summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--.gitmodules3
-rw-r--r--BUILD/FINISH.sh2
-rwxr-xr-xBUILD/SETUP.sh4
-rw-r--r--CMakeLists.txt7
-rw-r--r--Docs/INSTALL-BINARY2
-rw-r--r--VERSION6
-rw-r--r--client/client_priv.h2
-rw-r--r--client/mysql.cc5
-rw-r--r--client/mysqlbinlog.cc9
-rw-r--r--client/mysqldump.c58
-rw-r--r--client/mysqltest.cc9
-rw-r--r--cmake/abi_check.cmake2
-rw-r--r--cmake/build_configurations/mysql_release.cmake4
-rw-r--r--cmake/character_sets.cmake6
-rw-r--r--cmake/crc32.cmake37
-rw-r--r--cmake/do_abi_check.cmake3
-rw-r--r--cmake/os/Windows.cmake66
-rw-r--r--cmake/plugin.cmake26
-rw-r--r--config.h.cmake6
-rw-r--r--debian/additions/innotop/innotop59
-rw-r--r--debian/additions/innotop/innotop.112
-rw-r--r--debian/additions/mysql.init2
-rwxr-xr-xdebian/additions/mysqlreport6
-rw-r--r--debian/additions/mysqlreport.12
-rwxr-xr-xdebian/autobake-deb.sh10
-rw-r--r--debian/changelog6
-rw-r--r--debian/control124
-rw-r--r--debian/mariadb-client-10.5.README.Debian (renamed from debian/mariadb-client-10.4.README.Debian)0
-rw-r--r--debian/mariadb-client-10.5.docs (renamed from debian/mariadb-client-10.4.docs)0
-rw-r--r--debian/mariadb-client-10.5.install (renamed from debian/mariadb-client-10.4.install)0
-rw-r--r--debian/mariadb-client-10.5.links (renamed from debian/mariadb-client-10.4.links)0
-rw-r--r--debian/mariadb-client-10.5.manpages (renamed from debian/mariadb-client-10.4.manpages)0
-rw-r--r--debian/mariadb-client-10.5.menu (renamed from debian/mariadb-client-10.4.menu)2
-rw-r--r--debian/mariadb-client-core-10.5.install (renamed from debian/mariadb-client-core-10.4.install)0
-rw-r--r--debian/mariadb-client-core-10.5.links (renamed from debian/mariadb-client-core-10.4.links)0
-rw-r--r--debian/mariadb-plugin-tokudb.install2
-rw-r--r--debian/mariadb-server-10.5.README.Debian (renamed from debian/mariadb-server-10.4.README.Debian)0
-rw-r--r--debian/mariadb-server-10.5.config (renamed from debian/mariadb-server-10.4.config)0
-rw-r--r--debian/mariadb-server-10.5.dirs (renamed from debian/mariadb-server-10.4.dirs)0
-rw-r--r--debian/mariadb-server-10.5.install (renamed from debian/mariadb-server-10.4.install)4
-rw-r--r--debian/mariadb-server-10.5.links (renamed from debian/mariadb-server-10.4.links)0
-rw-r--r--debian/mariadb-server-10.5.logcheck.ignore.paranoid (renamed from debian/mariadb-server-10.4.logcheck.ignore.paranoid)0
-rw-r--r--debian/mariadb-server-10.5.logcheck.ignore.server (renamed from debian/mariadb-server-10.4.logcheck.ignore.server)0
-rw-r--r--debian/mariadb-server-10.5.logcheck.ignore.workstation (renamed from debian/mariadb-server-10.4.logcheck.ignore.workstation)0
-rw-r--r--debian/mariadb-server-10.5.mysql-server.logrotate (renamed from debian/mariadb-server-10.4.mysql-server.logrotate)0
-rw-r--r--debian/mariadb-server-10.5.mysql.default (renamed from debian/mariadb-server-10.4.mysql.default)0
-rw-r--r--debian/mariadb-server-10.5.postinst (renamed from debian/mariadb-server-10.4.postinst)2
-rw-r--r--debian/mariadb-server-10.5.postrm (renamed from debian/mariadb-server-10.4.postrm)4
-rw-r--r--debian/mariadb-server-10.5.preinst (renamed from debian/mariadb-server-10.4.preinst)4
-rw-r--r--debian/mariadb-server-10.5.prerm (renamed from debian/mariadb-server-10.4.prerm)0
-rw-r--r--debian/mariadb-server-10.5.py (renamed from debian/mariadb-server-10.4.py)4
-rw-r--r--debian/mariadb-server-10.5.templates (renamed from debian/mariadb-server-10.4.templates)8
-rw-r--r--debian/mariadb-server-10.5.triggers (renamed from debian/mariadb-server-10.4.triggers)0
-rw-r--r--debian/mariadb-server-core-10.5.install (renamed from debian/mariadb-server-core-10.4.install)0
-rw-r--r--debian/mariadb-server-core-10.5.links (renamed from debian/mariadb-server-core-10.4.links)0
-rw-r--r--debian/not-installed18
-rw-r--r--debian/po/POTFILES.in2
-rw-r--r--debian/po/ar.po46
-rw-r--r--debian/po/ca.po44
-rw-r--r--debian/po/cs.po46
-rw-r--r--debian/po/da.po46
-rw-r--r--debian/po/de.po44
-rw-r--r--debian/po/es.po46
-rw-r--r--debian/po/eu.po48
-rw-r--r--debian/po/fr.po48
-rw-r--r--debian/po/gl.po46
-rw-r--r--debian/po/it.po48
-rw-r--r--debian/po/ja.po48
-rw-r--r--debian/po/nb.po44
-rw-r--r--debian/po/nl.po46
-rw-r--r--debian/po/pt.po46
-rw-r--r--debian/po/pt_BR.po46
-rw-r--r--debian/po/ro.po44
-rw-r--r--debian/po/ru.po48
-rw-r--r--debian/po/sv.po48
-rw-r--r--debian/po/templates.pot46
-rw-r--r--debian/po/tr.po44
-rwxr-xr-xdebian/rules8
-rw-r--r--extra/crc32_armv8_neon/CMakeLists.txt8
-rw-r--r--extra/crc32_armv8_neon/crc32_armv8.c301
-rw-r--r--extra/mariabackup/CMakeLists.txt6
-rw-r--r--extra/mariabackup/backup_copy.cc7
-rw-r--r--extra/mariabackup/xtrabackup.cc17
-rw-r--r--include/aria_backup.h5
-rw-r--r--include/m_ctype.h16
-rw-r--r--include/ma_dyncol.h2
-rw-r--r--include/maria.h8
-rw-r--r--include/my_base.h2
-rw-r--r--include/my_bit.h41
-rw-r--r--include/my_global.h4
-rw-r--r--include/my_handler_errors.h2
-rw-r--r--include/my_pthread.h57
-rw-r--r--include/my_stack_alloc.h92
-rw-r--r--include/my_stacktrace.h4
-rw-r--r--include/my_sys.h12
-rw-r--r--include/myisam.h2
-rw-r--r--include/myisamchk.h20
-rw-r--r--include/mysql.h.pp13
-rw-r--r--include/mysql/plugin.h29
-rw-r--r--include/mysql/plugin_audit.h.pp197
-rw-r--r--include/mysql/plugin_auth.h.pp195
-rw-r--r--include/mysql/plugin_data_type.h49
-rw-r--r--include/mysql/plugin_data_type.h.pp629
-rw-r--r--include/mysql/plugin_encryption.h.pp193
-rw-r--r--include/mysql/plugin_ftparser.h.pp191
-rw-r--r--include/mysql/plugin_function_collection.h101
-rw-r--r--include/mysql/plugin_function_collection.h.pp679
-rw-r--r--include/mysql/plugin_password_validation.h.pp193
-rw-r--r--include/mysql/psi/mysql_socket.h15
-rw-r--r--include/mysql/service_wsrep.h7
-rw-r--r--include/mysql_com.h2
-rw-r--r--include/thread_pool_priv.h4
-rw-r--r--include/typelib.h2
-rw-r--r--include/wsrep.h6
-rw-r--r--libmysqld/CMakeLists.txt13
-rw-r--r--libmysqld/lib_sql.cc9
-rw-r--r--libmysqld/libmysql.c116
-rw-r--r--man/comp_err.14
-rw-r--r--man/galera_new_cluster.12
-rw-r--r--man/galera_recovery.12
-rw-r--r--man/innochecksum.14
-rw-r--r--man/mariabackup.12
-rw-r--r--man/mariadb-service-convert.12
-rw-r--r--man/mbstream.12
-rw-r--r--man/msql2mysql.14
-rw-r--r--man/my_print_defaults.14
-rw-r--r--man/my_safe_process.12
-rw-r--r--man/myisam_ftdump.14
-rw-r--r--man/myisamchk.14
-rw-r--r--man/myisamlog.14
-rw-r--r--man/myisampack.14
-rw-r--r--man/mysql-stress-test.pl.14
-rw-r--r--man/mysql-test-run.pl.14
-rw-r--r--man/mysql.14
-rw-r--r--man/mysql.server.14
-rw-r--r--man/mysql_client_test.14
-rw-r--r--man/mysql_config.14
-rw-r--r--man/mysql_convert_table_format.16
-rw-r--r--man/mysql_find_rows.14
-rw-r--r--man/mysql_fix_extensions.14
-rw-r--r--man/mysql_install_db.12
-rw-r--r--man/mysql_ldb.12
-rw-r--r--man/mysql_plugin.14
-rw-r--r--man/mysql_secure_installation.14
-rw-r--r--man/mysql_setpermission.16
-rw-r--r--man/mysql_tzinfo_to_sql.14
-rw-r--r--man/mysql_upgrade.14
-rw-r--r--man/mysql_waitpid.14
-rw-r--r--man/mysqlaccess.14
-rw-r--r--man/mysqladmin.12
-rw-r--r--man/mysqlbinlog.14
-rw-r--r--man/mysqlcheck.14
-rw-r--r--man/mysqld.84
-rw-r--r--man/mysqld_multi.14
-rw-r--r--man/mysqld_safe.14
-rw-r--r--man/mysqld_safe_helper.12
-rw-r--r--man/mysqldump.120
-rw-r--r--man/mysqldumpslow.14
-rw-r--r--man/mysqlhotcopy.14
-rw-r--r--man/mysqlimport.14
-rw-r--r--man/mysqlshow.14
-rw-r--r--man/mysqlslap.14
-rw-r--r--man/mysqltest.14
-rw-r--r--man/perror.14
-rw-r--r--man/replace.14
-rw-r--r--man/resolve_stack_dump.14
-rw-r--r--man/resolveip.14
-rw-r--r--man/tokuft_logprint.12
-rw-r--r--man/tokuftdump.14
-rw-r--r--man/wsrep_sst_common.12
-rw-r--r--man/wsrep_sst_mariabackup.12
-rw-r--r--man/wsrep_sst_mysqldump.12
-rw-r--r--man/wsrep_sst_rsync.12
-rw-r--r--man/wsrep_sst_rsync_wan.12
-rw-r--r--mysql-test/asan.supp1
-rw-r--r--mysql-test/include/common-tests.inc8
-rw-r--r--mysql-test/include/concurrent.inc36
-rw-r--r--mysql-test/include/galera_cluster.inc23
-rw-r--r--mysql-test/include/have_dbi_dbd-mariadb.inc (renamed from mysql-test/include/have_dbi_dbd-mysql.inc)10
-rw-r--r--mysql-test/include/have_s3.inc10
-rw-r--r--mysql-test/include/icp_tests.inc1
-rw-r--r--mysql-test/include/mysqlhotcopy.inc4
-rw-r--r--mysql-test/include/not_asan.inc8
-rw-r--r--mysql-test/include/search_pattern_in_file.inc13
-rw-r--r--mysql-test/include/shutdown_mysqld.inc10
-rw-r--r--mysql-test/include/wsrep_wait_condition.inc23
-rw-r--r--mysql-test/include/wsrep_wait_disconnect.inc20
-rw-r--r--mysql-test/include/wsrep_wait_membership.inc10
-rw-r--r--mysql-test/lsan.supp17
-rw-r--r--mysql-test/main/alter_table_debug.result26
-rw-r--r--mysql-test/main/alter_table_debug.test33
-rw-r--r--mysql-test/main/alter_table_online.result8
-rw-r--r--mysql-test/main/brackets.result2
-rw-r--r--mysql-test/main/column_compression.result16
-rw-r--r--mysql-test/main/column_compression.test29
-rw-r--r--mysql-test/main/comment_database.result78
-rw-r--r--mysql-test/main/comment_database.test63
-rw-r--r--mysql-test/main/compress.result8
-rw-r--r--mysql-test/main/concurrent_innodb_safelog-master.opt1
-rw-r--r--mysql-test/main/concurrent_innodb_safelog.result18
-rw-r--r--mysql-test/main/concurrent_innodb_safelog.test4
-rw-r--r--mysql-test/main/concurrent_innodb_unsafelog-master.opt2
-rw-r--r--mysql-test/main/concurrent_innodb_unsafelog.result34
-rw-r--r--mysql-test/main/concurrent_innodb_unsafelog.test8
-rw-r--r--mysql-test/main/cte_recursive.result12
-rw-r--r--mysql-test/main/cte_recursive.test12
-rw-r--r--mysql-test/main/ctype_latin1.result20
-rw-r--r--mysql-test/main/ctype_latin1.test18
-rw-r--r--mysql-test/main/ctype_utf8.result20
-rw-r--r--mysql-test/main/ctype_utf8.test19
-rw-r--r--mysql-test/main/ctype_utf8_def_upgrade.result8
-rw-r--r--mysql-test/main/except.result2
-rw-r--r--mysql-test/main/except.test2
-rw-r--r--mysql-test/main/except_all.result660
-rw-r--r--mysql-test/main/except_all.test99
-rw-r--r--mysql-test/main/frm-debug.result24
-rw-r--r--mysql-test/main/frm-debug.test22
-rw-r--r--mysql-test/main/func_debug.result8
-rw-r--r--mysql-test/main/func_gconcat.result2
-rw-r--r--mysql-test/main/func_hybrid_type.result196
-rw-r--r--mysql-test/main/func_hybrid_type.test253
-rw-r--r--mysql-test/main/func_json.result150
-rw-r--r--mysql-test/main/func_json.test90
-rw-r--r--mysql-test/main/func_misc.result3
-rw-r--r--mysql-test/main/func_time.result6
-rw-r--r--mysql-test/main/gis-debug.result79
-rw-r--r--mysql-test/main/gis-debug.test51
-rw-r--r--mysql-test/main/gis.result796
-rw-r--r--mysql-test/main/gis.test67
-rw-r--r--mysql-test/main/group_by.result21
-rw-r--r--mysql-test/main/group_by.test21
-rw-r--r--mysql-test/main/information_schema.result20
-rw-r--r--mysql-test/main/innodb_icp.result6
-rw-r--r--mysql-test/main/innodb_mysql_lock2.result3
-rw-r--r--mysql-test/main/innodb_mysql_lock2.test3
-rw-r--r--mysql-test/main/intersect.result44
-rw-r--r--mysql-test/main/intersect.test22
-rw-r--r--mysql-test/main/intersect_all.result888
-rw-r--r--mysql-test/main/intersect_all.test328
-rw-r--r--mysql-test/main/myisam_icp.result6
-rw-r--r--mysql-test/main/mysqld--help.result26
-rw-r--r--mysql-test/main/mysqld--help.test5
-rw-r--r--mysql-test/main/mysqltest_tracking_info.result10
-rw-r--r--mysql-test/main/mysqltest_tracking_info.test11
-rw-r--r--mysql-test/main/named_pipe.result8
-rw-r--r--mysql-test/main/openssl_1.test1
-rw-r--r--mysql-test/main/parser.result44
-rw-r--r--mysql-test/main/parser.test58
-rw-r--r--mysql-test/main/pool_of_threads.result8
-rw-r--r--mysql-test/main/range.result293
-rw-r--r--mysql-test/main/range.test184
-rw-r--r--mysql-test/main/range_mrr_icp.result293
-rw-r--r--mysql-test/main/repair.result6
-rw-r--r--mysql-test/main/select.result8
-rw-r--r--mysql-test/main/select.test8
-rw-r--r--mysql-test/main/select_jcl6.result8
-rw-r--r--mysql-test/main/select_pkeycache.result8
-rw-r--r--mysql-test/main/set_operation.result1157
-rw-r--r--mysql-test/main/set_operation.test526
-rw-r--r--mysql-test/main/set_operation_oracle.result75
-rw-r--r--mysql-test/main/set_operation_oracle.test65
-rw-r--r--mysql-test/main/sp-big.result4
-rw-r--r--mysql-test/main/sp-big.test13
-rw-r--r--mysql-test/main/sp-code.result25
-rw-r--r--mysql-test/main/sp-code.test16
-rw-r--r--mysql-test/main/sp-row.result4
-rw-r--r--mysql-test/main/sp-row.test4
-rw-r--r--mysql-test/main/sp_gis.result72
-rw-r--r--mysql-test/main/sp_gis.test63
-rw-r--r--mysql-test/main/ssl.result8
-rw-r--r--mysql-test/main/ssl_compress.result8
-rw-r--r--mysql-test/main/subselect.result4
-rw-r--r--mysql-test/main/subselect.test4
-rw-r--r--mysql-test/main/subselect_cache.result6
-rw-r--r--mysql-test/main/subselect_cache.test6
-rw-r--r--mysql-test/main/subselect_mat.result5
-rw-r--r--mysql-test/main/subselect_no_exists_to_in.result4
-rw-r--r--mysql-test/main/subselect_no_mat.result4
-rw-r--r--mysql-test/main/subselect_no_opts.result4
-rw-r--r--mysql-test/main/subselect_no_scache.result4
-rw-r--r--mysql-test/main/subselect_no_semijoin.result4
-rw-r--r--mysql-test/main/subselect_sj_mat.result5
-rw-r--r--mysql-test/main/subselect_sj_mat.test5
-rw-r--r--mysql-test/main/table_value_constr.result4
-rw-r--r--mysql-test/main/tc_heuristic_recover.test4
-rw-r--r--mysql-test/main/thread_pool_info.opt1
-rw-r--r--mysql-test/main/thread_pool_info.result89
-rw-r--r--mysql-test/main/thread_pool_info.test41
-rw-r--r--mysql-test/main/type_bit.result23
-rw-r--r--mysql-test/main/type_bit.test23
-rw-r--r--mysql-test/main/type_blob.result4
-rw-r--r--mysql-test/main/type_blob.test4
-rw-r--r--mysql-test/main/type_int.result15
-rw-r--r--mysql-test/main/type_int.test18
-rw-r--r--mysql-test/main/type_row.result51
-rw-r--r--mysql-test/main/type_row.test62
-rw-r--r--mysql-test/main/type_varchar.result29
-rw-r--r--mysql-test/main/type_varchar.test23
-rw-r--r--mysql-test/main/type_year.result26
-rw-r--r--mysql-test/main/type_year.test24
-rw-r--r--mysql-test/main/unsafe_binlog_innodb-master.opt1
-rw-r--r--mysql-test/main/unsafe_binlog_innodb.result6
-rw-r--r--mysql-test/main/unsafe_binlog_innodb.test8
-rw-r--r--mysql-test/main/user_var.result2
-rw-r--r--mysql-test/main/variables.result19
-rw-r--r--mysql-test/main/variables.test16
-rw-r--r--mysql-test/main/view.result5
-rw-r--r--mysql-test/main/view.test5
-rw-r--r--mysql-test/main/win.result5
-rw-r--r--mysql-test/main/win.test5
-rwxr-xr-xmysql-test/mysql-test-run.pl26
-rwxr-xr-xmysql-test/std_data/checkDBI_DBD-MariaDB.pl (renamed from mysql-test/std_data/checkDBI_DBD-mysql.pl)26
-rw-r--r--mysql-test/std_data/s3_unique_table.frmbin0 -> 512 bytes
-rw-r--r--mysql-test/suite/binlog/include/print_optional_metadata.inc34
-rw-r--r--mysql-test/suite/binlog/r/binlog_table_map_optional_metadata.result312
-rw-r--r--mysql-test/suite/binlog/r/binlog_table_map_optional_metadata_binary.result64
-rw-r--r--mysql-test/suite/binlog/r/binlog_table_map_optional_metadata_ucs2.result64
-rw-r--r--mysql-test/suite/binlog/r/binlog_table_map_optional_metadata_utf32.result64
-rw-r--r--mysql-test/suite/binlog/t/binlog_table_map_optional_metadata.test333
-rw-r--r--mysql-test/suite/binlog/t/binlog_table_map_optional_metadata_binary.test73
-rw-r--r--mysql-test/suite/binlog/t/binlog_table_map_optional_metadata_ucs2.test74
-rw-r--r--mysql-test/suite/binlog/t/binlog_table_map_optional_metadata_utf32.test74
-rw-r--r--mysql-test/suite/compat/oracle/r/gis-debug.result24
-rw-r--r--mysql-test/suite/compat/oracle/r/gis.result63
-rw-r--r--mysql-test/suite/compat/oracle/r/parser.result48
-rw-r--r--mysql-test/suite/compat/oracle/r/sp-code.result27
-rw-r--r--mysql-test/suite/compat/oracle/r/sp-row.result4
-rw-r--r--mysql-test/suite/compat/oracle/r/table_value_constr.result4
-rw-r--r--mysql-test/suite/compat/oracle/t/gis-debug.test31
-rw-r--r--mysql-test/suite/compat/oracle/t/gis.test72
-rw-r--r--mysql-test/suite/compat/oracle/t/parser.test63
-rw-r--r--mysql-test/suite/compat/oracle/t/sp-code.test31
-rw-r--r--mysql-test/suite/compat/oracle/t/sp-row.test4
-rw-r--r--mysql-test/suite/encryption/r/corrupted_during_recovery.result2
-rw-r--r--mysql-test/suite/encryption/r/innodb_encrypt_log.result2
-rw-r--r--mysql-test/suite/encryption/t/corrupted_during_recovery.test2
-rw-r--r--mysql-test/suite/engines/funcs/r/db_alter_character_set.result560
-rw-r--r--mysql-test/suite/engines/funcs/r/db_alter_character_set_collate.result168
-rw-r--r--mysql-test/suite/engines/funcs/r/db_alter_collate_ascii.result224
-rw-r--r--mysql-test/suite/engines/funcs/r/db_alter_collate_utf8.result2352
-rw-r--r--mysql-test/suite/engines/funcs/r/db_create_character_set.result140
-rw-r--r--mysql-test/suite/engines/funcs/r/db_create_character_set_collate.result84
-rw-r--r--mysql-test/suite/federated/federated_type_inet6.result24
-rw-r--r--mysql-test/suite/federated/federated_type_inet6.test17
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_is.result2
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_is_embedded.result2
-rw-r--r--mysql-test/suite/funcs_1/r/is_schemata.result29
-rw-r--r--mysql-test/suite/funcs_1/r/is_schemata_embedded.result35
-rw-r--r--mysql-test/suite/funcs_1/r/is_schemata_is_mysql_test.result14
-rw-r--r--mysql-test/suite/funcs_1/r/storedproc.result60
-rw-r--r--mysql-test/suite/funcs_1/t/storedproc.test32
-rw-r--r--mysql-test/suite/galera/include/kill_galera.inc9
-rw-r--r--mysql-test/suite/galera/r/GCF-360.result24
-rw-r--r--mysql-test/suite/galera/r/galera-features#117.result37
-rw-r--r--mysql-test/suite/galera/r/galera_gra_log.result9
-rw-r--r--mysql-test/suite/galera/r/galera_vote_rejoin_ddl.result60
-rw-r--r--mysql-test/suite/galera/r/galera_vote_rejoin_dml.result73
-rw-r--r--mysql-test/suite/galera/t/GCF-360.cnf17
-rw-r--r--mysql-test/suite/galera/t/GCF-360.test65
-rw-r--r--mysql-test/suite/galera/t/galera-features#117.cnf5
-rw-r--r--mysql-test/suite/galera/t/galera-features#117.test38
-rw-r--r--mysql-test/suite/galera/t/galera_gra_log.test19
-rw-r--r--mysql-test/suite/galera/t/galera_load_data.cnf3
-rw-r--r--mysql-test/suite/galera/t/galera_vote_rejoin_ddl.cnf4
-rw-r--r--mysql-test/suite/galera/t/galera_vote_rejoin_ddl.test83
-rw-r--r--mysql-test/suite/galera/t/galera_vote_rejoin_dml.cnf7
-rw-r--r--mysql-test/suite/galera/t/galera_vote_rejoin_dml.test99
-rw-r--r--mysql-test/suite/galera_3nodes/r/GCF-354.result52
-rw-r--r--mysql-test/suite/galera_3nodes/r/GCF-363.result46
-rw-r--r--mysql-test/suite/galera_3nodes/r/GCF-376.result71
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera-features#119.result33
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_evs_suspect_timeout.result1
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_pc_weight.result176
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_toi_vote.result22
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_vote_rejoin_mysqldump.result83
-rw-r--r--mysql-test/suite/galera_3nodes/r/inconsistency_shutdown.result140
-rw-r--r--mysql-test/suite/galera_3nodes/t/GCF-354.cnf5
-rw-r--r--mysql-test/suite/galera_3nodes/t/GCF-354.test92
-rw-r--r--mysql-test/suite/galera_3nodes/t/GCF-363.cnf8
-rw-r--r--mysql-test/suite/galera_3nodes/t/GCF-363.test63
-rw-r--r--mysql-test/suite/galera_3nodes/t/GCF-376.cnf4
-rw-r--r--mysql-test/suite/galera_3nodes/t/GCF-376.test94
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera-features#119.test72
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.test5
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_pc_weight.test68
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_toi_vote.cnf5
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_toi_vote.test67
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_vote_rejoin_mysqldump.cnf4
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_vote_rejoin_mysqldump.test93
-rw-r--r--mysql-test/suite/galera_3nodes/t/inconsistency_shutdown.cnf9
-rw-r--r--mysql-test/suite/galera_3nodes/t/inconsistency_shutdown.test179
-rw-r--r--mysql-test/suite/galera_3nodes_sr/r/galera_vote_sr.result195
-rw-r--r--mysql-test/suite/galera_3nodes_sr/t/galera_vote_sr-master.opt2
-rw-r--r--mysql-test/suite/galera_3nodes_sr/t/galera_vote_sr.inc79
-rw-r--r--mysql-test/suite/galera_3nodes_sr/t/galera_vote_sr.test37
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_mysqldump_sst.test5
-rw-r--r--mysql-test/suite/gcol/inc/gcol_ins_upd.inc6
-rw-r--r--mysql-test/suite/gcol/r/gcol_bugfixes.result1
-rw-r--r--mysql-test/suite/gcol/r/gcol_ins_upd_myisam.result14
-rw-r--r--mysql-test/suite/gcol/r/innodb_virtual_stats.result12
-rw-r--r--mysql-test/suite/gcol/t/innodb_virtual_stats.test4
-rw-r--r--mysql-test/suite/innodb/include/show_i_s_tables.inc3
-rw-r--r--mysql-test/suite/innodb/include/show_i_s_tablespaces.inc1
-rw-r--r--mysql-test/suite/innodb/include/wait_all_purged.inc5
-rw-r--r--mysql-test/suite/innodb/r/alter_inplace_perfschema.result2
-rw-r--r--mysql-test/suite/innodb/r/ibuf_not_empty.result3
-rw-r--r--mysql-test/suite/innodb/r/innodb-analyze.result4
-rw-r--r--mysql-test/suite/innodb/r/innodb-stats-modified-counter.result8
-rw-r--r--mysql-test/suite/innodb/r/innodb-stats-sample.result4
-rw-r--r--mysql-test/suite/innodb/r/innodb-system-table-view.result20
-rw-r--r--mysql-test/suite/innodb/r/innodb-wl5522-debug.result6
-rw-r--r--mysql-test/suite/innodb/r/innodb-wl5522.result10
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug12400341.result3
-rw-r--r--mysql-test/suite/innodb/r/innodb_force_recovery.result23
-rw-r--r--mysql-test/suite/innodb/r/innodb_information_schema.result4
-rw-r--r--mysql-test/suite/innodb/r/innodb_lock_wait_timeout_1.result12
-rw-r--r--mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result503
-rw-r--r--mysql-test/suite/innodb/r/monitor.result96
-rw-r--r--mysql-test/suite/innodb/r/undo_truncate.result3
-rw-r--r--mysql-test/suite/innodb/r/undo_truncate_recover.result1
-rw-r--r--mysql-test/suite/innodb/t/alter_copy.test2
-rw-r--r--mysql-test/suite/innodb/t/innodb-analyze.test32
-rw-r--r--mysql-test/suite/innodb/t/innodb-stats-sample.test32
-rw-r--r--mysql-test/suite/innodb/t/innodb-wl5522-debug.test5
-rw-r--r--mysql-test/suite/innodb/t/innodb-wl5522.test5
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug12400341-master.opt2
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug12400341.test5
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug53674-master.opt2
-rw-r--r--mysql-test/suite/innodb/t/innodb_force_recovery.test25
-rw-r--r--mysql-test/suite/innodb/t/innodb_lock_wait_timeout_1.test16
-rw-r--r--mysql-test/suite/innodb/t/log_file_name.test1
-rw-r--r--mysql-test/suite/innodb/t/monitor.test91
-rw-r--r--mysql-test/suite/innodb/t/recovery_shutdown.test3
-rw-r--r--mysql-test/suite/innodb/t/undo_truncate.test3
-rw-r--r--mysql-test/suite/innodb/t/undo_truncate_recover.test1
-rw-r--r--mysql-test/suite/innodb_gis/r/1.result4
-rw-r--r--mysql-test/suite/innodb_gis/r/alter_spatial_index.result6
-rw-r--r--mysql-test/suite/innodb_gis/r/create_spatial_index.result2
-rw-r--r--mysql-test/suite/innodb_gis/r/gis.result4
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_buffer_page.result24
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_buffer_page.test3
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_buffer_page_lru.result24
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_buffer_page_lru.test3
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_buffer_pool_stats.result36
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_buffer_pool_stats.test3
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_cmp.opt1
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_cmp.result10
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_cmp.test3
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_cmp_per_index.result12
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_cmp_per_index.test3
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_cmp_per_index_reset.opt1
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_cmp_per_index_reset.result12
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_cmp_per_index_reset.test3
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_cmp_reset.opt1
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_cmp_reset.result10
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_cmp_reset.test3
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_cmpmem.result10
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_cmpmem.test3
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_cmpmem_reset.opt1
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_cmpmem_reset.result10
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_cmpmem_reset.test3
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_ft_being_deleted.opt1
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_ft_being_deleted.result5
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_ft_being_deleted.test3
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_ft_config.opt1
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_ft_config.result6
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_ft_config.test3
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_ft_default_stopword.opt1
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_ft_default_stopword.result5
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_ft_default_stopword.test3
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_ft_deleted.opt1
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_ft_deleted.result5
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_ft_deleted.test3
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_ft_index_cache.opt1
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_ft_index_cache.result10
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_ft_index_cache.test3
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_ft_index_table.opt1
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_ft_index_table.result10
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_ft_index_table.test3
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_lock_waits.result8
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_lock_waits.test3
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_locks.result14
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_locks.test3
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_metrics.result21
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_metrics.test3
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_mutexes.opt1
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_mutexes.result8
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_mutexes.test3
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_sys_columns.result10
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_sys_columns.test3
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_sys_datafiles.opt1
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_sys_datafiles.result6
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_sys_datafiles.test3
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_sys_fields.result7
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_sys_fields.test3
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_sys_foreign.result9
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_sys_foreign.test3
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_sys_foreign_cols.result8
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_sys_foreign_cols.test3
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_sys_indexes.result12
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_sys_indexes.test3
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_sys_semaphore_waits.opt1
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_sys_semaphore_waits.result24
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_sys_semaphore_waits.test3
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_sys_tables.result12
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_sys_tables.test3
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_sys_tablespaces.opt1
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_sys_tablespaces.result13
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_sys_tablespaces.test3
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_sys_tablestats.opt1
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_sys_tablestats.result13
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_sys_tablestats.test3
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_sys_virtual.result7
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_sys_virtual.test3
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_tablespaces_encryption.opt1
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_tablespaces_encryption.result14
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_tablespaces_encryption.test3
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_tablespaces_scrubbing.opt1
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_tablespaces_scrubbing.result13
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_tablespaces_scrubbing.test3
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_trx.result26
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_trx.test3
-rw-r--r--mysql-test/suite/innodb_zip/r/16k,full_crc32.rdiff16
-rw-r--r--mysql-test/suite/innodb_zip/r/16k,strict_full_crc32.rdiff16
-rw-r--r--mysql-test/suite/innodb_zip/r/page_size,4k.rdiff12
-rw-r--r--mysql-test/suite/innodb_zip/r/page_size,8k.rdiff12
-rw-r--r--mysql-test/suite/innodb_zip/r/page_size.result10
-rw-r--r--mysql-test/suite/innodb_zip/r/restart.result224
-rw-r--r--mysql-test/suite/innodb_zip/r/wl5522_debug_zip.result6
-rw-r--r--mysql-test/suite/innodb_zip/r/wl5522_zip.result4
-rw-r--r--mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test5
-rw-r--r--mysql-test/suite/maria/icp.result6
-rw-r--r--mysql-test/suite/maria/maria-autozerofill.test7
-rw-r--r--mysql-test/suite/maria/maria-ucs2.result8
-rw-r--r--mysql-test/suite/maria/maria-ucs2.test2
-rw-r--r--mysql-test/suite/maria/maria.result46
-rw-r--r--mysql-test/suite/maria/maria.test6
-rw-r--r--mysql-test/suite/maria/maria3.result4
-rw-r--r--mysql-test/suite/maria/max_length.result23
-rw-r--r--mysql-test/suite/maria/max_length.test6
-rw-r--r--mysql-test/suite/maria/mrr.result10
-rw-r--r--mysql-test/suite/maria/mrr.test4
-rw-r--r--mysql-test/suite/mariabackup/absolute_ibdata_paths.opt1
-rw-r--r--mysql-test/suite/perfschema/include/event_aggregate_load.inc3
-rw-r--r--mysql-test/suite/perfschema/include/event_aggregate_setup.inc21
-rw-r--r--mysql-test/suite/perfschema/r/event_aggregate.result306
-rw-r--r--mysql-test/suite/perfschema/r/event_aggregate_no_a.result210
-rw-r--r--mysql-test/suite/perfschema/r/event_aggregate_no_a_no_h.result179
-rw-r--r--mysql-test/suite/perfschema/r/event_aggregate_no_a_no_u.result110
-rw-r--r--mysql-test/suite/perfschema/r/event_aggregate_no_a_no_u_no_h.result79
-rw-r--r--mysql-test/suite/perfschema/r/event_aggregate_no_h.result275
-rw-r--r--mysql-test/suite/perfschema/r/event_aggregate_no_u.result206
-rw-r--r--mysql-test/suite/perfschema/r/event_aggregate_no_u_no_h.result175
-rw-r--r--mysql-test/suite/perfschema/r/server_init.result4
-rw-r--r--mysql-test/suite/perfschema/t/server_init.test3
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_big_table_id,32bit.rdiff58
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_big_table_id.result58
-rw-r--r--mysql-test/suite/rpl/r/rpl_show_slave_hosts.result4
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_big_table_id.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_big_table_id.test12
-rw-r--r--mysql-test/suite/s3/alter.result122
-rw-r--r--mysql-test/suite/s3/alter.test96
-rw-r--r--mysql-test/suite/s3/alter2.result22
-rw-r--r--mysql-test/suite/s3/alter2.test32
-rw-r--r--mysql-test/suite/s3/amazon.result7
-rw-r--r--mysql-test/suite/s3/amazon.test27
-rw-r--r--mysql-test/suite/s3/arguments.result58
-rw-r--r--mysql-test/suite/s3/arguments.test54
-rw-r--r--mysql-test/suite/s3/backup.result18
-rw-r--r--mysql-test/suite/s3/backup.test33
-rw-r--r--mysql-test/suite/s3/basic.result106
-rw-r--r--mysql-test/suite/s3/basic.test55
-rw-r--r--mysql-test/suite/s3/create_database.inc10
-rw-r--r--mysql-test/suite/s3/discovery.result57
-rw-r--r--mysql-test/suite/s3/discovery.test84
-rw-r--r--mysql-test/suite/s3/drop_database.inc9
-rw-r--r--mysql-test/suite/s3/encryption.opt4
-rw-r--r--mysql-test/suite/s3/encryption.result23
-rw-r--r--mysql-test/suite/s3/encryption.test36
-rw-r--r--mysql-test/suite/s3/innodb.result31
-rw-r--r--mysql-test/suite/s3/innodb.test35
-rw-r--r--mysql-test/suite/s3/my.cnf11
-rw-r--r--mysql-test/suite/s3/mysqldump.result60
-rw-r--r--mysql-test/suite/s3/mysqldump.test33
-rw-r--r--mysql-test/suite/s3/no_s3-master.opt1
-rw-r--r--mysql-test/suite/s3/no_s3.result13
-rw-r--r--mysql-test/suite/s3/no_s3.test25
-rw-r--r--mysql-test/suite/s3/partitions-master.opt1
-rw-r--r--mysql-test/suite/s3/partitions.result128
-rw-r--r--mysql-test/suite/s3/partitions.test113
-rw-r--r--mysql-test/suite/s3/select.result8
-rw-r--r--mysql-test/suite/s3/select.test17
-rw-r--r--mysql-test/suite/s3/suite.pm8
-rw-r--r--mysql-test/suite/s3/unsupported.result8
-rw-r--r--mysql-test/suite/s3/unsupported.test31
-rw-r--r--mysql-test/suite/sys_vars/inc/sysvars_server.inc1
-rw-r--r--mysql-test/suite/sys_vars/r/big_tables_basic.result28
-rw-r--r--mysql-test/suite/sys_vars/r/binlog_row_metadata_basic.result90
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_checksum_algorithm_basic.result4
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_checksums_basic.result53
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_disable_background_merge_basic.result4
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_locks_unsafe_for_binlog_basic.result53
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_log_checksums_basic.result10
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_rollback_segments_basic.result64
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_stats_sample_pages_basic.result77
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_stats_transient_sample_pages_basic.result6
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_undo_logs_basic.result100
-rw-r--r--mysql-test/suite/sys_vars/r/max_long_data_size_basic.result14
-rw-r--r--mysql-test/suite/sys_vars/r/optimizer_switch_basic.result32
-rw-r--r--mysql-test/suite/sys_vars/r/session_track_system_variables_basic.result10
-rw-r--r--mysql-test/suite/sys_vars/r/sql_big_tables_basic.result109
-rw-r--r--mysql-test/suite/sys_vars/r/sql_big_tables_func.result96
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff815
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb.result70
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff289
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_server_embedded.result29
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff305
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result61
-rw-r--r--mysql-test/suite/sys_vars/r/thread_pool_stall_limit_basic.result2
-rw-r--r--mysql-test/suite/sys_vars/r/tmp_disk_table_size_func.result2
-rw-r--r--mysql-test/suite/sys_vars/r/tmp_memory_table_size_basic.result165
-rw-r--r--mysql-test/suite/sys_vars/r/tmp_table_size_basic.result146
-rw-r--r--mysql-test/suite/sys_vars/t/binlog_row_metadata_basic.test121
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_checksums_basic.test106
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_disable_background_merge_basic.test12
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_locks_unsafe_for_binlog_basic.test106
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_rollback_segments_basic.test64
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_stats_sample_pages_basic.test72
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_stats_transient_sample_pages_basic.test4
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_undo_logs_basic.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_undo_logs_basic.test125
-rw-r--r--mysql-test/suite/sys_vars/t/max_long_data_size_basic.test17
-rw-r--r--mysql-test/suite/sys_vars/t/session_track_system_variables_basic.test4
-rw-r--r--mysql-test/suite/sys_vars/t/thread_pool_stall_limit_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/tmp_memory_table_size_basic.test209
-rw-r--r--mysql-test/suite/sys_vars/t/tmp_table_size_basic.test207
-rw-r--r--mysql-test/suite/vcol/r/vcol_keys_innodb.result7
-rw-r--r--mysql-test/suite/vcol/r/vcol_sql_mode.result213
-rw-r--r--mysql-test/suite/vcol/r/vcol_sql_mode_datetime.result20
-rw-r--r--mysql-test/suite/vcol/r/vcol_sql_mode_time.result20
-rw-r--r--mysql-test/suite/vcol/r/vcol_sql_mode_timestamp.result25
-rw-r--r--mysql-test/suite/vcol/r/vcol_sql_mode_upgrade.result94
-rw-r--r--mysql-test/suite/vcol/t/vcol_keys_innodb.test2
-rw-r--r--mysql-test/suite/vcol/t/vcol_sql_mode.test83
-rw-r--r--mysql-test/suite/vcol/t/vcol_sql_mode_datetime.test12
-rw-r--r--mysql-test/suite/vcol/t/vcol_sql_mode_time.test12
-rw-r--r--mysql-test/suite/vcol/t/vcol_sql_mode_timestamp.test12
-rw-r--r--mysql-test/suite/vcol/t/vcol_sql_mode_upgrade.test20
-rw-r--r--mysql-test/suite/versioning/r/create.result2
-rw-r--r--mysql-test/suite/versioning/r/select.result5
-rw-r--r--mysql-test/suite/versioning/r/select2,trx_id.rdiff6
-rw-r--r--mysql-test/suite/versioning/r/select2.result2
-rw-r--r--mysql-test/suite/versioning/r/trx_id.result61
-rw-r--r--mysql-test/suite/versioning/r/view.result2
-rw-r--r--mysql-test/suite/versioning/t/select.test13
-rw-r--r--mysql-test/suite/versioning/t/select2.test6
-rw-r--r--mysql-test/suite/versioning/t/trx_id.test71
-rw-r--r--mysql-test/valgrind.supp208
-rw-r--r--mysys/charset-def.c132
-rw-r--r--mysys/charset.c10
-rw-r--r--mysys/my_addr_resolve.c68
-rw-r--r--mysys/my_error.c4
-rw-r--r--mysys/my_getsystime.c30
-rw-r--r--mysys/my_init.c152
-rw-r--r--mysys/my_pthread.c63
-rw-r--r--mysys/my_winfile.c13
-rw-r--r--mysys/stacktrace.c45
-rw-r--r--mysys/thr_rwlock.c139
-rw-r--r--mysys/typelib.c2
-rw-r--r--pcre/pcretest.c2
-rw-r--r--plugin/auth_gssapi/server_plugin.cc3
-rw-r--r--plugin/disks/information_schema_disks.cc25
-rw-r--r--plugin/feedback/feedback.cc11
-rw-r--r--plugin/func_test/CMakeLists.txt17
-rw-r--r--plugin/func_test/mysql-test/func_test/func_test.result28
-rw-r--r--plugin/func_test/mysql-test/func_test/func_test.test23
-rw-r--r--plugin/func_test/mysql-test/func_test/suite.opt1
-rw-r--r--plugin/func_test/mysql-test/func_test/suite.pm9
-rw-r--r--plugin/func_test/plugin.cc96
-rwxr-xr-xplugin/handler_socket/client/hspool_test.pl4
-rwxr-xr-xplugin/handler_socket/client/hstest.pl4
-rw-r--r--plugin/handler_socket/regtest/common/hstest.pm8
-rw-r--r--plugin/locale_info/locale_info.cc28
-rw-r--r--plugin/metadata_lock_info/metadata_lock_info.cc29
-rw-r--r--plugin/qc_info/qc_info.cc59
-rw-r--r--plugin/query_response_time/plugin.cc15
-rw-r--r--plugin/type_geom/CMakeLists.txt3
-rw-r--r--plugin/type_geom/plugin.cc254
-rw-r--r--plugin/type_inet/CMakeLists.txt18
-rw-r--r--plugin/type_inet/item_inetfunc.cc256
-rw-r--r--plugin/type_inet/item_inetfunc.h (renamed from sql/item_inetfunc.h)1
-rw-r--r--plugin/type_inet/mysql-test/type_inet/binlog_stm_type_inet6.result34
-rw-r--r--plugin/type_inet/mysql-test/type_inet/binlog_stm_type_inet6.test28
-rw-r--r--plugin/type_inet/mysql-test/type_inet/func_inet_plugin.result31
-rw-r--r--plugin/type_inet/mysql-test/type_inet/func_inet_plugin.test27
-rw-r--r--plugin/type_inet/mysql-test/type_inet/rpl_type_inet6.result17
-rw-r--r--plugin/type_inet/mysql-test/type_inet/rpl_type_inet6.test16
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6-debug.result18
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6-debug.test14
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6.result1933
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6.test1413
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_csv.result70
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_csv.test51
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_engines.inc38
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_innodb.result104
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_innodb.test18
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_memory.result163
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_memory.test18
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_myisam.result104
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_myisam.test18
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_mysql.result15
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_mysql.test6
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_plugin.result31
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_plugin.test27
-rw-r--r--plugin/type_inet/plugin.cc215
-rw-r--r--plugin/type_inet/sql_type_inet.cc1538
-rw-r--r--plugin/type_inet/sql_type_inet.h988
-rw-r--r--plugin/type_test/CMakeLists.txt17
-rw-r--r--plugin/type_test/mysql-test/type_test/suite.opt1
-rw-r--r--plugin/type_test/mysql-test/type_test/suite.pm10
-rw-r--r--plugin/type_test/mysql-test/type_test/type_test_double-debug.result35
-rw-r--r--plugin/type_test/mysql-test/type_test/type_test_double-debug.test32
-rw-r--r--plugin/type_test/mysql-test/type_test/type_test_double.result704
-rw-r--r--plugin/type_test/mysql-test/type_test/type_test_double.test530
-rw-r--r--plugin/type_test/mysql-test/type_test/type_test_int8-debug.result35
-rw-r--r--plugin/type_test/mysql-test/type_test/type_test_int8-debug.test32
-rw-r--r--plugin/type_test/mysql-test/type_test/type_test_int8.result683
-rw-r--r--plugin/type_test/mysql-test/type_test/type_test_int8.test518
-rw-r--r--plugin/type_test/mysql-test/type_test/type_test_mysql.result27
-rw-r--r--plugin/type_test/mysql-test/type_test/type_test_mysql.test6
-rw-r--r--plugin/type_test/plugin.cc333
-rw-r--r--plugin/user_variables/user_variables.cc18
-rw-r--r--plugin/userstat/client_stats.cc58
-rw-r--r--plugin/userstat/index_stats.cc16
-rw-r--r--plugin/userstat/table_stats.cc18
-rw-r--r--plugin/userstat/user_stats.cc58
-rw-r--r--plugin/wsrep_info/plugin.cc43
-rw-r--r--scripts/fill_help_tables.sql1706
-rw-r--r--scripts/mysql_convert_table_format.sh4
-rw-r--r--scripts/mysql_setpermission.sh2
-rw-r--r--scripts/mysqlhotcopy.sh8
-rw-r--r--scripts/mytop.sh6
-rw-r--r--sql-bench/server-cfg.sh4
-rw-r--r--sql-common/client.c39
-rw-r--r--sql/CMakeLists.txt34
-rw-r--r--sql/debug_sync.cc4
-rw-r--r--sql/event_db_repository.cc4
-rw-r--r--sql/field.cc1029
-rw-r--r--sql/field.h2314
-rw-r--r--sql/field_conv.cc8
-rw-r--r--sql/ha_partition.cc26
-rw-r--r--sql/ha_partition.h2
-rw-r--r--sql/ha_sequence.cc3
-rw-r--r--sql/handle_connections_win.cc9
-rw-r--r--sql/handler.cc425
-rw-r--r--sql/handler.h72
-rw-r--r--sql/item.cc259
-rw-r--r--sql/item.h428
-rw-r--r--sql/item_cmpfunc.cc165
-rw-r--r--sql/item_cmpfunc.h19
-rw-r--r--sql/item_create.cc2056
-rw-r--r--sql/item_create.h105
-rw-r--r--sql/item_func.cc86
-rw-r--r--sql/item_func.h207
-rw-r--r--sql/item_geofunc.cc1320
-rw-r--r--sql/item_geofunc.h167
-rw-r--r--sql/item_inetfunc.cc967
-rw-r--r--sql/item_jsonfunc.cc133
-rw-r--r--sql/item_jsonfunc.h139
-rw-r--r--sql/item_row.cc19
-rw-r--r--sql/item_row.h3
-rw-r--r--sql/item_strfunc.cc77
-rw-r--r--sql/item_strfunc.h4
-rw-r--r--sql/item_subselect.cc58
-rw-r--r--sql/item_sum.cc55
-rw-r--r--sql/item_sum.h50
-rw-r--r--sql/item_timefunc.cc105
-rw-r--r--sql/item_timefunc.h54
-rw-r--r--sql/item_windowfunc.cc3
-rw-r--r--sql/item_windowfunc.h11
-rw-r--r--sql/item_xmlfunc.cc254
-rw-r--r--sql/item_xmlfunc.h40
-rw-r--r--sql/lex.h9
-rw-r--r--sql/lex_string.h38
-rw-r--r--sql/log.cc114
-rw-r--r--sql/log.h16
-rw-r--r--sql/log_event.cc11565
-rw-r--r--sql/log_event.h302
-rw-r--r--sql/log_event_client.cc3902
-rw-r--r--sql/log_event_server.cc8311
-rw-r--r--sql/mysql_install_db.cc2
-rw-r--r--sql/mysql_upgrade_service.cc2
-rw-r--r--sql/mysqld.cc475
-rw-r--r--sql/mysqld.h13
-rw-r--r--sql/opt_range.cc30
-rw-r--r--sql/opt_range.h1
-rw-r--r--sql/opt_subselect.cc50
-rw-r--r--sql/opt_subselect.h1
-rw-r--r--sql/opt_trace.cc21
-rw-r--r--sql/partition_info.cc6
-rw-r--r--sql/procedure.h10
-rw-r--r--sql/protocol.cc2
-rw-r--r--sql/protocol.h5
-rw-r--r--sql/repl_failsafe.cc3
-rw-r--r--sql/rpl_rli.cc4
-rw-r--r--sql/rpl_utility.cc986
-rw-r--r--sql/rpl_utility.h4
-rw-r--r--sql/rpl_utility_server.cc1185
-rw-r--r--sql/scheduler.cc25
-rw-r--r--sql/scheduler.h9
-rw-r--r--sql/service_wsrep.cc10
-rw-r--r--sql/session_tracker.cc52
-rw-r--r--sql/session_tracker.h67
-rw-r--r--sql/set_var.cc31
-rw-r--r--sql/share/errmsg-utf8.txt6
-rw-r--r--sql/slave.cc34
-rw-r--r--sql/sp.cc13
-rw-r--r--sql/sp_head.cc13
-rw-r--r--sql/spatial.cc27
-rw-r--r--sql/spatial.h1
-rw-r--r--sql/sql_acl.cc32
-rw-r--r--sql/sql_alter.cc18
-rw-r--r--sql/sql_alter.h3
-rw-r--r--sql/sql_base.cc27
-rw-r--r--sql/sql_basic_types.h2
-rw-r--r--sql/sql_bitmap.h380
-rw-r--r--sql/sql_builtin.cc.in6
-rw-r--r--sql/sql_class.cc53
-rw-r--r--sql/sql_class.h257
-rw-r--r--sql/sql_cmd.h20
-rw-r--r--sql/sql_connect.cc108
-rw-r--r--sql/sql_connect.h28
-rw-r--r--sql/sql_cte.cc2
-rw-r--r--sql/sql_cursor.cc7
-rw-r--r--sql/sql_db.cc71
-rw-r--r--sql/sql_digest.cc2
-rw-r--r--sql/sql_error.cc12
-rw-r--r--sql/sql_error.h21
-rw-r--r--sql/sql_get_diagnostics.cc4
-rw-r--r--sql/sql_help.cc12
-rw-r--r--sql/sql_hset.h18
-rw-r--r--sql/sql_i_s.h327
-rw-r--r--sql/sql_insert.cc11
-rw-r--r--sql/sql_lex.cc233
-rw-r--r--sql/sql_lex.h108
-rw-r--r--sql/sql_parse.cc488
-rw-r--r--sql/sql_partition.cc4
-rw-r--r--sql/sql_plugin.cc22
-rw-r--r--sql/sql_plugin_services.ic4
-rw-r--r--sql/sql_prepare.cc34
-rw-r--r--sql/sql_priv.h1
-rw-r--r--sql/sql_profile.cc54
-rw-r--r--sql/sql_profile.h5
-rw-r--r--sql/sql_reload.cc2
-rw-r--r--sql/sql_select.cc1187
-rw-r--r--sql/sql_select.h8
-rw-r--r--sql/sql_sequence.cc18
-rw-r--r--sql/sql_show.cc1568
-rw-r--r--sql/sql_show.h5
-rw-r--r--sql/sql_signal.cc6
-rw-r--r--sql/sql_string.h22
-rw-r--r--sql/sql_table.cc484
-rw-r--r--sql/sql_table.h4
-rw-r--r--sql/sql_tablespace.cc2
-rw-r--r--sql/sql_tvc.cc5
-rw-r--r--sql/sql_type.cc2433
-rw-r--r--sql/sql_type.h3003
-rw-r--r--sql/sql_type_geom.cc1000
-rw-r--r--sql/sql_type_geom.h437
-rw-r--r--sql/sql_type_json.cc6
-rw-r--r--sql/sql_union.cc950
-rw-r--r--sql/sql_update.cc2
-rw-r--r--sql/sql_view.cc7
-rw-r--r--sql/sql_yacc.yy1593
-rw-r--r--sql/sql_yacc_ora.yy1554
-rw-r--r--sql/strfunc.cc3
-rw-r--r--sql/strfunc.h3
-rw-r--r--sql/structs.h2
-rw-r--r--sql/sys_vars.cc79
-rw-r--r--sql/table.cc261
-rw-r--r--sql/table.h105
-rw-r--r--sql/thread_pool_info.cc357
-rw-r--r--sql/threadpool.h9
-rw-r--r--sql/threadpool_common.cc33
-rw-r--r--sql/threadpool_generic.cc228
-rw-r--r--sql/threadpool_generic.h150
-rw-r--r--sql/threadpool_win.cc50
-rw-r--r--sql/unireg.cc141
-rw-r--r--sql/unireg.h3
-rw-r--r--sql/upgrade_conf_file.cc1
-rw-r--r--sql/vers_string.h27
-rw-r--r--sql/wsrep_applier.cc42
-rw-r--r--sql/wsrep_applier.h37
-rw-r--r--sql/wsrep_binlog.cc4
-rw-r--r--sql/wsrep_client_service.cc1
-rw-r--r--sql/wsrep_dummy.cc6
-rw-r--r--sql/wsrep_high_priority_service.cc71
-rw-r--r--sql/wsrep_high_priority_service.h5
-rw-r--r--sql/wsrep_mysqld.cc82
-rw-r--r--sql/wsrep_mysqld.h16
-rw-r--r--sql/wsrep_schema.cc14
-rw-r--r--sql/wsrep_trans_observer.h52
-rw-r--r--sql/xa.cc4
-rw-r--r--storage/archive/ha_archive.cc1
-rw-r--r--storage/blackhole/ha_blackhole.cc1
-rw-r--r--storage/cassandra/ha_cassandra.cc5
-rw-r--r--storage/connect/CMakeLists.txt18
-rw-r--r--storage/connect/colblk.cpp10
-rw-r--r--storage/connect/connect.cc3
-rw-r--r--storage/connect/filamdbf.cpp7
-rw-r--r--storage/connect/filamfix.cpp2
-rw-r--r--storage/connect/filamgz.cpp6
-rw-r--r--storage/connect/filamtxt.cpp3
-rw-r--r--storage/connect/filamvct.cpp4
-rw-r--r--storage/connect/filamzip.cpp3
-rw-r--r--storage/connect/filter.cpp4
-rw-r--r--storage/connect/fmdlex.c6
-rw-r--r--storage/connect/ha_connect.cc7
-rw-r--r--storage/connect/inihandl.cpp4
-rw-r--r--storage/connect/javaconn.cpp2
-rw-r--r--storage/connect/jdbconn.cpp6
-rw-r--r--storage/connect/jsonudf.cpp15
-rw-r--r--storage/connect/libdoc.cpp10
-rw-r--r--storage/connect/maputil.cpp2
-rw-r--r--storage/connect/myconn.cpp2
-rw-r--r--storage/connect/odbconn.cpp6
-rw-r--r--storage/connect/plgdbutl.cpp3
-rw-r--r--storage/connect/tabdos.cpp31
-rw-r--r--storage/connect/tabext.cpp2
-rw-r--r--storage/connect/tabfix.cpp1
-rw-r--r--storage/connect/tabfmt.cpp25
-rw-r--r--storage/connect/tabjdbc.cpp8
-rw-r--r--storage/connect/tabjson.cpp7
-rw-r--r--storage/connect/tabmul.cpp13
-rw-r--r--storage/connect/tabmysql.cpp2
-rw-r--r--storage/connect/taboccur.cpp5
-rw-r--r--storage/connect/tabodbc.cpp24
-rw-r--r--storage/connect/tabpivot.cpp8
-rw-r--r--storage/connect/tabutil.cpp2
-rw-r--r--storage/connect/tabxml.cpp28
-rw-r--r--storage/connect/user_connect.cc2
-rw-r--r--storage/connect/user_connect.h2
-rw-r--r--storage/connect/xindex.cpp8
-rw-r--r--storage/connect/zip.c13
-rw-r--r--storage/csv/ha_tina.cc5
-rw-r--r--storage/example/ha_example.cc1
-rw-r--r--storage/federated/ha_federated.cc3
-rw-r--r--storage/federatedx/ha_federatedx.cc16
-rw-r--r--storage/heap/ha_heap.cc1
-rw-r--r--storage/heap/hp_write.c26
-rw-r--r--storage/innobase/btr/btr0btr.cc209
-rw-r--r--storage/innobase/btr/btr0bulk.cc15
-rw-r--r--storage/innobase/btr/btr0cur.cc283
-rw-r--r--storage/innobase/btr/btr0defragment.cc17
-rw-r--r--storage/innobase/btr/btr0pcur.cc23
-rw-r--r--storage/innobase/btr/btr0scrub.cc18
-rw-r--r--storage/innobase/btr/btr0sea.cc63
-rw-r--r--storage/innobase/buf/buf0buf.cc334
-rw-r--r--storage/innobase/buf/buf0checksum.cc7
-rw-r--r--storage/innobase/buf/buf0flu.cc9
-rw-r--r--storage/innobase/buf/buf0rea.cc91
-rw-r--r--storage/innobase/dict/dict0boot.cc35
-rw-r--r--storage/innobase/dict/dict0dict.cc21
-rw-r--r--storage/innobase/dict/dict0load.cc9
-rw-r--r--storage/innobase/dict/dict0stats.cc11
-rw-r--r--storage/innobase/fil/fil0fil.cc16
-rw-r--r--storage/innobase/fts/fts0blex.cc2
-rw-r--r--storage/innobase/gis/gis0rtree.cc31
-rw-r--r--storage/innobase/gis/gis0sea.cc6
-rw-r--r--storage/innobase/handler/ha_innodb.cc663
-rw-r--r--storage/innobase/handler/i_s.cc2698
-rw-r--r--storage/innobase/handler/i_s.h10
-rw-r--r--storage/innobase/ibuf/ibuf0ibuf.cc422
-rw-r--r--storage/innobase/include/btr0btr.h85
-rw-r--r--storage/innobase/include/btr0btr.ic45
-rw-r--r--storage/innobase/include/btr0bulk.h2
-rw-r--r--storage/innobase/include/btr0cur.h4
-rw-r--r--storage/innobase/include/btr0pcur.h3
-rw-r--r--storage/innobase/include/buf0buf.h117
-rw-r--r--storage/innobase/include/buf0buf.ic40
-rw-r--r--storage/innobase/include/buf0flu.h3
-rw-r--r--storage/innobase/include/buf0rea.h20
-rw-r--r--storage/innobase/include/dict0dict.h24
-rw-r--r--storage/innobase/include/dict0load.h4
-rw-r--r--storage/innobase/include/fil0fil.h3
-rw-r--r--storage/innobase/include/fsp0fsp.h12
-rw-r--r--storage/innobase/include/ibuf0ibuf.h14
-rw-r--r--storage/innobase/include/ibuf0ibuf.ic10
-rw-r--r--storage/innobase/include/lock0lock.h51
-rw-r--r--storage/innobase/include/log0log.h29
-rw-r--r--storage/innobase/include/log0log.ic28
-rw-r--r--storage/innobase/include/log0recv.h71
-rw-r--r--storage/innobase/include/os0file.h20
-rw-r--r--storage/innobase/include/page0cur.h1
-rw-r--r--storage/innobase/include/page0cur.ic4
-rw-r--r--storage/innobase/include/page0page.h54
-rw-r--r--storage/innobase/include/page0page.ic46
-rw-r--r--storage/innobase/include/page0zip.h34
-rw-r--r--storage/innobase/include/page0zip.ic32
-rw-r--r--storage/innobase/include/row0mysql.h12
-rw-r--r--storage/innobase/include/srv0mon.h1
-rw-r--r--storage/innobase/include/srv0srv.h62
-rw-r--r--storage/innobase/include/trx0i_s.h48
-rw-r--r--storage/innobase/include/trx0trx.h2
-rw-r--r--storage/innobase/include/univ.i2
-rw-r--r--storage/innobase/lock/lock0lock.cc107
-rw-r--r--storage/innobase/log/log0log.cc29
-rw-r--r--storage/innobase/log/log0recv.cc832
-rw-r--r--storage/innobase/os/os0file.cc78
-rw-r--r--storage/innobase/page/page0cur.cc173
-rw-r--r--storage/innobase/page/page0page.cc252
-rw-r--r--storage/innobase/page/page0zip.cc69
-rw-r--r--storage/innobase/pars/lexyy.cc2
-rw-r--r--storage/innobase/row/row0ftsort.cc4
-rw-r--r--storage/innobase/row/row0merge.cc22
-rw-r--r--storage/innobase/row/row0mysql.cc15
-rw-r--r--storage/innobase/row/row0sel.cc196
-rw-r--r--storage/innobase/srv/srv0mon.cc21
-rw-r--r--storage/innobase/srv/srv0srv.cc141
-rw-r--r--storage/innobase/srv/srv0start.cc141
-rw-r--r--storage/innobase/sync/sync0arr.cc38
-rw-r--r--storage/innobase/trx/trx0i_s.cc183
-rw-r--r--storage/innobase/trx/trx0purge.cc2
-rw-r--r--storage/innobase/trx/trx0roll.cc5
-rw-r--r--storage/innobase/trx/trx0sys.cc65
-rw-r--r--storage/innobase/trx/trx0trx.cc12
-rw-r--r--storage/innobase/ut/ut0crc32.cc32
-rw-r--r--storage/maria/CMakeLists.txt59
-rw-r--r--storage/maria/aria_s3_copy.cc332
-rw-r--r--storage/maria/ha_maria.cc100
-rw-r--r--storage/maria/ha_maria.h14
-rw-r--r--storage/maria/ha_s3.cc774
-rw-r--r--storage/maria/ha_s3.h70
m---------storage/maria/libmarias30
-rw-r--r--storage/maria/ma_backup.c11
-rw-r--r--storage/maria/ma_blockrec.c35
-rw-r--r--storage/maria/ma_check.c60
-rw-r--r--storage/maria/ma_check.h36
-rw-r--r--storage/maria/ma_close.c15
-rw-r--r--storage/maria/ma_create.c6
-rw-r--r--storage/maria/ma_delete.c121
-rw-r--r--storage/maria/ma_delete_table.c2
-rw-r--r--storage/maria/ma_dynrec.c35
-rw-r--r--storage/maria/ma_ft_test1.h2
-rw-r--r--storage/maria/ma_info.c2
-rw-r--r--storage/maria/ma_open.c264
-rw-r--r--storage/maria/ma_pagecache.c419
-rw-r--r--storage/maria/ma_pagecache.h29
-rw-r--r--storage/maria/ma_recovery.c14
-rw-r--r--storage/maria/ma_rename.c2
-rw-r--r--storage/maria/ma_rt_index.c100
-rw-r--r--storage/maria/ma_rt_split.c25
-rw-r--r--storage/maria/ma_rt_test.c2
-rw-r--r--storage/maria/ma_search.c25
-rw-r--r--storage/maria/ma_sp_test.c2
-rw-r--r--storage/maria/ma_test1.c6
-rw-r--r--storage/maria/ma_test2.c2
-rw-r--r--storage/maria/ma_test3.c4
-rw-r--r--storage/maria/ma_write.c33
-rw-r--r--storage/maria/maria_chk.c54
-rw-r--r--storage/maria/maria_def.h29
-rw-r--r--storage/maria/maria_ftdump.c2
-rw-r--r--storage/maria/maria_pack.c2
-rw-r--r--storage/maria/s3_func.c1453
-rw-r--r--storage/maria/s3_func.h118
-rwxr-xr-xstorage/maria/test_aria_s3_copy.sh56
-rw-r--r--storage/maria/test_ma_backup.c2
-rw-r--r--storage/mroonga/ha_mroonga.cpp76
-rw-r--r--storage/mroonga/ha_mroonga.hpp3
-rw-r--r--storage/mroonga/mrn_table.cpp4
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/i_s.result7
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/i_s.test23
-rw-r--r--storage/myisam/ha_myisam.cc6
-rw-r--r--storage/myisam/mi_create.c2
-rw-r--r--storage/myisam/myisamdef.h19
-rw-r--r--storage/oqgraph/ha_oqgraph.cc1
-rw-r--r--storage/perfschema/ha_perfschema.cc1
-rw-r--r--storage/perfschema/pfs_defaults.cc8
-rw-r--r--storage/perfschema/pfs_engine_table.cc6
-rw-r--r--storage/perfschema/table_session_connect.cc2
-rw-r--r--storage/perfschema/table_setup_actors.cc8
-rw-r--r--storage/perfschema/table_setup_objects.cc6
-rw-r--r--storage/perfschema/unittest/pfs_connect_attr-t.cc8
-rw-r--r--storage/rocksdb/ha_rocksdb.cc1
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/i_s.result159
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/i_s_deadlock.result8
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/innodb_i_s_tables_disabled.result503
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/t/disabled.def1
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/t/i_s.test21
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/t/rqg.inc4
-rw-r--r--storage/rocksdb/rdb_i_s.cc233
-rw-r--r--storage/sphinx/ha_sphinx.cc38
-rw-r--r--storage/spider/ha_spider.cc36
-rw-r--r--storage/spider/spd_conn.cc69
-rw-r--r--storage/spider/spd_copy_tables.cc25
-rw-r--r--storage/spider/spd_db_conn.cc16
-rw-r--r--storage/spider/spd_db_handlersocket.cc4
-rw-r--r--storage/spider/spd_db_include.h4
-rw-r--r--storage/spider/spd_db_mysql.cc14
-rw-r--r--storage/spider/spd_db_oracle.cc28
-rw-r--r--storage/spider/spd_direct_sql.cc78
-rw-r--r--storage/spider/spd_group_by_handler.cc7
-rw-r--r--storage/spider/spd_i_s.cc30
-rw-r--r--storage/spider/spd_ping_table.cc36
-rw-r--r--storage/spider/spd_table.cc167
-rw-r--r--storage/spider/spd_trx.cc197
-rw-r--r--storage/spider/spd_trx.h3
-rw-r--r--storage/test_sql_discovery/mysql-test/sql_discovery/simple.result2
-rw-r--r--storage/tokudb/CMakeLists.txt1
-rw-r--r--storage/tokudb/hatoku_hton.cc1
-rw-r--r--storage/tokudb/mysql-test/tokudb/t/bf_delete.test2
-rw-r--r--storage/tokudb/mysql-test/tokudb_i_s/r/tokudb_background_job_status.result13
-rw-r--r--storage/tokudb/mysql-test/tokudb_i_s/r/tokudb_file_map.result9
-rw-r--r--storage/tokudb/mysql-test/tokudb_i_s/r/tokudb_fractal_tree_block_map.result13
-rw-r--r--storage/tokudb/mysql-test/tokudb_i_s/r/tokudb_fractal_tree_info.result13
-rw-r--r--storage/tokudb/mysql-test/tokudb_i_s/r/tokudb_lock_waits.result13
-rw-r--r--storage/tokudb/mysql-test/tokudb_i_s/r/tokudb_locks.result12
-rw-r--r--storage/tokudb/mysql-test/tokudb_i_s/r/tokudb_trx.result7
-rw-r--r--storage/tokudb/mysql-test/tokudb_i_s/suite.opt1
-rw-r--r--storage/tokudb/mysql-test/tokudb_i_s/suite.pm14
-rw-r--r--storage/tokudb/mysql-test/tokudb_i_s/t/tokudb_background_job_status.test1
-rw-r--r--storage/tokudb/mysql-test/tokudb_i_s/t/tokudb_file_map.test1
-rw-r--r--storage/tokudb/mysql-test/tokudb_i_s/t/tokudb_fractal_tree_block_map.test1
-rw-r--r--storage/tokudb/mysql-test/tokudb_i_s/t/tokudb_fractal_tree_info.test1
-rw-r--r--storage/tokudb/mysql-test/tokudb_i_s/t/tokudb_lock_waits.test1
-rw-r--r--storage/tokudb/mysql-test/tokudb_i_s/t/tokudb_locks.test1
-rw-r--r--storage/tokudb/mysql-test/tokudb_i_s/t/tokudb_trx.test1
-rw-r--r--storage/tokudb/mysql-test/tokudb_parts/t/partition_alter4_tokudb.test2
-rw-r--r--storage/tokudb/tokudb_information_schema.cc126
-rw-r--r--strings/CHARSET_INFO.txt2
-rw-r--r--strings/ctype-mb.ic2
-rw-r--r--strings/ctype-uca.c526
-rw-r--r--strings/ctype-uca.ic2
-rw-r--r--strings/ctype-utf8.c414
-rw-r--r--strings/ctype.c2
-rw-r--r--strings/json_lib.c2
-rw-r--r--strings/strcoll.ic8
-rw-r--r--support-files/rpm/server.cnf4
-rwxr-xr-xtests/big_record.pl6
-rw-r--r--tests/check_async_queries.pl2
-rwxr-xr-xtests/consistent_snapshot.pl2
-rwxr-xr-xtests/drop_test.pl12
-rwxr-xr-xtests/fork_big.pl28
-rw-r--r--tests/fork_big2.pl32
-rwxr-xr-xtests/grant.pl4
-rwxr-xr-xtests/index_corrupt.pl10
-rwxr-xr-xtests/insert_and_repair.pl10
-rwxr-xr-xtests/mail_to_db.pl6
-rwxr-xr-xtests/pmail.pl2
-rwxr-xr-xtests/rename_test.pl12
-rwxr-xr-xtests/test_delayed_insert.pl22
-rwxr-xr-xtests/truncate.pl6
-rw-r--r--unittest/json_lib/json_lib-t.c2
-rw-r--r--unittest/mysys/ma_dyncol-t.c8
-rw-r--r--unittest/sql/CMakeLists.txt8
-rw-r--r--unittest/sql/dummy_builtins.cc26
-rw-r--r--unittest/sql/explain_filename-t.cc2
-rw-r--r--unittest/strings/strings-t.c14
-rw-r--r--vio/viosslfactories.c2
-rw-r--r--win/packaging/CMakeLists.txt35
-rw-r--r--win/packaging/create_msi.cmake6
-rw-r--r--win/packaging/extra.wxs.in83
1163 files changed, 72675 insertions, 43794 deletions
diff --git a/.gitignore b/.gitignore
index 94795946e64..69fc59429fd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -179,6 +179,7 @@ storage/maria/aria_dump_log
storage/maria/aria_ftdump
storage/maria/aria_pack
storage/maria/aria_read_log
+storage/maria/aria_s3_copy
storage/maria/ma_rt_test
storage/maria/ma_sp_test
storage/maria/ma_test1
diff --git a/.gitmodules b/.gitmodules
index 921a4782f4f..eeee4802b2b 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -11,3 +11,6 @@
[submodule "extra/wolfssl/wolfssl"]
path = extra/wolfssl/wolfssl
url = https://github.com/wolfSSL/wolfssl.git
+[submodule "storage/maria/libmarias3"]
+ path = storage/maria/libmarias3
+ url = https://github.com/mariadb-corporation/libmarias3.git
diff --git a/BUILD/FINISH.sh b/BUILD/FINISH.sh
index 037b5ae5754..ea5ca44d187 100644
--- a/BUILD/FINISH.sh
+++ b/BUILD/FINISH.sh
@@ -42,6 +42,8 @@ cd ./libmariadb
git submodule update
cd ../storage/rocksdb/rocksdb
git submodule update
+cd ../../maria/libmarias3
+git submodule update
cd ../../.."
fi
commands="$commands
diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh
index 992cfa1286f..7397fbbd673 100755
--- a/BUILD/SETUP.sh
+++ b/BUILD/SETUP.sh
@@ -141,7 +141,7 @@ elif [ "x$warning_mode" = "xmaintainer" ]; then
debug_extra_cflags="-g3"
else
# Both C and C++ warnings
- warnings="-Wall -Wextra -Wunused -Wwrite-strings -Wno-uninitialized -Wno-strict-aliasing -Wimplicit-fallthrough=2"
+ warnings="-Wall -Wextra -Wunused -Wwrite-strings -Wno-uninitialized -Wno-strict-aliasing"
# For more warnings, uncomment the following line
# warnings="$warnings -Wshadow"
@@ -197,7 +197,7 @@ base_configs="--prefix=$prefix --enable-assembler "
base_configs="$base_configs --with-extra-charsets=complex "
base_configs="$base_configs --enable-thread-safe-client "
base_configs="$base_configs --with-big-tables $maintainer_mode"
-base_configs="$base_configs --with-plugin-aria --with-aria-tmp-tables"
+base_configs="$base_configs --with-plugin-aria --with-aria-tmp-tables --with-plugin-s3=STATIC"
# Following is to get tokudb to work
base_configs="$base_configs --with-jemalloc=NO"
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 59444ffd1c8..085d7f07fe6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,6 +16,11 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.7)
+# Remove the following comment if you don't want to have striped binaries
+# in RPM's:
+
+#set(CPACK_RPM_SPEC_MORE_DEFINE "%define __spec_install_post /bin/true")
+
IF(POLICY CMP0022)
CMAKE_POLICY(SET CMP0022 NEW)
ENDIF()
@@ -398,7 +403,7 @@ IF(WITH_UNIT_TESTS)
ENDIF()
ENDIF()
-SET (MYSQLD_STATIC_PLUGIN_LIBS "" CACHE INTERNAL "")
+UNSET (MYSQLD_STATIC_PLUGIN_LIBS CACHE)
INCLUDE(mariadb_connector_c) # this does ADD_SUBDIRECTORY(libmariadb)
diff --git a/Docs/INSTALL-BINARY b/Docs/INSTALL-BINARY
index 2bd6daaea17..64d5192a49d 100644
--- a/Docs/INSTALL-BINARY
+++ b/Docs/INSTALL-BINARY
@@ -154,7 +154,7 @@ shell> chown -R mysql data
script itself and at
https://mariadb.com/kb/en/starting-and-stopping-mariadb-automatically.
10. You can set up new accounts using the bin/mysql_setpermission
- script if you install the DBI and DBD::mysql Perl modules. See
+ script if you install the DBI and DBD::MariaDB Perl modules. See
Section 4.6.14, "mysql_setpermission --- Interactively Set
Permissions in Grant Tables." For Perl module installation
instructions, see Section 2.15, "Perl Installation Notes."
diff --git a/VERSION b/VERSION
index 04c5d83db42..db4b7f6ec9e 100644
--- a/VERSION
+++ b/VERSION
@@ -1,4 +1,4 @@
MYSQL_VERSION_MAJOR=10
-MYSQL_VERSION_MINOR=4
-MYSQL_VERSION_PATCH=9
-SERVER_MATURITY=stable
+MYSQL_VERSION_MINOR=5
+MYSQL_VERSION_PATCH=0
+SERVER_MATURITY=alpha
diff --git a/client/client_priv.h b/client/client_priv.h
index 3ad46cf4b9b..9729fcf40fc 100644
--- a/client/client_priv.h
+++ b/client/client_priv.h
@@ -101,6 +101,8 @@ enum options_client
OPT_SSL_CRL, OPT_SSL_CRLPATH,
OPT_PRINT_ROW_COUNT, OPT_PRINT_ROW_EVENT_POSITIONS,
OPT_SHUTDOWN_WAIT_FOR_SLAVES,
+ OPT_COPY_S3_TABLES,
+ OPT_PRINT_TABLE_METADATA,
OPT_MAX_CLIENT_OPTION /* should be always the last */
};
diff --git a/client/mysql.cc b/client/mysql.cc
index 3cbe8859842..6402d651038 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -4637,7 +4637,10 @@ static char *get_arg(char *line, get_arg_mode mode)
string, and the "dialog" plugin will free() it.
*/
-MYSQL_PLUGIN_EXPORT
+extern "C"
+#ifdef _MSC_VER
+__declspec(dllexport)
+#endif
char *mysql_authentication_dialog_ask(MYSQL *mysql, int type,
const char *prompt,
char *buf, int buf_len)
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index cb1b02de81c..2d861ce077f 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -67,7 +67,7 @@ Rpl_filter *binlog_filter= 0;
#define PROBE_HEADER_LEN (EVENT_LEN_OFFSET+4)
/* Needed for Rpl_filter */
-CHARSET_INFO* system_charset_info= &my_charset_utf8_general_ci;
+CHARSET_INFO* system_charset_info= &my_charset_utf8mb3_general_ci;
/* Needed for Flashback */
DYNAMIC_ARRAY binlog_events; // Storing the events output string
@@ -144,6 +144,7 @@ static const char* dirname_for_local_load= 0;
static bool opt_skip_annotate_row_events= 0;
static my_bool opt_flashback;
+static bool opt_print_table_metadata;
#ifdef WHEN_FLASHBACK_REVIEW_READY
static my_bool opt_flashback_review;
static char *flashback_review_dbname, *flashback_review_tablename;
@@ -1095,6 +1096,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
print_event_info->hexdump_from= pos;
print_event_info->base64_output_mode= opt_base64_output_mode;
+ print_event_info->print_table_metadata= opt_print_table_metadata;
DBUG_PRINT("debug", ("event_type: %s", ev->get_type_str()));
@@ -1788,6 +1790,10 @@ Example: rewrite-db='from->to'.",
(uchar**) &opt_skip_annotate_row_events,
(uchar**) &opt_skip_annotate_row_events,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"print-table-metadata", OPT_PRINT_TABLE_METADATA,
+ "Print metadata stored in Table_map_log_event",
+ &opt_print_table_metadata, &opt_print_table_metadata, 0,
+ GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@@ -3248,6 +3254,7 @@ struct encryption_service_st encryption_handler=
#include "../sql-common/my_time.c"
#include "password.c"
#include "log_event.cc"
+#include "log_event_client.cc"
#include "log_event_old.cc"
#include "rpl_utility.cc"
#include "sql_string.cc"
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 3c95e282246..16acc88b221 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -83,6 +83,7 @@
#define IGNORE_NONE 0x00 /* no ignore */
#define IGNORE_DATA 0x01 /* don't dump data for this table */
#define IGNORE_INSERT_DELAYED 0x02 /* table doesn't support INSERT DELAYED */
+#define IGNORE_S3_TABLE 0x04
/* Chars needed to store LONGLONG, excluding trailing '\0'. */
#define LONGLONG_LEN 20
@@ -100,6 +101,7 @@ static my_bool verbose= 0, opt_no_create_info= 0, opt_no_data= 0, opt_no_data_m
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,
+ opt_copy_s3_tables=0,
opt_delayed=0,create_options=1,opt_quoted=0,opt_databases=0,
opt_alldbs=0,opt_create_db=0,opt_lock_all_tables=0,
opt_set_charset=0, opt_dump_date=1,
@@ -273,6 +275,11 @@ static struct my_option my_long_options[] =
{"compress", 'C', "Use compression in server/client protocol.",
&opt_compress, &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
+ {"copy_s3_tables", OPT_COPY_S3_TABLES,
+ "If 'no' S3 tables will be ignored, otherwise S3 tables will be copied as "
+ " Aria tables and then altered to S3",
+ &opt_copy_s3_tables, &opt_copy_s3_tables, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+ 0, 0, 0},
{"create-options", 'a',
"Include all MariaDB specific create options.",
&create_options, &create_options, 0, GET_BOOL, NO_ARG, 1,
@@ -2147,7 +2154,12 @@ static void print_xml_row(FILE *xml_file, const char *row_name,
fputc(' ', xml_file);
print_quoted_xml(xml_file, field->name, field->name_length, 1);
fputs("=\"", xml_file);
- print_quoted_xml(xml_file, (*row)[i], lengths[i], 0);
+ if (opt_copy_s3_tables &&
+ !strcmp(field->name, "Engine") &&
+ !strcmp((*row)[i], "S3"))
+ print_quoted_xml(xml_file, "Aria", sizeof("Aria") - 1, 0);
+ else
+ print_quoted_xml(xml_file, (*row)[i], lengths[i], 0);
fputc('"', xml_file);
check_io(xml_file);
}
@@ -2743,11 +2755,18 @@ static uint get_table_structure(char *table, char *db, char *table_type,
my_bool is_log_table;
MYSQL_RES *result;
MYSQL_ROW row;
+ const char *s3_engine_ptr;
+ DYNAMIC_STRING create_table_str;
+ static const char s3_engine_token[]= " ENGINE=S3 ";
+ static const char aria_engine_token[]= " ENGINE=Aria ";
DBUG_ENTER("get_table_structure");
DBUG_PRINT("enter", ("db: %s table: %s", db, table));
*ignore_flag= check_if_ignore_table(table, table_type);
+ if (!opt_copy_s3_tables && *ignore_flag == IGNORE_S3_TABLE)
+ DBUG_RETURN(0);
+
delayed= opt_delayed;
if (delayed && (*ignore_flag & IGNORE_INSERT_DELAYED))
{
@@ -2981,11 +3000,22 @@ static uint get_table_structure(char *table, char *db, char *table_type,
is_log_table= general_log_or_slow_log_tables(db, table);
if (is_log_table)
row[1]+= 13; /* strlen("CREATE TABLE ")= 13 */
+ create_table_str.str= row[1];
+ if (opt_copy_s3_tables && (*ignore_flag & IGNORE_S3_TABLE) &&
+ (s3_engine_ptr= strstr(row[1], s3_engine_token)))
+ {
+ init_dynamic_string_checked(&create_table_str, "", 1024, 1024);
+ dynstr_append_mem_checked(&create_table_str, row[1],
+ (uint)(s3_engine_ptr - row[1]));
+ dynstr_append_checked(&create_table_str, aria_engine_token);
+ dynstr_append_checked(&create_table_str,
+ s3_engine_ptr + sizeof(s3_engine_token) - 1);
+ }
if (opt_compatible_mode & 3)
{
fprintf(sql_file,
is_log_table ? "CREATE TABLE IF NOT EXISTS %s;\n" : "%s;\n",
- row[1]);
+ create_table_str.str);
}
else
{
@@ -2995,10 +3025,12 @@ static uint get_table_structure(char *table, char *db, char *table_type,
"%s%s;\n"
"/*!40101 SET character_set_client = @saved_cs_client */;\n",
is_log_table ? "CREATE TABLE IF NOT EXISTS " : "",
- row[1]);
+ create_table_str.str);
}
check_io(sql_file);
+ if (create_table_str.str != row[1])
+ dynstr_free(&create_table_str);
mysql_free_result(result);
}
my_snprintf(query_buff, sizeof(query_buff), "show fields from %s",
@@ -3697,6 +3729,14 @@ static void dump_table(char *table, char *db)
if (strcmp(table_type, "VIEW") == 0)
DBUG_VOID_RETURN;
+ if (!opt_copy_s3_tables && (ignore_flag & IGNORE_S3_TABLE))
+ {
+ verbose_msg("-- Skipping dump data for table '%s', "
+ " this is S3 table and --copy-s3-tables=0\n",
+ table);
+ DBUG_VOID_RETURN;
+ }
+
/* Check --no-data flag */
if (opt_no_data)
{
@@ -4124,6 +4164,15 @@ static void dump_table(char *table, char *db)
fputs("\t</table_data>\n", md_result_file);
else if (extended_insert && row_break)
fputs(";\n", md_result_file); /* If not empty table */
+ if (!opt_xml && opt_copy_s3_tables && (ignore_flag & IGNORE_S3_TABLE))
+ {
+ DYNAMIC_STRING alter_string;
+ init_dynamic_string_checked(&alter_string, "ATER TABLE ", 1024, 1024);
+ dynstr_append_checked(&alter_string, opt_quoted_table);
+ dynstr_append_checked(&alter_string, " ENGINE=S3;\n");
+ fputs(alter_string.str, md_result_file);
+ dynstr_free(&alter_string);
+ }
fflush(md_result_file);
check_io(md_result_file);
if (mysql_errno(mysql))
@@ -5690,6 +5739,9 @@ char check_if_ignore_table(const char *table_name, char *table_type)
result= IGNORE_INSERT_DELAYED;
}
+ if (!strcmp(table_type, "S3"))
+ result|= IGNORE_S3_TABLE;
+
/*
If these two types, we do want to skip dumping the table
*/
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index 3e61b2ec9b7..bb3effafc84 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -9120,7 +9120,7 @@ static void init_signal_handling(void)
DBUG_ENTER("init_signal_handling");
#ifdef HAVE_STACKTRACE
- my_init_stacktrace();
+ my_init_stacktrace(0);
#endif
sa.sa_flags = SA_RESETHAND | SA_NODEFER;
@@ -10201,7 +10201,7 @@ void append_replace_regex(char* expr, char *expr_end, struct st_replace_regex* r
/* Allow variable for the *entire* list of replacements */
if (*p == '$')
{
- const char *v_end;
+ const char *v_end= 0;
VAR *val= var_get(p, &v_end, 0, 1);
if (val)
@@ -11292,7 +11292,10 @@ static int setenv(const char *name, const char *value, int overwrite)
that always reads from stdin with explicit echo.
*/
-MYSQL_PLUGIN_EXPORT
+extern "C"
+#ifdef _MSC_VER
+__declspec(dllexport)
+#endif
char *mysql_authentication_dialog_ask(MYSQL *mysql, int type,
const char *prompt,
char *buf, int buf_len)
diff --git a/cmake/abi_check.cmake b/cmake/abi_check.cmake
index 805322229c4..bf97b9db8e8 100644
--- a/cmake/abi_check.cmake
+++ b/cmake/abi_check.cmake
@@ -45,6 +45,8 @@ IF(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang" AND RUN_ABI_CHECK)
${CMAKE_SOURCE_DIR}/include/mysql/plugin_auth.h
${CMAKE_SOURCE_DIR}/include/mysql/plugin_password_validation.h
${CMAKE_SOURCE_DIR}/include/mysql/plugin_encryption.h
+ ${CMAKE_SOURCE_DIR}/include/mysql/plugin_data_type.h
+ ${CMAKE_SOURCE_DIR}/include/mysql/plugin_function_collection.h
)
ADD_CUSTOM_TARGET(abi_check ALL
diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake
index 37a6c459260..f097a1923cc 100644
--- a/cmake/build_configurations/mysql_release.cmake
+++ b/cmake/build_configurations/mysql_release.cmake
@@ -223,12 +223,12 @@ IF(UNIX)
# Default Clang flags
IF(CMAKE_C_COMPILER_ID MATCHES "Clang")
- SET(COMMON_C_FLAGS "-g -fno-omit-frame-pointer -fno-strict-aliasing")
+ SET(COMMON_C_FLAGS "-g -fno-omit-frame-pointer -fno-strict-aliasing -Wno-parentheses-equality -Wno-string-plus-int")
SET(CMAKE_C_FLAGS_DEBUG "${COMMON_C_FLAGS}")
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 ${COMMON_C_FLAGS}")
ENDIF()
IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
- SET(COMMON_CXX_FLAGS "-g -fno-omit-frame-pointer -fno-strict-aliasing")
+ SET(COMMON_CXX_FLAGS "-g -fno-omit-frame-pointer -fno-strict-aliasing -Wno-parentheses-equality -Wno-string-plus-int")
SET(CMAKE_CXX_FLAGS_DEBUG "${COMMON_CXX_FLAGS}")
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 ${COMMON_CXX_FLAGS}")
ENDIF()
diff --git a/cmake/character_sets.cmake b/cmake/character_sets.cmake
index 37de79758b3..fc6f1d2d343 100644
--- a/cmake/character_sets.cmake
+++ b/cmake/character_sets.cmake
@@ -22,17 +22,17 @@ IF(NOT DEFAULT_COLLATION)
SET(DEFAULT_COLLATION "latin1_swedish_ci")
ENDIF()
-SET(CHARSETS ${DEFAULT_CHARSET} latin1 utf8 utf8mb4)
+SET(CHARSETS ${DEFAULT_CHARSET} latin1 utf8mb3 utf8mb4)
SET(CHARSETS_COMPLEX
big5 cp1250 cp932 eucjpms euckr gb2312 gbk latin1 latin2
- sjis tis620 ucs2 ujis utf8 utf8mb4 utf16 utf16le utf32)
+ sjis tis620 ucs2 ujis utf8mb3 utf8mb4 utf16 utf16le utf32)
SET(CHARSETS_AVAILABLE
binary armscii8 ascii big5 cp1250 cp1251 cp1256 cp1257
cp850 cp852 cp866 cp932 dec8 eucjpms euckr gb2312 gbk geostd8
greek hebrew hp8 keybcs2 koi8r koi8u
latin1 latin2 latin5 latin7 macce macroman
-sjis swe7 tis620 ucs2 ujis utf8 utf8mb4 utf16 utf16le utf32)
+sjis swe7 tis620 ucs2 ujis utf8mb3 utf8mb4 utf16 utf16le utf32)
SET (EXTRA_CHARSETS "all")
diff --git a/cmake/crc32.cmake b/cmake/crc32.cmake
index ee8afdb0e92..78d57dec3fb 100644
--- a/cmake/crc32.cmake
+++ b/cmake/crc32.cmake
@@ -1,5 +1,36 @@
+IF(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|AARCH64")
+ IF(CMAKE_COMPILER_IS_GNUCC AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1)
+ include(CheckCXXSourceCompiles)
+
+ CHECK_CXX_SOURCE_COMPILES("
+ #define CRC32CX(crc, value) __asm__(\"crc32cx %w[c], %w[c], %x[v]\":[c]\"+r\"(crc):[v]\"r\"(value))
+ asm(\".arch_extension crc\");
+ unsigned int foo(unsigned int ret) {
+ CRC32CX(ret, 0);
+ return ret;
+ }
+ int main() { foo(0); }" HAVE_ARMV8_CRC)
+
+ CHECK_CXX_SOURCE_COMPILES("
+ asm(\".arch_extension crypto\");
+ unsigned int foo(unsigned int ret) {
+ __asm__(\"pmull v2.1q, v2.1d, v1.1d\");
+ return ret;
+ }
+ int main() { foo(0); }" HAVE_ARMV8_CRYPTO)
+
+ CHECK_C_COMPILER_FLAG(-march=armv8-a+crc+crypto HAVE_ARMV8_CRC_CRYPTO_INTRINSICS)
+ IF(HAVE_ARMV8_CRC_CRYPTO_INTRINSICS)
+ SET(ARMV8_CRC_COMPILE_FLAGS "${ARMV8_CRC_COMPILE_FLAGS} -march=armv8-a+crc+crypto")
+ ENDIF()
+
+ SET(CRC32_LIBRARY crc32_armv8_neon)
+ ADD_SUBDIRECTORY(extra/crc32_armv8_neon)
+ ENDIF()
+ENDIF()
+
IF(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64")
- SET(HAVE_CRC32_VPMSUM 1)
- SET(CRC32_LIBRARY crc32-vpmsum)
- ADD_SUBDIRECTORY(extra/crc32-vpmsum)
+ SET(HAVE_CRC32_VPMSUM 1)
+ SET(CRC32_LIBRARY crc32-vpmsum)
+ ADD_SUBDIRECTORY(extra/crc32-vpmsum)
ENDIF()
diff --git a/cmake/do_abi_check.cmake b/cmake/do_abi_check.cmake
index 43d8b15a7ab..d775d310383 100644
--- a/cmake/do_abi_check.cmake
+++ b/cmake/do_abi_check.cmake
@@ -58,7 +58,8 @@ FOREACH(file ${ABI_HEADERS})
EXECUTE_PROCESS(
COMMAND ${COMPILER}
- -E -nostdinc -DMYSQL_ABI_CHECK -I${SOURCE_DIR}/include
+ -E -nostdinc -DMYSQL_ABI_CHECK -D__cplusplus
+ -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/os/Windows.cmake b/cmake/os/Windows.cmake
index 02687b6f0d5..c48e3eb07f2 100644
--- a/cmake/os/Windows.cmake
+++ b/cmake/os/Windows.cmake
@@ -65,7 +65,9 @@ FUNCTION(ENABLE_ASAN)
ENDIF()
# currently, asan is broken with static CRT.
IF(NOT(MSVC_CRT_TYPE STREQUAL "/MD"))
- MESSAGE(FATAL_ERROR "-DWITH_ASAN cmake parameter also requires -DMSVC_CRT_TYPE=/MD")
+ IF(NOT DYNAMIC_UCRT_LINK)
+ MESSAGE(FATAL_ERROR "-DWITH_ASAN cmake parameter also requires -DMSVC_CRT_TYPE=/MD OR DYNAMIC_UCRT_LINK=ON")
+ ENDIF()
ENDIF()
IF(CMAKE_SIZEOF_VOID_P EQUAL 4)
MESSAGE(FATAL_ERROR "-DWITH_ASAN on Windows requires 64bit build")
@@ -90,29 +92,24 @@ ENDFUNCTION()
IF(MSVC)
- IF(WITH_ASAN)
- ENABLE_ASAN()
- ENDIF()
-
# Disable mingw based pkg-config found in Strawberry perl
SET(PKG_CONFIG_EXECUTABLE 0 CACHE INTERNAL "")
- SET(MSVC_CRT_TYPE /MD CACHE STRING
+ SET(MSVC_CRT_TYPE /MT CACHE STRING
"Runtime library - specify runtime library for linking (/MT,/MTd,/MD,/MDd)"
)
- SET(VALID_CRT_TYPES /MTd /MDd /MD /MT)
+ SET(VALID_CRT_TYPES /MTd /MDd /MD /MT)
IF (NOT ";${VALID_CRT_TYPES};" MATCHES ";${MSVC_CRT_TYPE};")
MESSAGE(FATAL_ERROR "Invalid value ${MSVC_CRT_TYPE} for MSVC_CRT_TYPE, choose one of /MT,/MTd,/MD,/MDd ")
ENDIF()
- IF(MSVC_CRT_TYPE MATCHES "/MD")
- # Dynamic runtime (DLLs), need to install CRT libraries.
- SET(CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT VCCRT)
- SET(CMAKE_INSTALL_UCRT_LIBRARIES TRUE)
- IF(MSVC_CRT_TYPE STREQUAL "/MDd")
- SET (CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY TRUE)
- ENDIF()
- INCLUDE(InstallRequiredSystemLibraries)
+ OPTION(DYNAMIC_UCRT_LINK "Link Universal CRT dynamically, if MSVC_CRT_TYPE=/MT" ON)
+ SET(DYNAMIC_UCRT_LINKER_OPTION " /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib")
+
+ IF(WITH_ASAN)
+ # Workaround something Linux specific
+ SET(SECURITY_HARDENED 0 CACHE INTERNAL "" FORCE)
+ ENABLE_ASAN()
ENDIF()
# Enable debug info also in Release build,
@@ -124,19 +121,11 @@ IF(MSVC)
"${CMAKE_${type}_LINKER_FLAGS_MINSIZEREL} /debug")
ENDFOREACH()
- # Force static runtime libraries
- # - Choose debugging information:
- # /Z7
- # Produces an .obj file containing full symbolic debugging
- # information for use with the debugger. The symbolic debugging
- # information includes the names and types of variables, as well as
- # functions and line numbers. No .pdb file is produced by the compiler.
- #
- # - Remove preprocessor flag _DEBUG that older cmakes use with Config=Debug,
- # it is as defined by Debug runtimes itself (/MTd /MDd)
+ # Force runtime libraries
+ # Compile with /Zi to get debugging information
FOREACH(lang C CXX)
- SET(CMAKE_${lang}_FLAGS_RELEASE "${CMAKE_${lang}_FLAGS_RELEASE} /Z7")
+ SET(CMAKE_${lang}_FLAGS_RELEASE "${CMAKE_${lang}_FLAGS_RELEASE} /Zi")
ENDFOREACH()
FOREACH(flag
CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO
@@ -146,30 +135,34 @@ IF(MSVC)
CMAKE_C_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_MINSIZEREL
)
STRING(REGEX REPLACE "/M[TD][d]?" "${MSVC_CRT_TYPE}" "${flag}" "${${flag}}" )
- STRING(REGEX REPLACE "/D[ ]?_DEBUG" "" "${flag}" "${${flag}}")
- STRING(REPLACE "/Zi" "/Z7" "${flag}" "${${flag}}")
- IF(NOT "${${flag}}" MATCHES "/Z7")
- STRING(APPEND ${flag} " /Z7")
+ STRING(REPLACE "/ZI " "/Zi " "${flag}" "${${flag}}")
+ IF((NOT "${${flag}}" MATCHES "/Zi") AND (NOT "${${flag}}" MATCHES "/Z7"))
+ STRING(APPEND ${flag} " /Zi")
ENDIF()
ENDFOREACH()
IF(CMAKE_CXX_COMPILER_ID MATCHES Clang)
SET(CLANG_CL_FLAGS
-"-Wno-unused-parameter -Wno-unused-command-line-argument -Wno-pointer-sign -Wno-deprecated-register \
--Wno-missing-braces -Wno-unused-function -msse4.2 "
+"-Wno-unknown-warning-option -Wno-unused-private-field \
+-Wno-unused-parameter -Wno-inconsistent-missing-override \
+-Wno-unused-command-line-argument -Wno-pointer-sign \
+-Wno-deprecated-register -Wno-missing-braces \
+-Wno-unused-function -Wno-unused-local-typedef -msse4.2 "
)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CLANG_CL_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CLANG_CL_FLAGS}")
ENDIF()
- # Fix CMake's predefined huge stack size
FOREACH(type EXE SHARED MODULE)
STRING(REGEX REPLACE "/STACK:([^ ]+)" "" CMAKE_${type}_LINKER_FLAGS "${CMAKE_${type}_LINKER_FLAGS}")
STRING(REGEX REPLACE "/INCREMENTAL:([^ ]+)" "/INCREMENTAL:NO" CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO}")
STRING(REGEX REPLACE "/INCREMENTAL$" "/INCREMENTAL:NO" CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO}")
- STRING(REGEX REPLACE "/INCREMENTAL:([^ ]+)" "/INCREMENTAL:NO" CMAKE_${type}_LINKER_FLAGS_DEBUG "${CMAKE_${type}_LINKER_FLAGS_DEBUG}")
- STRING(REGEX REPLACE "/INCREMENTAL$" "/INCREMENTAL:NO" CMAKE_${type}_LINKER_FLAGS_DEBUG "${CMAKE_${type}_LINKER_FLAGS_DEBUG}")
SET(CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO} /OPT:REF /release")
+ IF(DYNAMIC_UCRT_LINK AND (MSVC_CRT_TYPE STREQUAL "/MT"))
+ FOREACH(config RELEASE RELWITHDEBINFO DEBUG MINSIZEREL)
+ STRING(APPEND CMAKE_${type}_LINKER_FLAGS_${config} ${DYNAMIC_UCRT_LINKER_OPTION})
+ ENDFOREACH()
+ ENDIF()
ENDFOREACH()
@@ -180,7 +173,7 @@ IF(MSVC)
ENDIF()
# Speed up multiprocessor build
- IF (MSVC_VERSION GREATER 1400 AND (NOT CMAKE_CXX_COMPILER_ID MATCHES Clang))
+ IF (NOT CMAKE_CXX_COMPILER_ID MATCHES Clang)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
ENDIF()
@@ -295,5 +288,6 @@ MACRO(FORCE_STATIC_CRT)
CMAKE_C_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_MINSIZEREL
)
STRING(REGEX REPLACE "/MD[d]?" "/MT" "${flag}" "${${flag}}" )
+ STRING(REPLACE ${DYNAMIC_UCRT_LINKER_OPTION} "" "${flag}" "${${flag}}")
ENDFOREACH()
ENDMACRO()
diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake
index 5a1e8f81f0a..eec4fc6a33e 100644
--- a/cmake/plugin.cmake
+++ b/cmake/plugin.cmake
@@ -25,12 +25,13 @@ INCLUDE(CMakeParseArguments)
# [MODULE_OUTPUT_NAME module_name]
# [STATIC_OUTPUT_NAME static_name]
# [RECOMPILE_FOR_EMBEDDED]
+# [NOT_EMBEDDED]
# [LINK_LIBRARIES lib1...libN]
# [DEPENDENCIES target1...targetN]
MACRO(MYSQL_ADD_PLUGIN)
CMAKE_PARSE_ARGUMENTS(ARG
- "STORAGE_ENGINE;STATIC_ONLY;MODULE_ONLY;MANDATORY;DEFAULT;DISABLED;RECOMPILE_FOR_EMBEDDED;CLIENT"
+ "STORAGE_ENGINE;STATIC_ONLY;MODULE_ONLY;MANDATORY;DEFAULT;DISABLED;NOT_EMBEDDED;RECOMPILE_FOR_EMBEDDED;CLIENT;EXPORT_SYMBOLS"
"MODULE_OUTPUT_NAME;STATIC_OUTPUT_NAME;COMPONENT;CONFIG"
"LINK_LIBRARIES;DEPENDENCIES"
${ARGN}
@@ -139,8 +140,10 @@ MACRO(MYSQL_ADD_PLUGIN)
ADD_LIBRARY(${target} STATIC ${SOURCES})
DTRACE_INSTRUMENT(${target})
ADD_DEPENDENCIES(${target} GenError ${ARG_DEPENDENCIES})
- RESTRICT_SYMBOL_EXPORTS(${target})
- IF(WITH_EMBEDDED_SERVER)
+ IF(NOT ARG_EXPORT_SYMBOLS)
+ RESTRICT_SYMBOL_EXPORTS(${target})
+ ENDIF()
+ IF(WITH_EMBEDDED_SERVER AND (NOT ARG_NOT_EMBEDDED))
# Embedded library should contain PIC code and be linkable
# to shared libraries (on systems that need PIC)
IF(ARG_RECOMPILE_FOR_EMBEDDED OR NOT _SKIP_PIC)
@@ -165,19 +168,30 @@ MACRO(MYSQL_ADD_PLUGIN)
TARGET_LINK_LIBRARIES (${target} ${ARG_LINK_LIBRARIES})
ENDIF()
+ SET(${with_var} ON CACHE INTERNAL "Link ${plugin} statically to the server" FORCE)
+
# Update mysqld dependencies
SET (MYSQLD_STATIC_PLUGIN_LIBS ${MYSQLD_STATIC_PLUGIN_LIBS}
${target} ${ARG_LINK_LIBRARIES} CACHE INTERNAL "" FORCE)
- SET(${with_var} ON CACHE INTERNAL "Link ${plugin} statically to the server" FORCE)
+ IF(WITH_EMBEDDED_SERVER AND (NOT ARG_NOT_EMBEDDED))
+ SET (EMBEDDED_PLUGIN_LIBS ${EMBEDDED_PLUGIN_LIBS}
+ ${target} ${ARG_LINK_LIBRARIES} CACHE INTERNAL "" FORCE)
+ ENDIF()
+
+ IF(ARG_NOT_EMBEDDED)
+ SET(builtin_entry "#ifndef EMBEDDED_LIBRARY\n builtin_maria_${target}_plugin,\n#endif")
+ ELSE()
+ SET(builtin_entry " builtin_maria_${target}_plugin,")
+ ENDIF()
IF(ARG_MANDATORY)
SET (mysql_mandatory_plugins
- "${mysql_mandatory_plugins} builtin_maria_${target}_plugin,")
+ "${mysql_mandatory_plugins}${builtin_entry}\n")
SET (mysql_mandatory_plugins ${mysql_mandatory_plugins} PARENT_SCOPE)
ELSE()
SET (mysql_optional_plugins
- "${mysql_optional_plugins} builtin_maria_${target}_plugin,")
+ "${mysql_optional_plugins}${builtin_entry}\n")
SET (mysql_optional_plugins ${mysql_optional_plugins} PARENT_SCOPE)
ENDIF()
ELSEIF(PLUGIN_${plugin} MATCHES "(DYNAMIC|AUTO|YES)"
diff --git a/config.h.cmake b/config.h.cmake
index b15f7b57a2b..afb10348d40 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -106,6 +106,11 @@
#cmakedefine HAVE_SYSTEMD 1
#cmakedefine HAVE_CRC32_VPMSUM 1
+/* Support ARMv8 crc + crypto */
+#cmakedefine HAVE_ARMV8_CRC 1
+#cmakedefine HAVE_ARMV8_CRYPTO 1
+#cmakedefine HAVE_ARMV8_CRC_CRYPTO_INTRINSICS 1
+
/* Does "struct timespec" have a "sec" and "nsec" field? */
#cmakedefine HAVE_TIMESPEC_TS_SEC 1
@@ -495,7 +500,6 @@
#cmakedefine HAVE_CHARSET_ujis 1
#cmakedefine HAVE_CHARSET_utf8mb4 1
#cmakedefine HAVE_CHARSET_utf8mb3 1
-#cmakedefine HAVE_CHARSET_utf8 1
#cmakedefine HAVE_CHARSET_utf16 1
#cmakedefine HAVE_CHARSET_utf32 1
#cmakedefine HAVE_UCA_COLLATIONS 1
diff --git a/debian/additions/innotop/innotop b/debian/additions/innotop/innotop
index eb4b3590cf6..0ceb471140c 100644
--- a/debian/additions/innotop/innotop
+++ b/debian/additions/innotop/innotop
@@ -63,7 +63,7 @@ sub new {
},
F => {
desc => 'Only read default options from the given file',
- dsn => 'mysql_read_default_file',
+ dsn => 'mariadb_read_default_file',
copy => 1,
},
h => {
@@ -83,7 +83,7 @@ sub new {
},
S => {
desc => 'Socket file to use for connection',
- dsn => 'mysql_socket',
+ dsn => 'mariadb_socket',
copy => 1,
},
u => {
@@ -218,11 +218,11 @@ sub get_cxn_params {
qw(h P));
}
else {
- $dsn = 'DBI:mysql:' . ( $info->{D} || '' ) . ';'
+ $dsn = 'DBI:MariaDB:' . ( $info->{D} || '' ) . ';'
. join(';', map { "$opts{$_}->{dsn}=$info->{$_}" }
grep { defined $info->{$_} }
qw(F h P S A))
- . ';mysql_read_default_group=client';
+ . ';mariadb_read_default_group=client';
}
MKDEBUG && _d($dsn);
return ($dsn, $info->{u}, $info->{p});
@@ -249,7 +249,6 @@ sub get_dbh {
AutoCommit => 0,
RaiseError => 1,
PrintError => 0,
- mysql_enable_utf8 => ($cxn_string =~ m/charset=utf8/ ? 1 : 0),
};
@{$defaults}{ keys %$opts } = values %$opts;
my $dbh;
@@ -276,10 +275,6 @@ sub get_dbh {
};
if ( !$dbh && $EVAL_ERROR ) {
MKDEBUG && _d($EVAL_ERROR);
- if ( $EVAL_ERROR =~ m/not a compiled character set|character set utf8/ ) {
- MKDEBUG && _d("Going to try again without utf8 support");
- delete $defaults->{mysql_enable_utf8};
- }
if ( !$tries ) {
die $EVAL_ERROR;
}
@@ -301,11 +296,11 @@ sub get_dbh {
$dbh,
Dumper($dbh->selectrow_hashref(
'SELECT DATABASE(), CONNECTION_ID(), VERSION()/*!50038 , @@hostname*/')),
- ' Connection info: ', ($dbh->{mysql_hostinfo} || 'undef'),
+ ' Connection info: ', ($dbh->{mariadb_hostinfo} || 'undef'),
' Character set info: ',
Dumper($dbh->selectall_arrayref(
'SHOW VARIABLES LIKE "character_set%"', { Slice => {}})),
- ' $DBD::mysql::VERSION: ', $DBD::mysql::VERSION,
+ ' $DBD::MariaDB::VERSION: ', $DBD::MariaDB::VERSION,
' $DBI::VERSION: ', $DBI::VERSION,
);
return $dbh;
@@ -314,7 +309,7 @@ sub get_dbh {
# Tries to figure out a hostname for the connection.
sub get_hostname {
my ( $self, $dbh ) = @_;
- if ( my ($host) = ($dbh->{mysql_hostinfo} || '') =~ m/^(\w+) via/ ) {
+ if ( my ($host) = ($dbh->{mariadb_hostinfo} || '') =~ m/^(\w+) via/ ) {
return $host;
}
my ( $hostname, $one ) = $dbh->selectrow_array(
@@ -4534,7 +4529,7 @@ my %stmt_maker_for = (
eval { # This can fail if the table doesn't exist, INFORMATION_SCHEMA doesn't exist, etc.
my $cols = $dbh->selectall_arrayref(q{SHOW /*innotop*/ COLUMNS FROM INFORMATION_SCHEMA.INNODB_LOCK_WAITS});
if ( @$cols ) {
- if ($dbh->{mysql_serverinfo} =~ /^5.1/) {
+ if ($dbh->{mariadb_serverinfo} =~ /^5.1/) {
$sth = $dbh->prepare(q{
SELECT /*innotop*/
r.trx_mysql_thread_id AS waiting_thread,
@@ -7259,7 +7254,7 @@ sub create_statusbar {
my $cxn = '';
if ( 1 == @cxns && $dbhs{$cxns[0]} && $dbhs{$cxns[0]}->{dbh} ) {
- $cxn = $dbhs{$cxns[0]}->{dbh}->{mysql_serverinfo} || '';
+ $cxn = $dbhs{$cxns[0]}->{dbh}->{mariadb_serverinfo} || '';
}
else {
if ( $modes{$mode}->{server_group} ) {
@@ -7341,11 +7336,11 @@ sub add_new_dsn {
if ( !$dsn ) {
do {
$clear_screen_sub->();
- print "Typical DSN strings look like\n DBI:mysql:;host=hostname;port=port\n"
+ print "Typical DSN strings look like\n DBI:MariaDB:;host=hostname;port=port\n"
. "The db and port are optional and can usually be omitted.\n"
- . "If you specify 'mysql_read_default_group=mysql' many options can be read\n"
+ . "If you specify 'mariadb_read_default_group=mysql' many options can be read\n"
. "from your mysql options files (~/.my.cnf, /etc/my.cnf).\n\n";
- $dsn = prompt("Enter a DSN string", undef, "DBI:mysql:;mysql_read_default_group=mysql;host=$name");
+ $dsn = prompt("Enter a DSN string", undef, "DBI:MariaDB:;mariadb_read_default_group=mysql;host=$name");
} until ( $dsn );
}
if ( !$dl_table ) {
@@ -7674,7 +7669,7 @@ sub connect_to_db {
# Compares versions like 5.0.27 and 4.1.15-standard-log
sub version_ge {
my ( $dbh, $target ) = @_;
- my $version = sprintf('%03d%03d%03d', $dbh->{mysql_serverinfo} =~ m/^(\d+).(\d+).(\d+)/g);
+ my $version = sprintf('%03d%03d%03d', $dbh->{mariadb_serverinfo} =~ m/^(\d+).(\d+).(\d+)/g);
return $version ge sprintf('%03d%03d%03d', $target =~ m/(\d+)/g);
}
@@ -7686,7 +7681,7 @@ sub get_driver_status {
next unless $dbhs{$cxn} && $dbhs{$cxn}->{dbh} && $dbhs{$cxn}->{dbh}->{Active};
$vars{$cxn}->{$clock} ||= {};
my $vars = $vars{$cxn}->{$clock};
- my %res = map { $_ =~ s/ +/_/g; $_ } $dbhs{$cxn}->{dbh}->{mysql_stat} =~ m/(\w[^:]+): ([\d\.]+)/g;
+ my %res = map { $_ =~ s/ +/_/g; $_ } $dbhs{$cxn}->{dbh}->{mariadb_stat} =~ m/(\w[^:]+): ([\d\.]+)/g;
map { $vars->{$_} ||= $res{$_} } keys %res;
$vars->{Uptime_hires} ||= get_uptime($cxn);
$vars->{cxn} = $cxn;
@@ -7703,14 +7698,14 @@ sub get_new_db_connection {
my $dsn = $connections{$connection}
or die "No connection named '$connection' is defined in your configuration";
- # don't ask for a username if mysql_read_default_group=client is in the DSN
- if ( !defined $dsn->{have_user} and $dsn->{dsn} !~ /mysql_read_default_group=client/ ) {
+ # don't ask for a username if mariadb_read_default_group=client is in the DSN
+ if ( !defined $dsn->{have_user} and $dsn->{dsn} !~ /mariadb_read_default_group=client/ ) {
my $answer = prompt("Do you want to specify a username for $connection?", undef, 'n');
$dsn->{have_user} = $answer && $answer =~ m/1|y/i;
}
- # don't ask for a password if mysql_read_default_group=client is in the DSN
- if ( !defined $dsn->{have_pass} and $dsn->{dsn} !~ /mysql_read_default_group=client/ ) {
+ # don't ask for a password if mariadb_read_default_group=client is in the DSN
+ if ( !defined $dsn->{have_pass} and $dsn->{dsn} !~ /mariadb_read_default_group=client/ ) {
my $answer = prompt("Do you want to specify a password for $connection?", undef, 'n');
$dsn->{have_pass} = $answer && $answer =~ m/1|y/i;
}
@@ -7939,10 +7934,10 @@ sub load_config {
# write a config
$config{readonly}->{val} = 0 if $opts{w};
# If no connections have been defined, connect to a MySQL database
- # on localhost using mysql_read_default_group=client
+ # on localhost using mariadb_read_default_group=client
if (!%connections) {
add_new_dsn('localhost',
- 'DBI:mysql:;host=localhost;mysql_read_default_group=client',
+ 'DBI:MariaDB:;host=localhost;mariadb_read_default_group=client',
'test.innotop_dl');
}
}
@@ -9374,7 +9369,7 @@ sub choose_thread {
my %thread_for = map {
# Eliminate innotop's own threads.
- $_ => $dbhs{$_}->{dbh} ? $dbhs{$_}->{dbh}->{mysql_thread_id} : 0
+ $_ => $dbhs{$_}->{dbh} ? $dbhs{$_}->{dbh}->{mariadb_thread_id} : 0
} keys %connections;
my @candidates = grep {
@@ -9899,7 +9894,7 @@ Enter; otherwise, you will need to change to innotop's directory and type "perl
innotop".
With no options specified, innotop will attempt to connect to a MySQL server on
-localhost using mysql_read_default_group=client for other connection
+localhost using mariadb_read_default_group=client for other connection
parameters. If you need to specify a different username and password, use the
-u and -p options, respectively. To monitor a MySQL database on another
host, use the -h option.
@@ -10394,15 +10389,15 @@ inputs, as follows:
A DSN is a Data Source Name, which is the initial argument passed to the DBI
module for connecting to a server. It is usually of the form
- DBI:mysql:;mysql_read_default_group=mysql;host=HOSTNAME
+ DBI:MariaDB:;mariadb_read_default_group=mysql;host=HOSTNAME
-Since this DSN is passed to the DBD::mysql driver, you should read the driver's
-documentation at L<"http://search.cpan.org/dist/DBD-mysql/lib/DBD/mysql.pm"> for
+Since this DSN is passed to the DBD::MariaDB driver, you should read the driver's
+documentation at L<https://metacpan.org/pod/DBD::MariaDB> for
the exact details on all the options you can pass the driver in the DSN. You
can read more about DBI at L<http://dbi.perl.org/docs/>, and especially at
L<http://search.cpan.org/~timb/DBI/DBI.pm>.
-The mysql_read_default_group=mysql option lets the DBD driver read your MySQL
+The mariadb_read_default_group=mysql option lets the DBD driver read your MySQL
options files, such as ~/.my.cnf on UNIX-ish systems. You can use this to avoid
specifying a username or password for the connection.
@@ -12137,7 +12132,7 @@ You need appropriate privileges to create and drop the deadlock tables if needed
=head1 SYSTEM REQUIREMENTS
You need Perl to run innotop, of course. You also need a few Perl modules: DBI,
-DBD::mysql, Term::ReadKey, and Time::HiRes. These should be included with most
+DBD::MariaDB, Term::ReadKey, and Time::HiRes. These should be included with most
Perl distributions, but in case they are not, I recommend using versions
distributed with your operating system or Perl distribution, not from CPAN.
Term::ReadKey in particular has been known to cause problems if installed from
diff --git a/debian/additions/innotop/innotop.1 b/debian/additions/innotop/innotop.1
index 4c705422286..fefea717cd6 100644
--- a/debian/additions/innotop/innotop.1
+++ b/debian/additions/innotop/innotop.1
@@ -184,7 +184,7 @@ Enter; otherwise, you will need to change to innotop's directory and type \*(L"p
innotop\*(R".
.PP
With no options specified, innotop will attempt to connect to a MySQL server on
-localhost using mysql_read_default_group=client for other connection
+localhost using mariadb_read_default_group=client for other connection
parameters. If you need to specify a different username and password, use the
\&\-u and \-p options, respectively. To monitor a MySQL database on another
host, use the \-h option.
@@ -626,16 +626,16 @@ A \s-1DSN\s0 is a Data Source Name, which is the initial argument passed to the
module for connecting to a server. It is usually of the form
.Sp
.Vb 1
-\& DBI:mysql:;mysql_read_default_group=mysql;host=HOSTNAME
+\& DBI:MariaDB:;mariadb_read_default_group=mysql;host=HOSTNAME
.Ve
.Sp
-Since this \s-1DSN\s0 is passed to the DBD::mysql driver, you should read the driver's
-documentation at \*(L"/search.cpan.org/dist/DBD\-mysql/lib/DBD/mysql.pm\*(R"\*(L" in \*(R"http: for
+Since this \s-1DSN\s0 is passed to the DBD::MariaDB driver, you should read the driver's
+documentation at <https://metacpan.org/pod/DBD::MariaDB> for
the exact details on all the options you can pass the driver in the \s-1DSN. \s0 You
can read more about \s-1DBI\s0 at <http://dbi.perl.org/docs/>, and especially at
<http://search.cpan.org/~timb/DBI/DBI.pm>.
.Sp
-The mysql_read_default_group=mysql option lets the \s-1DBD\s0 driver read your MySQL
+The mariadb_read_default_group=mysql option lets the \s-1DBD\s0 driver read your MySQL
options files, such as ~/.my.cnf on UNIX-ish systems. You can use this to avoid
specifying a username or password for the connection.
.IP "InnoDB Deadlock Table" 4
@@ -2095,7 +2095,7 @@ You need appropriate privileges to create and drop the deadlock tables if needed
.SH "SYSTEM REQUIREMENTS"
.IX Header "SYSTEM REQUIREMENTS"
You need Perl to run innotop, of course. You also need a few Perl modules: \s-1DBI,\s0
-DBD::mysql, Term::ReadKey, and Time::HiRes. These should be included with most
+DBD::MariaDB, Term::ReadKey, and Time::HiRes. These should be included with most
Perl distributions, but in case they are not, I recommend using versions
distributed with your operating system or Perl distribution, not from \s-1CPAN.\s0
Term::ReadKey in particular has been known to cause problems if installed from
diff --git a/debian/additions/mysql.init b/debian/additions/mysql.init
index bcc366e95b7..0d4c6019ab5 100644
--- a/debian/additions/mysql.init
+++ b/debian/additions/mysql.init
@@ -158,7 +158,7 @@ case "${1:-''}" in
if ! mysqld_status check_dead warn; then
log_end_msg 1
- log_failure_msg "Please stop MariaDB manually and read /usr/share/doc/mariadb-server-10.4/README.Debian.gz!"
+ log_failure_msg "Please stop MariaDB manually and read /usr/share/doc/mariadb-server-10.5/README.Debian.gz!"
exit -1
else
log_end_msg 0
diff --git a/debian/additions/mysqlreport b/debian/additions/mysqlreport
index 6588b17f808..6ee9f1b1ac9 100755
--- a/debian/additions/mysqlreport
+++ b/debian/additions/mysqlreport
@@ -245,15 +245,15 @@ sub connect_to_MySQL
if($mycnf{'socket'} && -S $mycnf{'socket'})
{
- $dsn = "DBI:mysql:mysql_socket=$mycnf{socket}";
+ $dsn = "DBI:MariaDB:mariadb_socket=$mycnf{socket}";
}
elsif($mycnf{'host'})
{
- $dsn = "DBI:mysql:host=$mycnf{host}" . ($mycnf{port} ? ";port=$mycnf{port}" : "");
+ $dsn = "DBI:MariaDB:host=$mycnf{host}" . ($mycnf{port} ? ";port=$mycnf{port}" : "");
}
else
{
- $dsn = "DBI:mysql:host=localhost";
+ $dsn = "DBI:MariaDB:host=localhost";
}
print "connect_to_MySQL: DBI DSN: $dsn\n" if $op{debug};
diff --git a/debian/additions/mysqlreport.1 b/debian/additions/mysqlreport.1
index 5ae6b9e3b92..29435193ec1 100644
--- a/debian/additions/mysqlreport.1
+++ b/debian/additions/mysqlreport.1
@@ -160,7 +160,7 @@ command line option and operation. The FROM: field is
\fB\-\-flush\-status\fR
Execute a "FLUSH STATUS;" after generating the reports.
If you do not have permissions in MySQL to do this an
-error from DBD::mysql::st will be printed after the
+error from DBD::MariaDB::st will be printed after the
reports.
.SH "AUTHORS"
diff --git a/debian/autobake-deb.sh b/debian/autobake-deb.sh
index 7d2301c7369..8b70e784615 100755
--- a/debian/autobake-deb.sh
+++ b/debian/autobake-deb.sh
@@ -67,9 +67,9 @@ then
sed 's/ --with systemd//' -i debian/rules
sed '/systemd/d' -i debian/rules
sed '/\.service/d' -i debian/rules
- sed '/galera_new_cluster/d' -i debian/mariadb-server-10.4.install
- sed '/galera_recovery/d' -i debian/mariadb-server-10.4.install
- sed '/mariadb-service-convert/d' -i debian/mariadb-server-10.4.install
+ sed '/galera_new_cluster/d' -i debian/mariadb-server-10.5.install
+ sed '/galera_recovery/d' -i debian/mariadb-server-10.5.install
+ sed '/mariadb-service-convert/d' -i debian/mariadb-server-10.5.install
fi
# If libzstd-dev is not available (before Debian Stretch and Ubuntu Xenial)
@@ -106,6 +106,8 @@ then
sed '/Package: mariadb-plugin-cassandra/,/^$/d' -i debian/control
fi
+sed -i -e "/Package: mariadb-plugin-tokudb/,/^$/d" debian/control
+
# Mroonga, TokuDB never built on Travis CI anyway, see build flags above
if [[ $TRAVIS ]]
then
@@ -113,7 +115,7 @@ then
sed -i -e "/Package: mariadb-plugin-mroonga/,/^$/d" debian/control
sed -i -e "/Package: mariadb-plugin-spider/,/^$/d" debian/control
sed -i -e "/Package: mariadb-plugin-oqgraph/,/^$/d" debian/control
- sed -i -e "/usr\/lib\/mysql\/plugin\/ha_sphinx.so/d" debian/mariadb-server-10.4.install
+ sed -i -e "/usr\/lib\/mysql\/plugin\/ha_sphinx.so/d" debian/mariadb-server-10.5.install
sed -i -e "/Package: libmariadbd-dev/,/^$/d" debian/control
fi
diff --git a/debian/changelog b/debian/changelog
index 053727796d0..581da3bc92f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+mariadb-10.5 (1:10.5.0) unstable; urgency=low
+
+ * Initial Release
+
+ -- Vicentiu Ciorbaru <vicentiu@mariadb.org> Tue, 21 May 2019 13:27:19 +0000
+
mariadb-10.4 (1:10.4.0) unstable; urgency=low
* Initial release.
diff --git a/debian/control b/debian/control
index c433dd3f892..97275235f76 100644
--- a/debian/control
+++ b/debian/control
@@ -1,4 +1,4 @@
-Source: mariadb-10.4
+Source: mariadb-10.5
Section: database
Priority: optional
Maintainer: MariaDB Developers <maria-developers@lists.launchpad.net>
@@ -232,7 +232,7 @@ Description: MariaDB database common files (e.g. /etc/mysql/conf.d/mariadb.cnf)
This package includes files needed by all versions of the client library
(e.g. /etc/mysql/conf.d/mariadb.cnf).
-Package: mariadb-client-core-10.4
+Package: mariadb-client-core-10.5
Architecture: any
Depends: libmariadb3,
mariadb-common (>= ${source:Version}),
@@ -242,6 +242,7 @@ Conflicts: mariadb-client-10.0,
mariadb-client-10.1,
mariadb-client-10.2,
mariadb-client-10.3,
+ mariadb-client-10.4,
mariadb-client-5.1,
mariadb-client-5.2,
mariadb-client-5.3,
@@ -250,6 +251,7 @@ Conflicts: mariadb-client-10.0,
mariadb-client-core-10.1,
mariadb-client-core-10.2,
mariadb-client-core-10.3,
+ mariadb-client-core-10.4,
mariadb-client-core-5.1,
mariadb-client-core-5.2,
mariadb-client-core-5.3,
@@ -267,6 +269,7 @@ Replaces: mariadb-client-10.0,
mariadb-client-10.1,
mariadb-client-10.2,
mariadb-client-10.3,
+ mariadb-client-10.4,
mariadb-client-5.1,
mariadb-client-5.2,
mariadb-client-5.3,
@@ -275,6 +278,7 @@ Replaces: mariadb-client-10.0,
mariadb-client-core-10.1,
mariadb-client-core-10.2,
mariadb-client-core-10.3,
+ mariadb-client-core-10.4,
mariadb-client-core-5.1,
mariadb-client-core-5.2,
mariadb-client-core-5.3,
@@ -303,10 +307,10 @@ Description: MariaDB database core client binaries
.
This package includes the core client files, as used by Akonadi.
-Package: mariadb-client-10.4
+Package: mariadb-client-10.5
Architecture: any
Depends: debianutils (>=1.6),
- mariadb-client-core-10.4 (>= ${source:Version}),
+ mariadb-client-core-10.5 (>= ${source:Version}),
mariadb-common,
${misc:Depends},
${perl:Depends},
@@ -316,6 +320,7 @@ Conflicts: mariadb-client (<< ${source:Version}),
mariadb-client-10.1,
mariadb-client-10.2,
mariadb-client-10.3,
+ mariadb-client-10.4,
mariadb-client-5.1,
mariadb-client-5.2,
mariadb-client-5.3,
@@ -332,6 +337,7 @@ Replaces: mariadb-client (<< ${source:Version}),
mariadb-client-10.1,
mariadb-client-10.2,
mariadb-client-10.3,
+ mariadb-client-10.4,
mariadb-client-5.1,
mariadb-client-5.2,
mariadb-client-5.3,
@@ -351,7 +357,7 @@ Provides: default-mysql-client,
mysql-client-5.6,
mysql-client-5.7,
virtual-mysql-client
-Recommends: libdbd-mysql-perl (>= 1.2202),
+Recommends: libdbd-mariadb-perl,
libdbi-perl,
libterm-readkey-perl
Description: MariaDB database client binaries
@@ -363,7 +369,7 @@ Description: MariaDB database client binaries
This package includes the client binaries and the additional tools
innotop and mysqlreport.
-Package: mariadb-server-core-10.4
+Package: mariadb-server-core-10.5
Architecture: any
Depends: mariadb-common (>= ${source:Version}),
${misc:Depends},
@@ -372,6 +378,7 @@ Conflicts: mariadb-server-core-10.0,
mariadb-server-core-10.1,
mariadb-server-core-10.2,
mariadb-server-core-10.3,
+ mariadb-server-core-10.4,
mariadb-server-core-5.1,
mariadb-server-core-5.2,
mariadb-server-core-5.3,
@@ -387,16 +394,21 @@ Breaks: mariadb-client-10.0,
mariadb-client-10.1,
mariadb-client-10.2,
mariadb-client-10.3,
- mariadb-server-10.3
+ mariadb-server-10.3,
+ mariadb-client-10.4,
+ mariadb-server-10.4
Replaces: mariadb-client-10.0,
mariadb-client-10.1,
mariadb-client-10.2,
mariadb-client-10.3,
mariadb-server-10.3,
+ mariadb-client-10.4,
+ mariadb-server-10.4,
mariadb-server-core-10.0,
mariadb-server-core-10.1,
mariadb-server-core-10.2,
mariadb-server-core-10.3,
+ mariadb-server-core-10.4,
mariadb-server-core-5.1,
mariadb-server-core-5.2,
mariadb-server-core-5.3,
@@ -423,7 +435,7 @@ Description: MariaDB database core server files
.
This package includes the core server files, as used by Akonadi.
-Package: mariadb-server-10.4
+Package: mariadb-server-10.5
Architecture: any
Suggests: mailx,
mariadb-test,
@@ -439,8 +451,8 @@ Depends: galera-4 (>=26.4),
libdbi-perl,
lsb-base (>= 3.0-10),
lsof,
- mariadb-client-10.4 (>= ${source:Version}),
- mariadb-server-core-10.4 (>= ${binary:Version}),
+ mariadb-client-10.5 (>= ${source:Version}),
+ mariadb-server-core-10.5 (>= ${binary:Version}),
passwd,
perl (>= 5.6),
psmisc,
@@ -453,6 +465,7 @@ Conflicts: mariadb-server (<< ${source:Version}),
mariadb-server-10.1,
mariadb-server-10.2,
mariadb-server-10.3,
+ mariadb-server-10.4,
mariadb-server-5.1,
mariadb-server-5.2,
mariadb-server-5.3,
@@ -476,6 +489,7 @@ Replaces: libmariadbclient-dev (<< 5.5.0),
mariadb-server-10.1,
mariadb-server-10.2,
mariadb-server-10.3,
+ mariadb-server-10.4,
mariadb-server-5.1,
mariadb-server-5.2,
mariadb-server-5.3,
@@ -504,11 +518,11 @@ Description: MariaDB database server binaries
Package: mariadb-server
Architecture: all
-Depends: mariadb-server-10.4 (>= ${source:Version}),
+Depends: mariadb-server-10.5 (>= ${source:Version}),
${misc:Depends}
Description: MariaDB database server (metapackage depending on the latest version)
This is an empty package that depends on the current "best" version of
- mariadb-server (currently mariadb-server-10.4), as determined by the MariaDB
+ mariadb-server (currently mariadb-server-10.5), as determined by the MariaDB
maintainers. Install this package if in doubt about which MariaDB
version you need. That will install the version recommended by the
package maintainers.
@@ -520,11 +534,11 @@ Description: MariaDB database server (metapackage depending on the latest versio
Package: mariadb-client
Architecture: all
-Depends: mariadb-client-10.4 (>= ${source:Version}),
+Depends: mariadb-client-10.5 (>= ${source:Version}),
${misc:Depends}
Description: MariaDB database client (metapackage depending on the latest version)
This is an empty package that depends on the current "best" version of
- mariadb-client (currently mariadb-client-10.4), as determined by the MariaDB
+ mariadb-client (currently mariadb-client-10.5), as determined by the MariaDB
maintainers. Install this package if in doubt about which MariaDB version
you want, as this is the one considered to be in the best shape.
@@ -534,7 +548,7 @@ Breaks: mariadb-backup-10.1,
mariadb-backup-10.2
Replaces: mariadb-backup-10.1,
mariadb-backup-10.2
-Depends: mariadb-client-core-10.4 (= ${binary:Version}),
+Depends: mariadb-client-core-10.5 (= ${binary:Version}),
${misc:Depends},
${shlibs:Depends}
Description: Backup tool for MariaDB server
@@ -547,16 +561,18 @@ Description: Backup tool for MariaDB server
Package: mariadb-plugin-connect
Architecture: any
Depends: libxml2,
- mariadb-server-10.4 (= ${binary:Version}),
+ mariadb-server-10.5 (= ${binary:Version}),
unixodbc,
${misc:Depends},
${shlibs:Depends}
Breaks: mariadb-connect-engine-10.1,
mariadb-connect-engine-10.2,
- mariadb-connect-engine-10.3
+ mariadb-connect-engine-10.3,
+ mariadb-connect-engine-10.4
Replaces: mariadb-connect-engine-10.1,
mariadb-connect-engine-10.2,
- mariadb-connect-engine-10.3
+ mariadb-connect-engine-10.3,
+ mariadb-connect-engine-10.4
Description: Connect storage engine for MariaDB
Connect engine supports a number of file formats (dbf, xml, txt, bin, etc),
connections to ODBC tables and remote MySQL tables, as well as a number of
@@ -565,13 +581,15 @@ Description: Connect storage engine for MariaDB
Package: mariadb-plugin-rocksdb
Architecture: amd64 arm64 mips64el ppc64el
-Depends: mariadb-server-10.4 (= ${binary:Version}),
+Depends: mariadb-server-10.5 (= ${binary:Version}),
${misc:Depends},
${shlibs:Depends}
Breaks: mariadb-rocksdb-engine-10.2,
- mariadb-rocksdb-engine-10.3
+ mariadb-rocksdb-engine-10.3,
+ mariadb-rocksdb-engine-10.4
Replaces: mariadb-rocksdb-engine-10.2,
- mariadb-rocksdb-engine-10.3
+ mariadb-rocksdb-engine-10.3,
+ mariadb-rocksdb-engine-10.4
Recommends: python-mysqldb
Description: RocksDB storage engine for MariaDB
The RocksDB storage engine is a high performance storage engine, aimed
@@ -581,15 +599,17 @@ Description: RocksDB storage engine for MariaDB
Package: mariadb-plugin-oqgraph
Architecture: any
Depends: libjudydebian1,
- mariadb-server-10.4 (= ${binary:Version}),
+ mariadb-server-10.5 (= ${binary:Version}),
${misc:Depends},
${shlibs:Depends}
Breaks: mariadb-oqgraph-engine-10.1,
mariadb-oqgraph-engine-10.2,
- mariadb-oqgraph-engine-10.3
+ mariadb-oqgraph-engine-10.3,
+ mariadb-oqgraph-engine-10.4
Replaces: mariadb-oqgraph-engine-10.1,
mariadb-oqgraph-engine-10.2,
- mariadb-oqgraph-engine-10.3
+ mariadb-oqgraph-engine-10.3,
+ mariadb-oqgraph-engine-10.4
Description: OQGraph storage engine for MariaDB
The OQGraph engine is a computation engine plugin for handling hierarchies
(trees) and graphs (friend-of-a-friend, etc) cleanly through standard SQL.
@@ -598,17 +618,19 @@ Description: OQGraph storage engine for MariaDB
Package: mariadb-plugin-tokudb
Architecture: amd64
Depends: libjemalloc1 (>= 3.0.0~) | libjemalloc2,
- mariadb-server-10.4 (= ${binary:Version}),
+ mariadb-server-10.5 (= ${binary:Version}),
${misc:Depends},
${shlibs:Depends}
Breaks: mariadb-server-10.0,
mariadb-server-10.1,
mariadb-server-10.2,
- mariadb-server-10.3
+ mariadb-server-10.3,
+ mariadb-server-10.4
Replaces: mariadb-server-10.0,
mariadb-server-10.1,
mariadb-server-10.2,
- mariadb-server-10.3
+ mariadb-server-10.3,
+ mariadb-server-10.4
Description: TokuDB storage engine for MariaDB
The TokuDB storage engine is for use in high-performance and write-intensive
environments, offering increased compression and better performance based
@@ -617,17 +639,19 @@ Description: TokuDB storage engine for MariaDB
Package: mariadb-plugin-mroonga
Architecture: any-alpha any-amd64 any-arm any-arm64 any-i386 any-ia64 any-mips64el any-mips64r6el any-mipsel any-mipsr6el any-nios2 any-powerpcel any-ppc64el any-sh3 any-sh4 any-tilegx
-Depends: mariadb-server-10.4 (= ${binary:Version}),
+Depends: mariadb-server-10.5 (= ${binary:Version}),
${misc:Depends},
${shlibs:Depends}
Breaks: mariadb-server-10.0,
mariadb-server-10.1,
mariadb-server-10.2,
- mariadb-server-10.3
+ mariadb-server-10.3,
+ mariadb-server-10.4
Replaces: mariadb-server-10.0,
mariadb-server-10.1,
mariadb-server-10.2,
- mariadb-server-10.3
+ mariadb-server-10.3,
+ mariadb-server-10.4
Description: Mroonga storage engine for MariaDB
Mroonga (formerly named Groonga Storage Engine) is a storage engine that
provides fast CJK-ready full text searching using column store.
@@ -635,17 +659,19 @@ Description: Mroonga storage engine for MariaDB
Package: mariadb-plugin-spider
Architecture: any
-Depends: mariadb-server-10.4 (= ${binary:Version}),
+Depends: mariadb-server-10.5 (= ${binary:Version}),
${misc:Depends},
${shlibs:Depends}
Breaks: mariadb-server-10.0,
mariadb-server-10.1,
mariadb-server-10.2,
- mariadb-server-10.3
+ mariadb-server-10.3,
+ mariadb-server-10.4
Replaces: mariadb-server-10.0,
mariadb-server-10.1,
mariadb-server-10.2,
- mariadb-server-10.3
+ mariadb-server-10.3,
+ mariadb-server-10.4
Description: Spider storage engine for MariaDB
The Spider storage engine with built-in sharding features. It supports
partitioning and xa transactions, and allows tables of different MariaDB
@@ -654,17 +680,19 @@ Description: Spider storage engine for MariaDB
Package: mariadb-plugin-cassandra
Architecture: any
-Depends: mariadb-server-10.4 (= ${binary:Version}),
+Depends: mariadb-server-10.5 (= ${binary:Version}),
${misc:Depends},
${shlibs:Depends}
Breaks: mariadb-server-10.0,
mariadb-server-10.1,
mariadb-server-10.2,
- mariadb-server-10.3
+ mariadb-server-10.3,
+ mariadb-server-10.4
Replaces: mariadb-server-10.0,
mariadb-server-10.1,
mariadb-server-10.2,
- mariadb-server-10.3
+ mariadb-server-10.3,
+ mariadb-server-10.4
Description: Cassandra storage engine for MariaDB
The Cassandra Storage Engine allows access to data in a Cassandra cluster from
MariaDB, combining the best of SQL and no-SQL worlds. Cassandra SE (storage
@@ -676,15 +704,17 @@ Description: Cassandra storage engine for MariaDB
Package: mariadb-plugin-gssapi-server
Architecture: any
Depends: libgssapi-krb5-2,
- mariadb-server-10.4 (= ${binary:Version}),
+ mariadb-server-10.5 (= ${binary:Version}),
${misc:Depends},
${shlibs:Depends}
Breaks: mariadb-gssapi-server-10.1,
mariadb-gssapi-server-10.2,
- mariadb-gssapi-server-10.3
+ mariadb-gssapi-server-10.3,
+ mariadb-gssapi-server-10.4
Replaces: mariadb-gssapi-server-10.1,
mariadb-gssapi-server-10.2,
- mariadb-gssapi-server-10.3
+ mariadb-gssapi-server-10.3,
+ mariadb-gssapi-server-10.4
Description: GSSAPI authentication plugin for MariaDB server
This plugin includes support for Kerberos on Unix, but can also be used for
Windows authentication with or without domain environment.
@@ -694,15 +724,17 @@ Description: GSSAPI authentication plugin for MariaDB server
Package: mariadb-plugin-gssapi-client
Architecture: any
Depends: libgssapi-krb5-2,
- mariadb-client-10.4 (= ${binary:Version}),
+ mariadb-client-10.5 (= ${binary:Version}),
${misc:Depends},
${shlibs:Depends}
Breaks: mariadb-gssapi-client-10.1,
mariadb-gssapi-client-10.2,
- mariadb-gssapi-client-10.3
+ mariadb-gssapi-client-10.3,
+ mariadb-gssapi-client-10.4
Replaces: mariadb-gssapi-client-10.1,
mariadb-gssapi-client-10.2,
- mariadb-gssapi-client-10.3
+ mariadb-gssapi-client-10.3,
+ mariadb-gssapi-client-10.4
Description: GSSAPI authentication plugin for MariaDB client
This plugin includes support for Kerberos on Unix, but can also be used for
Windows authentication with or without domain environment.
@@ -712,7 +744,7 @@ Description: GSSAPI authentication plugin for MariaDB client
Package: mariadb-plugin-cracklib-password-check
Architecture: any
Depends: libcrack2 (>= 2.9.0),
- mariadb-server-10.4 (= ${binary:Version}),
+ mariadb-server-10.5 (= ${binary:Version}),
${misc:Depends},
${shlibs:Depends}
Description: CrackLib Password Validation Plugin for MariaDB
@@ -723,8 +755,8 @@ Description: CrackLib Password Validation Plugin for MariaDB
Package: mariadb-test
Architecture: any
-Depends: mariadb-client-10.4 (= ${binary:Version}),
- mariadb-server-10.4 (= ${binary:Version}),
+Depends: mariadb-client-10.5 (= ${binary:Version}),
+ mariadb-server-10.5 (= ${binary:Version}),
mariadb-test-data (= ${source:Version}),
${misc:Depends},
${shlibs:Depends}
@@ -733,6 +765,7 @@ Breaks: mariadb-server-5.5,
mariadb-test-10.1,
mariadb-test-10.2,
mariadb-test-10.3,
+ mariadb-test-10.4,
mariadb-test-5.5,
mysql-testsuite,
mysql-testsuite-5.5,
@@ -744,6 +777,7 @@ Replaces: mariadb-server-5.5,
mariadb-test-10.1,
mariadb-test-10.2,
mariadb-test-10.3,
+ mariadb-test-10.4,
mariadb-test-5.5,
mysql-testsuite,
mysql-testsuite-5.5,
diff --git a/debian/mariadb-client-10.4.README.Debian b/debian/mariadb-client-10.5.README.Debian
index 64f0f509951..64f0f509951 100644
--- a/debian/mariadb-client-10.4.README.Debian
+++ b/debian/mariadb-client-10.5.README.Debian
diff --git a/debian/mariadb-client-10.4.docs b/debian/mariadb-client-10.5.docs
index c09092629c3..c09092629c3 100644
--- a/debian/mariadb-client-10.4.docs
+++ b/debian/mariadb-client-10.5.docs
diff --git a/debian/mariadb-client-10.4.install b/debian/mariadb-client-10.5.install
index 4cd0af71c24..4cd0af71c24 100644
--- a/debian/mariadb-client-10.4.install
+++ b/debian/mariadb-client-10.5.install
diff --git a/debian/mariadb-client-10.4.links b/debian/mariadb-client-10.5.links
index 5d966575b76..5d966575b76 100644
--- a/debian/mariadb-client-10.4.links
+++ b/debian/mariadb-client-10.5.links
diff --git a/debian/mariadb-client-10.4.manpages b/debian/mariadb-client-10.5.manpages
index 6f3e2bc188c..6f3e2bc188c 100644
--- a/debian/mariadb-client-10.4.manpages
+++ b/debian/mariadb-client-10.5.manpages
diff --git a/debian/mariadb-client-10.4.menu b/debian/mariadb-client-10.5.menu
index 58f7ebfc45f..bb9d6f9076d 100644
--- a/debian/mariadb-client-10.4.menu
+++ b/debian/mariadb-client-10.5.menu
@@ -1,3 +1,3 @@
# According to /usr/share/menu/ policy 1.4, not /usr/share/doc/debian-policy/
-?package(mariadb-client-10.4):needs="text" section="Applications/Data Management"\
+?package(mariadb-client-10.5):needs="text" section="Applications/Data Management"\
title="Innotop" command="/usr/bin/innotop"
diff --git a/debian/mariadb-client-core-10.4.install b/debian/mariadb-client-core-10.5.install
index 4cc61674770..4cc61674770 100644
--- a/debian/mariadb-client-core-10.4.install
+++ b/debian/mariadb-client-core-10.5.install
diff --git a/debian/mariadb-client-core-10.4.links b/debian/mariadb-client-core-10.5.links
index d889e7164b0..d889e7164b0 100644
--- a/debian/mariadb-client-core-10.4.links
+++ b/debian/mariadb-client-core-10.5.links
diff --git a/debian/mariadb-plugin-tokudb.install b/debian/mariadb-plugin-tokudb.install
index 40dd0e78c65..3e970530f2b 100644
--- a/debian/mariadb-plugin-tokudb.install
+++ b/debian/mariadb-plugin-tokudb.install
@@ -3,6 +3,6 @@ etc/systemd/system/mariadb.service.d/tokudb.conf
usr/bin/tokuft_logprint
usr/bin/tokuftdump
usr/lib/mysql/plugin/ha_tokudb.so
-usr/share/doc/mariadb-server-10.4/README.md usr/share/doc/mariadb-plugin-tokudb/README.md
+usr/share/doc/mariadb-server-10.5/README.md usr/share/doc/mariadb-plugin-tokudb/README.md
usr/share/man/man1/tokuft_logprint.1
usr/share/man/man1/tokuftdump.1
diff --git a/debian/mariadb-server-10.4.README.Debian b/debian/mariadb-server-10.5.README.Debian
index 5a05f196042..5a05f196042 100644
--- a/debian/mariadb-server-10.4.README.Debian
+++ b/debian/mariadb-server-10.5.README.Debian
diff --git a/debian/mariadb-server-10.4.config b/debian/mariadb-server-10.5.config
index 1929c370d6d..1929c370d6d 100644
--- a/debian/mariadb-server-10.4.config
+++ b/debian/mariadb-server-10.5.config
diff --git a/debian/mariadb-server-10.4.dirs b/debian/mariadb-server-10.5.dirs
index 5057fe806c3..5057fe806c3 100644
--- a/debian/mariadb-server-10.4.dirs
+++ b/debian/mariadb-server-10.5.dirs
diff --git a/debian/mariadb-server-10.4.install b/debian/mariadb-server-10.5.install
index b6bfb04a344..761dba8ae0f 100644
--- a/debian/mariadb-server-10.4.install
+++ b/debian/mariadb-server-10.5.install
@@ -57,8 +57,8 @@ usr/lib/mysql/plugin/server_audit.so
usr/lib/mysql/plugin/simple_password_check.so
usr/lib/mysql/plugin/sql_errlog.so
usr/lib/mysql/plugin/wsrep_info.so
-usr/share/apport/package-hooks/source_mariadb-10.4.py
-usr/share/doc/mariadb-server-10.4/mysqld.sym.gz
+usr/share/apport/package-hooks/source_mariadb-10.5.py
+usr/share/doc/mariadb-server-10.5/mysqld.sym.gz
usr/share/man/man1/aria_chk.1
usr/share/man/man1/aria_dump_log.1
usr/share/man/man1/aria_ftdump.1
diff --git a/debian/mariadb-server-10.4.links b/debian/mariadb-server-10.5.links
index f2d97460371..f2d97460371 100644
--- a/debian/mariadb-server-10.4.links
+++ b/debian/mariadb-server-10.5.links
diff --git a/debian/mariadb-server-10.4.logcheck.ignore.paranoid b/debian/mariadb-server-10.5.logcheck.ignore.paranoid
index 00cc5c3e29d..00cc5c3e29d 100644
--- a/debian/mariadb-server-10.4.logcheck.ignore.paranoid
+++ b/debian/mariadb-server-10.5.logcheck.ignore.paranoid
diff --git a/debian/mariadb-server-10.4.logcheck.ignore.server b/debian/mariadb-server-10.5.logcheck.ignore.server
index a0b4792ecda..a0b4792ecda 100644
--- a/debian/mariadb-server-10.4.logcheck.ignore.server
+++ b/debian/mariadb-server-10.5.logcheck.ignore.server
diff --git a/debian/mariadb-server-10.4.logcheck.ignore.workstation b/debian/mariadb-server-10.5.logcheck.ignore.workstation
index a0b4792ecda..a0b4792ecda 100644
--- a/debian/mariadb-server-10.4.logcheck.ignore.workstation
+++ b/debian/mariadb-server-10.5.logcheck.ignore.workstation
diff --git a/debian/mariadb-server-10.4.mysql-server.logrotate b/debian/mariadb-server-10.5.mysql-server.logrotate
index 4111a276dc3..4111a276dc3 100644
--- a/debian/mariadb-server-10.4.mysql-server.logrotate
+++ b/debian/mariadb-server-10.5.mysql-server.logrotate
diff --git a/debian/mariadb-server-10.4.mysql.default b/debian/mariadb-server-10.5.mysql.default
index 146c5a87a84..146c5a87a84 100644
--- a/debian/mariadb-server-10.4.mysql.default
+++ b/debian/mariadb-server-10.5.mysql.default
diff --git a/debian/mariadb-server-10.4.postinst b/debian/mariadb-server-10.5.postinst
index fbb2584f2df..05aa6426b2a 100644
--- a/debian/mariadb-server-10.4.postinst
+++ b/debian/mariadb-server-10.5.postinst
@@ -102,7 +102,7 @@ EOF
# Clean up old flags before setting new one
rm -f $mysql_datadir/debian-*.flag
# Flag data dir to avoid downgrades
- touch $mysql_datadir/debian-10.4.flag
+ touch $mysql_datadir/debian-10.5.flag
# initiate databases. Output is not allowed by debconf :-(
# This will fail if we are upgrading an existing database; in this case
diff --git a/debian/mariadb-server-10.4.postrm b/debian/mariadb-server-10.5.postrm
index 3cbd3721414..f0698d6e0a6 100644
--- a/debian/mariadb-server-10.4.postrm
+++ b/debian/mariadb-server-10.5.postrm
@@ -45,9 +45,9 @@ if [ "$1" = "purge" -a ! \( -x /usr/sbin/mysqld -o -L /usr/sbin/mysqld \) ]; the
rm -f /var/log/mysql.{log,err}{,.0,.[1234567].gz}
rm -rf /var/log/mysql
- db_input high mariadb-server-10.4/postrm_remove_databases || true
+ db_input high mariadb-server-10.5/postrm_remove_databases || true
db_go || true
- db_get mariadb-server-10.4/postrm_remove_databases || true
+ db_get mariadb-server-10.5/postrm_remove_databases || true
if [ "$RET" = "true" ]; then
# never remove the debian.cnf when the databases are still existing
# else we ran into big trouble on the next install!
diff --git a/debian/mariadb-server-10.4.preinst b/debian/mariadb-server-10.5.preinst
index 560e03784f5..8dce0a4beef 100644
--- a/debian/mariadb-server-10.4.preinst
+++ b/debian/mariadb-server-10.5.preinst
@@ -41,7 +41,7 @@ stop_server() {
################################ main() ##########################
-this_version=10.4
+this_version=10.5
max_upgradeable_version=5.7
# Check if a flag file is found that indicates a previous MariaDB or MySQL
@@ -105,7 +105,7 @@ fi
# Instead simply move the old datadir and create a new for this_version.
if [ ! -z "$downgrade_detected" ]
then
- db_input critical mariadb-server-10.4/old_data_directory_saved || true
+ db_input critical mariadb-server-10.5/old_data_directory_saved || true
db_go
echo "The file $mysql_datadir/debian-$found_version.flag indicates a" 1>&2
echo "version that cannot automatically be upgraded. Therefore the" 1>&2
diff --git a/debian/mariadb-server-10.4.prerm b/debian/mariadb-server-10.5.prerm
index 0371bbfc844..0371bbfc844 100644
--- a/debian/mariadb-server-10.4.prerm
+++ b/debian/mariadb-server-10.5.prerm
diff --git a/debian/mariadb-server-10.4.py b/debian/mariadb-server-10.5.py
index b44228daf8b..4c6dea650f1 100644
--- a/debian/mariadb-server-10.4.py
+++ b/debian/mariadb-server-10.5.py
@@ -1,4 +1,4 @@
-'''apport package hook for mariadb-10.4
+'''apport package hook for mariadb-10.5
(c) 2009 Canonical Ltd.
Author: Mathias Gug <mathias.gug@canonical.com>
@@ -20,7 +20,7 @@ def _add_my_conf_files(report, filename):
continue
def add_info(report):
- attach_conffiles(report, 'mariadb-server-10.4', conffiles=None)
+ attach_conffiles(report, 'mariadb-server-10.5', conffiles=None)
key = 'Logs' + path_to_key('/var/log/daemon.log')
report[key] = ""
for line in read_file('/var/log/daemon.log').split('\n'):
diff --git a/debian/mariadb-server-10.4.templates b/debian/mariadb-server-10.5.templates
index a761ad76c6a..fde43a55706 100644
--- a/debian/mariadb-server-10.4.templates
+++ b/debian/mariadb-server-10.5.templates
@@ -7,7 +7,7 @@
# Even minor modifications require translation updates and such
# changes should be coordinated with translators and reviewers.
-Template: mariadb-server-10.4/old_data_directory_saved
+Template: mariadb-server-10.5/old_data_directory_saved
Type: note
_Description: The old data directory will be saved at new location
A file named /var/lib/mysql/debian-*.flag exists on this system.
@@ -19,7 +19,7 @@ _Description: The old data directory will be saved at new location
.
Please manually export/import your data (e.g. with mysqldump) if needed.
-Template: mariadb-server-10.4/nis_warning
+Template: mariadb-server-10.5/nis_warning
Type: note
#flag:translate!:3,5
_Description: Important note for NIS/YP users
@@ -33,7 +33,7 @@ _Description: Important note for NIS/YP users
.
/var/lib/mysql: drwxr-xr-x mysql mysql
-Template: mariadb-server-10.4/postrm_remove_databases
+Template: mariadb-server-10.5/postrm_remove_databases
Type: boolean
Default: false
_Description: Remove all MariaDB databases?
@@ -66,7 +66,7 @@ _Description: Unable to set password for the MariaDB "root" user
.
You should check the account's password after the package installation.
.
- Please read the /usr/share/doc/mariadb-server-10.4/README.Debian file
+ Please read the /usr/share/doc/mariadb-server-10.5/README.Debian file
for more information.
Template: mysql-server/password_mismatch
diff --git a/debian/mariadb-server-10.4.triggers b/debian/mariadb-server-10.5.triggers
index d1f5f5e14f1..d1f5f5e14f1 100644
--- a/debian/mariadb-server-10.4.triggers
+++ b/debian/mariadb-server-10.5.triggers
diff --git a/debian/mariadb-server-core-10.4.install b/debian/mariadb-server-core-10.5.install
index 9139949a24e..9139949a24e 100644
--- a/debian/mariadb-server-core-10.4.install
+++ b/debian/mariadb-server-core-10.5.install
diff --git a/debian/mariadb-server-core-10.4.links b/debian/mariadb-server-core-10.5.links
index b7873f93141..b7873f93141 100644
--- a/debian/mariadb-server-core-10.4.links
+++ b/debian/mariadb-server-core-10.5.links
diff --git a/debian/not-installed b/debian/not-installed
index 5341f6ca438..7e42735b03c 100644
--- a/debian/not-installed
+++ b/debian/not-installed
@@ -7,15 +7,15 @@ usr/lib/sysusers.d/sysusers.conf
usr/lib/tmpfiles.d/tmpfiles.conf
usr/lib/mysql/plugin/JavaWrappers.jar # These are only built if JNI/libjawt.so is installed from e.g. openjdk-8-jre-headless
usr/lib/mysql/plugin/JdbcInterface.jar # These are only built if JNI/libjawt.so is installed from e.g. openjdk-8-jre-headless
-usr/share/doc/mariadb-server-10.4/COPYING
-usr/share/doc/mariadb-server-10.4/COPYING.AGPLv3
-usr/share/doc/mariadb-server-10.4/COPYING.GPLv2
-usr/share/doc/mariadb-server-10.4/COPYING.thirdparty
-usr/share/doc/mariadb-server-10.4/CREDITS
-usr/share/doc/mariadb-server-10.4/EXCEPTIONS-CLIENT
-usr/share/doc/mariadb-server-10.4/INSTALL-BINARY
-usr/share/doc/mariadb-server-10.4/PATENTS
-usr/share/doc/mariadb-server-10.4/README-wsrep
+usr/share/doc/mariadb-server-10.5/COPYING
+usr/share/doc/mariadb-server-10.5/COPYING.AGPLv3
+usr/share/doc/mariadb-server-10.5/COPYING.GPLv2
+usr/share/doc/mariadb-server-10.5/COPYING.thirdparty
+usr/share/doc/mariadb-server-10.5/CREDITS
+usr/share/doc/mariadb-server-10.5/EXCEPTIONS-CLIENT
+usr/share/doc/mariadb-server-10.5/INSTALL-BINARY
+usr/share/doc/mariadb-server-10.5/PATENTS
+usr/share/doc/mariadb-server-10.5/README-wsrep
usr/share/groonga/COPYING
usr/share/groonga-normalizer-mysql/lgpl-2.0.txt
usr/share/groonga-normalizer-mysql/README.md
diff --git a/debian/po/POTFILES.in b/debian/po/POTFILES.in
index 9499932064b..662c4be9fbc 100644
--- a/debian/po/POTFILES.in
+++ b/debian/po/POTFILES.in
@@ -1 +1 @@
-[type: gettext/rfc822deb] mariadb-server-10.4.templates
+[type: gettext/rfc822deb] mariadb-server-10.5.templates
diff --git a/debian/po/ar.po b/debian/po/ar.po
index 3cc38aa9c1a..f8469e448f9 100644
--- a/debian/po/ar.po
+++ b/debian/po/ar.po
@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: templates\n"
-"Report-Msgid-Bugs-To: mariadb-10.4@packages.debian.org\n"
+"Report-Msgid-Bugs-To: mariadb-10.5@packages.debian.org\n"
"POT-Creation-Date: 2016-10-08 01:26+0300\n"
"PO-Revision-Date: 2007-05-01 13:04+0300\n"
"Last-Translator: Ossama M. Khayat <okhayat@yahoo.com>\n"
@@ -27,13 +27,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid "The old data directory will be saved at new location"
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"A file named /var/lib/mysql/debian-*.flag exists on this system. The number "
"indicates a database binary format version that cannot automatically be "
@@ -42,7 +42,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"Therefore the previous data directory will be renamed to /var/lib/mysql-* "
"and a new data directory will be initialized at /var/lib/mysql."
@@ -50,20 +50,20 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid "Important note for NIS/YP users"
msgstr "ملاحظة هامة لمستخدمي NIS/YP"
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid ""
"Using MariaDB under NIS/YP requires a mysql user account to be added on the "
"local system with:"
@@ -71,7 +71,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
#, fuzzy
#| msgid ""
#| "You should also check the permissions and the owner of the /var/lib/mysql "
@@ -83,13 +83,13 @@ msgstr "عليك أيضاً أن تقوم بالتأكد من صلاحيات Ù…Ø
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "إزالة جميع قواعد بيانات MariaDB؟"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid ""
"The /var/lib/mysql directory which contains the MariaDB databases is about "
"to be removed."
@@ -97,7 +97,7 @@ msgstr "الدليل /var/lib/mysql الذي يحتوي قواعد بيانات
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid ""
"If you're removing the MariaDB package in order to later install a more "
"recent version or if a different mariadb-server package is already using it, "
@@ -108,13 +108,13 @@ msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid "New password for the MariaDB \"root\" user:"
msgstr "كلمة المرور الجديدة لمستخد \"root\" الخاص بـMariaDB:"
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid ""
"While not mandatory, it is highly recommended that you set a password for "
"the MariaDB administrative \"root\" user."
@@ -124,7 +124,7 @@ msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
#, fuzzy
#| msgid "If that field is left blank, the password will not be changed."
msgid "If this field is left blank, the password will not be changed."
@@ -132,7 +132,7 @@ msgstr "إن ترك الحقل Ùارغاً، Ùلن يتم تغيير كلمة
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:6001
+#: ../mariadb-server-10.5.templates:6001
#, fuzzy
#| msgid "New password for the MariaDB \"root\" user:"
msgid "Repeat password for the MariaDB \"root\" user:"
@@ -140,13 +140,13 @@ msgstr "كلمة المرور الجديدة لمستخد \"root\" الخاص ب
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid "Unable to set password for the MariaDB \"root\" user"
msgstr "تعذر تعيين كلمة مرور للمستخدم \"root\" الخاص بـMariaDB."
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid ""
"An error occurred while setting the password for the MariaDB administrative "
"user. This may have happened because the account already has a password, or "
@@ -158,7 +158,7 @@ msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
#, fuzzy
#| msgid ""
#| "You should check the account's password after tha package installation."
@@ -167,26 +167,26 @@ msgstr "يجب عليك التحقق من كلمة مرور الحساب عقب
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
#, fuzzy
#| msgid ""
#| "Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for "
#| "more information."
msgid ""
-"Please read the /usr/share/doc/mariadb-server-10.4/README.Debian file for "
+"Please read the /usr/share/doc/mariadb-server-10.5/README.Debian file for "
"more information."
msgstr ""
-"الرجاء قراءة المل٠/usr/share/doc/mariadb-server-10.4/README.Debian للمزيد "
+"الرجاء قراءة المل٠/usr/share/doc/mariadb-server-10.5/README.Debian للمزيد "
"من المعلومات."
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:8001
+#: ../mariadb-server-10.5.templates:8001
msgid "Password input error"
msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:8001
+#: ../mariadb-server-10.5.templates:8001
msgid "The two passwords you entered were not the same. Please try again."
msgstr ""
diff --git a/debian/po/ca.po b/debian/po/ca.po
index 925c749600c..ea826909b53 100644
--- a/debian/po/ca.po
+++ b/debian/po/ca.po
@@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: mysql-dfsg-4.1\n"
-"Report-Msgid-Bugs-To: mariadb-10.4@packages.debian.org\n"
+"Report-Msgid-Bugs-To: mariadb-10.5@packages.debian.org\n"
"POT-Creation-Date: 2016-10-08 01:26+0300\n"
"PO-Revision-Date: 2004-01-31 19:20GMT\n"
"Last-Translator: Aleix Badia i Bosch <abadia@ica.es>\n"
@@ -17,13 +17,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid "The old data directory will be saved at new location"
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"A file named /var/lib/mysql/debian-*.flag exists on this system. The number "
"indicates a database binary format version that cannot automatically be "
@@ -32,7 +32,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"Therefore the previous data directory will be renamed to /var/lib/mysql-* "
"and a new data directory will be initialized at /var/lib/mysql."
@@ -40,14 +40,14 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
#, fuzzy
#| msgid "Important note for NIS/YP users!"
msgid "Important note for NIS/YP users"
@@ -55,7 +55,7 @@ msgstr "Nota important pels usuaris de NIS/YP"
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid ""
"Using MariaDB under NIS/YP requires a mysql user account to be added on the "
"local system with:"
@@ -63,7 +63,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid ""
"You should also check the permissions and ownership of the /var/lib/mysql "
"directory:"
@@ -71,13 +71,13 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid "Remove all MariaDB databases?"
msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid ""
"The /var/lib/mysql directory which contains the MariaDB databases is about "
"to be removed."
@@ -85,7 +85,7 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid ""
"If you're removing the MariaDB package in order to later install a more "
"recent version or if a different mariadb-server package is already using it, "
@@ -94,13 +94,13 @@ msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid "New password for the MariaDB \"root\" user:"
msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid ""
"While not mandatory, it is highly recommended that you set a password for "
"the MariaDB administrative \"root\" user."
@@ -108,25 +108,25 @@ msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid "If this field is left blank, the password will not be changed."
msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:6001
+#: ../mariadb-server-10.5.templates:6001
msgid "Repeat password for the MariaDB \"root\" user:"
msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid "Unable to set password for the MariaDB \"root\" user"
msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid ""
"An error occurred while setting the password for the MariaDB administrative "
"user. This may have happened because the account already has a password, or "
@@ -135,26 +135,26 @@ msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid "You should check the account's password after the package installation."
msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid ""
-"Please read the /usr/share/doc/mariadb-server-10.4/README.Debian file for "
+"Please read the /usr/share/doc/mariadb-server-10.5/README.Debian file for "
"more information."
msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:8001
+#: ../mariadb-server-10.5.templates:8001
msgid "Password input error"
msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:8001
+#: ../mariadb-server-10.5.templates:8001
msgid "The two passwords you entered were not the same. Please try again."
msgstr ""
diff --git a/debian/po/cs.po b/debian/po/cs.po
index ecb70c5f2b5..f5f669ee4bd 100644
--- a/debian/po/cs.po
+++ b/debian/po/cs.po
@@ -14,7 +14,7 @@
msgid ""
msgstr ""
"Project-Id-Version: mysql-dfsg-5.1\n"
-"Report-Msgid-Bugs-To: mariadb-10.4@packages.debian.org\n"
+"Report-Msgid-Bugs-To: mariadb-10.5@packages.debian.org\n"
"POT-Creation-Date: 2016-10-08 01:26+0300\n"
"PO-Revision-Date: 2007-05-01 13:01+0200\n"
"Last-Translator: Miroslav Kure <kurem@debian.cz>\n"
@@ -26,13 +26,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid "The old data directory will be saved at new location"
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"A file named /var/lib/mysql/debian-*.flag exists on this system. The number "
"indicates a database binary format version that cannot automatically be "
@@ -41,7 +41,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"Therefore the previous data directory will be renamed to /var/lib/mysql-* "
"and a new data directory will be initialized at /var/lib/mysql."
@@ -49,20 +49,20 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid "Important note for NIS/YP users"
msgstr "Důležitá poznámka pro uživatele NIS/YP"
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid ""
"Using MariaDB under NIS/YP requires a mysql user account to be added on the "
"local system with:"
@@ -70,7 +70,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
#, fuzzy
#| msgid ""
#| "You should also check the permissions and the owner of the /var/lib/mysql "
@@ -83,13 +83,13 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "Odstranit všechny MariaDB databáze?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid ""
"The /var/lib/mysql directory which contains the MariaDB databases is about "
"to be removed."
@@ -99,7 +99,7 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid ""
"If you're removing the MariaDB package in order to later install a more "
"recent version or if a different mariadb-server package is already using it, "
@@ -111,13 +111,13 @@ msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid "New password for the MariaDB \"root\" user:"
msgstr "Nové heslo MariaDB uživatele \"root\":"
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid ""
"While not mandatory, it is highly recommended that you set a password for "
"the MariaDB administrative \"root\" user."
@@ -127,7 +127,7 @@ msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
#, fuzzy
#| msgid "If that field is left blank, the password will not be changed."
msgid "If this field is left blank, the password will not be changed."
@@ -135,7 +135,7 @@ msgstr "Ponecháte-li pole prázdné, heslo se nezmění."
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:6001
+#: ../mariadb-server-10.5.templates:6001
#, fuzzy
#| msgid "New password for the MySQL \"root\" user:"
msgid "Repeat password for the MariaDB \"root\" user:"
@@ -143,13 +143,13 @@ msgstr "Nové heslo MariaDB uživatele \"root\":"
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid "Unable to set password for the MariaDB \"root\" user"
msgstr "Nelze nastavit heslo MariaDB uživatele \"root\""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid ""
"An error occurred while setting the password for the MariaDB administrative "
"user. This may have happened because the account already has a password, or "
@@ -161,7 +161,7 @@ msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
#, fuzzy
#| msgid ""
#| "You should check the account's password after tha package installation."
@@ -170,25 +170,25 @@ msgstr "Po instalaci balíku byste měli heslo ověřit."
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
#, fuzzy
#| msgid ""
#| "Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for "
#| "more information."
msgid ""
-"Please read the /usr/share/doc/mariadb-server-10.4/README.Debian file for "
+"Please read the /usr/share/doc/mariadb-server-10.5/README.Debian file for "
"more information."
msgstr ""
-"Více informací naleznete v /usr/share/doc/mariadb-server-10.4/README.Debian."
+"Více informací naleznete v /usr/share/doc/mariadb-server-10.5/README.Debian."
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:8001
+#: ../mariadb-server-10.5.templates:8001
msgid "Password input error"
msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:8001
+#: ../mariadb-server-10.5.templates:8001
msgid "The two passwords you entered were not the same. Please try again."
msgstr ""
diff --git a/debian/po/da.po b/debian/po/da.po
index 23c481768f7..780b893c328 100644
--- a/debian/po/da.po
+++ b/debian/po/da.po
@@ -14,7 +14,7 @@
msgid ""
msgstr ""
"Project-Id-Version: mysql-dfsg-4.1\n"
-"Report-Msgid-Bugs-To: mariadb-10.4@packages.debian.org\n"
+"Report-Msgid-Bugs-To: mariadb-10.5@packages.debian.org\n"
"POT-Creation-Date: 2016-10-08 01:26+0300\n"
"PO-Revision-Date: 2007-05-30 22:41+0200\n"
"Last-Translator: Claus Hindsgaul <claus.hindsgaul@gmail.com>\n"
@@ -27,13 +27,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid "The old data directory will be saved at new location"
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"A file named /var/lib/mysql/debian-*.flag exists on this system. The number "
"indicates a database binary format version that cannot automatically be "
@@ -42,7 +42,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"Therefore the previous data directory will be renamed to /var/lib/mysql-* "
"and a new data directory will be initialized at /var/lib/mysql."
@@ -50,20 +50,20 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid "Important note for NIS/YP users"
msgstr "Vigtig oplysning til NIS/YP-brugere"
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid ""
"Using MariaDB under NIS/YP requires a mysql user account to be added on the "
"local system with:"
@@ -71,7 +71,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
#, fuzzy
#| msgid ""
#| "You should also check the permissions and the owner of the /var/lib/mysql "
@@ -84,13 +84,13 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "Fjern alle MariaDB-databaser?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid ""
"The /var/lib/mysql directory which contains the MariaDB databases is about "
"to be removed."
@@ -100,7 +100,7 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid ""
"If you're removing the MariaDB package in order to later install a more "
"recent version or if a different mariadb-server package is already using it, "
@@ -112,13 +112,13 @@ msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid "New password for the MariaDB \"root\" user:"
msgstr "Ny adgangskode for MariaDB's \"root\"-bruger:"
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid ""
"While not mandatory, it is highly recommended that you set a password for "
"the MariaDB administrative \"root\" user."
@@ -128,7 +128,7 @@ msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
#, fuzzy
#| msgid "If that field is left blank, the password will not be changed."
msgid "If this field is left blank, the password will not be changed."
@@ -136,7 +136,7 @@ msgstr "Hvis du lader dette felt stå tomt, vil adgangskoden ikke blive ændret."
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:6001
+#: ../mariadb-server-10.5.templates:6001
#, fuzzy
#| msgid "New password for the MySQL \"root\" user:"
msgid "Repeat password for the MariaDB \"root\" user:"
@@ -144,13 +144,13 @@ msgstr "Ny adgangskode for MariaDB's \"root\"-bruger:"
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid "Unable to set password for the MariaDB \"root\" user"
msgstr "Kunne ikke sætte adgangskoden for MariaDB's \"root\"-bruger"
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid ""
"An error occurred while setting the password for the MariaDB administrative "
"user. This may have happened because the account already has a password, or "
@@ -163,32 +163,32 @@ msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid "You should check the account's password after the package installation."
msgstr "Du bør tjekke kontoens adgangskode efter pakkeinstallationen."
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
#, fuzzy
#| msgid ""
#| "Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for "
#| "more information."
msgid ""
-"Please read the /usr/share/doc/mariadb-server-10.4/README.Debian file for "
+"Please read the /usr/share/doc/mariadb-server-10.5/README.Debian file for "
"more information."
msgstr ""
-"Se filen /usr/share/doc/mariadb-server-10.4/README.Debian for yderligere "
+"Se filen /usr/share/doc/mariadb-server-10.5/README.Debian for yderligere "
"oplysninger."
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:8001
+#: ../mariadb-server-10.5.templates:8001
msgid "Password input error"
msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:8001
+#: ../mariadb-server-10.5.templates:8001
msgid "The two passwords you entered were not the same. Please try again."
msgstr ""
diff --git a/debian/po/de.po b/debian/po/de.po
index b61c4c12dec..253986ff9a5 100644
--- a/debian/po/de.po
+++ b/debian/po/de.po
@@ -15,7 +15,7 @@
msgid ""
msgstr ""
"Project-Id-Version: mysql-dfsg-5.1_5.1.37-1_de\n"
-"Report-Msgid-Bugs-To: mariadb-10.4@packages.debian.org\n"
+"Report-Msgid-Bugs-To: mariadb-10.5@packages.debian.org\n"
"POT-Creation-Date: 2016-10-08 01:26+0300\n"
"PO-Revision-Date: 2009-08-27 22:41+0200\n"
"Last-Translator: Thomas Mueller <thomas.mueller@tmit.eu>\n"
@@ -29,13 +29,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid "The old data directory will be saved at new location"
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"A file named /var/lib/mysql/debian-*.flag exists on this system. The number "
"indicates a database binary format version that cannot automatically be "
@@ -44,7 +44,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"Therefore the previous data directory will be renamed to /var/lib/mysql-* "
"and a new data directory will be initialized at /var/lib/mysql."
@@ -52,20 +52,20 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid "Important note for NIS/YP users"
msgstr "Wichtige Anmerkung für NIS/YP-Benutzer!"
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid ""
"Using MariaDB under NIS/YP requires a mysql user account to be added on the "
"local system with:"
@@ -75,7 +75,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid ""
"You should also check the permissions and ownership of the /var/lib/mysql "
"directory:"
@@ -85,13 +85,13 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "Alle MariaDB-Datenbanken entfernen?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid ""
"The /var/lib/mysql directory which contains the MariaDB databases is about "
"to be removed."
@@ -101,7 +101,7 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid ""
"If you're removing the MariaDB package in order to later install a more "
"recent version or if a different mariadb-server package is already using it, "
@@ -113,13 +113,13 @@ msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid "New password for the MariaDB \"root\" user:"
msgstr "Neues Passwort für den MariaDB »root«-Benutzer:"
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid ""
"While not mandatory, it is highly recommended that you set a password for "
"the MariaDB administrative \"root\" user."
@@ -129,25 +129,25 @@ msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid "If this field is left blank, the password will not be changed."
msgstr "Wenn dieses Feld freigelassen wird, wird das Passwort nicht geändert."
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:6001
+#: ../mariadb-server-10.5.templates:6001
msgid "Repeat password for the MariaDB \"root\" user:"
msgstr "Wiederholen Sie das Passwort für den MariaDB-»root«-Benutzer:"
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid "Unable to set password for the MariaDB \"root\" user"
msgstr "Konnte für den MariaDB-»root«-Benutzer kein Passwort setzen"
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid ""
"An error occurred while setting the password for the MariaDB administrative "
"user. This may have happened because the account already has a password, or "
@@ -160,7 +160,7 @@ msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid "You should check the account's password after the package installation."
msgstr ""
"Sie sollten das Passwort des administrativen Benutzers nach der "
@@ -168,13 +168,13 @@ msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
#, fuzzy
#| msgid ""
#| "Please read the /usr/share/doc/mariadb-server-5.1/README.Debian file for "
#| "more information."
msgid ""
-"Please read the /usr/share/doc/mariadb-server-10.4/README.Debian file for "
+"Please read the /usr/share/doc/mariadb-server-10.5/README.Debian file for "
"more information."
msgstr ""
"Für weitere Informationen lesen Sie /usr/share/doc/mariadb-server-5.1/README."
@@ -182,13 +182,13 @@ msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:8001
+#: ../mariadb-server-10.5.templates:8001
msgid "Password input error"
msgstr "Passwort-Eingabefehler"
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:8001
+#: ../mariadb-server-10.5.templates:8001
msgid "The two passwords you entered were not the same. Please try again."
msgstr ""
"Die beiden von Ihnen eingegebenen Passwörter sind nicht identisch. Bitte "
diff --git a/debian/po/es.po b/debian/po/es.po
index 3760e4f30f8..9e7e561693b 100644
--- a/debian/po/es.po
+++ b/debian/po/es.po
@@ -40,7 +40,7 @@
msgid ""
msgstr ""
"Project-Id-Version: mysql-dfsg-5.1_5.0.24-3\n"
-"Report-Msgid-Bugs-To: mariadb-10.4@packages.debian.org\n"
+"Report-Msgid-Bugs-To: mariadb-10.5@packages.debian.org\n"
"POT-Creation-Date: 2016-10-08 01:26+0300\n"
"PO-Revision-Date: 2007-05-28 22:21+0200\n"
"Last-Translator: Javier Fernández-Sanguino <jfs@debian.org>\n"
@@ -52,13 +52,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid "The old data directory will be saved at new location"
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"A file named /var/lib/mysql/debian-*.flag exists on this system. The number "
"indicates a database binary format version that cannot automatically be "
@@ -67,7 +67,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"Therefore the previous data directory will be renamed to /var/lib/mysql-* "
"and a new data directory will be initialized at /var/lib/mysql."
@@ -75,20 +75,20 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid "Important note for NIS/YP users"
msgstr "Nota importante para los usuarios de NIS/YP"
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid ""
"Using MariaDB under NIS/YP requires a mysql user account to be added on the "
"local system with:"
@@ -96,7 +96,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
#, fuzzy
#| msgid ""
#| "You should also check the permissions and the owner of the /var/lib/mysql "
@@ -110,13 +110,13 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "¿Desea eliminar todas las bases de datos MariaDB?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid ""
"The /var/lib/mysql directory which contains the MariaDB databases is about "
"to be removed."
@@ -126,7 +126,7 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid ""
"If you're removing the MariaDB package in order to later install a more "
"recent version or if a different mariadb-server package is already using it, "
@@ -138,13 +138,13 @@ msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid "New password for the MariaDB \"root\" user:"
msgstr "Nueva contraseña para el usuario «root» de MariaDB:"
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid ""
"While not mandatory, it is highly recommended that you set a password for "
"the MariaDB administrative \"root\" user."
@@ -154,7 +154,7 @@ msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
#, fuzzy
#| msgid "If that field is left blank, the password will not be changed."
msgid "If this field is left blank, the password will not be changed."
@@ -162,7 +162,7 @@ msgstr "No se modificará la contraseña si deja el espacio en blanco."
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:6001
+#: ../mariadb-server-10.5.templates:6001
#, fuzzy
#| msgid "New password for the MySQL \"root\" user:"
msgid "Repeat password for the MariaDB \"root\" user:"
@@ -170,13 +170,13 @@ msgstr "Nueva contraseña para el usuario «root» de MariaDB:"
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid "Unable to set password for the MariaDB \"root\" user"
msgstr "No se pudo fijar la contraseña para el usuario «root» de MariaDB"
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid ""
"An error occurred while setting the password for the MariaDB administrative "
"user. This may have happened because the account already has a password, or "
@@ -189,7 +189,7 @@ msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid "You should check the account's password after the package installation."
msgstr ""
"Debería comprobar la contraseña de la cuenta después de la instalación del "
@@ -197,26 +197,26 @@ msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
#, fuzzy
#| msgid ""
#| "Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for "
#| "more information."
msgid ""
-"Please read the /usr/share/doc/mariadb-server-10.4/README.Debian file for "
+"Please read the /usr/share/doc/mariadb-server-10.5/README.Debian file for "
"more information."
msgstr ""
-"Consulte /usr/share/doc/mariadb-server-10.4/README.Debian para más "
+"Consulte /usr/share/doc/mariadb-server-10.5/README.Debian para más "
"información."
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:8001
+#: ../mariadb-server-10.5.templates:8001
msgid "Password input error"
msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:8001
+#: ../mariadb-server-10.5.templates:8001
msgid "The two passwords you entered were not the same. Please try again."
msgstr ""
diff --git a/debian/po/eu.po b/debian/po/eu.po
index 0e8b74da486..49082c9059c 100644
--- a/debian/po/eu.po
+++ b/debian/po/eu.po
@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: eu\n"
-"Report-Msgid-Bugs-To: mariadb-10.4@packages.debian.org\n"
+"Report-Msgid-Bugs-To: mariadb-10.5@packages.debian.org\n"
"POT-Creation-Date: 2016-10-08 01:26+0300\n"
"PO-Revision-Date: 2009-07-29 11:59+0200\n"
"Last-Translator: Piarres Beobide <pi@beobide.net>\n"
@@ -20,13 +20,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid "The old data directory will be saved at new location"
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"A file named /var/lib/mysql/debian-*.flag exists on this system. The number "
"indicates a database binary format version that cannot automatically be "
@@ -35,7 +35,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"Therefore the previous data directory will be renamed to /var/lib/mysql-* "
"and a new data directory will be initialized at /var/lib/mysql."
@@ -43,20 +43,20 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid "Important note for NIS/YP users"
msgstr "NIS/YP erabiltzaileentzat ohar garrantzitsua"
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid ""
"Using MariaDB under NIS/YP requires a mysql user account to be added on the "
"local system with:"
@@ -64,7 +64,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
#, fuzzy
#| msgid ""
#| "You should also check the permissions and the owner of the /var/lib/mysql "
@@ -78,13 +78,13 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "Ezabatu MariaDB datubase guztiak?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid ""
"The /var/lib/mysql directory which contains the MariaDB databases is about "
"to be removed."
@@ -93,7 +93,7 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid ""
"If you're removing the MariaDB package in order to later install a more "
"recent version or if a different mariadb-server package is already using it, "
@@ -105,13 +105,13 @@ msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid "New password for the MariaDB \"root\" user:"
msgstr "MariaDB \"root\" erabiltzailearen pasahitz berria:"
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid ""
"While not mandatory, it is highly recommended that you set a password for "
"the MariaDB administrative \"root\" user."
@@ -121,7 +121,7 @@ msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
#, fuzzy
#| msgid "If that field is left blank, the password will not be changed."
msgid "If this field is left blank, the password will not be changed."
@@ -129,19 +129,19 @@ msgstr "Eremua hau zurian utziaz gero ez da pasahitza aldatuko."
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:6001
+#: ../mariadb-server-10.5.templates:6001
msgid "Repeat password for the MariaDB \"root\" user:"
msgstr "Errepikatu MariaDB \"root\" erabiltzailearen pasahitza:"
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid "Unable to set password for the MariaDB \"root\" user"
msgstr "Ezin da MariaDB \"root\" erabiltzailearen pasahitza ezarri"
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid ""
"An error occurred while setting the password for the MariaDB administrative "
"user. This may have happened because the account already has a password, or "
@@ -153,33 +153,33 @@ msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid "You should check the account's password after the package installation."
msgstr ""
"Kontuaren pasahitza egiaztatu beharko zenuke paketea instalatu aurretik."
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
#, fuzzy
#| msgid ""
-#| "Please read the /usr/share/doc/mariadb-server-10.4/README.Debian file for "
+#| "Please read the /usr/share/doc/mariadb-server-10.5/README.Debian file for "
#| "more information."
msgid ""
-"Please read the /usr/share/doc/mariadb-server-10.4/README.Debian file for "
+"Please read the /usr/share/doc/mariadb-server-10.5/README.Debian file for "
"more information."
msgstr ""
-"Mesedez irakurri /usr/share/doc/mariadb-server-10.4/README.Debian fitxategia "
+"Mesedez irakurri /usr/share/doc/mariadb-server-10.5/README.Debian fitxategia "
"xehetasun gehiagorako."
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:8001
+#: ../mariadb-server-10.5.templates:8001
msgid "Password input error"
msgstr "Pasahitz sarrera errorea"
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:8001
+#: ../mariadb-server-10.5.templates:8001
msgid "The two passwords you entered were not the same. Please try again."
msgstr "Idatzi dituzun bi pasahitzak ez dira berdina. Mesedez saiatu berriz."
diff --git a/debian/po/fr.po b/debian/po/fr.po
index ef91a14b334..ef2e74058bd 100644
--- a/debian/po/fr.po
+++ b/debian/po/fr.po
@@ -7,7 +7,7 @@
msgid ""
msgstr ""
"Project-Id-Version: fr\n"
-"Report-Msgid-Bugs-To: mariadb-10.4@packages.debian.org\n"
+"Report-Msgid-Bugs-To: mariadb-10.5@packages.debian.org\n"
"POT-Creation-Date: 2016-10-08 01:26+0300\n"
"PO-Revision-Date: 2009-08-08 14:56+0200\n"
"Last-Translator: Christian Perrier <bubulle@debian.org>\n"
@@ -22,13 +22,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid "The old data directory will be saved at new location"
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"A file named /var/lib/mysql/debian-*.flag exists on this system. The number "
"indicates a database binary format version that cannot automatically be "
@@ -37,7 +37,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"Therefore the previous data directory will be renamed to /var/lib/mysql-* "
"and a new data directory will be initialized at /var/lib/mysql."
@@ -45,20 +45,20 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid "Important note for NIS/YP users"
msgstr "Note importante pour les utilisateurs NIS/YP"
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid ""
"Using MariaDB under NIS/YP requires a mysql user account to be added on the "
"local system with:"
@@ -68,7 +68,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid ""
"You should also check the permissions and ownership of the /var/lib/mysql "
"directory:"
@@ -78,13 +78,13 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "Faut-il supprimer toutes les bases de données MariaDB ?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid ""
"The /var/lib/mysql directory which contains the MariaDB databases is about "
"to be removed."
@@ -94,7 +94,7 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid ""
"If you're removing the MariaDB package in order to later install a more "
"recent version or if a different mariadb-server package is already using it, "
@@ -105,13 +105,13 @@ msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid "New password for the MariaDB \"root\" user:"
msgstr "Nouveau mot de passe du superutilisateur de MariaDB :"
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid ""
"While not mandatory, it is highly recommended that you set a password for "
"the MariaDB administrative \"root\" user."
@@ -121,26 +121,26 @@ msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid "If this field is left blank, the password will not be changed."
msgstr "Si ce champ est laissé vide, le mot de passe ne sera pas changé."
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:6001
+#: ../mariadb-server-10.5.templates:6001
msgid "Repeat password for the MariaDB \"root\" user:"
msgstr "Confirmation du mot de passe du superutilisateur de MariaDB :"
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid "Unable to set password for the MariaDB \"root\" user"
msgstr ""
"Impossible de changer le mot de passe de l'utilisateur « root » de MariaDB"
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid ""
"An error occurred while setting the password for the MariaDB administrative "
"user. This may have happened because the account already has a password, or "
@@ -152,7 +152,7 @@ msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid "You should check the account's password after the package installation."
msgstr ""
"Vous devriez vérifier le mot de passe de ce compte après l'installation du "
@@ -160,27 +160,27 @@ msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
#, fuzzy
#| msgid ""
-#| "Please read the /usr/share/doc/mariadb-server-10.4/README.Debian file for "
+#| "Please read the /usr/share/doc/mariadb-server-10.5/README.Debian file for "
#| "more information."
msgid ""
-"Please read the /usr/share/doc/mariadb-server-10.4/README.Debian file for "
+"Please read the /usr/share/doc/mariadb-server-10.5/README.Debian file for "
"more information."
msgstr ""
-"Veuillez consulter le fichier /usr/share/doc/mysql-server-10.4/README.Debian "
+"Veuillez consulter le fichier /usr/share/doc/mysql-server-10.5/README.Debian "
"pour plus d'informations."
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:8001
+#: ../mariadb-server-10.5.templates:8001
msgid "Password input error"
msgstr "Erreur de saisie du mot de passe"
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:8001
+#: ../mariadb-server-10.5.templates:8001
msgid "The two passwords you entered were not the same. Please try again."
msgstr ""
"Le mot de passe et sa confirmation ne sont pas identiques. Veuillez "
diff --git a/debian/po/gl.po b/debian/po/gl.po
index 8ea79f2add5..8c309995001 100644
--- a/debian/po/gl.po
+++ b/debian/po/gl.po
@@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: mysql-dfsg-5.1\n"
-"Report-Msgid-Bugs-To: mariadb-10.4@packages.debian.org\n"
+"Report-Msgid-Bugs-To: mariadb-10.5@packages.debian.org\n"
"POT-Creation-Date: 2016-10-08 01:26+0300\n"
"PO-Revision-Date: 2007-04-20 09:44+0200\n"
"Last-Translator: Jacobo Tarrio <jtarrio@debian.org>\n"
@@ -17,13 +17,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid "The old data directory will be saved at new location"
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"A file named /var/lib/mysql/debian-*.flag exists on this system. The number "
"indicates a database binary format version that cannot automatically be "
@@ -32,7 +32,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"Therefore the previous data directory will be renamed to /var/lib/mysql-* "
"and a new data directory will be initialized at /var/lib/mysql."
@@ -40,20 +40,20 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid "Important note for NIS/YP users"
msgstr "Nota importante para os usuarios de NIS/YP"
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid ""
"Using MariaDB under NIS/YP requires a mysql user account to be added on the "
"local system with:"
@@ -61,7 +61,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
#, fuzzy
#| msgid ""
#| "You should also check the permissions and the owner of the /var/lib/mysql "
@@ -75,13 +75,13 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "¿Eliminar tódalas bases de datos de MariaDB?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid ""
"The /var/lib/mysql directory which contains the MariaDB databases is about "
"to be removed."
@@ -91,7 +91,7 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid ""
"If you're removing the MariaDB package in order to later install a more "
"recent version or if a different mariadb-server package is already using it, "
@@ -103,13 +103,13 @@ msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid "New password for the MariaDB \"root\" user:"
msgstr "Novo contrasinal para o usuario \"root\" de MariaDB:"
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid ""
"While not mandatory, it is highly recommended that you set a password for "
"the MariaDB administrative \"root\" user."
@@ -119,7 +119,7 @@ msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
#, fuzzy
#| msgid "If that field is left blank, the password will not be changed."
msgid "If this field is left blank, the password will not be changed."
@@ -127,7 +127,7 @@ msgstr "Se deixa o campo en branco, non se ha cambiar o contrasinal."
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:6001
+#: ../mariadb-server-10.5.templates:6001
#, fuzzy
#| msgid "New password for the MySQL \"root\" user:"
msgid "Repeat password for the MariaDB \"root\" user:"
@@ -135,13 +135,13 @@ msgstr "Novo contrasinal para o usuario \"root\" de MariaDB:"
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid "Unable to set password for the MariaDB \"root\" user"
msgstr "Non se puido establecer o contrasinal do usuario \"root\" de MariaDB"
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid ""
"An error occurred while setting the password for the MariaDB administrative "
"user. This may have happened because the account already has a password, or "
@@ -153,7 +153,7 @@ msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
#, fuzzy
#| msgid ""
#| "You should check the account's password after tha package installation."
@@ -162,26 +162,26 @@ msgstr "Debería comprobar o contrasinal da conta trala instalación do paquete.
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
#, fuzzy
#| msgid ""
#| "Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for "
#| "more information."
msgid ""
-"Please read the /usr/share/doc/mariadb-server-10.4/README.Debian file for "
+"Please read the /usr/share/doc/mariadb-server-10.5/README.Debian file for "
"more information."
msgstr ""
-"Consulte o ficheiro /usr/share/doc/mariadb-server-10.4/README.Debian para "
+"Consulte o ficheiro /usr/share/doc/mariadb-server-10.5/README.Debian para "
"máis información."
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:8001
+#: ../mariadb-server-10.5.templates:8001
msgid "Password input error"
msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:8001
+#: ../mariadb-server-10.5.templates:8001
msgid "The two passwords you entered were not the same. Please try again."
msgstr ""
diff --git a/debian/po/it.po b/debian/po/it.po
index d9b3fec0d49..255db97e902 100644
--- a/debian/po/it.po
+++ b/debian/po/it.po
@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: mysql-dfsg-5.1 5.1.37 italian debconf templates\n"
-"Report-Msgid-Bugs-To: mariadb-10.4@packages.debian.org\n"
+"Report-Msgid-Bugs-To: mariadb-10.5@packages.debian.org\n"
"POT-Creation-Date: 2016-10-08 01:26+0300\n"
"PO-Revision-Date: 2009-08-08 11:03+0200\n"
"Last-Translator: Luca Monducci <luca.mo@tiscali.it>\n"
@@ -18,13 +18,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid "The old data directory will be saved at new location"
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"A file named /var/lib/mysql/debian-*.flag exists on this system. The number "
"indicates a database binary format version that cannot automatically be "
@@ -33,7 +33,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"Therefore the previous data directory will be renamed to /var/lib/mysql-* "
"and a new data directory will be initialized at /var/lib/mysql."
@@ -41,20 +41,20 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid "Important note for NIS/YP users"
msgstr "Nota importante per gli utenti NIS/YP"
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid ""
"Using MariaDB under NIS/YP requires a mysql user account to be added on the "
"local system with:"
@@ -64,7 +64,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid ""
"You should also check the permissions and ownership of the /var/lib/mysql "
"directory:"
@@ -74,13 +74,13 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "Eliminare tutti i database MariaDB?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid ""
"The /var/lib/mysql directory which contains the MariaDB databases is about "
"to be removed."
@@ -90,7 +90,7 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid ""
"If you're removing the MariaDB package in order to later install a more "
"recent version or if a different mariadb-server package is already using it, "
@@ -102,13 +102,13 @@ msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid "New password for the MariaDB \"root\" user:"
msgstr "Nuova password per l'utente «root» di MariaDB:"
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid ""
"While not mandatory, it is highly recommended that you set a password for "
"the MariaDB administrative \"root\" user."
@@ -118,25 +118,25 @@ msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid "If this field is left blank, the password will not be changed."
msgstr "Se questo campo è lasciato vuoto, la password non viene cambiata."
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:6001
+#: ../mariadb-server-10.5.templates:6001
msgid "Repeat password for the MariaDB \"root\" user:"
msgstr "Ripetere la password per l'utente «root» di MariaDB:"
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid "Unable to set password for the MariaDB \"root\" user"
msgstr "Impossibile impostare la password per l'utente «root» di MariaDB"
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid ""
"An error occurred while setting the password for the MariaDB administrative "
"user. This may have happened because the account already has a password, or "
@@ -149,33 +149,33 @@ msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid "You should check the account's password after the package installation."
msgstr ""
"Al termine dell'installazione si deve verificare la password dell'account."
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
#, fuzzy
#| msgid ""
-#| "Please read the /usr/share/doc/mariadb-server-10.4/README.Debian file for "
+#| "Please read the /usr/share/doc/mariadb-server-10.5/README.Debian file for "
#| "more information."
msgid ""
-"Please read the /usr/share/doc/mariadb-server-10.4/README.Debian file for "
+"Please read the /usr/share/doc/mariadb-server-10.5/README.Debian file for "
"more information."
msgstr ""
"Per maggiori informazioni si consulti il file /usr/share/doc/mariadb-"
-"server-10.4/README.Debian."
+"server-10.5/README.Debian."
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:8001
+#: ../mariadb-server-10.5.templates:8001
msgid "Password input error"
msgstr "Errore di inserimento della password"
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:8001
+#: ../mariadb-server-10.5.templates:8001
msgid "The two passwords you entered were not the same. Please try again."
msgstr "Le due password inserite sono diverse. Riprovare."
diff --git a/debian/po/ja.po b/debian/po/ja.po
index 85ead48cccd..2f3c1359601 100644
--- a/debian/po/ja.po
+++ b/debian/po/ja.po
@@ -15,7 +15,7 @@
msgid ""
msgstr ""
"Project-Id-Version: mysql-dfsg-5.1 5.1.37-1\n"
-"Report-Msgid-Bugs-To: mariadb-10.4@packages.debian.org\n"
+"Report-Msgid-Bugs-To: mariadb-10.5@packages.debian.org\n"
"POT-Creation-Date: 2016-10-08 01:26+0300\n"
"PO-Revision-Date: 2009-09-01 08:25+0900\n"
"Last-Translator: Hideki Yamane (Debian-JP) <henrich@debian.or.jp>\n"
@@ -27,13 +27,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid "The old data directory will be saved at new location"
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"A file named /var/lib/mysql/debian-*.flag exists on this system. The number "
"indicates a database binary format version that cannot automatically be "
@@ -42,7 +42,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"Therefore the previous data directory will be renamed to /var/lib/mysql-* "
"and a new data directory will be initialized at /var/lib/mysql."
@@ -50,20 +50,20 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid "Important note for NIS/YP users"
msgstr "NIS/YP ユーザã¸ã®é‡è¦ãªæ³¨æ„"
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid ""
"Using MariaDB under NIS/YP requires a mysql user account to be added on the "
"local system with:"
@@ -73,7 +73,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid ""
"You should also check the permissions and ownership of the /var/lib/mysql "
"directory:"
@@ -81,13 +81,13 @@ msgstr "/var/lib/mysql ã®æ‰€æœ‰è€…権é™ã‚’ãƒã‚§ãƒƒã‚¯ã™ã‚‹å¿…è¦ã‚‚ã‚ã‚Šã¾
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "ã™ã¹ã¦ã® MariaDB データベースを削除ã—ã¾ã™ã‹?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid ""
"The /var/lib/mysql directory which contains the MariaDB databases is about "
"to be removed."
@@ -97,7 +97,7 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid ""
"If you're removing the MariaDB package in order to later install a more "
"recent version or if a different mariadb-server package is already using it, "
@@ -109,13 +109,13 @@ msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid "New password for the MariaDB \"root\" user:"
msgstr "MariaDB ã® \"root\" ユーザã«å¯¾ã™ã‚‹æ–°ã—ã„パスワード:"
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid ""
"While not mandatory, it is highly recommended that you set a password for "
"the MariaDB administrative \"root\" user."
@@ -125,25 +125,25 @@ msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid "If this field is left blank, the password will not be changed."
msgstr "ã“ã®å€¤ã‚’空ã®ã¾ã¾ã«ã—ã¦ãŠã„ãŸå ´åˆã¯ã€ãƒ‘スワードã¯å¤‰æ›´ã•ã‚Œã¾ã›ã‚“。"
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:6001
+#: ../mariadb-server-10.5.templates:6001
msgid "Repeat password for the MariaDB \"root\" user:"
msgstr "MariaDB ã® \"root\" ユーザã«å¯¾ã™ã‚‹æ–°ã—ã„パスワード:"
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid "Unable to set password for the MariaDB \"root\" user"
msgstr "MariaDB ã® \"root\" ユーザã®ãƒ‘スワードを設定ã§ãã¾ã›ã‚“"
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid ""
"An error occurred while setting the password for the MariaDB administrative "
"user. This may have happened because the account already has a password, or "
@@ -155,32 +155,32 @@ msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid "You should check the account's password after the package installation."
msgstr ""
"パッケージã®ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«å¾Œã€ã‚¢ã‚«ã‚¦ãƒ³ãƒˆã®ãƒ‘スワードを確èªã™ã‚‹å¿…è¦ãŒã‚ã‚Šã¾ã™ã€‚"
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
#, fuzzy
#| msgid ""
-#| "Please read the /usr/share/doc/mariadb-server-10.4/README.Debian file for "
+#| "Please read the /usr/share/doc/mariadb-server-10.5/README.Debian file for "
#| "more information."
msgid ""
-"Please read the /usr/share/doc/mariadb-server-10.4/README.Debian file for "
+"Please read the /usr/share/doc/mariadb-server-10.5/README.Debian file for "
"more information."
msgstr ""
-"詳細㯠/usr/share/doc/mariadb-server-10.4/README.Debian ã‚’å‚ç…§ã—ã¦ãã ã•ã„。"
+"詳細㯠/usr/share/doc/mariadb-server-10.5/README.Debian ã‚’å‚ç…§ã—ã¦ãã ã•ã„。"
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:8001
+#: ../mariadb-server-10.5.templates:8001
msgid "Password input error"
msgstr "パスワード入力エラー"
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:8001
+#: ../mariadb-server-10.5.templates:8001
msgid "The two passwords you entered were not the same. Please try again."
msgstr "入力ã•ã‚ŒãŸäºŒã¤ã®ãƒ‘スワードãŒä¸€è‡´ã—ã¾ã›ã‚“。å†å…¥åŠ›ã—ã¦ãã ã•ã„。"
diff --git a/debian/po/nb.po b/debian/po/nb.po
index 651f2f8ad5d..742b58dd944 100644
--- a/debian/po/nb.po
+++ b/debian/po/nb.po
@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: mysql_nb\n"
-"Report-Msgid-Bugs-To: mariadb-10.4@packages.debian.org\n"
+"Report-Msgid-Bugs-To: mariadb-10.5@packages.debian.org\n"
"POT-Creation-Date: 2016-10-08 01:26+0300\n"
"PO-Revision-Date: 2007-02-18 12:13+0100\n"
"Last-Translator: Bjørn Steensrud <bjornst@powertech.no>\n"
@@ -19,13 +19,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid "The old data directory will be saved at new location"
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"A file named /var/lib/mysql/debian-*.flag exists on this system. The number "
"indicates a database binary format version that cannot automatically be "
@@ -34,7 +34,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"Therefore the previous data directory will be renamed to /var/lib/mysql-* "
"and a new data directory will be initialized at /var/lib/mysql."
@@ -42,14 +42,14 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
#, fuzzy
#| msgid "Important note for NIS/YP users!"
msgid "Important note for NIS/YP users"
@@ -57,7 +57,7 @@ msgstr "Viktig merknad for NIS/YP-brukere!"
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid ""
"Using MariaDB under NIS/YP requires a mysql user account to be added on the "
"local system with:"
@@ -65,7 +65,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid ""
"You should also check the permissions and ownership of the /var/lib/mysql "
"directory:"
@@ -73,13 +73,13 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid "Remove all MariaDB databases?"
msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid ""
"The /var/lib/mysql directory which contains the MariaDB databases is about "
"to be removed."
@@ -87,7 +87,7 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
#, fuzzy
#| msgid ""
#| "The script is about to remove the data directory /var/lib/mysql. If it is "
@@ -104,7 +104,7 @@ msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
#, fuzzy
#| msgid "New password for MySQL \"root\" user:"
msgid "New password for the MariaDB \"root\" user:"
@@ -112,7 +112,7 @@ msgstr "Nytt passord for MariaDBs «root»-bruker:"
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
#, fuzzy
#| msgid ""
#| "It is highly recommended that you set a password for the MySQL "
@@ -126,13 +126,13 @@ msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid "If this field is left blank, the password will not be changed."
msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:6001
+#: ../mariadb-server-10.5.templates:6001
#, fuzzy
#| msgid "New password for MySQL \"root\" user:"
msgid "Repeat password for the MariaDB \"root\" user:"
@@ -140,7 +140,7 @@ msgstr "Nytt passord for MariaDBs «root»-bruker:"
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
#, fuzzy
#| msgid "Unable to set password for MySQL \"root\" user"
msgid "Unable to set password for the MariaDB \"root\" user"
@@ -148,7 +148,7 @@ msgstr "Klarer ikke angi passord for MariaDBs «root»-bruker"
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
#, fuzzy
#| msgid ""
#| "It seems an error occurred while setting the password for the MySQL "
@@ -167,26 +167,26 @@ msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid "You should check the account's password after the package installation."
msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid ""
-"Please read the /usr/share/doc/mariadb-server-10.4/README.Debian file for "
+"Please read the /usr/share/doc/mariadb-server-10.5/README.Debian file for "
"more information."
msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:8001
+#: ../mariadb-server-10.5.templates:8001
msgid "Password input error"
msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:8001
+#: ../mariadb-server-10.5.templates:8001
msgid "The two passwords you entered were not the same. Please try again."
msgstr ""
diff --git a/debian/po/nl.po b/debian/po/nl.po
index 7da4a752b4d..6473df81055 100644
--- a/debian/po/nl.po
+++ b/debian/po/nl.po
@@ -6,9 +6,9 @@
msgid ""
msgstr ""
"Project-Id-Version: mysql-dfsg-5.1 5.0.30-1\n"
-"Report-Msgid-Bugs-To: mariadb-10.4@packages.debian.org\n"
+"Report-Msgid-Bugs-To: mariadb-10.5@packages.debian.org\n"
"POT-Creation-Date: 2016-10-08 01:26+0300\n"
-"PO-Revision-Date: 2006-02-19 10.40+0100\n"
+"PO-Revision-Date: 2006-02-19 10.50+0100\n"
"Last-Translator: Thijs Kinkhorst <thijs@debian.org>\n"
"Language-Team: Debian-Dutch <debian-l10n-dutch@lists.debian.org>\n"
"Language: \n"
@@ -18,13 +18,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid "The old data directory will be saved at new location"
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"A file named /var/lib/mysql/debian-*.flag exists on this system. The number "
"indicates a database binary format version that cannot automatically be "
@@ -33,7 +33,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"Therefore the previous data directory will be renamed to /var/lib/mysql-* "
"and a new data directory will be initialized at /var/lib/mysql."
@@ -41,14 +41,14 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
#, fuzzy
#| msgid "Important note for NIS/YP users!"
msgid "Important note for NIS/YP users"
@@ -56,7 +56,7 @@ msgstr "Belangrijke opmerking voor gebruikers van NIS/YP!"
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid ""
"Using MariaDB under NIS/YP requires a mysql user account to be added on the "
"local system with:"
@@ -64,7 +64,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid ""
"You should also check the permissions and ownership of the /var/lib/mysql "
"directory:"
@@ -72,13 +72,13 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid "Remove all MariaDB databases?"
msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid ""
"The /var/lib/mysql directory which contains the MariaDB databases is about "
"to be removed."
@@ -86,7 +86,7 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
#, fuzzy
#| msgid ""
#| "The script is about to remove the data directory /var/lib/mysql. If it is "
@@ -104,7 +104,7 @@ msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
#, fuzzy
#| msgid "New password for MySQL \"root\" user:"
msgid "New password for the MariaDB \"root\" user:"
@@ -112,7 +112,7 @@ msgstr "Nieuw wachtwoord voor de MariaDB \"root\"-gebruiker:"
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
#, fuzzy
#| msgid ""
#| "It is highly recommended that you set a password for the MySQL "
@@ -126,13 +126,13 @@ msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid "If this field is left blank, the password will not be changed."
msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:6001
+#: ../mariadb-server-10.5.templates:6001
#, fuzzy
#| msgid "New password for MySQL \"root\" user:"
msgid "Repeat password for the MariaDB \"root\" user:"
@@ -140,7 +140,7 @@ msgstr "Nieuw wachtwoord voor de MariaDB \"root\"-gebruiker:"
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
#, fuzzy
#| msgid "Unable to set password for MySQL \"root\" user"
msgid "Unable to set password for the MariaDB \"root\" user"
@@ -148,7 +148,7 @@ msgstr "Kan het wachtwoord voor de MariaDB \"root\"-gebruiker niet instellen"
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
#, fuzzy
#| msgid ""
#| "It seems an error occurred while setting the password for the MySQL "
@@ -167,26 +167,26 @@ msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid "You should check the account's password after the package installation."
msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid ""
-"Please read the /usr/share/doc/mariadb-server-10.4/README.Debian file for "
+"Please read the /usr/share/doc/mariadb-server-10.5/README.Debian file for "
"more information."
msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:8001
+#: ../mariadb-server-10.5.templates:8001
msgid "Password input error"
msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:8001
+#: ../mariadb-server-10.5.templates:8001
msgid "The two passwords you entered were not the same. Please try again."
msgstr ""
diff --git a/debian/po/pt.po b/debian/po/pt.po
index b0150c1890f..b8f34f107c8 100644
--- a/debian/po/pt.po
+++ b/debian/po/pt.po
@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: mysql-dfsg-5.1\n"
-"Report-Msgid-Bugs-To: mariadb-10.4@packages.debian.org\n"
+"Report-Msgid-Bugs-To: mariadb-10.5@packages.debian.org\n"
"POT-Creation-Date: 2016-10-08 01:26+0300\n"
"PO-Revision-Date: 2007-05-05 21:01+0100\n"
"Last-Translator: Miguel Figueiredo <elmig@debianpt.org>\n"
@@ -18,13 +18,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid "The old data directory will be saved at new location"
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"A file named /var/lib/mysql/debian-*.flag exists on this system. The number "
"indicates a database binary format version that cannot automatically be "
@@ -33,7 +33,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"Therefore the previous data directory will be renamed to /var/lib/mysql-* "
"and a new data directory will be initialized at /var/lib/mysql."
@@ -41,20 +41,20 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid "Important note for NIS/YP users"
msgstr "Nota importante para utilizadores de NIS/YP"
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid ""
"Using MariaDB under NIS/YP requires a mysql user account to be added on the "
"local system with:"
@@ -62,7 +62,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
#, fuzzy
#| msgid ""
#| "You should also check the permissions and the owner of the /var/lib/mysql "
@@ -75,13 +75,13 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "Remover todas as bases de dados MariaDB?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid ""
"The /var/lib/mysql directory which contains the MariaDB databases is about "
"to be removed."
@@ -91,7 +91,7 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid ""
"If you're removing the MariaDB package in order to later install a more "
"recent version or if a different mariadb-server package is already using it, "
@@ -103,13 +103,13 @@ msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid "New password for the MariaDB \"root\" user:"
msgstr "Nova palavra-passe para o utilizador \"root\" do MariaDB:"
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid ""
"While not mandatory, it is highly recommended that you set a password for "
"the MariaDB administrative \"root\" user."
@@ -119,7 +119,7 @@ msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
#, fuzzy
#| msgid "If that field is left blank, the password will not be changed."
msgid "If this field is left blank, the password will not be changed."
@@ -128,7 +128,7 @@ msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:6001
+#: ../mariadb-server-10.5.templates:6001
#, fuzzy
#| msgid "New password for the MySQL \"root\" user:"
msgid "Repeat password for the MariaDB \"root\" user:"
@@ -136,7 +136,7 @@ msgstr "Nova palavra-passe para o utilizador \"root\" do MariaDB:"
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid "Unable to set password for the MariaDB \"root\" user"
msgstr ""
"Não foi possível definir a palavra-passe para o utilizador \"root\" do "
@@ -144,7 +144,7 @@ msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid ""
"An error occurred while setting the password for the MariaDB administrative "
"user. This may have happened because the account already has a password, or "
@@ -157,7 +157,7 @@ msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
#, fuzzy
#| msgid ""
#| "You should check the account's password after tha package installation."
@@ -167,26 +167,26 @@ msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
#, fuzzy
#| msgid ""
#| "Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for "
#| "more information."
msgid ""
-"Please read the /usr/share/doc/mariadb-server-10.4/README.Debian file for "
+"Please read the /usr/share/doc/mariadb-server-10.5/README.Debian file for "
"more information."
msgstr ""
"Para mais informação por favor leia o ficheiro /usr/share/doc/mariadb-"
-"server-10.4/README.Debian."
+"server-10.5/README.Debian."
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:8001
+#: ../mariadb-server-10.5.templates:8001
msgid "Password input error"
msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:8001
+#: ../mariadb-server-10.5.templates:8001
msgid "The two passwords you entered were not the same. Please try again."
msgstr ""
diff --git a/debian/po/pt_BR.po b/debian/po/pt_BR.po
index 001d4b4bd14..7df742ca842 100644
--- a/debian/po/pt_BR.po
+++ b/debian/po/pt_BR.po
@@ -8,7 +8,7 @@
msgid ""
msgstr ""
"Project-Id-Version: mysql-dfsg-5.1\n"
-"Report-Msgid-Bugs-To: mariadb-10.4@packages.debian.org\n"
+"Report-Msgid-Bugs-To: mariadb-10.5@packages.debian.org\n"
"POT-Creation-Date: 2016-10-08 01:26+0300\n"
"PO-Revision-Date: 2007-04-21 15:59-0300\n"
"Last-Translator: André Luís Lopes <andrelop@debian.org>\n"
@@ -21,13 +21,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid "The old data directory will be saved at new location"
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"A file named /var/lib/mysql/debian-*.flag exists on this system. The number "
"indicates a database binary format version that cannot automatically be "
@@ -36,7 +36,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"Therefore the previous data directory will be renamed to /var/lib/mysql-* "
"and a new data directory will be initialized at /var/lib/mysql."
@@ -44,20 +44,20 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid "Important note for NIS/YP users"
msgstr "Aviso importante para usuários NIS/YP"
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid ""
"Using MariaDB under NIS/YP requires a mysql user account to be added on the "
"local system with:"
@@ -65,7 +65,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
#, fuzzy
#| msgid ""
#| "You should also check the permissions and the owner of the /var/lib/mysql "
@@ -78,13 +78,13 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "Remover todas as bases de dados do MariaDB?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid ""
"The /var/lib/mysql directory which contains the MariaDB databases is about "
"to be removed."
@@ -94,7 +94,7 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid ""
"If you're removing the MariaDB package in order to later install a more "
"recent version or if a different mariadb-server package is already using it, "
@@ -106,13 +106,13 @@ msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid "New password for the MariaDB \"root\" user:"
msgstr "Nova senha para o usuário \"root\" do MariaDB:"
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid ""
"While not mandatory, it is highly recommended that you set a password for "
"the MariaDB administrative \"root\" user."
@@ -122,7 +122,7 @@ msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
#, fuzzy
#| msgid "If that field is left blank, the password will not be changed."
msgid "If this field is left blank, the password will not be changed."
@@ -130,7 +130,7 @@ msgstr "Caso este campo seja deixado em branco, a senha não sera mudada."
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:6001
+#: ../mariadb-server-10.5.templates:6001
#, fuzzy
#| msgid "New password for the MySQL \"root\" user:"
msgid "Repeat password for the MariaDB \"root\" user:"
@@ -138,13 +138,13 @@ msgstr "Nova senha para o usuário \"root\" do MariaDB:"
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid "Unable to set password for the MariaDB \"root\" user"
msgstr "Impossível definir senha para o usuário \"root\" do MariaDB"
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid ""
"An error occurred while setting the password for the MariaDB administrative "
"user. This may have happened because the account already has a password, or "
@@ -157,7 +157,7 @@ msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
#, fuzzy
#| msgid ""
#| "You should check the account's password after tha package installation."
@@ -166,26 +166,26 @@ msgstr "Você deverá checar a senha dessa conta após a instalação deste paco
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
#, fuzzy
#| msgid ""
#| "Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for "
#| "more information."
msgid ""
-"Please read the /usr/share/doc/mariadb-server-10.4/README.Debian file for "
+"Please read the /usr/share/doc/mariadb-server-10.5/README.Debian file for "
"more information."
msgstr ""
-"Por favor, leia o arquivo /usr/share/doc/mariadb-server-10.4/README.Debian "
+"Por favor, leia o arquivo /usr/share/doc/mariadb-server-10.5/README.Debian "
"para maiores informações."
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:8001
+#: ../mariadb-server-10.5.templates:8001
msgid "Password input error"
msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:8001
+#: ../mariadb-server-10.5.templates:8001
msgid "The two passwords you entered were not the same. Please try again."
msgstr ""
diff --git a/debian/po/ro.po b/debian/po/ro.po
index b77bc30c1ed..e54ed9ba6ba 100644
--- a/debian/po/ro.po
+++ b/debian/po/ro.po
@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: po-debconf://mysql-dfsg\n"
-"Report-Msgid-Bugs-To: mariadb-10.4@packages.debian.org\n"
+"Report-Msgid-Bugs-To: mariadb-10.5@packages.debian.org\n"
"POT-Creation-Date: 2016-10-08 01:26+0300\n"
"PO-Revision-Date: 2006-12-20 21:27+0200\n"
"Last-Translator: stan ioan-eugen <stan.ieugen@gmail.com>\n"
@@ -19,13 +19,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid "The old data directory will be saved at new location"
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"A file named /var/lib/mysql/debian-*.flag exists on this system. The number "
"indicates a database binary format version that cannot automatically be "
@@ -34,7 +34,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"Therefore the previous data directory will be renamed to /var/lib/mysql-* "
"and a new data directory will be initialized at /var/lib/mysql."
@@ -42,14 +42,14 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
#, fuzzy
#| msgid "Important note for NIS/YP users!"
msgid "Important note for NIS/YP users"
@@ -57,7 +57,7 @@ msgstr "Notă importantă pentru utilizatorii NIS/YP!"
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid ""
"Using MariaDB under NIS/YP requires a mysql user account to be added on the "
"local system with:"
@@ -65,7 +65,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid ""
"You should also check the permissions and ownership of the /var/lib/mysql "
"directory:"
@@ -73,13 +73,13 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid "Remove all MariaDB databases?"
msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid ""
"The /var/lib/mysql directory which contains the MariaDB databases is about "
"to be removed."
@@ -87,7 +87,7 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
#, fuzzy
#| msgid ""
#| "The script is about to remove the data directory /var/lib/mysql. If it is "
@@ -104,7 +104,7 @@ msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
#, fuzzy
#| msgid "New password for MySQL \"root\" user:"
msgid "New password for the MariaDB \"root\" user:"
@@ -112,7 +112,7 @@ msgstr "Noua parolă pentru utilizatorul „root†al MariaDB:"
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
#, fuzzy
#| msgid ""
#| "It is highly recommended that you set a password for the MySQL "
@@ -126,13 +126,13 @@ msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid "If this field is left blank, the password will not be changed."
msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:6001
+#: ../mariadb-server-10.5.templates:6001
#, fuzzy
#| msgid "New password for MySQL \"root\" user:"
msgid "Repeat password for the MariaDB \"root\" user:"
@@ -140,7 +140,7 @@ msgstr "Noua parolă pentru utilizatorul „root†al MariaDB:"
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
#, fuzzy
#| msgid "Unable to set password for MySQL \"root\" user"
msgid "Unable to set password for the MariaDB \"root\" user"
@@ -148,7 +148,7 @@ msgstr "Nu s-a putut stabili parola pentru utilizatorul „root†al MariaDB"
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
#, fuzzy
#| msgid ""
#| "It seems an error occurred while setting the password for the MySQL "
@@ -167,26 +167,26 @@ msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid "You should check the account's password after the package installation."
msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid ""
-"Please read the /usr/share/doc/mariadb-server-10.4/README.Debian file for "
+"Please read the /usr/share/doc/mariadb-server-10.5/README.Debian file for "
"more information."
msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:8001
+#: ../mariadb-server-10.5.templates:8001
msgid "Password input error"
msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:8001
+#: ../mariadb-server-10.5.templates:8001
msgid "The two passwords you entered were not the same. Please try again."
msgstr ""
diff --git a/debian/po/ru.po b/debian/po/ru.po
index 00496bd1e06..6198b7425c8 100644
--- a/debian/po/ru.po
+++ b/debian/po/ru.po
@@ -17,7 +17,7 @@
msgid ""
msgstr ""
"Project-Id-Version: mysql-dfsg-5.1 5.1.37-1\n"
-"Report-Msgid-Bugs-To: mariadb-10.4@packages.debian.org\n"
+"Report-Msgid-Bugs-To: mariadb-10.5@packages.debian.org\n"
"POT-Creation-Date: 2016-10-08 01:26+0300\n"
"PO-Revision-Date: 2009-08-06 20:27+0400\n"
"Last-Translator: Yuri Kozlov <yuray@komyakino.ru>\n"
@@ -32,13 +32,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid "The old data directory will be saved at new location"
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"A file named /var/lib/mysql/debian-*.flag exists on this system. The number "
"indicates a database binary format version that cannot automatically be "
@@ -47,7 +47,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"Therefore the previous data directory will be renamed to /var/lib/mysql-* "
"and a new data directory will be initialized at /var/lib/mysql."
@@ -55,20 +55,20 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid "Important note for NIS/YP users"
msgstr "Важное замечание Ð´Ð»Ñ Ð¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ñ‚ÐµÐ»ÐµÐ¹ NIS/YP"
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid ""
"Using MariaDB under NIS/YP requires a mysql user account to be added on the "
"local system with:"
@@ -78,7 +78,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid ""
"You should also check the permissions and ownership of the /var/lib/mysql "
"directory:"
@@ -86,13 +86,13 @@ msgstr "Также проверьте права доÑтупа и владелÑ
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "Удалить вÑе базы данных MariaDB?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid ""
"The /var/lib/mysql directory which contains the MariaDB databases is about "
"to be removed."
@@ -101,7 +101,7 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid ""
"If you're removing the MariaDB package in order to later install a more "
"recent version or if a different mariadb-server package is already using it, "
@@ -113,13 +113,13 @@ msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid "New password for the MariaDB \"root\" user:"
msgstr "Ðовый пароль Ð´Ð»Ñ MariaDB Ð¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ñ‚ÐµÐ»Ñ \"root\":"
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid ""
"While not mandatory, it is highly recommended that you set a password for "
"the MariaDB administrative \"root\" user."
@@ -129,25 +129,25 @@ msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid "If this field is left blank, the password will not be changed."
msgstr "ЕÑли оÑтавить поле пуÑтым, то пароль изменён не будет."
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:6001
+#: ../mariadb-server-10.5.templates:6001
msgid "Repeat password for the MariaDB \"root\" user:"
msgstr "Повторите ввод Ð¿Ð°Ñ€Ð¾Ð»Ñ Ð´Ð»Ñ MariaDB Ð¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ñ‚ÐµÐ»Ñ \"root\":"
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid "Unable to set password for the MariaDB \"root\" user"
msgstr "Ðевозможно задать пароль MariaDB пользователю \"root\""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid ""
"An error occurred while setting the password for the MariaDB administrative "
"user. This may have happened because the account already has a password, or "
@@ -159,31 +159,31 @@ msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid "You should check the account's password after the package installation."
msgstr "Проверьте пароль учётной запиÑи поÑле уÑтановки пакета."
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
#, fuzzy
#| msgid ""
-#| "Please read the /usr/share/doc/mariadb-server-10.4/README.Debian file for "
+#| "Please read the /usr/share/doc/mariadb-server-10.5/README.Debian file for "
#| "more information."
msgid ""
-"Please read the /usr/share/doc/mariadb-server-10.4/README.Debian file for "
+"Please read the /usr/share/doc/mariadb-server-10.5/README.Debian file for "
"more information."
msgstr ""
-"ПодробноÑти Ñм. в файле /usr/share/doc/mariadb-server-10.4/README.Debian."
+"ПодробноÑти Ñм. в файле /usr/share/doc/mariadb-server-10.5/README.Debian."
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:8001
+#: ../mariadb-server-10.5.templates:8001
msgid "Password input error"
msgstr "Ошибка ввода паролÑ"
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:8001
+#: ../mariadb-server-10.5.templates:8001
msgid "The two passwords you entered were not the same. Please try again."
msgstr "Два введённых Ð¿Ð°Ñ€Ð¾Ð»Ñ Ð½Ðµ одинаковы. Повторите ввод."
diff --git a/debian/po/sv.po b/debian/po/sv.po
index 46a64ff81fa..9b74e3300ab 100644
--- a/debian/po/sv.po
+++ b/debian/po/sv.po
@@ -7,7 +7,7 @@
msgid ""
msgstr ""
"Project-Id-Version: mysql-dfsg-5.1 5.0.21-3\n"
-"Report-Msgid-Bugs-To: mariadb-10.4@packages.debian.org\n"
+"Report-Msgid-Bugs-To: mariadb-10.5@packages.debian.org\n"
"POT-Creation-Date: 2016-10-08 01:26+0300\n"
"PO-Revision-Date: 2009-09-08 21:42+0100\n"
"Last-Translator: Martin Bagge <brother@bsnet.se>\n"
@@ -21,13 +21,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid "The old data directory will be saved at new location"
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"A file named /var/lib/mysql/debian-*.flag exists on this system. The number "
"indicates a database binary format version that cannot automatically be "
@@ -36,7 +36,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"Therefore the previous data directory will be renamed to /var/lib/mysql-* "
"and a new data directory will be initialized at /var/lib/mysql."
@@ -44,20 +44,20 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid "Important note for NIS/YP users"
msgstr "Viktig information för NIS/YP-användare"
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid ""
"Using MariaDB under NIS/YP requires a mysql user account to be added on the "
"local system with:"
@@ -67,7 +67,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid ""
"You should also check the permissions and ownership of the /var/lib/mysql "
"directory:"
@@ -77,13 +77,13 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "Ta bort alla MariaDB-databaser?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid ""
"The /var/lib/mysql directory which contains the MariaDB databases is about "
"to be removed."
@@ -93,7 +93,7 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid ""
"If you're removing the MariaDB package in order to later install a more "
"recent version or if a different mariadb-server package is already using it, "
@@ -105,13 +105,13 @@ msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid "New password for the MariaDB \"root\" user:"
msgstr "Nytt lösenord för MariaDBs \"root\"-användare:"
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid ""
"While not mandatory, it is highly recommended that you set a password for "
"the MariaDB administrative \"root\" user."
@@ -121,25 +121,25 @@ msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid "If this field is left blank, the password will not be changed."
msgstr "Om detta fält lämnas tom kommer lösenordet inte att ändras."
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:6001
+#: ../mariadb-server-10.5.templates:6001
msgid "Repeat password for the MariaDB \"root\" user:"
msgstr "Repetera lösenordet för MariaDBs \"root\"-användare:"
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid "Unable to set password for the MariaDB \"root\" user"
msgstr "Kunde inte sätta lösenord för MariaDBs \"root\"-användare"
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid ""
"An error occurred while setting the password for the MariaDB administrative "
"user. This may have happened because the account already has a password, or "
@@ -152,32 +152,32 @@ msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid "You should check the account's password after the package installation."
msgstr "Du bör kontrollera kontots lösenord efter installationen av paketet."
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
#, fuzzy
#| msgid ""
-#| "Please read the /usr/share/doc/mariadb-server-10.4/README.Debian file for "
+#| "Please read the /usr/share/doc/mariadb-server-10.5/README.Debian file for "
#| "more information."
msgid ""
-"Please read the /usr/share/doc/mariadb-server-10.4/README.Debian file for "
+"Please read the /usr/share/doc/mariadb-server-10.5/README.Debian file for "
"more information."
msgstr ""
-"Läs filen /usr/share/doc/mariadb-server-10.4/README.Debian för mer "
+"Läs filen /usr/share/doc/mariadb-server-10.5/README.Debian för mer "
"information."
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:8001
+#: ../mariadb-server-10.5.templates:8001
msgid "Password input error"
msgstr "Fel vid inmatning av lösenord"
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:8001
+#: ../mariadb-server-10.5.templates:8001
msgid "The two passwords you entered were not the same. Please try again."
msgstr "De två lösenorden du angav stämde inte överrens. Prova igen."
diff --git a/debian/po/templates.pot b/debian/po/templates.pot
index 46a4487480e..225818688b3 100644
--- a/debian/po/templates.pot
+++ b/debian/po/templates.pot
@@ -6,8 +6,8 @@
#, fuzzy
msgid ""
msgstr ""
-"Project-Id-Version: mariadb-10.4\n"
-"Report-Msgid-Bugs-To: mariadb-10.4@packages.debian.org\n"
+"Project-Id-Version: mariadb-10.5\n"
+"Report-Msgid-Bugs-To: mariadb-10.5@packages.debian.org\n"
"POT-Creation-Date: 2016-10-08 01:26+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
@@ -19,13 +19,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid "The old data directory will be saved at new location"
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"A file named /var/lib/mysql/debian-*.flag exists on this system. The number "
"indicates a database binary format version that cannot automatically be "
@@ -34,7 +34,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"Therefore the previous data directory will be renamed to /var/lib/mysql-* "
"and a new data directory will be initialized at /var/lib/mysql."
@@ -42,20 +42,20 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid "Important note for NIS/YP users"
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid ""
"Using MariaDB under NIS/YP requires a mysql user account to be added on the "
"local system with:"
@@ -63,7 +63,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid ""
"You should also check the permissions and ownership of the /var/lib/mysql "
"directory:"
@@ -71,13 +71,13 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid "Remove all MariaDB databases?"
msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid ""
"The /var/lib/mysql directory which contains the MariaDB databases is about "
"to be removed."
@@ -85,7 +85,7 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid ""
"If you're removing the MariaDB package in order to later install a more "
"recent version or if a different mariadb-server package is already using it, "
@@ -94,13 +94,13 @@ msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid "New password for the MariaDB \"root\" user:"
msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid ""
"While not mandatory, it is highly recommended that you set a password for "
"the MariaDB administrative \"root\" user."
@@ -108,25 +108,25 @@ msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid "If this field is left blank, the password will not be changed."
msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:6001
+#: ../mariadb-server-10.5.templates:6001
msgid "Repeat password for the MariaDB \"root\" user:"
msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid "Unable to set password for the MariaDB \"root\" user"
msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid ""
"An error occurred while setting the password for the MariaDB administrative "
"user. This may have happened because the account already has a password, or "
@@ -135,26 +135,26 @@ msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid "You should check the account's password after the package installation."
msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid ""
-"Please read the /usr/share/doc/mariadb-server-10.4/README.Debian file for "
+"Please read the /usr/share/doc/mariadb-server-10.5/README.Debian file for "
"more information."
msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:8001
+#: ../mariadb-server-10.5.templates:8001
msgid "Password input error"
msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:8001
+#: ../mariadb-server-10.5.templates:8001
msgid "The two passwords you entered were not the same. Please try again."
msgstr ""
diff --git a/debian/po/tr.po b/debian/po/tr.po
index e62399f3b36..a4249bfe9c6 100644
--- a/debian/po/tr.po
+++ b/debian/po/tr.po
@@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: mysql-dfsg-4.1\n"
-"Report-Msgid-Bugs-To: mariadb-10.4@packages.debian.org\n"
+"Report-Msgid-Bugs-To: mariadb-10.5@packages.debian.org\n"
"POT-Creation-Date: 2016-10-08 01:26+0300\n"
"PO-Revision-Date: 2004-06-05 08:53+0300\n"
"Last-Translator: Gürkan Aslan <gurkan@iaslan.com>\n"
@@ -18,13 +18,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid "The old data directory will be saved at new location"
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"A file named /var/lib/mysql/debian-*.flag exists on this system. The number "
"indicates a database binary format version that cannot automatically be "
@@ -33,7 +33,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"Therefore the previous data directory will be renamed to /var/lib/mysql-* "
"and a new data directory will be initialized at /var/lib/mysql."
@@ -41,14 +41,14 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:2001
+#: ../mariadb-server-10.5.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
#, fuzzy
#| msgid "Important note for NIS/YP users!"
msgid "Important note for NIS/YP users"
@@ -56,7 +56,7 @@ msgstr "NIS/YP kullanıcıları için önemli not!"
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid ""
"Using MariaDB under NIS/YP requires a mysql user account to be added on the "
"local system with:"
@@ -64,7 +64,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.4.templates:3001
+#: ../mariadb-server-10.5.templates:3001
msgid ""
"You should also check the permissions and ownership of the /var/lib/mysql "
"directory:"
@@ -72,13 +72,13 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid "Remove all MariaDB databases?"
msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid ""
"The /var/lib/mysql directory which contains the MariaDB databases is about "
"to be removed."
@@ -86,7 +86,7 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.4.templates:4001
+#: ../mariadb-server-10.5.templates:4001
msgid ""
"If you're removing the MariaDB package in order to later install a more "
"recent version or if a different mariadb-server package is already using it, "
@@ -95,13 +95,13 @@ msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid "New password for the MariaDB \"root\" user:"
msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid ""
"While not mandatory, it is highly recommended that you set a password for "
"the MariaDB administrative \"root\" user."
@@ -109,25 +109,25 @@ msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:5001
+#: ../mariadb-server-10.5.templates:5001
msgid "If this field is left blank, the password will not be changed."
msgstr ""
#. Type: password
#. Description
-#: ../mariadb-server-10.4.templates:6001
+#: ../mariadb-server-10.5.templates:6001
msgid "Repeat password for the MariaDB \"root\" user:"
msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid "Unable to set password for the MariaDB \"root\" user"
msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid ""
"An error occurred while setting the password for the MariaDB administrative "
"user. This may have happened because the account already has a password, or "
@@ -136,26 +136,26 @@ msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid "You should check the account's password after the package installation."
msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:7001
+#: ../mariadb-server-10.5.templates:7001
msgid ""
-"Please read the /usr/share/doc/mariadb-server-10.4/README.Debian file for "
+"Please read the /usr/share/doc/mariadb-server-10.5/README.Debian file for "
"more information."
msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:8001
+#: ../mariadb-server-10.5.templates:8001
msgid "Password input error"
msgstr ""
#. Type: error
#. Description
-#: ../mariadb-server-10.4.templates:8001
+#: ../mariadb-server-10.5.templates:8001
msgid "The two passwords you entered were not the same. Please try again."
msgstr ""
diff --git a/debian/rules b/debian/rules
index 9914bae721b..c4ec7497ee1 100755
--- a/debian/rules
+++ b/debian/rules
@@ -116,8 +116,8 @@ override_dh_auto_install:
ifneq (,$(filter linux,$(DEB_HOST_ARCH_OS)))
# Copy systemd files to a location available for dh_installinit
- cp $(BUILDDIR)/support-files/mariadb.service debian/mariadb-server-10.4.mariadb.service
- cp $(BUILDDIR)/support-files/mariadb@.service debian/mariadb-server-10.4.mariadb@.service
+ cp $(BUILDDIR)/support-files/mariadb.service debian/mariadb-server-10.5.mariadb.service
+ cp $(BUILDDIR)/support-files/mariadb@.service debian/mariadb-server-10.5.mariadb@.service
endif
# make install
@@ -130,12 +130,12 @@ endif
# nm numeric soft is not enough, therefore extra sort in command
# to satisfy Debian reproducible build requirements
- nm --defined-only $(BUILDDIR)/sql/mysqld | LC_ALL=C sort | gzip -n -9 > $(TMP)/usr/share/doc/mariadb-server-10.4/mysqld.sym.gz
+ nm --defined-only $(BUILDDIR)/sql/mysqld | LC_ALL=C sort | gzip -n -9 > $(TMP)/usr/share/doc/mariadb-server-10.5/mysqld.sym.gz
# rename and install AppArmor profile
install -D -m 644 debian/apparmor-profile $(TMP)/etc/apparmor.d/usr.sbin.mysqld
# install Apport hook
- install -D -m 644 debian/mariadb-server-10.4.py $(TMP)/usr/share/apport/package-hooks/source_mariadb-10.4.py
+ install -D -m 644 debian/mariadb-server-10.5.py $(TMP)/usr/share/apport/package-hooks/source_mariadb-10.5.py
# Install libmariadbclient18 compatibility links
ln -s libmariadb.so.3 $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmariadbclient.so
diff --git a/extra/crc32_armv8_neon/CMakeLists.txt b/extra/crc32_armv8_neon/CMakeLists.txt
new file mode 100644
index 00000000000..ba1d34d7c2e
--- /dev/null
+++ b/extra/crc32_armv8_neon/CMakeLists.txt
@@ -0,0 +1,8 @@
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
+INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/include)
+
+ADD_CONVENIENCE_LIBRARY(${CRC32_LIBRARY} $<TARGET_OBJECTS:common_crc32c_armv8>)
+ADD_LIBRARY(common_crc32c_armv8 OBJECT crc32_armv8.c)
+
+SET_TARGET_PROPERTIES(common_crc32c_armv8 PROPERTIES COMPILE_FLAGS "${ARMV8_CRC_COMPILE_FLAGS}")
+
diff --git a/extra/crc32_armv8_neon/crc32_armv8.c b/extra/crc32_armv8_neon/crc32_armv8.c
new file mode 100644
index 00000000000..20f341552e2
--- /dev/null
+++ b/extra/crc32_armv8_neon/crc32_armv8.c
@@ -0,0 +1,301 @@
+#include <my_global.h>
+#include <string.h>
+
+
+#if defined(__GNUC__) && defined(__linux__) && defined(HAVE_ARMV8_CRC)
+
+#include <sys/auxv.h>
+#include <asm/hwcap.h>
+
+#ifndef HWCAP_CRC32
+#define HWCAP_CRC32 (1 << 7)
+#endif
+
+unsigned int crc32c_aarch64_available(void)
+{
+ unsigned long auxv = getauxval(AT_HWCAP);
+ return (auxv & HWCAP_CRC32) != 0;
+}
+
+#endif
+
+#ifndef HAVE_ARMV8_CRC_CRYPTO_INTRINSICS
+
+/* Request crc extension capabilities from the assembler */
+asm(".arch_extension crc");
+
+#ifdef HAVE_ARMV8_CRYPTO
+/* crypto extension */
+asm(".arch_extension crypto");
+#endif
+
+#define CRC32CX(crc, value) __asm__("crc32cx %w[c], %w[c], %x[v]":[c]"+r"(crc):[v]"r"(value))
+#define CRC32CW(crc, value) __asm__("crc32cw %w[c], %w[c], %w[v]":[c]"+r"(crc):[v]"r"(value))
+#define CRC32CH(crc, value) __asm__("crc32ch %w[c], %w[c], %w[v]":[c]"+r"(crc):[v]"r"(value))
+#define CRC32CB(crc, value) __asm__("crc32cb %w[c], %w[c], %w[v]":[c]"+r"(crc):[v]"r"(value))
+
+#define CRC32C3X8(buffer, ITR) \
+ __asm__("crc32cx %w[c1], %w[c1], %x[v]":[c1]"+r"(crc1):[v]"r"(*((const uint64_t *)buffer + 42*1 + (ITR))));\
+ __asm__("crc32cx %w[c2], %w[c2], %x[v]":[c2]"+r"(crc2):[v]"r"(*((const uint64_t *)buffer + 42*2 + (ITR))));\
+ __asm__("crc32cx %w[c0], %w[c0], %x[v]":[c0]"+r"(crc0):[v]"r"(*((const uint64_t *)buffer + 42*0 + (ITR))));
+
+#define CRC32C3X8_ZERO \
+ __asm__("crc32cx %w[c0], %w[c0], xzr":[c0]"+r"(crc0));
+
+#else /* HAVE_ARMV8_CRC_CRYPTO_INTRINSICS */
+
+/* Intrinsics header*/
+#include <arm_acle.h>
+#include <arm_neon.h>
+
+#define CRC32CX(crc, value) (crc) = __crc32cd((crc), (value))
+#define CRC32CW(crc, value) (crc) = __crc32cw((crc), (value))
+#define CRC32CH(crc, value) (crc) = __crc32ch((crc), (value))
+#define CRC32CB(crc, value) (crc) = __crc32cb((crc), (value))
+
+#define CRC32C3X8(buffer, ITR) \
+ crc1 = __crc32cd(crc1, *((const uint64_t *)buffer + 42*1 + (ITR)));\
+ crc2 = __crc32cd(crc2, *((const uint64_t *)buffer + 42*2 + (ITR)));\
+ crc0 = __crc32cd(crc0, *((const uint64_t *)buffer + 42*0 + (ITR)));
+
+#define CRC32C3X8_ZERO \
+ crc0 = __crc32cd(crc0, (const uint64_t)0);
+
+#endif /* HAVE_ARMV8_CRC_CRYPTO_INTRINSICS */
+
+#define CRC32C7X3X8(buffer, ITR) do {\
+ CRC32C3X8(buffer, ((ITR) * 7 + 0)) \
+ CRC32C3X8(buffer, ((ITR) * 7 + 1)) \
+ CRC32C3X8(buffer, ((ITR) * 7 + 2)) \
+ CRC32C3X8(buffer, ((ITR) * 7 + 3)) \
+ CRC32C3X8(buffer, ((ITR) * 7 + 4)) \
+ CRC32C3X8(buffer, ((ITR) * 7 + 5)) \
+ CRC32C3X8(buffer, ((ITR) * 7 + 6)) \
+ } while(0)
+
+#define CRC32C7X3X8_ZERO do {\
+ CRC32C3X8_ZERO \
+ CRC32C3X8_ZERO \
+ CRC32C3X8_ZERO \
+ CRC32C3X8_ZERO \
+ CRC32C3X8_ZERO \
+ CRC32C3X8_ZERO \
+ CRC32C3X8_ZERO \
+ } while(0)
+
+#define PREF4X64L1(buffer, PREF_OFFSET, ITR) \
+ __asm__("PRFM PLDL1KEEP, [%x[v],%[c]]"::[v]"r"(buffer), [c]"I"((PREF_OFFSET) + ((ITR) + 0)*64));\
+ __asm__("PRFM PLDL1KEEP, [%x[v],%[c]]"::[v]"r"(buffer), [c]"I"((PREF_OFFSET) + ((ITR) + 1)*64));\
+ __asm__("PRFM PLDL1KEEP, [%x[v],%[c]]"::[v]"r"(buffer), [c]"I"((PREF_OFFSET) + ((ITR) + 2)*64));\
+ __asm__("PRFM PLDL1KEEP, [%x[v],%[c]]"::[v]"r"(buffer), [c]"I"((PREF_OFFSET) + ((ITR) + 3)*64));
+
+#define PREF1KL1(buffer, PREF_OFFSET) \
+ PREF4X64L1(buffer,(PREF_OFFSET), 0) \
+ PREF4X64L1(buffer,(PREF_OFFSET), 4) \
+ PREF4X64L1(buffer,(PREF_OFFSET), 8) \
+ PREF4X64L1(buffer,(PREF_OFFSET), 12)
+
+#define PREF4X64L2(buffer, PREF_OFFSET, ITR) \
+ __asm__("PRFM PLDL2KEEP, [%x[v],%[c]]"::[v]"r"(buffer), [c]"I"((PREF_OFFSET) + ((ITR) + 0)*64));\
+ __asm__("PRFM PLDL2KEEP, [%x[v],%[c]]"::[v]"r"(buffer), [c]"I"((PREF_OFFSET) + ((ITR) + 1)*64));\
+ __asm__("PRFM PLDL2KEEP, [%x[v],%[c]]"::[v]"r"(buffer), [c]"I"((PREF_OFFSET) + ((ITR) + 2)*64));\
+ __asm__("PRFM PLDL2KEEP, [%x[v],%[c]]"::[v]"r"(buffer), [c]"I"((PREF_OFFSET) + ((ITR) + 3)*64));
+
+#define PREF1KL2(buffer, PREF_OFFSET) \
+ PREF4X64L2(buffer,(PREF_OFFSET), 0) \
+ PREF4X64L2(buffer,(PREF_OFFSET), 4) \
+ PREF4X64L2(buffer,(PREF_OFFSET), 8) \
+ PREF4X64L2(buffer,(PREF_OFFSET), 12)
+
+
+uint32_t crc32c_aarch64(uint32_t crc, const unsigned char *buffer, uint64_t len)
+{
+ uint32_t crc0, crc1, crc2;
+ int64_t length = (int64_t)len;
+
+ crc = 0xFFFFFFFFU;
+
+ if (buffer) {
+
+/* Crypto extension Support
+ * Process 1024 Bytes (per block)
+ */
+#ifdef HAVE_ARMV8_CRYPTO
+
+/* Intrinsics Support */
+#ifdef HAVE_ARMV8_CRC_CRYPTO_INTRINSICS
+ const poly64_t k1 = 0xe417f38a, k2 = 0x8f158014;
+ uint64_t t0, t1;
+
+ /* Process per block size of 1024 Bytes
+ * A block size = 8 + 42*3*sizeof(uint64_t) + 8
+ */
+ while ((length -= 1024) >= 0) {
+ /* Prefetch 3*1024 data for avoiding L2 cache miss */
+ PREF1KL2(buffer, 1024*3);
+ /* Do first 8 bytes here for better pipelining */
+ crc0 = __crc32cd(crc, *(const uint64_t *)buffer);
+ crc1 = 0;
+ crc2 = 0;
+ buffer += sizeof(uint64_t);
+
+ /* Process block inline
+ * Process crc0 last to avoid dependency with above
+ */
+ CRC32C7X3X8(buffer, 0);
+ CRC32C7X3X8(buffer, 1);
+ CRC32C7X3X8(buffer, 2);
+ CRC32C7X3X8(buffer, 3);
+ CRC32C7X3X8(buffer, 4);
+ CRC32C7X3X8(buffer, 5);
+
+ buffer += 42*3*sizeof(uint64_t);
+ /* Prefetch data for following block to avoid L1 cache miss */
+ PREF1KL1(buffer, 1024);
+
+ /* Last 8 bytes
+ * Merge crc0 and crc1 into crc2
+ * crc1 multiply by K2
+ * crc0 multiply by K1
+ */
+ t1 = (uint64_t)vmull_p64(crc1, k2);
+ t0 = (uint64_t)vmull_p64(crc0, k1);
+ crc = __crc32cd(crc2, *(const uint64_t *)buffer);
+ crc1 = __crc32cd(0, t1);
+ crc ^= crc1;
+ crc0 = __crc32cd(0, t0);
+ crc ^= crc0;
+
+ buffer += sizeof(uint64_t);
+ }
+
+#else /* HAVE_ARMV8_CRC_CRYPTO_INTRINSICS */
+
+ /*No intrinsics*/
+ __asm__("mov x16, #0xf38a \n\t"
+ "movk x16, #0xe417, lsl 16 \n\t"
+ "mov v1.2d[0], x16 \n\t"
+ "mov x16, #0x8014 \n\t"
+ "movk x16, #0x8f15, lsl 16 \n\t"
+ "mov v0.2d[0], x16 \n\t"
+ :::"x16");
+
+ while ((length -= 1024) >= 0) {
+ PREF1KL2(buffer, 1024*3);
+ __asm__("crc32cx %w[c0], %w[c], %x[v]\n\t"
+ :[c0]"=r"(crc0):[c]"r"(crc), [v]"r"(*(const uint64_t *)buffer):);
+ crc1 = 0;
+ crc2 = 0;
+ buffer += sizeof(uint64_t);
+
+ CRC32C7X3X8(buffer, 0);
+ CRC32C7X3X8(buffer, 1);
+ CRC32C7X3X8(buffer, 2);
+ CRC32C7X3X8(buffer, 3);
+ CRC32C7X3X8(buffer, 4);
+ CRC32C7X3X8(buffer, 5);
+
+ buffer += 42*3*sizeof(uint64_t);
+ PREF1KL1(buffer, 1024);
+ __asm__("mov v2.2d[0], %x[c1] \n\t"
+ "pmull v2.1q, v2.1d, v0.1d \n\t"
+ "mov v3.2d[0], %x[c0] \n\t"
+ "pmull v3.1q, v3.1d, v1.1d \n\t"
+ "crc32cx %w[c], %w[c2], %x[v] \n\t"
+ "mov %x[c1], v2.2d[0] \n\t"
+ "crc32cx %w[c1], wzr, %x[c1] \n\t"
+ "eor %w[c], %w[c], %w[c1] \n\t"
+ "mov %x[c0], v3.2d[0] \n\t"
+ "crc32cx %w[c0], wzr, %x[c0] \n\t"
+ "eor %w[c], %w[c], %w[c0] \n\t"
+ :[c1]"+r"(crc1), [c0]"+r"(crc0), [c2]"+r"(crc2), [c]"+r"(crc)
+ :[v]"r"(*((const uint64_t *)buffer)));
+ buffer += sizeof(uint64_t);
+ }
+#endif /* HAVE_ARMV8_CRC_CRYPTO_INTRINSICS */
+
+ /* Done if Input data size is aligned with 1024 */
+ if(!(length += 1024))
+ return (~crc);
+
+#endif /* HAVE_ARMV8_CRYPTO */
+
+ while ((length -= sizeof(uint64_t)) >= 0) {
+ CRC32CX(crc, *(uint64_t *)buffer);
+ buffer += sizeof(uint64_t);
+ }
+ /* The following is more efficient than the straight loop */
+ if (length & sizeof(uint32_t)) {
+ CRC32CW(crc, *(uint32_t *)buffer);
+ buffer += sizeof(uint32_t);
+ }
+ if (length & sizeof(uint16_t)) {
+ CRC32CH(crc, *(uint16_t *)buffer);
+ buffer += sizeof(uint16_t);
+ }
+ if (length & sizeof(uint8_t))
+ CRC32CB(crc, *buffer);
+
+ } else {
+#ifdef HAVE_ARMV8_CRYPTO
+#ifdef HAVE_ARMV8_CRC_CRYPTO_INTRINSICS
+ const poly64_t k1 = 0xe417f38a;
+ uint64_t t0;
+ while ((length -= 1024) >= 0) {
+ crc0 = __crc32cd(crc, 0);
+
+ CRC32C7X3X8_ZERO;
+ CRC32C7X3X8_ZERO;
+ CRC32C7X3X8_ZERO;
+ CRC32C7X3X8_ZERO;
+ CRC32C7X3X8_ZERO;
+ CRC32C7X3X8_ZERO;
+
+ /* Merge crc0 into crc: crc0 multiply by K1 */
+ t0 = (uint64_t)vmull_p64(crc0, k1);
+ crc = __crc32cd(0, t0);
+ }
+#else /* !HAVE_ARMV8_CRC_CRYPTO_INTRINSICS */
+ __asm__("mov x16, #0xf38a \n\t"
+ "movk x16, #0xe417, lsl 16 \n\t"
+ "mov v1.2d[0], x16 \n\t"
+ :::"x16");
+
+ while ((length -= 1024) >= 0) {
+ __asm__("crc32cx %w[c0], %w[c], xzr\n\t"
+ :[c0]"=r"(crc0):[c]"r"(crc));
+
+ CRC32C7X3X8_ZERO;
+ CRC32C7X3X8_ZERO;
+ CRC32C7X3X8_ZERO;
+ CRC32C7X3X8_ZERO;
+ CRC32C7X3X8_ZERO;
+ CRC32C7X3X8_ZERO;
+
+ __asm__("mov v3.2d[0], %x[c0] \n\t"
+ "pmull v3.1q, v3.1d, v1.1d \n\t"
+ "mov %x[c0], v3.2d[0] \n\t"
+ "crc32cx %w[c], wzr, %x[c0] \n\t"
+ :[c]"=r"(crc)
+ :[c0]"r"(crc0));
+ }
+#endif /* HAVE_ARMV8_CRC_CRYPTO_INTRINSICS */
+ if(!(length += 1024))
+ return (~crc);
+#endif /* HAVE_ARMV8_CRYPTO */
+ while ((length -= sizeof(uint64_t)) >= 0)
+ CRC32CX(crc, 0);
+
+ /* The following is more efficient than the straight loop */
+ if (length & sizeof(uint32_t))
+ CRC32CW(crc, 0);
+
+ if (length & sizeof(uint16_t))
+ CRC32CH(crc, 0);
+
+ if (length & sizeof(uint8_t))
+ CRC32CB(crc, 0);
+ }
+
+ return (~crc);
+}
diff --git a/extra/mariabackup/CMakeLists.txt b/extra/mariabackup/CMakeLists.txt
index 5326ba9f8f5..71d97886b3f 100644
--- a/extra/mariabackup/CMakeLists.txt
+++ b/extra/mariabackup/CMakeLists.txt
@@ -74,6 +74,7 @@ MYSQL_ADD_EXECUTABLE(mariabackup
backup_mysql.cc
backup_copy.cc
encryption_plugin.cc
+ ${PROJECT_BINARY_DIR}/sql/sql_builtin.cc
${PROJECT_SOURCE_DIR}/sql/net_serv.cc
${NT_SERVICE_SOURCE}
${PROJECT_SOURCE_DIR}/libmysqld/libmysql.c
@@ -81,13 +82,14 @@ MYSQL_ADD_EXECUTABLE(mariabackup
)
+
+
# Export all symbols on Unix, for better crash callstacks
SET_TARGET_PROPERTIES(mariabackup PROPERTIES ENABLE_EXPORTS TRUE)
ADD_SUBDIRECTORY(crc)
-TARGET_LINK_LIBRARIES(mariabackup sql crc)
-
+TARGET_LINK_LIBRARIES(mariabackup sql sql_builtins crc)
IF(NOT HAVE_SYSTEM_REGEX)
TARGET_LINK_LIBRARIES(mariabackup pcreposix)
ENDIF()
diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc
index a31668a9642..21e574ae3b8 100644
--- a/extra/mariabackup/backup_copy.cc
+++ b/extra/mariabackup/backup_copy.cc
@@ -1009,7 +1009,6 @@ static int fix_win_file_permissions(const char *file)
ACL* pOldDACL;
SECURITY_DESCRIPTOR* pSD = NULL;
EXPLICIT_ACCESS ea = { 0 };
- BOOL isWellKnownSID = FALSE;
PSID pSid = NULL;
GetSecurityInfo(hFile, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION, NULL, NULL,
@@ -1030,15 +1029,15 @@ static int fix_win_file_permissions(const char *file)
ea.Trustee.TrusteeType = TRUSTEE_IS_UNKNOWN;
ACL* pNewDACL = 0;
DWORD err = SetEntriesInAcl(1, &ea, pOldDACL, &pNewDACL);
- if (pNewDACL)
+ if (!err)
{
+ DBUG_ASSERT(pNewDACL);
SetSecurityInfo(hFile, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION, NULL, NULL,
pNewDACL, NULL);
+ LocalFree((HLOCAL)pNewDACL);
}
if (pSD != NULL)
LocalFree((HLOCAL)pSD);
- if (pNewDACL != NULL)
- LocalFree((HLOCAL)pNewDACL);
CloseHandle(hFile);
return 0;
}
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc
index f695b5c7f6d..d4badc15520 100644
--- a/extra/mariabackup/xtrabackup.cc
+++ b/extra/mariabackup/xtrabackup.cc
@@ -242,7 +242,6 @@ char* innobase_data_file_path;
my_bool innobase_use_doublewrite;
my_bool innobase_file_per_table;
-my_bool innobase_locks_unsafe_for_binlog;
my_bool innobase_rollback_on_timeout;
my_bool innobase_create_status_file;
@@ -1369,11 +1368,6 @@ struct my_option xb_server_options[] =
&xb_plugin_dir, &xb_plugin_dir,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
- {"innodb-log-checksums", OPT_INNODB_LOG_CHECKSUMS,
- "Whether to require checksums for InnoDB redo log blocks",
- &innodb_log_checksums, &innodb_log_checksums,
- 0, GET_BOOL, REQUIRED_ARG, 1, 0, 0, 0, 0, 0 },
-
{"open_files_limit", OPT_OPEN_FILES_LIMIT, "the maximum number of file "
"descriptors to reserve with setrlimit().",
(G_PTR*) &xb_open_files_limit, (G_PTR*) &xb_open_files_limit, 0, GET_ULONG,
@@ -1922,8 +1916,6 @@ static bool innodb_init_param()
srv_file_per_table = (my_bool) innobase_file_per_table;
- srv_locks_unsafe_for_binlog = (ibool) innobase_locks_unsafe_for_binlog;
-
srv_max_n_open_files = ULINT_UNDEFINED - 5;
srv_innodb_status = (ibool) innobase_create_status_file;
@@ -1963,10 +1955,6 @@ static bool innodb_init_param()
srv_undo_dir = (char*) ".";
}
- log_checksum_algorithm_ptr = innodb_log_checksums || srv_encrypt_log
- ? log_block_calc_checksum_crc32
- : log_block_calc_checksum_none;
-
#ifdef _WIN32
srv_use_native_aio = TRUE;
#endif
@@ -5461,7 +5449,6 @@ static bool xtrabackup_prepare_func(char** argv)
}
srv_max_n_threads = 1000;
- srv_undo_logs = 1;
srv_n_purge_threads = 1;
xb_filters_init();
@@ -5908,7 +5895,7 @@ handle_options(int argc, char **argv, char ***argv_client, char ***argv_server)
srv_operation = SRV_OPERATION_RESTORE;
- files_charset_info = &my_charset_utf8_general_ci;
+ files_charset_info = &my_charset_utf8mb3_general_ci;
setup_error_messages();
@@ -6132,7 +6119,7 @@ int main(int argc, char **argv)
die("mysql_server_init() failed");
}
- system_charset_info = &my_charset_utf8_general_ci;
+ system_charset_info = &my_charset_utf8mb3_general_ci;
key_map_full.set_all();
logger.init_base();
diff --git a/include/aria_backup.h b/include/aria_backup.h
index 1a1c437d0b9..30c139c4234 100644
--- a/include/aria_backup.h
+++ b/include/aria_backup.h
@@ -23,10 +23,15 @@ typedef struct st_aria_table_capabilities
ulong bitmap_pages_covered;
uint block_size;
uint keypage_header;
+ enum data_file_type data_file_type;
my_bool checksum;
my_bool transactional;
+ my_bool encrypted;
/* This is true if the table can be copied without any locks */
my_bool online_backup_safe;
+ /* s3 capabilities */
+ ulong s3_block_size;
+ uint8 compression;
} ARIA_TABLE_CAPABILITIES;
int aria_get_capabilities(File kfile, ARIA_TABLE_CAPABILITIES *cap);
diff --git a/include/m_ctype.h b/include/m_ctype.h
index 0f6e6a11666..54e1a166592 100644
--- a/include/m_ctype.h
+++ b/include/m_ctype.h
@@ -531,7 +531,7 @@ struct my_charset_handler_st
extern MY_CHARSET_HANDLER my_charset_8bit_handler;
extern MY_CHARSET_HANDLER my_charset_ucs2_handler;
-extern MY_CHARSET_HANDLER my_charset_utf8_handler;
+extern MY_CHARSET_HANDLER my_charset_utf8mb3_handler;
/*
@@ -582,7 +582,7 @@ extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_latin1;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_latin1_nopad;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_filename;
-extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8_general_ci;
+extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8mb3_general_ci;
extern struct charset_info_st my_charset_big5_bin;
extern struct charset_info_st my_charset_big5_chinese_ci;
@@ -649,12 +649,12 @@ extern struct charset_info_st my_charset_utf32_unicode_ci;
extern struct charset_info_st my_charset_utf32_unicode_nopad_ci;
extern struct charset_info_st my_charset_utf32_nopad_bin;
extern struct charset_info_st my_charset_utf32_general_nopad_ci;
-extern struct charset_info_st my_charset_utf8_bin;
-extern struct charset_info_st my_charset_utf8_nopad_bin;
-extern struct charset_info_st my_charset_utf8_general_nopad_ci;
-extern struct charset_info_st my_charset_utf8_general_mysql500_ci;
-extern struct charset_info_st my_charset_utf8_unicode_ci;
-extern struct charset_info_st my_charset_utf8_unicode_nopad_ci;
+extern struct charset_info_st my_charset_utf8mb3_bin;
+extern struct charset_info_st my_charset_utf8mb3_nopad_bin;
+extern struct charset_info_st my_charset_utf8mb3_general_nopad_ci;
+extern struct charset_info_st my_charset_utf8mb3_general_mysql500_ci;
+extern struct charset_info_st my_charset_utf8mb3_unicode_ci;
+extern struct charset_info_st my_charset_utf8mb3_unicode_nopad_ci;
extern struct charset_info_st my_charset_utf8mb4_bin;
extern struct charset_info_st my_charset_utf8mb4_general_ci;
extern struct charset_info_st my_charset_utf8mb4_nopad_bin;
diff --git a/include/ma_dyncol.h b/include/ma_dyncol.h
index 4f05b425afd..833a25b937e 100644
--- a/include/ma_dyncol.h
+++ b/include/ma_dyncol.h
@@ -66,7 +66,7 @@ typedef struct st_mysql_lex_string LEX_STRING;
#ifdef HAVE_CHARSET_utf8mb4
#define DYNCOL_UTF (&my_charset_utf8mb4_general_ci)
#else
-#define DYNCOL_UTF (&my_charset_utf8_general_ci)
+#define DYNCOL_UTF (&my_charset_utf8mb3_general_ci)
#endif
/* escape json strings */
diff --git a/include/maria.h b/include/maria.h
index a1396d3a4c7..5ff76391270 100644
--- a/include/maria.h
+++ b/include/maria.h
@@ -145,12 +145,14 @@ typedef struct st_maria_create_info
ulonglong auto_increment;
ulonglong data_file_length;
ulonglong key_file_length;
+ ulong s3_block_size;
/* Size of null bitmap at start of row */
uint null_bytes;
uint old_options;
+ uint compression_algorithm;
enum data_file_type org_data_file_type;
uint16 language;
- my_bool with_auto_increment, transactional;
+ my_bool with_auto_increment, transactional, encrypted;
} MARIA_CREATE_INFO;
struct st_maria_share;
@@ -184,6 +186,7 @@ typedef struct st_maria_keydef /* Key definition with open & info */
uint16 keylength; /* Tot length of keyparts (auto) */
uint16 minlength; /* min length of (packed) key (auto) */
uint16 maxlength; /* max length of (packed) key (auto) */
+ uint16 max_store_length; /* Size to store key + overhead */
uint32 write_comp_flag; /* compare flag for write key (auto) */
uint32 version; /* For concurrent read/write */
uint32 ftkey_nr; /* full-text index number */
@@ -229,6 +232,7 @@ typedef struct st_maria_decode_tree /* Decode huff-table */
struct st_maria_bit_buff;
+typedef struct s3_info S3_INFO;
/*
Note that null markers should always be first in a row !
@@ -285,7 +289,7 @@ extern my_bool maria_upgrade(void);
extern int maria_close(MARIA_HA *file);
extern int maria_delete(MARIA_HA *file, const uchar *buff);
extern MARIA_HA *maria_open(const char *name, int mode,
- uint wait_if_locked);
+ uint wait_if_locked, S3_INFO *s3);
extern int maria_panic(enum ha_panic_function function);
extern int maria_rfirst(MARIA_HA *file, uchar *buf, int inx);
extern int maria_rkey(MARIA_HA *file, uchar *buf, int inx,
diff --git a/include/my_base.h b/include/my_base.h
index 68b3aaa6a13..e73844d0937 100644
--- a/include/my_base.h
+++ b/include/my_base.h
@@ -53,7 +53,7 @@
Allow opening even if table is incompatible as this is for ALTER TABLE which
will fix the table structure.
*/
-#define HA_OPEN_FOR_ALTER 4096U
+#define HA_OPEN_FOR_ALTER 8192U
/* The following is parameter to ha_rkey() how to use key */
diff --git a/include/my_bit.h b/include/my_bit.h
index 7a408bd0535..ccdf5a069e1 100644
--- a/include/my_bit.h
+++ b/include/my_bit.h
@@ -130,6 +130,47 @@ static inline uchar last_byte_mask(uint bits)
/* Return bitmask for the significant bits */
return ((2U << used) - 1);
}
+
+#ifdef _MSC_VER
+#include <intrin.h>
+#endif
+
+#define MY_FIND_FIRST_BIT_END sizeof(ulonglong)*8
+/*
+ Find the position of the first(least significant) bit set in
+ the argument. Returns 64 if the argument was 0.
+*/
+static inline uint my_find_first_bit(ulonglong n)
+{
+ if(!n)
+ return MY_FIND_FIRST_BIT_END;
+#if defined(__GNUC__)
+ return __builtin_ctzll(n);
+#elif defined(_MSC_VER)
+#if defined(_M_IX86)
+ unsigned long bit;
+ if( _BitScanForward(&bit, (uint)n))
+ return bit;
+ _BitScanForward(&bit, (uint)(n>>32));
+ return bit + 32;
+#else
+ unsigned long bit;
+ _BitScanForward64(&bit, n);
+ return bit;
+#endif
+#else
+ /* Generic case */
+ uint shift= 0;
+ static const uchar last_bit[16] = { 32, 0, 1, 0,
+ 2, 0, 1, 0,
+ 3, 0, 1, 0,
+ 2, 0, 1, 0};
+ uint bit;
+ while ((bit = last_bit[(n >> shift) & 0xF]) == 32)
+ shift+= 4;
+ return shift+bit;
+#endif
+}
C_MODE_END
#endif /* MY_BIT_INCLUDED */
diff --git a/include/my_global.h b/include/my_global.h
index ae12f233734..68033d8a9e6 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -1076,8 +1076,8 @@ typedef ulong myf; /* Type of MyFlags in my_funcs */
#ifdef HAVE_CHARSET_utf8mb4
#define MYSQL_UNIVERSAL_CLIENT_CHARSET "utf8mb4"
-#elif defined(HAVE_CHARSET_utf8)
-#define MYSQL_UNIVERSAL_CLIENT_CHARSET "utf8"
+#elif defined(HAVE_CHARSET_utf8mb3)
+#define MYSQL_UNIVERSAL_CLIENT_CHARSET "utf8mb3"
#else
#define MYSQL_UNIVERSAL_CLIENT_CHARSET MYSQL_DEFAULT_CHARSET_NAME
#endif
diff --git a/include/my_handler_errors.h b/include/my_handler_errors.h
index 45614ce221a..faf7b9f459e 100644
--- a/include/my_handler_errors.h
+++ b/include/my_handler_errors.h
@@ -101,7 +101,7 @@ static const char *handler_error_messages[]=
"Operation was interrupted by end user (probably kill command?)",
"Disk full",
/* 190 */
- "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",
+ "Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine. You may have retry or dump and restore the table to fix this",
"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.",
"Foreign key cascade delete/update exceeds max depth",
diff --git a/include/my_pthread.h b/include/my_pthread.h
index 1b35d0fdd0d..17813047ce5 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -312,6 +312,8 @@ int my_pthread_mutex_trylock(pthread_mutex_t *mutex);
#endif
#endif
+size_t my_setstacksize(pthread_attr_t *attr, size_t stacksize);
+
/*
The defines set_timespec and set_timespec_nsec should be used
for calculating an absolute time at which
@@ -581,36 +583,13 @@ extern int rw_pr_destroy(rw_pr_lock_t *);
/**
Implementation of Windows rwlock.
- We use native (slim) rwlocks on Win7 and later, and fallback to portable
- implementation on earlier Windows.
-
- slim rwlock are also available on Vista/WS2008, but we do not use it
- ("trylock" APIs are missing on Vista)
+ We use native (slim) rwlocks on Windows, which requires Win7
+ or later.
*/
-typedef union
+typedef struct _my_rwlock_t
{
- /* Native rwlock (is_srwlock == TRUE) */
- struct
- {
- SRWLOCK srwlock; /* native reader writer lock */
- BOOL have_exclusive_srwlock; /* used for unlock */
- };
-
- /*
- Portable implementation (is_srwlock == FALSE)
- Fields are identical with Unix my_rw_lock_t fields.
- */
- struct
- {
- pthread_mutex_t lock; /* lock for structure */
- pthread_cond_t readers; /* waiting readers */
- pthread_cond_t writers; /* waiting writers */
- int state; /* -1:writer,0:free,>0:readers */
- int waiters; /* number of waiting writers */
-#ifdef SAFE_MUTEX
- pthread_t write_thread;
-#endif
- };
+ SRWLOCK srwlock; /* native reader writer lock */
+ BOOL have_exclusive_srwlock; /* used for unlock */
} my_rw_lock_t;
@@ -719,22 +698,34 @@ extern void my_mutex_end(void);
#define INSTRUMENT_ME 0
+/*
+ Thread specific variables
+
+ Aria key cache is using the following variables for keeping track of
+ state:
+ suspend, next, prev, keycache_link, keycache_file, suspend, lock_type
+
+ MariaDB uses the following to
+ mutex, current_mutex, current_cond, abort
+*/
+
struct st_my_thread_var
{
int thr_errno;
mysql_cond_t suspend;
mysql_mutex_t mutex;
+ struct st_my_thread_var *next,**prev;
mysql_mutex_t * volatile current_mutex;
mysql_cond_t * volatile current_cond;
+ void *keycache_link;
+ void *keycache_file;
+ void *stack_ends_here;
+ safe_mutex_t *mutex_in_use;
pthread_t pthread_self;
my_thread_id id, dbug_id;
int volatile abort;
+ uint lock_type; /* used by conditional release the queue */
my_bool init;
- struct st_my_thread_var *next,**prev;
- void *keycache_link;
- uint lock_type; /* used by conditional release the queue */
- void *stack_ends_here;
- safe_mutex_t *mutex_in_use;
#ifndef DBUG_OFF
void *dbug;
char name[THREAD_NAME_SIZE+1];
diff --git a/include/my_stack_alloc.h b/include/my_stack_alloc.h
new file mode 100644
index 00000000000..2d5a721856d
--- /dev/null
+++ b/include/my_stack_alloc.h
@@ -0,0 +1,92 @@
+/* Copyright 2019 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
+ 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-1335 USA
+*/
+
+#ifndef _my_stack_alloc_h
+#define _my_stack_alloc_h
+
+/*
+ Do allocation through alloca if there is enough stack available.
+ If not, use my_malloc() instead.
+
+ The idea is that to be able to alloc as much as possible through the
+ stack. To ensure this, we have two different limits, on for big
+ blocks and one for small blocks. This will enable us to continue to
+ do allocation for small blocks even when there is less stack space
+ available.
+ This is for example used by Aria when traversing the b-tree and the code
+ needs to allocate one b-tree page and a few keys for each recursion. Even
+ if there is not space to allocate the b-tree pages on stack we can still
+ continue to allocate the keys.
+*/
+
+/*
+ Default suggested allocations
+*/
+
+/* Allocate big blocks as long as there is this much left */
+#define STACK_ALLOC_BIG_BLOCK 1024*64
+
+/* Allocate small blocks as long as there is this much left */
+#define STACK_ALLOC_SMALL_BLOCK 1024*32
+
+/* Allocate small blocks as long as there is this much left */
+#define STACK_ALLOC_SMALL_BLOCK_SIZE 4096
+
+/*
+ Allocate a block on stack or through malloc.
+ The 'must_be_freed' variable will be set to 1 if malloc was called.
+ 'must_be_freed' must be a variable on the stack!
+*/
+
+#ifdef HAVE_ALLOCA
+#define alloc_on_stack(stack_end, res, must_be_freed, size) \
+do \
+{ \
+ size_t alloc_size= (size); \
+ size_t stack_left= available_stack_size(&alloc_size, (stack_end)); \
+ if (stack_left > alloc_size && \
+ (STACK_ALLOC_BIG_BLOCK < stack_left - alloc_size || \
+ ((STACK_ALLOC_SMALL_BLOCK < stack_left - alloc_size) && \
+ (STACK_ALLOC_SMALL_BLOCK_SIZE <= alloc_size)))) \
+ { \
+ (must_be_freed)= 0; \
+ (res)= alloca(size); \
+ } \
+ else \
+ { \
+ (must_be_freed)= 1; \
+ (res)= my_malloc(size, MYF(MY_THREAD_SPECIFIC | MY_WME)); \
+ } \
+} while(0)
+#else
+#define alloc_on_stack(stack_end, res, must_be_freed, size) \
+ do { \
+ (must_be_freed)= 1; \
+ (res)= my_malloc(size, MYF(MY_THREAD_SPECIFIC | MY_WME)); \
+ } while(0)
+#endif /* HAVE_ALLOCA */
+
+
+/*
+ Free memory allocated by stack_alloc
+*/
+
+static inline void stack_alloc_free(void *res, my_bool must_be_freed)
+{
+ if (must_be_freed)
+ my_free(res);
+}
+#endif /* _my_stack_alloc_h */
diff --git a/include/my_stacktrace.h b/include/my_stacktrace.h
index 922a59c196a..63e97dbc4f2 100644
--- a/include/my_stacktrace.h
+++ b/include/my_stacktrace.h
@@ -41,7 +41,7 @@
C_MODE_START
#if defined(HAVE_STACKTRACE) || defined(HAVE_BACKTRACE)
-void my_init_stacktrace();
+void my_init_stacktrace(int setup_handlers);
void my_print_stacktrace(uchar* stack_bottom, ulong thread_stack,
my_bool silent);
int my_safe_print_str(const char* val, size_t max_len);
@@ -53,7 +53,7 @@ char *my_demangle(const char *mangled_name, int *status);
void my_set_exception_pointers(EXCEPTION_POINTERS *ep);
#endif /* __WIN__ */
#else
-#define my_init_stacktrace() do { } while(0)
+#define my_init_stacktrace(A) do { } while(0)
#endif /* ! (defined(HAVE_STACKTRACE) || defined(HAVE_BACKTRACE)) */
#ifndef _WIN32
diff --git a/include/my_sys.h b/include/my_sys.h
index 8f0d98f68bb..4d0eab83da5 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -691,16 +691,17 @@ int my_set_user(const char *user, struct passwd *user_info, myf MyFlags);
extern int check_if_legal_filename(const char *path);
extern int check_if_legal_tablename(const char *path);
-#ifdef __WIN__
+#ifdef _WIN32
extern my_bool is_filename_allowed(const char *name, size_t length,
my_bool allow_current_dir);
-#else /* __WIN__ */
+#else /* _WIN32 */
# define is_filename_allowed(name, length, allow_cwd) (TRUE)
-#endif /* __WIN__ */
+#endif /* _WIN32 */
#ifdef _WIN32
/* Windows-only functions (CRT equivalents)*/
extern HANDLE my_get_osfhandle(File fd);
+extern File my_win_handle2File(HANDLE hFile);
extern void my_osmaperr(unsigned long last_error);
#endif
@@ -1043,7 +1044,7 @@ extern size_t escape_string_for_mysql(CHARSET_INFO *charset_info,
char *to, size_t to_length,
const char *from, size_t length);
extern char *get_tty_password(const char *opt_message);
-#ifdef __WIN__
+#ifdef _WIN32
#define BACKSLASH_MBTAIL
/* File system character set */
extern CHARSET_INFO *fs_character_set(void);
@@ -1057,8 +1058,7 @@ extern void thd_increment_bytes_sent(void *thd, size_t length);
extern void thd_increment_bytes_received(void *thd, size_t length);
extern void thd_increment_net_big_packet_count(void *thd, size_t length);
-#ifdef __WIN__
-extern my_bool have_tcpip; /* Is set if tcpip is used */
+#ifdef _WIN32
/* implemented in my_windac.c */
diff --git a/include/myisam.h b/include/myisam.h
index 216f041c8a9..d283712a1e0 100644
--- a/include/myisam.h
+++ b/include/myisam.h
@@ -309,6 +309,8 @@ extern int mi_make_backup_of_index(struct st_myisam_info *info,
#define MYISAMCHK_VERIFY 2 /* Verify, run repair if failure */
typedef uint mi_bit_type;
+typedef struct st_sort_key_blocks SORT_KEY_BLOCKS;
+typedef struct st_sort_ftbuf SORT_FT_BUF;
typedef struct st_mi_bit_buff
{ /* Used for packing of record */
diff --git a/include/myisamchk.h b/include/myisamchk.h
index 5876d67ca5f..f1a7348eea0 100644
--- a/include/myisamchk.h
+++ b/include/myisamchk.h
@@ -20,6 +20,8 @@
#ifndef _myisamchk_h
#define _myisamchk_h
+#include <my_stack_alloc.h>
+
/*
Flags used by xxxxchk.c or/and ha_xxxx.cc that are NOT passed
to xxxcheck.c follows:
@@ -33,15 +35,6 @@
#define O_NEW_DATA 2U
#define O_DATA_LOST 4U
-typedef struct st_sort_key_blocks /* Used when sorting */
-{
- uchar *buff, *end_pos;
- uchar lastkey[HA_MAX_POSSIBLE_KEY_BUFF];
- uint last_length;
- int inited;
-} SORT_KEY_BLOCKS;
-
-
/*
MARIA/MYISAM supports several statistics collection
methods. Currently statistics collection method is not stored in
@@ -111,6 +104,7 @@ typedef struct st_handler_check_param
my_bool retry_repair, force_sort, calc_checksum, static_row_size;
char temp_filename[FN_REFLEN];
IO_CACHE read_cache;
+ void **stack_end_ptr;
enum_handler_stats_method stats_method;
/* For reporting progress */
uint stage, max_stage;
@@ -125,14 +119,6 @@ typedef struct st_handler_check_param
} HA_CHECK;
-typedef struct st_sort_ftbuf
-{
- uchar *buf, *end;
- int count;
- uchar lastkey[HA_MAX_KEY_BUFF];
-} SORT_FT_BUF;
-
-
typedef struct st_buffpek {
my_off_t file_pos; /* Where we are in the sort file */
uchar *base, *key; /* Key pointers */
diff --git a/include/mysql.h.pp b/include/mysql.h.pp
index 1e4479e8f2b..4fcfab4aea4 100644
--- a/include/mysql.h.pp
+++ b/include/mysql.h.pp
@@ -1,3 +1,4 @@
+extern "C" {
typedef char my_bool;
typedef int my_socket;
enum enum_server_command
@@ -107,8 +108,10 @@ enum enum_session_state_type
SESSION_TRACK_GTIDS,
SESSION_TRACK_TRANSACTION_CHARACTERISTICS,
SESSION_TRACK_TRANSACTION_STATE,
+ SESSION_TRACK_USER_VARIABLES,
SESSION_TRACK_always_at_the_end
};
+extern "C" {
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);
@@ -127,6 +130,7 @@ struct sockaddr;
int my_connect(my_socket s, const struct sockaddr *name, unsigned int namelen,
unsigned int timeout);
struct my_rnd_struct;
+}
enum Item_result
{
STRING_RESULT=0, REAL_RESULT, INT_RESULT, ROW_RESULT, DECIMAL_RESULT,
@@ -152,6 +156,7 @@ typedef struct st_udf_init
my_bool const_item;
void *extension;
} UDF_INIT;
+extern "C" {
void create_random_string(char *to, unsigned int length,
struct my_rnd_struct *rand_st);
void hash_password(unsigned long *to, const char *password, unsigned int password_len);
@@ -171,6 +176,7 @@ 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);
+}
typedef long my_time_t;
enum enum_mysql_timestamp_type
{
@@ -184,6 +190,7 @@ typedef struct st_mysql_time
my_bool neg;
enum enum_mysql_timestamp_type time_type;
} MYSQL_TIME;
+extern "C" {
typedef struct st_list {
struct st_list *prev,*next;
void *data;
@@ -196,6 +203,7 @@ extern LIST *list_reverse(LIST *root);
extern void list_free(LIST *root,unsigned int free_data);
extern unsigned int list_length(LIST *);
extern int list_walk(LIST *,list_walk_action action,unsigned char * argument);
+}
extern unsigned int mariadb_deinitialize_ssl;
extern unsigned int mysql_port;
extern char *mysql_unix_port;
@@ -225,6 +233,7 @@ typedef struct st_mysql_field {
typedef char **MYSQL_ROW;
typedef unsigned int MYSQL_FIELD_OFFSET;
typedef unsigned long long my_ulonglong;
+extern "C" {
typedef struct st_used_mem
{
struct st_used_mem *next;
@@ -244,6 +253,7 @@ typedef struct st_mem_root
void (*error_handler)(void);
const char *name;
} MEM_ROOT;
+}
typedef struct st_typelib {
unsigned int count;
const char *name;
@@ -256,7 +266,7 @@ extern int find_type_with_warning(const char *x, TYPELIB *typelib,
extern int find_type(const char *x, const TYPELIB *typelib, unsigned int flags);
extern void make_type(char *to,unsigned int nr,TYPELIB *typelib);
extern const char *get_type(TYPELIB *typelib,unsigned int nr);
-extern TYPELIB *copy_typelib(MEM_ROOT *root, TYPELIB *from);
+extern TYPELIB *copy_typelib(MEM_ROOT *root, const TYPELIB *from);
extern TYPELIB sql_protocol_typelib;
my_ulonglong find_set_from_flags(const TYPELIB *lib, unsigned int default_name,
my_ulonglong cur_set, my_ulonglong default_set,
@@ -770,3 +780,4 @@ unsigned int mysql_get_timeout_value(const MYSQL *mysql);
unsigned int mysql_get_timeout_value_ms(const MYSQL *mysql);
unsigned long mysql_net_read_packet(MYSQL *mysql);
unsigned long mysql_net_field_length(unsigned char **packet);
+}
diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h
index 484287db98d..f95e842e1d0 100644
--- a/include/mysql/plugin.h
+++ b/include/mysql/plugin.h
@@ -23,18 +23,20 @@
unlike other compilers, uses C++ mangling for variables not only
for functions.
*/
-#if defined(_MSC_VER)
- #ifdef __cplusplus
- #define MYSQL_PLUGIN_EXPORT extern "C" __declspec(dllexport)
+#ifdef MYSQL_DYNAMIC_PLUGIN
+ #ifdef _MSC_VER
+ #define MYSQL_DLLEXPORT _declspec(dllexport)
#else
- #define MYSQL_PLUGIN_EXPORT __declspec(dllexport)
- #endif
-#else /*_MSC_VER */
- #ifdef __cplusplus
- #define MYSQL_PLUGIN_EXPORT extern "C"
- #else
- #define MYSQL_PLUGIN_EXPORT
+ #define MYSQL_DLLEXPORT
#endif
+#else
+ #define MYSQL_DLLEXPORT
+#endif
+
+#ifdef __cplusplus
+ #define MYSQL_PLUGIN_EXPORT extern "C" MYSQL_DLLEXPORT
+#else
+ #define MYSQL_PLUGIN_EXPORT MYSQL_DLLEXPORT
#endif
#ifdef __cplusplus
@@ -88,11 +90,13 @@ typedef struct st_mysql_xid MYSQL_XID;
#define MYSQL_AUDIT_PLUGIN 5
#define MYSQL_REPLICATION_PLUGIN 6
#define MYSQL_AUTHENTICATION_PLUGIN 7
-#define MYSQL_MAX_PLUGIN_TYPE_NUM 10 /* The number of plugin types */
+#define MYSQL_MAX_PLUGIN_TYPE_NUM 12 /* The number of plugin types */
/* MariaDB plugin types */
#define MariaDB_PASSWORD_VALIDATION_PLUGIN 8
#define MariaDB_ENCRYPTION_PLUGIN 9
+#define MariaDB_DATA_TYPE_PLUGIN 10
+#define MariaDB_FUNCTION_COLLECTION_PLUGIN 11
/* We use the following strings to define licenses for plugins */
#define PLUGIN_LICENSE_PROPRIETARY 0
@@ -175,7 +179,7 @@ enum enum_mysql_show_type
SHOW_ULONGLONG, SHOW_CHAR, SHOW_CHAR_PTR,
SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE,
SHOW_SINT, SHOW_SLONG, SHOW_SLONGLONG, SHOW_SIMPLE_FUNC,
- SHOW_always_last
+ SHOW_SIZE_T, SHOW_always_last
};
/* backward compatibility mapping. */
@@ -645,7 +649,6 @@ int thd_in_lock_tables(const MYSQL_THD thd);
int thd_tablespace_op(const MYSQL_THD thd);
long long thd_test_options(const MYSQL_THD thd, long long test_options);
int thd_sql_command(const MYSQL_THD thd);
-void **thd_ha_data(const MYSQL_THD thd, const struct handlerton *hton);
void thd_storage_lock_wait(MYSQL_THD thd, long long value);
int thd_tx_isolation(const MYSQL_THD thd);
int thd_tx_is_read_only(const MYSQL_THD thd);
diff --git a/include/mysql/plugin_audit.h.pp b/include/mysql/plugin_audit.h.pp
index c5ae678e82a..07fe16ea92f 100644
--- a/include/mysql/plugin_audit.h.pp
+++ b/include/mysql/plugin_audit.h.pp
@@ -1,5 +1,9 @@
+class THD;
+class Item;
typedef char my_bool;
typedef void * MYSQL_PLUGIN;
+extern "C" {
+extern "C" {
extern struct base64_service_st {
int (*base64_needed_encoded_length_ptr)(int length_of_data);
int (*base64_encode_max_arg_length_ptr)(void);
@@ -16,7 +20,11 @@ int my_base64_decode_max_arg_length();
int my_base64_encode(const void *src, size_t src_len, char *dst);
int my_base64_decode(const char *src, size_t src_len,
void *dst, const char **end_ptr, int flags);
-extern void (*debug_sync_C_callback_ptr)(void*, const char *, size_t);
+}
+extern "C" {
+extern void (*debug_sync_C_callback_ptr)(THD*, const char *, size_t);
+}
+extern "C" {
struct encryption_service_st {
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,
@@ -57,6 +65,8 @@ static inline int encryption_crypt(const unsigned char* src, unsigned int slen,
*dlen= d1 + d2;
return res1 ? res1 : res2;
}
+}
+extern "C" {
struct st_encryption_scheme_key {
unsigned int version;
unsigned char key[16];
@@ -93,15 +103,19 @@ int encryption_scheme_decrypt(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);
+}
+extern "C" {
enum thd_kill_levels {
THD_IS_NOT_KILLED=0,
THD_ABORT_SOFTLY=50,
THD_ABORT_ASAP=100,
};
extern struct kill_statement_service_st {
- enum thd_kill_levels (*thd_kill_level_func)(const void*);
+ enum thd_kill_levels (*thd_kill_level_func)(const THD*);
} *thd_kill_statement_service;
-enum thd_kill_levels thd_kill_level(const void*);
+enum thd_kill_levels thd_kill_level(const THD*);
+}
+extern "C" {
typedef struct logger_handle_st LOGGER_HANDLE;
extern struct logger_service_st {
void (*logger_init_mutexes)();
@@ -123,6 +137,8 @@ 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);
+}
+extern "C" {
extern struct my_md5_service_st {
void (*my_md5_type)(unsigned char*, const char*, size_t);
void (*my_md5_multi_type)(unsigned char*, ...);
@@ -137,6 +153,8 @@ 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);
+}
+extern "C" {
enum my_aes_mode {
MY_AES_ECB, MY_AES_CBC
};
@@ -166,6 +184,8 @@ int my_aes_crypt(enum my_aes_mode mode, int flags,
int my_random_bytes(unsigned char* buf, int num);
unsigned int my_aes_get_size(enum my_aes_mode mode, unsigned int source_length);
unsigned int my_aes_ctx_size(enum my_aes_mode mode);
+}
+extern "C" {
extern struct my_print_error_service_st {
void (*my_error_func)(unsigned int nr, unsigned long MyFlags, ...);
void (*my_printf_error_func)(unsigned int nr, const char *fmt, unsigned long MyFlags,...);
@@ -174,32 +194,38 @@ extern struct my_print_error_service_st {
extern void my_error(unsigned int nr, unsigned long MyFlags, ...);
extern void my_printf_error(unsigned int my_err, const char *format, unsigned long MyFlags, ...);
extern void my_printv_error(unsigned int error, const char *format, unsigned long MyFlags,va_list ap);
+}
+extern "C" {
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);
+}
+extern "C" {
extern struct progress_report_service_st {
- void (*thd_progress_init_func)(void* thd, unsigned int max_stage);
- void (*thd_progress_report_func)(void* thd,
+ void (*thd_progress_init_func)(THD* thd, unsigned int max_stage);
+ void (*thd_progress_report_func)(THD* thd,
unsigned long long progress,
unsigned long long max_progress);
- void (*thd_progress_next_stage_func)(void* thd);
- void (*thd_progress_end_func)(void* thd);
- const char *(*set_thd_proc_info_func)(void*, const char *info,
+ void (*thd_progress_next_stage_func)(THD* thd);
+ void (*thd_progress_end_func)(THD* thd);
+ const char *(*set_thd_proc_info_func)(THD*, const char *info,
const char *func,
const char *file,
unsigned int line);
} *progress_report_service;
-void thd_progress_init(void* thd, unsigned int max_stage);
-void thd_progress_report(void* thd,
+void thd_progress_init(THD* thd, unsigned int max_stage);
+void thd_progress_report(THD* thd,
unsigned long long progress,
unsigned long long max_progress);
-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,
+void thd_progress_next_stage(THD* thd);
+void thd_progress_end(THD* thd);
+const char *set_thd_proc_info(THD*, const char * info, const char *func,
const char *file, unsigned int line);
+}
+extern "C" {
extern struct my_sha1_service_st {
void (*my_sha1_type)(unsigned char*, const char*, size_t);
void (*my_sha1_multi_type)(unsigned char*, ...);
@@ -214,6 +240,8 @@ 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);
+}
+extern "C" {
extern struct my_sha2_service_st {
void (*my_sha224_type)(unsigned char*, const char*, size_t);
void (*my_sha224_multi_type)(unsigned char*, ...);
@@ -264,6 +292,8 @@ size_t my_sha512_context_size();
void my_sha512_init(void *context);
void my_sha512_input(void *context, const unsigned char *buf, size_t len);
void my_sha512_result(void *context, unsigned char *digest);
+}
+extern "C" {
struct st_mysql_lex_string
{
char *str;
@@ -277,64 +307,73 @@ struct st_mysql_const_lex_string
};
typedef struct st_mysql_const_lex_string MYSQL_CONST_LEX_STRING;
extern struct thd_alloc_service_st {
- void *(*thd_alloc_func)(void*, size_t);
- void *(*thd_calloc_func)(void*, size_t);
- char *(*thd_strdup_func)(void*, const char *);
- char *(*thd_strmake_func)(void*, const char *, size_t);
- void *(*thd_memdup_func)(void*, const void*, size_t);
- MYSQL_CONST_LEX_STRING *(*thd_make_lex_string_func)(void*,
+ void *(*thd_alloc_func)(THD*, size_t);
+ void *(*thd_calloc_func)(THD*, size_t);
+ char *(*thd_strdup_func)(THD*, const char *);
+ char *(*thd_strmake_func)(THD*, const char *, size_t);
+ void *(*thd_memdup_func)(THD*, const void*, size_t);
+ MYSQL_CONST_LEX_STRING *(*thd_make_lex_string_func)(THD*,
MYSQL_CONST_LEX_STRING *,
const char *, size_t, int);
} *thd_alloc_service;
-void *thd_alloc(void* thd, size_t size);
-void *thd_calloc(void* thd, size_t size);
-char *thd_strdup(void* thd, const char *str);
-char *thd_strmake(void* thd, const char *str, size_t size);
-void *thd_memdup(void* thd, const void* str, size_t size);
+void *thd_alloc(THD* thd, size_t size);
+void *thd_calloc(THD* thd, size_t size);
+char *thd_strdup(THD* thd, const char *str);
+char *thd_strmake(THD* thd, const char *str, size_t size);
+void *thd_memdup(THD* thd, const void* str, size_t size);
MYSQL_CONST_LEX_STRING
-*thd_make_lex_string(void* thd, MYSQL_CONST_LEX_STRING *lex_str,
+*thd_make_lex_string(THD* thd, MYSQL_CONST_LEX_STRING *lex_str,
const char *str, size_t size,
int allocate_lex_string);
+}
+extern "C" {
extern struct thd_autoinc_service_st {
- void (*thd_get_autoinc_func)(const void* thd,
+ void (*thd_get_autoinc_func)(const THD* thd,
unsigned long* off, unsigned long* inc);
} *thd_autoinc_service;
-void thd_get_autoinc(const void* thd,
+void thd_get_autoinc(const THD* thd,
unsigned long* off, unsigned long* inc);
+}
+extern "C" {
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);
- unsigned long (*thd_get_error_row_func)(const void* thd);
- void (*thd_inc_error_row_func)(void* thd);
- char *(*thd_get_error_context_description_func)(void* thd,
+ const char *(*thd_get_error_message_func)(const THD* thd);
+ unsigned int (*thd_get_error_number_func)(const THD* thd);
+ unsigned long (*thd_get_error_row_func)(const THD* thd);
+ void (*thd_inc_error_row_func)(THD* thd);
+ char *(*thd_get_error_context_description_func)(THD* thd,
char *buffer,
unsigned int length,
unsigned int max_query_length);
} *thd_error_context_service;
-const char *thd_get_error_message(const void* thd);
-unsigned int thd_get_error_number(const void* thd);
-unsigned long thd_get_error_row(const void* thd);
-void thd_inc_error_row(void* thd);
-char *thd_get_error_context_description(void* thd,
+const char *thd_get_error_message(const THD* thd);
+unsigned int thd_get_error_number(const THD* thd);
+unsigned long thd_get_error_row(const THD* thd);
+void thd_inc_error_row(THD* thd);
+char *thd_get_error_context_description(THD* thd,
char *buffer, unsigned int length,
unsigned int max_query_length);
+}
+extern "C" {
extern struct thd_rnd_service_st {
- double (*thd_rnd_ptr)(void* thd);
- void (*thd_c_r_p_ptr)(void* thd, char *to, size_t length);
+ double (*thd_rnd_ptr)(THD* thd);
+ void (*thd_c_r_p_ptr)(THD* thd, char *to, size_t length);
} *thd_rnd_service;
-double thd_rnd(void* thd);
-void thd_create_random_password(void* thd, char *to, size_t length);
+double thd_rnd(THD* thd);
+void thd_create_random_password(THD* thd, char *to, size_t length);
+}
+extern "C" {
typedef int MYSQL_THD_KEY_T;
extern struct thd_specifics_service_st {
int (*thd_key_create_func)(MYSQL_THD_KEY_T *key);
void (*thd_key_delete_func)(MYSQL_THD_KEY_T *key);
- void *(*thd_getspecific_func)(void* thd, MYSQL_THD_KEY_T key);
- int (*thd_setspecific_func)(void* thd, MYSQL_THD_KEY_T key, void *value);
+ void *(*thd_getspecific_func)(THD* thd, MYSQL_THD_KEY_T key);
+ int (*thd_setspecific_func)(THD* thd, MYSQL_THD_KEY_T key, void *value);
} *thd_specifics_service;
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);
+void* thd_getspecific(THD* thd, MYSQL_THD_KEY_T key);
+int thd_setspecific(THD* thd, MYSQL_THD_KEY_T key, void *value);
+}
typedef long my_time_t;
enum enum_mysql_timestamp_type
{
@@ -348,12 +387,15 @@ typedef struct st_mysql_time
my_bool neg;
enum enum_mysql_timestamp_type time_type;
} MYSQL_TIME;
+extern "C" {
extern struct thd_timezone_service_st {
- 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);
+ my_time_t (*thd_TIME_to_gmt_sec)(THD* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
+ void (*thd_gmt_sec_to_TIME)(THD* thd, MYSQL_TIME *ltime, my_time_t t);
} *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);
+my_time_t thd_TIME_to_gmt_sec(THD* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
+void thd_gmt_sec_to_TIME(THD* thd, MYSQL_TIME *ltime, my_time_t t);
+}
+extern "C" {
typedef enum _thd_wait_type_e {
THD_WAIT_SLEEP= 1,
THD_WAIT_DISKIO= 2,
@@ -369,11 +411,13 @@ typedef enum _thd_wait_type_e {
THD_WAIT_LAST= 12
} thd_wait_type;
extern struct thd_wait_service_st {
- void (*thd_wait_begin_func)(void*, int);
- void (*thd_wait_end_func)(void*);
+ void (*thd_wait_begin_func)(THD*, int);
+ void (*thd_wait_end_func)(THD*);
} *thd_wait_service;
-void thd_wait_begin(void* thd, int wait_type);
-void thd_wait_end(void* thd);
+void thd_wait_begin(THD* thd, int wait_type);
+void thd_wait_end(THD* thd);
+}
+extern "C" {
enum json_types
{
JSV_BAD_JSON=-1,
@@ -419,6 +463,8 @@ int json_escape_string(const char *str,const char *str_end,
char *json, char *json_end);
int json_unescape_json(const char *json_str, const char *json_end,
char *res, char *res_end);
+}
+}
struct st_mysql_xid {
long formatID;
long gtrid_length;
@@ -432,7 +478,7 @@ enum enum_mysql_show_type
SHOW_ULONGLONG, SHOW_CHAR, SHOW_CHAR_PTR,
SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE,
SHOW_SINT, SHOW_SLONG, SHOW_SLONGLONG, SHOW_SIMPLE_FUNC,
- SHOW_always_last
+ SHOW_SIZE_T, SHOW_always_last
};
enum enum_var_type
{
@@ -444,13 +490,13 @@ struct st_mysql_show_var {
enum enum_mysql_show_type type;
};
struct system_status_var;
-typedef int (*mysql_show_var_func)(void*, struct st_mysql_show_var*, void *, struct system_status_var *status_var, enum enum_var_type);
+typedef int (*mysql_show_var_func)(THD*, struct st_mysql_show_var*, void *, struct system_status_var *status_var, enum enum_var_type);
struct st_mysql_sys_var;
struct st_mysql_value;
-typedef int (*mysql_var_check_func)(void* thd,
+typedef int (*mysql_var_check_func)(THD* thd,
struct st_mysql_sys_var *var,
void *save, struct st_mysql_value *value);
-typedef void (*mysql_var_update_func)(void* thd,
+typedef void (*mysql_var_update_func)(THD* thd,
struct st_mysql_sys_var *var,
void *var_ptr, const void *save);
struct st_mysql_plugin
@@ -485,6 +531,7 @@ struct st_maria_plugin
const char *version_info;
unsigned int maturity;
};
+extern "C" {
enum enum_ftparser_mode
{
MYSQL_FTPARSER_SIMPLE_MODE= 0,
@@ -531,6 +578,7 @@ struct st_mysql_ftparser
int (*init)(MYSQL_FTPARSER_PARAM *param);
int (*deinit)(MYSQL_FTPARSER_PARAM *param);
};
+}
struct st_mysql_daemon
{
int interface_version;
@@ -555,24 +603,26 @@ struct st_mysql_value
int (*val_int)(struct st_mysql_value *, long long *intbuf);
int (*is_unsigned)(struct st_mysql_value *);
};
-int thd_in_lock_tables(const void* thd);
-int thd_tablespace_op(const void* thd);
-long long thd_test_options(const void* thd, long long test_options);
-int thd_sql_command(const void* thd);
-void **thd_ha_data(const void* thd, const struct handlerton *hton);
-void thd_storage_lock_wait(void* thd, long long value);
-int thd_tx_isolation(const void* thd);
-int thd_tx_is_read_only(const void* thd);
+extern "C" {
+int thd_in_lock_tables(const THD* thd);
+int thd_tablespace_op(const THD* thd);
+long long thd_test_options(const THD* thd, long long test_options);
+int thd_sql_command(const THD* thd);
+void thd_storage_lock_wait(THD* thd, long long value);
+int thd_tx_isolation(const THD* thd);
+int thd_tx_is_read_only(const THD* thd);
int mysql_tmpfile(const char *prefix);
-unsigned long thd_get_thread_id(const void* thd);
-void thd_get_xid(const void* thd, MYSQL_XID *xid);
-void mysql_query_cache_invalidate4(void* thd,
+unsigned long thd_get_thread_id(const THD* thd);
+void thd_get_xid(const THD* thd, MYSQL_XID *xid);
+void mysql_query_cache_invalidate4(THD* thd,
const char *key, unsigned int key_length,
int using_trx);
-void *thd_get_ha_data(const void* thd, const struct handlerton *hton);
-void thd_set_ha_data(void* thd, const struct handlerton *hton,
+void *thd_get_ha_data(const THD* thd, const struct handlerton *hton);
+void thd_set_ha_data(THD* thd, const struct handlerton *hton,
const void *ha_data);
-void thd_wakeup_subsequent_commits(void* thd, int wakeup_error);
+void thd_wakeup_subsequent_commits(THD* thd, int wakeup_error);
+}
+extern "C" {
struct mysql_event_general
{
unsigned int event_subclass;
@@ -630,7 +680,8 @@ struct mysql_event_table
struct st_mysql_audit
{
int interface_version;
- void (*release_thd)(void*);
- void (*event_notify)(void*, unsigned int, const void *);
+ void (*release_thd)(THD*);
+ void (*event_notify)(THD*, unsigned int, const void *);
unsigned long class_mask[1];
};
+}
diff --git a/include/mysql/plugin_auth.h.pp b/include/mysql/plugin_auth.h.pp
index 41cb7d075c4..18eebd5e04a 100644
--- a/include/mysql/plugin_auth.h.pp
+++ b/include/mysql/plugin_auth.h.pp
@@ -1,5 +1,9 @@
+class THD;
+class Item;
typedef char my_bool;
typedef void * MYSQL_PLUGIN;
+extern "C" {
+extern "C" {
extern struct base64_service_st {
int (*base64_needed_encoded_length_ptr)(int length_of_data);
int (*base64_encode_max_arg_length_ptr)(void);
@@ -16,7 +20,11 @@ int my_base64_decode_max_arg_length();
int my_base64_encode(const void *src, size_t src_len, char *dst);
int my_base64_decode(const char *src, size_t src_len,
void *dst, const char **end_ptr, int flags);
-extern void (*debug_sync_C_callback_ptr)(void*, const char *, size_t);
+}
+extern "C" {
+extern void (*debug_sync_C_callback_ptr)(THD*, const char *, size_t);
+}
+extern "C" {
struct encryption_service_st {
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,
@@ -57,6 +65,8 @@ static inline int encryption_crypt(const unsigned char* src, unsigned int slen,
*dlen= d1 + d2;
return res1 ? res1 : res2;
}
+}
+extern "C" {
struct st_encryption_scheme_key {
unsigned int version;
unsigned char key[16];
@@ -93,15 +103,19 @@ int encryption_scheme_decrypt(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);
+}
+extern "C" {
enum thd_kill_levels {
THD_IS_NOT_KILLED=0,
THD_ABORT_SOFTLY=50,
THD_ABORT_ASAP=100,
};
extern struct kill_statement_service_st {
- enum thd_kill_levels (*thd_kill_level_func)(const void*);
+ enum thd_kill_levels (*thd_kill_level_func)(const THD*);
} *thd_kill_statement_service;
-enum thd_kill_levels thd_kill_level(const void*);
+enum thd_kill_levels thd_kill_level(const THD*);
+}
+extern "C" {
typedef struct logger_handle_st LOGGER_HANDLE;
extern struct logger_service_st {
void (*logger_init_mutexes)();
@@ -123,6 +137,8 @@ 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);
+}
+extern "C" {
extern struct my_md5_service_st {
void (*my_md5_type)(unsigned char*, const char*, size_t);
void (*my_md5_multi_type)(unsigned char*, ...);
@@ -137,6 +153,8 @@ 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);
+}
+extern "C" {
enum my_aes_mode {
MY_AES_ECB, MY_AES_CBC
};
@@ -166,6 +184,8 @@ int my_aes_crypt(enum my_aes_mode mode, int flags,
int my_random_bytes(unsigned char* buf, int num);
unsigned int my_aes_get_size(enum my_aes_mode mode, unsigned int source_length);
unsigned int my_aes_ctx_size(enum my_aes_mode mode);
+}
+extern "C" {
extern struct my_print_error_service_st {
void (*my_error_func)(unsigned int nr, unsigned long MyFlags, ...);
void (*my_printf_error_func)(unsigned int nr, const char *fmt, unsigned long MyFlags,...);
@@ -174,32 +194,38 @@ extern struct my_print_error_service_st {
extern void my_error(unsigned int nr, unsigned long MyFlags, ...);
extern void my_printf_error(unsigned int my_err, const char *format, unsigned long MyFlags, ...);
extern void my_printv_error(unsigned int error, const char *format, unsigned long MyFlags,va_list ap);
+}
+extern "C" {
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);
+}
+extern "C" {
extern struct progress_report_service_st {
- void (*thd_progress_init_func)(void* thd, unsigned int max_stage);
- void (*thd_progress_report_func)(void* thd,
+ void (*thd_progress_init_func)(THD* thd, unsigned int max_stage);
+ void (*thd_progress_report_func)(THD* thd,
unsigned long long progress,
unsigned long long max_progress);
- void (*thd_progress_next_stage_func)(void* thd);
- void (*thd_progress_end_func)(void* thd);
- const char *(*set_thd_proc_info_func)(void*, const char *info,
+ void (*thd_progress_next_stage_func)(THD* thd);
+ void (*thd_progress_end_func)(THD* thd);
+ const char *(*set_thd_proc_info_func)(THD*, const char *info,
const char *func,
const char *file,
unsigned int line);
} *progress_report_service;
-void thd_progress_init(void* thd, unsigned int max_stage);
-void thd_progress_report(void* thd,
+void thd_progress_init(THD* thd, unsigned int max_stage);
+void thd_progress_report(THD* thd,
unsigned long long progress,
unsigned long long max_progress);
-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,
+void thd_progress_next_stage(THD* thd);
+void thd_progress_end(THD* thd);
+const char *set_thd_proc_info(THD*, const char * info, const char *func,
const char *file, unsigned int line);
+}
+extern "C" {
extern struct my_sha1_service_st {
void (*my_sha1_type)(unsigned char*, const char*, size_t);
void (*my_sha1_multi_type)(unsigned char*, ...);
@@ -214,6 +240,8 @@ 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);
+}
+extern "C" {
extern struct my_sha2_service_st {
void (*my_sha224_type)(unsigned char*, const char*, size_t);
void (*my_sha224_multi_type)(unsigned char*, ...);
@@ -264,6 +292,8 @@ size_t my_sha512_context_size();
void my_sha512_init(void *context);
void my_sha512_input(void *context, const unsigned char *buf, size_t len);
void my_sha512_result(void *context, unsigned char *digest);
+}
+extern "C" {
struct st_mysql_lex_string
{
char *str;
@@ -277,64 +307,73 @@ struct st_mysql_const_lex_string
};
typedef struct st_mysql_const_lex_string MYSQL_CONST_LEX_STRING;
extern struct thd_alloc_service_st {
- void *(*thd_alloc_func)(void*, size_t);
- void *(*thd_calloc_func)(void*, size_t);
- char *(*thd_strdup_func)(void*, const char *);
- char *(*thd_strmake_func)(void*, const char *, size_t);
- void *(*thd_memdup_func)(void*, const void*, size_t);
- MYSQL_CONST_LEX_STRING *(*thd_make_lex_string_func)(void*,
+ void *(*thd_alloc_func)(THD*, size_t);
+ void *(*thd_calloc_func)(THD*, size_t);
+ char *(*thd_strdup_func)(THD*, const char *);
+ char *(*thd_strmake_func)(THD*, const char *, size_t);
+ void *(*thd_memdup_func)(THD*, const void*, size_t);
+ MYSQL_CONST_LEX_STRING *(*thd_make_lex_string_func)(THD*,
MYSQL_CONST_LEX_STRING *,
const char *, size_t, int);
} *thd_alloc_service;
-void *thd_alloc(void* thd, size_t size);
-void *thd_calloc(void* thd, size_t size);
-char *thd_strdup(void* thd, const char *str);
-char *thd_strmake(void* thd, const char *str, size_t size);
-void *thd_memdup(void* thd, const void* str, size_t size);
+void *thd_alloc(THD* thd, size_t size);
+void *thd_calloc(THD* thd, size_t size);
+char *thd_strdup(THD* thd, const char *str);
+char *thd_strmake(THD* thd, const char *str, size_t size);
+void *thd_memdup(THD* thd, const void* str, size_t size);
MYSQL_CONST_LEX_STRING
-*thd_make_lex_string(void* thd, MYSQL_CONST_LEX_STRING *lex_str,
+*thd_make_lex_string(THD* thd, MYSQL_CONST_LEX_STRING *lex_str,
const char *str, size_t size,
int allocate_lex_string);
+}
+extern "C" {
extern struct thd_autoinc_service_st {
- void (*thd_get_autoinc_func)(const void* thd,
+ void (*thd_get_autoinc_func)(const THD* thd,
unsigned long* off, unsigned long* inc);
} *thd_autoinc_service;
-void thd_get_autoinc(const void* thd,
+void thd_get_autoinc(const THD* thd,
unsigned long* off, unsigned long* inc);
+}
+extern "C" {
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);
- unsigned long (*thd_get_error_row_func)(const void* thd);
- void (*thd_inc_error_row_func)(void* thd);
- char *(*thd_get_error_context_description_func)(void* thd,
+ const char *(*thd_get_error_message_func)(const THD* thd);
+ unsigned int (*thd_get_error_number_func)(const THD* thd);
+ unsigned long (*thd_get_error_row_func)(const THD* thd);
+ void (*thd_inc_error_row_func)(THD* thd);
+ char *(*thd_get_error_context_description_func)(THD* thd,
char *buffer,
unsigned int length,
unsigned int max_query_length);
} *thd_error_context_service;
-const char *thd_get_error_message(const void* thd);
-unsigned int thd_get_error_number(const void* thd);
-unsigned long thd_get_error_row(const void* thd);
-void thd_inc_error_row(void* thd);
-char *thd_get_error_context_description(void* thd,
+const char *thd_get_error_message(const THD* thd);
+unsigned int thd_get_error_number(const THD* thd);
+unsigned long thd_get_error_row(const THD* thd);
+void thd_inc_error_row(THD* thd);
+char *thd_get_error_context_description(THD* thd,
char *buffer, unsigned int length,
unsigned int max_query_length);
+}
+extern "C" {
extern struct thd_rnd_service_st {
- double (*thd_rnd_ptr)(void* thd);
- void (*thd_c_r_p_ptr)(void* thd, char *to, size_t length);
+ double (*thd_rnd_ptr)(THD* thd);
+ void (*thd_c_r_p_ptr)(THD* thd, char *to, size_t length);
} *thd_rnd_service;
-double thd_rnd(void* thd);
-void thd_create_random_password(void* thd, char *to, size_t length);
+double thd_rnd(THD* thd);
+void thd_create_random_password(THD* thd, char *to, size_t length);
+}
+extern "C" {
typedef int MYSQL_THD_KEY_T;
extern struct thd_specifics_service_st {
int (*thd_key_create_func)(MYSQL_THD_KEY_T *key);
void (*thd_key_delete_func)(MYSQL_THD_KEY_T *key);
- void *(*thd_getspecific_func)(void* thd, MYSQL_THD_KEY_T key);
- int (*thd_setspecific_func)(void* thd, MYSQL_THD_KEY_T key, void *value);
+ void *(*thd_getspecific_func)(THD* thd, MYSQL_THD_KEY_T key);
+ int (*thd_setspecific_func)(THD* thd, MYSQL_THD_KEY_T key, void *value);
} *thd_specifics_service;
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);
+void* thd_getspecific(THD* thd, MYSQL_THD_KEY_T key);
+int thd_setspecific(THD* thd, MYSQL_THD_KEY_T key, void *value);
+}
typedef long my_time_t;
enum enum_mysql_timestamp_type
{
@@ -348,12 +387,15 @@ typedef struct st_mysql_time
my_bool neg;
enum enum_mysql_timestamp_type time_type;
} MYSQL_TIME;
+extern "C" {
extern struct thd_timezone_service_st {
- 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);
+ my_time_t (*thd_TIME_to_gmt_sec)(THD* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
+ void (*thd_gmt_sec_to_TIME)(THD* thd, MYSQL_TIME *ltime, my_time_t t);
} *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);
+my_time_t thd_TIME_to_gmt_sec(THD* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
+void thd_gmt_sec_to_TIME(THD* thd, MYSQL_TIME *ltime, my_time_t t);
+}
+extern "C" {
typedef enum _thd_wait_type_e {
THD_WAIT_SLEEP= 1,
THD_WAIT_DISKIO= 2,
@@ -369,11 +411,13 @@ typedef enum _thd_wait_type_e {
THD_WAIT_LAST= 12
} thd_wait_type;
extern struct thd_wait_service_st {
- void (*thd_wait_begin_func)(void*, int);
- void (*thd_wait_end_func)(void*);
+ void (*thd_wait_begin_func)(THD*, int);
+ void (*thd_wait_end_func)(THD*);
} *thd_wait_service;
-void thd_wait_begin(void* thd, int wait_type);
-void thd_wait_end(void* thd);
+void thd_wait_begin(THD* thd, int wait_type);
+void thd_wait_end(THD* thd);
+}
+extern "C" {
enum json_types
{
JSV_BAD_JSON=-1,
@@ -419,6 +463,8 @@ int json_escape_string(const char *str,const char *str_end,
char *json, char *json_end);
int json_unescape_json(const char *json_str, const char *json_end,
char *res, char *res_end);
+}
+}
struct st_mysql_xid {
long formatID;
long gtrid_length;
@@ -432,7 +478,7 @@ enum enum_mysql_show_type
SHOW_ULONGLONG, SHOW_CHAR, SHOW_CHAR_PTR,
SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE,
SHOW_SINT, SHOW_SLONG, SHOW_SLONGLONG, SHOW_SIMPLE_FUNC,
- SHOW_always_last
+ SHOW_SIZE_T, SHOW_always_last
};
enum enum_var_type
{
@@ -444,13 +490,13 @@ struct st_mysql_show_var {
enum enum_mysql_show_type type;
};
struct system_status_var;
-typedef int (*mysql_show_var_func)(void*, struct st_mysql_show_var*, void *, struct system_status_var *status_var, enum enum_var_type);
+typedef int (*mysql_show_var_func)(THD*, struct st_mysql_show_var*, void *, struct system_status_var *status_var, enum enum_var_type);
struct st_mysql_sys_var;
struct st_mysql_value;
-typedef int (*mysql_var_check_func)(void* thd,
+typedef int (*mysql_var_check_func)(THD* thd,
struct st_mysql_sys_var *var,
void *save, struct st_mysql_value *value);
-typedef void (*mysql_var_update_func)(void* thd,
+typedef void (*mysql_var_update_func)(THD* thd,
struct st_mysql_sys_var *var,
void *var_ptr, const void *save);
struct st_mysql_plugin
@@ -485,6 +531,7 @@ struct st_maria_plugin
const char *version_info;
unsigned int maturity;
};
+extern "C" {
enum enum_ftparser_mode
{
MYSQL_FTPARSER_SIMPLE_MODE= 0,
@@ -531,6 +578,7 @@ struct st_mysql_ftparser
int (*init)(MYSQL_FTPARSER_PARAM *param);
int (*deinit)(MYSQL_FTPARSER_PARAM *param);
};
+}
struct st_mysql_daemon
{
int interface_version;
@@ -555,24 +603,25 @@ struct st_mysql_value
int (*val_int)(struct st_mysql_value *, long long *intbuf);
int (*is_unsigned)(struct st_mysql_value *);
};
-int thd_in_lock_tables(const void* thd);
-int thd_tablespace_op(const void* thd);
-long long thd_test_options(const void* thd, long long test_options);
-int thd_sql_command(const void* thd);
-void **thd_ha_data(const void* thd, const struct handlerton *hton);
-void thd_storage_lock_wait(void* thd, long long value);
-int thd_tx_isolation(const void* thd);
-int thd_tx_is_read_only(const void* thd);
+extern "C" {
+int thd_in_lock_tables(const THD* thd);
+int thd_tablespace_op(const THD* thd);
+long long thd_test_options(const THD* thd, long long test_options);
+int thd_sql_command(const THD* thd);
+void thd_storage_lock_wait(THD* thd, long long value);
+int thd_tx_isolation(const THD* thd);
+int thd_tx_is_read_only(const THD* thd);
int mysql_tmpfile(const char *prefix);
-unsigned long thd_get_thread_id(const void* thd);
-void thd_get_xid(const void* thd, MYSQL_XID *xid);
-void mysql_query_cache_invalidate4(void* thd,
+unsigned long thd_get_thread_id(const THD* thd);
+void thd_get_xid(const THD* thd, MYSQL_XID *xid);
+void mysql_query_cache_invalidate4(THD* thd,
const char *key, unsigned int key_length,
int using_trx);
-void *thd_get_ha_data(const void* thd, const struct handlerton *hton);
-void thd_set_ha_data(void* thd, const struct handlerton *hton,
+void *thd_get_ha_data(const THD* thd, const struct handlerton *hton);
+void thd_set_ha_data(THD* thd, const struct handlerton *hton,
const void *ha_data);
-void thd_wakeup_subsequent_commits(void* thd, int wakeup_error);
+void thd_wakeup_subsequent_commits(THD* thd, int wakeup_error);
+}
typedef struct st_plugin_vio_info
{
enum { MYSQL_VIO_INVALID, MYSQL_VIO_TCP, MYSQL_VIO_SOCKET,
@@ -588,6 +637,7 @@ typedef struct st_plugin_vio
int packet_len);
void (*info)(struct st_plugin_vio *vio, struct st_plugin_vio_info *info);
} MYSQL_PLUGIN_VIO;
+extern "C" {
typedef struct st_mysql_server_auth_info
{
const char *user_name;
@@ -599,7 +649,7 @@ typedef struct st_mysql_server_auth_info
int password_used;
const char *host_or_ip;
unsigned int host_or_ip_length;
- void* thd;
+ THD* thd;
} MYSQL_SERVER_AUTH_INFO;
struct st_mysql_auth
{
@@ -611,3 +661,4 @@ struct st_mysql_auth
int (*preprocess_hash)(const char *hash, size_t hash_length,
unsigned char *out, size_t *out_length);
};
+}
diff --git a/include/mysql/plugin_data_type.h b/include/mysql/plugin_data_type.h
new file mode 100644
index 00000000000..4f2235c6a38
--- /dev/null
+++ b/include/mysql/plugin_data_type.h
@@ -0,0 +1,49 @@
+#ifndef MARIADB_PLUGIN_DATA_TYPE_INCLUDED
+#define MARIADB_PLUGIN_DATA_TYPE_INCLUDED
+/* Copyright (C) 2019, Alexander Barkov and 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
+
+/**
+ @file
+
+ Data Type Plugin API.
+
+ This file defines the API for server plugins that manage data types.
+*/
+
+#ifdef __cplusplus
+
+#include <mysql/plugin.h>
+
+/*
+ API for data type plugins. (MariaDB_DATA_TYPE_PLUGIN)
+*/
+#define MariaDB_DATA_TYPE_INTERFACE_VERSION (MYSQL_VERSION_ID << 8)
+
+
+struct st_mariadb_data_type
+{
+ int interface_version;
+ const class Type_handler *type_handler;
+};
+
+
+/**
+ Data type plugin descriptor
+*/
+
+#endif /* __cplusplus */
+
+#endif /* MARIADB_PLUGIN_DATA_TYPE_INCLUDED */
diff --git a/include/mysql/plugin_data_type.h.pp b/include/mysql/plugin_data_type.h.pp
new file mode 100644
index 00000000000..a1a9c917efe
--- /dev/null
+++ b/include/mysql/plugin_data_type.h.pp
@@ -0,0 +1,629 @@
+class THD;
+class Item;
+typedef char my_bool;
+typedef void * MYSQL_PLUGIN;
+extern "C" {
+extern "C" {
+extern struct base64_service_st {
+ int (*base64_needed_encoded_length_ptr)(int length_of_data);
+ int (*base64_encode_max_arg_length_ptr)(void);
+ int (*base64_needed_decoded_length_ptr)(int length_of_encoded_data);
+ int (*base64_decode_max_arg_length_ptr)();
+ int (*base64_encode_ptr)(const void *src, size_t src_len, char *dst);
+ int (*base64_decode_ptr)(const char *src, size_t src_len,
+ void *dst, const char **end_ptr, int flags);
+} *base64_service;
+int my_base64_needed_encoded_length(int length_of_data);
+int my_base64_encode_max_arg_length(void);
+int my_base64_needed_decoded_length(int length_of_encoded_data);
+int my_base64_decode_max_arg_length();
+int my_base64_encode(const void *src, size_t src_len, char *dst);
+int my_base64_decode(const char *src, size_t src_len,
+ void *dst, const char **end_ptr, int flags);
+}
+extern "C" {
+extern void (*debug_sync_C_callback_ptr)(THD*, const char *, size_t);
+}
+extern "C" {
+struct encryption_service_st {
+ 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;
+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;
+}
+}
+extern "C" {
+struct st_encryption_scheme_key {
+ unsigned int version;
+ unsigned char key[16];
+};
+struct st_encryption_scheme {
+ unsigned char iv[16];
+ struct st_encryption_scheme_key key[3];
+ unsigned int keyserver_requests;
+ unsigned int key_id;
+ unsigned int type;
+ void (*locker)(struct st_encryption_scheme *self, int release);
+};
+extern struct encryption_scheme_service_st {
+ int (*encryption_scheme_encrypt_func)
+ (const unsigned char* src, unsigned int slen,
+ unsigned char* dst, unsigned int* dlen,
+ struct st_encryption_scheme *scheme,
+ unsigned int key_version, unsigned int i32_1,
+ unsigned int i32_2, unsigned long long i64);
+ int (*encryption_scheme_decrypt_func)
+ (const unsigned char* src, unsigned int slen,
+ unsigned char* dst, unsigned int* dlen,
+ struct st_encryption_scheme *scheme,
+ unsigned int key_version, unsigned int i32_1,
+ unsigned int i32_2, unsigned long long i64);
+} *encryption_scheme_service;
+int encryption_scheme_encrypt(const unsigned char* src, unsigned int slen,
+ unsigned char* dst, unsigned int* dlen,
+ struct st_encryption_scheme *scheme,
+ unsigned int key_version, unsigned int i32_1,
+ unsigned int i32_2, unsigned long long i64);
+int encryption_scheme_decrypt(const unsigned char* src, unsigned int slen,
+ unsigned char* dst, unsigned int* dlen,
+ struct st_encryption_scheme *scheme,
+ unsigned int key_version, unsigned int i32_1,
+ unsigned int i32_2, unsigned long long i64);
+}
+extern "C" {
+enum thd_kill_levels {
+ THD_IS_NOT_KILLED=0,
+ THD_ABORT_SOFTLY=50,
+ THD_ABORT_ASAP=100,
+};
+extern struct kill_statement_service_st {
+ enum thd_kill_levels (*thd_kill_level_func)(const THD*);
+} *thd_kill_statement_service;
+enum thd_kill_levels thd_kill_level(const THD*);
+}
+extern "C" {
+typedef struct logger_handle_st LOGGER_HANDLE;
+extern struct logger_service_st {
+ void (*logger_init_mutexes)();
+ LOGGER_HANDLE* (*open)(const char *path,
+ unsigned long long size_limit,
+ unsigned int rotations);
+ int (*close)(LOGGER_HANDLE *log);
+ int (*vprintf)(LOGGER_HANDLE *log, const char *fmt, va_list argptr);
+ int (*printf)(LOGGER_HANDLE *log, const char *fmt, ...);
+ int (*write)(LOGGER_HANDLE *log, const char *buffer, size_t size);
+ int (*rotate)(LOGGER_HANDLE *log);
+} *logger_service;
+ void logger_init_mutexes();
+ LOGGER_HANDLE *logger_open(const char *path,
+ unsigned long long size_limit,
+ unsigned int rotations);
+ int logger_close(LOGGER_HANDLE *log);
+ int logger_vprintf(LOGGER_HANDLE *log, const char *fmt, va_list argptr);
+ 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);
+}
+extern "C" {
+extern struct my_md5_service_st {
+ void (*my_md5_type)(unsigned char*, const char*, size_t);
+ void (*my_md5_multi_type)(unsigned char*, ...);
+ size_t (*my_md5_context_size_type)();
+ void (*my_md5_init_type)(void *);
+ void (*my_md5_input_type)(void *, const unsigned char *, size_t);
+ void (*my_md5_result_type)(void *, unsigned char *);
+} *my_md5_service;
+void my_md5(unsigned char*, const char*, size_t);
+void my_md5_multi(unsigned char*, ...);
+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);
+}
+extern "C" {
+enum my_aes_mode {
+ MY_AES_ECB, MY_AES_CBC
+};
+extern struct my_crypt_service_st {
+ 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 unsigned char *src, unsigned int slen,
+ unsigned char *dst, unsigned int *dlen);
+ int (*my_aes_crypt_finish)(void *ctx, unsigned char *dst, unsigned int *dlen);
+ int (*my_aes_crypt)(enum my_aes_mode mode, int flags,
+ 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);
+ unsigned int (*my_aes_get_size)(enum my_aes_mode mode, unsigned int source_length);
+ unsigned int (*my_aes_ctx_size)(enum my_aes_mode mode);
+ int (*my_random_bytes)(unsigned char* buf, int num);
+} *my_crypt_service;
+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 unsigned char *src, unsigned int slen,
+ unsigned char *dst, unsigned int *dlen);
+int my_aes_crypt_finish(void *ctx, unsigned char *dst, unsigned int *dlen);
+int my_aes_crypt(enum my_aes_mode mode, int flags,
+ 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 my_random_bytes(unsigned char* buf, int num);
+unsigned int my_aes_get_size(enum my_aes_mode mode, unsigned int source_length);
+unsigned int my_aes_ctx_size(enum my_aes_mode mode);
+}
+extern "C" {
+extern struct my_print_error_service_st {
+ void (*my_error_func)(unsigned int nr, unsigned long MyFlags, ...);
+ void (*my_printf_error_func)(unsigned int nr, const char *fmt, unsigned long MyFlags,...);
+ void (*my_printv_error_func)(unsigned int error, const char *format, unsigned long MyFlags, va_list ap);
+} *my_print_error_service;
+extern void my_error(unsigned int nr, unsigned long MyFlags, ...);
+extern void my_printf_error(unsigned int my_err, const char *format, unsigned long MyFlags, ...);
+extern void my_printv_error(unsigned int error, const char *format, unsigned long MyFlags,va_list ap);
+}
+extern "C" {
+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);
+}
+extern "C" {
+extern struct progress_report_service_st {
+ void (*thd_progress_init_func)(THD* thd, unsigned int max_stage);
+ void (*thd_progress_report_func)(THD* thd,
+ unsigned long long progress,
+ unsigned long long max_progress);
+ void (*thd_progress_next_stage_func)(THD* thd);
+ void (*thd_progress_end_func)(THD* thd);
+ const char *(*set_thd_proc_info_func)(THD*, const char *info,
+ const char *func,
+ const char *file,
+ unsigned int line);
+} *progress_report_service;
+void thd_progress_init(THD* thd, unsigned int max_stage);
+void thd_progress_report(THD* thd,
+ unsigned long long progress,
+ unsigned long long max_progress);
+void thd_progress_next_stage(THD* thd);
+void thd_progress_end(THD* thd);
+const char *set_thd_proc_info(THD*, const char * info, const char *func,
+ const char *file, unsigned int line);
+}
+extern "C" {
+extern struct my_sha1_service_st {
+ void (*my_sha1_type)(unsigned char*, const char*, size_t);
+ void (*my_sha1_multi_type)(unsigned char*, ...);
+ size_t (*my_sha1_context_size_type)();
+ void (*my_sha1_init_type)(void *);
+ void (*my_sha1_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha1_result_type)(void *, unsigned char *);
+} *my_sha1_service;
+void my_sha1(unsigned char*, const char*, size_t);
+void my_sha1_multi(unsigned char*, ...);
+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);
+}
+extern "C" {
+extern struct my_sha2_service_st {
+ void (*my_sha224_type)(unsigned char*, const char*, size_t);
+ void (*my_sha224_multi_type)(unsigned char*, ...);
+ size_t (*my_sha224_context_size_type)();
+ void (*my_sha224_init_type)(void *);
+ void (*my_sha224_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha224_result_type)(void *, unsigned char *);
+ void (*my_sha256_type)(unsigned char*, const char*, size_t);
+ void (*my_sha256_multi_type)(unsigned char*, ...);
+ size_t (*my_sha256_context_size_type)();
+ void (*my_sha256_init_type)(void *);
+ void (*my_sha256_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha256_result_type)(void *, unsigned char *);
+ void (*my_sha384_type)(unsigned char*, const char*, size_t);
+ void (*my_sha384_multi_type)(unsigned char*, ...);
+ size_t (*my_sha384_context_size_type)();
+ void (*my_sha384_init_type)(void *);
+ void (*my_sha384_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha384_result_type)(void *, unsigned char *);
+ void (*my_sha512_type)(unsigned char*, const char*, size_t);
+ void (*my_sha512_multi_type)(unsigned char*, ...);
+ size_t (*my_sha512_context_size_type)();
+ void (*my_sha512_init_type)(void *);
+ void (*my_sha512_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha512_result_type)(void *, unsigned char *);
+} *my_sha2_service;
+void my_sha224(unsigned char*, const char*, size_t);
+void my_sha224_multi(unsigned char*, ...);
+size_t my_sha224_context_size();
+void my_sha224_init(void *context);
+void my_sha224_input(void *context, const unsigned char *buf, size_t len);
+void my_sha224_result(void *context, unsigned char *digest);
+void my_sha256(unsigned char*, const char*, size_t);
+void my_sha256_multi(unsigned char*, ...);
+size_t my_sha256_context_size();
+void my_sha256_init(void *context);
+void my_sha256_input(void *context, const unsigned char *buf, size_t len);
+void my_sha256_result(void *context, unsigned char *digest);
+void my_sha384(unsigned char*, const char*, size_t);
+void my_sha384_multi(unsigned char*, ...);
+size_t my_sha384_context_size();
+void my_sha384_init(void *context);
+void my_sha384_input(void *context, const unsigned char *buf, size_t len);
+void my_sha384_result(void *context, unsigned char *digest);
+void my_sha512(unsigned char*, const char*, size_t);
+void my_sha512_multi(unsigned char*, ...);
+size_t my_sha512_context_size();
+void my_sha512_init(void *context);
+void my_sha512_input(void *context, const unsigned char *buf, size_t len);
+void my_sha512_result(void *context, unsigned char *digest);
+}
+extern "C" {
+struct st_mysql_lex_string
+{
+ char *str;
+ size_t length;
+};
+typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
+struct st_mysql_const_lex_string
+{
+ const char *str;
+ size_t length;
+};
+typedef struct st_mysql_const_lex_string MYSQL_CONST_LEX_STRING;
+extern struct thd_alloc_service_st {
+ void *(*thd_alloc_func)(THD*, size_t);
+ void *(*thd_calloc_func)(THD*, size_t);
+ char *(*thd_strdup_func)(THD*, const char *);
+ char *(*thd_strmake_func)(THD*, const char *, size_t);
+ void *(*thd_memdup_func)(THD*, const void*, size_t);
+ MYSQL_CONST_LEX_STRING *(*thd_make_lex_string_func)(THD*,
+ MYSQL_CONST_LEX_STRING *,
+ const char *, size_t, int);
+} *thd_alloc_service;
+void *thd_alloc(THD* thd, size_t size);
+void *thd_calloc(THD* thd, size_t size);
+char *thd_strdup(THD* thd, const char *str);
+char *thd_strmake(THD* thd, const char *str, size_t size);
+void *thd_memdup(THD* thd, const void* str, size_t size);
+MYSQL_CONST_LEX_STRING
+*thd_make_lex_string(THD* thd, MYSQL_CONST_LEX_STRING *lex_str,
+ const char *str, size_t size,
+ int allocate_lex_string);
+}
+extern "C" {
+extern struct thd_autoinc_service_st {
+ void (*thd_get_autoinc_func)(const THD* thd,
+ unsigned long* off, unsigned long* inc);
+} *thd_autoinc_service;
+void thd_get_autoinc(const THD* thd,
+ unsigned long* off, unsigned long* inc);
+}
+extern "C" {
+extern struct thd_error_context_service_st {
+ const char *(*thd_get_error_message_func)(const THD* thd);
+ unsigned int (*thd_get_error_number_func)(const THD* thd);
+ unsigned long (*thd_get_error_row_func)(const THD* thd);
+ void (*thd_inc_error_row_func)(THD* thd);
+ char *(*thd_get_error_context_description_func)(THD* thd,
+ char *buffer,
+ unsigned int length,
+ unsigned int max_query_length);
+} *thd_error_context_service;
+const char *thd_get_error_message(const THD* thd);
+unsigned int thd_get_error_number(const THD* thd);
+unsigned long thd_get_error_row(const THD* thd);
+void thd_inc_error_row(THD* thd);
+char *thd_get_error_context_description(THD* thd,
+ char *buffer, unsigned int length,
+ unsigned int max_query_length);
+}
+extern "C" {
+extern struct thd_rnd_service_st {
+ double (*thd_rnd_ptr)(THD* thd);
+ void (*thd_c_r_p_ptr)(THD* thd, char *to, size_t length);
+} *thd_rnd_service;
+double thd_rnd(THD* thd);
+void thd_create_random_password(THD* thd, char *to, size_t length);
+}
+extern "C" {
+typedef int MYSQL_THD_KEY_T;
+extern struct thd_specifics_service_st {
+ int (*thd_key_create_func)(MYSQL_THD_KEY_T *key);
+ void (*thd_key_delete_func)(MYSQL_THD_KEY_T *key);
+ void *(*thd_getspecific_func)(THD* thd, MYSQL_THD_KEY_T key);
+ int (*thd_setspecific_func)(THD* thd, MYSQL_THD_KEY_T key, void *value);
+} *thd_specifics_service;
+int thd_key_create(MYSQL_THD_KEY_T *key);
+void thd_key_delete(MYSQL_THD_KEY_T *key);
+void* thd_getspecific(THD* thd, MYSQL_THD_KEY_T key);
+int thd_setspecific(THD* thd, MYSQL_THD_KEY_T key, void *value);
+}
+typedef long my_time_t;
+enum enum_mysql_timestamp_type
+{
+ MYSQL_TIMESTAMP_NONE= -2, MYSQL_TIMESTAMP_ERROR= -1,
+ MYSQL_TIMESTAMP_DATE= 0, MYSQL_TIMESTAMP_DATETIME= 1, MYSQL_TIMESTAMP_TIME= 2
+};
+typedef struct st_mysql_time
+{
+ unsigned int year, month, day, hour, minute, second;
+ unsigned long second_part;
+ my_bool neg;
+ enum enum_mysql_timestamp_type time_type;
+} MYSQL_TIME;
+extern "C" {
+extern struct thd_timezone_service_st {
+ my_time_t (*thd_TIME_to_gmt_sec)(THD* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
+ void (*thd_gmt_sec_to_TIME)(THD* thd, MYSQL_TIME *ltime, my_time_t t);
+} *thd_timezone_service;
+my_time_t thd_TIME_to_gmt_sec(THD* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
+void thd_gmt_sec_to_TIME(THD* thd, MYSQL_TIME *ltime, my_time_t t);
+}
+extern "C" {
+typedef enum _thd_wait_type_e {
+ THD_WAIT_SLEEP= 1,
+ THD_WAIT_DISKIO= 2,
+ THD_WAIT_ROW_LOCK= 3,
+ THD_WAIT_GLOBAL_LOCK= 4,
+ THD_WAIT_META_DATA_LOCK= 5,
+ THD_WAIT_TABLE_LOCK= 6,
+ THD_WAIT_USER_LOCK= 7,
+ THD_WAIT_BINLOG= 8,
+ THD_WAIT_GROUP_COMMIT= 9,
+ THD_WAIT_SYNC= 10,
+ THD_WAIT_NET= 11,
+ THD_WAIT_LAST= 12
+} thd_wait_type;
+extern struct thd_wait_service_st {
+ void (*thd_wait_begin_func)(THD*, int);
+ void (*thd_wait_end_func)(THD*);
+} *thd_wait_service;
+void thd_wait_begin(THD* thd, int wait_type);
+void thd_wait_end(THD* thd);
+}
+extern "C" {
+enum json_types
+{
+ JSV_BAD_JSON=-1,
+ JSV_NOTHING=0,
+ JSV_OBJECT=1,
+ JSV_ARRAY=2,
+ JSV_STRING=3,
+ JSV_NUMBER=4,
+ JSV_TRUE=5,
+ JSV_FALSE=6,
+ JSV_NULL=7
+};
+extern struct json_service_st {
+ enum json_types (*json_type)(const char *js, const char *js_end,
+ const char **value, int *value_len);
+ enum json_types (*json_get_array_item)(const char *js, const char *js_end,
+ int n_item,
+ const char **value, int *value_len);
+ enum json_types (*json_get_object_key)(const char *js, const char *js_end,
+ const char *key,
+ const char **value, int *value_len);
+ enum json_types (*json_get_object_nkey)(const char *js,const char *js_end,
+ int nkey,
+ const char **keyname, const char **keyname_end,
+ const char **value, int *value_len);
+ int (*json_escape_string)(const char *str,const char *str_end,
+ char *json, char *json_end);
+ int (*json_unescape_json)(const char *json_str, const char *json_end,
+ char *res, char *res_end);
+} *json_service;
+enum json_types json_type(const char *js, const char *js_end,
+ const char **value, int *value_len);
+enum json_types json_get_array_item(const char *js, const char *js_end,
+ int n_item,
+ const char **value, int *value_len);
+enum json_types json_get_object_key(const char *js, const char *js_end,
+ const char *key,
+ const char **value, int *value_len);
+enum json_types json_get_object_nkey(const char *js,const char *js_end, int nkey,
+ const char **keyname, const char **keyname_end,
+ const char **value, int *value_len);
+int json_escape_string(const char *str,const char *str_end,
+ char *json, char *json_end);
+int json_unescape_json(const char *json_str, const char *json_end,
+ char *res, char *res_end);
+}
+}
+struct st_mysql_xid {
+ long formatID;
+ long gtrid_length;
+ long bqual_length;
+ char data[128];
+};
+typedef struct st_mysql_xid MYSQL_XID;
+enum enum_mysql_show_type
+{
+ SHOW_UNDEF, SHOW_BOOL, SHOW_UINT, SHOW_ULONG,
+ SHOW_ULONGLONG, SHOW_CHAR, SHOW_CHAR_PTR,
+ SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE,
+ SHOW_SINT, SHOW_SLONG, SHOW_SLONGLONG, SHOW_SIMPLE_FUNC,
+ SHOW_SIZE_T, SHOW_always_last
+};
+enum enum_var_type
+{
+ SHOW_OPT_DEFAULT= 0, SHOW_OPT_SESSION, SHOW_OPT_GLOBAL
+};
+struct st_mysql_show_var {
+ const char *name;
+ void *value;
+ enum enum_mysql_show_type type;
+};
+struct system_status_var;
+typedef int (*mysql_show_var_func)(THD*, struct st_mysql_show_var*, void *, struct system_status_var *status_var, enum enum_var_type);
+struct st_mysql_sys_var;
+struct st_mysql_value;
+typedef int (*mysql_var_check_func)(THD* thd,
+ struct st_mysql_sys_var *var,
+ void *save, struct st_mysql_value *value);
+typedef void (*mysql_var_update_func)(THD* thd,
+ struct st_mysql_sys_var *var,
+ void *var_ptr, const void *save);
+struct st_mysql_plugin
+{
+ int type;
+ void *info;
+ const char *name;
+ const char *author;
+ const char *descr;
+ int license;
+ int (*init)(void *);
+ int (*deinit)(void *);
+ unsigned int version;
+ struct st_mysql_show_var *status_vars;
+ struct st_mysql_sys_var **system_vars;
+ void * __reserved1;
+ unsigned long flags;
+};
+struct st_maria_plugin
+{
+ int type;
+ void *info;
+ const char *name;
+ const char *author;
+ const char *descr;
+ int license;
+ int (*init)(void *);
+ int (*deinit)(void *);
+ unsigned int version;
+ struct st_mysql_show_var *status_vars;
+ struct st_mysql_sys_var **system_vars;
+ const char *version_info;
+ unsigned int maturity;
+};
+extern "C" {
+enum enum_ftparser_mode
+{
+ MYSQL_FTPARSER_SIMPLE_MODE= 0,
+ MYSQL_FTPARSER_WITH_STOPWORDS= 1,
+ MYSQL_FTPARSER_FULL_BOOLEAN_INFO= 2
+};
+enum enum_ft_token_type
+{
+ FT_TOKEN_EOF= 0,
+ FT_TOKEN_WORD= 1,
+ FT_TOKEN_LEFT_PAREN= 2,
+ FT_TOKEN_RIGHT_PAREN= 3,
+ FT_TOKEN_STOPWORD= 4
+};
+typedef struct st_mysql_ftparser_boolean_info
+{
+ enum enum_ft_token_type type;
+ int yesno;
+ int weight_adjust;
+ char wasign;
+ char trunc;
+ char prev;
+ char *quot;
+} MYSQL_FTPARSER_BOOLEAN_INFO;
+typedef struct st_mysql_ftparser_param
+{
+ int (*mysql_parse)(struct st_mysql_ftparser_param *,
+ const char *doc, int doc_len);
+ int (*mysql_add_word)(struct st_mysql_ftparser_param *,
+ const char *word, int word_len,
+ MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info);
+ void *ftparser_state;
+ void *mysql_ftparam;
+ const struct charset_info_st *cs;
+ const char *doc;
+ int length;
+ unsigned int flags;
+ enum enum_ftparser_mode mode;
+} MYSQL_FTPARSER_PARAM;
+struct st_mysql_ftparser
+{
+ int interface_version;
+ int (*parse)(MYSQL_FTPARSER_PARAM *param);
+ int (*init)(MYSQL_FTPARSER_PARAM *param);
+ int (*deinit)(MYSQL_FTPARSER_PARAM *param);
+};
+}
+struct st_mysql_daemon
+{
+ int interface_version;
+};
+struct st_mysql_information_schema
+{
+ int interface_version;
+};
+struct st_mysql_storage_engine
+{
+ int interface_version;
+};
+struct handlerton;
+ struct Mysql_replication {
+ int interface_version;
+ };
+struct st_mysql_value
+{
+ int (*value_type)(struct st_mysql_value *);
+ const char *(*val_str)(struct st_mysql_value *, char *buffer, int *length);
+ int (*val_real)(struct st_mysql_value *, double *realbuf);
+ int (*val_int)(struct st_mysql_value *, long long *intbuf);
+ int (*is_unsigned)(struct st_mysql_value *);
+};
+extern "C" {
+int thd_in_lock_tables(const THD* thd);
+int thd_tablespace_op(const THD* thd);
+long long thd_test_options(const THD* thd, long long test_options);
+int thd_sql_command(const THD* thd);
+void thd_storage_lock_wait(THD* thd, long long value);
+int thd_tx_isolation(const THD* thd);
+int thd_tx_is_read_only(const THD* thd);
+int mysql_tmpfile(const char *prefix);
+unsigned long thd_get_thread_id(const THD* thd);
+void thd_get_xid(const THD* thd, MYSQL_XID *xid);
+void mysql_query_cache_invalidate4(THD* thd,
+ const char *key, unsigned int key_length,
+ int using_trx);
+void *thd_get_ha_data(const THD* thd, const struct handlerton *hton);
+void thd_set_ha_data(THD* thd, const struct handlerton *hton,
+ const void *ha_data);
+void thd_wakeup_subsequent_commits(THD* thd, int wakeup_error);
+}
+struct st_mariadb_data_type
+{
+ int interface_version;
+ const class Type_handler *type_handler;
+};
diff --git a/include/mysql/plugin_encryption.h.pp b/include/mysql/plugin_encryption.h.pp
index 6597decfbef..ff436bb24c4 100644
--- a/include/mysql/plugin_encryption.h.pp
+++ b/include/mysql/plugin_encryption.h.pp
@@ -1,5 +1,9 @@
+class THD;
+class Item;
typedef char my_bool;
typedef void * MYSQL_PLUGIN;
+extern "C" {
+extern "C" {
extern struct base64_service_st {
int (*base64_needed_encoded_length_ptr)(int length_of_data);
int (*base64_encode_max_arg_length_ptr)(void);
@@ -16,7 +20,11 @@ int my_base64_decode_max_arg_length();
int my_base64_encode(const void *src, size_t src_len, char *dst);
int my_base64_decode(const char *src, size_t src_len,
void *dst, const char **end_ptr, int flags);
-extern void (*debug_sync_C_callback_ptr)(void*, const char *, size_t);
+}
+extern "C" {
+extern void (*debug_sync_C_callback_ptr)(THD*, const char *, size_t);
+}
+extern "C" {
struct encryption_service_st {
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,
@@ -57,6 +65,8 @@ static inline int encryption_crypt(const unsigned char* src, unsigned int slen,
*dlen= d1 + d2;
return res1 ? res1 : res2;
}
+}
+extern "C" {
struct st_encryption_scheme_key {
unsigned int version;
unsigned char key[16];
@@ -93,15 +103,19 @@ int encryption_scheme_decrypt(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);
+}
+extern "C" {
enum thd_kill_levels {
THD_IS_NOT_KILLED=0,
THD_ABORT_SOFTLY=50,
THD_ABORT_ASAP=100,
};
extern struct kill_statement_service_st {
- enum thd_kill_levels (*thd_kill_level_func)(const void*);
+ enum thd_kill_levels (*thd_kill_level_func)(const THD*);
} *thd_kill_statement_service;
-enum thd_kill_levels thd_kill_level(const void*);
+enum thd_kill_levels thd_kill_level(const THD*);
+}
+extern "C" {
typedef struct logger_handle_st LOGGER_HANDLE;
extern struct logger_service_st {
void (*logger_init_mutexes)();
@@ -123,6 +137,8 @@ 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);
+}
+extern "C" {
extern struct my_md5_service_st {
void (*my_md5_type)(unsigned char*, const char*, size_t);
void (*my_md5_multi_type)(unsigned char*, ...);
@@ -137,6 +153,8 @@ 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);
+}
+extern "C" {
enum my_aes_mode {
MY_AES_ECB, MY_AES_CBC
};
@@ -166,6 +184,8 @@ int my_aes_crypt(enum my_aes_mode mode, int flags,
int my_random_bytes(unsigned char* buf, int num);
unsigned int my_aes_get_size(enum my_aes_mode mode, unsigned int source_length);
unsigned int my_aes_ctx_size(enum my_aes_mode mode);
+}
+extern "C" {
extern struct my_print_error_service_st {
void (*my_error_func)(unsigned int nr, unsigned long MyFlags, ...);
void (*my_printf_error_func)(unsigned int nr, const char *fmt, unsigned long MyFlags,...);
@@ -174,32 +194,38 @@ extern struct my_print_error_service_st {
extern void my_error(unsigned int nr, unsigned long MyFlags, ...);
extern void my_printf_error(unsigned int my_err, const char *format, unsigned long MyFlags, ...);
extern void my_printv_error(unsigned int error, const char *format, unsigned long MyFlags,va_list ap);
+}
+extern "C" {
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);
+}
+extern "C" {
extern struct progress_report_service_st {
- void (*thd_progress_init_func)(void* thd, unsigned int max_stage);
- void (*thd_progress_report_func)(void* thd,
+ void (*thd_progress_init_func)(THD* thd, unsigned int max_stage);
+ void (*thd_progress_report_func)(THD* thd,
unsigned long long progress,
unsigned long long max_progress);
- void (*thd_progress_next_stage_func)(void* thd);
- void (*thd_progress_end_func)(void* thd);
- const char *(*set_thd_proc_info_func)(void*, const char *info,
+ void (*thd_progress_next_stage_func)(THD* thd);
+ void (*thd_progress_end_func)(THD* thd);
+ const char *(*set_thd_proc_info_func)(THD*, const char *info,
const char *func,
const char *file,
unsigned int line);
} *progress_report_service;
-void thd_progress_init(void* thd, unsigned int max_stage);
-void thd_progress_report(void* thd,
+void thd_progress_init(THD* thd, unsigned int max_stage);
+void thd_progress_report(THD* thd,
unsigned long long progress,
unsigned long long max_progress);
-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,
+void thd_progress_next_stage(THD* thd);
+void thd_progress_end(THD* thd);
+const char *set_thd_proc_info(THD*, const char * info, const char *func,
const char *file, unsigned int line);
+}
+extern "C" {
extern struct my_sha1_service_st {
void (*my_sha1_type)(unsigned char*, const char*, size_t);
void (*my_sha1_multi_type)(unsigned char*, ...);
@@ -214,6 +240,8 @@ 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);
+}
+extern "C" {
extern struct my_sha2_service_st {
void (*my_sha224_type)(unsigned char*, const char*, size_t);
void (*my_sha224_multi_type)(unsigned char*, ...);
@@ -264,6 +292,8 @@ size_t my_sha512_context_size();
void my_sha512_init(void *context);
void my_sha512_input(void *context, const unsigned char *buf, size_t len);
void my_sha512_result(void *context, unsigned char *digest);
+}
+extern "C" {
struct st_mysql_lex_string
{
char *str;
@@ -277,64 +307,73 @@ struct st_mysql_const_lex_string
};
typedef struct st_mysql_const_lex_string MYSQL_CONST_LEX_STRING;
extern struct thd_alloc_service_st {
- void *(*thd_alloc_func)(void*, size_t);
- void *(*thd_calloc_func)(void*, size_t);
- char *(*thd_strdup_func)(void*, const char *);
- char *(*thd_strmake_func)(void*, const char *, size_t);
- void *(*thd_memdup_func)(void*, const void*, size_t);
- MYSQL_CONST_LEX_STRING *(*thd_make_lex_string_func)(void*,
+ void *(*thd_alloc_func)(THD*, size_t);
+ void *(*thd_calloc_func)(THD*, size_t);
+ char *(*thd_strdup_func)(THD*, const char *);
+ char *(*thd_strmake_func)(THD*, const char *, size_t);
+ void *(*thd_memdup_func)(THD*, const void*, size_t);
+ MYSQL_CONST_LEX_STRING *(*thd_make_lex_string_func)(THD*,
MYSQL_CONST_LEX_STRING *,
const char *, size_t, int);
} *thd_alloc_service;
-void *thd_alloc(void* thd, size_t size);
-void *thd_calloc(void* thd, size_t size);
-char *thd_strdup(void* thd, const char *str);
-char *thd_strmake(void* thd, const char *str, size_t size);
-void *thd_memdup(void* thd, const void* str, size_t size);
+void *thd_alloc(THD* thd, size_t size);
+void *thd_calloc(THD* thd, size_t size);
+char *thd_strdup(THD* thd, const char *str);
+char *thd_strmake(THD* thd, const char *str, size_t size);
+void *thd_memdup(THD* thd, const void* str, size_t size);
MYSQL_CONST_LEX_STRING
-*thd_make_lex_string(void* thd, MYSQL_CONST_LEX_STRING *lex_str,
+*thd_make_lex_string(THD* thd, MYSQL_CONST_LEX_STRING *lex_str,
const char *str, size_t size,
int allocate_lex_string);
+}
+extern "C" {
extern struct thd_autoinc_service_st {
- void (*thd_get_autoinc_func)(const void* thd,
+ void (*thd_get_autoinc_func)(const THD* thd,
unsigned long* off, unsigned long* inc);
} *thd_autoinc_service;
-void thd_get_autoinc(const void* thd,
+void thd_get_autoinc(const THD* thd,
unsigned long* off, unsigned long* inc);
+}
+extern "C" {
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);
- unsigned long (*thd_get_error_row_func)(const void* thd);
- void (*thd_inc_error_row_func)(void* thd);
- char *(*thd_get_error_context_description_func)(void* thd,
+ const char *(*thd_get_error_message_func)(const THD* thd);
+ unsigned int (*thd_get_error_number_func)(const THD* thd);
+ unsigned long (*thd_get_error_row_func)(const THD* thd);
+ void (*thd_inc_error_row_func)(THD* thd);
+ char *(*thd_get_error_context_description_func)(THD* thd,
char *buffer,
unsigned int length,
unsigned int max_query_length);
} *thd_error_context_service;
-const char *thd_get_error_message(const void* thd);
-unsigned int thd_get_error_number(const void* thd);
-unsigned long thd_get_error_row(const void* thd);
-void thd_inc_error_row(void* thd);
-char *thd_get_error_context_description(void* thd,
+const char *thd_get_error_message(const THD* thd);
+unsigned int thd_get_error_number(const THD* thd);
+unsigned long thd_get_error_row(const THD* thd);
+void thd_inc_error_row(THD* thd);
+char *thd_get_error_context_description(THD* thd,
char *buffer, unsigned int length,
unsigned int max_query_length);
+}
+extern "C" {
extern struct thd_rnd_service_st {
- double (*thd_rnd_ptr)(void* thd);
- void (*thd_c_r_p_ptr)(void* thd, char *to, size_t length);
+ double (*thd_rnd_ptr)(THD* thd);
+ void (*thd_c_r_p_ptr)(THD* thd, char *to, size_t length);
} *thd_rnd_service;
-double thd_rnd(void* thd);
-void thd_create_random_password(void* thd, char *to, size_t length);
+double thd_rnd(THD* thd);
+void thd_create_random_password(THD* thd, char *to, size_t length);
+}
+extern "C" {
typedef int MYSQL_THD_KEY_T;
extern struct thd_specifics_service_st {
int (*thd_key_create_func)(MYSQL_THD_KEY_T *key);
void (*thd_key_delete_func)(MYSQL_THD_KEY_T *key);
- void *(*thd_getspecific_func)(void* thd, MYSQL_THD_KEY_T key);
- int (*thd_setspecific_func)(void* thd, MYSQL_THD_KEY_T key, void *value);
+ void *(*thd_getspecific_func)(THD* thd, MYSQL_THD_KEY_T key);
+ int (*thd_setspecific_func)(THD* thd, MYSQL_THD_KEY_T key, void *value);
} *thd_specifics_service;
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);
+void* thd_getspecific(THD* thd, MYSQL_THD_KEY_T key);
+int thd_setspecific(THD* thd, MYSQL_THD_KEY_T key, void *value);
+}
typedef long my_time_t;
enum enum_mysql_timestamp_type
{
@@ -348,12 +387,15 @@ typedef struct st_mysql_time
my_bool neg;
enum enum_mysql_timestamp_type time_type;
} MYSQL_TIME;
+extern "C" {
extern struct thd_timezone_service_st {
- 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);
+ my_time_t (*thd_TIME_to_gmt_sec)(THD* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
+ void (*thd_gmt_sec_to_TIME)(THD* thd, MYSQL_TIME *ltime, my_time_t t);
} *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);
+my_time_t thd_TIME_to_gmt_sec(THD* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
+void thd_gmt_sec_to_TIME(THD* thd, MYSQL_TIME *ltime, my_time_t t);
+}
+extern "C" {
typedef enum _thd_wait_type_e {
THD_WAIT_SLEEP= 1,
THD_WAIT_DISKIO= 2,
@@ -369,11 +411,13 @@ typedef enum _thd_wait_type_e {
THD_WAIT_LAST= 12
} thd_wait_type;
extern struct thd_wait_service_st {
- void (*thd_wait_begin_func)(void*, int);
- void (*thd_wait_end_func)(void*);
+ void (*thd_wait_begin_func)(THD*, int);
+ void (*thd_wait_end_func)(THD*);
} *thd_wait_service;
-void thd_wait_begin(void* thd, int wait_type);
-void thd_wait_end(void* thd);
+void thd_wait_begin(THD* thd, int wait_type);
+void thd_wait_end(THD* thd);
+}
+extern "C" {
enum json_types
{
JSV_BAD_JSON=-1,
@@ -419,6 +463,8 @@ int json_escape_string(const char *str,const char *str_end,
char *json, char *json_end);
int json_unescape_json(const char *json_str, const char *json_end,
char *res, char *res_end);
+}
+}
struct st_mysql_xid {
long formatID;
long gtrid_length;
@@ -432,7 +478,7 @@ enum enum_mysql_show_type
SHOW_ULONGLONG, SHOW_CHAR, SHOW_CHAR_PTR,
SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE,
SHOW_SINT, SHOW_SLONG, SHOW_SLONGLONG, SHOW_SIMPLE_FUNC,
- SHOW_always_last
+ SHOW_SIZE_T, SHOW_always_last
};
enum enum_var_type
{
@@ -444,13 +490,13 @@ struct st_mysql_show_var {
enum enum_mysql_show_type type;
};
struct system_status_var;
-typedef int (*mysql_show_var_func)(void*, struct st_mysql_show_var*, void *, struct system_status_var *status_var, enum enum_var_type);
+typedef int (*mysql_show_var_func)(THD*, struct st_mysql_show_var*, void *, struct system_status_var *status_var, enum enum_var_type);
struct st_mysql_sys_var;
struct st_mysql_value;
-typedef int (*mysql_var_check_func)(void* thd,
+typedef int (*mysql_var_check_func)(THD* thd,
struct st_mysql_sys_var *var,
void *save, struct st_mysql_value *value);
-typedef void (*mysql_var_update_func)(void* thd,
+typedef void (*mysql_var_update_func)(THD* thd,
struct st_mysql_sys_var *var,
void *var_ptr, const void *save);
struct st_mysql_plugin
@@ -485,6 +531,7 @@ struct st_maria_plugin
const char *version_info;
unsigned int maturity;
};
+extern "C" {
enum enum_ftparser_mode
{
MYSQL_FTPARSER_SIMPLE_MODE= 0,
@@ -531,6 +578,7 @@ struct st_mysql_ftparser
int (*init)(MYSQL_FTPARSER_PARAM *param);
int (*deinit)(MYSQL_FTPARSER_PARAM *param);
};
+}
struct st_mysql_daemon
{
int interface_version;
@@ -555,24 +603,26 @@ struct st_mysql_value
int (*val_int)(struct st_mysql_value *, long long *intbuf);
int (*is_unsigned)(struct st_mysql_value *);
};
-int thd_in_lock_tables(const void* thd);
-int thd_tablespace_op(const void* thd);
-long long thd_test_options(const void* thd, long long test_options);
-int thd_sql_command(const void* thd);
-void **thd_ha_data(const void* thd, const struct handlerton *hton);
-void thd_storage_lock_wait(void* thd, long long value);
-int thd_tx_isolation(const void* thd);
-int thd_tx_is_read_only(const void* thd);
+extern "C" {
+int thd_in_lock_tables(const THD* thd);
+int thd_tablespace_op(const THD* thd);
+long long thd_test_options(const THD* thd, long long test_options);
+int thd_sql_command(const THD* thd);
+void thd_storage_lock_wait(THD* thd, long long value);
+int thd_tx_isolation(const THD* thd);
+int thd_tx_is_read_only(const THD* thd);
int mysql_tmpfile(const char *prefix);
-unsigned long thd_get_thread_id(const void* thd);
-void thd_get_xid(const void* thd, MYSQL_XID *xid);
-void mysql_query_cache_invalidate4(void* thd,
+unsigned long thd_get_thread_id(const THD* thd);
+void thd_get_xid(const THD* thd, MYSQL_XID *xid);
+void mysql_query_cache_invalidate4(THD* thd,
const char *key, unsigned int key_length,
int using_trx);
-void *thd_get_ha_data(const void* thd, const struct handlerton *hton);
-void thd_set_ha_data(void* thd, const struct handlerton *hton,
+void *thd_get_ha_data(const THD* thd, const struct handlerton *hton);
+void thd_set_ha_data(THD* thd, const struct handlerton *hton,
const void *ha_data);
-void thd_wakeup_subsequent_commits(void* thd, int wakeup_error);
+void thd_wakeup_subsequent_commits(THD* thd, int wakeup_error);
+}
+extern "C" {
struct st_mariadb_encryption
{
int interface_version;
@@ -589,3 +639,4 @@ struct st_mariadb_encryption
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 bd1cfc7b68b..daefd6b2838 100644
--- a/include/mysql/plugin_ftparser.h.pp
+++ b/include/mysql/plugin_ftparser.h.pp
@@ -1,5 +1,9 @@
+class THD;
+class Item;
typedef char my_bool;
typedef void * MYSQL_PLUGIN;
+extern "C" {
+extern "C" {
extern struct base64_service_st {
int (*base64_needed_encoded_length_ptr)(int length_of_data);
int (*base64_encode_max_arg_length_ptr)(void);
@@ -16,7 +20,11 @@ int my_base64_decode_max_arg_length();
int my_base64_encode(const void *src, size_t src_len, char *dst);
int my_base64_decode(const char *src, size_t src_len,
void *dst, const char **end_ptr, int flags);
-extern void (*debug_sync_C_callback_ptr)(void*, const char *, size_t);
+}
+extern "C" {
+extern void (*debug_sync_C_callback_ptr)(THD*, const char *, size_t);
+}
+extern "C" {
struct encryption_service_st {
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,
@@ -57,6 +65,8 @@ static inline int encryption_crypt(const unsigned char* src, unsigned int slen,
*dlen= d1 + d2;
return res1 ? res1 : res2;
}
+}
+extern "C" {
struct st_encryption_scheme_key {
unsigned int version;
unsigned char key[16];
@@ -93,15 +103,19 @@ int encryption_scheme_decrypt(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);
+}
+extern "C" {
enum thd_kill_levels {
THD_IS_NOT_KILLED=0,
THD_ABORT_SOFTLY=50,
THD_ABORT_ASAP=100,
};
extern struct kill_statement_service_st {
- enum thd_kill_levels (*thd_kill_level_func)(const void*);
+ enum thd_kill_levels (*thd_kill_level_func)(const THD*);
} *thd_kill_statement_service;
-enum thd_kill_levels thd_kill_level(const void*);
+enum thd_kill_levels thd_kill_level(const THD*);
+}
+extern "C" {
typedef struct logger_handle_st LOGGER_HANDLE;
extern struct logger_service_st {
void (*logger_init_mutexes)();
@@ -123,6 +137,8 @@ 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);
+}
+extern "C" {
extern struct my_md5_service_st {
void (*my_md5_type)(unsigned char*, const char*, size_t);
void (*my_md5_multi_type)(unsigned char*, ...);
@@ -137,6 +153,8 @@ 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);
+}
+extern "C" {
enum my_aes_mode {
MY_AES_ECB, MY_AES_CBC
};
@@ -166,6 +184,8 @@ int my_aes_crypt(enum my_aes_mode mode, int flags,
int my_random_bytes(unsigned char* buf, int num);
unsigned int my_aes_get_size(enum my_aes_mode mode, unsigned int source_length);
unsigned int my_aes_ctx_size(enum my_aes_mode mode);
+}
+extern "C" {
extern struct my_print_error_service_st {
void (*my_error_func)(unsigned int nr, unsigned long MyFlags, ...);
void (*my_printf_error_func)(unsigned int nr, const char *fmt, unsigned long MyFlags,...);
@@ -174,32 +194,38 @@ extern struct my_print_error_service_st {
extern void my_error(unsigned int nr, unsigned long MyFlags, ...);
extern void my_printf_error(unsigned int my_err, const char *format, unsigned long MyFlags, ...);
extern void my_printv_error(unsigned int error, const char *format, unsigned long MyFlags,va_list ap);
+}
+extern "C" {
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);
+}
+extern "C" {
extern struct progress_report_service_st {
- void (*thd_progress_init_func)(void* thd, unsigned int max_stage);
- void (*thd_progress_report_func)(void* thd,
+ void (*thd_progress_init_func)(THD* thd, unsigned int max_stage);
+ void (*thd_progress_report_func)(THD* thd,
unsigned long long progress,
unsigned long long max_progress);
- void (*thd_progress_next_stage_func)(void* thd);
- void (*thd_progress_end_func)(void* thd);
- const char *(*set_thd_proc_info_func)(void*, const char *info,
+ void (*thd_progress_next_stage_func)(THD* thd);
+ void (*thd_progress_end_func)(THD* thd);
+ const char *(*set_thd_proc_info_func)(THD*, const char *info,
const char *func,
const char *file,
unsigned int line);
} *progress_report_service;
-void thd_progress_init(void* thd, unsigned int max_stage);
-void thd_progress_report(void* thd,
+void thd_progress_init(THD* thd, unsigned int max_stage);
+void thd_progress_report(THD* thd,
unsigned long long progress,
unsigned long long max_progress);
-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,
+void thd_progress_next_stage(THD* thd);
+void thd_progress_end(THD* thd);
+const char *set_thd_proc_info(THD*, const char * info, const char *func,
const char *file, unsigned int line);
+}
+extern "C" {
extern struct my_sha1_service_st {
void (*my_sha1_type)(unsigned char*, const char*, size_t);
void (*my_sha1_multi_type)(unsigned char*, ...);
@@ -214,6 +240,8 @@ 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);
+}
+extern "C" {
extern struct my_sha2_service_st {
void (*my_sha224_type)(unsigned char*, const char*, size_t);
void (*my_sha224_multi_type)(unsigned char*, ...);
@@ -264,6 +292,8 @@ size_t my_sha512_context_size();
void my_sha512_init(void *context);
void my_sha512_input(void *context, const unsigned char *buf, size_t len);
void my_sha512_result(void *context, unsigned char *digest);
+}
+extern "C" {
struct st_mysql_lex_string
{
char *str;
@@ -277,64 +307,73 @@ struct st_mysql_const_lex_string
};
typedef struct st_mysql_const_lex_string MYSQL_CONST_LEX_STRING;
extern struct thd_alloc_service_st {
- void *(*thd_alloc_func)(void*, size_t);
- void *(*thd_calloc_func)(void*, size_t);
- char *(*thd_strdup_func)(void*, const char *);
- char *(*thd_strmake_func)(void*, const char *, size_t);
- void *(*thd_memdup_func)(void*, const void*, size_t);
- MYSQL_CONST_LEX_STRING *(*thd_make_lex_string_func)(void*,
+ void *(*thd_alloc_func)(THD*, size_t);
+ void *(*thd_calloc_func)(THD*, size_t);
+ char *(*thd_strdup_func)(THD*, const char *);
+ char *(*thd_strmake_func)(THD*, const char *, size_t);
+ void *(*thd_memdup_func)(THD*, const void*, size_t);
+ MYSQL_CONST_LEX_STRING *(*thd_make_lex_string_func)(THD*,
MYSQL_CONST_LEX_STRING *,
const char *, size_t, int);
} *thd_alloc_service;
-void *thd_alloc(void* thd, size_t size);
-void *thd_calloc(void* thd, size_t size);
-char *thd_strdup(void* thd, const char *str);
-char *thd_strmake(void* thd, const char *str, size_t size);
-void *thd_memdup(void* thd, const void* str, size_t size);
+void *thd_alloc(THD* thd, size_t size);
+void *thd_calloc(THD* thd, size_t size);
+char *thd_strdup(THD* thd, const char *str);
+char *thd_strmake(THD* thd, const char *str, size_t size);
+void *thd_memdup(THD* thd, const void* str, size_t size);
MYSQL_CONST_LEX_STRING
-*thd_make_lex_string(void* thd, MYSQL_CONST_LEX_STRING *lex_str,
+*thd_make_lex_string(THD* thd, MYSQL_CONST_LEX_STRING *lex_str,
const char *str, size_t size,
int allocate_lex_string);
+}
+extern "C" {
extern struct thd_autoinc_service_st {
- void (*thd_get_autoinc_func)(const void* thd,
+ void (*thd_get_autoinc_func)(const THD* thd,
unsigned long* off, unsigned long* inc);
} *thd_autoinc_service;
-void thd_get_autoinc(const void* thd,
+void thd_get_autoinc(const THD* thd,
unsigned long* off, unsigned long* inc);
+}
+extern "C" {
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);
- unsigned long (*thd_get_error_row_func)(const void* thd);
- void (*thd_inc_error_row_func)(void* thd);
- char *(*thd_get_error_context_description_func)(void* thd,
+ const char *(*thd_get_error_message_func)(const THD* thd);
+ unsigned int (*thd_get_error_number_func)(const THD* thd);
+ unsigned long (*thd_get_error_row_func)(const THD* thd);
+ void (*thd_inc_error_row_func)(THD* thd);
+ char *(*thd_get_error_context_description_func)(THD* thd,
char *buffer,
unsigned int length,
unsigned int max_query_length);
} *thd_error_context_service;
-const char *thd_get_error_message(const void* thd);
-unsigned int thd_get_error_number(const void* thd);
-unsigned long thd_get_error_row(const void* thd);
-void thd_inc_error_row(void* thd);
-char *thd_get_error_context_description(void* thd,
+const char *thd_get_error_message(const THD* thd);
+unsigned int thd_get_error_number(const THD* thd);
+unsigned long thd_get_error_row(const THD* thd);
+void thd_inc_error_row(THD* thd);
+char *thd_get_error_context_description(THD* thd,
char *buffer, unsigned int length,
unsigned int max_query_length);
+}
+extern "C" {
extern struct thd_rnd_service_st {
- double (*thd_rnd_ptr)(void* thd);
- void (*thd_c_r_p_ptr)(void* thd, char *to, size_t length);
+ double (*thd_rnd_ptr)(THD* thd);
+ void (*thd_c_r_p_ptr)(THD* thd, char *to, size_t length);
} *thd_rnd_service;
-double thd_rnd(void* thd);
-void thd_create_random_password(void* thd, char *to, size_t length);
+double thd_rnd(THD* thd);
+void thd_create_random_password(THD* thd, char *to, size_t length);
+}
+extern "C" {
typedef int MYSQL_THD_KEY_T;
extern struct thd_specifics_service_st {
int (*thd_key_create_func)(MYSQL_THD_KEY_T *key);
void (*thd_key_delete_func)(MYSQL_THD_KEY_T *key);
- void *(*thd_getspecific_func)(void* thd, MYSQL_THD_KEY_T key);
- int (*thd_setspecific_func)(void* thd, MYSQL_THD_KEY_T key, void *value);
+ void *(*thd_getspecific_func)(THD* thd, MYSQL_THD_KEY_T key);
+ int (*thd_setspecific_func)(THD* thd, MYSQL_THD_KEY_T key, void *value);
} *thd_specifics_service;
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);
+void* thd_getspecific(THD* thd, MYSQL_THD_KEY_T key);
+int thd_setspecific(THD* thd, MYSQL_THD_KEY_T key, void *value);
+}
typedef long my_time_t;
enum enum_mysql_timestamp_type
{
@@ -348,12 +387,15 @@ typedef struct st_mysql_time
my_bool neg;
enum enum_mysql_timestamp_type time_type;
} MYSQL_TIME;
+extern "C" {
extern struct thd_timezone_service_st {
- 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);
+ my_time_t (*thd_TIME_to_gmt_sec)(THD* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
+ void (*thd_gmt_sec_to_TIME)(THD* thd, MYSQL_TIME *ltime, my_time_t t);
} *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);
+my_time_t thd_TIME_to_gmt_sec(THD* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
+void thd_gmt_sec_to_TIME(THD* thd, MYSQL_TIME *ltime, my_time_t t);
+}
+extern "C" {
typedef enum _thd_wait_type_e {
THD_WAIT_SLEEP= 1,
THD_WAIT_DISKIO= 2,
@@ -369,11 +411,13 @@ typedef enum _thd_wait_type_e {
THD_WAIT_LAST= 12
} thd_wait_type;
extern struct thd_wait_service_st {
- void (*thd_wait_begin_func)(void*, int);
- void (*thd_wait_end_func)(void*);
+ void (*thd_wait_begin_func)(THD*, int);
+ void (*thd_wait_end_func)(THD*);
} *thd_wait_service;
-void thd_wait_begin(void* thd, int wait_type);
-void thd_wait_end(void* thd);
+void thd_wait_begin(THD* thd, int wait_type);
+void thd_wait_end(THD* thd);
+}
+extern "C" {
enum json_types
{
JSV_BAD_JSON=-1,
@@ -419,6 +463,8 @@ int json_escape_string(const char *str,const char *str_end,
char *json, char *json_end);
int json_unescape_json(const char *json_str, const char *json_end,
char *res, char *res_end);
+}
+}
struct st_mysql_xid {
long formatID;
long gtrid_length;
@@ -432,7 +478,7 @@ enum enum_mysql_show_type
SHOW_ULONGLONG, SHOW_CHAR, SHOW_CHAR_PTR,
SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE,
SHOW_SINT, SHOW_SLONG, SHOW_SLONGLONG, SHOW_SIMPLE_FUNC,
- SHOW_always_last
+ SHOW_SIZE_T, SHOW_always_last
};
enum enum_var_type
{
@@ -444,13 +490,13 @@ struct st_mysql_show_var {
enum enum_mysql_show_type type;
};
struct system_status_var;
-typedef int (*mysql_show_var_func)(void*, struct st_mysql_show_var*, void *, struct system_status_var *status_var, enum enum_var_type);
+typedef int (*mysql_show_var_func)(THD*, struct st_mysql_show_var*, void *, struct system_status_var *status_var, enum enum_var_type);
struct st_mysql_sys_var;
struct st_mysql_value;
-typedef int (*mysql_var_check_func)(void* thd,
+typedef int (*mysql_var_check_func)(THD* thd,
struct st_mysql_sys_var *var,
void *save, struct st_mysql_value *value);
-typedef void (*mysql_var_update_func)(void* thd,
+typedef void (*mysql_var_update_func)(THD* thd,
struct st_mysql_sys_var *var,
void *var_ptr, const void *save);
struct st_mysql_plugin
@@ -509,24 +555,26 @@ struct st_mysql_value
int (*val_int)(struct st_mysql_value *, long long *intbuf);
int (*is_unsigned)(struct st_mysql_value *);
};
-int thd_in_lock_tables(const void* thd);
-int thd_tablespace_op(const void* thd);
-long long thd_test_options(const void* thd, long long test_options);
-int thd_sql_command(const void* thd);
-void **thd_ha_data(const void* thd, const struct handlerton *hton);
-void thd_storage_lock_wait(void* thd, long long value);
-int thd_tx_isolation(const void* thd);
-int thd_tx_is_read_only(const void* thd);
+extern "C" {
+int thd_in_lock_tables(const THD* thd);
+int thd_tablespace_op(const THD* thd);
+long long thd_test_options(const THD* thd, long long test_options);
+int thd_sql_command(const THD* thd);
+void thd_storage_lock_wait(THD* thd, long long value);
+int thd_tx_isolation(const THD* thd);
+int thd_tx_is_read_only(const THD* thd);
int mysql_tmpfile(const char *prefix);
-unsigned long thd_get_thread_id(const void* thd);
-void thd_get_xid(const void* thd, MYSQL_XID *xid);
-void mysql_query_cache_invalidate4(void* thd,
+unsigned long thd_get_thread_id(const THD* thd);
+void thd_get_xid(const THD* thd, MYSQL_XID *xid);
+void mysql_query_cache_invalidate4(THD* thd,
const char *key, unsigned int key_length,
int using_trx);
-void *thd_get_ha_data(const void* thd, const struct handlerton *hton);
-void thd_set_ha_data(void* thd, const struct handlerton *hton,
+void *thd_get_ha_data(const THD* thd, const struct handlerton *hton);
+void thd_set_ha_data(THD* thd, const struct handlerton *hton,
const void *ha_data);
-void thd_wakeup_subsequent_commits(void* thd, int wakeup_error);
+void thd_wakeup_subsequent_commits(THD* thd, int wakeup_error);
+}
+extern "C" {
enum enum_ftparser_mode
{
MYSQL_FTPARSER_SIMPLE_MODE= 0,
@@ -573,3 +621,4 @@ struct st_mysql_ftparser
int (*init)(MYSQL_FTPARSER_PARAM *param);
int (*deinit)(MYSQL_FTPARSER_PARAM *param);
};
+}
diff --git a/include/mysql/plugin_function_collection.h b/include/mysql/plugin_function_collection.h
new file mode 100644
index 00000000000..c1b51ac5883
--- /dev/null
+++ b/include/mysql/plugin_function_collection.h
@@ -0,0 +1,101 @@
+#ifndef MARIADB_PLUGIN_FUNCTION_COLLECTION_INCLUDED
+#define MARIADB_PLUGIN_FUNCTION_COLLECTION_INCLUDED
+/* Copyright (C) 2019, Alexander Barkov and 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
+
+/**
+ @file
+
+ Data Type Plugin API.
+
+ This file defines the API for server plugins that manage function collections.
+*/
+
+#ifdef __cplusplus
+
+#include <mysql/plugin.h>
+
+/*
+ API for data type plugins. (MariaDB_FUNCTION_COLLECTION_PLUGIN)
+*/
+#define MariaDB_FUNCTION_COLLECTION_INTERFACE_VERSION (MYSQL_VERSION_ID << 8)
+
+
+class Native_func_registry_array
+{
+ const Native_func_registry *m_elements;
+ size_t m_count;
+public:
+ Native_func_registry_array()
+ :m_elements(NULL),
+ m_count(0)
+ { }
+ Native_func_registry_array(const Native_func_registry *elements, size_t count)
+ :m_elements(elements),
+ m_count(count)
+ { }
+ const Native_func_registry& element(size_t i) const
+ {
+ DBUG_ASSERT(i < m_count);
+ return m_elements[i];
+ }
+ size_t count() const { return m_count; }
+};
+
+
+class Plugin_function_collection
+{
+ int m_interface_version;
+ const Native_func_registry_array m_native_func_registry_array;
+ HASH m_hash;
+public:
+ bool init();
+ void deinit()
+ {
+ my_hash_free(&m_hash);
+ }
+ static int init_plugin(st_plugin_int *plugin)
+ {
+ Plugin_function_collection *coll=
+ reinterpret_cast<Plugin_function_collection*>(plugin->plugin->info);
+ return coll->init();
+ }
+ static int deinit_plugin(st_plugin_int *plugin)
+ {
+ Plugin_function_collection *coll=
+ reinterpret_cast<Plugin_function_collection*>(plugin->plugin->info);
+ coll->deinit();
+ return 0;
+ }
+public:
+ Plugin_function_collection(int interface_version,
+ const Native_func_registry_array &nfra)
+ :m_interface_version(interface_version),
+ m_native_func_registry_array(nfra)
+ {
+ bzero((void*) &m_hash, sizeof(m_hash));
+ }
+ Create_func *find_native_function_builder(THD *thd,
+ const LEX_CSTRING &name) const;
+};
+
+
+/**
+ Data type plugin descriptor
+*/
+
+#endif /* __cplusplus */
+
+#endif /* MARIADB_PLUGIN_FUNCTION_COLLECTION_INCLUDED */
diff --git a/include/mysql/plugin_function_collection.h.pp b/include/mysql/plugin_function_collection.h.pp
new file mode 100644
index 00000000000..75baf7d7e10
--- /dev/null
+++ b/include/mysql/plugin_function_collection.h.pp
@@ -0,0 +1,679 @@
+class THD;
+class Item;
+typedef char my_bool;
+typedef void * MYSQL_PLUGIN;
+extern "C" {
+extern "C" {
+extern struct base64_service_st {
+ int (*base64_needed_encoded_length_ptr)(int length_of_data);
+ int (*base64_encode_max_arg_length_ptr)(void);
+ int (*base64_needed_decoded_length_ptr)(int length_of_encoded_data);
+ int (*base64_decode_max_arg_length_ptr)();
+ int (*base64_encode_ptr)(const void *src, size_t src_len, char *dst);
+ int (*base64_decode_ptr)(const char *src, size_t src_len,
+ void *dst, const char **end_ptr, int flags);
+} *base64_service;
+int my_base64_needed_encoded_length(int length_of_data);
+int my_base64_encode_max_arg_length(void);
+int my_base64_needed_decoded_length(int length_of_encoded_data);
+int my_base64_decode_max_arg_length();
+int my_base64_encode(const void *src, size_t src_len, char *dst);
+int my_base64_decode(const char *src, size_t src_len,
+ void *dst, const char **end_ptr, int flags);
+}
+extern "C" {
+extern void (*debug_sync_C_callback_ptr)(THD*, const char *, size_t);
+}
+extern "C" {
+struct encryption_service_st {
+ 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;
+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;
+}
+}
+extern "C" {
+struct st_encryption_scheme_key {
+ unsigned int version;
+ unsigned char key[16];
+};
+struct st_encryption_scheme {
+ unsigned char iv[16];
+ struct st_encryption_scheme_key key[3];
+ unsigned int keyserver_requests;
+ unsigned int key_id;
+ unsigned int type;
+ void (*locker)(struct st_encryption_scheme *self, int release);
+};
+extern struct encryption_scheme_service_st {
+ int (*encryption_scheme_encrypt_func)
+ (const unsigned char* src, unsigned int slen,
+ unsigned char* dst, unsigned int* dlen,
+ struct st_encryption_scheme *scheme,
+ unsigned int key_version, unsigned int i32_1,
+ unsigned int i32_2, unsigned long long i64);
+ int (*encryption_scheme_decrypt_func)
+ (const unsigned char* src, unsigned int slen,
+ unsigned char* dst, unsigned int* dlen,
+ struct st_encryption_scheme *scheme,
+ unsigned int key_version, unsigned int i32_1,
+ unsigned int i32_2, unsigned long long i64);
+} *encryption_scheme_service;
+int encryption_scheme_encrypt(const unsigned char* src, unsigned int slen,
+ unsigned char* dst, unsigned int* dlen,
+ struct st_encryption_scheme *scheme,
+ unsigned int key_version, unsigned int i32_1,
+ unsigned int i32_2, unsigned long long i64);
+int encryption_scheme_decrypt(const unsigned char* src, unsigned int slen,
+ unsigned char* dst, unsigned int* dlen,
+ struct st_encryption_scheme *scheme,
+ unsigned int key_version, unsigned int i32_1,
+ unsigned int i32_2, unsigned long long i64);
+}
+extern "C" {
+enum thd_kill_levels {
+ THD_IS_NOT_KILLED=0,
+ THD_ABORT_SOFTLY=50,
+ THD_ABORT_ASAP=100,
+};
+extern struct kill_statement_service_st {
+ enum thd_kill_levels (*thd_kill_level_func)(const THD*);
+} *thd_kill_statement_service;
+enum thd_kill_levels thd_kill_level(const THD*);
+}
+extern "C" {
+typedef struct logger_handle_st LOGGER_HANDLE;
+extern struct logger_service_st {
+ void (*logger_init_mutexes)();
+ LOGGER_HANDLE* (*open)(const char *path,
+ unsigned long long size_limit,
+ unsigned int rotations);
+ int (*close)(LOGGER_HANDLE *log);
+ int (*vprintf)(LOGGER_HANDLE *log, const char *fmt, va_list argptr);
+ int (*printf)(LOGGER_HANDLE *log, const char *fmt, ...);
+ int (*write)(LOGGER_HANDLE *log, const char *buffer, size_t size);
+ int (*rotate)(LOGGER_HANDLE *log);
+} *logger_service;
+ void logger_init_mutexes();
+ LOGGER_HANDLE *logger_open(const char *path,
+ unsigned long long size_limit,
+ unsigned int rotations);
+ int logger_close(LOGGER_HANDLE *log);
+ int logger_vprintf(LOGGER_HANDLE *log, const char *fmt, va_list argptr);
+ 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);
+}
+extern "C" {
+extern struct my_md5_service_st {
+ void (*my_md5_type)(unsigned char*, const char*, size_t);
+ void (*my_md5_multi_type)(unsigned char*, ...);
+ size_t (*my_md5_context_size_type)();
+ void (*my_md5_init_type)(void *);
+ void (*my_md5_input_type)(void *, const unsigned char *, size_t);
+ void (*my_md5_result_type)(void *, unsigned char *);
+} *my_md5_service;
+void my_md5(unsigned char*, const char*, size_t);
+void my_md5_multi(unsigned char*, ...);
+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);
+}
+extern "C" {
+enum my_aes_mode {
+ MY_AES_ECB, MY_AES_CBC
+};
+extern struct my_crypt_service_st {
+ 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 unsigned char *src, unsigned int slen,
+ unsigned char *dst, unsigned int *dlen);
+ int (*my_aes_crypt_finish)(void *ctx, unsigned char *dst, unsigned int *dlen);
+ int (*my_aes_crypt)(enum my_aes_mode mode, int flags,
+ 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);
+ unsigned int (*my_aes_get_size)(enum my_aes_mode mode, unsigned int source_length);
+ unsigned int (*my_aes_ctx_size)(enum my_aes_mode mode);
+ int (*my_random_bytes)(unsigned char* buf, int num);
+} *my_crypt_service;
+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 unsigned char *src, unsigned int slen,
+ unsigned char *dst, unsigned int *dlen);
+int my_aes_crypt_finish(void *ctx, unsigned char *dst, unsigned int *dlen);
+int my_aes_crypt(enum my_aes_mode mode, int flags,
+ 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 my_random_bytes(unsigned char* buf, int num);
+unsigned int my_aes_get_size(enum my_aes_mode mode, unsigned int source_length);
+unsigned int my_aes_ctx_size(enum my_aes_mode mode);
+}
+extern "C" {
+extern struct my_print_error_service_st {
+ void (*my_error_func)(unsigned int nr, unsigned long MyFlags, ...);
+ void (*my_printf_error_func)(unsigned int nr, const char *fmt, unsigned long MyFlags,...);
+ void (*my_printv_error_func)(unsigned int error, const char *format, unsigned long MyFlags, va_list ap);
+} *my_print_error_service;
+extern void my_error(unsigned int nr, unsigned long MyFlags, ...);
+extern void my_printf_error(unsigned int my_err, const char *format, unsigned long MyFlags, ...);
+extern void my_printv_error(unsigned int error, const char *format, unsigned long MyFlags,va_list ap);
+}
+extern "C" {
+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);
+}
+extern "C" {
+extern struct progress_report_service_st {
+ void (*thd_progress_init_func)(THD* thd, unsigned int max_stage);
+ void (*thd_progress_report_func)(THD* thd,
+ unsigned long long progress,
+ unsigned long long max_progress);
+ void (*thd_progress_next_stage_func)(THD* thd);
+ void (*thd_progress_end_func)(THD* thd);
+ const char *(*set_thd_proc_info_func)(THD*, const char *info,
+ const char *func,
+ const char *file,
+ unsigned int line);
+} *progress_report_service;
+void thd_progress_init(THD* thd, unsigned int max_stage);
+void thd_progress_report(THD* thd,
+ unsigned long long progress,
+ unsigned long long max_progress);
+void thd_progress_next_stage(THD* thd);
+void thd_progress_end(THD* thd);
+const char *set_thd_proc_info(THD*, const char * info, const char *func,
+ const char *file, unsigned int line);
+}
+extern "C" {
+extern struct my_sha1_service_st {
+ void (*my_sha1_type)(unsigned char*, const char*, size_t);
+ void (*my_sha1_multi_type)(unsigned char*, ...);
+ size_t (*my_sha1_context_size_type)();
+ void (*my_sha1_init_type)(void *);
+ void (*my_sha1_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha1_result_type)(void *, unsigned char *);
+} *my_sha1_service;
+void my_sha1(unsigned char*, const char*, size_t);
+void my_sha1_multi(unsigned char*, ...);
+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);
+}
+extern "C" {
+extern struct my_sha2_service_st {
+ void (*my_sha224_type)(unsigned char*, const char*, size_t);
+ void (*my_sha224_multi_type)(unsigned char*, ...);
+ size_t (*my_sha224_context_size_type)();
+ void (*my_sha224_init_type)(void *);
+ void (*my_sha224_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha224_result_type)(void *, unsigned char *);
+ void (*my_sha256_type)(unsigned char*, const char*, size_t);
+ void (*my_sha256_multi_type)(unsigned char*, ...);
+ size_t (*my_sha256_context_size_type)();
+ void (*my_sha256_init_type)(void *);
+ void (*my_sha256_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha256_result_type)(void *, unsigned char *);
+ void (*my_sha384_type)(unsigned char*, const char*, size_t);
+ void (*my_sha384_multi_type)(unsigned char*, ...);
+ size_t (*my_sha384_context_size_type)();
+ void (*my_sha384_init_type)(void *);
+ void (*my_sha384_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha384_result_type)(void *, unsigned char *);
+ void (*my_sha512_type)(unsigned char*, const char*, size_t);
+ void (*my_sha512_multi_type)(unsigned char*, ...);
+ size_t (*my_sha512_context_size_type)();
+ void (*my_sha512_init_type)(void *);
+ void (*my_sha512_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha512_result_type)(void *, unsigned char *);
+} *my_sha2_service;
+void my_sha224(unsigned char*, const char*, size_t);
+void my_sha224_multi(unsigned char*, ...);
+size_t my_sha224_context_size();
+void my_sha224_init(void *context);
+void my_sha224_input(void *context, const unsigned char *buf, size_t len);
+void my_sha224_result(void *context, unsigned char *digest);
+void my_sha256(unsigned char*, const char*, size_t);
+void my_sha256_multi(unsigned char*, ...);
+size_t my_sha256_context_size();
+void my_sha256_init(void *context);
+void my_sha256_input(void *context, const unsigned char *buf, size_t len);
+void my_sha256_result(void *context, unsigned char *digest);
+void my_sha384(unsigned char*, const char*, size_t);
+void my_sha384_multi(unsigned char*, ...);
+size_t my_sha384_context_size();
+void my_sha384_init(void *context);
+void my_sha384_input(void *context, const unsigned char *buf, size_t len);
+void my_sha384_result(void *context, unsigned char *digest);
+void my_sha512(unsigned char*, const char*, size_t);
+void my_sha512_multi(unsigned char*, ...);
+size_t my_sha512_context_size();
+void my_sha512_init(void *context);
+void my_sha512_input(void *context, const unsigned char *buf, size_t len);
+void my_sha512_result(void *context, unsigned char *digest);
+}
+extern "C" {
+struct st_mysql_lex_string
+{
+ char *str;
+ size_t length;
+};
+typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
+struct st_mysql_const_lex_string
+{
+ const char *str;
+ size_t length;
+};
+typedef struct st_mysql_const_lex_string MYSQL_CONST_LEX_STRING;
+extern struct thd_alloc_service_st {
+ void *(*thd_alloc_func)(THD*, size_t);
+ void *(*thd_calloc_func)(THD*, size_t);
+ char *(*thd_strdup_func)(THD*, const char *);
+ char *(*thd_strmake_func)(THD*, const char *, size_t);
+ void *(*thd_memdup_func)(THD*, const void*, size_t);
+ MYSQL_CONST_LEX_STRING *(*thd_make_lex_string_func)(THD*,
+ MYSQL_CONST_LEX_STRING *,
+ const char *, size_t, int);
+} *thd_alloc_service;
+void *thd_alloc(THD* thd, size_t size);
+void *thd_calloc(THD* thd, size_t size);
+char *thd_strdup(THD* thd, const char *str);
+char *thd_strmake(THD* thd, const char *str, size_t size);
+void *thd_memdup(THD* thd, const void* str, size_t size);
+MYSQL_CONST_LEX_STRING
+*thd_make_lex_string(THD* thd, MYSQL_CONST_LEX_STRING *lex_str,
+ const char *str, size_t size,
+ int allocate_lex_string);
+}
+extern "C" {
+extern struct thd_autoinc_service_st {
+ void (*thd_get_autoinc_func)(const THD* thd,
+ unsigned long* off, unsigned long* inc);
+} *thd_autoinc_service;
+void thd_get_autoinc(const THD* thd,
+ unsigned long* off, unsigned long* inc);
+}
+extern "C" {
+extern struct thd_error_context_service_st {
+ const char *(*thd_get_error_message_func)(const THD* thd);
+ unsigned int (*thd_get_error_number_func)(const THD* thd);
+ unsigned long (*thd_get_error_row_func)(const THD* thd);
+ void (*thd_inc_error_row_func)(THD* thd);
+ char *(*thd_get_error_context_description_func)(THD* thd,
+ char *buffer,
+ unsigned int length,
+ unsigned int max_query_length);
+} *thd_error_context_service;
+const char *thd_get_error_message(const THD* thd);
+unsigned int thd_get_error_number(const THD* thd);
+unsigned long thd_get_error_row(const THD* thd);
+void thd_inc_error_row(THD* thd);
+char *thd_get_error_context_description(THD* thd,
+ char *buffer, unsigned int length,
+ unsigned int max_query_length);
+}
+extern "C" {
+extern struct thd_rnd_service_st {
+ double (*thd_rnd_ptr)(THD* thd);
+ void (*thd_c_r_p_ptr)(THD* thd, char *to, size_t length);
+} *thd_rnd_service;
+double thd_rnd(THD* thd);
+void thd_create_random_password(THD* thd, char *to, size_t length);
+}
+extern "C" {
+typedef int MYSQL_THD_KEY_T;
+extern struct thd_specifics_service_st {
+ int (*thd_key_create_func)(MYSQL_THD_KEY_T *key);
+ void (*thd_key_delete_func)(MYSQL_THD_KEY_T *key);
+ void *(*thd_getspecific_func)(THD* thd, MYSQL_THD_KEY_T key);
+ int (*thd_setspecific_func)(THD* thd, MYSQL_THD_KEY_T key, void *value);
+} *thd_specifics_service;
+int thd_key_create(MYSQL_THD_KEY_T *key);
+void thd_key_delete(MYSQL_THD_KEY_T *key);
+void* thd_getspecific(THD* thd, MYSQL_THD_KEY_T key);
+int thd_setspecific(THD* thd, MYSQL_THD_KEY_T key, void *value);
+}
+typedef long my_time_t;
+enum enum_mysql_timestamp_type
+{
+ MYSQL_TIMESTAMP_NONE= -2, MYSQL_TIMESTAMP_ERROR= -1,
+ MYSQL_TIMESTAMP_DATE= 0, MYSQL_TIMESTAMP_DATETIME= 1, MYSQL_TIMESTAMP_TIME= 2
+};
+typedef struct st_mysql_time
+{
+ unsigned int year, month, day, hour, minute, second;
+ unsigned long second_part;
+ my_bool neg;
+ enum enum_mysql_timestamp_type time_type;
+} MYSQL_TIME;
+extern "C" {
+extern struct thd_timezone_service_st {
+ my_time_t (*thd_TIME_to_gmt_sec)(THD* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
+ void (*thd_gmt_sec_to_TIME)(THD* thd, MYSQL_TIME *ltime, my_time_t t);
+} *thd_timezone_service;
+my_time_t thd_TIME_to_gmt_sec(THD* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
+void thd_gmt_sec_to_TIME(THD* thd, MYSQL_TIME *ltime, my_time_t t);
+}
+extern "C" {
+typedef enum _thd_wait_type_e {
+ THD_WAIT_SLEEP= 1,
+ THD_WAIT_DISKIO= 2,
+ THD_WAIT_ROW_LOCK= 3,
+ THD_WAIT_GLOBAL_LOCK= 4,
+ THD_WAIT_META_DATA_LOCK= 5,
+ THD_WAIT_TABLE_LOCK= 6,
+ THD_WAIT_USER_LOCK= 7,
+ THD_WAIT_BINLOG= 8,
+ THD_WAIT_GROUP_COMMIT= 9,
+ THD_WAIT_SYNC= 10,
+ THD_WAIT_NET= 11,
+ THD_WAIT_LAST= 12
+} thd_wait_type;
+extern struct thd_wait_service_st {
+ void (*thd_wait_begin_func)(THD*, int);
+ void (*thd_wait_end_func)(THD*);
+} *thd_wait_service;
+void thd_wait_begin(THD* thd, int wait_type);
+void thd_wait_end(THD* thd);
+}
+extern "C" {
+enum json_types
+{
+ JSV_BAD_JSON=-1,
+ JSV_NOTHING=0,
+ JSV_OBJECT=1,
+ JSV_ARRAY=2,
+ JSV_STRING=3,
+ JSV_NUMBER=4,
+ JSV_TRUE=5,
+ JSV_FALSE=6,
+ JSV_NULL=7
+};
+extern struct json_service_st {
+ enum json_types (*json_type)(const char *js, const char *js_end,
+ const char **value, int *value_len);
+ enum json_types (*json_get_array_item)(const char *js, const char *js_end,
+ int n_item,
+ const char **value, int *value_len);
+ enum json_types (*json_get_object_key)(const char *js, const char *js_end,
+ const char *key,
+ const char **value, int *value_len);
+ enum json_types (*json_get_object_nkey)(const char *js,const char *js_end,
+ int nkey,
+ const char **keyname, const char **keyname_end,
+ const char **value, int *value_len);
+ int (*json_escape_string)(const char *str,const char *str_end,
+ char *json, char *json_end);
+ int (*json_unescape_json)(const char *json_str, const char *json_end,
+ char *res, char *res_end);
+} *json_service;
+enum json_types json_type(const char *js, const char *js_end,
+ const char **value, int *value_len);
+enum json_types json_get_array_item(const char *js, const char *js_end,
+ int n_item,
+ const char **value, int *value_len);
+enum json_types json_get_object_key(const char *js, const char *js_end,
+ const char *key,
+ const char **value, int *value_len);
+enum json_types json_get_object_nkey(const char *js,const char *js_end, int nkey,
+ const char **keyname, const char **keyname_end,
+ const char **value, int *value_len);
+int json_escape_string(const char *str,const char *str_end,
+ char *json, char *json_end);
+int json_unescape_json(const char *json_str, const char *json_end,
+ char *res, char *res_end);
+}
+}
+struct st_mysql_xid {
+ long formatID;
+ long gtrid_length;
+ long bqual_length;
+ char data[128];
+};
+typedef struct st_mysql_xid MYSQL_XID;
+enum enum_mysql_show_type
+{
+ SHOW_UNDEF, SHOW_BOOL, SHOW_UINT, SHOW_ULONG,
+ SHOW_ULONGLONG, SHOW_CHAR, SHOW_CHAR_PTR,
+ SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE,
+ SHOW_SINT, SHOW_SLONG, SHOW_SLONGLONG, SHOW_SIMPLE_FUNC,
+ SHOW_SIZE_T, SHOW_always_last
+};
+enum enum_var_type
+{
+ SHOW_OPT_DEFAULT= 0, SHOW_OPT_SESSION, SHOW_OPT_GLOBAL
+};
+struct st_mysql_show_var {
+ const char *name;
+ void *value;
+ enum enum_mysql_show_type type;
+};
+struct system_status_var;
+typedef int (*mysql_show_var_func)(THD*, struct st_mysql_show_var*, void *, struct system_status_var *status_var, enum enum_var_type);
+struct st_mysql_sys_var;
+struct st_mysql_value;
+typedef int (*mysql_var_check_func)(THD* thd,
+ struct st_mysql_sys_var *var,
+ void *save, struct st_mysql_value *value);
+typedef void (*mysql_var_update_func)(THD* thd,
+ struct st_mysql_sys_var *var,
+ void *var_ptr, const void *save);
+struct st_mysql_plugin
+{
+ int type;
+ void *info;
+ const char *name;
+ const char *author;
+ const char *descr;
+ int license;
+ int (*init)(void *);
+ int (*deinit)(void *);
+ unsigned int version;
+ struct st_mysql_show_var *status_vars;
+ struct st_mysql_sys_var **system_vars;
+ void * __reserved1;
+ unsigned long flags;
+};
+struct st_maria_plugin
+{
+ int type;
+ void *info;
+ const char *name;
+ const char *author;
+ const char *descr;
+ int license;
+ int (*init)(void *);
+ int (*deinit)(void *);
+ unsigned int version;
+ struct st_mysql_show_var *status_vars;
+ struct st_mysql_sys_var **system_vars;
+ const char *version_info;
+ unsigned int maturity;
+};
+extern "C" {
+enum enum_ftparser_mode
+{
+ MYSQL_FTPARSER_SIMPLE_MODE= 0,
+ MYSQL_FTPARSER_WITH_STOPWORDS= 1,
+ MYSQL_FTPARSER_FULL_BOOLEAN_INFO= 2
+};
+enum enum_ft_token_type
+{
+ FT_TOKEN_EOF= 0,
+ FT_TOKEN_WORD= 1,
+ FT_TOKEN_LEFT_PAREN= 2,
+ FT_TOKEN_RIGHT_PAREN= 3,
+ FT_TOKEN_STOPWORD= 4
+};
+typedef struct st_mysql_ftparser_boolean_info
+{
+ enum enum_ft_token_type type;
+ int yesno;
+ int weight_adjust;
+ char wasign;
+ char trunc;
+ char prev;
+ char *quot;
+} MYSQL_FTPARSER_BOOLEAN_INFO;
+typedef struct st_mysql_ftparser_param
+{
+ int (*mysql_parse)(struct st_mysql_ftparser_param *,
+ const char *doc, int doc_len);
+ int (*mysql_add_word)(struct st_mysql_ftparser_param *,
+ const char *word, int word_len,
+ MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info);
+ void *ftparser_state;
+ void *mysql_ftparam;
+ const struct charset_info_st *cs;
+ const char *doc;
+ int length;
+ unsigned int flags;
+ enum enum_ftparser_mode mode;
+} MYSQL_FTPARSER_PARAM;
+struct st_mysql_ftparser
+{
+ int interface_version;
+ int (*parse)(MYSQL_FTPARSER_PARAM *param);
+ int (*init)(MYSQL_FTPARSER_PARAM *param);
+ int (*deinit)(MYSQL_FTPARSER_PARAM *param);
+};
+}
+struct st_mysql_daemon
+{
+ int interface_version;
+};
+struct st_mysql_information_schema
+{
+ int interface_version;
+};
+struct st_mysql_storage_engine
+{
+ int interface_version;
+};
+struct handlerton;
+ struct Mysql_replication {
+ int interface_version;
+ };
+struct st_mysql_value
+{
+ int (*value_type)(struct st_mysql_value *);
+ const char *(*val_str)(struct st_mysql_value *, char *buffer, int *length);
+ int (*val_real)(struct st_mysql_value *, double *realbuf);
+ int (*val_int)(struct st_mysql_value *, long long *intbuf);
+ int (*is_unsigned)(struct st_mysql_value *);
+};
+extern "C" {
+int thd_in_lock_tables(const THD* thd);
+int thd_tablespace_op(const THD* thd);
+long long thd_test_options(const THD* thd, long long test_options);
+int thd_sql_command(const THD* thd);
+void thd_storage_lock_wait(THD* thd, long long value);
+int thd_tx_isolation(const THD* thd);
+int thd_tx_is_read_only(const THD* thd);
+int mysql_tmpfile(const char *prefix);
+unsigned long thd_get_thread_id(const THD* thd);
+void thd_get_xid(const THD* thd, MYSQL_XID *xid);
+void mysql_query_cache_invalidate4(THD* thd,
+ const char *key, unsigned int key_length,
+ int using_trx);
+void *thd_get_ha_data(const THD* thd, const struct handlerton *hton);
+void thd_set_ha_data(THD* thd, const struct handlerton *hton,
+ const void *ha_data);
+void thd_wakeup_subsequent_commits(THD* thd, int wakeup_error);
+}
+class Native_func_registry_array
+{
+ const Native_func_registry *m_elements;
+ size_t m_count;
+public:
+ Native_func_registry_array()
+ :m_elements(NULL),
+ m_count(0)
+ { }
+ Native_func_registry_array(const Native_func_registry *elements, size_t count)
+ :m_elements(elements),
+ m_count(count)
+ { }
+ const Native_func_registry& element(size_t i) const
+ {
+ DBUG_ASSERT(i < m_count);
+ return m_elements[i];
+ }
+ size_t count() const { return m_count; }
+};
+class Plugin_function_collection
+{
+ int m_interface_version;
+ const Native_func_registry_array m_native_func_registry_array;
+ HASH m_hash;
+public:
+ bool init();
+ void deinit()
+ {
+ my_hash_free(&m_hash);
+ }
+ static int init_plugin(st_plugin_int *plugin)
+ {
+ Plugin_function_collection *coll=
+ reinterpret_cast<Plugin_function_collection*>(plugin->plugin->info);
+ return coll->init();
+ }
+ static int deinit_plugin(st_plugin_int *plugin)
+ {
+ Plugin_function_collection *coll=
+ reinterpret_cast<Plugin_function_collection*>(plugin->plugin->info);
+ coll->deinit();
+ return 0;
+ }
+public:
+ Plugin_function_collection(int interface_version,
+ const Native_func_registry_array &nfra)
+ :m_interface_version(interface_version),
+ m_native_func_registry_array(nfra)
+ {
+ bzero((void*) &m_hash, sizeof(m_hash));
+ }
+ Create_func *find_native_function_builder(THD *thd,
+ const LEX_CSTRING &name) const;
+};
diff --git a/include/mysql/plugin_password_validation.h.pp b/include/mysql/plugin_password_validation.h.pp
index 2f9d2299c1f..fc8c3848f8c 100644
--- a/include/mysql/plugin_password_validation.h.pp
+++ b/include/mysql/plugin_password_validation.h.pp
@@ -1,5 +1,9 @@
+class THD;
+class Item;
typedef char my_bool;
typedef void * MYSQL_PLUGIN;
+extern "C" {
+extern "C" {
extern struct base64_service_st {
int (*base64_needed_encoded_length_ptr)(int length_of_data);
int (*base64_encode_max_arg_length_ptr)(void);
@@ -16,7 +20,11 @@ int my_base64_decode_max_arg_length();
int my_base64_encode(const void *src, size_t src_len, char *dst);
int my_base64_decode(const char *src, size_t src_len,
void *dst, const char **end_ptr, int flags);
-extern void (*debug_sync_C_callback_ptr)(void*, const char *, size_t);
+}
+extern "C" {
+extern void (*debug_sync_C_callback_ptr)(THD*, const char *, size_t);
+}
+extern "C" {
struct encryption_service_st {
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,
@@ -57,6 +65,8 @@ static inline int encryption_crypt(const unsigned char* src, unsigned int slen,
*dlen= d1 + d2;
return res1 ? res1 : res2;
}
+}
+extern "C" {
struct st_encryption_scheme_key {
unsigned int version;
unsigned char key[16];
@@ -93,15 +103,19 @@ int encryption_scheme_decrypt(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);
+}
+extern "C" {
enum thd_kill_levels {
THD_IS_NOT_KILLED=0,
THD_ABORT_SOFTLY=50,
THD_ABORT_ASAP=100,
};
extern struct kill_statement_service_st {
- enum thd_kill_levels (*thd_kill_level_func)(const void*);
+ enum thd_kill_levels (*thd_kill_level_func)(const THD*);
} *thd_kill_statement_service;
-enum thd_kill_levels thd_kill_level(const void*);
+enum thd_kill_levels thd_kill_level(const THD*);
+}
+extern "C" {
typedef struct logger_handle_st LOGGER_HANDLE;
extern struct logger_service_st {
void (*logger_init_mutexes)();
@@ -123,6 +137,8 @@ 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);
+}
+extern "C" {
extern struct my_md5_service_st {
void (*my_md5_type)(unsigned char*, const char*, size_t);
void (*my_md5_multi_type)(unsigned char*, ...);
@@ -137,6 +153,8 @@ 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);
+}
+extern "C" {
enum my_aes_mode {
MY_AES_ECB, MY_AES_CBC
};
@@ -166,6 +184,8 @@ int my_aes_crypt(enum my_aes_mode mode, int flags,
int my_random_bytes(unsigned char* buf, int num);
unsigned int my_aes_get_size(enum my_aes_mode mode, unsigned int source_length);
unsigned int my_aes_ctx_size(enum my_aes_mode mode);
+}
+extern "C" {
extern struct my_print_error_service_st {
void (*my_error_func)(unsigned int nr, unsigned long MyFlags, ...);
void (*my_printf_error_func)(unsigned int nr, const char *fmt, unsigned long MyFlags,...);
@@ -174,32 +194,38 @@ extern struct my_print_error_service_st {
extern void my_error(unsigned int nr, unsigned long MyFlags, ...);
extern void my_printf_error(unsigned int my_err, const char *format, unsigned long MyFlags, ...);
extern void my_printv_error(unsigned int error, const char *format, unsigned long MyFlags,va_list ap);
+}
+extern "C" {
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);
+}
+extern "C" {
extern struct progress_report_service_st {
- void (*thd_progress_init_func)(void* thd, unsigned int max_stage);
- void (*thd_progress_report_func)(void* thd,
+ void (*thd_progress_init_func)(THD* thd, unsigned int max_stage);
+ void (*thd_progress_report_func)(THD* thd,
unsigned long long progress,
unsigned long long max_progress);
- void (*thd_progress_next_stage_func)(void* thd);
- void (*thd_progress_end_func)(void* thd);
- const char *(*set_thd_proc_info_func)(void*, const char *info,
+ void (*thd_progress_next_stage_func)(THD* thd);
+ void (*thd_progress_end_func)(THD* thd);
+ const char *(*set_thd_proc_info_func)(THD*, const char *info,
const char *func,
const char *file,
unsigned int line);
} *progress_report_service;
-void thd_progress_init(void* thd, unsigned int max_stage);
-void thd_progress_report(void* thd,
+void thd_progress_init(THD* thd, unsigned int max_stage);
+void thd_progress_report(THD* thd,
unsigned long long progress,
unsigned long long max_progress);
-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,
+void thd_progress_next_stage(THD* thd);
+void thd_progress_end(THD* thd);
+const char *set_thd_proc_info(THD*, const char * info, const char *func,
const char *file, unsigned int line);
+}
+extern "C" {
extern struct my_sha1_service_st {
void (*my_sha1_type)(unsigned char*, const char*, size_t);
void (*my_sha1_multi_type)(unsigned char*, ...);
@@ -214,6 +240,8 @@ 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);
+}
+extern "C" {
extern struct my_sha2_service_st {
void (*my_sha224_type)(unsigned char*, const char*, size_t);
void (*my_sha224_multi_type)(unsigned char*, ...);
@@ -264,6 +292,8 @@ size_t my_sha512_context_size();
void my_sha512_init(void *context);
void my_sha512_input(void *context, const unsigned char *buf, size_t len);
void my_sha512_result(void *context, unsigned char *digest);
+}
+extern "C" {
struct st_mysql_lex_string
{
char *str;
@@ -277,64 +307,73 @@ struct st_mysql_const_lex_string
};
typedef struct st_mysql_const_lex_string MYSQL_CONST_LEX_STRING;
extern struct thd_alloc_service_st {
- void *(*thd_alloc_func)(void*, size_t);
- void *(*thd_calloc_func)(void*, size_t);
- char *(*thd_strdup_func)(void*, const char *);
- char *(*thd_strmake_func)(void*, const char *, size_t);
- void *(*thd_memdup_func)(void*, const void*, size_t);
- MYSQL_CONST_LEX_STRING *(*thd_make_lex_string_func)(void*,
+ void *(*thd_alloc_func)(THD*, size_t);
+ void *(*thd_calloc_func)(THD*, size_t);
+ char *(*thd_strdup_func)(THD*, const char *);
+ char *(*thd_strmake_func)(THD*, const char *, size_t);
+ void *(*thd_memdup_func)(THD*, const void*, size_t);
+ MYSQL_CONST_LEX_STRING *(*thd_make_lex_string_func)(THD*,
MYSQL_CONST_LEX_STRING *,
const char *, size_t, int);
} *thd_alloc_service;
-void *thd_alloc(void* thd, size_t size);
-void *thd_calloc(void* thd, size_t size);
-char *thd_strdup(void* thd, const char *str);
-char *thd_strmake(void* thd, const char *str, size_t size);
-void *thd_memdup(void* thd, const void* str, size_t size);
+void *thd_alloc(THD* thd, size_t size);
+void *thd_calloc(THD* thd, size_t size);
+char *thd_strdup(THD* thd, const char *str);
+char *thd_strmake(THD* thd, const char *str, size_t size);
+void *thd_memdup(THD* thd, const void* str, size_t size);
MYSQL_CONST_LEX_STRING
-*thd_make_lex_string(void* thd, MYSQL_CONST_LEX_STRING *lex_str,
+*thd_make_lex_string(THD* thd, MYSQL_CONST_LEX_STRING *lex_str,
const char *str, size_t size,
int allocate_lex_string);
+}
+extern "C" {
extern struct thd_autoinc_service_st {
- void (*thd_get_autoinc_func)(const void* thd,
+ void (*thd_get_autoinc_func)(const THD* thd,
unsigned long* off, unsigned long* inc);
} *thd_autoinc_service;
-void thd_get_autoinc(const void* thd,
+void thd_get_autoinc(const THD* thd,
unsigned long* off, unsigned long* inc);
+}
+extern "C" {
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);
- unsigned long (*thd_get_error_row_func)(const void* thd);
- void (*thd_inc_error_row_func)(void* thd);
- char *(*thd_get_error_context_description_func)(void* thd,
+ const char *(*thd_get_error_message_func)(const THD* thd);
+ unsigned int (*thd_get_error_number_func)(const THD* thd);
+ unsigned long (*thd_get_error_row_func)(const THD* thd);
+ void (*thd_inc_error_row_func)(THD* thd);
+ char *(*thd_get_error_context_description_func)(THD* thd,
char *buffer,
unsigned int length,
unsigned int max_query_length);
} *thd_error_context_service;
-const char *thd_get_error_message(const void* thd);
-unsigned int thd_get_error_number(const void* thd);
-unsigned long thd_get_error_row(const void* thd);
-void thd_inc_error_row(void* thd);
-char *thd_get_error_context_description(void* thd,
+const char *thd_get_error_message(const THD* thd);
+unsigned int thd_get_error_number(const THD* thd);
+unsigned long thd_get_error_row(const THD* thd);
+void thd_inc_error_row(THD* thd);
+char *thd_get_error_context_description(THD* thd,
char *buffer, unsigned int length,
unsigned int max_query_length);
+}
+extern "C" {
extern struct thd_rnd_service_st {
- double (*thd_rnd_ptr)(void* thd);
- void (*thd_c_r_p_ptr)(void* thd, char *to, size_t length);
+ double (*thd_rnd_ptr)(THD* thd);
+ void (*thd_c_r_p_ptr)(THD* thd, char *to, size_t length);
} *thd_rnd_service;
-double thd_rnd(void* thd);
-void thd_create_random_password(void* thd, char *to, size_t length);
+double thd_rnd(THD* thd);
+void thd_create_random_password(THD* thd, char *to, size_t length);
+}
+extern "C" {
typedef int MYSQL_THD_KEY_T;
extern struct thd_specifics_service_st {
int (*thd_key_create_func)(MYSQL_THD_KEY_T *key);
void (*thd_key_delete_func)(MYSQL_THD_KEY_T *key);
- void *(*thd_getspecific_func)(void* thd, MYSQL_THD_KEY_T key);
- int (*thd_setspecific_func)(void* thd, MYSQL_THD_KEY_T key, void *value);
+ void *(*thd_getspecific_func)(THD* thd, MYSQL_THD_KEY_T key);
+ int (*thd_setspecific_func)(THD* thd, MYSQL_THD_KEY_T key, void *value);
} *thd_specifics_service;
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);
+void* thd_getspecific(THD* thd, MYSQL_THD_KEY_T key);
+int thd_setspecific(THD* thd, MYSQL_THD_KEY_T key, void *value);
+}
typedef long my_time_t;
enum enum_mysql_timestamp_type
{
@@ -348,12 +387,15 @@ typedef struct st_mysql_time
my_bool neg;
enum enum_mysql_timestamp_type time_type;
} MYSQL_TIME;
+extern "C" {
extern struct thd_timezone_service_st {
- 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);
+ my_time_t (*thd_TIME_to_gmt_sec)(THD* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
+ void (*thd_gmt_sec_to_TIME)(THD* thd, MYSQL_TIME *ltime, my_time_t t);
} *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);
+my_time_t thd_TIME_to_gmt_sec(THD* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
+void thd_gmt_sec_to_TIME(THD* thd, MYSQL_TIME *ltime, my_time_t t);
+}
+extern "C" {
typedef enum _thd_wait_type_e {
THD_WAIT_SLEEP= 1,
THD_WAIT_DISKIO= 2,
@@ -369,11 +411,13 @@ typedef enum _thd_wait_type_e {
THD_WAIT_LAST= 12
} thd_wait_type;
extern struct thd_wait_service_st {
- void (*thd_wait_begin_func)(void*, int);
- void (*thd_wait_end_func)(void*);
+ void (*thd_wait_begin_func)(THD*, int);
+ void (*thd_wait_end_func)(THD*);
} *thd_wait_service;
-void thd_wait_begin(void* thd, int wait_type);
-void thd_wait_end(void* thd);
+void thd_wait_begin(THD* thd, int wait_type);
+void thd_wait_end(THD* thd);
+}
+extern "C" {
enum json_types
{
JSV_BAD_JSON=-1,
@@ -419,6 +463,8 @@ int json_escape_string(const char *str,const char *str_end,
char *json, char *json_end);
int json_unescape_json(const char *json_str, const char *json_end,
char *res, char *res_end);
+}
+}
struct st_mysql_xid {
long formatID;
long gtrid_length;
@@ -432,7 +478,7 @@ enum enum_mysql_show_type
SHOW_ULONGLONG, SHOW_CHAR, SHOW_CHAR_PTR,
SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE,
SHOW_SINT, SHOW_SLONG, SHOW_SLONGLONG, SHOW_SIMPLE_FUNC,
- SHOW_always_last
+ SHOW_SIZE_T, SHOW_always_last
};
enum enum_var_type
{
@@ -444,13 +490,13 @@ struct st_mysql_show_var {
enum enum_mysql_show_type type;
};
struct system_status_var;
-typedef int (*mysql_show_var_func)(void*, struct st_mysql_show_var*, void *, struct system_status_var *status_var, enum enum_var_type);
+typedef int (*mysql_show_var_func)(THD*, struct st_mysql_show_var*, void *, struct system_status_var *status_var, enum enum_var_type);
struct st_mysql_sys_var;
struct st_mysql_value;
-typedef int (*mysql_var_check_func)(void* thd,
+typedef int (*mysql_var_check_func)(THD* thd,
struct st_mysql_sys_var *var,
void *save, struct st_mysql_value *value);
-typedef void (*mysql_var_update_func)(void* thd,
+typedef void (*mysql_var_update_func)(THD* thd,
struct st_mysql_sys_var *var,
void *var_ptr, const void *save);
struct st_mysql_plugin
@@ -485,6 +531,7 @@ struct st_maria_plugin
const char *version_info;
unsigned int maturity;
};
+extern "C" {
enum enum_ftparser_mode
{
MYSQL_FTPARSER_SIMPLE_MODE= 0,
@@ -531,6 +578,7 @@ struct st_mysql_ftparser
int (*init)(MYSQL_FTPARSER_PARAM *param);
int (*deinit)(MYSQL_FTPARSER_PARAM *param);
};
+}
struct st_mysql_daemon
{
int interface_version;
@@ -555,27 +603,30 @@ struct st_mysql_value
int (*val_int)(struct st_mysql_value *, long long *intbuf);
int (*is_unsigned)(struct st_mysql_value *);
};
-int thd_in_lock_tables(const void* thd);
-int thd_tablespace_op(const void* thd);
-long long thd_test_options(const void* thd, long long test_options);
-int thd_sql_command(const void* thd);
-void **thd_ha_data(const void* thd, const struct handlerton *hton);
-void thd_storage_lock_wait(void* thd, long long value);
-int thd_tx_isolation(const void* thd);
-int thd_tx_is_read_only(const void* thd);
+extern "C" {
+int thd_in_lock_tables(const THD* thd);
+int thd_tablespace_op(const THD* thd);
+long long thd_test_options(const THD* thd, long long test_options);
+int thd_sql_command(const THD* thd);
+void thd_storage_lock_wait(THD* thd, long long value);
+int thd_tx_isolation(const THD* thd);
+int thd_tx_is_read_only(const THD* thd);
int mysql_tmpfile(const char *prefix);
-unsigned long thd_get_thread_id(const void* thd);
-void thd_get_xid(const void* thd, MYSQL_XID *xid);
-void mysql_query_cache_invalidate4(void* thd,
+unsigned long thd_get_thread_id(const THD* thd);
+void thd_get_xid(const THD* thd, MYSQL_XID *xid);
+void mysql_query_cache_invalidate4(THD* thd,
const char *key, unsigned int key_length,
int using_trx);
-void *thd_get_ha_data(const void* thd, const struct handlerton *hton);
-void thd_set_ha_data(void* thd, const struct handlerton *hton,
+void *thd_get_ha_data(const THD* thd, const struct handlerton *hton);
+void thd_set_ha_data(THD* thd, const struct handlerton *hton,
const void *ha_data);
-void thd_wakeup_subsequent_commits(void* thd, int wakeup_error);
+void thd_wakeup_subsequent_commits(THD* thd, int wakeup_error);
+}
+extern "C" {
struct st_mariadb_password_validation
{
int interface_version;
int (*validate_password)(const MYSQL_CONST_LEX_STRING *username,
const MYSQL_CONST_LEX_STRING *password);
};
+}
diff --git a/include/mysql/psi/mysql_socket.h b/include/mysql/psi/mysql_socket.h
index 086df145e59..99d3cb4795a 100644
--- a/include/mysql/psi/mysql_socket.h
+++ b/include/mysql/psi/mysql_socket.h
@@ -1018,8 +1018,7 @@ inline_mysql_socket_accept
int flags __attribute__ ((unused));
#endif
- MYSQL_SOCKET socket_accept= MYSQL_INVALID_SOCKET;
- socklen_t addr_length= (addr_len != NULL) ? *addr_len : 0;
+ MYSQL_SOCKET socket_accept;
#ifdef HAVE_PSI_SOCKET_INTERFACE
if (socket_listen.m_psi != NULL)
@@ -1032,10 +1031,9 @@ inline_mysql_socket_accept
/* Instrumented code */
#ifdef HAVE_ACCEPT4
- socket_accept.fd= accept4(socket_listen.fd, addr, &addr_length,
- SOCK_CLOEXEC);
+ socket_accept.fd= accept4(socket_listen.fd, addr, addr_len, SOCK_CLOEXEC);
#else
- socket_accept.fd= accept(socket_listen.fd, addr, &addr_length);
+ socket_accept.fd= accept(socket_listen.fd, addr, addr_len);
#ifdef FD_CLOEXEC
flags= fcntl(socket_accept.fd, F_GETFD);
if (flags != -1) {
@@ -1054,10 +1052,9 @@ inline_mysql_socket_accept
{
/* Non instrumented code */
#ifdef HAVE_ACCEPT4
- socket_accept.fd= accept4(socket_listen.fd, addr, &addr_length,
- SOCK_CLOEXEC);
+ socket_accept.fd= accept4(socket_listen.fd, addr, addr_len, SOCK_CLOEXEC);
#else
- socket_accept.fd= accept(socket_listen.fd, addr, &addr_length);
+ socket_accept.fd= accept(socket_listen.fd, addr, addr_len);
#ifdef FD_CLOEXEC
flags= fcntl(socket_accept.fd, F_GETFD);
if (flags != -1) {
@@ -1073,7 +1070,7 @@ inline_mysql_socket_accept
{
/* Initialize the instrument with the new socket descriptor and address */
socket_accept.m_psi= PSI_SOCKET_CALL(init_socket)
- (key, (const my_socket*)&socket_accept.fd, addr, addr_length);
+ (key, (const my_socket*)&socket_accept.fd, addr, *addr_len);
}
#endif
diff --git a/include/mysql/service_wsrep.h b/include/mysql/service_wsrep.h
index e7ac5e159cf..9a81ebb7e92 100644
--- a/include/mysql/service_wsrep.h
+++ b/include/mysql/service_wsrep.h
@@ -84,6 +84,8 @@ extern struct wsrep_service_st {
my_bool (*wsrep_get_debug_func)();
void (*wsrep_commit_ordered_func)(MYSQL_THD thd);
my_bool (*wsrep_thd_is_applying_func)(const MYSQL_THD thd);
+ my_bool (*wsrep_thd_has_ignored_error_func)(const MYSQL_THD thd);
+ void (*wsrep_thd_set_ignored_error_func)(MYSQL_THD thd, my_bool val);
} *wsrep_service;
#define MYSQL_SERVICE_WSREP_INCLUDED
@@ -124,6 +126,8 @@ extern struct wsrep_service_st {
#define wsrep_get_debug() wsrep_service->wsrep_get_debug_func()
#define wsrep_commit_ordered(T) wsrep_service->wsrep_commit_ordered_func(T)
#define wsrep_thd_is_applying(T) wsrep_service->wsrep_thd_is_applying_func(T)
+#define wsrep_thd_has_ignored_error(T) wsrep_service->wsrep_thd_has_ignored_error_func(T)
+#define wsrep_thd_set_ignored_error(T,V) wsrep_service->wsrep_thd_set_ignored_error_func(T,V)
#else
@@ -217,5 +221,8 @@ extern "C" my_bool wsrep_get_debug();
extern "C" void wsrep_commit_ordered(MYSQL_THD thd);
extern "C" my_bool wsrep_thd_is_applying(const MYSQL_THD thd);
+extern "C" my_bool wsrep_thd_has_ignored_error(const MYSQL_THD thd);
+extern "C" void wsrep_thd_set_ignored_error(MYSQL_THD thd, my_bool val);
+
#endif
#endif /* MYSQL_SERVICE_WSREP_INCLUDED */
diff --git a/include/mysql_com.h b/include/mysql_com.h
index 9e5215f29b3..4eafe148743 100644
--- a/include/mysql_com.h
+++ b/include/mysql_com.h
@@ -71,6 +71,7 @@
#define COLUMN_COMMENT_MAXLEN 1024
#define INDEX_COMMENT_MAXLEN 1024
#define TABLE_PARTITION_COMMENT_MAXLEN 1024
+#define DATABASE_COMMENT_MAXLEN 1024
/*
Maximum length of protocol packet.
@@ -600,6 +601,7 @@ enum enum_session_state_type
SESSION_TRACK_GTIDS,
SESSION_TRACK_TRANSACTION_CHARACTERISTICS, /* Transaction chistics */
SESSION_TRACK_TRANSACTION_STATE, /* Transaction state */
+ SESSION_TRACK_USER_VARIABLES,
SESSION_TRACK_always_at_the_end /* must be last */
};
diff --git a/include/thread_pool_priv.h b/include/thread_pool_priv.h
index 47f281192e9..0112ef9c434 100644
--- a/include/thread_pool_priv.h
+++ b/include/thread_pool_priv.h
@@ -82,8 +82,6 @@ bool do_command(THD *thd);
ensure that the proper MySQL Server logic attached to these events is
executed.
*/
-/* Initialise a new connection handler thread */
-bool init_new_connection_handler_thread();
/* Set up connection thread before use as execution thread */
bool setup_connection_thread_globals(THD *thd);
/* Prepare connection as part of connection set-up */
@@ -94,8 +92,6 @@ void mysql_audit_release(THD *thd);
bool thd_is_connection_alive(THD *thd);
/* Close connection with possible error code */
void close_connection(THD *thd, uint errcode);
-/* Decrement connection counter */
-void dec_connection_count();
/* Destroy THD object */
void delete_thd(THD *thd);
diff --git a/include/typelib.h b/include/typelib.h
index b20724fe05e..23df737d307 100644
--- a/include/typelib.h
+++ b/include/typelib.h
@@ -43,7 +43,7 @@ extern int find_type_with_warning(const char *x, TYPELIB *typelib,
extern int find_type(const char *x, const TYPELIB *typelib, unsigned int flags);
extern void make_type(char *to,unsigned int nr,TYPELIB *typelib);
extern const char *get_type(TYPELIB *typelib,unsigned int nr);
-extern TYPELIB *copy_typelib(MEM_ROOT *root, TYPELIB *from);
+extern TYPELIB *copy_typelib(MEM_ROOT *root, const TYPELIB *from);
extern TYPELIB sql_protocol_typelib;
diff --git a/include/wsrep.h b/include/wsrep.h
index fde5c5226e7..dbdb746409b 100644
--- a/include/wsrep.h
+++ b/include/wsrep.h
@@ -46,12 +46,6 @@
if (WSREP(thd) && !thd->lex->no_write_to_binlog \
&& wsrep_to_isolation_begin(thd, db_, table_, table_list_)) goto wsrep_error_label;
-#define WSREP_DEBUG(...) \
- if (wsrep_debug) WSREP_LOG(sql_print_information, ##__VA_ARGS__)
-#define WSREP_INFO(...) WSREP_LOG(sql_print_information, ##__VA_ARGS__)
-#define WSREP_WARN(...) WSREP_LOG(sql_print_warning, ##__VA_ARGS__)
-#define WSREP_ERROR(...) WSREP_LOG(sql_print_error, ##__VA_ARGS__)
-
#define WSREP_SYNC_WAIT(thd_, before_) \
{ if (WSREP_CLIENT(thd_) && \
wsrep_sync_wait(thd_, before_)) goto wsrep_error_label; }
diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt
index 529354389b5..c179575f006 100644
--- a/libmysqld/CMakeLists.txt
+++ b/libmysqld/CMakeLists.txt
@@ -55,7 +55,8 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
../sql/item_subselect.cc ../sql/item_sum.cc ../sql/item_timefunc.cc
../sql/item_xmlfunc.cc ../sql/item_jsonfunc.cc
../sql/key.cc ../sql/lock.cc ../sql/log.cc
- ../sql/log_event.cc ../sql/mf_iocache.cc ../sql/my_decimal.cc
+ ../sql/log_event.cc ../sql/log_event_server.cc
+ ../sql/mf_iocache.cc ../sql/my_decimal.cc
../sql/net_serv.cc ../sql/opt_range.cc ../sql/opt_sum.cc
../sql/parse_file.cc ../sql/procedure.cc ../sql/protocol.cc
../sql/records.cc ../sql/repl_failsafe.cc ../sql/rpl_filter.cc
@@ -100,7 +101,9 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
../sql/multi_range_read.cc
../sql/opt_index_cond_pushdown.cc
../sql/opt_subselect.cc
- ../sql/create_options.cc ../sql/rpl_utility.cc
+ ../sql/create_options.cc
+ ../sql/rpl_utility.cc
+ ../sql/rpl_utility_server.cc
../sql/rpl_reporting.cc
../sql/sql_expression_cache.cc
../sql/my_apc.cc ../sql/my_apc.h
@@ -112,8 +115,8 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
../sql/sql_type.cc ../sql/sql_type.h
../sql/sql_mode.cc
../sql/sql_type_json.cc
+ ../sql/sql_type_geom.cc
../sql/table_cache.cc ../sql/mf_iocache_encr.cc
- ../sql/item_inetfunc.cc
../sql/wsrep_dummy.cc ../sql/encryption.cc
../sql/item_windowfunc.cc ../sql/sql_window.cc
../sql/sql_cte.cc
@@ -153,7 +156,7 @@ SET(LIBS
dbug strings mysys mysys_ssl pcre vio
${ZLIB_LIBRARY} ${SSL_LIBRARIES}
${LIBWRAP} ${LIBCRYPT} ${LIBDL}
- ${MYSQLD_STATIC_PLUGIN_LIBS}
+ ${EMBEDDED_PLUGIN_LIBS}
sql_embedded
)
@@ -295,7 +298,7 @@ mysql_stmt_next_result
# Charsets
my_charset_bin
my_charset_latin1
-my_charset_utf8_general_ci
+my_charset_utf8mb3_general_ci
# Client plugins
mysql_client_find_plugin
mysql_client_register_plugin
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index 09e46be19a1..1d5133794d2 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -560,7 +560,7 @@ int init_embedded_server(int argc, char **argv, char **groups)
remaining_argv= *argvp;
/* Must be initialized early for comparison of options name */
- system_charset_info= &my_charset_utf8_general_ci;
+ system_charset_info= &my_charset_utf8mb3_general_ci;
sys_var_init();
int ho_error= handle_early_options();
@@ -892,13 +892,6 @@ static char *dup_str_aux(MEM_ROOT *root, const char *from, uint length,
}
-static char *dup_str_aux(MEM_ROOT *root, const char *from,
- CHARSET_INFO *fromcs, CHARSET_INFO *tocs)
-{
- return dup_str_aux(root, from, (uint) strlen(from), fromcs, tocs);
-}
-
-
static char *dup_str_aux(MEM_ROOT *root, const LEX_CSTRING &from,
CHARSET_INFO *fromcs, CHARSET_INFO *tocs)
{
diff --git a/libmysqld/libmysql.c b/libmysqld/libmysql.c
index bd5176566d6..d931b251bfd 100644
--- a/libmysqld/libmysql.c
+++ b/libmysqld/libmysql.c
@@ -4920,3 +4920,119 @@ ulong STDCALL mysql_net_field_length(uchar **packet)
{
return net_field_length(packet);
}
+
+/********************************************************************
+ Dummy functions to avoid linking with libmarias3 / libcurl
+*********************************************************************/
+
+#if defined(WITH_S3_STORAGE_ENGINE) || !defined(FIX_BEFORE_RELESE)
+C_MODE_START
+
+#include <stdint.h>
+struct ms3_st;
+typedef struct ms3_st ms3_st;
+struct ms3_list_st;
+typedef struct ms3_list_st ms3_list_st;
+struct ms3_status_st;
+typedef struct ms3_status_st ms3_status_st;
+enum ms3_set_option_t
+{
+ SOME_OPTIONS
+};
+typedef enum ms3_set_option_t ms3_set_option_t;
+typedef void *(*ms3_malloc_callback)(size_t size);
+typedef void (*ms3_free_callback)(void *ptr);
+typedef void *(*ms3_realloc_callback)(void *ptr, size_t size);
+typedef char *(*ms3_strdup_callback)(const char *str);
+typedef void *(*ms3_calloc_callback)(size_t nmemb, size_t size);
+
+
+uint8_t ms3_library_init_malloc(ms3_malloc_callback m,
+ ms3_free_callback f, ms3_realloc_callback r,
+ ms3_strdup_callback s, ms3_calloc_callback c)
+{
+ return 1;
+}
+void ms3_library_deinit(void)
+{
+}
+
+ms3_st *ms3_init(const char *s3key, const char *s3secret,
+ const char *region,
+ const char *base_domain)
+{
+ return 0;
+}
+
+uint8_t ms3_set_option(ms3_st *ms3, ms3_set_option_t option, void *value)
+{
+ return 0;
+}
+
+void ms3_deinit(ms3_st *ms3)
+{}
+
+const char *ms3_server_error(ms3_st *ms3)
+{
+ return 0;
+}
+const char *ms3_error(uint8_t errcode)
+{
+ return 0;
+}
+
+uint8_t ms3_list(ms3_st *ms3, const char *bucket, const char *prefix,
+ ms3_list_st **list)
+{
+ return 0;
+}
+
+uint8_t ms3_list_dir(ms3_st *ms3, const char *bucket, const char *prefix,
+ ms3_list_st **list)
+{
+ return 0;
+}
+
+void ms3_list_free(ms3_list_st *list)
+{}
+
+uint8_t ms3_put(ms3_st *ms3, const char *bucket, const char *key,
+ const uint8_t *data, size_t length)
+{
+ return 1;
+}
+
+uint8_t ms3_get(ms3_st *ms3, const char *bucket, const char *key,
+ uint8_t **data, size_t *length)
+{
+ return 1;
+}
+
+
+void ms3_free(uint8_t *data)
+{}
+
+uint8_t ms3_delete(ms3_st *ms3, const char *bucket, const char *key)
+{
+ return 1;
+}
+
+
+uint8_t ms3_status(ms3_st *ms3, const char *bucket, const char *key,
+ ms3_status_st *status)
+{
+ return 1;
+}
+
+uint8_t ms3_move(ms3_st *ms3, const char *source_bucket, const char *source_key,
+ const char *dest_bucket, const char *dest_key)
+{
+ return 1;
+}
+
+void ms3_debug()
+{
+}
+
+C_MODE_END
+#endif /* WITH_S3_STORAGE_ENGINE */
diff --git a/man/comp_err.1 b/man/comp_err.1
index 0eab8518903..87b9f6689bf 100644
--- a/man/comp_err.1
+++ b/man/comp_err.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBCOMP_ERR\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBCOMP_ERR\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -247,7 +247,7 @@ Display version information and exit\&.
.SH "COPYRIGHT"
.br
.PP
-Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2015 MariaDB Foundation
+Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2019 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
diff --git a/man/galera_new_cluster.1 b/man/galera_new_cluster.1
index e3f7d6670a0..bf29b6d6765 100644
--- a/man/galera_new_cluster.1
+++ b/man/galera_new_cluster.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBGALERA_NEW_CLUSTER\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBGALERA_NEW_CLUSTER\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/galera_recovery.1 b/man/galera_recovery.1
index deb51f39cd9..b7eeb4e00bb 100644
--- a/man/galera_recovery.1
+++ b/man/galera_recovery.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBGALERA_RECOVERY\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBGALERA_RECOVERY\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/innochecksum.1 b/man/innochecksum.1
index 8c63237c1e1..0937c4bf342 100644
--- a/man/innochecksum.1
+++ b/man/innochecksum.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBINNOCHECKSUM\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBINNOCHECKSUM\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -225,7 +225,7 @@ Displays version information and exits\&.
.SH "COPYRIGHT"
.br
.PP
-Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2015 MariaDB Foundation
+Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2019 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
diff --git a/man/mariabackup.1 b/man/mariabackup.1
index f3f24db88cf..cb494c6866f 100644
--- a/man/mariabackup.1
+++ b/man/mariabackup.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIABACKUP\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMARIABACKUP\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mariadb-service-convert.1 b/man/mariadb-service-convert.1
index a7c99f712e4..a2437b79cb5 100644
--- a/man/mariadb-service-convert.1
+++ b/man/mariadb-service-convert.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADB-SERVICE-CONVERT\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMARIADB-SERVICE-CONVERT\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mbstream.1 b/man/mbstream.1
index 7508aaf6326..f25c38e59ef 100644
--- a/man/mbstream.1
+++ b/man/mbstream.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMBSTREAM\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMBSTREAM\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/msql2mysql.1 b/man/msql2mysql.1
index 58829bc6d50..7cc1a417f5a 100644
--- a/man/msql2mysql.1
+++ b/man/msql2mysql.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMSQL2MYSQL\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMSQL2MYSQL\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -53,7 +53,7 @@ utility to make the function name substitutions\&. See
.SH "COPYRIGHT"
.br
.PP
-Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2015 MariaDB Foundation
+Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2019 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
diff --git a/man/my_print_defaults.1 b/man/my_print_defaults.1
index 7f11cdc2e66..ae151743d42 100644
--- a/man/my_print_defaults.1
+++ b/man/my_print_defaults.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMY_PRINT_DEFAULTS" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMY_PRINT_DEFAULTS" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -205,7 +205,7 @@ Display version information and exit\&.
.SH "COPYRIGHT"
.br
.PP
-Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2015 MariaDB Foundation
+Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2019 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
diff --git a/man/my_safe_process.1 b/man/my_safe_process.1
index 296f2e43997..9d88cfacaf3 100644
--- a/man/my_safe_process.1
+++ b/man/my_safe_process.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMY_SAFE_PROCESS\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMY_SAFE_PROCESS\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/myisam_ftdump.1 b/man/myisam_ftdump.1
index 239c89577d9..0ecb777bd9f 100644
--- a/man/myisam_ftdump.1
+++ b/man/myisam_ftdump.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYISAM_FTDUMP\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMYISAM_FTDUMP\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -235,7 +235,7 @@ Verbose mode\&. Print more output about what the program does\&.
.SH "COPYRIGHT"
.br
.PP
-Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2015 MariaDB Foundation
+Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2019 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
diff --git a/man/myisamchk.1 b/man/myisamchk.1
index f08d5b11a20..456ffbbbf5c 100644
--- a/man/myisamchk.1
+++ b/man/myisamchk.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYISAMCHK\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMYISAMCHK\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -2507,7 +2507,7 @@ instead of
.SH "COPYRIGHT"
.br
.PP
-Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2015 MariaDB Foundation
+Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2019 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
diff --git a/man/myisamlog.1 b/man/myisamlog.1
index f46b09660d2..77ddaded524 100644
--- a/man/myisamlog.1
+++ b/man/myisamlog.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYISAMLOG\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMYISAMLOG\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -218,7 +218,7 @@ Display version information\&.
.SH "COPYRIGHT"
.br
.PP
-Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2015 MariaDB Foundation
+Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2019 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
diff --git a/man/myisampack.1 b/man/myisampack.1
index 10b5457aaf6..859277bdbe5 100644
--- a/man/myisampack.1
+++ b/man/myisampack.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYISAMPACK\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMYISAMPACK\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -825,7 +825,7 @@ option to
.SH "COPYRIGHT"
.br
.PP
-Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2015 MariaDB Foundation
+Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2019 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
diff --git a/man/mysql-stress-test.pl.1 b/man/mysql-stress-test.pl.1
index 816d4922607..67fb8e8a1af 100644
--- a/man/mysql-stress-test.pl.1
+++ b/man/mysql-stress-test.pl.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYSQL\-STRESS\-TE" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMYSQL\-STRESS\-TE" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -482,7 +482,7 @@ Verbose mode\&. Print more information about what the program does\&.
.SH "COPYRIGHT"
.br
.PP
-Copyright \(co 2007, 2010, Oracle and/or its affiliates, 2010-2015 MariaDB Foundation
+Copyright \(co 2007, 2010, Oracle and/or its affiliates, 2010-2019 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
diff --git a/man/mysql-test-run.pl.1 b/man/mysql-test-run.pl.1
index 5f4c17858bd..3dbef47b189 100644
--- a/man/mysql-test-run.pl.1
+++ b/man/mysql-test-run.pl.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYSQL\-TEST\-RUN\" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMYSQL\-TEST\-RUN\" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -2312,7 +2312,7 @@ Search the server log for errors or warning after each test and report any suspi
.SH "COPYRIGHT"
.br
.PP
-Copyright \(co 2007, 2010, Oracle and/or its affiliates, 2010-2015 MariaDB Foundation
+Copyright \(co 2007, 2010, Oracle and/or its affiliates, 2010-2019 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
diff --git a/man/mysql.1 b/man/mysql.1
index c2eda6d7e72..519581394db 100644
--- a/man/mysql.1
+++ b/man/mysql.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYSQL\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMYSQL\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -3092,7 +3092,7 @@ option\&.
.SH "COPYRIGHT"
.br
.PP
-Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2015 MariaDB Foundation
+Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2019 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
diff --git a/man/mysql.server.1 b/man/mysql.server.1
index 2f89b889a6d..28a00c19a8d 100644
--- a/man/mysql.server.1
+++ b/man/mysql.server.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYSQL\&.SERVER\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMYSQL\&.SERVER\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -166,7 +166,7 @@ The login user name to use for running
.SH "COPYRIGHT"
.br
.PP
-Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2015 MariaDB Foundation
+Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2019 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
diff --git a/man/mysql_client_test.1 b/man/mysql_client_test.1
index 9b29f595c4d..78484cef062 100644
--- a/man/mysql_client_test.1
+++ b/man/mysql_client_test.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYSQL_CLIENT_TEST" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMYSQL_CLIENT_TEST" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -319,7 +319,7 @@ mysql\-test/var\&.
.SH "COPYRIGHT"
.br
.PP
-Copyright \(co 2007, 2010, Oracle and/or its affiliates, 2010-2015 MariaDB Foundation
+Copyright \(co 2007, 2010, Oracle and/or its affiliates, 2010-2019 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
diff --git a/man/mysql_config.1 b/man/mysql_config.1
index 6664bfa6a0f..bbb8247152b 100644
--- a/man/mysql_config.1
+++ b/man/mysql_config.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYSQL_CONFIG\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMYSQL_CONFIG\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -233,7 +233,7 @@ this way, be sure to invoke it within backtick (\(lq`\(rq) characters\&. That te
.SH "COPYRIGHT"
.br
.PP
-Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2015 MariaDB Foundation
+Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2019 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
diff --git a/man/mysql_convert_table_format.1 b/man/mysql_convert_table_format.1
index 95aa46aacb6..faa35afbe56 100644
--- a/man/mysql_convert_table_format.1
+++ b/man/mysql_convert_table_format.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYSQL_CONVERT_TAB" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMYSQL_CONVERT_TAB" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -26,7 +26,7 @@ by default)\&.
is written in Perl and requires that the
DBI
and
-DBD::mysql
+DBD::MariaDB
Perl modules be installed (see
Section\ \&2.15, \(lqPerl Installation Notes\(rq)\&.
.PP
@@ -208,7 +208,7 @@ Display version information and exit\&.
.SH "COPYRIGHT"
.br
.PP
-Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2015 MariaDB Foundation
+Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2019 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
diff --git a/man/mysql_find_rows.1 b/man/mysql_find_rows.1
index 73475da4e01..b00819a6954 100644
--- a/man/mysql_find_rows.1
+++ b/man/mysql_find_rows.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYSQL_FIND_ROWS\F" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMYSQL_FIND_ROWS\F" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -144,7 +144,7 @@ Start output from this row\&.
.SH "COPYRIGHT"
.br
.PP
-Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2015 MariaDB Foundation
+Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2019 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
diff --git a/man/mysql_fix_extensions.1 b/man/mysql_fix_extensions.1
index f817f2d70ba..152ea99948f 100644
--- a/man/mysql_fix_extensions.1
+++ b/man/mysql_fix_extensions.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYSQL_FIX_EXTENSI" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMYSQL_FIX_EXTENSI" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -54,7 +54,7 @@ shell> \fBmysql_fix_extensions \fR\fB\fIdata_dir\fR\fR
.SH "COPYRIGHT"
.br
.PP
-Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2015 MariaDB Foundation
+Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2019 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
diff --git a/man/mysql_install_db.1 b/man/mysql_install_db.1
index 02dea4b0f90..6ab81344de9 100644
--- a/man/mysql_install_db.1
+++ b/man/mysql_install_db.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYSQL_INSTALL_DB\FR" "1" "4 April 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMYSQL_INSTALL_DB\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysql_ldb.1 b/man/mysql_ldb.1
index fb60c382912..d2fa02a6318 100644
--- a/man/mysql_ldb.1
+++ b/man/mysql_ldb.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYSQL_LDB\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMYSQL_LDB\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysql_plugin.1 b/man/mysql_plugin.1
index 267110ed235..856b127c4cc 100644
--- a/man/mysql_plugin.1
+++ b/man/mysql_plugin.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYSQL_PLUGIN\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMYSQL_PLUGIN\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@@ -361,7 +361,7 @@ Display version information and exit\&.
.SH "COPYRIGHT"
.br
.PP
-Copyright \(co 1997, 2013, Oracle and/or its affiliates. All rights reserved., 2013-2015 MariaDB Foundation
+Copyright \(co 1997, 2013, Oracle and/or its affiliates. All rights reserved., 2013-2019 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
diff --git a/man/mysql_secure_installation.1 b/man/mysql_secure_installation.1
index 6c9ad6e95f9..871a833b46f 100644
--- a/man/mysql_secure_installation.1
+++ b/man/mysql_secure_installation.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYSQL_SECURE_INST" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMYSQL_SECURE_INST" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -153,7 +153,7 @@ Other unrecognized options will be passed on to the server\&.
.SH "COPYRIGHT"
.br
.PP
-Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2017 MariaDB Foundation
+Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2019 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
diff --git a/man/mysql_setpermission.1 b/man/mysql_setpermission.1
index b91d1c93148..f2f5e3e039c 100644
--- a/man/mysql_setpermission.1
+++ b/man/mysql_setpermission.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYSQL_SETPERMISSI" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMYSQL_SETPERMISSI" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -25,7 +25,7 @@ is a Perl script that was originally written and contributed by Luuk de Boer\&.
is written in Perl and requires that the
DBI
and
-DBD::mysql
+DBD::MariaDB
Perl modules be installed\&.
.PP
Invoke
@@ -154,7 +154,7 @@ The MariaDB user name to use when connecting to the server\&.
.SH "COPYRIGHT"
.br
.PP
-Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2015 MariaDB Foundation
+Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2019 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
diff --git a/man/mysql_tzinfo_to_sql.1 b/man/mysql_tzinfo_to_sql.1
index 7eb148b94e4..ad4d6023d86 100644
--- a/man/mysql_tzinfo_to_sql.1
+++ b/man/mysql_tzinfo_to_sql.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYSQL_TZINFO_TO_S" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMYSQL_TZINFO_TO_S" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -105,7 +105,7 @@ After running
.SH "COPYRIGHT"
.br
.PP
-Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2015 MariaDB Foundation
+Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2019 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
diff --git a/man/mysql_upgrade.1 b/man/mysql_upgrade.1
index 42307eefd4b..61712784758 100644
--- a/man/mysql_upgrade.1
+++ b/man/mysql_upgrade.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYSQL_UPGRADE\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMYSQL_UPGRADE\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -696,7 +696,7 @@ runs\&.
.SH "COPYRIGHT"
.br
.PP
-Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2015 MariaDB Foundation
+Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2019 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
diff --git a/man/mysql_waitpid.1 b/man/mysql_waitpid.1
index 810f64aa6ab..b77b8729764 100644
--- a/man/mysql_waitpid.1
+++ b/man/mysql_waitpid.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYSQL_WAITPID\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMYSQL_WAITPID\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -113,7 +113,7 @@ Display version information and exit\&.
.SH "COPYRIGHT"
.br
.PP
-Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2015 MariaDB Foundation
+Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2019 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
diff --git a/man/mysqlaccess.1 b/man/mysqlaccess.1
index cfd4cecdb1a..34894cf0760 100644
--- a/man/mysqlaccess.1
+++ b/man/mysqlaccess.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYSQLACCESS\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMYSQLACCESS\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -415,7 +415,7 @@ error will occur when you run
.SH "COPYRIGHT"
.br
.PP
-Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2015 MariaDB Foundation
+Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2019 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
diff --git a/man/mysqladmin.1 b/man/mysqladmin.1
index 9fc0ee974dd..4f39c059894 100644
--- a/man/mysqladmin.1
+++ b/man/mysqladmin.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYSQLADMIN\FR" "1" "27 June 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMYSQLADMIN\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysqlbinlog.1 b/man/mysqlbinlog.1
index 4e02226106b..243ae677268 100644
--- a/man/mysqlbinlog.1
+++ b/man/mysqlbinlog.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYSQLBINLOG\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMYSQLBINLOG\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -2107,7 +2107,7 @@ option can be used to prevent this header from being written\&.
.SH "COPYRIGHT"
.br
.PP
-Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2015 MariaDB Foundation
+Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2019 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
diff --git a/man/mysqlcheck.1 b/man/mysqlcheck.1
index 946b9325404..7415082b478 100644
--- a/man/mysqlcheck.1
+++ b/man/mysqlcheck.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYSQLCHECK\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMYSQLCHECK\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -1144,7 +1144,7 @@ when these statements should not be sent to replication slaves or run when using
.SH "COPYRIGHT"
.br
.PP
-Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2015 MariaDB Foundation
+Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2019 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
diff --git a/man/mysqld.8 b/man/mysqld.8
index a8ea2253d27..67daad786a3 100644
--- a/man/mysqld.8
+++ b/man/mysqld.8
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYSQLD\FR" "8" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMYSQLD\FR" "8" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -45,7 +45,7 @@ the MariaDB Knowledge Base\&.
.SH "COPYRIGHT"
.br
.PP
-Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2015 MariaDB Foundation
+Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2019 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
diff --git a/man/mysqld_multi.1 b/man/mysqld_multi.1
index a886e9fc6fc..7f1572e1352 100644
--- a/man/mysqld_multi.1
+++ b/man/mysqld_multi.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYSQLD_MULTI\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMYSQLD_MULTI\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -668,7 +668,7 @@ user = jani
.SH "COPYRIGHT"
.br
.PP
-Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2016 MariaDB Foundation
+Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2019 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
diff --git a/man/mysqld_safe.1 b/man/mysqld_safe.1
index 98e0c6ee81b..5f824dc96f2 100644
--- a/man/mysqld_safe.1
+++ b/man/mysqld_safe.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYSQLD_SAFE\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMYSQLD_SAFE\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -870,7 +870,7 @@ file in the data directory\&.
.SH "COPYRIGHT"
.br
.PP
-Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2015 MariaDB Foundation
+Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2019 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
diff --git a/man/mysqld_safe_helper.1 b/man/mysqld_safe_helper.1
index 68cd74152d5..23d932a94cc 100644
--- a/man/mysqld_safe_helper.1
+++ b/man/mysqld_safe_helper.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYSQLD_SAFE_HELPER\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMYSQLD_SAFE_HELPER\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysqldump.1 b/man/mysqldump.1
index e1a8141e69b..fae61fbdfd9 100644
--- a/man/mysqldump.1
+++ b/man/mysqldump.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYSQLDUMP\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMYSQLDUMP\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -499,6 +499,22 @@ Compress all information sent between the client and the server if both support
.sp -1
.IP \(bu 2.3
.\}
+.\" mysqldump: copy-s3-tables option
+.\" copy-s3-tables option: mysqldump
+\fB\-\-copy\-s3\-tables\fR
+.sp
+By default S3 tables are ignored\&. With this option set, the result file will contain a CREATE statement
+for a similar Aria table, followed by the table data and ending with an ALTER TABLE xxx ENGINE=S3\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
.\" mysqldump: create-options option
.\" create-options option: mysqldump
\fB\-\-create\-options\fR,
@@ -2673,7 +2689,7 @@ If you encounter problems backing up views, please read the section that covers
.SH "COPYRIGHT"
.br
.PP
-Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2015 MariaDB Foundation
+Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2019 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
diff --git a/man/mysqldumpslow.1 b/man/mysqldumpslow.1
index 0a0d95359f2..13018c4850e 100644
--- a/man/mysqldumpslow.1
+++ b/man/mysqldumpslow.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYSQLDUMPSLOW\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMYSQLDUMPSLOW\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -325,7 +325,7 @@ Count: 3 Time=2\&.13s (6s) Lock=0\&.00s (0s) Rows=0\&.0 (0), root[root]@local
.SH "COPYRIGHT"
.br
.PP
-Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2015 MariaDB Foundation
+Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2019 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
diff --git a/man/mysqlhotcopy.1 b/man/mysqlhotcopy.1
index 4719986a5a5..98d14caa7dd 100644
--- a/man/mysqlhotcopy.1
+++ b/man/mysqlhotcopy.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYSQLHOTCOPY\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMYSQLHOTCOPY\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -520,7 +520,7 @@ shell> \fBperldoc mysqlhotcopy\fR
.SH "COPYRIGHT"
.br
.PP
-Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2015 MariaDB Foundation
+Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2019 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
diff --git a/man/mysqlimport.1 b/man/mysqlimport.1
index 2e9dc854669..22fcd8d124e 100644
--- a/man/mysqlimport.1
+++ b/man/mysqlimport.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYSQLIMPORT\FR" "1" "21 May 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMYSQLIMPORT\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -863,7 +863,7 @@ shell> \fBmysql \-e \'SELECT * FROM imptest\' test\fR
.SH "COPYRIGHT"
.br
.PP
-Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2015 MariaDB Foundation
+Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2019 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
diff --git a/man/mysqlshow.1 b/man/mysqlshow.1
index 866d6f1e8dc..4fc35d966fa 100644
--- a/man/mysqlshow.1
+++ b/man/mysqlshow.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYSQLSHOW\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMYSQLSHOW\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -705,7 +705,7 @@ Display version information and exit\&.
.SH "COPYRIGHT"
.br
.PP
-Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2015 MariaDB Foundation
+Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2019 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
diff --git a/man/mysqlslap.1 b/man/mysqlslap.1
index 18100f70d49..7cca703b0d5 100644
--- a/man/mysqlslap.1
+++ b/man/mysqlslap.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYSQLSLAP\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMYSQLSLAP\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -1155,7 +1155,7 @@ Display version information and exit\&.
.SH "COPYRIGHT"
.br
.PP
-Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2015 MariaDB Foundation
+Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2019 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
diff --git a/man/mysqltest.1 b/man/mysqltest.1
index bb91f68021c..4aa3efda8e1 100644
--- a/man/mysqltest.1
+++ b/man/mysqltest.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYSQLTEST\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMYSQLTEST\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -1070,7 +1070,7 @@ statement is wrapped inside a view\&.
.SH "COPYRIGHT"
.br
.PP
-Copyright \(co 2007, 2010, Oracle and/or its affiliates, 2010-2015 MariaDB Foundation
+Copyright \(co 2007, 2010, Oracle and/or its affiliates, 2010-2019 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
diff --git a/man/perror.1 b/man/perror.1
index fa77d382439..31d033571f1 100644
--- a/man/perror.1
+++ b/man/perror.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBPERROR\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBPERROR\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -143,7 +143,7 @@ Display version information and exit\&.
.SH "COPYRIGHT"
.br
.PP
-Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2015 MariaDB Foundation
+Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2019 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
diff --git a/man/replace.1 b/man/replace.1
index 41b0a8fb71e..5c5c5b88131 100644
--- a/man/replace.1
+++ b/man/replace.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBREPLACE\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBREPLACE\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -153,7 +153,7 @@ Display version information and exit\&.
.SH "COPYRIGHT"
.br
.PP
-Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2015 MariaDB Foundation
+Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2019 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
diff --git a/man/resolve_stack_dump.1 b/man/resolve_stack_dump.1
index 130ea1e915d..59f1015082a 100644
--- a/man/resolve_stack_dump.1
+++ b/man/resolve_stack_dump.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBRESOLVE_STACK_DUM" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBRESOLVE_STACK_DUM" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -110,7 +110,7 @@ Display version information and exit\&.
.SH "COPYRIGHT"
.br
.PP
-Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2015 MariaDB Foundation
+Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2019 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
diff --git a/man/resolveip.1 b/man/resolveip.1
index 46361eab2f8..eebec3f2d96 100644
--- a/man/resolveip.1
+++ b/man/resolveip.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBRESOLVEIP\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBRESOLVEIP\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -92,7 +92,7 @@ Display version information and exit\&.
.SH "COPYRIGHT"
.br
.PP
-Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2015 MariaDB Foundation
+Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2019 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
diff --git a/man/tokuft_logprint.1 b/man/tokuft_logprint.1
index c97f7e19f69..c6b4d17e243 100644
--- a/man/tokuft_logprint.1
+++ b/man/tokuft_logprint.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBTOKUFT_LOGPRINT\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBTOKUFT_LOGPRINT\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/tokuftdump.1 b/man/tokuftdump.1
index a9c900e0045..04934f754d7 100644
--- a/man/tokuftdump.1
+++ b/man/tokuftdump.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBTOKUFTDUMP\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBTOKUFTDUMP\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -223,7 +223,7 @@ Provide summary info\&.
.SH "COPYRIGHT"
.br
.PP
-Copyright 2016 MariaDB Foundation
+Copyright 2016-2019 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
diff --git a/man/wsrep_sst_common.1 b/man/wsrep_sst_common.1
index 606c668b004..e332bf226cd 100644
--- a/man/wsrep_sst_common.1
+++ b/man/wsrep_sst_common.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBWSREP_SST_COMMON\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBWSREP_SST_COMMON\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/wsrep_sst_mariabackup.1 b/man/wsrep_sst_mariabackup.1
index 225cc728fad..87957dfb889 100644
--- a/man/wsrep_sst_mariabackup.1
+++ b/man/wsrep_sst_mariabackup.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBWSREP_SST_MARIABACKUP\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBWSREP_SST_MARIABACKUP\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/wsrep_sst_mysqldump.1 b/man/wsrep_sst_mysqldump.1
index d6ab1a01b4c..d72eff8db97 100644
--- a/man/wsrep_sst_mysqldump.1
+++ b/man/wsrep_sst_mysqldump.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBWSREP_SST_MYSQLDUMP\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBWSREP_SST_MYSQLDUMP\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/wsrep_sst_rsync.1 b/man/wsrep_sst_rsync.1
index ca3451a8998..09e7b26d614 100644
--- a/man/wsrep_sst_rsync.1
+++ b/man/wsrep_sst_rsync.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBWSREP_SST_RSYNC\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBWSREP_SST_RSYNC\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/wsrep_sst_rsync_wan.1 b/man/wsrep_sst_rsync_wan.1
index 81bbf27305f..c207c31caed 100644
--- a/man/wsrep_sst_rsync_wan.1
+++ b/man/wsrep_sst_rsync_wan.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBWSREP_SST_RSYNC_WAN\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBWSREP_SST_RSYNC_WAN\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/mysql-test/asan.supp b/mysql-test/asan.supp
new file mode 100644
index 00000000000..1bfd4fd0b17
--- /dev/null
+++ b/mysql-test/asan.supp
@@ -0,0 +1 @@
+# Asan suppressions
diff --git a/mysql-test/include/common-tests.inc b/mysql-test/include/common-tests.inc
index 347760bf3c0..9c6b29858c8 100644
--- a/mysql-test/include/common-tests.inc
+++ b/mysql-test/include/common-tests.inc
@@ -1412,9 +1412,9 @@ drop table tmp;
# big table done
-SET BIG_TABLES=1;
+set tmp_memory_table_size=0;
select distinct concat(fld3," ",fld3) as namn from t2,t3 where t2.fld1=t3.t2nr order by namn limit 10;
-SET BIG_TABLES=0;
+set tmp_memory_table_size=default;
select distinct concat(fld3," ",fld3) from t2,t3 where t2.fld1=t3.t2nr order by fld3 limit 10;
select distinct fld5 from t2 limit 10;
@@ -1423,9 +1423,9 @@ select distinct fld5 from t2 limit 10;
#
select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
-SET BIG_TABLES=1; # Force use of MyISAM
+set tmp_memory_table_size=0;
select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
-SET BIG_TABLES=0;
+set tmp_memory_table_size=default;
select distinct fld3,repeat("a",length(fld3)),count(*) from t2 group by companynr,fld3 limit 100,10;
#
diff --git a/mysql-test/include/concurrent.inc b/mysql-test/include/concurrent.inc
index c6d8775af6b..5a1f8c6eb89 100644
--- a/mysql-test/include/concurrent.inc
+++ b/mysql-test/include/concurrent.inc
@@ -31,20 +31,19 @@ SET SQL_MODE="";
# Show prerequisites for this test.
#
SELECT @@global.tx_isolation;
-SELECT @@global.innodb_locks_unsafe_for_binlog;
#
-# When innodb_locks_unsafe_for_binlog is not set (zero), which is the
-# default, InnoDB takes "next-key locks"/"gap locks". This means it
+# With the transaction isolation level REPEATABLE READ (the default)
+# or SERIALIZEBLE, InnoDB takes "next-key locks"/"gap locks". This means it
# locks the gap before the keys that it accessed to find the rows to
# use for a statement. In this case we have to expect some more lock
-# wait timeouts in the tests below as if innodb_locks_unsafe_for_binlog
-# is set (non-zero). In the latter case no "next-key locks"/"gap locks"
-# are taken and locks on keys that do not match the WHERE conditon are
-# released. Hence less lock collisions occur.
+# wait timeouts in the tests, compared to READ UNCOMMITTED or READ COMMITTED.
+# For READ UNCOMMITTED or READ COMMITTED, no "next-key locks"/"gap locks"
+# are taken and locks on keys that do not match the WHERE condition are
+# released. Hence fewer lock collisions occur.
# We use the variable $keep_locks to set the expectations for
# lock wait timeouts accordingly.
#
-let $keep_locks= `SELECT NOT @@global.innodb_locks_unsafe_for_binlog`;
+let $keep_locks= `SELECT @@global.tx_isolation IN ('REPEATABLE-READ','SERIALIZABLE')`;
--echo # keep_locks == $keep_locks
#
@@ -52,14 +51,6 @@ let $keep_locks= `SELECT NOT @@global.innodb_locks_unsafe_for_binlog`;
#
GRANT USAGE ON test.* TO mysqltest@localhost;
-#
-# Preparatory cleanup.
-#
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-
--echo
--echo **
--echo ** two UPDATE's running and both changing distinct result sets
@@ -99,7 +90,7 @@ drop table if exists t1;
--echo ** Update on t1 will cause a table scan which will be blocked because
--echo ** the previously initiated table scan applied exclusive key locks on
--echo ** all primary keys.
- --echo ** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
+ --echo ** Not so for READ UNCOMMITTED or READ COMMITTED. The locks that
--echo ** do not match the WHERE condition are released.
if ($keep_locks)
{
@@ -190,7 +181,7 @@ drop table t1;
--echo ** Update on t1 will cause a table scan which will be blocked because
--echo ** the previously initiated table scan applied exclusive key locks on
--echo ** all primary keys.
- --echo ** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
+ --echo ** Not so for READ UNCOMMITTED or READ COMMITTED. The locks that
--echo ** do not match the WHERE condition are released.
if ($keep_locks)
{
@@ -386,7 +377,7 @@ drop table t1;
--echo ** Updating single row using a table scan. This will time out
--echo ** because of ongoing transaction on thread 1 holding lock on
--echo ** all primary keys in the scan.
- --echo ** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
+ --echo ** Not so for READ UNCOMMITTED or READ COMMITTED. The locks that
--echo ** do not match the WHERE condition are released.
if ($keep_locks)
{
@@ -570,7 +561,7 @@ drop table t1;
--echo ** Update on t1 will cause a table scan which will be blocked because
--echo ** the previously initiated table scan applied exclusive key locks on
--echo ** all primary keys.
- --echo ** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
+ --echo ** Not so for READ UNCOMMITTED or READ COMMITTED. The locks that
--echo ** do not match the WHERE condition are released.
if ($keep_locks)
{
@@ -598,13 +589,8 @@ drop table t1;
connection thread1;
select * from t1;
---echo ** Cleanup
-connection thread1;
disconnect thread1;
---source include/wait_until_disconnected.inc
-connection thread2;
disconnect thread2;
---source include/wait_until_disconnected.inc
connection default;
drop table t1;
drop user mysqltest@localhost;
diff --git a/mysql-test/include/galera_cluster.inc b/mysql-test/include/galera_cluster.inc
index 7f76ea59c7f..48b5bc631db 100644
--- a/mysql-test/include/galera_cluster.inc
+++ b/mysql-test/include/galera_cluster.inc
@@ -3,16 +3,29 @@
#
# Description
# -----------
-# Configure galera cluster with 2 nodes.
+# Configure galera cluster with $galera_cluster_size (default: 2) nodes.
#
---let $galera_cluster_size = 2
+if (!$galera_cluster_size)
+{
+# --die ERROR IN TEST: $galera_cluster_size variable must be set
+ --let $galera_cluster_size = 2
+}
+
--source include/galera_init.inc
--source include/have_innodb.inc
--source include/galera_wait_ready.inc
---connection node_2
---source include/galera_wait_ready.inc
---source include/have_innodb.inc
+
+--let $_galera_node= $galera_cluster_size
+
+while ($_galera_node != 1)
+{
+ --connection node_$_galera_node
+ --source include/galera_wait_ready.inc
+ --source include/have_innodb.inc
+
+ --dec $_galera_node
+}
--connection node_1
diff --git a/mysql-test/include/have_dbi_dbd-mysql.inc b/mysql-test/include/have_dbi_dbd-mariadb.inc
index 7c2113a8109..1495d2891c8 100644
--- a/mysql-test/include/have_dbi_dbd-mysql.inc
+++ b/mysql-test/include/have_dbi_dbd-mariadb.inc
@@ -1,7 +1,7 @@
#
# Originally created by John Embretsen, 2011-01-26.
#
-# Checks for the existence of Perl modules DBI and DBD::mysql as seen from the
+# Checks for the existence of Perl modules DBI and DBD::MariaDB as seen from the
# perl installation used by "external" executable perl scripts, i.e. scripts
# that are executed as standalone scripts interpreted by the perl installation
# specified by the "shebang" line in the top of these scripts.
@@ -30,7 +30,7 @@
# We jump through some hoops since there is no direct way to check if an
# external command went OK or not from a mysql-test file:
#
-# - In theory, we could do as simple as "exec perl -MDBI -MDBD::mysql -e 1",
+# - In theory, we could do as simple as "exec perl -MDBI -MDBD::MariaDB -e 1",
# however we cannot check the result (exit code) from within a test script.
# Also, this may not yield the same result as other uses of perl due to the
# shebang issue mentioned above.
@@ -55,8 +55,8 @@
# Instead, we call a separate helper script which checks for the modules in its
# own environment. We call it without "perl" in front.
---let $perlChecker= $MYSQLTEST_VARDIR/std_data/checkDBI_DBD-mysql.pl
---let $resultFile= $MYSQL_TMP_DIR/dbidbd-mysql.txt
+--let $perlChecker= $MYSQLTEST_VARDIR/std_data/checkDBI_DBD-MariaDB.pl
+--let $resultFile= $MYSQL_TMP_DIR/dbiDBD-MariaDB.txt
--exec perl $perlChecker
@@ -64,7 +64,7 @@
--source $resultFile
if (!$dbidbd) {
- --skip Test needs Perl modules DBI and DBD::mysql
+ --skip Test needs Perl modules DBI and DBD::MariaDB
}
# Clean up
diff --git a/mysql-test/include/have_s3.inc b/mysql-test/include/have_s3.inc
new file mode 100644
index 00000000000..d81778cd157
--- /dev/null
+++ b/mysql-test/include/have_s3.inc
@@ -0,0 +1,10 @@
+if (!`SELECT count(*) FROM information_schema.engines WHERE
+ (support = 'YES' OR support = 'DEFAULT') AND
+ engine = 's3'`)
+{
+ skip Need s3 engine;
+}
+if (`select @@global.s3_secret_key = "" or @@global.s3_access_key = ""`)
+{
+ skip S3 engine not configured;
+}
diff --git a/mysql-test/include/icp_tests.inc b/mysql-test/include/icp_tests.inc
index 1ff34a936c6..040740f549f 100644
--- a/mysql-test/include/icp_tests.inc
+++ b/mysql-test/include/icp_tests.inc
@@ -459,6 +459,7 @@ INSERT INTO t2 VALUES (15,4);
set @save_optimizer_switch= @@optimizer_switch;
set optimizer_switch='semijoin=off';
+--replace_column 9 #
EXPLAIN
SELECT * FROM t1
WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON it.i=it.i WHERE it.pk-t1.i<10);
diff --git a/mysql-test/include/mysqlhotcopy.inc b/mysql-test/include/mysqlhotcopy.inc
index 2fc14d599d9..306f0acc208 100644
--- a/mysql-test/include/mysqlhotcopy.inc
+++ b/mysql-test/include/mysqlhotcopy.inc
@@ -4,7 +4,7 @@
--source include/not_windows.inc
--source include/not_embedded.inc
---source include/have_dbi_dbd-mysql.inc
+--source include/have_dbi_dbd-mariadb.inc
if (!$MYSQLHOTCOPY)
{
@@ -19,7 +19,7 @@ if (!$MYSQLHOTCOPY)
# executable, i.e. not necessarily using the perl interpreter in PATH,
# because that is how the documentation demonstrates it.
#
-# We include have_dbi_dbd-mysql.inc above so that the test will
+# We include have_dbi_dbd-mariadb.inc above so that the test will
# be skipped if Perl modules required by the mysqlhotcopy tool are not
# found when the script is run this way.
diff --git a/mysql-test/include/not_asan.inc b/mysql-test/include/not_asan.inc
new file mode 100644
index 00000000000..91f39b80150
--- /dev/null
+++ b/mysql-test/include/not_asan.inc
@@ -0,0 +1,8 @@
+# This file should only be used with test that finds bugs in ASan that can not
+# be overcome. In normal cases one should fix the bug server/test case or in
+# the worst case add a (temporary?) suppression in asan.supp or lsan.supp
+
+if (`select count(*) from information_schema.system_variables where variable_name='have_sanitizer'`)
+{
+--skip Can't be run with ASan
+}
diff --git a/mysql-test/include/search_pattern_in_file.inc b/mysql-test/include/search_pattern_in_file.inc
index 6bead628fb0..6cd725c3698 100644
--- a/mysql-test/include/search_pattern_in_file.inc
+++ b/mysql-test/include/search_pattern_in_file.inc
@@ -9,6 +9,9 @@
#
# The environment variables SEARCH_FILE and SEARCH_PATTERN must be set
# before sourcing this routine.
+# SEARCH_TYPE can also be set to either NULL(default) or _gm_
+# NULL is equivalent of using m/SEARCH_PATTERN/gs
+# _gm_ is equivalent of using m/SEARCH_RANGE/gm
#
# Optionally, SEARCH_RANGE can be set to the max number of bytes of the file
# to search. If negative, it will search that many bytes at the end of the
@@ -77,7 +80,15 @@ perl;
close(FILE);
$content.= $file_content;
}
- my @matches=($content =~ m/$search_pattern/gs);
+ my @matches;
+ if (not defined($ENV{SEARCH_TYPE}))
+ {
+ @matches=($content =~ /$search_pattern/gs);
+ }
+ elsif($ENV{SEARCH_TYPE} == "_gm_")
+ {
+ @matches=($content =~ /$search_pattern/gm);
+ }
my $res=@matches ? "FOUND " . scalar(@matches) : "NOT FOUND";
$ENV{SEARCH_FILE} =~ s{^.*?([^/\\]+)$}{$1};
diff --git a/mysql-test/include/shutdown_mysqld.inc b/mysql-test/include/shutdown_mysqld.inc
index c8ab6d00f0d..c787c2b8c3f 100644
--- a/mysql-test/include/shutdown_mysqld.inc
+++ b/mysql-test/include/shutdown_mysqld.inc
@@ -26,7 +26,17 @@ if ($rpl_inited)
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect
--exec echo "wait" > $_expect_file_name
+# Avoid warnings from connection threads that does not have time to exit
+--disable_query_log
+set @@global.log_warnings=0;
+--enable_query_log
+
--let $server_shutdown_timeout= 60
+if ($VALGRIND_TEST)
+{
+ --let $server_shutdown_timeout= 300
+}
+
if ($shutdown_timeout)
{
--let $server_shutdown_timeout= $shutdown_timeout
diff --git a/mysql-test/include/wsrep_wait_condition.inc b/mysql-test/include/wsrep_wait_condition.inc
new file mode 100644
index 00000000000..89b310475eb
--- /dev/null
+++ b/mysql-test/include/wsrep_wait_condition.inc
@@ -0,0 +1,23 @@
+# Helper script to allow to wait for condition on a node that may become
+# non-primary. It attempts to preserve wsrep_sync_wait and wsrep_on session
+# variables.
+#
+# We are forced to restore a global value for the session wsrep_sync_wait
+# here because we can not always issue a SELECT query to obtain the original
+# value and then restore it
+
+disable_query_log;
+SET SESSION wsrep_sync_wait = 8;
+let $restore_wsrep_sync_wait = `SELECT @@GLOBAL.wsrep_sync_wait`;
+let $restore_wsrep_on = `SELECT @@wsrep_on`;
+SET SESSION wsrep_on = OFF;
+
+--source include/wait_condition.inc
+
+if ($restore_wsrep_on == 1)
+{
+ --eval SET SESSION wsrep_on = ON
+}
+--eval SET SESSION wsrep_sync_wait = $restore_wsrep_sync_wait
+
+enable_query_log;
diff --git a/mysql-test/include/wsrep_wait_disconnect.inc b/mysql-test/include/wsrep_wait_disconnect.inc
index 740fc0d9426..504e8069cba 100644
--- a/mysql-test/include/wsrep_wait_disconnect.inc
+++ b/mysql-test/include/wsrep_wait_disconnect.inc
@@ -1,20 +1,2 @@
let $wait_condition = SELECT 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready' AND VARIABLE_VALUE = 'OFF';
-# since this is called until AFTER provider disconnects,we need to allow
-# queries in non-prim
-#
-# We are also forced to use a hard-coded value for wsrep_sync_wait here because
-# we can not issue a SELECT query to obtain the original value and then restore
-# it
-disable_query_log;
-SET SESSION wsrep_sync_wait = 7;
---let $restore_wsrep_on = `SHOW VARIABLES WHERE Variable_name = 'wsrep_on' AND Value = 'ON'`
-SET SESSION wsrep_on = OFF;
-
---source include/wait_condition.inc
-
-if ($restore_wsrep_on != "")
-{
- --eval SET SESSION wsrep_on = ON
-}
-SET SESSION wsrep_sync_wait = 15;
-enable_query_log;
+--source include/wsrep_wait_condition.inc
diff --git a/mysql-test/include/wsrep_wait_membership.inc b/mysql-test/include/wsrep_wait_membership.inc
new file mode 100644
index 00000000000..8bc1920ddfb
--- /dev/null
+++ b/mysql-test/include/wsrep_wait_membership.inc
@@ -0,0 +1,10 @@
+# Waits for N members in the cluster
+#
+# Usage:
+# --let $members=1
+# --source wsrep_wait_membership.inc
+#
+
+let $wait_condition = SELECT VARIABLE_VALUE = $members FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+
+--source include/wsrep_wait_condition.inc
diff --git a/mysql-test/lsan.supp b/mysql-test/lsan.supp
new file mode 100644
index 00000000000..3f460d4544e
--- /dev/null
+++ b/mysql-test/lsan.supp
@@ -0,0 +1,17 @@
+# LSAN (Asan leaks) suppressions
+
+# Leaks found by main.tls_version1
+leak:gnutls_certificate_allocate_credentials
+leak:gnutls_x509_trust_list_init
+
+# Leaks found by openssl_1
+leak:libtasn1
+leak:libgnutls
+leak:gnutls_pubkey_init
+leak:gnutls_x509_privkey_init
+leak:gnutls_x509_crt_init
+leak:gnutls_privkey_init
+leak:gnutls_x509_trust_list_init
+leak:gnutls_subject_alt_names_init
+leak:__gmp_default_allocate
+leak:__gmp_default_reallocate
diff --git a/mysql-test/main/alter_table_debug.result b/mysql-test/main/alter_table_debug.result
new file mode 100644
index 00000000000..3366f1721cd
--- /dev/null
+++ b/mysql-test/main/alter_table_debug.result
@@ -0,0 +1,26 @@
+#
+# Start of 10.5 tests
+#
+#
+# MDEV-19612 Split ALTER related data type specific code in sql_table.cc to Type_handler
+#
+SET sql_mode='STRICT_ALL_TABLES,STRICT_TRANS_TABLES,NO_ZERO_DATE';
+CREATE TABLE t1 (a INT);
+ALTER TABLE t1 ALGORITHM=COPY, ADD b INT NOT NULL;
+DROP TABLE t1;
+SET sql_mode='STRICT_ALL_TABLES,STRICT_TRANS_TABLES,NO_ZERO_DATE';
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (0);
+ALTER TABLE t1 ALGORITHM=COPY, ADD b INT NOT NULL;
+DROP TABLE t1;
+SET sql_mode='STRICT_ALL_TABLES,STRICT_TRANS_TABLES,NO_ZERO_DATE';
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (0);
+SET debug_dbug='+d,validate_implicit_default_value_error';
+ALTER TABLE t1 ALGORITHM=COPY, ADD b INT NOT NULL;
+ERROR 22007: Incorrect int value: '0' for column `test`.`t1`.`b` at row 1
+SET debug_dbug='-d,validate_implicit_default_value_error';
+DROP TABLE t1;
+#
+# End of 10.5 tests
+#
diff --git a/mysql-test/main/alter_table_debug.test b/mysql-test/main/alter_table_debug.test
new file mode 100644
index 00000000000..8c9293b06b9
--- /dev/null
+++ b/mysql-test/main/alter_table_debug.test
@@ -0,0 +1,33 @@
+--source include/have_debug.inc
+
+--echo #
+--echo # Start of 10.5 tests
+--echo #
+
+--echo #
+--echo # MDEV-19612 Split ALTER related data type specific code in sql_table.cc to Type_handler
+--echo #
+
+SET sql_mode='STRICT_ALL_TABLES,STRICT_TRANS_TABLES,NO_ZERO_DATE';
+CREATE TABLE t1 (a INT);
+ALTER TABLE t1 ALGORITHM=COPY, ADD b INT NOT NULL;
+DROP TABLE t1;
+
+SET sql_mode='STRICT_ALL_TABLES,STRICT_TRANS_TABLES,NO_ZERO_DATE';
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (0);
+ALTER TABLE t1 ALGORITHM=COPY, ADD b INT NOT NULL;
+DROP TABLE t1;
+
+SET sql_mode='STRICT_ALL_TABLES,STRICT_TRANS_TABLES,NO_ZERO_DATE';
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (0);
+SET debug_dbug='+d,validate_implicit_default_value_error';
+--error ER_TRUNCATED_WRONG_VALUE
+ALTER TABLE t1 ALGORITHM=COPY, ADD b INT NOT NULL;
+SET debug_dbug='-d,validate_implicit_default_value_error';
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.5 tests
+--echo #
diff --git a/mysql-test/main/alter_table_online.result b/mysql-test/main/alter_table_online.result
index 2e3de2c0635..719d6fe1751 100644
--- a/mysql-test/main/alter_table_online.result
+++ b/mysql-test/main/alter_table_online.result
@@ -253,19 +253,19 @@ Feature_delay_key_write 0
alter online table t1 delay_key_write=1;
show status like 'Feature_delay_key_write';
Variable_name Value
-Feature_delay_key_write 1
+Feature_delay_key_write 0
flush tables;
insert t1 values (1,2),(2,3),(3,4);
show status like 'Feature_delay_key_write';
Variable_name Value
-Feature_delay_key_write 2
+Feature_delay_key_write 1
alter online table t1 delay_key_write=0;
show status like 'Feature_delay_key_write';
Variable_name Value
-Feature_delay_key_write 2
+Feature_delay_key_write 1
flush tables;
insert t1 values (1,2),(2,3),(3,4);
show status like 'Feature_delay_key_write';
Variable_name Value
-Feature_delay_key_write 2
+Feature_delay_key_write 1
drop table t1;
diff --git a/mysql-test/main/brackets.result b/mysql-test/main/brackets.result
index dedd9a2a2bf..548250db758 100644
--- a/mysql-test/main/brackets.result
+++ b/mysql-test/main/brackets.result
@@ -54,7 +54,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union1,4> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 /* select#1 */ select 1 AS `1` union /* select#4 */ select `__4`.`1` AS `1` from (/* select#2 */ select 1 AS `1` union all /* select#3 */ select 1 AS `1`) `__4`
+Note 1003 /* select#1 */ select 1 AS `1` union /* select#4 */ select `__4`.`1` AS `1` from (/* select#2 */ select 1 AS `1` union /* select#3 */ select 1 AS `1`) `__4`
select 1 union select 1 union all select 1;
1
1
diff --git a/mysql-test/main/column_compression.result b/mysql-test/main/column_compression.result
index fb1dfcf1243..d9cc4aafac2 100644
--- a/mysql-test/main/column_compression.result
+++ b/mysql-test/main/column_compression.result
@@ -2663,3 +2663,19 @@ CREATE TABLE t1 (a NVARCHAR(10) COMPRESSED BINARY COMPRESSED);
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 'COMPRESSED)' at line 1
CREATE TABLE t1 (a NVARCHAR(10) COMPRESSED DEFAULT '' COMPRESSED);
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 'COMPRESSED)' at line 1
+#
+# End of 10.3 tests
+#
+#
+# Start of 10.5 tests
+#
+#
+# MDEV-19727 Add Type_handler::Key_part_spec_init_ft
+#
+CREATE TABLE t1 (a VARCHAR(1000) COMPRESSED, FULLTEXT INDEX(a));
+ERROR HY000: Compressed column 'a' can't be used in key specification
+CREATE TABLE t1 (a TEXT COMPRESSED, FULLTEXT INDEX(a));
+ERROR HY000: Compressed column 'a' can't be used in key specification
+#
+# End of 10.5 tests
+#
diff --git a/mysql-test/main/column_compression.test b/mysql-test/main/column_compression.test
index 092125735cf..bf311cb5097 100644
--- a/mysql-test/main/column_compression.test
+++ b/mysql-test/main/column_compression.test
@@ -255,3 +255,32 @@ DROP TABLE t1;
CREATE TABLE t1 (a NVARCHAR(10) COMPRESSED BINARY COMPRESSED);
--error ER_PARSE_ERROR
CREATE TABLE t1 (a NVARCHAR(10) COMPRESSED DEFAULT '' COMPRESSED);
+
+--echo #
+--echo # End of 10.3 tests
+--echo #
+
+
+--echo #
+--echo # Start of 10.5 tests
+--echo #
+
+--echo #
+--echo # MDEV-19727 Add Type_handler::Key_part_spec_init_ft
+--echo #
+
+#
+# Indexes on COMPRESSED columns are generally prohibited, so we don't have
+# to override Type_handler_xxx_compressed::Key_part_spec_init_ft().
+# Note, we could support FULLTEXT indexes on compressed columns eventually.
+#
+
+--error ER_COMPRESSED_COLUMN_USED_AS_KEY
+CREATE TABLE t1 (a VARCHAR(1000) COMPRESSED, FULLTEXT INDEX(a));
+
+--error ER_COMPRESSED_COLUMN_USED_AS_KEY
+CREATE TABLE t1 (a TEXT COMPRESSED, FULLTEXT INDEX(a));
+
+--echo #
+--echo # End of 10.5 tests
+--echo #
diff --git a/mysql-test/main/comment_database.result b/mysql-test/main/comment_database.result
new file mode 100644
index 00000000000..628a3259b6b
--- /dev/null
+++ b/mysql-test/main/comment_database.result
@@ -0,0 +1,78 @@
+#
+# MDEV-307: Add functionality for database comments
+#
+CREATE DATABASE db1 COMMENT=;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
+CREATE DATABASE db1
+COMMENT='abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd';
+SHOW CREATE DATABASE db1;
+Database Create Database
+db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET latin1 */ COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd'
+SELECT schema_comment, char_length(schema_comment)
+FROM information_schema.schemata
+WHERE schema_name='db1';
+schema_comment char_length(schema_comment)
+abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd 1024
+DROP DATABASE db1;
+SET SQL_MODE='';
+CREATE DATABASE db1
+COMMENT='abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcde';
+Warnings:
+Warning 4160 Comment for database 'db1' is too long (max = 1024)
+SHOW CREATE DATABASE db1;
+Database Create Database
+db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET latin1 */ COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd'
+SELECT schema_comment, char_length(schema_comment)
+FROM information_schema.schemata
+WHERE schema_name='db1';
+schema_comment char_length(schema_comment)
+abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd 1024
+DROP DATABASE db1;
+SET SQL_MODE='TRADITIONAL';
+CREATE DATABASE db1
+COMMENT='abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcde';
+ERROR HY000: Comment for database 'db1' is too long (max = 1024)
+SELECT schema_comment, char_length(schema_comment)
+FROM information_schema.schemata
+WHERE schema_name='db1';
+schema_comment char_length(schema_comment)
+CREATE DATABASE db1 COMMENT 'db1';
+SHOW CREATE DATABASE db1;
+Database Create Database
+db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET latin1 */ COMMENT 'db1'
+ALTER DATABASE db1 COMMENT = "db1 comment";
+SELECT * FROM information_schema.schemata
+WHERE schema_name='db1';
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def db1 latin1 latin1_swedish_ci NULL db1 comment
+DROP DATABASE db1;
+CREATE DATABASE db1;
+USE db1;
+ALTER DATABASE COMMENT 'db1 comment' CHARACTER SET 'utf8';
+SHOW CREATE DATABASE db1;
+Database Create Database
+db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8 */ COMMENT 'db1 comment'
+ALTER DATABASE db1 COMMENT 'this is db1 comment';
+SHOW CREATE DATABASE db1;
+Database Create Database
+db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8 */ COMMENT 'this is db1 comment'
+ALTER DATABASE CHARACTER SET 'latin1';
+SHOW CREATE DATABASE db1;
+Database Create Database
+db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET latin1 */ COMMENT 'this is db1 comment'
+DROP DATABASE db1;
+CREATE DATABASE comment COMMENT 'comment' CHARACTER SET 'latin2';
+SHOW CREATE DATABASE comment;
+Database Create Database
+comment CREATE DATABASE `comment` /*!40100 DEFAULT CHARACTER SET latin2 */ COMMENT 'comment'
+ALTER DATABASE comment COMMENT 'comment comment';
+SHOW CREATE DATABASE comment;
+Database Create Database
+comment CREATE DATABASE `comment` /*!40100 DEFAULT CHARACTER SET latin2 */ COMMENT 'comment comment'
+USE comment;
+ALTER DATABASE COMMENT 'comment';
+SELECT * FROM information_schema.schemata
+WHERE schema_name='comment';
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def comment latin2 latin2_general_ci NULL comment
+DROP DATABASE comment;
diff --git a/mysql-test/main/comment_database.test b/mysql-test/main/comment_database.test
new file mode 100644
index 00000000000..3fe1c7b205c
--- /dev/null
+++ b/mysql-test/main/comment_database.test
@@ -0,0 +1,63 @@
+--echo #
+--echo # MDEV-307: Add functionality for database comments
+--echo #
+
+# Check an error state
+--error ER_PARSE_ERROR
+CREATE DATABASE db1 COMMENT=;
+
+# 1024 bytes
+CREATE DATABASE db1
+COMMENT='abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd';
+SHOW CREATE DATABASE db1;
+SELECT schema_comment, char_length(schema_comment)
+FROM information_schema.schemata
+WHERE schema_name='db1';
+DROP DATABASE db1;
+
+# 1025 bytes (warning)
+SET SQL_MODE='';
+CREATE DATABASE db1
+COMMENT='abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcde';
+SHOW CREATE DATABASE db1;
+SELECT schema_comment, char_length(schema_comment)
+FROM information_schema.schemata
+WHERE schema_name='db1';
+DROP DATABASE db1;
+SET SQL_MODE='TRADITIONAL';
+
+# 1025 bytes (error)
+--error ER_TOO_LONG_DATABASE_COMMENT
+CREATE DATABASE db1
+COMMENT='abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcde';
+SELECT schema_comment, char_length(schema_comment)
+FROM information_schema.schemata
+WHERE schema_name='db1';
+
+CREATE DATABASE db1 COMMENT 'db1';
+SHOW CREATE DATABASE db1;
+ALTER DATABASE db1 COMMENT = "db1 comment";
+SELECT * FROM information_schema.schemata
+WHERE schema_name='db1';
+DROP DATABASE db1;
+
+CREATE DATABASE db1;
+USE db1;
+ALTER DATABASE COMMENT 'db1 comment' CHARACTER SET 'utf8';
+SHOW CREATE DATABASE db1;
+ALTER DATABASE db1 COMMENT 'this is db1 comment';
+SHOW CREATE DATABASE db1;
+ALTER DATABASE CHARACTER SET 'latin1';
+SHOW CREATE DATABASE db1;
+DROP DATABASE db1;
+
+# Test the case when the database is named 'comment'
+CREATE DATABASE comment COMMENT 'comment' CHARACTER SET 'latin2';
+SHOW CREATE DATABASE comment;
+ALTER DATABASE comment COMMENT 'comment comment';
+SHOW CREATE DATABASE comment;
+USE comment;
+ALTER DATABASE COMMENT 'comment';
+SELECT * FROM information_schema.schemata
+WHERE schema_name='comment';
+DROP DATABASE comment;
diff --git a/mysql-test/main/compress.result b/mysql-test/main/compress.result
index 8fbbb324b16..788eb7ab13b 100644
--- a/mysql-test/main/compress.result
+++ b/mysql-test/main/compress.result
@@ -515,7 +515,7 @@ insert into tmp select * from t3;
insert into t3 select * from tmp;
alter table t3 add t2nr int not null auto_increment primary key first;
drop table tmp;
-SET BIG_TABLES=1;
+set tmp_memory_table_size=0;
select distinct concat(fld3," ",fld3) as namn from t2,t3 where t2.fld1=t3.t2nr order by namn limit 10;
namn
Abraham Abraham
@@ -528,7 +528,7 @@ ammonium ammonium
analyzable analyzable
animals animals
animized animized
-SET BIG_TABLES=0;
+set tmp_memory_table_size=default;
select distinct concat(fld3," ",fld3) from t2,t3 where t2.fld1=t3.t2nr order by fld3 limit 10;
concat(fld3," ",fld3)
Abraham Abraham
@@ -565,7 +565,7 @@ attendants 1
bedlam 1
bedpost 1
boasted 1
-SET BIG_TABLES=1;
+set tmp_memory_table_size=0;
select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
fld3 count(*)
affixed 1
@@ -578,7 +578,7 @@ attendants 1
bedlam 1
bedpost 1
boasted 1
-SET BIG_TABLES=0;
+set tmp_memory_table_size=default;
select distinct fld3,repeat("a",length(fld3)),count(*) from t2 group by companynr,fld3 limit 100,10;
fld3 repeat("a",length(fld3)) count(*)
circus aaaaaa 1
diff --git a/mysql-test/main/concurrent_innodb_safelog-master.opt b/mysql-test/main/concurrent_innodb_safelog-master.opt
deleted file mode 100644
index 82dec8b25fd..00000000000
--- a/mysql-test/main/concurrent_innodb_safelog-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-innodb_lock_wait_timeout=1
diff --git a/mysql-test/main/concurrent_innodb_safelog.result b/mysql-test/main/concurrent_innodb_safelog.result
index 27889777ac1..ed399b4f1a1 100644
--- a/mysql-test/main/concurrent_innodb_safelog.result
+++ b/mysql-test/main/concurrent_innodb_safelog.result
@@ -1,15 +1,13 @@
+SET @save_timeout = @@GLOBAL.innodb_lock_wait_timeout;
+SET GLOBAL innodb_lock_wait_timeout = 1;
SET GLOBAL TRANSACTION ISOLATION LEVEL REPEATABLE READ;
connection default;
SET SQL_MODE="";
SELECT @@global.tx_isolation;
@@global.tx_isolation
REPEATABLE-READ
-SELECT @@global.innodb_locks_unsafe_for_binlog;
-@@global.innodb_locks_unsafe_for_binlog
-0
# keep_locks == 1
GRANT USAGE ON test.* TO mysqltest@localhost;
-drop table if exists t1;
**
** two UPDATE's running and both changing distinct result sets
@@ -47,7 +45,7 @@ begin;
** Update on t1 will cause a table scan which will be blocked because
** the previously initiated table scan applied exclusive key locks on
** all primary keys.
-** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
+** Not so for READ UNCOMMITTED or READ COMMITTED. The locks that
** do not match the WHERE condition are released.
update t1 set eta=2 where tipo=22;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
@@ -187,7 +185,7 @@ begin;
** Update on t1 will cause a table scan which will be blocked because
** the previously initiated table scan applied exclusive key locks on
** all primary keys.
-** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
+** Not so for READ UNCOMMITTED or READ COMMITTED. The locks that
** do not match the WHERE condition are released.
update t1 set tipo=1 where tipo=2;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
@@ -476,7 +474,7 @@ begin;
** Updating single row using a table scan. This will time out
** because of ongoing transaction on thread 1 holding lock on
** all primary keys in the scan.
-** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
+** Not so for READ UNCOMMITTED or READ COMMITTED. The locks that
** do not match the WHERE condition are released.
update t1 set tipo=11 where tipo=22;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
@@ -736,7 +734,7 @@ begin;
** Update on t1 will cause a table scan which will be blocked because
** the previously initiated table scan applied exclusive key locks on
** all primary keys.
-** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
+** Not so for READ UNCOMMITTED or READ COMMITTED. The locks that
** do not match the WHERE condition are released.
update t1 set tipo=1 where tipo=22;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
@@ -789,12 +787,10 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** Cleanup
-connection thread1;
disconnect thread1;
-connection thread2;
disconnect thread2;
connection default;
drop table t1;
drop user mysqltest@localhost;
SET SQL_MODE=default;
+SET GLOBAL innodb_lock_wait_timeout = @save_timeout;
diff --git a/mysql-test/main/concurrent_innodb_safelog.test b/mysql-test/main/concurrent_innodb_safelog.test
index 828df9ef717..7f6b3c328f2 100644
--- a/mysql-test/main/concurrent_innodb_safelog.test
+++ b/mysql-test/main/concurrent_innodb_safelog.test
@@ -16,8 +16,10 @@
let $engine_type= InnoDB;
+SET @save_timeout = @@GLOBAL.innodb_lock_wait_timeout;
+SET GLOBAL innodb_lock_wait_timeout = 1;
SET GLOBAL TRANSACTION ISOLATION LEVEL REPEATABLE READ;
-# innodb_locks_unsafe_for_binlog not set for this test
--source include/concurrent.inc
+SET GLOBAL innodb_lock_wait_timeout = @save_timeout;
diff --git a/mysql-test/main/concurrent_innodb_unsafelog-master.opt b/mysql-test/main/concurrent_innodb_unsafelog-master.opt
deleted file mode 100644
index ea9c1b860e9..00000000000
--- a/mysql-test/main/concurrent_innodb_unsafelog-master.opt
+++ /dev/null
@@ -1,2 +0,0 @@
---loose-innodb_locks_unsafe_for_binlog
---loose-innodb_lock_wait_timeout=1
diff --git a/mysql-test/main/concurrent_innodb_unsafelog.result b/mysql-test/main/concurrent_innodb_unsafelog.result
index 39e757aeeb1..1bf556046b9 100644
--- a/mysql-test/main/concurrent_innodb_unsafelog.result
+++ b/mysql-test/main/concurrent_innodb_unsafelog.result
@@ -1,15 +1,14 @@
-SET GLOBAL TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+SET @save_timeout = @@GLOBAL.innodb_lock_wait_timeout;
+SET GLOBAL innodb_lock_wait_timeout = 1;
+SET @save_isolation = @@GLOBAL.tx_isolation;
+SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED;
connection default;
SET SQL_MODE="";
SELECT @@global.tx_isolation;
@@global.tx_isolation
-REPEATABLE-READ
-SELECT @@global.innodb_locks_unsafe_for_binlog;
-@@global.innodb_locks_unsafe_for_binlog
-1
+READ-COMMITTED
# keep_locks == 0
GRANT USAGE ON test.* TO mysqltest@localhost;
-drop table if exists t1;
**
** two UPDATE's running and both changing distinct result sets
@@ -47,7 +46,7 @@ begin;
** Update on t1 will cause a table scan which will be blocked because
** the previously initiated table scan applied exclusive key locks on
** all primary keys.
-** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
+** Not so for READ UNCOMMITTED or READ COMMITTED. The locks that
** do not match the WHERE condition are released.
update t1 set eta=2 where tipo=22;
** Release user level name lock from thread 1. This will cause the ULL
@@ -101,7 +100,7 @@ eta tipo c
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
-90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
+1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** And send final commit on thread 1.
commit;
** Table should now be updated by both updates in the order of
@@ -186,7 +185,7 @@ begin;
** Update on t1 will cause a table scan which will be blocked because
** the previously initiated table scan applied exclusive key locks on
** all primary keys.
-** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
+** Not so for READ UNCOMMITTED or READ COMMITTED. The locks that
** do not match the WHERE condition are released.
update t1 set tipo=1 where tipo=2;
** Release ULL. This will release the next waiting ULL on thread 2.
@@ -231,13 +230,13 @@ select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
-10 1 ccccccccccccccccccccccccccccccccccccccccccc
+1 1 ccccccccccccccccccccccccccccccccccccccccccc
20 1 ddddddddddddddddddddddddddddddddddddddddddd
-30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
+1 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
40 1 fffffffffffffffffffffffffffffffffffffffffff
-50 1 ggggggggggggggggggggggggggggggggggggggggggg
+1 1 ggggggggggggggggggggggggggggggggggggggggggg
60 1 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
-70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
+1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
commit;
@@ -474,7 +473,7 @@ begin;
** Updating single row using a table scan. This will time out
** because of ongoing transaction on thread 1 holding lock on
** all primary keys in the scan.
-** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
+** Not so for READ UNCOMMITTED or READ COMMITTED. The locks that
** do not match the WHERE condition are released.
update t1 set tipo=11 where tipo=22;
** After the time out the transaction is aborted; no rows should
@@ -733,7 +732,7 @@ begin;
** Update on t1 will cause a table scan which will be blocked because
** the previously initiated table scan applied exclusive key locks on
** all primary keys.
-** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
+** Not so for READ UNCOMMITTED or READ COMMITTED. The locks that
** do not match the WHERE condition are released.
update t1 set tipo=1 where tipo=22;
select * from t1;
@@ -785,12 +784,11 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 1 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** Cleanup
-connection thread1;
disconnect thread1;
-connection thread2;
disconnect thread2;
connection default;
drop table t1;
drop user mysqltest@localhost;
SET SQL_MODE=default;
+SET GLOBAL innodb_lock_wait_timeout = @save_timeout;
+SET GLOBAL tx_isolation = @save_isolation;
diff --git a/mysql-test/main/concurrent_innodb_unsafelog.test b/mysql-test/main/concurrent_innodb_unsafelog.test
index e2c03655e43..eee2295211e 100644
--- a/mysql-test/main/concurrent_innodb_unsafelog.test
+++ b/mysql-test/main/concurrent_innodb_unsafelog.test
@@ -16,8 +16,12 @@
let $engine_type= InnoDB;
-SET GLOBAL TRANSACTION ISOLATION LEVEL REPEATABLE READ;
-# innodb_locks_unsafe_for_binlog is set fro this test.
+SET @save_timeout = @@GLOBAL.innodb_lock_wait_timeout;
+SET GLOBAL innodb_lock_wait_timeout = 1;
+SET @save_isolation = @@GLOBAL.tx_isolation;
+SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED;
--source include/concurrent.inc
+SET GLOBAL innodb_lock_wait_timeout = @save_timeout;
+SET GLOBAL tx_isolation = @save_isolation;
diff --git a/mysql-test/main/cte_recursive.result b/mysql-test/main/cte_recursive.result
index b88f0ff6255..de0f515d0ad 100644
--- a/mysql-test/main/cte_recursive.result
+++ b/mysql-test/main/cte_recursive.result
@@ -3110,7 +3110,7 @@ SELECT * FROM cte;
#
# MDEV-15575: using recursive cte with big_tables enabled
#
-set big_tables=1;
+set tmp_memory_table_size=0;
with recursive qn as
(select 123 as a union all select 1+a from qn where a<130)
select * from qn;
@@ -3123,13 +3123,13 @@ a
128
129
130
-set big_tables=default;
+set tmp_memory_table_size=default;
#
# MDEV-15571: using recursive cte with big_tables enabled
#
create table t1 (a bigint);
insert into t1 values(1);
-set big_tables=1;
+set tmp_memory_table_size=0;
with recursive qn as
(
select a from t1
@@ -3138,13 +3138,13 @@ select a*2000 from qn where a<10000000000000000000
)
select * from qn;
ERROR 22003: BIGINT value is out of range in '`qn`.`a` * 2000'
-set big_tables=default;
+set tmp_memory_table_size=default;
drop table t1;
#
# MDEV-15556: using recursive cte with big_tables enabled
# when recursive tables are accessed by key
#
-SET big_tables=1;
+set tmp_memory_table_size=0;
CREATE TABLE t1 (id int, name char(10), leftpar int, rightpar int);
INSERT INTO t1 VALUES
(1, "A", 2, 3), (2, "LA", 4, 5), (4, "LLA", 6, 7),
@@ -3195,7 +3195,7 @@ id select_type table type possible_keys key key_len ref rows Extra
4 RECURSIVE UNION <derived2> ref key0 key0 5 test.t2.id 2
NULL UNION RESULT <union2,3,4> ALL NULL NULL NULL NULL NULL
DROP TABLE t1,t2;
-SET big_tables=0;
+set tmp_memory_table_size=default;
#
# MDEV-15840: recursive tables are accessed by key
# (the same problem as for MDEV-15556)
diff --git a/mysql-test/main/cte_recursive.test b/mysql-test/main/cte_recursive.test
index 6a4f55cd408..ce3b817a937 100644
--- a/mysql-test/main/cte_recursive.test
+++ b/mysql-test/main/cte_recursive.test
@@ -2138,13 +2138,13 @@ SELECT * FROM cte;
--echo # MDEV-15575: using recursive cte with big_tables enabled
--echo #
-set big_tables=1;
+set tmp_memory_table_size=0; # force on-disk tmp table
with recursive qn as
(select 123 as a union all select 1+a from qn where a<130)
select * from qn;
-set big_tables=default;
+set tmp_memory_table_size=default;
--echo #
--echo # MDEV-15571: using recursive cte with big_tables enabled
@@ -2153,7 +2153,7 @@ set big_tables=default;
create table t1 (a bigint);
insert into t1 values(1);
-set big_tables=1;
+set tmp_memory_table_size=0; # force on-disk tmp table
--error ER_DATA_OUT_OF_RANGE
with recursive qn as
@@ -2164,7 +2164,7 @@ with recursive qn as
)
select * from qn;
-set big_tables=default;
+set tmp_memory_table_size=default;
drop table t1;
@@ -2173,7 +2173,7 @@ drop table t1;
--echo # when recursive tables are accessed by key
--echo #
-SET big_tables=1;
+set tmp_memory_table_size=0; # force on-disk tmp table
CREATE TABLE t1 (id int, name char(10), leftpar int, rightpar int);
INSERT INTO t1 VALUES
@@ -2202,7 +2202,7 @@ eval EXPLAIN $q;
DROP TABLE t1,t2;
-SET big_tables=0;
+set tmp_memory_table_size=default;
--echo #
--echo # MDEV-15840: recursive tables are accessed by key
diff --git a/mysql-test/main/ctype_latin1.result b/mysql-test/main/ctype_latin1.result
index a4925af69ae..4362ed44699 100644
--- a/mysql-test/main/ctype_latin1.result
+++ b/mysql-test/main/ctype_latin1.result
@@ -8889,3 +8889,23 @@ DROP TABLE t1;
#
# End of 10.2 tests
#
+#
+# Start of 10.5 tests
+#
+#
+# MDEV-20712 Wrong data type for CAST(@a AS BINARY) for a numeric variable
+#
+SET NAMES latin1;
+SET @a=2;
+CREATE OR REPLACE TABLE t1 AS SELECT CAST(1 AS BINARY), CAST(@a AS BINARY), CAST(@b:=3 AS BINARY);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `CAST(1 AS BINARY)` varbinary(1) DEFAULT NULL,
+ `CAST(@a AS BINARY)` varbinary(20) DEFAULT NULL,
+ `CAST(@b:=3 AS BINARY)` varbinary(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+#
+# End of 10.5 tests
+#
diff --git a/mysql-test/main/ctype_latin1.test b/mysql-test/main/ctype_latin1.test
index a556c86c016..97190caf890 100644
--- a/mysql-test/main/ctype_latin1.test
+++ b/mysql-test/main/ctype_latin1.test
@@ -441,3 +441,21 @@ SET NAMES latin1;
--echo #
--echo # End of 10.2 tests
--echo #
+
+--echo #
+--echo # Start of 10.5 tests
+--echo #
+
+--echo #
+--echo # MDEV-20712 Wrong data type for CAST(@a AS BINARY) for a numeric variable
+--echo #
+
+SET NAMES latin1;
+SET @a=2;
+CREATE OR REPLACE TABLE t1 AS SELECT CAST(1 AS BINARY), CAST(@a AS BINARY), CAST(@b:=3 AS BINARY);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.5 tests
+--echo #
diff --git a/mysql-test/main/ctype_utf8.result b/mysql-test/main/ctype_utf8.result
index 9cb7fc0ad76..d044fe6e430 100644
--- a/mysql-test/main/ctype_utf8.result
+++ b/mysql-test/main/ctype_utf8.result
@@ -11323,3 +11323,23 @@ DROP TABLE t1;
#
# End of 10.3 tests
#
+#
+# Start of 10.5 tests
+#
+#
+# MDEV-20712 Wrong data type for CAST(@a AS BINARY) for a numeric variable
+#
+SET NAMES utf8;
+SET @a=2;
+CREATE OR REPLACE TABLE t1 AS SELECT CAST(1 AS BINARY), CAST(@a AS BINARY), CAST(@b:=3 AS BINARY);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `CAST(1 AS BINARY)` varbinary(1) DEFAULT NULL,
+ `CAST(@a AS BINARY)` varbinary(20) DEFAULT NULL,
+ `CAST(@b:=3 AS BINARY)` varbinary(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+#
+# End of 10.5 tests
+#
diff --git a/mysql-test/main/ctype_utf8.test b/mysql-test/main/ctype_utf8.test
index 26fc491c568..89243a1d23d 100644
--- a/mysql-test/main/ctype_utf8.test
+++ b/mysql-test/main/ctype_utf8.test
@@ -2260,3 +2260,22 @@ DROP TABLE t1;
--echo #
--echo # End of 10.3 tests
--echo #
+
+
+--echo #
+--echo # Start of 10.5 tests
+--echo #
+
+--echo #
+--echo # MDEV-20712 Wrong data type for CAST(@a AS BINARY) for a numeric variable
+--echo #
+
+SET NAMES utf8;
+SET @a=2;
+CREATE OR REPLACE TABLE t1 AS SELECT CAST(1 AS BINARY), CAST(@a AS BINARY), CAST(@b:=3 AS BINARY);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.5 tests
+--echo #
diff --git a/mysql-test/main/ctype_utf8_def_upgrade.result b/mysql-test/main/ctype_utf8_def_upgrade.result
index 921b5200aca..4f8a2b27db2 100644
--- a/mysql-test/main/ctype_utf8_def_upgrade.result
+++ b/mysql-test/main/ctype_utf8_def_upgrade.result
@@ -10,14 +10,14 @@ SELECT @@character_set_database;
latin1
SET @@character_set_database="latin1";
SELECT COUNT(*) FROM t1;
-ERROR HY000: Got error 190 "Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine. You have to dump an" from storage engine MyISAM
+ERROR HY000: Got error 190 "Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine. You may have retry " from storage engine MyISAM
CHECK TABLE t1;
Table Op Msg_type Msg_text
-test.t1 check Error Got error 190 "Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine. You have to dump an" from storage engine MyISAM
+test.t1 check Error Got error 190 "Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine. You may have retry " from storage engine MyISAM
test.t1 check error Corrupt
REPAIR TABLE t1;
Table Op Msg_type Msg_text
-test.t1 repair Error Got error 190 "Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine. You have to dump an" from storage engine MyISAM
+test.t1 repair Error Got error 190 "Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine. You may have retry " from storage engine MyISAM
test.t1 repair error Corrupt
REPAIR TABLE t1 USE_FRM;
Table Op Msg_type Msg_text
@@ -64,7 +64,7 @@ SELECT @@character_set_database, 'taken from db.opt' AS comment;
@@character_set_database comment
latin1 taken from db.opt
SELECT COUNT(*) FROM t1;
-ERROR HY000: Got error 190 "Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine. You have to dump an" from storage engine MyISAM
+ERROR HY000: Got error 190 "Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine. You may have retry " from storage engine MyISAM
REPAIR TABLE t1 USE_FRM;
Table Op Msg_type Msg_text
db1.t1 repair status OK
diff --git a/mysql-test/main/except.result b/mysql-test/main/except.result
index f48a25f93bd..342340920cf 100644
--- a/mysql-test/main/except.result
+++ b/mysql-test/main/except.result
@@ -508,8 +508,6 @@ select 1 as a from dual union all select 1 from dual;
a
1
1
-select 1 from dual except all select 1 from dual;
-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 'all select 1 from dual' at line 1
create table t1 (a int, b blob, a1 int, b1 blob) engine=MyISAM;
create table t2 (c int, d blob, c1 int, d1 blob) engine=MyISAM;
insert into t1 values (1,"ddd", 1, "sdfrrwwww"),(2, "fgh", 2, "dffggtt");
diff --git a/mysql-test/main/except.test b/mysql-test/main/except.test
index 4eaae1a3888..97e4ffcc3f2 100644
--- a/mysql-test/main/except.test
+++ b/mysql-test/main/except.test
@@ -70,8 +70,6 @@ select 1 as a from dual except select 1 from dual;
select 1 from dual ORDER BY 1 except select 1 from dual;
select 1 as a from dual union all select 1 from dual;
---error ER_PARSE_ERROR
-select 1 from dual except all select 1 from dual;
create table t1 (a int, b blob, a1 int, b1 blob) engine=MyISAM;
diff --git a/mysql-test/main/except_all.result b/mysql-test/main/except_all.result
new file mode 100644
index 00000000000..ef65107d62c
--- /dev/null
+++ b/mysql-test/main/except_all.result
@@ -0,0 +1,660 @@
+create table t1 (a int, b int) engine=MyISAM;
+create table t2 (c int, d int) engine=MyISAM;
+insert into t1 values (1,1),(2,2),(3,3),(2,2),(4,4),(4,4),(4,4);
+insert into t2 values (1,1),(1,1),(1,1),(2,2),(3,3),(3,3),(5,5);
+select * from t1 except select * from t2;
+a b
+4 4
+select * from t1 except all select * from t2;
+a b
+4 4
+2 2
+4 4
+4 4
+select * from t1 except all select c+1,d+1 from t2;
+a b
+1 1
+4 4
+(select * from t1) except all (select * from t2);
+a b
+4 4
+2 2
+4 4
+4 4
+select * from ((select * from t1) except all (select * from t2)) a;
+a b
+4 4
+2 2
+4 4
+4 4
+select * from ((select a from t1) except all (select c from t2)) a;
+a
+4
+2
+4
+4
+select * from t1 except all select * from t1 union all select * from t1 union all select * from t1 except select * from t2;
+a b
+4 4
+select * from t1 except all select * from t1 union all select * from t1 union all select * from t1 except all select * from t2;
+a b
+4 4
+2 2
+4 4
+4 4
+4 4
+4 4
+4 4
+2 2
+2 2
+select * from (select * from t1 except all select * from t2) q1 except all select * from (select * from t1 except all select * from t2) q2;
+a b
+EXPLAIN select * from t1 except all select * from t2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 7
+2 EXCEPT t2 ALL NULL NULL NULL NULL 7
+NULL EXCEPT RESULT <except1,2> ALL NULL NULL NULL NULL NULL
+EXPLAIN format=json select * from t1 except all select * from t2;
+EXPLAIN
+{
+ "query_block": {
+ "union_result": {
+ "table_name": "<except1,2>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 7,
+ "filtered": 100
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 2,
+ "operation": "EXCEPT",
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 7,
+ "filtered": 100
+ }
+ }
+ }
+ ]
+ }
+ }
+}
+EXPLAIN extended (select * from t1) except all (select * from t2);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 7 100.00
+2 EXCEPT t2 ALL NULL NULL NULL NULL 7 100.00
+NULL EXCEPT RESULT <except1,2> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 (/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) except all (/* select#2 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`)
+EXPLAIN extended select * from ((select * from t1) except all (select * from t2)) a;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 7 100.00
+2 DERIVED t1 ALL NULL NULL NULL NULL 7 100.00
+3 EXCEPT t2 ALL NULL NULL NULL NULL 7 100.00
+NULL EXCEPT RESULT <except2,3> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 /* select#1 */ select `a`.`a` AS `a`,`a`.`b` AS `b` from ((/* select#2 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) except all (/* select#3 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`)) `a`
+ANALYZE format=json select * from ((select a,b from t1) except all (select c,d from t2)) a;
+ANALYZE
+{
+ "query_block": {
+ "select_id": 1,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 7,
+ "r_rows": 4,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<except2,3>",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "r_rows": 4,
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 7,
+ "r_rows": 7,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "EXCEPT",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 7,
+ "r_rows": 7,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+}
+ANALYZE format=json select * from ((select a from t1) except all (select c from t2)) a;
+ANALYZE
+{
+ "query_block": {
+ "select_id": 1,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 7,
+ "r_rows": 4,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<except2,3>",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "r_rows": 4,
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 7,
+ "r_rows": 7,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "EXCEPT",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 7,
+ "r_rows": 7,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+}
+select * from ((select a from t1) except all (select c from t2)) a;
+a
+4
+2
+4
+4
+prepare stmt from "(select a,b from t1) except all (select c,d from t2)";
+execute stmt;
+a b
+4 4
+2 2
+4 4
+4 4
+execute stmt;
+a b
+4 4
+2 2
+4 4
+4 4
+prepare stmt from "select * from ((select a,b from t1) except all (select c,d from t2)) a";
+execute stmt;
+a b
+4 4
+2 2
+4 4
+4 4
+execute stmt;
+a b
+4 4
+2 2
+4 4
+4 4
+drop tables t1,t2;
+create table t1 (a int, b int) engine=MyISAM;
+create table t2 (c int, d int) engine=MyISAM;
+create table t3 (e int, f int) engine=MyISAM;
+create table t4 (g int, h int) engine=MyISAM;
+insert into t1 values (1,1),(2,2),(2,2);
+insert into t2 values (2,2),(3,3);
+insert into t3 values (4,4),(5,5),(4,4);
+insert into t4 values (4,4),(7,7),(4,4);
+(select a,b,e,f from t1,t3) except all (select c,d,g,h from t2,t4);
+a b e f
+1 1 4 4
+2 2 4 4
+1 1 5 5
+2 2 5 5
+1 1 4 4
+2 2 4 4
+2 2 5 5
+select * from ((select a,b,e,f from t1,t3) except all (select c,d,g,h from t2,t4)) t;
+a b e f
+1 1 4 4
+2 2 4 4
+1 1 5 5
+2 2 5 5
+1 1 4 4
+2 2 4 4
+2 2 5 5
+(select * from t1,t3) except all (select * from t2,t4);
+a b e f
+1 1 4 4
+2 2 4 4
+1 1 5 5
+2 2 5 5
+1 1 4 4
+2 2 4 4
+2 2 5 5
+(select a,b,e from t1,t3) except all (select c,d,g from t2,t4);
+a b e
+1 1 4
+2 2 4
+1 1 5
+2 2 5
+1 1 4
+2 2 4
+2 2 5
+EXPLAIN (select a,b,e,f from t1,t3) except all (select c,d,g,h from t2,t4);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 3
+1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
+2 EXCEPT t2 ALL NULL NULL NULL NULL 2
+2 EXCEPT t4 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
+NULL EXCEPT RESULT <except1,2> ALL NULL NULL NULL NULL NULL
+EXPLAIN select * from ((select a,b,e,f from t1,t3) except all (select c,d,g,h from t2,t4)) t;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 9
+2 DERIVED t1 ALL NULL NULL NULL NULL 3
+2 DERIVED t3 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
+3 EXCEPT t2 ALL NULL NULL NULL NULL 2
+3 EXCEPT t4 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
+NULL EXCEPT RESULT <except2,3> ALL NULL NULL NULL NULL NULL
+EXPLAIN extended select * from ((select a,b,e,f from t1,t3) except all (select c,d,g,h from t2,t4)) t;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 9 100.00
+2 DERIVED t1 ALL NULL NULL NULL NULL 3 100.00
+2 DERIVED t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+3 EXCEPT t2 ALL NULL NULL NULL NULL 2 100.00
+3 EXCEPT t4 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+NULL EXCEPT RESULT <except2,3> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 /* select#1 */ select `t`.`a` AS `a`,`t`.`b` AS `b`,`t`.`e` AS `e`,`t`.`f` AS `f` from ((/* select#2 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t1` join `test`.`t3`) except all (/* select#3 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t4`.`g` AS `g`,`test`.`t4`.`h` AS `h` from `test`.`t2` join `test`.`t4`)) `t`
+EXPLAIN format=json select * from ((select a,b,e,f from t1,t3) except all (select c,d,g,h from t2,t4)) t;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<except2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "119",
+ "join_type": "BNL"
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "EXCEPT",
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "t4",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "119",
+ "join_type": "BNL"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+}
+ANALYZE format=json (select a,b,e,f from t1,t3) except all (select c,d,g,h from t2,t4);
+ANALYZE
+{
+ "query_block": {
+ "union_result": {
+ "table_name": "<except1,2>",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "r_rows": 7,
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 1,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 3,
+ "r_rows": 3,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 3,
+ "r_rows": 3,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "119",
+ "join_type": "BNL",
+ "r_filtered": 100
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 2,
+ "operation": "EXCEPT",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 2,
+ "r_rows": 2,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "t4",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 3,
+ "r_rows": 3,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "119",
+ "join_type": "BNL",
+ "r_filtered": 100
+ }
+ }
+ }
+ ]
+ }
+ }
+}
+ANALYZE format=json select * from ((select a,b,e,f from t1,t3) except all (select c,d,g,h from t2,t4)) t;
+ANALYZE
+{
+ "query_block": {
+ "select_id": 1,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 9,
+ "r_rows": 7,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<except2,3>",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "r_rows": 7,
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 3,
+ "r_rows": 3,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 3,
+ "r_rows": 3,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "119",
+ "join_type": "BNL",
+ "r_filtered": 100
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "EXCEPT",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 2,
+ "r_rows": 2,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "t4",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 3,
+ "r_rows": 3,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "119",
+ "join_type": "BNL",
+ "r_filtered": 100
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+}
+prepare stmt from "(select a,b,e,f from t1,t3) except all (select c,d,g,h from t2,t4)";
+execute stmt;
+a b e f
+1 1 4 4
+2 2 4 4
+1 1 5 5
+2 2 5 5
+1 1 4 4
+2 2 4 4
+2 2 5 5
+execute stmt;
+a b e f
+1 1 4 4
+2 2 4 4
+1 1 5 5
+2 2 5 5
+1 1 4 4
+2 2 4 4
+2 2 5 5
+prepare stmt from "select * from ((select a,b,e,f from t1,t3) except all (select c,d,g,h from t2,t4)) a";
+execute stmt;
+a b e f
+1 1 4 4
+2 2 4 4
+1 1 5 5
+2 2 5 5
+1 1 4 4
+2 2 4 4
+2 2 5 5
+execute stmt;
+a b e f
+1 1 4 4
+2 2 4 4
+1 1 5 5
+2 2 5 5
+1 1 4 4
+2 2 4 4
+2 2 5 5
+drop tables t1,t2,t3,t4;
+select 1 as a from dual except all select 1 from dual;
+a
+(select 1 from dual) except all (select 1 from dual);
+1
+(select 1 from dual into @v) except all (select 1 from dual);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'into @v) except all (select 1 from dual)' at line 1
+select 1 from dual ORDER BY 1 except all select 1 from dual;
+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 'except all select 1 from dual' at line 1
+select 1 as a from dual union all select 1 from dual;
+a
+1
+1
+create table t1 (a int, b blob, a1 int, b1 blob) engine=MyISAM;
+create table t2 (c int, d blob, c1 int, d1 blob) engine=MyISAM;
+insert into t1 values (1,"ddd", 1, "sdfrrwwww"),(2, "fgh", 2, "dffggtt"),(2, "fgh", 2, "dffggtt");
+insert into t2 values (2, "fgh", 2, "dffggtt"),(3, "ffggddd", 3, "dfgg");
+(select a,b,b1 from t1) except all (select c,d,d1 from t2);
+a b b1
+1 ddd sdfrrwwww
+2 fgh dffggtt
+create table t3 (select a,b,b1 from t1) except all (select c,d,d1 from t2);
+show create table t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `a` int(11) DEFAULT NULL,
+ `b` blob DEFAULT NULL,
+ `b1` blob DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop tables t1,t2,t3;
+CREATE TABLE t (i INT);
+INSERT INTO t VALUES (1),(2);
+SELECT * FROM t WHERE i != ANY ( SELECT 3 EXCEPT ALL SELECT 3 );
+i
+drop table t;
diff --git a/mysql-test/main/except_all.test b/mysql-test/main/except_all.test
new file mode 100644
index 00000000000..f873b220126
--- /dev/null
+++ b/mysql-test/main/except_all.test
@@ -0,0 +1,99 @@
+create table t1 (a int, b int) engine=MyISAM;
+create table t2 (c int, d int) engine=MyISAM;
+insert into t1 values (1,1),(2,2),(3,3),(2,2),(4,4),(4,4),(4,4);
+insert into t2 values (1,1),(1,1),(1,1),(2,2),(3,3),(3,3),(5,5);
+
+select * from t1 except select * from t2;
+select * from t1 except all select * from t2;
+select * from t1 except all select c+1,d+1 from t2;
+(select * from t1) except all (select * from t2);
+select * from ((select * from t1) except all (select * from t2)) a;
+select * from ((select a from t1) except all (select c from t2)) a;
+select * from t1 except all select * from t1 union all select * from t1 union all select * from t1 except select * from t2;
+
+select * from t1 except all select * from t1 union all select * from t1 union all select * from t1 except all select * from t2;
+
+select * from (select * from t1 except all select * from t2) q1 except all select * from (select * from t1 except all select * from t2) q2;
+
+EXPLAIN select * from t1 except all select * from t2;
+EXPLAIN format=json select * from t1 except all select * from t2;
+EXPLAIN extended (select * from t1) except all (select * from t2);
+EXPLAIN extended select * from ((select * from t1) except all (select * from t2)) a;
+
+--source include/analyze-format.inc
+ANALYZE format=json select * from ((select a,b from t1) except all (select c,d from t2)) a;
+--source include/analyze-format.inc
+ANALYZE format=json select * from ((select a from t1) except all (select c from t2)) a;
+select * from ((select a from t1) except all (select c from t2)) a;
+
+prepare stmt from "(select a,b from t1) except all (select c,d from t2)";
+execute stmt;
+execute stmt;
+
+prepare stmt from "select * from ((select a,b from t1) except all (select c,d from t2)) a";
+execute stmt;
+execute stmt;
+
+drop tables t1,t2;
+
+create table t1 (a int, b int) engine=MyISAM;
+create table t2 (c int, d int) engine=MyISAM;
+create table t3 (e int, f int) engine=MyISAM;
+create table t4 (g int, h int) engine=MyISAM;
+insert into t1 values (1,1),(2,2),(2,2);
+insert into t2 values (2,2),(3,3);
+insert into t3 values (4,4),(5,5),(4,4);
+insert into t4 values (4,4),(7,7),(4,4);
+
+(select a,b,e,f from t1,t3) except all (select c,d,g,h from t2,t4);
+select * from ((select a,b,e,f from t1,t3) except all (select c,d,g,h from t2,t4)) t;
+(select * from t1,t3) except all (select * from t2,t4);
+(select a,b,e from t1,t3) except all (select c,d,g from t2,t4);
+
+EXPLAIN (select a,b,e,f from t1,t3) except all (select c,d,g,h from t2,t4);
+EXPLAIN select * from ((select a,b,e,f from t1,t3) except all (select c,d,g,h from t2,t4)) t;
+EXPLAIN extended select * from ((select a,b,e,f from t1,t3) except all (select c,d,g,h from t2,t4)) t;
+EXPLAIN format=json select * from ((select a,b,e,f from t1,t3) except all (select c,d,g,h from t2,t4)) t;
+
+--source include/analyze-format.inc
+ANALYZE format=json (select a,b,e,f from t1,t3) except all (select c,d,g,h from t2,t4);
+--source include/analyze-format.inc
+ANALYZE format=json select * from ((select a,b,e,f from t1,t3) except all (select c,d,g,h from t2,t4)) t;
+
+prepare stmt from "(select a,b,e,f from t1,t3) except all (select c,d,g,h from t2,t4)";
+execute stmt;
+execute stmt;
+
+prepare stmt from "select * from ((select a,b,e,f from t1,t3) except all (select c,d,g,h from t2,t4)) a";
+execute stmt;
+execute stmt;
+
+drop tables t1,t2,t3,t4;
+
+select 1 as a from dual except all select 1 from dual;
+(select 1 from dual) except all (select 1 from dual);
+--error ER_PARSE_ERROR
+(select 1 from dual into @v) except all (select 1 from dual);
+--error ER_PARSE_ERROR
+select 1 from dual ORDER BY 1 except all select 1 from dual;
+select 1 as a from dual union all select 1 from dual;
+
+create table t1 (a int, b blob, a1 int, b1 blob) engine=MyISAM;
+create table t2 (c int, d blob, c1 int, d1 blob) engine=MyISAM;
+insert into t1 values (1,"ddd", 1, "sdfrrwwww"),(2, "fgh", 2, "dffggtt"),(2, "fgh", 2, "dffggtt");
+insert into t2 values (2, "fgh", 2, "dffggtt"),(3, "ffggddd", 3, "dfgg");
+
+
+(select a,b,b1 from t1) except all (select c,d,d1 from t2);
+# make sure that blob is used
+create table t3 (select a,b,b1 from t1) except all (select c,d,d1 from t2);
+show create table t3;
+
+drop tables t1,t2,t3;
+
+CREATE TABLE t (i INT);
+INSERT INTO t VALUES (1),(2);
+
+SELECT * FROM t WHERE i != ANY ( SELECT 3 EXCEPT ALL SELECT 3 );
+
+drop table t; \ No newline at end of file
diff --git a/mysql-test/main/frm-debug.result b/mysql-test/main/frm-debug.result
new file mode 100644
index 00000000000..332d7e00a8f
--- /dev/null
+++ b/mysql-test/main/frm-debug.result
@@ -0,0 +1,24 @@
+#
+# MDEV-20042 Implement EXTRA2_FIELD_DATA_TYPE_INFO in FRM
+#
+SET SESSION debug_dbug="+d,frm_data_type_info";
+CREATE TABLE t1 (c01 INT, c02 CHAR(20), c03 TEXT, c04 DOUBLE);
+Warnings:
+Note 1105 build_frm_image: Field data type info length: 0
+DROP TABLE t1;
+SET SESSION debug_dbug="-d,frm_data_type_info";
+SET SESSION debug_dbug="+d,frm_data_type_info";
+SET SESSION debug_dbug="+d,frm_data_type_info_emulate";
+CREATE TABLE t1 (c01 INT, c02 CHAR(20), c03 TEXT, c04 DOUBLE);
+Warnings:
+Note 1105 build_frm_image: Field data type info length: 14
+Note 1105 DBUG: [0] name='c01' type_info=''
+Note 1105 DBUG: [1] name='c02' type_info='xchar'
+Note 1105 DBUG: [2] name='c03' type_info='xblob'
+Note 1105 DBUG: [3] name='c04' type_info=''
+SET SESSION debug_dbug="-d,frm_data_type_info_emulate";
+SET SESSION debug_dbug="-d,frm_data_type_info";
+FLUSH TABLES;
+SHOW CREATE TABLE t1;
+ERROR HY000: Unknown data type: 'xchar'
+DROP TABLE t1;
diff --git a/mysql-test/main/frm-debug.test b/mysql-test/main/frm-debug.test
new file mode 100644
index 00000000000..d86acdbc7e3
--- /dev/null
+++ b/mysql-test/main/frm-debug.test
@@ -0,0 +1,22 @@
+--source include/have_debug.inc
+
+--echo #
+--echo # MDEV-20042 Implement EXTRA2_FIELD_DATA_TYPE_INFO in FRM
+--echo #
+
+# This should have empty EXTRA2_FIELD_DATA_TYPE_INFO
+SET SESSION debug_dbug="+d,frm_data_type_info";
+CREATE TABLE t1 (c01 INT, c02 CHAR(20), c03 TEXT, c04 DOUBLE);
+DROP TABLE t1;
+SET SESSION debug_dbug="-d,frm_data_type_info";
+
+# This should have non-empty EXTRA2_FIELD_DATA_TYPE_INFO
+SET SESSION debug_dbug="+d,frm_data_type_info";
+SET SESSION debug_dbug="+d,frm_data_type_info_emulate";
+CREATE TABLE t1 (c01 INT, c02 CHAR(20), c03 TEXT, c04 DOUBLE);
+SET SESSION debug_dbug="-d,frm_data_type_info_emulate";
+SET SESSION debug_dbug="-d,frm_data_type_info";
+FLUSH TABLES;
+--error ER_UNKNOWN_DATA_TYPE
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
diff --git a/mysql-test/main/func_debug.result b/mysql-test/main/func_debug.result
index 47bbced730b..08650fdd3c3 100644
--- a/mysql-test/main/func_debug.result
+++ b/mysql-test/main/func_debug.result
@@ -1723,7 +1723,7 @@ a
2
3
Warnings:
-Note 1105 bin_eq=0 a=(int)-1 b=(bigint)18446744073709551615
+Note 1105 bin_eq=0 a=(int)-1 b=(bigint unsigned)18446744073709551615
SELECT * FROM t1 WHERE a BETWEEN -1 AND 18446744073709551616;
a
1
@@ -1746,7 +1746,7 @@ a
2
3
Warnings:
-Note 1105 bin_eq=0 a=(int)-1 b=(bigint)18446744073709551615
+Note 1105 bin_eq=0 a=(int)-1 b=(bigint unsigned)18446744073709551615
EXECUTE IMMEDIATE 'SELECT * FROM t1 WHERE a BETWEEN -1 AND ?' USING 18446744073709551616;
a
1
@@ -1863,8 +1863,8 @@ Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (row)
Note 1105 DBUG: [1] arg=2 handler=0 (row)
Note 1105 DBUG: ROW(3 args) level=0
-Note 1105 DBUG: [0,0] handler=bigint
-Note 1105 DBUG: [0,1] handler=bigint
+Note 1105 DBUG: [0,0] handler=bigint unsigned
+Note 1105 DBUG: [0,1] handler=bigint unsigned
Note 1105 DBUG: [0,2] handler=int
Note 1105 DBUG: => handler=decimal
Note 1105 DBUG: [1,0] handler=int
diff --git a/mysql-test/main/func_gconcat.result b/mysql-test/main/func_gconcat.result
index 79011b4fc5e..dcc15e78e17 100644
--- a/mysql-test/main/func_gconcat.result
+++ b/mysql-test/main/func_gconcat.result
@@ -1043,7 +1043,7 @@ DROP TABLE t1;
CREATE TABLE t1(f1 int);
INSERT INTO t1 values (0),(0);
SELECT POLYGON((SELECT 1 FROM (SELECT 1 IN (GROUP_CONCAT(t1.f1)) FROM t1, t1 t GROUP BY t.f1 ) d));
-ERROR HY000: Illegal parameter data type int for operation 'geometrycollection'
+ERROR HY000: Illegal parameter data type int for operation 'polygon'
DROP TABLE t1;
#
# Bug#58396 group_concat and explain extended are still crashy
diff --git a/mysql-test/main/func_hybrid_type.result b/mysql-test/main/func_hybrid_type.result
index 83965bc6db5..4be42cee523 100644
--- a/mysql-test/main/func_hybrid_type.result
+++ b/mysql-test/main/func_hybrid_type.result
@@ -4119,3 +4119,199 @@ c
#
# End of 10.4 tests
#
+#
+# Start of 10.5 tests
+#
+#
+# MDEV-20332 Wrong UNSIGNED metadata flag returned for COALESCE(unsigned_field,timestamp_field)
+#
+CREATE TABLE t1 (a INT UNSIGNED, b TIMESTAMP);
+SELECT COALESCE(a,b) FROM t1;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def COALESCE(a,b) 253 19 0 Y 0 39 8
+COALESCE(a,b)
+DROP TABLE t1;
+#
+# MDEV-20353 Add separate type handlers for unsigned integer data types
+#
+# Constant
+SELECT 1=ROW(1,1);
+ERROR HY000: Illegal parameter data types int and row for operation '='
+SELECT -1=ROW(1,1);
+ERROR HY000: Illegal parameter data types int and row for operation '='
+SELECT 9223372036854775807=ROW(1,1);
+ERROR HY000: Illegal parameter data types bigint and row for operation '='
+SELECT 9223372036854775808=ROW(1,1);
+ERROR HY000: Illegal parameter data types bigint unsigned and row for operation '='
+SELECT 18446744073709551615=ROW(1,1);
+ERROR HY000: Illegal parameter data types bigint unsigned and row for operation '='
+# COALESCE
+CREATE TABLE t1 (a TINYINT UNSIGNED, b TINYINT);
+SELECT COALESCE(a,a)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types tiny unsigned and row for operation '='
+SELECT COALESCE(b,b)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types tinyint and row for operation '='
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT UNSIGNED, b SMALLINT);
+SELECT COALESCE(a,a)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types smallint unsigned and row for operation '='
+SELECT COALESCE(b,b)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types smallint and row for operation '='
+DROP TABLE t1;
+CREATE TABLE t1 (a MEDIUMINT UNSIGNED, b MEDIUMINT);
+SELECT COALESCE(a,a)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types mediumint unsigned and row for operation '='
+SELECT COALESCE(b,b)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types mediumint and row for operation '='
+DROP TABLE t1;
+CREATE TABLE t1 (a INT UNSIGNED, b INT);
+SELECT COALESCE(a,a)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types int unsigned and row for operation '='
+SELECT COALESCE(b,b)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types int and row for operation '='
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT UNSIGNED, b BIGINT);
+SELECT COALESCE(a,a)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types bigint unsigned and row for operation '='
+SELECT COALESCE(b,b)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types bigint and row for operation '='
+DROP TABLE t1;
+# COALESCE for different types integer types, with the UNSIGNED flag
+CREATE TABLE t1 (a1 TINYINT UNSIGNED, a2 SMALLINT UNSIGNED);
+SELECT COALESCE(a1,a2)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types smallint unsigned and row for operation '='
+DROP TABLE t1;
+CREATE TABLE t1 (a1 SMALLINT UNSIGNED, a2 MEDIUMINT UNSIGNED);
+SELECT COALESCE(a1,a2)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types mediumint unsigned and row for operation '='
+DROP TABLE t1;
+CREATE TABLE t1 (a1 MEDIUMINT UNSIGNED, a2 INT UNSIGNED);
+SELECT COALESCE(a1,a2)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types int unsigned and row for operation '='
+DROP TABLE t1;
+CREATE TABLE t1 (a1 INT UNSIGNED, a2 BIGINT UNSIGNED);
+SELECT COALESCE(a1,a2)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types bigint unsigned and row for operation '='
+DROP TABLE t1;
+# COALESCE for different types integer types, without the UNSIGNED flag
+CREATE TABLE t1 (a1 TINYINT, a2 SMALLINT);
+SELECT COALESCE(a1,a2)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types smallint and row for operation '='
+DROP TABLE t1;
+CREATE TABLE t1 (a1 SMALLINT, a2 MEDIUMINT);
+SELECT COALESCE(a1,a2)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types mediumint and row for operation '='
+DROP TABLE t1;
+CREATE TABLE t1 (a1 MEDIUMINT, a2 INT);
+SELECT COALESCE(a1,a2)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types int and row for operation '='
+DROP TABLE t1;
+CREATE TABLE t1 (a1 INT, a2 BIGINT);
+SELECT COALESCE(a1,a2)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types bigint and row for operation '='
+DROP TABLE t1;
+# Operator +
+CREATE TABLE t1 (a TINYINT UNSIGNED, b TINYINT);
+SELECT (a+a)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types int unsigned and row for operation '='
+SELECT (b+b)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types int and row for operation '='
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT UNSIGNED, b SMALLINT);
+SELECT (a+a)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types int unsigned and row for operation '='
+SELECT (b+b)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types int and row for operation '='
+DROP TABLE t1;
+CREATE TABLE t1 (a MEDIUMINT UNSIGNED, b MEDIUMINT);
+SELECT (a+a)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types int unsigned and row for operation '='
+SELECT (b+b)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types bigint and row for operation '='
+DROP TABLE t1;
+CREATE TABLE t1 (a INT UNSIGNED, b INT);
+SELECT (a+a)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types bigint unsigned and row for operation '='
+SELECT (b+b)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types bigint and row for operation '='
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT UNSIGNED, b BIGINT);
+SELECT (a+a)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types bigint unsigned and row for operation '='
+SELECT (b+b)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types bigint and row for operation '='
+DROP TABLE t1;
+# Opetator + for different types integer types, with the UNSIGNED flag
+CREATE TABLE t1 (a1 TINYINT UNSIGNED, a2 SMALLINT UNSIGNED);
+SELECT (a1+a2)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types int unsigned and row for operation '='
+DROP TABLE t1;
+CREATE TABLE t1 (a1 SMALLINT UNSIGNED, a2 MEDIUMINT UNSIGNED);
+SELECT (a1+a2)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types int unsigned and row for operation '='
+DROP TABLE t1;
+CREATE TABLE t1 (a1 MEDIUMINT UNSIGNED, a2 INT UNSIGNED);
+SELECT (a1+a2)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types bigint unsigned and row for operation '='
+DROP TABLE t1;
+CREATE TABLE t1 (a1 INT UNSIGNED, a2 BIGINT UNSIGNED);
+SELECT (a1+a2)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types bigint unsigned and row for operation '='
+DROP TABLE t1;
+# Operator + for different types integer types, without the UNSIGNED flag
+CREATE TABLE t1 (a1 TINYINT, a2 SMALLINT);
+SELECT (a1+a2)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types int and row for operation '='
+DROP TABLE t1;
+CREATE TABLE t1 (a1 SMALLINT, a2 MEDIUMINT);
+SELECT (a1+a2)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types bigint and row for operation '='
+DROP TABLE t1;
+CREATE TABLE t1 (a1 MEDIUMINT, a2 INT);
+SELECT (a1+a2)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types bigint and row for operation '='
+DROP TABLE t1;
+CREATE TABLE t1 (a1 INT, a2 BIGINT);
+SELECT (a1+a2)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types bigint and row for operation '='
+DROP TABLE t1;
+# SUM
+CREATE TABLE t1 (a TINYINT UNSIGNED, b TINYINT);
+SELECT MAX(a)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types tiny unsigned and row for operation '='
+SELECT MAX(b)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types tinyint and row for operation '='
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT UNSIGNED, b SMALLINT);
+SELECT MAX(a)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types smallint unsigned and row for operation '='
+SELECT MAX(b)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types smallint and row for operation '='
+DROP TABLE t1;
+CREATE TABLE t1 (a MEDIUMINT UNSIGNED, b MEDIUMINT);
+SELECT MAX(a)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types mediumint unsigned and row for operation '='
+SELECT MAX(b)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types mediumint and row for operation '='
+DROP TABLE t1;
+CREATE TABLE t1 (a INT UNSIGNED, b INT);
+SELECT MAX(a)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types int unsigned and row for operation '='
+SELECT MAX(b)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types int and row for operation '='
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT UNSIGNED, b BIGINT);
+SELECT MAX(a)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types bigint unsigned and row for operation '='
+SELECT MAX(b)=ROW(1,1) FROM t1;
+ERROR HY000: Illegal parameter data types bigint and row for operation '='
+DROP TABLE t1;
+# HEX hybrid
+SELECT 0x20+ROW(1,1);
+ERROR HY000: Illegal parameter data types bigint unsigned and row for operation '+'
+# System variables
+SELECT @@max_allowed_packet=ROW(1,1);
+ERROR HY000: Illegal parameter data types bigint unsigned and row for operation '='
+#
+# End of 10.5 tests
+#
diff --git a/mysql-test/main/func_hybrid_type.test b/mysql-test/main/func_hybrid_type.test
index 31a096c3305..cf41d92b01f 100644
--- a/mysql-test/main/func_hybrid_type.test
+++ b/mysql-test/main/func_hybrid_type.test
@@ -825,3 +825,256 @@ SELECT 0 + LEAST(TIME'-10:00:00',TIME'10:00:00') AS c;
--echo #
--echo # End of 10.4 tests
--echo #
+
+
+--echo #
+--echo # Start of 10.5 tests
+--echo #
+
+--echo #
+--echo # MDEV-20332 Wrong UNSIGNED metadata flag returned for COALESCE(unsigned_field,timestamp_field)
+--echo #
+
+CREATE TABLE t1 (a INT UNSIGNED, b TIMESTAMP);
+--disable_ps_protocol
+--enable_metadata
+SELECT COALESCE(a,b) FROM t1;
+--disable_metadata
+--enable_ps_protocol
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-20353 Add separate type handlers for unsigned integer data types
+--echo #
+
+--echo # Constant
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT 1=ROW(1,1);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT -1=ROW(1,1);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT 9223372036854775807=ROW(1,1);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT 9223372036854775808=ROW(1,1);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT 18446744073709551615=ROW(1,1);
+
+
+--echo # COALESCE
+
+CREATE TABLE t1 (a TINYINT UNSIGNED, b TINYINT);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT COALESCE(a,a)=ROW(1,1) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT COALESCE(b,b)=ROW(1,1) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a SMALLINT UNSIGNED, b SMALLINT);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT COALESCE(a,a)=ROW(1,1) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT COALESCE(b,b)=ROW(1,1) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a MEDIUMINT UNSIGNED, b MEDIUMINT);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT COALESCE(a,a)=ROW(1,1) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT COALESCE(b,b)=ROW(1,1) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a INT UNSIGNED, b INT);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT COALESCE(a,a)=ROW(1,1) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT COALESCE(b,b)=ROW(1,1) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a BIGINT UNSIGNED, b BIGINT);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT COALESCE(a,a)=ROW(1,1) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT COALESCE(b,b)=ROW(1,1) FROM t1;
+DROP TABLE t1;
+
+
+--echo # COALESCE for different types integer types, with the UNSIGNED flag
+
+CREATE TABLE t1 (a1 TINYINT UNSIGNED, a2 SMALLINT UNSIGNED);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT COALESCE(a1,a2)=ROW(1,1) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a1 SMALLINT UNSIGNED, a2 MEDIUMINT UNSIGNED);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT COALESCE(a1,a2)=ROW(1,1) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a1 MEDIUMINT UNSIGNED, a2 INT UNSIGNED);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT COALESCE(a1,a2)=ROW(1,1) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a1 INT UNSIGNED, a2 BIGINT UNSIGNED);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT COALESCE(a1,a2)=ROW(1,1) FROM t1;
+DROP TABLE t1;
+
+
+--echo # COALESCE for different types integer types, without the UNSIGNED flag
+
+CREATE TABLE t1 (a1 TINYINT, a2 SMALLINT);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT COALESCE(a1,a2)=ROW(1,1) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a1 SMALLINT, a2 MEDIUMINT);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT COALESCE(a1,a2)=ROW(1,1) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a1 MEDIUMINT, a2 INT);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT COALESCE(a1,a2)=ROW(1,1) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a1 INT, a2 BIGINT);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT COALESCE(a1,a2)=ROW(1,1) FROM t1;
+DROP TABLE t1;
+
+
+--echo # Operator +
+
+CREATE TABLE t1 (a TINYINT UNSIGNED, b TINYINT);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT (a+a)=ROW(1,1) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT (b+b)=ROW(1,1) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a SMALLINT UNSIGNED, b SMALLINT);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT (a+a)=ROW(1,1) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT (b+b)=ROW(1,1) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a MEDIUMINT UNSIGNED, b MEDIUMINT);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT (a+a)=ROW(1,1) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT (b+b)=ROW(1,1) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a INT UNSIGNED, b INT);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT (a+a)=ROW(1,1) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT (b+b)=ROW(1,1) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a BIGINT UNSIGNED, b BIGINT);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT (a+a)=ROW(1,1) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT (b+b)=ROW(1,1) FROM t1;
+DROP TABLE t1;
+
+
+--echo # Opetator + for different types integer types, with the UNSIGNED flag
+
+CREATE TABLE t1 (a1 TINYINT UNSIGNED, a2 SMALLINT UNSIGNED);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT (a1+a2)=ROW(1,1) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a1 SMALLINT UNSIGNED, a2 MEDIUMINT UNSIGNED);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT (a1+a2)=ROW(1,1) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a1 MEDIUMINT UNSIGNED, a2 INT UNSIGNED);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT (a1+a2)=ROW(1,1) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a1 INT UNSIGNED, a2 BIGINT UNSIGNED);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT (a1+a2)=ROW(1,1) FROM t1;
+DROP TABLE t1;
+
+
+--echo # Operator + for different types integer types, without the UNSIGNED flag
+
+CREATE TABLE t1 (a1 TINYINT, a2 SMALLINT);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT (a1+a2)=ROW(1,1) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a1 SMALLINT, a2 MEDIUMINT);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT (a1+a2)=ROW(1,1) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a1 MEDIUMINT, a2 INT);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT (a1+a2)=ROW(1,1) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a1 INT, a2 BIGINT);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT (a1+a2)=ROW(1,1) FROM t1;
+DROP TABLE t1;
+
+--echo # SUM
+
+CREATE TABLE t1 (a TINYINT UNSIGNED, b TINYINT);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT MAX(a)=ROW(1,1) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT MAX(b)=ROW(1,1) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a SMALLINT UNSIGNED, b SMALLINT);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT MAX(a)=ROW(1,1) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT MAX(b)=ROW(1,1) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a MEDIUMINT UNSIGNED, b MEDIUMINT);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT MAX(a)=ROW(1,1) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT MAX(b)=ROW(1,1) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a INT UNSIGNED, b INT);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT MAX(a)=ROW(1,1) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT MAX(b)=ROW(1,1) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a BIGINT UNSIGNED, b BIGINT);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT MAX(a)=ROW(1,1) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT MAX(b)=ROW(1,1) FROM t1;
+DROP TABLE t1;
+
+--echo # HEX hybrid
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT 0x20+ROW(1,1);
+
+--echo # System variables
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT @@max_allowed_packet=ROW(1,1);
+
+--echo #
+--echo # End of 10.5 tests
+--echo #
diff --git a/mysql-test/main/func_json.result b/mysql-test/main/func_json.result
index 3343771c218..f61cca9e48c 100644
--- a/mysql-test/main/func_json.result
+++ b/mysql-test/main/func_json.result
@@ -1051,5 +1051,155 @@ SELECT * FROM t1 WHERE CASE WHEN JSON_OBJECT('x', (SELECT MAX(a=2) FROM t1))='{"
a
DROP TABLE t1;
#
+# MDEV-16620 JSON_ARRAYAGG
+#
+#
+# Integer aggregation
+#
+CREATE TABLE t1 (a INT, b INT);
+INSERT INTO t1 VALUES (1, 1),(2, 1), (1, 1),(2, 1), (3, 2),(2, 2),(2, 2),(2, 2);
+SELECT JSON_VALID(JSON_ARRAYAGG(a)) FROM t1;
+JSON_VALID(JSON_ARRAYAGG(a))
+1
+SELECT JSON_ARRAYAGG(a), JSON_ARRAYAGG(b) FROM t1;
+JSON_ARRAYAGG(a) JSON_ARRAYAGG(b)
+[1,2,1,2,3,2,2,2] [1,1,1,1,2,2,2,2]
+SELECT JSON_ARRAYAGG(a), JSON_ARRAYAGG(b) FROM t1 GROUP BY b;
+JSON_ARRAYAGG(a) JSON_ARRAYAGG(b)
+[1,2,1,2] [1,1,1,1]
+[3,2,2,2] [2,2,2,2]
+DROP TABLE t1;
+#
+# Real aggregation
+#
+CREATE TABLE t1 (a FLOAT, b DOUBLE, c DECIMAL(10, 2));
+INSERT INTO t1 VALUES (1.0, 2.0, 3.0),(1.0, 3.0, 9.0),(1.0, 4.0, 16.0),(1.0, 5.0, 25.0);
+SELECT JSON_VALID(JSON_ARRAYAGG(a)) FROM t1;
+JSON_VALID(JSON_ARRAYAGG(a))
+1
+SELECT JSON_ARRAYAGG(a), JSON_ARRAYAGG(b), JSON_ARRAYAGG(c) FROM t1;
+JSON_ARRAYAGG(a) JSON_ARRAYAGG(b) JSON_ARRAYAGG(c)
+[1,1,1,1] [2,3,4,5] [3.00,9.00,16.00,25.00]
+DROP TABLE t1;
+#
+# Boolean aggregation
+#
+CREATE TABLE t1 (a BOOLEAN, b BOOLEAN);
+INSERT INTO t1 VALUES (TRUE, TRUE), (TRUE, FALSE), (FALSE, TRUE), (FALSE, FALSE);
+SELECT JSON_VALID(JSON_ARRAYAGG(a)) FROM t1;
+JSON_VALID(JSON_ARRAYAGG(a))
+1
+SELECT JSON_ARRAYAGG(a), JSON_ARRAYAGG(b) FROM t1;
+JSON_ARRAYAGG(a) JSON_ARRAYAGG(b)
+[1,1,0,0] [1,0,1,0]
+SELECT JSON_ARRAYAGG(a), JSON_ARRAYAGG(b) FROM t1 GROUP BY b;
+JSON_ARRAYAGG(a) JSON_ARRAYAGG(b)
+[1,0] [0,0]
+[1,0] [1,1]
+SELECT JSON_ARRAYAGG(TRUE), JSON_ARRAYAGG(FALSE) FROM t1;
+JSON_ARRAYAGG(TRUE) JSON_ARRAYAGG(FALSE)
+[true,true,true,true] [false,false,false,false]
+DROP TABLE t1;
+#
+# Aggregation of strings with quoted
+#
+CREATE TABLE t1 (a VARCHAR(80));
+INSERT INTO t1 VALUES
+('"double_quoted_value"'), ("'single_quoted_value'"),
+('"double_quoted_value"'), ("'single_quoted_value'");
+SELECT JSON_VALID(JSON_ARRAYAGG(a)) FROM t1;
+JSON_VALID(JSON_ARRAYAGG(a))
+1
+SELECT JSON_ARRAYAGG(a) FROM t1;
+JSON_ARRAYAGG(a)
+["\"double_quoted_value\"","'single_quoted_value'","\"double_quoted_value\"","'single_quoted_value'"]
+DROP TABLE t1;
+#
+# Strings and NULLs
+#
+CREATE TABLE t1 (a INT, b VARCHAR(80));
+INSERT INTO t1 VALUES
+(1, "Hello"),(1, "World"), (2, "This"),(2, "Will"), (2, "Work"),(2, "!"), (3, NULL),
+(1, "Hello"),(1, "World"), (2, "This"),(2, "Will"), (2, "Work"),(2, "!"), (3, NULL);
+SELECT JSON_VALID(JSON_ARRAYAGG(b)) FROM t1;
+JSON_VALID(JSON_ARRAYAGG(b))
+1
+SELECT JSON_ARRAYAGG(a), JSON_ARRAYAGG(b) FROM t1;
+JSON_ARRAYAGG(a) JSON_ARRAYAGG(b)
+[1,1,2,2,2,2,3,1,1,2,2,2,2,3] ["Hello","World","This","Will","Work","!",null,"Hello","World","This","Will","Work","!",null]
+SELECT JSON_ARRAYAGG(a), JSON_ARRAYAGG(b) FROM t1 GROUP BY a;
+JSON_ARRAYAGG(a) JSON_ARRAYAGG(b)
+[1,1,1,1] ["Hello","World","Hello","World"]
+[2,2,2,2,2,2,2,2] ["!","Work","Will","This","Will","This","!","Work"]
+[3,3] [null,null]
+#
+# DISTINCT and LIMIT
+#
+SELECT JSON_ARRAYAGG(b LIMIT 1) FROM t1;
+JSON_ARRAYAGG(b LIMIT 1)
+["Hello"]
+SELECT JSON_ARRAYAGG(b LIMIT 2) FROM t1;
+JSON_ARRAYAGG(b LIMIT 2)
+["Hello","World"]
+SELECT JSON_ARRAYAGG(b LIMIT 1) FROM t1 GROUP BY b;
+JSON_ARRAYAGG(b LIMIT 1)
+[null]
+["!"]
+["Hello"]
+["This"]
+["Will"]
+["Work"]
+["World"]
+SELECT JSON_ARRAYAGG(b LIMIT 2) FROM t1 GROUP BY a;
+JSON_ARRAYAGG(b LIMIT 2)
+["Hello","World"]
+["!","Work"]
+[null,null]
+SELECT JSON_ARRAYAGG(DISTINCT a) FROM t1;
+JSON_ARRAYAGG(DISTINCT a)
+[1,2,3]
+SELECT JSON_ARRAYAGG(DISTINCT b) FROM t1;
+JSON_ARRAYAGG(DISTINCT b)
+["Hello","World","This","Will","Work","!",null]
+SELECT JSON_ARRAYAGG(DISTINCT a LIMIT 2) FROM t1;
+JSON_ARRAYAGG(DISTINCT a LIMIT 2)
+[1,2]
+SELECT JSON_ARRAYAGG(DISTINCT b LIMIT 2) FROM t1;
+JSON_ARRAYAGG(DISTINCT b LIMIT 2)
+["Hello","World"]
+#
+# JSON aggregation
+#
+SELECT JSON_VALID(JSON_ARRAYAGG(JSON_ARRAY(a, b))) FROM t1;
+JSON_VALID(JSON_ARRAYAGG(JSON_ARRAY(a, b)))
+1
+SELECT JSON_ARRAYAGG(JSON_ARRAY(a, b)) FROM t1;
+JSON_ARRAYAGG(JSON_ARRAY(a, b))
+[[1, "Hello"],[1, "World"],[2, "This"],[2, "Will"],[2, "Work"],[2, "!"],[3, null],[1, "Hello"],[1, "World"],[2, "This"],[2, "Will"],[2, "Work"],[2, "!"],[3, null]]
+SELECT JSON_ARRAYAGG(JSON_ARRAY(a, b)) FROM t1 GROUP BY a;
+JSON_ARRAYAGG(JSON_ARRAY(a, b))
+[[1, "Hello"],[1, "World"],[1, "Hello"],[1, "World"]]
+[[2, "!"],[2, "Work"],[2, "Will"],[2, "This"],[2, "Will"],[2, "This"],[2, "!"],[2, "Work"]]
+[[3, null],[3, null]]
+SELECT JSON_VALID(JSON_ARRAYAGG(JSON_OBJECT('a', a, 'b', b))) FROM t1;
+JSON_VALID(JSON_ARRAYAGG(JSON_OBJECT('a', a, 'b', b)))
+1
+SELECT JSON_ARRAYAGG(JSON_OBJECT('a', a, 'b', b)) FROM t1;
+JSON_ARRAYAGG(JSON_OBJECT('a', a, 'b', b))
+[{"a": 1, "b": "Hello"},{"a": 1, "b": "World"},{"a": 2, "b": "This"},{"a": 2, "b": "Will"},{"a": 2, "b": "Work"},{"a": 2, "b": "!"},{"a": 3, "b": null},{"a": 1, "b": "Hello"},{"a": 1, "b": "World"},{"a": 2, "b": "This"},{"a": 2, "b": "Will"},{"a": 2, "b": "Work"},{"a": 2, "b": "!"},{"a": 3, "b": null}]
+SELECT JSON_ARRAYAGG(JSON_OBJECT('a', a, 'b', b)) FROM t1 GROUP BY a;
+JSON_ARRAYAGG(JSON_OBJECT('a', a, 'b', b))
+[{"a": 1, "b": "Hello"},{"a": 1, "b": "World"},{"a": 1, "b": "Hello"},{"a": 1, "b": "World"}]
+[{"a": 2, "b": "!"},{"a": 2, "b": "Work"},{"a": 2, "b": "Will"},{"a": 2, "b": "This"},{"a": 2, "b": "Will"},{"a": 2, "b": "This"},{"a": 2, "b": "!"},{"a": 2, "b": "Work"}]
+[{"a": 3, "b": null},{"a": 3, "b": null}]
+#
+# Error checks
+#
+SELECT JSON_ARRAYAGG(a, b) FROM t1;
+ERROR 42000: Incorrect parameter count in the call to native function 'JSON_ARRAYAGG'
+SELECT JSON_ARRAYAGG(JSON_ARRAYAGG(a, b)) FROM t1;
+ERROR HY000: Invalid use of group function
+DROP TABLE t1;
+#
# End of 10.4 tests
#
diff --git a/mysql-test/main/func_json.test b/mysql-test/main/func_json.test
index 1ac47d4f329..13ebe986615 100644
--- a/mysql-test/main/func_json.test
+++ b/mysql-test/main/func_json.test
@@ -628,6 +628,96 @@ SELECT * FROM t1 WHERE CASE WHEN JSON_OBJECT('x', (SELECT MAX(a=2) FROM t1))='{"
DROP TABLE t1;
+-- echo #
+-- echo # MDEV-16620 JSON_ARRAYAGG
+-- echo #
+
+-- echo #
+-- echo # Integer aggregation
+-- echo #
+CREATE TABLE t1 (a INT, b INT);
+INSERT INTO t1 VALUES (1, 1),(2, 1), (1, 1),(2, 1), (3, 2),(2, 2),(2, 2),(2, 2);
+SELECT JSON_VALID(JSON_ARRAYAGG(a)) FROM t1;
+SELECT JSON_ARRAYAGG(a), JSON_ARRAYAGG(b) FROM t1;
+SELECT JSON_ARRAYAGG(a), JSON_ARRAYAGG(b) FROM t1 GROUP BY b;
+DROP TABLE t1;
+
+-- echo #
+-- echo # Real aggregation
+-- echo #
+CREATE TABLE t1 (a FLOAT, b DOUBLE, c DECIMAL(10, 2));
+INSERT INTO t1 VALUES (1.0, 2.0, 3.0),(1.0, 3.0, 9.0),(1.0, 4.0, 16.0),(1.0, 5.0, 25.0);
+SELECT JSON_VALID(JSON_ARRAYAGG(a)) FROM t1;
+SELECT JSON_ARRAYAGG(a), JSON_ARRAYAGG(b), JSON_ARRAYAGG(c) FROM t1;
+DROP TABLE t1;
+
+-- echo #
+-- echo # Boolean aggregation
+-- echo #
+CREATE TABLE t1 (a BOOLEAN, b BOOLEAN);
+INSERT INTO t1 VALUES (TRUE, TRUE), (TRUE, FALSE), (FALSE, TRUE), (FALSE, FALSE);
+SELECT JSON_VALID(JSON_ARRAYAGG(a)) FROM t1;
+SELECT JSON_ARRAYAGG(a), JSON_ARRAYAGG(b) FROM t1;
+SELECT JSON_ARRAYAGG(a), JSON_ARRAYAGG(b) FROM t1 GROUP BY b;
+SELECT JSON_ARRAYAGG(TRUE), JSON_ARRAYAGG(FALSE) FROM t1;
+DROP TABLE t1;
+
+-- echo #
+-- echo # Aggregation of strings with quoted
+-- echo #
+CREATE TABLE t1 (a VARCHAR(80));
+INSERT INTO t1 VALUES
+ ('"double_quoted_value"'), ("'single_quoted_value'"),
+ ('"double_quoted_value"'), ("'single_quoted_value'");
+SELECT JSON_VALID(JSON_ARRAYAGG(a)) FROM t1;
+SELECT JSON_ARRAYAGG(a) FROM t1;
+DROP TABLE t1;
+
+-- echo #
+-- echo # Strings and NULLs
+-- echo #
+CREATE TABLE t1 (a INT, b VARCHAR(80));
+INSERT INTO t1 VALUES
+ (1, "Hello"),(1, "World"), (2, "This"),(2, "Will"), (2, "Work"),(2, "!"), (3, NULL),
+ (1, "Hello"),(1, "World"), (2, "This"),(2, "Will"), (2, "Work"),(2, "!"), (3, NULL);
+SELECT JSON_VALID(JSON_ARRAYAGG(b)) FROM t1;
+SELECT JSON_ARRAYAGG(a), JSON_ARRAYAGG(b) FROM t1;
+SELECT JSON_ARRAYAGG(a), JSON_ARRAYAGG(b) FROM t1 GROUP BY a;
+
+-- echo #
+-- echo # DISTINCT and LIMIT
+-- echo #
+SELECT JSON_ARRAYAGG(b LIMIT 1) FROM t1;
+SELECT JSON_ARRAYAGG(b LIMIT 2) FROM t1;
+SELECT JSON_ARRAYAGG(b LIMIT 1) FROM t1 GROUP BY b;
+SELECT JSON_ARRAYAGG(b LIMIT 2) FROM t1 GROUP BY a;
+SELECT JSON_ARRAYAGG(DISTINCT a) FROM t1;
+SELECT JSON_ARRAYAGG(DISTINCT b) FROM t1;
+SELECT JSON_ARRAYAGG(DISTINCT a LIMIT 2) FROM t1;
+SELECT JSON_ARRAYAGG(DISTINCT b LIMIT 2) FROM t1;
+
+-- echo #
+-- echo # JSON aggregation
+-- echo #
+SELECT JSON_VALID(JSON_ARRAYAGG(JSON_ARRAY(a, b))) FROM t1;
+SELECT JSON_ARRAYAGG(JSON_ARRAY(a, b)) FROM t1;
+SELECT JSON_ARRAYAGG(JSON_ARRAY(a, b)) FROM t1 GROUP BY a;
+
+SELECT JSON_VALID(JSON_ARRAYAGG(JSON_OBJECT('a', a, 'b', b))) FROM t1;
+SELECT JSON_ARRAYAGG(JSON_OBJECT('a', a, 'b', b)) FROM t1;
+SELECT JSON_ARRAYAGG(JSON_OBJECT('a', a, 'b', b)) FROM t1 GROUP BY a;
+
+-- echo #
+-- echo # Error checks
+-- echo #
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT JSON_ARRAYAGG(a, b) FROM t1;
+
+--error ER_INVALID_GROUP_FUNC_USE
+SELECT JSON_ARRAYAGG(JSON_ARRAYAGG(a, b)) FROM t1;
+
+DROP TABLE t1;
+
--echo #
--echo # End of 10.4 tests
--echo #
diff --git a/mysql-test/main/func_misc.result b/mysql-test/main/func_misc.result
index f4645ed089d..a54da192e9c 100644
--- a/mysql-test/main/func_misc.result
+++ b/mysql-test/main/func_misc.result
@@ -1345,6 +1345,9 @@ SELECT IS_IPV4_MAPPED(INET6_ATON('1.2.3.4')),
IS_IPV4_COMPAT(INET6_ATON('1.2.3.4'));
IS_IPV4_MAPPED(INET6_ATON('1.2.3.4')) IS_IPV4_COMPAT(INET6_ATON('1.2.3.4'))
0 0
+Warnings:
+Warning 1292 Incorrect inet6 value: '\x01\x02\x03\x04'
+Warning 1292 Incorrect inet6 value: '\x01\x02\x03\x04'
SELECT IS_IPV4_MAPPED(INET6_ATON('::1.2.3.4')),
IS_IPV4_COMPAT(INET6_ATON('::1.2.3.4'));
IS_IPV4_MAPPED(INET6_ATON('::1.2.3.4')) IS_IPV4_COMPAT(INET6_ATON('::1.2.3.4'))
diff --git a/mysql-test/main/func_time.result b/mysql-test/main/func_time.result
index 791920fca8d..4faf9731a29 100644
--- a/mysql-test/main/func_time.result
+++ b/mysql-test/main/func_time.result
@@ -3686,15 +3686,15 @@ SET TIMESTAMP=DEFAULT;
# MDEV-15702 Remove the use of STRING_ITEM from Item_func_date_format::fix_length_and_dec()
#
SELECT DATE_FORMAT('2001-01-01',POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'date_format'
+ERROR HY000: Illegal parameter data type point for operation 'date_format'
SELECT DATE_FORMAT(POINT(1,1),'10');
-ERROR HY000: Illegal parameter data type geometry for operation 'date_format'
+ERROR HY000: Illegal parameter data type point for operation 'date_format'
SELECT DATE_FORMAT('2001-01-01',ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'date_format'
SELECT DATE_FORMAT(ROW(1,1),'10');
ERROR HY000: Illegal parameter data type row for operation 'date_format'
SELECT DATE_FORMAT('2001-01-01','%Y',POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'date_format'
+ERROR HY000: Illegal parameter data type point for operation 'date_format'
SELECT DATE_FORMAT('2001-01-01','%Y',ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'date_format'
SELECT DATE_FORMAT('2001-01-01','%Y',@unknown_user_variable);
diff --git a/mysql-test/main/gis-debug.result b/mysql-test/main/gis-debug.result
index 2daa810db0d..f490a720ecf 100644
--- a/mysql-test/main/gis-debug.result
+++ b/mysql-test/main/gis-debug.result
@@ -356,22 +356,16 @@ SET SESSION debug_dbug="-d,Item_func_in";
# MDEV-12238 Add Type_handler::Item_func_{plus|minus|mul|div|mod}_fix_length_and_dec()
#
SET debug_dbug='+d,num_op';
-CREATE TABLE t1 AS SELECT
-POINT(0,0)+POINT(0,0),
-POINT(0,0)-POINT(0,0),
-POINT(0,0)*POINT(0,0),
-POINT(0,0)/POINT(0,0),
-POINT(0,0) MOD POINT(0,0) LIMIT 0;
-SHOW CREATE TABLE t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `POINT(0,0)+POINT(0,0)` geometry DEFAULT NULL,
- `POINT(0,0)-POINT(0,0)` geometry DEFAULT NULL,
- `POINT(0,0)*POINT(0,0)` geometry DEFAULT NULL,
- `POINT(0,0)/POINT(0,0)` geometry DEFAULT NULL,
- `POINT(0,0) MOD POINT(0,0)` geometry DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
-DROP TABLE t1;
+SELECT POINT(0,0)+POINT(0,0);
+ERROR HY000: Illegal parameter data types point and point for operation '+'
+SELECT POINT(0,0)-POINT(0,0);
+ERROR HY000: Illegal parameter data types point and point for operation '-'
+SELECT POINT(0,0)*POINT(0,0);
+ERROR HY000: Illegal parameter data types point and point for operation '*'
+SELECT POINT(0,0)/POINT(0,0);
+ERROR HY000: Illegal parameter data types point and point for operation '/'
+SELECT POINT(0,0) MOD POINT(0,0);
+ERROR HY000: Illegal parameter data types point and point for operation 'MOD'
CREATE TABLE t1 AS SELECT
POINT(0,0)+'0',
POINT(0,0)-'0',
@@ -399,11 +393,11 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 AS SELECT '0'-POINT(0,0) LIMIT 0;
-ERROR HY000: Illegal parameter data types varchar and geometry for operation '-'
+ERROR HY000: Illegal parameter data types varchar and point for operation '-'
CREATE TABLE t1 AS SELECT '0'/POINT(0,0) LIMIT 0;
-ERROR HY000: Illegal parameter data types varchar and geometry for operation '/'
+ERROR HY000: Illegal parameter data types varchar and point for operation '/'
CREATE TABLE t1 AS SELECT '0' MOD POINT(0,0) LIMIT 0;
-ERROR HY000: Illegal parameter data types varchar and geometry for operation 'MOD'
+ERROR HY000: Illegal parameter data types varchar and point for operation 'MOD'
SET debug_dbug='-d,num_op';
#
# End of 10.3 tests
@@ -424,9 +418,9 @@ Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (row)
Note 1105 DBUG: [1] arg=2 handler=0 (row)
Note 1105 DBUG: ROW(3 args) level=0
-Note 1105 DBUG: [0,0] handler=geometry
-Note 1105 DBUG: [0,1] handler=geometry
-Note 1105 DBUG: [0,2] handler=geometry
+Note 1105 DBUG: [0,0] handler=point
+Note 1105 DBUG: [0,1] handler=point
+Note 1105 DBUG: [0,2] handler=point
Note 1105 DBUG: => handler=geometry
Note 1105 DBUG: [1,0] handler=int
Note 1105 DBUG: [1,1] handler=int
@@ -449,9 +443,9 @@ Note 1105 DBUG: [1,1] handler=row
Note 1105 DBUG: [1,2] handler=row
Note 1105 DBUG: => handler=row
Note 1105 DBUG: ROW(3 args) level=1
-Note 1105 DBUG: [0,0] handler=geometry
-Note 1105 DBUG: [0,1] handler=geometry
-Note 1105 DBUG: [0,2] handler=geometry
+Note 1105 DBUG: [0,0] handler=point
+Note 1105 DBUG: [0,1] handler=point
+Note 1105 DBUG: [0,2] handler=point
Note 1105 DBUG: => handler=geometry
Note 1105 DBUG: [1,0] handler=int
Note 1105 DBUG: [1,1] handler=int
@@ -459,18 +453,18 @@ Note 1105 DBUG: [1,2] handler=int
Note 1105 DBUG: => handler=bigint
Note 1105 DBUG: types_compatible=yes bisect=no
SELECT (1,0) IN ((POINT(1,1),0),(0,0));
-ERROR HY000: Illegal parameter data types int and geometry for operation 'in'
+ERROR HY000: Illegal parameter data types int and point for operation 'in'
SHOW WARNINGS;
Level Code Message
Note 1105 DBUG: [0] arg=1 handler=0 (row)
Note 1105 DBUG: [1] arg=2 handler=0 (row)
Note 1105 DBUG: ROW(3 args) level=0
Note 1105 DBUG: [0,0] handler=int
-Note 1105 DBUG: [0,1] handler=geometry
+Note 1105 DBUG: [0,1] handler=point
Note 1105 DBUG: [0,2] handler=int
-Error 4078 Illegal parameter data types int and geometry for operation 'in'
+Error 4078 Illegal parameter data types int and point for operation 'in'
SELECT (1,(0,0)) IN ((1,(POINT(1,1),0)),(0,(0,0)));
-ERROR HY000: Illegal parameter data types int and geometry for operation 'in'
+ERROR HY000: Illegal parameter data types int and point for operation 'in'
SHOW WARNINGS;
Level Code Message
Note 1105 DBUG: [0] arg=1 handler=0 (row)
@@ -486,12 +480,35 @@ Note 1105 DBUG: [1,2] handler=row
Note 1105 DBUG: => handler=row
Note 1105 DBUG: ROW(3 args) level=1
Note 1105 DBUG: [0,0] handler=int
-Note 1105 DBUG: [0,1] handler=geometry
+Note 1105 DBUG: [0,1] handler=point
Note 1105 DBUG: [0,2] handler=int
-Error 4078 Illegal parameter data types int and geometry for operation 'in'
+Error 4078 Illegal parameter data types int and point for operation 'in'
SET SESSION debug_dbug="-d,Predicant_to_list_comparator";
SET SESSION debug_dbug="-d,Item_func_in";
SET SESSION debug_dbug="-d,cmp_item";
#
# End of 10.4 tests
#
+#
+# Start of 10.5 tests
+#
+#
+# MDEV-19994 Add class Function_collection
+#
+SET SESSION debug_dbug="+d,make_item_func_call_native_simulate_not_found";
+SELECT CONTAINS(POINT(1,1),POINT(1,1));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(POINT(1,1),POINT(1,1))' at line 1
+SELECT WITHIN(POINT(1,1),POINT(1,1));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(POINT(1,1),POINT(1,1))' at line 1
+SET SESSION debug_dbug="-d,make_item_func_call_native_simulate_not_found";
+#
+# MDEV-20009 Add CAST(expr AS pluggable_type)
+#
+SET SESSION debug_dbug="+d,emulate_geometry_create_typecast_item";
+SELECT AsText(CAST('POINT(0 0)' AS GEOMETRY));
+AsText(CAST('POINT(0 0)' AS GEOMETRY))
+POINT(0 0)
+SET SESSION debug_dbug="-d,emulate_geometry_create_typecast_item";
+#
+# End of 10.5 tests
+#
diff --git a/mysql-test/main/gis-debug.test b/mysql-test/main/gis-debug.test
index dd64ce0f04c..0e11c11e5b5 100644
--- a/mysql-test/main/gis-debug.test
+++ b/mysql-test/main/gis-debug.test
@@ -73,15 +73,19 @@ SET SESSION debug_dbug="-d,Item_func_in";
SET debug_dbug='+d,num_op';
-# (GEOMETRY,GEOMETRY) gives GEOMETRY for all operators
-CREATE TABLE t1 AS SELECT
- POINT(0,0)+POINT(0,0),
- POINT(0,0)-POINT(0,0),
- POINT(0,0)*POINT(0,0),
- POINT(0,0)/POINT(0,0),
- POINT(0,0) MOD POINT(0,0) LIMIT 0;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
+# (GEOMETRY,GEOMETRY) goes through
+# Type_collection_geometry::aggregate_for_num_op() which fails.
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT POINT(0,0)+POINT(0,0);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT POINT(0,0)-POINT(0,0);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT POINT(0,0)*POINT(0,0);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT POINT(0,0)/POINT(0,0);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT POINT(0,0) MOD POINT(0,0);
# (GEOMETRY,VARCHAR) gives GEOMETRY for all operators
CREATE TABLE t1 AS SELECT
@@ -147,3 +151,32 @@ SET SESSION debug_dbug="-d,cmp_item";
--echo #
--echo # End of 10.4 tests
--echo #
+
+
+--echo #
+--echo # Start of 10.5 tests
+--echo #
+
+--echo #
+--echo # MDEV-19994 Add class Function_collection
+--echo #
+
+SET SESSION debug_dbug="+d,make_item_func_call_native_simulate_not_found";
+--error ER_PARSE_ERROR
+SELECT CONTAINS(POINT(1,1),POINT(1,1));
+--error ER_PARSE_ERROR
+SELECT WITHIN(POINT(1,1),POINT(1,1));
+SET SESSION debug_dbug="-d,make_item_func_call_native_simulate_not_found";
+
+--echo #
+--echo # MDEV-20009 Add CAST(expr AS pluggable_type)
+--echo #
+
+SET SESSION debug_dbug="+d,emulate_geometry_create_typecast_item";
+SELECT AsText(CAST('POINT(0 0)' AS GEOMETRY));
+SET SESSION debug_dbug="-d,emulate_geometry_create_typecast_item";
+
+
+--echo #
+--echo # End of 10.5 tests
+--echo #
diff --git a/mysql-test/main/gis.result b/mysql-test/main/gis.result
index 09afb6033b3..936924ffe87 100644
--- a/mysql-test/main/gis.result
+++ b/mysql-test/main/gis.result
@@ -488,7 +488,7 @@ explain extended select issimple(MultiPoint(Point(3, 6), Point(4, 10))), issimpl
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select st_issimple(geometrycollection(point(3,6),point(4,10))) AS `issimple(MultiPoint(Point(3, 6), Point(4, 10)))`,st_issimple(point(3,6)) AS `issimple(Point(3, 6))`
+Note 1003 select st_issimple(multipoint(point(3,6),point(4,10))) AS `issimple(MultiPoint(Point(3, 6), Point(4, 10)))`,st_issimple(point(3,6)) AS `issimple(Point(3, 6))`
create table t1 (a geometry not null);
insert into t1 values (GeomFromText('Point(1 2)'));
insert into t1 values ('Garbage');
@@ -1049,7 +1049,7 @@ f5 datetime YES NULL
drop view v1;
drop table t1;
SELECT MultiPoint(12345,'');
-ERROR HY000: Illegal parameter data type int for operation 'geometrycollection'
+ERROR HY000: Illegal parameter data type int for operation 'multipoint'
SELECT 1 FROM (SELECT GREATEST(1,GEOMETRYCOLLECTION('00000','00000')) b FROM DUAL) AS d WHERE (LINESTRING(d.b));
ERROR HY000: Illegal parameter data type varchar for operation 'geometrycollection'
#
@@ -1889,10 +1889,10 @@ DROP TABLE t1;
create view v1 as select AsWKT(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9))));
show create view v1;
View Create View character_set_client collation_connection
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select st_astext(geometrycollection(point(44,6),geometrycollection(point(3,6),point(7,9)))) AS `Name_exp_1` latin1 latin1_swedish_ci
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select st_astext(geometrycollection(point(44,6),linestring(point(3,6),point(7,9)))) AS `Name_exp_1` latin1 latin1_swedish_ci
select * from v1;
Name_exp_1
-GEOMETRYCOLLECTION(POINT(44 6),GEOMETRYCOLLECTION(POINT(3 6),POINT(7 9)))
+GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
drop view v1;
#
# MDEV-10134 Add full support for DEFAULT
@@ -2498,309 +2498,309 @@ CREATE TABLE t1 (a TINYINT, b Point)
CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1
ERROR:
-Illegal parameter data types tinyint and geometry for operation 'case'
+Illegal parameter data types tinyint and point for operation 'case'
CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1
ERROR:
-Illegal parameter data types tinyint and geometry for operation 'coalesce'
+Illegal parameter data types tinyint and point for operation 'coalesce'
CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1
ERROR:
-Illegal parameter data types tinyint and geometry for operation 'if'
+Illegal parameter data types tinyint and point for operation 'if'
CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1
ERROR:
-Illegal parameter data types tinyint and geometry for operation 'ifnull'
+Illegal parameter data types tinyint and point for operation 'ifnull'
CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1
ERROR:
-Illegal parameter data types tinyint and geometry for operation 'UNION'
+Illegal parameter data types tinyint and point for operation 'UNION'
-------------------------------------
CREATE TABLE t1 (a SMALLINT, b Point)
CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1
ERROR:
-Illegal parameter data types smallint and geometry for operation 'case'
+Illegal parameter data types smallint and point for operation 'case'
CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1
ERROR:
-Illegal parameter data types smallint and geometry for operation 'coalesce'
+Illegal parameter data types smallint and point for operation 'coalesce'
CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1
ERROR:
-Illegal parameter data types smallint and geometry for operation 'if'
+Illegal parameter data types smallint and point for operation 'if'
CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1
ERROR:
-Illegal parameter data types smallint and geometry for operation 'ifnull'
+Illegal parameter data types smallint and point for operation 'ifnull'
CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1
ERROR:
-Illegal parameter data types smallint and geometry for operation 'UNION'
+Illegal parameter data types smallint and point for operation 'UNION'
-------------------------------------
CREATE TABLE t1 (a MEDIUMINT, b Point)
CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1
ERROR:
-Illegal parameter data types mediumint and geometry for operation 'case'
+Illegal parameter data types mediumint and point for operation 'case'
CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1
ERROR:
-Illegal parameter data types mediumint and geometry for operation 'coalesce'
+Illegal parameter data types mediumint and point for operation 'coalesce'
CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1
ERROR:
-Illegal parameter data types mediumint and geometry for operation 'if'
+Illegal parameter data types mediumint and point for operation 'if'
CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1
ERROR:
-Illegal parameter data types mediumint and geometry for operation 'ifnull'
+Illegal parameter data types mediumint and point for operation 'ifnull'
CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1
ERROR:
-Illegal parameter data types mediumint and geometry for operation 'UNION'
+Illegal parameter data types mediumint and point for operation 'UNION'
-------------------------------------
CREATE TABLE t1 (a INT, b Point)
CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1
ERROR:
-Illegal parameter data types int and geometry for operation 'case'
+Illegal parameter data types int and point for operation 'case'
CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1
ERROR:
-Illegal parameter data types int and geometry for operation 'coalesce'
+Illegal parameter data types int and point for operation 'coalesce'
CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1
ERROR:
-Illegal parameter data types int and geometry for operation 'if'
+Illegal parameter data types int and point for operation 'if'
CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1
ERROR:
-Illegal parameter data types int and geometry for operation 'ifnull'
+Illegal parameter data types int and point for operation 'ifnull'
CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1
ERROR:
-Illegal parameter data types int and geometry for operation 'UNION'
+Illegal parameter data types int and point for operation 'UNION'
-------------------------------------
CREATE TABLE t1 (a BIGINT, b Point)
CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1
ERROR:
-Illegal parameter data types bigint and geometry for operation 'case'
+Illegal parameter data types bigint and point for operation 'case'
CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1
ERROR:
-Illegal parameter data types bigint and geometry for operation 'coalesce'
+Illegal parameter data types bigint and point for operation 'coalesce'
CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1
ERROR:
-Illegal parameter data types bigint and geometry for operation 'if'
+Illegal parameter data types bigint and point for operation 'if'
CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1
ERROR:
-Illegal parameter data types bigint and geometry for operation 'ifnull'
+Illegal parameter data types bigint and point for operation 'ifnull'
CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1
ERROR:
-Illegal parameter data types bigint and geometry for operation 'UNION'
+Illegal parameter data types bigint and point for operation 'UNION'
-------------------------------------
CREATE TABLE t1 (a FLOAT, b Point)
CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1
ERROR:
-Illegal parameter data types float and geometry for operation 'case'
+Illegal parameter data types float and point for operation 'case'
CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1
ERROR:
-Illegal parameter data types float and geometry for operation 'coalesce'
+Illegal parameter data types float and point for operation 'coalesce'
CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1
ERROR:
-Illegal parameter data types float and geometry for operation 'if'
+Illegal parameter data types float and point for operation 'if'
CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1
ERROR:
-Illegal parameter data types float and geometry for operation 'ifnull'
+Illegal parameter data types float and point for operation 'ifnull'
CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1
ERROR:
-Illegal parameter data types float and geometry for operation 'UNION'
+Illegal parameter data types float and point for operation 'UNION'
-------------------------------------
CREATE TABLE t1 (a DOUBLE, b Point)
CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1
ERROR:
-Illegal parameter data types double and geometry for operation 'case'
+Illegal parameter data types double and point for operation 'case'
CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1
ERROR:
-Illegal parameter data types double and geometry for operation 'coalesce'
+Illegal parameter data types double and point for operation 'coalesce'
CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1
ERROR:
-Illegal parameter data types double and geometry for operation 'if'
+Illegal parameter data types double and point for operation 'if'
CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1
ERROR:
-Illegal parameter data types double and geometry for operation 'ifnull'
+Illegal parameter data types double and point for operation 'ifnull'
CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1
ERROR:
-Illegal parameter data types double and geometry for operation 'UNION'
+Illegal parameter data types double and point for operation 'UNION'
-------------------------------------
CREATE TABLE t1 (a DECIMAL(10,2), b Point)
CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1
ERROR:
-Illegal parameter data types decimal and geometry for operation 'case'
+Illegal parameter data types decimal and point for operation 'case'
CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1
ERROR:
-Illegal parameter data types decimal and geometry for operation 'coalesce'
+Illegal parameter data types decimal and point for operation 'coalesce'
CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1
ERROR:
-Illegal parameter data types decimal and geometry for operation 'if'
+Illegal parameter data types decimal and point for operation 'if'
CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1
ERROR:
-Illegal parameter data types decimal and geometry for operation 'ifnull'
+Illegal parameter data types decimal and point for operation 'ifnull'
CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1
ERROR:
-Illegal parameter data types decimal and geometry for operation 'UNION'
+Illegal parameter data types decimal and point for operation 'UNION'
-------------------------------------
CREATE TABLE t1 (a BIT(8), b Point)
CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1
ERROR:
-Illegal parameter data types bigint and geometry for operation 'case'
+Illegal parameter data types bigint and point for operation 'case'
CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1
ERROR:
-Illegal parameter data types bigint and geometry for operation 'coalesce'
+Illegal parameter data types bigint and point for operation 'coalesce'
CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1
ERROR:
-Illegal parameter data types bigint and geometry for operation 'if'
+Illegal parameter data types bigint and point for operation 'if'
CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1
ERROR:
-Illegal parameter data types bigint and geometry for operation 'ifnull'
+Illegal parameter data types bigint and point for operation 'ifnull'
CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1
ERROR:
-Illegal parameter data types bit and geometry for operation 'UNION'
+Illegal parameter data types bit and point for operation 'UNION'
-------------------------------------
CREATE TABLE t1 (a TIME, b Point)
CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1
ERROR:
-Illegal parameter data types time and geometry for operation 'case'
+Illegal parameter data types time and point for operation 'case'
CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1
ERROR:
-Illegal parameter data types time and geometry for operation 'coalesce'
+Illegal parameter data types time and point for operation 'coalesce'
CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1
ERROR:
-Illegal parameter data types time and geometry for operation 'if'
+Illegal parameter data types time and point for operation 'if'
CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1
ERROR:
-Illegal parameter data types time and geometry for operation 'ifnull'
+Illegal parameter data types time and point for operation 'ifnull'
CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1
ERROR:
-Illegal parameter data types time and geometry for operation 'UNION'
+Illegal parameter data types time and point for operation 'UNION'
-------------------------------------
CREATE TABLE t1 (a DATE, b Point)
CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1
ERROR:
-Illegal parameter data types date and geometry for operation 'case'
+Illegal parameter data types date and point for operation 'case'
CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1
ERROR:
-Illegal parameter data types date and geometry for operation 'coalesce'
+Illegal parameter data types date and point for operation 'coalesce'
CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1
ERROR:
-Illegal parameter data types date and geometry for operation 'if'
+Illegal parameter data types date and point for operation 'if'
CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1
ERROR:
-Illegal parameter data types date and geometry for operation 'ifnull'
+Illegal parameter data types date and point for operation 'ifnull'
CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1
ERROR:
-Illegal parameter data types date and geometry for operation 'UNION'
+Illegal parameter data types date and point for operation 'UNION'
-------------------------------------
CREATE TABLE t1 (a DATETIME, b Point)
CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1
ERROR:
-Illegal parameter data types datetime and geometry for operation 'case'
+Illegal parameter data types datetime and point for operation 'case'
CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1
ERROR:
-Illegal parameter data types datetime and geometry for operation 'coalesce'
+Illegal parameter data types datetime and point for operation 'coalesce'
CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1
ERROR:
-Illegal parameter data types datetime and geometry for operation 'if'
+Illegal parameter data types datetime and point for operation 'if'
CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1
ERROR:
-Illegal parameter data types datetime and geometry for operation 'ifnull'
+Illegal parameter data types datetime and point for operation 'ifnull'
CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1
ERROR:
-Illegal parameter data types datetime and geometry for operation 'UNION'
+Illegal parameter data types datetime and point for operation 'UNION'
-------------------------------------
CREATE TABLE t1 (a TIMESTAMP, b Point)
CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1
ERROR:
-Illegal parameter data types timestamp and geometry for operation 'case'
+Illegal parameter data types timestamp and point for operation 'case'
CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1
ERROR:
-Illegal parameter data types timestamp and geometry for operation 'coalesce'
+Illegal parameter data types timestamp and point for operation 'coalesce'
CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1
ERROR:
-Illegal parameter data types timestamp and geometry for operation 'if'
+Illegal parameter data types timestamp and point for operation 'if'
CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1
ERROR:
-Illegal parameter data types timestamp and geometry for operation 'ifnull'
+Illegal parameter data types timestamp and point for operation 'ifnull'
CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1
ERROR:
-Illegal parameter data types timestamp and geometry for operation 'UNION'
+Illegal parameter data types timestamp and point for operation 'UNION'
-------------------------------------
CREATE TABLE t1 (a YEAR, b Point)
CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1
ERROR:
-Illegal parameter data types year and geometry for operation 'case'
+Illegal parameter data types year and point for operation 'case'
CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1
ERROR:
-Illegal parameter data types year and geometry for operation 'coalesce'
+Illegal parameter data types year and point for operation 'coalesce'
CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1
ERROR:
-Illegal parameter data types year and geometry for operation 'if'
+Illegal parameter data types year and point for operation 'if'
CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1
ERROR:
-Illegal parameter data types year and geometry for operation 'ifnull'
+Illegal parameter data types year and point for operation 'ifnull'
CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1
ERROR:
-Illegal parameter data types year and geometry for operation 'UNION'
+Illegal parameter data types year and point for operation 'UNION'
# This creates BLOB with hybrid functions, but fails on error with UNION (MDEV-11458)
-------------------------------------
CREATE TABLE t1 (a ENUM(0x61), b Point)
@@ -2831,7 +2831,7 @@ t2 CREATE TABLE `t2` (
CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1
ERROR:
-Illegal parameter data types enum and geometry for operation 'UNION'
+Illegal parameter data types enum and point for operation 'UNION'
-------------------------------------
CREATE TABLE t1 (a SET(0x61), b Point)
@@ -2861,7 +2861,7 @@ t2 CREATE TABLE `t2` (
CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1
ERROR:
-Illegal parameter data types set and geometry for operation 'UNION'
+Illegal parameter data types set and point for operation 'UNION'
CREATE TABLE t1 AS SELECT COALESCE(NULL, Point(1,1));
SHOW CREATE TABLE t1;
Table Create Table
@@ -3148,602 +3148,602 @@ CREATE TABLE t1 (a TINYINT, b Point, c Point)
SELECT a=b FROM t1
ERROR:
-Illegal parameter data types tinyint and geometry for operation '='
+Illegal parameter data types tinyint and point for operation '='
SELECT b=a FROM t1
ERROR:
-Illegal parameter data types geometry and tinyint for operation '='
+Illegal parameter data types point and tinyint for operation '='
SELECT a BETWEEN b AND c FROM t1
ERROR:
-Illegal parameter data types tinyint and geometry for operation 'between'
+Illegal parameter data types tinyint and point for operation 'between'
SELECT a IN (b,c) FROM t1
ERROR:
-Illegal parameter data types tinyint and geometry for operation 'in'
+Illegal parameter data types tinyint and point for operation 'in'
SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1
ERROR:
-Illegal parameter data types tinyint and geometry for operation 'case..when'
+Illegal parameter data types tinyint and point for operation 'case..when'
SELECT a=POINT(1,1) FROM t1
ERROR:
-Illegal parameter data types tinyint and geometry for operation '='
+Illegal parameter data types tinyint and point for operation '='
SELECT POINT(1,1)=a FROM t1
ERROR:
-Illegal parameter data types geometry and tinyint for operation '='
+Illegal parameter data types point and tinyint for operation '='
SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1
ERROR:
-Illegal parameter data types tinyint and geometry for operation 'between'
+Illegal parameter data types tinyint and point for operation 'between'
SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1
ERROR:
-Illegal parameter data types tinyint and geometry for operation 'in'
+Illegal parameter data types tinyint and point for operation 'in'
SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1
ERROR:
-Illegal parameter data types tinyint and geometry for operation 'case..when'
+Illegal parameter data types tinyint and point for operation 'case..when'
CALL p1('CREATE TABLE t1 (a SMALLINT, b Point, c Point)');
-------------------------------------
CREATE TABLE t1 (a SMALLINT, b Point, c Point)
SELECT a=b FROM t1
ERROR:
-Illegal parameter data types smallint and geometry for operation '='
+Illegal parameter data types smallint and point for operation '='
SELECT b=a FROM t1
ERROR:
-Illegal parameter data types geometry and smallint for operation '='
+Illegal parameter data types point and smallint for operation '='
SELECT a BETWEEN b AND c FROM t1
ERROR:
-Illegal parameter data types smallint and geometry for operation 'between'
+Illegal parameter data types smallint and point for operation 'between'
SELECT a IN (b,c) FROM t1
ERROR:
-Illegal parameter data types smallint and geometry for operation 'in'
+Illegal parameter data types smallint and point for operation 'in'
SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1
ERROR:
-Illegal parameter data types smallint and geometry for operation 'case..when'
+Illegal parameter data types smallint and point for operation 'case..when'
SELECT a=POINT(1,1) FROM t1
ERROR:
-Illegal parameter data types smallint and geometry for operation '='
+Illegal parameter data types smallint and point for operation '='
SELECT POINT(1,1)=a FROM t1
ERROR:
-Illegal parameter data types geometry and smallint for operation '='
+Illegal parameter data types point and smallint for operation '='
SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1
ERROR:
-Illegal parameter data types smallint and geometry for operation 'between'
+Illegal parameter data types smallint and point for operation 'between'
SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1
ERROR:
-Illegal parameter data types smallint and geometry for operation 'in'
+Illegal parameter data types smallint and point for operation 'in'
SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1
ERROR:
-Illegal parameter data types smallint and geometry for operation 'case..when'
+Illegal parameter data types smallint and point for operation 'case..when'
CALL p1('CREATE TABLE t1 (a MEDIUMINT, b Point, c Point)');
-------------------------------------
CREATE TABLE t1 (a MEDIUMINT, b Point, c Point)
SELECT a=b FROM t1
ERROR:
-Illegal parameter data types mediumint and geometry for operation '='
+Illegal parameter data types mediumint and point for operation '='
SELECT b=a FROM t1
ERROR:
-Illegal parameter data types geometry and mediumint for operation '='
+Illegal parameter data types point and mediumint for operation '='
SELECT a BETWEEN b AND c FROM t1
ERROR:
-Illegal parameter data types mediumint and geometry for operation 'between'
+Illegal parameter data types mediumint and point for operation 'between'
SELECT a IN (b,c) FROM t1
ERROR:
-Illegal parameter data types mediumint and geometry for operation 'in'
+Illegal parameter data types mediumint and point for operation 'in'
SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1
ERROR:
-Illegal parameter data types mediumint and geometry for operation 'case..when'
+Illegal parameter data types mediumint and point for operation 'case..when'
SELECT a=POINT(1,1) FROM t1
ERROR:
-Illegal parameter data types mediumint and geometry for operation '='
+Illegal parameter data types mediumint and point for operation '='
SELECT POINT(1,1)=a FROM t1
ERROR:
-Illegal parameter data types geometry and mediumint for operation '='
+Illegal parameter data types point and mediumint for operation '='
SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1
ERROR:
-Illegal parameter data types mediumint and geometry for operation 'between'
+Illegal parameter data types mediumint and point for operation 'between'
SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1
ERROR:
-Illegal parameter data types mediumint and geometry for operation 'in'
+Illegal parameter data types mediumint and point for operation 'in'
SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1
ERROR:
-Illegal parameter data types mediumint and geometry for operation 'case..when'
+Illegal parameter data types mediumint and point for operation 'case..when'
CALL p1('CREATE TABLE t1 (a INT, b Point, c Point)');
-------------------------------------
CREATE TABLE t1 (a INT, b Point, c Point)
SELECT a=b FROM t1
ERROR:
-Illegal parameter data types int and geometry for operation '='
+Illegal parameter data types int and point for operation '='
SELECT b=a FROM t1
ERROR:
-Illegal parameter data types geometry and int for operation '='
+Illegal parameter data types point and int for operation '='
SELECT a BETWEEN b AND c FROM t1
ERROR:
-Illegal parameter data types int and geometry for operation 'between'
+Illegal parameter data types int and point for operation 'between'
SELECT a IN (b,c) FROM t1
ERROR:
-Illegal parameter data types int and geometry for operation 'in'
+Illegal parameter data types int and point for operation 'in'
SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1
ERROR:
-Illegal parameter data types int and geometry for operation 'case..when'
+Illegal parameter data types int and point for operation 'case..when'
SELECT a=POINT(1,1) FROM t1
ERROR:
-Illegal parameter data types int and geometry for operation '='
+Illegal parameter data types int and point for operation '='
SELECT POINT(1,1)=a FROM t1
ERROR:
-Illegal parameter data types geometry and int for operation '='
+Illegal parameter data types point and int for operation '='
SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1
ERROR:
-Illegal parameter data types int and geometry for operation 'between'
+Illegal parameter data types int and point for operation 'between'
SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1
ERROR:
-Illegal parameter data types int and geometry for operation 'in'
+Illegal parameter data types int and point for operation 'in'
SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1
ERROR:
-Illegal parameter data types int and geometry for operation 'case..when'
+Illegal parameter data types int and point for operation 'case..when'
CALL p1('CREATE TABLE t1 (a BIGINT, b Point, c Point)');
-------------------------------------
CREATE TABLE t1 (a BIGINT, b Point, c Point)
SELECT a=b FROM t1
ERROR:
-Illegal parameter data types bigint and geometry for operation '='
+Illegal parameter data types bigint and point for operation '='
SELECT b=a FROM t1
ERROR:
-Illegal parameter data types geometry and bigint for operation '='
+Illegal parameter data types point and bigint for operation '='
SELECT a BETWEEN b AND c FROM t1
ERROR:
-Illegal parameter data types bigint and geometry for operation 'between'
+Illegal parameter data types bigint and point for operation 'between'
SELECT a IN (b,c) FROM t1
ERROR:
-Illegal parameter data types bigint and geometry for operation 'in'
+Illegal parameter data types bigint and point for operation 'in'
SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1
ERROR:
-Illegal parameter data types bigint and geometry for operation 'case..when'
+Illegal parameter data types bigint and point for operation 'case..when'
SELECT a=POINT(1,1) FROM t1
ERROR:
-Illegal parameter data types bigint and geometry for operation '='
+Illegal parameter data types bigint and point for operation '='
SELECT POINT(1,1)=a FROM t1
ERROR:
-Illegal parameter data types geometry and bigint for operation '='
+Illegal parameter data types point and bigint for operation '='
SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1
ERROR:
-Illegal parameter data types bigint and geometry for operation 'between'
+Illegal parameter data types bigint and point for operation 'between'
SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1
ERROR:
-Illegal parameter data types bigint and geometry for operation 'in'
+Illegal parameter data types bigint and point for operation 'in'
SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1
ERROR:
-Illegal parameter data types bigint and geometry for operation 'case..when'
+Illegal parameter data types bigint and point for operation 'case..when'
CALL p1('CREATE TABLE t1 (a FLOAT, b Point, c Point)');
-------------------------------------
CREATE TABLE t1 (a FLOAT, b Point, c Point)
SELECT a=b FROM t1
ERROR:
-Illegal parameter data types float and geometry for operation '='
+Illegal parameter data types float and point for operation '='
SELECT b=a FROM t1
ERROR:
-Illegal parameter data types geometry and float for operation '='
+Illegal parameter data types point and float for operation '='
SELECT a BETWEEN b AND c FROM t1
ERROR:
-Illegal parameter data types float and geometry for operation 'between'
+Illegal parameter data types float and point for operation 'between'
SELECT a IN (b,c) FROM t1
ERROR:
-Illegal parameter data types float and geometry for operation 'in'
+Illegal parameter data types float and point for operation 'in'
SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1
ERROR:
-Illegal parameter data types float and geometry for operation 'case..when'
+Illegal parameter data types float and point for operation 'case..when'
SELECT a=POINT(1,1) FROM t1
ERROR:
-Illegal parameter data types float and geometry for operation '='
+Illegal parameter data types float and point for operation '='
SELECT POINT(1,1)=a FROM t1
ERROR:
-Illegal parameter data types geometry and float for operation '='
+Illegal parameter data types point and float for operation '='
SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1
ERROR:
-Illegal parameter data types float and geometry for operation 'between'
+Illegal parameter data types float and point for operation 'between'
SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1
ERROR:
-Illegal parameter data types float and geometry for operation 'in'
+Illegal parameter data types float and point for operation 'in'
SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1
ERROR:
-Illegal parameter data types float and geometry for operation 'case..when'
+Illegal parameter data types float and point for operation 'case..when'
CALL p1('CREATE TABLE t1 (a DOUBLE, b Point, c Point)');
-------------------------------------
CREATE TABLE t1 (a DOUBLE, b Point, c Point)
SELECT a=b FROM t1
ERROR:
-Illegal parameter data types double and geometry for operation '='
+Illegal parameter data types double and point for operation '='
SELECT b=a FROM t1
ERROR:
-Illegal parameter data types geometry and double for operation '='
+Illegal parameter data types point and double for operation '='
SELECT a BETWEEN b AND c FROM t1
ERROR:
-Illegal parameter data types double and geometry for operation 'between'
+Illegal parameter data types double and point for operation 'between'
SELECT a IN (b,c) FROM t1
ERROR:
-Illegal parameter data types double and geometry for operation 'in'
+Illegal parameter data types double and point for operation 'in'
SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1
ERROR:
-Illegal parameter data types double and geometry for operation 'case..when'
+Illegal parameter data types double and point for operation 'case..when'
SELECT a=POINT(1,1) FROM t1
ERROR:
-Illegal parameter data types double and geometry for operation '='
+Illegal parameter data types double and point for operation '='
SELECT POINT(1,1)=a FROM t1
ERROR:
-Illegal parameter data types geometry and double for operation '='
+Illegal parameter data types point and double for operation '='
SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1
ERROR:
-Illegal parameter data types double and geometry for operation 'between'
+Illegal parameter data types double and point for operation 'between'
SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1
ERROR:
-Illegal parameter data types double and geometry for operation 'in'
+Illegal parameter data types double and point for operation 'in'
SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1
ERROR:
-Illegal parameter data types double and geometry for operation 'case..when'
+Illegal parameter data types double and point for operation 'case..when'
CALL p1('CREATE TABLE t1 (a DECIMAL(10,2), b Point, c Point)');
-------------------------------------
CREATE TABLE t1 (a DECIMAL(10,2), b Point, c Point)
SELECT a=b FROM t1
ERROR:
-Illegal parameter data types decimal and geometry for operation '='
+Illegal parameter data types decimal and point for operation '='
SELECT b=a FROM t1
ERROR:
-Illegal parameter data types geometry and decimal for operation '='
+Illegal parameter data types point and decimal for operation '='
SELECT a BETWEEN b AND c FROM t1
ERROR:
-Illegal parameter data types decimal and geometry for operation 'between'
+Illegal parameter data types decimal and point for operation 'between'
SELECT a IN (b,c) FROM t1
ERROR:
-Illegal parameter data types decimal and geometry for operation 'in'
+Illegal parameter data types decimal and point for operation 'in'
SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1
ERROR:
-Illegal parameter data types decimal and geometry for operation 'case..when'
+Illegal parameter data types decimal and point for operation 'case..when'
SELECT a=POINT(1,1) FROM t1
ERROR:
-Illegal parameter data types decimal and geometry for operation '='
+Illegal parameter data types decimal and point for operation '='
SELECT POINT(1,1)=a FROM t1
ERROR:
-Illegal parameter data types geometry and decimal for operation '='
+Illegal parameter data types point and decimal for operation '='
SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1
ERROR:
-Illegal parameter data types decimal and geometry for operation 'between'
+Illegal parameter data types decimal and point for operation 'between'
SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1
ERROR:
-Illegal parameter data types decimal and geometry for operation 'in'
+Illegal parameter data types decimal and point for operation 'in'
SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1
ERROR:
-Illegal parameter data types decimal and geometry for operation 'case..when'
+Illegal parameter data types decimal and point for operation 'case..when'
CALL p1('CREATE TABLE t1 (a BIT(8), b Point, c Point)');
-------------------------------------
CREATE TABLE t1 (a BIT(8), b Point, c Point)
SELECT a=b FROM t1
ERROR:
-Illegal parameter data types bit and geometry for operation '='
+Illegal parameter data types bit and point for operation '='
SELECT b=a FROM t1
ERROR:
-Illegal parameter data types geometry and bit for operation '='
+Illegal parameter data types point and bit for operation '='
SELECT a BETWEEN b AND c FROM t1
ERROR:
-Illegal parameter data types bit and geometry for operation 'between'
+Illegal parameter data types bit and point for operation 'between'
SELECT a IN (b,c) FROM t1
ERROR:
-Illegal parameter data types bit and geometry for operation 'in'
+Illegal parameter data types bit and point for operation 'in'
SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1
ERROR:
-Illegal parameter data types bit and geometry for operation 'case..when'
+Illegal parameter data types bit and point for operation 'case..when'
SELECT a=POINT(1,1) FROM t1
ERROR:
-Illegal parameter data types bit and geometry for operation '='
+Illegal parameter data types bit and point for operation '='
SELECT POINT(1,1)=a FROM t1
ERROR:
-Illegal parameter data types geometry and bit for operation '='
+Illegal parameter data types point and bit for operation '='
SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1
ERROR:
-Illegal parameter data types bit and geometry for operation 'between'
+Illegal parameter data types bit and point for operation 'between'
SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1
ERROR:
-Illegal parameter data types bit and geometry for operation 'in'
+Illegal parameter data types bit and point for operation 'in'
SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1
ERROR:
-Illegal parameter data types bit and geometry for operation 'case..when'
+Illegal parameter data types bit and point for operation 'case..when'
CALL p1('CREATE TABLE t1 (a TIME, b Point, c Point)');
-------------------------------------
CREATE TABLE t1 (a TIME, b Point, c Point)
SELECT a=b FROM t1
ERROR:
-Illegal parameter data types time and geometry for operation '='
+Illegal parameter data types time and point for operation '='
SELECT b=a FROM t1
ERROR:
-Illegal parameter data types geometry and time for operation '='
+Illegal parameter data types point and time for operation '='
SELECT a BETWEEN b AND c FROM t1
ERROR:
-Illegal parameter data types time and geometry for operation 'between'
+Illegal parameter data types time and point for operation 'between'
SELECT a IN (b,c) FROM t1
ERROR:
-Illegal parameter data types time and geometry for operation 'in'
+Illegal parameter data types time and point for operation 'in'
SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1
ERROR:
-Illegal parameter data types time and geometry for operation 'case..when'
+Illegal parameter data types time and point for operation 'case..when'
SELECT a=POINT(1,1) FROM t1
ERROR:
-Illegal parameter data types time and geometry for operation '='
+Illegal parameter data types time and point for operation '='
SELECT POINT(1,1)=a FROM t1
ERROR:
-Illegal parameter data types geometry and time for operation '='
+Illegal parameter data types point and time for operation '='
SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1
ERROR:
-Illegal parameter data types time and geometry for operation 'between'
+Illegal parameter data types time and point for operation 'between'
SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1
ERROR:
-Illegal parameter data types time and geometry for operation 'in'
+Illegal parameter data types time and point for operation 'in'
SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1
ERROR:
-Illegal parameter data types time and geometry for operation 'case..when'
+Illegal parameter data types time and point for operation 'case..when'
CALL p1('CREATE TABLE t1 (a DATE, b Point, c Point)');
-------------------------------------
CREATE TABLE t1 (a DATE, b Point, c Point)
SELECT a=b FROM t1
ERROR:
-Illegal parameter data types date and geometry for operation '='
+Illegal parameter data types date and point for operation '='
SELECT b=a FROM t1
ERROR:
-Illegal parameter data types geometry and date for operation '='
+Illegal parameter data types point and date for operation '='
SELECT a BETWEEN b AND c FROM t1
ERROR:
-Illegal parameter data types date and geometry for operation 'between'
+Illegal parameter data types date and point for operation 'between'
SELECT a IN (b,c) FROM t1
ERROR:
-Illegal parameter data types date and geometry for operation 'in'
+Illegal parameter data types date and point for operation 'in'
SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1
ERROR:
-Illegal parameter data types date and geometry for operation 'case..when'
+Illegal parameter data types date and point for operation 'case..when'
SELECT a=POINT(1,1) FROM t1
ERROR:
-Illegal parameter data types date and geometry for operation '='
+Illegal parameter data types date and point for operation '='
SELECT POINT(1,1)=a FROM t1
ERROR:
-Illegal parameter data types geometry and date for operation '='
+Illegal parameter data types point and date for operation '='
SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1
ERROR:
-Illegal parameter data types date and geometry for operation 'between'
+Illegal parameter data types date and point for operation 'between'
SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1
ERROR:
-Illegal parameter data types date and geometry for operation 'in'
+Illegal parameter data types date and point for operation 'in'
SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1
ERROR:
-Illegal parameter data types date and geometry for operation 'case..when'
+Illegal parameter data types date and point for operation 'case..when'
CALL p1('CREATE TABLE t1 (a DATETIME, b Point, c Point)');
-------------------------------------
CREATE TABLE t1 (a DATETIME, b Point, c Point)
SELECT a=b FROM t1
ERROR:
-Illegal parameter data types datetime and geometry for operation '='
+Illegal parameter data types datetime and point for operation '='
SELECT b=a FROM t1
ERROR:
-Illegal parameter data types geometry and datetime for operation '='
+Illegal parameter data types point and datetime for operation '='
SELECT a BETWEEN b AND c FROM t1
ERROR:
-Illegal parameter data types datetime and geometry for operation 'between'
+Illegal parameter data types datetime and point for operation 'between'
SELECT a IN (b,c) FROM t1
ERROR:
-Illegal parameter data types datetime and geometry for operation 'in'
+Illegal parameter data types datetime and point for operation 'in'
SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1
ERROR:
-Illegal parameter data types datetime and geometry for operation 'case..when'
+Illegal parameter data types datetime and point for operation 'case..when'
SELECT a=POINT(1,1) FROM t1
ERROR:
-Illegal parameter data types datetime and geometry for operation '='
+Illegal parameter data types datetime and point for operation '='
SELECT POINT(1,1)=a FROM t1
ERROR:
-Illegal parameter data types geometry and datetime for operation '='
+Illegal parameter data types point and datetime for operation '='
SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1
ERROR:
-Illegal parameter data types datetime and geometry for operation 'between'
+Illegal parameter data types datetime and point for operation 'between'
SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1
ERROR:
-Illegal parameter data types datetime and geometry for operation 'in'
+Illegal parameter data types datetime and point for operation 'in'
SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1
ERROR:
-Illegal parameter data types datetime and geometry for operation 'case..when'
+Illegal parameter data types datetime and point for operation 'case..when'
CALL p1('CREATE TABLE t1 (a TIMESTAMP, b Point, c Point)');
-------------------------------------
CREATE TABLE t1 (a TIMESTAMP, b Point, c Point)
SELECT a=b FROM t1
ERROR:
-Illegal parameter data types timestamp and geometry for operation '='
+Illegal parameter data types timestamp and point for operation '='
SELECT b=a FROM t1
ERROR:
-Illegal parameter data types geometry and timestamp for operation '='
+Illegal parameter data types point and timestamp for operation '='
SELECT a BETWEEN b AND c FROM t1
ERROR:
-Illegal parameter data types timestamp and geometry for operation 'between'
+Illegal parameter data types timestamp and point for operation 'between'
SELECT a IN (b,c) FROM t1
ERROR:
-Illegal parameter data types timestamp and geometry for operation 'in'
+Illegal parameter data types timestamp and point for operation 'in'
SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1
ERROR:
-Illegal parameter data types timestamp and geometry for operation 'case..when'
+Illegal parameter data types timestamp and point for operation 'case..when'
SELECT a=POINT(1,1) FROM t1
ERROR:
-Illegal parameter data types timestamp and geometry for operation '='
+Illegal parameter data types timestamp and point for operation '='
SELECT POINT(1,1)=a FROM t1
ERROR:
-Illegal parameter data types geometry and timestamp for operation '='
+Illegal parameter data types point and timestamp for operation '='
SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1
ERROR:
-Illegal parameter data types timestamp and geometry for operation 'between'
+Illegal parameter data types timestamp and point for operation 'between'
SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1
ERROR:
-Illegal parameter data types timestamp and geometry for operation 'in'
+Illegal parameter data types timestamp and point for operation 'in'
SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1
ERROR:
-Illegal parameter data types timestamp and geometry for operation 'case..when'
+Illegal parameter data types timestamp and point for operation 'case..when'
CALL p1('CREATE TABLE t1 (a YEAR, b Point, c Point)');
-------------------------------------
CREATE TABLE t1 (a YEAR, b Point, c Point)
SELECT a=b FROM t1
ERROR:
-Illegal parameter data types year and geometry for operation '='
+Illegal parameter data types year and point for operation '='
SELECT b=a FROM t1
ERROR:
-Illegal parameter data types geometry and year for operation '='
+Illegal parameter data types point and year for operation '='
SELECT a BETWEEN b AND c FROM t1
ERROR:
-Illegal parameter data types year and geometry for operation 'between'
+Illegal parameter data types year and point for operation 'between'
SELECT a IN (b,c) FROM t1
ERROR:
-Illegal parameter data types year and geometry for operation 'in'
+Illegal parameter data types year and point for operation 'in'
SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1
ERROR:
-Illegal parameter data types year and geometry for operation 'case..when'
+Illegal parameter data types year and point for operation 'case..when'
SELECT a=POINT(1,1) FROM t1
ERROR:
-Illegal parameter data types year and geometry for operation '='
+Illegal parameter data types year and point for operation '='
SELECT POINT(1,1)=a FROM t1
ERROR:
-Illegal parameter data types geometry and year for operation '='
+Illegal parameter data types point and year for operation '='
SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1
ERROR:
-Illegal parameter data types year and geometry for operation 'between'
+Illegal parameter data types year and point for operation 'between'
SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1
ERROR:
-Illegal parameter data types year and geometry for operation 'in'
+Illegal parameter data types year and point for operation 'in'
SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1
ERROR:
-Illegal parameter data types year and geometry for operation 'case..when'
+Illegal parameter data types year and point for operation 'case..when'
CALL p1('CREATE TABLE t1 (a Point, b Point, c Point)');
-------------------------------------
CREATE TABLE t1 (a Point, b Point, c Point)
@@ -3862,85 +3862,85 @@ CREATE TABLE t1 (a TINYINT, b Point)
CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1
ERROR:
-Illegal parameter data types tinyint and geometry for operation 'least'
+Illegal parameter data types tinyint and point for operation 'least'
-------------------------------------
CREATE TABLE t1 (a SMALLINT, b Point)
CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1
ERROR:
-Illegal parameter data types smallint and geometry for operation 'least'
+Illegal parameter data types smallint and point for operation 'least'
-------------------------------------
CREATE TABLE t1 (a MEDIUMINT, b Point)
CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1
ERROR:
-Illegal parameter data types mediumint and geometry for operation 'least'
+Illegal parameter data types mediumint and point for operation 'least'
-------------------------------------
CREATE TABLE t1 (a INT, b Point)
CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1
ERROR:
-Illegal parameter data types int and geometry for operation 'least'
+Illegal parameter data types int and point for operation 'least'
-------------------------------------
CREATE TABLE t1 (a BIGINT, b Point)
CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1
ERROR:
-Illegal parameter data types bigint and geometry for operation 'least'
+Illegal parameter data types bigint and point for operation 'least'
-------------------------------------
CREATE TABLE t1 (a FLOAT, b Point)
CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1
ERROR:
-Illegal parameter data types float and geometry for operation 'least'
+Illegal parameter data types float and point for operation 'least'
-------------------------------------
CREATE TABLE t1 (a DOUBLE, b Point)
CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1
ERROR:
-Illegal parameter data types double and geometry for operation 'least'
+Illegal parameter data types double and point for operation 'least'
-------------------------------------
CREATE TABLE t1 (a DECIMAL(10,2), b Point)
CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1
ERROR:
-Illegal parameter data types decimal and geometry for operation 'least'
+Illegal parameter data types decimal and point for operation 'least'
-------------------------------------
CREATE TABLE t1 (a BIT(8), b Point)
CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1
ERROR:
-Illegal parameter data types bit and geometry for operation 'least'
+Illegal parameter data types bit and point for operation 'least'
-------------------------------------
CREATE TABLE t1 (a TIME, b Point)
CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1
ERROR:
-Illegal parameter data types time and geometry for operation 'least'
+Illegal parameter data types time and point for operation 'least'
-------------------------------------
CREATE TABLE t1 (a DATE, b Point)
CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1
ERROR:
-Illegal parameter data types date and geometry for operation 'least'
+Illegal parameter data types date and point for operation 'least'
-------------------------------------
CREATE TABLE t1 (a DATETIME, b Point)
CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1
ERROR:
-Illegal parameter data types datetime and geometry for operation 'least'
+Illegal parameter data types datetime and point for operation 'least'
-------------------------------------
CREATE TABLE t1 (a TIMESTAMP, b Point)
CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1
ERROR:
-Illegal parameter data types timestamp and geometry for operation 'least'
+Illegal parameter data types timestamp and point for operation 'least'
-------------------------------------
CREATE TABLE t1 (a YEAR, b Point)
CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1
ERROR:
-Illegal parameter data types year and geometry for operation 'least'
+Illegal parameter data types year and point for operation 'least'
# This LEAST(ENUM,GEOMETRY) creates BLOB, but fails on error with UNION (see MDEV-12503)
-------------------------------------
CREATE TABLE t1 (a ENUM(0x61), b Point)
@@ -3975,7 +3975,7 @@ SELECT ROUND(a) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'round'
DROP TABLE t1;
SELECT ROUND(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'round'
+ERROR HY000: Illegal parameter data type point for operation 'round'
#
# MDEV-12199 Split Item_func_{abs|neg|int_val}::fix_length_and_dec() into methods in Type_handler
#
@@ -3998,37 +3998,37 @@ SELECT FLOOR(COALESCE(a)) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'floor'
DROP TABLE t1;
SELECT -POINT(1,1);
-ERROR HY000: Illegal parameter data type geometry for operation '-'
+ERROR HY000: Illegal parameter data type point for operation '-'
SELECT ABS(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'abs'
+ERROR HY000: Illegal parameter data type point for operation 'abs'
SELECT CEILING(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'ceiling'
+ERROR HY000: Illegal parameter data type point for operation 'ceiling'
SELECT FLOOR(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'floor'
+ERROR HY000: Illegal parameter data type point for operation 'floor'
#
# MDEV-12239 Add Type_handler::Item_sum_{sum|avg|variance}_fix_length_and_dec()
#
CREATE TABLE t1 (a GEOMETRY);
SELECT SUM(POINT(1,1)) FROM t1;
-ERROR HY000: Illegal parameter data type geometry for operation 'sum'
+ERROR HY000: Illegal parameter data type point for operation 'sum'
SELECT SUM(a) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'sum'
SELECT SUM(COALESCE(a)) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'sum'
SELECT AVG(POINT(1,1)) FROM t1;
-ERROR HY000: Illegal parameter data type geometry for operation 'avg'
+ERROR HY000: Illegal parameter data type point for operation 'avg'
SELECT AVG(a) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'avg'
SELECT AVG(COALESCE(a)) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'avg'
SELECT VARIANCE(POINT(1,1)) FROM t1;
-ERROR HY000: Illegal parameter data type geometry for operation 'variance('
+ERROR HY000: Illegal parameter data type point for operation 'variance('
SELECT VARIANCE(a) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'variance('
SELECT VARIANCE(COALESCE(a)) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'variance('
SELECT STDDEV(POINT(1,1)) FROM t1;
-ERROR HY000: Illegal parameter data type geometry for operation 'std('
+ERROR HY000: Illegal parameter data type point for operation 'std('
SELECT STDDEV(a) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'std('
SELECT STDDEV(COALESCE(a)) FROM t1;
@@ -4039,23 +4039,23 @@ DROP TABLE t1;
#
CREATE TABLE t1 (a GEOMETRY);
SELECT CAST(POINT(1,1) AS SIGNED) FROM t1;
-ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_signed'
+ERROR HY000: Illegal parameter data type point for operation 'cast_as_signed'
SELECT CAST(POINT(1,1) AS UNSIGNED) FROM t1;
-ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_unsigned'
+ERROR HY000: Illegal parameter data type point for operation 'cast_as_unsigned'
SELECT CAST(POINT(1,1) AS FLOAT) FROM t1;
-ERROR HY000: Illegal parameter data type geometry for operation 'float_typecast'
+ERROR HY000: Illegal parameter data type point for operation 'float_typecast'
SELECT CAST(POINT(1,1) AS DOUBLE) FROM t1;
-ERROR HY000: Illegal parameter data type geometry for operation 'double_typecast'
+ERROR HY000: Illegal parameter data type point for operation 'double_typecast'
SELECT CAST(POINT(1,1) AS DECIMAL(10,1)) FROM t1;
-ERROR HY000: Illegal parameter data type geometry for operation 'decimal_typecast'
+ERROR HY000: Illegal parameter data type point for operation 'decimal_typecast'
SELECT CAST(POINT(1,1) AS CHAR) FROM t1;
-ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_char'
+ERROR HY000: Illegal parameter data type point for operation 'cast_as_char'
SELECT CAST(POINT(1,1) AS TIME) FROM t1;
-ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_time'
+ERROR HY000: Illegal parameter data type point for operation 'cast_as_time'
SELECT CAST(POINT(1,1) AS DATE) FROM t1;
-ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_date'
+ERROR HY000: Illegal parameter data type point for operation 'cast_as_date'
SELECT CAST(POINT(1,1) AS DATETIME) FROM t1;
-ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_datetime'
+ERROR HY000: Illegal parameter data type point for operation 'cast_as_datetime'
SELECT CAST(a AS SIGNED) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_signed'
SELECT CAST(a AS UNSIGNED) FROM t1;
@@ -4104,25 +4104,25 @@ DROP TABLE t1;
#
CREATE TABLE t1 (a GEOMETRY);
SELECT POINT(1,1) + 1;
-ERROR HY000: Illegal parameter data types geometry and int for operation '+'
+ERROR HY000: Illegal parameter data types point and int for operation '+'
SELECT POINT(1,1) - 1;
-ERROR HY000: Illegal parameter data types geometry and int for operation '-'
+ERROR HY000: Illegal parameter data types point and int for operation '-'
SELECT POINT(1,1) * 1;
-ERROR HY000: Illegal parameter data types geometry and int for operation '*'
+ERROR HY000: Illegal parameter data types point and int for operation '*'
SELECT POINT(1,1) / 1;
-ERROR HY000: Illegal parameter data types geometry and int for operation '/'
+ERROR HY000: Illegal parameter data types point and int for operation '/'
SELECT POINT(1,1) MOD 1;
-ERROR HY000: Illegal parameter data types geometry and int for operation 'MOD'
+ERROR HY000: Illegal parameter data types point and int for operation 'MOD'
SELECT 1 + POINT(1,1);
-ERROR HY000: Illegal parameter data types int and geometry for operation '+'
+ERROR HY000: Illegal parameter data types int and point for operation '+'
SELECT 1 - POINT(1,1);
-ERROR HY000: Illegal parameter data types int and geometry for operation '-'
+ERROR HY000: Illegal parameter data types int and point for operation '-'
SELECT 1 * POINT(1,1);
-ERROR HY000: Illegal parameter data types int and geometry for operation '*'
+ERROR HY000: Illegal parameter data types int and point for operation '*'
SELECT 1 / POINT(1,1);
-ERROR HY000: Illegal parameter data types int and geometry for operation '/'
+ERROR HY000: Illegal parameter data types int and point for operation '/'
SELECT 1 MOD POINT(1,1);
-ERROR HY000: Illegal parameter data types int and geometry for operation 'MOD'
+ERROR HY000: Illegal parameter data types int and point for operation 'MOD'
SELECT a + 1 FROM t1;
ERROR HY000: Illegal parameter data types geometry and int for operation '+'
SELECT a - 1 FROM t1;
@@ -4168,33 +4168,33 @@ DROP TABLE t1;
# MDEV-12514 Split Item_temporal_func::fix_length_and_dec()
#
SELECT DATE_ADD(POINT(1,1), INTERVAL 10 DAY);
-ERROR HY000: Illegal parameter data types geometry and interval for operation 'date_add_interval'
+ERROR HY000: Illegal parameter data types point and interval for operation 'date_add_interval'
SELECT DATE_SUB(POINT(1,1), INTERVAL 10 DAY);
-ERROR HY000: Illegal parameter data types geometry and interval for operation 'date_add_interval'
+ERROR HY000: Illegal parameter data types point and interval for operation 'date_add_interval'
SELECT POINT(1,1) + INTERVAL 10 DAY;
-ERROR HY000: Illegal parameter data types geometry and interval for operation 'date_add_interval'
+ERROR HY000: Illegal parameter data types point and interval for operation 'date_add_interval'
SELECT POINT(1,1) - INTERVAL 10 DAY;
-ERROR HY000: Illegal parameter data types geometry and interval for operation 'date_add_interval'
+ERROR HY000: Illegal parameter data types point and interval for operation 'date_add_interval'
SELECT INTERVAL 10 DAY + POINT(1,1);
-ERROR HY000: Illegal parameter data types geometry and interval for operation 'date_add_interval'
+ERROR HY000: Illegal parameter data types point and interval for operation 'date_add_interval'
SELECT INTERVAL 10 DAY + POINT(1,1);
-ERROR HY000: Illegal parameter data types geometry and interval for operation 'date_add_interval'
+ERROR HY000: Illegal parameter data types point and interval for operation 'date_add_interval'
SELECT ADDTIME(POINT(1,1), '10:10:10');
-ERROR HY000: Illegal parameter data types geometry and varchar for operation 'addtime'
+ERROR HY000: Illegal parameter data types point and varchar for operation 'addtime'
SELECT ADDTIME('10:10:10', POINT(1,1));
-ERROR HY000: Illegal parameter data types varchar and geometry for operation 'addtime'
+ERROR HY000: Illegal parameter data types varchar and point for operation 'addtime'
SELECT ADDTIME(POINT(1,1), TIME'10:10:10');
-ERROR HY000: Illegal parameter data types geometry and time for operation 'addtime'
+ERROR HY000: Illegal parameter data types point and time for operation 'addtime'
SELECT ADDTIME(TIME'10:10:10', POINT(1,1));
-ERROR HY000: Illegal parameter data types time and geometry for operation 'addtime'
+ERROR HY000: Illegal parameter data types time and point for operation 'addtime'
SELECT ADDTIME(POINT(1,1), TIMESTAMP'2001-01-01 10:10:10');
-ERROR HY000: Illegal parameter data types geometry and datetime for operation 'addtime'
+ERROR HY000: Illegal parameter data types point and datetime for operation 'addtime'
SELECT ADDTIME(TIMESTAMP'2001-01-01 10:10:10', POINT(1,1));
-ERROR HY000: Illegal parameter data types datetime and geometry for operation 'addtime'
+ERROR HY000: Illegal parameter data types datetime and point for operation 'addtime'
SELECT STR_TO_DATE(POINT(1,1),'%M %d,%Y');
-ERROR HY000: Illegal parameter data types geometry and varchar for operation 'str_to_date'
+ERROR HY000: Illegal parameter data types point and varchar for operation 'str_to_date'
SELECT STR_TO_DATE('2001-01-01', POINT(1,1));
-ERROR HY000: Illegal parameter data types varchar and geometry for operation 'str_to_date'
+ERROR HY000: Illegal parameter data types varchar and point for operation 'str_to_date'
#
# MDEV-12665 Hybrid functions do not preserve geometry type
#
@@ -4435,11 +4435,11 @@ ERROR HY000: Illegal parameter data type int for operation 'st_pointonsurface'
SELECT ST_POINTN(1,1);
ERROR HY000: Illegal parameter data type int for operation 'st_pointn'
SELECT ST_POINTN(LineString(Point(1,1)),Point(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'st_pointn'
+ERROR HY000: Illegal parameter data type point for operation 'st_pointn'
SELECT ST_BUFFER(1, 1);
ERROR HY000: Illegal parameter data type int for operation 'st_buffer'
SELECT ST_BUFFER(Point(1,1), Point(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'st_buffer'
+ERROR HY000: Illegal parameter data type point for operation 'st_buffer'
PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ST_ENVELOPE(?) AS g';
EXECUTE stmt USING 1;
ERROR HY000: Illegal parameter data type int for operation 'st_envelope'
@@ -4458,7 +4458,7 @@ PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ST_BUFFER(?,?) AS g';
EXECUTE stmt USING 1,1;
ERROR HY000: Illegal parameter data type int for operation 'st_buffer'
EXECUTE stmt USING POINT(1,1),POINT(1,1);
-ERROR HY000: Illegal parameter data type geometry for operation 'st_buffer'
+ERROR HY000: Illegal parameter data type point for operation 'st_buffer'
EXECUTE stmt USING POINT(1,1),0;
SHOW CREATE TABLE t1;
Table Create Table
@@ -4476,11 +4476,11 @@ DEALLOCATE PREPARE stmt;
SELECT ST_GEOMETRYFROMTEXT(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'st_geometryfromtext'
SELECT ST_GEOMETRYFROMTEXT(Point(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'st_geometryfromtext'
+ERROR HY000: Illegal parameter data type point for operation 'st_geometryfromtext'
SELECT ST_GEOMETRYFROMTEXT(Point(1,1), 1);
-ERROR HY000: Illegal parameter data type geometry for operation 'st_geometryfromtext'
+ERROR HY000: Illegal parameter data type point for operation 'st_geometryfromtext'
SELECT ST_GEOMETRYFROMTEXT('test', Point(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'st_geometryfromtext'
+ERROR HY000: Illegal parameter data type point for operation 'st_geometryfromtext'
SELECT ST_GEOMETRYFROMWKB(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'st_geometryfromwkb'
SELECT ST_GEOMETRYFROMWKB(1);
@@ -4488,7 +4488,7 @@ ERROR HY000: Illegal parameter data type int for operation 'st_geometryfromwkb'
SELECT ST_GEOMETRYFROMWKB(1, 1);
ERROR HY000: Illegal parameter data type int for operation 'st_geometryfromwkb'
SELECT ST_GEOMETRYFROMWKB(Point(1,1), Point(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'st_geometryfromwkb'
+ERROR HY000: Illegal parameter data type point for operation 'st_geometryfromwkb'
SELECT ST_GEOMFROMGEOJSON(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'st_geomfromgeojson'
SELECT ST_GEOMFROMGEOJSON(1);
@@ -4496,20 +4496,20 @@ ERROR HY000: Illegal parameter data type int for operation 'st_geomfromgeojson'
SELECT ST_GEOMFROMGEOJSON(1,1);
ERROR HY000: Illegal parameter data type int for operation 'st_geomfromgeojson'
SELECT ST_GEOMFROMGEOJSON(Point(1,1), Point(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'st_geomfromgeojson'
+ERROR HY000: Illegal parameter data type point for operation 'st_geomfromgeojson'
SELECT POINT(ROW(1,1),1);
ERROR HY000: Illegal parameter data type row for operation 'point'
SELECT POINT(POINT(1,1),1);
-ERROR HY000: Illegal parameter data type geometry for operation 'point'
+ERROR HY000: Illegal parameter data type point for operation 'point'
SELECT POINT(1,ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'point'
SELECT POINT(1,POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'point'
+ERROR HY000: Illegal parameter data type point for operation 'point'
PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ST_GEOMFROMTEXT(?,?) AS g';
EXECUTE stmt USING 1,1;
ERROR HY000: Illegal parameter data type int for operation 'st_geometryfromtext'
EXECUTE stmt USING POINT(1,1),POINT(1,1);
-ERROR HY000: Illegal parameter data type geometry for operation 'st_geometryfromtext'
+ERROR HY000: Illegal parameter data type point for operation 'st_geometryfromtext'
EXECUTE stmt USING 'POINT(1 1)',1;
SHOW CREATE TABLE t1;
Table Create Table
@@ -4670,7 +4670,7 @@ ERROR HY000: Illegal parameter data type date for operation 'st_relate'
SELECT ST_RELATE(Point(1,1),Point(1,1),TIMESTAMP'2010-01-01 10:10:10');
ERROR HY000: Illegal parameter data type datetime for operation 'st_relate'
SELECT ST_RELATE(Point(1,1),Point(1,1),Point(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'st_relate'
+ERROR HY000: Illegal parameter data type point for operation 'st_relate'
# Item_str_ascii_func_args_geometry
SELECT ST_ASTEXT(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'st_astext'
@@ -4691,9 +4691,9 @@ ERROR HY000: Illegal parameter data type int for operation 'st_asgeojson'
SELECT ST_ASGEOJSON('test');
ERROR HY000: Illegal parameter data type varchar for operation 'st_asgeojson'
SELECT ST_ASGEOJSON(POINT(1,1), POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'st_asgeojson'
+ERROR HY000: Illegal parameter data type point for operation 'st_asgeojson'
SELECT ST_ASGEOJSON(POINT(1,1), 1, POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'st_asgeojson'
+ERROR HY000: Illegal parameter data type point for operation 'st_asgeojson'
# Item_func_spatial_rel
SELECT ST_TOUCHES(ROW(1,1), POINT(1,1));
ERROR HY000: Illegal parameter data type row for operation 'st_touches'
@@ -4723,47 +4723,47 @@ ERROR HY000: Illegal parameter data type varchar for operation 'st_touches'
# MDEV-13964 Parameter data type control for Item_real_func
#
SELECT EXP(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'exp'
+ERROR HY000: Illegal parameter data type point for operation 'exp'
SELECT LN(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'ln'
+ERROR HY000: Illegal parameter data type point for operation 'ln'
SELECT LOG2(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'log2'
+ERROR HY000: Illegal parameter data type point for operation 'log2'
SELECT LOG10(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'log10'
+ERROR HY000: Illegal parameter data type point for operation 'log10'
SELECT SQRT(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'sqrt'
+ERROR HY000: Illegal parameter data type point for operation 'sqrt'
SELECT ACOS(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'acos'
+ERROR HY000: Illegal parameter data type point for operation 'acos'
SELECT ASIN(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'asin'
+ERROR HY000: Illegal parameter data type point for operation 'asin'
SELECT COS(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'cos'
+ERROR HY000: Illegal parameter data type point for operation 'cos'
SELECT SIN(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'sin'
+ERROR HY000: Illegal parameter data type point for operation 'sin'
SELECT TAN(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'tan'
+ERROR HY000: Illegal parameter data type point for operation 'tan'
SELECT COT(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'cot'
+ERROR HY000: Illegal parameter data type point for operation 'cot'
SELECT LOG(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'log'
+ERROR HY000: Illegal parameter data type point for operation 'log'
SELECT LOG(POINT(1,1),POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'log'
+ERROR HY000: Illegal parameter data type point for operation 'log'
SELECT LOG(1, POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'log'
+ERROR HY000: Illegal parameter data type point for operation 'log'
SELECT ATAN(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'atan'
+ERROR HY000: Illegal parameter data type point for operation 'atan'
SELECT ATAN(POINT(1,1),POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'atan'
+ERROR HY000: Illegal parameter data type point for operation 'atan'
SELECT ATAN(1, POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'atan'
+ERROR HY000: Illegal parameter data type point for operation 'atan'
SELECT POW(POINT(1,1),POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'pow'
+ERROR HY000: Illegal parameter data type point for operation 'pow'
SELECT RAND(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'rand'
+ERROR HY000: Illegal parameter data type point for operation 'rand'
SELECT RADIANS(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'radians'
+ERROR HY000: Illegal parameter data type point for operation 'radians'
SELECT DEGREES(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'degrees'
+ERROR HY000: Illegal parameter data type point for operation 'degrees'
SELECT EXP(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'exp'
SELECT LN(ROW(1,1));
@@ -4810,64 +4810,64 @@ ERROR HY000: Illegal parameter data type row for operation 'degrees'
# MDEV-13965 Parameter data type control for Item_longlong_func
#
SELECT POINT(1,1) | 1;
-ERROR HY000: Illegal parameter data type geometry for operation '|'
+ERROR HY000: Illegal parameter data type point for operation '|'
SELECT 1 | POINT(1,1);
-ERROR HY000: Illegal parameter data type geometry for operation '|'
+ERROR HY000: Illegal parameter data type point for operation '|'
SELECT POINT(1,1) & 1;
-ERROR HY000: Illegal parameter data type geometry for operation '&'
+ERROR HY000: Illegal parameter data type point for operation '&'
SELECT 1 & POINT(1,1);
-ERROR HY000: Illegal parameter data type geometry for operation '&'
+ERROR HY000: Illegal parameter data type point for operation '&'
SELECT POINT(1,1) << 1;
-ERROR HY000: Illegal parameter data type geometry for operation '<<'
+ERROR HY000: Illegal parameter data type point for operation '<<'
SELECT 1 << POINT(1,1);
-ERROR HY000: Illegal parameter data type geometry for operation '<<'
+ERROR HY000: Illegal parameter data type point for operation '<<'
SELECT POINT(1,1) >> 1;
-ERROR HY000: Illegal parameter data type geometry for operation '>>'
+ERROR HY000: Illegal parameter data type point for operation '>>'
SELECT 1 >> POINT(1,1);
-ERROR HY000: Illegal parameter data type geometry for operation '>>'
+ERROR HY000: Illegal parameter data type point for operation '>>'
SELECT ~POINT(1,1);
-ERROR HY000: Illegal parameter data type geometry for operation '~'
+ERROR HY000: Illegal parameter data type point for operation '~'
SELECT TO_SECONDS(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'to_seconds'
+ERROR HY000: Illegal parameter data type point for operation 'to_seconds'
SELECT TIMESTAMPDIFF(SECOND,POINT(1,1), 1);
-ERROR HY000: Illegal parameter data type geometry for operation 'timestampdiff'
+ERROR HY000: Illegal parameter data type point for operation 'timestampdiff'
SELECT TIMESTAMPDIFF(SECOND,1, POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'timestampdiff'
+ERROR HY000: Illegal parameter data type point for operation 'timestampdiff'
SELECT INET_ATON(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'inet_aton'
+ERROR HY000: Illegal parameter data type point for operation 'inet_aton'
SELECT LAST_INSERT_ID(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'last_insert_id'
+ERROR HY000: Illegal parameter data type point for operation 'last_insert_id'
#
# MDEV-13966 Parameter data type control for Item_temporal_func
#
SELECT FROM_DAYS(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'from_days'
+ERROR HY000: Illegal parameter data type point for operation 'from_days'
SELECT MAKEDATE(POINT(1,1),1);
-ERROR HY000: Illegal parameter data type geometry for operation 'makedate'
+ERROR HY000: Illegal parameter data type point for operation 'makedate'
SELECT MAKEDATE(1, POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'makedate'
+ERROR HY000: Illegal parameter data type point for operation 'makedate'
SELECT LAST_DAY(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'last_day'
+ERROR HY000: Illegal parameter data type point for operation 'last_day'
SELECT SEC_TO_TIME(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'sec_to_time'
+ERROR HY000: Illegal parameter data type point for operation 'sec_to_time'
SELECT TIMEDIFF(POINT(1,1),1);
-ERROR HY000: Illegal parameter data type geometry for operation 'timediff'
+ERROR HY000: Illegal parameter data type point for operation 'timediff'
SELECT TIMEDIFF(1, POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'timediff'
+ERROR HY000: Illegal parameter data type point for operation 'timediff'
SELECT MAKETIME(POINT(1,1),1,1);
-ERROR HY000: Illegal parameter data type geometry for operation 'maketime'
+ERROR HY000: Illegal parameter data type point for operation 'maketime'
SELECT MAKETIME(1, POINT(1,1), 1);
-ERROR HY000: Illegal parameter data type geometry for operation 'maketime'
+ERROR HY000: Illegal parameter data type point for operation 'maketime'
SELECT MAKETIME(1, 1, POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'maketime'
+ERROR HY000: Illegal parameter data type point for operation 'maketime'
SELECT FROM_UNIXTIME(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'from_unixtime'
+ERROR HY000: Illegal parameter data type point for operation 'from_unixtime'
SELECT CONVERT_TZ(POINT(1,1),1,1);
-ERROR HY000: Illegal parameter data type geometry for operation 'convert_tz'
+ERROR HY000: Illegal parameter data type point for operation 'convert_tz'
SELECT CONVERT_TZ(1, POINT(1,1), 1);
-ERROR HY000: Illegal parameter data type geometry for operation 'convert_tz'
+ERROR HY000: Illegal parameter data type point for operation 'convert_tz'
SELECT CONVERT_TZ(1, 1, POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'convert_tz'
+ERROR HY000: Illegal parameter data type point for operation 'convert_tz'
#
# MDEV-13967 Parameter data type control for Item_long_func
#
@@ -4896,67 +4896,67 @@ SELECT ORD(POINT(1,1));
ORD(POINT(1,1))
0
SELECT SIGN(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'sign'
+ERROR HY000: Illegal parameter data type point for operation 'sign'
SELECT LOCATE('a','a',POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'locate'
+ERROR HY000: Illegal parameter data type point for operation 'locate'
SELECT LOCATE(POINT(1,1),POINT(1,1));
LOCATE(POINT(1,1),POINT(1,1))
1
SELECT BIT_COUNT(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'bit_count'
+ERROR HY000: Illegal parameter data type point for operation 'bit_count'
SELECT BENCHMARK(POINT(1,1),'');
-ERROR HY000: Illegal parameter data type geometry for operation 'benchmark'
+ERROR HY000: Illegal parameter data type point for operation 'benchmark'
SELECT SLEEP(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'sleep'
+ERROR HY000: Illegal parameter data type point for operation 'sleep'
SELECT GET_LOCK('x', POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'get_lock'
+ERROR HY000: Illegal parameter data type point for operation 'get_lock'
SELECT PERIOD_ADD(POINT(1,1),1);
-ERROR HY000: Illegal parameter data type geometry for operation 'period_add'
+ERROR HY000: Illegal parameter data type point for operation 'period_add'
SELECT PERIOD_ADD(1,POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'period_add'
+ERROR HY000: Illegal parameter data type point for operation 'period_add'
SELECT PERIOD_DIFF(POINT(1,1),1);
-ERROR HY000: Illegal parameter data type geometry for operation 'period_diff'
+ERROR HY000: Illegal parameter data type point for operation 'period_diff'
SELECT PERIOD_DIFF(1,POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'period_diff'
+ERROR HY000: Illegal parameter data type point for operation 'period_diff'
SELECT TO_DAYS(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'to_days'
+ERROR HY000: Illegal parameter data type point for operation 'to_days'
SELECT DAYOFMONTH(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'dayofmonth'
+ERROR HY000: Illegal parameter data type point for operation 'dayofmonth'
SELECT DAYOFYEAR(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'dayofyear'
+ERROR HY000: Illegal parameter data type point for operation 'dayofyear'
SELECT QUARTER(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'quarter'
+ERROR HY000: Illegal parameter data type point for operation 'quarter'
SELECT YEAR(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'year'
+ERROR HY000: Illegal parameter data type point for operation 'year'
SELECT YEARWEEK(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'yearweek'
+ERROR HY000: Illegal parameter data type point for operation 'yearweek'
SELECT WEEK(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'week'
+ERROR HY000: Illegal parameter data type point for operation 'week'
SELECT WEEK(POINT(1,1),1);
-ERROR HY000: Illegal parameter data type geometry for operation 'week'
+ERROR HY000: Illegal parameter data type point for operation 'week'
SELECT WEEK(1,POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'week'
+ERROR HY000: Illegal parameter data type point for operation 'week'
SELECT HOUR(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'hour'
+ERROR HY000: Illegal parameter data type point for operation 'hour'
SELECT MINUTE(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'minute'
+ERROR HY000: Illegal parameter data type point for operation 'minute'
SELECT SECOND(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'second'
+ERROR HY000: Illegal parameter data type point for operation 'second'
SELECT MICROSECOND(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'microsecond'
+ERROR HY000: Illegal parameter data type point for operation 'microsecond'
SELECT JSON_DEPTH(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'json_depth'
+ERROR HY000: Illegal parameter data type point for operation 'json_depth'
SELECT JSON_LENGTH(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'json_length'
+ERROR HY000: Illegal parameter data type point for operation 'json_length'
SELECT JSON_LENGTH('json', POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'json_length'
+ERROR HY000: Illegal parameter data type point for operation 'json_length'
SELECT JSON_LENGTH(POINT(1,1), POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'json_length'
+ERROR HY000: Illegal parameter data type point for operation 'json_length'
SELECT REGEXP_INSTR(POINT(1,1),'');
REGEXP_INSTR(POINT(1,1),'')
1
SELECT REGEXP_INSTR('',POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'regexp_instr'
+ERROR HY000: Illegal parameter data type point for operation 'regexp_instr'
SELECT FIND_IN_SET(POINT(1,1),'');
FIND_IN_SET(POINT(1,1),'')
0
@@ -4964,11 +4964,11 @@ SELECT FIND_IN_SET('',POINT(1,1));
FIND_IN_SET('',POINT(1,1))
0
SELECT RELEASE_LOCK(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'release_lock'
+ERROR HY000: Illegal parameter data type point for operation 'release_lock'
SELECT IS_FREE_LOCK(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'is_free_lock'
+ERROR HY000: Illegal parameter data type point for operation 'is_free_lock'
SELECT IS_USED_LOCK(POINT(1,1));
-ERROR HY000: Illegal parameter data type geometry for operation 'is_used_lock'
+ERROR HY000: Illegal parameter data type point for operation 'is_used_lock'
#
# End of 10.3 tests
#
@@ -5012,16 +5012,16 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
SELECT 0x60+POINT(1,1);
-ERROR HY000: Illegal parameter data types bigint and geometry for operation '+'
+ERROR HY000: Illegal parameter data types bigint unsigned and point for operation '+'
SELECT POINT(1,1)+0x60;
-ERROR HY000: Illegal parameter data types geometry and bigint for operation '+'
+ERROR HY000: Illegal parameter data types point and bigint unsigned for operation '+'
#
# MDEV-16454 Bad results for IN with ROW
#
SELECT (1,0) IN ((POINT(1,1),0),(0,0));
-ERROR HY000: Illegal parameter data types int and geometry for operation 'in'
+ERROR HY000: Illegal parameter data types int and point for operation 'in'
SELECT (1,(0,0)) IN ((1,(POINT(1,1),0)),(0,(0,0)));
-ERROR HY000: Illegal parameter data types int and geometry for operation 'in'
+ERROR HY000: Illegal parameter data types int and point for operation 'in'
#
# MDEV-19819 ALTER from POINT to LINESTRING erroneously preserves POINT values
#
@@ -5041,3 +5041,59 @@ DROP TABLE t1, t2;
#
# End of 10.4 tests
#
+#
+# Start of 10.5 tests
+#
+#
+# MDEV-19994 Add class Function_collection
+#
+SELECT CONTAINS();
+ERROR 42000: Incorrect parameter count in the call to native function 'CONTAINS()'
+SELECT CONTAINS(POINT(1,1));
+ERROR 42000: Incorrect parameter count in the call to native function 'CONTAINS(POINT(1,1))'
+SELECT CONTAINS(POINT(1,1), POINT(1,1), POINT(1,1));
+ERROR 42000: Incorrect parameter count in the call to native function 'CONTAINS(POINT(1,1), POINT(1,1), POINT(1,1))'
+SELECT WITHIN();
+ERROR 42000: Incorrect parameter count in the call to native function 'WITHIN()'
+SELECT WITHIN(POINT(1,1));
+ERROR 42000: Incorrect parameter count in the call to native function 'WITHIN(POINT(1,1))'
+SELECT WITHIN(POINT(1,1), POINT(1,1), POINT(1,1));
+ERROR 42000: Incorrect parameter count in the call to native function 'WITHIN(POINT(1,1), POINT(1,1), POINT(1,1))'
+#
+# MDEV-20009 Add CAST(expr AS pluggable_type)
+#
+SELECT CAST(1 AS GEOMETRY);
+ERROR HY000: Operator does not exists: 'CAST(expr AS geometry)'
+SELECT CAST(1 AS GEOMETRYCOLLECTION);
+ERROR HY000: Operator does not exists: 'CAST(expr AS geometrycollection)'
+SELECT CAST(1 AS POINT);
+ERROR HY000: Operator does not exists: 'CAST(expr AS point)'
+SELECT CAST(1 AS LINESTRING);
+ERROR HY000: Operator does not exists: 'CAST(expr AS linestring)'
+SELECT CAST(1 AS POLYGON);
+ERROR HY000: Operator does not exists: 'CAST(expr AS polygon)'
+SELECT CAST(1 AS MULTIPOINT);
+ERROR HY000: Operator does not exists: 'CAST(expr AS multipoint)'
+SELECT CAST(1 AS MULTILINESTRING);
+ERROR HY000: Operator does not exists: 'CAST(expr AS multilinestring)'
+SELECT CAST(1 AS MULTIPOLYGON);
+ERROR HY000: Operator does not exists: 'CAST(expr AS multipolygon)'
+SELECT CONVERT(1, GEOMETRY);
+ERROR HY000: Operator does not exists: 'CAST(expr AS geometry)'
+SELECT CONVERT(1, GEOMETRYCOLLECTION);
+ERROR HY000: Operator does not exists: 'CAST(expr AS geometrycollection)'
+SELECT CONVERT(1, POINT);
+ERROR HY000: Operator does not exists: 'CAST(expr AS point)'
+SELECT CONVERT(1, LINESTRING);
+ERROR HY000: Operator does not exists: 'CAST(expr AS linestring)'
+SELECT CONVERT(1, POLYGON);
+ERROR HY000: Operator does not exists: 'CAST(expr AS polygon)'
+SELECT CONVERT(1, MULTIPOINT);
+ERROR HY000: Operator does not exists: 'CAST(expr AS multipoint)'
+SELECT CONVERT(1, MULTILINESTRING);
+ERROR HY000: Operator does not exists: 'CAST(expr AS multilinestring)'
+SELECT CONVERT(1, MULTIPOLYGON);
+ERROR HY000: Operator does not exists: 'CAST(expr AS multipolygon)'
+#
+# End of 10.5 tests
+#
diff --git a/mysql-test/main/gis.test b/mysql-test/main/gis.test
index e897086ed47..48f2803b27d 100644
--- a/mysql-test/main/gis.test
+++ b/mysql-test/main/gis.test
@@ -3116,3 +3116,70 @@ DROP TABLE t1, t2;
--echo #
--echo # End of 10.4 tests
--echo #
+
+
+--echo #
+--echo # Start of 10.5 tests
+--echo #
+
+--echo #
+--echo # MDEV-19994 Add class Function_collection
+--echo #
+
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT CONTAINS();
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT CONTAINS(POINT(1,1));
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT CONTAINS(POINT(1,1), POINT(1,1), POINT(1,1));
+
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT WITHIN();
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT WITHIN(POINT(1,1));
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT WITHIN(POINT(1,1), POINT(1,1), POINT(1,1));
+
+--echo #
+--echo # MDEV-20009 Add CAST(expr AS pluggable_type)
+--echo #
+
+--error ER_UNKNOWN_OPERATOR
+SELECT CAST(1 AS GEOMETRY);
+--error ER_UNKNOWN_OPERATOR
+SELECT CAST(1 AS GEOMETRYCOLLECTION);
+--error ER_UNKNOWN_OPERATOR
+SELECT CAST(1 AS POINT);
+--error ER_UNKNOWN_OPERATOR
+SELECT CAST(1 AS LINESTRING);
+--error ER_UNKNOWN_OPERATOR
+SELECT CAST(1 AS POLYGON);
+--error ER_UNKNOWN_OPERATOR
+SELECT CAST(1 AS MULTIPOINT);
+--error ER_UNKNOWN_OPERATOR
+SELECT CAST(1 AS MULTILINESTRING);
+--error ER_UNKNOWN_OPERATOR
+SELECT CAST(1 AS MULTIPOLYGON);
+
+
+--error ER_UNKNOWN_OPERATOR
+SELECT CONVERT(1, GEOMETRY);
+--error ER_UNKNOWN_OPERATOR
+SELECT CONVERT(1, GEOMETRYCOLLECTION);
+--error ER_UNKNOWN_OPERATOR
+SELECT CONVERT(1, POINT);
+--error ER_UNKNOWN_OPERATOR
+SELECT CONVERT(1, LINESTRING);
+--error ER_UNKNOWN_OPERATOR
+SELECT CONVERT(1, POLYGON);
+--error ER_UNKNOWN_OPERATOR
+SELECT CONVERT(1, MULTIPOINT);
+--error ER_UNKNOWN_OPERATOR
+SELECT CONVERT(1, MULTILINESTRING);
+--error ER_UNKNOWN_OPERATOR
+SELECT CONVERT(1, MULTIPOLYGON);
+
+
+--echo #
+--echo # End of 10.5 tests
+--echo #
diff --git a/mysql-test/main/group_by.result b/mysql-test/main/group_by.result
index d1b0898e6b2..3108f2f4e65 100644
--- a/mysql-test/main/group_by.result
+++ b/mysql-test/main/group_by.result
@@ -321,6 +321,7 @@ a c count(distinct rand())
drop table t1;
CREATE TABLE t1 (a char(1));
INSERT INTO t1 VALUES ('A'),('B'),('A'),('B'),('A'),('B'),(NULL),('a'),('b'),(NULL),('A'),('B'),(NULL);
+flush status;
SELECT a FROM t1 GROUP BY a;
a
NULL
@@ -359,7 +360,11 @@ A 4
B 4
a 1
b 1
-SET BIG_TABLES=1;
+show status like 'Created%tables';
+Variable_name Value
+Created_tmp_disk_tables 0
+Created_tmp_tables 6
+set tmp_memory_table_size=0;
SELECT a FROM t1 GROUP BY a;
a
NULL
@@ -398,7 +403,11 @@ A 4
B 4
a 1
b 1
-SET BIG_TABLES=0;
+show status like 'Created%tables';
+Variable_name Value
+Created_tmp_disk_tables 6
+Created_tmp_tables 12
+set tmp_memory_table_size=default;
drop table t1;
CREATE TABLE t1 (
`a` char(193) default NULL,
@@ -515,14 +524,14 @@ a count(*)
NULL 9
3
b 1
-set big_tables=1;
+set tmp_memory_table_size=0;
select a,count(*) from t1 group by a;
a count(*)
NULL 9
3
b 1
drop table t1;
-set big_tables=0;
+set tmp_memory_table_size=default;
SET @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity,@save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='outer_join_with_cache=off',@@optimizer_use_condition_selectivity=4;
create table t1 (a int not null, b int not null);
@@ -1964,7 +1973,7 @@ DROP TABLE t1;
# Bug#11765254 (58200): Assertion failed: param.sort_length when grouping
# by functions
#
-SET BIG_TABLES=1;
+set tmp_memory_table_size=0;
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (0),(0);
SELECT 1 FROM t1 GROUP BY IF(`a`,'','');
@@ -1991,7 +2000,7 @@ Warning 1292 Truncated incorrect INTEGER value: 'jxW<'
Warning 1292 Truncated incorrect INTEGER value: 'K'
Warning 1292 Truncated incorrect INTEGER value: 'jxW<'
DROP TABLE t1;
-SET BIG_TABLES=0;
+set tmp_memory_table_size=default;
#
# MDEV-641 LP:1002108 - Wrong result (or crash) from a query with duplicated field in the group list and a limit clause
# Bug#11761078: 53534: INCORRECT 'SELECT SQL_BIG_RESULT...'
diff --git a/mysql-test/main/group_by.test b/mysql-test/main/group_by.test
index f9242b5b4ff..7ba0945cc72 100644
--- a/mysql-test/main/group_by.test
+++ b/mysql-test/main/group_by.test
@@ -280,21 +280,28 @@ drop table t1;
CREATE TABLE t1 (a char(1));
INSERT INTO t1 VALUES ('A'),('B'),('A'),('B'),('A'),('B'),(NULL),('a'),('b'),(NULL),('A'),('B'),(NULL);
+flush status;
SELECT a FROM t1 GROUP BY a;
SELECT a,count(*) FROM t1 GROUP BY a;
SELECT a FROM t1 GROUP BY binary a;
SELECT a,count(*) FROM t1 GROUP BY binary a;
SELECT binary a FROM t1 GROUP BY 1;
SELECT binary a,count(*) FROM t1 GROUP BY 1;
-# Do the same tests with MyISAM temporary tables
-SET BIG_TABLES=1;
+--disable_ps_protocol
+show status like 'Created%tables';
+--enable_ps_protocol
+# Do the same tests with on-disk temporary tables
+set tmp_memory_table_size=0;
SELECT a FROM t1 GROUP BY a;
SELECT a,count(*) FROM t1 GROUP BY a;
SELECT a FROM t1 GROUP BY binary a;
SELECT a,count(*) FROM t1 GROUP BY binary a;
SELECT binary a FROM t1 GROUP BY 1;
SELECT binary a,count(*) FROM t1 GROUP BY 1;
-SET BIG_TABLES=0;
+--disable_ps_protocol
+show status like 'Created%tables';
+--enable_ps_protocol
+set tmp_memory_table_size=default;
drop table t1;
#
@@ -391,10 +398,10 @@ drop table t1,t2,t3;
create table t1 (a blob null);
insert into t1 values (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(""),(""),(""),("b");
select a,count(*) from t1 group by a;
-set big_tables=1;
+set tmp_memory_table_size=0;
select a,count(*) from t1 group by a;
drop table t1;
-set big_tables=0;
+set tmp_memory_table_size=default;
#
# Test of GROUP BY ... ORDER BY NULL optimization
@@ -1344,7 +1351,7 @@ DROP TABLE t1;
--echo # by functions
--echo #
-SET BIG_TABLES=1;
+set tmp_memory_table_size=0;
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (0),(0);
SELECT 1 FROM t1 GROUP BY IF(`a`,'','');
@@ -1352,7 +1359,7 @@ SELECT 1 FROM t1 GROUP BY TRIM(LEADING RAND() FROM '');
SELECT 1 FROM t1 GROUP BY SUBSTRING('',SLEEP(0),'');
SELECT 1 FROM t1 GROUP BY SUBSTRING(SYSDATE() FROM 'K' FOR 'jxW<');
DROP TABLE t1;
-SET BIG_TABLES=0;
+set tmp_memory_table_size=default;
--echo #
--echo # MDEV-641 LP:1002108 - Wrong result (or crash) from a query with duplicated field in the group list and a limit clause
diff --git a/mysql-test/main/information_schema.result b/mysql-test/main/information_schema.result
index b4d2d065d4a..9e9c92e31be 100644
--- a/mysql-test/main/information_schema.result
+++ b/mysql-test/main/information_schema.result
@@ -10,11 +10,11 @@ grant select, update on test.* to mysqltest_1@localhost;
create user mysqltest_3@localhost;
create user mysqltest_3;
select * from information_schema.SCHEMATA where schema_name > 'm';
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
select schema_name from information_schema.schemata;
schema_name
information_schema
@@ -1575,14 +1575,14 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE b ALL NULL NULL NULL NULL NULL Using where; Open_frm_only; Scanned all databases; Using join buffer (flat, BNL join)
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA
WHERE SCHEMA_NAME = 'mysqltest';
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA
WHERE SCHEMA_NAME = '';
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA
WHERE SCHEMA_NAME = 'test';
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def test latin1 latin1_swedish_ci NULL
select count(*) from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysql' AND TABLE_NAME='nonexisting';
count(*)
0
@@ -1627,7 +1627,7 @@ CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME UNIQUE_CONSTRAINT_CATALOG U
select * from `information_schema`.`REFERENTIAL_CONSTRAINTS` where `TABLE_NAME` = NULL;
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME UNIQUE_CONSTRAINT_CATALOG UNIQUE_CONSTRAINT_SCHEMA UNIQUE_CONSTRAINT_NAME MATCH_OPTION UPDATE_RULE DELETE_RULE TABLE_NAME REFERENCED_TABLE_NAME
select * from information_schema.schemata where schema_name = NULL;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
select * from `information_schema`.`STATISTICS` where `TABLE_SCHEMA` = NULL;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT INDEX_COMMENT
select * from `information_schema`.`STATISTICS` where `TABLE_NAME` = NULL;
diff --git a/mysql-test/main/innodb_icp.result b/mysql-test/main/innodb_icp.result
index d65acd5a48d..5a3a5b6432b 100644
--- a/mysql-test/main/innodb_icp.result
+++ b/mysql-test/main/innodb_icp.result
@@ -435,9 +435,9 @@ EXPLAIN
SELECT * FROM t1
WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON it.i=it.i WHERE it.pk-t1.i<10);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where
-2 DEPENDENT SUBQUERY it eq_ref PRIMARY PRIMARY 4 func 1 Using where
-2 DEPENDENT SUBQUERY t2 index NULL PRIMARY 4 NULL 3 Using index; Using join buffer (flat, BNL join)
+1 PRIMARY t1 ALL NULL NULL NULL NULL # Using where
+2 DEPENDENT SUBQUERY it eq_ref PRIMARY PRIMARY 4 func # Using where
+2 DEPENDENT SUBQUERY t2 index NULL PRIMARY 4 NULL # Using index; Using join buffer (flat, BNL join)
SELECT * FROM t1
WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON it.i=it.i WHERE it.pk-t1.i<10);
pk i
diff --git a/mysql-test/main/innodb_mysql_lock2.result b/mysql-test/main/innodb_mysql_lock2.result
index 608cbec88c5..ffbe3f8a406 100644
--- a/mysql-test/main/innodb_mysql_lock2.result
+++ b/mysql-test/main/innodb_mysql_lock2.result
@@ -238,8 +238,7 @@ Success: 'show keys from t1' doesn't take row locks on 't1'.
# statement-by-statement) and thanks to MVCC we can always get
# versions of rows prior to the update that has locked them.
# But in practice InnoDB does locking reads for all statements
-# other than SELECT (unless it is a READ-COMITTED mode or
-# innodb_locks_unsafe_for_binlog is ON).
+# other than SELECT (unless READ UNCOMMITTED or READ COMMITTED).
connection default;
Success: 'call p1((select i + 5 from t1 where i = 1))' takes shared row locks on 't1'.
#
diff --git a/mysql-test/main/innodb_mysql_lock2.test b/mysql-test/main/innodb_mysql_lock2.test
index f319fe23568..b983fd8dc7a 100644
--- a/mysql-test/main/innodb_mysql_lock2.test
+++ b/mysql-test/main/innodb_mysql_lock2.test
@@ -261,8 +261,7 @@ let $statement= show keys from t1;
--echo # statement-by-statement) and thanks to MVCC we can always get
--echo # versions of rows prior to the update that has locked them.
--echo # But in practice InnoDB does locking reads for all statements
---echo # other than SELECT (unless it is a READ-COMITTED mode or
---echo # innodb_locks_unsafe_for_binlog is ON).
+--echo # other than SELECT (unless READ UNCOMMITTED or READ COMMITTED).
let $statement= call p1((select i + 5 from t1 where i = 1));
let $wait_statement= $statement;
--source include/check_shared_row_lock.inc
diff --git a/mysql-test/main/intersect.result b/mysql-test/main/intersect.result
index 5990fcce110..7b43e478e30 100644
--- a/mysql-test/main/intersect.result
+++ b/mysql-test/main/intersect.result
@@ -508,8 +508,6 @@ select 1 as a from dual union all select 1 from dual;
a
1
1
-select 1 from dual intersect all select 1 from dual;
-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 'all select 1 from dual' at line 1
create table t1 (a int, b blob, a1 int, b1 blob);
create table t2 (c int, d blob, c1 int, d1 blob);
insert into t1 values (1,"ddd", 1, "sdfrrwwww"),(2, "fgh", 2, "dffggtt");
@@ -611,22 +609,6 @@ NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL NULL
NULL UNION RESULT <union1,5,4> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1003 (/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) union /* select#5 */ select `__5`.`c` AS `c`,`__5`.`d` AS `d` from ((/* select#2 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`) intersect (/* select#3 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3`)) `__5` union (/* select#4 */ select 4 AS `4`,4 AS `4`)
-set SQL_MODE=ORACLE;
-(select a,b from t1) union (select c,d from t2) intersect (select e,f from t3) union (select 4,4);
-a b
-3 3
-4 4
-explain extended
-(select a,b from t1) union (select c,d from t2) intersect (select e,f from t3) union (select 4,4);
-id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
-2 UNION t2 ALL NULL NULL NULL NULL 2 100.00
-3 INTERSECT t3 ALL NULL NULL NULL NULL 2 100.00
-4 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
-NULL UNIT RESULT <unit1,2,3,4> ALL NULL NULL NULL NULL NULL NULL
-Warnings:
-Note 1003 (/* select#1 */ select "test"."t1"."a" AS "a","test"."t1"."b" AS "b" from "test"."t1") union (/* select#2 */ select "test"."t2"."c" AS "c","test"."t2"."d" AS "d" from "test"."t2") intersect (/* select#3 */ select "test"."t3"."e" AS "e","test"."t3"."f" AS "f" from "test"."t3") union (/* select#4 */ select 4 AS "4",4 AS "4")
-set SQL_MODE=default;
(select e,f from t3) intersect (select c,d from t2) union (select a,b from t1) union (select 4,4);
e f
3 3
@@ -643,24 +625,6 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
NULL UNIT RESULT <unit1,2,3,4> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1003 (/* select#1 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3`) intersect (/* select#2 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`) union (/* select#3 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) union (/* select#4 */ select 4 AS `4`,4 AS `4`)
-set SQL_MODE=ORACLE;
-(select e,f from t3) intersect (select c,d from t2) union (select a,b from t1) union (select 4,4);
-e f
-3 3
-4 4
-5 5
-6 6
-explain extended
-(select e,f from t3) intersect (select c,d from t2) union (select a,b from t1) union (select 4,4);
-id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00
-2 INTERSECT t2 ALL NULL NULL NULL NULL 2 100.00
-3 UNION t1 ALL NULL NULL NULL NULL 2 100.00
-4 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
-NULL UNIT RESULT <unit1,2,3,4> ALL NULL NULL NULL NULL NULL NULL
-Warnings:
-Note 1003 (/* select#1 */ select "test"."t3"."e" AS "e","test"."t3"."f" AS "f" from "test"."t3") intersect (/* select#2 */ select "test"."t2"."c" AS "c","test"."t2"."d" AS "d" from "test"."t2") union (/* select#3 */ select "test"."t1"."a" AS "a","test"."t1"."b" AS "b" from "test"."t1") union (/* select#4 */ select 4 AS "4",4 AS "4")
-set SQL_MODE=default;
(/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) union /* select#3 */ select `__3`.`c` AS `c`,`__3`.`d` AS `d` from ((/* select#2 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`) intersect (/* select#4 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3`)) `__3` union (/* select#5 */ select 4 AS `4`,4 AS `4`);
a b
3 3
@@ -824,12 +788,6 @@ create table t234(c1 int);
insert into t234 values(2);
insert into t234 values(3);
insert into t234 values(4);
-set SQL_MODE=oracle;
-select * from t13 union select * from t234 intersect select * from t12;
-c1
-1
-2
-set SQL_MODE=default;
select * from t13 union select * from t234 intersect select * from t12;
c1
1
@@ -852,9 +810,9 @@ select * from t2 where a < 5
intersect
select * from t3 where a < 5;
a
+1
7
7
-1
explain extended
select * from t1 where a > 4
union all
diff --git a/mysql-test/main/intersect.test b/mysql-test/main/intersect.test
index 18c95d62d44..e42c0d007b5 100644
--- a/mysql-test/main/intersect.test
+++ b/mysql-test/main/intersect.test
@@ -71,8 +71,6 @@ select 1 as a from dual intersect select 1 from dual;
select 1 from dual ORDER BY 1 intersect select 1 from dual;
select 1 as a from dual union all select 1 from dual;
---error ER_PARSE_ERROR
-select 1 from dual intersect all select 1 from dual;
@@ -153,12 +151,6 @@ insert into t3 values (1,1),(3,3);
(select a,b from t1) union (select c,d from t2) intersect (select e,f from t3) union (select 4,4);
explain extended
(select a,b from t1) union (select c,d from t2) intersect (select e,f from t3) union (select 4,4);
-set SQL_MODE=ORACLE;
---sorted_result
-(select a,b from t1) union (select c,d from t2) intersect (select e,f from t3) union (select 4,4);
-explain extended
-(select a,b from t1) union (select c,d from t2) intersect (select e,f from t3) union (select 4,4);
-set SQL_MODE=default;
# test result of linear mix operation
@@ -166,12 +158,6 @@ set SQL_MODE=default;
(select e,f from t3) intersect (select c,d from t2) union (select a,b from t1) union (select 4,4);
explain extended
(select e,f from t3) intersect (select c,d from t2) union (select a,b from t1) union (select 4,4);
-set SQL_MODE=ORACLE;
---sorted_result
-(select e,f from t3) intersect (select c,d from t2) union (select a,b from t1) union (select 4,4);
-explain extended
-(select e,f from t3) intersect (select c,d from t2) union (select a,b from t1) union (select 4,4);
-set SQL_MODE=default;
--sorted_result
(/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) union /* select#3 */ select `__3`.`c` AS `c`,`__3`.`d` AS `d` from ((/* select#2 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`) intersect (/* select#4 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3`)) `__3` union (/* select#5 */ select 4 AS `4`,4 AS `4`);
@@ -316,11 +302,7 @@ create table t234(c1 int);
insert into t234 values(2);
insert into t234 values(3);
insert into t234 values(4);
-
-set SQL_MODE=oracle;
---sorted_result
-select * from t13 union select * from t234 intersect select * from t12;
-set SQL_MODE=default;
+
--sorted_result
select * from t13 union select * from t234 intersect select * from t12;
@@ -339,7 +321,7 @@ insert into t2 values (4), (5), (9), (1), (8), (9);
create table t3 (a int);
insert into t3 values (8), (1), (8), (2), (3), (7), (2);
-
+--sorted_result
select * from t1 where a > 4
union all
select * from t2 where a < 5
diff --git a/mysql-test/main/intersect_all.result b/mysql-test/main/intersect_all.result
new file mode 100644
index 00000000000..84a97982d13
--- /dev/null
+++ b/mysql-test/main/intersect_all.result
@@ -0,0 +1,888 @@
+create table t1 (a int, b int) engine=MyISAM;
+create table t2 (c int, d int) engine=MyISAM;
+insert into t1 values (1,1),(2,2),(3,3),(2,2);
+insert into t2 values (2,2),(2,2),(5,5);
+select * from t1 intersect all select * from t2;
+a b
+2 2
+2 2
+(select a,b from t1) intersect all (select c,d from t2);
+a b
+2 2
+2 2
+select * from ((select a,b from t1) intersect all (select c,d from t2)) t;
+a b
+2 2
+2 2
+select * from ((select a from t1) intersect all (select c from t2)) t;
+a
+2
+2
+drop tables t1,t2;
+create table t1 (a int, b int) engine=MyISAM;
+create table t2 (c int, d int) engine=MyISAM;
+create table t3 (e int, f int) engine=MyISAM;
+insert into t1 values (1,1),(2,2),(3,3),(2,2);
+insert into t2 values (2,2),(3,3),(4,4),(2,2);
+insert into t3 values (1,1),(2,2),(5,5),(2,2);
+(select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3);
+a b
+2 2
+2 2
+EXPLAIN (select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 4
+2 INTERSECT t2 ALL NULL NULL NULL NULL 4
+3 INTERSECT t3 ALL NULL NULL NULL NULL 4
+NULL INTERSECT RESULT <intersect1,2,3> ALL NULL NULL NULL NULL NULL
+EXPLAIN extended (select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 4 100.00
+2 INTERSECT t2 ALL NULL NULL NULL NULL 4 100.00
+3 INTERSECT t3 ALL NULL NULL NULL NULL 4 100.00
+NULL INTERSECT RESULT <intersect1,2,3> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 (/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) intersect all (/* select#2 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`) intersect all (/* select#3 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3`)
+EXPLAIN extended select * from ((select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3)) a;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 100.00
+2 DERIVED t1 ALL NULL NULL NULL NULL 4 100.00
+3 INTERSECT t2 ALL NULL NULL NULL NULL 4 100.00
+4 INTERSECT t3 ALL NULL NULL NULL NULL 4 100.00
+NULL INTERSECT RESULT <intersect2,3,4> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 /* select#1 */ select `a`.`a` AS `a`,`a`.`b` AS `b` from ((/* select#2 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) intersect all (/* select#3 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`) intersect all (/* select#4 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3`)) `a`
+EXPLAIN format=json (select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3);
+EXPLAIN
+{
+ "query_block": {
+ "union_result": {
+ "table_name": "<intersect1,2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 4,
+ "filtered": 100
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 2,
+ "operation": "INTERSECT",
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 4,
+ "filtered": 100
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "INTERSECT",
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "rows": 4,
+ "filtered": 100
+ }
+ }
+ }
+ ]
+ }
+ }
+}
+ANALYZE format=json (select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3);
+ANALYZE
+{
+ "query_block": {
+ "union_result": {
+ "table_name": "<intersect1,2,3>",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "r_rows": 2,
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 1,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 4,
+ "r_rows": 4,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 2,
+ "operation": "INTERSECT",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 4,
+ "r_rows": 4,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "INTERSECT",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 4,
+ "r_rows": 4,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ }
+ ]
+ }
+ }
+}
+ANALYZE format=json select * from ((select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3)) a;
+ANALYZE
+{
+ "query_block": {
+ "select_id": 1,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 4,
+ "r_rows": 2,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<intersect2,3,4>",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "r_rows": 2,
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 4,
+ "r_rows": 4,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "INTERSECT",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 4,
+ "r_rows": 4,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 4,
+ "operation": "INTERSECT",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 4,
+ "r_rows": 4,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+}
+select * from ((select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3)) a;
+a b
+2 2
+2 2
+prepare stmt from "(select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3);";
+execute stmt;
+a b
+2 2
+2 2
+execute stmt;
+a b
+2 2
+2 2
+prepare stmt from "select * from ((select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3)) a";
+execute stmt;
+a b
+2 2
+2 2
+execute stmt;
+a b
+2 2
+2 2
+insert into t1 values (2,2),(3,3);
+insert into t2 values (2,2),(2,2),(2,2);
+(select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3);
+a b
+2 2
+2 2
+(select a,b from t1) intersect (select c,d from t2) intersect all (select e,f from t3);
+a b
+2 2
+insert into t3 values (2,2);
+(select a,b from t1) intersect all (select c,d from t2) intersect (select e,f from t3);
+a b
+2 2
+(select a,b from t1) intersect all (select c,e from t2,t3);
+a b
+2 2
+2 2
+2 2
+EXPLAIN (select a,b from t1) intersect all (select c,e from t2,t3);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 6
+2 INTERSECT t3 ALL NULL NULL NULL NULL 5
+2 INTERSECT t2 ALL NULL NULL NULL NULL 7 Using join buffer (flat, BNL join)
+NULL INTERSECT RESULT <intersect1,2> ALL NULL NULL NULL NULL NULL
+EXPLAIN extended (select a,b from t1) intersect all (select c,e from t2,t3);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00
+2 INTERSECT t3 ALL NULL NULL NULL NULL 5 100.00
+2 INTERSECT t2 ALL NULL NULL NULL NULL 7 100.00 Using join buffer (flat, BNL join)
+NULL INTERSECT RESULT <intersect1,2> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 (/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) intersect all (/* select#2 */ select `test`.`t2`.`c` AS `c`,`test`.`t3`.`e` AS `e` from `test`.`t2` join `test`.`t3`)
+EXPLAIN extended select * from ((select a,b from t1) intersect all (select c,e from t2,t3)) a;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 6 100.00
+2 DERIVED t1 ALL NULL NULL NULL NULL 6 100.00
+3 INTERSECT t3 ALL NULL NULL NULL NULL 5 100.00
+3 INTERSECT t2 ALL NULL NULL NULL NULL 7 100.00 Using join buffer (flat, BNL join)
+NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 /* select#1 */ select `a`.`a` AS `a`,`a`.`b` AS `b` from ((/* select#2 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) intersect all (/* select#3 */ select `test`.`t2`.`c` AS `c`,`test`.`t3`.`e` AS `e` from `test`.`t2` join `test`.`t3`)) `a`
+EXPLAIN format=json (select a,b from t1) intersect all (select c,e from t2,t3);
+EXPLAIN
+{
+ "query_block": {
+ "union_result": {
+ "table_name": "<intersect1,2>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 6,
+ "filtered": 100
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 2,
+ "operation": "INTERSECT",
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 7,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "65",
+ "join_type": "BNL"
+ }
+ }
+ }
+ ]
+ }
+ }
+}
+ANALYZE format=json (select a,b from t1) intersect all (select c,e from t2,t3);
+ANALYZE
+{
+ "query_block": {
+ "union_result": {
+ "table_name": "<intersect1,2>",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "r_rows": 3,
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 1,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 6,
+ "r_rows": 6,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 2,
+ "operation": "INTERSECT",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 5,
+ "r_rows": 5,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "t2",
+ "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": "65",
+ "join_type": "BNL",
+ "r_filtered": 100
+ }
+ }
+ }
+ ]
+ }
+ }
+}
+ANALYZE format=json select * from ((select a,b from t1) intersect all (select c,e from t2,t3)) a;
+ANALYZE
+{
+ "query_block": {
+ "select_id": 1,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 6,
+ "r_rows": 3,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<intersect2,3>",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "r_rows": 3,
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 6,
+ "r_rows": 6,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "INTERSECT",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 5,
+ "r_rows": 5,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "t2",
+ "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": "65",
+ "join_type": "BNL",
+ "r_filtered": 100
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+}
+select * from ((select a,b from t1) intersect all (select c,e from t2,t3)) a;
+a b
+2 2
+2 2
+2 2
+prepare stmt from "(select a,b from t1) intersect all (select c,e from t2,t3);";
+execute stmt;
+a b
+2 2
+2 2
+2 2
+execute stmt;
+a b
+2 2
+2 2
+2 2
+prepare stmt from "select * from ((select a,b from t1) intersect all (select c,e from t2,t3)) a";
+execute stmt;
+a b
+2 2
+2 2
+2 2
+execute stmt;
+a b
+2 2
+2 2
+2 2
+drop tables t1,t2,t3;
+select 1 as a from dual intersect all select 1 from dual;
+a
+1
+(select 1 from dual) intersect all (select 1 from dual);
+1
+1
+(select 1 from dual into @v) intersect all (select 1 from dual);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'into @v) intersect all (select 1 from dual)' at line 1
+select 1 from dual ORDER BY 1 intersect all select 1 from dual;
+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 'intersect all select 1 from dual' at line 1
+select 1 as a from dual union all select 1 from dual;
+a
+1
+1
+create table t1 (a int, b blob, a1 int, b1 blob);
+create table t2 (c int, d blob, c1 int, d1 blob);
+insert into t1 values (1,"ddd", 1, "sdfrrwwww"),(2, "fgh", 2, "dffggtt"),(2, "fgh", 2, "dffggtt");
+insert into t2 values (2, "fgh", 2, "dffggtt"),(3, "ffggddd", 3, "dfgg"),(2, "fgh", 2, "dffggtt");
+(select a,b,b1 from t1) intersect all (select c,d,d1 from t2);
+a b b1
+2 fgh dffggtt
+2 fgh dffggtt
+drop tables t1,t2;
+create table t1 (a int, b blob) engine=MyISAM;
+create table t2 (c int, d blob) engine=MyISAM;
+create table t3 (e int, f blob) engine=MyISAM;
+insert into t1 values (1,1),(2,2),(3,3),(2,2),(3,3);
+insert into t2 values (2,2),(3,3),(4,4),(2,2),(2,2),(2,2);
+insert into t3 values (1,1),(2,2),(5,5),(2,2),(5,5);
+(select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3);
+a b
+2 2
+2 2
+select * from ((select a,b from t1) intersect all (select c,d from t2) intersect (select e,f from t3)) a;
+a b
+2 2
+prepare stmt from "(select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3);";
+execute stmt;
+a b
+2 2
+2 2
+execute stmt;
+a b
+2 2
+2 2
+prepare stmt from "select * from ((select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3)) a";
+execute stmt;
+a b
+2 2
+2 2
+execute stmt;
+a b
+2 2
+2 2
+create table t4 (select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3);
+show create table t4;
+Table Create Table
+t4 CREATE TABLE `t4` (
+ `a` int(11) DEFAULT NULL,
+ `b` blob DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop tables t4;
+(select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3) union all (select 4,4);
+a b
+4 4
+2 2
+2 2
+(select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3) union all (select 4,4) except all (select 2,2);
+a b
+4 4
+2 2
+drop tables t1,t2,t3;
+create table t1 (a int, b int);
+create table t2 (c int, d int);
+create table t3 (e int, f int);
+insert into t1 values (1,1),(2,2),(3,3),(2,2),(3,3);
+insert into t2 values (2,2),(3,3),(4,4),(2,2),(2,2),(2,2);
+insert into t3 values (1,1),(2,2),(5,5),(2,2),(5,5);
+(select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3) union all (select 4,4);
+a b
+4 4
+2 2
+2 2
+(select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3) union all (select 4,4) except all (select 2,2);
+a b
+4 4
+2 2
+drop tables t1,t2,t3;
+#
+# INTERSECT precedence
+#
+create table t1 (a int, b blob) engine=MyISAM;
+create table t2 (c int, d blob) engine=MyISAM;
+create table t3 (e int, f blob) engine=MyISAM;
+insert into t1 values (5,5),(6,6);
+insert into t2 values (2,2),(3,3);
+insert into t3 values (1,1),(3,3);
+(select a,b from t1) union all (select c,d from t2) intersect (select e,f from t3) union all (select 4,4);
+a b
+5 5
+6 6
+3 3
+4 4
+(select a,b from t1) union all (select c,d from t2) intersect all (select e,f from t3) union all (select 4,4);
+a b
+5 5
+6 6
+3 3
+4 4
+explain extended (select a,b from t1) union all (select c,d from t2) intersect all (select e,f from t3) union all (select 4,4);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
+5 UNION <derived2> ALL NULL NULL NULL NULL 2 100.00
+2 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00
+3 INTERSECT t3 ALL NULL NULL NULL NULL 2 100.00
+NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL NULL
+4 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 (/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) union all /* select#5 */ select `__5`.`c` AS `c`,`__5`.`d` AS `d` from ((/* select#2 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`) intersect all (/* select#3 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3`)) `__5` union all (/* select#4 */ select 4 AS `4`,4 AS `4`)
+insert into t2 values (3,3);
+insert into t3 values (3,3);
+(select e,f from t3) intersect all (select c,d from t2) union all (select a,b from t1) union all (select 4,4);
+e f
+3 3
+3 3
+5 5
+6 6
+4 4
+explain extended (select e,f from t3) intersect all (select c,d from t2) union all (select a,b from t1) union all (select 4,4);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
+2 INTERSECT t2 ALL NULL NULL NULL NULL 3 100.00
+3 UNION t1 ALL NULL NULL NULL NULL 2 100.00
+4 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+NULL UNIT RESULT <unit1,2,3,4> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 (/* select#1 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3`) intersect all (/* select#2 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`) union all (/* select#3 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) union all (/* select#4 */ select 4 AS `4`,4 AS `4`)
+(/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) union /* select#3 */ select `__3`.`c` AS `c`,`__3`.`d` AS `d` from ((/* select#2 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`) intersect all (/* select#4 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3`)) `__3` union (/* select#5 */ select 4 AS `4`,4 AS `4`);
+a b
+5 5
+6 6
+3 3
+4 4
+prepare stmt from "(select a,b from t1) union all (select c,d from t2) intersect all (select e,f from t3) union all (select 4,4)";
+execute stmt;
+a b
+5 5
+6 6
+3 3
+3 3
+4 4
+execute stmt;
+a b
+5 5
+6 6
+3 3
+3 3
+4 4
+create view v1 as (select a,b from t1) union all (select c,d from t2) intersect all (select e,f from t3) union all (select 4,4);
+select b,a,b+1 from v1;
+b a b+1
+5 5 6
+6 6 7
+3 3 4
+3 3 4
+4 4 5
+select b,a,b+1 from v1 where a > 3;
+b a b+1
+5 5 6
+6 6 7
+4 4 5
+create procedure p1()
+select * from v1;
+call p1();
+a b
+5 5
+6 6
+3 3
+3 3
+4 4
+call p1();
+a b
+5 5
+6 6
+3 3
+3 3
+4 4
+drop procedure p1;
+create procedure p1()
+(select a,b from t1) union all (select c,d from t2) intersect all (select e,f from t3) union all (select 4,4);
+call p1();
+a b
+5 5
+6 6
+3 3
+3 3
+4 4
+call p1();
+a b
+5 5
+6 6
+3 3
+3 3
+4 4
+drop procedure p1;
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) union all select `__6`.`c` AS `c`,`__6`.`d` AS `d` from ((select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`) intersect all (select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3`)) `__6` union all (select 4 AS `4`,4 AS `4`) latin1 latin1_swedish_ci
+drop view v1;
+drop tables t1,t2,t3;
+CREATE TABLE t (i INT);
+INSERT INTO t VALUES (1),(2);
+SELECT * FROM t WHERE i != ANY ( SELECT 6 INTERSECT ALL SELECT 3 );
+i
+select i from t where
+exists ((select 6 as r from dual having t.i <> 6)
+intersect all
+(select 3 from dual having t.i <> 3));
+i
+drop table t;
+CREATE TABLE t1 (a varchar(32)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES
+('Jakarta'),('Lisbon'),('Honolulu'),('Lusaka'),('Barcelona'),('Taipei'),
+('Brussels'),('Orlando'),('Osaka'),('Quito'),('Lima'),('Tunis'),
+('Unalaska'),('Rotterdam'),('Zagreb'),('Ufa'),('Ryazan'),('Xiamen'),
+('London'),('Izmir'),('Samara'),('Bern'),('Zhengzhou'),('Vladivostok'),
+('Yangon'),('Victoria'),('Warsaw'),('Luanda'),('Leon'),('Bangkok'),
+('Wellington'),('Zibo'),('Qiqihar'),('Delhi'),('Hamburg'),('Ottawa'),
+('Vaduz');
+CREATE TABLE t2 (b varchar(32)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES
+('Gaza'),('Jeddah'),('Beirut'),('Incheon'),('Tbilisi'),('Izmir'),
+('Quito'),('Riga'),('Freetown'),('Zagreb'),('Caracas'),('Orlando'),
+('Kingston'),('Turin'),('Xinyang'),('Osaka'),('Albany'),('Geneva'),
+('Omsk'),('Kazan'),('Quezon'),('Indore'),('Odessa'),('Xiamen'),
+('Winnipeg'),('Yakutsk'),('Nairobi'),('Ufa'),('Helsinki'),('Vilnius'),
+('Aden'),('Liverpool'),('Honolulu'),('Frankfurt'),('Glasgow'),
+('Vienna'),('Jackson'),('Jakarta'),('Sydney'),('Oslo'),('Novgorod'),
+('Norilsk'),('Izhevsk'),('Istanbul'),('Nice');
+CREATE TABLE t3 (c varchar(32)) ENGINE=MyISAM;
+INSERT INTO t3 VALUES
+('Nicosia'),('Istanbul'),('Richmond'),('Stockholm'),('Dublin'),
+('Wichita'),('Warsaw'),('Glasgow'),('Winnipeg'),('Irkutsk'),('Quito'),
+('Xiamen'),('Berlin'),('Rome'),('Denver'),('Dallas'),('Kabul'),
+('Prague'),('Izhevsk'),('Tirana'),('Sofia'),('Detroit'),('Sorbonne');
+select count(*) from (
+SELECT * FROM t1 LEFT OUTER JOIN t2 LEFT OUTER JOIN t3 ON b < c ON a > b
+INTERSECT
+SELECT * FROM t1 LEFT OUTER JOIN t2 LEFT OUTER JOIN t3 ON b < c ON a > b
+) a;
+count(*)
+14848
+select count(*) from (
+SELECT * FROM t1 LEFT OUTER JOIN t2 LEFT OUTER JOIN t3 ON b < c ON a > b
+INTERSECT ALL
+SELECT * FROM t1 LEFT OUTER JOIN t2 LEFT OUTER JOIN t3 ON b < c ON a > b
+) a;
+count(*)
+14848
+insert into t1 values ('Xiamen');
+insert into t2 values ('Xiamen'),('Xiamen');
+insert into t3 values ('Xiamen');
+select count(*) from (
+SELECT * FROM t1 LEFT OUTER JOIN t2 LEFT OUTER JOIN t3 ON b < c ON a > b
+INTERSECT ALL
+SELECT * FROM t1 LEFT OUTER JOIN t2 LEFT OUTER JOIN t3 ON b < c ON a > b
+) a;
+count(*)
+16430
+drop table t1,t2,t3;
+CREATE TABLE t1 (a varchar(32) not null) ENGINE=MyISAM;
+INSERT INTO t1 VALUES
+('Jakarta'),('Lisbon'),('Honolulu'),('Lusaka'),('Barcelona'),('Taipei'),
+('Brussels'),('Orlando'),('Osaka'),('Quito'),('Lima'),('Tunis'),
+('Unalaska'),('Rotterdam'),('Zagreb'),('Ufa'),('Ryazan'),('Xiamen'),
+('London'),('Izmir'),('Samara'),('Bern'),('Zhengzhou'),('Vladivostok'),
+('Yangon'),('Victoria'),('Warsaw'),('Luanda'),('Leon'),('Bangkok'),
+('Wellington'),('Zibo'),('Qiqihar'),('Delhi'),('Hamburg'),('Ottawa'),
+('Vaduz'),('Detroit'),('Detroit');
+CREATE TABLE t2 (b varchar(32) not null) ENGINE=MyISAM;
+INSERT INTO t2 VALUES
+('Gaza'),('Jeddah'),('Beirut'),('Incheon'),('Tbilisi'),('Izmir'),
+('Quito'),('Riga'),('Freetown'),('Zagreb'),('Caracas'),('Orlando'),
+('Kingston'),('Turin'),('Xinyang'),('Osaka'),('Albany'),('Geneva'),
+('Omsk'),('Kazan'),('Quezon'),('Indore'),('Odessa'),('Xiamen'),
+('Winnipeg'),('Yakutsk'),('Nairobi'),('Ufa'),('Helsinki'),('Vilnius'),
+('Aden'),('Liverpool'),('Honolulu'),('Frankfurt'),('Glasgow'),
+('Vienna'),('Jackson'),('Jakarta'),('Sydney'),('Oslo'),('Novgorod'),
+('Norilsk'),('Izhevsk'),('Istanbul'),('Nice'),('Detroit'),('Detroit');
+CREATE TABLE t3 (c varchar(32) not null) ENGINE=MyISAM;
+INSERT INTO t3 VALUES
+('Nicosia'),('Istanbul'),('Richmond'),('Stockholm'),('Dublin'),
+('Wichita'),('Warsaw'),('Glasgow'),('Winnipeg'),('Irkutsk'),('Quito'),
+('Xiamen'),('Berlin'),('Rome'),('Denver'),('Dallas'),('Kabul'),
+('Prague'),('Izhevsk'),('Tirana'),('Sofia'),('Detroit'),('Sorbonne'),
+('Detroit');
+select count(*) from (
+SELECT * FROM t1 LEFT OUTER JOIN t2 LEFT OUTER JOIN t3 ON b < c ON a > b
+INTERSECT
+SELECT * FROM t1 LEFT OUTER JOIN t2 LEFT OUTER JOIN t3 ON b < c ON a > b
+) a;
+count(*)
+15547
+drop table t1,t2,t3;
+create table t12(c1 int);
+insert into t12 values(1);
+insert into t12 values(2);
+create table t13(c1 int);
+insert into t13 values(1);
+insert into t13 values(3);
+create table t234(c1 int);
+insert into t234 values(2);
+insert into t234 values(3);
+insert into t234 values(4);
+select * from t13 union select * from t234 intersect all select * from t12;
+c1
+1
+3
+2
+drop table t12,t13,t234;
+create table t1 (a int);
+insert into t1 values (3), (1), (7), (3), (2), (7), (4);
+create table t2 (a int);
+insert into t2 values (4), (5), (9), (1), (8), (9), (2), (2);
+create table t3 (a int);
+insert into t3 values (8), (1), (8), (2), (3), (7), (2);
+select * from t1 where a > 4
+union all
+select * from t2 where a < 5
+intersect all
+select * from t3 where a < 5;
+a
+7
+7
+2
+1
+2
+explain extended
+select * from t1 where a > 4
+union all
+select * from t2 where a < 5
+intersect all
+select * from t3 where a < 5;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 7 100.00 Using where
+4 UNION <derived2> ALL NULL NULL NULL NULL 7 100.00
+2 DERIVED t2 ALL NULL NULL NULL NULL 8 100.00 Using where
+3 INTERSECT t3 ALL NULL NULL NULL NULL 7 100.00 Using where
+NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 4 union all /* select#4 */ select `__4`.`a` AS `a` from (/* select#2 */ select `test`.`t2`.`a` AS `a` from `test`.`t2` where `test`.`t2`.`a` < 5 intersect all /* select#3 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where `test`.`t3`.`a` < 5) `__4`
+drop table t1,t2,t3;
diff --git a/mysql-test/main/intersect_all.test b/mysql-test/main/intersect_all.test
new file mode 100644
index 00000000000..5d2b038fde9
--- /dev/null
+++ b/mysql-test/main/intersect_all.test
@@ -0,0 +1,328 @@
+create table t1 (a int, b int) engine=MyISAM;
+create table t2 (c int, d int) engine=MyISAM;
+insert into t1 values (1,1),(2,2),(3,3),(2,2);
+insert into t2 values (2,2),(2,2),(5,5);
+
+select * from t1 intersect all select * from t2;
+(select a,b from t1) intersect all (select c,d from t2);
+select * from ((select a,b from t1) intersect all (select c,d from t2)) t;
+select * from ((select a from t1) intersect all (select c from t2)) t;
+
+drop tables t1,t2;
+
+create table t1 (a int, b int) engine=MyISAM;
+create table t2 (c int, d int) engine=MyISAM;
+create table t3 (e int, f int) engine=MyISAM;
+insert into t1 values (1,1),(2,2),(3,3),(2,2);
+insert into t2 values (2,2),(3,3),(4,4),(2,2);
+insert into t3 values (1,1),(2,2),(5,5),(2,2);
+
+(select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3);
+
+EXPLAIN (select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3);
+EXPLAIN extended (select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3);
+EXPLAIN extended select * from ((select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3)) a;
+EXPLAIN format=json (select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3);
+--source include/analyze-format.inc
+ANALYZE format=json (select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3);
+--source include/analyze-format.inc
+ANALYZE format=json select * from ((select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3)) a;
+select * from ((select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3)) a;
+
+prepare stmt from "(select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3);";
+execute stmt;
+execute stmt;
+
+prepare stmt from "select * from ((select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3)) a";
+execute stmt;
+execute stmt;
+
+insert into t1 values (2,2),(3,3);
+insert into t2 values (2,2),(2,2),(2,2);
+(select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3);
+(select a,b from t1) intersect (select c,d from t2) intersect all (select e,f from t3);
+
+insert into t3 values (2,2);
+(select a,b from t1) intersect all (select c,d from t2) intersect (select e,f from t3);
+
+(select a,b from t1) intersect all (select c,e from t2,t3);
+
+EXPLAIN (select a,b from t1) intersect all (select c,e from t2,t3);
+EXPLAIN extended (select a,b from t1) intersect all (select c,e from t2,t3);
+EXPLAIN extended select * from ((select a,b from t1) intersect all (select c,e from t2,t3)) a;
+EXPLAIN format=json (select a,b from t1) intersect all (select c,e from t2,t3);
+--source include/analyze-format.inc
+ANALYZE format=json (select a,b from t1) intersect all (select c,e from t2,t3);
+--source include/analyze-format.inc
+ANALYZE format=json select * from ((select a,b from t1) intersect all (select c,e from t2,t3)) a;
+select * from ((select a,b from t1) intersect all (select c,e from t2,t3)) a;
+
+prepare stmt from "(select a,b from t1) intersect all (select c,e from t2,t3);";
+execute stmt;
+execute stmt;
+
+prepare stmt from "select * from ((select a,b from t1) intersect all (select c,e from t2,t3)) a";
+execute stmt;
+execute stmt;
+
+drop tables t1,t2,t3;
+
+select 1 as a from dual intersect all select 1 from dual;
+(select 1 from dual) intersect all (select 1 from dual);
+--error ER_PARSE_ERROR
+(select 1 from dual into @v) intersect all (select 1 from dual);
+--error ER_PARSE_ERROR
+select 1 from dual ORDER BY 1 intersect all select 1 from dual;
+select 1 as a from dual union all select 1 from dual;
+
+create table t1 (a int, b blob, a1 int, b1 blob);
+create table t2 (c int, d blob, c1 int, d1 blob);
+insert into t1 values (1,"ddd", 1, "sdfrrwwww"),(2, "fgh", 2, "dffggtt"),(2, "fgh", 2, "dffggtt");
+insert into t2 values (2, "fgh", 2, "dffggtt"),(3, "ffggddd", 3, "dfgg"),(2, "fgh", 2, "dffggtt");
+
+(select a,b,b1 from t1) intersect all (select c,d,d1 from t2);
+
+drop tables t1,t2;
+
+create table t1 (a int, b blob) engine=MyISAM;
+create table t2 (c int, d blob) engine=MyISAM;
+create table t3 (e int, f blob) engine=MyISAM;
+insert into t1 values (1,1),(2,2),(3,3),(2,2),(3,3);
+insert into t2 values (2,2),(3,3),(4,4),(2,2),(2,2),(2,2);
+insert into t3 values (1,1),(2,2),(5,5),(2,2),(5,5);
+
+(select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3);
+select * from ((select a,b from t1) intersect all (select c,d from t2) intersect (select e,f from t3)) a;
+
+prepare stmt from "(select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3);";
+execute stmt;
+execute stmt;
+
+prepare stmt from "select * from ((select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3)) a";
+execute stmt;
+execute stmt;
+
+# make sure that blob is used
+create table t4 (select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3);
+show create table t4;
+drop tables t4;
+
+
+(select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3) union all (select 4,4);
+
+(select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3) union all (select 4,4) except all (select 2,2);
+
+drop tables t1,t2,t3;
+
+create table t1 (a int, b int);
+create table t2 (c int, d int);
+create table t3 (e int, f int);
+insert into t1 values (1,1),(2,2),(3,3),(2,2),(3,3);
+insert into t2 values (2,2),(3,3),(4,4),(2,2),(2,2),(2,2);
+insert into t3 values (1,1),(2,2),(5,5),(2,2),(5,5);
+
+
+(select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3) union all (select 4,4);
+
+(select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3) union all (select 4,4) except all (select 2,2);
+
+drop tables t1,t2,t3;
+
+--echo #
+--echo # INTERSECT precedence
+--echo #
+create table t1 (a int, b blob) engine=MyISAM;
+create table t2 (c int, d blob) engine=MyISAM;
+create table t3 (e int, f blob) engine=MyISAM;
+insert into t1 values (5,5),(6,6);
+insert into t2 values (2,2),(3,3);
+insert into t3 values (1,1),(3,3);
+
+
+
+(select a,b from t1) union all (select c,d from t2) intersect (select e,f from t3) union all (select 4,4);
+
+(select a,b from t1) union all (select c,d from t2) intersect all (select e,f from t3) union all (select 4,4);
+explain extended (select a,b from t1) union all (select c,d from t2) intersect all (select e,f from t3) union all (select 4,4);
+
+# test result of linear mix operation
+insert into t2 values (3,3);
+insert into t3 values (3,3);
+
+(select e,f from t3) intersect all (select c,d from t2) union all (select a,b from t1) union all (select 4,4);
+explain extended (select e,f from t3) intersect all (select c,d from t2) union all (select a,b from t1) union all (select 4,4);
+
+
+(/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) union /* select#3 */ select `__3`.`c` AS `c`,`__3`.`d` AS `d` from ((/* select#2 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`) intersect all (/* select#4 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3`)) `__3` union (/* select#5 */ select 4 AS `4`,4 AS `4`);
+
+prepare stmt from "(select a,b from t1) union all (select c,d from t2) intersect all (select e,f from t3) union all (select 4,4)";
+
+execute stmt;
+
+execute stmt;
+
+create view v1 as (select a,b from t1) union all (select c,d from t2) intersect all (select e,f from t3) union all (select 4,4);
+
+
+select b,a,b+1 from v1;
+
+select b,a,b+1 from v1 where a > 3;
+
+create procedure p1()
+ select * from v1;
+
+call p1();
+
+call p1();
+drop procedure p1;
+
+create procedure p1()
+ (select a,b from t1) union all (select c,d from t2) intersect all (select e,f from t3) union all (select 4,4);
+
+call p1();
+
+call p1();
+drop procedure p1;
+
+show create view v1;
+
+drop view v1;
+drop tables t1,t2,t3;
+
+CREATE TABLE t (i INT);
+INSERT INTO t VALUES (1),(2);
+SELECT * FROM t WHERE i != ANY ( SELECT 6 INTERSECT ALL SELECT 3 );
+
+select i from t where
+ exists ((select 6 as r from dual having t.i <> 6)
+ intersect all
+ (select 3 from dual having t.i <> 3));
+
+drop table t;
+
+CREATE TABLE t1 (a varchar(32)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES
+('Jakarta'),('Lisbon'),('Honolulu'),('Lusaka'),('Barcelona'),('Taipei'),
+('Brussels'),('Orlando'),('Osaka'),('Quito'),('Lima'),('Tunis'),
+('Unalaska'),('Rotterdam'),('Zagreb'),('Ufa'),('Ryazan'),('Xiamen'),
+('London'),('Izmir'),('Samara'),('Bern'),('Zhengzhou'),('Vladivostok'),
+('Yangon'),('Victoria'),('Warsaw'),('Luanda'),('Leon'),('Bangkok'),
+('Wellington'),('Zibo'),('Qiqihar'),('Delhi'),('Hamburg'),('Ottawa'),
+('Vaduz');
+
+CREATE TABLE t2 (b varchar(32)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES
+('Gaza'),('Jeddah'),('Beirut'),('Incheon'),('Tbilisi'),('Izmir'),
+('Quito'),('Riga'),('Freetown'),('Zagreb'),('Caracas'),('Orlando'),
+('Kingston'),('Turin'),('Xinyang'),('Osaka'),('Albany'),('Geneva'),
+('Omsk'),('Kazan'),('Quezon'),('Indore'),('Odessa'),('Xiamen'),
+('Winnipeg'),('Yakutsk'),('Nairobi'),('Ufa'),('Helsinki'),('Vilnius'),
+('Aden'),('Liverpool'),('Honolulu'),('Frankfurt'),('Glasgow'),
+('Vienna'),('Jackson'),('Jakarta'),('Sydney'),('Oslo'),('Novgorod'),
+('Norilsk'),('Izhevsk'),('Istanbul'),('Nice');
+
+CREATE TABLE t3 (c varchar(32)) ENGINE=MyISAM;
+INSERT INTO t3 VALUES
+('Nicosia'),('Istanbul'),('Richmond'),('Stockholm'),('Dublin'),
+('Wichita'),('Warsaw'),('Glasgow'),('Winnipeg'),('Irkutsk'),('Quito'),
+('Xiamen'),('Berlin'),('Rome'),('Denver'),('Dallas'),('Kabul'),
+('Prague'),('Izhevsk'),('Tirana'),('Sofia'),('Detroit'),('Sorbonne');
+
+select count(*) from (
+ SELECT * FROM t1 LEFT OUTER JOIN t2 LEFT OUTER JOIN t3 ON b < c ON a > b
+ INTERSECT
+ SELECT * FROM t1 LEFT OUTER JOIN t2 LEFT OUTER JOIN t3 ON b < c ON a > b
+) a;
+
+select count(*) from (
+ SELECT * FROM t1 LEFT OUTER JOIN t2 LEFT OUTER JOIN t3 ON b < c ON a > b
+ INTERSECT ALL
+ SELECT * FROM t1 LEFT OUTER JOIN t2 LEFT OUTER JOIN t3 ON b < c ON a > b
+) a;
+
+insert into t1 values ('Xiamen');
+insert into t2 values ('Xiamen'),('Xiamen');
+insert into t3 values ('Xiamen');
+select count(*) from (
+ SELECT * FROM t1 LEFT OUTER JOIN t2 LEFT OUTER JOIN t3 ON b < c ON a > b
+ INTERSECT ALL
+ SELECT * FROM t1 LEFT OUTER JOIN t2 LEFT OUTER JOIN t3 ON b < c ON a > b
+) a;
+
+drop table t1,t2,t3;
+
+CREATE TABLE t1 (a varchar(32) not null) ENGINE=MyISAM;
+INSERT INTO t1 VALUES
+('Jakarta'),('Lisbon'),('Honolulu'),('Lusaka'),('Barcelona'),('Taipei'),
+('Brussels'),('Orlando'),('Osaka'),('Quito'),('Lima'),('Tunis'),
+('Unalaska'),('Rotterdam'),('Zagreb'),('Ufa'),('Ryazan'),('Xiamen'),
+('London'),('Izmir'),('Samara'),('Bern'),('Zhengzhou'),('Vladivostok'),
+('Yangon'),('Victoria'),('Warsaw'),('Luanda'),('Leon'),('Bangkok'),
+('Wellington'),('Zibo'),('Qiqihar'),('Delhi'),('Hamburg'),('Ottawa'),
+('Vaduz'),('Detroit'),('Detroit');
+
+CREATE TABLE t2 (b varchar(32) not null) ENGINE=MyISAM;
+INSERT INTO t2 VALUES
+('Gaza'),('Jeddah'),('Beirut'),('Incheon'),('Tbilisi'),('Izmir'),
+('Quito'),('Riga'),('Freetown'),('Zagreb'),('Caracas'),('Orlando'),
+('Kingston'),('Turin'),('Xinyang'),('Osaka'),('Albany'),('Geneva'),
+('Omsk'),('Kazan'),('Quezon'),('Indore'),('Odessa'),('Xiamen'),
+('Winnipeg'),('Yakutsk'),('Nairobi'),('Ufa'),('Helsinki'),('Vilnius'),
+('Aden'),('Liverpool'),('Honolulu'),('Frankfurt'),('Glasgow'),
+('Vienna'),('Jackson'),('Jakarta'),('Sydney'),('Oslo'),('Novgorod'),
+('Norilsk'),('Izhevsk'),('Istanbul'),('Nice'),('Detroit'),('Detroit');
+
+CREATE TABLE t3 (c varchar(32) not null) ENGINE=MyISAM;
+INSERT INTO t3 VALUES
+('Nicosia'),('Istanbul'),('Richmond'),('Stockholm'),('Dublin'),
+('Wichita'),('Warsaw'),('Glasgow'),('Winnipeg'),('Irkutsk'),('Quito'),
+('Xiamen'),('Berlin'),('Rome'),('Denver'),('Dallas'),('Kabul'),
+('Prague'),('Izhevsk'),('Tirana'),('Sofia'),('Detroit'),('Sorbonne'),
+('Detroit');
+
+select count(*) from (
+ SELECT * FROM t1 LEFT OUTER JOIN t2 LEFT OUTER JOIN t3 ON b < c ON a > b
+ INTERSECT
+ SELECT * FROM t1 LEFT OUTER JOIN t2 LEFT OUTER JOIN t3 ON b < c ON a > b
+) a;
+
+drop table t1,t2,t3;
+
+create table t12(c1 int);
+insert into t12 values(1);
+insert into t12 values(2);
+create table t13(c1 int);
+insert into t13 values(1);
+insert into t13 values(3);
+create table t234(c1 int);
+insert into t234 values(2);
+insert into t234 values(3);
+insert into t234 values(4);
+
+
+select * from t13 union select * from t234 intersect all select * from t12;
+
+drop table t12,t13,t234;
+
+create table t1 (a int);
+insert into t1 values (3), (1), (7), (3), (2), (7), (4);
+create table t2 (a int);
+insert into t2 values (4), (5), (9), (1), (8), (9), (2), (2);
+create table t3 (a int);
+insert into t3 values (8), (1), (8), (2), (3), (7), (2);
+
+
+select * from t1 where a > 4
+union all
+select * from t2 where a < 5
+intersect all
+select * from t3 where a < 5;
+
+explain extended
+select * from t1 where a > 4
+union all
+select * from t2 where a < 5
+intersect all
+select * from t3 where a < 5;
+
+drop table t1,t2,t3; \ No newline at end of file
diff --git a/mysql-test/main/myisam_icp.result b/mysql-test/main/myisam_icp.result
index 0fdc3f11627..bf636197652 100644
--- a/mysql-test/main/myisam_icp.result
+++ b/mysql-test/main/myisam_icp.result
@@ -428,9 +428,9 @@ EXPLAIN
SELECT * FROM t1
WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON it.i=it.i WHERE it.pk-t1.i<10);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where
-2 DEPENDENT SUBQUERY it eq_ref PRIMARY PRIMARY 4 func 1 Using index condition
-2 DEPENDENT SUBQUERY t2 index NULL PRIMARY 4 NULL 3 Using index; Using join buffer (flat, BNL join)
+1 PRIMARY t1 ALL NULL NULL NULL NULL # Using where
+2 DEPENDENT SUBQUERY it eq_ref PRIMARY PRIMARY 4 func # Using index condition
+2 DEPENDENT SUBQUERY t2 index NULL PRIMARY 4 NULL # Using index; Using join buffer (flat, BNL join)
SELECT * FROM t1
WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON it.i=it.i WHERE it.pk-t1.i<10);
pk i
diff --git a/mysql-test/main/mysqld--help.result b/mysql-test/main/mysqld--help.result
index 5e20172f5ef..c55f535cd35 100644
--- a/mysql-test/main/mysqld--help.result
+++ b/mysql-test/main/mysqld--help.result
@@ -40,7 +40,7 @@ The following specify which files/extra groups are read (specified before remain
--big-tables Old variable, which if set to 1, allows large result sets
by saving all temporary sets to disk, avoiding 'table
full' errors. No longer needed, as the server now handles
- this automatically. sql_big_tables is a synonym.
+ this automatically.
--bind-address=name IP address to bind to.
--binlog-annotate-row-events
Tells the master to annotate RBR events with the
@@ -114,6 +114,12 @@ The following specify which files/extra groups are read (specified before remain
the table) is logged in the before image, and only
changed columns are logged in the after image. (Default:
FULL).
+ --binlog-row-metadata=name
+ Controls whether metadata is logged using FULL , MINIMAL
+ format and NO_LOG.FULL causes all metadata to be logged;
+ MINIMAL means that only metadata actually required by
+ slave is logged; NO_LOG NO metadata will be
+ logged.Default: NO_LOG.
--binlog-stmt-cache-size=#
The size of the statement cache for updates to
non-transactional engines for the binary log. If you
@@ -561,10 +567,6 @@ The following specify which files/extra groups are read (specified before remain
max_join_size records return an error
--max-length-for-sort-data=#
Max number of bytes in sorted records
- --max-long-data-size=#
- The maximum BLOB length to send to server from
- mysql_send_long_data API. Deprecated option; use
- max_allowed_packet instead.
--max-password-errors=#
If there is more than this number of failed connect
attempts due to invalid password, user will be blocked
@@ -714,7 +716,7 @@ The following specify which files/extra groups are read (specified before remain
extended_keys, exists_to_in, orderby_uses_equalities,
condition_pushdown_for_derived, split_materialized,
condition_pushdown_for_subquery, rowid_filter,
- condition_pushdown_from_having
+ condition_pushdown_from_having, not_null_range_scan
--optimizer-trace=name
Controls tracing of the Optimizer:
optimizer_trace=option=val[,option=val...], where option
@@ -1111,6 +1113,8 @@ The following specify which files/extra groups are read (specified before remain
characteristics (isolation level, read only/read
write,snapshot - but not any work done / data modified
within the transaction).
+ --session-track-user-variables
+ Track changes to user variables.
--show-slave-auth-info
Show user and password in SHOW SLAVE HOSTS on this
master.
@@ -1324,6 +1328,11 @@ The following specify which files/extra groups are read (specified before remain
--thread-cache-size=#
How many threads we should keep in a cache for reuse.
These are freed after 5 minutes of idle time
+ --thread-pool-dedicated-listener
+ If set to 1,listener thread will not pick up queries
+ --thread-pool-exact-stats
+ If set to 1, provides better statistics in
+ information_schema threadpool tables
--thread-pool-idle-timeout=#
Timeout in seconds for an idle thread in the thread
pool.Worker thread will be shut down after timeout
@@ -1428,6 +1437,7 @@ binlog-format MIXED
binlog-optimize-thread-scheduling TRUE
binlog-row-event-max-size 8192
binlog-row-image FULL
+binlog-row-metadata NO_LOG
binlog-stmt-cache-size 32768
bulk-insert-buffer-size 8388608
character-set-client-handshake TRUE
@@ -1557,7 +1567,6 @@ max-error-count 64
max-heap-table-size 16777216
max-join-size 18446744073709551615
max-length-for-sort-data 1024
-max-long-data-size 16777216
max-password-errors 18446744073709551615
max-prepared-stmt-count 16382
max-recursive-iterations 18446744073709551615
@@ -1700,6 +1709,7 @@ session-track-schema TRUE
session-track-state-change FALSE
session-track-system-variables autocommit,character_set_client,character_set_connection,character_set_results,time_zone
session-track-transaction-info OFF
+session-track-user-variables FALSE
show-slave-auth-info FALSE
silent-startup FALSE
skip-grant-tables TRUE
@@ -1751,6 +1761,8 @@ tcp-keepalive-probes 0
tcp-keepalive-time 0
tcp-nodelay TRUE
thread-cache-size 151
+thread-pool-dedicated-listener FALSE
+thread-pool-exact-stats FALSE
thread-pool-idle-timeout 60
thread-pool-max-threads 65536
thread-pool-oversubscribe 3
diff --git a/mysql-test/main/mysqld--help.test b/mysql-test/main/mysqld--help.test
index 23bf7601e06..dcca6a75bca 100644
--- a/mysql-test/main/mysqld--help.test
+++ b/mysql-test/main/mysqld--help.test
@@ -26,13 +26,14 @@ perl;
collation-server character-set-server log-tc-size tls-version version.*/;
# Plugins which may or may not be there:
- @plugins=qw/innodb archive blackhole federated partition
+ @plugins=qw/innodb archive blackhole federated partition s3
feedback debug temp-pool ssl des-key-file xtradb sequence
thread-concurrency super-large-pages mutex-deadlock-detector
connect null-audit aria oqgraph sphinx thread-handling
test-sql-discovery query-cache-info
query-response-time metadata-lock-info locales unix-socket
- wsrep file-key-management cracklib-password-check user-variables/;
+ wsrep file-key-management cracklib-password-check user-variables
+ thread-pool-groups thread-pool-queues thread-pool-stats thread-pool-waits/;
# And substitute the content some environment variables with their
# names:
diff --git a/mysql-test/main/mysqltest_tracking_info.result b/mysql-test/main/mysqltest_tracking_info.result
index df966ae1d39..d2eaa5afea8 100644
--- a/mysql-test/main/mysqltest_tracking_info.result
+++ b/mysql-test/main/mysqltest_tracking_info.result
@@ -29,3 +29,13 @@ SET NAMES 'utf8';
# tracking info off once
SET NAMES 'big5';
SET @@session.session_track_system_variables= default;
+#
+# MDEV-16470 - Session user variables tracker
+#
+SET @@session.session_track_user_variables=1;
+SET @a=1;
+SET @b=NULL;
+SELECT @c:=10;
+@c:=10
+10
+SET @@session.session_track_user_variables=0;
diff --git a/mysql-test/main/mysqltest_tracking_info.test b/mysql-test/main/mysqltest_tracking_info.test
index d31f68b3cbd..405b920051a 100644
--- a/mysql-test/main/mysqltest_tracking_info.test
+++ b/mysql-test/main/mysqltest_tracking_info.test
@@ -23,3 +23,14 @@ SET NAMES 'big5';
--disable_session_track_info
SET @@session.session_track_system_variables= default;
+
+--echo #
+--echo # MDEV-16470 - Session user variables tracker
+--echo #
+SET @@session.session_track_user_variables=1;
+--enable_session_track_info
+SET @a=1;
+SET @b=NULL;
+SELECT @c:=10;
+--disable_session_track_info
+SET @@session.session_track_user_variables=0;
diff --git a/mysql-test/main/named_pipe.result b/mysql-test/main/named_pipe.result
index f8c2acf98a0..9fc7abd79f5 100644
--- a/mysql-test/main/named_pipe.result
+++ b/mysql-test/main/named_pipe.result
@@ -509,7 +509,7 @@ insert into tmp select * from t3;
insert into t3 select * from tmp;
alter table t3 add t2nr int not null auto_increment primary key first;
drop table tmp;
-SET BIG_TABLES=1;
+set tmp_memory_table_size=0;
select distinct concat(fld3," ",fld3) as namn from t2,t3 where t2.fld1=t3.t2nr order by namn limit 10;
namn
Abraham Abraham
@@ -522,7 +522,7 @@ ammonium ammonium
analyzable analyzable
animals animals
animized animized
-SET BIG_TABLES=0;
+set tmp_memory_table_size=default;
select distinct concat(fld3," ",fld3) from t2,t3 where t2.fld1=t3.t2nr order by fld3 limit 10;
concat(fld3," ",fld3)
Abraham Abraham
@@ -559,7 +559,7 @@ attendants 1
bedlam 1
bedpost 1
boasted 1
-SET BIG_TABLES=1;
+set tmp_memory_table_size=0;
select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
fld3 count(*)
affixed 1
@@ -572,7 +572,7 @@ attendants 1
bedlam 1
bedpost 1
boasted 1
-SET BIG_TABLES=0;
+set tmp_memory_table_size=default;
select distinct fld3,repeat("a",length(fld3)),count(*) from t2 group by companynr,fld3 limit 100,10;
fld3 repeat("a",length(fld3)) count(*)
circus aaaaaa 1
diff --git a/mysql-test/main/openssl_1.test b/mysql-test/main/openssl_1.test
index b70d2018c9e..fff65624b12 100644
--- a/mysql-test/main/openssl_1.test
+++ b/mysql-test/main/openssl_1.test
@@ -1,5 +1,6 @@
# Needed for mysqldump
--source include/have_utf8mb4.inc
+--source include/not_asan.inc
# Tests for SSL connections, only run if mysqld is compiled
# with support for SSL.
diff --git a/mysql-test/main/parser.result b/mysql-test/main/parser.result
index b39f496e3db..fa40ffa6942 100644
--- a/mysql-test/main/parser.result
+++ b/mysql-test/main/parser.result
@@ -1798,3 +1798,47 @@ ERROR HY000: Table 't2' was not locked with LOCK TABLES
SET STATEMENT max_statement_time=900 FOR unlock tables;
drop table t1, t2;
# End of 10.4 tests
+#
+# Start of 10.5 tests
+#
+#
+# MDEV-20734 Allow reserved keywords as user defined type names
+#
+CREATE TABLE t1 (a DUAL);
+ERROR HY000: Unknown data type: 'DUAL'
+SELECT CAST(1 AS DUAL);
+ERROR HY000: Unknown data type: 'DUAL'
+#
+# MDEV-20735 Allow non-reserved keywords as user defined type names
+#
+CREATE TABLE t1 (a ASCII);
+ERROR HY000: Unknown data type: 'ASCII'
+SELECT CAST(1 AS ASCII);
+ERROR HY000: Unknown data type: 'ASCII'
+CREATE TABLE t1 (a LANGUAGE);
+ERROR HY000: Unknown data type: 'LANGUAGE'
+SELECT CAST(1 AS LANGUAGE);
+ERROR HY000: Unknown data type: 'LANGUAGE'
+CREATE TABLE t1 (a CLOSE);
+ERROR HY000: Unknown data type: 'CLOSE'
+SELECT CAST(1 AS CLOSE);
+ERROR HY000: Unknown data type: 'CLOSE'
+CREATE TABLE t1 (a NAMES);
+ERROR HY000: Unknown data type: 'NAMES'
+SELECT CAST(1 AS NAMES);
+ERROR HY000: Unknown data type: 'NAMES'
+CREATE TABLE t1 (a END);
+ERROR HY000: Unknown data type: 'END'
+SELECT CAST(1 AS END);
+ERROR HY000: Unknown data type: 'END'
+CREATE TABLE t1 (a GLOBAL);
+ERROR HY000: Unknown data type: 'GLOBAL'
+SELECT CAST(1 AS GLOBAL);
+ERROR HY000: Unknown data type: 'GLOBAL'
+CREATE TABLE t1 (a ACTION);
+ERROR HY000: Unknown data type: 'ACTION'
+SELECT CAST(1 AS ACTION);
+ERROR HY000: Unknown data type: 'ACTION'
+#
+# End of 10.5 tests
+#
diff --git a/mysql-test/main/parser.test b/mysql-test/main/parser.test
index c6e9f13cdaf..006f409e6b7 100644
--- a/mysql-test/main/parser.test
+++ b/mysql-test/main/parser.test
@@ -1566,3 +1566,61 @@ SET STATEMENT max_statement_time=900 FOR unlock tables;
drop table t1, t2;
--echo # End of 10.4 tests
+
+
+--echo #
+--echo # Start of 10.5 tests
+--echo #
+
+--echo #
+--echo # MDEV-20734 Allow reserved keywords as user defined type names
+--echo #
+
+--error ER_UNKNOWN_DATA_TYPE
+CREATE TABLE t1 (a DUAL);
+--error ER_UNKNOWN_DATA_TYPE
+SELECT CAST(1 AS DUAL);
+
+--echo #
+--echo # MDEV-20735 Allow non-reserved keywords as user defined type names
+--echo #
+
+--error ER_UNKNOWN_DATA_TYPE
+CREATE TABLE t1 (a ASCII);
+--error ER_UNKNOWN_DATA_TYPE
+SELECT CAST(1 AS ASCII);
+
+--error ER_UNKNOWN_DATA_TYPE
+CREATE TABLE t1 (a LANGUAGE);
+--error ER_UNKNOWN_DATA_TYPE
+SELECT CAST(1 AS LANGUAGE);
+
+--error ER_UNKNOWN_DATA_TYPE
+CREATE TABLE t1 (a CLOSE);
+--error ER_UNKNOWN_DATA_TYPE
+SELECT CAST(1 AS CLOSE);
+
+--error ER_UNKNOWN_DATA_TYPE
+CREATE TABLE t1 (a NAMES);
+--error ER_UNKNOWN_DATA_TYPE
+SELECT CAST(1 AS NAMES);
+
+--error ER_UNKNOWN_DATA_TYPE
+CREATE TABLE t1 (a END);
+--error ER_UNKNOWN_DATA_TYPE
+SELECT CAST(1 AS END);
+
+--error ER_UNKNOWN_DATA_TYPE
+CREATE TABLE t1 (a GLOBAL);
+--error ER_UNKNOWN_DATA_TYPE
+SELECT CAST(1 AS GLOBAL);
+
+--error ER_UNKNOWN_DATA_TYPE
+CREATE TABLE t1 (a ACTION);
+--error ER_UNKNOWN_DATA_TYPE
+SELECT CAST(1 AS ACTION);
+
+
+--echo #
+--echo # End of 10.5 tests
+--echo #
diff --git a/mysql-test/main/pool_of_threads.result b/mysql-test/main/pool_of_threads.result
index 9c02dfac9cd..fd3c848117c 100644
--- a/mysql-test/main/pool_of_threads.result
+++ b/mysql-test/main/pool_of_threads.result
@@ -509,7 +509,7 @@ insert into tmp select * from t3;
insert into t3 select * from tmp;
alter table t3 add t2nr int not null auto_increment primary key first;
drop table tmp;
-SET BIG_TABLES=1;
+set tmp_memory_table_size=0;
select distinct concat(fld3," ",fld3) as namn from t2,t3 where t2.fld1=t3.t2nr order by namn limit 10;
namn
Abraham Abraham
@@ -522,7 +522,7 @@ ammonium ammonium
analyzable analyzable
animals animals
animized animized
-SET BIG_TABLES=0;
+set tmp_memory_table_size=default;
select distinct concat(fld3," ",fld3) from t2,t3 where t2.fld1=t3.t2nr order by fld3 limit 10;
concat(fld3," ",fld3)
Abraham Abraham
@@ -559,7 +559,7 @@ attendants 1
bedlam 1
bedpost 1
boasted 1
-SET BIG_TABLES=1;
+set tmp_memory_table_size=0;
select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
fld3 count(*)
affixed 1
@@ -572,7 +572,7 @@ attendants 1
bedlam 1
bedpost 1
boasted 1
-SET BIG_TABLES=0;
+set tmp_memory_table_size=default;
select distinct fld3,repeat("a",length(fld3)),count(*) from t2 group by companynr,fld3 limit 100,10;
fld3 repeat("a",length(fld3)) count(*)
circus aaaaaa 1
diff --git a/mysql-test/main/range.result b/mysql-test/main/range.result
index bb111f25a07..7f03a7c596c 100644
--- a/mysql-test/main/range.result
+++ b/mysql-test/main/range.result
@@ -3113,6 +3113,299 @@ drop table t1,ten,t2;
#
# End of 10.2 tests
#
+#
+# MDEV-15777: Use inferred IS NOT NULL predicates in the range optimizer
+#
+set @save_optimizer_switch= @@optimizer_switch;
+set @@optimizer_switch='not_null_range_scan=on';
+create table ten(a int);
+insert into ten values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table one_k(a int);
+insert into one_k select A.a + B.a* 10 + C.a * 100 from ten A, ten B, ten C;
+create table t1 (
+id int NOT NULL,
+subset_id int DEFAULT NULL,
+PRIMARY KEY (id),
+KEY t1_subset_id (subset_id));
+create table t2 (
+id int,
+col int NOT NULL,
+key (id)
+);
+insert into t1 select a,a from one_k limit 5;
+insert into t1 select a+5,NULL from one_k limit 995;
+insert into t2 select a,a from one_k;
+analyze table t1,t2;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
+test.t2 analyze status Table is already up to date
+# expected for t1: range access and rows = 4 (not 1000)
+explain SELECT * FROM t1,t2 WHERE t1.subset_id=t2.id;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range t1_subset_id t1_subset_id 5 NULL 3 Using index condition
+1 SIMPLE t2 ref id id 5 test.t1.subset_id 1
+SELECT * FROM t1,t2 WHERE t1.subset_id=t2.id;
+id subset_id id col
+0 0 0 0
+1 1 1 1
+2 2 2 2
+3 3 3 3
+4 4 4 4
+# with a subquery
+# expected the same plan as above
+explain SELECT * FROM t1 WHERE t1.subset_id IN (SELECT t2.id FROM t2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 range t1_subset_id t1_subset_id 5 NULL 3 Using index condition
+1 PRIMARY t2 ref id id 5 test.t1.subset_id 1 Using index; FirstMatch(t1)
+SELECT * FROM t1 WHERE t1.subset_id IN (SELECT t2.id FROM t2);
+id subset_id
+0 0
+1 1
+2 2
+3 3
+4 4
+# non-mergable subquery
+# expected for t1: range access and rows = 4 (not 1000)
+explain SELECT * FROM t1
+WHERE t1.subset_id IN (SELECT max(t2.id) FROM t2 group by t2.col);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 range t1_subset_id t1_subset_id 5 NULL 3 Using index condition
+1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 test.t1.subset_id 1
+2 MATERIALIZED t2 ALL NULL NULL NULL NULL 1000 Using temporary
+SELECT * FROM t1
+WHERE t1.subset_id IN (SELECT max(t2.id) FROM t2 group by t2.col);
+id subset_id
+0 0
+1 1
+2 2
+3 3
+4 4
+create view v1 as SELECT t2.id FROM t2;
+create view v2 as SELECT t2.id FROM t2 group by t2.col;
+# with mergeable view
+# expected for t1: range access and rows = 4 (not 1000)
+explain SELECT * FROM t1, v1 where t1.subset_id=v1.id;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range t1_subset_id t1_subset_id 5 NULL 3 Using index condition
+1 SIMPLE t2 ref id id 5 test.t1.subset_id 1 Using index
+SELECT * FROM t1, v1 where t1.subset_id=v1.id;
+id subset_id id
+0 0 0
+1 1 1
+2 2 2
+3 3 3
+4 4 4
+# with non-mergeable view
+# expected for t1: range access and rows = 4 (not 1000)
+explain SELECT * FROM t1, v2 where t1.subset_id=v2.id;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 range t1_subset_id t1_subset_id 5 NULL 3 Using index condition
+1 PRIMARY <derived2> ref key0 key0 5 test.t1.subset_id 10
+2 DERIVED t2 ALL NULL NULL NULL NULL 1000 Using temporary; Using filesort
+SELECT * FROM t1, v2 where t1.subset_id=v2.id;
+id subset_id id
+0 0 0
+1 1 1
+2 2 2
+3 3 3
+4 4 4
+# expected for t2 and for t1: range access
+explain SELECT * FROM t2 LEFT JOIN t1 ON t1.subset_id != 5 WHERE t2.id in (0,2,4);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range id id 5 NULL 3 Using index condition
+1 SIMPLE t1 range t1_subset_id t1_subset_id 5 NULL 4 Using where; Using join buffer (flat, BNL join)
+SELECT * FROM t2 LEFT JOIN t1 ON t1.subset_id != 5 WHERE t2.id in (0,2,4);
+id col id subset_id
+0 0 0 0
+2 2 0 0
+4 4 0 0
+0 0 1 1
+2 2 1 1
+4 4 1 1
+0 0 2 2
+2 2 2 2
+4 4 2 2
+0 0 3 3
+2 2 3 3
+4 4 3 3
+0 0 4 4
+2 2 4 4
+4 4 4 4
+# no range access expected for t1
+explain SELECT * FROM t1 LEFT JOIN t2 ON t1.subset_id=t2.id LIMIT 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 1000
+1 SIMPLE t2 ref id id 5 test.t1.subset_id 1 Using where
+SELECT * FROM t1 LEFT JOIN t2 ON t1.subset_id=t2.id LIMIT 10;
+id subset_id id col
+0 0 0 0
+1 1 1 1
+2 2 2 2
+3 3 3 3
+4 4 4 4
+5 NULL NULL NULL
+6 NULL NULL NULL
+7 NULL NULL NULL
+8 NULL NULL NULL
+9 NULL NULL NULL
+# expected for t1: range access
+explain SELECT * FROM ten LEFT JOIN (t1,t2) ON ten.a=t2.col AND t1.subset_id=t2.id;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE ten ALL NULL NULL NULL NULL 10
+1 SIMPLE t1 range t1_subset_id t1_subset_id 5 NULL 3 Using where
+1 SIMPLE t2 ref id id 5 test.t1.subset_id 1 Using where
+SELECT * FROM ten LEFT JOIN (t1,t2) ON ten.a=t2.col AND t1.subset_id=t2.id;
+a id subset_id id col
+0 0 0 0 0
+1 1 1 1 1
+2 2 2 2 2
+3 3 3 3 3
+4 4 4 4 4
+5 NULL NULL NULL NULL
+6 NULL NULL NULL NULL
+7 NULL NULL NULL NULL
+8 NULL NULL NULL NULL
+9 NULL NULL NULL NULL
+# no range access expected for t1
+explain SELECT * FROM t1 LEFT JOIN (t2,ten) ON ten.a=t2.col AND t1.subset_id=t2.id
+LIMIT 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 1000
+1 SIMPLE t2 ref id id 5 test.t1.subset_id 1 Using where
+1 SIMPLE ten ALL NULL NULL NULL NULL 10 Using where
+SELECT * FROM t1 LEFT JOIN (t2,ten) ON ten.a=t2.col AND t1.subset_id=t2.id
+LIMIT 10;
+id subset_id id col a
+0 0 0 0 0
+1 1 1 1 1
+2 2 2 2 2
+3 3 3 3 3
+4 4 4 4 4
+5 NULL NULL NULL NULL
+6 NULL NULL NULL NULL
+7 NULL NULL NULL NULL
+8 NULL NULL NULL NULL
+9 NULL NULL NULL NULL
+drop index id on t2;
+# expected for t1: range access
+explain SELECT * FROM t1,t2 WHERE t1.subset_id=t2.id;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range t1_subset_id t1_subset_id 5 NULL 3 Using index condition
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1000 Using where; Using join buffer (flat, BNL join)
+SELECT * FROM t1,t2 WHERE t1.subset_id=t2.id;
+id subset_id id col
+0 0 0 0
+1 1 1 1
+2 2 2 2
+3 3 3 3
+4 4 4 4
+# expected impossible where after reading const tables
+explain SELECT * FROM t1,t2 WHERE t1.subset_id > t2.id AND t1.subset_id IS NULL;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+SELECT * FROM t1,t2 WHERE t1.subset_id > t2.id AND t1.subset_id IS NULL;
+id subset_id id col
+# expected impossible where after reading const tables
+explain SELECT * FROM t1,t2 WHERE t1.subset_id > t2.id AND t2.id IS NULL;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+SELECT * FROM t1,t2 WHERE t1.subset_id > t2.id AND t2.id IS NULL;
+id subset_id id col
+drop index t1_subset_id on t1;
+alter table t1 add column m int not null default 0;
+alter table t1 add index idx(m,subset_id);
+alter table t2 add index (id);
+update t1 set m = id mod 2;
+analyze table t1,t2;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
+test.t2 analyze status Table is already up to date
+# expected for t1: range access by idx (keylen=9)
+explain SELECT * FROM t1,t2 WHERE t1.subset_id=t2.id and t1.m=0 ;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range idx idx 9 NULL 4 Using index condition
+1 SIMPLE t2 ref id id 5 test.t1.subset_id 1
+SELECT * FROM t1,t2 WHERE t1.subset_id=t2.id and t1.m=0 ;
+id subset_id m id col
+0 0 0 0 0
+2 2 0 2 2
+4 4 0 4 4
+drop view v1,v2;
+drop table t1,t2;
+create table t1 (
+id int NOT NULL,
+subset_id int DEFAULT NULL,
+KEY key1(id, subset_id),
+KEY t1_subset_id (subset_id)
+);
+create table t2 (
+id int NOT NULL,
+col int NOT NULL,
+key (id)
+);
+insert into t1 select 1,a from one_k limit 5;
+insert into t1 select 1,NULL from one_k limit 495;
+insert into t2 select a,a from one_k;
+analyze table t1,t2;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
+test.t2 analyze status Table is already up to date
+# expected for t1 :range access by index key1
+# rows 4 instead of 500
+explain SELECT * FROM t1,t2 WHERE t1.id>=1 and t1.subset_id=t2.id;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range key1,t1_subset_id key1 9 NULL 3 Using where; Using index
+1 SIMPLE t2 ref id id 4 test.t1.subset_id 1
+SELECT * FROM t1,t2 WHERE t1.id>=1 and t1.subset_id=t2.id;
+id subset_id id col
+1 0 0 0
+1 1 1 1
+1 2 2 2
+1 3 3 3
+1 4 4 4
+drop table t1,t2;
+create table t1 (id int unsigned,col int, KEY key1(id));
+create table t2 (id int unsigned,col int DEFAULT NULL,key (id));
+insert into t1 select a,2 from one_k limit 50;
+insert into t1 select NULL,2 from one_k limit 450;
+insert into t2 select a,a from one_k;
+insert into t2 select a,a from one_k;
+analyze table t1,t2;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
+test.t2 analyze status OK
+# using key1 for range access on t1 and also using index for sorting,
+# no filesort, rows should be 75 not 500
+explain SELECT * FROM t1,t2 WHERE t1.id=t2.id AND t1.col=2 ORDER BY t2.id LIMIT 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range key1 key1 5 NULL 74 Using index condition; Using where
+1 SIMPLE t2 ref id id 5 test.t1.id 2
+SELECT * FROM t1,t2 WHERE t1.id=t2.id AND t1.col=2 ORDER BY t2.id LIMIT 10;
+id col id col
+0 2 0 0
+0 2 0 0
+1 2 1 1
+1 2 1 1
+2 2 2 2
+2 2 2 2
+3 2 3 3
+3 2 3 3
+4 2 4 4
+4 2 4 4
+drop table t1,t2;
+drop table ten,one_k;
+set @@optimizer_switch= @save_optimizer_switch;
+#
+# End of 10.5 tests
+#
set global innodb_stats_persistent= @innodb_stats_persistent_save;
set global innodb_stats_persistent_sample_pages=
@innodb_stats_persistent_sample_pages_save;
diff --git a/mysql-test/main/range.test b/mysql-test/main/range.test
index a52443990be..ce2d2e7b44f 100644
--- a/mysql-test/main/range.test
+++ b/mysql-test/main/range.test
@@ -2102,6 +2102,188 @@ drop table t1,ten,t2;
--echo # End of 10.2 tests
--echo #
+--echo #
+--echo # MDEV-15777: Use inferred IS NOT NULL predicates in the range optimizer
+--echo #
+
+set @save_optimizer_switch= @@optimizer_switch;
+set @@optimizer_switch='not_null_range_scan=on';
+create table ten(a int);
+insert into ten values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+
+create table one_k(a int);
+insert into one_k select A.a + B.a* 10 + C.a * 100 from ten A, ten B, ten C;
+
+create table t1 (
+ id int NOT NULL,
+ subset_id int DEFAULT NULL,
+ PRIMARY KEY (id),
+ KEY t1_subset_id (subset_id));
+
+create table t2 (
+ id int,
+ col int NOT NULL,
+ key (id)
+);
+
+insert into t1 select a,a from one_k limit 5;
+insert into t1 select a+5,NULL from one_k limit 995;
+insert into t2 select a,a from one_k;
+
+analyze table t1,t2;
+
+let $q=
+SELECT * FROM t1,t2 WHERE t1.subset_id=t2.id;
+--echo # expected for t1: range access and rows = 4 (not 1000)
+eval explain $q;
+eval $q;
+
+let $q=
+SELECT * FROM t1 WHERE t1.subset_id IN (SELECT t2.id FROM t2);
+--echo # with a subquery
+--echo # expected the same plan as above
+eval explain $q;
+eval $q;
+
+let $q=
+SELECT * FROM t1
+ WHERE t1.subset_id IN (SELECT max(t2.id) FROM t2 group by t2.col);
+--echo # non-mergable subquery
+--echo # expected for t1: range access and rows = 4 (not 1000)
+eval explain $q;
+eval $q;
+
+create view v1 as SELECT t2.id FROM t2;
+create view v2 as SELECT t2.id FROM t2 group by t2.col;
+
+let $q=
+SELECT * FROM t1, v1 where t1.subset_id=v1.id;
+--echo # with mergeable view
+--echo # expected for t1: range access and rows = 4 (not 1000)
+eval explain $q;
+eval $q;
+
+let $q= SELECT * FROM t1, v2 where t1.subset_id=v2.id;
+--echo # with non-mergeable view
+--echo # expected for t1: range access and rows = 4 (not 1000)
+eval explain $q;
+eval $q;
+
+let $q=
+SELECT * FROM t2 LEFT JOIN t1 ON t1.subset_id != 5 WHERE t2.id in (0,2,4);
+--echo # expected for t2 and for t1: range access
+eval explain $q;
+eval $q;
+
+let $q=
+SELECT * FROM t1 LEFT JOIN t2 ON t1.subset_id=t2.id LIMIT 10;
+--echo # no range access expected for t1
+eval explain $q;
+eval $q;
+
+let $q=
+SELECT * FROM ten LEFT JOIN (t1,t2) ON ten.a=t2.col AND t1.subset_id=t2.id;
+--echo # expected for t1: range access
+eval explain $q;
+eval $q;
+
+let $q=
+SELECT * FROM t1 LEFT JOIN (t2,ten) ON ten.a=t2.col AND t1.subset_id=t2.id
+LIMIT 10;
+--echo # no range access expected for t1
+eval explain $q;
+eval $q;
+
+drop index id on t2;
+
+let $q=
+SELECT * FROM t1,t2 WHERE t1.subset_id=t2.id;
+--echo # expected for t1: range access
+eval explain $q;
+eval $q;
+
+let $q=
+SELECT * FROM t1,t2 WHERE t1.subset_id > t2.id AND t1.subset_id IS NULL;
+--echo # expected impossible where after reading const tables
+eval explain $q;
+eval $q;
+
+let $q=
+SELECT * FROM t1,t2 WHERE t1.subset_id > t2.id AND t2.id IS NULL;
+--echo # expected impossible where after reading const tables
+eval explain $q;
+eval $q;
+
+drop index t1_subset_id on t1;
+alter table t1 add column m int not null default 0;
+alter table t1 add index idx(m,subset_id);
+alter table t2 add index (id);
+update t1 set m = id mod 2;
+analyze table t1,t2;
+
+let $q=
+SELECT * FROM t1,t2 WHERE t1.subset_id=t2.id and t1.m=0 ;
+--echo # expected for t1: range access by idx (keylen=9)
+eval explain $q;
+eval $q;
+
+
+drop view v1,v2;
+drop table t1,t2;
+
+create table t1 (
+ id int NOT NULL,
+ subset_id int DEFAULT NULL,
+ KEY key1(id, subset_id),
+ KEY t1_subset_id (subset_id)
+);
+
+create table t2 (
+ id int NOT NULL,
+ col int NOT NULL,
+ key (id)
+);
+
+insert into t1 select 1,a from one_k limit 5;
+insert into t1 select 1,NULL from one_k limit 495;
+insert into t2 select a,a from one_k;
+
+analyze table t1,t2;
+
+let $q=
+SELECT * FROM t1,t2 WHERE t1.id>=1 and t1.subset_id=t2.id;
+--echo # expected for t1 :range access by index key1
+--echo # rows 4 instead of 500
+eval explain $q;
+eval $q;
+
+drop table t1,t2;
+
+create table t1 (id int unsigned,col int, KEY key1(id));
+create table t2 (id int unsigned,col int DEFAULT NULL,key (id));
+insert into t1 select a,2 from one_k limit 50;
+insert into t1 select NULL,2 from one_k limit 450;
+insert into t2 select a,a from one_k;
+insert into t2 select a,a from one_k;
+
+analyze table t1,t2;
+
+let $q=
+SELECT * FROM t1,t2 WHERE t1.id=t2.id AND t1.col=2 ORDER BY t2.id LIMIT 10;
+--echo # using key1 for range access on t1 and also using index for sorting,
+--echo # no filesort, rows should be 75 not 500
+eval explain $q;
+eval $q;
+
+drop table t1,t2;
+
+drop table ten,one_k;
+set @@optimizer_switch= @save_optimizer_switch;
+
+--echo #
+--echo # End of 10.5 tests
+--echo #
+
set global innodb_stats_persistent= @innodb_stats_persistent_save;
set global innodb_stats_persistent_sample_pages=
- @innodb_stats_persistent_sample_pages_save;
+ @innodb_stats_persistent_sample_pages_save;
diff --git a/mysql-test/main/range_mrr_icp.result b/mysql-test/main/range_mrr_icp.result
index c286c49cac0..b698ec9e2ff 100644
--- a/mysql-test/main/range_mrr_icp.result
+++ b/mysql-test/main/range_mrr_icp.result
@@ -3110,6 +3110,299 @@ drop table t1,ten,t2;
#
# End of 10.2 tests
#
+#
+# MDEV-15777: Use inferred IS NOT NULL predicates in the range optimizer
+#
+set @save_optimizer_switch= @@optimizer_switch;
+set @@optimizer_switch='not_null_range_scan=on';
+create table ten(a int);
+insert into ten values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table one_k(a int);
+insert into one_k select A.a + B.a* 10 + C.a * 100 from ten A, ten B, ten C;
+create table t1 (
+id int NOT NULL,
+subset_id int DEFAULT NULL,
+PRIMARY KEY (id),
+KEY t1_subset_id (subset_id));
+create table t2 (
+id int,
+col int NOT NULL,
+key (id)
+);
+insert into t1 select a,a from one_k limit 5;
+insert into t1 select a+5,NULL from one_k limit 995;
+insert into t2 select a,a from one_k;
+analyze table t1,t2;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
+test.t2 analyze status Table is already up to date
+# expected for t1: range access and rows = 4 (not 1000)
+explain SELECT * FROM t1,t2 WHERE t1.subset_id=t2.id;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range t1_subset_id t1_subset_id 5 NULL 3 Using index condition; Rowid-ordered scan
+1 SIMPLE t2 ref id id 5 test.t1.subset_id 1
+SELECT * FROM t1,t2 WHERE t1.subset_id=t2.id;
+id subset_id id col
+0 0 0 0
+1 1 1 1
+2 2 2 2
+3 3 3 3
+4 4 4 4
+# with a subquery
+# expected the same plan as above
+explain SELECT * FROM t1 WHERE t1.subset_id IN (SELECT t2.id FROM t2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 range t1_subset_id t1_subset_id 5 NULL 3 Using index condition; Rowid-ordered scan
+1 PRIMARY t2 ref id id 5 test.t1.subset_id 1 Using index; FirstMatch(t1)
+SELECT * FROM t1 WHERE t1.subset_id IN (SELECT t2.id FROM t2);
+id subset_id
+0 0
+1 1
+2 2
+3 3
+4 4
+# non-mergable subquery
+# expected for t1: range access and rows = 4 (not 1000)
+explain SELECT * FROM t1
+WHERE t1.subset_id IN (SELECT max(t2.id) FROM t2 group by t2.col);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 range t1_subset_id t1_subset_id 5 NULL 3 Using index condition; Rowid-ordered scan
+1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 test.t1.subset_id 1
+2 MATERIALIZED t2 ALL NULL NULL NULL NULL 1000 Using temporary
+SELECT * FROM t1
+WHERE t1.subset_id IN (SELECT max(t2.id) FROM t2 group by t2.col);
+id subset_id
+0 0
+1 1
+2 2
+3 3
+4 4
+create view v1 as SELECT t2.id FROM t2;
+create view v2 as SELECT t2.id FROM t2 group by t2.col;
+# with mergeable view
+# expected for t1: range access and rows = 4 (not 1000)
+explain SELECT * FROM t1, v1 where t1.subset_id=v1.id;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range t1_subset_id t1_subset_id 5 NULL 3 Using index condition; Rowid-ordered scan
+1 SIMPLE t2 ref id id 5 test.t1.subset_id 1 Using index
+SELECT * FROM t1, v1 where t1.subset_id=v1.id;
+id subset_id id
+0 0 0
+1 1 1
+2 2 2
+3 3 3
+4 4 4
+# with non-mergeable view
+# expected for t1: range access and rows = 4 (not 1000)
+explain SELECT * FROM t1, v2 where t1.subset_id=v2.id;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 range t1_subset_id t1_subset_id 5 NULL 3 Using index condition; Rowid-ordered scan
+1 PRIMARY <derived2> ref key0 key0 5 test.t1.subset_id 10
+2 DERIVED t2 ALL NULL NULL NULL NULL 1000 Using temporary; Using filesort
+SELECT * FROM t1, v2 where t1.subset_id=v2.id;
+id subset_id id
+0 0 0
+1 1 1
+2 2 2
+3 3 3
+4 4 4
+# expected for t2 and for t1: range access
+explain SELECT * FROM t2 LEFT JOIN t1 ON t1.subset_id != 5 WHERE t2.id in (0,2,4);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range id id 5 NULL 3 Using index condition; Rowid-ordered scan
+1 SIMPLE t1 range t1_subset_id t1_subset_id 5 NULL 4 Using where; Rowid-ordered scan; Using join buffer (flat, BNL join)
+SELECT * FROM t2 LEFT JOIN t1 ON t1.subset_id != 5 WHERE t2.id in (0,2,4);
+id col id subset_id
+0 0 0 0
+2 2 0 0
+4 4 0 0
+0 0 1 1
+2 2 1 1
+4 4 1 1
+0 0 2 2
+2 2 2 2
+4 4 2 2
+0 0 3 3
+2 2 3 3
+4 4 3 3
+0 0 4 4
+2 2 4 4
+4 4 4 4
+# no range access expected for t1
+explain SELECT * FROM t1 LEFT JOIN t2 ON t1.subset_id=t2.id LIMIT 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 1000
+1 SIMPLE t2 ref id id 5 test.t1.subset_id 1 Using where
+SELECT * FROM t1 LEFT JOIN t2 ON t1.subset_id=t2.id LIMIT 10;
+id subset_id id col
+0 0 0 0
+1 1 1 1
+2 2 2 2
+3 3 3 3
+4 4 4 4
+5 NULL NULL NULL
+6 NULL NULL NULL
+7 NULL NULL NULL
+8 NULL NULL NULL
+9 NULL NULL NULL
+# expected for t1: range access
+explain SELECT * FROM ten LEFT JOIN (t1,t2) ON ten.a=t2.col AND t1.subset_id=t2.id;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE ten ALL NULL NULL NULL NULL 10
+1 SIMPLE t1 range t1_subset_id t1_subset_id 5 NULL 3 Using where; Rowid-ordered scan
+1 SIMPLE t2 ref id id 5 test.t1.subset_id 1 Using where
+SELECT * FROM ten LEFT JOIN (t1,t2) ON ten.a=t2.col AND t1.subset_id=t2.id;
+a id subset_id id col
+0 0 0 0 0
+1 1 1 1 1
+2 2 2 2 2
+3 3 3 3 3
+4 4 4 4 4
+5 NULL NULL NULL NULL
+6 NULL NULL NULL NULL
+7 NULL NULL NULL NULL
+8 NULL NULL NULL NULL
+9 NULL NULL NULL NULL
+# no range access expected for t1
+explain SELECT * FROM t1 LEFT JOIN (t2,ten) ON ten.a=t2.col AND t1.subset_id=t2.id
+LIMIT 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 1000
+1 SIMPLE t2 ref id id 5 test.t1.subset_id 1 Using where
+1 SIMPLE ten ALL NULL NULL NULL NULL 10 Using where
+SELECT * FROM t1 LEFT JOIN (t2,ten) ON ten.a=t2.col AND t1.subset_id=t2.id
+LIMIT 10;
+id subset_id id col a
+0 0 0 0 0
+1 1 1 1 1
+2 2 2 2 2
+3 3 3 3 3
+4 4 4 4 4
+5 NULL NULL NULL NULL
+6 NULL NULL NULL NULL
+7 NULL NULL NULL NULL
+8 NULL NULL NULL NULL
+9 NULL NULL NULL NULL
+drop index id on t2;
+# expected for t1: range access
+explain SELECT * FROM t1,t2 WHERE t1.subset_id=t2.id;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range t1_subset_id t1_subset_id 5 NULL 3 Using index condition; Rowid-ordered scan
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1000 Using where; Using join buffer (flat, BNL join)
+SELECT * FROM t1,t2 WHERE t1.subset_id=t2.id;
+id subset_id id col
+0 0 0 0
+1 1 1 1
+2 2 2 2
+3 3 3 3
+4 4 4 4
+# expected impossible where after reading const tables
+explain SELECT * FROM t1,t2 WHERE t1.subset_id > t2.id AND t1.subset_id IS NULL;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+SELECT * FROM t1,t2 WHERE t1.subset_id > t2.id AND t1.subset_id IS NULL;
+id subset_id id col
+# expected impossible where after reading const tables
+explain SELECT * FROM t1,t2 WHERE t1.subset_id > t2.id AND t2.id IS NULL;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+SELECT * FROM t1,t2 WHERE t1.subset_id > t2.id AND t2.id IS NULL;
+id subset_id id col
+drop index t1_subset_id on t1;
+alter table t1 add column m int not null default 0;
+alter table t1 add index idx(m,subset_id);
+alter table t2 add index (id);
+update t1 set m = id mod 2;
+analyze table t1,t2;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
+test.t2 analyze status Table is already up to date
+# expected for t1: range access by idx (keylen=9)
+explain SELECT * FROM t1,t2 WHERE t1.subset_id=t2.id and t1.m=0 ;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range idx idx 9 NULL 4 Using index condition; Rowid-ordered scan
+1 SIMPLE t2 ref id id 5 test.t1.subset_id 1
+SELECT * FROM t1,t2 WHERE t1.subset_id=t2.id and t1.m=0 ;
+id subset_id m id col
+0 0 0 0 0
+2 2 0 2 2
+4 4 0 4 4
+drop view v1,v2;
+drop table t1,t2;
+create table t1 (
+id int NOT NULL,
+subset_id int DEFAULT NULL,
+KEY key1(id, subset_id),
+KEY t1_subset_id (subset_id)
+);
+create table t2 (
+id int NOT NULL,
+col int NOT NULL,
+key (id)
+);
+insert into t1 select 1,a from one_k limit 5;
+insert into t1 select 1,NULL from one_k limit 495;
+insert into t2 select a,a from one_k;
+analyze table t1,t2;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
+test.t2 analyze status Table is already up to date
+# expected for t1 :range access by index key1
+# rows 4 instead of 500
+explain SELECT * FROM t1,t2 WHERE t1.id>=1 and t1.subset_id=t2.id;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range key1,t1_subset_id key1 9 NULL 3 Using where; Using index
+1 SIMPLE t2 ref id id 4 test.t1.subset_id 1
+SELECT * FROM t1,t2 WHERE t1.id>=1 and t1.subset_id=t2.id;
+id subset_id id col
+1 0 0 0
+1 1 1 1
+1 2 2 2
+1 3 3 3
+1 4 4 4
+drop table t1,t2;
+create table t1 (id int unsigned,col int, KEY key1(id));
+create table t2 (id int unsigned,col int DEFAULT NULL,key (id));
+insert into t1 select a,2 from one_k limit 50;
+insert into t1 select NULL,2 from one_k limit 450;
+insert into t2 select a,a from one_k;
+insert into t2 select a,a from one_k;
+analyze table t1,t2;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
+test.t2 analyze status OK
+# using key1 for range access on t1 and also using index for sorting,
+# no filesort, rows should be 75 not 500
+explain SELECT * FROM t1,t2 WHERE t1.id=t2.id AND t1.col=2 ORDER BY t2.id LIMIT 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range key1 key1 5 NULL 74 Using index condition; Using where
+1 SIMPLE t2 ref id id 5 test.t1.id 2
+SELECT * FROM t1,t2 WHERE t1.id=t2.id AND t1.col=2 ORDER BY t2.id LIMIT 10;
+id col id col
+0 2 0 0
+0 2 0 0
+1 2 1 1
+1 2 1 1
+2 2 2 2
+2 2 2 2
+3 2 3 3
+3 2 3 3
+4 2 4 4
+4 2 4 4
+drop table t1,t2;
+drop table ten,one_k;
+set @@optimizer_switch= @save_optimizer_switch;
+#
+# End of 10.5 tests
+#
set global innodb_stats_persistent= @innodb_stats_persistent_save;
set global innodb_stats_persistent_sample_pages=
@innodb_stats_persistent_sample_pages_save;
diff --git a/mysql-test/main/repair.result b/mysql-test/main/repair.result
index 93da34b9657..84773449e92 100644
--- a/mysql-test/main/repair.result
+++ b/mysql-test/main/repair.result
@@ -192,14 +192,14 @@ drop tables t1, t2;
SET @save_global_character_set_server= @@global.character_set_server;
set @@global.character_set_server=@@character_set_server;
select count(*) from t1;
-ERROR HY000: Got error 190 "Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine. You have to dump an" from storage engine MyISAM
+ERROR HY000: Got error 190 "Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine. You may have retry " from storage engine MyISAM
check table t1;
Table Op Msg_type Msg_text
-test.t1 check Error Got error 190 "Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine. You have to dump an" from storage engine MyISAM
+test.t1 check Error Got error 190 "Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine. You may have retry " from storage engine MyISAM
test.t1 check error Corrupt
repair table t1;
Table Op Msg_type Msg_text
-test.t1 repair Error Got error 190 "Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine. You have to dump an" from storage engine MyISAM
+test.t1 repair Error Got error 190 "Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine. You may have retry " from storage engine MyISAM
test.t1 repair error Corrupt
repair table t1 use_frm;
Table Op Msg_type Msg_text
diff --git a/mysql-test/main/select.result b/mysql-test/main/select.result
index 0f84ed684da..ba5ec36430e 100644
--- a/mysql-test/main/select.result
+++ b/mysql-test/main/select.result
@@ -512,7 +512,7 @@ insert into tmp select * from t3;
insert into t3 select * from tmp;
alter table t3 add t2nr int not null auto_increment primary key first;
drop table tmp;
-SET BIG_TABLES=1;
+set tmp_memory_table_size=0;
select distinct concat(fld3," ",fld3) as namn from t2,t3 where t2.fld1=t3.t2nr order by namn limit 10;
namn
Abraham Abraham
@@ -525,7 +525,7 @@ ammonium ammonium
analyzable analyzable
animals animals
animized animized
-SET BIG_TABLES=0;
+set tmp_memory_table_size=default;
select distinct concat(fld3," ",fld3) from t2,t3 where t2.fld1=t3.t2nr order by fld3 limit 10;
concat(fld3," ",fld3)
Abraham Abraham
@@ -562,7 +562,7 @@ attendants 1
bedlam 1
bedpost 1
boasted 1
-SET BIG_TABLES=1;
+set tmp_memory_table_size=0;
select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
fld3 count(*)
affixed 1
@@ -575,7 +575,7 @@ attendants 1
bedlam 1
bedpost 1
boasted 1
-SET BIG_TABLES=0;
+set tmp_memory_table_size=default;
select distinct fld3,repeat("a",length(fld3)),count(*) from t2 group by companynr,fld3 limit 100,10;
fld3 repeat("a",length(fld3)) count(*)
circus aaaaaa 1
diff --git a/mysql-test/main/select.test b/mysql-test/main/select.test
index 43984810c66..22baccc625c 100644
--- a/mysql-test/main/select.test
+++ b/mysql-test/main/select.test
@@ -1425,9 +1425,9 @@ drop table tmp;
# big table done
-SET BIG_TABLES=1;
+set tmp_memory_table_size=0; # force on-disk tmp table
select distinct concat(fld3," ",fld3) as namn from t2,t3 where t2.fld1=t3.t2nr order by namn limit 10;
-SET BIG_TABLES=0;
+set tmp_memory_table_size=default;
select distinct concat(fld3," ",fld3) from t2,t3 where t2.fld1=t3.t2nr order by fld3 limit 10;
select distinct fld5 from t2 limit 10;
@@ -1436,9 +1436,9 @@ select distinct fld5 from t2 limit 10;
#
select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
-SET BIG_TABLES=1; # Force use of MyISAM
+set tmp_memory_table_size=0; # force on-disk tmp table
select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
-SET BIG_TABLES=0;
+set tmp_memory_table_size=default;
select distinct fld3,repeat("a",length(fld3)),count(*) from t2 group by companynr,fld3 limit 100,10;
#
diff --git a/mysql-test/main/select_jcl6.result b/mysql-test/main/select_jcl6.result
index 7276814114f..2de5df60901 100644
--- a/mysql-test/main/select_jcl6.result
+++ b/mysql-test/main/select_jcl6.result
@@ -523,7 +523,7 @@ insert into tmp select * from t3;
insert into t3 select * from tmp;
alter table t3 add t2nr int not null auto_increment primary key first;
drop table tmp;
-SET BIG_TABLES=1;
+set tmp_memory_table_size=0;
select distinct concat(fld3," ",fld3) as namn from t2,t3 where t2.fld1=t3.t2nr order by namn limit 10;
namn
Abraham Abraham
@@ -536,7 +536,7 @@ ammonium ammonium
analyzable analyzable
animals animals
animized animized
-SET BIG_TABLES=0;
+set tmp_memory_table_size=default;
select distinct concat(fld3," ",fld3) from t2,t3 where t2.fld1=t3.t2nr order by fld3 limit 10;
concat(fld3," ",fld3)
Abraham Abraham
@@ -573,7 +573,7 @@ attendants 1
bedlam 1
bedpost 1
boasted 1
-SET BIG_TABLES=1;
+set tmp_memory_table_size=0;
select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
fld3 count(*)
affixed 1
@@ -586,7 +586,7 @@ attendants 1
bedlam 1
bedpost 1
boasted 1
-SET BIG_TABLES=0;
+set tmp_memory_table_size=default;
select distinct fld3,repeat("a",length(fld3)),count(*) from t2 group by companynr,fld3 limit 100,10;
fld3 repeat("a",length(fld3)) count(*)
circus aaaaaa 1
diff --git a/mysql-test/main/select_pkeycache.result b/mysql-test/main/select_pkeycache.result
index 0f84ed684da..ba5ec36430e 100644
--- a/mysql-test/main/select_pkeycache.result
+++ b/mysql-test/main/select_pkeycache.result
@@ -512,7 +512,7 @@ insert into tmp select * from t3;
insert into t3 select * from tmp;
alter table t3 add t2nr int not null auto_increment primary key first;
drop table tmp;
-SET BIG_TABLES=1;
+set tmp_memory_table_size=0;
select distinct concat(fld3," ",fld3) as namn from t2,t3 where t2.fld1=t3.t2nr order by namn limit 10;
namn
Abraham Abraham
@@ -525,7 +525,7 @@ ammonium ammonium
analyzable analyzable
animals animals
animized animized
-SET BIG_TABLES=0;
+set tmp_memory_table_size=default;
select distinct concat(fld3," ",fld3) from t2,t3 where t2.fld1=t3.t2nr order by fld3 limit 10;
concat(fld3," ",fld3)
Abraham Abraham
@@ -562,7 +562,7 @@ attendants 1
bedlam 1
bedpost 1
boasted 1
-SET BIG_TABLES=1;
+set tmp_memory_table_size=0;
select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
fld3 count(*)
affixed 1
@@ -575,7 +575,7 @@ attendants 1
bedlam 1
bedpost 1
boasted 1
-SET BIG_TABLES=0;
+set tmp_memory_table_size=default;
select distinct fld3,repeat("a",length(fld3)),count(*) from t2 group by companynr,fld3 limit 100,10;
fld3 repeat("a",length(fld3)) count(*)
circus aaaaaa 1
diff --git a/mysql-test/main/set_operation.result b/mysql-test/main/set_operation.result
new file mode 100644
index 00000000000..a0210331d93
--- /dev/null
+++ b/mysql-test/main/set_operation.result
@@ -0,0 +1,1157 @@
+create table t1 (a int, b int) engine=MyISAM;
+create table t2 (c int, d int) engine=MyISAM;
+create table t3 (e int, f int) engine=MyISAM;
+create table t4 (g int, h int) engine=MyISAM;
+insert into t1 values (1,1),(2,2),(3,3),(2,2),(3,3);
+insert into t2 values (2,2),(3,3),(5,5),(2,2),(2,2),(3,3);
+insert into t3 values (4,4),(2,2),(2,2),(1,1),(3,3);
+insert into t4 values (2,2),(4,4),(1,1);
+create view v0(g, h) as select a,c from t1,t2;
+# test optimization
+select * from t1
+INTERSECT ALL
+select * from t2
+INTERSECT ALL
+select * from t3;
+a b
+2 2
+2 2
+3 3
+EXPLAIN EXTENDED select * from t1
+INTERSECT ALL
+select * from t2
+INTERSECT ALL
+select * from t3;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00
+2 INTERSECT t2 ALL NULL NULL NULL NULL 6 100.00
+3 INTERSECT t3 ALL NULL NULL NULL NULL 5 100.00
+NULL INTERSECT RESULT <intersect1,2,3> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` intersect all /* select#2 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` intersect all /* select#3 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3`
+select * from t1
+INTERSECT ALL
+select * from t2
+INTERSECT ALL
+select * from t3
+INTERSECT
+select * from t1;
+a b
+2 2
+3 3
+EXPLAIN EXTENDED select * from t1
+INTERSECT ALL
+select * from t2
+INTERSECT ALL
+select * from t3
+INTERSECT
+select * from t1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00
+2 INTERSECT t2 ALL NULL NULL NULL NULL 6 100.00
+3 INTERSECT t3 ALL NULL NULL NULL NULL 5 100.00
+4 INTERSECT t1 ALL NULL NULL NULL NULL 5 100.00
+NULL INTERSECT RESULT <intersect1,2,3,4> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` intersect /* select#2 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` intersect /* select#3 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3` intersect /* select#4 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`
+select * from t1
+INTERSECT ALL
+select * from t2
+INTERSECT ALL
+select * from t3
+EXCEPT ALL
+select * from t4;
+a b
+2 2
+3 3
+EXPLAIN EXTENDED select * from t1
+INTERSECT ALL
+select * from t2
+INTERSECT ALL
+select * from t3
+EXCEPT ALL
+select * from t4;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00
+2 INTERSECT t2 ALL NULL NULL NULL NULL 6 100.00
+3 INTERSECT t3 ALL NULL NULL NULL NULL 5 100.00
+4 EXCEPT t4 ALL NULL NULL NULL NULL 3 100.00
+NULL UNIT RESULT <unit1,2,3,4> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` intersect all /* select#2 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` intersect all /* select#3 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3` except all /* select#4 */ select `test`.`t4`.`g` AS `g`,`test`.`t4`.`h` AS `h` from `test`.`t4`
+select * from t1
+INTERSECT
+select * from t2
+EXCEPT ALL
+select * from t4;
+a b
+3 3
+EXPLAIN EXTENDED select * from t1
+INTERSECT
+select * from t2
+EXCEPT ALL
+select * from t4;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00
+2 INTERSECT t2 ALL NULL NULL NULL NULL 6 100.00
+3 EXCEPT t4 ALL NULL NULL NULL NULL 3 100.00
+NULL UNIT RESULT <unit1,2,3> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` intersect /* select#2 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` except /* select#3 */ select `test`.`t4`.`g` AS `g`,`test`.`t4`.`h` AS `h` from `test`.`t4`
+insert into t4 values (1,1),(9,9);
+select * from t1
+UNION ALL
+select * from t2
+UNION ALL
+select * from t3
+EXCEPT
+select * from t4;
+a b
+3 3
+5 5
+EXPLAIN EXTENDED select * from t1
+UNION ALL
+select * from t2
+UNION ALL
+select * from t3
+EXCEPT
+select * from t4;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00
+2 UNION t2 ALL NULL NULL NULL NULL 6 100.00
+3 UNION t3 ALL NULL NULL NULL NULL 5 100.00
+4 EXCEPT t4 ALL NULL NULL NULL NULL 5 100.00
+NULL UNIT RESULT <unit1,2,3,4> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` union /* select#2 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` union /* select#3 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3` except /* select#4 */ select `test`.`t4`.`g` AS `g`,`test`.`t4`.`h` AS `h` from `test`.`t4`
+delete from t4;
+insert into t4 values (3,3),(3,3);
+select * from t1
+INTERSECT ALL
+select * from t2
+UNION ALL
+select * from t3
+EXCEPT ALL
+select * from t1
+UNION
+select * from t4
+EXCEPT
+select * from t3
+UNION ALL
+select * from t1;
+a b
+2 2
+2 2
+1 1
+3 3
+3 3
+EXPLAIN EXTENDED select * from t1
+INTERSECT ALL
+select * from t2
+UNION ALL
+select * from t3
+EXCEPT ALL
+select * from t1
+UNION
+select * from t4
+EXCEPT
+select * from t3
+UNION ALL
+select * from t1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00
+2 INTERSECT t2 ALL NULL NULL NULL NULL 6 100.00
+3 UNION t3 ALL NULL NULL NULL NULL 5 100.00
+4 EXCEPT t1 ALL NULL NULL NULL NULL 5 100.00
+5 UNION t4 ALL NULL NULL NULL NULL 2 100.00
+6 EXCEPT t3 ALL NULL NULL NULL NULL 5 100.00
+7 UNION t1 ALL NULL NULL NULL NULL 5 100.00
+NULL UNIT RESULT <unit1,2,3,4,5,6,7> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` intersect all /* select#2 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` union all /* select#3 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3` except all /* select#4 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` union /* select#5 */ select `test`.`t4`.`g` AS `g`,`test`.`t4`.`h` AS `h` from `test`.`t4` except /* select#6 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3` union all /* select#7 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`
+drop table t4;
+# test optimization with brackets
+(
+(select 1 except select 5 union all select 6)
+union
+(select 2 intersect all select 3 intersect all select 4)
+except
+(select 7 intersect all select 8)
+)
+union all
+(select 9 union all select 10)
+except all
+select 11;
+1
+1
+6
+9
+10
+EXPLAIN EXTENDED (
+(select 1 except select 5 union all select 6)
+union
+(select 2 intersect all select 3 intersect all select 4)
+except
+(select 7 intersect all select 8)
+)
+union all
+(select 9 union all select 10)
+except all
+select 11;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY <derived8> ALL NULL NULL NULL NULL 4 100.00
+8 DERIVED <derived2> ALL NULL NULL NULL NULL 2 100.00
+2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+3 EXCEPT NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+4 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+NULL UNIT RESULT <unit2,3,4> ALL NULL NULL NULL NULL NULL NULL
+9 UNION <derived5> ALL NULL NULL NULL NULL 2 100.00
+5 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+6 INTERSECT NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+7 INTERSECT NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+NULL INTERSECT RESULT <intersect5,6,7> ALL NULL NULL NULL NULL NULL NULL
+12 EXCEPT <derived10> ALL NULL NULL NULL NULL 2 100.00
+10 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+11 INTERSECT NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+NULL INTERSECT RESULT <intersect10,11> ALL NULL NULL NULL NULL NULL NULL
+NULL UNIT RESULT <unit8,9,12> ALL NULL NULL NULL NULL NULL NULL
+15 UNION <derived13> ALL NULL NULL NULL NULL 2 100.00
+13 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+14 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+16 EXCEPT NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+NULL UNIT RESULT <unit1,15,16> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 /* select#1 */ select `__14`.`1` AS `1` from (/* select#8 */ select `__7`.`1` AS `1` from (/* select#2 */ select 1 AS `1` except /* select#3 */ select 5 AS `5` union /* select#4 */ select 6 AS `6`) `__7` union /* select#9 */ select `__8`.`2` AS `2` from (/* select#5 */ select 2 AS `2` intersect /* select#6 */ select 3 AS `3` intersect /* select#7 */ select 4 AS `4`) `__8` except /* select#12 */ select `__11`.`7` AS `7` from (/* select#10 */ select 7 AS `7` intersect /* select#11 */ select 8 AS `8`) `__11`) `__14` union all /* select#15 */ select `__15`.`9` AS `9` from (/* select#13 */ select 9 AS `9` union all /* select#14 */ select 10 AS `10`) `__15` except all /* select#16 */ select 11 AS `11`
+(select 1 union all select 2)
+union
+(select 3 union all select 4);
+1
+1
+2
+3
+4
+EXPLAIN EXTENDED (select 1 union all select 2)
+union
+(select 3 union all select 4);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00
+2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+6 UNION <derived4> ALL NULL NULL NULL NULL 2 100.00
+4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+5 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+NULL UNION RESULT <union1,6> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 /* select#1 */ select `__5`.`1` AS `1` from (/* select#2 */ select 1 AS `1` union /* select#3 */ select 2 AS `2`) `__5` union /* select#6 */ select `__6`.`3` AS `3` from (/* select#4 */ select 3 AS `3` union /* select#5 */ select 4 AS `4`) `__6`
+(select 1 intersect all select 2)
+except
+select 3;
+1
+EXPLAIN EXTENDED (select 1 intersect all select 2)
+except
+select 3;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00
+2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+3 INTERSECT NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL NULL
+4 EXCEPT NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+NULL EXCEPT RESULT <except1,4> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 /* select#1 */ select `__4`.`1` AS `1` from (/* select#2 */ select 1 AS `1` intersect /* select#3 */ select 2 AS `2`) `__4` except /* select#4 */ select 3 AS `3`
+(select 1 intersect all select 2 intersect all select 3)
+intersect
+(select 4 intersect all select 5);
+1
+EXPLAIN EXTENDED (select 1 intersect all select 2 intersect all select 3)
+intersect
+(select 4 intersect all select 5);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00
+2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+3 INTERSECT NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+4 INTERSECT NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+NULL INTERSECT RESULT <intersect2,3,4> ALL NULL NULL NULL NULL NULL NULL
+7 INTERSECT <derived5> ALL NULL NULL NULL NULL 2 100.00
+5 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+6 INTERSECT NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+NULL INTERSECT RESULT <intersect5,6> ALL NULL NULL NULL NULL NULL NULL
+NULL INTERSECT RESULT <intersect1,7> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 /* select#1 */ select `__6`.`1` AS `1` from (/* select#2 */ select 1 AS `1` intersect /* select#3 */ select 2 AS `2` intersect /* select#4 */ select 3 AS `3`) `__6` intersect /* select#7 */ select `__7`.`4` AS `4` from (/* select#5 */ select 4 AS `4` intersect /* select#6 */ select 5 AS `5`) `__7`
+# test set operations with table value constructor
+(values (1,1),(1,1),(1,1),(2,2),(2,2),(3,3),(9,9))
+INTERSECT ALL
+(values (1,1),(2,2),(2,2),(3,3),(3,3),(3,3),(8,8))
+EXCEPT ALL
+(values (7,7),(1,1));
+1 1
+2 2
+2 2
+3 3
+delete from t1;
+insert into t1 values(1,1),(1,1),(2,2),(4,4),(9,9);
+select * from t1
+UNION ALL
+(values (11,12),(3,3),(2,2),(3,3),(4,4),(8,8))
+INTERSECT
+(values (13,14),(7,7),(2,2),(3,3),(1,1))
+INTERSECT ALL
+(values (15,16),(2,2),(1,1))
+EXCEPT
+(values (17,18),(1,1));
+a b
+2 2
+4 4
+9 9
+# test set operations with derived table
+select * from (
+select * from t1
+UNION ALL
+select * from t2
+)dt1
+INTERSECT ALL
+select * from (
+select * from t2
+EXCEPT ALL
+select * from t3
+)dt2;
+a b
+2 2
+3 3
+5 5
+select * from (
+select * from t1
+UNION ALL
+select * from t3
+)dt1
+EXCEPT ALL
+select * from (
+select * from t2
+INTERSECT ALL
+select * from t2
+)dt2;
+a b
+1 1
+1 1
+4 4
+9 9
+1 1
+4 4
+SELECT * from(
+select * from (
+select * from t1
+UNION ALL
+select * from t2
+)dt1
+INTERSECT ALL
+select * from (
+select * from t2
+EXCEPT ALL
+select * from t3
+)dt2
+)dt3;
+a b
+2 2
+3 3
+5 5
+# integration test
+select * from t1
+UNION ALL
+select * from t2
+INTERSECT ALL
+(values (1,1), (2,2), (2,2), (5,5), (2,2))
+INTERSECT ALL
+select * from (select * from t1 union all select * from t1) sq
+EXCEPT ALL
+select * from t3
+UNION ALL
+select * from t2
+UNION
+select * from t3
+EXCEPT
+select a,c from t1,t2
+UNION ALL
+select * from v0 where g < 4
+UNION ALL
+select * from t3;
+a b
+1 1
+1 2
+3 3
+9 9
+5 5
+4 4
+1 2
+2 2
+1 3
+1 3
+2 3
+1 5
+1 5
+2 5
+1 2
+1 2
+2 2
+1 2
+1 2
+2 2
+1 3
+1 3
+2 3
+4 4
+2 2
+2 2
+1 1
+3 3
+select * from t1
+UNION ALL
+select * from t2
+INTERSECT ALL
+(values (1,1), (2,2), (2,2), (5,5), (2,2))
+INTERSECT ALL
+select * from (select * from t1 union all select * from t1) sq
+EXCEPT ALL
+select * from t3
+UNION ALL
+select * from t2
+UNION
+select * from t3
+EXCEPT
+select a,c from t1,t2
+UNION ALL
+select * from v0 where g < 4
+UNION ALL
+select * from t3
+ORDER BY a;
+a b
+1 1
+1 1
+1 2
+1 2
+1 2
+1 2
+1 2
+1 2
+1 3
+1 3
+1 3
+1 3
+1 5
+1 5
+2 2
+2 2
+2 2
+2 2
+2 2
+2 3
+2 3
+2 5
+3 3
+3 3
+4 4
+4 4
+5 5
+9 9
+select * from (
+select * from t1
+UNION ALL
+select * from t2
+INTERSECT ALL
+(values (1,1), (2,2), (2,2), (5,5), (2,2) )
+INTERSECT ALL
+select * from (select * from t1 union all select * from t1) sq
+EXCEPT ALL
+select * from t3
+UNION ALL
+select * from t2
+UNION
+select * from t3
+EXCEPT
+select a,c from t1,t2
+UNION ALL
+select * from v0 where g < 4
+UNION ALL
+select * from t3
+) dt;
+a b
+1 1
+1 2
+3 3
+9 9
+5 5
+4 4
+1 2
+2 2
+1 3
+1 3
+2 3
+1 5
+1 5
+2 5
+1 2
+1 2
+2 2
+1 2
+1 2
+2 2
+1 3
+1 3
+2 3
+4 4
+2 2
+2 2
+1 1
+3 3
+EXPLAIN
+select * from t1
+UNION ALL
+select * from t2
+INTERSECT ALL
+(values (1,1), (2,2), (2,2), (5,5), (2,2) )
+INTERSECT ALL
+select * from (select * from t1 union all select * from t1) sq
+EXCEPT ALL
+select * from t3
+UNION ALL
+select * from t2
+UNION
+select * from t3
+EXCEPT
+select a,c from t1,t2
+UNION ALL
+select * from v0 where g < 4
+UNION ALL
+select * from t3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 5
+8 UNION <derived2> ALL NULL NULL NULL NULL 5
+2 DERIVED t2 ALL NULL NULL NULL NULL 6
+3 INTERSECT NULL NULL NULL NULL NULL NULL NULL No tables used
+4 INTERSECT <derived5> ALL NULL NULL NULL NULL 10
+5 DERIVED t1 ALL NULL NULL NULL NULL 5
+6 UNION t1 ALL NULL NULL NULL NULL 5
+NULL INTERSECT RESULT <intersect2,3,4> ALL NULL NULL NULL NULL NULL
+7 EXCEPT t3 ALL NULL NULL NULL NULL 5
+9 UNION t2 ALL NULL NULL NULL NULL 6
+10 UNION t3 ALL NULL NULL NULL NULL 5
+11 EXCEPT t1 ALL NULL NULL NULL NULL 5
+11 EXCEPT t2 ALL NULL NULL NULL NULL 6 Using join buffer (flat, BNL join)
+12 UNION t1 ALL NULL NULL NULL NULL 5 Using where
+12 UNION t2 ALL NULL NULL NULL NULL 6 Using join buffer (flat, BNL join)
+13 UNION t3 ALL NULL NULL NULL NULL 5
+NULL UNIT RESULT <unit1,8,7,9,10,11,12,13> ALL NULL NULL NULL NULL NULL
+EXPLAIN format=json
+select * from t1
+UNION ALL
+select * from t2
+INTERSECT ALL
+(values (1,1), (2,2), (2,2), (5,5), (2,2) )
+INTERSECT ALL
+select * from (select * from t1 union all select * from t1) sq
+EXCEPT ALL
+select * from t3
+UNION ALL
+select * from t2
+UNION
+select * from t3
+EXCEPT
+select a,c from t1,t2
+UNION ALL
+select * from v0 where g < 4
+UNION ALL
+select * from t3;
+EXPLAIN
+{
+ "query_block": {
+ "union_result": {
+ "table_name": "<unit1,8,7,9,10,11,12,13>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 8,
+ "operation": "UNION",
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<intersect2,3,4>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 6,
+ "filtered": 100
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "INTERSECT",
+ "table": {
+ "message": "No tables used"
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 4,
+ "operation": "INTERSECT",
+ "table": {
+ "table_name": "<derived5>",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<union5,6>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 5,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 6,
+ "operation": "UNION",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 7,
+ "operation": "EXCEPT",
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 9,
+ "operation": "UNION",
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 6,
+ "filtered": 100
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 10,
+ "operation": "UNION",
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 11,
+ "operation": "EXCEPT",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 6,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "65",
+ "join_type": "BNL"
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 12,
+ "operation": "UNION",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a < 4"
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 6,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "65",
+ "join_type": "BNL"
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 13,
+ "operation": "UNION",
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100
+ }
+ }
+ }
+ ]
+ }
+ }
+}
+EXPLAIN EXTENDED
+select * from t1
+UNION ALL
+select * from t2
+INTERSECT ALL
+(values (1,1), (2,2), (2,2), (5,5), (2,2) )
+INTERSECT ALL
+select * from (select * from t1 union all select * from t1) sq
+EXCEPT ALL
+select * from t3
+UNION ALL
+select * from t2
+UNION
+select * from t3
+EXCEPT
+select a,c from t1,t2
+UNION ALL
+select * from v0 where g < 4
+UNION ALL
+select * from t3;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00
+8 UNION <derived2> ALL NULL NULL NULL NULL 5 100.00
+2 DERIVED t2 ALL NULL NULL NULL NULL 6 100.00
+3 INTERSECT NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+4 INTERSECT <derived5> ALL NULL NULL NULL NULL 10 100.00
+5 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00
+6 UNION t1 ALL NULL NULL NULL NULL 5 100.00
+NULL INTERSECT RESULT <intersect2,3,4> ALL NULL NULL NULL NULL NULL NULL
+7 EXCEPT t3 ALL NULL NULL NULL NULL 5 100.00
+9 UNION t2 ALL NULL NULL NULL NULL 6 100.00
+10 UNION t3 ALL NULL NULL NULL NULL 5 100.00
+11 EXCEPT t1 ALL NULL NULL NULL NULL 5 100.00
+11 EXCEPT t2 ALL NULL NULL NULL NULL 6 100.00 Using join buffer (flat, BNL join)
+12 UNION t1 ALL NULL NULL NULL NULL 5 100.00 Using where
+12 UNION t2 ALL NULL NULL NULL NULL 6 100.00 Using join buffer (flat, BNL join)
+13 UNION t3 ALL NULL NULL NULL NULL 5 100.00
+NULL UNIT RESULT <unit1,8,7,9,10,11,12,13> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` union all /* select#8 */ select `__8`.`c` AS `c`,`__8`.`d` AS `d` from (/* select#2 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` intersect all (values (1,1),(2,2),(2,2),(5,5),(2,2)) intersect all /* select#4 */ select `sq`.`a` AS `a`,`sq`.`b` AS `b` from (/* select#5 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` union all /* select#6 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) `sq`) `__8` except all /* select#7 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3` union /* select#9 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` union /* select#10 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3` except /* select#11 */ select `test`.`t1`.`a` AS `a`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` union all /* select#12 */ select `test`.`t1`.`a` AS `g`,`test`.`t2`.`c` AS `h` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` < 4 union all /* select#13 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3`
+PREPARE stmt from"
+ select * from t1
+ UNION ALL
+ select * from t2
+ INTERSECT ALL
+ (values (1,1), (2,2), (2,2), (5,5), (2,2) )
+ INTERSECT ALL
+ select * from (select * from t1 union all select * from t1) sq
+ EXCEPT ALL
+ select * from t3
+ UNION ALL
+ select * from t2
+ UNION
+ select * from t3
+ EXCEPT
+ select a,c from t1,t2
+ UNION ALL
+ select * from v0 where g < 4
+ UNION ALL
+ select * from t3
+";
+EXECUTE stmt;
+a b
+1 1
+1 2
+3 3
+9 9
+5 5
+4 4
+1 2
+2 2
+1 3
+1 3
+2 3
+1 5
+1 5
+2 5
+1 2
+1 2
+2 2
+1 2
+1 2
+2 2
+1 3
+1 3
+2 3
+4 4
+2 2
+2 2
+1 1
+3 3
+EXECUTE stmt;
+a b
+1 1
+1 2
+3 3
+9 9
+5 5
+4 4
+1 2
+2 2
+1 3
+1 3
+2 3
+1 5
+1 5
+2 5
+1 2
+1 2
+2 2
+1 2
+1 2
+2 2
+1 3
+1 3
+2 3
+4 4
+2 2
+2 2
+1 1
+3 3
+deallocate prepare stmt;
+create view v1(i1, i2) as
+select * from t1
+UNION ALL
+select * from t2
+INTERSECT ALL
+(values (1,1), (2,2), (2,2), (5,5), (2,2) )
+INTERSECT ALL
+select * from (select * from t1 union all select * from t1) sq
+EXCEPT ALL
+select * from t3
+UNION ALL
+select * from t2
+UNION
+select * from t3
+EXCEPT
+select a,c from t1,t2
+UNION ALL
+select * from v0 where g < 4
+UNION ALL
+select * from t3;
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`a` AS `i1`,`test`.`t1`.`b` AS `i2` from `test`.`t1` union all select `__9`.`c` AS `c`,`__9`.`d` AS `d` from (select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` intersect all (values (1,1),(2,2),(2,2),(5,5),(2,2)) intersect all select `sq`.`a` AS `a`,`sq`.`b` AS `b` from (select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` union all select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) `sq`) `__9` except all select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3` union all select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` union select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3` except select `test`.`t1`.`a` AS `a`,`test`.`t2`.`c` AS `c` from (`test`.`t1` join `test`.`t2`) union all select `v0`.`g` AS `g`,`v0`.`h` AS `h` from `test`.`v0` where `v0`.`g` < 4 union all select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3` latin1 latin1_swedish_ci
+select * from v1 limit 14;
+i1 i2
+1 1
+1 2
+3 3
+9 9
+5 5
+4 4
+1 2
+2 2
+1 3
+1 3
+2 3
+1 5
+1 5
+2 5
+select * from v1 order by i1 limit 14;
+i1 i2
+1 1
+1 1
+1 2
+1 2
+1 2
+1 2
+1 2
+1 2
+1 3
+1 3
+1 3
+1 3
+1 5
+1 5
+drop table t1,t2,t3;
+drop view v0,v1;
+# compare result
+create table t1 (a int, b int);
+create table t2 (c int, d int);
+create table t3 (e int, f int);
+create table t4 (g int, h int);
+insert into t1 values (1,1),(1,1),(2,2);
+insert into t2 values (1,1),(1,1),(2,2),(3,3);
+insert into t3 values (1,1);
+insert into t4 values (4,4);
+select * from t1 intersect all select * from t2 except select * from t3 union select * from t4;
+a b
+4 4
+2 2
+select * from t1 intersect all select * from t2 except ALL select * from t3 union select * from t4;
+a b
+1 1
+2 2
+4 4
+select * from t1 intersect DISTINCT select * from t2 except select * from t3 union select * from t4;
+a b
+4 4
+2 2
+select * from t1 intersect DISTINCT select * from t2 except ALL select * from t3 union select * from t4;
+a b
+4 4
+2 2
+delete from t1;
+delete from t2;
+delete from t3;
+delete from t4;
+insert into t1 values (1,1),(1,1),(1,1),(2,2),(2,2),(4,4),(5,5);
+insert into t2 values (1,1),(1,1),(1,1),(2,2),(2,2),(3,3);
+insert into t3 values (1,1),(2,2),(2,2);
+select * from t1 intersect all select * from t2 intersect all select * from t3;
+a b
+1 1
+2 2
+2 2
+select * from t1 intersect all select * from t2 intersect select * from t3;
+a b
+1 1
+2 2
+select * from t1 intersect all select * from t1 intersect all select * from t2 intersect select * from t3;
+a b
+1 1
+2 2
+delete from t1;
+delete from t2;
+delete from t3;
+insert into t1 values (1,1),(1,1),(2,2);
+insert into t2 values (1,1),(1,1),(2,2),(3,3);
+insert into t3 values (1,1),(5,5);
+insert into t4 values (4,4),(4,4),(4,4);
+select * from t1 intersect all select * from t2 union all select * from t3 union select * from t4;
+a b
+1 1
+2 2
+5 5
+4 4
+select * from t1 intersect DISTINCT select * from t2 union DISTINCT select * from t3 union select * from t4;
+a b
+1 1
+2 2
+5 5
+4 4
+select * from t1 intersect all select * from t2 intersect all select * from t3 union select * from t4;
+a b
+1 1
+4 4
+select * from t1 intersect all select * from t2 intersect DISTINCT select * from t3 union select * from t4;
+a b
+1 1
+4 4
+select * from t1 intersect DISTINCT select * from t2 intersect DISTINCT select * from t3 union select * from t4;
+a b
+1 1
+4 4
+select * from t1 intersect all select * from t2 EXCEPT select * from t3 union select * from t4;
+a b
+4 4
+2 2
+select * from t1 intersect DISTINCT select * from t2 EXCEPT select * from t3 union select * from t4;
+a b
+4 4
+2 2
+select * from t1 intersect all select * from t2 EXCEPT ALL select * from t3 union select * from t4;
+a b
+1 1
+2 2
+4 4
+select * from t1 EXCEPT select * from t2 union all select * from t3 union select * from t4;
+a b
+5 5
+1 1
+4 4
+select * from t1 EXCEPT select * from t2 union DISTINCT select * from t3 union select * from t4;
+a b
+5 5
+1 1
+4 4
+delete from t1;
+delete from t2;
+delete from t3;
+delete from t4;
+insert into t1 values (1,1),(2,2);
+insert into t2 values (1,1),(2,2);
+insert into t3 values (1,1),(3,3);
+select * from t1 union all select * from t2 except all select * from t3;
+a b
+1 1
+2 2
+2 2
+select * from t1 union all select * from t2 except DISTINCT select * from t3;
+a b
+2 2
+select * from t1 union DISTINCT select * from t2 except all select * from t3;
+a b
+2 2
+select * from t1 union DISTINCT select * from t2 except DISTINCT select * from t3;
+a b
+2 2
+drop table t1;
+drop table t2;
+drop table t3;
+drop table t4;
+select 1 intersect all select 2 intersect all select 3 intersect select 4 union select 5;
+1
+5
+select 1 intersect all select 2 intersect all select 3 union select 4 except select 5;
+1
+4
+select 1 union select 2 except all select 3 union select 4;
+1
+1
+2
+4
+select 1 union all select 2 union all select 3 union select 4;
+1
+1
+2
+3
+4
+# test with limited resource
+set @@max_heap_table_size= 1024;
+Warnings:
+Warning 1292 Truncated incorrect max_heap_table_size value: '1024'
+set @@tmp_table_size= 1024;
+create table t1 (a int, b int);
+insert into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(0,0);
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select a+100, b+100 from t1;
+create table t2 (a int, b int);
+insert into t2 values (10,10),(11,11),(12,12),(13,13),(14,14),(5,5),(6,6),(7,7),(8,8),(9,9);
+insert into t2 select * from t2;
+insert into t2 select * from t2;
+insert into t2 select * from t2;
+insert into t2 select a+100, b+100 from t2;
+select count(*) from
+(
+select * from t1
+INTERSECT ALL
+select * from t2
+) c;
+count(*)
+80
+select count(*) from
+(
+select * from t1
+EXCEPT ALL
+select * from t2
+) c;
+count(*)
+80
+select count(*) from
+(
+select * from t1
+INTERSECT ALL
+select * from t2
+UNION ALL
+select * from t1
+EXCEPT ALL
+select * from t2
+) c;
+count(*)
+160
+delete from t1;
+delete from t2;
+insert into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(0,0);
+insert into t1 select a+10, b+10 from t1;
+insert into t1 select a+20, b+20 from t1;
+insert into t1 select a+40, b+40 from t1;
+insert into t1 select a+80, b+80 from t1;
+insert into t2 values (1110,1110),(1111,1111),(1112,1112),(1113,1113),(1114,1114),(1105,1105),(1106,1106),(1107,1107),(1108,1108),(1109,1109);
+insert into t2 select a+10, b+10 from t2;
+insert into t2 select a+20, b+20 from t2;
+insert into t2 select a+40, b+40 from t2;
+insert into t2 select a+80, b+80 from t2;
+select count(*) from
+(
+select * from t1
+UNION ALL
+select * from t2
+EXCEPT ALL
+values (1,1)
+) c;
+count(*)
+319
+drop table t1;
+drop table t2;
diff --git a/mysql-test/main/set_operation.test b/mysql-test/main/set_operation.test
new file mode 100644
index 00000000000..c43725c733e
--- /dev/null
+++ b/mysql-test/main/set_operation.test
@@ -0,0 +1,526 @@
+create table t1 (a int, b int) engine=MyISAM;
+create table t2 (c int, d int) engine=MyISAM;
+create table t3 (e int, f int) engine=MyISAM;
+create table t4 (g int, h int) engine=MyISAM;
+insert into t1 values (1,1),(2,2),(3,3),(2,2),(3,3);
+insert into t2 values (2,2),(3,3),(5,5),(2,2),(2,2),(3,3);
+insert into t3 values (4,4),(2,2),(2,2),(1,1),(3,3);
+insert into t4 values (2,2),(4,4),(1,1);
+create view v0(g, h) as select a,c from t1,t2;
+
+--echo # test optimization
+
+let $q=
+ select * from t1
+ INTERSECT ALL
+ select * from t2
+ INTERSECT ALL
+ select * from t3;
+eval $q;
+eval EXPLAIN EXTENDED $q;
+
+let $q=
+ select * from t1
+ INTERSECT ALL
+ select * from t2
+ INTERSECT ALL
+ select * from t3
+ INTERSECT
+ select * from t1;
+eval $q;
+eval EXPLAIN EXTENDED $q;
+
+let $q=
+ select * from t1
+ INTERSECT ALL
+ select * from t2
+ INTERSECT ALL
+ select * from t3
+ EXCEPT ALL
+ select * from t4;
+eval $q;
+eval EXPLAIN EXTENDED $q;
+
+let $q=
+ select * from t1
+ INTERSECT
+ select * from t2
+ EXCEPT ALL
+ select * from t4;
+eval $q;
+eval EXPLAIN EXTENDED $q;
+
+insert into t4 values (1,1),(9,9);
+let $q=
+ select * from t1
+ UNION ALL
+ select * from t2
+ UNION ALL
+ select * from t3
+ EXCEPT
+ select * from t4;
+eval $q;
+eval EXPLAIN EXTENDED $q;
+
+delete from t4;
+insert into t4 values (3,3),(3,3);
+let $q=
+ select * from t1
+ INTERSECT ALL
+ select * from t2
+ UNION ALL
+ select * from t3
+ EXCEPT ALL
+ select * from t1
+ UNION
+ select * from t4
+ EXCEPT
+ select * from t3
+ UNION ALL
+ select * from t1;
+
+eval $q;
+eval EXPLAIN EXTENDED $q;
+drop table t4;
+
+--echo # test optimization with brackets
+
+let $q=
+(
+ (select 1 except select 5 union all select 6)
+ union
+ (select 2 intersect all select 3 intersect all select 4)
+ except
+ (select 7 intersect all select 8)
+)
+ union all
+(select 9 union all select 10)
+ except all
+select 11;
+eval $q;
+eval EXPLAIN EXTENDED $q;
+
+let $q=
+(select 1 union all select 2)
+ union
+(select 3 union all select 4);
+eval $q;
+eval EXPLAIN EXTENDED $q;
+
+let $q=
+(select 1 intersect all select 2)
+ except
+select 3;
+eval $q;
+eval EXPLAIN EXTENDED $q;
+
+let $q=
+(select 1 intersect all select 2 intersect all select 3)
+ intersect
+(select 4 intersect all select 5);
+eval $q;
+eval EXPLAIN EXTENDED $q;
+
+
+--echo # test set operations with table value constructor
+
+(values (1,1),(1,1),(1,1),(2,2),(2,2),(3,3),(9,9))
+INTERSECT ALL
+(values (1,1),(2,2),(2,2),(3,3),(3,3),(3,3),(8,8))
+EXCEPT ALL
+(values (7,7),(1,1));
+
+delete from t1;
+insert into t1 values(1,1),(1,1),(2,2),(4,4),(9,9);
+
+select * from t1
+UNION ALL
+(values (11,12),(3,3),(2,2),(3,3),(4,4),(8,8))
+INTERSECT
+(values (13,14),(7,7),(2,2),(3,3),(1,1))
+INTERSECT ALL
+(values (15,16),(2,2),(1,1))
+EXCEPT
+(values (17,18),(1,1));
+
+--echo # test set operations with derived table
+
+select * from (
+ select * from t1
+ UNION ALL
+ select * from t2
+)dt1
+INTERSECT ALL
+select * from (
+ select * from t2
+ EXCEPT ALL
+ select * from t3
+)dt2;
+
+select * from (
+ select * from t1
+ UNION ALL
+ select * from t3
+)dt1
+EXCEPT ALL
+select * from (
+ select * from t2
+ INTERSECT ALL
+ select * from t2
+)dt2;
+
+SELECT * from(
+ select * from (
+ select * from t1
+ UNION ALL
+ select * from t2
+ )dt1
+ INTERSECT ALL
+ select * from (
+ select * from t2
+ EXCEPT ALL
+ select * from t3
+ )dt2
+)dt3;
+
+--echo # integration test
+
+
+select * from t1
+UNION ALL
+select * from t2
+INTERSECT ALL
+(values (1,1), (2,2), (2,2), (5,5), (2,2))
+INTERSECT ALL
+select * from (select * from t1 union all select * from t1) sq
+EXCEPT ALL
+select * from t3
+UNION ALL
+select * from t2
+UNION
+select * from t3
+EXCEPT
+select a,c from t1,t2
+UNION ALL
+select * from v0 where g < 4
+UNION ALL
+select * from t3;
+
+--sorted_result
+select * from t1
+UNION ALL
+select * from t2
+INTERSECT ALL
+(values (1,1), (2,2), (2,2), (5,5), (2,2))
+INTERSECT ALL
+select * from (select * from t1 union all select * from t1) sq
+EXCEPT ALL
+select * from t3
+UNION ALL
+select * from t2
+UNION
+select * from t3
+EXCEPT
+select a,c from t1,t2
+UNION ALL
+select * from v0 where g < 4
+UNION ALL
+select * from t3
+ORDER BY a;
+
+
+select * from (
+ select * from t1
+ UNION ALL
+ select * from t2
+ INTERSECT ALL
+ (values (1,1), (2,2), (2,2), (5,5), (2,2) )
+ INTERSECT ALL
+ select * from (select * from t1 union all select * from t1) sq
+ EXCEPT ALL
+ select * from t3
+ UNION ALL
+ select * from t2
+ UNION
+ select * from t3
+ EXCEPT
+ select a,c from t1,t2
+ UNION ALL
+ select * from v0 where g < 4
+ UNION ALL
+ select * from t3
+) dt;
+
+EXPLAIN
+select * from t1
+UNION ALL
+select * from t2
+INTERSECT ALL
+(values (1,1), (2,2), (2,2), (5,5), (2,2) )
+INTERSECT ALL
+select * from (select * from t1 union all select * from t1) sq
+EXCEPT ALL
+select * from t3
+UNION ALL
+select * from t2
+UNION
+select * from t3
+EXCEPT
+select a,c from t1,t2
+UNION ALL
+select * from v0 where g < 4
+UNION ALL
+select * from t3;
+
+EXPLAIN format=json
+select * from t1
+UNION ALL
+select * from t2
+INTERSECT ALL
+(values (1,1), (2,2), (2,2), (5,5), (2,2) )
+INTERSECT ALL
+select * from (select * from t1 union all select * from t1) sq
+EXCEPT ALL
+select * from t3
+UNION ALL
+select * from t2
+UNION
+select * from t3
+EXCEPT
+select a,c from t1,t2
+UNION ALL
+select * from v0 where g < 4
+UNION ALL
+select * from t3;
+
+EXPLAIN EXTENDED
+select * from t1
+UNION ALL
+select * from t2
+INTERSECT ALL
+(values (1,1), (2,2), (2,2), (5,5), (2,2) )
+INTERSECT ALL
+select * from (select * from t1 union all select * from t1) sq
+EXCEPT ALL
+select * from t3
+UNION ALL
+select * from t2
+UNION
+select * from t3
+EXCEPT
+select a,c from t1,t2
+UNION ALL
+select * from v0 where g < 4
+UNION ALL
+select * from t3;
+
+PREPARE stmt from"
+ select * from t1
+ UNION ALL
+ select * from t2
+ INTERSECT ALL
+ (values (1,1), (2,2), (2,2), (5,5), (2,2) )
+ INTERSECT ALL
+ select * from (select * from t1 union all select * from t1) sq
+ EXCEPT ALL
+ select * from t3
+ UNION ALL
+ select * from t2
+ UNION
+ select * from t3
+ EXCEPT
+ select a,c from t1,t2
+ UNION ALL
+ select * from v0 where g < 4
+ UNION ALL
+ select * from t3
+";
+
+
+EXECUTE stmt;
+
+EXECUTE stmt;
+deallocate prepare stmt;
+
+create view v1(i1, i2) as
+ select * from t1
+ UNION ALL
+ select * from t2
+ INTERSECT ALL
+ (values (1,1), (2,2), (2,2), (5,5), (2,2) )
+ INTERSECT ALL
+ select * from (select * from t1 union all select * from t1) sq
+ EXCEPT ALL
+ select * from t3
+ UNION ALL
+ select * from t2
+ UNION
+ select * from t3
+ EXCEPT
+ select a,c from t1,t2
+ UNION ALL
+ select * from v0 where g < 4
+ UNION ALL
+ select * from t3;
+
+show create view v1;
+
+select * from v1 limit 14;
+--sorted_result
+select * from v1 order by i1 limit 14;
+
+drop table t1,t2,t3;
+drop view v0,v1;
+
+--echo # compare result
+
+create table t1 (a int, b int);
+create table t2 (c int, d int);
+create table t3 (e int, f int);
+create table t4 (g int, h int);
+
+
+insert into t1 values (1,1),(1,1),(2,2);
+insert into t2 values (1,1),(1,1),(2,2),(3,3);
+insert into t3 values (1,1);
+insert into t4 values (4,4);
+
+select * from t1 intersect all select * from t2 except select * from t3 union select * from t4;
+select * from t1 intersect all select * from t2 except ALL select * from t3 union select * from t4;
+
+select * from t1 intersect DISTINCT select * from t2 except select * from t3 union select * from t4;
+select * from t1 intersect DISTINCT select * from t2 except ALL select * from t3 union select * from t4;
+
+delete from t1;
+delete from t2;
+delete from t3;
+delete from t4;
+
+
+insert into t1 values (1,1),(1,1),(1,1),(2,2),(2,2),(4,4),(5,5);
+insert into t2 values (1,1),(1,1),(1,1),(2,2),(2,2),(3,3);
+insert into t3 values (1,1),(2,2),(2,2);
+
+select * from t1 intersect all select * from t2 intersect all select * from t3;
+select * from t1 intersect all select * from t2 intersect select * from t3;
+select * from t1 intersect all select * from t1 intersect all select * from t2 intersect select * from t3;
+
+delete from t1;
+delete from t2;
+delete from t3;
+
+
+insert into t1 values (1,1),(1,1),(2,2);
+insert into t2 values (1,1),(1,1),(2,2),(3,3);
+insert into t3 values (1,1),(5,5);
+insert into t4 values (4,4),(4,4),(4,4);
+
+select * from t1 intersect all select * from t2 union all select * from t3 union select * from t4;
+select * from t1 intersect DISTINCT select * from t2 union DISTINCT select * from t3 union select * from t4;
+
+select * from t1 intersect all select * from t2 intersect all select * from t3 union select * from t4;
+select * from t1 intersect all select * from t2 intersect DISTINCT select * from t3 union select * from t4;
+select * from t1 intersect DISTINCT select * from t2 intersect DISTINCT select * from t3 union select * from t4;
+
+select * from t1 intersect all select * from t2 EXCEPT select * from t3 union select * from t4;
+select * from t1 intersect DISTINCT select * from t2 EXCEPT select * from t3 union select * from t4;
+select * from t1 intersect all select * from t2 EXCEPT ALL select * from t3 union select * from t4;
+
+select * from t1 EXCEPT select * from t2 union all select * from t3 union select * from t4;
+select * from t1 EXCEPT select * from t2 union DISTINCT select * from t3 union select * from t4;
+
+delete from t1;
+delete from t2;
+delete from t3;
+delete from t4;
+
+
+insert into t1 values (1,1),(2,2);
+insert into t2 values (1,1),(2,2);
+insert into t3 values (1,1),(3,3);
+
+select * from t1 union all select * from t2 except all select * from t3;
+select * from t1 union all select * from t2 except DISTINCT select * from t3;
+select * from t1 union DISTINCT select * from t2 except all select * from t3;
+select * from t1 union DISTINCT select * from t2 except DISTINCT select * from t3;
+
+drop table t1;
+drop table t2;
+drop table t3;
+drop table t4;
+
+
+select 1 intersect all select 2 intersect all select 3 intersect select 4 union select 5;
+select 1 intersect all select 2 intersect all select 3 union select 4 except select 5;
+select 1 union select 2 except all select 3 union select 4;
+select 1 union all select 2 union all select 3 union select 4;
+
+--echo # test with limited resource
+
+set @@max_heap_table_size= 1024;
+set @@tmp_table_size= 1024;
+
+create table t1 (a int, b int);
+insert into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(0,0);
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select a+100, b+100 from t1;
+create table t2 (a int, b int);
+insert into t2 values (10,10),(11,11),(12,12),(13,13),(14,14),(5,5),(6,6),(7,7),(8,8),(9,9);
+insert into t2 select * from t2;
+insert into t2 select * from t2;
+insert into t2 select * from t2;
+insert into t2 select a+100, b+100 from t2;
+
+
+select count(*) from
+(
+ select * from t1
+ INTERSECT ALL
+ select * from t2
+) c;
+
+select count(*) from
+(
+ select * from t1
+ EXCEPT ALL
+ select * from t2
+) c;
+
+select count(*) from
+(
+ select * from t1
+ INTERSECT ALL
+ select * from t2
+ UNION ALL
+ select * from t1
+ EXCEPT ALL
+ select * from t2
+) c;
+
+delete from t1;
+delete from t2;
+
+insert into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(0,0);
+insert into t1 select a+10, b+10 from t1;
+insert into t1 select a+20, b+20 from t1;
+insert into t1 select a+40, b+40 from t1;
+insert into t1 select a+80, b+80 from t1;
+insert into t2 values (1110,1110),(1111,1111),(1112,1112),(1113,1113),(1114,1114),(1105,1105),(1106,1106),(1107,1107),(1108,1108),(1109,1109);
+insert into t2 select a+10, b+10 from t2;
+insert into t2 select a+20, b+20 from t2;
+insert into t2 select a+40, b+40 from t2;
+insert into t2 select a+80, b+80 from t2;
+
+select count(*) from
+(
+ select * from t1
+ UNION ALL
+ select * from t2
+ EXCEPT ALL
+ values (1,1)
+) c;
+
+drop table t1;
+drop table t2;
diff --git a/mysql-test/main/set_operation_oracle.result b/mysql-test/main/set_operation_oracle.result
new file mode 100644
index 00000000000..28f6e315005
--- /dev/null
+++ b/mysql-test/main/set_operation_oracle.result
@@ -0,0 +1,75 @@
+create table t1 (a int, b blob) engine=MyISAM;
+create table t2 (c int, d blob) engine=MyISAM;
+create table t3 (e int, f blob) engine=MyISAM;
+insert into t1 values (5,5),(6,6);
+insert into t2 values (2,2),(3,3);
+insert into t3 values (1,1),(3,3);
+set SQL_MODE=ORACLE;
+(select a,b from t1) union (select c,d from t2) intersect (select e,f from t3) union (select 4,4);
+a b
+4 4
+3 3
+explain extended
+(select a,b from t1) union (select c,d from t2) intersect (select e,f from t3) union (select 4,4);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
+2 UNION t2 ALL NULL NULL NULL NULL 2 100.00
+3 INTERSECT t3 ALL NULL NULL NULL NULL 2 100.00
+4 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+NULL UNIT RESULT <unit1,2,3,4> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 (/* select#1 */ select "test"."t1"."a" AS "a","test"."t1"."b" AS "b" from "test"."t1") union (/* select#2 */ select "test"."t2"."c" AS "c","test"."t2"."d" AS "d" from "test"."t2") intersect (/* select#3 */ select "test"."t3"."e" AS "e","test"."t3"."f" AS "f" from "test"."t3") union (/* select#4 */ select 4 AS "4",4 AS "4")
+(select e,f from t3) intersect (select c,d from t2) union (select a,b from t1) union (select 4,4);
+e f
+5 5
+3 3
+6 6
+4 4
+explain extended
+(select e,f from t3) intersect (select c,d from t2) union (select a,b from t1) union (select 4,4);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00
+2 INTERSECT t2 ALL NULL NULL NULL NULL 2 100.00
+3 UNION t1 ALL NULL NULL NULL NULL 2 100.00
+4 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+NULL UNIT RESULT <unit1,2,3,4> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 (/* select#1 */ select "test"."t3"."e" AS "e","test"."t3"."f" AS "f" from "test"."t3") intersect (/* select#2 */ select "test"."t2"."c" AS "c","test"."t2"."d" AS "d" from "test"."t2") union (/* select#3 */ select "test"."t1"."a" AS "a","test"."t1"."b" AS "b" from "test"."t1") union (/* select#4 */ select 4 AS "4",4 AS "4")
+create table t12(c1 int);
+insert into t12 values(1);
+insert into t12 values(2);
+create table t13(c1 int);
+insert into t13 values(1);
+insert into t13 values(3);
+create table t234(c1 int);
+insert into t234 values(2);
+insert into t234 values(3);
+insert into t234 values(4);
+select * from t13 union select * from t234 intersect select * from t12;
+c1
+1
+2
+set SQL_MODE=default;
+drop table t1,t2,t3;
+drop table t12,t13, t234;
+create table t1 (a int, b blob) engine=MyISAM;
+create table t2 (c int, d blob) engine=MyISAM;
+create table t3 (e int, f blob) engine=MyISAM;
+insert into t1 values (5,5),(6,6);
+insert into t2 values (2,2),(3,3);
+insert into t3 values (1,1),(3,3);
+set SQL_MODE=ORACLE;
+(select a,b from t1) union all (select c,d from t2) intersect all (select e,f from t3) union all (select 4,4);
+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 'all (select e,f from t3) union all (select 4,4)' at line 1
+explain extended (select a,b from t1) union all (select c,d from t2) intersect all (select e,f from t3) union all (select 4,4);
+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 'all (select e,f from t3) union all (select 4,4)' at line 1
+(select e,f from t3) intersect all (select c,d from t2) union all (select a,b from t1) union all (select 4,4);
+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 'all (select c,d from t2) union all (select a,b from t1) union all (select 4,4)' at line 1
+explain extended (select e,f from t3) intersect all (select c,d from t2) union all (select a,b from t1) union all (select 4,4);
+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 'all (select c,d from t2) union all (select a,b from t1) union all (select 4,4)' at line 1
+set SQL_MODE=default;
+drop table t1,t2,t3;
+set SQL_MODE=oracle;
+select * from t13 union select * from t234 intersect all select * from t12;
+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 'all select * from t12' at line 1
+set SQL_MODE=default;
diff --git a/mysql-test/main/set_operation_oracle.test b/mysql-test/main/set_operation_oracle.test
new file mode 100644
index 00000000000..bd2a4d5c6e2
--- /dev/null
+++ b/mysql-test/main/set_operation_oracle.test
@@ -0,0 +1,65 @@
+# from intersect.test
+create table t1 (a int, b blob) engine=MyISAM;
+create table t2 (c int, d blob) engine=MyISAM;
+create table t3 (e int, f blob) engine=MyISAM;
+insert into t1 values (5,5),(6,6);
+insert into t2 values (2,2),(3,3);
+insert into t3 values (1,1),(3,3);
+
+set SQL_MODE=ORACLE;
+
+(select a,b from t1) union (select c,d from t2) intersect (select e,f from t3) union (select 4,4);
+explain extended
+(select a,b from t1) union (select c,d from t2) intersect (select e,f from t3) union (select 4,4);
+
+
+(select e,f from t3) intersect (select c,d from t2) union (select a,b from t1) union (select 4,4);
+explain extended
+(select e,f from t3) intersect (select c,d from t2) union (select a,b from t1) union (select 4,4);
+
+create table t12(c1 int);
+insert into t12 values(1);
+insert into t12 values(2);
+create table t13(c1 int);
+insert into t13 values(1);
+insert into t13 values(3);
+create table t234(c1 int);
+insert into t234 values(2);
+insert into t234 values(3);
+insert into t234 values(4);
+
+
+select * from t13 union select * from t234 intersect select * from t12;
+set SQL_MODE=default;
+
+drop table t1,t2,t3;
+drop table t12,t13, t234;
+
+#from intersect_all.test
+create table t1 (a int, b blob) engine=MyISAM;
+create table t2 (c int, d blob) engine=MyISAM;
+create table t3 (e int, f blob) engine=MyISAM;
+insert into t1 values (5,5),(6,6);
+insert into t2 values (2,2),(3,3);
+insert into t3 values (1,1),(3,3);
+
+set SQL_MODE=ORACLE;
+
+#(select a,b from t1) union all (select c,d from t2) intersect (select e,f from t3) union all (select 4,4);
+--error ER_PARSE_ERROR
+(select a,b from t1) union all (select c,d from t2) intersect all (select e,f from t3) union all (select 4,4);
+--error ER_PARSE_ERROR
+explain extended (select a,b from t1) union all (select c,d from t2) intersect all (select e,f from t3) union all (select 4,4);
+
+--error ER_PARSE_ERROR
+(select e,f from t3) intersect all (select c,d from t2) union all (select a,b from t1) union all (select 4,4);
+--error ER_PARSE_ERROR
+explain extended (select e,f from t3) intersect all (select c,d from t2) union all (select a,b from t1) union all (select 4,4);
+set SQL_MODE=default;
+
+drop table t1,t2,t3;
+
+set SQL_MODE=oracle;
+--error ER_PARSE_ERROR
+select * from t13 union select * from t234 intersect all select * from t12;
+set SQL_MODE=default; \ No newline at end of file
diff --git a/mysql-test/main/sp-big.result b/mysql-test/main/sp-big.result
index 0a07a3aa7a8..ea93f2cac60 100644
--- a/mysql-test/main/sp-big.result
+++ b/mysql-test/main/sp-big.result
@@ -82,8 +82,8 @@ Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be
insert t1 select seq, seq, 1, 1, seq, seq, seq from seq_1_to_2000;
set @before=unix_timestamp();
call select_test();
-select unix_timestamp() - @before < 60;
-unix_timestamp() - @before < 60
+select unix_timestamp() - @before < @time;
+unix_timestamp() - @before < @time
1
drop procedure select_test;
drop table t1;
diff --git a/mysql-test/main/sp-big.test b/mysql-test/main/sp-big.test
index 4220541697e..043e737105a 100644
--- a/mysql-test/main/sp-big.test
+++ b/mysql-test/main/sp-big.test
@@ -112,6 +112,17 @@ delimiter ;//
insert t1 select seq, seq, 1, 1, seq, seq, seq from seq_1_to_2000;
set @before=unix_timestamp();
call select_test();
-select unix_timestamp() - @before < 60;
+
+--let $time=60
+if ($VALGRIND_TEST)
+{
+ --let $time=600
+}
+
+--disable_query_log
+--eval set @time=$time;
+--enable_query_log
+
+select unix_timestamp() - @before < @time;
drop procedure select_test;
drop table t1;
diff --git a/mysql-test/main/sp-code.result b/mysql-test/main/sp-code.result
index 46324c534e8..f9cbdcce691 100644
--- a/mysql-test/main/sp-code.result
+++ b/mysql-test/main/sp-code.result
@@ -847,8 +847,8 @@ drop procedure if exists p_20906_b;
create procedure p_20906_a() SET @a=@a+1, @b=@b+1;
show procedure code p_20906_a;
Pos Instruction
-0 stmt 31 "SET @a=@a+1"
-1 stmt 31 "SET @b=@b+1"
+0 stmt 31 "SET @a=@a+1"
+1 stmt 31 "SET @b=@b+1"
set @a=1;
set @b=1;
call p_20906_a();
@@ -858,9 +858,9 @@ select @a, @b;
create procedure p_20906_b() SET @a=@a+1, @b=@b+1, @c=@c+1;
show procedure code p_20906_b;
Pos Instruction
-0 stmt 31 "SET @a=@a+1"
-1 stmt 31 "SET @b=@b+1"
-2 stmt 31 "SET @c=@c+1"
+0 stmt 31 "SET @a=@a+1"
+1 stmt 31 "SET @b=@b+1"
+2 stmt 31 "SET @c=@c+1"
set @a=1;
set @b=1;
set @c=1;
@@ -1329,3 +1329,18 @@ Pos Instruction
4 jump 2
5 hpop 1
drop function f1;
+#
+# MDEV-19640 Wrong SHOW PROCEDURE output for SET GLOBAL sysvar1=expr, sysvar2=expr
+#
+CREATE OR REPLACE PROCEDURE p1()
+BEGIN
+SET GLOBAL max_allowed_packet=16000000, max_error_count=60;
+SELECT @@GLOBAL.max_allowed_packet, @@GLOBAL.max_error_count;
+END;
+$$
+SHOW PROCEDURE CODE p1;
+Pos Instruction
+0 stmt 31 "SET GLOBAL max_allowed_packet=16000000"
+1 stmt 31 "SET GLOBAL max_error_count=60"
+2 stmt 0 "SELECT @@GLOBAL.max_allowed_packet, @..."
+DROP PROCEDURE p1;
diff --git a/mysql-test/main/sp-code.test b/mysql-test/main/sp-code.test
index e03ce5048fb..10bf1ba1322 100644
--- a/mysql-test/main/sp-code.test
+++ b/mysql-test/main/sp-code.test
@@ -947,3 +947,19 @@ end|
delimiter ;|
show function code f1;
drop function f1;
+
+
+--echo #
+--echo # MDEV-19640 Wrong SHOW PROCEDURE output for SET GLOBAL sysvar1=expr, sysvar2=expr
+--echo #
+
+DELIMITER $$;
+CREATE OR REPLACE PROCEDURE p1()
+BEGIN
+ SET GLOBAL max_allowed_packet=16000000, max_error_count=60;
+ SELECT @@GLOBAL.max_allowed_packet, @@GLOBAL.max_error_count;
+END;
+$$
+DELIMITER ;$$
+SHOW PROCEDURE CODE p1;
+DROP PROCEDURE p1;
diff --git a/mysql-test/main/sp-row.result b/mysql-test/main/sp-row.result
index 4b87798e0bb..7c257297934 100644
--- a/mysql-test/main/sp-row.result
+++ b/mysql-test/main/sp-row.result
@@ -189,7 +189,7 @@ SELECT a+1;
END;
$$
CALL p1();
-ERROR 21000: Operand should contain 1 column(s)
+ERROR HY000: Illegal parameter data types row and int for operation '+'
DROP PROCEDURE p1;
CREATE PROCEDURE p1()
BEGIN
@@ -198,7 +198,7 @@ SELECT a+1;
END;
$$
CALL p1();
-ERROR 21000: Operand should contain 1 column(s)
+ERROR HY000: Illegal parameter data types row and int for operation '+'
DROP PROCEDURE p1;
#
# Comparing the entire ROW to a scalar value
diff --git a/mysql-test/main/sp-row.test b/mysql-test/main/sp-row.test
index 3352c940cb6..b9143b1113b 100644
--- a/mysql-test/main/sp-row.test
+++ b/mysql-test/main/sp-row.test
@@ -244,7 +244,7 @@ BEGIN
END;
$$
DELIMITER ;$$
---error ER_OPERAND_COLUMNS
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
CALL p1();
DROP PROCEDURE p1;
@@ -257,7 +257,7 @@ BEGIN
END;
$$
DELIMITER ;$$
---error ER_OPERAND_COLUMNS
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
CALL p1();
DROP PROCEDURE p1;
diff --git a/mysql-test/main/sp_gis.result b/mysql-test/main/sp_gis.result
index 7a76507754f..35c7e52e833 100644
--- a/mysql-test/main/sp_gis.result
+++ b/mysql-test/main/sp_gis.result
@@ -28,3 +28,75 @@ test.a() test.x() test.y()
drop function a;
drop function x;
drop function y;
+#
+# Start of 10.5 tests
+#
+#
+# MDEV-19944 Remove GIS data types from keyword list in lex.h
+#
+CREATE FUNCTION point() RETURNS POINT RETURN NULL;
+Warnings:
+Note 1585 This function 'point' has the same name as a native function
+SELECT point();
+point()
+NULL
+DROP FUNCTION point;
+CREATE FUNCTION point(x INT) RETURNS POINT RETURN NULL;
+Warnings:
+Note 1585 This function 'point' has the same name as a native function
+SELECT point(1);
+point(1)
+NULL
+DROP FUNCTION point;
+CREATE FUNCTION point(x INT, y INT) RETURNS POINT RETURN NULL;
+Warnings:
+Note 1585 This function 'point' has the same name as a native function
+SELECT AsText(point(1,1));
+AsText(point(1,1))
+POINT(1 1)
+DROP FUNCTION point;
+CREATE FUNCTION linestring() RETURNS POINT RETURN NULL;
+Warnings:
+Note 1585 This function 'linestring' has the same name as a native function
+SELECT linestring();
+linestring()
+NULL
+DROP FUNCTION linestring;
+CREATE FUNCTION polygon() RETURNS POINT RETURN NULL;
+Warnings:
+Note 1585 This function 'polygon' has the same name as a native function
+SELECT polygon();
+polygon()
+NULL
+DROP FUNCTION polygon;
+CREATE FUNCTION multipoint() RETURNS POINT RETURN NULL;
+Warnings:
+Note 1585 This function 'multipoint' has the same name as a native function
+SELECT multipoint();
+multipoint()
+NULL
+DROP FUNCTION multipoint;
+CREATE FUNCTION multilinestring() RETURNS POINT RETURN NULL;
+Warnings:
+Note 1585 This function 'multilinestring' has the same name as a native function
+SELECT multilinestring();
+multilinestring()
+NULL
+DROP FUNCTION multilinestring;
+CREATE FUNCTION multipolygon() RETURNS POINT RETURN NULL;
+Warnings:
+Note 1585 This function 'multipolygon' has the same name as a native function
+SELECT multipolygon();
+multipolygon()
+NULL
+DROP FUNCTION multipolygon;
+CREATE FUNCTION geometrycollection() RETURNS POINT RETURN NULL;
+Warnings:
+Note 1585 This function 'geometrycollection' has the same name as a native function
+SELECT geometrycollection();
+geometrycollection()
+NULL
+DROP FUNCTION geometrycollection;
+#
+# End of 10.5 tests
+#
diff --git a/mysql-test/main/sp_gis.test b/mysql-test/main/sp_gis.test
index 51ed78b27d5..4148a4ec423 100644
--- a/mysql-test/main/sp_gis.test
+++ b/mysql-test/main/sp_gis.test
@@ -37,3 +37,66 @@ drop function a;
drop function x;
drop function y;
+--echo #
+--echo # Start of 10.5 tests
+--echo #
+
+--echo #
+--echo # MDEV-19944 Remove GIS data types from keyword list in lex.h
+--echo #
+
+CREATE FUNCTION point() RETURNS POINT RETURN NULL;
+--disable_warnings
+SELECT point();
+--enable_warnings
+DROP FUNCTION point;
+
+CREATE FUNCTION point(x INT) RETURNS POINT RETURN NULL;
+--disable_warnings
+SELECT point(1);
+--enable_warnings
+DROP FUNCTION point;
+
+CREATE FUNCTION point(x INT, y INT) RETURNS POINT RETURN NULL;
+SELECT AsText(point(1,1));
+DROP FUNCTION point;
+
+CREATE FUNCTION linestring() RETURNS POINT RETURN NULL;
+--disable_warnings
+SELECT linestring();
+--enable_warnings
+DROP FUNCTION linestring;
+
+CREATE FUNCTION polygon() RETURNS POINT RETURN NULL;
+--disable_warnings
+SELECT polygon();
+--enable_warnings
+DROP FUNCTION polygon;
+
+CREATE FUNCTION multipoint() RETURNS POINT RETURN NULL;
+--disable_warnings
+SELECT multipoint();
+--enable_warnings
+DROP FUNCTION multipoint;
+
+CREATE FUNCTION multilinestring() RETURNS POINT RETURN NULL;
+--disable_warnings
+SELECT multilinestring();
+--enable_warnings
+DROP FUNCTION multilinestring;
+
+CREATE FUNCTION multipolygon() RETURNS POINT RETURN NULL;
+--disable_warnings
+SELECT multipolygon();
+--enable_warnings
+DROP FUNCTION multipolygon;
+
+CREATE FUNCTION geometrycollection() RETURNS POINT RETURN NULL;
+--disable_warnings
+SELECT geometrycollection();
+--enable_warnings
+DROP FUNCTION geometrycollection;
+
+--echo #
+--echo # End of 10.5 tests
+--echo #
diff --git a/mysql-test/main/ssl.result b/mysql-test/main/ssl.result
index 00faea58fd2..40a32fdd1dd 100644
--- a/mysql-test/main/ssl.result
+++ b/mysql-test/main/ssl.result
@@ -518,7 +518,7 @@ insert into tmp select * from t3;
insert into t3 select * from tmp;
alter table t3 add t2nr int not null auto_increment primary key first;
drop table tmp;
-SET BIG_TABLES=1;
+set tmp_memory_table_size=0;
select distinct concat(fld3," ",fld3) as namn from t2,t3 where t2.fld1=t3.t2nr order by namn limit 10;
namn
Abraham Abraham
@@ -531,7 +531,7 @@ ammonium ammonium
analyzable analyzable
animals animals
animized animized
-SET BIG_TABLES=0;
+set tmp_memory_table_size=default;
select distinct concat(fld3," ",fld3) from t2,t3 where t2.fld1=t3.t2nr order by fld3 limit 10;
concat(fld3," ",fld3)
Abraham Abraham
@@ -568,7 +568,7 @@ attendants 1
bedlam 1
bedpost 1
boasted 1
-SET BIG_TABLES=1;
+set tmp_memory_table_size=0;
select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
fld3 count(*)
affixed 1
@@ -581,7 +581,7 @@ attendants 1
bedlam 1
bedpost 1
boasted 1
-SET BIG_TABLES=0;
+set tmp_memory_table_size=default;
select distinct fld3,repeat("a",length(fld3)),count(*) from t2 group by companynr,fld3 limit 100,10;
fld3 repeat("a",length(fld3)) count(*)
circus aaaaaa 1
diff --git a/mysql-test/main/ssl_compress.result b/mysql-test/main/ssl_compress.result
index d298f8ec6e4..8c63c798afa 100644
--- a/mysql-test/main/ssl_compress.result
+++ b/mysql-test/main/ssl_compress.result
@@ -515,7 +515,7 @@ insert into tmp select * from t3;
insert into t3 select * from tmp;
alter table t3 add t2nr int not null auto_increment primary key first;
drop table tmp;
-SET BIG_TABLES=1;
+set tmp_memory_table_size=0;
select distinct concat(fld3," ",fld3) as namn from t2,t3 where t2.fld1=t3.t2nr order by namn limit 10;
namn
Abraham Abraham
@@ -528,7 +528,7 @@ ammonium ammonium
analyzable analyzable
animals animals
animized animized
-SET BIG_TABLES=0;
+set tmp_memory_table_size=default;
select distinct concat(fld3," ",fld3) from t2,t3 where t2.fld1=t3.t2nr order by fld3 limit 10;
concat(fld3," ",fld3)
Abraham Abraham
@@ -565,7 +565,7 @@ attendants 1
bedlam 1
bedpost 1
boasted 1
-SET BIG_TABLES=1;
+set tmp_memory_table_size=0;
select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
fld3 count(*)
affixed 1
@@ -578,7 +578,7 @@ attendants 1
bedlam 1
bedpost 1
boasted 1
-SET BIG_TABLES=0;
+set tmp_memory_table_size=default;
select distinct fld3,repeat("a",length(fld3)),count(*) from t2 group by companynr,fld3 limit 100,10;
fld3 repeat("a",length(fld3)) count(*)
circus aaaaaa 1
diff --git a/mysql-test/main/subselect.result b/mysql-test/main/subselect.result
index 349e7dca129..2f78a77b10f 100644
--- a/mysql-test/main/subselect.result
+++ b/mysql-test/main/subselect.result
@@ -7134,7 +7134,7 @@ drop table t1,t2,t3,t4;
# MDEV-7122
# Assertion `0' failed in subselect_hash_sj_engine::init
#
-SET SESSION big_tables=1;
+set tmp_memory_table_size=0;
CREATE TABLE t1(a char(255) DEFAULT '', KEY(a(10))) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
INSERT INTO t1 VALUES(0),(0),(0);
SELECT * FROM t1 WHERE a IN(SELECT MIN(a) FROM t1);
@@ -7143,7 +7143,7 @@ a
0
0
DROP TABLE t1;
-SET SESSION big_tables=0;
+set tmp_memory_table_size=default;
#
# MDEV-10776: Server crash on query
#
diff --git a/mysql-test/main/subselect.test b/mysql-test/main/subselect.test
index be17254202e..8b34e32740b 100644
--- a/mysql-test/main/subselect.test
+++ b/mysql-test/main/subselect.test
@@ -5959,12 +5959,12 @@ drop table t1,t2,t3,t4;
--echo # MDEV-7122
--echo # Assertion `0' failed in subselect_hash_sj_engine::init
--echo #
-SET SESSION big_tables=1;
+set tmp_memory_table_size=0; # force on-disk tmp table
CREATE TABLE t1(a char(255) DEFAULT '', KEY(a(10))) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
INSERT INTO t1 VALUES(0),(0),(0);
SELECT * FROM t1 WHERE a IN(SELECT MIN(a) FROM t1);
DROP TABLE t1;
-SET SESSION big_tables=0;
+set tmp_memory_table_size=default;
--echo #
--echo # MDEV-10776: Server crash on query
diff --git a/mysql-test/main/subselect_cache.result b/mysql-test/main/subselect_cache.result
index abd978de9a5..0d6f459ce88 100644
--- a/mysql-test/main/subselect_cache.result
+++ b/mysql-test/main/subselect_cache.result
@@ -1860,8 +1860,8 @@ Variable_name Value
Subquery_cache_hit 0
Subquery_cache_miss 4
drop table t1;
-#test of sql_big_tables switch and outer table reference in subquery with grouping
-set big_tables=1;
+#test of big_tables switch and outer table reference in subquery with grouping
+set tmp_memory_table_size=0;
CREATE TABLE t1 (a INT PRIMARY KEY, b INT);
INSERT INTO t1 VALUES (1,1),(2,1),(3,2),(4,2),(5,3),(6,3);
SELECT (SELECT t1_outer.a FROM t1 AS t1_inner GROUP BY b LIMIT 1) FROM t1 AS t1_outer;
@@ -1873,7 +1873,7 @@ SELECT (SELECT t1_outer.a FROM t1 AS t1_inner GROUP BY b LIMIT 1) FROM t1 AS t1_
5
6
drop table t1;
-set big_tables=0;
+set tmp_memory_table_size=default;
#test of function reference to outer query
set local group_concat_max_len=400;
create table t2 (a int, b int);
diff --git a/mysql-test/main/subselect_cache.test b/mysql-test/main/subselect_cache.test
index 55da0000f13..8fcecf1281b 100644
--- a/mysql-test/main/subselect_cache.test
+++ b/mysql-test/main/subselect_cache.test
@@ -428,13 +428,13 @@ select a, a in (select a from t1 where -1 < benchmark(a,100)) from t1 as ext;
show status like "subquery_cache%";
drop table t1;
---echo #test of sql_big_tables switch and outer table reference in subquery with grouping
-set big_tables=1;
+--echo #test of big_tables switch and outer table reference in subquery with grouping
+set tmp_memory_table_size=0; # force on-disk tmp table
CREATE TABLE t1 (a INT PRIMARY KEY, b INT);
INSERT INTO t1 VALUES (1,1),(2,1),(3,2),(4,2),(5,3),(6,3);
SELECT (SELECT t1_outer.a FROM t1 AS t1_inner GROUP BY b LIMIT 1) FROM t1 AS t1_outer;
drop table t1;
-set big_tables=0;
+set tmp_memory_table_size=default;
--echo #test of function reference to outer query
set local group_concat_max_len=400;
diff --git a/mysql-test/main/subselect_mat.result b/mysql-test/main/subselect_mat.result
index 34b58daa50e..c5fa7ddc92c 100644
--- a/mysql-test/main/subselect_mat.result
+++ b/mysql-test/main/subselect_mat.result
@@ -2118,8 +2118,7 @@ DROP VIEW v2;
#
# MDEV-5811: Server crashes in best_access_path with materialization+semijoin and big_tables=ON
#
-SET @tmp_mdev5811= @@big_tables;
-SET big_tables = ON;
+set tmp_memory_table_size=0;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (b INT);
@@ -2128,7 +2127,7 @@ SELECT * FROM t1 AS t1_1, t1 AS t1_2
WHERE ( t1_1.a, t1_2.a ) IN ( SELECT MAX(b), MIN(b) FROM t2 );
a a
DROP TABLE t1,t2;
-SET big_tables=@tmp_mdev5811;
+set tmp_memory_table_size=default;
# End of 5.3 tests
#
# MDEV-5056: Wrong result (extra rows) with materialization+semijoin, IN subqueries
diff --git a/mysql-test/main/subselect_no_exists_to_in.result b/mysql-test/main/subselect_no_exists_to_in.result
index 84c415d1ce1..e830c8bdc91 100644
--- a/mysql-test/main/subselect_no_exists_to_in.result
+++ b/mysql-test/main/subselect_no_exists_to_in.result
@@ -7134,7 +7134,7 @@ drop table t1,t2,t3,t4;
# MDEV-7122
# Assertion `0' failed in subselect_hash_sj_engine::init
#
-SET SESSION big_tables=1;
+set tmp_memory_table_size=0;
CREATE TABLE t1(a char(255) DEFAULT '', KEY(a(10))) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
INSERT INTO t1 VALUES(0),(0),(0);
SELECT * FROM t1 WHERE a IN(SELECT MIN(a) FROM t1);
@@ -7143,7 +7143,7 @@ a
0
0
DROP TABLE t1;
-SET SESSION big_tables=0;
+set tmp_memory_table_size=default;
#
# MDEV-10776: Server crash on query
#
diff --git a/mysql-test/main/subselect_no_mat.result b/mysql-test/main/subselect_no_mat.result
index 93035e235f7..8203f59f92b 100644
--- a/mysql-test/main/subselect_no_mat.result
+++ b/mysql-test/main/subselect_no_mat.result
@@ -7127,7 +7127,7 @@ drop table t1,t2,t3,t4;
# MDEV-7122
# Assertion `0' failed in subselect_hash_sj_engine::init
#
-SET SESSION big_tables=1;
+set tmp_memory_table_size=0;
CREATE TABLE t1(a char(255) DEFAULT '', KEY(a(10))) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
INSERT INTO t1 VALUES(0),(0),(0);
SELECT * FROM t1 WHERE a IN(SELECT MIN(a) FROM t1);
@@ -7136,7 +7136,7 @@ a
0
0
DROP TABLE t1;
-SET SESSION big_tables=0;
+set tmp_memory_table_size=default;
#
# MDEV-10776: Server crash on query
#
diff --git a/mysql-test/main/subselect_no_opts.result b/mysql-test/main/subselect_no_opts.result
index 09f664d3c28..ec4d0d99a6d 100644
--- a/mysql-test/main/subselect_no_opts.result
+++ b/mysql-test/main/subselect_no_opts.result
@@ -7125,7 +7125,7 @@ drop table t1,t2,t3,t4;
# MDEV-7122
# Assertion `0' failed in subselect_hash_sj_engine::init
#
-SET SESSION big_tables=1;
+set tmp_memory_table_size=0;
CREATE TABLE t1(a char(255) DEFAULT '', KEY(a(10))) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
INSERT INTO t1 VALUES(0),(0),(0);
SELECT * FROM t1 WHERE a IN(SELECT MIN(a) FROM t1);
@@ -7134,7 +7134,7 @@ a
0
0
DROP TABLE t1;
-SET SESSION big_tables=0;
+set tmp_memory_table_size=default;
#
# MDEV-10776: Server crash on query
#
diff --git a/mysql-test/main/subselect_no_scache.result b/mysql-test/main/subselect_no_scache.result
index 765bb15a3df..f4c850409da 100644
--- a/mysql-test/main/subselect_no_scache.result
+++ b/mysql-test/main/subselect_no_scache.result
@@ -7140,7 +7140,7 @@ drop table t1,t2,t3,t4;
# MDEV-7122
# Assertion `0' failed in subselect_hash_sj_engine::init
#
-SET SESSION big_tables=1;
+set tmp_memory_table_size=0;
CREATE TABLE t1(a char(255) DEFAULT '', KEY(a(10))) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
INSERT INTO t1 VALUES(0),(0),(0);
SELECT * FROM t1 WHERE a IN(SELECT MIN(a) FROM t1);
@@ -7149,7 +7149,7 @@ a
0
0
DROP TABLE t1;
-SET SESSION big_tables=0;
+set tmp_memory_table_size=default;
#
# MDEV-10776: Server crash on query
#
diff --git a/mysql-test/main/subselect_no_semijoin.result b/mysql-test/main/subselect_no_semijoin.result
index 97d2f3b058f..e1d147da761 100644
--- a/mysql-test/main/subselect_no_semijoin.result
+++ b/mysql-test/main/subselect_no_semijoin.result
@@ -7125,7 +7125,7 @@ drop table t1,t2,t3,t4;
# MDEV-7122
# Assertion `0' failed in subselect_hash_sj_engine::init
#
-SET SESSION big_tables=1;
+set tmp_memory_table_size=0;
CREATE TABLE t1(a char(255) DEFAULT '', KEY(a(10))) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
INSERT INTO t1 VALUES(0),(0),(0);
SELECT * FROM t1 WHERE a IN(SELECT MIN(a) FROM t1);
@@ -7134,7 +7134,7 @@ a
0
0
DROP TABLE t1;
-SET SESSION big_tables=0;
+set tmp_memory_table_size=default;
#
# MDEV-10776: Server crash on query
#
diff --git a/mysql-test/main/subselect_sj_mat.result b/mysql-test/main/subselect_sj_mat.result
index afc75a22962..6615eb41425 100644
--- a/mysql-test/main/subselect_sj_mat.result
+++ b/mysql-test/main/subselect_sj_mat.result
@@ -2154,8 +2154,7 @@ DROP VIEW v2;
#
# MDEV-5811: Server crashes in best_access_path with materialization+semijoin and big_tables=ON
#
-SET @tmp_mdev5811= @@big_tables;
-SET big_tables = ON;
+set tmp_memory_table_size=0;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (b INT);
@@ -2164,7 +2163,7 @@ SELECT * FROM t1 AS t1_1, t1 AS t1_2
WHERE ( t1_1.a, t1_2.a ) IN ( SELECT MAX(b), MIN(b) FROM t2 );
a a
DROP TABLE t1,t2;
-SET big_tables=@tmp_mdev5811;
+set tmp_memory_table_size=default;
# End of 5.3 tests
#
# MDEV-5056: Wrong result (extra rows) with materialization+semijoin, IN subqueries
diff --git a/mysql-test/main/subselect_sj_mat.test b/mysql-test/main/subselect_sj_mat.test
index 1de8701ecbb..8d5bbd8ef82 100644
--- a/mysql-test/main/subselect_sj_mat.test
+++ b/mysql-test/main/subselect_sj_mat.test
@@ -1760,8 +1760,7 @@ DROP VIEW v2;
--echo #
--echo # MDEV-5811: Server crashes in best_access_path with materialization+semijoin and big_tables=ON
--echo #
-SET @tmp_mdev5811= @@big_tables;
-SET big_tables = ON;
+set tmp_memory_table_size=0; # force on-disk tmp table
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
@@ -1773,7 +1772,7 @@ SELECT * FROM t1 AS t1_1, t1 AS t1_2
WHERE ( t1_1.a, t1_2.a ) IN ( SELECT MAX(b), MIN(b) FROM t2 );
DROP TABLE t1,t2;
-SET big_tables=@tmp_mdev5811;
+set tmp_memory_table_size=default;
--echo # End of 5.3 tests
diff --git a/mysql-test/main/table_value_constr.result b/mysql-test/main/table_value_constr.result
index b395a896000..54bf9c36491 100644
--- a/mysql-test/main/table_value_constr.result
+++ b/mysql-test/main/table_value_constr.result
@@ -2062,9 +2062,9 @@ values (1,2),(3,4,5);
ERROR HY000: The used table value constructor has a different number of values
# illegal parameter data types in TVC
values (1,point(1,1)),(1,1);
-ERROR HY000: Illegal parameter data types geometry and int for operation 'TABLE VALUE CONSTRUCTOR'
+ERROR HY000: Illegal parameter data types point and int for operation 'TABLE VALUE CONSTRUCTOR'
values (1,point(1,1)+1);
-ERROR HY000: Illegal parameter data types geometry and int for operation '+'
+ERROR HY000: Illegal parameter data types point and int for operation '+'
# field reference in TVC
select * from (values (1), (b), (2)) as new_tvc;
ERROR HY000: Field reference 'b' can't be used in table value constructor
diff --git a/mysql-test/main/tc_heuristic_recover.test b/mysql-test/main/tc_heuristic_recover.test
index 8cbf7d61143..86fea084de8 100644
--- a/mysql-test/main/tc_heuristic_recover.test
+++ b/mysql-test/main/tc_heuristic_recover.test
@@ -49,7 +49,7 @@ SELECT * FROM t1;
# TODO: MDEV-12700 Allow innodb_read_only startup without prior slow shutdown.
--source include/kill_mysqld.inc
--error 1
---exec $MYSQLD_LAST_CMD --log-bin=master-bin --binlog-format=mixed --core-file --loose-debug-sync-timeout=300 --innodb-force-recovery=4
+--exec $MYSQLD_LAST_CMD --log-bin=master-bin --binlog-format=mixed --core-file --loose-debug-sync-timeout=300 --debug_dbug="+d,innobase_xa_fail"
--let SEARCH_PATTERN= was in the XA prepared state
--source include/search_pattern_in_file.inc
@@ -59,7 +59,7 @@ SELECT * FROM t1;
--source include/search_pattern_in_file.inc
--error 1
---exec $MYSQLD_LAST_CMD --log-bin=master-bin --binlog-format=mixed --core-file --loose-debug-sync-timeout=300 --innodb-force-recovery=4 --tc-heuristic-recover=COMMIT
+--exec $MYSQLD_LAST_CMD --log-bin=master-bin --binlog-format=mixed --core-file --loose-debug-sync-timeout=300 --debug_dbug="+d,innobase_xa_fail" --tc-heuristic-recover=COMMIT
--let SEARCH_PATTERN= was in the XA prepared state
--source include/search_pattern_in_file.inc
--let SEARCH_PATTERN= Found 1 prepared transactions!
diff --git a/mysql-test/main/thread_pool_info.opt b/mysql-test/main/thread_pool_info.opt
new file mode 100644
index 00000000000..4094287a9bf
--- /dev/null
+++ b/mysql-test/main/thread_pool_info.opt
@@ -0,0 +1 @@
+--thread-handling=pool-of-threads --loose-thread-pool-mode=generic --loose-thread-pool-groups=ON --loose-thread-pool-queues=ON --thread-pool-stats=ON --thread-pool-waits=ON \ No newline at end of file
diff --git a/mysql-test/main/thread_pool_info.result b/mysql-test/main/thread_pool_info.result
new file mode 100644
index 00000000000..802e2f3a7ec
--- /dev/null
+++ b/mysql-test/main/thread_pool_info.result
@@ -0,0 +1,89 @@
+DESC INFORMATION_SCHEMA.THREAD_POOL_GROUPS;
+Field Type Null Key Default Extra
+GROUP_ID int(6) NO 0
+CONNECTIONS int(6) NO 0
+THREADS int(6) NO 0
+ACTIVE_THREADS int(6) NO 0
+STANDBY_THREADS int(6) NO 0
+QUEUE_LENGTH int(6) NO 0
+HAS_LISTENER tinyint(1) NO 0
+IS_STALLED tinyint(1) NO 0
+SELECT COUNT(*)=@@thread_pool_size FROM INFORMATION_SCHEMA.THREAD_POOL_GROUPS;
+COUNT(*)=@@thread_pool_size
+1
+SELECT SUM(CONNECTIONS) FROM INFORMATION_SCHEMA.THREAD_POOL_GROUPS;
+SUM(CONNECTIONS)
+1
+SELECT SUM(THREADS) > 0 FROM INFORMATION_SCHEMA.THREAD_POOL_GROUPS;
+SUM(THREADS) > 0
+1
+SELECT SUM(ACTIVE_THREADS) > 0 FROM INFORMATION_SCHEMA.THREAD_POOL_GROUPS;
+SUM(ACTIVE_THREADS) > 0
+1
+SELECT SUM(QUEUE_LENGTH) FROM INFORMATION_SCHEMA.THREAD_POOL_GROUPS;
+SUM(QUEUE_LENGTH)
+0
+SELECT SUM(IS_STALLED) FROM INFORMATION_SCHEMA.THREAD_POOL_GROUPS;
+SUM(IS_STALLED)
+0
+DESC INFORMATION_SCHEMA.THREAD_POOL_QUEUES;
+Field Type Null Key Default Extra
+GROUP_ID int(6) NO 0
+POSITION int(6) NO 0
+PRIORITY int(1) NO 0
+CONNECTION_ID bigint(19) unsigned NO 0
+QUEUEING_TIME_MICROSECONDS bigint(19) NO 0
+DESC INFORMATION_SCHEMA.THREAD_POOL_STATS;
+Field Type Null Key Default Extra
+GROUP_ID int(6) NO 0
+THREAD_CREATIONS bigint(19) NO 0
+THREAD_CREATIONS_DUE_TO_STALL bigint(19) NO 0
+WAKES bigint(19) NO 0
+WAKES_DUE_TO_STALL bigint(19) NO 0
+THROTTLES bigint(19) NO 0
+STALLS bigint(19) NO 0
+POLLS_BY_LISTENER bigint(19) NO 0
+POLLS_BY_WORKER bigint(19) NO 0
+DEQUEUES_BY_LISTENER bigint(19) NO 0
+DEQUEUES_BY_WORKER bigint(19) NO 0
+SELECT SUM(DEQUEUES_BY_LISTENER+DEQUEUES_BY_WORKER) > 0 FROM INFORMATION_SCHEMA.THREAD_POOL_STATS;
+SUM(DEQUEUES_BY_LISTENER+DEQUEUES_BY_WORKER) > 0
+1
+SELECT SUM(POLLS_BY_LISTENER+POLLS_BY_WORKER) > 0 FROM INFORMATION_SCHEMA.THREAD_POOL_STATS;
+SUM(POLLS_BY_LISTENER+POLLS_BY_WORKER) > 0
+1
+FLUSH THREAD_POOL_STATS;
+SELECT SUM(DEQUEUES_BY_LISTENER+DEQUEUES_BY_WORKER) FROM INFORMATION_SCHEMA.THREAD_POOL_STATS;
+SUM(DEQUEUES_BY_LISTENER+DEQUEUES_BY_WORKER)
+1
+SELECT SUM(POLLS_BY_LISTENER+POLLS_BY_WORKER) FROM INFORMATION_SCHEMA.THREAD_POOL_STATS;
+SUM(POLLS_BY_LISTENER+POLLS_BY_WORKER)
+2
+DESC INFORMATION_SCHEMA.THREAD_POOL_WAITS;
+Field Type Null Key Default Extra
+REASON varchar(16) NO
+COUNT bigint(19) NO 0
+SELECT REASON FROM INFORMATION_SCHEMA.THREAD_POOL_WAITS;
+REASON
+UNKNOWN
+SLEEP
+DISKIO
+ROW_LOCK
+GLOBAL_LOCK
+META_DATA_LOCK
+TABLE_LOCK
+USER_LOCK
+BINLOG
+GROUP_COMMIT
+SYNC
+NET
+SELECT COUNT FROM INFORMATION_SCHEMA.THREAD_POOL_WAITS WHERE REASON='Sleep';
+COUNT
+0
+SELECT SLEEP(0.01);
+SLEEP(0.01)
+0
+SELECT COUNT FROM INFORMATION_SCHEMA.THREAD_POOL_WAITS WHERE REASON='Sleep';
+COUNT
+1
+FLUSH THREAD_POOL_WAITS;
diff --git a/mysql-test/main/thread_pool_info.test b/mysql-test/main/thread_pool_info.test
new file mode 100644
index 00000000000..fe8acb6099a
--- /dev/null
+++ b/mysql-test/main/thread_pool_info.test
@@ -0,0 +1,41 @@
+source include/not_embedded.inc;
+
+let $have_plugin = `SELECT COUNT(*) FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_STATUS='ACTIVE' AND PLUGIN_NAME = 'THREAD_POOL_GROUPS'`;
+if(!$have_plugin)
+{
+ --skip Need thread_pool_groups plugin
+}
+
+#I_S.THREAD_POOL_GROUPS
+DESC INFORMATION_SCHEMA.THREAD_POOL_GROUPS;
+SELECT COUNT(*)=@@thread_pool_size FROM INFORMATION_SCHEMA.THREAD_POOL_GROUPS;
+SELECT SUM(CONNECTIONS) FROM INFORMATION_SCHEMA.THREAD_POOL_GROUPS;
+SELECT SUM(THREADS) > 0 FROM INFORMATION_SCHEMA.THREAD_POOL_GROUPS;
+SELECT SUM(ACTIVE_THREADS) > 0 FROM INFORMATION_SCHEMA.THREAD_POOL_GROUPS;
+SELECT SUM(QUEUE_LENGTH) FROM INFORMATION_SCHEMA.THREAD_POOL_GROUPS;
+SELECT SUM(IS_STALLED) FROM INFORMATION_SCHEMA.THREAD_POOL_GROUPS;
+
+# I_S.THREAD_POOL_QUEUES
+DESC INFORMATION_SCHEMA.THREAD_POOL_QUEUES;
+#Todo - figure out how to populate queue with debug test
+
+# I_S.THREAD_POOL_STATS
+DESC INFORMATION_SCHEMA.THREAD_POOL_STATS;
+# The following query does not reliably give results, after FLUSH
+# so if the test runs with --repeat, it would fail
+#SELECT SUM(THREAD_CREATIONS) > 0 FROM INFORMATION_SCHEMA.THREAD_POOL_STATS;
+SELECT SUM(DEQUEUES_BY_LISTENER+DEQUEUES_BY_WORKER) > 0 FROM INFORMATION_SCHEMA.THREAD_POOL_STATS;
+SELECT SUM(POLLS_BY_LISTENER+POLLS_BY_WORKER) > 0 FROM INFORMATION_SCHEMA.THREAD_POOL_STATS;
+--disable_ps_protocol
+FLUSH THREAD_POOL_STATS;
+SELECT SUM(DEQUEUES_BY_LISTENER+DEQUEUES_BY_WORKER) FROM INFORMATION_SCHEMA.THREAD_POOL_STATS;
+SELECT SUM(POLLS_BY_LISTENER+POLLS_BY_WORKER) FROM INFORMATION_SCHEMA.THREAD_POOL_STATS;
+--enable_ps_protocol
+
+#I_S.THREAD_POOL_WAITS
+DESC INFORMATION_SCHEMA.THREAD_POOL_WAITS;
+SELECT REASON FROM INFORMATION_SCHEMA.THREAD_POOL_WAITS;
+SELECT COUNT FROM INFORMATION_SCHEMA.THREAD_POOL_WAITS WHERE REASON='Sleep';
+SELECT SLEEP(0.01);
+SELECT COUNT FROM INFORMATION_SCHEMA.THREAD_POOL_WAITS WHERE REASON='Sleep';
+FLUSH THREAD_POOL_WAITS;
diff --git a/mysql-test/main/type_bit.result b/mysql-test/main/type_bit.result
index 2964f400f10..2c9b4230022 100644
--- a/mysql-test/main/type_bit.result
+++ b/mysql-test/main/type_bit.result
@@ -878,3 +878,26 @@ DROP TABLE t1;
#
# End of 10.4 tests
#
+#
+# Start of 10.5 tests
+#
+#
+# MDEV-20496 Assertion `field.is_sane()' failed in Protocol_text::store_field_metadata
+#
+CREATE TABLE t1 (b BIT(1));
+SELECT MIN(CASE WHEN 0 THEN b END) FROM t1;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def MIN(CASE WHEN 0 THEN b END) 8 1 0 Y 32928 0 63
+MIN(CASE WHEN 0 THEN b END)
+NULL
+CREATE TABLE t2 AS SELECT MIN(CASE WHEN 0 THEN b END) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `MIN(CASE WHEN 0 THEN b END)` bigint(1) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+#
+# End of 10.5 tests
+#
diff --git a/mysql-test/main/type_bit.test b/mysql-test/main/type_bit.test
index d0644b764ae..57bd990c8d7 100644
--- a/mysql-test/main/type_bit.test
+++ b/mysql-test/main/type_bit.test
@@ -511,3 +511,26 @@ DROP TABLE t1;
--echo #
--echo # End of 10.4 tests
--echo #
+
+--echo #
+--echo # Start of 10.5 tests
+--echo #
+
+--echo #
+--echo # MDEV-20496 Assertion `field.is_sane()' failed in Protocol_text::store_field_metadata
+--echo #
+
+CREATE TABLE t1 (b BIT(1));
+--disable_ps_protocol
+--enable_metadata
+SELECT MIN(CASE WHEN 0 THEN b END) FROM t1;
+--disable_metadata
+--enable_ps_protocol
+CREATE TABLE t2 AS SELECT MIN(CASE WHEN 0 THEN b END) FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.5 tests
+--echo #
diff --git a/mysql-test/main/type_blob.result b/mysql-test/main/type_blob.result
index cfb47f7b850..4dd416426c7 100644
--- a/mysql-test/main/type_blob.result
+++ b/mysql-test/main/type_blob.result
@@ -245,7 +245,7 @@ HELLO
HELLO MY
a
hello
-set big_tables=1;
+set tmp_memory_table_size=0;
select distinct t from t1;
t
NULL
@@ -326,7 +326,7 @@ HELLO
HELLO MY
a
hello
-set big_tables=0;
+set tmp_memory_table_size=default;
select distinct * from t1;
t c b d
NULL NULL NULL NULL
diff --git a/mysql-test/main/type_blob.test b/mysql-test/main/type_blob.test
index df565b187b4..d81c2c644c4 100644
--- a/mysql-test/main/type_blob.test
+++ b/mysql-test/main/type_blob.test
@@ -112,7 +112,7 @@ select distinct t from t1 order by t;
select distinct b from t1 order by b;
select t from t1 group by t;
select b from t1 group by b;
-set big_tables=1;
+set tmp_memory_table_size=0; # force on-disk tmp table
select distinct t from t1;
select distinct b from t1;
select distinct t from t1 order by t;
@@ -123,7 +123,7 @@ select distinct c from t1 order by c;
select distinct d from t1 order by d;
select c from t1 group by c;
select d from t1 group by d;
-set big_tables=0;
+set tmp_memory_table_size=default;
select distinct * from t1;
select t,count(*) from t1 group by t;
select b,count(*) from t1 group by b;
diff --git a/mysql-test/main/type_int.result b/mysql-test/main/type_int.result
index db08563a191..3b1321d9a60 100644
--- a/mysql-test/main/type_int.result
+++ b/mysql-test/main/type_int.result
@@ -401,3 +401,18 @@ DROP TABLE t1;
#
# End of 10.4 tests
#
+#
+# Start of 10.5 tests
+#
+#
+# MDEV-20363 Assertion `is_unsigned() == attr.unsigned_flag' failed in Type_handler_longlong::make_table_field
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2);
+SELECT DISTINCT 1 FROM t1 GROUP BY 0 >> NULL WITH ROLLUP;
+1
+1
+DROP TABLE t1;
+#
+# End of 10.5 tests
+#
diff --git a/mysql-test/main/type_int.test b/mysql-test/main/type_int.test
index 748ba3c3c52..77c532ff4ac 100644
--- a/mysql-test/main/type_int.test
+++ b/mysql-test/main/type_int.test
@@ -284,3 +284,21 @@ DROP TABLE t1;
--echo #
--echo # End of 10.4 tests
--echo #
+
+--echo #
+--echo # Start of 10.5 tests
+--echo #
+
+--echo #
+--echo # MDEV-20363 Assertion `is_unsigned() == attr.unsigned_flag' failed in Type_handler_longlong::make_table_field
+--echo #
+
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2);
+SELECT DISTINCT 1 FROM t1 GROUP BY 0 >> NULL WITH ROLLUP;
+DROP TABLE t1;
+
+
+--echo #
+--echo # End of 10.5 tests
+--echo #
diff --git a/mysql-test/main/type_row.result b/mysql-test/main/type_row.result
new file mode 100644
index 00000000000..dc74cfc88a4
--- /dev/null
+++ b/mysql-test/main/type_row.result
@@ -0,0 +1,51 @@
+#
+# Start of 10.5 tests
+#
+#
+# MDEV-20175 Move Type_handler_row from Type_collection_std to Type_collection_row
+#
+SELECT LEAST(ROW(1,1), ROW(1,1));
+ERROR HY000: Illegal parameter data types row and row for operation 'least'
+SELECT GREATEST(ROW(1,1), ROW(1,1));
+ERROR HY000: Illegal parameter data types row and row for operation 'greatest'
+SELECT LEAST(ROW(1,1), 1);
+ERROR HY000: Illegal parameter data types row and int for operation 'least'
+SELECT GREATEST(ROW(1,1), 1);
+ERROR HY000: Illegal parameter data types row and int for operation 'greatest'
+SELECT LEAST(1, ROW(1,1));
+ERROR HY000: Illegal parameter data types int and row for operation 'least'
+SELECT GREATEST(1, ROW(1,1));
+ERROR HY000: Illegal parameter data types int and row for operation 'greatest'
+SELECT ROW(1,1) + ROW(1,1);
+ERROR HY000: Illegal parameter data types row and row for operation '+'
+SELECT 1 + ROW(1,1);
+ERROR HY000: Illegal parameter data types int and row for operation '+'
+SELECT ROW(1,1) + 1;
+ERROR HY000: Illegal parameter data types row and int for operation '+'
+SELECT ROW(1,1) - ROW(1,1);
+ERROR HY000: Illegal parameter data types row and row for operation '-'
+SELECT 1 - ROW(1,1);
+ERROR HY000: Illegal parameter data types int and row for operation '-'
+SELECT ROW(1,1) - 1;
+ERROR HY000: Illegal parameter data types row and int for operation '-'
+SELECT ROW(1,1) * ROW(1,1);
+ERROR HY000: Illegal parameter data types row and row for operation '*'
+SELECT 1 * ROW(1,1);
+ERROR HY000: Illegal parameter data types int and row for operation '*'
+SELECT ROW(1,1) * 1;
+ERROR HY000: Illegal parameter data types row and int for operation '*'
+SELECT ROW(1,1) / ROW(1,1);
+ERROR HY000: Illegal parameter data types row and row for operation '/'
+SELECT 1 / ROW(1,1);
+ERROR HY000: Illegal parameter data types int and row for operation '/'
+SELECT ROW(1,1) / 1;
+ERROR HY000: Illegal parameter data types row and int for operation '/'
+SELECT ROW(1,1) % ROW(1,1);
+ERROR HY000: Illegal parameter data types row and row for operation 'MOD'
+SELECT 1 % ROW(1,1);
+ERROR HY000: Illegal parameter data types int and row for operation 'MOD'
+SELECT ROW(1,1) % 1;
+ERROR HY000: Illegal parameter data types row and int for operation 'MOD'
+#
+# End of 10.5 tests
+#
diff --git a/mysql-test/main/type_row.test b/mysql-test/main/type_row.test
new file mode 100644
index 00000000000..2a5902351e2
--- /dev/null
+++ b/mysql-test/main/type_row.test
@@ -0,0 +1,62 @@
+--echo #
+--echo # Start of 10.5 tests
+--echo #
+
+--echo #
+--echo # MDEV-20175 Move Type_handler_row from Type_collection_std to Type_collection_row
+--echo #
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT LEAST(ROW(1,1), ROW(1,1));
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT GREATEST(ROW(1,1), ROW(1,1));
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT LEAST(ROW(1,1), 1);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT GREATEST(ROW(1,1), 1);
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT LEAST(1, ROW(1,1));
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT GREATEST(1, ROW(1,1));
+
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT ROW(1,1) + ROW(1,1);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT 1 + ROW(1,1);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT ROW(1,1) + 1;
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT ROW(1,1) - ROW(1,1);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT 1 - ROW(1,1);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT ROW(1,1) - 1;
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT ROW(1,1) * ROW(1,1);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT 1 * ROW(1,1);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT ROW(1,1) * 1;
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT ROW(1,1) / ROW(1,1);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT 1 / ROW(1,1);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT ROW(1,1) / 1;
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT ROW(1,1) % ROW(1,1);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT 1 % ROW(1,1);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT ROW(1,1) % 1;
+
+--echo #
+--echo # End of 10.5 tests
+--echo #
diff --git a/mysql-test/main/type_varchar.result b/mysql-test/main/type_varchar.result
index cec279913b4..e42a363a2c2 100644
--- a/mysql-test/main/type_varchar.result
+++ b/mysql-test/main/type_varchar.result
@@ -739,3 +739,32 @@ SET sql_mode=DEFAULT;
#
# End of 10.4 tests
#
+#
+# Start of 10.5 tests
+#
+#
+# MDEV-15592 Column COMPRESSED should select a 'high order' datatype
+#
+TRUNCATE TABLE vchar;
+SHOW CREATE TABLE vchar;
+Table Create Table
+vchar CREATE TABLE `vchar` (
+ `v` varchar(30)/*old*/ DEFAULT NULL,
+ `c` char(3) DEFAULT NULL,
+ `e` enum('abc','def','ghi') DEFAULT NULL,
+ `t` text DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ALTER TABLE vchar ADD FULLTEXT INDEX(v);
+SHOW CREATE TABLE vchar;
+Table Create Table
+vchar CREATE TABLE `vchar` (
+ `v` varchar(30) DEFAULT NULL,
+ `c` char(3) DEFAULT NULL,
+ `e` enum('abc','def','ghi') DEFAULT NULL,
+ `t` text DEFAULT NULL,
+ FULLTEXT KEY `v` (`v`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE vchar;
+#
+# End of 10.5 tests
+#
diff --git a/mysql-test/main/type_varchar.test b/mysql-test/main/type_varchar.test
index 9d0ad8a128b..f63523e226b 100644
--- a/mysql-test/main/type_varchar.test
+++ b/mysql-test/main/type_varchar.test
@@ -373,3 +373,26 @@ SET sql_mode=DEFAULT;
--echo #
--echo # End of 10.4 tests
--echo #
+
+--echo #
+--echo # Start of 10.5 tests
+--echo #
+
+--echo #
+--echo # MDEV-15592 Column COMPRESSED should select a 'high order' datatype
+--echo #
+
+#
+# Old VARCHAR is automatically upgraded to new VARCHAR.
+# So we don't have to override Type_handler_var_string::Key_part_spec_init_ft()
+#
+copy_file $MYSQL_TEST_DIR/std_data/vchar.frm $MYSQLD_DATADIR/test/vchar.frm;
+TRUNCATE TABLE vchar;
+SHOW CREATE TABLE vchar;
+ALTER TABLE vchar ADD FULLTEXT INDEX(v);
+SHOW CREATE TABLE vchar;
+DROP TABLE vchar;
+
+--echo #
+--echo # End of 10.5 tests
+--echo #
diff --git a/mysql-test/main/type_year.result b/mysql-test/main/type_year.result
index 71285418588..1792cd5b7d4 100644
--- a/mysql-test/main/type_year.result
+++ b/mysql-test/main/type_year.result
@@ -587,3 +587,29 @@ DROP TABLE t1;
#
# End of 10.4 tests
#
+#
+# Start of 10.5 tests
+#
+#
+# MDEV-20384 Assertion `field.is_sane()' failed in Protocol_text::store_field_metadata
+#
+CREATE TABLE t1 (a YEAR);
+INSERT INTO t1 VALUES (2000),(2001);
+SELECT MAX( NULLIF( a, 1970 ) ) AS f FROM t1;
+f
+2001
+SELECT NULLIF(a, 1970) AS f FROM t1 ORDER BY a;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def f 13 4 4 Y 32928 0 63
+f
+2000
+2001
+SELECT MAX(NULLIF(a, 1970)) AS f FROM t1;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def f 8 4 4 Y 32928 0 63
+f
+2001
+DROP TABLE t1;
+#
+# End of 10.5 tests
+#
diff --git a/mysql-test/main/type_year.test b/mysql-test/main/type_year.test
index 3c578b3ab59..6f16610c06f 100644
--- a/mysql-test/main/type_year.test
+++ b/mysql-test/main/type_year.test
@@ -329,3 +329,27 @@ DROP TABLE t1;
--echo #
--echo # End of 10.4 tests
--echo #
+
+--echo #
+--echo # Start of 10.5 tests
+--echo #
+
+--echo #
+--echo # MDEV-20384 Assertion `field.is_sane()' failed in Protocol_text::store_field_metadata
+--echo #
+
+CREATE TABLE t1 (a YEAR);
+INSERT INTO t1 VALUES (2000),(2001);
+SELECT MAX( NULLIF( a, 1970 ) ) AS f FROM t1;
+--disable_ps_protocol
+--enable_metadata
+SELECT NULLIF(a, 1970) AS f FROM t1 ORDER BY a;
+SELECT MAX(NULLIF(a, 1970)) AS f FROM t1;
+--disable_metadata
+--enable_ps_protocol
+DROP TABLE t1;
+
+
+--echo #
+--echo # End of 10.5 tests
+--echo #
diff --git a/mysql-test/main/unsafe_binlog_innodb-master.opt b/mysql-test/main/unsafe_binlog_innodb-master.opt
deleted file mode 100644
index 0d13f0834a5..00000000000
--- a/mysql-test/main/unsafe_binlog_innodb-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-innodb_locks_unsafe_for_binlog --loose-innodb_lock_wait_timeout=1
diff --git a/mysql-test/main/unsafe_binlog_innodb.result b/mysql-test/main/unsafe_binlog_innodb.result
index 0fe3d38035b..c917362af59 100644
--- a/mysql-test/main/unsafe_binlog_innodb.result
+++ b/mysql-test/main/unsafe_binlog_innodb.result
@@ -1,3 +1,7 @@
+SET @save_timeout = @@GLOBAL.innodb_lock_wait_timeout;
+SET GLOBAL innodb_lock_wait_timeout = 1;
+SET @save_isolation = @@GLOBAL.tx_isolation;
+SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
create table t1 (id int not null, f_id int not null, f int not null,
primary key(f_id, id)) engine = InnoDB;
@@ -187,3 +191,5 @@ disconnect h;
disconnect i;
disconnect j;
drop table t1, t2, t3, t5, t6, t8, t9;
+SET GLOBAL innodb_lock_wait_timeout = @save_timeout;
+SET GLOBAL tx_isolation = @save_isolation;
diff --git a/mysql-test/main/unsafe_binlog_innodb.test b/mysql-test/main/unsafe_binlog_innodb.test
index a0516749451..abd2c58de30 100644
--- a/mysql-test/main/unsafe_binlog_innodb.test
+++ b/mysql-test/main/unsafe_binlog_innodb.test
@@ -13,4 +13,12 @@
--source include/have_innodb.inc
let $engine_type= InnoDB;
+SET @save_timeout = @@GLOBAL.innodb_lock_wait_timeout;
+SET GLOBAL innodb_lock_wait_timeout = 1;
+SET @save_isolation = @@GLOBAL.tx_isolation;
+SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED;
+
--source include/unsafe_binlog.inc
+
+SET GLOBAL innodb_lock_wait_timeout = @save_timeout;
+SET GLOBAL tx_isolation = @save_isolation;
diff --git a/mysql-test/main/user_var.result b/mysql-test/main/user_var.result
index b475a8ca60a..7b4c8e0b66e 100644
--- a/mysql-test/main/user_var.result
+++ b/mysql-test/main/user_var.result
@@ -188,7 +188,7 @@ NULL 2
set @v1=null, @v2=1, @v3=1.1, @v4=now();
select coercibility(@v1),coercibility(@v2),coercibility(@v3),coercibility(@v4);
coercibility(@v1) coercibility(@v2) coercibility(@v3) coercibility(@v4)
-2 2 2 2
+2 5 5 2
set session @honk=99;
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 '@honk=99' at line 1
select @@local.max_allowed_packet;
diff --git a/mysql-test/main/variables.result b/mysql-test/main/variables.result
index 9cf751a1ee5..66acb163661 100644
--- a/mysql-test/main/variables.result
+++ b/mysql-test/main/variables.result
@@ -162,7 +162,6 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select @@IDENTITY AS `@@IDENTITY`,last_insert_id() AS `last_insert_id()`,@@identity AS `@@identity`
-set big_tables=OFF, big_tables=ON, big_tables=0, big_tables=1, big_tables="OFF", big_tables="ON";
set global concurrent_insert=2;
show variables like 'concurrent_insert';
Variable_name Value
@@ -422,18 +421,14 @@ SELECT @@version LIKE 'non-existent';
SELECT @@version_compile_os LIKE 'non-existent';
@@version_compile_os LIKE 'non-existent'
0
-set big_tables=OFFF;
-ERROR 42000: Variable 'big_tables' can't be set to the value of 'OFFF'
-set big_tables="OFFF";
-ERROR 42000: Variable 'big_tables' can't be set to the value of 'OFFF'
set unknown_variable=1;
ERROR HY000: Unknown system variable 'unknown_variable'
set max_join_size="hello";
ERROR 42000: Incorrect argument type to variable 'max_join_size'
set default_storage_engine=UNKNOWN_TABLE_TYPE;
ERROR 42000: Unknown storage engine 'UNKNOWN_TABLE_TYPE'
-set default_storage_engine=MERGE, big_tables=2;
-ERROR 42000: Variable 'big_tables' can't be set to the value of '2'
+set default_storage_engine=MERGE, sql_warnings=NULL;
+ERROR 42000: Variable 'sql_warnings' can't be set to the value of 'NULL'
show local variables like 'default_storage_engine';
Variable_name Value
default_storage_engine MEMORY
@@ -456,10 +451,9 @@ ERROR HY000: Variable 'myisam_max_sort_file_size' is a GLOBAL variable and shoul
set @@SQL_WARNINGS=NULL;
ERROR 42000: Variable 'sql_warnings' can't be set to the value of 'NULL'
set autocommit=1;
-set big_tables=1;
-select @@autocommit, @@big_tables;
-@@autocommit @@big_tables
-1 1
+select @@autocommit;
+@@autocommit
+1
set global binlog_cache_size=100;
Warnings:
Warning 1292 Truncated incorrect binlog_cache_size value: '100'
@@ -1532,9 +1526,6 @@ SET @@global.max_binlog_cache_size=DEFAULT;
SET @@global.max_join_size=DEFAULT;
SET @@global.key_buffer_size=@kbs;
SET @@global.key_cache_block_size=@kcbs;
-select @@max_long_data_size > 0;
-@@max_long_data_size > 0
-1
#
# Bug#11766424 59527:
# Assert in DECIMAL_BIN_SIZE:
diff --git a/mysql-test/main/variables.test b/mysql-test/main/variables.test
index 846d2665013..eab323dda3d 100644
--- a/mysql-test/main/variables.test
+++ b/mysql-test/main/variables.test
@@ -113,8 +113,6 @@ explain extended select last_insert_id(345);
select @@IDENTITY,last_insert_id(), @@identity;
explain extended select @@IDENTITY,last_insert_id(), @@identity;
-set big_tables=OFF, big_tables=ON, big_tables=0, big_tables=1, big_tables="OFF", big_tables="ON";
-
set global concurrent_insert=2;
show variables like 'concurrent_insert';
select * from information_schema.session_variables where variable_name like 'concurrent_insert';
@@ -241,10 +239,6 @@ SELECT @@version_compile_os LIKE 'non-existent';
# The following should give errors
---error ER_WRONG_VALUE_FOR_VAR
-set big_tables=OFFF;
---error ER_WRONG_VALUE_FOR_VAR
-set big_tables="OFFF";
--error ER_UNKNOWN_SYSTEM_VARIABLE
set unknown_variable=1;
--error ER_WRONG_TYPE_FOR_VAR
@@ -252,7 +246,7 @@ set max_join_size="hello";
--error ER_UNKNOWN_STORAGE_ENGINE
set default_storage_engine=UNKNOWN_TABLE_TYPE;
--error ER_WRONG_VALUE_FOR_VAR
-set default_storage_engine=MERGE, big_tables=2;
+set default_storage_engine=MERGE, sql_warnings=NULL;
show local variables like 'default_storage_engine';
--error ER_UNKNOWN_CHARACTER_SET
set character_set_client=UNKNOWN_CHARACTER_SET;
@@ -276,8 +270,7 @@ set @@SQL_WARNINGS=NULL;
# Test setting all variables
set autocommit=1;
-set big_tables=1;
-select @@autocommit, @@big_tables;
+select @@autocommit;
set global binlog_cache_size=100;
set bulk_insert_buffer_size=100;
set character set cp1251_koi8;
@@ -1264,11 +1257,6 @@ SET @@global.max_join_size=DEFAULT;
SET @@global.key_buffer_size=@kbs;
SET @@global.key_cache_block_size=@kcbs;
-#
-# Bug#56976: added new start-up parameter
-#
-select @@max_long_data_size > 0;
-
--echo #
--echo # Bug#11766424 59527:
--echo # Assert in DECIMAL_BIN_SIZE:
diff --git a/mysql-test/main/view.result b/mysql-test/main/view.result
index 13f3761cdee..496cea70d81 100644
--- a/mysql-test/main/view.result
+++ b/mysql-test/main/view.result
@@ -5738,8 +5738,7 @@ drop view v60;
#
# MDEV-15572: view.test, server crash with --big-tables=1
#
-set @save_big_tables=@@big_tables;
-set big_tables=ON;
+set tmp_memory_table_size=0;
CREATE TABLE t1 ( f1 int , f2 int , f3 int , f4 int);
CREATE TABLE t2 ( f1 int , f2 int , f3 int , f4 int);
CREATE VIEW v1 AS
@@ -5749,7 +5748,7 @@ SELECT f1, f2, f3, f4 FROM t1;
ERROR HY000: Can not modify more than one base table through a join view 'test.v1'
drop view v1;
drop table t1, t2;
-set big_tables=@save_big_tables;
+set tmp_memory_table_size=default;
# -----------------------------------------------------------------
# -- End of 5.5 tests.
# -----------------------------------------------------------------
diff --git a/mysql-test/main/view.test b/mysql-test/main/view.test
index 4fc87f6283c..6c9a6aa70c8 100644
--- a/mysql-test/main/view.test
+++ b/mysql-test/main/view.test
@@ -5628,8 +5628,7 @@ drop view v60;
--echo # MDEV-15572: view.test, server crash with --big-tables=1
--echo #
-set @save_big_tables=@@big_tables;
-set big_tables=ON;
+set tmp_memory_table_size=0; # force on-disk tmp table
CREATE TABLE t1 ( f1 int , f2 int , f3 int , f4 int);
CREATE TABLE t2 ( f1 int , f2 int , f3 int , f4 int);
@@ -5642,7 +5641,7 @@ REPLACE INTO v1 (f1, f2, f3, f4)
drop view v1;
drop table t1, t2;
-set big_tables=@save_big_tables;
+set tmp_memory_table_size=default;
--echo # -----------------------------------------------------------------
--echo # -- End of 5.5 tests.
diff --git a/mysql-test/main/win.result b/mysql-test/main/win.result
index 4adb5c84f1e..0eec38db611 100644
--- a/mysql-test/main/win.result
+++ b/mysql-test/main/win.result
@@ -1742,8 +1742,7 @@ drop table t1;
#
create table t1(a int);
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-set @tmp=@@big_tables;
-set big_tables=1;
+set tmp_memory_table_size=0;
select rank() over (order by a) from t1;
rank() over (order by a)
1
@@ -1756,7 +1755,7 @@ rank() over (order by a)
8
9
10
-set big_tables=@tmp;
+set tmp_memory_table_size=default;
drop table t1;
#
# Check if "ORDER BY window_func" works
diff --git a/mysql-test/main/win.test b/mysql-test/main/win.test
index 3d5fb2240de..ef55f4bdbc7 100644
--- a/mysql-test/main/win.test
+++ b/mysql-test/main/win.test
@@ -1067,10 +1067,9 @@ drop table t1;
--echo #
create table t1(a int);
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-set @tmp=@@big_tables;
-set big_tables=1;
+set tmp_memory_table_size=0; # force on-disk tmp table
select rank() over (order by a) from t1;
-set big_tables=@tmp;
+set tmp_memory_table_size=default;
drop table t1;
--echo #
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 6d4549d7d7a..47fa0d4cc2d 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -189,6 +189,7 @@ my @DEFAULT_SUITES= qw(
innodb-
innodb_fts-
innodb_gis-
+ innodb_i_s-
innodb_zip-
json-
maria-
@@ -202,6 +203,7 @@ my @DEFAULT_SUITES= qw(
rpl-
sys_vars-
sql_sequence-
+ type_inet-
unit-
vcol-
versioning-
@@ -1782,12 +1784,24 @@ sub command_line_setup {
# --------------------------------------------------------------------------
# Check debug related options
# --------------------------------------------------------------------------
+ $ENV{ASAN_OPTIONS}= "abort_on_error=1:" . ($ENV{ASAN_OPTIONS} || '');
+ $ENV{ASAN_OPTIONS}= "suppressions=${glob_mysql_test_dir}/asan.supp:" .
+ $ENV{ASAN_OPTIONS}
+ if -f "$glob_mysql_test_dir/asan.supp";
+ # The following can be useful when a test fails without any asan report
+ # on stderr like with openssl_1.test
+ # $ENV{ASAN_OPTIONS}= "log_path=${opt_vardir}/log/asan:" . $ENV{ASAN_OPTIONS};
+
+ # Add leak suppressions
+ $ENV{LSAN_OPTIONS}= "suppressions=${glob_mysql_test_dir}/lsan.supp"
+ if -f "$glob_mysql_test_dir/lsan.supp";
+
if ( $opt_gdb || $opt_client_gdb || $opt_ddd || $opt_client_ddd ||
$opt_manual_gdb || $opt_manual_lldb || $opt_manual_ddd ||
$opt_manual_debug || $opt_dbx || $opt_client_dbx || $opt_manual_dbx ||
$opt_debugger || $opt_client_debugger )
{
- $ENV{ASAN_OPTIONS}= 'abort_on_error=1:'.($ENV{ASAN_OPTIONS} || '');
+ $ENV{ASAN_OPTIONS}= 'disable_coredump=0:'. $ENV{ASAN_OPTIONS};
if ( using_extern() )
{
mtr_error("Can't use --extern when using debugger");
@@ -1912,9 +1926,13 @@ sub command_line_setup {
if ($opt_valgrind && ! grep(/^--tool=/i, @valgrind_args))
{
# Set valgrind_option unless already defined
- push(@valgrind_args, ("--show-reachable=yes", "--leak-check=yes",
- "--num-callers=16"))
- unless @valgrind_args;
+ if (!@valgrind_args)
+ {
+ push(@valgrind_args, ("--show-reachable=yes", "--leak-check=yes",
+ "--num-callers=20"));
+ push(@valgrind_args, ("--gen-suppressions=all"));
+ # push(@valgrind_args, ("--trace-signals=yes"));
+ }
unshift(@valgrind_args, "--tool=memcheck");
}
diff --git a/mysql-test/std_data/checkDBI_DBD-mysql.pl b/mysql-test/std_data/checkDBI_DBD-MariaDB.pl
index 328a7ad774f..ed0f5b415d7 100755
--- a/mysql-test/std_data/checkDBI_DBD-mysql.pl
+++ b/mysql-test/std_data/checkDBI_DBD-MariaDB.pl
@@ -20,7 +20,7 @@
################################################################################
#
# This perl script checks for availability of the Perl modules DBI and
-# DBD::mysql using the "current" perl interpreter.
+# DBD::MariaDB using the "current" perl interpreter.
#
# Useful for test environment checking before testing executable perl scripts
# in the MySQL Server distribution.
@@ -30,8 +30,8 @@
# support running perl scripts with such a shebang without specifying the
# perl interpreter on the command line. Such a script is mysqlhotcopy.
#
-# When run as "checkDBI_DBD-mysql.pl" the shebang line will be evaluated
-# and used. When run as "perl checkDBI_DBD-mysql.pl" the shebang line is
+# When run as "checkDBI_DBD-MariaDB.pl" the shebang line will be evaluated
+# and used. When run as "perl checkDBI_DBD-MariaDB.pl" the shebang line is
# not used.
#
# NOTE: This script will create a temporary file in MTR's tmp dir.
@@ -43,13 +43,13 @@
#
# Example:
#
-# --let $perlChecker= $MYSQLTEST_VARDIR/std_data/checkDBI_DBD-mysql.pl
-# --let $resultFile= $MYSQL_TMP_DIR/dbidbd-mysql.txt
+# --let $perlChecker= $MYSQLTEST_VARDIR/std_data/checkDBI_DBD-MariaDB.pl
+# --let $resultFile= $MYSQL_TMP_DIR/dbiDBD-MariaDB.txt
# --chmod 0755 $perlChecker
# --exec $perlChecker
# --source $resultFile
# if (!$dbidbd) {
-# --skip Test needs Perl modules DBI and DBD::mysql
+# --skip Test needs Perl modules DBI and DBD::MariaDB
# }
#
# The calling script is also responsible for cleaning up after use:
@@ -59,7 +59,7 @@
# Windows notes:
# - shebangs may work differently - call this script with "perl " in front.
#
-# See mysql-test/include/have_dbi_dbd-mysql.inc for example use of this script.
+# See mysql-test/include/have_dbi_dbd-mariadb.inc for example use of this script.
# This script should be executable for the user running MTR.
#
################################################################################
@@ -69,13 +69,13 @@ BEGIN {
# We need to catch "Can't locate" as well as "Can't load" errors.
eval{
$FOUND_DBI=0;
- $FOUND_DBD_MYSQL=0;
+ $FOUND_DBD_MARIADB=0;
# Check for DBI module:
$FOUND_DBI=1 if require DBI;
- # Check for DBD::mysql module
- $FOUND_DBD_MYSQL=1 if require DBD::mysql;
+ # Check for DBD::MariaDB module
+ $FOUND_DBD_MARIADB=1 if require DBD::MariaDB;
};
};
@@ -83,11 +83,11 @@ BEGIN {
# The file must be created whether we write to it or not, otherwise mysql-test
# will complain if trying to source it.
# An empty file indicates failure to load modules.
-open(FILE, ">", $ENV{'MYSQL_TMP_DIR'}.'/dbidbd-mysql.txt');
+open(FILE, ">", $ENV{'MYSQL_TMP_DIR'}.'/dbiDBD-MariaDB.txt');
-if ($FOUND_DBI && $FOUND_DBD_MYSQL) {
+if ($FOUND_DBI && $FOUND_DBD_MARIADB) {
# write a mysql-test command setting a variable to indicate success
- print(FILE 'let $dbidbd= FOUND_DBI_DBD-MYSQL;'."\n");
+ print(FILE 'let $dbidbd= FOUND_DBI_DBD-MARIADB;'."\n");
}
# close the file.
diff --git a/mysql-test/std_data/s3_unique_table.frm b/mysql-test/std_data/s3_unique_table.frm
new file mode 100644
index 00000000000..23bb5215783
--- /dev/null
+++ b/mysql-test/std_data/s3_unique_table.frm
Binary files differ
diff --git a/mysql-test/suite/binlog/include/print_optional_metadata.inc b/mysql-test/suite/binlog/include/print_optional_metadata.inc
new file mode 100644
index 00000000000..739903ab190
--- /dev/null
+++ b/mysql-test/suite/binlog/include/print_optional_metadata.inc
@@ -0,0 +1,34 @@
+# Auxaliary file for printing optional metadata in table_map_log_event
+# Usage :
+# --let $binlog_file=
+# [--let $stop_position]
+# [--let $print_primary_key]
+# --source extra/binlog_tests/print_optional_metadata.inc
+
+--let $output_file= $MYSQLTEST_VARDIR/tmp/mysqlbinlog.output
+
+--let $_stop_position_opt=
+if ($stop_position)
+{
+ --let $_stop_position_opt=--stop-position=$stop_position
+}
+
+--exec $MYSQL_BINLOG -F --print-table-metadata $_stop_position_opt $binlog_file > $output_file
+
+
+--let SEARCH_PATTERN= # (?:Columns\(| {8}).*
+--let SEARCH_FILE= $output_file
+--let SEARCH_OUTPUT=matches
+--let SEARCH_TYPE="_gm_"
+--source include/search_pattern_in_file.inc
+
+if ($print_primary_key)
+{
+ --let SEARCH_PATTERN= # Primary Key
+ --source include/search_pattern_in_file.inc
+}
+--remove_file $output_file
+--let $stop_position=
+--let $_stop_position_opt=
+
+
diff --git a/mysql-test/suite/binlog/r/binlog_table_map_optional_metadata.result b/mysql-test/suite/binlog/r/binlog_table_map_optional_metadata.result
new file mode 100644
index 00000000000..cb34f48fb69
--- /dev/null
+++ b/mysql-test/suite/binlog/r/binlog_table_map_optional_metadata.result
@@ -0,0 +1,312 @@
+RESET MASTER;
+SET GLOBAL binlog_row_metadata = MINIMAL;
+#
+# Temporal types can be printed correctly
+#
+CREATE TABLE t1(c_year YEAR, c_date DATE, c_time TIME, c_time_f TIME(3),
+c_datetime DATETIME, c_datetime_f DATETIME(3),
+c_timestamp TIMESTAMP, c_timestamp_f TIMESTAMP(3) DEFAULT "2017-1-1 10:10:10");
+INSERT INTO t1(c_year) VALUES(2017);
+# Columns(YEAR,
+# DATE,
+# TIME,
+# TIME(3),
+# DATETIME,
+# DATETIME(3),
+# TIMESTAMP NOT NULL,
+# TIMESTAMP(3) NOT NULL)
+DROP TABLE t1;
+RESET MASTER;
+#
+# Geometry types can be printed correctly
+#
+CREATE TABLE t1 (c_geo GEOMETRY, c_point POINT, c_linestring LINESTRING,
+c_polygon POLYGON, c_multi_point MULTIPOINT,
+c_multi_linestring MULTILINESTRING, c_multi_polygon MULTIPOLYGON,
+c_geometrycollection GEOMETRYCOLLECTION, c_char CHAR(100));
+INSERT INTO t1(c_point) VALUES(ST_PointFromText('POINT(10 10)'));
+# Columns(GEOMETRY,
+# POINT,
+# LINESTRING,
+# POLYGON,
+# MULTIPOINT,
+# MULTILINESTRING,
+# MULTIPOLYGON,
+# GEOMETRYCOLLECTION,
+# CHAR(100) CHARSET latin1 COLLATE latin1_swedish_ci)
+RESET MASTER;
+SET GLOBAL binlog_row_metadata = FULL;
+INSERT INTO t1(c_point) VALUES(ST_PointFromText('POINT(10 10)'));
+# Columns(`c_geo` GEOMETRY,
+# `c_point` POINT,
+# `c_linestring` LINESTRING,
+# `c_polygon` POLYGON,
+# `c_multi_point` MULTIPOINT,
+# `c_multi_linestring` MULTILINESTRING,
+# `c_multi_polygon` MULTIPOLYGON,
+# `c_geometrycollection` GEOMETRYCOLLECTION,
+# `c_char` CHAR(100) CHARSET latin1 COLLATE latin1_swedish_ci)
+DROP TABLE t1;
+RESET MASTER;
+#
+# Numeric types can be printed correctly
+#
+CREATE TABLE t1(c_bit BIT(10), c_bool BOOL, c_smallint SMALLINT,
+c_mediumint MEDIUMINT, c_int INT UNSIGNED, c_bigint BIGINT,
+c_float FLOAT UNSIGNED, c_double DOUBLE, c_decimal DECIMAL(10, 2));
+SET GLOBAL binlog_row_metadata = MINIMAL;
+INSERT INTO t1(c_bool) VALUES(1);
+# UNSIGNED flag should be printed
+# Columns(BIT(10),
+# TINYINT,
+# SMALLINT,
+# MEDIUMINT,
+# INT UNSIGNED,
+# BIGINT,
+# FLOAT UNSIGNED,
+# DOUBLE,
+# DECIMAL(10,2))
+RESET MASTER;
+SET GLOBAL binlog_row_metadata = FULL;
+INSERT INTO t1(c_bool) VALUES(1);
+# Columns(`c_bit` BIT(10),
+# `c_bool` TINYINT,
+# `c_smallint` SMALLINT,
+# `c_mediumint` MEDIUMINT,
+# `c_int` INT UNSIGNED,
+# `c_bigint` BIGINT,
+# `c_float` FLOAT UNSIGNED,
+# `c_double` DOUBLE,
+# `c_decimal` DECIMAL(10,2))
+DROP TABLE t1;
+RESET MASTER;
+#
+# Character types can be printed correctly
+#
+CREATE TABLE t1(c_char CHAR(10), c_varchar VARCHAR(500),
+c_tinytext TINYTEXT, c_text TEXT,
+c_mediumtext MEDIUMTEXT, c_longtext LONGTEXT CHARSET utf8);
+SET GLOBAL binlog_row_metadata = MINIMAL;
+INSERT INTO t1(c_char) VALUES("1");
+# Columns(CHAR(10) CHARSET latin1 COLLATE latin1_swedish_ci,
+# VARCHAR(500) CHARSET latin1 COLLATE latin1_swedish_ci,
+# TINYTEXT CHARSET latin1 COLLATE latin1_swedish_ci,
+# TEXT CHARSET latin1 COLLATE latin1_swedish_ci,
+# MEDIUMTEXT CHARSET latin1 COLLATE latin1_swedish_ci,
+# LONGTEXT CHARSET utf8 COLLATE utf8_general_ci)
+RESET MASTER;
+SET GLOBAL binlog_row_metadata = FULL;
+INSERT INTO t1(c_char) VALUES("1");
+# Columns(`c_char` CHAR(10) CHARSET latin1 COLLATE latin1_swedish_ci,
+# `c_varchar` VARCHAR(500) CHARSET latin1 COLLATE latin1_swedish_ci,
+# `c_tinytext` TINYTEXT CHARSET latin1 COLLATE latin1_swedish_ci,
+# `c_text` TEXT CHARSET latin1 COLLATE latin1_swedish_ci,
+# `c_mediumtext` MEDIUMTEXT CHARSET latin1 COLLATE latin1_swedish_ci,
+# `c_longtext` LONGTEXT CHARSET utf8 COLLATE utf8_general_ci)
+DROP TABLE t1;
+RESET MASTER;
+#
+# Column names with non-ascii characters and escape characters can be printed correctly
+#
+set names utf8;
+CREATE TABLE t1(`åäö表\a'``"` INT);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `åäö表\a'``"` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES(1);
+# Columns(`åäö表\\a\'`"` INT)
+DROP TABLE t1;
+RESET MASTER;
+#
+# Charsets can be printed correctly
+#
+CREATE TABLE t1(c_char_utf8 CHAR(10) CHARSET utf8,
+c_varchar_utf8 VARCHAR(10) CHARSET utf8,
+c_text_utf8 TEXT CHARSET utf8);
+INSERT INTO t1 VALUES("1", "2", "3");
+# Columns(`c_char_utf8` CHAR(10) CHARSET utf8 COLLATE utf8_general_ci,
+# `c_varchar_utf8` VARCHAR(10) CHARSET utf8 COLLATE utf8_general_ci,
+# `c_text_utf8` TEXT CHARSET utf8 COLLATE utf8_general_ci)
+DROP TABLE t1;
+RESET MASTER;
+CREATE TABLE t1(c_utf8mb4_520 CHAR(10) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci,
+c_utf8mb4_0900 VARCHAR(10) CHARSET utf8mb4 COLLATE utf8mb4_polish_ci,
+c_utf8mb4_def TEXT CHARSET utf8mb4);
+INSERT INTO t1 VALUES("1", "2", "3");
+# Columns(`c_utf8mb4_520` CHAR(10) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci,
+# `c_utf8mb4_0900` VARCHAR(10) CHARSET utf8mb4 COLLATE utf8mb4_polish_ci,
+# `c_utf8mb4_def` TEXT CHARSET utf8mb4 COLLATE utf8mb4_general_ci)
+DROP TABLE t1;
+RESET MASTER;
+#
+# Blob and binary columns can be printed correctly
+#
+CREATE TABLE t1(c_binary BINARY(10), c_varbinary VARBINARY(10),
+c_tinyblob TINYBLOB, c_blob BLOB,
+c_mediumblob MEDIUMBLOB, c_longblob LONGBLOB);
+INSERT INTO t1 VALUES("1", "2", "3", "4", "5", "6");
+# Columns(`c_binary` BINARY(10),
+# `c_varbinary` VARBINARY(10),
+# `c_tinyblob` TINYBLOB,
+# `c_blob` BLOB,
+# `c_mediumblob` MEDIUMBLOB,
+# `c_longblob` LONGBLOB)
+DROP TABLE t1;
+RESET MASTER;
+#
+# Verify that SET string values and character sets can be printed correctly
+#
+set names utf8;
+CREATE TABLE t1(
+c_set_1 SET("set1_v1_å", "set1_v2_ä", "set1_v3_ö"),
+c_set_2 SET("set2_v1_å", "set2_v2_ä", "set2_v3_ö") CHARACTER SET latin1,
+c_set_4 SET("set3_v1_å", "set3_v2_ä", "set3_v3_ö") CHARACTER SET swe7 COLLATE swe7_bin);
+SET GLOBAL binlog_row_metadata = MINIMAL;
+INSERT INTO t1 VALUES("set1_v1_å", "set2_v3_ö", "set3_v1_å");
+# Columns(SET,
+# SET,
+# SET)
+RESET MASTER;
+SET GLOBAL binlog_row_metadata = FULL;
+INSERT INTO t1 VALUES("set1_v1_å", "set2_v3_ö", "set3_v1_å");
+# Columns(`c_set_1` SET('set1_v1_å','set1_v2_ä','set1_v3_ö') CHARSET latin1 COLLATE latin1_swedish_ci,
+# `c_set_2` SET('set2_v1_å','set2_v2_ä','set2_v3_ö') CHARSET latin1 COLLATE latin1_swedish_ci,
+# `c_set_4` SET('set3_v1_}','set3_v2_{','set3_v3_|') CHARSET swe7 COLLATE swe7_bin)
+DROP TABLE t1;
+RESET MASTER;
+#
+# Verify that ENUM string values and character sets can be printed correctly
+#
+CREATE TABLE t1(
+c_enum_1 ENUM("enum1_v1_å", "enum1_v2_ä", "enum1_v3_ö"),
+c_enum_3 ENUM("enum2_v1_å", "enum2_v2_ä", "enum2_v3_ö") CHARACTER SET latin1,
+c_enum_4 ENUM("enum3_v1_å", "enum3_v2_ä", "enum3_v3_ö") CHARACTER SET swe7 COLLATE swe7_bin);
+SET GLOBAL binlog_row_metadata = MINIMAL;
+INSERT INTO t1 VALUES("enum1_v1_å", "enum2_v3_ö", "enum3_v1_å");
+# Columns(ENUM,
+# ENUM,
+# ENUM)
+RESET MASTER;
+SET GLOBAL binlog_row_metadata = FULL;
+INSERT INTO t1 VALUES("enum1_v1_å", "enum2_v3_ö", "enum3_v1_å");
+# Columns(`c_enum_1` ENUM('enum1_v1_å','enum1_v2_ä','enum1_v3_ö') CHARSET latin1 COLLATE latin1_swedish_ci,
+# `c_enum_3` ENUM('enum2_v1_å','enum2_v2_ä','enum2_v3_ö') CHARSET latin1 COLLATE latin1_swedish_ci,
+# `c_enum_4` ENUM('enum3_v1_}','enum3_v2_{','enum3_v3_|') CHARSET swe7 COLLATE swe7_bin)
+DROP TABLE t1;
+RESET MASTER;
+#
+# Verify that explicit NOT NULL can be printed correctly
+#
+CREATE TABLE t1(c_not_null1 INT NOT NULL, c_null1 INT, c_not_null2 INT NOT NULL,
+c_null2 INT);
+INSERT INTO t1 VALUES(1, 2, 3, 4);
+# Columns(`c_not_null1` INT NOT NULL,
+# `c_null1` INT,
+# `c_not_null2` INT NOT NULL,
+# `c_null2` INT)
+DROP TABLE t1;
+RESET MASTER;
+#
+# Verify that primary key can be printed correctly
+#
+CREATE TABLE t1(c_key1 INT, c_key3 INT, c_not_key INT, c_key2 INT,
+PRIMARY KEY(c_key1, c_key2, c_key3));
+INSERT INTO t1 VALUES(1, 2, 3, 4);
+# Columns(`c_key1` INT NOT NULL,
+# `c_key3` INT NOT NULL,
+# `c_not_key` INT,
+# `c_key2` INT NOT NULL)
+# Primary Key
+DROP TABLE t1;
+RESET MASTER;
+CREATE TABLE t1(c_key1 CHAR(100), c_key3 CHAR(100), c_not_key INT, c_key2 CHAR(10),
+PRIMARY KEY(c_key1(5), c_key2, c_key3(10)));
+INSERT INTO t1 VALUES("1", "2", 3, "4");
+# Columns(`c_key1` CHAR(100) NOT NULL CHARSET latin1 COLLATE latin1_swedish_ci,
+# `c_key3` CHAR(100) NOT NULL CHARSET latin1 COLLATE latin1_swedish_ci,
+# `c_not_key` INT,
+# `c_key2` CHAR(10) NOT NULL CHARSET latin1 COLLATE latin1_swedish_ci)
+# Primary Key
+RESET MASTER;
+SET GLOBAL binlog_row_metadata = MINIMAL;
+INSERT INTO t1 VALUES("2", "2", 3, "4");
+# Columns(CHAR(100) NOT NULL CHARSET latin1 COLLATE latin1_swedish_ci,
+# CHAR(100) NOT NULL CHARSET latin1 COLLATE latin1_swedish_ci,
+# INT,
+# CHAR(10) NOT NULL CHARSET latin1 COLLATE latin1_swedish_ci)
+RESET MASTER;
+#
+# Coverage test: Print column index instead of column name if column name
+# is not binlogged.
+#
+SET GLOBAL binlog_row_metadata = FULL;
+SET SESSION debug_dbug = 'd, dont_log_column_name';
+INSERT INTO t1 VALUES("3", "2", 3, "4");
+# Columns(`c_key1` CHAR(100) NOT NULL CHARSET latin1 COLLATE latin1_swedish_ci,
+# `c_key3` CHAR(100) NOT NULL CHARSET latin1 COLLATE latin1_swedish_ci,
+# `c_not_key` INT,
+# `c_key2` CHAR(10) NOT NULL CHARSET latin1 COLLATE latin1_swedish_ci)
+# Primary Key
+DROP TABLE t1;
+RESET MASTER;
+#
+# Coverage test: Inject an invalid column type
+#
+CREATE TABLE t1(c1 int, c2 BLOB);
+SET SESSION debug_dbug = 'd,inject_invalid_column_type';
+INSERT INTO t1 VALUES(1, "a");
+# Columns(`c1` INT,
+# `c2` INVALID_TYPE(230))
+RESET MASTER;
+#
+# Coverage test: Inject an invalid BLOB metadata
+#
+SET SESSION debug_dbug = 'd,inject_invalid_blob_size';
+INSERT INTO t1 VALUES(2, "b");
+# Columns(`c1` INT,
+# `c2` INVALID_BLOB(5))
+#
+# Coverage test: Inject an invalid Geometry type
+#
+DROP TABLE t1;
+CREATE TABLE t1(c_geometry GEOMETRY, c_point POINT, c_multilinestring MULTILINESTRING);
+RESET MASTER;
+SET SESSION debug_dbug = 'd,inject_invalid_geometry_type';
+INSERT INTO t1(c_point) VALUES(ST_PointFromText('POINT(10 10)'));
+# Columns(`c_geometry` INVALID_GEOMETRY_TYPE(100),
+# `c_point` INVALID_GEOMETRY_TYPE(100),
+# `c_multilinestring` INVALID_GEOMETRY_TYPE(100))
+DROP TABLE t1;
+RESET MASTER;
+#
+# Comptibility Test: Verify mysqlbinlog can print OLD table_map_log_event
+# without any optional metadata
+#
+CREATE TABLE t1(c_int INT, c_tiny_int_unsigned TINYINT UNSIGNED,
+c_binary BINARY(10), c_text TEXT, c_point POINT);
+SET session debug_dbug='d,simulate_no_optional_metadata';
+INSERT INTO t1(c_int) VALUES(1);
+# Columns(INT,
+# TINYINT,
+# BINARY(10),
+# BLOB,
+# GEOMETRY)
+DROP TABLE t1;
+RESET MASTER;
+#
+# Simulate error on initializing charset and primary key metadata
+#
+CREATE TABLE t1(c1 char(10) PRIMARY KEY);
+SET session debug_dbug='d,simulate_init_charset_field_error';
+INSERT INTO t1 VALUES("a");
+SET GLOBAL binlog_row_metadata = FULL;
+SET session debug_dbug='d,simulate_init_primary_key_field_error';
+INSERT INTO t1 VALUES("b");
+# Columns(BINARY(10) NOT NULL)
+# Columns(BINARY(10) NOT NULL)
+SET SESSION debug_dbug = '';
+SET GLOBAL binlog_row_metadata = NO_LOG;
+DROP TABLE t1;
+RESET MASTER;
diff --git a/mysql-test/suite/binlog/r/binlog_table_map_optional_metadata_binary.result b/mysql-test/suite/binlog/r/binlog_table_map_optional_metadata_binary.result
new file mode 100644
index 00000000000..789bc6cd178
--- /dev/null
+++ b/mysql-test/suite/binlog/r/binlog_table_map_optional_metadata_binary.result
@@ -0,0 +1,64 @@
+#
+# Verify that SET string values and character sets can be printed correctly
+#
+SET NAMES utf8;
+CREATE TABLE t1(
+c_set_1 SET("set1_v1_å", "set1_v2_ä", "set1_v3_ö"),
+c_set_2 SET("set2_v1_å", "set2_v2_ä", "set2_v3_ö") CHARACTER SET binary);
+SET GLOBAL binlog_row_metadata = MINIMAL;
+INSERT INTO t1 VALUES("set1_v1_å", "set2_v2_ä");
+# Columns(SET,
+# SET)
+RESET MASTER;
+SET GLOBAL binlog_row_metadata = FULL;
+INSERT INTO t1 VALUES("set1_v1_å", "set2_v2_ä");
+# Columns(`c_set_1` SET('set1_v1_å','set1_v2_ä','set1_v3_ö') CHARSET latin1 COLLATE latin1_swedish_ci,
+# `c_set_2` SET('set2_v1_å','set2_v2_ä','set2_v3_ö') CHARSET binary COLLATE binary)
+INSERT INTO t1 VALUES("set1_v3_ö", "set2_v3_ö");
+INSERT INTO t1 VALUES("set1_v1_Ã¥", "set2_v1_Ã¥");
+SELECT c_set_1, HEX(c_set_1) FROM t1;
+c_set_1 HEX(c_set_1)
+set1_v1_Ã¥ 736574315F76315FE5
+set1_v1_Ã¥ 736574315F76315FE5
+set1_v3_ö 736574315F76335FF6
+set1_v1_Ã¥ 736574315F76315FE5
+SELECT c_set_2, HEX(c_set_2) FROM t1;
+c_set_2 HEX(c_set_2)
+set2_v2_ä 736574325F76325FC3A4
+set2_v2_ä 736574325F76325FC3A4
+set2_v3_ö 736574325F76335FC3B6
+set2_v1_Ã¥ 736574325F76315FC3A5
+DROP TABLE t1;
+RESET MASTER;
+#
+# Verify that ENUM string values and character sets can be printed correctly
+#
+CREATE TABLE t1(
+c_enum_1 ENUM("enum1_v1_å", "enum1_v2_ä", "enum1_v3_ö"),
+c_enum_2 ENUM("enum2_v1_å", "enum2_v2_ä", "enum2_v3_ö") CHARACTER SET binary);
+SET GLOBAL binlog_row_metadata = MINIMAL;
+INSERT INTO t1 VALUES("enum1_v1_å", "enum2_v2_ä");
+# Columns(ENUM,
+# ENUM)
+RESET MASTER;
+SET GLOBAL binlog_row_metadata = FULL;
+INSERT INTO t1 VALUES("enum1_v1_å", "enum2_v2_ä");
+# Columns(`c_enum_1` ENUM('enum1_v1_å','enum1_v2_ä','enum1_v3_ö') CHARSET latin1 COLLATE latin1_swedish_ci,
+# `c_enum_2` ENUM('enum2_v1_å','enum2_v2_ä','enum2_v3_ö') CHARSET binary COLLATE binary)
+INSERT INTO t1 VALUES("enum1_v3_ö", "enum2_v3_ö");
+INSERT INTO t1 VALUES("enum1_v1_Ã¥", "enum2_v1_Ã¥");
+SELECT c_enum_1, HEX(c_enum_1) FROM t1;
+c_enum_1 HEX(c_enum_1)
+enum1_v1_Ã¥ 656E756D315F76315FE5
+enum1_v1_Ã¥ 656E756D315F76315FE5
+enum1_v3_ö 656E756D315F76335FF6
+enum1_v1_Ã¥ 656E756D315F76315FE5
+SELECT c_enum_2, HEX(c_enum_2) FROM t1;
+c_enum_2 HEX(c_enum_2)
+enum2_v2_ä 656E756D325F76325FC3A4
+enum2_v2_ä 656E756D325F76325FC3A4
+enum2_v3_ö 656E756D325F76335FC3B6
+enum2_v1_Ã¥ 656E756D325F76315FC3A5
+DROP TABLE t1;
+RESET MASTER;
+SET GLOBAL binlog_row_metadata = NO_LOG;
diff --git a/mysql-test/suite/binlog/r/binlog_table_map_optional_metadata_ucs2.result b/mysql-test/suite/binlog/r/binlog_table_map_optional_metadata_ucs2.result
new file mode 100644
index 00000000000..1b1d2a79725
--- /dev/null
+++ b/mysql-test/suite/binlog/r/binlog_table_map_optional_metadata_ucs2.result
@@ -0,0 +1,64 @@
+#
+# Verify that SET string values and character sets can be printed correctly
+#
+SET NAMES utf8;
+CREATE TABLE t1(
+c_set_1 SET("set1_v1_å", "set1_v2_ä", "set1_v3_ö"),
+c_set_2 SET("set2_v1_å", "set2_v2_ä", "set2_v3_ö") CHARACTER SET ucs2);
+SET GLOBAL binlog_row_metadata = MINIMAL;
+INSERT INTO t1 VALUES("set1_v1_å", "set2_v2_ä");
+# Columns(SET,
+# SET)
+RESET MASTER;
+SET GLOBAL binlog_row_metadata = FULL;
+INSERT INTO t1 VALUES("set1_v1_å", "set2_v2_ä");
+# Columns(`c_set_1` SET('set1_v1_å','set1_v2_ä','set1_v3_ö') CHARSET latin1 COLLATE latin1_swedish_ci,
+# `c_set_2` SET('\0s\0e\0t\02\0_\0v\01\0_\0å','\0s\0e\0t\02\0_\0v\02\0_\0ä','\0s\0e\0t\02\0_\0v\03\0_\0ö') CHARSET ucs2 COLLATE ucs2_general_ci)
+INSERT INTO t1 VALUES("set1_v3_ö", "set2_v3_ö");
+INSERT INTO t1 VALUES("set1_v1_Ã¥", "set2_v1_Ã¥");
+SELECT c_set_1, HEX(c_set_1) FROM t1;
+c_set_1 HEX(c_set_1)
+set1_v1_Ã¥ 736574315F76315FE5
+set1_v1_Ã¥ 736574315F76315FE5
+set1_v3_ö 736574315F76335FF6
+set1_v1_Ã¥ 736574315F76315FE5
+SELECT c_set_2, HEX(c_set_2) FROM t1;
+c_set_2 HEX(c_set_2)
+set2_v2_ä 0073006500740032005F00760032005F00E4
+set2_v2_ä 0073006500740032005F00760032005F00E4
+set2_v3_ö 0073006500740032005F00760033005F00F6
+set2_v1_Ã¥ 0073006500740032005F00760031005F00E5
+DROP TABLE t1;
+RESET MASTER;
+#
+# Verify that ENUM string values and character sets can be printed correctly
+#
+CREATE TABLE t1(
+c_enum_1 ENUM("enum1_v1_å", "enum1_v2_ä", "enum1_v3_ö"),
+c_enum_2 ENUM("enum2_v1_å", "enum2_v2_ä", "enum2_v3_ö") CHARACTER SET ucs2);
+SET GLOBAL binlog_row_metadata = MINIMAL;
+INSERT INTO t1 VALUES("enum1_v1_å", "enum2_v2_ä");
+# Columns(ENUM,
+# ENUM)
+RESET MASTER;
+SET GLOBAL binlog_row_metadata = FULL;
+INSERT INTO t1 VALUES("enum1_v1_å", "enum2_v2_ä");
+# Columns(`c_enum_1` ENUM('enum1_v1_å','enum1_v2_ä','enum1_v3_ö') CHARSET latin1 COLLATE latin1_swedish_ci,
+# `c_enum_2` ENUM('\0e\0n\0u\0m\02\0_\0v\01\0_\0å','\0e\0n\0u\0m\02\0_\0v\02\0_\0ä','\0e\0n\0u\0m\02\0_\0v\03\0_\0ö') CHARSET ucs2 COLLATE ucs2_general_ci)
+INSERT INTO t1 VALUES("enum1_v3_ö", "enum2_v3_ö");
+INSERT INTO t1 VALUES("enum1_v1_Ã¥", "enum2_v1_Ã¥");
+SELECT c_enum_1, HEX(c_enum_1) FROM t1;
+c_enum_1 HEX(c_enum_1)
+enum1_v1_Ã¥ 656E756D315F76315FE5
+enum1_v1_Ã¥ 656E756D315F76315FE5
+enum1_v3_ö 656E756D315F76335FF6
+enum1_v1_Ã¥ 656E756D315F76315FE5
+SELECT c_enum_2, HEX(c_enum_2) FROM t1;
+c_enum_2 HEX(c_enum_2)
+enum2_v2_ä 0065006E0075006D0032005F00760032005F00E4
+enum2_v2_ä 0065006E0075006D0032005F00760032005F00E4
+enum2_v3_ö 0065006E0075006D0032005F00760033005F00F6
+enum2_v1_Ã¥ 0065006E0075006D0032005F00760031005F00E5
+DROP TABLE t1;
+RESET MASTER;
+SET GLOBAL binlog_row_metadata = NO_LOG;
diff --git a/mysql-test/suite/binlog/r/binlog_table_map_optional_metadata_utf32.result b/mysql-test/suite/binlog/r/binlog_table_map_optional_metadata_utf32.result
new file mode 100644
index 00000000000..6fdda842bac
--- /dev/null
+++ b/mysql-test/suite/binlog/r/binlog_table_map_optional_metadata_utf32.result
@@ -0,0 +1,64 @@
+#
+# Verify that SET string values and character sets can be printed correctly
+#
+SET NAMES utf8;
+CREATE TABLE t1(
+c_set_1 SET("set1_v1_å", "set1_v2_ä", "set1_v3_ö"),
+c_set_2 SET("set2_v1_å", "set2_v2_ä", "set2_v3_ö") CHARACTER SET utf32);
+SET GLOBAL binlog_row_metadata = MINIMAL;
+INSERT INTO t1 VALUES("set1_v1_å", "set2_v2_ä");
+# Columns(SET,
+# SET)
+RESET MASTER;
+SET GLOBAL binlog_row_metadata = FULL;
+INSERT INTO t1 VALUES("set1_v1_å", "set2_v2_ä");
+# Columns(`c_set_1` SET('set1_v1_å','set1_v2_ä','set1_v3_ö') CHARSET latin1 COLLATE latin1_swedish_ci,
+# `c_set_2` SET('\0\0\0s\0\0\0e\0\0\0t\0\0\02\0\0\0_\0\0\0v\0\0\01\0\0\0_\0\0\0å','\0\0\0s\0\0\0e\0\0\0t\0\0\02\0\0\0_\0\0\0v\0\0\02\0\0\0_\0\0\0ä','\0\0\0s\0\0\0e\0\0\0t\0\0\02\0\0\0_\0\0\0v\0\0\03\0\0\0_\0\0\0ö') CHARSET utf32 COLLATE utf32_general_ci)
+INSERT INTO t1 VALUES("set1_v3_ö", "set2_v3_ö");
+INSERT INTO t1 VALUES("set1_v1_Ã¥", "set2_v1_Ã¥");
+SELECT c_set_1, HEX(c_set_1) FROM t1;
+c_set_1 HEX(c_set_1)
+set1_v1_Ã¥ 736574315F76315FE5
+set1_v1_Ã¥ 736574315F76315FE5
+set1_v3_ö 736574315F76335FF6
+set1_v1_Ã¥ 736574315F76315FE5
+SELECT c_set_2, HEX(c_set_2) FROM t1;
+c_set_2 HEX(c_set_2)
+set2_v2_ä 000000730000006500000074000000320000005F00000076000000320000005F000000E4
+set2_v2_ä 000000730000006500000074000000320000005F00000076000000320000005F000000E4
+set2_v3_ö 000000730000006500000074000000320000005F00000076000000330000005F000000F6
+set2_v1_Ã¥ 000000730000006500000074000000320000005F00000076000000310000005F000000E5
+DROP TABLE t1;
+RESET MASTER;
+#
+# Verify that ENUM string values and character sets can be printed correctly
+#
+CREATE TABLE t1(
+c_enum_1 ENUM("enum1_v1_å", "enum1_v2_ä", "enum1_v3_ö"),
+c_enum_2 ENUM("enum2_v1_å", "enum2_v2_ä", "enum2_v3_ö") CHARACTER SET utf32);
+SET GLOBAL binlog_row_metadata = MINIMAL;
+INSERT INTO t1 VALUES("enum1_v1_å", "enum2_v2_ä");
+# Columns(ENUM,
+# ENUM)
+RESET MASTER;
+SET GLOBAL binlog_row_metadata = FULL;
+INSERT INTO t1 VALUES("enum1_v1_å", "enum2_v2_ä");
+# Columns(`c_enum_1` ENUM('enum1_v1_å','enum1_v2_ä','enum1_v3_ö') CHARSET latin1 COLLATE latin1_swedish_ci,
+# `c_enum_2` ENUM('\0\0\0e\0\0\0n\0\0\0u\0\0\0m\0\0\02\0\0\0_\0\0\0v\0\0\01\0\0\0_\0\0\0å','\0\0\0e\0\0\0n\0\0\0u\0\0\0m\0\0\02\0\0\0_\0\0\0v\0\0\02\0\0\0_\0\0\0ä','\0\0\0e\0\0\0n\0\0\0u\0\0\0m\0\0\02\0\0\0_\0\0\0v\0\0\03\0\0\0_\0\0\0ö') CHARSET utf32 COLLATE utf32_general_ci)
+INSERT INTO t1 VALUES("enum1_v3_ö", "enum2_v3_ö");
+INSERT INTO t1 VALUES("enum1_v1_Ã¥", "enum2_v1_Ã¥");
+SELECT c_enum_1, HEX(c_enum_1) FROM t1;
+c_enum_1 HEX(c_enum_1)
+enum1_v1_Ã¥ 656E756D315F76315FE5
+enum1_v1_Ã¥ 656E756D315F76315FE5
+enum1_v3_ö 656E756D315F76335FF6
+enum1_v1_Ã¥ 656E756D315F76315FE5
+SELECT c_enum_2, HEX(c_enum_2) FROM t1;
+c_enum_2 HEX(c_enum_2)
+enum2_v2_ä 000000650000006E000000750000006D000000320000005F00000076000000320000005F000000E4
+enum2_v2_ä 000000650000006E000000750000006D000000320000005F00000076000000320000005F000000E4
+enum2_v3_ö 000000650000006E000000750000006D000000320000005F00000076000000330000005F000000F6
+enum2_v1_Ã¥ 000000650000006E000000750000006D000000320000005F00000076000000310000005F000000E5
+DROP TABLE t1;
+RESET MASTER;
+SET GLOBAL binlog_row_metadata = NO_LOG;
diff --git a/mysql-test/suite/binlog/t/binlog_table_map_optional_metadata.test b/mysql-test/suite/binlog/t/binlog_table_map_optional_metadata.test
new file mode 100644
index 00000000000..9fd201e0cb9
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_table_map_optional_metadata.test
@@ -0,0 +1,333 @@
+################################################################################
+# WL#4618 RBR: extended table metadata in the binary log
+#
+# Below metadata is logged into Table_map_log_event
+# - signedness of numeric columns
+# - charsets of character columns
+# - column names
+# - set/enum character sets and string values
+# - primary key
+#
+# The first two are always logged. The others are controlled by system
+# variable --binlog-row-metadata
+#
+# The test will verify if the metadata can be logged and printed by mysqlbinlog
+# correctly.
+# mysqlbinlog --print-table-metadata will print the extra metadata
+################################################################################
+--source include/have_debug.inc
+--source include/have_binlog_format_row.inc
+
+RESET MASTER;
+SET GLOBAL binlog_row_metadata = MINIMAL;
+
+--let $MYSQLD_DATADIR= `select @@datadir`
+--let $binlog_file= $MYSQLD_DATADIR/master-bin.000001
+
+--echo #
+--echo # Temporal types can be printed correctly
+--echo #
+CREATE TABLE t1(c_year YEAR, c_date DATE, c_time TIME, c_time_f TIME(3),
+ c_datetime DATETIME, c_datetime_f DATETIME(3),
+ c_timestamp TIMESTAMP, c_timestamp_f TIMESTAMP(3) DEFAULT "2017-1-1 10:10:10");
+
+INSERT INTO t1(c_year) VALUES(2017);
+--source include/print_optional_metadata.inc
+
+DROP TABLE t1;
+RESET MASTER;
+
+--echo #
+--echo # Geometry types can be printed correctly
+--echo #
+CREATE TABLE t1 (c_geo GEOMETRY, c_point POINT, c_linestring LINESTRING,
+ c_polygon POLYGON, c_multi_point MULTIPOINT,
+ c_multi_linestring MULTILINESTRING, c_multi_polygon MULTIPOLYGON,
+ c_geometrycollection GEOMETRYCOLLECTION, c_char CHAR(100));
+
+INSERT INTO t1(c_point) VALUES(ST_PointFromText('POINT(10 10)'));
+--source include/print_optional_metadata.inc
+
+RESET MASTER;
+SET GLOBAL binlog_row_metadata = FULL;
+
+# geometry type is binlogged, the real geometry types are printed
+INSERT INTO t1(c_point) VALUES(ST_PointFromText('POINT(10 10)'));
+--source include/print_optional_metadata.inc
+
+DROP TABLE t1;
+RESET MASTER;
+
+--echo #
+--echo # Numeric types can be printed correctly
+--echo #
+CREATE TABLE t1(c_bit BIT(10), c_bool BOOL, c_smallint SMALLINT,
+ c_mediumint MEDIUMINT, c_int INT UNSIGNED, c_bigint BIGINT,
+ c_float FLOAT UNSIGNED, c_double DOUBLE, c_decimal DECIMAL(10, 2));
+
+SET GLOBAL binlog_row_metadata = MINIMAL;
+INSERT INTO t1(c_bool) VALUES(1);
+
+--echo # UNSIGNED flag should be printed
+--source include/print_optional_metadata.inc
+
+RESET MASTER;
+SET GLOBAL binlog_row_metadata = FULL;
+INSERT INTO t1(c_bool) VALUES(1);
+
+--source include/print_optional_metadata.inc
+
+DROP TABLE t1;
+RESET MASTER;
+
+--echo #
+--echo # Character types can be printed correctly
+--echo #
+CREATE TABLE t1(c_char CHAR(10), c_varchar VARCHAR(500),
+ c_tinytext TINYTEXT, c_text TEXT,
+ c_mediumtext MEDIUMTEXT, c_longtext LONGTEXT CHARSET utf8);
+
+SET GLOBAL binlog_row_metadata = MINIMAL;
+INSERT INTO t1(c_char) VALUES("1");
+
+# Charset set is printed with default charset
+--source include/print_optional_metadata.inc
+
+RESET MASTER;
+SET GLOBAL binlog_row_metadata = FULL;
+INSERT INTO t1(c_char) VALUES("1");
+
+--source include/print_optional_metadata.inc
+
+DROP TABLE t1;
+RESET MASTER;
+
+--echo #
+--echo # Column names with non-ascii characters and escape characters can be printed correctly
+--echo #
+set names utf8;
+CREATE TABLE t1(`åäö表\a'``"` INT);
+
+SHOW CREATE TABLE t1;
+
+INSERT INTO t1 VALUES(1);
+--source include/print_optional_metadata.inc
+DROP TABLE t1;
+RESET MASTER;
+--echo #
+--echo # Charsets can be printed correctly
+--echo #
+CREATE TABLE t1(c_char_utf8 CHAR(10) CHARSET utf8,
+ c_varchar_utf8 VARCHAR(10) CHARSET utf8,
+ c_text_utf8 TEXT CHARSET utf8);
+
+INSERT INTO t1 VALUES("1", "2", "3");
+
+# Charset set is printed with Default charset
+--source include/print_optional_metadata.inc
+
+DROP TABLE t1;
+RESET MASTER;
+
+# Test collation number less than 250 and collation number greater than 250
+CREATE TABLE t1(c_utf8mb4_520 CHAR(10) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci,
+ c_utf8mb4_0900 VARCHAR(10) CHARSET utf8mb4 COLLATE utf8mb4_polish_ci,
+ c_utf8mb4_def TEXT CHARSET utf8mb4);
+
+INSERT INTO t1 VALUES("1", "2", "3");
+
+# Charset set is printed without default charset
+--source include/print_optional_metadata.inc
+
+DROP TABLE t1;
+RESET MASTER;
+
+--echo #
+--echo # Blob and binary columns can be printed correctly
+--echo #
+CREATE TABLE t1(c_binary BINARY(10), c_varbinary VARBINARY(10),
+ c_tinyblob TINYBLOB, c_blob BLOB,
+ c_mediumblob MEDIUMBLOB, c_longblob LONGBLOB);
+
+INSERT INTO t1 VALUES("1", "2", "3", "4", "5", "6");
+--source include/print_optional_metadata.inc
+
+DROP TABLE t1;
+RESET MASTER;
+
+--echo #
+--echo # Verify that SET string values and character sets can be printed correctly
+--echo #
+
+set names utf8;
+CREATE TABLE t1(
+ c_set_1 SET("set1_v1_å", "set1_v2_ä", "set1_v3_ö"),
+ c_set_2 SET("set2_v1_å", "set2_v2_ä", "set2_v3_ö") CHARACTER SET latin1,
+ c_set_4 SET("set3_v1_å", "set3_v2_ä", "set3_v3_ö") CHARACTER SET swe7 COLLATE swe7_bin);
+
+SET GLOBAL binlog_row_metadata = MINIMAL;
+INSERT INTO t1 VALUES("set1_v1_å", "set2_v3_ö", "set3_v1_å");
+--source include/print_optional_metadata.inc
+
+RESET MASTER;
+SET GLOBAL binlog_row_metadata = FULL;
+INSERT INTO t1 VALUES("set1_v1_å", "set2_v3_ö", "set3_v1_å");
+--source include/print_optional_metadata.inc
+
+DROP TABLE t1;
+RESET MASTER;
+
+--echo #
+--echo # Verify that ENUM string values and character sets can be printed correctly
+--echo #
+
+CREATE TABLE t1(
+ c_enum_1 ENUM("enum1_v1_å", "enum1_v2_ä", "enum1_v3_ö"),
+ c_enum_3 ENUM("enum2_v1_å", "enum2_v2_ä", "enum2_v3_ö") CHARACTER SET latin1,
+ c_enum_4 ENUM("enum3_v1_å", "enum3_v2_ä", "enum3_v3_ö") CHARACTER SET swe7 COLLATE swe7_bin);
+
+SET GLOBAL binlog_row_metadata = MINIMAL;
+INSERT INTO t1 VALUES("enum1_v1_å", "enum2_v3_ö", "enum3_v1_å");
+--source include/print_optional_metadata.inc
+
+RESET MASTER;
+SET GLOBAL binlog_row_metadata = FULL;
+INSERT INTO t1 VALUES("enum1_v1_å", "enum2_v3_ö", "enum3_v1_å");
+--source include/print_optional_metadata.inc
+
+DROP TABLE t1;
+RESET MASTER;
+
+--echo #
+--echo # Verify that explicit NOT NULL can be printed correctly
+--echo #
+CREATE TABLE t1(c_not_null1 INT NOT NULL, c_null1 INT, c_not_null2 INT NOT NULL,
+ c_null2 INT);
+
+INSERT INTO t1 VALUES(1, 2, 3, 4);
+--source include/print_optional_metadata.inc
+
+DROP TABLE t1;
+RESET MASTER;
+
+--echo #
+--echo # Verify that primary key can be printed correctly
+--echo #
+CREATE TABLE t1(c_key1 INT, c_key3 INT, c_not_key INT, c_key2 INT,
+PRIMARY KEY(c_key1, c_key2, c_key3));
+
+INSERT INTO t1 VALUES(1, 2, 3, 4);
+--let $print_primary_key= 1
+--source include/print_optional_metadata.inc
+
+DROP TABLE t1;
+RESET MASTER;
+
+# Key has prefix
+CREATE TABLE t1(c_key1 CHAR(100), c_key3 CHAR(100), c_not_key INT, c_key2 CHAR(10),
+PRIMARY KEY(c_key1(5), c_key2, c_key3(10)));
+
+INSERT INTO t1 VALUES("1", "2", 3, "4");
+--source include/print_optional_metadata.inc
+
+RESET MASTER;
+# Primary key should not be printed
+SET GLOBAL binlog_row_metadata = MINIMAL;
+
+INSERT INTO t1 VALUES("2", "2", 3, "4");
+--source include/print_optional_metadata.inc
+
+RESET MASTER;
+--echo #
+--echo # Coverage test: Print column index instead of column name if column name
+--echo # is not binlogged.
+--echo #
+SET GLOBAL binlog_row_metadata = FULL;
+
+SET SESSION debug_dbug = 'd, dont_log_column_name';
+INSERT INTO t1 VALUES("3", "2", 3, "4");
+--source include/print_optional_metadata.inc
+
+--let $print_primary_key=
+DROP TABLE t1;
+RESET MASTER;
+
+--echo #
+--echo # Coverage test: Inject an invalid column type
+--echo #
+CREATE TABLE t1(c1 int, c2 BLOB);
+
+SET SESSION debug_dbug = 'd,inject_invalid_column_type';
+INSERT INTO t1 VALUES(1, "a");
+# It prints an error
+--source include/print_optional_metadata.inc
+
+RESET MASTER;
+
+--echo #
+--echo # Coverage test: Inject an invalid BLOB metadata
+--echo #
+--let $start_pos= query_get_value(SHOW MASTER STATUS, Position, 1)
+
+SET SESSION debug_dbug = 'd,inject_invalid_blob_size';
+INSERT INTO t1 VALUES(2, "b");
+
+# The invalid metadata will case assertion failure on Write_rows_log_event
+# So we need to stop mysqlbinlog before reading Write_rows_log_event.
+--let $stop_position= query_get_value(SHOW BINLOG EVENTS FROM $start_pos LIMIT 3, End_log_pos, 3)
+--source include/print_optional_metadata.inc
+
+--echo #
+--echo # Coverage test: Inject an invalid Geometry type
+--echo #
+DROP TABLE t1;
+CREATE TABLE t1(c_geometry GEOMETRY, c_point POINT, c_multilinestring MULTILINESTRING);
+RESET MASTER;
+--let $start_pos= query_get_value(SHOW MASTER STATUS, Position, 1)
+
+SET SESSION debug_dbug = 'd,inject_invalid_geometry_type';
+INSERT INTO t1(c_point) VALUES(ST_PointFromText('POINT(10 10)'));
+
+# The invalid metadata will case assertion failure on Write_rows_log_event
+# So we need to stop mysqlbinlog before reading Write_rows_log_event.
+--let $stop_position= query_get_value(SHOW BINLOG EVENTS FROM $start_pos LIMIT 3, End_log_pos, 3)
+--source include/print_optional_metadata.inc
+
+DROP TABLE t1;
+RESET MASTER;
+--echo #
+--echo # Comptibility Test: Verify mysqlbinlog can print OLD table_map_log_event
+--echo # without any optional metadata
+--echo #
+CREATE TABLE t1(c_int INT, c_tiny_int_unsigned TINYINT UNSIGNED,
+ c_binary BINARY(10), c_text TEXT, c_point POINT);
+
+SET session debug_dbug='d,simulate_no_optional_metadata';
+INSERT INTO t1(c_int) VALUES(1);
+# TINYINT will be printed without UNSIGNED flag,
+# CHAR will be printed as BINARY(10)
+# POINT will be printed as GEOMETRY
+--let $stop_position=
+--source include/print_optional_metadata.inc
+
+DROP TABLE t1;
+RESET MASTER;
+--echo #
+--echo # Simulate error on initializing charset and primary key metadata
+--echo #
+CREATE TABLE t1(c1 char(10) PRIMARY KEY);
+
+SET session debug_dbug='d,simulate_init_charset_field_error';
+INSERT INTO t1 VALUES("a");
+
+SET GLOBAL binlog_row_metadata = FULL;
+SET session debug_dbug='d,simulate_init_primary_key_field_error';
+INSERT INTO t1 VALUES("b");
+
+--let $print_primary_key= 1
+--source include/print_optional_metadata.inc
+
+SET SESSION debug_dbug = '';
+SET GLOBAL binlog_row_metadata = NO_LOG;
+DROP TABLE t1;
+RESET MASTER;
diff --git a/mysql-test/suite/binlog/t/binlog_table_map_optional_metadata_binary.test b/mysql-test/suite/binlog/t/binlog_table_map_optional_metadata_binary.test
new file mode 100644
index 00000000000..5997cfd5d27
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_table_map_optional_metadata_binary.test
@@ -0,0 +1,73 @@
+################################################################################
+# WL#4618 RBR: extended table metadata in the binary log
+#
+# Below metadata is logged into Table_map_log_event
+# - signedness of numeric columns
+# - charsets of character columns
+# - column names
+# - set/enum character sets and string values
+# - primary key
+#
+# The first two are always logged. The others are controlled by system
+# variable --binlog-row-metadata
+#
+# The test will verify if the metadata can be logged and printed by mysqlbinlog
+# correctly.
+# mysqlbinlog --print-table-metadata will print the extra metadata
+################################################################################
+--source include/have_debug.inc
+--source include/have_binlog_format_row.inc
+--let $MYSQLD_DATADIR= `select @@datadir`
+--let $binlog_file= $MYSQLD_DATADIR/master-bin.000001
+
+--echo #
+--echo # Verify that SET string values and character sets can be printed correctly
+--echo #
+
+SET NAMES utf8;
+CREATE TABLE t1(
+ c_set_1 SET("set1_v1_å", "set1_v2_ä", "set1_v3_ö"),
+ c_set_2 SET("set2_v1_å", "set2_v2_ä", "set2_v3_ö") CHARACTER SET binary);
+
+SET GLOBAL binlog_row_metadata = MINIMAL;
+INSERT INTO t1 VALUES("set1_v1_å", "set2_v2_ä");
+--source include/print_optional_metadata.inc
+
+RESET MASTER;
+SET GLOBAL binlog_row_metadata = FULL;
+INSERT INTO t1 VALUES("set1_v1_å", "set2_v2_ä");
+--source include/print_optional_metadata.inc
+INSERT INTO t1 VALUES("set1_v3_ö", "set2_v3_ö");
+INSERT INTO t1 VALUES("set1_v1_Ã¥", "set2_v1_Ã¥");
+SELECT c_set_1, HEX(c_set_1) FROM t1;
+SELECT c_set_2, HEX(c_set_2) FROM t1;
+
+DROP TABLE t1;
+RESET MASTER;
+
+--echo #
+--echo # Verify that ENUM string values and character sets can be printed correctly
+--echo #
+
+CREATE TABLE t1(
+ c_enum_1 ENUM("enum1_v1_å", "enum1_v2_ä", "enum1_v3_ö"),
+ c_enum_2 ENUM("enum2_v1_å", "enum2_v2_ä", "enum2_v3_ö") CHARACTER SET binary);
+
+SET GLOBAL binlog_row_metadata = MINIMAL;
+INSERT INTO t1 VALUES("enum1_v1_å", "enum2_v2_ä");
+--source include/print_optional_metadata.inc
+
+
+RESET MASTER;
+SET GLOBAL binlog_row_metadata = FULL;
+INSERT INTO t1 VALUES("enum1_v1_å", "enum2_v2_ä");
+--source include/print_optional_metadata.inc
+INSERT INTO t1 VALUES("enum1_v3_ö", "enum2_v3_ö");
+INSERT INTO t1 VALUES("enum1_v1_Ã¥", "enum2_v1_Ã¥");
+SELECT c_enum_1, HEX(c_enum_1) FROM t1;
+SELECT c_enum_2, HEX(c_enum_2) FROM t1;
+
+DROP TABLE t1;
+RESET MASTER;
+
+SET GLOBAL binlog_row_metadata = NO_LOG;
diff --git a/mysql-test/suite/binlog/t/binlog_table_map_optional_metadata_ucs2.test b/mysql-test/suite/binlog/t/binlog_table_map_optional_metadata_ucs2.test
new file mode 100644
index 00000000000..1e218acdfea
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_table_map_optional_metadata_ucs2.test
@@ -0,0 +1,74 @@
+################################################################################
+# WL#4618 RBR: extended table metadata in the binary log
+#
+# Below metadata is logged into Table_map_log_event
+# - signedness of numeric columns
+# - charsets of character columns
+# - column names
+# - set/enum character sets and string values
+# - primary key
+#
+# The first two are always logged. The others are controlled by system
+# variable --binlog-row-metadata
+#
+# The test will verify if the metadata can be logged and printed by mysqlbinlog
+# correctly.
+# mysqlbinlog --print-table-metadata will print the extra metadata
+################################################################################
+--source include/have_debug.inc
+--source include/have_binlog_format_row.inc
+--source include/have_ucs2.inc
+--let $MYSQLD_DATADIR= `select @@datadir`
+--let $binlog_file= $MYSQLD_DATADIR/master-bin.000001
+
+--echo #
+--echo # Verify that SET string values and character sets can be printed correctly
+--echo #
+
+SET NAMES utf8;
+CREATE TABLE t1(
+ c_set_1 SET("set1_v1_å", "set1_v2_ä", "set1_v3_ö"),
+ c_set_2 SET("set2_v1_å", "set2_v2_ä", "set2_v3_ö") CHARACTER SET ucs2);
+
+SET GLOBAL binlog_row_metadata = MINIMAL;
+INSERT INTO t1 VALUES("set1_v1_å", "set2_v2_ä");
+--source include/print_optional_metadata.inc
+
+RESET MASTER;
+SET GLOBAL binlog_row_metadata = FULL;
+INSERT INTO t1 VALUES("set1_v1_å", "set2_v2_ä");
+--source include/print_optional_metadata.inc
+INSERT INTO t1 VALUES("set1_v3_ö", "set2_v3_ö");
+INSERT INTO t1 VALUES("set1_v1_Ã¥", "set2_v1_Ã¥");
+SELECT c_set_1, HEX(c_set_1) FROM t1;
+SELECT c_set_2, HEX(c_set_2) FROM t1;
+
+DROP TABLE t1;
+RESET MASTER;
+
+--echo #
+--echo # Verify that ENUM string values and character sets can be printed correctly
+--echo #
+
+CREATE TABLE t1(
+ c_enum_1 ENUM("enum1_v1_å", "enum1_v2_ä", "enum1_v3_ö"),
+ c_enum_2 ENUM("enum2_v1_å", "enum2_v2_ä", "enum2_v3_ö") CHARACTER SET ucs2);
+
+SET GLOBAL binlog_row_metadata = MINIMAL;
+INSERT INTO t1 VALUES("enum1_v1_å", "enum2_v2_ä");
+--source include/print_optional_metadata.inc
+
+
+RESET MASTER;
+SET GLOBAL binlog_row_metadata = FULL;
+INSERT INTO t1 VALUES("enum1_v1_å", "enum2_v2_ä");
+--source include/print_optional_metadata.inc
+INSERT INTO t1 VALUES("enum1_v3_ö", "enum2_v3_ö");
+INSERT INTO t1 VALUES("enum1_v1_Ã¥", "enum2_v1_Ã¥");
+SELECT c_enum_1, HEX(c_enum_1) FROM t1;
+SELECT c_enum_2, HEX(c_enum_2) FROM t1;
+
+DROP TABLE t1;
+RESET MASTER;
+
+SET GLOBAL binlog_row_metadata = NO_LOG;
diff --git a/mysql-test/suite/binlog/t/binlog_table_map_optional_metadata_utf32.test b/mysql-test/suite/binlog/t/binlog_table_map_optional_metadata_utf32.test
new file mode 100644
index 00000000000..c1d449abf2f
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_table_map_optional_metadata_utf32.test
@@ -0,0 +1,74 @@
+################################################################################
+# WL#4618 RBR: extended table metadata in the binary log
+#
+# Below metadata is logged into Table_map_log_event
+# - signedness of numeric columns
+# - charsets of character columns
+# - column names
+# - set/enum character sets and string values
+# - primary key
+#
+# The first two are always logged. The others are controlled by system
+# variable --binlog-row-metadata
+#
+# The test will verify if the metadata can be logged and printed by mysqlbinlog
+# correctly.
+# mysqlbinlog --print-table-metadata will print the extra metadata
+################################################################################
+--source include/have_debug.inc
+--source include/have_binlog_format_row.inc
+--source include/have_utf32.inc
+--let $MYSQLD_DATADIR= `select @@datadir`
+--let $binlog_file= $MYSQLD_DATADIR/master-bin.000001
+
+--echo #
+--echo # Verify that SET string values and character sets can be printed correctly
+--echo #
+
+SET NAMES utf8;
+CREATE TABLE t1(
+ c_set_1 SET("set1_v1_å", "set1_v2_ä", "set1_v3_ö"),
+ c_set_2 SET("set2_v1_å", "set2_v2_ä", "set2_v3_ö") CHARACTER SET utf32);
+
+SET GLOBAL binlog_row_metadata = MINIMAL;
+INSERT INTO t1 VALUES("set1_v1_å", "set2_v2_ä");
+--source include/print_optional_metadata.inc
+
+RESET MASTER;
+SET GLOBAL binlog_row_metadata = FULL;
+INSERT INTO t1 VALUES("set1_v1_å", "set2_v2_ä");
+--source include/print_optional_metadata.inc
+INSERT INTO t1 VALUES("set1_v3_ö", "set2_v3_ö");
+INSERT INTO t1 VALUES("set1_v1_Ã¥", "set2_v1_Ã¥");
+SELECT c_set_1, HEX(c_set_1) FROM t1;
+SELECT c_set_2, HEX(c_set_2) FROM t1;
+
+DROP TABLE t1;
+RESET MASTER;
+
+--echo #
+--echo # Verify that ENUM string values and character sets can be printed correctly
+--echo #
+
+CREATE TABLE t1(
+ c_enum_1 ENUM("enum1_v1_å", "enum1_v2_ä", "enum1_v3_ö"),
+ c_enum_2 ENUM("enum2_v1_å", "enum2_v2_ä", "enum2_v3_ö") CHARACTER SET utf32);
+
+SET GLOBAL binlog_row_metadata = MINIMAL;
+INSERT INTO t1 VALUES("enum1_v1_å", "enum2_v2_ä");
+--source include/print_optional_metadata.inc
+
+
+RESET MASTER;
+SET GLOBAL binlog_row_metadata = FULL;
+INSERT INTO t1 VALUES("enum1_v1_å", "enum2_v2_ä");
+--source include/print_optional_metadata.inc
+INSERT INTO t1 VALUES("enum1_v3_ö", "enum2_v3_ö");
+INSERT INTO t1 VALUES("enum1_v1_Ã¥", "enum2_v1_Ã¥");
+SELECT c_enum_1, HEX(c_enum_1) FROM t1;
+SELECT c_enum_2, HEX(c_enum_2) FROM t1;
+
+DROP TABLE t1;
+RESET MASTER;
+
+SET GLOBAL binlog_row_metadata = NO_LOG;
diff --git a/mysql-test/suite/compat/oracle/r/gis-debug.result b/mysql-test/suite/compat/oracle/r/gis-debug.result
new file mode 100644
index 00000000000..9ab74e6e579
--- /dev/null
+++ b/mysql-test/suite/compat/oracle/r/gis-debug.result
@@ -0,0 +1,24 @@
+SET sql_mode=ORACLE;
+#
+# Start of 10.5 tests
+#
+#
+# MDEV-19994 Add class Function_collection
+#
+SET SESSION debug_dbug="+d,make_item_func_call_native_simulate_not_found";
+SELECT CONTAINS(POINT(1,1),POINT(1,1));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(POINT(1,1),POINT(1,1))' at line 1
+SELECT WITHIN(POINT(1,1),POINT(1,1));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(POINT(1,1),POINT(1,1))' at line 1
+SET SESSION debug_dbug="-d,make_item_func_call_native_simulate_not_found";
+#
+# MDEV-20009 Add CAST(expr AS pluggable_type)
+#
+SET SESSION debug_dbug="+d,emulate_geometry_create_typecast_item";
+SELECT AsText(CAST('POINT(0 0)' AS GEOMETRY));
+AsText(CAST('POINT(0 0)' AS GEOMETRY))
+POINT(0 0)
+SET SESSION debug_dbug="-d,emulate_geometry_create_typecast_item";
+#
+# End of 10.5 tests
+#
diff --git a/mysql-test/suite/compat/oracle/r/gis.result b/mysql-test/suite/compat/oracle/r/gis.result
index ebd56a089ad..113cb0ea402 100644
--- a/mysql-test/suite/compat/oracle/r/gis.result
+++ b/mysql-test/suite/compat/oracle/r/gis.result
@@ -1,6 +1,69 @@
+SET sql_mode=ORACLE;
+SELECT CONTAINS(POINT(1,1), POINT(1,1));
+CONTAINS(POINT(1,1), POINT(1,1))
+1
+SELECT CONTAINS(POINT(1,1), POINT(0,0));
+CONTAINS(POINT(1,1), POINT(0,0))
+0
SELECT WITHIN(POINT(1,1), POINT(1,1));
WITHIN(POINT(1,1), POINT(1,1))
1
SELECT WITHIN(POINT(1,1), POINT(0,0));
WITHIN(POINT(1,1), POINT(0,0))
0
+#
+# Start of 10.5 tests
+#
+#
+# MDEV-19994 Add class Function_collection
+#
+SELECT CONTAINS();
+ERROR 42000: Incorrect parameter count in the call to native function 'CONTAINS()'
+SELECT CONTAINS(POINT(1,1));
+ERROR 42000: Incorrect parameter count in the call to native function 'CONTAINS(POINT(1,1))'
+SELECT CONTAINS(POINT(1,1), POINT(1,1), POINT(1,1));
+ERROR 42000: Incorrect parameter count in the call to native function 'CONTAINS(POINT(1,1), POINT(1,1), POINT(1,1))'
+SELECT WITHIN();
+ERROR 42000: Incorrect parameter count in the call to native function 'WITHIN()'
+SELECT WITHIN(POINT(1,1));
+ERROR 42000: Incorrect parameter count in the call to native function 'WITHIN(POINT(1,1))'
+SELECT WITHIN(POINT(1,1), POINT(1,1), POINT(1,1));
+ERROR 42000: Incorrect parameter count in the call to native function 'WITHIN(POINT(1,1), POINT(1,1), POINT(1,1))'
+#
+# MDEV-20009 Add CAST(expr AS pluggable_type)
+#
+SELECT CAST(1 AS GEOMETRY);
+ERROR HY000: Operator does not exists: 'CAST(expr AS geometry)'
+SELECT CAST(1 AS GEOMETRYCOLLECTION);
+ERROR HY000: Operator does not exists: 'CAST(expr AS geometrycollection)'
+SELECT CAST(1 AS POINT);
+ERROR HY000: Operator does not exists: 'CAST(expr AS point)'
+SELECT CAST(1 AS LINESTRING);
+ERROR HY000: Operator does not exists: 'CAST(expr AS linestring)'
+SELECT CAST(1 AS POLYGON);
+ERROR HY000: Operator does not exists: 'CAST(expr AS polygon)'
+SELECT CAST(1 AS MULTIPOINT);
+ERROR HY000: Operator does not exists: 'CAST(expr AS multipoint)'
+SELECT CAST(1 AS MULTILINESTRING);
+ERROR HY000: Operator does not exists: 'CAST(expr AS multilinestring)'
+SELECT CAST(1 AS MULTIPOLYGON);
+ERROR HY000: Operator does not exists: 'CAST(expr AS multipolygon)'
+SELECT CONVERT(1, GEOMETRY);
+ERROR HY000: Operator does not exists: 'CAST(expr AS geometry)'
+SELECT CONVERT(1, GEOMETRYCOLLECTION);
+ERROR HY000: Operator does not exists: 'CAST(expr AS geometrycollection)'
+SELECT CONVERT(1, POINT);
+ERROR HY000: Operator does not exists: 'CAST(expr AS point)'
+SELECT CONVERT(1, LINESTRING);
+ERROR HY000: Operator does not exists: 'CAST(expr AS linestring)'
+SELECT CONVERT(1, POLYGON);
+ERROR HY000: Operator does not exists: 'CAST(expr AS polygon)'
+SELECT CONVERT(1, MULTIPOINT);
+ERROR HY000: Operator does not exists: 'CAST(expr AS multipoint)'
+SELECT CONVERT(1, MULTILINESTRING);
+ERROR HY000: Operator does not exists: 'CAST(expr AS multilinestring)'
+SELECT CONVERT(1, MULTIPOLYGON);
+ERROR HY000: Operator does not exists: 'CAST(expr AS multipolygon)'
+#
+# End of 10.5 tests
+#
diff --git a/mysql-test/suite/compat/oracle/r/parser.result b/mysql-test/suite/compat/oracle/r/parser.result
index 1c60c1434a3..a1a92b13aa3 100644
--- a/mysql-test/suite/compat/oracle/r/parser.result
+++ b/mysql-test/suite/compat/oracle/r/parser.result
@@ -609,3 +609,51 @@ ERROR HY000: Unknown system variable 'role'
#
# End of 10.3 tests
#
+#
+# Start of 10.5 tests
+#
+#
+# MDEV-20734 Allow reserved keywords as user defined type names
+#
+CREATE TABLE t1 (a DUAL);
+ERROR HY000: Unknown data type: 'DUAL'
+SELECT CAST(1 AS DUAL);
+ERROR HY000: Unknown data type: 'DUAL'
+#
+# MDEV-20735 Allow non-reserved keywords as user defined type names
+#
+CREATE TABLE t1 (a ASCII);
+ERROR HY000: Unknown data type: 'ASCII'
+SELECT CAST(1 AS ASCII);
+ERROR HY000: Unknown data type: 'ASCII'
+CREATE TABLE t1 (a LANGUAGE);
+ERROR HY000: Unknown data type: 'LANGUAGE'
+SELECT CAST(1 AS LANGUAGE);
+ERROR HY000: Unknown data type: 'LANGUAGE'
+CREATE TABLE t1 (a CLOSE);
+ERROR HY000: Unknown data type: 'CLOSE'
+SELECT CAST(1 AS CLOSE);
+ERROR HY000: Unknown data type: 'CLOSE'
+CREATE TABLE t1 (a NAMES);
+ERROR HY000: Unknown data type: 'NAMES'
+SELECT CAST(1 AS NAMES);
+ERROR HY000: Unknown data type: 'NAMES'
+CREATE TABLE t1 (a END);
+ERROR HY000: Unknown data type: 'END'
+SELECT CAST(1 AS END);
+ERROR HY000: Unknown data type: 'END'
+CREATE TABLE t1 (a GLOBAL);
+ERROR HY000: Unknown data type: 'GLOBAL'
+SELECT CAST(1 AS GLOBAL);
+ERROR HY000: Unknown data type: 'GLOBAL'
+CREATE TABLE t1 (a ACTION);
+ERROR HY000: Unknown data type: 'ACTION'
+SELECT CAST(1 AS ACTION);
+ERROR HY000: Unknown data type: 'ACTION'
+CREATE TABLE t1 (a BEGIN);
+ERROR HY000: Unknown data type: 'BEGIN'
+SELECT CAST(1 AS BEGIN);
+ERROR HY000: Unknown data type: 'BEGIN'
+#
+# End of 10.5 tests
+#
diff --git a/mysql-test/suite/compat/oracle/r/sp-code.result b/mysql-test/suite/compat/oracle/r/sp-code.result
index 1c6aacc8743..0fc980a3b84 100644
--- a/mysql-test/suite/compat/oracle/r/sp-code.result
+++ b/mysql-test/suite/compat/oracle/r/sp-code.result
@@ -1487,3 +1487,30 @@ CALL p1();
x0 x1.a x1.b
100 101 102
DROP PROCEDURE p1;
+#
+# MDEV-19640 Wrong SHOW PROCEDURE output for SET GLOBAL sysvar1=expr, sysvar2=expr
+#
+CREATE OR REPLACE PROCEDURE p1() AS
+BEGIN
+SET GLOBAL max_allowed_packet=16000000, max_error_count=60;
+SELECT @@GLOBAL.max_allowed_packet, @@GLOBAL.max_error_count;
+END;
+$$
+SHOW PROCEDURE CODE p1;
+Pos Instruction
+0 stmt 31 "SET GLOBAL max_allowed_packet=16000000"
+1 stmt 31 "SET GLOBAL max_error_count=60"
+2 stmt 0 "SELECT @@GLOBAL.max_allowed_packet, @..."
+DROP PROCEDURE p1;
+#
+# MDEV-19639 sql_mode=ORACLE: Wrong SHOW PROCEDURE output for sysvar:=expr
+#
+CREATE OR REPLACE PROCEDURE p1() AS
+BEGIN
+max_error_count:=10;
+END;
+$$
+SHOW PROCEDURE CODE p1;
+Pos Instruction
+0 stmt 31 "max_error_count:=10"
+DROP PROCEDURE p1;
diff --git a/mysql-test/suite/compat/oracle/r/sp-row.result b/mysql-test/suite/compat/oracle/r/sp-row.result
index 218fb5d463a..323b0c684f3 100644
--- a/mysql-test/suite/compat/oracle/r/sp-row.result
+++ b/mysql-test/suite/compat/oracle/r/sp-row.result
@@ -209,7 +209,7 @@ SELECT a+1;
END;
$$
CALL p1();
-ERROR 21000: Operand should contain 1 column(s)
+ERROR HY000: Illegal parameter data types row and int for operation '+'
DROP PROCEDURE p1;
CREATE PROCEDURE p1()
AS
@@ -219,7 +219,7 @@ SELECT a+1;
END;
$$
CALL p1();
-ERROR 21000: Operand should contain 1 column(s)
+ERROR HY000: Illegal parameter data types row and int for operation '+'
DROP PROCEDURE p1;
#
# Comparing the entire ROW to a scalar value
diff --git a/mysql-test/suite/compat/oracle/r/table_value_constr.result b/mysql-test/suite/compat/oracle/r/table_value_constr.result
index 4383845cd87..3621006d7dc 100644
--- a/mysql-test/suite/compat/oracle/r/table_value_constr.result
+++ b/mysql-test/suite/compat/oracle/r/table_value_constr.result
@@ -2060,9 +2060,9 @@ values (1,2),(3,4,5);
ERROR HY000: The used table value constructor has a different number of values
# illegal parameter data types in TVC
values (1,point(1,1)),(1,1);
-ERROR HY000: Illegal parameter data types geometry and int for operation 'TABLE VALUE CONSTRUCTOR'
+ERROR HY000: Illegal parameter data types point and int for operation 'TABLE VALUE CONSTRUCTOR'
values (1,point(1,1)+1);
-ERROR HY000: Illegal parameter data types geometry and int for operation '+'
+ERROR HY000: Illegal parameter data types point and int for operation '+'
# field reference in TVC
select * from (values (1), (b), (2)) as new_tvc;
ERROR HY000: Field reference 'b' can't be used in table value constructor
diff --git a/mysql-test/suite/compat/oracle/t/gis-debug.test b/mysql-test/suite/compat/oracle/t/gis-debug.test
new file mode 100644
index 00000000000..6053e546211
--- /dev/null
+++ b/mysql-test/suite/compat/oracle/t/gis-debug.test
@@ -0,0 +1,31 @@
+--source include/have_geometry.inc
+--source include/have_debug.inc
+
+SET sql_mode=ORACLE;
+
+--echo #
+--echo # Start of 10.5 tests
+--echo #
+
+--echo #
+--echo # MDEV-19994 Add class Function_collection
+--echo #
+
+SET SESSION debug_dbug="+d,make_item_func_call_native_simulate_not_found";
+--error ER_PARSE_ERROR
+SELECT CONTAINS(POINT(1,1),POINT(1,1));
+--error ER_PARSE_ERROR
+SELECT WITHIN(POINT(1,1),POINT(1,1));
+SET SESSION debug_dbug="-d,make_item_func_call_native_simulate_not_found";
+
+--echo #
+--echo # MDEV-20009 Add CAST(expr AS pluggable_type)
+--echo #
+
+SET SESSION debug_dbug="+d,emulate_geometry_create_typecast_item";
+SELECT AsText(CAST('POINT(0 0)' AS GEOMETRY));
+SET SESSION debug_dbug="-d,emulate_geometry_create_typecast_item";
+
+--echo #
+--echo # End of 10.5 tests
+--echo #
diff --git a/mysql-test/suite/compat/oracle/t/gis.test b/mysql-test/suite/compat/oracle/t/gis.test
index a684563390b..cb1b869035a 100644
--- a/mysql-test/suite/compat/oracle/t/gis.test
+++ b/mysql-test/suite/compat/oracle/t/gis.test
@@ -1,4 +1,76 @@
-- source include/have_geometry.inc
+SET sql_mode=ORACLE;
+
+
+SELECT CONTAINS(POINT(1,1), POINT(1,1));
+SELECT CONTAINS(POINT(1,1), POINT(0,0));
+
SELECT WITHIN(POINT(1,1), POINT(1,1));
SELECT WITHIN(POINT(1,1), POINT(0,0));
+
+--echo #
+--echo # Start of 10.5 tests
+--echo #
+
+--echo #
+--echo # MDEV-19994 Add class Function_collection
+--echo #
+
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT CONTAINS();
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT CONTAINS(POINT(1,1));
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT CONTAINS(POINT(1,1), POINT(1,1), POINT(1,1));
+
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT WITHIN();
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT WITHIN(POINT(1,1));
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT WITHIN(POINT(1,1), POINT(1,1), POINT(1,1));
+
+--echo #
+--echo # MDEV-20009 Add CAST(expr AS pluggable_type)
+--echo #
+
+--error ER_UNKNOWN_OPERATOR
+SELECT CAST(1 AS GEOMETRY);
+--error ER_UNKNOWN_OPERATOR
+SELECT CAST(1 AS GEOMETRYCOLLECTION);
+--error ER_UNKNOWN_OPERATOR
+SELECT CAST(1 AS POINT);
+--error ER_UNKNOWN_OPERATOR
+SELECT CAST(1 AS LINESTRING);
+--error ER_UNKNOWN_OPERATOR
+SELECT CAST(1 AS POLYGON);
+--error ER_UNKNOWN_OPERATOR
+SELECT CAST(1 AS MULTIPOINT);
+--error ER_UNKNOWN_OPERATOR
+SELECT CAST(1 AS MULTILINESTRING);
+--error ER_UNKNOWN_OPERATOR
+SELECT CAST(1 AS MULTIPOLYGON);
+
+
+--error ER_UNKNOWN_OPERATOR
+SELECT CONVERT(1, GEOMETRY);
+--error ER_UNKNOWN_OPERATOR
+SELECT CONVERT(1, GEOMETRYCOLLECTION);
+--error ER_UNKNOWN_OPERATOR
+SELECT CONVERT(1, POINT);
+--error ER_UNKNOWN_OPERATOR
+SELECT CONVERT(1, LINESTRING);
+--error ER_UNKNOWN_OPERATOR
+SELECT CONVERT(1, POLYGON);
+--error ER_UNKNOWN_OPERATOR
+SELECT CONVERT(1, MULTIPOINT);
+--error ER_UNKNOWN_OPERATOR
+SELECT CONVERT(1, MULTILINESTRING);
+--error ER_UNKNOWN_OPERATOR
+SELECT CONVERT(1, MULTIPOLYGON);
+
+
+--echo #
+--echo # End of 10.5 tests
+--echo #
diff --git a/mysql-test/suite/compat/oracle/t/parser.test b/mysql-test/suite/compat/oracle/t/parser.test
index 067fd9beb48..091307d37bf 100644
--- a/mysql-test/suite/compat/oracle/t/parser.test
+++ b/mysql-test/suite/compat/oracle/t/parser.test
@@ -412,3 +412,66 @@ SELECT @@GLOBAL.role;
--echo #
--echo # End of 10.3 tests
--echo #
+
+
+--echo #
+--echo # Start of 10.5 tests
+--echo #
+
+--echo #
+--echo # MDEV-20734 Allow reserved keywords as user defined type names
+--echo #
+
+--error ER_UNKNOWN_DATA_TYPE
+CREATE TABLE t1 (a DUAL);
+--error ER_UNKNOWN_DATA_TYPE
+SELECT CAST(1 AS DUAL);
+
+
+--echo #
+--echo # MDEV-20735 Allow non-reserved keywords as user defined type names
+--echo #
+
+--error ER_UNKNOWN_DATA_TYPE
+CREATE TABLE t1 (a ASCII);
+--error ER_UNKNOWN_DATA_TYPE
+SELECT CAST(1 AS ASCII);
+
+--error ER_UNKNOWN_DATA_TYPE
+CREATE TABLE t1 (a LANGUAGE);
+--error ER_UNKNOWN_DATA_TYPE
+SELECT CAST(1 AS LANGUAGE);
+
+--error ER_UNKNOWN_DATA_TYPE
+CREATE TABLE t1 (a CLOSE);
+--error ER_UNKNOWN_DATA_TYPE
+SELECT CAST(1 AS CLOSE);
+
+--error ER_UNKNOWN_DATA_TYPE
+CREATE TABLE t1 (a NAMES);
+--error ER_UNKNOWN_DATA_TYPE
+SELECT CAST(1 AS NAMES);
+
+--error ER_UNKNOWN_DATA_TYPE
+CREATE TABLE t1 (a END);
+--error ER_UNKNOWN_DATA_TYPE
+SELECT CAST(1 AS END);
+
+--error ER_UNKNOWN_DATA_TYPE
+CREATE TABLE t1 (a GLOBAL);
+--error ER_UNKNOWN_DATA_TYPE
+SELECT CAST(1 AS GLOBAL);
+
+--error ER_UNKNOWN_DATA_TYPE
+CREATE TABLE t1 (a ACTION);
+--error ER_UNKNOWN_DATA_TYPE
+SELECT CAST(1 AS ACTION);
+
+--error ER_UNKNOWN_DATA_TYPE
+CREATE TABLE t1 (a BEGIN);
+--error ER_UNKNOWN_DATA_TYPE
+SELECT CAST(1 AS BEGIN);
+
+--echo #
+--echo # End of 10.5 tests
+--echo #
diff --git a/mysql-test/suite/compat/oracle/t/sp-code.test b/mysql-test/suite/compat/oracle/t/sp-code.test
index ea66ed80d2a..1ffd3b948e6 100644
--- a/mysql-test/suite/compat/oracle/t/sp-code.test
+++ b/mysql-test/suite/compat/oracle/t/sp-code.test
@@ -1055,3 +1055,34 @@ DELIMITER ;$$
SHOW PROCEDURE CODE p1;
CALL p1();
DROP PROCEDURE p1;
+
+--echo #
+--echo # MDEV-19640 Wrong SHOW PROCEDURE output for SET GLOBAL sysvar1=expr, sysvar2=expr
+--echo #
+
+DELIMITER $$;
+CREATE OR REPLACE PROCEDURE p1() AS
+BEGIN
+ SET GLOBAL max_allowed_packet=16000000, max_error_count=60;
+ SELECT @@GLOBAL.max_allowed_packet, @@GLOBAL.max_error_count;
+END;
+$$
+DELIMITER ;$$
+SHOW PROCEDURE CODE p1;
+DROP PROCEDURE p1;
+
+--echo #
+--echo # MDEV-19639 sql_mode=ORACLE: Wrong SHOW PROCEDURE output for sysvar:=expr
+--echo #
+
+DELIMITER $$;
+CREATE OR REPLACE PROCEDURE p1() AS
+BEGIN
+ max_error_count:=10;
+END;
+$$
+DELIMITER ;$$
+SHOW PROCEDURE CODE p1;
+DROP PROCEDURE p1;
+
+
diff --git a/mysql-test/suite/compat/oracle/t/sp-row.test b/mysql-test/suite/compat/oracle/t/sp-row.test
index 469494ad228..8abf317708a 100644
--- a/mysql-test/suite/compat/oracle/t/sp-row.test
+++ b/mysql-test/suite/compat/oracle/t/sp-row.test
@@ -263,7 +263,7 @@ BEGIN
END;
$$
DELIMITER ;$$
---error ER_OPERAND_COLUMNS
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
CALL p1();
DROP PROCEDURE p1;
@@ -277,7 +277,7 @@ BEGIN
END;
$$
DELIMITER ;$$
---error ER_OPERAND_COLUMNS
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
CALL p1();
DROP PROCEDURE p1;
diff --git a/mysql-test/suite/encryption/r/corrupted_during_recovery.result b/mysql-test/suite/encryption/r/corrupted_during_recovery.result
index 356dce64f8d..ea2f1ff3328 100644
--- a/mysql-test/suite/encryption/r/corrupted_during_recovery.result
+++ b/mysql-test/suite/encryption/r/corrupted_during_recovery.result
@@ -1,3 +1,5 @@
+# Work around MDEV-19541
+SET GLOBAL innodb_checksum_algorithm=crc32;
CREATE TABLE t1(a BIGINT PRIMARY KEY) ENGINE=InnoDB, ENCRYPTED=YES;
INSERT INTO t1 VALUES(1);
CREATE TABLE t2(a BIGINT PRIMARY KEY) ENGINE=InnoDB, ENCRYPTED=YES;
diff --git a/mysql-test/suite/encryption/r/innodb_encrypt_log.result b/mysql-test/suite/encryption/r/innodb_encrypt_log.result
index ff5b7c15b8b..86446e4eabd 100644
--- a/mysql-test/suite/encryption/r/innodb_encrypt_log.result
+++ b/mysql-test/suite/encryption/r/innodb_encrypt_log.result
@@ -7,7 +7,7 @@
#
SET GLOBAL innodb_log_checksums=0;
Warnings:
-Warning 138 innodb_encrypt_log implies innodb_log_checksums
+Warning 138 The parameter innodb_log_checksums is deprecated and has no effect.
SELECT @@global.innodb_log_checksums;
@@global.innodb_log_checksums
1
diff --git a/mysql-test/suite/encryption/t/corrupted_during_recovery.test b/mysql-test/suite/encryption/t/corrupted_during_recovery.test
index 42cdd13d206..7e13168e759 100644
--- a/mysql-test/suite/encryption/t/corrupted_during_recovery.test
+++ b/mysql-test/suite/encryption/t/corrupted_during_recovery.test
@@ -13,6 +13,8 @@ call mtr.add_suppression("InnoDB: Table in tablespace \\d+ encrypted. However ke
let INNODB_CHECKSUM_ALGORITHM = `SELECT @@innodb_checksum_algorithm`;
let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
+--echo # Work around MDEV-19541
+SET GLOBAL innodb_checksum_algorithm=crc32;
CREATE TABLE t1(a BIGINT PRIMARY KEY) ENGINE=InnoDB, ENCRYPTED=YES;
INSERT INTO t1 VALUES(1);
# Force a redo log checkpoint.
diff --git a/mysql-test/suite/engines/funcs/r/db_alter_character_set.result b/mysql-test/suite/engines/funcs/r/db_alter_character_set.result
index 48351449a72..ad0cf41bdf1 100644
--- a/mysql-test/suite/engines/funcs/r/db_alter_character_set.result
+++ b/mysql-test/suite/engines/funcs/r/db_alter_character_set.result
@@ -43,381 +43,381 @@ cp932 SJIS for Windows Japanese cp932_japanese_ci 2
eucjpms UJIS for Windows Japanese eucjpms_japanese_ci 3
CREATE DATABASE d8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d8 latin1 latin1_swedish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d8 latin1 latin1_swedish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d8 CHARACTER SET ascii;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d8 ascii ascii_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d8 ascii ascii_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d8;
CREATE DATABASE d8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d8 latin1 latin1_swedish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d8 latin1 latin1_swedish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d8 CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d8 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d8 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d8;
CREATE DATABASE d8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d8 latin1 latin1_swedish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d8 latin1 latin1_swedish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d8 CHARACTER SET binary;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d8 binary binary NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d8 binary binary NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d8;
CREATE DATABASE d8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d8 latin1 latin1_swedish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d8 latin1 latin1_swedish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d8 CHARACTER SET swe7;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d8 swe7 swe7_swedish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d8 swe7 swe7_swedish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d8;
CREATE DATABASE d8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d8 latin1 latin1_swedish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d8 latin1 latin1_swedish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d8 CHARACTER SET cp1251;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d8 cp1251 cp1251_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d8 cp1251 cp1251_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d8;
CREATE DATABASE d8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d8 latin1 latin1_swedish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d8 latin1 latin1_swedish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d8 DEFAULT CHARACTER SET ascii;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d8 ascii ascii_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d8 ascii ascii_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d8;
CREATE DATABASE d8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d8 latin1 latin1_swedish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d8 latin1 latin1_swedish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d8 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d8 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d8 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d8;
CREATE DATABASE d8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d8 latin1 latin1_swedish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d8 latin1 latin1_swedish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d8 DEFAULT CHARACTER SET binary;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d8 binary binary NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d8 binary binary NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d8;
CREATE DATABASE d8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d8 latin1 latin1_swedish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d8 latin1 latin1_swedish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d8 DEFAULT CHARACTER SET swe7;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d8 swe7 swe7_swedish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d8 swe7 swe7_swedish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d8;
CREATE DATABASE d8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d8 latin1 latin1_swedish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d8 latin1 latin1_swedish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d8 DEFAULT CHARACTER SET cp1251;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d8 cp1251 cp1251_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d8 cp1251 cp1251_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d8;
CREATE DATABASE d8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d8 latin1 latin1_swedish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d8 latin1 latin1_swedish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d8 CHARACTER SET ascii;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d8 ascii ascii_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d8 ascii ascii_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d8;
CREATE DATABASE d8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d8 latin1 latin1_swedish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d8 latin1 latin1_swedish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d8 CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d8 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d8 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d8;
CREATE DATABASE d8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d8 latin1 latin1_swedish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d8 latin1 latin1_swedish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d8 CHARACTER SET binary;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d8 binary binary NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d8 binary binary NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d8;
CREATE DATABASE d8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d8 latin1 latin1_swedish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d8 latin1 latin1_swedish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d8 CHARACTER SET swe7;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d8 swe7 swe7_swedish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d8 swe7 swe7_swedish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d8;
CREATE DATABASE d8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d8 latin1 latin1_swedish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d8 latin1 latin1_swedish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d8 CHARACTER SET cp1251;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d8 cp1251 cp1251_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d8 cp1251 cp1251_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d8;
CREATE DATABASE d8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d8 latin1 latin1_swedish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d8 latin1 latin1_swedish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d8 DEFAULT CHARACTER SET ascii;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d8 ascii ascii_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d8 ascii ascii_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d8;
CREATE DATABASE d8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d8 latin1 latin1_swedish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d8 latin1 latin1_swedish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d8 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d8 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d8 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d8;
CREATE DATABASE d8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d8 latin1 latin1_swedish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d8 latin1 latin1_swedish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d8 DEFAULT CHARACTER SET binary;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d8 binary binary NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d8 binary binary NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d8;
CREATE DATABASE d8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d8 latin1 latin1_swedish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d8 latin1 latin1_swedish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d8 DEFAULT CHARACTER SET swe7;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d8 swe7 swe7_swedish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d8 swe7 swe7_swedish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d8;
CREATE DATABASE d8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d8 latin1 latin1_swedish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d8 latin1 latin1_swedish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d8 DEFAULT CHARACTER SET cp1251;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d8 cp1251 cp1251_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d8 cp1251 cp1251_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d8;
diff --git a/mysql-test/suite/engines/funcs/r/db_alter_character_set_collate.result b/mysql-test/suite/engines/funcs/r/db_alter_character_set_collate.result
index b16ddd6e50f..d01b85d9039 100644
--- a/mysql-test/suite/engines/funcs/r/db_alter_character_set_collate.result
+++ b/mysql-test/suite/engines/funcs/r/db_alter_character_set_collate.result
@@ -1,115 +1,115 @@
DROP DATABASE IF EXISTS d11;
CREATE DATABASE d11 DEFAULT CHARACTER SET ascii DEFAULT COLLATE ascii_bin;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d11 ascii ascii_bin NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d11 ascii ascii_bin NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d11 CHARACTER SET utf8 COLLATE utf8_general_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d11 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d11 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d11;
CREATE DATABASE d11 DEFAULT CHARACTER SET ascii DEFAULT COLLATE ascii_bin;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d11 ascii ascii_bin NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d11 ascii ascii_bin NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d11 CHARACTER SET latin2 COLLATE latin2_general_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d11 latin2 latin2_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d11 latin2 latin2_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d11;
CREATE DATABASE d11 DEFAULT CHARACTER SET ascii DEFAULT COLLATE ascii_bin;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d11 ascii ascii_bin NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d11 ascii ascii_bin NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d11 CHARACTER SET cp1250 COLLATE cp1250_croatian_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d11 cp1250 cp1250_croatian_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d11 cp1250 cp1250_croatian_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d11;
CREATE DATABASE d11 DEFAULT CHARACTER SET ascii DEFAULT COLLATE ascii_bin;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d11 ascii ascii_bin NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d11 ascii ascii_bin NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d11 CHARACTER SET utf8 COLLATE utf8_general_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d11 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d11 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d11;
CREATE DATABASE d11 DEFAULT CHARACTER SET ascii DEFAULT COLLATE ascii_bin;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d11 ascii ascii_bin NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d11 ascii ascii_bin NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d11 CHARACTER SET latin2 COLLATE latin2_general_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d11 latin2 latin2_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d11 latin2 latin2_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d11;
CREATE DATABASE d11 DEFAULT CHARACTER SET ascii DEFAULT COLLATE ascii_bin;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d11 ascii ascii_bin NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d11 ascii ascii_bin NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d11 CHARACTER SET cp1250 COLLATE cp1250_croatian_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d11 cp1250 cp1250_croatian_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d11 cp1250 cp1250_croatian_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d11;
diff --git a/mysql-test/suite/engines/funcs/r/db_alter_collate_ascii.result b/mysql-test/suite/engines/funcs/r/db_alter_collate_ascii.result
index a7217ba424e..0b06979ee1d 100644
--- a/mysql-test/suite/engines/funcs/r/db_alter_collate_ascii.result
+++ b/mysql-test/suite/engines/funcs/r/db_alter_collate_ascii.result
@@ -325,153 +325,153 @@ eucjpms_japanese_nopad_ci eucjpms 1121 # #
eucjpms_nopad_bin eucjpms 1122 # #
CREATE DATABASE d9 DEFAULT CHARACTER SET ascii;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d9 ascii ascii_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d9 ascii ascii_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d9 COLLATE ascii_bin;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d9 ascii ascii_bin NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d9 ascii ascii_bin NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d9;
CREATE DATABASE d9 DEFAULT CHARACTER SET ascii;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d9 ascii ascii_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d9 ascii ascii_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d9 DEFAULT COLLATE ascii_bin;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d9 ascii ascii_bin NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d9 ascii ascii_bin NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d9;
CREATE DATABASE d9 DEFAULT CHARACTER SET ascii;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d9 ascii ascii_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d9 ascii ascii_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d9 COLLATE ascii_general_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d9 ascii ascii_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d9 ascii ascii_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d9;
CREATE DATABASE d9 DEFAULT CHARACTER SET ascii;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d9 ascii ascii_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d9 ascii ascii_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d9 DEFAULT COLLATE ascii_general_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d9 ascii ascii_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d9 ascii ascii_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d9;
CREATE DATABASE d9 DEFAULT CHARACTER SET ascii;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d9 ascii ascii_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d9 ascii ascii_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d9 COLLATE ascii_bin;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d9 ascii ascii_bin NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d9 ascii ascii_bin NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d9;
CREATE DATABASE d9 DEFAULT CHARACTER SET ascii;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d9 ascii ascii_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d9 ascii ascii_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d9 DEFAULT COLLATE ascii_bin;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d9 ascii ascii_bin NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d9 ascii ascii_bin NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d9;
CREATE DATABASE d9 DEFAULT CHARACTER SET ascii;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d9 ascii ascii_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d9 ascii ascii_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d9 COLLATE ascii_general_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d9 ascii ascii_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d9 ascii ascii_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d9;
CREATE DATABASE d9 DEFAULT CHARACTER SET ascii;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d9 ascii ascii_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d9 ascii ascii_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d9 DEFAULT COLLATE ascii_general_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d9 ascii ascii_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d9 ascii ascii_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d9;
diff --git a/mysql-test/suite/engines/funcs/r/db_alter_collate_utf8.result b/mysql-test/suite/engines/funcs/r/db_alter_collate_utf8.result
index 8304b3a0f96..1b875962417 100644
--- a/mysql-test/suite/engines/funcs/r/db_alter_collate_utf8.result
+++ b/mysql-test/suite/engines/funcs/r/db_alter_collate_utf8.result
@@ -325,1597 +325,1597 @@ eucjpms_japanese_nopad_ci eucjpms 1121 # #
eucjpms_nopad_bin eucjpms 1122 # #
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 COLLATE utf8_general_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 DEFAULT COLLATE utf8_general_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 COLLATE utf8_bin;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_bin NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_bin NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 DEFAULT COLLATE utf8_bin;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_bin NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_bin NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 COLLATE utf8_unicode_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_unicode_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_unicode_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 DEFAULT COLLATE utf8_unicode_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_unicode_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_unicode_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 COLLATE utf8_icelandic_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_icelandic_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_icelandic_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 DEFAULT COLLATE utf8_icelandic_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_icelandic_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_icelandic_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 COLLATE utf8_latvian_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_latvian_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_latvian_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 DEFAULT COLLATE utf8_latvian_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_latvian_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_latvian_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 COLLATE utf8_romanian_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_romanian_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_romanian_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 DEFAULT COLLATE utf8_romanian_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_romanian_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_romanian_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 COLLATE utf8_slovenian_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_slovenian_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_slovenian_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 DEFAULT COLLATE utf8_slovenian_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_slovenian_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_slovenian_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 COLLATE utf8_polish_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_polish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_polish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 DEFAULT COLLATE utf8_polish_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_polish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_polish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 COLLATE utf8_estonian_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_estonian_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_estonian_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 DEFAULT COLLATE utf8_estonian_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_estonian_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_estonian_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 COLLATE utf8_spanish_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_spanish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_spanish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 DEFAULT COLLATE utf8_spanish_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_spanish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_spanish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 COLLATE utf8_swedish_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_swedish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_swedish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 DEFAULT COLLATE utf8_swedish_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_swedish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_swedish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 COLLATE utf8_turkish_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_turkish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_turkish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 DEFAULT COLLATE utf8_turkish_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_turkish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_turkish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 COLLATE utf8_czech_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_czech_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_czech_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 DEFAULT COLLATE utf8_czech_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_czech_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_czech_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 COLLATE utf8_danish_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_danish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_danish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 DEFAULT COLLATE utf8_danish_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_danish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_danish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 COLLATE utf8_lithuanian_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_lithuanian_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_lithuanian_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 DEFAULT COLLATE utf8_lithuanian_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_lithuanian_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_lithuanian_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 COLLATE utf8_slovak_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_slovak_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_slovak_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 DEFAULT COLLATE utf8_slovak_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_slovak_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_slovak_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 COLLATE utf8_spanish2_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_spanish2_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_spanish2_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 DEFAULT COLLATE utf8_spanish2_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_spanish2_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_spanish2_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 COLLATE utf8_roman_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_roman_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_roman_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 DEFAULT COLLATE utf8_roman_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_roman_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_roman_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 COLLATE utf8_persian_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_persian_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_persian_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 DEFAULT COLLATE utf8_persian_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_persian_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_persian_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 COLLATE utf8_esperanto_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_esperanto_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_esperanto_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 DEFAULT COLLATE utf8_esperanto_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_esperanto_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_esperanto_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 COLLATE utf8_hungarian_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_hungarian_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_hungarian_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER DATABASE d10 DEFAULT COLLATE utf8_hungarian_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_hungarian_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_hungarian_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 COLLATE utf8_general_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 DEFAULT COLLATE utf8_general_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 COLLATE utf8_bin;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_bin NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_bin NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 DEFAULT COLLATE utf8_bin;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_bin NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_bin NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 COLLATE utf8_unicode_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_unicode_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_unicode_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 DEFAULT COLLATE utf8_unicode_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_unicode_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_unicode_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 COLLATE utf8_icelandic_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_icelandic_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_icelandic_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 DEFAULT COLLATE utf8_icelandic_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_icelandic_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_icelandic_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 COLLATE utf8_latvian_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_latvian_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_latvian_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 DEFAULT COLLATE utf8_latvian_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_latvian_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_latvian_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 COLLATE utf8_romanian_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_romanian_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_romanian_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 DEFAULT COLLATE utf8_romanian_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_romanian_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_romanian_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 COLLATE utf8_slovenian_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_slovenian_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_slovenian_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 DEFAULT COLLATE utf8_slovenian_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_slovenian_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_slovenian_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 COLLATE utf8_polish_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_polish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_polish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 DEFAULT COLLATE utf8_polish_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_polish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_polish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 COLLATE utf8_estonian_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_estonian_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_estonian_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 DEFAULT COLLATE utf8_estonian_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_estonian_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_estonian_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 COLLATE utf8_spanish_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_spanish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_spanish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 DEFAULT COLLATE utf8_spanish_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_spanish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_spanish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 COLLATE utf8_swedish_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_swedish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_swedish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 DEFAULT COLLATE utf8_swedish_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_swedish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_swedish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 COLLATE utf8_turkish_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_turkish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_turkish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 DEFAULT COLLATE utf8_turkish_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_turkish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_turkish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 COLLATE utf8_czech_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_czech_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_czech_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 DEFAULT COLLATE utf8_czech_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_czech_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_czech_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 COLLATE utf8_danish_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_danish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_danish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 DEFAULT COLLATE utf8_danish_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_danish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_danish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 COLLATE utf8_lithuanian_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_lithuanian_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_lithuanian_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 DEFAULT COLLATE utf8_lithuanian_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_lithuanian_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_lithuanian_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 COLLATE utf8_slovak_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_slovak_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_slovak_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 DEFAULT COLLATE utf8_slovak_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_slovak_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_slovak_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 COLLATE utf8_spanish2_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_spanish2_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_spanish2_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 DEFAULT COLLATE utf8_spanish2_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_spanish2_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_spanish2_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 COLLATE utf8_roman_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_roman_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_roman_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 DEFAULT COLLATE utf8_roman_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_roman_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_roman_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 COLLATE utf8_persian_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_persian_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_persian_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 DEFAULT COLLATE utf8_persian_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_persian_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_persian_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 COLLATE utf8_esperanto_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_esperanto_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_esperanto_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 DEFAULT COLLATE utf8_esperanto_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_esperanto_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_esperanto_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 COLLATE utf8_hungarian_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_hungarian_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_hungarian_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
CREATE DATABASE d10 DEFAULT CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
ALTER SCHEMA d10 DEFAULT COLLATE utf8_hungarian_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d10 utf8 utf8_hungarian_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d10 utf8 utf8_hungarian_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d10;
diff --git a/mysql-test/suite/engines/funcs/r/db_create_character_set.result b/mysql-test/suite/engines/funcs/r/db_create_character_set.result
index 466eabce744..3c3d99bfba2 100644
--- a/mysql-test/suite/engines/funcs/r/db_create_character_set.result
+++ b/mysql-test/suite/engines/funcs/r/db_create_character_set.result
@@ -1,101 +1,101 @@
DROP DATABASE IF EXISTS d12;
CREATE DATABASE d12 CHARACTER SET ascii;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d12 ascii ascii_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d12 ascii ascii_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d12;
CREATE DATABASE d12 CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d12 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d12 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d12;
CREATE DATABASE d12 CHARACTER SET binary;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d12 binary binary NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d12 binary binary NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d12;
CREATE DATABASE d12 CHARACTER SET swe7;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d12 swe7 swe7_swedish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d12 swe7 swe7_swedish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d12;
CREATE DATABASE d12 CHARACTER SET cp1251;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d12 cp1251 cp1251_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d12 cp1251 cp1251_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d12;
CREATE SCHEMA d12 CHARACTER SET ascii;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d12 ascii ascii_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d12 ascii ascii_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP SCHEMA d12;
CREATE SCHEMA d12 CHARACTER SET utf8;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d12 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d12 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP SCHEMA d12;
CREATE SCHEMA d12 CHARACTER SET binary;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d12 binary binary NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d12 binary binary NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP SCHEMA d12;
CREATE SCHEMA d12 CHARACTER SET swe7;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d12 swe7 swe7_swedish_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d12 swe7 swe7_swedish_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP SCHEMA d12;
CREATE SCHEMA d12 CHARACTER SET cp1251;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d12 cp1251 cp1251_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d12 cp1251 cp1251_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP SCHEMA d12;
diff --git a/mysql-test/suite/engines/funcs/r/db_create_character_set_collate.result b/mysql-test/suite/engines/funcs/r/db_create_character_set_collate.result
index 4263454f229..236973a34fd 100644
--- a/mysql-test/suite/engines/funcs/r/db_create_character_set_collate.result
+++ b/mysql-test/suite/engines/funcs/r/db_create_character_set_collate.result
@@ -1,61 +1,61 @@
DROP DATABASE IF EXISTS d13;
CREATE DATABASE d13 CHARACTER SET utf8 COLLATE utf8_general_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d13 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d13 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d13;
CREATE DATABASE d13 CHARACTER SET latin2 COLLATE latin2_general_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d13 latin2 latin2_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d13 latin2 latin2_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d13;
CREATE DATABASE d13 CHARACTER SET cp1250 COLLATE cp1250_croatian_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d13 cp1250 cp1250_croatian_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d13 cp1250 cp1250_croatian_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP DATABASE d13;
CREATE SCHEMA d13 CHARACTER SET utf8 COLLATE utf8_general_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d13 utf8 utf8_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d13 utf8 utf8_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP SCHEMA d13;
CREATE SCHEMA d13 CHARACTER SET latin2 COLLATE latin2_general_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d13 latin2 latin2_general_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d13 latin2 latin2_general_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP SCHEMA d13;
CREATE SCHEMA d13 CHARACTER SET cp1250 COLLATE cp1250_croatian_ci;
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def d13 cp1250 cp1250_croatian_ci NULL
-def information_schema utf8 utf8_general_ci NULL
-def mtr latin1 latin1_swedish_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def performance_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def d13 cp1250 cp1250_croatian_ci NULL
+def information_schema utf8 utf8_general_ci NULL
+def mtr latin1 latin1_swedish_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def performance_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
DROP SCHEMA d13;
diff --git a/mysql-test/suite/federated/federated_type_inet6.result b/mysql-test/suite/federated/federated_type_inet6.result
new file mode 100644
index 00000000000..625a7f3353f
--- /dev/null
+++ b/mysql-test/suite/federated/federated_type_inet6.result
@@ -0,0 +1,24 @@
+connect master,127.0.0.1,root,,test,$MASTER_MYPORT,;
+connect slave,127.0.0.1,root,,test,$SLAVE_MYPORT,;
+connection master;
+CREATE DATABASE federated;
+connection slave;
+CREATE DATABASE federated;
+#
+# MDEV-20806 Federated does not work with INET6, returns NULL with warning ER_TRUNCATED_WRONG_VALUE
+#
+connection master;
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('::'),('f::f');
+CREATE TABLE t2 (a INET6) ENGINE=Federated CONNECTION='mysql://root@127.0.0.1:MASTER_PORT/test/t1';
+SELECT * FROM t2;
+a
+::
+f::f
+DROP TABLE t1, t2;
+connection master;
+DROP TABLE IF EXISTS federated.t1;
+DROP DATABASE IF EXISTS federated;
+connection slave;
+DROP TABLE IF EXISTS federated.t1;
+DROP DATABASE IF EXISTS federated;
diff --git a/mysql-test/suite/federated/federated_type_inet6.test b/mysql-test/suite/federated/federated_type_inet6.test
new file mode 100644
index 00000000000..857f0726689
--- /dev/null
+++ b/mysql-test/suite/federated/federated_type_inet6.test
@@ -0,0 +1,17 @@
+source include/federated.inc;
+
+--echo #
+--echo # MDEV-20806 Federated does not work with INET6, returns NULL with warning ER_TRUNCATED_WRONG_VALUE
+--echo #
+
+connection master;
+
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('::'),('f::f');
+
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval CREATE TABLE t2 (a INET6) ENGINE=Federated CONNECTION='mysql://root@127.0.0.1:$MASTER_MYPORT/test/t1';
+SELECT * FROM t2;
+DROP TABLE t1, t2;
+
+source include/federated_cleanup.inc;
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 386b0f07f98..00f9f347067 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_is.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_is.result
@@ -326,6 +326,7 @@ def information_schema ROUTINES SQL_PATH 22 NULL YES varchar 64 192 NULL NULL NU
def information_schema SCHEMATA CATALOG_NAME 1 '' NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) select NEVER NULL
def information_schema SCHEMATA DEFAULT_CHARACTER_SET_NAME 3 '' NO varchar 32 96 NULL NULL NULL utf8 utf8_general_ci varchar(32) select NEVER NULL
def information_schema SCHEMATA DEFAULT_COLLATION_NAME 4 '' NO varchar 32 96 NULL NULL NULL utf8 utf8_general_ci varchar(32) select NEVER NULL
+def information_schema SCHEMATA SCHEMA_COMMENT 6 '' NO varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) select NEVER NULL
def information_schema SCHEMATA SCHEMA_NAME 2 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select NEVER NULL
def information_schema SCHEMATA SQL_PATH 5 NULL YES varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) select NEVER NULL
def information_schema SCHEMA_PRIVILEGES GRANTEE 1 '' NO varchar 190 570 NULL NULL NULL utf8 utf8_general_ci varchar(190) select NEVER NULL
@@ -870,6 +871,7 @@ NULL information_schema ROUTINES LAST_ALTERED datetime NULL NULL NULL NULL datet
3.0000 information_schema SCHEMATA DEFAULT_CHARACTER_SET_NAME varchar 32 96 utf8 utf8_general_ci varchar(32)
3.0000 information_schema SCHEMATA DEFAULT_COLLATION_NAME varchar 32 96 utf8 utf8_general_ci varchar(32)
3.0000 information_schema SCHEMATA SQL_PATH varchar 512 1536 utf8 utf8_general_ci varchar(512)
+3.0000 information_schema SCHEMATA SCHEMA_COMMENT varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
3.0000 information_schema SCHEMA_PRIVILEGES GRANTEE varchar 190 570 utf8 utf8_general_ci varchar(190)
3.0000 information_schema SCHEMA_PRIVILEGES TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512)
3.0000 information_schema SCHEMA_PRIVILEGES TABLE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64)
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 97346c4648d..072a90eaa50 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
@@ -326,6 +326,7 @@ def information_schema ROUTINES SQL_PATH 22 NULL YES varchar 64 192 NULL NULL NU
def information_schema SCHEMATA CATALOG_NAME 1 '' NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) NEVER NULL
def information_schema SCHEMATA DEFAULT_CHARACTER_SET_NAME 3 '' NO varchar 32 96 NULL NULL NULL utf8 utf8_general_ci varchar(32) NEVER NULL
def information_schema SCHEMATA DEFAULT_COLLATION_NAME 4 '' NO varchar 32 96 NULL NULL NULL utf8 utf8_general_ci varchar(32) NEVER NULL
+def information_schema SCHEMATA SCHEMA_COMMENT 6 '' NO varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) NEVER NULL
def information_schema SCHEMATA SCHEMA_NAME 2 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) NEVER NULL
def information_schema SCHEMATA SQL_PATH 5 NULL YES varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) NEVER NULL
def information_schema SCHEMA_PRIVILEGES GRANTEE 1 '' NO varchar 190 570 NULL NULL NULL utf8 utf8_general_ci varchar(190) NEVER NULL
@@ -870,6 +871,7 @@ NULL information_schema ROUTINES LAST_ALTERED datetime NULL NULL NULL NULL datet
3.0000 information_schema SCHEMATA DEFAULT_CHARACTER_SET_NAME varchar 32 96 utf8 utf8_general_ci varchar(32)
3.0000 information_schema SCHEMATA DEFAULT_COLLATION_NAME varchar 32 96 utf8 utf8_general_ci varchar(32)
3.0000 information_schema SCHEMATA SQL_PATH varchar 512 1536 utf8 utf8_general_ci varchar(512)
+3.0000 information_schema SCHEMATA SCHEMA_COMMENT varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
3.0000 information_schema SCHEMA_PRIVILEGES GRANTEE varchar 190 570 utf8 utf8_general_ci varchar(190)
3.0000 information_schema SCHEMA_PRIVILEGES TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512)
3.0000 information_schema SCHEMA_PRIVILEGES TABLE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64)
diff --git a/mysql-test/suite/funcs_1/r/is_schemata.result b/mysql-test/suite/funcs_1/r/is_schemata.result
index 6db6ac8f150..18ee8d01147 100644
--- a/mysql-test/suite/funcs_1/r/is_schemata.result
+++ b/mysql-test/suite/funcs_1/r/is_schemata.result
@@ -33,6 +33,7 @@ SCHEMA_NAME varchar(64) NO
DEFAULT_CHARACTER_SET_NAME varchar(32) NO
DEFAULT_COLLATION_NAME varchar(32) NO
SQL_PATH varchar(512) YES NULL
+SCHEMA_COMMENT varchar(1024) NO
SHOW CREATE TABLE information_schema.SCHEMATA;
Table Create Table
SCHEMATA CREATE TEMPORARY TABLE `SCHEMATA` (
@@ -40,7 +41,8 @@ SCHEMATA CREATE TEMPORARY TABLE `SCHEMATA` (
`SCHEMA_NAME` varchar(64) NOT NULL DEFAULT '',
`DEFAULT_CHARACTER_SET_NAME` varchar(32) NOT NULL DEFAULT '',
`DEFAULT_COLLATION_NAME` varchar(32) NOT NULL DEFAULT '',
- `SQL_PATH` varchar(512) DEFAULT NULL
+ `SQL_PATH` varchar(512) DEFAULT NULL,
+ `SCHEMA_COMMENT` varchar(1024) NOT NULL DEFAULT ''
) ENGINE=MEMORY DEFAULT CHARSET=utf8
SHOW COLUMNS FROM information_schema.SCHEMATA;
Field Type Null Key Default Extra
@@ -49,6 +51,7 @@ SCHEMA_NAME varchar(64) NO
DEFAULT_CHARACTER_SET_NAME varchar(32) NO
DEFAULT_COLLATION_NAME varchar(32) NO
SQL_PATH varchar(512) YES NULL
+SCHEMA_COMMENT varchar(1024) NO
SELECT catalog_name, schema_name, sql_path
FROM information_schema.schemata
WHERE catalog_name IS NOT NULL or sql_path IS NOT NULL
@@ -77,9 +80,9 @@ GRANT SELECT ON db_datadict_1.* to 'testuser2'@'localhost';
GRANT SELECT ON db_datadict_2.* to 'testuser2'@'localhost';
SELECT * FROM information_schema.schemata
WHERE schema_name LIKE 'db_datadict_%' ORDER BY schema_name;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def db_datadict_1 latin1 latin1_swedish_ci NULL
-def db_datadict_2 latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def db_datadict_1 latin1 latin1_swedish_ci NULL
+def db_datadict_2 latin1 latin1_swedish_ci NULL
SHOW DATABASES LIKE 'db_datadict_%';
Database (db_datadict_%)
db_datadict_1
@@ -87,17 +90,17 @@ db_datadict_2
connect testuser1, localhost, testuser1, , db_datadict_1;
SELECT * FROM information_schema.schemata
WHERE schema_name LIKE 'db_datadict_%' ORDER BY schema_name;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def db_datadict_1 latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def db_datadict_1 latin1 latin1_swedish_ci NULL
SHOW DATABASES LIKE 'db_datadict_%';
Database (db_datadict_%)
db_datadict_1
connect testuser2, localhost, testuser2, , db_datadict_2;
SELECT * FROM information_schema.schemata
WHERE schema_name LIKE 'db_datadict_%' ORDER BY schema_name;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def db_datadict_1 latin1 latin1_swedish_ci NULL
-def db_datadict_2 latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def db_datadict_1 latin1 latin1_swedish_ci NULL
+def db_datadict_2 latin1 latin1_swedish_ci NULL
SHOW DATABASES LIKE 'db_datadict_%';
Database (db_datadict_%)
db_datadict_1
@@ -105,7 +108,7 @@ db_datadict_2
connect testuser3, localhost, testuser3, , test;
SELECT * FROM information_schema.schemata
WHERE schema_name LIKE 'db_datadict_%' ORDER BY schema_name;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
SHOW DATABASES LIKE 'db_datadict_%';
Database (db_datadict_%)
connection default;
@@ -122,11 +125,11 @@ DROP DATABASE db_datadict_2;
#################################################################################
DROP DATABASE IF EXISTS db_datadict;
SELECT * FROM information_schema.schemata WHERE schema_name = 'db_datadict';
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
CREATE DATABASE db_datadict CHARACTER SET 'latin1' COLLATE 'latin1_swedish_ci';
SELECT * FROM information_schema.schemata WHERE schema_name = 'db_datadict';
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def db_datadict latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def db_datadict latin1 latin1_swedish_ci NULL
SELECT schema_name, default_character_set_name
FROM information_schema.schemata WHERE schema_name = 'db_datadict';
schema_name default_character_set_name
diff --git a/mysql-test/suite/funcs_1/r/is_schemata_embedded.result b/mysql-test/suite/funcs_1/r/is_schemata_embedded.result
index bc993e8dc9f..6cd93190efd 100644
--- a/mysql-test/suite/funcs_1/r/is_schemata_embedded.result
+++ b/mysql-test/suite/funcs_1/r/is_schemata_embedded.result
@@ -33,6 +33,7 @@ SCHEMA_NAME varchar(64) NO
DEFAULT_CHARACTER_SET_NAME varchar(32) NO
DEFAULT_COLLATION_NAME varchar(32) NO
SQL_PATH varchar(512) YES NULL
+SCHEMA_COMMENT varchar(1024) NO
SHOW CREATE TABLE information_schema.SCHEMATA;
Table Create Table
SCHEMATA CREATE TEMPORARY TABLE `SCHEMATA` (
@@ -40,7 +41,8 @@ SCHEMATA CREATE TEMPORARY TABLE `SCHEMATA` (
`SCHEMA_NAME` varchar(64) NOT NULL DEFAULT '',
`DEFAULT_CHARACTER_SET_NAME` varchar(32) NOT NULL DEFAULT '',
`DEFAULT_COLLATION_NAME` varchar(32) NOT NULL DEFAULT '',
- `SQL_PATH` varchar(512) DEFAULT NULL
+ `SQL_PATH` varchar(512) DEFAULT NULL,
+ `SCHEMA_COMMENT` varchar(1024) NOT NULL DEFAULT ''
) ENGINE=MEMORY DEFAULT CHARSET=utf8
SHOW COLUMNS FROM information_schema.SCHEMATA;
Field Type Null Key Default Extra
@@ -49,6 +51,7 @@ SCHEMA_NAME varchar(64) NO
DEFAULT_CHARACTER_SET_NAME varchar(32) NO
DEFAULT_COLLATION_NAME varchar(32) NO
SQL_PATH varchar(512) YES NULL
+SCHEMA_COMMENT varchar(1024) NO
SELECT catalog_name, schema_name, sql_path
FROM information_schema.schemata
WHERE catalog_name IS NOT NULL or sql_path IS NOT NULL
@@ -77,9 +80,9 @@ GRANT SELECT ON db_datadict_1.* to 'testuser2'@'localhost';
GRANT SELECT ON db_datadict_2.* to 'testuser2'@'localhost';
SELECT * FROM information_schema.schemata
WHERE schema_name LIKE 'db_datadict_%' ORDER BY schema_name;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def db_datadict_1 latin1 latin1_swedish_ci NULL
-def db_datadict_2 latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def db_datadict_1 latin1 latin1_swedish_ci NULL
+def db_datadict_2 latin1 latin1_swedish_ci NULL
SHOW DATABASES LIKE 'db_datadict_%';
Database (db_datadict_%)
db_datadict_1
@@ -87,9 +90,9 @@ db_datadict_2
connect testuser1, localhost, testuser1, , db_datadict_1;
SELECT * FROM information_schema.schemata
WHERE schema_name LIKE 'db_datadict_%' ORDER BY schema_name;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def db_datadict_1 latin1 latin1_swedish_ci NULL
-def db_datadict_2 latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def db_datadict_1 latin1 latin1_swedish_ci NULL
+def db_datadict_2 latin1 latin1_swedish_ci NULL
SHOW DATABASES LIKE 'db_datadict_%';
Database (db_datadict_%)
db_datadict_1
@@ -97,9 +100,9 @@ db_datadict_2
connect testuser2, localhost, testuser2, , db_datadict_2;
SELECT * FROM information_schema.schemata
WHERE schema_name LIKE 'db_datadict_%' ORDER BY schema_name;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def db_datadict_1 latin1 latin1_swedish_ci NULL
-def db_datadict_2 latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def db_datadict_1 latin1 latin1_swedish_ci NULL
+def db_datadict_2 latin1 latin1_swedish_ci NULL
SHOW DATABASES LIKE 'db_datadict_%';
Database (db_datadict_%)
db_datadict_1
@@ -107,9 +110,9 @@ db_datadict_2
connect testuser3, localhost, testuser3, , test;
SELECT * FROM information_schema.schemata
WHERE schema_name LIKE 'db_datadict_%' ORDER BY schema_name;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def db_datadict_1 latin1 latin1_swedish_ci NULL
-def db_datadict_2 latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def db_datadict_1 latin1 latin1_swedish_ci NULL
+def db_datadict_2 latin1 latin1_swedish_ci NULL
SHOW DATABASES LIKE 'db_datadict_%';
Database (db_datadict_%)
db_datadict_1
@@ -128,11 +131,11 @@ DROP DATABASE db_datadict_2;
#################################################################################
DROP DATABASE IF EXISTS db_datadict;
SELECT * FROM information_schema.schemata WHERE schema_name = 'db_datadict';
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
CREATE DATABASE db_datadict CHARACTER SET 'latin1' COLLATE 'latin1_swedish_ci';
SELECT * FROM information_schema.schemata WHERE schema_name = 'db_datadict';
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def db_datadict latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def db_datadict latin1 latin1_swedish_ci NULL
SELECT schema_name, default_character_set_name
FROM information_schema.schemata WHERE schema_name = 'db_datadict';
schema_name default_character_set_name
diff --git a/mysql-test/suite/funcs_1/r/is_schemata_is_mysql_test.result b/mysql-test/suite/funcs_1/r/is_schemata_is_mysql_test.result
index 0679142bd82..ccf0e513d88 100644
--- a/mysql-test/suite/funcs_1/r/is_schemata_is_mysql_test.result
+++ b/mysql-test/suite/funcs_1/r/is_schemata_is_mysql_test.result
@@ -9,10 +9,10 @@ GRANT SELECT ON db_datadict.* TO 'testuser1'@'localhost';
SELECT * FROM information_schema.schemata
WHERE schema_name IN ('information_schema','mysql','test')
ORDER BY schema_name;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def information_schema utf8 utf8_general_ci NULL
-def mysql latin1 latin1_swedish_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def information_schema utf8 utf8_general_ci NULL
+def mysql latin1 latin1_swedish_ci NULL
+def test latin1 latin1_swedish_ci NULL
SHOW DATABASES LIKE 'information_schema';
Database (information_schema)
information_schema
@@ -26,9 +26,9 @@ connect testuser1, localhost, testuser1, , db_datadict;
SELECT * FROM information_schema.schemata
WHERE schema_name IN ('information_schema','mysql','test')
ORDER BY schema_name;
-CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
-def information_schema utf8 utf8_general_ci NULL
-def test latin1 latin1_swedish_ci NULL
+CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
+def information_schema utf8 utf8_general_ci NULL
+def test latin1 latin1_swedish_ci NULL
SHOW DATABASES LIKE 'information_schema';
Database (information_schema)
information_schema
diff --git a/mysql-test/suite/funcs_1/r/storedproc.result b/mysql-test/suite/funcs_1/r/storedproc.result
index 81ed8405b7d..dce2f31768a 100644
--- a/mysql-test/suite/funcs_1/r/storedproc.result
+++ b/mysql-test/suite/funcs_1/r/storedproc.result
@@ -5864,9 +5864,7 @@ BEGIN
declare x default '0' char;
SELECT x;
END//
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'default '0' char;
-SELECT x;
-END' at line 3
+ERROR HY000: Unknown data type: 'default'
DROP PROCEDURE IF EXISTS sp6;
CREATE PROCEDURE sp6( )
BEGIN
@@ -5911,8 +5909,7 @@ CREATE PROCEDURE sp6( )
BEGIN
declare x default 'a' char;
END//
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'default 'a' char;
-END' at line 3
+ERROR HY000: Unknown data type: 'default'
DROP PROCEDURE IF EXISTS sp6;
CREATE PROCEDURE sp6( )
BEGIN
@@ -5967,8 +5964,7 @@ CREATE PROCEDURE sp6( )
BEGIN
declare handler continue for sqlstate '02000' set @x2 = 1;
END//
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'continue for sqlstate '02000' set @x2 = 1;
-END' at line 3
+ERROR HY000: Unknown data type: 'continue'
DROP PROCEDURE IF EXISTS sp6;
CREATE PROCEDURE sp6( )
BEGIN
@@ -5981,8 +5977,7 @@ CREATE PROCEDURE sp6( )
BEGIN
declare handler undo for sqlstate '02000' set @x2 = 1;
END//
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'undo for sqlstate '02000' set @x2 = 1;
-END' at line 3
+ERROR HY000: Unknown data type: 'undo'
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1( )
BEGIN
@@ -6876,45 +6871,35 @@ BEGIN
declare date not null x;
SELECT f101 into x from tb2 limit 9998, 1;
END//
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'not null x;
-SELECT f101 into x from tb2 limit 9998, 1;
-END' at line 3
+ERROR HY000: Unknown data type: 'not'
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1( )
BEGIN
declare time not null x;
SELECT f102 into x from tb2 limit 9998, 1;
END//
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'not null x;
-SELECT f102 into x from tb2 limit 9998, 1;
-END' at line 3
+ERROR HY000: Unknown data type: 'not'
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1( )
BEGIN
declare datetime not null x;
SELECT f103 into x from tb2 limit 9998, 1;
END//
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'not null x;
-SELECT f103 into x from tb2 limit 9998, 1;
-END' at line 3
+ERROR HY000: Unknown data type: 'not'
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1( )
BEGIN
declare timestamp not null x;
SELECT f104 into x from tb2 limit 9998, 1;
END//
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'not null x;
-SELECT f104 into x from tb2 limit 9998, 1;
-END' at line 3
+ERROR HY000: Unknown data type: 'not'
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1( )
BEGIN
declare year not null x;
SELECT f105 into x from tb2 limit 9998, 1;
END//
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'not null x;
-SELECT f105 into x from tb2 limit 9998, 1;
-END' at line 3
+ERROR HY000: Unknown data type: 'not'
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1( )
BEGIN
@@ -9347,8 +9332,7 @@ CREATE PROCEDURE sp1( )
BEGIN
declare x char1;
END//
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'char1;
-END' at line 3
+ERROR HY000: Unknown data type: 'char1'
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11664,10 +11648,7 @@ set @x = 2;
insert into t values (1);
set @x = 3;
END//
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'handler for sqlstate '2300' set @x2 = 1;
-set @x = 1;
-insert into t values (1);
-s' at line 3
+ERROR HY000: Unknown data type: 'handler'
DROP PROCEDURE IF EXISTS handler1;
Warnings:
Note 1305 PROCEDURE db_storedproc.handler1 does not exist
@@ -11680,10 +11661,7 @@ set @x = 2;
insert into t values (1);
set @x = 3;
END//
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'handler for sqlstate '2300' set @x2 = 1;
-set @x = 1;
-insert into t values (1);
-s' at line 3
+ERROR HY000: Unknown data type: 'handler'
DROP PROCEDURE IF EXISTS handler1;
Warnings:
Note 1305 PROCEDURE db_storedproc.handler1 does not exist
@@ -11696,10 +11674,7 @@ set @x = 2;
insert into t values (1);
set @x = 3;
END//
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'handler for sqlstate '2300' set @x2 = 1;
-set @x = 1;
-insert into t values (1);
-s' at line 3
+ERROR HY000: Unknown data type: 'handler'
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -12950,8 +12925,7 @@ CREATE PROCEDURE sp1( )
BEGIN
declare option handler for sqlstate '02000' set @var2 = 1;
END//
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'handler for sqlstate '02000' set @var2 = 1;
-END' at line 3
+ERROR HY000: Unknown data type: 'handler'
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -13031,8 +13005,7 @@ CREATE PROCEDURE sp1( )
BEGIN
declare privileges handler for sqlstate '02000' set @var2 = 1;
END//
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'handler for sqlstate '02000' set @var2 = 1;
-END' at line 3
+ERROR HY000: Unknown data type: 'handler'
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -13085,8 +13058,7 @@ CREATE PROCEDURE sp1( )
BEGIN
declare read_only handler for sqlstate '02000' set @var2 = 1;
END//
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'handler for sqlstate '02000' set @var2 = 1;
-END' at line 3
+ERROR HY000: Unknown data type: 'handler'
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
diff --git a/mysql-test/suite/funcs_1/t/storedproc.test b/mysql-test/suite/funcs_1/t/storedproc.test
index 7ca9ba6f3d1..dde624bd0b9 100644
--- a/mysql-test/suite/funcs_1/t/storedproc.test
+++ b/mysql-test/suite/funcs_1/t/storedproc.test
@@ -5954,7 +5954,7 @@ DROP PROCEDURE IF EXISTS sp6;
--enable_warnings
delimiter //;
---error ER_PARSE_ERROR
+--error ER_UNKNOWN_DATA_TYPE
CREATE PROCEDURE sp6( )
BEGIN
declare x default '0' char;
@@ -6021,7 +6021,7 @@ DROP PROCEDURE IF EXISTS sp6;
--enable_warnings
delimiter //;
---error ER_PARSE_ERROR
+--error ER_UNKNOWN_DATA_TYPE
CREATE PROCEDURE sp6( )
BEGIN
declare x default 'a' char;
@@ -6117,7 +6117,7 @@ DROP PROCEDURE IF EXISTS sp6;
--enable_warnings
delimiter //;
---error ER_PARSE_ERROR
+--error ER_UNKNOWN_DATA_TYPE
CREATE PROCEDURE sp6( )
BEGIN
declare handler continue for sqlstate '02000' set @x2 = 1;
@@ -6141,7 +6141,7 @@ DROP PROCEDURE IF EXISTS sp6;
--enable_warnings
delimiter //;
---error ER_PARSE_ERROR
+--error ER_UNKNOWN_DATA_TYPE
CREATE PROCEDURE sp6( )
BEGIN
declare handler undo for sqlstate '02000' set @x2 = 1;
@@ -7455,7 +7455,7 @@ DROP PROCEDURE IF EXISTS sp1;
--enable_warnings
delimiter //;
---error ER_PARSE_ERROR
+--error ER_UNKNOWN_DATA_TYPE
CREATE PROCEDURE sp1( )
BEGIN
declare date not null x;
@@ -7468,7 +7468,7 @@ DROP PROCEDURE IF EXISTS sp1;
--enable_warnings
delimiter //;
---error ER_PARSE_ERROR
+--error ER_UNKNOWN_DATA_TYPE
CREATE PROCEDURE sp1( )
BEGIN
declare time not null x;
@@ -7481,7 +7481,7 @@ DROP PROCEDURE IF EXISTS sp1;
--enable_warnings
delimiter //;
---error ER_PARSE_ERROR
+--error ER_UNKNOWN_DATA_TYPE
CREATE PROCEDURE sp1( )
BEGIN
declare datetime not null x;
@@ -7494,7 +7494,7 @@ DROP PROCEDURE IF EXISTS sp1;
--enable_warnings
delimiter //;
---error ER_PARSE_ERROR
+--error ER_UNKNOWN_DATA_TYPE
CREATE PROCEDURE sp1( )
BEGIN
declare timestamp not null x;
@@ -7507,7 +7507,7 @@ DROP PROCEDURE IF EXISTS sp1;
--enable_warnings
delimiter //;
---error ER_PARSE_ERROR
+--error ER_UNKNOWN_DATA_TYPE
CREATE PROCEDURE sp1( )
BEGIN
declare year not null x;
@@ -11210,7 +11210,7 @@ delimiter ;//
DROP PROCEDURE IF EXISTS sp1;
delimiter //;
---error ER_PARSE_ERROR
+--error ER_UNKNOWN_DATA_TYPE
CREATE PROCEDURE sp1( )
BEGIN
declare x char1;
@@ -13752,7 +13752,7 @@ delimiter ;//
DROP PROCEDURE IF EXISTS handler1;
delimiter //;
---error ER_PARSE_ERROR
+--error ER_UNKNOWN_DATA_TYPE
CREATE PROCEDURE handler1()
BEGIN
declare continueinv handler for sqlstate '2300' set @x2 = 1;
@@ -13776,7 +13776,7 @@ delimiter ;//
DROP PROCEDURE IF EXISTS handler1;
delimiter //;
---error ER_PARSE_ERROR
+--error ER_UNKNOWN_DATA_TYPE
CREATE PROCEDURE handler1()
BEGIN
declare undoinv handler for sqlstate '2300' set @x2 = 1;
@@ -13800,7 +13800,7 @@ delimiter ;//
DROP PROCEDURE IF EXISTS handler1;
delimiter //;
---error ER_PARSE_ERROR
+--error ER_UNKNOWN_DATA_TYPE
CREATE PROCEDURE handler1 ()
BEGIN
declare exitinv handler for sqlstate '2300' set @x2 = 1;
@@ -15210,7 +15210,7 @@ delimiter ;//
DROP PROCEDURE IF EXISTS sp1;
delimiter //;
---error ER_PARSE_ERROR
+--error ER_UNKNOWN_DATA_TYPE
CREATE PROCEDURE sp1( )
BEGIN
declare option handler for sqlstate '02000' set @var2 = 1;
@@ -15300,7 +15300,7 @@ delimiter ;//
DROP PROCEDURE IF EXISTS sp1;
delimiter //;
---error ER_PARSE_ERROR
+--error ER_UNKNOWN_DATA_TYPE
CREATE PROCEDURE sp1( )
BEGIN
declare privileges handler for sqlstate '02000' set @var2 = 1;
@@ -15360,7 +15360,7 @@ delimiter ;//
DROP PROCEDURE IF EXISTS sp1;
delimiter //;
---error ER_PARSE_ERROR
+--error ER_UNKNOWN_DATA_TYPE
CREATE PROCEDURE sp1( )
BEGIN
declare read_only handler for sqlstate '02000' set @var2 = 1;
diff --git a/mysql-test/suite/galera/include/kill_galera.inc b/mysql-test/suite/galera/include/kill_galera.inc
index d7f665df6c7..98ebf4ff35d 100644
--- a/mysql-test/suite/galera/include/kill_galera.inc
+++ b/mysql-test/suite/galera/include/kill_galera.inc
@@ -1,5 +1,10 @@
--echo Killing server ...
+if (!$kill_signal)
+{
+--let $kill_signal = 9
+}
+
# 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
@@ -7,13 +12,15 @@
# Kill the connected server
--disable_reconnect
+--let KILL_SIGNAL_VALUE = $kill_signal
--let KILL_NODE_PIDFILE = `SELECT @@pid_file`
--perl
+ my $kill_sig = $ENV{'KILL_SIGNAL_VALUE'};
my $pid_filename = $ENV{'KILL_NODE_PIDFILE'};
my $mysqld_pid = `cat $pid_filename`;
chomp($mysqld_pid);
- system("kill -9 $mysqld_pid");
+ system("kill -s $kill_sig $mysqld_pid");
exit(0);
EOF
diff --git a/mysql-test/suite/galera/r/GCF-360.result b/mysql-test/suite/galera/r/GCF-360.result
new file mode 100644
index 00000000000..8c1ba193c1f
--- /dev/null
+++ b/mysql-test/suite/galera/r/GCF-360.result
@@ -0,0 +1,24 @@
+connection node_2;
+connection node_1;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4;
+connection node_1;
+SELECT VARIABLE_VALUE AS expect_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+expect_4
+4
+CALL mtr.add_suppression("Slave SQL: Error 'Unknown table");
+connection node_2;
+SELECT VARIABLE_VALUE AS expect_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+expect_4
+4
+CALL mtr.add_suppression("Slave SQL: Error 'Unknown table");
+connection node_3;
+SELECT VARIABLE_VALUE AS expect_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+expect_4
+4
+CALL mtr.add_suppression("Slave SQL: Error 'Unknown table");
+connection node_4;
+SELECT VARIABLE_VALUE AS expect_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+expect_4
+4
+CALL mtr.add_suppression("Slave SQL: Error 'Unknown table");
diff --git a/mysql-test/suite/galera/r/galera-features#117.result b/mysql-test/suite/galera/r/galera-features#117.result
new file mode 100644
index 00000000000..583f3c74a8b
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera-features#117.result
@@ -0,0 +1,37 @@
+connection node_2;
+connection node_1;
+connection node_2;
+SET SESSION wsrep_on=OFF;
+CREATE TABLE test.t1 (f2 INTEGER);
+SET SESSION wsrep_on=ON;
+CREATE TABLE test.t1 (f1 INTEGER);
+ERROR 42S01: Table 't1' already exists
+connection node_1;
+SHOW CREATE TABLE test.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SHOW STATUS LIKE 'wsrep_cluster_status';
+Variable_name Value
+wsrep_cluster_status Primary
+DROP TABLE test.t1;
+connection node_2;
+SET SESSION wsrep_sync_wait=0;
+SHOW CREATE TABLE test.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f2` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SHOW STATUS LIKE 'wsrep_cluster_status';
+Variable_name Value
+wsrep_cluster_status Disconnected
+CREATE TABLE test.t2 (f1 INTEGER);
+ERROR 08S01: WSREP has not yet prepared node for application use
+SHOW TABLES IN test;
+Tables_in_test
+t1
+Killing server ...
+CALL mtr.add_suppression("Inconsistent by consensus.");
+CALL mtr.add_suppression("WSREP: Failed to execute TOI action");
+CALL mtr.add_suppression("WSREP: TO isolation end failed");
diff --git a/mysql-test/suite/galera/r/galera_gra_log.result b/mysql-test/suite/galera/r/galera_gra_log.result
index 33853188965..3b133b2732e 100644
--- a/mysql-test/suite/galera/r/galera_gra_log.result
+++ b/mysql-test/suite/galera/r/galera_gra_log.result
@@ -1,15 +1,12 @@
connection node_2;
connection node_1;
connection node_2;
+SET GLOBAL wsrep_ignore_apply_errors=0;
SET SESSION wsrep_on=OFF;
CREATE TABLE t1 (f1 INTEGER);
connection node_1;
CREATE TABLE t1 (f1 INTEGER);
connection node_2;
-SET SESSION wsrep_on=ON;
-SELECT COUNT(*) = 0 FROM t1;
-COUNT(*) = 0
-1
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
@@ -33,5 +30,7 @@ DELIMITER ;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
-CALL mtr.add_suppression("Slave SQL: Error 'Table 't1' already exists' on query");
+Killing server ...
+SET GLOBAL wsrep_ignore_apply_errors = 7;
DROP TABLE t1;
+CALL mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on");
diff --git a/mysql-test/suite/galera/r/galera_vote_rejoin_ddl.result b/mysql-test/suite/galera/r/galera_vote_rejoin_ddl.result
new file mode 100644
index 00000000000..fe98d403e13
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_vote_rejoin_ddl.result
@@ -0,0 +1,60 @@
+connection node_2;
+connection node_1;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_3;
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1';
+connection node_1;
+connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4;
+connection node_4;
+SET SESSION wsrep_on=OFF;
+CREATE TABLE t1 (f1 INTEGER);
+SET SESSION wsrep_on=ON;
+DROP TABLE t1;
+connection node_1;
+CREATE TABLE t2 (f1 INTEGER);
+connection node_3;
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 0';
+connection node_1;
+connection node_3;
+SELECT COUNT(*) AS expect_0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+expect_0
+0
+SELECT COUNT(*) AS expect_1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2';
+expect_1
+1
+connection node_4;
+SET SESSION wsrep_on=OFF;
+Killing server ...
+Starting mysqld
+connection node_1;
+SELECT COUNT(*) AS expect_0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+expect_0
+0
+SELECT COUNT(*) AS expect_1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2';
+expect_1
+1
+CALL mtr.add_suppression("Slave SQL: Error 'Unknown table");
+connection node_2;
+SELECT COUNT(*) AS expect_0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+expect_0
+0
+SELECT COUNT(*) AS expect_1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2';
+expect_1
+1
+CALL mtr.add_suppression("Slave SQL: Error 'Unknown table");
+connection node_3;
+SELECT COUNT(*) AS expect_0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+expect_0
+0
+SELECT COUNT(*) AS expect_1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2';
+expect_1
+1
+connection node_4;
+SELECT COUNT(*) AS expect_0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+expect_0
+0
+SELECT COUNT(*) AS expect_1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2';
+expect_1
+1
+CALL mtr.add_suppression("WSREP: Vote 0 \\(success\\) on .* is inconsistent with group. Leaving cluster.");
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera/r/galera_vote_rejoin_dml.result b/mysql-test/suite/galera/r/galera_vote_rejoin_dml.result
new file mode 100644
index 00000000000..f451555e000
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_vote_rejoin_dml.result
@@ -0,0 +1,73 @@
+connection node_4;
+connection node_3;
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_3;
+connection node_4;
+connection node_3;
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1';
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, 'A');
+connection node_4;
+SET SESSION wsrep_on=OFF;
+INSERT INTO t1 VALUES (2, 'B');
+SET SESSION wsrep_on=ON;
+DELETE FROM t1 WHERE f1 = 2;
+connection node_1;
+connection node_3;
+SET SESSION wsrep_on = ON;
+SET SESSION wsrep_sync_wait = 15;
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 0';
+connection node_1;
+connection node_3;
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'A';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'B';
+COUNT(*) = 0
+1
+connection node_4;
+SET SESSION wsrep_on=OFF;
+Killing server ...
+Starting mysqld
+connection node_1;
+connection node_1;
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'A';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'B';
+COUNT(*) = 0
+1
+CALL mtr.add_suppression("mysqld: Can't find record in 't1'");
+CALL mtr.add_suppression("Slave SQL: Could not execute Delete_rows");
+CALL mtr.add_suppression("WSREP: Event 3 Delete_rows_v1 apply failed: 120, seqno [0-9]*");
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'A';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'B';
+COUNT(*) = 0
+1
+CALL mtr.add_suppression("mysqld: Can't find record in 't1'");
+CALL mtr.add_suppression("Slave SQL: Could not execute Delete_rows");
+CALL mtr.add_suppression("WSREP: Event 3 Delete_rows_v1 apply failed: 120, seqno [0-9]*");
+connection node_3;
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'A';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'B';
+COUNT(*) = 0
+1
+connection node_4;
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'A';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'B';
+COUNT(*) = 0
+1
+CALL mtr.add_suppression("inconsistent with group");
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/GCF-360.cnf b/mysql-test/suite/galera/t/GCF-360.cnf
new file mode 100644
index 00000000000..28e51f87e8e
--- /dev/null
+++ b/mysql-test/suite/galera/t/GCF-360.cnf
@@ -0,0 +1,17 @@
+!include ../galera_4nodes.cnf
+
+[mysqld.1]
+wsrep_provider_options='base_port=@mysqld.1.#galera_port'
+wsrep_ignore_apply_errors=0
+
+[mysqld.2]
+wsrep_provider_options='base_port=@mysqld.2.#galera_port'
+wsrep_ignore_apply_errors=0
+
+[mysqld.3]
+wsrep_provider_options='base_port=@mysqld.3.#galera_port'
+wsrep_ignore_apply_errors=0
+
+[mysqld.4]
+wsrep_provider_options='base_port=@mysqld.4.#galera_port'
+wsrep_ignore_apply_errors=0
diff --git a/mysql-test/suite/galera/t/GCF-360.test b/mysql-test/suite/galera/t/GCF-360.test
new file mode 100644
index 00000000000..f1a511177f6
--- /dev/null
+++ b/mysql-test/suite/galera/t/GCF-360.test
@@ -0,0 +1,65 @@
+#
+# GCF-360 Inconsistency voting: node goes non-prim on DDL that fails everywhere
+#
+# We issue 400 DDLs in total to make this test more stressful#
+#
+
+--source include/galera_cluster.inc
+
+--let $count = 100
+
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+--connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4
+
+--disable_query_log
+--disable_result_log
+while ($count)
+{
+ --connection node_1
+ --send DROP TABLE nonexisting_table;
+
+ --connection node_2
+ --send DROP TABLE nonexisting_table;
+
+ --connection node_3
+ --send DROP TABLE nonexisting_table;
+
+ --connection node_4
+ --send DROP TABLE nonexisting_table;
+
+ --connection node_1
+ --error ER_BAD_TABLE_ERROR
+ --reap
+
+ --connection node_2
+ --error ER_BAD_TABLE_ERROR
+ --reap
+
+ --connection node_3
+ --error ER_BAD_TABLE_ERROR
+ --reap
+
+ --connection node_4
+ --error ER_BAD_TABLE_ERROR
+ --reap
+
+ --dec $count
+}
+--enable_result_log
+--enable_query_log
+
+--connection node_1
+SELECT VARIABLE_VALUE AS expect_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+CALL mtr.add_suppression("Slave SQL: Error 'Unknown table");
+
+--connection node_2
+SELECT VARIABLE_VALUE AS expect_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+CALL mtr.add_suppression("Slave SQL: Error 'Unknown table");
+
+--connection node_3
+SELECT VARIABLE_VALUE AS expect_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+CALL mtr.add_suppression("Slave SQL: Error 'Unknown table");
+
+--connection node_4
+SELECT VARIABLE_VALUE AS expect_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+CALL mtr.add_suppression("Slave SQL: Error 'Unknown table");
diff --git a/mysql-test/suite/galera/t/galera-features#117.cnf b/mysql-test/suite/galera/t/galera-features#117.cnf
new file mode 100644
index 00000000000..8eaed546ad8
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera-features#117.cnf
@@ -0,0 +1,5 @@
+!include ../galera_2nodes.cnf
+
+[mysqld]
+wsrep-ignore-apply-errors=0
+wsrep-sync-wait=0
diff --git a/mysql-test/suite/galera/t/galera-features#117.test b/mysql-test/suite/galera/t/galera-features#117.test
new file mode 100644
index 00000000000..0436b201a09
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera-features#117.test
@@ -0,0 +1,38 @@
+#
+# This test tests voting for DDLs (TOI events)
+#
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--connection node_2
+SET SESSION wsrep_on=OFF;
+CREATE TABLE test.t1 (f2 INTEGER);
+SET SESSION wsrep_on=ON;
+
+--error ER_TABLE_EXISTS_ERROR
+CREATE TABLE test.t1 (f1 INTEGER);
+
+--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
+SHOW CREATE TABLE test.t1;
+SHOW STATUS LIKE 'wsrep_cluster_status';
+DROP TABLE test.t1;
+
+--connection node_2
+SET SESSION wsrep_sync_wait=0;
+--let $wait_condition = SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+SHOW CREATE TABLE test.t1;
+SHOW STATUS LIKE 'wsrep_cluster_status';
+--error ER_UNKNOWN_COM_ERROR
+CREATE TABLE test.t2 (f1 INTEGER);
+SHOW TABLES IN test;
+
+--source include/kill_galera.inc
+--source include/wait_until_disconnected.inc
+--source include/start_mysqld.inc
+
+CALL mtr.add_suppression("Inconsistent by consensus.");
+CALL mtr.add_suppression("WSREP: Failed to execute TOI action");
+CALL mtr.add_suppression("WSREP: TO isolation end failed");
diff --git a/mysql-test/suite/galera/t/galera_gra_log.test b/mysql-test/suite/galera/t/galera_gra_log.test
index 8b5aaaae5bd..aeadafad969 100644
--- a/mysql-test/suite/galera/t/galera_gra_log.test
+++ b/mysql-test/suite/galera/t/galera_gra_log.test
@@ -7,24 +7,35 @@
--connection node_2
--exec rm -rf $MYSQLTEST_VARDIR/mysqld.2/data/GRA_*.log
+let $restore_wsrep_ignore_apply_errors = `SELECT @@GLOBAL.wsrep_ignore_apply_errors`;
+SET GLOBAL wsrep_ignore_apply_errors=0;
# Create applier failure
-
SET SESSION wsrep_on=OFF;
CREATE TABLE t1 (f1 INTEGER);
--connection node_1
CREATE TABLE t1 (f1 INTEGER);
+# node 2 should detect an error and leave the cluster
+--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
--connection node_2
-SET SESSION wsrep_on=ON;
-SELECT COUNT(*) = 0 FROM t1;
+--let $wait_condition = SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
# Make sure the GRA file produced is readable and contains the failure
--replace_regex /SET TIMESTAMP=[0-9]+/SET TIMESTAMP=<TIMESTAMP>/ /pseudo_thread_id=[0-9]+/pseudo_thread_id=<PSEUDO_THREAD_ID>/
--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/mysqld.2/data/GRA_*.log
-CALL mtr.add_suppression("Slave SQL: Error 'Table 't1' already exists' on query");
+# restart and reconnect node_2
+--source include/kill_galera.inc
+--source include/wait_until_disconnected.inc
+--source include/start_mysqld.inc
+--eval SET GLOBAL wsrep_ignore_apply_errors = $restore_wsrep_ignore_apply_errors
DROP TABLE t1;
+
+CALL mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on");
diff --git a/mysql-test/suite/galera/t/galera_load_data.cnf b/mysql-test/suite/galera/t/galera_load_data.cnf
index fd0327e0ecb..5c56c92c571 100644
--- a/mysql-test/suite/galera/t/galera_load_data.cnf
+++ b/mysql-test/suite/galera/t/galera_load_data.cnf
@@ -2,9 +2,8 @@
[mysqld]
secure-file-priv = ""
-innodb_file_format ='Barracuda'
innodb_file_per_table = ON
innodb_stats_persistent=ON
innodb_stats_auto_recalc=ON
innodb_stats_persistent_sample_pages=20
-innodb_stats_sample_pages=8
+innodb_stats_transient_sample_pages=8
diff --git a/mysql-test/suite/galera/t/galera_vote_rejoin_ddl.cnf b/mysql-test/suite/galera/t/galera_vote_rejoin_ddl.cnf
new file mode 100644
index 00000000000..b2cba42c0bd
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_vote_rejoin_ddl.cnf
@@ -0,0 +1,4 @@
+!include ../galera_4nodes.cnf
+
+[mysqld]
+wsrep-ignore-apply-errors=0
diff --git a/mysql-test/suite/galera/t/galera_vote_rejoin_ddl.test b/mysql-test/suite/galera/t/galera_vote_rejoin_ddl.test
new file mode 100644
index 00000000000..ce87c728b8c
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_vote_rejoin_ddl.test
@@ -0,0 +1,83 @@
+#
+# Test the case where a node that dropped prior to an inconsistency vote is
+# able to rejoin via IST after the vote is complete
+#
+
+--source include/galera_cluster.inc
+--source include/big_test.inc
+
+# Isolate node #3
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+--connection node_3
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1';
+
+# Wait for node #3 to leave cluster
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+# Introduce inconsistency on node #4
+--connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4
+--connection node_4
+SET SESSION wsrep_on=OFF;
+CREATE TABLE t1 (f1 INTEGER);
+SET SESSION wsrep_on=ON;
+DROP TABLE t1;
+
+# Wait for node #4 to be voted out
+--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
+# Do some more stuff on the cluster to add to the IST stream
+CREATE TABLE t2 (f1 INTEGER);
+
+# Rejoin node #3
+--connection node_3
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 0';
+--source include/galera_wait_ready.inc
+
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+# Confirm that all is good
+--connection node_3
+SELECT COUNT(*) AS expect_0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+SELECT COUNT(*) AS expect_1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2';
+
+# Rejoin node #4
+--connection node_4
+SET SESSION wsrep_on=OFF;
+--source include/kill_galera.inc
+--sleep 1
+--echo Starting mysqld
+--source include/start_mysqld.inc
+
+--connection node_1
+# Confirm node #4 has rejoined
+--let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+# Confirm that all is good and all nodes have identical data
+SELECT COUNT(*) AS expect_0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+SELECT COUNT(*) AS expect_1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2';
+CALL mtr.add_suppression("Slave SQL: Error 'Unknown table");
+
+--connection node_2
+SELECT COUNT(*) AS expect_0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+SELECT COUNT(*) AS expect_1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2';
+CALL mtr.add_suppression("Slave SQL: Error 'Unknown table");
+
+--connection node_3
+SELECT COUNT(*) AS expect_0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+SELECT COUNT(*) AS expect_1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2';
+
+--connection node_4
+SELECT COUNT(*) AS expect_0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+SELECT COUNT(*) AS expect_1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2';
+CALL mtr.add_suppression("WSREP: Vote 0 \\(success\\) on .* is inconsistent with group. Leaving cluster.");
+
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera/t/galera_vote_rejoin_dml.cnf b/mysql-test/suite/galera/t/galera_vote_rejoin_dml.cnf
new file mode 100644
index 00000000000..af445b25372
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_vote_rejoin_dml.cnf
@@ -0,0 +1,7 @@
+!include ../galera_4nodes.cnf
+
+[mysqld]
+wsrep-ignore-apply-errors=0
+
+[ENV]
+galera_cluster_size=4
diff --git a/mysql-test/suite/galera/t/galera_vote_rejoin_dml.test b/mysql-test/suite/galera/t/galera_vote_rejoin_dml.test
new file mode 100644
index 00000000000..e65c067304e
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_vote_rejoin_dml.test
@@ -0,0 +1,99 @@
+#
+# Test the case where a node that dropped prior to an inconsistency vote is
+# able to rejoin via IST after the vote is complete
+#
+
+--source include/galera_cluster.inc
+--source include/big_test.inc
+
+--let $node_1=node_1
+--let $node_2=node_2
+--let $node_3=node_3
+--let $node_4=node_4
+--source include/auto_increment_offset_save.inc
+
+# Isolate node #3
+--connection node_3
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1';
+
+# Wait for node #3 to leave cluster
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, 'A');
+
+# Introduce inconsistency on node #4
+--connection node_4
+SET SESSION wsrep_on=OFF;
+INSERT INTO t1 VALUES (2, 'B');
+SET SESSION wsrep_on=ON;
+DELETE FROM t1 WHERE f1 = 2;
+
+# Wait for node #4 to be voted out
+--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
+
+# Rejoin node #3
+--connection node_3
+--source include/wsrep_wait_disconnect.inc
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 0';
+--source include/galera_wait_ready.inc
+
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+# Confirm that all is good
+--connection node_3
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'A';
+SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'B';
+
+# Rejoin node #4
+--connection node_4
+SET SESSION wsrep_on=OFF;
+--source include/kill_galera.inc
+--sleep 1
+--echo Starting mysqld
+--source include/start_mysqld.inc
+
+# Confirm node #4 has rejoined
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+# Confirm that all is good and all nodes have identical data
+
+--connection node_1
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'A';
+SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'B';
+CALL mtr.add_suppression("mysqld: Can't find record in 't1'");
+CALL mtr.add_suppression("Slave SQL: Could not execute Delete_rows");
+CALL mtr.add_suppression("WSREP: Event 3 Delete_rows_v1 apply failed: 120, seqno [0-9]*");
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'A';
+SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'B';
+CALL mtr.add_suppression("mysqld: Can't find record in 't1'");
+CALL mtr.add_suppression("Slave SQL: Could not execute Delete_rows");
+CALL mtr.add_suppression("WSREP: Event 3 Delete_rows_v1 apply failed: 120, seqno [0-9]*");
+
+--connection node_3
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'A';
+SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'B';
+
+--connection node_4
+--source include/galera_wait_ready.inc
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'A';
+SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'B';
+CALL mtr.add_suppression("inconsistent with group");
+
+DROP TABLE t1;
+
+--source include/auto_increment_offset_restore.inc
diff --git a/mysql-test/suite/galera_3nodes/r/GCF-354.result b/mysql-test/suite/galera_3nodes/r/GCF-354.result
new file mode 100644
index 00000000000..b7ab3014ff5
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/r/GCF-354.result
@@ -0,0 +1,52 @@
+connection node_2;
+connection node_1;
+connection node_2;
+SET wsrep_on=OFF;
+DROP SCHEMA test;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_3;
+SET wsrep_on=OFF;
+CREATE TABLE test.t1 (f1 INTEGER);
+connection node_1;
+CREATE TABLE test.t1 (f1 INTEGER);
+SHOW STATUS LIKE 'wsrep_cluster_status';
+Variable_name Value
+wsrep_cluster_status Primary
+DROP TABLE test.t1;
+connection node_2;
+SET SESSION wsrep_sync_wait=0;
+SHOW STATUS LIKE 'wsrep_cluster_status';
+Variable_name Value
+wsrep_cluster_status Disconnected
+disconnect node_2;
+connect node_2, 127.0.0.1, root, , mysql, $NODE_MYPORT_2;
+Killing server ...
+connection node_2;
+Starting node_2
+# restart
+connection node_3;
+SET SESSION wsrep_sync_wait=0;
+SHOW STATUS LIKE 'wsrep_cluster_status';
+Variable_name Value
+wsrep_cluster_status Disconnected
+disconnect node_3;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+Killing server ...
+connection node_3;
+Starting node_3
+# restart
+connection node_1;
+Nodes 2 and 3 started
+connection node_2;
+USE test;
+Node 2 synced
+CALL mtr.add_suppression("Slave SQL: Error 'Unknown database 'test'' on query. Default database: 'test'. Query: 'CREATE TABLE test.t1 \\\(f1 INTEGER\\\)', Error_code: 1049");
+CALL mtr.add_suppression("Query apply failed");
+CALL mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on .*");
+CALL mtr.add_suppression("Plugin 'InnoDB' will be forced to shutdown");
+connection node_3;
+Node 3 synced
+CALL mtr.add_suppression("Slave SQL: Error 'Table 't1' already exists' on query. Default database: 'test'. Query: 'CREATE TABLE test.t1 \\\(f1 INTEGER\\\)', Error_code: 1050");
+CALL mtr.add_suppression("Query apply failed");
+CALL mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on .*");
+CALL mtr.add_suppression("Plugin 'InnoDB' will be forced to shutdown");
diff --git a/mysql-test/suite/galera_3nodes/r/GCF-363.result b/mysql-test/suite/galera_3nodes/r/GCF-363.result
new file mode 100644
index 00000000000..afab5012ee5
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/r/GCF-363.result
@@ -0,0 +1,46 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)) ENGINE=InnoDB;
+connection node_1;
+SET GLOBAL wsrep_on=OFF;
+INSERT INTO t1 VALUES (1, 'a');
+SET GLOBAL wsrep_on=ON;
+connection node_2;
+SET GLOBAL wsrep_on=OFF;
+INSERT INTO t1 VALUES (1, 'a');
+SET GLOBAL wsrep_on=ON;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_3;
+INSERT INTO t1 VALUES (1, 'b');
+SET SESSION wsrep_sync_wait = 0;
+SHOW STATUS LIKE 'wsrep_cluster_status';
+Variable_name Value
+wsrep_cluster_status Disconnected
+connection node_1;
+connection node_3;
+SET SESSION wsrep_on=OFF;
+# restart
+SET SESSION wsrep_on=ON;
+connection node_1;
+SELECT * FROM t1;
+f1 f2
+1 a
+connection node_2;
+SELECT * FROM t1;
+f1 f2
+1 a
+connection node_3;
+SELECT * FROM t1;
+f1 f2
+1 a
+DROP TABLE t1;
+connection node_1;
+CALL mtr.add_suppression("Slave SQL: Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log FIRST, end_log_pos 155, Error_code: 1062");
+CALL mtr.add_suppression("WSREP: Event 3 Write_rows_v1 apply failed: 121, seqno ");
+connection node_2;
+CALL mtr.add_suppression("Slave SQL: Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log FIRST, end_log_pos 155, Error_code: 1062");
+CALL mtr.add_suppression("WSREP: Event 3 Write_rows_v1 apply failed: 121, seqno ");
+connection node_3;
+CALL mtr.add_suppression("WSREP: Vote 0 \\\(success\\\) on (.*) is inconsistent with group. Leaving cluster.");
+CALL mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on ");
+CALL mtr.add_suppression("Plugin 'InnoDB' will be forced to shutdown");
diff --git a/mysql-test/suite/galera_3nodes/r/GCF-376.result b/mysql-test/suite/galera_3nodes/r/GCF-376.result
new file mode 100644
index 00000000000..a852d1f2385
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/r/GCF-376.result
@@ -0,0 +1,71 @@
+connection node_2;
+connection node_1;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_3;
+CREATE TABLE test.t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)) ENGINE=InnoDB;
+connection node_2;
+SET GLOBAL wsrep_on=OFF;
+INSERT INTO t1 VALUES (1, 'a');
+SET GLOBAL wsrep_on=ON;
+LOCK TABLE t1 WRITE;
+connection node_1;
+INSERT INTO t1 VALUES (1, 'b');
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
+SET SESSION wsrep_sync_wait=0;
+connection node_3;
+connection node_2;
+UNLOCK TABLES;
+SET SESSION wsrep_on = ON;
+SET SESSION wsrep_sync_wait = 15;
+connection node_1;
+SHOW STATUS LIKE 'wsrep_cluster_status';
+Variable_name Value
+wsrep_cluster_status non-Primary
+connection node_2;
+SET SESSION wsrep_sync_wait=0;
+SHOW STATUS LIKE 'wsrep_cluster_status';
+Variable_name Value
+wsrep_cluster_status Disconnected
+SHOW STATUS LIKE 'wsrep_cluster_size';
+Variable_name Value
+wsrep_cluster_size 0
+SET GLOBAL wsrep_on=OFF;
+SELECT * FROM t1;
+f1 f2
+1 a
+connection node_3;
+SET SESSION wsrep_sync_wait=0;
+SHOW STATUS LIKE 'wsrep_cluster_status';
+Variable_name Value
+wsrep_cluster_status Primary
+SHOW STATUS LIKE 'wsrep_cluster_size';
+Variable_name Value
+wsrep_cluster_size 1
+SELECT * FROM t1;
+f1 f2
+1 b
+connection node_1;
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
+connection node_2;
+# restart
+connection node_1;
+SELECT * FROM t1;
+f1 f2
+1 b
+connection node_2;
+SELECT * FROM t1;
+f1 f2
+1 b
+connection node_3;
+SELECT * FROM t1;
+f1 f2
+1 b
+DROP TABLE t1;
+connection node_2;
+CALL mtr.add_suppression("Slave SQL: Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log FIRST, end_log_pos (.*), Error_code: 1062");
+CALL mtr.add_suppression("WSREP: Event (.*) Write_rows_v1 apply failed: 121, seqno ");
+CALL mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on (.*)");
+CALL mtr.add_suppression("Plugin 'InnoDB' will be forced to shutdown");
diff --git a/mysql-test/suite/galera_3nodes/r/galera-features#119.result b/mysql-test/suite/galera_3nodes/r/galera-features#119.result
new file mode 100644
index 00000000000..7796064d563
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/r/galera-features#119.result
@@ -0,0 +1,33 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_3;
+CREATE TABLE test.t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+connection node_2;
+SET wsrep_on=OFF;
+INSERT INTO t1 VALUES (1);
+LOCK TABLE t1 WRITE;
+SET GLOBAL wsrep_sync_wait=0;
+connection node_1;
+INSERT INTO t1 VALUES (1);
+SET GLOBAL wsrep_sync_wait=0;
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
+connection node_3;
+connection node_2;
+UNLOCK TABLES;
+connection node_3;
+connection node_1;
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
+SET GLOBAL wsrep_sync_wait=15;
+DROP TABLE test.t1;
+connection node_2;
+Killing server ...
+# restart
+connection node_2;
+CALL mtr.add_suppression("Inconsistent by consensus.");
+CALL mtr.add_suppression("Slave SQL: Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log FIRST");
+CALL mtr.add_suppression("WSREP: Event 3 Write_rows_v1 apply failed: 121, seqno");
+CALL mtr.add_suppression("WSREP: Failed to apply trx: source: ");
+CALL mtr.add_suppression("WSREP: Failed to apply app buffer: seqno:");
+CALL mtr.add_suppression("WSREP: Node consistency compromized, leaving cluster...");
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
index b1332a5f87c..1910106c646 100644
--- a/mysql-test/suite/galera_3nodes/r/galera_evs_suspect_timeout.result
+++ b/mysql-test/suite/galera_3nodes/r/galera_evs_suspect_timeout.result
@@ -8,6 +8,7 @@ SET GLOBAL wsrep_provider_options = 'evs.inactive_timeout=PT100M; evs.suspect_ti
connection node_2;
SET GLOBAL wsrep_provider_options = 'evs.inactive_timeout=PT100M; evs.suspect_timeout=PT1S';
connection node_3;
+connection node_3;
Suspending node ...
connection node_1;
SET SESSION wsrep_sync_wait=0;
diff --git a/mysql-test/suite/galera_3nodes/r/galera_pc_weight.result b/mysql-test/suite/galera_3nodes/r/galera_pc_weight.result
index 3ae983f9550..858f2297f91 100644
--- a/mysql-test/suite/galera_3nodes/r/galera_pc_weight.result
+++ b/mysql-test/suite/galera_3nodes/r/galera_pc_weight.result
@@ -5,9 +5,9 @@ SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_N
VARIABLE_VALUE = 3
1
SET GLOBAL wsrep_provider_options = 'pc.weight=3';
-SELECT VARIABLE_VALUE = 5 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight';
-VARIABLE_VALUE = 5
-1
+SELECT VARIABLE_VALUE AS expect_5 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight';
+expect_5
+5
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
connection node_2;
SET SESSION wsrep_sync_wait=0;
@@ -60,106 +60,104 @@ SHOW STATUS LIKE 'wsrep_local_state_comment';
Variable_name Value
wsrep_local_state_comment Initialized
connection node_1;
-SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight';
-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 AS expect_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight';
+expect_3
+3
+SELECT VARIABLE_VALUE AS expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+expect_Primary
+Primary
+SELECT VARIABLE_VALUE AS expect_ON FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected';
+expect_ON
+ON
+SELECT VARIABLE_VALUE AS expect_ON FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+expect_ON
+ON
+SELECT VARIABLE_VALUE AS expect_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state';
+expect_4
+4
+SELECT VARIABLE_VALUE AS expect_Synced FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+expect_Synced
+Synced
SET GLOBAL wsrep_provider_options = 'pc.weight=1';
-SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight';
-VARIABLE_VALUE = 1
+SELECT VARIABLE_VALUE AS expect_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight';
+expect_1
1
connection node_1;
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
connection node_2;
connection node_3;
-connection node_1;
-SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
-VARIABLE_VALUE = 3
-1
-SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight';
-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 AS expect_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+expect_3
+3
+SELECT VARIABLE_VALUE AS expect_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight';
+expect_3
+3
+SELECT VARIABLE_VALUE AS expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+expect_Primary
+Primary
+SELECT VARIABLE_VALUE AS expect_ON FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected';
+expect_ON
+ON
+SELECT VARIABLE_VALUE AS expect_ON FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+expect_ON
+ON
+SELECT VARIABLE_VALUE AS expect_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state';
+expect_4
+4
+SELECT VARIABLE_VALUE AS expect_Synced FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+expect_Synced
+Synced
connection node_2;
-SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
-VARIABLE_VALUE = 3
-1
-SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight';
-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
-connection node_3;
-SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
-VARIABLE_VALUE = 3
-1
-SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight';
-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 AS expect_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+expect_3
+3
+SELECT VARIABLE_VALUE AS expect_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight';
+expect_3
+3
+SELECT VARIABLE_VALUE AS expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+expect_Primary
+Primary
+SELECT VARIABLE_VALUE AS expect_ON FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected';
+expect_ON
+ON
+SELECT VARIABLE_VALUE AS expect_ON FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+expect_ON
+ON
+SELECT VARIABLE_VALUE AS expect_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state';
+expect_4
+4
+SELECT VARIABLE_VALUE AS expect_Synced FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+expect_Synced
+Synced
connection node_1;
+SELECT VARIABLE_VALUE AS expect_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+expect_3
+3
+SELECT VARIABLE_VALUE AS expect_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight';
+expect_3
+3
+SELECT VARIABLE_VALUE AS expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+expect_Primary
+Primary
+SELECT VARIABLE_VALUE AS expect_ON FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected';
+expect_ON
+ON
+SELECT VARIABLE_VALUE AS expect_ON FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+expect_ON
+ON
+SELECT VARIABLE_VALUE AS expect_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state';
+expect_4
+4
+SELECT VARIABLE_VALUE AS expect_Synced FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+expect_Synced
+Synced
SET GLOBAL wsrep_provider_options = 'pc.weight=1';
CALL mtr.add_suppression('WSREP: gcs_caused\\(\\) returned -1');
connection node_2;
-CALL mtr.add_suppression('overriding reported weight for');
CALL mtr.add_suppression('SYNC message from member');
CALL mtr.add_suppression('user message in state LEAVING');
CALL mtr.add_suppression('sending install message failed: (Transport endpoint is not connected|Socket is not connected)');
+CALL mtr.add_suppression('overriding reported weight for');
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|Socket is not connected)');
diff --git a/mysql-test/suite/galera_3nodes/r/galera_toi_vote.result b/mysql-test/suite/galera_3nodes/r/galera_toi_vote.result
new file mode 100644
index 00000000000..13caead79d3
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/r/galera_toi_vote.result
@@ -0,0 +1,22 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_3;
+connection node_3;
+SET SESSION wsrep_on=OFF;
+DROP SCHEMA test;
+connection node_1;
+CREATE SCHEMA test;
+ERROR HY000: Can't create database 'test'; database exists
+connection node_1;
+SET SESSION wsrep_sync_wait=0;
+connection node_2;
+SET SESSION wsrep_sync_wait=0;
+connection node_3;
+SET SESSION wsrep_sync_wait=0;
+disconnect node_3;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+Killing server ...
+# restart
+CALL mtr.add_suppression("WSREP: Vote 0 \\\(success\\\) on (.*) is inconsistent with group. Leaving cluster.");
diff --git a/mysql-test/suite/galera_3nodes/r/galera_vote_rejoin_mysqldump.result b/mysql-test/suite/galera_3nodes/r/galera_vote_rejoin_mysqldump.result
new file mode 100644
index 00000000000..d43f31d4c87
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/r/galera_vote_rejoin_mysqldump.result
@@ -0,0 +1,83 @@
+connection node_2;
+connection node_1;
+Setting SST method to mysqldump ...
+call mtr.add_suppression("WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to '127.0.0.1'");
+call mtr.add_suppression("Failed to load slave replication state from table mysql.gtid_slave_pos");
+connection node_1;
+CREATE USER 'sst';
+GRANT ALL PRIVILEGES ON *.* TO 'sst';
+SET GLOBAL wsrep_sst_auth = 'sst:';
+connection node_2;
+SET GLOBAL wsrep_sst_method = 'mysqldump';
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_1;
+connection node_2;
+connection node_3;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+connection node_2;
+SET SESSION wsrep_on=OFF;
+ALTER TABLE t1 ADD PRIMARY KEY (f1);
+SET SESSION wsrep_on=ON;
+connection node_1;
+ALTER TABLE t1 LOCK=SHARED, DROP PRIMARY KEY;
+ERROR 42000: Can't DROP INDEX `PRIMARY`; check that it exists
+connection node_1;
+SELECT VARIABLE_VALUE AS expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+expect_Primary
+Primary
+connection node_3;
+SELECT VARIABLE_VALUE AS expect_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+expect_2
+2
+SELECT VARIABLE_VALUE AS expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+expect_Primary
+Primary
+connection node_2;
+SET SESSION wsrep_on=OFF;
+SELECT VARIABLE_VALUE AS expect_Disconnected FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+expect_Disconnected
+Disconnected
+SET SESSION wsrep_on=ON;
+SELECT VARIABLE_VALUE AS expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+expect_Primary
+Primary
+connection node_1;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+connection node_2;
+SET SESSION wsrep_on=OFF;
+SET SESSION wsrep_on=ON;
+# restart
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SELECT COUNT(*) AS expect_0 FROM t1;
+expect_0
+0
+CALL mtr.add_suppression("is inconsistent with group");
+connection node_3;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'PRIMARY'; check that column/key exists'");
+connection node_1;
+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");
+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("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");
+CALL mtr.add_suppression("Table \'mysql.gtid_slave_pos\' doesn\'t exist");
diff --git a/mysql-test/suite/galera_3nodes/r/inconsistency_shutdown.result b/mysql-test/suite/galera_3nodes/r/inconsistency_shutdown.result
new file mode 100644
index 00000000000..4b668d89d91
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/r/inconsistency_shutdown.result
@@ -0,0 +1,140 @@
+connection node_3;
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_3;
+connection node_2;
+SELECT @@wsrep_slave_threads = 8;
+@@wsrep_slave_threads = 8
+1
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INT);
+INSERT INTO t1 VALUES (1, 0),(2, 0),(3, 0),(4, 0),(5, 0),(6, 0),(7, 0),(8, 0);
+connection node_2;
+SET GLOBAL wsrep_provider_options='gcs.fc_limit=1K';
+SET wsrep_on=OFF;
+DELETE FROM t1 WHERE f1 = 2;
+DELETE FROM t1 WHERE f1 = 4;
+SET wsrep_on=ON;
+LOCK TABLES t1 WRITE;
+connection node_1;
+UPDATE t1 SET f2 = 1 WHERE f1 = 1;
+UPDATE t1 SET f2 = 1 WHERE f1 = 2;
+UPDATE t1 SET f2 = 1 WHERE f1 = 3;
+UPDATE t1 SET f2 = 1 WHERE f1 = 4;
+UPDATE t1 SET f2 = 2 WHERE f1 = 4;
+/* dependent applier */
+UPDATE t1 SET f2 = 3 WHERE f1 = 4;
+/* dependent applier */
+UPDATE t1 SET f2 = 1 WHERE f1 = 5;
+UPDATE t1 SET f2 = 1 WHERE f1 = 6;
+UPDATE t1 SET f2 = 1 WHERE f1 = 7;
+UPDATE t1 SET f2 = 1 WHERE f1 = 8;
+connection node_2;
+SET wsrep_on=OFF;
+SET wsrep_on=ON;
+UNLOCK TABLES;
+SET SESSION wsrep_on = ON;
+SET SESSION wsrep_sync_wait = 15;
+SET SESSION wsrep_on = ON;
+SET SESSION wsrep_sync_wait = 15;
+connection node_1;
+SET SESSION wsrep_on = ON;
+SET SESSION wsrep_sync_wait = 15;
+SHOW STATUS LIKE 'wsrep_cluster_size';
+Variable_name Value
+wsrep_cluster_size 2
+SELECT * FROM t1;
+f1 f2
+1 1
+2 1
+3 1
+4 3
+5 1
+6 1
+7 1
+8 1
+connection node_2;
+SET GLOBAL wsrep_on=OFF;
+# restart
+DROP TABLE t1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INT);
+START TRANSACTION;
+INSERT INTO t1 VALUES (1, 0);
+INSERT INTO t1 VALUES (2, 0);
+INSERT INTO t1 VALUES (3, 0);
+INSERT INTO t1 VALUES (4, 0);
+INSERT INTO t1 VALUES (5, 0);
+INSERT INTO t1 VALUES (6, 0);
+INSERT INTO t1 VALUES (7, 0);
+INSERT INTO t1 VALUES (8, 0);
+COMMIT;
+CREATE TABLE t2 (f1 INTEGER PRIMARY KEY, f2 INT);
+connection node_2;
+SET GLOBAL wsrep_provider_options='gcs.fc_limit=1K';
+SET wsrep_on=OFF;
+DROP TABLE t2;
+SET wsrep_on=ON;
+SET GLOBAL wsrep_provider_options = 'dbug=d,after_replicate_sync';
+LOCK TABLES t1 READ;
+connection node_1;
+UPDATE t1 SET f2 = 1 WHERE f1 = 1;
+UPDATE t1 SET f2 = 1 WHERE f1 = 2;
+UPDATE t1 SET f2 = 1 WHERE f1 = 3;
+UPDATE t1 SET f2 = 1 WHERE f1 = 4;
+UPDATE t1 SET f2 = 2 WHERE f1 = 4;
+/* dependent applier */;
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2a;
+DROP TABLE t2;;
+connection node_2;
+SET wsrep_on=OFF;
+"Wait for DROP TABLE to replicate"
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 0;
+SET GLOBAL wsrep_provider_options = 'signal=after_replicate_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+"DROP TABLE replicated"
+SET wsrep_on=ON;
+connection node_1;
+UPDATE t1 SET f2 = 3 WHERE f1 = 4;
+/* dependent applier */
+UPDATE t1 SET f2 = 1 WHERE f1 = 5;
+UPDATE t1 SET f2 = 1 WHERE f1 = 6;
+UPDATE t1 SET f2 = 1 WHERE f1 = 7;
+UPDATE t1 SET f2 = 1 WHERE f1 = 8;
+connection node_2;
+SET wsrep_on=OFF;
+SET wsrep_on=ON;
+UNLOCK TABLES;
+connection node_2a;
+ERROR 42S02: Unknown table 'test.t2'
+connection node_1;
+SET SESSION wsrep_on = ON;
+SET SESSION wsrep_sync_wait = 15;
+SHOW STATUS LIKE 'wsrep_cluster_size';
+Variable_name Value
+wsrep_cluster_size 2
+SELECT * FROM t1;
+f1 f2
+1 1
+2 1
+3 1
+4 3
+5 1
+6 1
+7 1
+8 1
+connection node_2;
+SET SESSION wsrep_on = ON;
+SET SESSION wsrep_sync_wait = 15;
+SET SESSION wsrep_on = ON;
+SET SESSION wsrep_sync_wait = 15;
+SET GLOBAL wsrep_on=OFF;
+# restart
+DROP TABLE t1;
+CALL mtr.add_suppression('mysqld: Can\'t find record in \'t1\'');
+CALL mtr.add_suppression('Update_rows_v1 apply failed');
+CALL mtr.add_suppression('Inconsistency detected: Inconsistent by consensus on');
diff --git a/mysql-test/suite/galera_3nodes/t/GCF-354.cnf b/mysql-test/suite/galera_3nodes/t/GCF-354.cnf
new file mode 100644
index 00000000000..252b4b613c7
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/t/GCF-354.cnf
@@ -0,0 +1,5 @@
+!include ../galera_3nodes.cnf
+
+[mysqld]
+wsrep-ignore-apply-errors=0
+wsrep_sync_wait=0 \ No newline at end of file
diff --git a/mysql-test/suite/galera_3nodes/t/GCF-354.test b/mysql-test/suite/galera_3nodes/t/GCF-354.test
new file mode 100644
index 00000000000..f48d9fbc72a
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/t/GCF-354.test
@@ -0,0 +1,92 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+#
+# 1. Create different inconsistencies on nodes 2 and 3
+#
+--connection node_2
+SET wsrep_on=OFF;
+DROP SCHEMA test;
+
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+--connection node_3
+SET wsrep_on=OFF;
+CREATE TABLE test.t1 (f1 INTEGER);
+#
+# 2. The following should generate different errors on nodes 2 and 3 and
+# trigger voting with 3 different votes. node_1 should remain alone
+# in the cluster.
+#
+--connection node_1
+CREATE TABLE test.t1 (f1 INTEGER);
+
+--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'
+--source include/wait_condition.inc
+SHOW STATUS LIKE 'wsrep_cluster_status';
+
+# Test cleanup
+DROP TABLE test.t1;
+#
+# 3. Wait for nodes 2 and 3 to drop out of the cluster and restart them to
+# recover the initial configuration.
+#
+--connection node_2
+SET SESSION wsrep_sync_wait=0;
+--let $wait_condition = SELECT VARIABLE_VALUE = 'OFF' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'
+--source include/wait_condition.inc
+SHOW STATUS LIKE 'wsrep_cluster_status';
+
+# need to reinitialize connection due to a "Bad handshake" bug
+--disconnect node_2
+--connect node_2, 127.0.0.1, root, , mysql, $NODE_MYPORT_2
+
+--source include/kill_galera.inc
+
+--connection node_2
+--source include/wait_until_disconnected.inc
+--echo Starting node_2
+--source include/start_mysqld.inc
+
+--connection node_3
+SET SESSION wsrep_sync_wait=0;
+--let $wait_condition = SELECT VARIABLE_VALUE = 'OFF' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'
+--source include/wait_condition.inc
+SHOW STATUS LIKE 'wsrep_cluster_status';
+
+# need to reinitialize connection due to a "Bad handshake" bug
+--disconnect node_3
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+
+--source include/kill_galera.inc
+
+--connection node_3
+--source include/wait_until_disconnected.inc
+--echo Starting node_3
+--source include/start_mysqld.inc
+
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+--echo Nodes 2 and 3 started
+
+--connection node_2
+# fix the default schema
+USE test;
+--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'
+--source include/wait_condition.inc
+--echo Node 2 synced
+CALL mtr.add_suppression("Slave SQL: Error 'Unknown database 'test'' on query. Default database: 'test'. Query: 'CREATE TABLE test.t1 \\\(f1 INTEGER\\\)', Error_code: 1049");
+CALL mtr.add_suppression("Query apply failed");
+CALL mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on .*");
+CALL mtr.add_suppression("Plugin 'InnoDB' will be forced to shutdown");
+
+--connection node_3
+--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'
+--source include/wait_condition.inc
+--echo Node 3 synced
+CALL mtr.add_suppression("Slave SQL: Error 'Table 't1' already exists' on query. Default database: 'test'. Query: 'CREATE TABLE test.t1 \\\(f1 INTEGER\\\)', Error_code: 1050");
+CALL mtr.add_suppression("Query apply failed");
+CALL mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on .*");
+CALL mtr.add_suppression("Plugin 'InnoDB' will be forced to shutdown");
+
diff --git a/mysql-test/suite/galera_3nodes/t/GCF-363.cnf b/mysql-test/suite/galera_3nodes/t/GCF-363.cnf
new file mode 100644
index 00000000000..7b7770e3ad1
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/t/GCF-363.cnf
@@ -0,0 +1,8 @@
+!include ../galera_3nodes.cnf
+
+[mysqld]
+wsrep-ignore-apply-errors=0
+
+# [mysqld.3]
+# wsrep-sst-method=mysqldump
+# wsrep_sst_receive_address=127.0.0.2:@mysqld.3.port
diff --git a/mysql-test/suite/galera_3nodes/t/GCF-363.test b/mysql-test/suite/galera_3nodes/t/GCF-363.test
new file mode 100644
index 00000000000..c8ddea435a7
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/t/GCF-363.test
@@ -0,0 +1,63 @@
+#
+# GCF-363 Inconsistency voting: If in a 3-node cluster the nodes with applier
+# error survive, the other node can not join properly
+#
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)) ENGINE=InnoDB;
+
+--connection node_1
+SET GLOBAL wsrep_on=OFF;
+INSERT INTO t1 VALUES (1, 'a');
+SET GLOBAL wsrep_on=ON;
+
+--connection node_2
+SET GLOBAL wsrep_on=OFF;
+INSERT INTO t1 VALUES (1, 'a');
+SET GLOBAL wsrep_on=ON;
+
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+--connection node_3
+INSERT INTO t1 VALUES (1, 'b');
+SET SESSION wsrep_sync_wait = 0;
+--let $wait_condition = SELECT VARIABLE_VALUE = 'OFF' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'
+--source include/wait_condition.inc
+SHOW STATUS LIKE 'wsrep_cluster_status';
+
+--connection node_1
+# Wait until node #3 leaves the cluster
+--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_3
+SET SESSION wsrep_on=OFF;
+--source include/restart_mysqld.inc
+--source include/wait_until_connected_again.inc
+SET SESSION wsrep_on=ON;
+
+--connection node_1
+SELECT * FROM t1;
+
+--connection node_2
+SELECT * FROM t1;
+
+--connection node_3
+SELECT * FROM t1;
+
+DROP TABLE t1;
+
+--connection node_1
+CALL mtr.add_suppression("Slave SQL: Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log FIRST, end_log_pos 155, Error_code: 1062");
+CALL mtr.add_suppression("WSREP: Event 3 Write_rows_v1 apply failed: 121, seqno ");
+
+--connection node_2
+CALL mtr.add_suppression("Slave SQL: Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log FIRST, end_log_pos 155, Error_code: 1062");
+CALL mtr.add_suppression("WSREP: Event 3 Write_rows_v1 apply failed: 121, seqno ");
+
+--connection node_3
+CALL mtr.add_suppression("WSREP: Vote 0 \\\(success\\\) on (.*) is inconsistent with group. Leaving cluster.");
+CALL mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on ");
+CALL mtr.add_suppression("Plugin 'InnoDB' will be forced to shutdown");
+
+
diff --git a/mysql-test/suite/galera_3nodes/t/GCF-376.cnf b/mysql-test/suite/galera_3nodes/t/GCF-376.cnf
new file mode 100644
index 00000000000..e255e1d527e
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/t/GCF-376.cnf
@@ -0,0 +1,4 @@
+!include ../galera_3nodes.cnf
+
+[mysqld]
+wsrep-ignore-apply-errors=0
diff --git a/mysql-test/suite/galera_3nodes/t/GCF-376.test b/mysql-test/suite/galera_3nodes/t/GCF-376.test
new file mode 100644
index 00000000000..7a5c5251910
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/t/GCF-376.test
@@ -0,0 +1,94 @@
+#
+# GCF-376: slaves become inconsistent if master goes non-prim during
+# inconsistency voting
+#
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+--connection node_1
+
+# Save original auto_increment_offset values.
+--let $node_1=node_1
+--let $node_2=node_2
+--let $node_3=node_3
+--source ../galera/include/auto_increment_offset_save.inc
+
+CREATE TABLE test.t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)) ENGINE=InnoDB;
+
+--connection node_2
+SET GLOBAL wsrep_on=OFF;
+INSERT INTO t1 VALUES (1, 'a');
+SET GLOBAL wsrep_on=ON;
+
+LOCK TABLE t1 WRITE;
+
+--connection node_1
+INSERT INTO t1 VALUES (1, 'b');
+
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
+SET SESSION wsrep_sync_wait=0;
+
+# Wait until node #1 leaves the cluster
+--connection node_3
+--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_2
+UNLOCK TABLES;
+
+# Wait until node #2 leaves the cluster
+--source include/wsrep_wait_disconnect.inc
+
+--connection node_1
+SHOW STATUS LIKE 'wsrep_cluster_status';
+
+--connection node_2
+SET SESSION wsrep_sync_wait=0;
+SHOW STATUS LIKE 'wsrep_cluster_status';
+SHOW STATUS LIKE 'wsrep_cluster_size';
+SET GLOBAL wsrep_on=OFF;
+SELECT * FROM t1;
+
+--connection node_3
+SET SESSION wsrep_sync_wait=0;
+--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+SHOW STATUS LIKE 'wsrep_cluster_status';
+SHOW STATUS LIKE 'wsrep_cluster_size';
+SELECT * FROM t1;
+
+# reconnect node #1
+--connection node_1
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
+
+# reconnect node #2
+--connection node_2
+--source include/restart_mysqld.inc
+--source include/wait_until_connected_again.inc
+
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+SELECT * FROM t1;
+
+--connection node_2
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+SELECT * FROM t1;
+
+--connection node_3
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+SELECT * FROM t1;
+
+DROP TABLE t1;
+
+# Restore original auto_increment_offset values.
+--source ../galera/include/auto_increment_offset_restore.inc
+
+--connection node_2
+CALL mtr.add_suppression("Slave SQL: Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log FIRST, end_log_pos (.*), Error_code: 1062");
+CALL mtr.add_suppression("WSREP: Event (.*) Write_rows_v1 apply failed: 121, seqno ");
+CALL mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on (.*)");
+CALL mtr.add_suppression("Plugin 'InnoDB' will be forced to shutdown");
diff --git a/mysql-test/suite/galera_3nodes/t/galera-features#119.test b/mysql-test/suite/galera_3nodes/t/galera-features#119.test
new file mode 100644
index 00000000000..95dfec23932
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/t/galera-features#119.test
@@ -0,0 +1,72 @@
+#
+# This test tests voting (successful slave wins) in the absence of the master
+# for trasaction.
+#
+--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.
+--let $node_1=node_1
+--let $node_2=node_2
+--let $node_3=node_3
+--source ../galera/include/auto_increment_offset_save.inc
+
+CREATE TABLE test.t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+
+--connection node_2
+--let $wsrep_provider_orig = `SELECT @@wsrep_provider`
+--let $wsrep_cluster_address_orig = `SELECT @@wsrep_cluster_address`
+SET wsrep_on=OFF;
+INSERT INTO t1 VALUES (1);
+LOCK TABLE t1 WRITE;
+SET GLOBAL wsrep_sync_wait=0;
+
+--connection node_1
+INSERT INTO t1 VALUES (1);
+SET GLOBAL wsrep_sync_wait=0;
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
+
+--connection node_3
+# wait for node_1 to disappear
+--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_2
+UNLOCK TABLES;
+# wait to go non-Primary due to inconsistency voting
+#--let $wait_condition = SELECT VARIABLE_VALUE = 'non-Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+#--source include/wait_condition.inc
+# Somehow the above times out so we use connectin to node 3
+
+--connection node_3
+# wait for node_1 to disappear
+--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+--connection node_1
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
+--source include/galera_wait_ready.inc
+SET GLOBAL wsrep_sync_wait=15;
+DROP TABLE test.t1;
+
+# reconnect node 2, since it is now inconsistent
+--connection node_2
+--source include/kill_galera.inc
+--source include/wait_until_disconnected.inc
+--source include/start_mysqld.inc
+
+--connection node_2
+CALL mtr.add_suppression("Inconsistent by consensus.");
+CALL mtr.add_suppression("Slave SQL: Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log FIRST");
+CALL mtr.add_suppression("WSREP: Event 3 Write_rows_v1 apply failed: 121, seqno");
+CALL mtr.add_suppression("WSREP: Failed to apply trx: source: ");
+CALL mtr.add_suppression("WSREP: Failed to apply app buffer: seqno:");
+CALL mtr.add_suppression("WSREP: Node consistency compromized, leaving cluster...");
+
+# Restore original auto_increment_offset values.
+--source ../galera/include/auto_increment_offset_restore.inc
+
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
index 3f1140b175d..ee75aa085e6 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.test
@@ -26,8 +26,11 @@ SET GLOBAL wsrep_provider_options = 'evs.inactive_timeout=PT100M; evs.suspect_ti
--let $wsrep_provider_options_node2 = `SELECT @@wsrep_provider_options`
SET GLOBAL wsrep_provider_options = 'evs.inactive_timeout=PT100M; evs.suspect_timeout=PT1S';
-# Suspend node #3
+--connection node_3
+--source include/wait_until_connected_again.inc
+--let $wsrep_cluster_address_node3 = `SELECT @@wsrep_cluster_address`
+# Suspend node #3
--connection node_3
--source include/galera_suspend.inc
--sleep 5
diff --git a/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test b/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test
index 729f14a731f..0097d335e36 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test
@@ -10,7 +10,7 @@
--connection node_1
SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight';
SET GLOBAL wsrep_provider_options = 'pc.weight=3';
-SELECT VARIABLE_VALUE = 5 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight';
+SELECT VARIABLE_VALUE AS expect_5 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight';
# Isolate node_1 from the cluster.
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
@@ -62,15 +62,15 @@ SHOW STATUS LIKE 'wsrep_local_state_comment';
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc
-SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight';
-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';
+SELECT VARIABLE_VALUE AS expect_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight';
+SELECT VARIABLE_VALUE AS expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+SELECT VARIABLE_VALUE AS expect_ON FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected';
+SELECT VARIABLE_VALUE AS expect_ON FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+SELECT VARIABLE_VALUE AS expect_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state';
+SELECT VARIABLE_VALUE AS expect_Synced FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
SET GLOBAL wsrep_provider_options = 'pc.weight=1';
-SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight';
+SELECT VARIABLE_VALUE AS expect_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight';
# Resume cluster connectivity on node_1
--connection node_1
@@ -78,44 +78,42 @@ SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc
+--source include/galera_wait_ready.inc
--connection node_2
--source include/wait_condition.inc
+--source include/galera_wait_ready.inc
--connection node_3
--source include/wait_condition.inc
-
---connection node_1
---source include/wait_condition.inc
+--source include/galera_wait_ready.inc
# On all nodes, we now expect a Primary component of size 3, weight 3, Synced and ready
-SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
-SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight';
-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';
+SELECT VARIABLE_VALUE AS expect_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+SELECT VARIABLE_VALUE AS expect_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight';
+SELECT VARIABLE_VALUE AS expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+SELECT VARIABLE_VALUE AS expect_ON FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected';
+SELECT VARIABLE_VALUE AS expect_ON FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+SELECT VARIABLE_VALUE AS expect_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state';
+SELECT VARIABLE_VALUE AS expect_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 = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight';
-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 = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight';
-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';
+SELECT VARIABLE_VALUE AS expect_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+SELECT VARIABLE_VALUE AS expect_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight';
+SELECT VARIABLE_VALUE AS expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+SELECT VARIABLE_VALUE AS expect_ON FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected';
+SELECT VARIABLE_VALUE AS expect_ON FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+SELECT VARIABLE_VALUE AS expect_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state';
+SELECT VARIABLE_VALUE AS expect_Synced FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
--connection node_1
+SELECT VARIABLE_VALUE AS expect_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+SELECT VARIABLE_VALUE AS expect_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight';
+SELECT VARIABLE_VALUE AS expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+SELECT VARIABLE_VALUE AS expect_ON FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected';
+SELECT VARIABLE_VALUE AS expect_ON FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+SELECT VARIABLE_VALUE AS expect_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state';
+SELECT VARIABLE_VALUE AS expect_Synced FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
SET GLOBAL wsrep_provider_options = 'pc.weight=1';
--let $wait_condition = SELECT @@wsrep_provider_options LIKE '%pc.weight = 1%'
@@ -124,10 +122,10 @@ SET GLOBAL wsrep_provider_options = 'pc.weight=1';
CALL mtr.add_suppression('WSREP: gcs_caused\\(\\) returned -1');
--connection node_2
-CALL mtr.add_suppression('overriding reported weight for');
CALL mtr.add_suppression('SYNC message from member');
CALL mtr.add_suppression('user message in state LEAVING');
CALL mtr.add_suppression('sending install message failed: (Transport endpoint is not connected|Socket is not connected)');
+CALL mtr.add_suppression('overriding reported weight for');
--connection node_3
CALL mtr.add_suppression('WSREP: user message in state LEAVING');
diff --git a/mysql-test/suite/galera_3nodes/t/galera_toi_vote.cnf b/mysql-test/suite/galera_3nodes/t/galera_toi_vote.cnf
new file mode 100644
index 00000000000..4c5e4854606
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/t/galera_toi_vote.cnf
@@ -0,0 +1,5 @@
+!include ../galera_3nodes.cnf
+
+[mysqld]
+wsrep-ignore-apply-errors=0
+wsrep_sync_wait=0
diff --git a/mysql-test/suite/galera_3nodes/t/galera_toi_vote.test b/mysql-test/suite/galera_3nodes/t/galera_toi_vote.test
new file mode 100644
index 00000000000..7b5682ed030
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/t/galera_toi_vote.test
@@ -0,0 +1,67 @@
+#
+# This test tests that TOI failure on 2 nodes (master and slave) for the
+# same reason, wins over success on a third slave.
+# In particular this tests that master and slave TOI cast the same vote for
+# the same error
+#
+--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.
+--let $node_1=node_1
+--let $node_2=node_2
+--let $node_3=node_3
+--source ../galera/include/auto_increment_offset_save.inc
+
+# create inconsistency on node 3
+--connection node_3
+SET SESSION wsrep_on=OFF;
+DROP SCHEMA test;
+
+# This should fail on nodes 1 and 2 and succeed on node 3
+--connection node_1
+--error ER_DB_CREATE_EXISTS
+CREATE SCHEMA test;
+
+--connection node_1
+SET SESSION wsrep_sync_wait=0;
+# wait for node 3 to drop from the cluster
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+--source include/wait_condition.inc
+
+--connection node_2
+SET SESSION wsrep_sync_wait=0;
+# wait for node 3 to drop from the cluster
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+--source include/wait_condition.inc
+
+--connection node_3
+SET SESSION wsrep_sync_wait=0;
+--let $wait_condition = SELECT VARIABLE_VALUE = 'Disconnected' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+--source include/wait_condition.inc
+
+# need to reinitialize connection due to a "Bad handshake" bug
+--disconnect node_3
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+
+# reconnect node 3, since it failed
+--source include/kill_galera.inc
+--source include/wait_until_disconnected.inc
+--source include/start_mysqld.inc
+--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+--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
+
+CALL mtr.add_suppression("WSREP: Vote 0 \\\(success\\\) on (.*) is inconsistent with group. Leaving cluster.");
+
+# Restore original auto_increment_offset values.
+--source ../galera/include/auto_increment_offset_restore.inc
diff --git a/mysql-test/suite/galera_3nodes/t/galera_vote_rejoin_mysqldump.cnf b/mysql-test/suite/galera_3nodes/t/galera_vote_rejoin_mysqldump.cnf
new file mode 100644
index 00000000000..e255e1d527e
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/t/galera_vote_rejoin_mysqldump.cnf
@@ -0,0 +1,4 @@
+!include ../galera_3nodes.cnf
+
+[mysqld]
+wsrep-ignore-apply-errors=0
diff --git a/mysql-test/suite/galera_3nodes/t/galera_vote_rejoin_mysqldump.test b/mysql-test/suite/galera_3nodes/t/galera_vote_rejoin_mysqldump.test
new file mode 100644
index 00000000000..70d58cb25f4
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/t/galera_vote_rejoin_mysqldump.test
@@ -0,0 +1,93 @@
+#
+# Test that mysqldump SST is possible after a vote without a cluster restart
+#
+
+--source include/galera_cluster.inc
+--source suite/galera/include/galera_sst_set_mysqldump.inc
+
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+
+# Save original auto_increment_offset values.
+--let $node_1=node_1
+--let $node_2=node_2
+--let $node_3=node_3
+--source ../galera/include/auto_increment_offset_save.inc
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+
+# Introduce inconsistency on node #2
+
+--connection node_2
+--let $wsrep_cluster_address_node2 = `SELECT @@wsrep_cluster_address`
+SET SESSION wsrep_on=OFF;
+ALTER TABLE t1 ADD PRIMARY KEY (f1);
+SET SESSION wsrep_on=ON;
+
+# Run DDL that will fail on nodes #1 and #3 but succeed on node #2
+
+--connection node_1
+--error ER_CANT_DROP_FIELD_OR_KEY
+ALTER TABLE t1 LOCK=SHARED, DROP PRIMARY KEY;
+
+# Nodes #1 and #3 remain in the cluster
+
+--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
+
+SELECT VARIABLE_VALUE AS expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+
+--connection node_3
+SELECT VARIABLE_VALUE AS expect_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+SELECT VARIABLE_VALUE AS expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+
+# Node #2 is kicked out
+
+--connection node_2
+SET SESSION wsrep_on=OFF;
+SELECT VARIABLE_VALUE AS expect_Disconnected FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+SET SESSION wsrep_on=ON;
+
+# Restore cluster
+
+--disable_query_log
+--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_node2'
+--enable_query_log
+--enable_reconnect
+
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+SELECT VARIABLE_VALUE AS expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+
+# Confirm that the table is now identical throughout
+
+--connection node_1
+SHOW CREATE TABLE t1;
+
+--connection node_2
+SET SESSION wsrep_on=OFF;
+--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+--source include/wait_condition.inc
+--source include/galera_wait_ready.inc
+SET SESSION wsrep_on=ON;
+
+# restart node so we don't fail on WSREP_START_POSITION internal check
+--source include/restart_mysqld.inc
+--source include/wait_until_connected_again.inc
+
+SHOW CREATE TABLE t1;
+SELECT COUNT(*) AS expect_0 FROM t1;
+CALL mtr.add_suppression("is inconsistent with group");
+
+--connection node_3
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'PRIMARY'; check that column/key exists'");
+
+--connection node_1
+--source suite/galera/include/galera_sst_restore.inc
+
+# Restore original auto_increment_offset values.
+--source ../galera/include/auto_increment_offset_restore.inc
diff --git a/mysql-test/suite/galera_3nodes/t/inconsistency_shutdown.cnf b/mysql-test/suite/galera_3nodes/t/inconsistency_shutdown.cnf
new file mode 100644
index 00000000000..ae2cf8068f5
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/t/inconsistency_shutdown.cnf
@@ -0,0 +1,9 @@
+!include ../galera_3nodes.cnf
+
+[mysqld]
+wsrep-slave-threads=8
+wsrep-ignore-apply-errors=0
+
+[ENV]
+galera_cluster_size = 3
+
diff --git a/mysql-test/suite/galera_3nodes/t/inconsistency_shutdown.test b/mysql-test/suite/galera_3nodes/t/inconsistency_shutdown.test
new file mode 100644
index 00000000000..ac47ea5ea09
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/t/inconsistency_shutdown.test
@@ -0,0 +1,179 @@
+#
+# Check that the node can cleanly shutdown in case of inconsistency
+# (no locked up threads)
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+# Save original auto_increment_offset values.
+--let $node_1=node_1
+--let $node_2=node_2
+--let $node_3=node_3
+--source ../galera/include/auto_increment_offset_save.inc
+
+--connection node_2
+SELECT @@wsrep_slave_threads = 8;
+
+#
+# 1. Inconsistency on slave
+#
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INT);
+INSERT INTO t1 VALUES (1, 0),(2, 0),(3, 0),(4, 0),(5, 0),(6, 0),(7, 0),(8, 0);
+
+--connection node_2
+# Allow 1K slave queue woithout flow control
+SET GLOBAL wsrep_provider_options='gcs.fc_limit=1K';
+# Introduce 2 inconsistencies
+SET wsrep_on=OFF;
+DELETE FROM t1 WHERE f1 = 2;
+DELETE FROM t1 WHERE f1 = 4;
+SET wsrep_on=ON;
+
+# Build up slave queue:
+# - first 8 events will be picked by slave threads
+# - one moreevent will be waiting in slave queue
+LOCK TABLES t1 WRITE;
+--connection node_1
+UPDATE t1 SET f2 = 1 WHERE f1 = 1;
+UPDATE t1 SET f2 = 1 WHERE f1 = 2;
+UPDATE t1 SET f2 = 1 WHERE f1 = 3;
+UPDATE t1 SET f2 = 1 WHERE f1 = 4;
+UPDATE t1 SET f2 = 2 WHERE f1 = 4; /* dependent applier */
+UPDATE t1 SET f2 = 3 WHERE f1 = 4; /* dependent applier */
+UPDATE t1 SET f2 = 1 WHERE f1 = 5;
+UPDATE t1 SET f2 = 1 WHERE f1 = 6;
+UPDATE t1 SET f2 = 1 WHERE f1 = 7;
+UPDATE t1 SET f2 = 1 WHERE f1 = 8;
+
+--connection node_2
+# make sure all events landed to slave queue
+SET wsrep_on=OFF;
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_recv_queue';
+--source include/wait_condition.inc
+SET wsrep_on=ON;
+UNLOCK TABLES;
+--source include/wsrep_wait_disconnect.inc
+# Wait for the node to shutdown replication
+--let $members=0
+--source include/wsrep_wait_membership.inc
+
+--connection node_1
+--let $members=2
+--source include/wsrep_wait_membership.inc
+--source include/wait_until_ready.inc
+SHOW STATUS LIKE 'wsrep_cluster_size';
+SELECT * FROM t1;
+
+--connection node_2
+#Gracefully restart the node
+SET GLOBAL wsrep_on=OFF;
+--source include/shutdown_mysqld.inc
+--source include/start_mysqld.inc
+--source include/galera_wait_ready.inc
+
+DROP TABLE t1;
+
+#
+# 2. Inconsistency on master
+#
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INT);
+START TRANSACTION;
+INSERT INTO t1 VALUES (1, 0);
+INSERT INTO t1 VALUES (2, 0);
+INSERT INTO t1 VALUES (3, 0);
+INSERT INTO t1 VALUES (4, 0);
+INSERT INTO t1 VALUES (5, 0);
+INSERT INTO t1 VALUES (6, 0);
+INSERT INTO t1 VALUES (7, 0);
+INSERT INTO t1 VALUES (8, 0);
+COMMIT;
+CREATE TABLE t2 (f1 INTEGER PRIMARY KEY, f2 INT);
+
+--connection node_2
+# Allow 1K slave queue without flow control
+SET GLOBAL wsrep_provider_options='gcs.fc_limit=1K';
+# Introduce inconsistency
+SET wsrep_on=OFF;
+DROP TABLE t2;
+SET wsrep_on=ON;
+
+# set up sync point to ensure DROP TABLE replication order below
+--let galera_sync_point = after_replicate_sync
+--source include/galera_set_sync_point.inc
+
+# Build up slave queue:
+# - first 8 events will be picked by slave threads
+# - one more event will be waiting in slave queue
+LOCK TABLES t1 READ;
+
+--connection node_1
+UPDATE t1 SET f2 = 1 WHERE f1 = 1;
+UPDATE t1 SET f2 = 1 WHERE f1 = 2;
+UPDATE t1 SET f2 = 1 WHERE f1 = 3;
+UPDATE t1 SET f2 = 1 WHERE f1 = 4;
+UPDATE t1 SET f2 = 2 WHERE f1 = 4; /* dependent applier */;
+
+# interleave a failing statement
+--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
+--connection node_2a
+--send DROP TABLE t2;
+
+# make sure DROP TABLE from above has replicated
+--connection node_2
+SET wsrep_on=OFF;
+--echo "Wait for DROP TABLE to replicate"
+--source include/galera_wait_sync_point.inc
+--source include/galera_signal_sync_point.inc
+--source include/galera_clear_sync_point.inc
+--echo "DROP TABLE replicated"
+SET wsrep_on=ON;
+
+--connection node_1
+UPDATE t1 SET f2 = 3 WHERE f1 = 4; /* dependent applier */
+UPDATE t1 SET f2 = 1 WHERE f1 = 5;
+UPDATE t1 SET f2 = 1 WHERE f1 = 6;
+UPDATE t1 SET f2 = 1 WHERE f1 = 7;
+UPDATE t1 SET f2 = 1 WHERE f1 = 8;
+
+--connection node_2
+# make sure all events landed to slave queue
+SET wsrep_on=OFF;
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_recv_queue';
+--source include/wait_condition.inc
+SET wsrep_on=ON;
+UNLOCK TABLES;
+
+--connection node_2a
+--error ER_BAD_TABLE_ERROR
+--reap
+
+--connection node_1
+--let $members=2
+--source include/wsrep_wait_membership.inc
+--source include/wait_until_ready.inc
+SHOW STATUS LIKE 'wsrep_cluster_size';
+SELECT * FROM t1;
+
+--connection node_2
+--source include/wsrep_wait_disconnect.inc
+# Wait for the node to shutdown replication
+--let $members=0
+--source include/wsrep_wait_membership.inc
+# Gracefully restart the node
+SET GLOBAL wsrep_on=OFF;
+--source include/shutdown_mysqld.inc
+--source include/start_mysqld.inc
+--source include/galera_wait_ready.inc
+
+DROP TABLE t1;
+
+CALL mtr.add_suppression('mysqld: Can\'t find record in \'t1\'');
+CALL mtr.add_suppression('Update_rows_v1 apply failed');
+CALL mtr.add_suppression('Inconsistency detected: Inconsistent by consensus on');
+CALL mtr.add_suppression('last left .* greater than drain seqno');
+
+# Restore original auto_increment_offset values.
+--source ../galera/include/auto_increment_offset_restore.inc
diff --git a/mysql-test/suite/galera_3nodes_sr/r/galera_vote_sr.result b/mysql-test/suite/galera_3nodes_sr/r/galera_vote_sr.result
new file mode 100644
index 00000000000..55a0757897a
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/r/galera_vote_sr.result
@@ -0,0 +1,195 @@
+connection node_2;
+connection node_1;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_1;
+connection node_2;
+connection node_3;
+Inconsistency on the first fragment
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 BLOB) ENGINE=InnoDB;
+connection node_2;
+SET SESSION wsrep_on=OFF;
+INSERT INTO t1 VALUES (1, 'X');
+SET SESSION wsrep_on=ON;
+DELETE FROM t1 WHERE f1 = 2;
+connection node_1;
+SET AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size = 131070;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1, REPEAT('A', 65535));
+INSERT INTO t1 VALUES (2, REPEAT('A', 65535));
+INSERT INTO t1 VALUES (3, REPEAT('A', 65535));
+INSERT INTO t1 VALUES (4, REPEAT('A', 65535));
+INSERT INTO t1 VALUES (5, REPEAT('A', 65535));
+COMMIT;
+SELECT COUNT(*) AS expect_0 FROM mysql.wsrep_streaming_log;
+expect_0
+0
+START TRANSACTION;
+INSERT INTO t1 VALUES (11, REPEAT('A', 65535));
+INSERT INTO t1 VALUES (12, REPEAT('A', 65535));
+INSERT INTO t1 VALUES (13, REPEAT('A', 65535));
+INSERT INTO t1 VALUES (14, REPEAT('A', 65535));
+INSERT INTO t1 VALUES (15, REPEAT('A', 65535));
+connection node_2;
+SET SESSION wsrep_on=OFF;
+Starting mysqld
+# restart
+connection node_1;
+connection node_2;
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) > 0
+1
+connection node_1;
+COMMIT;
+connection node_1;
+SELECT COUNT(*) AS expect_0 FROM mysql.wsrep_streaming_log;
+expect_0
+0
+SELECT COUNT(*) AS expect_10 FROM t1;
+expect_10
+10
+connection node_2;
+SELECT COUNT(*) AS expect_0 FROM mysql.wsrep_streaming_log;
+expect_0
+0
+SELECT COUNT(*) AS expect_10 FROM t1;
+expect_10
+10
+connection node_3;
+SELECT COUNT(*) AS expect_0 FROM mysql.wsrep_streaming_log;
+expect_0
+0
+SELECT COUNT(*) AS expect_10 FROM t1;
+expect_10
+10
+connection node_1;
+DROP TABLE t1;
+Inconsistency on a middle fragment
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 BLOB) ENGINE=InnoDB;
+connection node_2;
+SET SESSION wsrep_on=OFF;
+INSERT INTO t1 VALUES (3, 'X');
+SET SESSION wsrep_on=ON;
+DELETE FROM t1 WHERE f1 = 2;
+connection node_1;
+SET AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size = 131070;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1, REPEAT('A', 65535));
+INSERT INTO t1 VALUES (2, REPEAT('A', 65535));
+INSERT INTO t1 VALUES (3, REPEAT('A', 65535));
+INSERT INTO t1 VALUES (4, REPEAT('A', 65535));
+INSERT INTO t1 VALUES (5, REPEAT('A', 65535));
+COMMIT;
+SELECT COUNT(*) AS expect_0 FROM mysql.wsrep_streaming_log;
+expect_0
+0
+START TRANSACTION;
+INSERT INTO t1 VALUES (11, REPEAT('A', 65535));
+INSERT INTO t1 VALUES (12, REPEAT('A', 65535));
+INSERT INTO t1 VALUES (13, REPEAT('A', 65535));
+INSERT INTO t1 VALUES (14, REPEAT('A', 65535));
+INSERT INTO t1 VALUES (15, REPEAT('A', 65535));
+connection node_2;
+SET SESSION wsrep_on=OFF;
+Starting mysqld
+# restart
+connection node_1;
+connection node_2;
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) > 0
+1
+connection node_1;
+COMMIT;
+connection node_1;
+SELECT COUNT(*) AS expect_0 FROM mysql.wsrep_streaming_log;
+expect_0
+0
+SELECT COUNT(*) AS expect_10 FROM t1;
+expect_10
+10
+connection node_2;
+SELECT COUNT(*) AS expect_0 FROM mysql.wsrep_streaming_log;
+expect_0
+0
+SELECT COUNT(*) AS expect_10 FROM t1;
+expect_10
+10
+connection node_3;
+SELECT COUNT(*) AS expect_0 FROM mysql.wsrep_streaming_log;
+expect_0
+0
+SELECT COUNT(*) AS expect_10 FROM t1;
+expect_10
+10
+connection node_1;
+DROP TABLE t1;
+Inconsistency on the commit fragment
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 BLOB) ENGINE=InnoDB;
+connection node_2;
+SET SESSION wsrep_on=OFF;
+INSERT INTO t1 VALUES (5, 'X');
+SET SESSION wsrep_on=ON;
+DELETE FROM t1 WHERE f1 = 2;
+connection node_1;
+SET AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size = 131070;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1, REPEAT('A', 65535));
+INSERT INTO t1 VALUES (2, REPEAT('A', 65535));
+INSERT INTO t1 VALUES (3, REPEAT('A', 65535));
+INSERT INTO t1 VALUES (4, REPEAT('A', 65535));
+INSERT INTO t1 VALUES (5, REPEAT('A', 65535));
+COMMIT;
+SELECT COUNT(*) AS expect_0 FROM mysql.wsrep_streaming_log;
+expect_0
+0
+START TRANSACTION;
+INSERT INTO t1 VALUES (11, REPEAT('A', 65535));
+INSERT INTO t1 VALUES (12, REPEAT('A', 65535));
+INSERT INTO t1 VALUES (13, REPEAT('A', 65535));
+INSERT INTO t1 VALUES (14, REPEAT('A', 65535));
+INSERT INTO t1 VALUES (15, REPEAT('A', 65535));
+connection node_2;
+SET SESSION wsrep_on=OFF;
+Starting mysqld
+# restart
+connection node_1;
+connection node_2;
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) > 0
+1
+connection node_1;
+COMMIT;
+connection node_1;
+SELECT COUNT(*) AS expect_0 FROM mysql.wsrep_streaming_log;
+expect_0
+0
+SELECT COUNT(*) AS expect_10 FROM t1;
+expect_10
+10
+connection node_2;
+SELECT COUNT(*) AS expect_0 FROM mysql.wsrep_streaming_log;
+expect_0
+0
+SELECT COUNT(*) AS expect_10 FROM t1;
+expect_10
+10
+connection node_3;
+SELECT COUNT(*) AS expect_0 FROM mysql.wsrep_streaming_log;
+expect_0
+0
+SELECT COUNT(*) AS expect_10 FROM t1;
+expect_10
+10
+connection node_1;
+DROP TABLE t1;
+connection node_2;
+CALL mtr.add_suppression("Slave SQL: Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 'PRIMARY'");
+CALL mtr.add_suppression("Slave SQL: Could not execute Write_rows event on table test.t1; Duplicate entry '3' for key 'PRIMARY'");
+CALL mtr.add_suppression("Slave SQL: Could not execute Write_rows event on table test.t1; Duplicate entry '5' for key 'PRIMARY'");
+CALL mtr.add_suppression("Write_rows_v1 apply failed");
+CALL mtr.add_suppression("Inconsistent by consensus");
diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_vote_sr-master.opt b/mysql-test/suite/galera_3nodes_sr/t/galera_vote_sr-master.opt
new file mode 100644
index 00000000000..196498bb9fa
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/t/galera_vote_sr-master.opt
@@ -0,0 +1,2 @@
+--wsrep-ignore-apply-errors=0
+
diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_vote_sr.inc b/mysql-test/suite/galera_3nodes_sr/t/galera_vote_sr.inc
new file mode 100644
index 00000000000..db6ba458379
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/t/galera_vote_sr.inc
@@ -0,0 +1,79 @@
+#
+# set $inconsistent_fragment to determine at which fragment inconsistency
+# happens
+#
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 BLOB) ENGINE=InnoDB;
+
+# Introduce inconsistency
+--connection node_2
+SET SESSION wsrep_on=OFF;
+--eval INSERT INTO t1 VALUES ($inconsistent_fragment, 'X')
+SET SESSION wsrep_on=ON;
+DELETE FROM t1 WHERE f1 = 2;
+
+# Perform an SR transaction that will hit the inconsistency
+--connection node_1
+SET AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size = 131070;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1, REPEAT('A', 65535));
+INSERT INTO t1 VALUES (2, REPEAT('A', 65535));
+INSERT INTO t1 VALUES (3, REPEAT('A', 65535));
+INSERT INTO t1 VALUES (4, REPEAT('A', 65535));
+INSERT INTO t1 VALUES (5, REPEAT('A', 65535));
+COMMIT;
+SELECT COUNT(*) AS expect_0 FROM mysql.wsrep_streaming_log;
+
+# Perform another SR transaction in order to have stuff in the
+# wsrep_streaming_log table
+START TRANSACTION;
+INSERT INTO t1 VALUES (11, REPEAT('A', 65535));
+INSERT INTO t1 VALUES (12, REPEAT('A', 65535));
+INSERT INTO t1 VALUES (13, REPEAT('A', 65535));
+INSERT INTO t1 VALUES (14, REPEAT('A', 65535));
+INSERT INTO t1 VALUES (15, REPEAT('A', 65535));
+
+# Node #2 has dropped from the cluster due to voting
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+# Bring node #2 back via SST
+--connection node_2
+SET SESSION wsrep_on=OFF;
+--source include/shutdown_mysqld.inc
+--source include/wait_until_disconnected.inc
+--echo Starting mysqld
+--source include/start_mysqld.inc
+
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+--connection node_2
+--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+--source include/wait_condition.inc
+
+# Node #2 should have some entries in its SR table post-restart
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+
+# Commit second SR transaction
+--connection node_1
+COMMIT;
+
+# Confirm that all nodes are identical
+--connection node_1
+SELECT COUNT(*) AS expect_0 FROM mysql.wsrep_streaming_log;
+SELECT COUNT(*) AS expect_10 FROM t1;
+
+--connection node_2
+SELECT COUNT(*) AS expect_0 FROM mysql.wsrep_streaming_log;
+SELECT COUNT(*) AS expect_10 FROM t1;
+
+--connection node_3
+SELECT COUNT(*) AS expect_0 FROM mysql.wsrep_streaming_log;
+SELECT COUNT(*) AS expect_10 FROM t1;
+
+--connection node_1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_vote_sr.test b/mysql-test/suite/galera_3nodes_sr/t/galera_vote_sr.test
new file mode 100644
index 00000000000..de2fe2c019d
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/t/galera_vote_sr.test
@@ -0,0 +1,37 @@
+#
+# Test voting while an SR transaction is in progress
+#
+
+--source include/galera_cluster.inc
+--source include/big_test.inc
+
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+
+# Save original auto_increment_offset values.
+--let $node_1=node_1
+--let $node_2=node_2
+--let $node_3=node_3
+--source ../galera/include/auto_increment_offset_save.inc
+
+--echo Inconsistency on the first fragment
+--let $inconsistent_fragment=1
+--source galera_vote_sr.inc
+
+--echo Inconsistency on a middle fragment
+--let $inconsistent_fragment=3
+--source galera_vote_sr.inc
+
+--echo Inconsistency on the commit fragment
+--let $inconsistent_fragment=5
+--source galera_vote_sr.inc
+
+--connection node_2
+CALL mtr.add_suppression("Slave SQL: Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 'PRIMARY'");
+CALL mtr.add_suppression("Slave SQL: Could not execute Write_rows event on table test.t1; Duplicate entry '3' for key 'PRIMARY'");
+CALL mtr.add_suppression("Slave SQL: Could not execute Write_rows event on table test.t1; Duplicate entry '5' for key 'PRIMARY'");
+CALL mtr.add_suppression("Write_rows_v1 apply failed");
+CALL mtr.add_suppression("Inconsistent by consensus");
+#CALL mtr.add_suppression("no THD for trx");
+
+# Restore original auto_increment_offset values.
+--source ../galera/include/auto_increment_offset_restore.inc
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_mysqldump_sst.test b/mysql-test/suite/galera_sr/t/galera_sr_mysqldump_sst.test
index e660895cde6..50378b2a9bd 100644
--- a/mysql-test/suite/galera_sr/t/galera_sr_mysqldump_sst.test
+++ b/mysql-test/suite/galera_sr/t/galera_sr_mysqldump_sst.test
@@ -10,7 +10,7 @@
# Save original auto_increment_offset values.
--let $node_1=node_1
--let $node_2=node_2
---source suite/galera/include/auto_increment_offset_save.inc
+--source ../../galera/include/auto_increment_offset_save.inc
--connection node_1
CREATE TABLE ten (f1 INTEGER);
@@ -84,4 +84,5 @@ SET SESSION wsrep_trx_fragment_size=0;
--source suite/galera/include/galera_sst_restore.inc
# Restore original auto_increment_offset values.
---source suite/galera/include/auto_increment_offset_restore.inc
+--source ../galera/include/auto_increment_offset_restore.inc
+
diff --git a/mysql-test/suite/gcol/inc/gcol_ins_upd.inc b/mysql-test/suite/gcol/inc/gcol_ins_upd.inc
index 7fde9c2e852..8c00bde7fca 100644
--- a/mysql-test/suite/gcol/inc/gcol_ins_upd.inc
+++ b/mysql-test/suite/gcol/inc/gcol_ins_upd.inc
@@ -487,12 +487,18 @@ DROP TABLE t;
--echo # Bug#21807818: Generated columns not updated with empty insert list
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t (
a BLOB GENERATED ALWAYS AS ('') VIRTUAL,
b TIMESTAMP(4) GENERATED ALWAYS AS ('') VIRTUAL,
KEY (a(183),b)
);
+CREATE TABLE t (
+a BLOB GENERATED ALWAYS AS ('') VIRTUAL,
+b TIMESTAMP(4) GENERATED ALWAYS AS ('') VIRTUAL
+);
+
INSERT IGNORE INTO t VALUES(), (), ();
DELETE IGNORE FROM t;
diff --git a/mysql-test/suite/gcol/r/gcol_bugfixes.result b/mysql-test/suite/gcol/r/gcol_bugfixes.result
index 3d19f718287..3a859116cab 100644
--- a/mysql-test/suite/gcol/r/gcol_bugfixes.result
+++ b/mysql-test/suite/gcol/r/gcol_bugfixes.result
@@ -535,7 +535,6 @@ CREATE TABLE t (a INTEGER) engine=innodb;
ALTER TABLE t ADD b INTEGER AS (SUBSTR('','a',1));
Warnings:
Warning 1292 Truncated incorrect INTEGER value: 'a'
-Warning 1292 Truncated incorrect INTEGER value: 'a'
DROP TABLE t;
set sql_mode= @save_old_sql_mode;
# Bug#21875520 Problems with virtual column indexes
diff --git a/mysql-test/suite/gcol/r/gcol_ins_upd_myisam.result b/mysql-test/suite/gcol/r/gcol_ins_upd_myisam.result
index 210c6450b70..e5f512d5029 100644
--- a/mysql-test/suite/gcol/r/gcol_ins_upd_myisam.result
+++ b/mysql-test/suite/gcol/r/gcol_ins_upd_myisam.result
@@ -549,16 +549,12 @@ a BLOB GENERATED ALWAYS AS ('') VIRTUAL,
b TIMESTAMP(4) GENERATED ALWAYS AS ('') VIRTUAL,
KEY (a(183),b)
);
-Warnings:
-Warning 1901 Function or expression '''' cannot be used in the GENERATED ALWAYS AS clause of `b`
-Warning 1105 Expression depends on the @@sql_mode value TIME_ROUND_FRACTIONAL
+ERROR HY000: Function or expression '''' cannot be used in the GENERATED ALWAYS AS clause of `b`
+CREATE TABLE t (
+a BLOB GENERATED ALWAYS AS ('') VIRTUAL,
+b TIMESTAMP(4) GENERATED ALWAYS AS ('') VIRTUAL
+);
INSERT IGNORE INTO t VALUES(), (), ();
-Warnings:
-Warning 1901 Function or expression '''' cannot be used in the GENERATED ALWAYS AS clause of `b`
-Warning 1105 Expression depends on the @@sql_mode value TIME_ROUND_FRACTIONAL
-Warning 1265 Data truncated for column 'b' at row 1
-Warning 1265 Data truncated for column 'b' at row 2
-Warning 1265 Data truncated for column 'b' at row 3
DELETE IGNORE FROM t;
DROP TABLE t;
#
diff --git a/mysql-test/suite/gcol/r/innodb_virtual_stats.result b/mysql-test/suite/gcol/r/innodb_virtual_stats.result
index 4ef499f932f..c0f595263df 100644
--- a/mysql-test/suite/gcol/r/innodb_virtual_stats.result
+++ b/mysql-test/suite/gcol/r/innodb_virtual_stats.result
@@ -24,6 +24,9 @@ vidxcd n_diff_pfx03 c,d,DB_ROW_ID
vidxcd n_leaf_pages Number of leaf pages in the index
vidxcd size Number of pages in the index
ALTER TABLE t ADD COLUMN e INT GENERATED ALWAYS AS(a+a+b), ADD INDEX idxb (b), ALGORITHM=INPLACE;
+select count(*) from t;
+count(*)
+1
SELECT index_name, stat_name, stat_description
FROM mysql.innodb_index_stats
WHERE database_name = 'test' AND table_name = 't';
@@ -45,6 +48,9 @@ vidxcd n_diff_pfx03 c,d,DB_ROW_ID
vidxcd n_leaf_pages Number of leaf pages in the index
vidxcd size Number of pages in the index
ALTER TABLE t DROP COLUMN c, DROP INDEX idxa, ALGORITHM=INPLACE;
+select count(*) from t;
+count(*)
+1
SELECT index_name, stat_name, stat_description
FROM mysql.innodb_index_stats
WHERE database_name = 'test' AND table_name = 't';
@@ -61,6 +67,9 @@ vidxcd n_diff_pfx02 d,DB_ROW_ID
vidxcd n_leaf_pages Number of leaf pages in the index
vidxcd size Number of pages in the index
ALTER TABLE t ADD INDEX vidxe (e), ALGORITHM=INPLACE;
+select count(*) from t;
+count(*)
+1
SELECT index_name, stat_name, stat_description
FROM mysql.innodb_index_stats
WHERE database_name = 'test' AND table_name = 't';
@@ -81,6 +90,9 @@ vidxe n_diff_pfx02 e,DB_ROW_ID
vidxe n_leaf_pages Number of leaf pages in the index
vidxe size Number of pages in the index
ALTER TABLE t ADD COLUMN f INT GENERATED ALWAYS AS(a + a), ADD INDEX vidxf (f), ALGORITHM=INPLACE;
+select count(*) from t;
+count(*)
+1
SELECT index_name, stat_name, stat_description
FROM mysql.innodb_index_stats
WHERE database_name = 'test' AND table_name = 't';
diff --git a/mysql-test/suite/gcol/t/innodb_virtual_stats.test b/mysql-test/suite/gcol/t/innodb_virtual_stats.test
index 7e3c8f4e00e..69c67af8ed1 100644
--- a/mysql-test/suite/gcol/t/innodb_virtual_stats.test
+++ b/mysql-test/suite/gcol/t/innodb_virtual_stats.test
@@ -20,24 +20,28 @@ FROM mysql.innodb_index_stats
WHERE database_name = 'test' AND table_name = 't';
ALTER TABLE t ADD COLUMN e INT GENERATED ALWAYS AS(a+a+b), ADD INDEX idxb (b), ALGORITHM=INPLACE;
+select count(*) from t;
SELECT index_name, stat_name, stat_description
FROM mysql.innodb_index_stats
WHERE database_name = 'test' AND table_name = 't';
ALTER TABLE t DROP COLUMN c, DROP INDEX idxa, ALGORITHM=INPLACE;
+select count(*) from t;
SELECT index_name, stat_name, stat_description
FROM mysql.innodb_index_stats
WHERE database_name = 'test' AND table_name = 't';
ALTER TABLE t ADD INDEX vidxe (e), ALGORITHM=INPLACE;
+select count(*) from t;
SELECT index_name, stat_name, stat_description
FROM mysql.innodb_index_stats
WHERE database_name = 'test' AND table_name = 't';
ALTER TABLE t ADD COLUMN f INT GENERATED ALWAYS AS(a + a), ADD INDEX vidxf (f), ALGORITHM=INPLACE;
+select count(*) from t;
SELECT index_name, stat_name, stat_description
FROM mysql.innodb_index_stats
diff --git a/mysql-test/suite/innodb/include/show_i_s_tables.inc b/mysql-test/suite/innodb/include/show_i_s_tables.inc
index cb4dffdd4c4..5fe34c370c8 100644
--- a/mysql-test/suite/innodb/include/show_i_s_tables.inc
+++ b/mysql-test/suite/innodb/include/show_i_s_tables.inc
@@ -8,8 +8,7 @@ SELECT t.name 'Table Name',
t.flag 'Table Flags',
t.n_cols 'Columns',
t.row_format 'Row Format',
- t.zip_page_size 'Zip Size',
- t.space_type 'Space Type'
+ t.zip_page_size 'Zip Size'
FROM information_schema.innodb_sys_tables t LEFT JOIN
information_schema.innodb_sys_tablespaces s
ON t.space = s.space
diff --git a/mysql-test/suite/innodb/include/show_i_s_tablespaces.inc b/mysql-test/suite/innodb/include/show_i_s_tablespaces.inc
index 50267852fb0..32c5e88d9b6 100644
--- a/mysql-test/suite/innodb/include/show_i_s_tablespaces.inc
+++ b/mysql-test/suite/innodb/include/show_i_s_tablespaces.inc
@@ -6,7 +6,6 @@
--replace_regex /#P#/#p#/ /#SP#/#sp#/
--replace_result ./ MYSQLD_DATADIR/ $MYSQLD_DATADIR/ MYSQLD_DATADIR/ $MYSQLD_DATADIR MYSQLD_DATADIR/ $MYSQL_TMP_DIR MYSQL_TMP_DIR $INNODB_PAGE_SIZE DEFAULT
SELECT s.name 'Space_Name',
- s.space_type 'Space_Type',
s.page_size 'Page_Size',
s.zip_page_size 'Zip_Size',
d.path 'Path'
diff --git a/mysql-test/suite/innodb/include/wait_all_purged.inc b/mysql-test/suite/innodb/include/wait_all_purged.inc
index 992e14f0843..a478cc8aa2c 100644
--- a/mysql-test/suite/innodb/include/wait_all_purged.inc
+++ b/mysql-test/suite/innodb/include/wait_all_purged.inc
@@ -8,6 +8,11 @@ if (!$wait_all_purged)
let $remaining_expect= `select concat('InnoDB ',$wait_all_purged)`;
let $wait_counter= 600;
+if ($VALGRIND_TEST)
+{
+ let $wait_counter= 2000;
+}
+
while ($wait_counter)
{
--replace_regex /.*History list length ([0-9]+).*/\1/
diff --git a/mysql-test/suite/innodb/r/alter_inplace_perfschema.result b/mysql-test/suite/innodb/r/alter_inplace_perfschema.result
index 440a1d0d6b3..4b5a2176b87 100644
--- a/mysql-test/suite/innodb/r/alter_inplace_perfschema.result
+++ b/mysql-test/suite/innodb/r/alter_inplace_perfschema.result
@@ -12,7 +12,7 @@ SET DEBUG_SYNC = 'now WAIT_FOR go';
select count_star into @final_count from performance_schema.events_waits_summary_global_by_event_name WHERE event_name LIKE '%wait%io%file%innodb%innodb_temp_file%';
SELECT @final_count - @init_count;
@final_count - @init_count
-11
+10
SET DEBUG_SYNC = 'now SIGNAL gone';
connection ddl;
disconnect ddl;
diff --git a/mysql-test/suite/innodb/r/ibuf_not_empty.result b/mysql-test/suite/innodb/r/ibuf_not_empty.result
index 667f0b2c90b..7e6099e7fea 100644
--- a/mysql-test/suite/innodb/r/ibuf_not_empty.result
+++ b/mysql-test/suite/innodb/r/ibuf_not_empty.result
@@ -21,7 +21,6 @@ INSERT INTO t1 SELECT 0,b,c FROM t1;
# restart: --innodb-force-recovery=6
check table t1;
Table Op Msg_type Msg_text
-test.t1 check Warning InnoDB: Index 'b' contains #### entries, should be 4096.
-test.t1 check error Corrupt
+test.t1 check status OK
# restart
DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/innodb-analyze.result b/mysql-test/suite/innodb/r/innodb-analyze.result
index 2aee004a2d6..b622992a422 100644
--- a/mysql-test/suite/innodb/r/innodb-analyze.result
+++ b/mysql-test/suite/innodb/r/innodb-analyze.result
@@ -1,2 +1,4 @@
+Warnings:
+Warning 1292 Truncated incorrect innodb_stats_transient_sample_pa value: '0'
Variable_name Value
-innodb_stats_sample_pages 1
+innodb_stats_transient_sample_pages 1
diff --git a/mysql-test/suite/innodb/r/innodb-stats-modified-counter.result b/mysql-test/suite/innodb/r/innodb-stats-modified-counter.result
index db56c6ba81a..fe47912edf4 100644
--- a/mysql-test/suite/innodb/r/innodb-stats-modified-counter.result
+++ b/mysql-test/suite/innodb/r/innodb-stats-modified-counter.result
@@ -2,19 +2,19 @@ set global innodb_stats_auto_recalc=off;
CREATE TABLE t1 (i int) ENGINE=InnoDB;
SELECT NAME, STATS_INITIALIZED, NUM_ROWS, MODIFIED_COUNTER FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
NAME STATS_INITIALIZED NUM_ROWS MODIFIED_COUNTER
-test/t1 Initialized 0 0
+test/t1 1 0 0
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (2);
SELECT NAME, STATS_INITIALIZED, NUM_ROWS, MODIFIED_COUNTER FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
NAME STATS_INITIALIZED NUM_ROWS MODIFIED_COUNTER
-test/t1 Initialized 2 2
+test/t1 1 2 2
DELETE FROM t1 WHERE i = 1;
SELECT NAME, STATS_INITIALIZED, NUM_ROWS, MODIFIED_COUNTER FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
NAME STATS_INITIALIZED NUM_ROWS MODIFIED_COUNTER
-test/t1 Initialized 1 3
+test/t1 1 1 3
UPDATE t1 SET i = 4 WHERE i = 2;
SELECT NAME, STATS_INITIALIZED, NUM_ROWS, MODIFIED_COUNTER FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
NAME STATS_INITIALIZED NUM_ROWS MODIFIED_COUNTER
-test/t1 Initialized 1 4
+test/t1 1 1 4
DROP TABLE t1;
set global innodb_stats_auto_recalc=default;
diff --git a/mysql-test/suite/innodb/r/innodb-stats-sample.result b/mysql-test/suite/innodb/r/innodb-stats-sample.result
index a049a1d82c1..dcd1a2592d7 100644
--- a/mysql-test/suite/innodb/r/innodb-stats-sample.result
+++ b/mysql-test/suite/innodb/r/innodb-stats-sample.result
@@ -1,4 +1,6 @@
+Warnings:
+Warning 1292 Truncated incorrect innodb_stats_transient_sample_pa value: '0'
Variable_name Value
-innodb_stats_sample_pages 1
+innodb_stats_transient_sample_pages 1
Variable_name Value
innodb_stats_traditional OFF
diff --git a/mysql-test/suite/innodb/r/innodb-system-table-view.result b/mysql-test/suite/innodb/r/innodb-system-table-view.result
index 65dc0a8e274..11fc1ae8cf9 100644
--- a/mysql-test/suite/innodb/r/innodb-system-table-view.result
+++ b/mysql-test/suite/innodb/r/innodb-system-table-view.result
@@ -81,17 +81,17 @@ CREATE TABLE t_compact (a INT KEY, b TEXT) ROW_FORMAT=COMPACT ENGINE=innodb;
CREATE TABLE t_compressed (a INT KEY, b TEXT) ROW_FORMAT=COMPRESSED ENGINE=innodb KEY_BLOCK_SIZE=2;
CREATE TABLE t_dynamic (a INT KEY, b TEXT) ROW_FORMAT=DYNAMIC ENGINE=innodb;
=== information_schema.innodb_sys_tables and innodb_sys_tablespaces ===
-Table Name Tablespace Table Flags Columns Row Format Zip Size Space Type
-test/t_compact test/t_compact 1 5 Compact 0 Single
-test/t_compressed test/t_compressed 37 5 Compressed 2048 Single
-test/t_dynamic test/t_dynamic 33 5 Dynamic 0 Single
-test/t_redundant test/t_redundant 0 5 Redundant 0 Single
+Table Name Tablespace Table Flags Columns Row Format Zip Size
+test/t_compact test/t_compact 1 5 Compact 0
+test/t_compressed test/t_compressed 37 5 Compressed 2048
+test/t_dynamic test/t_dynamic 33 5 Dynamic 0
+test/t_redundant test/t_redundant 0 5 Redundant 0
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
-Space_Name Space_Type Page_Size Zip_Size Path
-test/t_redundant Single DEFAULT DEFAULT MYSQLD_DATADIR/test/t_redundant.ibd
-test/t_compact Single DEFAULT DEFAULT MYSQLD_DATADIR/test/t_compact.ibd
-test/t_compressed Single DEFAULT 2048 MYSQLD_DATADIR/test/t_compressed.ibd
-test/t_dynamic Single DEFAULT DEFAULT MYSQLD_DATADIR/test/t_dynamic.ibd
+Space_Name Page_Size Zip_Size Path
+test/t_redundant DEFAULT DEFAULT MYSQLD_DATADIR/test/t_redundant.ibd
+test/t_compact DEFAULT DEFAULT MYSQLD_DATADIR/test/t_compact.ibd
+test/t_compressed DEFAULT 2048 MYSQLD_DATADIR/test/t_compressed.ibd
+test/t_dynamic DEFAULT DEFAULT MYSQLD_DATADIR/test/t_dynamic.ibd
DROP TABLE t_redundant, t_compact, t_compressed, t_dynamic;
SELECT count(*) FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS;
count(*)
diff --git a/mysql-test/suite/innodb/r/innodb-wl5522-debug.result b/mysql-test/suite/innodb/r/innodb-wl5522-debug.result
index ed7477fa033..e367c5d3705 100644
--- a/mysql-test/suite/innodb/r/innodb-wl5522-debug.result
+++ b/mysql-test/suite/innodb/r/innodb-wl5522-debug.result
@@ -491,7 +491,6 @@ INDEX idx3(c4(512))) Engine=InnoDB;
connect purge_control,localhost,root;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection default;
-SET GLOBAL innodb_disable_background_merge=ON;
SET GLOBAL innodb_monitor_reset = ibuf_merges;
SET GLOBAL innodb_monitor_reset = ibuf_merges_insert;
INSERT INTO test_wl5522.t1(c2, c3, c4) VALUES
@@ -642,6 +641,7 @@ SELECT name
FROM information_schema.innodb_metrics
WHERE name = 'ibuf_merges_insert' AND count = 0;
name
+ibuf_merges_insert
FLUSH TABLES test_wl5522.t1 FOR EXPORT;
backup: t1
UNLOCK TABLES;
@@ -649,12 +649,10 @@ SELECT name
FROM information_schema.innodb_metrics
WHERE name = 'ibuf_merges' AND count > 0;
name
-ibuf_merges
SELECT name
FROM information_schema.innodb_metrics
WHERE name = 'ibuf_merges_inserts' AND count > 0;
name
-SET GLOBAL innodb_disable_background_merge=OFF;
connection purge_control;
COMMIT;
disconnect purge_control;
@@ -867,8 +865,6 @@ SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table `t1`
SET SESSION debug_dbug="+d,ib_import_create_index_failure_1";
ALTER TABLE test_wl5522.t1 ADD INDEX idx(c1);
-Warnings:
-Warning 1814 Tablespace has been discarded for table `t1`
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
diff --git a/mysql-test/suite/innodb/r/innodb-wl5522.result b/mysql-test/suite/innodb/r/innodb-wl5522.result
index 50330b5b164..3cc31a5b831 100644
--- a/mysql-test/suite/innodb/r/innodb-wl5522.result
+++ b/mysql-test/suite/innodb/r/innodb-wl5522.result
@@ -285,14 +285,16 @@ ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Schema mismatch (Index x not found in tablespace meta-data file.)
+select count(*) from t1;
+ERROR HY000: Tablespace has been discarded for table `t1`
ALTER TABLE t1 DROP INDEX x;
-Warnings:
-Warning 1814 Tablespace has been discarded for table `t1`
+ALTER TABLE t1 DROP INDEX x, ALGORITHM=copy;
+ERROR 42000: Can't DROP INDEX `x`; check that it exists
ALTER TABLE t1 ADD INDEX idx(c2);
-Warnings:
-Warning 1814 Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
+Warnings:
+Warning 1814 Tablespace has been discarded for table `t1`
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
diff --git a/mysql-test/suite/innodb/r/innodb_bug12400341.result b/mysql-test/suite/innodb/r/innodb_bug12400341.result
index b402af84231..7b7f1c1a981 100644
--- a/mysql-test/suite/innodb/r/innodb_bug12400341.result
+++ b/mysql-test/suite/innodb/r/innodb_bug12400341.result
@@ -1,7 +1,5 @@
call mtr.add_suppression("InnoDB: Warning: cannot find a free slot for an undo log. Do you have too*");
call mtr.add_suppression("\\[Warning\\] InnoDB: Cannot find a free slot for an undo log. Do you have too");
-set @old_innodb_undo_logs = @@innodb_undo_logs;
-set global innodb_undo_logs=1;
show variables like "max_connections";
Variable_name Value
max_connections 64
@@ -28,4 +26,3 @@ select count(*) from information_schema.processlist where command != 'Daemon';
count(*)
33
drop database mysqltest;
-set global innodb_undo_logs = @old_innodb_undo_logs;
diff --git a/mysql-test/suite/innodb/r/innodb_force_recovery.result b/mysql-test/suite/innodb/r/innodb_force_recovery.result
index 838de9844e1..9d537126216 100644
--- a/mysql-test/suite/innodb/r/innodb_force_recovery.result
+++ b/mysql-test/suite/innodb/r/innodb_force_recovery.result
@@ -3,38 +3,26 @@ create table t2(f1 int primary key, f2 int, index idx(f2))engine=innodb;
insert into t1 values(1, 2);
insert into t2 values(1, 2);
SET GLOBAL innodb_fast_shutdown = 0;
-# Restart the server with innodb_force_recovery as 4.
# restart: --innodb-force-recovery=4
select * from t1;
f1 f2
1 2
+begin;
insert into t1 values(2, 3);
-ERROR HY000: Running in read-only mode
+rollback;
alter table t1 add f3 int not null, algorithm=copy;
-ERROR HY000: Can't create table `test`.`t1` (errno: 165 "Table is read only")
-alter table t1 add f3 int not null, algorithm=inplace;
-ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Running in read-only mode. Try ALGORITHM=COPY
+alter table t1 add f4 int not null, algorithm=inplace;
drop index idx on t1;
-ERROR HY000: Can't create table `test`.`t1` (errno: 165 "Table is read only")
-alter table t1 drop index idx, algorithm=inplace;
-ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Running in read-only mode. Try ALGORITHM=COPY
update t1 set f1=3 where f2=2;
-ERROR HY000: Running in read-only mode
create table t3(f1 int not null)engine=innodb;
-ERROR HY000: Can't create table `test`.`t3` (errno: 165 "Table is read only")
drop table t3;
-ERROR 42S02: Unknown table 'test.t3'
rename table t1 to t3;
-ERROR HY000: Error on rename of './test/t1' to './test/t3' (errno: 165 "Table is read only")
+rename table t3 to t1;
truncate table t1;
-ERROR HY000: Table 't1' is read only
-drop table t1;
-ERROR HY000: Table 't1' is read only
show tables;
Tables_in_test
t1
t2
-# Restart the server with innodb_force_recovery as 5.
# restart: --innodb-force-recovery=5
select * from t2;
f1 f2
@@ -65,7 +53,6 @@ show tables;
Tables_in_test
t1
t2
-# Restart the server with innodb_force_recovery as 6.
# restart: --innodb-force-recovery=6
select * from t2;
f1 f2
@@ -94,7 +81,6 @@ show tables;
Tables_in_test
t1
t2
-# Restart the server with innodb_force_recovery=2
# restart: --innodb-force-recovery=2
select * from t2;
f1 f2
@@ -108,7 +94,6 @@ drop table t1;
disconnect con1;
connection default;
# Kill the server
-# Restart the server with innodb_force_recovery=3
# restart: --innodb-force-recovery=3
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
select * from t2;
diff --git a/mysql-test/suite/innodb/r/innodb_information_schema.result b/mysql-test/suite/innodb/r/innodb_information_schema.result
index 766d5f47c2d..708108bf32c 100644
--- a/mysql-test/suite/innodb/r/innodb_information_schema.result
+++ b/mysql-test/suite/innodb/r/innodb_information_schema.result
@@ -22,7 +22,7 @@ lock_table COUNT(*)
"test"."t_min" 2
"test"."`t'\""_str" 10
Field Type Null Key Default Extra
-trx_id varchar(18) NO
+trx_id bigint(21) unsigned NO 0
trx_state varchar(13) NO
trx_started datetime NO 0000-00-00 00:00:00
trx_requested_lock_id varchar(81) YES NULL
@@ -38,7 +38,7 @@ trx_lock_memory_bytes bigint(21) unsigned NO 0
trx_rows_locked bigint(21) unsigned NO 0
trx_rows_modified bigint(21) unsigned NO 0
trx_concurrency_tickets bigint(21) unsigned NO 0
-trx_isolation_level varchar(16) NO
+trx_isolation_level enum('READ UNCOMMITTED','READ COMMITTED','REPEATABLE READ','SERIALIZABLE') NO
trx_unique_checks int(1) NO 0
trx_foreign_key_checks int(1) NO 0
trx_last_foreign_key_error varchar(256) YES NULL
diff --git a/mysql-test/suite/innodb/r/innodb_lock_wait_timeout_1.result b/mysql-test/suite/innodb/r/innodb_lock_wait_timeout_1.result
index d43da0cb7b7..797c30d700f 100644
--- a/mysql-test/suite/innodb/r/innodb_lock_wait_timeout_1.result
+++ b/mysql-test/suite/innodb/r/innodb_lock_wait_timeout_1.result
@@ -35,7 +35,6 @@ DROP TABLE t2, t1;
# Bug#46539 Various crashes on INSERT IGNORE SELECT + SELECT
# FOR UPDATE
#
-drop table if exists t1;
create table t1 (a int primary key auto_increment,
b int, index(b)) engine=innodb;
insert into t1 (b) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
@@ -84,19 +83,12 @@ drop table t1, t2;
#
# Bug#41756 Strange error messages about locks from InnoDB
#
-drop table if exists t1;
-# In the default transaction isolation mode, and/or with
-# innodb_locks_unsafe_for_binlog=OFF, handler::unlock_row()
-# in InnoDB does nothing.
+# In the default transaction isolation mode,
+# handler::unlock_row() in InnoDB does nothing.
# Thus in order to reproduce the condition that led to the
# warning, one needs to relax isolation by either
# setting a weaker tx_isolation value, or by turning on
# the unsafe replication switch.
-# For testing purposes, choose to tweak the isolation level,
-# since it's settable at runtime, unlike
-# innodb_locks_unsafe_for_binlog, which is
-# only a command-line switch.
-#
set @@session.tx_isolation="read-committed";
# Prepare data. We need a table with a unique index,
# for join_read_key to be used. The other column
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 0c2c456c77c..912c3d77867 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
@@ -35,257 +35,256 @@ page_size buffer_pool_instance pages_used pages_free relocation_ops relocation_t
Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_cmpmem_reset but the InnoDB storage engine is not installed
select * from information_schema.innodb_metrics;
-NAME SUBSYSTEM COUNT MAX_COUNT MIN_COUNT AVG_COUNT COUNT_RESET MAX_COUNT_RESET MIN_COUNT_RESET AVG_COUNT_RESET TIME_ENABLED TIME_DISABLED TIME_ELAPSED TIME_RESET STATUS TYPE COMMENT
-metadata_table_handles_opened metadata 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of table handles opened
-metadata_table_handles_closed metadata 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of table handles closed
-metadata_table_reference_count metadata 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Table reference counter
-lock_deadlocks lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of deadlocks
-lock_timeouts lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of lock timeouts
-lock_rec_lock_waits lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times enqueued into record lock wait queue
-lock_table_lock_waits lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times enqueued into table lock wait queue
-lock_rec_lock_requests lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of record locks requested
-lock_rec_lock_created lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of record locks created
-lock_rec_lock_removed lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of record locks removed from the lock queue
-lock_rec_locks lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Current number of record locks on tables
-lock_table_lock_created lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of table locks created
-lock_table_lock_removed lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of table locks removed from the lock queue
-lock_table_locks lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Current number of table locks on tables
-lock_row_lock_current_waits lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of row locks currently being waited for (innodb_row_lock_current_waits)
-lock_row_lock_time lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Time spent in acquiring row locks, in milliseconds (innodb_row_lock_time)
-lock_row_lock_time_max lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value The maximum time to acquire a row lock, in milliseconds (innodb_row_lock_time_max)
-lock_row_lock_waits lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of times a row lock had to be waited for (innodb_row_lock_waits)
-lock_row_lock_time_avg lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value The average time to acquire a row lock, in milliseconds (innodb_row_lock_time_avg)
-buffer_pool_size server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Server buffer pool size (all buffer pools) in bytes
-buffer_pool_reads buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of reads directly from disk (innodb_buffer_pool_reads)
-buffer_pool_read_requests buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of logical read requests (innodb_buffer_pool_read_requests)
-buffer_pool_write_requests buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of write requests (innodb_buffer_pool_write_requests)
-buffer_pool_wait_free buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of times waited for free buffer (innodb_buffer_pool_wait_free)
-buffer_pool_read_ahead buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of pages read as read ahead (innodb_buffer_pool_read_ahead)
-buffer_pool_read_ahead_evicted buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Read-ahead pages evicted without being accessed (innodb_buffer_pool_read_ahead_evicted)
-buffer_pool_pages_total buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Total buffer pool size in pages (innodb_buffer_pool_pages_total)
-buffer_pool_pages_misc buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Buffer pages for misc use such as row locks or the adaptive hash index (innodb_buffer_pool_pages_misc)
-buffer_pool_pages_data buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Buffer pages containing data (innodb_buffer_pool_pages_data)
-buffer_pool_bytes_data buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Buffer bytes containing data (innodb_buffer_pool_bytes_data)
-buffer_pool_pages_dirty buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Buffer pages currently dirty (innodb_buffer_pool_pages_dirty)
-buffer_pool_bytes_dirty buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Buffer bytes currently dirty (innodb_buffer_pool_bytes_dirty)
-buffer_pool_pages_free buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Buffer pages currently free (innodb_buffer_pool_pages_free)
-buffer_pages_created buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of pages created (innodb_pages_created)
-buffer_pages_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of pages written (innodb_pages_written)
-buffer_index_pages_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of index pages written (innodb_index_pages_written)
-buffer_non_index_pages_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of non index pages written (innodb_non_index_pages_written)
-buffer_pages_read buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of pages read (innodb_pages_read)
-buffer_index_sec_rec_cluster_reads buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of secondary record reads triggered cluster read
-buffer_index_sec_rec_cluster_reads_avoided buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of secondary record reads avoided triggering cluster read
-buffer_data_reads buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Amount of data read in bytes (innodb_data_reads)
-buffer_data_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Amount of data written in bytes (innodb_data_written)
-buffer_flush_batch_scanned buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages scanned as part of flush batch
-buffer_flush_batch_num_scan buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of times buffer flush list flush is called
-buffer_flush_batch_scanned_per_call buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Pages scanned per flush batch scan
-buffer_flush_batch_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages flushed as part of flush batch
-buffer_flush_batches buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of flush batches
-buffer_flush_batch_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Pages queued as a flush batch
-buffer_flush_neighbor_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total neighbors flushed as part of neighbor flush
-buffer_flush_neighbor buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of times neighbors flushing is invoked
-buffer_flush_neighbor_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Pages queued as a neighbor batch
-buffer_flush_n_to_flush_requested buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of pages requested for flushing.
-buffer_flush_n_to_flush_by_age buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of pages target by LSN Age for flushing.
-buffer_flush_adaptive_avg_time_slot buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Avg time (ms) spent for adaptive flushing recently per slot.
-buffer_LRU_batch_flush_avg_time_slot buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Avg time (ms) spent for LRU batch flushing recently per slot.
-buffer_flush_adaptive_avg_time_thread buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Avg time (ms) spent for adaptive flushing recently per thread.
-buffer_LRU_batch_flush_avg_time_thread buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Avg time (ms) spent for LRU batch flushing recently per thread.
-buffer_flush_adaptive_avg_time_est buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Estimated time (ms) spent for adaptive flushing recently.
-buffer_LRU_batch_flush_avg_time_est buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Estimated time (ms) spent for LRU batch flushing recently.
-buffer_flush_avg_time buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Avg time (ms) spent for flushing recently.
-buffer_flush_adaptive_avg_pass buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Numner of adaptive flushes passed during the recent Avg period.
-buffer_LRU_batch_flush_avg_pass buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of LRU batch flushes passed during the recent Avg period.
-buffer_flush_avg_pass buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of flushes passed during the recent Avg period.
-buffer_LRU_get_free_loops buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Total loops in LRU get free.
-buffer_LRU_get_free_waits buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Total sleep waits in LRU get free.
-buffer_flush_avg_page_rate buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Average number of pages at which flushing is happening
-buffer_flush_lsn_avg_rate buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Average redo generation rate
-buffer_flush_pct_for_dirty buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Percent of IO capacity used to avoid max dirty page limit
-buffer_flush_pct_for_lsn buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Percent of IO capacity used to avoid reusable redo space limit
-buffer_flush_sync_waits buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times a wait happens due to sync flushing
-buffer_flush_adaptive_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages flushed as part of adaptive flushing
-buffer_flush_adaptive buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of adaptive batches
-buffer_flush_adaptive_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Pages queued as an adaptive batch
-buffer_flush_sync_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages flushed as part of sync batches
-buffer_flush_sync buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of sync batches
-buffer_flush_sync_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Pages queued as a sync batch
-buffer_flush_background_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages flushed as part of background batches
-buffer_flush_background buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of background batches
-buffer_flush_background_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Pages queued as a background batch
-buffer_LRU_batch_scanned buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages scanned as part of LRU batch
-buffer_LRU_batch_num_scan buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of times LRU batch is called
-buffer_LRU_batch_scanned_per_call buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Pages scanned per LRU batch call
-buffer_LRU_batch_flush_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages flushed as part of LRU batches
-buffer_LRU_batches_flush buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of LRU batches
-buffer_LRU_batch_flush_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Pages queued as an LRU batch
-buffer_LRU_batch_evict_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages evicted as part of LRU batches
-buffer_LRU_batches_evict buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of LRU batches
-buffer_LRU_batch_evict_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Pages queued as an LRU batch
-buffer_LRU_single_flush_scanned buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages scanned as part of single page LRU flush
-buffer_LRU_single_flush_num_scan buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of times single page LRU flush is called
-buffer_LRU_single_flush_scanned_per_call buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Page scanned per single LRU flush
-buffer_LRU_single_flush_failure_count Buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times attempt to flush a single page from LRU failed
-buffer_LRU_get_free_search Buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of searches performed for a clean page
-buffer_LRU_search_scanned buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages scanned as part of LRU search
-buffer_LRU_search_num_scan buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of times LRU search is performed
-buffer_LRU_search_scanned_per_call buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Page scanned per single LRU search
-buffer_LRU_unzip_search_scanned buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages scanned as part of LRU unzip search
-buffer_LRU_unzip_search_num_scan buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of times LRU unzip search is performed
-buffer_LRU_unzip_search_scanned_per_call buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Page scanned per single LRU unzip search
-buffer_page_read_index_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Index Leaf Pages read
-buffer_page_read_index_non_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Index Non-leaf Pages read
-buffer_page_read_index_ibuf_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Insert Buffer Index Leaf Pages read
-buffer_page_read_index_ibuf_non_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Insert Buffer Index Non-Leaf Pages read
-buffer_page_read_undo_log buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Undo Log Pages read
-buffer_page_read_index_inode buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Index Inode Pages read
-buffer_page_read_ibuf_free_list buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Insert Buffer Free List Pages read
-buffer_page_read_ibuf_bitmap buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Insert Buffer Bitmap Pages read
-buffer_page_read_system_page buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of System Pages read
-buffer_page_read_trx_system buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Transaction System Pages read
-buffer_page_read_fsp_hdr buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of File Space Header Pages read
-buffer_page_read_xdes buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Extent Descriptor Pages read
-buffer_page_read_blob buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Uncompressed BLOB Pages read
-buffer_page_read_zblob buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of First Compressed BLOB Pages read
-buffer_page_read_zblob2 buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Subsequent Compressed BLOB Pages read
-buffer_page_read_other buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of other/unknown (old version of InnoDB) Pages read
-buffer_page_written_index_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Index Leaf Pages written
-buffer_page_written_index_non_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Index Non-leaf Pages written
-buffer_page_written_index_ibuf_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Insert Buffer Index Leaf Pages written
-buffer_page_written_index_ibuf_non_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Insert Buffer Index Non-Leaf Pages written
-buffer_page_written_undo_log buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Undo Log Pages written
-buffer_page_written_index_inode buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Index Inode Pages written
-buffer_page_written_ibuf_free_list buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Insert Buffer Free List Pages written
-buffer_page_written_ibuf_bitmap buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Insert Buffer Bitmap Pages written
-buffer_page_written_system_page buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of System Pages written
-buffer_page_written_trx_system buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Transaction System Pages written
-buffer_page_written_fsp_hdr buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of File Space Header Pages written
-buffer_page_written_xdes buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Extent Descriptor Pages written
-buffer_page_written_blob buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Uncompressed BLOB Pages written
-buffer_page_written_zblob buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of First Compressed BLOB Pages written
-buffer_page_written_zblob2 buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Subsequent Compressed BLOB Pages written
-buffer_page_written_other buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of other/unknown (old version InnoDB) Pages written
-os_data_reads os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of reads initiated (innodb_data_reads)
-os_data_writes os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of writes initiated (innodb_data_writes)
-os_data_fsyncs os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of fsync() calls (innodb_data_fsyncs)
-os_pending_reads os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of reads pending
-os_pending_writes os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of writes pending
-os_log_bytes_written os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Bytes of log written (innodb_os_log_written)
-os_log_fsyncs os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of fsync log writes (innodb_os_log_fsyncs)
-os_log_pending_fsyncs os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of pending fsync write (innodb_os_log_pending_fsyncs)
-os_log_pending_writes os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of pending log file writes (innodb_os_log_pending_writes)
-trx_rw_commits transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of read-write transactions committed
-trx_ro_commits transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of read-only transactions committed
-trx_nl_ro_commits transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of non-locking auto-commit read-only transactions committed
-trx_commits_insert_update transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of transactions committed with inserts and updates
-trx_rollbacks transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of transactions rolled back
-trx_rollbacks_savepoint transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of transactions rolled back to savepoint
-trx_active_transactions transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of active transactions
-trx_rseg_history_len transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Length of the TRX_RSEG_HISTORY list
-trx_undo_slots_used transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of undo slots used
-trx_undo_slots_cached transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of undo slots cached
-trx_rseg_current_size transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Current rollback segment size in pages
-purge_del_mark_records purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of delete-marked rows purged
-purge_upd_exist_or_extern_records purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of purges on updates of existing records and updates on delete marked record with externally stored field
-purge_invoked purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times purge was invoked
-purge_undo_log_pages purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of undo log pages handled by the purge
-purge_dml_delay_usec purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Microseconds DML to be delayed due to purge lagging
-purge_stop_count purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Number of times purge was stopped
-purge_resume_count purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Number of times purge was resumed
-log_checkpoints recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of checkpoints
-log_lsn_last_flush recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value LSN of Last flush
-log_lsn_last_checkpoint recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value LSN at last checkpoint
-log_lsn_current recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Current LSN value
-log_lsn_checkpoint_age recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Current LSN value minus LSN at last checkpoint
-log_lsn_buf_pool_oldest recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value The oldest modified block LSN in the buffer pool
-log_max_modified_age_async recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Maximum LSN difference; when exceeded, start asynchronous preflush
-log_max_modified_age_sync recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Maximum LSN difference; when exceeded, start synchronous preflush
-log_pending_log_flushes recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Pending log flushes
-log_pending_checkpoint_writes recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Pending checkpoints
-log_num_log_io recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Number of log I/Os
-log_waits recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of log waits due to small log buffer (innodb_log_waits)
-log_write_requests recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of log write requests (innodb_log_write_requests)
-log_writes recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of log writes (innodb_log_writes)
-log_padded recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Bytes of log padded for log write ahead
-compress_pages_compressed compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of pages compressed
-compress_pages_decompressed compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of pages decompressed
-compression_pad_increments compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times padding is incremented to avoid compression failures
-compression_pad_decrements compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times padding is decremented due to good compressibility
-compress_saved compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of bytes saved by page compression
-compress_pages_page_compressed compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of pages compressed by page compression
-compress_page_compressed_trim_op compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of TRIM operation performed by page compression
-compress_pages_page_decompressed compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of pages decompressed by page compression
-compress_pages_page_compression_error compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of page compression errors
-compress_pages_encrypted compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of pages encrypted
-compress_pages_decrypted compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of pages decrypted
-index_page_splits index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of index page splits
-index_page_merge_attempts index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of index page merge attempts
-index_page_merge_successful index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of successful index page merges
-index_page_reorg_attempts index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of index page reorganization attempts
-index_page_reorg_successful index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of successful index page reorganizations
-index_page_discards index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of index pages discarded
-adaptive_hash_searches adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of successful searches using Adaptive Hash Index
-adaptive_hash_searches_btree adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of searches using B-tree on an index search
-adaptive_hash_pages_added adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of index pages on which the Adaptive Hash Index is built
-adaptive_hash_pages_removed adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of index pages whose corresponding Adaptive Hash Index entries were removed
-adaptive_hash_rows_added adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Adaptive Hash Index rows added
-adaptive_hash_rows_removed adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Adaptive Hash Index rows removed
-adaptive_hash_rows_deleted_no_hash_entry adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of rows deleted that did not have corresponding Adaptive Hash Index entries
-adaptive_hash_rows_updated adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Adaptive Hash Index rows updated
-file_num_open_files file_system 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Number of files currently open (innodb_num_open_files)
-ibuf_merges_insert change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of inserted records merged by change buffering
-ibuf_merges_delete_mark change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of deleted records merged by change buffering
-ibuf_merges_delete change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of purge records merged by change buffering
-ibuf_merges_discard_insert change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of insert merged operations discarded
-ibuf_merges_discard_delete_mark change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of deleted merged operations discarded
-ibuf_merges_discard_delete change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of purge merged operations discarded
-ibuf_merges change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of change buffer merges
-ibuf_size change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Change buffer size in pages
-innodb_master_thread_sleeps server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times (seconds) master thread sleeps
-innodb_activity_count server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Current server activity count
-innodb_master_active_loops server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times master thread performs its tasks when server is active
-innodb_master_idle_loops server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times master thread performs its tasks when server is idle
-innodb_background_drop_table_usec server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Time (in microseconds) spent to process drop table list
-innodb_ibuf_merge_usec server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Time (in microseconds) spent to process change buffer merge
-innodb_log_flush_usec server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Time (in microseconds) spent to flush log records
-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)
-innodb_page_size server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value InnoDB page size in bytes (innodb_page_size)
-innodb_rwlock_s_spin_waits server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of rwlock spin waits due to shared latch request
-innodb_rwlock_x_spin_waits server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of rwlock spin waits due to exclusive latch request
-innodb_rwlock_sx_spin_waits server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of rwlock spin waits due to sx latch request
-innodb_rwlock_s_spin_rounds server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of rwlock spin loop rounds due to shared latch request
-innodb_rwlock_x_spin_rounds server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of rwlock spin loop rounds due to exclusive latch request
-innodb_rwlock_sx_spin_rounds server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of rwlock spin loop rounds due to sx latch request
-innodb_rwlock_s_os_waits server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of OS waits due to shared latch request
-innodb_rwlock_x_os_waits server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of OS waits due to exclusive latch request
-innodb_rwlock_sx_os_waits server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of OS waits due to sx latch request
-dml_reads dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of rows read
-dml_inserts dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of rows inserted
-dml_deletes dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of rows deleted
-dml_updates dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of rows updated
-dml_system_reads dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of system rows read
-dml_system_inserts dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of system rows inserted
-dml_system_deletes dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of system rows deleted
-dml_system_updates dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of system rows updated
-ddl_background_drop_indexes ddl 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of indexes waiting to be dropped after failed index creation
-ddl_background_drop_tables ddl 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of tables in background drop table list
-ddl_online_create_index ddl 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of indexes being created online
-ddl_pending_alter_table ddl 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of ALTER TABLE, CREATE INDEX, DROP INDEX in progress
-ddl_sort_file_alter_table ddl 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of sort files created during alter table
-ddl_log_file_alter_table ddl 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of log files created during alter table
-icp_attempts icp 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of attempts for index push-down condition checks
-icp_no_match icp 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Index push-down condition does not match
-icp_out_of_range icp 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Index push-down condition out of range
-icp_match icp 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Index push-down condition matches
+NAME SUBSYSTEM COUNT MAX_COUNT MIN_COUNT AVG_COUNT COUNT_RESET MAX_COUNT_RESET MIN_COUNT_RESET AVG_COUNT_RESET TIME_ENABLED TIME_DISABLED TIME_ELAPSED TIME_RESET ENABLED TYPE COMMENT
+metadata_table_handles_opened metadata 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of table handles opened
+metadata_table_handles_closed metadata 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of table handles closed
+metadata_table_reference_count metadata 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Table reference counter
+lock_deadlocks lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of deadlocks
+lock_timeouts lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of lock timeouts
+lock_rec_lock_waits lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of times enqueued into record lock wait queue
+lock_table_lock_waits lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of times enqueued into table lock wait queue
+lock_rec_lock_requests lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of record locks requested
+lock_rec_lock_created lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of record locks created
+lock_rec_lock_removed lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of record locks removed from the lock queue
+lock_rec_locks lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Current number of record locks on tables
+lock_table_lock_created lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of table locks created
+lock_table_lock_removed lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of table locks removed from the lock queue
+lock_table_locks lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Current number of table locks on tables
+lock_row_lock_current_waits lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of row locks currently being waited for (innodb_row_lock_current_waits)
+lock_row_lock_time lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Time spent in acquiring row locks, in milliseconds (innodb_row_lock_time)
+lock_row_lock_time_max lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value The maximum time to acquire a row lock, in milliseconds (innodb_row_lock_time_max)
+lock_row_lock_waits lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of times a row lock had to be waited for (innodb_row_lock_waits)
+lock_row_lock_time_avg lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value The average time to acquire a row lock, in milliseconds (innodb_row_lock_time_avg)
+buffer_pool_size server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Server buffer pool size (all buffer pools) in bytes
+buffer_pool_reads buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of reads directly from disk (innodb_buffer_pool_reads)
+buffer_pool_read_requests buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of logical read requests (innodb_buffer_pool_read_requests)
+buffer_pool_write_requests buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of write requests (innodb_buffer_pool_write_requests)
+buffer_pool_wait_free buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of times waited for free buffer (innodb_buffer_pool_wait_free)
+buffer_pool_read_ahead buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of pages read as read ahead (innodb_buffer_pool_read_ahead)
+buffer_pool_read_ahead_evicted buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Read-ahead pages evicted without being accessed (innodb_buffer_pool_read_ahead_evicted)
+buffer_pool_pages_total buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Total buffer pool size in pages (innodb_buffer_pool_pages_total)
+buffer_pool_pages_misc buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Buffer pages for misc use such as row locks or the adaptive hash index (innodb_buffer_pool_pages_misc)
+buffer_pool_pages_data buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Buffer pages containing data (innodb_buffer_pool_pages_data)
+buffer_pool_bytes_data buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Buffer bytes containing data (innodb_buffer_pool_bytes_data)
+buffer_pool_pages_dirty buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Buffer pages currently dirty (innodb_buffer_pool_pages_dirty)
+buffer_pool_bytes_dirty buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Buffer bytes currently dirty (innodb_buffer_pool_bytes_dirty)
+buffer_pool_pages_free buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Buffer pages currently free (innodb_buffer_pool_pages_free)
+buffer_pages_created buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of pages created (innodb_pages_created)
+buffer_pages_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of pages written (innodb_pages_written)
+buffer_index_pages_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of index pages written (innodb_index_pages_written)
+buffer_non_index_pages_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of non index pages written (innodb_non_index_pages_written)
+buffer_pages_read buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of pages read (innodb_pages_read)
+buffer_index_sec_rec_cluster_reads buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of secondary record reads triggered cluster read
+buffer_index_sec_rec_cluster_reads_avoided buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of secondary record reads avoided triggering cluster read
+buffer_data_reads buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Amount of data read in bytes (innodb_data_reads)
+buffer_data_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Amount of data written in bytes (innodb_data_written)
+buffer_flush_batch_scanned buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_owner Total pages scanned as part of flush batch
+buffer_flush_batch_num_scan buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Number of times buffer flush list flush is called
+buffer_flush_batch_scanned_per_call buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Pages scanned per flush batch scan
+buffer_flush_batch_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_owner Total pages flushed as part of flush batch
+buffer_flush_batches buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Number of flush batches
+buffer_flush_batch_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Pages queued as a flush batch
+buffer_flush_neighbor_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_owner Total neighbors flushed as part of neighbor flush
+buffer_flush_neighbor buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Number of times neighbors flushing is invoked
+buffer_flush_neighbor_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Pages queued as a neighbor batch
+buffer_flush_n_to_flush_requested buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of pages requested for flushing.
+buffer_flush_n_to_flush_by_age buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of pages target by LSN Age for flushing.
+buffer_flush_adaptive_avg_time_slot buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Avg time (ms) spent for adaptive flushing recently per slot.
+buffer_LRU_batch_flush_avg_time_slot buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Avg time (ms) spent for LRU batch flushing recently per slot.
+buffer_flush_adaptive_avg_time_thread buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Avg time (ms) spent for adaptive flushing recently per thread.
+buffer_LRU_batch_flush_avg_time_thread buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Avg time (ms) spent for LRU batch flushing recently per thread.
+buffer_flush_adaptive_avg_time_est buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Estimated time (ms) spent for adaptive flushing recently.
+buffer_LRU_batch_flush_avg_time_est buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Estimated time (ms) spent for LRU batch flushing recently.
+buffer_flush_avg_time buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Avg time (ms) spent for flushing recently.
+buffer_flush_adaptive_avg_pass buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Numner of adaptive flushes passed during the recent Avg period.
+buffer_LRU_batch_flush_avg_pass buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of LRU batch flushes passed during the recent Avg period.
+buffer_flush_avg_pass buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of flushes passed during the recent Avg period.
+buffer_LRU_get_free_loops buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Total loops in LRU get free.
+buffer_LRU_get_free_waits buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Total sleep waits in LRU get free.
+buffer_flush_avg_page_rate buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Average number of pages at which flushing is happening
+buffer_flush_lsn_avg_rate buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Average redo generation rate
+buffer_flush_pct_for_dirty buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Percent of IO capacity used to avoid max dirty page limit
+buffer_flush_pct_for_lsn buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Percent of IO capacity used to avoid reusable redo space limit
+buffer_flush_sync_waits buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of times a wait happens due to sync flushing
+buffer_flush_adaptive_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_owner Total pages flushed as part of adaptive flushing
+buffer_flush_adaptive buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Number of adaptive batches
+buffer_flush_adaptive_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Pages queued as an adaptive batch
+buffer_flush_sync_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_owner Total pages flushed as part of sync batches
+buffer_flush_sync buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Number of sync batches
+buffer_flush_sync_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Pages queued as a sync batch
+buffer_flush_background_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_owner Total pages flushed as part of background batches
+buffer_flush_background buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Number of background batches
+buffer_flush_background_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Pages queued as a background batch
+buffer_LRU_batch_scanned buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_owner Total pages scanned as part of LRU batch
+buffer_LRU_batch_num_scan buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Number of times LRU batch is called
+buffer_LRU_batch_scanned_per_call buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Pages scanned per LRU batch call
+buffer_LRU_batch_flush_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_owner Total pages flushed as part of LRU batches
+buffer_LRU_batches_flush buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Number of LRU batches
+buffer_LRU_batch_flush_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Pages queued as an LRU batch
+buffer_LRU_batch_evict_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_owner Total pages evicted as part of LRU batches
+buffer_LRU_batches_evict buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Number of LRU batches
+buffer_LRU_batch_evict_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Pages queued as an LRU batch
+buffer_LRU_single_flush_scanned buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_owner Total pages scanned as part of single page LRU flush
+buffer_LRU_single_flush_num_scan buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Number of times single page LRU flush is called
+buffer_LRU_single_flush_scanned_per_call buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Page scanned per single LRU flush
+buffer_LRU_single_flush_failure_count Buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of times attempt to flush a single page from LRU failed
+buffer_LRU_get_free_search Buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of searches performed for a clean page
+buffer_LRU_search_scanned buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_owner Total pages scanned as part of LRU search
+buffer_LRU_search_num_scan buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Number of times LRU search is performed
+buffer_LRU_search_scanned_per_call buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Page scanned per single LRU search
+buffer_LRU_unzip_search_scanned buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_owner Total pages scanned as part of LRU unzip search
+buffer_LRU_unzip_search_num_scan buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Number of times LRU unzip search is performed
+buffer_LRU_unzip_search_scanned_per_call buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Page scanned per single LRU unzip search
+buffer_page_read_index_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Index Leaf Pages read
+buffer_page_read_index_non_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Index Non-leaf Pages read
+buffer_page_read_index_ibuf_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Insert Buffer Index Leaf Pages read
+buffer_page_read_index_ibuf_non_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Insert Buffer Index Non-Leaf Pages read
+buffer_page_read_undo_log buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Undo Log Pages read
+buffer_page_read_index_inode buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Index Inode Pages read
+buffer_page_read_ibuf_free_list buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Insert Buffer Free List Pages read
+buffer_page_read_ibuf_bitmap buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Insert Buffer Bitmap Pages read
+buffer_page_read_system_page buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of System Pages read
+buffer_page_read_trx_system buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Transaction System Pages read
+buffer_page_read_fsp_hdr buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of File Space Header Pages read
+buffer_page_read_xdes buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Extent Descriptor Pages read
+buffer_page_read_blob buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Uncompressed BLOB Pages read
+buffer_page_read_zblob buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of First Compressed BLOB Pages read
+buffer_page_read_zblob2 buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Subsequent Compressed BLOB Pages read
+buffer_page_read_other buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of other/unknown (old version of InnoDB) Pages read
+buffer_page_written_index_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Index Leaf Pages written
+buffer_page_written_index_non_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Index Non-leaf Pages written
+buffer_page_written_index_ibuf_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Insert Buffer Index Leaf Pages written
+buffer_page_written_index_ibuf_non_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Insert Buffer Index Non-Leaf Pages written
+buffer_page_written_undo_log buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Undo Log Pages written
+buffer_page_written_index_inode buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Index Inode Pages written
+buffer_page_written_ibuf_free_list buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Insert Buffer Free List Pages written
+buffer_page_written_ibuf_bitmap buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Insert Buffer Bitmap Pages written
+buffer_page_written_system_page buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of System Pages written
+buffer_page_written_trx_system buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Transaction System Pages written
+buffer_page_written_fsp_hdr buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of File Space Header Pages written
+buffer_page_written_xdes buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Extent Descriptor Pages written
+buffer_page_written_blob buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Uncompressed BLOB Pages written
+buffer_page_written_zblob buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of First Compressed BLOB Pages written
+buffer_page_written_zblob2 buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Subsequent Compressed BLOB Pages written
+buffer_page_written_other buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of other/unknown (old version InnoDB) Pages written
+os_data_reads os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of reads initiated (innodb_data_reads)
+os_data_writes os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of writes initiated (innodb_data_writes)
+os_data_fsyncs os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of fsync() calls (innodb_data_fsyncs)
+os_pending_reads os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of reads pending
+os_pending_writes os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of writes pending
+os_log_bytes_written os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Bytes of log written (innodb_os_log_written)
+os_log_fsyncs os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of fsync log writes (innodb_os_log_fsyncs)
+os_log_pending_fsyncs os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of pending fsync write (innodb_os_log_pending_fsyncs)
+os_log_pending_writes os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of pending log file writes (innodb_os_log_pending_writes)
+trx_rw_commits transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of read-write transactions committed
+trx_ro_commits transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of read-only transactions committed
+trx_nl_ro_commits transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of non-locking auto-commit read-only transactions committed
+trx_commits_insert_update transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of transactions committed with inserts and updates
+trx_rollbacks transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of transactions rolled back
+trx_rollbacks_savepoint transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of transactions rolled back to savepoint
+trx_active_transactions transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of active transactions
+trx_rseg_history_len transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Length of the TRX_RSEG_HISTORY list
+trx_undo_slots_used transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of undo slots used
+trx_undo_slots_cached transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of undo slots cached
+trx_rseg_current_size transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Current rollback segment size in pages
+purge_del_mark_records purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of delete-marked rows purged
+purge_upd_exist_or_extern_records purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of purges on updates of existing records and updates on delete marked record with externally stored field
+purge_invoked purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of times purge was invoked
+purge_undo_log_pages purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of undo log pages handled by the purge
+purge_dml_delay_usec purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Microseconds DML to be delayed due to purge lagging
+purge_stop_count purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Number of times purge was stopped
+purge_resume_count purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Number of times purge was resumed
+log_checkpoints recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of checkpoints
+log_lsn_last_flush recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value LSN of Last flush
+log_lsn_last_checkpoint recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value LSN at last checkpoint
+log_lsn_current recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Current LSN value
+log_lsn_checkpoint_age recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Current LSN value minus LSN at last checkpoint
+log_lsn_buf_pool_oldest recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value The oldest modified block LSN in the buffer pool
+log_max_modified_age_async recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Maximum LSN difference; when exceeded, start asynchronous preflush
+log_max_modified_age_sync recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Maximum LSN difference; when exceeded, start synchronous preflush
+log_pending_log_flushes recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Pending log flushes
+log_pending_checkpoint_writes recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Pending checkpoints
+log_num_log_io recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Number of log I/Os
+log_waits recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of log waits due to small log buffer (innodb_log_waits)
+log_write_requests recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of log write requests (innodb_log_write_requests)
+log_writes recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of log writes (innodb_log_writes)
+log_padded recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Bytes of log padded for log write ahead
+compress_pages_compressed compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of pages compressed
+compress_pages_decompressed compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of pages decompressed
+compression_pad_increments compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of times padding is incremented to avoid compression failures
+compression_pad_decrements compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of times padding is decremented due to good compressibility
+compress_saved compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of bytes saved by page compression
+compress_pages_page_compressed compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of pages compressed by page compression
+compress_page_compressed_trim_op compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of TRIM operation performed by page compression
+compress_pages_page_decompressed compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of pages decompressed by page compression
+compress_pages_page_compression_error compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of page compression errors
+compress_pages_encrypted compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of pages encrypted
+compress_pages_decrypted compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of pages decrypted
+index_page_splits index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of index page splits
+index_page_merge_attempts index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of index page merge attempts
+index_page_merge_successful index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of successful index page merges
+index_page_reorg_attempts index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of index page reorganization attempts
+index_page_reorg_successful index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of successful index page reorganizations
+index_page_discards index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of index pages discarded
+adaptive_hash_searches adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of successful searches using Adaptive Hash Index
+adaptive_hash_searches_btree adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of searches using B-tree on an index search
+adaptive_hash_pages_added adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of index pages on which the Adaptive Hash Index is built
+adaptive_hash_pages_removed adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of index pages whose corresponding Adaptive Hash Index entries were removed
+adaptive_hash_rows_added adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Adaptive Hash Index rows added
+adaptive_hash_rows_removed adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Adaptive Hash Index rows removed
+adaptive_hash_rows_deleted_no_hash_entry adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of rows deleted that did not have corresponding Adaptive Hash Index entries
+adaptive_hash_rows_updated adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Adaptive Hash Index rows updated
+file_num_open_files file_system 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Number of files currently open (innodb_num_open_files)
+ibuf_merges_insert change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of inserted records merged by change buffering
+ibuf_merges_delete_mark change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of deleted records merged by change buffering
+ibuf_merges_delete change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of purge records merged by change buffering
+ibuf_merges_discard_insert change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of insert merged operations discarded
+ibuf_merges_discard_delete_mark change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of deleted merged operations discarded
+ibuf_merges_discard_delete change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of purge merged operations discarded
+ibuf_merges change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of change buffer merges
+ibuf_size change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Change buffer size in pages
+innodb_master_thread_sleeps server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of times (seconds) master thread sleeps
+innodb_activity_count server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Current server activity count
+innodb_master_active_loops server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of times master thread performs its tasks when server is active
+innodb_master_idle_loops server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of times master thread performs its tasks when server is idle
+innodb_background_drop_table_usec server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Time (in microseconds) spent to process drop table list
+innodb_log_flush_usec server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Time (in microseconds) spent to flush log records
+innodb_mem_validate_usec server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 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 0 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 0 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 0 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 0 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 0 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 0 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 0 status_counter Number of pages that have been written for doublewrite operations (innodb_dblwr_pages_written)
+innodb_page_size server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value InnoDB page size in bytes (innodb_page_size)
+innodb_rwlock_s_spin_waits server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of rwlock spin waits due to shared latch request
+innodb_rwlock_x_spin_waits server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of rwlock spin waits due to exclusive latch request
+innodb_rwlock_sx_spin_waits server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of rwlock spin waits due to sx latch request
+innodb_rwlock_s_spin_rounds server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of rwlock spin loop rounds due to shared latch request
+innodb_rwlock_x_spin_rounds server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of rwlock spin loop rounds due to exclusive latch request
+innodb_rwlock_sx_spin_rounds server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of rwlock spin loop rounds due to sx latch request
+innodb_rwlock_s_os_waits server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of OS waits due to shared latch request
+innodb_rwlock_x_os_waits server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of OS waits due to exclusive latch request
+innodb_rwlock_sx_os_waits server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of OS waits due to sx latch request
+dml_reads dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of rows read
+dml_inserts dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of rows inserted
+dml_deletes dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of rows deleted
+dml_updates dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of rows updated
+dml_system_reads dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of system rows read
+dml_system_inserts dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of system rows inserted
+dml_system_deletes dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of system rows deleted
+dml_system_updates dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of system rows updated
+ddl_background_drop_indexes ddl 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of indexes waiting to be dropped after failed index creation
+ddl_background_drop_tables ddl 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of tables in background drop table list
+ddl_online_create_index ddl 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of indexes being created online
+ddl_pending_alter_table ddl 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of ALTER TABLE, CREATE INDEX, DROP INDEX in progress
+ddl_sort_file_alter_table ddl 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of sort files created during alter table
+ddl_log_file_alter_table ddl 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of log files created during alter table
+icp_attempts icp 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of attempts for index push-down condition checks
+icp_no_match icp 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Index push-down condition does not match
+icp_out_of_range icp 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Index push-down condition out of range
+icp_match icp 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Index push-down condition matches
select * from information_schema.innodb_ft_default_stopword;
value
a
@@ -382,7 +381,7 @@ ID FOR_COL_NAME REF_COL_NAME POS
Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_sys_foreign_cols but the InnoDB storage engine is not installed
select * from information_schema.innodb_sys_tablespaces;
-SPACE NAME FLAG ROW_FORMAT PAGE_SIZE ZIP_PAGE_SIZE SPACE_TYPE FS_BLOCK_SIZE FILE_SIZE ALLOCATED_SIZE
+SPACE NAME FLAG ROW_FORMAT PAGE_SIZE ZIP_PAGE_SIZE FS_BLOCK_SIZE FILE_SIZE ALLOCATED_SIZE
Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_sys_tablespaces but the InnoDB storage engine is not installed
select * from information_schema.innodb_sys_datafiles;
diff --git a/mysql-test/suite/innodb/r/monitor.result b/mysql-test/suite/innodb/r/monitor.result
index 4aea9fb5b0b..16aa8630012 100644
--- a/mysql-test/suite/innodb/r/monitor.result
+++ b/mysql-test/suite/innodb/r/monitor.result
@@ -1,5 +1,6 @@
set global innodb_monitor_disable = All;
-select name, status from information_schema.innodb_metrics;
+select name, if(enabled,'enabled','disabled') status
+from information_schema.innodb_metrics;
name status
metadata_table_handles_opened disabled
metadata_table_handles_closed disabled
@@ -213,7 +214,6 @@ innodb_activity_count disabled
innodb_master_active_loops disabled
innodb_master_idle_loops disabled
innodb_background_drop_table_usec disabled
-innodb_ibuf_merge_usec disabled
innodb_log_flush_usec disabled
innodb_mem_validate_usec disabled
innodb_master_purge_usec disabled
@@ -252,22 +252,23 @@ icp_no_match disabled
icp_out_of_range disabled
icp_match disabled
set global innodb_monitor_enable = all;
-select name from information_schema.innodb_metrics where status!='enabled';
+select name from information_schema.innodb_metrics where not enabled;
name
set global innodb_monitor_enable = aaa;
ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of 'aaa'
set global innodb_monitor_disable = All;
-select name from information_schema.innodb_metrics where status!='disabled';
+select name from information_schema.innodb_metrics where enabled;
name
set global innodb_monitor_reset_all = all;
select name from information_schema.innodb_metrics where count!=0;
name
set global innodb_monitor_enable = "%lock%";
select name from information_schema.innodb_metrics
-where status != IF(name like "%lock%", 'enabled', 'disabled');
+where enabled != (name like "%lock%");
name
set global innodb_monitor_disable = "%lock%";
-select name, status from information_schema.innodb_metrics
+select name, if(enabled,'enabled','disabled') status
+from information_schema.innodb_metrics
where name like "%lock%";
name status
lock_deadlocks disabled
@@ -298,24 +299,25 @@ innodb_rwlock_sx_os_waits disabled
set global innodb_monitor_enable = "%lock*";
ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of '%lock*'
set global innodb_monitor_enable="%%%%%%%%%%%%%%%%%%%%%%%%%%%";
-select name from information_schema.innodb_metrics where status!='enabled';
+select name from information_schema.innodb_metrics where not enabled;
name
set global innodb_monitor_disable="%%%%%";
-select name from information_schema.innodb_metrics where status!='disabled';
+select name from information_schema.innodb_metrics where enabled;
name
set global innodb_monitor_enable="%";
-select name from information_schema.innodb_metrics where status!='enabled';
+select name from information_schema.innodb_metrics where not enabled;
name
set global innodb_monitor_disable="%_%";
-select name from information_schema.innodb_metrics where status!='disabled';
+select name from information_schema.innodb_metrics where enabled;
name
set global innodb_monitor_enable="log%%%%";
select name from information_schema.innodb_metrics
-where status != IF(name like "log%", 'enabled', 'disabled');
+where enabled != (name like "log%");
name
set global innodb_monitor_enable="os_%a_fs_ncs";
set global innodb_monitor_enable="os%pending%";
-select name, status from information_schema.innodb_metrics
+select name, if(enabled,'enabled','disabled') status
+from information_schema.innodb_metrics
where name like "os%";
name status
os_data_reads disabled
@@ -338,14 +340,16 @@ create table monitor_test(col int) engine = innodb;
select * from monitor_test;
col
select name, max_count, min_count, count,
-max_count_reset, min_count_reset, count_reset, status
+max_count_reset, min_count_reset, count_reset,
+if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name = "metadata_table_handles_opened";
name max_count min_count count max_count_reset min_count_reset count_reset status
metadata_table_handles_opened 1 NULL 1 1 NULL 1 enabled
set global innodb_monitor_reset = metadata_table_handles_opened;
select name, max_count, min_count, count,
-max_count_reset, min_count_reset, count_reset, status
+max_count_reset, min_count_reset, count_reset,
+if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name = "metadata_table_handles_opened";
name max_count min_count count max_count_reset min_count_reset count_reset status
@@ -355,14 +359,16 @@ create table monitor_test(col int) engine = innodb;
select * from monitor_test;
col
select name, max_count, min_count, count,
-max_count_reset, min_count_reset, count_reset, status
+max_count_reset, min_count_reset, count_reset,
+if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name = "metadata_table_handles_opened";
name max_count min_count count max_count_reset min_count_reset count_reset status
metadata_table_handles_opened 2 NULL 2 1 NULL 1 enabled
set global innodb_monitor_reset_all = metadata_table_handles_opened;
select name, max_count, min_count, count,
-max_count_reset, min_count_reset, count_reset, status
+max_count_reset, min_count_reset, count_reset,
+if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name = "metadata_table_handles_opened";
name max_count min_count count max_count_reset min_count_reset count_reset status
@@ -370,7 +376,8 @@ metadata_table_handles_opened 2 NULL 2 1 NULL 1 enabled
set global innodb_monitor_disable = metadata_table_handles_opened;
set global innodb_monitor_reset = metadata_table_handles_opened;
select name, max_count, min_count, count,
-max_count_reset, min_count_reset, count_reset, status
+max_count_reset, min_count_reset, count_reset,
+if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name = "metadata_table_handles_opened";
name max_count min_count count max_count_reset min_count_reset count_reset status
@@ -380,14 +387,16 @@ create table monitor_test(col int) engine = innodb;
select * from monitor_test;
col
select name, max_count, min_count, count,
-max_count_reset, min_count_reset, count_reset, status
+max_count_reset, min_count_reset, count_reset,
+if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name = "metadata_table_handles_opened";
name max_count min_count count max_count_reset min_count_reset count_reset status
metadata_table_handles_opened 2 NULL 2 NULL NULL 0 disabled
set global innodb_monitor_reset_all = metadata_table_handles_opened;
select name, max_count, min_count, count,
-max_count_reset, min_count_reset, count_reset, status
+max_count_reset, min_count_reset, count_reset,
+if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name = "metadata_table_handles_opened";
name max_count min_count count max_count_reset min_count_reset count_reset status
@@ -398,7 +407,8 @@ create table monitor_test(col int) engine = innodb stats_persistent=0;
select * from monitor_test;
col
select name, max_count, min_count, count,
-max_count_reset, min_count_reset, count_reset, status
+max_count_reset, min_count_reset, count_reset,
+if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name = "metadata_table_handles_opened";
name max_count min_count count max_count_reset min_count_reset count_reset status
@@ -406,32 +416,36 @@ metadata_table_handles_opened 1 NULL 1 1 NULL 1 enabled
set global innodb_monitor_enable = metadata_table_handles_closed;
create index idx on monitor_test(col);
select name, max_count, min_count, count,
-max_count_reset, min_count_reset, count_reset, status
+max_count_reset, min_count_reset, count_reset,
+if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name = "metadata_table_handles_closed";
name max_count min_count count max_count_reset min_count_reset count_reset status
metadata_table_handles_closed 1 NULL 1 1 NULL 1 enabled
select name, max_count, min_count, count,
-max_count_reset, min_count_reset, count_reset, status
+max_count_reset, min_count_reset, count_reset,
+if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name like "metadata%";
name max_count min_count count max_count_reset min_count_reset count_reset status
-metadata_table_handles_opened 2 NULL 2 2 NULL 2 enabled
+metadata_table_handles_opened 1 NULL 1 1 NULL 1 enabled
metadata_table_handles_closed 1 NULL 1 1 NULL 1 enabled
metadata_table_reference_count NULL NULL 0 NULL NULL 0 disabled
set global innodb_monitor_disable = module_metadata;
set global innodb_monitor_reset = module_metadata;
select name, max_count, min_count, count,
-max_count_reset, min_count_reset, count_reset, status
+max_count_reset, min_count_reset, count_reset,
+if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name like "metadata%";
name max_count min_count count max_count_reset min_count_reset count_reset status
-metadata_table_handles_opened 2 NULL 2 NULL NULL 0 disabled
+metadata_table_handles_opened 1 NULL 1 NULL NULL 0 disabled
metadata_table_handles_closed 1 NULL 1 NULL NULL 0 disabled
metadata_table_reference_count NULL NULL 0 NULL NULL 0 disabled
set global innodb_monitor_reset_all = module_metadata;
select name, max_count, min_count, count,
-max_count_reset, min_count_reset, count_reset, status
+max_count_reset, min_count_reset, count_reset,
+if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name like "metadata%";
name max_count min_count count max_count_reset min_count_reset count_reset status
@@ -446,7 +460,8 @@ begin;
insert into monitor_test values(9);
rollback;
select name, max_count, min_count, count,
-max_count_reset, min_count_reset, count_reset, status
+max_count_reset, min_count_reset, count_reset,
+if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name like "trx_rollbacks" or name like "trx_active_transactions";
name max_count min_count count max_count_reset min_count_reset count_reset status
@@ -457,7 +472,8 @@ set global innodb_monitor_enable = module_dml;
insert into monitor_test values(9);
update monitor_test set col = 10 where col = 9;
select name, max_count, min_count, count,
-max_count_reset, min_count_reset, count_reset, status
+max_count_reset, min_count_reset, count_reset,
+if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name like "dml%";
name max_count min_count count max_count_reset min_count_reset count_reset status
@@ -471,7 +487,8 @@ dml_system_deletes 0 NULL 0 0 NULL 0 enabled
dml_system_updates 0 NULL 0 0 NULL 0 enabled
delete from monitor_test;
select name, max_count, min_count, count,
-max_count_reset, min_count_reset, count_reset, status
+max_count_reset, min_count_reset, count_reset,
+if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name like "dml%";
name max_count min_count count max_count_reset min_count_reset count_reset status
@@ -485,7 +502,8 @@ dml_system_deletes 0 NULL 0 0 NULL 0 enabled
dml_system_updates 0 NULL 0 0 NULL 0 enabled
set global innodb_monitor_reset = module_dml;
select name, max_count, min_count, count,
-max_count_reset, min_count_reset, count_reset, status
+max_count_reset, min_count_reset, count_reset,
+if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name like "dml%";
name max_count min_count count max_count_reset min_count_reset count_reset status
@@ -501,7 +519,8 @@ insert into monitor_test values(9);
insert into monitor_test values(1);
delete from monitor_test;
select name, max_count, min_count, count,
-max_count_reset, min_count_reset, count_reset, status
+max_count_reset, min_count_reset, count_reset,
+if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name like "dml%";
name max_count min_count count max_count_reset min_count_reset count_reset status
@@ -515,7 +534,8 @@ dml_system_deletes 0 NULL 0 0 NULL 0 enabled
dml_system_updates 0 NULL 0 0 NULL 0 enabled
set global innodb_monitor_reset_all = module_dml;
select name, max_count, min_count, count,
-max_count_reset, min_count_reset, count_reset, status
+max_count_reset, min_count_reset, count_reset,
+if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name like "dml%";
name max_count min_count count max_count_reset min_count_reset count_reset status
@@ -529,7 +549,8 @@ dml_system_deletes 0 NULL 0 0 NULL 0 enabled
dml_system_updates 0 NULL 0 0 NULL 0 enabled
set global innodb_monitor_disable = module_dml;
select name, max_count, min_count, count,
-max_count_reset, min_count_reset, count_reset, status
+max_count_reset, min_count_reset, count_reset,
+if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name like "dml%";
name max_count min_count count max_count_reset min_count_reset count_reset status
@@ -543,7 +564,8 @@ dml_system_deletes 0 NULL 0 0 NULL 0 disabled
dml_system_updates 0 NULL 0 0 NULL 0 disabled
set global innodb_monitor_reset_all = module_dml;
select name, max_count, min_count, count,
-max_count_reset, min_count_reset, count_reset, status
+max_count_reset, min_count_reset, count_reset,
+if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name like "dml%";
name max_count min_count count max_count_reset min_count_reset count_reset status
@@ -560,7 +582,8 @@ insert into monitor_test values(9);
insert into monitor_test values(1);
delete from monitor_test;
select name, max_count, min_count, count,
-max_count_reset, min_count_reset, count_reset, status
+max_count_reset, min_count_reset, count_reset,
+if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name like "dml%";
name max_count min_count count max_count_reset min_count_reset count_reset status
@@ -576,7 +599,8 @@ set global innodb_monitor_disable = module_dml;
drop table monitor_test;
set global innodb_monitor_enable = file_num_open_files;
select name, max_count, min_count, count,
-max_count_reset, min_count_reset, count_reset, status
+max_count_reset, min_count_reset, count_reset,
+if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name like "file_num_open_files";
name max_count min_count count max_count_reset min_count_reset count_reset status
diff --git a/mysql-test/suite/innodb/r/undo_truncate.result b/mysql-test/suite/innodb/r/undo_truncate.result
index dce91a7461e..ad236bdecd4 100644
--- a/mysql-test/suite/innodb/r/undo_truncate.result
+++ b/mysql-test/suite/innodb/r/undo_truncate.result
@@ -1,8 +1,6 @@
-SET @save_undo_logs = @@GLOBAL.innodb_undo_logs;
SET @save_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET @save_truncate = @@GLOBAL.innodb_undo_log_truncate;
SET GLOBAL innodb_undo_log_truncate = 0;
-SET GLOBAL innodb_undo_logs = 4;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
SET @trunc_start=
(SELECT variable_value FROM information_schema.global_status
@@ -55,6 +53,5 @@ drop table t1, t2;
drop PROCEDURE populate_t1;
drop PROCEDURE populate_t2;
InnoDB 0 transactions not purged
-SET GLOBAL innodb_undo_logs = @save_undo_logs;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @save_frequency;
SET GLOBAL innodb_undo_log_truncate = @save_truncate;
diff --git a/mysql-test/suite/innodb/r/undo_truncate_recover.result b/mysql-test/suite/innodb/r/undo_truncate_recover.result
index 428a2dec0bb..909771e6a17 100644
--- a/mysql-test/suite/innodb/r/undo_truncate_recover.result
+++ b/mysql-test/suite/innodb/r/undo_truncate_recover.result
@@ -1,4 +1,3 @@
-SET GLOBAL innodb_undo_logs = 4;
SET GLOBAL innodb_undo_log_truncate = 1;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
create table t1(keyc int primary key, c char(100)) engine = innodb;
diff --git a/mysql-test/suite/innodb/t/alter_copy.test b/mysql-test/suite/innodb/t/alter_copy.test
index b7ab05a061a..e85b94d467f 100644
--- a/mysql-test/suite/innodb/t/alter_copy.test
+++ b/mysql-test/suite/innodb/t/alter_copy.test
@@ -2,6 +2,8 @@
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/not_embedded.inc
+# Valgrind gives leaks from the first shutdown which confuses mtr
+#--source include/not_valgrind.inc
--echo #
--echo # MDEV-11415 AVOID INTERMEDIATE COMMIT WHILE DOING
diff --git a/mysql-test/suite/innodb/t/innodb-analyze.test b/mysql-test/suite/innodb/t/innodb-analyze.test
index 0fec9968c1f..db699ad41a0 100644
--- a/mysql-test/suite/innodb/t/innodb-analyze.test
+++ b/mysql-test/suite/innodb/t/innodb-analyze.test
@@ -1,21 +1,17 @@
--source include/have_innodb.inc
#
# Test that mysqld does not crash when running ANALYZE TABLE with
-# different values of the parameter innodb_stats_sample_pages.
+# different values of the parameter innodb_stats_transient_sample_pages.
#
# we care only that the following SQL commands do not produce errors
# and do not crash the server
-- disable_query_log
--- disable_result_log
-- enable_warnings
-let $sample_pages=`select @@innodb_stats_sample_pages`;
-SET GLOBAL innodb_stats_sample_pages=0;
-
-# check that the value has been adjusted to 1
--- enable_result_log
-SHOW VARIABLES LIKE 'innodb_stats_sample_pages';
+SET @save_sample_pages = @@GLOBAL.innodb_stats_transient_sample_pages;
+SET GLOBAL innodb_stats_transient_sample_pages=0;
+SHOW VARIABLES LIKE 'innodb_stats_transient_sample_pages';
-- disable_result_log
CREATE TABLE innodb_analyze (
@@ -29,36 +25,36 @@ CREATE TABLE innodb_analyze (
ANALYZE TABLE innodb_analyze;
-SET GLOBAL innodb_stats_sample_pages=2;
+SET GLOBAL innodb_stats_transient_sample_pages=2;
ANALYZE TABLE innodb_analyze;
-SET GLOBAL innodb_stats_sample_pages=4;
+SET GLOBAL innodb_stats_transient_sample_pages=4;
ANALYZE TABLE innodb_analyze;
-SET GLOBAL innodb_stats_sample_pages=8;
+SET GLOBAL innodb_stats_transient_sample_pages=8;
ANALYZE TABLE innodb_analyze;
-SET GLOBAL innodb_stats_sample_pages=16;
+SET GLOBAL innodb_stats_transient_sample_pages=16;
ANALYZE TABLE innodb_analyze;
INSERT INTO innodb_analyze VALUES
(1,1), (1,1), (1,2), (1,3), (1,4), (1,5),
(8,1), (8,8), (8,2), (7,1), (1,4), (3,5);
-SET GLOBAL innodb_stats_sample_pages=1;
+SET GLOBAL innodb_stats_transient_sample_pages=1;
ANALYZE TABLE innodb_analyze;
-SET GLOBAL innodb_stats_sample_pages=2;
+SET GLOBAL innodb_stats_transient_sample_pages=2;
ANALYZE TABLE innodb_analyze;
-SET GLOBAL innodb_stats_sample_pages=4;
+SET GLOBAL innodb_stats_transient_sample_pages=4;
ANALYZE TABLE innodb_analyze;
-SET GLOBAL innodb_stats_sample_pages=8;
+SET GLOBAL innodb_stats_transient_sample_pages=8;
ANALYZE TABLE innodb_analyze;
-SET GLOBAL innodb_stats_sample_pages=16;
+SET GLOBAL innodb_stats_transient_sample_pages=16;
ANALYZE TABLE innodb_analyze;
DROP TABLE innodb_analyze;
-EVAL SET GLOBAL innodb_stats_sample_pages=$sample_pages;
+SET GLOBAL innodb_stats_transient_sample_pages = @save_sample_pages;
diff --git a/mysql-test/suite/innodb/t/innodb-stats-sample.test b/mysql-test/suite/innodb/t/innodb-stats-sample.test
index 35d35bfa382..600688ab98d 100644
--- a/mysql-test/suite/innodb/t/innodb-stats-sample.test
+++ b/mysql-test/suite/innodb/t/innodb-stats-sample.test
@@ -1,24 +1,20 @@
--source include/have_innodb.inc
#
# Test that mysqld does not crash when running ANALYZE TABLE with
-# different values of the parameter innodb_stats_sample_pages.
+# different values of the parameter innodb_stats_transient_sample_pages.
#
# we care only that the following SQL commands do not produce errors
# and do not crash the server
-- disable_query_log
--- disable_result_log
-- enable_warnings
-let $sample_pages=`select @@innodb_stats_sample_pages`;
-let $traditional=`select @@innodb_stats_traditional`;
-SET GLOBAL innodb_stats_sample_pages=0;
+SET @save_sample_pages = @@GLOBAL.innodb_stats_transient_sample_pages;
+SET @save_traditional = @@GLOBAL.innodb_stats_traditional;
+SET GLOBAL innodb_stats_transient_sample_pages=0;
#use new method to calculate statistics
SET GLOBAL innodb_stats_traditional=0;
-
-# check that the value has been adjusted to 1
--- enable_result_log
-SHOW VARIABLES LIKE 'innodb_stats_sample_pages';
+SHOW VARIABLES LIKE 'innodb_stats_transient_sample_pages';
SHOW VARIABLES LIKE 'innodb_stats_traditional';
-- disable_result_log
@@ -33,13 +29,13 @@ CREATE TABLE innodb_analyze (
# test with empty table
ANALYZE TABLE innodb_analyze;
-SET GLOBAL innodb_stats_sample_pages=2;
+SET GLOBAL innodb_stats_transient_sample_pages=2;
ANALYZE TABLE innodb_analyze;
-SET GLOBAL innodb_stats_sample_pages=1;
+SET GLOBAL innodb_stats_transient_sample_pages=1;
ANALYZE TABLE innodb_analyze;
-SET GLOBAL innodb_stats_sample_pages=8000;
+SET GLOBAL innodb_stats_transient_sample_pages=8000;
ANALYZE TABLE innodb_analyze;
delimiter //;
@@ -60,19 +56,19 @@ call innodb_insert_proc(7000);
commit;
set autocommit=1;
-SET GLOBAL innodb_stats_sample_pages=1;
+SET GLOBAL innodb_stats_transient_sample_pages=1;
ANALYZE TABLE innodb_analyze;
-SET GLOBAL innodb_stats_sample_pages=8;
+SET GLOBAL innodb_stats_transient_sample_pages=8;
ANALYZE TABLE innodb_analyze;
-SET GLOBAL innodb_stats_sample_pages=16;
+SET GLOBAL innodb_stats_transient_sample_pages=16;
ANALYZE TABLE innodb_analyze;
-SET GLOBAL innodb_stats_sample_pages=8000;
+SET GLOBAL innodb_stats_transient_sample_pages=8000;
ANALYZE TABLE innodb_analyze;
DROP PROCEDURE innodb_insert_proc;
DROP TABLE innodb_analyze;
-EVAL SET GLOBAL innodb_stats_sample_pages=$sample_pages;
-EVAL SET GLOBAL innodb_stats_traditional=$traditional; \ No newline at end of file
+SET GLOBAL innodb_stats_transient_sample_pages = @save_sample_pages;
+SET GLOBAL innodb_stats_traditional = @save_traditional;
diff --git a/mysql-test/suite/innodb/t/innodb-wl5522-debug.test b/mysql-test/suite/innodb/t/innodb-wl5522-debug.test
index b223113b6ff..e8e02d1aeba 100644
--- a/mysql-test/suite/innodb/t/innodb-wl5522-debug.test
+++ b/mysql-test/suite/innodb/t/innodb-wl5522-debug.test
@@ -1047,9 +1047,6 @@ connect (purge_control,localhost,root);
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection default;
-# Disable change buffer merge from the master thread, additionally
-# enable aggressive flushing so that more changes are buffered.
-SET GLOBAL innodb_disable_background_merge=ON;
SET GLOBAL innodb_monitor_reset = ibuf_merges;
SET GLOBAL innodb_monitor_reset = ibuf_merges_insert;
@@ -1112,8 +1109,6 @@ SELECT name
FROM information_schema.innodb_metrics
WHERE name = 'ibuf_merges_inserts' AND count > 0;
-SET GLOBAL innodb_disable_background_merge=OFF;
-
# Enable normal operation
connection purge_control;
COMMIT;
diff --git a/mysql-test/suite/innodb/t/innodb-wl5522.test b/mysql-test/suite/innodb/t/innodb-wl5522.test
index 744768a1d6c..e17ccf24fa6 100644
--- a/mysql-test/suite/innodb/t/innodb-wl5522.test
+++ b/mysql-test/suite/innodb/t/innodb-wl5522.test
@@ -312,8 +312,11 @@ EOF
# This is really a name mismatch error, need better error codes.
-- error ER_TABLE_SCHEMA_MISMATCH
ALTER TABLE t1 IMPORT TABLESPACE;
-
+--error ER_TABLESPACE_DISCARDED
+select count(*) from t1;
ALTER TABLE t1 DROP INDEX x;
+--error ER_CANT_DROP_FIELD_OR_KEY
+ALTER TABLE t1 DROP INDEX x, ALGORITHM=copy;
ALTER TABLE t1 ADD INDEX idx(c2);
perl;
diff --git a/mysql-test/suite/innodb/t/innodb_bug12400341-master.opt b/mysql-test/suite/innodb/t/innodb_bug12400341-master.opt
index 13f480704f5..9f65e8b12e4 100644
--- a/mysql-test/suite/innodb/t/innodb_bug12400341-master.opt
+++ b/mysql-test/suite/innodb/t/innodb_bug12400341-master.opt
@@ -1 +1 @@
---max_connections=64 --innodb_thread_concurrency=0 --innodb_file_per_table --innodb_rollback_segments=2
+--max_connections=64 --innodb_thread_concurrency=0
diff --git a/mysql-test/suite/innodb/t/innodb_bug12400341.test b/mysql-test/suite/innodb/t/innodb_bug12400341.test
index 5fb0d63ebe7..3b5fd18a456 100644
--- a/mysql-test/suite/innodb/t/innodb_bug12400341.test
+++ b/mysql-test/suite/innodb/t/innodb_bug12400341.test
@@ -18,9 +18,6 @@ set @old_innodb_trx_rseg_n_slots_debug = @@innodb_trx_rseg_n_slots_debug;
set global innodb_trx_rseg_n_slots_debug = 32;
--enable_query_log
-set @old_innodb_undo_logs = @@innodb_undo_logs;
-set global innodb_undo_logs=1;
-
show variables like "max_connections";
show variables like "innodb_thread_concurrency";
show variables like "innodb_file_per_table";
@@ -105,8 +102,6 @@ while ($c)
#
drop database mysqltest;
-set global innodb_undo_logs = @old_innodb_undo_logs;
-
--disable_query_log
set global innodb_trx_rseg_n_slots_debug = @old_innodb_trx_rseg_n_slots_debug;
--enable_query_log
diff --git a/mysql-test/suite/innodb/t/innodb_bug53674-master.opt b/mysql-test/suite/innodb/t/innodb_bug53674-master.opt
index 1fe48c3a33a..01cf3e0520f 100644
--- a/mysql-test/suite/innodb/t/innodb_bug53674-master.opt
+++ b/mysql-test/suite/innodb/t/innodb_bug53674-master.opt
@@ -1 +1 @@
---loose-innodb-locks-unsafe-for-binlog --binlog-format=mixed
+--binlog-format=mixed
diff --git a/mysql-test/suite/innodb/t/innodb_force_recovery.test b/mysql-test/suite/innodb/t/innodb_force_recovery.test
index fe070100c08..bd9554e6b6e 100644
--- a/mysql-test/suite/innodb/t/innodb_force_recovery.test
+++ b/mysql-test/suite/innodb/t/innodb_force_recovery.test
@@ -17,47 +17,33 @@ insert into t2 values(1, 2);
SET GLOBAL innodb_fast_shutdown = 0;
---echo # Restart the server with innodb_force_recovery as 4.
--let $restart_parameters= --innodb-force-recovery=4
--source include/restart_mysqld.inc
let $status=`SHOW ENGINE INNODB STATUS`;
select * from t1;
---error ER_READ_ONLY_MODE
+begin;
insert into t1 values(2, 3);
+rollback;
---error ER_CANT_CREATE_TABLE
alter table t1 add f3 int not null, algorithm=copy;
---error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
-alter table t1 add f3 int not null, algorithm=inplace;
+alter table t1 add f4 int not null, algorithm=inplace;
---error ER_CANT_CREATE_TABLE
drop index idx on t1;
---error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
-alter table t1 drop index idx, algorithm=inplace;
---error ER_READ_ONLY_MODE
update t1 set f1=3 where f2=2;
---error ER_CANT_CREATE_TABLE
create table t3(f1 int not null)engine=innodb;
-
---error ER_BAD_TABLE_ERROR
drop table t3;
---error ER_ERROR_ON_RENAME
rename table t1 to t3;
-
---error ER_OPEN_AS_READONLY
+rename table t3 to t1;
truncate table t1;
---error ER_OPEN_AS_READONLY
-drop table t1;
show tables;
---echo # Restart the server with innodb_force_recovery as 5.
--let $restart_parameters= --innodb-force-recovery=5
--source include/restart_mysqld.inc
let $status=`SHOW ENGINE INNODB STATUS`;
@@ -98,7 +84,6 @@ create schema db;
drop schema db;
show tables;
---echo # Restart the server with innodb_force_recovery as 6.
--let $restart_parameters= --innodb-force-recovery=6
--source include/restart_mysqld.inc
let $status=`SHOW ENGINE INNODB STATUS`;
@@ -136,7 +121,6 @@ truncate table t2;
drop table t2;
show tables;
---echo # Restart the server with innodb_force_recovery=2
--let $restart_parameters= --innodb-force-recovery=2
--source include/restart_mysqld.inc
let $status=`SHOW ENGINE INNODB STATUS`;
@@ -154,7 +138,6 @@ disconnect con1;
connection default;
--source include/kill_mysqld.inc
---echo # Restart the server with innodb_force_recovery=3
--let $restart_parameters= --innodb-force-recovery=3
--source include/start_mysqld.inc
let $status=`SHOW ENGINE INNODB STATUS`;
diff --git a/mysql-test/suite/innodb/t/innodb_lock_wait_timeout_1.test b/mysql-test/suite/innodb/t/innodb_lock_wait_timeout_1.test
index 23e8b40b010..ea31d4a14c5 100644
--- a/mysql-test/suite/innodb/t/innodb_lock_wait_timeout_1.test
+++ b/mysql-test/suite/innodb/t/innodb_lock_wait_timeout_1.test
@@ -49,9 +49,6 @@ DROP TABLE t2, t1;
--echo # Bug#46539 Various crashes on INSERT IGNORE SELECT + SELECT
--echo # FOR UPDATE
--echo #
---disable_warnings
-drop table if exists t1;
---enable_warnings
create table t1 (a int primary key auto_increment,
b int, index(b)) engine=innodb;
insert into t1 (b) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
@@ -107,21 +104,12 @@ drop table t1, t2;
--echo #
--echo # Bug#41756 Strange error messages about locks from InnoDB
--echo #
---disable_warnings
-drop table if exists t1;
---enable_warnings
---echo # In the default transaction isolation mode, and/or with
---echo # innodb_locks_unsafe_for_binlog=OFF, handler::unlock_row()
---echo # in InnoDB does nothing.
+--echo # In the default transaction isolation mode,
+--echo # handler::unlock_row() in InnoDB does nothing.
--echo # Thus in order to reproduce the condition that led to the
--echo # warning, one needs to relax isolation by either
--echo # setting a weaker tx_isolation value, or by turning on
--echo # the unsafe replication switch.
---echo # For testing purposes, choose to tweak the isolation level,
---echo # since it's settable at runtime, unlike
---echo # innodb_locks_unsafe_for_binlog, which is
---echo # only a command-line switch.
---echo #
set @@session.tx_isolation="read-committed";
--echo # Prepare data. We need a table with a unique index,
diff --git a/mysql-test/suite/innodb/t/log_file_name.test b/mysql-test/suite/innodb/t/log_file_name.test
index 9df1c6eed5a..3e1099ac8df 100644
--- a/mysql-test/suite/innodb/t/log_file_name.test
+++ b/mysql-test/suite/innodb/t/log_file_name.test
@@ -2,6 +2,7 @@
# Test the detection of duplicate tablespaces.
--source include/have_innodb.inc
+--source include/not_valgrind.inc
# Embedded server does not support crashing
--source include/not_embedded.inc
diff --git a/mysql-test/suite/innodb/t/monitor.test b/mysql-test/suite/innodb/t/monitor.test
index 3535c9c85ad..10a0219767d 100644
--- a/mysql-test/suite/innodb/t/monitor.test
+++ b/mysql-test/suite/innodb/t/monitor.test
@@ -8,13 +8,14 @@
set global innodb_monitor_disable = All;
# Test turn on/off the monitor counter with "all" option
# By default, they will be off.
-select name, status from information_schema.innodb_metrics;
+select name, if(enabled,'enabled','disabled') status
+from information_schema.innodb_metrics;
# Turn on all monitor counters
set global innodb_monitor_enable = all;
# status should all change to "enabled"
-select name from information_schema.innodb_metrics where status!='enabled';
+select name from information_schema.innodb_metrics where not enabled;
# Test wrong argument to the global configure option
--error ER_WRONG_VALUE_FOR_VAR
@@ -32,7 +33,7 @@ set global innodb_monitor_enable = aaa;
set global innodb_monitor_disable = All;
# status should all change to "disabled"
-select name from information_schema.innodb_metrics where status!='disabled';
+select name from information_schema.innodb_metrics where enabled;
# Reset all counter values
set global innodb_monitor_reset_all = all;
@@ -45,13 +46,14 @@ set global innodb_monitor_enable = "%lock%";
# All lock related counter should be enabled
select name from information_schema.innodb_metrics
-where status != IF(name like "%lock%", 'enabled', 'disabled');
+where enabled != (name like "%lock%");
# Disable them
set global innodb_monitor_disable = "%lock%";
# All lock related counter should be disabled
-select name, status from information_schema.innodb_metrics
+select name, if(enabled,'enabled','disabled') status
+from information_schema.innodb_metrics
where name like "%lock%";
# No match for "%lock*"
@@ -61,29 +63,29 @@ set global innodb_monitor_enable = "%lock*";
# All counters will be turned on with wildcard match string with all "%"
set global innodb_monitor_enable="%%%%%%%%%%%%%%%%%%%%%%%%%%%";
-select name from information_schema.innodb_metrics where status!='enabled';
+select name from information_schema.innodb_metrics where not enabled;
# Turn off all counters
set global innodb_monitor_disable="%%%%%";
-select name from information_schema.innodb_metrics where status!='disabled';
+select name from information_schema.innodb_metrics where enabled;
# One more round testing. All counters will be turned on with
# single wildcard character "%"
set global innodb_monitor_enable="%";
-select name from information_schema.innodb_metrics where status!='enabled';
+select name from information_schema.innodb_metrics where not enabled;
# Turn off all the counters with "%_%"
set global innodb_monitor_disable="%_%";
-select name from information_schema.innodb_metrics where status!='disabled';
+select name from information_schema.innodb_metrics where enabled;
# Turn on all counters start with "log"
set global innodb_monitor_enable="log%%%%";
select name from information_schema.innodb_metrics
-where status != IF(name like "log%", 'enabled', 'disabled');
+where enabled != (name like "log%");
# Turn on counters "os_data_fsync" with wildcard match "os_%a_fs_ncs", "_"
# is single character wildcard match word
@@ -93,7 +95,8 @@ set global innodb_monitor_enable="os_%a_fs_ncs";
# wildcard match "os%pending%"
set global innodb_monitor_enable="os%pending%";
-select name, status from information_schema.innodb_metrics
+select name, if(enabled,'enabled','disabled') status
+from information_schema.innodb_metrics
where name like "os%";
# Empty string is an invalid option
@@ -117,7 +120,8 @@ select * from monitor_test;
# "metadata_table_handles_opened" should increment by 1
select name, max_count, min_count, count,
- max_count_reset, min_count_reset, count_reset, status
+ max_count_reset, min_count_reset, count_reset,
+ if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name = "metadata_table_handles_opened";
@@ -127,7 +131,8 @@ where name = "metadata_table_handles_opened";
set global innodb_monitor_reset = metadata_table_handles_opened;
select name, max_count, min_count, count,
- max_count_reset, min_count_reset, count_reset, status
+ max_count_reset, min_count_reset, count_reset,
+ if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name = "metadata_table_handles_opened";
@@ -141,7 +146,8 @@ select * from monitor_test;
# "metadata_table_handles_opened" should increment
select name, max_count, min_count, count,
- max_count_reset, min_count_reset, count_reset, status
+ max_count_reset, min_count_reset, count_reset,
+ if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name = "metadata_table_handles_opened";
@@ -149,7 +155,8 @@ where name = "metadata_table_handles_opened";
set global innodb_monitor_reset_all = metadata_table_handles_opened;
select name, max_count, min_count, count,
- max_count_reset, min_count_reset, count_reset, status
+ max_count_reset, min_count_reset, count_reset,
+ if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name = "metadata_table_handles_opened";
@@ -160,7 +167,8 @@ set global innodb_monitor_disable = metadata_table_handles_opened;
set global innodb_monitor_reset = metadata_table_handles_opened;
select name, max_count, min_count, count,
- max_count_reset, min_count_reset, count_reset, status
+ max_count_reset, min_count_reset, count_reset,
+ if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name = "metadata_table_handles_opened";
@@ -175,7 +183,8 @@ create table monitor_test(col int) engine = innodb;
select * from monitor_test;
select name, max_count, min_count, count,
- max_count_reset, min_count_reset, count_reset, status
+ max_count_reset, min_count_reset, count_reset,
+ if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name = "metadata_table_handles_opened";
@@ -183,7 +192,8 @@ where name = "metadata_table_handles_opened";
set global innodb_monitor_reset_all = metadata_table_handles_opened;
select name, max_count, min_count, count,
- max_count_reset, min_count_reset, count_reset, status
+ max_count_reset, min_count_reset, count_reset,
+ if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name = "metadata_table_handles_opened";
@@ -201,7 +211,8 @@ select * from monitor_test;
# "metadata_table_handles_opened" should increment
select name, max_count, min_count, count,
- max_count_reset, min_count_reset, count_reset, status
+ max_count_reset, min_count_reset, count_reset,
+ if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name = "metadata_table_handles_opened";
@@ -212,12 +223,14 @@ set global innodb_monitor_enable = metadata_table_handles_closed;
create index idx on monitor_test(col);
select name, max_count, min_count, count,
- max_count_reset, min_count_reset, count_reset, status
+ max_count_reset, min_count_reset, count_reset,
+ if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name = "metadata_table_handles_closed";
select name, max_count, min_count, count,
- max_count_reset, min_count_reset, count_reset, status
+ max_count_reset, min_count_reset, count_reset,
+ if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name like "metadata%";
@@ -227,14 +240,16 @@ set global innodb_monitor_disable = module_metadata;
set global innodb_monitor_reset = module_metadata;
select name, max_count, min_count, count,
- max_count_reset, min_count_reset, count_reset, status
+ max_count_reset, min_count_reset, count_reset,
+ if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name like "metadata%";
set global innodb_monitor_reset_all = module_metadata;
select name, max_count, min_count, count,
- max_count_reset, min_count_reset, count_reset, status
+ max_count_reset, min_count_reset, count_reset,
+ if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name like "metadata%";
@@ -250,7 +265,8 @@ insert into monitor_test values(9);
rollback;
select name, max_count, min_count, count,
- max_count_reset, min_count_reset, count_reset, status
+ max_count_reset, min_count_reset, count_reset,
+ if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name like "trx_rollbacks" or name like "trx_active_transactions";
@@ -264,14 +280,16 @@ insert into monitor_test values(9);
update monitor_test set col = 10 where col = 9;
select name, max_count, min_count, count,
- max_count_reset, min_count_reset, count_reset, status
+ max_count_reset, min_count_reset, count_reset,
+ if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name like "dml%";
delete from monitor_test;
select name, max_count, min_count, count,
- max_count_reset, min_count_reset, count_reset, status
+ max_count_reset, min_count_reset, count_reset,
+ if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name like "dml%";
@@ -279,7 +297,8 @@ select name, max_count, min_count, count,
set global innodb_monitor_reset = module_dml;
select name, max_count, min_count, count,
- max_count_reset, min_count_reset, count_reset, status
+ max_count_reset, min_count_reset, count_reset,
+ if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name like "dml%";
@@ -290,7 +309,8 @@ insert into monitor_test values(1);
delete from monitor_test;
select name, max_count, min_count, count,
- max_count_reset, min_count_reset, count_reset, status
+ max_count_reset, min_count_reset, count_reset,
+ if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name like "dml%";
@@ -299,7 +319,8 @@ where name like "dml%";
set global innodb_monitor_reset_all = module_dml;
select name, max_count, min_count, count,
- max_count_reset, min_count_reset, count_reset, status
+ max_count_reset, min_count_reset, count_reset,
+ if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name like "dml%";
@@ -307,7 +328,8 @@ where name like "dml%";
set global innodb_monitor_disable = module_dml;
select name, max_count, min_count, count,
- max_count_reset, min_count_reset, count_reset, status
+ max_count_reset, min_count_reset, count_reset,
+ if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name like "dml%";
@@ -315,7 +337,8 @@ where name like "dml%";
set global innodb_monitor_reset_all = module_dml;
select name, max_count, min_count, count,
- max_count_reset, min_count_reset, count_reset, status
+ max_count_reset, min_count_reset, count_reset,
+ if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name like "dml%";
@@ -329,7 +352,8 @@ delete from monitor_test;
# Only counter "dml_inserts" should be updated
select name, max_count, min_count, count,
- max_count_reset, min_count_reset, count_reset, status
+ max_count_reset, min_count_reset, count_reset,
+ if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name like "dml%";
@@ -342,7 +366,8 @@ set global innodb_monitor_enable = file_num_open_files;
# Counters are unpredictable when innodb-file-per-table is on
--replace_column 2 # 3 # 4 # 5 # 6 # 7 #
select name, max_count, min_count, count,
- max_count_reset, min_count_reset, count_reset, status
+ max_count_reset, min_count_reset, count_reset,
+ if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics
where name like "file_num_open_files";
diff --git a/mysql-test/suite/innodb/t/recovery_shutdown.test b/mysql-test/suite/innodb/t/recovery_shutdown.test
index d72e785f21d..d9079f2e42c 100644
--- a/mysql-test/suite/innodb/t/recovery_shutdown.test
+++ b/mysql-test/suite/innodb/t/recovery_shutdown.test
@@ -1,5 +1,8 @@
--source include/have_innodb.inc
--source include/not_embedded.inc
+# Valgrind has to be disabled as killing the server hard gives a lot of
+# leak warnings
+--source include/not_valgrind.inc
# Flush any open myisam tables from previous tests
FLUSH TABLES;
diff --git a/mysql-test/suite/innodb/t/undo_truncate.test b/mysql-test/suite/innodb/t/undo_truncate.test
index af6ed2b4372..b4c8e46150b 100644
--- a/mysql-test/suite/innodb/t/undo_truncate.test
+++ b/mysql-test/suite/innodb/t/undo_truncate.test
@@ -2,11 +2,9 @@
--source include/innodb_page_size.inc
--source include/have_undo_tablespaces.inc
-SET @save_undo_logs = @@GLOBAL.innodb_undo_logs;
SET @save_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET @save_truncate = @@GLOBAL.innodb_undo_log_truncate;
SET GLOBAL innodb_undo_log_truncate = 0;
-SET GLOBAL innodb_undo_logs = 4;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
SET @trunc_start=
@@ -117,6 +115,5 @@ if ($size1 == $size2)
}
}
-SET GLOBAL innodb_undo_logs = @save_undo_logs;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @save_frequency;
SET GLOBAL innodb_undo_log_truncate = @save_truncate;
diff --git a/mysql-test/suite/innodb/t/undo_truncate_recover.test b/mysql-test/suite/innodb/t/undo_truncate_recover.test
index 64b1f6f23a1..e6a873085e0 100644
--- a/mysql-test/suite/innodb/t/undo_truncate_recover.test
+++ b/mysql-test/suite/innodb/t/undo_truncate_recover.test
@@ -11,7 +11,6 @@
# Tests with embedded server do not support restarting
--source include/not_embedded.inc
-SET GLOBAL innodb_undo_logs = 4;
SET GLOBAL innodb_undo_log_truncate = 1;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
diff --git a/mysql-test/suite/innodb_gis/r/1.result b/mysql-test/suite/innodb_gis/r/1.result
index f4ac87ec56e..e654bc4b498 100644
--- a/mysql-test/suite/innodb_gis/r/1.result
+++ b/mysql-test/suite/innodb_gis/r/1.result
@@ -458,7 +458,7 @@ explain extended select ST_issimple(MultiPoint(Point(3, 6), Point(4, 10))), ST_i
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select st_issimple(geometrycollection(point(3,6),point(4,10))) AS `ST_issimple(MultiPoint(Point(3, 6), Point(4, 10)))`,st_issimple(point(3,6)) AS `ST_issimple(Point(3, 6))`
+Note 1003 select st_issimple(multipoint(point(3,6),point(4,10))) AS `ST_issimple(MultiPoint(Point(3, 6), Point(4, 10)))`,st_issimple(point(3,6)) AS `ST_issimple(Point(3, 6))`
create table t1 (a geometry not null);
insert into t1 values (ST_GeomFromText('Point(1 2)'));
insert into t1 values ('Garbage');
@@ -1028,7 +1028,7 @@ f5 datetime YES NULL
drop view v1;
drop table t1;
SELECT MultiPoint(12345,'');
-ERROR HY000: Illegal parameter data type int for operation 'geometrycollection'
+ERROR HY000: Illegal parameter data type int for operation 'multipoint'
SELECT 1 FROM (SELECT GREATEST(1,GEOMETRYCOLLECTION('00000','00000')) b FROM DUAL) AS d WHERE (LINESTRING(d.b));
ERROR HY000: Illegal parameter data type varchar for operation 'geometrycollection'
#
diff --git a/mysql-test/suite/innodb_gis/r/alter_spatial_index.result b/mysql-test/suite/innodb_gis/r/alter_spatial_index.result
index 1582963bd03..ee1f3f19b20 100644
--- a/mysql-test/suite/innodb_gis/r/alter_spatial_index.result
+++ b/mysql-test/suite/innodb_gis/r/alter_spatial_index.result
@@ -287,7 +287,7 @@ affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
CREATE TEMPORARY TABLE temp_tab AS SELECT * FROM tab where c1 = c2;
-ERROR HY000: Illegal parameter data types int and geometry for operation '='
+ERROR HY000: Illegal parameter data types int and point for operation '='
SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
CREATE TEMPORARY TABLE temp_tab AS SELECT * FROM tab;
INSERT INTO temp_tab SELECT * FROM tab;
@@ -790,13 +790,13 @@ DROP TABLE t1;
create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1)))) ENGINE=innodb;
set timestamp=10;
insert into t1 values(default);
-ERROR 22007: Incorrect POINT value: 'GEOMETRYCOLLECTION' for column `test`.`t1`.`p` at row 1
+ERROR 22007: Incorrect POINT value: 'LINESTRING' for column `test`.`t1`.`p` at row 1
drop table t1;
SET timestamp=default;
create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1)))) ENGINE=innodb;
set timestamp=10;
alter table t1 add column i int;
-ERROR 22007: Incorrect POINT value: 'GEOMETRYCOLLECTION' for column `test`.`t1`.`p` at row 1
+ERROR 22007: Incorrect POINT value: 'LINESTRING' for column `test`.`t1`.`p` at row 1
drop table t1;
SET timestamp=default;
CREATE OR REPLACE TABLE t1 (a INT) ENGINE=InnoDB;
diff --git a/mysql-test/suite/innodb_gis/r/create_spatial_index.result b/mysql-test/suite/innodb_gis/r/create_spatial_index.result
index c69d67c411f..78f2a6ad04d 100644
--- a/mysql-test/suite/innodb_gis/r/create_spatial_index.result
+++ b/mysql-test/suite/innodb_gis/r/create_spatial_index.result
@@ -1244,7 +1244,7 @@ Table Op Msg_type Msg_text
test.tab check status OK
DROP TABLE tab;
CREATE TABLE tab(c1 POINT NOT NULL,CONSTRAINT tab_const check(c1 > 0) ) ENGINE=InnoDB;
-ERROR HY000: Illegal parameter data types geometry and int for operation '>'
+ERROR HY000: Illegal parameter data types point and int for operation '>'
CREATE TABLE tab(c1 POINT NOT NULL,CONSTRAINT tab_const check(CAST(c1 AS BINARY) > 0) ) ENGINE=InnoDB;
CREATE SPATIAL INDEX idx1 ON tab(c1) ;
SHOW CREATE TABLE tab;
diff --git a/mysql-test/suite/innodb_gis/r/gis.result b/mysql-test/suite/innodb_gis/r/gis.result
index f4a973ecdc5..a769f47bf7c 100644
--- a/mysql-test/suite/innodb_gis/r/gis.result
+++ b/mysql-test/suite/innodb_gis/r/gis.result
@@ -458,7 +458,7 @@ explain extended select ST_issimple(MultiPoint(Point(3, 6), Point(4, 10))), ST_i
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select st_issimple(geometrycollection(point(3,6),point(4,10))) AS `ST_issimple(MultiPoint(Point(3, 6), Point(4, 10)))`,st_issimple(point(3,6)) AS `ST_issimple(Point(3, 6))`
+Note 1003 select st_issimple(multipoint(point(3,6),point(4,10))) AS `ST_issimple(MultiPoint(Point(3, 6), Point(4, 10)))`,st_issimple(point(3,6)) AS `ST_issimple(Point(3, 6))`
create table t1 (a geometry not null);
insert into t1 values (ST_GeomFromText('Point(1 2)'));
insert into t1 values ('Garbage');
@@ -1024,7 +1024,7 @@ f5 datetime YES NULL
drop view v1;
drop table t1;
SELECT MultiPoint(12345,'');
-ERROR HY000: Illegal parameter data type int for operation 'geometrycollection'
+ERROR HY000: Illegal parameter data type int for operation 'multipoint'
SELECT 1 FROM (SELECT GREATEST(1,GEOMETRYCOLLECTION('00000','00000')) b FROM DUAL) AS d WHERE (LINESTRING(d.b));
ERROR HY000: Illegal parameter data type varchar for operation 'geometrycollection'
#
diff --git a/mysql-test/suite/innodb_i_s/innodb_buffer_page.result b/mysql-test/suite/innodb_i_s/innodb_buffer_page.result
new file mode 100644
index 00000000000..6699fd9ae79
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_buffer_page.result
@@ -0,0 +1,24 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_BUFFER_PAGE;
+Table Create Table
+INNODB_BUFFER_PAGE CREATE TEMPORARY TABLE `INNODB_BUFFER_PAGE` (
+ `POOL_ID` int(11) unsigned NOT NULL DEFAULT 0,
+ `BLOCK_ID` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `SPACE` int(11) unsigned NOT NULL DEFAULT 0,
+ `PAGE_NUMBER` int(11) unsigned NOT NULL DEFAULT 0,
+ `PAGE_TYPE` varchar(64) DEFAULT NULL,
+ `FLUSH_TYPE` int(11) unsigned NOT NULL DEFAULT 0,
+ `FIX_COUNT` int(11) unsigned NOT NULL DEFAULT 0,
+ `IS_HASHED` int(1) NOT NULL DEFAULT 0,
+ `NEWEST_MODIFICATION` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `OLDEST_MODIFICATION` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `ACCESS_TIME` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `TABLE_NAME` varchar(1024) DEFAULT NULL,
+ `INDEX_NAME` varchar(64) DEFAULT NULL,
+ `NUMBER_RECORDS` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `DATA_SIZE` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `COMPRESSED_SIZE` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `PAGE_STATE` enum('NOT_USED','READY_FOR_USE','FILE_PAGE','MEMORY','REMOVE_HASH') NOT NULL DEFAULT '',
+ `IO_FIX` enum('IO_NONE','IO_READ','IO_WRITE','IO_PIN') NOT NULL DEFAULT '',
+ `IS_OLD` int(1) NOT NULL DEFAULT 0,
+ `FREE_PAGE_CLOCK` bigint(21) unsigned NOT NULL DEFAULT 0
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/mysql-test/suite/innodb_i_s/innodb_buffer_page.test b/mysql-test/suite/innodb_i_s/innodb_buffer_page.test
new file mode 100644
index 00000000000..baf8571bc20
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_buffer_page.test
@@ -0,0 +1,3 @@
+--source include/have_innodb.inc
+
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_BUFFER_PAGE;
diff --git a/mysql-test/suite/innodb_i_s/innodb_buffer_page_lru.result b/mysql-test/suite/innodb_i_s/innodb_buffer_page_lru.result
new file mode 100644
index 00000000000..00134233350
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_buffer_page_lru.result
@@ -0,0 +1,24 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_BUFFER_PAGE_LRU;
+Table Create Table
+INNODB_BUFFER_PAGE_LRU CREATE TEMPORARY TABLE `INNODB_BUFFER_PAGE_LRU` (
+ `POOL_ID` int(11) unsigned NOT NULL DEFAULT 0,
+ `LRU_POSITION` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `SPACE` int(11) unsigned NOT NULL DEFAULT 0,
+ `PAGE_NUMBER` int(11) unsigned NOT NULL DEFAULT 0,
+ `PAGE_TYPE` varchar(64) DEFAULT NULL,
+ `FLUSH_TYPE` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `FIX_COUNT` int(11) unsigned NOT NULL DEFAULT 0,
+ `IS_HASHED` int(1) NOT NULL DEFAULT 0,
+ `NEWEST_MODIFICATION` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `OLDEST_MODIFICATION` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `ACCESS_TIME` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `TABLE_NAME` varchar(1024) DEFAULT NULL,
+ `INDEX_NAME` varchar(64) DEFAULT NULL,
+ `NUMBER_RECORDS` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `DATA_SIZE` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `COMPRESSED_SIZE` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `COMPRESSED` int(1) NOT NULL DEFAULT 0,
+ `IO_FIX` enum('IO_NONE','IO_READ','IO_WRITE','IO_PIN') NOT NULL DEFAULT '',
+ `IS_OLD` int(1) DEFAULT NULL,
+ `FREE_PAGE_CLOCK` bigint(21) unsigned NOT NULL DEFAULT 0
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/mysql-test/suite/innodb_i_s/innodb_buffer_page_lru.test b/mysql-test/suite/innodb_i_s/innodb_buffer_page_lru.test
new file mode 100644
index 00000000000..f7969fcc2d3
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_buffer_page_lru.test
@@ -0,0 +1,3 @@
+--source include/have_innodb.inc
+
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_BUFFER_PAGE_LRU;
diff --git a/mysql-test/suite/innodb_i_s/innodb_buffer_pool_stats.result b/mysql-test/suite/innodb_i_s/innodb_buffer_pool_stats.result
new file mode 100644
index 00000000000..be5c31a6b57
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_buffer_pool_stats.result
@@ -0,0 +1,36 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_BUFFER_POOL_STATS;
+Table Create Table
+INNODB_BUFFER_POOL_STATS CREATE TEMPORARY TABLE `INNODB_BUFFER_POOL_STATS` (
+ `POOL_ID` int(11) unsigned NOT NULL DEFAULT 0,
+ `POOL_SIZE` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `FREE_BUFFERS` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `DATABASE_PAGES` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `OLD_DATABASE_PAGES` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `MODIFIED_DATABASE_PAGES` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `PENDING_DECOMPRESS` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `PENDING_READS` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `PENDING_FLUSH_LRU` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `PENDING_FLUSH_LIST` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `PAGES_MADE_YOUNG` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `PAGES_NOT_MADE_YOUNG` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `PAGES_MADE_YOUNG_RATE` float NOT NULL DEFAULT 0,
+ `PAGES_MADE_NOT_YOUNG_RATE` float NOT NULL DEFAULT 0,
+ `NUMBER_PAGES_READ` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `NUMBER_PAGES_CREATED` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `NUMBER_PAGES_WRITTEN` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `PAGES_READ_RATE` float NOT NULL DEFAULT 0,
+ `PAGES_CREATE_RATE` float NOT NULL DEFAULT 0,
+ `PAGES_WRITTEN_RATE` float NOT NULL DEFAULT 0,
+ `NUMBER_PAGES_GET` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `HIT_RATE` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `YOUNG_MAKE_PER_THOUSAND_GETS` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `NOT_YOUNG_MAKE_PER_THOUSAND_GETS` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `NUMBER_PAGES_READ_AHEAD` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `NUMBER_READ_AHEAD_EVICTED` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `READ_AHEAD_RATE` float NOT NULL DEFAULT 0,
+ `READ_AHEAD_EVICTED_RATE` float NOT NULL DEFAULT 0,
+ `LRU_IO_TOTAL` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `LRU_IO_CURRENT` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `UNCOMPRESS_TOTAL` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `UNCOMPRESS_CURRENT` bigint(21) unsigned NOT NULL DEFAULT 0
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/mysql-test/suite/innodb_i_s/innodb_buffer_pool_stats.test b/mysql-test/suite/innodb_i_s/innodb_buffer_pool_stats.test
new file mode 100644
index 00000000000..4dd396ef9fc
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_buffer_pool_stats.test
@@ -0,0 +1,3 @@
+--source include/have_innodb.inc
+
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_BUFFER_POOL_STATS;
diff --git a/mysql-test/suite/innodb_i_s/innodb_cmp.opt b/mysql-test/suite/innodb_i_s/innodb_cmp.opt
new file mode 100644
index 00000000000..4f9fa4186cc
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_cmp.opt
@@ -0,0 +1 @@
+--innodb_cmp
diff --git a/mysql-test/suite/innodb_i_s/innodb_cmp.result b/mysql-test/suite/innodb_i_s/innodb_cmp.result
new file mode 100644
index 00000000000..47a92e42e59
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_cmp.result
@@ -0,0 +1,10 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_CMP;
+Table Create Table
+INNODB_CMP CREATE TEMPORARY TABLE `INNODB_CMP` (
+ `page_size` int(5) NOT NULL DEFAULT 0,
+ `compress_ops` int(11) NOT NULL DEFAULT 0,
+ `compress_ops_ok` int(11) NOT NULL DEFAULT 0,
+ `compress_time` int(11) NOT NULL DEFAULT 0,
+ `uncompress_ops` int(11) NOT NULL DEFAULT 0,
+ `uncompress_time` int(11) NOT NULL DEFAULT 0
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/mysql-test/suite/innodb_i_s/innodb_cmp.test b/mysql-test/suite/innodb_i_s/innodb_cmp.test
new file mode 100644
index 00000000000..a7ddff3ee85
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_cmp.test
@@ -0,0 +1,3 @@
+--source include/have_innodb.inc
+
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_CMP;
diff --git a/mysql-test/suite/innodb_i_s/innodb_cmp_per_index.result b/mysql-test/suite/innodb_i_s/innodb_cmp_per_index.result
new file mode 100644
index 00000000000..bcde9a2e9dd
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_cmp_per_index.result
@@ -0,0 +1,12 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_CMP_PER_INDEX;
+Table Create Table
+INNODB_CMP_PER_INDEX CREATE TEMPORARY TABLE `INNODB_CMP_PER_INDEX` (
+ `database_name` varchar(64) NOT NULL DEFAULT '',
+ `table_name` varchar(64) NOT NULL DEFAULT '',
+ `index_name` varchar(64) NOT NULL DEFAULT '',
+ `compress_ops` int(11) NOT NULL DEFAULT 0,
+ `compress_ops_ok` int(11) NOT NULL DEFAULT 0,
+ `compress_time` int(11) NOT NULL DEFAULT 0,
+ `uncompress_ops` int(11) NOT NULL DEFAULT 0,
+ `uncompress_time` int(11) NOT NULL DEFAULT 0
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/mysql-test/suite/innodb_i_s/innodb_cmp_per_index.test b/mysql-test/suite/innodb_i_s/innodb_cmp_per_index.test
new file mode 100644
index 00000000000..9e91e8dd934
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_cmp_per_index.test
@@ -0,0 +1,3 @@
+--source include/have_innodb.inc
+
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_CMP_PER_INDEX;
diff --git a/mysql-test/suite/innodb_i_s/innodb_cmp_per_index_reset.opt b/mysql-test/suite/innodb_i_s/innodb_cmp_per_index_reset.opt
new file mode 100644
index 00000000000..37aab727b87
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_cmp_per_index_reset.opt
@@ -0,0 +1 @@
+--innodb_cmp_per_index_reset
diff --git a/mysql-test/suite/innodb_i_s/innodb_cmp_per_index_reset.result b/mysql-test/suite/innodb_i_s/innodb_cmp_per_index_reset.result
new file mode 100644
index 00000000000..97ba44ec641
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_cmp_per_index_reset.result
@@ -0,0 +1,12 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_CMP_PER_INDEX_RESET;
+Table Create Table
+INNODB_CMP_PER_INDEX_RESET CREATE TEMPORARY TABLE `INNODB_CMP_PER_INDEX_RESET` (
+ `database_name` varchar(64) NOT NULL DEFAULT '',
+ `table_name` varchar(64) NOT NULL DEFAULT '',
+ `index_name` varchar(64) NOT NULL DEFAULT '',
+ `compress_ops` int(11) NOT NULL DEFAULT 0,
+ `compress_ops_ok` int(11) NOT NULL DEFAULT 0,
+ `compress_time` int(11) NOT NULL DEFAULT 0,
+ `uncompress_ops` int(11) NOT NULL DEFAULT 0,
+ `uncompress_time` int(11) NOT NULL DEFAULT 0
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/mysql-test/suite/innodb_i_s/innodb_cmp_per_index_reset.test b/mysql-test/suite/innodb_i_s/innodb_cmp_per_index_reset.test
new file mode 100644
index 00000000000..05220afe596
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_cmp_per_index_reset.test
@@ -0,0 +1,3 @@
+--source include/have_innodb.inc
+
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_CMP_PER_INDEX_RESET;
diff --git a/mysql-test/suite/innodb_i_s/innodb_cmp_reset.opt b/mysql-test/suite/innodb_i_s/innodb_cmp_reset.opt
new file mode 100644
index 00000000000..01508468386
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_cmp_reset.opt
@@ -0,0 +1 @@
+--innodb_cmp_reset
diff --git a/mysql-test/suite/innodb_i_s/innodb_cmp_reset.result b/mysql-test/suite/innodb_i_s/innodb_cmp_reset.result
new file mode 100644
index 00000000000..3d247f2cbc1
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_cmp_reset.result
@@ -0,0 +1,10 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_CMP_RESET;
+Table Create Table
+INNODB_CMP_RESET CREATE TEMPORARY TABLE `INNODB_CMP_RESET` (
+ `page_size` int(5) NOT NULL DEFAULT 0,
+ `compress_ops` int(11) NOT NULL DEFAULT 0,
+ `compress_ops_ok` int(11) NOT NULL DEFAULT 0,
+ `compress_time` int(11) NOT NULL DEFAULT 0,
+ `uncompress_ops` int(11) NOT NULL DEFAULT 0,
+ `uncompress_time` int(11) NOT NULL DEFAULT 0
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/mysql-test/suite/innodb_i_s/innodb_cmp_reset.test b/mysql-test/suite/innodb_i_s/innodb_cmp_reset.test
new file mode 100644
index 00000000000..fe0d7196617
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_cmp_reset.test
@@ -0,0 +1,3 @@
+--source include/have_innodb.inc
+
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_CMP_RESET;
diff --git a/mysql-test/suite/innodb_i_s/innodb_cmpmem.result b/mysql-test/suite/innodb_i_s/innodb_cmpmem.result
new file mode 100644
index 00000000000..e1dd5d0a314
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_cmpmem.result
@@ -0,0 +1,10 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_CMPMEM;
+Table Create Table
+INNODB_CMPMEM CREATE TEMPORARY TABLE `INNODB_CMPMEM` (
+ `page_size` int(5) NOT NULL DEFAULT 0,
+ `buffer_pool_instance` int(11) NOT NULL DEFAULT 0,
+ `pages_used` int(11) NOT NULL DEFAULT 0,
+ `pages_free` int(11) NOT NULL DEFAULT 0,
+ `relocation_ops` bigint(21) NOT NULL DEFAULT 0,
+ `relocation_time` int(11) NOT NULL DEFAULT 0
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/mysql-test/suite/innodb_i_s/innodb_cmpmem.test b/mysql-test/suite/innodb_i_s/innodb_cmpmem.test
new file mode 100644
index 00000000000..6b5ddf9b93a
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_cmpmem.test
@@ -0,0 +1,3 @@
+--source include/have_innodb.inc
+
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_CMPMEM;
diff --git a/mysql-test/suite/innodb_i_s/innodb_cmpmem_reset.opt b/mysql-test/suite/innodb_i_s/innodb_cmpmem_reset.opt
new file mode 100644
index 00000000000..de3b60d9218
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_cmpmem_reset.opt
@@ -0,0 +1 @@
+--innodb_cmpmem_reset
diff --git a/mysql-test/suite/innodb_i_s/innodb_cmpmem_reset.result b/mysql-test/suite/innodb_i_s/innodb_cmpmem_reset.result
new file mode 100644
index 00000000000..178cd244f9a
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_cmpmem_reset.result
@@ -0,0 +1,10 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_CMPMEM_RESET;
+Table Create Table
+INNODB_CMPMEM_RESET CREATE TEMPORARY TABLE `INNODB_CMPMEM_RESET` (
+ `page_size` int(5) NOT NULL DEFAULT 0,
+ `buffer_pool_instance` int(11) NOT NULL DEFAULT 0,
+ `pages_used` int(11) NOT NULL DEFAULT 0,
+ `pages_free` int(11) NOT NULL DEFAULT 0,
+ `relocation_ops` bigint(21) NOT NULL DEFAULT 0,
+ `relocation_time` int(11) NOT NULL DEFAULT 0
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/mysql-test/suite/innodb_i_s/innodb_cmpmem_reset.test b/mysql-test/suite/innodb_i_s/innodb_cmpmem_reset.test
new file mode 100644
index 00000000000..9ea5bdf51fa
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_cmpmem_reset.test
@@ -0,0 +1,3 @@
+--source include/have_innodb.inc
+
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_CMPMEM_RESET;
diff --git a/mysql-test/suite/innodb_i_s/innodb_ft_being_deleted.opt b/mysql-test/suite/innodb_i_s/innodb_ft_being_deleted.opt
new file mode 100644
index 00000000000..9665b7c5772
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_ft_being_deleted.opt
@@ -0,0 +1 @@
+--innodb_ft_being_deleted
diff --git a/mysql-test/suite/innodb_i_s/innodb_ft_being_deleted.result b/mysql-test/suite/innodb_i_s/innodb_ft_being_deleted.result
new file mode 100644
index 00000000000..920ec782ac5
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_ft_being_deleted.result
@@ -0,0 +1,5 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_FT_BEING_DELETED;
+Table Create Table
+INNODB_FT_BEING_DELETED CREATE TEMPORARY TABLE `INNODB_FT_BEING_DELETED` (
+ `DOC_ID` bigint(21) unsigned NOT NULL DEFAULT 0
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/mysql-test/suite/innodb_i_s/innodb_ft_being_deleted.test b/mysql-test/suite/innodb_i_s/innodb_ft_being_deleted.test
new file mode 100644
index 00000000000..cfe2836f224
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_ft_being_deleted.test
@@ -0,0 +1,3 @@
+--source include/have_innodb.inc
+
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_FT_BEING_DELETED;
diff --git a/mysql-test/suite/innodb_i_s/innodb_ft_config.opt b/mysql-test/suite/innodb_i_s/innodb_ft_config.opt
new file mode 100644
index 00000000000..9e0e66f6620
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_ft_config.opt
@@ -0,0 +1 @@
+--innodb_ft_config
diff --git a/mysql-test/suite/innodb_i_s/innodb_ft_config.result b/mysql-test/suite/innodb_i_s/innodb_ft_config.result
new file mode 100644
index 00000000000..dcb11b1805c
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_ft_config.result
@@ -0,0 +1,6 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_FT_CONFIG;
+Table Create Table
+INNODB_FT_CONFIG CREATE TEMPORARY TABLE `INNODB_FT_CONFIG` (
+ `KEY` varchar(193) NOT NULL DEFAULT '',
+ `VALUE` varchar(193) NOT NULL DEFAULT ''
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/mysql-test/suite/innodb_i_s/innodb_ft_config.test b/mysql-test/suite/innodb_i_s/innodb_ft_config.test
new file mode 100644
index 00000000000..9d844250764
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_ft_config.test
@@ -0,0 +1,3 @@
+--source include/have_innodb.inc
+
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_FT_CONFIG;
diff --git a/mysql-test/suite/innodb_i_s/innodb_ft_default_stopword.opt b/mysql-test/suite/innodb_i_s/innodb_ft_default_stopword.opt
new file mode 100644
index 00000000000..2732f3a46a5
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_ft_default_stopword.opt
@@ -0,0 +1 @@
+--innodb_ft_default_stopword
diff --git a/mysql-test/suite/innodb_i_s/innodb_ft_default_stopword.result b/mysql-test/suite/innodb_i_s/innodb_ft_default_stopword.result
new file mode 100644
index 00000000000..c680665a256
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_ft_default_stopword.result
@@ -0,0 +1,5 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_FT_DEFAULT_STOPWORD;
+Table Create Table
+INNODB_FT_DEFAULT_STOPWORD CREATE TEMPORARY TABLE `INNODB_FT_DEFAULT_STOPWORD` (
+ `value` varchar(18) NOT NULL DEFAULT ''
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/mysql-test/suite/innodb_i_s/innodb_ft_default_stopword.test b/mysql-test/suite/innodb_i_s/innodb_ft_default_stopword.test
new file mode 100644
index 00000000000..b997c3891b0
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_ft_default_stopword.test
@@ -0,0 +1,3 @@
+--source include/have_innodb.inc
+
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_FT_DEFAULT_STOPWORD;
diff --git a/mysql-test/suite/innodb_i_s/innodb_ft_deleted.opt b/mysql-test/suite/innodb_i_s/innodb_ft_deleted.opt
new file mode 100644
index 00000000000..011d5a78f69
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_ft_deleted.opt
@@ -0,0 +1 @@
+--innodb_ft_deleted
diff --git a/mysql-test/suite/innodb_i_s/innodb_ft_deleted.result b/mysql-test/suite/innodb_i_s/innodb_ft_deleted.result
new file mode 100644
index 00000000000..ab1a816eee8
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_ft_deleted.result
@@ -0,0 +1,5 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_FT_DELETED;
+Table Create Table
+INNODB_FT_DELETED CREATE TEMPORARY TABLE `INNODB_FT_DELETED` (
+ `DOC_ID` bigint(21) unsigned NOT NULL DEFAULT 0
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/mysql-test/suite/innodb_i_s/innodb_ft_deleted.test b/mysql-test/suite/innodb_i_s/innodb_ft_deleted.test
new file mode 100644
index 00000000000..63b2eede818
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_ft_deleted.test
@@ -0,0 +1,3 @@
+--source include/have_innodb.inc
+
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_FT_DELETED;
diff --git a/mysql-test/suite/innodb_i_s/innodb_ft_index_cache.opt b/mysql-test/suite/innodb_i_s/innodb_ft_index_cache.opt
new file mode 100644
index 00000000000..a076db4e5b8
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_ft_index_cache.opt
@@ -0,0 +1 @@
+--innodb_ft_index_cache
diff --git a/mysql-test/suite/innodb_i_s/innodb_ft_index_cache.result b/mysql-test/suite/innodb_i_s/innodb_ft_index_cache.result
new file mode 100644
index 00000000000..b95cb1ddf28
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_ft_index_cache.result
@@ -0,0 +1,10 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
+Table Create Table
+INNODB_FT_INDEX_CACHE CREATE TEMPORARY TABLE `INNODB_FT_INDEX_CACHE` (
+ `WORD` varchar(337) NOT NULL DEFAULT '',
+ `FIRST_DOC_ID` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `LAST_DOC_ID` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `DOC_COUNT` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `DOC_ID` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `POSITION` bigint(21) unsigned NOT NULL DEFAULT 0
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/mysql-test/suite/innodb_i_s/innodb_ft_index_cache.test b/mysql-test/suite/innodb_i_s/innodb_ft_index_cache.test
new file mode 100644
index 00000000000..5e95dd05e98
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_ft_index_cache.test
@@ -0,0 +1,3 @@
+--source include/have_innodb.inc
+
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
diff --git a/mysql-test/suite/innodb_i_s/innodb_ft_index_table.opt b/mysql-test/suite/innodb_i_s/innodb_ft_index_table.opt
new file mode 100644
index 00000000000..ab47d299659
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_ft_index_table.opt
@@ -0,0 +1 @@
+--innodb_ft_index_table
diff --git a/mysql-test/suite/innodb_i_s/innodb_ft_index_table.result b/mysql-test/suite/innodb_i_s/innodb_ft_index_table.result
new file mode 100644
index 00000000000..0003e7d6741
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_ft_index_table.result
@@ -0,0 +1,10 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
+Table Create Table
+INNODB_FT_INDEX_TABLE CREATE TEMPORARY TABLE `INNODB_FT_INDEX_TABLE` (
+ `WORD` varchar(337) NOT NULL DEFAULT '',
+ `FIRST_DOC_ID` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `LAST_DOC_ID` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `DOC_COUNT` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `DOC_ID` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `POSITION` bigint(21) unsigned NOT NULL DEFAULT 0
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/mysql-test/suite/innodb_i_s/innodb_ft_index_table.test b/mysql-test/suite/innodb_i_s/innodb_ft_index_table.test
new file mode 100644
index 00000000000..984665f2fd6
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_ft_index_table.test
@@ -0,0 +1,3 @@
+--source include/have_innodb.inc
+
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
diff --git a/mysql-test/suite/innodb_i_s/innodb_lock_waits.result b/mysql-test/suite/innodb_i_s/innodb_lock_waits.result
new file mode 100644
index 00000000000..4142f142d3b
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_lock_waits.result
@@ -0,0 +1,8 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_LOCK_WAITS;
+Table Create Table
+INNODB_LOCK_WAITS CREATE TEMPORARY TABLE `INNODB_LOCK_WAITS` (
+ `requesting_trx_id` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `requested_lock_id` varchar(81) NOT NULL DEFAULT '',
+ `blocking_trx_id` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `blocking_lock_id` varchar(81) NOT NULL DEFAULT ''
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/mysql-test/suite/innodb_i_s/innodb_lock_waits.test b/mysql-test/suite/innodb_i_s/innodb_lock_waits.test
new file mode 100644
index 00000000000..704537f83ae
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_lock_waits.test
@@ -0,0 +1,3 @@
+--source include/have_innodb.inc
+
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_LOCK_WAITS;
diff --git a/mysql-test/suite/innodb_i_s/innodb_locks.result b/mysql-test/suite/innodb_i_s/innodb_locks.result
new file mode 100644
index 00000000000..abfdce08606
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_locks.result
@@ -0,0 +1,14 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_LOCKS;
+Table Create Table
+INNODB_LOCKS CREATE TEMPORARY TABLE `INNODB_LOCKS` (
+ `lock_id` varchar(81) NOT NULL DEFAULT '',
+ `lock_trx_id` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `lock_mode` enum('S','S,GAP','X','X,GAP','IS','IS,GAP','IX','IX,GAP','AUTO_INC') NOT NULL DEFAULT '',
+ `lock_type` enum('RECORD','TABLE') NOT NULL DEFAULT '',
+ `lock_table` varchar(1024) NOT NULL DEFAULT '',
+ `lock_index` varchar(1024) DEFAULT NULL,
+ `lock_space` int(11) unsigned DEFAULT NULL,
+ `lock_page` int(11) unsigned DEFAULT NULL,
+ `lock_rec` int(11) unsigned DEFAULT NULL,
+ `lock_data` varchar(8192) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/mysql-test/suite/innodb_i_s/innodb_locks.test b/mysql-test/suite/innodb_i_s/innodb_locks.test
new file mode 100644
index 00000000000..adf45ba4642
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_locks.test
@@ -0,0 +1,3 @@
+--source include/have_innodb.inc
+
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_LOCKS;
diff --git a/mysql-test/suite/innodb_i_s/innodb_metrics.result b/mysql-test/suite/innodb_i_s/innodb_metrics.result
new file mode 100644
index 00000000000..0ec3a6b7bf6
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_metrics.result
@@ -0,0 +1,21 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_METRICS;
+Table Create Table
+INNODB_METRICS CREATE TEMPORARY TABLE `INNODB_METRICS` (
+ `NAME` varchar(193) NOT NULL DEFAULT '',
+ `SUBSYSTEM` varchar(193) NOT NULL DEFAULT '',
+ `COUNT` bigint(21) NOT NULL DEFAULT 0,
+ `MAX_COUNT` bigint(21) DEFAULT NULL,
+ `MIN_COUNT` bigint(21) DEFAULT NULL,
+ `AVG_COUNT` float DEFAULT NULL,
+ `COUNT_RESET` bigint(21) NOT NULL DEFAULT 0,
+ `MAX_COUNT_RESET` bigint(21) DEFAULT NULL,
+ `MIN_COUNT_RESET` bigint(21) DEFAULT NULL,
+ `AVG_COUNT_RESET` float DEFAULT NULL,
+ `TIME_ENABLED` datetime DEFAULT NULL,
+ `TIME_DISABLED` datetime DEFAULT NULL,
+ `TIME_ELAPSED` bigint(21) DEFAULT NULL,
+ `TIME_RESET` datetime DEFAULT NULL,
+ `ENABLED` int(1) NOT NULL DEFAULT 0,
+ `TYPE` enum('value','status_counter','set_owner','set_member','counter') NOT NULL DEFAULT '',
+ `COMMENT` varchar(193) NOT NULL DEFAULT ''
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/mysql-test/suite/innodb_i_s/innodb_metrics.test b/mysql-test/suite/innodb_i_s/innodb_metrics.test
new file mode 100644
index 00000000000..6a2b2cee247
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_metrics.test
@@ -0,0 +1,3 @@
+--source include/have_innodb.inc
+
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_METRICS;
diff --git a/mysql-test/suite/innodb_i_s/innodb_mutexes.opt b/mysql-test/suite/innodb_i_s/innodb_mutexes.opt
new file mode 100644
index 00000000000..d658e54eff5
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_mutexes.opt
@@ -0,0 +1 @@
+--innodb_mutexes
diff --git a/mysql-test/suite/innodb_i_s/innodb_mutexes.result b/mysql-test/suite/innodb_i_s/innodb_mutexes.result
new file mode 100644
index 00000000000..e00b68d39fc
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_mutexes.result
@@ -0,0 +1,8 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_MUTEXES;
+Table Create Table
+INNODB_MUTEXES CREATE TEMPORARY TABLE `INNODB_MUTEXES` (
+ `NAME` varchar(4000) NOT NULL DEFAULT '',
+ `CREATE_FILE` varchar(4000) NOT NULL DEFAULT '',
+ `CREATE_LINE` int(11) unsigned NOT NULL DEFAULT 0,
+ `OS_WAITS` bigint(21) unsigned NOT NULL DEFAULT 0
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/mysql-test/suite/innodb_i_s/innodb_mutexes.test b/mysql-test/suite/innodb_i_s/innodb_mutexes.test
new file mode 100644
index 00000000000..d4c8d49bab4
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_mutexes.test
@@ -0,0 +1,3 @@
+--source include/have_innodb.inc
+
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_MUTEXES;
diff --git a/mysql-test/suite/innodb_i_s/innodb_sys_columns.result b/mysql-test/suite/innodb_i_s/innodb_sys_columns.result
new file mode 100644
index 00000000000..fbce9faac99
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_sys_columns.result
@@ -0,0 +1,10 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_SYS_COLUMNS;
+Table Create Table
+INNODB_SYS_COLUMNS CREATE TEMPORARY TABLE `INNODB_SYS_COLUMNS` (
+ `TABLE_ID` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `NAME` varchar(64) NOT NULL DEFAULT '',
+ `POS` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `MTYPE` int(11) NOT NULL DEFAULT 0,
+ `PRTYPE` int(11) NOT NULL DEFAULT 0,
+ `LEN` int(11) NOT NULL DEFAULT 0
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/mysql-test/suite/innodb_i_s/innodb_sys_columns.test b/mysql-test/suite/innodb_i_s/innodb_sys_columns.test
new file mode 100644
index 00000000000..73332697d7b
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_sys_columns.test
@@ -0,0 +1,3 @@
+--source include/have_innodb.inc
+
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_SYS_COLUMNS;
diff --git a/mysql-test/suite/innodb_i_s/innodb_sys_datafiles.opt b/mysql-test/suite/innodb_i_s/innodb_sys_datafiles.opt
new file mode 100644
index 00000000000..d6803d5ecdf
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_sys_datafiles.opt
@@ -0,0 +1 @@
+--innodb_sys_datafiles
diff --git a/mysql-test/suite/innodb_i_s/innodb_sys_datafiles.result b/mysql-test/suite/innodb_i_s/innodb_sys_datafiles.result
new file mode 100644
index 00000000000..eb2dd8b71ad
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_sys_datafiles.result
@@ -0,0 +1,6 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_SYS_DATAFILES;
+Table Create Table
+INNODB_SYS_DATAFILES CREATE TEMPORARY TABLE `INNODB_SYS_DATAFILES` (
+ `SPACE` int(11) unsigned NOT NULL DEFAULT 0,
+ `PATH` varchar(4000) NOT NULL DEFAULT ''
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/mysql-test/suite/innodb_i_s/innodb_sys_datafiles.test b/mysql-test/suite/innodb_i_s/innodb_sys_datafiles.test
new file mode 100644
index 00000000000..dd843fec761
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_sys_datafiles.test
@@ -0,0 +1,3 @@
+--source include/have_innodb.inc
+
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_SYS_DATAFILES;
diff --git a/mysql-test/suite/innodb_i_s/innodb_sys_fields.result b/mysql-test/suite/innodb_i_s/innodb_sys_fields.result
new file mode 100644
index 00000000000..9c5437ff64e
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_sys_fields.result
@@ -0,0 +1,7 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_SYS_FIELDS;
+Table Create Table
+INNODB_SYS_FIELDS CREATE TEMPORARY TABLE `INNODB_SYS_FIELDS` (
+ `INDEX_ID` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `NAME` varchar(64) NOT NULL DEFAULT '',
+ `POS` int(11) unsigned NOT NULL DEFAULT 0
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/mysql-test/suite/innodb_i_s/innodb_sys_fields.test b/mysql-test/suite/innodb_i_s/innodb_sys_fields.test
new file mode 100644
index 00000000000..1559eb39576
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_sys_fields.test
@@ -0,0 +1,3 @@
+--source include/have_innodb.inc
+
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_SYS_FIELDS;
diff --git a/mysql-test/suite/innodb_i_s/innodb_sys_foreign.result b/mysql-test/suite/innodb_i_s/innodb_sys_foreign.result
new file mode 100644
index 00000000000..8dc7cbb2c53
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_sys_foreign.result
@@ -0,0 +1,9 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
+Table Create Table
+INNODB_SYS_FOREIGN CREATE TEMPORARY TABLE `INNODB_SYS_FOREIGN` (
+ `ID` varchar(193) NOT NULL DEFAULT '',
+ `FOR_NAME` varchar(193) NOT NULL DEFAULT '',
+ `REF_NAME` varchar(193) NOT NULL DEFAULT '',
+ `N_COLS` int(11) unsigned NOT NULL DEFAULT 0,
+ `TYPE` int(11) unsigned NOT NULL DEFAULT 0
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/mysql-test/suite/innodb_i_s/innodb_sys_foreign.test b/mysql-test/suite/innodb_i_s/innodb_sys_foreign.test
new file mode 100644
index 00000000000..694a773392e
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_sys_foreign.test
@@ -0,0 +1,3 @@
+--source include/have_innodb.inc
+
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
diff --git a/mysql-test/suite/innodb_i_s/innodb_sys_foreign_cols.result b/mysql-test/suite/innodb_i_s/innodb_sys_foreign_cols.result
new file mode 100644
index 00000000000..8f1134fb36d
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_sys_foreign_cols.result
@@ -0,0 +1,8 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
+Table Create Table
+INNODB_SYS_FOREIGN_COLS CREATE TEMPORARY TABLE `INNODB_SYS_FOREIGN_COLS` (
+ `ID` varchar(193) NOT NULL DEFAULT '',
+ `FOR_COL_NAME` varchar(64) NOT NULL DEFAULT '',
+ `REF_COL_NAME` varchar(64) NOT NULL DEFAULT '',
+ `POS` int(11) unsigned NOT NULL DEFAULT 0
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/mysql-test/suite/innodb_i_s/innodb_sys_foreign_cols.test b/mysql-test/suite/innodb_i_s/innodb_sys_foreign_cols.test
new file mode 100644
index 00000000000..6afccfc212f
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_sys_foreign_cols.test
@@ -0,0 +1,3 @@
+--source include/have_innodb.inc
+
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
diff --git a/mysql-test/suite/innodb_i_s/innodb_sys_indexes.result b/mysql-test/suite/innodb_i_s/innodb_sys_indexes.result
new file mode 100644
index 00000000000..6e76ea887cc
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_sys_indexes.result
@@ -0,0 +1,12 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_SYS_INDEXES;
+Table Create Table
+INNODB_SYS_INDEXES CREATE TEMPORARY TABLE `INNODB_SYS_INDEXES` (
+ `INDEX_ID` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `NAME` varchar(64) NOT NULL DEFAULT '',
+ `TABLE_ID` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `TYPE` int(11) NOT NULL DEFAULT 0,
+ `N_FIELDS` int(11) NOT NULL DEFAULT 0,
+ `PAGE_NO` int(11) NOT NULL DEFAULT 0,
+ `SPACE` int(11) NOT NULL DEFAULT 0,
+ `MERGE_THRESHOLD` int(11) NOT NULL DEFAULT 0
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/mysql-test/suite/innodb_i_s/innodb_sys_indexes.test b/mysql-test/suite/innodb_i_s/innodb_sys_indexes.test
new file mode 100644
index 00000000000..b8ad25ea6e3
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_sys_indexes.test
@@ -0,0 +1,3 @@
+--source include/have_innodb.inc
+
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_SYS_INDEXES;
diff --git a/mysql-test/suite/innodb_i_s/innodb_sys_semaphore_waits.opt b/mysql-test/suite/innodb_i_s/innodb_sys_semaphore_waits.opt
new file mode 100644
index 00000000000..2b4bd0c33da
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_sys_semaphore_waits.opt
@@ -0,0 +1 @@
+--innodb_sys_semaphore_waits
diff --git a/mysql-test/suite/innodb_i_s/innodb_sys_semaphore_waits.result b/mysql-test/suite/innodb_i_s/innodb_sys_semaphore_waits.result
new file mode 100644
index 00000000000..ee1e3fade1e
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_sys_semaphore_waits.result
@@ -0,0 +1,24 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_SYS_SEMAPHORE_WAITS;
+Table Create Table
+INNODB_SYS_SEMAPHORE_WAITS CREATE TEMPORARY TABLE `INNODB_SYS_SEMAPHORE_WAITS` (
+ `THREAD_ID` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `OBJECT_NAME` varchar(4000) DEFAULT NULL,
+ `FILE` varchar(4000) DEFAULT NULL,
+ `LINE` int(11) unsigned NOT NULL DEFAULT 0,
+ `WAIT_TIME` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `WAIT_OBJECT` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `WAIT_TYPE` varchar(16) DEFAULT NULL,
+ `HOLDER_THREAD_ID` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `HOLDER_FILE` varchar(4000) DEFAULT NULL,
+ `HOLDER_LINE` int(11) unsigned NOT NULL DEFAULT 0,
+ `CREATED_FILE` varchar(4000) DEFAULT NULL,
+ `CREATED_LINE` int(11) unsigned NOT NULL DEFAULT 0,
+ `WRITER_THREAD` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `RESERVATION_MODE` varchar(16) DEFAULT NULL,
+ `READERS` int(11) unsigned NOT NULL DEFAULT 0,
+ `WAITERS_FLAG` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `LOCK_WORD` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `LAST_WRITER_FILE` varchar(4000) DEFAULT NULL,
+ `LAST_WRITER_LINE` int(11) unsigned NOT NULL DEFAULT 0,
+ `OS_WAIT_COUNT` int(11) unsigned NOT NULL DEFAULT 0
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/mysql-test/suite/innodb_i_s/innodb_sys_semaphore_waits.test b/mysql-test/suite/innodb_i_s/innodb_sys_semaphore_waits.test
new file mode 100644
index 00000000000..a8ea1c59bb8
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_sys_semaphore_waits.test
@@ -0,0 +1,3 @@
+--source include/have_innodb.inc
+
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_SYS_SEMAPHORE_WAITS;
diff --git a/mysql-test/suite/innodb_i_s/innodb_sys_tables.result b/mysql-test/suite/innodb_i_s/innodb_sys_tables.result
new file mode 100644
index 00000000000..82c6c480587
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_sys_tables.result
@@ -0,0 +1,12 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_SYS_TABLES;
+Table Create Table
+INNODB_SYS_TABLES CREATE TEMPORARY TABLE `INNODB_SYS_TABLES` (
+ `TABLE_ID` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `NAME` varchar(655) NOT NULL DEFAULT '',
+ `FLAG` int(11) NOT NULL DEFAULT 0,
+ `N_COLS` int(11) unsigned NOT NULL DEFAULT 0,
+ `SPACE` int(11) unsigned NOT NULL DEFAULT 0,
+ `ROW_FORMAT` enum('Redundant','Compact','Compressed','Dynamic') DEFAULT NULL,
+ `ZIP_PAGE_SIZE` int(11) unsigned NOT NULL DEFAULT 0,
+ `SPACE_TYPE` enum('Single','System') DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/mysql-test/suite/innodb_i_s/innodb_sys_tables.test b/mysql-test/suite/innodb_i_s/innodb_sys_tables.test
new file mode 100644
index 00000000000..b868678f7f1
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_sys_tables.test
@@ -0,0 +1,3 @@
+--source include/have_innodb.inc
+
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_SYS_TABLES;
diff --git a/mysql-test/suite/innodb_i_s/innodb_sys_tablespaces.opt b/mysql-test/suite/innodb_i_s/innodb_sys_tablespaces.opt
new file mode 100644
index 00000000000..497233a1520
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_sys_tablespaces.opt
@@ -0,0 +1 @@
+--innodb_sys_tablespaces
diff --git a/mysql-test/suite/innodb_i_s/innodb_sys_tablespaces.result b/mysql-test/suite/innodb_i_s/innodb_sys_tablespaces.result
new file mode 100644
index 00000000000..40e337f49f3
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_sys_tablespaces.result
@@ -0,0 +1,13 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES;
+Table Create Table
+INNODB_SYS_TABLESPACES CREATE TEMPORARY TABLE `INNODB_SYS_TABLESPACES` (
+ `SPACE` int(11) unsigned NOT NULL DEFAULT 0,
+ `NAME` varchar(655) NOT NULL DEFAULT '',
+ `FLAG` int(11) unsigned NOT NULL DEFAULT 0,
+ `ROW_FORMAT` varchar(22) DEFAULT NULL,
+ `PAGE_SIZE` int(11) unsigned NOT NULL DEFAULT 0,
+ `ZIP_PAGE_SIZE` int(11) unsigned NOT NULL DEFAULT 0,
+ `FS_BLOCK_SIZE` int(11) unsigned NOT NULL DEFAULT 0,
+ `FILE_SIZE` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `ALLOCATED_SIZE` bigint(21) unsigned NOT NULL DEFAULT 0
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/mysql-test/suite/innodb_i_s/innodb_sys_tablespaces.test b/mysql-test/suite/innodb_i_s/innodb_sys_tablespaces.test
new file mode 100644
index 00000000000..e5132dc1ac0
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_sys_tablespaces.test
@@ -0,0 +1,3 @@
+--source include/have_innodb.inc
+
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES;
diff --git a/mysql-test/suite/innodb_i_s/innodb_sys_tablestats.opt b/mysql-test/suite/innodb_i_s/innodb_sys_tablestats.opt
new file mode 100644
index 00000000000..370dbcef0a2
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_sys_tablestats.opt
@@ -0,0 +1 @@
+--innodb_sys_tablestats
diff --git a/mysql-test/suite/innodb_i_s/innodb_sys_tablestats.result b/mysql-test/suite/innodb_i_s/innodb_sys_tablestats.result
new file mode 100644
index 00000000000..ccc8a034e00
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_sys_tablestats.result
@@ -0,0 +1,13 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS;
+Table Create Table
+INNODB_SYS_TABLESTATS CREATE TEMPORARY TABLE `INNODB_SYS_TABLESTATS` (
+ `TABLE_ID` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `NAME` varchar(64) NOT NULL DEFAULT '',
+ `STATS_INITIALIZED` int(1) NOT NULL DEFAULT 0,
+ `NUM_ROWS` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `CLUST_INDEX_SIZE` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `OTHER_INDEX_SIZE` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `MODIFIED_COUNTER` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `AUTOINC` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `REF_COUNT` int(11) NOT NULL DEFAULT 0
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/mysql-test/suite/innodb_i_s/innodb_sys_tablestats.test b/mysql-test/suite/innodb_i_s/innodb_sys_tablestats.test
new file mode 100644
index 00000000000..45d7e31a4a9
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_sys_tablestats.test
@@ -0,0 +1,3 @@
+--source include/have_innodb.inc
+
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS;
diff --git a/mysql-test/suite/innodb_i_s/innodb_sys_virtual.result b/mysql-test/suite/innodb_i_s/innodb_sys_virtual.result
new file mode 100644
index 00000000000..0d324a13bc6
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_sys_virtual.result
@@ -0,0 +1,7 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_SYS_VIRTUAL;
+Table Create Table
+INNODB_SYS_VIRTUAL CREATE TEMPORARY TABLE `INNODB_SYS_VIRTUAL` (
+ `TABLE_ID` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `POS` int(11) unsigned NOT NULL DEFAULT 0,
+ `BASE_POS` int(11) unsigned NOT NULL DEFAULT 0
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/mysql-test/suite/innodb_i_s/innodb_sys_virtual.test b/mysql-test/suite/innodb_i_s/innodb_sys_virtual.test
new file mode 100644
index 00000000000..58577f7df87
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_sys_virtual.test
@@ -0,0 +1,3 @@
+--source include/have_innodb.inc
+
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_SYS_VIRTUAL;
diff --git a/mysql-test/suite/innodb_i_s/innodb_tablespaces_encryption.opt b/mysql-test/suite/innodb_i_s/innodb_tablespaces_encryption.opt
new file mode 100644
index 00000000000..557daf9b0b9
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_tablespaces_encryption.opt
@@ -0,0 +1 @@
+--innodb_tablespaces_encryption
diff --git a/mysql-test/suite/innodb_i_s/innodb_tablespaces_encryption.result b/mysql-test/suite/innodb_i_s/innodb_tablespaces_encryption.result
new file mode 100644
index 00000000000..e824366632a
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_tablespaces_encryption.result
@@ -0,0 +1,14 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION;
+Table Create Table
+INNODB_TABLESPACES_ENCRYPTION CREATE TEMPORARY TABLE `INNODB_TABLESPACES_ENCRYPTION` (
+ `SPACE` int(11) unsigned NOT NULL DEFAULT 0,
+ `NAME` varchar(655) DEFAULT NULL,
+ `ENCRYPTION_SCHEME` int(11) unsigned NOT NULL DEFAULT 0,
+ `KEYSERVER_REQUESTS` int(11) unsigned NOT NULL DEFAULT 0,
+ `MIN_KEY_VERSION` int(11) unsigned NOT NULL DEFAULT 0,
+ `CURRENT_KEY_VERSION` int(11) unsigned NOT NULL DEFAULT 0,
+ `KEY_ROTATION_PAGE_NUMBER` bigint(21) unsigned DEFAULT NULL,
+ `KEY_ROTATION_MAX_PAGE_NUMBER` bigint(21) unsigned DEFAULT NULL,
+ `CURRENT_KEY_ID` int(11) unsigned NOT NULL DEFAULT 0,
+ `ROTATING_OR_FLUSHING` int(1) NOT NULL DEFAULT 0
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/mysql-test/suite/innodb_i_s/innodb_tablespaces_encryption.test b/mysql-test/suite/innodb_i_s/innodb_tablespaces_encryption.test
new file mode 100644
index 00000000000..da361a3b71d
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_tablespaces_encryption.test
@@ -0,0 +1,3 @@
+--source include/have_innodb.inc
+
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION;
diff --git a/mysql-test/suite/innodb_i_s/innodb_tablespaces_scrubbing.opt b/mysql-test/suite/innodb_i_s/innodb_tablespaces_scrubbing.opt
new file mode 100644
index 00000000000..e7999f9d727
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_tablespaces_scrubbing.opt
@@ -0,0 +1 @@
+--innodb_tablespaces_scrubbing
diff --git a/mysql-test/suite/innodb_i_s/innodb_tablespaces_scrubbing.result b/mysql-test/suite/innodb_i_s/innodb_tablespaces_scrubbing.result
new file mode 100644
index 00000000000..fb28253a2bb
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_tablespaces_scrubbing.result
@@ -0,0 +1,13 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_TABLESPACES_SCRUBBING;
+Table Create Table
+INNODB_TABLESPACES_SCRUBBING CREATE TEMPORARY TABLE `INNODB_TABLESPACES_SCRUBBING` (
+ `SPACE` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `NAME` varchar(655) DEFAULT NULL,
+ `COMPRESSED` int(1) unsigned NOT NULL DEFAULT 0,
+ `LAST_SCRUB_COMPLETED` datetime DEFAULT NULL,
+ `CURRENT_SCRUB_STARTED` datetime DEFAULT NULL,
+ `CURRENT_SCRUB_ACTIVE_THREADS` int(11) unsigned DEFAULT NULL,
+ `CURRENT_SCRUB_PAGE_NUMBER` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `CURRENT_SCRUB_MAX_PAGE_NUMBER` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `ON_SSD` int(1) unsigned NOT NULL DEFAULT 0
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/mysql-test/suite/innodb_i_s/innodb_tablespaces_scrubbing.test b/mysql-test/suite/innodb_i_s/innodb_tablespaces_scrubbing.test
new file mode 100644
index 00000000000..289e1ad9d20
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_tablespaces_scrubbing.test
@@ -0,0 +1,3 @@
+--source include/have_innodb.inc
+
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_TABLESPACES_SCRUBBING;
diff --git a/mysql-test/suite/innodb_i_s/innodb_trx.result b/mysql-test/suite/innodb_i_s/innodb_trx.result
new file mode 100644
index 00000000000..d9a348f132c
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_trx.result
@@ -0,0 +1,26 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_TRX;
+Table Create Table
+INNODB_TRX CREATE TEMPORARY TABLE `INNODB_TRX` (
+ `trx_id` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `trx_state` varchar(13) NOT NULL DEFAULT '',
+ `trx_started` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `trx_requested_lock_id` varchar(81) DEFAULT NULL,
+ `trx_wait_started` datetime DEFAULT NULL,
+ `trx_weight` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `trx_mysql_thread_id` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `trx_query` varchar(1024) DEFAULT NULL,
+ `trx_operation_state` varchar(64) DEFAULT NULL,
+ `trx_tables_in_use` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `trx_tables_locked` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `trx_lock_structs` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `trx_lock_memory_bytes` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `trx_rows_locked` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `trx_rows_modified` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `trx_concurrency_tickets` bigint(21) unsigned NOT NULL DEFAULT 0,
+ `trx_isolation_level` enum('READ UNCOMMITTED','READ COMMITTED','REPEATABLE READ','SERIALIZABLE') NOT NULL DEFAULT '',
+ `trx_unique_checks` int(1) NOT NULL DEFAULT 0,
+ `trx_foreign_key_checks` int(1) NOT NULL DEFAULT 0,
+ `trx_last_foreign_key_error` varchar(256) DEFAULT NULL,
+ `trx_is_read_only` int(1) NOT NULL DEFAULT 0,
+ `trx_autocommit_non_locking` int(1) NOT NULL DEFAULT 0
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/mysql-test/suite/innodb_i_s/innodb_trx.test b/mysql-test/suite/innodb_i_s/innodb_trx.test
new file mode 100644
index 00000000000..01bb141777e
--- /dev/null
+++ b/mysql-test/suite/innodb_i_s/innodb_trx.test
@@ -0,0 +1,3 @@
+--source include/have_innodb.inc
+
+SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_TRX;
diff --git a/mysql-test/suite/innodb_zip/r/16k,full_crc32.rdiff b/mysql-test/suite/innodb_zip/r/16k,full_crc32.rdiff
index 97daeacd1e8..5bb15da9264 100644
--- a/mysql-test/suite/innodb_zip/r/16k,full_crc32.rdiff
+++ b/mysql-test/suite/innodb_zip/r/16k,full_crc32.rdiff
@@ -3,14 +3,14 @@
@@ -41,10 +41,10 @@
test/t4 5 33 PRIMARY 3 3 1 50
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
- Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path
--test/t1 Single DEFAULT DEFAULT Compact or Redundant MYSQLD_DATADIR/test/t1.ibd
--test/t2 Single DEFAULT DEFAULT Compact or Redundant MYSQLD_DATADIR/test/t2.ibd
-+test/t1 Single DEFAULT DEFAULT NULL MYSQLD_DATADIR/test/t1.ibd
-+test/t2 Single DEFAULT DEFAULT NULL MYSQLD_DATADIR/test/t2.ibd
- test/t3 Single DEFAULT 8192 Compressed MYSQLD_DATADIR/test/t3.ibd
--test/t4 Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t4.ibd
-+test/t4 Single DEFAULT DEFAULT NULL MYSQLD_DATADIR/test/t4.ibd
+ Space_Name Page_Size Zip_Size Formats_Permitted Path
+-test/t1 DEFAULT DEFAULT Compact or Redundant MYSQLD_DATADIR/test/t1.ibd
+-test/t2 DEFAULT DEFAULT Compact or Redundant MYSQLD_DATADIR/test/t2.ibd
++test/t1 DEFAULT DEFAULT NULL MYSQLD_DATADIR/test/t1.ibd
++test/t2 DEFAULT DEFAULT NULL MYSQLD_DATADIR/test/t2.ibd
+ test/t3 DEFAULT 8192 Compressed MYSQLD_DATADIR/test/t3.ibd
+-test/t4 DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t4.ibd
++test/t4 DEFAULT DEFAULT NULL MYSQLD_DATADIR/test/t4.ibd
DROP TABLE t1, t2, t3, t4;
# Test 4) The maximum row size is dependent upon the page size.
# Redundant: 8123, Compact: 8126.
diff --git a/mysql-test/suite/innodb_zip/r/16k,strict_full_crc32.rdiff b/mysql-test/suite/innodb_zip/r/16k,strict_full_crc32.rdiff
index 97daeacd1e8..5bb15da9264 100644
--- a/mysql-test/suite/innodb_zip/r/16k,strict_full_crc32.rdiff
+++ b/mysql-test/suite/innodb_zip/r/16k,strict_full_crc32.rdiff
@@ -3,14 +3,14 @@
@@ -41,10 +41,10 @@
test/t4 5 33 PRIMARY 3 3 1 50
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
- Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path
--test/t1 Single DEFAULT DEFAULT Compact or Redundant MYSQLD_DATADIR/test/t1.ibd
--test/t2 Single DEFAULT DEFAULT Compact or Redundant MYSQLD_DATADIR/test/t2.ibd
-+test/t1 Single DEFAULT DEFAULT NULL MYSQLD_DATADIR/test/t1.ibd
-+test/t2 Single DEFAULT DEFAULT NULL MYSQLD_DATADIR/test/t2.ibd
- test/t3 Single DEFAULT 8192 Compressed MYSQLD_DATADIR/test/t3.ibd
--test/t4 Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t4.ibd
-+test/t4 Single DEFAULT DEFAULT NULL MYSQLD_DATADIR/test/t4.ibd
+ Space_Name Page_Size Zip_Size Formats_Permitted Path
+-test/t1 DEFAULT DEFAULT Compact or Redundant MYSQLD_DATADIR/test/t1.ibd
+-test/t2 DEFAULT DEFAULT Compact or Redundant MYSQLD_DATADIR/test/t2.ibd
++test/t1 DEFAULT DEFAULT NULL MYSQLD_DATADIR/test/t1.ibd
++test/t2 DEFAULT DEFAULT NULL MYSQLD_DATADIR/test/t2.ibd
+ test/t3 DEFAULT 8192 Compressed MYSQLD_DATADIR/test/t3.ibd
+-test/t4 DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t4.ibd
++test/t4 DEFAULT DEFAULT NULL MYSQLD_DATADIR/test/t4.ibd
DROP TABLE t1, t2, t3, t4;
# Test 4) The maximum row size is dependent upon the page size.
# Redundant: 8123, Compact: 8126.
diff --git a/mysql-test/suite/innodb_zip/r/page_size,4k.rdiff b/mysql-test/suite/innodb_zip/r/page_size,4k.rdiff
index 0423520455c..2ee4852ce2a 100644
--- a/mysql-test/suite/innodb_zip/r/page_size,4k.rdiff
+++ b/mysql-test/suite/innodb_zip/r/page_size,4k.rdiff
@@ -17,12 +17,12 @@
+test/t3 5 37 PRIMARY 3 3 1 50
test/t4 5 33 PRIMARY 3 3 1 50
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
- Space_Name Space_Type Page_Size Zip_Size Path
- test/t1 Single DEFAULT DEFAULT MYSQLD_DATADIR/test/t1.ibd
- test/t2 Single DEFAULT DEFAULT MYSQLD_DATADIR/test/t2.ibd
--test/t3 Single DEFAULT 8192 MYSQLD_DATADIR/test/t3.ibd
-+test/t3 Single DEFAULT 2048 MYSQLD_DATADIR/test/t3.ibd
- test/t4 Single DEFAULT DEFAULT MYSQLD_DATADIR/test/t4.ibd
+ Space_Name Page_Size Zip_Size Path
+ test/t1 DEFAULT DEFAULT MYSQLD_DATADIR/test/t1.ibd
+ test/t2 DEFAULT DEFAULT MYSQLD_DATADIR/test/t2.ibd
+-test/t3 DEFAULT 8192 MYSQLD_DATADIR/test/t3.ibd
++test/t3 DEFAULT 2048 MYSQLD_DATADIR/test/t3.ibd
+ test/t4 DEFAULT DEFAULT MYSQLD_DATADIR/test/t4.ibd
DROP TABLE t1, t2, t3, t4;
# Test 4) The maximum row size is dependent upon the page size.
@@ -51,141 +51,90 @@
diff --git a/mysql-test/suite/innodb_zip/r/page_size,8k.rdiff b/mysql-test/suite/innodb_zip/r/page_size,8k.rdiff
index 173b20a3fcf..e74b82e3215 100644
--- a/mysql-test/suite/innodb_zip/r/page_size,8k.rdiff
+++ b/mysql-test/suite/innodb_zip/r/page_size,8k.rdiff
@@ -17,12 +17,12 @@
+test/t3 5 39 PRIMARY 3 3 1 50
test/t4 5 33 PRIMARY 3 3 1 50
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
- Space_Name Space_Type Page_Size Zip_Size Path
- test/t1 Single DEFAULT DEFAULT MYSQLD_DATADIR/test/t1.ibd
- test/t2 Single DEFAULT DEFAULT MYSQLD_DATADIR/test/t2.ibd
--test/t3 Single DEFAULT 8192 MYSQLD_DATADIR/test/t3.ibd
-+test/t3 Single DEFAULT 4096 MYSQLD_DATADIR/test/t3.ibd
- test/t4 Single DEFAULT DEFAULT MYSQLD_DATADIR/test/t4.ibd
+ Space_Name Page_Size Zip_Size Path
+ test/t1 DEFAULT DEFAULT MYSQLD_DATADIR/test/t1.ibd
+ test/t2 DEFAULT DEFAULT MYSQLD_DATADIR/test/t2.ibd
+-test/t3 DEFAULT 8192 MYSQLD_DATADIR/test/t3.ibd
++test/t3 DEFAULT 4096 MYSQLD_DATADIR/test/t3.ibd
+ test/t4 DEFAULT DEFAULT MYSQLD_DATADIR/test/t4.ibd
DROP TABLE t1, t2, t3, t4;
# Test 4) The maximum row size is dependent upon the page size.
@@ -53,133 +53,97 @@
diff --git a/mysql-test/suite/innodb_zip/r/page_size.result b/mysql-test/suite/innodb_zip/r/page_size.result
index 90018e2c8c2..e65a57326ec 100644
--- a/mysql-test/suite/innodb_zip/r/page_size.result
+++ b/mysql-test/suite/innodb_zip/r/page_size.result
@@ -39,11 +39,11 @@ test/t2 5 1 PRIMARY 3 3 1 50
test/t3 5 41 PRIMARY 3 3 1 50
test/t4 5 33 PRIMARY 3 3 1 50
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
-Space_Name Space_Type Page_Size Zip_Size Path
-test/t1 Single DEFAULT DEFAULT MYSQLD_DATADIR/test/t1.ibd
-test/t2 Single DEFAULT DEFAULT MYSQLD_DATADIR/test/t2.ibd
-test/t3 Single DEFAULT 8192 MYSQLD_DATADIR/test/t3.ibd
-test/t4 Single DEFAULT DEFAULT MYSQLD_DATADIR/test/t4.ibd
+Space_Name Page_Size Zip_Size Path
+test/t1 DEFAULT DEFAULT MYSQLD_DATADIR/test/t1.ibd
+test/t2 DEFAULT DEFAULT MYSQLD_DATADIR/test/t2.ibd
+test/t3 DEFAULT 8192 MYSQLD_DATADIR/test/t3.ibd
+test/t4 DEFAULT DEFAULT MYSQLD_DATADIR/test/t4.ibd
DROP TABLE t1, t2, t3, t4;
# Test 4) The maximum row size is dependent upon the page size.
# Each row format has its own amount of overhead that
diff --git a/mysql-test/suite/innodb_zip/r/restart.result b/mysql-test/suite/innodb_zip/r/restart.result
index 5b488c277aa..59d739db5b5 100644
--- a/mysql-test/suite/innodb_zip/r/restart.result
+++ b/mysql-test/suite/innodb_zip/r/restart.result
@@ -196,33 +196,33 @@ count(*)
# Show these tables in information_schema.
#
=== information_schema.innodb_sys_tables and innodb_sys_tablespaces ===
-Table Name Tablespace Table Flags Columns Row Format Zip Size Space Type
-test/t1_restart test/t1_restart 0 8 Redundant 0 Single
-test/t2_restart test/t2_restart 1 8 Compact 0 Single
-test/t3_restart test/t3_restart 37 8 Compressed 2048 Single
-test/t4_restart test/t4_restart 33 8 Dynamic 0 Single
-test/t5_restart test/t5_restart 97 8 Dynamic 0 Single
-test/t6_restart#p#p0 test/t6_restart#p#p0 101 8 Compressed 2048 Single
-test/t6_restart#p#p1 test/t6_restart#p#p1 101 8 Compressed 2048 Single
-test/t6_restart#p#p2 test/t6_restart#p#p2 101 8 Compressed 2048 Single
-test/t7_restart#p#p0#sp#s0 test/t7_restart#p#p0#sp#s0 97 8 Dynamic 0 Single
-test/t7_restart#p#p0#sp#s1 test/t7_restart#p#p0#sp#s1 97 8 Dynamic 0 Single
-test/t7_restart#p#p1#sp#s2 test/t7_restart#p#p1#sp#s2 97 8 Dynamic 0 Single
-test/t7_restart#p#p1#sp#s3 test/t7_restart#p#p1#sp#s3 97 8 Dynamic 0 Single
+Table Name Tablespace Table Flags Columns Row Format Zip Size
+test/t1_restart test/t1_restart 0 8 Redundant 0
+test/t2_restart test/t2_restart 1 8 Compact 0
+test/t3_restart test/t3_restart 37 8 Compressed 2048
+test/t4_restart test/t4_restart 33 8 Dynamic 0
+test/t5_restart test/t5_restart 97 8 Dynamic 0
+test/t6_restart#p#p0 test/t6_restart#p#p0 101 8 Compressed 2048
+test/t6_restart#p#p1 test/t6_restart#p#p1 101 8 Compressed 2048
+test/t6_restart#p#p2 test/t6_restart#p#p2 101 8 Compressed 2048
+test/t7_restart#p#p0#sp#s0 test/t7_restart#p#p0#sp#s0 97 8 Dynamic 0
+test/t7_restart#p#p0#sp#s1 test/t7_restart#p#p0#sp#s1 97 8 Dynamic 0
+test/t7_restart#p#p1#sp#s2 test/t7_restart#p#p1#sp#s2 97 8 Dynamic 0
+test/t7_restart#p#p1#sp#s3 test/t7_restart#p#p1#sp#s3 97 8 Dynamic 0
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
-Space_Name Space_Type Page_Size Zip_Size Path
-test/t1_restart Single DEFAULT DEFAULT MYSQLD_DATADIR/test/t1_restart.ibd
-test/t2_restart Single DEFAULT DEFAULT MYSQLD_DATADIR/test/t2_restart.ibd
-test/t3_restart Single DEFAULT 2048 MYSQLD_DATADIR/test/t3_restart.ibd
-test/t4_restart Single DEFAULT DEFAULT MYSQLD_DATADIR/test/t4_restart.ibd
-test/t5_restart Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t5_restart.ibd
-test/t6_restart#p#p0 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p0.ibd
-test/t6_restart#p#p1 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p1.ibd
-test/t6_restart#p#p2 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p2.ibd
-test/t7_restart#p#p0#sp#s0 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s0.ibd
-test/t7_restart#p#p0#sp#s1 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s1.ibd
-test/t7_restart#p#p1#sp#s2 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s2.ibd
-test/t7_restart#p#p1#sp#s3 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s3.ibd
+Space_Name Page_Size Zip_Size Path
+test/t1_restart DEFAULT DEFAULT MYSQLD_DATADIR/test/t1_restart.ibd
+test/t2_restart DEFAULT DEFAULT MYSQLD_DATADIR/test/t2_restart.ibd
+test/t3_restart DEFAULT 2048 MYSQLD_DATADIR/test/t3_restart.ibd
+test/t4_restart DEFAULT DEFAULT MYSQLD_DATADIR/test/t4_restart.ibd
+test/t5_restart DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t5_restart.ibd
+test/t6_restart#p#p0 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p0.ibd
+test/t6_restart#p#p1 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p1.ibd
+test/t6_restart#p#p2 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p2.ibd
+test/t7_restart#p#p0#sp#s0 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s0.ibd
+test/t7_restart#p#p0#sp#s1 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s1.ibd
+test/t7_restart#p#p1#sp#s2 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s2.ibd
+test/t7_restart#p#p1#sp#s3 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s3.ibd
#
# Shutdown the server and list the tablespace OS files
#
@@ -381,33 +381,33 @@ count(*)
# Show these tables in information_schema.
#
=== information_schema.innodb_sys_tables and innodb_sys_tablespaces ===
-Table Name Tablespace Table Flags Columns Row Format Zip Size Space Type
-test/t1_restart test/t1_restart 0 8 Redundant 0 Single
-test/t2_restart test/t2_restart 1 8 Compact 0 Single
-test/t3_restart test/t3_restart 37 8 Compressed 2048 Single
-test/t4_restart test/t4_restart 33 8 Dynamic 0 Single
-test/t5_restart test/t5_restart 97 8 Dynamic 0 Single
-test/t6_restart#p#p0 test/t6_restart#p#p0 101 8 Compressed 2048 Single
-test/t6_restart#p#p1 test/t6_restart#p#p1 101 8 Compressed 2048 Single
-test/t6_restart#p#p2 test/t6_restart#p#p2 101 8 Compressed 2048 Single
-test/t7_restart#p#p0#sp#s0 test/t7_restart#p#p0#sp#s0 97 8 Dynamic 0 Single
-test/t7_restart#p#p0#sp#s1 test/t7_restart#p#p0#sp#s1 97 8 Dynamic 0 Single
-test/t7_restart#p#p1#sp#s2 test/t7_restart#p#p1#sp#s2 97 8 Dynamic 0 Single
-test/t7_restart#p#p1#sp#s3 test/t7_restart#p#p1#sp#s3 97 8 Dynamic 0 Single
+Table Name Tablespace Table Flags Columns Row Format Zip Size
+test/t1_restart test/t1_restart 0 8 Redundant 0
+test/t2_restart test/t2_restart 1 8 Compact 0
+test/t3_restart test/t3_restart 37 8 Compressed 2048
+test/t4_restart test/t4_restart 33 8 Dynamic 0
+test/t5_restart test/t5_restart 97 8 Dynamic 0
+test/t6_restart#p#p0 test/t6_restart#p#p0 101 8 Compressed 2048
+test/t6_restart#p#p1 test/t6_restart#p#p1 101 8 Compressed 2048
+test/t6_restart#p#p2 test/t6_restart#p#p2 101 8 Compressed 2048
+test/t7_restart#p#p0#sp#s0 test/t7_restart#p#p0#sp#s0 97 8 Dynamic 0
+test/t7_restart#p#p0#sp#s1 test/t7_restart#p#p0#sp#s1 97 8 Dynamic 0
+test/t7_restart#p#p1#sp#s2 test/t7_restart#p#p1#sp#s2 97 8 Dynamic 0
+test/t7_restart#p#p1#sp#s3 test/t7_restart#p#p1#sp#s3 97 8 Dynamic 0
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
-Space_Name Space_Type Page_Size Zip_Size Path
-test/t1_restart Single DEFAULT DEFAULT MYSQLD_DATADIR/test/t1_restart.ibd
-test/t2_restart Single DEFAULT DEFAULT MYSQLD_DATADIR/test/t2_restart.ibd
-test/t3_restart Single DEFAULT 2048 MYSQLD_DATADIR/test/t3_restart.ibd
-test/t4_restart Single DEFAULT DEFAULT MYSQLD_DATADIR/test/t4_restart.ibd
-test/t5_restart Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t5_restart.ibd
-test/t6_restart#p#p0 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p0.ibd
-test/t6_restart#p#p1 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p1.ibd
-test/t6_restart#p#p2 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p2.ibd
-test/t7_restart#p#p0#sp#s0 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s0.ibd
-test/t7_restart#p#p0#sp#s1 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s1.ibd
-test/t7_restart#p#p1#sp#s2 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s2.ibd
-test/t7_restart#p#p1#sp#s3 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s3.ibd
+Space_Name Page_Size Zip_Size Path
+test/t1_restart DEFAULT DEFAULT MYSQLD_DATADIR/test/t1_restart.ibd
+test/t2_restart DEFAULT DEFAULT MYSQLD_DATADIR/test/t2_restart.ibd
+test/t3_restart DEFAULT 2048 MYSQLD_DATADIR/test/t3_restart.ibd
+test/t4_restart DEFAULT DEFAULT MYSQLD_DATADIR/test/t4_restart.ibd
+test/t5_restart DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t5_restart.ibd
+test/t6_restart#p#p0 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p0.ibd
+test/t6_restart#p#p1 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p1.ibd
+test/t6_restart#p#p2 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p2.ibd
+test/t7_restart#p#p0#sp#s0 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s0.ibd
+test/t7_restart#p#p0#sp#s1 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s1.ibd
+test/t7_restart#p#p1#sp#s2 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s2.ibd
+test/t7_restart#p#p1#sp#s3 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s3.ibd
DROP TABLE t1_restart;
DROP TABLE t2_restart;
DROP TABLE t3_restart;
@@ -418,16 +418,16 @@ TRUNCATE TABLE t5_restart;
ALTER TABLE t6_restart TRUNCATE PARTITION p2;
ALTER TABLE t7_restart TRUNCATE PARTITION p1;
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
-Space_Name Space_Type Page_Size Zip_Size Path
-test/t4_restart Single DEFAULT DEFAULT MYSQLD_DATADIR/test/t4_restart.ibd
-test/t6_restart#p#p0 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p0.ibd
-test/t6_restart#p#p1 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p1.ibd
-test/t7_restart#p#p0#sp#s0 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s0.ibd
-test/t7_restart#p#p0#sp#s1 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s1.ibd
-test/t5_restart Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t5_restart.ibd
-test/t6_restart#p#p2 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p2.ibd
-test/t7_restart#p#p1#sp#s2 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s2.ibd
-test/t7_restart#p#p1#sp#s3 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s3.ibd
+Space_Name Page_Size Zip_Size Path
+test/t4_restart DEFAULT DEFAULT MYSQLD_DATADIR/test/t4_restart.ibd
+test/t6_restart#p#p0 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p0.ibd
+test/t6_restart#p#p1 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p1.ibd
+test/t7_restart#p#p0#sp#s0 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s0.ibd
+test/t7_restart#p#p0#sp#s1 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s1.ibd
+test/t5_restart DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t5_restart.ibd
+test/t6_restart#p#p2 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p2.ibd
+test/t7_restart#p#p1#sp#s2 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s2.ibd
+test/t7_restart#p#p1#sp#s3 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s3.ibd
INSERT INTO t5_restart VALUES (1000000000, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot');
INSERT INTO t5_restart (SELECT 0, c2, c3, c4, c5 FROM t5_restart);
INSERT INTO t5_restart (SELECT 0, c2, c3, c4, c5 FROM t5_restart);
@@ -523,16 +523,16 @@ SHOW VARIABLES LIKE 'innodb_file_per_table';
Variable_name Value
innodb_file_per_table ON
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
-Space_Name Space_Type Page_Size Zip_Size Path
-test/t4_restart Single DEFAULT DEFAULT MYSQLD_DATADIR/test/t4_restart.ibd
-test/t6_restart#p#p0 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p0.ibd
-test/t6_restart#p#p1 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p1.ibd
-test/t7_restart#p#p0#sp#s0 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s0.ibd
-test/t7_restart#p#p0#sp#s1 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s1.ibd
-test/t5_restart Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t5_restart.ibd
-test/t6_restart#p#p2 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p2.ibd
-test/t7_restart#p#p1#sp#s2 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s2.ibd
-test/t7_restart#p#p1#sp#s3 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s3.ibd
+Space_Name Page_Size Zip_Size Path
+test/t4_restart DEFAULT DEFAULT MYSQLD_DATADIR/test/t4_restart.ibd
+test/t6_restart#p#p0 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p0.ibd
+test/t6_restart#p#p1 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p1.ibd
+test/t7_restart#p#p0#sp#s0 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s0.ibd
+test/t7_restart#p#p0#sp#s1 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s1.ibd
+test/t5_restart DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t5_restart.ibd
+test/t6_restart#p#p2 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p2.ibd
+test/t7_restart#p#p1#sp#s2 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s2.ibd
+test/t7_restart#p#p1#sp#s3 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s3.ibd
SELECT count(*) FROM t5_restart;
count(*)
8
@@ -624,16 +624,16 @@ RENAME TABLE t5_restart TO t55_restart;
RENAME TABLE t6_restart TO t66_restart;
RENAME TABLE t7_restart TO t77_restart;
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
-Space_Name Space_Type Page_Size Zip_Size Path
-test/t4_restart Single DEFAULT DEFAULT MYSQLD_DATADIR/test/t4_restart.ibd
-test/t66_restart#p#p0 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p0.ibd
-test/t66_restart#p#p1 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p1.ibd
-test/t77_restart#p#p0#sp#s0 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p0#sp#s0.ibd
-test/t77_restart#p#p0#sp#s1 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p0#sp#s1.ibd
-test/t55_restart Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t55_restart.ibd
-test/t66_restart#p#p2 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p2.ibd
-test/t77_restart#p#p1#sp#s2 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s2.ibd
-test/t77_restart#p#p1#sp#s3 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s3.ibd
+Space_Name Page_Size Zip_Size Path
+test/t4_restart DEFAULT DEFAULT MYSQLD_DATADIR/test/t4_restart.ibd
+test/t66_restart#p#p0 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p0.ibd
+test/t66_restart#p#p1 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p1.ibd
+test/t77_restart#p#p0#sp#s0 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p0#sp#s0.ibd
+test/t77_restart#p#p0#sp#s1 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p0#sp#s1.ibd
+test/t55_restart DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t55_restart.ibd
+test/t66_restart#p#p2 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p2.ibd
+test/t77_restart#p#p1#sp#s2 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s2.ibd
+test/t77_restart#p#p1#sp#s3 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s3.ibd
INSERT INTO t55_restart (SELECT 0, c2, c3, c4, c5 FROM t55_restart);
SELECT count(*) FROM t55_restart;
count(*)
@@ -722,16 +722,16 @@ SHOW VARIABLES LIKE 'innodb_file_per_table';
Variable_name Value
innodb_file_per_table ON
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
-Space_Name Space_Type Page_Size Zip_Size Path
-test/t4_restart Single DEFAULT DEFAULT MYSQLD_DATADIR/test/t4_restart.ibd
-test/t66_restart#p#p0 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p0.ibd
-test/t66_restart#p#p1 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p1.ibd
-test/t77_restart#p#p0#sp#s0 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p0#sp#s0.ibd
-test/t77_restart#p#p0#sp#s1 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p0#sp#s1.ibd
-test/t55_restart Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t55_restart.ibd
-test/t66_restart#p#p2 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p2.ibd
-test/t77_restart#p#p1#sp#s2 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s2.ibd
-test/t77_restart#p#p1#sp#s3 Single DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s3.ibd
+Space_Name Page_Size Zip_Size Path
+test/t4_restart DEFAULT DEFAULT MYSQLD_DATADIR/test/t4_restart.ibd
+test/t66_restart#p#p0 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p0.ibd
+test/t66_restart#p#p1 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p1.ibd
+test/t77_restart#p#p0#sp#s0 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p0#sp#s0.ibd
+test/t77_restart#p#p0#sp#s1 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p0#sp#s1.ibd
+test/t55_restart DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t55_restart.ibd
+test/t66_restart#p#p2 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p2.ibd
+test/t77_restart#p#p1#sp#s2 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s2.ibd
+test/t77_restart#p#p1#sp#s3 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s3.ibd
INSERT INTO t55_restart (SELECT 0, c2, c3, c4, c5 FROM t55_restart);
SELECT count(*) FROM t55_restart;
count(*)
@@ -856,16 +856,16 @@ t77_restart#p#p1#sp#s3.ibd
#
# restart
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
-Space_Name Space_Type Page_Size Zip_Size Path
-test/t4_restart Single DEFAULT DEFAULT MYSQL_TMP_DIR/new_dir/test/t4_restart.ibd
-test/t66_restart#p#p0 Single DEFAULT DEFAULT MYSQL_TMP_DIR/new_dir/test/t66_restart#p#p0.ibd
-test/t66_restart#p#p1 Single DEFAULT DEFAULT MYSQL_TMP_DIR/new_dir/test/t66_restart#p#p1.ibd
-test/t77_restart#p#p0#sp#s0 Single DEFAULT DEFAULT MYSQL_TMP_DIR/new_dir/test/t77_restart#p#p0#sp#s0.ibd
-test/t77_restart#p#p0#sp#s1 Single DEFAULT DEFAULT MYSQL_TMP_DIR/new_dir/test/t77_restart#p#p0#sp#s1.ibd
-test/t55_restart Single DEFAULT DEFAULT MYSQL_TMP_DIR/new_dir/test/t55_restart.ibd
-test/t66_restart#p#p2 Single DEFAULT DEFAULT MYSQL_TMP_DIR/new_dir/test/t66_restart#p#p2.ibd
-test/t77_restart#p#p1#sp#s2 Single DEFAULT DEFAULT MYSQL_TMP_DIR/new_dir/test/t77_restart#p#p1#sp#s2.ibd
-test/t77_restart#p#p1#sp#s3 Single DEFAULT DEFAULT MYSQL_TMP_DIR/new_dir/test/t77_restart#p#p1#sp#s3.ibd
+Space_Name Page_Size Zip_Size Path
+test/t4_restart DEFAULT DEFAULT MYSQL_TMP_DIR/new_dir/test/t4_restart.ibd
+test/t66_restart#p#p0 DEFAULT DEFAULT MYSQL_TMP_DIR/new_dir/test/t66_restart#p#p0.ibd
+test/t66_restart#p#p1 DEFAULT DEFAULT MYSQL_TMP_DIR/new_dir/test/t66_restart#p#p1.ibd
+test/t77_restart#p#p0#sp#s0 DEFAULT DEFAULT MYSQL_TMP_DIR/new_dir/test/t77_restart#p#p0#sp#s0.ibd
+test/t77_restart#p#p0#sp#s1 DEFAULT DEFAULT MYSQL_TMP_DIR/new_dir/test/t77_restart#p#p0#sp#s1.ibd
+test/t55_restart DEFAULT DEFAULT MYSQL_TMP_DIR/new_dir/test/t55_restart.ibd
+test/t66_restart#p#p2 DEFAULT DEFAULT MYSQL_TMP_DIR/new_dir/test/t66_restart#p#p2.ibd
+test/t77_restart#p#p1#sp#s2 DEFAULT DEFAULT MYSQL_TMP_DIR/new_dir/test/t77_restart#p#p1#sp#s2.ibd
+test/t77_restart#p#p1#sp#s3 DEFAULT DEFAULT MYSQL_TMP_DIR/new_dir/test/t77_restart#p#p1#sp#s3.ibd
INSERT INTO t4_restart (SELECT 0, c2, c3, c4, c5 FROM t4_restart);
SELECT count(*) FROM t4_restart;
count(*)
@@ -994,16 +994,16 @@ t77_restart.par
#
# restart
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
-Space_Name Space_Type Page_Size Zip_Size Path
-test/t4_restart Single DEFAULT DEFAULT MYSQLD_DATADIR/test/t4_restart.ibd
-test/t66_restart#p#p0 Single DEFAULT DEFAULT MYSQLD_DATADIR/test/t66_restart#p#p0.ibd
-test/t66_restart#p#p1 Single DEFAULT DEFAULT MYSQLD_DATADIR/test/t66_restart#p#p1.ibd
-test/t77_restart#p#p0#sp#s0 Single DEFAULT DEFAULT MYSQLD_DATADIR/test/t77_restart#p#p0#sp#s0.ibd
-test/t77_restart#p#p0#sp#s1 Single DEFAULT DEFAULT MYSQLD_DATADIR/test/t77_restart#p#p0#sp#s1.ibd
-test/t55_restart Single DEFAULT DEFAULT MYSQLD_DATADIR/test/t55_restart.ibd
-test/t66_restart#p#p2 Single DEFAULT DEFAULT MYSQLD_DATADIR/test/t66_restart#p#p2.ibd
-test/t77_restart#p#p1#sp#s2 Single DEFAULT DEFAULT MYSQLD_DATADIR/test/t77_restart#p#p1#sp#s2.ibd
-test/t77_restart#p#p1#sp#s3 Single DEFAULT DEFAULT MYSQLD_DATADIR/test/t77_restart#p#p1#sp#s3.ibd
+Space_Name Page_Size Zip_Size Path
+test/t4_restart DEFAULT DEFAULT MYSQLD_DATADIR/test/t4_restart.ibd
+test/t66_restart#p#p0 DEFAULT DEFAULT MYSQLD_DATADIR/test/t66_restart#p#p0.ibd
+test/t66_restart#p#p1 DEFAULT DEFAULT MYSQLD_DATADIR/test/t66_restart#p#p1.ibd
+test/t77_restart#p#p0#sp#s0 DEFAULT DEFAULT MYSQLD_DATADIR/test/t77_restart#p#p0#sp#s0.ibd
+test/t77_restart#p#p0#sp#s1 DEFAULT DEFAULT MYSQLD_DATADIR/test/t77_restart#p#p0#sp#s1.ibd
+test/t55_restart DEFAULT DEFAULT MYSQLD_DATADIR/test/t55_restart.ibd
+test/t66_restart#p#p2 DEFAULT DEFAULT MYSQLD_DATADIR/test/t66_restart#p#p2.ibd
+test/t77_restart#p#p1#sp#s2 DEFAULT DEFAULT MYSQLD_DATADIR/test/t77_restart#p#p1#sp#s2.ibd
+test/t77_restart#p#p1#sp#s3 DEFAULT DEFAULT MYSQLD_DATADIR/test/t77_restart#p#p1#sp#s3.ibd
INSERT INTO t4_restart (SELECT 0, c2, c3, c4, c5 FROM t4_restart);
SELECT count(*) FROM t4_restart;
count(*)
diff --git a/mysql-test/suite/innodb_zip/r/wl5522_debug_zip.result b/mysql-test/suite/innodb_zip/r/wl5522_debug_zip.result
index b3a4ad2b0ba..4ce6fe769fd 100644
--- a/mysql-test/suite/innodb_zip/r/wl5522_debug_zip.result
+++ b/mysql-test/suite/innodb_zip/r/wl5522_debug_zip.result
@@ -120,7 +120,6 @@ ROW_FORMAT=COMPRESSED;
connect purge_control,localhost,root;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection default;
-SET GLOBAL innodb_disable_background_merge=ON;
SET GLOBAL innodb_monitor_reset = ibuf_merges;
SET GLOBAL innodb_monitor_reset = ibuf_merges_insert;
INSERT INTO test_wl5522.t1(c2, c3, c4) VALUES
@@ -271,6 +270,7 @@ SELECT name
FROM information_schema.innodb_metrics
WHERE name = 'ibuf_merges_insert' AND count = 0;
name
+ibuf_merges_insert
FLUSH TABLES test_wl5522.t1 FOR EXPORT;
backup: t1
UNLOCK TABLES;
@@ -278,12 +278,10 @@ SELECT name
FROM information_schema.innodb_metrics
WHERE name = 'ibuf_merges' AND count > 0;
name
-ibuf_merges
SELECT name
FROM information_schema.innodb_metrics
WHERE name = 'ibuf_merges_inserts' AND count > 0;
name
-SET GLOBAL innodb_disable_background_merge=OFF;
connection purge_control;
COMMIT;
disconnect purge_control;
@@ -503,8 +501,6 @@ SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table `t1`
SET SESSION debug_dbug="+d,ib_import_create_index_failure_1";
ALTER TABLE test_wl5522.t1 ADD INDEX idx(c1);
-Warnings:
-Warning 1814 Tablespace has been discarded for table `t1`
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
diff --git a/mysql-test/suite/innodb_zip/r/wl5522_zip.result b/mysql-test/suite/innodb_zip/r/wl5522_zip.result
index 03bfd2cac7a..9d6bcb3629f 100644
--- a/mysql-test/suite/innodb_zip/r/wl5522_zip.result
+++ b/mysql-test/suite/innodb_zip/r/wl5522_zip.result
@@ -265,13 +265,13 @@ restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Schema mismatch (Index x not found in tablespace meta-data file.)
ALTER TABLE t1 DROP INDEX x;
-Warnings:
-Warning 1814 Tablespace has been discarded for table `t1`
ALTER TABLE t1 ADD INDEX idx(c2);
Warnings:
Warning 1814 Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
+Warnings:
+Warning 1814 Tablespace has been discarded for table `t1`
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
diff --git a/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test b/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test
index e42f1baed74..22f729eccbe 100644
--- a/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test
+++ b/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test
@@ -312,9 +312,6 @@ connect (purge_control,localhost,root);
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection default;
-# Disable change buffer merge from the master thread, additionally
-# enable aggressive flushing so that more changes are buffered.
-SET GLOBAL innodb_disable_background_merge=ON;
SET GLOBAL innodb_monitor_reset = ibuf_merges;
SET GLOBAL innodb_monitor_reset = ibuf_merges_insert;
@@ -377,8 +374,6 @@ SELECT name
FROM information_schema.innodb_metrics
WHERE name = 'ibuf_merges_inserts' AND count > 0;
-SET GLOBAL innodb_disable_background_merge=OFF;
-
# Enable normal operation
connection purge_control;
COMMIT;
diff --git a/mysql-test/suite/maria/icp.result b/mysql-test/suite/maria/icp.result
index 0a7105fcfad..ac51c5f6607 100644
--- a/mysql-test/suite/maria/icp.result
+++ b/mysql-test/suite/maria/icp.result
@@ -430,9 +430,9 @@ EXPLAIN
SELECT * FROM t1
WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON it.i=it.i WHERE it.pk-t1.i<10);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where
-2 DEPENDENT SUBQUERY it eq_ref PRIMARY PRIMARY 4 func 1 Using index condition
-2 DEPENDENT SUBQUERY t2 index NULL PRIMARY 4 NULL 3 Using index; Using join buffer (flat, BNL join)
+1 PRIMARY t1 ALL NULL NULL NULL NULL # Using where
+2 DEPENDENT SUBQUERY it eq_ref PRIMARY PRIMARY 4 func # Using index condition
+2 DEPENDENT SUBQUERY t2 index NULL PRIMARY 4 NULL # Using index; Using join buffer (flat, BNL join)
SELECT * FROM t1
WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON it.i=it.i WHERE it.pk-t1.i<10);
pk i
diff --git a/mysql-test/suite/maria/maria-autozerofill.test b/mysql-test/suite/maria/maria-autozerofill.test
index 4baa118302c..c24f89576f8 100644
--- a/mysql-test/suite/maria/maria-autozerofill.test
+++ b/mysql-test/suite/maria/maria-autozerofill.test
@@ -115,7 +115,14 @@ check table t5;
# Check that if we zerofill with aria_chk, we should not get any warnings when
# accessing the table
+--error 0,1,11,139
--exec $MARIA_CHK --ignore-control-file --zerofill $MYSQLD_DATADIR/mysqltest/t6 >$MYSQLTEST_VARDIR/tmp/autozerofill.txt 2>&1
+if ($sys_errno != 0)
+{
+--cat_file $MYSQLTEST_VARDIR/tmp/autozerofill.txt
+--die
+}
+
select * from t6;
check table t6;
diff --git a/mysql-test/suite/maria/maria-ucs2.result b/mysql-test/suite/maria/maria-ucs2.result
index 1a54ab78081..83eaf88e660 100644
--- a/mysql-test/suite/maria/maria-ucs2.result
+++ b/mysql-test/suite/maria/maria-ucs2.result
@@ -16,8 +16,6 @@ Table Op Msg_type Msg_text
test.t1 check status OK
SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
ALTER TABLE t1 MODIFY a VARCHAR(800) CHARSET `ucs2`;
-Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
@@ -25,12 +23,12 @@ SHOW CREATE table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(800) CHARACTER SET ucs2 DEFAULT NULL,
- KEY `a` (`a`(500))
+ KEY `a` (`a`)
) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
DROP TABLE t1;
-CREATE TABLE t1 (a VARCHAR(800),KEY(a)) ENGINE=Aria CHARACTER SET ucs2;
+CREATE TABLE t1 (a VARCHAR(1200),KEY(a)) ENGINE=Aria CHARACTER SET ucs2;
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Warning 1071 Specified key was too long; max key length is 2000 bytes
INSERT INTO t1 VALUES (REPEAT('abc ',200));
CHECK TABLE t1;
Table Op Msg_type Msg_text
diff --git a/mysql-test/suite/maria/maria-ucs2.test b/mysql-test/suite/maria/maria-ucs2.test
index e4f8bc8dd27..7dab000a1c9 100644
--- a/mysql-test/suite/maria/maria-ucs2.test
+++ b/mysql-test/suite/maria/maria-ucs2.test
@@ -37,7 +37,7 @@ DROP TABLE t1;
# Issue was too long key
#
-CREATE TABLE t1 (a VARCHAR(800),KEY(a)) ENGINE=Aria CHARACTER SET ucs2;
+CREATE TABLE t1 (a VARCHAR(1200),KEY(a)) ENGINE=Aria CHARACTER SET ucs2;
INSERT INTO t1 VALUES (REPEAT('abc ',200));
CHECK TABLE t1;
DROP TABLE t1;
diff --git a/mysql-test/suite/maria/maria.result b/mysql-test/suite/maria/maria.result
index 7a4283c4cc5..908df15aa0d 100644
--- a/mysql-test/suite/maria/maria.result
+++ b/mysql-test/suite/maria/maria.result
@@ -351,13 +351,13 @@ CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
-CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255), d varchar(255), e varchar(255), KEY t1 (a, b, c, d, e));
-ERROR 42000: Specified key was too long; max key length is 1000 bytes
+CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255), d varchar(255), e varchar(255), f varchar(255), g varchar(255), h varchar(255), i varchar(255), KEY t1 (a, b, c, d, e, f, g, h, i));
+ERROR 42000: Specified key was too long; max key length is 2000 bytes
CREATE TABLE t1 (a varchar(1), b varchar(1), key (a,b,a,b,a,b,a,b,a,b,a,b,a,b,a,b,a,b,a,b,a,b,a,b,a,b,a,b,a,b,a,b,a,b,a,b));
ERROR 42000: Too many key parts specified; max 32 parts allowed
-CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255), d varchar(255), e varchar(255));
-ALTER TABLE t1 ADD INDEX t1 (a, b, c, d, e);
-ERROR 42000: Specified key was too long; max key length is 1000 bytes
+CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255), d varchar(255), e varchar(255), f varchar(255), g varchar(255), h varchar(255), i varchar(255));
+ALTER TABLE t1 ADD INDEX t1 (a, b, c, d, e, f, g, h, i);
+ERROR 42000: Specified key was too long; max key length is 2000 bytes
DROP TABLE t1;
CREATE TABLE t1 (a int not null, b int, c int, key(b), key(c), key(a,b), key(c,a));
INSERT into t1 values (0,null,0), (0,null,1), (0,null,2), (0,null,3), (1,1,4);
@@ -1594,7 +1594,7 @@ a b
drop table t1;
create table t1 (v varchar(65530), key(v));
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Warning 1071 Specified key was too long; max key length is 2000 bytes
drop table if exists t1;
set statement sql_mode = 'NO_ENGINE_SUBSTITUTION' for
create table t1 (v varchar(65536));
@@ -1866,34 +1866,34 @@ t1 CREATE TABLE `t1` (
drop table t1;
create table t1 (a varchar(2048), key `a` (a));
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Warning 1071 Specified key was too long; max key length is 2000 bytes
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(2048) DEFAULT NULL,
- KEY `a` (`a`(1000))
+ KEY `a` (`a`(2000))
) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0
drop table t1;
create table t1 (a varchar(2048), key `a` (a) key_block_size=1024);
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Warning 1071 Specified key was too long; max key length is 2000 bytes
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(2048) DEFAULT NULL,
- KEY `a` (`a`(1000)) KEY_BLOCK_SIZE=8192
+ KEY `a` (`a`(2000)) KEY_BLOCK_SIZE=8192
) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0
drop table t1;
create table t1 (a int not null, b varchar(2048), key (a), key(b)) key_block_size=1024;
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Warning 1071 Specified key was too long; max key length is 2000 bytes
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` varchar(2048) DEFAULT NULL,
KEY `a` (`a`) KEY_BLOCK_SIZE=8192,
- KEY `b` (`b`(1000)) KEY_BLOCK_SIZE=8192
+ KEY `b` (`b`(2000)) KEY_BLOCK_SIZE=8192
) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 KEY_BLOCK_SIZE=1024
alter table t1 key_block_size=2048;
show create table t1;
@@ -1902,7 +1902,7 @@ t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` varchar(2048) DEFAULT NULL,
KEY `a` (`a`) KEY_BLOCK_SIZE=8192,
- KEY `b` (`b`(1000)) KEY_BLOCK_SIZE=8192
+ KEY `b` (`b`(2000)) KEY_BLOCK_SIZE=8192
) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 KEY_BLOCK_SIZE=2048
alter table t1 add c int, add key (c);
show create table t1;
@@ -1912,7 +1912,7 @@ t1 CREATE TABLE `t1` (
`b` varchar(2048) DEFAULT NULL,
`c` int(11) DEFAULT NULL,
KEY `a` (`a`) KEY_BLOCK_SIZE=8192,
- KEY `b` (`b`(1000)) KEY_BLOCK_SIZE=8192,
+ KEY `b` (`b`(2000)) KEY_BLOCK_SIZE=8192,
KEY `c` (`c`) KEY_BLOCK_SIZE=8192
) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 KEY_BLOCK_SIZE=2048
alter table t1 key_block_size=4096;
@@ -1923,7 +1923,7 @@ t1 CREATE TABLE `t1` (
`b` varchar(2048) DEFAULT NULL,
`c` int(11) DEFAULT NULL,
KEY `a` (`a`) KEY_BLOCK_SIZE=8192,
- KEY `b` (`b`(1000)) KEY_BLOCK_SIZE=8192,
+ KEY `b` (`b`(2000)) KEY_BLOCK_SIZE=8192,
KEY `c` (`c`) KEY_BLOCK_SIZE=8192
) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 KEY_BLOCK_SIZE=4096
alter table t1 key_block_size=0;
@@ -1934,7 +1934,7 @@ t1 CREATE TABLE `t1` (
`b` varchar(2048) DEFAULT NULL,
`c` int(11) DEFAULT NULL,
KEY `a` (`a`) KEY_BLOCK_SIZE=8192,
- KEY `b` (`b`(1000)) KEY_BLOCK_SIZE=8192,
+ KEY `b` (`b`(2000)) KEY_BLOCK_SIZE=8192,
KEY `c` (`c`) KEY_BLOCK_SIZE=8192
) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0
alter table t1 add d int, add key (d);
@@ -1946,33 +1946,33 @@ t1 CREATE TABLE `t1` (
`c` int(11) DEFAULT NULL,
`d` int(11) DEFAULT NULL,
KEY `a` (`a`) KEY_BLOCK_SIZE=8192,
- KEY `b` (`b`(1000)) KEY_BLOCK_SIZE=8192,
+ KEY `b` (`b`(2000)) KEY_BLOCK_SIZE=8192,
KEY `c` (`c`) KEY_BLOCK_SIZE=8192,
KEY `d` (`d`)
) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0
drop table t1;
create table t1 (a int not null, b varchar(2048), key (a), key(b)) key_block_size=8192;
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Warning 1071 Specified key was too long; max key length is 2000 bytes
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` varchar(2048) DEFAULT NULL,
KEY `a` (`a`),
- KEY `b` (`b`(1000))
+ KEY `b` (`b`(2000))
) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 KEY_BLOCK_SIZE=8192
drop table t1;
create table t1 (a int not null, b varchar(2048), key (a) key_block_size=1024, key(b)) key_block_size=8192;
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Warning 1071 Specified key was too long; max key length is 2000 bytes
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` varchar(2048) DEFAULT NULL,
KEY `a` (`a`),
- KEY `b` (`b`(1000))
+ KEY `b` (`b`(2000))
) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 KEY_BLOCK_SIZE=8192
drop table t1;
create table t1 (a int not null, b int, key (a) key_block_size=1024, key(b) key_block_size=8192) key_block_size=16384;
@@ -1995,12 +1995,12 @@ t1 CREATE TABLE `t1` (
drop table t1;
create table t1 (a varchar(2048), key `a` (a) key_block_size=1000000000000000000);
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Warning 1071 Specified key was too long; max key length is 2000 bytes
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(2048) DEFAULT NULL,
- KEY `a` (`a`(1000)) KEY_BLOCK_SIZE=8192
+ KEY `a` (`a`(2000)) KEY_BLOCK_SIZE=8192
) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0
drop table t1;
create table t1 (a int not null, key `a` (a) key_block_size=1025);
diff --git a/mysql-test/suite/maria/maria.test b/mysql-test/suite/maria/maria.test
index d5b9d839699..920443d4338 100644
--- a/mysql-test/suite/maria/maria.test
+++ b/mysql-test/suite/maria/maria.test
@@ -373,12 +373,12 @@ drop table t1;
#
--error 1071
-CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255), d varchar(255), e varchar(255), KEY t1 (a, b, c, d, e));
+CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255), d varchar(255), e varchar(255), f varchar(255), g varchar(255), h varchar(255), i varchar(255), KEY t1 (a, b, c, d, e, f, g, h, i));
--error 1070
CREATE TABLE t1 (a varchar(1), b varchar(1), key (a,b,a,b,a,b,a,b,a,b,a,b,a,b,a,b,a,b,a,b,a,b,a,b,a,b,a,b,a,b,a,b,a,b,a,b));
-CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255), d varchar(255), e varchar(255));
+CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255), d varchar(255), e varchar(255), f varchar(255), g varchar(255), h varchar(255), i varchar(255));
--error 1071
-ALTER TABLE t1 ADD INDEX t1 (a, b, c, d, e);
+ALTER TABLE t1 ADD INDEX t1 (a, b, c, d, e, f, g, h, i);
DROP TABLE t1;
#
diff --git a/mysql-test/suite/maria/maria3.result b/mysql-test/suite/maria/maria3.result
index 64ae268997a..3c0b8f28800 100644
--- a/mysql-test/suite/maria/maria3.result
+++ b/mysql-test/suite/maria/maria3.result
@@ -17,12 +17,12 @@ t1 CREATE TABLE `t1` (
drop table t1;
create table t1 (a varchar(2048), key `a` (a) key_block_size=1000000000000000000);
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Warning 1071 Specified key was too long; max key length is 2000 bytes
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(2048) DEFAULT NULL,
- KEY `a` (`a`(1000)) KEY_BLOCK_SIZE=8192
+ KEY `a` (`a`(2000)) KEY_BLOCK_SIZE=8192
) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0
drop table t1;
create table t1 (a int not null, key `a` (a) key_block_size=1025);
diff --git a/mysql-test/suite/maria/max_length.result b/mysql-test/suite/maria/max_length.result
index 93478e033f4..b4ca61392cc 100644
--- a/mysql-test/suite/maria/max_length.result
+++ b/mysql-test/suite/maria/max_length.result
@@ -2,13 +2,30 @@ drop table if exists t1,t2;
Warnings:
Note 1051 Unknown table 'test.t1'
Note 1051 Unknown table 'test.t2'
-create table t1 (id int(10) unsigned not null auto_increment primary key, v varchar(1000), b blob) row_format=page max_rows=2 engine=aria;
-create table t2 (id int(10) unsigned not null auto_increment primary key, v varchar(1000), b blob) row_format=page max_rows=20000000 engine=aria;
+create table t1 (id int(10) unsigned not null auto_increment primary key, v varchar(2000), b blob) row_format=page max_rows=2 engine=aria;
+create table t2 (id int(10) unsigned not null auto_increment primary key, v varchar(2000), b blob, key(v)) row_format=page max_rows=20000000 engine=aria;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `v` varchar(2000) DEFAULT NULL,
+ `b` blob DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 MAX_ROWS=2 PAGE_CHECKSUM=1 ROW_FORMAT=PAGE
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `v` varchar(2000) DEFAULT NULL,
+ `b` blob DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `v` (`v`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 MAX_ROWS=20000000 PAGE_CHECKSUM=1 ROW_FORMAT=PAGE
lock tables t1 write,t2 write;
show table status like "t_";
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 Max_index_length Temporary
t1 Aria 10 Page 0 0 8192 268320768 8192 0 1 # # # latin1_swedish_ci NULL max_rows=2 row_format=PAGE 536862720 N
-t2 Aria 10 Page 0 0 8192 17592186011648 8192 0 1 # # # latin1_swedish_ci NULL max_rows=20000000 row_format=PAGE 536862720 N
+t2 Aria 10 Page 0 0 8192 17592186011648 8192 0 1 # # # latin1_swedish_ci NULL max_rows=20000000 row_format=PAGE 137438945280 N
insert into t1 values(null, repeat("ab",100),repeat("def",1000));
insert into t1 values(null, repeat("de",200),repeat("ghi",2000));
insert into t1 values(null, repeat("fe",300),repeat("ghi",3000));
diff --git a/mysql-test/suite/maria/max_length.test b/mysql-test/suite/maria/max_length.test
index fdfe2aae4ac..4ebe48b4979 100644
--- a/mysql-test/suite/maria/max_length.test
+++ b/mysql-test/suite/maria/max_length.test
@@ -7,8 +7,10 @@
drop table if exists t1,t2;
-create table t1 (id int(10) unsigned not null auto_increment primary key, v varchar(1000), b blob) row_format=page max_rows=2 engine=aria;
-create table t2 (id int(10) unsigned not null auto_increment primary key, v varchar(1000), b blob) row_format=page max_rows=20000000 engine=aria;
+create table t1 (id int(10) unsigned not null auto_increment primary key, v varchar(2000), b blob) row_format=page max_rows=2 engine=aria;
+create table t2 (id int(10) unsigned not null auto_increment primary key, v varchar(2000), b blob, key(v)) row_format=page max_rows=20000000 engine=aria;
+show create table t1;
+show create table t2;
lock tables t1 write,t2 write;
--replace_column 12 # 13 # 14 #
show table status like "t_";
diff --git a/mysql-test/suite/maria/mrr.result b/mysql-test/suite/maria/mrr.result
index 5c709fb34e5..2ebf10cf1af 100644
--- a/mysql-test/suite/maria/mrr.result
+++ b/mysql-test/suite/maria/mrr.result
@@ -392,8 +392,6 @@ col_varchar_1024_latin1_key varchar(1024) DEFAULT NULL,
PRIMARY KEY (pk),
KEY col_varchar_1024_latin1_key (col_varchar_1024_latin1_key)
) ENGINE=Aria;
-Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
INSERT INTO t1 VALUES
(1,'z'), (2,'abcdefjhjkl'), (3,'in'), (4,'abcdefjhjkl'), (6,'abcdefjhjkl'),
(11,'zx'), (12,'abcdefjhjm'), (13,'jn'), (14,'abcdefjhjp'), (16,'abcdefjhjr');
@@ -407,7 +405,7 @@ WHERE
table1.col_varchar_1024_latin1_key = table2.col_varchar_10_latin1 AND table1.pk<>0 ;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE table2 ALL NULL NULL NULL NULL 2 Using where
-1 SIMPLE table1 ref PRIMARY,col_varchar_1024_latin1_key col_varchar_1024_latin1_key 1003 test.table2.col_varchar_10_latin1 2 Using where
+1 SIMPLE table1 ref PRIMARY,col_varchar_1024_latin1_key col_varchar_1024_latin1_key 1027 test.table2.col_varchar_10_latin1 2 Using index condition(BKA); Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
SELECT count(*)
FROM t1 AS table1, t2 AS table2
WHERE
@@ -425,12 +423,12 @@ set join_buffer_size=10240;
CREATE TABLE t1 (
f2 varchar(32) COLLATE latin1_swedish_ci,
f3 int(11),
-f4 varchar(1024) COLLATE utf8_bin,
-f5 varchar(1024) COLLATE latin1_bin,
+f4 varchar(2048) COLLATE utf8_bin,
+f5 varchar(2048) COLLATE latin1_bin,
KEY (f5)
) ENGINE=Aria TRANSACTIONAL=0 ;
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Warning 1071 Specified key was too long; max key length is 2000 bytes
# Fill the table with some data
SELECT alias2.* , alias1.f2
FROM
diff --git a/mysql-test/suite/maria/mrr.test b/mysql-test/suite/maria/mrr.test
index 6c6a8c4e7b6..f3addd6c0f5 100644
--- a/mysql-test/suite/maria/mrr.test
+++ b/mysql-test/suite/maria/mrr.test
@@ -144,8 +144,8 @@ set join_buffer_size=10240;
CREATE TABLE t1 (
f2 varchar(32) COLLATE latin1_swedish_ci,
f3 int(11),
- f4 varchar(1024) COLLATE utf8_bin,
- f5 varchar(1024) COLLATE latin1_bin,
+ f4 varchar(2048) COLLATE utf8_bin,
+ f5 varchar(2048) COLLATE latin1_bin,
KEY (f5)
) ENGINE=Aria TRANSACTIONAL=0 ;
diff --git a/mysql-test/suite/mariabackup/absolute_ibdata_paths.opt b/mysql-test/suite/mariabackup/absolute_ibdata_paths.opt
index 6c6a45cb572..49297a84918 100644
--- a/mysql-test/suite/mariabackup/absolute_ibdata_paths.opt
+++ b/mysql-test/suite/mariabackup/absolute_ibdata_paths.opt
@@ -1,2 +1,3 @@
--innodb --innodb-data-home-dir= --innodb-data-file-path=$MYSQLTEST_VARDIR/tmp/absolute_path_ibdata1:6M;ibdata_second:1M:autoextend
--innodb-undo-tablespaces=2
+--innodb-checksum-algorithm=crc32
diff --git a/mysql-test/suite/perfschema/include/event_aggregate_load.inc b/mysql-test/suite/perfschema/include/event_aggregate_load.inc
index 68dbde276df..6e632b98c62 100644
--- a/mysql-test/suite/perfschema/include/event_aggregate_load.inc
+++ b/mysql-test/suite/perfschema/include/event_aggregate_load.inc
@@ -27,9 +27,6 @@ execute dump_hosts;
# Notes about this test
#
-# Each connect causes 2 wait/synch/mutex/sql/LOCK_connection_count events:
-# - 1 in mysqld.cc, create_new_thread(), for the main thread
-# - 1 in sql_connect.cc, check_user(), for the connected thread
# The main thread does not count for BY_ACCOUNT / BY_HOST.
# The user thread does count for BY_ACCOUNT, BY_HOST
#
diff --git a/mysql-test/suite/perfschema/include/event_aggregate_setup.inc b/mysql-test/suite/perfschema/include/event_aggregate_setup.inc
index f116b09ff04..59431e31682 100644
--- a/mysql-test/suite/perfschema/include/event_aggregate_setup.inc
+++ b/mysql-test/suite/perfschema/include/event_aggregate_setup.inc
@@ -111,8 +111,7 @@ update performance_schema.threads set instrumented='NO';
update performance_schema.setup_instruments set enabled='NO', timed='NO';
update performance_schema.setup_instruments set enabled='YES', timed='YES'
- where name in ('wait/synch/mutex/sql/LOCK_connection_count',
- 'wait/synch/mutex/sql/LOCK_user_locks',
+ where name in ('wait/synch/mutex/sql/LOCK_user_locks',
'wait/synch/rwlock/sql/LOCK_grant',
'wait/io/file/sql/query_log',
'idle');
@@ -181,8 +180,7 @@ begin
if (my_thread_id is not null) then
select username, event_name, count_star
from performance_schema.events_waits_summary_by_thread_by_event_name
- where event_name in ('wait/synch/mutex/sql/LOCK_connection_count',
- 'wait/synch/mutex/sql/LOCK_user_locks',
+ where event_name in ('wait/synch/mutex/sql/LOCK_user_locks',
'wait/synch/rwlock/sql/LOCK_grant',
'wait/io/file/sql/query_log')
and thread_id = my_thread_id
@@ -199,8 +197,7 @@ prepare dump_waits_account from
"select user, host, event_name, count_star
from performance_schema.events_waits_summary_by_account_by_event_name
where user like \'user%\'
- and event_name in ('wait/synch/mutex/sql/LOCK_connection_count',
- 'wait/synch/mutex/sql/LOCK_user_locks',
+ and event_name in ('wait/synch/mutex/sql/LOCK_user_locks',
'wait/synch/rwlock/sql/LOCK_grant',
'wait/io/file/sql/query_log')
order by user, host, event_name;";
@@ -209,8 +206,7 @@ prepare dump_waits_user from
"select user, event_name, count_star
from performance_schema.events_waits_summary_by_user_by_event_name
where user like \'user%\'
- and event_name in ('wait/synch/mutex/sql/LOCK_connection_count',
- 'wait/synch/mutex/sql/LOCK_user_locks',
+ and event_name in ('wait/synch/mutex/sql/LOCK_user_locks',
'wait/synch/rwlock/sql/LOCK_grant',
'wait/io/file/sql/query_log')
order by user, event_name;";
@@ -219,8 +215,7 @@ prepare dump_waits_host from
"select host, event_name, count_star
from performance_schema.events_waits_summary_by_host_by_event_name
where host=\'localhost\'
- and event_name in ('wait/synch/mutex/sql/LOCK_connection_count',
- 'wait/synch/mutex/sql/LOCK_user_locks',
+ and event_name in ('wait/synch/mutex/sql/LOCK_user_locks',
'wait/synch/rwlock/sql/LOCK_grant',
'wait/io/file/sql/query_log')
order by host, event_name;";
@@ -228,8 +223,7 @@ prepare dump_waits_host from
prepare dump_waits_global from
"select event_name, count_star
from performance_schema.events_waits_summary_global_by_event_name
- where event_name in ('wait/synch/mutex/sql/LOCK_connection_count',
- 'wait/synch/mutex/sql/LOCK_user_locks',
+ where event_name in ('wait/synch/mutex/sql/LOCK_user_locks',
'wait/synch/rwlock/sql/LOCK_grant',
'wait/io/file/sql/query_log')
order by event_name;";
@@ -237,8 +231,7 @@ prepare dump_waits_global from
prepare dump_waits_history from
"select event_name, count(event_name)
from performance_schema.events_waits_history_long
- where event_name in ('wait/synch/mutex/sql/LOCK_connection_count',
- 'wait/synch/mutex/sql/LOCK_user_locks',
+ where event_name in ('wait/synch/mutex/sql/LOCK_user_locks',
'wait/synch/rwlock/sql/LOCK_grant',
'wait/io/file/sql/query_log')
group by event_name order by event_name;";
diff --git a/mysql-test/suite/perfschema/r/event_aggregate.result b/mysql-test/suite/perfschema/r/event_aggregate.result
index 7fa08534bb1..23f88479a94 100644
--- a/mysql-test/suite/perfschema/r/event_aggregate.result
+++ b/mysql-test/suite/perfschema/r/event_aggregate.result
@@ -15,13 +15,11 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
@@ -79,7 +77,6 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 1
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
username status
@@ -91,25 +88,21 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 1
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 1
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 1
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 1
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
@@ -195,7 +188,6 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username status
@@ -207,25 +199,21 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 4
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 4
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_history;
@@ -312,12 +300,10 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 1
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
username status
@@ -327,33 +313,27 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 1
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 1
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 5
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 5
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_history;
@@ -467,12 +447,10 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username status
@@ -482,33 +460,27 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 8
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 8
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_history;
@@ -615,17 +587,14 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 1
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
username status
@@ -633,41 +602,33 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 1
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 1
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 9
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 9
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_history;
@@ -801,17 +762,14 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
username status
@@ -819,41 +777,33 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 4
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 12
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 12
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_history;
@@ -980,70 +930,56 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 1
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 4
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 1
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 1
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 13
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 13
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_history;
@@ -1197,70 +1133,56 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 4
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 4
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 16
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 16
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
@@ -1409,71 +1331,57 @@ username status
user1 not found
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 5
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 4
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 4
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
-user1 wait/synch/mutex/sql/LOCK_connection_count 1
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 17
-localhost wait/synch/mutex/sql/LOCK_connection_count 1
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 17
-wait/synch/mutex/sql/LOCK_connection_count 1
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 17
-wait/synch/mutex/sql/LOCK_connection_count 1
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1620,66 +1528,53 @@ username status
user2 not found
username event_name count_star
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 5
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 5
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 4
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 4
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
-user1 wait/synch/mutex/sql/LOCK_connection_count 1
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 5
-user2 wait/synch/mutex/sql/LOCK_connection_count 1
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 18
-localhost wait/synch/mutex/sql/LOCK_connection_count 2
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 18
-wait/synch/mutex/sql/LOCK_connection_count 2
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 18
-wait/synch/mutex/sql/LOCK_connection_count 2
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1828,61 +1723,49 @@ username status
user3 not found
username event_name count_star
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 5
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 5
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 5
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 4
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
-user1 wait/synch/mutex/sql/LOCK_connection_count 1
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 5
-user2 wait/synch/mutex/sql/LOCK_connection_count 1
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 5
-user3 wait/synch/mutex/sql/LOCK_connection_count 1
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 19
-localhost wait/synch/mutex/sql/LOCK_connection_count 3
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 19
-wait/synch/mutex/sql/LOCK_connection_count 3
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 19
-wait/synch/mutex/sql/LOCK_connection_count 3
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2034,55 +1917,44 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 5
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 5
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 5
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 5
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
-user1 wait/synch/mutex/sql/LOCK_connection_count 1
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 5
-user2 wait/synch/mutex/sql/LOCK_connection_count 1
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 5
-user3 wait/synch/mutex/sql/LOCK_connection_count 1
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 5
-user4 wait/synch/mutex/sql/LOCK_connection_count 1
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 20
-localhost wait/synch/mutex/sql/LOCK_connection_count 4
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2235,55 +2107,44 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 5
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 5
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 5
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 5
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
-user1 wait/synch/mutex/sql/LOCK_connection_count 1
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 5
-user2 wait/synch/mutex/sql/LOCK_connection_count 1
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 5
-user3 wait/synch/mutex/sql/LOCK_connection_count 1
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 5
-user4 wait/synch/mutex/sql/LOCK_connection_count 1
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 20
-localhost wait/synch/mutex/sql/LOCK_connection_count 4
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2435,55 +2296,44 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
-user1 wait/synch/mutex/sql/LOCK_connection_count 1
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 5
-user2 wait/synch/mutex/sql/LOCK_connection_count 1
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 5
-user3 wait/synch/mutex/sql/LOCK_connection_count 1
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 5
-user4 wait/synch/mutex/sql/LOCK_connection_count 1
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 20
-localhost wait/synch/mutex/sql/LOCK_connection_count 4
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2635,55 +2485,44 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 20
-localhost wait/synch/mutex/sql/LOCK_connection_count 4
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2835,55 +2674,44 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -3035,55 +2863,44 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -3235,55 +3052,44 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -3435,55 +3241,44 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -3635,55 +3430,44 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -3835,55 +3619,44 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -4035,55 +3808,44 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -4235,55 +3997,44 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -4435,55 +4186,44 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -4635,55 +4375,44 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -4835,55 +4564,44 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -5035,55 +4753,44 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -5237,37 +4944,30 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -5383,19 +5083,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -5471,19 +5168,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
diff --git a/mysql-test/suite/perfschema/r/event_aggregate_no_a.result b/mysql-test/suite/perfschema/r/event_aggregate_no_a.result
index 19dec52aa47..32bf988e63a 100644
--- a/mysql-test/suite/perfschema/r/event_aggregate_no_a.result
+++ b/mysql-test/suite/perfschema/r/event_aggregate_no_a.result
@@ -15,13 +15,11 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
@@ -78,7 +76,6 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 1
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
username status
@@ -92,19 +89,16 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 1
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 1
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 1
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
@@ -179,7 +173,6 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username status
@@ -193,19 +186,16 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 4
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 4
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_history;
@@ -281,12 +271,10 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 1
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
username status
@@ -298,23 +286,19 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 1
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 5
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 5
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_history;
@@ -407,12 +391,10 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username status
@@ -424,23 +406,19 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 8
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 8
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_history;
@@ -526,17 +504,14 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 1
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
username status
@@ -546,27 +521,22 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 1
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 9
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 9
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_history;
@@ -669,17 +639,14 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
username status
@@ -689,27 +656,22 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 12
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 12
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_history;
@@ -805,22 +767,18 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 1
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_account;
@@ -828,31 +786,25 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 1
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 13
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 13
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_history;
@@ -965,22 +917,18 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
@@ -988,31 +936,25 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 16
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 16
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
@@ -1120,17 +1062,14 @@ username status
user1 not found
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
@@ -1138,37 +1077,30 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
-user1 wait/synch/mutex/sql/LOCK_connection_count 1
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 17
-localhost wait/synch/mutex/sql/LOCK_connection_count 1
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 17
-wait/synch/mutex/sql/LOCK_connection_count 1
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 17
-wait/synch/mutex/sql/LOCK_connection_count 1
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1274,12 +1206,10 @@ username status
user2 not found
username event_name count_star
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
@@ -1287,37 +1217,30 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
-user1 wait/synch/mutex/sql/LOCK_connection_count 1
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 5
-user2 wait/synch/mutex/sql/LOCK_connection_count 1
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 18
-localhost wait/synch/mutex/sql/LOCK_connection_count 2
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 18
-wait/synch/mutex/sql/LOCK_connection_count 2
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 18
-wait/synch/mutex/sql/LOCK_connection_count 2
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1425,7 +1348,6 @@ username status
user3 not found
username event_name count_star
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
@@ -1433,37 +1355,30 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
-user1 wait/synch/mutex/sql/LOCK_connection_count 1
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 5
-user2 wait/synch/mutex/sql/LOCK_connection_count 1
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 5
-user3 wait/synch/mutex/sql/LOCK_connection_count 1
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 19
-localhost wait/synch/mutex/sql/LOCK_connection_count 3
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 19
-wait/synch/mutex/sql/LOCK_connection_count 3
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 19
-wait/synch/mutex/sql/LOCK_connection_count 3
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1576,37 +1491,30 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
-user1 wait/synch/mutex/sql/LOCK_connection_count 1
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 5
-user2 wait/synch/mutex/sql/LOCK_connection_count 1
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 5
-user3 wait/synch/mutex/sql/LOCK_connection_count 1
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 5
-user4 wait/synch/mutex/sql/LOCK_connection_count 1
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 20
-localhost wait/synch/mutex/sql/LOCK_connection_count 4
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1720,37 +1628,30 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
-user1 wait/synch/mutex/sql/LOCK_connection_count 1
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 5
-user2 wait/synch/mutex/sql/LOCK_connection_count 1
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 5
-user3 wait/synch/mutex/sql/LOCK_connection_count 1
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 5
-user4 wait/synch/mutex/sql/LOCK_connection_count 1
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 20
-localhost wait/synch/mutex/sql/LOCK_connection_count 4
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1863,37 +1764,30 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
-user1 wait/synch/mutex/sql/LOCK_connection_count 1
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 5
-user2 wait/synch/mutex/sql/LOCK_connection_count 1
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 5
-user3 wait/synch/mutex/sql/LOCK_connection_count 1
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 5
-user4 wait/synch/mutex/sql/LOCK_connection_count 1
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 20
-localhost wait/synch/mutex/sql/LOCK_connection_count 4
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2006,37 +1900,30 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 20
-localhost wait/synch/mutex/sql/LOCK_connection_count 4
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2149,37 +2036,30 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2292,37 +2172,30 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2435,37 +2308,30 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2578,37 +2444,30 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2721,37 +2580,30 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2864,37 +2716,30 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -3007,37 +2852,30 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -3150,37 +2988,30 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -3293,37 +3124,30 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -3436,37 +3260,30 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -3579,37 +3396,30 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -3722,37 +3532,30 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -3865,37 +3668,30 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -4010,19 +3806,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -4097,19 +3890,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
diff --git a/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_h.result b/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_h.result
index 3aa27664cac..b172ab33969 100644
--- a/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_h.result
+++ b/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_h.result
@@ -17,7 +17,6 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
@@ -64,7 +63,6 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 1
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
username status
@@ -78,7 +76,6 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 1
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
@@ -86,7 +83,6 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 1
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
@@ -151,7 +147,6 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username status
@@ -165,7 +160,6 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
@@ -173,7 +167,6 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 4
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_history;
@@ -239,12 +232,10 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 1
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
username status
@@ -256,11 +247,9 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 1
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
@@ -268,7 +257,6 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 5
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_history;
@@ -351,12 +339,10 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username status
@@ -368,11 +354,9 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
@@ -380,7 +364,6 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 8
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_history;
@@ -456,17 +439,14 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 1
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
username status
@@ -476,15 +456,12 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 1
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
@@ -492,7 +469,6 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 9
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_history;
@@ -585,17 +561,14 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
username status
@@ -605,15 +578,12 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
@@ -621,7 +591,6 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 12
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_history;
@@ -707,22 +676,18 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 1
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_account;
@@ -730,19 +695,15 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 1
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
@@ -750,7 +711,6 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 13
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_history;
@@ -853,22 +813,18 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
@@ -876,19 +832,15 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
@@ -896,7 +848,6 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 16
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
@@ -994,17 +945,14 @@ username status
user1 not found
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
@@ -1012,19 +960,15 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
-user1 wait/synch/mutex/sql/LOCK_connection_count 1
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
@@ -1032,13 +976,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 17
-wait/synch/mutex/sql/LOCK_connection_count 1
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 17
-wait/synch/mutex/sql/LOCK_connection_count 1
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1134,12 +1076,10 @@ username status
user2 not found
username event_name count_star
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
@@ -1147,19 +1087,15 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
-user1 wait/synch/mutex/sql/LOCK_connection_count 1
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 5
-user2 wait/synch/mutex/sql/LOCK_connection_count 1
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
@@ -1167,13 +1103,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 18
-wait/synch/mutex/sql/LOCK_connection_count 2
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 18
-wait/synch/mutex/sql/LOCK_connection_count 2
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1271,7 +1205,6 @@ username status
user3 not found
username event_name count_star
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
@@ -1279,19 +1212,15 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
-user1 wait/synch/mutex/sql/LOCK_connection_count 1
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 5
-user2 wait/synch/mutex/sql/LOCK_connection_count 1
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 5
-user3 wait/synch/mutex/sql/LOCK_connection_count 1
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
@@ -1299,13 +1228,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 19
-wait/synch/mutex/sql/LOCK_connection_count 3
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 19
-wait/synch/mutex/sql/LOCK_connection_count 3
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1408,19 +1335,15 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
-user1 wait/synch/mutex/sql/LOCK_connection_count 1
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 5
-user2 wait/synch/mutex/sql/LOCK_connection_count 1
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 5
-user3 wait/synch/mutex/sql/LOCK_connection_count 1
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 5
-user4 wait/synch/mutex/sql/LOCK_connection_count 1
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
@@ -1428,13 +1351,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1538,19 +1459,15 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
-user1 wait/synch/mutex/sql/LOCK_connection_count 1
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 5
-user2 wait/synch/mutex/sql/LOCK_connection_count 1
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 5
-user3 wait/synch/mutex/sql/LOCK_connection_count 1
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 5
-user4 wait/synch/mutex/sql/LOCK_connection_count 1
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
@@ -1558,13 +1475,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1667,19 +1582,15 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
-user1 wait/synch/mutex/sql/LOCK_connection_count 1
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 5
-user2 wait/synch/mutex/sql/LOCK_connection_count 1
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 5
-user3 wait/synch/mutex/sql/LOCK_connection_count 1
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 5
-user4 wait/synch/mutex/sql/LOCK_connection_count 1
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
@@ -1687,13 +1598,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1796,19 +1705,15 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
@@ -1816,13 +1721,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1925,19 +1828,15 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
@@ -1945,13 +1844,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2054,19 +1951,15 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
@@ -2074,13 +1967,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2183,19 +2074,15 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
@@ -2203,13 +2090,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2312,19 +2197,15 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
@@ -2332,13 +2213,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2441,19 +2320,15 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
@@ -2461,13 +2336,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2570,19 +2443,15 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
@@ -2590,13 +2459,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2699,19 +2566,15 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
@@ -2719,13 +2582,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2828,19 +2689,15 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
@@ -2848,13 +2705,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2957,19 +2812,15 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
@@ -2977,13 +2828,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -3086,19 +2935,15 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
@@ -3106,13 +2951,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -3215,19 +3058,15 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
@@ -3235,13 +3074,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -3344,19 +3181,15 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
@@ -3364,13 +3197,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -3473,19 +3304,15 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
@@ -3493,13 +3320,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -3606,13 +3431,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -3679,13 +3502,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
diff --git a/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_u.result b/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_u.result
index 4d4a842948f..1ac9fc38274 100644
--- a/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_u.result
+++ b/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_u.result
@@ -15,13 +15,11 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
@@ -77,7 +75,6 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 1
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
username status
@@ -93,13 +90,11 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 1
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 1
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
@@ -163,7 +158,6 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username status
@@ -179,13 +173,11 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 4
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 4
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_history;
@@ -250,12 +242,10 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 1
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
username status
@@ -269,13 +259,11 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 5
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 5
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_history;
@@ -347,12 +335,10 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username status
@@ -366,13 +352,11 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 8
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 8
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_history;
@@ -437,17 +421,14 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 1
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
username status
@@ -459,13 +440,11 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 9
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 9
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_history;
@@ -537,17 +516,14 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
username status
@@ -559,13 +535,11 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 12
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 12
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_history;
@@ -630,22 +604,18 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 1
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_account;
@@ -655,13 +625,11 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 13
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 13
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_history;
@@ -733,22 +701,18 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
@@ -758,13 +722,11 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 16
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 16
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
@@ -831,17 +793,14 @@ username status
user1 not found
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
@@ -851,19 +810,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 17
-localhost wait/synch/mutex/sql/LOCK_connection_count 1
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 17
-wait/synch/mutex/sql/LOCK_connection_count 1
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 17
-wait/synch/mutex/sql/LOCK_connection_count 1
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -928,12 +884,10 @@ username status
user2 not found
username event_name count_star
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
@@ -943,19 +897,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 18
-localhost wait/synch/mutex/sql/LOCK_connection_count 2
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 18
-wait/synch/mutex/sql/LOCK_connection_count 2
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 18
-wait/synch/mutex/sql/LOCK_connection_count 2
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1022,7 +973,6 @@ username status
user3 not found
username event_name count_star
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
@@ -1032,19 +982,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 19
-localhost wait/synch/mutex/sql/LOCK_connection_count 3
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 19
-wait/synch/mutex/sql/LOCK_connection_count 3
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 19
-wait/synch/mutex/sql/LOCK_connection_count 3
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1118,19 +1065,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 20
-localhost wait/synch/mutex/sql/LOCK_connection_count 4
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1205,19 +1149,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 20
-localhost wait/synch/mutex/sql/LOCK_connection_count 4
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1291,19 +1232,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 20
-localhost wait/synch/mutex/sql/LOCK_connection_count 4
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1377,19 +1315,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 20
-localhost wait/synch/mutex/sql/LOCK_connection_count 4
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1463,19 +1398,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1549,19 +1481,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1635,19 +1564,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1721,19 +1647,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1807,19 +1730,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1893,19 +1813,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1979,19 +1896,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2065,19 +1979,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2151,19 +2062,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2237,19 +2145,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2323,19 +2228,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2409,19 +2311,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2495,19 +2394,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2581,19 +2477,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2667,19 +2560,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
diff --git a/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_u_no_h.result b/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_u_no_h.result
index db281652c0c..4b522c1a5dd 100644
--- a/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_u_no_h.result
+++ b/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_u_no_h.result
@@ -17,7 +17,6 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
@@ -63,7 +62,6 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 1
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
username status
@@ -81,7 +79,6 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 1
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
@@ -135,7 +132,6 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username status
@@ -153,7 +149,6 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 4
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_history;
@@ -208,12 +203,10 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 1
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
username status
@@ -229,7 +222,6 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 5
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_history;
@@ -291,12 +283,10 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username status
@@ -312,7 +302,6 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 8
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_history;
@@ -367,17 +356,14 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 1
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
username status
@@ -391,7 +377,6 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 9
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_history;
@@ -453,17 +438,14 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
username status
@@ -477,7 +459,6 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 12
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_history;
@@ -532,22 +513,18 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 1
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_account;
@@ -559,7 +536,6 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 13
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_history;
@@ -621,22 +597,18 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
@@ -648,7 +620,6 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 16
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
@@ -705,17 +676,14 @@ username status
user1 not found
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
@@ -727,13 +695,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 17
-wait/synch/mutex/sql/LOCK_connection_count 1
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 17
-wait/synch/mutex/sql/LOCK_connection_count 1
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -788,12 +754,10 @@ username status
user2 not found
username event_name count_star
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
@@ -805,13 +769,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 18
-wait/synch/mutex/sql/LOCK_connection_count 2
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 18
-wait/synch/mutex/sql/LOCK_connection_count 2
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -868,7 +830,6 @@ username status
user3 not found
username event_name count_star
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
@@ -880,13 +841,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 19
-wait/synch/mutex/sql/LOCK_connection_count 3
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 19
-wait/synch/mutex/sql/LOCK_connection_count 3
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -952,13 +911,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1025,13 +982,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1097,13 +1052,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1169,13 +1122,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1241,13 +1192,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1313,13 +1262,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1385,13 +1332,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1457,13 +1402,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1529,13 +1472,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1601,13 +1542,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1673,13 +1612,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1745,13 +1682,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1817,13 +1752,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1889,13 +1822,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1961,13 +1892,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2033,13 +1962,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2105,13 +2032,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2177,13 +2102,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2249,13 +2172,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
diff --git a/mysql-test/suite/perfschema/r/event_aggregate_no_h.result b/mysql-test/suite/perfschema/r/event_aggregate_no_h.result
index c8996fa2846..3ca29d4d235 100644
--- a/mysql-test/suite/perfschema/r/event_aggregate_no_h.result
+++ b/mysql-test/suite/perfschema/r/event_aggregate_no_h.result
@@ -17,7 +17,6 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
@@ -65,7 +64,6 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 1
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
username status
@@ -77,13 +75,11 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 1
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 1
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
@@ -91,7 +87,6 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 1
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
@@ -167,7 +162,6 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username status
@@ -179,13 +173,11 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
@@ -193,7 +185,6 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 4
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_history;
@@ -270,12 +261,10 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 1
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
username status
@@ -285,21 +274,17 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 1
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 1
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
@@ -307,7 +292,6 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 5
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_history;
@@ -411,12 +395,10 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username status
@@ -426,21 +408,17 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
@@ -448,7 +426,6 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 8
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_history;
@@ -545,17 +522,14 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 1
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
username status
@@ -563,29 +537,23 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 1
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 1
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
@@ -593,7 +561,6 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 9
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_history;
@@ -717,17 +684,14 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
username status
@@ -735,29 +699,23 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 4
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
@@ -765,7 +723,6 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 12
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_history;
@@ -882,58 +839,46 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 1
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 4
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 1
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 1
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
@@ -941,7 +886,6 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 13
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_history;
@@ -1085,58 +1029,46 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 4
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 4
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
@@ -1144,7 +1076,6 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 16
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
@@ -1283,53 +1214,42 @@ username status
user1 not found
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 5
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 4
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 4
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
-user1 wait/synch/mutex/sql/LOCK_connection_count 1
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
@@ -1337,13 +1257,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 17
-wait/synch/mutex/sql/LOCK_connection_count 1
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 17
-wait/synch/mutex/sql/LOCK_connection_count 1
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1480,48 +1398,38 @@ username status
user2 not found
username event_name count_star
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 5
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 5
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 4
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 4
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
-user1 wait/synch/mutex/sql/LOCK_connection_count 1
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 5
-user2 wait/synch/mutex/sql/LOCK_connection_count 1
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
@@ -1529,13 +1437,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 18
-wait/synch/mutex/sql/LOCK_connection_count 2
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 18
-wait/synch/mutex/sql/LOCK_connection_count 2
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1674,43 +1580,34 @@ username status
user3 not found
username event_name count_star
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 5
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 5
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 5
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 4
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
-user1 wait/synch/mutex/sql/LOCK_connection_count 1
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 5
-user2 wait/synch/mutex/sql/LOCK_connection_count 1
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 5
-user3 wait/synch/mutex/sql/LOCK_connection_count 1
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
@@ -1718,13 +1615,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 19
-wait/synch/mutex/sql/LOCK_connection_count 3
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 19
-wait/synch/mutex/sql/LOCK_connection_count 3
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1866,37 +1761,29 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 5
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 5
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 5
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 5
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
-user1 wait/synch/mutex/sql/LOCK_connection_count 1
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 5
-user2 wait/synch/mutex/sql/LOCK_connection_count 1
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 5
-user3 wait/synch/mutex/sql/LOCK_connection_count 1
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 5
-user4 wait/synch/mutex/sql/LOCK_connection_count 1
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
@@ -1904,13 +1791,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2053,37 +1938,29 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 5
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 5
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 5
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 5
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
-user1 wait/synch/mutex/sql/LOCK_connection_count 1
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 5
-user2 wait/synch/mutex/sql/LOCK_connection_count 1
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 5
-user3 wait/synch/mutex/sql/LOCK_connection_count 1
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 5
-user4 wait/synch/mutex/sql/LOCK_connection_count 1
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
@@ -2091,13 +1968,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2239,37 +2114,29 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
-user1 wait/synch/mutex/sql/LOCK_connection_count 1
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 5
-user2 wait/synch/mutex/sql/LOCK_connection_count 1
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 5
-user3 wait/synch/mutex/sql/LOCK_connection_count 1
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 5
-user4 wait/synch/mutex/sql/LOCK_connection_count 1
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
@@ -2277,13 +2144,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2425,37 +2290,29 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
@@ -2463,13 +2320,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2611,37 +2466,29 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
@@ -2649,13 +2496,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2797,37 +2642,29 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
@@ -2835,13 +2672,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2983,37 +2818,29 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
@@ -3021,13 +2848,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -3169,37 +2994,29 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
@@ -3207,13 +3024,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -3355,37 +3170,29 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
@@ -3393,13 +3200,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -3541,37 +3346,29 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
@@ -3579,13 +3376,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -3727,37 +3522,29 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
@@ -3765,13 +3552,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -3913,37 +3698,29 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
@@ -3951,13 +3728,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -4099,37 +3874,29 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
@@ -4137,13 +3904,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -4285,37 +4050,29 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
@@ -4323,13 +4080,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -4471,37 +4226,29 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
@@ -4509,13 +4256,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -4657,37 +4402,29 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
@@ -4695,13 +4432,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -4845,19 +4580,15 @@ user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 0
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
user2 wait/io/file/sql/query_log 0
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
user3 wait/io/file/sql/query_log 0
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
user4 wait/io/file/sql/query_log 0
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_host;
@@ -4865,13 +4596,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -4979,13 +4708,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -5053,13 +4780,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
diff --git a/mysql-test/suite/perfschema/r/event_aggregate_no_u.result b/mysql-test/suite/perfschema/r/event_aggregate_no_u.result
index 508a65d9ba0..be6f3e272d9 100644
--- a/mysql-test/suite/perfschema/r/event_aggregate_no_u.result
+++ b/mysql-test/suite/perfschema/r/event_aggregate_no_u.result
@@ -15,13 +15,11 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
@@ -78,7 +76,6 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 1
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
username status
@@ -90,7 +87,6 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 1
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
@@ -98,13 +94,11 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 1
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 1
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
@@ -179,7 +173,6 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username status
@@ -191,7 +184,6 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
@@ -199,13 +191,11 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 4
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 4
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_history;
@@ -281,12 +271,10 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 1
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
username status
@@ -296,11 +284,9 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 1
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
@@ -308,13 +294,11 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 5
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 5
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_history;
@@ -407,12 +391,10 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username status
@@ -422,11 +404,9 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
@@ -434,13 +414,11 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 8
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 8
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_history;
@@ -526,17 +504,14 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 1
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
username status
@@ -544,15 +519,12 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 1
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
@@ -560,13 +532,11 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 9
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 9
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_history;
@@ -669,17 +639,14 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
username status
@@ -687,15 +654,12 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 4
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
@@ -703,13 +667,11 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 12
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 12
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_history;
@@ -805,40 +767,32 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 1
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 4
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 1
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
@@ -846,13 +800,11 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 13
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 13
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_history;
@@ -965,40 +917,32 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 4
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 4
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
@@ -1006,13 +950,11 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 16
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 16
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
@@ -1120,35 +1062,28 @@ username status
user1 not found
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 5
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 4
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 4
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
@@ -1156,19 +1091,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 17
-localhost wait/synch/mutex/sql/LOCK_connection_count 1
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 17
-wait/synch/mutex/sql/LOCK_connection_count 1
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 17
-wait/synch/mutex/sql/LOCK_connection_count 1
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1274,30 +1206,24 @@ username status
user2 not found
username event_name count_star
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 5
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 5
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 4
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 4
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
@@ -1305,19 +1231,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 18
-localhost wait/synch/mutex/sql/LOCK_connection_count 2
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 18
-wait/synch/mutex/sql/LOCK_connection_count 2
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 18
-wait/synch/mutex/sql/LOCK_connection_count 2
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1425,25 +1348,20 @@ username status
user3 not found
username event_name count_star
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 5
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 5
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 5
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 4
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
@@ -1451,19 +1369,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 19
-localhost wait/synch/mutex/sql/LOCK_connection_count 3
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 19
-wait/synch/mutex/sql/LOCK_connection_count 3
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 19
-wait/synch/mutex/sql/LOCK_connection_count 3
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1574,19 +1489,15 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 5
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 5
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 5
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 5
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
@@ -1594,19 +1505,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 20
-localhost wait/synch/mutex/sql/LOCK_connection_count 4
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1718,19 +1626,15 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 5
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 5
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 5
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 5
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
@@ -1738,19 +1642,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 20
-localhost wait/synch/mutex/sql/LOCK_connection_count 4
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1861,19 +1762,15 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
@@ -1881,19 +1778,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 20
-localhost wait/synch/mutex/sql/LOCK_connection_count 4
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2004,19 +1898,15 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
@@ -2024,19 +1914,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 20
-localhost wait/synch/mutex/sql/LOCK_connection_count 4
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2147,19 +2034,15 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
@@ -2167,19 +2050,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2290,19 +2170,15 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
@@ -2310,19 +2186,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2433,19 +2306,15 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
@@ -2453,19 +2322,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2576,19 +2442,15 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
@@ -2596,19 +2458,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2719,19 +2578,15 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
@@ -2739,19 +2594,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2862,19 +2714,15 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
@@ -2882,19 +2730,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -3005,19 +2850,15 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
@@ -3025,19 +2866,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -3148,19 +2986,15 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
@@ -3168,19 +3002,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -3291,19 +3122,15 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
@@ -3311,19 +3138,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -3434,19 +3258,15 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
@@ -3454,19 +3274,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -3577,19 +3394,15 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
@@ -3597,19 +3410,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -3720,19 +3530,15 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
@@ -3740,19 +3546,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -3867,19 +3670,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -3954,19 +3754,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -4041,19 +3838,16 @@ user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 0
-localhost wait/synch/mutex/sql/LOCK_connection_count 0
localhost wait/synch/mutex/sql/LOCK_user_locks 0
localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
diff --git a/mysql-test/suite/perfschema/r/event_aggregate_no_u_no_h.result b/mysql-test/suite/perfschema/r/event_aggregate_no_u_no_h.result
index 579fadc51c0..6ca450ab864 100644
--- a/mysql-test/suite/perfschema/r/event_aggregate_no_u_no_h.result
+++ b/mysql-test/suite/perfschema/r/event_aggregate_no_u_no_h.result
@@ -17,7 +17,6 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
@@ -64,7 +63,6 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 1
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 0
username status
@@ -76,7 +74,6 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 1
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
@@ -86,7 +83,6 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 1
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
@@ -151,7 +147,6 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username status
@@ -163,7 +158,6 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
@@ -173,7 +167,6 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 4
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_history;
@@ -239,12 +232,10 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 1
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 0
username status
@@ -254,11 +245,9 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 1
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
@@ -268,7 +257,6 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 5
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_history;
@@ -351,12 +339,10 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username status
@@ -366,11 +352,9 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
@@ -380,7 +364,6 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 8
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_history;
@@ -456,17 +439,14 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 1
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 0
username status
@@ -474,15 +454,12 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 1
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
@@ -492,7 +469,6 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 9
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_history;
@@ -585,17 +561,14 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
username status
@@ -603,15 +576,12 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 4
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
@@ -621,7 +591,6 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 12
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_history;
@@ -707,40 +676,32 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 1
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 4
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 1
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
@@ -750,7 +711,6 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 13
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_history;
@@ -853,40 +813,32 @@ connection default;
call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
-user1 wait/synch/mutex/sql/LOCK_connection_count 0
user1 wait/synch/mutex/sql/LOCK_user_locks 0
user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 4
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 4
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
@@ -896,7 +848,6 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 16
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
@@ -994,35 +945,28 @@ username status
user1 not found
username event_name count_star
user2 wait/io/file/sql/query_log 4
-user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 5
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 4
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 4
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
@@ -1032,13 +976,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 17
-wait/synch/mutex/sql/LOCK_connection_count 1
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 17
-wait/synch/mutex/sql/LOCK_connection_count 1
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1134,30 +1076,24 @@ username status
user2 not found
username event_name count_star
user3 wait/io/file/sql/query_log 4
-user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 5
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 5
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 4
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 4
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
@@ -1167,13 +1103,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 18
-wait/synch/mutex/sql/LOCK_connection_count 2
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 18
-wait/synch/mutex/sql/LOCK_connection_count 2
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1271,25 +1205,20 @@ username status
user3 not found
username event_name count_star
user4 wait/io/file/sql/query_log 4
-user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 5
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 5
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 5
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 4
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
@@ -1299,13 +1228,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 19
-wait/synch/mutex/sql/LOCK_connection_count 3
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 19
-wait/synch/mutex/sql/LOCK_connection_count 3
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1406,19 +1333,15 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 5
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 5
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 5
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 5
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
@@ -1428,13 +1351,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1536,19 +1457,15 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 5
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 5
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 5
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 5
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 1
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
@@ -1558,13 +1475,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1665,19 +1580,15 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
@@ -1687,13 +1598,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1794,19 +1703,15 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
@@ -1816,13 +1721,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -1923,19 +1826,15 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
@@ -1945,13 +1844,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2052,19 +1949,15 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
@@ -2074,13 +1967,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2181,19 +2072,15 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
@@ -2203,13 +2090,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2310,19 +2195,15 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
@@ -2332,13 +2213,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2439,19 +2318,15 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
@@ -2461,13 +2336,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2568,19 +2441,15 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
@@ -2590,13 +2459,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2697,19 +2564,15 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
@@ -2719,13 +2582,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2826,19 +2687,15 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
@@ -2848,13 +2705,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -2955,19 +2810,15 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
@@ -2977,13 +2828,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -3084,19 +2933,15 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
@@ -3106,13 +2951,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -3213,19 +3056,15 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
@@ -3235,13 +3074,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -3342,19 +3179,15 @@ user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 0
-user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user1 localhost wait/synch/rwlock/sql/LOCK_grant 0
user2 localhost wait/io/file/sql/query_log 0
-user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user2 localhost wait/synch/rwlock/sql/LOCK_grant 0
user3 localhost wait/io/file/sql/query_log 0
-user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user3 localhost wait/synch/rwlock/sql/LOCK_grant 0
user4 localhost wait/io/file/sql/query_log 0
-user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
user4 localhost wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_user;
@@ -3364,13 +3197,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -3477,13 +3308,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -3550,13 +3379,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
@@ -3623,13 +3450,11 @@ host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 0
-wait/synch/mutex/sql/LOCK_connection_count 0
wait/synch/mutex/sql/LOCK_user_locks 0
wait/synch/rwlock/sql/LOCK_grant 0
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
-wait/synch/mutex/sql/LOCK_connection_count 4
wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
diff --git a/mysql-test/suite/perfschema/r/server_init.result b/mysql-test/suite/perfschema/r/server_init.result
index 25f3f180735..d2f370cf00a 100644
--- a/mysql-test/suite/perfschema/r/server_init.result
+++ b/mysql-test/suite/perfschema/r/server_init.result
@@ -88,10 +88,6 @@ where name like "wait/synch/mutex/sql/LOCK_prepared_stmt_count";
count(name)
1
select count(name) from mutex_instances
-where name like "wait/synch/mutex/sql/LOCK_connection_count";
-count(name)
-1
-select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_server_started";
count(name)
1
diff --git a/mysql-test/suite/perfschema/t/server_init.test b/mysql-test/suite/perfschema/t/server_init.test
index 36e09adea78..19ed7ba97c7 100644
--- a/mysql-test/suite/perfschema/t/server_init.test
+++ b/mysql-test/suite/perfschema/t/server_init.test
@@ -86,9 +86,6 @@ select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_prepared_stmt_count";
select count(name) from mutex_instances
- where name like "wait/synch/mutex/sql/LOCK_connection_count";
-
-select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_server_started";
# LOG_INFO object are created on demand, and are not global.
diff --git a/mysql-test/suite/rpl/r/rpl_row_big_table_id,32bit.rdiff b/mysql-test/suite/rpl/r/rpl_row_big_table_id,32bit.rdiff
index 2ff34004702..3815ec9375d 100644
--- a/mysql-test/suite/rpl/r/rpl_row_big_table_id,32bit.rdiff
+++ b/mysql-test/suite/rpl/r/rpl_row_big_table_id,32bit.rdiff
@@ -1,31 +1,31 @@
---- r/rpl_row_big_table_id.result 2019-01-23 19:58:07.204914873 +0200
-+++ r/rpl_row_big_table_id_32bit.result 2019-01-23 19:43:54.590640934 +0200
-@@ -22,22 +22,22 @@
- master-bin.000002 # Query 1 # use `test`; ALTER TABLE t comment ''
- master-bin.000002 # Gtid 1 # BEGIN GTID #-#-#
- master-bin.000002 # Annotate_rows 1 # INSERT INTO t SET a= 1
--master-bin.000002 # Table_map 1 # table_id: 4294967298 (test.t)
--master-bin.000002 # Write_rows_v1 1 # table_id: 4294967298 flags: STMT_END_F
-+master-bin.000002 # Table_map 1 # table_id: 4294967294 (test.t)
-+master-bin.000002 # Write_rows_v1 1 # table_id: 4294967294 flags: STMT_END_F
- master-bin.000002 # Query 1 # COMMIT
- master-bin.000002 # Gtid 1 # GTID #-#-#
- master-bin.000002 # Query 1 # use `test`; ALTER TABLE t comment ''
- master-bin.000002 # Gtid 1 # BEGIN GTID #-#-#
- master-bin.000002 # Annotate_rows 1 # INSERT INTO t SET a= 2
--master-bin.000002 # Table_map 1 # table_id: 4294967299 (test.t)
--master-bin.000002 # Write_rows_v1 1 # table_id: 4294967299 flags: STMT_END_F
-+master-bin.000002 # Table_map 1 # table_id: 1 (test.t)
-+master-bin.000002 # Write_rows_v1 1 # table_id: 1 flags: STMT_END_F
- master-bin.000002 # Query 1 # COMMIT
- master-bin.000002 # Gtid 1 # GTID #-#-#
- master-bin.000002 # Query 1 # use `test`; ALTER TABLE t comment ''
- master-bin.000002 # Gtid 1 # BEGIN GTID #-#-#
- master-bin.000002 # Annotate_rows 1 # INSERT INTO t SET a= 3
--master-bin.000002 # Table_map 1 # table_id: 4294967300 (test.t)
--master-bin.000002 # Write_rows_v1 1 # table_id: 4294967300 flags: STMT_END_F
-+master-bin.000002 # Table_map 1 # table_id: 4294967294 (test.t)
-+master-bin.000002 # Write_rows_v1 1 # table_id: 4294967294 flags: STMT_END_F
- master-bin.000002 # Query 1 # COMMIT
+--- /home/my/maria-test/mysql-test/suite/rpl/r/rpl_row_big_table_id.result 2019-08-18 15:19:56.829962449 +0300
++++ /home/my/maria-test/mysql-test/suite/rpl/r/rpl_row_big_table_id,32bit.reject 2019-08-18 15:20:19.253763968 +0300
+@@ -20,22 +20,22 @@
+ master-bin.000001 # Query 1 # use `test`; ALTER TABLE t comment ''
+ master-bin.000001 # Gtid 1 # BEGIN GTID #-#-#
+ master-bin.000001 # Annotate_rows 1 # INSERT INTO t SET a= 1
+-master-bin.000001 # Table_map 1 # table_id: 4294967295 (test.t)
+-master-bin.000001 # Write_rows_v1 1 # table_id: 4294967295 flags: STMT_END_F
++master-bin.000001 # Table_map 1 # table_id: 1 (test.t)
++master-bin.000001 # Write_rows_v1 1 # table_id: 1 flags: STMT_END_F
+ master-bin.000001 # Query 1 # COMMIT
+ master-bin.000001 # Gtid 1 # GTID #-#-#
+ master-bin.000001 # Query 1 # use `test`; ALTER TABLE t comment ''
+ master-bin.000001 # Gtid 1 # BEGIN GTID #-#-#
+ master-bin.000001 # Annotate_rows 1 # INSERT INTO t SET a= 2
+-master-bin.000001 # Table_map 1 # table_id: 4294967296 (test.t)
+-master-bin.000001 # Write_rows_v1 1 # table_id: 4294967296 flags: STMT_END_F
++master-bin.000001 # Table_map 1 # table_id: 4294967294 (test.t)
++master-bin.000001 # Write_rows_v1 1 # table_id: 4294967294 flags: STMT_END_F
+ master-bin.000001 # Query 1 # COMMIT
+ master-bin.000001 # Gtid 1 # GTID #-#-#
+ master-bin.000001 # Query 1 # use `test`; ALTER TABLE t comment ''
+ master-bin.000001 # Gtid 1 # BEGIN GTID #-#-#
+ master-bin.000001 # Annotate_rows 1 # INSERT INTO t SET a= 3
+-master-bin.000001 # Table_map 1 # table_id: 4294967297 (test.t)
+-master-bin.000001 # Write_rows_v1 1 # table_id: 4294967297 flags: STMT_END_F
++master-bin.000001 # Table_map 1 # table_id: 1 (test.t)
++master-bin.000001 # Write_rows_v1 1 # table_id: 1 flags: STMT_END_F
+ master-bin.000001 # Query 1 # COMMIT
connection slave;
connection master;
diff --git a/mysql-test/suite/rpl/r/rpl_row_big_table_id.result b/mysql-test/suite/rpl/r/rpl_row_big_table_id.result
index 7a0a964dc5e..694a6132244 100644
--- a/mysql-test/suite/rpl/r/rpl_row_big_table_id.result
+++ b/mysql-test/suite/rpl/r/rpl_row_big_table_id.result
@@ -1,8 +1,7 @@
include/master-slave.inc
[connection master]
-connection master;
-include/rpl_restart_server.inc [server_number=1]
-SET @@debug_dbug="d,simulate_big_table_id";
+SET @old_debug_dbug= @@debug_dbug;
+SET @@debug_dbug="+d,simulate_big_table_id";
CREATE TABLE t (a int);
INSERT INTO t SET a= 0;
ALTER TABLE t comment '';
@@ -13,34 +12,35 @@ ALTER TABLE t comment '';
INSERT INTO t SET a= 3;
show binlog events in <file> from <pos>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000002 # Gtid 1 # BEGIN GTID #-#-#
-master-bin.000002 # Annotate_rows 1 # INSERT INTO t SET a= 0
-master-bin.000002 # Table_map 1 # table_id: 4294967294 (test.t)
-master-bin.000002 # Write_rows_v1 1 # table_id: 4294967294 flags: STMT_END_F
-master-bin.000002 # Query 1 # COMMIT
-master-bin.000002 # Gtid 1 # GTID #-#-#
-master-bin.000002 # Query 1 # use `test`; ALTER TABLE t comment ''
-master-bin.000002 # Gtid 1 # BEGIN GTID #-#-#
-master-bin.000002 # Annotate_rows 1 # INSERT INTO t SET a= 1
-master-bin.000002 # Table_map 1 # table_id: 4294967298 (test.t)
-master-bin.000002 # Write_rows_v1 1 # table_id: 4294967298 flags: STMT_END_F
-master-bin.000002 # Query 1 # COMMIT
-master-bin.000002 # Gtid 1 # GTID #-#-#
-master-bin.000002 # Query 1 # use `test`; ALTER TABLE t comment ''
-master-bin.000002 # Gtid 1 # BEGIN GTID #-#-#
-master-bin.000002 # Annotate_rows 1 # INSERT INTO t SET a= 2
-master-bin.000002 # Table_map 1 # table_id: 4294967299 (test.t)
-master-bin.000002 # Write_rows_v1 1 # table_id: 4294967299 flags: STMT_END_F
-master-bin.000002 # Query 1 # COMMIT
-master-bin.000002 # Gtid 1 # GTID #-#-#
-master-bin.000002 # Query 1 # use `test`; ALTER TABLE t comment ''
-master-bin.000002 # Gtid 1 # BEGIN GTID #-#-#
-master-bin.000002 # Annotate_rows 1 # INSERT INTO t SET a= 3
-master-bin.000002 # Table_map 1 # table_id: 4294967300 (test.t)
-master-bin.000002 # Write_rows_v1 1 # table_id: 4294967300 flags: STMT_END_F
-master-bin.000002 # Query 1 # COMMIT
+master-bin.000001 # Gtid 1 # BEGIN GTID #-#-#
+master-bin.000001 # Annotate_rows 1 # INSERT INTO t SET a= 0
+master-bin.000001 # Table_map 1 # table_id: 4294967294 (test.t)
+master-bin.000001 # Write_rows_v1 1 # table_id: 4294967294 flags: STMT_END_F
+master-bin.000001 # Query 1 # COMMIT
+master-bin.000001 # Gtid 1 # GTID #-#-#
+master-bin.000001 # Query 1 # use `test`; ALTER TABLE t comment ''
+master-bin.000001 # Gtid 1 # BEGIN GTID #-#-#
+master-bin.000001 # Annotate_rows 1 # INSERT INTO t SET a= 1
+master-bin.000001 # Table_map 1 # table_id: 4294967295 (test.t)
+master-bin.000001 # Write_rows_v1 1 # table_id: 4294967295 flags: STMT_END_F
+master-bin.000001 # Query 1 # COMMIT
+master-bin.000001 # Gtid 1 # GTID #-#-#
+master-bin.000001 # Query 1 # use `test`; ALTER TABLE t comment ''
+master-bin.000001 # Gtid 1 # BEGIN GTID #-#-#
+master-bin.000001 # Annotate_rows 1 # INSERT INTO t SET a= 2
+master-bin.000001 # Table_map 1 # table_id: 4294967296 (test.t)
+master-bin.000001 # Write_rows_v1 1 # table_id: 4294967296 flags: STMT_END_F
+master-bin.000001 # Query 1 # COMMIT
+master-bin.000001 # Gtid 1 # GTID #-#-#
+master-bin.000001 # Query 1 # use `test`; ALTER TABLE t comment ''
+master-bin.000001 # Gtid 1 # BEGIN GTID #-#-#
+master-bin.000001 # Annotate_rows 1 # INSERT INTO t SET a= 3
+master-bin.000001 # Table_map 1 # table_id: 4294967297 (test.t)
+master-bin.000001 # Write_rows_v1 1 # table_id: 4294967297 flags: STMT_END_F
+master-bin.000001 # Query 1 # COMMIT
connection slave;
connection master;
+SET debug_dbug=@old_debug_dbug;
DROP TABLE t;
connection slave;
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_show_slave_hosts.result b/mysql-test/suite/rpl/r/rpl_show_slave_hosts.result
index bd605c6e0fb..79803cca0d0 100644
--- a/mysql-test/suite/rpl/r/rpl_show_slave_hosts.result
+++ b/mysql-test/suite/rpl/r/rpl_show_slave_hosts.result
@@ -10,11 +10,11 @@ connection master;
SHOW SLAVE HOSTS;
Server_id Host Port Master_id
3 slave2 SLAVE_PORT 1
-2 SLAVE_PORT 1
+2 localhost SLAVE_PORT 1
connection slave2;
include/stop_slave_io.inc
connection master;
SHOW SLAVE HOSTS;
Server_id Host Port Master_id
-2 SLAVE_PORT 1
+2 localhost SLAVE_PORT 1
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_row_big_table_id.opt b/mysql-test/suite/rpl/t/rpl_row_big_table_id.opt
new file mode 100644
index 00000000000..7c3d2411b28
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_big_table_id.opt
@@ -0,0 +1 @@
+--verbose=1
diff --git a/mysql-test/suite/rpl/t/rpl_row_big_table_id.test b/mysql-test/suite/rpl/t/rpl_row_big_table_id.test
index 0c6f9d5e862..4bfdceef297 100644
--- a/mysql-test/suite/rpl/t/rpl_row_big_table_id.test
+++ b/mysql-test/suite/rpl/t/rpl_row_big_table_id.test
@@ -4,6 +4,8 @@
# MDEV-17803 Row-based event is not applied when
# table map id is greater 32 bit int
#
+# This test is depending on that the server was restarted before test was run
+#
# Verify row-based events applying when table map id value is about and greater
# than 1 << 32.
##################################################################
@@ -12,12 +14,8 @@
--source include/have_binlog_format_row.inc
--source include/master-slave.inc
---connection master
-# To reset last table id
---let $rpl_server_number= 1
---source include/rpl_restart_server.inc
-
-SET @@debug_dbug="d,simulate_big_table_id";
+SET @old_debug_dbug= @@debug_dbug;
+SET @@debug_dbug="+d,simulate_big_table_id";
CREATE TABLE t (a int);
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
@@ -50,6 +48,8 @@ if (`SELECT sum(a) != 6 FROM t`)
# Cleanup
--connection master
+SET debug_dbug=@old_debug_dbug;
+
DROP TABLE t;
--sync_slave_with_master
diff --git a/mysql-test/suite/s3/alter.result b/mysql-test/suite/s3/alter.result
new file mode 100644
index 00000000000..0764d661468
--- /dev/null
+++ b/mysql-test/suite/s3/alter.result
@@ -0,0 +1,122 @@
+drop table if exists t1,t2,t3;
+#
+# Test ALTER TABLE to and from s3
+#
+create table t1 (a int, b int) engine=aria;
+insert into t1 select seq,seq+10 from seq_1_to_1000;
+alter table t1 engine=s3;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=S3 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+alter table t1 comment="hello";
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=S3 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='hello'
+alter table t1 engine=aria;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='hello'
+select count(*), sum(a), sum(b) from t1;
+count(*) sum(a) sum(b)
+1000 500500 510500
+drop table t1;
+#
+# Test ALTER TABLE to and from s3 with rename
+#
+create table t1 (a int, b int) engine=aria select seq as a,seq+10 as b from seq_1_to_10;
+alter table t1 rename to t2, engine=s3;
+select count(*), sum(a), sum(b) from t2;
+count(*) sum(a) sum(b)
+10 55 155
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=S3 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+alter table t2 rename to t3, engine=aria;
+show create table t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+select count(*), sum(a), sum(b) from t3;
+count(*) sum(a) sum(b)
+10 55 155
+drop table t3;
+#
+# Test changing options for a s3 table
+#
+create table t1 (a int, b int) engine=aria select seq as a,seq+10 as b from seq_1_to_1000;
+alter table t1 engine=s3;
+alter table t1 engine=s3, compression_algorithm="zlib";
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=S3 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 `compression_algorithm`='zlib'
+select count(*), sum(a), sum(b) from t1;
+count(*) sum(a) sum(b)
+1000 500500 510500
+drop table t1;
+#
+# Test ALTER TABLE for S3
+#
+create table t1 (a int, b int) engine=aria select seq as a,seq+10 as b from seq_1_to_10;
+alter table t1 add column c int, engine=s3;
+alter table t1 add column d int;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ `d` int(11) DEFAULT NULL
+) ENGINE=S3 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+select count(*), sum(a), sum(b), sum(c), sum(d) from t1;
+count(*) sum(a) sum(b) sum(c) sum(d)
+10 55 155 NULL NULL
+drop table t1;
+#
+# Test ALTER TABLE with locked table for S3
+#
+create table t1 (a int, b int) engine=aria select seq as a,seq+10 as b from seq_1_to_10;
+lock table t1 write;
+alter table t1 add column c int, engine=s3;
+ERROR HY000: Table 't1' is read only
+unlock tables;
+select count(*), sum(a), sum(b), sum(c) from t1;
+count(*) sum(a) sum(b) sum(c)
+10 55 155 NULL
+lock table t1 write;
+ERROR HY000: Table 't1' is read only
+lock table t1 read;
+select count(*), sum(a), sum(b), sum(c) from t1;
+count(*) sum(a) sum(b) sum(c)
+10 55 155 NULL
+unlock tables;
+drop table t1;
+#
+# Test RENAME TABLE
+#
+create table t1 (a int, b int) engine=aria select seq as a, seq+10 as b from seq_1_to_10;
+alter table t1 engine=s3;
+rename table t1 to t3;
+alter table t3 rename t2;
+select count(*), sum(a), sum(b) from t2;
+count(*) sum(a) sum(b)
+10 55 155
+select count(*), sum(a), sum(b) from t1;
+ERROR 42S02: Table 'database.t1' doesn't exist
+drop table t2;
diff --git a/mysql-test/suite/s3/alter.test b/mysql-test/suite/s3/alter.test
new file mode 100644
index 00000000000..791d7750cb1
--- /dev/null
+++ b/mysql-test/suite/s3/alter.test
@@ -0,0 +1,96 @@
+--source include/have_s3.inc
+--source include/have_sequence.inc
+
+#
+# Create unique database for running the tests
+#
+--source create_database.inc
+--disable_warnings
+drop table if exists t1,t2,t3;
+--enable_warnings
+
+--echo #
+--echo # Test ALTER TABLE to and from s3
+--echo #
+
+create table t1 (a int, b int) engine=aria;
+insert into t1 select seq,seq+10 from seq_1_to_1000;
+alter table t1 engine=s3;
+show create table t1;
+alter table t1 comment="hello";
+show create table t1;
+alter table t1 engine=aria;
+show create table t1;
+select count(*), sum(a), sum(b) from t1;
+drop table t1;
+
+--echo #
+--echo # Test ALTER TABLE to and from s3 with rename
+--echo #
+
+create table t1 (a int, b int) engine=aria select seq as a,seq+10 as b from seq_1_to_10;
+alter table t1 rename to t2, engine=s3;
+select count(*), sum(a), sum(b) from t2;
+show create table t2;
+alter table t2 rename to t3, engine=aria;
+show create table t3;
+select count(*), sum(a), sum(b) from t3;
+drop table t3;
+
+--echo #
+--echo # Test changing options for a s3 table
+--echo #
+
+create table t1 (a int, b int) engine=aria select seq as a,seq+10 as b from seq_1_to_1000;
+alter table t1 engine=s3;
+alter table t1 engine=s3, compression_algorithm="zlib";
+show create table t1;
+select count(*), sum(a), sum(b) from t1;
+drop table t1;
+
+--echo #
+--echo # Test ALTER TABLE for S3
+--echo #
+
+create table t1 (a int, b int) engine=aria select seq as a,seq+10 as b from seq_1_to_10;
+alter table t1 add column c int, engine=s3;
+alter table t1 add column d int;
+show create table t1;
+select count(*), sum(a), sum(b), sum(c), sum(d) from t1;
+drop table t1;
+
+--echo #
+--echo # Test ALTER TABLE with locked table for S3
+--echo #
+
+create table t1 (a int, b int) engine=aria select seq as a,seq+10 as b from seq_1_to_10;
+lock table t1 write;
+--error ER_OPEN_AS_READONLY
+alter table t1 add column c int, engine=s3;
+unlock tables;
+select count(*), sum(a), sum(b), sum(c) from t1;
+--error ER_OPEN_AS_READONLY
+lock table t1 write;
+lock table t1 read;
+select count(*), sum(a), sum(b), sum(c) from t1;
+unlock tables;
+drop table t1;
+
+--echo #
+--echo # Test RENAME TABLE
+--echo #
+
+create table t1 (a int, b int) engine=aria select seq as a, seq+10 as b from seq_1_to_10;
+alter table t1 engine=s3;
+rename table t1 to t3;
+alter table t3 rename t2;
+select count(*), sum(a), sum(b) from t2;
+--replace_result $database database
+--error ER_NO_SUCH_TABLE
+select count(*), sum(a), sum(b) from t1;
+drop table t2;
+
+#
+# clean up
+#
+--source drop_database.inc
diff --git a/mysql-test/suite/s3/alter2.result b/mysql-test/suite/s3/alter2.result
new file mode 100644
index 00000000000..d2849905c67
--- /dev/null
+++ b/mysql-test/suite/s3/alter2.result
@@ -0,0 +1,22 @@
+#
+# MDEV-19575 Assertion `page_st == 1' failed upon SELECT from S3
+# table which is being converted into Aria
+#
+CREATE TABLE t1 (f INT);
+insert into t1 values (1),(2);
+ALTER TABLE t1 ENGINE=S3;
+select * from t1;
+f
+1
+2
+connect con1,localhost,root,,$database;
+ALTER TABLE t1 ENGINE=Aria;
+connection default;
+SELECT * FROM t1;
+f
+1
+2
+connection con1;
+disconnect con1;
+connection default;
+DROP TABLE t1;
diff --git a/mysql-test/suite/s3/alter2.test b/mysql-test/suite/s3/alter2.test
new file mode 100644
index 00000000000..de2bc001298
--- /dev/null
+++ b/mysql-test/suite/s3/alter2.test
@@ -0,0 +1,32 @@
+--source include/have_s3.inc
+--source create_database.inc
+
+--echo #
+--echo # MDEV-19575 Assertion `page_st == 1' failed upon SELECT from S3
+--echo # table which is being converted into Aria
+--echo #
+
+CREATE TABLE t1 (f INT);
+insert into t1 values (1),(2);
+
+ALTER TABLE t1 ENGINE=S3;
+select * from t1;
+--connect (con1,localhost,root,,$database)
+--send
+ ALTER TABLE t1 ENGINE=Aria;
+
+--connection default
+SELECT * FROM t1;
+
+# Cleanup
+
+--connection con1
+--reap
+--disconnect con1
+--connection default
+DROP TABLE t1;
+
+#
+# clean up
+#
+--source drop_database.inc
diff --git a/mysql-test/suite/s3/amazon.result b/mysql-test/suite/s3/amazon.result
new file mode 100644
index 00000000000..29075118a63
--- /dev/null
+++ b/mysql-test/suite/s3/amazon.result
@@ -0,0 +1,7 @@
+set @save_s3_protocol_version=@@global.s3_protocol_version;
+set @@global.s3_protocol_version="Original";
+create table t1 (pk int primary key, a int);
+insert into t1 values (1,1),(2,2),(3,3),(4,4);
+alter table t1 engine=S3;
+drop table t1;
+set @@global.s3_protocol_version=@save_s3_protocol_version;
diff --git a/mysql-test/suite/s3/amazon.test b/mysql-test/suite/s3/amazon.test
new file mode 100644
index 00000000000..3c64cc2841b
--- /dev/null
+++ b/mysql-test/suite/s3/amazon.test
@@ -0,0 +1,27 @@
+--source include/have_s3.inc
+
+if (`SELECT @@s3_host_name <> "s3.amazonaws.com"`)
+{
+ skip Not connected to AWS;
+}
+
+--source create_database.inc
+
+#
+# Check options against amazon
+#
+
+set @save_s3_protocol_version=@@global.s3_protocol_version;
+set @@global.s3_protocol_version="Original";
+
+create table t1 (pk int primary key, a int);
+insert into t1 values (1,1),(2,2),(3,3),(4,4);
+--replace_result $database database
+alter table t1 engine=S3;
+drop table t1;
+
+#
+# clean up
+#
+set @@global.s3_protocol_version=@save_s3_protocol_version;
+--source drop_database.inc
diff --git a/mysql-test/suite/s3/arguments.result b/mysql-test/suite/s3/arguments.result
new file mode 100644
index 00000000000..4a371aabc9b
--- /dev/null
+++ b/mysql-test/suite/s3/arguments.result
@@ -0,0 +1,58 @@
+drop table if exists t1;
+#
+# Test options
+#
+create or replace table t1 (a int, b int, key(a)) engine=aria;
+insert into t1 select seq,seq+10 from seq_1_to_10;
+alter table t1 engine=s3, s3_block_size=819200, compression_algorithm="zlib";
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=S3 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 `s3_block_size`=819200 `compression_algorithm`='zlib'
+alter table t1 engine=s3, s3_block_size=8192;
+ERROR HY000: Incorrect value '8192' for option 's3_block_size'
+alter table t1 engine=s3, s3_block_size=65536;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=S3 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 `compression_algorithm`='zlib' `s3_block_size`=65536
+alter table t1 engine=s3, s3_block_size=100000;
+ERROR HY000: Incorrect value '100000' for option 's3_block_size'
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=S3 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 `compression_algorithm`='zlib' `s3_block_size`=65536
+alter table t1 engine=s3, compression_algorithm="wss";
+ERROR HY000: Incorrect value 'wss' for option 'compression_algorithm'
+drop table t1;
+# Check that key variables are not shown to the end user
+show variables like "s3%key";
+Variable_name Value
+s3_access_key *****
+s3_secret_key *****
+# Show some "static" s3 variables
+set @tmp= @@global.s3_block_size;
+show variables like "s3_block_size";
+Variable_name Value
+s3_block_size 4194304
+set @@global.s3_block_size=65536;
+show variables like "s3_block_size";
+Variable_name Value
+s3_block_size 65536
+set @@global.s3_block_size= @tmp;
+set @@s3_block_size=65536;
+ERROR HY000: Variable 's3_block_size' is a GLOBAL variable and should be set with SET GLOBAL
+# Check s3 variables that can't be changed by end user
+set @@s3_access_key="abc";
+ERROR HY000: Variable 's3_access_key' is a read only variable
+set @@s3_secret_key="abc";
+ERROR HY000: Variable 's3_secret_key' is a read only variable
diff --git a/mysql-test/suite/s3/arguments.test b/mysql-test/suite/s3/arguments.test
new file mode 100644
index 00000000000..76ef4c960dd
--- /dev/null
+++ b/mysql-test/suite/s3/arguments.test
@@ -0,0 +1,54 @@
+--source include/have_s3.inc
+--source include/have_sequence.inc
+
+#
+# Create unique database for running the tests
+#
+--source create_database.inc
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+--echo #
+--echo # Test options
+--echo #
+
+create or replace table t1 (a int, b int, key(a)) engine=aria;
+insert into t1 select seq,seq+10 from seq_1_to_10;
+alter table t1 engine=s3, s3_block_size=819200, compression_algorithm="zlib";
+show create table t1;
+--error ER_BAD_OPTION_VALUE
+alter table t1 engine=s3, s3_block_size=8192;
+alter table t1 engine=s3, s3_block_size=65536;
+show create table t1;
+--error ER_BAD_OPTION_VALUE
+alter table t1 engine=s3, s3_block_size=100000;
+show create table t1;
+--error ER_BAD_OPTION_VALUE
+alter table t1 engine=s3, compression_algorithm="wss";
+drop table t1;
+
+--echo # Check that key variables are not shown to the end user
+
+show variables like "s3%key";
+
+--echo # Show some "static" s3 variables
+set @tmp= @@global.s3_block_size;
+show variables like "s3_block_size";
+set @@global.s3_block_size=65536;
+show variables like "s3_block_size";
+set @@global.s3_block_size= @tmp;
+--error ER_GLOBAL_VARIABLE
+set @@s3_block_size=65536;
+
+--echo # Check s3 variables that can't be changed by end user
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set @@s3_access_key="abc";
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set @@s3_secret_key="abc";
+
+#
+# clean up
+#
+--source drop_database.inc
diff --git a/mysql-test/suite/s3/backup.result b/mysql-test/suite/s3/backup.result
new file mode 100644
index 00000000000..55065d7baa8
--- /dev/null
+++ b/mysql-test/suite/s3/backup.result
@@ -0,0 +1,18 @@
+#
+# MDEV-19585 Assertion `!is_set() || (m_status == DA_OK_BULK &&
+# is_bulk_op())' failed upon SELECT from S3 table with concurrent
+# BACKUP stage
+#
+CREATE TABLE t1 (a INT);
+ALTER TABLE t1 ENGINE=S3;
+connect con1,localhost,root,,test;
+BACKUP STAGE START;
+connection default;
+SELECT * FROM t1;
+connection con1;
+BACKUP STAGE BLOCK_COMMIT;
+BACKUP STAGE END;
+disconnect con1;
+connection default;
+a
+DROP TABLE t1;
diff --git a/mysql-test/suite/s3/backup.test b/mysql-test/suite/s3/backup.test
new file mode 100644
index 00000000000..06f61429707
--- /dev/null
+++ b/mysql-test/suite/s3/backup.test
@@ -0,0 +1,33 @@
+--source include/have_s3.inc
+--source create_database.inc
+
+--echo #
+--echo # MDEV-19585 Assertion `!is_set() || (m_status == DA_OK_BULK &&
+--echo # is_bulk_op())' failed upon SELECT from S3 table with concurrent
+--echo # BACKUP stage
+--echo #
+
+CREATE TABLE t1 (a INT);
+ALTER TABLE t1 ENGINE=S3;
+
+--connect (con1,localhost,root,,test)
+BACKUP STAGE START;
+
+--connection default
+--send
+SELECT * FROM t1;
+
+--connection con1
+BACKUP STAGE BLOCK_COMMIT;
+
+# Cleanup
+BACKUP STAGE END;
+--disconnect con1
+--connection default
+--reap
+DROP TABLE t1;
+
+#
+# clean up
+#
+--source drop_database.inc
diff --git a/mysql-test/suite/s3/basic.result b/mysql-test/suite/s3/basic.result
new file mode 100644
index 00000000000..94fe14ab989
--- /dev/null
+++ b/mysql-test/suite/s3/basic.result
@@ -0,0 +1,106 @@
+drop table if exists t1;
+#
+# Test simple create of s3 table
+#
+create or replace table t1 (a int, b int, key (a)) engine=aria;
+insert into t1 select seq,seq+10 from seq_1_to_10000;
+alter table t1 engine=s3;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=S3 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+select * from information_schema.tables where table_schema="database" and table_name="t1";;
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT MAX_INDEX_LENGTH TEMPORARY
+def # t1 BASE TABLE S3 10 Page 10000 33 335872 # 122880 0 NULL # # # latin1_swedish_ci NULL page_checksum=1 9007199254732800 #
+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 Max_index_length Temporary
+t1 S3 10 Page 10000 33 335872 # 122880 0 NULL # # # latin1_swedish_ci NULL page_checksum=1 # N
+select * from t1 limit 10;
+a b
+1 11
+2 12
+3 13
+4 14
+5 15
+6 16
+7 17
+8 18
+9 19
+10 20
+select count(*) from t1;
+count(*)
+10000
+select * from t1 where a between 10 and 20;
+a b
+10 20
+11 21
+12 22
+13 23
+14 24
+15 25
+16 26
+17 27
+18 28
+19 29
+20 30
+explain select * from t1 where a between 10 and 20;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL # Using index condition
+insert into t1 values (1,1);
+ERROR HY000: Table 't1' is read only
+update t1 set b=100 where a=1;
+ERROR HY000: Table 't1' is read only
+delete from t1 where a>10;
+ERROR HY000: Table 't1' is read only
+alter table t1 engine=aria;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+select * from t1 limit 10;
+a b
+1 11
+2 12
+3 13
+4 14
+5 15
+6 16
+7 17
+8 18
+9 19
+10 20
+select count(*) from t1;
+count(*)
+10000
+delete from t1 where a=1;
+drop table t1;
+#
+# status
+#
+show variables like "s3%";
+Variable_name Value
+s3_access_key X
+s3_block_size X
+s3_bucket X
+s3_debug X
+s3_host_name X
+s3_pagecache_age_threshold X
+s3_pagecache_buffer_size X
+s3_pagecache_division_limit X
+s3_pagecache_file_hash_size X
+s3_protocol_version X
+s3_region X
+s3_secret_key X
+show status like "s3%";
+Variable_name Value
+S3_pagecache_blocks_not_flushed X
+S3_pagecache_blocks_unused X
+S3_pagecache_blocks_used X
+S3_pagecache_read_requests X
+S3_pagecache_reads X
diff --git a/mysql-test/suite/s3/basic.test b/mysql-test/suite/s3/basic.test
new file mode 100644
index 00000000000..f3f53a55a1c
--- /dev/null
+++ b/mysql-test/suite/s3/basic.test
@@ -0,0 +1,55 @@
+--source include/have_s3.inc
+--source include/have_sequence.inc
+
+#
+# Create unique database for running the tests
+#
+--source create_database.inc
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+--echo #
+--echo # Test simple create of s3 table
+--echo #
+
+create or replace table t1 (a int, b int, key (a)) engine=aria;
+insert into t1 select seq,seq+10 from seq_1_to_10000;
+alter table t1 engine=s3;
+show create table t1;
+
+--replace_column 2 # 11 # 15 # 16 # 17 # 23 #
+--replace_result $database database
+--eval select * from information_schema.tables where table_schema="$database" and table_name="t1";
+--replace_column 8 # 12 # 13 # 14 # 19 #
+show table status like "t1";
+select * from t1 limit 10;
+select count(*) from t1;
+select * from t1 where a between 10 and 20;
+--replace_column 9 #
+explain select * from t1 where a between 10 and 20;
+--error ER_OPEN_AS_READONLY
+insert into t1 values (1,1);
+--error ER_OPEN_AS_READONLY
+update t1 set b=100 where a=1;
+--error ER_OPEN_AS_READONLY
+delete from t1 where a>10;
+alter table t1 engine=aria;
+show create table t1;
+select * from t1 limit 10;
+select count(*) from t1;
+delete from t1 where a=1;
+drop table t1;
+
+--echo #
+--echo # status
+--echo #
+
+--replace_column 2 X
+show variables like "s3%";
+--replace_column 2 X
+show status like "s3%";
+#
+# clean up
+#
+--source drop_database.inc
diff --git a/mysql-test/suite/s3/create_database.inc b/mysql-test/suite/s3/create_database.inc
new file mode 100644
index 00000000000..880cdd3a8d5
--- /dev/null
+++ b/mysql-test/suite/s3/create_database.inc
@@ -0,0 +1,10 @@
+#
+# Create unique database to not conflict with concurrently running tests as
+# the s3 database is shared
+#
+
+let $database=`select concat("s3_test_",replace(uuid(),"-",""))`;
+--disable_query_log
+--eval create database $database;
+--eval use $database;
+--enable_query_log
diff --git a/mysql-test/suite/s3/discovery.result b/mysql-test/suite/s3/discovery.result
new file mode 100644
index 00000000000..abc97867e89
--- /dev/null
+++ b/mysql-test/suite/s3/discovery.result
@@ -0,0 +1,57 @@
+drop table if exists t1,t2;
+#
+# Test discovery of s3
+#
+create table t1 (a int, b int) engine=aria select seq as a, seq+10 as b from seq_1_to_10;
+alter table t1 engine=s3;
+#
+# Check discovery by select
+#
+flush tables;
+select * from t1 limit 1;
+a b
+1 11
+#
+# Check if changes to .frm is copied to S3
+#
+alter table t1 change column b c int not null;
+flush tables;
+select * from t1 limit 1;
+a c
+1 11
+#
+# Check if SHOW TABLES finds the S3 tables
+#
+create table t2 (a int, b int) engine=aria select seq as a, seq+10 as b from seq_1_to_10;
+alter table t2 engine=s3;
+flush tables;
+SHOW TABLES;
+Tables_in_database
+t1
+t2
+drop table t2;
+#
+# Check if DROP TABLE works with discovery
+#
+select count(*) from t1;
+count(*)
+10
+flush tables;
+drop table t1;
+select count(*), sum(a) from t1;
+ERROR 42S02: Table 'database.t1' doesn't exist
+#
+# Check if S3 detects that the .frm is too old
+#
+create table t1 (a int, b int) engine=aria select seq as a, seq+10 as b from seq_1_to_10;
+alter table t1 engine=s3;
+alter table t1 add column c int, engine=s3;
+flush tables;
+select * from t1 limit 1;
+a b c
+1 11 NULL
+flush tables;
+select * from t1 limit 1;
+a b c
+1 11 NULL
+drop table t1;
diff --git a/mysql-test/suite/s3/discovery.test b/mysql-test/suite/s3/discovery.test
new file mode 100644
index 00000000000..b85776acac5
--- /dev/null
+++ b/mysql-test/suite/s3/discovery.test
@@ -0,0 +1,84 @@
+--source include/have_s3.inc
+--source include/have_sequence.inc
+
+#
+# Create unique database for running the tests
+#
+--source create_database.inc
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
+
+let $datadir=`select @@datadir`;
+
+--echo #
+--echo # Test discovery of s3
+--echo #
+
+create table t1 (a int, b int) engine=aria select seq as a, seq+10 as b from seq_1_to_10;
+alter table t1 engine=s3;
+
+--echo #
+--echo # Check discovery by select
+--echo #
+
+--remove_file $datadir/$database/t1.frm
+flush tables;
+select * from t1 limit 1;
+
+--echo #
+--echo # Check if changes to .frm is copied to S3
+--echo #
+
+alter table t1 change column b c int not null;
+flush tables;
+--remove_file $datadir/$database/t1.frm
+select * from t1 limit 1;
+
+--echo #
+--echo # Check if SHOW TABLES finds the S3 tables
+--echo #
+
+create table t2 (a int, b int) engine=aria select seq as a, seq+10 as b from seq_1_to_10;
+alter table t2 engine=s3;
+
+flush tables;
+--remove_file $datadir/$database/t1.frm
+--replace_result $database database
+SHOW TABLES;
+drop table t2;
+
+--echo #
+--echo # Check if DROP TABLE works with discovery
+--echo #
+
+select count(*) from t1;
+flush tables;
+--remove_file $datadir/$database/t1.frm
+drop table t1;
+--replace_result $database database
+--error ER_NO_SUCH_TABLE
+select count(*), sum(a) from t1;
+
+--echo #
+--echo # Check if S3 detects that the .frm is too old
+--echo #
+
+create table t1 (a int, b int) engine=aria select seq as a, seq+10 as b from seq_1_to_10;
+alter table t1 engine=s3;
+--copy_file $datadir/$database/t1.frm $datadir/$database/t1.frm-old
+alter table t1 add column c int, engine=s3;
+flush tables;
+--remove_file $datadir/$database/t1.frm
+--copy_file $datadir/$database/t1.frm-old $datadir/$database/t1.frm
+--remove_file $datadir/$database/t1.frm-old
+select * from t1 limit 1;
+flush tables;
+--remove_file $datadir/$database/t1.frm
+select * from t1 limit 1;
+drop table t1;
+
+#
+# clean up
+#
+--source drop_database.inc
diff --git a/mysql-test/suite/s3/drop_database.inc b/mysql-test/suite/s3/drop_database.inc
new file mode 100644
index 00000000000..a5425f4ed47
--- /dev/null
+++ b/mysql-test/suite/s3/drop_database.inc
@@ -0,0 +1,9 @@
+
+#
+# Drop database created by the s3 tests
+#
+
+--disable_query_log
+use test;
+--eval drop database $database;
+--enable_query_log
diff --git a/mysql-test/suite/s3/encryption.opt b/mysql-test/suite/s3/encryption.opt
new file mode 100644
index 00000000000..8f13b08c5c4
--- /dev/null
+++ b/mysql-test/suite/s3/encryption.opt
@@ -0,0 +1,4 @@
+--plugin-load-add=$FILE_KEY_MANAGEMENT_SO
+--aria-encrypt-tables=1
+--loose-file-key-management
+--loose-file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys.txt
diff --git a/mysql-test/suite/s3/encryption.result b/mysql-test/suite/s3/encryption.result
new file mode 100644
index 00000000000..c60490d342a
--- /dev/null
+++ b/mysql-test/suite/s3/encryption.result
@@ -0,0 +1,23 @@
+#
+# MDEV-20306
+# Assertion `!(end_of_data > info->scan.dir_end)' failed in
+# _ma_scan_block_record upon converting table from S3 to Aria
+# with encryption enabled
+#
+drop table if exists t1;
+CREATE TABLE t1 (a INT) ENGINE=Aria;
+INSERT INTO t1 VALUES (1);
+ALTER TABLE t1 ENGINE=S3;
+select * from t1;
+a
+1
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=S3 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+ALTER TABLE t1 ENGINE=Aria;
+select * from t1;
+a
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/s3/encryption.test b/mysql-test/suite/s3/encryption.test
new file mode 100644
index 00000000000..82434627309
--- /dev/null
+++ b/mysql-test/suite/s3/encryption.test
@@ -0,0 +1,36 @@
+--source include/have_s3.inc
+
+if (`SELECT COUNT(*)=0 FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME = 'file_key_management' AND PLUGIN_STATUS='ACTIVE'`)
+{
+ --skip Test requires file_key_management plugin
+}
+
+#
+# Create unique database for running the tests
+#
+--source create_database.inc
+
+--echo #
+--echo # MDEV-20306
+--echo # Assertion `!(end_of_data > info->scan.dir_end)' failed in
+--echo # _ma_scan_block_record upon converting table from S3 to Aria
+--echo # with encryption enabled
+--echo #
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+CREATE TABLE t1 (a INT) ENGINE=Aria;
+INSERT INTO t1 VALUES (1);
+ALTER TABLE t1 ENGINE=S3;
+select * from t1;
+show create table t1;
+ALTER TABLE t1 ENGINE=Aria;
+select * from t1;
+DROP TABLE t1;
+
+#
+# clean up
+#
+--source drop_database.inc
diff --git a/mysql-test/suite/s3/innodb.result b/mysql-test/suite/s3/innodb.result
new file mode 100644
index 00000000000..eaa9cf93c86
--- /dev/null
+++ b/mysql-test/suite/s3/innodb.result
@@ -0,0 +1,31 @@
+drop table if exists t1,t2,t3;
+#
+# Test ALTER TABLE to and from s3
+#
+create table t1 (a int, b int) engine=innodb;
+insert into t1 select seq,seq+10 from seq_1_to_1000;
+alter table t1 engine=s3;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=S3 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+alter table t1 comment="hello";
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=S3 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='hello'
+alter table t1 engine=innodb;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='hello'
+select count(*), sum(a), sum(b) from t1;
+count(*) sum(a) sum(b)
+1000 500500 510500
+drop table t1;
diff --git a/mysql-test/suite/s3/innodb.test b/mysql-test/suite/s3/innodb.test
new file mode 100644
index 00000000000..e2687064bdb
--- /dev/null
+++ b/mysql-test/suite/s3/innodb.test
@@ -0,0 +1,35 @@
+--source include/have_s3.inc
+--source include/have_sequence.inc
+--source include/have_innodb.inc
+
+#
+# Testing converting InnoDB tables to S3
+#
+
+#
+# Create unique database for running the tests
+#
+--source create_database.inc
+--disable_warnings
+drop table if exists t1,t2,t3;
+--enable_warnings
+
+--echo #
+--echo # Test ALTER TABLE to and from s3
+--echo #
+
+create table t1 (a int, b int) engine=innodb;
+insert into t1 select seq,seq+10 from seq_1_to_1000;
+alter table t1 engine=s3;
+show create table t1;
+alter table t1 comment="hello";
+show create table t1;
+alter table t1 engine=innodb;
+show create table t1;
+select count(*), sum(a), sum(b) from t1;
+drop table t1;
+
+#
+# clean up
+#
+--source drop_database.inc
diff --git a/mysql-test/suite/s3/my.cnf b/mysql-test/suite/s3/my.cnf
new file mode 100644
index 00000000000..1958a04343f
--- /dev/null
+++ b/mysql-test/suite/s3/my.cnf
@@ -0,0 +1,11 @@
+!include include/default_mysqld.cnf
+!include include/default_client.cnf
+
+[mysqld.1]
+s3=ON
+#s3-host-name=s3.amazonaws.com
+#s3-protocol-version=Amazon
+#s3-bucket=MariaDB
+#s3-access-key=...
+#s3-secret-key=...
+#s3-region=eu-north-1
diff --git a/mysql-test/suite/s3/mysqldump.result b/mysql-test/suite/s3/mysqldump.result
new file mode 100644
index 00000000000..995cbf5bc63
--- /dev/null
+++ b/mysql-test/suite/s3/mysqldump.result
@@ -0,0 +1,60 @@
+create table t1 (pk int primary key, a int);
+insert into t1 values (1,1),(2,2),(3,3),(4,4);
+alter table t1 engine=S3;
+#####
+# mysqldump with --copy-s3-tables=0 (by default)
+###
+#####
+# mysqldump with --copy-s3-tables=0 (by default) XML
+###
+<?xml version="1.0"?>
+<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<database name="database">
+</database>
+</mysqldump>
+#####
+# mysqldump with --copy-s3-tables=1
+###
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `t1` (
+ `pk` int(11) NOT NULL,
+ `a` int(11) DEFAULT NULL,
+ PRIMARY KEY (`pk`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+INSERT INTO `t1` VALUES (1,1),(2,2),(3,3),(4,4);
+ATER TABLE `t1` ENGINE=S3;
+#####
+# mysqldump with --copy-s3-tables=1 XML
+###
+<?xml version="1.0"?>
+<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<database name="database">
+ <table_structure name="t1">
+ <field Field="pk" Type="int(11)" Null="NO" Key="PRI" Extra="" Comment="" />
+ <field Field="a" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" />
+ <key Table="t1" Non_unique="0" Key_name="PRIMARY" Seq_in_index="1" Column_name="pk" Collation="A" Cardinality="4" Null="" Index_type="BTREE" Comment="" Index_comment="" />
+ <options Name="t1" Engine="Aria" Version="10" Row_format="Page" Rows="4" Avg_row_length="4096" Data_length="16384" Max_data_length="17592186011648" Index_length="16384" Data_free="0" Create_time="--TIME--" Collation="latin1_swedish_ci" Create_options="" Comment="" Max_index_length="9007199254732800" Temporary="N" />
+ </table_structure>
+ <table_data name="t1">
+ <row>
+ <field name="pk">1</field>
+ <field name="a">1</field>
+ </row>
+ <row>
+ <field name="pk">2</field>
+ <field name="a">2</field>
+ </row>
+ <row>
+ <field name="pk">3</field>
+ <field name="a">3</field>
+ </row>
+ <row>
+ <field name="pk">4</field>
+ <field name="a">4</field>
+ </row>
+ </table_data>
+</database>
+</mysqldump>
+drop table t1;
diff --git a/mysql-test/suite/s3/mysqldump.test b/mysql-test/suite/s3/mysqldump.test
new file mode 100644
index 00000000000..83d2310d636
--- /dev/null
+++ b/mysql-test/suite/s3/mysqldump.test
@@ -0,0 +1,33 @@
+--source include/have_s3.inc
+--source create_database.inc
+
+create table t1 (pk int primary key, a int);
+insert into t1 values (1,1),(2,2),(3,3),(4,4);
+alter table t1 engine=S3;
+
+--echo #####
+--echo # mysqldump with --copy-s3-tables=0 (by default)
+--echo ###
+--exec $MYSQL_DUMP --compact $database
+--echo #####
+--echo # mysqldump with --copy-s3-tables=0 (by default) XML
+--echo ###
+--replace_regex /[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}(.[0-9]{2})*/--TIME--/
+--replace_result $database database
+--exec $MYSQL_DUMP --compact -X $database
+--echo #####
+--echo # mysqldump with --copy-s3-tables=1
+--echo ###
+--exec $MYSQL_DUMP --compact --copy-s3-tables=1 $database
+--echo #####
+--echo # mysqldump with --copy-s3-tables=1 XML
+--echo ###
+--replace_regex /[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}(.[0-9]{2})*/--TIME--/
+--replace_result $database database
+--exec $MYSQL_DUMP --compact --copy-s3-tables=1 -X $database
+
+drop table t1;
+#
+# clean up
+#
+--source drop_database.inc
diff --git a/mysql-test/suite/s3/no_s3-master.opt b/mysql-test/suite/s3/no_s3-master.opt
new file mode 100644
index 00000000000..ad13d335ae9
--- /dev/null
+++ b/mysql-test/suite/s3/no_s3-master.opt
@@ -0,0 +1 @@
+--s3-bucket=storage-engine --s3-access-key="" --s3-secret-key="" --s3-region=eu-north-1
diff --git a/mysql-test/suite/s3/no_s3.result b/mysql-test/suite/s3/no_s3.result
new file mode 100644
index 00000000000..89ab3ea97a1
--- /dev/null
+++ b/mysql-test/suite/s3/no_s3.result
@@ -0,0 +1,13 @@
+create table t1 (a int, b int) engine=aria select seq,seq+10 from seq_1_to_2;
+alter table t1 engine=s3;
+ERROR HY000: Can't create table `test`.`t1` (errno: 138 "Unsupported extension used for table")
+drop table t1;
+select * from s3_unique_table;
+ERROR 42000: Table 's3_unique_table' uses an extension that doesn't exist in this MariaDB version
+truncate table s3_unique_table;
+ERROR 42000: Table 's3_unique_table' uses an extension that doesn't exist in this MariaDB version
+rename table s3_unique_table to t1;
+ERROR HY000: Error on rename of './test/s3_unique_table' to './test/t1' (errno: 138 "Unsupported extension used for table")
+drop table s3_unique_table;
+Warnings:
+Warning 1112 Table 's3_unique_table' uses an extension that doesn't exist in this MariaDB version
diff --git a/mysql-test/suite/s3/no_s3.test b/mysql-test/suite/s3/no_s3.test
new file mode 100644
index 00000000000..6c5df76bfa3
--- /dev/null
+++ b/mysql-test/suite/s3/no_s3.test
@@ -0,0 +1,25 @@
+--source include/have_sequence.inc
+
+let $datadir=`select @@datadir`;
+
+if (`select @@global.s3_secret_key <> "" or @@global.s3_access_key <> ""`)
+{
+ skip S3 engine options given (probably from command line);
+}
+
+#
+# Test what happens when we don't have s3 enabled
+#
+create table t1 (a int, b int) engine=aria select seq,seq+10 from seq_1_to_2;
+--error ER_CANT_CREATE_TABLE
+alter table t1 engine=s3;
+drop table t1;
+
+--copy_file std_data/s3_unique_table.frm $datadir/test/s3_unique_table.frm
+--error ER_UNSUPPORTED_EXTENSION
+select * from s3_unique_table;
+--error ER_UNSUPPORTED_EXTENSION
+truncate table s3_unique_table;
+--error ER_ERROR_ON_RENAME
+rename table s3_unique_table to t1;
+drop table s3_unique_table;
diff --git a/mysql-test/suite/s3/partitions-master.opt b/mysql-test/suite/s3/partitions-master.opt
new file mode 100644
index 00000000000..bbb6d7f9ff4
--- /dev/null
+++ b/mysql-test/suite/s3/partitions-master.opt
@@ -0,0 +1 @@
+--loose-partition
diff --git a/mysql-test/suite/s3/partitions.result b/mysql-test/suite/s3/partitions.result
new file mode 100644
index 00000000000..c7f9a9d8cc7
--- /dev/null
+++ b/mysql-test/suite/s3/partitions.result
@@ -0,0 +1,128 @@
+# Test for COALESCE PARTITION, ALTER TABLE and ADD PARTITIONS
+# for tables with HASH partitions
+CREATE TABLE t1 (
+c1 INT DEFAULT NULL
+) ENGINE=Aria
+PARTITION BY HASH (c1)
+PARTITIONS 3;
+INSERT INTO t1 VALUE (1), (2), (101), (102), (201), (202);
+ALTER TABLE t1 ENGINE=S3;
+SELECT count(*) FROM t1;
+count(*)
+6
+ALTER TABLE t1 COALESCE PARTITION 2;
+ERROR HY000: Storage engine S3 of the table `s3`.`t1` doesn't have this option
+ALTER TABLE t1 ADD PARTITION PARTITIONS 6;
+ERROR HY000: Storage engine S3 of the table `s3`.`t1` doesn't have this option
+SELECT count(*) FROM t1;
+count(*)
+6
+ALTER TABLE t1 ADD COLUMN c INT;
+SELECT count(*) FROM t1;
+count(*)
+6
+DROP TABLE t1;
+# Test for simple change engine to S3
+CREATE TABLE t1 (
+c1 int DEFAULT NULL,
+c2 int DEFAULT NULL
+) ENGINE=Aria
+PARTITION BY RANGE (c1)
+SUBPARTITION BY HASH(c2)
+SUBPARTITIONS 2
+(PARTITION p0 VALUES LESS THAN (100),
+PARTITION p1 VALUES LESS THAN (200),
+PARTITION p3 VALUES LESS THAN (300));
+INSERT INTO t1 VALUE (1,1), (2,2), (101,101), (102,102), (201,201), (202,202);
+ALTER TABLE t1 ENGINE=S3;
+SELECT count(*) FROM t1;
+count(*)
+6
+# Test for rename table
+RENAME TABLE t1 TO t2;
+SELECT count(*) FROM t2;
+count(*)
+6
+# Test for TRUNCATE, ANALYZE, CHECK, REBUILD, OPTIMIZE, REPAIR,
+# ADD, DROP, REORGANIZE partition
+ALTER TABLE t2 TRUNCATE PARTITION p3;
+ERROR HY000: Table 't2' is read only
+ALTER TABLE t2 ANALYZE PARTITION p3;
+Table Op Msg_type Msg_text
+s3.t2 analyze error Table 's3.t2' is read only
+SELECT count(*) FROM t2;
+count(*)
+6
+ALTER TABLE t2 CHECK PARTITION p3;
+Table Op Msg_type Msg_text
+s3.t2 check error Subpartition p3sp0 returned error
+s3.t2 check error Unknown - internal error 131 during operation
+SELECT count(*) FROM t2;
+count(*)
+6
+ALTER TABLE t2 REBUILD PARTITION p0, p1;
+ERROR HY000: Storage engine S3 of the table `s3`.`t2` doesn't have this option
+ALTER TABLE t2 OPTIMIZE PARTITION p0, p1;
+Table Op Msg_type Msg_text
+s3.t2 optimize Error Table 't2' is read only
+s3.t2 optimize status Operation failed
+SELECT count(*) FROM t2;
+count(*)
+6
+ALTER TABLE t2 REPAIR PARTITION p0, p1;
+Table Op Msg_type Msg_text
+s3.t2 repair Error Table 't2' is read only
+s3.t2 repair status Operation failed
+SELECT count(*) FROM t2;
+count(*)
+6
+ALTER TABLE t2 ADD PARTITION (PARTITION p4 VALUES LESS THAN (400));
+ERROR HY000: Storage engine S3 of the table `s3`.`t2` doesn't have this option
+ALTER TABLE t2
+REORGANIZE PARTITION p3 INTO (
+PARTITION n0 VALUES LESS THAN (500),
+PARTITION n1 VALUES LESS THAN (600)
+);
+ERROR HY000: Storage engine S3 of the table `s3`.`t2` doesn't have this option
+ALTER TABLE t2 DROP PARTITION p3;
+SELECT count(*) from t2;
+count(*)
+4
+# Test for ALTER TABLE
+ALTER TABLE t2 ADD COLUMN c INT;
+SELECT count(*) FROM t2;
+count(*)
+4
+ALTER TABLE t2 DROP COLUMN c;
+SELECT count(*) FROM t2;
+count(*)
+4
+# Test for REMOVE PARTITIONING
+ALTER TABLE t2 REMOVE PARTITIONING;
+SELECT count(*) FROM t2;
+count(*)
+4
+DROP TABLE t2;
+# Test for EXCHANGE PARTITION
+CREATE TABLE t1 (
+c1 int DEFAULT NULL
+) ENGINE=Aria
+PARTITION BY RANGE (c1)
+(PARTITION p0 VALUES LESS THAN (100),
+PARTITION p1 VALUES LESS THAN (200));
+INSERT INTO t1 VALUE (1), (2), (101), (102);
+ALTER TABLE t1 ENGINE=S3;
+CREATE TABLE t_part (
+c1 int DEFAULT NULL
+) ENGINE=Aria;
+INSERT INTO t_part VALUE (120), (130), (140);
+ALTER TABLE t_part ENGINE=S3;
+ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t_part;
+SELECT count(*) FROM t_part;
+count(*)
+2
+SELECT count(*) FROM t1;
+count(*)
+5
+DROP TABLE t1;
+DROP TABLE t_part;
diff --git a/mysql-test/suite/s3/partitions.test b/mysql-test/suite/s3/partitions.test
new file mode 100644
index 00000000000..196a72e2826
--- /dev/null
+++ b/mysql-test/suite/s3/partitions.test
@@ -0,0 +1,113 @@
+--source include/have_partition.inc
+--source include/have_s3.inc
+--source create_database.inc
+
+
+--echo # Test for COALESCE PARTITION, ALTER TABLE and ADD PARTITIONS
+--echo # for tables with HASH partitions
+CREATE TABLE t1 (
+ c1 INT DEFAULT NULL
+) ENGINE=Aria
+ PARTITION BY HASH (c1)
+ PARTITIONS 3;
+INSERT INTO t1 VALUE (1), (2), (101), (102), (201), (202);
+ALTER TABLE t1 ENGINE=S3;
+SELECT count(*) FROM t1;
+--replace_result $database s3
+--error ER_ILLEGAL_HA
+ALTER TABLE t1 COALESCE PARTITION 2;
+--replace_result $database s3
+--error ER_ILLEGAL_HA
+ALTER TABLE t1 ADD PARTITION PARTITIONS 6;
+SELECT count(*) FROM t1;
+ALTER TABLE t1 ADD COLUMN c INT;
+SELECT count(*) FROM t1;
+DROP TABLE t1;
+
+--echo # Test for simple change engine to S3
+CREATE TABLE t1 (
+ c1 int DEFAULT NULL,
+ c2 int DEFAULT NULL
+) ENGINE=Aria
+ PARTITION BY RANGE (c1)
+ SUBPARTITION BY HASH(c2)
+ SUBPARTITIONS 2
+ (PARTITION p0 VALUES LESS THAN (100),
+ PARTITION p1 VALUES LESS THAN (200),
+ PARTITION p3 VALUES LESS THAN (300));
+
+INSERT INTO t1 VALUE (1,1), (2,2), (101,101), (102,102), (201,201), (202,202);
+ALTER TABLE t1 ENGINE=S3;
+SELECT count(*) FROM t1;
+
+--echo # Test for rename table
+RENAME TABLE t1 TO t2;
+SELECT count(*) FROM t2;
+
+--echo # Test for TRUNCATE, ANALYZE, CHECK, REBUILD, OPTIMIZE, REPAIR,
+--echo # ADD, DROP, REORGANIZE partition
+--error ER_OPEN_AS_READONLY
+ALTER TABLE t2 TRUNCATE PARTITION p3;
+--replace_result $database s3
+ALTER TABLE t2 ANALYZE PARTITION p3;
+SELECT count(*) FROM t2;
+--replace_result $database s3
+ALTER TABLE t2 CHECK PARTITION p3;
+SELECT count(*) FROM t2;
+--replace_result $database s3
+--error ER_ILLEGAL_HA
+ALTER TABLE t2 REBUILD PARTITION p0, p1;
+--replace_result $database s3
+ALTER TABLE t2 OPTIMIZE PARTITION p0, p1;
+SELECT count(*) FROM t2;
+--replace_result $database s3
+ALTER TABLE t2 REPAIR PARTITION p0, p1;
+SELECT count(*) FROM t2;
+--replace_result $database s3
+--error ER_ILLEGAL_HA
+ALTER TABLE t2 ADD PARTITION (PARTITION p4 VALUES LESS THAN (400));
+--replace_result $database s3
+--error ER_ILLEGAL_HA
+ALTER TABLE t2
+ REORGANIZE PARTITION p3 INTO (
+ PARTITION n0 VALUES LESS THAN (500),
+ PARTITION n1 VALUES LESS THAN (600)
+);
+ALTER TABLE t2 DROP PARTITION p3;
+SELECT count(*) from t2;
+
+--echo # Test for ALTER TABLE
+ALTER TABLE t2 ADD COLUMN c INT;
+SELECT count(*) FROM t2;
+ALTER TABLE t2 DROP COLUMN c;
+SELECT count(*) FROM t2;
+
+--echo # Test for REMOVE PARTITIONING
+ALTER TABLE t2 REMOVE PARTITIONING;
+SELECT count(*) FROM t2;
+DROP TABLE t2;
+
+--echo # Test for EXCHANGE PARTITION
+CREATE TABLE t1 (
+ c1 int DEFAULT NULL
+) ENGINE=Aria
+ PARTITION BY RANGE (c1)
+ (PARTITION p0 VALUES LESS THAN (100),
+ PARTITION p1 VALUES LESS THAN (200));
+INSERT INTO t1 VALUE (1), (2), (101), (102);
+ALTER TABLE t1 ENGINE=S3;
+CREATE TABLE t_part (
+ c1 int DEFAULT NULL
+) ENGINE=Aria;
+INSERT INTO t_part VALUE (120), (130), (140);
+ALTER TABLE t_part ENGINE=S3;
+ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t_part;
+SELECT count(*) FROM t_part;
+SELECT count(*) FROM t1;
+DROP TABLE t1;
+DROP TABLE t_part;
+
+#
+# clean up
+#
+--source drop_database.inc
diff --git a/mysql-test/suite/s3/select.result b/mysql-test/suite/s3/select.result
new file mode 100644
index 00000000000..94a6fdf12d6
--- /dev/null
+++ b/mysql-test/suite/s3/select.result
@@ -0,0 +1,8 @@
+create table t1 (pk int primary key, a int);
+insert into t1 values (1,1),(2,2),(3,3),(4,4);
+alter table t1 engine=S3;
+select a from t1 where pk in (2, 3);
+a
+2
+3
+drop table t1;
diff --git a/mysql-test/suite/s3/select.test b/mysql-test/suite/s3/select.test
new file mode 100644
index 00000000000..223311cb32b
--- /dev/null
+++ b/mysql-test/suite/s3/select.test
@@ -0,0 +1,17 @@
+--source include/have_s3.inc
+--source create_database.inc
+
+#
+# MDEV-19465 Server crashes in s3_block_read upon IN quer
+#
+
+create table t1 (pk int primary key, a int);
+insert into t1 values (1,1),(2,2),(3,3),(4,4);
+alter table t1 engine=S3;
+select a from t1 where pk in (2, 3);
+drop table t1;
+
+#
+# clean up
+#
+--source drop_database.inc
diff --git a/mysql-test/suite/s3/suite.pm b/mysql-test/suite/s3/suite.pm
new file mode 100644
index 00000000000..5bf1559ae97
--- /dev/null
+++ b/mysql-test/suite/s3/suite.pm
@@ -0,0 +1,8 @@
+package My::Suite::S3;
+
+@ISA = qw(My::Suite);
+
+return "Need S3 engine" unless $::mysqld_variables{'s3'} eq "ON";
+
+bless { };
+
diff --git a/mysql-test/suite/s3/unsupported.result b/mysql-test/suite/s3/unsupported.result
new file mode 100644
index 00000000000..4ced713f73f
--- /dev/null
+++ b/mysql-test/suite/s3/unsupported.result
@@ -0,0 +1,8 @@
+create sequence s1;
+alter table s1 engine=s3;
+ERROR HY000: Can't create table `database`.`s1` (errno: 138 "Unsupported extension used for table")
+drop sequence s1;
+create temporary table t1 (a int);
+alter table t1 engine=S3;
+ERROR HY000: Can't create table `database`.`t1` (errno: 131 "Command not supported by the engine")
+drop temporary table t1;
diff --git a/mysql-test/suite/s3/unsupported.test b/mysql-test/suite/s3/unsupported.test
new file mode 100644
index 00000000000..c2b2a89e424
--- /dev/null
+++ b/mysql-test/suite/s3/unsupported.test
@@ -0,0 +1,31 @@
+--source include/have_s3.inc
+--source create_database.inc
+
+#
+# Test unsupported features in S3
+#
+#
+
+#
+# MDEV-19463 Altering sequence to S3 leaves unremovable garbage behind
+#
+
+create sequence s1;
+--replace_result $database database
+--error ER_CANT_CREATE_TABLE
+alter table s1 engine=s3;
+drop sequence s1;
+
+#
+# MDEV-19461 Assertion failure upon altering temporary S3 table
+#
+
+create temporary table t1 (a int);
+--replace_result $database database
+--error ER_CANT_CREATE_TABLE
+alter table t1 engine=S3;
+drop temporary table t1;
+
+# clean up
+#
+--source drop_database.inc
diff --git a/mysql-test/suite/sys_vars/inc/sysvars_server.inc b/mysql-test/suite/sys_vars/inc/sysvars_server.inc
index 36b41cbdc09..dff31cb2b97 100644
--- a/mysql-test/suite/sys_vars/inc/sysvars_server.inc
+++ b/mysql-test/suite/sys_vars/inc/sysvars_server.inc
@@ -23,6 +23,7 @@ select VARIABLE_NAME,VARIABLE_SCOPE,VARIABLE_TYPE,VARIABLE_COMMENT,NUMERIC_MIN_V
variable_name not like 'wsrep%' and
variable_name not like 's3%' and
variable_name not in (
+ 'have_sanitizer',
'log_tc_size'
)
order by variable_name;
diff --git a/mysql-test/suite/sys_vars/r/big_tables_basic.result b/mysql-test/suite/sys_vars/r/big_tables_basic.result
index 29781987d47..a4ee8e83e5e 100644
--- a/mysql-test/suite/sys_vars/r/big_tables_basic.result
+++ b/mysql-test/suite/sys_vars/r/big_tables_basic.result
@@ -4,16 +4,24 @@ SELECT @start_value;
0
'#--------------------FN_DYNVARS_005_01------------------------#'
SET @@big_tables = 1;
+Warnings:
+Warning 1287 '@@big_tables' is deprecated and will be removed in a future release
SET @@big_tables = DEFAULT;
+Warnings:
+Warning 1287 '@@big_tables' is deprecated and will be removed in a future release
SELECT @@big_tables;
@@big_tables
0
'#--------------------FN_DYNVARS_005_02------------------------#'
SET @@big_tables = 0;
+Warnings:
+Warning 1287 '@@big_tables' is deprecated and will be removed in a future release
SELECT @@big_tables;
@@big_tables
0
SET @@big_tables = 1;
+Warnings:
+Warning 1287 '@@big_tables' is deprecated and will be removed in a future release
SELECT @@big_tables;
@@big_tables
1
@@ -44,10 +52,14 @@ SET @@big_tables = '';
ERROR 42000: Variable 'big_tables' can't be set to the value of ''
'#-------------------FN_DYNVARS_005_04----------------------------#'
SET @@global.big_tables = 1-@@global.big_tables;
+Warnings:
+Warning 1287 '@@big_tables' is deprecated and will be removed in a future release
SELECT @@global.big_tables;
@@global.big_tables
1
SET @@global.big_tables = 1-@@global.big_tables;
+Warnings:
+Warning 1287 '@@big_tables' is deprecated and will be removed in a future release
'#----------------------FN_DYNVARS_005_05------------------------#'
SELECT IF(@@big_tables, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
@@ -56,33 +68,47 @@ IF(@@big_tables, "ON", "OFF") = VARIABLE_VALUE
1
'#---------------------FN_DYNVARS_005_06----------------------#'
SET @@big_tables = OFF;
+Warnings:
+Warning 1287 '@@big_tables' is deprecated and will be removed in a future release
SELECT @@big_tables;
@@big_tables
0
SET @@big_tables = ON;
+Warnings:
+Warning 1287 '@@big_tables' is deprecated and will be removed in a future release
SELECT @@big_tables;
@@big_tables
1
'#---------------------FN_DYNVARS_005_07----------------------#'
SET @@big_tables = TRUE;
+Warnings:
+Warning 1287 '@@big_tables' is deprecated and will be removed in a future release
SELECT @@big_tables;
@@big_tables
1
SET @@big_tables = FALSE;
+Warnings:
+Warning 1287 '@@big_tables' is deprecated and will be removed in a future release
SELECT @@big_tables;
@@big_tables
0
'#---------------------FN_DYNVARS_005_08----------------------#'
SET @@big_tables = 0;
+Warnings:
+Warning 1287 '@@big_tables' is deprecated and will be removed in a future release
SELECT @@big_tables = @@session.big_tables;
@@big_tables = @@session.big_tables
1
SET @@big_tables = 1;
+Warnings:
+Warning 1287 '@@big_tables' is deprecated and will be removed in a future release
SELECT @@big_tables = @@local.big_tables and @@local.big_tables = @@session.big_tables;
@@big_tables = @@local.big_tables and @@local.big_tables = @@session.big_tables
1
'#---------------------FN_DYNVARS_005_09----------------------#'
SET big_tables = 1;
+Warnings:
+Warning 1287 '@@big_tables' is deprecated and will be removed in a future release
SELECT @@big_tables;
@@big_tables
1
@@ -93,6 +119,8 @@ ERROR 42S02: Unknown table 'session' in field list
select big_tables;
ERROR 42S22: Unknown column 'big_tables' in 'field list'
SET @@big_tables = @start_value;
+Warnings:
+Warning 1287 '@@big_tables' is deprecated and will be removed in a future release
SELECT @@big_tables;
@@big_tables
0
diff --git a/mysql-test/suite/sys_vars/r/binlog_row_metadata_basic.result b/mysql-test/suite/sys_vars/r/binlog_row_metadata_basic.result
new file mode 100644
index 00000000000..09287cff7fd
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/binlog_row_metadata_basic.result
@@ -0,0 +1,90 @@
+NO_LOG Expected
+SELECT @@GLOBAL.binlog_row_metadata;
+@@GLOBAL.binlog_row_metadata
+NO_LOG
+SELECT @@SESSION.binlog_row_metadata;
+ERROR HY000: Variable 'binlog_row_metadata' is a GLOBAL variable
+'#---------------------BS_STVARS_002_01----------------------#'
+SET @start_value= @@global.binlog_row_metadata;
+SELECT COUNT(@@GLOBAL.binlog_row_metadata);
+COUNT(@@GLOBAL.binlog_row_metadata)
+1
+1 Expected
+'#---------------------BS_STVARS_002_02----------------------#'
+SET @@GLOBAL.binlog_row_metadata=0;
+SELECT @@GLOBAL.binlog_row_metadata;
+@@GLOBAL.binlog_row_metadata
+NO_LOG
+NO_LOG Expected
+SET @@GLOBAL.binlog_row_metadata=1;
+SELECT @@GLOBAL.binlog_row_metadata;
+@@GLOBAL.binlog_row_metadata
+MINIMAL
+MINIMAL Expected
+SET @@GLOBAL.binlog_row_metadata=2;
+SELECT @@GLOBAL.binlog_row_metadata;
+@@GLOBAL.binlog_row_metadata
+FULL
+FULL Expected
+SET @@GLOBAL.binlog_row_metadata=NO_LOG;
+SELECT @@GLOBAL.binlog_row_metadata;
+@@GLOBAL.binlog_row_metadata
+NO_LOG
+NO_LOG Expected
+SET @@GLOBAL.binlog_row_metadata=MINIMAL;
+SELECT @@GLOBAL.binlog_row_metadata;
+@@GLOBAL.binlog_row_metadata
+MINIMAL
+MINIMAL Expected
+SET @@GLOBAL.binlog_row_metadata=FULL;
+SELECT @@GLOBAL.binlog_row_metadata;
+@@GLOBAL.binlog_row_metadata
+FULL
+FULL Expected
+SET @@GLOBAL.binlog_row_metadata='NO_LOG';
+SELECT @@GLOBAL.binlog_row_metadata;
+@@GLOBAL.binlog_row_metadata
+NO_LOG
+NO_LOG Expected
+SET @@GLOBAL.binlog_row_metadata='MINIMAL';
+SELECT @@GLOBAL.binlog_row_metadata;
+@@GLOBAL.binlog_row_metadata
+MINIMAL
+MINIMAL Expected
+SET @@GLOBAL.binlog_row_metadata='FULL';
+SELECT @@GLOBAL.binlog_row_metadata;
+@@GLOBAL.binlog_row_metadata
+FULL
+FULL Expected
+'#---------------------BS_STVARS_002_03----------------------#'
+SET @@GLOBAL.binlog_row_metadata='MINIMAl';
+SELECT *
+FROM information_schema.global_variables
+WHERE VARIABLE_NAME='binlog_row_metadata';
+VARIABLE_NAME VARIABLE_VALUE
+BINLOG_ROW_METADATA MINIMAL
+'#---------------------BS_STVARS_002_04----------------------#'
+SELECT *
+FROM information_schema.session_variables
+WHERE VARIABLE_NAME LIKE 'binlog_row_metadata';
+VARIABLE_NAME VARIABLE_VALUE
+BINLOG_ROW_METADATA MINIMAL
+'#---------------------BS_STVARS_002_05----------------------#'
+SELECT COUNT(@@binlog_row_metadata);
+COUNT(@@binlog_row_metadata)
+1
+1 Expected
+SELECT COUNT(@@GLOBAL.binlog_row_metadata);
+COUNT(@@GLOBAL.binlog_row_metadata)
+1
+1 Expected
+'#---------------------BS_STVARS_002_06----------------------#'
+SET GLOBAL binlog_row_metadata = full1;
+ERROR 42000: Variable 'binlog_row_metadata' can't be set to the value of 'full1'
+SET GLOBAL binlog_row_metadata = "full1";
+ERROR 42000: Variable 'binlog_row_metadata' can't be set to the value of 'full1'
+SET GLOBAL binlog_row_metadata = 3;
+ERROR 42000: Variable 'binlog_row_metadata' can't be set to the value of '3'
+SET GLOBAL binlog_row_metadata = -1;
+ERROR 42000: Variable 'binlog_row_metadata' can't be set to the value of '-1'
+SET @@global.binlog_row_metadata= @start_value;
diff --git a/mysql-test/suite/sys_vars/r/innodb_checksum_algorithm_basic.result b/mysql-test/suite/sys_vars/r/innodb_checksum_algorithm_basic.result
index eec16411144..91d3c65597a 100644
--- a/mysql-test/suite/sys_vars/r/innodb_checksum_algorithm_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_checksum_algorithm_basic.result
@@ -1,7 +1,7 @@
SET @orig = @@global.innodb_checksum_algorithm;
SELECT @orig;
@orig
-crc32
+full_crc32
SET GLOBAL innodb_checksum_algorithm = 'crc32';
SELECT @@global.innodb_checksum_algorithm;
@@global.innodb_checksum_algorithm
@@ -52,4 +52,4 @@ strict_full_crc32
SET GLOBAL innodb_checksum_algorithm = @orig;
SELECT @@global.innodb_checksum_algorithm;
@@global.innodb_checksum_algorithm
-crc32
+full_crc32
diff --git a/mysql-test/suite/sys_vars/r/innodb_checksums_basic.result b/mysql-test/suite/sys_vars/r/innodb_checksums_basic.result
deleted file mode 100644
index bb3cbac1863..00000000000
--- a/mysql-test/suite/sys_vars/r/innodb_checksums_basic.result
+++ /dev/null
@@ -1,53 +0,0 @@
-'#---------------------BS_STVARS_023_01----------------------#'
-SELECT COUNT(@@GLOBAL.innodb_checksums);
-COUNT(@@GLOBAL.innodb_checksums)
-1
-1 Expected
-'#---------------------BS_STVARS_023_02----------------------#'
-SET @@GLOBAL.innodb_checksums=1;
-ERROR HY000: Variable 'innodb_checksums' is a read only variable
-Expected error 'Read only variable'
-SELECT COUNT(@@GLOBAL.innodb_checksums);
-COUNT(@@GLOBAL.innodb_checksums)
-1
-1 Expected
-'#---------------------BS_STVARS_023_03----------------------#'
-SELECT IF(@@GLOBAL.innodb_checksums, "ON", "OFF") = VARIABLE_VALUE
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
-WHERE VARIABLE_NAME='innodb_checksums';
-IF(@@GLOBAL.innodb_checksums, "ON", "OFF") = VARIABLE_VALUE
-1
-1 Expected
-SELECT COUNT(@@GLOBAL.innodb_checksums);
-COUNT(@@GLOBAL.innodb_checksums)
-1
-1 Expected
-SELECT COUNT(VARIABLE_VALUE)
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
-WHERE VARIABLE_NAME='innodb_checksums';
-COUNT(VARIABLE_VALUE)
-1
-1 Expected
-'#---------------------BS_STVARS_023_04----------------------#'
-SELECT @@innodb_checksums = @@GLOBAL.innodb_checksums;
-@@innodb_checksums = @@GLOBAL.innodb_checksums
-1
-1 Expected
-'#---------------------BS_STVARS_023_05----------------------#'
-SELECT COUNT(@@innodb_checksums);
-COUNT(@@innodb_checksums)
-1
-1 Expected
-SELECT COUNT(@@local.innodb_checksums);
-ERROR HY000: Variable 'innodb_checksums' is a GLOBAL variable
-Expected error 'Variable is a GLOBAL variable'
-SELECT COUNT(@@SESSION.innodb_checksums);
-ERROR HY000: Variable 'innodb_checksums' is a GLOBAL variable
-Expected error 'Variable is a GLOBAL variable'
-SELECT COUNT(@@GLOBAL.innodb_checksums);
-COUNT(@@GLOBAL.innodb_checksums)
-1
-1 Expected
-SELECT innodb_checksums = @@SESSION.innodb_checksums;
-ERROR 42S22: Unknown column 'innodb_checksums' in 'field list'
-Expected error 'Readonly variable'
diff --git a/mysql-test/suite/sys_vars/r/innodb_disable_background_merge_basic.result b/mysql-test/suite/sys_vars/r/innodb_disable_background_merge_basic.result
deleted file mode 100644
index c4bf621a33d..00000000000
--- a/mysql-test/suite/sys_vars/r/innodb_disable_background_merge_basic.result
+++ /dev/null
@@ -1,4 +0,0 @@
-SET @orig = @@global.innodb_disable_background_merge;
-SELECT @orig;
-@orig
-0
diff --git a/mysql-test/suite/sys_vars/r/innodb_locks_unsafe_for_binlog_basic.result b/mysql-test/suite/sys_vars/r/innodb_locks_unsafe_for_binlog_basic.result
deleted file mode 100644
index c2229d54d02..00000000000
--- a/mysql-test/suite/sys_vars/r/innodb_locks_unsafe_for_binlog_basic.result
+++ /dev/null
@@ -1,53 +0,0 @@
-'#---------------------BS_STVARS_031_01----------------------#'
-SELECT COUNT(@@GLOBAL.innodb_locks_unsafe_for_binlog);
-COUNT(@@GLOBAL.innodb_locks_unsafe_for_binlog)
-1
-1 Expected
-'#---------------------BS_STVARS_031_02----------------------#'
-SET @@GLOBAL.innodb_locks_unsafe_for_binlog=1;
-ERROR HY000: Variable 'innodb_locks_unsafe_for_binlog' is a read only variable
-Expected error 'Read only variable'
-SELECT COUNT(@@GLOBAL.innodb_locks_unsafe_for_binlog);
-COUNT(@@GLOBAL.innodb_locks_unsafe_for_binlog)
-1
-1 Expected
-'#---------------------BS_STVARS_031_03----------------------#'
-SELECT IF(@@GLOBAL.innodb_locks_unsafe_for_binlog, "ON", "OFF") = VARIABLE_VALUE
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
-WHERE VARIABLE_NAME='innodb_locks_unsafe_for_binlog';
-IF(@@GLOBAL.innodb_locks_unsafe_for_binlog, "ON", "OFF") = VARIABLE_VALUE
-1
-1 Expected
-SELECT COUNT(@@GLOBAL.innodb_locks_unsafe_for_binlog);
-COUNT(@@GLOBAL.innodb_locks_unsafe_for_binlog)
-1
-1 Expected
-SELECT COUNT(VARIABLE_VALUE)
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
-WHERE VARIABLE_NAME='innodb_locks_unsafe_for_binlog';
-COUNT(VARIABLE_VALUE)
-1
-1 Expected
-'#---------------------BS_STVARS_031_04----------------------#'
-SELECT @@innodb_locks_unsafe_for_binlog = @@GLOBAL.innodb_locks_unsafe_for_binlog;
-@@innodb_locks_unsafe_for_binlog = @@GLOBAL.innodb_locks_unsafe_for_binlog
-1
-1 Expected
-'#---------------------BS_STVARS_031_05----------------------#'
-SELECT COUNT(@@innodb_locks_unsafe_for_binlog);
-COUNT(@@innodb_locks_unsafe_for_binlog)
-1
-1 Expected
-SELECT COUNT(@@local.innodb_locks_unsafe_for_binlog);
-ERROR HY000: Variable 'innodb_locks_unsafe_for_binlog' is a GLOBAL variable
-Expected error 'Variable is a GLOBAL variable'
-SELECT COUNT(@@SESSION.innodb_locks_unsafe_for_binlog);
-ERROR HY000: Variable 'innodb_locks_unsafe_for_binlog' is a GLOBAL variable
-Expected error 'Variable is a GLOBAL variable'
-SELECT COUNT(@@GLOBAL.innodb_locks_unsafe_for_binlog);
-COUNT(@@GLOBAL.innodb_locks_unsafe_for_binlog)
-1
-1 Expected
-SELECT innodb_locks_unsafe_for_binlog = @@SESSION.innodb_locks_unsafe_for_binlog;
-ERROR 42S22: Unknown column 'innodb_locks_unsafe_for_binlog' in 'field list'
-Expected error 'Readonly variable'
diff --git a/mysql-test/suite/sys_vars/r/innodb_log_checksums_basic.result b/mysql-test/suite/sys_vars/r/innodb_log_checksums_basic.result
index 6679ca87249..bf70bbb1bea 100644
--- a/mysql-test/suite/sys_vars/r/innodb_log_checksums_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_log_checksums_basic.result
@@ -28,15 +28,23 @@ SELECT @@global.innodb_log_checksums;
@@global.innodb_log_checksums
1
SET GLOBAL innodb_log_checksums = OFF;
+Warnings:
+Warning 138 The parameter innodb_log_checksums is deprecated and has no effect.
SELECT @@global.innodb_log_checksums;
@@global.innodb_log_checksums
-0
+1
SET GLOBAL innodb_log_checksums = default;
+Warnings:
+Warning 138 The parameter innodb_log_checksums is deprecated and has no effect.
SET GLOBAL innodb_log_checksums = ON;
+Warnings:
+Warning 138 The parameter innodb_log_checksums is deprecated and has no effect.
SELECT @@global.innodb_log_checksums;
@@global.innodb_log_checksums
1
SET GLOBAL innodb_log_checksums = @orig;
+Warnings:
+Warning 138 The parameter innodb_log_checksums is deprecated and has no effect.
SELECT @@global.innodb_log_checksums;
@@global.innodb_log_checksums
1
diff --git a/mysql-test/suite/sys_vars/r/innodb_rollback_segments_basic.result b/mysql-test/suite/sys_vars/r/innodb_rollback_segments_basic.result
deleted file mode 100644
index a8d392eee38..00000000000
--- a/mysql-test/suite/sys_vars/r/innodb_rollback_segments_basic.result
+++ /dev/null
@@ -1,64 +0,0 @@
-SET @start_global_value = @@global.innodb_rollback_segments;
-SELECT @start_global_value;
-@start_global_value
-128
-Valid values are zero or above
-SELECT @@global.innodb_rollback_segments >=0;
-@@global.innodb_rollback_segments >=0
-1
-SELECT @@global.innodb_rollback_segments <=128;
-@@global.innodb_rollback_segments <=128
-1
-SELECT @@global.innodb_rollback_segments;
-@@global.innodb_rollback_segments
-128
-SELECT @@session.innodb_rollback_segments;
-ERROR HY000: Variable 'innodb_rollback_segments' is a GLOBAL variable
-SHOW global variables LIKE 'innodb_rollback_segments';
-Variable_name Value
-innodb_rollback_segments 128
-SHOW session variables LIKE 'innodb_rollback_segments';
-Variable_name Value
-innodb_rollback_segments 128
-SELECT * FROM information_schema.global_variables
-WHERE variable_name='innodb_rollback_segments';
-VARIABLE_NAME VARIABLE_VALUE
-INNODB_ROLLBACK_SEGMENTS 128
-SELECT * FROM information_schema.session_variables
-WHERE variable_name='innodb_rollback_segments';
-VARIABLE_NAME VARIABLE_VALUE
-INNODB_ROLLBACK_SEGMENTS 128
-SET global innodb_rollback_segments=100;
-SELECT @@global.innodb_rollback_segments;
-@@global.innodb_rollback_segments
-100
-SELECT * FROM information_schema.global_variables
-WHERE variable_name='innodb_rollback_segments';
-VARIABLE_NAME VARIABLE_VALUE
-INNODB_ROLLBACK_SEGMENTS 100
-SELECT * FROM information_schema.session_variables
-WHERE variable_name='innodb_rollback_segments';
-VARIABLE_NAME VARIABLE_VALUE
-INNODB_ROLLBACK_SEGMENTS 100
-SET session innodb_rollback_segments=1;
-ERROR HY000: Variable 'innodb_rollback_segments' is a GLOBAL variable and should be set with SET GLOBAL
-SET global innodb_rollback_segments=1.1;
-ERROR 42000: Incorrect argument type to variable 'innodb_rollback_segments'
-SET global innodb_rollback_segments=1e1;
-ERROR 42000: Incorrect argument type to variable 'innodb_rollback_segments'
-SET global innodb_rollback_segments="foo";
-ERROR 42000: Incorrect argument type to variable 'innodb_rollback_segments'
-SET global innodb_rollback_segments=-7;
-Warnings:
-Warning 1292 Truncated incorrect innodb_rollback_segments value: '-7'
-SELECT @@global.innodb_rollback_segments;
-@@global.innodb_rollback_segments
-1
-SELECT * FROM information_schema.global_variables
-WHERE variable_name='innodb_rollback_segments';
-VARIABLE_NAME VARIABLE_VALUE
-INNODB_ROLLBACK_SEGMENTS 1
-SET @@global.innodb_rollback_segments = @start_global_value;
-SELECT @@global.innodb_rollback_segments;
-@@global.innodb_rollback_segments
-128
diff --git a/mysql-test/suite/sys_vars/r/innodb_stats_sample_pages_basic.result b/mysql-test/suite/sys_vars/r/innodb_stats_sample_pages_basic.result
deleted file mode 100644
index 8618d602922..00000000000
--- a/mysql-test/suite/sys_vars/r/innodb_stats_sample_pages_basic.result
+++ /dev/null
@@ -1,77 +0,0 @@
-SET @start_global_value = @@global.innodb_stats_sample_pages;
-SELECT @start_global_value;
-@start_global_value
-8
-Valid values are one or above
-select @@global.innodb_stats_sample_pages >=1;
-@@global.innodb_stats_sample_pages >=1
-1
-select @@global.innodb_stats_sample_pages;
-@@global.innodb_stats_sample_pages
-8
-select @@session.innodb_stats_sample_pages;
-ERROR HY000: Variable 'innodb_stats_sample_pages' is a GLOBAL variable
-show global variables like 'innodb_stats_sample_pages';
-Variable_name Value
-innodb_stats_sample_pages 8
-show session variables like 'innodb_stats_sample_pages';
-Variable_name Value
-innodb_stats_sample_pages 8
-select * from information_schema.global_variables where variable_name='innodb_stats_sample_pages';
-VARIABLE_NAME VARIABLE_VALUE
-INNODB_STATS_SAMPLE_PAGES 8
-select * from information_schema.session_variables where variable_name='innodb_stats_sample_pages';
-VARIABLE_NAME VARIABLE_VALUE
-INNODB_STATS_SAMPLE_PAGES 8
-set global innodb_stats_sample_pages=10;
-Warnings:
-Warning 131 Using innodb_stats_sample_pages is deprecated and the variable may be removed in future releases. Please use innodb_stats_transient_sample_pages instead.
-select @@global.innodb_stats_sample_pages;
-@@global.innodb_stats_sample_pages
-10
-select * from information_schema.global_variables where variable_name='innodb_stats_sample_pages';
-VARIABLE_NAME VARIABLE_VALUE
-INNODB_STATS_SAMPLE_PAGES 10
-select * from information_schema.session_variables where variable_name='innodb_stats_sample_pages';
-VARIABLE_NAME VARIABLE_VALUE
-INNODB_STATS_SAMPLE_PAGES 10
-set session innodb_stats_sample_pages=1;
-ERROR HY000: Variable 'innodb_stats_sample_pages' is a GLOBAL variable and should be set with SET GLOBAL
-set global innodb_stats_sample_pages=DEFAULT;
-Warnings:
-Warning 131 Using innodb_stats_sample_pages is deprecated and the variable may be removed in future releases. Please use innodb_stats_transient_sample_pages instead.
-select @@global.innodb_stats_sample_pages;
-@@global.innodb_stats_sample_pages
-8
-set global innodb_stats_sample_pages = 1.1;
-ERROR 42000: Incorrect argument type to variable 'innodb_stats_sample_pages'
-set global innodb_stats_sample_pages = 1e1;
-ERROR 42000: Incorrect argument type to variable 'innodb_stats_sample_pages'
-set global innodb_stats_sample_pages = "foo";
-ERROR 42000: Incorrect argument type to variable 'innodb_stats_sample_pages'
-set global innodb_stats_sample_pages=' ';
-ERROR 42000: Incorrect argument type to variable 'innodb_stats_sample_pages'
-select @@global.innodb_stats_sample_pages;
-@@global.innodb_stats_sample_pages
-8
-set global innodb_stats_sample_pages=" ";
-ERROR 42000: Incorrect argument type to variable 'innodb_stats_sample_pages'
-select @@global.innodb_stats_sample_pages;
-@@global.innodb_stats_sample_pages
-8
-set global innodb_stats_sample_pages=-7;
-Warnings:
-Warning 1292 Truncated incorrect innodb_stats_sample_pages value: '-7'
-Warning 131 Using innodb_stats_sample_pages is deprecated and the variable may be removed in future releases. Please use innodb_stats_transient_sample_pages instead.
-select @@global.innodb_stats_sample_pages;
-@@global.innodb_stats_sample_pages
-1
-select * from information_schema.global_variables where variable_name='innodb_stats_sample_pages';
-VARIABLE_NAME VARIABLE_VALUE
-INNODB_STATS_SAMPLE_PAGES 1
-SET @@global.innodb_stats_sample_pages = @start_global_value;
-Warnings:
-Warning 131 Using innodb_stats_sample_pages is deprecated and the variable may be removed in future releases. Please use innodb_stats_transient_sample_pages instead.
-SELECT @@global.innodb_stats_sample_pages;
-@@global.innodb_stats_sample_pages
-8
diff --git a/mysql-test/suite/sys_vars/r/innodb_stats_transient_sample_pages_basic.result b/mysql-test/suite/sys_vars/r/innodb_stats_transient_sample_pages_basic.result
index 1ea5ac3d3bc..abd6beec929 100644
--- a/mysql-test/suite/sys_vars/r/innodb_stats_transient_sample_pages_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_stats_transient_sample_pages_basic.result
@@ -2,9 +2,9 @@ SET @start_global_value = @@global.innodb_stats_transient_sample_pages;
SELECT @start_global_value;
@start_global_value
8
-Valid values are zero or above
-SELECT @@global.innodb_stats_transient_sample_pages >=0;
-@@global.innodb_stats_transient_sample_pages >=0
+Valid values are one or above
+SELECT @@global.innodb_stats_transient_sample_pages >=1;
+@@global.innodb_stats_transient_sample_pages >=1
1
SELECT @@global.innodb_stats_transient_sample_pages;
@@global.innodb_stats_transient_sample_pages
diff --git a/mysql-test/suite/sys_vars/r/innodb_undo_logs_basic.result b/mysql-test/suite/sys_vars/r/innodb_undo_logs_basic.result
index 1310d7151fd..d6ff67ccc7d 100644
--- a/mysql-test/suite/sys_vars/r/innodb_undo_logs_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_undo_logs_basic.result
@@ -1,68 +1,44 @@
-SELECT @@GLOBAL.innodb_undo_logs;
-@@GLOBAL.innodb_undo_logs
+SELECT @@global.innodb_undo_logs;
+@@global.innodb_undo_logs
128
-128 Expected
-SET @@GLOBAL.innodb_undo_logs=128;
-SELECT COUNT(@@GLOBAL.innodb_undo_logs);
-COUNT(@@GLOBAL.innodb_undo_logs)
-1
-1 Expected
-SELECT VARIABLE_VALUE
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
-WHERE VARIABLE_NAME='innodb_undo_logs';
-VARIABLE_VALUE
-128
-128 Expected
-SELECT @@innodb_undo_logs = @@GLOBAL.innodb_undo_logs;
-@@innodb_undo_logs = @@GLOBAL.innodb_undo_logs
-1
-1 Expected
-SELECT COUNT(@@innodb_undo_logs);
-COUNT(@@innodb_undo_logs)
-1
-1 Expected
-SELECT COUNT(@@local.innodb_undo_logs);
-ERROR HY000: Variable 'innodb_undo_logs' is a GLOBAL variable
-Expected error 'Variable is a GLOBAL variable'
-SELECT COUNT(@@SESSION.innodb_undo_logs);
+SELECT @@session.innodb_undo_logs;
ERROR HY000: Variable 'innodb_undo_logs' is a GLOBAL variable
-Expected error 'Variable is a GLOBAL variable'
-SELECT innodb_undo_logs = @@SESSION.innodb_undo_logs;
-ERROR 42S22: Unknown column 'innodb_undo_logs' in 'field list'
-Begin bug 13604034
-select @@innodb_undo_logs;
-@@innodb_undo_logs
-128
-128 Expected
-set global innodb_undo_logs = 129;
+SHOW global variables LIKE 'innodb_undo_logs';
+Variable_name Value
+innodb_undo_logs 128
+SHOW session variables LIKE 'innodb_undo_logs';
+Variable_name Value
+innodb_undo_logs 128
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_undo_logs';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_UNDO_LOGS 128
+SELECT * FROM information_schema.session_variables
+WHERE variable_name='innodb_undo_logs';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_UNDO_LOGS 128
+SET global innodb_undo_logs=100;
Warnings:
-Warning 1292 Truncated incorrect innodb_undo_logs value: '129'
-select @@innodb_undo_logs;
-@@innodb_undo_logs
+Warning 138 The parameter innodb_undo_logs is deprecated and has no effect.
+SELECT @@global.innodb_undo_logs;
+@@global.innodb_undo_logs
128
-128 Expected
-set global innodb_undo_logs = 0;
-Warnings:
-Warning 1292 Truncated incorrect innodb_undo_logs value: '0'
-select @@innodb_undo_logs;
-@@innodb_undo_logs
-1
-1 Expected
-set global innodb_undo_logs = -1;
+SET session innodb_undo_logs=1;
+ERROR HY000: Variable 'innodb_undo_logs' is a GLOBAL variable and should be set with SET GLOBAL
+SET global innodb_undo_logs=1.1;
+ERROR 42000: Incorrect argument type to variable 'innodb_undo_logs'
+SET global innodb_undo_logs=1e1;
+ERROR 42000: Incorrect argument type to variable 'innodb_undo_logs'
+SET global innodb_undo_logs="foo";
+ERROR 42000: Incorrect argument type to variable 'innodb_undo_logs'
+SET global innodb_undo_logs=-7;
Warnings:
-Warning 1292 Truncated incorrect innodb_undo_logs value: '-1'
-select @@innodb_undo_logs;
-@@innodb_undo_logs
-1
-1 Expected
-set global innodb_undo_logs = 50;
-select @@innodb_undo_logs;
-@@innodb_undo_logs
-50
-50 Expected
-set global innodb_undo_logs = default;
-select @@innodb_undo_logs;
-@@innodb_undo_logs
+Warning 1292 Truncated incorrect innodb_undo_logs value: '-7'
+Warning 138 The parameter innodb_undo_logs is deprecated and has no effect.
+SELECT @@global.innodb_undo_logs;
+@@global.innodb_undo_logs
128
-128 Expected
-End bug 13604034
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_undo_logs';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_UNDO_LOGS 128
diff --git a/mysql-test/suite/sys_vars/r/max_long_data_size_basic.result b/mysql-test/suite/sys_vars/r/max_long_data_size_basic.result
deleted file mode 100644
index 679a0d3611f..00000000000
--- a/mysql-test/suite/sys_vars/r/max_long_data_size_basic.result
+++ /dev/null
@@ -1,14 +0,0 @@
-select @@global.max_long_data_size=20;
-@@global.max_long_data_size=20
-0
-select @@session.max_long_data_size;
-ERROR HY000: Variable 'max_long_data_size' is a GLOBAL variable
-SELECT @@global.max_long_data_size = VARIABLE_VALUE
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
-WHERE VARIABLE_NAME='max_long_data_size';
-@@global.max_long_data_size = VARIABLE_VALUE
-1
-set global max_long_data_size=1;
-ERROR HY000: Variable 'max_long_data_size' is a read only variable
-set session max_long_data_size=1;
-ERROR HY000: Variable 'max_long_data_size' is a read only variable
diff --git a/mysql-test/suite/sys_vars/r/optimizer_switch_basic.result b/mysql-test/suite/sys_vars/r/optimizer_switch_basic.result
index 91932c966f6..0ac1b839d76 100644
--- a/mysql-test/suite/sys_vars/r/optimizer_switch_basic.result
+++ b/mysql-test/suite/sys_vars/r/optimizer_switch_basic.result
@@ -1,60 +1,60 @@
set @@global.optimizer_switch=@@optimizer_switch;
select @@global.optimizer_switch;
@@global.optimizer_switch
-index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on
+index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off
select @@session.optimizer_switch;
@@session.optimizer_switch
-index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on
+index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off
show global variables like 'optimizer_switch';
Variable_name Value
-optimizer_switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on
+optimizer_switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off
show session variables like 'optimizer_switch';
Variable_name Value
-optimizer_switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on
+optimizer_switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off
select * from information_schema.global_variables where variable_name='optimizer_switch';
VARIABLE_NAME VARIABLE_VALUE
-OPTIMIZER_SWITCH index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on
+OPTIMIZER_SWITCH index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off
select * from information_schema.session_variables where variable_name='optimizer_switch';
VARIABLE_NAME VARIABLE_VALUE
-OPTIMIZER_SWITCH index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on
+OPTIMIZER_SWITCH index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off
set global optimizer_switch=10;
set session optimizer_switch=5;
select @@global.optimizer_switch;
@@global.optimizer_switch
-index_merge=off,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off
+index_merge=off,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off
select @@session.optimizer_switch;
@@session.optimizer_switch
-index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off
+index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off
set global optimizer_switch="index_merge_sort_union=on";
set session optimizer_switch="index_merge=off";
select @@global.optimizer_switch;
@@global.optimizer_switch
-index_merge=off,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off
+index_merge=off,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off
select @@session.optimizer_switch;
@@session.optimizer_switch
-index_merge=off,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off
+index_merge=off,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off
show global variables like 'optimizer_switch';
Variable_name Value
-optimizer_switch index_merge=off,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off
+optimizer_switch index_merge=off,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off
show session variables like 'optimizer_switch';
Variable_name Value
-optimizer_switch index_merge=off,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off
+optimizer_switch index_merge=off,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off
select * from information_schema.global_variables where variable_name='optimizer_switch';
VARIABLE_NAME VARIABLE_VALUE
-OPTIMIZER_SWITCH index_merge=off,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off
+OPTIMIZER_SWITCH index_merge=off,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off
select * from information_schema.session_variables where variable_name='optimizer_switch';
VARIABLE_NAME VARIABLE_VALUE
-OPTIMIZER_SWITCH index_merge=off,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off
+OPTIMIZER_SWITCH index_merge=off,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off
set session optimizer_switch="default";
select @@session.optimizer_switch;
@@session.optimizer_switch
-index_merge=off,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off
+index_merge=off,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off
set optimizer_switch = replace(@@optimizer_switch, '=off', '=on');
Warnings:
Warning 1681 'engine_condition_pushdown=on' is deprecated and will be removed in a future release
select @@optimizer_switch;
@@optimizer_switch
-index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=on,mrr_cost_based=on,mrr_sort_keys=on,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on
+index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=on,mrr_cost_based=on,mrr_sort_keys=on,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=on
set global optimizer_switch=1.1;
ERROR 42000: Incorrect argument type to variable 'optimizer_switch'
set global optimizer_switch=1e1;
diff --git a/mysql-test/suite/sys_vars/r/session_track_system_variables_basic.result b/mysql-test/suite/sys_vars/r/session_track_system_variables_basic.result
index 78ca8ca4ad1..bb34436b4ec 100644
--- a/mysql-test/suite/sys_vars/r/session_track_system_variables_basic.result
+++ b/mysql-test/suite/sys_vars/r/session_track_system_variables_basic.result
@@ -12,19 +12,13 @@ SELECT @@session.session_track_system_variables;
autocommit,character_set_client,character_set_connection,character_set_results,time_zone
# via INFORMATION_SCHEMA.GLOBAL_VARIABLES
-SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'session_track%' ORDER BY VARIABLE_NAME;
+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'session_track_system_variables' ORDER BY VARIABLE_NAME;
VARIABLE_NAME VARIABLE_VALUE
-SESSION_TRACK_SCHEMA ON
-SESSION_TRACK_STATE_CHANGE OFF
SESSION_TRACK_SYSTEM_VARIABLES autocommit,character_set_client,character_set_connection,character_set_results,time_zone
-SESSION_TRACK_TRANSACTION_INFO OFF
# via INFORMATION_SCHEMA.SESSION_VARIABLES
-SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE 'session_track%' ORDER BY VARIABLE_NAME;
+SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE 'session_track_system_variables' ORDER BY VARIABLE_NAME;
VARIABLE_NAME VARIABLE_VALUE
-SESSION_TRACK_SCHEMA ON
-SESSION_TRACK_STATE_CHANGE OFF
SESSION_TRACK_SYSTEM_VARIABLES autocommit,character_set_client,character_set_connection,character_set_results,time_zone
-SESSION_TRACK_TRANSACTION_INFO OFF
SET @global_saved_tmp = @@global.session_track_system_variables;
# Altering global variable's value
diff --git a/mysql-test/suite/sys_vars/r/sql_big_tables_basic.result b/mysql-test/suite/sys_vars/r/sql_big_tables_basic.result
deleted file mode 100644
index 09553ae7d57..00000000000
--- a/mysql-test/suite/sys_vars/r/sql_big_tables_basic.result
+++ /dev/null
@@ -1,109 +0,0 @@
-SET @session_start_value = @@session.sql_big_tables;
-SELECT @session_start_value;
-@session_start_value
-0
-'#--------------------FN_DYNVARS_154_01------------------------#'
-SET @@session.sql_big_tables = 0;
-SET @@session.sql_big_tables = DEFAULT;
-SELECT @@session.sql_big_tables;
-@@session.sql_big_tables
-0
-SET @@session.sql_big_tables = 1;
-SET @@session.sql_big_tables = DEFAULT;
-SELECT @@session.sql_big_tables;
-@@session.sql_big_tables
-0
-'#---------------------FN_DYNVARS_154_02-------------------------#'
-SET sql_big_tables = 1;
-SELECT @@sql_big_tables;
-@@sql_big_tables
-1
-SELECT session.sql_big_tables;
-ERROR 42S02: Unknown table 'session' in field list
-SELECT local.sql_big_tables;
-ERROR 42S02: Unknown table 'local' in field list
-SET session sql_big_tables = 0;
-SELECT @@session.sql_big_tables;
-@@session.sql_big_tables
-0
-'#--------------------FN_DYNVARS_154_03------------------------#'
-SET @@session.sql_big_tables = 0;
-SELECT @@session.sql_big_tables;
-@@session.sql_big_tables
-0
-SET @@session.sql_big_tables = 1;
-SELECT @@session.sql_big_tables;
-@@session.sql_big_tables
-1
-'#--------------------FN_DYNVARS_154_04-------------------------#'
-SET @@session.sql_big_tables = -1;
-ERROR 42000: Variable 'sql_big_tables' can't be set to the value of '-1'
-SET @@session.sql_big_tables = 2;
-ERROR 42000: Variable 'sql_big_tables' can't be set to the value of '2'
-SET @@session.sql_big_tables = "T";
-ERROR 42000: Variable 'sql_big_tables' can't be set to the value of 'T'
-SET @@session.sql_big_tables = "Y";
-ERROR 42000: Variable 'sql_big_tables' can't be set to the value of 'Y'
-SET @@session.sql_big_tables = TRÜE;
-ERROR 42000: Variable 'sql_big_tables' can't be set to the value of 'TRÜE'
-SET @@session.sql_big_tables = ÕN;
-ERROR 42000: Variable 'sql_big_tables' can't be set to the value of 'ÕN'
-SET @@session.sql_big_tables = OF;
-ERROR 42000: Variable 'sql_big_tables' can't be set to the value of 'OF'
-SET @@session.sql_big_tables = ÓFF;
-ERROR 42000: Variable 'sql_big_tables' can't be set to the value of 'ÓFF'
-SET @@session.sql_big_tables = '¹';
-ERROR 42000: Variable 'sql_big_tables' can't be set to the value of '¹'
-SET @@session.sql_big_tables = NO;
-ERROR 42000: Variable 'sql_big_tables' can't be set to the value of 'NO'
-'#-------------------FN_DYNVARS_154_05----------------------------#'
-SET @@global.sql_big_tables = 1-@@global.sql_big_tables;
-SELECT @@global.sql_big_tables;
-@@global.sql_big_tables
-1
-SET @@global.sql_big_tables = 1-@@global.sql_big_tables;
-SELECT @@global.sql_big_tables;
-@@global.sql_big_tables
-0
-'#----------------------FN_DYNVARS_154_06------------------------#'
-SELECT count(VARIABLE_VALUE)
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
-WHERE VARIABLE_NAME='sql_big_tables';
-count(VARIABLE_VALUE)
-1
-'#----------------------FN_DYNVARS_154_07------------------------#'
-SELECT IF(@@session.sql_big_tables, "ON", "OFF") = VARIABLE_VALUE
-FROM INFORMATION_SCHEMA.SESSION_VARIABLES
-WHERE VARIABLE_NAME='sql_big_tables';
-IF(@@session.sql_big_tables, "ON", "OFF") = VARIABLE_VALUE
-1
-SELECT @@session.sql_big_tables;
-@@session.sql_big_tables
-1
-SELECT VARIABLE_VALUE
-FROM INFORMATION_SCHEMA.SESSION_VARIABLES
-WHERE VARIABLE_NAME='sql_big_tables';
-VARIABLE_VALUE
-ON
-'#---------------------FN_DYNVARS_154_08-------------------------#'
-SET @@session.sql_big_tables = OFF;
-SELECT @@session.sql_big_tables;
-@@session.sql_big_tables
-0
-SET @@session.sql_big_tables = ON;
-SELECT @@session.sql_big_tables;
-@@session.sql_big_tables
-1
-'#---------------------FN_DYNVARS_154_09----------------------#'
-SET @@session.sql_big_tables = TRUE;
-SELECT @@session.sql_big_tables;
-@@session.sql_big_tables
-1
-SET @@session.sql_big_tables = FALSE;
-SELECT @@session.sql_big_tables;
-@@session.sql_big_tables
-0
-SET @@session.sql_big_tables = @session_start_value;
-SELECT @@session.sql_big_tables;
-@@session.sql_big_tables
-0
diff --git a/mysql-test/suite/sys_vars/r/sql_big_tables_func.result b/mysql-test/suite/sys_vars/r/sql_big_tables_func.result
deleted file mode 100644
index cf42cb742b2..00000000000
--- a/mysql-test/suite/sys_vars/r/sql_big_tables_func.result
+++ /dev/null
@@ -1,96 +0,0 @@
-** Setup **
-
-SET @old_big_tables = @@SESSION.sql_big_tables;
-CREATE TABLE t1(a varchar(20), b varchar(20));
-INSERT INTO t1 VALUES('aa','bb');
-INSERT INTO t1 VALUES('aa','bb');
-INSERT INTO t1 VALUES('aa','bb');
-INSERT INTO t1 VALUES('aa','bb');
-INSERT INTO t1 VALUES('aa','bb');
-'#--------------------FN_DYNVARS_155_01-------------------------#'
-SET SESSION sql_big_tables = 1;
-SET @diskTableCount = 0;
-SET @tempTableCount = 0;
-select count(a), b from t1 group by b;
-count(a) b
-5 bb
-SET @diskTableCount = 1 - @diskTableCount;
-SET @tempTableCount = 1 - @tempTableCount;
-SELECT @diskTableCount;
-@diskTableCount
-1
-1 Expected
-SELECT @tempTableCount;
-@tempTableCount
-1
-1 Expected
-'#--------------------FN_DYNVARS_155_02-------------------------#'
-SET SESSION sql_big_tables = 0;
-SET @diskTableCount = 1;
-SET @tempTableCount = 1;
-SELECT * FROM (SELECT ta.b as a, tb.a as b FROM t1 as ta INNER JOIN t1 as tb ON ta.a = tb.a) sub;
-a b
-bb aa
-bb aa
-bb aa
-bb aa
-bb aa
-bb aa
-bb aa
-bb aa
-bb aa
-bb aa
-bb aa
-bb aa
-bb aa
-bb aa
-bb aa
-bb aa
-bb aa
-bb aa
-bb aa
-bb aa
-bb aa
-bb aa
-bb aa
-bb aa
-bb aa
-SET @diskTableCount = 1 - @diskTableCount;
-SET @tempTableCount = 2 - @tempTableCount;
-SELECT @diskTableCount;
-@diskTableCount
-0
-0 Expected
-SELECT @tempTableCount;
-@tempTableCount
-1
-1 Expected
-'#--------------------FN_DYNVARS_155_03-------------------------#'
-** Connecting con_int1 using root **
-** Connection con_int1 **
-SELECT @@SESSION.sql_big_tables;
-@@SESSION.sql_big_tables
-0
-0 / FALSE Expected;
-SET SESSION sql_big_tables = FALSE;
-** Connecting con_int2 using root **
-** Connection con_int2 **
-SELECT @@SESSION.sql_big_tables;
-@@SESSION.sql_big_tables
-0
-0 / FALSE Expected;
-SET SESSION sql_big_tables = TRUE;
-** Connection con_int1 **
-SELECT @@SESSION.sql_big_tables;
-@@SESSION.sql_big_tables
-0
-0 / FALSE Expected;
-** Connection con_int2 **
-SELECT @@SESSION.sql_big_tables;
-@@SESSION.sql_big_tables
-1
-1 / TRUE Expected;
-** Connection default **
-Disconnecting Connections con_int1, con_int2
-SET SESSION sql_big_tables = @old_big_tables;
-DROP TABLE t1;
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 16cda279c3e..60be1dc78a0 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff
@@ -1,272 +1,543 @@
-52c52
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-64c64
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-76c76
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-88c88
-< VARIABLE_TYPE BIGINT
----
-> VARIABLE_TYPE INT
-160c160
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-163c163
-< NUMERIC_MAX_VALUE 9223372036854775807
----
-> NUMERIC_MAX_VALUE 2147483647
-196c196
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-232c232
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-292c292
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-388c388
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-424c424
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-448c448
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-460c460
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-463c463
-< NUMERIC_MAX_VALUE 18446744073709551615
----
-> NUMERIC_MAX_VALUE 4294967295
-688c688
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-784c784
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-832c832
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-844c844
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-868c868
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-892c892
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-940c940
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-964c964
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-1000c1000
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-1012c1012
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-1024c1024
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-1036c1036
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-1039c1039
-< NUMERIC_MAX_VALUE 18446744073709551615
----
-> NUMERIC_MAX_VALUE 4294967295
-1060c1060
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-1072c1072
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-1096c1096
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-1120c1120
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-1123c1123
-< NUMERIC_MAX_VALUE 18446744073709551615
----
-> NUMERIC_MAX_VALUE 4294967295
-1130c1130
-< DEFAULT_VALUE 18446744073709551615
----
-> DEFAULT_VALUE 4294967295
-1132c1132
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-1135c1135
-< NUMERIC_MAX_VALUE 18446744073709551615
----
-> NUMERIC_MAX_VALUE 4294967295
-1192c1192
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-1204c1204
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-1207c1207
-< NUMERIC_MAX_VALUE 9223372036854775807
----
-> NUMERIC_MAX_VALUE 2147483647
-1252c1252
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-1300c1300
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-1312c1312
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-1315c1315
-< NUMERIC_MAX_VALUE 18446744073709551615
----
-> NUMERIC_MAX_VALUE 4294967295
-1360c1360
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-1363c1363
-< NUMERIC_MAX_VALUE 18446744073709551615
----
-> NUMERIC_MAX_VALUE 4294967295
-1372c1372
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-1492c1492
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-1495c1495
-< NUMERIC_MAX_VALUE 9223372036854775807
----
-> NUMERIC_MAX_VALUE 2147483647
-1516c1516
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-1540c1540
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-1552c1552
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-1588c1588
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-1600c1600
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-1612c1612
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-1636c1636
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-1648c1648
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-1672c1672
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-1675c1675
-< NUMERIC_MAX_VALUE 18446744073709551615
----
-> NUMERIC_MAX_VALUE 4294967295
-1696c1696
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-1708c1708
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-1756c1756
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-1936c1936
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-1960c1960
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-1963c1963
-< NUMERIC_MAX_VALUE 18446744073709551615
----
-> NUMERIC_MAX_VALUE 4294967295
-1996c1996
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-2008c2008
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-2068c2068
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-2092c2092
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
-2116c2116
-< VARIABLE_TYPE BIGINT UNSIGNED
----
-> VARIABLE_TYPE INT UNSIGNED
+--- sysvars_innodb.result
++++ sysvars_innodb,32bit.result
+@@ -49,7 +49,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 8
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Number of InnoDB Adaptive Hash Index Partitions (default 8)
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 512
+@@ -61,7 +61,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 150000
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT The upper limit of the sleep delay in usec. Value of 0 disables it.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 1000000
+@@ -73,7 +73,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 64
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Data file autoextend increment in megabytes
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 1000
+@@ -85,7 +85,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 1
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT
++VARIABLE_TYPE INT
+ VARIABLE_COMMENT The AUTOINC lock modes supported by InnoDB: 0 => Old style AUTOINC locking (for backward compatibility); 1 => New style AUTOINC locking; 2 => No AUTOINC locking (unsafe for SBR)
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 2
+@@ -157,10 +157,10 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 134217728
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Size of a single memory chunk within each buffer pool instance for resizing buffer pool. Online buffer pool resizing happens at this granularity. 0 means disable resizing buffer pool.
+ NUMERIC_MIN_VALUE 1048576
+-NUMERIC_MAX_VALUE 9223372036854775807
++NUMERIC_MAX_VALUE 2147483647
+ NUMERIC_BLOCK_SIZE 1048576
+ ENUM_VALUE_LIST NULL
+ READ_ONLY YES
+@@ -193,7 +193,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 25
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Dump only the hottest N% of each buffer pool, defaults to 25
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 100
+@@ -229,7 +229,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 0
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ 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
+@@ -289,7 +289,7 @@
+ SESSION_VALUE NULL
+ 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
+@@ -373,7 +373,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 0
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Helps in performance tuning in heavily concurrent environments.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 1000
+@@ -409,7 +409,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 5
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ 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
+@@ -433,7 +433,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 50
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ 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
+@@ -445,10 +445,10 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 5000
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Number of times a thread is allowed to enter InnoDB within the same SQL query after it has once got the ticket
+ NUMERIC_MIN_VALUE 1
+-NUMERIC_MAX_VALUE 18446744073709551615
++NUMERIC_MAX_VALUE 4294967295
+ NUMERIC_BLOCK_SIZE 0
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+@@ -673,7 +673,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 120
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Number of pages reserved in doublewrite buffer for batch flushing
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 127
+@@ -769,7 +769,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 600
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Maximum number of seconds that semaphore times out in InnoDB.
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 4294967295
+@@ -817,7 +817,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 0
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Make the first page of the given tablespace dirty.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 4294967295
+@@ -829,7 +829,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 30
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Number of iterations over which the background flushing is averaged.
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 1000
+@@ -853,7 +853,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 1
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT 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
+ NUMERIC_MAX_VALUE 3
+@@ -877,7 +877,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 1
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ 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
+@@ -925,7 +925,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 0
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Helps to save your data in case the disk image of the database becomes corrupt. Value 5 can return bogus data, and 6 can permanently corrupt data.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 6
+@@ -949,7 +949,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 8000000
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT InnoDB Fulltext search cache size in bytes
+ NUMERIC_MIN_VALUE 1600000
+ NUMERIC_MAX_VALUE 80000000
+@@ -985,7 +985,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 84
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT InnoDB Fulltext search maximum token size in characters
+ NUMERIC_MIN_VALUE 10
+ NUMERIC_MAX_VALUE 84
+@@ -997,7 +997,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 3
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT InnoDB Fulltext search minimum token size in characters
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 16
+@@ -1009,7 +1009,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 2000
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT InnoDB Fulltext search number of words to optimize for each optimize table call
+ NUMERIC_MIN_VALUE 1000
+ NUMERIC_MAX_VALUE 10000
+@@ -1021,10 +1021,10 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 2000000000
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT InnoDB Fulltext search query result cache limit in bytes
+ NUMERIC_MIN_VALUE 1000000
+-NUMERIC_MAX_VALUE 18446744073709551615
++NUMERIC_MAX_VALUE 4294967295
+ NUMERIC_BLOCK_SIZE 0
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+@@ -1045,7 +1045,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 2
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ 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
+@@ -1057,7 +1057,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 640000000
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Total memory allocated for InnoDB Fulltext Search cache
+ NUMERIC_MIN_VALUE 32000000
+ NUMERIC_MAX_VALUE 1600000000
+@@ -1081,7 +1081,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 100
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ 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
+@@ -1105,22 +1105,22 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 200
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Number of IOPs the server can do. Tunes the background IO rate
+ NUMERIC_MIN_VALUE 100
+-NUMERIC_MAX_VALUE 18446744073709551615
++NUMERIC_MAX_VALUE 4294967295
+ NUMERIC_BLOCK_SIZE 0
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME INNODB_IO_CAPACITY_MAX
+ SESSION_VALUE NULL
+-DEFAULT_VALUE 18446744073709551615
++DEFAULT_VALUE 4294967295
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Limit to which innodb_io_capacity can be inflated.
+ NUMERIC_MIN_VALUE 100
+-NUMERIC_MAX_VALUE 18446744073709551615
++NUMERIC_MAX_VALUE 4294967295
+ NUMERIC_BLOCK_SIZE 0
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+@@ -1165,7 +1165,7 @@
+ SESSION_VALUE 50
+ DEFAULT_VALUE 50
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ 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 0
+ NUMERIC_MAX_VALUE 1073741824
+@@ -1177,10 +1177,10 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 16777216
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT The size of the buffer which InnoDB uses to write log to the log files on disk.
+ NUMERIC_MIN_VALUE 262144
+-NUMERIC_MAX_VALUE 9223372036854775807
++NUMERIC_MAX_VALUE 2147483647
+ NUMERIC_BLOCK_SIZE 1024
+ ENUM_VALUE_LIST NULL
+ READ_ONLY YES
+@@ -1225,7 +1225,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 2
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Number of log files in the log group. InnoDB writes to the files in a circular fashion.
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 100
+@@ -1273,7 +1273,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 8192
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Redo log write ahead unit size to avoid read-on-write, it should match the OS cache block IO size
+ NUMERIC_MIN_VALUE 512
+ NUMERIC_MAX_VALUE 16384
+@@ -1285,10 +1285,10 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 1024
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT How deep to scan LRU to keep it clean
+ NUMERIC_MIN_VALUE 100
+-NUMERIC_MAX_VALUE 18446744073709551615
++NUMERIC_MAX_VALUE 4294967295
+ NUMERIC_BLOCK_SIZE 0
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+@@ -1333,10 +1333,10 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 0
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Desired maximum length of the purge queue (0 = no limit)
+ NUMERIC_MIN_VALUE 0
+-NUMERIC_MAX_VALUE 18446744073709551615
++NUMERIC_MAX_VALUE 4294967295
+ NUMERIC_BLOCK_SIZE 0
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+@@ -1345,7 +1345,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 0
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Maximum delay of user threads in micro-seconds
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 10000000
+@@ -1465,10 +1465,10 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 0
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT How many files at the maximum InnoDB keeps open at the same time.
+ NUMERIC_MIN_VALUE 0
+-NUMERIC_MAX_VALUE 9223372036854775807
++NUMERIC_MAX_VALUE 2147483647
+ NUMERIC_BLOCK_SIZE 0
+ ENUM_VALUE_LIST NULL
+ READ_ONLY YES
+@@ -1489,7 +1489,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 4
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Page cleaner threads can be from 1 to 64. Default is 4.
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 64
+@@ -1513,7 +1513,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 16
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ 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
+@@ -1525,7 +1525,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 16384
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Page size to use for all InnoDB tablespaces.
+ NUMERIC_MIN_VALUE 4096
+ NUMERIC_MAX_VALUE 65536
+@@ -1561,7 +1561,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 300
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Number of UNDO log pages to purge in one batch from the history list.
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 5000
+@@ -1573,7 +1573,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 128
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Dictates rate at which UNDO records are purged. Value N means purge rollback segment(s) on every Nth iteration of purge invocation
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 128
+@@ -1585,7 +1585,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 4
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Purge threads can be from 1 to 32. Default is 4.
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 32
+@@ -1609,7 +1609,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 56
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Number of pages that must be accessed sequentially for InnoDB to trigger a readahead.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 64
+@@ -1621,7 +1621,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 4
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Number of background read I/O threads in InnoDB.
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 64
+@@ -1645,10 +1645,10 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 0
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Replication thread delay (ms) on the slave server if innodb_thread_concurrency is reached (0 by default)
+ NUMERIC_MIN_VALUE 0
+-NUMERIC_MAX_VALUE 18446744073709551615
++NUMERIC_MAX_VALUE 4294967295
+ NUMERIC_BLOCK_SIZE 0
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+@@ -1669,7 +1669,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 0
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT An InnoDB page number.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 4294967295
+@@ -1717,7 +1717,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 1048576
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Memory buffer size for index creation
+ NUMERIC_MIN_VALUE 65536
+ NUMERIC_MAX_VALUE 67108864
+@@ -1885,7 +1885,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 1
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Size of the mutex/lock wait array.
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 1024
+@@ -1909,10 +1909,10 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 30
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Count of spin-loop rounds in InnoDB mutexes (30 by default)
+ NUMERIC_MIN_VALUE 0
+-NUMERIC_MAX_VALUE 18446744073709551615
++NUMERIC_MAX_VALUE 4294967295
+ NUMERIC_BLOCK_SIZE 0
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+@@ -1945,7 +1945,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 0
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ 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
+@@ -1957,7 +1957,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 10000
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ 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
+@@ -2017,7 +2017,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 128
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Deprecated parameter with no effect.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 128
+@@ -2041,7 +2041,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 0
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Number of undo tablespaces to use.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 127
+@@ -2065,7 +2065,7 @@
+ SESSION_VALUE NULL
+ DEFAULT_VALUE 4
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Number of background write I/O threads in InnoDB.
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 64
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
index 9c1d121ede6..335be38b6e6 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
@@ -345,21 +345,9 @@ NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
-VARIABLE_NAME INNODB_CHECKSUMS
-SESSION_VALUE NULL
-DEFAULT_VALUE ON
-VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BOOLEAN
-VARIABLE_COMMENT DEPRECATED. Use innodb_checksum_algorithm=NONE instead of setting this to OFF. Enable InnoDB checksums validation (enabled by default). Disable with --skip-innodb-checksums.
-NUMERIC_MIN_VALUE NULL
-NUMERIC_MAX_VALUE NULL
-NUMERIC_BLOCK_SIZE NULL
-ENUM_VALUE_LIST OFF,ON
-READ_ONLY YES
-COMMAND_LINE_ARGUMENT NONE
VARIABLE_NAME INNODB_CHECKSUM_ALGORITHM
SESSION_VALUE NULL
-DEFAULT_VALUE crc32
+DEFAULT_VALUE full_crc32
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE ENUM
VARIABLE_COMMENT The algorithm InnoDB uses for page checksumming. Possible values are FULL_CRC32 for new files, always use CRC-32C; for old, see CRC32 below; STRICT_FULL_CRC32 for new files, always use CRC-32C; for old, see STRICT_CRC32 below; CRC32 write crc32, allow any of the other checksums to match when reading; STRICT_CRC32 write crc32, do not allow other algorithms to match when reading; INNODB write a software calculated checksum, allow any other checksums to match when reading; STRICT_INNODB write a software calculated checksum, do not allow other algorithms to match when reading; NONE write a constant magic number, do not do any checksum verification when reading (same as innodb_checksums=OFF); STRICT_NONE write a constant magic number, do not allow values other than that magic number when reading; Files updated when this option is set to crc32 or strict_crc32 will not be readable by MariaDB versions older than 10.0.4; new files created with full_crc32 are readable by MariaDB 10.4.3+
@@ -645,18 +633,6 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
-VARIABLE_NAME INNODB_DISABLE_BACKGROUND_MERGE
-SESSION_VALUE NULL
-DEFAULT_VALUE OFF
-VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BOOLEAN
-VARIABLE_COMMENT Disable change buffering merges by the master thread
-NUMERIC_MIN_VALUE NULL
-NUMERIC_MAX_VALUE NULL
-NUMERIC_BLOCK_SIZE NULL
-ENUM_VALUE_LIST OFF,ON
-READ_ONLY NO
-COMMAND_LINE_ARGUMENT NONE
VARIABLE_NAME INNODB_DISABLE_RESIZE_BUFFER_POOL_DEBUG
SESSION_VALUE NULL
DEFAULT_VALUE ON
@@ -950,7 +926,7 @@ SESSION_VALUE NULL
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
-VARIABLE_COMMENT Helps to save your data in case the disk image of the database becomes corrupt.
+VARIABLE_COMMENT Helps to save your data in case the disk image of the database becomes corrupt. Value 5 can return bogus data, and 6 can permanently corrupt data.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 6
NUMERIC_BLOCK_SIZE 0
@@ -1173,18 +1149,6 @@ NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
-VARIABLE_NAME INNODB_LOCKS_UNSAFE_FOR_BINLOG
-SESSION_VALUE NULL
-DEFAULT_VALUE OFF
-VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BOOLEAN
-VARIABLE_COMMENT DEPRECATED. This option may be removed in future releases. Please use READ COMMITTED transaction isolation level instead. Force InnoDB to not use next-key locking, to use only row-level locking.
-NUMERIC_MIN_VALUE NULL
-NUMERIC_MAX_VALUE NULL
-NUMERIC_BLOCK_SIZE NULL
-ENUM_VALUE_LIST OFF,ON
-READ_ONLY YES
-COMMAND_LINE_ARGUMENT NONE
VARIABLE_NAME INNODB_LOCK_SCHEDULE_ALGORITHM
SESSION_VALUE NULL
DEFAULT_VALUE fcfs
@@ -1238,7 +1202,7 @@ SESSION_VALUE NULL
DEFAULT_VALUE ON
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN
-VARIABLE_COMMENT Whether to compute and require checksums for InnoDB redo log blocks
+VARIABLE_COMMENT Deprecated parameter with no effect.
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
@@ -1701,18 +1665,6 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY YES
COMMAND_LINE_ARGUMENT OPTIONAL
-VARIABLE_NAME INNODB_ROLLBACK_SEGMENTS
-SESSION_VALUE NULL
-DEFAULT_VALUE 128
-VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
-VARIABLE_COMMENT Number of undo logs to use (deprecated).
-NUMERIC_MIN_VALUE 1
-NUMERIC_MAX_VALUE 128
-NUMERIC_BLOCK_SIZE 0
-ENUM_VALUE_LIST NULL
-READ_ONLY NO
-COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME INNODB_SAVED_PAGE_NUMBER_DEBUG
SESSION_VALUE NULL
DEFAULT_VALUE 0
@@ -1869,18 +1821,6 @@ NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
-VARIABLE_NAME INNODB_STATS_SAMPLE_PAGES
-SESSION_VALUE NULL
-DEFAULT_VALUE 8
-VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
-VARIABLE_COMMENT Deprecated, use innodb_stats_transient_sample_pages instead
-NUMERIC_MIN_VALUE 1
-NUMERIC_MAX_VALUE 18446744073709551615
-NUMERIC_BLOCK_SIZE 0
-ENUM_VALUE_LIST NULL
-READ_ONLY NO
-COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME INNODB_STATS_TRADITIONAL
SESSION_VALUE NULL
DEFAULT_VALUE ON
@@ -2078,8 +2018,8 @@ SESSION_VALUE NULL
DEFAULT_VALUE 128
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
-VARIABLE_COMMENT Number of undo logs to use.
-NUMERIC_MIN_VALUE 1
+VARIABLE_COMMENT Deprecated parameter with no effect.
+NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 128
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
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 9ec15d3079a..02c4c717f6f 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,6 +1,6 @@
---- sysvars_server_embedded.result
-+++ sysvars_server_embedded.result
-@@ -34,7 +34,7 @@ READ_ONLY NO
+--- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
++++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
+@@ -35,7 +35,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME ARIA_BLOCK_SIZE
VARIABLE_SCOPE GLOBAL
@@ -9,7 +9,7 @@
VARIABLE_COMMENT Block size to be used for Aria index pages.
NUMERIC_MIN_VALUE 4096
NUMERIC_MAX_VALUE 32768
-@@ -44,7 +44,7 @@ READ_ONLY YES
+@@ -45,7 +45,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME ARIA_CHECKPOINT_INTERVAL
VARIABLE_SCOPE GLOBAL
@@ -18,7 +18,7 @@
VARIABLE_COMMENT Interval between tries to do an automatic checkpoints. In seconds; 0 means 'no automatic checkpoints' which makes sense only for testing.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -54,7 +54,7 @@ READ_ONLY NO
+@@ -55,7 +55,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME ARIA_CHECKPOINT_LOG_ACTIVITY
VARIABLE_SCOPE GLOBAL
@@ -27,7 +27,7 @@
VARIABLE_COMMENT Number of bytes that the transaction log has to grow between checkpoints before a new checkpoint is written to the log.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -74,7 +74,7 @@ READ_ONLY NO
+@@ -75,7 +75,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME ARIA_FORCE_START_AFTER_RECOVERY_FAILURES
VARIABLE_SCOPE GLOBAL
@@ -36,7 +36,7 @@
VARIABLE_COMMENT Number of consecutive log recovery failures after which logs will be automatically deleted to cure the problem; 0 (the default) disables the feature.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 255
-@@ -94,7 +94,7 @@ READ_ONLY NO
+@@ -95,7 +95,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME ARIA_GROUP_COMMIT_INTERVAL
VARIABLE_SCOPE GLOBAL
@@ -45,7 +45,7 @@
VARIABLE_COMMENT Interval between commite in microseconds (1/1000000c). 0 stands for no waiting for other threads to come and do a commit in "hard" mode and no sync()/commit at all in "soft" mode. Option has only an effect if aria_group_commit is used
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -104,7 +104,7 @@ READ_ONLY NO
+@@ -105,7 +105,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME ARIA_LOG_FILE_SIZE
VARIABLE_SCOPE GLOBAL
@@ -54,7 +54,7 @@
VARIABLE_COMMENT Limit for transaction log size
NUMERIC_MIN_VALUE 8388608
NUMERIC_MAX_VALUE 4294967295
-@@ -134,10 +134,10 @@ READ_ONLY NO
+@@ -135,10 +135,10 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME ARIA_PAGECACHE_AGE_THRESHOLD
VARIABLE_SCOPE GLOBAL
@@ -67,7 +67,7 @@
NUMERIC_BLOCK_SIZE 100
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -154,7 +154,7 @@ READ_ONLY YES
+@@ -155,7 +155,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME ARIA_PAGECACHE_DIVISION_LIMIT
VARIABLE_SCOPE GLOBAL
@@ -76,7 +76,7 @@
VARIABLE_COMMENT The minimum percentage of warm blocks in key cache
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 100
-@@ -164,7 +164,7 @@ READ_ONLY NO
+@@ -165,7 +165,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME ARIA_PAGECACHE_FILE_HASH_SIZE
VARIABLE_SCOPE GLOBAL
@@ -85,7 +85,7 @@
VARIABLE_COMMENT Number of hash buckets for open and changed files. If you have a lot of Aria files open you should increase this for faster flush of changes. A good value is probably 1/10 of number of possible open Aria files.
NUMERIC_MIN_VALUE 128
NUMERIC_MAX_VALUE 16384
-@@ -194,7 +194,7 @@ READ_ONLY NO
+@@ -195,7 +195,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME ARIA_REPAIR_THREADS
VARIABLE_SCOPE SESSION
@@ -94,7 +94,7 @@
VARIABLE_COMMENT Number of threads to use when repairing Aria tables. The value of 1 disables parallel repair.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 128
-@@ -207,7 +207,7 @@ VARIABLE_SCOPE SESSION
+@@ -208,7 +208,7 @@ VARIABLE_SCOPE SESSION
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
@@ -103,7 +103,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -264,7 +264,7 @@ READ_ONLY NO
+@@ -265,7 +265,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME AUTO_INCREMENT_INCREMENT
VARIABLE_SCOPE SESSION
@@ -112,7 +112,7 @@
VARIABLE_COMMENT Auto-increment columns are incremented by this
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 65535
-@@ -274,7 +274,7 @@ READ_ONLY NO
+@@ -275,7 +275,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME AUTO_INCREMENT_OFFSET
VARIABLE_SCOPE SESSION
@@ -121,7 +121,7 @@
VARIABLE_COMMENT Offset added to Auto-increment columns. Used when auto-increment-increment != 1
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 65535
-@@ -284,7 +284,7 @@ READ_ONLY NO
+@@ -285,7 +285,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME BACK_LOG
VARIABLE_SCOPE GLOBAL
@@ -130,7 +130,7 @@
VARIABLE_COMMENT The number of outstanding connection requests MariaDB can have. This comes into play when the main MariaDB thread gets very many connection requests in a very short time
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 65535
-@@ -337,7 +337,7 @@ VARIABLE_SCOPE GLOBAL
+@@ -338,7 +338,7 @@ VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The size of the transactional cache for updates to transactional engines for the binary log. If you often use transactions containing many statements, you can increase this to get more performance
NUMERIC_MIN_VALUE 4096
@@ -139,7 +139,7 @@
NUMERIC_BLOCK_SIZE 4096
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -354,20 +354,20 @@ READ_ONLY NO
+@@ -355,20 +355,20 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME BINLOG_COMMIT_WAIT_COUNT
VARIABLE_SCOPE GLOBAL
@@ -164,7 +164,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -387,7 +387,7 @@ VARIABLE_SCOPE GLOBAL
+@@ -388,7 +388,7 @@ VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The size of file cache for the binary log
NUMERIC_MIN_VALUE 8192
@@ -173,7 +173,7 @@
NUMERIC_BLOCK_SIZE 4096
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -427,7 +427,7 @@ VARIABLE_SCOPE GLOBAL
+@@ -438,7 +438,7 @@ VARIABLE_SCOPE GLOBAL
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
@@ -182,7 +182,7 @@
NUMERIC_BLOCK_SIZE 4096
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -437,7 +437,7 @@ VARIABLE_SCOPE SESSION
+@@ -448,7 +448,7 @@ VARIABLE_SCOPE SESSION
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
@@ -191,7 +191,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -624,7 +624,7 @@ READ_ONLY NO
+@@ -635,7 +635,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME CONNECT_TIMEOUT
VARIABLE_SCOPE GLOBAL
@@ -200,7 +200,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
-@@ -674,7 +674,7 @@ READ_ONLY YES
+@@ -685,7 +685,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME DEADLOCK_SEARCH_DEPTH_LONG
VARIABLE_SCOPE SESSION
@@ -209,7 +209,7 @@
VARIABLE_COMMENT Long search depth for the two-step deadlock detection
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 33
-@@ -684,7 +684,7 @@ READ_ONLY NO
+@@ -695,7 +695,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME DEADLOCK_SEARCH_DEPTH_SHORT
VARIABLE_SCOPE SESSION
@@ -218,7 +218,7 @@
VARIABLE_COMMENT Short search depth for the two-step deadlock detection
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 32
-@@ -694,7 +694,7 @@ READ_ONLY NO
+@@ -705,7 +705,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME DEADLOCK_TIMEOUT_LONG
VARIABLE_SCOPE SESSION
@@ -227,7 +227,7 @@
VARIABLE_COMMENT Long timeout for the two-step deadlock detection (in microseconds)
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -704,7 +704,7 @@ READ_ONLY NO
+@@ -715,7 +715,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME DEADLOCK_TIMEOUT_SHORT
VARIABLE_SCOPE SESSION
@@ -236,7 +236,7 @@
VARIABLE_COMMENT Short timeout for the two-step deadlock detection (in microseconds)
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -754,7 +754,7 @@ READ_ONLY NO
+@@ -765,7 +765,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME DEFAULT_WEEK_FORMAT
VARIABLE_SCOPE SESSION
@@ -245,7 +245,7 @@
VARIABLE_COMMENT The default week format used by WEEK() functions
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 7
-@@ -764,7 +764,7 @@ READ_ONLY NO
+@@ -775,7 +775,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME DELAYED_INSERT_LIMIT
VARIABLE_SCOPE GLOBAL
@@ -254,7 +254,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
-@@ -774,7 +774,7 @@ READ_ONLY NO
+@@ -785,7 +785,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME DELAYED_INSERT_TIMEOUT
VARIABLE_SCOPE GLOBAL
@@ -263,7 +263,7 @@
VARIABLE_COMMENT How long a INSERT DELAYED thread should wait for INSERT statements before terminating
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 31536000
-@@ -784,7 +784,7 @@ READ_ONLY NO
+@@ -795,7 +795,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME DELAYED_QUEUE_SIZE
VARIABLE_SCOPE GLOBAL
@@ -272,7 +272,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
-@@ -814,7 +814,7 @@ READ_ONLY NO
+@@ -825,7 +825,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME DIV_PRECISION_INCREMENT
VARIABLE_SCOPE SESSION
@@ -281,7 +281,7 @@
VARIABLE_COMMENT Precision of the result of '/' operator will be increased on that value
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 38
-@@ -894,7 +894,7 @@ READ_ONLY NO
+@@ -905,7 +905,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME EXPIRE_LOGS_DAYS
VARIABLE_SCOPE GLOBAL
@@ -290,7 +290,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
-@@ -924,7 +924,7 @@ READ_ONLY YES
+@@ -935,7 +935,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME EXTRA_MAX_CONNECTIONS
VARIABLE_SCOPE GLOBAL
@@ -299,7 +299,7 @@
VARIABLE_COMMENT The number of connections on extra-port
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 100000
-@@ -954,7 +954,7 @@ READ_ONLY NO
+@@ -965,7 +965,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME FLUSH_TIME
VARIABLE_SCOPE GLOBAL
@@ -308,7 +308,7 @@
VARIABLE_COMMENT A dedicated thread is created to flush all tables at the given interval
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 31536000
-@@ -984,7 +984,7 @@ READ_ONLY NO
+@@ -995,7 +995,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME FT_MAX_WORD_LEN
VARIABLE_SCOPE GLOBAL
@@ -317,7 +317,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
-@@ -994,7 +994,7 @@ READ_ONLY YES
+@@ -1005,7 +1005,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME FT_MIN_WORD_LEN
VARIABLE_SCOPE GLOBAL
@@ -326,7 +326,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
-@@ -1004,7 +1004,7 @@ READ_ONLY YES
+@@ -1015,7 +1015,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME FT_QUERY_EXPANSION_LIMIT
VARIABLE_SCOPE GLOBAL
@@ -335,7 +335,7 @@
VARIABLE_COMMENT Number of best matches to use for query expansion
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1000
-@@ -1047,7 +1047,7 @@ VARIABLE_SCOPE SESSION
+@@ -1058,7 +1058,7 @@ VARIABLE_SCOPE SESSION
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The maximum length of the result of function GROUP_CONCAT()
NUMERIC_MIN_VALUE 4
@@ -344,7 +344,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -1174,7 +1174,7 @@ READ_ONLY YES
+@@ -1185,7 +1185,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME HISTOGRAM_SIZE
VARIABLE_SCOPE SESSION
@@ -353,7 +353,7 @@
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
-@@ -1204,7 +1204,7 @@ READ_ONLY YES
+@@ -1215,7 +1215,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME HOST_CACHE_SIZE
VARIABLE_SCOPE GLOBAL
@@ -362,7 +362,7 @@
VARIABLE_COMMENT How many host names should be cached to avoid resolving.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 65536
-@@ -1314,7 +1314,7 @@ READ_ONLY NO
+@@ -1325,7 +1325,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME INTERACTIVE_TIMEOUT
VARIABLE_SCOPE SESSION
@@ -371,7 +371,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
-@@ -1347,7 +1347,7 @@ VARIABLE_SCOPE SESSION
+@@ -1358,7 +1358,7 @@ VARIABLE_SCOPE SESSION
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The size of the buffer that is used for joins
NUMERIC_MIN_VALUE 128
@@ -380,7 +380,7 @@
NUMERIC_BLOCK_SIZE 128
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -1364,7 +1364,7 @@ READ_ONLY NO
+@@ -1375,7 +1375,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME JOIN_CACHE_LEVEL
VARIABLE_SCOPE SESSION
@@ -389,7 +389,7 @@
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
-@@ -1387,7 +1387,7 @@ VARIABLE_SCOPE GLOBAL
+@@ -1398,7 +1398,7 @@ 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 0
@@ -398,7 +398,7 @@
NUMERIC_BLOCK_SIZE 4096
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -1544,7 +1544,7 @@ READ_ONLY YES
+@@ -1555,7 +1555,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME LOCK_WAIT_TIMEOUT
VARIABLE_SCOPE SESSION
@@ -407,7 +407,7 @@
VARIABLE_COMMENT Timeout in seconds to wait for a lock before returning an error.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 31536000
-@@ -1664,7 +1664,7 @@ READ_ONLY NO
+@@ -1675,7 +1675,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME LOG_SLOW_RATE_LIMIT
VARIABLE_SCOPE SESSION
@@ -416,7 +416,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
-@@ -1694,7 +1694,7 @@ READ_ONLY NO
+@@ -1705,7 +1705,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME LOG_WARNINGS
VARIABLE_SCOPE SESSION
@@ -425,7 +425,7 @@
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
-@@ -1744,7 +1744,7 @@ READ_ONLY NO
+@@ -1755,7 +1755,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME MAX_ALLOWED_PACKET
VARIABLE_SCOPE SESSION
@@ -434,7 +434,7 @@
VARIABLE_COMMENT Max packet length to send to or receive from the server
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 1073741824
-@@ -1757,14 +1757,14 @@ VARIABLE_SCOPE GLOBAL
+@@ -1768,14 +1768,14 @@ VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Sets the total size of the transactional cache
NUMERIC_MIN_VALUE 4096
@@ -451,7 +451,7 @@
VARIABLE_COMMENT Binary log will be rotated automatically when the size exceeds this value.
NUMERIC_MIN_VALUE 4096
NUMERIC_MAX_VALUE 1073741824
-@@ -1777,14 +1777,14 @@ VARIABLE_SCOPE GLOBAL
+@@ -1788,14 +1788,14 @@ VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Sets the total size of the statement cache
NUMERIC_MIN_VALUE 4096
@@ -468,7 +468,7 @@
VARIABLE_COMMENT The number of simultaneous clients allowed
NUMERIC_MIN_VALUE 10
NUMERIC_MAX_VALUE 100000
-@@ -1794,7 +1794,7 @@ READ_ONLY NO
+@@ -1805,7 +1805,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MAX_CONNECT_ERRORS
VARIABLE_SCOPE GLOBAL
@@ -477,7 +477,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
-@@ -1804,7 +1804,7 @@ READ_ONLY NO
+@@ -1815,7 +1815,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MAX_DELAYED_THREADS
VARIABLE_SCOPE SESSION
@@ -486,7 +486,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
-@@ -1824,7 +1824,7 @@ READ_ONLY YES
+@@ -1835,7 +1835,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MAX_ERROR_COUNT
VARIABLE_SCOPE SESSION
@@ -495,7 +495,7 @@
VARIABLE_COMMENT Max number of errors/warnings to store for a statement
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 65535
-@@ -1837,14 +1837,14 @@ VARIABLE_SCOPE SESSION
+@@ -1848,14 +1848,14 @@ VARIABLE_SCOPE SESSION
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Don't allow creation of heap tables bigger than this
NUMERIC_MIN_VALUE 16384
@@ -512,7 +512,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
-@@ -1864,7 +1864,7 @@ READ_ONLY NO
+@@ -1875,7 +1875,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MAX_LENGTH_FOR_SORT_DATA
VARIABLE_SCOPE SESSION
@@ -521,16 +521,7 @@
VARIABLE_COMMENT Max number of bytes in sorted records
NUMERIC_MIN_VALUE 4
NUMERIC_MAX_VALUE 8388608
-@@ -1874,7 +1874,7 @@ READ_ONLY NO
- COMMAND_LINE_ARGUMENT REQUIRED
- VARIABLE_NAME MAX_LONG_DATA_SIZE
- VARIABLE_SCOPE GLOBAL
--VARIABLE_TYPE BIGINT UNSIGNED
-+VARIABLE_TYPE INT UNSIGNED
- 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
-@@ -1904,7 +1904,7 @@ READ_ONLY NO
+@@ -1905,7 +1905,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MAX_RECURSIVE_ITERATIONS
VARIABLE_SCOPE SESSION
@@ -539,7 +530,7 @@
VARIABLE_COMMENT Maximum number of iterations when executing recursive queries
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -1917,14 +1917,14 @@ VARIABLE_SCOPE SESSION
+@@ -1918,14 +1918,14 @@ VARIABLE_SCOPE SESSION
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The maximum size of the container of a rowid filter
NUMERIC_MIN_VALUE 1024
@@ -556,7 +547,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
-@@ -1944,7 +1944,7 @@ READ_ONLY NO
+@@ -1945,7 +1945,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MAX_SORT_LENGTH
VARIABLE_SCOPE SESSION
@@ -565,7 +556,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
-@@ -1954,7 +1954,7 @@ READ_ONLY NO
+@@ -1955,7 +1955,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MAX_SP_RECURSION_DEPTH
VARIABLE_SCOPE SESSION
@@ -574,7 +565,7 @@
VARIABLE_COMMENT Maximum stored procedure recursion depth
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 255
-@@ -1974,7 +1974,7 @@ READ_ONLY NO
+@@ -1975,7 +1975,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MAX_TMP_TABLES
VARIABLE_SCOPE SESSION
@@ -583,7 +574,7 @@
VARIABLE_COMMENT Unused, will be removed.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 4294967295
-@@ -1994,7 +1994,7 @@ READ_ONLY NO
+@@ -1995,7 +1995,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MAX_WRITE_LOCK_COUNT
VARIABLE_SCOPE GLOBAL
@@ -592,7 +583,7 @@
VARIABLE_COMMENT After this many write locks, allow some read locks to run in between
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 4294967295
-@@ -2004,7 +2004,7 @@ READ_ONLY NO
+@@ -2005,7 +2005,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME METADATA_LOCKS_CACHE_SIZE
VARIABLE_SCOPE GLOBAL
@@ -601,7 +592,7 @@
VARIABLE_COMMENT Unused
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 1048576
-@@ -2014,7 +2014,7 @@ READ_ONLY YES
+@@ -2015,7 +2015,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME METADATA_LOCKS_HASH_INSTANCES
VARIABLE_SCOPE GLOBAL
@@ -610,7 +601,7 @@
VARIABLE_COMMENT Unused
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 1024
-@@ -2024,7 +2024,7 @@ READ_ONLY YES
+@@ -2025,7 +2025,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MIN_EXAMINED_ROW_LIMIT
VARIABLE_SCOPE SESSION
@@ -619,7 +610,7 @@
VARIABLE_COMMENT Don't write queries to slow log that examine fewer rows than that
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -2034,7 +2034,7 @@ READ_ONLY NO
+@@ -2035,7 +2035,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MRR_BUFFER_SIZE
VARIABLE_SCOPE SESSION
@@ -628,7 +619,7 @@
VARIABLE_COMMENT Size of buffer to use when using MRR with range access
NUMERIC_MIN_VALUE 8192
NUMERIC_MAX_VALUE 2147483647
-@@ -2044,17 +2044,17 @@ READ_ONLY NO
+@@ -2045,17 +2045,17 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MULTI_RANGE_COUNT
VARIABLE_SCOPE SESSION
@@ -649,7 +640,7 @@
VARIABLE_COMMENT Block size to be used for MyISAM index pages
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 16384
-@@ -2064,7 +2064,7 @@ READ_ONLY YES
+@@ -2065,7 +2065,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MYISAM_DATA_POINTER_SIZE
VARIABLE_SCOPE GLOBAL
@@ -658,7 +649,7 @@
VARIABLE_COMMENT Default pointer size to be used for MyISAM tables
NUMERIC_MIN_VALUE 2
NUMERIC_MAX_VALUE 7
-@@ -2087,7 +2087,7 @@ VARIABLE_SCOPE GLOBAL
+@@ -2088,7 +2088,7 @@ VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Restricts the total memory used for memory mapping of MySQL tables
NUMERIC_MIN_VALUE 7
@@ -667,7 +658,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY YES
-@@ -2104,10 +2104,10 @@ READ_ONLY YES
+@@ -2105,10 +2105,10 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME MYISAM_REPAIR_THREADS
VARIABLE_SCOPE SESSION
@@ -680,7 +671,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -2117,7 +2117,7 @@ VARIABLE_SCOPE SESSION
+@@ -2118,7 +2118,7 @@ VARIABLE_SCOPE SESSION
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
@@ -689,7 +680,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -2154,7 +2154,7 @@ READ_ONLY NO
+@@ -2155,7 +2155,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME NET_BUFFER_LENGTH
VARIABLE_SCOPE SESSION
@@ -698,7 +689,7 @@
VARIABLE_COMMENT Buffer length for TCP/IP and socket communication
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 1048576
-@@ -2164,7 +2164,7 @@ READ_ONLY NO
+@@ -2165,7 +2165,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME NET_READ_TIMEOUT
VARIABLE_SCOPE SESSION
@@ -707,7 +698,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
-@@ -2174,7 +2174,7 @@ READ_ONLY NO
+@@ -2175,7 +2175,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME NET_RETRY_COUNT
VARIABLE_SCOPE SESSION
@@ -716,7 +707,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
-@@ -2184,7 +2184,7 @@ READ_ONLY NO
+@@ -2185,7 +2185,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME NET_WRITE_TIMEOUT
VARIABLE_SCOPE SESSION
@@ -725,7 +716,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
-@@ -2234,7 +2234,7 @@ READ_ONLY NO
+@@ -2235,7 +2235,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME OPEN_FILES_LIMIT
VARIABLE_SCOPE GLOBAL
@@ -734,7 +725,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 or autoset 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
-@@ -2244,7 +2244,7 @@ READ_ONLY YES
+@@ -2245,7 +2245,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME OPTIMIZER_PRUNE_LEVEL
VARIABLE_SCOPE SESSION
@@ -743,7 +734,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
-@@ -2254,7 +2254,7 @@ READ_ONLY NO
+@@ -2255,7 +2255,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME OPTIMIZER_SEARCH_DEPTH
VARIABLE_SCOPE SESSION
@@ -752,7 +743,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.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 62
-@@ -2264,7 +2264,7 @@ READ_ONLY NO
+@@ -2265,7 +2265,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME OPTIMIZER_SELECTIVITY_SAMPLING_LIMIT
VARIABLE_SCOPE SESSION
@@ -761,7 +752,7 @@
VARIABLE_COMMENT Controls number of record samples to check condition selectivity
NUMERIC_MIN_VALUE 10
NUMERIC_MAX_VALUE 4294967295
-@@ -2294,17 +2294,17 @@ READ_ONLY NO
+@@ -2295,17 +2295,17 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME OPTIMIZER_TRACE_MAX_MEM_SIZE
VARIABLE_SCOPE SESSION
@@ -782,7 +773,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
-@@ -2324,7 +2324,7 @@ READ_ONLY YES
+@@ -2325,7 +2325,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME PERFORMANCE_SCHEMA_ACCOUNTS_SIZE
VARIABLE_SCOPE GLOBAL
@@ -791,7 +782,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
-@@ -2334,7 +2334,7 @@ READ_ONLY YES
+@@ -2335,7 +2335,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_DIGESTS_SIZE
VARIABLE_SCOPE GLOBAL
@@ -800,7 +791,7 @@
VARIABLE_COMMENT Size of the statement digest. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 200
-@@ -2344,7 +2344,7 @@ READ_ONLY YES
+@@ -2345,7 +2345,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_STAGES_HISTORY_LONG_SIZE
VARIABLE_SCOPE GLOBAL
@@ -809,7 +800,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
-@@ -2354,7 +2354,7 @@ READ_ONLY YES
+@@ -2355,7 +2355,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_STAGES_HISTORY_SIZE
VARIABLE_SCOPE GLOBAL
@@ -818,7 +809,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
-@@ -2364,7 +2364,7 @@ READ_ONLY YES
+@@ -2365,7 +2365,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_STATEMENTS_HISTORY_LONG_SIZE
VARIABLE_SCOPE GLOBAL
@@ -827,7 +818,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
-@@ -2374,7 +2374,7 @@ READ_ONLY YES
+@@ -2375,7 +2375,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_STATEMENTS_HISTORY_SIZE
VARIABLE_SCOPE GLOBAL
@@ -836,7 +827,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
-@@ -2384,7 +2384,7 @@ READ_ONLY YES
+@@ -2385,7 +2385,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_WAITS_HISTORY_LONG_SIZE
VARIABLE_SCOPE GLOBAL
@@ -845,7 +836,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
-@@ -2394,7 +2394,7 @@ READ_ONLY YES
+@@ -2395,7 +2395,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_WAITS_HISTORY_SIZE
VARIABLE_SCOPE GLOBAL
@@ -854,7 +845,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
-@@ -2404,7 +2404,7 @@ READ_ONLY YES
+@@ -2405,7 +2405,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_HOSTS_SIZE
VARIABLE_SCOPE GLOBAL
@@ -863,7 +854,7 @@
VARIABLE_COMMENT Maximum number of instrumented hosts. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2414,7 +2414,7 @@ READ_ONLY YES
+@@ -2415,7 +2415,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_COND_CLASSES
VARIABLE_SCOPE GLOBAL
@@ -872,7 +863,7 @@
VARIABLE_COMMENT Maximum number of condition instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2424,7 +2424,7 @@ READ_ONLY YES
+@@ -2425,7 +2425,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_COND_INSTANCES
VARIABLE_SCOPE GLOBAL
@@ -881,7 +872,7 @@
VARIABLE_COMMENT Maximum number of instrumented condition objects. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2434,7 +2434,7 @@ READ_ONLY YES
+@@ -2435,7 +2435,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_DIGEST_LENGTH
VARIABLE_SCOPE GLOBAL
@@ -890,7 +881,7 @@
VARIABLE_COMMENT Maximum length considered for digest text, when stored in performance_schema tables.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1048576
-@@ -2444,7 +2444,7 @@ READ_ONLY YES
+@@ -2445,7 +2445,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_FILE_CLASSES
VARIABLE_SCOPE GLOBAL
@@ -899,7 +890,7 @@
VARIABLE_COMMENT Maximum number of file instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2454,7 +2454,7 @@ READ_ONLY YES
+@@ -2455,7 +2455,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_FILE_HANDLES
VARIABLE_SCOPE GLOBAL
@@ -908,7 +899,7 @@
VARIABLE_COMMENT Maximum number of opened instrumented files.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1048576
-@@ -2464,7 +2464,7 @@ READ_ONLY YES
+@@ -2465,7 +2465,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_FILE_INSTANCES
VARIABLE_SCOPE GLOBAL
@@ -917,7 +908,7 @@
VARIABLE_COMMENT Maximum number of instrumented files. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2474,7 +2474,7 @@ READ_ONLY YES
+@@ -2475,7 +2475,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_MUTEX_CLASSES
VARIABLE_SCOPE GLOBAL
@@ -926,7 +917,7 @@
VARIABLE_COMMENT Maximum number of mutex instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2484,7 +2484,7 @@ READ_ONLY YES
+@@ -2485,7 +2485,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_MUTEX_INSTANCES
VARIABLE_SCOPE GLOBAL
@@ -935,7 +926,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
-@@ -2494,7 +2494,7 @@ READ_ONLY YES
+@@ -2495,7 +2495,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_RWLOCK_CLASSES
VARIABLE_SCOPE GLOBAL
@@ -944,7 +935,7 @@
VARIABLE_COMMENT Maximum number of rwlock instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2504,7 +2504,7 @@ READ_ONLY YES
+@@ -2505,7 +2505,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_RWLOCK_INSTANCES
VARIABLE_SCOPE GLOBAL
@@ -953,7 +944,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
-@@ -2514,7 +2514,7 @@ READ_ONLY YES
+@@ -2515,7 +2515,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_SOCKET_CLASSES
VARIABLE_SCOPE GLOBAL
@@ -962,7 +953,7 @@
VARIABLE_COMMENT Maximum number of socket instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2524,7 +2524,7 @@ READ_ONLY YES
+@@ -2525,7 +2525,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_SOCKET_INSTANCES
VARIABLE_SCOPE GLOBAL
@@ -971,7 +962,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
-@@ -2534,7 +2534,7 @@ READ_ONLY YES
+@@ -2535,7 +2535,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_STAGE_CLASSES
VARIABLE_SCOPE GLOBAL
@@ -980,7 +971,7 @@
VARIABLE_COMMENT Maximum number of stage instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2544,7 +2544,7 @@ READ_ONLY YES
+@@ -2545,7 +2545,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_STATEMENT_CLASSES
VARIABLE_SCOPE GLOBAL
@@ -989,7 +980,7 @@
VARIABLE_COMMENT Maximum number of statement instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2554,7 +2554,7 @@ READ_ONLY YES
+@@ -2555,7 +2555,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_TABLE_HANDLES
VARIABLE_SCOPE GLOBAL
@@ -998,7 +989,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
-@@ -2564,7 +2564,7 @@ READ_ONLY YES
+@@ -2565,7 +2565,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_TABLE_INSTANCES
VARIABLE_SCOPE GLOBAL
@@ -1007,7 +998,7 @@
VARIABLE_COMMENT Maximum number of instrumented tables. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2574,7 +2574,7 @@ READ_ONLY YES
+@@ -2575,7 +2575,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_THREAD_CLASSES
VARIABLE_SCOPE GLOBAL
@@ -1016,7 +1007,7 @@
VARIABLE_COMMENT Maximum number of thread instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2584,7 +2584,7 @@ READ_ONLY YES
+@@ -2585,7 +2585,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_THREAD_INSTANCES
VARIABLE_SCOPE GLOBAL
@@ -1025,7 +1016,7 @@
VARIABLE_COMMENT Maximum number of instrumented threads. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2594,7 +2594,7 @@ READ_ONLY YES
+@@ -2595,7 +2595,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_SESSION_CONNECT_ATTRS_SIZE
VARIABLE_SCOPE GLOBAL
@@ -1034,7 +1025,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
-@@ -2604,7 +2604,7 @@ READ_ONLY YES
+@@ -2605,7 +2605,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_SETUP_ACTORS_SIZE
VARIABLE_SCOPE GLOBAL
@@ -1043,7 +1034,7 @@
VARIABLE_COMMENT Maximum number of rows in SETUP_ACTORS.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1024
-@@ -2614,7 +2614,7 @@ READ_ONLY YES
+@@ -2615,7 +2615,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_SETUP_OBJECTS_SIZE
VARIABLE_SCOPE GLOBAL
@@ -1052,7 +1043,7 @@
VARIABLE_COMMENT Maximum number of rows in SETUP_OBJECTS.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1048576
-@@ -2624,7 +2624,7 @@ READ_ONLY YES
+@@ -2625,7 +2625,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_USERS_SIZE
VARIABLE_SCOPE GLOBAL
@@ -1061,7 +1052,7 @@
VARIABLE_COMMENT Maximum number of instrumented users. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2674,7 +2674,7 @@ READ_ONLY YES
+@@ -2675,7 +2675,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PRELOAD_BUFFER_SIZE
VARIABLE_SCOPE SESSION
@@ -1070,7 +1061,7 @@
VARIABLE_COMMENT The size of the buffer that is allocated when preloading indexes
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 1073741824
-@@ -2694,7 +2694,7 @@ READ_ONLY NO
+@@ -2695,7 +2695,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME PROFILING_HISTORY_SIZE
VARIABLE_SCOPE SESSION
@@ -1079,7 +1070,7 @@
VARIABLE_COMMENT Number of statements about which profiling information is maintained. If set to 0, no profiles are stored. See SHOW PROFILES.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 100
-@@ -2704,7 +2704,7 @@ READ_ONLY NO
+@@ -2705,7 +2705,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PROGRESS_REPORT_TIME
VARIABLE_SCOPE SESSION
@@ -1088,7 +1079,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
-@@ -2764,7 +2764,7 @@ READ_ONLY NO
+@@ -2765,7 +2765,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME QUERY_ALLOC_BLOCK_SIZE
VARIABLE_SCOPE SESSION
@@ -1097,7 +1088,7 @@
VARIABLE_COMMENT Allocation block size for query parsing and execution
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 4294967295
-@@ -2774,7 +2774,7 @@ READ_ONLY NO
+@@ -2775,7 +2775,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME QUERY_CACHE_LIMIT
VARIABLE_SCOPE GLOBAL
@@ -1106,7 +1097,7 @@
VARIABLE_COMMENT Don't cache results that are bigger than this
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -2784,7 +2784,7 @@ READ_ONLY NO
+@@ -2785,7 +2785,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME QUERY_CACHE_MIN_RES_UNIT
VARIABLE_SCOPE GLOBAL
@@ -1115,7 +1106,7 @@
VARIABLE_COMMENT The minimum size for blocks allocated by the query cache
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -2797,7 +2797,7 @@ VARIABLE_SCOPE GLOBAL
+@@ -2798,7 +2798,7 @@ VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The memory allocated to store results from old queries
NUMERIC_MIN_VALUE 0
@@ -1124,7 +1115,7 @@
NUMERIC_BLOCK_SIZE 1024
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -2834,7 +2834,7 @@ READ_ONLY NO
+@@ -2835,7 +2835,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME QUERY_PREALLOC_SIZE
VARIABLE_SCOPE SESSION
@@ -1133,7 +1124,7 @@
VARIABLE_COMMENT Persistent buffer for query parsing and execution
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 4294967295
-@@ -2847,7 +2847,7 @@ VARIABLE_SCOPE SESSION ONLY
+@@ -2848,7 +2848,7 @@ VARIABLE_SCOPE SESSION ONLY
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes
NUMERIC_MIN_VALUE 0
@@ -1142,7 +1133,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -2857,14 +2857,14 @@ VARIABLE_SCOPE SESSION ONLY
+@@ -2858,14 +2858,14 @@ VARIABLE_SCOPE SESSION ONLY
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes
NUMERIC_MIN_VALUE 0
@@ -1159,7 +1150,7 @@
VARIABLE_COMMENT Allocation block size for storing ranges during optimization
NUMERIC_MIN_VALUE 4096
NUMERIC_MAX_VALUE 4294967295
-@@ -2874,7 +2874,7 @@ READ_ONLY NO
+@@ -2875,7 +2875,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME READ_BUFFER_SIZE
VARIABLE_SCOPE SESSION
@@ -1168,7 +1159,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
-@@ -2894,7 +2894,7 @@ READ_ONLY NO
+@@ -2895,7 +2895,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME READ_RND_BUFFER_SIZE
VARIABLE_SCOPE SESSION
@@ -1177,7 +1168,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
-@@ -2904,10 +2904,10 @@ READ_ONLY NO
+@@ -2905,10 +2905,10 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME ROWID_MERGE_BUFF_SIZE
VARIABLE_SCOPE SESSION
@@ -1190,7 +1181,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -2944,7 +2944,7 @@ READ_ONLY YES
+@@ -2945,7 +2945,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME SERVER_ID
VARIABLE_SCOPE SESSION
@@ -1199,7 +1190,7 @@
VARIABLE_COMMENT Uniquely identifies the server instance in the community of replication partners
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 4294967295
-@@ -3014,7 +3014,7 @@ READ_ONLY NO
+@@ -3015,7 +3015,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME SLAVE_MAX_ALLOWED_PACKET
VARIABLE_SCOPE GLOBAL
@@ -1208,7 +1199,7 @@
VARIABLE_COMMENT The maximum packet length to sent successfully from the master to slave.
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 1073741824
-@@ -3024,7 +3024,7 @@ READ_ONLY NO
+@@ -3025,7 +3025,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME SLOW_LAUNCH_TIME
VARIABLE_SCOPE GLOBAL
@@ -1217,7 +1208,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
-@@ -3067,7 +3067,7 @@ VARIABLE_SCOPE SESSION
+@@ -3068,7 +3068,7 @@ VARIABLE_SCOPE SESSION
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Each thread that needs to do a sort allocates a buffer of this size
NUMERIC_MIN_VALUE 1024
@@ -1226,7 +1217,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -3274,7 +3274,7 @@ READ_ONLY NO
+@@ -3275,7 +3275,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME STORED_PROGRAM_CACHE
VARIABLE_SCOPE GLOBAL
@@ -1235,7 +1226,7 @@
VARIABLE_COMMENT The soft upper limit for number of cached stored routines for one connection.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 524288
-@@ -3354,7 +3354,7 @@ READ_ONLY NO
+@@ -3355,7 +3355,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME TABLE_DEFINITION_CACHE
VARIABLE_SCOPE GLOBAL
@@ -1244,7 +1235,7 @@
VARIABLE_COMMENT The number of cached table definitions
NUMERIC_MIN_VALUE 400
NUMERIC_MAX_VALUE 2097152
-@@ -3364,7 +3364,7 @@ READ_ONLY NO
+@@ -3365,7 +3365,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME TABLE_OPEN_CACHE
VARIABLE_SCOPE GLOBAL
@@ -1253,7 +1244,7 @@
VARIABLE_COMMENT The number of cached open tables
NUMERIC_MIN_VALUE 10
NUMERIC_MAX_VALUE 1048576
-@@ -3424,7 +3424,7 @@ READ_ONLY NO
+@@ -3425,7 +3425,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME THREAD_CACHE_SIZE
VARIABLE_SCOPE GLOBAL
@@ -1262,7 +1253,7 @@
VARIABLE_COMMENT How many threads we should keep in a cache for reuse. These are freed after 5 minutes of idle time
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 16384
-@@ -3434,7 +3434,7 @@ READ_ONLY NO
+@@ -3435,7 +3435,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME THREAD_CONCURRENCY
VARIABLE_SCOPE GLOBAL
@@ -1271,7 +1262,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
-@@ -3527,7 +3527,7 @@ VARIABLE_SCOPE SESSION
+@@ -3528,7 +3528,7 @@ VARIABLE_SCOPE SESSION
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Max size for data for an internal temporary on-disk MyISAM or Aria table.
NUMERIC_MIN_VALUE 1024
@@ -1280,19 +1271,19 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -3537,7 +3537,7 @@ VARIABLE_SCOPE SESSION
+@@ -3538,7 +3538,7 @@ VARIABLE_SCOPE SESSION
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT If an internal in-memory temporary table exceeds this size, MariaDB will automatically convert it to an on-disk MyISAM or Aria table. Same as tmp_table_size.
- NUMERIC_MIN_VALUE 1024
+ NUMERIC_MIN_VALUE 0
-NUMERIC_MAX_VALUE 18446744073709551615
+NUMERIC_MAX_VALUE 4294967295
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -3547,14 +3547,14 @@ VARIABLE_SCOPE SESSION
+@@ -3548,14 +3548,14 @@ VARIABLE_SCOPE SESSION
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Alias for tmp_memory_table_size. If an internal in-memory temporary table exceeds this size, MariaDB will automatically convert it to an on-disk MyISAM or Aria table.
- NUMERIC_MIN_VALUE 1024
+ NUMERIC_MIN_VALUE 0
-NUMERIC_MAX_VALUE 18446744073709551615
+NUMERIC_MAX_VALUE 4294967295
NUMERIC_BLOCK_SIZE 1
@@ -1306,7 +1297,7 @@
VARIABLE_COMMENT Allocation block size for transactions to be stored in binary log
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 134217728
-@@ -3564,7 +3564,7 @@ READ_ONLY NO
+@@ -3565,7 +3565,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME TRANSACTION_PREALLOC_SIZE
VARIABLE_SCOPE SESSION
@@ -1315,7 +1306,7 @@
VARIABLE_COMMENT Persistent buffer for transactions to be stored in binary log
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 134217728
-@@ -3704,7 +3704,7 @@ READ_ONLY YES
+@@ -3705,7 +3705,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME WAIT_TIMEOUT
VARIABLE_SCOPE SESSION
@@ -1324,7 +1315,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
-@@ -3731,7 +3731,7 @@ order by variable_name;
+@@ -3732,7 +3732,7 @@ order by variable_name;
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 4ecf169b75e..9ed579fb632 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
@@ -9,6 +9,7 @@ where variable_name not like 'debug%' and
variable_name not like 'wsrep%' and
variable_name not like 's3%' and
variable_name not in (
+'have_sanitizer',
'log_tc_size'
)
order by variable_name;
@@ -305,7 +306,7 @@ COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME BIG_TABLES
VARIABLE_SCOPE SESSION
VARIABLE_TYPE BOOLEAN
-VARIABLE_COMMENT Old variable, which if set to 1, allows large result sets by saving all temporary sets to disk, avoiding 'table full' errors. No longer needed, as the server now handles this automatically. sql_big_tables is a synonym.
+VARIABLE_COMMENT Old variable, which if set to 1, allows large result sets by saving all temporary sets to disk, avoiding 'table full' errors. No longer needed, as the server now handles this automatically.
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
@@ -422,6 +423,16 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST MINIMAL,NOBLOB,FULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME BINLOG_ROW_METADATA
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE ENUM
+VARIABLE_COMMENT Controls whether metadata is logged using FULL , MINIMAL format and NO_LOG.FULL causes all metadata to be logged; MINIMAL means that only metadata actually required by slave is logged; NO_LOG NO metadata will be logged.Default: NO_LOG.
+NUMERIC_MIN_VALUE NULL
+NUMERIC_MAX_VALUE NULL
+NUMERIC_BLOCK_SIZE NULL
+ENUM_VALUE_LIST NO_LOG,MINIMAL,FULL
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME BINLOG_STMT_CACHE_SIZE
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
@@ -1872,16 +1883,6 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
-VARIABLE_NAME MAX_LONG_DATA_SIZE
-VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
-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
-NUMERIC_BLOCK_SIZE 1
-ENUM_VALUE_LIST NULL
-READ_ONLY YES
-COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MAX_PASSWORD_ERRORS
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE INT UNSIGNED
@@ -2279,7 +2280,7 @@ VARIABLE_COMMENT Fine-tune the optimizer behavior
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
-ENUM_VALUE_LIST index_merge,index_merge_union,index_merge_sort_union,index_merge_intersection,index_merge_sort_intersection,engine_condition_pushdown,index_condition_pushdown,derived_merge,derived_with_keys,firstmatch,loosescan,materialization,in_to_exists,semijoin,partial_match_rowid_merge,partial_match_table_scan,subquery_cache,mrr,mrr_cost_based,mrr_sort_keys,outer_join_with_cache,semijoin_with_cache,join_cache_incremental,join_cache_hashed,join_cache_bka,optimize_join_buffer_size,table_elimination,extended_keys,exists_to_in,orderby_uses_equalities,condition_pushdown_for_derived,split_materialized,condition_pushdown_for_subquery,rowid_filter,condition_pushdown_from_having,default
+ENUM_VALUE_LIST index_merge,index_merge_union,index_merge_sort_union,index_merge_intersection,index_merge_sort_intersection,engine_condition_pushdown,index_condition_pushdown,derived_merge,derived_with_keys,firstmatch,loosescan,materialization,in_to_exists,semijoin,partial_match_rowid_merge,partial_match_table_scan,subquery_cache,mrr,mrr_cost_based,mrr_sort_keys,outer_join_with_cache,semijoin_with_cache,join_cache_incremental,join_cache_hashed,join_cache_bka,optimize_join_buffer_size,table_elimination,extended_keys,exists_to_in,orderby_uses_equalities,condition_pushdown_for_derived,split_materialized,condition_pushdown_for_subquery,rowid_filter,condition_pushdown_from_having,not_null_range_scan,default
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME OPTIMIZER_TRACE
@@ -3536,7 +3537,7 @@ VARIABLE_NAME TMP_MEMORY_TABLE_SIZE
VARIABLE_SCOPE SESSION
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT If an internal in-memory temporary table exceeds this size, MariaDB will automatically convert it to an on-disk MyISAM or Aria table. Same as tmp_table_size.
-NUMERIC_MIN_VALUE 1024
+NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 18446744073709551615
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
@@ -3546,7 +3547,7 @@ VARIABLE_NAME TMP_TABLE_SIZE
VARIABLE_SCOPE SESSION
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Alias for tmp_memory_table_size. If an internal in-memory temporary table exceeds this size, MariaDB will automatically convert it to an on-disk MyISAM or Aria table.
-NUMERIC_MIN_VALUE 1024
+NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 18446744073709551615
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
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 bfe56dbc1a9..51809a1740c 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
@@ -1,6 +1,6 @@
---- sysvars_server_notembedded.result
-+++ sysvars_server_notembedded.result
-@@ -34,7 +34,7 @@ READ_ONLY NO
+--- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
++++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
+@@ -35,7 +35,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME ARIA_BLOCK_SIZE
VARIABLE_SCOPE GLOBAL
@@ -9,7 +9,7 @@
VARIABLE_COMMENT Block size to be used for Aria index pages.
NUMERIC_MIN_VALUE 4096
NUMERIC_MAX_VALUE 32768
-@@ -44,7 +44,7 @@ READ_ONLY YES
+@@ -45,7 +45,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME ARIA_CHECKPOINT_INTERVAL
VARIABLE_SCOPE GLOBAL
@@ -18,7 +18,7 @@
VARIABLE_COMMENT Interval between tries to do an automatic checkpoints. In seconds; 0 means 'no automatic checkpoints' which makes sense only for testing.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -54,7 +54,7 @@ READ_ONLY NO
+@@ -55,7 +55,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME ARIA_CHECKPOINT_LOG_ACTIVITY
VARIABLE_SCOPE GLOBAL
@@ -27,7 +27,7 @@
VARIABLE_COMMENT Number of bytes that the transaction log has to grow between checkpoints before a new checkpoint is written to the log.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -74,7 +74,7 @@ READ_ONLY NO
+@@ -75,7 +75,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME ARIA_FORCE_START_AFTER_RECOVERY_FAILURES
VARIABLE_SCOPE GLOBAL
@@ -36,7 +36,7 @@
VARIABLE_COMMENT Number of consecutive log recovery failures after which logs will be automatically deleted to cure the problem; 0 (the default) disables the feature.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 255
-@@ -94,7 +94,7 @@ READ_ONLY NO
+@@ -95,7 +95,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME ARIA_GROUP_COMMIT_INTERVAL
VARIABLE_SCOPE GLOBAL
@@ -45,7 +45,7 @@
VARIABLE_COMMENT Interval between commite in microseconds (1/1000000c). 0 stands for no waiting for other threads to come and do a commit in "hard" mode and no sync()/commit at all in "soft" mode. Option has only an effect if aria_group_commit is used
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -104,7 +104,7 @@ READ_ONLY NO
+@@ -105,7 +105,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME ARIA_LOG_FILE_SIZE
VARIABLE_SCOPE GLOBAL
@@ -54,7 +54,7 @@
VARIABLE_COMMENT Limit for transaction log size
NUMERIC_MIN_VALUE 8388608
NUMERIC_MAX_VALUE 4294967295
-@@ -134,10 +134,10 @@ READ_ONLY NO
+@@ -135,10 +135,10 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME ARIA_PAGECACHE_AGE_THRESHOLD
VARIABLE_SCOPE GLOBAL
@@ -67,7 +67,7 @@
NUMERIC_BLOCK_SIZE 100
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -154,7 +154,7 @@ READ_ONLY YES
+@@ -155,7 +155,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME ARIA_PAGECACHE_DIVISION_LIMIT
VARIABLE_SCOPE GLOBAL
@@ -76,7 +76,7 @@
VARIABLE_COMMENT The minimum percentage of warm blocks in key cache
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 100
-@@ -164,7 +164,7 @@ READ_ONLY NO
+@@ -165,7 +165,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME ARIA_PAGECACHE_FILE_HASH_SIZE
VARIABLE_SCOPE GLOBAL
@@ -85,7 +85,7 @@
VARIABLE_COMMENT Number of hash buckets for open and changed files. If you have a lot of Aria files open you should increase this for faster flush of changes. A good value is probably 1/10 of number of possible open Aria files.
NUMERIC_MIN_VALUE 128
NUMERIC_MAX_VALUE 16384
-@@ -194,7 +194,7 @@ READ_ONLY NO
+@@ -195,7 +195,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME ARIA_REPAIR_THREADS
VARIABLE_SCOPE SESSION
@@ -94,7 +94,7 @@
VARIABLE_COMMENT Number of threads to use when repairing Aria tables. The value of 1 disables parallel repair.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 128
-@@ -207,7 +207,7 @@ VARIABLE_SCOPE SESSION
+@@ -208,7 +208,7 @@ VARIABLE_SCOPE SESSION
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
@@ -103,7 +103,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -264,7 +264,7 @@ READ_ONLY NO
+@@ -265,7 +265,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME AUTO_INCREMENT_INCREMENT
VARIABLE_SCOPE SESSION
@@ -112,7 +112,7 @@
VARIABLE_COMMENT Auto-increment columns are incremented by this
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 65535
-@@ -274,7 +274,7 @@ READ_ONLY NO
+@@ -275,7 +275,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME AUTO_INCREMENT_OFFSET
VARIABLE_SCOPE SESSION
@@ -121,7 +121,7 @@
VARIABLE_COMMENT Offset added to Auto-increment columns. Used when auto-increment-increment != 1
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 65535
-@@ -284,7 +284,7 @@ READ_ONLY NO
+@@ -285,7 +285,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME BACK_LOG
VARIABLE_SCOPE GLOBAL
@@ -130,7 +130,7 @@
VARIABLE_COMMENT The number of outstanding connection requests MariaDB can have. This comes into play when the main MariaDB thread gets very many connection requests in a very short time
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 65535
-@@ -337,7 +337,7 @@ VARIABLE_SCOPE GLOBAL
+@@ -338,7 +338,7 @@ VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The size of the transactional cache for updates to transactional engines for the binary log. If you often use transactions containing many statements, you can increase this to get more performance
NUMERIC_MIN_VALUE 4096
@@ -139,7 +139,7 @@
NUMERIC_BLOCK_SIZE 4096
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -354,20 +354,20 @@ READ_ONLY NO
+@@ -355,20 +355,20 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME BINLOG_COMMIT_WAIT_COUNT
VARIABLE_SCOPE GLOBAL
@@ -164,7 +164,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -387,7 +387,7 @@ VARIABLE_SCOPE GLOBAL
+@@ -388,7 +388,7 @@ VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The size of file cache for the binary log
NUMERIC_MIN_VALUE 8192
@@ -173,7 +173,7 @@
NUMERIC_BLOCK_SIZE 4096
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -427,7 +427,7 @@ VARIABLE_SCOPE GLOBAL
+@@ -438,7 +438,7 @@ VARIABLE_SCOPE GLOBAL
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
@@ -182,7 +182,7 @@
NUMERIC_BLOCK_SIZE 4096
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -437,7 +437,7 @@ VARIABLE_SCOPE SESSION
+@@ -448,7 +448,7 @@ VARIABLE_SCOPE SESSION
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
@@ -191,7 +191,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -624,7 +624,7 @@ READ_ONLY NO
+@@ -635,7 +635,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME CONNECT_TIMEOUT
VARIABLE_SCOPE GLOBAL
@@ -200,7 +200,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
-@@ -674,7 +674,7 @@ READ_ONLY YES
+@@ -685,7 +685,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME DEADLOCK_SEARCH_DEPTH_LONG
VARIABLE_SCOPE SESSION
@@ -209,7 +209,7 @@
VARIABLE_COMMENT Long search depth for the two-step deadlock detection
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 33
-@@ -684,7 +684,7 @@ READ_ONLY NO
+@@ -695,7 +695,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME DEADLOCK_SEARCH_DEPTH_SHORT
VARIABLE_SCOPE SESSION
@@ -218,7 +218,7 @@
VARIABLE_COMMENT Short search depth for the two-step deadlock detection
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 32
-@@ -694,7 +694,7 @@ READ_ONLY NO
+@@ -705,7 +705,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME DEADLOCK_TIMEOUT_LONG
VARIABLE_SCOPE SESSION
@@ -227,7 +227,7 @@
VARIABLE_COMMENT Long timeout for the two-step deadlock detection (in microseconds)
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -704,7 +704,7 @@ READ_ONLY NO
+@@ -715,7 +715,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME DEADLOCK_TIMEOUT_SHORT
VARIABLE_SCOPE SESSION
@@ -236,7 +236,7 @@
VARIABLE_COMMENT Short timeout for the two-step deadlock detection (in microseconds)
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -764,7 +764,7 @@ READ_ONLY NO
+@@ -775,7 +775,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME DEFAULT_WEEK_FORMAT
VARIABLE_SCOPE SESSION
@@ -245,7 +245,7 @@
VARIABLE_COMMENT The default week format used by WEEK() functions
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 7
-@@ -774,7 +774,7 @@ READ_ONLY NO
+@@ -785,7 +785,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME DELAYED_INSERT_LIMIT
VARIABLE_SCOPE GLOBAL
@@ -254,7 +254,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
-@@ -784,7 +784,7 @@ READ_ONLY NO
+@@ -795,7 +795,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME DELAYED_INSERT_TIMEOUT
VARIABLE_SCOPE GLOBAL
@@ -263,7 +263,7 @@
VARIABLE_COMMENT How long a INSERT DELAYED thread should wait for INSERT statements before terminating
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 31536000
-@@ -794,7 +794,7 @@ READ_ONLY NO
+@@ -805,7 +805,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME DELAYED_QUEUE_SIZE
VARIABLE_SCOPE GLOBAL
@@ -272,7 +272,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
-@@ -824,7 +824,7 @@ READ_ONLY NO
+@@ -835,7 +835,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME DIV_PRECISION_INCREMENT
VARIABLE_SCOPE SESSION
@@ -281,7 +281,7 @@
VARIABLE_COMMENT Precision of the result of '/' operator will be increased on that value
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 38
-@@ -914,7 +914,7 @@ READ_ONLY NO
+@@ -925,7 +925,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME EXPIRE_LOGS_DAYS
VARIABLE_SCOPE GLOBAL
@@ -290,7 +290,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
-@@ -944,7 +944,7 @@ READ_ONLY YES
+@@ -955,7 +955,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME EXTRA_MAX_CONNECTIONS
VARIABLE_SCOPE GLOBAL
@@ -299,7 +299,7 @@
VARIABLE_COMMENT The number of connections on extra-port
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 100000
-@@ -974,7 +974,7 @@ READ_ONLY NO
+@@ -985,7 +985,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME FLUSH_TIME
VARIABLE_SCOPE GLOBAL
@@ -308,7 +308,7 @@
VARIABLE_COMMENT A dedicated thread is created to flush all tables at the given interval
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 31536000
-@@ -1004,7 +1004,7 @@ READ_ONLY NO
+@@ -1015,7 +1015,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME FT_MAX_WORD_LEN
VARIABLE_SCOPE GLOBAL
@@ -317,7 +317,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
-@@ -1014,7 +1014,7 @@ READ_ONLY YES
+@@ -1025,7 +1025,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME FT_MIN_WORD_LEN
VARIABLE_SCOPE GLOBAL
@@ -326,7 +326,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
-@@ -1024,7 +1024,7 @@ READ_ONLY YES
+@@ -1035,7 +1035,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME FT_QUERY_EXPANSION_LIMIT
VARIABLE_SCOPE GLOBAL
@@ -335,7 +335,7 @@
VARIABLE_COMMENT Number of best matches to use for query expansion
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1000
-@@ -1067,7 +1067,7 @@ VARIABLE_SCOPE SESSION
+@@ -1078,7 +1078,7 @@ VARIABLE_SCOPE SESSION
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The maximum length of the result of function GROUP_CONCAT()
NUMERIC_MIN_VALUE 4
@@ -344,7 +344,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -1274,7 +1274,7 @@ READ_ONLY YES
+@@ -1285,7 +1285,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME HISTOGRAM_SIZE
VARIABLE_SCOPE SESSION
@@ -353,7 +353,7 @@
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
-@@ -1304,7 +1304,7 @@ READ_ONLY YES
+@@ -1315,7 +1315,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME HOST_CACHE_SIZE
VARIABLE_SCOPE GLOBAL
@@ -362,7 +362,7 @@
VARIABLE_COMMENT How many host names should be cached to avoid resolving.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 65536
-@@ -1414,7 +1414,7 @@ READ_ONLY NO
+@@ -1425,7 +1425,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME INTERACTIVE_TIMEOUT
VARIABLE_SCOPE SESSION
@@ -371,7 +371,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
-@@ -1447,7 +1447,7 @@ VARIABLE_SCOPE SESSION
+@@ -1458,7 +1458,7 @@ VARIABLE_SCOPE SESSION
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The size of the buffer that is used for joins
NUMERIC_MIN_VALUE 128
@@ -380,7 +380,7 @@
NUMERIC_BLOCK_SIZE 128
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -1464,7 +1464,7 @@ READ_ONLY NO
+@@ -1475,7 +1475,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME JOIN_CACHE_LEVEL
VARIABLE_SCOPE SESSION
@@ -389,7 +389,7 @@
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
-@@ -1487,7 +1487,7 @@ VARIABLE_SCOPE GLOBAL
+@@ -1498,7 +1498,7 @@ 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 0
@@ -398,7 +398,7 @@
NUMERIC_BLOCK_SIZE 4096
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -1654,7 +1654,7 @@ READ_ONLY YES
+@@ -1665,7 +1665,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME LOCK_WAIT_TIMEOUT
VARIABLE_SCOPE SESSION
@@ -407,7 +407,7 @@
VARIABLE_COMMENT Timeout in seconds to wait for a lock before returning an error.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 31536000
-@@ -1804,7 +1804,7 @@ READ_ONLY NO
+@@ -1815,7 +1815,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME LOG_SLOW_RATE_LIMIT
VARIABLE_SCOPE SESSION
@@ -416,7 +416,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
-@@ -1834,7 +1834,7 @@ READ_ONLY NO
+@@ -1845,7 +1845,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME LOG_WARNINGS
VARIABLE_SCOPE SESSION
@@ -425,7 +425,7 @@
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
-@@ -1894,7 +1894,7 @@ READ_ONLY NO
+@@ -1905,7 +1905,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME MAX_ALLOWED_PACKET
VARIABLE_SCOPE SESSION
@@ -434,7 +434,7 @@
VARIABLE_COMMENT Max packet length to send to or receive from the server
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 1073741824
-@@ -1907,14 +1907,14 @@ VARIABLE_SCOPE GLOBAL
+@@ -1918,14 +1918,14 @@ VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Sets the total size of the transactional cache
NUMERIC_MIN_VALUE 4096
@@ -451,7 +451,7 @@
VARIABLE_COMMENT Binary log will be rotated automatically when the size exceeds this value.
NUMERIC_MIN_VALUE 4096
NUMERIC_MAX_VALUE 1073741824
-@@ -1927,14 +1927,14 @@ VARIABLE_SCOPE GLOBAL
+@@ -1938,14 +1938,14 @@ VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Sets the total size of the statement cache
NUMERIC_MIN_VALUE 4096
@@ -468,7 +468,7 @@
VARIABLE_COMMENT The number of simultaneous clients allowed
NUMERIC_MIN_VALUE 10
NUMERIC_MAX_VALUE 100000
-@@ -1944,7 +1944,7 @@ READ_ONLY NO
+@@ -1955,7 +1955,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MAX_CONNECT_ERRORS
VARIABLE_SCOPE GLOBAL
@@ -477,7 +477,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
-@@ -1954,7 +1954,7 @@ READ_ONLY NO
+@@ -1965,7 +1965,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MAX_DELAYED_THREADS
VARIABLE_SCOPE SESSION
@@ -486,7 +486,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
-@@ -1974,7 +1974,7 @@ READ_ONLY YES
+@@ -1985,7 +1985,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MAX_ERROR_COUNT
VARIABLE_SCOPE SESSION
@@ -495,7 +495,7 @@
VARIABLE_COMMENT Max number of errors/warnings to store for a statement
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 65535
-@@ -1987,14 +1987,14 @@ VARIABLE_SCOPE SESSION
+@@ -1998,14 +1998,14 @@ VARIABLE_SCOPE SESSION
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Don't allow creation of heap tables bigger than this
NUMERIC_MIN_VALUE 16384
@@ -512,7 +512,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
-@@ -2014,7 +2014,7 @@ READ_ONLY NO
+@@ -2025,7 +2025,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MAX_LENGTH_FOR_SORT_DATA
VARIABLE_SCOPE SESSION
@@ -521,16 +521,7 @@
VARIABLE_COMMENT Max number of bytes in sorted records
NUMERIC_MIN_VALUE 4
NUMERIC_MAX_VALUE 8388608
-@@ -2024,7 +2024,7 @@ READ_ONLY NO
- COMMAND_LINE_ARGUMENT REQUIRED
- VARIABLE_NAME MAX_LONG_DATA_SIZE
- VARIABLE_SCOPE GLOBAL
--VARIABLE_TYPE BIGINT UNSIGNED
-+VARIABLE_TYPE INT UNSIGNED
- 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
-@@ -2054,7 +2054,7 @@ READ_ONLY NO
+@@ -2055,7 +2055,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MAX_RECURSIVE_ITERATIONS
VARIABLE_SCOPE SESSION
@@ -539,7 +530,7 @@
VARIABLE_COMMENT Maximum number of iterations when executing recursive queries
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -2077,14 +2077,14 @@ VARIABLE_SCOPE SESSION
+@@ -2078,14 +2078,14 @@ VARIABLE_SCOPE SESSION
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The maximum size of the container of a rowid filter
NUMERIC_MIN_VALUE 1024
@@ -556,7 +547,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
-@@ -2104,7 +2104,7 @@ READ_ONLY NO
+@@ -2105,7 +2105,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MAX_SORT_LENGTH
VARIABLE_SCOPE SESSION
@@ -565,7 +556,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
-@@ -2114,7 +2114,7 @@ READ_ONLY NO
+@@ -2115,7 +2115,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MAX_SP_RECURSION_DEPTH
VARIABLE_SCOPE SESSION
@@ -574,7 +565,7 @@
VARIABLE_COMMENT Maximum stored procedure recursion depth
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 255
-@@ -2134,7 +2134,7 @@ READ_ONLY NO
+@@ -2135,7 +2135,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MAX_TMP_TABLES
VARIABLE_SCOPE SESSION
@@ -583,7 +574,7 @@
VARIABLE_COMMENT Unused, will be removed.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 4294967295
-@@ -2154,7 +2154,7 @@ READ_ONLY NO
+@@ -2155,7 +2155,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MAX_WRITE_LOCK_COUNT
VARIABLE_SCOPE GLOBAL
@@ -592,7 +583,7 @@
VARIABLE_COMMENT After this many write locks, allow some read locks to run in between
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 4294967295
-@@ -2164,7 +2164,7 @@ READ_ONLY NO
+@@ -2165,7 +2165,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME METADATA_LOCKS_CACHE_SIZE
VARIABLE_SCOPE GLOBAL
@@ -601,7 +592,7 @@
VARIABLE_COMMENT Unused
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 1048576
-@@ -2174,7 +2174,7 @@ READ_ONLY YES
+@@ -2175,7 +2175,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME METADATA_LOCKS_HASH_INSTANCES
VARIABLE_SCOPE GLOBAL
@@ -610,7 +601,7 @@
VARIABLE_COMMENT Unused
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 1024
-@@ -2184,7 +2184,7 @@ READ_ONLY YES
+@@ -2185,7 +2185,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MIN_EXAMINED_ROW_LIMIT
VARIABLE_SCOPE SESSION
@@ -619,7 +610,7 @@
VARIABLE_COMMENT Don't write queries to slow log that examine fewer rows than that
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -2194,7 +2194,7 @@ READ_ONLY NO
+@@ -2195,7 +2195,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MRR_BUFFER_SIZE
VARIABLE_SCOPE SESSION
@@ -628,7 +619,7 @@
VARIABLE_COMMENT Size of buffer to use when using MRR with range access
NUMERIC_MIN_VALUE 8192
NUMERIC_MAX_VALUE 2147483647
-@@ -2204,17 +2204,17 @@ READ_ONLY NO
+@@ -2205,17 +2205,17 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MULTI_RANGE_COUNT
VARIABLE_SCOPE SESSION
@@ -649,7 +640,7 @@
VARIABLE_COMMENT Block size to be used for MyISAM index pages
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 16384
-@@ -2224,7 +2224,7 @@ READ_ONLY YES
+@@ -2225,7 +2225,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MYISAM_DATA_POINTER_SIZE
VARIABLE_SCOPE GLOBAL
@@ -658,7 +649,7 @@
VARIABLE_COMMENT Default pointer size to be used for MyISAM tables
NUMERIC_MIN_VALUE 2
NUMERIC_MAX_VALUE 7
-@@ -2247,7 +2247,7 @@ VARIABLE_SCOPE GLOBAL
+@@ -2248,7 +2248,7 @@ VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Restricts the total memory used for memory mapping of MySQL tables
NUMERIC_MIN_VALUE 7
@@ -667,7 +658,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY YES
-@@ -2264,10 +2264,10 @@ READ_ONLY YES
+@@ -2265,10 +2265,10 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME MYISAM_REPAIR_THREADS
VARIABLE_SCOPE SESSION
@@ -680,7 +671,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -2277,7 +2277,7 @@ VARIABLE_SCOPE SESSION
+@@ -2278,7 +2278,7 @@ VARIABLE_SCOPE SESSION
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
@@ -689,7 +680,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -2314,7 +2314,7 @@ READ_ONLY NO
+@@ -2315,7 +2315,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME NET_BUFFER_LENGTH
VARIABLE_SCOPE SESSION
@@ -698,7 +689,7 @@
VARIABLE_COMMENT Buffer length for TCP/IP and socket communication
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 1048576
-@@ -2324,7 +2324,7 @@ READ_ONLY NO
+@@ -2325,7 +2325,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME NET_READ_TIMEOUT
VARIABLE_SCOPE SESSION
@@ -707,7 +698,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
-@@ -2334,7 +2334,7 @@ READ_ONLY NO
+@@ -2335,7 +2335,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME NET_RETRY_COUNT
VARIABLE_SCOPE SESSION
@@ -716,7 +707,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
-@@ -2344,7 +2344,7 @@ READ_ONLY NO
+@@ -2345,7 +2345,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME NET_WRITE_TIMEOUT
VARIABLE_SCOPE SESSION
@@ -725,7 +716,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
-@@ -2394,7 +2394,7 @@ READ_ONLY NO
+@@ -2395,7 +2395,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME OPEN_FILES_LIMIT
VARIABLE_SCOPE GLOBAL
@@ -734,7 +725,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 or autoset 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
-@@ -2404,7 +2404,7 @@ READ_ONLY YES
+@@ -2405,7 +2405,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME OPTIMIZER_PRUNE_LEVEL
VARIABLE_SCOPE SESSION
@@ -743,7 +734,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
-@@ -2414,7 +2414,7 @@ READ_ONLY NO
+@@ -2415,7 +2415,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME OPTIMIZER_SEARCH_DEPTH
VARIABLE_SCOPE SESSION
@@ -752,7 +743,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.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 62
-@@ -2424,7 +2424,7 @@ READ_ONLY NO
+@@ -2425,7 +2425,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME OPTIMIZER_SELECTIVITY_SAMPLING_LIMIT
VARIABLE_SCOPE SESSION
@@ -761,7 +752,7 @@
VARIABLE_COMMENT Controls number of record samples to check condition selectivity
NUMERIC_MIN_VALUE 10
NUMERIC_MAX_VALUE 4294967295
-@@ -2454,17 +2454,17 @@ READ_ONLY NO
+@@ -2455,17 +2455,17 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME OPTIMIZER_TRACE_MAX_MEM_SIZE
VARIABLE_SCOPE SESSION
@@ -782,7 +773,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
-@@ -2484,7 +2484,7 @@ READ_ONLY YES
+@@ -2485,7 +2485,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME PERFORMANCE_SCHEMA_ACCOUNTS_SIZE
VARIABLE_SCOPE GLOBAL
@@ -791,7 +782,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
-@@ -2494,7 +2494,7 @@ READ_ONLY YES
+@@ -2495,7 +2495,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_DIGESTS_SIZE
VARIABLE_SCOPE GLOBAL
@@ -800,7 +791,7 @@
VARIABLE_COMMENT Size of the statement digest. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 200
-@@ -2504,7 +2504,7 @@ READ_ONLY YES
+@@ -2505,7 +2505,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_STAGES_HISTORY_LONG_SIZE
VARIABLE_SCOPE GLOBAL
@@ -809,7 +800,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
-@@ -2514,7 +2514,7 @@ READ_ONLY YES
+@@ -2515,7 +2515,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_STAGES_HISTORY_SIZE
VARIABLE_SCOPE GLOBAL
@@ -818,7 +809,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
-@@ -2524,7 +2524,7 @@ READ_ONLY YES
+@@ -2525,7 +2525,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_STATEMENTS_HISTORY_LONG_SIZE
VARIABLE_SCOPE GLOBAL
@@ -827,7 +818,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
-@@ -2534,7 +2534,7 @@ READ_ONLY YES
+@@ -2535,7 +2535,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_STATEMENTS_HISTORY_SIZE
VARIABLE_SCOPE GLOBAL
@@ -836,7 +827,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
-@@ -2544,7 +2544,7 @@ READ_ONLY YES
+@@ -2545,7 +2545,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_WAITS_HISTORY_LONG_SIZE
VARIABLE_SCOPE GLOBAL
@@ -845,7 +836,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
-@@ -2554,7 +2554,7 @@ READ_ONLY YES
+@@ -2555,7 +2555,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_WAITS_HISTORY_SIZE
VARIABLE_SCOPE GLOBAL
@@ -854,7 +845,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
-@@ -2564,7 +2564,7 @@ READ_ONLY YES
+@@ -2565,7 +2565,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_HOSTS_SIZE
VARIABLE_SCOPE GLOBAL
@@ -863,7 +854,7 @@
VARIABLE_COMMENT Maximum number of instrumented hosts. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2574,7 +2574,7 @@ READ_ONLY YES
+@@ -2575,7 +2575,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_COND_CLASSES
VARIABLE_SCOPE GLOBAL
@@ -872,7 +863,7 @@
VARIABLE_COMMENT Maximum number of condition instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2584,7 +2584,7 @@ READ_ONLY YES
+@@ -2585,7 +2585,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_COND_INSTANCES
VARIABLE_SCOPE GLOBAL
@@ -881,7 +872,7 @@
VARIABLE_COMMENT Maximum number of instrumented condition objects. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2594,7 +2594,7 @@ READ_ONLY YES
+@@ -2595,7 +2595,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_DIGEST_LENGTH
VARIABLE_SCOPE GLOBAL
@@ -890,7 +881,7 @@
VARIABLE_COMMENT Maximum length considered for digest text, when stored in performance_schema tables.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1048576
-@@ -2604,7 +2604,7 @@ READ_ONLY YES
+@@ -2605,7 +2605,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_FILE_CLASSES
VARIABLE_SCOPE GLOBAL
@@ -899,7 +890,7 @@
VARIABLE_COMMENT Maximum number of file instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2614,7 +2614,7 @@ READ_ONLY YES
+@@ -2615,7 +2615,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_FILE_HANDLES
VARIABLE_SCOPE GLOBAL
@@ -908,7 +899,7 @@
VARIABLE_COMMENT Maximum number of opened instrumented files.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1048576
-@@ -2624,7 +2624,7 @@ READ_ONLY YES
+@@ -2625,7 +2625,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_FILE_INSTANCES
VARIABLE_SCOPE GLOBAL
@@ -917,7 +908,7 @@
VARIABLE_COMMENT Maximum number of instrumented files. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2634,7 +2634,7 @@ READ_ONLY YES
+@@ -2635,7 +2635,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_MUTEX_CLASSES
VARIABLE_SCOPE GLOBAL
@@ -926,7 +917,7 @@
VARIABLE_COMMENT Maximum number of mutex instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2644,7 +2644,7 @@ READ_ONLY YES
+@@ -2645,7 +2645,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_MUTEX_INSTANCES
VARIABLE_SCOPE GLOBAL
@@ -935,7 +926,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
-@@ -2654,7 +2654,7 @@ READ_ONLY YES
+@@ -2655,7 +2655,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_RWLOCK_CLASSES
VARIABLE_SCOPE GLOBAL
@@ -944,7 +935,7 @@
VARIABLE_COMMENT Maximum number of rwlock instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2664,7 +2664,7 @@ READ_ONLY YES
+@@ -2665,7 +2665,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_RWLOCK_INSTANCES
VARIABLE_SCOPE GLOBAL
@@ -953,7 +944,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
-@@ -2674,7 +2674,7 @@ READ_ONLY YES
+@@ -2675,7 +2675,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_SOCKET_CLASSES
VARIABLE_SCOPE GLOBAL
@@ -962,7 +953,7 @@
VARIABLE_COMMENT Maximum number of socket instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2684,7 +2684,7 @@ READ_ONLY YES
+@@ -2685,7 +2685,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_SOCKET_INSTANCES
VARIABLE_SCOPE GLOBAL
@@ -971,7 +962,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
-@@ -2694,7 +2694,7 @@ READ_ONLY YES
+@@ -2695,7 +2695,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_STAGE_CLASSES
VARIABLE_SCOPE GLOBAL
@@ -980,7 +971,7 @@
VARIABLE_COMMENT Maximum number of stage instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2704,7 +2704,7 @@ READ_ONLY YES
+@@ -2705,7 +2705,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_STATEMENT_CLASSES
VARIABLE_SCOPE GLOBAL
@@ -989,7 +980,7 @@
VARIABLE_COMMENT Maximum number of statement instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2714,7 +2714,7 @@ READ_ONLY YES
+@@ -2715,7 +2715,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_TABLE_HANDLES
VARIABLE_SCOPE GLOBAL
@@ -998,7 +989,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
-@@ -2724,7 +2724,7 @@ READ_ONLY YES
+@@ -2725,7 +2725,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_TABLE_INSTANCES
VARIABLE_SCOPE GLOBAL
@@ -1007,7 +998,7 @@
VARIABLE_COMMENT Maximum number of instrumented tables. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2734,7 +2734,7 @@ READ_ONLY YES
+@@ -2735,7 +2735,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_THREAD_CLASSES
VARIABLE_SCOPE GLOBAL
@@ -1016,7 +1007,7 @@
VARIABLE_COMMENT Maximum number of thread instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2744,7 +2744,7 @@ READ_ONLY YES
+@@ -2745,7 +2745,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_THREAD_INSTANCES
VARIABLE_SCOPE GLOBAL
@@ -1025,7 +1016,7 @@
VARIABLE_COMMENT Maximum number of instrumented threads. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2754,7 +2754,7 @@ READ_ONLY YES
+@@ -2755,7 +2755,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_SESSION_CONNECT_ATTRS_SIZE
VARIABLE_SCOPE GLOBAL
@@ -1034,7 +1025,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
-@@ -2764,7 +2764,7 @@ READ_ONLY YES
+@@ -2765,7 +2765,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_SETUP_ACTORS_SIZE
VARIABLE_SCOPE GLOBAL
@@ -1043,7 +1034,7 @@
VARIABLE_COMMENT Maximum number of rows in SETUP_ACTORS.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1024
-@@ -2774,7 +2774,7 @@ READ_ONLY YES
+@@ -2775,7 +2775,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_SETUP_OBJECTS_SIZE
VARIABLE_SCOPE GLOBAL
@@ -1052,7 +1043,7 @@
VARIABLE_COMMENT Maximum number of rows in SETUP_OBJECTS.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1048576
-@@ -2784,7 +2784,7 @@ READ_ONLY YES
+@@ -2785,7 +2785,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_USERS_SIZE
VARIABLE_SCOPE GLOBAL
@@ -1061,7 +1052,7 @@
VARIABLE_COMMENT Maximum number of instrumented users. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2834,7 +2834,7 @@ READ_ONLY YES
+@@ -2835,7 +2835,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PRELOAD_BUFFER_SIZE
VARIABLE_SCOPE SESSION
@@ -1070,7 +1061,7 @@
VARIABLE_COMMENT The size of the buffer that is allocated when preloading indexes
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 1073741824
-@@ -2854,7 +2854,7 @@ READ_ONLY NO
+@@ -2855,7 +2855,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME PROFILING_HISTORY_SIZE
VARIABLE_SCOPE SESSION
@@ -1079,7 +1070,7 @@
VARIABLE_COMMENT Number of statements about which profiling information is maintained. If set to 0, no profiles are stored. See SHOW PROFILES.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 100
-@@ -2864,7 +2864,7 @@ READ_ONLY NO
+@@ -2865,7 +2865,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PROGRESS_REPORT_TIME
VARIABLE_SCOPE SESSION
@@ -1088,7 +1079,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
-@@ -2924,7 +2924,7 @@ READ_ONLY NO
+@@ -2925,7 +2925,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME QUERY_ALLOC_BLOCK_SIZE
VARIABLE_SCOPE SESSION
@@ -1097,7 +1088,7 @@
VARIABLE_COMMENT Allocation block size for query parsing and execution
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 4294967295
-@@ -2934,7 +2934,7 @@ READ_ONLY NO
+@@ -2935,7 +2935,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME QUERY_CACHE_LIMIT
VARIABLE_SCOPE GLOBAL
@@ -1106,7 +1097,7 @@
VARIABLE_COMMENT Don't cache results that are bigger than this
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -2944,7 +2944,7 @@ READ_ONLY NO
+@@ -2945,7 +2945,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME QUERY_CACHE_MIN_RES_UNIT
VARIABLE_SCOPE GLOBAL
@@ -1115,7 +1106,7 @@
VARIABLE_COMMENT The minimum size for blocks allocated by the query cache
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -2957,7 +2957,7 @@ VARIABLE_SCOPE GLOBAL
+@@ -2958,7 +2958,7 @@ VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The memory allocated to store results from old queries
NUMERIC_MIN_VALUE 0
@@ -1124,7 +1115,7 @@
NUMERIC_BLOCK_SIZE 1024
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -2994,7 +2994,7 @@ READ_ONLY NO
+@@ -2995,7 +2995,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME QUERY_PREALLOC_SIZE
VARIABLE_SCOPE SESSION
@@ -1133,7 +1124,7 @@
VARIABLE_COMMENT Persistent buffer for query parsing and execution
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 4294967295
-@@ -3007,7 +3007,7 @@ VARIABLE_SCOPE SESSION ONLY
+@@ -3008,7 +3008,7 @@ VARIABLE_SCOPE SESSION ONLY
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes
NUMERIC_MIN_VALUE 0
@@ -1142,7 +1133,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -3017,14 +3017,14 @@ VARIABLE_SCOPE SESSION ONLY
+@@ -3018,14 +3018,14 @@ VARIABLE_SCOPE SESSION ONLY
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes
NUMERIC_MIN_VALUE 0
@@ -1159,7 +1150,7 @@
VARIABLE_COMMENT Allocation block size for storing ranges during optimization
NUMERIC_MIN_VALUE 4096
NUMERIC_MAX_VALUE 4294967295
-@@ -3037,14 +3037,14 @@ VARIABLE_SCOPE GLOBAL
+@@ -3038,14 +3038,14 @@ VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Maximum speed(KB/s) to read binlog from master (0 = no limit)
NUMERIC_MIN_VALUE 0
@@ -1176,7 +1167,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
-@@ -3064,7 +3064,7 @@ READ_ONLY NO
+@@ -3065,7 +3065,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME READ_RND_BUFFER_SIZE
VARIABLE_SCOPE SESSION
@@ -1185,7 +1176,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
-@@ -3264,10 +3264,10 @@ READ_ONLY YES
+@@ -3265,10 +3265,10 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME ROWID_MERGE_BUFF_SIZE
VARIABLE_SCOPE SESSION
@@ -1198,7 +1189,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -3284,20 +3284,20 @@ READ_ONLY NO
+@@ -3285,20 +3285,20 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME RPL_SEMI_SYNC_MASTER_TIMEOUT
VARIABLE_SCOPE GLOBAL
@@ -1223,7 +1214,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -3354,10 +3354,10 @@ READ_ONLY NO
+@@ -3355,10 +3355,10 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME RPL_SEMI_SYNC_SLAVE_TRACE_LEVEL
VARIABLE_SCOPE GLOBAL
@@ -1236,7 +1227,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -3394,7 +3394,7 @@ READ_ONLY YES
+@@ -3395,7 +3395,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME SERVER_ID
VARIABLE_SCOPE SESSION
@@ -1245,7 +1236,7 @@
VARIABLE_COMMENT Uniquely identifies the server instance in the community of replication partners
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 4294967295
-@@ -3524,7 +3524,7 @@ READ_ONLY NO
+@@ -3525,7 +3525,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME SLAVE_DOMAIN_PARALLEL_THREADS
VARIABLE_SCOPE GLOBAL
@@ -1254,7 +1245,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
-@@ -3554,7 +3554,7 @@ READ_ONLY YES
+@@ -3555,7 +3555,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME SLAVE_MAX_ALLOWED_PACKET
VARIABLE_SCOPE GLOBAL
@@ -1263,7 +1254,7 @@
VARIABLE_COMMENT The maximum packet length to sent successfully from the master to slave.
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 1073741824
-@@ -3574,7 +3574,7 @@ READ_ONLY NO
+@@ -3575,7 +3575,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME SLAVE_PARALLEL_MAX_QUEUED
VARIABLE_SCOPE GLOBAL
@@ -1272,7 +1263,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
-@@ -3594,7 +3594,7 @@ READ_ONLY NO
+@@ -3595,7 +3595,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME SLAVE_PARALLEL_THREADS
VARIABLE_SCOPE GLOBAL
@@ -1281,7 +1272,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
-@@ -3604,7 +3604,7 @@ READ_ONLY NO
+@@ -3605,7 +3605,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME SLAVE_PARALLEL_WORKERS
VARIABLE_SCOPE GLOBAL
@@ -1290,7 +1281,7 @@
VARIABLE_COMMENT Alias for slave_parallel_threads
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 16383
-@@ -3644,7 +3644,7 @@ READ_ONLY NO
+@@ -3645,7 +3645,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME SLAVE_TRANSACTION_RETRIES
VARIABLE_SCOPE GLOBAL
@@ -1299,7 +1290,7 @@
VARIABLE_COMMENT Number of times the slave SQL thread will retry a transaction in case it failed with a deadlock, elapsed lock wait timeout or listed in slave_transaction_retry_errors, before giving up and stopping
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -3664,7 +3664,7 @@ READ_ONLY YES
+@@ -3665,7 +3665,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME SLAVE_TRANSACTION_RETRY_INTERVAL
VARIABLE_SCOPE GLOBAL
@@ -1308,7 +1299,7 @@
VARIABLE_COMMENT Interval of the slave SQL thread will retry a transaction in case it failed with a deadlock or elapsed lock wait timeout or listed in slave_transaction_retry_errors
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 3600
-@@ -3684,7 +3684,7 @@ READ_ONLY NO
+@@ -3685,7 +3685,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME SLOW_LAUNCH_TIME
VARIABLE_SCOPE GLOBAL
@@ -1317,7 +1308,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
-@@ -3727,7 +3727,7 @@ VARIABLE_SCOPE SESSION
+@@ -3728,7 +3728,7 @@ VARIABLE_SCOPE SESSION
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Each thread that needs to do a sort allocates a buffer of this size
NUMERIC_MIN_VALUE 1024
@@ -1326,7 +1317,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -3944,7 +3944,7 @@ READ_ONLY NO
+@@ -3945,7 +3945,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME STORED_PROGRAM_CACHE
VARIABLE_SCOPE GLOBAL
@@ -1335,7 +1326,7 @@
VARIABLE_COMMENT The soft upper limit for number of cached stored routines for one connection.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 524288
-@@ -4044,7 +4044,7 @@ READ_ONLY NO
+@@ -4045,7 +4045,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME TABLE_DEFINITION_CACHE
VARIABLE_SCOPE GLOBAL
@@ -1344,7 +1335,7 @@
VARIABLE_COMMENT The number of cached table definitions
NUMERIC_MIN_VALUE 400
NUMERIC_MAX_VALUE 2097152
-@@ -4054,7 +4054,7 @@ READ_ONLY NO
+@@ -4055,7 +4055,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME TABLE_OPEN_CACHE
VARIABLE_SCOPE GLOBAL
@@ -1353,7 +1344,7 @@
VARIABLE_COMMENT The number of cached open tables
NUMERIC_MIN_VALUE 10
NUMERIC_MAX_VALUE 1048576
-@@ -4114,7 +4114,7 @@ READ_ONLY NO
+@@ -4115,7 +4115,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME THREAD_CACHE_SIZE
VARIABLE_SCOPE GLOBAL
@@ -1362,7 +1353,7 @@
VARIABLE_COMMENT How many threads we should keep in a cache for reuse. These are freed after 5 minutes of idle time
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 16384
-@@ -4124,7 +4124,7 @@ READ_ONLY NO
+@@ -4125,7 +4125,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME THREAD_CONCURRENCY
VARIABLE_SCOPE GLOBAL
@@ -1371,7 +1362,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
-@@ -4287,7 +4287,7 @@ VARIABLE_SCOPE SESSION
+@@ -4308,7 +4308,7 @@ VARIABLE_SCOPE SESSION
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Max size for data for an internal temporary on-disk MyISAM or Aria table.
NUMERIC_MIN_VALUE 1024
@@ -1380,19 +1371,19 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -4297,7 +4297,7 @@ VARIABLE_SCOPE SESSION
+@@ -4318,7 +4318,7 @@ VARIABLE_SCOPE SESSION
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT If an internal in-memory temporary table exceeds this size, MariaDB will automatically convert it to an on-disk MyISAM or Aria table. Same as tmp_table_size.
- NUMERIC_MIN_VALUE 1024
+ NUMERIC_MIN_VALUE 0
-NUMERIC_MAX_VALUE 18446744073709551615
+NUMERIC_MAX_VALUE 4294967295
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -4307,14 +4307,14 @@ VARIABLE_SCOPE SESSION
+@@ -4328,14 +4328,14 @@ VARIABLE_SCOPE SESSION
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Alias for tmp_memory_table_size. If an internal in-memory temporary table exceeds this size, MariaDB will automatically convert it to an on-disk MyISAM or Aria table.
- NUMERIC_MIN_VALUE 1024
+ NUMERIC_MIN_VALUE 0
-NUMERIC_MAX_VALUE 18446744073709551615
+NUMERIC_MAX_VALUE 4294967295
NUMERIC_BLOCK_SIZE 1
@@ -1406,7 +1397,7 @@
VARIABLE_COMMENT Allocation block size for transactions to be stored in binary log
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 134217728
-@@ -4324,7 +4324,7 @@ READ_ONLY NO
+@@ -4345,7 +4345,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME TRANSACTION_PREALLOC_SIZE
VARIABLE_SCOPE SESSION
@@ -1415,7 +1406,7 @@
VARIABLE_COMMENT Persistent buffer for transactions to be stored in binary log
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 134217728
-@@ -4464,7 +4464,7 @@ READ_ONLY YES
+@@ -4485,7 +4485,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME WAIT_TIMEOUT
VARIABLE_SCOPE SESSION
@@ -1424,7 +1415,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
-@@ -4491,7 +4491,7 @@ order by variable_name;
+@@ -4512,7 +4512,7 @@ order by variable_name;
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 c9443b64674..66b996b8cd3 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
@@ -9,6 +9,7 @@ where variable_name not like 'debug%' and
variable_name not like 'wsrep%' and
variable_name not like 's3%' and
variable_name not in (
+'have_sanitizer',
'log_tc_size'
)
order by variable_name;
@@ -305,7 +306,7 @@ COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME BIG_TABLES
VARIABLE_SCOPE SESSION
VARIABLE_TYPE BOOLEAN
-VARIABLE_COMMENT Old variable, which if set to 1, allows large result sets by saving all temporary sets to disk, avoiding 'table full' errors. No longer needed, as the server now handles this automatically. sql_big_tables is a synonym.
+VARIABLE_COMMENT Old variable, which if set to 1, allows large result sets by saving all temporary sets to disk, avoiding 'table full' errors. No longer needed, as the server now handles this automatically.
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
@@ -422,6 +423,16 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST MINIMAL,NOBLOB,FULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME BINLOG_ROW_METADATA
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE ENUM
+VARIABLE_COMMENT Controls whether metadata is logged using FULL , MINIMAL format and NO_LOG.FULL causes all metadata to be logged; MINIMAL means that only metadata actually required by slave is logged; NO_LOG NO metadata will be logged.Default: NO_LOG.
+NUMERIC_MIN_VALUE NULL
+NUMERIC_MAX_VALUE NULL
+NUMERIC_BLOCK_SIZE NULL
+ENUM_VALUE_LIST NO_LOG,MINIMAL,FULL
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME BINLOG_STMT_CACHE_SIZE
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
@@ -2022,16 +2033,6 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
-VARIABLE_NAME MAX_LONG_DATA_SIZE
-VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
-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
-NUMERIC_BLOCK_SIZE 1
-ENUM_VALUE_LIST NULL
-READ_ONLY YES
-COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MAX_PASSWORD_ERRORS
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE INT UNSIGNED
@@ -2439,7 +2440,7 @@ VARIABLE_COMMENT Fine-tune the optimizer behavior
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
-ENUM_VALUE_LIST index_merge,index_merge_union,index_merge_sort_union,index_merge_intersection,index_merge_sort_intersection,engine_condition_pushdown,index_condition_pushdown,derived_merge,derived_with_keys,firstmatch,loosescan,materialization,in_to_exists,semijoin,partial_match_rowid_merge,partial_match_table_scan,subquery_cache,mrr,mrr_cost_based,mrr_sort_keys,outer_join_with_cache,semijoin_with_cache,join_cache_incremental,join_cache_hashed,join_cache_bka,optimize_join_buffer_size,table_elimination,extended_keys,exists_to_in,orderby_uses_equalities,condition_pushdown_for_derived,split_materialized,condition_pushdown_for_subquery,rowid_filter,condition_pushdown_from_having,default
+ENUM_VALUE_LIST index_merge,index_merge_union,index_merge_sort_union,index_merge_intersection,index_merge_sort_intersection,engine_condition_pushdown,index_condition_pushdown,derived_merge,derived_with_keys,firstmatch,loosescan,materialization,in_to_exists,semijoin,partial_match_rowid_merge,partial_match_table_scan,subquery_cache,mrr,mrr_cost_based,mrr_sort_keys,outer_join_with_cache,semijoin_with_cache,join_cache_incremental,join_cache_hashed,join_cache_bka,optimize_join_buffer_size,table_elimination,extended_keys,exists_to_in,orderby_uses_equalities,condition_pushdown_for_derived,split_materialized,condition_pushdown_for_subquery,rowid_filter,condition_pushdown_from_having,not_null_range_scan,default
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME OPTIMIZER_TRACE
@@ -3442,6 +3443,16 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,STATE,CHARACTERISTICS
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME SESSION_TRACK_USER_VARIABLES
+VARIABLE_SCOPE SESSION
+VARIABLE_TYPE BOOLEAN
+VARIABLE_COMMENT Track changes to user variables.
+NUMERIC_MIN_VALUE NULL
+NUMERIC_MAX_VALUE NULL
+NUMERIC_BLOCK_SIZE NULL
+ENUM_VALUE_LIST OFF,ON
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME SKIP_EXTERNAL_LOCKING
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN
@@ -4142,6 +4153,26 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST one-thread-per-connection,no-threads,pool-of-threads
READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME THREAD_POOL_DEDICATED_LISTENER
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE BOOLEAN
+VARIABLE_COMMENT If set to 1,listener thread will not pick up queries
+NUMERIC_MIN_VALUE NULL
+NUMERIC_MAX_VALUE NULL
+NUMERIC_BLOCK_SIZE NULL
+ENUM_VALUE_LIST OFF,ON
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT OPTIONAL
+VARIABLE_NAME THREAD_POOL_EXACT_STATS
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE BOOLEAN
+VARIABLE_COMMENT If set to 1, provides better statistics in information_schema threadpool tables
+NUMERIC_MIN_VALUE NULL
+NUMERIC_MAX_VALUE NULL
+NUMERIC_BLOCK_SIZE NULL
+ENUM_VALUE_LIST OFF,ON
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME THREAD_POOL_IDLE_TIMEOUT
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE INT UNSIGNED
@@ -4206,7 +4237,7 @@ VARIABLE_NAME THREAD_POOL_STALL_LIMIT
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Maximum query execution time in milliseconds,before an executing non-yielding thread is considered stalled.If a worker thread is stalled, additional worker thread may be created to handle remaining clients.
-NUMERIC_MIN_VALUE 10
+NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 4294967295
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
@@ -4296,7 +4327,7 @@ VARIABLE_NAME TMP_MEMORY_TABLE_SIZE
VARIABLE_SCOPE SESSION
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT If an internal in-memory temporary table exceeds this size, MariaDB will automatically convert it to an on-disk MyISAM or Aria table. Same as tmp_table_size.
-NUMERIC_MIN_VALUE 1024
+NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 18446744073709551615
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
@@ -4306,7 +4337,7 @@ VARIABLE_NAME TMP_TABLE_SIZE
VARIABLE_SCOPE SESSION
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Alias for tmp_memory_table_size. If an internal in-memory temporary table exceeds this size, MariaDB will automatically convert it to an on-disk MyISAM or Aria table.
-NUMERIC_MIN_VALUE 1024
+NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 18446744073709551615
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
diff --git a/mysql-test/suite/sys_vars/r/thread_pool_stall_limit_basic.result b/mysql-test/suite/sys_vars/r/thread_pool_stall_limit_basic.result
index eda4e6baebe..0a4d8dea6d2 100644
--- a/mysql-test/suite/sys_vars/r/thread_pool_stall_limit_basic.result
+++ b/mysql-test/suite/sys_vars/r/thread_pool_stall_limit_basic.result
@@ -37,7 +37,7 @@ Warnings:
Warning 1292 Truncated incorrect thread_pool_stall_limit value: '-1'
select @@global.thread_pool_stall_limit;
@@global.thread_pool_stall_limit
-10
+1
set global thread_pool_stall_limit=10000000000;
Warnings:
Warning 1292 Truncated incorrect thread_pool_stall_limit value: '10000000000'
diff --git a/mysql-test/suite/sys_vars/r/tmp_disk_table_size_func.result b/mysql-test/suite/sys_vars/r/tmp_disk_table_size_func.result
index bc2301cfd39..7b26106384b 100644
--- a/mysql-test/suite/sys_vars/r/tmp_disk_table_size_func.result
+++ b/mysql-test/suite/sys_vars/r/tmp_disk_table_size_func.result
@@ -4,8 +4,6 @@
SET @start_tmp_memory_table_size=@@session.tmp_memory_table_size;
SET @start_tmp_disk_table_size=@@session.tmp_disk_table_size;
set @@session.tmp_memory_table_size=1000;
-Warnings:
-Warning 1292 Truncated incorrect tmp_memory_table_size value: '1000'
set @@session.tmp_disk_table_size=3000000;
create table t1 (a int primary key, b varchar(2000));
insert into t1 select seq,repeat(char(mod(seq,62)+64),seq) from seq_1_to_2000;
diff --git a/mysql-test/suite/sys_vars/r/tmp_memory_table_size_basic.result b/mysql-test/suite/sys_vars/r/tmp_memory_table_size_basic.result
deleted file mode 100644
index dddba1a6dfe..00000000000
--- a/mysql-test/suite/sys_vars/r/tmp_memory_table_size_basic.result
+++ /dev/null
@@ -1,165 +0,0 @@
-SET @start_global_value = @@global.tmp_memory_table_size;
-SET @start_session_value = @@session.tmp_memory_table_size;
-'#--------------------FN_DYNVARS_005_01-------------------------#'
-SET @@global.tmp_memory_table_size = 10000;
-SELECT @@global.tmp_memory_table_size;
-@@global.tmp_memory_table_size
-10000
-SET @@global.tmp_memory_table_size = DEFAULT;
-SELECT @@global.tmp_memory_table_size;
-@@global.tmp_memory_table_size
-16777216
-SET @@session.tmp_memory_table_size = 20000;
-SELECT @@session.tmp_memory_table_size;
-@@session.tmp_memory_table_size
-20000
-SET @@session.tmp_memory_table_size = DEFAULT;
-SELECT @@session.tmp_memory_table_size;
-@@session.tmp_memory_table_size
-16777216
-'#--------------------FN_DYNVARS_005_02-------------------------#'
-SELECT @@global.tmp_memory_table_size >= 16777216;
-@@global.tmp_memory_table_size >= 16777216
-1
-SELECT @@session.tmp_memory_table_size >= 16777216;
-@@session.tmp_memory_table_size >= 16777216
-1
-'#--------------------FN_DYNVARS_005_03-------------------------#'
-SET @@global.tmp_memory_table_size = 1024;
-SELECT @@global.tmp_memory_table_size;
-@@global.tmp_memory_table_size
-1024
-SET @@global.tmp_memory_table_size = 60020;
-SELECT @@global.tmp_memory_table_size;
-@@global.tmp_memory_table_size
-60020
-SET @@global.tmp_memory_table_size = 4294967295;
-SELECT @@global.tmp_memory_table_size;
-@@global.tmp_memory_table_size
-4294967295
-'#--------------------FN_DYNVARS_005_04-------------------------#'
-SET @@session.tmp_memory_table_size = 1024;
-SELECT @@session.tmp_memory_table_size;
-@@session.tmp_memory_table_size
-1024
-SET @@session.tmp_memory_table_size = 4294967295;
-SELECT @@session.tmp_memory_table_size;
-@@session.tmp_memory_table_size
-4294967295
-SET @@session.tmp_memory_table_size = 65535;
-SELECT @@session.tmp_memory_table_size;
-@@session.tmp_memory_table_size
-65535
-'#------------------FN_DYNVARS_005_05-----------------------#'
-SET @@global.tmp_memory_table_size = 0;
-Warnings:
-Warning 1292 Truncated incorrect tmp_memory_table_size value: '0'
-SELECT @@global.tmp_memory_table_size;
-@@global.tmp_memory_table_size
-1024
-SET @@global.tmp_memory_table_size = -1024;
-Warnings:
-Warning 1292 Truncated incorrect tmp_memory_table_size value: '-1024'
-SELECT @@global.tmp_memory_table_size;
-@@global.tmp_memory_table_size
-1024
-SET @@global.tmp_memory_table_size = 1000;
-Warnings:
-Warning 1292 Truncated incorrect tmp_memory_table_size value: '1000'
-SELECT @@global.tmp_memory_table_size;
-@@global.tmp_memory_table_size
-1024
-SET @@global.tmp_memory_table_size = ON;
-ERROR 42000: Incorrect argument type to variable 'tmp_memory_table_size'
-SET @@global.tmp_memory_table_size = OFF;
-ERROR 42000: Incorrect argument type to variable 'tmp_memory_table_size'
-SET @@global.tmp_memory_table_size = True;
-Warnings:
-Warning 1292 Truncated incorrect tmp_memory_table_size value: '1'
-SELECT @@global.tmp_memory_table_size;
-@@global.tmp_memory_table_size
-1024
-SET @@global.tmp_memory_table_size = False;
-Warnings:
-Warning 1292 Truncated incorrect tmp_memory_table_size value: '0'
-SELECT @@global.tmp_memory_table_size;
-@@global.tmp_memory_table_size
-1024
-SET @@global.tmp_memory_table_size = 65530.34;
-ERROR 42000: Incorrect argument type to variable 'tmp_memory_table_size'
-SET @@global.tmp_memory_table_size ="Test";
-ERROR 42000: Incorrect argument type to variable 'tmp_memory_table_size'
-SET @@session.tmp_memory_table_size = ON;
-ERROR 42000: Incorrect argument type to variable 'tmp_memory_table_size'
-SET @@session.tmp_memory_table_size = OFF;
-ERROR 42000: Incorrect argument type to variable 'tmp_memory_table_size'
-SET @@session.tmp_memory_table_size = True;
-Warnings:
-Warning 1292 Truncated incorrect tmp_memory_table_size value: '1'
-SELECT @@session.tmp_memory_table_size;
-@@session.tmp_memory_table_size
-1024
-SET @@session.tmp_memory_table_size = False;
-Warnings:
-Warning 1292 Truncated incorrect tmp_memory_table_size value: '0'
-SELECT @@session.tmp_memory_table_size;
-@@session.tmp_memory_table_size
-1024
-SET @@session.tmp_memory_table_size = "Test";
-ERROR 42000: Incorrect argument type to variable 'tmp_memory_table_size'
-SET @@session.tmp_memory_table_size = 12345678901;
-SELECT @@session.tmp_memory_table_size IN (12345678901,4294967295);
-@@session.tmp_memory_table_size IN (12345678901,4294967295)
-1
-'#------------------FN_DYNVARS_005_06-----------------------#'
-SELECT @@global.tmp_memory_table_size = VARIABLE_VALUE
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
-WHERE VARIABLE_NAME='tmp_memory_table_size';
-@@global.tmp_memory_table_size = VARIABLE_VALUE
-1
-'#------------------FN_DYNVARS_005_07-----------------------#'
-SELECT @@session.tmp_memory_table_size = VARIABLE_VALUE
-FROM INFORMATION_SCHEMA.SESSION_VARIABLES
-WHERE VARIABLE_NAME='tmp_memory_table_size';
-@@session.tmp_memory_table_size = VARIABLE_VALUE
-1
-'#---------------------FN_DYNVARS_001_09----------------------#'
-SET @@global.tmp_memory_table_size = 1024;
-SET @@tmp_memory_table_size = 4294967295;
-SELECT @@tmp_memory_table_size = @@global.tmp_memory_table_size;
-@@tmp_memory_table_size = @@global.tmp_memory_table_size
-0
-'#---------------------FN_DYNVARS_001_10----------------------#'
-SET @@tmp_memory_table_size = 100;
-Warnings:
-Warning 1292 Truncated incorrect tmp_memory_table_size value: '100'
-SELECT @@tmp_memory_table_size = @@local.tmp_memory_table_size;
-@@tmp_memory_table_size = @@local.tmp_memory_table_size
-1
-SELECT @@local.tmp_memory_table_size = @@session.tmp_memory_table_size;
-@@local.tmp_memory_table_size = @@session.tmp_memory_table_size
-1
-'#---------------------FN_DYNVARS_001_11----------------------#'
-SET tmp_memory_table_size = 1027;
-SELECT @@tmp_memory_table_size;
-@@tmp_memory_table_size
-1027
-SELECT local.tmp_memory_table_size;
-ERROR 42S02: Unknown table 'local' in field list
-SELECT global.tmp_memory_table_size;
-ERROR 42S02: Unknown table 'global' in field list
-SELECT tmp_memory_table_size = @@session.tmp_memory_table_size;
-ERROR 42S22: Unknown column 'tmp_memory_table_size' in 'field list'
-
-"Check that tmp_memory_table_size and tmp_table_size are the same"
-
-set @@session.tmp_memory_table_size=100000;
-select @@session.tmp_memory_table_size,@@session.tmp_table_size;
-@@session.tmp_memory_table_size @@session.tmp_table_size
-100000 100000
-set @@session.tmp_memory_table_size=200000;
-select @@session.tmp_memory_table_size,@@session.tmp_table_size;
-@@session.tmp_memory_table_size @@session.tmp_table_size
-200000 200000
-SET @@global.tmp_memory_table_size = @start_global_value;
-SET @@session.tmp_memory_table_size = @start_session_value;
diff --git a/mysql-test/suite/sys_vars/r/tmp_table_size_basic.result b/mysql-test/suite/sys_vars/r/tmp_table_size_basic.result
deleted file mode 100644
index 06b624ad5c8..00000000000
--- a/mysql-test/suite/sys_vars/r/tmp_table_size_basic.result
+++ /dev/null
@@ -1,146 +0,0 @@
-SET @start_global_value = @@global.tmp_table_size;
-SET @start_session_value = @@session.tmp_table_size;
-'#--------------------FN_DYNVARS_005_01-------------------------#'
-SET @@global.tmp_table_size = 100;
-Warnings:
-Warning 1292 Truncated incorrect tmp_table_size value: '100'
-SET @@global.tmp_table_size = DEFAULT;
-SET @@session.tmp_table_size = 200;
-Warnings:
-Warning 1292 Truncated incorrect tmp_table_size value: '200'
-SET @@session.tmp_table_size = DEFAULT;
-'#--------------------FN_DYNVARS_005_02-------------------------#'
-SELECT @@global.tmp_table_size >= 16777216;
-@@global.tmp_table_size >= 16777216
-1
-SELECT @@session.tmp_table_size >= 16777216;
-@@session.tmp_table_size >= 16777216
-1
-'#--------------------FN_DYNVARS_005_03-------------------------#'
-SET @@global.tmp_table_size = 1024;
-SELECT @@global.tmp_table_size;
-@@global.tmp_table_size
-1024
-SET @@global.tmp_table_size = 60020;
-SELECT @@global.tmp_table_size;
-@@global.tmp_table_size
-60020
-SET @@global.tmp_table_size = 4294967295;
-SELECT @@global.tmp_table_size;
-@@global.tmp_table_size
-4294967295
-'#--------------------FN_DYNVARS_005_04-------------------------#'
-SET @@session.tmp_table_size = 1024;
-SELECT @@session.tmp_table_size;
-@@session.tmp_table_size
-1024
-SET @@session.tmp_table_size = 4294967295;
-SELECT @@session.tmp_table_size;
-@@session.tmp_table_size
-4294967295
-SET @@session.tmp_table_size = 65535;
-SELECT @@session.tmp_table_size;
-@@session.tmp_table_size
-65535
-'#------------------FN_DYNVARS_005_05-----------------------#'
-SET @@global.tmp_table_size = 0;
-Warnings:
-Warning 1292 Truncated incorrect tmp_table_size value: '0'
-SELECT @@global.tmp_table_size;
-@@global.tmp_table_size
-1024
-SET @@global.tmp_table_size = -1024;
-Warnings:
-Warning 1292 Truncated incorrect tmp_table_size value: '-1024'
-SELECT @@global.tmp_table_size;
-@@global.tmp_table_size
-1024
-SET @@global.tmp_table_size = 1000;
-Warnings:
-Warning 1292 Truncated incorrect tmp_table_size value: '1000'
-SELECT @@global.tmp_table_size;
-@@global.tmp_table_size
-1024
-SET @@global.tmp_table_size = ON;
-ERROR 42000: Incorrect argument type to variable 'tmp_table_size'
-SET @@global.tmp_table_size = OFF;
-ERROR 42000: Incorrect argument type to variable 'tmp_table_size'
-SET @@global.tmp_table_size = True;
-Warnings:
-Warning 1292 Truncated incorrect tmp_table_size value: '1'
-SELECT @@global.tmp_table_size;
-@@global.tmp_table_size
-1024
-SET @@global.tmp_table_size = False;
-Warnings:
-Warning 1292 Truncated incorrect tmp_table_size value: '0'
-SELECT @@global.tmp_table_size;
-@@global.tmp_table_size
-1024
-SET @@global.tmp_table_size = 65530.34;
-ERROR 42000: Incorrect argument type to variable 'tmp_table_size'
-SET @@global.tmp_table_size ="Test";
-ERROR 42000: Incorrect argument type to variable 'tmp_table_size'
-SET @@session.tmp_table_size = ON;
-ERROR 42000: Incorrect argument type to variable 'tmp_table_size'
-SET @@session.tmp_table_size = OFF;
-ERROR 42000: Incorrect argument type to variable 'tmp_table_size'
-SET @@session.tmp_table_size = True;
-Warnings:
-Warning 1292 Truncated incorrect tmp_table_size value: '1'
-SELECT @@session.tmp_table_size;
-@@session.tmp_table_size
-1024
-SET @@session.tmp_table_size = False;
-Warnings:
-Warning 1292 Truncated incorrect tmp_table_size value: '0'
-SELECT @@session.tmp_table_size;
-@@session.tmp_table_size
-1024
-SET @@session.tmp_table_size = "Test";
-ERROR 42000: Incorrect argument type to variable 'tmp_table_size'
-SET @@session.tmp_table_size = 12345678901;
-SELECT @@session.tmp_table_size IN (12345678901,4294967295);
-@@session.tmp_table_size IN (12345678901,4294967295)
-1
-'#------------------FN_DYNVARS_005_06-----------------------#'
-SELECT @@global.tmp_table_size = VARIABLE_VALUE
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
-WHERE VARIABLE_NAME='tmp_table_size';
-@@global.tmp_table_size = VARIABLE_VALUE
-1
-'#------------------FN_DYNVARS_005_07-----------------------#'
-SELECT @@session.tmp_table_size = VARIABLE_VALUE
-FROM INFORMATION_SCHEMA.SESSION_VARIABLES
-WHERE VARIABLE_NAME='tmp_table_size';
-@@session.tmp_table_size = VARIABLE_VALUE
-1
-'#---------------------FN_DYNVARS_001_09----------------------#'
-SET @@global.tmp_table_size = 1024;
-SET @@tmp_table_size = 4294967295;
-SELECT @@tmp_table_size = @@global.tmp_table_size;
-@@tmp_table_size = @@global.tmp_table_size
-0
-'#---------------------FN_DYNVARS_001_10----------------------#'
-SET @@tmp_table_size = 100;
-Warnings:
-Warning 1292 Truncated incorrect tmp_table_size value: '100'
-SELECT @@tmp_table_size = @@local.tmp_table_size;
-@@tmp_table_size = @@local.tmp_table_size
-1
-SELECT @@local.tmp_table_size = @@session.tmp_table_size;
-@@local.tmp_table_size = @@session.tmp_table_size
-1
-'#---------------------FN_DYNVARS_001_11----------------------#'
-SET tmp_table_size = 1027;
-SELECT @@tmp_table_size;
-@@tmp_table_size
-1027
-SELECT local.tmp_table_size;
-ERROR 42S02: Unknown table 'local' in field list
-SELECT global.tmp_table_size;
-ERROR 42S02: Unknown table 'global' in field list
-SELECT tmp_table_size = @@session.tmp_table_size;
-ERROR 42S22: Unknown column 'tmp_table_size' in 'field list'
-SET @@global.tmp_table_size = @start_global_value;
-SET @@session.tmp_table_size = @start_session_value;
diff --git a/mysql-test/suite/sys_vars/t/binlog_row_metadata_basic.test b/mysql-test/suite/sys_vars/t/binlog_row_metadata_basic.test
new file mode 100644
index 00000000000..d08acd5a348
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/binlog_row_metadata_basic.test
@@ -0,0 +1,121 @@
+################## mysql-test\t\binlog_row_metadata_basic.test ################
+# #
+# Variable Name: binlog_row_metadata #
+# Scope: Global #
+# Data Type: enumeration #
+# #
+# Creation Date: 2017-01-23 #
+# Author : Libing Song #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable binlog_row_metadata #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: #
+# http://dev.mysql.com/doc/refman/8.X/en/server-system-variables.html #
+# #
+###############################################################################
+
+
+--echo NO_LOG Expected
+SELECT @@GLOBAL.binlog_row_metadata;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@SESSION.binlog_row_metadata;
+
+--echo '#---------------------BS_STVARS_002_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SET @start_value= @@global.binlog_row_metadata;
+
+SELECT COUNT(@@GLOBAL.binlog_row_metadata);
+--echo 1 Expected
+
+--echo '#---------------------BS_STVARS_002_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+SET @@GLOBAL.binlog_row_metadata=0;
+SELECT @@GLOBAL.binlog_row_metadata;
+--echo NO_LOG Expected
+
+SET @@GLOBAL.binlog_row_metadata=1;
+SELECT @@GLOBAL.binlog_row_metadata;
+--echo MINIMAL Expected
+
+SET @@GLOBAL.binlog_row_metadata=2;
+SELECT @@GLOBAL.binlog_row_metadata;
+--echo FULL Expected
+
+SET @@GLOBAL.binlog_row_metadata=NO_LOG;
+SELECT @@GLOBAL.binlog_row_metadata;
+--echo NO_LOG Expected
+
+SET @@GLOBAL.binlog_row_metadata=MINIMAL;
+SELECT @@GLOBAL.binlog_row_metadata;
+--echo MINIMAL Expected
+
+SET @@GLOBAL.binlog_row_metadata=FULL;
+SELECT @@GLOBAL.binlog_row_metadata;
+--echo FULL Expected
+
+SET @@GLOBAL.binlog_row_metadata='NO_LOG';
+SELECT @@GLOBAL.binlog_row_metadata;
+--echo NO_LOG Expected
+
+SET @@GLOBAL.binlog_row_metadata='MINIMAL';
+SELECT @@GLOBAL.binlog_row_metadata;
+--echo MINIMAL Expected
+
+SET @@GLOBAL.binlog_row_metadata='FULL';
+SELECT @@GLOBAL.binlog_row_metadata;
+--echo FULL Expected
+
+--echo '#---------------------BS_STVARS_002_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+SET @@GLOBAL.binlog_row_metadata='MINIMAl';
+SELECT *
+FROM information_schema.global_variables
+WHERE VARIABLE_NAME='binlog_row_metadata';
+
+--echo '#---------------------BS_STVARS_002_04----------------------#'
+#################################################################
+# Check if the value in SESSION Table matches value in variable #
+#################################################################
+
+SELECT *
+FROM information_schema.session_variables
+WHERE VARIABLE_NAME LIKE 'binlog_row_metadata';
+
+--echo '#---------------------BS_STVARS_002_05----------------------#'
+################################################################################
+# Check if binlog_row_metadata can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@binlog_row_metadata);
+--echo 1 Expected
+SELECT COUNT(@@GLOBAL.binlog_row_metadata);
+--echo 1 Expected
+
+--echo '#---------------------BS_STVARS_002_06----------------------#'
+################################################################################
+# Check if binlog_row_metadata can handle invalid values correctly #
+################################################################################
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL binlog_row_metadata = full1;
+
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL binlog_row_metadata = "full1";
+
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL binlog_row_metadata = 3;
+
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL binlog_row_metadata = -1;
+
+SET @@global.binlog_row_metadata= @start_value;
diff --git a/mysql-test/suite/sys_vars/t/innodb_checksums_basic.test b/mysql-test/suite/sys_vars/t/innodb_checksums_basic.test
deleted file mode 100644
index 5db0a18e8fd..00000000000
--- a/mysql-test/suite/sys_vars/t/innodb_checksums_basic.test
+++ /dev/null
@@ -1,106 +0,0 @@
-
-
-################## mysql-test\t\innodb_checksums_basic.test ###################
-# #
-# Variable Name: innodb_checksums #
-# Scope: Global #
-# Access Type: Static #
-# Data Type: boolean #
-# #
-# #
-# Creation Date: 2008-02-07 #
-# Author : Sharique Abdullah #
-# #
-# #
-# Description:Test Cases of Dynamic System Variable innodb_checksums #
-# that checks the behavior of this variable in the following ways #
-# * Value Check #
-# * Scope Check #
-# #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
-# server-system-variables.html #
-# #
-###############################################################################
-
---source include/have_innodb.inc
-
---echo '#---------------------BS_STVARS_023_01----------------------#'
-####################################################################
-# Displaying default value #
-####################################################################
-SELECT COUNT(@@GLOBAL.innodb_checksums);
---echo 1 Expected
-
-
---echo '#---------------------BS_STVARS_023_02----------------------#'
-####################################################################
-# Check if Value can set #
-####################################################################
-
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@GLOBAL.innodb_checksums=1;
---echo Expected error 'Read only variable'
-
-SELECT COUNT(@@GLOBAL.innodb_checksums);
---echo 1 Expected
-
-
-
-
---echo '#---------------------BS_STVARS_023_03----------------------#'
-#################################################################
-# Check if the value in GLOBAL Table matches value in variable #
-#################################################################
-
---disable_warnings
-SELECT IF(@@GLOBAL.innodb_checksums, "ON", "OFF") = VARIABLE_VALUE
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
-WHERE VARIABLE_NAME='innodb_checksums';
---enable_warnings
---echo 1 Expected
-
-SELECT COUNT(@@GLOBAL.innodb_checksums);
---echo 1 Expected
-
---disable_warnings
-SELECT COUNT(VARIABLE_VALUE)
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
-WHERE VARIABLE_NAME='innodb_checksums';
---enable_warnings
---echo 1 Expected
-
-
-
---echo '#---------------------BS_STVARS_023_04----------------------#'
-################################################################################
-# Check if accessing variable with and without GLOBAL point to same variable #
-################################################################################
-SELECT @@innodb_checksums = @@GLOBAL.innodb_checksums;
---echo 1 Expected
-
-
-
---echo '#---------------------BS_STVARS_023_05----------------------#'
-################################################################################
-# Check if innodb_checksums can be accessed with and without @@ sign #
-################################################################################
-
-SELECT COUNT(@@innodb_checksums);
---echo 1 Expected
-
---Error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT COUNT(@@local.innodb_checksums);
---echo Expected error 'Variable is a GLOBAL variable'
-
---Error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT COUNT(@@SESSION.innodb_checksums);
---echo Expected error 'Variable is a GLOBAL variable'
-
-SELECT COUNT(@@GLOBAL.innodb_checksums);
---echo 1 Expected
-
---Error ER_BAD_FIELD_ERROR
-SELECT innodb_checksums = @@SESSION.innodb_checksums;
---echo Expected error 'Readonly variable'
-
-
diff --git a/mysql-test/suite/sys_vars/t/innodb_disable_background_merge_basic.test b/mysql-test/suite/sys_vars/t/innodb_disable_background_merge_basic.test
deleted file mode 100644
index 9ab1a90efe1..00000000000
--- a/mysql-test/suite/sys_vars/t/innodb_disable_background_merge_basic.test
+++ /dev/null
@@ -1,12 +0,0 @@
-#
-# Basic test for innodb_disable_background_merge.
-#
-
--- source include/have_innodb.inc
-
-# The config variable is a debug variable
--- source include/have_debug.inc
-
-# Check the default value
-SET @orig = @@global.innodb_disable_background_merge;
-SELECT @orig;
diff --git a/mysql-test/suite/sys_vars/t/innodb_locks_unsafe_for_binlog_basic.test b/mysql-test/suite/sys_vars/t/innodb_locks_unsafe_for_binlog_basic.test
deleted file mode 100644
index 755c5c62c70..00000000000
--- a/mysql-test/suite/sys_vars/t/innodb_locks_unsafe_for_binlog_basic.test
+++ /dev/null
@@ -1,106 +0,0 @@
-
-
-################## mysql-test\t\innodb_locks_unsafe_for_binlog_basic.test #####
-# #
-# Variable Name: innodb_locks_unsafe_for_binlog #
-# Scope: Global #
-# Access Type: Static #
-# Data Type: boolean #
-# #
-# #
-# Creation Date: 2008-02-07 #
-# Author : Sharique Abdullah #
-# #
-# #
-# Description:Test Cases of Dynamic System Variable innodb_locks_unsafe_for_binlog#
-# that checks the behavior of this variable in the following ways #
-# * Value Check #
-# * Scope Check #
-# #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
-# server-system-variables.html #
-# #
-###############################################################################
-
---source include/have_innodb.inc
-
---echo '#---------------------BS_STVARS_031_01----------------------#'
-####################################################################
-# Displaying default value #
-####################################################################
-SELECT COUNT(@@GLOBAL.innodb_locks_unsafe_for_binlog);
---echo 1 Expected
-
-
---echo '#---------------------BS_STVARS_031_02----------------------#'
-####################################################################
-# Check if Value can set #
-####################################################################
-
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@GLOBAL.innodb_locks_unsafe_for_binlog=1;
---echo Expected error 'Read only variable'
-
-SELECT COUNT(@@GLOBAL.innodb_locks_unsafe_for_binlog);
---echo 1 Expected
-
-
-
-
---echo '#---------------------BS_STVARS_031_03----------------------#'
-#################################################################
-# Check if the value in GLOBAL Table matches value in variable #
-#################################################################
-
---disable_warnings
-SELECT IF(@@GLOBAL.innodb_locks_unsafe_for_binlog, "ON", "OFF") = VARIABLE_VALUE
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
-WHERE VARIABLE_NAME='innodb_locks_unsafe_for_binlog';
---enable_warnings
---echo 1 Expected
-
-SELECT COUNT(@@GLOBAL.innodb_locks_unsafe_for_binlog);
---echo 1 Expected
-
---disable_warnings
-SELECT COUNT(VARIABLE_VALUE)
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
-WHERE VARIABLE_NAME='innodb_locks_unsafe_for_binlog';
---enable_warnings
---echo 1 Expected
-
-
-
---echo '#---------------------BS_STVARS_031_04----------------------#'
-################################################################################
-# Check if accessing variable with and without GLOBAL point to same variable #
-################################################################################
-SELECT @@innodb_locks_unsafe_for_binlog = @@GLOBAL.innodb_locks_unsafe_for_binlog;
---echo 1 Expected
-
-
-
---echo '#---------------------BS_STVARS_031_05----------------------#'
-################################################################################
-# Check if innodb_locks_unsafe_for_binlog can be accessed with and without @@ sign #
-################################################################################
-
-SELECT COUNT(@@innodb_locks_unsafe_for_binlog);
---echo 1 Expected
-
---Error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT COUNT(@@local.innodb_locks_unsafe_for_binlog);
---echo Expected error 'Variable is a GLOBAL variable'
-
---Error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT COUNT(@@SESSION.innodb_locks_unsafe_for_binlog);
---echo Expected error 'Variable is a GLOBAL variable'
-
-SELECT COUNT(@@GLOBAL.innodb_locks_unsafe_for_binlog);
---echo 1 Expected
-
---Error ER_BAD_FIELD_ERROR
-SELECT innodb_locks_unsafe_for_binlog = @@SESSION.innodb_locks_unsafe_for_binlog;
---echo Expected error 'Readonly variable'
-
-
diff --git a/mysql-test/suite/sys_vars/t/innodb_rollback_segments_basic.test b/mysql-test/suite/sys_vars/t/innodb_rollback_segments_basic.test
deleted file mode 100644
index 33223d4c064..00000000000
--- a/mysql-test/suite/sys_vars/t/innodb_rollback_segments_basic.test
+++ /dev/null
@@ -1,64 +0,0 @@
-#
-# 2011-08-01 Added
-#
-
---source include/have_innodb.inc
-
-SET @start_global_value = @@global.innodb_rollback_segments;
-SELECT @start_global_value;
-
-#
-# exists as global only
-#
---echo Valid values are zero or above
-SELECT @@global.innodb_rollback_segments >=0;
-SELECT @@global.innodb_rollback_segments <=128;
-SELECT @@global.innodb_rollback_segments;
-
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.innodb_rollback_segments;
-SHOW global variables LIKE 'innodb_rollback_segments';
-SHOW session variables LIKE 'innodb_rollback_segments';
---disable_warnings
-SELECT * FROM information_schema.global_variables
-WHERE variable_name='innodb_rollback_segments';
-SELECT * FROM information_schema.session_variables
-WHERE variable_name='innodb_rollback_segments';
---enable_warnings
-
-#
-# show that it's writable
-#
-SET global innodb_rollback_segments=100;
-SELECT @@global.innodb_rollback_segments;
---disable_warnings
-SELECT * FROM information_schema.global_variables
-WHERE variable_name='innodb_rollback_segments';
-SELECT * FROM information_schema.session_variables
-WHERE variable_name='innodb_rollback_segments';
---enable_warnings
---error ER_GLOBAL_VARIABLE
-SET session innodb_rollback_segments=1;
-
-#
-# incorrect types
-#
---error ER_WRONG_TYPE_FOR_VAR
-SET global innodb_rollback_segments=1.1;
---error ER_WRONG_TYPE_FOR_VAR
-SET global innodb_rollback_segments=1e1;
---error ER_WRONG_TYPE_FOR_VAR
-SET global innodb_rollback_segments="foo";
-SET global innodb_rollback_segments=-7;
-SELECT @@global.innodb_rollback_segments;
---disable_warnings
-SELECT * FROM information_schema.global_variables
-WHERE variable_name='innodb_rollback_segments';
---enable_warnings
-
-#
-# cleanup
-#
-
-SET @@global.innodb_rollback_segments = @start_global_value;
-SELECT @@global.innodb_rollback_segments;
diff --git a/mysql-test/suite/sys_vars/t/innodb_stats_sample_pages_basic.test b/mysql-test/suite/sys_vars/t/innodb_stats_sample_pages_basic.test
deleted file mode 100644
index 0e4fcb508ac..00000000000
--- a/mysql-test/suite/sys_vars/t/innodb_stats_sample_pages_basic.test
+++ /dev/null
@@ -1,72 +0,0 @@
-
-#
-# 2010-01-27 - Added
-#
-
---source include/have_innodb.inc
-
-SET @start_global_value = @@global.innodb_stats_sample_pages;
-SELECT @start_global_value;
-
-#
-# exists as global only
-#
---echo Valid values are one or above
-select @@global.innodb_stats_sample_pages >=1;
-select @@global.innodb_stats_sample_pages;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-select @@session.innodb_stats_sample_pages;
-show global variables like 'innodb_stats_sample_pages';
-show session variables like 'innodb_stats_sample_pages';
---disable_warnings
-select * from information_schema.global_variables where variable_name='innodb_stats_sample_pages';
-select * from information_schema.session_variables where variable_name='innodb_stats_sample_pages';
---enable_warnings
-
-#
-# show that it's writable
-#
-set global innodb_stats_sample_pages=10;
-select @@global.innodb_stats_sample_pages;
---disable_warnings
-select * from information_schema.global_variables where variable_name='innodb_stats_sample_pages';
-select * from information_schema.session_variables where variable_name='innodb_stats_sample_pages';
---enable_warnings
---error ER_GLOBAL_VARIABLE
-set session innodb_stats_sample_pages=1;
-
-#
-# show the default value
-#
-set global innodb_stats_sample_pages=DEFAULT;
-select @@global.innodb_stats_sample_pages;
-
-
-#
-# invalid values
-#
---error ER_WRONG_TYPE_FOR_VAR
-set global innodb_stats_sample_pages = 1.1;
---error ER_WRONG_TYPE_FOR_VAR
-set global innodb_stats_sample_pages = 1e1;
---error ER_WRONG_TYPE_FOR_VAR
-set global innodb_stats_sample_pages = "foo";
---error ER_WRONG_TYPE_FOR_VAR
-set global innodb_stats_sample_pages=' ';
-select @@global.innodb_stats_sample_pages;
---error ER_WRONG_TYPE_FOR_VAR
-set global innodb_stats_sample_pages=" ";
-select @@global.innodb_stats_sample_pages;
-
-set global innodb_stats_sample_pages=-7;
-select @@global.innodb_stats_sample_pages;
---disable_warnings
-select * from information_schema.global_variables where variable_name='innodb_stats_sample_pages';
---enable_warnings
-
-
-#
-# cleanup
-#
-SET @@global.innodb_stats_sample_pages = @start_global_value;
-SELECT @@global.innodb_stats_sample_pages;
diff --git a/mysql-test/suite/sys_vars/t/innodb_stats_transient_sample_pages_basic.test b/mysql-test/suite/sys_vars/t/innodb_stats_transient_sample_pages_basic.test
index 897d3de42e0..d3d50890a8c 100644
--- a/mysql-test/suite/sys_vars/t/innodb_stats_transient_sample_pages_basic.test
+++ b/mysql-test/suite/sys_vars/t/innodb_stats_transient_sample_pages_basic.test
@@ -11,8 +11,8 @@ SELECT @start_global_value;
#
# exists as global only
#
---echo Valid values are zero or above
-SELECT @@global.innodb_stats_transient_sample_pages >=0;
+--echo Valid values are one or above
+SELECT @@global.innodb_stats_transient_sample_pages >=1;
SELECT @@global.innodb_stats_transient_sample_pages;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.innodb_stats_transient_sample_pages;
diff --git a/mysql-test/suite/sys_vars/t/innodb_undo_logs_basic.opt b/mysql-test/suite/sys_vars/t/innodb_undo_logs_basic.opt
new file mode 100644
index 00000000000..71866672bd9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_undo_logs_basic.opt
@@ -0,0 +1 @@
+--innodb-undo-logs=42
diff --git a/mysql-test/suite/sys_vars/t/innodb_undo_logs_basic.test b/mysql-test/suite/sys_vars/t/innodb_undo_logs_basic.test
index f83b5ede247..54ee06d94cb 100644
--- a/mysql-test/suite/sys_vars/t/innodb_undo_logs_basic.test
+++ b/mysql-test/suite/sys_vars/t/innodb_undo_logs_basic.test
@@ -1,97 +1,42 @@
-################## mysql-test/t/innodb_undo_logs_basic.test ############
-# #
-# Variable Name: innodb_undo_logs #
-# Scope: Global #
-# Access Type: Static #
-# Data Type: numeric #
-# #
-# #
-# Creation Date: 2011-07-05 #
-# Author : Sunny Bains #
-# #
-# #
-# Description: Read-only config global variable innodb_undo_logs #
-# * Value check #
-# * Scope check #
-# #
-###############################################################################
+#
+# 2011-08-01 Added
+#
--source include/have_innodb.inc
-####################################################################
-# Display default value #
-####################################################################
-SELECT @@GLOBAL.innodb_undo_logs;
---echo 128 Expected
-
-
-####################################################################
-# Check if value can be set #
-####################################################################
-
-SET @@GLOBAL.innodb_undo_logs=128;
-
-SELECT COUNT(@@GLOBAL.innodb_undo_logs);
---echo 1 Expected
-
-
-################################################################################
-# Check if the value in GLOBAL table matches value in variable #
-################################################################################
+#
+# exists as global only
+#
+SELECT @@global.innodb_undo_logs;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.innodb_undo_logs;
+SHOW global variables LIKE 'innodb_undo_logs';
+SHOW session variables LIKE 'innodb_undo_logs';
--disable_warnings
-SELECT VARIABLE_VALUE
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
-WHERE VARIABLE_NAME='innodb_undo_logs';
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_undo_logs';
+SELECT * FROM information_schema.session_variables
+WHERE variable_name='innodb_undo_logs';
--enable_warnings
---echo 128 Expected
-
-
-################################################################################
-# Check if accessing variable with and without GLOBAL point to same variable #
-################################################################################
-SELECT @@innodb_undo_logs = @@GLOBAL.innodb_undo_logs;
---echo 1 Expected
-
-################################################################################
-# Check if innodb_undo_logs can be accessed with and without @@ sign #
-################################################################################
-
-SELECT COUNT(@@innodb_undo_logs);
---echo 1 Expected
-
---Error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT COUNT(@@local.innodb_undo_logs);
---echo Expected error 'Variable is a GLOBAL variable'
-
---Error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT COUNT(@@SESSION.innodb_undo_logs);
---echo Expected error 'Variable is a GLOBAL variable'
-
---Error ER_BAD_FIELD_ERROR
-SELECT innodb_undo_logs = @@SESSION.innodb_undo_logs;
-
-# Begin Bug 13604034
-# SET GLOBAL INNODB_UNDO_LOGS=0 SUCCEEDS BUT LEADS TO AN ASSERT
-# MAX_UNDO_LOGS > 0
---echo Begin bug 13604034
-select @@innodb_undo_logs;
---echo 128 Expected
-set global innodb_undo_logs = 129;
-select @@innodb_undo_logs;
---echo 128 Expected
-set global innodb_undo_logs = 0;
-select @@innodb_undo_logs;
---echo 1 Expected
-set global innodb_undo_logs = -1;
-select @@innodb_undo_logs;
---echo 1 Expected
-set global innodb_undo_logs = 50;
-select @@innodb_undo_logs;
---echo 50 Expected
-set global innodb_undo_logs = default;
-select @@innodb_undo_logs;
---echo 128 Expected
---echo End bug 13604034
-# End Bug 13604034
+SET global innodb_undo_logs=100;
+SELECT @@global.innodb_undo_logs;
+--error ER_GLOBAL_VARIABLE
+SET session innodb_undo_logs=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+SET global innodb_undo_logs=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+SET global innodb_undo_logs=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+SET global innodb_undo_logs="foo";
+SET global innodb_undo_logs=-7;
+SELECT @@global.innodb_undo_logs;
+--disable_warnings
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_undo_logs';
+--enable_warnings
diff --git a/mysql-test/suite/sys_vars/t/max_long_data_size_basic.test b/mysql-test/suite/sys_vars/t/max_long_data_size_basic.test
deleted file mode 100644
index eefa61bd4b7..00000000000
--- a/mysql-test/suite/sys_vars/t/max_long_data_size_basic.test
+++ /dev/null
@@ -1,17 +0,0 @@
-select @@global.max_long_data_size=20;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-select @@session.max_long_data_size;
-
-# Show that value of the variable matches the value in the GLOBAL I_S table
-SELECT @@global.max_long_data_size = VARIABLE_VALUE
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
-WHERE VARIABLE_NAME='max_long_data_size';
-
-#
-# show that it's read-only
-#
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-set global max_long_data_size=1;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-set session max_long_data_size=1;
-
diff --git a/mysql-test/suite/sys_vars/t/session_track_system_variables_basic.test b/mysql-test/suite/sys_vars/t/session_track_system_variables_basic.test
index 90e6052947c..e58d405cf0a 100644
--- a/mysql-test/suite/sys_vars/t/session_track_system_variables_basic.test
+++ b/mysql-test/suite/sys_vars/t/session_track_system_variables_basic.test
@@ -12,10 +12,10 @@ SELECT @@session.session_track_system_variables;
--echo
--echo # via INFORMATION_SCHEMA.GLOBAL_VARIABLES
-SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'session_track%' ORDER BY VARIABLE_NAME;
+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'session_track_system_variables' ORDER BY VARIABLE_NAME;
--echo # via INFORMATION_SCHEMA.SESSION_VARIABLES
-SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE 'session_track%' ORDER BY VARIABLE_NAME;
+SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE 'session_track_system_variables' ORDER BY VARIABLE_NAME;
# Save the global value to be used to restore the original value.
SET @global_saved_tmp = @@global.session_track_system_variables;
diff --git a/mysql-test/suite/sys_vars/t/thread_pool_stall_limit_basic.test b/mysql-test/suite/sys_vars/t/thread_pool_stall_limit_basic.test
index 9b4e1df7ab0..1ab27907535 100644
--- a/mysql-test/suite/sys_vars/t/thread_pool_stall_limit_basic.test
+++ b/mysql-test/suite/sys_vars/t/thread_pool_stall_limit_basic.test
@@ -1,5 +1,4 @@
# uint global
---source include/not_windows.inc
--source include/not_embedded.inc
SET @start_global_value = @@global.thread_pool_stall_limit;
diff --git a/mysql-test/suite/sys_vars/t/tmp_memory_table_size_basic.test b/mysql-test/suite/sys_vars/t/tmp_memory_table_size_basic.test
deleted file mode 100644
index f5fcb17c8a5..00000000000
--- a/mysql-test/suite/sys_vars/t/tmp_memory_table_size_basic.test
+++ /dev/null
@@ -1,209 +0,0 @@
-###################### tmp_memory_table_size_basic.test ######################
-# #
-# Variable Name: tmp_memory_table_size #
-# Scope: GLOBAL | SESSION #
-# Access Type: Dynamic #
-# Data Type: numeric #
-# #
-# Description: Test Cases of Dynamic System Variable tmp_table_size #
-# that checks the behavior of this variable in the following ways#
-# * Default Value #
-# * Valid & Invalid values #
-# * Scope & Access method #
-# * Data Integrity #
-# #
-###############################################################################
-
---source include/load_sysvars.inc
-
-##############################################################
-# START OF tmp_memory_table_size TESTS #
-##############################################################
-
-#############################################################
-# Save initial value #
-#############################################################
-
-SET @start_global_value = @@global.tmp_memory_table_size;
-SET @start_session_value = @@session.tmp_memory_table_size;
-
---echo '#--------------------FN_DYNVARS_005_01-------------------------#'
-##############################################################
-# Display the DEFAULT value of tmp_memory_table_size #
-##############################################################
-
-SET @@global.tmp_memory_table_size = 10000;
-SELECT @@global.tmp_memory_table_size;
-SET @@global.tmp_memory_table_size = DEFAULT;
-SELECT @@global.tmp_memory_table_size;
-
-SET @@session.tmp_memory_table_size = 20000;
-SELECT @@session.tmp_memory_table_size;
-SET @@session.tmp_memory_table_size = DEFAULT;
-SELECT @@session.tmp_memory_table_size;
-
---echo '#--------------------FN_DYNVARS_005_02-------------------------#'
-########################################################################
-# Check the DEFAULT value of tmp_memory_table_size #
-########################################################################
-# The DEFAULT value is system dependend.
-# Therefore we have only a plausibility check here
-SELECT @@global.tmp_memory_table_size >= 16777216;
-SELECT @@session.tmp_memory_table_size >= 16777216;
-
---echo '#--------------------FN_DYNVARS_005_03-------------------------#'
-########################################################################
-# Change the value of tmp_memory_table_size to a valid value for GLOBAL Scope #
-########################################################################
-
-SET @@global.tmp_memory_table_size = 1024;
-SELECT @@global.tmp_memory_table_size;
-SET @@global.tmp_memory_table_size = 60020;
-SELECT @@global.tmp_memory_table_size;
-SET @@global.tmp_memory_table_size = 4294967295;
-SELECT @@global.tmp_memory_table_size;
-
-
---echo '#--------------------FN_DYNVARS_005_04-------------------------#'
-#########################################################################
-# Change the value of tmp_memory_table_size to a valid value for SESSION Scope #
-#########################################################################
-
-SET @@session.tmp_memory_table_size = 1024;
-SELECT @@session.tmp_memory_table_size;
-
-SET @@session.tmp_memory_table_size = 4294967295;
-SELECT @@session.tmp_memory_table_size;
-SET @@session.tmp_memory_table_size = 65535;
-SELECT @@session.tmp_memory_table_size;
-
-
---echo '#------------------FN_DYNVARS_005_05-----------------------#'
-##########################################################
-# Change the value of tmp_memory_table_size to an invalid value #
-##########################################################
-
-SET @@global.tmp_memory_table_size = 0;
-SELECT @@global.tmp_memory_table_size;
-
-SET @@global.tmp_memory_table_size = -1024;
-SELECT @@global.tmp_memory_table_size;
-
-SET @@global.tmp_memory_table_size = 1000;
-SELECT @@global.tmp_memory_table_size;
-
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@global.tmp_memory_table_size = ON;
-
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@global.tmp_memory_table_size = OFF;
-
-SET @@global.tmp_memory_table_size = True;
-SELECT @@global.tmp_memory_table_size;
-
-SET @@global.tmp_memory_table_size = False;
-SELECT @@global.tmp_memory_table_size;
-
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@global.tmp_memory_table_size = 65530.34;
-
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@global.tmp_memory_table_size ="Test";
-
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@session.tmp_memory_table_size = ON;
-
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@session.tmp_memory_table_size = OFF;
-
-SET @@session.tmp_memory_table_size = True;
-SELECT @@session.tmp_memory_table_size;
-
-SET @@session.tmp_memory_table_size = False;
-SELECT @@session.tmp_memory_table_size;
-
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@session.tmp_memory_table_size = "Test";
-
---disable_warnings
-SET @@session.tmp_memory_table_size = 12345678901;
---enable_warnings
-# With a 64 bit mysqld:12345678901,with a 32 bit mysqld: 4294967295
-SELECT @@session.tmp_memory_table_size IN (12345678901,4294967295);
-
---echo '#------------------FN_DYNVARS_005_06-----------------------#'
-####################################################################
-# Check if the value in GLOBAL Table matches value in variable #
-####################################################################
-
-SELECT @@global.tmp_memory_table_size = VARIABLE_VALUE
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
-WHERE VARIABLE_NAME='tmp_memory_table_size';
-
---echo '#------------------FN_DYNVARS_005_07-----------------------#'
-####################################################################
-# Check if the value in SESSION Table matches value in variable #
-####################################################################
-
-SELECT @@session.tmp_memory_table_size = VARIABLE_VALUE
-FROM INFORMATION_SCHEMA.SESSION_VARIABLES
-WHERE VARIABLE_NAME='tmp_memory_table_size';
-
---echo '#---------------------FN_DYNVARS_001_09----------------------#'
-########################################################################
-# Check if global and session variables are independent of each other #
-########################################################################
-
-SET @@global.tmp_memory_table_size = 1024;
-SET @@tmp_memory_table_size = 4294967295;
-SELECT @@tmp_memory_table_size = @@global.tmp_memory_table_size;
-
---echo '#---------------------FN_DYNVARS_001_10----------------------#'
-##################################################################
-# Check if accessing variable with SESSION,LOCAL and without #
-# SCOPE points to same session variable #
-##################################################################
-
-SET @@tmp_memory_table_size = 100;
-SELECT @@tmp_memory_table_size = @@local.tmp_memory_table_size;
-SELECT @@local.tmp_memory_table_size = @@session.tmp_memory_table_size;
-
-
---echo '#---------------------FN_DYNVARS_001_11----------------------#'
-#########################################################################
-# Check if tmp_memory_table_size can be accessed with and without @@ sign #
-#########################################################################
-
-SET tmp_memory_table_size = 1027;
-SELECT @@tmp_memory_table_size;
-
---Error ER_UNKNOWN_TABLE
-SELECT local.tmp_memory_table_size;
-
---Error ER_UNKNOWN_TABLE
-SELECT global.tmp_memory_table_size;
-
---Error ER_BAD_FIELD_ERROR
-SELECT tmp_memory_table_size = @@session.tmp_memory_table_size;
-
---echo
---echo "Check that tmp_memory_table_size and tmp_table_size are the same"
---echo
-
-set @@session.tmp_memory_table_size=100000;
-select @@session.tmp_memory_table_size,@@session.tmp_table_size;
-set @@session.tmp_memory_table_size=200000;
-select @@session.tmp_memory_table_size,@@session.tmp_table_size;
-
-
-####################################
-# Restore initial value #
-####################################
-
-SET @@global.tmp_memory_table_size = @start_global_value;
-SET @@session.tmp_memory_table_size = @start_session_value;
-
-###################################################
-# END OF tmp_memory_table_size TESTS #
-###################################################
-
diff --git a/mysql-test/suite/sys_vars/t/tmp_table_size_basic.test b/mysql-test/suite/sys_vars/t/tmp_table_size_basic.test
deleted file mode 100644
index 116196ddb07..00000000000
--- a/mysql-test/suite/sys_vars/t/tmp_table_size_basic.test
+++ /dev/null
@@ -1,207 +0,0 @@
-########################### tmp_table_size_basic.test ##########################
-# #
-# Variable Name: tmp_table_size #
-# Scope: GLOBAL | SESSION #
-# Access Type: Dynamic #
-# Data Type: numeric #
-# Default Value: system dependend #
-# Range: 1024-system dependend #
-# #
-# #
-# Creation Date: 2008-02-13 #
-# Author: Salman #
-# #
-# Description: Test Cases of Dynamic System Variable tmp_table_size #
-# that checks the behavior of this variable in the following ways #
-# * Default Value #
-# * Valid & Invalid values #
-# * Scope & Access method #
-# * Data Integrity #
-# Modified: 2008-12-04 HHunger #
-# removed the differences between 64 and 32 bit platforms #
-# #
-# Reference: #
-# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
-# #
-################################################################################
-
---source include/load_sysvars.inc
-
-##############################################################
-# START OF tmp_table_size TESTS #
-##############################################################
-
-#############################################################
-# Save initial value #
-#############################################################
-
-SET @start_global_value = @@global.tmp_table_size;
-SET @start_session_value = @@session.tmp_table_size;
-
---echo '#--------------------FN_DYNVARS_005_01-------------------------#'
-##############################################################
-# Display the DEFAULT value of tmp_table_size #
-##############################################################
-
-SET @@global.tmp_table_size = 100;
-SET @@global.tmp_table_size = DEFAULT;
-
-SET @@session.tmp_table_size = 200;
-SET @@session.tmp_table_size = DEFAULT;
-
---echo '#--------------------FN_DYNVARS_005_02-------------------------#'
-########################################################################
-# Check the DEFAULT value of tmp_table_size #
-########################################################################
-# The DEFAULT value is system dependend.
-# Therefore we have only a plausibility check here
-SELECT @@global.tmp_table_size >= 16777216;
-
-SELECT @@session.tmp_table_size >= 16777216;
-
---echo '#--------------------FN_DYNVARS_005_03-------------------------#'
-########################################################################
-# Change the value of tmp_table_size to a valid value for GLOBAL Scope #
-########################################################################
-
-SET @@global.tmp_table_size = 1024;
-SELECT @@global.tmp_table_size;
-SET @@global.tmp_table_size = 60020;
-SELECT @@global.tmp_table_size;
-SET @@global.tmp_table_size = 4294967295;
-SELECT @@global.tmp_table_size;
-
-
---echo '#--------------------FN_DYNVARS_005_04-------------------------#'
-#########################################################################
-# Change the value of tmp_table_size to a valid value for SESSION Scope #
-#########################################################################
-
-SET @@session.tmp_table_size = 1024;
-SELECT @@session.tmp_table_size;
-
-SET @@session.tmp_table_size = 4294967295;
-SELECT @@session.tmp_table_size;
-SET @@session.tmp_table_size = 65535;
-SELECT @@session.tmp_table_size;
-
-
---echo '#------------------FN_DYNVARS_005_05-----------------------#'
-##########################################################
-# Change the value of tmp_table_size to an invalid value #
-##########################################################
-
-SET @@global.tmp_table_size = 0;
-SELECT @@global.tmp_table_size;
-
-SET @@global.tmp_table_size = -1024;
-SELECT @@global.tmp_table_size;
-
-SET @@global.tmp_table_size = 1000;
-SELECT @@global.tmp_table_size;
-
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@global.tmp_table_size = ON;
-
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@global.tmp_table_size = OFF;
-
-SET @@global.tmp_table_size = True;
-SELECT @@global.tmp_table_size;
-
-SET @@global.tmp_table_size = False;
-SELECT @@global.tmp_table_size;
-
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@global.tmp_table_size = 65530.34;
-
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@global.tmp_table_size ="Test";
-
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@session.tmp_table_size = ON;
-
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@session.tmp_table_size = OFF;
-
-SET @@session.tmp_table_size = True;
-SELECT @@session.tmp_table_size;
-
-SET @@session.tmp_table_size = False;
-SELECT @@session.tmp_table_size;
-
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@session.tmp_table_size = "Test";
-
---disable_warnings
-SET @@session.tmp_table_size = 12345678901;
---enable_warnings
-# With a 64 bit mysqld:12345678901,with a 32 bit mysqld: 4294967295
-SELECT @@session.tmp_table_size IN (12345678901,4294967295);
-
---echo '#------------------FN_DYNVARS_005_06-----------------------#'
-####################################################################
-# Check if the value in GLOBAL Table matches value in variable #
-####################################################################
-
-SELECT @@global.tmp_table_size = VARIABLE_VALUE
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
-WHERE VARIABLE_NAME='tmp_table_size';
-
---echo '#------------------FN_DYNVARS_005_07-----------------------#'
-####################################################################
-# Check if the value in SESSION Table matches value in variable #
-####################################################################
-
-SELECT @@session.tmp_table_size = VARIABLE_VALUE
-FROM INFORMATION_SCHEMA.SESSION_VARIABLES
-WHERE VARIABLE_NAME='tmp_table_size';
-
---echo '#---------------------FN_DYNVARS_001_09----------------------#'
-########################################################################
-# Check if global and session variables are independent of each other #
-########################################################################
-
-SET @@global.tmp_table_size = 1024;
-SET @@tmp_table_size = 4294967295;
-SELECT @@tmp_table_size = @@global.tmp_table_size;
-
---echo '#---------------------FN_DYNVARS_001_10----------------------#'
-##################################################################
-# Check if accessing variable with SESSION,LOCAL and without #
-# SCOPE points to same session variable #
-##################################################################
-
-SET @@tmp_table_size = 100;
-SELECT @@tmp_table_size = @@local.tmp_table_size;
-SELECT @@local.tmp_table_size = @@session.tmp_table_size;
-
-
---echo '#---------------------FN_DYNVARS_001_11----------------------#'
-#########################################################################
-# Check if tmp_table_size can be accessed with and without @@ sign #
-#########################################################################
-
-SET tmp_table_size = 1027;
-SELECT @@tmp_table_size;
-
---Error ER_UNKNOWN_TABLE
-SELECT local.tmp_table_size;
-
---Error ER_UNKNOWN_TABLE
-SELECT global.tmp_table_size;
-
---Error ER_BAD_FIELD_ERROR
-SELECT tmp_table_size = @@session.tmp_table_size;
-
-####################################
-# Restore initial value #
-####################################
-
-SET @@global.tmp_table_size = @start_global_value;
-SET @@session.tmp_table_size = @start_session_value;
-
-###################################################
-# END OF tmp_table_size TESTS #
-###################################################
-
diff --git a/mysql-test/suite/vcol/r/vcol_keys_innodb.result b/mysql-test/suite/vcol/r/vcol_keys_innodb.result
index f3bbd6039eb..ae202637cb6 100644
--- a/mysql-test/suite/vcol/r/vcol_keys_innodb.result
+++ b/mysql-test/suite/vcol/r/vcol_keys_innodb.result
@@ -239,7 +239,7 @@ col_dec decimal(18,9) not null default 0,
col_enum enum('','a','b','c','d','e','f','foo','bar') not null default '',
col_date date not null default '1900-01-01',
col_timestamp timestamp(3) not null default '1971-01-01 00:00:00',
-vcol_datetime datetime as (col_datetime) virtual,
+vcol_datetime datetime as (truncate(col_datetime,0)) virtual,
vcol_dec decimal(18,9) zerofill as (col_dec) virtual,
vcol_bit bit(63) as (col_bit) virtual,
vcol_char binary(51) as (col_char) virtual,
@@ -257,11 +257,6 @@ insert into t1 (col_varchar,col_int,col_datetime,col_time,col_blob,col_bit,col_y
('foo',1,'2010-05-08 13:08:12.034783','18:32:14','foo',b'0111110101001001',1992,'f',0.2,'','1994-12-26','2019-01-11 00:00:00'),
('bar',6,'1900-01-01 00:00:00','00:00:00','bar',b'10011000001101011000101',1985,'b',0.7,'','2028-04-06','1971-01-01 00:00:00');
alter table t1 add index(vcol_datetime);
-Warnings:
-Warning 1901 Function or expression '`col_datetime`' cannot be used in the GENERATED ALWAYS AS clause of `vcol_datetime`
-Warning 1105 Expression depends on the @@sql_mode value TIME_ROUND_FRACTIONAL
-Warning 1901 Function or expression '`col_datetime`' cannot be used in the GENERATED ALWAYS AS clause of `vcol_datetime`
-Warning 1105 Expression depends on the @@sql_mode value TIME_ROUND_FRACTIONAL
drop table t1;
create table t1 (
pk int,
diff --git a/mysql-test/suite/vcol/r/vcol_sql_mode.result b/mysql-test/suite/vcol/r/vcol_sql_mode.result
index ecbafc87b84..ba75aeb0e6c 100644
--- a/mysql-test/suite/vcol/r/vcol_sql_mode.result
+++ b/mysql-test/suite/vcol/r/vcol_sql_mode.result
@@ -26,46 +26,31 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 (a CHAR(5), v TIME AS (a) VIRTUAL, KEY(v));
-Warnings:
-Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value TIME_ROUND_FRACTIONAL
-DROP TABLE t1;
+ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
CREATE TABLE t1 (c CHAR(8), v BINARY(8) AS (c), KEY(v));
-Warnings:
-Warning 1901 Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
+ERROR HY000: Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
SHOW WARNINGS;
Level Code Message
-Warning 1901 Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
+Error 1901 Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-DROP TABLE t1;
CREATE TABLE t1 (a CHAR(5), v BIT(64) AS (a) VIRTUAL, KEY(v));
-Warnings:
-Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
+ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
SHOW WARNINGS;
Level Code Message
-Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
+Error 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-DROP TABLE t1;
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (a) VIRTUAL, KEY(v));
-Warnings:
-Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
+ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
SHOW WARNINGS;
Level Code Message
-Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
+Error 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-DROP TABLE t1;
CREATE TABLE t1 (a CHAR(5), v TEXT AS (a) VIRTUAL, KEY(v(100)));
-Warnings:
-Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
+ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
SHOW WARNINGS;
Level Code Message
-Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
+Error 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-DROP TABLE t1;
# PAD_CHAR_TO_FULL_LENGTH + TRIM resolving dependency
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (RTRIM(a)) VIRTUAL, KEY(v));
SHOW CREATE TABLE t1;
@@ -141,94 +126,67 @@ t1 CREATE TABLE `t1` (
DROP TABLE t1;
# PAD_CHAR_TO_FULL_LENGTH + TRIM not resolving dependency
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (TRIM(LEADING ' ' FROM a)) VIRTUAL, KEY(v));
-Warnings:
-Warning 1901 Function or expression 'trim(leading ' ' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
+ERROR HY000: Function or expression 'trim(leading ' ' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
SHOW WARNINGS;
Level Code Message
-Warning 1901 Function or expression 'trim(leading ' ' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
+Error 1901 Function or expression 'trim(leading ' ' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-DROP TABLE t1;
CREATE TABLE t1 (a CHAR(5), v TEXT AS (TRIM(LEADING ' ' FROM a)) VIRTUAL, KEY(v(100)));
-Warnings:
-Warning 1901 Function or expression 'trim(leading ' ' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
+ERROR HY000: Function or expression 'trim(leading ' ' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
SHOW WARNINGS;
Level Code Message
-Warning 1901 Function or expression 'trim(leading ' ' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
+Error 1901 Function or expression 'trim(leading ' ' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-DROP TABLE t1;
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (TRIM(TRAILING '' FROM a)) VIRTUAL, KEY(v));
-Warnings:
-Warning 1901 Function or expression 'trim(trailing '' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
+ERROR HY000: Function or expression 'trim(trailing '' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
SHOW WARNINGS;
Level Code Message
-Warning 1901 Function or expression 'trim(trailing '' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
+Error 1901 Function or expression 'trim(trailing '' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-DROP TABLE t1;
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (TRIM(BOTH '' FROM a)) VIRTUAL, KEY(v));
-Warnings:
-Warning 1901 Function or expression 'trim(both '' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
+ERROR HY000: Function or expression 'trim(both '' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
SHOW WARNINGS;
Level Code Message
-Warning 1901 Function or expression 'trim(both '' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
+Error 1901 Function or expression 'trim(both '' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-DROP TABLE t1;
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (TRIM(TRAILING 'x' FROM a)) VIRTUAL, KEY(v));
-Warnings:
-Warning 1901 Function or expression 'trim(trailing 'x' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
+ERROR HY000: Function or expression 'trim(trailing 'x' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
SHOW WARNINGS;
Level Code Message
-Warning 1901 Function or expression 'trim(trailing 'x' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
+Error 1901 Function or expression 'trim(trailing 'x' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-DROP TABLE t1;
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (TRIM(BOTH 'x' FROM a)) VIRTUAL, KEY(v));
-Warnings:
-Warning 1901 Function or expression 'trim(both 'x' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
+ERROR HY000: Function or expression 'trim(both 'x' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
SHOW WARNINGS;
Level Code Message
-Warning 1901 Function or expression 'trim(both 'x' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
+Error 1901 Function or expression 'trim(both 'x' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-DROP TABLE t1;
CREATE TABLE t1 (
a CHAR(5),
v VARCHAR(5) AS (TRIM(TRAILING ' ' FROM a)) VIRTUAL, KEY(v));
-Warnings:
-Warning 1901 Function or expression 'trim(trailing ' ' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
+ERROR HY000: Function or expression 'trim(trailing ' ' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
SHOW WARNINGS;
Level Code Message
-Warning 1901 Function or expression 'trim(trailing ' ' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
+Error 1901 Function or expression 'trim(trailing ' ' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-DROP TABLE t1;
CREATE TABLE t1 (
a CHAR(5),
v VARCHAR(5) AS (TRIM(BOTH ' ' FROM a)) VIRTUAL, KEY(v));
-Warnings:
-Warning 1901 Function or expression 'trim(both ' ' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
+ERROR HY000: Function or expression 'trim(both ' ' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
SHOW WARNINGS;
Level Code Message
-Warning 1901 Function or expression 'trim(both ' ' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
+Error 1901 Function or expression 'trim(both ' ' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-DROP TABLE t1;
# PAD_CHAR_TO_FULL_LENGTH + TRIM(... non_constant FROM a)
CREATE TABLE t1 (
a CHAR(5),
b CHAR(5),
v TEXT AS (TRIM(TRAILING b FROM a)) VIRTUAL, KEY(v(100)));
-Warnings:
-Warning 1901 Function or expression 'trim(trailing `b` from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
+ERROR HY000: Function or expression 'trim(trailing `b` from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
SHOW WARNINGS;
Level Code Message
-Warning 1901 Function or expression 'trim(trailing `b` from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
+Error 1901 Function or expression 'trim(trailing `b` from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-DROP TABLE t1;
# PAD_CHAR_TO_FULL_LENGTH + RPAD resolving dependency
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (RPAD(a,5,' ')) VIRTUAL, KEY(v));
SHOW CREATE TABLE t1;
@@ -268,28 +226,22 @@ t1 CREATE TABLE `t1` (
DROP TABLE t1;
# PAD_CHAR_TO_FULL_LENGTH + RPAD not resolving dependency
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (RPAD(a,4,' ')) VIRTUAL, KEY(v));
-Warnings:
-Warning 1901 Function or expression 'rpad(`a`,4,' ')' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
+ERROR HY000: Function or expression 'rpad(`a`,4,' ')' cannot be used in the GENERATED ALWAYS AS clause of `v`
SHOW WARNINGS;
Level Code Message
-Warning 1901 Function or expression 'rpad(`a`,4,' ')' cannot be used in the GENERATED ALWAYS AS clause of `v`
+Error 1901 Function or expression 'rpad(`a`,4,' ')' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-DROP TABLE t1;
CREATE TABLE t1 (
a CHAR(5),
b CHAR(5),
v VARCHAR(5) AS (RPAD(a,NULL,b)) VIRTUAL,
KEY(v)
);
-Warnings:
-Warning 1901 Function or expression 'rpad(`a`,NULL,`b`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
+ERROR HY000: Function or expression 'rpad(`a`,NULL,`b`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
SHOW WARNINGS;
Level Code Message
-Warning 1901 Function or expression 'rpad(`a`,NULL,`b`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
+Error 1901 Function or expression 'rpad(`a`,NULL,`b`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-DROP TABLE t1;
# PAD_CHAR_TO_FULL_LENGTH + comparison
CREATE TABLE t1 (a CHAR(5), v INT AS (a='a') VIRTUAL, KEY(v));
SHOW CREATE TABLE t1;
@@ -304,14 +256,11 @@ CREATE TABLE t1 (
a CHAR(5) CHARACTER SET latin1 COLLATE latin1_nopad_bin,
v INT AS (a='a') VIRTUAL, KEY(v)
);
-Warnings:
-Warning 1901 Function or expression '`a` = 'a'' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
+ERROR HY000: Function or expression '`a` = 'a'' cannot be used in the GENERATED ALWAYS AS clause of `v`
SHOW WARNINGS;
Level Code Message
-Warning 1901 Function or expression '`a` = 'a'' cannot be used in the GENERATED ALWAYS AS clause of `v`
+Error 1901 Function or expression '`a` = 'a'' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-DROP TABLE t1;
# PAD_CHAR_TO_FULL_LENGTH + LIKE
CREATE TABLE t1 (a CHAR(5), v INT AS (a LIKE 'a%') VIRTUAL, KEY(v));
SHOW CREATE TABLE t1;
@@ -332,24 +281,18 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 (a CHAR(5), v INT AS (a LIKE 'a') VIRTUAL, KEY(v));
-Warnings:
-Warning 1901 Function or expression '`a` like 'a'' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
+ERROR HY000: Function or expression '`a` like 'a'' cannot be used in the GENERATED ALWAYS AS clause of `v`
SHOW WARNINGS;
Level Code Message
-Warning 1901 Function or expression '`a` like 'a'' cannot be used in the GENERATED ALWAYS AS clause of `v`
+Error 1901 Function or expression '`a` like 'a'' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-DROP TABLE t1;
# PAD_CHAR_TO_FULL_LENGTH + LENGTH(char_column) = hard dependency
CREATE TABLE t1 (a CHAR(5), v INT AS (LENGTH(a)) VIRTUAL, KEY(v));
-Warnings:
-Warning 1901 Function or expression 'octet_length(`a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
+ERROR HY000: Function or expression 'octet_length(`a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
SHOW WARNINGS;
Level Code Message
-Warning 1901 Function or expression 'octet_length(`a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
+Error 1901 Function or expression 'octet_length(`a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-DROP TABLE t1;
#
# Testing NO_UNSIGNED_SUBTRACTION
#
@@ -359,42 +302,33 @@ b INT UNSIGNED,
c INT GENERATED ALWAYS AS (a-b) VIRTUAL,
KEY (c)
);
-Warnings:
-Warning 1901 Function or expression '`a` - `b`' cannot be used in the GENERATED ALWAYS AS clause of `c`
-Warning 1105 Expression depends on the @@sql_mode value NO_UNSIGNED_SUBTRACTION
+ERROR HY000: Function or expression '`a` - `b`' cannot be used in the GENERATED ALWAYS AS clause of `c`
SHOW WARNINGS;
Level Code Message
-Warning 1901 Function or expression '`a` - `b`' cannot be used in the GENERATED ALWAYS AS clause of `c`
+Error 1901 Function or expression '`a` - `b`' cannot be used in the GENERATED ALWAYS AS clause of `c`
Warning 1105 Expression depends on the @@sql_mode value NO_UNSIGNED_SUBTRACTION
-DROP TABLE t1;
CREATE TABLE t1 (
a INT UNSIGNED,
b INT UNSIGNED,
c INT GENERATED ALWAYS AS (CAST(a AS SIGNED)-b) VIRTUAL,
KEY (c)
);
-Warnings:
-Warning 1901 Function or expression 'cast(`a` as signed) - `b`' cannot be used in the GENERATED ALWAYS AS clause of `c`
-Warning 1105 Expression depends on the @@sql_mode value NO_UNSIGNED_SUBTRACTION
+ERROR HY000: Function or expression 'cast(`a` as signed) - `b`' cannot be used in the GENERATED ALWAYS AS clause of `c`
SHOW WARNINGS;
Level Code Message
-Warning 1901 Function or expression 'cast(`a` as signed) - `b`' cannot be used in the GENERATED ALWAYS AS clause of `c`
+Error 1901 Function or expression 'cast(`a` as signed) - `b`' cannot be used in the GENERATED ALWAYS AS clause of `c`
Warning 1105 Expression depends on the @@sql_mode value NO_UNSIGNED_SUBTRACTION
-DROP TABLE t1;
CREATE TABLE t1 (
a INT UNSIGNED,
b INT UNSIGNED,
c INT GENERATED ALWAYS AS (a-CAST(b AS SIGNED)) VIRTUAL,
KEY (c)
);
-Warnings:
-Warning 1901 Function or expression '`a` - cast(`b` as signed)' cannot be used in the GENERATED ALWAYS AS clause of `c`
-Warning 1105 Expression depends on the @@sql_mode value NO_UNSIGNED_SUBTRACTION
+ERROR HY000: Function or expression '`a` - cast(`b` as signed)' cannot be used in the GENERATED ALWAYS AS clause of `c`
SHOW WARNINGS;
Level Code Message
-Warning 1901 Function or expression '`a` - cast(`b` as signed)' cannot be used in the GENERATED ALWAYS AS clause of `c`
+Error 1901 Function or expression '`a` - cast(`b` as signed)' cannot be used in the GENERATED ALWAYS AS clause of `c`
Warning 1105 Expression depends on the @@sql_mode value NO_UNSIGNED_SUBTRACTION
-DROP TABLE t1;
CREATE TABLE t1 (
a INT UNSIGNED,
b INT UNSIGNED,
@@ -435,16 +369,12 @@ c CHAR(5),
v VARCHAR(5) GENERATED ALWAYS AS (RPAD(c,a-b,' ')) VIRTUAL,
KEY (v)
);
-Warnings:
-Warning 1901 Function or expression 'rpad(`c`,`a` - `b`,' ')' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value NO_UNSIGNED_SUBTRACTION
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
+ERROR HY000: Function or expression 'rpad(`c`,`a` - `b`,' ')' cannot be used in the GENERATED ALWAYS AS clause of `v`
SHOW WARNINGS;
Level Code Message
-Warning 1901 Function or expression 'rpad(`c`,`a` - `b`,' ')' cannot be used in the GENERATED ALWAYS AS clause of `v`
+Error 1901 Function or expression 'rpad(`c`,`a` - `b`,' ')' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value NO_UNSIGNED_SUBTRACTION
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-DROP TABLE t1;
CREATE TABLE t1 (
a INT UNSIGNED,
b INT UNSIGNED,
@@ -452,14 +382,11 @@ c CHAR(5),
v VARCHAR(5) GENERATED ALWAYS AS (RPAD(c,CAST(a AS DECIMAL(20,1))-b,' ')) VIRTUAL,
KEY (v)
);
-Warnings:
-Warning 1901 Function or expression 'rpad(`c`,cast(`a` as decimal(20,1)) - `b`,' ')' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
+ERROR HY000: Function or expression 'rpad(`c`,cast(`a` as decimal(20,1)) - `b`,' ')' cannot be used in the GENERATED ALWAYS AS clause of `v`
SHOW WARNINGS;
Level Code Message
-Warning 1901 Function or expression 'rpad(`c`,cast(`a` as decimal(20,1)) - `b`,' ')' cannot be used in the GENERATED ALWAYS AS clause of `v`
+Error 1901 Function or expression 'rpad(`c`,cast(`a` as decimal(20,1)) - `b`,' ')' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-DROP TABLE t1;
# ALTER TABLE ADD KEY(vcol_depending_on_sql_mode) --> error
CREATE TABLE t1 (
a INT UNSIGNED,
@@ -468,62 +395,32 @@ c CHAR(5),
v VARCHAR(5) GENERATED ALWAYS AS (c) VIRTUAL
);
ALTER TABLE t1 ADD KEY(v);
-Warnings:
-Warning 1901 Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-Warning 1901 Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-Warning 1901 Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
+ERROR HY000: Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
SHOW WARNINGS;
Level Code Message
-Warning 1901 Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-Warning 1901 Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-Warning 1901 Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-ALTER TABLE t1 DROP KEY v;
-Warnings:
-Warning 1901 Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
+Error 1901 Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
CREATE INDEX v ON t1 (v);
-Warnings:
-Warning 1901 Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-Warning 1901 Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-Warning 1901 Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
+ERROR HY000: Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
SHOW WARNINGS;
Level Code Message
-Warning 1901 Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-Warning 1901 Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-Warning 1901 Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
+Error 1901 Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
DROP TABLE t1;
# A virtual column on the second position in an index - cannot depend on sql_mode
CREATE TABLE t1 (id int, a CHAR(5), v TEXT AS (a) VIRTUAL, KEY(id, v(100)));
-Warnings:
-Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
+ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
SHOW WARNINGS;
Level Code Message
-Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
+Error 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-DROP TABLE t1;
# A persisten virtual column cannot depend on sql_mode
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (a) PERSISTENT);
-Warnings:
-Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
+ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
SHOW WARNINGS;
Level Code Message
-Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
+Error 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-DROP TABLE t1;
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (RTRIM(a)) PERSISTENT);
SHOW CREATE TABLE t1;
Table Create Table
diff --git a/mysql-test/suite/vcol/r/vcol_sql_mode_datetime.result b/mysql-test/suite/vcol/r/vcol_sql_mode_datetime.result
index 151b95095a8..3033ffb66b4 100644
--- a/mysql-test/suite/vcol/r/vcol_sql_mode_datetime.result
+++ b/mysql-test/suite/vcol/r/vcol_sql_mode_datetime.result
@@ -40,30 +40,21 @@ d DATETIME,
v DATETIME(3) AS (t) VIRTUAL,
KEY(v,d)
);
-Warnings:
-Warning 1901 Function or expression '`t`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value TIME_ROUND_FRACTIONAL
-DROP TABLE t1;
+ERROR HY000: Function or expression '`t`' cannot be used in the GENERATED ALWAYS AS clause of `v`
CREATE TABLE t1 (
t DATETIME(4),
d DATETIME,
v DATETIME(3) AS (COALESCE(t)) VIRTUAL,
KEY(v,d)
);
-Warnings:
-Warning 1901 Function or expression 'coalesce(`t`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value TIME_ROUND_FRACTIONAL
-DROP TABLE t1;
+ERROR HY000: Function or expression 'coalesce(`t`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
CREATE TABLE t1 (
t DATETIME(4),
d DATETIME,
v DATETIME(3) AS ('2001-01-01 10:20:30.1234') VIRTUAL,
KEY(v,d)
);
-Warnings:
-Warning 1901 Function or expression ''2001-01-01 10:20:30.1234'' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value TIME_ROUND_FRACTIONAL
-DROP TABLE t1;
+ERROR HY000: Function or expression ''2001-01-01 10:20:30.1234'' cannot be used in the GENERATED ALWAYS AS clause of `v`
# OK: lower FSP + ROUND + virtual index
SET sql_mode=DEFAULT;
CREATE TABLE t1 (
@@ -104,10 +95,7 @@ a DATETIME(6),
v VARCHAR(30) GENERATED ALWAYS AS (CAST(a AS DATETIME(3))) VIRTUAL,
KEY (v)
);
-Warnings:
-Warning 1901 Function or expression 'cast(`a` as datetime(3))' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value TIME_ROUND_FRACTIONAL
-DROP TABLE t1;
+ERROR HY000: Function or expression 'cast(`a` as datetime(3))' cannot be used in the GENERATED ALWAYS AS clause of `v`
CREATE TABLE t1 (
a DATETIME(6),
v VARCHAR(30) GENERATED ALWAYS AS (TRUNCATE(a,3)) VIRTUAL,
diff --git a/mysql-test/suite/vcol/r/vcol_sql_mode_time.result b/mysql-test/suite/vcol/r/vcol_sql_mode_time.result
index adf650fff9f..300b91726d1 100644
--- a/mysql-test/suite/vcol/r/vcol_sql_mode_time.result
+++ b/mysql-test/suite/vcol/r/vcol_sql_mode_time.result
@@ -40,30 +40,21 @@ d TIME,
v TIME(3) AS (t) VIRTUAL,
KEY(v,d)
);
-Warnings:
-Warning 1901 Function or expression '`t`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value TIME_ROUND_FRACTIONAL
-DROP TABLE t1;
+ERROR HY000: Function or expression '`t`' cannot be used in the GENERATED ALWAYS AS clause of `v`
CREATE TABLE t1 (
t TIME(4),
d TIME,
v TIME(3) AS (COALESCE(t)) VIRTUAL,
KEY(v,d)
);
-Warnings:
-Warning 1901 Function or expression 'coalesce(`t`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value TIME_ROUND_FRACTIONAL
-DROP TABLE t1;
+ERROR HY000: Function or expression 'coalesce(`t`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
CREATE TABLE t1 (
t TIME(4),
d TIME,
v TIME(3) AS ('2001-01-01 10:20:30.1234') VIRTUAL,
KEY(v,d)
);
-Warnings:
-Warning 1901 Function or expression ''2001-01-01 10:20:30.1234'' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value TIME_ROUND_FRACTIONAL
-DROP TABLE t1;
+ERROR HY000: Function or expression ''2001-01-01 10:20:30.1234'' cannot be used in the GENERATED ALWAYS AS clause of `v`
# OK: lower FSP + ROUND + virtual index
SET sql_mode=DEFAULT;
CREATE TABLE t1 (
@@ -104,10 +95,7 @@ a TIME(6),
v VARCHAR(30) GENERATED ALWAYS AS (CAST(a AS TIME(3))) VIRTUAL,
KEY (v)
);
-Warnings:
-Warning 1901 Function or expression 'cast(`a` as time(3))' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value TIME_ROUND_FRACTIONAL
-DROP TABLE t1;
+ERROR HY000: Function or expression 'cast(`a` as time(3))' cannot be used in the GENERATED ALWAYS AS clause of `v`
CREATE TABLE t1 (
a TIME(6),
v VARCHAR(30) GENERATED ALWAYS AS (TRUNCATE(a,3)) VIRTUAL,
diff --git a/mysql-test/suite/vcol/r/vcol_sql_mode_timestamp.result b/mysql-test/suite/vcol/r/vcol_sql_mode_timestamp.result
index 7c82856717d..df1cee04542 100644
--- a/mysql-test/suite/vcol/r/vcol_sql_mode_timestamp.result
+++ b/mysql-test/suite/vcol/r/vcol_sql_mode_timestamp.result
@@ -40,30 +40,21 @@ d DATETIME,
v TIMESTAMP(3) AS (t) VIRTUAL,
KEY(v,d)
);
-Warnings:
-Warning 1901 Function or expression '`t`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value TIME_ROUND_FRACTIONAL
-DROP TABLE t1;
+ERROR HY000: Function or expression '`t`' cannot be used in the GENERATED ALWAYS AS clause of `v`
CREATE TABLE t1 (
t TIMESTAMP(4),
d DATETIME,
v TIMESTAMP(3) AS (COALESCE(t)) VIRTUAL,
KEY(v,d)
);
-Warnings:
-Warning 1901 Function or expression 'coalesce(`t`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value TIME_ROUND_FRACTIONAL
-DROP TABLE t1;
+ERROR HY000: Function or expression 'coalesce(`t`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
CREATE TABLE t1 (
t TIMESTAMP(4),
d DATETIME,
v TIMESTAMP(3) AS ('2001-01-01 10:20:30.1234') VIRTUAL,
KEY(v,d)
);
-Warnings:
-Warning 1901 Function or expression ''2001-01-01 10:20:30.1234'' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value TIME_ROUND_FRACTIONAL
-DROP TABLE t1;
+ERROR HY000: Function or expression ''2001-01-01 10:20:30.1234'' cannot be used in the GENERATED ALWAYS AS clause of `v`
# OK: lower FSP + ROUND + virtual index
SET sql_mode=DEFAULT;
CREATE TABLE t1 (
@@ -105,12 +96,10 @@ b TIMESTAMP AS (a) VIRTUAL,
KEY (b)
);
ALTER TABLE t1 MODIFY a BLOB FIRST;
-Warnings:
-Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `b`
-Warning 1105 Expression depends on the @@sql_mode value TIME_ROUND_FRACTIONAL
-Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `b`
-Warning 1105 Expression depends on the @@sql_mode value TIME_ROUND_FRACTIONAL
-Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `b`
+ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `b`
+SHOW WARNINGS;
+Level Code Message
+Error 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `b`
Warning 1105 Expression depends on the @@sql_mode value TIME_ROUND_FRACTIONAL
DROP TABLE t1;
#
diff --git a/mysql-test/suite/vcol/r/vcol_sql_mode_upgrade.result b/mysql-test/suite/vcol/r/vcol_sql_mode_upgrade.result
index fe1cb7b5779..d3954770c7b 100644
--- a/mysql-test/suite/vcol/r/vcol_sql_mode_upgrade.result
+++ b/mysql-test/suite/vcol/r/vcol_sql_mode_upgrade.result
@@ -52,66 +52,40 @@ Warnings:
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
CREATE TABLE t2 LIKE t1;
-Warnings:
-Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-DROP TABLE t2;
+ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
FLUSH TABLES;
CREATE TABLE t2 LIKE t1;
-Warnings:
-Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-DROP TABLE t2;
+ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(5) DEFAULT NULL,
`v` varchar(5) GENERATED ALWAYS AS (`a`) STORED
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-ALTER TABLE t1 ADD b INT DEFAULT a;
Warnings:
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
+ALTER TABLE t1 ADD b INT DEFAULT a;
+ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(5) DEFAULT NULL,
- `v` varchar(5) GENERATED ALWAYS AS (`a`) STORED,
- `b` int(11) DEFAULT `a`
+ `v` varchar(5) GENERATED ALWAYS AS (`a`) STORED
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-Warnings:
-Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
SELECT * FROM t1;
-a v b
-1 1 1
-2 2 2
-3 3 3
+a v
+1 1
+2 2
+3 3
FLUSH TABLES;
ALTER TABLE t1 ADD c INT DEFAULT a;
-Warnings:
-Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
+ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
SELECT * FROM t1;
-a v b c
-1 1 1 1
-2 2 2 2
-3 3 3 3
-Warnings:
-Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
+a v
+1 1
+2 2
+3 3
DROP TABLE t1;
#
# Fixing a Maria-10.2.26 table with a stored VARCHAR column
@@ -203,18 +177,10 @@ Warnings:
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
CREATE TABLE t2 LIKE t1;
-Warnings:
-Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-DROP TABLE t2;
+ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
FLUSH TABLES;
CREATE TABLE t2 LIKE t1;
-Warnings:
-Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-DROP TABLE t2;
+ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -222,33 +188,19 @@ t1 CREATE TABLE `t1` (
`v` varchar(5) GENERATED ALWAYS AS (`a`) VIRTUAL,
KEY `v` (`v`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-ALTER TABLE t1 ADD b INT DEFAULT a;
Warnings:
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
+ALTER TABLE t1 ADD b INT DEFAULT a;
+ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
FLUSH TABLES;
ALTER TABLE t1 ADD c INT DEFAULT a;
-Warnings:
-Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
-Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
+ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
SELECT * FROM t1;
-a v b c
-1 1 1 1
-2 2 2 2
-3 3 3 3
-Warnings:
-Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
-Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
+a v
+1 1
+2 2
+3 3
DROP TABLE t1;
#
# Fixing a Maria-10.2.26 table with a virtual VARCHAR column
diff --git a/mysql-test/suite/vcol/t/vcol_keys_innodb.test b/mysql-test/suite/vcol/t/vcol_keys_innodb.test
index 58fb8378ac7..15206cde328 100644
--- a/mysql-test/suite/vcol/t/vcol_keys_innodb.test
+++ b/mysql-test/suite/vcol/t/vcol_keys_innodb.test
@@ -80,7 +80,7 @@ create table t1 (
col_enum enum('','a','b','c','d','e','f','foo','bar') not null default '',
col_date date not null default '1900-01-01',
col_timestamp timestamp(3) not null default '1971-01-01 00:00:00',
- vcol_datetime datetime as (col_datetime) virtual,
+ vcol_datetime datetime as (truncate(col_datetime,0)) virtual,
vcol_dec decimal(18,9) zerofill as (col_dec) virtual,
vcol_bit bit(63) as (col_bit) virtual,
vcol_char binary(51) as (col_char) virtual,
diff --git a/mysql-test/suite/vcol/t/vcol_sql_mode.test b/mysql-test/suite/vcol/t/vcol_sql_mode.test
index 44d3686ac01..f52345c7ffb 100644
--- a/mysql-test/suite/vcol/t/vcol_sql_mode.test
+++ b/mysql-test/suite/vcol/t/vcol_sql_mode.test
@@ -18,28 +18,24 @@ CREATE TABLE t1 (a CHAR(5), v INT AS (a) VIRTUAL, KEY(v));
SHOW CREATE TABLE t1;
DROP TABLE t1;
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (a CHAR(5), v TIME AS (a) VIRTUAL, KEY(v));
-DROP TABLE t1;
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (c CHAR(8), v BINARY(8) AS (c), KEY(v));
SHOW WARNINGS;
-DROP TABLE t1;
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (a CHAR(5), v BIT(64) AS (a) VIRTUAL, KEY(v));
SHOW WARNINGS;
-DROP TABLE t1;
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (a) VIRTUAL, KEY(v));
SHOW WARNINGS;
-DROP TABLE t1;
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (a CHAR(5), v TEXT AS (a) VIRTUAL, KEY(v(100)));
SHOW WARNINGS;
-DROP TABLE t1;
--echo # PAD_CHAR_TO_FULL_LENGTH + TRIM resolving dependency
@@ -79,61 +75,52 @@ DROP TABLE t1;
--echo # PAD_CHAR_TO_FULL_LENGTH + TRIM not resolving dependency
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (TRIM(LEADING ' ' FROM a)) VIRTUAL, KEY(v));
SHOW WARNINGS;
-DROP TABLE t1;
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (a CHAR(5), v TEXT AS (TRIM(LEADING ' ' FROM a)) VIRTUAL, KEY(v(100)));
SHOW WARNINGS;
-DROP TABLE t1;
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (TRIM(TRAILING '' FROM a)) VIRTUAL, KEY(v));
SHOW WARNINGS;
-DROP TABLE t1;
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (TRIM(BOTH '' FROM a)) VIRTUAL, KEY(v));
SHOW WARNINGS;
-DROP TABLE t1;
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (TRIM(TRAILING 'x' FROM a)) VIRTUAL, KEY(v));
SHOW WARNINGS;
-DROP TABLE t1;
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (TRIM(BOTH 'x' FROM a)) VIRTUAL, KEY(v));
SHOW WARNINGS;
-DROP TABLE t1;
# more than one space
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (
a CHAR(5),
v VARCHAR(5) AS (TRIM(TRAILING ' ' FROM a)) VIRTUAL, KEY(v));
SHOW WARNINGS;
-DROP TABLE t1;
# more than one space
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (
a CHAR(5),
v VARCHAR(5) AS (TRIM(BOTH ' ' FROM a)) VIRTUAL, KEY(v));
SHOW WARNINGS;
-DROP TABLE t1;
--echo # PAD_CHAR_TO_FULL_LENGTH + TRIM(... non_constant FROM a)
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (
a CHAR(5),
b CHAR(5),
v TEXT AS (TRIM(TRAILING b FROM a)) VIRTUAL, KEY(v(100)));
SHOW WARNINGS;
-DROP TABLE t1;
--echo # PAD_CHAR_TO_FULL_LENGTH + RPAD resolving dependency
@@ -157,12 +144,11 @@ DROP TABLE t1;
--echo # PAD_CHAR_TO_FULL_LENGTH + RPAD not resolving dependency
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (RPAD(a,4,' ')) VIRTUAL, KEY(v));
SHOW WARNINGS;
-DROP TABLE t1;
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (
a CHAR(5),
b CHAR(5),
@@ -170,7 +156,6 @@ CREATE TABLE t1 (
KEY(v)
);
SHOW WARNINGS;
-DROP TABLE t1;
--echo # PAD_CHAR_TO_FULL_LENGTH + comparison
@@ -179,13 +164,12 @@ CREATE TABLE t1 (a CHAR(5), v INT AS (a='a') VIRTUAL, KEY(v));
SHOW CREATE TABLE t1;
DROP TABLE t1;
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (
a CHAR(5) CHARACTER SET latin1 COLLATE latin1_nopad_bin,
v INT AS (a='a') VIRTUAL, KEY(v)
);
SHOW WARNINGS;
-DROP TABLE t1;
--echo # PAD_CHAR_TO_FULL_LENGTH + LIKE
@@ -198,25 +182,23 @@ CREATE TABLE t1 (a CHAR(5), v INT AS (a LIKE NULL) VIRTUAL, KEY(v));
SHOW CREATE TABLE t1;
DROP TABLE t1;
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (a CHAR(5), v INT AS (a LIKE 'a') VIRTUAL, KEY(v));
SHOW WARNINGS;
-DROP TABLE t1;
--echo # PAD_CHAR_TO_FULL_LENGTH + LENGTH(char_column) = hard dependency
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (a CHAR(5), v INT AS (LENGTH(a)) VIRTUAL, KEY(v));
SHOW WARNINGS;
-DROP TABLE t1;
--echo #
--echo # Testing NO_UNSIGNED_SUBTRACTION
--echo #
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (
a INT UNSIGNED,
b INT UNSIGNED,
@@ -224,9 +206,8 @@ CREATE TABLE t1 (
KEY (c)
);
SHOW WARNINGS;
-DROP TABLE t1;
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (
a INT UNSIGNED,
b INT UNSIGNED,
@@ -234,9 +215,8 @@ CREATE TABLE t1 (
KEY (c)
);
SHOW WARNINGS;
-DROP TABLE t1;
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (
a INT UNSIGNED,
b INT UNSIGNED,
@@ -244,7 +224,6 @@ CREATE TABLE t1 (
KEY (c)
);
SHOW WARNINGS;
-DROP TABLE t1;
CREATE TABLE t1 (
a INT UNSIGNED,
@@ -271,7 +250,7 @@ DROP TABLE t1;
--echo # Comnination: PAD_CHAR_TO_FULL_LENGTH + NO_UNSIGNED_SUBTRACTION
--echo #
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (
a INT UNSIGNED,
b INT UNSIGNED,
@@ -280,14 +259,13 @@ CREATE TABLE t1 (
KEY (v)
);
SHOW WARNINGS;
-DROP TABLE t1;
# The below solves the dependency on NO_UNSIGNED_SUBTRACTION
# but does not solve the dependency on PAD_CHAR_TO_FULL_LENGTH,
# because the 'length' argument to RPAD() is not a constant.
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (
a INT UNSIGNED,
b INT UNSIGNED,
@@ -296,7 +274,6 @@ CREATE TABLE t1 (
KEY (v)
);
SHOW WARNINGS;
-DROP TABLE t1;
@@ -314,12 +291,10 @@ CREATE TABLE t1 (
c CHAR(5),
v VARCHAR(5) GENERATED ALWAYS AS (c) VIRTUAL
);
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
ALTER TABLE t1 ADD KEY(v);
SHOW WARNINGS;
-ALTER TABLE t1 DROP KEY v;
-
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE INDEX v ON t1 (v);
SHOW WARNINGS;
DROP TABLE t1;
@@ -327,18 +302,16 @@ DROP TABLE t1;
--echo # A virtual column on the second position in an index - cannot depend on sql_mode
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (id int, a CHAR(5), v TEXT AS (a) VIRTUAL, KEY(id, v(100)));
SHOW WARNINGS;
-DROP TABLE t1;
--echo # A persisten virtual column cannot depend on sql_mode
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (a) PERSISTENT);
SHOW WARNINGS;
-DROP TABLE t1;
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (RTRIM(a)) PERSISTENT);
SHOW CREATE TABLE t1;
diff --git a/mysql-test/suite/vcol/t/vcol_sql_mode_datetime.test b/mysql-test/suite/vcol/t/vcol_sql_mode_datetime.test
index bef1e09b719..19ebd9648a7 100644
--- a/mysql-test/suite/vcol/t/vcol_sql_mode_datetime.test
+++ b/mysql-test/suite/vcol/t/vcol_sql_mode_datetime.test
@@ -47,32 +47,29 @@ DROP TABLE t1;
--echo # NOT OK: lower FSP + virtual index
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (
t DATETIME(4),
d DATETIME,
v DATETIME(3) AS (t) VIRTUAL,
KEY(v,d)
);
-DROP TABLE t1;
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (
t DATETIME(4),
d DATETIME,
v DATETIME(3) AS (COALESCE(t)) VIRTUAL,
KEY(v,d)
);
-DROP TABLE t1;
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (
t DATETIME(4),
d DATETIME,
v DATETIME(3) AS ('2001-01-01 10:20:30.1234') VIRTUAL,
KEY(v,d)
);
-DROP TABLE t1;
--echo # OK: lower FSP + ROUND + virtual index
@@ -110,13 +107,12 @@ SET sql_mode=DEFAULT;
--echo # MDEV-20423 Assertion `0' failed or `btr_validate_index(index, 0, false)' in row_upd_sec_index_entry or error code 126: Index is corrupted upon DELETE with TIME_ROUND_FRACTIONAL
--echo #
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (
a DATETIME(6),
v VARCHAR(30) GENERATED ALWAYS AS (CAST(a AS DATETIME(3))) VIRTUAL,
KEY (v)
);
-DROP TABLE t1;
CREATE TABLE t1 (
a DATETIME(6),
diff --git a/mysql-test/suite/vcol/t/vcol_sql_mode_time.test b/mysql-test/suite/vcol/t/vcol_sql_mode_time.test
index 05160a43ebb..2ce2a9eb5d7 100644
--- a/mysql-test/suite/vcol/t/vcol_sql_mode_time.test
+++ b/mysql-test/suite/vcol/t/vcol_sql_mode_time.test
@@ -47,32 +47,29 @@ DROP TABLE t1;
--echo # NOT OK: lower FSP + virtual index
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (
t TIME(4),
d TIME,
v TIME(3) AS (t) VIRTUAL,
KEY(v,d)
);
-DROP TABLE t1;
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (
t TIME(4),
d TIME,
v TIME(3) AS (COALESCE(t)) VIRTUAL,
KEY(v,d)
);
-DROP TABLE t1;
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (
t TIME(4),
d TIME,
v TIME(3) AS ('2001-01-01 10:20:30.1234') VIRTUAL,
KEY(v,d)
);
-DROP TABLE t1;
--echo # OK: lower FSP + ROUND + virtual index
@@ -111,13 +108,12 @@ SET sql_mode=DEFAULT;
--echo # MDEV-20423 Assertion `0' failed or `btr_validate_index(index, 0, false)' in row_upd_sec_index_entry or error code 126: Index is corrupted upon DELETE with TIME_ROUND_FRACTIONAL
--echo #
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (
a TIME(6),
v VARCHAR(30) GENERATED ALWAYS AS (CAST(a AS TIME(3))) VIRTUAL,
KEY (v)
);
-DROP TABLE t1;
CREATE TABLE t1 (
a TIME(6),
diff --git a/mysql-test/suite/vcol/t/vcol_sql_mode_timestamp.test b/mysql-test/suite/vcol/t/vcol_sql_mode_timestamp.test
index 4f38da75948..e3dee5828f0 100644
--- a/mysql-test/suite/vcol/t/vcol_sql_mode_timestamp.test
+++ b/mysql-test/suite/vcol/t/vcol_sql_mode_timestamp.test
@@ -47,32 +47,29 @@ DROP TABLE t1;
--echo # NOT OK: lower FSP + virtual index
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (
t TIMESTAMP(4),
d DATETIME,
v TIMESTAMP(3) AS (t) VIRTUAL,
KEY(v,d)
);
-DROP TABLE t1;
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (
t TIMESTAMP(4),
d DATETIME,
v TIMESTAMP(3) AS (COALESCE(t)) VIRTUAL,
KEY(v,d)
);
-DROP TABLE t1;
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (
t TIMESTAMP(4),
d DATETIME,
v TIMESTAMP(3) AS ('2001-01-01 10:20:30.1234') VIRTUAL,
KEY(v,d)
);
-DROP TABLE t1;
--echo # OK: lower FSP + ROUND + virtual index
@@ -115,10 +112,11 @@ CREATE TABLE t1 (
b TIMESTAMP AS (a) VIRTUAL,
KEY (b)
);
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
ALTER TABLE t1 MODIFY a BLOB FIRST;
+SHOW WARNINGS;
DROP TABLE t1;
-
--echo #
--echo # End of 10.4 tests
--echo #
diff --git a/mysql-test/suite/vcol/t/vcol_sql_mode_upgrade.test b/mysql-test/suite/vcol/t/vcol_sql_mode_upgrade.test
index 26b76fbcfe1..71e34231ac1 100644
--- a/mysql-test/suite/vcol/t/vcol_sql_mode_upgrade.test
+++ b/mysql-test/suite/vcol/t/vcol_sql_mode_upgrade.test
@@ -25,21 +25,19 @@ SELECT * FROM t1;
FLUSH TABLES;
SELECT * FROM t1;
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t2 LIKE t1;
-DROP TABLE t2;
FLUSH TABLES;
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t2 LIKE t1;
-DROP TABLE t2;
SHOW CREATE TABLE t1;
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
ALTER TABLE t1 ADD b INT DEFAULT a;
SHOW CREATE TABLE t1;
SELECT * FROM t1;
FLUSH TABLES;
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
ALTER TABLE t1 ADD c INT DEFAULT a;
SELECT * FROM t1;
DROP TABLE t1;
@@ -92,20 +90,18 @@ SELECT * FROM t1;
FLUSH TABLES;
SELECT * FROM t1;
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t2 LIKE t1;
-DROP TABLE t2;
FLUSH TABLES;
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t2 LIKE t1;
-DROP TABLE t2;
SHOW CREATE TABLE t1;
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
ALTER TABLE t1 ADD b INT DEFAULT a;
FLUSH TABLES;
-#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
ALTER TABLE t1 ADD c INT DEFAULT a;
SELECT * FROM t1;
DROP TABLE t1;
diff --git a/mysql-test/suite/versioning/r/create.result b/mysql-test/suite/versioning/r/create.result
index ce33a3c6c51..3c15f84c18b 100644
--- a/mysql-test/suite/versioning/r/create.result
+++ b/mysql-test/suite/versioning/r/create.result
@@ -519,7 +519,7 @@ row_start bigint as row start,
row_end bigint as row end,
period for system_time (row_start, row_end)
) engine=myisam with system versioning;
-ERROR HY000: `row_start` must be of type TIMESTAMP(6) for system-versioned table `t1`
+ERROR HY000: `row_start` must be of type BIGINT(20) UNSIGNED for system-versioned table `t1`
create table t (
a int,
row_start datetime(6) generated always as row start,
diff --git a/mysql-test/suite/versioning/r/select.result b/mysql-test/suite/versioning/r/select.result
index 3569268ce1d..66e22de9b0e 100644
--- a/mysql-test/suite/versioning/r/select.result
+++ b/mysql-test/suite/versioning/r/select.result
@@ -383,12 +383,9 @@ x
select x from t1 for system_time as of transaction @trx_start;
x
1
-## no specifier (auto-detection)
+## no specifier (defaults to timestamp)
select x from t1 for system_time as of @ts;
x
-select x from t1 for system_time as of @trx_start;
-x
-1
### Issue #365, bug 4 (related to #226, optimized fields)
create or replace table t1 (i int, b int) with system versioning;
insert into t1 values (0, 0), (0, 0);
diff --git a/mysql-test/suite/versioning/r/select2,trx_id.rdiff b/mysql-test/suite/versioning/r/select2,trx_id.rdiff
index d23eb5afbc0..89399516777 100644
--- a/mysql-test/suite/versioning/r/select2,trx_id.rdiff
+++ b/mysql-test/suite/versioning/r/select2,trx_id.rdiff
@@ -14,7 +14,7 @@
9 109
3 33
-select x as ASOF2_x, y from t1 for system_time as of @t0;
-+select x as ASOF2_x, y from t1 for system_time as of @x0;
++select x as ASOF2_x, y from t1 for system_time as of transaction @x0;
ASOF2_x y
0 100
1 101
@@ -23,7 +23,7 @@
8 108
9 109
-select x as FROMTO2_x, y from t1 for system_time from '0-0-0 0:0:0' to @t1;
-+select x as FROMTO2_x, y from t1 for system_time from @x0 to @x1;
++select x as FROMTO2_x, y from t1 for system_time from transaction @x0 to transaction @x1;
FROMTO2_x y
0 100
1 101
@@ -31,7 +31,7 @@
7 107
8 108
9 109
--select x as BETWAND2_x, y from t1 for system_time between timestamp '0-0-0 0:0:0' and timestamp @t1;
+-select x as BETWAND2_x, y from t1 for system_time between '0-0-0 0:0:0' and @t1;
+select x as BETWAND2_x, y from t1 for system_time between transaction @x0 and transaction @x1;
BETWAND2_x y
0 100
diff --git a/mysql-test/suite/versioning/r/select2.result b/mysql-test/suite/versioning/r/select2.result
index 22388359885..abe1c821172 100644
--- a/mysql-test/suite/versioning/r/select2.result
+++ b/mysql-test/suite/versioning/r/select2.result
@@ -110,7 +110,7 @@ FROMTO2_x y
7 107
8 108
9 109
-select x as BETWAND2_x, y from t1 for system_time between timestamp '0-0-0 0:0:0' and timestamp @t1;
+select x as BETWAND2_x, y from t1 for system_time between '0-0-0 0:0:0' and @t1;
BETWAND2_x y
0 100
1 101
diff --git a/mysql-test/suite/versioning/r/trx_id.result b/mysql-test/suite/versioning/r/trx_id.result
index ee8be01dc24..3ef08e60dd6 100644
--- a/mysql-test/suite/versioning/r/trx_id.result
+++ b/mysql-test/suite/versioning/r/trx_id.result
@@ -254,41 +254,41 @@ ERROR HY000: Illegal parameter data type row for operation 'FOR SYSTEM_TIME'
#
# DOUBLE is not supported, use explicit CAST
#
-SELECT * FROM t1 FOR SYSTEM_TIME AS OF RAND();
+SELECT * FROM t1 FOR SYSTEM_TIME AS OF TRANSACTION RAND();
ERROR HY000: Illegal parameter data type double for operation 'FOR SYSTEM_TIME'
-SELECT * FROM t1 FOR SYSTEM_TIME AS OF (RAND());
+SELECT * FROM t1 FOR SYSTEM_TIME AS OF TRANSACTION (RAND());
ERROR HY000: Illegal parameter data type double for operation 'FOR SYSTEM_TIME'
-SELECT * FROM t1 FOR SYSTEM_TIME AS OF COALESCE(RAND());
+SELECT * FROM t1 FOR SYSTEM_TIME AS OF TRANSACTION COALESCE(RAND());
ERROR HY000: Illegal parameter data type double for operation 'FOR SYSTEM_TIME'
-SELECT * FROM t2 FOR SYSTEM_TIME AS OF RAND();
+SELECT * FROM t2 FOR SYSTEM_TIME AS OF TRANSACTION RAND();
ERROR HY000: Illegal parameter data type double for operation 'FOR SYSTEM_TIME'
-SELECT * FROM t2 FOR SYSTEM_TIME AS OF (RAND());
+SELECT * FROM t2 FOR SYSTEM_TIME AS OF TRANSACTION (RAND());
ERROR HY000: Illegal parameter data type double for operation 'FOR SYSTEM_TIME'
-SELECT * FROM t2 FOR SYSTEM_TIME AS OF COALESCE(RAND());
+SELECT * FROM t2 FOR SYSTEM_TIME AS OF TRANSACTION COALESCE(RAND());
ERROR HY000: Illegal parameter data type double for operation 'FOR SYSTEM_TIME'
#
# DECIMAL is not supported, use explicit CAST
#
-SELECT * FROM t1 FOR SYSTEM_TIME AS OF 10.1;
+SELECT * FROM t1 FOR SYSTEM_TIME AS OF TRANSACTION 10.1;
ERROR HY000: Illegal parameter data type decimal for operation 'FOR SYSTEM_TIME'
-SELECT * FROM t1 FOR SYSTEM_TIME AS OF COALESCE(10.1);
+SELECT * FROM t1 FOR SYSTEM_TIME AS OF TRANSACTION COALESCE(10.1);
ERROR HY000: Illegal parameter data type decimal for operation 'FOR SYSTEM_TIME'
-SELECT * FROM t2 FOR SYSTEM_TIME AS OF 10.1;
+SELECT * FROM t2 FOR SYSTEM_TIME AS OF TRANSACTION 10.1;
ERROR HY000: Illegal parameter data type decimal for operation 'FOR SYSTEM_TIME'
-SELECT * FROM t2 FOR SYSTEM_TIME AS OF COALESCE(10.1);
+SELECT * FROM t2 FOR SYSTEM_TIME AS OF TRANSACTION COALESCE(10.1);
ERROR HY000: Illegal parameter data type decimal for operation 'FOR SYSTEM_TIME'
#
# YEAR is not supported, use explicit CAST
#
BEGIN NOT ATOMIC
DECLARE var YEAR;
-SELECT * FROM t1 FOR SYSTEM_TIME AS OF var;
+SELECT * FROM t1 FOR SYSTEM_TIME AS OF TRANSACTION var;
END;
$$
ERROR HY000: Illegal parameter data type year for operation 'FOR SYSTEM_TIME'
BEGIN NOT ATOMIC
DECLARE var YEAR;
-SELECT * FROM t2 FOR SYSTEM_TIME AS OF var;
+SELECT * FROM t2 FOR SYSTEM_TIME AS OF TRANSACTION var;
END;
$$
ERROR HY000: Illegal parameter data type year for operation 'FOR SYSTEM_TIME'
@@ -297,13 +297,13 @@ ERROR HY000: Illegal parameter data type year for operation 'FOR SYSTEM_TIME'
#
BEGIN NOT ATOMIC
DECLARE var ENUM('xxx') DEFAULT 'xxx';
-SELECT * FROM t1 FOR SYSTEM_TIME AS OF var;
+SELECT * FROM t1 FOR SYSTEM_TIME AS OF TRANSACTION var;
END;
$$
ERROR HY000: Illegal parameter data type enum for operation 'FOR SYSTEM_TIME'
BEGIN NOT ATOMIC
DECLARE var ENUM('xxx') DEFAULT 'xxx';
-SELECT * FROM t2 FOR SYSTEM_TIME AS OF var;
+SELECT * FROM t2 FOR SYSTEM_TIME AS OF TRANSACTION var;
END;
$$
ERROR HY000: Illegal parameter data type enum for operation 'FOR SYSTEM_TIME'
@@ -312,28 +312,19 @@ ERROR HY000: Illegal parameter data type enum for operation 'FOR SYSTEM_TIME'
#
BEGIN NOT ATOMIC
DECLARE var SET('xxx') DEFAULT 'xxx';
-SELECT * FROM t1 FOR SYSTEM_TIME AS OF var;
+SELECT * FROM t1 FOR SYSTEM_TIME AS OF TRANSACTION var;
END;
$$
ERROR HY000: Illegal parameter data type set for operation 'FOR SYSTEM_TIME'
BEGIN NOT ATOMIC
DECLARE var SET('xxx') DEFAULT 'xxx';
-SELECT * FROM t2 FOR SYSTEM_TIME AS OF var;
+SELECT * FROM t2 FOR SYSTEM_TIME AS OF TRANSACTION var;
END;
$$
ERROR HY000: Illegal parameter data type set for operation 'FOR SYSTEM_TIME'
-#
-# BIT is resolved to TRANSACTION
-#
-BEGIN NOT ATOMIC
-DECLARE var BIT(10);
-SELECT * FROM t1 FOR SYSTEM_TIME AS OF var;
-END;
-$$
-x
BEGIN NOT ATOMIC
DECLARE var BIT(10);
-SELECT * FROM t2 FOR SYSTEM_TIME AS OF var;
+SELECT * FROM t2 FOR SYSTEM_TIME AS OF TRANSACTION var;
END;
$$
ERROR HY000: Transaction-precise system versioning for `t2` is not supported
@@ -345,20 +336,6 @@ x
1
SELECT * FROM t2 FOR SYSTEM_TIME AS OF '2038-12-30 00:00:00';
x
-#
-# HEX hybrids resolve to TRANSACTION
-#
-SELECT * FROM t1 FOR SYSTEM_TIME AS OF (0xFFFFFFFF);
-ERROR HY000: TRX_ID 4294967295 not found in `mysql.transaction_registry`
-SELECT * FROM t2 FOR SYSTEM_TIME AS OF (0xFFFFFFFF);
-ERROR HY000: Transaction-precise system versioning for `t2` is not supported
-#
-# BIT literals resolve to TRANSACTION
-#
-SELECT * FROM t1 FOR SYSTEM_TIME AS OF (b'11111111111111111111111111111111');
-ERROR HY000: TRX_ID 4294967295 not found in `mysql.transaction_registry`
-SELECT * FROM t2 FOR SYSTEM_TIME AS OF (b'11111111111111111111111111111111');
-ERROR HY000: Transaction-precise system versioning for `t2` is not supported
DROP TABLE t1, t2;
#
# MDEV-16094 Crash when using AS OF with a stored function
@@ -381,11 +358,11 @@ PERIOD FOR SYSTEM_TIME(start_timestamp, end_timestamp)
) ENGINE=InnoDB WITH SYSTEM VERSIONING;
SELECT * FROM tts FOR SYSTEM_TIME AS OF fts();
x start_timestamp end_timestamp
-SELECT * FROM tts FOR SYSTEM_TIME AS OF ftx();
+SELECT * FROM tts FOR SYSTEM_TIME AS OF TRANSACTION ftx();
ERROR HY000: Transaction-precise system versioning for `tts` is not supported
SELECT * FROM ttx FOR SYSTEM_TIME AS OF fts();
x start_timestamp end_timestamp
-SELECT * FROM ttx FOR SYSTEM_TIME AS OF ftx();
+SELECT * FROM ttx FOR SYSTEM_TIME AS OF TRANSACTION ftx();
x start_timestamp end_timestamp
DROP TABLE tts;
DROP TABLE ttx;
diff --git a/mysql-test/suite/versioning/r/view.result b/mysql-test/suite/versioning/r/view.result
index 850eba32c0d..2c0df212ce8 100644
--- a/mysql-test/suite/versioning/r/view.result
+++ b/mysql-test/suite/versioning/r/view.result
@@ -146,6 +146,6 @@ i
create or replace view v1 as select * from t1 for system_time as of date_sub(now(), interval 6 second);
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` FOR SYSTEM_TIME AS OF current_timestamp() - interval 6 second latin1 latin1_swedish_ci
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i` from `t1` FOR SYSTEM_TIME AS OF TIMESTAMP current_timestamp() - interval 6 second latin1 latin1_swedish_ci
drop view v1, vt1, vt12;
drop tables t1, t3;
diff --git a/mysql-test/suite/versioning/t/select.test b/mysql-test/suite/versioning/t/select.test
index c4c1d703ce5..e8d34e55b16 100644
--- a/mysql-test/suite/versioning/t/select.test
+++ b/mysql-test/suite/versioning/t/select.test
@@ -55,8 +55,8 @@ select x as ALL_x, y from t1 for system_time all;
--disable_query_log
if ($MTR_COMBINATION_TRX_ID)
{
- select x as ASOF2_x, y from t1 for system_time as of @x0;
- select x as FROMTO2_x, y from t1 for system_time from @x0 to @x1;
+ select x as ASOF2_x, y from t1 for system_time as of transaction @x0;
+ select x as FROMTO2_x, y from t1 for system_time from transaction @x0 to transaction @x1;
select x as BETWAND2_x, y from t1 for system_time between transaction @x0 and transaction @x1;
}
if ($MTR_COMBINATION_TIMESTAMP)
@@ -253,9 +253,8 @@ select x from t1 for system_time as of timestamp @ts;
--echo ## TRANSACTION specifier
select x from t1 for system_time as of transaction @trx_start;
---echo ## no specifier (auto-detection)
+--echo ## no specifier (defaults to timestamp)
select x from t1 for system_time as of @ts;
-select x from t1 for system_time as of @trx_start;
--echo ### Issue #365, bug 4 (related to #226, optimized fields)
create or replace table t1 (i int, b int) with system versioning;
@@ -369,6 +368,12 @@ insert into t1 values (1);
delete from t1;
select row_start from t1 for system_time all into @t1;
select row_end from t1 for system_time all into @t2;
+--disable_query_log
+if($MTR_COMBINATION_TRX_ID) {
+ set @t1= trt_begin_ts(@t1);
+ set @t2= trt_commit_ts(@t2);
+}
+--enable_query_log
select * from t1 for system_time between @t1 and @t2;
select * from t1 for system_time between @t2 and @t1;
select * from t1 for system_time from @t1 to @t2;
diff --git a/mysql-test/suite/versioning/t/select2.test b/mysql-test/suite/versioning/t/select2.test
index d1b73fa799b..f624c512c87 100644
--- a/mysql-test/suite/versioning/t/select2.test
+++ b/mysql-test/suite/versioning/t/select2.test
@@ -41,14 +41,14 @@ select x as BETWAND_x, y from t1 for system_time between '0-0-0 0:0:0' and times
select x as ALL_x, y from t1 for system_time all;
if($MTR_COMBINATION_TRX_ID) {
- select x as ASOF2_x, y from t1 for system_time as of @x0;
- select x as FROMTO2_x, y from t1 for system_time from @x0 to @x1;
+ select x as ASOF2_x, y from t1 for system_time as of transaction @x0;
+ select x as FROMTO2_x, y from t1 for system_time from transaction @x0 to transaction @x1;
select x as BETWAND2_x, y from t1 for system_time between transaction @x0 and transaction @x1;
}
if(!$MTR_COMBINATION_TRX_ID) {
select x as ASOF2_x, y from t1 for system_time as of @t0;
select x as FROMTO2_x, y from t1 for system_time from '0-0-0 0:0:0' to @t1;
- select x as BETWAND2_x, y from t1 for system_time between timestamp '0-0-0 0:0:0' and timestamp @t1;
+ select x as BETWAND2_x, y from t1 for system_time between '0-0-0 0:0:0' and @t1;
}
drop table t1;
diff --git a/mysql-test/suite/versioning/t/trx_id.test b/mysql-test/suite/versioning/t/trx_id.test
index 617c46a9332..1bb763cd801 100644
--- a/mysql-test/suite/versioning/t/trx_id.test
+++ b/mysql-test/suite/versioning/t/trx_id.test
@@ -230,18 +230,18 @@ SELECT * FROM t2 FOR SYSTEM_TIME AS OF (1,1);
--echo #
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT * FROM t1 FOR SYSTEM_TIME AS OF RAND();
+SELECT * FROM t1 FOR SYSTEM_TIME AS OF TRANSACTION RAND();
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT * FROM t1 FOR SYSTEM_TIME AS OF (RAND());
+SELECT * FROM t1 FOR SYSTEM_TIME AS OF TRANSACTION (RAND());
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT * FROM t1 FOR SYSTEM_TIME AS OF COALESCE(RAND());
+SELECT * FROM t1 FOR SYSTEM_TIME AS OF TRANSACTION COALESCE(RAND());
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT * FROM t2 FOR SYSTEM_TIME AS OF RAND();
+SELECT * FROM t2 FOR SYSTEM_TIME AS OF TRANSACTION RAND();
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT * FROM t2 FOR SYSTEM_TIME AS OF (RAND());
+SELECT * FROM t2 FOR SYSTEM_TIME AS OF TRANSACTION (RAND());
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT * FROM t2 FOR SYSTEM_TIME AS OF COALESCE(RAND());
+SELECT * FROM t2 FOR SYSTEM_TIME AS OF TRANSACTION COALESCE(RAND());
--echo #
@@ -249,14 +249,14 @@ SELECT * FROM t2 FOR SYSTEM_TIME AS OF COALESCE(RAND());
--echo #
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT * FROM t1 FOR SYSTEM_TIME AS OF 10.1;
+SELECT * FROM t1 FOR SYSTEM_TIME AS OF TRANSACTION 10.1;
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT * FROM t1 FOR SYSTEM_TIME AS OF COALESCE(10.1);
+SELECT * FROM t1 FOR SYSTEM_TIME AS OF TRANSACTION COALESCE(10.1);
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT * FROM t2 FOR SYSTEM_TIME AS OF 10.1;
+SELECT * FROM t2 FOR SYSTEM_TIME AS OF TRANSACTION 10.1;
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT * FROM t2 FOR SYSTEM_TIME AS OF COALESCE(10.1);
+SELECT * FROM t2 FOR SYSTEM_TIME AS OF TRANSACTION COALESCE(10.1);
--echo #
@@ -267,7 +267,7 @@ DELIMITER $$;
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
BEGIN NOT ATOMIC
DECLARE var YEAR;
- SELECT * FROM t1 FOR SYSTEM_TIME AS OF var;
+ SELECT * FROM t1 FOR SYSTEM_TIME AS OF TRANSACTION var;
END;
$$
DELIMITER ;$$
@@ -276,7 +276,7 @@ DELIMITER $$;
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
BEGIN NOT ATOMIC
DECLARE var YEAR;
- SELECT * FROM t2 FOR SYSTEM_TIME AS OF var;
+ SELECT * FROM t2 FOR SYSTEM_TIME AS OF TRANSACTION var;
END;
$$
DELIMITER ;$$
@@ -290,7 +290,7 @@ DELIMITER $$;
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
BEGIN NOT ATOMIC
DECLARE var ENUM('xxx') DEFAULT 'xxx';
- SELECT * FROM t1 FOR SYSTEM_TIME AS OF var;
+ SELECT * FROM t1 FOR SYSTEM_TIME AS OF TRANSACTION var;
END;
$$
DELIMITER ;$$
@@ -300,7 +300,7 @@ DELIMITER $$;
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
BEGIN NOT ATOMIC
DECLARE var ENUM('xxx') DEFAULT 'xxx';
- SELECT * FROM t2 FOR SYSTEM_TIME AS OF var;
+ SELECT * FROM t2 FOR SYSTEM_TIME AS OF TRANSACTION var;
END;
$$
DELIMITER ;$$
@@ -314,7 +314,7 @@ DELIMITER $$;
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
BEGIN NOT ATOMIC
DECLARE var SET('xxx') DEFAULT 'xxx';
- SELECT * FROM t1 FOR SYSTEM_TIME AS OF var;
+ SELECT * FROM t1 FOR SYSTEM_TIME AS OF TRANSACTION var;
END;
$$
DELIMITER ;$$
@@ -323,29 +323,17 @@ DELIMITER $$;
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
BEGIN NOT ATOMIC
DECLARE var SET('xxx') DEFAULT 'xxx';
- SELECT * FROM t2 FOR SYSTEM_TIME AS OF var;
+ SELECT * FROM t2 FOR SYSTEM_TIME AS OF TRANSACTION var;
END;
$$
DELIMITER ;$$
---echo #
---echo # BIT is resolved to TRANSACTION
---echo #
-
-DELIMITER $$;
-BEGIN NOT ATOMIC
- DECLARE var BIT(10);
- SELECT * FROM t1 FOR SYSTEM_TIME AS OF var;
-END;
-$$
-DELIMITER ;$$
-
DELIMITER $$;
--error ER_VERS_ENGINE_UNSUPPORTED
BEGIN NOT ATOMIC
DECLARE var BIT(10);
- SELECT * FROM t2 FOR SYSTEM_TIME AS OF var;
+ SELECT * FROM t2 FOR SYSTEM_TIME AS OF TRANSACTION var;
END;
$$
DELIMITER ;$$
@@ -357,27 +345,6 @@ DELIMITER ;$$
SELECT * FROM t1 FOR SYSTEM_TIME AS OF '2038-12-30 00:00:00';
SELECT * FROM t2 FOR SYSTEM_TIME AS OF '2038-12-30 00:00:00';
-
-
---echo #
---echo # HEX hybrids resolve to TRANSACTION
---echo #
-
---error ER_VERS_NO_TRX_ID
-SELECT * FROM t1 FOR SYSTEM_TIME AS OF (0xFFFFFFFF);
---error ER_VERS_ENGINE_UNSUPPORTED
-SELECT * FROM t2 FOR SYSTEM_TIME AS OF (0xFFFFFFFF);
-
-
---echo #
---echo # BIT literals resolve to TRANSACTION
---echo #
-
---error ER_VERS_NO_TRX_ID
-SELECT * FROM t1 FOR SYSTEM_TIME AS OF (b'11111111111111111111111111111111');
---error ER_VERS_ENGINE_UNSUPPORTED
-SELECT * FROM t2 FOR SYSTEM_TIME AS OF (b'11111111111111111111111111111111');
-
DROP TABLE t1, t2;
@@ -406,9 +373,9 @@ CREATE TABLE tts
SELECT * FROM tts FOR SYSTEM_TIME AS OF fts();
--error ER_VERS_ENGINE_UNSUPPORTED
-SELECT * FROM tts FOR SYSTEM_TIME AS OF ftx();
+SELECT * FROM tts FOR SYSTEM_TIME AS OF TRANSACTION ftx();
SELECT * FROM ttx FOR SYSTEM_TIME AS OF fts();
-SELECT * FROM ttx FOR SYSTEM_TIME AS OF ftx();
+SELECT * FROM ttx FOR SYSTEM_TIME AS OF TRANSACTION ftx();
DROP TABLE tts;
DROP TABLE ttx;
diff --git a/mysql-test/valgrind.supp b/mysql-test/valgrind.supp
index e58d0a10124..d33cbcf2694 100644
--- a/mysql-test/valgrind.supp
+++ b/mysql-test/valgrind.supp
@@ -1638,6 +1638,81 @@
fun:clone
}
+{
+ codership test wsrep_info.plugin
+ Memcheck:Leak
+ match-leak-kinds: possible
+ fun:malloc
+ fun:tls_get_addr_tail
+}
+
+{
+ codership/galera
+ Memcheck:Addr4
+ fun:_ZN14Wsrep_thd_args11thread_typeEv
+ fun:_Z15start_wsrep_THDPv
+ fun:start_thread
+ fun:clone
+}
+
+{
+ codership/galera
+ Memcheck:Leak
+ match-leak-kinds: indirect
+ fun:malloc
+ fun:strdup
+ fun:dummy_init
+ fun:_ZN5wsrep18wsrep_provider_v26C1ERNS_12server_stateERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_
+ fun:_ZN5wsrep8provider13make_providerERNS_12server_stateERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_
+ fun:_ZN5wsrep12server_state13load_providerERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_
+ fun:_Z10wsrep_initv
+}
+
+{
+ codership/galera
+ Memcheck:Leak
+ match-leak-kinds: indirect
+ fun:malloc
+ fun:wsrep_dummy_loader
+ fun:wsrep_load
+ fun:_ZN5wsrep18wsrep_provider_v26C1ERNS_12server_stateERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_
+ fun:_ZN5wsrep8provider13make_providerERNS_12server_stateERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_
+ fun:_ZN5wsrep12server_state13load_providerERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_
+ fun:_Z10wsrep_initv
+}
+
+{
+ codership/galera
+ Memcheck:Leak
+ match-leak-kinds: indirect
+ fun:malloc
+ fun:wsrep_load
+ fun:_ZN5wsrep18wsrep_provider_v26C1ERNS_12server_stateERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_
+ fun:_ZN5wsrep8provider13make_providerERNS_12server_stateERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_
+ fun:_ZN5wsrep12server_state13load_providerERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_
+ fun:_Z10wsrep_initv
+}
+
+{
+ codership/galera
+ Memcheck:Leak
+ match-leak-kinds: definite
+ fun:_Znwm
+ fun:_ZN5wsrep8provider13make_providerERNS_12server_stateERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_
+ fun:_ZN5wsrep12server_state13load_providerERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_
+ fun:_Z10wsrep_initv
+}
+
+{
+ MDEV-20378 wsrep_info.plugin
+ Memcheck:Addr4
+ fun:_ZN14Wsrep_thd_args11thread_typeEv
+ fun:_Z15start_wsrep_THDPv
+ fun:pfs_spawn_thread
+ fun:start_thread
+ fun:clone
+}
+
#
# MDEV-11061: OpenSSL 0.9.8 problems
#
@@ -1800,7 +1875,39 @@
obj:/usr/lib64/libcrypto.so*
}
+#
+# libmarias3 problems
+#
+{
+ libmarias3 crypto
+ Memcheck:Leak
+ match-leak-kinds: reachable
+ fun:malloc
+ ...
+ obj:/usr/lib64/libcrypto.so*
+}
+
+#
+# libmarias3 problems
+#
+{
+ libmarias3 curl
+ Memcheck:Leak
+ match-leak-kinds: reachable
+ fun:malloc
+ ...
+ obj:/usr/lib64/libcrypto.so*
+}
+{
+ libmarias3 libxml2
+ Memcheck:Leak
+ match-leak-kinds: reachable
+ fun:calloc
+ fun:xmlGetGlobalState
+ ...
+ fun:s3_deinit_library
+}
##
## The following is a copy of facebook/mysql-5.6 suppressions:
@@ -1913,7 +2020,108 @@
...
}
+{
+ From rocksdb.mariadb_plugin.test
+ Memcheck:Leak
+ match-leak-kinds: reachable
+ fun:calloc
+ fun:__cxa_thread_atexit_impl
+ fun:__tls_init
+ fun:_ZTWN7rocksdb12perf_contextE
+ fun:_ZN7rocksdb17InstrumentedMutex4LockEv
+ ...
+ fun:_ZNSt10unique_ptrIN7rocksdb9DBOptionsESt14default_deleteIS1_EED1Ev
+ fun:__run_exit_handlers
+}
+
##
## RocksDB Storage Engine suppressions end
##
+#
+# wolfSSL problems, to be removed after fixed by wolfSSL team
+#
+
+{
+ WolfSSL_accept
+ Memcheck:Cond
+ ...
+ fun:wolfSSL_accept
+}
+
+{
+ WolfSSL_connect
+ Memcheck:Cond
+ ...
+ fun:wolfSSL_connect
+}
+
+{
+ WolfSSL send param
+ Memcheck:Param
+ socketcall.sendto(msg)
+ fun:send
+ ...
+ fun:wolfSSL_connect
+}
+
+#
+# Temporary suppressions to be able to run all tests in 10.5 with --valgrind
+#
+
+#
+# InnoDB errors
+#
+
+{
+ InnoDB encryption
+ Memcheck:Addr2
+ fun:memmove
+ fun:wolfSSL_EVP_CipherUpdate
+}
+
+{
+ InnoDB row_in_step
+ Memcheck:Cond
+ fun:_Z12row_ins_stepP9que_thr_t
+ ...
+ fun:_ZN11ha_innobase10update_rowEPKhS1_
+}
+
+{
+ InnoDB leak
+ Memcheck:Leak
+ match-leak-kinds: indirect,definite
+ fun:malloc
+ fun:_Z26mem_heap_create_block_funcP16mem_block_info_tmPKcjm
+ ...
+ fun:_ZN11ha_innobase10delete_rowEPKh
+}
+
+{
+ InnoDB leak
+ Memcheck:Leak
+ match-leak-kinds: indirect,definite
+ fun:malloc
+ fun:_Z26mem_heap_create_block_funcP16mem_block_info_tmPKcjm
+ ...
+ fun:_ZN7handler13ha_update_rowEPKhS1_
+}
+
+#
+# Optimizer
+#
+
+{
+ innodb_fts.fulltext_misc
+ Memcheck:Param
+ write(buf)
+ fun:write
+ fun:my_write
+ fun:inline_mysql_file_write
+ fun:_my_b_cache_write
+ fun:my_b_flush_io_cache
+ fun:end_io_cache
+ ...
+ fun:_Z11mysql_unionP3THDP3LEXP13select_resultP18st_select_lex_unitm
+}
diff --git a/mysys/charset-def.c b/mysys/charset-def.c
index b4317806762..249fb1b5e4d 100644
--- a/mysys/charset-def.c
+++ b/mysys/charset-def.c
@@ -116,37 +116,37 @@ extern struct charset_info_st my_charset_utf16_unicode_520_nopad_ci;
#endif /* HAVE_CHARSET_utf16 */
-#ifdef HAVE_CHARSET_utf8
-extern struct charset_info_st my_charset_utf8_german2_uca_ci;
-extern struct charset_info_st my_charset_utf8_icelandic_uca_ci;
-extern struct charset_info_st my_charset_utf8_latvian_uca_ci;
-extern struct charset_info_st my_charset_utf8_romanian_uca_ci;
-extern struct charset_info_st my_charset_utf8_slovenian_uca_ci;
-extern struct charset_info_st my_charset_utf8_polish_uca_ci;
-extern struct charset_info_st my_charset_utf8_estonian_uca_ci;
-extern struct charset_info_st my_charset_utf8_spanish_uca_ci;
-extern struct charset_info_st my_charset_utf8_swedish_uca_ci;
-extern struct charset_info_st my_charset_utf8_turkish_uca_ci;
-extern struct charset_info_st my_charset_utf8_czech_uca_ci;
-extern struct charset_info_st my_charset_utf8_danish_uca_ci;
-extern struct charset_info_st my_charset_utf8_lithuanian_uca_ci;
-extern struct charset_info_st my_charset_utf8_slovak_uca_ci;
-extern struct charset_info_st my_charset_utf8_spanish2_uca_ci;
-extern struct charset_info_st my_charset_utf8_roman_uca_ci;
-extern struct charset_info_st my_charset_utf8_persian_uca_ci;
-extern struct charset_info_st my_charset_utf8_esperanto_uca_ci;
-extern struct charset_info_st my_charset_utf8_hungarian_uca_ci;
-extern struct charset_info_st my_charset_utf8_croatian_mysql561_uca_ci;
-extern struct charset_info_st my_charset_utf8_sinhala_uca_ci;
-extern struct charset_info_st my_charset_utf8_unicode_520_ci;
-extern struct charset_info_st my_charset_utf8_vietnamese_ci;
-extern struct charset_info_st my_charset_utf8_croatian_uca_ci;
-extern struct charset_info_st my_charset_utf8_myanmar_uca_ci;
-extern struct charset_info_st my_charset_utf8_thai_520_w2;
+#ifdef HAVE_CHARSET_utf8mb3
+extern struct charset_info_st my_charset_utf8mb3_german2_uca_ci;
+extern struct charset_info_st my_charset_utf8mb3_icelandic_uca_ci;
+extern struct charset_info_st my_charset_utf8mb3_latvian_uca_ci;
+extern struct charset_info_st my_charset_utf8mb3_romanian_uca_ci;
+extern struct charset_info_st my_charset_utf8mb3_slovenian_uca_ci;
+extern struct charset_info_st my_charset_utf8mb3_polish_uca_ci;
+extern struct charset_info_st my_charset_utf8mb3_estonian_uca_ci;
+extern struct charset_info_st my_charset_utf8mb3_spanish_uca_ci;
+extern struct charset_info_st my_charset_utf8mb3_swedish_uca_ci;
+extern struct charset_info_st my_charset_utf8mb3_turkish_uca_ci;
+extern struct charset_info_st my_charset_utf8mb3_czech_uca_ci;
+extern struct charset_info_st my_charset_utf8mb3_danish_uca_ci;
+extern struct charset_info_st my_charset_utf8mb3_lithuanian_uca_ci;
+extern struct charset_info_st my_charset_utf8mb3_slovak_uca_ci;
+extern struct charset_info_st my_charset_utf8mb3_spanish2_uca_ci;
+extern struct charset_info_st my_charset_utf8mb3_roman_uca_ci;
+extern struct charset_info_st my_charset_utf8mb3_persian_uca_ci;
+extern struct charset_info_st my_charset_utf8mb3_esperanto_uca_ci;
+extern struct charset_info_st my_charset_utf8mb3_hungarian_uca_ci;
+extern struct charset_info_st my_charset_utf8mb3_croatian_mysql561_uca_ci;
+extern struct charset_info_st my_charset_utf8mb3_sinhala_uca_ci;
+extern struct charset_info_st my_charset_utf8mb3_unicode_520_ci;
+extern struct charset_info_st my_charset_utf8mb3_vietnamese_ci;
+extern struct charset_info_st my_charset_utf8mb3_croatian_uca_ci;
+extern struct charset_info_st my_charset_utf8mb3_myanmar_uca_ci;
+extern struct charset_info_st my_charset_utf8mb3_thai_520_w2;
#ifdef HAVE_UTF8_GENERAL_CS
-extern struct charset_info_st my_charset_utf8_general_cs;
+extern struct charset_info_st my_charset_utf8mb3_general_cs;
#endif
-extern struct charset_info_st my_charset_utf8_unicode_520_nopad_ci;
+extern struct charset_info_st my_charset_utf8mb3_unicode_520_nopad_ci;
#endif
#ifdef HAVE_CHARSET_utf8mb4
@@ -304,47 +304,47 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused)))
add_compiled_collation(&my_charset_ujis_nopad_bin);
#endif
-#ifdef HAVE_CHARSET_utf8
- add_compiled_collation(&my_charset_utf8_general_ci);
- add_compiled_collation(&my_charset_utf8_general_nopad_ci);
- add_compiled_collation(&my_charset_utf8_bin);
- add_compiled_collation(&my_charset_utf8_nopad_bin);
- add_compiled_collation(&my_charset_utf8_general_mysql500_ci);
+#ifdef HAVE_CHARSET_utf8mb3
+ add_compiled_collation(&my_charset_utf8mb3_general_ci);
+ add_compiled_collation(&my_charset_utf8mb3_general_nopad_ci);
+ add_compiled_collation(&my_charset_utf8mb3_bin);
+ add_compiled_collation(&my_charset_utf8mb3_nopad_bin);
+ add_compiled_collation(&my_charset_utf8mb3_general_mysql500_ci);
#ifdef HAVE_UTF8_GENERAL_CS
- add_compiled_collation(&my_charset_utf8_general_cs);
+ add_compiled_collation(&my_charset_utf8mb3_general_cs);
#endif
#ifdef HAVE_UCA_COLLATIONS
- add_compiled_collation(&my_charset_utf8_unicode_ci);
- add_compiled_collation(&my_charset_utf8_german2_uca_ci);
- add_compiled_collation(&my_charset_utf8_icelandic_uca_ci);
- add_compiled_collation(&my_charset_utf8_latvian_uca_ci);
- add_compiled_collation(&my_charset_utf8_romanian_uca_ci);
- add_compiled_collation(&my_charset_utf8_slovenian_uca_ci);
- add_compiled_collation(&my_charset_utf8_polish_uca_ci);
- add_compiled_collation(&my_charset_utf8_estonian_uca_ci);
- add_compiled_collation(&my_charset_utf8_spanish_uca_ci);
- add_compiled_collation(&my_charset_utf8_swedish_uca_ci);
- add_compiled_collation(&my_charset_utf8_turkish_uca_ci);
- add_compiled_collation(&my_charset_utf8_czech_uca_ci);
- add_compiled_collation(&my_charset_utf8_danish_uca_ci);
- add_compiled_collation(&my_charset_utf8_lithuanian_uca_ci);
- add_compiled_collation(&my_charset_utf8_slovak_uca_ci);
- add_compiled_collation(&my_charset_utf8_spanish2_uca_ci);
- add_compiled_collation(&my_charset_utf8_roman_uca_ci);
- add_compiled_collation(&my_charset_utf8_persian_uca_ci);
- add_compiled_collation(&my_charset_utf8_esperanto_uca_ci);
- add_compiled_collation(&my_charset_utf8_hungarian_uca_ci);
- add_compiled_collation(&my_charset_utf8_croatian_mysql561_uca_ci);
- add_compiled_collation(&my_charset_utf8_sinhala_uca_ci);
- add_compiled_collation(&my_charset_utf8_unicode_520_ci);
- add_compiled_collation(&my_charset_utf8_vietnamese_ci);
- add_compiled_collation(&my_charset_utf8_croatian_uca_ci);
- add_compiled_collation(&my_charset_utf8_myanmar_uca_ci);
- add_compiled_collation(&my_charset_utf8_thai_520_w2);
- add_compiled_collation(&my_charset_utf8_unicode_nopad_ci);
- add_compiled_collation(&my_charset_utf8_unicode_520_nopad_ci);
+ add_compiled_collation(&my_charset_utf8mb3_unicode_ci);
+ add_compiled_collation(&my_charset_utf8mb3_german2_uca_ci);
+ add_compiled_collation(&my_charset_utf8mb3_icelandic_uca_ci);
+ add_compiled_collation(&my_charset_utf8mb3_latvian_uca_ci);
+ add_compiled_collation(&my_charset_utf8mb3_romanian_uca_ci);
+ add_compiled_collation(&my_charset_utf8mb3_slovenian_uca_ci);
+ add_compiled_collation(&my_charset_utf8mb3_polish_uca_ci);
+ add_compiled_collation(&my_charset_utf8mb3_estonian_uca_ci);
+ add_compiled_collation(&my_charset_utf8mb3_spanish_uca_ci);
+ add_compiled_collation(&my_charset_utf8mb3_swedish_uca_ci);
+ add_compiled_collation(&my_charset_utf8mb3_turkish_uca_ci);
+ add_compiled_collation(&my_charset_utf8mb3_czech_uca_ci);
+ add_compiled_collation(&my_charset_utf8mb3_danish_uca_ci);
+ add_compiled_collation(&my_charset_utf8mb3_lithuanian_uca_ci);
+ add_compiled_collation(&my_charset_utf8mb3_slovak_uca_ci);
+ add_compiled_collation(&my_charset_utf8mb3_spanish2_uca_ci);
+ add_compiled_collation(&my_charset_utf8mb3_roman_uca_ci);
+ add_compiled_collation(&my_charset_utf8mb3_persian_uca_ci);
+ add_compiled_collation(&my_charset_utf8mb3_esperanto_uca_ci);
+ add_compiled_collation(&my_charset_utf8mb3_hungarian_uca_ci);
+ add_compiled_collation(&my_charset_utf8mb3_croatian_mysql561_uca_ci);
+ add_compiled_collation(&my_charset_utf8mb3_sinhala_uca_ci);
+ add_compiled_collation(&my_charset_utf8mb3_unicode_520_ci);
+ add_compiled_collation(&my_charset_utf8mb3_vietnamese_ci);
+ add_compiled_collation(&my_charset_utf8mb3_croatian_uca_ci);
+ add_compiled_collation(&my_charset_utf8mb3_myanmar_uca_ci);
+ add_compiled_collation(&my_charset_utf8mb3_thai_520_w2);
+ add_compiled_collation(&my_charset_utf8mb3_unicode_nopad_ci);
+ add_compiled_collation(&my_charset_utf8mb3_unicode_520_nopad_ci);
#endif
-#endif /* HAVE_CHARSET_utf8 */
+#endif /* HAVE_CHARSET_utf8mb3 */
#ifdef HAVE_CHARSET_utf8mb4
diff --git a/mysys/charset.c b/mysys/charset.c
index f44dc7606c1..7771f5800ef 100644
--- a/mysys/charset.c
+++ b/mysys/charset.c
@@ -262,7 +262,7 @@ static my_bool simple_cs_is_full(CHARSET_INFO *cs)
}
-#if defined(HAVE_UCA_COLLATIONS) && (defined(HAVE_CHARSET_ucs2) || defined(HAVE_CHARSET_utf8))
+#if defined(HAVE_UCA_COLLATIONS) && (defined(HAVE_CHARSET_ucs2) || defined(HAVE_CHARSET_utf8mb3))
/**
Initialize a loaded collation.
@param [OUT] to - The new charset_info_st structure to initialize.
@@ -350,12 +350,12 @@ static int add_collation(struct charset_info_st *cs)
}
else if (!strcmp(cs->csname, "utf8") || !strcmp(cs->csname, "utf8mb3"))
{
-#if defined (HAVE_CHARSET_utf8) && defined(HAVE_UCA_COLLATIONS)
+#if defined (HAVE_CHARSET_utf8mb3) && defined(HAVE_UCA_COLLATIONS)
copy_uca_collation(newcs, newcs->state & MY_CS_NOPAD ?
- &my_charset_utf8_unicode_nopad_ci :
- &my_charset_utf8_unicode_ci,
+ &my_charset_utf8mb3_unicode_nopad_ci :
+ &my_charset_utf8mb3_unicode_ci,
cs);
- newcs->ctype= my_charset_utf8_unicode_ci.ctype;
+ newcs->ctype= my_charset_utf8mb3_unicode_ci.ctype;
if (init_state_maps(newcs))
return MY_XML_ERROR;
#endif
diff --git a/mysys/my_addr_resolve.c b/mysys/my_addr_resolve.c
index 7590d576a7c..ff15558ddd4 100644
--- a/mysys/my_addr_resolve.c
+++ b/mysys/my_addr_resolve.c
@@ -191,7 +191,9 @@ int start_addr2line_fork(const char *binary_path)
return 0;
}
-int my_addr_resolve(void *ptr, my_addr_loc *loc)
+static int first_error= 0;
+
+static int addr_resolve(void *ptr, my_addr_loc *loc)
{
char input[32];
size_t len;
@@ -206,29 +208,13 @@ int my_addr_resolve(void *ptr, my_addr_loc *loc)
int filename_start = -1;
int line_number_start = -1;
- Dl_info info;
- void *offset;
-
- if (!dladdr(ptr, &info))
- return 1;
-
- if (strcmp(addr2line_binary, info.dli_fname))
- {
- /* We use dli_fname in case the path is longer than the length of our static
- string. We don't want to allocate anything dynamicaly here as we are in
- a "crashed" state. */
- if (start_addr2line_fork(info.dli_fname))
- {
- addr2line_binary[0] = '\0';
- return 2;
- }
- /* Save result for future comparisons. */
- strnmov(addr2line_binary, info.dli_fname, sizeof(addr2line_binary));
- }
- offset = info.dli_fbase;
- len= my_snprintf(input, sizeof(input), "%08x\n", (ulonglong)(ptr - offset));
+ len= my_snprintf(input, sizeof(input), "%p\n", ptr);
if (write(in[1], input, len) <= 0)
+ {
+ if (!first_error++)
+ fputs("Printing to addr2line failed\n", stderr);
return 3;
+ }
FD_ZERO(&set);
FD_SET(out[0], &set);
@@ -278,7 +264,7 @@ int my_addr_resolve(void *ptr, my_addr_loc *loc)
loc->line= atoi(output + line_number_start);
/* Addr2line was unable to extract any meaningful information. */
- if (strcmp(loc->file, "??") == 0)
+ if (strcmp(loc->file, "??") == 0 && loc->func[0] == '?')
return 6;
loc->file= strip_path(loc->file);
@@ -286,6 +272,42 @@ int my_addr_resolve(void *ptr, my_addr_loc *loc)
return 0;
}
+
+int my_addr_resolve(void *ptr, my_addr_loc *loc)
+{
+ Dl_info info;
+ int error;
+
+ if (!dladdr(ptr, &info))
+ return 1;
+
+ if (strcmp(addr2line_binary, info.dli_fname))
+ {
+ /*
+ We use dli_fname in case the path is longer than the length of
+ our static string. We don't want to allocate anything
+ dynamicaly here as we are in a "crashed" state.
+ */
+ if (start_addr2line_fork(info.dli_fname))
+ {
+ if (!first_error++)
+ fputs("Can't start addr2line\n", stderr);
+ addr2line_binary[0] = '\0';
+ return 2;
+ }
+ /* Save result for future comparisons. */
+ strnmov(addr2line_binary, info.dli_fname, sizeof(addr2line_binary));
+ }
+ if (!(error= addr_resolve(ptr, loc)))
+ return 0;
+#ifdef EXTRA_RESOLVE
+ if (!(error= addr_resolve((void*) (ptr - info.dli_fbase), loc)))
+ return 0;
+#endif
+ return error;
+}
+
+
const char *my_addr_resolve_init()
{
return 0;
diff --git a/mysys/my_error.c b/mysys/my_error.c
index 5f1ca0af55b..cb1fbfe1c04 100644
--- a/mysys/my_error.c
+++ b/mysys/my_error.c
@@ -118,7 +118,7 @@ void my_error(uint nr, myf MyFlags, ...)
else
{
va_start(args,MyFlags);
- (void) my_vsnprintf_ex(&my_charset_utf8_general_ci, ebuff,
+ (void) my_vsnprintf_ex(&my_charset_utf8mb3_general_ci, ebuff,
sizeof(ebuff), format, args);
va_end(args);
}
@@ -148,7 +148,7 @@ void my_printf_error(uint error, const char *format, myf MyFlags, ...)
error, MyFlags, errno, format));
va_start(args,MyFlags);
- (void) my_vsnprintf_ex(&my_charset_utf8_general_ci, ebuff,
+ (void) my_vsnprintf_ex(&my_charset_utf8mb3_general_ci, ebuff,
sizeof(ebuff), format, args);
va_end(args);
(*error_handler_hook)(error, ebuff, MyFlags);
diff --git a/mysys/my_getsystime.c b/mysys/my_getsystime.c
index 18218c2e8de..ce8a9ca786f 100644
--- a/mysys/my_getsystime.c
+++ b/mysys/my_getsystime.c
@@ -21,10 +21,8 @@
#ifdef _WIN32
#define OFFSET_TO_EPOC 116444736000000000LL
static ulonglong query_performance_frequency;
-typedef void (WINAPI* get_system_time_as_filetime_t)(LPFILETIME);
-static get_system_time_as_filetime_t
- my_GetSystemTimePreciseAsFileTime= GetSystemTimeAsFileTime;
#endif
+
#ifdef HAVE_LINUX_UNISTD_H
#include <linux/unistd.h>
#endif
@@ -57,20 +55,12 @@ ulonglong my_interval_timer()
#elif defined(HAVE_GETHRTIME)
return gethrtime();
#elif defined(_WIN32)
+ DBUG_ASSERT(query_performance_frequency);
LARGE_INTEGER t_cnt;
- if (query_performance_frequency)
- {
- QueryPerformanceCounter(&t_cnt);
- return (t_cnt.QuadPart / query_performance_frequency * 1000000000ULL) +
+ QueryPerformanceCounter(&t_cnt);
+ return (t_cnt.QuadPart / query_performance_frequency * 1000000000ULL) +
((t_cnt.QuadPart % query_performance_frequency) * 1000000000ULL /
query_performance_frequency);
- }
- else
- {
- ulonglong newtime;
- my_GetSystemTimePreciseAsFileTime((FILETIME*)&newtime);
- return newtime*100ULL;
- }
#else
/* TODO: check for other possibilities for hi-res timestamping */
struct timeval tv;
@@ -87,7 +77,7 @@ my_hrtime_t my_hrtime()
my_hrtime_t hrtime;
#if defined(_WIN32)
ulonglong newtime;
- my_GetSystemTimePreciseAsFileTime((FILETIME*)&newtime);
+ GetSystemTimePreciseAsFileTime((FILETIME*)&newtime);
hrtime.val= (newtime - OFFSET_TO_EPOC)/10;
#elif defined(HAVE_CLOCK_GETTIME)
struct timespec tp;
@@ -129,14 +119,8 @@ void my_time_init()
#ifdef _WIN32
compile_time_assert(sizeof(LARGE_INTEGER) ==
sizeof(query_performance_frequency));
- if (QueryPerformanceFrequency((LARGE_INTEGER *)&query_performance_frequency) == 0)
- query_performance_frequency= 0;
-
- get_system_time_as_filetime_t f= (get_system_time_as_filetime_t)
- GetProcAddress(GetModuleHandle("kernel32"),
- "GetSystemTimePreciseAsFileTime");
- if (f)
- my_GetSystemTimePreciseAsFileTime= f;
+ QueryPerformanceFrequency((LARGE_INTEGER *)&query_performance_frequency);
+ DBUG_ASSERT(query_performance_frequency);
#endif
}
diff --git a/mysys/my_init.c b/mysys/my_init.c
index d8fb2003052..fdde04be084 100644
--- a/mysys/my_init.c
+++ b/mysys/my_init.c
@@ -22,14 +22,13 @@
#include <m_ctype.h>
#include <signal.h>
#include <mysql/psi/mysql_stage.h>
-#ifdef __WIN__
+#ifdef _WIN32
#ifdef _MSC_VER
#include <locale.h>
#include <crtdbg.h>
/* WSAStartup needs winsock library*/
#pragma comment(lib, "ws2_32")
#endif
-my_bool have_tcpip=0;
static void my_win_init(void);
static my_bool win32_init_tcp_ip();
#else
@@ -119,8 +118,9 @@ my_bool my_init(void)
my_time_init();
my_win_init();
DBUG_PRINT("exit", ("home: '%s'", home_dir));
-#ifdef __WIN__
- win32_init_tcp_ip();
+#ifdef _WIN32
+ if (win32_init_tcp_ip())
+ DBUG_RETURN(1);
#endif
#ifdef CHECK_UNLIKELY
init_my_likely();
@@ -218,7 +218,7 @@ Voluntary context switches %ld, Involuntary context switches %ld\n",
rus.ru_msgsnd, rus.ru_msgrcv, rus.ru_nsignals,
rus.ru_nvcsw, rus.ru_nivcsw);
#endif
-#if defined(__WIN__) && defined(_MSC_VER)
+#if defined(_MSC_VER)
_CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE );
_CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDERR );
_CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE );
@@ -245,10 +245,9 @@ Voluntary context switches %ld, Involuntary context switches %ld\n",
(FILE *) 0);
#endif /* defined(SAFE_MUTEX) */
-#ifdef __WIN__
- if (have_tcpip)
- WSACleanup();
-#endif /* __WIN__ */
+#ifdef _WIN32
+ WSACleanup();
+#endif
/* At very last, delete mysys key, it is used everywhere including DBUG */
pthread_key_delete(THR_KEY_mysys);
@@ -263,16 +262,14 @@ void my_debug_put_break_here(void)
}
#endif
-#ifdef __WIN__
+#ifdef _WIN32
/*
my_parameter_handler
Invalid parameter handler we will use instead of the one "baked"
- into the CRT for MSC v8. This one just prints out what invalid
- parameter was encountered. By providing this routine, routines like
- lseek will return -1 when we expect them to instead of crash.
+ into the CRT.
*/
void my_parameter_handler(const wchar_t * expression, const wchar_t * function,
@@ -311,78 +308,14 @@ int handle_rtc_failure(int err_type, const char *file, int line,
#pragma runtime_checks("", restore)
#endif
-/*
- Open HKEY_LOCAL_MACHINE\SOFTWARE\MySQL and set any strings found
- there as environment variables
-*/
-static void win_init_registry(void)
-{
- HKEY key_handle;
-
- if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, (LPCTSTR)"SOFTWARE\\MySQL",
- 0, KEY_READ, &key_handle) == ERROR_SUCCESS)
- {
- LONG ret;
- DWORD index= 0;
- DWORD type;
- char key_name[256], key_data[1024];
- DWORD key_name_len= sizeof(key_name) - 1;
- DWORD key_data_len= sizeof(key_data) - 1;
-
- while ((ret= RegEnumValue(key_handle, index++,
- key_name, &key_name_len,
- NULL, &type, (LPBYTE)&key_data,
- &key_data_len)) != ERROR_NO_MORE_ITEMS)
- {
- char env_string[sizeof(key_name) + sizeof(key_data) + 2];
-
- if (ret == ERROR_MORE_DATA)
- {
- /* Registry value larger than 'key_data', skip it */
- DBUG_PRINT("error", ("Skipped registry value that was too large"));
- }
- else if (ret == ERROR_SUCCESS)
- {
- if (type == REG_SZ)
- {
- strxmov(env_string, key_name, "=", key_data, NullS);
-
- /* variable for putenv must be allocated ! */
- putenv(strdup(env_string)) ;
- }
- }
- else
- {
- /* Unhandled error, break out of loop */
- break;
- }
-
- key_name_len= sizeof(key_name) - 1;
- key_data_len= sizeof(key_data) - 1;
- }
-
- RegCloseKey(key_handle);
- }
-}
-
static void my_win_init(void)
{
DBUG_ENTER("my_win_init");
#if defined(_MSC_VER)
-#if _MSC_VER < 1300
- /*
- Clear the OS system variable TZ and avoid the 100% CPU usage
- Only for old versions of Visual C++
- */
- _putenv("TZ=");
-#endif
-#if _MSC_VER >= 1400
- /* this is required to make crt functions return -1 appropriately */
_set_invalid_parameter_handler(my_parameter_handler);
#endif
-#endif
#ifdef __MSVC_RUNTIME_CHECKS
/*
@@ -394,75 +327,22 @@ static void my_win_init(void)
_tzset();
- win_init_registry();
-
DBUG_VOID_RETURN;
}
-/*------------------------------------------------------------------
- Name: CheckForTcpip| Desc: checks if tcpip has been installed on system
- According to Microsoft Developers documentation the first registry
- entry should be enough to check if TCP/IP is installed, but as expected
- this doesn't work on all Win32 machines :(
-------------------------------------------------------------------*/
-
-#define TCPIPKEY "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters"
-#define WINSOCK2KEY "SYSTEM\\CurrentControlSet\\Services\\Winsock2\\Parameters"
-#define WINSOCKKEY "SYSTEM\\CurrentControlSet\\Services\\Winsock\\Parameters"
-
-static my_bool win32_have_tcpip(void)
-{
- HKEY hTcpipRegKey;
- if (RegOpenKeyEx ( HKEY_LOCAL_MACHINE, TCPIPKEY, 0, KEY_READ,
- &hTcpipRegKey) != ERROR_SUCCESS)
- {
- if (RegOpenKeyEx ( HKEY_LOCAL_MACHINE, WINSOCK2KEY, 0, KEY_READ,
- &hTcpipRegKey) != ERROR_SUCCESS)
- {
- if (RegOpenKeyEx ( HKEY_LOCAL_MACHINE, WINSOCKKEY, 0, KEY_READ,
- &hTcpipRegKey) != ERROR_SUCCESS)
- if (!getenv("HAVE_TCPIP") || have_tcpip) /* Provide a workaround */
- return (FALSE);
- }
- }
- RegCloseKey ( hTcpipRegKey);
- return (TRUE);
-}
-
-
static my_bool win32_init_tcp_ip()
{
- if (win32_have_tcpip())
+ WORD wVersionRequested = MAKEWORD( 2, 2 );
+ WSADATA wsaData;
+ if (WSAStartup(wVersionRequested, &wsaData))
{
- WORD wVersionRequested = MAKEWORD( 2, 2 );
- WSADATA wsaData;
- /* Be a good citizen: maybe another lib has already initialised
- sockets, so don't clobber them unless necessary */
- if (WSAStartup( wVersionRequested, &wsaData ))
- {
- /* Load failed, maybe because of previously loaded
- incompatible version; try again */
- WSACleanup( );
- if (!WSAStartup( wVersionRequested, &wsaData ))
- have_tcpip=1;
- }
- else
- {
- if (wsaData.wVersion != wVersionRequested)
- {
- /* Version is no good, try again */
- WSACleanup( );
- if (!WSAStartup( wVersionRequested, &wsaData ))
- have_tcpip=1;
- }
- else
- have_tcpip=1;
- }
+ fprintf(stderr, "WSAStartup() failed with error: %d\n", WSAGetLastError());
+ return 1;
}
return(0);
}
-#endif /* __WIN__ */
+#endif /* _WIN32 */
PSI_stage_info stage_waiting_for_table_level_lock=
{0, "Waiting for table level lock", 0};
diff --git a/mysys/my_pthread.c b/mysys/my_pthread.c
index e2795ed7bb9..ac6d3f87de3 100644
--- a/mysys/my_pthread.c
+++ b/mysys/my_pthread.c
@@ -405,3 +405,66 @@ int pthread_dummy(int ret)
{
return ret;
}
+
+
+/*
+ pthread_attr_setstacksize() without so much platform-dependency
+
+ Return: The actual stack size if possible.
+*/
+
+size_t my_setstacksize(pthread_attr_t *attr, size_t stacksize)
+{
+ size_t guard_size __attribute__((unused))= 0;
+
+#if defined(__ia64__) || defined(__ia64)
+ /*
+ On IA64, half of the requested stack size is used for "normal stack"
+ and half for "register stack". The space measured by check_stack_overrun
+ is the "normal stack", so double the request to make sure we have the
+ caller-expected amount of normal stack.
+
+ NOTE: there is no guarantee that the register stack can't grow faster
+ than normal stack, so it's very unclear that we won't dump core due to
+ stack overrun despite check_stack_overrun's efforts. Experimentation
+ shows that in the execution_constants test, the register stack grows
+ less than half as fast as normal stack, but perhaps other scenarios are
+ less forgiving. If it turns out that more space is needed for the
+ register stack, that could be forced (rather inefficiently) by using a
+ multiplier higher than 2 here.
+ */
+ stacksize *= 2;
+#endif
+
+ /*
+ On many machines, the "guard space" is subtracted from the requested
+ stack size, and that space is quite large on some platforms. So add
+ it to our request, if we can find out what it is.
+ */
+#ifdef HAVE_PTHREAD_ATTR_GETGUARDSIZE
+ if (pthread_attr_getguardsize(attr, &guard_size))
+ guard_size = 0; /* if can't find it out, treat as 0 */
+#endif /* HAVE_PTHREAD_ATTR_GETGUARDSIZE */
+
+ pthread_attr_setstacksize(attr, stacksize + guard_size);
+
+ /* Retrieve actual stack size if possible */
+#ifdef HAVE_PTHREAD_ATTR_GETSTACKSIZE
+ {
+ size_t real_stack_size= 0;
+ /* We must ignore real_stack_size = 0 as Solaris 2.9 can return 0 here */
+ if (pthread_attr_getstacksize(attr, &real_stack_size) == 0 &&
+ real_stack_size > guard_size)
+ {
+ real_stack_size -= guard_size;
+ if (real_stack_size < stacksize)
+ stacksize= real_stack_size;
+ }
+ }
+#endif /* HAVE_PTHREAD_ATTR_GETSTACKSIZE */
+
+#if defined(__ia64__) || defined(__ia64)
+ stacksize /= 2;
+#endif
+ return stacksize;
+}
diff --git a/mysys/my_winfile.c b/mysys/my_winfile.c
index 0c76eb25560..9c8d747adc9 100644
--- a/mysys/my_winfile.c
+++ b/mysys/my_winfile.c
@@ -501,13 +501,12 @@ static File my_get_stdfile_descriptor(FILE *stream)
}
-File my_win_fileno(FILE *file)
+File my_win_handle2File(HANDLE hFile)
{
- HANDLE hFile= (HANDLE)_get_osfhandle(fileno(file));
int retval= -1;
uint i;
- DBUG_ENTER("my_win_fileno");
+ DBUG_ENTER("my_win_handle2File");
for(i= MY_FILE_MIN; i < my_file_limit; i++)
{
@@ -517,6 +516,14 @@ File my_win_fileno(FILE *file)
break;
}
}
+ DBUG_RETURN(retval);
+}
+
+
+File my_win_fileno(FILE *file)
+{
+ DBUG_ENTER("my_win_fileno");
+ int retval= my_win_handle2File((HANDLE) _get_osfhandle(fileno(file)));
if(retval == -1)
/* try std stream */
DBUG_RETURN(my_get_stdfile_descriptor(file));
diff --git a/mysys/stacktrace.c b/mysys/stacktrace.c
index 2274c505195..19dcdf11dd5 100644
--- a/mysys/stacktrace.c
+++ b/mysys/stacktrace.c
@@ -14,12 +14,11 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
-#include <my_global.h>
+#include "mysys_priv.h"
#include <my_stacktrace.h>
#ifndef __WIN__
#include <signal.h>
-#include <my_pthread.h>
#include <m_string.h>
#ifdef HAVE_STACKTRACE
#include <unistd.h>
@@ -42,11 +41,49 @@ static char *heap_start;
extern char *__bss_start;
#endif
-void my_init_stacktrace()
+/**
+ Default handler for printing stacktrace
+*/
+
+static sig_handler default_handle_fatal_signal(int sig)
+{
+ my_safe_printf_stderr("%s: Got signal %d. Attempting backtrace\n",
+ my_progname_short, sig);
+ my_print_stacktrace(0,0,1);
+#ifndef __WIN__
+ signal(sig, SIG_DFL);
+ kill(getpid(), sig);
+#endif /* __WIN__ */
+ return;
+}
+
+
+/**
+ Initialize priting off stacktrace at signal
+
+ @param setup_handlers 0 only initialize variables
+ 1 setup signal handlers for stacktrace printing
+*/
+
+void my_init_stacktrace(int setup_handlers)
{
#if(defined HAVE_BSS_START) && !(defined __linux__)
heap_start = (char*) &__bss_start;
#endif
+ if (setup_handlers)
+ {
+ struct sigaction sa;
+ sa.sa_flags = SA_RESETHAND | SA_NODEFER;
+ sigemptyset(&sa.sa_mask);
+ sa.sa_handler= default_handle_fatal_signal;
+ sigaction(SIGSEGV, &sa, NULL);
+ sigaction(SIGABRT, &sa, NULL);
+#ifdef SIGBUS
+ sigaction(SIGBUS, &sa, NULL);
+#endif
+ sigaction(SIGILL, &sa, NULL);
+ sigaction(SIGFPE, &sa, NULL);
+ }
}
#ifdef __linux__
@@ -510,7 +547,7 @@ static EXCEPTION_POINTERS *exception_ptrs;
#define MODULE64_SIZE_WINXP 576
#define STACKWALK_MAX_FRAMES 64
-void my_init_stacktrace()
+void my_init_stacktrace(int setup_handlers __attribute__((unused)))
{
}
diff --git a/mysys/thr_rwlock.c b/mysys/thr_rwlock.c
index ea8b73bf8f5..a8711d517f9 100644
--- a/mysys/thr_rwlock.c
+++ b/mysys/thr_rwlock.c
@@ -21,116 +21,66 @@
#ifdef _WIN32
-static BOOL have_srwlock= FALSE;
-/* Prototypes and function pointers for windows functions */
-typedef VOID (WINAPI* srw_func) (PSRWLOCK SRWLock);
-typedef BOOLEAN (WINAPI* srw_bool_func) (PSRWLOCK SRWLock);
-
-static srw_func my_InitializeSRWLock;
-static srw_func my_AcquireSRWLockExclusive;
-static srw_func my_ReleaseSRWLockExclusive;
-static srw_func my_AcquireSRWLockShared;
-static srw_func my_ReleaseSRWLockShared;
-
-static srw_bool_func my_TryAcquireSRWLockExclusive;
-static srw_bool_func my_TryAcquireSRWLockShared;
-
-/**
- Check for presence of Windows slim reader writer lock function.
- Load function pointers.
-*/
-
-static void check_srwlock_availability(void)
-{
- HMODULE module= GetModuleHandle("kernel32");
-
- my_InitializeSRWLock= (srw_func) GetProcAddress(module,
- "InitializeSRWLock");
- my_AcquireSRWLockExclusive= (srw_func) GetProcAddress(module,
- "AcquireSRWLockExclusive");
- my_AcquireSRWLockShared= (srw_func) GetProcAddress(module,
- "AcquireSRWLockShared");
- my_ReleaseSRWLockExclusive= (srw_func) GetProcAddress(module,
- "ReleaseSRWLockExclusive");
- my_ReleaseSRWLockShared= (srw_func) GetProcAddress(module,
- "ReleaseSRWLockShared");
- my_TryAcquireSRWLockExclusive= (srw_bool_func) GetProcAddress(module,
- "TryAcquireSRWLockExclusive");
- my_TryAcquireSRWLockShared= (srw_bool_func) GetProcAddress(module,
- "TryAcquireSRWLockShared");
-
- /*
- We currently require TryAcquireSRWLockExclusive. This API is missing on
- Vista, this means SRWLock are only used starting with Win7.
-
- If "trylock" usage for rwlocks is eliminated from server codebase (it is used
- in a single place currently, in query cache), then SRWLock can be enabled on
- Vista too. In this case condition below needs to be changed to e.g check
- for my_InitializeSRWLock.
- */
-
- if (my_TryAcquireSRWLockExclusive)
- have_srwlock= TRUE;
-
-}
-
-
-static int srw_init(my_rw_lock_t *rwp)
+int my_rw_init(my_rw_lock_t *rwp)
{
- my_InitializeSRWLock(&rwp->srwlock);
+ InitializeSRWLock(&rwp->srwlock);
rwp->have_exclusive_srwlock = FALSE;
return 0;
}
-static int srw_rdlock(my_rw_lock_t *rwp)
+int my_rw_rdlock(my_rw_lock_t *rwp)
{
- my_AcquireSRWLockShared(&rwp->srwlock);
+ AcquireSRWLockShared(&rwp->srwlock);
return 0;
}
-static int srw_tryrdlock(my_rw_lock_t *rwp)
+int my_rw_tryrdlock(my_rw_lock_t *rwp)
{
-
- if (!my_TryAcquireSRWLockShared(&rwp->srwlock))
+ if (!TryAcquireSRWLockShared(&rwp->srwlock))
return EBUSY;
return 0;
}
-static int srw_wrlock(my_rw_lock_t *rwp)
+int my_rw_wrlock(my_rw_lock_t *rwp)
{
- my_AcquireSRWLockExclusive(&rwp->srwlock);
+ AcquireSRWLockExclusive(&rwp->srwlock);
rwp->have_exclusive_srwlock= TRUE;
return 0;
}
-
-static int srw_trywrlock(my_rw_lock_t *rwp)
+int my_rw_trywrlock(my_rw_lock_t *rwp)
{
- if (!my_TryAcquireSRWLockExclusive(&rwp->srwlock))
+ if (!TryAcquireSRWLockExclusive(&rwp->srwlock))
return EBUSY;
rwp->have_exclusive_srwlock= TRUE;
return 0;
}
-static int srw_unlock(my_rw_lock_t *rwp)
+int my_rw_unlock(my_rw_lock_t *rwp)
{
if (rwp->have_exclusive_srwlock)
{
rwp->have_exclusive_srwlock= FALSE;
- my_ReleaseSRWLockExclusive(&rwp->srwlock);
+ ReleaseSRWLockExclusive(&rwp->srwlock);
}
else
{
- my_ReleaseSRWLockShared(&rwp->srwlock);
+ ReleaseSRWLockShared(&rwp->srwlock);
}
return 0;
}
-#endif /*_WIN32 */
+int my_rw_destroy(my_rw_lock_t* rwp)
+{
+ DBUG_ASSERT(!rwp->have_exclusive_srwlock);
+ return 0;
+}
+
+#else
/*
Source base from Sun Microsystems SPILT, simplified for MySQL use
@@ -175,22 +125,6 @@ int my_rw_init(my_rw_lock_t *rwp)
{
pthread_condattr_t cond_attr;
-#ifdef _WIN32
- /*
- Once initialization is used here rather than in my_init(), in order to
- - avoid my_init() pitfalls- (undefined order in which initialization should
- run)
- - be potentially useful C++ (static constructors)
- - just to simplify the API.
- Also, the overhead is of my_pthread_once is very small.
- */
- static my_pthread_once_t once_control= MY_PTHREAD_ONCE_INIT;
- my_pthread_once(&once_control, check_srwlock_availability);
-
- if (have_srwlock)
- return srw_init(rwp);
-#endif
-
pthread_mutex_init( &rwp->lock, MY_MUTEX_INIT_FAST);
pthread_condattr_init( &cond_attr );
pthread_cond_init( &rwp->readers, &cond_attr );
@@ -209,10 +143,6 @@ int my_rw_init(my_rw_lock_t *rwp)
int my_rw_destroy(my_rw_lock_t *rwp)
{
-#ifdef _WIN32
- if (have_srwlock)
- return 0; /* no destroy function */
-#endif
DBUG_ASSERT(rwp->state == 0);
pthread_mutex_destroy( &rwp->lock );
pthread_cond_destroy( &rwp->readers );
@@ -223,11 +153,6 @@ int my_rw_destroy(my_rw_lock_t *rwp)
int my_rw_rdlock(my_rw_lock_t *rwp)
{
-#ifdef _WIN32
- if (have_srwlock)
- return srw_rdlock(rwp);
-#endif
-
pthread_mutex_lock(&rwp->lock);
/* active or queued writers */
@@ -242,12 +167,6 @@ int my_rw_rdlock(my_rw_lock_t *rwp)
int my_rw_tryrdlock(my_rw_lock_t *rwp)
{
int res;
-
-#ifdef _WIN32
- if (have_srwlock)
- return srw_tryrdlock(rwp);
-#endif
-
pthread_mutex_lock(&rwp->lock);
if ((rwp->state < 0 ) || rwp->waiters)
res= EBUSY; /* Can't get lock */
@@ -263,11 +182,6 @@ int my_rw_tryrdlock(my_rw_lock_t *rwp)
int my_rw_wrlock(my_rw_lock_t *rwp)
{
-#ifdef _WIN32
- if (have_srwlock)
- return srw_wrlock(rwp);
-#endif
-
pthread_mutex_lock(&rwp->lock);
rwp->waiters++; /* another writer queued */
@@ -289,11 +203,6 @@ int my_rw_trywrlock(my_rw_lock_t *rwp)
{
int res;
-#ifdef _WIN32
- if (have_srwlock)
- return srw_trywrlock(rwp);
-#endif
-
pthread_mutex_lock(&rwp->lock);
if (rwp->state)
res= EBUSY; /* Can't get lock */
@@ -312,11 +221,6 @@ int my_rw_trywrlock(my_rw_lock_t *rwp)
int my_rw_unlock(my_rw_lock_t *rwp)
{
-#ifdef _WIN32
- if (have_srwlock)
- return srw_unlock(rwp);
-#endif
-
DBUG_PRINT("rw_unlock",
("state: %d waiters: %d", rwp->state, rwp->waiters));
pthread_mutex_lock(&rwp->lock);
@@ -347,7 +251,8 @@ int my_rw_unlock(my_rw_lock_t *rwp)
return(0);
}
-#endif /* defined(NEED_MY_RW_LOCK) */
+#endif /* !defined _WIN32 */
+#endif /* NEED_MY_RW_LOCK*/
int rw_pr_init(rw_pr_lock_t *rwlock)
diff --git a/mysys/typelib.c b/mysys/typelib.c
index f0037921a87..715e7ad42ba 100644
--- a/mysys/typelib.c
+++ b/mysys/typelib.c
@@ -226,7 +226,7 @@ my_ulonglong find_typeset(char *x, TYPELIB *lib, int *err)
NULL otherwise
*/
-TYPELIB *copy_typelib(MEM_ROOT *root, TYPELIB *from)
+TYPELIB *copy_typelib(MEM_ROOT *root, const TYPELIB *from)
{
TYPELIB *to;
uint i;
diff --git a/pcre/pcretest.c b/pcre/pcretest.c
index dcf1e2c6760..12f76cc0299 100644
--- a/pcre/pcretest.c
+++ b/pcre/pcretest.c
@@ -3192,7 +3192,7 @@ while (argc > 1 && argv[op][0] == '-')
#endif
else if (strcmp(arg, "-C") == 0)
{
- int rc;
+ int rc=0;
unsigned long int lrc;
if (argc > 2)
diff --git a/plugin/auth_gssapi/server_plugin.cc b/plugin/auth_gssapi/server_plugin.cc
index bce6a812d12..4fdad2de4b8 100644
--- a/plugin/auth_gssapi/server_plugin.cc
+++ b/plugin/auth_gssapi/server_plugin.cc
@@ -90,6 +90,7 @@ static int deinitialize_plugin(void *unused)
return plugin_deinit();
}
+#ifdef PLUGIN_GSSAPI
/* system variable */
static MYSQL_SYSVAR_STR(keytab_path, srv_keytab_path,
PLUGIN_VAR_RQCMDARG|PLUGIN_VAR_READONLY,
@@ -97,6 +98,8 @@ static MYSQL_SYSVAR_STR(keytab_path, srv_keytab_path,
NULL,
NULL,
"");
+#endif
+
static MYSQL_SYSVAR_STR(principal_name, srv_principal_name,
PLUGIN_VAR_RQCMDARG|PLUGIN_VAR_READONLY,
"GSSAPI target name - service principal name for Kerberos authentication.",
diff --git a/plugin/disks/information_schema_disks.cc b/plugin/disks/information_schema_disks.cc
index 9b1b6c0fe69..6715d40f20d 100644
--- a/plugin/disks/information_schema_disks.cc
+++ b/plugin/disks/information_schema_disks.cc
@@ -19,26 +19,29 @@
#include <sys/types.h>
#include <mntent.h>
#include <sql_class.h>
-#include <table.h>
+#include <sql_i_s.h>
#include <sql_acl.h> /* check_global_access() */
bool schema_table_store_record(THD *thd, TABLE *table);
-namespace
-{
struct st_mysql_information_schema disks_table_info = { MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION };
+
+namespace Show {
+
ST_FIELD_INFO disks_table_fields[]=
{
- { "Disk", PATH_MAX, MYSQL_TYPE_STRING, 0, 0 ,0, 0 },
- { "Path", PATH_MAX, MYSQL_TYPE_STRING, 0, 0 ,0, 0 },
- { "Total", 32, MYSQL_TYPE_LONG, 0, 0 ,0 ,0 }, // Total amount available
- { "Used", 32, MYSQL_TYPE_LONG, 0, 0 ,0 ,0 }, // Amount of space used
- { "Available", 32, MYSQL_TYPE_LONG, 0, 0 ,0 ,0 }, // Amount available to users other than root.
- { 0, 0, MYSQL_TYPE_NULL, 0, 0, 0, 0 }
+ Column("Disk", Varchar(PATH_MAX), NOT_NULL),
+ Column("Path", Varchar(PATH_MAX), NOT_NULL),
+ Column("Total", SLong(32), NOT_NULL), // Total amount available
+ Column("Used", SLong(32), NOT_NULL), // Amount of space used
+ Column("Available", SLong(32), NOT_NULL), // Amount available to users other than root.
+ CEnd()
};
+
+
int disks_table_add_row(THD* pThd,
TABLE* pTable,
const char* zDisk,
@@ -134,7 +137,7 @@ int disks_table_init(void *ptr)
return 0;
}
-}
+} // namespace Show
extern "C"
{
@@ -147,7 +150,7 @@ maria_declare_plugin(disks)
"Johan Wikman", /* author */
"Disk space information", /* description */
PLUGIN_LICENSE_GPL, /* license type */
- disks_table_init, /* init function */
+ Show::disks_table_init, /* init function */
NULL, /* deinit function */
0x0101, /* version = 1.1 */
NULL, /* no status variables */
diff --git a/plugin/feedback/feedback.cc b/plugin/feedback/feedback.cc
index 75e9a1e430e..b8e6feb3807 100644
--- a/plugin/feedback/feedback.cc
+++ b/plugin/feedback/feedback.cc
@@ -67,9 +67,9 @@ ST_SCHEMA_TABLE *i_s_feedback; ///< table descriptor for our I_S table
*/
static ST_FIELD_INFO feedback_fields[] =
{
- {"VARIABLE_NAME", 255, MYSQL_TYPE_STRING, 0, 0, 0, 0},
- {"VARIABLE_VALUE", 1024, MYSQL_TYPE_STRING, 0, 0, 0, 0},
- {0, 0, MYSQL_TYPE_NULL, 0, 0, 0, 0}
+ Show::Column("VARIABLE_NAME", Show::Varchar(255), NOT_NULL),
+ Show::Column("VARIABLE_VALUE", Show::Varchar(1024), NOT_NULL),
+ Show::CEnd()
};
static COND * const OOM= (COND*)1;
@@ -93,8 +93,9 @@ static COND* make_cond(THD *thd, TABLE_LIST *tables, LEX_STRING *filter)
{
Item_cond_or *res= NULL;
Name_resolution_context nrc;
- const char *db= tables->db.str, *table= tables->alias.str;
- LEX_CSTRING *field= &tables->table->field[0]->field_name;
+ LEX_CSTRING &db= tables->db;
+ LEX_CSTRING &table= tables->alias;
+ LEX_CSTRING &field= tables->table->field[0]->field_name;
CHARSET_INFO *cs= &my_charset_latin1;
if (!filter->str)
diff --git a/plugin/func_test/CMakeLists.txt b/plugin/func_test/CMakeLists.txt
new file mode 100644
index 00000000000..38ce82d36e4
--- /dev/null
+++ b/plugin/func_test/CMakeLists.txt
@@ -0,0 +1,17 @@
+# Copyright (c) 2019, 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 Street, Fifth Floor, Boston, MA 02110-1335 USA
+
+MYSQL_ADD_PLUGIN(func_test plugin.cc RECOMPILE_FOR_EMBEDDED
+ MODULE_ONLY COMPONENT Test)
diff --git a/plugin/func_test/mysql-test/func_test/func_test.result b/plugin/func_test/mysql-test/func_test/func_test.result
new file mode 100644
index 00000000000..8b40dde7003
--- /dev/null
+++ b/plugin/func_test/mysql-test/func_test/func_test.result
@@ -0,0 +1,28 @@
+SELECT
+PLUGIN_NAME,
+PLUGIN_VERSION,
+PLUGIN_STATUS,
+PLUGIN_TYPE,
+PLUGIN_AUTHOR,
+PLUGIN_DESCRIPTION,
+PLUGIN_LICENSE,
+PLUGIN_MATURITY,
+PLUGIN_AUTH_VERSION
+FROM INFORMATION_SCHEMA.PLUGINS
+WHERE PLUGIN_TYPE='FUNCTION COLLECTION'
+ AND PLUGIN_NAME='func_test';
+PLUGIN_NAME func_test
+PLUGIN_VERSION 1.0
+PLUGIN_STATUS ACTIVE
+PLUGIN_TYPE FUNCTION COLLECTION
+PLUGIN_AUTHOR MariaDB Corporation
+PLUGIN_DESCRIPTION Function collection test
+PLUGIN_LICENSE GPL
+PLUGIN_MATURITY Experimental
+PLUGIN_AUTH_VERSION 1.0
+SELECT sysconst_test();
+sysconst_test()
+sysconst_test
+SELECT sysconst_test();
+sysconst_test()
+sysconst_test
diff --git a/plugin/func_test/mysql-test/func_test/func_test.test b/plugin/func_test/mysql-test/func_test/func_test.test
new file mode 100644
index 00000000000..c8daf09916a
--- /dev/null
+++ b/plugin/func_test/mysql-test/func_test/func_test.test
@@ -0,0 +1,23 @@
+#--echo #
+#--echo #
+#--echo #
+
+--vertical_results
+SELECT
+ PLUGIN_NAME,
+ PLUGIN_VERSION,
+ PLUGIN_STATUS,
+ PLUGIN_TYPE,
+ PLUGIN_AUTHOR,
+ PLUGIN_DESCRIPTION,
+ PLUGIN_LICENSE,
+ PLUGIN_MATURITY,
+ PLUGIN_AUTH_VERSION
+FROM INFORMATION_SCHEMA.PLUGINS
+ WHERE PLUGIN_TYPE='FUNCTION COLLECTION'
+ AND PLUGIN_NAME='func_test';
+--horizontal_results
+
+
+SELECT sysconst_test();
+SELECT sysconst_test();
diff --git a/plugin/func_test/mysql-test/func_test/suite.opt b/plugin/func_test/mysql-test/func_test/suite.opt
new file mode 100644
index 00000000000..8c8bfe0f4e6
--- /dev/null
+++ b/plugin/func_test/mysql-test/func_test/suite.opt
@@ -0,0 +1 @@
+--plugin-load-add=$FUNC_TEST_SO
diff --git a/plugin/func_test/mysql-test/func_test/suite.pm b/plugin/func_test/mysql-test/func_test/suite.pm
new file mode 100644
index 00000000000..ddaa6b55df2
--- /dev/null
+++ b/plugin/func_test/mysql-test/func_test/suite.pm
@@ -0,0 +1,9 @@
+package My::Suite::Func_test;
+
+@ISA = qw(My::Suite);
+
+return "No FUNC_TEST plugin" unless $ENV{FUNC_TEST_SO};
+
+sub is_default { 1 }
+
+bless { };
diff --git a/plugin/func_test/plugin.cc b/plugin/func_test/plugin.cc
new file mode 100644
index 00000000000..831c0c66484
--- /dev/null
+++ b/plugin/func_test/plugin.cc
@@ -0,0 +1,96 @@
+/*
+ Copyright (c) 2000, 2015, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2019, 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#define MYSQL_SERVER
+
+#include <my_global.h>
+#include <sql_class.h>
+#include <mysql/plugin_function_collection.h>
+
+class Item_func_sysconst_test :public Item_func_sysconst
+{
+public:
+ Item_func_sysconst_test(THD *thd): Item_func_sysconst(thd) {}
+ String *val_str(String *str)
+ {
+ null_value= str->copy(STRING_WITH_LEN("sysconst_test"), system_charset_info);
+ return null_value ? NULL : str;
+ }
+ bool fix_length_and_dec()
+ {
+ max_length= MAX_FIELD_NAME * system_charset_info->mbmaxlen;
+ maybe_null= true;
+ return false;
+ }
+ const char *func_name() const { return "sysconst_test"; }
+ const char *fully_qualified_func_name() const { return "sysconst_test()"; }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_sysconst_test>(thd, this); }
+};
+
+
+class Create_func_sysconst_test : public Create_func_arg0
+{
+public:
+ Item *create_builder(THD *thd) override;
+ static Create_func_sysconst_test s_singleton;
+protected:
+ Create_func_sysconst_test() {}
+};
+
+
+Create_func_sysconst_test Create_func_sysconst_test::s_singleton;
+
+Item* Create_func_sysconst_test::create_builder(THD *thd)
+{
+ return new (thd->mem_root) Item_func_sysconst_test(thd);
+}
+
+
+#define BUILDER(F) & F::s_singleton
+
+
+static Native_func_registry func_array[] =
+{
+ {{STRING_WITH_LEN("SYSCONST_TEST")}, BUILDER(Create_func_sysconst_test)}
+};
+
+
+static Plugin_function_collection
+ plugin_descriptor_function_collection_test(
+ MariaDB_FUNCTION_COLLECTION_INTERFACE_VERSION,
+ Native_func_registry_array(func_array, array_elements(func_array)));
+
+/*************************************************************************/
+
+maria_declare_plugin(type_test)
+{
+ MariaDB_FUNCTION_COLLECTION_PLUGIN, // the plugin type (see include/mysql/plugin.h)
+ &plugin_descriptor_function_collection_test, // pointer to type-specific plugin descriptor
+ "func_test", // plugin name
+ "MariaDB Corporation", // plugin author
+ "Function collection test", // the plugin description
+ PLUGIN_LICENSE_GPL, // the plugin license (see include/mysql/plugin.h)
+ 0, // Pointer to plugin initialization function
+ 0, // Pointer to plugin deinitialization function
+ 0x0100, // Numeric version 0xAABB means AA.BB veriosn
+ NULL, // Status variables
+ NULL, // System variables
+ "1.0", // String version representation
+ MariaDB_PLUGIN_MATURITY_EXPERIMENTAL // Maturity(see include/mysql/plugin.h)*/
+}
+maria_declare_plugin_end;
diff --git a/plugin/handler_socket/client/hspool_test.pl b/plugin/handler_socket/client/hspool_test.pl
index 7fe073301b1..091cb4967cb 100755
--- a/plugin/handler_socket/client/hspool_test.pl
+++ b/plugin/handler_socket/client/hspool_test.pl
@@ -31,8 +31,8 @@ my $moreflds_prefix = get_conf("moreflds_prefix", "f");
my $mysql_user = 'root';
my $mysql_password = '';
-my $dsn = "DBI:mysql:database=;host=$host;port=$mysqlport"
- . ";mysql_server_prepare=$ssps";
+my $dsn = "DBI:MariaDB:database=;host=$host;port=$mysqlport"
+ . ";mariadb_server_prepare=$ssps";
my $dbh = DBI->connect($dsn, $mysql_user, $mysql_password,
{ RaiseError => 1 });
my $hsargs = { 'host' => $host, 'port' => $hsport_rd };
diff --git a/plugin/handler_socket/client/hstest.pl b/plugin/handler_socket/client/hstest.pl
index 4d177b6cdc8..de39fcb6d6c 100755
--- a/plugin/handler_socket/client/hstest.pl
+++ b/plugin/handler_socket/client/hstest.pl
@@ -33,8 +33,8 @@ my $moreflds_prefix = get_conf("moreflds_prefix", "column0123456789_");
my $keytype = get_conf("keytype", "varchar(32)");
my $file = get_conf("file", undef);
-my $dsn = "DBI:mysql:database=;host=$host;port=$mysqlport"
- . ";mysql_server_prepare=$ssps";
+my $dsn = "DBI:MariaDB:database=;host=$host;port=$mysqlport"
+ . ";mariadb_server_prepare=$ssps";
my $dbh = DBI->connect($dsn, $mysqluser, $mysqlpass, { RaiseError => 1 });
my $hsargs = { 'host' => $host, 'port' => $hsport };
my $cli = new Net::HandlerSocket($hsargs);
diff --git a/plugin/handler_socket/regtest/common/hstest.pm b/plugin/handler_socket/regtest/common/hstest.pm
index 348242b027f..89f273c9786 100644
--- a/plugin/handler_socket/regtest/common/hstest.pm
+++ b/plugin/handler_socket/regtest/common/hstest.pm
@@ -29,10 +29,10 @@ sub get_dbi_connection {
= ($conf{dbname}, $conf{host}, $conf{myport}, $conf{ssps},
$conf{user}, $conf{pass});
my $mycnf = "binary_my.cnf";
- my $dsn = "DBI:mysql:database=;host=$host;port=$myport"
- . ";mysql_server_prepare=$ssps"
- . ";mysql_read_default_group=perl"
- . ";mysql_read_default_file=../common/$mycnf";
+ my $dsn = "DBI:MariaDB:database=;host=$host;port=$myport"
+ . ";mariadb_server_prepare=$ssps"
+ . ";mariadb_read_default_group=perl"
+ . ";mariadb_read_default_file=../common/$mycnf";
my $dbh = DBI->connect($dsn, $user, $pass, { RaiseError => 1 });
return $dbh;
}
diff --git a/plugin/locale_info/locale_info.cc b/plugin/locale_info/locale_info.cc
index e444b4fade0..2685552d4ae 100644
--- a/plugin/locale_info/locale_info.cc
+++ b/plugin/locale_info/locale_info.cc
@@ -28,27 +28,31 @@
#include <my_global.h>
#include <sql_class.h> // THD
-#include <table.h> // ST_SCHEMA_TABLE
+#include <sql_i_s.h> // ST_SCHEMA_TABLE
#include <mysql/plugin.h>
#include <m_ctype.h>
#include "sql_locale.h"
-bool schema_table_store_record(THD *thd, TABLE *table);
static MY_LOCALE **locale_list;
+namespace Show {
+
/* LOCALES */
static ST_FIELD_INFO locale_info_locale_fields_info[]=
{
- {"ID", 4, MYSQL_TYPE_LONGLONG, 0, 0, "Id", 0},
- {"NAME", 255, MYSQL_TYPE_STRING, 0, 0, "Name", 0},
- {"DESCRIPTION", 255, MYSQL_TYPE_STRING, 0, 0, "Description", 0},
- {"MAX_MONTH_NAME_LENGTH", 4, MYSQL_TYPE_LONGLONG, 0, 0, 0, 0},
- {"MAX_DAY_NAME_LENGTH", 4, MYSQL_TYPE_LONGLONG, 0, 0, 0, 0},
- {"DECIMAL_POINT", 2, MYSQL_TYPE_STRING, 0, 0, 0, 0},
- {"THOUSAND_SEP", 2, MYSQL_TYPE_STRING, 0, 0, 0, 0},
- {"ERROR_MESSAGE_LANGUAGE", 64, MYSQL_TYPE_STRING, 0, 0, "Error_Message_Language", 0},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, 0}
+ Column("ID", SLonglong(4), NOT_NULL, "Id"),
+ Column("NAME", Varchar(255), NOT_NULL, "Name"),
+ Column("DESCRIPTION", Varchar(255), NOT_NULL, "Description"),
+ Column("MAX_MONTH_NAME_LENGTH", SLonglong(4), NOT_NULL),
+ Column("MAX_DAY_NAME_LENGTH", SLonglong(4), NOT_NULL),
+ Column("DECIMAL_POINT", Varchar(2), NOT_NULL),
+ Column("THOUSAND_SEP", Varchar(2), NOT_NULL),
+ Column("ERROR_MESSAGE_LANGUAGE", Varchar(64), NOT_NULL, "Error_Message_Language"),
+ CEnd()
};
+
+} // namespace Show
+
static int locale_info_fill_table_locale(THD* thd, TABLE_LIST* tables, COND* cond)
{
TABLE *table= tables->table;
@@ -84,7 +88,7 @@ static int locale_info_fill_table_locale(THD* thd, TABLE_LIST* tables, COND* con
static int locale_info_plugin_init_locales(void *p)
{
ST_SCHEMA_TABLE *schema= (ST_SCHEMA_TABLE *)p;
- schema->fields_info= locale_info_locale_fields_info;
+ schema->fields_info= Show::locale_info_locale_fields_info;
schema->fill_table= locale_info_fill_table_locale;
#if defined(_WIN64)
diff --git a/plugin/metadata_lock_info/metadata_lock_info.cc b/plugin/metadata_lock_info/metadata_lock_info.cc
index a4c1d8ef205..46c31ca3a96 100644
--- a/plugin/metadata_lock_info/metadata_lock_info.cc
+++ b/plugin/metadata_lock_info/metadata_lock_info.cc
@@ -18,7 +18,7 @@
#include "mysql_version.h"
#include "mysql/plugin.h"
#include "sql_class.h"
-#include "sql_show.h"
+#include "sql_i_s.h"
static const LEX_STRING metadata_lock_info_lock_name[] = {
{ C_STRING_WITH_LEN("Backup lock") },
@@ -32,23 +32,22 @@ static const LEX_STRING metadata_lock_info_lock_name[] = {
{ C_STRING_WITH_LEN("User lock") },
};
+namespace Show {
+
static ST_FIELD_INFO i_s_metadata_lock_info_fields_info[] =
{
- {"THREAD_ID", 20, MYSQL_TYPE_LONGLONG, 0,
- MY_I_S_UNSIGNED, "thread_id", SKIP_OPEN_TABLE},
- {"LOCK_MODE", 24, MYSQL_TYPE_STRING, 0,
- MY_I_S_MAYBE_NULL, "lock_mode", SKIP_OPEN_TABLE},
- {"LOCK_DURATION", 30, MYSQL_TYPE_STRING, 0,
- MY_I_S_MAYBE_NULL, "lock_duration", SKIP_OPEN_TABLE},
- {"LOCK_TYPE", 33, MYSQL_TYPE_STRING, 0,
- MY_I_S_MAYBE_NULL, "lock_type", SKIP_OPEN_TABLE},
- {"TABLE_SCHEMA", 64, MYSQL_TYPE_STRING, 0,
- MY_I_S_MAYBE_NULL, "table_schema", SKIP_OPEN_TABLE},
- {"TABLE_NAME", 64, MYSQL_TYPE_STRING, 0,
- MY_I_S_MAYBE_NULL, "table_name", SKIP_OPEN_TABLE},
- {NULL, 0, MYSQL_TYPE_STRING, 0, 0, NULL, 0}
+ Column("THREAD_ID", ULonglong(20), NOT_NULL, "thread_id"),
+ Column("LOCK_MODE", Varchar(24), NULLABLE, "lock_mode"),
+ Column("LOCK_DURATION", Varchar(30), NULLABLE, "lock_duration"),
+ Column("LOCK_TYPE", Varchar(33), NULLABLE, "lock_type"),
+ Column("TABLE_SCHEMA", Name(), NULLABLE, "table_schema"),
+ Column("TABLE_NAME", Name(), NULLABLE, "table_name"),
+ CEnd()
};
+} // namespace Show
+
+
struct st_i_s_metadata_param
{
THD *thd;
@@ -110,7 +109,7 @@ static int i_s_metadata_lock_info_init(
ST_SCHEMA_TABLE *schema = (ST_SCHEMA_TABLE *) p;
DBUG_ENTER("i_s_metadata_lock_info_init");
- schema->fields_info = i_s_metadata_lock_info_fields_info;
+ schema->fields_info = Show::i_s_metadata_lock_info_fields_info;
schema->fill_table = i_s_metadata_lock_info_fill_table;
schema->idx_field1 = 0;
DBUG_RETURN(0);
diff --git a/plugin/qc_info/qc_info.cc b/plugin/qc_info/qc_info.cc
index c01207571d2..1da9c5f6ee8 100644
--- a/plugin/qc_info/qc_info.cc
+++ b/plugin/qc_info/qc_info.cc
@@ -37,7 +37,7 @@
#include <sql_acl.h> // PROCESS_ACL
#include <sql_class.h> // THD
#include <sql_cache.h>
-#include <table.h> // ST_SCHEMA_TABLE
+#include <sql_i_s.h> // ST_SCHEMA_TABLE
#include <set_var.h> // sql_mode_string_representation
#include <tztime.h>
#include <mysql/plugin.h>
@@ -79,36 +79,41 @@ bool schema_table_store_record(THD *thd, TABLE *table);
#define COLUMN_PKT_NR 22
#define COLUMN_HITS 23
+
+namespace Show {
+
/* ST_FIELD_INFO is defined in table.h */
static ST_FIELD_INFO qc_info_fields[]=
{
- {"STATEMENT_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, 0},
- {"STATEMENT_TEXT", MAX_STATEMENT_TEXT_LENGTH, MYSQL_TYPE_STRING, 0, 0, 0, 0},
- {"RESULT_BLOCKS_COUNT", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, 0, 0},
- {"RESULT_BLOCKS_SIZE", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, 0, 0},
- {"RESULT_BLOCKS_SIZE_USED", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, 0, 0},
- {"LIMIT", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, 0, 0},
- {"MAX_SORT_LENGTH", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, 0, 0},
- {"GROUP_CONCAT_MAX_LENGTH", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, 0, 0},
- {"CHARACTER_SET_CLIENT", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, 0, 0},
- {"CHARACTER_SET_RESULT", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, 0, 0},
- {"COLLATION", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, 0, 0},
- {"TIMEZONE", 50, MYSQL_TYPE_STRING, 0, 0, 0, 0},
- {"DEFAULT_WEEK_FORMAT", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, 0, 0},
- {"DIV_PRECISION_INCREMENT", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, 0, 0},
- {"SQL_MODE", 250, MYSQL_TYPE_STRING, 0, 0, 0, 0},
- {"LC_TIME_NAMES", 100, MYSQL_TYPE_STRING, 0, 0, 0, 0},
- {"CLIENT_LONG_FLAG", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_TINY, 0, 0, 0, 0},
- {"CLIENT_PROTOCOL_41", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_TINY, 0, 0, 0, 0},
- {"PROTOCOL_TYPE", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_TINY, 0, 0, 0, 0},
- {"MORE_RESULTS_EXISTS", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_TINY, 0, 0, 0, 0},
- {"IN_TRANS", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_TINY, 0, 0, 0, 0},
- {"AUTOCOMMIT", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_TINY, 0, 0, 0, 0},
- {"PACKET_NUMBER", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_TINY, 0, 0, 0, 0},
- {"HITS", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, MY_I_S_UNSIGNED, 0, 0},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, 0}
+ Column("STATEMENT_SCHEMA", Varchar(NAME_LEN), NOT_NULL),
+ Column("STATEMENT_TEXT", Longtext(MAX_STATEMENT_TEXT_LENGTH),NOT_NULL),
+ Column("RESULT_BLOCKS_COUNT", SLong(), NOT_NULL),
+ Column("RESULT_BLOCKS_SIZE", SLonglong(MY_INT32_NUM_DECIMAL_DIGITS),NOT_NULL),
+ Column("RESULT_BLOCKS_SIZE_USED",SLonglong(MY_INT32_NUM_DECIMAL_DIGITS), NOT_NULL),
+ Column("LIMIT", SLonglong(MY_INT32_NUM_DECIMAL_DIGITS), NOT_NULL),
+ Column("MAX_SORT_LENGTH", SLonglong(MY_INT32_NUM_DECIMAL_DIGITS), NOT_NULL),
+ Column("GROUP_CONCAT_MAX_LENGTH",SLonglong(MY_INT32_NUM_DECIMAL_DIGITS), NOT_NULL),
+ Column("CHARACTER_SET_CLIENT", CSName(), NOT_NULL),
+ Column("CHARACTER_SET_RESULT", CSName(), NOT_NULL),
+ Column("COLLATION", CSName(), NOT_NULL),
+ Column("TIMEZONE", Varchar(50), NOT_NULL),
+ Column("DEFAULT_WEEK_FORMAT", SLong(), NOT_NULL),
+ Column("DIV_PRECISION_INCREMENT",SLong(), NOT_NULL),
+ Column("SQL_MODE", Varchar(250), NOT_NULL),
+ Column("LC_TIME_NAMES", Varchar(100), NOT_NULL),
+ Column("CLIENT_LONG_FLAG", STiny(MY_INT32_NUM_DECIMAL_DIGITS), NOT_NULL),
+ Column("CLIENT_PROTOCOL_41", STiny(MY_INT32_NUM_DECIMAL_DIGITS), NOT_NULL),
+ Column("PROTOCOL_TYPE", STiny(MY_INT32_NUM_DECIMAL_DIGITS), NOT_NULL),
+ Column("MORE_RESULTS_EXISTS", STiny(MY_INT32_NUM_DECIMAL_DIGITS), NOT_NULL),
+ Column("IN_TRANS", STiny(MY_INT32_NUM_DECIMAL_DIGITS), NOT_NULL),
+ Column("AUTOCOMMIT", STiny(MY_INT32_NUM_DECIMAL_DIGITS), NOT_NULL),
+ Column("PACKET_NUMBER", STiny(MY_INT32_NUM_DECIMAL_DIGITS), NOT_NULL),
+ Column("HITS", SLonglong(MY_INT32_NUM_DECIMAL_DIGITS), NOT_NULL),
+ CEnd()
};
+} // namespace Show
+
static const char unknown[]= "#UNKNOWN#";
@@ -276,7 +281,7 @@ static int qc_info_plugin_init(void *p)
{
ST_SCHEMA_TABLE *schema= (ST_SCHEMA_TABLE *)p;
- schema->fields_info= qc_info_fields;
+ schema->fields_info= Show::qc_info_fields;
schema->fill_table= qc_info_fill_table;
#ifdef _WIN32
diff --git a/plugin/query_response_time/plugin.cc b/plugin/query_response_time/plugin.cc
index c337424039c..0362c6e2792 100644
--- a/plugin/query_response_time/plugin.cc
+++ b/plugin/query_response_time/plugin.cc
@@ -16,7 +16,7 @@
#define MYSQL_SERVER
#include <my_global.h>
#include <sql_class.h>
-#include <table.h>
+#include <sql_i_s.h>
#include <sql_show.h>
#include <mysql/plugin_audit.h>
#include "query_response_time.h"
@@ -71,19 +71,22 @@ static struct st_mysql_sys_var *query_response_time_info_vars[]=
};
+namespace Show {
+
ST_FIELD_INFO query_response_time_fields_info[] =
{
- { "TIME", QRT_TIME_STRING_LENGTH, MYSQL_TYPE_STRING, 0, 0, "Time", 0 },
- { "COUNT", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, MY_I_S_UNSIGNED, "Count", 0 },
- { "TOTAL", QRT_TIME_STRING_LENGTH, MYSQL_TYPE_STRING, 0, 0, "Total", 0 },
- { 0, 0, MYSQL_TYPE_NULL, 0, 0, 0, 0 }
+ Column("TIME", Varchar(QRT_TIME_STRING_LENGTH), NOT_NULL, "Time"),
+ Column("COUNT", ULong(), NOT_NULL, "Count"),
+ Column("TOTAL", Varchar(QRT_TIME_STRING_LENGTH), NOT_NULL, "Total"),
+ CEnd()
};
+} // namespace Show
static int query_response_time_info_init(void *p)
{
ST_SCHEMA_TABLE *i_s_query_response_time= (ST_SCHEMA_TABLE *) p;
- i_s_query_response_time->fields_info= query_response_time_fields_info;
+ i_s_query_response_time->fields_info= Show::query_response_time_fields_info;
i_s_query_response_time->fill_table= query_response_time_fill;
i_s_query_response_time->reset_table= query_response_time_flush;
query_response_time_init();
diff --git a/plugin/type_geom/CMakeLists.txt b/plugin/type_geom/CMakeLists.txt
new file mode 100644
index 00000000000..2b0c84f6fa0
--- /dev/null
+++ b/plugin/type_geom/CMakeLists.txt
@@ -0,0 +1,3 @@
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/sql)
+
+MYSQL_ADD_PLUGIN(TYPE_GEOM plugin.cc MANDATORY RECOMPILE_FOR_EMBEDDED)
diff --git a/plugin/type_geom/plugin.cc b/plugin/type_geom/plugin.cc
new file mode 100644
index 00000000000..aa2f9255f17
--- /dev/null
+++ b/plugin/type_geom/plugin.cc
@@ -0,0 +1,254 @@
+/*
+ Copyright (c) 2000, 2015, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2019, 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#include <my_global.h>
+#include <sql_class.h> // THD
+#include <sql_i_s.h> // ST_SCHEMA_TABLE
+#include <mysql/plugin.h>
+#include "sql_show.h" // get_all_tables()
+#include "sql_error.h" // convert_error_to_warning()
+#include "sql_type_geom.h"
+
+
+/*********** INFORMATION_SCHEMA.SPATIEL_REF_SYS *******************/
+
+namespace Show {
+
+static ST_FIELD_INFO spatial_ref_sys_fields_info[]=
+{
+ Column("SRID", SShort(5), NOT_NULL),
+ Column("AUTH_NAME", Varchar(FN_REFLEN), NOT_NULL),
+ Column("AUTH_SRID", SLong(5), NOT_NULL),
+ Column("SRTEXT", Varchar(2048), NOT_NULL),
+ CEnd()
+};
+
+
+static int spatial_ref_sys_fill(THD *thd, TABLE_LIST *tables, COND *cond)
+{
+ DBUG_ENTER("fill_spatial_ref_sys");
+ TABLE *table= tables->table;
+ CHARSET_INFO *cs= system_charset_info;
+ int result= 1;
+
+ restore_record(table, s->default_values);
+
+ table->field[0]->store(-1, FALSE); /*SRID*/
+ table->field[1]->store(STRING_WITH_LEN("Not defined"), cs); /*AUTH_NAME*/
+ table->field[2]->store(-1, FALSE); /*AUTH_SRID*/
+ table->field[3]->store(STRING_WITH_LEN(
+ "LOCAL_CS[\"Spatial reference wasn't specified\","
+ "LOCAL_DATUM[\"Unknown\",0]," "UNIT[\"m\",1.0]," "AXIS[\"x\",EAST],"
+ "AXIS[\"y\",NORTH]]"), cs);/*SRTEXT*/
+ if (schema_table_store_record(thd, table))
+ goto exit;
+
+ table->field[0]->store(0, TRUE); /*SRID*/
+ table->field[1]->store(STRING_WITH_LEN("EPSG"), cs); /*AUTH_NAME*/
+ table->field[2]->store(404000, TRUE); /*AUTH_SRID*/
+ table->field[3]->store(STRING_WITH_LEN(
+ "LOCAL_CS[\"Wildcard 2D cartesian plane in metric unit\","
+ "LOCAL_DATUM[\"Unknown\",0]," "UNIT[\"m\",1.0],"
+ "AXIS[\"x\",EAST]," "AXIS[\"y\",NORTH],"
+ "AUTHORITY[\"EPSG\",\"404000\"]]"), cs);/*SRTEXT*/
+ if (schema_table_store_record(thd, table))
+ goto exit;
+
+ result= 0;
+
+exit:
+ DBUG_RETURN(result);
+}
+
+
+static int plugin_init_spatial_ref_sys(void *p)
+{
+ ST_SCHEMA_TABLE *schema= (ST_SCHEMA_TABLE *)p;
+ schema->fields_info= spatial_ref_sys_fields_info;
+ schema->fill_table= spatial_ref_sys_fill;
+ return 0;
+}
+
+
+static struct st_mysql_information_schema spatial_ref_sys_plugin=
+{ MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION };
+
+
+} // namespace Show
+
+/*********** INFORMATION_SCHEMA.GEOMETRY_COLUMNS *******************/
+
+
+namespace Show {
+
+static ST_FIELD_INFO geometry_columns_fields_info[]=
+{
+ Column("F_TABLE_CATALOG", Catalog(), NOT_NULL, OPEN_FRM_ONLY),
+ Column("F_TABLE_SCHEMA", Name(), NOT_NULL, OPEN_FRM_ONLY),
+ Column("F_TABLE_NAME", Name(), NOT_NULL, OPEN_FRM_ONLY),
+ Column("F_GEOMETRY_COLUMN", Name(), NOT_NULL, OPEN_FRM_ONLY),
+ Column("G_TABLE_CATALOG", Catalog(), NOT_NULL, OPEN_FRM_ONLY),
+ Column("G_TABLE_SCHEMA", Name(), NOT_NULL, OPEN_FRM_ONLY),
+ Column("G_TABLE_NAME", Name(), NOT_NULL, OPEN_FRM_ONLY),
+ Column("G_GEOMETRY_COLUMN", Name(), NOT_NULL, OPEN_FRM_ONLY),
+ Column("STORAGE_TYPE", STiny(2), NOT_NULL, OPEN_FRM_ONLY),
+ Column("GEOMETRY_TYPE", SLong(7), NOT_NULL, OPEN_FRM_ONLY),
+ Column("COORD_DIMENSION", STiny(2), NOT_NULL, OPEN_FRM_ONLY),
+ Column("MAX_PPR", STiny(2), NOT_NULL, OPEN_FRM_ONLY),
+ Column("SRID", SShort(5), NOT_NULL, OPEN_FRM_ONLY),
+ CEnd()
+};
+
+
+static void geometry_columns_fill_record(TABLE *table,
+ const LEX_CSTRING *db_name,
+ const LEX_CSTRING *table_name,
+ const Field_geom *field)
+{
+ static const LEX_CSTRING catalog= {STRING_WITH_LEN("def")};
+ const CHARSET_INFO *cs= system_charset_info;
+ const Type_handler_geometry *gth= field->type_handler_geom();
+ /*F_TABLE_CATALOG*/
+ table->field[0]->store(catalog, cs);
+ /*F_TABLE_SCHEMA*/
+ table->field[1]->store(db_name, cs);
+ /*F_TABLE_NAME*/
+ table->field[2]->store(table_name, cs);
+ /*G_TABLE_CATALOG*/
+ table->field[4]->store(catalog, cs);
+ /*G_TABLE_SCHEMA*/
+ table->field[5]->store(db_name, cs);
+ /*G_TABLE_NAME*/
+ table->field[6]->store(table_name, cs);
+ /*G_GEOMETRY_COLUMN*/
+ table->field[7]->store(field->field_name, cs);
+ /*STORAGE_TYPE*/
+ table->field[8]->store(1LL, true); /*Always 1 (binary implementation)*/
+ /*GEOMETRY_TYPE*/
+ table->field[9]->store((longlong) (gth->geometry_type()), true);
+ /*COORD_DIMENSION*/
+ table->field[10]->store(2LL, true);
+ /*MAX_PPR*/
+ table->field[11]->set_null();
+ /*SRID*/
+ table->field[12]->store((longlong) (field->get_srid()), true);
+}
+
+
+static int get_geometry_column_record(THD *thd, TABLE_LIST *tables,
+ TABLE *table, bool res,
+ const LEX_CSTRING *db_name,
+ const LEX_CSTRING *table_name)
+{
+ TABLE *show_table;
+ Field **ptr, *field;
+ DBUG_ENTER("get_geometry_column_record");
+
+ if (res)
+ {
+ /*
+ open_table() failed with an error.
+ Convert the error to a warning and let the caller
+ continue with the next table.
+ */
+ convert_error_to_warning(thd);
+ DBUG_RETURN(0);
+ }
+
+ // Skip INFORMATION_SCHEMA tables. They don't have geometry columns.
+ if (tables->schema_table)
+ DBUG_RETURN(0);
+
+ show_table= tables->table;
+ ptr= show_table->field;
+ show_table->use_all_columns(); // Required for default
+ restore_record(show_table, s->default_values);
+
+ for (; (field= *ptr) ; ptr++)
+ {
+ const Field_geom *fg;
+ if (field->type() == MYSQL_TYPE_GEOMETRY &&
+ (fg= dynamic_cast<const Field_geom*>(field)))
+ {
+ DEBUG_SYNC(thd, "get_schema_column");
+ /* Get default row, with all NULL fields set to NULL */
+ restore_record(table, s->default_values);
+ geometry_columns_fill_record(table, db_name, table_name, fg);
+ if (schema_table_store_record(thd, table))
+ DBUG_RETURN(1);
+ }
+ }
+
+ DBUG_RETURN(0);
+}
+
+
+static int plugin_init_geometry_columns(void *p)
+{
+ ST_SCHEMA_TABLE *schema= (ST_SCHEMA_TABLE *)p;
+ schema->fields_info= geometry_columns_fields_info;
+ schema->fill_table= get_all_tables;
+ schema->process_table= get_geometry_column_record;
+ schema->idx_field1= 1;
+ schema->idx_field2= 2;
+ schema->i_s_requested_object= OPTIMIZE_I_S_TABLE | OPEN_VIEW_FULL;
+ return 0;
+}
+
+
+static struct st_mysql_information_schema geometry_columns_plugin=
+{ MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION };
+
+
+} // namespace Show
+
+
+/********************* Plugin library descriptors ************************/
+
+
+maria_declare_plugin(type_geom)
+{
+ MYSQL_INFORMATION_SCHEMA_PLUGIN, // the plugin type (see include/mysql/plugin.h)
+ &Show::spatial_ref_sys_plugin, // pointer to type-specific plugin descriptor
+ "SPATIAL_REF_SYS", // plugin name
+ "MariaDB", // plugin author
+ "Lists all geometry columns", // the plugin description
+ PLUGIN_LICENSE_GPL, // the plugin license (see include/mysql/plugin.h)
+ Show::plugin_init_spatial_ref_sys, // Pointer to plugin initialization function
+ 0, // Pointer to plugin deinitialization function
+ 0x0100, // Numeric version 0xAABB means AA.BB veriosn
+ NULL, // Status variables
+ NULL, // System variables
+ "1.0", // String version representation
+ MariaDB_PLUGIN_MATURITY_ALPHA // Maturity (see include/mysql/plugin.h)*/
+},
+{
+ MYSQL_INFORMATION_SCHEMA_PLUGIN, // the plugin type (see include/mysql/plugin.h)
+ &Show::geometry_columns_plugin, // pointer to type-specific plugin descriptor
+ "GEOMETRY_COLUMNS", // plugin name
+ "MariaDB", // plugin author
+ "Lists all geometry columns", // the plugin description
+ PLUGIN_LICENSE_GPL, // the plugin license (see include/mysql/plugin.h)
+ Show::plugin_init_geometry_columns,// Pointer to plugin initialization function
+ 0, // Pointer to plugin deinitialization function
+ 0x0100, // Numeric version 0xAABB means AA.BB veriosn
+ NULL, // Status variables
+ NULL, // System variables
+ "1.0", // String version representation
+ MariaDB_PLUGIN_MATURITY_ALPHA // Maturity (see include/mysql/plugin.h)
+}
+maria_declare_plugin_end;
diff --git a/plugin/type_inet/CMakeLists.txt b/plugin/type_inet/CMakeLists.txt
new file mode 100644
index 00000000000..d2a9d9f5fb0
--- /dev/null
+++ b/plugin/type_inet/CMakeLists.txt
@@ -0,0 +1,18 @@
+# Copyright (c) 2016-2019, 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 Street, Fifth Floor, Boston, MA 02110-1335 USA
+
+MYSQL_ADD_PLUGIN(type_inet
+ plugin.cc item_inetfunc.cc sql_type_inet.cc
+ MANDATORY RECOMPILE_FOR_EMBEDDED)
diff --git a/plugin/type_inet/item_inetfunc.cc b/plugin/type_inet/item_inetfunc.cc
new file mode 100644
index 00000000000..50bd82817e0
--- /dev/null
+++ b/plugin/type_inet/item_inetfunc.cc
@@ -0,0 +1,256 @@
+/* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2014 MariaDB Foundation
+ Copyright (c) 2019 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-1335 USA */
+
+#define MYSQL_SERVER
+#include "mariadb.h"
+#include "item_inetfunc.h"
+#include "sql_type_inet.h"
+
+///////////////////////////////////////////////////////////////////////////
+
+longlong Item_func_inet_aton::val_int()
+{
+ DBUG_ASSERT(fixed);
+
+ uint byte_result= 0;
+ ulonglong result= 0; // We are ready for 64 bit addresses
+ const char *p,* end;
+ char c= '.'; // we mark c to indicate invalid IP in case length is 0
+ int dot_count= 0;
+
+ StringBuffer<36> tmp;
+ String *s= args[0]->val_str_ascii(&tmp);
+
+ if (!s) // If null value
+ goto err;
+
+ null_value= 0;
+
+ end= (p = s->ptr()) + s->length();
+ while (p < end)
+ {
+ c= *p++;
+ int digit= (int) (c - '0');
+ if (digit >= 0 && digit <= 9)
+ {
+ if ((byte_result= byte_result * 10 + digit) > 255)
+ goto err; // Wrong address
+ }
+ else if (c == '.')
+ {
+ dot_count++;
+ result= (result << 8) + (ulonglong) byte_result;
+ byte_result= 0;
+ }
+ else
+ goto err; // Invalid character
+ }
+ if (c != '.') // IP number can't end on '.'
+ {
+ /*
+ Attempt to support short forms of IP-addresses. It's however pretty
+ basic one comparing to the BSD support.
+ Examples:
+ 127 -> 0.0.0.127
+ 127.255 -> 127.0.0.255
+ 127.256 -> NULL (should have been 127.0.1.0)
+ 127.2.1 -> 127.2.0.1
+ */
+ switch (dot_count) {
+ case 1: result<<= 8; /* Fall through */
+ case 2: result<<= 8; /* Fall through */
+ }
+ return (result << 8) + (ulonglong) byte_result;
+ }
+
+err:
+ null_value=1;
+ return 0;
+}
+
+
+String* Item_func_inet_ntoa::val_str(String* str)
+{
+ DBUG_ASSERT(fixed);
+
+ ulonglong n= (ulonglong) args[0]->val_int();
+
+ /*
+ We do not know if args[0] is NULL until we have called
+ some val function on it if args[0] is not a constant!
+
+ Also return null if n > 255.255.255.255
+ */
+ if ((null_value= (args[0]->null_value || n > 0xffffffff)))
+ return 0; // Null value
+
+ str->set_charset(collation.collation);
+ str->length(0);
+
+ uchar buf[8];
+ int4store(buf, n);
+
+ /* Now we can assume little endian. */
+
+ char num[4];
+ num[3]= '.';
+
+ for (uchar *p= buf + 4; p-- > buf;)
+ {
+ uint c= *p;
+ uint n1, n2; // Try to avoid divisions
+ n1= c / 100; // 100 digits
+ c-= n1 * 100;
+ n2= c / 10; // 10 digits
+ c-= n2 * 10; // last digit
+ num[0]= (char) n1 + '0';
+ num[1]= (char) n2 + '0';
+ num[2]= (char) c + '0';
+ uint length= (n1 ? 4 : n2 ? 3 : 2); // Remove pre-zero
+ uint dot_length= (p <= buf) ? 1 : 0;
+ (void) str->append(num + 4 - length, length - dot_length,
+ &my_charset_latin1);
+ }
+
+ return str;
+}
+
+
+///////////////////////////////////////////////////////////////////////////
+
+/**
+ Converts IP-address-string to IP-address-data.
+
+ ipv4-string -> varbinary(4)
+ ipv6-string -> varbinary(16)
+
+ @return Completion status.
+ @retval NULL Given string does not represent an IP-address.
+ @retval !NULL The string has been converted sucessfully.
+*/
+
+String *Item_func_inet6_aton::val_str(String *buffer)
+{
+ DBUG_ASSERT(fixed);
+
+ Ascii_ptr_and_buffer<STRING_BUFFER_USUAL_SIZE> tmp(args[0]);
+ if ((null_value= tmp.is_null()))
+ return NULL;
+
+ Inet4_null ipv4(*tmp.string());
+ if (!ipv4.is_null())
+ {
+ ipv4.to_binary(buffer);
+ return buffer;
+ }
+
+ Inet6_null ipv6(*tmp.string());
+ if (!ipv6.is_null())
+ {
+ ipv6.to_binary(buffer);
+ return buffer;
+ }
+
+ null_value= true;
+ return NULL;
+}
+
+
+/**
+ Converts IP-address-data to IP-address-string.
+*/
+
+String *Item_func_inet6_ntoa::val_str_ascii(String *buffer)
+{
+ DBUG_ASSERT(fixed);
+
+ // Binary string argument expected
+ if (unlikely(args[0]->result_type() != STRING_RESULT ||
+ args[0]->collation.collation != &my_charset_bin))
+ {
+ null_value= true;
+ return NULL;
+ }
+
+ String_ptr_and_buffer<STRING_BUFFER_USUAL_SIZE> tmp(args[0]);
+ if ((null_value= tmp.is_null()))
+ return NULL;
+
+ Inet4_null ipv4(static_cast<const Binary_string&>(*tmp.string()));
+ if (!ipv4.is_null())
+ {
+ ipv4.to_string(buffer);
+ return buffer;
+ }
+
+ Inet6_null ipv6(static_cast<const Binary_string&>(*tmp.string()));
+ if (!ipv6.is_null())
+ {
+ ipv6.to_string(buffer);
+ return buffer;
+ }
+
+ DBUG_PRINT("info", ("INET6_NTOA(): varbinary(4) or varbinary(16) expected."));
+ null_value= true;
+ return NULL;
+}
+
+
+/**
+ Checks if the passed string represents an IPv4-address.
+*/
+
+longlong Item_func_is_ipv4::val_int()
+{
+ DBUG_ASSERT(fixed);
+ String_ptr_and_buffer<STRING_BUFFER_USUAL_SIZE> tmp(args[0]);
+ return !tmp.is_null() && !Inet4_null(*tmp.string()).is_null();
+}
+
+
+/**
+ Checks if the passed string represents an IPv6-address.
+*/
+
+longlong Item_func_is_ipv6::val_int()
+{
+ DBUG_ASSERT(fixed);
+ String_ptr_and_buffer<STRING_BUFFER_USUAL_SIZE> tmp(args[0]);
+ return !tmp.is_null() && !Inet6_null(*tmp.string()).is_null();
+}
+
+
+/**
+ Checks if the passed IPv6-address is an IPv4-compat IPv6-address.
+*/
+
+longlong Item_func_is_ipv4_compat::val_int()
+{
+ Inet6_null ip6(args[0]);
+ return !ip6.is_null() && ip6.is_v4compat();
+}
+
+
+/**
+ Checks if the passed IPv6-address is an IPv4-mapped IPv6-address.
+*/
+
+longlong Item_func_is_ipv4_mapped::val_int()
+{
+ Inet6_null ip6(args[0]);
+ return !ip6.is_null() && ip6.is_v4mapped();
+}
diff --git a/sql/item_inetfunc.h b/plugin/type_inet/item_inetfunc.h
index 8cfb4cd278c..94255426f68 100644
--- a/sql/item_inetfunc.h
+++ b/plugin/type_inet/item_inetfunc.h
@@ -3,6 +3,7 @@
/* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2014 MariaDB Foundation
+ Copyright (c) 2019 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
diff --git a/plugin/type_inet/mysql-test/type_inet/binlog_stm_type_inet6.result b/plugin/type_inet/mysql-test/type_inet/binlog_stm_type_inet6.result
new file mode 100644
index 00000000000..e09b1021651
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/binlog_stm_type_inet6.result
@@ -0,0 +1,34 @@
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('::');
+INSERT INTO t1 VALUES ('ffff::ffff');
+PREPARE stmt FROM 'INSERT INTO t1 VALUES (?)';
+EXECUTE stmt USING CAST('::1' AS INET6);
+EXECUTE stmt USING CAST(CONCAT(REPEAT(0x00,15), 0x02) AS INET6);
+DEALLOCATE PREPARE stmt;
+BEGIN NOT ATOMIC
+DECLARE a INET6 DEFAULT '::3';
+INSERT INTO t1 VALUES (a);
+END;
+$$
+DROP TABLE t1;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INET6)
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES ('::')
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES ('ffff::ffff')
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES ('::1')
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES ('::2')
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES ( NAME_CONST('a','::3'))
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
diff --git a/plugin/type_inet/mysql-test/type_inet/binlog_stm_type_inet6.test b/plugin/type_inet/mysql-test/type_inet/binlog_stm_type_inet6.test
new file mode 100644
index 00000000000..d51448090c4
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/binlog_stm_type_inet6.test
@@ -0,0 +1,28 @@
+--source include/not_embedded.inc
+--source include/have_binlog_format_statement.inc
+
+--disable_query_log
+reset master; # get rid of previous tests binlog
+--enable_query_log
+
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('::');
+INSERT INTO t1 VALUES ('ffff::ffff');
+
+PREPARE stmt FROM 'INSERT INTO t1 VALUES (?)';
+EXECUTE stmt USING CAST('::1' AS INET6);
+EXECUTE stmt USING CAST(CONCAT(REPEAT(0x00,15), 0x02) AS INET6);
+DEALLOCATE PREPARE stmt;
+
+DELIMITER $$;
+BEGIN NOT ATOMIC
+ DECLARE a INET6 DEFAULT '::3';
+ INSERT INTO t1 VALUES (a);
+END;
+$$
+DELIMITER ;$$
+
+DROP TABLE t1;
+
+--let $binlog_file = LAST
+source include/show_binlog_events.inc;
diff --git a/plugin/type_inet/mysql-test/type_inet/func_inet_plugin.result b/plugin/type_inet/mysql-test/type_inet/func_inet_plugin.result
new file mode 100644
index 00000000000..4663ae485e2
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/func_inet_plugin.result
@@ -0,0 +1,31 @@
+#
+# Start of 10.5 tests
+#
+#
+# MDEV-20768 Turn INET functions into a function collection plugin
+#
+SELECT
+PLUGIN_NAME,
+PLUGIN_VERSION,
+PLUGIN_STATUS,
+PLUGIN_TYPE,
+PLUGIN_AUTHOR,
+PLUGIN_DESCRIPTION,
+PLUGIN_LICENSE,
+PLUGIN_MATURITY,
+PLUGIN_AUTH_VERSION
+FROM INFORMATION_SCHEMA.PLUGINS
+WHERE PLUGIN_TYPE='FUNCTION COLLECTION'
+ AND PLUGIN_NAME='func_inet';
+PLUGIN_NAME func_inet
+PLUGIN_VERSION 1.0
+PLUGIN_STATUS ACTIVE
+PLUGIN_TYPE FUNCTION COLLECTION
+PLUGIN_AUTHOR MariaDB Corporation
+PLUGIN_DESCRIPTION Function collection test
+PLUGIN_LICENSE GPL
+PLUGIN_MATURITY Experimental
+PLUGIN_AUTH_VERSION 1.0
+#
+# End of 10.5 tests
+#
diff --git a/plugin/type_inet/mysql-test/type_inet/func_inet_plugin.test b/plugin/type_inet/mysql-test/type_inet/func_inet_plugin.test
new file mode 100644
index 00000000000..8047e7f1513
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/func_inet_plugin.test
@@ -0,0 +1,27 @@
+--echo #
+--echo # Start of 10.5 tests
+--echo #
+
+--echo #
+--echo # MDEV-20768 Turn INET functions into a function collection plugin
+--echo #
+
+--vertical_results
+SELECT
+ PLUGIN_NAME,
+ PLUGIN_VERSION,
+ PLUGIN_STATUS,
+ PLUGIN_TYPE,
+ PLUGIN_AUTHOR,
+ PLUGIN_DESCRIPTION,
+ PLUGIN_LICENSE,
+ PLUGIN_MATURITY,
+ PLUGIN_AUTH_VERSION
+FROM INFORMATION_SCHEMA.PLUGINS
+ WHERE PLUGIN_TYPE='FUNCTION COLLECTION'
+ AND PLUGIN_NAME='func_inet';
+--horizontal_results
+
+--echo #
+--echo # End of 10.5 tests
+--echo #
diff --git a/plugin/type_inet/mysql-test/type_inet/rpl_type_inet6.result b/plugin/type_inet/mysql-test/type_inet/rpl_type_inet6.result
new file mode 100644
index 00000000000..5bda0b079a5
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/rpl_type_inet6.result
@@ -0,0 +1,17 @@
+include/master-slave.inc
+[connection master]
+#
+# MDEV-274 The data type for IPv6/IPv4 addresses in MariaDB
+#
+connection master;
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('::'),('ffff::ffff');
+connection slave;
+SELECT HEX(a), a FROM t1;
+HEX(a) a
+00000000000000000000000000000000 ::
+FFFF000000000000000000000000FFFF ffff::ffff
+connection master;
+DROP TABLE t1;
+connection slave;
+include/rpl_end.inc
diff --git a/plugin/type_inet/mysql-test/type_inet/rpl_type_inet6.test b/plugin/type_inet/mysql-test/type_inet/rpl_type_inet6.test
new file mode 100644
index 00000000000..91c092b6e20
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/rpl_type_inet6.test
@@ -0,0 +1,16 @@
+--source include/master-slave.inc
+
+--echo #
+--echo # MDEV-274 The data type for IPv6/IPv4 addresses in MariaDB
+--echo #
+
+connection master;
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('::'),('ffff::ffff');
+sync_slave_with_master;
+SELECT HEX(a), a FROM t1;
+connection master;
+DROP TABLE t1;
+sync_slave_with_master;
+
+--source include/rpl_end.inc
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6-debug.result b/plugin/type_inet/mysql-test/type_inet/type_inet6-debug.result
new file mode 100644
index 00000000000..0e879aad58f
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6-debug.result
@@ -0,0 +1,18 @@
+#
+# MDEV-274 The data type for IPv6/IPv4 addresses in MariaDB
+#
+SET @old_debug_dbug=@@debug_dbug;
+SET debug_dbug="+d,frm_data_type_info";
+CREATE TABLE t1 (c01 INET6, c02 INET6);
+Warnings:
+Note 1105 build_frm_image: Field data type info length: 14
+Note 1105 DBUG: [0] name='c01' type_info='inet6'
+Note 1105 DBUG: [1] name='c02' type_info='inet6'
+SET debug_dbug=@old_debug_dbug;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c01` inet6 DEFAULT NULL,
+ `c02` inet6 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6-debug.test b/plugin/type_inet/mysql-test/type_inet/type_inet6-debug.test
new file mode 100644
index 00000000000..ef5ea8363f2
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6-debug.test
@@ -0,0 +1,14 @@
+--source include/have_debug.inc
+
+--echo #
+--echo # MDEV-274 The data type for IPv6/IPv4 addresses in MariaDB
+--echo #
+
+SET @old_debug_dbug=@@debug_dbug;
+
+SET debug_dbug="+d,frm_data_type_info";
+CREATE TABLE t1 (c01 INET6, c02 INET6);
+SET debug_dbug=@old_debug_dbug;
+
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6.result b/plugin/type_inet/mysql-test/type_inet/type_inet6.result
new file mode 100644
index 00000000000..9e3601e414b
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6.result
@@ -0,0 +1,1933 @@
+#
+# Basic CREATE functionality, defaults, metadata
+#
+CREATE TABLE t1 (a INET6 AUTO_INCREMENT);
+ERROR 42000: Incorrect column specifier for column 'a'
+CREATE TABLE t1 (a INET6);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` inet6 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DESCRIBE t1;
+Field Type Null Key Default Extra
+a inet6 YES NULL
+SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='test' AND table_name='t1';
+TABLE_CATALOG def
+TABLE_SCHEMA test
+TABLE_NAME t1
+COLUMN_NAME a
+ORDINAL_POSITION 1
+COLUMN_DEFAULT NULL
+IS_NULLABLE YES
+DATA_TYPE inet6
+CHARACTER_MAXIMUM_LENGTH NULL
+CHARACTER_OCTET_LENGTH NULL
+NUMERIC_PRECISION NULL
+NUMERIC_SCALE NULL
+DATETIME_PRECISION NULL
+CHARACTER_SET_NAME NULL
+COLLATION_NAME NULL
+COLUMN_TYPE inet6
+COLUMN_KEY
+EXTRA
+PRIVILEGES #
+COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
+DROP TABLE t1;
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('::1');
+SELECT * FROM t1;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def test t1 t1 a a 254 39 3 Y 160 0 8
+a
+::1
+SELECT CAST('::' AS INET6) AS a;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def a 254 39 2 N 33 0 8
+a
+::
+DROP TABLE t1;
+CREATE TABLE t1 (
+c1 INET6 DEFAULT 0x00000000000000000000000000000000,
+c2 INET6 DEFAULT 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF,
+c3 INET6 DEFAULT '::',
+c4 INET6 DEFAULT 'FFFF::ffff',
+c5 INET6 DEFAULT CAST(X'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF' AS INET6)
+);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` inet6 DEFAULT '::',
+ `c2` inet6 DEFAULT 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff',
+ `c3` inet6 DEFAULT '::',
+ `c4` inet6 DEFAULT 'ffff::ffff',
+ `c5` inet6 DEFAULT cast(X'ffffffffffffffffffffffffffffffff' as inet6)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DESCRIBE t1;
+Field Type Null Key Default Extra
+c1 inet6 YES ::
+c2 inet6 YES ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
+c3 inet6 YES ::
+c4 inet6 YES ffff::ffff
+c5 inet6 YES cast(X'ffffffffffffffffffffffffffffffff' as inet6)
+SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='test' AND table_name='t1';
+TABLE_CATALOG def
+TABLE_SCHEMA test
+TABLE_NAME t1
+COLUMN_NAME c1
+ORDINAL_POSITION 1
+COLUMN_DEFAULT '::'
+IS_NULLABLE YES
+DATA_TYPE inet6
+CHARACTER_MAXIMUM_LENGTH NULL
+CHARACTER_OCTET_LENGTH NULL
+NUMERIC_PRECISION NULL
+NUMERIC_SCALE NULL
+DATETIME_PRECISION NULL
+CHARACTER_SET_NAME NULL
+COLLATION_NAME NULL
+COLUMN_TYPE inet6
+COLUMN_KEY
+EXTRA
+PRIVILEGES #
+COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
+TABLE_CATALOG def
+TABLE_SCHEMA test
+TABLE_NAME t1
+COLUMN_NAME c2
+ORDINAL_POSITION 2
+COLUMN_DEFAULT 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff'
+IS_NULLABLE YES
+DATA_TYPE inet6
+CHARACTER_MAXIMUM_LENGTH NULL
+CHARACTER_OCTET_LENGTH NULL
+NUMERIC_PRECISION NULL
+NUMERIC_SCALE NULL
+DATETIME_PRECISION NULL
+CHARACTER_SET_NAME NULL
+COLLATION_NAME NULL
+COLUMN_TYPE inet6
+COLUMN_KEY
+EXTRA
+PRIVILEGES #
+COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
+TABLE_CATALOG def
+TABLE_SCHEMA test
+TABLE_NAME t1
+COLUMN_NAME c3
+ORDINAL_POSITION 3
+COLUMN_DEFAULT '::'
+IS_NULLABLE YES
+DATA_TYPE inet6
+CHARACTER_MAXIMUM_LENGTH NULL
+CHARACTER_OCTET_LENGTH NULL
+NUMERIC_PRECISION NULL
+NUMERIC_SCALE NULL
+DATETIME_PRECISION NULL
+CHARACTER_SET_NAME NULL
+COLLATION_NAME NULL
+COLUMN_TYPE inet6
+COLUMN_KEY
+EXTRA
+PRIVILEGES #
+COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
+TABLE_CATALOG def
+TABLE_SCHEMA test
+TABLE_NAME t1
+COLUMN_NAME c4
+ORDINAL_POSITION 4
+COLUMN_DEFAULT 'ffff::ffff'
+IS_NULLABLE YES
+DATA_TYPE inet6
+CHARACTER_MAXIMUM_LENGTH NULL
+CHARACTER_OCTET_LENGTH NULL
+NUMERIC_PRECISION NULL
+NUMERIC_SCALE NULL
+DATETIME_PRECISION NULL
+CHARACTER_SET_NAME NULL
+COLLATION_NAME NULL
+COLUMN_TYPE inet6
+COLUMN_KEY
+EXTRA
+PRIVILEGES #
+COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
+TABLE_CATALOG def
+TABLE_SCHEMA test
+TABLE_NAME t1
+COLUMN_NAME c5
+ORDINAL_POSITION 5
+COLUMN_DEFAULT cast(X'ffffffffffffffffffffffffffffffff' as inet6)
+IS_NULLABLE YES
+DATA_TYPE inet6
+CHARACTER_MAXIMUM_LENGTH NULL
+CHARACTER_OCTET_LENGTH NULL
+NUMERIC_PRECISION NULL
+NUMERIC_SCALE NULL
+DATETIME_PRECISION NULL
+CHARACTER_SET_NAME NULL
+COLLATION_NAME NULL
+COLUMN_TYPE inet6
+COLUMN_KEY
+EXTRA
+PRIVILEGES #
+COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INET6 DEFAULT 0x00);
+ERROR 42000: Invalid default value for 'c1'
+CREATE TABLE t1 (c1 INET6 DEFAULT '');
+ERROR 42000: Invalid default value for 'c1'
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('x');
+ERROR 22007: Incorrect inet6 value: 'x' for column `test`.`t1`.`a` at row 1
+INSERT INTO t1 VALUES (1);
+ERROR 22007: Incorrect inet6 value: '1' for column `test`.`t1`.`a` at row 1
+INSERT INTO t1 VALUES (TIME'10:20:30');
+ERROR 22007: Incorrect inet6 value: '10:20:30' for column `test`.`t1`.`a` at row 1
+INSERT INTO t1 VALUES (0x00);
+ERROR 22007: Incorrect inet6 value: '\x00' for column `test`.`t1`.`a` at row 1
+DROP TABLE t1;
+#
+# CAST
+#
+SELECT CAST('garbage' AS INET6);
+CAST('garbage' AS INET6)
+NULL
+Warnings:
+Warning 1292 Incorrect inet6 value: 'garbage'
+SELECT CAST(0x01 AS INET6);
+CAST(0x01 AS INET6)
+NULL
+Warnings:
+Warning 1292 Incorrect inet6 value: '\x01'
+SELECT CAST(REPEAT(0x00,16) AS INET6);
+CAST(REPEAT(0x00,16) AS INET6)
+::
+SELECT CAST(REPEAT(0x11,16) AS INET6);
+CAST(REPEAT(0x11,16) AS INET6)
+1111:1111:1111:1111:1111:1111:1111:1111
+CREATE TABLE t1 AS SELECT CAST('::' AS INET6);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `CAST('::' AS INET6)` inet6 NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+#
+# Text and binary formats, comparison operators
+#
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES (0x00000000000000000000000000000000);
+INSERT INTO t1 VALUES (0x00000000000000000000000000000001);
+INSERT INTO t1 VALUES (0xFFFF0000000000000000000000000001);
+INSERT INTO t1 VALUES (0xFFFF0000000000000000000000000002);
+SELECT * FROM t1 ORDER BY a;
+a
+::
+::1
+ffff::1
+ffff::2
+SELECT * FROM t1 ORDER BY a DESC;
+a
+ffff::2
+ffff::1
+::1
+::
+SELECT HEX(a),a FROM t1 ORDER BY a;
+HEX(a) a
+00000000000000000000000000000000 ::
+00000000000000000000000000000001 ::1
+FFFF0000000000000000000000000001 ffff::1
+FFFF0000000000000000000000000002 ffff::2
+SELECT * FROM t1 WHERE a='::';
+a
+::
+SELECT * FROM t1 WHERE a='::1';
+a
+::1
+SELECT * FROM t1 WHERE a='ffff::1';
+a
+ffff::1
+SELECT * FROM t1 WHERE a='ffff::2';
+a
+ffff::2
+SELECT * FROM t1 WHERE a=0x00000000000000000000000000000000;
+a
+::
+SELECT * FROM t1 WHERE a=0x00000000000000000000000000000001;
+a
+::1
+SELECT * FROM t1 WHERE a=0xffff0000000000000000000000000001;
+a
+ffff::1
+SELECT * FROM t1 WHERE a=0xffff0000000000000000000000000002;
+a
+ffff::2
+SELECT * FROM t1 WHERE a<'::';
+a
+SELECT * FROM t1 WHERE a<='::';
+a
+::
+SELECT * FROM t1 WHERE a>='ffff::2';
+a
+ffff::2
+SELECT * FROM t1 WHERE a>'ffff::2';
+a
+SELECT * FROM t1 WHERE a IN ('::', 'ffff::1') ORDER BY a;
+a
+::
+ffff::1
+SELECT * FROM t1 WHERE a IN ('::', 0xffff0000000000000000000000000002) ORDER BY a;
+a
+::
+ffff::2
+SELECT * FROM t1 WHERE a<'garbage';
+a
+Warnings:
+Warning 1292 Incorrect inet6 value: 'garbage'
+SELECT * FROM t1 WHERE a<='garbage';
+a
+Warnings:
+Warning 1292 Incorrect inet6 value: 'garbage'
+SELECT * FROM t1 WHERE a='garbage';
+a
+Warnings:
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+SELECT * FROM t1 WHERE a>='garbage';
+a
+Warnings:
+Warning 1292 Incorrect inet6 value: 'garbage'
+SELECT * FROM t1 WHERE a>'garbage';
+a
+Warnings:
+Warning 1292 Incorrect inet6 value: 'garbage'
+SELECT * FROM t1 WHERE a<0x01;
+a
+Warnings:
+Warning 1292 Incorrect inet6 value: '\x01'
+SELECT * FROM t1 WHERE a<=0x01;
+a
+Warnings:
+Warning 1292 Incorrect inet6 value: '\x01'
+SELECT * FROM t1 WHERE a=0x01;
+a
+Warnings:
+Warning 1292 Incorrect inet6 value: '\x01'
+Warning 1292 Incorrect inet6 value: '\x01'
+SELECT * FROM t1 WHERE a>=0x01;
+a
+Warnings:
+Warning 1292 Incorrect inet6 value: '\x01'
+SELECT * FROM t1 WHERE a>0x01;
+a
+Warnings:
+Warning 1292 Incorrect inet6 value: '\x01'
+SELECT * FROM t1 WHERE a='0::0';
+a
+::
+SELECT * FROM t1 WHERE a='0::00';
+a
+::
+SELECT * FROM t1 WHERE a='0::000';
+a
+::
+SELECT * FROM t1 WHERE a='0::0000';
+a
+::
+SELECT * FROM t1 WHERE a=0;
+ERROR HY000: Illegal parameter data types inet6 and int for operation '='
+SELECT * FROM t1 WHERE a=0.0;
+ERROR HY000: Illegal parameter data types inet6 and decimal for operation '='
+SELECT * FROM t1 WHERE a=0e0;
+ERROR HY000: Illegal parameter data types inet6 and double for operation '='
+SELECT * FROM t1 WHERE a=TIME'10:20:30';
+ERROR HY000: Illegal parameter data types inet6 and time for operation '='
+SELECT * FROM t1 WHERE a IN ('::', 10);
+ERROR HY000: Illegal parameter data types inet6 and int for operation 'in'
+DROP TABLE t1;
+#
+# cmp_item_inet6: IN for non-constants
+#
+CREATE TABLE t1 (a INET6, b INET6);
+INSERT INTO t1 VALUES ('::1', '::2');
+SELECT * FROM t1 WHERE '::' IN (a, b);
+a b
+SELECT * FROM t1 WHERE '::1' IN (a, b);
+a b
+::1 ::2
+SELECT * FROM t1 WHERE '::01' IN (a, b);
+a b
+::1 ::2
+SELECT * FROM t1 WHERE '00::01' IN (a, b);
+a b
+::1 ::2
+DROP TABLE t1;
+#
+# cmp_item_inet6: DECODE_ORACLE
+#
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES (NULL),('::01'),('::02');
+SELECT a, DECODE_ORACLE(a, '::01', '01') AS d FROM t1;
+a d
+NULL NULL
+::1 01
+::2 NULL
+SELECT
+a,
+DECODE_ORACLE(a, '::01', '01') AS d0,
+DECODE_ORACLE(a, NULL, '<NULL>', '::01', '01') AS d1,
+DECODE_ORACLE(a, 'garbage', '<NULL>', '::01', '01') AS d2
+FROM t1;
+a d0 d1 d2
+NULL NULL <NULL> <NULL>
+::1 01 01 01
+::2 NULL NULL NULL
+Warnings:
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+DROP TABLE t1;
+#
+# CASE abbreviations
+#
+CREATE TABLE t1 (
+c INET6,
+c_char CHAR(32),
+c_varchar VARCHAR(32),
+c_tinytext TINYTEXT,
+c_text TEXT,
+c_mediumtext TEXT,
+c_longtext LONGTEXT
+);
+CREATE TABLE t2 AS SELECT
+COALESCE(c, c_char),
+COALESCE(c, c_varchar),
+COALESCE(c, c_tinytext),
+COALESCE(c, c_text),
+COALESCE(c, c_mediumtext),
+COALESCE(c, c_longtext)
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `COALESCE(c, c_char)` inet6 DEFAULT NULL,
+ `COALESCE(c, c_varchar)` inet6 DEFAULT NULL,
+ `COALESCE(c, c_tinytext)` inet6 DEFAULT NULL,
+ `COALESCE(c, c_text)` inet6 DEFAULT NULL,
+ `COALESCE(c, c_mediumtext)` inet6 DEFAULT NULL,
+ `COALESCE(c, c_longtext)` inet6 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT
+LEAST(c, c_char),
+LEAST(c, c_varchar),
+LEAST(c, c_tinytext),
+LEAST(c, c_text),
+LEAST(c, c_mediumtext),
+LEAST(c, c_longtext)
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `LEAST(c, c_char)` inet6 DEFAULT NULL,
+ `LEAST(c, c_varchar)` inet6 DEFAULT NULL,
+ `LEAST(c, c_tinytext)` inet6 DEFAULT NULL,
+ `LEAST(c, c_text)` inet6 DEFAULT NULL,
+ `LEAST(c, c_mediumtext)` inet6 DEFAULT NULL,
+ `LEAST(c, c_longtext)` inet6 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES (NULL),('::1'),('::2');
+SELECT COALESCE(a, '::') FROM t1 ORDER BY a;
+COALESCE(a, '::')
+::
+::1
+::2
+SELECT a, LEAST(a,'::0'), LEAST(a,'::f') FROM t1 ORDER BY a;
+a LEAST(a,'::0') LEAST(a,'::f')
+NULL NULL NULL
+::1 :: ::1
+::2 :: ::2
+SELECT a, GREATEST(a,'::0'), GREATEST(a,'::f') FROM t1 ORDER BY a;
+a GREATEST(a,'::0') GREATEST(a,'::f')
+NULL NULL NULL
+::1 ::1 ::f
+::2 ::2 ::f
+CREATE TABLE t2 AS SELECT
+COALESCE(a, '::'),
+LEAST(a,'::'),
+GREATEST(a,'::')
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `COALESCE(a, '::')` inet6 DEFAULT NULL,
+ `LEAST(a,'::')` inet6 DEFAULT NULL,
+ `GREATEST(a,'::')` inet6 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+SELECT COALESCE(a, 0x00000000000000000000000000000000) FROM t1 ORDER BY a;
+COALESCE(a, 0x00000000000000000000000000000000)
+::
+::1
+::2
+SELECT a,
+LEAST(a, 0x00000000000000000000000000000000),
+LEAST(a, 0x0000000000000000000000000000000f)
+FROM t1 ORDER BY a;
+a LEAST(a, 0x00000000000000000000000000000000) LEAST(a, 0x0000000000000000000000000000000f)
+NULL NULL NULL
+::1 :: ::1
+::2 :: ::2
+SELECT a,
+GREATEST(a, 0x00000000000000000000000000000000),
+GREATEST(a, 0x0000000000000000000000000000000f)
+FROM t1 ORDER BY a;
+a GREATEST(a, 0x00000000000000000000000000000000) GREATEST(a, 0x0000000000000000000000000000000f)
+NULL NULL NULL
+::1 ::1 ::f
+::2 ::2 ::f
+CREATE TABLE t2 AS SELECT
+COALESCE(a, 0x00000000000000000000000000000000),
+LEAST(a,0x00000000000000000000000000000000),
+GREATEST(a,0x00000000000000000000000000000000)
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `COALESCE(a, 0x00000000000000000000000000000000)` inet6 DEFAULT NULL,
+ `LEAST(a,0x00000000000000000000000000000000)` inet6 DEFAULT NULL,
+ `GREATEST(a,0x00000000000000000000000000000000)` inet6 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+SELECT COALESCE(a, 10) FROM t1;
+ERROR HY000: Illegal parameter data types inet6 and int for operation 'coalesce'
+SELECT LEAST(a, 10) FROM t1;
+ERROR HY000: Illegal parameter data types inet6 and int for operation 'least'
+SELECT GREATEST(a, 10) FROM t1;
+ERROR HY000: Illegal parameter data types inet6 and int for operation 'greatest'
+DROP TABLE t1;
+SELECT COALESCE('garbage', CAST('::1' AS INET6));
+COALESCE('garbage', CAST('::1' AS INET6))
+::1
+Warnings:
+Warning 1292 Incorrect inet6 value: 'garbage'
+SELECT COALESCE(0x01, CAST('::1' AS INET6));
+COALESCE(0x01, CAST('::1' AS INET6))
+::1
+Warnings:
+Warning 1292 Incorrect inet6 value: '\x01'
+#
+# Uniqueness
+#
+CREATE TABLE t1 (a INET6 NOT NULL PRIMARY KEY);
+INSERT INTO t1 VALUES ('41::1'),('61::1');
+INSERT INTO t1 VALUES ('41::1');
+ERROR 23000: Duplicate entry '41::1' for key 'PRIMARY'
+SELECT * FROM t1;
+a
+41::1
+61::1
+DROP TABLE t1;
+#
+# Indexes
+#
+CREATE TABLE t1 (a INET6, KEY(a(1)));
+ERROR HY000: Incorrect prefix key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique prefix keys
+#
+# Explicit CAST on INSERT
+#
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES (CAST('1::1' AS INET6));
+INSERT INTO t1 VALUES (CAST('1::2' AS INET6));
+INSERT INTO t1 VALUES (CAST('1::3' AS INET6));
+INSERT INTO t1 VALUES (CAST(CONCAT('2','::1') AS INET6));
+INSERT INTO t1 VALUES (CAST(CONCAT('2','::2') AS INET6));
+INSERT INTO t1 VALUES (CAST(CONCAT('2','::3') AS INET6));
+SELECT * FROM t1 ORDER BY a;
+a
+1::1
+1::2
+1::3
+2::1
+2::2
+2::3
+DROP TABLE t1;
+#
+# Explicit CAST and implicit CAST on ALTER
+#
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES ('garbage'),('::'),('::1'),('ffff::1'),('ffff::2');
+SELECT a, CAST(a AS INET6) FROM t1 ORDER BY a;
+a CAST(a AS INET6)
+:: ::
+::1 ::1
+ffff::1 ffff::1
+ffff::2 ffff::2
+garbage NULL
+Warnings:
+Warning 1292 Incorrect inet6 value: 'garbage'
+SELECT a, CAST(a AS INET6) FROM t1 ORDER BY CAST(a AS INET6);
+a CAST(a AS INET6)
+garbage NULL
+:: ::
+::1 ::1
+ffff::1 ffff::1
+ffff::2 ffff::2
+Warnings:
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+ALTER TABLE t1 MODIFY a INET6;
+ERROR 22007: Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
+SET sql_mode='';
+ALTER TABLE t1 MODIFY a INET6;
+Warnings:
+Warning 1292 Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
+SET sql_mode=DEFAULT;
+SELECT * FROM t1 ORDER BY a;
+a
+NULL
+::
+::1
+ffff::1
+ffff::2
+DROP TABLE t1;
+CREATE TABLE t1 (a BINARY(16));
+INSERT INTO t1 VALUES (0x00000000000000000000000000000000);
+INSERT INTO t1 VALUES (0x00000000000000000000000000000001);
+INSERT INTO t1 VALUES (0xffff0000000000000000000000000001);
+INSERT INTO t1 VALUES (0xffff0000000000000000000000000002);
+SELECT HEX(a), CAST(a AS INET6) FROM t1 ORDER BY a;
+HEX(a) CAST(a AS INET6)
+00000000000000000000000000000000 ::
+00000000000000000000000000000001 ::1
+FFFF0000000000000000000000000001 ffff::1
+FFFF0000000000000000000000000002 ffff::2
+ALTER TABLE t1 MODIFY a INET6;
+SELECT * FROM t1 ORDER BY a;
+a
+::
+::1
+ffff::1
+ffff::2
+DROP TABLE t1;
+#
+# INSERT..SELECT, same data types
+#
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('::'),('::1'),('::2');
+CREATE TABLE t2 (a INET6);
+INSERT INTO t2 SELECT a FROM t1;
+SELECT * FROM t2;
+a
+::
+::1
+::2
+DROP TABLE t1,t2;
+#
+# Implicit CAST on INSERT..SELECT, text format
+#
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES ('garbage'),('::'),('::1'),('ffff::1'),('ffff::2');
+CREATE TABLE t2 (a INET6);
+INSERT INTO t2 SELECT a FROM t1;
+ERROR 22007: Incorrect inet6 value: 'garbage' for column `test`.`t2`.`a` at row 1
+SET sql_mode='';
+INSERT INTO t2 SELECT a FROM t1;
+Warnings:
+Warning 1292 Incorrect inet6 value: 'garbage' for column `test`.`t2`.`a` at row 1
+SELECT * FROM t2 ORDER BY a;
+a
+NULL
+::
+::1
+ffff::1
+ffff::2
+SET sql_mode=DEFAULT;
+DROP TABLE t2;
+CREATE TABLE t2 (a INET6 NOT NULL);
+INSERT INTO t2 SELECT a FROM t1;
+ERROR 22007: Incorrect inet6 value: 'garbage' for column `test`.`t2`.`a` at row 1
+SET sql_mode='';
+INSERT INTO t2 SELECT a FROM t1;
+Warnings:
+Warning 1292 Incorrect inet6 value: 'garbage' for column `test`.`t2`.`a` at row 1
+SELECT * FROM t2 ORDER BY a;
+a
+::
+::
+::1
+ffff::1
+ffff::2
+SET sql_mode=DEFAULT;
+DROP TABLE t2;
+DROP TABLE t1;
+#
+# Implicit CAST on INSERT..SELECT, binary format
+#
+CREATE TABLE t1 (a BINARY(16));
+INSERT INTO t1 VALUES (0x00000000000000000000000000000000);
+INSERT INTO t1 VALUES (0x00000000000000000000000000000001);
+INSERT INTO t1 VALUES (0xffff0000000000000000000000000001);
+INSERT INTO t1 VALUES (0xffff0000000000000000000000000002);
+CREATE TABLE t2 (a INET6);
+INSERT INTO t2 SELECT a FROM t1;
+SELECT a FROM t2 ORDER BY a;
+a
+::
+::1
+ffff::1
+ffff::2
+DROP TABLE t1,t2;
+#
+# CAST to other data types
+#
+SELECT CAST(CAST('::' AS INET6) AS DOUBLE);
+ERROR HY000: Illegal parameter data type inet6 for operation 'double_typecast'
+SELECT CAST(CAST('::' AS INET6) AS FLOAT);
+ERROR HY000: Illegal parameter data type inet6 for operation 'float_typecast'
+SELECT CAST(CAST('::' AS INET6) AS DECIMAL);
+ERROR HY000: Illegal parameter data type inet6 for operation 'decimal_typecast'
+SELECT CAST(CAST('::' AS INET6) AS SIGNED);
+ERROR HY000: Illegal parameter data type inet6 for operation 'cast_as_signed'
+SELECT CAST(CAST('::' AS INET6) AS UNSIGNED);
+ERROR HY000: Illegal parameter data type inet6 for operation 'cast_as_unsigned'
+SELECT CAST(CAST('::' AS INET6) AS TIME);
+ERROR HY000: Illegal parameter data type inet6 for operation 'cast_as_time'
+SELECT CAST(CAST('::' AS INET6) AS DATE);
+ERROR HY000: Illegal parameter data type inet6 for operation 'cast_as_date'
+SELECT CAST(CAST('::' AS INET6) AS DATETIME);
+ERROR HY000: Illegal parameter data type inet6 for operation 'cast_as_datetime'
+SELECT CAST(CAST('::' AS INET6) AS CHAR);
+CAST(CAST('::' AS INET6) AS CHAR)
+::
+CREATE TABLE t1 AS SELECT CAST(CAST('::' AS INET6) AS CHAR) AS a;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(39) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('ffff::ffff');
+CREATE TABLE t2 AS SELECT
+CAST(a AS CHAR),
+CAST(a AS CHAR(39)),
+CAST(a AS CHAR(530)),
+CAST(a AS CHAR(65535)),
+CAST(a AS CHAR(66000)),
+CAST(a AS CHAR(16777215)),
+CAST(a AS CHAR(16777216))
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `CAST(a AS CHAR)` varchar(39) DEFAULT NULL,
+ `CAST(a AS CHAR(39))` varchar(39) DEFAULT NULL,
+ `CAST(a AS CHAR(530))` text DEFAULT NULL,
+ `CAST(a AS CHAR(65535))` text DEFAULT NULL,
+ `CAST(a AS CHAR(66000))` mediumtext DEFAULT NULL,
+ `CAST(a AS CHAR(16777215))` mediumtext DEFAULT NULL,
+ `CAST(a AS CHAR(16777216))` longtext DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT * FROM t2;
+CAST(a AS CHAR) ffff::ffff
+CAST(a AS CHAR(39)) ffff::ffff
+CAST(a AS CHAR(530)) ffff::ffff
+CAST(a AS CHAR(65535)) ffff::ffff
+CAST(a AS CHAR(66000)) ffff::ffff
+CAST(a AS CHAR(16777215)) ffff::ffff
+CAST(a AS CHAR(16777216)) ffff::ffff
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('ffff::ffff');
+CREATE TABLE t2 AS SELECT
+CAST(a AS BINARY(4)) AS cb4,
+CAST(a AS BINARY) AS cb,
+CAST(a AS BINARY(16)) AS cb16,
+CAST(a AS BINARY(32)) AS cb32,
+CAST(a AS BINARY(530)) AS cb530,
+CAST(a AS BINARY(65535)) AS cb65535,
+CAST(a AS BINARY(66000)) AS cb66000,
+CAST(a AS BINARY(16777215)) AS cb16777215,
+CAST(a AS BINARY(16777216)) AS cb16777216
+FROM t1 LIMIT 0;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `cb4` binary(4) DEFAULT NULL,
+ `cb` binary(16) DEFAULT NULL,
+ `cb16` binary(16) DEFAULT NULL,
+ `cb32` binary(32) DEFAULT NULL,
+ `cb530` varbinary(530) DEFAULT NULL,
+ `cb65535` blob DEFAULT NULL,
+ `cb66000` mediumblob DEFAULT NULL,
+ `cb16777215` mediumblob DEFAULT NULL,
+ `cb16777216` longblob DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT
+CAST(a AS BINARY(4)) AS cb4,
+CAST(a AS BINARY) AS cb,
+CAST(a AS BINARY(16)) AS cb16,
+CAST(a AS BINARY(32)) AS cb32,
+CAST(a AS BINARY(530)) AS cb530,
+CAST(a AS BINARY(65535)) AS cb65535
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `cb4` binary(4) DEFAULT NULL,
+ `cb` binary(16) DEFAULT NULL,
+ `cb16` binary(16) DEFAULT NULL,
+ `cb32` binary(32) DEFAULT NULL,
+ `cb530` varbinary(530) DEFAULT NULL,
+ `cb65535` blob DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT
+HEX(cb4),
+HEX(cb),
+HEX(cb16),
+HEX(cb32),
+LENGTH(cb530),
+LENGTH(cb65535)
+FROM t2;
+HEX(cb4) FFFF0000
+HEX(cb) FFFF000000000000000000000000FFFF
+HEX(cb16) FFFF000000000000000000000000FFFF
+HEX(cb32) FFFF000000000000000000000000FFFF00000000000000000000000000000000
+LENGTH(cb530) 530
+LENGTH(cb65535) 65535
+DROP TABLE t2;
+DROP TABLE t1;
+#
+# Implicit conversion to other types in INSERT
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (CAST('::' AS INET6));
+ERROR 22007: Incorrect integer value: '::' for column `test`.`t1`.`a` at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES (CAST('::' AS INET6));
+ERROR 22007: Incorrect double value: '::' for column `test`.`t1`.`a` at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL(32,0));
+INSERT INTO t1 VALUES (CAST('::' AS INET6));
+ERROR 22007: Incorrect decimal value: '::' for column `test`.`t1`.`a` at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES (CAST('::' AS INET6));
+DROP TABLE t1;
+CREATE TABLE t1 (a TEXT);
+INSERT INTO t1 VALUES (CAST('::' AS INET6));
+DROP TABLE t1;
+#
+# Boolean context
+#
+SELECT
+CAST('::' AS INET6) IS TRUE,
+CAST('::' AS INET6) IS FALSE,
+CAST('::1' AS INET6) IS TRUE,
+CAST('::1' AS INET6) IS FALSE;
+CAST('::' AS INET6) IS TRUE CAST('::' AS INET6) IS FALSE CAST('::1' AS INET6) IS TRUE CAST('::1' AS INET6) IS FALSE
+0 1 1 0
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('::'),('::1');
+SELECT a, a IS TRUE, a IS FALSE FROM t1 ORDER BY a;
+a a IS TRUE a IS FALSE
+:: 0 1
+::1 1 0
+DROP TABLE t1;
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('::'),('::1'),('::2');
+SELECT * FROM t1 WHERE a;
+ERROR HY000: Illegal parameter data types inet6 and bigint for operation '<>'
+DROP TABLE t1;
+#
+# GROUP BY
+#
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('::'),('::');
+INSERT INTO t1 VALUES ('::1'),('::01'),('::0001');
+INSERT INTO t1 VALUES ('::2'),('::2'),('::2'),('::2');
+SELECT a, COUNT(*) FROM t1 GROUP BY a;
+a COUNT(*)
+:: 2
+::1 3
+::2 4
+DROP TABLE t1;
+#
+# Aggregate functions
+#
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('::'),('::');
+INSERT INTO t1 VALUES ('::1'),('::01'),('::0001');
+INSERT INTO t1 VALUES ('::2'),('::2'),('::2'),('::2');
+SELECT MIN(a),MAX(a) FROM t1;
+MIN(a) MAX(a)
+:: ::2
+CREATE TABLE t2 AS SELECT MIN(a), MAX(a) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `MIN(a)` inet6 DEFAULT NULL,
+ `MAX(a)` inet6 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+SELECT AVG(a) FROM t1;
+ERROR HY000: Illegal parameter data type inet6 for operation 'avg('
+SELECT AVG(DISTINCT a) FROM t1;
+ERROR HY000: Illegal parameter data type inet6 for operation 'avg(distinct '
+SELECT SUM(a) FROM t1;
+ERROR HY000: Illegal parameter data type inet6 for operation 'sum('
+SELECT SUM(DISTINCT a) FROM t1;
+ERROR HY000: Illegal parameter data type inet6 for operation 'sum(distinct '
+SELECT STDDEV(a) FROM t1;
+ERROR HY000: Illegal parameter data type inet6 for operation 'std('
+SELECT GROUP_CONCAT(a ORDER BY a) FROM t1;
+GROUP_CONCAT(a ORDER BY a)
+::,::,::1,::1,::1,::2,::2,::2,::2
+SELECT a, GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a;
+a GROUP_CONCAT(a ORDER BY a)
+:: ::,::
+::1 ::1,::1,::1
+::2 ::2,::2,::2,::2
+DROP TABLE t1;
+#
+# Window functions
+#
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('::1'),('::2'),('::3'),('::4');
+SELECT
+a,
+LAG(a) OVER (ORDER BY a),
+LEAD(a) OVER (ORDER BY a)
+FROM t1 ORDER BY a;
+a LAG(a) OVER (ORDER BY a) LEAD(a) OVER (ORDER BY a)
+::1 NULL ::2
+::2 ::1 ::3
+::3 ::2 ::4
+::4 ::3 NULL
+SELECT
+a,
+FIRST_VALUE(a) OVER (ORDER BY a ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING),
+LAST_VALUE(a) OVER (ORDER BY a ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING)
+FROM t1 ORDER BY a;
+a FIRST_VALUE(a) OVER (ORDER BY a ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) LAST_VALUE(a) OVER (ORDER BY a ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING)
+::1 ::1 ::2
+::2 ::1 ::3
+::3 ::2 ::4
+::4 ::3 ::4
+DROP TABLE t1;
+#
+# Prepared statements
+#
+EXECUTE IMMEDIATE 'CREATE TABLE t1 AS SELECT ? AS a' USING CAST('::' AS INET6);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` inet6 NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?)' USING '::1';
+EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?)' USING CAST('::2' AS INET6);
+EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?)' USING 0x00000000000000000000000000000003;
+SELECT a FROM t1 ORDER BY a;
+a
+::
+::1
+::2
+::3
+EXECUTE IMMEDIATE 'SELECT * FROM t1 WHERE a=?' USING '::1';
+a
+::1
+EXECUTE IMMEDIATE 'SELECT * FROM t1 WHERE a=?' USING CAST('::2' AS INET6);
+a
+::2
+EXECUTE IMMEDIATE 'SELECT * FROM t1 WHERE a=?' USING 0x00000000000000000000000000000003;
+a
+::3
+DROP TABLE t1;
+#
+# Character set and collation aggregation
+#
+CREATE TABLE t1 (a INET6);
+CREATE TABLE t2 AS SELECT
+CONCAT(a) AS c1,
+CONCAT(CAST('::' AS INET6)) AS c2
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(39) DEFAULT NULL,
+ `c2` varchar(39) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT
+CONCAT(_utf8'1', a) AS c1,
+CONCAT(_utf8'1', CAST('::1' AS INET6)) AS c2,
+CONCAT(_utf8'1', COALESCE(a)) AS c3
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(40) CHARACTER SET utf8 DEFAULT NULL,
+ `c2` varchar(40) CHARACTER SET utf8 DEFAULT NULL,
+ `c3` varchar(40) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT
+CONCAT(_latin1'1', a) AS c1,
+CONCAT(_latin1'1', CAST('::1' AS INET6)) AS c2,
+CONCAT(_latin1'1', COALESCE(a)) AS c3
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(40) DEFAULT NULL,
+ `c2` varchar(40) DEFAULT NULL,
+ `c3` varchar(40) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+#
+# UNION
+#
+CREATE TABLE t1 AS SELECT CAST('::' AS INET6) AS c UNION SELECT CAST('::1' AS INET6);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` inet6 NOT NULL DEFAULT '::'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 AS SELECT CAST('::' AS INET6) AS c UNION SELECT '::1';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` inet6 NOT NULL DEFAULT '::'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 AS SELECT '::' AS c UNION SELECT CAST('::1' AS INET6);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` inet6 NOT NULL DEFAULT '::'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 AS SELECT CAST('::' AS INET6) AS c UNION SELECT 0x00000000000000000000000000000001;
+SELECT * FROM t1;
+c
+::
+::1
+DROP TABLE t1;
+CREATE TABLE t1 AS SELECT CAST('::' AS INET6) AS c UNION SELECT 1;
+ERROR HY000: Illegal parameter data types inet6 and int for operation 'UNION'
+#
+# Unary operators
+#
+SELECT -CAST('::' AS INET6);
+ERROR HY000: Illegal parameter data type inet6 for operation '-'
+SELECT ABS(CAST('::' AS INET6));
+ERROR HY000: Illegal parameter data type inet6 for operation 'abs'
+SELECT ROUND(CAST('::' AS INET6));
+ERROR HY000: Illegal parameter data type inet6 for operation 'round'
+SELECT CEILING(CAST('::' AS INET6));
+ERROR HY000: Illegal parameter data type inet6 for operation 'ceiling'
+SELECT FLOOR(CAST('::' AS INET6));
+ERROR HY000: Illegal parameter data type inet6 for operation 'floor'
+#
+# Arithmetic operators
+#
+SELECT CAST('::' AS INET6) + 1;
+ERROR HY000: Illegal parameter data types inet6 and int for operation '+'
+SELECT CAST('::' AS INET6) - 1;
+ERROR HY000: Illegal parameter data types inet6 and int for operation '-'
+SELECT CAST('::' AS INET6) * 1;
+ERROR HY000: Illegal parameter data types inet6 and int for operation '*'
+SELECT CAST('::' AS INET6) / 1;
+ERROR HY000: Illegal parameter data types inet6 and int for operation '/'
+SELECT CAST('::' AS INET6) MOD 1;
+ERROR HY000: Illegal parameter data types inet6 and int for operation 'MOD'
+#
+# Misc
+#
+SELECT RAND(CAST('::' AS INET6));
+ERROR HY000: Illegal parameter data type inet6 for operation 'rand'
+SELECT FROM_UNIXTIME(CAST('::' AS INET6));
+ERROR HY000: Illegal parameter data type inet6 for operation 'from_unixtime'
+SELECT HOUR(CAST('::' AS INET6));
+ERROR HY000: Illegal parameter data type inet6 for operation 'hour'
+SELECT YEAR(CAST('::' AS INET6));
+ERROR HY000: Illegal parameter data type inet6 for operation 'year'
+SELECT RELEASE_LOCK(CAST('::' AS INET6));
+ERROR HY000: Illegal parameter data type inet6 for operation 'release_lock'
+SELECT JSON_LENGTH(CAST('::' AS INET6));
+JSON_LENGTH(CAST('::' AS INET6))
+NULL
+Warnings:
+Warning 4038 Syntax error in JSON text in argument 1 to function 'json_length' at position 1
+#
+# Virtual columns
+#
+CREATE TABLE t1 (
+a INT,
+b INET6 GENERATED ALWAYS AS (CAST(CONCAT(RAND(),a) AS INET6)), INDEX(b)
+);
+ERROR HY000: Function or expression 'rand()' cannot be used in the GENERATED ALWAYS AS clause of `b`
+CREATE TABLE t1 (
+a INT,
+b INET6 GENERATED ALWAYS AS (CAST(CONCAT('::',HEX(a)) AS INET6)), INDEX(b)
+);
+INSERT INTO t1 (a) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15);
+SELECT * FROM t1;
+a b
+0 ::
+1 ::1
+2 ::2
+3 ::3
+4 ::4
+5 ::5
+6 ::6
+7 ::7
+8 ::8
+9 ::9
+10 ::a
+11 ::b
+12 ::c
+13 ::d
+14 ::e
+15 ::f
+DROP TABLE t1;
+#
+# VIEW
+#
+CREATE TABLE t1 (a INT DEFAULT 0);
+INSERT INTO t1 (a) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15);
+SELECT * FROM t1 ORDER BY a;
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+CREATE VIEW v1 AS SELECT (CAST(CONCAT('::',HEX(a)) AS INET6)) AS c FROM t1;
+SELECT * FROM v1 ORDER BY c;
+c
+::
+::1
+::2
+::3
+::4
+::5
+::6
+::7
+::8
+::9
+::a
+::b
+::c
+::d
+::e
+::f
+DROP VIEW v1;
+DROP TABLE t1;
+CREATE TABLE t1 (a INET6 DEFAULT '::');
+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`.`a` AS `a` from `t1` latin1 latin1_swedish_ci
+DESCRIBE v1;
+Field Type Null Key Default Extra
+a inet6 YES ::
+INSERT INTO v1 VALUES ('::'),('::1'),('::2');
+SELECT * FROM t1;
+a
+::
+::1
+::2
+DROP VIEW v1;
+DROP TABLE t1;
+CREATE TABLE t1 (a INET6 DEFAULT CAST('::' AS INET6));
+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`.`a` AS `a` from `t1` latin1 latin1_swedish_ci
+DESCRIBE v1;
+Field Type Null Key Default Extra
+a inet6 YES cast('::' as inet6)
+INSERT INTO v1 VALUES ('::'),('::1'),('::2');
+SELECT * FROM t1;
+a
+::
+::1
+::2
+DROP VIEW v1;
+DROP TABLE t1;
+#
+# Subqueries
+#
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('::'),('::1'),('::2');
+SELECT * FROM t1 WHERE a=(SELECT MIN(a) FROM t1) ORDER BY a;
+a
+::
+SELECT * FROM t1 WHERE a=(SELECT MAX(a) FROM t1) ORDER BY a;
+a
+::2
+SELECT * FROM t1 WHERE a IN (SELECT a FROM t1 WHERE a>'::') ORDER BY a;
+a
+::1
+::2
+DROP TABLE t1;
+#
+# Stored routines
+#
+CREATE PROCEDURE p1(a INET6)
+BEGIN
+DECLARE b INET6 DEFAULT CONCAT('1', a);
+SELECT a, b;
+END;
+$$
+CALL p1('::1');
+a b
+::1 1::1
+CALL p1(CAST('::2' AS INET6));
+a b
+::2 1::2
+DROP PROCEDURE p1;
+CREATE FUNCTION f1(a INET6) RETURNS INET6
+BEGIN
+RETURN CONCAT('1',a);
+END;
+$$
+SELECT f1('::1');
+f1('::1')
+1::1
+SELECT f1(CAST('::1' AS INET6));
+f1(CAST('::1' AS INET6))
+1::1
+DROP FUNCTION f1;
+#
+# Anchored data types in SP variables
+#
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('::1');
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE va TYPE OF t1.a;
+SELECT MAX(a) INTO va FROM t1;
+SELECT va;
+END;
+$$
+CALL p1;
+va
+::1
+DROP PROCEDURE p1;
+DROP TABLE t1;
+CREATE TABLE t1 (a INET6, b INET6);
+INSERT INTO t1 VALUES ('::a', '::b');
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE va ROW TYPE OF t1;
+SELECT MAX(a), MAX(b) INTO va FROM t1;
+SELECT va.a, va.b;
+END;
+$$
+CALL p1;
+va.a va.b
+::a ::b
+DROP PROCEDURE p1;
+DROP TABLE t1;
+#
+# Optimizer: make_const_item_for_comparison
+#
+CREATE TABLE t1 (id INT, a INET6);
+INSERT INTO t1 VALUES (1,'::1'),(2,'::2');
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=COALESCE(CAST('::1' AS INET6)) AND id>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`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = INET6'::1' and `test`.`t1`.`id` > 0
+DROP TABLE t1;
+#
+# Optimizer: equal field propagation
+#
+CREATE TABLE t1 (id INT, a INET6);
+INSERT INTO t1 VALUES (1,'::1'),(2,'::2');
+EXPLAIN EXTENDED SELECT * FROM t1
+WHERE a=COALESCE(CAST('::1' AS INET6))
+AND LENGTH(CONCAT(a,RAND()))>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`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = INET6'::1' and octet_length(concat(INET6'::1',rand())) > 1
+EXPLAIN EXTENDED SELECT * FROM t1
+WHERE a=COALESCE(CAST('::1' AS INET6))
+AND LENGTH(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`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = INET6'::1'
+DROP TABLE t1;
+#
+# Optimizer: equal expression propagation
+#
+CREATE TABLE t1 (id INT, a INET6);
+INSERT INTO t1 VALUES (1,'::1'),(2,'::2');
+EXPLAIN EXTENDED SELECT * FROM t1
+WHERE COALESCE(a)='::1' AND COALESCE(a)=CONCAT(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`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = '::1' and concat(`test`.`t1`.`a`) = '::1'
+DROP TABLE t1;
+#
+# Subquery materialization
+#
+CREATE TABLE t1 (a INET6, b VARCHAR(32), KEY (a), KEY(b)) ;
+INSERT INTO t1 VALUES ('::a','::a'),('::a','::b');
+SET @@optimizer_switch='semijoin=off,materialization=on,in_to_exists=off,subquery_cache=off';
+EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT a AS a_inner FROM t1 GROUP BY a_inner);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
+2 MATERIALIZED t1 index NULL a 17 NULL 2 Using index
+EXPLAIN SELECT * FROM t1 WHERE b IN (SELECT a AS a_inner FROM t1 GROUP BY a_inner);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
+2 DEPENDENT SUBQUERY t1 index_subquery a a 17 func 2 Using index; Using where
+SET @@optimizer_switch=DEFAULT;
+DROP TABLE t1;
+#
+# IS_IPV4_MAPPED(), IS_IPV4_COMPAT() now understand text notation
+#
+CREATE TABLE t1 (id SERIAL, a VARCHAR(32));
+INSERT INTO t1 (a) VALUES ('::192.168.0.1'),('::192.168.10.111'),('::ffff:10.10.0.1'),('::ffff:192.168.0.1');
+# This is a text notation
+SELECT id, length(a), a, IS_IPV4_MAPPED(a) FROM t1 ORDER BY id;
+id length(a) a IS_IPV4_MAPPED(a)
+1 13 ::192.168.0.1 0
+2 16 ::192.168.10.111 0
+3 16 ::ffff:10.10.0.1 1
+4 18 ::ffff:192.168.0.1 1
+SELECT id, length(a), a, IS_IPV4_COMPAT(a) FROM t1 ORDER BY id;
+id length(a) a IS_IPV4_COMPAT(a)
+1 13 ::192.168.0.1 1
+2 16 ::192.168.10.111 1
+3 16 ::ffff:10.10.0.1 0
+4 18 ::ffff:192.168.0.1 0
+# This is not a text notation: it is a binary input only looking like text notation
+SELECT id, length(a), a, IS_IPV4_MAPPED(BINARY a) FROM t1 ORDER BY id;
+id length(a) a IS_IPV4_MAPPED(BINARY a)
+1 13 ::192.168.0.1 0
+2 16 ::192.168.10.111 0
+3 16 ::ffff:10.10.0.1 0
+4 18 ::ffff:192.168.0.1 0
+Warnings:
+Warning 1292 Incorrect inet6 value: '::192.168.0.1'
+Warning 1292 Incorrect inet6 value: '::ffff:192.168.0.1'
+SELECT id, length(a), a, IS_IPV4_COMPAT(BINARY a) FROM t1 ORDER BY id;
+id length(a) a IS_IPV4_COMPAT(BINARY a)
+1 13 ::192.168.0.1 0
+2 16 ::192.168.10.111 0
+3 16 ::ffff:10.10.0.1 0
+4 18 ::ffff:192.168.0.1 0
+Warnings:
+Warning 1292 Incorrect inet6 value: '::192.168.0.1'
+Warning 1292 Incorrect inet6 value: '::ffff:192.168.0.1'
+DROP TABLE t1;
+#
+# ALTER from INET6 to INET6
+#
+CREATE TABLE t1 (a INET6, b INT);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329', 1);
+ALTER TABLE t1 MODIFY b DECIMAL(10,2);
+SELECT * FROM t1;
+a b
+2001:db8::ff00:42:8329 1.00
+DROP TABLE t1;
+#
+# ALTER to character string data types
+#
+CREATE OR REPLACE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+SELECT CAST(a AS CHAR(39)) FROM t1;
+CAST(a AS CHAR(39))
+2001:db8::ff00:42:8329
+ALTER TABLE t1 MODIFY a CHAR(39);
+SELECT * FROM t1;
+a
+2001:db8::ff00:42:8329
+DROP TABLE t1;
+CREATE OR REPLACE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+ALTER TABLE t1 MODIFY a VARCHAR(39);
+SELECT * FROM t1;
+a
+2001:db8::ff00:42:8329
+DROP TABLE t1;
+CREATE OR REPLACE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+ALTER TABLE t1 MODIFY a TINYTEXT;
+SELECT * FROM t1;
+a
+2001:db8::ff00:42:8329
+DROP TABLE t1;
+CREATE OR REPLACE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+ALTER TABLE t1 MODIFY a TEXT;
+SELECT * FROM t1;
+a
+2001:db8::ff00:42:8329
+DROP TABLE t1;
+CREATE OR REPLACE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+ALTER TABLE t1 MODIFY a MEDIUMTEXT;
+SELECT * FROM t1;
+a
+2001:db8::ff00:42:8329
+DROP TABLE t1;
+CREATE OR REPLACE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+ALTER TABLE t1 MODIFY a LONGTEXT;
+SELECT * FROM t1;
+a
+2001:db8::ff00:42:8329
+DROP TABLE t1;
+#
+# ALTER from character string data types
+#
+CREATE OR REPLACE TABLE t1 (a CHAR(64));
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+SELECT CAST(a AS INET6) FROM t1;
+CAST(a AS INET6)
+2001:db8::ff00:42:8329
+ALTER TABLE t1 MODIFY a INET6;
+SELECT * FROM t1;
+a
+2001:db8::ff00:42:8329
+DROP TABLE t1;
+CREATE OR REPLACE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+SELECT CAST(a AS INET6) FROM t1;
+CAST(a AS INET6)
+2001:db8::ff00:42:8329
+ALTER TABLE t1 MODIFY a INET6;
+SELECT * FROM t1;
+a
+2001:db8::ff00:42:8329
+DROP TABLE t1;
+CREATE OR REPLACE TABLE t1 (a TINYTEXT);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+SELECT CAST(a AS INET6) FROM t1;
+CAST(a AS INET6)
+2001:db8::ff00:42:8329
+ALTER TABLE t1 MODIFY a INET6;
+SELECT * FROM t1;
+a
+2001:db8::ff00:42:8329
+DROP TABLE t1;
+CREATE OR REPLACE TABLE t1 (a TEXT);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+SELECT CAST(a AS INET6) FROM t1;
+CAST(a AS INET6)
+2001:db8::ff00:42:8329
+ALTER TABLE t1 MODIFY a INET6;
+SELECT * FROM t1;
+a
+2001:db8::ff00:42:8329
+DROP TABLE t1;
+CREATE OR REPLACE TABLE t1 (a MEDIUMTEXT);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+SELECT CAST(a AS INET6) FROM t1;
+CAST(a AS INET6)
+2001:db8::ff00:42:8329
+ALTER TABLE t1 MODIFY a INET6;
+SELECT * FROM t1;
+a
+2001:db8::ff00:42:8329
+DROP TABLE t1;
+CREATE OR REPLACE TABLE t1 (a LONGTEXT);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+SELECT CAST(a AS INET6) FROM t1;
+CAST(a AS INET6)
+2001:db8::ff00:42:8329
+ALTER TABLE t1 MODIFY a INET6;
+SELECT * FROM t1;
+a
+2001:db8::ff00:42:8329
+DROP TABLE t1;
+#
+# ALTER to binary string data types
+#
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+ALTER TABLE t1 MODIFY a BINARY(16);
+SELECT HEX(a) FROM t1;
+HEX(a)
+20010DB8000000000000FF0000428329
+DROP TABLE t1;
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+ALTER TABLE t1 MODIFY a BINARY(17);
+SELECT HEX(a) FROM t1;
+HEX(a)
+20010DB8000000000000FF000042832900
+DROP TABLE t1;
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+ALTER TABLE t1 MODIFY a BINARY(15);
+ERROR 22001: Data too long for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+ALTER TABLE t1 MODIFY a TINYBLOB;
+SELECT HEX(a) FROM t1;
+HEX(a)
+20010DB8000000000000FF0000428329
+DROP TABLE t1;
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+ALTER TABLE t1 MODIFY a BLOB;
+SELECT HEX(a) FROM t1;
+HEX(a)
+20010DB8000000000000FF0000428329
+DROP TABLE t1;
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+ALTER TABLE t1 MODIFY a MEDIUMBLOB;
+SELECT HEX(a) FROM t1;
+HEX(a)
+20010DB8000000000000FF0000428329
+DROP TABLE t1;
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+ALTER TABLE t1 MODIFY a LONGBLOB;
+SELECT HEX(a) FROM t1;
+HEX(a)
+20010DB8000000000000FF0000428329
+DROP TABLE t1;
+#
+# ALTER from binary string data types
+#
+CREATE TABLE t1 (a BINARY(16));
+INSERT INTO t1 VALUES (X'20010DB8000000000000FF0000428329');
+ALTER TABLE t1 MODIFY a INET6;
+SELECT a FROM t1;
+a
+2001:db8::ff00:42:8329
+DROP TABLE t1;
+CREATE TABLE t1 (a BINARY(17));
+INSERT INTO t1 VALUES (X'20010DB8000000000000FF000042832900');
+ALTER TABLE t1 MODIFY a INET6;
+ERROR 22007: Incorrect inet6 value: ' \x01\x0D\xB8\x00\x00\x00\x00\x00\x00\xFF\x00\x00B\x83)\x00' for column `test`.`t1`.`a` at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a BINARY(15));
+INSERT INTO t1 VALUES (X'20010DB8000000000000FF00004283');
+ALTER TABLE t1 MODIFY a INET6;
+ERROR 22007: Incorrect inet6 value: ' \x01\x0D\xB8\x00\x00\x00\x00\x00\x00\xFF\x00\x00B\x83' for column `test`.`t1`.`a` at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYBLOB);
+INSERT INTO t1 VALUES (X'20010DB8000000000000FF0000428329');
+ALTER TABLE t1 MODIFY a INET6;
+SELECT a FROM t1;
+a
+2001:db8::ff00:42:8329
+DROP TABLE t1;
+CREATE TABLE t1 (a BLOB);
+INSERT INTO t1 VALUES (X'20010DB8000000000000FF0000428329');
+ALTER TABLE t1 MODIFY a INET6;
+SELECT a FROM t1;
+a
+2001:db8::ff00:42:8329
+DROP TABLE t1;
+CREATE TABLE t1 (a MEDIUMBLOB);
+INSERT INTO t1 VALUES (X'20010DB8000000000000FF0000428329');
+ALTER TABLE t1 MODIFY a INET6;
+SELECT a FROM t1;
+a
+2001:db8::ff00:42:8329
+DROP TABLE t1;
+CREATE TABLE t1 (a BLOB);
+INSERT INTO t1 VALUES (X'20010DB8000000000000FF0000428329');
+ALTER TABLE t1 MODIFY a INET6;
+SELECT a FROM t1;
+a
+2001:db8::ff00:42:8329
+DROP TABLE t1;
+#
+# SET from INET6 to INET6
+#
+CREATE TABLE t1 (a INET6, b INET6);
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+b
+ffff::ffff
+DROP TABLE t1;
+#
+# SET from INET6 to numeric
+#
+CREATE TABLE t1 (a INET6, b INT);
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+UPDATE t1 SET b=a;
+ERROR 22007: Incorrect integer value: 'ffff::ffff' for column `test`.`t1`.`b` at row 1
+SELECT b FROM t1;
+b
+NULL
+DROP TABLE t1;
+CREATE TABLE t1 (a INET6, b DOUBLE);
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+UPDATE t1 SET b=a;
+ERROR 22007: Incorrect double value: 'ffff::ffff' for column `test`.`t1`.`b` at row 1
+SELECT b FROM t1;
+b
+NULL
+DROP TABLE t1;
+CREATE TABLE t1 (a INET6, b DECIMAL(32,0));
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+UPDATE t1 SET b=a;
+ERROR 22007: Incorrect decimal value: 'ffff::ffff' for column `test`.`t1`.`b` at row 1
+SELECT b FROM t1;
+b
+NULL
+DROP TABLE t1;
+CREATE TABLE t1 (a INET6, b YEAR);
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+UPDATE t1 SET b=a;
+ERROR 22007: Incorrect integer value: 'ffff::ffff' for column `test`.`t1`.`b` at row 1
+SELECT b FROM t1;
+b
+NULL
+DROP TABLE t1;
+#
+# SET from numeric to INET6
+#
+CREATE TABLE t1 (a INT, b INET6);
+INSERT INTO t1 VALUES (1, NULL);
+UPDATE t1 SET b=a;
+ERROR 22007: Incorrect inet6 value: '1' for column `test`.`t1`.`b` at row 1
+SELECT b FROM t1;
+b
+NULL
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE, b INET6);
+INSERT INTO t1 VALUES (1, NULL);
+UPDATE t1 SET b=a;
+ERROR 22007: Incorrect inet6 value: '1' for column `test`.`t1`.`b` at row 1
+SELECT b FROM t1;
+b
+NULL
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL(32,0), b INET6);
+INSERT INTO t1 VALUES (1, NULL);
+UPDATE t1 SET b=a;
+ERROR 22007: Incorrect inet6 value: '1' for column `test`.`t1`.`b` at row 1
+SELECT b FROM t1;
+b
+NULL
+DROP TABLE t1;
+CREATE TABLE t1 (a YEAR, b INET6);
+INSERT INTO t1 VALUES (1, NULL);
+UPDATE t1 SET b=a;
+ERROR 22007: Incorrect inet6 value: '2001' for column `test`.`t1`.`b` at row 1
+SELECT b FROM t1;
+b
+NULL
+DROP TABLE t1;
+#
+# SET from INET6 to temporal
+#
+CREATE TABLE t1 (a INET6, b TIME);
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+UPDATE t1 SET b=a;
+ERROR 22007: Incorrect time value: 'ffff::ffff' for column `test`.`t1`.`b` at row 1
+SELECT b FROM t1;
+b
+NULL
+DROP TABLE t1;
+CREATE TABLE t1 (a INET6, b DATE);
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+UPDATE t1 SET b=a;
+ERROR 22007: Incorrect date value: 'ffff::ffff' for column `test`.`t1`.`b` at row 1
+SELECT b FROM t1;
+b
+NULL
+DROP TABLE t1;
+CREATE TABLE t1 (a INET6, b DATETIME);
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+UPDATE t1 SET b=a;
+ERROR 22007: Incorrect datetime value: 'ffff::ffff' for column `test`.`t1`.`b` at row 1
+SELECT b FROM t1;
+b
+NULL
+DROP TABLE t1;
+CREATE TABLE t1 (a INET6, b TIMESTAMP NULL DEFAULT NULL);
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+UPDATE t1 SET b=a;
+ERROR 22007: Incorrect datetime value: 'ffff::ffff' for column `test`.`t1`.`b` at row 1
+SELECT b FROM t1;
+b
+NULL
+DROP TABLE t1;
+#
+# SET from temporal to INET6
+#
+CREATE TABLE t1 (a TIME, b INET6);
+INSERT INTO t1 VALUES ('00:00:00', NULL);
+UPDATE t1 SET b=a;
+ERROR 22007: Incorrect inet6 value: '00:00:00' for column `test`.`t1`.`b` at row 1
+SELECT b FROM t1;
+b
+NULL
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE, b INET6);
+INSERT INTO t1 VALUES ('2001-01:01', NULL);
+UPDATE t1 SET b=a;
+ERROR 22007: Incorrect inet6 value: '2001-01-01' for column `test`.`t1`.`b` at row 1
+SELECT b FROM t1;
+b
+NULL
+DROP TABLE t1;
+CREATE TABLE t1 (a DATETIME, b INET6);
+INSERT INTO t1 VALUES ('2001-01-01 10:20:30', NULL);
+UPDATE t1 SET b=a;
+ERROR 22007: Incorrect inet6 value: '2001-01-01 10:20:30' for column `test`.`t1`.`b` at row 1
+SELECT b FROM t1;
+b
+NULL
+DROP TABLE t1;
+CREATE TABLE t1 (a TIMESTAMP, b INET6);
+INSERT INTO t1 VALUES ('2001-01-01 10:20:30', NULL);
+UPDATE t1 SET b=a;
+ERROR 22007: Incorrect inet6 value: '2001-01-01 10:20:30' for column `test`.`t1`.`b` at row 1
+SELECT b FROM t1;
+b
+NULL
+DROP TABLE t1;
+#
+# SET from INET6 to character string
+#
+CREATE TABLE t1 (a INET6, b CHAR(39));
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+b
+ffff::ffff
+DROP TABLE t1;
+CREATE TABLE t1 (a INET6, b VARCHAR(39));
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+b
+ffff::ffff
+DROP TABLE t1;
+CREATE TABLE t1 (a INET6, b TEXT);
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+b
+ffff::ffff
+DROP TABLE t1;
+CREATE TABLE t1 (a INET6, b ENUM('ffff::ffff'));
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+b
+ffff::ffff
+DROP TABLE t1;
+CREATE TABLE t1 (a INET6, b SET('ffff::ffff'));
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+b
+ffff::ffff
+DROP TABLE t1;
+#
+# SET from character string to INET6
+#
+CREATE TABLE t1 (a CHAR(39), b INET6);
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+b
+ffff::ffff
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(39), b INET6);
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+b
+ffff::ffff
+DROP TABLE t1;
+CREATE TABLE t1 (a TEXT, b INET6);
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+b
+ffff::ffff
+DROP TABLE t1;
+CREATE TABLE t1 (a ENUM('ffff::ffff'), b INET6);
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+b
+ffff::ffff
+DROP TABLE t1;
+CREATE TABLE t1 (a SET('ffff::ffff'), b INET6);
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+b
+ffff::ffff
+DROP TABLE t1;
+#
+# SET from INET6 to binary
+#
+CREATE TABLE t1 (a INET6, b BINARY(16));
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+UPDATE t1 SET b=a;
+SELECT HEX(b) FROM t1;
+HEX(b)
+FFFF000000000000000000000000FFFF
+DROP TABLE t1;
+CREATE TABLE t1 (a INET6, b VARBINARY(39));
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+UPDATE t1 SET b=a;
+SELECT HEX(b) FROM t1;
+HEX(b)
+FFFF000000000000000000000000FFFF
+DROP TABLE t1;
+CREATE TABLE t1 (a INET6, b BLOB);
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+UPDATE t1 SET b=a;
+SELECT HEX(b) FROM t1;
+HEX(b)
+FFFF000000000000000000000000FFFF
+DROP TABLE t1;
+#
+# SET from binary to INET6
+#
+CREATE TABLE t1 (a BINARY(16), b INET6);
+INSERT INTO t1 VALUES (CONCAT(0xFFFF,REPEAT(0x0000,6),0xFFFF), NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+b
+ffff::ffff
+DROP TABLE t1;
+CREATE TABLE t1 (a VARBINARY(16), b INET6);
+INSERT INTO t1 VALUES (CONCAT(0xFFFF,REPEAT(0x0000,6),0xFFFF), NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+b
+ffff::ffff
+DROP TABLE t1;
+CREATE TABLE t1 (a BLOB, b INET6);
+INSERT INTO t1 VALUES (CONCAT(0xFFFF,REPEAT(0x0000,6),0xFFFF), NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+b
+ffff::ffff
+DROP TABLE t1;
+#
+# Limit clause parameter
+# TODO: this should fail.
+# The test for a valid data type should be moved
+# from parse time to fix_fields() time, and performed
+# for both Item_splocal and Item_param.
+#
+EXECUTE IMMEDIATE 'SELECT 1 FROM DUAL LIMIT ?' USING CAST('::' AS INET6);
+1
+#
+# MDEV-20785 Converting INET6 to CHAR(39) produces garbage without a warning
+#
+CREATE OR REPLACE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+SELECT CAST(a AS CHAR(39)) FROM t1;
+CAST(a AS CHAR(39))
+2001:db8::ff00:42:8329
+ALTER TABLE t1 MODIFY a CHAR(39);
+SELECT * FROM t1;
+a
+2001:db8::ff00:42:8329
+DROP TABLE t1;
+#
+# MDEV-20783 INET6 cannot be converted to BINARY(16) (requires clarification in documentation)
+#
+CREATE OR REPLACE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+ALTER TABLE t1 MODIFY a BINARY(16);
+SELECT HEX(a) FROM t1;
+HEX(a)
+20010DB8000000000000FF0000428329
+DROP TABLE t1;
+#
+# MDEV-20795 CAST(inet6 AS BINARY) returns wrong result
+#
+CREATE OR REPLACE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+SELECT HEX(CAST(a AS BINARY)) FROM t1;
+HEX(CAST(a AS BINARY))
+20010DB8000000000000FF0000428329
+SELECT HEX(CAST(a AS BINARY(16))) FROM t1;
+HEX(CAST(a AS BINARY(16)))
+20010DB8000000000000FF0000428329
+DROP TABLE t1;
+#
+# MDEV-20808 CAST from INET6 to FLOAT does not produce an error
+#
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('::');
+SELECT CAST(a AS FLOAT) FROM t1;
+ERROR HY000: Illegal parameter data type inet6 for operation 'float_typecast'
+DROP TABLE t1;
+#
+# MDEV-20798 Conversion from INET6 to other types performed without errors or warnings
+#
+CREATE TABLE t1 (a INET6, b INT);
+INSERT INTO t1 (a) VALUES ('::');
+UPDATE t1 SET b=a;
+ERROR 22007: Incorrect integer value: '::' for column `test`.`t1`.`b` at row 1
+SELECT * FROM t1;
+a b
+:: NULL
+DROP TABLE t1;
+SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30');
+CREATE TABLE t1 (a INET6, b TIMESTAMP);
+INSERT INTO t1 (a) VALUES ('::');
+UPDATE t1 SET b=a;
+ERROR 22007: Incorrect datetime value: '::' for column `test`.`t1`.`b` at row 1
+SELECT * FROM t1;
+a b
+:: 2001-01-01 10:20:30
+DROP TABLE t1;
+SET timestamp=DEFAULT;
+CREATE OR REPLACE TABLE t1 (a INET6);
+INSERT INTO t1 (a) VALUES ('::');
+ALTER TABLE t1 MODIFY a DATE;
+ERROR 22007: Incorrect date value: '::' for column `test`.`t1`.`a` at row 1
+DROP TABLE t1;
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6.test b/plugin/type_inet/mysql-test/type_inet/type_inet6.test
new file mode 100644
index 00000000000..a17f5dd69f7
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6.test
@@ -0,0 +1,1413 @@
+
+--echo #
+--echo # Basic CREATE functionality, defaults, metadata
+--echo #
+
+--error ER_WRONG_FIELD_SPEC
+CREATE TABLE t1 (a INET6 AUTO_INCREMENT);
+
+CREATE TABLE t1 (a INET6);
+SHOW CREATE TABLE t1;
+DESCRIBE t1;
+--vertical_results
+--replace_column 19 #
+SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='test' AND table_name='t1';
+--horizontal_results
+DROP TABLE t1;
+
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('::1');
+--enable_metadata
+SELECT * FROM t1;
+SELECT CAST('::' AS INET6) AS a;
+--disable_metadata
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (
+ c1 INET6 DEFAULT 0x00000000000000000000000000000000,
+ c2 INET6 DEFAULT 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF,
+ c3 INET6 DEFAULT '::',
+ c4 INET6 DEFAULT 'FFFF::ffff',
+ c5 INET6 DEFAULT CAST(X'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF' AS INET6)
+);
+SHOW CREATE TABLE t1;
+DESCRIBE t1;
+--vertical_results
+--replace_column 19 #
+SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='test' AND table_name='t1';
+--horizontal_results
+DROP TABLE t1;
+
+--error ER_INVALID_DEFAULT
+CREATE TABLE t1 (c1 INET6 DEFAULT 0x00);
+--error ER_INVALID_DEFAULT
+CREATE TABLE t1 (c1 INET6 DEFAULT '');
+
+
+CREATE TABLE t1 (a INET6);
+--error ER_TRUNCATED_WRONG_VALUE
+INSERT INTO t1 VALUES ('x');
+--error ER_TRUNCATED_WRONG_VALUE
+INSERT INTO t1 VALUES (1);
+--error ER_TRUNCATED_WRONG_VALUE
+INSERT INTO t1 VALUES (TIME'10:20:30');
+--error ER_TRUNCATED_WRONG_VALUE
+INSERT INTO t1 VALUES (0x00);
+DROP TABLE t1;
+
+--echo #
+--echo # CAST
+--echo #
+
+SELECT CAST('garbage' AS INET6);
+SELECT CAST(0x01 AS INET6);
+SELECT CAST(REPEAT(0x00,16) AS INET6);
+SELECT CAST(REPEAT(0x11,16) AS INET6);
+
+CREATE TABLE t1 AS SELECT CAST('::' AS INET6);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # Text and binary formats, comparison operators
+--echo #
+
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES (0x00000000000000000000000000000000);
+INSERT INTO t1 VALUES (0x00000000000000000000000000000001);
+INSERT INTO t1 VALUES (0xFFFF0000000000000000000000000001);
+INSERT INTO t1 VALUES (0xFFFF0000000000000000000000000002);
+SELECT * FROM t1 ORDER BY a;
+SELECT * FROM t1 ORDER BY a DESC;
+SELECT HEX(a),a FROM t1 ORDER BY a;
+SELECT * FROM t1 WHERE a='::';
+SELECT * FROM t1 WHERE a='::1';
+SELECT * FROM t1 WHERE a='ffff::1';
+SELECT * FROM t1 WHERE a='ffff::2';
+SELECT * FROM t1 WHERE a=0x00000000000000000000000000000000;
+SELECT * FROM t1 WHERE a=0x00000000000000000000000000000001;
+SELECT * FROM t1 WHERE a=0xffff0000000000000000000000000001;
+SELECT * FROM t1 WHERE a=0xffff0000000000000000000000000002;
+SELECT * FROM t1 WHERE a<'::';
+SELECT * FROM t1 WHERE a<='::';
+SELECT * FROM t1 WHERE a>='ffff::2';
+SELECT * FROM t1 WHERE a>'ffff::2';
+SELECT * FROM t1 WHERE a IN ('::', 'ffff::1') ORDER BY a;
+SELECT * FROM t1 WHERE a IN ('::', 0xffff0000000000000000000000000002) ORDER BY a;
+
+SELECT * FROM t1 WHERE a<'garbage';
+SELECT * FROM t1 WHERE a<='garbage';
+SELECT * FROM t1 WHERE a='garbage';
+SELECT * FROM t1 WHERE a>='garbage';
+SELECT * FROM t1 WHERE a>'garbage';
+
+SELECT * FROM t1 WHERE a<0x01;
+SELECT * FROM t1 WHERE a<=0x01;
+SELECT * FROM t1 WHERE a=0x01;
+SELECT * FROM t1 WHERE a>=0x01;
+SELECT * FROM t1 WHERE a>0x01;
+
+SELECT * FROM t1 WHERE a='0::0';
+SELECT * FROM t1 WHERE a='0::00';
+SELECT * FROM t1 WHERE a='0::000';
+SELECT * FROM t1 WHERE a='0::0000';
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT * FROM t1 WHERE a=0;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT * FROM t1 WHERE a=0.0;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT * FROM t1 WHERE a=0e0;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT * FROM t1 WHERE a=TIME'10:20:30';
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT * FROM t1 WHERE a IN ('::', 10);
+
+DROP TABLE t1;
+
+--echo #
+--echo # cmp_item_inet6: IN for non-constants
+--echo #
+
+CREATE TABLE t1 (a INET6, b INET6);
+INSERT INTO t1 VALUES ('::1', '::2');
+SELECT * FROM t1 WHERE '::' IN (a, b);
+SELECT * FROM t1 WHERE '::1' IN (a, b);
+SELECT * FROM t1 WHERE '::01' IN (a, b);
+SELECT * FROM t1 WHERE '00::01' IN (a, b);
+DROP TABLE t1;
+
+
+--echo #
+--echo # cmp_item_inet6: DECODE_ORACLE
+--echo #
+
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES (NULL),('::01'),('::02');
+SELECT a, DECODE_ORACLE(a, '::01', '01') AS d FROM t1;
+SELECT
+ a,
+ DECODE_ORACLE(a, '::01', '01') AS d0,
+ DECODE_ORACLE(a, NULL, '<NULL>', '::01', '01') AS d1,
+ DECODE_ORACLE(a, 'garbage', '<NULL>', '::01', '01') AS d2
+FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # CASE abbreviations
+--echo #
+
+CREATE TABLE t1 (
+ c INET6,
+ c_char CHAR(32),
+ c_varchar VARCHAR(32),
+ c_tinytext TINYTEXT,
+ c_text TEXT,
+ c_mediumtext TEXT,
+ c_longtext LONGTEXT
+);
+CREATE TABLE t2 AS SELECT
+ COALESCE(c, c_char),
+ COALESCE(c, c_varchar),
+ COALESCE(c, c_tinytext),
+ COALESCE(c, c_text),
+ COALESCE(c, c_mediumtext),
+ COALESCE(c, c_longtext)
+FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT
+ LEAST(c, c_char),
+ LEAST(c, c_varchar),
+ LEAST(c, c_tinytext),
+ LEAST(c, c_text),
+ LEAST(c, c_mediumtext),
+ LEAST(c, c_longtext)
+FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES (NULL),('::1'),('::2');
+SELECT COALESCE(a, '::') FROM t1 ORDER BY a;
+SELECT a, LEAST(a,'::0'), LEAST(a,'::f') FROM t1 ORDER BY a;
+SELECT a, GREATEST(a,'::0'), GREATEST(a,'::f') FROM t1 ORDER BY a;
+
+CREATE TABLE t2 AS SELECT
+ COALESCE(a, '::'),
+ LEAST(a,'::'),
+ GREATEST(a,'::')
+FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+
+SELECT COALESCE(a, 0x00000000000000000000000000000000) FROM t1 ORDER BY a;
+SELECT a,
+ LEAST(a, 0x00000000000000000000000000000000),
+ LEAST(a, 0x0000000000000000000000000000000f)
+FROM t1 ORDER BY a;
+SELECT a,
+ GREATEST(a, 0x00000000000000000000000000000000),
+ GREATEST(a, 0x0000000000000000000000000000000f)
+FROM t1 ORDER BY a;
+
+CREATE TABLE t2 AS SELECT
+ COALESCE(a, 0x00000000000000000000000000000000),
+ LEAST(a,0x00000000000000000000000000000000),
+ GREATEST(a,0x00000000000000000000000000000000)
+FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT COALESCE(a, 10) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT LEAST(a, 10) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT GREATEST(a, 10) FROM t1;
+DROP TABLE t1;
+
+SELECT COALESCE('garbage', CAST('::1' AS INET6));
+SELECT COALESCE(0x01, CAST('::1' AS INET6));
+
+
+--echo #
+--echo # Uniqueness
+--echo #
+
+CREATE TABLE t1 (a INET6 NOT NULL PRIMARY KEY);
+INSERT INTO t1 VALUES ('41::1'),('61::1');
+--error ER_DUP_ENTRY
+INSERT INTO t1 VALUES ('41::1');
+SELECT * FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # Indexes
+--echo #
+
+--error ER_WRONG_SUB_KEY
+CREATE TABLE t1 (a INET6, KEY(a(1)));
+
+
+--echo #
+--echo # Explicit CAST on INSERT
+--echo #
+
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES (CAST('1::1' AS INET6));
+INSERT INTO t1 VALUES (CAST('1::2' AS INET6));
+INSERT INTO t1 VALUES (CAST('1::3' AS INET6));
+INSERT INTO t1 VALUES (CAST(CONCAT('2','::1') AS INET6));
+INSERT INTO t1 VALUES (CAST(CONCAT('2','::2') AS INET6));
+INSERT INTO t1 VALUES (CAST(CONCAT('2','::3') AS INET6));
+SELECT * FROM t1 ORDER BY a;
+DROP TABLE t1;
+
+
+--echo #
+--echo # Explicit CAST and implicit CAST on ALTER
+--echo #
+
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES ('garbage'),('::'),('::1'),('ffff::1'),('ffff::2');
+SELECT a, CAST(a AS INET6) FROM t1 ORDER BY a;
+SELECT a, CAST(a AS INET6) FROM t1 ORDER BY CAST(a AS INET6);
+--error ER_TRUNCATED_WRONG_VALUE
+ALTER TABLE t1 MODIFY a INET6;
+SET sql_mode='';
+ALTER TABLE t1 MODIFY a INET6;
+SET sql_mode=DEFAULT;
+SELECT * FROM t1 ORDER BY a;
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (a BINARY(16));
+INSERT INTO t1 VALUES (0x00000000000000000000000000000000);
+INSERT INTO t1 VALUES (0x00000000000000000000000000000001);
+INSERT INTO t1 VALUES (0xffff0000000000000000000000000001);
+INSERT INTO t1 VALUES (0xffff0000000000000000000000000002);
+SELECT HEX(a), CAST(a AS INET6) FROM t1 ORDER BY a;
+ALTER TABLE t1 MODIFY a INET6;
+SELECT * FROM t1 ORDER BY a;
+DROP TABLE t1;
+
+
+--echo #
+--echo # INSERT..SELECT, same data types
+--echo #
+
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('::'),('::1'),('::2');
+CREATE TABLE t2 (a INET6);
+INSERT INTO t2 SELECT a FROM t1;
+SELECT * FROM t2;
+DROP TABLE t1,t2;
+
+
+--echo #
+--echo # Implicit CAST on INSERT..SELECT, text format
+--echo #
+
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES ('garbage'),('::'),('::1'),('ffff::1'),('ffff::2');
+
+CREATE TABLE t2 (a INET6);
+--error ER_TRUNCATED_WRONG_VALUE
+INSERT INTO t2 SELECT a FROM t1;
+SET sql_mode='';
+INSERT INTO t2 SELECT a FROM t1;
+SELECT * FROM t2 ORDER BY a;
+SET sql_mode=DEFAULT;
+DROP TABLE t2;
+
+CREATE TABLE t2 (a INET6 NOT NULL);
+--error ER_TRUNCATED_WRONG_VALUE
+INSERT INTO t2 SELECT a FROM t1;
+SET sql_mode='';
+INSERT INTO t2 SELECT a FROM t1;
+SELECT * FROM t2 ORDER BY a;
+SET sql_mode=DEFAULT;
+DROP TABLE t2;
+
+DROP TABLE t1;
+
+
+--echo #
+--echo # Implicit CAST on INSERT..SELECT, binary format
+--echo #
+
+CREATE TABLE t1 (a BINARY(16));
+INSERT INTO t1 VALUES (0x00000000000000000000000000000000);
+INSERT INTO t1 VALUES (0x00000000000000000000000000000001);
+INSERT INTO t1 VALUES (0xffff0000000000000000000000000001);
+INSERT INTO t1 VALUES (0xffff0000000000000000000000000002);
+CREATE TABLE t2 (a INET6);
+INSERT INTO t2 SELECT a FROM t1;
+SELECT a FROM t2 ORDER BY a;
+DROP TABLE t1,t2;
+
+
+--echo #
+--echo # CAST to other data types
+--echo #
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT CAST(CAST('::' AS INET6) AS DOUBLE);
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT CAST(CAST('::' AS INET6) AS FLOAT);
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT CAST(CAST('::' AS INET6) AS DECIMAL);
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT CAST(CAST('::' AS INET6) AS SIGNED);
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT CAST(CAST('::' AS INET6) AS UNSIGNED);
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT CAST(CAST('::' AS INET6) AS TIME);
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT CAST(CAST('::' AS INET6) AS DATE);
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT CAST(CAST('::' AS INET6) AS DATETIME);
+
+SELECT CAST(CAST('::' AS INET6) AS CHAR);
+CREATE TABLE t1 AS SELECT CAST(CAST('::' AS INET6) AS CHAR) AS a;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('ffff::ffff');
+CREATE TABLE t2 AS SELECT
+ CAST(a AS CHAR),
+ CAST(a AS CHAR(39)),
+ CAST(a AS CHAR(530)),
+ CAST(a AS CHAR(65535)),
+ CAST(a AS CHAR(66000)),
+ CAST(a AS CHAR(16777215)),
+ CAST(a AS CHAR(16777216))
+FROM t1;
+SHOW CREATE TABLE t2;
+--vertical_results
+SELECT * FROM t2;
+--horizontal_results
+DROP TABLE t2;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('ffff::ffff');
+CREATE TABLE t2 AS SELECT
+ CAST(a AS BINARY(4)) AS cb4,
+ CAST(a AS BINARY) AS cb,
+ CAST(a AS BINARY(16)) AS cb16,
+ CAST(a AS BINARY(32)) AS cb32,
+ CAST(a AS BINARY(530)) AS cb530,
+ CAST(a AS BINARY(65535)) AS cb65535,
+ CAST(a AS BINARY(66000)) AS cb66000,
+ CAST(a AS BINARY(16777215)) AS cb16777215,
+ CAST(a AS BINARY(16777216)) AS cb16777216
+FROM t1 LIMIT 0;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+
+CREATE TABLE t2 AS SELECT
+ CAST(a AS BINARY(4)) AS cb4,
+ CAST(a AS BINARY) AS cb,
+ CAST(a AS BINARY(16)) AS cb16,
+ CAST(a AS BINARY(32)) AS cb32,
+ CAST(a AS BINARY(530)) AS cb530,
+ CAST(a AS BINARY(65535)) AS cb65535
+FROM t1;
+SHOW CREATE TABLE t2;
+--vertical_results
+SELECT
+ HEX(cb4),
+ HEX(cb),
+ HEX(cb16),
+ HEX(cb32),
+ LENGTH(cb530),
+ LENGTH(cb65535)
+FROM t2;
+--horizontal_results
+DROP TABLE t2;
+DROP TABLE t1;
+
+--echo #
+--echo # Implicit conversion to other types in INSERT
+--echo #
+
+CREATE TABLE t1 (a INT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES (CAST('::' AS INET6));
+DROP TABLE t1;
+
+CREATE TABLE t1 (a DOUBLE);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES (CAST('::' AS INET6));
+DROP TABLE t1;
+
+CREATE TABLE t1 (a DECIMAL(32,0));
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES (CAST('::' AS INET6));
+DROP TABLE t1;
+
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES (CAST('::' AS INET6));
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TEXT);
+INSERT INTO t1 VALUES (CAST('::' AS INET6));
+DROP TABLE t1;
+
+
+
+--echo #
+--echo # Boolean context
+--echo #
+
+SELECT
+ CAST('::' AS INET6) IS TRUE,
+ CAST('::' AS INET6) IS FALSE,
+ CAST('::1' AS INET6) IS TRUE,
+ CAST('::1' AS INET6) IS FALSE;
+
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('::'),('::1');
+SELECT a, a IS TRUE, a IS FALSE FROM t1 ORDER BY a;
+DROP TABLE t1;
+
+#
+# TODO: Error looks like a bug. This should return rows where a<>'::'.
+# The same problem is repeatable with GEOMETRY.
+#
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('::'),('::1'),('::2');
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT * FROM t1 WHERE a;
+DROP TABLE t1;
+
+
+--echo #
+--echo # GROUP BY
+--echo #
+
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('::'),('::');
+INSERT INTO t1 VALUES ('::1'),('::01'),('::0001');
+INSERT INTO t1 VALUES ('::2'),('::2'),('::2'),('::2');
+SELECT a, COUNT(*) FROM t1 GROUP BY a;
+DROP TABLE t1;
+
+--echo #
+--echo # Aggregate functions
+--echo #
+
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('::'),('::');
+INSERT INTO t1 VALUES ('::1'),('::01'),('::0001');
+INSERT INTO t1 VALUES ('::2'),('::2'),('::2'),('::2');
+SELECT MIN(a),MAX(a) FROM t1;
+
+CREATE TABLE t2 AS SELECT MIN(a), MAX(a) FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT AVG(a) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT AVG(DISTINCT a) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT SUM(a) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT SUM(DISTINCT a) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT STDDEV(a) FROM t1;
+SELECT GROUP_CONCAT(a ORDER BY a) FROM t1;
+SELECT a, GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a;
+DROP TABLE t1;
+
+--echo #
+--echo # Window functions
+--echo #
+
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('::1'),('::2'),('::3'),('::4');
+SELECT
+ a,
+ LAG(a) OVER (ORDER BY a),
+ LEAD(a) OVER (ORDER BY a)
+FROM t1 ORDER BY a;
+
+SELECT
+ a,
+ FIRST_VALUE(a) OVER (ORDER BY a ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING),
+ LAST_VALUE(a) OVER (ORDER BY a ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING)
+FROM t1 ORDER BY a;
+DROP TABLE t1;
+
+
+--echo #
+--echo # Prepared statements
+--echo #
+
+EXECUTE IMMEDIATE 'CREATE TABLE t1 AS SELECT ? AS a' USING CAST('::' AS INET6);
+SHOW CREATE TABLE t1;
+EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?)' USING '::1';
+EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?)' USING CAST('::2' AS INET6);
+EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?)' USING 0x00000000000000000000000000000003;
+SELECT a FROM t1 ORDER BY a;
+EXECUTE IMMEDIATE 'SELECT * FROM t1 WHERE a=?' USING '::1';
+EXECUTE IMMEDIATE 'SELECT * FROM t1 WHERE a=?' USING CAST('::2' AS INET6);
+EXECUTE IMMEDIATE 'SELECT * FROM t1 WHERE a=?' USING 0x00000000000000000000000000000003;
+DROP TABLE t1;
+
+
+--echo #
+--echo # Character set and collation aggregation
+--echo #
+
+CREATE TABLE t1 (a INET6);
+
+CREATE TABLE t2 AS SELECT
+ CONCAT(a) AS c1,
+ CONCAT(CAST('::' AS INET6)) AS c2
+FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+
+CREATE TABLE t2 AS SELECT
+ CONCAT(_utf8'1', a) AS c1,
+ CONCAT(_utf8'1', CAST('::1' AS INET6)) AS c2,
+ CONCAT(_utf8'1', COALESCE(a)) AS c3
+FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+
+CREATE TABLE t2 AS SELECT
+ CONCAT(_latin1'1', a) AS c1,
+ CONCAT(_latin1'1', CAST('::1' AS INET6)) AS c2,
+ CONCAT(_latin1'1', COALESCE(a)) AS c3
+FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+
+DROP TABLE t1;
+
+
+--echo #
+--echo # UNION
+--echo #
+
+CREATE TABLE t1 AS SELECT CAST('::' AS INET6) AS c UNION SELECT CAST('::1' AS INET6);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 AS SELECT CAST('::' AS INET6) AS c UNION SELECT '::1';
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 AS SELECT '::' AS c UNION SELECT CAST('::1' AS INET6);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 AS SELECT CAST('::' AS INET6) AS c UNION SELECT 0x00000000000000000000000000000001;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+CREATE TABLE t1 AS SELECT CAST('::' AS INET6) AS c UNION SELECT 1;
+
+
+--echo #
+--echo # Unary operators
+--echo #
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT -CAST('::' AS INET6);
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT ABS(CAST('::' AS INET6));
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT ROUND(CAST('::' AS INET6));
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT CEILING(CAST('::' AS INET6));
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT FLOOR(CAST('::' AS INET6));
+
+
+--echo #
+--echo # Arithmetic operators
+--echo #
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT CAST('::' AS INET6) + 1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT CAST('::' AS INET6) - 1;
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT CAST('::' AS INET6) * 1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT CAST('::' AS INET6) / 1;
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT CAST('::' AS INET6) MOD 1;
+
+
+--echo #
+--echo # Misc
+--echo #
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT RAND(CAST('::' AS INET6));
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT FROM_UNIXTIME(CAST('::' AS INET6));
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT HOUR(CAST('::' AS INET6));
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT YEAR(CAST('::' AS INET6));
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT RELEASE_LOCK(CAST('::' AS INET6));
+
+
+SELECT JSON_LENGTH(CAST('::' AS INET6));
+
+--echo #
+--echo # Virtual columns
+--echo #
+
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+CREATE TABLE t1 (
+ a INT,
+ b INET6 GENERATED ALWAYS AS (CAST(CONCAT(RAND(),a) AS INET6)), INDEX(b)
+);
+
+CREATE TABLE t1 (
+ a INT,
+ b INET6 GENERATED ALWAYS AS (CAST(CONCAT('::',HEX(a)) AS INET6)), INDEX(b)
+);
+INSERT INTO t1 (a) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15);
+SELECT * FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # VIEW
+--echo #
+
+CREATE TABLE t1 (a INT DEFAULT 0);
+INSERT INTO t1 (a) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15);
+SELECT * FROM t1 ORDER BY a;
+CREATE VIEW v1 AS SELECT (CAST(CONCAT('::',HEX(a)) AS INET6)) AS c FROM t1;
+SELECT * FROM v1 ORDER BY c;
+DROP VIEW v1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a INET6 DEFAULT '::');
+CREATE VIEW v1 AS SELECT * FROM t1;
+SHOW CREATE VIEW v1;
+DESCRIBE v1;
+INSERT INTO v1 VALUES ('::'),('::1'),('::2');
+SELECT * FROM t1;
+DROP VIEW v1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a INET6 DEFAULT CAST('::' AS INET6));
+CREATE VIEW v1 AS SELECT * FROM t1;
+SHOW CREATE VIEW v1;
+DESCRIBE v1;
+INSERT INTO v1 VALUES ('::'),('::1'),('::2');
+SELECT * FROM t1;
+DROP VIEW v1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # Subqueries
+--echo #
+
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('::'),('::1'),('::2');
+SELECT * FROM t1 WHERE a=(SELECT MIN(a) FROM t1) ORDER BY a;
+SELECT * FROM t1 WHERE a=(SELECT MAX(a) FROM t1) ORDER BY a;
+SELECT * FROM t1 WHERE a IN (SELECT a FROM t1 WHERE a>'::') ORDER BY a;
+DROP TABLE t1;
+
+--echo #
+--echo # Stored routines
+--echo #
+
+DELIMITER $$;
+CREATE PROCEDURE p1(a INET6)
+BEGIN
+ DECLARE b INET6 DEFAULT CONCAT('1', a);
+ SELECT a, b;
+END;
+$$
+DELIMITER ;$$
+CALL p1('::1');
+CALL p1(CAST('::2' AS INET6));
+DROP PROCEDURE p1;
+
+DELIMITER $$;
+CREATE FUNCTION f1(a INET6) RETURNS INET6
+BEGIN
+ RETURN CONCAT('1',a);
+END;
+$$
+DELIMITER ;$$
+SELECT f1('::1');
+SELECT f1(CAST('::1' AS INET6));
+DROP FUNCTION f1;
+
+--echo #
+--echo # Anchored data types in SP variables
+--echo #
+
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('::1');
+DELIMITER $$;
+CREATE PROCEDURE p1()
+BEGIN
+ DECLARE va TYPE OF t1.a;
+ SELECT MAX(a) INTO va FROM t1;
+ SELECT va;
+END;
+$$
+DELIMITER ;$$
+CALL p1;
+DROP PROCEDURE p1;
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (a INET6, b INET6);
+INSERT INTO t1 VALUES ('::a', '::b');
+DELIMITER $$;
+CREATE PROCEDURE p1()
+BEGIN
+ DECLARE va ROW TYPE OF t1;
+ SELECT MAX(a), MAX(b) INTO va FROM t1;
+ SELECT va.a, va.b;
+END;
+$$
+DELIMITER ;$$
+CALL p1;
+DROP PROCEDURE p1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # Optimizer: make_const_item_for_comparison
+--echo #
+
+CREATE TABLE t1 (id INT, a INET6);
+INSERT INTO t1 VALUES (1,'::1'),(2,'::2');
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=COALESCE(CAST('::1' AS INET6)) AND id>0;
+DROP TABLE t1;
+
+--echo #
+--echo # Optimizer: equal field propagation
+--echo #
+
+CREATE TABLE t1 (id INT, a INET6);
+INSERT INTO t1 VALUES (1,'::1'),(2,'::2');
+EXPLAIN EXTENDED SELECT * FROM t1
+WHERE a=COALESCE(CAST('::1' AS INET6))
+ AND LENGTH(CONCAT(a,RAND()))>1;
+EXPLAIN EXTENDED SELECT * FROM t1
+WHERE a=COALESCE(CAST('::1' AS INET6))
+ AND LENGTH(a)>1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # Optimizer: equal expression propagation
+--echo #
+
+
+CREATE TABLE t1 (id INT, a INET6);
+INSERT INTO t1 VALUES (1,'::1'),(2,'::2');
+EXPLAIN EXTENDED SELECT * FROM t1
+WHERE COALESCE(a)='::1' AND COALESCE(a)=CONCAT(a);
+DROP TABLE t1;
+
+--echo #
+--echo # Subquery materialization
+--echo #
+
+CREATE TABLE t1 (a INET6, b VARCHAR(32), KEY (a), KEY(b)) ;
+INSERT INTO t1 VALUES ('::a','::a'),('::a','::b');
+SET @@optimizer_switch='semijoin=off,materialization=on,in_to_exists=off,subquery_cache=off';
+EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT a AS a_inner FROM t1 GROUP BY a_inner);
+EXPLAIN SELECT * FROM t1 WHERE b IN (SELECT a AS a_inner FROM t1 GROUP BY a_inner);
+SET @@optimizer_switch=DEFAULT;
+DROP TABLE t1;
+
+--echo #
+--echo # IS_IPV4_MAPPED(), IS_IPV4_COMPAT() now understand text notation
+--echo #
+CREATE TABLE t1 (id SERIAL, a VARCHAR(32));
+INSERT INTO t1 (a) VALUES ('::192.168.0.1'),('::192.168.10.111'),('::ffff:10.10.0.1'),('::ffff:192.168.0.1');
+--echo # This is a text notation
+SELECT id, length(a), a, IS_IPV4_MAPPED(a) FROM t1 ORDER BY id;
+SELECT id, length(a), a, IS_IPV4_COMPAT(a) FROM t1 ORDER BY id;
+--echo # This is not a text notation: it is a binary input only looking like text notation
+SELECT id, length(a), a, IS_IPV4_MAPPED(BINARY a) FROM t1 ORDER BY id;
+SELECT id, length(a), a, IS_IPV4_COMPAT(BINARY a) FROM t1 ORDER BY id;
+DROP TABLE t1;
+
+
+--echo #
+--echo # ALTER from INET6 to INET6
+--echo #
+
+CREATE TABLE t1 (a INET6, b INT);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329', 1);
+ALTER TABLE t1 MODIFY b DECIMAL(10,2);
+SELECT * FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # ALTER to character string data types
+--echo #
+
+CREATE OR REPLACE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+SELECT CAST(a AS CHAR(39)) FROM t1;
+ALTER TABLE t1 MODIFY a CHAR(39);
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE OR REPLACE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+ALTER TABLE t1 MODIFY a VARCHAR(39);
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE OR REPLACE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+ALTER TABLE t1 MODIFY a TINYTEXT;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE OR REPLACE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+ALTER TABLE t1 MODIFY a TEXT;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE OR REPLACE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+ALTER TABLE t1 MODIFY a MEDIUMTEXT;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE OR REPLACE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+ALTER TABLE t1 MODIFY a LONGTEXT;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # ALTER from character string data types
+--echo #
+
+CREATE OR REPLACE TABLE t1 (a CHAR(64));
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+SELECT CAST(a AS INET6) FROM t1;
+ALTER TABLE t1 MODIFY a INET6;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE OR REPLACE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+SELECT CAST(a AS INET6) FROM t1;
+ALTER TABLE t1 MODIFY a INET6;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE OR REPLACE TABLE t1 (a TINYTEXT);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+SELECT CAST(a AS INET6) FROM t1;
+ALTER TABLE t1 MODIFY a INET6;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE OR REPLACE TABLE t1 (a TEXT);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+SELECT CAST(a AS INET6) FROM t1;
+ALTER TABLE t1 MODIFY a INET6;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE OR REPLACE TABLE t1 (a MEDIUMTEXT);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+SELECT CAST(a AS INET6) FROM t1;
+ALTER TABLE t1 MODIFY a INET6;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE OR REPLACE TABLE t1 (a LONGTEXT);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+SELECT CAST(a AS INET6) FROM t1;
+ALTER TABLE t1 MODIFY a INET6;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # ALTER to binary string data types
+--echo #
+
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+ALTER TABLE t1 MODIFY a BINARY(16);
+SELECT HEX(a) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+ALTER TABLE t1 MODIFY a BINARY(17);
+SELECT HEX(a) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+--error ER_DATA_TOO_LONG
+ALTER TABLE t1 MODIFY a BINARY(15);
+DROP TABLE t1;
+
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+ALTER TABLE t1 MODIFY a TINYBLOB;
+SELECT HEX(a) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+ALTER TABLE t1 MODIFY a BLOB;
+SELECT HEX(a) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+ALTER TABLE t1 MODIFY a MEDIUMBLOB;
+SELECT HEX(a) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+ALTER TABLE t1 MODIFY a LONGBLOB;
+SELECT HEX(a) FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # ALTER from binary string data types
+--echo #
+
+CREATE TABLE t1 (a BINARY(16));
+INSERT INTO t1 VALUES (X'20010DB8000000000000FF0000428329');
+ALTER TABLE t1 MODIFY a INET6;
+SELECT a FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a BINARY(17));
+INSERT INTO t1 VALUES (X'20010DB8000000000000FF000042832900');
+--error ER_TRUNCATED_WRONG_VALUE
+ALTER TABLE t1 MODIFY a INET6;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a BINARY(15));
+INSERT INTO t1 VALUES (X'20010DB8000000000000FF00004283');
+--error ER_TRUNCATED_WRONG_VALUE
+ALTER TABLE t1 MODIFY a INET6;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TINYBLOB);
+INSERT INTO t1 VALUES (X'20010DB8000000000000FF0000428329');
+ALTER TABLE t1 MODIFY a INET6;
+SELECT a FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a BLOB);
+INSERT INTO t1 VALUES (X'20010DB8000000000000FF0000428329');
+ALTER TABLE t1 MODIFY a INET6;
+SELECT a FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a MEDIUMBLOB);
+INSERT INTO t1 VALUES (X'20010DB8000000000000FF0000428329');
+ALTER TABLE t1 MODIFY a INET6;
+SELECT a FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a BLOB);
+INSERT INTO t1 VALUES (X'20010DB8000000000000FF0000428329');
+ALTER TABLE t1 MODIFY a INET6;
+SELECT a FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # SET from INET6 to INET6
+--echo #
+
+CREATE TABLE t1 (a INET6, b INET6);
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # SET from INET6 to numeric
+--echo #
+
+CREATE TABLE t1 (a INET6, b INT);
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a INET6, b DOUBLE);
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a INET6, b DECIMAL(32,0));
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a INET6, b YEAR);
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # SET from numeric to INET6
+--echo #
+
+CREATE TABLE t1 (a INT, b INET6);
+INSERT INTO t1 VALUES (1, NULL);
+--error ER_TRUNCATED_WRONG_VALUE
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a DOUBLE, b INET6);
+INSERT INTO t1 VALUES (1, NULL);
+--error ER_TRUNCATED_WRONG_VALUE
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a DECIMAL(32,0), b INET6);
+INSERT INTO t1 VALUES (1, NULL);
+--error ER_TRUNCATED_WRONG_VALUE
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a YEAR, b INET6);
+INSERT INTO t1 VALUES (1, NULL);
+--error ER_TRUNCATED_WRONG_VALUE
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # SET from INET6 to temporal
+--echo #
+
+CREATE TABLE t1 (a INET6, b TIME);
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+--error ER_TRUNCATED_WRONG_VALUE
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a INET6, b DATE);
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+--error ER_TRUNCATED_WRONG_VALUE
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a INET6, b DATETIME);
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+--error ER_TRUNCATED_WRONG_VALUE
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a INET6, b TIMESTAMP NULL DEFAULT NULL);
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+--error ER_TRUNCATED_WRONG_VALUE
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # SET from temporal to INET6
+--echo #
+
+CREATE TABLE t1 (a TIME, b INET6);
+INSERT INTO t1 VALUES ('00:00:00', NULL);
+--error ER_TRUNCATED_WRONG_VALUE
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a DATE, b INET6);
+INSERT INTO t1 VALUES ('2001-01:01', NULL);
+--error ER_TRUNCATED_WRONG_VALUE
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a DATETIME, b INET6);
+INSERT INTO t1 VALUES ('2001-01-01 10:20:30', NULL);
+--error ER_TRUNCATED_WRONG_VALUE
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TIMESTAMP, b INET6);
+INSERT INTO t1 VALUES ('2001-01-01 10:20:30', NULL);
+--error ER_TRUNCATED_WRONG_VALUE
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # SET from INET6 to character string
+--echo #
+
+CREATE TABLE t1 (a INET6, b CHAR(39));
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a INET6, b VARCHAR(39));
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a INET6, b TEXT);
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a INET6, b ENUM('ffff::ffff'));
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a INET6, b SET('ffff::ffff'));
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # SET from character string to INET6
+--echo #
+
+CREATE TABLE t1 (a CHAR(39), b INET6);
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a VARCHAR(39), b INET6);
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TEXT, b INET6);
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a ENUM('ffff::ffff'), b INET6);
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a SET('ffff::ffff'), b INET6);
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # SET from INET6 to binary
+--echo #
+
+CREATE TABLE t1 (a INET6, b BINARY(16));
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+UPDATE t1 SET b=a;
+SELECT HEX(b) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a INET6, b VARBINARY(39));
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+UPDATE t1 SET b=a;
+SELECT HEX(b) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a INET6, b BLOB);
+INSERT INTO t1 VALUES ('ffff::ffff', NULL);
+UPDATE t1 SET b=a;
+SELECT HEX(b) FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # SET from binary to INET6
+--echo #
+
+CREATE TABLE t1 (a BINARY(16), b INET6);
+INSERT INTO t1 VALUES (CONCAT(0xFFFF,REPEAT(0x0000,6),0xFFFF), NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a VARBINARY(16), b INET6);
+INSERT INTO t1 VALUES (CONCAT(0xFFFF,REPEAT(0x0000,6),0xFFFF), NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a BLOB, b INET6);
+INSERT INTO t1 VALUES (CONCAT(0xFFFF,REPEAT(0x0000,6),0xFFFF), NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # Limit clause parameter
+--echo # TODO: this should fail.
+--echo # The test for a valid data type should be moved
+--echo # from parse time to fix_fields() time, and performed
+--echo # for both Item_splocal and Item_param.
+--echo #
+
+EXECUTE IMMEDIATE 'SELECT 1 FROM DUAL LIMIT ?' USING CAST('::' AS INET6);
+
+
+## TODO:
+## - Add hooks to run mysql_client_test with pluggable data types
+##
+## - This should fail with the "illegal data type" error:
+##SELECT CAST('::' AS INET6) DIV 1;
+##
+## - This should fail with the "illegal data type" error:
+## EXTRACT(MINUTE...)
+##
+
+
+--echo #
+--echo # MDEV-20785 Converting INET6 to CHAR(39) produces garbage without a warning
+--echo #
+
+CREATE OR REPLACE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+SELECT CAST(a AS CHAR(39)) FROM t1;
+ALTER TABLE t1 MODIFY a CHAR(39);
+SELECT * FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-20783 INET6 cannot be converted to BINARY(16) (requires clarification in documentation)
+--echo #
+
+CREATE OR REPLACE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+ALTER TABLE t1 MODIFY a BINARY(16);
+SELECT HEX(a) FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-20795 CAST(inet6 AS BINARY) returns wrong result
+--echo #
+
+CREATE OR REPLACE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+SELECT HEX(CAST(a AS BINARY)) FROM t1;
+SELECT HEX(CAST(a AS BINARY(16))) FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-20808 CAST from INET6 to FLOAT does not produce an error
+--echo #
+
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('::');
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT CAST(a AS FLOAT) FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-20798 Conversion from INET6 to other types performed without errors or warnings
+--echo #
+
+CREATE TABLE t1 (a INET6, b INT);
+INSERT INTO t1 (a) VALUES ('::');
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+UPDATE t1 SET b=a;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30');
+CREATE TABLE t1 (a INET6, b TIMESTAMP);
+INSERT INTO t1 (a) VALUES ('::');
+--error ER_TRUNCATED_WRONG_VALUE
+UPDATE t1 SET b=a;
+SELECT * FROM t1;
+DROP TABLE t1;
+SET timestamp=DEFAULT;
+
+CREATE OR REPLACE TABLE t1 (a INET6);
+INSERT INTO t1 (a) VALUES ('::');
+--error ER_TRUNCATED_WRONG_VALUE
+ALTER TABLE t1 MODIFY a DATE;
+DROP TABLE t1;
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_csv.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_csv.result
new file mode 100644
index 00000000000..8e972235b06
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_csv.result
@@ -0,0 +1,70 @@
+#
+# Start of 10.5 tests
+#
+#
+# MDEV-274 The data type for IPv6/IPv4 addresses in MariaDB
+#
+SET default_storage_engine=CSV;
+CREATE TABLE t1 (a INET6 NOT NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` inet6 NOT NULL
+) ENGINE=CSV DEFAULT CHARSET=latin1
+FOR i IN 0..255
+DO
+INSERT INTO t1 VALUES (CONCAT('::', HEX(i)));
+END FOR
+$$
+SELECT * FROM t1 WHERE a='::ff';
+a
+::ff
+SELECT * FROM t1 WHERE a>='::fe' ORDER BY a;
+a
+::fe
+::ff
+SELECT * FROM t1 WHERE a IN ('::80','::a0','::f0') ORDER BY a;
+a
+::80
+::a0
+::f0
+SELECT * FROM t1 WHERE a BETWEEN '::80' AND '::81' ORDER BY a;
+a
+::80
+::81
+SELECT * FROM t1 WHERE a=CAST('::ff' AS INET6);
+a
+::ff
+UPDATE t1 SET a=CONCAT('ffff', a) WHERE a LIKE '::a%';
+SELECT * FROM t1 WHERE a LIKE 'ffff::%' ORDER BY a;
+a
+ffff::a
+ffff::a0
+ffff::a1
+ffff::a2
+ffff::a3
+ffff::a4
+ffff::a5
+ffff::a6
+ffff::a7
+ffff::a8
+ffff::a9
+ffff::aa
+ffff::ab
+ffff::ac
+ffff::ad
+ffff::ae
+ffff::af
+DROP TABLE t1;
+#
+# MDEV-20790 CSV table with INET6 can be created and inserted into, but cannot be read from
+#
+CREATE TABLE t1 (a INET6 NOT NULL) ENGINE=CSV;
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+SELECT * FROM t1;
+a
+2001:db8::ff00:42:8329
+DROP TABLE t1;
+#
+# End of 10.5 tests
+#
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_csv.test b/plugin/type_inet/mysql-test/type_inet/type_inet6_csv.test
new file mode 100644
index 00000000000..65761cf0af7
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_csv.test
@@ -0,0 +1,51 @@
+--source include/have_csv.inc
+
+--echo #
+--echo # Start of 10.5 tests
+--echo #
+
+--echo #
+--echo # MDEV-274 The data type for IPv6/IPv4 addresses in MariaDB
+--echo #
+
+SET default_storage_engine=CSV;
+
+CREATE TABLE t1 (a INET6 NOT NULL);
+SHOW CREATE TABLE t1;
+
+DELIMITER $$;
+FOR i IN 0..255
+DO
+ INSERT INTO t1 VALUES (CONCAT('::', HEX(i)));
+END FOR
+$$
+DELIMITER ;$$
+
+SELECT * FROM t1 WHERE a='::ff';
+
+SELECT * FROM t1 WHERE a>='::fe' ORDER BY a;
+
+SELECT * FROM t1 WHERE a IN ('::80','::a0','::f0') ORDER BY a;
+
+SELECT * FROM t1 WHERE a BETWEEN '::80' AND '::81' ORDER BY a;
+
+SELECT * FROM t1 WHERE a=CAST('::ff' AS INET6);
+
+UPDATE t1 SET a=CONCAT('ffff', a) WHERE a LIKE '::a%';
+SELECT * FROM t1 WHERE a LIKE 'ffff::%' ORDER BY a;
+
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-20790 CSV table with INET6 can be created and inserted into, but cannot be read from
+--echo #
+
+CREATE TABLE t1 (a INET6 NOT NULL) ENGINE=CSV;
+INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
+SELECT * FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # End of 10.5 tests
+--echo #
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_engines.inc b/plugin/type_inet/mysql-test/type_inet/type_inet6_engines.inc
new file mode 100644
index 00000000000..596036fc0ee
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_engines.inc
@@ -0,0 +1,38 @@
+--echo #
+--echo # Range optimizer
+--echo #
+
+CREATE TABLE t1 (a INET6, INDEX(a));
+SHOW CREATE TABLE t1;
+
+DELIMITER $$;
+FOR i IN 0..255
+DO
+ INSERT INTO t1 VALUES (CONCAT('::', HEX(i)));
+END FOR
+$$
+DELIMITER ;$$
+SELECT * FROM t1 WHERE a='::ff';
+EXPLAIN SELECT * FROM t1 WHERE a='::ff';
+SELECT * FROM t1 WHERE a='garbage';
+EXPLAIN SELECT * FROM t1 WHERE a='garbage';
+
+SELECT * FROM t1 WHERE a>='::fe';
+EXPLAIN SELECT * FROM t1 WHERE a>='::fe';
+SELECT * FROM t1 WHERE a>='garbage';
+EXPLAIN SELECT * FROM t1 WHERE a>='garbage';
+
+SELECT * FROM t1 WHERE a IN ('::80','::a0','::f0');
+EXPLAIN SELECT * FROM t1 WHERE a IN ('::80','::a0','::f0');
+SELECT * FROM t1 WHERE a IN ('::80','::a0','garbage');
+EXPLAIN SELECT * FROM t1 WHERE a IN ('::80','::a0','garbage');
+
+SELECT * FROM t1 WHERE a BETWEEN '::80' AND '::81';
+EXPLAIN SELECT * FROM t1 WHERE a BETWEEN '::80' AND '::81';
+SELECT * FROM t1 WHERE a BETWEEN '::80' AND 'garbage';
+EXPLAIN SELECT * FROM t1 WHERE a BETWEEN '::80' AND 'garbage';
+
+SELECT * FROM t1 WHERE a=CAST('::ff' AS INET6);
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=CAST('::ff' AS INET6);
+
+DROP TABLE t1;
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_innodb.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_innodb.result
new file mode 100644
index 00000000000..ad2d22c2153
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_innodb.result
@@ -0,0 +1,104 @@
+#
+# Start of 10.5 tests
+#
+#
+# MDEV-274 The data type for IPv6/IPv4 addresses in MariaDB
+#
+SET default_storage_engine=InnoDB;
+#
+# Range optimizer
+#
+CREATE TABLE t1 (a INET6, INDEX(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` inet6 DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+FOR i IN 0..255
+DO
+INSERT INTO t1 VALUES (CONCAT('::', HEX(i)));
+END FOR
+$$
+SELECT * FROM t1 WHERE a='::ff';
+a
+::ff
+EXPLAIN SELECT * FROM t1 WHERE a='::ff';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 17 const 1 Using where; Using index
+SELECT * FROM t1 WHERE a='garbage';
+a
+Warnings:
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
+EXPLAIN SELECT * FROM t1 WHERE a='garbage';
+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 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
+SELECT * FROM t1 WHERE a>='::fe';
+a
+::fe
+::ff
+EXPLAIN SELECT * FROM t1 WHERE a>='::fe';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 17 NULL 2 Using where; Using index
+SELECT * FROM t1 WHERE a>='garbage';
+a
+Warnings:
+Warning 1292 Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
+EXPLAIN SELECT * FROM t1 WHERE a>='garbage';
+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 1292 Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
+SELECT * FROM t1 WHERE a IN ('::80','::a0','::f0');
+a
+::80
+::a0
+::f0
+EXPLAIN SELECT * FROM t1 WHERE a IN ('::80','::a0','::f0');
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 17 NULL 3 Using where; Using index
+SELECT * FROM t1 WHERE a IN ('::80','::a0','garbage');
+a
+::80
+::a0
+Warnings:
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
+EXPLAIN SELECT * FROM t1 WHERE a IN ('::80','::a0','garbage');
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 17 NULL 2 Using where; Using index
+Warnings:
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
+SELECT * FROM t1 WHERE a BETWEEN '::80' AND '::81';
+a
+::80
+::81
+EXPLAIN SELECT * FROM t1 WHERE a BETWEEN '::80' AND '::81';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 17 NULL 2 Using where; Using index
+SELECT * FROM t1 WHERE a BETWEEN '::80' AND 'garbage';
+a
+Warnings:
+Warning 1292 Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
+EXPLAIN SELECT * FROM t1 WHERE a BETWEEN '::80' AND 'garbage';
+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 1292 Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
+SELECT * FROM t1 WHERE a=CAST('::ff' AS INET6);
+a
+::ff
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=CAST('::ff' AS INET6);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ref a a 17 const 1 100.00 Using where; Using index
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = INET6'::ff'
+DROP TABLE t1;
+#
+# End of 10.5 tests
+#
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_innodb.test b/plugin/type_inet/mysql-test/type_inet/type_inet6_innodb.test
new file mode 100644
index 00000000000..dd6049abbf3
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_innodb.test
@@ -0,0 +1,18 @@
+--source include/have_innodb.inc
+
+--echo #
+--echo # Start of 10.5 tests
+--echo #
+
+--echo #
+--echo # MDEV-274 The data type for IPv6/IPv4 addresses in MariaDB
+--echo #
+
+
+SET default_storage_engine=InnoDB;
+--source type_inet6_engines.inc
+
+
+--echo #
+--echo # End of 10.5 tests
+--echo #
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_memory.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_memory.result
new file mode 100644
index 00000000000..56c4ae8231d
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_memory.result
@@ -0,0 +1,163 @@
+#
+# Start of 10.5 tests
+#
+#
+# MDEV-274 The data type for IPv6/IPv4 addresses in MariaDB
+#
+SET default_storage_engine=MEMORY;
+#
+# Range optimizer
+#
+CREATE TABLE t1 (a INET6, INDEX(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` inet6 DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=latin1
+FOR i IN 0..255
+DO
+INSERT INTO t1 VALUES (CONCAT('::', HEX(i)));
+END FOR
+$$
+SELECT * FROM t1 WHERE a='::ff';
+a
+::ff
+EXPLAIN SELECT * FROM t1 WHERE a='::ff';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 17 const 2 Using where
+SELECT * FROM t1 WHERE a='garbage';
+a
+Warnings:
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
+EXPLAIN SELECT * FROM t1 WHERE a='garbage';
+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 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
+SELECT * FROM t1 WHERE a>='::fe';
+a
+::fe
+::ff
+EXPLAIN SELECT * FROM t1 WHERE a>='::fe';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL a NULL NULL NULL 256 Using where
+SELECT * FROM t1 WHERE a>='garbage';
+a
+Warnings:
+Warning 1292 Incorrect inet6 value: 'garbage'
+EXPLAIN SELECT * FROM t1 WHERE a>='garbage';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL a NULL NULL NULL 256 Using where
+SELECT * FROM t1 WHERE a IN ('::80','::a0','::f0');
+a
+::80
+::a0
+::f0
+EXPLAIN SELECT * FROM t1 WHERE a IN ('::80','::a0','::f0');
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 17 NULL 6 Using where
+SELECT * FROM t1 WHERE a IN ('::80','::a0','garbage');
+a
+::80
+::a0
+Warnings:
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
+EXPLAIN SELECT * FROM t1 WHERE a IN ('::80','::a0','garbage');
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 17 NULL 4 Using where
+Warnings:
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
+SELECT * FROM t1 WHERE a BETWEEN '::80' AND '::81';
+a
+::80
+::81
+EXPLAIN SELECT * FROM t1 WHERE a BETWEEN '::80' AND '::81';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL a NULL NULL NULL 256 Using where
+SELECT * FROM t1 WHERE a BETWEEN '::80' AND 'garbage';
+a
+Warnings:
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage'
+EXPLAIN SELECT * FROM t1 WHERE a BETWEEN '::80' AND 'garbage';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL a NULL NULL NULL 256 Using where
+SELECT * FROM t1 WHERE a=CAST('::ff' AS INET6);
+a
+::ff
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=CAST('::ff' AS INET6);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ref a a 17 const 2 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = INET6'::ff'
+DROP TABLE t1;
+#
+# End of 10.5 tests
+#
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_memory.test b/plugin/type_inet/mysql-test/type_inet/type_inet6_memory.test
new file mode 100644
index 00000000000..ff503ce524d
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_memory.test
@@ -0,0 +1,18 @@
+--source include/have_innodb.inc
+
+--echo #
+--echo # Start of 10.5 tests
+--echo #
+
+--echo #
+--echo # MDEV-274 The data type for IPv6/IPv4 addresses in MariaDB
+--echo #
+
+
+SET default_storage_engine=MEMORY;
+--source type_inet6_engines.inc
+
+
+--echo #
+--echo # End of 10.5 tests
+--echo #
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_myisam.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_myisam.result
new file mode 100644
index 00000000000..6525bda5aa5
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_myisam.result
@@ -0,0 +1,104 @@
+#
+# Start of 10.5 tests
+#
+#
+# MDEV-274 The data type for IPv6/IPv4 addresses in MariaDB
+#
+SET default_storage_engine=MyISAM;
+#
+# Range optimizer
+#
+CREATE TABLE t1 (a INET6, INDEX(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` inet6 DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+FOR i IN 0..255
+DO
+INSERT INTO t1 VALUES (CONCAT('::', HEX(i)));
+END FOR
+$$
+SELECT * FROM t1 WHERE a='::ff';
+a
+::ff
+EXPLAIN SELECT * FROM t1 WHERE a='::ff';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 17 const 1 Using where; Using index
+SELECT * FROM t1 WHERE a='garbage';
+a
+Warnings:
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
+EXPLAIN SELECT * FROM t1 WHERE a='garbage';
+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 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
+SELECT * FROM t1 WHERE a>='::fe';
+a
+::fe
+::ff
+EXPLAIN SELECT * FROM t1 WHERE a>='::fe';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 17 NULL 2 Using where; Using index
+SELECT * FROM t1 WHERE a>='garbage';
+a
+Warnings:
+Warning 1292 Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
+EXPLAIN SELECT * FROM t1 WHERE a>='garbage';
+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 1292 Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
+SELECT * FROM t1 WHERE a IN ('::80','::a0','::f0');
+a
+::80
+::a0
+::f0
+EXPLAIN SELECT * FROM t1 WHERE a IN ('::80','::a0','::f0');
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 17 NULL 3 Using where; Using index
+SELECT * FROM t1 WHERE a IN ('::80','::a0','garbage');
+a
+::80
+::a0
+Warnings:
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
+EXPLAIN SELECT * FROM t1 WHERE a IN ('::80','::a0','garbage');
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 17 NULL 2 Using where; Using index
+Warnings:
+Warning 1292 Incorrect inet6 value: 'garbage'
+Warning 1292 Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
+SELECT * FROM t1 WHERE a BETWEEN '::80' AND '::81';
+a
+::80
+::81
+EXPLAIN SELECT * FROM t1 WHERE a BETWEEN '::80' AND '::81';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 17 NULL 2 Using where; Using index
+SELECT * FROM t1 WHERE a BETWEEN '::80' AND 'garbage';
+a
+Warnings:
+Warning 1292 Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
+EXPLAIN SELECT * FROM t1 WHERE a BETWEEN '::80' AND 'garbage';
+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 1292 Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
+SELECT * FROM t1 WHERE a=CAST('::ff' AS INET6);
+a
+::ff
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=CAST('::ff' AS INET6);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ref a a 17 const 1 100.00 Using where; Using index
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = INET6'::ff'
+DROP TABLE t1;
+#
+# End of 10.5 tests
+#
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_myisam.test b/plugin/type_inet/mysql-test/type_inet/type_inet6_myisam.test
new file mode 100644
index 00000000000..232f874640a
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_myisam.test
@@ -0,0 +1,18 @@
+--source include/have_innodb.inc
+
+--echo #
+--echo # Start of 10.5 tests
+--echo #
+
+--echo #
+--echo # MDEV-274 The data type for IPv6/IPv4 addresses in MariaDB
+--echo #
+
+
+SET default_storage_engine=MyISAM;
+--source type_inet6_engines.inc
+
+
+--echo #
+--echo # End of 10.5 tests
+--echo #
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mysql.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_mysql.result
new file mode 100644
index 00000000000..468e9fea41e
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mysql.result
@@ -0,0 +1,15 @@
+CREATE TABLE t1 (a INET6);
+Field 1: `a`
+Catalog: `def`
+Database: `test`
+Table: `t1`
+Org_table: `t1`
+Type: STRING
+Collation: latin1_swedish_ci (8)
+Length: 39
+Max_length: 0
+Decimals: 0
+Flags: UNSIGNED BINARY
+
+
+DROP TABLE t1;
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mysql.test b/plugin/type_inet/mysql-test/type_inet/type_inet6_mysql.test
new file mode 100644
index 00000000000..5e6ac6f3804
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mysql.test
@@ -0,0 +1,6 @@
+-- source include/have_working_dns.inc
+-- source include/not_embedded.inc
+
+CREATE TABLE t1 (a INET6);
+--exec $MYSQL -t test --column-type-info -e "SELECT * FROM t1" 2>&1
+DROP TABLE t1;
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_plugin.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_plugin.result
new file mode 100644
index 00000000000..8369ef07de8
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_plugin.result
@@ -0,0 +1,31 @@
+#
+# Start of 10.5 tests
+#
+#
+# MDEV-274 The data type for IPv6/IPv4 addresses in MariaDB
+#
+SELECT
+PLUGIN_NAME,
+PLUGIN_VERSION,
+PLUGIN_STATUS,
+PLUGIN_TYPE,
+PLUGIN_AUTHOR,
+PLUGIN_DESCRIPTION,
+PLUGIN_LICENSE,
+PLUGIN_MATURITY,
+PLUGIN_AUTH_VERSION
+FROM INFORMATION_SCHEMA.PLUGINS
+WHERE PLUGIN_TYPE='DATA TYPE'
+ AND PLUGIN_NAME='inet6';
+PLUGIN_NAME inet6
+PLUGIN_VERSION 1.0
+PLUGIN_STATUS ACTIVE
+PLUGIN_TYPE DATA TYPE
+PLUGIN_AUTHOR MariaDB Corporation
+PLUGIN_DESCRIPTION Data type TEST_INT8
+PLUGIN_LICENSE GPL
+PLUGIN_MATURITY Experimental
+PLUGIN_AUTH_VERSION 1.0
+#
+# End of 10.5 tests
+#
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_plugin.test b/plugin/type_inet/mysql-test/type_inet/type_inet6_plugin.test
new file mode 100644
index 00000000000..ccc22b16f4f
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_plugin.test
@@ -0,0 +1,27 @@
+--echo #
+--echo # Start of 10.5 tests
+--echo #
+
+--echo #
+--echo # MDEV-274 The data type for IPv6/IPv4 addresses in MariaDB
+--echo #
+
+--vertical_results
+SELECT
+ PLUGIN_NAME,
+ PLUGIN_VERSION,
+ PLUGIN_STATUS,
+ PLUGIN_TYPE,
+ PLUGIN_AUTHOR,
+ PLUGIN_DESCRIPTION,
+ PLUGIN_LICENSE,
+ PLUGIN_MATURITY,
+ PLUGIN_AUTH_VERSION
+FROM INFORMATION_SCHEMA.PLUGINS
+ WHERE PLUGIN_TYPE='DATA TYPE'
+ AND PLUGIN_NAME='inet6';
+--horizontal_results
+
+--echo #
+--echo # End of 10.5 tests
+--echo #
diff --git a/plugin/type_inet/plugin.cc b/plugin/type_inet/plugin.cc
new file mode 100644
index 00000000000..6623492bf01
--- /dev/null
+++ b/plugin/type_inet/plugin.cc
@@ -0,0 +1,215 @@
+/* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2014 MariaDB Foundation
+ Copyright (c) 2019 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-1335 USA */
+
+#define MYSQL_SERVER
+#include "mariadb.h"
+#include "sql_class.h"
+#include "sql_type_inet.h"
+#include "item_inetfunc.h"
+#include <mysql/plugin_data_type.h>
+#include <mysql/plugin_function_collection.h>
+
+
+Type_handler_inet6 type_handler_inet6;
+
+
+static struct st_mariadb_data_type plugin_descriptor_type_inet6=
+{
+ MariaDB_DATA_TYPE_INTERFACE_VERSION,
+ &type_handler_inet6
+};
+
+
+/*************************************************************************/
+
+class Create_func_inet_ntoa : public Create_func_arg1
+{
+public:
+ Item *create_1_arg(THD *thd, Item *arg1) override
+ {
+ return new (thd->mem_root) Item_func_inet_ntoa(thd, arg1);
+ }
+ static Create_func_inet_ntoa s_singleton;
+protected:
+ Create_func_inet_ntoa() {}
+ virtual ~Create_func_inet_ntoa() {}
+};
+
+
+class Create_func_inet_aton : public Create_func_arg1
+{
+public:
+ Item *create_1_arg(THD *thd, Item *arg1) override
+ {
+ return new (thd->mem_root) Item_func_inet_aton(thd, arg1);
+ }
+ static Create_func_inet_aton s_singleton;
+protected:
+ Create_func_inet_aton() {}
+ virtual ~Create_func_inet_aton() {}
+};
+
+
+class Create_func_inet6_aton : public Create_func_arg1
+{
+public:
+ Item *create_1_arg(THD *thd, Item *arg1) override
+ {
+ return new (thd->mem_root) Item_func_inet6_aton(thd, arg1);
+ }
+ static Create_func_inet6_aton s_singleton;
+protected:
+ Create_func_inet6_aton() {}
+ virtual ~Create_func_inet6_aton() {}
+};
+
+
+class Create_func_inet6_ntoa : public Create_func_arg1
+{
+public:
+ Item *create_1_arg(THD *thd, Item *arg1) override
+ {
+ return new (thd->mem_root) Item_func_inet6_ntoa(thd, arg1);
+ }
+ static Create_func_inet6_ntoa s_singleton;
+protected:
+ Create_func_inet6_ntoa() {}
+ virtual ~Create_func_inet6_ntoa() {}
+};
+
+
+class Create_func_is_ipv4 : public Create_func_arg1
+{
+public:
+ Item *create_1_arg(THD *thd, Item *arg1) override
+ {
+ return new (thd->mem_root) Item_func_is_ipv4(thd, arg1);
+ }
+ static Create_func_is_ipv4 s_singleton;
+protected:
+ Create_func_is_ipv4() {}
+ virtual ~Create_func_is_ipv4() {}
+};
+
+
+class Create_func_is_ipv6 : public Create_func_arg1
+{
+public:
+ Item *create_1_arg(THD *thd, Item *arg1) override
+ {
+ return new (thd->mem_root) Item_func_is_ipv6(thd, arg1);
+ }
+ static Create_func_is_ipv6 s_singleton;
+protected:
+ Create_func_is_ipv6() {}
+ virtual ~Create_func_is_ipv6() {}
+};
+
+
+class Create_func_is_ipv4_compat : public Create_func_arg1
+{
+public:
+ Item *create_1_arg(THD *thd, Item *arg1) override
+ {
+ return new (thd->mem_root) Item_func_is_ipv4_compat(thd, arg1);
+ }
+ static Create_func_is_ipv4_compat s_singleton;
+protected:
+ Create_func_is_ipv4_compat() {}
+ virtual ~Create_func_is_ipv4_compat() {}
+};
+
+
+class Create_func_is_ipv4_mapped : public Create_func_arg1
+{
+public:
+ Item *create_1_arg(THD *thd, Item *arg1) override
+ {
+ return new (thd->mem_root) Item_func_is_ipv4_mapped(thd, arg1);
+ }
+ static Create_func_is_ipv4_mapped s_singleton;
+protected:
+ Create_func_is_ipv4_mapped() {}
+ virtual ~Create_func_is_ipv4_mapped() {}
+};
+
+
+Create_func_inet_ntoa Create_func_inet_ntoa::s_singleton;
+Create_func_inet6_aton Create_func_inet6_aton::s_singleton;
+Create_func_inet6_ntoa Create_func_inet6_ntoa::s_singleton;
+Create_func_inet_aton Create_func_inet_aton::s_singleton;
+Create_func_is_ipv4 Create_func_is_ipv4::s_singleton;
+Create_func_is_ipv6 Create_func_is_ipv6::s_singleton;
+Create_func_is_ipv4_compat Create_func_is_ipv4_compat::s_singleton;
+Create_func_is_ipv4_mapped Create_func_is_ipv4_mapped::s_singleton;
+
+
+#define BUILDER(F) & F::s_singleton
+
+
+static Native_func_registry func_array[] =
+{
+ {{STRING_WITH_LEN("INET_ATON")}, BUILDER(Create_func_inet_aton)},
+ {{STRING_WITH_LEN("INET_NTOA")}, BUILDER(Create_func_inet_ntoa)},
+ {{STRING_WITH_LEN("INET6_ATON")}, BUILDER(Create_func_inet6_aton)},
+ {{STRING_WITH_LEN("INET6_NTOA")}, BUILDER(Create_func_inet6_ntoa)},
+ {{STRING_WITH_LEN("IS_IPV4")}, BUILDER(Create_func_is_ipv4)},
+ {{STRING_WITH_LEN("IS_IPV6")}, BUILDER(Create_func_is_ipv6)},
+ {{STRING_WITH_LEN("IS_IPV4_COMPAT")}, BUILDER(Create_func_is_ipv4_compat)},
+ {{STRING_WITH_LEN("IS_IPV4_MAPPED")}, BUILDER(Create_func_is_ipv4_mapped)}
+};
+
+
+static Plugin_function_collection
+ plugin_descriptor_function_collection_inet(
+ MariaDB_FUNCTION_COLLECTION_INTERFACE_VERSION,
+ Native_func_registry_array(func_array, array_elements(func_array)));
+
+/*************************************************************************/
+
+maria_declare_plugin(type_inet)
+{
+ MariaDB_FUNCTION_COLLECTION_PLUGIN, // the plugin type (see include/mysql/plugin.h)
+ &plugin_descriptor_function_collection_inet, // pointer to type-specific plugin descriptor
+ "func_inet", // plugin name
+ "MariaDB Corporation", // plugin author
+ "Function collection test", // the plugin description
+ PLUGIN_LICENSE_GPL, // the plugin license (see include/mysql/plugin.h)
+ 0, // Pointer to plugin initialization function
+ 0, // Pointer to plugin deinitialization function
+ 0x0100, // Numeric version 0xAABB means AA.BB veriosn
+ NULL, // Status variables
+ NULL, // System variables
+ "1.0", // String version representation
+ MariaDB_PLUGIN_MATURITY_EXPERIMENTAL // Maturity(see include/mysql/plugin.h)*/
+},
+{
+ MariaDB_DATA_TYPE_PLUGIN, // the plugin type (see include/mysql/plugin.h)
+ &plugin_descriptor_type_inet6,// pointer to type-specific plugin descriptor
+ type_handler_inet6.name().ptr(),// plugin name
+ "MariaDB Corporation", // plugin author
+ "Data type TEST_INT8", // the plugin description
+ PLUGIN_LICENSE_GPL, // the plugin license (see include/mysql/plugin.h)
+ 0, // Pointer to plugin initialization function
+ 0, // Pointer to plugin deinitialization function
+ 0x0100, // Numeric version 0xAABB means AA.BB veriosn
+ NULL, // Status variables
+ NULL, // System variables
+ "1.0", // String version representation
+ MariaDB_PLUGIN_MATURITY_EXPERIMENTAL // Maturity(see include/mysql/plugin.h)*/
+}
+maria_declare_plugin_end;
diff --git a/plugin/type_inet/sql_type_inet.cc b/plugin/type_inet/sql_type_inet.cc
new file mode 100644
index 00000000000..05d87acf8f8
--- /dev/null
+++ b/plugin/type_inet/sql_type_inet.cc
@@ -0,0 +1,1538 @@
+/* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2014 MariaDB Foundation
+ Copyright (c) 2019 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-1335 USA */
+
+#define MYSQL_SERVER
+#include "mariadb.h"
+#include "my_net.h"
+#include "sql_class.h" // THD, SORT_FIELD_ATTR
+#include "opt_range.h" // SEL_ARG
+#include "sql_type_inet.h"
+
+///////////////////////////////////////////////////////////////////////////
+
+static const char HEX_DIGITS[]= "0123456789abcdef";
+
+
+///////////////////////////////////////////////////////////////////////////
+
+/**
+ Tries to convert given string to binary IPv4-address representation.
+ This is a portable alternative to inet_pton(AF_INET).
+
+ @param str String to convert.
+ @param str_length String length.
+
+ @return Completion status.
+ @retval true - error, the given string does not represent an IPv4-address.
+ @retval false - ok, the string has been converted sucessfully.
+
+ @note The problem with inet_pton() is that it treats leading zeros in
+ IPv4-part differently on different platforms.
+*/
+
+bool Inet4::ascii_to_ipv4(const char *str, size_t str_length)
+{
+ if (str_length < 7)
+ {
+ DBUG_PRINT("error", ("ascii_to_ipv4(%.*s): "
+ "invalid IPv4 address: too short.",
+ (int) str_length, str));
+ return true;
+ }
+
+ if (str_length > IN_ADDR_MAX_CHAR_LENGTH)
+ {
+ DBUG_PRINT("error", ("ascii_to_ipv4(%.*s): "
+ "invalid IPv4 address: too long.",
+ (int) str_length, str));
+ return true;
+ }
+
+ unsigned char *ipv4_bytes= (unsigned char *) &m_buffer;
+ const char *str_end= str + str_length;
+ const char *p= str;
+ int byte_value= 0;
+ int chars_in_group= 0;
+ int dot_count= 0;
+ char c= 0;
+
+ while (p < str_end && *p)
+ {
+ c= *p++;
+
+ if (my_isdigit(&my_charset_latin1, c))
+ {
+ ++chars_in_group;
+
+ if (chars_in_group > 3)
+ {
+ DBUG_PRINT("error", ("ascii_to_ipv4(%.*s): invalid IPv4 address: "
+ "too many characters in a group.",
+ (int) str_length, str));
+ return true;
+ }
+
+ byte_value= byte_value * 10 + (c - '0');
+
+ if (byte_value > 255)
+ {
+ DBUG_PRINT("error", ("ascii_to_ipv4(%.*s): invalid IPv4 address: "
+ "invalid byte value.",
+ (int) str_length, str));
+ return true;
+ }
+ }
+ else if (c == '.')
+ {
+ if (chars_in_group == 0)
+ {
+ DBUG_PRINT("error", ("ascii_to_ipv4(%.*s): invalid IPv4 address: "
+ "too few characters in a group.",
+ (int) str_length, str));
+ return true;
+ }
+
+ ipv4_bytes[dot_count]= (unsigned char) byte_value;
+
+ ++dot_count;
+ byte_value= 0;
+ chars_in_group= 0;
+
+ if (dot_count > 3)
+ {
+ DBUG_PRINT("error", ("ascii_to_ipv4(%.*s): invalid IPv4 address: "
+ "too many dots.", (int) str_length, str));
+ return true;
+ }
+ }
+ else
+ {
+ DBUG_PRINT("error", ("ascii_to_ipv4(%.*s): invalid IPv4 address: "
+ "invalid character at pos %d.",
+ (int) str_length, str, (int) (p - str)));
+ return true;
+ }
+ }
+
+ if (c == '.')
+ {
+ DBUG_PRINT("error", ("ascii_to_ipv4(%.*s): invalid IPv4 address: "
+ "ending at '.'.", (int) str_length, str));
+ return true;
+ }
+
+ if (dot_count != 3)
+ {
+ DBUG_PRINT("error", ("ascii_to_ipv4(%.*s): invalid IPv4 address: "
+ "too few groups.",
+ (int) str_length, str));
+ return true;
+ }
+
+ ipv4_bytes[3]= (unsigned char) byte_value;
+
+ DBUG_PRINT("info", ("ascii_to_ipv4(%.*s): valid IPv4 address: %d.%d.%d.%d",
+ (int) str_length, str,
+ ipv4_bytes[0], ipv4_bytes[1],
+ ipv4_bytes[2], ipv4_bytes[3]));
+ return false;
+}
+
+
+/**
+ Tries to convert given string to binary IPv6-address representation.
+ This is a portable alternative to inet_pton(AF_INET6).
+
+ @param str String to convert.
+ @param str_length String length.
+
+ @return Completion status.
+ @retval true - error, the given string does not represent an IPv6-address.
+ @retval false - ok, the string has been converted sucessfully.
+
+ @note The problem with inet_pton() is that it treats leading zeros in
+ IPv4-part differently on different platforms.
+*/
+
+bool Inet6::ascii_to_ipv6(const char *str, size_t str_length)
+{
+ if (str_length < 2)
+ {
+ DBUG_PRINT("error", ("ascii_to_ipv6(%.*s): invalid IPv6 address: too short.",
+ (int) str_length, str));
+ return true;
+ }
+
+ if (str_length > IN6_ADDR_MAX_CHAR_LENGTH)
+ {
+ DBUG_PRINT("error", ("ascii_to_ipv6(%.*s): invalid IPv6 address: too long.",
+ (int) str_length, str));
+ return true;
+ }
+
+ memset(m_buffer, 0, sizeof(m_buffer));
+
+ const char *p= str;
+
+ if (*p == ':')
+ {
+ ++p;
+
+ if (*p != ':')
+ {
+ DBUG_PRINT("error", ("ascii_to_ipv6(%.*s): invalid IPv6 address: "
+ "can not start with ':x'.", (int) str_length, str));
+ return true;
+ }
+ }
+
+ const char *str_end= str + str_length;
+ char *ipv6_bytes_end= m_buffer + sizeof(m_buffer);
+ char *dst= m_buffer;
+ char *gap_ptr= NULL;
+ const char *group_start_ptr= p;
+ int chars_in_group= 0;
+ int group_value= 0;
+
+ while (p < str_end && *p)
+ {
+ char c= *p++;
+
+ if (c == ':')
+ {
+ group_start_ptr= p;
+
+ if (!chars_in_group)
+ {
+ if (gap_ptr)
+ {
+ DBUG_PRINT("error", ("ascii_to_ipv6(%.*s): invalid IPv6 address: "
+ "too many gaps(::).", (int) str_length, str));
+ return true;
+ }
+
+ gap_ptr= dst;
+ continue;
+ }
+
+ if (!*p || p >= str_end)
+ {
+ DBUG_PRINT("error", ("ascii_to_ipv6(%.*s): invalid IPv6 address: "
+ "ending at ':'.", (int) str_length, str));
+ return true;
+ }
+
+ if (dst + 2 > ipv6_bytes_end)
+ {
+ DBUG_PRINT("error", ("ascii_to_ipv6(%.*s): invalid IPv6 address: "
+ "too many groups (1).", (int) str_length, str));
+ return true;
+ }
+
+ dst[0]= (unsigned char) (group_value >> 8) & 0xff;
+ dst[1]= (unsigned char) group_value & 0xff;
+ dst += 2;
+
+ chars_in_group= 0;
+ group_value= 0;
+ }
+ else if (c == '.')
+ {
+ if (dst + IN_ADDR_SIZE > ipv6_bytes_end)
+ {
+ DBUG_PRINT("error", ("ascii_to_ipv6(%.*s): invalid IPv6 address: "
+ "unexpected IPv4-part.", (int) str_length, str));
+ return true;
+ }
+
+ Inet4_null tmp(group_start_ptr, (size_t) (str_end - group_start_ptr),
+ &my_charset_latin1);
+ if (tmp.is_null())
+ {
+ DBUG_PRINT("error", ("ascii_to_ipv6(%.*s): invalid IPv6 address: "
+ "invalid IPv4-part.", (int) str_length, str));
+ return true;
+ }
+
+ tmp.to_binary(dst, IN_ADDR_SIZE);
+ dst += IN_ADDR_SIZE;
+ chars_in_group= 0;
+
+ break;
+ }
+ else
+ {
+ const char *hdp= strchr(HEX_DIGITS, my_tolower(&my_charset_latin1, c));
+
+ if (!hdp)
+ {
+ DBUG_PRINT("error", ("ascii_to_ipv6(%.*s): invalid IPv6 address: "
+ "invalid character at pos %d.",
+ (int) str_length, str, (int) (p - str)));
+ return true;
+ }
+
+ if (chars_in_group >= 4)
+ {
+ DBUG_PRINT("error", ("ascii_to_ipv6(%.*s): invalid IPv6 address: "
+ "too many digits in group.",
+ (int) str_length, str));
+ return true;
+ }
+
+ group_value <<= 4;
+ group_value |= hdp - HEX_DIGITS;
+
+ DBUG_ASSERT(group_value <= 0xffff);
+
+ ++chars_in_group;
+ }
+ }
+
+ if (chars_in_group > 0)
+ {
+ if (dst + 2 > ipv6_bytes_end)
+ {
+ DBUG_PRINT("error", ("ascii_to_ipv6(%.*s): invalid IPv6 address: "
+ "too many groups (2).", (int) str_length, str));
+ return true;
+ }
+
+ dst[0]= (unsigned char) (group_value >> 8) & 0xff;
+ dst[1]= (unsigned char) group_value & 0xff;
+ dst += 2;
+ }
+
+ if (gap_ptr)
+ {
+ if (dst == ipv6_bytes_end)
+ {
+ DBUG_PRINT("error", ("ascii_to_ipv6(%.*s): invalid IPv6 address: "
+ "no room for a gap (::).", (int) str_length, str));
+ return true;
+ }
+
+ int bytes_to_move= (int)(dst - gap_ptr);
+
+ for (int i= 1; i <= bytes_to_move; ++i)
+ {
+ ipv6_bytes_end[-i]= gap_ptr[bytes_to_move - i];
+ gap_ptr[bytes_to_move - i]= 0;
+ }
+
+ dst= ipv6_bytes_end;
+ }
+
+ if (dst < ipv6_bytes_end)
+ {
+ DBUG_PRINT("error", ("ascii_to_ipv6(%.*s): invalid IPv6 address: "
+ "too few groups.", (int) str_length, str));
+ return true;
+ }
+
+ return false;
+}
+
+
+/**
+ Converts IPv4-binary-address to a string. This function is a portable
+ alternative to inet_ntop(AF_INET).
+
+ @param[in] ipv4 IPv4-address data (byte array)
+ @param[out] dst A buffer to store string representation of IPv4-address.
+ @param[in] dstsize Number of bytes avaiable in "dst"
+
+ @note The problem with inet_ntop() is that it is available starting from
+ Windows Vista, but the minimum supported version is Windows 2000.
+*/
+
+size_t Inet4::to_string(char *dst, size_t dstsize) const
+{
+ return (size_t) my_snprintf(dst, dstsize, "%d.%d.%d.%d",
+ (uchar) m_buffer[0], (uchar) m_buffer[1],
+ (uchar) m_buffer[2], (uchar) m_buffer[3]);
+}
+
+
+/**
+ Converts IPv6-binary-address to a string. This function is a portable
+ alternative to inet_ntop(AF_INET6).
+
+ @param[in] ipv6 IPv6-address data (byte array)
+ @param[out] dst A buffer to store string representation of IPv6-address.
+ It must be at least of INET6_ADDRSTRLEN.
+ @param[in] dstsize Number of bytes available dst.
+
+ @note The problem with inet_ntop() is that it is available starting from
+ Windows Vista, but out the minimum supported version is Windows 2000.
+*/
+
+size_t Inet6::to_string(char *dst, size_t dstsize) const
+{
+ struct Region
+ {
+ int pos;
+ int length;
+ };
+
+ const char *ipv6= m_buffer;
+ char *dstend= dst + dstsize;
+ const unsigned char *ipv6_bytes= (const unsigned char *) ipv6;
+
+ // 1. Translate IPv6-address bytes to words.
+ // We can't just cast to short, because it's not guaranteed
+ // that sizeof (short) == 2. So, we have to make a copy.
+
+ uint16 ipv6_words[IN6_ADDR_NUM_WORDS];
+
+ DBUG_ASSERT(dstsize > 0); // Need a space at least for the trailing '\0'
+ for (size_t i= 0; i < IN6_ADDR_NUM_WORDS; ++i)
+ ipv6_words[i]= (ipv6_bytes[2 * i] << 8) + ipv6_bytes[2 * i + 1];
+
+ // 2. Find "the gap" -- longest sequence of zeros in IPv6-address.
+
+ Region gap= { -1, -1 };
+
+ {
+ Region rg= { -1, -1 };
+
+ for (size_t i= 0; i < IN6_ADDR_NUM_WORDS; ++i)
+ {
+ if (ipv6_words[i] != 0)
+ {
+ if (rg.pos >= 0)
+ {
+ if (rg.length > gap.length)
+ gap= rg;
+
+ rg.pos= -1;
+ rg.length= -1;
+ }
+ }
+ else
+ {
+ if (rg.pos >= 0)
+ {
+ ++rg.length;
+ }
+ else
+ {
+ rg.pos= (int) i;
+ rg.length= 1;
+ }
+ }
+ }
+
+ if (rg.pos >= 0)
+ {
+ if (rg.length > gap.length)
+ gap= rg;
+ }
+ }
+
+ // 3. Convert binary data to string.
+
+ char *p= dst;
+
+ for (int i= 0; i < (int) IN6_ADDR_NUM_WORDS; ++i)
+ {
+ DBUG_ASSERT(dstend >= p);
+ size_t dstsize_available= dstend - p;
+ if (dstsize_available < 5)
+ break;
+ if (i == gap.pos)
+ {
+ // We're at the gap position. We should put trailing ':' and jump to
+ // the end of the gap.
+
+ if (i == 0)
+ {
+ // The gap starts from the beginning of the data -- leading ':'
+ // should be put additionally.
+
+ *p= ':';
+ ++p;
+ }
+
+ *p= ':';
+ ++p;
+
+ i += gap.length - 1;
+ }
+ else if (i == 6 && gap.pos == 0 &&
+ (gap.length == 6 || // IPv4-compatible
+ (gap.length == 5 && ipv6_words[5] == 0xffff) // IPv4-mapped
+ ))
+ {
+ // The data represents either IPv4-compatible or IPv4-mapped address.
+ // The IPv6-part (zeros or zeros + ffff) has been already put into
+ // the string (dst). Now it's time to dump IPv4-part.
+
+ return (size_t) (p - dst) +
+ Inet4_null((const char *) (ipv6_bytes + 12), 4).
+ to_string(p, dstsize_available);
+ }
+ else
+ {
+ // Usual IPv6-address-field. Print it out using lower-case
+ // hex-letters without leading zeros (recommended IPv6-format).
+ //
+ // If it is not the last field, append closing ':'.
+
+ p += sprintf(p, "%x", ipv6_words[i]);
+
+ if (i + 1 != IN6_ADDR_NUM_WORDS)
+ {
+ *p= ':';
+ ++p;
+ }
+ }
+ }
+
+ *p= 0;
+ return (size_t) (p - dst);
+}
+
+
+bool Inet6::make_from_item(Item *item)
+{
+ if (item->type_handler() == &type_handler_inet6)
+ {
+ Native tmp(m_buffer, sizeof(m_buffer));
+ bool rc= item->val_native(current_thd, &tmp);
+ if (rc)
+ return true;
+ DBUG_ASSERT(tmp.length() == sizeof(m_buffer));
+ if (tmp.ptr() != m_buffer)
+ memcpy(m_buffer, tmp.ptr(), sizeof(m_buffer));
+ return false;
+ }
+ StringBufferInet6 tmp;
+ String *str= item->val_str(&tmp);
+ return str ? make_from_character_or_binary_string(str) : true;
+}
+
+
+bool Inet6::make_from_character_or_binary_string(const String *str)
+{
+ static Name name= type_handler_inet6.name();
+ if (str->charset() != &my_charset_bin)
+ {
+ bool rc= character_string_to_ipv6(str->ptr(), str->length(),
+ str->charset());
+ if (rc)
+ current_thd->push_warning_wrong_value(Sql_condition::WARN_LEVEL_WARN,
+ name.ptr(),
+ ErrConvString(str).ptr());
+ return rc;
+ }
+ if (str->length() != sizeof(m_buffer))
+ {
+ current_thd->push_warning_wrong_value(Sql_condition::WARN_LEVEL_WARN,
+ name.ptr(),
+ ErrConvString(str).ptr());
+ return true;
+ }
+ DBUG_ASSERT(str->ptr() != m_buffer);
+ memcpy(m_buffer, str->ptr(), sizeof(m_buffer));
+ return false;
+};
+
+
+/********************************************************************/
+
+
+class cmp_item_inet6: public cmp_item_scalar
+{
+ Inet6 m_native;
+public:
+ cmp_item_inet6()
+ :cmp_item_scalar(),
+ m_native(Inet6_zero())
+ { }
+ void store_value(Item *item) override
+ {
+ m_native= Inet6(item, &m_null_value);
+ }
+ int cmp_not_null(const Value *val) override
+ {
+ DBUG_ASSERT(!val->is_null());
+ DBUG_ASSERT(val->is_string());
+ Inet6_null tmp(val->m_string);
+ DBUG_ASSERT(!tmp.is_null());
+ return m_native.cmp(tmp);
+ }
+ int cmp(Item *arg) override
+ {
+ Inet6_null tmp(arg);
+ return m_null_value || tmp.is_null() ? UNKNOWN : m_native.cmp(tmp) != 0;
+ }
+ int compare(cmp_item *ci) override
+ {
+ cmp_item_inet6 *tmp= static_cast<cmp_item_inet6*>(ci);
+ DBUG_ASSERT(!m_null_value);
+ DBUG_ASSERT(!tmp->m_null_value);
+ return m_native.cmp(tmp->m_native);
+ }
+ cmp_item *make_same() override
+ {
+ return new cmp_item_inet6();
+ }
+};
+
+
+class Field_inet6: public Field
+{
+ static void set_min_value(char *ptr)
+ {
+ memset(ptr, 0, Inet6::binary_length());
+ }
+ static void set_max_value(char *ptr)
+ {
+ memset(ptr, 0xFF, Inet6::binary_length());
+ }
+ void store_warning(const ErrConv &str,
+ Sql_condition::enum_warning_level level)
+ {
+ static const Name type_name= type_handler_inet6.name();
+ get_thd()->push_warning_truncated_value_for_field(level, type_name.ptr(),
+ str.ptr(), table->s,
+ field_name.str);
+ }
+ int set_null_with_warn(const ErrConv &str)
+ {
+ store_warning(str, Sql_condition::WARN_LEVEL_WARN);
+ set_null();
+ return 1;
+ }
+ int set_min_value_with_warn(const ErrConv &str)
+ {
+ store_warning(str, Sql_condition::WARN_LEVEL_WARN);
+ set_min_value((char*) ptr);
+ return 1;
+ }
+ int set_max_value_with_warn(const ErrConv &str)
+ {
+ store_warning(str, Sql_condition::WARN_LEVEL_WARN);
+ set_max_value((char*) ptr);
+ return 1;
+ }
+ int store_inet6_null_with_warn(const Inet6_null &inet6,
+ const ErrConvString &err)
+ {
+ DBUG_ASSERT(marked_for_write_or_computed());
+ if (inet6.is_null())
+ return maybe_null() ? set_null_with_warn(err) :
+ set_min_value_with_warn(err);
+ inet6.to_binary((char *) ptr, Inet6::binary_length());
+ return 0;
+ }
+
+public:
+ Field_inet6(const LEX_CSTRING *field_name_arg, const Record_addr &rec)
+ :Field(rec.ptr(), Inet6::max_char_length(),
+ rec.null_ptr(), rec.null_bit(), Field::NONE, field_name_arg)
+ {
+ flags|= BINARY_FLAG | UNSIGNED_FLAG;
+ }
+ const Type_handler *type_handler() const override
+ {
+ return &type_handler_inet6;
+ }
+ uint32 max_display_length() const override { return field_length; }
+ bool str_needs_quotes() const override { return true; }
+ const DTCollation &dtcollation() const override
+ {
+ static DTCollation_numeric c;
+ return c;
+ }
+ CHARSET_INFO *charset(void) const override { return &my_charset_numeric; }
+ const CHARSET_INFO *sort_charset(void) const override { return &my_charset_bin; }
+ /**
+ This makes client-server protocol convert the value according
+ to @@character_set_client.
+ */
+ bool binary() const override { return false; }
+ enum ha_base_keytype key_type() const override { return HA_KEYTYPE_BINARY; }
+
+ bool is_equal(const Column_definition &new_field) const override
+ {
+ return new_field.type_handler() == type_handler();
+ }
+ bool eq_def(const Field *field) const override
+ {
+ return Field::eq_def(field);
+ }
+ double pos_in_interval(Field *min, Field *max) override
+ {
+ return pos_in_interval_val_str(min, max, 0);
+ }
+ int cmp(const uchar *a, const uchar *b) const override
+ { return memcmp(a, b, pack_length()); }
+
+ void sort_string(uchar *to, uint length) override
+ {
+ DBUG_ASSERT(length == pack_length());
+ memcpy(to, ptr, length);
+ }
+ uint32 pack_length() const override
+ {
+ return Inet6::binary_length();
+ }
+ uint pack_length_from_metadata(uint field_metadata) const override
+ {
+ return Inet6::binary_length();
+ }
+
+ void sql_type(String &str) const override
+ {
+ static Name name= type_handler_inet6.name();
+ str.set_ascii(name.ptr(), name.length());
+ }
+
+ bool validate_value_in_record(THD *thd, const uchar *record) const override
+ {
+ return false;
+ }
+
+ String *val_str(String *val_buffer,
+ String *val_ptr __attribute__((unused))) override
+ {
+ DBUG_ASSERT(marked_for_read());
+ Inet6_null tmp((const char *) ptr, pack_length());
+ return tmp.to_string(val_buffer) ? NULL : val_buffer;
+ }
+
+ my_decimal *val_decimal(my_decimal *to) override
+ {
+ DBUG_ASSERT(marked_for_read());
+ my_decimal_set_zero(to);
+ return to;
+ }
+
+ longlong val_int() override
+ {
+ DBUG_ASSERT(marked_for_read());
+ return 0;
+ }
+
+ double val_real() override
+ {
+ DBUG_ASSERT(marked_for_read());
+ return 0;
+ }
+
+ bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate) override
+ {
+ DBUG_ASSERT(marked_for_read());
+ set_zero_time(ltime, MYSQL_TIMESTAMP_TIME);
+ return false;
+ }
+
+ bool val_bool(void) override
+ {
+ DBUG_ASSERT(marked_for_read());
+ return !Inet6::only_zero_bytes((const char *) ptr, Inet6::binary_length());
+ }
+
+ int store_native(const Native &value) override
+ {
+ DBUG_ASSERT(marked_for_write_or_computed());
+ DBUG_ASSERT(value.length() == Inet6::binary_length());
+ memcpy(ptr, value.ptr(), value.length());
+ return 0;
+ }
+
+ int store(const char *str, size_t length, CHARSET_INFO *cs) override
+ {
+ return cs == &my_charset_bin ? store_binary(str, length) :
+ store_text(str, length, cs);
+ }
+
+ int store_text(const char *str, size_t length, CHARSET_INFO *cs) override
+ {
+ return store_inet6_null_with_warn(Inet6_null(str, length, cs),
+ ErrConvString(str, length, cs));
+ }
+
+ int store_binary(const char *str, size_t length) override
+ {
+ return store_inet6_null_with_warn(Inet6_null(str, length),
+ ErrConvString(str, length,
+ &my_charset_bin));
+ }
+
+ int store_hex_hybrid(const char *str, size_t length) override
+ {
+ return Field_inet6::store_binary(str, length);
+ }
+
+ int store_decimal(const my_decimal *num) override
+ {
+ DBUG_ASSERT(marked_for_write_or_computed());
+ return set_min_value_with_warn(ErrConvDecimal(num));
+ }
+
+ int store(longlong nr, bool unsigned_flag) override
+ {
+ DBUG_ASSERT(marked_for_write_or_computed());
+ return set_min_value_with_warn(
+ ErrConvInteger(Longlong_hybrid(nr, unsigned_flag)));
+ }
+
+ int store(double nr) override
+ {
+ DBUG_ASSERT(marked_for_write_or_computed());
+ return set_min_value_with_warn(ErrConvDouble(nr));
+ }
+
+ int store_time_dec(const MYSQL_TIME *ltime, uint dec) override
+ {
+ DBUG_ASSERT(marked_for_write_or_computed());
+ return set_min_value_with_warn(ErrConvTime(ltime));
+ }
+
+ /*** Field conversion routines ***/
+ int store_field(Field *from) override
+ {
+ // INSERT INTO t1 (inet6_field) SELECT different_field_type FROM t2;
+ return from->save_in_field(this);
+ }
+ int save_in_field(Field *to) override
+ {
+ // INSERT INTO t2 (different_field_type) SELECT inet6_field FROM t1;
+ if (to->charset() == &my_charset_bin &&
+ dynamic_cast<const Type_handler_general_purpose_string*>
+ (to->type_handler()))
+ {
+ NativeBufferInet6 res;
+ val_native(&res);
+ return to->store(res.ptr(), res.length(), &my_charset_bin);
+ }
+ return save_in_field_str(to);
+ }
+ Copy_func *get_copy_func(const Field *from) const override
+ {
+ // ALTER to INET6 from another field
+ return do_field_string;
+ }
+
+ Copy_func *get_copy_func_to(const Field *to) const override
+ {
+ if (type_handler() == to->type_handler())
+ {
+ // ALTER from INET6 to INET6
+ DBUG_ASSERT(pack_length() == to->pack_length());
+ DBUG_ASSERT(charset() == to->charset());
+ DBUG_ASSERT(sort_charset() == to->sort_charset());
+ return Field::do_field_eq;
+ }
+ // ALTER from INET6 to another data type
+ if (to->charset() == &my_charset_bin &&
+ dynamic_cast<const Type_handler_general_purpose_string*>
+ (to->type_handler()))
+ {
+ /*
+ ALTER from INET6 to a binary string type, e.g.:
+ BINARY, TINYBLOB, BLOB, MEDIUMBLOB, LONGBLOB
+ */
+ return do_field_inet6_native_to_binary;
+ }
+ return do_field_string;
+ }
+
+ static void do_field_inet6_native_to_binary(Copy_field *copy)
+ {
+ NativeBufferInet6 res;
+ copy->from_field->val_native(&res);
+ copy->to_field->store(res.ptr(), res.length(), &my_charset_bin);
+ }
+
+ bool memcpy_field_possible(const Field *from) const override
+ {
+ // INSERT INTO t1 (inet6_field) SELECT field2 FROM t2;
+ return type_handler() == from->type_handler();
+ }
+ enum_conv_type rpl_conv_type_from(const Conv_source &source,
+ const Relay_log_info *rli,
+ const Conv_param &param) const override
+ {
+ if (type_handler() == source.type_handler() ||
+ (source.type_handler() == &type_handler_string &&
+ source.type_handler()->max_display_length_for_field(source) ==
+ Inet6::binary_length()))
+ return rpl_conv_type_from_same_data_type(source.metadata(), rli, param);
+ return CONV_TYPE_IMPOSSIBLE;
+ }
+
+ /*** Optimizer routines ***/
+ bool test_if_equality_guarantees_uniqueness(const Item *const_item) const override
+ {
+ /*
+ This condition:
+ WHERE inet6_field=const
+ should return a single distinct value only,
+ as comparison is done according to INET6.
+ */
+ return true;
+ }
+ bool can_be_substituted_to_equal_item(const Context &ctx,
+ const Item_equal *item_equal)
+ override
+ {
+ switch (ctx.subst_constraint()) {
+ case ANY_SUBST:
+ return ctx.compare_type_handler() == item_equal->compare_type_handler();
+ case IDENTITY_SUBST:
+ return true;
+ }
+ return false;
+ }
+ Item *get_equal_const_item(THD *thd, const Context &ctx,
+ Item *const_item) override;
+ bool can_optimize_keypart_ref(const Item_bool_func *cond,
+ const Item *item) const override
+ {
+ /*
+ Mixing of two different non-traditional types is currently prevented.
+ This may change in the future. For example, INET4 and INET6
+ data types can be made comparable.
+ */
+ DBUG_ASSERT(item->type_handler()->is_traditional_scalar_type() ||
+ item->type_handler() == type_handler());
+ return true;
+ }
+ /**
+ Test if Field can use range optimizer for a standard comparison operation:
+ <=, <, =, <=>, >, >=
+ Note, this method does not cover spatial operations.
+ */
+ bool can_optimize_range(const Item_bool_func *cond,
+ const Item *item,
+ bool is_eq_func) const override
+ {
+ // See the DBUG_ASSERT comment in can_optimize_keypart_ref()
+ DBUG_ASSERT(item->type_handler()->is_traditional_scalar_type() ||
+ item->type_handler() == type_handler());
+ return true;
+ }
+ SEL_ARG *get_mm_leaf(RANGE_OPT_PARAM *prm, KEY_PART *key_part,
+ const Item_bool_func *cond,
+ scalar_comparison_op op, Item *value) override
+ {
+ DBUG_ENTER("Field_inet6::get_mm_leaf");
+ if (!can_optimize_scalar_range(prm, key_part, cond, op, value))
+ DBUG_RETURN(0);
+ int err= value->save_in_field_no_warnings(this, 1);
+ if ((op != SCALAR_CMP_EQUAL && is_real_null()) || err < 0)
+ DBUG_RETURN(&null_element);
+ if (err > 0)
+ {
+ if (op == SCALAR_CMP_EQ || op == SCALAR_CMP_EQUAL)
+ DBUG_RETURN(new (prm->mem_root) SEL_ARG_IMPOSSIBLE(this));
+ DBUG_RETURN(NULL); /* Cannot infer anything */
+ }
+ DBUG_RETURN(stored_field_make_mm_leaf(prm, key_part, op, value));
+ }
+ bool can_optimize_hash_join(const Item_bool_func *cond,
+ const Item *item) const override
+ {
+ return can_optimize_keypart_ref(cond, item);
+ }
+ bool can_optimize_group_min_max(const Item_bool_func *cond,
+ const Item *const_item) const override
+ {
+ return true;
+ }
+
+ uint row_pack_length() const override { return pack_length(); }
+
+ Binlog_type_info binlog_type_info() const override
+ {
+ DBUG_ASSERT(type() == binlog_type());
+ return Binlog_type_info_fixed_string(Field_inet6::binlog_type(),
+ Inet6::binary_length(),
+ &my_charset_bin);
+ }
+
+ /**********/
+ uint size_of() const override { return sizeof(*this); }
+};
+
+
+class Item_typecast_inet6: public Item_func
+{
+public:
+ Item_typecast_inet6(THD *thd, Item *a) :Item_func(thd, a) {}
+
+ const Type_handler *type_handler() const override
+ { return &type_handler_inet6; }
+
+ enum Functype functype() const override { return CHAR_TYPECAST_FUNC; }
+ bool eq(const Item *item, bool binary_cmp) const override
+ {
+ if (this == item)
+ return true;
+ if (item->type() != FUNC_ITEM ||
+ functype() != ((Item_func*)item)->functype())
+ return false;
+ if (type_handler() != item->type_handler())
+ return false;
+ Item_typecast_inet6 *cast= (Item_typecast_inet6*) item;
+ return args[0]->eq(cast->args[0], binary_cmp);
+ }
+ const char *func_name() const override { return "cast_as_inet6"; }
+ void print(String *str, enum_query_type query_type) override
+ {
+ str->append(STRING_WITH_LEN("cast("));
+ args[0]->print(str, query_type);
+ str->append(STRING_WITH_LEN(" as inet6)"));
+ }
+ bool fix_length_and_dec() override
+ {
+ Type_std_attributes::operator=(Type_std_attributes_inet6());
+ return false;
+ }
+ String *val_str(String *to) override
+ {
+ Inet6_null tmp(args[0]);
+ return (null_value= tmp.is_null() || tmp.to_string(to)) ? NULL : to;
+ }
+ longlong val_int() override
+ {
+ return 0;
+ }
+ double val_real() override
+ {
+ return 0;
+ }
+ my_decimal *val_decimal(my_decimal *to) override
+ {
+ my_decimal_set_zero(to);
+ return to;
+ }
+ bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override
+ {
+ set_zero_time(ltime, MYSQL_TIMESTAMP_TIME);
+ return false;
+ }
+ bool val_native(THD *thd, Native *to) override
+ {
+ Inet6_null tmp(args[0]);
+ return null_value= tmp.is_null() || tmp.to_native(to);
+ }
+ Item *get_copy(THD *thd) override
+ { return get_item_copy<Item_typecast_inet6>(thd, this); }
+};
+
+
+class Item_cache_inet6: public Item_cache
+{
+ NativeBufferInet6 m_value;
+public:
+ Item_cache_inet6(THD *thd)
+ :Item_cache(thd, &type_handler_inet6)
+ { }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_cache_inet6>(thd, this); }
+ bool cache_value()
+ {
+ if (!example)
+ return false;
+ value_cached= true;
+ null_value= example->val_native_with_conversion_result(current_thd,
+ &m_value,
+ type_handler());
+ return true;
+ }
+ String* val_str(String *to)
+ {
+ if (!has_value())
+ return NULL;
+ Inet6_null tmp(m_value.ptr(), m_value.length());
+ return tmp.is_null() || tmp.to_string(to) ? NULL : to;
+ }
+ my_decimal *val_decimal(my_decimal *to)
+ {
+ if (!has_value())
+ return NULL;
+ my_decimal_set_zero(to);
+ return to;
+ }
+ longlong val_int()
+ {
+ if (!has_value())
+ return 0;
+ return 0;
+ }
+ double val_real()
+ {
+ if (!has_value())
+ return 0;
+ return 0;
+ }
+ longlong val_datetime_packed(THD *thd)
+ {
+ DBUG_ASSERT(0);
+ if (!has_value())
+ return 0;
+ return 0;
+ }
+ longlong val_time_packed(THD *thd)
+ {
+ DBUG_ASSERT(0);
+ if (!has_value())
+ return 0;
+ return 0;
+ }
+ bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)
+ {
+ if (!has_value())
+ return true;
+ set_zero_time(ltime, MYSQL_TIMESTAMP_TIME);
+ return false;
+ }
+ bool val_native(THD *thd, Native *to)
+ {
+ if (!has_value())
+ return true;
+ return to->copy(m_value.ptr(), m_value.length());
+ }
+};
+
+
+class Item_literal_inet6: public Item_literal
+{
+ Inet6 m_value;
+public:
+ Item_literal_inet6(THD *thd)
+ :Item_literal(thd),
+ m_value(Inet6_zero())
+ { }
+ Item_literal_inet6(THD *thd, const Inet6 &value)
+ :Item_literal(thd),
+ m_value(value)
+ { }
+ const Type_handler *type_handler() const override
+ {
+ return &type_handler_inet6;
+ }
+ longlong val_int() override
+ {
+ return 0;
+ }
+ double val_real() override
+ {
+ return 0;
+ }
+ String *val_str(String *to) override
+ {
+ return m_value.to_string(to) ? NULL : to;
+ }
+ my_decimal *val_decimal(my_decimal *to) override
+ {
+ my_decimal_set_zero(to);
+ return to;
+ }
+ bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override
+ {
+ set_zero_time(ltime, MYSQL_TIMESTAMP_TIME);
+ return false;
+ }
+ bool val_native(THD *thd, Native *to) override
+ {
+ return m_value.to_native(to);
+ }
+ void print(String *str, enum_query_type query_type) override
+ {
+ StringBufferInet6 tmp;
+ m_value.to_string(&tmp);
+ str->append("INET6'");
+ str->append(tmp);
+ str->append('\'');
+ }
+ Item *get_copy(THD *thd) override
+ { return get_item_copy<Item_literal_inet6>(thd, this); }
+
+ // Non-overriding methods
+ void set_value(const Inet6 &value)
+ {
+ m_value= value;
+ }
+};
+
+
+class in_inet6 :public in_vector
+{
+ Inet6 m_value;
+ static int cmp_inet6(void *cmp_arg, Inet6 *a, Inet6 *b)
+ {
+ return a->cmp(*b);
+ }
+public:
+ in_inet6(THD *thd, uint elements)
+ :in_vector(thd, elements, sizeof(Inet6), (qsort2_cmp) cmp_inet6, 0),
+ m_value(Inet6_zero())
+ { }
+ const Type_handler *type_handler() const override
+ {
+ return &type_handler_inet6;
+ }
+ void set(uint pos, Item *item) override
+ {
+ Inet6 *buff= &((Inet6 *) base)[pos];
+ Inet6_null value(item);
+ if (value.is_null())
+ *buff= Inet6_zero();
+ else
+ *buff= value;
+ }
+ uchar *get_value(Item *item) override
+ {
+ Inet6_null value(item);
+ if (value.is_null())
+ return 0;
+ m_value= value;
+ return (uchar *) &m_value;
+ }
+ Item* create_item(THD *thd) override
+ {
+ return new (thd->mem_root) Item_literal_inet6(thd);
+ }
+ void value_to_item(uint pos, Item *item) override
+ {
+ const Inet6 &buff= (((Inet6*) base)[pos]);
+ static_cast<Item_literal_inet6*>(item)->set_value(buff);
+ }
+};
+
+
+class Item_char_typecast_func_handler_inet6_to_binary:
+ public Item_handled_func::Handler_str
+{
+public:
+ const Type_handler *return_type_handler() const override
+ {
+ return &type_handler_string;
+ }
+ const Type_handler *
+ type_handler_for_create_select(const Item_handled_func *item) const
+ {
+ if (item->max_length > MAX_FIELD_VARCHARLENGTH)
+ return Type_handler::blob_type_handler(item->max_length);
+ if (item->max_length > 255)
+ return &type_handler_varchar;
+ return &type_handler_string;
+ }
+ bool fix_length_and_dec(Item_handled_func *xitem) const override
+ {
+ return false;
+ }
+ String *val_str(Item_handled_func *item, String *to) const override
+ {
+ DBUG_ASSERT(dynamic_cast<const Item_char_typecast*>(item));
+ return static_cast<Item_char_typecast*>(item)->
+ val_str_binary_from_native(to);
+ }
+};
+
+
+static Item_char_typecast_func_handler_inet6_to_binary
+ item_char_typecast_func_handler_inet6_to_binary;
+
+
+bool Type_handler_inet6::
+ Item_char_typecast_fix_length_and_dec(Item_char_typecast *item) const
+{
+ if (item->cast_charset() == &my_charset_bin)
+ {
+ item->fix_length_and_dec_native_to_binary(Inet6::binary_length());
+ item->set_func_handler(&item_char_typecast_func_handler_inet6_to_binary);
+ return false;
+ }
+ item->fix_length_and_dec_str();
+ return false;
+}
+
+
+bool
+Type_handler_inet6::character_or_binary_string_to_native(THD *thd,
+ const String *str,
+ Native *to) const
+{
+ if (str->charset() == &my_charset_bin)
+ {
+ // Convert from a binary string
+ if (str->length() != Inet6::binary_length() ||
+ to->copy(str->ptr(), str->length()))
+ {
+ thd->push_warning_wrong_value(Sql_condition::WARN_LEVEL_WARN,
+ name().ptr(),
+ ErrConvString(str).ptr());
+ return true;
+ }
+ return false;
+ }
+ // Convert from a character string
+ Inet6_null tmp(*str);
+ if (tmp.is_null())
+ thd->push_warning_wrong_value(Sql_condition::WARN_LEVEL_WARN,
+ name().ptr(),
+ ErrConvString(str).ptr());
+ return tmp.is_null() || tmp.to_native(to);
+}
+
+
+bool
+Type_handler_inet6::Item_save_in_value(THD *thd,
+ Item *item,
+ st_value *value) const
+{
+ value->m_type= DYN_COL_STRING;
+ String *str= item->val_str(&value->m_string);
+ if (str != &value->m_string && !item->null_value)
+ {
+ // "item" returned a non-NULL value
+ if (Inet6_null(*str).is_null())
+ {
+ /*
+ The value was not-null, but conversion to INET6 failed:
+ SELECT a, DECODE_ORACLE(inet6col, 'garbage', '<NULL>', '::01', '01')
+ FROM t1;
+ */
+ thd->push_warning_wrong_value(Sql_condition::WARN_LEVEL_WARN,
+ name().ptr(),
+ ErrConvString(str).ptr());
+ value->m_type= DYN_COL_NULL;
+ return true;
+ }
+ // "item" returned a non-NULL value, and it was a valid INET6
+ value->m_string.set(str->ptr(), str->length(), str->charset());
+ }
+ return check_null(item, value);
+}
+
+
+void Type_handler_inet6::Item_param_setup_conversion(THD *thd,
+ Item_param *param) const
+{
+ param->setup_conversion_string(thd, thd->variables.character_set_client);
+}
+
+
+void Type_handler_inet6::make_sort_key(uchar *to, Item *item,
+ const SORT_FIELD_ATTR *sort_field,
+ Sort_param *param) const
+{
+ DBUG_ASSERT(item->type_handler() == this);
+ NativeBufferInet6 tmp;
+ item->val_native_result(current_thd, &tmp);
+ if (item->maybe_null)
+ {
+ if (item->null_value)
+ {
+ memset(to, 0, Inet6::binary_length() + 1);
+ return;
+ }
+ *to++= 1;
+ }
+ DBUG_ASSERT(!item->null_value);
+ DBUG_ASSERT(Inet6::binary_length() == tmp.length());
+ DBUG_ASSERT(Inet6::binary_length() == sort_field->length);
+ memcpy(to, tmp.ptr(), tmp.length());
+}
+
+
+void Type_handler_inet6::sortlength(THD *thd,
+ const Type_std_attributes *item,
+ SORT_FIELD_ATTR *attr) const
+{
+ attr->length= Inet6::binary_length();
+ attr->suffix_length= 0;
+}
+
+
+cmp_item *Type_handler_inet6::make_cmp_item(THD *thd, CHARSET_INFO *cs) const
+{
+ return new (thd->mem_root) cmp_item_inet6;
+}
+
+
+
+in_vector *
+Type_handler_inet6::make_in_vector(THD *thd, const Item_func_in *func,
+ uint nargs) const
+{
+ return new (thd->mem_root) in_inet6(thd, nargs);
+}
+
+
+Item *Type_handler_inet6::create_typecast_item(THD *thd, Item *item,
+ const Type_cast_attributes &attr)
+ const
+{
+ return new (thd->mem_root) Item_typecast_inet6(thd, item);
+}
+
+
+Item_cache *Type_handler_inet6::Item_get_cache(THD *thd, const Item *item) const
+{
+ return new (thd->mem_root) Item_cache_inet6(thd);
+}
+
+
+Item *
+Type_handler_inet6::make_const_item_for_comparison(THD *thd,
+ Item *src,
+ const Item *cmp) const
+{
+ Inet6_null tmp(src);
+ if (tmp.is_null())
+ return new (thd->mem_root) Item_null(thd, src->name.str);
+ return new (thd->mem_root) Item_literal_inet6(thd, tmp);
+}
+
+
+Item *Field_inet6::get_equal_const_item(THD *thd, const Context &ctx,
+ Item *const_item)
+{
+ Inet6_null tmp(const_item);
+ if (tmp.is_null())
+ return NULL;
+ return new (thd->mem_root) Item_literal_inet6(thd, tmp);
+}
+
+
+Field *
+Type_handler_inet6::make_table_field_from_def(
+ TABLE_SHARE *share,
+ MEM_ROOT *mem_root,
+ const LEX_CSTRING *name,
+ const Record_addr &addr,
+ const Bit_addr &bit,
+ const Column_definition_attributes *attr,
+ uint32 flags) const
+{
+ return new (mem_root) Field_inet6(name, addr);
+}
+
+
+Field *Type_handler_inet6::make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
+ const Record_addr &addr,
+ const Type_all_attributes &attr,
+ TABLE_SHARE *share) const
+{
+ return new (root) Field_inet6(name, addr);
+}
+
+
+Field *Type_handler_inet6::make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table,
+ uint metadata,
+ const Field *target)
+ const
+{
+ const Record_addr tmp(NULL, Bit_addr(true));
+ return new (table->in_use->mem_root) Field_inet6(&empty_clex_str, tmp);
+}
+
+
+/***************************************************************/
+
+
+class Type_collection_inet: public Type_collection
+{
+ const Type_handler *aggregate_common(const Type_handler *a,
+ const Type_handler *b) const
+ {
+ if (a == b)
+ return a;
+ return NULL;
+ }
+ const Type_handler *aggregate_if_string(const Type_handler *a,
+ const Type_handler *b) const
+ {
+ static const Type_aggregator::Pair agg[]=
+ {
+ {&type_handler_inet6, &type_handler_null, &type_handler_inet6},
+ {&type_handler_inet6, &type_handler_varchar, &type_handler_inet6},
+ {&type_handler_inet6, &type_handler_string, &type_handler_inet6},
+ {&type_handler_inet6, &type_handler_tiny_blob, &type_handler_inet6},
+ {&type_handler_inet6, &type_handler_blob, &type_handler_inet6},
+ {&type_handler_inet6, &type_handler_medium_blob, &type_handler_inet6},
+ {&type_handler_inet6, &type_handler_long_blob, &type_handler_inet6},
+ {&type_handler_inet6, &type_handler_hex_hybrid, &type_handler_inet6},
+ {NULL,NULL,NULL}
+ };
+ return Type_aggregator::find_handler_in_array(agg, a, b, true);
+ }
+public:
+ const Type_handler *aggregate_for_result(const Type_handler *a,
+ const Type_handler *b)
+ const override
+ {
+ const Type_handler *h;
+ if ((h= aggregate_common(a, b)) ||
+ (h= aggregate_if_string(a, b)))
+ return h;
+ return NULL;
+ }
+
+ const Type_handler *aggregate_for_min_max(const Type_handler *a,
+ const Type_handler *b)
+ const override
+ {
+ return aggregate_for_result(a, b);
+ }
+
+ const Type_handler *aggregate_for_comparison(const Type_handler *a,
+ const Type_handler *b)
+ const override
+ {
+ if (const Type_handler *h= aggregate_common(a, b))
+ return h;
+ static const Type_aggregator::Pair agg[]=
+ {
+ {&type_handler_inet6, &type_handler_null, &type_handler_inet6},
+ {&type_handler_inet6, &type_handler_long_blob, &type_handler_inet6},
+ {NULL,NULL,NULL}
+ };
+ return Type_aggregator::find_handler_in_array(agg, a, b, true);
+ }
+
+ const Type_handler *aggregate_for_num_op(const Type_handler *a,
+ const Type_handler *b)
+ const override
+ {
+ return NULL;
+ }
+
+ const Type_handler *handler_by_name(const LEX_CSTRING &name) const override
+ {
+ if (type_handler_inet6.name().eq(name))
+ return &type_handler_inet6;
+ return NULL;
+ }
+};
+
+
+const Type_collection *Type_handler_inet6::type_collection() const
+{
+ static Type_collection_inet type_collection_inet;
+ return &type_collection_inet;
+}
diff --git a/plugin/type_inet/sql_type_inet.h b/plugin/type_inet/sql_type_inet.h
new file mode 100644
index 00000000000..970c3b63a3e
--- /dev/null
+++ b/plugin/type_inet/sql_type_inet.h
@@ -0,0 +1,988 @@
+#ifndef SQL_TYPE_INET_H
+#define SQL_TYPE_INET_H
+/* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2014 MariaDB Foundation
+ Copyright (c) 2019 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-1335 USA */
+
+
+static const size_t IN_ADDR_SIZE= 4;
+static const size_t IN_ADDR_MAX_CHAR_LENGTH= 15;
+
+static const size_t IN6_ADDR_SIZE= 16;
+static const size_t IN6_ADDR_NUM_WORDS= IN6_ADDR_SIZE / 2;
+
+/**
+ Non-abbreviated syntax is 8 groups, up to 4 digits each,
+ plus 7 delimiters between the groups.
+ Abbreviated syntax is even shorter.
+*/
+static const uint IN6_ADDR_MAX_CHAR_LENGTH= 8 * 4 + 7;
+
+
+class NativeBufferInet6: public NativeBuffer<IN6_ADDR_SIZE+1>
+{
+};
+
+class StringBufferInet6: public StringBuffer<IN6_ADDR_MAX_CHAR_LENGTH+1>
+{
+};
+
+/***********************************************************************/
+
+class Inet4
+{
+ char m_buffer[IN_ADDR_SIZE];
+protected:
+ bool ascii_to_ipv4(const char *str, size_t length);
+ bool character_string_to_ipv4(const char *str, size_t str_length,
+ CHARSET_INFO *cs)
+ {
+ if (cs->state & MY_CS_NONASCII)
+ {
+ char tmp[IN_ADDR_MAX_CHAR_LENGTH];
+ String_copier copier;
+ uint length= copier.well_formed_copy(&my_charset_latin1, tmp, sizeof(tmp),
+ cs, str, str_length);
+ return ascii_to_ipv4(tmp, length);
+ }
+ return ascii_to_ipv4(str, str_length);
+ }
+ bool binary_to_ipv4(const char *str, size_t length)
+ {
+ if (length != sizeof(m_buffer))
+ return true;
+ memcpy(m_buffer, str, length);
+ return false;
+ }
+ // Non-initializing constructor
+ Inet4() { }
+public:
+ void to_binary(char *dst, size_t dstsize) const
+ {
+ DBUG_ASSERT(dstsize >= sizeof(m_buffer));
+ memcpy(dst, m_buffer, sizeof(m_buffer));
+ }
+ bool to_binary(String *to) const
+ {
+ return to->copy(m_buffer, sizeof(m_buffer), &my_charset_bin);
+ }
+ size_t to_string(char *dst, size_t dstsize) const;
+ bool to_string(String *to) const
+ {
+ to->set_charset(&my_charset_latin1);
+ if (to->alloc(INET_ADDRSTRLEN))
+ return true;
+ to->length((uint32) to_string((char*) to->ptr(), INET_ADDRSTRLEN));
+ return false;
+ }
+};
+
+
+class Inet4_null: public Inet4, public Null_flag
+{
+public:
+ // Initialize from a text representation
+ Inet4_null(const char *str, size_t length, CHARSET_INFO *cs)
+ :Null_flag(character_string_to_ipv4(str, length, cs))
+ { }
+ Inet4_null(const String &str)
+ :Inet4_null(str.ptr(), str.length(), str.charset())
+ { }
+ // Initialize from a binary representation
+ Inet4_null(const char *str, size_t length)
+ :Null_flag(binary_to_ipv4(str, length))
+ { }
+ Inet4_null(const Binary_string &str)
+ :Inet4_null(str.ptr(), str.length())
+ { }
+public:
+ const Inet4& to_inet4() const
+ {
+ DBUG_ASSERT(!is_null());
+ return *this;
+ }
+ void to_binary(char *dst, size_t dstsize) const
+ {
+ to_inet4().to_binary(dst, dstsize);
+ }
+ bool to_binary(String *to) const
+ {
+ return to_inet4().to_binary(to);
+ }
+ size_t to_string(char *dst, size_t dstsize) const
+ {
+ return to_inet4().to_string(dst, dstsize);
+ }
+ bool to_string(String *to) const
+ {
+ return to_inet4().to_string(to);
+ }
+};
+
+
+class Inet6
+{
+protected:
+ char m_buffer[IN6_ADDR_SIZE];
+ bool make_from_item(Item *item);
+ bool ascii_to_ipv6(const char *str, size_t str_length);
+ bool character_string_to_ipv6(const char *str, size_t str_length,
+ CHARSET_INFO *cs)
+ {
+ if (cs->state & MY_CS_NONASCII)
+ {
+ char tmp[IN6_ADDR_MAX_CHAR_LENGTH];
+ String_copier copier;
+ uint length= copier.well_formed_copy(&my_charset_latin1, tmp, sizeof(tmp),
+ cs, str, str_length);
+ return ascii_to_ipv6(tmp, length);
+ }
+ return ascii_to_ipv6(str, str_length);
+ }
+ bool make_from_character_or_binary_string(const String *str);
+ bool binary_to_ipv6(const char *str, size_t length)
+ {
+ if (length != sizeof(m_buffer))
+ return true;
+ memcpy(m_buffer, str, length);
+ return false;
+ }
+
+ Inet6() { }
+
+public:
+ static uint binary_length() { return IN6_ADDR_SIZE; }
+ /**
+ Non-abbreviated syntax is 8 groups, up to 4 digits each,
+ plus 7 delimiters between the groups.
+ Abbreviated syntax is even shorter.
+ */
+ static uint max_char_length() { return IN6_ADDR_MAX_CHAR_LENGTH; }
+
+ static bool only_zero_bytes(const char *ptr, uint length)
+ {
+ for (uint i= 0 ; i < length; i++)
+ {
+ if (ptr[i] != 0)
+ return false;
+ }
+ return true;
+ }
+
+public:
+
+ Inet6(Item *item, bool *error)
+ {
+ *error= make_from_item(item);
+ }
+ void to_binary(char *str, size_t str_size) const
+ {
+ DBUG_ASSERT(str_size >= sizeof(m_buffer));
+ memcpy(str, m_buffer, sizeof(m_buffer));
+ }
+ bool to_binary(String *to) const
+ {
+ return to->copy(m_buffer, sizeof(m_buffer), &my_charset_bin);
+ }
+ bool to_native(Native *to) const
+ {
+ return to->copy(m_buffer, sizeof(m_buffer));
+ }
+ size_t to_string(char *dst, size_t dstsize) const;
+ bool to_string(String *to) const
+ {
+ to->set_charset(&my_charset_latin1);
+ if (to->alloc(INET6_ADDRSTRLEN))
+ return true;
+ to->length((uint32) to_string((char*) to->ptr(), INET6_ADDRSTRLEN));
+ return false;
+ }
+ bool is_v4compat() const
+ {
+ static_assert(sizeof(in6_addr) == IN6_ADDR_SIZE, "unexpected in6_addr size");
+ return IN6_IS_ADDR_V4COMPAT((struct in6_addr *) m_buffer);
+ }
+ bool is_v4mapped() const
+ {
+ static_assert(sizeof(in6_addr) == IN6_ADDR_SIZE, "unexpected in6_addr size");
+ return IN6_IS_ADDR_V4MAPPED((struct in6_addr *) m_buffer);
+ }
+ int cmp(const char *str, size_t length) const
+ {
+ DBUG_ASSERT(length == sizeof(m_buffer));
+ return memcmp(m_buffer, str, length);
+ }
+ int cmp(const Binary_string &other) const
+ {
+ return cmp(other.ptr(), other.length());
+ }
+ int cmp(const Inet6 &other) const
+ {
+ return memcmp(m_buffer, other.m_buffer, sizeof(m_buffer));
+ }
+};
+
+
+class Inet6_zero: public Inet6
+{
+public:
+ Inet6_zero()
+ {
+ bzero(&m_buffer, sizeof(m_buffer));
+ }
+};
+
+
+class Inet6_null: public Inet6, public Null_flag
+{
+public:
+ // Initialize from a text representation
+ Inet6_null(const char *str, size_t length, CHARSET_INFO *cs)
+ :Null_flag(character_string_to_ipv6(str, length, cs))
+ { }
+ Inet6_null(const String &str)
+ :Inet6_null(str.ptr(), str.length(), str.charset())
+ { }
+ // Initialize from a binary representation
+ Inet6_null(const char *str, size_t length)
+ :Null_flag(binary_to_ipv6(str, length))
+ { }
+ Inet6_null(const Binary_string &str)
+ :Inet6_null(str.ptr(), str.length())
+ { }
+ // Initialize from an Item
+ Inet6_null(Item *item)
+ :Null_flag(make_from_item(item))
+ { }
+public:
+ const Inet6& to_inet6() const
+ {
+ DBUG_ASSERT(!is_null());
+ return *this;
+ }
+ void to_binary(char *str, size_t str_size) const
+ {
+ to_inet6().to_binary(str, str_size);
+ }
+ bool to_binary(String *to) const
+ {
+ return to_inet6().to_binary(to);
+ }
+ size_t to_string(char *dst, size_t dstsize) const
+ {
+ return to_inet6().to_string(dst, dstsize);
+ }
+ bool to_string(String *to) const
+ {
+ return to_inet6().to_string(to);
+ }
+ bool is_v4compat() const
+ {
+ return to_inet6().is_v4compat();
+ }
+ bool is_v4mapped() const
+ {
+ return to_inet6().is_v4mapped();
+ }
+};
+
+
+class Type_std_attributes_inet6: public Type_std_attributes
+{
+public:
+ Type_std_attributes_inet6()
+ :Type_std_attributes(
+ Type_numeric_attributes(Inet6::max_char_length(), 0, true),
+ DTCollation_numeric())
+ { }
+};
+
+
+class Type_handler_inet6: public Type_handler
+{
+ bool character_or_binary_string_to_native(THD *thd, const String *str,
+ Native *to) const;
+public:
+ ~Type_handler_inet6() override {}
+
+ const Name name() const override
+ {
+ static const Name name(STRING_WITH_LEN("inet6"));
+ return name;
+ }
+ const Type_collection *type_collection() const override;
+ const Name &default_value() const override
+ {
+ static Name def(STRING_WITH_LEN("::"));
+ return def;
+ }
+ protocol_send_type_t protocol_send_type() const override
+ {
+ return PROTOCOL_SEND_STRING;
+ }
+
+ enum_field_types field_type() const override
+ {
+ return MYSQL_TYPE_STRING;
+ }
+
+ Item_result result_type() const override
+ {
+ return STRING_RESULT;
+ }
+
+ Item_result cmp_type() const override
+ {
+ return STRING_RESULT;
+ }
+
+ enum_dynamic_column_type dyncol_type(const Type_all_attributes *attr)
+ const override
+ {
+ return DYN_COL_STRING;
+ }
+
+ uint32 max_display_length_for_field(const Conv_source &src) const override
+ {
+ return Inet6::max_char_length();
+ }
+
+ const Type_handler *type_handler_for_comparison() const override
+ {
+ return this;
+ }
+
+ int
+ stored_field_cmp_to_item(THD *thd, Field *field, Item *item) const override
+ {
+ DBUG_ASSERT(field->type_handler() == this);
+ Inet6_null ni(item); // Convert Item to INET6
+ if (ni.is_null())
+ return 0;
+ NativeBufferInet6 tmp;
+ if (field->val_native(&tmp))
+ {
+ DBUG_ASSERT(0);
+ return 0;
+ }
+ return -ni.cmp(tmp);
+ }
+ CHARSET_INFO *charset_for_protocol(const Item *item) const override
+ {
+ return item->collation.collation;
+ }
+
+ bool is_scalar_type() const override { return true; }
+ bool can_return_int() const override { return false; }
+ bool can_return_decimal() const override { return false; }
+ bool can_return_real() const override { return false; }
+ bool can_return_str() const override { return true; }
+ bool can_return_text() const override { return true; }
+ bool can_return_date() const override { return false; }
+ bool can_return_time() const override { return false; }
+ bool convert_to_binary_using_val_native() const override { return true; }
+
+ uint Item_time_precision(THD *thd, Item *item) const override
+ {
+ return 0;
+ }
+ uint Item_datetime_precision(THD *thd, Item *item) const override
+ {
+ return 0;
+ }
+ uint Item_decimal_scale(const Item *item) const override
+ {
+ return 0;
+ }
+ uint Item_decimal_precision(const Item *item) const override
+ {
+ /*
+ This will be needed if we ever allow cast from INET6 to DECIMAL.
+ Decimal precision of INET6 is 39 digits:
+ 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff' =
+ 340282366920938463463374607431768211456 = 39 digits
+ */
+ return 39;
+ }
+
+ /*
+ Returns how many digits a divisor adds into a division result.
+ See Item::divisor_precision_increment() in item.h for more comments.
+ */
+ uint Item_divisor_precision_increment(const Item *) const override
+ {
+ return 0;
+ }
+ /**
+ Makes a temporary table Field to handle numeric aggregate functions,
+ e.g. SUM(DISTINCT expr), AVG(DISTINCT expr), etc.
+ */
+ Field *make_num_distinct_aggregator_field(MEM_ROOT *,
+ const Item *) const override
+ {
+ DBUG_ASSERT(0);
+ return 0;
+ }
+ Field *make_conversion_table_field(MEM_ROOT *root,
+ TABLE *TABLE,
+ uint metadata,
+ const Field *target) const override;
+ // Fix attributes after the parser
+ bool Column_definition_fix_attributes(Column_definition *c) const override
+ {
+ c->length= Inet6::max_char_length();
+ return false;
+ }
+
+ bool Column_definition_prepare_stage1(THD *thd,
+ MEM_ROOT *mem_root,
+ Column_definition *def,
+ handler *file,
+ ulonglong table_flags) const override
+ {
+ def->create_length_to_internal_length_simple();
+ return false;
+ }
+
+ bool Column_definition_redefine_stage1(Column_definition *def,
+ const Column_definition *dup,
+ const handler *file,
+ const Schema_specification_st *schema)
+ const override
+ {
+ def->redefine_stage1_common(dup, file, schema);
+ def->set_compression_method(dup->compression_method());
+ def->create_length_to_internal_length_string();
+ return false;
+ }
+
+ bool Column_definition_prepare_stage2(Column_definition *def,
+ handler *file,
+ ulonglong table_flags) const override
+ {
+ def->pack_flag= FIELDFLAG_BINARY;
+ return false;
+ }
+
+ Field *make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
+ const Record_addr &addr,
+ const Type_all_attributes &attr,
+ TABLE_SHARE *table) const override;
+
+ Field *
+ make_table_field_from_def(TABLE_SHARE *share,
+ MEM_ROOT *mem_root,
+ const LEX_CSTRING *name,
+ const Record_addr &addr,
+ const Bit_addr &bit,
+ const Column_definition_attributes *attr,
+ uint32 flags) const override;
+ void
+ Column_definition_attributes_frm_pack(const Column_definition_attributes *def,
+ uchar *buff) const override
+ {
+ def->frm_pack_basic(buff);
+ def->frm_pack_charset(buff);
+ }
+ bool
+ Column_definition_attributes_frm_unpack(Column_definition_attributes *def,
+ TABLE_SHARE *share,
+ const uchar *buffer,
+ LEX_CUSTRING *gis_options)
+ const override
+ {
+ def->frm_unpack_basic(buffer);
+ return def->frm_unpack_charset(share, buffer);
+ }
+ void make_sort_key(uchar *to, Item *item,
+ const SORT_FIELD_ATTR *sort_field, Sort_param *param)
+ const override;
+ void sortlength(THD *thd,
+ const Type_std_attributes *item,
+ SORT_FIELD_ATTR *attr) const override;
+ uint32 max_display_length(const Item *item) const override
+ {
+ return Inet6::max_char_length();
+ }
+ uint32 calc_pack_length(uint32 length) const override
+ {
+ return Inet6::binary_length();
+ }
+ void Item_update_null_value(Item *item) const override
+ {
+ NativeBufferInet6 tmp;
+ item->val_native(current_thd, &tmp);
+ }
+ bool Item_save_in_value(THD *thd, Item *item, st_value *value) const override;
+ void Item_param_setup_conversion(THD *thd, Item_param *param) const override;
+ void Item_param_set_param_func(Item_param *param,
+ uchar **pos, ulong len) const override
+ {
+ param->set_param_str(pos, len);
+ }
+ bool Item_param_set_from_value(THD *thd,
+ Item_param *param,
+ const Type_all_attributes *attr,
+ const st_value *val) const override
+ {
+ param->unsigned_flag= false;//QQ
+ param->setup_conversion_string(thd, attr->collation.collation);
+ /*
+ Exact value of max_length is not known unless data is converted to
+ charset of connection, so we have to set it later.
+ */
+ return param->set_str(val->m_string.ptr(), val->m_string.length(),
+ attr->collation.collation,
+ attr->collation.collation);
+ }
+ bool Item_param_val_native(THD *thd, Item_param *item, Native *to)
+ const override
+ {
+ StringBufferInet6 buffer;
+ String *str= item->val_str(&buffer);
+ if (!str)
+ return true;
+ Inet6_null tmp(*str);
+ return tmp.is_null() || tmp.to_native(to);
+ }
+ bool Item_send(Item *item, Protocol *p, st_value *buf) const override
+ {
+ return Item_send_str(item, p, buf);
+ }
+ int Item_save_in_field(Item *item, Field *field, bool no_conversions)
+ const override
+ {
+ if (field->type_handler() == this)
+ {
+ NativeBuffer<MAX_FIELD_WIDTH> tmp;
+ bool rc= item->val_native(current_thd, &tmp);
+ if (rc || item->null_value)
+ return set_field_to_null_with_conversions(field, no_conversions);
+ field->set_notnull();
+ return field->store_native(tmp);
+ }
+ return item->save_str_in_field(field, no_conversions);
+ }
+
+ String *print_item_value(THD *thd, Item *item, String *str) const override
+ {
+ StringBufferInet6 buf;
+ String *result= item->val_str(&buf);
+ /*
+ TODO: This should eventually use one of these notations:
+ 1. CAST('::' AS INET6)
+ Problem: CAST is not supported as a NAME_CONST() argument.
+ 2. INET6'::
+ Problem: This syntax is not supported by the parser yet.
+ */
+ return !result ||
+ str->realloc(result->length() + 2) ||
+ str->append(STRING_WITH_LEN("'")) ||
+ str->append(result->ptr(), result->length()) ||
+ str->append(STRING_WITH_LEN("'")) ?
+ NULL :
+ str;
+ }
+
+ /**
+ Check if
+ WHERE expr=value AND expr=const
+ can be rewritten as:
+ WHERE const=value AND expr=const
+
+ "this" is the comparison handler that is used by "target".
+
+ @param target - the predicate expr=value,
+ whose "expr" argument will be replaced to "const".
+ @param target_expr - the target's "expr" which will be replaced to "const".
+ @param target_value - the target's second argument, it will remain unchanged.
+ @param source - the equality predicate expr=const (or expr<=>const)
+ that can be used to rewrite the "target" part
+ (under certain conditions, see the code).
+ @param source_expr - the source's "expr". It should be exactly equal to
+ the target's "expr" to make condition rewrite possible.
+ @param source_const - the source's "const" argument, it will be inserted
+ into "target" instead of "expr".
+ */
+ bool
+ can_change_cond_ref_to_const(Item_bool_func2 *target,
+ Item *target_expr, Item *target_value,
+ Item_bool_func2 *source,
+ Item *source_expr, Item *source_const)
+ const override
+ {
+ /*
+ WHERE COALESCE(inet6_col)='::1' AND COALESCE(inet6_col)=CONCAT(a); -->
+ WHERE COALESCE(inet6_col)='::1' AND '::1'=CONCAT(a);
+ */
+ return target->compare_type_handler() == source->compare_type_handler();
+ }
+ bool
+ subquery_type_allows_materialization(const Item *inner,
+ const Item *outer) const override
+ {
+ /*
+ Example:
+ SELECT * FROM t1 WHERE a IN (SELECT inet6col FROM t1 GROUP BY inet6col);
+ Allow materialization only if the outer column is also INET6.
+ This can be changed for more relaxed rules in the future.
+ */
+ DBUG_ASSERT(inner->type_handler() == this);
+ return outer->type_handler() == this;
+ }
+ /**
+ Make a simple constant replacement item for a constant "src",
+ so the new item can futher be used for comparison with "cmp", e.g.:
+ src = cmp -> replacement = cmp
+
+ "this" is the type handler that is used to compare "src" and "cmp".
+
+ @param thd - current thread, for mem_root
+ @param src - The item that we want to replace. It's a const item,
+ but it can be complex enough to calculate on every row.
+ @param cmp - The src's comparand.
+ @retval - a pointer to the created replacement Item
+ @retval - NULL, if could not create a replacement (e.g. on EOM).
+ NULL is also returned for ROWs, because instead of replacing
+ a Item_row to a new Item_row, Type_handler_row just replaces
+ its elements.
+ */
+ Item *make_const_item_for_comparison(THD *thd,
+ Item *src,
+ const Item *cmp) const override;
+ Item_cache *Item_get_cache(THD *thd, const Item *item) const override;
+
+ Item *create_typecast_item(THD *thd, Item *item,
+ const Type_cast_attributes &attr) const override;
+
+ int cmp_native(const Native &a, const Native &b) const override
+ {
+ DBUG_ASSERT(a.length() == Inet6::binary_length());
+ DBUG_ASSERT(b.length() == Inet6::binary_length());
+ return memcmp(a.ptr(), b.ptr(), Inet6::binary_length());
+ }
+ bool set_comparator_func(Arg_comparator *cmp) const override
+ {
+ return cmp->set_cmp_func_native();
+ }
+ bool Item_const_eq(const Item_const *a, const Item_const *b,
+ bool binary_cmp) const override
+ {
+ return false;//QQ
+ }
+ bool Item_eq_value(THD *thd, const Type_cmp_attributes *attr,
+ Item *a, Item *b) const override
+ {
+ Inet6_null na(a);
+ Inet6_null nb(b);
+ return !na.is_null() && !nb.is_null() && !na.cmp(nb);
+ }
+ bool Item_hybrid_func_fix_attributes(THD *thd,
+ const char *name,
+ Type_handler_hybrid_field_type *h,
+ Type_all_attributes *attr,
+ Item **items,
+ uint nitems) const override
+ {
+ attr->Type_std_attributes::operator=(Type_std_attributes_inet6());
+ h->set_handler(this);
+ return false;
+ }
+ bool Item_func_min_max_fix_attributes(THD *thd,
+ Item_func_min_max *func,
+ Item **items,
+ uint nitems) const override
+ {
+ return Item_hybrid_func_fix_attributes(thd, func->func_name(),
+ func, func, items, nitems);
+
+ }
+ bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *func) const override
+ {
+ func->Type_std_attributes::operator=(Type_std_attributes_inet6());
+ func->set_handler(this);
+ return false;
+ }
+ bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *func) const override
+ {
+ return Item_func_or_sum_illegal_param(func);
+ }
+ bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *func) const override
+ {
+ return Item_func_or_sum_illegal_param(func);
+ }
+ bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *func) const override
+ {
+ return Item_func_or_sum_illegal_param(func);
+ }
+
+ bool Item_val_native_with_conversion(THD *thd, Item *item,
+ Native *to) const override
+ {
+ if (item->type_handler() == this)
+ return item->val_native(thd, to); // No conversion needed
+ StringBufferInet6 buffer;
+ String *str= item->val_str(&buffer);
+ return str ? character_or_binary_string_to_native(thd, str, to) : true;
+ }
+ bool Item_val_native_with_conversion_result(THD *thd, Item *item,
+ Native *to) const override
+ {
+ if (item->type_handler() == this)
+ return item->val_native_result(thd, to); // No conversion needed
+ StringBufferInet6 buffer;
+ String *str= item->str_result(&buffer);
+ return str ? character_or_binary_string_to_native(thd, str, to) : true;
+ }
+
+ bool Item_val_bool(Item *item) const override
+ {
+ NativeBufferInet6 tmp;
+ if (item->val_native(current_thd, &tmp))
+ return false;
+ return !Inet6::only_zero_bytes(tmp.ptr(), tmp.length());
+ }
+ void Item_get_date(THD *thd, Item *item,
+ Temporal::Warn *buff, MYSQL_TIME *ltime,
+ date_mode_t fuzzydate) const override
+ {
+ set_zero_time(ltime, MYSQL_TIMESTAMP_TIME);
+ }
+
+ longlong Item_val_int_signed_typecast(Item *item) const override
+ {
+ DBUG_ASSERT(0);
+ return 0;
+ }
+
+ longlong Item_val_int_unsigned_typecast(Item *item) const override
+ {
+ DBUG_ASSERT(0);
+ return 0;
+ }
+
+ String *Item_func_hex_val_str_ascii(Item_func_hex *item, String *str)
+ const override
+ {
+ NativeBufferInet6 tmp;
+ if ((item->null_value= item->arguments()[0]->val_native(current_thd, &tmp)))
+ return NULL;
+ DBUG_ASSERT(tmp.length() == Inet6::binary_length());
+ if (str->set_hex(tmp.ptr(), tmp.length()))
+ {
+ str->length(0);
+ str->set_charset(item->collation.collation);
+ }
+ return str;
+ }
+
+ String *Item_func_hybrid_field_type_val_str(Item_func_hybrid_field_type *item,
+ String *str) const override
+ {
+ NativeBufferInet6 native;
+ if (item->val_native(current_thd, &native))
+ {
+ DBUG_ASSERT(item->null_value);
+ return NULL;
+ }
+ DBUG_ASSERT(native.length() == Inet6::binary_length());
+ Inet6_null tmp(native.ptr(), native.length());
+ return tmp.is_null() || tmp.to_string(str) ? NULL : str;
+ }
+ double Item_func_hybrid_field_type_val_real(Item_func_hybrid_field_type *)
+ const override
+ {
+ return 0;
+ }
+ longlong Item_func_hybrid_field_type_val_int(Item_func_hybrid_field_type *)
+ const override
+ {
+ return 0;
+ }
+ my_decimal *
+ Item_func_hybrid_field_type_val_decimal(Item_func_hybrid_field_type *,
+ my_decimal *to) const override
+ {
+ my_decimal_set_zero(to);
+ return to;
+ }
+ void Item_func_hybrid_field_type_get_date(THD *,
+ Item_func_hybrid_field_type *,
+ Temporal::Warn *,
+ MYSQL_TIME *to,
+ date_mode_t fuzzydate)
+ const override
+ {
+ set_zero_time(to, MYSQL_TIMESTAMP_TIME);
+ }
+ // WHERE is Item_func_min_max_val_native???
+ String *Item_func_min_max_val_str(Item_func_min_max *func, String *str)
+ const override
+ {
+ Inet6_null tmp(func);
+ return tmp.is_null() || tmp.to_string(str) ? NULL : str;
+ }
+ double Item_func_min_max_val_real(Item_func_min_max *) const override
+ {
+ return 0;
+ }
+ longlong Item_func_min_max_val_int(Item_func_min_max *) const override
+ {
+ return 0;
+ }
+ my_decimal *Item_func_min_max_val_decimal(Item_func_min_max *,
+ my_decimal *to) const override
+ {
+ my_decimal_set_zero(to);
+ return to;
+ }
+ bool Item_func_min_max_get_date(THD *thd, Item_func_min_max*,
+ MYSQL_TIME *to, date_mode_t fuzzydate)
+ const override
+ {
+ set_zero_time(to, MYSQL_TIMESTAMP_TIME);
+ return false;
+ }
+
+ bool
+ Item_func_between_fix_length_and_dec(Item_func_between *func) const override
+ {
+ return false;
+ }
+ longlong Item_func_between_val_int(Item_func_between *func) const override
+ {
+ return func->val_int_cmp_native();
+ }
+
+ cmp_item *make_cmp_item(THD *thd, CHARSET_INFO *cs) const override;
+
+ in_vector *make_in_vector(THD *thd, const Item_func_in *func,
+ uint nargs) const override;
+
+ bool Item_func_in_fix_comparator_compatible_types(THD *thd,
+ Item_func_in *func)
+ const override
+ {
+ if (func->compatible_types_scalar_bisection_possible())
+ {
+ return func->value_list_convert_const_to_int(thd) ||
+ func->fix_for_scalar_comparison_using_bisection(thd);
+ }
+ return
+ func->fix_for_scalar_comparison_using_cmp_items(thd,
+ 1U << (uint) STRING_RESULT);
+ }
+ bool
+ Item_func_round_fix_length_and_dec(Item_func_round *func) const override
+ {
+ return Item_func_or_sum_illegal_param(func);
+ }
+ bool
+ Item_func_int_val_fix_length_and_dec(Item_func_int_val *func) const override
+ {
+ return Item_func_or_sum_illegal_param(func);
+ }
+
+ bool Item_func_abs_fix_length_and_dec(Item_func_abs *func) const override
+ {
+ return Item_func_or_sum_illegal_param(func);
+ }
+
+ bool Item_func_neg_fix_length_and_dec(Item_func_neg *func) const override
+ {
+ return Item_func_or_sum_illegal_param(func);
+ }
+
+ bool
+ Item_func_signed_fix_length_and_dec(Item_func_signed *item) const override
+ {
+ return Item_func_or_sum_illegal_param(item);
+ }
+ bool
+ Item_func_unsigned_fix_length_and_dec(Item_func_unsigned *item) const override
+ {
+ return Item_func_or_sum_illegal_param(item);
+ }
+ bool
+ Item_double_typecast_fix_length_and_dec(Item_double_typecast *item)
+ const override
+ {
+ return Item_func_or_sum_illegal_param(item);
+ }
+ bool
+ Item_float_typecast_fix_length_and_dec(Item_float_typecast *item)
+ const override
+ {
+ return Item_func_or_sum_illegal_param(item);
+ }
+ bool
+ Item_decimal_typecast_fix_length_and_dec(Item_decimal_typecast *item)
+ const override
+ {
+ return Item_func_or_sum_illegal_param(item);
+ }
+ bool
+ Item_char_typecast_fix_length_and_dec(Item_char_typecast *item)
+ const override;
+ bool
+ Item_time_typecast_fix_length_and_dec(Item_time_typecast *item) const override
+ {
+ return Item_func_or_sum_illegal_param(item);
+ }
+ bool
+ Item_date_typecast_fix_length_and_dec(Item_date_typecast *item) const override
+ {
+ return Item_func_or_sum_illegal_param(item);
+ }
+ bool
+ Item_datetime_typecast_fix_length_and_dec(Item_datetime_typecast *item)
+ const override
+ {
+ return Item_func_or_sum_illegal_param(item);
+ }
+ bool
+ Item_func_plus_fix_length_and_dec(Item_func_plus *item) const override
+ {
+ return Item_func_or_sum_illegal_param(item);
+ }
+ bool
+ Item_func_minus_fix_length_and_dec(Item_func_minus *item) const override
+ {
+ return Item_func_or_sum_illegal_param(item);
+ }
+ bool
+ Item_func_mul_fix_length_and_dec(Item_func_mul *item) const override
+ {
+ return Item_func_or_sum_illegal_param(item);
+ }
+ bool
+ Item_func_div_fix_length_and_dec(Item_func_div *item) const override
+ {
+ return Item_func_or_sum_illegal_param(item);
+ }
+ bool
+ Item_func_mod_fix_length_and_dec(Item_func_mod *item) const override
+ {
+ return Item_func_or_sum_illegal_param(item);
+ }
+};
+
+
+extern MYSQL_PLUGIN_IMPORT Type_handler_inet6 type_handler_inet6;
+
+
+#endif /* SQL_TYPE_INET_H */
diff --git a/plugin/type_test/CMakeLists.txt b/plugin/type_test/CMakeLists.txt
new file mode 100644
index 00000000000..b85168d1bd2
--- /dev/null
+++ b/plugin/type_test/CMakeLists.txt
@@ -0,0 +1,17 @@
+# Copyright (c) 2016, 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 Street, Fifth Floor, Boston, MA 02110-1335 USA
+
+MYSQL_ADD_PLUGIN(type_test plugin.cc RECOMPILE_FOR_EMBEDDED
+ MODULE_ONLY COMPONENT Test)
diff --git a/plugin/type_test/mysql-test/type_test/suite.opt b/plugin/type_test/mysql-test/type_test/suite.opt
new file mode 100644
index 00000000000..edf6d838a78
--- /dev/null
+++ b/plugin/type_test/mysql-test/type_test/suite.opt
@@ -0,0 +1 @@
+--plugin-load-add=$TYPE_TEST_SO
diff --git a/plugin/type_test/mysql-test/type_test/suite.pm b/plugin/type_test/mysql-test/type_test/suite.pm
new file mode 100644
index 00000000000..fe38ca57650
--- /dev/null
+++ b/plugin/type_test/mysql-test/type_test/suite.pm
@@ -0,0 +1,10 @@
+package My::Suite::Type_test;
+
+@ISA = qw(My::Suite);
+
+return "No TYPE_TEST plugin" unless $ENV{TYPE_TEST_SO};
+
+sub is_default { 1 }
+
+bless { };
+
diff --git a/plugin/type_test/mysql-test/type_test/type_test_double-debug.result b/plugin/type_test/mysql-test/type_test/type_test_double-debug.result
new file mode 100644
index 00000000000..975decca11e
--- /dev/null
+++ b/plugin/type_test/mysql-test/type_test/type_test_double-debug.result
@@ -0,0 +1,35 @@
+#
+# MDEV-20016 Add MariaDB_DATA_TYPE_PLUGIN
+#
+# Testing that a user-defined handler is resolved by name
+# when opening a FRM file.
+SET @old_debug_dbug=@@debug_dbug;
+SET @@debug_dbug="+d,frm_data_type_info";
+CREATE TABLE t1 (a TEST_DOUBLE);
+Warnings:
+Note 1105 build_frm_image: Field data type info length: 13
+Note 1105 DBUG: [0] name='a' type_info='test_double'
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` test_double DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+Warnings:
+Note 1105 DBUG: [0] name='a' type_info='test_double'
+DROP TABLE t1;
+SET @@debug_dbug=@old_debug_dbug;
+# Testing what happens on failure to resolve a type handler by name
+SET @old_debug_dbug=@@debug_dbug;
+SET @@debug_dbug="+d,frm_data_type_info";
+CREATE TABLE t1 (a TEST_DOUBLE);
+Warnings:
+Note 1105 build_frm_image: Field data type info length: 13
+Note 1105 DBUG: [0] name='a' type_info='test_double'
+FLUSH TABLES;
+SET @@debug_dbug="+d,emulate_handler_by_name_or_error_failure";
+SHOW CREATE TABLE t1;
+ERROR HY000: Unknown data type: 'test_double'
+SELECT * FROM t1;
+ERROR HY000: Unknown data type: 'test_double'
+DROP TABLE t1;
+SET @@debug_dbug=@old_debug_dbug;
diff --git a/plugin/type_test/mysql-test/type_test/type_test_double-debug.test b/plugin/type_test/mysql-test/type_test/type_test_double-debug.test
new file mode 100644
index 00000000000..e275d8222d7
--- /dev/null
+++ b/plugin/type_test/mysql-test/type_test/type_test_double-debug.test
@@ -0,0 +1,32 @@
+--source include/have_debug.inc
+
+--echo #
+--echo # MDEV-20016 Add MariaDB_DATA_TYPE_PLUGIN
+--echo #
+
+--echo # Testing that a user-defined handler is resolved by name
+--echo # when opening a FRM file.
+
+SET @old_debug_dbug=@@debug_dbug;
+SET @@debug_dbug="+d,frm_data_type_info";
+--disable_ps_protocol
+CREATE TABLE t1 (a TEST_DOUBLE);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+--enable_ps_protocol
+SET @@debug_dbug=@old_debug_dbug;
+
+
+--echo # Testing what happens on failure to resolve a type handler by name
+
+SET @old_debug_dbug=@@debug_dbug;
+SET @@debug_dbug="+d,frm_data_type_info";
+CREATE TABLE t1 (a TEST_DOUBLE);
+FLUSH TABLES;
+SET @@debug_dbug="+d,emulate_handler_by_name_or_error_failure";
+--error ER_UNKNOWN_DATA_TYPE
+SHOW CREATE TABLE t1;
+--error ER_UNKNOWN_DATA_TYPE
+SELECT * FROM t1;
+DROP TABLE t1;
+SET @@debug_dbug=@old_debug_dbug;
diff --git a/plugin/type_test/mysql-test/type_test/type_test_double.result b/plugin/type_test/mysql-test/type_test/type_test_double.result
new file mode 100644
index 00000000000..19ebb6cde64
--- /dev/null
+++ b/plugin/type_test/mysql-test/type_test/type_test_double.result
@@ -0,0 +1,704 @@
+#
+# MDEV-20016 Add MariaDB_DATA_TYPE_PLUGIN
+#
+SELECT
+PLUGIN_NAME,
+PLUGIN_VERSION,
+PLUGIN_STATUS,
+PLUGIN_TYPE,
+PLUGIN_AUTHOR,
+PLUGIN_DESCRIPTION,
+PLUGIN_LICENSE,
+PLUGIN_MATURITY,
+PLUGIN_AUTH_VERSION
+FROM INFORMATION_SCHEMA.PLUGINS
+WHERE PLUGIN_TYPE='DATA TYPE'
+ AND PLUGIN_NAME='test_double';
+PLUGIN_NAME test_double
+PLUGIN_VERSION 1.0
+PLUGIN_STATUS ACTIVE
+PLUGIN_TYPE DATA TYPE
+PLUGIN_AUTHOR MariaDB Corporation
+PLUGIN_DESCRIPTION Data type TEST_DOUBLE
+PLUGIN_LICENSE GPL
+PLUGIN_MATURITY Experimental
+PLUGIN_AUTH_VERSION 1.0
+CREATE TABLE t1 (a TEST_DOUBLE);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` test_double DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (a TEST_DOUBLE(4));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` test_double(4,0) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (a TEST_DOUBLE(10));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` test_double(10,0) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (a TEST_DOUBLE(20));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` test_double(20,0) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (a TEST_DOUBLE(4,2));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` test_double(4,2) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (a TEST_DOUBLE(10,5));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` test_double(10,5) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (a TEST_DOUBLE(20,10));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` test_double(20,10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+SELECT CAST('100' AS TEST_DOUBLE) AS cast;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def cast 5 22 3 Y 32896 31 63
+cast
+100
+BEGIN NOT ATOMIC
+DECLARE a TEST_DOUBLE DEFAULT 256;
+SELECT HEX(a), a;
+END;
+$$
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def HEX(a) 253 44 3 Y 0 0 8
+def a a 5 22 3 Y 32768 31 63
+HEX(a) a
+100 256
+CREATE FUNCTION f1(p TEST_DOUBLE) RETURNS TEST_DOUBLE RETURN 1;
+SHOW CREATE FUNCTION f1;
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+f1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f1`(p TEST_DOUBLE) RETURNS test_double
+RETURN 1 latin1 latin1_swedish_ci latin1_swedish_ci
+SELECT f1(10);
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def f1(10) f1(10) 5 22 1 Y 32768 31 63
+f1(10)
+1
+DROP FUNCTION f1;
+CREATE TABLE t1 (a TEST_DOUBLE);
+CREATE TABLE t2 AS SELECT a FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` test_double DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (a TEST_DOUBLE);
+CREATE TABLE t2 AS SELECT COALESCE(a,a) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `COALESCE(a,a)` test_double DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (a TEST_DOUBLE);
+CREATE TABLE t2 AS SELECT LEAST(a,a) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `LEAST(a,a)` test_double DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (a TEST_DOUBLE);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 AS SELECT MIN(a), MAX(a) FROM t1;
+SELECT * FROM t2;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def test t2 t2 MIN(a) MIN(a) 5 22 1 Y 32768 31 63
+def test t2 t2 MAX(a) MAX(a) 5 22 1 Y 32768 31 63
+MIN(a) MAX(a)
+1 2
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `MIN(a)` test_double DEFAULT NULL,
+ `MAX(a)` test_double DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (id INT, a TEST_DOUBLE);
+INSERT INTO t1 VALUES (1,1),(1,2),(2,1),(2,2);
+CREATE TABLE t2 AS SELECT id, MIN(a), MAX(a) FROM t1 GROUP BY id;
+SELECT * FROM t2;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def test t2 t2 id id 3 11 1 Y 32768 0 63
+def test t2 t2 MIN(a) MIN(a) 5 22 1 Y 32768 31 63
+def test t2 t2 MAX(a) MAX(a) 5 22 1 Y 32768 31 63
+id MIN(a) MAX(a)
+1 1 2
+2 1 2
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) DEFAULT NULL,
+ `MIN(a)` test_double DEFAULT NULL,
+ `MAX(a)` test_double DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (a TEST_DOUBLE);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 AS SELECT DISTINCT a FROM t1;
+SELECT * FROM t2;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def test t2 t2 a a 5 22 1 Y 32768 31 63
+a
+1
+2
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` test_double DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (a TEST_DOUBLE);
+INSERT INTO t1 VALUES (1);
+CREATE TABLE t2 AS SELECT (SELECT a FROM t1) AS c1;
+SELECT * FROM t2;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def test t2 t2 c1 c1 5 22 1 Y 32768 31 63
+c1
+1
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` test_double DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (a TEST_DOUBLE);
+CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT a FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` test_double DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+# Testing CREATE..LIKE
+CREATE TABLE t1 (a TEST_DOUBLE);
+CREATE TABLE t2 LIKE t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` test_double DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+# Testing CREATE..SELECT
+CREATE TABLE t1 (a TEST_DOUBLE);
+CREATE TABLE t2 AS SELECT * FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` test_double DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+# Testing ALTER
+CREATE TABLE t1 (a TEST_DOUBLE);
+INSERT INTO t1 VALUES (10),(20);
+SELECT * FROM t1;
+a
+10
+20
+ALTER TABLE t1 MODIFY a INT;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+a
+10
+20
+ALTER TABLE t1 MODIFY a TEST_DOUBLE;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` test_double DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+a
+10
+20
+DROP TABLE t1;
+CREATE TABLE t1 (a TEST_DOUBLE);
+INSERT INTO t1 VALUES (10),(20);
+ALTER TABLE t1 ADD b TEST_DOUBLE DEFAULT 0;
+SELECT * FROM t1;
+a b
+10 0
+20 0
+DROP TABLE t1;
+# Testing metadata views
+CREATE TABLE t1 (a TEST_DOUBLE);
+SELECT
+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,
+EXTRA
+FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test';
+TABLE_CATALOG def
+TABLE_SCHEMA test
+TABLE_NAME t1
+COLUMN_NAME a
+ORDINAL_POSITION 1
+COLUMN_DEFAULT NULL
+IS_NULLABLE YES
+DATA_TYPE test_double
+CHARACTER_MAXIMUM_LENGTH NULL
+CHARACTER_OCTET_LENGTH NULL
+NUMERIC_PRECISION 22
+NUMERIC_SCALE 31
+DATETIME_PRECISION NULL
+CHARACTER_SET_NAME NULL
+COLLATION_NAME NULL
+COLUMN_TYPE test_double
+EXTRA
+SHOW COLUMNS FROM t1;
+Field Type Null Key Default Extra
+a test_double YES NULL
+DROP TABLE t1;
+# Testing indexing
+CREATE TABLE t1 (a TEST_DOUBLE, KEY(a));
+INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7);
+EXPLAIN SELECT * FROM t1 WHERE a=3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 9 const 1 Using index
+DROP TABLE t1;
+# Testing aggregation for result
+CREATE TABLE t1 (a TEST_DOUBLE);
+INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7);
+CREATE TABLE t2 AS SELECT
+COALESCE(a,1) AS c1,
+COALESCE(a,1.0) AS c2,
+COALESCE(a,1e0) AS c3
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` test_double DEFAULT NULL,
+ `c2` test_double DEFAULT NULL,
+ `c3` test_double DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT * FROM t2 ORDER BY c1;
+c1 c2 c3
+0 0 0
+1 1 1
+2 2 2
+3 3 3
+4 4 4
+5 5 5
+6 6 6
+7 7 7
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (
+c TEST_DOUBLE,
+c_tinyint TINYINT,
+c_smallint SMALLINT,
+c_mediumint MEDIUMINT,
+c_int INT,
+c_bigint BIGINT
+);
+CREATE TABLE t2 AS SELECT
+COALESCE(c,c_tinyint),
+COALESCE(c,c_smallint),
+COALESCE(c,c_mediumint),
+COALESCE(c,c_bigint)
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `COALESCE(c,c_tinyint)` test_double DEFAULT NULL,
+ `COALESCE(c,c_smallint)` test_double DEFAULT NULL,
+ `COALESCE(c,c_mediumint)` test_double DEFAULT NULL,
+ `COALESCE(c,c_bigint)` test_double DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (
+c TEST_DOUBLE,
+c_time TIME,
+c_date DATE,
+c_datetime DATETIME,
+c_timestamp TIMESTAMP
+);
+SELECT COALESCE(c, c_time) FROM t1;
+ERROR HY000: Illegal parameter data types test_double and time for operation 'coalesce'
+SELECT COALESCE(c, c_date) FROM t1;
+ERROR HY000: Illegal parameter data types test_double and date for operation 'coalesce'
+SELECT COALESCE(c, c_datetime) FROM t1;
+ERROR HY000: Illegal parameter data types test_double and datetime for operation 'coalesce'
+SELECT COALESCE(c, c_timestamp) FROM t1;
+ERROR HY000: Illegal parameter data types test_double and timestamp for operation 'coalesce'
+DROP TABLE t1;
+CREATE TABLE t1 (
+c TEST_DOUBLE,
+c_char CHAR(32),
+c_varchar VARCHAR(32),
+c_tinytext TINYTEXT,
+c_text TEXT,
+c_mediumtext MEDIUMTEXT,
+c_longtext LONGTEXT
+);
+SELECT COALESCE(c, c_char) FROM t1;
+ERROR HY000: Illegal parameter data types test_double and char for operation 'coalesce'
+SELECT COALESCE(c, c_varchar) FROM t1;
+ERROR HY000: Illegal parameter data types test_double and varchar for operation 'coalesce'
+SELECT COALESCE(c, c_tinytext) FROM t1;
+ERROR HY000: Illegal parameter data types test_double and tinyblob for operation 'coalesce'
+SELECT COALESCE(c, c_text) FROM t1;
+ERROR HY000: Illegal parameter data types test_double and blob for operation 'coalesce'
+SELECT COALESCE(c, c_mediumtext) FROM t1;
+ERROR HY000: Illegal parameter data types test_double and mediumblob for operation 'coalesce'
+SELECT COALESCE(c, c_longtext) FROM t1;
+ERROR HY000: Illegal parameter data types test_double and longblob for operation 'coalesce'
+DROP TABLE t1;
+# Testing aggregation for min/max
+CREATE TABLE t1 (a TEST_DOUBLE);
+INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7);
+CREATE TABLE t2 AS SELECT
+LEAST(a,1) AS c1,
+LEAST(a,1.0) AS c2,
+LEAST(a,1e0) AS c3
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` test_double DEFAULT NULL,
+ `c2` test_double DEFAULT NULL,
+ `c3` test_double DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT * FROM t2 ORDER BY c1;
+c1 c2 c3
+0 0 0
+1 1 1
+1 1 1
+1 1 1
+1 1 1
+1 1 1
+1 1 1
+1 1 1
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (
+c TEST_DOUBLE,
+c_tinyint TINYINT,
+c_smallint SMALLINT,
+c_mediumint MEDIUMINT,
+c_int INT,
+c_bigint BIGINT
+);
+CREATE TABLE t2 AS SELECT
+LEAST(c,c_tinyint),
+LEAST(c,c_smallint),
+LEAST(c,c_mediumint),
+LEAST(c,c_bigint)
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `LEAST(c,c_tinyint)` test_double DEFAULT NULL,
+ `LEAST(c,c_smallint)` test_double DEFAULT NULL,
+ `LEAST(c,c_mediumint)` test_double DEFAULT NULL,
+ `LEAST(c,c_bigint)` test_double DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (
+c TEST_DOUBLE,
+c_time TIME,
+c_date DATE,
+c_datetime DATETIME,
+c_timestamp TIMESTAMP
+);
+SELECT LEAST(c, c_time) FROM t1;
+ERROR HY000: Illegal parameter data types test_double and time for operation 'least'
+SELECT LEAST(c, c_date) FROM t1;
+ERROR HY000: Illegal parameter data types test_double and date for operation 'least'
+SELECT LEAST(c, c_datetime) FROM t1;
+ERROR HY000: Illegal parameter data types test_double and datetime for operation 'least'
+SELECT LEAST(c, c_timestamp) FROM t1;
+ERROR HY000: Illegal parameter data types test_double and timestamp for operation 'least'
+DROP TABLE t1;
+CREATE TABLE t1 (
+c TEST_DOUBLE,
+c_char CHAR(32),
+c_varchar VARCHAR(32),
+c_tinytext TINYTEXT,
+c_text TEXT,
+c_mediumtext MEDIUMTEXT,
+c_longtext LONGTEXT
+);
+SELECT LEAST(c, c_char) FROM t1;
+ERROR HY000: Illegal parameter data types test_double and char for operation 'least'
+SELECT LEAST(c, c_varchar) FROM t1;
+ERROR HY000: Illegal parameter data types test_double and varchar for operation 'least'
+SELECT LEAST(c, c_tinytext) FROM t1;
+ERROR HY000: Illegal parameter data types test_double and tinyblob for operation 'least'
+SELECT LEAST(c, c_text) FROM t1;
+ERROR HY000: Illegal parameter data types test_double and blob for operation 'least'
+SELECT LEAST(c, c_mediumtext) FROM t1;
+ERROR HY000: Illegal parameter data types test_double and mediumblob for operation 'least'
+SELECT LEAST(c, c_longtext) FROM t1;
+ERROR HY000: Illegal parameter data types test_double and longblob for operation 'least'
+DROP TABLE t1;
+# Testing aggregation for numeric operation - plus
+CREATE TABLE t1 (a TEST_DOUBLE);
+INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7);
+CREATE TABLE t2 AS SELECT
+a+1 AS c1,
+a+1.0 AS c2,
+a+1e0 AS c3
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` test_double DEFAULT NULL,
+ `c2` test_double DEFAULT NULL,
+ `c3` test_double DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT * FROM t2 ORDER BY c1;
+c1 c2 c3
+1 1 1
+2 2 2
+3 3 3
+4 4 4
+5 5 5
+6 6 6
+7 7 7
+8 8 8
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (
+c TEST_DOUBLE,
+c_tinyint TINYINT,
+c_smallint SMALLINT,
+c_mediumint MEDIUMINT,
+c_int INT,
+c_bigint BIGINT
+);
+CREATE TABLE t2 AS SELECT
+c + c_tinyint,
+c + c_smallint,
+c + c_mediumint,
+c + c_bigint
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c + c_tinyint` test_double DEFAULT NULL,
+ `c + c_smallint` test_double DEFAULT NULL,
+ `c + c_mediumint` test_double DEFAULT NULL,
+ `c + c_bigint` test_double DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (
+c TEST_DOUBLE,
+c_time TIME,
+c_date DATE,
+c_datetime DATETIME,
+c_timestamp TIMESTAMP
+);
+SELECT c + c_time FROM t1;
+ERROR HY000: Illegal parameter data types test_double and time for operation '+'
+SELECT c + c_date FROM t1;
+ERROR HY000: Illegal parameter data types test_double and date for operation '+'
+SELECT c + c_datetime FROM t1;
+ERROR HY000: Illegal parameter data types test_double and datetime for operation '+'
+SELECT c + c_timestamp FROM t1;
+ERROR HY000: Illegal parameter data types test_double and timestamp for operation '+'
+DROP TABLE t1;
+CREATE TABLE t1 (
+c TEST_DOUBLE,
+c_char CHAR(32),
+c_varchar VARCHAR(32),
+c_tinytext TINYTEXT,
+c_text TEXT,
+c_mediumtext MEDIUMTEXT,
+c_longtext LONGTEXT
+);
+SELECT c + c_char FROM t1;
+ERROR HY000: Illegal parameter data types test_double and char for operation '+'
+SELECT c + c_varchar FROM t1;
+ERROR HY000: Illegal parameter data types test_double and varchar for operation '+'
+SELECT c + c_tinytext FROM t1;
+ERROR HY000: Illegal parameter data types test_double and tinyblob for operation '+'
+SELECT c + c_text FROM t1;
+ERROR HY000: Illegal parameter data types test_double and blob for operation '+'
+SELECT c + c_mediumtext FROM t1;
+ERROR HY000: Illegal parameter data types test_double and mediumblob for operation '+'
+SELECT c + c_longtext FROM t1;
+ERROR HY000: Illegal parameter data types test_double and longblob for operation '+'
+DROP TABLE t1;
+# Testing aggregation for numeric operation - minus
+CREATE TABLE t1 (a TEST_DOUBLE);
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
+CREATE TABLE t2 AS SELECT
+a-1 AS c1,
+a-1.0 AS c2,
+a-1e0 AS c3
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` test_double DEFAULT NULL,
+ `c2` test_double DEFAULT NULL,
+ `c3` test_double DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT * FROM t2 ORDER BY c1;
+c1 c2 c3
+0 0 0
+1 1 1
+2 2 2
+3 3 3
+4 4 4
+5 5 5
+6 6 6
+7 7 7
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (
+c TEST_DOUBLE,
+c_tinyint TINYINT,
+c_smallint SMALLINT,
+c_mediumint MEDIUMINT,
+c_int INT,
+c_bigint BIGINT
+);
+CREATE TABLE t2 AS SELECT
+c - c_tinyint,
+c - c_smallint,
+c - c_mediumint,
+c - c_bigint
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c - c_tinyint` test_double DEFAULT NULL,
+ `c - c_smallint` test_double DEFAULT NULL,
+ `c - c_mediumint` test_double DEFAULT NULL,
+ `c - c_bigint` test_double DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (
+c TEST_DOUBLE,
+c_time TIME,
+c_date DATE,
+c_datetime DATETIME,
+c_timestamp TIMESTAMP
+);
+SELECT c - c_time FROM t1;
+ERROR HY000: Illegal parameter data types test_double and time for operation '-'
+SELECT c - c_date FROM t1;
+ERROR HY000: Illegal parameter data types test_double and date for operation '-'
+SELECT c - c_datetime FROM t1;
+ERROR HY000: Illegal parameter data types test_double and datetime for operation '-'
+SELECT c - c_timestamp FROM t1;
+ERROR HY000: Illegal parameter data types test_double and timestamp for operation '-'
+DROP TABLE t1;
+CREATE TABLE t1 (
+c TEST_DOUBLE,
+c_char CHAR(32),
+c_varchar VARCHAR(32),
+c_tinytext TINYTEXT,
+c_text TEXT,
+c_mediumtext MEDIUMTEXT,
+c_longtext LONGTEXT
+);
+SELECT c - c_char FROM t1;
+ERROR HY000: Illegal parameter data types test_double and char for operation '-'
+SELECT c - c_varchar FROM t1;
+ERROR HY000: Illegal parameter data types test_double and varchar for operation '-'
+SELECT c - c_tinytext FROM t1;
+ERROR HY000: Illegal parameter data types test_double and tinyblob for operation '-'
+SELECT c - c_text FROM t1;
+ERROR HY000: Illegal parameter data types test_double and blob for operation '-'
+SELECT c - c_mediumtext FROM t1;
+ERROR HY000: Illegal parameter data types test_double and mediumblob for operation '-'
+SELECT c - c_longtext FROM t1;
+ERROR HY000: Illegal parameter data types test_double and longblob for operation '-'
+DROP TABLE t1;
+# Testing CAST to other data types
+CREATE TABLE t1 (a TEST_DOUBLE);
+INSERT INTO t1 VALUES (20000102);
+CREATE TABLE t2 AS SELECT
+a,
+CAST(a AS CHAR),
+CAST(a AS DECIMAL),
+CAST(a AS DOUBLE),
+CAST(a AS SIGNED),
+CAST(a AS UNSIGNED),
+CAST(a AS TIME),
+CAST(a AS DATETIME),
+CAST(a AS DATE)
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` test_double DEFAULT NULL,
+ `CAST(a AS CHAR)` varchar(22) DEFAULT NULL,
+ `CAST(a AS DECIMAL)` decimal(10,0) DEFAULT NULL,
+ `CAST(a AS DOUBLE)` double DEFAULT NULL,
+ `CAST(a AS SIGNED)` bigint(20) DEFAULT NULL,
+ `CAST(a AS UNSIGNED)` bigint(20) unsigned DEFAULT NULL,
+ `CAST(a AS TIME)` time DEFAULT NULL,
+ `CAST(a AS DATETIME)` datetime DEFAULT NULL,
+ `CAST(a AS DATE)` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT * FROM t2;
+a 20000102
+CAST(a AS CHAR) 20000102
+CAST(a AS DECIMAL) 20000102
+CAST(a AS DOUBLE) 20000102
+CAST(a AS SIGNED) 20000102
+CAST(a AS UNSIGNED) 20000102
+CAST(a AS TIME) 00:00:00
+CAST(a AS DATETIME) 2000-01-02 00:00:00
+CAST(a AS DATE) 2000-01-02
+DROP TABLE t2;
+DROP TABLE t1;
diff --git a/plugin/type_test/mysql-test/type_test/type_test_double.test b/plugin/type_test/mysql-test/type_test/type_test_double.test
new file mode 100644
index 00000000000..993eab95af7
--- /dev/null
+++ b/plugin/type_test/mysql-test/type_test/type_test_double.test
@@ -0,0 +1,530 @@
+--echo #
+--echo # MDEV-20016 Add MariaDB_DATA_TYPE_PLUGIN
+--echo #
+
+--vertical_results
+SELECT
+ PLUGIN_NAME,
+ PLUGIN_VERSION,
+ PLUGIN_STATUS,
+ PLUGIN_TYPE,
+ PLUGIN_AUTHOR,
+ PLUGIN_DESCRIPTION,
+ PLUGIN_LICENSE,
+ PLUGIN_MATURITY,
+ PLUGIN_AUTH_VERSION
+FROM INFORMATION_SCHEMA.PLUGINS
+ WHERE PLUGIN_TYPE='DATA TYPE'
+ AND PLUGIN_NAME='test_double';
+--horizontal_results
+
+CREATE TABLE t1 (a TEST_DOUBLE);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TEST_DOUBLE(4));
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TEST_DOUBLE(10));
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TEST_DOUBLE(20));
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (a TEST_DOUBLE(4,2));
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TEST_DOUBLE(10,5));
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TEST_DOUBLE(20,10));
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+
+--disable_ps_protocol
+--enable_metadata
+SELECT CAST('100' AS TEST_DOUBLE) AS cast;
+--disable_metadata
+--enable_ps_protocol
+
+--disable_ps_protocol
+--enable_metadata
+DELIMITER $$;
+BEGIN NOT ATOMIC
+ DECLARE a TEST_DOUBLE DEFAULT 256;
+ SELECT HEX(a), a;
+END;
+$$
+DELIMITER ;$$
+--disable_metadata
+--enable_ps_protocol
+
+CREATE FUNCTION f1(p TEST_DOUBLE) RETURNS TEST_DOUBLE RETURN 1;
+SHOW CREATE FUNCTION f1;
+--disable_ps_protocol
+--enable_metadata
+SELECT f1(10);
+--disable_metadata
+--enable_ps_protocol
+DROP FUNCTION f1;
+
+CREATE TABLE t1 (a TEST_DOUBLE);
+CREATE TABLE t2 AS SELECT a FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TEST_DOUBLE);
+CREATE TABLE t2 AS SELECT COALESCE(a,a) FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TEST_DOUBLE);
+CREATE TABLE t2 AS SELECT LEAST(a,a) FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TEST_DOUBLE);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 AS SELECT MIN(a), MAX(a) FROM t1;
+--disable_ps_protocol
+--enable_metadata
+SELECT * FROM t2;
+--disable_metadata
+--enable_ps_protocol
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+DROP TABLE t1;
+
+CREATE TABLE t1 (id INT, a TEST_DOUBLE);
+INSERT INTO t1 VALUES (1,1),(1,2),(2,1),(2,2);
+CREATE TABLE t2 AS SELECT id, MIN(a), MAX(a) FROM t1 GROUP BY id;
+--disable_ps_protocol
+--enable_metadata
+SELECT * FROM t2;
+--disable_metadata
+--enable_ps_protocol
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TEST_DOUBLE);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 AS SELECT DISTINCT a FROM t1;
+--disable_ps_protocol
+--enable_metadata
+SELECT * FROM t2;
+--disable_metadata
+--enable_ps_protocol
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TEST_DOUBLE);
+INSERT INTO t1 VALUES (1);
+CREATE TABLE t2 AS SELECT (SELECT a FROM t1) AS c1;
+--disable_ps_protocol
+--enable_metadata
+SELECT * FROM t2;
+--disable_metadata
+--enable_ps_protocol
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TEST_DOUBLE);
+CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT a FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+DROP TABLE t1;
+
+--echo # Testing CREATE..LIKE
+
+CREATE TABLE t1 (a TEST_DOUBLE);
+CREATE TABLE t2 LIKE t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+DROP TABLE t1;
+
+--echo # Testing CREATE..SELECT
+
+CREATE TABLE t1 (a TEST_DOUBLE);
+CREATE TABLE t2 AS SELECT * FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+DROP TABLE t1;
+
+
+--echo # Testing ALTER
+
+CREATE TABLE t1 (a TEST_DOUBLE);
+INSERT INTO t1 VALUES (10),(20);
+SELECT * FROM t1;
+ALTER TABLE t1 MODIFY a INT;
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+ALTER TABLE t1 MODIFY a TEST_DOUBLE;
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TEST_DOUBLE);
+INSERT INTO t1 VALUES (10),(20);
+ALTER TABLE t1 ADD b TEST_DOUBLE DEFAULT 0;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+--echo # Testing metadata views
+
+CREATE TABLE t1 (a TEST_DOUBLE);
+--vertical_results
+SELECT
+ 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,
+ EXTRA
+FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test';
+--horizontal_results
+SHOW COLUMNS FROM t1;
+DROP TABLE t1;
+
+
+--echo # Testing indexing
+
+CREATE TABLE t1 (a TEST_DOUBLE, KEY(a));
+INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7);
+EXPLAIN SELECT * FROM t1 WHERE a=3;
+DROP TABLE t1;
+
+--echo # Testing aggregation for result
+
+CREATE TABLE t1 (a TEST_DOUBLE);
+INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7);
+CREATE TABLE t2 AS SELECT
+ COALESCE(a,1) AS c1,
+ COALESCE(a,1.0) AS c2,
+ COALESCE(a,1e0) AS c3
+FROM t1;
+SHOW CREATE TABLE t2;
+SELECT * FROM t2 ORDER BY c1;
+DROP TABLE t2;
+DROP TABLE t1;
+
+CREATE TABLE t1 (
+ c TEST_DOUBLE,
+ c_tinyint TINYINT,
+ c_smallint SMALLINT,
+ c_mediumint MEDIUMINT,
+ c_int INT,
+ c_bigint BIGINT
+);
+CREATE TABLE t2 AS SELECT
+ COALESCE(c,c_tinyint),
+ COALESCE(c,c_smallint),
+ COALESCE(c,c_mediumint),
+ COALESCE(c,c_bigint)
+FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+DROP TABLE t1;
+
+CREATE TABLE t1 (
+ c TEST_DOUBLE,
+ c_time TIME,
+ c_date DATE,
+ c_datetime DATETIME,
+ c_timestamp TIMESTAMP
+);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT COALESCE(c, c_time) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT COALESCE(c, c_date) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT COALESCE(c, c_datetime) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT COALESCE(c, c_timestamp) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (
+ c TEST_DOUBLE,
+ c_char CHAR(32),
+ c_varchar VARCHAR(32),
+ c_tinytext TINYTEXT,
+ c_text TEXT,
+ c_mediumtext MEDIUMTEXT,
+ c_longtext LONGTEXT
+);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT COALESCE(c, c_char) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT COALESCE(c, c_varchar) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT COALESCE(c, c_tinytext) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT COALESCE(c, c_text) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT COALESCE(c, c_mediumtext) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT COALESCE(c, c_longtext) FROM t1;
+DROP TABLE t1;
+
+--echo # Testing aggregation for min/max
+
+CREATE TABLE t1 (a TEST_DOUBLE);
+INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7);
+CREATE TABLE t2 AS SELECT
+ LEAST(a,1) AS c1,
+ LEAST(a,1.0) AS c2,
+ LEAST(a,1e0) AS c3
+FROM t1;
+SHOW CREATE TABLE t2;
+SELECT * FROM t2 ORDER BY c1;
+DROP TABLE t2;
+DROP TABLE t1;
+
+CREATE TABLE t1 (
+ c TEST_DOUBLE,
+ c_tinyint TINYINT,
+ c_smallint SMALLINT,
+ c_mediumint MEDIUMINT,
+ c_int INT,
+ c_bigint BIGINT
+);
+CREATE TABLE t2 AS SELECT
+ LEAST(c,c_tinyint),
+ LEAST(c,c_smallint),
+ LEAST(c,c_mediumint),
+ LEAST(c,c_bigint)
+FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+DROP TABLE t1;
+
+CREATE TABLE t1 (
+ c TEST_DOUBLE,
+ c_time TIME,
+ c_date DATE,
+ c_datetime DATETIME,
+ c_timestamp TIMESTAMP
+);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT LEAST(c, c_time) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT LEAST(c, c_date) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT LEAST(c, c_datetime) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT LEAST(c, c_timestamp) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (
+ c TEST_DOUBLE,
+ c_char CHAR(32),
+ c_varchar VARCHAR(32),
+ c_tinytext TINYTEXT,
+ c_text TEXT,
+ c_mediumtext MEDIUMTEXT,
+ c_longtext LONGTEXT
+);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT LEAST(c, c_char) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT LEAST(c, c_varchar) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT LEAST(c, c_tinytext) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT LEAST(c, c_text) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT LEAST(c, c_mediumtext) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT LEAST(c, c_longtext) FROM t1;
+DROP TABLE t1;
+
+
+--echo # Testing aggregation for numeric operation - plus
+
+CREATE TABLE t1 (a TEST_DOUBLE);
+INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7);
+CREATE TABLE t2 AS SELECT
+ a+1 AS c1,
+ a+1.0 AS c2,
+ a+1e0 AS c3
+FROM t1;
+SHOW CREATE TABLE t2;
+SELECT * FROM t2 ORDER BY c1;
+DROP TABLE t2;
+DROP TABLE t1;
+
+CREATE TABLE t1 (
+ c TEST_DOUBLE,
+ c_tinyint TINYINT,
+ c_smallint SMALLINT,
+ c_mediumint MEDIUMINT,
+ c_int INT,
+ c_bigint BIGINT
+);
+CREATE TABLE t2 AS SELECT
+ c + c_tinyint,
+ c + c_smallint,
+ c + c_mediumint,
+ c + c_bigint
+FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+DROP TABLE t1;
+
+CREATE TABLE t1 (
+ c TEST_DOUBLE,
+ c_time TIME,
+ c_date DATE,
+ c_datetime DATETIME,
+ c_timestamp TIMESTAMP
+);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT c + c_time FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT c + c_date FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT c + c_datetime FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT c + c_timestamp FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (
+ c TEST_DOUBLE,
+ c_char CHAR(32),
+ c_varchar VARCHAR(32),
+ c_tinytext TINYTEXT,
+ c_text TEXT,
+ c_mediumtext MEDIUMTEXT,
+ c_longtext LONGTEXT
+);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT c + c_char FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT c + c_varchar FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT c + c_tinytext FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT c + c_text FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT c + c_mediumtext FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT c + c_longtext FROM t1;
+DROP TABLE t1;
+
+--echo # Testing aggregation for numeric operation - minus
+
+CREATE TABLE t1 (a TEST_DOUBLE);
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
+CREATE TABLE t2 AS SELECT
+ a-1 AS c1,
+ a-1.0 AS c2,
+ a-1e0 AS c3
+FROM t1;
+SHOW CREATE TABLE t2;
+SELECT * FROM t2 ORDER BY c1;
+DROP TABLE t2;
+DROP TABLE t1;
+
+CREATE TABLE t1 (
+ c TEST_DOUBLE,
+ c_tinyint TINYINT,
+ c_smallint SMALLINT,
+ c_mediumint MEDIUMINT,
+ c_int INT,
+ c_bigint BIGINT
+);
+CREATE TABLE t2 AS SELECT
+ c - c_tinyint,
+ c - c_smallint,
+ c - c_mediumint,
+ c - c_bigint
+FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+DROP TABLE t1;
+
+CREATE TABLE t1 (
+ c TEST_DOUBLE,
+ c_time TIME,
+ c_date DATE,
+ c_datetime DATETIME,
+ c_timestamp TIMESTAMP
+);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT c - c_time FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT c - c_date FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT c - c_datetime FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT c - c_timestamp FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (
+ c TEST_DOUBLE,
+ c_char CHAR(32),
+ c_varchar VARCHAR(32),
+ c_tinytext TINYTEXT,
+ c_text TEXT,
+ c_mediumtext MEDIUMTEXT,
+ c_longtext LONGTEXT
+);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT c - c_char FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT c - c_varchar FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT c - c_tinytext FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT c - c_text FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT c - c_mediumtext FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT c - c_longtext FROM t1;
+DROP TABLE t1;
+
+--echo # Testing CAST to other data types
+
+CREATE TABLE t1 (a TEST_DOUBLE);
+INSERT INTO t1 VALUES (20000102);
+CREATE TABLE t2 AS SELECT
+ a,
+ CAST(a AS CHAR),
+ CAST(a AS DECIMAL),
+ CAST(a AS DOUBLE),
+ CAST(a AS SIGNED),
+ CAST(a AS UNSIGNED),
+ CAST(a AS TIME),
+ CAST(a AS DATETIME),
+ CAST(a AS DATE)
+FROM t1;
+SHOW CREATE TABLE t2;
+--vertical_results
+SELECT * FROM t2;
+--horizontal_results
+DROP TABLE t2;
+DROP TABLE t1;
diff --git a/plugin/type_test/mysql-test/type_test/type_test_int8-debug.result b/plugin/type_test/mysql-test/type_test/type_test_int8-debug.result
new file mode 100644
index 00000000000..952a63c8476
--- /dev/null
+++ b/plugin/type_test/mysql-test/type_test/type_test_int8-debug.result
@@ -0,0 +1,35 @@
+#
+# MDEV-20016 Add MariaDB_DATA_TYPE_PLUGIN
+#
+# Testing that a user-defined handler is resolved by name
+# when opening a FRM file.
+SET @old_debug_dbug=@@debug_dbug;
+SET @@debug_dbug="+d,frm_data_type_info";
+CREATE TABLE t1 (a TEST_INT8);
+Warnings:
+Note 1105 build_frm_image: Field data type info length: 11
+Note 1105 DBUG: [0] name='a' type_info='test_int8'
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` test_int8(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+Warnings:
+Note 1105 DBUG: [0] name='a' type_info='test_int8'
+DROP TABLE t1;
+SET @@debug_dbug=@old_debug_dbug;
+# Testing what happens on failure to resolve a type handler by name
+SET @old_debug_dbug=@@debug_dbug;
+SET @@debug_dbug="+d,frm_data_type_info";
+CREATE TABLE t1 (a TEST_INT8);
+Warnings:
+Note 1105 build_frm_image: Field data type info length: 11
+Note 1105 DBUG: [0] name='a' type_info='test_int8'
+FLUSH TABLES;
+SET @@debug_dbug="+d,emulate_handler_by_name_or_error_failure";
+SHOW CREATE TABLE t1;
+ERROR HY000: Unknown data type: 'test_int8'
+SELECT * FROM t1;
+ERROR HY000: Unknown data type: 'test_int8'
+DROP TABLE t1;
+SET @@debug_dbug=@old_debug_dbug;
diff --git a/plugin/type_test/mysql-test/type_test/type_test_int8-debug.test b/plugin/type_test/mysql-test/type_test/type_test_int8-debug.test
new file mode 100644
index 00000000000..131a500ba29
--- /dev/null
+++ b/plugin/type_test/mysql-test/type_test/type_test_int8-debug.test
@@ -0,0 +1,32 @@
+--source include/have_debug.inc
+
+--echo #
+--echo # MDEV-20016 Add MariaDB_DATA_TYPE_PLUGIN
+--echo #
+
+--echo # Testing that a user-defined handler is resolved by name
+--echo # when opening a FRM file.
+
+SET @old_debug_dbug=@@debug_dbug;
+SET @@debug_dbug="+d,frm_data_type_info";
+--disable_ps_protocol
+CREATE TABLE t1 (a TEST_INT8);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+--enable_ps_protocol
+SET @@debug_dbug=@old_debug_dbug;
+
+
+--echo # Testing what happens on failure to resolve a type handler by name
+
+SET @old_debug_dbug=@@debug_dbug;
+SET @@debug_dbug="+d,frm_data_type_info";
+CREATE TABLE t1 (a TEST_INT8);
+FLUSH TABLES;
+SET @@debug_dbug="+d,emulate_handler_by_name_or_error_failure";
+--error ER_UNKNOWN_DATA_TYPE
+SHOW CREATE TABLE t1;
+--error ER_UNKNOWN_DATA_TYPE
+SELECT * FROM t1;
+DROP TABLE t1;
+SET @@debug_dbug=@old_debug_dbug;
diff --git a/plugin/type_test/mysql-test/type_test/type_test_int8.result b/plugin/type_test/mysql-test/type_test/type_test_int8.result
new file mode 100644
index 00000000000..f18c990cf3b
--- /dev/null
+++ b/plugin/type_test/mysql-test/type_test/type_test_int8.result
@@ -0,0 +1,683 @@
+#
+# MDEV-20016 Add MariaDB_DATA_TYPE_PLUGIN
+#
+SELECT
+PLUGIN_NAME,
+PLUGIN_VERSION,
+PLUGIN_STATUS,
+PLUGIN_TYPE,
+PLUGIN_AUTHOR,
+PLUGIN_DESCRIPTION,
+PLUGIN_LICENSE,
+PLUGIN_MATURITY,
+PLUGIN_AUTH_VERSION
+FROM INFORMATION_SCHEMA.PLUGINS
+WHERE PLUGIN_TYPE='DATA TYPE'
+ AND PLUGIN_NAME='test_int8';
+PLUGIN_NAME test_int8
+PLUGIN_VERSION 1.0
+PLUGIN_STATUS ACTIVE
+PLUGIN_TYPE DATA TYPE
+PLUGIN_AUTHOR MariaDB Corporation
+PLUGIN_DESCRIPTION Data type TEST_INT8
+PLUGIN_LICENSE GPL
+PLUGIN_MATURITY Experimental
+PLUGIN_AUTH_VERSION 1.0
+CREATE TABLE t1 (a TEST_INT8);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` test_int8(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (a TEST_INT8(4));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` test_int8(4) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (a TEST_INT8(10));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` test_int8(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (a TEST_INT8(20));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` test_int8(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+SELECT CAST('100' AS TEST_INT8) AS cast;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def cast 3 3 3 N 32897 0 63
+cast
+100
+BEGIN NOT ATOMIC
+DECLARE a TEST_INT8 DEFAULT 256;
+SELECT HEX(a), a;
+END;
+$$
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def HEX(a) 253 40 3 Y 0 0 8
+def a a 8 20 3 Y 32768 0 63
+HEX(a) a
+100 256
+CREATE FUNCTION f1(p TEST_INT8) RETURNS TEST_INT8 RETURN 1;
+SHOW CREATE FUNCTION f1;
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+f1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f1`(p TEST_INT8) RETURNS test_int8(20)
+RETURN 1 latin1 latin1_swedish_ci latin1_swedish_ci
+SELECT f1(10);
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def f1(10) f1(10) 8 20 1 Y 32768 0 63
+f1(10)
+1
+DROP FUNCTION f1;
+CREATE TABLE t1 (a TEST_INT8);
+CREATE TABLE t2 AS SELECT a FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` test_int8(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (a TEST_INT8);
+CREATE TABLE t2 AS SELECT COALESCE(a,a) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `COALESCE(a,a)` test_int8(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (a TEST_INT8);
+CREATE TABLE t2 AS SELECT LEAST(a,a) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `LEAST(a,a)` test_int8(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (a TEST_INT8);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 AS SELECT MIN(a), MAX(a) FROM t1;
+SELECT * FROM t2;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def test t2 t2 MIN(a) MIN(a) 8 20 1 Y 32768 0 63
+def test t2 t2 MAX(a) MAX(a) 8 20 1 Y 32768 0 63
+MIN(a) MAX(a)
+1 2
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `MIN(a)` test_int8(20) DEFAULT NULL,
+ `MAX(a)` test_int8(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (id INT, a TEST_INT8);
+INSERT INTO t1 VALUES (1,1),(1,2),(2,1),(2,2);
+CREATE TABLE t2 AS SELECT id, MIN(a), MAX(a) FROM t1 GROUP BY id;
+SELECT * FROM t2;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def test t2 t2 id id 3 11 1 Y 32768 0 63
+def test t2 t2 MIN(a) MIN(a) 8 20 1 Y 32768 0 63
+def test t2 t2 MAX(a) MAX(a) 8 20 1 Y 32768 0 63
+id MIN(a) MAX(a)
+1 1 2
+2 1 2
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) DEFAULT NULL,
+ `MIN(a)` test_int8(20) DEFAULT NULL,
+ `MAX(a)` test_int8(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (a TEST_INT8);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 AS SELECT DISTINCT a FROM t1;
+SELECT * FROM t2;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def test t2 t2 a a 8 20 1 Y 32768 0 63
+a
+1
+2
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` test_int8(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (a TEST_INT8);
+INSERT INTO t1 VALUES (1);
+CREATE TABLE t2 AS SELECT (SELECT a FROM t1) AS c1;
+SELECT * FROM t2;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def test t2 t2 c1 c1 8 20 1 Y 32768 0 63
+c1
+1
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` test_int8(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (a TEST_INT8);
+CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT a FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` test_int8(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+# Testing CREATE..LIKE
+CREATE TABLE t1 (a TEST_INT8);
+CREATE TABLE t2 LIKE t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` test_int8(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+# Testing CREATE..SELECT
+CREATE TABLE t1 (a TEST_INT8);
+CREATE TABLE t2 AS SELECT * FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` test_int8(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+# Testing ALTER
+CREATE TABLE t1 (a TEST_INT8);
+INSERT INTO t1 VALUES (10),(20);
+SELECT * FROM t1;
+a
+10
+20
+ALTER TABLE t1 MODIFY a INT;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+a
+10
+20
+ALTER TABLE t1 MODIFY a TEST_INT8;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` test_int8(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+a
+10
+20
+DROP TABLE t1;
+CREATE TABLE t1 (a TEST_INT8);
+INSERT INTO t1 VALUES (10),(20);
+ALTER TABLE t1 ADD b TEST_INT8 DEFAULT 0;
+SELECT * FROM t1;
+a b
+10 0
+20 0
+DROP TABLE t1;
+# Testing metadata views
+CREATE TABLE t1 (a TEST_INT8);
+SELECT
+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,
+EXTRA
+FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test';
+TABLE_CATALOG def
+TABLE_SCHEMA test
+TABLE_NAME t1
+COLUMN_NAME a
+ORDINAL_POSITION 1
+COLUMN_DEFAULT NULL
+IS_NULLABLE YES
+DATA_TYPE test_int8
+CHARACTER_MAXIMUM_LENGTH NULL
+CHARACTER_OCTET_LENGTH NULL
+NUMERIC_PRECISION 19
+NUMERIC_SCALE 0
+DATETIME_PRECISION NULL
+CHARACTER_SET_NAME NULL
+COLLATION_NAME NULL
+COLUMN_TYPE test_int8(20)
+EXTRA
+SHOW COLUMNS FROM t1;
+Field Type Null Key Default Extra
+a test_int8(20) YES NULL
+DROP TABLE t1;
+# Testing indexing
+CREATE TABLE t1 (a TEST_INT8, KEY(a));
+INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7);
+EXPLAIN SELECT * FROM t1 WHERE a=3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 9 const 1 Using index
+DROP TABLE t1;
+# Testing aggregation for result
+CREATE TABLE t1 (a TEST_INT8);
+INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7);
+CREATE TABLE t2 AS SELECT
+COALESCE(a,1) AS c1,
+COALESCE(a,1.0) AS c2,
+COALESCE(a,1e0) AS c3
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` test_int8(20) DEFAULT NULL,
+ `c2` decimal(20,1) DEFAULT NULL,
+ `c3` double DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT * FROM t2 ORDER BY c1;
+c1 c2 c3
+0 0.0 0
+1 1.0 1
+2 2.0 2
+3 3.0 3
+4 4.0 4
+5 5.0 5
+6 6.0 6
+7 7.0 7
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (
+c TEST_INT8,
+c_tinyint TINYINT,
+c_smallint SMALLINT,
+c_mediumint MEDIUMINT,
+c_int INT,
+c_bigint BIGINT
+);
+CREATE TABLE t2 AS SELECT
+COALESCE(c,c_tinyint),
+COALESCE(c,c_smallint),
+COALESCE(c,c_mediumint),
+COALESCE(c,c_bigint)
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `COALESCE(c,c_tinyint)` test_int8(20) DEFAULT NULL,
+ `COALESCE(c,c_smallint)` test_int8(20) DEFAULT NULL,
+ `COALESCE(c,c_mediumint)` test_int8(20) DEFAULT NULL,
+ `COALESCE(c,c_bigint)` test_int8(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (
+c TEST_INT8,
+c_time TIME,
+c_date DATE,
+c_datetime DATETIME,
+c_timestamp TIMESTAMP
+);
+SELECT COALESCE(c, c_time) FROM t1;
+ERROR HY000: Illegal parameter data types test_int8 and time for operation 'coalesce'
+SELECT COALESCE(c, c_date) FROM t1;
+ERROR HY000: Illegal parameter data types test_int8 and date for operation 'coalesce'
+SELECT COALESCE(c, c_datetime) FROM t1;
+ERROR HY000: Illegal parameter data types test_int8 and datetime for operation 'coalesce'
+SELECT COALESCE(c, c_timestamp) FROM t1;
+ERROR HY000: Illegal parameter data types test_int8 and timestamp for operation 'coalesce'
+DROP TABLE t1;
+CREATE TABLE t1 (
+c TEST_INT8,
+c_char CHAR(32),
+c_varchar VARCHAR(32),
+c_tinytext TINYTEXT,
+c_text TEXT,
+c_mediumtext MEDIUMTEXT,
+c_longtext LONGTEXT
+);
+SELECT COALESCE(c, c_char) FROM t1;
+ERROR HY000: Illegal parameter data types test_int8 and char for operation 'coalesce'
+SELECT COALESCE(c, c_varchar) FROM t1;
+ERROR HY000: Illegal parameter data types test_int8 and varchar for operation 'coalesce'
+SELECT COALESCE(c, c_tinytext) FROM t1;
+ERROR HY000: Illegal parameter data types test_int8 and tinyblob for operation 'coalesce'
+SELECT COALESCE(c, c_text) FROM t1;
+ERROR HY000: Illegal parameter data types test_int8 and blob for operation 'coalesce'
+SELECT COALESCE(c, c_mediumtext) FROM t1;
+ERROR HY000: Illegal parameter data types test_int8 and mediumblob for operation 'coalesce'
+SELECT COALESCE(c, c_longtext) FROM t1;
+ERROR HY000: Illegal parameter data types test_int8 and longblob for operation 'coalesce'
+DROP TABLE t1;
+# Testing aggregation for min/max
+CREATE TABLE t1 (a TEST_INT8);
+INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7);
+CREATE TABLE t2 AS SELECT
+LEAST(a,1) AS c1,
+LEAST(a,1.0) AS c2,
+LEAST(a,1e0) AS c3
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` test_int8(20) DEFAULT NULL,
+ `c2` decimal(20,1) DEFAULT NULL,
+ `c3` double DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT * FROM t2 ORDER BY c1;
+c1 c2 c3
+0 0.0 0
+1 1.0 1
+1 1.0 1
+1 1.0 1
+1 1.0 1
+1 1.0 1
+1 1.0 1
+1 1.0 1
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (
+c TEST_INT8,
+c_tinyint TINYINT,
+c_smallint SMALLINT,
+c_mediumint MEDIUMINT,
+c_int INT,
+c_bigint BIGINT
+);
+CREATE TABLE t2 AS SELECT
+LEAST(c,c_tinyint),
+LEAST(c,c_smallint),
+LEAST(c,c_mediumint),
+LEAST(c,c_bigint)
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `LEAST(c,c_tinyint)` test_int8(20) DEFAULT NULL,
+ `LEAST(c,c_smallint)` test_int8(20) DEFAULT NULL,
+ `LEAST(c,c_mediumint)` test_int8(20) DEFAULT NULL,
+ `LEAST(c,c_bigint)` test_int8(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (
+c TEST_INT8,
+c_time TIME,
+c_date DATE,
+c_datetime DATETIME,
+c_timestamp TIMESTAMP
+);
+SELECT LEAST(c, c_time) FROM t1;
+ERROR HY000: Illegal parameter data types test_int8 and time for operation 'least'
+SELECT LEAST(c, c_date) FROM t1;
+ERROR HY000: Illegal parameter data types test_int8 and date for operation 'least'
+SELECT LEAST(c, c_datetime) FROM t1;
+ERROR HY000: Illegal parameter data types test_int8 and datetime for operation 'least'
+SELECT LEAST(c, c_timestamp) FROM t1;
+ERROR HY000: Illegal parameter data types test_int8 and timestamp for operation 'least'
+DROP TABLE t1;
+CREATE TABLE t1 (
+c TEST_INT8,
+c_char CHAR(32),
+c_varchar VARCHAR(32),
+c_tinytext TINYTEXT,
+c_text TEXT,
+c_mediumtext MEDIUMTEXT,
+c_longtext LONGTEXT
+);
+SELECT LEAST(c, c_char) FROM t1;
+ERROR HY000: Illegal parameter data types test_int8 and char for operation 'least'
+SELECT LEAST(c, c_varchar) FROM t1;
+ERROR HY000: Illegal parameter data types test_int8 and varchar for operation 'least'
+SELECT LEAST(c, c_tinytext) FROM t1;
+ERROR HY000: Illegal parameter data types test_int8 and tinyblob for operation 'least'
+SELECT LEAST(c, c_text) FROM t1;
+ERROR HY000: Illegal parameter data types test_int8 and blob for operation 'least'
+SELECT LEAST(c, c_mediumtext) FROM t1;
+ERROR HY000: Illegal parameter data types test_int8 and mediumblob for operation 'least'
+SELECT LEAST(c, c_longtext) FROM t1;
+ERROR HY000: Illegal parameter data types test_int8 and longblob for operation 'least'
+DROP TABLE t1;
+# Testing aggregation for numeric operation - plus
+CREATE TABLE t1 (a TEST_INT8);
+INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7);
+CREATE TABLE t2 AS SELECT
+a+1 AS c1,
+a+1.0 AS c2,
+a+1e0 AS c3
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` bigint(21) DEFAULT NULL,
+ `c2` decimal(21,1) DEFAULT NULL,
+ `c3` double DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT * FROM t2 ORDER BY c1;
+c1 c2 c3
+1 1.0 1
+2 2.0 2
+3 3.0 3
+4 4.0 4
+5 5.0 5
+6 6.0 6
+7 7.0 7
+8 8.0 8
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (
+c TEST_INT8,
+c_tinyint TINYINT,
+c_smallint SMALLINT,
+c_mediumint MEDIUMINT,
+c_int INT,
+c_bigint BIGINT
+);
+CREATE TABLE t2 AS SELECT
+c + c_tinyint,
+c + c_smallint,
+c + c_mediumint,
+c + c_bigint
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c + c_tinyint` bigint(21) DEFAULT NULL,
+ `c + c_smallint` bigint(21) DEFAULT NULL,
+ `c + c_mediumint` bigint(21) DEFAULT NULL,
+ `c + c_bigint` bigint(21) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (
+c TEST_INT8,
+c_time TIME,
+c_date DATE,
+c_datetime DATETIME,
+c_timestamp TIMESTAMP
+);
+SELECT c + c_time FROM t1;
+ERROR HY000: Illegal parameter data types test_int8 and time for operation '+'
+SELECT c + c_date FROM t1;
+ERROR HY000: Illegal parameter data types test_int8 and date for operation '+'
+SELECT c + c_datetime FROM t1;
+ERROR HY000: Illegal parameter data types test_int8 and datetime for operation '+'
+SELECT c + c_timestamp FROM t1;
+ERROR HY000: Illegal parameter data types test_int8 and timestamp for operation '+'
+DROP TABLE t1;
+CREATE TABLE t1 (
+c TEST_INT8,
+c_char CHAR(32),
+c_varchar VARCHAR(32),
+c_tinytext TINYTEXT,
+c_text TEXT,
+c_mediumtext MEDIUMTEXT,
+c_longtext LONGTEXT
+);
+SELECT c + c_char FROM t1;
+ERROR HY000: Illegal parameter data types test_int8 and char for operation '+'
+SELECT c + c_varchar FROM t1;
+ERROR HY000: Illegal parameter data types test_int8 and varchar for operation '+'
+SELECT c + c_tinytext FROM t1;
+ERROR HY000: Illegal parameter data types test_int8 and tinyblob for operation '+'
+SELECT c + c_text FROM t1;
+ERROR HY000: Illegal parameter data types test_int8 and blob for operation '+'
+SELECT c + c_mediumtext FROM t1;
+ERROR HY000: Illegal parameter data types test_int8 and mediumblob for operation '+'
+SELECT c + c_longtext FROM t1;
+ERROR HY000: Illegal parameter data types test_int8 and longblob for operation '+'
+DROP TABLE t1;
+# Testing aggregation for numeric operation - minus
+CREATE TABLE t1 (a TEST_INT8);
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
+CREATE TABLE t2 AS SELECT
+a-1 AS c1,
+a-1.0 AS c2,
+a-1e0 AS c3
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` bigint(21) DEFAULT NULL,
+ `c2` decimal(21,1) DEFAULT NULL,
+ `c3` double DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT * FROM t2 ORDER BY c1;
+c1 c2 c3
+0 0.0 0
+1 1.0 1
+2 2.0 2
+3 3.0 3
+4 4.0 4
+5 5.0 5
+6 6.0 6
+7 7.0 7
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (
+c TEST_INT8,
+c_tinyint TINYINT,
+c_smallint SMALLINT,
+c_mediumint MEDIUMINT,
+c_int INT,
+c_bigint BIGINT
+);
+CREATE TABLE t2 AS SELECT
+c - c_tinyint,
+c - c_smallint,
+c - c_mediumint,
+c - c_bigint
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c - c_tinyint` bigint(21) DEFAULT NULL,
+ `c - c_smallint` bigint(21) DEFAULT NULL,
+ `c - c_mediumint` bigint(21) DEFAULT NULL,
+ `c - c_bigint` bigint(21) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (
+c TEST_INT8,
+c_time TIME,
+c_date DATE,
+c_datetime DATETIME,
+c_timestamp TIMESTAMP
+);
+SELECT c - c_time FROM t1;
+ERROR HY000: Illegal parameter data types test_int8 and time for operation '-'
+SELECT c - c_date FROM t1;
+ERROR HY000: Illegal parameter data types test_int8 and date for operation '-'
+SELECT c - c_datetime FROM t1;
+ERROR HY000: Illegal parameter data types test_int8 and datetime for operation '-'
+SELECT c - c_timestamp FROM t1;
+ERROR HY000: Illegal parameter data types test_int8 and timestamp for operation '-'
+DROP TABLE t1;
+CREATE TABLE t1 (
+c TEST_INT8,
+c_char CHAR(32),
+c_varchar VARCHAR(32),
+c_tinytext TINYTEXT,
+c_text TEXT,
+c_mediumtext MEDIUMTEXT,
+c_longtext LONGTEXT
+);
+SELECT c - c_char FROM t1;
+ERROR HY000: Illegal parameter data types test_int8 and char for operation '-'
+SELECT c - c_varchar FROM t1;
+ERROR HY000: Illegal parameter data types test_int8 and varchar for operation '-'
+SELECT c - c_tinytext FROM t1;
+ERROR HY000: Illegal parameter data types test_int8 and tinyblob for operation '-'
+SELECT c - c_text FROM t1;
+ERROR HY000: Illegal parameter data types test_int8 and blob for operation '-'
+SELECT c - c_mediumtext FROM t1;
+ERROR HY000: Illegal parameter data types test_int8 and mediumblob for operation '-'
+SELECT c - c_longtext FROM t1;
+ERROR HY000: Illegal parameter data types test_int8 and longblob for operation '-'
+DROP TABLE t1;
+# Testing CAST to other data types
+CREATE TABLE t1 (a TEST_INT8);
+INSERT INTO t1 VALUES (20000102);
+CREATE TABLE t2 AS SELECT
+a,
+CAST(a AS CHAR),
+CAST(a AS DECIMAL),
+CAST(a AS DOUBLE),
+CAST(a AS SIGNED),
+CAST(a AS UNSIGNED),
+CAST(a AS TIME),
+CAST(a AS DATETIME),
+CAST(a AS DATE)
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` test_int8(20) DEFAULT NULL,
+ `CAST(a AS CHAR)` varchar(20) DEFAULT NULL,
+ `CAST(a AS DECIMAL)` decimal(10,0) DEFAULT NULL,
+ `CAST(a AS DOUBLE)` double DEFAULT NULL,
+ `CAST(a AS SIGNED)` bigint(20) DEFAULT NULL,
+ `CAST(a AS UNSIGNED)` bigint(20) unsigned DEFAULT NULL,
+ `CAST(a AS TIME)` time DEFAULT NULL,
+ `CAST(a AS DATETIME)` datetime DEFAULT NULL,
+ `CAST(a AS DATE)` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT * FROM t2;
+a 20000102
+CAST(a AS CHAR) 20000102
+CAST(a AS DECIMAL) 20000102
+CAST(a AS DOUBLE) 20000102
+CAST(a AS SIGNED) 20000102
+CAST(a AS UNSIGNED) 20000102
+CAST(a AS TIME) 00:00:00
+CAST(a AS DATETIME) 2000-01-02 00:00:00
+CAST(a AS DATE) 2000-01-02
+DROP TABLE t2;
+DROP TABLE t1;
diff --git a/plugin/type_test/mysql-test/type_test/type_test_int8.test b/plugin/type_test/mysql-test/type_test/type_test_int8.test
new file mode 100644
index 00000000000..6b5496c30fa
--- /dev/null
+++ b/plugin/type_test/mysql-test/type_test/type_test_int8.test
@@ -0,0 +1,518 @@
+--echo #
+--echo # MDEV-20016 Add MariaDB_DATA_TYPE_PLUGIN
+--echo #
+
+--vertical_results
+SELECT
+ PLUGIN_NAME,
+ PLUGIN_VERSION,
+ PLUGIN_STATUS,
+ PLUGIN_TYPE,
+ PLUGIN_AUTHOR,
+ PLUGIN_DESCRIPTION,
+ PLUGIN_LICENSE,
+ PLUGIN_MATURITY,
+ PLUGIN_AUTH_VERSION
+FROM INFORMATION_SCHEMA.PLUGINS
+ WHERE PLUGIN_TYPE='DATA TYPE'
+ AND PLUGIN_NAME='test_int8';
+--horizontal_results
+
+CREATE TABLE t1 (a TEST_INT8);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TEST_INT8(4));
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TEST_INT8(10));
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TEST_INT8(20));
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+
+--disable_ps_protocol
+--enable_metadata
+SELECT CAST('100' AS TEST_INT8) AS cast;
+--disable_metadata
+--enable_ps_protocol
+
+--disable_ps_protocol
+--enable_metadata
+DELIMITER $$;
+BEGIN NOT ATOMIC
+ DECLARE a TEST_INT8 DEFAULT 256;
+ SELECT HEX(a), a;
+END;
+$$
+DELIMITER ;$$
+--disable_metadata
+--enable_ps_protocol
+
+CREATE FUNCTION f1(p TEST_INT8) RETURNS TEST_INT8 RETURN 1;
+SHOW CREATE FUNCTION f1;
+--disable_ps_protocol
+--enable_metadata
+SELECT f1(10);
+--disable_metadata
+--enable_ps_protocol
+DROP FUNCTION f1;
+
+CREATE TABLE t1 (a TEST_INT8);
+CREATE TABLE t2 AS SELECT a FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TEST_INT8);
+CREATE TABLE t2 AS SELECT COALESCE(a,a) FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TEST_INT8);
+CREATE TABLE t2 AS SELECT LEAST(a,a) FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TEST_INT8);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 AS SELECT MIN(a), MAX(a) FROM t1;
+--disable_ps_protocol
+--enable_metadata
+SELECT * FROM t2;
+--disable_metadata
+--enable_ps_protocol
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+DROP TABLE t1;
+
+CREATE TABLE t1 (id INT, a TEST_INT8);
+INSERT INTO t1 VALUES (1,1),(1,2),(2,1),(2,2);
+CREATE TABLE t2 AS SELECT id, MIN(a), MAX(a) FROM t1 GROUP BY id;
+--disable_ps_protocol
+--enable_metadata
+SELECT * FROM t2;
+--disable_metadata
+--enable_ps_protocol
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TEST_INT8);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 AS SELECT DISTINCT a FROM t1;
+--disable_ps_protocol
+--enable_metadata
+SELECT * FROM t2;
+--disable_metadata
+--enable_ps_protocol
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TEST_INT8);
+INSERT INTO t1 VALUES (1);
+CREATE TABLE t2 AS SELECT (SELECT a FROM t1) AS c1;
+--disable_ps_protocol
+--enable_metadata
+SELECT * FROM t2;
+--disable_metadata
+--enable_ps_protocol
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TEST_INT8);
+CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT a FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+DROP TABLE t1;
+
+--echo # Testing CREATE..LIKE
+
+CREATE TABLE t1 (a TEST_INT8);
+CREATE TABLE t2 LIKE t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+DROP TABLE t1;
+
+--echo # Testing CREATE..SELECT
+
+CREATE TABLE t1 (a TEST_INT8);
+CREATE TABLE t2 AS SELECT * FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+DROP TABLE t1;
+
+
+--echo # Testing ALTER
+
+CREATE TABLE t1 (a TEST_INT8);
+INSERT INTO t1 VALUES (10),(20);
+SELECT * FROM t1;
+ALTER TABLE t1 MODIFY a INT;
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+ALTER TABLE t1 MODIFY a TEST_INT8;
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TEST_INT8);
+INSERT INTO t1 VALUES (10),(20);
+ALTER TABLE t1 ADD b TEST_INT8 DEFAULT 0;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+--echo # Testing metadata views
+
+CREATE TABLE t1 (a TEST_INT8);
+--vertical_results
+SELECT
+ 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,
+ EXTRA
+FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test';
+--horizontal_results
+SHOW COLUMNS FROM t1;
+DROP TABLE t1;
+
+
+--echo # Testing indexing
+
+CREATE TABLE t1 (a TEST_INT8, KEY(a));
+INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7);
+EXPLAIN SELECT * FROM t1 WHERE a=3;
+DROP TABLE t1;
+
+--echo # Testing aggregation for result
+
+CREATE TABLE t1 (a TEST_INT8);
+INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7);
+CREATE TABLE t2 AS SELECT
+ COALESCE(a,1) AS c1,
+ COALESCE(a,1.0) AS c2,
+ COALESCE(a,1e0) AS c3
+FROM t1;
+SHOW CREATE TABLE t2;
+SELECT * FROM t2 ORDER BY c1;
+DROP TABLE t2;
+DROP TABLE t1;
+
+CREATE TABLE t1 (
+ c TEST_INT8,
+ c_tinyint TINYINT,
+ c_smallint SMALLINT,
+ c_mediumint MEDIUMINT,
+ c_int INT,
+ c_bigint BIGINT
+);
+CREATE TABLE t2 AS SELECT
+ COALESCE(c,c_tinyint),
+ COALESCE(c,c_smallint),
+ COALESCE(c,c_mediumint),
+ COALESCE(c,c_bigint)
+FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+DROP TABLE t1;
+
+CREATE TABLE t1 (
+ c TEST_INT8,
+ c_time TIME,
+ c_date DATE,
+ c_datetime DATETIME,
+ c_timestamp TIMESTAMP
+);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT COALESCE(c, c_time) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT COALESCE(c, c_date) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT COALESCE(c, c_datetime) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT COALESCE(c, c_timestamp) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (
+ c TEST_INT8,
+ c_char CHAR(32),
+ c_varchar VARCHAR(32),
+ c_tinytext TINYTEXT,
+ c_text TEXT,
+ c_mediumtext MEDIUMTEXT,
+ c_longtext LONGTEXT
+);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT COALESCE(c, c_char) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT COALESCE(c, c_varchar) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT COALESCE(c, c_tinytext) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT COALESCE(c, c_text) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT COALESCE(c, c_mediumtext) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT COALESCE(c, c_longtext) FROM t1;
+DROP TABLE t1;
+
+--echo # Testing aggregation for min/max
+
+CREATE TABLE t1 (a TEST_INT8);
+INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7);
+CREATE TABLE t2 AS SELECT
+ LEAST(a,1) AS c1,
+ LEAST(a,1.0) AS c2,
+ LEAST(a,1e0) AS c3
+FROM t1;
+SHOW CREATE TABLE t2;
+SELECT * FROM t2 ORDER BY c1;
+DROP TABLE t2;
+DROP TABLE t1;
+
+CREATE TABLE t1 (
+ c TEST_INT8,
+ c_tinyint TINYINT,
+ c_smallint SMALLINT,
+ c_mediumint MEDIUMINT,
+ c_int INT,
+ c_bigint BIGINT
+);
+CREATE TABLE t2 AS SELECT
+ LEAST(c,c_tinyint),
+ LEAST(c,c_smallint),
+ LEAST(c,c_mediumint),
+ LEAST(c,c_bigint)
+FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+DROP TABLE t1;
+
+CREATE TABLE t1 (
+ c TEST_INT8,
+ c_time TIME,
+ c_date DATE,
+ c_datetime DATETIME,
+ c_timestamp TIMESTAMP
+);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT LEAST(c, c_time) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT LEAST(c, c_date) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT LEAST(c, c_datetime) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT LEAST(c, c_timestamp) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (
+ c TEST_INT8,
+ c_char CHAR(32),
+ c_varchar VARCHAR(32),
+ c_tinytext TINYTEXT,
+ c_text TEXT,
+ c_mediumtext MEDIUMTEXT,
+ c_longtext LONGTEXT
+);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT LEAST(c, c_char) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT LEAST(c, c_varchar) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT LEAST(c, c_tinytext) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT LEAST(c, c_text) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT LEAST(c, c_mediumtext) FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT LEAST(c, c_longtext) FROM t1;
+DROP TABLE t1;
+
+
+--echo # Testing aggregation for numeric operation - plus
+
+CREATE TABLE t1 (a TEST_INT8);
+INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7);
+CREATE TABLE t2 AS SELECT
+ a+1 AS c1,
+ a+1.0 AS c2,
+ a+1e0 AS c3
+FROM t1;
+SHOW CREATE TABLE t2;
+SELECT * FROM t2 ORDER BY c1;
+DROP TABLE t2;
+DROP TABLE t1;
+
+CREATE TABLE t1 (
+ c TEST_INT8,
+ c_tinyint TINYINT,
+ c_smallint SMALLINT,
+ c_mediumint MEDIUMINT,
+ c_int INT,
+ c_bigint BIGINT
+);
+CREATE TABLE t2 AS SELECT
+ c + c_tinyint,
+ c + c_smallint,
+ c + c_mediumint,
+ c + c_bigint
+FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+DROP TABLE t1;
+
+CREATE TABLE t1 (
+ c TEST_INT8,
+ c_time TIME,
+ c_date DATE,
+ c_datetime DATETIME,
+ c_timestamp TIMESTAMP
+);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT c + c_time FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT c + c_date FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT c + c_datetime FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT c + c_timestamp FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (
+ c TEST_INT8,
+ c_char CHAR(32),
+ c_varchar VARCHAR(32),
+ c_tinytext TINYTEXT,
+ c_text TEXT,
+ c_mediumtext MEDIUMTEXT,
+ c_longtext LONGTEXT
+);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT c + c_char FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT c + c_varchar FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT c + c_tinytext FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT c + c_text FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT c + c_mediumtext FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT c + c_longtext FROM t1;
+DROP TABLE t1;
+
+--echo # Testing aggregation for numeric operation - minus
+
+CREATE TABLE t1 (a TEST_INT8);
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
+CREATE TABLE t2 AS SELECT
+ a-1 AS c1,
+ a-1.0 AS c2,
+ a-1e0 AS c3
+FROM t1;
+SHOW CREATE TABLE t2;
+SELECT * FROM t2 ORDER BY c1;
+DROP TABLE t2;
+DROP TABLE t1;
+
+CREATE TABLE t1 (
+ c TEST_INT8,
+ c_tinyint TINYINT,
+ c_smallint SMALLINT,
+ c_mediumint MEDIUMINT,
+ c_int INT,
+ c_bigint BIGINT
+);
+CREATE TABLE t2 AS SELECT
+ c - c_tinyint,
+ c - c_smallint,
+ c - c_mediumint,
+ c - c_bigint
+FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+DROP TABLE t1;
+
+CREATE TABLE t1 (
+ c TEST_INT8,
+ c_time TIME,
+ c_date DATE,
+ c_datetime DATETIME,
+ c_timestamp TIMESTAMP
+);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT c - c_time FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT c - c_date FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT c - c_datetime FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT c - c_timestamp FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (
+ c TEST_INT8,
+ c_char CHAR(32),
+ c_varchar VARCHAR(32),
+ c_tinytext TINYTEXT,
+ c_text TEXT,
+ c_mediumtext MEDIUMTEXT,
+ c_longtext LONGTEXT
+);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT c - c_char FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT c - c_varchar FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT c - c_tinytext FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT c - c_text FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT c - c_mediumtext FROM t1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT c - c_longtext FROM t1;
+DROP TABLE t1;
+
+
+--echo # Testing CAST to other data types
+
+CREATE TABLE t1 (a TEST_INT8);
+INSERT INTO t1 VALUES (20000102);
+CREATE TABLE t2 AS SELECT
+ a,
+ CAST(a AS CHAR),
+ CAST(a AS DECIMAL),
+ CAST(a AS DOUBLE),
+ CAST(a AS SIGNED),
+ CAST(a AS UNSIGNED),
+ CAST(a AS TIME),
+ CAST(a AS DATETIME),
+ CAST(a AS DATE)
+FROM t1;
+SHOW CREATE TABLE t2;
+--vertical_results
+SELECT * FROM t2;
+--horizontal_results
+DROP TABLE t2;
+DROP TABLE t1;
diff --git a/plugin/type_test/mysql-test/type_test/type_test_mysql.result b/plugin/type_test/mysql-test/type_test/type_test_mysql.result
new file mode 100644
index 00000000000..402e8265181
--- /dev/null
+++ b/plugin/type_test/mysql-test/type_test/type_test_mysql.result
@@ -0,0 +1,27 @@
+CREATE TABLE t1 (a TEST_INT8, b TEST_DOUBLE);
+Field 1: `a`
+Catalog: `def`
+Database: `test`
+Table: `t1`
+Org_table: `t1`
+Type: LONGLONG
+Collation: binary (63)
+Length: 20
+Max_length: 0
+Decimals: 0
+Flags: NUM
+
+Field 2: `b`
+Catalog: `def`
+Database: `test`
+Table: `t1`
+Org_table: `t1`
+Type: DOUBLE
+Collation: binary (63)
+Length: 22
+Max_length: 0
+Decimals: 31
+Flags: NUM
+
+
+DROP TABLE t1;
diff --git a/plugin/type_test/mysql-test/type_test/type_test_mysql.test b/plugin/type_test/mysql-test/type_test/type_test_mysql.test
new file mode 100644
index 00000000000..95fafe67fb1
--- /dev/null
+++ b/plugin/type_test/mysql-test/type_test/type_test_mysql.test
@@ -0,0 +1,6 @@
+-- source include/have_working_dns.inc
+-- source include/not_embedded.inc
+
+CREATE TABLE t1 (a TEST_INT8, b TEST_DOUBLE);
+--exec $MYSQL -t test --column-type-info -e "SELECT * FROM t1" 2>&1
+DROP TABLE t1;
diff --git a/plugin/type_test/plugin.cc b/plugin/type_test/plugin.cc
new file mode 100644
index 00000000000..efc5627cade
--- /dev/null
+++ b/plugin/type_test/plugin.cc
@@ -0,0 +1,333 @@
+/*
+ Copyright (c) 2000, 2015, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2019, 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#include <my_global.h>
+#include <sql_class.h> // THD
+#include <mysql/plugin_data_type.h>
+#include "sql_type.h"
+
+
+class Type_collection_test: public Type_collection
+{
+protected:
+ const Type_handler *aggregate_common(const Type_handler *h1,
+ const Type_handler *h2) const;
+public:
+ const Type_handler *handler_by_name(const LEX_CSTRING &name) const override
+ {
+ return NULL;
+ }
+ const Type_handler *aggregate_for_result(const Type_handler *h1,
+ const Type_handler *h2)
+ const override;
+ const Type_handler *aggregate_for_comparison(const Type_handler *h1,
+ const Type_handler *h2)
+ const override;
+ const Type_handler *aggregate_for_min_max(const Type_handler *h1,
+ const Type_handler *h2)
+ const override;
+ const Type_handler *aggregate_for_num_op(const Type_handler *h1,
+ const Type_handler *h2)
+ const override;
+};
+
+
+static Type_collection_test type_collection_test;
+
+
+class Field_test_int8 :public Field_longlong
+{
+public:
+ Field_test_int8(const LEX_CSTRING &name, const Record_addr &addr,
+ enum utype unireg_check_arg,
+ uint32 len_arg, bool zero_arg, bool unsigned_arg)
+ :Field_longlong(addr.ptr(), len_arg, addr.null_ptr(), addr.null_bit(),
+ Field::NONE, &name, zero_arg, unsigned_arg)
+ {}
+ const Type_handler *type_handler() const override;
+};
+
+
+class Type_handler_test_int8: public Type_handler_longlong
+{
+public:
+ const Name name() const override
+ {
+ static Name name(STRING_WITH_LEN("test_int8"));
+ return name;
+ }
+ const Type_collection *type_collection() const override
+ {
+ return &type_collection_test;
+ }
+ const Type_handler *type_handler_signed() const override
+ {
+ return this;
+ }
+ Field *make_table_field_from_def(TABLE_SHARE *share, MEM_ROOT *root,
+ const LEX_CSTRING *name,
+ const Record_addr &rec, const Bit_addr &bit,
+ const Column_definition_attributes *attr,
+ uint32 flags) const override
+ {
+ return new (root)
+ Field_test_int8(*name, rec, attr->unireg_check,
+ (uint32) attr->length,
+ f_is_zerofill(attr->pack_flag) != 0,
+ f_is_dec(attr->pack_flag) == 0);
+ }
+};
+
+static Type_handler_test_int8 type_handler_test_int8;
+
+
+const Type_handler *Field_test_int8::type_handler() const
+{
+ return &type_handler_test_int8;
+}
+
+
+static struct st_mariadb_data_type plugin_descriptor_type_test_int8=
+{
+ MariaDB_DATA_TYPE_INTERFACE_VERSION,
+ &type_handler_test_int8
+};
+
+
+/*************************************************************************/
+
+class Field_test_double :public Field_double
+{
+public:
+ Field_test_double(const LEX_CSTRING &name, const Record_addr &addr,
+ enum utype unireg_check_arg,
+ uint32 len_arg, uint8 dec_arg,
+ bool zero_arg, bool unsigned_arg)
+ :Field_double(addr.ptr(), len_arg, addr.null_ptr(), addr.null_bit(),
+ Field::NONE, &name, dec_arg, zero_arg, unsigned_arg)
+ {}
+ const Type_handler *type_handler() const override;
+};
+
+
+class Type_handler_test_double: public Type_handler_double
+{
+public:
+ const Name name() const override
+ {
+ static Name name(STRING_WITH_LEN("test_double"));
+ return name;
+ }
+ const Type_collection *type_collection() const override
+ {
+ return &type_collection_test;
+ }
+ const Type_handler *type_handler_signed() const override
+ {
+ return this;
+ }
+ bool Column_definition_data_type_info_image(Binary_string *to,
+ const Column_definition &def)
+ const override
+ {
+ return to->append(Type_handler_test_double::name().lex_cstring());
+ }
+ Field *make_table_field_from_def(TABLE_SHARE *share, MEM_ROOT *root,
+ const LEX_CSTRING *name,
+ const Record_addr &rec, const Bit_addr &bit,
+ const Column_definition_attributes *attr,
+ uint32 flags) const override
+ {
+ return new (root)
+ Field_test_double(*name, rec, attr->unireg_check,
+ (uint32) attr->length, (uint8) attr->decimals,
+ f_is_zerofill(attr->pack_flag) != 0,
+ f_is_dec(attr->pack_flag) == 0);
+ }
+};
+
+static Type_handler_test_double type_handler_test_double;
+
+
+const Type_handler *Field_test_double::type_handler() const
+{
+ return &type_handler_test_double;
+}
+
+
+static struct st_mariadb_data_type plugin_descriptor_type_test_double=
+{
+ MariaDB_DATA_TYPE_INTERFACE_VERSION,
+ &type_handler_test_double
+};
+
+
+/*************************************************************************/
+const Type_handler *
+Type_collection_test::aggregate_common(const Type_handler *h1,
+ const Type_handler *h2) const
+{
+ if (h1 == h2)
+ return h1;
+
+ static const Type_aggregator::Pair agg[]=
+ {
+ {
+ &type_handler_slong,
+ &type_handler_test_double,
+ &type_handler_test_double
+ },
+ {
+ &type_handler_newdecimal,
+ &type_handler_test_double,
+ &type_handler_test_double
+ },
+ {
+ &type_handler_double,
+ &type_handler_test_double,
+ &type_handler_test_double
+ },
+ {
+ &type_handler_slong,
+ &type_handler_test_int8,
+ &type_handler_test_int8
+ },
+ {
+ &type_handler_newdecimal,
+ &type_handler_test_int8,
+ &type_handler_newdecimal
+ },
+ {
+ &type_handler_double,
+ &type_handler_test_int8,
+ &type_handler_double
+ },
+ {
+ &type_handler_stiny,
+ &type_handler_test_double,
+ &type_handler_test_double
+ },
+ {
+ &type_handler_sshort,
+ &type_handler_test_double,
+ &type_handler_test_double
+ },
+ {
+ &type_handler_sint24,
+ &type_handler_test_double,
+ &type_handler_test_double
+ },
+ {
+ &type_handler_slonglong,
+ &type_handler_test_double,
+ &type_handler_test_double
+ },
+ {
+ &type_handler_stiny,
+ &type_handler_test_int8,
+ &type_handler_test_int8
+ },
+ {
+ &type_handler_sshort,
+ &type_handler_test_int8,
+ &type_handler_test_int8
+ },
+ {
+ &type_handler_sint24,
+ &type_handler_test_int8,
+ &type_handler_test_int8
+ },
+ {
+ &type_handler_slonglong,
+ &type_handler_test_int8,
+ &type_handler_test_int8
+ },
+ {NULL,NULL,NULL}
+ };
+
+ return Type_aggregator::find_handler_in_array(agg, h1, h2, true);
+}
+
+
+const Type_handler *
+Type_collection_test::aggregate_for_result(const Type_handler *h1,
+ const Type_handler *h2) const
+{
+ return aggregate_common(h1, h2);
+}
+
+
+const Type_handler *
+Type_collection_test::aggregate_for_min_max(const Type_handler *h1,
+ const Type_handler *h2) const
+{
+ return aggregate_common(h1, h2);
+}
+
+
+const Type_handler *
+Type_collection_test::aggregate_for_num_op(const Type_handler *h1,
+ const Type_handler *h2) const
+{
+ return aggregate_common(h1, h2);
+}
+
+
+const Type_handler *
+Type_collection_test::aggregate_for_comparison(const Type_handler *h1,
+ const Type_handler *h2) const
+{
+ DBUG_ASSERT(h1 == h1->type_handler_for_comparison());
+ DBUG_ASSERT(h2 == h2->type_handler_for_comparison());
+ return aggregate_common(h1, h2);
+}
+
+
+/*************************************************************************/
+
+maria_declare_plugin(type_test)
+{
+ MariaDB_DATA_TYPE_PLUGIN, // the plugin type (see include/mysql/plugin.h)
+ &plugin_descriptor_type_test_int8, // pointer to type-specific plugin descriptor
+ type_handler_test_int8.name().ptr(), // plugin name
+ "MariaDB Corporation", // plugin author
+ "Data type TEST_INT8", // the plugin description
+ PLUGIN_LICENSE_GPL, // the plugin license (see include/mysql/plugin.h)
+ 0, // Pointer to plugin initialization function
+ 0, // Pointer to plugin deinitialization function
+ 0x0100, // Numeric version 0xAABB means AA.BB veriosn
+ NULL, // Status variables
+ NULL, // System variables
+ "1.0", // String version representation
+ MariaDB_PLUGIN_MATURITY_EXPERIMENTAL // Maturity(see include/mysql/plugin.h)*/
+},
+{
+ MariaDB_DATA_TYPE_PLUGIN, // the plugin type (see include/mysql/plugin.h)
+ &plugin_descriptor_type_test_double, // pointer to type-specific plugin descriptor
+ type_handler_test_double.name().ptr(), // plugin name
+ "MariaDB Corporation", // plugin author
+ "Data type TEST_DOUBLE", // the plugin description
+ PLUGIN_LICENSE_GPL, // the plugin license (see include/mysql/plugin.h)
+ 0, // Pointer to plugin initialization function
+ 0, // Pointer to plugin deinitialization function
+ 0x0100, // Numeric version 0xAABB means AA.BB veriosn
+ NULL, // Status variables
+ NULL, // System variables
+ "1.0", // String version representation
+ MariaDB_PLUGIN_MATURITY_EXPERIMENTAL // Maturity(see include/mysql/plugin.h)*/
+}
+maria_declare_plugin_end;
diff --git a/plugin/user_variables/user_variables.cc b/plugin/user_variables/user_variables.cc
index bee8b1feccc..f820e4ad890 100644
--- a/plugin/user_variables/user_variables.cc
+++ b/plugin/user_variables/user_variables.cc
@@ -16,7 +16,7 @@
#define MYSQL_SERVER
#include <my_global.h>
#include <sql_class.h>
-#include <table.h>
+#include <sql_i_s.h>
#include <sql_show.h>
@@ -42,16 +42,18 @@ static const LEX_CSTRING unsigned_result_types[]=
};
+namespace Show {
+
static ST_FIELD_INFO user_variables_fields_info[] =
{
- { "VARIABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Variable_name", 0 },
- { "VARIABLE_VALUE", 2048, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, "Value", 0 },
- { "VARIABLE_TYPE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, 0 },
- { "CHARACTER_SET_NAME", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0,
- MY_I_S_MAYBE_NULL, 0, 0 },
- { 0, 0, MYSQL_TYPE_NULL, 0, 0, 0, 0 }
+ Column("VARIABLE_NAME", Name(), NOT_NULL, "Variable_name"),
+ Column("VARIABLE_VALUE", Varchar(2048), NULLABLE, "Value"),
+ Column("VARIABLE_TYPE", Name(), NOT_NULL),
+ Column("CHARACTER_SET_NAME", CSName(), NULLABLE),
+ CEnd()
};
+} // namespace Show
static int user_variables_fill(THD *thd, TABLE_LIST *tables, COND *cond)
{
@@ -110,7 +112,7 @@ int user_variables_reset(void)
static int user_variables_init(void *p)
{
ST_SCHEMA_TABLE *is= (ST_SCHEMA_TABLE *) p;
- is->fields_info= user_variables_fields_info;
+ is->fields_info= Show::user_variables_fields_info;
is->fill_table= user_variables_fill;
is->reset_table= user_variables_reset;
return 0;
diff --git a/plugin/userstat/client_stats.cc b/plugin/userstat/client_stats.cc
index a1835384ad1..2adeb23a385 100644
--- a/plugin/userstat/client_stats.cc
+++ b/plugin/userstat/client_stats.cc
@@ -1,33 +1,37 @@
+namespace Show {
+
static ST_FIELD_INFO client_stats_fields[]=
{
- {"CLIENT", LIST_PROCESS_HOST_LEN, MYSQL_TYPE_STRING, 0, 0, "Client", 0},
- {"TOTAL_CONNECTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Total_connections", 0},
- {"CONCURRENT_CONNECTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Concurrent_connections", 0},
- {"CONNECTED_TIME", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Connected_time", 0},
- {"BUSY_TIME", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_DOUBLE, 0, 0, "Busy_time", 0},
- {"CPU_TIME", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_DOUBLE, 0, 0, "Cpu_time", 0},
- {"BYTES_RECEIVED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Bytes_received", 0},
- {"BYTES_SENT", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Bytes_sent", 0},
- {"BINLOG_BYTES_WRITTEN", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Binlog_bytes_written", 0},
- {"ROWS_READ", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_read", 0},
- {"ROWS_SENT", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_sent", 0},
- {"ROWS_DELETED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_deleted", 0},
- {"ROWS_INSERTED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_inserted", 0},
- {"ROWS_UPDATED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_updated", 0},
- {"SELECT_COMMANDS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Select_commands", 0},
- {"UPDATE_COMMANDS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Update_commands", 0},
- {"OTHER_COMMANDS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Other_commands", 0},
- {"COMMIT_TRANSACTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Commit_transactions", 0},
- {"ROLLBACK_TRANSACTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rollback_transactions", 0},
- {"DENIED_CONNECTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Denied_connections", 0},
- {"LOST_CONNECTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Lost_connections", 0},
- {"ACCESS_DENIED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Access_denied", 0},
- {"EMPTY_QUERIES", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Empty_queries", 0},
- {"TOTAL_SSL_CONNECTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, MY_I_S_UNSIGNED, "Total_ssl_connections", 0},
- {"MAX_STATEMENT_TIME_EXCEEDED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Max_statement_time_exceeded",SKIP_OPEN_TABLE},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, 0}
+ Column("CLIENT",Varchar(LIST_PROCESS_HOST_LEN), NOT_NULL, "Client"),
+ Column("TOTAL_CONNECTIONS", SLonglong(), NOT_NULL, "Total_connections"),
+ Column("CONCURRENT_CONNECTIONS", SLonglong(), NOT_NULL, "Concurrent_connections"),
+ Column("CONNECTED_TIME", SLonglong(), NOT_NULL, "Connected_time"),
+ Column("BUSY_TIME", Double(MY_INT64_NUM_DECIMAL_DIGITS), NOT_NULL, "Busy_time"),
+ Column("CPU_TIME", Double(MY_INT64_NUM_DECIMAL_DIGITS), NOT_NULL, "Cpu_time"),
+ Column("BYTES_RECEIVED", SLonglong(), NOT_NULL, "Bytes_received"),
+ Column("BYTES_SENT", SLonglong(), NOT_NULL, "Bytes_sent"),
+ Column("BINLOG_BYTES_WRITTEN", SLonglong(), NOT_NULL, "Binlog_bytes_written"),
+ Column("ROWS_READ", SLonglong(), NOT_NULL, "Rows_read"),
+ Column("ROWS_SENT", SLonglong(), NOT_NULL, "Rows_sent"),
+ Column("ROWS_DELETED", SLonglong(), NOT_NULL, "Rows_deleted"),
+ Column("ROWS_INSERTED", SLonglong(), NOT_NULL, "Rows_inserted"),
+ Column("ROWS_UPDATED", SLonglong(), NOT_NULL, "Rows_updated"),
+ Column("SELECT_COMMANDS", SLonglong(), NOT_NULL, "Select_commands"),
+ Column("UPDATE_COMMANDS", SLonglong(), NOT_NULL, "Update_commands"),
+ Column("OTHER_COMMANDS", SLonglong(), NOT_NULL, "Other_commands"),
+ Column("COMMIT_TRANSACTIONS", SLonglong(), NOT_NULL, "Commit_transactions"),
+ Column("ROLLBACK_TRANSACTIONS", SLonglong(), NOT_NULL, "Rollback_transactions"),
+ Column("DENIED_CONNECTIONS", SLonglong(), NOT_NULL, "Denied_connections"),
+ Column("LOST_CONNECTIONS", SLonglong(), NOT_NULL, "Lost_connections"),
+ Column("ACCESS_DENIED", SLonglong(), NOT_NULL, "Access_denied"),
+ Column("EMPTY_QUERIES", SLonglong(), NOT_NULL, "Empty_queries"),
+ Column("TOTAL_SSL_CONNECTIONS", ULonglong(), NOT_NULL, "Total_ssl_connections"),
+ Column("MAX_STATEMENT_TIME_EXCEEDED", SLonglong(), NOT_NULL, "Max_statement_time_exceeded"),
+ CEnd()
};
+} // namespace Show
+
static int send_user_stats(THD* thd, HASH *all_user_stats, TABLE *table)
{
mysql_mutex_lock(&LOCK_global_user_client_stats);
@@ -92,7 +96,7 @@ static int client_stats_reset()
static int client_stats_init(void *p)
{
ST_SCHEMA_TABLE *schema= (ST_SCHEMA_TABLE *)p;
- schema->fields_info= client_stats_fields;
+ schema->fields_info= Show::client_stats_fields;
schema->fill_table= client_stats_fill;
schema->reset_table= client_stats_reset;
return 0;
diff --git a/plugin/userstat/index_stats.cc b/plugin/userstat/index_stats.cc
index 0528507c50e..8605e56fbc8 100644
--- a/plugin/userstat/index_stats.cc
+++ b/plugin/userstat/index_stats.cc
@@ -1,12 +1,16 @@
+namespace Show {
+
static ST_FIELD_INFO index_stats_fields[]=
{
- {"TABLE_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Table_schema",SKIP_OPEN_TABLE},
- {"TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Table_name",SKIP_OPEN_TABLE},
- {"INDEX_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Index_name",SKIP_OPEN_TABLE},
- {"ROWS_READ", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_read",SKIP_OPEN_TABLE},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0,0}
+ Column("TABLE_SCHEMA", Varchar(NAME_LEN), NOT_NULL, "Table_schema"),
+ Column("TABLE_NAME", Varchar(NAME_LEN), NOT_NULL, "Table_name"),
+ Column("INDEX_NAME", Varchar(NAME_LEN), NOT_NULL, "Index_name"),
+ Column("ROWS_READ", SLonglong(), NOT_NULL, "Rows_read"),
+ CEnd()
};
+} // namespace Show
+
static int index_stats_fill(THD *thd, TABLE_LIST *tables, COND *cond)
{
TABLE *table= tables->table;
@@ -63,7 +67,7 @@ static int index_stats_reset()
static int index_stats_init(void *p)
{
ST_SCHEMA_TABLE *schema= (ST_SCHEMA_TABLE *)p;
- schema->fields_info= index_stats_fields;
+ schema->fields_info= Show::index_stats_fields;
schema->fill_table= index_stats_fill;
schema->reset_table= index_stats_reset;
return 0;
diff --git a/plugin/userstat/table_stats.cc b/plugin/userstat/table_stats.cc
index 3119e516e06..c733d77c26b 100644
--- a/plugin/userstat/table_stats.cc
+++ b/plugin/userstat/table_stats.cc
@@ -1,13 +1,17 @@
+namespace Show {
+
static ST_FIELD_INFO table_stats_fields[]=
{
- {"TABLE_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Table_schema",SKIP_OPEN_TABLE},
- {"TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Table_name",SKIP_OPEN_TABLE},
- {"ROWS_READ", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_read",SKIP_OPEN_TABLE},
- {"ROWS_CHANGED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_changed",SKIP_OPEN_TABLE},
- {"ROWS_CHANGED_X_INDEXES", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_changed_x_#indexes",SKIP_OPEN_TABLE},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, 0}
+ Column("TABLE_SCHEMA", Varchar(NAME_LEN), NOT_NULL, "Table_schema"),
+ Column("TABLE_NAME", Varchar(NAME_LEN), NOT_NULL, "Table_name"),
+ Column("ROWS_READ", SLonglong(), NOT_NULL, "Rows_read"),
+ Column("ROWS_CHANGED", SLonglong(), NOT_NULL, "Rows_changed"),
+ Column("ROWS_CHANGED_X_INDEXES",SLonglong(), NOT_NULL, "Rows_changed_x_#indexes"),
+ CEnd()
};
+} // namespace Show
+
static int table_stats_fill(THD *thd, TABLE_LIST *tables, COND *cond)
{
TABLE *table= tables->table;
@@ -67,7 +71,7 @@ static int table_stats_reset()
static int table_stats_init(void *p)
{
ST_SCHEMA_TABLE *schema= (ST_SCHEMA_TABLE *)p;
- schema->fields_info= table_stats_fields;
+ schema->fields_info= Show::table_stats_fields;
schema->fill_table= table_stats_fill;
schema->reset_table= table_stats_reset;
return 0;
diff --git a/plugin/userstat/user_stats.cc b/plugin/userstat/user_stats.cc
index 12e2372e5cf..50809e0442a 100644
--- a/plugin/userstat/user_stats.cc
+++ b/plugin/userstat/user_stats.cc
@@ -1,33 +1,37 @@
+namespace Show {
+
static ST_FIELD_INFO user_stats_fields[]=
{
- {"USER", USERNAME_CHAR_LENGTH, MYSQL_TYPE_STRING, 0, 0, "User", 0},
- {"TOTAL_CONNECTIONS", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Total_connections", 0},
- {"CONCURRENT_CONNECTIONS", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Concurrent_connections", 0},
- {"CONNECTED_TIME", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Connected_time", 0},
- {"BUSY_TIME", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_DOUBLE, 0, 0, "Busy_time", 0},
- {"CPU_TIME", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_DOUBLE, 0, 0, "Cpu_time", 0},
- {"BYTES_RECEIVED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Bytes_received", 0},
- {"BYTES_SENT", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Bytes_sent", 0},
- {"BINLOG_BYTES_WRITTEN", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Binlog_bytes_written", 0},
- {"ROWS_READ", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_read", 0},
- {"ROWS_SENT", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_sent", 0},
- {"ROWS_DELETED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_deleted", 0},
- {"ROWS_INSERTED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_inserted", 0},
- {"ROWS_UPDATED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_updated", 0},
- {"SELECT_COMMANDS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Select_commands", 0},
- {"UPDATE_COMMANDS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Update_commands", 0},
- {"OTHER_COMMANDS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Other_commands", 0},
- {"COMMIT_TRANSACTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Commit_transactions", 0},
- {"ROLLBACK_TRANSACTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rollback_transactions", 0},
- {"DENIED_CONNECTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Denied_connections", 0},
- {"LOST_CONNECTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Lost_connections", 0},
- {"ACCESS_DENIED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Access_denied", 0},
- {"EMPTY_QUERIES", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Empty_queries", 0},
- {"TOTAL_SSL_CONNECTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, MY_I_S_UNSIGNED, "Total_ssl_connections", 0},
- {"MAX_STATEMENT_TIME_EXCEEDED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Max_statement_time_exceeded",SKIP_OPEN_TABLE},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, 0}
+ Column("USER",Varchar(USERNAME_CHAR_LENGTH),NOT_NULL, "User"),
+ Column("TOTAL_CONNECTIONS", SLong(), NOT_NULL, "Total_connections"),
+ Column("CONCURRENT_CONNECTIONS",SLong(), NOT_NULL, "Concurrent_connections"),
+ Column("CONNECTED_TIME", SLong(), NOT_NULL, "Connected_time"),
+ Column("BUSY_TIME", Double(MY_INT64_NUM_DECIMAL_DIGITS), NOT_NULL, "Busy_time"),
+ Column("CPU_TIME", Double(MY_INT64_NUM_DECIMAL_DIGITS), NOT_NULL, "Cpu_time"),
+ Column("BYTES_RECEIVED", SLonglong(), NOT_NULL, "Bytes_received"),
+ Column("BYTES_SENT", SLonglong(), NOT_NULL, "Bytes_sent"),
+ Column("BINLOG_BYTES_WRITTEN", SLonglong(), NOT_NULL, "Binlog_bytes_written"),
+ Column("ROWS_READ", SLonglong(), NOT_NULL, "Rows_read"),
+ Column("ROWS_SENT", SLonglong(), NOT_NULL, "Rows_sent"),
+ Column("ROWS_DELETED", SLonglong(), NOT_NULL, "Rows_deleted"),
+ Column("ROWS_INSERTED", SLonglong(), NOT_NULL, "Rows_inserted"),
+ Column("ROWS_UPDATED", SLonglong(), NOT_NULL, "Rows_updated"),
+ Column("SELECT_COMMANDS", SLonglong(), NOT_NULL, "Select_commands"),
+ Column("UPDATE_COMMANDS", SLonglong(), NOT_NULL, "Update_commands"),
+ Column("OTHER_COMMANDS", SLonglong(), NOT_NULL, "Other_commands"),
+ Column("COMMIT_TRANSACTIONS", SLonglong(), NOT_NULL, "Commit_transactions"),
+ Column("ROLLBACK_TRANSACTIONS",SLonglong(), NOT_NULL, "Rollback_transactions"),
+ Column("DENIED_CONNECTIONS", SLonglong(), NOT_NULL, "Denied_connections"),
+ Column("LOST_CONNECTIONS", SLonglong(), NOT_NULL, "Lost_connections"),
+ Column("ACCESS_DENIED", SLonglong(), NOT_NULL, "Access_denied"),
+ Column("EMPTY_QUERIES", SLonglong(), NOT_NULL, "Empty_queries"),
+ Column("TOTAL_SSL_CONNECTIONS",ULonglong(), NOT_NULL, "Total_ssl_connections"),
+ Column("MAX_STATEMENT_TIME_EXCEEDED",SLonglong(),NOT_NULL, "Max_statement_time_exceeded"),
+ CEnd()
};
+} // namespace Show
+
static int user_stats_fill(THD* thd, TABLE_LIST* tables, COND* cond)
{
if (check_global_access(thd, SUPER_ACL | PROCESS_ACL, true))
@@ -48,7 +52,7 @@ static int user_stats_reset()
static int user_stats_init(void *p)
{
ST_SCHEMA_TABLE *schema= (ST_SCHEMA_TABLE *)p;
- schema->fields_info= user_stats_fields;
+ schema->fields_info= Show::user_stats_fields;
schema->fill_table= user_stats_fill;
schema->reset_table= user_stats_reset;
return 0;
diff --git a/plugin/wsrep_info/plugin.cc b/plugin/wsrep_info/plugin.cc
index f78ecdcb68c..51eadc9d3cf 100644
--- a/plugin/wsrep_info/plugin.cc
+++ b/plugin/wsrep_info/plugin.cc
@@ -19,7 +19,7 @@
#include <my_global.h>
#include <mysql/plugin.h>
-#include <table.h> /* ST_SCHEMA_TABLE */
+#include <sql_i_s.h> /* ST_SCHEMA_TABLE */
#include <sql_show.h>
#include <sql_acl.h> /* check_global_access() */
#include <wsrep_mysqld.h>
@@ -55,35 +55,32 @@
/* Application protocol version */
#define COLUMN_WSREP_STATUS_PROTO_VERSION 7
+namespace Show {
static ST_FIELD_INFO wsrep_memb_fields[]=
{
- {"INDEX", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Index", 0},
- {"UUID", WSREP_UUID_STR_LEN, MYSQL_TYPE_STRING, 0, 0, "Uuid", 0},
- {"NAME", WSREP_MEMBER_NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Name", 0},
- {"ADDRESS", WSREP_INCOMING_LEN, MYSQL_TYPE_STRING, 0, 0, "Address", 0},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, 0}
+ Column("INDEX", SLong(), NOT_NULL, "Index"),
+ Column("UUID", Varchar(WSREP_UUID_STR_LEN), NOT_NULL, "Uuid"),
+ Column("NAME", Varchar(WSREP_MEMBER_NAME_LEN), NOT_NULL, "Name"),
+ Column("ADDRESS", Varchar(WSREP_INCOMING_LEN), NOT_NULL, "Address"),
+ CEnd()
};
static ST_FIELD_INFO wsrep_status_fields[]=
{
- {"NODE_INDEX", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG,
- 0, 0, "Node_Index", 0},
- {"NODE_STATUS", 16, MYSQL_TYPE_STRING, 0, 0, "Node_Status", 0},
- {"CLUSTER_STATUS", 16, MYSQL_TYPE_STRING, 0, 0, "Cluster_Status", 0},
- {"CLUSTER_SIZE", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG,
- 0, 0, "Cluster_Size", 0},
- {"CLUSTER_STATE_UUID", WSREP_UUID_STR_LEN, MYSQL_TYPE_STRING,
- 0, 0, 0, 0},
- {"CLUSTER_STATE_SEQNO", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG,
- 0, 0, 0, 0},
- {"CLUSTER_CONF_ID", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG,
- 0, 0, 0, 0},
- {"PROTOCOL_VERSION", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG,
- 0, 0, 0, 0},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, 0}
+ Column("NODE_INDEX", SLong(), NOT_NULL, "Node_Index"),
+ Column("NODE_STATUS", Varchar(16), NOT_NULL, "Node_Status"),
+ Column("CLUSTER_STATUS", Varchar(16), NOT_NULL, "Cluster_Status"),
+ Column("CLUSTER_SIZE", SLong(), NOT_NULL, "Cluster_Size"),
+ Column("CLUSTER_STATE_UUID", Varchar(WSREP_UUID_STR_LEN), NOT_NULL),
+ Column("CLUSTER_STATE_SEQNO", SLonglong(), NOT_NULL),
+ Column("CLUSTER_CONF_ID", SLonglong(), NOT_NULL),
+ Column("PROTOCOL_VERSION", SLong(), NOT_NULL),
+ CEnd()
};
+} // namespace Show
+
static int wsrep_memb_fill_table(THD *thd, TABLE_LIST *tables, COND *cond)
{
int rc= 0;
@@ -131,7 +128,7 @@ static int wsrep_memb_plugin_init(void *p)
{
ST_SCHEMA_TABLE *schema= (ST_SCHEMA_TABLE *)p;
- schema->fields_info= wsrep_memb_fields;
+ schema->fields_info= Show::wsrep_memb_fields;
schema->fill_table= wsrep_memb_fill_table;
return 0;
@@ -189,7 +186,7 @@ static int wsrep_status_plugin_init(void *p)
{
ST_SCHEMA_TABLE *schema= (ST_SCHEMA_TABLE *)p;
- schema->fields_info= wsrep_status_fields;
+ schema->fields_info= Show::wsrep_status_fields;
schema->fill_table= wsrep_status_fill_table;
return 0;
diff --git a/scripts/fill_help_tables.sql b/scripts/fill_help_tables.sql
index 64e84f204a5..e110c00c277 100644
--- a/scripts/fill_help_tables.sql
+++ b/scripts/fill_help_tables.sql
@@ -12,7 +12,7 @@
--
-- 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-1335 USA.
+-- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-- DO NOT EDIT THIS FILE. It is generated automatically.
@@ -77,917 +77,797 @@ 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 (42,'Window Functions',38,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (43,'Spider Functions',38,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (44,'Dynamic Column Functions',38,'');
-insert into help_category (help_category_id,name,parent_category_id,url) values (45,'Storage Engines',35,'');
-insert into help_category (help_category_id,name,parent_category_id,url) values (46,'InnoDB',45,'');
-insert into help_category (help_category_id,name,parent_category_id,url) values (47,'Optimization and Indexes',35,'');
-insert into help_category (help_category_id,name,parent_category_id,url) values (48,'Full-text Indexes',47,'');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (1,9,'HELP_DATE','This help information was generated from the MariaDB Knowledge Base\non 2 September 2019.','','');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (2,2,'AREA','A synonym for ST_AREA.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/polygon-properties-area/','','https://mariadb.com/kb/en/polygon-properties-area/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (3,2,'CENTROID','A synonym for ST_CENTROID.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/centroid/','','https://mariadb.com/kb/en/centroid/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (4,2,'ExteriorRing','A synonym for ST_ExteriorRing.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/polygon-properties-exteriorring/','','https://mariadb.com/kb/en/polygon-properties-exteriorring/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (5,2,'InteriorRingN','A synonym for ST_InteriorRingN.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/polygon-properties-interiorringn/','','https://mariadb.com/kb/en/polygon-properties-interiorringn/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (6,2,'NumInteriorRings','A synonym for ST_NumInteriorRings.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/polygon-properties-numinteriorrings/','','https://mariadb.com/kb/en/polygon-properties-numinteriorrings/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (7,2,'ST_AREA','Syntax\n------ \nST_Area(poly)\nArea(poly)\n \nDescription\n----------- \nReturns as a double-precision number the area of the Polygon\nvalue poly, as measured in its spatial reference system.\n \nST_Area() and Area() are synonyms.\n \nExamples\n-------- \nSET @poly = \'Polygon((0 0,0 3,3 0,0 0),(1 1,1 2,2 1,1\n1))\';\n \nSELECT Area(GeomFromText(@poly));\n+---------------------------+\n| Area(GeomFromText(@poly)) |\n+---------------------------+\n| 4 |\n+---------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_area/','','https://mariadb.com/kb/en/st_area/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (8,2,'ST_CENTROID','Syntax\n------ \nST_Centroid(mpoly)\nCentroid(mpoly)\n \nDescription\n----------- \nReturns a point reflecting the mathematical centroid\n(geometric center) for the MultiPolygon mpoly. The resulting\npoint will not necessarily be on the MultiPolygon. \n \nST_Centroid() and Centroid() are synonyms.\n \nExamples\n-------- \nSET @poly = ST_GeomFromText(\'POLYGON((0 0,20 0,20 20,0 20,0\n0))\');\nSELECT ST_AsText(ST_Centroid(@poly)) AS center;\n \n+--------------+\n| center |\n+--------------+\n| POINT(10 10) |\n+--------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_centroid/','','https://mariadb.com/kb/en/st_centroid/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (9,2,'ST_ExteriorRing','Syntax\n------ \nST_ExteriorRing(poly)\nExteriorRing(poly)\n \nDescription\n----------- \nReturns the exterior ring of the Polygon value poly as a\nLineString.\n \nST_ExteriorRing() and ExteriorRing() are synonyms.\n \nExamples\n-------- \nSET @poly = \'Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2\n1,1 1))\';\n \nSELECT 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 \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_exteriorring/','','https://mariadb.com/kb/en/st_exteriorring/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (10,2,'ST_InteriorRingN','Syntax\n------ \nST_InteriorRingN(poly,N)\nInteriorRingN(poly,N)\n \nDescription\n----------- \nReturns the N-th interior ring for the Polygon value poly as\na LineString. Rings are numbered beginning with 1.\n \nST_InteriorRingN() and InteriorRingN() are synonyms.\n \nExamples\n-------- \nSET @poly = \'Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2\n1,1 1))\';\n \nSELECT 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 \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_interiorringn/','','https://mariadb.com/kb/en/st_interiorringn/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (11,2,'ST_NumInteriorRings','Syntax\n------ \nST_NumInteriorRings(poly)\nNumInteriorRings(poly)\n \nDescription\n----------- \nReturns an integer containing the number of interior rings\nin the Polygon value poly.\n \nNote that according the the OpenGIS standard, a POLYGON\nshould have exactly one ExteriorRing and all other rings\nshould lie within that ExteriorRing and thus be the\nInteriorRings. Practically, however, some systems, including\nMariaDB\'s, permit polygons to have several\n\'ExteriorRings\'. In the case of there being multiple,\nnon-overlapping exterior rings ST_NumInteriorRings() will\nreturn 1.\n \nST_NumInteriorRings() and NumInteriorRings() are synonyms.\n \nExamples\n-------- \nSET @poly = \'Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2\n1,1 1))\';\n \nSELECT NumInteriorRings(GeomFromText(@poly));\n+---------------------------------------+\n| NumInteriorRings(GeomFromText(@poly)) |\n+---------------------------------------+\n| 1 |\n+---------------------------------------+\n \nNon-overlapping \'polygon\':\n \nSELECT ST_NumInteriorRings(ST_PolyFromText(\'POLYGON((0 0,10\n0,10 10,0 10,0 0),\n (-1 -1,-5 -1,-5 -5,-1 -5,-1 -1))\')) AS NumInteriorRings;\n \n+------------------+\n| NumInteriorRings |\n+------------------+\n| 1 |\n+------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_numinteriorrings/','','https://mariadb.com/kb/en/st_numinteriorrings/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (12,3,'WKT Definition','Description\n----------- \nThe Well-Known Text (WKT) representation of Geometry is\ndesigned to exchange geometry data in ASCII form. Examples\nof the basic geometry types include:\n \nGeometry Types | \n \nPOINT | \n \nLINESTRING | \n \nPOLYGON | \n \nMULTIPOINT | \n \nMULTILINESTRING | \n \nMULTIPOLYGON | \n \nGEOMETRYCOLLECTION | \n \nGEOMETRY | \n \n\n\nURL: https://mariadb.com/kb/en/wkt-definition/','','https://mariadb.com/kb/en/wkt-definition/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (13,3,'AsText','A synonym for ST_AsText().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/wkt-astext/','','https://mariadb.com/kb/en/wkt-astext/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (14,3,'AsWKT','A synonym for ST_AsText().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/wkt-aswkt/','','https://mariadb.com/kb/en/wkt-aswkt/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (15,3,'GeomCollFromText','A synonym for ST_GeomCollFromText.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/wkt-geomcollfromtext/','','https://mariadb.com/kb/en/wkt-geomcollfromtext/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (16,3,'GeometryCollectionFromText','A synonym for ST_GeomCollFromText.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/geometrycollectionfromtext/','','https://mariadb.com/kb/en/geometrycollectionfromtext/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (17,3,'GeometryFromText','A synonym for ST_GeomFromText.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/geometryfromtext/','','https://mariadb.com/kb/en/geometryfromtext/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (18,3,'GeomFromText','A synonym for ST_GeomFromText.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/wkt-geomfromtext/','','https://mariadb.com/kb/en/wkt-geomfromtext/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (19,3,'LineFromText','A synonym for ST_LineFromText.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/wkt-linefromtext/','','https://mariadb.com/kb/en/wkt-linefromtext/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (20,3,'LineStringFromText','A synonym for ST_LineFromText.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/linestringfromtext/','','https://mariadb.com/kb/en/linestringfromtext/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (21,3,'MLineFromText','Syntax\n------ \nMLineFromText(wkt[,srid])\nMultiLineStringFromText(wkt[,srid])\n \nDescription\n----------- \nConstructs a MULTILINESTRING value using its WKT\nrepresentation and SRID.\n \nMLineFromText() and MultiLineStringFromText() are synonyms.\n \nExamples\n-------- \nCREATE TABLE gis_multi_line (g MULTILINESTRING);\nSHOW FIELDS FROM gis_multi_line;\n \nINSERT INTO gis_multi_line VALUES\n (MultiLineStringFromText(\'MULTILINESTRING((10 48,10 21,10\n0),(16 0,16 23,16 48))\')),\n (MLineFromText(\'MULTILINESTRING((10 48,10 21,10 0))\')),\n (MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2),\nPoint(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21,\n7))))));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/mlinefromtext/','','https://mariadb.com/kb/en/mlinefromtext/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (22,3,'MPointFromText','Syntax\n------ \nMPointFromText(wkt[,srid])\nMultiPointFromText(wkt[,srid])\n \nDescription\n----------- \nConstructs a MULTIPOINT value using its WKT representation\nand SRID.\n \nMPointFromText() and MultiPointFromText() are synonyms.\n \nExamples\n-------- \nCREATE TABLE gis_multi_point (g MULTIPOINT);\nSHOW FIELDS FROM gis_multi_point;\n \nINSERT INTO gis_multi_point VALUES\n (MultiPointFromText(\'MULTIPOINT(0 0,10 10,10 20,20\n20)\')),\n (MPointFromText(\'MULTIPOINT(1 1,11 11,11 21,21 21)\')),\n (MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4,\n10)))));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/mpointfromtext/','','https://mariadb.com/kb/en/mpointfromtext/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (23,3,'MPolyFromText','Syntax\n------ \nMPolyFromText(wkt[,srid])\nMultiPolygonFromText(wkt[,srid])\n \nDescription\n----------- \nConstructs a MULTIPOLYGON value using its WKT representation\nand SRID.\n \nMPolyFromText() and MultiPolygonFromText() are synonyms.\n \nExamples\n-------- \nCREATE TABLE gis_multi_polygon (g MULTIPOLYGON);\nSHOW FIELDS FROM gis_multi_polygon;\n \nINSERT INTO gis_multi_polygon VALUES\n (MultiPolygonFromText(\'MULTIPOLYGON(((28 26,28 0,84 0,84\n42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67\n13,59 13,59 18)))\')),\n (MPolyFromText(\'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28\n26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59\n13,59 18)))\')),\n (MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0,\n3), Point(3, 3), Point(3, 0), Point(0, 3)))))));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/mpolyfromtext/','','https://mariadb.com/kb/en/mpolyfromtext/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (24,3,'MultiLineStringFromText','A synonym for MLineFromText.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/multilinestringfromtext/','','https://mariadb.com/kb/en/multilinestringfromtext/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (25,3,'MultiPointFromText','A synonym for MPointFromText.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/multipointfromtext/','','https://mariadb.com/kb/en/multipointfromtext/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (26,3,'MultiPolygonFromText','A synonym for MPolyFromText.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/multipolygonfromtext/','','https://mariadb.com/kb/en/multipolygonfromtext/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (27,3,'PointFromText','A synonym for ST_PointFromText.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/wkt-pointfromtext/','','https://mariadb.com/kb/en/wkt-pointfromtext/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (28,3,'PolyFromText','A synonym for ST_PolyFromText.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/wkt-polyfromtext/','','https://mariadb.com/kb/en/wkt-polyfromtext/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (29,3,'PolygonFromText','A synonym for ST_PolyFromText.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/polygonfromtext/','','https://mariadb.com/kb/en/polygonfromtext/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (30,3,'ST_AsText','Syntax\n------ \nST_AsText(g)\nAsText(g)\nST_AsWKT(g)\nAsWKT(g)\n \nDescription\n----------- \nConverts a value in internal geometry format to its WKT\nrepresentation and returns the string result.\n \nST_AsText(), AsText(), ST_AsWKT() and AsWKT() are all\nsynonyms.\n \nExamples\n-------- \nSET @g = \'LineString(1 1,4 4,6 6)\';\n \nSELECT ST_AsText(ST_GeomFromText(@g));\n+--------------------------------+\n| ST_AsText(ST_GeomFromText(@g)) |\n+--------------------------------+\n| LINESTRING(1 1,4 4,6 6) |\n+--------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_astext/','','https://mariadb.com/kb/en/st_astext/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (31,3,'ST_ASWKT','A synonym for ST_ASTEXT().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_aswkt/','','https://mariadb.com/kb/en/st_aswkt/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (32,3,'ST_GeomCollFromText','Syntax\n------ \nST_GeomCollFromText(wkt[,srid])\nST_GeometryCollectionFromText(wkt[,srid])\nGeomCollFromText(wkt[,srid])\nGeometryCollectionFromText(wkt[,srid])\n \nDescription\n----------- \nConstructs a GEOMETRYCOLLECTION value using its WKT \nrepresentation and SRID.\n \nST_GeomCollFromText(), ST_GeometryCollectionFromText(),\nGeomCollFromText() and GeometryCollectionFromText() are all\nsynonyms.\n \nExample\n \nCREATE TABLE gis_geometrycollection (g GEOMETRYCOLLECTION);\nSHOW FIELDS FROM gis_geometrycollection;\n \nINSERT INTO gis_geometrycollection VALUES\n (GeomCollFromText(\'GEOMETRYCOLLECTION(POINT(0 0),\nLINESTRING(0 0,10 10))\')),\n (GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6),\nLineString(Point(3, 6), Point(7, 9)))))),\n (GeomFromText(\'GeometryCollection()\')),\n (GeomFromText(\'GeometryCollection EMPTY\'));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_geomcollfromtext/','','https://mariadb.com/kb/en/st_geomcollfromtext/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (33,3,'ST_GeometryCollectionFromText','A synonym for ST_GeomCollFromText.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/st_geometrycollectionfromtext/','','https://mariadb.com/kb/en/st_geometrycollectionfromtext/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (34,3,'ST_GeometryFromText','A synonym for ST_GeomFromText.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_geometryfromtext/','','https://mariadb.com/kb/en/st_geometryfromtext/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (35,3,'ST_GeomFromText','Syntax\n------ \nST_GeomFromText(wkt[,srid])\nST_GeometryFromText(wkt[,srid])\nGeomFromText(wkt[,srid])\nGeometryFromText(wkt[,srid])\n \nDescription\n----------- \nConstructs a geometry value of any type using its WKT\nrepresentation and SRID.\n \nGeomFromText(), GeometryFromText(), ST_GeomFromText() and\nST_GeometryFromText() are all synonyms.\n \nExample\n \nSET @g = ST_GEOMFROMTEXT(\'POLYGON((1 1,1 5,4 9,6 9,9 3,7\n2,1 1))\');\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_geomfromtext/','','https://mariadb.com/kb/en/st_geomfromtext/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (36,3,'ST_LineFromText','Syntax\n------ \nST_LineFromText(wkt[,srid])\nST_LineStringFromText(wkt[,srid])\nLineFromText(wkt[,srid])\nLineStringFromText(wkt[,srid])\n \nDescription\n----------- \nConstructs a LINESTRING value using its WKT representation\nand SRID.\n \nST_LineFromText(), ST_LineStringFromText(),\nST_LineFromText() and ST_LineStringFromText() are all\nsynonyms.\n \nExamples\n-------- \nCREATE TABLE gis_line (g LINESTRING);\nSHOW FIELDS FROM gis_line;\n \nINSERT INTO gis_line VALUES\n (LineFromText(\'LINESTRING(0 0,0 10,10 0)\')),\n (LineStringFromText(\'LINESTRING(10 10,20 10,20 20,10 20,10\n10)\')),\n (LineStringFromWKB(AsWKB(LineString(Point(10, 10),\nPoint(40, 10)))));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_linefromtext/','','https://mariadb.com/kb/en/st_linefromtext/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (37,3,'ST_LineStringFromText','A synonym for ST_LineFromText.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_linestringfromtext/','','https://mariadb.com/kb/en/st_linestringfromtext/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (38,3,'ST_PointFromText','Syntax\n------ \nST_PointFromText(wkt[,srid])\nPointFromText(wkt[,srid])\n \nDescription\n----------- \nConstructs a POINT value using its WKT representation and\nSRID.\n \nST_PointFromText() and PointFromText() are synonyms.\n \nExamples\n-------- \nCREATE TABLE gis_point (g POINT);\nSHOW FIELDS FROM gis_point;\n \nINSERT INTO gis_point VALUES\n (PointFromText(\'POINT(10 10)\')),\n (PointFromText(\'POINT(20 10)\')),\n (PointFromText(\'POINT(20 20)\')),\n (PointFromWKB(AsWKB(PointFromText(\'POINT(10 20)\'))));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_pointfromtext/','','https://mariadb.com/kb/en/st_pointfromtext/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (39,3,'ST_PolyFromText','Syntax\n------ \nST_PolyFromText(wkt[,srid])\nST_PolygonFromText(wkt[,srid])\nPolyFromText(wkt[,srid])\nPolygonFromText(wkt[,srid])\n \nDescription\n----------- \nConstructs a POLYGON value using its WKT representation and\nSRID.\n \nST_PolyFromText(), ST_PolygonFromText(), PolyFromText() and\nST_PolygonFromText() are all synonyms.\n \nExamples\n-------- \nCREATE TABLE gis_polygon (g POLYGON);\nINSERT INTO gis_polygon VALUES\n (PolygonFromText(\'POLYGON((10 10,20 10,20 20,10 20,10\n10))\')),\n (PolyFromText(\'POLYGON((0 0,50 0,50 50,0 50,0 0), (10\n10,20 10,20 20,10 20,10 10))\'));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_polyfromtext/','','https://mariadb.com/kb/en/st_polyfromtext/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (40,3,'ST_PolygonFromText','A synonym for ST_PolyFromText.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_polygonfromtext/','','https://mariadb.com/kb/en/st_polygonfromtext/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (41,4,'Addition Operator (+)','Syntax\n------ \n+\n \nDescription\n----------- \nAddition.\n \nIf both operands are integers, the result is calculated with\nBIGINT precision. If either integer is unsigned, the result\nis also an unsigned integer.\n \nFor real or string operands, the operand with the highest\nprecision determines the result precision.\n \nExamples\n-------- \nSELECT 3+5;\n \n+-----+\n| 3+5 |\n+-----+\n| 8 |\n+-----+\n \n\n\nURL: https://mariadb.com/kb/en/addition-operator/','','https://mariadb.com/kb/en/addition-operator/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (42,4,'Subtraction Operator (-)','Syntax\n------ \n-\n \nDescription\n----------- \nSubtraction. The operator is also used as the unary minus\nfor changing sign.\n \nIf both operands are integers, the result is calculated with\nBIGINT precision. If either integer is unsigned, the result\nis also an unsigned integer, unless the\nNO_UNSIGNED_SUBTRACTION SQL_MODE is enabled, in which case\nthe result is always signed.\n \nFor real or string operands, the operand with the highest\nprecision determines the result precision.\n \nExamples\n-------- \nSELECT 96-9;\n \n+------+\n| 96-9 |\n+------+\n| 87 |\n+------+\n \nSELECT 15-17;\n \n+-------+\n| 15-17 |\n+-------+\n| -2 |\n+-------+\n \nSELECT 3.66 + 1.333;\n \n+--------------+\n| 3.66 + 1.333 |\n+--------------+\n| 4.993 |\n+--------------+\n \nUnary minus:\n \n SELECT - (3+5);\n+---------+\n| - (3+5) |\n+---------+\n| -8 |\n+---------+\n \n\n\nURL: https://mariadb.com/kb/en/subtraction-operator-/','','https://mariadb.com/kb/en/subtraction-operator-/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (43,4,'Division Operator (/)','Syntax\n------ \n/\n \nDescription\n----------- \nDivision operator. Dividing by zero will return NULL. By\ndefault, returns four digits after the decimal. This is\ndetermined by the server system variable\ndiv_precision_increment which by default is four. It can be\nset from 0 to 30.\n \nDividing by zero returns NULL. If the\nERROR_ON_DIVISION_BY_ZERO SQL_MODE is used (the default\nsince MariaDB 10.2.4), a division by zero also produces a\nwarning.\n \nExamples\n-------- \nSELECT 4/5;\n \n+--------+\n| 4/5 |\n+--------+\n| 0.8000 |\n+--------+\n \nSELECT 300/(2-2);\n+-----------+\n| 300/(2-2) |\n+-----------+\n| NULL |\n+-----------+\n \nSELECT 300/7;\n \n+---------+\n| 300/7 |\n+---------+\n| 42.8571 |\n+---------+\n \nChanging div_precision_increment for the session from the\ndefault of four to six:\n \nSET div_precision_increment = 6;\n \nSELECT 300/7;\n \n+-----------+\n| 300/7 |\n+-----------+\n| 42.857143 |\n+-----------+\n \nSELECT 300/7;\n \n+-----------+\n| 300/7 |\n+-----------+\n| 42.857143 |\n+-----------+\n \n\n\nURL: https://mariadb.com/kb/en/division-operator/','','https://mariadb.com/kb/en/division-operator/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (44,4,'Multiplication Operator (*)','Syntax\n------ \n*\n \nDescription\n----------- \nMultiplication operator.\n \nExamples\n-------- \nSELECT 7*6;\n \n+-----+\n| 7*6 |\n+-----+\n| 42 |\n+-----+\n \nSELECT 1234567890*9876543210;\n \n+-----------------------+\n| 1234567890*9876543210 |\n+-----------------------+\n| -6253480962446024716 |\n+-----------------------+\n \nSELECT 18014398509481984*18014398509481984.0;\n \n+---------------------------------------+\n| 18014398509481984*18014398509481984.0 |\n+---------------------------------------+\n| 324518553658426726783156020576256.0 |\n+---------------------------------------+\n \nSELECT 18014398509481984*18014398509481984;\n \n+-------------------------------------+\n| 18014398509481984*18014398509481984 |\n+-------------------------------------+\n| 0 |\n+-------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/multiplication-operator/','','https://mariadb.com/kb/en/multiplication-operator/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (45,4,'Modulo Operator (%)','Syntax\n------ \nN % M\n \nDescription\n----------- \nModulo operator. Returns the remainder of N divided by M.\nSee also MOD.\n \nExamples\n-------- \nSELECT 1042 % 50;\n \n+-----------+\n| 1042 % 50 |\n+-----------+\n| 42 |\n+-----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/modulo-operator/','','https://mariadb.com/kb/en/modulo-operator/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (46,4,'DIV','Syntax\n------ \nDIV\n \nDescription\n----------- \nInteger division. Similar to FLOOR(), but is safe with\nBIGINT values.\nIncorrect results may occur for non-integer operands that\nexceed BIGINT range.\n \nIf the ERROR_ON_DIVISION_BY_ZERO SQL_MODE is used, a\ndivision by zero produces an error. Otherwise, it returns\nNULL.\n \nThe remainder of a division can be obtained using the MOD\noperator.\n \nExamples\n-------- \nSELECT 300 DIV 7;\n \n+-----------+\n| 300 DIV 7 |\n+-----------+\n| 42 |\n+-----------+\n \nSELECT 300 DIV 0;\n \n+-----------+\n| 300 DIV 0 |\n+-----------+\n| NULL |\n+-----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/div/','','https://mariadb.com/kb/en/div/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (47,4,'ABS','Syntax\n------ \nABS(X)\n \nDescription\n----------- \nReturns the absolute (non-negative) value of X. If X is not\na number, it is converted to a numeric type.\n \nExamples\n-------- \nSELECT ABS(42);\n+---------+\n| ABS(42) |\n+---------+\n| 42 |\n+---------+\n \nSELECT ABS(-42);\n+----------+\n| ABS(-42) |\n+----------+\n| 42 |\n+----------+\n \nSELECT ABS(DATE \'1994-01-01\');\n+------------------------+\n| ABS(DATE \'1994-01-01\') |\n+------------------------+\n| 19940101 |\n+------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/abs/','','https://mariadb.com/kb/en/abs/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (48,4,'ACOS','Syntax\n------ \nACOS(X)\n \nDescription\n----------- \nReturns the arc cosine of X, that is, the value whose cosine\nis X.\nReturns NULL if X is not in the range -1 to 1.\n \nExamples\n-------- \nSELECT ACOS(1);\n+---------+\n| ACOS(1) |\n+---------+\n| 0 |\n+---------+\n \nSELECT ACOS(1.0001);\n+--------------+\n| ACOS(1.0001) |\n+--------------+\n| NULL |\n+--------------+\n \nSELECT ACOS(0);\n+-----------------+\n| ACOS(0) |\n+-----------------+\n| 1.5707963267949 |\n+-----------------+\n \nSELECT ACOS(0.234);\n+------------------+\n| ACOS(0.234) |\n+------------------+\n| 1.33460644244679 |\n+------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/acos/','','https://mariadb.com/kb/en/acos/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (49,4,'ASIN','Syntax\n------ \nASIN(X)\n \nDescription\n----------- \nReturns the arc sine of X, that is, the value whose sine is\nX. Returns\nNULL if X is not in the range -1 to 1.\n \nExamples\n-------- \nSELECT ASIN(0.2);\n+--------------------+\n| ASIN(0.2) |\n+--------------------+\n| 0.2013579207903308 |\n+--------------------+\n \nSELECT ASIN(\'foo\');\n+-------------+\n| ASIN(\'foo\') |\n+-------------+\n| 0 |\n+-------------+\n \nSHOW WARNINGS;\n \n+---------+------+-----------------------------------------+\n| Level | Code | Message |\n+---------+------+-----------------------------------------+\n| Warning | 1292 | Truncated incorrect DOUBLE value: \'foo\'\n|\n+---------+------+-----------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/asin/','','https://mariadb.com/kb/en/asin/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (50,4,'ATAN','Syntax\n------ \nATAN(X)\n \nDescription\n----------- \nReturns the arc tangent of X, that is, the value whose\ntangent is X.\n \nExamples\n-------- \nSELECT ATAN(2);\n+--------------------+\n| ATAN(2) |\n+--------------------+\n| 1.1071487177940904 |\n+--------------------+\n \nSELECT ATAN(-2);\n+---------------------+\n| ATAN(-2) |\n+---------------------+\n| -1.1071487177940904 |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/atan/','','https://mariadb.com/kb/en/atan/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (51,4,'ATAN2','Syntax\n------ \nATAN(Y,X), ATAN2(Y,X)\n \nDescription\n----------- \nReturns the arc tangent of the two variables X and Y. It is\nsimilar to\ncalculating the arc tangent of Y / X, except that the signs\nof both\narguments are used to determine the quadrant of the result.\n \nExamples\n-------- \nSELECT ATAN(-2,2);\n+---------------------+\n| ATAN(-2,2) |\n+---------------------+\n| -0.7853981633974483 |\n+---------------------+\n \nSELECT ATAN2(PI(),0);\n+--------------------+\n| ATAN2(PI(),0) |\n+--------------------+\n| 1.5707963267948966 |\n+--------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/atan2/','','https://mariadb.com/kb/en/atan2/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (52,4,'CEIL','Syntax\n------ \nCEIL(X)\n \nDescription\n----------- \nCEIL() is a synonym for CEILING().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/ceil/','','https://mariadb.com/kb/en/ceil/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (53,4,'CEILING','Syntax\n------ \nCEILING(X)\n \nDescription\n----------- \nReturns the smallest integer value not less than X.\n \nExamples\n-------- \nSELECT CEILING(1.23);\n+---------------+\n| CEILING(1.23) |\n+---------------+\n| 2 |\n+---------------+\n \nSELECT CEILING(-1.23);\n+----------------+\n| CEILING(-1.23) |\n+----------------+\n| -1 |\n+----------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/ceiling/','','https://mariadb.com/kb/en/ceiling/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (54,4,'CONV','Syntax\n------ \nCONV(N,from_base,to_base)\n \nDescription\n----------- \nConverts numbers between different number bases. Returns a\nstring\nrepresentation of the number N, converted from base\nfrom_base\nto base to_base.\n \nReturns NULL if any argument is NULL, or if the second or\nthird argument are not in the allowed range.\n \nThe argument N is interpreted as an integer, but may be\nspecified as an\ninteger or a string. The minimum base is 2 and the maximum\nbase is 36. If\nto_base is a negative number, N is regarded as a signed\nnumber.\nOtherwise, N is treated as unsigned. CONV() works with\n64-bit\nprecision.\n \nSome shortcuts for this function are also available: BIN(),\nOCT(), HEX(), UNHEX(). Also, MariaDB allows binary literal\nvalues and hexadecimal literal values.\n \nExamples\n-------- \nSELECT CONV(\'a\',16,2);\n+----------------+\n| CONV(\'a\',16,2) |\n+----------------+\n| 1010 |\n+----------------+\n \nSELECT CONV(\'6E\',18,8);\n+-----------------+\n| CONV(\'6E\',18,8) |\n+-----------------+\n| 172 |\n+-----------------+\n \nSELECT CONV(-17,10,-18);\n+------------------+\n| CONV(-17,10,-18) |\n+------------------+\n| -H |\n+------------------+\n \nSELECT CONV(12+\'10\'+\'10\'+0xa,10,10);\n+------------------------------+\n| CONV(12+\'10\'+\'10\'+0xa,10,10) |\n+------------------------------+\n| 42 |\n+------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/conv/','','https://mariadb.com/kb/en/conv/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (55,4,'COS','Syntax\n------ \nCOS(X)\n \nDescription\n----------- \nReturns the cosine of X, where X is given in radians.\n \nExamples\n-------- \nSELECT COS(PI());\n+-----------+\n| COS(PI()) |\n+-----------+\n| -1 |\n+-----------\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/cos/','','https://mariadb.com/kb/en/cos/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (56,4,'COT','Syntax\n------ \nCOT(X)\n \nDescription\n----------- \nReturns the cotangent of X.\n \nExamples\n-------- \nSELECT COT(42);\n+--------------------+\n| COT(42) |\n+--------------------+\n| 0.4364167060752729 |\n+--------------------+\n \nSELECT COT(12);\n+---------------------+\n| COT(12) |\n+---------------------+\n| -1.5726734063976893 |\n+---------------------+\n \nSELECT COT(0);\nERROR 1690 (22003): DOUBLE value is out of range in\n\'cot(0)\'\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/cot/','','https://mariadb.com/kb/en/cot/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (57,4,'CRC32','Syntax\n------ \nCRC32(expr)\n \nDescription\n----------- \nComputes a cyclic redundancy check value and returns a\n32-bit unsigned\nvalue. The result is NULL if the argument is NULL. The\nargument is\nexpected to be a string and (if possible) is treated as one\nif it is\nnot.\n \nExamples\n-------- \nSELECT CRC32(\'MariaDB\');\n+------------------+\n| CRC32(\'MariaDB\') |\n+------------------+\n| 4227209140 |\n+------------------+\n \nSELECT CRC32(\'mariadb\');\n+------------------+\n| CRC32(\'mariadb\') |\n+------------------+\n| 2594253378 |\n+------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/crc32/','','https://mariadb.com/kb/en/crc32/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (58,4,'DEGREES','Syntax\n------ \nDEGREES(X)\n \nDescription\n----------- \nReturns the argument X, converted from radians to degrees.\n \nThis is the converse of the RADIANS() function.\n \nExamples\n-------- \nSELECT DEGREES(PI());\n+---------------+\n| DEGREES(PI()) |\n+---------------+\n| 180 |\n+---------------+\n \nSELECT DEGREES(PI() / 2);\n+-------------------+\n| DEGREES(PI() / 2) |\n+-------------------+\n| 90 |\n+-------------------+\n \nSELECT DEGREES(45);\n+-----------------+\n| DEGREES(45) |\n+-----------------+\n| 2578.3100780887 |\n+-----------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/degrees/','','https://mariadb.com/kb/en/degrees/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (59,4,'EXP','Syntax\n------ \nEXP(X)\n \nDescription\n----------- \nReturns the value of e (the base of natural logarithms)\nraised to the\npower of X. The inverse of this function is LOG() (using a\nsingle\nargument only) or LN().\n \nIf X is NULL, this function returns NULL.\n \nExamples\n-------- \nSELECT EXP(2);\n+------------------+\n| EXP(2) |\n+------------------+\n| 7.38905609893065 |\n+------------------+\n \nSELECT EXP(-2);\n+--------------------+\n| EXP(-2) |\n+--------------------+\n| 0.1353352832366127 |\n+--------------------+\n \nSELECT EXP(0);\n+--------+\n| EXP(0) |\n+--------+\n| 1 |\n+--------+\n \nSELECT EXP(NULL);\n+-----------+\n| EXP(NULL) |\n+-----------+\n| NULL |\n+-----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/exp/','','https://mariadb.com/kb/en/exp/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (60,4,'FLOOR','Syntax\n------ \nFLOOR(X)\n \nDescription\n----------- \nReturns the largest integer value not greater than X.\n \nExamples\n-------- \nSELECT FLOOR(1.23);\n+-------------+\n| FLOOR(1.23) |\n+-------------+\n| 1 |\n+-------------+\n \nSELECT FLOOR(-1.23);\n+--------------+\n| FLOOR(-1.23) |\n+--------------+\n| -2 |\n+--------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/floor/','','https://mariadb.com/kb/en/floor/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (61,4,'LN','Syntax\n------ \nLN(X)\n \nDescription\n----------- \nReturns the natural logarithm of X; that is, the base-e\nlogarithm of X.\nIf X is less than or equal to 0, or NULL, then NULL is\nreturned.\n \nThe inverse of this function is EXP().\n \nExamples\n-------- \nSELECT LN(2);\n+-------------------+\n| LN(2) |\n+-------------------+\n| 0.693147180559945 |\n+-------------------+\n \nSELECT LN(-2);\n+--------+\n| LN(-2) |\n+--------+\n| NULL |\n+--------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/ln/','','https://mariadb.com/kb/en/ln/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (62,4,'LOG','Syntax\n------ \nLOG(X), LOG(B,X)\n \nDescription\n----------- \nIf called with one parameter, this function returns the\nnatural\nlogarithm of X. If X is less than or equal to 0, then NULL\nis\nreturned.\n \nIf called with two parameters, it returns the logarithm of X\nto the base B. If B is \n\nURL: https://mariadb.com/kb/en/log/','','https://mariadb.com/kb/en/log/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (63,4,'LOG10','Syntax\n------ \nLOG10(X)\n \nDescription\n----------- \nReturns the base-10 logarithm of X.\n \nExamples\n-------- \nSELECT LOG10(2);\n+-------------------+\n| LOG10(2) |\n+-------------------+\n| 0.301029995663981 |\n+-------------------+\n \nSELECT LOG10(100);\n+------------+\n| LOG10(100) |\n+------------+\n| 2 |\n+------------+\n \nSELECT LOG10(-100);\n+-------------+\n| LOG10(-100) |\n+-------------+\n| NULL |\n+-------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/log10/','','https://mariadb.com/kb/en/log10/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (64,4,'LOG2','Syntax\n------ \nLOG2(X)\n \nDescription\n----------- \nReturns the base-2 logarithm of X.\n \nExamples\n-------- \nSELECT LOG2(4398046511104);\n+---------------------+\n| LOG2(4398046511104) |\n+---------------------+\n| 42 |\n+---------------------+\n \nSELECT LOG2(65536);\n+-------------+\n| LOG2(65536) |\n+-------------+\n| 16 |\n+-------------+\n \nSELECT LOG2(-100);\n+------------+\n| LOG2(-100) |\n+------------+\n| NULL |\n+------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/log2/','','https://mariadb.com/kb/en/log2/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (65,4,'MOD','Syntax\n------ \nMOD(N,M), N % M, N MOD M\n \nDescription\n----------- \nModulo operation. Returns the remainder of N divided by M.\nSee also Modulo Operator.\n \nIf the ERROR_ON_DIVISION_BY_ZERO SQL_MODE is used, any\nnumber modulus zero produces an error. Otherwise, it returns\nNULL.\n \nThe integer part of a division can be obtained using DIV.\n \nExamples\n-------- \nSELECT 1042 % 50;\n \n+-----------+\n| 1042 % 50 |\n+-----------+\n| 42 |\n+-----------+\n \nSELECT MOD(234, 10);\n+--------------+\n| MOD(234, 10) |\n+--------------+\n| 4 |\n+--------------+\n \nSELECT 253 % 7;\n \n+---------+\n| 253 % 7 |\n+---------+\n| 1 |\n+---------+\n \nSELECT MOD(29,9);\n+-----------+\n| MOD(29,9) |\n+-----------+\n| 2 |\n+-----------+\n \nSELECT 29 MOD 9;\n \n+----------+\n| 29 MOD 9 |\n+----------+\n| 2 |\n+----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/mod/','','https://mariadb.com/kb/en/mod/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (66,4,'OCT','Syntax\n------ \nOCT(N)\n \nDescription\n----------- \nReturns a string representation of the octal value of N,\nwhere N is a longlong (BIGINT) number. This is equivalent to\nCONV(N,10,8). Returns NULL if N is NULL.\n \nExamples\n-------- \nSELECT OCT(34);\n+---------+\n| OCT(34) |\n+---------+\n| 42 |\n+---------+\n \nSELECT OCT(12);\n+---------+\n| OCT(12) |\n+---------+\n| 14 |\n+---------+\n \n\n\nURL: https://mariadb.com/kb/en/oct/','','https://mariadb.com/kb/en/oct/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (67,4,'PI','Syntax\n------ \nPI()\n \nDescription\n----------- \nReturns the value of π (pi). The default number of decimal\nplaces\ndisplayed is six, but MariaDB uses the full double-precision\nvalue\ninternally.\n \nExamples\n-------- \nSELECT PI();\n+----------+\n| PI() |\n+----------+\n| 3.141593 |\n+----------+\n \nSELECT PI()+0.0000000000000000000000;\n \n+-------------------------------+\n| PI()+0.0000000000000000000000 |\n+-------------------------------+\n| 3.1415926535897931159980 |\n+-------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/pi/','','https://mariadb.com/kb/en/pi/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (68,4,'POW','Syntax\n------ \nPOW(X,Y)\n \nDescription\n----------- \nReturns the value of X raised to the power of Y.\n \nPOWER() is a synonym.\n \nExamples\n-------- \nSELECT POW(2,3);\n+----------+\n| POW(2,3) |\n+----------+\n| 8 |\n+----------+\n \nSELECT POW(2,-2);\n+-----------+\n| POW(2,-2) |\n+-----------+\n| 0.25 |\n+-----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/pow/','','https://mariadb.com/kb/en/pow/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (69,4,'POWER','Syntax\n------ \nPOWER(X,Y)\n \nDescription\n----------- \nThis is a synonym for POW(), which returns the value of X\nraised to the power of Y.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/power/','','https://mariadb.com/kb/en/power/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (70,4,'RADIANS','Syntax\n------ \nRADIANS(X)\n \nDescription\n----------- \nReturns the argument X, converted from degrees to radians.\nNote that\nπ radians equals 180 degrees. \n \nThis is the converse of the DEGREES() function.\n \nExamples\n-------- \nSELECT RADIANS(45);\n+-------------------+\n| RADIANS(45) |\n+-------------------+\n| 0.785398163397448 |\n+-------------------+\n \nSELECT RADIANS(90);\n+-----------------+\n| RADIANS(90) |\n+-----------------+\n| 1.5707963267949 |\n+-----------------+\n \nSELECT RADIANS(PI());\n+--------------------+\n| RADIANS(PI()) |\n+--------------------+\n| 0.0548311355616075 |\n+--------------------+\n \nSELECT RADIANS(180);\n+------------------+\n| RADIANS(180) |\n+------------------+\n| 3.14159265358979 |\n+------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/radians/','','https://mariadb.com/kb/en/radians/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (71,4,'RAND','Syntax\n------ \nRAND(), RAND(N)\n \nDescription\n----------- \nReturns a random DOUBLE precision floating point value v in\nthe range 0 \n\nURL: https://mariadb.com/kb/en/rand/','','https://mariadb.com/kb/en/rand/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (72,4,'ROUND','Syntax\n------ \nROUND(X), ROUND(X,D)\n \nDescription\n----------- \nRounds the argument X to D decimal places. The rounding\nalgorithm\ndepends on the data type of X. D defaults to 0 if not\nspecified.\nD can be negative to cause D digits left of the decimal\npoint of the\nvalue X to become zero.\n \nExamples\n-------- \nSELECT ROUND(-1.23);\n+--------------+\n| ROUND(-1.23) |\n+--------------+\n| -1 |\n+--------------+\n \nSELECT ROUND(-1.58);\n+--------------+\n| ROUND(-1.58) |\n+--------------+\n| -2 |\n+--------------+\n \nSELECT ROUND(1.58); \n+-------------+\n| ROUND(1.58) |\n+-------------+\n| 2 |\n+-------------+\n \nSELECT ROUND(1.298, 1);\n+-----------------+\n| ROUND(1.298, 1) |\n+-----------------+\n| 1.3 |\n+-----------------+\n \nSELECT ROUND(1.298, 0);\n+-----------------+\n| ROUND(1.298, 0) |\n+-----------------+\n| 1 |\n+-----------------+\n \nSELECT ROUND(23.298, -1);\n+-------------------+\n| ROUND(23.298, -1) |\n+-------------------+\n| 20 |\n+-------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/round/','','https://mariadb.com/kb/en/round/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (73,4,'SIGN','Syntax\n------ \nSIGN(X)\n \nDescription\n----------- \nReturns the sign of the argument as -1, 0, or 1, depending\non whether\nX is negative, zero, or positive.\n \nExamples\n-------- \nSELECT SIGN(-32);\n+-----------+\n| SIGN(-32) |\n+-----------+\n| -1 |\n+-----------+\n \nSELECT SIGN(0);\n+---------+\n| SIGN(0) |\n+---------+\n| 0 |\n+---------+\n \nSELECT SIGN(234);\n+-----------+\n| SIGN(234) |\n+-----------+\n| 1 |\n+-----------+\n \n\n\nURL: https://mariadb.com/kb/en/sign/','','https://mariadb.com/kb/en/sign/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (74,4,'SIN','Syntax\n------ \nSIN(X)\n \nDescription\n----------- \nReturns the sine of X, where X is given in radians.\n \nExamples\n-------- \nSELECT SIN(1.5707963267948966);\n+-------------------------+\n| SIN(1.5707963267948966) |\n+-------------------------+\n| 1 |\n+-------------------------+\n \nSELECT SIN(PI());\n+----------------------+\n| SIN(PI()) |\n+----------------------+\n| 1.22460635382238e-16 |\n+----------------------+\n \nSELECT ROUND(SIN(PI()));\n+------------------+\n| ROUND(SIN(PI())) |\n+------------------+\n| 0 |\n+------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/sin/','','https://mariadb.com/kb/en/sin/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (75,4,'SQRT','Syntax\n------ \nSQRT(X)\n \nDescription\n----------- \nReturns the square root of X. If X is negative, NULL is\nreturned.\n \nExamples\n-------- \nSELECT SQRT(4);\n+---------+\n| SQRT(4) |\n+---------+\n| 2 |\n+---------+\n \nSELECT SQRT(20);\n+------------------+\n| SQRT(20) |\n+------------------+\n| 4.47213595499958 |\n+------------------+\n \nSELECT SQRT(-16);\n+-----------+\n| SQRT(-16) |\n+-----------+\n| NULL |\n+-----------+\n \nSELECT SQRT(1764);\n+------------+\n| SQRT(1764) |\n+------------+\n| 42 |\n+------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/sqrt/','','https://mariadb.com/kb/en/sqrt/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (76,4,'TAN','Syntax\n------ \nTAN(X)\n \nDescription\n----------- \nReturns the tangent of X, where X is given in radians.\n \nExamples\n-------- \nSELECT TAN(0.7853981633974483);\n+-------------------------+\n| TAN(0.7853981633974483) |\n+-------------------------+\n| 0.9999999999999999 |\n+-------------------------+\n \nSELECT TAN(PI());\n+-----------------------+\n| TAN(PI()) |\n+-----------------------+\n| -1.22460635382238e-16 |\n+-----------------------+\n \nSELECT TAN(PI()+1);\n+-----------------+\n| TAN(PI()+1) |\n+-----------------+\n| 1.5574077246549 |\n+-----------------+\n \nSELECT TAN(RADIANS(PI()));\n+--------------------+\n| TAN(RADIANS(PI())) |\n+--------------------+\n| 0.0548861508080033 |\n+--------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/tan/','','https://mariadb.com/kb/en/tan/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (77,4,'TRUNCATE','This page documents the TRUNCATE function. See TRUNCATE\nTABLE for the DDL statement.\n \nSyntax\n------ \nTRUNCATE(X,D)\n \nDescription\n----------- \nReturns the number X, truncated to D decimal places. If D is\n0, the\nresult has no decimal point or fractional part. D can be\nnegative to\ncause D digits left of the decimal point of the value X to\nbecome\nzero.\n \nExamples\n-------- \nSELECT TRUNCATE(1.223,1);\n+-------------------+\n| TRUNCATE(1.223,1) |\n+-------------------+\n| 1.2 |\n+-------------------+\n \nSELECT TRUNCATE(1.999,1);\n+-------------------+\n| TRUNCATE(1.999,1) |\n+-------------------+\n| 1.9 |\n+-------------------+\n \nSELECT TRUNCATE(1.999,0); \n+-------------------+\n| TRUNCATE(1.999,0) |\n+-------------------+\n| 1 |\n+-------------------+\n \nSELECT TRUNCATE(-1.999,1);\n+--------------------+\n| TRUNCATE(-1.999,1) |\n+--------------------+\n| -1.9 |\n+--------------------+\n \nSELECT TRUNCATE(122,-2);\n+------------------+\n| TRUNCATE(122,-2) |\n+------------------+\n| 100 |\n+------------------+\n \nSELECT TRUNCATE(10.28*100,0);\n+-----------------------+\n| TRUNCATE(10.28*100,0) |\n+-----------------------+\n| 1028 |\n+-----------------------+\n \n\n\nURL: https://mariadb.com/kb/en/truncate/','','https://mariadb.com/kb/en/truncate/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (78,5,'Plugin Overview','Plugins are server components that enhance MariaDB in some\nway. These can be anything from new storage engines, plugins\nfor enhancing full-text parsing, or even small enhancements,\nsuch as a plugin to get a timestamp as an integer.\n \nQuerying Plugin Information\n \nThere are a number of ways to see which plugins are\ncurrently active.\n \nA server almost always has a large number of active plugins,\nbecause the server contains a large number of built-in\nplugins, which are active by default and cannot be\nuninstalled.\n \nQuerying Plugin Information with SHOW PLUGINS\n \nThe SHOW PLUGINS statement can be used to query information\nabout all active plugins.\n \nFor example:\n \nSHOW PLUGINS;\n \n+----------------------------+----------+--------------------+---------+---------+\n| Name | Status | Type | Library | License |\n+----------------------------+----------+--------------------+---------+---------+\n...\n| mysql_native_password | ACTIVE | AUTHENTICATION | NULL |\nGPL |\n| mysql_old_password | ACTIVE | AUTHENTICATION | NULL | GPL\n|\n| MRG_MyISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |\n...\n+----------------------------+----------+--------------------+---------+---------+\n \nIf a plugin\'s Library column has the NULL value, then the\nplugin is built-in, and it cannot be uninstalled.\n \nQuerying Plugin Information with information_schema.PLUGINS\n \nThe information_schema.PLUGINS table can be queried to get\nmore detailed information about plugins.\n \nFor example:\n \nSELECT * FROM information_schema.PLUGINS\\G\n...\n*************************** 6. row\n***************************\n PLUGIN_NAME: CSV\n PLUGIN_VERSION: 1.0\n PLUGIN_STATUS: ACTIVE\n PLUGIN_TYPE: STORAGE ENGINE\n PLUGIN_TYPE_VERSION: 100003.0\n PLUGIN_LIBRARY: NULL\nPLUGIN_LIBRARY_VERSION: NULL\n PLUGIN_AUTHOR: Brian Aker, MySQL AB\n PLUGIN_DESCRIPTION: CSV storage engine\n PLUGIN_LICENSE: GPL\n LOAD_OPTION: FORCE\n PLUGIN_MATURITY: Stable\n PLUGIN_AUTH_VERSION: 1.0\n*************************** 7. row\n***************************\n PLUGIN_NAME: MEMORY\n PLUGIN_VERSION: 1.0\n PLUGIN_STATUS: ACTIVE\n PLUGIN_TYPE: STORAGE ENGINE\n PLUGIN_TYPE_VERSION: 100003.0\n PLUGIN_LIBRARY: NULL\nPLUGIN_LIBRARY_VERSION: NULL\n PLUGIN_AUTHOR: MySQL AB\n PLUGIN_DESCRIPTION: Hash based, stored in memory, useful\nfor temporary tables\n PLUGIN_LICENSE: GPL\n LOAD_OPTION: FORCE\n PLUGIN_MATURITY: Stable\n PLUGIN_AUTH_VERSION: 1.0\n...\n \nIf a plugin\'s PLUGIN_LIBRARY column has the NULL value,\nthen the plugin is built-in, and it cannot be uninstalled.\n \nQuerying Plugin Information with mysql.plugin\n \nThe mysql.plugin table can be queried to get information\nabout installed plugins.\n \nThis table only contains information about plugins that have\nbeen installed via the following methods:\nThe INSTALL SONAME statement.\nThe INSTALL PLUGIN statement.\nThe mysql_plugin utility.\n \nThis table does not contain information about:\nBuilt-in plugins.\nPlugins loaded with the --plugin-load-add option.\nPlugins loaded with the --plugin-load option.\n \nThis table only contains enough information to reload the\nplugin when the server is restarted, which means it only\ncontains the plugin name and the plugin library.\n \nFor example:\n \nSELECT * FROM mysql.plugin;\n \n+------+------------+\n| name | dl |\n+------+------------+\n| PBXT | libpbxt.so |\n+------+------------+\n \nInstalling a Plugin\n \nThere are three primary ways to install a plugin:\nA plugin can be installed dynamically with an SQL statement.\nA plugin can be installed with a mysqld option, but it\nrequires a server restart.\nA plugin can be installed with the mysql_plugin utility,\nwhile the server is completely offline.\n \nWhen you are installing a plugin, you also have to ensure\nthat:\nThe server\'s plugin directory is properly configured, and\nthe plugin\'s library is in the plugin directory.\nThe server\'s minimum plugin maturity is properly\nconfigured, and the plugin is mature enough to be installed.\n \nInstalling a Plugin Dynamically\n \nA plugin can be installed dynamically by executing either\nthe INSTALL SONAME or the INSTALL PLUGIN statement.\n \nIf a plugin is installed with one of these statements, then\na record will be added to the mysql.plugins table for the\nplugin. This means that the plugin will automatically be\nloaded every time the server restarts, unless specifically\nuninstalled or deactivated.\n \nInstalling a Plugin with INSTALL SONAME\n \nYou can install a plugin dynamically by executing the\nINSTALL SONAME statement. INSTALL SONAME installs all\nplugins from the given plugin library. This could be\nrequired for some plugin libraries.\n \nFor example, to install all plugins in the server_audit\nplugin library (which is currently only the server_audit\naudit plugin), you could execute the following:\n \nINSTALL SONAME \'server_audit\';\n \nInstalling a Plugin with INSTALL PLUGIN\n \nYou can install a plugin dynamically by executing the\nINSTALL PLUGIN statement. INSTALL PLUGIN installs a single\nplugin from the given plugin library.\n \nFor example, to install the server_audit audit plugin from\nthe server_audit plugin library, you could execute the\nfollowing:\n \nINSTALL PLUGIN server_audit SONAME \'server_audit\';\n \nInstalling a Plugin with Plugin Load Options\n \nA plugin can be installed with a mysqld option by providing\neither the --plugin-load-add or the --plugin-load option.\n \nIf a plugin is installed with one of these options, then a\nrecord will not be added to the mysql.plugins table for the\nplugin. This means that if the server is restarted without\nthe same option set, then the plugin will not automatically\nbe loaded.\n \nInstalling a Plugin with --plugin-load-add\n \nYou can install a plugin with the --plugin-load-add option\nby specifying the option as a command-line argument to\nmysqld or by specifying the option in a relevant server\noption group in an option file.\n \nThe --plugin-load-add option uses the following format:\nPlugins can be specified in the format name=library, where\nname is the plugin name and library is the plugin library.\nThis format installs a single plugin from the given plugin\nlibrary.\nPlugins can also be specified in the format library, where\nlibrary is the plugin library. This format installs all\nplugins from the given plugin library.\nMultiple plugins can be specified by separating them with\nsemicolons.\n \nFor example, to install all plugins in the server_audit\nplugin library (which is currently only the server_audit\naudit plugin) and also the ed25519 authentication plugin\nfrom the auth_ed25519 plugin library, you could set the\noption to the following values on the command-line:\n \n$ mysqld --user=mysql --plugin-load-add=\'server_audit\'\n--plugin-load-add=\'ed25519=auth_ed25519\'\n \nYou could also set the option to the same values in an\noption file:\n \n[mariadb]\n...\nplugin_load_add = server_audit\nplugin_load_add = ed25519=auth_ed25519\n \nSpecial care must be taken when specifying both the\n--plugin-load option and the --plugin-load-add option\ntogether. The --plugin-load option resets the plugin load\nlist, and this can cause unexpected problems if you are not\naware. The --plugin-load-add option does not reset the\nplugin load list, so it is much safer to use. See Specifying\nMultiple Plugin Load Options for more information.\n \nInstalling a Plugin with --plugin-load\n \nYou can install a plugin with the --plugin-load option by\nspecifying the option as a command-line argument to mysqld\nor by specifying the option in a relevant server option\ngroup in an option file.\n \nThe --plugin-load option uses the following format:\nPlugins can be specified in the format name=library, where\nname is the plugin name and library is the plugin library.\nThis format installs a single plugin from the given plugin\nlibrary.\nPlugins can also be specified in the format library, where\nlibrary is the plugin library. This format installs all\nplugins from the given plugin library.\nMultiple plugins can be specified by separating them with\nsemicolons.\n \nFor example, to install all plugins in the server_audit\nplugin library (which is currently only the server_audit\naudit plugin) and also the ed25519 authentication plugin\nfrom the auth_ed25519 plugin library, you could set the\noption to the following values on the command-line:\n \n$ mysqld --user=mysql\n--plugin-load=\'server_audit;ed25519=auth_ed25519\'\n \nYou could also set the option to the same values in an\noption file:\n \n[mariadb]\n...\nplugin_load = server_audit;ed25519=auth_ed25519\n \nSpecial care must be taken when specifying the --plugin-load\noption multiple times, or when specifying both the\n--plugin-load option and the --plugin-load-add option\ntogether. The --plugin-load option resets the plugin load\nlist, and this can cause unexpected problems if you are not\naware. The --plugin-load-add option does not reset the\nplugin load list, so it is much safer to use. See Specifying\nMultiple Plugin Load Options for more information.\n \nSpecifying Multiple Plugin Load Options\n \nSpecial care must be taken when specifying the --plugin-load\noption multiple times, or when specifying both the\n--plugin-load option and the --plugin-load-add option. The\n--plugin-load option resets the plugin load list, and this\ncan cause unexpected problems if you are not aware. The\n--plugin-load-add option does not reset the plugin load\nlist, so it is much safer to use.\n \nThis can have the following consequences:\nIf the --plugin-load option is specified multiple times,\nthen only the last instance will have any effect. For\nexample, in the following case, the first instance of the\noption is reset:\n \n[mariadb]\n...\nplugin_load = server_audit\nplugin_load = ed25519=auth_ed25519\nIf the --plugin-load option is specified after the\n--plugin-load-add option, then it will also reset the\nchanges made by that option. For example, in the following\ncase, the --plugin-load-add option does not do anything,\nbecause the subsequent --plugin-load option resets the\nplugin load list:\n \n[mariadb]\n...\nplugin_load_add = server_audit\nplugin_load = ed25519=auth_ed25519\nIn contrast, if the --plugin-load option is specified before\nthe --plugin-load-add option, then it will work fine,\nbecause the --plugin-load-add option does not reset the\nplugin load list. For example, in the following case, both\nplugins are properly loaded:\n \n[mariadb]\n...\nplugin_load = server_audit\nplugin_load_add = ed25519=auth_ed25519\n \nInstalling a Plugin with mysql_plugin\n \nA plugin can be installed with the mysql_plugin utility if\nthe server is completely offline. \n \nThe syntax is:\n \nmysql_plugin [options] \n ENABLE|DISABLE\n \nFor example, to install the server_audit audit plugin, you\ncould execute the following:\n \nmysql_plugin server_audit ENABLE\n \nIf a plugin is installed with this utility, then a record\nwill be added to the mysql.plugins table for the plugin.\nThis means that the plugin will automatically be loaded\nevery time the server restarts, unless specifically\nuninstalled or deactivated.\n \nConfiguring the Plugin Directory\n \nWhen a plugin is being installed, the server looks for the\nplugin\'s library in the server\'s plugin directory. This\ndirectory is configured by the plugin_dir system variable.\nThis can be specified as a command-line argument to mysqld\nor it can be specified in a relevant server option group in\nan option file. For example:\n \n[mariadb]\n...\nplugin_dir = /usr/lib64/mysql/plugin\n \nConfiguring the Minimum Plugin Maturity\n \nWhen a plugin is being installed, the server compares the\nplugin\'s maturity level against the server\'s minimum\nallowed plugin maturity. This can help prevent users from\nusing unstable plugins on production servers. This minimum\nplugin maturity is configured by the plugin_maturity system\nvariable. This can be specified as a command-line argument\nto mysqld or it can be specified in a relevant server option\ngroup in an option file. For example:\n \n[mariadb]\n...\nplugin_maturity = stable\n \nConfiguring Plugin Activation at Server Startup\n \nA plugin will be loaded by default when the server starts\nif:\nThe plugin was installed with the INSTALL SONAME statement.\nThe plugin was installed with the INSTALL PLUGIN statement.\nThe plugin was installed with the mysql_plugin utility.\nThe server is configured to load the plugin with the\n--plugin-load-add option.\nThe server is configured to load the plugin with the\n--plugin-load option.\n \nThis behavior can be changed with special options that take\nthe form --plugin-name. For example, for the server_audit\naudit plugin, the special option is called --server-audit.\n \nThe possible values for these special options are:\n \nOption Value | Description | \n \nOFF | Disables the plugin without removing it from the\nmysql.plugins table. | \n \nON | Enables the plugin. If the plugin cannot be\ninitialized, then the server will still continue starting\nup, but the plugin will be disabled. | \n \nFORCE | Enables the plugin. If the plugin cannot be\ninitialized, then the server will fail to start with an\nerror. | \n \nFORCE_PLUS_PERMANENT | Enables the plugin. If the plugin\ncannot be initialized, then the server will fail to start\nwith an error. In addition, the plugin cannot be uninstalled\nwith UNINSTALL SONAME or UNINSTALL PLUGIN while the server\nis running. | \n \nA plugin\'s status can be found by looking at the\nPLUGIN_STATUS column of the information_schema.PLUGINS\ntable.\n \nUninstalling Plugins\n \nPlugins that are found in the mysql.plugin table, that is\nthose that were installed with INSTALL SONAME, INSTALL\nPLUGIN or mysql_plugin can be uninstalled in one of two\nways:\nThe UNINSTALL SONAME or the UNINSTALL PLUGIN statement while\nthe server is running\nWith mysql_plugin while the server is offline.\n \nPlugins that were enabled as a --plugin-load option do not\nneed to be uninstalled. If --plugin-load is omitted the next\ntime the server starts, or the plugin is not listed as one\nof the --plugin-load entries, the plugin will not be loaded.\n \nUNINSTALL PLUGIN uninstalls a single installed plugin, while\nUNINSTALL SONAME uninstalls all plugins belonging to a given\nlibrary.\n \n\n\nURL: https://mariadb.com/kb/en/plugin-overview/','','https://mariadb.com/kb/en/plugin-overview/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (79,5,'INSTALL PLUGIN','Syntax\n------ \nINSTALL PLUGIN [IF NOT EXISTS] plugin_name SONAME\n\'plugin_library\'\n \nDescription\n----------- \nThis statement installs an individual plugin from the\nspecified library. To install the whole library (which could\nbe required), use INSTALL SONAME.\n \nplugin_name is the name of the plugin as defined in the\nplugin declaration structure contained in the library file.\nPlugin names are\nnot case sensitive. For maximal compatibility, plugin names\nshould be limited\nto ASCII letters, digits, and underscore, because they are\nused in C source\nfiles, shell command lines, M4 and Bourne shell scripts, and\nSQL environments.\n \nplugin_library is the name of the shared library that\ncontains the plugin code. Before MariaDB 5.5.21, the name\nshould include the file name extension (for\nexample, libmyplugin.so or libmyplugin.dll). Starting from\nMariaDB 5.5.21, the file name extension can be omitted\n(which makes the statement look the same on all\narchitectures).\n \nThe shared library must be located in the plugin directory\n(that is,\nthe directory named by the plugin_dir system variable). The\nlibrary must be in the plugin directory itself, not in a\nsubdirectory. By\ndefault, plugin_dir is plugin directory under the directory\nnamed by\nthe pkglibdir configuration variable, but it can be changed\nby setting\nthe value of plugin_dir at server startup. For example, set\nits value in a my.cnf file:\n \n[mysqld]\nplugin_dir=/path/to/plugin/directory\nIf the value of plugin_dir is a relative path name, it is\ntaken to be relative to the MySQL base directory (the value\nof the basedir\nsystem variable).\n \nINSTALL PLUGIN adds a line to the mysql.plugin table that\ndescribes the plugin. This table contains the plugin name\nand library file\nname.\n \nINSTALL PLUGIN causes the server to read\noption (my.cnf) files just as during server startup. This\nenables the plugin to\npick up any relevant options from those files. It is\npossible to add plugin\noptions to an option file even before loading a plugin (if\nthe loose prefix is\nused). It is also possible to uninstall a plugin, edit\nmy.cnf, and install the\nplugin again. Restarting the plugin this way enables it to\nthe new option\nvalues without a server restart.\n \nBefore MySQL 5.1.33, a plugin was started with each option\nset to its\ndefault value.\n \nINSTALL PLUGIN also loads and initializes the plugin code to\nmake the plugin available for use. A plugin is initialized\nby executing its\ninitialization function, which handles any setup that the\nplugin must perform\nbefore it can be used.\n \nTo use INSTALL PLUGIN, you must have the\nINSERT privilege for the mysql.plugin table.\n \nAt server startup, the server loads and initializes any\nplugin that is\nlisted in the mysql.plugin table. This means that a plugin\nis installed\nwith INSTALL PLUGIN only once, not every time the server\nstarts. Plugin loading at startup does not occur if the\nserver is started with\nthe --skip-grant-tables option.\n \nWhen the server shuts down, it executes the deinitialization\nfunction\nfor each plugin that is loaded so that the plugin has a\nchance to\nperform any final cleanup.\n \nIf you need to load plugins for a single server startup when\nthe\n--skip-grant-tables option is given (which tells the server\nnot to read system tables), use the \n--plugin-load mysqld option.\n \nIF NOT EXISTS\n \nWhen the IF NOT EXISTS clause is used, MariaDB will return a\nnote instead of an error if the specified plugin already\nexists. See SHOW WARNINGS.\n \nExamples\n-------- \nINSTALL PLUGIN sphinx SONAME \'ha_sphinx.so\';\n \nStarting from MariaDB 5.5.21, the extension can be omitted:\n \nINSTALL PLUGIN innodb SONAME \'ha_xtradb\';\n \nFrom MariaDB 10.4.0:\n \nINSTALL PLUGIN IF NOT EXISTS example SONAME \'ha_example\';\n \nQuery OK, 0 rows affected (0.104 sec)\n \nINSTALL PLUGIN IF NOT EXISTS example SONAME \'ha_example\';\n \nQuery OK, 0 rows affected, 1 warning (0.000 sec)\n \nSHOW WARNINGS;\n \n+-------+------+------------------------------------+\n| Level | Code | Message |\n+-------+------+------------------------------------+\n| Note | 1968 | Plugin \'example\' already installed |\n+-------+------+------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/install-plugin/','','https://mariadb.com/kb/en/install-plugin/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (80,5,'UNINSTALL PLUGIN','Syntax\n------ \nUNINSTALL PLUGIN [IF EXISTS] plugin_name\n \nDescription\n----------- \nThis statement removes a single installed plugin. To\nuninstall the whole library which contains the plugin, use\nUNINSTALL SONAME. You cannot uninstall a plugin if any table\nthat uses it is open.\n \nplugin_name must be the name of some plugin that is listed\nin the mysql.plugin table. The server executes the plugin\'s\ndeinitialization\nfunction and removes the row for the plugin from the\nmysql.plugin\ntable, so that subsequent server restarts will not load and\ninitialize\nthe plugin. UNINSTALL PLUGIN does not remove the plugin\'s\nshared library file.\n \nTo use UNINSTALL PLUGIN, you must have the\nDELETE privilege for the mysql.plugin table.\n \nIF EXISTS\n \nIf the IF EXISTS clause is used, MariaDB will return a note\ninstead of an error if the plugin does not exist. See SHOW\nWARNINGS.\n \nExamples\n-------- \nUNINSTALL PLUGIN example;\n \nFrom MariaDB 10.4.0:\n \nUNINSTALL PLUGIN IF EXISTS example;\n \nQuery OK, 0 rows affected (0.099 sec)\n \nUNINSTALL PLUGIN IF EXISTS example;\n \nQuery OK, 0 rows affected, 1 warning (0.000 sec)\n \nSHOW WARNINGS;\n \n+-------+------+-------------------------------+\n| Level | Code | Message |\n+-------+------+-------------------------------+\n| Note | 1305 | PLUGIN example does not exist |\n+-------+------+-------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/uninstall-plugin/','','https://mariadb.com/kb/en/uninstall-plugin/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (81,5,'INSTALL SONAME','INSTALL SONAME has been supported since MariaDB 5.5.21.\n \nSyntax\n------ \nINSTALL SONAME \'plugin_library\'\n \nDescription\n----------- \nThis statement is a variant of INSTALL PLUGIN. It installs\nall plugins from a given plugin_library. See INSTALL PLUGIN\nfor details.\n \nplugin_library is the name of the shared library that\ncontains the plugin code. The file name extension (for\nexample, libmyplugin.so or libmyplugin.dll) can be omitted\n(which makes the statement look the same on all\narchitectures).\n \nThe shared library must be located in the plugin directory\n(that is,\nthe directory named by the plugin_dir system variable). The\nlibrary must be in the plugin directory itself, not in a\nsubdirectory. By\ndefault, plugin_dir is plugin directory under the directory\nnamed by\nthe pkglibdir configuration variable, but it can be changed\nby setting\nthe value of plugin_dir at server startup. For example, set\nits value in a my.cnf file:\n \n[mysqld]\nplugin_dir=/path/to/plugin/directory\nIf the value of plugin_dir is a relative path name, it is\ntaken to be relative to the MySQL base directory (the value\nof the basedir\nsystem variable).\n \nINSTALL SONAME adds one or more lines to the mysql.plugin\ntable that\ndescribes the plugin. This table contains the plugin name\nand library file\nname.\n \nINSTALL SONAME causes the server to read\noption (my.cnf) files just as during server startup. This\nenables the plugin to\npick up any relevant options from those files. It is\npossible to add plugin\noptions to an option file even before loading a plugin (if\nthe loose prefix is\nused). It is also possible to uninstall a plugin, edit\nmy.cnf, and install the\nplugin again. Restarting the plugin this way enables it to\nthe new option\nvalues without a server restart.\n \nINSTALL SONAME also loads and initializes the plugin code to\nmake the plugin available for use. A plugin is initialized\nby executing its\ninitialization function, which handles any setup that the\nplugin must perform\nbefore it can be used.\n \nTo use INSTALL SONAME, you must have the\nINSERT privilege for the mysql.plugin table.\n \nAt server startup, the server loads and initializes any\nplugin that is\nlisted in the mysql.plugin table. This means that a plugin\nis installed\nwith INSTALL SONAME only once, not every time the server\nstarts. Plugin loading at startup does not occur if the\nserver is started with\nthe --skip-grant-tables option.\n \nWhen the server shuts down, it executes the deinitialization\nfunction\nfor each plugin that is loaded so that the plugin has a\nchance to\nperform any final cleanup.\n \nIf you need to load plugins for a single server startup when\nthe\n--skip-grant-tables option is given (which tells the server\nnot to read system tables), use the \n--plugin-load mysqld option.\n \nIf you need to install only one plugin from a library, use\nthe INSTALL PLUGIN statement.\n \nExamples\n-------- \nTo load the XtraDB storage engine and all of its\ninformation_schema tables with one statement, use\n \nINSTALL SONAME \'ha_xtradb\';\n \nThis statement can be used instead of INSTALL PLUGIN even\nwhen the library contains only one plugin:\n \nINSTALL SONAME \'ha_sequence\';\n \n\n\nURL: https://mariadb.com/kb/en/install-soname/','','https://mariadb.com/kb/en/install-soname/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (82,5,'UNINSTALL SONAME','UNINSTALL SONAME has been supported since MariaDB 5.5.21.\n \nSyntax\n------ \nUNINSTALL SONAME [IF EXISTS] \'plugin_library\'\n \nDescription\n----------- \nThis statement is a variant of UNINSTALL PLUGIN statement,\nthat removes all plugins belonging to a specified\nplugin_library. See UNINSTALL PLUGIN for details.\n \nplugin_library is the name of the shared library that\ncontains the plugin code. The file name extension (for\nexample, libmyplugin.so or libmyplugin.dll) can be omitted\n(which makes the statement look the same on all\narchitectures).\n \nTo use UNINSTALL SONAME, you must have the\nDELETE privilege for the mysql.plugin table.\n \nIF EXISTS\n \nIf the IF EXISTS clause is used, MariaDB will return a note\ninstead of an error if the plugin library does not exist.\nSee SHOW WARNINGS.\n \nExamples\n-------- \nTo uninstall the XtraDB plugin and all of its\ninformation_schema tables with one statement, use\n \nUNINSTALL SONAME \'ha_xtradb\';\n \nFrom MariaDB 10.4.0:\n \nUNINSTALL SONAME IF EXISTS \'ha_example\';\n \nQuery OK, 0 rows affected (0.099 sec)\n \nUNINSTALL SONAME IF EXISTS \'ha_example\';\n \nQuery OK, 0 rows affected, 1 warning (0.000 sec)\n \nSHOW WARNINGS;\n \n+-------+------+-------------------------------------+\n| Level | Code | Message |\n+-------+------+-------------------------------------+\n| Note | 1305 | SONAME ha_example.so does not exist |\n+-------+------+-------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/uninstall-soname/','','https://mariadb.com/kb/en/uninstall-soname/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (83,6,'MBR Definition','Description\n----------- \nThe MBR (Minimum Bounding Rectangle), or Envelope is the\nbounding\ngeometry, formed by the minimum and maximum (X,Y)\ncoordinates:\n \nExamples\n-------- \n((MINX MINY, MAXX MINY, MAXX MAXY, MINX MAXY, MINX MINY))\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/mbr-definition/','','https://mariadb.com/kb/en/mbr-definition/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (84,6,'MBRContains','Syntax\n------ \nMBRContains(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether the Minimum Bounding\nRectangle of\ng1 contains the Minimum Bounding Rectangle of g2. This tests\nthe\nopposite relationship as MBRWithin().\n \nExamples\n-------- \nSET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\n \nSET @g2 = GeomFromText(\'Point(1 1)\');\n \nSELECT MBRContains(@g1,@g2), MBRContains(@g2,@g1);\n+----------------------+----------------------+\n| MBRContains(@g1,@g2) | MBRContains(@g2,@g1) |\n+----------------------+----------------------+\n| 1 | 0 |\n+----------------------+----------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/mbrcontains/','','https://mariadb.com/kb/en/mbrcontains/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (85,6,'MBRDisjoint','Syntax\n------ \nMBRDisjoint(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether the Minimum Bounding\nRectangles of the two geometries g1 and g2 are disjoint. Two\ngeometries are disjoint if they do not intersect, that is\ntouch or overlap.\n \nExamples\n-------- \nSET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((4 4,4 7,7 7,7 4,4 4))\');\nSELECTmbrdisjoint(@g1,@g2);\n+----------------------+\n| mbrdisjoint(@g1,@g2) |\n+----------------------+\n| 1 |\n+----------------------+\n \nSET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((3 3,3 6,6 6,6 3,3 3))\');\nSELECT mbrdisjoint(@g1,@g2);\n+----------------------+\n| mbrdisjoint(@g1,@g2) |\n+----------------------+\n| 0 |\n+----------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/mbrdisjoint/','','https://mariadb.com/kb/en/mbrdisjoint/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (86,6,'MBREqual','Syntax\n------ \nMBREqual(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether the Minimum Bounding\nRectangles of\nthe two geometries g1 and g2 are the same.\n \nExamples\n-------- \nSET @g1=GEOMFROMTEXT(\'LINESTRING(0 0, 1 2)\');\nSET @g2=GEOMFROMTEXT(\'POLYGON((0 0, 0 2, 1 2, 1 0, 0\n0))\');\nSELECT MbrEqual(@g1,@g2);\n+-------------------+\n| MbrEqual(@g1,@g2) |\n+-------------------+\n| 1 |\n+-------------------+\n \nSET @g1=GEOMFROMTEXT(\'LINESTRING(0 0, 1 3)\');\nSET @g2=GEOMFROMTEXT(\'POLYGON((0 0, 0 2, 1 4, 1 0, 0\n0))\');\nSELECT MbrEqual(@g1,@g2);\n+-------------------+\n| MbrEqual(@g1,@g2) |\n+-------------------+\n| 0 |\n+-------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/mbrequal/','','https://mariadb.com/kb/en/mbrequal/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (87,6,'MBRIntersects','Syntax\n------ \nMBRIntersects(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether the Minimum Bounding\nRectangles of the two geometries g1 and g2 intersect.\n \nExamples\n-------- \nSET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((3 3,3 6,6 6,6 3,3 3))\');\nSELECT mbrintersects(@g1,@g2);\n+------------------------+\n| mbrintersects(@g1,@g2) |\n+------------------------+\n| 1 |\n+------------------------+\n \nSET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((4 4,4 7,7 7,7 4,4 4))\');\nSELECT mbrintersects(@g1,@g2);\n+------------------------+\n| mbrintersects(@g1,@g2) |\n+------------------------+\n| 0 |\n+------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/mbrintersects/','','https://mariadb.com/kb/en/mbrintersects/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (88,6,'MBROverlaps','Syntax\n------ \nMBROverlaps(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether the Minimum Bounding\nRectangles of\nthe two geometries g1 and g2 overlap. The term spatially\noverlaps is\nused if two geometries intersect and their intersection\nresults in a\ngeometry of the same dimension but not equal to either of\nthe given\ngeometries.\n \nExamples\n-------- \nSET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((4 4,4 7,7 7,7 4,4 4))\');\nSELECT mbroverlaps(@g1,@g2);\n+----------------------+\n| mbroverlaps(@g1,@g2) |\n+----------------------+\n| 0 |\n+----------------------+\n \nSET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((3 3,3 6,6 6,6 3,3 3))\');\nSELECT mbroverlaps(@g1,@g2);\n+----------------------+\n| mbroverlaps(@g1,@g2) |\n+----------------------+\n| 0 |\n+----------------------+\n \nSET @g1 = GeomFromText(\'Polygon((0 0,0 4,4 4,4 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((3 3,3 6,6 6,6 3,3 3))\');\nSELECT mbroverlaps(@g1,@g2);\n+----------------------+\n| mbroverlaps(@g1,@g2) |\n+----------------------+\n| 1 |\n+----------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/mbroverlaps/','','https://mariadb.com/kb/en/mbroverlaps/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (89,6,'MBRTouches','Syntax\n------ \nMBRTouches(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether the Minimum Bounding\nRectangles of\nthe two geometries g1 and g2 touch. Two geometries spatially\ntouch if\nthe interiors of the geometries do not intersect, but the\nboundary of\none of the geometries intersects either the boundary or the\ninterior\nof the other.\n \nExamples\n-------- \nSET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((4 4,4 7,7 7,7 4,4 4))\');\nSELECT mbrtouches(@g1,@g2);\n+---------------------+\n| mbrtouches(@g1,@g2) |\n+---------------------+\n| 0 |\n+---------------------+\n \nSET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((3 3,3 6,6 6,6 3,3 3))\');\nSELECT mbrtouches(@g1,@g2);\n+---------------------+\n| mbrtouches(@g1,@g2) |\n+---------------------+\n| 1 |\n+---------------------+\n \nSET @g1 = GeomFromText(\'Polygon((0 0,0 4,4 4,4 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((3 3,3 6,6 6,6 3,3 3))\');\nSELECT mbrtouches(@g1,@g2);\n+---------------------+\n| mbrtouches(@g1,@g2) |\n+---------------------+\n| 0 |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/mbrtouches/','','https://mariadb.com/kb/en/mbrtouches/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (90,6,'MBRWithin','Syntax\n------ \nMBRWithin(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether the Minimum Bounding\nRectangle of\ng1 is within the Minimum Bounding Rectangle of g2. This\ntests the\nopposite relationship as MBRContains().\n \nExamples\n-------- \nSET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((0 0,0 5,5 5,5 0,0 0))\');\nSELECT MBRWithin(@g1,@g2), MBRWithin(@g2,@g1);\n+--------------------+--------------------+\n| MBRWithin(@g1,@g2) | MBRWithin(@g2,@g1) |\n+--------------------+--------------------+\n| 1 | 0 |\n+--------------------+--------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/mbrwithin/','','https://mariadb.com/kb/en/mbrwithin/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (91,7,'CASE OPERATOR','Syntax\n------ \nCASE value WHEN [compare_value] THEN result [WHEN\n[compare_value] THEN\nresult ...] [ELSE result] END\n \nCASE WHEN [condition] THEN result [WHEN [condition] THEN\nresult ...]\n[ELSE result] END\n \nDescription\n----------- \nThe first version returns the result where\nvalue=compare_value. The\nsecond version returns the result for the first condition\nthat is\ntrue. If there was no matching result value, the result\nafter ELSE is\nreturned, or NULL if there is no ELSE part.\n \nThere is also a CASE statement, which differs from the CASE\noperator described here.\n \nExamples\n-------- \nSELECT CASE 1 WHEN 1 THEN \'one\' WHEN 2 THEN \'two\' ELSE\n\'more\' END;\n \n+------------------------------------------------------------+\n| CASE 1 WHEN 1 THEN \'one\' WHEN 2 THEN \'two\' ELSE\n\'more\' END |\n+------------------------------------------------------------+\n| one |\n+------------------------------------------------------------+\n \nSELECT CASE WHEN 1>0 THEN \'true\' ELSE \'false\' END;\n \n+--------------------------------------------+\n| CASE WHEN 1>0 THEN \'true\' ELSE \'false\' END |\n+--------------------------------------------+\n| true |\n+--------------------------------------------+\n \nSELECT CASE BINARY \'B\' WHEN \'a\' THEN 1 WHEN \'b\' THEN 2\nEND;\n \n+-----------------------------------------------------+\n| CASE BINARY \'B\' WHEN \'a\' THEN 1 WHEN \'b\' THEN 2 END\n|\n+-----------------------------------------------------+\n| NULL |\n+-----------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/case-operator/','','https://mariadb.com/kb/en/case-operator/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (92,7,'IF Function','Syntax\n------ \nIF(expr1,expr2,expr3)\n \nDescription\n----------- \nIf expr1 is TRUE (expr1 0 and expr1 NULL) then IF()\nreturns expr2; otherwise it returns expr3. IF() returns a\nnumeric\nor string value, depending on the context in which it is\nused.\n \nNote: There is also an IF statement which differs from the\nIF() function described here.\n \nExamples\n-------- \nSELECT IF(1>2,2,3);\n+-------------+\n| IF(1>2,2,3) |\n+-------------+\n| 3 |\n+-------------+\n \nSELECT IF(1\n\nURL: https://mariadb.com/kb/en/if-function/','','https://mariadb.com/kb/en/if-function/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (93,7,'IFNULL','Syntax\n------ \nIFNULL(expr1,expr2)\n \nDescription\n----------- \nIf expr1 is not NULL, IFNULL() returns expr1; otherwise it\nreturns\nexpr2. IFNULL() returns a numeric or string value, depending\non the\ncontext in which it is used.\n \nExamples\n-------- \nSELECT IFNULL(1,0); \n+-------------+\n| IFNULL(1,0) |\n+-------------+\n| 1 |\n+-------------+\n \nSELECT IFNULL(NULL,10);\n+-----------------+\n| IFNULL(NULL,10) |\n+-----------------+\n| 10 |\n+-----------------+\n \nSELECT IFNULL(1/0,10);\n+----------------+\n| IFNULL(1/0,10) |\n+----------------+\n| 10.0000 |\n+----------------+\n \nSELECT IFNULL(1/0,\'yes\');\n+-------------------+\n| IFNULL(1/0,\'yes\') |\n+-------------------+\n| yes |\n+-------------------+\n \n\n\nURL: https://mariadb.com/kb/en/ifnull/','','https://mariadb.com/kb/en/ifnull/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (94,7,'NULLIF','Syntax\n------ \nNULLIF(expr1,expr2)\n \nDescription\n----------- \nReturns NULL if expr1 = expr2 is true, otherwise returns\nexpr1. This is\nthe same as CASE WHEN expr1 = expr2 THEN NULL ELSE expr1\nEND.\n \nExamples\n-------- \nSELECT NULLIF(1,1);\n+-------------+\n| NULLIF(1,1) |\n+-------------+\n| NULL |\n+-------------+\n \nSELECT NULLIF(1,2);\n+-------------+\n| NULLIF(1,2) |\n+-------------+\n| 1 |\n+-------------+\n \n\n\nURL: https://mariadb.com/kb/en/nullif/','','https://mariadb.com/kb/en/nullif/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (95,8,'CHANGE MASTER TO','Syntax\n------ \nCHANGE MASTER [\'connection_name\'] TO master_def [,\nmaster_def] ...\n \nmaster_def:\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_DELAY = interval\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_CRL = \'crl_file_name\'\n | MASTER_SSL_CRLPATH = \'crl_directory_name\'\n | MASTER_SSL_KEY = \'key_file_name\'\n | MASTER_SSL_CIPHER = \'cipher_list\'\n | MASTER_SSL_VERIFY_SERVER_CERT = {0|1}\n | MASTER_USE_GTID = {current_pos|slave_pos|no}\n | IGNORE_SERVER_IDS = (server_id_list)\n | DO_DOMAIN_IDS = ([N,..])\n | IGNORE_DOMAIN_IDS = ([N,..])\n \nDescription\n----------- \nThe CHANGE MASTER statement sets the options that a\nreplication slave uses to connect to and replicate from a\nreplication master. \n \nMariaDB until 10.0.7\n \nIn MariaDB 10.0.7 and before, the relay_log_purge system\nvariable was silently set to 0 when CHANGE MASTER was\nexecuted.\n \nMulti-Source Replication\n \nMulti-source replication was added in MariaDB 10.0.1.\n \nIf you are using multi-source replication, then you need to\nspecify a connection name when you execute CHANGE MASTER.\nThere are two ways to do this:\nSetting the default_master_connection system variable prior\nto executing CHANGE MASTER.\nSetting the connection_name parameter when executing CHANGE\nMASTER.\n \ndefault_master_connection\n \nSET default_master_connection = \'gandalf\';\n \nSTOP SLAVE;\n \nCHANGE MASTER TO \n MASTER_PASSWORD=\'new3cret\';\n \nSTART SLAVE;\n \nconnection_name\n \nSTOP SLAVE \'gandalf\';\n \nCHANGE MASTER \'gandalf\' TO \n MASTER_PASSWORD=\'new3cret\';\n \nSTART SLAVE \'gandalf\';\n \nOptions\n \nConnection Options\n \nMASTER_USER\n \nThe MASTER_USER option for CHANGE MASTER defines the user\naccount that the replication slave will use to connect to\nthe replication master.\n \nThis user account will need the REPLICATION SLAVE privilege\non the master.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_USER=\'repl\',\n MASTER_PASSWORD=\'new3cret\';\n \nSTART SLAVE;\n \nMASTER_PASSWORD\n \nThe MASTER_USER option for CHANGE MASTER defines the\npassword that the replication slave will use to connect to\nthe replication master as the user account defined by the\nMASTER_USER option.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO \n MASTER_PASSWORD=\'new3cret\';\n \nSTART SLAVE;\n \nMASTER_HOST\n \nThe MASTER_HOST option for CHANGE MASTER defines the\nhostname or IP address of the replication master.\n \nIf you set the value of the MASTER_HOST option to the empty\nstring, then that is not the same as not setting the\noption\'s value at all. In MariaDB 5.5 and later, if you set\nthe value of the MASTER_HOST option to the empty string,\nthen the CHANGE MASTER command will fail with an error. In\nMariaDB 5.3 and before, if you set the value of the\nMASTER_HOST option to the empty string, then the CHANGE\nMASTER command would succeed, but the subsequent START SLAVE\ncommand would fail.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_HOST=\'dbserver1.example.com\',\n MASTER_USER=\'repl\',\n MASTER_PASSWORD=\'new3cret\',\n MASTER_USE_GTID=slave_pos;\n \nSTART SLAVE;\n \nIf you set the value of the MASTER_HOST option in a CHANGE\nMASTER command, then the slave assumes that the master is\ndifferent from before, even if you set the value of this\noption to the same value it had previously. In this\nscenario, the slave will consider the old values for the\nmaster\'s binary\nlog file name and position to be invalid for the new master.\nAs a side effect, if you do not explicitly set the values of\nthe MASTER_LOG_FILE and MASTER_LOG_POS options in the\nstatement, then the statement will be implicitly appended\nwith MASTER_LOG_FILE=\'\' and MASTER_LOG_POS=4. However, if\nyou enable GTID mode for replication by setting the\nMASTER_USE_GTID option to some value other than no in the\nstatement, then these values will effectively be ignored\nanyway.\n \nReplication slaves cannot connect to replication masters\nusing Unix socket files or Windows named pipes. The\nreplication slave must connect to the replication master\nusing TCP/IP.\n \nMASTER_PORT\n \nThe MASTER_PORT option for CHANGE MASTER defines the TCP/IP\nport of the replication master.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_HOST=\'dbserver1.example.com\',\n MASTER_PORT=3307,\n MASTER_USER=\'repl\',\n MASTER_PASSWORD=\'new3cret\',\n MASTER_USE_GTID=slave_pos;\n \nSTART SLAVE;\n \nIf you set the value of the MASTER_PORT option in a CHANGE\nMASTER command, then the slave assumes that the master is\ndifferent from before, even if you set the value of this\noption to the same value it had previously. In this\nscenario, the slave will consider the old values for the\nmaster\'s binary\nlog file name and position to be invalid for the new master.\nAs a side effect, if you do not explicitly set the values of\nthe MASTER_LOG_FILE and MASTER_LOG_POS options in the\nstatement, then the statement will be implicitly appended\nwith MASTER_LOG_FILE=\'\' and MASTER_LOG_POS=4. However, if\nyou enable GTID mode for replication by setting the\nMASTER_USE_GTID option to some value other than no in the\nstatement, then these values will effectively be ignored\nanyway.\n \nReplication slaves cannot connect to replication masters\nusing Unix socket files or Windows named pipes. The\nreplication slave must connect to the replication master\nusing TCP/IP.\n \nMASTER_CONNECT_RETRY\n \nThe MASTER_CONNECT_RETRY option for CHANGE MASTER defines\nhow many seconds that the slave will wait between connection\nretries. The default is 60.\n \nSTOP SLAVE;\n \nCHANGE MASTER TO \n MASTER_CONNECT_RETRY=20;\n \nSTART SLAVE;\n \nThe number of connection attempts is limited by the\nmaster_retry_count option. It can be set either on the\ncommand-line or in a server option group in an option file\nprior to starting up the server. For example:\n \n[mariadb]\n...\nmaster_retry_count=4294967295\n \nMASTER_BIND\n \nThe MASTER_BIND option for CHANGE MASTER is only supported\nby MySQL 5.6.2 and later and by MySQL NDB Cluster 7.3.1 and\nlater. This option is not yet supported by MariaDB. See\nMDEV-19248 for more information.\n \nThe MASTER_BIND option for CHANGE MASTER can be used on\nreplication slaves that have multiple network interfaces to\nchoose which network interface the slave will use to connect\nto the master.\n \nMASTER_HEARTBEAT_PERIOD\n \nThe MASTER_HEARTBEAT_PERIOD option for CHANGE MASTER can be\nused to set the interval in seconds between replication\nheartbeats. Whenever the master\'s binary log is updated\nwith an event, the waiting period for the next heartbeat is\nreset.\n \nThis option\'s interval argument has the following\ncharacteristics:\nIt is a decimal value with a range of 0 to 4294967 seconds.\nIt has a resolution of hundredths of a second.\nIts smallest valid non-zero value is 0.001.\nIts default value is the value of the slave_net_timeout\nsystem variable divided by 2.\nIf it\'s set to 0, then heartbeats are disabled.\n \nHeartbeats are sent by the master only if there are no\nunsent events in the binary log file for a period longer\nthan the interval.\n \nIf the RESET SLAVE statement is executed, then the heartbeat\ninterval is reset to the default.\n \nIf the slave_net_timeout system variable is set to a value\nthat is lower than the current heartbeat interval, then a\nwarning will be issued.\n \nTLS Options\n \nThe TLS options are used for providing information about\nTLS. The options can be set even on slaves that are compiled\nwithout TLS support. The TLS options are saved to either the\ndefault master.info file or the file that is configured by\nthe master_info_file option, but these TLS options are\nignored unless the slave supports TLS.\n \nSee Replication with Secure Connections for more\ninformation.\n \nMASTER_SSL\n \nThe MASTER_SSL option for CHANGE MASTER tells the slave\nwhether to force TLS for the connection. The valid values\nare 0 or 1.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_SSL=1;\n \nSTART SLAVE;\n \nMASTER_SSL_CA\n \nThe MASTER_SSL_CA option for CHANGE MASTER defines a path to\na PEM file that should contain one or more X509 certificates\nfor trusted Certificate Authorities (CAs) to use for TLS.\nThis option requires that you use the absolute path, not a\nrelative path. This option implies the MASTER_SSL option.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_SSL_CERT=\'/etc/my.cnf.d/certificates/server-cert.pem\',\n MASTER_SSL_KEY=\'/etc/my.cnf.d/certificates/server-key.pem\',\n MASTER_SSL_CA=\'/etc/my.cnf.d/certificates/ca.pem\',\n MASTER_SSL_VERIFY_SERVER_CERT=1;\n \nSTART SLAVE;\n \nSee Secure Connections Overview: Certificate Authorities\n(CAs) for more information.\n \nMASTER_SSL_CAPATH\n \nThe MASTER_SSL_CAPATH option for CHANGE MASTER defines a\npath to a directory that contains one or more PEM files that\nshould each contain one X509 certificate for a trusted\nCertificate Authority (CA) to use for TLS. This option\nrequires that you use the absolute path, not a relative\npath. The directory specified by this option needs to be run\nthrough the openssl rehash command. This option implies the\nMASTER_SSL option.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_SSL_CERT=\'/etc/my.cnf.d/certificates/server-cert.pem\',\n MASTER_SSL_KEY=\'/etc/my.cnf.d/certificates/server-key.pem\',\n MASTER_SSL_CAPATH=\'/etc/my.cnf.d/certificates/ca/\',\n MASTER_SSL_VERIFY_SERVER_CERT=1;\n \nSTART SLAVE;\n \nSee Secure Connections Overview: Certificate Authorities\n(CAs) for more information.\n \nMASTER_SSL_CERT\n \nThe MASTER_SSL_CERT option for CHANGE MASTER defines a path\nto the X509 certificate file to use for TLS. This option\nrequires that you use the absolute path, not a relative\npath. This option implies the MASTER_SSL option.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_SSL_CERT=\'/etc/my.cnf.d/certificates/server-cert.pem\',\n MASTER_SSL_KEY=\'/etc/my.cnf.d/certificates/server-key.pem\',\n MASTER_SSL_CA=\'/etc/my.cnf.d/certificates/ca.pem\',\n MASTER_SSL_VERIFY_SERVER_CERT=1;\n \nSTART SLAVE;\n \nMASTER_SSL_CRL\n \nThe MASTER_SSL_CRL option for CHANGE MASTER defines a path\nto a PEM file that should contain one or more revoked X509\ncertificates to use for TLS. This option requires that you\nuse the absolute path, not a relative path.\n \nThis option is only supported if the server was built with\nOpenSSL. If the server was built with yaSSL, then this\noption is not supported. See TLS and Cryptography Libraries\nUsed by MariaDB for more information about which libraries\nare used on which platforms.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_SSL_CERT=\'/etc/my.cnf.d/certificates/server-cert.pem\',\n MASTER_SSL_KEY=\'/etc/my.cnf.d/certificates/server-key.pem\',\n MASTER_SSL_CA=\'/etc/my.cnf.d/certificates/ca.pem\',\n MASTER_SSL_VERIFY_SERVER_CERT=1,\n MASTER_SSL_CRL=\'/etc/my.cnf.d/certificates/crl.pem\';\n \nSTART SLAVE;\n \nSee Secure Connections Overview: Certificate Revocation\nLists (CRLs) for more information.\n \nMASTER_SSL_CRLPATH\n \nThe MASTER_SSL_CRLPATH option for CHANGE MASTER defines a\npath to a directory that contains one or more PEM files that\nshould each contain one revoked X509 certificate to use for\nTLS. This option requires that you use the absolute path,\nnot a relative path. The directory specified by this\nvariable needs to be run through the openssl rehash command.\n \nThis option is only supported if the server was built with\nOpenSSL. If the server was built with yaSSL, then this\noption is not supported. See TLS and Cryptography Libraries\nUsed by MariaDB for more information about which libraries\nare used on which platforms.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_SSL_CERT=\'/etc/my.cnf.d/certificates/server-cert.pem\',\n MASTER_SSL_KEY=\'/etc/my.cnf.d/certificates/server-key.pem\',\n MASTER_SSL_CA=\'/etc/my.cnf.d/certificates/ca.pem\',\n MASTER_SSL_VERIFY_SERVER_CERT=1,\n MASTER_SSL_CRLPATH=\'/etc/my.cnf.d/certificates/crl/\';\n \nSTART SLAVE;\n \nSee Secure Connections Overview: Certificate Revocation\nLists (CRLs) for more information.\n \nMASTER_SSL_KEY\n \nThe MASTER_SSL_KEY option for CHANGE MASTER defines a path\nto a private key file to use for TLS. This option requires\nthat you use the absolute path, not a relative path. This\noption implies the MASTER_SSL option.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_SSL_CERT=\'/etc/my.cnf.d/certificates/server-cert.pem\',\n MASTER_SSL_KEY=\'/etc/my.cnf.d/certificates/server-key.pem\',\n MASTER_SSL_CA=\'/etc/my.cnf.d/certificates/ca.pem\',\n MASTER_SSL_VERIFY_SERVER_CERT=1;\n \nSTART SLAVE;\n \nMASTER_SSL_CIPHER\n \nThe MASTER_SSL_CIPHER option for CHANGE MASTER defines the\nlist of permitted ciphers or cipher suites to use for TLS.\nBesides cipher names, if MariaDB was compiled with OpenSSL,\nthis option could be set to \"SSLv3\" or \"TLSv1.2\" to\nallow all SSLv3 or all TLSv1.2 ciphers. Note that the\nTLSv1.3 ciphers cannot be excluded when using OpenSSL, even\nby using this option. See Using TLSv1.3 for details. This\noption implies the MASTER_SSL option.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_SSL_CERT=\'/etc/my.cnf.d/certificates/server-cert.pem\',\n MASTER_SSL_KEY=\'/etc/my.cnf.d/certificates/server-key.pem\',\n MASTER_SSL_CA=\'/etc/my.cnf.d/certificates/ca.pem\',\n MASTER_SSL_VERIFY_SERVER_CERT=1,\n MASTER_SSL_CIPHER=\'TLSv1.2\';\n \nSTART SLAVE;\n \nMASTER_SSL_VERIFY_SERVER_CERT\n \nThe MASTER_SSL_VERIFY_SERVER_CERT option for CHANGE MASTER\nenables server certificate verification. This option is\ndisabled by default.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_SSL_CERT=\'/etc/my.cnf.d/certificates/server-cert.pem\',\n MASTER_SSL_KEY=\'/etc/my.cnf.d/certificates/server-key.pem\',\n MASTER_SSL_CA=\'/etc/my.cnf.d/certificates/ca.pem\',\n MASTER_SSL_VERIFY_SERVER_CERT=1;\n \nSTART SLAVE;\n \nSee Secure Connections Overview: Server Certificate\nVerification for more information.\n \nBinary Log Options\n \nThese options are related to the binary log position on the\nmaster.\n \nMASTER_LOG_FILE\n \nThe MASTER_LOG_FILE option for CHANGE MASTER can be used\nalong with MASTER_LOG_POS to specify the coordinates at\nwhich the slave\'s I/O thread should begin reading from the\nmaster\'s binary logs the next time the thread starts.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_LOG_FILE=\'master2-bin.001\',\n MASTER_LOG_POS=4;\n \nSTART SLAVE;\n \nThe MASTER_LOG_FILE and MASTER_LOG_POS options cannot be\nspecified if the RELAY_LOG_FILE and RELAY_LOG_POS options\nwere also specified.\n \nThe MASTER_LOG_FILE and MASTER_LOG_POS options are\neffectively ignored if you enable GTID mode for replication\nby setting the MASTER_USE_GTID option to some value other\nthan no in the statement.\n \nMASTER_LOG_POS\n \nThe MASTER_LOG_POS option for CHANGE MASTER can be used\nalong with MASTER_LOG_FILE to specify the coordinates at\nwhich the slave\'s I/O thread should begin reading from the\nmaster\'s binary logs the next time the thread starts.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_LOG_FILE=\'master2-bin.001\',\n MASTER_LOG_POS=4;\n \nSTART SLAVE;\n \nThe MASTER_LOG_FILE and MASTER_LOG_POS options cannot be\nspecified if the RELAY_LOG_FILE and RELAY_LOG_POS options\nwere also specified.\n \nThe MASTER_LOG_FILE and MASTER_LOG_POS options are\neffectively ignored if you enable GTID mode for replication\nby setting the MASTER_USE_GTID option to some value other\nthan no in the statement.\n \nRelay Log Options\n \nThese options are related to the relay log position on the\nslave.\n \nRELAY_LOG_FILE\n \nThe RELAY_LOG_FILE option for CHANGE MASTER can be used\nalong with the RELAY_LOG_POS option to specify the\ncoordinates at which the slave\'s SQL thread should begin\nreading from the relay log the next time the thread starts.\n \nThe CHANGE MASTER statement usually deletes all relay log\nfiles. However, if the RELAY_LOG_FILE and/or RELAY_LOG_POS\noptions are specified, then existing relay log files are\nkept.\n \nWhen you want to change the relay log position, you only\nneed to stop the slave\'s SQL thread. The slave\'s I/O\nthread can continue running. The STOP SLAVE and START SLAVE\nstatements support the SQL_THREAD option for this scenario.\nFor example:\n \nSTOP SLAVE SQL_THREAD;\n \nCHANGE MASTER TO\n RELAY_LOG_FILE=\'slave-relay-bin.006\',\n RELAY_LOG_POS=4025;\n \nSTART SLAVE SQL_THREAD;\n \nWhen the value of this option is changed, the metadata about\nthe slave\'s SQL thread\'s position in the relay logs will\nalso be changed in the relay-log.info file or the file that\nis configured by the relay_log_info_file system variable.\n \nThe RELAY_LOG_FILE and RELAY_LOG_POS options cannot be\nspecified if the MASTER_LOG_FILE and MASTER_LOG_POS options\nwere also specified.\n \nRELAY_LOG_POS\n \nThe RELAY_LOG_POS option for CHANGE MASTER can be used along\nwith the RELAY_LOG_FILE option to specify the coordinates at\nwhich the slave\'s SQL thread should begin reading from the\nrelay log the next time the thread starts.\n \nThe CHANGE MASTER statement usually deletes all relay log\nfiles. However, if the RELAY_LOG_FILE and/or RELAY_LOG_POS\noptions are specified, then existing relay log files are\nkept.\n \nWhen you want to change the relay log position, you only\nneed to stop the slave\'s SQL thread. The slave\'s I/O\nthread can continue running. The STOP SLAVE and START SLAVE\nstatements support the SQL_THREAD option for this scenario.\nFor example:\n \nSTOP SLAVE SQL_THREAD;\n \nCHANGE MASTER TO\n RELAY_LOG_FILE=\'slave-relay-bin.006\',\n RELAY_LOG_POS=4025;\n \nSTART SLAVE SQL_THREAD;\n \nWhen the value of this option is changed, the metadata about\nthe slave\'s SQL thread\'s position in the relay logs will\nalso be changed in the relay-log.info file or the file that\nis configured by the relay_log_info_file system variable.\n \nThe RELAY_LOG_FILE and RELAY_LOG_POS options cannot be\nspecified if the MASTER_LOG_FILE and MASTER_LOG_POS options\nwere also specified.\n \nGTID Options\n \nMASTER_USE_GTID\n \nThe MASTER_USE_GTID option for CHANGE MASTER was first added\nin MariaDB 10.0.2 to enable replication with Global\nTransaction IDs (GTIDs).\n \nThe MASTER_USE_GTID option for CHANGE MASTER can be used to\nconfigure the slave to use the global transaction ID (GTID)\nwhen connecting to a master. The possible values are:\ncurrent_pos - Replicate in GTID mode and use\ngtid_current_pos as the position to start downloading\ntransactions from the master.\nslave_pos - Replicate in GTID mode and use gtid_slave_pos as\nthe position to start downloading transactions from the\nmaster.\nno - Don\'t replicate in GTID mode.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_USE_GTID = current_pos;\n \nSTART SLAVE;\n \nOr:\n \nSTOP SLAVE;\n \nSET GLOBAL gtid_slave_pos=\'0-1-153\';\n \nCHANGE MASTER TO\n MASTER_USE_GTID = slave','','https://mariadb.com/kb/en/change-master-to/');
-update help_topic set description = CONCAT(description, '_pos;\n \nSTART SLAVE;\n \nReplication Filter Options\n \nIGNORE_SERVER_IDS\n \nThe IGNORE_SERVER_IDS option for CHANGE MASTER can be used\nto configure a replication slave to ignore binary log events\nthat originated from certain servers. Filtered binary log\nevents will not get logged to the slave’s relay log, and\nthey will not be applied by the slave.\n \nThe option\'s value can be specified by providing a\ncomma-separated list of server_id values. For example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO \n IGNORE_SERVER_IDS = (3,5);\nSTART SLAVE;\n \nIf you would like to clear a previously set list, then you\ncan set the value to an empty list. For example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO \n IGNORE_SERVER_IDS = ();\nSTART SLAVE;\n \nDO_DOMAIN_IDS\n \nThe DO_DOMAIN_IDS option for CHANGE MASTER was first added\nin MariaDB 10.1.2.\n \nThe DO_DOMAIN_IDS option for CHANGE MASTER can be used to\nconfigure a replication slave to only apply binary log\nevents if the transaction\'s GTID is in a specific\ngtid_domain_id value. Filtered binary log events will not\nget logged to the slave’s relay log, and they will not be\napplied by the slave.\n \nThe option\'s value can be specified by providing a\ncomma-separated list of gtid_domain_id values. Duplicate\nvalues are automatically ignored. For example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO \n DO_DOMAIN_IDS = (1,2);\nSTART SLAVE;\n \nIf you would like to clear a previously set list, then you\ncan set the value to an empty list. For example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO \n DO_DOMAIN_IDS = ();\nSTART SLAVE;\n \nThe DO_DOMAIN_IDS option and the IGNORE_DOMAIN_IDS option\ncannot both be set to non-empty values at the same time. If\nyou want to set the DO_DOMAIN_IDS option, and the\nIGNORE_DOMAIN_IDS option was previously set, then you need\nto clear the value of the IGNORE_DOMAIN_IDS option. For\nexample:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO \n IGNORE_DOMAIN_IDS = (), \n DO_DOMAIN_IDS = (1,2);\nSTART SLAVE;\n \nThe DO_DOMAIN_IDS option can only be specified if the slave\nis replicating in GTID mode. Therefore, the MASTER_USE_GTID\noption must also be set to some value other than no in order\nto use this option.\n \nIGNORE_DOMAIN_IDS\n \nThe IGNORE_DOMAIN_IDS option for CHANGE MASTER was first\nadded in MariaDB 10.1.2.\n \nThe IGNORE_DOMAIN_IDS option for CHANGE MASTER can be used\nto configure a replication slave to ignore binary log events\nif the transaction\'s GTID is in a specific gtid_domain_id\nvalue. Filtered binary log events will not get logged to the\nslave’s relay log, and they will not be applied by the\nslave.\n \nThe option\'s value can be specified by providing a\ncomma-separated list of gtid_domain_id values. Duplicate\nvalues are automatically ignored. For example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO \n IGNORE_DOMAIN_IDS = (1,2);\nSTART SLAVE;\n \nIf you would like to clear a previously set list, then you\ncan set the value to an empty list. For example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO \n IGNORE_DOMAIN_IDS = ();\nSTART SLAVE;\n \nThe DO_DOMAIN_IDS option and the IGNORE_DOMAIN_IDS option\ncannot both be set to non-empty values at the same time. If\nyou want to set the IGNORE_DOMAIN_IDS option, and the\nDO_DOMAIN_IDS option was previously set, then you need to\nclear the value of the DO_DOMAIN_IDS option. For example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO \n DO_DOMAIN_IDS = (), \n IGNORE_DOMAIN_IDS = (1,2);\nSTART SLAVE;\n \nThe IGNORE_DOMAIN_IDS option can only be specified if the\nslave is replicating in GTID mode. Therefore, the\nMASTER_USE_GTID option must also be set to some value other\nthan no in order to use this option.\n \nDelayed Replication Options\n \nMASTER_DELAY\n \nThe MASTER_DELAY option for CHANGE MASTER was first added in\nMariaDB 10.2.3 to enable delayed replication.\n \nThe MASTER_DELAY option for CHANGE MASTER can be used to\nenable delayed replication. This option specifies the time\nin seconds (at least) that a replication slave should lag\nbehind the master. Before executing an event, the slave will\nfirst wait, if necessary, until the given time has passed\nsince the event was created on the master. The result is\nthat the slave will reflect the state of the master some\ntime back in the past. The default is zero, no delay.\n \nSTOP SLAVE;\n \nCHANGE MASTER TO \n MASTER_DELAY=3600;\n \nSTART SLAVE;\n \nChanging Option Values\n \nIf you don\'t specify a given option when executing the\nCHANGE MASTER statement, then the option keeps its old value\nin most cases. Most of the time, there is no need to specify\nthe options that do not need to change. For example, if the\npassword for the user account that the slave uses to connect\nto its master has changed, but no other options need to\nchange, then you can just change the MASTER_PASSWORD option\nby executing the following commands:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO \n MASTER_PASSWORD=\'new3cret\';\n \nSTART SLAVE;\n \nThere are some cases where options are implicitly reset,\nsuch as when the MASTER_HOST and MASTER_PORT options are\nchanged.\n \nOption Persistence\n \nThe values of the MASTER_LOG_FILE and MASTER_LOG_POS options\n(i.e. the binary log position on the master) and most other\noptions are written to either the default master.info file\nor the file that is configured by the master_info_file\noption. The slave\'s I/O thread keeps this binary log\nposition updated as it downloads events only when\nMASTER_USE_GTID option\n is set to NO. Otherwise the file is not updated on a per\nevent basis.\n \nThe master_info_file option can be set either on the\ncommand-line or in a server option group in an option file\nprior to starting up the server. For example:\n \n[mariadb]\n...\nmaster_info_file=/mariadb/myserver1-master.info\n \nThe values of the RELAY_LOG_FILE and RELAY_LOG_POS options\n(i.e. the relay log position) are written to either the\ndefault relay-log.info file or the file that is configured\nby the relay_log_info_file system variable. The slave\'s SQL\nthread keeps this relay log position updated as it applies\nevents.\n \nThe relay_log_info_file system variable can be set either on\nthe command-line or in a server option group in an option\nfile prior to starting up the server. For example:\n \n[mariadb]\n...\nrelay_log_info_file=/mariadb/myserver1-relay-log.info\n \nGTID Persistence\n \nIf the slave is replicating binary log events that contain\nGTIDs, then the slave\'s SQL thread will write every GTID\nthat it applies to the mysql.gtid_slave_pos table. This GTID\ncan be inspected and modified through the gtid_slave_pos\nsystem variable.\n \nIf the slave has the log_slave_updates system variable\nenabled and if the slave has the binary log enabled, then\nevery write by the slave\'s SQL thread will also go into the\nslave\'s binary log. This means that GTIDs of replicated\ntransactions would be reflected in the value of the\ngtid_binlog_pos system variable.\n \nCreating a Slave from a Backup\n \nThe CHANGE MASTER statement is useful for setting up a slave\nwhen you have a backup of the master and you also have the\nbinary log position or GTID position corresponding to the\nbackup.\n \nAfter restoring the backup on the slave, you could execute\nsomething like this to use the binary log position:\n \nCHANGE MASTER TO\n MASTER_LOG_FILE=\'master2-bin.001\',\n MASTER_LOG_POS=4;\n \nSTART SLAVE;\n \nOr you could execute something like this to use the GTID\nposition:\n \nSET GLOBAL gtid_slave_pos=\'0-1-153\';\n \nCHANGE MASTER TO\n MASTER_USE_GTID=slave_pos;\n \nSTART SLAVE;\n \nSee Setting up a Replication Slave with Mariabackup for more\ninformation on how to do this with Mariabackup.\n \nExample\n \nThe following example changes the master and master\'s\nbinary log coordinates.\nThis is used when you want to set up the slave to replicate\nthe 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 \nSTART SLAVE;\n \n\n\nURL: https://mariadb.com/kb/en/change-master-to/') WHERE help_topic_id = 95;
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (96,8,'COMMIT','The COMMIT statement ends a transaction, saving any changes\nto the data so that they become visible to subsequent\ntransactions. Also, unlocks metadata changed by current\ntransaction. If autocommit is set to 1, an implicit commit\nis performed after each statement. Otherwise, all\ntransactions which don\'t end with an explicit COMMIT are\nimplicitly rollbacked and the changes are lost. The ROLLBACK\nstatement can be used to do this explicitly.\n \nThe required syntax for the COMMIT statement is as follows:\n \nCOMMIT [WORK] [AND [NO] CHAIN] [[NO] RELEASE]\n \nCOMMIT is the more important transaction terminator, as well\nas the more interesting one. The basic form of the COMMIT\nstatement is simply the keyword COMMIT (the keyword WORK is\nsimply noise and can be omitted without changing the\neffect).\n \nThe optional AND CHAIN clause is a convenience for\ninitiating a new transaction as soon as the old transaction\nterminates. If AND CHAIN is specified, then there is\neffectively nothing between the old and new transactions,\nalthough they remain separate. The characteristics of the\nnew transaction will be the same as the characteristics of\nthe old one — that is, the new transaction will have the\nsame access mode, isolation level and diagnostics area size\n(we\'ll discuss all of these shortly) as the transaction\njust terminated. \n \nRELEASE tells the server to disconnect the client\nimmediately after the current transaction.\n \nThere are NO RELEASE and AND NO CHAIN options. By default,\ncommits do not RELEASE or CHAIN, but it\'s possible to\nchange this default behavior with the completion_type server\nsystem variable. In this case, the AND NO CHAIN and NO\nRELEASE options override the server default.\n \n\n\nURL: https://mariadb.com/kb/en/commit/','','https://mariadb.com/kb/en/commit/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (97,8,'DEALLOCATE / DROP PREPARE','Syntax\n------ \n{DEALLOCATE | DROP} PREPARE stmt_name\n \nDescription\n----------- \nTo deallocate a prepared statement produced with PREPARE,\nuse a\nDEALLOCATE PREPARE statement that refers to the prepared\nstatement\nname.\n \nA prepared statement is implicitly deallocated when a new\nPREPARE command is issued. In that case, there is no need to\nuse DEALLOCATE.\n \nAttempting to execute a prepared statement after\ndeallocating it\nresults in an error, as if it was not prepared at all:\n \nERROR 1243 (HY000): Unknown prepared statement handler\n(stmt_name) given to EXECUTE\n \nIf the specified statement has not been PREPAREd, an error\nsimilar to the following will be produced:\n \nERROR 1243 (HY000): Unknown prepared statement handler\n(stmt_name) given to DEALLOCATE PREPARE\n \nExample\n \nSee example in PREPARE.\n \n\n\nURL:\nhttps://mariadb.com/kb/en/deallocate-drop-prepared-statement/','','https://mariadb.com/kb/en/deallocate-drop-prepared-statement/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (98,8,'EXECUTE Statement','Syntax\n------ \nEXECUTE stmt_name\n [USING expression[, expression] ...]\n \nEXECUTE with expression as parameters was introduced in\nMariaDB 10.2.3. Before that one could only use variables\n(@var_name) as parameters.\n \nDescription\n----------- \nAfter preparing a statement with PREPARE, you execute it\nwith an\nEXECUTE statement that refers to the prepared statement\nname. If the\nprepared statement contains any parameter markers, you must\nsupply a\nUSING clause that lists user variables containing the values\nto be\nbound to the parameters. Parameter values can be supplied\nonly by user\nvariables, and the USING clause must name exactly as many\nvariables as\nthe number of parameter markers in the statement.\n \nYou can execute a given prepared statement multiple times,\npassing\ndifferent variables to it or setting the variables to\ndifferent values\nbefore each execution.\n \nIf the specified statement has not been PREPAREd, an error\nsimilar to the following is produced:\n \nERROR 1243 (HY000): Unknown prepared statement handler\n(stmt_name) given to EXECUTE\n \nExample\n \nSee example in PREPARE.\n \n\n\nURL: https://mariadb.com/kb/en/execute-statement/','','https://mariadb.com/kb/en/execute-statement/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (99,8,'EXECUTE IMMEDIATE','EXECUTE IMMEDIATE was introduced in MariaDB 10.2.3.\n \nSyntax\n------ \nEXECUTE IMMEDIATE statement\n \nDescription\n----------- \nEXECUTE IMMEDIATE executes a dynamic SQL statement created\non the fly, which can reduce performance overhead.\n \nFor example:\n \nEXECUTE IMMEDIATE \'SELECT 1\' \n \nwhich is shorthand for:\n \nprepare stmt from \"select 1\";\n \nexecute stmt;\n \ndeallocate prepare stmt;\n \nEXECUTE IMMEDIATE supports complex expressions as prepare\nsource and parameters:\n \nEXECUTE IMMEDIATE CONCAT(\'SELECT COUNT(*) FROM \', \'t1\',\n\' WHERE a=?\') USING 5+5;\n \nLimitations: subselects and stored function calls are not\nsupported as a prepare source.\n \nThe following examples return an error:\n \nCREATE OR REPLACE FUNCTION f1() RETURNS VARCHAR(64) RETURN\n\'SELECT * FROM t1\';\nEXECUTE IMMEDIATE f1();\nERROR 1970 (42000): EXECUTE IMMEDIATE does not support\nsubqueries or stored functions\n \nEXECUTE IMMEDIATE (SELECT \'SELECT * FROM t1\');\nERROR 1064 (42000): You have an error in your SQL syntax;\ncheck the manual that \n corresponds to your MariaDB server version for the right\nsyntax to use near \n \'SELECT \'SELECT * FROM t1\')\' at line 1\n \nCREATE OR REPLACE FUNCTION f1() RETURNS INT RETURN 10;\nEXECUTE IMMEDIATE \'SELECT * FROM t1 WHERE a=?\' USING f1();\nERROR 1970 (42000): EXECUTE..USING does not support\nsubqueries or stored functions\n \nEXECUTE IMMEDIATE \'SELECT * FROM t1 WHERE a=?\' USING\n(SELECT 10);\nERROR 1064 (42000): You have an error in your SQL syntax;\ncheck the manual that \n corresponds to your MariaDB server version for the right\nsyntax to use near \n \'SELECT 10)\' at line 1\n \nOne can use a user or an SP variable as a workaround:\n \nCREATE OR REPLACE FUNCTION f1() RETURNS VARCHAR(64) RETURN\n\'SELECT * FROM t1\';\nSET @stmt=f1();\nEXECUTE IMMEDIATE @stmt;\n \nSET @stmt=(SELECT \'SELECT 1\');\nEXECUTE IMMEDIATE @stmt;\n \nCREATE OR REPLACE FUNCTION f1() RETURNS INT RETURN 10;\nSET @param=f1();\nEXECUTE IMMEDIATE \'SELECT * FROM t1 WHERE a=?\' USING\n@param;\n \nSET @param=(SELECT 10);\nEXECUTE IMMEDIATE \'SELECT * FROM t1 WHERE a=?\' USING\n@param;\n \nEXECUTE IMMEDIATE supports user variables and SP variables\nas OUT parameters\n \nDELIMITER $$\nCREATE OR REPLACE PROCEDURE p1(OUT a INT)\nBEGIN\n SET a:= 10;\nEND;\n$$\nDELIMITER ;\nSET @a=2;\nEXECUTE IMMEDIATE \'CALL p1(?)\' USING @a;\nSELECT @a;\n+------+\n| @a |\n+------+\n| 10 |\n+------+\n \nSimilar to PREPARE, EXECUTE IMMEDIATE is allowed in stored\nprocedures but is not allowed in stored functions.\n \nThis example uses EXECUTE IMMEDIATE inside a stored\nprocedure:\n \nDELIMITER $$\nCREATE OR REPLACE PROCEDURE p1()\nBEGIN\n EXECUTE IMMEDIATE \'SELECT 1\';\nEND;\n$$\nDELIMITER ;\nCALL p1;\n+---+\n| 1 |\n+---+\n| 1 |\n+---+\n \nThis script returns an error:\n \nDELIMITER $$\nCREATE FUNCTION f1() RETURNS INT\nBEGIN\n EXECUTE IMMEDIATE \'DO 1\';\n RETURN 1;\nEND;\n$$\nERROR 1336 (0A000): Dynamic SQL is not allowed in stored\nfunction or trigger\n \nEXECUTE IMMEDIATE can use DEFAULT and IGNORE indicators as\nbind parameters:\n \nCREATE OR REPLACE TABLE t1 (a INT DEFAULT 10);\nEXECUTE IMMEDIATE \'INSERT INTO t1 VALUES (?)\' USING\nDEFAULT;\nSELECT * FROM t1;\n+------+\n| a |\n+------+\n| 10 |\n+------+\n \nEXECUTE IMMEDIATE increments the Com_execute_immediate\nstatus variable, as well as the Com_stmt_prepare,\nCom_stmt_execute and Com_stmt_close status variables.\n \nNote, EXECUTE IMMEDIATE does not increment the\nCom_execute_sql status variable. Com_execute_sql is used\nonly for PREPARE..EXECUTE.\n \nThis session screenshot demonstrates how EXECUTE IMMEDIATE\naffects status variables:\n \nSELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE\nVARIABLE_NAME RLIKE \n (\'COM_(EXECUTE|STMT_PREPARE|STMT_EXECUTE|STMT_CLOSE)\');\n \n+-----------------------+----------------+\n| VARIABLE_NAME | VARIABLE_VALUE |\n+-----------------------+----------------+\n| COM_EXECUTE_IMMEDIATE | 0 |\n| COM_EXECUTE_SQL | 0 |\n| COM_STMT_CLOSE | 0 |\n| COM_STMT_EXECUTE | 0 |\n| COM_STMT_PREPARE | 0 |\n+-----------------------+----------------+\n \nEXECUTE IMMEDIATE \'SELECT 1\';\n+---+\n| 1 |\n+---+\n| 1 |\n+---+\n \nSELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE\nVARIABLE_NAME RLIKE \n (\'COM_(EXECUTE|STMT_PREPARE|STMT_EXECUTE|STMT_CLOSE)\');\n+-----------------------+----------------+\n| VARIABLE_NAME | VARIABLE_VALUE |\n+-----------------------+----------------+\n| COM_EXECUTE_IMMEDIATE | 1 |\n| COM_EXECUTE_SQL | 0 |\n| COM_STMT_CLOSE | 1 |\n| COM_STMT_EXECUTE | 1 |\n| COM_STMT_PREPARE | 1 |\n+-----------------------+----------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/execute-immediate/','','https://mariadb.com/kb/en/execute-immediate/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (100,8,'LOCK TABLES','Syntax\n------ \nLOCK TABLE[S]\n tbl_name [[AS] alias] lock_type\n [, tbl_name [[AS] alias] lock_type] ...\n [WAIT n|NOWAIT]\n \nlock_type:\n READ [LOCAL]\n | [LOW_PRIORITY] WRITE\n | WRITE CONCURRENT\n \nUNLOCK TABLES\n \nDescription\n----------- \nThe lock_type can be one of:\n \nOption | Description | \n \nREAD | Read lock, no writes allowed | \n \nREAD LOCAL | Read lock, but allow concurrent inserts | \n \nWRITE | Exclusive write lock. No other connections can read\nor write to this table | \n \nLOW_PRIORITY WRITE | Exclusive write lock, but allow new\nread locks on the table until we get the write lock. | \n \nWRITE CONCURRENT | Exclusive write lock, but allow READ\nLOCAL locks to the table. | \n \nMariaDB enables client sessions to acquire table locks\nexplicitly for the\npurpose of cooperating with other sessions for access to\ntables, or to\nprevent other sessions from modifying tables during periods\nwhen a\nsession requires exclusive access to them. A session can\nacquire or\nrelease locks only for itself. One session cannot acquire\nlocks for\nanother session or release locks held by another session.\n \nLocks may be used to emulate transactions or to get more\nspeed when\nupdating tables.\n \nLOCK TABLES explicitly acquires table locks for the current\nclient session.\nTable locks can be acquired for base tables or views. To use\nLOCK TABLES,\nyou must have the LOCK TABLES privilege, and the SELECT\nprivilege for\neach object to be locked. See GRANT\n \nFor view locking, LOCK TABLES adds all base tables used in\nthe view to the\nset of tables to be locked and locks them automatically. If\nyou lock a table\nexplicitly with LOCK TABLES, any tables used in triggers are\nalso locked\nimplicitly, as described in Triggers and Implicit Locks.\n \nUNLOCK TABLES explicitly releases any table locks held by\nthe\ncurrent session.\n \nWAIT/NOWAIT\n \nSet the lock wait timeout. See WAIT and NOWAIT.\n \nLimitations\n \nLOCK TABLES doesn\'t work when using Galera cluster. You may\nexperience crashes or locks when used with Galera.\n \nLOCK TABLES works on XtraDB/InnoDB tables only if the\ninnodb_table_locks system variable is set to 1 (the default)\nand autocommit is set to 0 (1 is default). Please note that\nno error message will be returned on LOCK TABLES with\ninnodb_table_locks = 0.\n \nLOCK TABLES implicitly commits the active transaction, if\nany. Also, starting a transaction always releases all table\nlocks acquired with LOCK TABLES. This means that there is no\nway to have table locks and an active transaction at the\nsame time. The only exceptions are the transactions in\nautocommit mode. To preserve the data integrity between\ntransactional and non-transactional tables, the GET_LOCK()\nfunction can be used.\n \nWhile a connection holds an explicit read lock on a table,\nit cannot modify it. If you try, the following error will be\nproduced:\n \nERROR 1099 (HY000): Table \'tab_name\' was locked with a\nREAD lock and can\'t be updated\n \nWhile a connection holds an explicit lock on a table, it\ncannot access a non-locked table. If you try, the following\nerror will be produced:\n \nERROR 1100 (HY000): Table \'tab_name\' was not locked with\nLOCK TABLES\n \nWhile a connection holds an explicit lock on a table, it\ncannot issue the following: INSERT DELAYED, CREATE TABLE,\nCREATE TABLE ... LIKE, and DDL statements involving stored\nprograms and views (except for triggers). If you try, the\nfollowing error will be produced:\n \nERROR 1192 (HY000): Can\'t execute the given command because\nyou have active locked tables or an active transaction\n \nLOCK TABLES can not be used in stored routines - if you try,\nthe following error will be produced on creation:\n \nERROR 1314 (0A000): LOCK is not allowed in stored procedures\n \n\n\nURL: https://mariadb.com/kb/en/lock-tables/','','https://mariadb.com/kb/en/lock-tables/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (101,8,'ROLLBACK','The ROLLBACK statement rolls back (ends) a transaction,\ndestroying any changes to SQL-data so that they never become\nvisible to subsequent transactions. The required syntax for\nthe ROLLBACK statement is as follows. \n \nROLLBACK [ WORK ] [ AND [ NO ] CHAIN ] \n[ TO [ SAVEPOINT ] { | } ]\n \nThe ROLLBACK statement will either end a transaction,\ndestroying all data changes that happened during any of the\ntransaction, or it will just destroy any data changes that\nhappened since you established a savepoint. The basic form\nof the ROLLBACK statement is just the keyword ROLLBACK (the\nkeyword WORK is simply noise and can be omitted without\nchanging the effect). \n \nThe optional AND CHAIN clause is a convenience for\ninitiating a new transaction as soon as the old transaction\nterminates. If AND CHAIN is specified, then there is\neffectively nothing between the old and new transactions,\nalthough they remain separate. The characteristics of the\nnew transaction will be the same as the characteristics of\nthe old one — that is, the new transaction will have the\nsame access mode, isolation level and diagnostics area size\n(we\'ll discuss all of these shortly) as the transaction\njust terminated. The AND NO CHAIN option just tells your\nDBMS to end the transaction — that is, these four SQL\nstatements are equivalent: \n \nROLLBACK;\n \nROLLBACK WORK;\n \nROLLBACK AND NO CHAIN;\n \nROLLBACK WORK AND NO CHAIN;\n \nAll of them end a transaction without saving any transaction\ncharacteristics. The only other options, the equivalent\nstatements: \n \nROLLBACK AND CHAIN;\n \nROLLBACK WORK AND CHAIN;\n \nboth tell your DBMS to end a transaction, but to save that\ntransaction\'s characteristics for the next transaction. \n \nROLLBACK is much simpler than COMMIT: it may involve no more\nthan a few deletions (of Cursors, locks, prepared SQL\nstatements and log-file entries). It\'s usually assumed that\nROLLBACK can\'t fail, although such a thing is conceivable\n(for example, an encompassing transaction might reject an\nattempt to ROLLBACK because it\'s lining up for a COMMIT). \n \nROLLBACK cancels all effects of a transaction. It does not\ncancel effects on objects outside the DBMS\'s control (for\nexample the values in host program variables or the settings\nmade by some SQL/CLI function calls). But in general, it is\na convenient statement for those situations when you say\n\"oops, this isn\'t working\" or when you simply don\'t care\nwhether your temporary work becomes permanent or not.\n \nHere is a moot question. If all you\'ve been doing is\nSELECTs, so that there have been no data changes, should you\nend the transaction with ROLLBACK or COMMIT? It shouldn\'t\nreally matter because both ROLLBACK and COMMIT do the same\ntransaction-terminating job. However, the popular conception\nis that ROLLBACK implies failure, so after a successful\nseries of SELECT statements the convention is to end the\ntransaction with COMMIT rather than ROLLBACK.\n \nMariaDB (and most other DBMSs) supports rollback of SQL-data\nchange statements, but not of SQL-Schema statements. This\nmeans that if you use any of CREATE, ALTER, DROP, GRANT,\nREVOKE, you are implicitly committing at execution time.\n \nINSERT INTO Table_2 VALUES(5); \nDROP TABLE Table_3 CASCADE;\n \nROLLBACK;\n \nThe result will be that both the INSERT and the DROP will go\nthrough as separate transactions so the ROLLBACK will have\nno effect. \n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/rollback/','','https://mariadb.com/kb/en/rollback/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (102,8,'SAVEPOINT','Syntax\n------ \nSAVEPOINT identifier\nROLLBACK [WORK] TO [SAVEPOINT] identifier\nRELEASE SAVEPOINT identifier\n \nDescription\n----------- \nInnoDB supports the SQL statements SAVEPOINT,\nROLLBACK TO SAVEPOINT, RELEASE SAVEPOINT\nand the optional WORK keyword for\nROLLBACK.\n \nEach savepoint must have a legal MariaDB identifier. A\nsavepoint is a named sub-transaction.\n \nNormally ROLLBACK undoes the changes performed by the whole\ntransaction. When used with the TO clause, it undoes the\nchanges performed after the specified savepoint, and erases\nall subsequent savepoints. However, all locks that have been\nacquired after the save point will survive. RELEASE\nSAVEPOINT does not rollback or commit any changes, but\nremoves the specified savepoint.\n \nWhen the execution of a trigger or a stored function begins,\nit is not possible to use statements which reference a\nsavepoint which was defined from out of that stored program.\n \nWhen a COMMIT (including implicit commits) or a ROLLBACK\nstatement (with no TO clause) is performed, they act on the\nwhole transaction, and all savepoints are removed.\n \nErrors\n \nIf COMMIT or ROLLBACK is issued and no transaction was\nstarted, no error is reported.\n \nIf SAVEPOINT is issued and no transaction was started, no\nerror is reported but no savepoint is created. When ROLLBACK\nTO SAVEPOINT or RELEASE SAVEPOINT is called for a savepoint\nthat does not exist, an error like this is issued:\n \nERROR 1305 (42000): SAVEPOINT svp_name does not exist\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/savepoint/','','https://mariadb.com/kb/en/savepoint/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (103,8,'Metadata Locking','Metadata locking has been supported since MariaDB 5.5. This\nmeans that when a transaction (including XA transactions)\nuses a table, it locks its metadata until the end of\ntransaction. Non-transactional tables are also locked, as\nwell as views and objects which are related to locked\ntables/views (stored functions, triggers, etc). When a\nconnection tries to use a DDL statement (like an ALTER\nTABLE) which modifies a table that is locked, that\nconnection is queued, and has to wait until it\'s unlocked.\nUsing savepoints and performing a partial rollback does not\nrelease metadata locks.\n \nLOCK TABLES ... WRITE are also queued. Some wrong statements\nwhich produce an error may not need to wait for the lock to\nbe freed.\n \nMetadata lock\'s timeout is determined by the value of the\nlock_wait_timeout server system variable (in seconds).\nHowever, note that its default value is 31536000 (1 year).\nIf this timeout exceeds, the following error is returned:\n \nERROR 1205 (HY000): Lock wait timeout exceeded;\n try restarting transaction\n \nIf the metadata_lock_info plugin is installed, the\nInformation Schema metadata_lock_info table stores\ninformation about existing metadata locks.\n \nExample\n \nLet\'s use the following MEMORY (non-transactional) table:\n \nCREATE TABLE t (a INT) ENGINE = MEMORY;\n \nConnection 1 starts a transaction, and INSERTs a row into t:\n \nSTART TRANSACTION;\n \nINSERT INTO t SET a=1;\n \nt\'s metadata is now locked by connection 1. Connection 2\ntries to alter t, but has to wait:\n \nALTER TABLE t ADD COLUMN b INT;\n \nConnection 2\'s prompt is blocked now.\n \nNow connection 1 ends the transaction:\n \nCOMMIT;\n \n...and connection 2 finally gets the output of its command:\n \nQuery OK, 1 row affected (35.23 sec)\nRecords: 1 Duplicates: 0 Warnings: 0\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/metadata-locking/','','https://mariadb.com/kb/en/metadata-locking/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (104,8,'PREPARE Statement','Syntax\n------ \nPREPARE stmt_name FROM preparable_stmt\n \nDescription\n----------- \nThe PREPARE statement prepares a statement and assigns it a\nname,\nstmt_name, by which to refer to the statement later.\nStatement names\nare not case sensitive. preparable_stmt is either a string\nliteral or a user variable (not a local variable, an SQL\nexpression or a subquery) that contains the text of the\nstatement. The text must \nrepresent a single SQL statement, not multiple statements.\nWithin the\nstatement, \"?\" characters can be used as parameter markers\nto indicate\nwhere data values are to be bound to the query later when\nyou execute\nit. The \"?\" characters should not be enclosed within\nquotes, even if\nyou intend to bind them to string values. Parameter markers\ncan be used\nonly where data values should appear, not for SQL keywords,\nidentifiers, and so forth.\n \nThe scope of a prepared statement is the session within\nwhich it is\ncreated. Other sessions cannot see it.\n \nIf a prepared statement with the given name already exists,\nit is\ndeallocated implicitly before the new statement is prepared.\nThis means\nthat if the new statement contains an error and cannot be\nprepared, an\nerror is returned and no statement with the given name\nexists.\n \nPrepared statements can be PREPAREd and EXECUTEd in a stored\nprocedure, but not in a stored function or trigger. Also,\neven if the statement is PREPAREd in a procedure, it will\nnot be deallocated when the procedure execution ends.\n \nA prepared statement can access user-defined variables, but\nnot local variables or procedure\'s parameters.\n \nIf the prepared statement contains a syntax error, PREPARE\nwill fail. As a side effect, stored procedures can use it to\ncheck if a statement is valid. For example:\n \nCREATE PROCEDURE `test_stmt`(IN sql_text TEXT)\nBEGIN\n DECLARE EXIT HANDLER FOR SQLEXCEPTION\n BEGIN\n SELECT CONCAT(sql_text, \' is not valid\');\n END;\n SET @SQL := sql_text;\n PREPARE stmt FROM @SQL;\n DEALLOCATE PREPARE stmt;\nEND;\n \nThe FOUND_ROWS() and ROW_COUNT() functions, if called\nimmediatly after EXECUTE, return the number of rows read or\naffected by the prepared statements; however, if they are\ncalled after DEALLOCATE PREPARE, they provide information\nabout this statement. If the prepared statement produces\nerrors or warnings, GET DIAGNOSTICS return information about\nthem. DEALLOCATE PREPARE shouldn\'t clear the diagnostics\narea, unless it produces an error.\n \nA prepared statement is executed with EXECUTE and released \nwith DEALLOCATE PREPARE.\n \nThe max_prepared_stmt_count server system variable\ndetermines the number of allowed prepared statements that\ncan be prepared on the server. If it is set to 0, prepared\nstatements are not allowed. If the limit is reached, an\nerror similar to the following will be produced:\n \nERROR 1461 (42000): Can\'t create more than\nmax_prepared_stmt_count statements \n (current value: 0)\n \nOracle Mode\n \nIn Oracle mode from MariaDB 10.3, PREPARE stmt FROM \'SELECT\n:1, :2\' is used, instead of ?.\n \nPermitted Statements\n \nNot all statements can be prepared. Only the following SQL\ncommands are permitted:\nALTER TABLE\nANALYZE TABLE\nBINLOG\nCACHE INDEX\nCALL\nCHANGE MASTER\nCHECKSUM {TABLE | TABLES}\nCOMMIT\n{CREATE | DROP} DATABASE\n{CREATE | DROP} INDEX\n{CREATE | RENAME | DROP} TABLE\n{CREATE | RENAME | DROP} USER\n{CREATE | DROP} VIEW\nDELETE\nDESCRIBE\nDO\nEXPLAIN\nFLUSH {TABLE | TABLES | TABLES WITH READ LOCK | HOSTS |\nPRIVILEGES | LOGS | STATUS | \n MASTER | SLAVE | DES_KEY_FILE | USER_RESOURCES | QUERY\nCACHE | TABLE_STATISTICS | \n INDEX_STATISTICS | USER_STATISTICS | CLIENT_STATISTICS}\nGRANT\nINSERT\nINSTALL {PLUGIN | SONAME}\nHANDLER READ\nKILL\nLOAD INDEX INTO CACHE\nOPTIMIZE TABLE\nREPAIR TABLE\nREPLACE\nRESET {MASTER | SLAVE | QUERY CACHE}\nREVOKE\nROLLBACK\nSELECT\nSET\nSET GLOBAL SQL_SLAVE_SKIP_COUNTER\nSET ROLE\nSET SQL_LOG_BIN\nSET TRANSACTION ISOLATION LEVEL\nSHOW EXPLAIN\nSHOW {DATABASES | TABLES | OPEN TABLES | TABLE STATUS |\nCOLUMNS | INDEX | TRIGGERS | \n EVENTS | GRANTS | CHARACTER SET | COLLATION | ENGINES |\nPLUGINS [SONAME] | PRIVILEGES | \n PROCESSLIST | PROFILE | PROFILES | VARIABLES | STATUS |\nWARNINGS | ERRORS | \n TABLE_STATISTICS | INDEX_STATISTICS | USER_STATISTICS |\nCLIENT_STATISTICS | AUTHORS | \n CONTRIBUTORS}\nSHOW CREATE {DATABASE | TABLE | VIEW | PROCEDURE | FUNCTION\n| TRIGGER | EVENT}\nSHOW {FUNCTION | PROCEDURE} CODE\nSHOW BINLOG EVENTS\nSHOW SLAVE HOSTS\nSHOW {MASTER | BINARY} LOGS\nSHOW {MASTER | SLAVE | TABLES | INNODB | FUNCTION |\nPROCEDURE} STATUS\nSLAVE {START | STOP}\nTRUNCATE TABLE\nSHUTDOWN\nUNINSTALL {PLUGIN | SONAME}\nUPDATE\n \nSynonyms are not listed here, but can be used. For example,\nDESC can be used instead of DESCRIBE.\n \nCompound statements can be prepared too.\n \nNote that if a statement can be run in a stored routine, it\nwill work even if it is called by a prepared statement. For\nexample, SIGNAL can\'t be directly prepared. However, it is\nallowed in stored routines. If the x() procedure contains\nSIGNAL, you can still prepare and execute the \'CALL x();\'\nprepared statement.\n \nPREPARE now supports most kinds of expressions as well, for\nexample:\n \nPREPARE stmt FROM CONCAT(\'SELECT * FROM \', table_name);\n \nWhen PREPARE is used with a statement which is not\nsupported, the following error is produced:\n \nERROR 1295 (HY000): This command is not supported in the\nprepared statement protocol yet\n \nExample\n \ncreate table t1 (a int,b char(10));\ninsert into t1 values (1,\"one\"),(2,\n\"two\"),(3,\"three\");\nprepare test from \"select * from t1 where a=?\";\nset @param=2;\nexecute test using @param;\n+------+------+\n| a | b |\n+------+------+\n| 2 | two |\n+------+------+\nset @param=3;\nexecute test using @param;\n+------+-------+\n| a | b |\n+------+-------+\n| 3 | three |\n+------+-------+\ndeallocate prepare test;\n \nSince identifiers are not permitted as prepared statements\nparameters, sometimes it is necessary to dynamically compose\nan SQL statement. This technique is called dynamic SQL). The\nfollowing example shows how to use dynamic SQL:\n \nCREATE PROCEDURE test.stmt_test(IN tab_name VARCHAR(64))\nBEGIN\n SET @sql = CONCAT(\'SELECT COUNT(*) FROM \', tab_name);\n PREPARE stmt FROM @sql;\n EXECUTE stmt;\n DEALLOCATE PREPARE stmt;\nEND;\n \nCALL test.stmt_test(\'mysql.user\');\n+----------+\n| COUNT(*) |\n+----------+\n| 4 |\n+----------+\n \nUse of variables in prepared statements:\n \nPREPARE stmt FROM \'SELECT @x;\';\n \nSET @x = 1;\n \nEXECUTE stmt;\n+------+\n| @x |\n+------+\n| 1 |\n+------+\n \nSET @x = 0;\n \nEXECUTE stmt;\n+------+\n| @x |\n+------+\n| 0 |\n+------+\n \nDEALLOCATE PREPARE stmt;\n \n\n\nURL: https://mariadb.com/kb/en/prepare-statement/','','https://mariadb.com/kb/en/prepare-statement/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (105,8,'PURGE BINARY LOGS','Syntax\n------ \nPURGE { BINARY | MASTER } LOGS\n { TO \'log_name\' | BEFORE datetime_expr }\n \nDescription\n----------- \nThe PURGE BINARY LOGS statement deletes all the binary log\nfiles listed in the log index file prior to the specified\nlog file name or\ndate. BINARY and MASTER are synonyms.\nDeleted log files also are removed from the list recorded in\nthe index file, so\nthat the given log file becomes the first in the list.\n \nThe datetime expression is in the format \'YYYY-MM-DD\nhh:mm:ss\'. \n \nIf a slave is active but has yet to read from a binary log\nfile you attempt to delete, the statement will fail with an\nerror. However, if the slave is not connected and has yet to\nread from a log file you delete, the file will be deleted,\nbut the slave will be unable to continue replicating once it\nconnects again.\n \nThis statement has no effect if the server was not started\nwith the\n--log-bin option to enable binary logging.\n \nTo list the binary log files on the server, use SHOW BINARY\nLOGS. To see which files they are reading, use SHOW SLAVE\nSTATUS. You can only delete the files that are older than\nthe oldest file that is used by the slaves.\n \nTo delete all binary log files, use RESET MASTER.\nTo move to a new log file (for example if you want to remove\nthe current log file), use FLUSH LOGS before you execute\nPURGE LOGS.\n \nIf the expire_logs_days server system variable is not set to\n0, the server automatically deletes binary log files after\nthe given number of days.\n \nExamples\n-------- \nPURGE BINARY LOGS TO \'mariadb-bin.000063\';\n \nPURGE BINARY LOGS BEFORE \'2013-04-21\';\n \nPURGE BINARY LOGS BEFORE \'2013-04-22 09:55:22\';\n \n\n\nURL: https://mariadb.com/kb/en/purge-binary-logs/','','https://mariadb.com/kb/en/purge-binary-logs/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (106,8,'RESET MASTER','RESET MASTER [TO #]\n \nDeletes all binary log files listed in the index file,\nresets the\nbinary log index file to be empty, and creates a new binary\nlog file with a suffix of .000001.\n \nIf TO # is given, then the first new binary log file will\nstart from number #.\n \nThis statement is for use only when the master is started\nfor the first time, and should never be used if any slaves\nare actively replicating from the binary log.\n \n\n\nURL: https://mariadb.com/kb/en/reset-master/','','https://mariadb.com/kb/en/reset-master/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (107,8,'RESET SLAVE','RESET SLAVE [\"connection_name\"] [ALL] \n \nRESET SLAVE makes the slave forget its replication position\nin the\nmaster\'s binary log. This statement is meant to be used for\na clean\nstart. It deletes the master.info and relay-log.info files,\nall the\nrelay log files, and starts a new relay log file. To use\nRESET SLAVE,\nthe slave replication threads must be stopped (use STOP\nSLAVE if\nnecessary).\n \nNote: All relay log files are deleted, even if they have not\nbeen\ncompletely executed by the slave SQL thread. (This is a\ncondition\nlikely to exist on a replication slave if you have issued a\nSTOP SLAVE\nstatement or if the slave is highly loaded.)\n \nConnection information stored in the master.info file is\nimmediately\nreset using any values specified in the corresponding\nstartup options.\nThis information includes values such as master host, master\nport,\nmaster user, and master password. If the slave SQL thread\nwas in the\nmiddle of replicating temporary tables when it was stopped,\nand RESET\nSLAVE is issued, these replicated temporary tables are\ndeleted on the\nslave.\n \nThe ALL also resets the PORT, HOST, USER and PASSWORD\nparameters for the slave. If you are using a connection\nname, it will permanently delete it and it will not show up\nanymore in SHOW ALL SLAVES STATUS.\n \nconnection_name\n \nThe connection_name option was added as part of multi-source\nreplication added in MariaDB 10.0\n \nIf there is only one nameless master, or the default master\n(as specified by the default_master_connection system\nvariable) is intended, connection_name can be omitted. If\nprovided, the RESET SLAVE statement will apply to the\nspecified master. connection_name is case-insensitive.\n \n\n\nURL: https://mariadb.com/kb/en/reset-slave-connection_name/','','https://mariadb.com/kb/en/reset-slave-connection_name/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (108,8,'SET TRANSACTION','Syntax\n------ \nSET [GLOBAL | SESSION] TRANSACTION\n transaction_property [, transaction_property] ...\n \ntransaction_property:\n ISOLATION LEVEL level\n | READ WRITE\n | READ ONLY\n \nlevel:\n REPEATABLE READ\n | READ COMMITTED\n | READ UNCOMMITTED\n | SERIALIZABLE\n \nDescription\n----------- \nThis statement sets the transaction isolation level or the\ntransaction access mode globally, for the current session,\nor for the next transaction:\nWith the GLOBAL keyword, the statement sets the default\n transaction level globally for all subsequent sessions.\nExisting sessions are\n unaffected.\nWith the SESSION keyword, the statement sets the default\n transaction level for all subsequent transactions performed\nwithin the\n current session.\nWithout any SESSION or GLOBAL keyword,\n the statement sets the isolation level for the next (not\nstarted) transaction\n performed within the current session.\n \nA change to the global default isolation level requires the \nSUPER privilege. Any session is free to change its\nsession isolation level (even in the middle of a\ntransaction), or the isolation\nlevel for its next transaction.\n \nIsolation Level\n \nTo set the global default isolation level at server startup,\nuse the\n--transaction-isolation=level option on the command line or\nin an option file. Values of level for this option use\ndashes\nrather than spaces, so the allowable values are\nREAD-UNCOMMITTED,\nREAD-COMMITTED, REPEATABLE-READ, or\nSERIALIZABLE. For example, to set the default isolation\nlevel to REPEATABLE READ, use these lines in the [mysqld]\nsection of an option file:\n \n[mysqld]\ntransaction-isolation = REPEATABLE-READ\nTo determine the global and session transaction isolation\nlevels at\nruntime, check the value of the tx_isolation system\nvariable:\n \nSELECT @@GLOBAL.tx_isolation, @@tx_isolation;\n \nInnoDB supports each of the translation isolation levels\ndescribed here\nusing different locking strategies. The default level is \nREPEATABLE READ. For additional information about InnoDB\nrecord-level locks and how it uses them to execute various\ntypes of statements,\nsee XtraDB/InnoDB Lock Modes,\nand\nhttp://dev.mysql.com/doc/refman/en/innodb-locks-set.html.\n \nIsolation Levels\n \nThe following sections describe how MariaDB supports the\ndifferent transaction levels.\n \nREAD UNCOMMITTED\n \nSELECT statements are performed in a non-locking fashion,\nbut a possible earlier version of a row might be used. Thus,\nusing this\nisolation level, such reads are not consistent. This is also\ncalled a \"dirty\nread.\" Otherwise, this isolation level works like \nREAD COMMITTED.\n \nREAD COMMITTED\n \nA somewhat Oracle-like isolation level with respect to\nconsistent\n(non-locking) reads: Each consistent read, even within the\nsame\ntransaction, sets and reads its own fresh snapshot. See\nhttp://dev.mysql.com/doc/refman/en/innodb-consistent-read.html.\n \nFor locking reads (SELECT with FOR UPDATE\nor LOCK IN SHARE MODE), InnoDB locks only index records, not\nthe gaps before them, and thus allows the free insertion of\nnew records next to\nlocked records. For UPDATE and DELETE\nstatements, locking depends on whether the statement uses a\nunique index with a\nunique search condition (such as WHERE id = 100), or a\nrange-type search condition (such as WHERE id > 100). For a\nunique index with a unique search condition, InnoDB locks\nonly the index record\nfound, not the gap before it. For range-type searches,\nInnoDB locks the index\nrange scanned, using gap locks or next-key (gap plus\nindex-record) locks to\nblock insertions by other sessions into the gaps covered by\nthe range. This is\nnecessary because \"phantom rows\" must be blocked for MySQL\nreplication and\nrecovery to work.\n \nNote: Since MariaDB 5.1, if the READ COMMITTED isolation\nlevel is used or the innodb_locks_unsafe_for_binlog system\nvariable is enabled,\nthere is no InnoDB gap locking except for foreign-key\nconstraint checking and\nduplicate-key checking. Also, record locks for non-matching\nrows are released\nafter MariaDB has evaluated the WHERE condition. As of\nMariaDB/MySQL\n5.1, if you use READ COMMITTED or enable\ninnodb_locks_unsafe_for_binlog, you must use row-based\nbinary logging.\n \nREPEATABLE READ\n \nThis is the default isolation level for InnoDB. For\nconsistent reads,\nthere is an important difference from the READ COMMITTED\nisolation level: All consistent reads within the same\ntransaction read the\nsnapshot established by the first read. This convention\nmeans that if you issue\nseveral plain (non-locking) SELECT statements within the\nsame transaction, these SELECT statements are consistent\nalso with respect to each other. See\nhttp://dev.mysql.com/doc/refman/en/innodb-consistent-read.html.\n \nFor locking reads (SELECT with FOR UPDATE or LOCK IN SHARE\nMODE),\nUPDATE, and DELETE statements, locking depends on whether\nthe\nstatement uses a unique index with a unique search\ncondition, or a\nrange-type search condition. For a unique index with a\nunique search\ncondition, InnoDB locks only the index record found, not the\ngap\nbefore it. For other search conditions, InnoDB locks the\nindex range\nscanned, using gap locks or next-key (gap plus index-record)\nlocks to\nblock insertions by other sessions into the gaps covered by\nthe range.\n \nThis is the minimum isolation level for non-distributed XA\ntransactions.\n \nSERIALIZABLE\n \nThis level is like REPEATABLE READ, but InnoDB implicitly\nconverts all\nplain SELECT statements to SELECT ... LOCK IN SHARE MODE if\nautocommit\nis disabled. If autocommit is enabled, the SELECT is its own\ntransaction. It therefore is known to be read only and can\nbe\nserialized if performed as a consistent (non-locking) read\nand need\nnot block for other transactions. (This means that to force\na plain\nSELECT to block if other transactions have modified the\nselected rows,\nyou should disable autocommit.)\n \nDistributed XA transactions should always use this isolation\nlevel.\n \nAccess Mode\n \nThese clauses appeared in MariaDB 10.0.\n \nThe access mode specifies whether the transaction is allowed\nto write data or not. By default, transactions are in READ\nWRITE mode (see the tx_read_only system variable). READ ONLY\nmode allows the storage engine to apply optimizations that\ncannot be used for transactions which write data. The only\nexception to this rule is that read only transactions can\nperform DDL statements on temporary tables.\n \nIt is not permitted to specify both READ WRITE and READ ONLY\nin the same statement.\n \nREAD WRITE and READ ONLY can also be specified in the START\nTRANSACTION statement, in which case the specified mode is\nonly valid for one transaction.\n \nExamples\n-------- \nSET GLOBAL TRANSACTION ISOLATION LEVEL SERIALIZABLE;\n \nAttempting to set the isolation level within an existing\ntransaction without specifying GLOBAL or SESSION.\n \nSTART TRANSACTION;\n \nSET TRANSACTION ISOLATION LEVEL SERIALIZABLE;\nERROR 1568 (25001): Transaction characteristics can\'t be\nchanged while a transaction is in progress\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/set-transaction/','','https://mariadb.com/kb/en/set-transaction/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (109,8,'START SLAVE','Syntax\n------ \nSTART SLAVE [\"connection_name\"] [thread_type [,\nthread_type] ... ]\nSTART SLAVE [\"connection_name\"] [SQL_THREAD] UNTIL \n MASTER_LOG_FILE = \'log_name\', MASTER_LOG_POS = log_pos\nSTART SLAVE [\"connection_name\"] [SQL_THREAD] UNTIL\n RELAY_LOG_FILE = \'log_name\', RELAY_LOG_POS = log_pos\nSTART SLAVE [\"connection_name\"] [SQL_THREAD] UNTIL\n MASTER_GTID_POS = \nSTART ALL SLAVES [thread_type [, thread_type]]\nthread_type: IO_THREAD | SQL_THREAD\n \nDescription\n----------- \nSTART SLAVE with no thread_type options starts both of the\nslave\nthreads (see replication). The I/O thread reads events from\nthe master server and stores\nthem in the relay log. The SQL thread reads events from the\nrelay log\nand executes them. START SLAVE requires the SUPER privilege.\n \nIf START SLAVE succeeds in starting the slave threads, it\nreturns\nwithout any error. However, even in that case, it might be\nthat the\nslave threads start and then later stop (for example,\nbecause they do\nnot manage to connect to the master or read its binary log,\nor some\nother problem). START SLAVE does not warn you about this.\nYou must\ncheck the slave\'s error log for error messages generated by\nthe slave\nthreads, or check that they are running satisfactorily with\nSHOW SLAVE\nSTATUS.\n \nSTART SLAVE UNTIL\n \nSTART SLAVE UNTIL refers to the SQL_THREAD slave position at\nwhich the SQL_THREAD replication will halt. If SQL_THREAD\nisn\'t specified both threads are started.\n \nSince version 10.0.2, START SLAVE UNTIL master_gtid_pos=xxx\nhas also been supported. See Global Transaction ID/START\nSLAVE UNTIL master_gtid_pos=xxx for more details.\n \nconnection_name\n \nThe connection_name option was added as part of multi-source\nreplication added in MariaDB 10.0\n \nIf there is only one nameless master, or the default master\n(as specified by the default_master_connection system\nvariable) is intended, connection_name can be omitted. If\nprovided, the START SLAVE statement will apply to the\nspecified master. connection_name is case-insensitive.\n \nSTART ALL SLAVES\n \nSTART ALL SLAVES starts all configured slaves (slaves with\nmaster_host not empty) that were not started before. It will\ngive a note for all started connections. You can check the\nnotes with SHOW WARNINGS.\n \n\n\nURL: https://mariadb.com/kb/en/start-slave/','','https://mariadb.com/kb/en/start-slave/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (110,8,'START TRANSACTION','Syntax\n------ \nSTART TRANSACTION [transaction_property [,\ntransaction_property] ...] | BEGIN [WORK]\nCOMMIT [WORK] [AND [NO] CHAIN] [[NO] RELEASE]\nROLLBACK [WORK] [AND [NO] CHAIN] [[NO] RELEASE]\nSET autocommit = {0 | 1}\n \ntransaction_property:\n WITH CONSISTENT SNAPSHOT\n | READ WRITE\n | READ ONLY\n \nDescription\n----------- \nThe START TRANSACTION or BEGIN statement\nbegins a new transaction. COMMIT commits the current\ntransaction, making its changes permanent. ROLLBACK rolls\nback the current transaction, canceling its changes. The SET\nautocommit statement disables or enables the default\nautocommit mode for the current session.\n \nSTART TRANSACTION and SET autocommit = 1 implicitly commit\nthe current transaction, if any.\n \nThe optional WORK keyword is supported for\nCOMMIT and ROLLBACK, as are the\nCHAIN and RELEASE clauses.\nCHAIN and RELEASE can be used for\nadditional control over transaction completion. The value of\nthe\ncompletion_type system variable determines the default\ncompletion behavior.\n \nThe AND CHAIN clause causes a new transaction to begin as\nsoon as the current one ends, and the new transaction has\nthe same isolation\nlevel as the just-terminated transaction. The RELEASE clause\ncauses the server to disconnect the current client session\nafter terminating\nthe current transaction. Including the NO keyword suppresses\nCHAIN or RELEASE completion, which can be\nuseful if the completion_type system variable is set to\ncause chaining or release completion by default.\n \nAccess Mode\n \nThese clauses appeared in MariaDB 10.0.\n \nThe access mode specifies whether the transaction is allowed\nto write data or not. By default, transactions are in READ\nWRITE mode (see the tx_read_only system variable). READ ONLY\nmode allows the storage engine to apply optimizations that\ncannot be used for transactions which write data. The only\nexception to this rule is that read only transactions can\nperform DDL statements on temporary tables.\n \nIt is not permitted to specify both READ WRITE and READ ONLY\nin the same statement.\n \nREAD WRITE and READ ONLY can also be specified in the SET\nTRANSACTION statement, in which case the specified mode is\nvalid for all sessions, or for all subsequent transaction\nused by the current session.\n \nautocommit\n \nBy default, MariaDB runs with autocommit mode enabled. This\nmeans that as soon as you execute a statement that updates\n(modifies) a table, MariaDB stores the update on disk to\nmake it permanent. To disable autocommit mode, use the\nfollowing statement:\n \nSET autocommit=0;\n \nAfter disabling autocommit mode by setting the autocommit\nvariable to zero, changes to transaction-safe tables (such\nas those for InnoDB or\nNDBCLUSTER) are not made permanent immediately. You must use\nCOMMIT to store your changes to disk or ROLLBACK to ignore\nthe changes.\n \nTo disable autocommit mode for a single series of\nstatements, use the START TRANSACTION statement.\n \nDDL Statements\n \nDDL statements (CREATE, ALTER, DROP) and administrative\nstatements (FLUSH, RESET, OPTIMIZE, ANALYZE, CHECK, REPAIR,\nCACHE INDEX), and LOAD DATA INFILE, cause an implicit COMMIT\nand start a new transaction. An exception to this rule are\nthe DDL that operate on temporary tables: you can CREATE,\nALTER and DROP them without causing any COMMIT, but those\nactions cannot be rolled back. This means that if you call\nROLLBACK, the temporary tables you created in the\ntransaction will remain, while the rest of the transaction\nwill be rolled back.\n \nTransactions cannot be used in Stored Functions or Triggers.\nIn Stored Procedures and Events BEGIN is not allowed, so you\nshould use START TRANSACTION instead.\n \nA transaction acquires a metadata lock on every table it\naccesses to prevent other connections from altering their\nstructure. The lock is released at the end of the\ntransaction. This happens even with non-transactional\nstorage engines (like MEMORY or CONNECT), so it makes sense\nto use transactions with non-transactional tables.\n \nin_transaction\n \nThe in_transaction system variable appeared in MariaDB 5.3.\n \nIt is a session-only, read-only variable that returns 1\ninside a transaction, and 0 if not in a transaction.\n \nWITH CONSISTENT SNAPSHOT\n \nThe WITH CONSISTENT SNAPSHOT option starts a consistent read\nfor storage engines such as XtraDB and InnoDB that can do\nso, the same as if a START TRANSACTION followed by a SELECT\nfrom any InnoDB table was issued. \n \nMariaDB 5.3 introduced enhancements to this feature. See\nEnhancements for START TRANSACTION WITH CONSISTENT SNAPSHOT.\n \nExamples\n-------- \nSTART TRANSACTION;\n \nSELECT @A:=SUM(salary) FROM table1 WHERE type=1;\n \nUPDATE table2 SET summary=@A WHERE type=1;\n \nCOMMIT;\n \n\n\nURL: https://mariadb.com/kb/en/start-transaction/','','https://mariadb.com/kb/en/start-transaction/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (111,8,'STOP SLAVE','Syntax\n------ \nSTOP SLAVE [\"connection_name\"] [thread_type [,\nthread_type] ... ]\n \nSTOP ALL SLAVES [thread_type [, thread_type]]\n \nthread_type: IO_THREAD | SQL_THREAD\n \nDescription\n----------- \nStops the slave threads. STOP SLAVE requires the SUPER\nprivilege.\n \nLike START SLAVE, this statement may be used with the\nIO_THREAD and\nSQL_THREAD options to name the thread or threads to be\nstopped. In almost all cases, one never need to use the\nthread_type options.\n \nSTOP SLAVE waits until any current replication event group\naffecting\none or more non-transactional tables has finished executing\n(if there\nis any such replication group), or until the user issues a\nKILL QUERY or KILL CONNECTION statement.\n \nNote that STOP SLAVE doesn\'t delete the connection\npermanently. Next time you execute START SLAVE or the\nMariaDB server restarts, the slave connection is restored\nwith it\'s original arguments. If you want to delete a\nconnection, you should execute RESET SLAVE.\n \nSTOP ALL SLAVES\n \nSTOP ALL SLAVES stops all your running slaves. It will give\nyou a note for every stopped connection. You can check the\nnotes with SHOW WARNINGS.\n \nconnection_name\n \nThe connection_name option was added as part of multi-source\nreplication added in MariaDB 10.0\n \nIf there is only one nameless master, or the default master\n(as specified by the default_master_connection system\nvariable) is intended, connection_name can be omitted. If\nprovided, the STOP SLAVE statement will apply to the\nspecified master. connection_name is case-insensitive.\n \n\n\nURL: https://mariadb.com/kb/en/stop-slave/','','https://mariadb.com/kb/en/stop-slave/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (112,8,'Transaction Timeouts','MariaDB has always had the wait_timeout and\ninteractive_timeout settings, which close connections after\na certain period of inactivity.\n \nHowever, these are by default set to a long wait period. In\nsituations where transactions may be started, but not\ncommitted or rolled back, more granular control and a\nshorter timeout may be desirable so as to avoid locks being\nheld for too long.\n \nMariaDB 10.3 introduced three new variables to handle this\nsituation.\nidle_transaction_timeout (all transactions)\nidle_write_transaction_timeout (write transactions - called\nidle_readwrite_transaction_timeout until MariaDB 10.3.2)\nidle_readonly_transaction_timeout (read transactions)\n \nThese accept a time in seconds to time out, by closing the\nconnection, transactions that are idle for longer than this\nperiod. By default all are set to zero, or no timeout.\n \nidle_transaction_timeout affects all transactions,\nidle_write_transaction_timeout affects write transactions\nonly and idle_readonly_transaction_timeout affects read\ntransactions only. The latter two variables work\nindependently. However, if either is set along with\nidle_transaction_timeout, the settings for\nidle_write_transaction_timeout or\nidle_readonly_transaction_timeout will take precedence.\n \nExamples\n-------- \nSET SESSION idle_transaction_timeout=2;\n \nBEGIN;\n \nSELECT * FROM t;\n \nEmpty set (0.000 sec)\n## wait 3 seconds\nSELECT * FROM t;\n \nERROR 2006 (HY000): MySQL server has gone away\n \nSET SESSION idle_write_transaction_timeout=2;\n \nBEGIN;\n \nSELECT * FROM t;\n \nEmpty set (0.000 sec)\n## wait 3 seconds\nSELECT * FROM t;\n \nEmpty set (0.000 sec)\nINSERT INTO t VALUES(1);\n## wait 3 seconds\nSELECT * FROM t;\n \nERROR 2006 (HY000): MySQL server has gone away\n \nSET SESSION idle_transaction_timeout=2, SESSION\nidle_readonly_transaction_timeout=10;\n \nBEGIN;\n \nSELECT * FROM t;\n \nEmpty set (0.000 sec)\n ## wait 3 seconds\nSELECT * FROM t;\n \nEmpty set (0.000 sec)\n## wait 11 seconds\nSELECT * FROM t;\n \nERROR 2006 (HY000): MySQL server has gone away\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/transaction-timeouts/','','https://mariadb.com/kb/en/transaction-timeouts/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (113,8,'UNLOCK TABLES','Syntax\n------ \nUNLOCK TABLES\n \nDescription\n----------- \nUNLOCK TABLES explicitly releases any table locks held by\nthe\ncurrent session. See LOCK TABLES for more information.\n \nIn addition to releasing table locks acquired by the LOCK\nTABLES statement, the UNLOCK TABLES statement also releases\nthe global read lock acquired by the FLUSH TABLES WITH READ\nLOCK statement. The FLUSH TABLES WITH READ LOCK statement is\nvery useful for performing backups. See FLUSH for more\ninformation about FLUSH TABLES WITH READ LOCK.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/transactions-unlock-tables/','','https://mariadb.com/kb/en/transactions-unlock-tables/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (114,8,'WAIT and NOWAIT','MariaDB 10.3.0 introduced extended syntax so that it is\npossible to set innodb_lock_wait_timeout and\nlock_wait_timeout for the following statements:\n \nSyntax\n------ \nALTER TABLE tbl_name [WAIT n|NOWAIT] ...\nCREATE ... INDEX ON tbl_name (index_col_name, ...) [WAIT\nn|NOWAIT] ...\nDROP INDEX ... [WAIT n|NOWAIT]\nDROP TABLE tbl_name [WAIT n|NOWAIT] ...\nLOCK TABLE ... [WAIT n|NOWAIT]\nOPTIMIZE TABLE tbl_name [WAIT n|NOWAIT]\nRENAME TABLE tbl_name [WAIT n|NOWAIT] ...\nSELECT ... FOR UPDATE [WAIT n|NOWAIT]\nSELECT ... LOCK IN SHARE MODE [WAIT n|NOWAIT]\nTRUNCATE TABLE tbl_name [WAIT n|NOWAIT]\n \nDescription\n----------- \nThe lock wait timeout can be explicitly set in the statement\nby using either WAIT n (to set the wait in seconds) or\nNOWAIT, in which case the statement will immediately fail if\nthe lock cannot be obtained. WAIT 0 is equivalent to NOWAIT.\n \n\n\nURL: https://mariadb.com/kb/en/wait-and-nowait/','','https://mariadb.com/kb/en/wait-and-nowait/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (115,8,'XA Transactions','Overview\n \nThe MariaDB XA implementation is based on the X/Open CAE\ndocument Distributed Transaction Processing: The XA\nSpecification. This document is published by The Open Group\nand available at\nhttp://www.opengroup.org/public/pubs/catalog/c193.htm.\n \nXA transactions are designed to allow distributed\ntransactions, where a transaction manager (the application)\ncontrols a transaction which involves multiple resources.\nSuch resources are usually DBMSs, but could be resources of\nany type. The whole set of required transactional operations\nis called a global transaction. Each subset of operations\nwhich involve a single resource is called a local\ntransaction. XA used a 2-phases commit (2PC). With the first\ncommit, the transaction manager tells each resource to\nprepare an effective commit, and waits for a confirm\nmessage. The changes are not still made effective at this\npoint. If any of the resources encountered an error, the\ntransaction manager will rollback the global transaction. If\nall resources communicate that the first commit is\nsuccessful, the transaction manager can require a second\ncommit, which makes the changes effective.\n \nIn MariaDB, XA transactions can only be used with storage\nengines that support them. At least InnoDB, TokuDB, SPIDER\nand MyRocks support them. For InnoDB, XA transactions can be\ndisabled by setting the innodb_support_xa server system\nvariable to 0. \n \nLike regular transactions, XA transactions create metadata\nlocks on accessed tables.\n \nXA transactions require REPEATABLE READ as a minimum\nisolation level. However, distributed transactions should\nalways use SERIALIZABLE.\n \nTrying to start more than one XA transaction at the same\ntime produces a 1400 error (SQLSTATE \'XAE09\'). The same\nerror is produced when attempting to start an XA transaction\nwhile a regular transaction is in effect. Trying to start a\nregular transaction while an XA transaction is in effect\nproduces a 1399 error (SQLSTATE \'XAE07\').\n \nThe statements that cause an implicit COMMIT for regular\ntransactions produce a 1400 error (SQLSTATE \'XAE09\') if a\nXA transaction is in effect.\n \nInternal XA vs External XA\n \nXA transactions are an overloaded term in MariaDB. If a\nstorage engine is XA-capable, it can mean one or both of\nthese:\nIt supports MariaDB\'s internal two-phase commit API. This\nis transparent to the user. Sometimes this is called\n\"internal XA\", since MariaDB\'s internal transaction\ncoordinator log can handle coordinating these transactions.\n \nIt supports XA transactions, with the XA START, XA PREPARE,\nXA COMMIT, etc. statements. Sometimes this is called\n\"external XA\", since it requires the use of an external\ntransaction coordinator to use this feature properly.\n \nTransaction Coordinator Log\n \nIf you have two or more XA-capable storage engines enabled,\nthen a transaction coordinator log must be available.\n \nThere are currently two implementations of the transaction\ncoordinator log:\nBinary log-based transaction coordinator log\nMemory-mapped file-based transaction coordinator log\n \nIf the binary log is enabled on a server, then the server\nwill use the binary log-based transaction coordinator log.\nOtherwise, it will use the memory-mapped file-based\ntransaction coordinator log.\n \nSee Transaction Coordinator Log for more information.\n \nSyntax\n------ \nXA {START|BEGIN} xid [JOIN|RESUME]\n \nXA END xid [SUSPEND [FOR MIGRATE]]\n \nXA PREPARE xid\n \nXA COMMIT xid [ONE PHASE]\n \nXA ROLLBACK xid\n \nXA RECOVER [FORMAT=[\'RAW\'|\'SQL\']]\n \nxid: gtrid [, bqual [, formatID ]]\n \nThe interface to XA transactions is a set of SQL statements\nstarting with XA. Each statement changes a transaction\'s\nstate, determining which actions it can perform. A\ntransaction which does not exist is in the NON-EXISTING\nstate.\n \nXA START (or BEGIN) starts a transaction and defines its xid\n(a transaction identifier). The JOIN or RESUME keywords have\nno effect. The new transaction will be in ACTIVE state.\n \nThe xid can have 3 components, though only the first one is\nmandatory. gtrid is a quoted string representing a global\ntransaction identifier. bqual is a quoted string\nrepresenting a local transaction identifier. formatID is an\nunsigned integer indicating the format used for the first\ntwo components; if not specified, defaults to 1. MariaDB\ndoes not interpret in any way these components, and only\nuses them to identify a transaction. xids of transactions in\neffect must be unique.\n \nXA END declares that the specified ACTIVE transaction is\nfinished and it changes its state to IDLE. SUSPEND [FOR\nMIGRATE] has no effect.\n \nXA PREPARE prepares an IDLE transaction for commit, changing\nits state to PREPARED. This is the first commit.\n \nXA COMMIT definitely commits and terminates a transaction\nwhich has already been PREPARED. If the ONE PHASE clause is\nspecified, this statements performs a 1-phase commit on an\nIDLE transaction.\n \nXA ROLLBACK rolls back and terminates an IDLE or PREPARED\ntransaction.\n \nXA RECOVER shows information about all PREPARED\ntransactions.\n \nWhen trying to execute an operation which is not allowed for\nthe transaction\'s current state, an error is produced:\n \nXA COMMIT \'test\' ONE PHASE;\n \nERROR 1399 (XAE07): XAER_RMFAIL: The command cannot be\nexecuted when global transaction is in the ACTIVE state\n \nXA COMMIT \'test2\';\n \nERROR 1399 (XAE07): XAER_RMFAIL: The command cannot be\nexecuted when global transaction is in the NON-EXISTING\nstate\n \nXA RECOVER\n \nThe XA RECOVER statement shows information about all\ntransactions which are in the PREPARED state. It does not\nmatter which connection created the transaction: if it has\nbeen PREPARED, it appears. But this does not mean that a\nconnection can commit or rollback a transaction which was\nstarted by another connection. Note that transactions using\na 1-phase commit are never in the PREPARED state, so they\ncannot be shown by XA RECOVER.\n \nXA RECOVER produces four columns:\n \nXA RECOVER;\n \n+----------+--------------+--------------+------+\n| formatID | gtrid_length | bqual_length | data |\n+----------+--------------+--------------+------+\n| 1 | 4 | 0 | test |\n+----------+--------------+--------------+------+\n \nYou can use XA RECOVER FORMAT=\'SQL\' to get the data in a\nhuman readable\nform that can be directly copy-pasted into XA COMMIT or XA\nROLLBACK. This is particularly useful for binary xid\ngenerated by some transaction coordinators.\n \nformatID is the formatID part of xid.\n \ndata are the gtrid and bqual parts of xid, concatenated.\n \ngtrid_length and bqual_length are the lengths of gtrid and\nbqual, respectevely.\n \nExamples\n-------- \n2-phases commit:\n \nXA START \'test\';\n \nINSERT INTO t VALUES (1,2);\n \nXA END \'test\';\n \nXA PREPARE \'test\';\n \nXA COMMIT \'test\';\n \n1-phase commit:\n \nXA START \'test\';\n \nINSERT INTO t VALUES (1,2);\n \nXA END \'test\';\n \nXA COMMIT \'test\' ONE PHASE;\n \nHuman-readable:\n \nxa start \'12\\r34\\t67\\v78\', \'abc\\ndef\', 3;\n \ninsert t1 values (40);\n \nxa end \'12\\r34\\t67\\v78\', \'abc\\ndef\', 3;\n \nxa prepare \'12\\r34\\t67\\v78\', \'abc\\ndef\', 3;\n \nxa recover format=\'RAW\';\n \n+----------+--------------+--------------+--------------------+\n| formatID | gtrid_length | bqual_length | data |\n+----------+--------------+--------------+--------------------+\n34 67v78abc 11 | 7 | 12\ndef |\n+----------+--------------+--------------+--------------------+\n \nxa recover format=\'SQL\';\n \n+----------+--------------+--------------+-----------------------------------------------+\n| formatID | gtrid_length | bqual_length | data |\n+----------+--------------+--------------+-----------------------------------------------+\n| 3 | 11 | 7 |\nX\'31320d3334093637763738\',X\'6162630a646566\',3 |\n+----------+--------------+--------------+-----------------------------------------------+\n \nxa rollback\nX\'31320d3334093637763738\',X\'6162630a646566\',3;\n \nKnown Issues\n \nMariaDB Galera Cluster\n \nMariaDB Galera Cluster does not support XA transactions. See\nMDEV-10532 for more information on that. The request to\nimplement that feature is being tracked at MDEV-17099.\n \nHowever, MariaDB Galera Cluster builds include a built-in\nplugin called wsrep. Prior to MariaDB 10.4.3, this plugin\nwas internally considered an XA-capable storage engine.\nConsequently, these MariaDB Galera Cluster builds have\nmultiple XA-capable storage engines by default, even if the\nonly \"real\" storage engine that supports external XA\ntransactions enabled on these builds by default is InnoDB.\nTherefore, when using one these builds MariaDB would be\nforced to use a transaction coordinator log by default,\nwhich could have performance implications.\n \nSee Transaction Coordinator Log Overview: MariaDB Galera\nCluster for more information.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/xa-transactions/','','https://mariadb.com/kb/en/xa-transactions/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (116,10,'Account Locking','Account locking was introduced in MariaDB 10.4.2.\n \nDescription\n----------- \nAccount locking permits privileged administrators to\nlock/unlock user accounts. No new client connections will be\npermitted if an account is locked (existing connections are\nnot affected).\n \nUser accounts can be locked at creation, with the CREATE\nUSER statement, or modified after creation with the ALTER\nUSER statement. For example:\n \nCREATE USER \'lorin\'@\'localhost\' ACCOUNT LOCK;\n \nor\n \nALTER USER \'marijn\'@\'localhost\' ACCOUNT LOCK;\n \nThe server will return an ER_ACCOUNT_HAS_BEEN_LOCKED error\nwhen locked users attempt to connect:\n \nmysql -ulorin\n ERROR 4151 (HY000): Access denied, this account is locked\n \nThe ALTER USER statement is also used to unlock a user:\n \nALTER USER \'lorin\'@\'localhost\' ACCOUNT UNLOCK;\n \nThe SHOW CREATE USER statement will show whether the account\nis locked:\n \nSHOW CREATE USER \'marijn\'@\'localhost\';\n \n+-----------------------------------------------+\n| CREATE USER for marijn@localhost |\n+-----------------------------------------------+\n| CREATE USER \'marijn\'@\'localhost\' ACCOUNT LOCK |\n+-----------------------------------------------+\n \nas well as querying the mysql.global_priv table:\n \nSELECT CONCAT(user, \'@\', host, \' => \',\nJSON_DETAILED(priv)) FROM mysql.global_priv \n WHERE user=\'marijn\';\n+--------------------------------------------------------------------------------------+\n| CONCAT(user, \'@\', host, \' => \', JSON_DETAILED(priv)) |\n+--------------------------------------------------------------------------------------+\n| marijn@localhost => {\n \"access\": 0,\n \"plugin\": \"mysql_native_password\",\n \"authentication_string\": \"\",\n \"account_locked\": true,\n \"password_last_changed\": 1558017158\n} |\n+--------------------------------------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/account-locking/','','https://mariadb.com/kb/en/account-locking/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (117,10,'Authentication from MariaDB 10.4','MariaDB 10.4 introduces a number of changes to the\nauthentication process, intended to make things easier and\nmore intuitive.\n \nOverview\n \nThere are four main changes relating to authentication:\nIt is possible to use more than one authentication plugin\nfor each user account. For example, this can be useful to\nslowly migrate users to the more secure ed25519\nauthentication plugin over time, while allowing the old\nmysql_native_password authentication plugin as an\nalternative for the transitional period.\nThe root@localhost user account created by mysql_install_db\nis created with the ability to use two authentication\nplugins.\nFirst, it is configured to try to use the unix_socket\nauthentication plugin. This allows the the root@localhost\nuser to login without a password via the local Unix socket\nfile defined by the socket system variable, as long as the\nlogin is attempted from a process owned by the operating\nsystem root user account.\nSecond, if authentication fails with the unix_socket\nauthentication plugin, then it is configured to try to use\nthe mysql_native_password authentication plugin. However, an\ninvalid password is initially set, so in order to\nauthenticate this way, a password must be set with SET\nPASSWORD.\nHowever, just using the unix_socket authentication plugin\nmay be fine for many users, and it is very secure. You may\nwant to try going without password authentication to see how\nwell it works for you. Remember, the best way to keep your\npassword safe is not to have one!\n \nAll user accounts, passwords, and global privileges are now\nstored in the mysql.global_priv table. The mysql.user table\nstill exists and has exactly the same set of columns as\nbefore, but it’s now a view that references the\nmysql.global_priv table. Tools that analyze the mysql.user\ntable should continue to workas before.\nMariaDB 10.4 supports User Password Expiry, which is not\nactive by default.\n \nDescription\n----------- \nAs a result of the above changes, the open-for-everyone\nall-powerful root account is finally gone. And installation\nscripts will no longer demand that you “PLEASE REMEMBER TO\nSET A PASSWORD FOR THE MariaDB root USER !â€, because the\nroot account is securely created automatically.\n \nTwo all-powerful accounts are created by default — root\nand the OS user that owns the data directory, typically\nmysql. They are created as:\n \nCREATE USER root@localhost IDENTIFIED VIA unix_socket OR\nmysql_native_password USING \'invalid\'\nCREATE USER mysql@localhost IDENTIFIED VIA unix_socket OR\nmysql_native_password USING \'invalid\'\n \nUsing unix_socket means that if you are the system root\nuser, you can login as root@locahost without a password.\nThis technique was pioneered by Otto Kekäläinen in Debian\nMariaDB packages and has been successfully used in Debian\nsince as early as MariaDB 10.0. \n \nIt is based on a simple fact that asking the system root for\na password adds no extra security — root has full access\nto all the data files and all process memory anyway. But not\nasking for a password means, there is no root password to\nforget (no need for the numerous tutorials on “how to\nreset MariaDB root passwordâ€). And if you want to script\nsome tedious database work, there is no need to store the\nroot password in plain text for the scipt to use (no need\nfor debian-sys-maint user).\n \nStill, some users may wish to log in as MariaDB root without\nusing sudo. Hence the old authentication method —\nconventional MariaDB password — is still available. By\ndefault it is disabled (“invalid†is not a valid\npassword hash), but one can set the password with a usual\nSET PASSWORD statement. And still retain the password-less\naccess via sudo.\n \nIf you install MariaDB locally (say from a tarball, you\nwould not want to use sudo to be able to login. This is why\nMariaDB creates a second all-powerful user with the same\nname as a system user that owns the data directory. In local\n(not system-wide) installations, this will be the user who\ninstalled MariaDB — they automatically get convenient\npassword-less root-like access, because they can access all\nthe data files anyway.\n \nEven if MariaDB is installed system-wide, you may not want\nto run your database maintenance scripts as system root —\nnow you can run them as system mysql user. And you will know\nthat they will never destroy your entire system, even if you\nmake a typo in a shell script.\n \nHowever, seasoned MariaDB DBAs who are used to the old ways\ndo need to makes some changes. See the examples below for\ncommon tasks. \n \nCookbook\n \nAfter installing MariaDB system-wide the first thing\nyou’ve got used to doing is logging in into the\nunprotected root account and protecting it, that is, setting\nthe root password:\n \n$ sudo dnf install MariaDB-server\n$ mysql -uroot\n...\nMariaDB> set password = password(\"XH4VmT3_jt\");\n \nThis is not only unnecessary now, it will simply not work\n— there is no unprotected root account. To login as root\nuse\n \n$ sudo dnf install MariaDB-server\n$ sudo mysql\n \nNote that it implies you are connecting via the unix socket,\nnot tcp. If you happen to have protocol=tcp in a system-wide\n/etc/my.cnf file, use sudo mysql --protocol=socket.\n \nAfter installing MariaDB locally you’ve also used to\nconnect to the unprotected root account using mysql -uroot.\nThis will not work either, simply use mysql without\nspecifying a username.\n \nIf you\'ve forgotten your root password, no problem — you\ncan still connect using sudo and change the password. And if\nyou\'ve also removed unix_socket authentication, to restore\naccess do as follows:\nrestart MariaDB with --skip-grant-tables\nlogin into the unprotected server\nrun FLUSH PRIVILEGES (note, before 10.4 this would’ve been\nthe last step, not anymore). This disables\n--skip-grant-tables and allows you to change the stored\nauthentication method.\nrun SET PASSWORD FOR root@localhost to change the root\npassword\n \nTo view inside privilege tables, the old mysql.user table\nstill exists. You can select from it as before, although you\ncannot update it anymore. It doesn’t show alternative\nauthentication plugins and this was one of the reasons for\nswitching to the mysql.global_priv table — complex\nauthentication rules did not fit into rigid structure of a\nrelational table. You can select from the new table, for\nexample: \n \nselect concat(user, \'@\', host, \' => \',\njson_detailed(priv)) from mysql.global_priv;\n \nReverting to the Previous Authentication Method for\nroot@localhost\n \nIf you don\'t want the root@localhost user account created\nby mysql_install_db to use unix_socket authentication by\ndefault, then there are a few ways to revert to the previous\nmysql_native_password authentication method for this user\naccount.\n \nConfiguring mysql_install_db to Revert to the Previous\nAuthentication Method\n \nOne way to revert to the previous mysql_native_password\nauthentication method for the root@localhost user account is\nto execute mysql_install_db with a special option. If\nmysql_install_db is executed while\n--auth-root-authentication-method=normal is specified, then\nit will create the default user accounts using the default\nbehavior of MariaDB 10.3 and before.\n \nThis means that the root@localhost user account will use\nmysql_native_password authentication by default. There are\nsome other differences as well. See mysql_install_db: User\nAccounts Created by Default for more information.\n \nFor example, the option can be set on the command-line while\nrunning mysql_install_db:\n \nmysql_install_db --user=mysql --datadir=/var/lib/mysql\n--auth-root-authentication-method=normal\n \nThe option can also be set in an option file in an option\ngroup supported by mysql_install_db. For example:\n \n[mysql_install_db]\nauth_root_authentication_method=normal\n \nIf the option is set in an option file and if\nmysql_install_db is executed, then mysql_install_db will\nread this option from the option file, and it will\nautomatically set this option.\n \nAltering the User Account to Revert to the Previous\nAuthentication Method\n \nIf you have already installed MariaDB, and if the\nroot@localhost user account is already using unix_socket\nauthentication, then you can revert to the old\nmysql_native_password authentication method for the user\naccount by executing the following:\n \nALTER USER root@localhost IDENTIFIED VIA\nmysql_native_password USING PASSWORD(\"verysecret\")\n \n\n\nURL:\nhttps://mariadb.com/kb/en/authentication-from-mariadb-104/','','https://mariadb.com/kb/en/authentication-from-mariadb-104/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (118,10,'CREATE USER','Syntax\n------ \nCREATE [OR REPLACE] USER [IF NOT EXISTS] \n user_specification [,user_specification ...] \n [REQUIRE {NONE | tls_option [[AND] tls_option ...] }]\n [WITH resource_option [resource_option ...] ]\n [password_option | lock_option] \n \nuser_specification:\n username [authentication_option]\n \nauthentication_option:\n IDENTIFIED BY \'password\' \n | IDENTIFIED BY PASSWORD \'password_hash\'\n | IDENTIFIED {VIA|WITH} authentication_rule [OR\nauthentication_rule ...]\n \nauthentication_rule:\n authentication_plugin\n | authentication_plugin {USING|AS}\n\'authentication_string\'\n | authentication_plugin {USING|AS} PASSWORD(\'password\')\n \ntls_option:\n SSL \n | X509\n | CIPHER \'cipher\'\n | ISSUER \'issuer\'\n | SUBJECT \'subject\'\n \nresource_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 | MAX_STATEMENT_TIME time\n \npassword_option:\n PASSWORD EXPIRE\n | PASSWORD EXPIRE DEFAULT\n | PASSWORD EXPIRE NEVER\n | PASSWORD EXPIRE INTERVAL N DAY\n \nlock_option:\n ACCOUNT LOCK\n | ACCOUNT UNLOCK\n}\n \nDescription\n----------- \nThe CREATE USER statement creates new MariaDB accounts. To\nuse it, you must have the global CREATE USER privilege or\nthe INSERT privilege for the mysql database. For each\naccount, CREATE USER creates a new row in\nthe mysql.user table that has no privileges.\n \nIf any of the specified accounts, or any permissions for the\nspecified accounts, already exist, then the server returns\nERROR 1396 (HY000). If an error occurs, CREATE USER will\nstill create the accounts that do not result in an error.\nOnly one error is produced for all users which have not been\ncreated:\n \nERROR 1396 (HY000): \n Operation CREATE USER failed for \'u1\'@\'%\',\'u2\'@\'%\'\n \nCREATE USER, DROP USER, CREATE ROLE, and DROP ROLE all\nproduce the\nsame error code when they fail.\n \nSee Account Names below for details on how account names are\nspecified. \n \nOR REPLACE\n \nIf the optional OR REPLACE clause is used, it is basically a\nshortcut for:\n \nDROP USER IF EXISTS name;\n \nCREATE USER name ...;\n \nFor example:\n \nCREATE USER foo2@test IDENTIFIED BY \'password\';\n \nERROR 1396 (HY000): Operation CREATE USER failed for\n\'foo2\'@\'test\'\n \nCREATE OR REPLACE USER foo2@test IDENTIFIED BY \'password\';\n \nQuery OK, 0 rows affected (0.00 sec)\n \nIF NOT EXISTS\n \nWhen the IF NOT EXISTS clause is used, MariaDB will return a\nwarning instead of an error if the specified user already\nexists.\n \nFor example:\n \nCREATE USER foo2@test IDENTIFIED BY \'password\';\n \nERROR 1396 (HY000): Operation CREATE USER failed for\n\'foo2\'@\'test\'\n \nCREATE USER IF NOT EXISTS foo2@test IDENTIFIED BY\n\'password\';\n \nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+-------+------+----------------------------------------------------+\n| Level | Code | Message |\n+-------+------+----------------------------------------------------+\n| Note | 1973 | Can\'t create user \'foo2\'@\'test\';\n it already exists |\n+-------+------+----------------------------------------------------+\n1 row in set (0.00 sec\n \nAuthentication Options\n \nIDENTIFIED BY \'password\'\n \nThe optional IDENTIFIED BY clause can be used to provide an\naccount with a password. The password should be specified in\nplain text. It will be hashed by the PASSWORD function prior\nto being stored to the mysql.user table.\n \nFor example, if our password is mariadb, then we can create\nthe user with:\n \nCREATE USER foo2@test IDENTIFIED BY \'mariadb\';\n \nIf you do not specify a password with the IDENTIFIED BY\nclause, the user\nwill be able to connect without a password. A blank password\nis not a wildcard\nto match any password. The user must connect without\nproviding a password if no\npassword is set.\n \nThe only authentication plugins that this clause supports\nare mysql_native_password and mysql_old_password.\n \nIDENTIFIED BY PASSWORD \'password_hash\'\n \nThe optional IDENTIFIED BY PASSWORD clause can be used to\nprovide an account with a password that has already been\nhashed. The password should be specified as a hash that was\nprovided by the PASSWORD function. It will be stored to the\nmysql.user table as-is.\n \nFor example, if our password is mariadb, then we can find\nthe hash with:\n \nSELECT PASSWORD(\'mariadb\');\n+-------------------------------------------+\n| PASSWORD(\'mariadb\') |\n+-------------------------------------------+\n| *54958E764CE10E50764C2EECBB71D01F08549980 |\n+-------------------------------------------+\n1 row in set (0.00 sec)\n \nAnd then we can create a user with the hash:\n \nCREATE USER foo2@test IDENTIFIED BY PASSWORD\n\'*54958E764CE10E50764C2EECBB71D01F08549980\';\n \nIf you do not specify a password with the IDENTIFIED BY\nclause, the user\nwill be able to connect without a password. A blank password\nis not a wildcard\nto match any password. The user must connect without\nproviding a password if no\npassword is set.\n \nThe only authentication plugins that this clause supports\nare mysql_native_password and mysql_old_password.\n \nIDENTIFIED {VIA|WITH} authentication_plugin\n \nThe optional IDENTIFIED VIA authentication_plugin allows you\nto specify that the account should be authenticated by a\nspecific authentication plugin. The plugin name must be an\nactive authentication plugin as per SHOW PLUGINS. If it\ndoesn\'t show up in that output, then you will need to\ninstall it with INSTALL PLUGIN or INSTALL SONAME.\n \nFor example, this could be used with the PAM authentication\nplugin:\n \nCREATE USER foo2@test IDENTIFIED VIA pam;\n \nSome authentication plugins allow additional arguments to be\nspecified after a USING or AS keyword. For example, the PAM\nauthentication plugin accepts a service name:\n \nCREATE USER foo2@test IDENTIFIED VIA pam USING \'mariadb\';\n \nThe exact meaning of the additional argument would depend on\nthe specific authentication plugin.\n \nThe USING or AS keyword can also be used to provide a\nplain-text password to a plugin if it\'s provided as an\nargument to the PASSWORD() function. This is only valid for\nauthentication plugins that have implemented a hook for the\nPASSWORD() function. For example, the ed25519 authentication\nplugin supports this:\n \nCREATE USER safe@\'%\' IDENTIFIED VIA ed25519 USING\nPASSWORD(\'secret\');\n \nOne can specify many authentication plugins, they all works\nas alternatives ways of authenticating a user:\n \nCREATE USER safe@\'%\' IDENTIFIED VIA ed25519 USING\nPASSWORD(\'secret\') OR unix_socket;\n \nTLS Options\n \nBy default, MariaDB transmits data between the server and\nclients without encrypting it. This is generally acceptable\nwhen the server and client run on the same host or in\nnetworks where security is guaranteed through other means.\nHowever, in cases where the server and client exist on\nseparate networks or they are in a high-risk network, the\nlack of encryption does introduce security concerns as a\nmalicious actor could potentially eavesdrop on the traffic\nas it is sent over the network between them.\n \nTo mitigate this concern, MariaDB allows you to encrypt data\nin transit between the server and clients using the\nTransport Layer Security (TLS) protocol. TLS was formerly\nknown as Secure Socket Layer (SSL), but strictly speaking\nthe SSL protocol is a predecessor to TLS and, that version\nof the protocol is now considered insecure. The\ndocumentation still uses the term SSL often and for\ncompatibility reasons TLS-related server system and status\nvariables still use the prefix ssl_, but internally, MariaDB\nonly supports its secure successors.\n \nSee Secure Connections Overview for more information about\nhow to determine whether your MariaDB server has TLS\nsupport.\n \nYou can set certain TLS-related restrictions for specific\nuser accounts. For instance, you might use this with user\naccounts that require access to sensitive data while sending\nit across networks that you do not control. These\nrestrictions can be enabled for a user account with the\nCREATE USER, ALTER USER, or GRANT statements. The following\noptions are available:\n \nOption | Description | \n \nREQUIRE NONE | TLS is not required for this account, but can\nstill be used. | \n \nREQUIRE SSL | The account must use TLS, but no valid X509\ncertificate is required. This option cannot be combined with\nother TLS options. | \n \nREQUIRE X509 | The account must use TLS and must have a\nvalid X509 certificate. This option implies REQUIRE SSL.\nThis option cannot be combined with other TLS options. | \n \nREQUIRE ISSUER \'issuer\' | The account must use TLS and\nmust have a valid X509 certificate. Also, the Certificate\nAuthority must be the one specified via the string issuer.\nThis option implies REQUIRE X509. This option can be\ncombined with the SUBJECT, and CIPHER options in any order.\n| \n \nREQUIRE SUBJECT \'subject\' | The account must use TLS and\nmust have a valid X509 certificate. Also, the certificate\'s\nSubject must be the one specified via the string subject.\nThis option implies REQUIRE X509. This option can be\ncombined with the ISSUER, and CIPHER options in any order. |\n\n \nREQUIRE CIPHER \'cipher\' | The account must use TLS, but no\nvalid X509 certificate is required. Also, the encryption\nused for the connection must use one of the methods\nspecified in the string cipher. This option implies REQUIRE\nSSL. This option can be combined with the ISSUER, and\nSUBJECT options in any order. | \n \nThe REQUIRE keyword must be used only once for all specified\noptions, and the AND keyword can be used to separate\nindividual options, but it is not required.\n \nFor example, you can create a user account that requires\nthese TLS options with the following:\n \nCREATE USER \'alice\'@\'%\'\n REQUIRE SUBJECT \'/CN=alice/O=My Dom,\nInc./C=US/ST=Oregon/L=Portland\'\n AND ISSUER \'/C=FI/ST=Somewhere/L=City/ O=Some\nCompany/CN=Peter Parker/emailAddress=p.parker@marvel.com\'\n AND CIPHER \'TLSv1.2\';\n \nIf any of these options are set for a specific user account,\nthen any client who tries to connect with that user account\nwill have to be configured to connect with TLS.\n \nSee Securing Connections for Client and Server for\ninformation on how to enable TLS on the client and server.\n \nResource Limit Options\n \nMariaDB 10.2.0 introduced a number of resource limit\noptions.\n \nIt is possible to set per-account limits for certain server\nresources. The following table shows the values that can be\nset per account:\n \nLimit Type | Decription | \n \nMAX_QUERIES_PER_HOUR | Number of statements that the account\ncan issue per hour (including updates) | \n \nMAX_UPDATES_PER_HOUR | Number of updates (not queries) that\nthe account can issue per hour | \n \nMAX_CONNECTIONS_PER_HOUR | Number of connections that the\naccount can start per hour | \n \nMAX_USER_CONNECTIONS | Number of simultaneous connections\nthat can be accepted from the same account; if it is 0,\nmax_connections will be used instead; if max_connections is\n0, there is no limit for this account\'s simultaneous\nconnections. | \n \nMAX_STATEMENT_TIME | Timeout, in seconds, for statements\nexecuted by the user. See also Aborting Statements that\nExceed a Certain Time to Execute. | \n \nIf any of these limits are set to 0, then there is no limit\nfor that resource for that user.\n \nHere is an example showing how to create a user with\nresource limits:\n \nCREATE USER \'someone\'@\'localhost\' WITH\n MAX_USER_CONNECTIONS 10\n MAX_QUERIES_PER_HOUR 200;\n \nThe resources are tracked per account, which means\n\'user\'@\'server\'; not per user name or per connection.\n \nThe count can be reset for all users using FLUSH\nUSER_RESOURCES, FLUSH PRIVILEGES or mysqladmin reload.\n \nPer account resource limits are stored in the user table, in\nthe mysql database. Columns used for resources limits are\nnamed max_questions, max_updates, max_connections (for\nMAX_CONNECTIONS_PER_HOUR), and max_user_connections (for\nMAX_USER_CONNECTIONS).\n \nAccount Names\n \nAccount names have both a user name component and a host\nname component, and are specified as\n\'user_name\'@\'host_name\'.\n \nThe user name and host name may be unquoted, quoted as\nstrings using double quotes (\") or\nsingle quotes (\'), or quoted as identifiers using backticks\n(`). You must use quotes\nwhen using special characters (such as a hyphen) or wildcard\ncharacters. If you quote, you \nmust quote the user name and host name separately (for\nexample \'user_name\'@\'host_name\').\n \nHost Name Component\n \nIf the host name is not provided, it is assumed to be \'%\'.\n \nHost names may contain the wildcard characters % and _. They\nare matched as if by\nthe LIKE clause. If you need to use a wildcard character\nliterally (for example, to\nmatch a domain name with an underscore), prefix the\ncharacter with a backslash. See LIKE\nfor more information on escaping wildcard characters.\n \nHost name matches are case-insensitive. Host names can match\neither domain names or IP\naddresses. Use \'localhost\' as the host name to allow only\nlocal client connections.\n \nYou can use a netmask to match a range of IP addresses using\n\'base_ip/netmask\' as the\nhost name. A user with an IP address ip_addr will be allowed\nto connect if the following\ncondition is true:\n \nip_addr & netmask = base_ip\n \nYou can only use netmasks that specify a multiple of 8 bits\nof the address to match. That is,\nonly the following netmasks are allowed:\n \n255.0.0.0\n255.255.0.0\n255.255.255.0\n255.255.255.255\n \nUsing 255.255.255.255 is equivalent to not using a netmask\nat all.\n \nUser Name Component\n \nUser names must match exactly, including case. A user name\nthat is empty is known as an anonymous account and is\nallowed to match a login attempt with any user name\ncomponent. These are described more in the next section.\n \nFor valid identifiers to use as user names, see Identifier\nNames.\n \nIt is possible for more than one account to match when a\nuser connects. MariaDB selects\nthe first matching account after sorting according to the\nfollowing criteria:\nAccounts with an exact host name are sorted before accounts\nusing a wildcard in the\nhost name. Host names using a netmask are considered to be\nexact for sorting.\nAccounts with a wildcard in the host name are sorted\naccording to the position of\nthe first wildcard character. Those with a wildcard\ncharacter later in the host name\nsort before those with a wildcard character earlier in the\nhost name.\nAccounts with a non-empty user name sort before accounts\nwith an empty user name.\nAccounts with an empty user name are sorted last. As\nmentioned previously, these are known as anonymous accounts.\nThese are described more in the next section.\n \nThe following table shows a list of example account as\nsorted by these criteria:\n \n+---------+-------------+\n| User | Host |\n+---------+-------------+\n| joffrey | 192.168.0.3 |\n| | 192.168.0.% |\n| joffrey | 192.168.% |\n| | 192.168.% |\n+---------+-------------+\n \nOnce connected, you only have the privileges granted to the\naccount that matched,\nnot all accounts that could have matched. For example,\nconsider the following\ncommands:\n \nCREATE USER \'joffrey\'@\'192.168.0.3\';\n \nCREATE USER \'joffrey\'@\'%\';\n \nGRANT SELECT ON test.t1 to \'joffrey\'@\'192.168.0.3\';\n \nGRANT SELECT ON test.t2 to \'joffrey\'@\'%\';\n \nIf you connect as joffrey from 192.168.0.3, you will have\nthe SELECT\nprivilege on the table test.t1, but not on the table\ntest.t2. If you connect as joffrey from any other IP\naddress, you will have the SELECT privilege on the table\ntest.t2, but not\non the table test.t1.\n \nBeginning with MariaDB 5.5.31, usernames can be up to 80\ncharacters long. From MariaDB 10.0 the system tables are all\nby default this length. However, in order to enable this\nfeature in MariaDB 5.5, the following schema changes must be\nmade:\n \nALTER TABLE mysql.user MODIFY User CHAR(80) BINARY NOT NULL\nDEFAULT \'\';\n \nALTER TABLE mysql.db MODIFY User CHAR(80) BINARY NOT NULL\nDEFAULT \'\';\n \nALTER TABLE mysql.tables_priv MODIFY User CHAR(80) BINARY\nNOT NULL DEFAULT \'\';\n \nALTER TABLE mysql.columns_priv MODIFY User CHAR(80) BINARY\nNOT NULL DEFAULT \'\';\n \nALTER TABLE mysql.procs_priv MODIFY User CHAR(80) BINARY NOT\nNULL DEFAULT \'\';\n \nALTER TABLE mysql.proc MODIFY definer CHAR(141) COLLATE\nutf8_bin NOT NULL DEFAULT \'\';\n \nALTER TABLE mysql.event MODIFY definer CHAR(141) COLLATE\nutf8_bin NOT NULL DEFAULT \'\';\n \nALTER TABLE mysql.proxies_priv MODIFY User CHAR(80) COLLATE\nutf8_bin NOT NULL DEFAULT \'\';\n \nALTER TABLE mysql.proxies_priv MODIFY Proxied_user CHAR(80)\nCOLLATE utf8_bin NOT NULL DEFAULT \'\';\n \nALTER TABLE mysql.proxies_priv MODIFY Grantor CHAR(141)\nCOLLATE utf8_bin NOT NULL DEFAULT \'\';\n \nALTER TABLE mysql.servers MODIFY Username CHAR(80) NOT NULL\nDEFAULT \'\';\n \nALTER TABLE mysql.procs_priv MODIFY Grantor CHAR(141)\nCOLLATE utf8_bin NOT NULL DEFAULT \'\';\n \nALTER TABLE mysql.tables_priv MODIFY Grantor CHAR(141)\nCOLLATE utf8_bin NOT NULL DEFAULT \'\';\n \nFLUSH PRIVILEGES;\n \nAnonymous Accounts\n \nAnonymous accounts are accounts where the user name portion\nof the account name is empty. These accounts act as special\ncatch-all accounts. If a user attempts to log into the\nsystem from a host, and an anonymous account exists with a\nhost name portion that matches the user\'s host, then the\nuser will log in as the anonymous account if there is no\nmore specific account match for the user name that the user\nentered.\n \nFor example, here are some anonymous accounts:\n \nCREATE USER \'\'@\'localhost\';\n \nCREATE USER \'\'@\'192.168.0.3\';\n \nFixing a Legacy Default Anonymous Account\n \nOn some systems, the mysql.db table has some entries for the\n\'\'@\'%\' anonymous account by default. Unfortunately,\nthere is no matching entry in the mysql.user table, which\nmeans that this anonymous account doesn\'t exactly exist,\nbut it does have privileges--usually on the default test\ndatabase created by mysql_install_db. These account-less\nprivileges are a legacy that is leftover from a time when\nMySQL\'s privilege system was less advanced.\n \nThis situation means that you will run into errors if you\ntry to create a \'\'@\'%\' account. For example:\n \nCREATE USER \'\'@\'%\';\n \nERROR 1396 (HY000): Operation CREATE USER failed for\n\'\'@\'%\'\n \nThe fix is to DELETE the row in the mysql.db table and then\nexecute FLUSH PRIVILEGES:\n \nDELETE FROM mysql.db WHERE User=\'\' AND Host=\'%\';\n \nFLUSH PRIVILEGES;\n \nAnd then the account can be created:\n \nCREATE USER \'\'@\'%\';\n \nQuery OK, 0 rows affected (0.01 sec)\n \nSee MDEV-13486 for more information.\n \nPassword Expiry\n \nBesides automatic password expiry, as determined by\ndefault_password_lifetime, password expiry times can be set\non an individual user basis, overriding the global setting,\nfor example:\n \nCREATE USER \'monty\'@\'localhost\' PASSWORD EXPIRE INTERVAL\n120 DAY;\n \nSee User Password Expiry for more details.\n \nAccount Locking\n \nAccount locking permits privileged administrators to\nlock/unlock user accounts. No new client connections will be\npermitted if an account is locked (existing connections are\nnot affected). For example:\n \nCREATE USER \'marijn\'@\'localhost\' ACCOUNT LOCK;\n \nSee Account Locking','','https://mariadb.com/kb/en/create-user/');
-update help_topic set description = CONCAT(description, ' for more details.\n \n\n\nURL: https://mariadb.com/kb/en/create-user/') WHERE help_topic_id = 118;
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (119,10,'ALTER USER','The ALTER USER statement was introduced in MariaDB 10.2.0.\n \nSyntax\n------ \nALTER USER [IF EXISTS] \n user_specification [,user_specification] ...\n [REQUIRE {NONE | tls_option [[AND] tls_option] ...}]\n [WITH resource_option [resource_option] ...]\n [password_option | lock_option] \n \nuser_specification:\n username [authentication_option]\n \nauthentication_option:\n IDENTIFIED BY \'password\' \n | IDENTIFIED BY PASSWORD \'password_hash\'\n | IDENTIFIED {VIA|WITH} authentication_plugin\n | IDENTIFIED {VIA|WITH} authentication_plugin {USING|AS}\n\'authentication_string\'\n | IDENTIFIED {VIA|WITH} authentication_plugin {USING|AS}\nPASSWORD(\'password\')\n \ntls_option\n SSL \n | X509\n | CIPHER \'cipher\'\n | ISSUER \'issuer\'\n | SUBJECT \'subject\'\n \nresource_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 | MAX_STATEMENT_TIME time\n \npassword_option:\n PASSWORD EXPIRE\n | PASSWORD EXPIRE DEFAULT\n | PASSWORD EXPIRE NEVER\n | PASSWORD EXPIRE INTERVAL N DAY\n \nlock_option:\n ACCOUNT LOCK\n | ACCOUNT UNLOCK\n}\n \nDescription\n----------- \nThe ALTER USER statement modifies existing MariaDB accounts.\nTo use it, you must have the global CREATE USER privilege or\nthe UPDATE privilege for the mysql database. The global\nSUPER privilege is also required if the read_only system\nvariable is enabled.\n \nIf any of the specified user accounts do not yet exist, an\nerror results. If an error occurs, ALTER USER will still\nmodify the accounts that do not result in an error. Only one\nerror is produced for all users which have not been\nmodified.\n \nIF EXISTS\n \nWhen the IF EXISTS clause is used, MariaDB will return a\nwarning instead of an error for each specified user that\ndoes not exist.\n \nAccount Names\n \nFor ALTER USER statements, account names are specified as\nthe username argument in the same way as they are for CREATE\nUSER statements. See account names from the CREATE USER page\nfor details on how account names are specified.\n \nCURRENT_USER or CURRENT_USER() can also be used to alter the\naccount logged into the current session. For example, to\nchange the current user\'s password to mariadb:\n \nALTER USER CURRENT_USER() IDENTIFIED BY \'mariadb\';\n \nAuthentication Options\n \nIDENTIFIED BY \'password\'\n \nThe optional IDENTIFIED BY clause can be used to provide an\naccount with a password. The password should be specified in\nplain text. It will be hashed by the PASSWORD function prior\nto being stored to the mysql.user table.\n \nFor example, if our password is mariadb, then we can set the\naccount\'s password with:\n \nALTER USER foo2@test IDENTIFIED BY \'mariadb\';\n \nIf you do not specify a password with the IDENTIFIED BY\nclause, the user\nwill be able to connect without a password. A blank password\nis not a wildcard\nto match any password. The user must connect without\nproviding a password if no\npassword is set.\n \nThe only authentication plugins that this clause supports\nare mysql_native_password and mysql_old_password.\n \nIDENTIFIED BY PASSWORD \'password_hash\'\n \nThe optional IDENTIFIED BY PASSWORD clause can be used to\nprovide an account with a password that has already been\nhashed. The password should be specified as a hash that was\nprovided by the PASSWORD function. It will be stored to the\nmysql.user table as-is.\n \nFor example, if our password is mariadb, then we can find\nthe hash with:\n \nSELECT PASSWORD(\'mariadb\');\n+-------------------------------------------+\n| PASSWORD(\'mariadb\') |\n+-------------------------------------------+\n| *54958E764CE10E50764C2EECBB71D01F08549980 |\n+-------------------------------------------+\n1 row in set (0.00 sec)\n \nAnd then we can set an account\'s password with the hash:\n \nALTER USER foo2@test IDENTIFIED BY PASSWORD\n\'*54958E764CE10E50764C2EECBB71D01F08549980\';\n \nIf you do not specify a password with the IDENTIFIED BY\nclause, the user\nwill be able to connect without a password. A blank password\nis not a wildcard\nto match any password. The user must connect without\nproviding a password if no\npassword is set.\n \nThe only authentication plugins that this clause supports\nare mysql_native_password and mysql_old_password.\n \nIDENTIFIED {VIA|WITH} authentication_plugin\n \nThe optional IDENTIFIED VIA authentication_plugin allows you\nto specify that the account should be authenticated by a\nspecific authentication plugin. The plugin name must be an\nactive authentication plugin as per SHOW PLUGINS. If it\ndoesn\'t show up in that output, then you will need to\ninstall it with INSTALL PLUGIN or INSTALL SONAME.\n \nFor example, this could be used with the PAM authentication\nplugin:\n \nALTER USER foo2@test IDENTIFIED VIA pam;\n \nSome authentication plugins allow additional arguments to be\nspecified after a USING or AS keyword. For example, the PAM\nauthentication plugin accepts a service name:\n \nALTER USER foo2@test IDENTIFIED VIA pam USING \'mariadb\';\n \nThe exact meaning of the additional argument would depend on\nthe specific authentication plugin.\n \nIn MariaDB 10.4 and later, the USING or AS keyword can also\nbe used to provide a plain-text password to a plugin if\nit\'s provided as an argument to the PASSWORD() function.\nThis is only valid for authentication plugins that have\nimplemented a hook for the PASSWORD() function. For example,\nthe ed25519 authentication plugin supports this:\n \nALTER USER safe@\'%\' IDENTIFIED VIA ed25519 USING\nPASSWORD(\'secret\');\n \nTLS Options\n \nBy default, MariaDB transmits data between the server and\nclients without encrypting it. This is generally acceptable\nwhen the server and client run on the same host or in\nnetworks where security is guaranteed through other means.\nHowever, in cases where the server and client exist on\nseparate networks or they are in a high-risk network, the\nlack of encryption does introduce security concerns as a\nmalicious actor could potentially eavesdrop on the traffic\nas it is sent over the network between them.\n \nTo mitigate this concern, MariaDB allows you to encrypt data\nin transit between the server and clients using the\nTransport Layer Security (TLS) protocol. TLS was formerly\nknown as Secure Socket Layer (SSL), but strictly speaking\nthe SSL protocol is a predecessor to TLS and, that version\nof the protocol is now considered insecure. The\ndocumentation still uses the term SSL often and for\ncompatibility reasons TLS-related server system and status\nvariables still use the prefix ssl_, but internally, MariaDB\nonly supports its secure successors.\n \nSee Secure Connections Overview for more information about\nhow to determine whether your MariaDB server has TLS\nsupport.\n \nYou can set certain TLS-related restrictions for specific\nuser accounts. For instance, you might use this with user\naccounts that require access to sensitive data while sending\nit across networks that you do not control. These\nrestrictions can be enabled for a user account with the\nCREATE USER, ALTER USER, or GRANT statements. The following\noptions are available:\n \nOption | Description | \n \nREQUIRE NONE | TLS is not required for this account, but can\nstill be used. | \n \nREQUIRE SSL | The account must use TLS, but no valid X509\ncertificate is required. This option cannot be combined with\nother TLS options. | \n \nREQUIRE X509 | The account must use TLS and must have a\nvalid X509 certificate. This option implies REQUIRE SSL.\nThis option cannot be combined with other TLS options. | \n \nREQUIRE ISSUER \'issuer\' | The account must use TLS and\nmust have a valid X509 certificate. Also, the Certificate\nAuthority must be the one specified via the string issuer.\nThis option implies REQUIRE X509. This option can be\ncombined with the SUBJECT, and CIPHER options in any order.\n| \n \nREQUIRE SUBJECT \'subject\' | The account must use TLS and\nmust have a valid X509 certificate. Also, the certificate\'s\nSubject must be the one specified via the string subject.\nThis option implies REQUIRE X509. This option can be\ncombined with the ISSUER, and CIPHER options in any order. |\n\n \nREQUIRE CIPHER \'cipher\' | The account must use TLS, but no\nvalid X509 certificate is required. Also, the encryption\nused for the connection must use one of the methods\nspecified in the string cipher. This option implies REQUIRE\nSSL. This option can be combined with the ISSUER, and\nSUBJECT options in any order. | \n \nThe REQUIRE keyword must be used only once for all specified\noptions, and the AND keyword can be used to separate\nindividual options, but it is not required.\n \nFor example, you can alter a user account to require these\nTLS options with the following:\n \nALTER USER \'alice\'@\'%\'\n REQUIRE SUBJECT \'/CN=alice/O=My Dom,\nInc./C=US/ST=Oregon/L=Portland\'\n AND ISSUER \'/C=FI/ST=Somewhere/L=City/ O=Some\nCompany/CN=Peter Parker/emailAddress=p.parker@marvel.com\'\n AND CIPHER \'TLSv1.2\';\n \nIf any of these options are set for a specific user account,\nthen any client who tries to connect with that user account\nwill have to be configured to connect with TLS.\n \nSee Securing Connections for Client and Server for\ninformation on how to enable TLS on the client and server.\n \nResource Limit Options\n \nMariaDB 10.2.0 introduced a number of resource limit\noptions.\n \nIt is possible to set per-account limits for certain server\nresources. The following table shows the values that can be\nset per account:\n \nLimit Type | Decription | \n \nMAX_QUERIES_PER_HOUR | Number of statements that the account\ncan issue per hour (including updates) | \n \nMAX_UPDATES_PER_HOUR | Number of updates (not queries) that\nthe account can issue per hour | \n \nMAX_CONNECTIONS_PER_HOUR | Number of connections that the\naccount can start per hour | \n \nMAX_USER_CONNECTIONS | Number of simultaneous connections\nthat can be accepted from the same account; if it is 0,\nmax_connections will be used instead; if max_connections is\n0, there is no limit for this account\'s simultaneous\nconnections. | \n \nMAX_STATEMENT_TIME | Timeout, in seconds, for statements\nexecuted by the user. See also Aborting Statements that\nExceed a Certain Time to Execute. | \n \nIf any of these limits are set to 0, then there is no limit\nfor that resource for that user.\n \nHere is an example showing how to set an account\'s resource\nlimits:\n \nALTER USER \'someone\'@\'localhost\' WITH\n MAX_USER_CONNECTIONS 10\n MAX_QUERIES_PER_HOUR 200;\n \nThe resources are tracked per account, which means\n\'user\'@\'server\'; not per user name or per connection.\n \nThe count can be reset for all users using FLUSH\nUSER_RESOURCES, FLUSH PRIVILEGES or mysqladmin reload.\n \nPer account resource limits are stored in the user table, in\nthe mysql database. Columns used for resources limits are\nnamed max_questions, max_updates, max_connections (for\nMAX_CONNECTIONS_PER_HOUR), and max_user_connections (for\nMAX_USER_CONNECTIONS).\n \nPassword Expiry\n \nBesides automatic password expiry, as determined by\ndefault_password_lifetime, password expiry times can be set\non an individual user basis, overriding the global setting,\nfor example:\n \nALTER USER \'monty\'@\'localhost\' PASSWORD EXPIRE INTERVAL\n120 DAY;\n \nALTER USER \'monty\'@\'localhost\' PASSWORD EXPIRE NEVER;\n \nALTER USER \'monty\'@\'localhost\' PASSWORD EXPIRE DEFAULT;\n \nSee User Password Expiry for more details.\n \nAccount Locking\n \nAccount locking permits privileged administrators to\nlock/unlock user accounts. No new client connections will be\npermitted if an account is locked (existing connections are\nnot affected). For example:\n \nALTER USER \'marijn\'@\'localhost\' ACCOUNT LOCK;\n \nSee Account Locking for more details.\n \n\n\nURL: https://mariadb.com/kb/en/alter-user/','','https://mariadb.com/kb/en/alter-user/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (120,10,'DROP USER','Syntax\n------ \nDROP USER [IF EXISTS] user_name [, user_name] ...\n \nDescription\n----------- \nThe DROP USER statement removes one or more MariaDB\naccounts. It removes\nprivilege rows for the account from all grant tables. To use\nthis statement,\nyou must have the global CREATE USER privilege\nor the DELETE privilege for the mysql database.\nEach account is named using the same format as for the\nCREATE USER\nstatement; for example, \'jeffrey\'@\'localhost\'. If you\nspecify\nonly the user name part of the account name, a host name\npart of \'%\' is\nused. For additional information about specifying account\nnames, see\nCREATE USER.\n \nNote that, if you specify an account that is currently\nconnected, it will not\nbe deleted until the connection is closed. The connection\nwill not be\nautomatically closed.\n \nIf any of the specified user accounts do not exist, ERROR\n1396 (HY000)\nresults. If an error occurs, DROP USER will still drop the\naccounts that do\nnot result in an error. Only one error is produced for all\nusers which have not\nbeen dropped:\n \nERROR 1396 (HY000): Operation DROP USER failed for\n\'u1\'@\'%\',\'u2\'@\'%\'\n \nFailed CREATE or DROP operations, for both users and roles,\nproduce the\nsame error code.\n \nIF EXISTS\n \nThe IF EXISTS clause was added in MariaDB 10.1.3\n \nIf the IF EXISTS clause is used, MariaDB will return a note\ninstead of an error if the user does not exist.\n \nExamples\n-------- \nDROP USER bob;\n \nIF EXISTS:\n \nDROP USER bob;\n \nERROR 1396 (HY000): Operation DROP USER failed for\n\'bob\'@\'%\'\n \nDROP USER IF EXISTS bob;\n \nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+-------+------+---------------------------------------------+\n| Level | Code | Message |\n+-------+------+---------------------------------------------+\n| Note | 1974 | Can\'t drop user \'bob\'@\'%\'; it doesn\'t\nexist |\n+-------+------+---------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/drop-user/','','https://mariadb.com/kb/en/drop-user/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (121,10,'GRANT','Syntax\n------ \nGRANT\n priv_type [(column_list)]\n [, priv_type [(column_list)]] ...\n ON [object_type] priv_level\n TO user_specification [ user_options ...]\n \nuser_specification:\n username [authentication_option]\n \nauthentication_option:\n IDENTIFIED BY \'password\' \n | IDENTIFIED BY PASSWORD \'password_hash\'\n | IDENTIFIED {VIA|WITH} authentication_rule [OR\nauthentication_rule ...]\n \nauthentication_rule:\n authentication_plugin\n | authentication_plugin {USING|AS}\n\'authentication_string\'\n | authentication_plugin {USING|AS} PASSWORD(\'password\')\n \nGRANT PROXY ON username\n TO username [, username] ...\n [WITH GRANT OPTION]\n \nuser_options:\n [REQUIRE {NONE | tls_option [[AND] tls_option] ...}]\n [WITH with_option [with_option] ...]\n \nobject_type:\n TABLE\n | FUNCTION\n | PROCEDURE\n \npriv_level:\n *\n | *.*\n | db_name.*\n | db_name.tbl_name\n | tbl_name\n | db_name.routine_name\n \nwith_option:\n GRANT OPTION\n | resource_option\n \nresource_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 | MAX_STATEMENT_TIME time\n \ntls_option:\n SSL \n | X509\n | CIPHER \'cipher\'\n | ISSUER \'issuer\'\n | SUBJECT \'subject\'\n \nDescription\n----------- \nThe GRANT statement allows you to grant privileges or roles\nto accounts. To use GRANT, you must have the GRANT OPTION\nprivilege, and you must have the privileges that you are\ngranting.\n \nUse the REVOKE statement to revoke privileges granted with\nthe GRANT statement.\n \nUse the SHOW GRANTS statement to determine what privileges\nan account has.\n \nAccount Names\n \nFor GRANT statements, account names are specified as the\nusername argument in the same way as they are for CREATE\nUSER statements. See account names from the CREATE USER page\nfor details on how account names are specified.\n \nImplicit Account Creation\n \nThe GRANT statement also allows you to implicitly create\naccounts in some cases.\n \nIf the account does not yet exist, then GRANT can implicitly\ncreate it. To implicitly create an account with GRANT, a\nuser is required to have the same privileges that would be\nrequired to explicitly create the account with the CREATE\nUSER statement.\n \nIf the NO_AUTO_CREATE_USER SQL_MODE is set, then accounts\ncan only be created if authentication information is\nspecified, or with a CREATE USER statement. If no\nauthentication information is provided, GRANT will produce\nan error when the specified account does not exist, for\nexample:\n \nshow variables like \'%sql_mode%\' ;\n+---------------+--------------------------------------------+\n| Variable_name | Value |\n+---------------+--------------------------------------------+\n| sql_mode | NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |\n+---------------+--------------------------------------------+\n \nGRANT USAGE ON *.* TO \'user123\'@\'%\' IDENTIFIED BY \'\';\nERROR 1133 (28000): Can\'t find any matching row in the user\ntable\n \nGRANT USAGE ON *.* TO \'user123\'@\'%\' IDENTIFIED VIA PAM\nusing \'mariadb\' require ssl ;\nQuery OK, 0 rows affected (0.00 sec)\n \nselect host, user from mysql.user where user=\'user123\' ;\n \n+------+----------+\n| host | user |\n+------+----------+\n| % | user123 |\n+------+----------+\n \nPrivilege Levels\n \nPrivileges can be set globally, for an entire database, for\na table or routine,\nor for individual columns in a table. Certain privileges can\nonly be set at\ncertain levels.\nGlobal privileges are granted using *.* for\npriv_level. Global privileges include privileges to\nadminister the database\nand manage user accounts, as well as privileges for all\ntables, functions, and\nprocedures. Global privileges are stored in the mysql.user\ntable.\nDatabase privileges are granted using db_name.*\nfor priv_level, or using just * to use default database.\nDatabase\nprivileges include privileges to create tables and\nfunctions, as well as\nprivileges for all tables, functions, and procedures in the\ndatabase. Database privileges are stored in the mysql.db\ntable.\nTable privileges are granted using db_name.tbl_name\nfor priv_level, or using just tbl_name to specify a table in\nthe default\ndatabase. The TABLE keyword is optional. Table privileges\ninclude the\nability to select and change data in the table. Certain\ntable privileges can\nbe granted for individual columns.\nColumn privileges are granted by specifying a table for\npriv_level and providing a column list after the privilege\ntype. They allow\nyou to control exactly which columns in a table users can\nselect and change.\nFunction privileges are granted using FUNCTION\ndb_name.routine_name\nfor priv_level, or using just FUNCTION routine_name to\nspecify a function\nin the default database.\nProcedure privileges are granted using PROCEDURE\ndb_name.routine_name\nfor priv_level, or using just PROCEDURE routine_name to\nspecify a procedure\nin the default database.\n \nThe USAGE Privilege\n \nThe USAGE privilege grants no real privileges. The SHOW\nGRANTS\nstatement will show a global USAGE privilege for a\nnewly-created user. You\ncan use USAGE with the GRANT statement to change options\nlike GRANT OPTION\nand MAX_USER_CONNECTIONS without changing any account\nprivileges.\n \nThe ALL PRIVILEGES Privilege\n \nThe ALL PRIVILEGES privilege grants all available\nprivileges. Granting all\nprivileges only affects the given privilege level. For\nexample, granting all\nprivileges on a table does not grant any privileges on the\ndatabase or globally.\n \nUsing ALL PRIVILEGES does not grant the special GRANT OPTION\nprivilege.\n \nYou can use ALL instead of ALL PRIVILEGES.\n \nThe GRANT OPTION Privilege\n \nUse the WITH GRANT OPTION clause to give users the ability\nto grant privileges\nto other users at the given privilege level. Users with the\nGRANT OPTION privilege can\nonly grant privileges they have. They cannot grant\nprivileges at a higher privilege level than\nthey have the GRANT OPTION privilege.\n \nThe GRANT OPTION privilege cannot be set for individual\ncolumns.\nIf you use WITH GRANT OPTION when specifying column\nprivileges,\nthe GRANT OPTION privilege will be granted for the entire\ntable.\n \nUsing the WITH GRANT OPTION clause is equivalent to listing\nGRANT OPTION\nas a privilege.\n \nGlobal Privileges\n \nThe following table lists the privileges that can be granted\nglobally. You can\nalso grant all database, table, and function privileges\nglobally. When granted\nglobally, these privileges apply to all databases, tables,\nor functions,\nincluding those created later.\n \nTo set a global privilege, use *.* for priv_level.\n \nPrivilege | Description | \n \nCREATE USER | Create a user using the CREATE USER statement,\nor implicitly create a user with the GRANT statement. | \n \nFILE | Read and write files on the server, using statements\nlike LOAD DATA INFILE or functions like LOAD_FILE(). Also\nneeded to create CONNECT outward tables. MariaDB server must\nhave the permissions to access those files. | \n \nGRANT OPTION | Grant global privileges. You can only grant\nprivileges that you have. | \n \nPROCESS | Show information about the active processes, via\nSHOW PROCESSLIST or mysqladmin processlist. | \n \nRELOAD | Execute FLUSH statements or equivalent mysqladmin\ncommands. | \n \nREPLICATION CLIENT | Execute SHOW MASTER STATUS and SHOW\nSLAVE STATUS informative statements. | \n \nREPLICATION SLAVE | Accounts used by slave servers on the\nmaster need this privilege. This is needed to get the\nupdates made on the master. | \n \nSHOW DATABASES | List all databases using the SHOW DATABASES\nstatement. Without the SHOW DATABASES privilege, you can\nstill issue the SHOW DATABASES statement, but it will only\nlist databases containing tables on which you have\nprivileges. | \n \nSHUTDOWN | Shut down the server using SHUTDOWN or the\nmysqladmin shutdown command. | \n \nSUPER | Execute superuser statements: CHANGE MASTER TO, KILL\n(users who do not have this privilege can only KILL their\nown threads), PURGE LOGS, SET global system variables, or\nthe mysqladmin debug command. Also, this permission allows\nthe user to write data even if the read_only startup option\nis set, enable or disable logging, enable or disable\nreplication on slaves, specify a DEFINER for statements that\nsupport that clause, connect once after reaching the\nMAX_CONNECTIONS. If a statement has been specified for the\ninit-connect mysqld option, that command will not be\nexecuted when a user with SUPER privileges connects to the\nserver. | \n \nDatabase Privileges\n \nThe following table lists the privileges that can be granted\nat the database\nlevel. You can also grant all table and function privileges\nat the database\nlevel. Table and function privileges on a database apply to\nall tables or\nfunctions in that database, including those created later.\n \nTo set a privilege for a database, specify the database\nusing\ndb_name.* for priv_level, or just use *\nto specify the default database.\n \nPrivilege | Description | \n \nCREATE | Create a database using the CREATE DATABASE\nstatement, when the privilege is granted for a database. You\ncan grant the CREATE privilege on databases that do not yet\nexist. This also grants the CREATE privilege on all tables\nin the database. | \n \nCREATE ROUTINE | Create Stored Programs using the CREATE\nPROCEDURE and CREATE FUNCTION statements. | \n \nCREATE TEMPORARY TABLES | Create temporary tables with the\nCREATE TEMPORARY TABLE statement. This privilege enable\nwriting and dropping those temporary tables | \n \nDROP | Drop a database using the DROP DATABASE statement,\nwhen the privilege is granted for a database. This also\ngrants the DROP privilege on all tables in the database. | \n \nEVENT | Create, drop and alter EVENTs. Added in MySQL 5.1.6.\n| \n \nGRANT OPTION | Grant database privileges. You can only grant\nprivileges that you have. | \n \nLOCK TABLES | Acquire explicit locks using the LOCK TABLES\nstatement; you also need to have the SELECT privilege on a\ntable, in order to lock it. | \n \nTable Privileges\n \nPrivilege | Description | \n \nALTER | Change the structure of an existing table using the\nALTER TABLE statement. | \n \nCREATE | Create a table using the CREATE TABLE statement.\nYou can grant the CREATE privilege on tables that do not yet\nexist. | \n \nCREATE VIEW | Create a view using the CREATE_VIEW statement.\n| \n \nDELETE | Remove rows from a table using the DELETE\nstatement. | \n \nDELETE HISTORY | Remove historical rows from a table using\nthe DELETE HISTORY statement. Displays as DELETE VERSIONING\nROWS when running SHOW GRANTS until MariaDB 10.3.15 and\nuntil MariaDB 10.4.5 (MDEV-17655), or when running SHOW\nPRIVILEGES (MDEV-20382). From MariaDB 10.3.4. From MariaDB\n10.3.5, if a user has the SUPER privilege but not this\nprivilege, running mysql_upgrade will grant this privilege\nas well. | \n \nDROP | Drop a table using the DROP TABLE statement or a view\nusing the DROP VIEW statement. Also required to execute the\nTRUNCATE TABLE statement. | \n \nGRANT OPTION | Grant table privileges. You can only grant\nprivileges that you have. | \n \nINDEX | Create an index on a table using the CREATE INDEX\nstatement. Without the INDEX privilege, you can still create\nindexes when creating a table using the CREATE TABLE\nstatement if the you have the CREATE privilege, and you can\ncreate indexes using the ALTER TABLE statement if you have\nthe ALTER privilege. | \n \nINSERT | Add rows to a table using the INSERT statement. The\nINSERT privilege can also be set on individual columns; see\nColumn Privileges below for details. | \n \nREFERENCES | Unused. | \n \nSELECT | Read data from a table using the SELECT statement.\nThe SELECT privilege can also be set on individual columns;\nsee Column Privileges below for details. | \n \nSHOW VIEW | Show the CREATE VIEW statement to create a view\nusing the SHOW CREATE VIEW statement. | \n \nTRIGGER | Execute triggers associated to tables you update,\nexecute the CREATE TRIGGER and DROP TRIGGER statements. You\nwill still be able to see triggers. | \n \nUPDATE | Update existing rows in a table using the UPDATE\nstatement. UPDATE statements usually include a WHERE clause\nto update only certain rows. You must have SELECT privileges\non the table or the appropriate columns for the WHERE\nclause. The UPDATE privilege can also be set on individual\ncolumns; see Column Privileges below for details. | \n \nColumn Privileges\n \nSome table privileges can be set for individual columns of a\ntable. To use\ncolumn privileges, specify the table explicitly and provide\na list of column\nnames after the privilege type. For example, the following\nstatement would allow\nthe user to read the names and positions of employees, but\nnot other information\nfrom the same table, such as salaries.\n \nGRANT SELECT (name, position) on Employee to\n\'jeffrey\'@\'localhost\';\n \nPrivilege | Description | \n \nINSERT (column_list) | Add rows specifying values in columns\nusing the INSERT statement. If you only have column-level\nINSERT privileges, you must specify the columns you are\nsetting in the INSERT statement. All other columns will be\nset to their default values, or NULL. | \n \nREFERENCES (column_list) | Unused. | \n \nSELECT (column_list) | Read values in columns using the\nSELECT statement. You cannot access or query any columns for\nwhich you do not have SELECT privileges, including in WHERE,\nON, GROUP BY, and ORDER BY clauses. | \n \nUPDATE (column_list) | Update values in columns of existing\nrows using the UPDATE statement. UPDATE statements usually\ninclude a WHERE clause to update only certain rows. You must\nhave SELECT privileges on the table or the appropriate\ncolumns for the WHERE clause. | \n \nFunction Privileges\n \nPrivilege | Description | \n \nALTER ROUTINE | Change the characteristics of a stored\nfunction using the ALTER FUNCTION statement. | \n \nEXECUTE | Use a stored function. You need SELECT privileges\nfor any tables or columns accessed by the function. | \n \nGRANT OPTION | Grant function privileges. You can only grant\nprivileges that you have. | \n \nProcedure Privileges\n \nPrivilege | Description | \n \nALTER ROUTINE | Change the characteristics of a stored\nprocedure using the ALTER PROCEDURE statement. | \n \nEXECUTE | Execute a stored procedure using the CALL\nstatement. The privilege to call a procedure may allow you\nto perform actions you wouldn\'t otherwise be able to do,\nsuch as insert rows into a table. | \n \nGRANT OPTION | Grant procedure privileges. You can only\ngrant privileges that you have. | \n \nProxy Privileges\n \nPrivilege | Description | \n \nPROXY | Permits one user to be a proxy for another. | \n \nThe PROXY privilege allows one user to proxy as another\nuser, which means their privileges change to that of the\nproxy user, and the CURRENT_USER() function returns the user\nname of the proxy user.\n \nThe PROXY privilege only works with authentication plugins\nthat support it. The default mysql_native_password\nauthentication plugin does not support proxy users.\n \nThe pam authentication plugin is the only plugin included\nwith MariaDB that currently supports proxy users. The PROXY\nprivilege is commonly used with the pam authentication\nplugin to enable user and group mapping with PAM.\n \nFor example, to grant the PROXY privilege to an anonymous\naccount that authenticates with the pam authentication\nplugin, you could execute the following:\n \nCREATE USER \'dba\'@\'%\' IDENTIFIED BY \'strongpassword\';\n \nGRANT ALL PRIVILEGES ON *.* TO \'dba\'@\'%\' ;\n \nCREATE USER \'\'@\'%\' IDENTIFIED VIA pam USING \'mariadb\';\n \nGRANT PROXY ON \'dba\'@\'%\' TO \'\'@\'%\';\n \nA user account can only grant the PROXY privilege for a\nspecific user account if the granter also has the PROXY\nprivilege for that specific user account, and if that\nprivilege is defined WITH GRANT OPTION. For example, the\nfollowing example fails because the granter does not have\nthe PROXY privilege for that specific user account at all:\n \nSELECT USER(), CURRENT_USER();\n+-----------------+-----------------+\n| USER() | CURRENT_USER() |\n+-----------------+-----------------+\n| alice@localhost | alice@localhost |\n+-----------------+-----------------+\n \nSHOW GRANTS;\n \n+-----------------------------------------------------------------------------------------------------------------------+\n| Grants for alice@localhost |\n+-----------------------------------------------------------------------------------------------------------------------+\n| GRANT ALL PRIVILEGES ON *.* TO \'alice\'@\'localhost\'\nIDENTIFIED BY PASSWORD\n\'*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19\' |\n+-----------------------------------------------------------------------------------------------------------------------+\n \nGRANT PROXY ON \'dba\'@\'localhost\' TO\n\'bob\'@\'localhost\';\n \nERROR 1698 (28000): Access denied for user\n\'alice\'@\'localhost\'\n \nAnd the following example fails because the granter does\nhave the PROXY privilege for that specific user account, but\nit is not defined WITH GRANT OPTION:\n \nSELECT USER(), CURRENT_USER();\n+-----------------+-----------------+\n| USER() | CURRENT_USER() |\n+-----------------+-----------------+\n| alice@localhost | alice@localhost |\n+-----------------+-----------------+\n \nSHOW GRANTS;\n \n+-----------------------------------------------------------------------------------------------------------------------+\n| Grants for alice@localhost |\n+-----------------------------------------------------------------------------------------------------------------------+\n| GRANT ALL PRIVILEGES ON *.* TO \'alice\'@\'localhost\'\nIDENTIFIED BY PASSWORD\n\'*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19\' |\n| GRANT PROXY ON \'dba\'@\'localhost\' TO\n\'alice\'@\'localhost\' |\n+-----------------------------------------------------------------------------------------------------------------------+\n \nMariaDB [(none)]> GRANT PROXY ON \'dba\'@\'localhost\' TO\n\'bob\'@\'localhost\';\n \nERROR 1698 (28000): Access denied for user\n\'alice\'@\'localhost\'\n \nBut the following example succeeds because the granter does\nhave the PROXY privilege for that specific user account, and\nit is defined WITH GRANT OPTION:\n \nSELECT USER(), CURRENT_USER();\n+-----------------+-----------------+\n| USER() | CURRENT_USER() |\n+-----------------+-----------------+\n| alice@localhost | alice@localhost |\n+-----------------+-----------------+\n \nSHOW GRANTS;\n \n+-----------------------------------------------------------------------------------------------------------------------------------------+\n| Grants for alice@localhost |\n+-----------------------------------------------------------------------------------------------------------------------------------------+\n| GRANT ALL PRIVILEGES ON *.* TO \'alice\'@\'localhost\'\nIDENTIFIED BY PASSWORD\n\'*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19\' WITH GRANT\nOPTION |\n| GRANT PROXY ON \'dba\'@\'localhost\' TO\n\'alice\'@\'localhost\' WITH GRANT OPTION |\n+-----------------------------------------------------------------------------------------------------------------------------------------+\n \nGRANT PROXY ON \'dba\'@\'localhost\' TO\n\'bob\'@\'localhost\';\n \nQuery OK, 0 rows affected (0.004 sec)\n \nA user account can grant the PROXY privilege for any other\nuser account if th','','https://mariadb.com/kb/en/grant/');
-update help_topic set description = CONCAT(description, 'e granter has the PROXY privilege for the\n\'\'@\'%\' anonymous user account, like this:\n \nGRANT PROXY ON \'\'@\'%\' TO \'dba\'@\'localhost\' WITH\nGRANT OPTION;\n \nFor example, the following example succeeds because the user\ncan grant the PROXY privilege for any other user account:\n \nSELECT USER(), CURRENT_USER();\n+-----------------+-----------------+\n| USER() | CURRENT_USER() |\n+-----------------+-----------------+\n| alice@localhost | alice@localhost |\n+-----------------+-----------------+\n \nSHOW GRANTS;\n \n+-----------------------------------------------------------------------------------------------------------------------------------------+\n| Grants for alice@localhost |\n+-----------------------------------------------------------------------------------------------------------------------------------------+\n| GRANT ALL PRIVILEGES ON *.* TO \'alice\'@\'localhost\'\nIDENTIFIED BY PASSWORD\n\'*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19\' WITH GRANT\nOPTION |\n| GRANT PROXY ON \'\'@\'%\' TO \'alice\'@\'localhost\' WITH\nGRANT OPTION |\n+-----------------------------------------------------------------------------------------------------------------------------------------+\n \nGRANT PROXY ON \'app1_dba\'@\'localhost\' TO\n\'bob\'@\'localhost\';\n \nQuery OK, 0 rows affected (0.004 sec)\n \nGRANT PROXY ON \'app2_dba\'@\'localhost\' TO\n\'carol\'@\'localhost\';\n \nQuery OK, 0 rows affected (0.004 sec)\n \nThe default root user accounts created by mysql_install_db\nhave this privilege. For example:\n \nGRANT ALL PRIVILEGES ON *.* TO \'root\'@\'localhost\' WITH\nGRANT OPTION;\n \nGRANT PROXY ON \'\'@\'%\' TO \'root\'@\'localhost\' WITH\nGRANT OPTION;\n \nThis allows the default root user accounts to grant the\nPROXY privilege for any other user account, and it also\nallows the default root user accounts to grant others the\nprivilege to do the same.\n \nAuthentication Options\n \nThe authentication options for the GRANT statement are the\nsame as those for the CREATE USER statement.\n \nIDENTIFIED BY \'password\'\n \nThe optional IDENTIFIED BY clause can be used to provide an\naccount with a password. The password should be specified in\nplain text. It will be hashed by the PASSWORD function prior\nto being stored to the mysql.user table.\n \nFor example, if our password is mariadb, then we can create\nthe user with:\n \nGRANT USAGE ON *.* TO foo2@test IDENTIFIED BY \'mariadb\';\n \nIf you do not specify a password with the IDENTIFIED BY\nclause, the user\nwill be able to connect without a password. A blank password\nis not a wildcard\nto match any password. The user must connect without\nproviding a password if no\npassword is set.\n \nIf the user account already exists and if you provide the\nIDENTIFIED BY clause, then the user\'s password will be\nchanged. You must have the privileges needed for the SET\nPASSWORD\nstatement to change a user\'s password with GRANT.\n \nThe only authentication plugins that this clause supports\nare mysql_native_password and mysql_old_password.\n \nIDENTIFIED BY PASSWORD \'password_hash\'\n \nThe optional IDENTIFIED BY PASSWORD clause can be used to\nprovide an account with a password that has already been\nhashed. The password should be specified as a hash that was\nprovided by the PASSWORD function. It will be stored to the\nmysql.user table as-is.\n \nFor example, if our password is mariadb, then we can find\nthe hash with:\n \nSELECT PASSWORD(\'mariadb\');\n+-------------------------------------------+\n| PASSWORD(\'mariadb\') |\n+-------------------------------------------+\n| *54958E764CE10E50764C2EECBB71D01F08549980 |\n+-------------------------------------------+\n1 row in set (0.00 sec)\n \nAnd then we can create a user with the hash:\n \nGRANT USAGE ON *.* TO foo2@test IDENTIFIED BY PASSWORD\n\'*54958E764CE10E50764C2EECBB71D01F08549980\';\n \nIf you do not specify a password with the IDENTIFIED BY\nclause, the user\nwill be able to connect without a password. A blank password\nis not a wildcard\nto match any password. The user must connect without\nproviding a password if no\npassword is set.\n \nIf the user account already exists and if you provide the\nIDENTIFIED BY clause, then the user\'s password will be\nchanged. You must have the privileges needed for the SET\nPASSWORD\nstatement to change a user\'s password with GRANT.\n \nThe only authentication plugins that this clause supports\nare mysql_native_password and mysql_old_password.\n \nIDENTIFIED {VIA|WITH} authentication_plugin\n \nThe optional IDENTIFIED VIA authentication_plugin allows you\nto specify that the account should be authenticated by a\nspecific authentication plugin. The plugin name must be an\nactive authentication plugin as per SHOW PLUGINS. If it\ndoesn\'t show up in that output, then you will need to\ninstall it with INSTALL PLUGIN or INSTALL SONAME.\n \nFor example, this could be used with the PAM authentication\nplugin:\n \nGRANT USAGE ON *.* TO foo2@test IDENTIFIED VIA pam;\n \nSome authentication plugins allow additional arguments to be\nspecified after a USING or AS keyword. For example, the PAM\nauthentication plugin accepts a service name:\n \nGRANT USAGE ON *.* TO foo2@test IDENTIFIED VIA pam USING\n\'mariadb\';\n \nThe exact meaning of the additional argument would depend on\nthe specific authentication plugin.\n \nThe USING or AS keyword can also be used to provide a\nplain-text password to a plugin if it\'s provided as an\nargument to the PASSWORD() function. This is only valid for\nauthentication plugins that have implemented a hook for the\nPASSWORD() function. For example, the ed25519 authentication\nplugin supports this:\n \nCREATE USER safe@\'%\' IDENTIFIED VIA ed25519 USING\nPASSWORD(\'secret\');\n \nOne can specify many authentication plugins, they all works\nas alternatives ways of authenticating a user:\n \nCREATE USER safe@\'%\' IDENTIFIED VIA ed25519 USING\nPASSWORD(\'secret\') OR unix_socket;\n \nResource Limit Options\n \nMariaDB 10.2.0 introduced a number of resource limit\noptions.\n \nIt is possible to set per-account limits for certain server\nresources. The following table shows the values that can be\nset per account:\n \nLimit Type | Decription | \n \nMAX_QUERIES_PER_HOUR | Number of statements that the account\ncan issue per hour (including updates) | \n \nMAX_UPDATES_PER_HOUR | Number of updates (not queries) that\nthe account can issue per hour | \n \nMAX_CONNECTIONS_PER_HOUR | Number of connections that the\naccount can start per hour | \n \nMAX_USER_CONNECTIONS | Number of simultaneous connections\nthat can be accepted from the same account; if it is 0,\nmax_connections will be used instead; if max_connections is\n0, there is no limit for this account\'s simultaneous\nconnections. | \n \nMAX_STATEMENT_TIME | Timeout, in seconds, for statements\nexecuted by the user. See also Aborting Statements that\nExceed a Certain Time to Execute. | \n \nIf any of these limits are set to 0, then there is no limit\nfor that resource for that user.\n \nTo set resource limits for an account, if you do not want to\nchange that account\'s privileges, you can issue a GRANT\nstatement with the USAGE privilege, which has no meaning.\nThe statement can name some or all limit types, in any\norder.\n \nHere is an example showing how to set resource limits:\n \nGRANT USAGE ON *.* TO \'someone\'@\'localhost\' WITH\n MAX_USER_CONNECTIONS 0\n MAX_QUERIES_PER_HOUR 200;\n \nThe resources are tracked per account, which means\n\'user\'@\'server\'; not per user name or per connection.\n \nThe count can be reset for all users using FLUSH\nUSER_RESOURCES, FLUSH PRIVILEGES or mysqladmin reload.\n \nPer account resource limits are stored in the user table, in\nthe mysql database. Columns used for resources limits are\nnamed max_questions, max_updates, max_connections (for\nMAX_CONNECTIONS_PER_HOUR), and max_user_connections (for\nMAX_USER_CONNECTIONS).\n \nTLS Options\n \nBy default, MariaDB transmits data between the server and\nclients without encrypting it. This is generally acceptable\nwhen the server and client run on the same host or in\nnetworks where security is guaranteed through other means.\nHowever, in cases where the server and client exist on\nseparate networks or they are in a high-risk network, the\nlack of encryption does introduce security concerns as a\nmalicious actor could potentially eavesdrop on the traffic\nas it is sent over the network between them.\n \nTo mitigate this concern, MariaDB allows you to encrypt data\nin transit between the server and clients using the\nTransport Layer Security (TLS) protocol. TLS was formerly\nknown as Secure Socket Layer (SSL), but strictly speaking\nthe SSL protocol is a predecessor to TLS and, that version\nof the protocol is now considered insecure. The\ndocumentation still uses the term SSL often and for\ncompatibility reasons TLS-related server system and status\nvariables still use the prefix ssl_, but internally, MariaDB\nonly supports its secure successors.\n \nSee Secure Connections Overview for more information about\nhow to determine whether your MariaDB server has TLS\nsupport.\n \nYou can set certain TLS-related restrictions for specific\nuser accounts. For instance, you might use this with user\naccounts that require access to sensitive data while sending\nit across networks that you do not control. These\nrestrictions can be enabled for a user account with the\nCREATE USER, ALTER USER, or GRANT statements. The following\noptions are available:\n \nOption | Description | \n \nREQUIRE NONE | TLS is not required for this account, but can\nstill be used. | \n \nREQUIRE SSL | The account must use TLS, but no valid X509\ncertificate is required. This option cannot be combined with\nother TLS options. | \n \nREQUIRE X509 | The account must use TLS and must have a\nvalid X509 certificate. This option implies REQUIRE SSL.\nThis option cannot be combined with other TLS options. | \n \nREQUIRE ISSUER \'issuer\' | The account must use TLS and\nmust have a valid X509 certificate. Also, the Certificate\nAuthority must be the one specified via the string issuer.\nThis option implies REQUIRE X509. This option can be\ncombined with the SUBJECT, and CIPHER options in any order.\n| \n \nREQUIRE SUBJECT \'subject\' | The account must use TLS and\nmust have a valid X509 certificate. Also, the certificate\'s\nSubject must be the one specified via the string subject.\nThis option implies REQUIRE X509. This option can be\ncombined with the ISSUER, and CIPHER options in any order. |\n\n \nREQUIRE CIPHER \'cipher\' | The account must use TLS, but no\nvalid X509 certificate is required. Also, the encryption\nused for the connection must use one of the methods\nspecified in the string cipher. This option implies REQUIRE\nSSL. This option can be combined with the ISSUER, and\nSUBJECT options in any order. | \n \nThe REQUIRE keyword must be used only once for all specified\noptions, and the AND keyword can be used to separate\nindividual options, but it is not required.\n \nFor example, you can create a user account that requires\nthese TLS options with the following:\n \nGRANT USAGE ON *.* TO \'alice\'@\'%\'\n REQUIRE SUBJECT \'/CN=alice/O=My Dom,\nInc./C=US/ST=Oregon/L=Portland\'\n AND ISSUER \'/C=FI/ST=Somewhere/L=City/ O=Some\nCompany/CN=Peter Parker/emailAddress=p.parker@marvel.com\'\n AND CIPHER \'TLSv1.2\';\n \nIf any of these options are set for a specific user account,\nthen any client who tries to connect with that user account\nwill have to be configured to connect with TLS.\n \nSee Securing Connections for Client and Server for\ninformation on how to enable TLS on the client and server.\n \nRoles\n \nRoles were introduced in MariaDB 10.0.5.\n \nSyntax\n------ \nGRANT role TO grantee [, grantee2 ... ]\n[ WITH ADMIN OPTION ]\n \nThe GRANT statement is also used to grant the use a role to\none or more users or other roles. In order to be able to\ngrant a role, the grantor doing so must have permission to\ndo so (see WITH ADMIN in the CREATE ROLE article).\n \nSpecifying the WITH ADMIN OPTION permits the grantee to in\nturn grant the role to another.\n \nFor example, the following commands show how to grant the\nsame role to a couple different users.\n \nGRANT journalist TO hulda;\n \nGRANT journalist TO berengar WITH ADMIN OPTION;\n \nIf a user has been granted a role, they do not automatically\nobtain all permissions associated with that role. These\npermissions are only in use when the user activates the role\nwith the SET ROLE statement.\n \nGrant Examples\n \nGranting Root-like Privileges\n \nYou can create a user that has privileges similar to the\ndefault root accounts by executing the following:\n \nCREATE USER \'alexander\'@\'localhost\';\n \nGRANT ALL PRIVILEGES ON *.* to \'alexander\'@\'localhost\'\nWITH GRANT OPTION;\n \n\n\nURL: https://mariadb.com/kb/en/grant/') WHERE help_topic_id = 121;
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (122,10,'User Password Expiry','User password expiry was introduced in MariaDB 10.4.3.\n \nPassword expiry permits administrators to expire user\npasswords, either manually or automatically. \n \nSystem Variables\n \nThere are two system variables which affect password expiry:\ndefault_password_lifetime, which determines the amount of\ntime between requiring the user to change their password. 0,\nthe default, means automatic password expiry is not active.\n \nThe second variable, disconnect_on_expired_password\ndetermines whether a client is permitted to connect if their\npassword has expired, or whether they are permitted to\nconnect in sandbox mode, able to perform a limited subset of\nqueries related to resetting the password, in particular SET\nPASSWORD and SET.\n \nSetting a Password Expiry Limit for a User\n \nBesides automatic password expiry, as determined by\ndefault_password_lifetime, password expiry times can be set\non an individual user basis, overriding the global using the\nCREATE USER or ALTER USER statements, for example:\n \nCREATE USER \'monty\'@\'localhost\' PASSWORD EXPIRE INTERVAL\n120 DAY;\n \nALTER USER \'monty\'@\'localhost\' PASSWORD EXPIRE INTERVAL\n120 DAY;\n \nLimits can be disabled by use of the NEVER keyword, for\nexample:\n \nCREATE USER \'monty\'@\'localhost\' PASSWORD EXPIRE NEVER;\n \nALTER USER \'monty\'@\'localhost\' PASSWORD EXPIRE NEVER;\n \nA manually set limit can be restored the system default by\nuse of DEFAULT, for example:\n \nCREATE USER \'monty\'@\'localhost\' PASSWORD EXPIRE DEFAULT;\n \nALTER USER \'monty\'@\'localhost\' PASSWORD EXPIRE DEFAULT;\n \nSHOW CREATE USER\n \nThe SHOW CREATE USER statement will display information\nabout the password expiry status of the user. Unlike MySQL,\nit will not display if the user is unlocked, or if the\npassword expiry is set to default.\n \nCREATE USER \'monty\'@\'localhost\' PASSWORD EXPIRE INTERVAL\n120 DAY;\n \nCREATE USER \'konstantin\'@\'localhost\' PASSWORD EXPIRE\nNEVER;\n \nCREATE USER \'amse\'@\'localhost\' PASSWORD EXPIRE DEFAULT;\n \nSHOW CREATE USER \'monty\'@\'localhost\';\n \n+------------------------------------------------------------------+\n| CREATE USER for monty@localhost |\n+------------------------------------------------------------------+\n| CREATE USER \'monty\'@\'localhost\' PASSWORD EXPIRE\nINTERVAL 120 DAY |\n+------------------------------------------------------------------+\n \nSHOW CREATE USER \'konstantin\'@\'localhost\';\n \n+------------------------------------------------------------+\n| CREATE USER for konstantin@localhost |\n+------------------------------------------------------------+\n| CREATE USER \'konstantin\'@\'localhost\' PASSWORD EXPIRE\nNEVER |\n+------------------------------------------------------------+\n \nSHOW CREATE USER \'amse\'@\'localhost\';\n \n+--------------------------------+\n| CREATE USER for amse@localhost |\n+--------------------------------+\n| CREATE USER \'amse\'@\'localhost\' |\n+--------------------------------+\n \n--connect-expired-password Client Option\n \nThe mysql client --connect-expired-password option notifies\nthe server that the client is prepared to handle expired\npassword sandbox mode (even if the --batch option was\nspecified).\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/user-password-expiry/','','https://mariadb.com/kb/en/user-password-expiry/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (123,10,'RENAME USER','Syntax\n------ \nRENAME USER old_user TO new_user\n [, old_user TO new_user] ...\n \nDescription\n----------- \nThe RENAME USER statement renames existing MariaDB accounts.\nTo use it,\nyou must have the global CREATE USER privilege\nor the UPDATE privilege for the mysql database.\nEach account is named using the same format as for the\nCREATE USER\nstatement; for example, \'jeffrey\'@\'localhost\'.\nIf you specify only the user name part of the account name,\na host\nname part of \'%\' is used.\n \nIf any of the old user accounts do not exist or any of the\nnew user accounts already\nexist, ERROR 1396 (HY000) results. If an error occurs,\nRENAME USER\nwill still rename the accounts that do not result in an\nerror.\n \nExamples\n-------- \nCREATE USER \'donald\', \'mickey\';\n \nRENAME USER \'donald\' TO \'duck\'@\'localhost\', \'mickey\'\nTO \'mouse\'@\'localhost\';\n \n\n \n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/rename-user/','','https://mariadb.com/kb/en/rename-user/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (124,10,'REVOKE','Privileges\n \nSyntax\n------ \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 \nDescription\n----------- \nThe REVOKE statement enables system administrators to revoke\nprivileges (or roles - see section below) from MariaDB\naccounts. Each account is named using the same format\nas for the GRANT statement; for example,\n\'jeffrey\'@\'localhost\'. If you specify only the user name\npart\nof the account name, a host name part of \'%\' is used. For\ndetails on the levels at which privileges exist, the\nallowable\npriv_type and priv_level values, and the\nsyntax for specifying users and passwords, see GRANT.\n \nTo use the first REVOKE syntax, you must have the\nGRANT OPTION privilege, and you must have the privileges\nthat\nyou are revoking.\n \nTo revoke all privileges, use the second syntax, which drops\nall\nglobal, database, table, column, and routine privileges for\nthe named\nuser or users:\n \nREVOKE ALL PRIVILEGES, GRANT OPTION FROM user [, user] ...\n \nTo use this REVOKE syntax, you must have the global\nCREATE USER privilege or the\nUPDATE privilege for the mysql database. See\nGRANT.\n \nExamples\n-------- \nREVOKE SUPER ON *.* FROM \'alexander\'@\'localhost\';\n \nRoles\n \nRoles were introduced in MariaDB 10.0.5.\n \nSyntax\n------ \nREVOKE role [, role ...]\n FROM grantee [, grantee2 ... ]\n \nDescription\n----------- \nREVOKE is also used to remove a role from a user or another\nrole that it\'s previously been assigned to. If a role has\npreviously been set as a default role, REVOKE does not\nremove the record of the default role from the mysql.user\ntable. If the role is subsequently granted again, it will\nagain be the user\'s default. Use SET DEFAULT ROLE NONE to\nexplicitly remove this.\n \nBefore MariaDB 10.1.13, the REVOKE role statement was not\npermitted in prepared statements.\n \nExample\n \nREVOKE journalist FROM hulda\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/revoke/','','https://mariadb.com/kb/en/revoke/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (125,10,'SET PASSWORD','Syntax\n------ \nSET PASSWORD [FOR user] =\n {\n PASSWORD(\'some password\')\n | OLD_PASSWORD(\'some password\')\n | \'encrypted password\'\n }\n \nDescription\n----------- \nThe SET PASSWORD statement assigns a password to an existing\nMariaDB user\naccount.\n \nIf the password is specified using the PASSWORD() or\nOLD_PASSWORD()\nfunction, the literal text of the password should be given.\nIf the\npassword is specified without using either function, the\npassword\nshould be the already-encrypted password value as returned\nby\nPASSWORD().\n \nOLD_PASSWORD() should only be used if your MariaDB/MySQL\nclients are very old (< 4.0.0).\n \nWith no FOR clause, this statement sets the password for the\ncurrent\nuser. Any client that has connected to the server using a\nnon-anonymous\naccount can change the password for that account.\n \nWith a FOR clause, this statement sets the password for a\nspecific\naccount on the current server host. Only clients that have\nthe UPDATE\nprivilege for the mysql database can do this. The user value\nshould be\ngiven in user_name@host_name format, where user_name and\nhost_name are\nexactly as they are listed in the User and Host columns of\nthe\nmysql.user table entry. \n \nThe argument to PASSWORD() and the password given to MariaDB\nclients can be of arbitrary length.\n \nAuthentication Plugin Support\n \nIn MariaDB 10.4 and later, SET PASSWORD (with or without\nPASSWORD()) works for accounts authenticated via any\nauthentication plugin that supports passwords stored in the\nmysql.global_priv table.\n \nThe ed25519, mysql_native_password, and mysql_old_password\nauthentication plugins store passwords in the\nmysql.global_priv table.\n \nIf you run SET PASSWORD on an account that authenticates\nwith one of these authentication plugins that stores\npasswords in the mysql.global_priv table, then the\nPASSWORD() function is evaluated by the specific\nauthentication plugin used by the account. The\nauthentication plugin hashes the password with a method that\nis compatible with that specific authentication plugin.\n \nThe unix_socket, named_pipe, gssapi, and pam authentication\nplugins do not store passwords in the mysql.global_priv\ntable. These authentication plugins rely on other methods to\nauthenticate the user.\n \nIf you attempt to run SET PASSWORD on an account that\nauthenticates with one of these authentication plugins that\ndoesn\'t store a password in the mysql.global_priv table,\nthen MariaDB Server will raise a warning like the following:\n \nSET PASSWORD is ignored for users authenticating via\nunix_socket plugin\n \nSee Authentication from MariaDB 10.4 for an overview of\nauthentication changes in MariaDB 10.4.\n \nMariaDB until 10.3\n \nIn MariaDB 10.3 and before, SET PASSWORD (with or without\nPASSWORD()) only works for accounts authenticated via\nmysql_native_password or mysql_old_password authentication\nplugins\n \nPasswordless User Accounts\n \nUser accounts do not always require passwords to login.\n \nThe unix_socket , named_pipe and gssapi authentication\nplugins do not require a password to authenticate the user.\n \nThe pam authentication plugin may or may not require a\npassword to authenticate the user, depending on the specific\nconfiguration.\n \nThe mysql_native_password and mysql_old_password\nauthentication plugins require passwords for authentication,\nbut the password can be blank. In that case, no password is\nrequired.\n \nIf you provide a password while attempting to log into the\nserver as an account that doesn\'t require a password, then\nMariaDB server will simply ignore the password.\n \nIn MariaDB 10.4 and later, a user account can be defined to\nuse multiple authentication plugins in a specific order of\npreference. This specific scenario may be more noticeable in\nthese versions, since an account could be associated with\nsome authentication plugins that require a password, and\nsome that do not.\n \nExample\n \nFor example, if you had an entry with User and\nHost column values of \'bob\' and \n\'%.loc.gov\', you would write the\nstatement like this:\n \nSET PASSWORD FOR \'bob\'@\'%.loc.gov\' =\nPASSWORD(\'newpass\');\n \n\n\nURL: https://mariadb.com/kb/en/set-password/','','https://mariadb.com/kb/en/set-password/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (126,10,'Roles Overview','Roles were introduced in MariaDB 10.0.5.\n \nDescription\n----------- \nA role bundles a number of privileges together. It assists\nlarger organizations where, typically, a number of users\nwould have the same privileges, and, previously, the only\nway to change the privileges for a group of users was by\nchanging each user\'s privileges individually. \n \nAlternatively, multiple external users could have been\nassigned the same user, and there would have been no way to\nsee which actual user was responsible for which action.\n \nWith roles, managing this is easy. For example, there could\nbe a number of users assigned to a journalist role, with\nidentical privileges. Changing the privileges for all the\njournalists is a matter of simply changing the role\'s\nprivileges, while the individual user is still linked with\nany changes that take place.\n \nRoles are created with the CREATE ROLE statement, and\ndropped with the DROP ROLE statement. Roles are then\nassigned to a user with an extension to the GRANT statement,\nwhile privileges are assigned to a role in the regular way\nwith GRANT. Similarly, the REVOKE statement can be used to\nboth revoke a role from a user, or revoke a privilege from a\nrole.\n \nOnce a user has connected, he can obtain all privileges\nassociated with a role by setting a role with the SET ROLE\nstatement. The CURRENT_ROLE function returns the currently\nset role for the session, if any.\n \nOnly roles granted directly to a user can be set, roles\ngranted to other roles cannot. Instead the privileges\ngranted to a role, which is, in turn, granted to another\nrole (grantee), will be immediately available to any user\nwho sets this second grantee role.\n \nRoles were implemented as a GSoC 2013 project by Vicentiu\nCiorbaru. \n \nThe SET DEFAULT ROLE statement allows one to set a default\nrole for a user. A default role is automatically enabled\nwhen a user connects (an implicit SET ROLE statement is\nexecuted immediately after a connection is established).\n \nSystem Tables\n \nInformation about roles and who they\'ve been granted to can\nbe found in the Information Schema APPLICABLE_ROLES table as\nwell as the mysql.ROLES_MAPPING table.\n \nThe Information Schema ENABLED_ROLES table shows the enabled\nroles for the current session.\n \nExamples\n-------- \nCreating a role and granting a privilege:\n \nCREATE ROLE journalist;\n \nGRANT SHOW DATABASES ON *.* TO journalist;\n \nGRANT journalist to hulda;\n \nNote, that hulda has no SHOW DATABASES privilege, even\nthough she was granted the journalist role. She needs to set\nthe role first:\n \nSHOW DATABASES;\n \n+--------------------+\n| Database |\n+--------------------+\n| information_schema |\n+--------------------+\n \nSELECT CURRENT_ROLE;\n \n+--------------+\n| CURRENT_ROLE |\n+--------------+\n| NULL |\n+--------------+\n \nSET ROLE journalist;\n \nSELECT CURRENT_ROLE;\n \n+--------------+\n| CURRENT_ROLE |\n+--------------+\n| journalist |\n+--------------+\n \nSHOW DATABASES;\n \n+--------------------+\n| Database |\n+--------------------+\n| ... |\n| information_schema |\n| mysql |\n| performance_schema |\n| test |\n| ... |\n+--------------------+\n \nSET ROLE NONE;\n \nRoles can be granted to roles:\n \nCREATE ROLE writer;\n \nGRANT SELECT ON data.* TO writer;\n \nGRANT writer TO journalist;\n \nBut one does not need to set a role granted to a role. For\nexample, hulda will automatically get all writer privileges\nwhen she sets the journalist role:\n \nSELECT CURRENT_ROLE;\n \n+--------------+\n| CURRENT_ROLE |\n+--------------+\n| NULL |\n+--------------+\n \nSHOW TABLES FROM data;\n \nEmpty set (0.01 sec)\n \nSET ROLE journalist;\n \nSELECT CURRENT_ROLE;\n \n+--------------+\n| CURRENT_ROLE |\n+--------------+\n| journalist |\n+--------------+\n \nSHOW TABLES FROM data;\n \n+------------------------------+\n| Tables_in_data |\n+------------------------------+\n| set1 |\n| ... |\n+------------------------------+\n \nRoles and Views (and Stored Routines)\n \nWhen a user sets a role, he, in a sense, has two identities\nwith two associated sets of privileges.\nBut a view (or a stored routine) can have only one definer.\nSo, when a view (or a stored routine) is created with the\nSQL SECURITY DEFINER, one can specify whether the definer\nshould be CURRENT_USER (and the view will have none of the\nprivileges of the user\'s role) or CURRENT_ROLE (in this\ncase, the view will use role\'s privileges, but none of the\nuser\'s privileges). As a result, sometimes one can create a\nview that is impossible to use.\n \nCREATE ROLE r1;\n \nGRANT ALL ON db1.* TO r1;\n \nGRANT r1 TO foo@localhost;\n \nGRANT ALL ON db.* TO foo@localhost;\n \nSELECT CURRENT_USER\n+---------------+\n| current_user |\n+---------------+\n| foo@localhost |\n+---------------+\n \nSET ROLE r1;\n \nCREATE TABLE db1.t1 (i int);\n \nCREATE VIEW db.v1 AS SELECT * FROM db1.t1;\n \nSHOW CREATE VIEW db.v1;\n \n+------+------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+\n| View | Create View | character_set_client |\ncollation_connection |\n+------+------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+\n| v1 | CREATE ALGORITHM=UNDEFINED DEFINER=`foo`@`localhost`\nSQL SECURITY DEFINER VIEW `db`.`v1` AS SELECT `db1`.`t1`.`i`\nAS `i` from `db1`.`t1` | utf8 | utf8_general_ci |\n+------+------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+\n \nCREATE DEFINER=CURRENT_ROLE VIEW db.v2 AS SELECT * FROM\ndb1.t1;\n \nSHOW CREATE VIEW db.b2;\n \n+------+-----------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+\n| View | Create View | character_set_client |\ncollation_connection |\n+------+-----------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+\n| v2 | CREATE ALGORITHM=UNDEFINED DEFINER=`r1` SQL SECURITY\nDEFINER VIEW `db`.`v2` AS select `db1`.`t1`.`a` AS `a` from\n`db1`.`t1` | utf8 | utf8_general_ci |\n+------+-----------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+\n \nOther Resources\n \nRoles Review by Peter Gulutzan\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/roles_overview/','','https://mariadb.com/kb/en/roles_overview/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (127,10,'CREATE ROLE','Roles were introduced in MariaDB 10.0.5.\n \nSyntax\n------ \nCREATE [OR REPLACE] ROLE [IF NOT EXISTS] role \n [WITH ADMIN \n {CURRENT_USER | CURRENT_ROLE | user | role}]\n \nDescription\n----------- \nThe CREATE ROLE statement creates one or more MariaDB roles.\nTo\nuse it, you must have the global CREATE USER\nprivilege or the INSERT privilege for the mysql\ndatabase. For each account, CREATE ROLE creates a new row in\nthe\nmysql.user table that has no privileges, and with the\ncorresponding is_role field set to Y. It also creates a\nrecord in the\nmysql.roles_mapping table.\n \nIf any of the specified roles already exist, ERROR 1396\n(HY000) results. If\nan error occurs, CREATE ROLE will still create the roles\nthat do not result\nin an error. The maximum length for a role is 128\ncharacters. Role names can be\nquoted, as explained in the Identifier names page. Only\none error is produced for all roles which have not been\ncreated:\n \nERROR 1396 (HY000): Operation CREATE ROLE failed for\n\'a\',\'b\',\'c\'\n \nFailed CREATE or DROP operations, for both users and roles,\nproduce the\nsame error code.\n \nPUBLIC and NONE are reserved, and cannot be used as role\nnames.\n \nBefore MariaDB 10.1.13, the CREATE ROLE statement was not\npermitted in prepared statements.\n \nFor valid identifiers to use as role names, see Identifier\nNames.\n \nWITH ADMIN\n \nThe optional WITH ADMIN clause determines whether the\ncurrent user, the\ncurrent role or another user or role has use of the newly\ncreated role. If the\nclause is omitted, WITH ADMIN CURRENT_USER is treated as the\ndefault, which\nmeans that the current user will be able to GRANT this role\nto\nusers.\n \nOR REPLACE\n \nThe OR REPLACE clause was added in MariaDB 10.1.3\n \nIf the optional OR REPLACE clause is used, it acts as a\nshortcut for:\n \nDROP ROLE IF EXISTS name;\n \nCREATE ROLE name ...;\n \nIF NOT EXISTS\n \nThe IF NOT EXISTS clause was added in MariaDB 10.1.3\n \nWhen the IF NOT EXISTS clause is used, MariaDB will return a\nwarning instead of an error if the specified role already\nexists. Cannot be used together with the OR REPLACE clause.\n \nExamples\n-------- \nCREATE ROLE journalist;\n \nCREATE ROLE developer WITH ADMIN lorinda;\n \nThe OR REPLACE and IF NOT EXISTS clauses:\n \nCREATE ROLE journalist;\nERROR 1396 (HY000): Operation CREATE ROLE failed for\n\'journalist\'\n \nCREATE OR REPLACE ROLE journalist;\nQuery OK, 0 rows affected (0.00 sec)\n \nCREATE ROLE IF NOT EXISTS journalist;\nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n+-------+------+---------------------------------------------------+\n| Level | Code | Message |\n+-------+------+---------------------------------------------------+\n| Note | 1975 | Can\'t create role \'journalist\'; it\nalready exists |\n+-------+------+---------------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/create-role/','','https://mariadb.com/kb/en/create-role/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (128,10,'DROP ROLE','Roles were introduced in MariaDB 10.0.5.\n \nSyntax\n------ \nDROP ROLE [IF EXISTS] role_name [,role_name ...]\n \nDescription\n----------- \nThe DROP ROLE statement removes one or more MariaDB roles.\nTo use this\nstatement, you must have the global CREATE USER privilege or\nthe DELETE privilege for the mysql database.\n \nDROP ROLE does not disable roles for connections which\nselected them with SET ROLE. If a role has previously been\nset as a default role, DROP ROLE does not remove the record\nof the default role from the mysql.user table. If the role\nis subsequently recreated and granted, it will again be the\nuser\'s default. Use SET DEFAULT ROLE NONE to explicitly\nremove this.\n \nIf any of the specified user accounts do not exist, ERROR\n1396 (HY000)\nresults. If an error occurs, DROP ROLE will still drop the\nroles that\ndo not result in an error. Only one error is produced for\nall roles which have not been dropped:\n \nERROR 1396 (HY000): Operation DROP ROLE failed for\n\'a\',\'b\',\'c\'\n \nFailed CREATE or DROP operations, for both users and roles,\nproduce the same error code.\n \nBefore MariaDB 10.1.13, the DROP ROLE statement was not\npermitted in prepared statements.\n \nIF EXISTS\n \nThe IF EXISTS clause was added in MariaDB 10.1.3\n \nIf the IF EXISTS clause is used, MariaDB will return a\nwarning instead of an error if the role does not exist.\n \nExamples\n-------- \nDROP ROLE journalist;\n \nThe same thing using the optional IF EXISTS clause:\n \nDROP ROLE journalist;\n \nERROR 1396 (HY000): Operation DROP ROLE failed for\n\'journalist\'\n \nDROP ROLE IF EXISTS journalist;\n \nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n \nNote (Code 1975): Can\'t drop role \'journalist\'; it\ndoesn\'t exist\n \n\n\nURL: https://mariadb.com/kb/en/drop-role/','','https://mariadb.com/kb/en/drop-role/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (129,10,'SET ROLE','Roles were introduced in MariaDB 10.0.5.\n \nSyntax\n------ \nSET ROLE { role | NONE }\n \nDescription\n----------- \nThe SET ROLE statement enables a role, along with all of its\nassociated permissions, for the current session. To unset a\nrole, use NONE .\n \nIf a role that doesn\'t exist, or to which the user has not\nbeen assigned, is specified, an ERROR 1959 (OP000): Invalid\nrole specification error occurs.\n \nFrom MariaDB 10.1.1, an automatic SET ROLE is implicitly\nperformed when a user connects if that user has been\nassigned a default role. See SET DEFAULT ROLE.\n \nExample\n \nSELECT CURRENT_ROLE;\n \n+--------------+\n| CURRENT_ROLE |\n+--------------+\n| NULL |\n+--------------+\n \nSET ROLE staff;\n \nSELECT CURRENT_ROLE;\n \n+--------------+\n| CURRENT_ROLE |\n+--------------+\n| staff |\n+--------------+\n \nSET ROLE NONE;\n \nQuery OK, 0 rows affected (0.00 sec)\n \nSELECT CURRENT_ROLE();\n+----------------+\n| CURRENT_ROLE() |\n+----------------+\n| NULL |\n+----------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/set-role/','','https://mariadb.com/kb/en/set-role/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (130,10,'SET DEFAULT ROLE','Default roles were implemented in MariaDB 10.1.1.\n \nSyntax\n------ \nSET DEFAULT ROLE { role | NONE } [ FOR user@host ]\n \nDescription\n----------- \nThe SET DEFAULT ROLE statement sets a default role for a\nspecified (or current) user. A default role is automatically\nenabled when a user connects (an implicit SET ROLE statement\nis executed immediately after a connection is established).\n \nTo be able to set a role as a default, one needs the\nprivileges to enable this role (if you cannot do SET ROLE X,\nyou won\'t be able to do SET DEFAULT ROLE X). To set a\ndefault role for another user one needs to have write access\nto the mysql database.\n \nTo remove a user\'s default role, use SET DEFAULT ROLE NONE\n[ FOR user@host ]. The record of the default role is not\nremoved if the role is dropped or revoked, so if the role is\nsubsequently re-created or granted, it will again be the\nuser\'s default role.\n \nThe default role is stored in a new column in the mysql.user\ntable, and currently viewing this table is the only way to\nsee which role has been assigned to a user as the default. \n \nExamples\n-------- \nSetting a default role for the current user:\n \nSET DEFAULT ROLE journalist;\n \nRemoving a default role from the current user:\n \nSET DEFAULT ROLE NONE;\n \n\n \n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/set-default-role/','','https://mariadb.com/kb/en/set-default-role/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (131,11,'ST_X','Syntax\n------ \nST_X(p)\nX(p)\n \nDescription\n----------- \nReturns the X-coordinate value for the point p as a\ndouble-precision number.\n \nST_X() and X() are synonyms.\n \nExamples\n-------- \nSET @pt = \'Point(56.7 53.34)\';\n \nSELECT X(GeomFromText(@pt));\n+----------------------+\n| X(GeomFromText(@pt)) |\n+----------------------+\n| 56.7 |\n+----------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_x/','','https://mariadb.com/kb/en/st_x/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (132,11,'ST_Y','Syntax\n------ \nST_Y(p)\nY(p)\n \nDescription\n----------- \nReturns the Y-coordinate value for the point p as a\ndouble-precision number.\n \nST_Y() and Y() are synonyms.\n \nExamples\n-------- \nSET @pt = \'Point(56.7 53.34)\';\n \nSELECT Y(GeomFromText(@pt));\n+----------------------+\n| Y(GeomFromText(@pt)) |\n+----------------------+\n| 53.34 |\n+----------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_y/','','https://mariadb.com/kb/en/st_y/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (133,11,'X','A synonym for ST_X.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/point-properties-x/','','https://mariadb.com/kb/en/point-properties-x/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (134,11,'Y','A synonym for ST_Y.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/point-properties-y/','','https://mariadb.com/kb/en/point-properties-y/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (135,12,'AES_DECRYPT','Syntax\n------ \nAES_DECRYPT(crypt_str,key_str)\n \nDescription\n----------- \nThis function allows decryption of data using the official\nAES\n(Advanced Encryption Standard) algorithm. For more\ninformation, see\nthe description of AES_ENCRYPT().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/aes_decrypt/','','https://mariadb.com/kb/en/aes_decrypt/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (136,12,'AES_ENCRYPT','Syntax\n------ \nAES_ENCRYPT(str,key_str)\n \nDescription\n----------- \nAES_ENCRYPT() and AES_DECRYPT() allow encryption and\ndecryption of\ndata using the official AES (Advanced Encryption Standard)\nalgorithm,\npreviously known as \"Rijndael.\" Encoding with a 128-bit\nkey length is\nused, but you can extend it up to 256 bits by modifying the\nsource. We\nchose 128 bits because it is much faster and it is secure\nenough for\nmost purposes.\n \nAES_ENCRYPT() encrypts a string str using the key key_str,\nand returns a binary string.\n \nAES_DECRYPT() decrypts the encrypted string and returns the\noriginal\nstring.\n \nThe 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\nencode\nuneven length strings and so the result string length may be\ncalculated using this formula:\n \n16 x (trunc(string_length / 16) + 1)\n \nIf AES_DECRYPT() detects invalid data or incorrect padding,\nit returns\nNULL. However, it is possible for AES_DECRYPT() to return a\nnon-NULL\nvalue (possibly garbage) if the input data or the key is\ninvalid.\n \nExamples\n-------- \nINSERT INTO t VALUES\n(AES_ENCRYPT(\'text\',SHA2(\'password\',512)));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/aes_encrypt/','','https://mariadb.com/kb/en/aes_encrypt/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (137,12,'COMPRESS','Syntax\n------ \nCOMPRESS(string_to_compress)\n \nDescription\n----------- \nCompresses a string and returns the result as a binary\nstring. This\nfunction requires MariaDB to have been compiled with a\ncompression\nlibrary such as zlib. Otherwise, the return value is always\nNULL. The\ncompressed string can be uncompressed with UNCOMPRESS().\n \nThe have_compress server system variable indicates whether a\ncompression library is present. \n \nExamples\n-------- \nSELECT LENGTH(COMPRESS(REPEAT(\'a\',1000)));\n+------------------------------------+\n| LENGTH(COMPRESS(REPEAT(\'a\',1000))) |\n+------------------------------------+\n| 21 |\n+------------------------------------+\n \nSELECT LENGTH(COMPRESS(\'\'));\n+----------------------+\n| LENGTH(COMPRESS(\'\')) |\n+----------------------+\n| 0 |\n+----------------------+\n \nSELECT LENGTH(COMPRESS(\'a\'));\n+-----------------------+\n| LENGTH(COMPRESS(\'a\')) |\n+-----------------------+\n| 13 |\n+-----------------------+\n \nSELECT LENGTH(COMPRESS(REPEAT(\'a\',16)));\n+----------------------------------+\n| LENGTH(COMPRESS(REPEAT(\'a\',16))) |\n+----------------------------------+\n| 15 |\n+----------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/compress/','','https://mariadb.com/kb/en/compress/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (138,12,'DECODE','Syntax\n------ \nDECODE(crypt_str,pass_str)\n \nDescription\n----------- \nDecrypts the encrypted string crypt_str using pass_str as\nthe\npassword. crypt_str should be a string returned from\nENCODE(). The resulting string will be the original string\nonly if pass_str is the same.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/decode/','','https://mariadb.com/kb/en/decode/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (139,12,'DES_DECRYPT','Syntax\n------ \nDES_DECRYPT(crypt_str[,key_str])\n \nDescription\n----------- \nDecrypts a string encrypted with DES_ENCRYPT(). If an error\noccurs,\nthis function returns NULL.\n \nThis function works only if MariaDB has been configured with\nTLS\nsupport.\n \nIf no key_str argument is given, DES_DECRYPT() examines the\nfirst byte\nof the encrypted string to determine the DES key number that\nwas used\nto encrypt the original string, and then reads the key from\nthe DES\nkey file to decrypt the message. For this to work, the user\nmust have\nthe SUPER privilege. The key file can be specified with the\n--des-key-file server option.\n \nIf you pass this function a key_str argument, that string is\nused as\nthe key for decrypting the message.\n \nIf the crypt_str argument does not appear to be an encrypted\nstring,\nMariaDB returns the given crypt_str.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/des_decrypt/','','https://mariadb.com/kb/en/des_decrypt/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (140,12,'DES_ENCRYPT','Syntax\n------ \nDES_ENCRYPT(str[,{key_num|key_str}])\n \nDescription\n----------- \nEncrypts the string with the given key using the Triple-DES\nalgorithm.\n \nThis function works only if MariaDB has been configured with\nTLS support.\n \nThe encryption key to use is chosen based on the second\nargument to\nDES_ENCRYPT(), if one was given. With no argument, the first\nkey from\nthe DES key file is used. With a key_num argument, the given\nkey \nnumber (0-9) from the DES key file is used. With a key_str\nargument,\nthe given key string is used to encrypt str. \n \nThe key file can be specified with the --des-key-file server\noption.\n \nThe return string is a binary string where the first\ncharacter is \nCHAR(128 | key_num). If an error occurs, DES_ENCRYPT()\nreturns NULL.\n \nThe 128 is added to make it easier to recognize an encrypted\nkey. 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\n9. Lines in\nthe file may be in any order. des_key_str is the string that\nis used\nto encrypt the message. There should be at least one space\nbetween the\nnumber and the key. The first key is the default key that is\nused if\nyou do not specify any key argument to DES_ENCRYPT().\n \nYou can tell MariaDB to read new key values from the key\nfile with the\nFLUSH DES_KEY_FILE statement. This requires the RELOAD\nprivilege.\n \nOne benefit of having a set of default keys is that it gives\napplications a way to check for the existence of encrypted\ncolumn\nvalues, without giving the end user the right to decrypt\nthose values.\n \nExamples\n-------- \nSELECT customer_address FROM customer_table \n WHERE crypted_credit_card =\nDES_ENCRYPT(\'credit_card_number\');\n \n\n\nURL: https://mariadb.com/kb/en/des_encrypt/','','https://mariadb.com/kb/en/des_encrypt/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (141,12,'ENCODE','Syntax\n------ \nENCODE(str,pass_str)\n \nDescription\n----------- \nENCODE is not considered cryptographically secure, and\nshould not be used for password encryption.\n \nEncrypt str using pass_str as the password. To decrypt the\nresult, 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\nrandom generator is. \n \nIt is not recommended to rely on the encryption performed by\nthe ENCODE function. Using a salt value (changed when a\npassword is updated) will improve matters somewhat, but for\nstoring passwords, consider a more cryptographically secure\nfunction, such as SHA2().\n \nExamples\n-------- \nENCODE(\'not so secret text\',\nCONCAT(\'random_salt\',\'password\'))\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/encode/','','https://mariadb.com/kb/en/encode/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (142,12,'ENCRYPT','Syntax\n------ \nENCRYPT(str[,salt])\n \nDescription\n----------- \nEncrypts a string using the Unix crypt() system call,\nreturning an encrypted binary string. The salt argument\nshould be a string with at least two characters or the\nreturned result will be NULL. If no salt argument is given,\na random value of sufficient length is used.\n \nIt is not recommended to use ENCRYPT() with utf16, utf32 or\nucs2 multi-byte character sets because the crypt() system\ncall expects a string terminated with a zero byte.\n \nNote that the underlying crypt() system call may have some\nlimitations, such as ignoring all but the first eight\ncharacters.\n \nIf the have_crypt system variable is set to NO (because the\ncrypt() system call is not available), the ENCRYPT function\nwill always return NULL.\n \nExamples\n-------- \nSELECT ENCRYPT(\'encrypt me\');\n+-----------------------+\n| ENCRYPT(\'encrypt me\') |\n+-----------------------+\n| 4I5BsEx0lqTDk |\n+-----------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/encrypt/','','https://mariadb.com/kb/en/encrypt/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (143,12,'MD5','Syntax\n------ \nMD5(str)\n \nDescription\n----------- \nCalculates an MD5 128-bit checksum for the string. \n \nThe return value is a 32-hex digit string, and as of MariaDB\n5.5, is a nonbinary string in the connection character set\nand collation, determined by the values of the\ncharacter_set_connection and collation_connection system\nvariables. Before 5.5, the return value was a binary string.\n \nNULL is returned if the argument was NULL. \n \nExamples\n-------- \nSELECT MD5(\'testing\');\n+----------------------------------+\n| MD5(\'testing\') |\n+----------------------------------+\n| ae2b1fca515949e5d54fb22b8ed95575 |\n+----------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/md5/','','https://mariadb.com/kb/en/md5/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (144,12,'OLD_PASSWORD','Syntax\n------ \nOLD_PASSWORD(str)\n \nDescription\n----------- \nOLD_PASSWORD() was added to MySQL when the implementation of\n\nPASSWORD() was changed to improve security. OLD_PASSWORD()\nreturns the\nvalue of the old (pre-MySQL 4.1) implementation of\nPASSWORD() as a\nstring, and is intended to permit you to reset passwords for\nany\npre-4.1 clients that need to connect to a more recent MySQL\nserver version, or any version of MariaDB,\nwithout locking them out.\n \nAs of MariaDB 5.5, the return value is a nonbinary string in\nthe connection character set and collation, determined by\nthe values of the character_set_connection and\ncollation_connection system variables. Before 5.5, the\nreturn value was a binary string.\n \nThe return value is 16 bytes in length, or NULL if the\nargument was NULL.\n \n\n\nURL: https://mariadb.com/kb/en/old_password/','','https://mariadb.com/kb/en/old_password/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (145,12,'PASSWORD','Syntax\n------ \nPASSWORD(str)\n \nDescription\n----------- \nThe PASSWORD() function is used for hashing passwords for\nuse in authentication by the MariaDB server. It is not\nintended for use in other applications.\n \nCalculates and returns a hashed password string from the\nplaintext password str. Returns an empty string (>= MariaDB\n10.0.4) or NULL (\n\nURL: https://mariadb.com/kb/en/password/','','https://mariadb.com/kb/en/password/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (146,12,'SHA1','Syntax\n------ \nSHA1(str), SHA(str)\n \nDescription\n----------- \nCalculates an SHA-1 160-bit checksum for the string str, as\ndescribed in\nRFC 3174 (Secure Hash Algorithm).\n \nThe value is returned as a string of 40 hex digits, or NULL\nif the argument was NULL. As of MariaDB 5.5, the return\nvalue is a nonbinary string in the connection character set\nand collation, determined by the values of the\ncharacter_set_connection and collation_connection system\nvariables. Before 5.5, the return value was a binary string.\n \nExamples\n-------- \nSELECT SHA1(\'some boring text\');\n+------------------------------------------+\n| SHA1(\'some boring text\') |\n+------------------------------------------+\n| af969fc2085b1bb6d31e517d5c456def5cdd7093 |\n+------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/sha1/','','https://mariadb.com/kb/en/sha1/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (147,12,'SHA2','SHA2() was introduced in MariaDB 5.5\n \nSyntax\n------ \nSHA2(str,hash_len)\n \nDescription\n----------- \nGiven a string str, calculates an SHA-2 checksum, which is\nconsidered more cryptographically secure than its SHA-1\nequivalent. The SHA-2 family includes SHA-224, SHA-256,\nSHA-384, and SHA-512, and the hash_len must correspond to\none of these, i.e. 224, 256, 384 or 512. 0 is equivalent to\n256.\n \nThe return value is a nonbinary string in the connection\ncharacter set and collation, determined by the values of the\ncharacter_set_connection and collation_connection system\nvariables. \n \nNULL is returned if the hash length is not valid, or the\nstring str is NULL.\n \nSHA2 will only work if MariaDB was has been configured with\nTLS support. \n \nExamples\n-------- \nSELECT SHA2(\'Maria\',224);\n+----------------------------------------------------------+\n| SHA2(\'Maria\',224) |\n+----------------------------------------------------------+\n| 6cc67add32286412efcab9d0e1675a43a5c2ef3cec8879f81516ff83 |\n+----------------------------------------------------------+\n \nSELECT SHA2(\'Maria\',256);\n+------------------------------------------------------------------+\n| SHA2(\'Maria\',256) |\n+------------------------------------------------------------------+\n|\n9ff18ebe7449349f358e3af0b57cf7a032c1c6b2272cb2656ff85eb112232f16\n|\n+------------------------------------------------------------------+\n \nSELECT SHA2(\'Maria\',0);\n+------------------------------------------------------------------+\n| SHA2(\'Maria\',0) |\n+------------------------------------------------------------------+\n|\n9ff18ebe7449349f358e3af0b57cf7a032c1c6b2272cb2656ff85eb112232f16\n|\n+------------------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/sha2/','','https://mariadb.com/kb/en/sha2/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (148,12,'UNCOMPRESS','Syntax\n------ \nUNCOMPRESS(string_to_uncompress)\n \nDescription\n----------- \nUncompresses a string compressed by the COMPRESS() function.\nIf the\nargument is not a compressed value, the result is NULL. This\nfunction\nrequires MariaDB to have been compiled with a compression\nlibrary such\nas zlib. Otherwise, the return value is always NULL. The\nhave_compress server system variable indicates whether a\ncompression library is present. \n \nExamples\n-------- \nSELECT UNCOMPRESS(COMPRESS(\'a string\'));\n+----------------------------------+\n| UNCOMPRESS(COMPRESS(\'a string\')) |\n+----------------------------------+\n| a string |\n+----------------------------------+\n \nSELECT UNCOMPRESS(\'a string\');\n+------------------------+\n| UNCOMPRESS(\'a string\') |\n+------------------------+\n| NULL |\n+------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/uncompress/','','https://mariadb.com/kb/en/uncompress/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (149,12,'UNCOMPRESSED_LENGTH','Syntax\n------ \nUNCOMPRESSED_LENGTH(compressed_string)\n \nDescription\n----------- \nReturns the length that the compressed string had before\nbeing\ncompressed with COMPRESS().\n \nUNCOMPRESSED_LENGTH() returns NULL or an incorrect result if\nthe string is not compressed.\n \nUntil MariaDB 10.3.1, returns MYSQL_TYPE_LONGLONG, or\nbigint(10), in all cases. From MariaDB 10.3.1, returns\nMYSQL_TYPE_LONG, or int(10), when the result would fit\nwithin 32-bits.\n \nExamples\n-------- \nSELECT UNCOMPRESSED_LENGTH(COMPRESS(REPEAT(\'a\',30)));\n+-----------------------------------------------+\n| UNCOMPRESSED_LENGTH(COMPRESS(REPEAT(\'a\',30))) |\n+-----------------------------------------------+\n| 30 |\n+-----------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/uncompressed_length/','','https://mariadb.com/kb/en/uncompressed_length/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (150,13,'ENDPOINT','A synonym for ST_ENDPOINT.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/linestring-properties-endpoint/','','https://mariadb.com/kb/en/linestring-properties-endpoint/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (151,13,'GLENGTH','Syntax\n------ \nGLength(ls)\n \nDescription\n----------- \nReturns as a double-precision number the length of the\nLineString value ls in its associated spatial reference.\n \nExamples\n-------- \nSET @ls = \'LineString(1 1,2 2,3 3)\';\n \nSELECT GLength(GeomFromText(@ls));\n+----------------------------+\n| GLength(GeomFromText(@ls)) |\n+----------------------------+\n| 2.82842712474619 |\n+----------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/glength/','','https://mariadb.com/kb/en/glength/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (152,13,'NumPoints','A synonym for ST_NumPoints.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/linestring-properties-numpoints/','','https://mariadb.com/kb/en/linestring-properties-numpoints/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (153,13,'PointN','A synonym for ST_PointN.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/linestring-properties-pointn/','','https://mariadb.com/kb/en/linestring-properties-pointn/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (154,13,'STARTPOINT','A synonym for ST_STARTPOINT.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/linestring-properties-startpoint/','','https://mariadb.com/kb/en/linestring-properties-startpoint/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (155,13,'ST_ENDPOINT','Syntax\n------ \nST_EndPoint(ls)\nEndPoint(ls)\n \nDescription\n----------- \nReturns the Point that is the endpoint of the\nLineString value ls.\n \nST_EndPoint() and EndPoint() are synonyms.\n \nExamples\n-------- \nSET @ls = \'LineString(1 1,2 2,3 3)\';\n \nSELECT AsText(EndPoint(GeomFromText(@ls)));\n+-------------------------------------+\n| AsText(EndPoint(GeomFromText(@ls))) |\n+-------------------------------------+\n| POINT(3 3) |\n+-------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_endpoint/','','https://mariadb.com/kb/en/st_endpoint/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (156,13,'ST_NUMPOINTS','Syntax\n------ \nST_NumPoints(ls)\nNumPoints(ls)\n \nDescription\n----------- \nReturns the number of Point objects in the LineString\nvalue ls.\n \nST_NumPoints() and NumPoints() are synonyms.\n \nExamples\n-------- \nSET @ls = \'LineString(1 1,2 2,3 3)\';\n \nSELECT NumPoints(GeomFromText(@ls));\n+------------------------------+\n| NumPoints(GeomFromText(@ls)) |\n+------------------------------+\n| 3 |\n+------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_numpoints/','','https://mariadb.com/kb/en/st_numpoints/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (157,13,'ST_POINTN','Syntax\n------ \nST_PointN(ls,N)\nPointN(ls,N)\n \nDescription\n----------- \nReturns the N-th Point in the LineString value ls.\nPoints are numbered beginning with 1.\n \nST_PointN() and PointN() are synonyms.\n \nExamples\n-------- \nSET @ls = \'LineString(1 1,2 2,3 3)\';\n \nSELECT AsText(PointN(GeomFromText(@ls),2));\n+-------------------------------------+\n| AsText(PointN(GeomFromText(@ls),2)) |\n+-------------------------------------+\n| POINT(2 2) |\n+-------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_pointn/','','https://mariadb.com/kb/en/st_pointn/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (158,14,'GET_LOCK','Syntax\n------ \nGET_LOCK(str,timeout)\n \nDescription\n----------- \nTries to obtain a lock with a name given by the string str,\nusing a timeout of timeout seconds. Returns 1 if the lock\nwas obtained successfully, 0 if the attempt timed out (for\nexample, because another client has previously locked the\nname), or NULL if an error occurred (such as running out of\nmemory or the thread was killed with mysqladmin kill).\n \nA lock is released with RELEASE_LOCK(), when the connection\nterminates (either normally or abnormally), or before\nMariaDB 10.0.2, when the connection executes another\nGET_LOCK statement. From MariaDB 10.0.2, a connection can\nhold multiple locks at the same time, so a lock that is no\nlonger needed needs to be explicitly released.\n \nThe IS_FREE_LOCK function returns whether a specified lock a\nfree or not, and the IS_USED_LOCK whether the function is in\nuse or not.\n \nLocks obtained with GET_LOCK() do not interact with\ntransactions. That is, committing a transaction does not\nrelease any such locks obtained during the transaction.\n \nFrom MariaDB 10.0.2, it is also possible to recursively set\nthe same lock. If a lock with the same name is set n times,\nit needs to be released n times as well. \n \nstr is case insensitive for GET_LOCK() and related\nfunctions. If str is an empty string or NULL, GET_LOCK()\nreturns NULL and does nothing. From MariaDB 10.2.2, timeout\nsupports microseconds. Before then, it was rounded to the\nclosest integer.\n \nIf the metadata_lock_info plugin is installed, locks\nacquired with this function are visible in the Information\nSchema METADATA_LOCK_INFO table.\n \nThis function can be used to implement application locks or\nto simulate record locks. Names are locked on a server-wide\nbasis. If a name has been locked by one client, GET_LOCK()\nblocks any request by another client for a lock with the\nsame name. This allows clients that agree on a given lock\nname to use the name to perform cooperative advisory\nlocking. But be aware that it also allows a client that is\nnot among the set of cooperating clients to lock a name,\neither inadvertently or deliberately, and thus prevent any\nof the cooperating clients from locking that name. One way\nto reduce the likelihood of this is to use lock names that\nare database-specific or application-specific. For example,\nuse lock names of the form db_name.str or app_name.str.\n \nStatements using the GET_LOCK() function are not safe for\nreplication.\n \nThe patch to permit multiple locks was contributed by\nKonstantin \"Kostja\" Osipov (MDEV-3917).\n \nExamples\n-------- \nSELECT GET_LOCK(\'lock1\',10);\n+----------------------+\n| GET_LOCK(\'lock1\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nSELECT IS_FREE_LOCK(\'lock1\'), IS_USED_LOCK(\'lock1\');\n+-----------------------+-----------------------+\n| IS_FREE_LOCK(\'lock1\') | IS_USED_LOCK(\'lock1\') |\n+-----------------------+-----------------------+\n| 0 | 46 |\n+-----------------------+-----------------------+\n \nSELECT IS_FREE_LOCK(\'lock2\'), IS_USED_LOCK(\'lock2\');\n+-----------------------+-----------------------+\n| IS_FREE_LOCK(\'lock2\') | IS_USED_LOCK(\'lock2\') |\n+-----------------------+-----------------------+\n| 1 | NULL |\n+-----------------------+-----------------------+\n \nFrom MariaDB 10.0.2, multiple locks can be held:\n \nSELECT GET_LOCK(\'lock2\',10);\n+----------------------+\n| GET_LOCK(\'lock2\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nSELECT IS_FREE_LOCK(\'lock1\'), IS_FREE_LOCK(\'lock2\');\n+-----------------------+-----------------------+\n| IS_FREE_LOCK(\'lock1\') | IS_FREE_LOCK(\'lock2\') |\n+-----------------------+-----------------------+\n| 0 | 0 |\n+-----------------------+-----------------------+\n \nSELECT RELEASE_LOCK(\'lock1\'), RELEASE_LOCK(\'lock2\');\n+-----------------------+-----------------------+\n| RELEASE_LOCK(\'lock1\') | RELEASE_LOCK(\'lock2\') |\n+-----------------------+-----------------------+\n| 1 | 1 |\n+-----------------------+-----------------------+\n \nBefore MariaDB 10.0.2, a connection could only hold a single\nlock:\n \nSELECT GET_LOCK(\'lock2\',10);\n+----------------------+\n| GET_LOCK(\'lock2\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nSELECT IS_FREE_LOCK(\'lock1\'), IS_FREE_LOCK(\'lock2\');\n+-----------------------+-----------------------+\n| IS_FREE_LOCK(\'lock1\') | IS_FREE_LOCK(\'lock2\') |\n+-----------------------+-----------------------+\n| 1 | 0 |\n+-----------------------+-----------------------+\n \nSELECT RELEASE_LOCK(\'lock1\'), RELEASE_LOCK(\'lock2\');\n+-----------------------+-----------------------+\n| RELEASE_LOCK(\'lock1\') | RELEASE_LOCK(\'lock2\') |\n+-----------------------+-----------------------+\n| NULL | 1 |\n+-----------------------+-----------------------+\n \nFrom MariaDB 10.0.2, it is possible to hold the same lock\nrecursively. This example is viewed using the\nmetadata_lock_info plugin:\n \nSELECT GET_LOCK(\'lock3\',10);\n+----------------------+\n| GET_LOCK(\'lock3\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nSELECT GET_LOCK(\'lock3\',10);\n+----------------------+\n| GET_LOCK(\'lock3\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nSELECT * FROM INFORMATION_SCHEMA.METADATA_LOCK_INFO;\n \n+-----------+---------------------+---------------+-----------+--------------+------------+\n| THREAD_ID | LOCK_MODE | LOCK_DURATION | LOCK_TYPE |\nTABLE_SCHEMA | TABLE_NAME |\n+-----------+---------------------+---------------+-----------+--------------+------------+\n| 46 | MDL_SHARED_NO_WRITE | NULL | User lock | lock3 | |\n+-----------+---------------------+---------------+-----------+--------------+------------+\n \nSELECT RELEASE_LOCK(\'lock3\');\n+-----------------------+\n| RELEASE_LOCK(\'lock3\') |\n+-----------------------+\n| 1 |\n+-----------------------+\n \nSELECT * FROM INFORMATION_SCHEMA.METADATA_LOCK_INFO;\n \n+-----------+---------------------+---------------+-----------+--------------+------------+\n| THREAD_ID | LOCK_MODE | LOCK_DURATION | LOCK_TYPE |\nTABLE_SCHEMA | TABLE_NAME |\n+-----------+---------------------+---------------+-----------+--------------+------------+\n| 46 | MDL_SHARED_NO_WRITE | NULL | User lock | lock3 | |\n+-----------+---------------------+---------------+-----------+--------------+------------+\n \nSELECT RELEASE_LOCK(\'lock3\');\n+-----------------------+\n| RELEASE_LOCK(\'lock3\') |\n+-----------------------+\n| 1 |\n+-----------------------+\n \nSELECT * FROM INFORMATION_SCHEMA.METADATA_LOCK_INFO;\n \nEmpty set (0.000 sec)\n \nTimeout example: Connection 1:\n \nSELECT GET_LOCK(\'lock4\',10);\n+----------------------+\n| GET_LOCK(\'lock4\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nConnection 2:\n \nSELECT GET_LOCK(\'lock4\',10);\n \nAfter 10 seconds...\n \n+----------------------+\n| GET_LOCK(\'lock4\',10) |\n+----------------------+\n| 0 |\n+----------------------+\n \nDeadlocks are automatically detected and resolved.\nConnection 1:\n \nSELECT GET_LOCK(\'lock5\',10); \n+----------------------+\n| GET_LOCK(\'lock5\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nConnection 2:\n \nSELECT GET_LOCK(\'lock6\',10);\n+----------------------+\n| GET_LOCK(\'lock6\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nConnection 1:\n \nSELECT GET_LOCK(\'lock6\',10); \n+----------------------+\n| GET_LOCK(\'lock6\',10) |\n+----------------------+\n| 0 |\n+----------------------+\n \nConnection 2:\n \nSELECT GET_LOCK(\'lock5\',10);\nERROR 1213 (40001): Deadlock found when trying to get lock;\n try restarting transaction\n \n\n\nURL: https://mariadb.com/kb/en/get_lock/','','https://mariadb.com/kb/en/get_lock/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (159,14,'INET6_ATON','INET6_ATON() has been available since MariaDB 10.0.12.\n \nSyntax\n------ \nINET6_ATON(expr)\n \nDescription\n----------- \nGiven an IPv6 or IPv4 network address as a string, returns a\nbinary string that represents the numeric value of the\naddress.\n \nNo trailing zone ID\'s or traling network masks are\npermitted. For IPv4 addresses, or IPv6 addresses with IPv4\naddress parts, no classful addresses or trailing port\nnumbers are permitted and octal numbers are not supported.\n \nThe returned binary string will be VARBINARY(16) or\nVARBINARY(4) for IPv6 and IPv4 addresses respectively.\n \nReturns NULL if the argument is not understood.\n \nExamples\n-------- \nSELECT HEX(INET6_ATON(\'10.0.1.1\'));\n+-----------------------------+\n| HEX(INET6_ATON(\'10.0.1.1\')) |\n+-----------------------------+\n| 0A000101 |\n+-----------------------------+\n \nSELECT HEX(INET6_ATON(\'48f3::d432:1431:ba23:846f\'));\n+----------------------------------------------+\n| HEX(INET6_ATON(\'48f3::d432:1431:ba23:846f\')) |\n+----------------------------------------------+\n| 48F3000000000000D4321431BA23846F |\n+----------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/inet6_aton/','','https://mariadb.com/kb/en/inet6_aton/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (160,14,'INET6_NTOA','INET6_NTOA() has been available from MariaDB 10.0.12.\n \nSyntax\n------ \nINET6_NTOA(expr)\n \nDescription\n----------- \nGiven an IPv6 or IPv4 network address as a numeric binary\nstring, returns the address as a nonbinary string in the\nconnection character set.\n \nThe return string is lowercase, and is platform independent,\nsince it does not use functions specific to the operating\nsystem. It has a maximum length of 39 characters.\n \nReturns NULL if the argument is not understood.\n \nExamples\n-------- \nSELECT INET6_NTOA(UNHEX(\'0A000101\'));\n+-------------------------------+\n| INET6_NTOA(UNHEX(\'0A000101\')) |\n+-------------------------------+\n| 10.0.1.1 |\n+-------------------------------+\n \nSELECT\nINET6_NTOA(UNHEX(\'48F3000000000000D4321431BA23846F\'));\n+-------------------------------------------------------+\n| INET6_NTOA(UNHEX(\'48F3000000000000D4321431BA23846F\')) |\n+-------------------------------------------------------+\n| 48f3::d432:1431:ba23:846f |\n+-------------------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/inet6_ntoa/','','https://mariadb.com/kb/en/inet6_ntoa/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (161,14,'INET_ATON','Syntax\n------ \nINET_ATON(expr)\n \nDescription\n----------- \nGiven the dotted-quad representation of an IPv4 network\naddress as a string,\nreturns an integer that represents the numeric value of the\naddress.\nAddresses may be 4- or 8-byte addresses.\n \nReturns NULL if the argument is not understood.\n \nExamples\n-------- \nSELECT INET_ATON(\'192.168.1.1\');\n+--------------------------+\n| INET_ATON(\'192.168.1.1\') |\n+--------------------------+\n| 3232235777 |\n+--------------------------+\n \nThis is calculated as follows: 192 x 2563 + 168 x 256 2 + 1\nx 256 + 1\n \n\n\nURL: https://mariadb.com/kb/en/inet_aton/','','https://mariadb.com/kb/en/inet_aton/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (162,14,'INET_NTOA','Syntax\n------ \nINET_NTOA(expr)\n \nDescription\n----------- \nGiven a numeric IPv4 network address in network byte order\n(4 or 8 byte),\nreturns the dotted-quad representation of the address as a\nstring.\n \nExamples\n-------- \nSELECT INET_NTOA(3232235777);\n+-----------------------+\n| INET_NTOA(3232235777) |\n+-----------------------+\n| 192.168.1.1 |\n+-----------------------+\n \n192.168.1.1 corresponds to 3232235777 since 192 x 2563 + 168\nx 256 2 + 1 x 256 + 1 = 3232235777\n \n\n\nURL: https://mariadb.com/kb/en/inet_ntoa/','','https://mariadb.com/kb/en/inet_ntoa/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (163,14,'IS_FREE_LOCK','Syntax\n------ \nIS_FREE_LOCK(str)\n \nDescription\n----------- \nChecks whether the lock named str is free to use (that is,\nnot locked).\nReturns 1 if the lock is free (no one is using the lock),\n 0 if the lock is in use, and NULL if an\nerror occurs (such as an incorrect argument, like an empty\nstring or NULL). str is case insensitive.\n \nIf the metadata_lock_info plugin is installed, the\nInformation Schema metadata_lock_info table contains\ninformation about locks of this kind (as well as metadata\nlocks).\n \nStatements using the IS_FREE_LOCK() function are not safe\nfor replication.\n \n\n\nURL: https://mariadb.com/kb/en/is_free_lock/','','https://mariadb.com/kb/en/is_free_lock/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (164,14,'IS_IPV4','IS_IPV4() has been available since MariaDB 10.0.12.\n \nSyntax\n------ \nIS_IPV4(expr)\n \nDescription\n----------- \nIf the expression is a valid IPv4 address, returns 1,\notherwise returns 0.\n \nIS_IPV4() is stricter than INET_ATON(), but as strict as\nINET6_ATON(), in determining the validity of an IPv4\naddress. This implies that if IS_IPV4 returns 1, the same\nexpression will always return a non-NULL result when passed\nto INET_ATON(), but that the reverse may not apply.\n \nExamples\n-------- \nSELECT IS_IPV4(\'1110.0.1.1\');\n+-----------------------+\n| IS_IPV4(\'1110.0.1.1\') |\n+-----------------------+\n| 0 |\n+-----------------------+\n \nSELECT IS_IPV4(\'48f3::d432:1431:ba23:846f\');\n+--------------------------------------+\n| IS_IPV4(\'48f3::d432:1431:ba23:846f\') |\n+--------------------------------------+\n| 0 |\n+--------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/is_ipv4/','','https://mariadb.com/kb/en/is_ipv4/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (165,14,'IS_IPV4_COMPAT','IS_IPV4_COMPAT() has been available since MariaDB 10.0.12.\n \nSyntax\n------ \nIS_IPV4_COMPAT(expr)\n \nDescription\n----------- \nReturns 1 if a given numeric binary string IPv6 address,\nsuch as returned by INET6_ATON(), is IPv4-compatible,\notherwise returns 0. \n \nExamples\n-------- \nSELECT IS_IPV4_COMPAT(INET6_ATON(\'::10.0.1.1\'));\n+------------------------------------------+\n| IS_IPV4_COMPAT(INET6_ATON(\'::10.0.1.1\')) |\n+------------------------------------------+\n| 1 |\n+------------------------------------------+\n \nSELECT\nIS_IPV4_COMPAT(INET6_ATON(\'::48f3::d432:1431:ba23:846f\'));\n+-----------------------------------------------------------+\n|\nIS_IPV4_COMPAT(INET6_ATON(\'::48f3::d432:1431:ba23:846f\'))\n|\n+-----------------------------------------------------------+\n| 0 |\n+-----------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/is_ipv4_compat/','','https://mariadb.com/kb/en/is_ipv4_compat/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (166,14,'IS_IPV4_MAPPED','IS_IPV4_MAPPED() has been available since MariaDB 10.0.12.\n \nSyntax\n------ \nIS_IPV4_MAPPED(expr)\n \nDescription\n----------- \nReturns 1 if a given a numeric binary string IPv6 address,\nsuch as returned by INET6_ATON(), is a valid IPv4-mapped\naddress, otherwise returns 0.\n \nExamples\n-------- \nSELECT IS_IPV4_MAPPED(INET6_ATON(\'::10.0.1.1\'));\n+------------------------------------------+\n| IS_IPV4_MAPPED(INET6_ATON(\'::10.0.1.1\')) |\n+------------------------------------------+\n| 0 |\n+------------------------------------------+\n \nSELECT IS_IPV4_MAPPED(INET6_ATON(\'::ffff:10.0.1.1\'));\n+-----------------------------------------------+\n| IS_IPV4_MAPPED(INET6_ATON(\'::ffff:10.0.1.1\')) |\n+-----------------------------------------------+\n| 1 |\n+-----------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/is_ipv4_mapped/','','https://mariadb.com/kb/en/is_ipv4_mapped/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (167,14,'IS_IPV6','IS_IPV6() has been available since MariaDB 10.0.12.\n \nSyntax\n------ \nIS_IPV6(expr)\n \nDescription\n----------- \nReturns 1 if the expression is a valid IPv6 address\nspecified as a string, otherwise returns 0. Does not\nconsider IPv4 addresses to be valid IPv6 addresses.\n \nExamples\n-------- \n SELECT IS_IPV6(\'48f3::d432:1431:ba23:846f\');\n+--------------------------------------+\n| IS_IPV6(\'48f3::d432:1431:ba23:846f\') |\n+--------------------------------------+\n| 1 |\n+--------------------------------------+\n1 row in set (0.02 sec)\n \nSELECT IS_IPV6(\'10.0.1.1\');\n+---------------------+\n| IS_IPV6(\'10.0.1.1\') |\n+---------------------+\n| 0 |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/is_ipv6/','','https://mariadb.com/kb/en/is_ipv6/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (168,14,'IS_USED_LOCK','Syntax\n------ \nIS_USED_LOCK(str)\n \nDescription\n----------- \nChecks whether the lock named str is in use (that is,\nlocked). If so,\nit returns the connection identifier of the client that\nholds the\nlock. Otherwise, it returns NULL. str is case insensitive.\n \nIf the metadata_lock_info plugin is installed, the\nInformation Schema metadata_lock_info table contains\ninformation about locks of this kind (as well as metadata\nlocks).\n \nStatements using the IS_USED_LOCK() function are not safe\nfor replication.\n \n\n\nURL: https://mariadb.com/kb/en/is_used_lock/','','https://mariadb.com/kb/en/is_used_lock/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (169,14,'MASTER_GTID_WAIT','MASTER_GTID_WAIT() was included in MariaDB 10.0.9.\n \nSyntax\n------ \nMASTER_GTID_WAIT(gtid-list[, timeout)\n \nDescription\n----------- \nThis function takes a string containing a comma-separated\nlist of global transaction id\'s\n(similar to the value of, for example, gtid_binlog_pos). It\nwaits until the value of gtid_slave_pos has the same or\nhigher seq_no within all replication domains specified in\nthe gtid-list; in other words, it waits until the slave has\nreached the specified GTID position.\n \nAn optional second argument gives a timeout in seconds. If\nthe timeout\nexpires before the specified GTID position is reached, then\nthe function\nreturns -1. Passing NULL or a negative number for the\ntimeout means no timeout, and the function will wait\nindefinitely.\n \n If the wait completes without a timeout, 0 is returned.\nPassing NULL for the\n gtid-list makes the function return NULL immediately,\nwithout waiting.\n \nThe gtid-list may be the empty string, in which case\nMASTER_GTID_WAIT()\nreturns immediately. If the gtid-list contains fewer domains\nthan\ngtid_slave_pos, then only those domains are waited upon. If\ngtid-list\ncontains a domain that is not present in @@gtid_slave_pos,\nthen\nMASTER_GTID_WAIT() will wait until an event containing such\ndomain_id arrives\non the slave (or until timed out or killed).\n \nMASTER_GTID_WAIT() can be useful to ensure that a slave has\ncaught up to\na master. Simply take the value of gtid_binlog_pos on the\nmaster, and use it in a MASTER_GTID_WAIT() call on the\nslave; when the call completes, the slave\nwill have caught up with that master position.\n \nMASTER_GTID_WAIT() can also be used in client applications\ntogether with the\nlast_gtid session variable. This is useful in a\nread-scaleout replication setup, where the application\nwrites to a single master but divides the\nreads out to a number of slaves to distribute the load. In\nsuch a setup, there\nis a risk that an application could first do an update on\nthe master, and then\na bit later do a read on a slave, and if the slave is not\nfast enough, the\ndata read from the slave might not include the update just\nmade, possibly\nconfusing the application and/or the end-user. One way to\navoid this is to\nrequest the value of last_gtid on the master just after the\nupdate. Then\nbefore doing the read on the slave, do a MASTER_GTID_WAIT()\non the value\nobtained from the master; this will ensure that the read is\nnot performed\nuntil the slave has replicated sufficiently far for the\nupdate to have become\nvisible.\n \nNote that MASTER_GTID_WAIT() can be used even if the slave\nis configured not\nto use GTID for connections (CHANGE MASTER TO\nmaster_use_gtid=no). This is\nbecause from MariaDB 10, GTIDs are always logged on the\nmaster server, and\nalways recorded on the slave servers.\n \nDifferences to MASTER_POS_WAIT()\n \nMASTER_GTID_WAIT() is global; it waits for any master\nconnection to reach\n the specified GTID position. MASTER_POS_WAIT() works only\nagainst a\n specific connection. This also means that while\nMASTER_POS_WAIT() aborts if\n its master connection is terminated with STOP SLAVE or due\nto an error,\n MASTER_GTID_WAIT() continues to wait while slaves are\nstopped.\n \nMASTER_GTID_WAIT() can take its timeout as a floating-point\nvalue, so a\n timeout in fractional seconds is supported, eg.\nMASTER_GTID_WAIT(\"0-1-100\",\n 0.5). (The minimum wait is one microsecond, 0.000001\nseconds).\n \nMASTER_GTID_WAIT() allows one to specify a timeout of zero\nin order to do a\n non-blocking check to see if the slaves have progressed to\na specific GTID position\n (MASTER_POS_WAIT() takes a zero timeout as meaning an\ninfinite wait). To do\n an infinite MASTER_GTID_WAIT(), specify a negative timeout,\nor omit the\n timeout argument.\n \nMASTER_GTID_WAIT() does not return the number of events\nexecuted since the\n wait started, nor does it return NULL if a slave thread is\nstopped. It\n always returns either 0 for successful wait completed, or\n-1 for timeout\n reached (or NULL if the specified gtid-pos is NULL).\n \nSince MASTER_GTID_WAIT() looks only at the seq_no part of\nthe GTIDs, not the\nserver_id, care is needed if a slave becomes diverged from\nanother server so\nthat two different GTIDs with the same seq_no (in the same\ndomain) arrive at\nthe same server. This situation is in any case best avoided;\nsetting\ngtid_strict_mode is recommended, as this will prevent any\nsuch out-of-order sequence numbers from ever being\nreplicated on a slave.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/master_gtid_wait/','','https://mariadb.com/kb/en/master_gtid_wait/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (170,14,'MASTER_POS_WAIT','MASTER_POS_WAIT was introduced in MariaDB 10.0.9.\n \nSyntax\n------ \nMASTER_POS_WAIT(log_name,log_pos[,timeout,[\"connection_name\"]])\n \nDescription\n----------- \nThis function is useful in replication for controlling\nmaster/slave synchronization. It blocks until the slave has\nread and applied all updates up to the specified position\n(log_name,log_pos) in the master log. The return value is\nthe number of log events the slave had to wait for to\nadvance to the specified position. The function returns NULL\nif\nthe slave SQL thread is not started, the slave\'s master\ninformation is not\ninitialized, the arguments are incorrect, or an error\noccurs. It returns -1 if\nthe timeout has been exceeded. If the slave SQL thread stops\nwhile\n MASTER_POS_WAIT() is waiting, the function returns NULL. If\nthe slave is past the specified position, the function\nreturns immediately.\n \nIf a timeout value is specified, MASTER_POS_WAIT() stops\nwaiting when timeout seconds have elapsed. timeout must be\ngreater than 0; a\nzero or negative timeout means no timeout.\n \nThe connection_name is used when you are using\nmulti-source-replication. If you don\'t specify it, it\'s\nset to the value of the default_master_connection system\nvariable.\n \nStatements using the MASTER_POS_WAIT() function are not safe\nfor replication.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/master_pos_wait/','','https://mariadb.com/kb/en/master_pos_wait/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (171,14,'NAME_CONST','Syntax\n------ \nNAME_CONST(name,value)\n \nDescription\n----------- \nReturns the given value. When used to produce a result set\ncolumn,\n NAME_CONST() causes the column to have the given name. The\narguments should be constants.\n \nThis function is used internally when replicating stored\nprocedures. It makes little sense to use it explicitly in\nSQL statements, and it was not supposed to be used like\nthat.\n \nSELECT NAME_CONST(\'myname\', 14);\n+--------+\n| myname |\n+--------+\n| 14 |\n+--------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/name_const/','','https://mariadb.com/kb/en/name_const/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (172,14,'RELEASE_LOCK','Syntax\n------ \nRELEASE_LOCK(str)\n \nDescription\n----------- \nReleases the lock named by the string str that was obtained\nwith GET_LOCK(). Returns 1 if the lock was released, 0 if\nthe lock was not established by this thread (in which case\nthe lock is not\nreleased), and NULL if the named lock did not exist. The\nlock does not exist if it was never obtained by a call to\nGET_LOCK() or if it has previously been released.\n \nMariaDB until 10.0.1\n \nBefore 10.0.2, GET_LOCK() released the existing lock, if\nany. Since 10.0.2 this does not happen, because multiple\nlocks are allowed.\n \nstr is case insensitive. If str is an empty string or NULL,\nRELEASE_LOCK() returns NULL and does nothing.\n \nStatements using the RELEASE_LOCK() function are not safe\nfor replication.\n \nThe DO statement is convenient to use with RELEASE_LOCK().\n \nExamples\n-------- \nConnection1:\n \nSELECT GET_LOCK(\'lock1\',10);\n+----------------------+\n| GET_LOCK(\'lock1\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nConnection 2:\n \nSELECT GET_LOCK(\'lock2\',10);\n+----------------------+\n| GET_LOCK(\'lock2\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nConnection 1:\n \nSELECT RELEASE_LOCK(\'lock1\'), RELEASE_LOCK(\'lock2\'),\nRELEASE_LOCK(\'lock3\');\n+-----------------------+-----------------------+-----------------------+\n| RELEASE_LOCK(\'lock1\') | RELEASE_LOCK(\'lock2\') |\nRELEASE_LOCK(\'lock3\') |\n+-----------------------+-----------------------+-----------------------+\n| 1 | 0 | NULL |\n+-----------------------+-----------------------+-----------------------+\n \nFrom MariaDB 10.0.2, it is possible to hold the same lock\nrecursively. This example is viewed using the\nmetadata_lock_info plugin:\n \nSELECT GET_LOCK(\'lock3\',10);\n+----------------------+\n| GET_LOCK(\'lock3\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nSELECT GET_LOCK(\'lock3\',10);\n+----------------------+\n| GET_LOCK(\'lock3\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nSELECT * FROM INFORMATION_SCHEMA.METADATA_LOCK_INFO;\n \n+-----------+---------------------+---------------+-----------+--------------+------------+\n| THREAD_ID | LOCK_MODE | LOCK_DURATION | LOCK_TYPE |\nTABLE_SCHEMA | TABLE_NAME |\n+-----------+---------------------+---------------+-----------+--------------+------------+\n| 46 | MDL_SHARED_NO_WRITE | NULL | User lock | lock3 | |\n+-----------+---------------------+---------------+-----------+--------------+------------+\n \nSELECT RELEASE_LOCK(\'lock3\');\n+-----------------------+\n| RELEASE_LOCK(\'lock3\') |\n+-----------------------+\n| 1 |\n+-----------------------+\n \nSELECT * FROM INFORMATION_SCHEMA.METADATA_LOCK_INFO;\n \n+-----------+---------------------+---------------+-----------+--------------+------------+\n| THREAD_ID | LOCK_MODE | LOCK_DURATION | LOCK_TYPE |\nTABLE_SCHEMA | TABLE_NAME |\n+-----------+---------------------+---------------+-----------+--------------+------------+\n| 46 | MDL_SHARED_NO_WRITE | NULL | User lock | lock3 | |\n+-----------+---------------------+---------------+-----------+--------------+------------+\n \nSELECT RELEASE_LOCK(\'lock3\');\n+-----------------------+\n| RELEASE_LOCK(\'lock3\') |\n+-----------------------+\n| 1 |\n+-----------------------+\n \nSELECT * FROM INFORMATION_SCHEMA.METADATA_LOCK_INFO;\n \nEmpty set (0.000 sec)\n \n\n\nURL: https://mariadb.com/kb/en/release_lock/','','https://mariadb.com/kb/en/release_lock/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (173,14,'SLEEP','Syntax\n------ \nSLEEP(duration)\n \nDescription\n----------- \nSleeps (pauses) for the number of seconds given by the\nduration argument, then\nreturns 0. If SLEEP() is interrupted, it\nreturns 1. The duration may have a fractional part given in\nmicroseconds.\n \nStatements using the SLEEP() function are not safe for\nreplication.\n \nExample\n \nSELECT SLEEP(5.5);\n+------------+\n| SLEEP(5.5) |\n+------------+\n| 0 |\n+------------+\n1 row in set (5.50 sec)\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/sleep/','','https://mariadb.com/kb/en/sleep/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (174,14,'UUID','Syntax\n------ \nUUID()\n \nDescription\n----------- \nReturns a Universal Unique Identifier (UUID) generated\naccording to \"DCE 1.1:\nRemote Procedure Call\" (Appendix A) CAE (Common\nApplications Environment)\nSpecifications published by The Open Group in October\n1997 \n(Document Number C706).\n \nA UUID is designed as a number that is globally unique in\nspace and time. Two\ncalls to UUID() are expected to generate two different\nvalues, even if these calls are performed on two separate\ncomputers that are\nnot connected to each other.\n \nA UUID is a 128-bit number represented by a utf8 string of\nfive\nhexadecimal numbers in aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee\nformat:\nThe first three numbers are generated from a timestamp.\nThe fourth number preserves temporal uniqueness in case the\ntimestamp value\n loses monotonicity (for example, due to daylight saving\ntime).\nThe fifth number is an IEEE 802 node number that provides\nspatial uniqueness.\n A random number is substituted if the latter is not\navailable (for example,\n because the host computer has no Ethernet card, or we do\nnot know how to find\n the hardware address of an interface on your operating\nsystem). In this case,\n spatial uniqueness cannot be guaranteed. Nevertheless, a\ncollision should\n have very low probability.\n \nCurrently, the MAC address of an interface is taken into\naccount only on FreeBSD and Linux. On other operating\nsystems, MariaDB uses a randomly generated 48-bit number.\n \nStatements using the UUID() function are not safe for\nreplication.\n \nUUID() results are intended to be unique, but cannot always\nbe relied upon to unpredictable and unguessable, so should\nnot be relied upon for these purposes.\n \nExamples\n-------- \nSELECT UUID();\n+--------------------------------------+\n| UUID() |\n+--------------------------------------+\n| cd41294a-afb0-11df-bc9b-00241dd75637 |\n+--------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/uuid/','','https://mariadb.com/kb/en/uuid/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (175,14,'UUID_SHORT','Syntax\n------ \nUUID_SHORT()\n \nDescription\n----------- \nReturns a \"short\" universal identifier as a 64-bit\nunsigned integer (rather\nthan a string-form 128-bit identifier as returned by the\nUUID() function).\n \nThe value of UUID_SHORT() is guaranteed to be unique if the\nfollowing conditions hold:\nThe server_id of the current host is unique among your set\nof master and\n slave servers\nserver_id is between 0 and 255\nYou don\'t set back your system time for your server between\nmysqld restarts\nYou do not invoke UUID_SHORT() on average more than 16\n million times per second between mysqld restarts\n \nThe UUID_SHORT() return value is constructed this way:\n \n (server_id & 255) \n\nURL: https://mariadb.com/kb/en/uuid_short/','','https://mariadb.com/kb/en/uuid_short/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (176,14,'VALUES / VALUE','Syntax\n------ \nVALUE(col_name) \n \nMariaDB until 10.3.2\n \nVALUES(col_name) \n \nDescription\n----------- \nIn an INSERT ... ON DUPLICATE KEY UPDATE statement, you can\nuse the VALUES(col_name) function in the UPDATE clause to\nrefer to column values from the INSERT portion of the\nstatement. In other words, VALUES(col_name) in the UPDATE\nclause refers to the value of col_name that would be\ninserted, had no duplicate-key conflict occurred. This\nfunction is especially useful in multiple-row inserts.\n \nThe VALUES() function is meaningful only in INSERT ... ON\nDUPLICATE KEY UPDATE statements and returns NULL otherwise.\n \nIn MariaDB 10.3.3 this function was renamed to VALUE(),\nbecause it\'s incompatible with the standard Table Value\nConstructors syntax, implemented in MariaDB 10.3.3.\n \nThe VALUES() function can still be used even from MariaDB\n10.3.3, but only in INSERT ... ON DUPLICATE KEY UPDATE\nstatements; it\'s a syntax error otherwise.\n \nExamples\n-------- \nINSERT INTO t (a,b,c) VALUES (1,2,3),(4,5,6)\n ON DUPLICATE KEY UPDATE c=VALUE(a)+VALUE(b);\n \nMariaDB until 10.3.2\n \nINSERT INTO t (a,b,c) VALUES (1,2,3),(4,5,6)\n ON DUPLICATE KEY UPDATE c=VALUES(a)+VALUES(b);\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/values-value/','','https://mariadb.com/kb/en/values-value/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (177,15,'!','Syntax\n------ \nNOT, !\n \nDescription\n----------- \nLogical NOT. Evaluates to 1 if the operand is 0, to 0 if the\noperand\nis non-zero, and NOT NULL returns NULL.\n \nBy default, the ! operator has a higher precedence. If the\nHIGH_NOT_PRECEDENCE SQL_MODE flag is set, NOT and ! have the\nsame precedence.\n \nExamples\n-------- \nSELECT NOT 10;\n \n+--------+\n| NOT 10 |\n+--------+\n| 0 |\n+--------+\n \nSELECT NOT 0;\n \n+-------+\n| NOT 0 |\n+-------+\n| 1 |\n+-------+\n \nSELECT NOT NULL;\n \n+----------+\n| NOT NULL |\n+----------+\n| NULL |\n+----------+\n \nSELECT ! (1+1);\n+---------+\n| ! (1+1) |\n+---------+\n| 0 |\n+---------+\n \nSELECT ! 1+1;\n \n+-------+\n| ! 1+1 |\n+-------+\n| 1 |\n+-------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/not/','','https://mariadb.com/kb/en/not/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (178,15,'&amp;&amp;','Syntax\n------ \nAND, &&\n \nDescription\n----------- \nLogical AND. Evaluates to 1 if all operands are non-zero and\nnot NULL,\nto 0 if one or more operands are 0, otherwise NULL is\nreturned.\n \nFor this operator, short-circuit evaluation can be used.\n \nExamples\n-------- \nSELECT 1 && 1;\n \n+--------+\n| 1 && 1 |\n+--------+\n| 1 |\n+--------+\n \nSELECT 1 && 0;\n \n+--------+\n| 1 && 0 |\n+--------+\n| 0 |\n+--------+\n \nSELECT 1 && NULL;\n \n+-----------+\n| 1 && NULL |\n+-----------+\n| NULL |\n+-----------+\n \nSELECT 0 && NULL;\n \n+-----------+\n| 0 && NULL |\n+-----------+\n| 0 |\n+-----------+\n \nSELECT NULL && 0;\n \n+-----------+\n| NULL && 0 |\n+-----------+\n| 0 |\n+-----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/and/','','https://mariadb.com/kb/en/and/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (179,15,'||','Syntax\n------ \nOR, ||\n \nDescription\n----------- \nLogical OR. When both operands are non-NULL, the result is 1\nif any\noperand is non-zero, and 0 otherwise. With a NULL operand,\nthe result\nis 1 if the other operand is non-zero, and NULL otherwise.\nIf both\noperands are NULL, the result is NULL.\n \nFor this operator, short-circuit evaluation can be used.\n \nNote that, if the PIPES_AS_CONCAT SQL_MODE is set, || is\nused as a string concatenation operator. This means that a\n|| b is the same as CONCAT(a,b). See CONCAT() for details.\n \nOracle Mode\n \nIn Oracle mode from MariaDB 10.3, || ignores NULL.\n \nExamples\n-------- \nSELECT 1 || 1;\n \n+--------+\n| 1 || 1 |\n+--------+\n| 1 |\n+--------+\n \nSELECT 1 || 0;\n \n+--------+\n| 1 || 0 |\n+--------+\n| 1 |\n+--------+\n \nSELECT 0 || 0;\n \n+--------+\n| 0 || 0 |\n+--------+\n| 0 |\n+--------+\n \nSELECT 0 || NULL;\n \n+-----------+\n| 0 || NULL |\n+-----------+\n| NULL |\n+-----------+\n \nSELECT 1 || NULL;\n \n+-----------+\n| 1 || NULL |\n+-----------+\n| 1 |\n+-----------+\n \nIn Oracle mode, from MariaDB 10.3:\n \nSELECT 0 || NULL;\n \n+-----------+\n| 0 || NULL |\n+-----------+\n| 0 |\n+-----------+\n \n\n\nURL: https://mariadb.com/kb/en/or/','','https://mariadb.com/kb/en/or/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (180,15,'XOR','Syntax\n------ \nXOR\n \nDescription\n----------- \nXOR stands for eXclusive OR. Returns NULL if either operand\nis NULL. For non-NULL\noperands, evaluates to 1 if an odd number of operands is\nnon-zero,\notherwise 0 is returned.\n \nExamples\n-------- \nSELECT 1 XOR 1;\n \n+---------+\n| 1 XOR 1 |\n+---------+\n| 0 |\n+---------+\n \nSELECT 1 XOR 0;\n \n+---------+\n| 1 XOR 0 |\n+---------+\n| 1 |\n+---------+\n \nSELECT 1 XOR NULL;\n \n+------------+\n| 1 XOR NULL |\n+------------+\n| NULL |\n+------------+\n \nIn the following example, the right 1 XOR 1 is evaluated\nfirst, and returns 0. Then, 1 XOR 0 is evaluated, and 1 is\nreturned.\n \nSELECT 1 XOR 1 XOR 1;\n \n+---------------+\n| 1 XOR 1 XOR 1 |\n+---------------+\n| 1 |\n+---------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/xor/','','https://mariadb.com/kb/en/xor/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (181,15,'Assignment Operator (=)','Syntax\n------ \nidentifier = expr\n \nDescription\n----------- \nThe equal sign is used as both an assignment operator in\ncertain contexts, and as a comparison operator. When used as\nassignment operator, the value on the right is assigned to\nthe variable (or column, in some contexts) on the left.\n \nSince its use can be ambiguous, unlike the := assignment\noperator, the = assignment operator cannot be used in all\ncontexts, and is only valid as part of a SET statement, or\nthe SET clause of an UPDATE statement\n \nThis operator works with both user-defined variables and\nlocal variables.\n \nExamples\n-------- \nUPDATE table_name SET x = 2 WHERE x > 100;\n \nSET @x = 1, @y := 2;\n \n\n \n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/assignment-operators-assignment-operator/','','https://mariadb.com/kb/en/assignment-operators-assignment-operator/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (182,15,'Assignment Operator (:=)','Syntax\n------ \nvar_name := expr\n \nDescription\n----------- \nAssignment operator for assigning a value. The value on the\nright is assigned to the variable on left.\n \nUnlike the = operator, := can always be used to assign a\nvalue to a variable.\n \nThis operator works with both user-defined variables and\nlocal variables.\n \nWhen assigning the same value to several variables,\nLAST_VALUE() can be useful.\n \nExamples\n-------- \n SELECT @x := 10;\n \n+----------+\n| @x := 10 |\n+----------+\n| 10 |\n+----------+\n \nSELECT @x, @y := @x;\n \n+------+----------+\n| @x | @y := @x |\n+------+----------+\n| 10 | 10 |\n+------+----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/assignment-operator/','','https://mariadb.com/kb/en/assignment-operator/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (183,16,'Stored Aggregate Functions','The ability to create stored aggregate functions was added\nin MariaDB 10.3.3.\n \nAggregate functions are functions that are computed over a\nsequence of rows and return one result for the sequence of\nrows.\n \nCreating a custom aggregate function is done using the\nCREATE FUNCTION statement with two main differences:\nThe addition of the AGGREGATE keyword, so CREATE AGGREGATE\nFUNCTION\nThe FETCH GROUP NEXT ROW instruction inside the loop\nOracle PL/SQL compatibility using SQL/PL is provided\n \nStandard Syntax\n \nCREATE AGGREGATE FUNCTION function_name (parameters) RETURNS\nreturn_type\nBEGIN\n All types of declarations\n DECLARE CONTINUE HANDLER FOR NOT FOUND RETURN return_val;\n LOOP\n FETCH GROUP NEXT ROW; // fetches next row from table\n other instructions\n END LOOP;\nEND\n \nStored aggregate functions were a 2016 Google Summer of Code\nproject by Varun Gupta.\n \nUsing SQL/PL\n \nSET sql_mode=Oracle;\nDELIMITER //\n \nCREATE AGGREGATE FUNCTION function_name (parameters) RETURN\nreturn_type\n declarations\nBEGIN\n LOOP\n FETCH GROUP NEXT ROW; -- fetches next row from table\n -- other instructions\n \n END LOOP;\nEXCEPTION\n WHEN NO_DATA_FOUND THEN\n RETURN return_val;\nEND //\n \nDELIMITER ;\n \nExamples\n-------- \nFirst a simplified example:\n \nCREATE TABLE marks(stud_id INT, grade_count INT);\n \nINSERT INTO marks VALUES (1,6), (2,4), (3,7), (4,5), (5,8);\n \nSELECT * FROM marks;\n \n+---------+-------------+\n| stud_id | grade_count |\n+---------+-------------+\n| 1 | 6 |\n| 2 | 4 |\n| 3 | 7 |\n| 4 | 5 |\n| 5 | 8 |\n+---------+-------------+\n \nDELIMITER //\nCREATE AGGREGATE FUNCTION IF NOT EXISTS aggregate_count(x\nINT) RETURNS INT\nBEGIN\n DECLARE count_students INT DEFAULT 0;\n \n DECLARE CONTINUE HANDLER FOR NOT FOUND\n RETURN count_students;\n \n LOOP\n FETCH GROUP NEXT ROW;\n \n IF x THEN\n SET count_students = count_students+1;\n \n END IF;\n \n END LOOP;\n \nEND //\nDELIMITER ;\n \nA non-trivial example that cannot easily be rewritten using\nexisting functions:\n \nDELIMITER //\nCREATE AGGREGATE FUNCTION medi_int(x INT) RETURNS DOUBLE\nBEGIN\n DECLARE CONTINUE HANDLER FOR NOT FOUND\n BEGIN\n DECLARE res DOUBLE;\n \n DECLARE cnt INT DEFAULT (SELECT COUNT(*) FROM tt);\n DECLARE lim INT DEFAULT (cnt-1) DIV 2;\n \n IF cnt % 2 = 0 THEN\n SET res = (SELECT AVG(a) FROM (SELECT a FROM tt ORDER BY a\nLIMIT lim,2) ttt);\n ELSE\n SET res = (SELECT a FROM tt ORDER BY a LIMIT lim,1);\n END IF;\n \n DROP TEMPORARY TABLE tt;\n \n RETURN res;\n \n END;\n \n CREATE TEMPORARY TABLE tt (a INT);\n LOOP\n FETCH GROUP NEXT ROW;\n \n INSERT INTO tt VALUES (x);\n END LOOP;\n \nEND //\nDELIMITER ;\n \nSQL/PL Example\n \nThis uses the same marks table as created above.\n \nSET sql_mode=Oracle;\n \nDELIMITER //\n \nCREATE AGGREGATE FUNCTION aggregate_count(x INT) RETURN INT\nAS count_students INT DEFAULT 0;\n \nBEGIN\n LOOP\n FETCH GROUP NEXT ROW;\n \n IF x THEN\n SET count_students := count_students+1;\n \n END IF;\n \n END LOOP;\n \nEXCEPTION\n WHEN NO_DATA_FOUND THEN\n RETURN count_students;\n \nEND aggregate_count //\nDELIMITER ;\n \nSELECT aggregate_count(stud_id) FROM marks;\n \n\n\nURL: https://mariadb.com/kb/en/stored-aggregate-functions/','','https://mariadb.com/kb/en/stored-aggregate-functions/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (184,16,'AVG','Syntax\n------ \nAVG([DISTINCT] expr)\n \nDescription\n----------- \nReturns the average value of expr. The DISTINCT option can\nbe used to return the average of the distinct values of\nexpr. NULL values are ignored. It is an aggregate function,\nand so can be used with the GROUP BY clause.\n \nAVG() returns NULL if there were no matching rows.\n \nFrom MariaDB 10.2.0, AVG() can be used as a window function.\n \nExamples\n-------- \nCREATE TABLE sales (sales_value INT);\n \nINSERT INTO sales VALUES(10),(20),(20),(40);\n \nSELECT AVG(sales_value) FROM sales;\n \n+------------------+\n| AVG(sales_value) |\n+------------------+\n| 22.5000 |\n+------------------+\n \nSELECT AVG(DISTINCT(sales_value)) FROM sales;\n \n+----------------------------+\n| AVG(DISTINCT(sales_value)) |\n+----------------------------+\n| 23.3333 |\n+----------------------------+\n \nCommonly, AVG() is used with a GROUP BY clause:\n \nCREATE TABLE student (name CHAR(10), test CHAR(10), score\nTINYINT); \n \nINSERT INTO student VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87), (\'Tatiana\', \'Tuning\', 83);\n \nSELECT name, AVG(score) FROM student GROUP BY name;\n \n+---------+------------+\n| name | AVG(score) |\n+---------+------------+\n| Chun | 74.0000 |\n| Esben | 37.0000 |\n| Kaolin | 72.0000 |\n| Tatiana | 85.0000 |\n+---------+------------+\n \nBe careful to avoid this common mistake, not grouping\ncorrectly and returning mismatched data: \n \nSELECT name,test,AVG(score) FROM student;\n \n+------+------+------------+\n| name | test | MIN(score) |\n+------+------+------------+\n| Chun | SQL | 31 |\n+------+------+------------+\n \nAs a window function:\n \nCREATE TABLE student_test (name CHAR(10), test CHAR(10),\nscore TINYINT); \n \nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87), (\'Tatiana\', \'Tuning\', 83);\n \nSELECT name, test, score, AVG(score) OVER (PARTITION BY\ntest) \n AS average_by_test FROM student_test;\n \n+---------+--------+-------+-----------------+\n| name | test | score | average_by_test |\n+---------+--------+-------+-----------------+\n| Chun | SQL | 75 | 65.2500 |\n| Chun | Tuning | 73 | 68.7500 |\n| Esben | SQL | 43 | 65.2500 |\n| Esben | Tuning | 31 | 68.7500 |\n| Kaolin | SQL | 56 | 65.2500 |\n| Kaolin | Tuning | 88 | 68.7500 |\n| Tatiana | SQL | 87 | 65.2500 |\n| Tatiana | Tuning | 83 | 68.7500 |\n+---------+--------+-------+-----------------+\n \n\n\nURL: https://mariadb.com/kb/en/avg/','','https://mariadb.com/kb/en/avg/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (185,16,'BIT_AND','Syntax\n------ \nBIT_AND(expr)\n \nDescription\n----------- \nReturns the bitwise AND of all bits in expr. The calculation\nis performed with 64-bit (BIGINT) precision. It is an\naggregate function, and so can be used with the GROUP BY\nclause.\n \nFrom MariaDB 10.2.0, BIT_AND() can be used as a window\nfunction.\n \nExamples\n-------- \nCREATE TABLE vals (x INT);\n \nINSERT INTO vals VALUES(111),(110),(100);\n \nSELECT BIT_AND(x), BIT_OR(x), BIT_XOR(x) FROM vals;\n \n+------------+-----------+------------+\n| BIT_AND(x) | BIT_OR(x) | BIT_XOR(x) |\n+------------+-----------+------------+\n| 100 | 111 | 101 |\n+------------+-----------+------------+\n \nAs an aggregate function:\n \nCREATE TABLE vals2 (category VARCHAR(1), x INT);\n \nINSERT INTO vals2 VALUES\n (\'a\',111),(\'a\',110),(\'a\',100),\n (\'b\',\'000\'),(\'b\',001),(\'b\',011);\n \nSELECT category, BIT_AND(x), BIT_OR(x), BIT_XOR(x) \n FROM vals GROUP BY category;\n \n+----------+------------+-----------+------------+\n| category | BIT_AND(x) | BIT_OR(x) | BIT_XOR(x) |\n+----------+------------+-----------+------------+\n| a | 100 | 111 | 101 |\n| b | 0 | 11 | 10 |\n+----------+------------+-----------+------------+\n \n\n\nURL: https://mariadb.com/kb/en/bit_and/','','https://mariadb.com/kb/en/bit_and/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (186,16,'BIT_OR','Syntax\n------ \nBIT_OR(expr)\n \nDescription\n----------- \nReturns the bitwise OR of all bits in expr. The calculation\nis performed with 64-bit (BIGINT) precision. It is an\naggregate function, and so can be used with the GROUP BY\nclause.\n \nFrom MariaDB 10.2.0, BIT_OR can be used as a window\nfunction.\n \nExamples\n-------- \nCREATE TABLE vals (x INT);\n \nINSERT INTO vals VALUES(111),(110),(100);\n \nSELECT BIT_AND(x), BIT_OR(x), BIT_XOR(x) FROM vals;\n \n+------------+-----------+------------+\n| BIT_AND(x) | BIT_OR(x) | BIT_XOR(x) |\n+------------+-----------+------------+\n| 100 | 111 | 101 |\n+------------+-----------+------------+\n \nAs an aggregate function:\n \nCREATE TABLE vals2 (category VARCHAR(1), x INT);\n \nINSERT INTO vals2 VALUES\n (\'a\',111),(\'a\',110),(\'a\',100),\n (\'b\',\'000\'),(\'b\',001),(\'b\',011);\n \nSELECT category, BIT_AND(x), BIT_OR(x), BIT_XOR(x) \n FROM vals GROUP BY category;\n \n+----------+------------+-----------+------------+\n| category | BIT_AND(x) | BIT_OR(x) | BIT_XOR(x) |\n+----------+------------+-----------+------------+\n| a | 100 | 111 | 101 |\n| b | 0 | 11 | 10 |\n+----------+------------+-----------+------------+\n \n\n\nURL: https://mariadb.com/kb/en/bit_or/','','https://mariadb.com/kb/en/bit_or/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (187,16,'BIT_XOR','Syntax\n------ \nBIT_XOR(expr)\n \nDescription\n----------- \nReturns the bitwise XOR of all bits in expr. The calculation\nis performed with 64-bit (BIGINT) precision. It is an\naggregate function, and so can be used with the GROUP BY\nclause.\n \nFrom MariaDB 10.2.0, BIT_XOR() can be used as a window\nfunction.\n \nExamples\n-------- \nCREATE TABLE vals (x INT);\n \nINSERT INTO vals VALUES(111),(110),(100);\n \nSELECT BIT_AND(x), BIT_OR(x), BIT_XOR(x) FROM vals;\n \n+------------+-----------+------------+\n| BIT_AND(x) | BIT_OR(x) | BIT_XOR(x) |\n+------------+-----------+------------+\n| 100 | 111 | 101 |\n+------------+-----------+------------+\n \nAs an aggregate function:\n \nCREATE TABLE vals2 (category VARCHAR(1), x INT);\n \nINSERT INTO vals2 VALUES\n (\'a\',111),(\'a\',110),(\'a\',100),\n (\'b\',\'000\'),(\'b\',001),(\'b\',011);\n \nSELECT category, BIT_AND(x), BIT_OR(x), BIT_XOR(x) \n FROM vals GROUP BY category;\n \n+----------+------------+-----------+------------+\n| category | BIT_AND(x) | BIT_OR(x) | BIT_XOR(x) |\n+----------+------------+-----------+------------+\n| a | 100 | 111 | 101 |\n| b | 0 | 11 | 10 |\n+----------+------------+-----------+------------+\n \n\n\nURL: https://mariadb.com/kb/en/bit_xor/','','https://mariadb.com/kb/en/bit_xor/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (188,16,'COUNT','Syntax\n------ \nCOUNT(expr)\n \nDescription\n----------- \nReturns a count of the number of non-NULL values of expr in\nthe rows retrieved by a SELECT statement. The result is a\nBIGINT value. It is an aggregate function, and so can be\nused with the GROUP BY clause.\n \nCOUNT(*) counts the total number of rows in a table.\n \nCOUNT() returns 0 if there were no matching rows.\n \nFrom MariaDB 10.2.0, COUNT() can be used as a window\nfunction.\n \nExamples\n-------- \nCREATE TABLE student (name CHAR(10), test CHAR(10), score\nTINYINT); \n \nINSERT INTO student VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87), (\'Tatiana\', \'Tuning\', 83);\n \nSELECT COUNT(*) FROM student;\n \n+----------+\n| COUNT(*) |\n+----------+\n| 8 |\n+----------+\n \nCOUNT(DISTINCT) example:\n \nSELECT COUNT(DISTINCT (name)) FROM student;\n \n+------------------------+\n| COUNT(DISTINCT (name)) |\n+------------------------+\n| 4 |\n+------------------------+\n \nAs a window function\n \nCREATE OR REPLACE TABLE student_test (name CHAR(10), test\nCHAR(10), score TINYINT);\n \nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87);\n \nSELECT name, test, score, COUNT(score) OVER (PARTITION BY\nname) \n AS tests_written FROM student_test;\n \n+---------+--------+-------+---------------+\n| name | test | score | tests_written |\n+---------+--------+-------+---------------+\n| Chun | SQL | 75 | 2 |\n| Chun | Tuning | 73 | 2 |\n| Esben | SQL | 43 | 2 |\n| Esben | Tuning | 31 | 2 |\n| Kaolin | SQL | 56 | 2 |\n| Kaolin | Tuning | 88 | 2 |\n| Tatiana | SQL | 87 | 1 |\n+---------+--------+-------+---------------+\n \n\n\nURL: https://mariadb.com/kb/en/count/','','https://mariadb.com/kb/en/count/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (189,16,'GROUP_CONCAT','Syntax\n------ \nGROUP_CONCAT(expr)\n \nDescription\n----------- \nThis function returns a string result with the concatenated\nnon-NULL\nvalues from a group. It returns NULL if there are no\nnon-NULL values.\n \nThe maximum returned length in bytes is determined by the\ngroup_concat_max_len server system variable, which defaults\nto 1M (>= MariaDB 10.2.4) or 1K (\n\nURL: https://mariadb.com/kb/en/group_concat/','','https://mariadb.com/kb/en/group_concat/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (190,16,'MAX','Syntax\n------ \nMAX([DISTINCT] expr)\n \nDescription\n----------- \nReturns the largest, or maximum, value of expr. MAX() can\nalso take a string\nargument in which case it returns the maximum string value.\nThe DISTINCT\nkeyword can be used to find the maximum of the distinct\nvalues of expr,\nhowever, this produces the same result as omitting DISTINCT.\n \nNote that SET and ENUM fields are currently compared by\ntheir string value rather than their relative position in\nthe set, so MAX() may produce a different highest result\nthan ORDER BY DESC.\n \nIt is an aggregate function, and so can be used with the\nGROUP BY clause.\n \nFrom MariaDB 10.2.2, MAX() can be used as a window function.\n \nMAX() returns NULL if there were no matching rows.\n \nExamples\n-------- \nCREATE TABLE student (name CHAR(10), test CHAR(10), score\nTINYINT); \n \nINSERT INTO student VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87), (\'Tatiana\', \'Tuning\', 83);\n \nSELECT name, MAX(score) FROM student GROUP BY name;\n \n+---------+------------+\n| name | MAX(score) |\n+---------+------------+\n| Chun | 75 |\n| Esben | 43 |\n| Kaolin | 88 |\n| Tatiana | 87 |\n+---------+------------+\n \nMAX string:\n \nSELECT MAX(name) FROM student;\n \n+-----------+\n| MAX(name) |\n+-----------+\n| Tatiana |\n+-----------+\n \nBe careful to avoid this common mistake, not grouping\ncorrectly and returning mismatched data: \n \nSELECT name,test,MAX(SCORE) FROM student;\n \n+------+------+------------+\n| name | test | MAX(SCORE) |\n+------+------+------------+\n| Chun | SQL | 88 |\n+------+------+------------+\n \nDifference between ORDER BY DESC and MAX():\n \nCREATE TABLE student2(name CHAR(10),grade\nENUM(\'b\',\'c\',\'a\'));\n \nINSERT INTO student2\nVALUES(\'Chun\',\'b\'),(\'Esben\',\'c\'),(\'Kaolin\',\'a\');\n \nSELECT MAX(grade) FROM student2;\n \n+------------+\n| MAX(grade) |\n+------------+\n| c |\n+------------+\n \nSELECT grade FROM student2 ORDER BY grade DESC LIMIT 1;\n \n+-------+\n| grade |\n+-------+\n| a |\n+-------+\n \nAs a window function:\n \nCREATE OR REPLACE TABLE student_test (name CHAR(10), test\nCHAR(10), score TINYINT);\nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87);\n \nSELECT name, test, score, MAX(score) \n OVER (PARTITION BY name) AS highest_score FROM\nstudent_test;\n \n+---------+--------+-------+---------------+\n| name | test | score | highest_score |\n+---------+--------+-------+---------------+\n| Chun | SQL | 75 | 75 |\n| Chun | Tuning | 73 | 75 |\n| Esben | SQL | 43 | 43 |\n| Esben | Tuning | 31 | 43 |\n| Kaolin | SQL | 56 | 88 |\n| Kaolin | Tuning | 88 | 88 |\n| Tatiana | SQL | 87 | 87 |\n+---------+--------+-------+---------------+\n \n\n\nURL: https://mariadb.com/kb/en/max/','','https://mariadb.com/kb/en/max/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (191,16,'MIN','Syntax\n------ \nMIN([DISTINCT] expr)\n \nDescription\n----------- \nReturns the minimum value of expr. MIN() may take a string\nargument, in which case it returns the minimum string value.\nThe DISTINCT\nkeyword can be used to find the minimum of the distinct\nvalues of expr,\nhowever, this produces the same result as omitting DISTINCT.\n \nNote that SET and ENUM fields are currently compared by\ntheir string value rather than their relative position in\nthe set, so MIN() may produce a different lowest result than\nORDER BY ASC.\n \nIt is an aggregate function, and so can be used with the\nGROUP BY clause.\n \nFrom MariaDB 10.2.2, MIN() can be used as a window function.\n \nMIN() returns NULL if there were no matching rows.\n \nExamples\n-------- \nCREATE TABLE student (name CHAR(10), test CHAR(10), score\nTINYINT); \n \nINSERT INTO student VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87), (\'Tatiana\', \'Tuning\', 83);\n \nSELECT name, MIN(score) FROM student GROUP BY name;\n \n+---------+------------+\n| name | MIN(score) |\n+---------+------------+\n| Chun | 73 |\n| Esben | 31 |\n| Kaolin | 56 |\n| Tatiana | 83 |\n+---------+------------+\n \nMIN() with a string:\n \nSELECT MIN(name) FROM student;\n \n+-----------+\n| MIN(name) |\n+-----------+\n| Chun |\n+-----------+\n \nBe careful to avoid this common mistake, not grouping\ncorrectly and returning mismatched data: \n \nSELECT name,test,MIN(score) FROM student;\n \n+------+------+------------+\n| name | test | MIN(score) |\n+------+------+------------+\n| Chun | SQL | 31 |\n+------+------+------------+\n \nDifference between ORDER BY ASC and MIN():\n \nCREATE TABLE student2(name CHAR(10),grade\nENUM(\'b\',\'c\',\'a\'));\n \nINSERT INTO student2\nVALUES(\'Chun\',\'b\'),(\'Esben\',\'c\'),(\'Kaolin\',\'a\');\n \nSELECT MIN(grade) FROM student2;\n \n+------------+\n| MIN(grade) |\n+------------+\n| a |\n+------------+\n \nSELECT grade FROM student2 ORDER BY grade ASC LIMIT 1;\n \n+-------+\n| grade |\n+-------+\n| b |\n+-------+\n \nAs a window function:\n \nCREATE OR REPLACE TABLE student_test (name CHAR(10), test\nCHAR(10), score TINYINT);\nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87);\n \nSELECT name, test, score, MIN(score) \n OVER (PARTITION BY name) AS lowest_score FROM student_test;\n \n+---------+--------+-------+--------------+\n| name | test | score | lowest_score |\n+---------+--------+-------+--------------+\n| Chun | SQL | 75 | 73 |\n| Chun | Tuning | 73 | 73 |\n| Esben | SQL | 43 | 31 |\n| Esben | Tuning | 31 | 31 |\n| Kaolin | SQL | 56 | 56 |\n| Kaolin | Tuning | 88 | 56 |\n| Tatiana | SQL | 87 | 87 |\n+---------+--------+-------+--------------+\n \n\n\nURL: https://mariadb.com/kb/en/min/','','https://mariadb.com/kb/en/min/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (192,16,'STD','Syntax\n------ \nSTD(expr)\n \nDescription\n----------- \nReturns the population standard deviation of expr. This is\nan extension\nto standard SQL. The standard SQL function STDDEV_POP() can\nbe used instead. \n \nIt is an aggregate function, and so can be used with the\nGROUP BY clause.\n \nFrom MariaDB 10.2.2, STD() can be used as a window function.\n \nThis function returns NULL if there were no matching rows.\n \nExamples\n-------- \nAs an aggregate function:\n \nCREATE OR REPLACE TABLE stats (category VARCHAR(2), x INT);\n \nINSERT INTO stats VALUES \n (\'a\',1),(\'a\',2),(\'a\',3),\n (\'b\',11),(\'b\',12),(\'b\',20),(\'b\',30),(\'b\',60);\n \nSELECT category, STDDEV_POP(x), STDDEV_SAMP(x), VAR_POP(x) \n FROM stats GROUP BY category;\n \n+----------+---------------+----------------+------------+\n| category | STDDEV_POP(x) | STDDEV_SAMP(x) | VAR_POP(x) |\n+----------+---------------+----------------+------------+\n| a | 0.8165 | 1.0000 | 0.6667 |\n| b | 18.0400 | 20.1693 | 325.4400 |\n+----------+---------------+----------------+------------+\n \nAs a window function:\n \nCREATE OR REPLACE TABLE student_test (name CHAR(10), test\nCHAR(10), score TINYINT);\n \nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87);\n \nSELECT name, test, score, STDDEV_POP(score) \n OVER (PARTITION BY test) AS stddev_results FROM\nstudent_test;\n \n+---------+--------+-------+----------------+\n| name | test | score | stddev_results |\n+---------+--------+-------+----------------+\n| Chun | SQL | 75 | 16.9466 |\n| Chun | Tuning | 73 | 24.1247 |\n| Esben | SQL | 43 | 16.9466 |\n| Esben | Tuning | 31 | 24.1247 |\n| Kaolin | SQL | 56 | 16.9466 |\n| Kaolin | Tuning | 88 | 24.1247 |\n| Tatiana | SQL | 87 | 16.9466 |\n+---------+--------+-------+----------------+\n \n\n\nURL: https://mariadb.com/kb/en/std/','','https://mariadb.com/kb/en/std/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (193,16,'STDDEV','Syntax\n------ \nSTDDEV(expr)\n \nDescription\n----------- \nReturns the population standard deviation of expr. This\nfunction is\nprovided for compatibility with Oracle. The standard SQL\nfunction\nSTDDEV_POP() can be used instead.\n \nIt is an aggregate function, and so can be used with the\nGROUP BY clause.\n \nFrom MariaDB 10.2.2, STDDEV() can be used as a window\nfunction.\n \nThis function returns NULL if there were no matching rows.\n \nExamples\n-------- \nAs an aggregate function:\n \nCREATE OR REPLACE TABLE stats (category VARCHAR(2), x INT);\n \nINSERT INTO stats VALUES \n (\'a\',1),(\'a\',2),(\'a\',3),\n (\'b\',11),(\'b\',12),(\'b\',20),(\'b\',30),(\'b\',60);\n \nSELECT category, STDDEV_POP(x), STDDEV_SAMP(x), VAR_POP(x) \n FROM stats GROUP BY category;\n \n+----------+---------------+----------------+------------+\n| category | STDDEV_POP(x) | STDDEV_SAMP(x) | VAR_POP(x) |\n+----------+---------------+----------------+------------+\n| a | 0.8165 | 1.0000 | 0.6667 |\n| b | 18.0400 | 20.1693 | 325.4400 |\n+----------+---------------+----------------+------------+\n \nAs a window function:\n \nCREATE OR REPLACE TABLE student_test (name CHAR(10), test\nCHAR(10), score TINYINT);\n \nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87);\n \nSELECT name, test, score, STDDEV_POP(score) \n OVER (PARTITION BY test) AS stddev_results FROM\nstudent_test;\n \n+---------+--------+-------+----------------+\n| name | test | score | stddev_results |\n+---------+--------+-------+----------------+\n| Chun | SQL | 75 | 16.9466 |\n| Chun | Tuning | 73 | 24.1247 |\n| Esben | SQL | 43 | 16.9466 |\n| Esben | Tuning | 31 | 24.1247 |\n| Kaolin | SQL | 56 | 16.9466 |\n| Kaolin | Tuning | 88 | 24.1247 |\n| Tatiana | SQL | 87 | 16.9466 |\n+---------+--------+-------+----------------+\n \n\n\nURL: https://mariadb.com/kb/en/stddev/','','https://mariadb.com/kb/en/stddev/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (194,16,'STDDEV_POP','Syntax\n------ \nSTDDEV_POP(expr)\n \nDescription\n----------- \nReturns the population standard deviation of expr (the\nsquare root of\nVAR_POP()). You can also use STD() or\nSTDDEV(), which are equivalent but not standard SQL.\n \nIt is an aggregate function, and so can be used with the\nGROUP BY clause.\n \nFrom MariaDB 10.2.2, STDDEV_POP() can be used as a window\nfunction.\n \nSTDDEV_POP() returns NULL if there were no matching rows.\n \nExamples\n-------- \nAs an aggregate function:\n \nCREATE OR REPLACE TABLE stats (category VARCHAR(2), x INT);\n \nINSERT INTO stats VALUES \n (\'a\',1),(\'a\',2),(\'a\',3),\n (\'b\',11),(\'b\',12),(\'b\',20),(\'b\',30),(\'b\',60);\n \nSELECT category, STDDEV_POP(x), STDDEV_SAMP(x), VAR_POP(x) \n FROM stats GROUP BY category;\n \n+----------+---------------+----------------+------------+\n| category | STDDEV_POP(x) | STDDEV_SAMP(x) | VAR_POP(x) |\n+----------+---------------+----------------+------------+\n| a | 0.8165 | 1.0000 | 0.6667 |\n| b | 18.0400 | 20.1693 | 325.4400 |\n+----------+---------------+----------------+------------+\n \nAs a window function:\n \nCREATE OR REPLACE TABLE student_test (name CHAR(10), test\nCHAR(10), score TINYINT);\n \nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87);\n \nSELECT name, test, score, STDDEV_POP(score) \n OVER (PARTITION BY test) AS stddev_results FROM\nstudent_test;\n \n+---------+--------+-------+----------------+\n| name | test | score | stddev_results |\n+---------+--------+-------+----------------+\n| Chun | SQL | 75 | 16.9466 |\n| Chun | Tuning | 73 | 24.1247 |\n| Esben | SQL | 43 | 16.9466 |\n| Esben | Tuning | 31 | 24.1247 |\n| Kaolin | SQL | 56 | 16.9466 |\n| Kaolin | Tuning | 88 | 24.1247 |\n| Tatiana | SQL | 87 | 16.9466 |\n+---------+--------+-------+----------------+\n \n\n\nURL: https://mariadb.com/kb/en/stddev_pop/','','https://mariadb.com/kb/en/stddev_pop/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (195,16,'STDDEV_SAMP','Syntax\n------ \nSTDDEV_SAMP(expr)\n \nDescription\n----------- \nReturns the sample standard deviation of expr (the square\nroot of VAR_SAMP()).\n \nIt is an aggregate function, and so can be used with the\nGROUP BY clause.\n \nFrom MariaDB 10.2.2, STDDEV_SAMP() can be used as a window\nfunction.\n \nSTDDEV_SAMP() returns NULL if there were no matching rows.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/stddev_samp/','','https://mariadb.com/kb/en/stddev_samp/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (196,16,'SUM','Syntax\n------ \nSUM([DISTINCT] expr)\n \nDescription\n----------- \nReturns the sum of expr. If the return set has no rows,\nSUM() returns\nNULL. The DISTINCT keyword can be used to sum only the\ndistinct values\nof expr.\n \nFrom MariaDB 10.2.0, SUM() can be used as a window function,\nalthough not with the DISTINCT specifier.\n \nExamples\n-------- \nCREATE TABLE sales (sales_value INT);\nINSERT INTO sales VALUES(10),(20),(20),(40);\n \nSELECT SUM(sales_value) FROM sales;\n \n+------------------+\n| SUM(sales_value) |\n+------------------+\n| 90 |\n+------------------+\n \nSELECT SUM(DISTINCT(sales_value)) FROM sales;\n \n+----------------------------+\n| SUM(DISTINCT(sales_value)) |\n+----------------------------+\n| 70 |\n+----------------------------+\n \nCommonly, SUM is used with a GROUP BY clause:\n \nCREATE TABLE sales (name CHAR(10), month CHAR(10), units\nINT);\n \nINSERT INTO sales VALUES \n (\'Chun\', \'Jan\', 75), (\'Chun\', \'Feb\', 73),\n (\'Esben\', \'Jan\', 43), (\'Esben\', \'Feb\', 31),\n (\'Kaolin\', \'Jan\', 56), (\'Kaolin\', \'Feb\', 88),\n (\'Tatiana\', \'Jan\', 87), (\'Tatiana\', \'Feb\', 83);\n \nSELECT name, SUM(units) FROM sales GROUP BY name;\n \n+---------+------------+\n| name | SUM(units) |\n+---------+------------+\n| Chun | 148 |\n| Esben | 74 |\n| Kaolin | 144 |\n| Tatiana | 170 |\n+---------+------------+\n \nThe GROUP BY clause is required when using an aggregate\nfunction along with regular column data, otherwise the\nresult will be a mismatch, as in the following common type\nof mistake:\n \nSELECT name,SUM(units) FROM sales\n;\n+------+------------+\n| name | SUM(units) |\n+------+------------+\n| Chun | 536 |\n+------+------------+\n \nAs a window function:\n \nCREATE OR REPLACE TABLE student_test (name CHAR(10), test\nCHAR(10), score TINYINT);\nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87);\n \nSELECT name, test, score, SUM(score) OVER (PARTITION BY\nname) AS total_score FROM student_test;\n \n+---------+--------+-------+-------------+\n| name | test | score | total_score |\n+---------+--------+-------+-------------+\n| Chun | SQL | 75 | 148 |\n| Chun | Tuning | 73 | 148 |\n| Esben | SQL | 43 | 74 |\n| Esben | Tuning | 31 | 74 |\n| Kaolin | SQL | 56 | 144 |\n| Kaolin | Tuning | 88 | 144 |\n| Tatiana | SQL | 87 | 87 |\n+---------+--------+-------+-------------+\n \n\n\nURL: https://mariadb.com/kb/en/sum/','','https://mariadb.com/kb/en/sum/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (197,16,'VARIANCE','Syntax\n------ \nVARIANCE(expr) \n \nDescription\n----------- \nReturns the population standard variance of expr. This is an\nextension to\nstandard SQL. The standard SQL function VAR_POP() can be\nused\ninstead.\n \nVariance is calculated by\nworking out the mean for the set\nfor each number, subtracting the mean and squaring the\nresult\ncalculate the average of the resulting differences\n \nIt is an aggregate function, and so can be used with the\nGROUP BY clause.\n \nFrom MariaDB 10.2.2, VARIANCE() can be used as a window\nfunction.\n \nVARIANCE() returns NULL if there were no matching rows.\n \nExamples\n-------- \nCREATE TABLE v(i tinyint);\n \nINSERT INTO v VALUES(101),(99);\n \nSELECT VARIANCE(i) FROM v;\n \n+-------------+\n| VARIANCE(i) |\n+-------------+\n| 1.0000 |\n+-------------+\n \nINSERT INTO v VALUES(120),(80);\n \nSELECT VARIANCE(i) FROM v;\n \n+-------------+\n| VARIANCE(i) |\n+-------------+\n| 200.5000 |\n+-------------+\n \nAs an aggregate function:\n \nCREATE OR REPLACE TABLE stats (category VARCHAR(2), x INT);\n \nINSERT INTO stats VALUES \n (\'a\',1),(\'a\',2),(\'a\',3),\n (\'b\',11),(\'b\',12),(\'b\',20),(\'b\',30),(\'b\',60);\n \nSELECT category, STDDEV_POP(x), STDDEV_SAMP(x), VAR_POP(x) \n FROM stats GROUP BY category;\n \n+----------+---------------+----------------+------------+\n| category | STDDEV_POP(x) | STDDEV_SAMP(x) | VAR_POP(x) |\n+----------+---------------+----------------+------------+\n| a | 0.8165 | 1.0000 | 0.6667 |\n| b | 18.0400 | 20.1693 | 325.4400 |\n+----------+---------------+----------------+------------+\n \nAs a window function:\n \nCREATE OR REPLACE TABLE student_test (name CHAR(10), test\nCHAR(10), score TINYINT);\n \nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87);\n \nSELECT name, test, score, VAR_POP(score) \n OVER (PARTITION BY test) AS variance_results FROM\nstudent_test;\n \n+---------+--------+-------+------------------+\n| name | test | score | variance_results |\n+---------+--------+-------+------------------+\n| Chun | SQL | 75 | 287.1875 |\n| Chun | Tuning | 73 | 582.0000 |\n| Esben | SQL | 43 | 287.1875 |\n| Esben | Tuning | 31 | 582.0000 |\n| Kaolin | SQL | 56 | 287.1875 |\n| Kaolin | Tuning | 88 | 582.0000 |\n| Tatiana | SQL | 87 | 287.1875 |\n+---------+--------+-------+------------------+\n \n\n\nURL: https://mariadb.com/kb/en/variance/','','https://mariadb.com/kb/en/variance/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (198,16,'VAR_POP','Syntax\n------ \nVAR_POP(expr)\n \nDescription\n----------- \nReturns the population standard variance of expr. It\nconsiders rows as\nthe whole population, not as a sample, so it has the number\nof rows as\nthe denominator. You can also use VARIANCE(), which is\nequivalent but\nis not standard SQL.\n \nVariance is calculated by\nworking out the mean for the set\nfor each number, subtracting the mean and squaring the\nresult\ncalculate the average of the resulting differences\n \nIt is an aggregate function, and so can be used with the\nGROUP BY clause.\n \nFrom MariaDB 10.2.2, VAR_POP() can be used as a window\nfunction.\n \nVAR_POP() returns NULL if there were no matching rows.\n \nExamples\n-------- \nCREATE TABLE v(i tinyint);\n \nINSERT INTO v VALUES(101),(99);\n \nSELECT VAR_POP(i) FROM v;\n \n+------------+\n| VAR_POP(i) |\n+------------+\n| 1.0000 |\n+------------+\n \nINSERT INTO v VALUES(120),(80);\n \nSELECT VAR_POP(i) FROM v;\n \n+------------+\n| VAR_POP(i) |\n+------------+\n| 200.5000 |\n+------------+\n \nAs an aggregate function:\n \nCREATE OR REPLACE TABLE stats (category VARCHAR(2), x INT);\n \nINSERT INTO stats VALUES \n (\'a\',1),(\'a\',2),(\'a\',3),\n (\'b\',11),(\'b\',12),(\'b\',20),(\'b\',30),(\'b\',60);\n \nSELECT category, STDDEV_POP(x), STDDEV_SAMP(x), VAR_POP(x) \n FROM stats GROUP BY category;\n \n+----------+---------------+----------------+------------+\n| category | STDDEV_POP(x) | STDDEV_SAMP(x) | VAR_POP(x) |\n+----------+---------------+----------------+------------+\n| a | 0.8165 | 1.0000 | 0.6667 |\n| b | 18.0400 | 20.1693 | 325.4400 |\n+----------+---------------+----------------+------------+\n \nAs a window function:\n \nCREATE OR REPLACE TABLE student_test (name CHAR(10), test\nCHAR(10), score TINYINT);\n \nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87);\n \nSELECT name, test, score, VAR_POP(score) \n OVER (PARTITION BY test) AS variance_results FROM\nstudent_test;\n \n+---------+--------+-------+------------------+\n| name | test | score | variance_results |\n+---------+--------+-------+------------------+\n| Chun | SQL | 75 | 287.1875 |\n| Chun | Tuning | 73 | 582.0000 |\n| Esben | SQL | 43 | 287.1875 |\n| Esben | Tuning | 31 | 582.0000 |\n| Kaolin | SQL | 56 | 287.1875 |\n| Kaolin | Tuning | 88 | 582.0000 |\n| Tatiana | SQL | 87 | 287.1875 |\n+---------+--------+-------+------------------+\n \n\n\nURL: https://mariadb.com/kb/en/var_pop/','','https://mariadb.com/kb/en/var_pop/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (199,16,'VAR_SAMP','Syntax\n------ \nVAR_SAMP(expr)\n \nDescription\n----------- \nReturns the sample variance of expr. That is, the\ndenominator is the number of rows minus one.\n \nIt is an aggregate function, and so can be used with the\nGROUP BY clause.\n \nFrom MariaDB 10.2.2, VAR_SAMP() can be used as a window\nfunction.\n \nVAR_SAMP() returns NULL if there were no matching rows.\n \nExamples\n-------- \nAs an aggregate function:\n \nCREATE OR REPLACE TABLE stats (category VARCHAR(2), x INT);\n \nINSERT INTO stats VALUES \n (\'a\',1),(\'a\',2),(\'a\',3),\n (\'b\',11),(\'b\',12),(\'b\',20),(\'b\',30),(\'b\',60);\n \nSELECT category, STDDEV_POP(x), STDDEV_SAMP(x), VAR_POP(x) \n FROM stats GROUP BY category;\n \n+----------+---------------+----------------+------------+\n| category | STDDEV_POP(x) | STDDEV_SAMP(x) | VAR_POP(x) |\n+----------+---------------+----------------+------------+\n| a | 0.8165 | 1.0000 | 0.6667 |\n| b | 18.0400 | 20.1693 | 325.4400 |\n+----------+---------------+----------------+------------+\n \nAs a window function:\n \nCREATE OR REPLACE TABLE student_test (name CHAR(10), test\nCHAR(10), score TINYINT);\n \nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87);\n \nSELECT name, test, score, VAR_SAMP(score) \n OVER (PARTITION BY test) AS variance_results FROM\nstudent_test;\n \n+---------+--------+-------+------------------+\n| name | test | score | variance_results |\n+---------+--------+-------+------------------+\n| Chun | SQL | 75 | 382.9167 |\n| Chun | Tuning | 73 | 873.0000 |\n| Esben | SQL | 43 | 382.9167 |\n| Esben | Tuning | 31 | 873.0000 |\n| Kaolin | SQL | 56 | 382.9167 |\n| Kaolin | Tuning | 88 | 873.0000 |\n| Tatiana | SQL | 87 | 382.9167 |\n+---------+--------+-------+------------------+\n \n\n\nURL: https://mariadb.com/kb/en/var_samp/','','https://mariadb.com/kb/en/var_samp/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (200,17,'BENCHMARK','Syntax\n------ \nBENCHMARK(count,expr)\n \nDescription\n----------- \nThe BENCHMARK() function executes the expression expr\nrepeatedly count\ntimes. It may be used to time how quickly MariaDB processes\nthe\nexpression. The result value is always 0. The intended use\nis from\nwithin the mysql client, which reports query execution\ntimes.\n \nExamples\n-------- \nSELECT BENCHMARK(1000000,ENCODE(\'hello\',\'goodbye\'));\n+----------------------------------------------+\n| BENCHMARK(1000000,ENCODE(\'hello\',\'goodbye\')) |\n+----------------------------------------------+\n| 0 |\n+----------------------------------------------+\n1 row in set (0.21 sec)\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/benchmark/','','https://mariadb.com/kb/en/benchmark/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (201,17,'BINLOG_GTID_POS','From version 10.0.2, MariaDB supports global transaction IDs\nfor replication.\n \nSyntax\n------ \nBINLOG_GTID_POS(binlog_filename,binlog_offset)\n \nDescription\n----------- \nThe BINLOG_GTID_POS() function takes as input an old-style\nbinary log position in the form of a file name and a file\noffset. It looks up the position in the current binlog, and\nreturns a string representation of the corresponding GTID\nposition. If the position is not found in the current\nbinlog, NULL is returned.\n \nExamples\n-------- \nSELECT BINLOG_GTID_POS(\"master-bin.000001\", 600);\n \n\n\nURL: https://mariadb.com/kb/en/binlog_gtid_pos/','','https://mariadb.com/kb/en/binlog_gtid_pos/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (202,17,'CHARSET','Syntax\n------ \nCHARSET(str)\n \nDescription\n----------- \nReturns the character set of the string argument. If str is\nnot a string, it is considered as a binary string (so the\nfunction returns \'binary\'). This applies to NULL, too. The\nreturn value is a string in the utf8 character set.\n \nExamples\n-------- \nSELECT CHARSET(\'abc\');\n+----------------+\n| CHARSET(\'abc\') |\n+----------------+\n| latin1 |\n+----------------+\n \nSELECT CHARSET(CONVERT(\'abc\' USING utf8));\n+------------------------------------+\n| CHARSET(CONVERT(\'abc\' USING utf8)) |\n+------------------------------------+\n| utf8 |\n+------------------------------------+\n \nSELECT CHARSET(USER());\n+-----------------+\n| CHARSET(USER()) |\n+-----------------+\n| utf8 |\n+-----------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/charset/','','https://mariadb.com/kb/en/charset/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (203,17,'COERCIBILITY','Syntax\n------ \nCOERCIBILITY(str)\n \nDescription\n----------- \nReturns the collation coercibility value of the string\nargument. Coercibility defines what will be converted to\nwhat in case of collation conflict, with an expression with\nhigher coercibility being converted to the collation of an\nexpression with lower coercibility.\n \nCoercibility | Description | Example | \n \n0 | Explicit | Value using a COLLATE clause | \n \n1 | No collation | Concatenated strings using different\ncollations | \n \n2 | Implicit | Column value | \n \n3 | Constant | USER() return value | \n \n4 | Coercible | Literal string | \n \n5 | Ignorable | NULL or derived from NULL | \n \nExamples\n-------- \nSELECT COERCIBILITY(\'abc\' COLLATE latin1_swedish_ci);\n+-----------------------------------------------+\n| COERCIBILITY(\'abc\' COLLATE latin1_swedish_ci) |\n+-----------------------------------------------+\n| 0 |\n+-----------------------------------------------+\n \nSELECT COERCIBILITY(USER());\n+----------------------+\n| COERCIBILITY(USER()) |\n+----------------------+\n| 3 |\n+----------------------+\n \nSELECT COERCIBILITY(\'abc\');\n+---------------------+\n| COERCIBILITY(\'abc\') |\n+---------------------+\n| 4 |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/coercibility/','','https://mariadb.com/kb/en/coercibility/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (204,17,'COLLATION','Syntax\n------ \nCOLLATION(str)\n \nDescription\n----------- \nReturns the collation of the string argument. If str is not\na string, it is considered as a binary string (so the\nfunction returns \'binary\'). This applies to NULL, too. The\nreturn value is a string in the utf8 character set.\n \nSee Character Sets and Collations.\n \nExamples\n-------- \nSELECT COLLATION(\'abc\');\n+-------------------+\n| COLLATION(\'abc\') |\n+-------------------+\n| latin1_swedish_ci |\n+-------------------+\n \nSELECT COLLATION(_utf8\'abc\');\n+-----------------------+\n| COLLATION(_utf8\'abc\') |\n+-----------------------+\n| utf8_general_ci |\n+-----------------------+\n \n\n\nURL: https://mariadb.com/kb/en/collation/','','https://mariadb.com/kb/en/collation/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (205,17,'CONNECTION_ID','Syntax\n------ \nCONNECTION_ID()\n \nDescription\n----------- \nReturns the connection ID (thread ID) for the connection.\nEvery\nthread (including events) has an ID that is unique among the\nset of currently\nconnected clients.\n \nUntil MariaDB 10.3.1, returns MYSQL_TYPE_LONGLONG, or\nbigint(10), in all cases. From MariaDB 10.3.1, returns\nMYSQL_TYPE_LONG, or int(10), when the result would fit\nwithin 32-bits.\n \nExamples\n-------- \nSELECT CONNECTION_ID();\n+-----------------+\n| CONNECTION_ID() |\n+-----------------+\n| 3 |\n+-----------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/connection_id/','','https://mariadb.com/kb/en/connection_id/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (206,17,'CURRENT_ROLE','Roles were introduced in MariaDB 10.0.5.\n \nSyntax\n------ \nCURRENT_ROLE, CURRENT_ROLE()\n \nDescription\n----------- \nReturns the current role name. This determines your access\nprivileges. The return value is a string in the\nutf8 character set.\n \nIf there is no current role, NULL is returned.\n \nThe output of SELECT CURRENT_ROLE is equivalent to the\ncontents of the ENABLED_ROLES Information Schema table.\n \nUSER() returns the combination of user and host used to\nlogin. CURRENT_USER() returns the account used to determine\ncurrent connection\'s privileges.\n \nExamples\n-------- \nSELECT CURRENT_ROLE;\n \n+--------------+\n| CURRENT_ROLE |\n+--------------+\n| NULL |\n+--------------+\n \nSET ROLE staff;\n \nSELECT CURRENT_ROLE;\n \n+--------------+\n| CURRENT_ROLE |\n+--------------+\n| staff |\n+--------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/current_role/','','https://mariadb.com/kb/en/current_role/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (207,17,'CURRENT_USER','Syntax\n------ \nCURRENT_USER, CURRENT_USER()\n \nDescription\n----------- \nReturns the user name and host name combination for the\nMariaDB account\nthat the server used to authenticate the current client.\nThis account\ndetermines your access privileges. The return value is a\nstring in the\nutf8 character set.\n \nThe value of CURRENT_USER() can differ from the value of\nUSER(). CURRENT_ROLE() returns the current active role.\n \nExamples\n-------- \nshell> mysql --user=\"anonymous\"\n \nMariaDB [(none)]> select user(),current_user();\n+---------------------+----------------+\n| user() | current_user() |\n+---------------------+----------------+\n| anonymous@localhost | @localhost |\n+---------------------+----------------+\n \nWhen calling CURRENT_USER() in a stored procedure, it\nreturns the owner of the stored procedure, as defined with\nDEFINER.\n \n\n\nURL: https://mariadb.com/kb/en/current_user/','','https://mariadb.com/kb/en/current_user/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (208,17,'DATABASE','Syntax\n------ \nDATABASE()\n \nDescription\n----------- \nReturns the default (current) database name as a string in\nthe utf8 character set. If there is no default database,\nDATABASE() returns NULL. Within a stored routine, the\ndefault database is the database that the routine is\nassociated with, which is not necessarily the same as the\ndatabase that is the default in the calling context.\n \nSCHEMA() is a synonym for DATABASE().\n \nTo select a default database, the USE statement can be run.\nAnother way to set the default database is specifying its\nname at mysql command line client startup.\n \nExamples\n-------- \nSELECT DATABASE();\n+------------+\n| DATABASE() |\n+------------+\n| NULL |\n+------------+\n \nUSE test;\n \nDatabase changed\n \nSELECT DATABASE();\n+------------+\n| DATABASE() |\n+------------+\n| test |\n+------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/database/','','https://mariadb.com/kb/en/database/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (209,17,'DECODE_HISTOGRAM','DECODE_HISTOGRAM() was introduced in MariaDB 10.0.2\n \nSyntax\n------ \nDECODE_HISTOGRAM(hist_type,histogram)\n \nNote: Before MariaDB 10.0.10 the arguments were reversed.\n \nDescription\n----------- \nReturns a string of comma separated numeric values\ncorresponding to a probability distribution represented by\nthe histogram of type hist_type (SINGLE_PREC_HB or\nDOUBLE_PREC_HB). The hist_type and histogram would be\ncommonly used from the mysql.column_stats table.\n \nSee Histogram Based Statistics for details.\n \nExamples\n-------- \nCREATE TABLE origin (\n i INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,\n v INT UNSIGNED NOT NULL\n);\n \nINSERT INTO origin(v) VALUES \n (1),(2),(3),(4),(5),(10),(20),\n (30),(40),(50),(60),(70),(80),\n (90),(100),(200),(400),(800);\n \nSET histogram_size=10,histogram_type=SINGLE_PREC_HB;\n \nANALYZE TABLE origin PERSISTENT FOR ALL;\n \n+-------------+---------+----------+-----------------------------------------+\n| Table | Op | Msg_type | Msg_text |\n+-------------+---------+----------+-----------------------------------------+\n| test.origin | analyze | status | Engine-independent\nstatistics collected |\n| test.origin | analyze | status | OK |\n+-------------+---------+----------+-----------------------------------------+\n \nSELECT db_name,table_name,column_name,hist_type,\n hex(histogram),decode_histogram(hist_type,histogram) \n FROM mysql.column_stats WHERE db_name=\'test\' and\ntable_name=\'origin\';\n \n+---------+------------+-------------+----------------+----------------------+-------------------------------------------------------------------+\n| db_name | table_name | column_name | hist_type |\nhex(histogram) | decode_histogram(hist_type,histogram) |\n+---------+------------+-------------+----------------+----------------------+-------------------------------------------------------------------+\n| test | origin | i | SINGLE_PREC_HB | 0F2D3C5A7887A5C3D2F0\n|\n0.059,0.118,0.059,0.118,0.118,0.059,0.118,0.118,0.059,0.118,0.059\n|\n| test | origin | v | SINGLE_PREC_HB | 000001060C0F161C1F7F\n|\n0.000,0.000,0.004,0.020,0.024,0.012,0.027,0.024,0.012,0.376,0.502\n|\n+---------+------------+-------------+----------------+----------------------+-------------------------------------------------------------------+\n \nSET histogram_size=20,histogram_type=DOUBLE_PREC_HB;\n \nANALYZE TABLE origin PERSISTENT FOR ALL;\n \n+-------------+---------+----------+-----------------------------------------+\n| Table | Op | Msg_type | Msg_text |\n+-------------+---------+----------+-----------------------------------------+\n| test.origin | analyze | status | Engine-independent\nstatistics collected |\n| test.origin | analyze | status | OK |\n+-------------+---------+----------+-----------------------------------------+\n \nSELECT db_name,table_name,column_name,\n hist_type,hex(histogram),decode_histogram(hist_type,histogram)\n\n FROM mysql.column_stats WHERE db_name=\'test\' and\ntable_name=\'origin\';\n \n+---------+------------+-------------+----------------+------------------------------------------+-----------------------------------------------------------------------------------------+\n| db_name | table_name | column_name | hist_type |\nhex(histogram) | decode_histogram(hist_type,histogram) |\n+---------+------------+-------------+----------------+------------------------------------------+-----------------------------------------------------------------------------------------+\n| test | origin | i | DOUBLE_PREC_HB |\n0F0F2D2D3C3C5A5A78788787A5A5C3C3D2D2F0F0 |\n0.05882,0.11765,0.05882,0.11765,0.11765,0.05882,0.11765,0.11765,0.05882,0.11765,0.05882\n|\n| test | origin | v | DOUBLE_PREC_HB |\n5200F600480116067E0CB30F1B16831CB81FD67F |\n0.00125,0.00250,0.00125,0.01877,0.02502,0.01253,0.02502,0.02502,0.01253,0.37546,0.50063\n|\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/decode_histogram/','','https://mariadb.com/kb/en/decode_histogram/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (210,17,'DEFAULT','Syntax\n------ \nDEFAULT(col_name)\n \nDescription\n----------- \nReturns the default value for a table column. If the column\nhas no default value, NULL is returned.\nFor integer columns using AUTO_INCREMENT, 0 is returned.\n \nWhen using DEFAULT as a value to set in an INSERT or UPDATE\nstatement, you can use the bare keyword DEFAULT without the\nparentheses and argument to\nrefer to the column in context. You can only use DEFAULT as\na bare keyword if you are using it\nalone without a surrounding expression or function.\n \nExamples\n-------- \nSelect only non-default values for a column:\n \nSELECT i FROM t WHERE i != DEFAULT(i);\n \nUpdate values to be one greater than the default value:\n \nUPDATE t SET i = DEFAULT(i)+1 WHERE i \n\nURL: https://mariadb.com/kb/en/default/','','https://mariadb.com/kb/en/default/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (211,17,'FOUND_ROWS','Syntax\n------ \nFOUND_ROWS()\n \nDescription\n----------- \nA SELECT statement may include a LIMIT clause to restrict\nthe number\nof rows the server returns to the client. In some cases, it\nis\ndesirable to know how many rows the statement would have\nreturned\nwithout the LIMIT, but without running the statement again.\nTo obtain\nthis row count, include a SQL_CALC_FOUND_ROWS option in the\nSELECT\nstatement, and then invoke FOUND_ROWS() afterwards.\n \nYou can also use FOUND_ROWS() to obtain the number of rows\nreturned by a SELECT which does not contain a LIMIT clause.\nIn this case you don\'t need to use the SQL_CALC_FOUND_ROWS\noption. This can be useful for example in a stored\nprocedure.\n \nAlso, this function works with some other statements which\nreturn a resultset, including SHOW, DESC and HELP. For\nDELETE ... RETURNING you should use ROW_COUNT(). It also\nworks as a prepared statement, or after executing a prepared\nstatement.\n \nStatements which don\'t return any results don\'t affect\nFOUND_ROWS() - the previous value will still be returned.\n \nWarning: When used after a CALL statement, this function\nreturns the number of rows selected by the last query in the\nprocedure, not by the whole procedure.\n \nStatements using the FOUND_ROWS() function are not safe for\nreplication.\n \nExamples\n-------- \nSHOW ENGINES;\n \n+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+\n| Engine | Support | Comment | Transactions | XA |\nSavepoints |\n+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+\n| InnoDB | DEFAULT | Supports transactions, row-level\nlocking, and foreign keys | YES | YES | YES |\n...\n| SPHINX | YES | Sphinx storage engine | NO | NO | NO |\n+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+\n11 rows in set (0.01 sec)\n \nSELECT FOUND_ROWS();\n+--------------+\n| FOUND_ROWS() |\n+--------------+\n| 11 |\n+--------------+\n \nSELECT SQL_CALC_FOUND_ROWS * FROM tbl_name WHERE id > 100\nLIMIT 10;\n \nSELECT FOUND_ROWS();\n+--------------+\n| FOUND_ROWS() |\n+--------------+\n| 23 |\n+--------------+\n \n\n\nURL: https://mariadb.com/kb/en/found_rows/','','https://mariadb.com/kb/en/found_rows/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (212,17,'LAST_INSERT_ID','Syntax\n------ \nLAST_INSERT_ID(), LAST_INSERT_ID(expr)\n \nDescription\n----------- \nLAST_INSERT_ID() (no arguments) returns\nthe first automatically generated value successfully\ninserted for an\nAUTO_INCREMENT column as a result of the most recently\nexecuted INSERT\nstatement. The value of LAST_INSERT_ID() remains unchanged\nif no rows\nare successfully inserted.\n \nIf one gives an argument to LAST_INSERT_ID(), then it will\nreturn the value of the expression and\nthe next call to LAST_INSERT_ID() will return the same\nvalue. The value will also be sent to the client\nand can be accessed by the mysql_insert_id function.\n \nFor example, after inserting a row that generates an\nAUTO_INCREMENT\nvalue, you can get the value like this:\n \nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n| 9 |\n+------------------+\n \nYou can also use LAST_INSERT_ID() to delete the last\ninserted row:\n \nDELETE FROM product WHERE id = LAST_INSERT_ID();\n \nIf no rows were successfully inserted, LAST_INSERT_ID()\nreturns 0.\n \nThe value of LAST_INSERT_ID() will be consistent across all\nversions\nif all rows in the INSERT or UPDATE statement were\nsuccessful.\n \nThe currently executing statement does not affect the value\nof\nLAST_INSERT_ID(). Suppose that you generate an\nAUTO_INCREMENT value\nwith one statement, and then refer to LAST_INSERT_ID() in a\nmultiple-row INSERT statement that inserts rows into a table\nwith its\nown AUTO_INCREMENT column. The value of LAST_INSERT_ID()\nwill remain\nstable in the second statement; its value for the second and\nlater\nrows is not affected by the earlier row insertions.\n(However, if you\nmix references to LAST_INSERT_ID() and LAST_INSERT_ID(expr),\nthe\neffect is undefined.)\n \nIf the previous statement returned an error, the value of\nLAST_INSERT_ID() is undefined. For transactional tables, if\nthe\nstatement is rolled back due to an error, the value of\nLAST_INSERT_ID() is left undefined. For manual ROLLBACK, the\nvalue of\nLAST_INSERT_ID() is not restored to that before the\ntransaction; it\nremains as it was at the point of the ROLLBACK.\n \nWithin the body of a stored routine (procedure or function)\nor a\ntrigger, the value of LAST_INSERT_ID() changes the same way\nas for\nstatements executed outside the body of these kinds of\nobjects. The\neffect of a stored routine or trigger upon the value of\nLAST_INSERT_ID() that is seen by following statements\ndepends on the\nkind of routine:\nIf a stored procedure executes statements that change the\nvalue of LAST_INSERT_ID(), the new value will be seen by\nstatements that follow the procedure call.\n \nFor stored functions and triggers that change the value, the\nvalue is restored when the function or trigger ends, so\nfollowing statements will not see a changed value.\n \nExamples\n-------- \nCREATE TABLE t (\n id INTEGER UNSIGNED AUTO_INCREMENT PRIMARY KEY, \n f VARCHAR(1)) \nENGINE = InnoDB;\n \nINSERT INTO t(f) VALUES(\'a\');\n \nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n| 1 |\n+------------------+\n \nINSERT INTO t(f) VALUES(\'b\');\n \nINSERT INTO t(f) VALUES(\'c\');\n \nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n| 3 |\n+------------------+\n \nINSERT INTO t(f) VALUES(\'d\'),(\'e\');\n \nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n| 4 |\n+------------------+\n \nSELECT * FROM t;\n \n+----+------+\n| id | f |\n+----+------+\n| 1 | a |\n| 2 | b |\n| 3 | c |\n| 4 | d |\n| 5 | e |\n+----+------+\n \nSELECT LAST_INSERT_ID(12);\n+--------------------+\n| LAST_INSERT_ID(12) |\n+--------------------+\n| 12 |\n+--------------------+\n \nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n| 12 |\n+------------------+\n \nINSERT INTO t(f) VALUES(\'f\');\n \nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n| 6 |\n+------------------+\n \nSELECT * FROM t;\n \n+----+------+\n| id | f |\n+----+------+\n| 1 | a |\n| 2 | b |\n| 3 | c |\n| 4 | d |\n| 5 | e |\n| 6 | f |\n+----+------+\n \nSELECT LAST_INSERT_ID(12);\n+--------------------+\n| LAST_INSERT_ID(12) |\n+--------------------+\n| 12 |\n+--------------------+\n \nINSERT INTO t(f) VALUES(\'g\');\n \nSELECT * FROM t;\n \n+----+------+\n| id | f |\n+----+------+\n| 1 | a |\n| 2 | b |\n| 3 | c |\n| 4 | d |\n| 5 | e |\n| 6 | f |\n| 7 | g |\n+----+------+\n \n\n\nURL: https://mariadb.com/kb/en/last_insert_id/','','https://mariadb.com/kb/en/last_insert_id/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (213,17,'LAST_VALUE','Syntax\n------ \nLAST_VALUE(expr,[expr,...])\n \nLAST_VALUE(expr) OVER (\n [ PARTITION BY partition_expression ]\n [ ORDER BY order_list ]\n) \n \nDescription\n----------- \nLAST_VALUE() evaluates all expressions and returns the last.\n \nThis is useful together with setting user variables to a\nvalue with @var:=expr, for example when you want to get data\nof rows updated/deleted without having to do two queries\nagainst the table.\n \nSince MariaDB 10.2.2, LAST_VALUE can be used as a window\nfunction.\n \nReturns NULL if no last value exists.\n \nExamples\n-------- \nCREATE TABLE t1 (a int, b int);\nINSERT INTO t1 VALUES(1,10),(2,20);\nDELETE FROM t1 WHERE a=1 AND last_value(@a:=a,@b:=b,1);\nSELECT @a,@b;\n \n+------+------+\n| @a | @b |\n+------+------+\n| 1 | 10 |\n+------+------+\n \nAs a window function:\n \nCREATE TABLE t1 (\n pk int primary key,\n a int,\n b int,\n c char(10),\n d decimal(10, 3),\n e real\n);\n \nINSERT INTO t1 VALUES\n( 1, 0, 1, \'one\', 0.1, 0.001),\n( 2, 0, 2, \'two\', 0.2, 0.002),\n( 3, 0, 3, \'three\', 0.3, 0.003),\n( 4, 1, 2, \'three\', 0.4, 0.004),\n( 5, 1, 1, \'two\', 0.5, 0.005),\n( 6, 1, 1, \'one\', 0.6, 0.006),\n( 7, 2, NULL, \'n_one\', 0.5, 0.007),\n( 8, 2, 1, \'n_two\', NULL, 0.008),\n( 9, 2, 2, NULL, 0.7, 0.009),\n(10, 2, 0, \'n_four\', 0.8, 0.010),\n(11, 2, 10, NULL, 0.9, NULL);\n \nSELECT pk, FIRST_VALUE(pk) OVER (ORDER BY pk) AS first_asc,\n LAST_VALUE(pk) OVER (ORDER BY pk) AS last_asc,\n FIRST_VALUE(pk) OVER (ORDER BY pk DESC) AS first_desc,\n LAST_VALUE(pk) OVER (ORDER BY pk DESC) AS last_desc\nFROM t1\nORDER BY pk DESC;\n \n+----+-----------+----------+------------+-----------+\n| pk | first_asc | last_asc | first_desc | last_desc |\n+----+-----------+----------+------------+-----------+\n| 11 | 1 | 11 | 11 | 11 |\n| 10 | 1 | 10 | 11 | 10 |\n| 9 | 1 | 9 | 11 | 9 |\n| 8 | 1 | 8 | 11 | 8 |\n| 7 | 1 | 7 | 11 | 7 |\n| 6 | 1 | 6 | 11 | 6 |\n| 5 | 1 | 5 | 11 | 5 |\n| 4 | 1 | 4 | 11 | 4 |\n| 3 | 1 | 3 | 11 | 3 |\n| 2 | 1 | 2 | 11 | 2 |\n| 1 | 1 | 1 | 11 | 1 |\n+----+-----------+----------+------------+-----------+\n \nCREATE OR REPLACE TABLE t1 (i int);\nINSERT INTO t1 VALUES\n(1),(2),(3),(4),(5),(6),(7),(8),(9),(10);\n \nSELECT i,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW\nand 1 FOLLOWING) AS f_1f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW and\n1 FOLLOWING) AS l_1f,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 PRECEDING\nAND 1 FOLLOWING) AS f_1p1f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 PRECEDING AND\n1 FOLLOWING) AS f_1p1f,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 2 PRECEDING\nAND 1 PRECEDING) AS f_2p1p,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 2 PRECEDING AND\n1 PRECEDING) AS f_2p1p,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 FOLLOWING\nAND 2 FOLLOWING) AS f_1f2f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 FOLLOWING AND\n2 FOLLOWING) AS f_1f2f\nFROM t1;\n \n+------+------+------+--------+--------+--------+--------+--------+--------+\n| i | f_1f | l_1f | f_1p1f | f_1p1f | f_2p1p | f_2p1p |\nf_1f2f | f_1f2f |\n+------+------+------+--------+--------+--------+--------+--------+--------+\n| 1 | 1 | 2 | 1 | 2 | NULL | NULL | 2 | 3 |\n| 2 | 2 | 3 | 1 | 3 | 1 | 1 | 3 | 4 |\n| 3 | 3 | 4 | 2 | 4 | 1 | 2 | 4 | 5 |\n| 4 | 4 | 5 | 3 | 5 | 2 | 3 | 5 | 6 |\n| 5 | 5 | 6 | 4 | 6 | 3 | 4 | 6 | 7 |\n| 6 | 6 | 7 | 5 | 7 | 4 | 5 | 7 | 8 |\n| 7 | 7 | 8 | 6 | 8 | 5 | 6 | 8 | 9 |\n| 8 | 8 | 9 | 7 | 9 | 6 | 7 | 9 | 10 |\n| 9 | 9 | 10 | 8 | 10 | 7 | 8 | 10 | 10 |\n| 10 | 10 | 10 | 9 | 10 | 8 | 9 | NULL | NULL |\n+------+------+------+--------+--------+--------+--------+--------+--------+\n \n\n\nURL: https://mariadb.com/kb/en/last_value/','','https://mariadb.com/kb/en/last_value/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (214,17,'PROCEDURE ANALYSE','Syntax\n------ \nanalyse([max_elements[,max_memory]])\n \nDescription\n----------- \nThis procedure is defined in the sql/sql_analyse.cc file. It\nexamines\nthe result from a query and returns an analysis of the\nresults that\nsuggests optimal data types for each column. To obtain this\nanalysis,\nappend PROCEDURE ANALYSE to the end of a SELECT statement:\n \nSELECT ... FROM ... WHERE ... PROCEDURE\nANALYSE([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\nthe query,\nand propose an optimal data type for the columns. This can\nbe helpful\nfor checking your existing tables, or after importing new\ndata. You\nmay need to try different settings for the arguments so that\nPROCEDURE\nANALYSE() does not suggest the ENUM data type when it is not\nappropriate.\n \nThe arguments are optional and are used as follows:\nmax_elements (default 256) is the maximum number of distinct\nvalues that analyse notices per column. This is used by\nanalyse to check whether the optimal data type should be of\ntype ENUM; if there are more than max_elements distinct\nvalues, then ENUM is not a suggested type.\nmax_memory (default 8192) is the maximum amount of memory\nthat analyse should allocate per column while trying to find\nall distinct values.\n \n\n\nURL: https://mariadb.com/kb/en/procedure-analyse/','','https://mariadb.com/kb/en/procedure-analyse/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (215,17,'ROW_COUNT','Syntax\n------ \nROW_COUNT()\n \nDescription\n----------- \nROW_COUNT() returns the number of rows updated, inserted or\ndeleted\nby the preceding statement. This is the same as the row\ncount that the\nmysql client displays and the value from the\nmysql_affected_rows() C\nAPI function.\n \nGenerally:\nFor statements which return a result set (such as SELECT,\nSHOW, DESC or HELP), returns -1, even when the result set is\nempty. This is also true for administrative statements, such\nas OPTIMIZE.\nFor DML statements other than SELECT and for ALTER TABLE,\nreturns the number of affected rows.\nFor DDL statements (including TRUNCATE) and for other\nstatements which don\'t return any result set (such as USE,\nDO, SIGNAL or DEALLOCATE PREPARE), returns 0.\n \nFor UPDATE, affected rows is by default the number of rows\nthat were actually changed. If the CLIENT_FOUND_ROWS flag to\nmysql_real_connect() is specified when connecting to mysqld,\naffected rows is instead the number of rows matched by the\nWHERE clause. \n \nFor REPLACE, deleted rows are also counted. So, if REPLACE\ndeletes a row and adds a new row, ROW_COUNT() returns 2.\n \nFor INSERT ... ON DUPLICATE KEY, updated rows are counted\ntwice. So, if INSERT adds a new rows and modifies another\nrow, ROW_COUNT() returns 3.\n \nROW_COUNT() does not take into account rows that are not\ndirectly deleted/updated by the last statement. This means\nthat rows deleted by foreign keys or triggers are not\ncounted.\n \nWarning: You can use ROW_COUNT() with prepared statements,\nbut you need to call it after EXECUTE, not after DEALLOCATE\nPREPARE, because the row count for allocate prepare is\nalways 0.\n \nWarning: When used after a CALL statement, this function\nreturns the number of rows affected by the last statement in\nthe procedure, not by the whole procedure.\n \nWarning: After INSERT DELAYED, ROW_COUNT() returns the\nnumber of the rows you tried to insert, not the number of\nthe successful writes.\n \nThis information can also be found in the diagnostics area.\n \nStatements using the ROW_COUNT() function are not safe for\nreplication.\n \nExamples\n-------- \nCREATE TABLE t (A INT);\n \nINSERT INTO t VALUES(1),(2),(3);\n \nSELECT ROW_COUNT();\n+-------------+\n| ROW_COUNT() |\n+-------------+\n| 3 |\n+-------------+\n \nDELETE FROM t WHERE A IN(1,2);\n \nSELECT ROW_COUNT(); \n+-------------+\n| ROW_COUNT() |\n+-------------+\n| 2 |\n+-------------+\n \nExample with prepared statements:\n \nSET @q = \'INSERT INTO t VALUES(1),(2),(3);\';\n \nPREPARE stmt FROM @q;\n \nEXECUTE stmt;\n \nQuery OK, 3 rows affected (0.39 sec)\nRecords: 3 Duplicates: 0 Warnings: 0\n \nSELECT ROW_COUNT();\n+-------------+\n| ROW_COUNT() |\n+-------------+\n| 3 |\n+-------------+\n \n\n\nURL: https://mariadb.com/kb/en/row_count/','','https://mariadb.com/kb/en/row_count/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (216,17,'SCHEMA','Syntax\n------ \nSCHEMA()\n \nDescription\n----------- \nThis function is a synonym for DATABASE().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/schema/','','https://mariadb.com/kb/en/schema/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (217,17,'SESSION_USER','Syntax\n------ \nSESSION_USER()\n \nDescription\n----------- \nSESSION_USER() is a synonym for USER().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/session_user/','','https://mariadb.com/kb/en/session_user/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (218,17,'SYSTEM_USER','Syntax\n------ \nSYSTEM_USER()\n \nDescription\n----------- \nSYSTEM_USER() is a synonym for USER().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/system_user/','','https://mariadb.com/kb/en/system_user/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (219,17,'USER','Syntax\n------ \nUSER()\n \nDescription\n----------- \nReturns the current MariaDB user name and host name, given\nwhen authenticating to MariaDB, as a string in the utf8\ncharacter set.\n \nNote that the value of USER() may differ from the value of\nCURRENT_USER(), which is the user used to authenticate the\ncurrent client. \nCURRENT_ROLE() returns the current active role.\n \nSYSTEM_USER() and SESSION_USER are synonyms for USER().\n \nStatements using the USER() function or one of its synonyms\nare not safe for statement level replication.\n \nExamples\n-------- \nshell> mysql --user=\"anonymous\"\n \nMariaDB [(none)]> select user(),current_user();\n+---------------------+----------------+\n| user() | current_user() |\n+---------------------+----------------+\n| anonymous@localhost | @localhost |\n+---------------------+----------------+\n \n\n\nURL: https://mariadb.com/kb/en/user/','','https://mariadb.com/kb/en/user/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (220,17,'VERSION','Syntax\n------ \nVERSION()\n \nDescription\n----------- \nReturns a string that indicates the MariaDB server version.\nThe string\nuses the utf8 character set.\n \nExamples\n-------- \nSELECT VERSION();\n+----------------+\n| VERSION() |\n+----------------+\n| 10.4.7-MariaDB |\n+----------------+\n \nThe VERSION() string may have one or more of the following\nsuffixes:\n \nSuffix | Description | \n \n-embedded | The server is an embedded server (libmysqld). | \n \n-log | General logging, slow logging or binary (replication)\nlogging is enabled. | \n \n-debug | The server is compiled for debugging. | \n \n-valgrind |  The server is compiled to be instrumented with\nvalgrind. | \n \nChanging the Version String\n \nSome old legacy code may break because they are parsing the\nVERSION string and expecting a MySQL string or a simple\nversion\nstring like Joomla til API17, see MDEV-7780.\n \nFrom MariaDB 10.2, one can fool these applications by\nsetting the version string from the command line or the\nmy.cnf files with --version=....\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/version/','','https://mariadb.com/kb/en/version/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (221,18,'Not Equal Operator','Syntax\n------ \n, !=\n \nDescription\n----------- \nNot equal operator. Evaluates both SQL expressions and\nreturns 1 if they are not equal and 0 if they are equal, or\nNULL if either expression is NULL. If the expressions return\ndifferent data types, (for instance, a number and a string),\nperforms type conversion.\n \nWhen used in row comparisons these two queries return the\nsame results:\n \nSELECT (t1.a, t1.b) != (t2.x, t2.y) \nFROM t1 INNER JOIN t2;\n \nSELECT (t1.a != t2.x) OR (t1.b != t2.y)\nFROM t1 INNER JOIN t2;\n \nExamples\n-------- \nSELECT \'.01\' \'0.01\';\n \n+-----------------+\n| \'.01\' \'0.01\' |\n+-----------------+\n| 1 |\n+-----------------+\n \nSELECT .01 \'0.01\';\n \n+---------------+\n| .01 \'0.01\' |\n+---------------+\n| 0 |\n+---------------+\n \nSELECT \'zapp\' \'zappp\';\n \n+-------------------+\n| \'zapp\' \'zappp\' |\n+-------------------+\n| 1 |\n+-------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/not-equal/','','https://mariadb.com/kb/en/not-equal/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (222,18,'&lt;','Syntax\n------ \n\n\nURL: https://mariadb.com/kb/en/less-than/','','https://mariadb.com/kb/en/less-than/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (223,18,'&lt;=','Syntax\n------ \n\n\nURL: https://mariadb.com/kb/en/less-than-or-equal/','','https://mariadb.com/kb/en/less-than-or-equal/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (224,18,'&lt;=&gt;','Syntax\n------ \n\n \nDescription\n----------- \nNULL-safe equal operator. It performs an equality comparison\nlike\nthe = operator, but returns 1 rather than NULL if both\noperands are\nNULL, and 0 rather than NULL if one operand is NULL.\n \na b is equivalent to a = b OR (a IS NULL AND b IS NULL).\n \nWhen used in row comparisons these two queries return the\nsame results:\n \nSELECT (t1.a, t1.b) (t2.x, t2.y) \nFROM t1 INNER JOIN t2;\n \nSELECT (t1.a t2.x) AND (t1.b t2.y)\nFROM t1 INNER JOIN t2;\n \nSee also NULL Values in MariaDB.\n \nExamples\n-------- \nSELECT 1 1, NULL NULL, 1 NULL;\n \n+---------+---------------+------------+\n| 1 1 | NULL NULL | 1 NULL |\n+---------+---------------+------------+\n| 1 | 1 | 0 |\n+---------+---------------+------------+\n \nSELECT 1 = 1, NULL = NULL, 1 = NULL;\n \n+-------+-------------+----------+\n| 1 = 1 | NULL = NULL | 1 = NULL |\n+-------+-------------+----------+\n| 1 | NULL | NULL |\n+-------+-------------+----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/null-safe-equal/','','https://mariadb.com/kb/en/null-safe-equal/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (225,18,'=','Syntax\n------ \nleft_expr = right_expr\n \nDescription\n----------- \nEqual operator. Evaluates both SQL expressions and returns 1\nif they are equal, 0 if they are not equal, or NULL if\neither expression is NULL. If the expressions return\ndifferent data types (for example, a number and a string), a\ntype conversion is performed.\n \nWhen used in row comparisons these two queries are\nsynonymous and return the same results:\n \nSELECT (t1.a, t1.b) = (t2.x, t2.y) FROM t1 INNER JOIN t2;\n \nSELECT (t1.a = t2.x) AND (t1.b = t2.y) FROM t1 INNER JOIN\nt2;\n \nTo perform a NULL-safe comparison, use the operator.\n \n= can also be used as an assignment operator.\n \nExamples\n-------- \nSELECT 1 = 0;\n \n+-------+\n| 1 = 0 |\n+-------+\n| 0 |\n+-------+\n \nSELECT \'0\' = 0;\n \n+---------+\n| \'0\' = 0 |\n+---------+\n| 1 |\n+---------+\n \nSELECT \'0.0\' = 0;\n \n+-----------+\n| \'0.0\' = 0 |\n+-----------+\n| 1 |\n+-----------+\n \nSELECT \'0.01\' = 0;\n \n+------------+\n| \'0.01\' = 0 |\n+------------+\n| 0 |\n+------------+\n \nSELECT \'.01\' = 0.01;\n \n+--------------+\n| \'.01\' = 0.01 |\n+--------------+\n| 1 |\n+--------------+\n \nSELECT (5 * 2) = CONCAT(\'1\', \'0\');\n+----------------------------+\n| (5 * 2) = CONCAT(\'1\', \'0\') |\n+----------------------------+\n| 1 |\n+----------------------------+\n \nSELECT 1 = NULL;\n \n+----------+\n| 1 = NULL |\n+----------+\n| NULL |\n+----------+\n \nSELECT NULL = NULL;\n \n+-------------+\n| NULL = NULL |\n+-------------+\n| NULL |\n+-------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/equal/','','https://mariadb.com/kb/en/equal/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (226,18,'&gt;','Syntax\n------ \n>\n \nDescription\n----------- \nGreater than operator. Evaluates both SQL expressions and\nreturns 1 if the left value is greater than the right value\nand 0 if it is not, or NULL if either expression is NULL. If\nthe expressions return different data types, (for instance,\na number and a string), performs type conversion.\n \nWhen used in row comparisons these two queries return the\nsame results:\n \nSELECT (t1.a, t1.b) > (t2.x, t2.y) \nFROM t1 INNER JOIN t2;\n \nSELECT (t1.a > t2.x) OR ((t1.a = t2.x) AND (t1.b > t2.y))\nFROM t1 INNER JOIN t2;\n \nExamples\n-------- \nSELECT 2 > 2;\n \n+-------+\n| 2 > 2 |\n+-------+\n| 0 |\n+-------+\n \nSELECT \'b\' > \'a\';\n \n+-----------+\n| \'b\' > \'a\' |\n+-----------+\n| 1 |\n+-----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/greater-than/','','https://mariadb.com/kb/en/greater-than/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (227,18,'&gt;=','Syntax\n------ \n>=\n \nDescription\n----------- \nGreater than or equal operator. Evaluates both SQL\nexpressions and returns 1 if the left value is greater than\nor equal to the right value and 0 if it is not, or NULL if\neither expression is NULL. If the expressions return\ndifferent data types, (for instance, a number and a string),\nperforms type conversion.\n \nWhen used in row comparisons these two queries return the\nsame results:\n \nSELECT (t1.a, t1.b) >= (t2.x, t2.y) \nFROM t1 INNER JOIN t2;\n \nSELECT (t1.a > t2.x) OR ((t1.a = t2.x) AND (t1.b >= t2.y))\nFROM t1 INNER JOIN t2;\n \nExamples\n-------- \nSELECT 2 >= 2;\n \n+--------+\n| 2 >= 2 |\n+--------+\n| 1 |\n+--------+\n \nSELECT \'A\' >= \'a\';\n \n+------------+\n| \'A\' >= \'a\' |\n+------------+\n| 1 |\n+------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/greater-than-or-equal/','','https://mariadb.com/kb/en/greater-than-or-equal/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (228,18,'BETWEEN AND','Syntax\n------ \nexpr BETWEEN min AND max\n \nDescription\n----------- \nIf expr is greater than or equal to min and expr is less\nthan or equal\nto max, BETWEEN returns 1, otherwise it returns 0. This is\nequivalent\nto the expression (min \n\nURL: https://mariadb.com/kb/en/between-and/','','https://mariadb.com/kb/en/between-and/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (229,18,'COALESCE','Syntax\n------ \nCOALESCE(value,...)\n \nDescription\n----------- \nReturns the first non-NULL value in the list, or NULL if\nthere are no\nnon-NULL values. At least one parameter must be passed.\n \nSee also NULL Values in MariaDB.\n \nExamples\n-------- \nSELECT COALESCE(NULL,1);\n+------------------+\n| COALESCE(NULL,1) |\n+------------------+\n| 1 |\n+------------------+\n \nSELECT COALESCE(NULL,NULL,NULL);\n+--------------------------+\n| COALESCE(NULL,NULL,NULL) |\n+--------------------------+\n| NULL |\n+--------------------------+\n \nWhen two arguments are given, COALESCE() is the same as\nIFNULL():\n \nSET @a=NULL, @b=1;\n \nSELECT COALESCE(@a, @b), IFNULL(@a, @b);\n+------------------+----------------+\n| COALESCE(@a, @b) | IFNULL(@a, @b) |\n+------------------+----------------+\n| 1 | 1 |\n+------------------+----------------+\n \nHex type confusion:\n \nCREATE TABLE t1 (a INT, b VARCHAR(10));\nINSERT INTO t1 VALUES (0x31, 0x61),(COALESCE(0x31),\nCOALESCE(0x61));\n \nSELECT * FROM t1;\n \n+------+------+\n| a | b |\n+------+------+\n| 49 | a |\n| 1 | a |\n+------+------+\n \nThe reason for the differing results above is that when 0x31\nis inserted directly to the column, it\'s treated as a\nnumber (see Hexadecimal Literals), while when 0x31 is passed\nto COALESCE(), it\'s treated as a string, because:\nHEX values have a string data type by default.\nCOALESCE() has the same data type as the argument. \n \n\n\nURL: https://mariadb.com/kb/en/coalesce/','','https://mariadb.com/kb/en/coalesce/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (230,18,'GREATEST','Syntax\n------ \nGREATEST(value1,value2,...)\n \nDescription\n----------- \nWith two or more arguments, returns the largest\n(maximum-valued)\nargument. The arguments are compared using the same rules as\nfor\nLEAST().\n \nExamples\n-------- \nSELECT GREATEST(2,0);\n+---------------+\n| GREATEST(2,0) |\n+---------------+\n| 2 |\n+---------------+\n \nSELECT GREATEST(34.0,3.0,5.0,767.0);\n+------------------------------+\n| GREATEST(34.0,3.0,5.0,767.0) |\n+------------------------------+\n| 767.0 |\n+------------------------------+\n \nSELECT GREATEST(\'B\',\'A\',\'C\');\n+-----------------------+\n| GREATEST(\'B\',\'A\',\'C\') |\n+-----------------------+\n| C |\n+-----------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/greatest/','','https://mariadb.com/kb/en/greatest/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (231,18,'IN','Syntax\n------ \nexpr IN (value,...)\n \nDescription\n----------- \nReturns 1 if expr is equal to any of the values in the IN\nlist, else\nreturns 0. If all values are constants, they are evaluated\naccording\nto the type of expr and sorted. The search for the item then\nis done\nusing a binary search. This means IN is very quick if the IN\nvalue\nlist consists entirely of constants. Otherwise, type\nconversion takes\nplace according to the rules described at Type Conversion,\nbut\napplied to all the arguments.\n \nIf expr is NULL, IN always returns NULL. If at least one of\nthe values in the list is NULL, and one of the comparisons\nis true, the result is 1. If at least one of the values in\nthe list is NULL and none of the comparisons is true, the\nresult is NULL.\n \nExamples\n-------- \nSELECT 2 IN (0,3,5,7);\n+----------------+\n| 2 IN (0,3,5,7) |\n+----------------+\n| 0 |\n+----------------+\n \nSELECT \'wefwf\' IN (\'wee\',\'wefwf\',\'weg\');\n+----------------------------------+\n| \'wefwf\' IN (\'wee\',\'wefwf\',\'weg\') |\n+----------------------------------+\n| 1 |\n+----------------------------------+ \n \nType conversion:\n \nSELECT 1 IN (\'1\', \'2\', \'3\');\n+----------------------+\n| 1 IN (\'1\', \'2\', \'3\') |\n+----------------------+\n| 1 |\n+----------------------+\n \nSELECT NULL IN (1, 2, 3);\n+-------------------+\n| NULL IN (1, 2, 3) |\n+-------------------+\n| NULL |\n+-------------------+\n \nMariaDB [(none)]> SELECT 1 IN (1, 2, NULL);\n+-------------------+\n| 1 IN (1, 2, NULL) |\n+-------------------+\n| 1 |\n+-------------------+\n \nMariaDB [(none)]> SELECT 5 IN (1, 2, NULL);\n+-------------------+\n| 5 IN (1, 2, NULL) |\n+-------------------+\n| NULL |\n+-------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/in/','','https://mariadb.com/kb/en/in/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (232,18,'INTERVAL','Syntax\n------ \nINTERVAL(N,N1,N2,N3,...)\n \nDescription\n----------- \nReturns the index of the last argument that is less than the\nfirst argument or is NULL. \n \nReturns 0 if N < N1, 1 if N < N2, 2 if N < N3 and so on or\n-1 if N is NULL. All\narguments are treated as integers. It is required that N1 <\nN2 < N3 \n\nURL: https://mariadb.com/kb/en/interval/','','https://mariadb.com/kb/en/interval/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (233,18,'IS','Syntax\n------ \nIS boolean_value\n \nDescription\n----------- \nTests a value against a boolean value, where boolean_value\ncan be\nTRUE, FALSE, or UNKNOWN.\n \nThere is an important difference between using IS TRUE or\ncomparing a value with TRUE using =. When using =, only 1\nequals to TRUE. But when using IS TRUE, all values which are\nlogically true (like a number > 1) return TRUE.\n \nExamples\n-------- \nSELECT 1 IS TRUE, 0 IS FALSE, NULL IS UNKNOWN;\n+-----------+------------+-----------------+\n| 1 IS TRUE | 0 IS FALSE | NULL IS UNKNOWN |\n+-----------+------------+-----------------+\n| 1 | 1 | 1 |\n+-----------+------------+-----------------+\n \nDifference between = and IS TRUE:\n \nSELECT 2 = TRUE, 2 IS TRUE;\n+----------+-----------+\n| 2 = TRUE | 2 IS TRUE |\n+----------+-----------+\n| 0 | 1 |\n+----------+-----------+\n \n\n\nURL: https://mariadb.com/kb/en/is/','','https://mariadb.com/kb/en/is/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (234,18,'IS NOT','Syntax\n------ \nIS NOT boolean_value\n \nDescription\n----------- \nTests a value against a boolean value, where boolean_value\ncan be\nTRUE, FALSE, or UNKNOWN. \n \nExamples\n-------- \nSELECT 1 IS NOT UNKNOWN, 0 IS NOT UNKNOWN, NULL IS NOT\nUNKNOWN;\n+------------------+------------------+---------------------+\n| 1 IS NOT UNKNOWN | 0 IS NOT UNKNOWN | NULL IS NOT UNKNOWN\n|\n+------------------+------------------+---------------------+\n| 1 | 1 | 0 |\n+------------------+------------------+---------------------+\n \nSELECT NULL IS NOT TRUE, NULL IS NOT FALSE;\n+------------------+-------------------+\n| NULL IS NOT TRUE | NULL IS NOT FALSE |\n+------------------+-------------------+\n| 1 | 1 |\n+------------------+-------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/is-not/','','https://mariadb.com/kb/en/is-not/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (235,18,'IS NOT NULL','Syntax\n------ \nIS NOT NULL\n \nDescription\n----------- \nTests whether a value is not NULL. See also NULL Values in\nMariaDB.\n \nExamples\n-------- \nSELECT 1 IS NOT NULL, 0 IS NOT NULL, NULL IS NOT NULL;\n+---------------+---------------+------------------+\n| 1 IS NOT NULL | 0 IS NOT NULL | NULL IS NOT NULL |\n+---------------+---------------+------------------+\n| 1 | 1 | 0 |\n+---------------+---------------+------------------+\n \n\n\nURL: https://mariadb.com/kb/en/is-not-null/','','https://mariadb.com/kb/en/is-not-null/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (236,18,'IS NULL','Syntax\n------ \nIS NULL\n \nDescription\n----------- \nTests whether a value is NULL. See also NULL Values in\nMariaDB.\n \nExamples\n-------- \nSELECT 1 IS NULL, 0 IS NULL, NULL IS NULL;\n+-----------+-----------+--------------+\n| 1 IS NULL | 0 IS NULL | NULL IS NULL |\n+-----------+-----------+--------------+\n| 0 | 0 | 1 |\n+-----------+-----------+--------------+\n \nCompatibility\n \nSome ODBC applications use the syntax auto_increment_field\nIS NOT NULL to find the latest row that was inserted with an\nautogenerated key value. If your applications need this, you\ncan set the sql_auto_is_null variable to 1.\n \nSET @@sql_auto_is_null=1;\nCREATE TABLE t1 (auto_increment_column INT NOT NULL\nAUTO_INCREMENT PRIMARY KEY);\nINSERT INTO t1 VALUES (NULL);\nSELECT * FROM t1 WHERE auto_increment_column IS NULL;\n \n+-----------------------+\n| auto_increment_column |\n+-----------------------+\n| 1 |\n+-----------------------+\n \n\n\nURL: https://mariadb.com/kb/en/is-null/','','https://mariadb.com/kb/en/is-null/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (237,18,'ISNULL','Syntax\n------ \nISNULL(expr)\n \nDescription\n----------- \nIf expr is NULL, ISNULL() returns 1, otherwise it returns 0.\n \nSee also NULL Values in MariaDB.\n \nExamples\n-------- \nSELECT ISNULL(1+1);\n+-------------+\n| ISNULL(1+1) |\n+-------------+\n| 0 |\n+-------------+\n \nSELECT ISNULL(1/0);\n+-------------+\n| ISNULL(1/0) |\n+-------------+\n| 1 |\n+-------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/isnull/','','https://mariadb.com/kb/en/isnull/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (238,18,'LEAST','Syntax\n------ \nLEAST(value1,value2,...)\n \nDescription\n----------- \nWith two or more arguments, returns the smallest\n(minimum-valued)\nargument. The arguments are compared using the following\nrules:\nIf the return value is used in an INTEGER context or all\narguments are integer-valued, they are compared as integers.\nIf the return value is used in a REAL context or all\narguments are real-valued, they are compared as reals.\nIf any argument is a case-sensitive string, the arguments\nare compared as case-sensitive strings.\nIn all other cases, the arguments are compared as\ncase-insensitive strings.\n \nLEAST() returns NULL if any argument is NULL.\n \nExamples\n-------- \nSELECT LEAST(2,0);\n+------------+\n| LEAST(2,0) |\n+------------+\n| 0 |\n+------------+\n \nSELECT LEAST(34.0,3.0,5.0,767.0);\n+---------------------------+\n| LEAST(34.0,3.0,5.0,767.0) |\n+---------------------------+\n| 3.0 |\n+---------------------------+\n \nSELECT LEAST(\'B\',\'A\',\'C\');\n+--------------------+\n| LEAST(\'B\',\'A\',\'C\') |\n+--------------------+\n| A |\n+--------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/least/','','https://mariadb.com/kb/en/least/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (239,18,'NOT BETWEEN','Syntax\n------ \nexpr NOT BETWEEN min AND max\n \nDescription\n----------- \nThis is the same as NOT (expr BETWEEN min AND max).\n \nNote that the meaning of the alternative form NOT expr\nBETWEEN min AND max is affected by the HIGH_NOT_PRECEDENCE\nSQL_MODE flag.\n \nExamples\n-------- \nSELECT 1 NOT BETWEEN 2 AND 3;\n+-----------------------+\n| 1 NOT BETWEEN 2 AND 3 |\n+-----------------------+\n| 1 |\n+-----------------------+\n \nSELECT \'b\' NOT BETWEEN \'a\' AND \'c\';\n+-----------------------------+\n| \'b\' NOT BETWEEN \'a\' AND \'c\' |\n+-----------------------------+\n| 0 |\n+-----------------------------+\n \nNULL:\n \nSELECT 1 NOT BETWEEN 1 AND NULL;\n+--------------------------+\n| 1 NOT BETWEEN 1 AND NULL |\n+--------------------------+\n| NULL |\n+--------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/not-between/','','https://mariadb.com/kb/en/not-between/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (240,18,'NOT IN','Syntax\n------ \nexpr NOT IN (value,...)\n \nDescription\n----------- \nThis is the same as NOT (expr IN (value,...)).\n \nExamples\n-------- \nSELECT 2 NOT IN (0,3,5,7);\n+--------------------+\n| 2 NOT IN (0,3,5,7) |\n+--------------------+\n| 1 |\n+--------------------+\n \nSELECT \'wefwf\' NOT IN (\'wee\',\'wefwf\',\'weg\');\n+--------------------------------------+\n| \'wefwf\' NOT IN (\'wee\',\'wefwf\',\'weg\') |\n+--------------------------------------+\n| 0 |\n+--------------------------------------+\n \nSELECT 1 NOT IN (\'1\', \'2\', \'3\');\n+--------------------------+\n| 1 NOT IN (\'1\', \'2\', \'3\') |\n+--------------------------+\n| 0 |\n+--------------------------+\n \nNULL:\n \nSELECT NULL NOT IN (1, 2, 3);\n+-----------------------+\n| NULL NOT IN (1, 2, 3) |\n+-----------------------+\n| NULL |\n+-----------------------+\n \nSELECT 1 NOT IN (1, 2, NULL);\n+-----------------------+\n| 1 NOT IN (1, 2, NULL) |\n+-----------------------+\n| 0 |\n+-----------------------+\n \nSELECT 5 NOT IN (1, 2, NULL);\n+-----------------------+\n| 5 NOT IN (1, 2, NULL) |\n+-----------------------+\n| NULL |\n+-----------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/not-in/','','https://mariadb.com/kb/en/not-in/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (241,19,'Operator Precedence','The precedence is the order in which the SQL operators are\nevaluated.\n \nThe following list shows the SQL operator precedence.\nOperators that appear first in the list have a higher\nprecedence. Operators which are listed together have the\nsame precedence.\nINTERVAL\nBINARY, COLLATE\n!\n- (unary minus), [[bitwise-not|]] (unary bit inversion)\n|| (string concatenation)\n^\n*, /, DIV, %, MOD\n-, +\n \n&\n|\n= (comparison), , >=, >, \n\nURL: https://mariadb.com/kb/en/operator-precedence/','','https://mariadb.com/kb/en/operator-precedence/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (242,19,'&amp;','Syntax\n------ \n&\n \nDescription\n----------- \nBitwise AND. Converts the values to binary and compares\nbits. Only if both the corresponding bits are 1 is the\nresulting bit also 1.\n \nSee also bitwise OR.\n \nExamples\n-------- \nSELECT 2&1;\n+-----+\n| 2&1 |\n+-----+\n| 0 |\n+-----+\n \nSELECT 3&1;\n+-----+\n| 3&1 |\n+-----+\n| 1 |\n+-----+\n \nSELECT 29 & 15;\n+---------+\n| 29 & 15 |\n+---------+\n| 13 |\n+---------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/bitwise_and/','','https://mariadb.com/kb/en/bitwise_and/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (243,19,'&lt;&lt;','Syntax\n------ \nvalue1 \n\nURL: https://mariadb.com/kb/en/shift-left/','','https://mariadb.com/kb/en/shift-left/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (244,19,'&gt;&gt;','Syntax\n------ \nvalue1 >> value2\n \nDescription\n----------- \nConverts a longlong (BIGINT) number (value1) to binary and\nshifts value2 units to the right.\n \nExamples\n-------- \nSELECT 4 >> 2;\n+--------+\n| 4 >> 2 |\n+--------+\n| 1 |\n+--------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/shift-right/','','https://mariadb.com/kb/en/shift-right/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (245,19,'BIT_COUNT','Syntax\n------ \nBIT_COUNT(N)\n \nDescription\n----------- \nReturns the number of bits that are set in the argument N.\n \nExamples\n-------- \nSELECT BIT_COUNT(29), BIT_COUNT(b\'101010\');\n+---------------+----------------------+\n| BIT_COUNT(29) | BIT_COUNT(b\'101010\') |\n+---------------+----------------------+\n| 4 | 3 |\n+---------------+----------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/bit_count/','','https://mariadb.com/kb/en/bit_count/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (246,19,'^','Syntax\n------ \n^\n \nDescription\n----------- \nBitwise XOR. Converts the values to binary and compares\nbits. If one (and only one) of the corresponding bits is 1\nis the resulting bit also 1.\n \nExamples\n-------- \nSELECT 1 ^ 1;\n+-------+\n| 1 ^ 1 |\n+-------+\n| 0 |\n+-------+\n \nSELECT 1 ^ 0;\n+-------+\n| 1 ^ 0 |\n+-------+\n| 1 |\n+-------+\n \nSELECT 11 ^ 3;\n+--------+\n| 11 ^ 3 |\n+--------+\n| 8 |\n+--------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/bitwise-xor/','','https://mariadb.com/kb/en/bitwise-xor/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (247,19,'|','Syntax\n------ \n|\n \nDescription\n----------- \nBitwise OR. Converts the values to binary and compares bits.\nIf either of the corresponding bits has a value of 1, the\nresulting bit is also 1.\n \nSee also bitwise AND.\n \nExamples\n-------- \nSELECT 2|1;\n+-----+\n| 2|1 |\n+-----+\n| 3 |\n+-----+\n \nSELECT 29 | 15;\n+---------+\n| 29 | 15 |\n+---------+\n| 31 |\n+---------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/bitwise-or/','','https://mariadb.com/kb/en/bitwise-or/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (248,19,'~','Syntax\n------ \n~\n \nDescription\n----------- \nBitwise NOT. Converts the value to 4 bytes binary and\ninverts all bits.\n \nExamples\n-------- \nSELECT 3 & ~1;\n+--------+\n| 3 & ~1 |\n+--------+\n| 2 |\n+--------+\n \nSELECT 5 & ~1;\n+--------+\n| 5 & ~1 |\n+--------+\n| 4 |\n+--------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/bitwise-not/','','https://mariadb.com/kb/en/bitwise-not/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (249,19,'Parentheses','Parentheses are sometimes called precedence operators - this\nmeans that they can be used to change the other operator\'s\nprecedence in an expression. The expressions that are\nwritten between parentheses are computed before the\nexpressions that are written outside. Parentheses must\nalways contain an expression (that is, they cannot be\nempty), and can be nested.\n \nFor example, the following expressions could return\ndifferent results:\nNOT a OR b\nNOT (a OR b)\n \nIn the first case, NOT applies to a, so if a is FALSE or b\nis TRUE, the expression returns TRUE. In the second case,\nNOT applies to the result of a OR b, so if at least one of a\nor b is TRUE, the expression is TRUE.\n \nWhen the precedence of operators is not intuitive, you can\nuse parentheses to make it immediately clear for whoever\nreads the statement.\n \nThe precedence of the NOT operator can also be affected by\nthe HIGH_NOT_PRECEDENCE SQL_MODE flag.\n \nOther uses\n \nParentheses must always be used to enclose subqueries.\n \nParentheses can also be used in a JOIN statement between\nmultiple tables to determine which tables must be joined\nfirst.\n \nAlso, parentheses are used to enclose the list of parameters\nto be passed to built-in functions, user-defined functions\nand stored routines. However, when no parameter is passed to\na stored procedure, parentheses are optional. For builtin\nfunctions and user-defined functions, spaces are not allowed\nbetween the function name and the open parenthesis, unless\nthe IGNORE_SPACE SQL_MODE is set. For stored routines (and\nfor functions if IGNORE_SPACE is set) spaces are allowed\nbefore the open parenthesis, including tab characters and\nnew line characters.\n \nSyntax errors\n \nIf there are more open parentheses than closed parentheses,\nthe error usually looks like this:\n \nERROR 1064 (42000): You have an error in your SQL syntax;\ncheck the manual that\ncorresponds to your MariaDB server version for the right\nsyntax to use near \'\' a\nt line 1\n \nNote the empty string.\n \nIf there are more closed parentheses than open parentheses,\nthe error usually looks like this:\n \nERROR 1064 (42000): You have an error in your SQL syntax;\ncheck the manual that\ncorresponds to your MariaDB server version for the right\nsyntax to use near \')\'\nat line 1\n \nNote the quoted closed parenthesis.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/parentheses/','','https://mariadb.com/kb/en/parentheses/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (250,19,'TRUE FALSE','Description\n----------- \nThe constants TRUE and FALSE evaluate to 1 and 0,\nrespectively. The\nconstant names can be written in any lettercase.\n \nExamples\n-------- \nSELECT TRUE, true, FALSE, false;\n \n+------+------+-------+-------+\n| TRUE | TRUE | FALSE | FALSE |\n+------+------+-------+-------+\n| 1 | 1 | 0 | 0 |\n+------+------+-------+-------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/true-false/','','https://mariadb.com/kb/en/true-false/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (251,20,'ANALYZE TABLE','Syntax\n------ \nANALYZE [NO_WRITE_TO_BINLOG | LOCAL] TABLE tbl_name\n[,tbl_name ...] \n [PERSISTENT FOR [ALL|COLUMNS ([col_name [,col_name ...]])] \n [INDEXES ([index_name [,index_name ...]])]] \n \nDescription\n----------- \nANALYZE TABLE analyzes and stores the key distribution for a\ntable (index statistics). During the analysis, the table is\nlocked with a read lock. This statement works with MyISAM,\nAria and InnoDB tables. For MyISAM tables, this statement is\nequivalent\nto using myisamchk --analyze.\n \nFor more information on how the analysis works within\nInnoDB, see\nInnoDB Limitations.\n \nMariaDB uses the stored key distribution to decide the order\nin which\ntables should be joined when you perform a join on something\nother than\na constant. In addition, key distributions can be used when\ndeciding\nwhich indexes to use for a specific table within a query.\n \nThis statement requires SELECT and INSERT privileges for the\ntable.\n \nBy default, ANALYZE TABLE statements are written to the\nbinary log and will be replicated. The NO_WRITE_TO_BINLOG\nkeyword (LOCAL is an alias) will ensure the statement is not\nwritten to the binary log. \n \nANALYZE TABLE is also supported for partitioned tables. You\ncan use ALTER TABLE ... ANALYZE PARTITION to analyze one or\nmore partitions.\n \nThe Aria storage engine supports progress reporting for the\nANALYZE TABLE statement.\n \nEngine-Independent Statistics\n \nIn MariaDB 10.0 and later, ANALYZE TABLE supports\nengine-independent statistics. See Engine-Independent Table\nStatistics: Collecting Statistics with the ANALYZE TABLE\nStatement for more information.\n \n\n\nURL: https://mariadb.com/kb/en/analyze-table/','','https://mariadb.com/kb/en/analyze-table/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (252,20,'CHECK TABLE','Syntax\n------ \nCHECK TABLE tbl_name [, tbl_name] ... [option] ...\n \noption = {FOR UPGRADE | QUICK | FAST | MEDIUM | EXTENDED |\nCHANGED}\n \nDescription\n----------- \nCHECK TABLE checks a table or tables for errors. CHECK TABLE\nworks for\nArchive, Aria, CSV, InnoDB, and MyISAM tables. For Aria and\nMyISAM tables, the\nkey statistics are updated as well. For CSV, see also\nChecking and Repairing CSV Tables.\n \nAs an alternative, myisamchk is a commandline tool for\nchecking MyISAM tables when the tables are not being\naccessed.\n \nFor checking dynamic columns integrity, COLUMN_CHECK() can\nbe used.\n \nCHECK TABLE can also check views for problems, such as\ntables\nthat are referenced in the view definition that no longer\nexist.\n \nCHECK TABLE is also supported for partitioned tables. You\ncan\nuse ALTER TABLE ... CHECK PARTITION \nto check one or more partitions.\n \nThe meaning of the different options are as follows - note\nthat this can vary a bit between\nstorage engines:\n \nFOR UPGRADE | Do a very quick check if the storage format\nfor the table has changed so that one needs to do a REPAIR.\nThis is only needed when one upgrades between major versions\nof MariaDB or MySQL. This is usually done by running\nmysql_upgrade. | \n \nFAST | Only check tables that has not been closed properly\nor are marked as corrupt. Only supported by the MyISAM and\nAria engines. For other engines the table is checked\nnormally | \n \nCHANGED | Check only tables that has changed since last\nREPAIR / CHECK. Only supported by the MyISAM and Aria\nengines. For other engines the table is checked normally. | \n \nQUICK | Do a fast check. For MyISAM and Aria engine this\nmeans we skip checking the delete link chain which may take\nsome time. | \n \nMEDIUM | Scan also the data files. Checks integrity between\ndata and index files with checksums. In most cases this\nshould find all possible errors. | \n \nEXTENDED | Does a full check to verify every possible error.\nFor MyISAM and Aria we verify for each row that all it keys\nexists and points to the row. This may take a long time on\nbig tables! | \n \nFor most cases running CHECK TABLE without options or MEDIUM\nshould be\ngood enough.\n \nSince MariaDB 5.3, the Aria storage engine supports progress\nreporting for this statement.\n \nIf you want to know if two tables are identical, take a look\nat CHECKSUM TABLE.\n \nXtraDB/InnoDB\n \nIf CHECK TABLE finds an error in an InnoDB table, MariaDB\nmight shutdown to prevent the error propagation. In this\ncase, the problem will be reported in the error log.\nOtherwise, since MariaDB 5.5, the table or an index might be\nmarked as corrupted, to prevent use. This does not happen\nwith some minor problems, like a wrong number of entries in\na secondary index. Those problems are reported in the output\nof CHECK TABLE.\n \nEach tablespace contains a header with metadata. This header\nis not checked by this statement.\n \nDuring the execution of CHECK TABLE, other threads may be\nblocked.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/sql-commands-check-table/','','https://mariadb.com/kb/en/sql-commands-check-table/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (253,20,'CHECK VIEW','CHECK VIEW was introduced in MariaDB 10.0.18.\n \nSyntax\n------ \nCHECK VIEW view_name\n \nDescription\n----------- \nThe CHECK VIEW statement was introduced in MariaDB 10.0.18\nto assist with fixing MDEV-6916, an issue introduced in\nMariaDB 5.2 where the view algorithms were swapped. It\nchecks whether the view algorithm is correct. It is run as\npart of mysql_upgrade, and should not normally be required\nin regular use.\n \n\n\nURL: https://mariadb.com/kb/en/check-view/','','https://mariadb.com/kb/en/check-view/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (254,20,'','URL: https://mariadb.com/kb/en/checksum-table/','','https://mariadb.com/kb/en/checksum-table/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (255,20,'OPTIMIZE TABLE','Syntax\n------ \nOPTIMIZE [NO_WRITE_TO_BINLOG | LOCAL] TABLE\n tbl_name [, tbl_name] ...\n [WAIT n | NOWAIT]\n \nDescription\n----------- \nOPTIMIZE TABLE has two main functions. It can either be used\nto defragment tables, or to update the InnoDB fulltext\nindex.\n \nWAIT/NOWAIT\n \nSet the lock wait timeout. See WAIT and NOWAIT.\n \nDefragmenting\n \nOPTIMIZE TABLE works for InnoDB (before MariaDB 10.1.1, only\nif the innodb_file_per_table server system variable is set),\nAria, MyISAM and ARCHIVE tables, and should be used if you\nhave deleted a large part of a table or if you have made\nmany changes to a table with variable-length\nrows (tables that have VARCHAR, VARBINARY, BLOB, or TEXT\ncolumns). Deleted rows are maintained in a\nlinked list and subsequent INSERT operations reuse old row\npositions.\n \nThis statement requires SELECT and INSERT privileges for the\ntable.\n \nBy default, OPTIMIZE TABLE statements are written to the\nbinary log and will be replicated. The NO_WRITE_TO_BINLOG\nkeyword (LOCAL is an alias) will ensure the statement is not\nwritten to the binary log. \n \nOPTIMIZE TABLE is also supported for partitioned tables. You\ncan use \nALTER TABLE ... OPTIMIZE PARTITION \nto optimize one or more partitions.\n \nYou can use OPTIMIZE TABLE to reclaim the unused\nspace and to defragment the data file. With other storage\nengines, OPTIMIZE TABLE does nothing by default, and returns\nthis message: \" The storage engine for the table doesn\'t\nsupport optimize\". However, if the server has been started\nwith the --skip-new option, OPTIMIZE TABLE is linked to\nALTER TABLE, and recreates the table. This operation frees\nthe unused space and updates index statistics.\n \nSince MariaDB 5.3, the Aria storage engine supports progress\nreporting for this statement.\n \nIf a MyISAM table is fragmented, concurrent inserts will not\nbe performed until an OPTIMIZE TABLE statement is executed\non that table, unless the concurrent_insert server system\nvariable is set to ALWAYS.\n \nUpdating an InnoDB fulltext index\n \nWhen rows are added or deleted to an InnoDB fulltext index,\nthe index is not immediately re-organized, as this can be an\nexpensive operation. Change statistics are stored in a\nseparate location . The fulltext index is only fully\nre-organized when an OPTIMIZE TABLE statement is run.\n \nBy default, an OPTIMIZE TABLE will defragment a table. In\norder to use it to update fulltext index statistics, the\ninnodb_optimize_fulltext_only system variable must be set to\n1. This is intended to be a temporary setting, and should be\nreset to 0 once the fulltext index has been re-organized.\n \nSince fulltext re-organization can take a long time, the\ninnodb_ft_num_word_optimize variable limits the\nre-organization to a number of words (2000 by default). You\ncan run multiple OPTIMIZE statements to fully re-organize\nthe index.\n \nDefragmenting InnoDB tablespaces\n \nMariaDB 10.1.1 merged the Facebook/Kakao defragmentation\npatch \n \nMariaDB 10.1.1 merged the Facebook/Kakao defragmentation\npatch, allowing one to use OPTIMIZE TABLE to defragment\nInnoDB tablespaces. For this functionality to be enabled,\nthe innodb_defragment system variable must be enabled. No\nnew tables are created and there is no need to copy data\nfrom old tables to new tables. Instead, this feature loads n\npages (determined by innodb-defragment-n-pages) and tries to\nmove records so that pages would be full of records and then\nfrees pages that are fully empty after the operation. Note\nthat tablespace files (including ibdata1) will not shrink as\nthe result of defragmentation, but one will get better\nmemory utilization in the InnoDB buffer pool as there are\nfewer data pages in use.\n \nSee Defragmenting InnoDB Tablespaces for more details.\n \n\n\nURL: https://mariadb.com/kb/en/optimize-table/','','https://mariadb.com/kb/en/optimize-table/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (256,20,'REPAIR TABLE','Syntax\n------ \nREPAIR [NO_WRITE_TO_BINLOG | LOCAL] TABLE\n tbl_name [, tbl_name] ...\n [QUICK] [EXTENDED] [USE_FRM]\n \nDescription\n----------- \nREPAIR TABLE repairs a possibly corrupted table. By default,\nit has the same effect as\n \nmyisamchk --recover tbl_name\n \nor\n \naria_chk --recover tbl_name\n \nSee aria_chk and myisamchk for more.\n \nREPAIR TABLE works for Archive, Aria, CSV and MyISAM tables.\nFor XtraDB/InnoDB, see recovery modes. For CSV, see also\nChecking and Repairing CSV Tables. For Archive, this\nstatement also improves compression. If the storage engine\ndoes not support this statement, a warning is issued.\n \nThis statement requires SELECT and INSERT privileges for the\ntable.\n \nBy default, REPAIR TABLE statements are written to the\nbinary log and will be replicated. The NO_WRITE_TO_BINLOG\nkeyword (LOCAL is an alias) will ensure the statement is not\nwritten to the binary log.\n \nWhen an index is recreated, the storage engine may use a\nconfigurable buffer in the process. Incrementing the buffer\nspeeds up the index creation. Aria and MyISAM allocate a\nbuffer whose size is defined by aria_sort_buffer_size or\nmyisam_sort_buffer_size, also used for ALTER TABLE.\n \nREPAIR TABLE is also supported for partitioned tables.\nHowever, the USE_FRM option cannot be used with this\nstatement\non a partitioned table.\n \n ALTER TABLE ... REPAIR PARTITION can be used\nto repair one or more partitions.\n \nThe Aria storage engine supports progress reporting for this\nstatement.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/repair-table/','','https://mariadb.com/kb/en/repair-table/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (257,20,'REPAIR VIEW','REPAIR VIEW was introduced in MariaDB 10.0.18 and MariaDB\n5.5.43.\n \nSyntax\n------ \nREPAIR [NO_WRITE_TO_BINLOG | LOCAL] VIEW view_name[,\nview_name] ... [FROM MYSQL]\n \nDescription\n----------- \nThe REPAIR VIEW statement was introduced to assist with\nfixing MDEV-6916, an issue introduced in MariaDB 5.2 where\nthe view algorithms were swapped compared to their MySQL on\ndisk representation. It checks whether the view algorithm is\ncorrect. It is run as part of mysql_upgrade, and should not\nnormally be required in regular use.\n \nBy default it corrects the checksum and if necessary adds\nthe mariadb-version field. If the optional FROM MYSQL clause\nis used, and no mariadb-version field is present, the MERGE\nand TEMPTABLE algorithms are toggled.\n \nBy default, REPAIR VIEW statements are written to the binary\nlog and will be replicated. The NO_WRITE_TO_BINLOG keyword\n(LOCAL is an alias) will ensure the statement is not written\nto the binary log.\n \nNote that REPAIR VIEW in MariaDB 10.0.18 and MariaDB 5.5.43\ncould crash the server (see MDEV-8115). Upgrade to a later\nversion.\n \n\n\nURL: https://mariadb.com/kb/en/repair-view/','','https://mariadb.com/kb/en/repair-view/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (258,21,'CREATE FUNCTION UDF','Syntax\n------ \nCREATE [OR REPLACE] [AGGREGATE] FUNCTION [IF NOT EXISTS]\nfunction_name\n RETURNS {STRING|INTEGER|REAL|DECIMAL}\n SONAME shared_library_name\n \nDescription\n----------- \nA user-defined function (UDF) is a way to extend MariaDB\nwith a new function\nthat works like a native (built-in) MariaDB function such as\nABS() or\nCONCAT().\n \nfunction_name is the name that should be used in SQL\nstatements to invoke\nthe function. \n \nTo create a function, you must have the INSERT privilege for\nthe\nmysql database. This is necessary because CREATE FUNCTION\nadds a row to the\nmysql.func system table that records the function\'s name,\ntype, and shared library name. If you do not have this\ntable, you should run\nthe mysql_upgrade command to create it.\n \nUDFs need to be written in C, C++ or another language that\nuses C calling\nconventions, MariaDB needs to have been dynamically\ncompiled, and your\noperating system must support dynamic loading.\n \nFor an example, see sql/udf_example.cc in the source tree.\nFor a collection of existing UDFs see\nhttp://www.mysqludf.org/.\n \nStatements making use of user-defined functions are not\nsafe for replication.\n \nFor creating a stored function as opposed to a user-defined\nfunction, see\nCREATE FUNCTION.\n \nFor valid identifiers to use as function names, see\nIdentifier Names.\n \nRETURNS\n \nThe RETURNS clause indicates the type of the function\'s\nreturn value, and can be one of STRING, INTEGER, REAL or\nDECIMAL. DECIMAL functions currently return string values\nand should be written like STRING functions.\n \nshared_library_name\n \nshared_library_name is the basename of the shared object\nfile that contains\nthe code that implements the function. The file must be\nlocated in the plugin\ndirectory. This directory is given by the value of the\nplugin_dir system variable. Note that\nbefore MariaDB/MySQL 5.1, the shared object could be located\nin any directory\nthat was searched by your system\'s dynamic linker.\n \nAGGREGATE\n \nAggregate functions are summary functions such as SUM() and\nAVG().\n \nAggregate UDF functions can be used as window functions.\n \nOR REPLACE\n \nThe OR REPLACE clause was added in MariaDB 10.1.3\n \nIf the optional OR REPLACE clause is used, it acts as a\nshortcut for:\n \nDROP FUNCTION IF EXISTS function_name;\n \nCREATE FUNCTION name ...;\n \nIF NOT EXISTS\n \nThe IF NOT EXISTS clause was added in MariaDB 10.1.3\n \nWhen the IF NOT EXISTS clause is used, MariaDB will return a\nwarning instead of an error if the specified function\nalready exists. Cannot be used together with OR REPLACE.\n \nUpgrading a UDF\n \nTo upgrade the UDF\'s shared library, first run a\nDROP FUNCTION statement, then upgrade the shared library and\nfinally run the CREATE FUNCTION statement. If you upgrade\nwithout following\nthis process, you may crash the server.\n \nExamples\n-------- \nCREATE FUNCTION jsoncontains_path RETURNS integer SONAME\n\'ha_connect.so\';\n \nQuery OK, 0 rows affected (0.00 sec)\n \nOR REPLACE and IF NOT EXISTS:\n \nCREATE FUNCTION jsoncontains_path RETURNS integer SONAME\n\'ha_connect.so\';\n \nERROR 1125 (HY000): Function \'jsoncontains_path\' already\nexists\n \nCREATE OR REPLACE FUNCTION jsoncontains_path RETURNS integer\nSONAME \'ha_connect.so\';\n \nQuery OK, 0 rows affected (0.00 sec)\n \nCREATE FUNCTION IF NOT EXISTS jsoncontains_path RETURNS\ninteger SONAME \'ha_connect.so\';\n \nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+-------+------+---------------------------------------------+\n| Level | Code | Message |\n+-------+------+---------------------------------------------+\n| Note | 1125 | Function \'jsoncontains_path\' already\nexists |\n+-------+------+---------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/create-function-udf/','','https://mariadb.com/kb/en/create-function-udf/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (259,21,'DROP FUNCTION UDF','Syntax\n------ \nDROP FUNCTION [IF EXISTS] function_name\n \nDescription\n----------- \nThis statement drops the user-defined function (UDF) named\nfunction_name.\n \nTo drop a function, you must have the DELETE privilege for\nthe mysql database. This is because DROP FUNCTION removes\nthe row from the mysql.func system table that records the\nfunction\'s name, type and shared library name.\n \nFor dropping a stored function, see DROP FUNCTION.\n \nUpgrading a UDF\n \nTo upgrade the UDF\'s shared library, first run a DROP\nFUNCTION statement, then upgrade the shared library and\nfinally run the CREATE FUNCTION statement. If you upgrade\nwithout following this process, you may crash the server.\n \nExamples\n-------- \nDROP FUNCTION jsoncontains_path;\n \nIF EXISTS:\n \nDROP FUNCTION jsoncontains_path;\n \nERROR 1305 (42000): FUNCTION test.jsoncontains_path does not\nexist\n \nDROP FUNCTION IF EXISTS jsoncontains_path;\n \nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+-------+------+------------------------------------------------+\n| Level | Code | Message |\n+-------+------+------------------------------------------------+\n| Note | 1305 | FUNCTION test.jsoncontains_path does not\nexist |\n+-------+------+------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/drop-function-udf/','','https://mariadb.com/kb/en/drop-function-udf/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (260,21,'Creating User-Defined Functions','User-defined functions allow MariaDB to be extended with a\nnew function that works like a native (built-in) MariaDB\nfunction such as ABS() or CONCAT(). There are alternative\nways to add a new function: writing a native function (which\nrequires modifying and compiling the server source code), or\nwriting a stored function.\n \nStatements making use of user-defined functions are not safe\nfor replication.\n \nFunctions are written in C or C++, and to make use of them,\nthe operating system must support dynamic loading. \n \nEach new SQL function requires corresponding functions\nwritten in C/C++. In the list below, at least the main\nfunction - x() - and one other, are required. x should be\nreplaced by the name of the function you are creating.\n \nAll functions need to be thread-safe, so not global or\nstatic variables that change can be allocated. Memory is\nallocated in x_init()/ and freed in x_deinit(). \n \nSimple Functions\n \nx()\n \nRequired for all UDF\'s, this is where the results are\ncalculated.\n \nC/C++ type | SQL type | \n \nchar * | STRING | \n \nlong long | INTEGER | \n \ndouble | REAL | \n \nDECIMAL functions return string values, and so should be\nwritten accordingly. It is not possible to create ROW\nfunctions.\n \nx_init()\n \nInitialization function for x(). Can be used for the\nfollowing:\nCheck the number of arguments to X() (the SQL equivalent).\nVerify the argument types, or to force arguments to be of a\nparticular type after the function is called.\nSpecify whether the result can be NULL.\nSpecify the maximum result length.\nFor REAL functions, specify the maximum number of decimals\nfor the result.\nAllocate any required memory.\n To verify that the arguments are of a required type or,\nalternatively, to tell MySQL to coerce arguments to the\nrequired types when the main function is called.\n \nx_deinit()\n \nDe-initialization function for x(). Used to de-allocate\nmemory that was allocated in x_init().\n \nDescription\n----------- \nEach time the SQL function X() is called:\nMariaDB will first call the C/C++ initialization function,\nx_init(), assuming it exists. All setup will be performed,\nand if it returns an error, the SQL statement is aborted and\nno further functions are called.\nIf there is no x_init() function, or it has been called and\ndid not return an error, x() is then called once per row.\nAfter all rows have finished processing, x_deinit() is\ncalled, if present, to clean up by de-allocating any memory\nthat was allocated in x_init().\nSee User-defined Functions Calling Sequences for more\ndetails on the functions.\n \nAggregate Functions\n \nThe following functions are required for aggregate\nfunctions, such as AVG() and SUM(). \n \nx_clear()\n \nUsed to reset the current aggregate, but without inserting\nthe argument as the initial aggregate value for the new\ngroup.\n \nx_add()\n \nUsed to add the argument to the current aggregate. \n \nx_remove()\n \nStaring from MariaDB 10.4 it improves the support of window\nfunctions (so it is not obligatory to add it) and should\nremove the argument from the current aggregate.\n \nDescription\n----------- \nEach time the aggregate SQL function X() is called:\nMariaDB will first call the C/C++ initialization function,\nx_init(), assuming it exists. All setup will be performed,\nand if it returns an error, the SQL statement is aborted and\nno further functions are called.\nIf there is no x_init() function, or it has been called and\ndid not return an error, x() is then called once per row.\nAfter all rows have finished processing, x_deinit() is\ncalled, if present, to clean up by de-allocating any memory\nthat was allocated in x_init().\n \nMariaDB will first call the C/C++ initialization function,\nx_init(), assuming it exists. All setup will be performed,\nand if it returns an error, the SQL statement is aborted and\nno further functions are called.\nThe table is sorted according to the GROUP BY expression.\nx_clear() is called for the first row of each new group.\nx_add() is called once per row for each row in the same\ngroup.\nx() is called when the group changes, or after the last row,\nto get the aggregate result. \nThe latter three steps are repeated until all rows have been\nprocessed.\nAfter all rows have finished processing, x_deinit() is\ncalled, if present, to clean up by de-allocating any memory\nthat was allocated in x_init().\n \nExamples\n-------- \nFor an example, see sql/udf_example.cc in the source tree.\nFor a collection of existing UDFs see\nhttps://github.com/mysqludf.\n \n\n\nURL:\nhttps://mariadb.com/kb/en/creating-user-defined-functions/','','https://mariadb.com/kb/en/creating-user-defined-functions/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (261,21,'User-Defined Functions Calling Sequences','The functions described in Creating User-defined Functions\nare expanded on this page. They are declared as follows:\n \nSimple Functions\n \nx()\n \nIf x() returns an integer, it is declared as follows:\n \nlong long x(UDF_INIT *initid, UDF_ARGS *args,\n char *is_null, char *error);\n \nIf x() returns a string (DECIMAL functions also return\nstring values), it is declared as follows:\n \nchar *x(UDF_INIT *initid, UDF_ARGS *args,\n char *result, unsigned long *length,\n char *is_null, char *error);\n \nIf x() returns a real, it is declared as follows:\n \ndouble x(UDF_INIT *initid, UDF_ARGS *args,\n char *is_null, char *error);\n \nx_init()\n \nmy_bool x_init(UDF_INIT *initid, UDF_ARGS *args, char\n*message);\n \nx_deinit()\n \nvoid x_deinit(UDF_INIT *initid);\n \nDescription\n----------- \ninitid is a parameter passed to all three functions that\npoints to a UDF_INIT structure, used for communicating\ninformation between the functions. Its structure members\nare:\nmy_bool maybe_null\nmaybe_null should be set to 1 if x_init can return a NULL\nvalue, Defaults to 1 if any arguments are declared\nmaybe_null.\n \nunsigned int decimals\nNumber of decimals after the decimal point. The default, if\nan explicit number of decimals is passed in the arguments to\nthe main function, is the maximum number of decimals, so if\n9.5, 9.55 and 9.555 are passed to the function, the default\nwould be three (based on 9.555, the maximum). If there are\nno explicit number of decimals, the default is set to 31, or\none more than the maximum for the DOUBLE, FLOAT and DECIMAL\ntypes. This default can be changed in the function to suit\nthe actual calculation.\n \nunsigned int max_length\nMaximum length of the result. For integers, the default is\n21. For strings, the length of the longest argument. For\nreals, the default is 13 plus the number of decimals\nindicated by initid->decimals. The length includes any signs\nor decimal points. Can also be set to 65KB or 16MB in order\nto return a BLOB. The memory remains unallocated, but this\nis used to decide on the data type to use if the data needs\nto be temporarily stored.\n \nchar *ptr\nA pointer for use as required by the function. Commonly,\ninitid->ptr is used to communicate allocated memory, with\nx_init() allocating the memory and assigning it to this\npointer, x() using it, and x_deinit() de-allocating it.\n \nmy_bool const_item\nShould be set to 1 in x_init() if x() always returns the\nsame value, otherwise 0.\n \n\nAggregate Functions\n \nx_clear()\n \nx_clear() is a required function for aggregate functions,\nand is declared as follows:\n \nvoid x_clear(UDF_INIT *initid, char *is_null, char *error);\n \nIt is called when the summary results need to be reset, that\nis at the beginning of each new group. but also to reset the\nvalues when there were no matching rows.\n \nis_null is set to point to CHAR(0) before calling x_clear().\n \nIn the case of an error, you can store the value to which\nthe error argument points (a single-byte variable, not a\nstring string buffer) in the variable.\n \nx_reset()\n \nx_reset() is declared as follows:\n \nvoid x_reset(UDF_INIT *initid, UDF_ARGS *args,\n char *is_null, char *error);\n \nIt is called on finding the first row in a new group. Should\nreset the summary variables, and then use UDF_ARGS as the\nfirst value in the group\'s internal summary value. The\nfunction is not required if the UDF interface uses\nx_clear().\n \nx_add()\n \nx_add() is declared as follows:\n \nvoid x_add(UDF_INIT *initid, UDF_ARGS *args,\n char *is_null, char *error);\n \nIt is called for all rows belonging to the same group, and\nshould be used to add the value in UDF_ARGS to the internal\nsummary variable.\n \nx_remove()\n \nx_remove() was added in MariaDB 10.4 and is declared as\nfollows (same as x_add()):\n \nvoid x_remove(UDF_INIT* initid, UDF_ARGS* args,\n char* is_null, char *error );\n \nIt adds more efficient support of aggregate UDFs as window\nfunctions. x_remove() should \"subtract\" the row (reverse\nx_add()). In MariaDB 10.4 aggregate UDFs will work as WINDOW\nfunctions without x_remove() but it will not be so\nefficient.\n \nIf x_remove() supported (defined) detected automatically.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/user-defined-functions-calling-sequences/','','https://mariadb.com/kb/en/user-defined-functions-calling-sequences/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (262,21,'User-Defined Functions Security','The MariaDB server imposes a number of limitations on\nuser-defined functions for security purposes.\nThe INSERT privilege for the mysql database is required to\nrun CREATE FUNCTION, as a record will be added to the\nmysql.func-table.\nThe DELETE privilege for the mysql database is required to\nrun DROP FUNCTION as the corresponding record will be\nremoved from the mysql.func-table.\nUDF object files can only be placed in the plugin directory,\nas specified by the value of the plugin_dir system variable.\nAt least one symbol, beyond the required x() - corresponding\nto an SQL function X()) - is required. These can be\nx_init(), x_deinit(), xxx_reset(), x_clear() and x_add()\nfunctions (see Creating User-defined Functions). The\nallow-suspicious-udfs mysqld option (by default unset)\nprovides a workaround, permitting only one symbol to be\nused. This is not recommended, as it opens the possibility\nof loading shared objects that are not legitimate\nuser-defined functions.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/user-defined-functions-security/','','https://mariadb.com/kb/en/user-defined-functions-security/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (263,21,'mysql.func Table','The mysql.func table stores information about user-defined\nfunctions (UDFs) created with the CREATE FUNCTION UDF\nstatement.\n \nIn MariaDB 10.4 and later, this table uses the Aria storage\nengine.\n \nMariaDB until 10.3\n \nIn MariaDB 10.3 and before, this table uses the MyISAM\nstorage engine.\n \nThe mysql.func table contains the following fields:\n \nField | Type | Null | Key | Default | Description | \n \nname | char(64) | NO | PRI | | UDF name | \n \nret | tinyint(1) | NO | | 0 | | \n \ndl | char(128) | NO | | | Shared library name | \n \ntype | enum(\'function\',\'aggregate\') | NO | | NULL |\nType, either function or aggregate. Aggregate functions are\nsummary functions such as SUM() and AVG(). | \n \nExample\n \nSELECT * FROM mysql.func;\n+------------------------------+-----+--------------+-----------+\n| name | ret | dl | type |\n+------------------------------+-----+--------------+-----------+\n| spider_direct_sql | 2 | ha_spider.so | function |\n| spider_bg_direct_sql | 2 | ha_spider.so | aggregate |\n| spider_ping_table | 2 | ha_spider.so | function |\n| spider_copy_tables | 2 | ha_spider.so | function |\n| spider_flush_table_mon_cache | 2 | ha_spider.so | function\n|\n+------------------------------+-----+--------------+-----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/mysqlfunc-table/','','https://mariadb.com/kb/en/mysqlfunc-table/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (264,22,'AUTO_INCREMENT','Description\n----------- \nThe AUTO_INCREMENT attribute can be used to generate a\nunique identity for new rows. When you insert a new record\nto the table, and the auto_increment field is NULL or\nDEFAULT, the value will automatically be incremented. This\nalso applies to 0, unless the NO_AUTO_VALUE_ON_ZERO SQL_MODE\nis enabled.\n \nAUTO_INCREMENT columns start from 1 by default. The\nautomatically generated value can never be lower than 0.\n \nEach table can have only one AUTO_INCREMENT column. It must\ndefined as a key (not necessarily the PRIMARY KEY or UNIQUE\nkey). In some storage engines (including the default\nInnoDB), if the key consists of multiple columns, the\nAUTO_INCREMENT column must be the first column. Storage\nengines that permit the column to be placed elsewhere are\nAria, MyISAM, MERGE, Spider, TokuDB, BLACKHOLE, FederatedX\nand Federated.\n \nCREATE 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 (\'fox\'),(\'whale\'),(\'ostrich\');\n \nSELECT * FROM animals;\n \n+----+---------+\n| id | name |\n+----+---------+\n| 1 | dog |\n| 2 | cat |\n| 3 | penguin |\n| 4 | fox |\n| 5 | whale |\n| 6 | ostrich |\n+----+---------+\n \nSERIAL is an alias for BIGINT UNSIGNED NOT NULL\nAUTO_INCREMENT UNIQUE.\n \nCREATE TABLE t (id SERIAL, c CHAR(1)) ENGINE=InnoDB;\n \nSHOW CREATE TABLE t \\G\n*************************** 1. row\n***************************\n Table: t\nCreate Table: CREATE TABLE `t` (\n `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,\n `c` char(1) DEFAULT NULL,\n UNIQUE KEY `id` (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=latin1\n \nSetting or Changing the Auto_Increment Value\n \nYou can use an ALTER TABLE statement to assign a new value\nto the auto_increment table option, or set the insert_id\nserver system variable to change the next AUTO_INCREMENT\nvalue inserted by the current session.\n \nLAST_INSERT_ID() can be used to see the last AUTO_INCREMENT\nvalue inserted by the current session.\n \nALTER TABLE animals AUTO_INCREMENT=8;\n \nINSERT INTO animals (name) VALUES (\'aardvark\');\n \nSELECT * FROM animals;\n \n+----+-----------+\n| id | name |\n+----+-----------+\n| 1 | dog |\n| 2 | cat |\n| 3 | penguin |\n| 4 | fox |\n| 5 | whale |\n| 6 | ostrich |\n| 8 | aardvark |\n+----+-----------+\n \nSET insert_id=12;\n \nINSERT INTO animals (name) VALUES (\'gorilla\');\n \nSELECT * FROM animals;\n \n+----+-----------+\n| id | name |\n+----+-----------+\n| 1 | dog |\n| 2 | cat |\n| 3 | penguin |\n| 4 | fox |\n| 5 | whale |\n| 6 | ostrich |\n| 8 | aardvark |\n| 12 | gorilla |\n+----+-----------+\n \nInnoDB/XtraDB\n \nUntil MariaDB 10.2.3, InnoDB and XtraDB used an\nauto-increment counter that is stored in memory. When the\nserver restarts, the counter is re-initialized to the\nhighest value used in the table, which cancels the effects\nof any AUTO_INCREMENT = N option in the table statements.\n \nFrom MariaDB 10.2.4, this restriction has been lifted and\nAUTO_INCREMENT is persistent.\n \nSee also AUTO_INCREMENT Handling in XtraDB/InnoDB.\n \nSetting Explicit Values\n \nIt is possible to specify a value for an AUTO_INCREMENT\ncolumn. The value must not exist in the key.\n \nIf the new value is higher than the current maximum value,\nthe AUTO_INCREMENT value is updated, so the next value will\nbe higher. If the new value is lower than the current\nmaximum value, the AUTO_INCREMENT value remains unchanged.\n \nThe following example demonstrates these behaviours:\n \nCREATE TABLE t (id INTEGER UNSIGNED AUTO_INCREMENT PRIMARY\nKEY) ENGINE = InnoDB;\n \nINSERT INTO t VALUES (NULL);\nSELECT id FROM t;\n \n+----+\n| id |\n+----+\n| 1 |\n+----+\n \nINSERT INTO t VALUES (10); -- higher value\nSELECT id FROM t;\n \n+----+\n| id |\n+----+\n| 1 |\n| 10 |\n+----+\n \nINSERT INTO t VALUES (2); -- lower value\nINSERT INTO t VALUES (NULL); -- auto value\nSELECT id FROM t;\n \n+----+\n| id |\n+----+\n| 1 |\n| 2 |\n| 10 |\n| 11 |\n+----+\n \nThe ARCHIVE storage engine does not allow to insert a value\nthat is lower than the current maximum.\n \nMissing Values\n \nAn AUTO_INCREMENT column normally has missing values. This\nhappens because if a row is deleted, or an AUTO_INCREMENT\nvalue is explicitly updated, old values are never re-used.\nThe REPLACE statement also deletes a row, and its value is\nwasted. With InnoDB, values can be reserved by a\ntransaction; but if the transaction fails (for example,\nbecause of a ROLLBACK) the reserved value will be lost.\n \nThus AUTO_INCREMENT values can be used to sort results in a\nchronological order, but not to create a numeric sequence.\n \nReplication\n \nTo make master-master or Galera safe to use AUTO_INCREMENT\none should use the system variables \n auto_increment_increment and auto_increment_offset to\ngenerate unique values for each server.\n \nCHECK Constraints, DEFAULT Values and Virtual Columns\n \nFrom MariaDB 10.2.6 auto_increment columns are no longer\npermitted in CHECK constraints, DEFAULT value expressions\nand virtual columns. They were permitted in earlier\nversions, but did not work correctly. See MDEV-11117.\n \n\n\nURL: https://mariadb.com/kb/en/auto_increment/','','https://mariadb.com/kb/en/auto_increment/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (265,22,'BIGINT','Syntax\n------ \nBIGINT[(M)] [SIGNED | UNSIGNED | ZEROFILL]\n \nDescription\n----------- \nA large integer. The signed range is -9223372036854775808 to\n9223372036854775807. The unsigned range is 0 to\n18446744073709551615.\n \nIf a column has been set to ZEROFILL, all values will be\nprepended by zeros so that the BIGINT value contains a\nnumber of M digits.\n \nNote: If the ZEROFILL attribute has been specified, the\ncolumn will automatically become UNSIGNED.\n \nFor more details on the attributes, see Numeric Data Type\nOverview.\n \nSERIAL is an alias for:\n \nBIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE\n \nExamples\n-------- \nCREATE TABLE bigints (a BIGINT,b BIGINT UNSIGNED,c BIGINT\nZEROFILL);\n \nINSERT INTO bigints VALUES (-10,-10,-10);\nQuery OK, 1 row affected, 2 warnings (0.08 sec)\nWarning (Code 1264): Out of range value for column \'b\' at\nrow 1\nWarning (Code 1264): Out of range value for column \'c\' at\nrow 1\n \nINSERT INTO bigints VALUES (-10,10,-10);Query OK, 1 row\naffected, 1 warning (0.08 sec)\nWarning (Code 1264): Out of range value for column \'c\' at\nrow 1\n \nINSERT INTO bigints VALUES (-10,10,10);\n \nINSERT INTO bigints VALUES\n(9223372036854775808,9223372036854775808,9223372036854775808);\nQuery OK, 1 row affected, 1 warning (0.07 sec)\nWarning (Code 1264): Out of range value for column \'a\' at\nrow 1\n \nINSERT INTO bigints VALUES\n(9223372036854775807,9223372036854775808,9223372036854775808);\n \nSELECT * FROM bigints;\n+---------------------+---------------------+----------------------+\n| a | b | c |\n+---------------------+---------------------+----------------------+\n| -10 | 0 | 00000000000000000000 |\n| -10 | 10 | 00000000000000000000 |\n| -10 | 10 | 00000000000000000010 |\n| 9223372036854775807 | 9223372036854775808 |\n09223372036854775808 |\n| 9223372036854775807 | 9223372036854775808 |\n09223372036854775808 |\n+---------------------+---------------------+----------------------+\n \n\n\nURL: https://mariadb.com/kb/en/bigint/','','https://mariadb.com/kb/en/bigint/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (266,22,'BINARY','Syntax\n------ \nBINARY(M)\n \nDescription\n----------- \nThe BINARY type is similar to the CHAR type, but stores\nbinary\nbyte strings rather than non-binary character strings. M\nrepresents the\ncolumn length in bytes.\n \nIt contains no character set, and comparison and sorting are\nbased on the numeric value of the bytes.\n \nIf the maximum length is exceeded, and SQL strict mode is\nnot enabled , the extra characters will be dropped with a\nwarning. If strict mode is enabled, an error will occur.\n \nBINARY values are right-padded with 0x00 (the zero byte) to\nthe specified length when inserted. The padding is not\nremoved on select, so this needs to be taken into account\nwhen sorting and comparing, where all bytes are significant.\nThe zero byte, 0x00 is less than a space for comparison\npurposes.\n \nExamples\n-------- \nInserting too many characters, first with strict mode off,\nthen with it on:\n \nCREATE TABLE bins (a BINARY(10));\n \nINSERT INTO bins VALUES(\'12345678901\');\nQuery OK, 1 row affected, 1 warning (0.04 sec)\n \nSELECT * FROM bins;\n \n+------------+\n| a |\n+------------+\n| 1234567890 |\n+------------+\n \nSET sql_mode=\'STRICT_ALL_TABLES\';\n \nINSERT INTO bins VALUES(\'12345678901\');\nERROR 1406 (22001): Data too long for column \'a\' at row 1\n \nSorting is performed with the byte value:\n \nTRUNCATE bins;\n \nINSERT INTO bins VALUES(\'A\'),(\'B\'),(\'a\'),(\'b\');\n \nSELECT * FROM bins ORDER BY a;\n \n+------+\n| a |\n+------+\n| A |\n| B |\n| a |\n| b |\n+------+\n \nUsing CAST to sort as a CHAR instead:\n \nSELECT * FROM bins ORDER BY CAST(a AS CHAR);\n+------+\n| a |\n+------+\n| a |\n| A |\n| b |\n| B |\n+------+\n \nThe field is a BINARY(10), so padding of two \'\\0\'s are\ninserted, causing comparisons that don\'t take this into\naccount to fail:\n \nTRUNCATE bins;\n \nINSERT INTO bins VALUES(\'12345678\');\n \nSELECT a = \'12345678\', a = \'12345678\\0\\0\' from bins;\n \n+----------------+--------------------+\n| a = \'12345678\' | a = \'12345678\\0\\0\' |\n+----------------+--------------------+\n| 0 | 1 |\n+----------------+--------------------+\n \n\n\nURL: https://mariadb.com/kb/en/binary/','','https://mariadb.com/kb/en/binary/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (267,22,'BIT','Syntax\n------ \nBIT[(M)]\n \nDescription\n----------- \nA bit-field type. M indicates the number of bits per value,\nfrom 1 to\n64. The default is 1 if M is omitted.\n \nBit values can be inserted with b\'value\' notation, where\nvalue is the bit value in 0\'s and 1\'s.\n \nBit fields are automatically zero-padded from the left to\nthe full length of the bit, so for example in a BIT(4)\nfield, \'10\' is equivalent to \'0010\'.\n \nBits are returned as binary, so to display them, either add\n0, or use a function such as HEX, OCT or BIN to convert\nthem.\n \nExamples\n-------- \nCREATE TEMPORARY TABLE b ( b1 BIT(8) );\nINSERT INTO b VALUES\n(b\'11111111\'),(b\'01010101\'),(b\'1111111111111\');\nQuery OK, 3 rows affected, 1 warning (0.10 sec)\nRecords: 3 Duplicates: 0 Warnings: 1\n \nSHOW WARNINGS;\n+---------+------+---------------------------------------------+\n| Level | Code | Message |\n+---------+------+---------------------------------------------+\n| Warning | 1264 | Out of range value for column \'b1\' at\nrow 3 |\n+---------+------+---------------------------------------------+\n \nSELECT b1+0, HEX(b1), OCT(b1), BIN(b1) FROM b;\n+------+---------+---------+----------+\n| b1+0 | HEX(b1) | OCT(b1) | BIN(b1) |\n+------+---------+---------+----------+\n| 255 | FF | 377 | 11111111 |\n| 85 | 55 | 125 | 1010101 |\n| 255 | FF | 377 | 11111111 |\n+------+---------+---------+----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/bit/','','https://mariadb.com/kb/en/bit/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (268,22,'BLOB','Syntax\n------ \nBLOB[(M)]\n \nDescription\n----------- \nA BLOB column with a maximum length of 65,535 (216 - 1)\nbytes. Each\nBLOB value is stored using a two-byte length prefix that\nindicates the\nnumber of bytes in the value.\n \nAn optional length M can be given for this type. If this is\ndone,\nMariaDB creates the column as the smallest BLOB type large\nenough to\nhold values M bytes long.\n \nBLOBS can also be used to store dynamic columns.\n \nBefore MariaDB 10.2.1, BLOB and TEXT columns could not be\nassigned a DEFAULT value. This restriction was lifted in\nMariaDB 10.2.1.\n \nIndexing\n \nIn MariaDB 10.4, it is possible to set a Unique index on a\ncolumn that uses the BLOB data type. In previous releases\nthis was not possible, as the index would only guarantee the\nuniqueness of a fixed number of characters.\n \nOracle Mode\n \nIn Oracle mode from MariaDB 10.3, BLOB is a synonym for\nLONGBLOB.\n \n\n\nURL: https://mariadb.com/kb/en/blob/','','https://mariadb.com/kb/en/blob/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (269,22,'BLOB and TEXT Data Types','Description\n----------- \nA BLOB is a binary large object that can hold a variable\namount of\ndata. The four BLOB types are \nTINYBLOB,\nBLOB, \nMEDIUMBLOB, and\nLONGBLOB.\n \nThese differ only in the maximum length of the values they\ncan hold. \n \nThe TEXT types are \nTINYTEXT,\nTEXT,\nMEDIUMTEXT, and\nLONGTEXT.\nJSON (alias for LONGTEXT)\n \nThese correspond to the four BLOB types and have the same\nmaximum lengths and storage requirements.\n \nStarting from MariaDB 10.2.1, BLOB and TEXT columns can have\na DEFAULT value.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/blob-and-text-data-types/','','https://mariadb.com/kb/en/blob-and-text-data-types/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (270,22,'BOOLEAN','Syntax\n------ \nBOOL, BOOLEAN\n \nDescription\n----------- \nThese types are synonyms for TINYINT(1). \nA value of zero is considered false. Non-zero values are\nconsidered 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\nand 0,\nrespectively, as shown here:\n \nmysql> SELECT IF(0 = FALSE, \'true\', \'false\');\n \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 \nUNKNOWN is an alias for NULL.\n \nThe last two statements display the results shown because 2\nis equal\nto neither 1 nor 0.\n \n\n\nURL: https://mariadb.com/kb/en/boolean/','','https://mariadb.com/kb/en/boolean/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (271,22,'CHAR','This article covers the CHAR data type. See CHAR Function\nfor the function.\n \nSyntax\n------ \n[NATIONAL] CHAR[(M)] [CHARACTER SET charset_name] [COLLATE\ncollation_name]\n \nDescription\n----------- \nA fixed-length string that is always right-padded with\nspaces to the specified\nlength when stored. M represents the column length in\ncharacters. The range\nof M is 0 to 255. If M is omitted, the length is 1.\n \nCHAR(0) columns can contain 2 values: an empty string or\nNULL. Such columns cannot be part of an index. The CONNECT\nstorage engine does not support CHAR(0).\n \nNote: Trailing spaces are removed when CHAR values are\nretrieved\nunless the PAD_CHAR_TO_FULL_LENGTH SQL mode is enabled.\n \nBefore MariaDB 10.2, all collations were of type PADSPACE,\nmeaning that CHAR (as well as VARCHAR and TEXT) values are\ncompared without regard for trailing spaces. This does not\napply to the LIKE pattern-matching operator, which takes\ninto account trailing spaces.\n \nIf a unique index consists of a column where trailing pad\ncharacters are stripped or ignored, inserts into that column\nwhere values differ only by the number of trailing pad\ncharacters will result in a duplicate-key error.\n \nExamples\n-------- \nTrailing spaces:\n \nCREATE TABLE strtest (c CHAR(10));\nINSERT INTO strtest VALUES(\'Maria \');\n \nSELECT c=\'Maria\',c=\'Maria \' FROM strtest;\n \n+-----------+--------------+\n| c=\'Maria\' | c=\'Maria \' |\n+-----------+--------------+\n| 1 | 1 |\n+-----------+--------------+\n \nSELECT c LIKE \'Maria\',c LIKE \'Maria \' FROM strtest;\n \n+----------------+-------------------+\n| c LIKE \'Maria\' | c LIKE \'Maria \' |\n+----------------+-------------------+\n| 1 | 0 |\n+----------------+-------------------+\n \nNO PAD Collations\n \nNO PAD collations regard trailing spaces as normal\ncharacters. You can get a list of all NO PAD collations by\nquerying the Information Schema Collations table, for\nexample:\n \nSELECT collation_name FROM information_schema.collations \n WHERE collation_name LIKE \"%nopad%\";\n \n+------------------------------+\n| collation_name |\n+------------------------------+\n| big5_chinese_nopad_ci |\n| big5_nopad_bin |\n...\n \n\n\nURL: https://mariadb.com/kb/en/char/','','https://mariadb.com/kb/en/char/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (272,22,'CHAR BYTE','Description\n----------- \nThe CHAR BYTE data type is an alias for the \nBINARY data type. This is a\ncompatibility feature.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/char-byte/','','https://mariadb.com/kb/en/char-byte/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (273,22,'DATE','Syntax\n------ \nDATE\n \nDescription\n----------- \nA date. The supported range is \'1000-01-01\' to\n\'9999-12-31\'. MariaDB\ndisplays DATE values in \'YYYY-MM-DD\' format, but can be\nassigned dates in looser formats, including strings or\nnumbers, as long as they make sense. These include a short\nyear, YY-MM-DD, no delimiters, YYMMDD, or any other\nacceptable delimiter, for example YYYY/MM/DD. For details,\nsee date and time literals.\n \n\'0000-00-00\' is a permitted special value (zero-date),\nunless the NO_ZERO_DATE SQL_MODE is used. Also, individual\ncomponents of a date can be set to 0 (for example:\n\'2015-00-12\'), unless the NO_ZERO_IN_DATE SQL_MODE is\nused. In many cases, the result of en expression involving a\nzero-date, or a date with zero-parts, is NULL. If the\nALLOW_INVALID_DATES SQL_MODE is enabled, if the day part is\nin the range between 1 and 31, the date does not produce any\nerror, even for months that have less than 31 days.\n \nExamples\n-------- \nCREATE TABLE t1 (d DATE);\n \nINSERT INTO t1 VALUES (\"2010-01-12\"), (\"2011-2-28\"),\n(\'120314\'),(\'13*04*21\');\n \nSELECT * FROM t1;\n \n+------------+\n| d |\n+------------+\n| 2010-01-12 |\n| 2011-02-28 |\n| 2012-03-14 |\n| 2013-04-21 |\n+------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/date/','','https://mariadb.com/kb/en/date/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (274,22,'DATETIME','Syntax\n------ \nDATETIME [(microsecond precision)]\n \nDescription\n----------- \nA date and time combination. The supported range is\n\'1000-01-01 00:00:00.000000\' to \'9999-12-31\n23:59:59.999999\'.\nMariaDB displays DATETIME values in \'YYYY-MM-DD HH:MM:SS\'\nformat, but\nallows assignment of values to DATETIME columns using either\nstrings or\nnumbers. For details, see date and time literals.\n \nThe microsecond precision can be from 0-6. If not specified\n0 is used.\n \n\'0000-00-00\' is a permitted special value (zero-date),\nunless the NO_ZERO_DATE SQL_MODE is used. Also, individual\ncomponents of a date can be set to 0 (for example:\n\'2015-00-12\'), unless the NO_ZERO_IN_DATE SQL_MODE is\nused. In many cases, the result of en expression involving a\nzero-date, or a date with zero-parts, is NULL. If the\nALLOW_INVALID_DATES SQL_MODE is enabled, if the day part is\nin the range between 1 and 31, the date does not produce any\nerror, even for months that have less than 31 days.\n \nSince MariaDB 10.0.1, DATETIME columns also accept\nCURRENT_TIMESTAMP as the default value.\n \nMariaDB 10.1.2 introduced the --mysql56-temporal-format\noption, on by default, which allows MariaDB to store\nDATETMEs using the same low-level format MySQL 5.6 uses. For\nmore information, see Internal Format, below.\n \nFor storage requirements, see Data Type Storage\nRequirements.\n \nOracle Mode\n \nIn Oracle mode from MariaDB 10.3, DATE with a time portion\nis a synonym for DATETIME.\n \nInternal Format\n \nIn MariaDB 10.1.2 a new temporal format was introduced from\nMySQL 5.6 that alters how the TIME, DATETIME and TIMESTAMP\ncolumns operate at lower levels. These changes allow these\ntemporal data types to have fractional parts and negative\nvalues. You can disable this feature using the\nmysql56_temporal_format system variable.\n \nTables that include TIMESTAMP values that were created on an\nolder version of MariaDB or that were created while the\nmysql56_temporal_format system variable was disabled\ncontinue to store data using the older data type format.\n \nIn order to update table columns from the older format to\nthe newer format, execute an ALTER TABLE... MODIFY COLUMN\nstatement that changes the column to the *same* data type.\nThis change may be needed if you want to export the table\'s\ntablespace and import it onto a server that has\nmysql56_temporal_format=ON set (see MDEV-15225).\n \nFor instance, if you have a DATETIME column in your table: \n \nSHOW VARIABLES LIKE \'mysql56_temporal_format\';\n \n+-------------------------+-------+\n| Variable_name | Value |\n+-------------------------+-------+\n| mysql56_temporal_format | ON |\n+-------------------------+-------+\n \nALTER TABLE example_table MODIFY ts_col DATETIME;\n \nWhen MariaDB executes the ALTER TABLE statement, it converts\nthe data from the older temporal format to the newer one. \n \nIn the event that you have several tables and columns using\ntemporal data types that you want to switch over to the new\nformat, make sure the system variable is enabled, then\nperform a dump and restore using mysqldump. The columns\nusing relevant temporal data types are restored using the\nnew temporal format.\n \nExamples\n-------- \nCREATE TABLE t1 (d DATETIME);\n \nINSERT INTO t1 VALUES (\"2011-03-11\"), (\"2012-04-19\n13:08:22\"),\n (\"2013-07-18 13:44:22.123456\");\n \nSELECT * FROM t1;\n \n+---------------------+\n| d |\n+---------------------+\n| 2011-03-11 00:00:00 |\n| 2012-04-19 13:08:22 |\n| 2013-07-18 13:44:22 |\n+---------------------+\n \nCREATE TABLE t2 (d DATETIME(6));\n \nINSERT INTO t2 VALUES (\"2011-03-11\"), (\"2012-04-19\n13:08:22\"),\n (\"2013-07-18 13:44:22.123456\");\n \nSELECT * FROM t2;\n \n+----------------------------+\n| d |\n+----------------------------+\n| 2011-03-11 00:00:00.000000 |\n| 2012-04-19 13:08:22.000000 |\n| 2013-07-18 13:44:22.123456 |\n+----------------------------++\n \nStrings used in datetime context are automatically converted\nto datetime(6). If you want to have a datetime without\nseconds, you should use CONVERT(..,datetime).\n \nSELECT CONVERT(\'2007-11-30 10:30:19\',datetime);\n+-----------------------------------------+\n| CONVERT(\'2007-11-30 10:30:19\',datetime) |\n+-----------------------------------------+\n| 2007-11-30 10:30:19 |\n+-----------------------------------------+\n \nSELECT CONVERT(\'2007-11-30 10:30:19\',datetime(6));\n+--------------------------------------------+\n| CONVERT(\'2007-11-30 10:30:19\',datetime(6)) |\n+--------------------------------------------+\n| 2007-11-30 10:30:19.000000 |\n+--------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/datetime/','','https://mariadb.com/kb/en/datetime/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (275,22,'DECIMAL','Syntax\n------ \nDECIMAL[(M[,D])] [SIGNED | UNSIGNED | ZEROFILL]\n \nDescription\n----------- \nA packed \"exact\" fixed-point number. M is the total number\nof digits (the\nprecision) and D is the number of digits after the decimal\npoint (the\nscale). The decimal point and (for negative numbers) the\n\"-\" sign are not\ncounted in M. If D is 0, values have no decimal point or\nfractional\npart and on INSERT the value will be rounded to the nearest\nDECIMAL. The maximum number of digits (M) for DECIMAL is 65.\nThe maximum number of supported decimals (D) is 30 before\nMariadB 10.2.1 and 38 afterwards. If D is omitted, the\ndefault is 0. If M is omitted, the default is 10.\n \nUNSIGNED, if specified, disallows negative values.\n \nZEROFILL, if specified, pads the number with zeros, up to\nthe total number\nof digits specified by M.\n \nAll basic calculations (+, -, *, /) with DECIMAL columns are\ndone with\na precision of 65 digits.\n \nFor more details on the attributes, see Numeric Data Type\nOverview.\n \nOracle Mode\n \nIn Oracle mode from MariaDB 10.3, NUMBER is a synonym.\n \nExamples\n-------- \nCREATE TABLE t1 (d DECIMAL UNSIGNED ZEROFILL);\n \nINSERT INTO t1 VALUES (1),(2),(3),(4.0),(5.2),(5.7);\nQuery OK, 6 rows affected, 2 warnings (0.16 sec)\nRecords: 6 Duplicates: 0 Warnings: 2\n \nNote (Code 1265): Data truncated for column \'d\' at row 5\nNote (Code 1265): Data truncated for column \'d\' at row 6\n \nSELECT * FROM t1;\n \n+------------+\n| d |\n+------------+\n| 0000000001 |\n| 0000000002 |\n| 0000000003 |\n| 0000000004 |\n| 0000000005 |\n| 0000000006 |\n+------------+\n \nINSERT INTO t1 VALUES (-7);\nERROR 1264 (22003): Out of range value for column \'d\' at\nrow 1\n \n\n\nURL: https://mariadb.com/kb/en/decimal/','','https://mariadb.com/kb/en/decimal/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (276,22,'ENUM','Syntax\n------ \nENUM(\'value1\',\'value2\',...) [CHARACTER SET charset_name]\n[COLLATE collation_name]\n \nDescription\n----------- \nAn enumeration. A string object that can have only one\nvalue, chosen\nfrom the list of values \'value1\', \'value2\', ..., NULL or\nthe special \n\'\' error value. In theory, an ENUM column can have a\nmaximum of 65,535 distinct\nvalues; in practice, the real maximum depends on many\nfactors. ENUM values are represented internally as integers.\n \nTrailing spaces are automatically stripped from ENUM values\non table creation.\n \nENUMs require relatively little storage space compared to\nstrings, either one or two bytes depending on the number of\nenumeration values.\n \nNULL and empty values\n \nAn ENUM can also contain NULL and empty values. If the ENUM\ncolumn is declared to permit NULL values, NULL becomes a\nvalid value, as well as the default value (see below). If\nstrict SQL Mode is not enabled, and an invalid value is\ninserted into an ENUM, a special empty string, with an index\nvalue of zero (see Numeric index, below), is inserted, with\na warning. This may be confusing, because the empty string\nis also a possible value, and the only difference if that in\nthis case its index is not 0. Inserting will fail with an\nerror if strict mode is active.\n \nIf a DEFAULT clause is missing, the default value will be:\nNULL is the column is nullable;\notherwise, the first value in the enumaration.\n \nNumeric index\n \nENUM values are indexed numerically in the order they are\ndefined, and sorting will be performed in this numeric\norder. We suggest not using ENUM to store numerals, as there\nis little to no storage space benefit, and it is easy to\nconfuse the enum integer with the enum numeral value by\nleaving out the quotes.\n \nAn ENUM defined as ENUM(\'apple\',\'orange\',\'pear\') would\nhave the following index values:\n \nIndex | Value | \n \nNULL | NULL | \n \n0 | \'\' | \n \n1 | \'apple\' | \n \n2 | \'orange\' | \n \n3 | \'pear\' | \n \nExamples\n-------- \nCREATE TABLE fruits (\n id INT NOT NULL auto_increment PRIMARY KEY,\n fruit ENUM(\'apple\',\'orange\',\'pear\'),\n bushels INT);\n \nDESCRIBE fruits;\n \n+---------+-------------------------------+------+-----+---------+----------------+\n| Field | Type | Null | Key | Default | Extra |\n+---------+-------------------------------+------+-----+---------+----------------+\n| id | int(11) | NO | PRI | NULL | auto_increment |\n| fruit | enum(\'apple\',\'orange\',\'pear\') | YES | | NULL\n| |\n| bushels | int(11) | YES | | NULL | |\n+---------+-------------------------------+------+-----+---------+----------------+\n \nINSERT INTO fruits\n (fruit,bushels) VALUES\n (\'pear\',20),\n (\'apple\',100),\n (\'orange\',25);\n \nINSERT INTO fruits\n (fruit,bushels) VALUES\n (\'avocado\',10);\nERROR 1265 (01000): Data truncated for column \'fruit\' at\nrow 1\n \nSELECT * FROM fruits;\n \n+----+--------+---------+\n| id | fruit | bushels |\n+----+--------+---------+\n| 1 | pear | 20 |\n| 2 | apple | 100 |\n| 3 | orange | 25 |\n+----+--------+---------+\n \nSelecting by numeric index:\n \nSELECT * FROM fruits WHERE fruit=2;\n \n+----+--------+---------+\n| id | fruit | bushels |\n+----+--------+---------+\n| 3 | orange | 25 |\n+----+--------+---------+\n \nSorting is according to the index value:\n \nCREATE TABLE enums (a ENUM(\'2\',\'1\'));\n \nINSERT INTO enums VALUES (\'1\'),(\'2\');\n \nSELECT * FROM enums ORDER BY a ASC;\n \n+------+\n| a |\n+------+\n| 2 |\n| 1 |\n+------+\n \nIt\'s easy to get confused between returning the enum\ninteger with the stored value, so we don\'t suggest using\nENUM to store numerals. The first example returns the 1st\nindexed field (\'2\' has an index value of 1, as it\'s\ndefined first), while the second example returns the string\nvalue \'1\'.\n \nSELECT * FROM enums WHERE a=1;\n \n+------+\n| a |\n+------+\n| 2 |\n+------+\n \nSELECT * FROM enums WHERE a=\'1\';\n \n+------+\n| a |\n+------+\n| 1 |\n+------+\n \n\n\nURL: https://mariadb.com/kb/en/enum/','','https://mariadb.com/kb/en/enum/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (277,22,'DOUBLE','Syntax\n------ \nDOUBLE[(M,D)] [SIGNED | UNSIGNED | ZEROFILL]\nDOUBLE PRECISION[(M,D)] [SIGNED | UNSIGNED | ZEROFILL]\nREAL[(M,D)] [SIGNED | UNSIGNED | ZEROFILL]\n \nDescription\n----------- \nA normal-size (double-precision) floating-point number (see\nFLOAT for a single-precision floating-point number).\n \nAllowable values are:\n-1.7976931348623157E+308 to -2.2250738585072014E-308\n0\n2.2250738585072014E-308 to 1.7976931348623157E+308\n \nThese are the theoretical limits, based on the IEEE\nstandard. The actual range\nmight be slightly smaller depending on your hardware or\noperating system.\n \nM is the total number of digits and D is the number of\ndigits\nfollowing the decimal point. If M and D are omitted, values\nare stored\nto the limits allowed by the hardware. A double-precision\nfloating-point number is accurate to approximately 15\ndecimal places.\n \nUNSIGNED, if specified, disallows negative values.\n \nZEROFILL, if specified, pads the number with zeros, up to\nthe total number\nof digits specified by M.\n \nREAL and DOUBLE PRECISION are synonyms, unless the\nREAL_AS_FLOAT SQL mode is enabled, in which case REAL is a\nsynonym for FLOAT rather than DOUBLE.\n \nSee Floating Point Accuracy for issues when using\nfloating-point numbers.\n \nFor more details on the attributes, see Numeric Data Type\nOverview.\n \nExamples\n-------- \nCREATE TABLE t1 (d DOUBLE(5,0) zerofill);\n \nINSERT INTO t1 VALUES (1),(2),(3),(4);\n \nSELECT * FROM t1;\n \n+-------+\n| d |\n+-------+\n| 00001 |\n| 00002 |\n| 00003 |\n| 00004 |\n+-------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/double/','','https://mariadb.com/kb/en/double/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (278,22,'FLOAT','Syntax\n------ \nFLOAT[(M,D)] [SIGNED | UNSIGNED | ZEROFILL]\n \nDescription\n----------- \nA small (single-precision) floating-point number (see DOUBLE\nfor a regular-size floating point number). Allowable values\nare:\n-3.402823466E+38 to -1.175494351E-38\n0\n1.175494351E-38 to 3.402823466E+38. \n \nThese are the theoretical limits, based on the IEEE \nstandard. The actual range might be slightly smaller\ndepending on your\nhardware or operating system.\n \nM is the total number of digits and D is the number of\ndigits\nfollowing the decimal point. If M and D are omitted, values\nare stored\nto the limits allowed by the hardware. A single-precision\nfloating-point number is accurate to approximately 7 decimal\nplaces.\n \nUNSIGNED, if specified, disallows negative values.\n \nUsing FLOAT might give you some unexpected problems because\nall\ncalculations in MariaDB are done with double precision. See\nFloating Point Accuracy.\n \nFor more details on the attributes, see Numeric Data Type\nOverview.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/float/','','https://mariadb.com/kb/en/float/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (279,22,'Geometry Types','Description\n----------- \nMariaDB provides a standard way of creating spatial columns\nfor geometry types,\nfor example, with CREATE TABLE or ALTER TABLE.\nCurrently, spatial columns are supported for MyISAM, InnoDB,\nNDB, and ARCHIVE\ntables. See also SPATIAL INDEX.\n \nThe basic geometry type is GEOMETRY. But the type can be\nmore specific. The following types are supported:\n \nGeometry Types | \n \nPOINT | \n \nLINESTRING | \n \nPOLYGON | \n \nMULTIPOINT | \n \nMULTILINESTRING | \n \nMULTIPOLYGON | \n \nGEOMETRYCOLLECTION | \n \nGEOMETRY | \n \nExamples\n-------- \nNote: For clarity, only one type is listed per table in the\nexamples below, but a table\nrow can contain multiple types. For example:\n \nCREATE TABLE object (shapeA POLYGON, shapeB LINESTRING);\n \nPOINT\n \nCREATE TABLE gis_point (g POINT);\nSHOW FIELDS FROM gis_point;\n \nINSERT INTO gis_point VALUES\n (PointFromText(\'POINT(10 10)\')),\n (PointFromText(\'POINT(20 10)\')),\n (PointFromText(\'POINT(20 20)\')),\n (PointFromWKB(AsWKB(PointFromText(\'POINT(10 20)\'))));\n \nLINESTRING\n \nCREATE TABLE gis_line (g LINESTRING);\nSHOW FIELDS FROM gis_line;\n \nINSERT INTO gis_line VALUES\n (LineFromText(\'LINESTRING(0 0,0 10,10 0)\')),\n (LineStringFromText(\'LINESTRING(10 10,20 10,20 20,10 20,10\n10)\')),\n (LineStringFromWKB(AsWKB(LineString(Point(10, 10),\nPoint(40, 10)))));\n \nPOLYGON\n \nCREATE TABLE gis_polygon (g POLYGON);\nSHOW FIELDS FROM gis_polygon;\n \nINSERT INTO gis_polygon VALUES\n (PolygonFromText(\'POLYGON((10 10,20 10,20 20,10 20,10\n10))\')),\n (PolyFromText(\'POLYGON((0 0,50 0,50 50,0 50,0 0), (10\n10,20 10,20 20,10 20,10 10))\')),\n (PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0),\nPoint(30, 0), Point(30, 30), Point(0, 0))))));\n \nMULTIPOINT\n \nCREATE TABLE gis_multi_point (g MULTIPOINT);\nSHOW FIELDS FROM gis_multi_point;\n \nINSERT INTO gis_multi_point VALUES\n (MultiPointFromText(\'MULTIPOINT(0 0,10 10,10 20,20\n20)\')),\n (MPointFromText(\'MULTIPOINT(1 1,11 11,11 21,21 21)\')),\n (MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4,\n10)))));\n \nMULTILINESTRING\n \nCREATE TABLE gis_multi_line (g MULTILINESTRING);\nSHOW FIELDS FROM gis_multi_line;\n \nINSERT INTO gis_multi_line VALUES\n (MultiLineStringFromText(\'MULTILINESTRING((10 48,10 21,10\n0),(16 0,16 23,16 48))\')),\n (MLineFromText(\'MULTILINESTRING((10 48,10 21,10 0))\')),\n (MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2),\nPoint(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21,\n7))))));\n \nMULTIPOLYGON\n \nCREATE TABLE gis_multi_polygon (g MULTIPOLYGON);\nSHOW FIELDS FROM gis_multi_polygon;\n \nINSERT INTO gis_multi_polygon VALUES\n (MultiPolygonFromText(\'MULTIPOLYGON(((28 26,28 0,84 0,84\n42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67\n13,59 13,59 18)))\')),\n (MPolyFromText(\'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28\n26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59\n13,59 18)))\')),\n (MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0,\n3), Point(3, 3), Point(3, 0), Point(0, 3)))))));\n \nGEOMETRYCOLLECTION\n \nCREATE TABLE gis_geometrycollection (g GEOMETRYCOLLECTION);\nSHOW FIELDS FROM gis_geometrycollection;\n \nINSERT INTO gis_geometrycollection VALUES\n (GeomCollFromText(\'GEOMETRYCOLLECTION(POINT(0 0),\nLINESTRING(0 0,10 10))\')),\n (GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6),\nLineString(Point(3, 6), Point(7, 9)))))),\n (GeomFromText(\'GeometryCollection()\')),\n (GeomFromText(\'GeometryCollection EMPTY\'));\n \nGEOMETRY\n \nCREATE TABLE gis_geometry (g GEOMETRY);\nSHOW FIELDS FROM gis_geometry;\n \nINSERT into gis_geometry SELECT * FROM gis_point;\n \nINSERT into gis_geometry SELECT * FROM gis_line;\n \nINSERT into gis_geometry SELECT * FROM gis_polygon;\n \nINSERT into gis_geometry SELECT * FROM gis_multi_point;\n \nINSERT into gis_geometry SELECT * FROM gis_multi_line;\n \nINSERT into gis_geometry SELECT * FROM gis_multi_polygon;\n \nINSERT into gis_geometry SELECT * FROM\ngis_geometrycollection;\n \n\n \n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/geometry-types/','','https://mariadb.com/kb/en/geometry-types/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (280,22,'JSON Data Type','The JSON alias was added in MariaDB 10.2.7. This was done to\nmake it possible to use JSON columns in statement based\nreplication from MySQL to MariaDB and to make it possible\nfor MariaDB to read mysqldumps from MySQL.\n \nJSON is an alias for LONGTEXT introduced for compatibility\nreasons with MySQL\'s JSON data type. MariaDB implements\nthis as a LONGTEXT rather, as the JSON data type contradicts\nthe SQL standard, and MariaDB\'s benchmarks indicate that\nperformance is at least equivalent.\n \nIn order to ensure that a a valid json document is inserted,\nthe JSON_VALID function can be used as a CHECK constraint.\nThis constraint is automatically included for types using\nthe JSON alias from MariaDB 10.4.3.\n \nExamples\n-------- \nCREATE TABLE t (j JSON);\n \nDESC t;\n+-------+----------+------+-----+---------+-------+\n| Field | Type | Null | Key | Default | Extra |\n+-------+----------+------+-----+---------+-------+\n| j | longtext | YES | | NULL | |\n+-------+----------+------+-----+---------+-------+\n \nWith validation:\n \nCREATE TABLE t2 (\n j JSON \n CHECK (JSON_VALID(j))\n);\n \nINSERT INTO t2 VALUES (\'invalid\');\nERROR 4025 (23000): CONSTRAINT `j` failed for `test`.`t2`\n \nINSERT INTO t2 VALUES (\'{\"id\": 1, \"name\":\n\"Monty\"}\');\nQuery OK, 1 row affected (0.13 sec)\n \nReplicating JSON Data Between MySQL and MariaDB\n \nThe JSON type in MySQL stores the JSON object in a compact\nform, not as LONGTEXT as in MariaDB.\nThis means that row based replication will not work for JSON\ntypes from MySQL to MariaDB.\n \nThere are a a few different ways to solve this:\nUse statement based replication.\nChange the JSON column to type TEXT in MySQL\n \nConverting a MySQL TABLE with JSON Fields to MariaDB\n \nMariaDB can\'t directly access MySQL\'s JSON format.\n \nThere are a a few different ways to move the table to\nMariaDB:\nChange the JSON column to type TEXT in MySQL. After this,\nMariaDB can directly use the table without any need for a\ndump and restore.\nUse mysqldump to copy the table.\n \nDifferences Between MySQL JSON Strings and MariaDB JSON\nStrings\n \nIn MySQL, JSON is an object and is compared according to\njson values. In MariaDB JSON strings are normal strings and\ncompared as strings. One exception is when using\nJSON_EXTRACT() in which case strings are unescaped before\ncomparison.\n \n\n\nURL: https://mariadb.com/kb/en/json-data-type/','','https://mariadb.com/kb/en/json-data-type/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (281,22,'LONGBLOB','Syntax\n------ \nLONGBLOB\n \nDescription\n----------- \nA BLOB column with a \nmaximum length of 4,294,967,295 bytes or 4GB (232 - 1). The\neffective maximum length of LONGBLOB columns depends on the\nconfigured maximum packet size in the client/server protocol\nand\navailable memory. Each LONGBLOB value is stored using a\nfour-byte\nlength prefix that indicates the number of bytes in the\nvalue.\n \nOracle Mode\n \nIn Oracle mode from MariaDB 10.3, BLOB is a synonym for\nLONGBLOB.\n \n\n\nURL: https://mariadb.com/kb/en/longblob/','','https://mariadb.com/kb/en/longblob/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (282,22,'LONGTEXT','Syntax\n------ \nLONGTEXT [CHARACTER SET charset_name] [COLLATE\ncollation_name]\n \nDescription\n----------- \nA TEXT column with a maximum length of 4,294,967,295 or 4GB\n(232 - 1) characters. The effective maximum length is less\nif the value contains multi-byte characters. The effective\nmaximum length of LONGTEXT columns also depends on the\nconfigured maximum packet size in the client/server protocol\nand available memory. Each LONGTEXT value is stored using a\nfour-byte length prefix that indicates the number of bytes\nin the value.\n \nFrom MariaDB 10.2.7, JSON is an alias for LONGTEXT. See JSON\nData Type for details.\n \nOracle Mode\n \nIn Oracle mode from MariaDB 10.3, CLOB is a synonym for\nLONGTEXT.\n \n\n\nURL: https://mariadb.com/kb/en/longtext/','','https://mariadb.com/kb/en/longtext/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (283,22,'MEDIUMBLOB','Syntax\n------ \nMEDIUMBLOB\n \nDescription\n----------- \nA BLOB column with a maximum\nlength of 16,777,215 (224 - 1) bytes.\nEach MEDIUMBLOB value is stored using a three-byte length\nprefix that\nindicates the number of bytes in the value. \n \n\n\nURL: https://mariadb.com/kb/en/mediumblob/','','https://mariadb.com/kb/en/mediumblob/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (284,22,'MEDIUMINT','Syntax\n------ \nMEDIUMINT[(M)] [SIGNED | UNSIGNED | ZEROFILL]\n \nDescription\n----------- \nA medium-sized integer. The signed range is -8388608 to\n8388607. The\nunsigned range is 0 to 16777215.\n \nZEROFILL pads the integer with zeroes and assumes UNSIGNED\n(even if UNSIGNED is not specified).\n \nFor details on the attributes, see Numeric Data Type\nOverview.\n \nExamples\n-------- \nCREATE TABLE mediumints (a MEDIUMINT,b MEDIUMINT UNSIGNED,c\nMEDIUMINT ZEROFILL);\n \nDESCRIBE mediumints;\n+-------+--------------------------------+------+-----+---------+-------+\n| Field | Type | Null | Key | Default | Extra |\n+-------+--------------------------------+------+-----+---------+-------+\n| a | mediumint(9) | YES | | NULL | |\n| b | mediumint(8) unsigned | YES | | NULL | |\n| c | mediumint(8) unsigned zerofill | YES | | NULL | |\n+-------+--------------------------------+------+-----+---------+-------+\n \nINSERT INTO mediumints VALUES (-10,-10,-10);\nQuery OK, 1 row affected, 2 warnings (0.05 sec)\nWarning (Code 1264): Out of range value for column \'b\' at\nrow 1\nWarning (Code 1264): Out of range value for column \'c\' at\nrow 1\n \nINSERT INTO mediumints VALUES (-10,10,-10);\nQuery OK, 1 row affected, 1 warning (0.08 sec)\nWarning (Code 1264): Out of range value for column \'c\' at\nrow 1\n \nINSERT INTO mediumints VALUES (-10,10,10);\n \nINSERT INTO mediumints VALUES (8388608,8388608,8388608);\nQuery OK, 1 row affected, 1 warning (0.05 sec)\nWarning (Code 1264): Out of range value for column \'a\' at\nrow 1\n \nINSERT INTO mediumints VALUES (8388607,8388608,8388608);\n \nSELECT * FROM mediumints;\n+---------+---------+----------+\n| a | b | c |\n+---------+---------+----------+\n| -10 | 0 | 00000000 |\n| -10 | 0 | 00000000 |\n| -10 | 10 | 00000000 |\n| -10 | 10 | 00000010 |\n| 8388607 | 8388608 | 08388608 |\n| 8388607 | 8388608 | 08388608 |\n+---------+---------+----------+\n \n\n\nURL: https://mariadb.com/kb/en/mediumint/','','https://mariadb.com/kb/en/mediumint/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (285,22,'MEDIUMTEXT','Syntax\n------ \nMEDIUMTEXT [CHARACTER SET charset_name] [COLLATE\ncollation_name]\n \nDescription\n----------- \nA TEXT column with a \nmaximum length of 16,777,215 (224 - 1)\ncharacters. The effective maximum length is less if the\nvalue\ncontains multi-byte characters. Each MEDIUMTEXT value is\nstored using\na three-byte length prefix that indicates the number of\nbytes in the\nvalue.\n \n\n\nURL: https://mariadb.com/kb/en/mediumtext/','','https://mariadb.com/kb/en/mediumtext/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (286,22,'Numeric Data Type Overview','There are a number of numeric data types:\nTINYINT\nBOOLEAN - Synonym for TINYINT(1)\nSMALLINT\nMEDIUMINT\nINT, INTEGER\nBIGINT\nDECIMAL, DEC, NUMERIC, FIXED\nFLOAT\nDOUBLE, DOUBLE PRECISION, REAL\nBIT\n \nSee the specific articles for detailed information on each.\n \nSIGNED, UNSIGNED and ZEROFILL\n \nMost numeric types can be defined as SIGNED, UNSIGNED or\nZEROFILL, for example:\n \nTINYINT[(M)] [SIGNED | UNSIGNED | ZEROFILL]\n \nIf SIGNED, or no attribute, is specified, a portion of the\nnumeric type will be reserved for the sign (plus or minus).\nFor example, a TINYINT SIGNED can range from -128 to 127. \n \nIf UNSIGNED is specified, no portion of the numeric type is\nreserved for the sign, so for integer types range can be\nlarger. For example, a TINYINT UNSIGNED can range from 0 to\n255. Floating point and fixed-point types also can be\nUNSIGNED, but this only prevents negative values from being\nstored and doesn\'t alter the range. \n \nIf ZEROFILL is specified, the column will be set to UNSIGNED\nand the spaces used by default to pad the field are replaced\nwith zeros. ZEROFILL is ignored in expressions or as part of\na UNION. ZEROFILL is a non-standard MySQL and MariaDB\nenhancement.\n \nNote that although the preferred syntax indicates that the\nattributes are exclusive, more than one attribute can be\nspecified.\n \nUntil MariaDB 10.2.7 (MDEV-8659), any combination of the\nattributes could be used in any order, with duplicates. In\nthis case:\nthe presence of ZEROFILL makes the column UNSIGNED ZEROFILL.\nthe presence of UNSIGNED makes the column UNSIGNED.\n \nFrom MariaDB 10.2.8, only the following combinations are\nsupported:\nSIGNED\nUNSIGNED\nZEROFILL\nUNSIGNED ZEROFILL\nZEROFILL UNSIGNED\n \nThe latter two should be replaced with simply ZEROFILL, but\nare still accepted by the parser.\n \nExamples\n-------- \nCREATE TABLE zf (\n i1 TINYINT SIGNED,\n i2 TINYINT UNSIGNED,\n i3 TINYINT ZEROFILL\n);\n \nINSERT INTO zf VALUES (2,2,2);\n \nSELECT * FROM zf;\n \n+------+------+------+\n| i1 | i2 | i3 |\n+------+------+------+\n| 2 | 2 | 002 |\n+------+------+------+\n \nRange\n \nWhen attempting to add a value that is out of the valid\nrange for the numeric type, MariaDB will react depending on\nthe strict SQL_MODE setting.\n \nIf strict_mode has been set (the default from MariaDB\n10.2.4), MariaDB will return an error.\n \nIf strict_mode has not been set (the default until MariaDB\n10.2.3), MariaDB will adjust the number to fit in the field,\nreturning a warning.\n \nExamples\n-------- \nWith strict_mode set:\n \nSHOW VARIABLES LIKE \'sql_mode\';\n \n+---------------+-------------------------------------------------------------------------------------------+\n| Variable_name | Value |\n+---------------+-------------------------------------------------------------------------------------------+\n| sql_mode |\nSTRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION\n|\n+---------------+-------------------------------------------------------------------------------------------+\n \nCREATE TABLE ranges (i1 TINYINT, i2 SMALLINT, i3 TINYINT\nUNSIGNED);\n \nINSERT INTO ranges VALUES (257,257,257);\nERROR 1264 (22003): Out of range value for column \'i1\' at\nrow 1\n \nSELECT * FROM ranges;\n \nEmpty set (0.10 sec)\n \nWith strict_mode unset:\n \nSHOW VARIABLES LIKE \'sql_mode%\';\n \n+---------------+-------+\n| Variable_name | Value |\n+---------------+-------+\n| sql_mode | |\n+---------------+-------+\n \nCREATE TABLE ranges (i1 TINYINT, i2 SMALLINT, i3 TINYINT\nUNSIGNED);\n \nINSERT INTO ranges VALUES (257,257,257);\nQuery OK, 1 row affected, 2 warnings (0.00 sec)\n \nSHOW WARNINGS;\n \n+---------+------+---------------------------------------------+\n| Level | Code | Message |\n+---------+------+---------------------------------------------+\n| Warning | 1264 | Out of range value for column \'i1\' at\nrow 1 |\n| Warning | 1264 | Out of range value for column \'i3\' at\nrow 1 |\n+---------+------+---------------------------------------------+\n2 rows in set (0.00 sec)\n \nSELECT * FROM ranges;\n \n+------+------+------+\n| i1 | i2 | i3 |\n+------+------+------+\n| 127 | 257 | 255 |\n+------+------+------+\n \nAuto_increment\n \nThe AUTO_INCREMENT attribute can be used to generate a\nunique identity for new rows. For more details, see\nauto_increment.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/numeric-data-type-overview/','','https://mariadb.com/kb/en/numeric-data-type-overview/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (287,22,'ROW','The ROW data type was introduced in MariaDB 10.3.0.\n \nSyntax\n------ \nROW ( [{, }... ])\n \nDescription\n----------- \nROW is a data type for stored procedure variables.\n \nFeatures\n \nROW fields as normal variables\n \nROW fields (members) act as normal variables, and are able\nto appear in all\nquery parts where a stored procedure variable is allowed:\nAssignment is using the := operator and the SET command:\n \na.x:= 10;\n \na.x:= b.x;\n \nSET a.x= 10, a.y=20, a.z= b.z;\n \nPassing to functions and operators:\n \nSELECT f1(rec.a), rec.a\n\nURL: https://mariadb.com/kb/en/row/','','https://mariadb.com/kb/en/row/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (288,22,'SET Data Type','Syntax\n------ \nSET(\'value1\',\'value2\',...) [CHARACTER SET charset_name]\n[COLLATE collation_name]\n \nDescription\n----------- \nA set. A string object that can have zero or more values,\neach of\nwhich must be chosen from the list of values \'value1\',\n\'value2\', ... A\nSET column can have a maximum of 64 members. SET values are\nrepresented internally as integers.\n \n\n\nURL: https://mariadb.com/kb/en/set-data-type/','','https://mariadb.com/kb/en/set-data-type/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (289,22,'SMALLINT','Syntax\n------ \nSMALLINT[(M)] [SIGNED | UNSIGNED | ZEROFILL]\n \nDescription\n----------- \nA small integer. The signed range is -32768 to 32767. The\nunsigned range is 0 to 65535.\n \nIf a column has been set to ZEROFILL, all values will be\nprepended by zeros so that the SMALLINT value contains a\nnumber of M digits.\n \nNote: If the ZEROFILL attribute has been specified, the\ncolumn will automatically become UNSIGNED.\n \nFor more details on the attributes, see Numeric Data Type\nOverview.\n \nExamples\n-------- \nCREATE TABLE smallints (a SMALLINT,b SMALLINT UNSIGNED,c\nSMALLINT ZEROFILL);\n \nINSERT INTO smallints VALUES (-10,-10,-10);\nQuery OK, 1 row affected, 2 warnings (0.09 sec)\nWarning (Code 1264): Out of range value for column \'b\' at\nrow 1\nWarning (Code 1264): Out of range value for column \'c\' at\nrow 1\n \nINSERT INTO smallints VALUES (-10,10,-10);\nQuery OK, 1 row affected, 1 warning (0.08 sec)\nWarning (Code 1264): Out of range value for column \'c\' at\nrow 1\n \nINSERT INTO smallints VALUES (-10,10,10);\n \nINSERT INTO smallints VALUES (32768,32768,32768);\nQuery OK, 1 row affected, 1 warning (0.04 sec)\nWarning (Code 1264): Out of range value for column \'a\' at\nrow 1\n \nINSERT INTO smallints VALUES (32767,32768,32768);\n \nSELECT * FROM smallints;\n+-------+-------+-------+\n| a | b | c |\n+-------+-------+-------+\n| -10 | 0 | 00000 |\n| -10 | 10 | 00000 |\n| -10 | 10 | 00010 |\n| 32767 | 32768 | 32768 |\n| 32767 | 32768 | 32768 |\n+-------+-------+-------+\n \n\n\nURL: https://mariadb.com/kb/en/smallint/','','https://mariadb.com/kb/en/smallint/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (290,22,'String Literals','Strings are sequences of characters and are enclosed with\nquotes.\n \nThe syntax is:\n \n[_charset_name]\'string\' [COLLATE collation_name]\n \nFor example:\n \n\'The MariaDB Foundation\'\n_utf8 \'Foundation\' COLLATE utf8_unicode_ci;\n \nStrings can either be enclosed in single quotes or in double\nquotes (the same character must be used to both open and\nclose the string).\n \nThe ANSI SQL-standard does not permit double quotes for\nenclosing strings, and although MariaDB does by default, if\nthe MariaDB server has enabled the ANSI_QUOTES_SQL SQL_MODE,\ndouble quotes will be treated as being used for identifiers\ninstead of strings.\n \nStrings that are next to each other are automatically\nconcatenated. For example:\n \n\'The \' \'MariaDB \' \'Foundation\'\n \nand\n \n\'The MariaDB Foundation\'\n \nare equivalent.\n \nThe \\ (backslash character) is used to escape characters.\nFor example:\n \n\'MariaDB\'s new features\'\n \nis not a valid string because of the single quote in the\nmiddle of the string, which is treated as if it closes the\nstring, but is actually meant as part of the string, an\napostrophe. The backslash character helps in situations like\nthis:\n \n\'MariaDB\\\'s new features\'\n \nis now a valid string, and if displayed, will appear without\nthe backslash.\n \nSELECT \'MariaDB\\\'s new features\';\n+------------------------+\n| MariaDB\'s new features |\n+------------------------+\n| MariaDB\'s new features |\n+------------------------+\n \nAnother way to escape the quoting character is repeating it\ntwice:\n \nSELECT \'I\'\'m here\', \"\"\"Double\"\"\";\n+----------+----------+\n| I\'m here | \"Double\" |\n+----------+----------+\n| I\'m here | \"Double\" |\n+----------+----------+\n \nEscape sequences\n \nThere are other escape sequences also. Here is a full list:\n \nEscape sequence | Character | \n \n\\0 | ASCII NUL (0x00). | \n \n\\\' | Single quote (“\'â€). | \n \n\\\" | Double quote (“\"â€). | \n \n\\b | Backspace. | \n \n\\n | Newline, or linefeed,. | \n \n\\r | Carriage return. | \n \n\\t | Tab. | \n \n\\Z | ASCII 26 (Control+Z). See note following the table. | \n \n\\\\ | Backslash (“\\â€). | \n \n\\% | “%†character. See note following the table. | \n \n\\_ | A “_†character. See note following the table. | \n \nEscaping the % and _ characters can be necessary when using\nthe LIKE operator, which treats them as special characters.\n \nThe ASCII 26 character (\\Z) needs to be escaped when\nincluded in a batch file which needs to be executed in\nWindows. The reason is that ASCII 26, in Windows, is the end\nof file (EOF).\n \nBackslash (\\), if not used as an escape character, must\nalways be escaped. When followed by a character that is not\nin the above table, backslashes will simply be ignored.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/string-literals/','','https://mariadb.com/kb/en/string-literals/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (291,22,'TEXT','Syntax\n------ \nTEXT[(M)] [CHARACTER SET charset_name] [COLLATE\ncollation_name]\n \nDescription\n----------- \nA TEXT column with a maximum length of 65,535 (216 - 1)\ncharacters. The effective maximum length is less if the\nvalue contains\nmulti-byte characters. Each TEXT value is stored using a\ntwo-byte length\nprefix that indicates the number of bytes in the value. If\nyou need a bigger storage, consider using MEDIUMTEXT\ninstead.\n \nAn optional length M can be given for this type. If this is\ndone, MariaDB\ncreates the column as the smallest TEXT type large enough to\nhold values\nM characters long.\n \nBefore MariaDB 10.2, all MariaDB collations were of type\nPADSPACE, meaning that TEXT (as well as VARCHAR and CHAR\nvalues) are compared without regard for trailing spaces.\nThis does not apply to the LIKE pattern-matching operator,\nwhich takes into account trailing spaces.\n \nBefore MariaDB 10.2.1, BLOB and TEXT columns could not be\nassigned a DEFAULT value. This restriction was lifted in\nMariaDB 10.2.1.\n \nExamples\n-------- \nTrailing spaces:\n \nCREATE TABLE strtest (d TEXT(10));\nINSERT INTO strtest VALUES(\'Maria \');\n \nSELECT d=\'Maria\',d=\'Maria \' FROM strtest;\n+-----------+--------------+\n| d=\'Maria\' | d=\'Maria \' |\n+-----------+--------------+\n| 1 | 1 |\n+-----------+--------------+\n \nSELECT d LIKE \'Maria\',d LIKE \'Maria \' FROM strtest;\n+----------------+-------------------+\n| d LIKE \'Maria\' | d LIKE \'Maria \' |\n+----------------+-------------------+\n| 0 | 1 |\n+----------------+-------------------+\n \nDifference between VARCHAR and TEXT\n \nVARCHAR columns can be fully indexed. TEXT columns can only\nbe indexed over a specified length.\nUsing TEXT or BLOB in a SELECT query that uses temporary\ntables for storing intermediate results will force the\ntemporary table to be disk based (using the Aria storage\nengine instead of the memory storage engine, which is a bit\nslower. This is not that bad as the Aria storage engine\ncaches the rows in memory. To get the benefit of this, one\nshould ensure that the aria_pagecache_buffer_size variable\nis big enough to hold most of the row and index data for\ntemporary tables.\n \nFor Storage Engine Developers\n \nInternally the full length of the VARCHAR column is\nallocated inside each TABLE objects record[] structure. As\nthere are three such buffers, each open table will allocate\n3 times max-length-to-store-varchar bytes of memory.\nTEXT and BLOB columns are stored with a pointer (4 or 8\nbytes) + a 1-4 bytes length. The TEXT data is only stored\nonce. This means that internally TEXT uses less memory for\neach open table but instead has the additional overhead that\neach TEXT object needs to be allocated and freed for each\nrow access (with some caching in between).\n \n\n\nURL: https://mariadb.com/kb/en/text/','','https://mariadb.com/kb/en/text/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (292,22,'TIME','Syntax\n------ \nTIME [()]\n \nDescription\n----------- \nA time. The range is \'-838:59:59.999999\' to\n\'838:59:59.999999\'. Microsecond precision can be from 0-6;\nif not specified 0 is used. Microseconds have been available\nsince MariaDB 5.3. \n \nMariaDB displays TIME values in \'HH:MM:SS.ssssss\' format,\nbut allows assignment of times in looser formats, including\n\'D HH:MM:SS\', \'HH:MM:SS\', \'HH:MM\', \'D HH:MM\', \'D\nHH\', \'SS\', or \'HHMMSS\', as well as permitting dropping\nof any leading zeros when a delimiter is provided, for\nexample \'3:9:10\'. For details, see date and time literals.\n \nMariaDB 10.1.2 introduced the --mysql56-temporal-format\noption, on by default, which allows MariaDB to store TIMEs\nusing the same low-level format MySQL 5.6 uses.\n \nInternal Format\n \nIn MariaDB 10.1.2 a new temporal format was introduced from\nMySQL 5.6 that alters how the TIME, DATETIME and TIMESTAMP\ncolumns operate at lower levels. These changes allow these\ntemporal data types to have fractional parts and negative\nvalues. You can disable this feature using the\nmysql56_temporal_format system variable.\n \nTables that include TIMESTAMP values that were created on an\nolder version of MariaDB or that were created while the\nmysql56_temporal_format system variable was disabled\ncontinue to store data using the older data type format.\n \nIn order to update table columns from the older format to\nthe newer format, execute an ALTER TABLE... MODIFY COLUMN\nstatement that changes the column to the *same* data type.\nThis change may be needed if you want to export the table\'s\ntablespace and import it onto a server that has\nmysql56_temporal_format=ON set (see MDEV-15225).\n \nFor instance, if you have a TIME column in your table: \n \nSHOW VARIABLES LIKE \'mysql56_temporal_format\';\n \n+-------------------------+-------+\n| Variable_name | Value |\n+-------------------------+-------+\n| mysql56_temporal_format | ON |\n+-------------------------+-------+\n \nALTER TABLE example_table MODIFY ts_col TIME;\n \nWhen MariaDB executes the ALTER TABLE statement, it converts\nthe data from the older temporal format to the newer one. \n \nIn the event that you have several tables and columns using\ntemporal data types that you want to switch over to the new\nformat, make sure the system variable is enabled, then\nperform a dump and restore using mysqldump. The columns\nusing relevant temporal data types are restored using the\nnew temporal format.\n \nExamples\n-------- \nINSERT INTO time VALUES (\'90:00:00\'), (\'800:00:00\'),\n(800), (22), (151413), (\'9:6:3\'), (\'12 09\');\n \nSELECT * FROM time;\n+-----------+\n| t |\n+-----------+\n| 90:00:00 |\n| 800:00:00 |\n| 00:08:00 |\n| 00:00:22 |\n| 15:14:13 |\n| 09:06:03 |\n| 297:00:00 |\n+-----------+\n \n\n\nURL: https://mariadb.com/kb/en/time/','','https://mariadb.com/kb/en/time/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (293,22,'TIMESTAMP','Syntax\n------ \nTIMESTAMP [(\n\nURL: https://mariadb.com/kb/en/timestamp/','','https://mariadb.com/kb/en/timestamp/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (294,22,'TINYBLOB','Syntax\n------ \nTINYBLOB\n \nDescription\n----------- \nA BLOB column with a maximum length of \n255 (28 - 1) bytes. Each\nTINYBLOB value is stored using a one-byte length prefix that\nindicates\nthe number of bytes in the value.\n \n\n\nURL: https://mariadb.com/kb/en/tinyblob/','','https://mariadb.com/kb/en/tinyblob/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (295,22,'TINYINT','Syntax\n------ \nTINYINT[(M)] [SIGNED | UNSIGNED | ZEROFILL]\n \nDescription\n----------- \nA very small integer. The signed range is -128 to 127. The\nunsigned range is 0 to 255. For details on the attributes,\nsee Numeric Data Type Overview.\n \nExamples\n-------- \nCREATE TABLE tinyints (a TINYINT,b TINYINT UNSIGNED,c\nTINYINT ZEROFILL);\nQuery OK, 0 rows affected (0.43 sec)\n \nINSERT INTO tinyints VALUES (-10,-10,-10);\nQuery OK, 1 row affected, 2 warnings (0.08 sec)\nWarning (Code 1264): Out of range value for column \'b\' at\nrow 1\nWarning (Code 1264): Out of range value for column \'c\' at\nrow 1\n \nINSERT INTO tinyints VALUES (-10,10,-10);\nQuery OK, 1 row affected, 1 warning (0.11 sec)\nWarning (Code 1264): Out of range value for column \'c\' at\nrow 1\n \nINSERT INTO tinyints VALUES (-10,10,10);\n \nSELECT * FROM tinyints;\n+------+------+------+\n| a | b | c |\n+------+------+------+\n| -10 | 0 | 000 |\n| -10 | 10 | 000 |\n| -10 | 10 | 010 |\n+------+------+------+\n \nINSERT INTO tinyints VALUES (128,128,128);\nQuery OK, 1 row affected, 1 warning (0.19 sec)\nWarning (Code 1264): Out of range value for column \'a\' at\nrow 1\n \nINSERT INTO tinyints VALUES (127,128,128);\n \nSELECT * FROM tinyints;\n+------+------+------+\n| a | b | c |\n+------+------+------+\n| -10 | 0 | 000 |\n| -10 | 10 | 000 |\n| -10 | 10 | 010 |\n| 127 | 128 | 128 |\n| 127 | 128 | 128 |\n+------+------+------+\n \n\n\nURL: https://mariadb.com/kb/en/tinyint/','','https://mariadb.com/kb/en/tinyint/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (296,22,'TINYTEXT','Syntax\n------ \nTINYTEXT [CHARACTER SET charset_name] [COLLATE\ncollation_name]\n \nDescription\n----------- \nA TEXT column with a maximum length of 255 (28 - 1)\ncharacters. The effective maximum length is less if the\nvalue contains multi-byte characters. Each TINYTEXT value is\nstored using a one-byte length prefix that indicates the\nnumber of bytes in the value.\n \n\n\nURL: https://mariadb.com/kb/en/tinytext/','','https://mariadb.com/kb/en/tinytext/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (297,22,'VARBINARY','Syntax\n------ \nVARBINARY(M)\n \nDescription\n----------- \nThe VARBINARY type is similar to the VARCHAR type, but\nstores binary byte strings rather than non-binary character\nstrings. M represents the maximum column length in bytes. \n \nIt contains no character set, and comparison and sorting are\nbased on the numeric value of the bytes.\n \nIf the maximum length is exceeded, and SQL strict mode is\nnot enabled , the extra characters will be dropped with a\nwarning. If strict mode is enabled, an error will occur.\n \nUnlike BINARY values, VARBINARYs are not right-padded when\ninserting.\n \nOracle Mode\n \nIn Oracle mode from MariaDB 10.3, RAW is a synonym for\nVARBINARY.\n \nExamples\n-------- \nInserting too many characters, first with strict mode off,\nthen with it on:\n \nCREATE TABLE varbins (a VARBINARY(10));\n \nINSERT INTO varbins VALUES(\'12345678901\');\nQuery OK, 1 row affected, 1 warning (0.04 sec)\n \nSELECT * FROM varbins;\n \n+------------+\n| a |\n+------------+\n| 1234567890 |\n+------------+\n \nSET sql_mode=\'STRICT_ALL_TABLES\';\n \nINSERT INTO varbins VALUES(\'12345678901\');\nERROR 1406 (22001): Data too long for column \'a\' at row 1\n \nSorting is performed with the byte value:\n \nTRUNCATE varbins;\n \nINSERT INTO varbins VALUES(\'A\'),(\'B\'),(\'a\'),(\'b\');\n \nSELECT * FROM varbins ORDER BY a;\n \n+------+\n| a |\n+------+\n| A |\n| B |\n| a |\n| b |\n+------+\n \nUsing CAST to sort as a CHAR instead:\n \nSELECT * FROM varbins ORDER BY CAST(a AS CHAR);\n+------+\n| a |\n+------+\n| a |\n| A |\n| b |\n| B |\n+------+\n \n\n\nURL: https://mariadb.com/kb/en/varbinary/','','https://mariadb.com/kb/en/varbinary/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (298,22,'VARCHAR','Syntax\n------ \n[NATIONAL] VARCHAR(M) [CHARACTER SET charset_name] [COLLATE\ncollation_name]\n \nDescription\n----------- \nA variable-length string. M represents the maximum column\nlength in\ncharacters. The range of M is 0 to 65,532. The effective\nmaximum\nlength of a VARCHAR is subject to the maximum row size and\nthe character set used. For\nexample, utf8 characters can require up to three bytes per\ncharacter,\nso a VARCHAR column that uses the utf8 character set can be\ndeclared\nto be a maximum of 21,844 characters.\n \nMariaDB stores VARCHAR values as a one-byte or two-byte\nlength prefix\nplus data. The length prefix indicates the number of bytes\nin the\nvalue. A VARCHAR column uses one length byte if values\nrequire no more\nthan 255 bytes, two length bytes if values may require more\nthan 255\nbytes.\n \nNote: MariaDB 5.1 and later follow the standard SQL\nspecification, \nand do not remove trailing spaces from VARCHAR values.\n \nVARCHAR(0) columns can contain 2 values: an empty string or\nNULL. Such columns cannot be part of an index. The CONNECT\nstorage engine does not support VARCHAR(0).\n \nVARCHAR is shorthand for CHARACTER VARYING. NATIONAL VARCHAR\nis the\nstandard SQL way to define that a VARCHAR column should use\nsome\npredefined character set. MariaDB uses utf8 as this\npredefined character set, as does MySQL 4.1 and up.\nNVARCHAR is shorthand for NATIONAL VARCHAR.\n \nBefore MariaDB 10.2, all MariaDB collations were of type\nPADSPACE, meaning that VARCHAR (as well as CHAR and TEXT\nvalues) are compared without regard for trailing spaces.\nThis does not apply to the LIKE pattern-matching operator,\nwhich takes into account trailing spaces. From MariaDB 10.2,\na number of NO PAD collations are available.\n \nIf a unique index consists of a column where trailing pad\ncharacters are stripped or ignored, inserts into that column\nwhere values differ only by the number of trailing pad\ncharacters will result in a duplicate-key error.\n \nExamples\n-------- \nThe following are equivalent:\n \nVARCHAR(30) CHARACTER SET utf8\nNATIONAL VARCHAR(30)\nNVARCHAR(30)\nNCHAR VARCHAR(30)\nNATIONAL CHARACTER VARYING(30)\nNATIONAL CHAR VARYING(30)\n \nTrailing spaces:\n \nCREATE TABLE strtest (v VARCHAR(10));\nINSERT INTO strtest VALUES(\'Maria \');\n \nSELECT v=\'Maria\',v=\'Maria \' FROM strtest;\n+-----------+--------------+\n| v=\'Maria\' | v=\'Maria \' |\n+-----------+--------------+\n| 1 | 1 |\n+-----------+--------------+\n \nSELECT v LIKE \'Maria\',v LIKE \'Maria \' FROM strtest;\n+----------------+-------------------+\n| v LIKE \'Maria\' | v LIKE \'Maria \' |\n+----------------+-------------------+\n| 0 | 1 |\n+----------------+-------------------+\n \nTruncation\n \nDepending on whether or not strict sql mode is set, you will\neither get a warning or an error if you try to insert a\nstring that is too long into a VARCHAR column. If the extra\ncharacters are spaces, the spaces that can\'t fit will be\nremoved and you will always get a warning, regardless of the\nsql mode setting.\n \nDifference Between VARCHAR and TEXT\n \nVARCHAR columns can be fully indexed. TEXT columns can only\nbe indexed over a specified length.\nUsing TEXT or BLOB in a SELECT query that uses temporary\ntables for storing intermediate results will force the\ntemporary table to be disk based (using the Aria storage\nengine instead of the memory storage engine, which is a bit\nslower. This is not that bad as the Aria storage engine\ncaches the rows in memory. To get the benefit of this, one\nshould ensure that the aria_pagecache_buffer_size variable\nis big enough to hold most of the row and index data for\ntemporary tables.\n \nOracle Mode\n \nIn Oracle mode from MariaDB 10.3, VARCHAR2 is a synonym.\n \nFor Storage Engine Developers\n \nInternally the full length of the VARCHAR column is\nallocated inside each TABLE objects record[] structure. As\nthere are three such buffers, each open table will allocate\n3 times max-length-to-store-varchar bytes of memory.\nTEXT and BLOB columns are stored with a pointer (4 or 8\nbytes) + a 1-4 bytes length. The TEXT data is only stored\nonce. This means that internally TEXT uses less memory for\neach open table but instead has the additional overhead that\neach TEXT object needs to be allocated and freed for each\nrow access (with some caching in between).\n \n\n\nURL: https://mariadb.com/kb/en/varchar/','','https://mariadb.com/kb/en/varchar/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (299,22,'YEAR Data Type','Syntax\n------ \nYEAR[(4)]\n \nDescription\n----------- \nA year in two-digit or four-digit format. The default is\nfour-digit format. Note that the two-digit format has been\ndeprecated since 5.5.27. \n \nIn four-digit format, the allowable values are 1901 to 2155,\nand 0000. In two-digit format, the allowable values are 70\nto 69,\nrepresenting years from 1970 to 2069. MariaDB displays YEAR\nvalues in\nYYYY format, but allows you to assign values to YEAR columns\nusing\neither strings or numbers.\n \nInserting numeric zero has a different result for YEAR(4)\nand YEAR(2). For YEAR(2), the value 00 reflects the year\n2000. For YEAR(4), the value 0000 reflects the year zero.\nThis only applies to numeric zero. String zero always\nreflects the year 2000.\n \nExamples\n-------- \nAccepting a string or a number:\n \nCREATE TABLE y(y YEAR);\n \nINSERT INTO y VALUES (1990),(\'2012\');\n \nSELECT * FROM y;\n+------+\n| y |\n+------+\n| 1990 |\n| 2012 |\n+------+\n \nOut of range:\n \nINSERT INTO y VALUES (1005),(\'3080\');\nQuery OK, 2 rows affected, 2 warnings (0.05 sec)\nRecords: 2 Duplicates: 0 Warnings: 2\n \nSHOW WARNINGS;\n+---------+------+--------------------------------------------+\n| Level | Code | Message |\n+---------+------+--------------------------------------------+\n| Warning | 1264 | Out of range value for column \'y\' at\nrow 1 |\n| Warning | 1264 | Out of range value for column \'y\' at\nrow 2 |\n+---------+------+--------------------------------------------+\n \nSELECT * FROM y;\n+------+\n| y |\n+------+\n| 1990 |\n| 2012 |\n| 0000 |\n| 0000 |\n+------+\n \nTruncating:\n \nINSERT INTO y VALUES (\'2013-12-12\');\nQuery OK, 1 row affected, 1 warning (0.05 sec)\n \nSHOW WARNINGS;\n+---------+------+----------------------------------------+\n| Level | Code | Message |\n+---------+------+----------------------------------------+\n| Warning | 1265 | Data truncated for column \'y\' at row 1\n|\n+---------+------+----------------------------------------+\n \nSELECT * FROM y;\n+------+\n| y |\n+------+\n| 1990 |\n| 2012 |\n| 0000 |\n| 0000 |\n| 2013 |\n+------+\n \nDifference between YEAR(2) and YEAR(4), and string and\nnumeric zero:\n \nCREATE TABLE y2(y YEAR(4), y2 YEAR(2));\nQuery OK, 0 rows affected, 1 warning (0.40 sec)\n \nNote (Code 1287): \'YEAR(2)\' is deprecated and will be\nremoved in a future release. Please use YEAR(4) instead\n \nINSERT INTO y2 VALUES(0,0),(\'0\',\'0\');\n \nSELECT YEAR(y),YEAR(y2) FROM y;\n+---------+----------+\n| YEAR(y) | YEAR(y2) |\n+---------+----------+\n| 0 | 2000 |\n| 2000 | 2000 |\n+---------+----------+\n \n\n\nURL: https://mariadb.com/kb/en/year-data-type/','','https://mariadb.com/kb/en/year-data-type/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (300,23,'BEGIN END','Syntax\n------ \n[begin_label:] BEGIN [NOT ATOMIC]\n [statement_list]\nEND [end_label]\n \nNOT ATOMIC is required when used outside of a stored\nprocedure. Inside stored procedures or within an anonymous\nblock, BEGIN alone starts a new anonymous block.\n \nDescription\n----------- \nBEGIN ... END syntax is used for writing compound\nstatements. A compound statement can contain multiple\nstatements, enclosed by the BEGIN and END keywords.\nstatement_list represents a list of one or more statements,\neach\nterminated by a semicolon (i.e., ;) statement delimiter.\nstatement_list is\noptional, which means that the empty compound statement\n(BEGIN END) is\nlegal.\n \nNote that END will perform a commit. If you are running in\nautocommit mode, every statement will be committed\nseparately. If you are not running in autocommit mode, you\nmust execute a COMMIT or ROLLBACK after END to get the\ndatabase up to date.\n \nUse of multiple statements requires that a client is able to\nsend statement strings containing the ; statement delimiter.\nThis is handled in the mysql command-line client with the\nDELIMITER command.\nChanging the ; end-of-statement delimiter (for example, to\n//) allows ; to be used in a program body.\n \nA compound statement within a stored program can be\nlabeled. end_label cannot be given unless begin_label also\nis present. If both are present, they must be the same.\n \nBEGIN ... END constructs can be nested. Each block can\ndefine its own variables, a CONDITION, a HANDLER and a\nCURSOR, which don\'t exist in the outer blocks. The most\nlocal declarations override the outer objects which use the\nsame name (see example below).\n \nThe declarations order is the following:\nDECLARE local variables;\nDECLARE CONDITIONs;\nDECLARE CURSORs;\nDECLARE HANDLERs;\n \nNote that DECLARE HANDLER contains another BEGIN ... END\nconstruct.\n \nHere is an example of a very simple, anonymous block:\n \nBEGIN NOT ATOMIC\nSET @a=1;\n \nCREATE TABLE test.t1(a INT);\nEND|\n \nBelow is an example of nested blocks in a stored procedure:\n \nCREATE PROCEDURE t( )\nBEGIN\n DECLARE x TINYINT UNSIGNED DEFAULT 1;\n \n BEGIN\n DECLARE x CHAR(2) DEFAULT \'02\';\n \n DECLARE y TINYINT UNSIGNED DEFAULT 10;\n \n SELECT x, y;\n \n END;\n \n SELECT x;\n \nEND;\n \nIn this example, a TINYINT variable, x is declared in the\noutter block. But in the inner block x is re-declared as a\nCHAR and an y variable is declared. The inner SELECT shows\nthe \"new\" value of x, and the value of y. But when x is\nselected in the outer block, the \"old\" value is returned.\nThe final SELECT doesn\'t try to read y, because it doesn\'t\nexist in that context.\n \n\n\nURL: https://mariadb.com/kb/en/begin-end/','','https://mariadb.com/kb/en/begin-end/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (301,23,'CASE Statement','Syntax\n------ \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 \nDescription\n----------- \nThe CASE statement for stored programs implements a complex\nconditional\nconstruct. If a search_condition evaluates to true, the\ncorresponding SQL\nstatement list is executed. If no search condition matches,\nthe statement list\nin the ELSE clause is executed. Each statement_list consists\nof one or\nmore statements.\n \nIf no when_value or search_condition matches the value\ntested and the CASE\nstatement contains no ELSE clause, a Case not found for CASE\nstatement\nerror results.\n \nEach statement_list consists of one or more statements; an\nempty\nstatement_list is not allowed. To handle situations where no\nvalue is\nmatched by any WHEN clause, use an ELSE containing an\nempty BEGIN ... END block, as shown in this example:\n \nDELIMITER |\nCREATE PROCEDURE p()\nBEGIN\n DECLARE v INT DEFAULT 1;\n \n CASE v\n WHEN 2 THEN SELECT v;\n \n WHEN 3 THEN SELECT 0;\n \n ELSE BEGIN END;\n \n END CASE;\n \nEND;\n \n|\n \nThe indentation used here in the ELSE clause is for purposes\nof clarity only,\nand is not otherwise significant. See Delimiters in the\nmysql client for more on the use of the delimiter command.\n \nNote: The syntax of the CASE statement used inside stored\nprograms\ndiffers slightly from that of the SQL CASE expression\ndescribed in\nCASE OPERATOR.\nThe CASE statement cannot have an ELSE NULL clause, and it\nis\nterminated with END CASE instead of END.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/case-statement/','','https://mariadb.com/kb/en/case-statement/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (302,23,'CLOSE','Syntax\n------ \nCLOSE cursor_name\n \nDescription\n----------- \nThis statement closes a previously opened cursor. The cursor\nmust have been previously opened or else an error occurs.\n \nIf not closed explicitly, a cursor is closed at the end of\nthe\ncompound statement in which it was declared.\n \nSee Cursor Overview for an example.\n \n\n\nURL: https://mariadb.com/kb/en/close/','','https://mariadb.com/kb/en/close/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (303,23,'DECLARE CONDITION','Syntax\n------ \nDECLARE condition_name CONDITION FOR condition_value\n \ncondition_value:\n SQLSTATE [VALUE] sqlstate_value\n | mysql_error_code\n \nDescription\n----------- \nThe DECLARE ... CONDITION statement defines a named error\ncondition.\nIt specifies a condition that needs specific handling and\nassociates a\nname with that condition. Later, the name can be used in a\nDECLARE ... HANDLER, SIGNAL or RESIGNAL statement (as long\nas the statement is located in the same BEGIN ... END\nblock).\n \nConditions must be declared after local variables, but\nbefore CURSORs and HANDLERs.\n \nA condition_value for DECLARE ... CONDITION can be an\nSQLSTATE value (a\n5-character string literal) or a MySQL error code (a\nnumber). You should not\nuse SQLSTATE value \'00000\' or MySQL error code 0, because\nthose indicate sucess\nrather than an error condition. If you try, or if you\nspecify an invalid SQLSTATE value, an error like this is\nproduced:\n \nERROR 1407 (42000): Bad SQLSTATE: \'00000\'\n \nFor a list of SQLSTATE values and MariaDB error\ncodes, see MariaDB Error Codes.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/declare-condition/','','https://mariadb.com/kb/en/declare-condition/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (304,23,'DECLARE CURSOR','Syntax\n------ \n\n\nURL: https://mariadb.com/kb/en/declare-cursor/','','https://mariadb.com/kb/en/declare-cursor/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (305,23,'DECLARE HANDLER','Syntax\n------ \nDECLARE handler_type HANDLER\n FOR condition_value [, condition_value] ...\n statement\n \nhandler_type:\n CONTINUE\n | EXIT \n | UNDO\n \ncondition_value:\n SQLSTATE [VALUE] sqlstate_value\n | condition_name\n | SQLWARNING\n | NOT FOUND\n | SQLEXCEPTION\n | mariadb_error_code\n \nDescription\n----------- \nThe DECLARE ... HANDLER statement specifies handlers that\neach may\ndeal with one or more conditions. If one of these conditions\noccurs,\nthe specified statement is executed. statement can be a\nsimple\nstatement (for example, SET var_name = value), or it can be\na compound\nstatement written using BEGIN and END.\n \nHandlers must be declared after local variables, a CONDITION\nand a CURSOR.\n \nFor a CONTINUE handler, execution of the current program\ncontinues\nafter execution of the handler statement. For an EXIT\nhandler,\nexecution terminates for the BEGIN ... END compound\nstatement in which\nthe handler is declared. (This is true even if the condition\noccurs in\nan inner block.) The UNDO handler type statement is not\nsupported.\n \nIf a condition occurs for which no handler has been\ndeclared, the\ndefault action is EXIT.\n \nA condition_value for DECLARE ... HANDLER can be any of the\nfollowing\nvalues:\nAn SQLSTATE value (a 5-character string literal) or a\nMariaDB error\ncode (a number). You should not use SQLSTATE value \'00000\'\nor MariaDB\nerror code 0, because those indicate sucess rather than an\nerror\ncondition. For a list of SQLSTATE values and MariaDB error\ncodes, see\nMariaDB Error Codes.\nA condition name previously specified with DECLARE ...\nCONDITION. It must be in the same stored program. See\nDECLARE CONDITION.\nSQLWARNING is shorthand for the class of SQLSTATE values\nthat begin\nwith \'01\'.\nNOT FOUND is shorthand for the class of SQLSTATE values that\nbegin\nwith \'02\'. This is relevant only the context of cursors\nand is used to\ncontrol what happens when a cursor reaches the end of a data\nset. If\nno more rows are available, a No Data condition occurs with\nSQLSTATE\nvalue 02000. To detect this condition, you can set up a\nhandler for it\n(or for a NOT FOUND condition). An example is shown in\nCursor Overview. This condition also occurs for SELECT ...\nINTO var_list statements that retrieve no\nrows.\nSQLEXCEPTION is shorthand for the class of SQLSTATE values\nthat do\nnot begin with \'00\', \'01\', or \'02\'.\n \nWhen an error raises, in some cases it could be handled by\nmultiple HANDLERs. For example, there may be an handler for\n1050 error, a separate handler for the 42S01 SQLSTATE, and\nanother separate handler for the SQLEXCEPTION class: in\ntheory all occurrences of HANDLER may catch the 1050 error,\nbut MariaDB chooses the HANDLER with the highest precedence.\nHere are the precedence rules:\nHandlers which refer to an error code have the highest\nprecedence.\nHandlers which refer to a SQLSTATE come next.\nHandlers which refer to an error class have the lowest\nprecedence.\n \nIn some cases, a statement could produce multiple errors. If\nthis happens, in some cases multiple handlers could have the\nhighest precedence. In such cases, the choice of the handler\nis indeterminate.\n \nNote that if an error occurs within a CONTINUE HANDLER\nblock, it can be handled by another HANDLER. However, a\nHANDLER which is already in the stack (that is, it has been\ncalled to handle an error and its execution didn\'t finish\nyet) cannot handle new errors—this prevents endless loops.\nFor example, suppose that a stored procedure contains a\nCONTINUE HANDLER for SQLWARNING and another CONTINUE HANDLER\nfor NOT FOUND. At some point, a NOT FOUND error occurs, and\nthe execution enters the NOT FOUND HANDLER. But within that\nhandler, a warning occurs, and the execution enters the\nSQLWARNING HANDLER. If another NOT FOUND error occurs, it\ncannot be handled again by the NOT FOUND HANDLER, because\nits execution is not finished.\n \nWhen a DECLARE HANDLER block can handle more than one error\ncondition, it may be useful to know which errors occurred.\nTo do so, you can use the GET DIAGNOSTICS statement.\n \nAn error that is handled by a DECLARE HANDLER construct can\nbe issued again using the RESIGNAL statement.\n \nBelow is an example using DECLARE HANDLER:\n \nCREATE TABLE test.t (s1 INT, PRIMARY KEY (s1));\n \nDELIMITER //\n \nCREATE PROCEDURE handlerdemo ( )\n BEGIN\n DECLARE CONTINUE HANDLER FOR SQLSTATE \'23000\' SET @x2 =\n1;\n \n SET @x = 1;\n \n INSERT INTO test.t VALUES (1);\n SET @x = 2;\n \n INSERT INTO test.t VALUES (1);\n SET @x = 3;\n \n END;\n \n //\n \nDELIMITER ;\n \nCALL handlerdemo( );\n \nSELECT @x;\n \n+------+\n| @x |\n+------+\n| 3 |\n+------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/declare-handler/','','https://mariadb.com/kb/en/declare-handler/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (306,23,'DECLARE Variable','Syntax\n------ \nDECLARE var_name [, var_name] ... [[ROW] TYPE OF]] type\n[DEFAULT value]\n \nDescription\n----------- \nThis statement is used to declare local variables within\nstored programs. To\nprovide a default value for the variable, include a DEFAULT\nclause. The\nvalue can be specified as an expression (even subqueries are\npermitted); it need not be a constant. If the\nDEFAULT clause is missing, the initial value is NULL.\n \nLocal variables are treated like stored routine parameters\nwith respect to data\ntype and overflow checking. See CREATE PROCEDURE.\n \nLocal variables must be declared before CONDITIONs, CURSORs\nand HANDLERs.\n \nLocal variable names are not case sensitive.\n \nThe scope of a local variable is within the BEGIN ... END\nblock where it is\ndeclared. The variable can be referred to in blocks nested\nwithin the declaring\nblock, except those blocks that declare a variable with the\nsame name.\n \nTYPE OF / ROW TYPE OF\n \nTYPE OF and ROW TYPE OF anchored data types for stored\nroutines were introduced in MariaDB 10.3.\n \nAnchored data types allow a data type to be defined based on\nanother object, such as a table row, rather than\nspecifically set in the declaration. If the anchor object\nchanges, so will the anchored data type. This can lead to\nroutines being easier to maintain, so that if the data type\nin the table is changed, it will automatically be changed in\nthe routine as well.\n \nVariables declared with ROW TYPE OF will have the same\nfeatures as implicit ROW variables. It is not possible to\nuse ROW TYPE OF variables in a LIMIT clause.\n \nThe real data type of TYPE OF and ROW TYPE OF table_name\nwill become known at the very beginning of the stored\nroutine call. ALTER TABLE or DROP TABLE statements performed\ninside the current routine on the tables that appear in\nanchors won\'t affect the data type of the anchored\nvariables, even if the variable is declared after an ALTER\nTABLE or DROP TABLE statement.\n \nThe real data type of a ROW TYPE OF cursor_name variable\nwill become known when execution enters into the block where\nthe variable is declared. Data type instantiation will\nhappen only once. In a cursor ROW TYPE OF variable that is\ndeclared inside a loop, its data type will become known on\nthe very first iteration and won\'t change on further loop\niterations.\n \nThe tables referenced in TYPE OF and ROW TYPE OF\ndeclarations will be checked for existence at the beginning\nof the stored routine call. CREATE PROCEDURE or CREATE\nFUNCTION will not check the referenced tables for existence.\n \nExamples\n-------- \nTYPE OF and ROW TYPE OF from MariaDB 10.3:\n \nDECLARE tmp TYPE OF t1.a;\n -- Get the data type from the column {{a}} in the table\n{{t1}}\n \nDECLARE rec1 ROW TYPE OF t1;\n -- Get the row data type from the table {{t1}}\n \nDECLARE rec2 ROW TYPE OF cur1;\n -- Get the row data type from the cursor {{cur1}}\n \n\n\nURL: https://mariadb.com/kb/en/declare-variable/','','https://mariadb.com/kb/en/declare-variable/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (307,23,'FETCH','Syntax\n------ \nFETCH cursor_name INTO var_name [, var_name] ...\n \nDescription\n----------- \nThis statement fetches the next row (if a row exists) using\nthe\nspecified open cursor, and advances the cursor pointer.\n \nvar_name can be a local variable, but not a user-defined\nvariable.\n \nIf no more rows are available, a No Data condition occurs\nwith\nSQLSTATE value 02000. To detect this condition, you can set\nup a\nhandler for it (or for a NOT FOUND condition).\n \nSee Cursor Overview for an example.\n \n\n\nURL: https://mariadb.com/kb/en/fetch/','','https://mariadb.com/kb/en/fetch/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (308,23,'FOR','FOR loops were introduced in MariaDB 10.3.\n \nSyntax\n------ \nInteger range FOR loop:\n \n[begin_label:]\nFOR var_name IN [ REVERSE ] lower_bound .. upper_bound\nDO statement_list\nEND FOR [ end_label ]\n \nExplicit cursor FOR loop\n \n[begin_label:]\nFOR record_name IN cursor_name [ (\ncursor_actual_parameter_list)]\nDO statement_list\nEND FOR [ end_label ]\n \nExplicit cursor FOR loop (Oracle mode)\n \n[begin_label:]\nFOR record_name IN cursor_name [ (\ncursor_actual_parameter_list)]\nLOOP\n statement_list\nEND LOOP [ end_label ]\n \nImplicit cursor FOR loop\n \n[begin_label:]\nFOR record_name IN ( select_statement )\nDO statement_list\nEND FOR [ end_label ]\n \nDescription\n----------- \nFOR loops allow code to be executed a fixed number of times.\n \nIn an integer range FOR loop, MariaDB will compare the lower\nbound and upper bound values, and assign the lower bound\nvalue to a counter. If REVERSE is not specified, and the\nupper bound value is greater than or equal to the counter,\nthe counter will be incremented and the statement will\ncontinue, after which the loop is entered again. If the\nupper bound value is greater than the counter, the loop will\nbe exited.\n \nIf REVERSE is specified, the counter is decremented, and the\nupper bound value needs to be less than or equal for the\nloop to continue.\n \nExamples\n-------- \nIntger range FOR loop:\n \nCREATE TABLE t1 (a INT);\n \nDELIMITER //\n \nFOR i IN 1..3\nDO\n INSERT INTO t1 VALUES (i);\nEND FOR;\n \n//\n \nDELIMITER ;\n \nSELECT * FROM t1;\n \n+------+\n| a |\n+------+\n| 1 |\n| 2 |\n| 3 |\n+------+\n \nREVERSE integer range FOR loop:\n \nCREATE OR REPLACE TABLE t1 (a INT);\n \nDELIMITER //\nFOR i IN REVERSE 12..4\n DO\n INSERT INTO t1 VALUES (i);\nEND FOR;\n \n//\nQuery OK, 9 rows affected (0.422 sec)\n \nDELIMITER ;\n \nSELECT * FROM t1;\n \n+------+\n| a |\n+------+\n| 12 |\n| 11 |\n| 10 |\n| 9 |\n| 8 |\n| 7 |\n| 6 |\n| 5 |\n| 4 |\n+------+\n \nExplicit cursor in Oracle mode:\n \nSET sql_mode=ORACLE;\n \nCREATE OR REPLACE TABLE t1 (a INT, b VARCHAR(32));\n \nINSERT INTO t1 VALUES (10,\'b0\');\nINSERT INTO t1 VALUES (11,\'b1\');\nINSERT INTO t1 VALUES (12,\'b2\');\n \nDELIMITER //\n \nCREATE OR REPLACE PROCEDURE p1(pa INT) AS \n CURSOR cur(va INT) IS\n SELECT a, b FROM t1 WHERE a=va;\n \nBEGIN\n FOR rec IN cur(pa)\n LOOP\n SELECT rec.a, rec.b;\n \n END LOOP;\n \nEND;\n \n//\n \nDELIMITER ;\n \nCALL p1(10);\n+-------+-------+\n| rec.a | rec.b |\n+-------+-------+\n| 10 | b0 |\n+-------+-------+\n \nCALL p1(11);\n+-------+-------+\n| rec.a | rec.b |\n+-------+-------+\n| 11 | b1 |\n+-------+-------+\n \nCALL p1(12);\n+-------+-------+\n| rec.a | rec.b |\n+-------+-------+\n| 12 | b2 |\n+-------+-------+\n \nCALL p1(13);\nQuery OK, 0 rows affected (0.000 sec)\n \n\n\nURL: https://mariadb.com/kb/en/for/','','https://mariadb.com/kb/en/for/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (309,23,'GOTO','The GOTO statement was introduced in MariaDB 10.3 for Oracle\ncompatibility.\n \nSyntax\n------ \nGOTO label\n \nDescription\n----------- \nThe GOTO statement causes the code to jump to the specified\nlabel, and continue operating from there. It is only\naccepted when in Oracle mode.\n \nExample\n \nSET sql_mode=ORACLE;\n \nDELIMITER //\n \nCREATE OR REPLACE PROCEDURE p1 AS\n \nBEGIN\n \n SELECT 1;\n \n GOTO label;\n \n SELECT 2;\n \n SELECT 3;\n \nEND;\n \n//\n \nDELIMITER \n \ncall p1();\n+---+\n| 1 |\n+---+\n| 1 |\n+---+\n1 row in set (0.000 sec)\n \n+---+\n| 3 |\n+---+\n| 3 |\n+---+\n1 row in set (0.000 sec)\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/goto/','','https://mariadb.com/kb/en/goto/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (310,23,'IF','Syntax\n------ \nIF search_condition THEN statement_list\n [ELSEIF search_condition THEN statement_list] ...\n [ELSE statement_list]\nEND IF;\n \nDescription\n----------- \nIF implements a basic conditional construct. If the\nsearch_condition\nevaluates to true, the corresponding SQL statement list is\nexecuted.\nIf no search_condition matches, the statement list in the\nELSE clause\nis executed. Each statement_list consists of one or more\nstatements.\n \n\n\nURL: https://mariadb.com/kb/en/if/','','https://mariadb.com/kb/en/if/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (311,23,'ITERATE','Syntax\n------ \nITERATE label\n \nITERATE can appear only within LOOP, REPEAT, and WHILE\nstatements.\nITERATE means \"do the loop again\", and uses the\nstatement\'s label to determine which statements to repeat.\nThe label must be in the same stored program, not in a\ncaller procedure.\n \nIf you try to use ITERATE with a non-existing label, or if\nthe label is associated to a construct which is not a loop,\nthe following error will be produced:\n \nERROR 1308 (42000): ITERATE with no matching label: \n \nBelow is an example of how ITERATE might be used:\n \nCREATE PROCEDURE doiterate(p1 INT)\nBEGIN\n label1: LOOP\n SET p1 = p1 + 1;\n \n IF p1 \n\nURL: https://mariadb.com/kb/en/iterate/','','https://mariadb.com/kb/en/iterate/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (312,23,'Labels','Syntax\n------ \nlabel: \n[label]\n \nLabels are MariaDB identifiers which can be used to identify\na BEGIN ... END construct or a loop. They have a maximum\nlength of 16 characters and can be quoted with backticks\n(i.e.., `).\n \nLabels have a start part and an end part. The start part\nmust precede the portion of code it refers to, must be\nfollowed by a colon (:) and can be on the same or different\nline. The end part is optional and adds nothing, but can\nmake the code more readable. If used, the end part must\nprecede the construct\'s delimiter (;). Constructs\nidentified by a label can be nested. Each construct can be\nidentified by only one label.\n \nLabels need not be unique in the stored program they belong\nto. However, a label for an inner loop cannot be identical\nto a label for an outer loop. In this case, the following\nerror would be produced:\n \nERROR 1309 (42000): Redefining label \n \nLEAVE and ITERATE statements can be used to exit or repeat a\nportion of code identified by a label. They must be in the\nsame Stored Routine, Trigger or Event which contains the\ntarget label.\n \nBelow is an example using a simple label that is used to\nexit a LOOP:\n \nCREATE PROCEDURE `test_sp`()\nBEGIN\n `my_label`:\n LOOP\n SELECT \'looping\';\n \n LEAVE `my_label`;\n \n END LOOP;\n \n SELECT \'out of loop\';\n \nEND;\n \nThe following label is used to exit a procedure, and has an\nend part:\n \nCREATE PROCEDURE `test_sp`()\n`my_label`:\nBEGIN\n IF @var = 1 THEN\n LEAVE `my_label`;\n \n END IF;\n \n DO something();\nEND `my_label`;\n \n\n \n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/labels/','','https://mariadb.com/kb/en/labels/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (313,23,'LEAVE','Syntax\n------ \nLEAVE label\n \nThis statement is used to exit the flow control construct\nthat has the\ngiven label. The label must be in the same stored program,\nnot in a caller procedure. LEAVE can be used within BEGIN\n... END or loop constructs\n(LOOP, REPEAT, WHILE). In Stored Procedures, Triggers and\nEvents, LEAVE can refer to the outmost BEGIN ... END\nconstruct; in that case, the program exits the procedure. In\nStored Functions, RETURN can be used instead.\n \nNote that LEAVE cannot be used to exit a DECLARE HANDLER\nblock.\n \nIf you try to LEAVE a non-existing label, or if you try to\nLEAVE a HANDLER block, the following error will be produced:\n \nERROR 1308 (42000): LEAVE with no matching label: \n \nThe following example uses LEAVE to exit the procedure if a\ncondition is true:\n \nCREATE PROCEDURE proc(IN p TINYINT)\nCONTAINS SQL\n`whole_proc`:\nBEGIN\n SELECT 1;\n \n IF p \n\nURL: https://mariadb.com/kb/en/leave/','','https://mariadb.com/kb/en/leave/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (314,23,'LOOP','Syntax\n------ \n[begin_label:] LOOP\n statement_list\nEND LOOP [end_label]\n \nDescription\n----------- \nLOOP implements a simple loop construct, enabling repeated\nexecution\nof the statement list, which consists of one or more\nstatements, each\nterminated by a semicolon (i.e., ;) statement delimiter. The\nstatements\nwithin the loop are repeated until the loop is exited;\nusually this is\naccomplished with a LEAVE statement.\n \nA LOOP statement can be labeled. end_label cannot be given\nunless\nbegin_label also is present. If both are present, they must\nbe the\nsame.\n \nSee Delimiters in the mysql client for more on delimiter\nusage in the client.\n \n\n\nURL: https://mariadb.com/kb/en/loop/','','https://mariadb.com/kb/en/loop/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (315,23,'OPEN','Syntax\n------ \n\n\nURL: https://mariadb.com/kb/en/open/','','https://mariadb.com/kb/en/open/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (316,23,'REPEAT LOOP','Syntax\n------ \n[begin_label:] REPEAT\n statement_list\nUNTIL search_condition\nEND REPEAT [end_label]\n \nThe statement list within a REPEAT statement is repeated\nuntil the\nsearch_condition is true. Thus, a REPEAT always enters the\nloop at\nleast once. statement_list consists of one or more\nstatements, each\nterminated by a semicolon (i.e., ;) statement delimiter.\n \nA REPEAT statement can be labeled. end_label cannot be given\nunless\nbegin_label also is present. If both are present, they must\nbe the\nsame.\n \nSee Delimiters in the mysql client for more on client\ndelimiter usage.\n \nDELIMITER //\n \nCREATE PROCEDURE dorepeat(p1 INT)\n BEGIN\n SET @x = 0;\n \n REPEAT SET @x = @x + 1;\n UNTIL @x > p1 END REPEAT;\n \n END\n//\n \nCALL dorepeat(1000)//\n \nSELECT @x//\n+------+\n| @x |\n+------+\n| 1001 |\n+------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/repeat-loop/','','https://mariadb.com/kb/en/repeat-loop/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (317,23,'RESIGNAL','Syntax\n------ \nRESIGNAL [error_condition]\n [SET error_property\n [, error_property] ...]\n \nerror_condition:\n SQLSTATE [VALUE] \'sqlstate_value\'\n | condition_name\n \nerror_property:\n error_property_name = \n \nerror_property_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 \nDescription\n----------- \nThe syntax of RESIGNAL and its semantics are very similar to\nSIGNAL. This statement can only be used within an error\nHANDLER. It produces an error, like SIGNAL. RESIGNAL clauses\nare the same as SIGNAL, except that they all are optional,\neven SQLSTATE. All the properties which are not specified in\nRESIGNAL, will be identical to the properties of the error\nthat was received by the error HANDLER. For a description of\nthe clauses, see diagnostics area.\n \nNote that RESIGNAL does not empty the diagnostics area: it\njust appends another error condition.\n \nRESIGNAL, without any clauses, produces an error which is\nidentical to the error that was received by HANDLER.\n \nIf used out of a HANDLER construct, RESIGNAL produces the\nfollowing error:\n \nERROR 1645 (0K000): RESIGNAL when handler not active\n \nIn MariaDB 5.5, if a HANDLER contained a CALL to another\nprocedure, that procedure could use RESIGNAL. Since MariaDB\n10.0, trying to do this raises the above error.\n \nFor a list of SQLSTATE values and MariaDB error codes, see\nMariaDB Error Codes.\n \nThe following procedure tries to query two tables which\ndon\'t exist, producing a 1146 error in both cases. Those\nerrors will trigger the HANDLER. The first time the error\nwill be ignored and the client will not receive it, but the\nsecond time, the error is re-signaled, so the client will\nreceive it.\n \nCREATE PROCEDURE test_error( )\nBEGIN\n DECLARE CONTINUE HANDLER\n FOR 1146\n BEGIN\n IF @hide_errors IS FALSE THEN\n RESIGNAL;\n \n END IF;\n \n END;\n \n SET @hide_errors = TRUE;\n \n SELECT \'Next error will be ignored\' AS msg;\n \n SELECT `c` FROM `temptab_one`;\n \n SELECT \'Next error won\'\'t be ignored\' AS msg;\n \n SET @hide_errors = FALSE;\n \n SELECT `c` FROM `temptab_two`;\n \nEND;\n \nCALL test_error( );\n \n+----------------------------+\n| msg |\n+----------------------------+\n| Next error will be ignored |\n+----------------------------+\n \n+-----------------------------+\n| msg |\n+-----------------------------+\n| Next error won\'t be ignored |\n+-----------------------------+\n \nERROR 1146 (42S02): Table \'test.temptab_two\' doesn\'t\nexist\n \nThe following procedure re-signals an error, modifying only\nthe error message to clarify the cause of the problem.\n \nCREATE PROCEDURE test_error()\nBEGIN\n DECLARE CONTINUE HANDLER\n FOR 1146\n BEGIN\n RESIGNAL SET\n MESSAGE_TEXT = \'`temptab` does not exist\';\n \n END;\n \n SELECT `c` FROM `temptab`;\n \nEND;\n \nCALL test_error( );\nERROR 1146 (42S02): `temptab` does not exist\n \nAs explained above, this works on MariaDB 5.5, but produces\na 1645 error since 10.0.\n \nCREATE PROCEDURE handle_error()\nBEGIN\n RESIGNAL;\n \nEND;\n \nCREATE PROCEDURE p()\nBEGIN\n DECLARE EXIT HANDLER FOR SQLEXCEPTION CALL p();\n SIGNAL SQLSTATE \'45000\';\n \nEND;\n \n\n\nURL: https://mariadb.com/kb/en/resignal/','','https://mariadb.com/kb/en/resignal/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (318,23,'RETURN','Syntax\n------ \nRETURN expr \n \nThe RETURN statement terminates execution of a stored\nfunction and\nreturns the value expr to the function caller. There must be\nat least\none RETURN statement in a stored function. If the function\nhas multiple exit points, all exit points must have a\nRETURN.\n \nThis statement is not used in stored procedures, triggers,\nor events. LEAVE can be used instead.\n \nThe following example shows that RETURN can return the\nresult of a scalar subquery:\n \nCREATE FUNCTION users_count() RETURNS BOOL\n READS SQL DATA\nBEGIN\n RETURN (SELECT COUNT(DISTINCT User) FROM mysql.user);\nEND;\n \n\n \n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/return/','','https://mariadb.com/kb/en/return/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (319,23,'SELECT INTO','Syntax\n------ \nSELECT col_name [, col_name] ...\n INTO var_name [, var_name] ...\n table_expr\n \nDescription\n----------- \nSELECT ... INTO enables selected columns to be stored\ndirectly\ninto variables. No resultset is produced. The query should\nreturn a single row. If the query\nreturns no rows, a warning with error code 1329 occurs (No\ndata), and\nthe variable values remain unchanged. If the query returns\nmultiple\nrows, error 1172 occurs (Result consisted of more than one\nrow). If it\nis possible that the statement may retrieve multiple rows,\nyou can use\nLIMIT 1 to limit the result set to a single row.\n \nThe INTO clause can also be specified at the end of the\nstatement.\n \nIn the context of such statements that occur as part of\nevents\nexecuted by the Event Scheduler, diagnostics messages (not\nonly\nerrors, but also warnings) are written to the error log,\nand, on\nWindows, to the application event log.\n \nThis statement can be used with both local variables and\nuser-defined variables.\n \nFor the complete syntax, see SELECT.\n \nAnother way to set a variable\'s value is the SET statement.\n \nSELECT ... INTO results are not stored in the query cache\neven if SQL_CACHE is specified.\n \nExamples\n-------- \nSELECT id, data INTO @x,@y \nFROM test.t1 LIMIT 1;\n \n\n\nURL: https://mariadb.com/kb/en/selectinto/','','https://mariadb.com/kb/en/selectinto/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (320,23,'SIGNAL','Syntax\n------ \nSIGNAL error_condition\n [SET error_property\n [, error_property] ...]\n \nerror_condition:\n SQLSTATE [VALUE] \'sqlstate_value\'\n | condition_name\n \nerror_property:\n error_property_name = \n \nerror_property_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 \nSIGNAL empties the diagnostics area and produces a custom\nerror. This statement can be used anywhere, but is generally\nuseful when used inside a stored program. When the error is\nproduced, it can be caught by a HANDLER. If not, the current\nstored program, or the current statement, will terminate\nwith the specified error.\n \nSometimes an error HANDLER just needs to SIGNAL the same\nerror it received, optionally with some changes. Usually the\nRESIGNAL statement is the most convenient way to do this.\n \nerror_condition can be an SQLSTATE value or a named error\ncondition defined via DECLARE CONDITION. SQLSTATE must be a\nconstant string consisting of five characters. These codes\nare standard to ODBC and ANSI SQL. For customized errors,\nthe recommended SQLSTATE is \'45000\'. For a list of\nSQLSTATE values used by MariaDB, see the MariaDB Error Codes\npage. The SQLSTATE can be read via the API method\nmysql_sqlstate( ). \n \nTo specify error properties user-defined variables and local\nvariables can be used, as well as character set conversions\n(but you can\'t set a collation).\n \nThe error properties, their type and their default values\nare explained in the diagnostics area page.\n \nErrors\n \nIf the SQLSTATE is not valid, the following error like this\nwill be produced:\n \nERROR 1407 (42000): Bad SQLSTATE: \'123456\'\n \nIf a property is specified more than once, an error like\nthis will be produced:\n \nERROR 1641 (42000): Duplicate condition information item\n\'MESSAGE_TEXT\'\n \nIf you specify a condition name which is not declared, an\nerror like this will be produced:\n \nERROR 1319 (42000): Undefined CONDITION: cond_name\n \nIf MYSQL_ERRNO is out of range, you will get an error like\nthis:\n \nERROR 1231 (42000): Variable \'MYSQL_ERRNO\' can\'t be set\nto the value of \'0\'\n \nExamples\n-------- \nHere\'s what happens if SIGNAL is used in the client to\ngenerate errors:\n \nSIGNAL SQLSTATE \'01000\';\n \nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+---------+------+------------------------------------------+\n| Level | Code | Message |\n+---------+------+------------------------------------------+\n| Warning | 1642 | Unhandled user-defined warning condition\n|\n+---------+------+------------------------------------------+\n1 row in set (0.06 sec)\n \nSIGNAL SQLSTATE \'02000\';\n \nERROR 1643 (02000): Unhandled user-defined not found\ncondition\n \nHow to specify MYSQL_ERRNO and MESSAGE_TEXT properties:\n \nSIGNAL SQLSTATE \'45000\' SET MYSQL_ERRNO=30001,\nMESSAGE_TEXT=\'H\nello, world!\';\n \nERROR 30001 (45000): Hello, world!\n \nThe following code shows how to use user variables, local\nvariables and character set conversion with SIGNAL:\n \nCREATE PROCEDURE test_error(x INT)\nBEGIN\n DECLARE errno SMALLINT UNSIGNED DEFAULT 31001;\n \n SET @errmsg = \'Hello, world!\';\n \n IF x = 1 THEN\n SIGNAL SQLSTATE \'45000\' SET\n MYSQL_ERRNO = errno,\n MESSAGE_TEXT = @errmsg;\n \n ELSE\n SIGNAL SQLSTATE \'45000\' SET\n MYSQL_ERRNO = errno,\n MESSAGE_TEXT = _utf8\'Hello, world!\';\n \n END IF;\n \nEND;\n \nHow to use named error conditions:\n \nCREATE PROCEDURE test_error(n INT)\nBEGIN\n DECLARE `too_big` CONDITION FOR SQLSTATE \'45000\';\n \n IF n > 10 THEN\n SIGNAL `too_big`;\n \n END IF;\n \nEND;\n \nIn this example, we\'ll define a HANDLER for an error code.\nWhen the error occurs, we SIGNAL a more informative error\nwhich makes sense for our procedure:\n \nCREATE PROCEDURE test_error()\nBEGIN\n DECLARE EXIT HANDLER\n FOR 1146\n BEGIN\n SIGNAL SQLSTATE \'45000\' SET\n MESSAGE_TEXT = \'Temporary tables not found; did you call\ninit() procedure?\';\n \n END;\n \n -- this will produce a 1146 error\n SELECT `c` FROM `temptab`;\n \nEND;\n \n\n\nURL: https://mariadb.com/kb/en/signal/','','https://mariadb.com/kb/en/signal/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (321,23,'WHILE','Syntax\n------ \n[begin_label:] WHILE search_condition DO\n statement_list\nEND WHILE [end_label]\n \nDescription\n----------- \nThe statement list within a WHILE statement is repeated as\nlong as the\nsearch_condition is true. statement_list consists of one or\nmore\nstatements. If the loop must be executed at least once,\nREPEAT ... LOOP can be used instead.\n \nA WHILE statement can be labeled. end_label cannot be given\nunless\nbegin_label also is present. If both are present, they must\nbe the\nsame.\n \nExamples\n-------- \nCREATE PROCEDURE dowhile()\nBEGIN\n DECLARE v1 INT DEFAULT 5;\n \n WHILE v1 > 0 DO\n ...\n SET v1 = v1 - 1;\n \n END WHILE;\n \nEND\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/while/','','https://mariadb.com/kb/en/while/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (322,24,'BUFFER','A synonym for ST_BUFFER.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/buffer/','','https://mariadb.com/kb/en/buffer/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (323,24,'CONVEXHULL','A synonym for ST_CONVEXHULL.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/convexhull/','','https://mariadb.com/kb/en/convexhull/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (324,24,'GEOMETRYCOLLECTION','Syntax\n------ \nGeometryCollection(g1,g2,...)\n \nDescription\n----------- \nConstructs a WKB GeometryCollection. If any argument is not\na well-formed WKB representation of a geometry, the return\nvalue is NULL.\n \nExamples\n-------- \nCREATE TABLE gis_geometrycollection (g GEOMETRYCOLLECTION);\nSHOW FIELDS FROM gis_geometrycollection;\n \nINSERT INTO gis_geometrycollection VALUES\n (GeomCollFromText(\'GEOMETRYCOLLECTION(POINT(0 0),\nLINESTRING(0 0,10 10))\')),\n (GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6),\nLineString(Point(3, 6), Point(7, 9)))))),\n (GeomFromText(\'GeometryCollection()\')),\n (GeomFromText(\'GeometryCollection EMPTY\'));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/geometrycollection/','','https://mariadb.com/kb/en/geometrycollection/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (325,24,'LINESTRING','Syntax\n------ \nLineString(pt1,pt2,...)\n \nDescription\n----------- \nConstructs a WKB LineString value from a number of WKB Point\narguments. If any argument is not a WKB Point, the return\nvalue is\nNULL. If the number of Point arguments is less than two, the\nreturn value is NULL.\n \nExamples\n-------- \nSET @ls = \'LineString(1 1,2 2,3 3)\';\n \nSELECT AsText(EndPoint(GeomFromText(@ls)));\n+-------------------------------------+\n| AsText(EndPoint(GeomFromText(@ls))) |\n+-------------------------------------+\n| POINT(3 3) |\n+-------------------------------------+\n \nCREATE TABLE gis_line (g LINESTRING);\nINSERT INTO gis_line VALUES\n (LineFromText(\'LINESTRING(0 0,0 10,10 0)\')),\n (LineStringFromText(\'LINESTRING(10 10,20 10,20 20,10 20,10\n10)\')),\n (LineStringFromWKB(AsWKB(LineString(Point(10, 10),\nPoint(40, 10)))));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/linestring/','','https://mariadb.com/kb/en/linestring/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (326,24,'MULTILINESTRING','Syntax\n------ \nMultiLineString(ls1,ls2,...)\n \nDescription\n----------- \nConstructs a WKB MultiLineString value using WKB LineString\narguments. If any argument is not a WKB LineString, the\nreturn value is\nNULL.\n \nExample\n \nCREATE TABLE gis_multi_line (g MULTILINESTRING);\nINSERT INTO gis_multi_line VALUES\n (MultiLineStringFromText(\'MULTILINESTRING((10 48,10 21,10\n0),(16 0,16 23,16 48))\')),\n (MLineFromText(\'MULTILINESTRING((10 48,10 21,10 0))\')),\n (MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2),\nPoint(3, 5)), LineString(Point(2, 5),Point(5, 8),Point(21,\n7))))));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/multilinestring/','','https://mariadb.com/kb/en/multilinestring/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (327,24,'MULTIPOINT','Syntax\n------ \nMultiPoint(pt1,pt2,...)\n \nDescription\n----------- \nConstructs a WKB MultiPoint value using WKB Point arguments.\nIf any argument is not a WKB Point, the return value is\nNULL.\n \nExamples\n-------- \nSET @g = ST_GEOMFROMTEXT(\'MultiPoint( 1 1, 2 2, 5 3, 7 2, 9\n3, 8 4, 6 6, 6 9, 4 9, 1 5 )\');\n \nCREATE TABLE gis_multi_point (g MULTIPOINT);\nINSERT INTO gis_multi_point VALUES\n (MultiPointFromText(\'MULTIPOINT(0 0,10 10,10 20,20\n20)\')),\n (MPointFromText(\'MULTIPOINT(1 1,11 11,11 21,21 21)\')),\n (MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4,\n10)))));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/multipoint/','','https://mariadb.com/kb/en/multipoint/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (328,24,'MULTIPOLYGON','Syntax\n------ \nMultiPolygon(poly1,poly2,...)\n \nDescription\n----------- \nConstructs a WKB MultiPolygon value from a set of WKB\nPolygon arguments. If any argument is not a WKB Polygon, the\nreturn value is NULL.\n \nExample\n \nCREATE TABLE gis_multi_polygon (g MULTIPOLYGON);\nINSERT INTO gis_multi_polygon VALUES\n (MultiPolygonFromText(\'MULTIPOLYGON(((28 26,28 0,84 0,84\n42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67\n13,59 13,59 18)))\')),\n (MPolyFromText(\'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28\n26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59\n13,59 18)))\')),\n (MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0,\n3), Point(3, 3), Point(3, 0), Point(0, 3)))))));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/multipolygon/','','https://mariadb.com/kb/en/multipolygon/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (329,24,'POINT','Syntax\n------ \nPoint(x,y)\n \nDescription\n----------- \nConstructs a WKB Point using the given coordinates.\n \nExamples\n-------- \nSET @g = ST_GEOMFROMTEXT(\'Point(1 1)\');\n \nCREATE TABLE gis_point (g POINT);\nINSERT INTO gis_point VALUES\n (PointFromText(\'POINT(10 10)\')),\n (PointFromText(\'POINT(20 10)\')),\n (PointFromText(\'POINT(20 20)\')),\n (PointFromWKB(AsWKB(PointFromText(\'POINT(10 20)\'))));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/point/','','https://mariadb.com/kb/en/point/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (330,24,'PointOnSurface','A synonym for ST_PointOnSurface.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/pointonsurface/','','https://mariadb.com/kb/en/pointonsurface/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (331,24,'POLYGON','Syntax\n------ \nPolygon(ls1,ls2,...)\n \nDescription\n----------- \nConstructs a WKB Polygon value from a number of WKB\nLineString\narguments. If any argument does not represent the WKB of a\nLinearRing (that is,\nnot a closed and simple LineString) the return value is\nNULL.\n \nNote that according to the OpenGIS standard, a POLYGON\nshould have exactly one ExteriorRing and all other rings\nshould lie within that ExteriorRing and thus be the\nInteriorRings. Practically, however, some systems, including\nMariaDB\'s, permit polygons to have several\n\'ExteriorRings\'. In the case of there being multiple,\nnon-overlapping exterior rings ST_NUMINTERIORRINGS() will\nreturn 1.\n \nExamples\n-------- \nSET @g = ST_GEOMFROMTEXT(\'POLYGON((1 1,1 5,4 9,6 9,9 3,7\n2,1 1))\');\n \nCREATE TABLE gis_polygon (g POLYGON);\nINSERT INTO gis_polygon VALUES\n (PolygonFromText(\'POLYGON((10 10,20 10,20 20,10 20,10\n10))\')),\n (PolyFromText(\'POLYGON((0 0,50 0,50 50,0 50,0 0), (10\n10,20 10,20 20,10 20,10 10))\')),\n (PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0),\nPoint(30, 0), Point(30, 30), Point(0, 0))))));\n \nNon-overlapping \'polygon\':\n \nSELECT ST_NumInteriorRings(ST_PolyFromText(\'POLYGON((0 0,10\n0,10 10,0 10,0 0),\n (-1 -1,-5 -1,-5 -5,-1 -5,-1 -1))\')) AS NumInteriorRings;\n \n+------------------+\n| NumInteriorRings |\n+------------------+\n| 1 |\n+------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/polygon/','','https://mariadb.com/kb/en/polygon/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (332,24,'ST_BUFFER','Syntax\n------ \nST_BUFFER(g1,r)\nBUFFER(g1,r)\n \nDescription\n----------- \nReturns a geometry that represents all points whose distance\nfrom geometry g1 is less than or equal to distance, or\nradius, r.\n \nUses for this function could include creating for example a\nnew geometry representing a buffer zone around an island.\n \nBUFFER() is a synonym.\n \nExamples\n-------- \nDetermining whether a point is within a buffer zone:\n \nSET @g1 = ST_GEOMFROMTEXT(\'POLYGON((10 10, 10 20, 20 20, 20\n10, 10 10))\');\n \nSET @g2 = ST_GEOMFROMTEXT(\'POINT(8 8)\');\n \nSELECT ST_WITHIN(@g2,ST_BUFFER(@g1,5));\n+---------------------------------+\n| ST_WITHIN(@g2,ST_BUFFER(@g1,5)) |\n+---------------------------------+\n| 1 |\n+---------------------------------+\n \nSELECT ST_WITHIN(@g2,ST_BUFFER(@g1,1));\n+---------------------------------+\n| ST_WITHIN(@g2,ST_BUFFER(@g1,1)) |\n+---------------------------------+\n| 0 |\n+---------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_buffer/','','https://mariadb.com/kb/en/st_buffer/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (333,24,'ST_CONVEXHULL','ST_ConvexHull() was introduced in MariaDB 10.1.2\n \nSyntax\n------ \nST_ConvexHull(g)\nConvexHull(g)\n \nDescription\n----------- \nGiven a geometry, returns a geometry that is the minimum\nconvex geometry enclosing all geometries within the set.\nReturns NULL if the geometry value is NULL or an empty\nvalue.\n \nST_ConvexHull() and ConvexHull() are synonyms.\n \nExamples\n-------- \nThe ConvexHull of a single point is simply the single point:\n \nSET @g = ST_GEOMFROMTEXT(\'Point(0 0)\');\n \nSELECT ST_ASTEXT(ST_CONVEXHULL(@g));\n+------------------------------+\n| ST_ASTEXT(ST_CONVEXHULL(@g)) |\n+------------------------------+\n| POINT(0 0) |\n+------------------------------+\n \nSET @g = ST_GEOMFROMTEXT(\'MultiPoint(0 0, 1 2, 2 3)\');\n \nSELECT ST_ASTEXT(ST_CONVEXHULL(@g));\n+------------------------------+\n| ST_ASTEXT(ST_CONVEXHULL(@g)) |\n+------------------------------+\n| POLYGON((0 0,1 2,2 3,0 0)) |\n+------------------------------+\n \nSET @g = ST_GEOMFROMTEXT(\'MultiPoint( 1 1, 2 2, 5 3, 7 2, 9\n3, 8 4, 6 6, 6 9, 4 9, 1 5 )\');\n \nSELECT ST_ASTEXT(ST_CONVEXHULL(@g));\n+----------------------------------------+\n| ST_ASTEXT(ST_CONVEXHULL(@g)) |\n+----------------------------------------+\n| POLYGON((1 1,1 5,4 9,6 9,9 3,7 2,1 1)) |\n+----------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_convexhull/','','https://mariadb.com/kb/en/st_convexhull/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (334,24,'ST_INTERSECTION','Syntax\n------ \nST_INTERSECTION(g1,g2)\n \nDescription\n----------- \nReturns a geometry that is the intersection, or shared\nportion, of geometry g1 and geometry g2.\n \nExamples\n-------- \nSET @g1 = ST_GEOMFROMTEXT(\'POINT(2 1)\');\n \nSET @g2 = ST_GEOMFROMTEXT(\'LINESTRING(2 1, 0 2)\');\n \nSELECT ASTEXT(ST_INTERSECTION(@g1,@g2));\n+----------------------------------+\n| ASTEXT(ST_INTERSECTION(@g1,@g2)) |\n+----------------------------------+\n| POINT(2 1) |\n+----------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_intersection/','','https://mariadb.com/kb/en/st_intersection/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (335,24,'ST_POINTONSURFACE','ST_POINTONSURFACE() was introduced in MariaDB 10.1.2\n \nSyntax\n------ \nST_PointOnSurface(g)\nPointOnSurface(g)\n \nDescription\n----------- \nGiven a geometry, returns a POINT guaranteed to intersect a\nsurface. However, see MDEV-7514.\n \nST_PointOnSurface() and PointOnSurface() are synonyms.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_pointonsurface/','','https://mariadb.com/kb/en/st_pointonsurface/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (336,24,'ST_SYMDIFFERENCE','Syntax\n------ \nST_SYMDIFFERENCE(g1,g2)\n \nDescription\n----------- \nReturns a geometry that represents the portions of geometry\ng1 and geometry g2 that don\'t intersect.\n \nExamples\n-------- \nSET @g1 = ST_GEOMFROMTEXT(\'LINESTRING(10 20, 10 40)\');\n \nSET @g2 = ST_GEOMFROMTEXT(\'LINESTRING(10 15, 10 25)\');\n \nSELECT ASTEXT(ST_SYMDIFFERENCE(@g1,@g2));\n+----------------------------------------------+\n| ASTEXT(ST_SYMDIFFERENCE(@g1,@g2)) |\n+----------------------------------------------+\n| MULTILINESTRING((10 15,10 20),(10 25,10 40)) |\n+----------------------------------------------+\n \nSET @g2 = ST_GeomFromText(\'LINESTRING(10 20, 10 41)\');\n \nSELECT ASTEXT(ST_SYMDIFFERENCE(@g1,@g2));\n+-----------------------------------+\n| ASTEXT(ST_SYMDIFFERENCE(@g1,@g2)) |\n+-----------------------------------+\n| LINESTRING(10 40,10 41) |\n+-----------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_symdifference/','','https://mariadb.com/kb/en/st_symdifference/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (337,24,'ST_UNION','Syntax\n------ \nST_UNION(g1,g2)\n \nDescription\n----------- \nReturns a geometry that is the union of the geometry g1 and\ngeometry g2.\n \nExamples\n-------- \nSET @g1 = GEOMFROMTEXT(\'POINT (0 2)\');\n \nSET @g2 = GEOMFROMTEXT(\'POINT (2 0)\');\n \nSELECT ASTEXT(ST_UNION(@g1,@g2));\n+---------------------------+\n| ASTEXT(ST_UNION(@g1,@g2)) |\n+---------------------------+\n| MULTIPOINT(2 0,0 2) |\n+---------------------------+\n \nSET @g1 = GEOMFROMTEXT(\'POLYGON((0 0,0 3,3 3,3 0,0 0))\');\n \nSET @g2 = GEOMFROMTEXT(\'POLYGON((2 2,4 2,4 4,2 4,2 2))\');\n \nSELECT ASTEXT(ST_UNION(@g1,@g2));\n+------------------------------------------------+\n| ASTEXT(ST_UNION(@g1,@g2)) |\n+------------------------------------------------+\n| POLYGON((0 0,0 3,2 3,2 4,4 4,4 2,3 2,3 0,0 0)) |\n+------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_union/','','https://mariadb.com/kb/en/st_union/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (338,26,'BACKUP STAGE','BACKUP STAGE commands are a set of commands to make it\npossible to make an efficient external backup tool. \n \nThe BACKUP STAGE command was introduced in MariaDB 10.4.1.\n \nSyntax\n------ \nBACKUP STAGE [START | FLUSH | BLOCK_DDL | BLOCK_COMMIT | END\n]\n \nIn the following text, a transactional table means InnoDB or\n\"InnoDB-like engine with redo log that can lock redo purges\nand can be copied without locks by an outside process\".\n \nIn the text we refer to mariabackup as the backup tool to\nuse. However the description should work for any tools that\nsupport BACKUP STAGEs.\n \nGoals with BACKUP STAGE Commands\n \nTo be able to do a majority of the backup with the minimum\npossible server locks. Especially for transactional tables\n(InnoDB, MyRocks etc) there is only need for a very short\nblock of new commits while copying statistics and log\ntables.\nDDL are only needed to be blocked for a very short duration\nof the backup while mariabackup is copying the tables\naffected by DDL during the initial part of the backup.\nMost non transactional tables (those that are not in use)\nwill be copied during BACKUP STAGE START. The exceptions are\nsystem statistic and log tables that are not blocked during\nthe backup until BLOCK_COMMIT.\nShould work efficiently with backup tools that use disk\nsnapshots.\nShould work as efficiently as possible for all table types\nthat store data on the local disks.\nAs little copying as possible under higher level\nstages/locks. For example, .frm (dictionary) and .trn\n(trigger) files should be copying while copying the table\ndata.\n \nBACKUP STAGE Commands\n \nBACKUP STAGE START\n \nThings Done by STAGE START\n \nBlocks purge of redo files for storage engines that needs\nthis (Aria)\nStart logging of DDL commands into \'datadir\'/ddl.log. This\nmay take a short time as the command has to wait until there\nall now active DDL commands.\n \nmariabackup Under START\n \nmariabackup can, under START:\nCopy all transactional tables, aria_log_control, aria_log.#\nand\nother engines redo logs.\nCall BACKUP STAGE FLUSH while copying the last set of files.\n \nTo copy InnoDB tables, mariabackup has to start to watch the\nInnoDB backup redo log and copy all changes to the backup to\nbe able to run the redos later on in the final backup.\n \nBACKUP STAGE FLUSH\n \nThings Done by STAGE FLUSH\n \nFLUSH all changes for inactive non-transactional tables,\nexcept for statistics and log tables.\nClose all tables that are not in use, to ensure they are\nmarked as closed for the backup.\nBLOCK all new write locks for all non transactional tables\n(except statistics and log tables). The command will not\nwait for tables that are in use by read-only transactions.\n \nDDLs don\'t have to be blocked at this stage as they can\'t\ncause the table to be in an inconsistent state. This is true\nalso for non-transactional tables.\n \nmariabackup under STAGE_FLUSH\n \nmariabackup can, under STAGE FLUSH:\nCopy all non-transactional tables that are not in use. This\nlist of used tables can be found with SHOW OPEN TABLES\nCopy all new changes to the aria_log.# tables\n \nAt this point data for all old tables should have been\ncopied (except for some system tables).\n \nBACKUP STAGE BLOCK_DDL\n \nThings Done by BLOCK_DDL\n \nWait for all statements using write locked non-transactional\ntables to end.\nBlocks CREATE TABLE, DROP TABLE, TRUNCATE TABLE, and RENAME\nTABLE.\nBlocks also start off a new ALTER TABLE and the final rename\nphase of ALTER TABLE. Running ALTER TABLES are not blocked.\n \nmariabackup under BLOCK_DDL\n \nmariabackup can, under BLOCK_DDL:\nCopy the non-transactional tables that were in use during\nSTAGE FLUSH\nCopy new tables created before BLOCK DDL. The file names can\nbe read from ddl.log. The log also allows the backup to\nexecute renames of files for which RENAME TABLE was done\ninstead of copying them.\nAdd markers to backup stream of tables that were dropped\nduring the earlier BACKUP STAGEs.\nCopy changes to system log tables (this is easy as these are\nappend only)\nCopy changes to aria_log.# tables (this is easy as these are\nappend only)\n \nBACKUP STAGE BLOCK_COMMIT\n \nThings Done by BLOCK_COMMIT\n \nLock the binary log and commit/rollback to ensure that no\nchanges are committed to any tables. If there are active\ncommits or data to be copied to the binary log this will be\nallowed to finish.\nThis doesn\'t lock temporary tables that are not used by\nreplication. However these will be blocked when it\'s time\nto write to the binary log.\nLock system log tables and statistics tables, flush them and\nmark them closed.\n \nWhen the BLOCK_COMMIT\'s stages return, this is the \'backup\ntime\'. Everything committed will be in the backup and\neverything not committed will roll back.\n \nTransactional engines will continue to do changes to the\nredo log during the BLOCK COMMIT stage, but this is not\nimportant as all of these will roll back later as the\nchanges will not be committed.\n \nmariabackup Under BLOCK_COMMIT\n \nmariabackup can, under BLOCK_COMMIT:\nCopy the last changes to the redo files for InnoDB and Aria\n(aria_log.#), and the part of the binary log that was not\ncopied before.\nMyRocks files can also be hard linked to the backup\ndirectory\nEnd of system log tables (slow_log and general_log) and all\nstatistics tables (table_stats, column_stats and\nindex_stats) should also be copied.\n \nBACKUP STAGE END\n \nThings Done by END\n \nEnd DDL logging\nFree resources\n \nmariabackup After END\n \nmariabackup can, after END:\nCopy MyRocks tables\n \nUsing BACKUP STAGE With Disk Snapshots\n \nA tool that is using disk snapshots for copying MariaDB\nfiles should do\n \nBACKUP STAGE START\nBACKUP STAGE BLOCK_COMMIT\n \ndisk snapshot\n \nBACKUP STAGE END\n \nThe above ensures that all non-transactional tables are\nproperly flushed to disk before the snapshot is done.\nUsing BACKUP STAGEs is also more efficient than using FLUSH\nTABLES WITH READ LOCK as the above set of commands will not\nblock or be blocked by write operations to transactional\ntables.\n \nNote that when the backup is completed, one should delete\nall files with the \"#sql\" prefix, as these are files used\nby concurrent running ALTER TABLE. Note that InnoDB will on\nserver restart automatically delete any tables with the\n\"#sql\" prefix.\n \nPrivileges\n \nBACKUP STAGE requires the RELOAD privilege.\n \nOther Things\n \nOnly one connection can run BACKUP STAGE START. If a second\nconnection tries, it will wait until the first one has\nexecuted BACKUP STAGE END.\nIf the user skips a BACKUP STAGE, all intermediate backup\nstages will automatically be run. This will allow us to add\nnew BACKUP STAGEs in the future with even more precise locks\nwithout causing problems for tools using an earlier version\nof BACKUP STAGEs\nWhile opening files for a table, mariabackup should use\nBACKUP LOCK to ensure that all files for a table are from\nthe same generation, that is, created at the same time.\nOne can use the max_statement_time or lock_wait_timeout\nvariables to ensure that a BACKUP STAGE command doesn\'t\nblock the server too long.\nDDL logging will only be available in MariaDB Enterprise\nserver 10.2, 10.3 and 10.4.\n \n\n\nURL: https://mariadb.com/kb/en/backup-stage/','','https://mariadb.com/kb/en/backup-stage/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (339,26,'BACKUP LOCK','The BACKUP LOCK command was introduced in MariaDB 10.4.2.\n \nBACKUP LOCK blocks a table from DDL statements. This is\nmainly intended to be used by tools like mariabackup that\nneed to ensure there are no DDLs on a table while the table\nfiles are opened. For example, for an Aria table that stores\ndata in 3 files with extensions .frm, .MAI and .MAD.\nNormal read/write operations can continue as normal.\n \nSyntax\n------ \nTo lock a table:\n \nBACKUP LOCK table_name\n \nTo unlock a table:\n \nBACKUP UNLOCK\n \nUsage in a Backup Tool\n \nBACKUP LOCK [database.]table_name;\n - Open all files related to a table (for example, t.frm,\nt.MAI and t.MYD)\nBACKUP UNLOCK;\n- Copy data\n- Close files\n \nThis ensures that all files are from the same generation,\nthat is created at the same time by the MariaDB server.\n \nPrivileges\n \nBACKUP LOCK requires the RELOAD privilege.\n \nNotes\n \nThe idea is that the BACKUP LOCK should be held for as short\na time as possible by the backup tool. The time to take an\nuncontested lock is very short! One can easily do 50,000\nlocks/unlocks per second on low end hardware.\nOne should use different connections for BACKUP STAGE\ncommands and BACKUP LOCK. \n \nImplementation\n \nInternally, BACKUP LOCK is implemented by taking an\nMDLSHARED_HIGH_PRIO MDL lock on the table object, which\nprotects the table from any DDL operations.\n \n\n\nURL: https://mariadb.com/kb/en/backup-lock/','','https://mariadb.com/kb/en/backup-lock/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (340,26,'BINLOG','Syntax\n------ \nBINLOG \'str\'\n \nDescription\n----------- \nBINLOG is an internal-use statement. It is generated by the\nmysqlbinlog program as the printable representation of\ncertain events\nin binary log files. The \'str\' value is a base 64-encoded\nstring the that server decodes to determine the data change\nindicated by the\ncorresponding event. This statement requires the SUPER\nprivilege. It was added in MySQL 5.1.5.\n \n\n\nURL: https://mariadb.com/kb/en/binlog/','','https://mariadb.com/kb/en/binlog/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (341,26,'CACHE INDEX','Syntax\n------ \nCACHE INDEX \n tbl_index_list [, tbl_index_list] ...\n IN key_cache_name \n \ntbl_index_list:\n tbl_name [[INDEX|KEY] (index_name[, index_name] ...)]\n \nDescription\n----------- \nThe CACHE INDEX statement assigns table indexes to a\nspecific key\ncache. It is used only for MyISAM tables.\n \nA default key cache exists and cannot be destroyed. To\ncreate more key caches, the key_buffer_size server system\nvariable.\n \nThe associations between tables indexes and key caches are\nlost on server restart. To recreate them automatically, it\nis necessary to configure caches in a configuration file and\ninclude some CACHE INDEX (and optionally LOAD INDEX)\nstatements in the init file.\n \nExamples\n-------- \nThe following statement assigns indexes from the tables t1,\nt2, and t3\nto the key cache named hot_cache:\n \nCACHE 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 \nImplementation (for MyISAM)\n \nNormally CACHE INDEX should not take a long time to execute.\nInternally it\'s implemented the following way:\nFind the right key cache (under\nLOCK_global_system_variables)\nOpen the table with a TL_READ_NO_INSERT lock.\nFlush the original key cache for the given file (under key\ncache lock)\nFlush the new key cache for the given file (safety)\nMove the file to the new key cache (under file share lock)\n \nThe only possible long operations are getting the locks for\nthe table and flushing the original key cache, if there were\nmany key blocks for the file in it.\n \nWe plan to also add CACHE INDEX for Aria tables if there is\na need for this.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/cache-index/','','https://mariadb.com/kb/en/cache-index/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (342,26,'FLUSH','Syntax\n------ \nFLUSH [NO_WRITE_TO_BINLOG | LOCAL]\n flush_option [, flush_option] ...\n \nor when flushing tables:\n \nFLUSH [NO_WRITE_TO_BINLOG | LOCAL] TABLES [table_list]\n[table_flush_option]\n \nwhere table_list is a list of tables separated by , (comma).\n \nDescription\n----------- \nThe FLUSH statement clears or reloads various internal\ncaches used by\nMariaDB. To execute FLUSH, you must have the RELOAD\nprivilege. See GRANT.\n \nThe RESET statement is similar to FLUSH. See\nRESET.\n \nYou cannot issue a FLUSH statement from within a stored\nfunction or a trigger. Doing so within a stored procedure is\npermitted, as long as it is not called by a stored function\nor trigger. See Stored Routine Limitations, Stored Function\nLimitations and Trigger Limitations.\n \nIf a listed table is a view, an error like the following\nwill be produced:\n \nERROR 1347 (HY000): \'test.v\' is not BASE TABLE\n \nBy default, FLUSH statements are written to the binary log\nand will be replicated. The NO_WRITE_TO_BINLOG keyword\n(LOCAL is an alias) will ensure the statement is not written\nto the binary log. \n \nThe different flush options are:\n \nOption | Description | \n \nCHANGED_PAGE_BITMAPS | Internal command used for backup\npurposes. See the Information Schema CHANGED_PAGE_BITMAPS\nTable. | \n \nCLIENT_STATISTICS | Reset client statistics (see SHOW\nCLIENT_STATISTICS). | \n \nDES_KEY_FILE | Reloads the DES key file (Specified with the\n--des-key-file startup option). | \n \nHOSTS | Flush the hostname cache (used for converting ip to\nhost names and for unblocking blocked hosts. See\nmax_connect_errors) | \n \nINDEX_STATISTICS | Reset index statistics (see SHOW\nINDEX_STATISTICS). | \n \n[ERROR | ENGINE | GENERAL | SLOW | BINARY | RELAY] LOGS |\nClose and reopen the specified log type, or all log types if\nnone are specified. FLUSH RELAY LOGS [connection-name] can\nbe used to flush the relay logs for a specific connection.\nOnly one connection can be specified per FLUSH command. See\nMulti-source replication. FLUSH ENGINE LOGS will delete all\nunneeded Aria redo logs. Since MariaDB 10.1.30 and MariaDB\n10.2.11, FLUSH BINARY LOGS\nDELETE_DOMAIN_ID=(list-of-domains) can be used to discard\nobsolete GTID domains from the server\'s binary log state.\nIn order for this to be successful, no event group from the\nlisted GTID domains can be present in existing binary log\nfiles. If some still exist, then they must be purged prior\nto executing this command. If the command completes\nsuccessfully, then it also rotates the binary log. | \n \nMASTER | Deprecated option, use RESET MASTER instead. | \n \nPRIVILEGES | Reload all privileges from the privilege tables\nin the mysql database. If the server is started with\n--skip-grant-table option, this will activate the privilege\ntables again. | \n \nQUERY CACHE | Defragment the query cache to better utilize\nits memory. If you want to reset the query cache, you can do\nit with RESET QUERY CACHE. | \n \nQUERY_RESPONSE_TIME | See the QUERY_RESPONSE_TIME plugin. | \n \nSLAVE | Deprecated option, use RESET SLAVE instead. | \n \nSSL | Used to dynamically reinitialize the server\'s TLS\ncontext by reloading the files defined by several TLS system\nvariables. See FLUSH SSL for more information. This command\nwas first added in MariaDB 10.4.1. | \n \nSTATUS | Resets all server status variables that can be\nreset to 0. Not all global status variables support this, so\nnot all global values are reset. See FLUSH STATUS for more\ninformation. | \n \nTABLE | Close tables given as options or all open tables if\nno table list was used. From MariaDB 10.4.1, using without\nany table list will only close tables not in use, and tables\nnot locked by the FLUSH TABLES connection. If there are no\nlocked tables, FLUSH TABLES will be instant and will not\ncause any waits, as it no longer waits for tables in use.\nWhen a table list is provided, from MariaDB 10.4.1, the\nserver will wait for the end of any transactions that are\nusing the tables. Previously, FLUSH TABLES only waited for\nthe statements to complete. | \n \nTABLES | Same as FLUSH TABLE. | \n \nTABLES ... FOR EXPORT | For InnoDB tables, flushes table\nchanges to disk to permit binary table copies while the\nserver is running. Introduced in MariaDB 10.0.8. See FLUSH\nTABLES ... FOR EXPORT for more. | \n \nTABLES WITH READ LOCK | Closes all open tables. New tables\nare only allowed to be opened with read locks until an\nUNLOCK TABLES is given. | \n \nTABLES WITH READ LOCK AND DISABLE CHECKPOINT | As TABLES\nWITH READ LOCK but also disable all checkpoint writes by\ntransactional table engines. This is useful when doing a\ndisk snapshot of all tables. | \n \nTABLE_STATISTICS | Reset table statistics (see SHOW\nTABLE_STATISTICS). | \n \nUSER_RESOURCES | Resets all per hour user resources. This\nenables clients that have exhausted their resources to\nconnect again. | \n \nUSER_STATISTICS | Reset user statistics (see SHOW\nUSER_STATISTICS). | \n \nYou can also use the mysqladmin client to flush things. Use\nmysqladmin --help to examine what flush commands it\nsupports.\n \nFLUSH STATUS\n \nServer status variables can be reset by executing the\nfollowing:\n \nFLUSH STATUS;\n \nGlobal Status Variables that Support FLUSH STATUS\n \nNot all global status variables support being reset by FLUSH\nSTATUS. Currently, the following status variables are reset\nby FLUSH STATUS:\nAborted_clients\nAborted_connects\nAria_pagecache_blocks_not_flushed\nAria_pagecache_blocks_unused\nAria_pagecache_blocks_used\nBinlog_cache_disk_use\nBinlog_cache_use\nBinlog_stmt_cache_disk_use\nBinlog_stmt_cache_use\nConnection_errors_accept\nConnection_errors_internal\nConnection_errors_max_connections\nConnection_errors_peer_address\nConnection_errors_select\nConnection_errors_tcpwrap\nCreated_tmp_files\nDelayed_errors\nDelayed_writes\nFeature_check_constraint\nFeature_delay_key_write\nMax_used_connections\nOpened_plugin_libraries\nPerformance_schema_accounts_lost\nPerformance_schema_cond_instances_lost\nPerformance_schema_digest_lost\nPerformance_schema_file_handles_lost\nPerformance_schema_file_instances_lost\nPerformance_schema_hosts_lost\nPerformance_schema_locker_lost\nPerformance_schema_mutex_instances_lost\nPerformance_schema_rwlock_instances_lost\nPerformance_schema_session_connect_attrs_lost\nPerformance_schema_socket_instances_lost\nPerformance_schema_stage_classes_lost\nPerformance_schema_statement_classes_lost\nPerformance_schema_table_handles_lost\nPerformance_schema_table_instances_lost\nPerformance_schema_thread_instances_lost\nPerformance_schema_users_lost\nQcache_hits\nQcache_inserts\nQcache_lowmem_prunes\nQcache_not_cached\nRpl_semi_sync_master_no_times\nRpl_semi_sync_master_no_tx\nRpl_semi_sync_master_timefunc_failures\nRpl_semi_sync_master_wait_pos_backtraverse\nRpl_semi_sync_master_yes_tx\nRpl_transactions_multi_engine\nServer_audit_writes_failed\nSlave_retried_transactions\nSlow_launch_threads\nSsl_accept_renegotiates\nSsl_accepts\nSsl_callback_cache_hits\nSsl_client_connects\nSsl_connect_renegotiates\nSsl_ctx_verify_depth\nSsl_ctx_verify_mode\nSsl_finished_accepts\nSsl_finished_connects\nSsl_session_cache_hits\nSsl_session_cache_misses\nSsl_session_cache_overflows\nSsl_session_cache_size\nSsl_session_cache_timeouts\nSsl_sessions_reused\nSsl_used_session_cache_entries\nSubquery_cache_hit\nSubquery_cache_miss\nTable_locks_immediate\nTable_locks_waited\nTc_log_max_pages_used\nTc_log_page_waits\nTransactions_gtid_foreign_engine\nTransactions_multi_engine\n \nFLUSH SSL\n \nThe FLUSH SSL command was first added in MariaDB 10.4.\n \nIn MariaDB 10.4 and later, the FLUSH SSL command can be used\nto dynamically reinitialize the server\'s TLS context. This\nis most useful if you need to replace a certificate that is\nabout to expire without restarting the server.\n \nThis operation is performed by reloading the files defined\nby the following TLS system variables:\nssl_cert\nssl_key\nssl_ca\nssl_capath\nssl_crl\nssl_crlpath\n \nThese TLS system variables are not dynamic, so their values\ncan not be changed without restarting the server.\n \nIf you want to dynamically reinitialize the server\'s TLS\ncontext, then you need to change the certificate and key\nfiles at the relevant paths defined by these TLS system\nvariables, without actually changing the values of the\nvariables. See MDEV-19341 for more information.\n \nReducing Memory Usage\n \nTo flush some of the global caches that take up memory, you\ncould execute the following command:\n \nFLUSH LOCAL HOSTS,\n QUERY CACHE, \n TABLE_STATISTICS, \n INDEX_STATISTICS, \n USER_STATISTICS;\n \n\n \n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/flush/','','https://mariadb.com/kb/en/flush/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (343,26,'FLUSH QUERY CACHE','Description\n----------- \nYou can defragment the query cache to better utilize its\nmemory with\nthe FLUSH QUERY CACHE statement. The statement does not\nremove any queries from the cache.\n \nThe RESET QUERY CACHE statement removes all query results\nfrom the query cache.\nThe FLUSH TABLES statement also does this.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/flush-query-cache/','','https://mariadb.com/kb/en/flush-query-cache/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (344,26,'FLUSH TABLES FOR EXPORT','FLUSH TABLES ... FOR EXPORT was introduced in MariaDB\n10.0.8.\n \nSyntax\n------ \nFLUSH TABLES table_name [, table_name] FOR EXPORT\n \nDescription\n----------- \nFLUSH TABLES ... FOR EXPORT flushes changes to the specified\ntables to disk so that binary copies can be made while the\nserver is still running. This works for Archive, Aria, CSV,\nInnoDB, MyISAM, MERGE, and XtraDB tables.\n \nThe table is read locked until one has issued UNLOCK TABLES.\n \nIf a storage engine does not support FLUSH TABLES FOR\nEXPORT, a 1031 error (SQLSTATE \'HY000\') is produced.\n \nIf FLUSH TABLES ... FOR EXPORT is in effect in the session,\nthe following statements will produce an error if attempted:\nFLUSH TABLES WITH READ LOCK\nFLUSH TABLES ... WITH READ LOCK\nFLUSH TABLES ... FOR EXPORT\nAny statement trying to update any table\n \nIf any of the following statements is in effect in the\nsession, attempting FLUSH TABLES ... FOR EXPORT will\nproduce an error.\nFLUSH TABLES ... WITH READ LOCK\nFLUSH TABLES ... FOR EXPORT\nLOCK TABLES ... READ\nLOCK TABLES ... WRITE\n \nFLUSH FOR EXPORT is not written to the binary log.\n \nThis statement requires the RELOAD and the LOCK TABLES\nprivileges.\n \nIf one of the specified tables cannot be locked, none of the\ntables will be locked.\n \nIf a table does not exist, an error like the following will\nbe produced:\n \nERROR 1146 (42S02): Table \'test.xxx\' doesn\'t exist\n \nIf a table is a view, an error like the following will be\nproduced:\n \nERROR 1347 (HY000): \'test.v\' is not BASE TABLE\n \nExample\n \nFLUSH TABLES test.t1 FOR EXPORT;\n# Copy files related to the table (see below)\nUNLOCK TABLES;\n \nFor a full description, please see copying MariaDB tables.\n \n\n\nURL: https://mariadb.com/kb/en/flush-tables-for-export/','','https://mariadb.com/kb/en/flush-tables-for-export/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (345,26,'HELP Command','Syntax\n------ \nHELP search_string\n \nDescription\n----------- \nThe HELP command can be used in any MariaDB client, such as\nthe mysql command-line client, to get basic syntax help and\na short description for most commands and functions. \n \nIf you provide an argument to the HELP command, the mysql\nclient uses it as a search string to access server-side\nhelp. The proper operation of this command requires that the\nhelp tables in the mysql database be initialized with help\ntopic information.\n \nIf there is no match for the search string, the search\nfails. Use help contents to see a list of the help\ncategories:\n \nHELP contents\nYou asked for help about help category: \"Contents\"\nFor more information, type \'help \', where is one of the\nfollowing\ncategories:\n Account Management\n Administration\n Compound Statements\n Data Definition\n Data Manipulation\n Data Types\n Functions\n Functions and Modifiers for Use with GROUP BY\n Geographic Features\n Help Metadata\n Language Structure\n Plugins\n Procedures\n Sequences\n Table Maintenance\n Transactions\n User-Defined Functions\n Utility\n \nIf a search string matches multiple items, MariaDB shows a\nlist of matching topics:\n \nHELP drop\nMany help items for your request exist.\nTo make a more specific request, please type \'help \',\nwhere is one of the following\ntopics:\n ALTER TABLE\n DROP DATABASE\n DROP EVENT\n DROP FUNCTION\n DROP FUNCTION UDF\n DROP INDEX\n DROP PACKAGE\n DROP PACKAGE BODY\n DROP PROCEDURE\n DROP ROLE\n DROP SEQUENCE\n DROP SERVER\n DROP TABLE\n DROP TRIGGER\n DROP USER\n DROP VIEW\n \nThen you can enter a topic as the search string to see the\nhelp entry for that topic.\n \nThe help is provided with the MariaDB server and makes use\nof four help tables found in the mysql database:\nhelp_relation, help_topic, help_category and help_keyword.\nThese tables are populated by the mysql_install_db or\nfill_help_table.sql scripts which, until MariaDB 10.4.7,\ncontain data generated from an old version of MySQL.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/help-command/','','https://mariadb.com/kb/en/help-command/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (346,26,'KILL [CONNECTION | QUERY]','Syntax\n------ \nKILL [HARD | SOFT] [CONNECTION | QUERY [ID] ] [thread_id |\nUSER user_name | query_id]\n \nMariaDB 5.3.2\n \nThe options HARD | SOFT and USER username were introduced in\nMariaDB 5.3.2\n \nMariaDB 10.0.5\n \nKILL QUERY ID query_id, which permits killing a query by\nquery id rather than thread id, was introduced in MariaDB\n10.0.5.\n \nDescription\n----------- \nEach connection to mysqld runs in a separate thread. You can\nsee which threads\nare running with the SHOW PROCESSLIST statement and kill a\nthread with the KILL thread_id statement. \nKILL allows the optional CONNECTION or\nQUERY modifier:\nKILL CONNECTION is the same as KILL with no\n modifier: It terminates the connection associated with the\ngiven thread or query id.\nKILL QUERY terminates the statement that the connection\nthread_id is\n currently executing, but leaves the connection itself\nintact.\nKILL QUERY ID (introduced in MariaDB 10.0.5) terminates the\nquery by query_id, leaving the connection intact.\n \nIf a connection is terminated that has an active\ntransaction, the transaction will be rolled back. If only a\nquery is killed, the current transaction will stay active.\nSee also idle_transaction_timeout.\n \nIf you have the PROCESS privilege, you can see all threads.\nIf\nyou have the SUPER privilege, you can kill all threads and\nstatements. Otherwise, you can see and kill only your own\nthreads and\nstatements.\n \nKilling queries that repair or create indexes on MyISAM and\nAria tables may result in corrupted tables. Use the SOFT\noption to avoid this!\n \nThe HARD option (default) kills a command as soon as\npossible. If you use\nSOFT, then critical operations that may leave a table in an\ninconsistent state will not be interrupted. Such operations\ninclude REPAIR and INDEX creation for MyISAM and Aria tables\n(REPAIR TABLE, OPTIMIZE TABLE).\n \nKILL ... USER username will kill all connections/queries for\na\ngiven user. USER can be specified one of the following ways:\nusername (Kill without regard to hostname)\nusername@hostname\nCURRENT_USER or CURRENT_USER()\n \nIf you specify a thread id and that thread does not exist,\nyou get the following error:\n \nERROR 1094 (HY000): Unknown thread id: \n \nIf you specify a query id that doesn\'t exist, you get the\nfollowing error:\n \nERROR 1957 (HY000): Unknown query id: \n \nHowever, if you specify a user name, no error is issued for\nnon-connected (or even non-existing) users. To check if the\nconnection/query has been killed, you can use the\nROW_COUNT() function.\n \nA client whose connection is killed receives the following\nerror:\n \nERROR 1317 (70100): Query execution was interrupted\n \nTo obtain a list of existing sessions, use the SHOW\nPROCESSLIST statement or query the Information Schema\nPROCESSLIST table.\n \nNote: You cannot use KILL with the Embedded MySQL Server\nlibrary because the embedded server merely runs inside the\nthreads of the host\napplication. It does not create any connection threads of\nits own.\n \nNote: You can also use \nmysqladmin kill thread_id [,thread_id...]\nto kill connections. To get a list of running queries,\nuse mysqladmin processlist. See mysqladmin.\n \nPercona Toolkit contains a program, pt-kill that can be used\nto automatically kill connections that match certain\ncriteria. For example, it can be used to terminate idle\nconnections, or connections that have been busy for more\nthan 60 seconds.\n \n\n\nURL:\nhttps://mariadb.com/kb/en/data-manipulation-kill-connection-query/','','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 (347,26,'LOAD INDEX','Syntax\n------ \nLOAD INDEX INTO CACHE\n tbl_index_list [, tbl_index_list] ...\n \ntbl_index_list:\n tbl_name\n [[INDEX|KEY] (index_name[, index_name] ...)]\n [IGNORE LEAVES]\n \nDescription\n----------- \nThe LOAD INDEX INTO CACHE statement preloads a table index\ninto the key\ncache to which it has been assigned by an explicit CACHE\nINDEX\nstatement, or into the default key cache otherwise. \nLOAD INDEX INTO CACHE is used only for MyISAM or Aria\ntables. Until MariaDB 5.3, it was not supported for tables\nhaving user-defined partitioning, but this limitation was\nremoved in MariaDB 5.5.\n \nThe IGNORE LEAVES modifier causes only blocks for the\nnonleaf nodes of\nthe index to be preloaded.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/load-index/','','https://mariadb.com/kb/en/load-index/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (348,26,'RESET','Syntax\n------ \nRESET reset_option [, reset_option] ...\n \nDescription\n----------- \nThe RESET statement is used to clear the state of various\nserver\noperations. You must have the RELOAD privilege to execute\nRESET.\n \nRESET acts as a stronger version of the FLUSH statement.\n \nThe different RESET options are:\n \nOption | Description | \n \nSLAVE [\"connection_name\"] [ALL] | Deletes all relay logs\nfrom the slave and reset the replication position in the\nmaster binary log. | \n \nMASTER | Deletes all old binary logs, makes the binary index\nfile (--log-bin-index) empty and creates a new binary log\nfile. This is useful when you want to reset the master to an\ninitial state. If you want to just delete old, not used\nbinary logs, you should use the PURGE BINARY LOGS command. |\n\n \nQUERY CACHE | Removes all queries from the query cache. See\nalso FLUSH QUERY CACHE. | \n \n\n \n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/reset/','','https://mariadb.com/kb/en/reset/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (349,26,'SET','Syntax\n------ \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 \nOne can also set a user variable in any expression with this\nsyntax:\n \nuser_var_name:= expr\n \nDescription\n----------- \nThe SET statement assigns values to different types of\nvariables that affect the operation of the server or your\nclient. Older\nversions of MySQL employed SET OPTION, but this syntax was\ndeprecated in favor of SET without OPTION, and was removed\nin MariaDB 10.0.\n \nChanging a system variable by using the SET statement does\nnot make the change permanently. To do so, the change must\nbe made in a configuration file.\n \nFor setting variables on a per-query basis (from MariaDB\n10.1.2), see SET STATEMENT.\n \nSee SHOW VARIABLES for documentation on viewing server\nsystem variables.\n \nSee Server System Variables for a list of all the system\nvariables.\n \nGLOBAL / SESSION\n \nWhen setting a system variable, the scope can be specified\nas either GLOBAL or SESSION.\n \nA global variable change affects all new sessions. It does\nnot affect any currently open sessions, including the one\nthat made the change. \n \nA session variable change affects the current session only.\n \nIf the variable has a session value, not specifying either\nGLOBAL or SESSION will be the same as specifying SESSION. If\nthe variable only has a global value, not specifying GLOBAL\nor SESSION will apply to the change to the global value.\n \nDEFAULT\n \nSetting a global variable to DEFAULT will restore it to the\nserver default, and setting a session variable to DEFAULT\nwill restore it to the current global value.\n \nExamples\n-------- \ninnodb_sync_spin_loops is a global variable.\nskip_parallel_replication is a session variable.\nmax_error_count is both global and session.\n \nSELECT VARIABLE_NAME, SESSION_VALUE, GLOBAL_VALUE FROM\n INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE \n VARIABLE_NAME LIKE \'max_error_count\' OR \n VARIABLE_NAME LIKE \'skip_parallel_replication\' OR \n VARIABLE_NAME LIKE \'innodb_sync_spin_loops\';\n \n+---------------------------+---------------+--------------+\n| VARIABLE_NAME | SESSION_VALUE | GLOBAL_VALUE |\n+---------------------------+---------------+--------------+\n| MAX_ERROR_COUNT | 64 | 64 |\n| SKIP_PARALLEL_REPLICATION | OFF | NULL |\n| INNODB_SYNC_SPIN_LOOPS | NULL | 30 |\n+---------------------------+---------------+--------------+\n \nSetting the session values:\n \nSET max_error_count=128;\nQuery OK, 0 rows affected (0.000 sec)\n \nSET skip_parallel_replication=ON;\nQuery OK, 0 rows affected (0.000 sec)\n \nSET innodb_sync_spin_loops=60;\n \nERROR 1229 (HY000): Variable \'innodb_sync_spin_loops\' is a\nGLOBAL variable \n and should be set with SET GLOBAL\n \nSELECT VARIABLE_NAME, SESSION_VALUE, GLOBAL_VALUE FROM\n INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE \n VARIABLE_NAME LIKE \'max_error_count\' OR \n VARIABLE_NAME LIKE \'skip_parallel_replication\' OR \n VARIABLE_NAME LIKE \'innodb_sync_spin_loops\';\n \n+---------------------------+---------------+--------------+\n| VARIABLE_NAME | SESSION_VALUE | GLOBAL_VALUE |\n+---------------------------+---------------+--------------+\n| MAX_ERROR_COUNT | 128 | 64 |\n| SKIP_PARALLEL_REPLICATION | ON | NULL |\n| INNODB_SYNC_SPIN_LOOPS | NULL | 30 |\n+---------------------------+---------------+--------------+\n \nSetting the global values:\n \nSET GLOBAL max_error_count=256;\n \nSET GLOBAL skip_parallel_replication=ON;\n \nERROR 1228 (HY000): Variable \'skip_parallel_replication\'\nis a SESSION variable \n and can\'t be used with SET GLOBAL\n \nSET GLOBAL innodb_sync_spin_loops=120;\n \nSELECT VARIABLE_NAME, SESSION_VALUE, GLOBAL_VALUE FROM\n INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE \n VARIABLE_NAME LIKE \'max_error_count\' OR \n VARIABLE_NAME LIKE \'skip_parallel_replication\' OR \n VARIABLE_NAME LIKE \'innodb_sync_spin_loops\';\n \n+---------------------------+---------------+--------------+\n| VARIABLE_NAME | SESSION_VALUE | GLOBAL_VALUE |\n+---------------------------+---------------+--------------+\n| MAX_ERROR_COUNT | 128 | 256 |\n| SKIP_PARALLEL_REPLICATION | ON | NULL |\n| INNODB_SYNC_SPIN_LOOPS | NULL | 120 |\n+---------------------------+---------------+--------------+\n \nSHOW VARIABLES will by default return the session value\nunless the variable is global only.\n \nSHOW VARIABLES LIKE \'max_error_count\';\n \n+-----------------+-------+\n| Variable_name | Value |\n+-----------------+-------+\n| max_error_count | 128 |\n+-----------------+-------+\n \nSHOW VARIABLES LIKE \'skip_parallel_replication\';\n \n+---------------------------+-------+\n| Variable_name | Value |\n+---------------------------+-------+\n| skip_parallel_replication | ON |\n+---------------------------+-------+\n \nSHOW VARIABLES LIKE \'innodb_sync_spin_loops\';\n \n+------------------------+-------+\n| Variable_name | Value |\n+------------------------+-------+\n| innodb_sync_spin_loops | 120 |\n+------------------------+-------+\n \nUsing the inplace syntax:\n \nSELECT (@a:=1);\n+---------+\n| (@a:=1) |\n+---------+\n| 1 |\n+---------+\n \nSELECT @a;\n \n+------+\n| @a |\n+------+\n| 1 |\n+------+\n \n\n\nURL: https://mariadb.com/kb/en/set/','','https://mariadb.com/kb/en/set/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (350,26,'About SHOW','SHOW has many forms that provide information about\ndatabases, tables, columns, or status information about the\nserver. These include:\nSHOW AUTHORS\nSHOW CHARACTER SET [like_or_where]\nSHOW COLLATION [like_or_where]\nSHOW [FULL] COLUMNS FROM tbl_name [FROM db_name]\n[like_or_where]\nSHOW CONTRIBUTORS\nSHOW CREATE DATABASE db_name\nSHOW CREATE EVENT event_name\nSHOW CREATE PACKAGE package_name\nSHOW CREATE PACKAGE BODY package_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 [FULL] EVENTS\nSHOW FUNCTION CODE func_name\nSHOW FUNCTION STATUS [like_or_where]\nSHOW GRANTS FOR user\nSHOW INDEX FROM tbl_name [FROM db_name]\nSHOW INNODB STATUS\nSHOW OPEN TABLES [FROM db_name] [like_or_where]\nSHOW PLUGINS\nSHOW PROCEDURE CODE proc_name\nSHOW PROCEDURE STATUS [like_or_where]\nSHOW PRIVILEGES\nSHOW [FULL] PROCESSLIST\nSHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]\nSHOW PROFILES\nSHOW [GLOBAL | SESSION] STATUS [like_or_where]\nSHOW TABLE STATUS [FROM db_name] [like_or_where]\nSHOW 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\nLIKE \'pattern\' part, \'pattern\' is a\nstring that can contain the SQL \"%\" and\n\"_\" wildcard characters. The pattern is useful for\nrestricting statement output to matching values.\n \nSeveral SHOW statements also accept a\nWHERE clause that provides more flexibility in specifying\nwhich rows to display. See Extended Show.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/about-show/','','https://mariadb.com/kb/en/about-show/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (351,26,'SHOW AUTHORS','Syntax\n------ \nSHOW AUTHORS\n \nDescription\n----------- \nThe SHOW AUTHORS statement displays information about the\npeople who work on MariaDB. For each author, it displays\nName, Location, and\nComment values. All columns are encoded as latin1.\n \nIn MariaDB 5.5 this is in somewhat random order.\n \nIn MariaDB 10.0.5 and later you have:\nFirst the active people in MariaDB are listed.\nThen the active people in MySQL.\nLast the people that has contributed to MariaDB/MySQL in the\npast.\n \nThe order is somewhat related to importance of the\ncontribution given to the MariaDB project, but this is not\n100% accurate. There is still room for improvements and\ndebate...\n \nExample\n \nSHOW AUTHORS;\n+--------------------------------+---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+\n| Name | Location | Comment |\n+--------------------------------+---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+\n| Michael (Monty) Widenius | Tusby, Finland | Lead developer\nand main author |\n| Sergei Golubchik | Kerpen, Germany | Architect, Full-text\nsearch, precision math, plugin framework, merges etc |\n| Igor Babaev | Bellevue, USA | Optimizer, keycache, core\nwork |\n| Sergey Petrunia | St. Petersburg, Russia | Optimizer |\n| Oleksandr Byelkin | Lugansk, Ukraine | Query Cache (4.0),\nSubqueries (4.1), Views (5.0) |\n| Timour Katchaounov | Sofia , Bulgaria | Optimizer |\n| Kristian Nielsen | Copenhagen, Denmark | Replication,\nAsync client prototocol, General buildbot stuff |\n| Alexander (Bar) Barkov | Izhevsk, Russia | Unicode and\ncharacter sets |\n| Alexey Botchkov (Holyfoot) | Izhevsk, Russia | GIS\nextensions, embedded server, precision math |\n| Daniel Bartholomew | Raleigh, USA | MariaDB documentation\n|\n| Colin Charles | Selangor, Malesia | MariaDB documentation,\ntalks at a LOT of conferences |\n| Sergey Vojtovich | Izhevsk, Russia | initial\nimplementation of plugin architecture, maintained native\nstorage engines (MyISAM, MEMORY, ARCHIVE, etc), rewrite of\ntable cache |\n| Vladislav Vaintroub | Mannheim, Germany | MariaDB Java\nconnector, new thread pool, Windows optimizations |\n| Elena Stepanova | Sankt Petersburg, Russia | QA, test\ncases |\n| Georg Richter | Heidelberg, Germany | New LGPL C\nconnector, PHP connector |\n| Jan Lindström | Ylämylly, Finland | Working on InnoDB |\n| Lixun Peng | Hangzhou, China | Multi Source replication |\n| Percona | CA, USA | XtraDB, microslow patches, extensions\nto slow log \n...\n \nSee Also\n \nSHOW CONTRIBUTORS. This list all members and sponsors of the\nMariaDB Foundation and other sponsors.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/show-authors/','','https://mariadb.com/kb/en/show-authors/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (352,26,'SHOW BINARY LOGS','Syntax\n------ \nSHOW BINARY LOGS\nSHOW MASTER LOGS\n \nDescription\n----------- \nLists the binary log files on the server. This statement is\nused as part of the\nprocedure described in \nPURGE BINARY LOGS, that shows how to\ndetermine which logs can be purged.\n \nExamples\n-------- \nSHOW BINARY LOGS;\n+--------------------+-----------+\n| Log_name | File_size |\n+--------------------+-----------+\n| mariadb-bin.000001 | 19039 |\n| mariadb-bin.000002 | 717389 |\n| mariadb-bin.000003 | 300 |\n| mariadb-bin.000004 | 333 |\n| mariadb-bin.000005 | 899 |\n| mariadb-bin.000006 | 125 |\n| mariadb-bin.000007 | 18907 |\n| mariadb-bin.000008 | 19530 |\n| mariadb-bin.000009 | 151 |\n| mariadb-bin.000010 | 151 |\n| mariadb-bin.000011 | 125 |\n| mariadb-bin.000012 | 151 |\n| mariadb-bin.000013 | 151 |\n| mariadb-bin.000014 | 125 |\n| mariadb-bin.000015 | 151 |\n| mariadb-bin.000016 | 314 |\n+--------------------+-----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/show-binary-logs/','','https://mariadb.com/kb/en/show-binary-logs/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (353,26,'SHOW BINLOG EVENTS','Syntax\n------ \nSHOW BINLOG EVENTS\n [IN \'log_name\'] [FROM pos] [LIMIT [offset,] row_count]\n \nDescription\n----------- \nShows the events in the binary log. If you do not specify\n\'log_name\',\nthe first binary log is displayed.\n \nExample\n \nSHOW BINLOG EVENTS IN \'mysql_sandbox10019-bin.000002\';\n+-------------------------------+-----+-------------------+-----------+-------------+------------------------------------------------+\n| Log_name | Pos | Event_type | Server_id | End_log_pos |\nInfo |\n+-------------------------------+-----+-------------------+-----------+-------------+------------------------------------------------+\n| mysql_sandbox10019-bin.000002 | 4 | Format_desc | 1 | 248\n| Server ver: 10.0.19-MariaDB-log, Binlog ver: 4 |\n| mysql_sandbox10019-bin.000002 | 248 | Gtid_list | 1 | 273\n| [] |\n| mysql_sandbox10019-bin.000002 | 273 | Binlog_checkpoint |\n1 | 325 | mysql_sandbox10019-bin.000002 |\n| mysql_sandbox10019-bin.000002 | 325 | Gtid | 1 | 363 |\nGTID 0-1-1 |\n| mysql_sandbox10019-bin.000002 | 363 | Query | 1 | 446 |\nCREATE DATABASE blog |\n| mysql_sandbox10019-bin.000002 | 446 | Gtid | 1 | 484 |\nGTID 0-1-2 |\n| mysql_sandbox10019-bin.000002 | 484 | Query | 1 | 571 |\nuse `blog`; CREATE TABLE bb (id INT) |\n+-------------------------------+-----+-------------------+-----------+-------------+------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/show-binlog-events/','','https://mariadb.com/kb/en/show-binlog-events/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (354,26,'SHOW CHARACTER SET','Syntax\n------ \nSHOW CHARACTER SET\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \nThe SHOW CHARACTER SET statement shows all available\ncharacter sets. The LIKE clause, if present on its own,\nindicates which character\nset names to match. The WHERE and LIKE clauses can be given\nto select rows using more general conditions, as discussed\nin Extended SHOW.\n \nThe same information can be queried from the\ninformation_schema.CHARACTER_SETS table.\n \nSee Setting Character Sets and Collations for details on\nspecifying the character set at the server, database, table\nand column levels.\n \nExamples\n-------- \nSHOW 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 |\n1 |\n| latin5 | ISO 8859-9 Turkish | latin5_turkish_ci | 1 |\n| latin7 | ISO 8859-13 Baltic | latin7_general_ci | 1 |\n+---------+-----------------------------+-------------------+--------+\n \nSHOW CHARACTER SET WHERE Maxlen LIKE \'2\';\n+---------+---------------------------+-------------------+--------+\n| Charset | Description | Default collation | Maxlen |\n+---------+---------------------------+-------------------+--------+\n| big5 | Big5 Traditional Chinese | big5_chinese_ci | 2 |\n| sjis | Shift-JIS Japanese | sjis_japanese_ci | 2 |\n| euckr | EUC-KR Korean | euckr_korean_ci | 2 |\n| gb2312 | GB2312 Simplified Chinese | gb2312_chinese_ci | 2\n|\n| gbk | GBK Simplified Chinese | gbk_chinese_ci | 2 |\n| ucs2 | UCS-2 Unicode | ucs2_general_ci | 2 |\n| cp932 | SJIS for Windows Japanese | cp932_japanese_ci | 2\n|\n+---------+---------------------------+-------------------+--------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/show-character-set/','','https://mariadb.com/kb/en/show-character-set/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (355,26,'SHOW CLIENT_STATISTICS','MariaDB 5.2 introduced the User Statistics feature.\n \nSyntax\n------ \nSHOW CLIENT_STATISTICS\n \nDescription\n----------- \nThe SHOW CLIENT_STATISTICS statement was introduced in\nMariaDB 5.2 as part of the User Statistics feature. It was\nremoved as a separate statement in MariaDB 10.1.1, but\neffectively replaced by the generic SHOW\ninformation_schema_table statement. The\ninformation_schema.CLIENT_STATISTICS table holds statistics\nabout client connections.\n \nThe userstat system variable must be set to 1 to activate\nthis feature. See the User Statistics and\ninformation_schema.CLIENT_STATISTICS articles for more\ninformation.\n \nExample\n \nFrom MariaDB 10.0:\n \nSHOW CLIENT_STATISTICS\\G\n*************************** 1. row\n***************************\n Client: localhost\n Total_connections: 35\nConcurrent_connections: 0\n Connected_time: 708\n Busy_time: 2.5557979999999985\n Cpu_time: 0.04123740000000002\n Bytes_received: 3883\n Bytes_sent: 21595\n Binlog_bytes_written: 0\n Rows_read: 18\n Rows_sent: 115\n Rows_deleted: 0\n Rows_inserted: 0\n Rows_updated: 0\n Select_commands: 70\n Update_commands: 0\n Other_commands: 0\n Commit_transactions: 1\n Rollback_transactions: 0\n Denied_connections: 0\n Lost_connections: 0\n Access_denied: 0\n Empty_queries: 35\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/show-client-statistics/','','https://mariadb.com/kb/en/show-client-statistics/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (356,26,'SHOW COLLATION','Syntax\n------ \nSHOW COLLATION\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \nThe output from SHOW COLLATION includes all available\ncollations. The LIKE clause, if present on its own,\nindicates which collation names to match. The WHERE and LIKE\nclauses can be given to select rows using more general\nconditions, as discussed in Extended SHOW.\n \nThe same information can be queried from the\ninformation_schema.COLLATIONS table.\n \nSee Setting Character Sets and Collations for details on\nspecifying the collation at the server, database, table and\ncolumn levels.\n \nExamples\n-------- \nSHOW COLLATION LIKE \'latin1%\';\n+-------------------+---------+----+---------+----------+---------+\n| Collation | Charset | Id | Default | Compiled | Sortlen |\n+-------------------+---------+----+---------+----------+---------+\n| latin1_german1_ci | latin1 | 5 | | Yes | 1 |\n| latin1_swedish_ci | latin1 | 8 | Yes | Yes | 1 |\n| latin1_danish_ci | latin1 | 15 | | Yes | 1 |\n| latin1_german2_ci | latin1 | 31 | | Yes | 2 |\n| latin1_bin | latin1 | 47 | | Yes | 1 |\n| latin1_general_ci | latin1 | 48 | | Yes | 1 |\n| latin1_general_cs | latin1 | 49 | | Yes | 1 |\n| latin1_spanish_ci | latin1 | 94 | | Yes | 1 |\n+-------------------+---------+----+---------+----------+---------+\n \nSHOW COLLATION WHERE Sortlen LIKE \'8\' AND Charset LIKE\n\'utf8\';\n+--------------------+---------+-----+---------+----------+---------+\n| Collation | Charset | Id | Default | Compiled | Sortlen |\n+--------------------+---------+-----+---------+----------+---------+\n| utf8_unicode_ci | utf8 | 192 | | Yes | 8 |\n| utf8_icelandic_ci | utf8 | 193 | | Yes | 8 |\n| utf8_latvian_ci | utf8 | 194 | | Yes | 8 |\n| utf8_romanian_ci | utf8 | 195 | | Yes | 8 |\n| utf8_slovenian_ci | utf8 | 196 | | Yes | 8 |\n| utf8_polish_ci | utf8 | 197 | | Yes | 8 |\n| utf8_estonian_ci | utf8 | 198 | | Yes | 8 |\n| utf8_spanish_ci | utf8 | 199 | | Yes | 8 |\n| utf8_swedish_ci | utf8 | 200 | | Yes | 8 |\n| utf8_turkish_ci | utf8 | 201 | | Yes | 8 |\n| utf8_czech_ci | utf8 | 202 | | Yes | 8 |\n| utf8_danish_ci | utf8 | 203 | | Yes | 8 |\n| utf8_lithuanian_ci | utf8 | 204 | | Yes | 8 |\n| utf8_slovak_ci | utf8 | 205 | | Yes | 8 |\n| utf8_spanish2_ci | utf8 | 206 | | Yes | 8 |\n| utf8_roman_ci | utf8 | 207 | | Yes | 8 |\n| utf8_persian_ci | utf8 | 208 | | Yes | 8 |\n| utf8_esperanto_ci | utf8 | 209 | | Yes | 8 |\n| utf8_hungarian_ci | utf8 | 210 | | Yes | 8 |\n| utf8_sinhala_ci | utf8 | 211 | | Yes | 8 |\n| utf8_croatian_ci | utf8 | 213 | | Yes | 8 |\n+--------------------+---------+-----+---------+----------+---------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/show-collation/','','https://mariadb.com/kb/en/show-collation/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (357,26,'SHOW COLUMNS','Syntax\n------ \nSHOW [FULL] {COLUMNS | FIELDS} FROM tbl_name [FROM db_name]\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \nSHOW COLUMNS displays information about the columns in a\ngiven table. It also works for views. The LIKE clause, if\npresent on its own, indicates which column names to match.\nThe WHERE and LIKE clauses can be given to select rows using\nmore general conditions, as discussed in Extended SHOW.\n \nIf the data types differ from what you expect them to be\nbased on a\nCREATE TABLE statement, note that MariaDB sometimes changes\ndata types when you create or alter a table. The conditions\nunder which this\noccurs are described in the Silent Column Changes article.\n \nThe FULL keyword causes the output to include the column\ncollation and comments, as well as the privileges you have\nfor each column.\n \nYou can use db_name.tbl_name as an alternative to the\ntbl_name FROM db_name syntax. In other words, these two\nstatements are equivalent:\n \nSHOW COLUMNS FROM mytable FROM mydb;\nSHOW COLUMNS FROM mydb.mytable;\n \nSHOW COLUMNS displays the following values for each table\ncolumn:\n \nField indicates the column name.\n \nType indicates the column data type.\n \nCollation indicates the collation for non-binary string\ncolumns, or\nNULL for other columns. This value is displayed only if you\nuse the\nFULL keyword.\n \nThe Null field contains YES if NULL values can be stored in\nthe column,\nNO if not.\n \nThe Key field indicates whether the column is indexed:\nIf Key is empty, the column either is not indexed or is\nindexed only as a\n secondary column in a multiple-column, non-unique index.\nIf Key is PRI, the column is a PRIMARY KEY or\n is one of the columns in a multiple-column PRIMARY KEY.\nIf Key is UNI, the column is the first column of a\nunique-valued\n index that cannot contain NULL values.\nIf Key is MUL, multiple occurrences of a given value are\nallowed\n within the column. The column is the first column of a\nnon-unique index or a\n unique-valued index that can contain NULL values.\n \nIf more than one of the Key values applies to a given column\nof a\ntable, Key displays the one with the highest priority, in\nthe order\nPRI, UNI, MUL.\n \nA UNIQUE index may be displayed as PRI if\nit cannot contain NULL values and there is no\nPRIMARY KEY in the table. A UNIQUE index\nmay display as MUL if several columns form a composite\nUNIQUE index; although the combination of the columns is\nunique, each column can still hold multiple occurrences of a\ngiven value.\n \nThe Default field indicates the default value that is\nassigned to the\ncolumn.\n \nThe Extra field contains any additional information that is\navailable about a given column.\n \nValue | Description | \n \nAUTO_INCREMENT | The column was created with the\nAUTO_INCREMENT keyword. | \n \nPERSISTENT | The column was created with the PERSISTENT\nkeyword. (New in 5.3) | \n \nVIRTUAL | The column was created with the VIRTUAL keyword.\n(New in 5.3) | \n \non update CURRENT_TIMESTAMP | The column is a TIMESTAMP\ncolumn that is automatically updated on INSERT and UPDATE. |\n\n \nPrivileges indicates the privileges you have for the column.\nThis\nvalue is displayed only if you use the FULL keyword.\n \nComment indicates any comment the column has. This value is\ndisplayed\nonly if you use the FULL keyword.\n \nSHOW FIELDS is a synonym for\nSHOW COLUMNS. Also DESCRIBE and EXPLAIN can be used as\nshortcuts.\n \nYou can also list a table\'s columns with: \n \nmysqlshow db_name tbl_name\n \nSee the mysqlshow command for more details.\n \nThe DESCRIBE statement provides information similar to SHOW\nCOLUMNS. The information_schema.COLUMNS table provides\nsimilar, but more complete, information.\n \nThe SHOW CREATE TABLE, SHOW TABLE STATUS, and SHOW INDEX\nstatements also provide information about tables.\n \nExamples\n-------- \nSHOW 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+------------+----------+------+-----+---------+----------------+\n \nSHOW COLUMNS FROM employees WHERE Type LIKE \'Varchar%\';\n+---------------+-------------+------+-----+---------+-------+\n| Field | Type | Null | Key | Default | Extra |\n+---------------+-------------+------+-----+---------+-------+\n| first_name | varchar(30) | NO | MUL | NULL | |\n| last_name | varchar(40) | NO | | NULL | |\n| position | varchar(25) | NO | | NULL | |\n| home_address | varchar(50) | NO | | NULL | |\n| home_phone | varchar(12) | NO | | NULL | |\n| employee_code | varchar(25) | NO | UNI | NULL | |\n+---------------+-------------+------+-----+---------+-------+\n \n\n\nURL: https://mariadb.com/kb/en/show-columns/','','https://mariadb.com/kb/en/show-columns/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (358,26,'SHOW CONTRIBUTORS','Syntax\n------ \nSHOW CONTRIBUTORS\n \nDescription\n----------- \nThe SHOW CONTRIBUTORS statement displays information about\nthe companies and people who financially contribute to\nMariaDB. For each contributor, it displays Name, Location,\nand Comment values. All columns are encoded as latin1.\n \nIn MariaDB 5.5 this is in somewhat random order, and the\nfeature was deprecated.\n \nIn MariaDB 10.0.5 it was un-deprecated, and since then\ndisplays all members and sponsors of the MariaDB Foundation\nas well as other financial contributors.\n \nExample\n \nSHOW CONTRIBUTORS;\n+---------------------+-------------------------------+-------------------------------------------------------------+\n| Name | Location | Comment |\n+---------------------+-------------------------------+-------------------------------------------------------------+\n| Booking.com | https://www.booking.com | Founding member,\nPlatinum Sponsor of the MariaDB Foundation |\n| Alibaba Cloud | https://www.alibabacloud.com/ | Platinum\nSponsor of the MariaDB Foundation |\n| Tencent Cloud | https://cloud.tencent.com | Platinum\nSponsor of the MariaDB Foundation |\n| Microsoft | https://microsoft.com/ | Platinum Sponsor of\nthe MariaDB Foundation |\n| MariaDB Corporation | https://mariadb.com | Founding\nmember, Platinum Sponsor of the MariaDB Foundation |\n| Visma | https://visma.com | Gold Sponsor of the MariaDB\nFoundation |\n| DBS | https://dbs.com | Gold Sponsor of the MariaDB\nFoundation |\n| IBM | https://www.ibm.com | Gold Sponsor of the MariaDB\nFoundation |\n| Tencent Games | http://game.qq.com/ | Gold Sponsor of the\nMariaDB Foundation |\n| Nexedi | https://www.nexedi.com | Silver Sponsor of the\nMariaDB Foundation |\n| Acronis | https://www.acronis.com | Silver Sponsor of the\nMariaDB Foundation |\n| Verkkokauppa.com | https://www.verkkokauppa.com | Bronze\nSponsor of the MariaDB Foundation |\n| Virtuozzo | https://virtuozzo.com | Bronze Sponsor of the\nMariaDB Foundation |\n| Tencent Game DBA | http://tencentdba.com/about | Bronze\nSponsor of the MariaDB Foundation |\n| Tencent TDSQL | http://tdsql.org | Bronze Sponsor of the\nMariaDB Foundation |\n| Percona | https://www.percona.com/ | Bronze Sponsor of the\nMariaDB Foundation |\n| Google | USA | Sponsoring encryption, parallel replication\nand GTID |\n| Facebook | USA | Sponsoring non-blocking API, LIMIT ROWS\nEXAMINED etc |\n| Ronald Bradford | Brisbane, Australia | EFF contribution\nfor UC2006 Auction |\n| Sheeri Kritzer | Boston, Mass. USA | EFF contribution for\nUC2006 Auction |\n| Mark Shuttleworth | London, UK. | EFF contribution for\nUC2006 Auction |\n+---------------------+-------------------------------+-------------------------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/show-contributors/','','https://mariadb.com/kb/en/show-contributors/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (359,26,'SHOW CREATE DATABASE','Syntax\n------ \nSHOW CREATE {DATABASE | SCHEMA} db_name\n \nDescription\n----------- \nShows the CREATE DATABASE statement that\ncreates the given database. SHOW CREATE SCHEMA is a synonym\nfor SHOW CREATE DATABASE. SHOW CREATE DATABASE quotes\ndatabase names according to the value of the\nsql_quote_show_create server system variable.\n \nExamples\n-------- \nSHOW CREATE DATABASE test;\n+----------+-----------------------------------------------------------------+\n| Database | Create Database |\n+----------+-----------------------------------------------------------------+\n| test | CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER\nSET latin1 */ |\n+----------+-----------------------------------------------------------------+\n \nSHOW CREATE SCHEMA test;\n+----------+-----------------------------------------------------------------+\n| Database | Create Database |\n+----------+-----------------------------------------------------------------+\n| test | CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER\nSET latin1 */ |\n+----------+-----------------------------------------------------------------+\n \nWith sql_quote_show_create off:\n \nSHOW CREATE DATABASE test;\n+----------+---------------------------------------------------------------+\n| Database | Create Database |\n+----------+---------------------------------------------------------------+\n| test | CREATE DATABASE test /*!40100 DEFAULT CHARACTER SET\nlatin1 */ |\n+----------+---------------------------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/show-create-database/','','https://mariadb.com/kb/en/show-create-database/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (360,26,'SHOW CREATE EVENT','Syntax\n------ \nSHOW CREATE EVENT event_name\n \nDescription\n----------- \nThis statement displays the CREATE EVENT\nstatement needed to re-create a given event, as well as the\nSQL_MODE that was used when the trigger has been created and\nthe character set used by the connection.. To find out which\nevents are present, use SHOW EVENTS.\n \nThe output of this statement is unreliably affected by the\nsql_quote_show_create server system variable - see\nhttp://bugs.mysql.com/bug.php?id=12719\n \nThe information_schema.EVENTS table provides similar, but\nmore complete, information.\n \nExamples\n-------- \nSHOW CREATE EVENT test.e_daily\\G\n*************************** 1. row\n***************************\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 \n\n\nURL: https://mariadb.com/kb/en/show-create-event/','','https://mariadb.com/kb/en/show-create-event/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (361,26,'SHOW CREATE FUNCTION','Syntax\n------ \nSHOW CREATE FUNCTION func_name\n \nDescription\n----------- \nThis statement is similar to \nSHOW CREATE PROCEDURE but for\nstored functions.\n \nThe output of this statement is unreliably affected by the\nsql_quote_show_create server system variable - see\nhttp://bugs.mysql.com/bug.php?id=12719\n \nExample\n \nMariaDB [test]> SHOW CREATE FUNCTION VatCents\\G\n*************************** 1. row\n***************************\n Function: VatCents\n sql_mode: \n Create Function: CREATE DEFINER=`root`@`localhost` FUNCTION\n`VatCents`(price DECIMAL(10,2)) RETURNS int(11)\n DETERMINISTIC\nBEGIN\n DECLARE x INT;\n SET x = price * 114;\n RETURN x;\nEND\ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n Database Collation: latin1_swedish_ci\n \n\n\nURL: https://mariadb.com/kb/en/show-create-function/','','https://mariadb.com/kb/en/show-create-function/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (362,26,'SHOW CREATE PACKAGE','Oracle-style packages were introduced in MariaDB 10.3.5.\n \nSyntax\n------ \nSHOW CREATE PACKAGE [ db_name . ] package_name\n \nDescription\n----------- \nThe SHOW CREATE PACKAGE statement can be used when Oracle\nSQL_MODE is set.\n \nShows the CREATE statement that creates the given package\nspecification.\n \nExamples\n-------- \nSHOW CREATE PACKAGE employee_tools\\G\n*************************** 1. row\n***************************\n Package: employee_tools\n sql_mode:\nPIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUTO_CREATE_USER\n Create Package: CREATE DEFINER=\"root\"@\"localhost\"\nPACKAGE \"employee_tools\" AS\n FUNCTION getSalary(eid INT) RETURN DECIMAL(10,2);\n PROCEDURE raiseSalary(eid INT, amount DECIMAL(10,2));\n PROCEDURE raiseSalaryStd(eid INT);\n PROCEDURE hire(ename TEXT, esalary DECIMAL(10,2));\nEND\ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n Database Collation: latin1_swedish_ci\n \n\n\nURL: https://mariadb.com/kb/en/show-create-package/','','https://mariadb.com/kb/en/show-create-package/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (363,26,'SHOW CREATE PACKAGE BODY','Oracle-style packages were introduced in MariaDB 10.3.5.\n \nSyntax\n------ \nSHOW CREATE PACKAGE BODY [ db_name . ] package_name\n \nDescription\n----------- \nThe SHOW CREATE PACKAGE BODY statement can be used when\nOracle SQL_MODE is set.\n \nShows the CREATE statement that creates the given package\nbody (i.e. the implementation).\n \nExamples\n-------- \nSHOW CREATE PACKAGE BODY employee_tools\\G\n*************************** 1. row\n***************************\n Package body: employee_tools\n sql_mode:\nPIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUTO_CREATE_USER\n Create Package Body: CREATE DEFINER=\"root\"@\"localhost\"\nPACKAGE BODY \"employee_tools\" AS\n \n stdRaiseAmount DECIMAL(10,2):=500;\n \n PROCEDURE log (eid INT, ecmnt TEXT) AS\n BEGIN\n INSERT INTO employee_log (id, cmnt) VALUES (eid, ecmnt);\n END;\n \n PROCEDURE hire(ename TEXT, esalary DECIMAL(10,2)) AS\n eid INT;\n BEGIN\n INSERT INTO employee (name, salary) VALUES (ename,\nesalary);\n eid:= last_insert_id();\n log(eid, \'hire \' || ename);\n END;\n \n FUNCTION getSalary(eid INT) RETURN DECIMAL(10,2) AS\n nSalary DECIMAL(10,2);\n BEGIN\n SELECT salary INTO nSalary FROM employee WHERE id=eid;\n log(eid, \'getSalary id=\' || eid || \' salary=\' ||\nnSalary);\n RETURN nSalary;\n END;\n \n PROCEDURE raiseSalary(eid INT, amount DECIMAL(10,2)) AS\n BEGIN\n UPDATE employee SET salary=salary+amount WHERE id=eid;\n log(eid, \'raiseSalary id=\' || eid || \' amount=\' ||\namount);\n END;\n \n PROCEDURE raiseSalaryStd(eid INT) AS\n BEGIN\n raiseSalary(eid, stdRaiseAmount);\n log(eid, \'raiseSalaryStd id=\' || eid);\n END;\n \nBEGIN \n log(0, \'Session \' || connection_id() || \' \' ||\ncurrent_user || \' started\');\nEND\ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n Database Collation: latin1_swedish_ci\n \n\n\nURL: https://mariadb.com/kb/en/show-create-package-body/','','https://mariadb.com/kb/en/show-create-package-body/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (364,26,'SHOW CREATE PROCEDURE','Syntax\n------ \nSHOW CREATE PROCEDURE proc_name\n \nDescription\n----------- \nThis statement is a MariaDB extension. It returns the exact\nstring that\ncan be used to re-create the named stored procedure, as well\nas the SQL_MODE that was used when the trigger has been\ncreated and the character set used by the connection.. A\nsimilar\nstatement, SHOW CREATE FUNCTION,\ndisplays information about stored functions.\n \nBoth statements require that you are the owner of the\nroutine or have the SELECT privilege on the mysql.proc\ntable. When neither is true, the statements display NULL for\nthe Create Procedure or Create Function field.\n \nWarning Users with SELECT privileges on mysql.proc or USAGE\nprivileges on *.* can view the text of routines, even when\nthey do not have privileges for the function or procedure\nitself.\n \nThe output of these statements is unreliably affected by the\nsql_quote_show_create server system variable - see\nhttp://bugs.mysql.com/bug.php?id=12719\n \nExamples\n-------- \nHere\'s a comparison of the SHOW CREATE PROCEDURE and SHOW\nCREATE FUNCTION statements.\n \nSHOW CREATE PROCEDURE test.simpleproc\\G\n*************************** 1. row\n***************************\n Procedure: simpleproc\n sql_mode: \n Create Procedure: CREATE PROCEDURE `simpleproc`(OUT param1\nINT)\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 \nSHOW CREATE FUNCTION test.hello\\G\n*************************** 1. row\n***************************\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 \nWhen the user issuing the statement does not have privileges\non the routine, attempting to CALL the procedure raises\nError 1370.\n \nCALL test.prc1();\nError 1370 (42000): execute command denieed to user\n\'test_user\'@\'localhost\' for routine \'test\'.\'prc1\'\n \nIf the user neither has privilege to the routine nor the\nSELECT privilege on mysql.proc table, it raises Error 1305,\ninforming them that the procedure does not exist.\n \nSHOW CREATE TABLES test.prc1\\G\nError 1305 (42000): PROCEDURE prc1 does not exist\n \n\n\nURL: https://mariadb.com/kb/en/show-create-procedure/','','https://mariadb.com/kb/en/show-create-procedure/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (365,26,'SHOW CREATE SEQUENCE','Sequences were introduced in MariaDB 10.3.\n \nSyntax\n------ \nSHOW CREATE SEQUENCE sequence_name;\n \nDescription\n----------- \nShows the CREATE SEQUENCE statement that created the given\nsequence. The statement requires the SELECT privilege for\nthe table.\n \nExample\n \nCREATE SEQUENCE s1 START WITH 50;\n \nSHOW CREATE SEQUENCE s1\\G;\n \n*************************** 1. row\n***************************\n Table: t1\nCreate Table: CREATE SEQUENCE `s1` start with 50 minvalue 1\nmaxvalue 9223372036854775806\nincrement by 1 cache 1000 nocycle ENGINE=Aria\n \nNotes\n \nIf you want to see the underlying table structure used for\nthe SEQUENCE\nyou can use SHOW CREATE TABLE on the SEQUENCE. You can also\nuse SELECT to read the current recorded state of the\nSEQUENCE:\n \nCREATE SEQUENCE t1;\n \nSHOW CREATE TABLE s1\\G\n*************************** 1. row\n***************************\n Table: s1\nCreate Table: CREATE TABLE `s1` (\n `next_value` bigint(21) NOT NULL COMMENT \'next not cached\nvalue\',\n `min_value` bigint(21) NOT NULL COMMENT \'min value\',\n `max_value` bigint(21) NOT NULL COMMENT \'max value\',\n `start` bigint(21) NOT NULL COMMENT \'start value\',\n `increment` bigint(21) NOT NULL COMMENT \'increment\nvalue\',\n `cache` bigint(21) NOT NULL COMMENT \'cache size\',\n `cycle` tinyint(1) unsigned NOT NULL COMMENT \'cycle\nstate\',\n `round` bigint(21) NOT NULL COMMENT \'How many cycles has\nbeen done\'\n) ENGINE=Aria SEQUENCE=1\n \nSELECT * FROM s1;\n \n+------------+-----------+---------------------+-------+-----------+-------+-------+-------+\n| next_value | min_value | max_value | start | increment |\ncache | cycle | round |\n+------------+-----------+---------------------+-------+-----------+-------+-------+-------+\n| 1 | 1 | 9223372036854775806 | 1 | 1 | 1000 | 0 | 0 |\n+------------+-----------+---------------------+-------+-----------+-------+-------+-------+\n \n\n\nURL: https://mariadb.com/kb/en/show-create-sequence/','','https://mariadb.com/kb/en/show-create-sequence/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (366,26,'SHOW CREATE TABLE','Syntax\n------ \nSHOW CREATE TABLE tbl_name\n \nDescription\n----------- \nShows the CREATE TABLE statement that created the given\ntable. The statement requires the SELECT privilege for the\ntable. This statement also works with views and SEQUENCE.\n \nSHOW CREATE TABLE quotes table and\ncolumn names according to the value of the\nsql_quote_show_create server system variable.\n \nMariaDB and MySQL-specific table options, column options,\nand index options are not included in the output of this\nstatement if the NO_TABLE_OPTIONS, NO_FIELD_OPTIONS and\nNO_KEY_OPTIONS SQL_MODE flags are used.\n \nInvalid table options, column options and index options are\nnormally commented out (note, that it is possible to create\na table with invalid options, by altering a table of a\ndifferent engine, where these options were valid). To have\nthem uncommented, enable IGNORE_BAD_TABLE_OPTIONS SQL_MODE.\nRemember that replaying a CREATE TABLE statement with\nuncommented invalid options will fail with an error, unless\nIGNORE_BAD_TABLE_OPTIONS SQL_MODE is in effect.\n \nNote that SHOW CREATE TABLE is not meant to provide metadata\nabout a table. It provides information about how the table\nwas declared, but the real table structure could differ a\nbit. For example, if an index has been declared as HASH, the\nCREATE TABLE statement returned by SHOW CREATE TABLE will\ndeclare that index as HASH; however, it is possible that the\nindex is in fact a BTREE, because the storage engine does\nnot support HASH.\n \nMariaDB 10.2.1 permits TEXT and BLOB data types to be\nassigned a DEFAULT value. As a result, from MariaDB 10.2.1,\nSHOW CREATE TABLE will append a DEFAULT NULL to nullable\nTEXT or BLOB fields if no specific default is provided. \n \nFrom MariaDB 10.2.2, numbers are no longer quoted in the\nDEFAULT clause in SHOW CREATE statement. Previously, MariaDB\nquoted numbers. \n \nExamples\n-------- \nSHOW CREATE TABLE t\\G\n*************************** 1. row\n***************************\n Table: t\nCreate Table: CREATE TABLE `t` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `s` char(60) DEFAULT NULL,\n PRIMARY KEY (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=latin1\n \nWith sql_quote_show_create off:\n \nSHOW CREATE TABLE t\\G\n*************************** 1. row\n***************************\n Table: t\nCreate Table: CREATE TABLE t (\n id int(11) NOT NULL AUTO_INCREMENT,\n s char(60) DEFAULT NULL,\n PRIMARY KEY (id)\n) ENGINE=InnoDB DEFAULT CHARSET=latin1\n \nUnquoted numeric DEFAULTs, from MariaDB 10.2.2:\n \nCREATE TABLE td (link TINYINT DEFAULT 1);\n \nSHOW CREATE TABLE td\\G\n*************************** 1. row\n***************************\n Table: td\nCreate Table: CREATE TABLE `td` (\n `link` tinyint(4) DEFAULT 1\n) ENGINE=InnoDB DEFAULT CHARSET=latin1\n \nQuoted numeric DEFAULTs, until MariaDB 10.2.1:\n \nCREATE TABLE td (link TINYINT DEFAULT 1);\n \nSHOW CREATE TABLE td\\G\n*************************** 1. row\n***************************\n Table: td\nCreate Table: CREATE TABLE `td` (\n `link` tinyint(4) DEFAULT \'1\'\n) ENGINE=InnoDB DEFAULT CHARSET=latin1\n \n\n\nURL: https://mariadb.com/kb/en/show-create-table/','','https://mariadb.com/kb/en/show-create-table/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (367,26,'SHOW CREATE TRIGGER','Syntax\n------ \nSHOW CREATE TRIGGER trigger_name\n \nDescription\n----------- \nThis statement shows a CREATE TRIGGER\nstatement that creates the given trigger, as well as the\nSQL_MODE that was used when the trigger has been created and\nthe character set used by the connection.\n \nThe output of this statement is unreliably affected by the\nsql_quote_show_create server system variable - see\nhttp://bugs.mysql.com/bug.php?id=12719\n \nExamples\n-------- \nSHOW CREATE TRIGGER example\\G\n*************************** 1. row\n***************************\n Trigger: example\n sql_mode:\nONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,STRICT_ALL_TABLES\n,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_\nENGINE_SUBSTITUTION\nSQL Original Statement: CREATE DEFINER=`root`@`localhost`\nTRIGGER example BEFORE\n INSERT ON t FOR EACH ROW\nBEGIN\n SET NEW.c = NEW.c * 2;\nEND\n character_set_client: cp850\n collation_connection: cp850_general_ci\n Database Collation: utf8_general_ci\n Created: 2016-09-29 13:53:34.35\n \nThe Created column was added in MySQL 5.7 and MariaDB 10.2.3\nas part of introducing multiple trigger events per action.\n \n\n\nURL: https://mariadb.com/kb/en/show-create-trigger/','','https://mariadb.com/kb/en/show-create-trigger/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (368,26,'SHOW CREATE USER','SHOW CREATE USER was introduced in MariaDB 10.2.0\n \nSyntax\n------ \nSHOW CREATE USER user_name\n \nDescription\n----------- \nShows the CREATE USER statement that created the given\nuser. The statement requires the SELECT privilege for the\nmysql database, except for the current user.\n \nExamples\n-------- \nCREATE USER foo4@test require cipher \'text\' \n issuer \'foo_issuer\' subject \'foo_subject\';\n \nSHOW CREATE USER foo4@test\\G\n*************************** 1. row\n***************************\nCREATE USER \'foo4\'@\'test\' \n REQUIRE ISSUER \'foo_issuer\' \n SUBJECT \'foo_subject\' \n CIPHER \'text\'\n \nUser Password Expiry:\n \nCREATE USER \'monty\'@\'localhost\' PASSWORD EXPIRE INTERVAL\n120 DAY;\n \nSHOW CREATE USER \'monty\'@\'localhost\';\n \n+------------------------------------------------------------------+\n| CREATE USER for monty@localhost |\n+------------------------------------------------------------------+\n| CREATE USER \'monty\'@\'localhost\' PASSWORD EXPIRE\nINTERVAL 120 DAY |\n+------------------------------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/show-create-user/','','https://mariadb.com/kb/en/show-create-user/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (369,26,'SHOW CREATE VIEW','Syntax\n------ \nSHOW CREATE VIEW view_name\n \nDescription\n----------- \nThis statement shows a CREATE VIEW statement that creates\nthe given view, as well as the character set used by the\nconnection when the view was created. This statement\nalso works with views.\n \nSHOW CREATE VIEW quotes table, column and stored function\nnames according to the value of the sql_quote_show_create\nserver system variable.\n \nExamples\n-------- \nSHOW CREATE VIEW example\\G\n*************************** 1. row\n***************************\n View: example\n Create View: CREATE ALGORITHM=UNDEFINED\nDEFINER=`root`@`localhost` SQL\nSECURITY DEFINER VIEW `example` AS (select `t`.`id` AS\n`id`,`t`.`s` AS `s` from\n`t`)\ncharacter_set_client: cp850\ncollation_connection: cp850_general_ci\n \nWith sql_quote_show_create off:\n \nSHOW CREATE VIEW example\\G\n*************************** 1. row\n***************************\n View: example\n Create View: CREATE ALGORITHM=UNDEFINED\nDEFINER=root@localhost SQL SECU\nRITY DEFINER VIEW example AS (select t.id AS id,t.s AS s\nfrom t)\ncharacter_set_client: cp850\ncollation_connection: cp850_general_ci\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/show-create-view/','','https://mariadb.com/kb/en/show-create-view/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (370,26,'SHOW DATABASES','Syntax\n------ \nSHOW {DATABASES | SCHEMAS}\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \nSHOW DATABASES lists the databases on the MariaDB server\nhost.\nSHOW SCHEMAS is a synonym for \nSHOW DATABASES. The LIKE clause, if\npresent on its own, indicates which database names to match.\nThe WHERE and LIKE clauses can be given to select rows using\nmore general conditions, as discussed in Extended SHOW.\n \nYou see only those databases for which you have some kind of\nprivilege, unless you have the global \nSHOW DATABASES privilege. You\ncan also get this list using the mysqlshow command.\n \nIf the server was started with the --skip-show-database\noption, you cannot use this statement at all unless you have\nthe\nSHOW DATABASES privilege.\n \nExample\n \nSHOW DATABASES;\n+--------------------+\n| Database |\n+--------------------+\n| information_schema |\n| mysql |\n| performance_schema |\n| test |\n+--------------------+\n \nSHOW DATABASES LIKE \'m%\';\n+---------------+\n| Database (m%) |\n+---------------+\n| mysql |\n+---------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/show-databases/','','https://mariadb.com/kb/en/show-databases/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (371,26,'SHOW ENGINE','Syntax\n------ \nSHOW ENGINE engine_name {STATUS | MUTEX}\n \nDescription\n----------- \nSHOW ENGINE displays operational information about a storage\nengine. The following statements currently are supported:\n \nSHOW ENGINE INNODB STATUS\nSHOW ENGINE INNODB MUTEX\nSHOW ENGINE PERFORMANCE_SCHEMA STATUS\n \nIf the Sphinx Storage Engine is installed, the following is\nalso supported:\n \nSHOW ENGINE SPHINX STATUS\n \nSee SHOW ENGINE SPHINX STATUS.\n \nOlder (and now removed) synonyms were SHOW INNODB STATUS\nfor SHOW ENGINE INNODB STATUS and \nSHOW MUTEX STATUS for \nSHOW ENGINE INNODB MUTEX.\n \nSHOW ENGINE BDB LOGS formerly displayed status information\nabout BDB log files. It was deprecated in MySQL 5.1.12 and\nremoved in MariaDB and MySQL 5.5, so now produces an error.\n \nSHOW ENGINE INNODB STATUS\n \nSHOW ENGINE INNODB STATUS displays extensive information\nfrom the standard InnoDB Monitor about the state of the\nInnoDB storage engine.\nSee SHOW ENGINE INNODB STATUS for more.\n \nSHOW ENGINE INNODB MUTEX\n \nSHOW ENGINE INNODB MUTEX displays InnoDB mutex statistics.\n \nThe statement displays the following output fields:\nType: Always InnoDB.\nName: The source file where the mutex is implemented, and\nthe line number\n in the file where the mutex is created. The line number is\ndependent on the MariaDB version.\nStatus: This field displays the following values if\nUNIV_DEBUG was defined at compilation time (for example, in\ninclude/univ.h in the InnoDB part of the source tree). Only\nthe os_waits value is displayed if UNIV_DEBUG was not\ndefined. Without UNIV_DEBUG, the information on which the\noutput is based is insufficient to distinguish regular\nmutexes and mutexes that protect\n rw-locks (which allow multiple readers or a single writer).\nConsequently, the\n output may appear to contain multiple rows for the same\nmutex.\ncount indicates how many times the mutex was requested.\nspin_waits indicates how many times the spinlock had to run.\nspin_rounds indicates the number of spinlock rounds.\n(spin_rounds divided by\n spin_waits provides the average round count.)\nos_waits indicates the number of operating system waits.\nThis occurs when\n the spinlock did not work (the mutex was not locked during\nthe spinlock and\n it was necessary to yield to the operating system and\nwait).\nos_yields indicates the number of times a the thread trying\nto lock a mutex\n gave up its timeslice and yielded to the operating system\n(on the\n presumption that allowing other threads to run will free\nthe mutex so that\n it can be locked).\nos_wait_times indicates the amount of time (in ms) spent in\noperating system\n waits, if the timed_mutexes system variable is 1 (ON). If\ntimed_mutexes is 0\n (OFF), timing is disabled, so os_wait_times is 0.\ntimed_mutexes is off by\n default.\n \nInformation from this statement can be used to diagnose\nsystem problems. For\nexample, large values of spin_waits and spin_rounds may\nindicate scalability\nproblems.\n \nThe information_schema.INNODB_MUTEXES table provides similar\ninformation.\n \nSHOW ENGINE PERFORMANCE_SCHEMA STATUS\n \nThis statement shows how much memory is used for\nperformance_schema tables and internal buffers.\n \nThe output contains the following fields:\nType: Always performance_schema.\nName: The name of a table, the name of an internal buffer,\nor the performance_schema word, followed by a dot and an\nattribute. Internal buffers names are enclosed by\nparenthesis. performance_schema means that the attribute\nrefers to the whole database (it is a total). \nStatus: The value for the attribute.\n \nThe following attributes are shown, in this order, for all\ntables:\nrow_size: The memory used for an individual record. This\nvalue will never change.\nrow_count: The number of rows in the table or buffer. For\nsome tables, this value depends on a server system variable.\nmemory: For tables and performance_schema, this is the\nresult of row_size * row_count.\n \nFor internal buffers, the attributes are:\ncount\nsize\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/show-engine/','','https://mariadb.com/kb/en/show-engine/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (372,26,'SHOW ENGINE INNODB STATUS','SHOW ENGINE INNODB STATUS is a specific form of the SHOW\nENGINE statement that displays the InnoDB Monitor output,\nwhich is extensive InnoDB information which can be useful in\ndiagnosing problems.\n \nThe following sections are displayed\nStatus: Shows the timestamp, monitor name and the number of\nseconds, or the elapsed time between the current time and\nthe time the InnoDB Monitor output was last displayed. The\nper-second averages are based upon this time.\nBACKGROUND THREAD: srv_master_thread lines show work\nperformed by the main background thread.\nSEMAPHORES: Threads waiting for a semaphore and stats on how\nthe number of times threads have needed a spin or a wait on\na mutex or rw-lock semaphore. If this number of threads is\nlarge, there may be I/O or contention issues. Reducing the\nsize of the innodb_thread_concurrency system variable may\nhelp if contention is related to thread scheduling. Spin\nrounds per wait shows the number of spinlock rounds per OS\nwait for a mutex. \nLATEST FOREIGN KEY ERROR: Only shown if there has been a\nforeign key constraint error, it displays the failed\nstatement and information about the constraint and the\nrelated tables.\nLATEST DETECTED DEADLOCK: Only shown if there has been a\ndeadlock, it displays the transactions involved in the\ndeadlock and the statements being executed, held and\nrequired locked and the transaction rolled back to.\nTRANSACTIONS: The output of this section can help identify\nlock contention, as well as reasons for the deadlocks.\nFILE I/O: InnoDB thread information as well as pending I/O\noperations and I/O performance statistics.\nINSERT BUFFER AND ADAPTIVE HASH INDEX: InnoDB insert buffer\nand adaptive hash index status information, including the\nnumber of each type of operation performed, and adaptive\nhash index performance.\nLOG: InnoDB log information, including current log sequence\nnumber, how far the log has been flushed to disk, the\nposition at which InnoDB last took a checkpoint, pending\nwrites and write performance statistics.\nBUFFER POOL AND MEMORY: Information on buffer pool pages\nread and written, which allows you to see the number of data\nfile I/O operations performed by your queries. See InnoDB\nBuffer Pool for more. Similar information is also available\nfrom the INFORMATION_SCHEMA.INNODB_BUFFER_POOL_STATS table.\nROW OPERATIONS:Information about the main thread, including\nthe number and performance rate for each type of row\noperation. \n \nIf the innodb_status_output_locks system variable is set to\n1, extended lock information will be displayed.\n \nExample output:\n \n=====================================\n2016-09-12 04:42:15 7f226145fb00 INNODB MONITOR OUTPUT\n=====================================\nPer second averages calculated from the last 29 seconds\n-----------------\nBACKGROUND THREAD\n-----------------\nsrv_master_thread loops: 0 srv_active, 0 srv_shutdown, 527\nsrv_idle\nsrv_master_thread log flush and writes: 527\n----------\nSEMAPHORES\n----------\nOS WAIT ARRAY INFO: reservation count 4\nOS WAIT ARRAY INFO: signal count 4\nMutex spin waits 2, rounds 60, OS waits 2\nRW-shared spins 2, rounds 60, OS waits 2\nRW-excl spins 0, rounds 0, OS waits 0\nSpin rounds per wait: 30.00 mutex, 30.00 RW-shared, 0.00\nRW-excl\n------------\nTRANSACTIONS\n------------\nTrx id counter 2308\nPurge done for trx\'s n:o < 0 undo n:o < 0 state: running\nbut idle\nHistory list length 0\nLIST OF TRANSACTIONS FOR EACH SESSION:\n---TRANSACTION 0, not started\nMySQL thread id 3, OS thread handle 0x7f226145fb00, query id\n4 localhost root init\nSHOW ENGINE INNODB STATUS\n--------\nFILE I/O\n--------\nI/O thread 0 state: waiting for completed aio requests\n(insert buffer thread)\nI/O thread 1 state: waiting for completed aio requests (log\nthread)\nI/O thread 2 state: waiting for completed aio requests (read\nthread)\nI/O thread 3 state: waiting for completed aio requests (read\nthread)\nI/O thread 4 state: waiting for completed aio requests (read\nthread)\nI/O thread 5 state: waiting for completed aio requests (read\nthread)\nI/O thread 6 state: waiting for completed aio requests\n(write thread)\nI/O thread 7 state: waiting for completed aio requests\n(write thread)\nI/O thread 8 state: waiting for completed aio requests\n(write thread)\nI/O thread 9 state: waiting for completed aio requests\n(write thread)\nPending normal aio reads: 0 [0, 0, 0, 0] , aio writes: 0 [0,\n0, 0, 0] ,\n ibuf aio reads: 0, log i/o\'s: 0, sync i/o\'s: 0\nPending flushes (fsync) log: 0; buffer pool: 0\n172 OS file reads, 5 OS file writes, 5 OS fsyncs\n0.00 reads/s, 0 avg bytes/read, 0.00 writes/s, 0.00 fsyncs/s\n-------------------------------------\nINSERT BUFFER AND ADAPTIVE HASH INDEX\n-------------------------------------\nIbuf: size 1, free list len 0, seg size 2, 0 merges\nmerged operations:\n insert 0, delete mark 0, delete 0\ndiscarded operations:\n insert 0, delete mark 0, delete 0\n0.00 hash searches/s, 0.00 non-hash searches/s\n---\nLOG\n---\nLog sequence number 1616829\nLog flushed up to 1616829\nPages flushed up to 1616829\nLast checkpoint at 1616829\nMax checkpoint age 80826164\nCheckpoint age target 78300347\nModified age 0\nCheckpoint age 0\n0 pending log writes, 0 pending chkp writes\n8 log i/o\'s done, 0.00 log i/o\'s/second\n----------------------\nBUFFER POOL AND MEMORY\n----------------------\nTotal memory allocated 140771328; in additional pool\nallocated 0\nTotal memory allocated by read views 88\nInternal hash tables (constant factor + variable factor)\n Adaptive hash index 2217568 (2213368 + 4200)\n Page hash 139112 (buffer pool 0 only)\n Dictionary cache 630703 (554768 + 75935)\n File system 817648 (812272 + 5376)\n Lock system 333232 (332872 + 360)\n Recovery system 0 (0 + 0)\nDictionary memory allocated 75935\nBuffer pool size 8191\nBuffer pool size, bytes 134201344\nFree buffers 8037\nDatabase pages 154\nOld database pages 0\nModified db pages 0\nPercent of dirty pages(LRU & free pages): 0.000\nMax dirty pages percent: 75.000\nPending reads 0\nPending writes: LRU 0, flush list 0, single page 0\nPages made young 0, not young 0\n0.00 youngs/s, 0.00 non-youngs/s\nPages read 154, created 0, written 1\n0.00 reads/s, 0.00 creates/s, 0.00 writes/s\nNo buffer pool page gets since the last printout\nPages read ahead 0.00/s, evicted without access 0.00/s,\nRandom read ahead 0.00/s\nLRU len: 154, unzip_LRU len: 0\nI/O sum[0]:cur[0], unzip sum[0]:cur[0]\n--------------\nROW OPERATIONS\n--------------\n0 queries inside InnoDB, 0 queries in queue\n0 read views open inside InnoDB\n0 RW transactions active inside InnoDB\n0 RO transactions active inside InnoDB\n0 out of 1000 descriptors used\nMain thread process no. 3337, id 139784957703936, state:\nsleeping\nNumber of rows inserted 0, updated 0, deleted 0, read 0\n0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s\nNumber of system rows inserted 0, updated 0, deleted 0, read\n0\n0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s\n----------------------------\nEND OF INNODB MONITOR OUTPUT\n============================\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/show-engine-innodb-status/','','https://mariadb.com/kb/en/show-engine-innodb-status/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (373,26,'SHOW ENGINES','Syntax\n------ \nSHOW [STORAGE] ENGINES\n \nDescription\n----------- \nSHOW ENGINES displays status information about the server\'s\nstorage engines. This is particularly useful for checking\nwhether a storage\nengine is supported, or to see what the default engine is. \nSHOW TABLE TYPES is a deprecated synonym.\n \nThe information_schema.ENGINES table provides the same\ninformation.\n \nSince storage engines are plugins, different information\nabout them is also shown in the information_schema.PLUGINS\ntable and by the SHOW PLUGINS statement.\n \nNote that both MySQL\'s InnoDB and Percona\'s XtraDB\nreplacement are labeled as InnoDB. However, if XtraDB is in\nuse, it will be specified in the COMMENT field. See XtraDB\nand InnoDB. The same applies to FederatedX.\n \nThe output consists of the following columns:\nEngine indicates the engine\'s name.\nSupport indicates whether the engine is installed, and\nwhether it is the default engine for the current session.\nComment is a brief description.\nTransactions, XA and Savepoints indicate whether\ntransactions, XA transactions and transaction savepoints are\nsupported by the engine.\n \nExamples\n-------- \nSHOW ENGINES\\G\n*************************** 1. row\n***************************\n Engine: InnoDB\n Support: DEFAULT\n Comment: Supports transactions, row-level locking, and\nforeign keys\nTransactions: YES\n XA: YES\n Savepoints: YES\n*************************** 2. row\n***************************\n Engine: CSV\n Support: YES\n Comment: CSV storage engine\nTransactions: NO\n XA: NO\n Savepoints: NO\n*************************** 3. row\n***************************\n Engine: MyISAM\n Support: YES\n Comment: MyISAM storage engine\nTransactions: NO\n XA: NO\n Savepoints: NO\n*************************** 4. row\n***************************\n Engine: BLACKHOLE\n Support: YES\n Comment: /dev/null storage engine (anything you write to it\ndisappears)\nTransactions: NO\n XA: NO\n Savepoints: NO\n*************************** 5. row\n***************************\n Engine: FEDERATED\n Support: YES\n Comment: FederatedX pluggable storage engine\nTransactions: YES\n XA: NO\n Savepoints: YES\n*************************** 6. row\n***************************\n Engine: MRG_MyISAM\n Support: YES\n Comment: Collection of identical MyISAM tables\nTransactions: NO\n XA: NO\n Savepoints: NO\n*************************** 7. row\n***************************\n Engine: ARCHIVE\n Support: YES\n Comment: Archive storage engine\nTransactions: NO\n XA: NO\n Savepoints: NO\n*************************** 8. row\n***************************\n Engine: MEMORY\n Support: YES\n Comment: Hash based, stored in memory, useful for temporary\ntables\nTransactions: NO\n XA: NO\n Savepoints: NO\n*************************** 9. row\n***************************\n Engine: PERFORMANCE_SCHEMA\n Support: YES\n Comment: Performance Schema\nTransactions: NO\n XA: NO\n Savepoints: NO\n*************************** 10. row\n***************************\n Engine: Aria\n Support: YES\n Comment: Crash-safe tables with MyISAM heritage\nTransactions: NO\n XA: NO\n Savepoints: NO\n10 rows in set (0.00 sec)\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/show-engines/','','https://mariadb.com/kb/en/show-engines/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (374,26,'SHOW ERRORS','Syntax\n------ \nSHOW ERRORS [LIMIT [offset,] row_count]\nSHOW ERRORS [LIMIT row_count OFFSET offset]\nSHOW COUNT(*) ERRORS\n \nDescription\n----------- \nThis statement is similar to SHOW WARNINGS, except that\ninstead of\ndisplaying errors, warnings, and notes, it displays only\nerrors.\n \nThe LIMIT clause has the same syntax as for the\nSELECT statement.\n \nThe SHOW COUNT(*) ERRORS statement displays the number of\nerrors. You can also retrieve this number from the\nerror_count variable.\n \nSHOW COUNT(*) ERRORS;\nSELECT @@error_count;\n \nThe value of error_count might be greater than the number of\nmessages displayed by SHOW WARNINGS if the max_error_count\nsystem variable is set so low that not all messages are\nstored.\n \nFor a list of MariaDB error codes, see MariaDB Error Codes.\n \nExamples\n-------- \nSELECT f();\nERROR 1305 (42000): FUNCTION f does not exist\n \nSHOW COUNT(*) ERRORS;\n \n+-----------------------+\n| @@session.error_count |\n+-----------------------+\n| 1 |\n+-----------------------+\n \nSHOW ERRORS;\n \n+-------+------+---------------------------+\n| Level | Code | Message |\n+-------+------+---------------------------+\n| Error | 1305 | FUNCTION f does not exist |\n+-------+------+---------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/show-errors/','','https://mariadb.com/kb/en/show-errors/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (375,26,'SHOW EVENTS','Syntax\n------ \nSHOW EVENTS [{FROM | IN} schema_name]\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \nShows information about Event Manager events (created with\nCREATE EVENT). Requires the EVENT privilege. Without any\narguments, SHOW EVENTS lists all of the events in the\ncurrent schema:\n \nSELECT CURRENT_USER(), SCHEMA();\n+----------------+----------+\n| CURRENT_USER() | SCHEMA() |\n+----------------+----------+\n| jon@ghidora | myschema |\n+----------------+----------+\n \nSHOW EVENTS\\G\n*************************** 1. row\n***************************\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 the event action, use SHOW CREATE EVENT instead, or\nlook at the information_schema.EVENTS table.\n \nTo see events for a specific schema, use the FROM clause.\nFor example, to see events for the test schema, use the\nfollowing statement:\n \nSHOW EVENTS FROM test;\n \nThe LIKE clause, if present, indicates which event names to\nmatch. The WHERE clause can be given to select rows using\nmore general conditions, as discussed in Extended Show.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/show-events/','','https://mariadb.com/kb/en/show-events/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (376,26,'SHOW EXPLAIN','The SHOW EXPLAIN command is a new feature in MariaDB 10.0.0.\n \nCommand description\n \nThe SHOW EXPLAIN command allows one to get an EXPLAIN (that\nis, a\ndescription of a query plan) of a query running in a certain\nthread.\n \nThe syntax is:\n \nSHOW EXPLAIN FOR ;\n \nwhich will produce an EXPLAIN output for the query that\nthread number thread_id is running. The thread id can be\nobtained with SHOW PROCESSLIST.\n \nSHOW EXPLAIN FOR 1;\n \n+------+-------------+-------+-------+---------------+------+---------+------+---------+-------------+\n| id | select_type | table | type | possible_keys | key |\nkey_len | ref | rows | Extra |\n+------+-------------+-------+-------+---------------+------+---------+------+---------+-------------+\n| 1 | SIMPLE | tbl | index | NULL | a | 5 | NULL | 1000107 |\nUsing index |\n+------+-------------+-------+-------+---------------+------+---------+------+---------+-------------+\n1 row in set, 1 warning (0.00 sec)\n \nThe output is always accompanied with a warning which shows\nthe query the\ntarget thread is running (this shows what the EXPLAIN is\nfor):\n \nSHOW WARNINGS;\n \n+-------+------+------------------------+\n| Level | Code | Message |\n+-------+------+------------------------+\n| Note | 1003 | select sum(a) from tbl |\n+-------+------+------------------------+\n1 row in set (0.00 sec)\n \nPossible errors\n \nThe output can be only produced if the target thread is\ncurrently running a\nquery, which has a ready query plan. If this is not the\ncase, the output will\nbe:\n \nSHOW EXPLAIN FOR 2;\n \nERROR 1932 (HY000): Target is not running an EXPLAINable\ncommand\n \nYou will get this error when:\nthe target thread is not running a command for which one can\nrun EXPLAIN\nthe target thread is running a command for which one can run\nEXPLAIN, but\nthere is no query plan yet (for example, tables are open and\nlocks are\n acquired before the query plan is produced)\n \n\nDifferences between SHOW EXPLAIN and EXPLAIN outputs\n \nBackground\n \nIn MySQL, EXPLAIN execution takes a slightly different route\nfrom the way\nthe real query (typically the SELECT) is optimized. This is\nunfortunate,\nand has caused a number of bugs in EXPLAIN. (For example,\nsee\nMDEV-326, MDEV-410, and\nlp:1013343.\nlp:992942 is not directly\nabout EXPLAIN, but it also would not have existed if MySQL\ndidn\'t try to delete\nparts of a query plan in the middle of the query) \n \nSHOW EXPLAIN examines a running SELECT, and hence its output\nmay be\nslightly different from what EXPLAIN SELECT would produce.\nWe did our best\nto make sure that either the difference is negligible, or\nSHOW EXPLAIN\'s\noutput is closer to reality than EXPLAIN\'s output.\n \nList of recorded differences\n \nSHOW EXPLAIN may have Extra=\'no matching row in const\ntable\', where EXPLAIN would produce Extra=\'Impossible\nWHERE ...\'\nFor queries with subqueries, SHOW EXPLAIN may print\nselect_type==PRIMARY where regular EXPLAIN used to print\nselect_type==SIMPLE, or vice versa.\n \nRequired permissions\n \nRunning SHOW EXPLAIN requires the same permissions as\nrunning SHOW PROCESSLIST would.\n \n\n\nURL: https://mariadb.com/kb/en/show-explain/','','https://mariadb.com/kb/en/show-explain/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (377,26,'SHOW FUNCTION CODE','Syntax\n------ \nSHOW FUNCTION CODE func_name\n \nDescription\n----------- \nSHOW FUNCTION CODE shows a representation of the internal\nimplementation of the stored function.\n \nIt is similar to SHOW PROCEDURE CODE but for stored\nfunctions.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/show-function-code/','','https://mariadb.com/kb/en/show-function-code/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (378,26,'SHOW FUNCTION STATUS','Syntax\n------ \nSHOW FUNCTION STATUS\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \nThis statement is similar to \nSHOW PROCEDURE STATUS but for\nstored functions.\n \nThe LIKE clause, if present on its own, indicates which\nfunction names to match. \n \nThe WHERE and LIKE clauses can be given to select rows using\nmore general conditions, as discussed in Extended SHOW.\n \nThe information_schema.ROUTINES table contains more detailed\ninformation.\n \nExamples\n-------- \nShowing all stored functions:\n \nSHOW FUNCTION STATUS\\G\n*************************** 1. row\n***************************\n Db: test\n Name: VatCents\n Type: FUNCTION\n Definer: root@localhost\n Modified: 2013-06-01 12:40:31\n Created: 2013-06-01 12:40:31\n Security_type: DEFINER\n Comment: \ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n Database Collation: latin1_swedish_ci\n \nStored functions whose name starts with \'V\': \n \nSHOW FUNCTION STATUS LIKE \'V%\' \\G\n*************************** 1. row\n***************************\n Db: test\n Name: VatCents\n Type: FUNCTION\n Definer: root@localhost\n Modified: 2013-06-01 12:40:31\n Created: 2013-06-01 12:40:31\n Security_type: DEFINER\n Comment: \ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n Database Collation: latin1_swedish_ci\n \nStored functions with a security type of \'DEFINER\':\n \nSHOW FUNCTION STATUS WHERE Security_type LIKE \'DEFINER\'\n\\G\n*************************** 1. row\n***************************\n Db: test\n Name: VatCents\n Type: FUNCTION\n Definer: root@localhost\n Modified: 2013-06-01 12:40:31\n Created: 2013-06-01 12:40:31\n Security_type: DEFINER\n Comment: \ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n Database Collation: latin1_swedish_ci\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/show-function-status/','','https://mariadb.com/kb/en/show-function-status/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (379,26,'SHOW GRANTS','Users\n \nSyntax\n------ \nSHOW GRANTS [FOR user]\n \nDescription\n----------- \nThis statement lists the GRANT statement or\nstatements that must be issued to duplicate the privileges\nthat are granted to\na MariaDB user account. The account is named using the same\nformat as for the\nGRANT statement; for example,\n\'jeffrey\'@\'localhost\'. If you specify only the user name\npart\nof the account name, a host name part of \'%\' is used. For\nadditional information about specifying account names, see\nGRANT.\n \nSHOW GRANTS FOR \'root\'@\'localhost\';\n+---------------------------------------------------------------------+\n| Grants for root@localhost |\n+---------------------------------------------------------------------+\n| GRANT ALL PRIVILEGES ON *.* TO \'root\'@\'localhost\' WITH\nGRANT OPTION |\n+---------------------------------------------------------------------+\n \nTo list the privileges granted to the account that you are\nusing to\nconnect to the server, you can use any of the following\nstatements:\n \nSHOW GRANTS;\n \nSHOW GRANTS FOR CURRENT_USER;\n \nSHOW GRANTS FOR CURRENT_USER();\n \nIf SHOW GRANTS FOR CURRENT_USER (or any\nof the equivalent syntaxes) is used in DEFINER context (such\nas within a stored procedure that is defined with \n SQL SECURITY DEFINER), the grants displayed are those of\nthe\ndefiner and not the invoker.\n \nNote that the DELETE HISTORY privilege, introduced in\nMariaDB 10.3.4, is displayed as DELETE VERSIONING ROWS when\nrunning SHOW GRANTS (MDEV-17655).\n \nRoles\n \nRoles were introduced in MariaDB 10.0.5.\n \nSyntax\n------ \nSHOW GRANTS [FOR role]\n \nDescription\n----------- \nFrom MariaDB 10.0.5, SHOW GRANTS can also be used to view\nthe privileges granted to a role.\n \nExample\n \nSHOW GRANTS FOR journalist;\n+------------------------------------------+\n| Grants for journalist |\n+------------------------------------------+\n| GRANT USAGE ON *.* TO \'journalist\' |\n| GRANT DELETE ON `test`.* TO \'journalist\' |\n+------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/show-grants/','','https://mariadb.com/kb/en/show-grants/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (380,26,'SHOW INDEX','Syntax\n------ \nSHOW {INDEX | INDEXES | KEYS} \n FROM tbl_name [FROM db_name]\n [WHERE expr]\n \nDescription\n----------- \nSHOW INDEX returns table index information. The format\nresembles that of the SQLStatistics call in ODBC.\n \nYou can use db_name.tbl_name as an alternative to the\n tbl_name FROM db_name syntax. These two statements are\n equivalent:\n \nSHOW INDEX FROM mytable FROM mydb;\nSHOW INDEX FROM mydb.mytable;\n \nSHOW KEYS and SHOW INDEXES are synonyms for SHOW INDEX.\n \nYou can also list a table\'s indexes with the following\ncommand: \n \nmysqlshow -k db_name tbl_name\n \nSee mysqlshow for more details.\n \nThe information_schema.STATISTICS table stores similar\ninformation.\n \nThe following fields are returned by SHOW INDEX.\n \nField | Description | \n \nTable | Table name | \n \nNon_unique | 1 if the index permits duplicate values, 0 if\nvalues must be unique. | \n \nKey_name | Index name. The primary key is always named\nPRIMARY. | \n \nSeq_in_index | The column\'s sequence in the index,\nbeginning with 1. | \n \nColumn_name | Column name. | \n \nCollation | Either A, if the column is sorted in ascending\norder in the index, or NULL if it\'s not sorted. | \n \nCardinality | Estimated number of unique values in the\nindex. The cardinality statistics are calculated at various\ntimes, and can help the optimizer make improved decisions. |\n\n \nSub_part | NULL if the entire column is included in the\nindex, or the number of included characters if not. | \n \nPacked | NULL if the index is not packed, otherwise how the\nindex is packed. | \n \nNull | NULL if NULL values are permitted in the column, an\nempty string if NULL\'s are not permitted. | \n \nIndex_type | The index type, which can be BTREE, FULLTEXT,\nHASH or RTREE. See Storage Engine Index Types. | \n \nComment | Other information, such as whether the index is\ndisabled. | \n \nIndex_comment | Contents of the COMMENT attribute when the\nindex was created. | \n \nThe WHERE and LIKE clauses can be given to select rows using\nmore general conditions, as discussed in Extended SHOW.\n \nExamples\n-------- \nCREATE TABLE IF NOT EXISTS `employees_example` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `first_name` varchar(30) NOT NULL,\n `last_name` varchar(40) NOT NULL,\n `position` varchar(25) NOT NULL,\n `home_address` varchar(50) NOT NULL,\n `home_phone` varchar(12) NOT NULL,\n `employee_code` varchar(25) NOT NULL,\n PRIMARY KEY (`id`),\n UNIQUE KEY `employee_code` (`employee_code`),\n KEY `first_name` (`first_name`,`last_name`)\n) ENGINE=Aria;\n \nINSERT INTO `employees_example` (`first_name`, `last_name`,\n`position`, `home_address`, `home_phone`, `employee_code`)\n VALUES\n (\'Mustapha\', \'Mond\', \'Chief Executive Officer\', \'692\nPromiscuous Plaza\', \'326-555-3492\', \'MM1\'),\n (\'Henry\', \'Foster\', \'Store Manager\', \'314 Savage\nCircle\', \'326-555-3847\', \'HF1\'),\n (\'Bernard\', \'Marx\', \'Cashier\', \'1240 Ambient\nAvenue\', \'326-555-8456\', \'BM1\'),\n (\'Lenina\', \'Crowne\', \'Cashier\', \'281 Bumblepuppy\nBoulevard\', \'328-555-2349\', \'LC1\'),\n (\'Fanny\', \'Crowne\', \'Restocker\', \'1023 Bokanovsky\nLane\', \'326-555-6329\', \'FC1\'),\n (\'Helmholtz\', \'Watson\', \'Janitor\', \'944 Soma\nCourt\', \'329-555-2478\', \'HW1\');\n \nSHOW INDEXES FROM employees_example;\n \n+-------------------+------------+---------------+--------------+---------------+-----------+-------------+----------+--------+------+------------+---------+---------------+\n| Table | Non_unique | Key_name | Seq_in_index | Column_name\n| Collation | Cardinality | Sub_part | Packed | Null |\nIndex_type | Comment | Index_comment |\n+-------------------+------------+---------------+--------------+---------------+-----------+-------------+----------+--------+------+------------+---------+---------------+\n| employees_example | 0 | PRIMARY | 1 | id | A | 7 | NULL |\nNULL | | BTREE | | |\n| employees_example | 0 | employee_code | 1 | employee_code\n| A | 7 | NULL | NULL | | BTREE | | |\n| employees_example | 1 | first_name | 1 | first_name | A |\nNULL | NULL | NULL | | BTREE | | |\n| employees_example | 1 | first_name | 2 | last_name | A |\nNULL | NULL | NULL | | BTREE | | |\n+-------------------+------------+---------------+--------------+---------------+-----------+-------------+----------+--------+------+------------+---------+---------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/show-index/','','https://mariadb.com/kb/en/show-index/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (381,26,'SHOW LOCALES','SHOW LOCALES was introduced as part of the Information\nSchema plugin extension in MariaDB 10.1.1.\n \nSHOW LOCALES is used to return locales information as part\nof the Locales plugin. While the information_schema.LOCALES\ntable has 8 columns, the SHOW LOCALES statement will only\ndisplay 4 of them:\n \nExample\n \nSHOW LOCALES;\n+-----+-------+-------------------------------------+------------------------+\n| Id | Name | Description | Error_Message_Language |\n+-----+-------+-------------------------------------+------------------------+\n| 0 | en_US | English - United States | english |\n| 1 | en_GB | English - United Kingdom | english |\n| 2 | ja_JP | Japanese - Japan | japanese |\n| 3 | sv_SE | Swedish - Sweden | swedish |\n...\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/show-locales/','','https://mariadb.com/kb/en/show-locales/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (382,26,'SHOW MASTER STATUS','Syntax\n------ \nSHOW MASTER STATUS\n \nDescription\n----------- \nProvides status information about the binary log files of\nthe master.\n \nThis statement requires the SUPER or the REPLICATION_CLIENT\nprivilege.\n \nTo see information about the current GTIDs in the binary\nlog, use the\ngtid_binlog_pos variable.\n \nExample\n \nSHOW MASTER STATUS;\n+--------------------+----------+--------------+------------------+\n| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |\n+--------------------+----------+--------------+------------------+\n| mariadb-bin.000016 | 475 | | |\n+--------------------+----------+--------------+------------------+\nSELECT @@global.gtid_binlog_pos;\n+--------------------------+\n| @@global.gtid_binlog_pos |\n+--------------------------+\n| 0-1-2 |\n+--------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/show-master-status/','','https://mariadb.com/kb/en/show-master-status/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (383,26,'SHOW OPEN TABLES','Syntax\n------ \nSHOW OPEN TABLES [FROM db_name]\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \n SHOW OPEN TABLES lists the non-TEMPORARY\ntables that are currently open in the table cache. See\nhttp://dev.mysql.com/doc/refman/5.1/en/table-cache.html.\n \nThe FROM and LIKE clauses may be used.\n \nThe FROM\nclause, if present, restricts the tables shown to those\npresent in the\ndb_name database. \n \nThe LIKE clause, if\npresent on its own, indicates which table names to match.\nThe WHERE and LIKE clauses can be given to select rows using\nmore general conditions, as discussed in Extended SHOW.\n \nThe following information is returned:\n \nColumn | Description | \n \nDatabase | Database name. | \n \nName | Table name. | \n \nIn_use | Number of table instances being used. | \n \nName_locked | 1 if the table is name-locked, e.g. if it is\nbeing dropped or renamed, otherwise 0. | \n \nBefore MariaDB 5.5, each use of, for example, LOCK TABLE ...\nWRITE would increment In_use for that table. With the\nimplementation of the metadata locking improvements in\nMariaDB 5.5, LOCK TABLE... WRITE acquires a strong MDL lock,\nand concurrent connections will wait on this MDL lock, so\nany subsequent LOCK TABLE... WRITE will not increment\nIn_use.\n \nExample\n \nSHOW OPEN TABLES;\n \n+----------+---------------------------+--------+-------------+\n| Database | Table | In_use | Name_locked |\n+----------+---------------------------+--------+-------------+\n...\n| test | xjson | 0 | 0 |\n| test | jauthor | 0 | 0 |\n| test | locks | 1 | 0 |\n...\n+----------+---------------------------+--------+-------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/show-open-tables/','','https://mariadb.com/kb/en/show-open-tables/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (384,26,'SHOW PACKAGE BODY STATUS','Oracle-style packages were introduced in MariaDB 10.3.5.\n \nSyntax\n------ \nSHOW PACKAGE BODY STATUS\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \nThe SHOW PACKAGE BODY STATUS statement returns\ncharacteristics of stored package bodies (implementations),\nsuch as the database, name, type, creator, creation and\nmodification dates, and character set information. A similar\nstatement, SHOW PACKAGE STATUS, displays information about\nstored package specifications.\n \nThe LIKE clause, if present, indicates which package names\nto match. The WHERE and LIKE clauses can be given to select\nrows using more general conditions, as discussed in Extended\nSHOW.\n \nThe ROUTINES table in the INFORMATION_SCHEMA database\ncontains more detailed information.\n \nExamples\n-------- \nSHOW PACKAGE BODY STATUS LIKE \'pkg1\'\\G\n*************************** 1. row\n***************************\n Db: test\n Name: pkg1\n Type: PACKAGE BODY\n Definer: root@localhost\n Modified: 2018-02-27 14:44:14\n Created: 2018-02-27 14:44:14\n Security_type: DEFINER\n Comment: This is my first package body\ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n Database Collation: latin1_swedish_ci\n \n\n\nURL: https://mariadb.com/kb/en/show-package-body-status/','','https://mariadb.com/kb/en/show-package-body-status/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (385,26,'SHOW PACKAGE STATUS','Oracle-style packages were introduced in MariaDB 10.3.5.\n \nSyntax\n------ \nSHOW PACKAGE STATUS\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \nThe SHOW PACKAGE STATUS statement returns characteristics of\nstored package specifications, such as the database, name,\ntype, creator, creation and modification dates, and\ncharacter set information. A similar statement, SHOW PACKAGE\nBODY STATUS, displays information about stored package\nbodies (i.e. implementations).\n \nThe LIKE clause, if present, indicates which package names\nto match. The WHERE and LIKE clauses can be given to select\nrows using more general conditions, as discussed in Extended\nSHOW.\n \nThe ROUTINES table in the INFORMATION_SCHEMA database\ncontains more detailed information.\n \nExamples\n-------- \nSHOW PACKAGE STATUS LIKE \'pkg1\'\\G\n*************************** 1. row\n***************************\n Db: test\n Name: pkg1\n Type: PACKAGE\n Definer: root@localhost\n Modified: 2018-02-27 14:38:15\n Created: 2018-02-27 14:38:15\n Security_type: DEFINER\n Comment: This is my first package\ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n Database Collation: latin1_swedish_ci\n \n\n\nURL: https://mariadb.com/kb/en/show-package-status/','','https://mariadb.com/kb/en/show-package-status/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (386,26,'SHOW PLUGINS','Syntax\n------ \nSHOW PLUGINS;\n \nDescription\n----------- \n SHOW PLUGINS displays information about installed plugins.\nThe Library column indicates the plugin library - if it is\nNULL, the plugin is built-in and cannot be uninstalled.\n \nThe PLUGINS table in the information_schema database\ncontains more detailed information.\n \nFor specific information about storage engines (a particular\ntype of plugin), see the information_schema.ENGINES table\nand the SHOW ENGINES statement.\n \nExamples\n-------- \nSHOW PLUGINS;\n+----------------------------+----------+--------------------+-------------+---------+\n| Name | Status | Type | Library | License |\n+----------------------------+----------+--------------------+-------------+---------+\n| binlog | ACTIVE | STORAGE ENGINE | NULL | GPL |\n| mysql_native_password | ACTIVE | AUTHENTICATION | NULL |\nGPL |\n| mysql_old_password | ACTIVE | AUTHENTICATION | NULL | GPL\n|\n| MRG_MyISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |\n| MyISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |\n| CSV | ACTIVE | STORAGE ENGINE | NULL | GPL |\n| MEMORY | ACTIVE | STORAGE ENGINE | NULL | GPL |\n| FEDERATED | ACTIVE | STORAGE ENGINE | NULL | GPL |\n| PERFORMANCE_SCHEMA | ACTIVE | STORAGE ENGINE | NULL | GPL\n|\n| Aria | ACTIVE | STORAGE ENGINE | NULL | GPL |\n| InnoDB | ACTIVE | STORAGE ENGINE | NULL | GPL |\n| INNODB_TRX | ACTIVE | INFORMATION SCHEMA | NULL | GPL |\n...\n| INNODB_SYS_FOREIGN | ACTIVE | INFORMATION SCHEMA | NULL |\nGPL |\n| INNODB_SYS_FOREIGN_COLS | ACTIVE | INFORMATION SCHEMA |\nNULL | GPL |\n| SPHINX | ACTIVE | STORAGE ENGINE | NULL | GPL |\n| ARCHIVE | ACTIVE | STORAGE ENGINE | NULL | GPL |\n| BLACKHOLE | ACTIVE | STORAGE ENGINE | NULL | GPL |\n| FEEDBACK | DISABLED | INFORMATION SCHEMA | NULL | GPL |\n| partition | ACTIVE | STORAGE ENGINE | NULL | GPL |\n| pam | ACTIVE | AUTHENTICATION | auth_pam.so | GPL |\n+----------------------------+----------+--------------------+-------------+---------+\n \n\n\nURL: https://mariadb.com/kb/en/show-plugins/','','https://mariadb.com/kb/en/show-plugins/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (387,26,'SHOW PLUGINS SONAME','MariaDB 10.0.2\n \nSHOW PLUGINS SONAME was introduced in MariaDB 10.0.2\n \nSyntax\n------ \nSHOW PLUGINS SONAME { library | LIKE \'pattern\' | WHERE\nexpr };\n \nDescription\n----------- \nSHOW PLUGINS SONAME displays information about compiled-in\nand all server plugins in the plugin_dir directory,\nincluding plugins that haven\'t been installed.\n \nExamples\n-------- \nSHOW PLUGINS SONAME \'ha_example.so\';\n+----------+---------------+----------------+---------------+---------+\n| Name | Status | Type | Library | License |\n+----------+---------------+----------------+---------------+---------+\n| EXAMPLE | NOT INSTALLED | STORAGE ENGINE | ha_example.so |\nGPL |\n| UNUSABLE | NOT INSTALLED | DAEMON | ha_example.so | GPL |\n+----------+---------------+----------------+---------------+---------+\n \nThere is also a corresponding information_schema table,\ncalled ALL_PLUGINS, which contains more complete\ninformation.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/show-plugins-soname/','','https://mariadb.com/kb/en/show-plugins-soname/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (388,26,'SHOW PRIVILEGES','Syntax\n------ \nSHOW PRIVILEGES\n \nDescription\n----------- \n SHOW PRIVILEGES shows the list of system privileges that\nthe MariaDB server supports. The exact list of privileges\ndepends on the version of your server.\n \nNote that the Delete history privilege displays as Delete\nversioning rows (MDEV-20382).\n \nExamples\n-------- \nSHOW PRIVILEGES;\n+-------------------------+---------------------------------------+-------------------------------------------------------+\n| Privilege | Context | Comment |\n+-------------------------+---------------------------------------+-------------------------------------------------------+\n| Alter | Tables | To alter the table |\n| Alter routine | Functions,Procedures | To alter or drop\nstored functions/procedures |\n| Create | Databases,Tables,Indexes | To create new\ndatabases and tables |\n| Create routine | Databases | To use CREATE\nFUNCTION/PROCEDURE |\n| Create temporary tables | Databases | To use CREATE\nTEMPORARY TABLE |\n| Create view | Tables | To create new views |\n| Create user | Server Admin | To create new users |\n| Delete | Tables | To delete existing rows |\n| Delete versioning rows | Tables | To delete versioning\ntable historical rows |\n| Drop | Databases,Tables | To drop databases, tables, and\nviews |\n| Event | Server Admin | To create, alter, drop and execute\nevents |\n| Execute | Functions,Procedures | To execute stored\nroutines |\n| File | File access on server | To read and write files on\nthe server |\n| Grant option | Databases,Tables,Functions,Procedures | To\ngive to other users those privileges you possess |\n| Index | Tables | To create or drop indexes |\n| Insert | Tables | To insert data into tables |\n| Lock tables | Databases | To use LOCK TABLES (together\nwith SELECT privilege) |\n| Process | Server Admin | To view the plain text of\ncurrently executing queries |\n| Proxy | Server Admin | To make proxy user possible |\n| References | Databases,Tables | To have references on\ntables |\n| Reload | Server Admin | To reload or refresh tables, logs\nand privileges |\n| Replication client | Server Admin | To ask where the slave\nor master servers are |\n| Replication slave | Server Admin | To read binary log\nevents from the master |\n| Select | Tables | To retrieve rows from table |\n| Show databases | Server Admin | To see all databases with\nSHOW DATABASES |\n| Show view | Tables | To see views with SHOW CREATE VIEW |\n| Shutdown | Server Admin | To shut down the server |\n| Super | Server Admin | To use KILL thread, SET GLOBAL,\nCHANGE MASTER, etc. |\n| Trigger | Tables | To use triggers |\n| Create tablespace | Server Admin | To create/alter/drop\ntablespaces |\n| Update | Tables | To update existing rows |\n| Usage | Server Admin | No privileges - allow connect only\n|\n+-------------------------+---------------------------------------+-------------------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/show-privileges/','','https://mariadb.com/kb/en/show-privileges/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (389,26,'SHOW PROCEDURE CODE','Syntax\n------ \nSHOW PROCEDURE CODE proc_name\n \nDescription\n----------- \nThis statement is a MariaDB extension that is available only\nfor servers that\nhave been built with debugging support. It displays a\nrepresentation of the\ninternal implementation of the named stored procedure. A\nsimilar statement,\n SHOW FUNCTION CODE, displays\ninformation about stored functions.\n \nBoth statements require that you be the owner of the routine\nor have\n SELECT access to the mysql.proc table.\n \nIf the named routine is available, each statement produces a\nresult\nset. Each row in the result set corresponds to one\n\"instruction\" in\nthe routine. The first column is Pos, which is an ordinal\nnumber\nbeginning with 0. The second column is Instruction, which\ncontains an\nSQL statement (usually changed from the original source), or\na\ndirective which has meaning only to the stored-routine\nhandler.\n \nExamples\n-------- \nDELIMITER //\n \nCREATE 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 \nSHOW 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+-----+----------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/show-procedure-code/','','https://mariadb.com/kb/en/show-procedure-code/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (390,26,'SHOW PROCEDURE STATUS','Syntax\n------ \nSHOW PROCEDURE STATUS\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \nThis statement is a MariaDB extension. It returns\ncharacteristics of a stored\nprocedure, such as the database, name, type, creator,\ncreation and modification\ndates, and character set information. A similar statement, \n SHOW FUNCTION STATUS, displays\ninformation about stored functions.\n \nThe LIKE clause, if present, indicates which procedure or\nfunction names to match. The WHERE and LIKE clauses can be\ngiven to select rows using more general conditions, as\ndiscussed in Extended SHOW.\n \nThe ROUTINES table in the INFORMATION_SCHEMA database\ncontains more detailed information.\n \nExamples\n-------- \nSHOW PROCEDURE STATUS LIKE \'p1\'\\G\n*************************** 1. row\n***************************\n Db: test\n Name: p1\n Type: PROCEDURE\n Definer: root@localhost\n Modified: 2010-08-23 13:23:03\n Created: 2010-08-23 13:23:03\n Security_type: DEFINER\n Comment: \ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n \n\n\nURL: https://mariadb.com/kb/en/show-procedure-status/','','https://mariadb.com/kb/en/show-procedure-status/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (391,26,'SHOW PROCESSLIST','Syntax\n------ \nSHOW [FULL] PROCESSLIST\n \nDescription\n----------- \n SHOW PROCESSLIST shows you which threads are running. You\ncan also get this information from the\ninformation_schema.PROCESSLIST table or the mysqladmin\nprocesslist command. If you have the \nPROCESS privilege, you can see all threads.\nOtherwise, you can see only your own threads (that is,\nthreads associated with\nthe MariaDB account that you are using). If you do not use\nthe\nFULL keyword, only the first 100 characters of each\nstatement are shown in the Info field.\n \nThe columns shown in SHOW PROCESSLIST\n are:\n \nName | Description | Introduced | \n \nID | The client\'s process ID. | | \n \nUSER | The username associated with the process. | | \n \nHOST | The host the client is connected to. | | \n \nDB | The default database of the process (NULL if no\ndefault). | | \n \nCOMMAND | The command type. See Thread Command Values. | | \n \nTIME | The amount of time, in seconds, the process has been\nin its current state. For a slave SQL thread before MariaDB\n10.1, this is the time in seconds between the last\nreplicated event\'s timestamp and the slave machine\'s real\ntime. | | \n \nSTATE | See Thread States. | | \n \nINFO | The statement being executed. | | \n \nPROGRESS | The total progress of the process (0-100%) (see\nProgress Reporting). | MariaDB 5.3 | \n \nSee TIME_MS column in information_schema.PROCESSLIST for\ndifferences in the TIME column between MariaDB and MySQL.\n \nThe information_schema.PROCESSLIST table contains the\nfollowing additional columns:\n \nName | Description | Introduced | \n \nTIME_MS | The amount of time, in milliseconds, the process\nhas been in its current state. | MariaDB 5.1 | \n \nSTAGE | The stage the process is currently in. |\nMariaDB 5.3 | \n \nMAX_STAGE | The maximum number of stages. | MariaDB 5.3 | \n \nPROGRESS | The progress of the process within the current\nstage (0-100%). | MariaDB 5.3 | \n \nMEMORY_USED | The amount of memory used by the process. |\nMariaDB 10.0.1 | \n \nEXAMINED_ROWS | The number of rows the process has examined.\n| MariaDB 10.0.1 | \n \nQUERY_ID | Query ID. | MariaDB 10.0.5 | \n \nNote that the PROGRESS field from the information schema,\nand the PROGRESS field from SHOW PROCESSLIST display\ndifferent results. SHOW PROCESSLIST shows the total\nprogress, while the information schema shows the progress\nfor the current stage only.\n \nThreads can be killed using their thread_id, or, since\nMariaDB 10.0.5, their query_id, with the KILL statement.\n \nSince queries on this table are locking, if the\nperformance_schema is enabled, you may want to query the\nTHREADS table instead.\n \nExamples\n-------- \nFrom MariaDB 5.1.x\n \nSHOW FULL PROCESSLIST;\n+---------+-------+-----------+------+---------+------+-------+-----------------------+\n| Id | User | Host | db | Command | Time | State | Info |\n+---------+-------+-----------+------+---------+------+-------+-----------------------+\n| 1988880 | dbart | localhost | NULL | Query | 0 | NULL |\nSHOW FULL PROCESSLIST |\n+---------+-------+-----------+------+---------+------+-------+-----------------------+\n \nSELECT * FROM information_schema.processlist;\n+---------+-------+-----------+------+---------+------+-----------+----------------------------------------------+---------+\n| ID | USER | HOST | DB | COMMAND | TIME | STATE | INFO |\nTIME_MS |\n+---------+-------+-----------+------+---------+------+-----------+----------------------------------------------+---------+\n| 1988880 | dbart | localhost | NULL | Query | 0 | executing\n| SELECT * FROM information_schema.processlist | 0.444 |\n+---------+-------+-----------+------+---------+------+-----------+----------------------------------------------+---------+\n \nFrom MariaDB 5.5.x\n \nSHOW FULL PROCESSLIST;\n+-----+------+-----------+------+---------+------+-------+-----------------------+----------+\n| Id | User | Host | db | Command | Time | State | Info |\nProgress |\n+-----+------+-----------+------+---------+------+-------+-----------------------+----------+\n| 126 | root | localhost | NULL | Query | 0 | NULL | SHOW\nFULL PROCESSLIST | 0.000 |\n+-----+------+-----------+------+---------+------+-------+-----------------------+----------+\n \nSELECT * FROM information_schema.processlist;\n+-----+--------+-----------+------+---------+------+-----------+----------------------------------------------+---------+-------+-----------+----------+\n| ID | USER | HOST | DB | COMMAND | TIME | STATE | INFO |\nTIME_MS | STAGE | MAX_STAGE | PROGRESS |\n+-----+--------+-----------+------+---------+------+-----------+----------------------------------------------+---------+-------+-----------+----------+\n| 126 | root | localhost | NULL | Query | 0 | executing |\nSELECT * FROM information_schema.processlist | 344.718 | 0 |\n0 | 0.000 |\n+-----+--------+-----------+------+---------+------+-----------+----------------------------------------------+---------+-------+-----------+----------+\n \nFrom MariaDB 10.0.x\n \nSHOW PROCESSLIST;\n+----+-----------------+-----------+------+---------+------+------------------------+------------------+----------+\n| Id | User | Host | db | Command | Time | State | Info |\nProgress |\n+----+-----------------+-----------+------+---------+------+------------------------+------------------+----------+\n| 2 | event_scheduler | localhost | NULL | Daemon | 2693 |\nWaiting on empty queue | NULL | 0.000 |\n| 4 | root | localhost | NULL | Query | 0 | Table lock |\nSHOW PROCESSLIST | 0.000 |\n+----+-----------------+-----------+------+---------+------+------------------------+------------------+----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/show-processlist/','','https://mariadb.com/kb/en/show-processlist/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (392,26,'SHOW PROFILE','Syntax\n------ \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 \nDescription\n----------- \nThe SHOW PROFILE and \nSHOW PROFILES statements display profiling\ninformation that indicates resource usage for statements\nexecuted during the\ncourse of the current session.\n \nProfiling is controlled by the profiling session variable,\nwhich has a default value of 0 (OFF). Profiling is enabled\nby setting profiling to 1 or ON:\n \nSET profiling = 1;\n \nSHOW PROFILES displays a list of the most recent statements\nsent to the master. The size of the list is controlled by\nthe\nprofiling_history_size session variable, which has a default\nvalue of 15. The maximum value is 100. Setting the value to\n0 has the practical effect of disabling profiling.\n \nAll statements are profiled except SHOW PROFILES and \nSHOW PROFILE, so you will find neither of those statements\nin the profile list. Malformed statements are profiled. For\nexample, \n SHOW PROFILING is an illegal statement, and a syntax error\noccurs if you try to execute it, but it will show up in the\nprofiling list.\n \n SHOW PROFILE displays detailed information about a single\nstatement. Without the FOR QUERY n clause, the output\npertains to the most recently executed statement. If \n FOR QUERY n is included,\n SHOW PROFILE displays information for statement n. The\nvalues of n correspond to\nthe Query_ID values displayed by SHOW PROFILES.\n \nThe LIMIT row_count clause may be given to limit the\noutput to row_count rows. If LIMIT is given, \n OFFSET offset may be added to begin the output offset\nrows into the full set of rows.\n \nBy default, SHOW PROFILE displays Status and Duration\ncolumns. The Status values are like the State values\ndisplayed by \nSHOW PROCESSLIST,\nalthough there might be some minor differences in\ninterpretation for\nthe two statements for some status values (see\nhttp://dev.mysql.com/doc/refman/5.6/en/thread-information.html).\n \nOptional type values may be specified to display specific\nadditional\ntypes of information:\nALL displays all information\nBLOCK IO displays counts for block input and output\noperations\nCONTEXT SWITCHES displays counts for voluntary and\ninvoluntary context switches\nCPU displays user and system CPU usage times\nIPC displays counts for messages sent and received\nMEMORY is not currently implemented\nPAGE FAULTS displays counts for major and minor page faults\nSOURCE displays the names of functions from the source code,\ntogether with the name and line number of the file in which\nthe function occurs\nSWAPS displays swap counts\n \nProfiling is enabled per session. When a session ends, its\nprofiling information is lost.\n \nThe information_schema.PROFILING table contains similar\ninformation.\n \nExamples\n-------- \nSELECT @@profiling;\n+-------------+\n| @@profiling |\n+-------------+\n| 0 |\n+-------------+\n \nSET profiling = 1;\n \nUSE test;\n \nDROP TABLE IF EXISTS t1;\n \nCREATE TABLE T1 (id INT);\n \nSHOW PROFILES;\n+----------+------------+--------------------------+\n| Query_ID | Duration | Query |\n+----------+------------+--------------------------+\n| 1 | 0.00009200 | SELECT DATABASE() |\n| 2 | 0.00023800 | show databases |\n| 3 | 0.00018900 | show tables |\n| 4 | 0.00014700 | DROP TABLE IF EXISTS t1 |\n| 5 | 0.24476900 | CREATE TABLE T1 (id INT) |\n+----------+------------+--------------------------+\n \nSHOW PROFILE;\n+----------------------+----------+\n| Status | Duration |\n+----------------------+----------+\n| starting | 0.000042 |\n| checking permissions | 0.000044 |\n| creating table | 0.244645 |\n| After create | 0.000013 |\n| query end | 0.000003 |\n| freeing items | 0.000016 |\n| logging slow query | 0.000003 |\n| cleaning up | 0.000003 |\n+----------------------+----------+\n \nSHOW PROFILE FOR QUERY 4;\n+--------------------+----------+\n| Status | Duration |\n+--------------------+----------+\n| starting | 0.000126 |\n| query end | 0.000004 |\n| freeing items | 0.000012 |\n| logging slow query | 0.000003 |\n| cleaning up | 0.000002 |\n+--------------------+----------+\n \nSHOW PROFILE CPU FOR QUERY 5;\n+----------------------+----------+----------+------------+\n| Status | Duration | CPU_user | CPU_system |\n+----------------------+----------+----------+------------+\n| starting | 0.000042 | 0.000000 | 0.000000 |\n| checking permissions | 0.000044 | 0.000000 | 0.000000 |\n| creating table | 0.244645 | 0.000000 | 0.000000 |\n| After create | 0.000013 | 0.000000 | 0.000000 |\n| query end | 0.000003 | 0.000000 | 0.000000 |\n| freeing items | 0.000016 | 0.000000 | 0.000000 |\n| logging slow query | 0.000003 | 0.000000 | 0.000000 |\n| cleaning up | 0.000003 | 0.000000 | 0.000000 |\n+----------------------+----------+----------+------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/show-profile/','','https://mariadb.com/kb/en/show-profile/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (393,26,'SHOW PROFILES','Syntax\n------ \nSHOW PROFILES\n \nDescription\n----------- \nThe SHOW PROFILES statement displays profiling information\nthat indicates resource usage for statements executed during\nthe course of the\ncurrent session. It is used together with \nSHOW PROFILE.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/show-profiles/','','https://mariadb.com/kb/en/show-profiles/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (394,26,'SHOW QUERY_RESPONSE_TIME','SHOW QUERY_RESPONSE_TIME was introduced in MariaDB 10.1.1.\n \nStarting with MariaDB 10.1.1, which introduced the\nInformation Schema plugin extension, it is possible to use\nSHOW QUERY_RESPONSE_TIME as an alternative for retrieving\ninformation from the QUERY_RESPONSE_TIME plugin.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/show-query_response_time/','','https://mariadb.com/kb/en/show-query_response_time/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (395,26,'SHOW RELAYLOG EVENTS','Syntax\n------ \nSHOW RELAYLOG [\'connection_name\'] EVENTS\n [IN \'log_name\'] [FROM pos] [LIMIT [offset,] row_count]\n \nDescription\n----------- \nOn replication slaves this command shows the events in the\nrelay log. If \'log_name\' is not specified, the first relay\nlog is shown.\n \nSyntax for the LIMIT clause is the same as for SELECT ...\nLIMIT.\n \nUsing the LIMIT clause is highly recommended because the\nSHOW RELAYLOG EVENTS command returns the complete contents\nof the relay log, which can be quite large.\n \nThis command does not return events related to setting user\nand system variables. If you need those, use mysqlbinlog.\n \nOn the replication master, this command does nothing.\n \nconnection_name\n \nconnection_name was added as part of multi-source\nreplication added in MariaDB 10.0.1\n \nIf there is only one nameless master, or the default master\n(as specified by the default_master_connection system\nvariable) is intended, connection_name can be omitted. If\nprovided, the SHOW RELAYLOG statement will apply to the\nspecified master. connection_name is case-insensitive.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/show-relaylog-events/','','https://mariadb.com/kb/en/show-relaylog-events/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (396,26,'SHOW SLAVE HOSTS','Syntax\n------ \nSHOW SLAVE HOSTS\n \nDescription\n----------- \nThis command is run on the master and displays a list of\nreplication slaves that are currently registered with it.\nOnly slaves started with the --report-host=host_name option\nare visible in this list.\n \nThe list is displayed on any server (not just the master\nserver). The output\nlooks like this:\n \nSHOW SLAVE HOSTS;\n+------------+-----------+------+-----------+\n| Server_id | Host | Port | Master_id |\n+------------+-----------+------+-----------+\n| 192168010 | iconnect2 | 3306 | 192168011 |\n| 1921680101 | athena | 3306 | 192168011 |\n+------------+-----------+------+-----------+\nServer_id: The unique server ID of the slave server, as\nconfigured in the server\'s option file, or on the command\nline with --server-id=value.\nHost: The host name of the slave server, as configured in\nthe server\'s option file, or on the command line with\n--report-host=host_name. Note that this can differ from the\nmachine name as configured in the operating system.\nPort: The port the slave server is listening on.\nMaster_id: The unique server ID of the master server that\nthe slave server is replicating from.\n \nSome MariaDB and MySQL versions report another variable,\nrpl_recovery_rank. This\nvariable was never used, and was eventually removed in\nMariaDB 10.1.2 and MySQL 5.6.\n \n\n\nURL: https://mariadb.com/kb/en/show-slave-hosts/','','https://mariadb.com/kb/en/show-slave-hosts/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (397,26,'SHOW SLAVE STATUS','Syntax\n------ \nSHOW SLAVE [\"connection_name\"] STATUS\n \nor\n \nSHOW ALL SLAVES STATUS\n \nDescription\n----------- \nThis statement is to be run on a slave and provides status\ninformation on essential parameters of the replication slave\nthreads.\n \nThis statement requires the SUPER or the REPLICATION_CLIENT\nprivilege.\n \nMulti-source\n \nMariaDB 10.0 introduced the FULL and \"connection_name\"\noptions to\nallow you to connect to many masters at the same time.\n \nALL SLAVES gives you a list of all connections to the\nmaster.\n \nThe rows will be sorted according to Connection_name.\n \nIf you specify a connection_name, you only get the\ninformation about that\nconnection. If connection_name is not used, then the name\nset by default_master_connection is used. If the connection\nname doesn\'t exist you will get an error:\nThere is no master connection for \'xxx\'.\n \nColumn descriptions\n \nName | Description | Added | \n \nConnection_name | Name of the master connection. Returned\nwith SHOW ALL SLAVES STATUS only. | MariaDB 10.0 | \n \nSlave_SQL_State | State of SQL thread. Returned with SHOW\nALL SLAVES STATUS only. See Slave SQL Thread States. |\nMariaDB 10.0 | \n \nSlave_IO_State | State of I/O thread. See Slave I/O Thread\nStates. | MariaDB 10.0 | \n \nMaster_host | Master host that the slave is connected to. | \n| \n \nMaster_user | Account user name being used to connect to the\nmaster. | | \n \nMaster_port | The port being used to connect to the master.\n| | \n \nConnect_Retry | Time in seconds between retries to connect.\nThe default is 60. The CHANGE MASTER TO statement can set\nthis. The master-retry-count option determines the maximum\nnumber of reconnection attempts. | | \n \nMaster_Log_File | Name of the master binary log file that\nthe I/O thread is currently reading from. | | \n \nRead_Master_Log_Pos | Position up to which the I/O thread\nhas read in the current master binary log file. | | \n \nRelay_Log_File | Name of the relay log file that the SQL\nthread is currently processing. | | \n \nRelay_Log_Pos | Position up to which the SQL thread has\nfinished processing in the current relay log file. | | \n \nRelay_Master_Log_File | Name of the master binary log file\nthat contains the most recent event executed by the SQL\nthread. | | \n \nSlave_IO_Running | Whether the slave I/O thread is running\nand connected (Yes), running but not connected to a master\n(Connecting) or not running (No). | | \n \nSlave_SQL_Running | Whether or not the SQL thread is\nrunning. | | \n \nReplicate_Do_DB | Databases specified for replicating with\nthe replicate_do_db option. | | \n \nReplicate_Ignore_DB | Databases specified for ignoring with\nthe replicate_ignore_db option. | | \n \nReplicate_Do_Table | Tables specified for replicating with\nthe replicate_do_table option. | | \n \nReplicate_Ignore_Table | Tables specified for ignoring with\nthe replicate_ignore_table option. | | \n \nReplicate_Wild_Do_Table | Tables specified for replicating\nwith the replicate_wild_do_table option. | | \n \nReplicate_Wild_Ignore_Table | Tables specified for ignoring\nwith the replicate_wild_ignore_table option. | | \n \nLast_Errno | Alias for Last_SQL_Errno (see below) | | \n \nLast Error | Alias for Last_SQL_Error (see below) | | \n \nSkip_Counter | Number of events that a slave skips from the\nmaster, as recorded in the sql_slave_skip_counter system\nvariable. | | \n \nExec_Master_Log_Pos | Position up to which the SQL thread\nhas processed in the current master binary log file. Can be\nused to start a new slave from a current slave with the\nCHANGE MASTER TO ... MASTER_LOG_POS option. | | \n \nRelay_Log_Space | Total size of all relay log files\ncombined. | | \n \nUntil_Condition | | | \n \nUntil_Log_File | The MASTER_LOG_FILE value of the START\nSLAVE UNTIL condition. | | \n \nUntil_Log_Pos | The MASTER_LOG_POS value of the START SLAVE\nUNTIL condition. | | \n \nMaster_SSL_Allowed | Whether an SSL connection is permitted\n(Yes), not permitted (No) or permitted but without the slave\nhaving SSL support enabled (Ignored) | | \n \nMaster_SSL_CA_File | The MASTER_SSL_CA option of the CHANGE\nMASTER TO statement. | | \n \nMaster_SSL_CA_Path | The MASTER_SSL_CAPATH option of the\nCHANGE MASTER TO statement. | | \n \nMaster_SSL_Cert | The MASTER_SSL_CERT option of the CHANGE\nMASTER TO statement. | | \n \nMaster_SSL_Cipher | The MASTER_SSL_CIPHER option of the\nCHANGE MASTER TO statement. | | \n \nMaster_SSL_Key | The MASTER_SSL_KEY option of the CHANGE\nMASTER TO statement. | | \n \nSeconds_Behind_Master | Difference between the timestamp\nlogged on the master for the event that the slave is\ncurrently processing, and the current timestamp on the\nslave. Zero if the slave is not currently processing an\nevent. From MariaDB 10.0.23 and MariaDB 10.1.9, with\nparallel replication, seconds_behind_master is updated only\nafter transactions commit. | | \n \nMaster_SSL_Verify_Server_Cert | The\nMASTER_SSL_VERIFY_SERVER_CERT option of the CHANGE MASTER TO\nstatement. | | \n \nLast_IO_Errno | Error code of the most recent error that\ncaused the I/O thread to stop (also recorded in the slave\'s\nerror log). 0 means no error. RESET SLAVE or RESET MASTER\nwill reset this value. | | \n \nLast_IO_Error | Error message of the most recent error that\ncaused the I/O thread to stop (also recorded in the slave\'s\nerror log). An empty string means no error. RESET SLAVE or\nRESET MASTER will reset this value. | | \n \nLast_SQL_Errno | Error code of the most recent error that\ncaused the SQL thread to stop (also recorded in the slave\'s\nerror log). 0 means no error. RESET SLAVE or RESET MASTER\nwill reset this value. | | \n \nLast_SQL_Error | Error message of the most recent error that\ncaused the SQL thread to stop (also recorded in the slave\'s\nerror log). An empty string means no error. RESET SLAVE or\nRESET MASTER will reset this value. | | \n \nReplicate_Ignore_Server_Ids | List of server_ids that are\ncurrently being ignored for replication purposes, or an\nempty string for none, as specified in the IGNORE_SERVER_IDS\noption of the CHANGE MASTER TO statement. | | \n \nMaster_Server_Id | The master\'s server_id value. | | \n \nMaster_SSL_Crl | The MASTER_SSL_CRL option of the CHANGE\nMASTER TO statement. | MariaDB 10.0 | \n \nMaster_SSL_Crlpath | The MASTER_SSL_CRLPATH option of the\nCHANGE MASTER TO statement. | MariaDB 10.0 | \n \nUsing_Gtid | Whether or not global transaction ID\'s are\nbeing used for replication (can be No, Slave_Pos, or\nCurrent_Pos). | MariaDB 10.0.2 | \n \nGtid_IO_Pos | Current global transaction ID value. | MariaDB\n10.0.2 | \n \nRetried_transactions | Number of retried transactions for\nthis connection. Returned with SHOW ALL SLAVES STATUS only.\n| MariaDB 10.0 | \n \nMax_relay_log_size | Max relay log size for this connection.\nReturned with SHOW ALL SLAVES STATUS only. | MariaDB 10.0 | \n \nExecuted_log_entries | How many log entries the slave has\nexecuted. Returned with SHOW ALL SLAVES STATUS only. |\nMariaDB 10.0 | \n \nSlave_received_heartbeats | How many heartbeats we have got\nfrom the master. Returned with SHOW ALL SLAVES STATUS only.\n| MariaDB 10.0 | \n \nSlave_heartbeat_period | How often to request a heartbeat\npacket from the master (in seconds). Returned with SHOW ALL\nSLAVES STATUS only. | MariaDB 10.0 | \n \nGtid_Slave_Pos | GTID of the last event group replicated on\na slave server, for each replication domain, as stored in\nthe gtid_slave_pos system variable. Returned with SHOW ALL\nSLAVES STATUS only. | MariaDB 10.0 | \n \nSQL_Delay | Value specified by MASTER_DELAY in CHANGE MASTER\n(or 0 if none). | MariaDB 10.2.3 | \n \nSQL_Remaining_Delay | When the slave is delaying the\nexecution of an event due to MASTER_DELAY, this is the\nnumber of seconds of delay remaining before the event will\nbe applied. Otherwise, the value is NULL. | MariaDB 10.2.3 |\n\n \nSlave_SQL_Running_State | The state of the SQL driver\nthreads, same as in SHOW PROCESSLIST. When the slave is\ndelaying the execution of an event due to MASTER_DELAY, this\nfield displays: \"Waiting until MASTER_DELAY seconds after\nmaster executed event\". | MariaDB 10.2.3 | \n \nSlave_DDL_Groups | This status variable counts the\noccurrence of DDL statements. This is a slave-side counter\nfor optimistic parallel replication. | MariaDB 10.3.7 | \n \nSlave_Non_Transactional_Groups | This status variable counts\nthe occurrence of non-transactional event groups. This is a\nslave-side counter for optimistic parallel replication. |\nMariaDB 10.3.7 | \n \nSlave_Transactional_Groups | This status variable counts the\noccurrence of transactional event groups. This is a\nslave-side counter for optimistic parallel replication. |\nMariaDB 10.3.7 | \n \nExamples\n-------- \nIf you issue this statement using the mysql client,\nyou can use a \\G statement terminator rather than a\nsemicolon to\nobtain a more readable vertical layout.\n \nSHOW SLAVE STATUS\\G\n*************************** 1. row\n***************************\n Slave_IO_State: Waiting for master to send event\n Master_Host: db01.example.com\n Master_User: replicant\n Master_Port: 3306\n Connect_Retry: 60\n Master_Log_File: mariadb-bin.000010\n Read_Master_Log_Pos: 548\n Relay_Log_File: relay-bin.000004\n Relay_Log_Pos: 837\n Relay_Master_Log_File: mariadb-bin.000010\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: 548\n Relay_Log_Space: 1497\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: 0\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: \n Master_Server_Id: 101\n Master_SSL_Crl: \n Master_SSL_Crlpath: \n Using_Gtid: No\n Gtid_IO_Pos: \n \nMariaDB [(none)]> SHOW ALL SLAVES STATUS\\G\n*************************** 1. row\n***************************\n Connection_name: \n Slave_SQL_State: Slave has read all relay log; waiting for\nthe slave I/O thread to update it\n Slave_IO_State: Waiting for master to send event\n Master_Host: db01.example.com\n Master_User: replicant\n Master_Port: 3306\n Connect_Retry: 60\n Master_Log_File: mariadb-bin.000010\n Read_Master_Log_Pos: 3608\n Relay_Log_File: relay-bin.000004\n Relay_Log_Pos: 3897\n Relay_Master_Log_File: mariadb-bin.000010\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: 3608\n Relay_Log_Space: 4557\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: 0\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: \n Master_Server_Id: 101\n Master_SSL_Crl: \n Master_SSL_Crlpath: \n Using_Gtid: No\n Gtid_IO_Pos:\n Retried_transactions: 0\n Max_relay_log_size: 104857600\n Executed_log_entries: 40\n Slave_received_heartbeats: 11\n Slave_heartbeat_period: 1800.000\n Gtid_Slave_Pos: 0-101-2320\n \nYou can also access some of the variables directly from\nstatus variables:\n \nSET @@default_master_connection=\"test\" ;\nshow status like \"%slave%\"\n \nVariable_name Value\nCom_show_slave_hosts 0\nCom_show_slave_status 0\nCom_start_all_slaves 0\nCom_start_slave 0\nCom_stop_all_slaves 0\nCom_stop_slave 0\nRpl_semi_sync_slave_status OFF\nSlave_connections 0\nSlave_heartbeat_period 1800.000\nSlave_open_temp_tables 0\nSlave_received_heartbeats 0\nSlave_retried_transactions 0\nSlave_running OFF\nSlaves_connected 0\nSlaves_running 1\n \n\n\nURL: https://mariadb.com/kb/en/show-slave-status/','','https://mariadb.com/kb/en/show-slave-status/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (398,26,'SHOW STATUS','Syntax\n------ \nSHOW [GLOBAL | SESSION] STATUS\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \nSHOW STATUS provides server status information. This\ninformation also can be obtained using the mysqladmin\nextended-status command, or by querying the Information\nSchema GLOBAL_STATUS and SESSION_STATUS tables.\nThe LIKE clause, if present, indicates which variable names\nto match. The WHERE clause can be given to select rows using\nmore general conditions.\n \nWith the GLOBAL modifier, SHOW STATUS\ndisplays the status values for all connections to MariaDB.\nWith\nSESSION, it displays the status values\nfor the current connection. If no modifier is present, the\ndefault is\n SESSION. LOCAL is a synonym for\n SESSION. If you see a lot of 0 values, the reason is\nprobably that you have used SHOW STATUS with a new\nconnection instead of SHOW GLOBAL STATUS.\n \nSome status variables have only a global value. For these,\nyou get the\nsame value for both GLOBAL and SESSION.\n \nSee Server Status Variables for a full list, scope and\ndescription of the variables that can be viewed with SHOW\nSTATUS.\n \nThe LIKE clause, if present on its own, indicates which\nvariable name to match.\n \nThe WHERE and LIKE clauses can be given to select rows using\nmore general conditions, as discussed in Extended SHOW.\n \nExamples\n-------- \nFull output from MariaDB 10.1.17:\n \nSHOW GLOBAL STATUS;\n \n+--------------------------------------------------------------+----------------------------------------+\n| Variable_name | Value |\n+--------------------------------------------------------------+----------------------------------------+\n| Aborted_clients | 0 |\n| Aborted_connects | 0 |\n| Access_denied_errors | 0 |\n| Acl_column_grants | 0 |\n| Acl_database_grants | 2 |\n| Acl_function_grants | 0 |\n| Acl_procedure_grants | 0 |\n| Acl_proxy_users | 2 |\n| Acl_role_grants | 0 |\n| Acl_roles | 0 |\n| Acl_table_grants | 0 |\n| Acl_users | 6 |\n| Aria_pagecache_blocks_not_flushed | 0 |\n| Aria_pagecache_blocks_unused | 15706 |\n| Aria_pagecache_blocks_used | 0 |\n| Aria_pagecache_read_requests | 0 |\n| Aria_pagecache_reads | 0 |\n| Aria_pagecache_write_requests | 0 |\n| Aria_pagecache_writes | 0 |\n| Aria_transaction_log_syncs | 0 |\n| Binlog_commits | 0 |\n| Binlog_group_commits | 0 |\n| Binlog_group_commit_trigger_count | 0 |\n| Binlog_group_commit_trigger_lock_wait | 0 |\n| Binlog_group_commit_trigger_timeout | 0 |\n| Binlog_snapshot_file | |\n| Binlog_snapshot_position | 0 |\n| Binlog_bytes_written | 0 |\n| Binlog_cache_disk_use | 0 |\n| Binlog_cache_use | 0 |\n| Binlog_stmt_cache_disk_use | 0 |\n| Binlog_stmt_cache_use | 0 |\n| Busy_time | 0.000000 |\n| Bytes_received | 432 |\n| Bytes_sent | 15183 |\n| Com_admin_commands | 1 |\n| Com_alter_db | 0 |\n| Com_alter_db_upgrade | 0 |\n| Com_alter_event | 0 |\n| Com_alter_function | 0 |\n| Com_alter_procedure | 0 |\n| Com_alter_server | 0 |\n| Com_alter_table | 0 |\n| Com_alter_tablespace | 0 |\n| Com_analyze | 0 |\n| Com_assign_to_keycache | 0 |\n| Com_begin | 0 |\n| Com_binlog | 0 |\n| Com_call_procedure | 0 |\n| Com_change_db | 0 |\n| Com_change_master | 0 |\n| Com_check | 0 |\n| Com_checksum | 0 |\n| Com_commit | 0 |\n| Com_compound_sql | 0 |\n| Com_create_db | 0 |\n| Com_create_event | 0 |\n| Com_create_function | 0 |\n| Com_create_index | 0 |\n| Com_create_procedure | 0 |\n| Com_create_role | 0 |\n| Com_create_server | 0 |\n| Com_create_table | 0 |\n| Com_create_temporary_table | 0 |\n| Com_create_trigger | 0 |\n| Com_create_udf | 0 |\n| Com_create_user | 0 |\n| Com_create_view | 0 |\n| Com_dealloc_sql | 0 |\n| Com_delete | 0 |\n| Com_delete_multi | 0 |\n| Com_do | 0 |\n| Com_drop_db | 0 |\n| Com_drop_event | 0 |\n| Com_drop_function | 0 |\n| Com_drop_index | 0 |\n| Com_drop_procedure | 0 |\n| Com_drop_role | 0 |\n| Com_drop_server | 0 |\n| Com_drop_table | 0 |\n| Com_drop_temporary_table | 0 |\n| Com_drop_trigger | 0 |\n| Com_drop_user | 0 |\n| Com_drop_view | 0 |\n| Com_empty_query | 0 |\n| Com_execute_sql | 0 |\n| Com_flush | 0 |\n| Com_get_diagnostics | 0 |\n| Com_grant | 0 |\n| Com_grant_role | 0 |\n| Com_ha_close | 0 |\n| Com_ha_open | 0 |\n| Com_ha_read | 0 |\n| Com_help | 0 |\n| Com_insert | 0 |\n| Com_insert_select | 0 |\n| Com_install_plugin | 0 |\n| Com_kill | 0 |\n| Com_load | 0 |\n| Com_lock_tables | 0 |\n| Com_optimize | 0 |\n| Com_preload_keys | 0 |\n| Com_prepare_sql | 0 |\n| Com_purge | 0 |\n| Com_purge_before_date | 0 |\n| Com_release_savepoint | 0 |\n| Com_rename_table | 0 |\n| Com_rename_user | 0 |\n| Com_repair | 0 |\n| Com_replace | 0 |\n| Com_replace_select | 0 |\n| Com_reset | 0 |\n| Com_resignal | 0 |\n| Com_revoke | 0 |\n| Com_revoke_all | 0 |\n| Com_revoke_role | 0 |\n| Com_rollback | 0 |\n| Com_rollback_to_savepoint | 0 |\n| Com_savepoint | 0 |\n| Com_select | 1 |\n| Com_set_option | 0 |\n| Com_show_authors | 0 |\n| Com_show_binlog_events | 0 |\n| Com_show_binlogs | 0 |\n| Com_show_charsets | 0 |\n| Com_show_collations | 0 |\n| Com_show_contributors | 0 |\n| Com_show_create_db | 0 |\n| Com_show_create_event | 0 |\n| Com_show_create_func | 0 |\n| Com_show_create_proc | 0 |\n| Com_show_create_table | 0 |\n| Com_show_create_trigger | 0 |\n| Com_show_databases | 0 |\n| Com_show_engine_logs | 0 |\n| Com_show_engine_mutex | 0 |\n| Com_show_engine_status | 0 |\n| Com_show_errors | 0 |\n| Com_show_events | 0 |\n| Com_show_explain | 0 |\n| Com_show_fields | 0 |\n| Com_show_function_status | 0 |\n| Com_show_generic | 0 |\n| Com_show_grants | 0 |\n| Com_show_keys | 0 |\n| Com_show_master_status | 0 |\n| Com_show_open_tables | 0 |\n| Com_show_plugins | 0 |\n| Com_show_privileges | 0 |\n| Com_show_procedure_status | 0 |\n| Com_show_processlist | 0 |\n| Com_show_profile | 0 |\n| Com_show_profiles | 0 |\n| Com_show_relaylog_events | 0 |\n| Com_show_slave_hosts | 0 |\n| Com_show_slave_status | 0 |\n| Com_show_status | 2 |\n| Com_show_storage_engines | 0 |\n| Com_show_table_status | 0 |\n| Com_show_tables | 0 |\n| Com_show_triggers | 0 |\n| Com_show_variables | 0 |\n| Com_show_warnings | 0 |\n| Com_shutdown | 0 |\n| Com_signal | 0 |\n| Com_start_all_slaves | 0 |\n| Com_start_slave | 0 |\n| Com_stmt_close | 0 |\n| Com_stmt_execute | 0 |\n| Com_stmt_fetch | 0 |\n| Com_stmt_prepare | 0 |\n| Com_stmt_reprepare | 0 |\n| Com_stmt_reset | 0 |\n| Com_stmt_send_long_data | 0 |\n| Com_stop_all_slaves | 0 |\n| Com_stop_slave | 0 |\n| Com_truncate | 0 |\n| Com_uninstall_plugin | 0 |\n| Com_unlock_tables | 0 |\n| Com_update | 0 |\n| Com_update_multi | 0 |\n| Com_xa_commit | 0 |\n| Com_xa_end | 0 |\n| Com_xa_prepare | 0 |\n| Com_xa_recover | 0 |\n| Com_xa_rollback | 0 |\n| Com_xa_start | 0 |\n| Compression | OFF |\n| Connection_errors_accept | 0 |\n| Connection_errors_internal | 0 |\n| Connection_errors_max_connections | 0 |\n| Connection_errors_peer_address | 0 |\n| Connection_errors_select | 0 |\n| Connection_errors_tcpwrap | 0 |\n| Connections | 4 |\n| Cpu_time | 0.000000 |\n| Created_tmp_disk_tables | 0 |\n| Created_tmp_files | 6 |\n| Created_tmp_tables | 2 |\n| Delayed_errors | 0 |\n| Delayed_insert_threads | 0 |\n| Delayed_writes | 0 |\n| Delete_scan | 0 |\n| Empty_queries | 0 |\n| Executed_events | 0 |\n| Executed_triggers | 0 |\n| Feature_delay_key_write | 0 |\n| Feature_dynamic_columns | 0 |\n| Feature_fulltext | 0 |\n| Feature_gis | 0 |\n| Feature_locale | 0 |\n| Feature_subquery | 0 |\n| Feature_timezone | 0 |\n| Feature_trigger | 0 |\n| Feature_xml | 0 |\n| Flush_commands | 1 |\n| Handler_commit | 1 |\n| Handler_delete | 0 |\n| Handler_discover | 0 |\n| Handler_external_lock | 0 |\n| Handler_icp_attempts | 0 |\n| Handler_icp_match | 0 |\n| Handler_mrr_init | 0 |\n| Handler_mrr_key_refills | 0 |\n| Handler_mrr_rowid_refills | 0 |\n| Handler_prepare | 0 |\n| Handler_read_first | 3 |\n| Handler_read_key | 0 |\n| Handler_read_last | 0 |\n| Handler_read_next | 0 |\n| Handler_read_prev | 0 |\n| Handler_read_retry | 0 |\n| Handler_read_rnd | 0 |\n| Handler_read_rnd_deleted | 0 |\n| Handler_read_rnd_next | 537 |\n| Handler_rollback | 0 |\n| Handler_savepoint | 0 |\n| Handler_savepoint_rollback | 0 |\n| Handler_tmp_update | 0 |\n| Handler_tmp_write | 516 |\n| Handler_update | 0 |\n| Handler_write | 0 |\n| Innodb_available_undo_logs | 128 |\n| Innodb_background_log_sync | 222 |\n| Innodb_buffer_pool_bytes_data | 2523136 |\n| Innodb_buffer_pool_bytes_dirty | 0 |\n| Innodb_buffer_pool_dump_status | Dumping buffer pool(s)\nnot yet started |\n| Innodb_buffer_pool_load_status | Loading buffer pool(s)\nnot yet started |\n| Innodb_buffer_pool_pages_data | 154 |\n| Innodb_buffer_pool_pages_dirty | 0 |\n| Innodb_buffer_pool_pages_flushed | 1 |\n| Innodb_buffer_pool_pages_free | 8037 |\n| Innodb_buffer_pool_pages_lru_flushed | 0 |\n| Innodb_buffer_pool_pages_made_not_young | 0 |\n| Innodb_buffer_pool_pages_made_young | 0 |\n| Innodb_buffer_pool_pages_misc | 0 |\n| Innodb_buffer_pool_pages_old | 0 |\n| Innodb_buffer_pool_pages_total | 8191 |\n| Innodb_buffer_pool_read_ahead | 0 |\n| Innodb_buffer_pool_read_ahead_evicted | 0 |\n| Innodb_buffer_pool_read_ahead_rnd | 0 |\n| Innodb_buffer_pool_read_requests | 558 |\n| Innodb_buffer_pool_reads | 155 |\n| Innodb_buffer_pool_wait_free | 0 |\n| Innodb_buffer_pool_write_requests | 1 |\n| Innodb_checkpoint_age | 0 |\n| Innodb_checkpoint_max_age | 80826164 |\n| Innodb_data_fsyncs | 5 |\n| Innodb_data_pending_fsyncs | 0 |\n| Innodb_data_pending_reads | 0 |\n| Innodb_data_pending_writes | 0 |\n| Innodb_data_read | 2609664 |\n| Innodb_data_reads | 172 |\n| Innodb_data_writes | 5 |\n| Innodb_data_written | 34304 |\n| Innodb_dblwr_pages_written | 1 |\n| Innodb_dblwr_writes | 1 |\n| Innodb_deadlocks | 0 |\n| Innodb_have_atomic_builtins | ON |\n| Innodb_history_list_length | 0 |\n| Innodb_ibuf_discarded_delete_marks | 0 |\n| Innodb_ibuf_discarded_deletes | 0 |\n| Innodb_ibuf_discarded_inserts | 0 |\n| Innodb_ibuf_free_list | 0 |\n| Innodb_ibuf_merged_delete_marks | 0 |\n| Innodb_ibuf_merged_deletes | 0 |\n| Innodb_ibuf_merged_inserts | 0 |\n| Innodb_ibuf_merges | 0 |\n| Innodb_ibuf_segment_size | 2 |\n| Innodb_ibuf_size | 1 |\n| Innodb_log_waits | 0 |\n| Innodb_log_write_requests | 0 |\n| Innodb_log_writes | 1 |\n| Innodb_lsn_current | 1616829 |\n| Innodb_lsn_flushed | 1616829 |\n| Innodb_lsn_last_checkpoint | 1616829 |\n| Innodb_master_thread_active_loops | 0 |\n| Innodb_master_thread_idle_loops | 222 |\n| Innodb_max_trx_id | 2308 |\n| Innodb_mem_adaptive_hash | 2217568 |\n| Innodb_mem_dictionary | 630703 |\n| Innodb_mem_total | 140771328 |\n| Innodb_mutex_os_waits | 1 |\n| Innodb_mutex_spin_rounds | 30 |\n| Innodb_mutex_spin_waits | 1 |\n| Innodb_oldest_view_low_limit_trx_id | 0 |\n| Innodb_os_log_fsyncs | 3 |\n| Innodb_os_log_pending_fsyncs | 0 |\n| Innodb_os_log_pending_writes | 0 |\n| Innodb_os_log_written | 512 |\n| Innodb_page_size | 16384 |\n| Innodb_pages_created | 0 |\n| Innodb_pages_read | 154 |\n| Innodb_pages_written | 1 |\n| Innodb_purge_trx_id | 0 |\n| Innodb_purge_undo_no | 0 |\n| Innodb_read_views_memory | 88 |\n| Innodb_row_lock_current_waits | 0 |\n| Innodb_row_lock_time | 0 |\n| Innodb_row_lock_time_avg | 0 |\n| Innodb_row_lock_time_max | 0 |\n| Innodb_row_lock_waits | 0 |\n| Innodb_rows_deleted | 0 |\n| Innodb_rows_inserted | 0 |\n| Innodb_rows_read | 0 |\n| Innodb_rows_updated | 0 |\n| Innodb_system_rows_deleted | 0 |\n| Innodb_system_rows_inserted | 0 |\n| Innodb_system_rows_read | 0 |\n| Innodb_system_rows_updated | 0 |\n| Innodb_s_lock_os_waits | 2 |\n| Innodb_s_lock_spin_rounds | 60 |\n| Innodb_s_lock_spin_waits | 2 |\n| Innodb_truncated_status_writes | 0 |\n| Innodb_x_lock_os_waits | 0 |\n| Innodb_x_lock_spin_rounds | 0 |\n| Innodb_x_lock_spin_waits | 0 |\n| Innodb_page_compression_saved | 0 |\n| Innodb_page_compression_trim_sect512 | 0 |\n| Innodb_page_compression_trim_sect1024 | 0 |\n| Innodb_page_compression_trim_sect2048 | 0 |\n| Innodb_page_compression_trim_sect4096 | 0 |\n| Innodb_page_compression_trim_sect8192 | 0 |\n| Innodb_page_compression_trim_sect16384 | 0 |\n| Innodb_page_compression_trim_sect32768 | 0 |\n| Innodb_num_index_pages_written | 0 |\n| Innodb_num_non_index_pages_written | 5 |\n| Innodb_num_pages_page_compressed | 0 |\n| Innodb_num_page_compressed_trim_op | 0 |\n| Innodb_num_page_compressed_trim_op_saved | 0 |\n| Innodb_num_pages_page_decompressed | 0 |\n| Innodb_num_pages_page_compression_error | 0 |\n| Innodb_num_pages_encrypted | 0 |\n| Innodb_num_pages_decrypted | 0 |\n| Innodb_have_lz4 | OFF |\n| Innodb_have_lzo | OFF |\n| Innodb_have_lzma | OFF |\n| Innodb_have_bzip2 | OFF |\n| Innodb_have_snappy | OFF |\n| Innodb_defragment_compression_failures | 0 |\n| Innodb_defragment_failures | 0 |\n| Innodb_defragment_count | 0 |\n| Innodb_onlineddl_rowlog_rows | 0 |\n| Innodb_onlineddl_rowlog_pct_used | 0 |\n| Innodb_onlineddl_pct_progress | 0 |\n| Innodb_secondary_index_triggered_cluster_reads | 0 |\n| Innodb_secondary_index_triggered_cluster_reads_avoided | 0\n|\n| Innodb_encryption_rotation_pages_read_from_cache | 0 |\n| Innodb_encryption_rotation_pages_read_from_disk | 0 |\n| Innodb_encryption_rotation_pages_modified | 0 |\n| Innodb_encryption_rotation_pages_flushed | 0 |\n| Innodb_encryption_rotation_estimated_iops | 0 |\n| Innodb_scrub_background_page_reorganizations | 0 |\n| Innodb_scrub_background_page_splits | 0 |\n| Innodb_scrub_background_page_split_failures_underflow | 0\n|\n|\nInnodb_scrub_background_page_split_failures_out_of_filespace\n| 0 |\n| Innodb_scrub_background_page_split_failures_missing_index\n| 0 |\n| Innodb_scrub_background_page_split_failures_unknown | 0 |\n| Key_blocks_not_flushed | 0 |\n| Key_blocks_unused | 107163 |\n| Key_blocks_used | 0 |\n| Key_blocks_warm | 0 |\n| Key_read_requests | 0 |\n| Key_reads | 0 |\n| Key_write_requests | 0 |\n| Key_writes | 0 |\n| Last_query_cost | 0.000000 |\n| Master_gtid_wait_count | 0 |\n| Master_gtid_wait_time | 0 |\n| Master_gtid_wait_timeouts | 0 |\n| Max_statement_time_exceeded | 0 |\n| Max_used_connections | 1 |\n| Memory_used | 273614696 |\n| Not_flushed_delayed_rows | 0 |\n| Open_files | 25 |\n| Open_streams | 0 |\n| Open_table_definitions | 18 |\n| Open_tables | 11 |\n| Opened_files | 77 |\n| Opened_plugin_libraries | 0 |\n| Opened_table_definitions | 18 |\n| Opened_tables | 18 |\n| Opened_views | 0 |\n| Performance_schema_accounts_lost | 0 |\n| Performance_schema_cond_classes_lost | 0 |\n| Performance_schema_cond_instances_lost | 0 |\n| Performance_schema_digest_lost | 0 |\n| Performance_schema_file_classes_lost | 0 |\n| Performance_schema_file_handles_lost | 0 |\n| Performance_schema_file_instances_lost | 0 |\n| Performance_schema_hosts_lost | 0 |\n| Performance_schema_locker_lost | 0 |\n| Performance_schema_mutex_classes_lost | 0 |\n| Performance_schema_mutex_instances_lost | 0 |\n| Performance_schema_rwlock_classes_lost | 0 |\n| Performance_schema_rwlock_instances_lost | 0 |\n| Performance_schema_session_connect_attrs_lost | 0 |\n| Performance_schema_socket_classes_lost | 0 |\n| Performance_schema_socket_instances_lost | 0 |\n| Performance_schema_stage_classes_lost | 0 |\n| Performance_schema_statement_classes_lost | 0 |\n| Performance_schema_table_handles_lost | 0 |\n| Performance_schema_table_instances_lost | 0 |\n| Performance_schema_thread_classes_lost | 0 |\n| Performance_schema_thread_instances_lost | 0 |\n| Performance_schema_users_lost | 0 |\n| Prepared_stmt_count | 0 |\n| Qcache_free_blocks | 1 |\n| Qcache_free_memory | 1031336 |\n| Qcache_hits | 0 |\n| Qcache_inserts | 0 |\n| Qcache_lowmem_prunes | 0 |\n| Qcache_not_cached | 0 |\n| Qcache_queries_in_cache | 0 |\n| Qcache_total_blocks | 1 |\n| Queries | 4 |\n| Questions | 4 |\n| Rows_read | 10 |\n| Rows_sent | 517 |\n| Rows_tmp_read | 516 |\n| Rpl_status | AUTH_MASTER |\n| Select_full_join | 0 |\n| Select_full_range_join | 0 |\n| Select_range | 0 |\n| Select_range_check | 0 |\n| Select_scan | 2 |\n| Slave_connections | 0 |\n| Slave_heartbeat_period | 0.000 |\n| Slave_open_temp_tables | 0 |\n| Slave_received_heartbeats | 0 |\n| Slave_retried_transactions | 0 |\n| Slave_running | OFF |\n| Slave_skipped_errors | 0 |\n| Slaves_connected | 0 |\n| Slaves_running | 0 |\n| Slow_launch_threads | 0 |\n| Slow_queries | 0 |\n| Sort_merge_passes | 0 |\n| Sort_priority_queue_sorts | 0 |\n| Sort_range | 0 |\n| Sort_rows | 0 |\n| Sort_scan | 0 |\n| Ssl_accept_renegotiates | 0 |\n| Ssl_accepts | 0 |\n| Ssl_callback_cache_hits | 0 |\n| Ssl_cipher | |\n| Ssl_cipher_list | |\n| Ssl_client_connects | 0 |\n| Ssl_connect_renegotiates | 0 |\n| Ssl_ctx_verify_depth | 0 |\n| Ssl_ctx_verify_mode | 0 |\n| Ssl_default_timeout | 0 |\n| Ssl_finished_accepts | 0 |\n| Ssl_finished_connects | 0 |\n| Ssl_server_not_after | |\n| Ssl_server_not_before | |\n| Ssl_session_cache_hits | 0 |\n| Ssl_session_cache_misses | 0 |\n| Ssl_session_cache_mode | NONE |\n| Ssl_session_cache_overflows | 0 |\n| Ssl_session_cache_size | 0 |\n| Ssl_session_cache_timeouts | 0 |\n| Ssl_sessions_reused | 0 |\n| Ssl_used_session_cache_entries | 0 |\n| Ssl_verify_depth | 0 |\n| Ssl_verify_mode | 0 |\n| Ssl_version | |\n| Subquery_cache_hit | 0 |\n| Subquery_cache_miss | 0 |\n| Syncs | 2 |\n| Table_locks_immediate | 21 |\n| Table_locks_waited | 0 |\n| Tc_log_max_pages_used | 0 |\n| Tc_log_page_size | 4096 |\n| Tc_log_page_waits | 0 |\n| Threadpool_idle_threads | 0 |\n| Threadpool_threads | 0 |\n| Threads_cached | 0 |\n| Threads_connected | 1 |\n| Threads_created | 2 |\n| Threads_running | 1 |\n| Update_scan | 0 |\n| Uptime | 223 |\n| Uptime_since_flush_status | 223 |\n| wsrep_cluster_conf_id | 18446744073709551615 |\n| wsrep_cluster_size | 0 |\n| wsrep_cluster_state_uuid | |\n| wsrep_cluster_status | Disconnected |\n| wsrep_connected | OFF |\n| wsrep_local_bf_aborts | 0 |\n| wsrep_local_index | 18446744073709551615 |\n| wsrep_provider_name | |\n| wsrep_provider_vendor | |\n| wsrep_provider_version | |\n| wsrep_ready | OFF |\n| wsrep_thread_count | 0 |\n+--------------------------------------------------------------+----------------------------------------+\n516 rows in set (0.00 sec)\n \nExample of filtered output:\n \nSHOW STATUS LIKE \'Key%\';\n \n+------------------------+--------+\n| Variable_name | Value |\n+------------------------+--------+\n| Key_blocks_not_flushed | 0 |\n| Key_blocks_unused | 107163 |\n| Key_blocks_used | 0 |\n| Key_blocks_warm | 0 |\n| Key_read_requests | 0 |\n| Key_reads | 0 |\n| Key_write_requests | 0 |\n| Key_writes | 0 |\n+------------------------+--------+\n8 rows in set (0.00 sec)\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/show-status/','','https://mariadb.com/kb/en/show-status/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (399,26,'SHOW TABLE STATUS','Syntax\n------ \nSHOW TABLE STATUS [{FROM | IN} db_name]\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \n SHOW TABLE STATUS works like \n SHOW TABLES, but provides more extensive information about\neach non-TEMPORARY table.\n \nThe LIKE clause, if present on its own, indicates which\ntable names to\nmatch. The WHERE and LIKE clauses can be given to select\nrows using more general conditions, as discussed in Extended\nSHOW.\n \nThe following information is returned:\n \nColumn | Description | \n \nName | Table name. | \n \nEngine | Table storage engine. | \n \nVersion | Version number from the table\'s .frm file. | \n \nRow_format | Row format (see InnoDB, Aria and MyISAM row\nformats). | \n \nRows | Number of rows in the table. Some engines, such as\nXtraDB and InnoDB may store an estimate. | \n \nAvg_row_length | Average row length in the table. | \n \nData_length | For InnoDB/XtraDB, the index size, in pages,\nmultiplied by the page size. For Aria and MyISAM, length of\nthe data file, in bytes. For MEMORY, the approximate\nallocated memory. | \n \nMax_data_length | Maximum length of the data file, ie the\ntotal number of bytes that could be stored in the table. Not\nused in XtraDB and InnoDB. | \n \nIndex_length | Length of the index file. | \n \nData_free | Bytes allocated but unused. For InnoDB tables in\na shared tablespace, the free space of the shared tablespace\nwith small safety margin. An estimate in the case of\npartitioned tables - see the PARTITIONS table. | \n \nAuto_increment | Next AUTO_INCREMENT value. | \n \nCreate_time | Time the table was created. | \n \nUpdate_time | Time the table was last updated. On Windows,\nthe timestamp is not updated on update, so MyISAM values\nwill be inaccurate. In InnoDB, if shared tablespaces are\nused, will be NULL, while buffering can also delay the\nupdate, so the value will differ from the actual time of the\nlast UPDATE, INSERT or DELETE. | \n \nCheck_time | Time the table was last checked. Not kept by\nall storage engines, in which case will be NULL. | \n \nCollation | Character set and collation. | \n \nChecksum | Live checksum value, if any. | \n \nCreate_options | Extra CREATE TABLE options. | \n \nComment | Table comment provided when MariaDB created the\ntable. | \n \nSimilar information can be found in the\ninformation_schema.TABLES table as well as by using\nmysqlshow:\n \nmysqlshow --status db_name\n \nExample\n \nshow table status\\G\n*************************** 1. row\n***************************\n Name: bus_routes\n Engine: InnoDB\n Version: 10\n Row_format: Dynamic\n Rows: 5\n Avg_row_length: 3276\n Data_length: 16384\nMax_data_length: 0\n Index_length: 0\n Data_free: 0\n Auto_increment: NULL\n Create_time: 2017-05-24 11:17:46\n Update_time: NULL\n Check_time: NULL\n Collation: latin1_swedish_ci\n Checksum: NULL\n Create_options: \n Comment:\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/show-table-status/','','https://mariadb.com/kb/en/show-table-status/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (400,26,'SHOW TABLES','Syntax\n------ \nSHOW [FULL] TABLES [FROM db_name]\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \nSHOW TABLES lists the non-TEMPORARY tables, sequences and\nviews in a given database. \n \nThe LIKE clause, if present on its own, indicates which\ntable names to match. The WHERE and LIKE clauses can be\ngiven to select rows using more general conditions, as\ndiscussed in Extended SHOW. For example, when searching for\ntables in the test database, the column name for use in the\nWHERE and LIKE clauses will be Tables_in_test\n \nThe FULL modifier is supported such that SHOW FULL TABLES\ndisplays a second output column. Values for the second\ncolumn. Table_type, are BASE TABLE for a table, VIEW for a\nview and SEQUENCE for a sequence.\n \nYou can also get this information using:\n \nmysqlshow db_name\n \nSee mysqlshow for more details.\n \nIf you have no privileges for a base table or view, it does\nnot show up in the output from SHOW TABLES or mysqlshow\ndb_name.\n \nThe information_schema.TABLES table, as well as the SHOW\nTABLE STATUS statement, provide extended information about\ntables.\n \nExamples\n-------- \nSHOW TABLES;\n+----------------------+\n| Tables_in_test |\n+----------------------+\n| animal_count |\n| animals |\n| are_the_mooses_loose |\n| aria_test2 |\n| t1 |\n| view1 |\n+----------------------+\n \nShowing the tables beginning with a only.\n \nSHOW TABLES WHERE Tables_in_test LIKE \'a%\';\n+----------------------+\n| Tables_in_test |\n+----------------------+\n| animal_count |\n| animals |\n| are_the_mooses_loose |\n| aria_test2 |\n+----------------------+\n \nShowing tables and table types:\n \nSHOW FULL TABLES;\n+----------------+------------+\n| Tables_in_test | Table_type |\n+----------------+------------+\n| s1 | SEQUENCE |\n| student | BASE TABLE |\n| v1 | VIEW |\n+----------------+------------+\n \n\n\nURL: https://mariadb.com/kb/en/show-tables/','','https://mariadb.com/kb/en/show-tables/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (401,26,'SHOW TABLE_STATISTICS','MariaDB 5.2 introduced the User Statistics feature.\n \nSyntax\n------ \nSHOW TABLE_STATISTICS\n \nDescription\n----------- \nThe SHOW TABLE_STATISTICS statement was introduced in\nMariaDB 5.2 as part of the User Statistics feature. It was\nremoved as a separate statement in MariaDB 10.1.1, but\neffectively replaced by the generic SHOW\ninformation_schema_table statement. The\ninformation_schema.TABLE_STATISTICS table shows statistics\non table usage\n \nThe userstat system variable must be set to 1 to activate\nthis feature. See the User Statistics and\ninformation_schema.TABLE_STATISTICS articles for more\ninformation.\n \nExample\n \nFrom MariaDB 10.0\n \nSHOW TABLE_STATISTICS\\G\n*************************** 1. row\n***************************\n Table_schema: mysql\n Table_name: proxies_priv\n Rows_read: 2\n Rows_changed: 0\nRows_changed_x_#indexes: 0\n*************************** 2. row\n***************************\n Table_schema: test\n Table_name: employees_example\n Rows_read: 7\n Rows_changed: 0\nRows_changed_x_#indexes: 0\n*************************** 3. row\n***************************\n Table_schema: mysql\n Table_name: user\n Rows_read: 16\n Rows_changed: 0\nRows_changed_x_#indexes: 0\n*************************** 4. row\n***************************\n Table_schema: mysql\n Table_name: db\n Rows_read: 2\n Rows_changed: 0\nRows_changed_x_#indexes: 0\n \n\n \n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/show-table-statistics/','','https://mariadb.com/kb/en/show-table-statistics/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (402,26,'SHOW TRIGGERS','Syntax\n------ \nSHOW TRIGGERS [FROM db_name]\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \n SHOW TRIGGERS lists the triggers currently defined for\ntables in a database (the default database unless a FROM\nclause is given). This statement requires the\nTRIGGER privilege (prior to MySQL\n5.1.22, it required the SUPER privilege). \n \nThe LIKE clause, if present on its own, indicates which\ntable names to\nmatch and causes the statement to display triggers for those\ntables. The WHERE and LIKE clauses can be given to select\nrows using more general conditions, as discussed in Extended\nSHOW.\n \nSimilar information is stored in the\ninformation_schema.TRIGGERS table.\n \nIf there are multiple triggers for the same action, then the\ntriggers are shown in action order.\n \nExamples\n-------- \nFor the trigger defined at Trigger Overview:\n \nSHOW triggers Like \'animals\' \\G\n*************************** 1. row\n***************************\n Trigger: the_mooses_are_loose\n Event: INSERT\n Table: animals\n Statement: BEGIN\n IF NEW.name = \'Moose\' THEN\n UPDATE animal_count SET animal_count.animals =\nanimal_count.animals+100;\n ELSE \n UPDATE animal_count SET animal_count.animals =\nanimal_count.animals+1;\n END IF;\nEND\n Timing: AFTER\n Created: 2016-09-29 13:53:34.35\n sql_mode: \n Definer: root@localhost\ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n Database Collation: latin1_swedish_ci\n \nListing all triggers associated with a certain table:\n \nSHOW TRIGGERS FROM test WHERE `Table` = \'user\' \\G\n*************************** 1. row\n***************************\n Trigger: user_ai\n Event: INSERT\n Table: user\n Statement: BEGIN END\n Timing: AFTER\n Created: 2016-09-29 13:53:34.35\n sql_mode: \n Definer: root@%\ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n Database Collation: latin1_swedish_ci\n \nSHOW triggers WHERE Event Like \'Insert\' \\G\n*************************** 1. row\n***************************\n Trigger: the_mooses_are_loose\n Event: INSERT\n Table: animals\n Statement: BEGIN\n IF NEW.name = \'Moose\' THEN\n UPDATE animal_count SET animal_count.animals =\nanimal_count.animals+100;\n ELSE \n UPDATE animal_count SET animal_count.animals =\nanimal_count.animals+1;\n END IF;\nEND\n Timing: AFTER\n Created: 2016-09-29 13:53:34.35\n sql_mode: \n Definer: root@localhost\ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n Database Collation: latin1_swedish_ci\ncharacter_set_client is the session value of the\ncharacter_set_client system variable when the trigger was\ncreated. \ncollation_connection is the session value of the\ncollation_connection system variable when the trigger was\n created. \nDatabase Collation is the collation of the database \n with which the trigger is associated.\n \nThese columns were added in MariaDB/MySQL 5.1.21.\n \nOld triggers created before MySQL 5.7 and MariaDB 10.2.3 has\nNULL in the Created column.\n \n\n\nURL: https://mariadb.com/kb/en/show-triggers/','','https://mariadb.com/kb/en/show-triggers/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (403,26,'SHOW USER_STATISTICS','MariaDB 5.2 introduced the User Statistics feature.\n \nSyntax\n------ \nSHOW USER_STATISTICS\n \nDescription\n----------- \nThe SHOW USER_STATISTICS statement was introduced in MariaDB\n5.2 as part of the User Statistics feature. It was removed\nas a separate statement in MariaDB 10.1.1, but effectively\nreplaced by the generic SHOW information_schema_table\nstatement. The information_schema.USER_STATISTICS table\nholds statistics about user activity. You can use this table\nto find out such things as which user is causing the most\nload and which users are being abusive. You can also use\nthis table to measure how close to capacity the server may\nbe.\n \nThe userstat system variable must be set to 1 to activate\nthis feature. See the User Statistics and\ninformation_schema.USER_STATISTICS table for more\ninformation.\n \nExample\n \nFrom MariaDB 10.0:\n \nSHOW USER_STATISTICS\\G\n*************************** 1. row\n***************************\n User: root\n Total_connections: 1\nConcurrent_connections: 0\n Connected_time: 3297\n Busy_time: 0.14113400000000006\n Cpu_time: 0.017637000000000003\n Bytes_received: 969\n Bytes_sent: 22355\n Binlog_bytes_written: 0\n Rows_read: 10\n Rows_sent: 67\n Rows_deleted: 0\n Rows_inserted: 0\n Rows_updated: 0\n Select_commands: 7\n Update_commands: 0\n Other_commands: 0\n Commit_transactions: 1\n Rollback_transactions: 0\n Denied_connections: 0\n Lost_connections: 0\n Access_denied: 0\n Empty_queries: 7\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/show-user-statistics/','','https://mariadb.com/kb/en/show-user-statistics/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (404,26,'SHOW VARIABLES','Syntax\n------ \nSHOW [GLOBAL | SESSION] VARIABLES\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \nSHOW VARIABLES shows the values of MariaDB system variables.\nThis\ninformation also can be obtained using the mysqladmin\nvariables\ncommand. The LIKE clause, if present, indicates which\nvariable names\nto match. The WHERE clause can be given to select rows using\nmore\ngeneral conditions.\n \nWith the GLOBAL modifier, SHOW VARIABLES displays the values\nthat are\nused for new connections to MariaDB. With SESSION, it\ndisplays the\nvalues that are in effect for the current connection. If no\nmodifier\nis present, the default is SESSION. LOCAL is a synonym for\nSESSION.\nWith a LIKE clause, the statement displays only rows for\nthose\nvariables with names that match the pattern. To obtain the\nrow for a\nspecific variable, use a LIKE clause as shown:\n \nSHOW VARIABLES LIKE \'maria_group_commit\';\n \nSHOW SESSION VARIABLES LIKE \'maria_group_commit\';\n \nTo get a list of variables whose name match a pattern, use\nthe \"%\"\nwildcard character in a LIKE clause:\n \nSHOW VARIABLES LIKE \'%maria%\';\n \nSHOW GLOBAL VARIABLES LIKE \'%maria%\';\n \nWildcard characters can be used in any position within the\npattern to\nbe matched. Strictly speaking, because \"_\" is a wildcard\nthat matches\nany single character, you should escape it as \"\\_\" to\nmatch it\nliterally. In practice, this is rarely necessary.\n \nThe WHERE and LIKE clauses can be given to select rows using\nmore general conditions, as discussed in Extended SHOW.\n \nSee SET for information on setting server system variables.\n \nSee Server System Variables for a list of all the variables\nthat can be set.\n \nYou can also see the server variables by querying the\nInformation Schema GLOBAL_VARIABLES and SESSION_VARIABLES\ntables.\n \nExamples\n-------- \nSHOW VARIABLES LIKE \'aria%\';\n \n+------------------------------------------+---------------------+\n| Variable_name | Value |\n+------------------------------------------+---------------------+\n| aria_block_size | 8192 |\n| aria_checkpoint_interval | 30 |\n| aria_checkpoint_log_activity | 1048576 |\n| aria_force_start_after_recovery_failures | 0 |\n| aria_group_commit | none |\n| aria_group_commit_interval | 0 |\n| aria_log_file_size | 1073741824 |\n| aria_log_purge_type | immediate |\n| aria_max_sort_file_size | 9223372036853727232 |\n| aria_page_checksum | ON |\n| aria_pagecache_age_threshold | 300 |\n| aria_pagecache_buffer_size | 134217728 |\n| aria_pagecache_division_limit | 100 |\n| aria_recover | NORMAL |\n| aria_repair_threads | 1 |\n| aria_sort_buffer_size | 134217728 |\n| aria_stats_method | nulls_unequal |\n| aria_sync_log_dir | NEWFILE |\n| aria_used_for_temp_tables | ON |\n+------------------------------------------+---------------------+\n \nSELECT VARIABLE_NAME, SESSION_VALUE, GLOBAL_VALUE FROM\n INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE\n VARIABLE_NAME LIKE \'max_error_count\' OR\n VARIABLE_NAME LIKE \'innodb_sync_spin_loops\';\n \n+---------------------------+---------------+--------------+\n| VARIABLE_NAME | SESSION_VALUE | GLOBAL_VALUE |\n+---------------------------+---------------+--------------+\n| MAX_ERROR_COUNT | 64 | 64 |\n| INNODB_SYNC_SPIN_LOOPS | NULL | 30 |\n+---------------------------+---------------+--------------+\n \nSET GLOBAL max_error_count=128;\n \nSELECT VARIABLE_NAME, SESSION_VALUE, GLOBAL_VALUE FROM\n INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE\n VARIABLE_NAME LIKE \'max_error_count\' OR\n VARIABLE_NAME LIKE \'innodb_sync_spin_loops\';\n \n+---------------------------+---------------+--------------+\n| VARIABLE_NAME | SESSION_VALUE | GLOBAL_VALUE |\n+---------------------------+---------------+--------------+\n| MAX_ERROR_COUNT | 64 | 128 |\n| INNODB_SYNC_SPIN_LOOPS | NULL | 30 |\n+---------------------------+---------------+--------------+\n \nSET GLOBAL max_error_count=128;\n \nSHOW VARIABLES LIKE \'max_error_count\';\n \n+-----------------+-------+\n| Variable_name | Value |\n+-----------------+-------+\n| max_error_count | 64 |\n+-----------------+-------+\n \nSHOW GLOBAL VARIABLES LIKE \'max_error_count\';\n \n+-----------------+-------+\n| Variable_name | Value |\n+-----------------+-------+\n| max_error_count | 128 |\n+-----------------+-------+\n \nBecause the following variable only has a global scope, the\nglobal value is returned even when specifying SESSION (in\nthis case by default):\n \nSHOW VARIABLES LIKE \'innodb_sync_spin_loops\';\n \n+------------------------+-------+\n| Variable_name | Value |\n+------------------------+-------+\n| innodb_sync_spin_loops | 30 |\n+------------------------+-------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/show-variables/','','https://mariadb.com/kb/en/show-variables/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (405,26,'SHOW WARNINGS','Syntax\n------ \nSHOW WARNINGS [LIMIT [offset,] row_count]\nSHOW ERRORS [LIMIT row_count OFFSET offset]\nSHOW COUNT(*) WARNINGS\n \nDescription\n----------- \n SHOW WARNINGS shows the error, warning, and note messages\nthat resulted from the last statement that generated\nmessages in the\ncurrent session. It shows nothing if the last statement used\na table\nand generated no messages. (That is, a statement that uses a\ntable but\ngenerates no messages clears the message list.) Statements\nthat do not\nuse tables and do not generate messages have no effect on\nthe message\nlist.\n \nA note is different to a warning in that it only appears if\nthe sql_notes variable is set to 1 (the default), and is not\nconverted to an error if strict mode is enabled.\n \nA related statement, SHOW ERRORS, shows only the errors.\n \nThe SHOW COUNT(*) WARNINGS statement displays the total\nnumber of errors, warnings, and notes. You can also retrieve\nthis number from\nthe warning_count variable:\n \nSHOW COUNT(*) WARNINGS;\nSELECT @@warning_count;\n \nThe value of warning_count might be greater than the number\nof messages displayed by SHOW WARNINGS if the\nmax_error_count system variable is set so low that not all\nmessages are stored.\n \nThe LIMIT clause has the same syntax as for the\n SELECT statement.\n \nSHOW WARNINGS can be used after EXPLAIN EXTENDED to see how\na query is internally rewritten by MariaDB.\n \nIf the sql_notes server variable is set to 1, Notes are\nincluded in the output of SHOW WARNINGS; if it is set to 0,\nthis statement will not show (or count) Notes.\n \nThe results of SHOW WARNINGS and SHOW COUNT(*) WARNINGS are\ndirectly sent to the client. If you need to access those\ninformation in a stored program, you can use the GET\nDIAGNOSTICS statement instead.\n \nFor a list of MariaDB error codes, see MariaDB Error Codes.\n \nThe mysql client also has a number of options related to\nwarnings. The \\W command will show warnings after every\nstatement, while \\w will disable this. Starting the client\nwith the --show-warnings option will show warnings after\nevery statement.\n \nMariaDB 10.3.1 implements a stored routine error stack\ntrace. SHOW WARNINGS can also be used to show more\ninformation. See the example below.\n \nExamples\n-------- \nSELECT 1/0;\n+------+\n| 1/0 |\n+------+\n| NULL |\n+------+\n \nSHOW COUNT(*) WARNINGS;\n+-------------------------+\n| @@session.warning_count |\n+-------------------------+\n| 1 |\n+-------------------------+\n \nSHOW WARNINGS;\n+---------+------+---------------+\n| Level | Code | Message |\n+---------+------+---------------+\n| Warning | 1365 | Division by 0 |\n+---------+------+---------------+\n \nStack Trace\n \nFrom MariaDB 10.3.1, displaying a stack trace:\n \nDELIMITER $$\nCREATE OR REPLACE PROCEDURE p1()\n BEGIN\n DECLARE c CURSOR FOR SELECT * FROM not_existing;\n OPEN c;\n CLOSE c;\n END;\n$$\nCREATE OR REPLACE PROCEDURE p2()\n BEGIN\n CALL p1;\n END;\n$$\nDELIMITER ;\nCALL p2;\nERROR 1146 (42S02): Table \'test.not_existing\' doesn\'t\nexist\n \nSHOW WARNINGS;\n+-------+------+-----------------------------------------+\n| Level | Code | Message |\n+-------+------+-----------------------------------------+\n| Error | 1146 | Table \'test.not_existing\' doesn\'t exist\n|\n| Note | 4091 | At line 6 in test.p1 |\n| Note | 4091 | At line 4 in test.p2 |\n+-------+------+-----------------------------------------+\n \nSHOW WARNINGS displays a stack trace, showing where the\nerror actually happened:\nLine 4 in test.p1 is the OPEN command which actually raised\nthe error\nLine 3 in test.p2 is the CALL statement, calling p1 from p2.\n \n\n\nURL: https://mariadb.com/kb/en/show-warnings/','','https://mariadb.com/kb/en/show-warnings/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (406,26,'SHOW WSREP_MEMBERSHIP','MariaDB 10.1.2\n \nSHOW WSREP_MEMBERSHIP was introduced with the WSREP_INFO\nplugin in MariaDB 10.1.2.\n \nSyntax\n------ \nSHOW WSREP_MEMBERSHIP\n \nDescription\n----------- \nThe SHOW WSREP_MEMBERSHIP statement returns Galera node\ncluster membership information. It returns the same\ninformation as found in the\ninformation_schema.WSREP_MEMBERSHIP table. Only users with\nthe SUPER privilege can access this information.\n \nExamples\n-------- \nSHOW WSREP_MEMBERSHIP;\n+-------+--------------------------------------+----------+-----------------+\n| Index | Uuid | Name | Address |\n+-------+--------------------------------------+----------+-----------------+\n| 0 | 19058073-8940-11e4-8570-16af7bf8fced | my_node1 |\n10.0.2.15:16001 |\n| 1 | 19f2b0e0-8942-11e4-9cb8-b39e8ee0b5dd | my_node3 |\n10.0.2.15:16003 |\n| 2 | d85e62db-8941-11e4-b1ef-4bc9980e476d | my_node2 |\n10.0.2.15:16002 |\n+-------+--------------------------------------+----------+-----------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/show-wsrep_membership/','','https://mariadb.com/kb/en/show-wsrep_membership/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (407,26,'SHOW WSREP_STATUS','MariaDB 10.1.2\n \nSHOW WSREP_STATUS was introduced with the WSREP_INFO plugin\nin MariaDB 10.1.2.\n \nSyntax\n------ \nSHOW WSREP_STATUS\n \nDescription\n----------- \nThe SHOW WSREP_STATUS statement returns Galera node and\ncluster status information. It returns the same information\nas found in the information_schema.WSREP_STATUS table. Only\nusers with the SUPER privilege can access this information.\n \nExamples\n-------- \nSHOW WSREP_STATUS;\n+------------+-------------+----------------+--------------+\n| Node_Index | Node_Status | Cluster_Status | Cluster_Size |\n+------------+-------------+----------------+--------------+\n| 0 | Synced | Primary | 3 |\n+------------+-------------+----------------+--------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/show-wsrep_status/','','https://mariadb.com/kb/en/show-wsrep_status/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (408,27,'CALL','Syntax\n------ \nCALL sp_name([parameter[,...]])\nCALL sp_name[()]\n \nDescription\n----------- \nThe CALL statement invokes a stored procedure that was\ndefined previously with CREATE PROCEDURE. \n \nStored procedure names can be specified as\ndatabase_name.procedure_name. Procedure names and database\nnames can be quoted with backticks (). This is necessary if\nthey are reserved words, or contain special characters. See\nidentifier qualifiers for details.\n \nBefore MySQL 5.1.13, stored procedures that take no\narguments required parentheses. In current releases of\nMariaDB, CALL p() and CALL p are equivalent.\n \nIf parentheses are used, any number of spaces, tab\ncharacters and new line characters is allowed between the\nprocedure\'s name and the open parenthesis.\n \nCALL can pass back values to its caller using parameters\nthat are declared as OUT or INOUT\nparameters. If no value is assigned to an OUT parameter,\nNULL is assigned (and its former value is lost). To pass\nsuch values from another stored program you can use\nuser-defined variables, local variables or routine\'s\nparameters; in other contexts, you can only use user-defined\nvariables. \n \nCALL can also be executed as a prepared statement.\nPlaceholders can be used for IN parameters in all versions\nof MariaDB; for OUT and INOUT parameters, placeholders can\nbe used since MariaDB 5.5.\n \nWhen the procedure returns, a client program can also obtain\nthe\nnumber of rows affected for the final statement executed\nwithin the routine: At\nthe SQL level, call the ROW_COUNT() function; from the C\nAPI, call the mysql_affected_rows() function.\n \nIf the CLIENT_MULTI_RESULTS API flag is set, CALL can return\nany number of resultsets and the called stored procedure can\nexecute prepared statements. If it is not set, at most one\nresultset can be returned and prepared statements cannot be\nused within procedures.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/call/','','https://mariadb.com/kb/en/call/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (409,27,'Concurrent Inserts','The MyISAM storage engine supports concurrent inserts. This\nfeature allows SELECT statements to be executed during\nINSERT operations, reducing contention.\n \nWhether concurrent inserts can be used or not depends on the\nvalue of the concurrent_insert server system variable:\nNEVER (0) disables concurrent inserts.\nAUTO (1) allows concurrent inserts only when the target\ntable has no free blocks (no data in the middle of the table\nhas been deleted after the last OPTIMIZE TABLE). This is the\ndefault.\nALWAYS (2) always enables concurrent inserts.\n \nIf the binary log is used, CREATE TABLE ... SELECT and\nINSERT ... SELECT statements cannot use concurrent inserts.\nThese statements acquire a read lock on the table, so\nconcurrent inserts will need to wait. This way the log can\nbe safely used to restore data.\n \nConcurrent inserts is not used by slaves with the row based\nreplication (see binary log formats).\n \nIf an INSERT statement contain the HIGH_PRIORITY clause,\nconcurrent inserts cannot be used. INSERT ... DELAYED is\nusually unneeded if concurrent inserts are enabled.\n \nLOAD DATA INFILE uses concurrent inserts if the CONCURRENT\nkeyword is specified and concurrent_insert is not NEVER.\nThis makes the statement slower (even if no other sessions\naccess the table) but reduces contention.\n \nLOCK TABLES allows non-conflicting concurrent inserts if a\nREAD LOCAL lock is used. Concurrent inserts are not allowed\nif the LOCAL keyword is omitted.\n \nNotes\n \nThe decision to enable concurrent insert for a table is done\nwhen the table is opened. If you change the value of\nconcurrent_insert it will only affect new opened tables. If\nyou want it to work for also for tables in use or cached,\nyou should do FLUSH TABLES after setting the variable.\n \n\n\nURL: https://mariadb.com/kb/en/concurrent-inserts/','','https://mariadb.com/kb/en/concurrent-inserts/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (410,27,'DELETE','Syntax\n------ \nSingle-table syntax:\n \nDELETE [LOW_PRIORITY] [QUICK] [IGNORE] \n FROM tbl_name [PARTITION (partition_list)]\n [WHERE where_condition]\n [ORDER BY ...]\n [LIMIT row_count]\n [RETURNING select_expr \n [, select_expr ...]]\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 \nTrimming history:\n \nDELETE HISTORY\n FROM tbl_name [PARTITION (partition_list)]\n [BEFORE SYSTEM_TIME [TIMESTAMP|TRANSACTION] expression]\n \nDescription\n----------- \nOption | Description | \n \nLOW_PRIORITY | Wait until all SELECT\'s are done before\nstarting the statement. Used with storage engines that uses\ntable locking (MyISAM, Aria etc). See HIGH_PRIORITY and\nLOW_PRIORITY clauses for details. | \n \nQUICK | Signal the storage engine that it should expect that\na lot of rows are deleted. The storage engine engine can do\nthings to speed up the DELETE like ignoring merging of data\nblocks until all rows are deleted from the block (instead of\nwhen a block is half full). This speeds up things at the\nexpanse of lost space in data blocks. At least MyISAM and\nAria support this feature. | \n \nIGNORE | Don\'t stop the query even if a not-critical error\noccurs (like data overflow). See How IGNORE works for a full\ndescription. | \n \nFor the single-table syntax, the DELETE statement deletes\nrows\nfrom tbl_name and returns a count of the number of deleted\nrows. This count can\nbe obtained by calling the ROW_COUNT() function. The\nWHERE clause, if given, specifies the conditions that\nidentify\nwhich rows to delete. With no WHERE clause, all rows are\ndeleted. If the ORDER BY clause is specified, the rows are\ndeleted in the order that is specified. The LIMIT clause\nplaces a limit on the number of rows that can be deleted.\n \nFor the multiple-table syntax, DELETE deletes from each\ntbl_name the rows that satisfy the conditions. In this case,\nORDER BY and LIMIT> cannot be used. A DELETE can also\nreference tables which are located in different databases;\nsee Identifier Qualifiers for the syntax.\n \nwhere_condition is an expression that evaluates to true for\neach row to be deleted. It is specified as described in\nSELECT.\n \nCurrently, you cannot delete from a table and select from\nthe same\ntable in a subquery.\n \nYou need the DELETE privilege on a table to delete rows from\nit. You need only the SELECT privilege for any columns that\nare only read, such as those named in the WHERE clause. See\nGRANT.\n \nThe PARTITION clause was introduced in MariaDB 10.0. See\nPartition Pruning and Selection for details.\n \nAs stated, a DELETE statement with no WHERE\nclause deletes all rows. A faster way to do this, when you\ndo not need to know\nthe number of deleted rows, is to use TRUNCATE TABLE.\nHowever,\nwithin a transaction or if you have a lock on the table, \nTRUNCATE TABLE cannot be used whereas DELETE\ncan. See TRUNCATE TABLE, and\nLOCK.\n \nFrom MariaDB 10.0.5, it is possible to return a resultset of\nthe deleted rows for a single table to the client by using\nthe syntax DELETE ... RETURNING select_expr [, select_expr2\n...]]\n \nAny of SQL expression that can be calculated from a single\nrow fields is allowed. Subqueries are allowed. The AS\nkeyword is allowed, so it is possible to use aliases.\n \nThe use of aggregate functions is not allowed. RETURNING\ncannot be used in multi-table DELETEs.\n \nSame Source and Target Table\n \nUntil MariaDB 10.3.1, deleting from a table with the same\nsource and target was not possible. From MariaDB 10.3.1,\nthis is now possible. For example:\n \nDELETE FROM t1 WHERE c1 IN (SELECT b.c1 FROM t1 b WHERE\nb.c2=0);\n \nOne can use DELETE HISTORY to delete historical information\nfrom System-versioned tables.\n \nExamples\n-------- \nHow to use the ORDER BY and LIMIT clauses:\n \nDELETE FROM page_hit ORDER BY timestamp LIMIT 1000000;\n \nHow to use the RETURNING clause:\n \nDELETE FROM t RETURNING f1;\n \n+------+\n| f1 |\n+------+\n| 5 |\n| 50 |\n| 500 |\n+------+ \n \nThe following statement joins two tables: one is only used\nto satisfy a WHERE condition, but no row is deleted from it;\nrows from the other table are deleted, instead.\n \nDELETE post FROM blog INNER JOIN post WHERE blog.id =\npost.blog_id;\n \nDeleting from the Same Source and Target\n \nCREATE TABLE t1 (c1 INT, c2 INT);\nDELETE FROM t1 WHERE c1 IN (SELECT b.c1 FROM t1 b WHERE\nb.c2=0);\n \nUntil MariaDB 10.3.1, this returned:\n \nERROR 1093 (HY000): Table \'t1\' is specified twice, both as\na target for \'DELETE\' \n and as a separate source for\n \nFrom MariaDB 10.3.1:\n \nQuery OK, 0 rows affected (0.00 sec)\n \n\n\nURL: https://mariadb.com/kb/en/delete/','','https://mariadb.com/kb/en/delete/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (411,27,'DO','Syntax\n------ \nDO expr [, expr] ...\n \nDescription\n----------- \n DO executes the expressions but does not return any\nresults. In most respects, DO is shorthand for\n SELECT expr, ..., but has the advantage that it is slightly\nfaster when you do not care about the result.\n \n DO is useful primarily with functions that have side\n effects, such as RELEASE_LOCK().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/do/','','https://mariadb.com/kb/en/do/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (412,27,'DUAL','Description\n----------- \nYou are allowed to specify DUAL as a dummy table name in\nsituations where no tables are referenced, such as the\nfollowing SELECT statement:\n \nSELECT 1 + 1 FROM DUAL;\n \n+-------+\n| 1 + 1 |\n+-------+\n| 2 |\n+-------+\n \n DUAL is purely for the convenience of people who require\n that all SELECT statements should have\n FROM and possibly other clauses. MariaDB ignores the\n clauses. MariaDB does not require FROM DUAL if no tables\n are referenced.\n \nFROM DUAL could be used when you only SELECT computed\nvalues, but require a WHERE clause, perhaps to test that a\nscript correctly handles empty resultsets:\n \nSELECT 1 FROM DUAL WHERE FALSE;\n \nEmpty set (0.00 sec)\n \n\n\nURL: https://mariadb.com/kb/en/dual/','','https://mariadb.com/kb/en/dual/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (413,27,'EXCEPT','EXCEPT was introduced in MariaDB 10.3.0.\n \nThe result of EXCEPT is all records of the left SELECT\nresult set except records which are in right SELECT result\nset, i.e. it is subtraction of two result sets.\n \nSyntax\n------ \nSELECT ...\n(INTERSECT | EXCEPT | UNION [ALL | DISTINCT]) SELECT ...\n[(INTERSECT | EXCEPT | UNION [ALL | DISTINCT]) SELECT ...]\n[ORDER BY [column [, column ...]]]\n[LIMIT {[offset,] row_count | row_count OFFSET offset}]\n \nPlease note:\nALL is not supported by EXCEPT (and it is difficult to make\nsense of ALL with EXCEPT).\nBrackets for explicit operation precedence are not\nsupported; use a subquery in the FROM clause as a\nworkaround).\n \nDescription\n----------- \nMariaDB has supported EXCEPT and INTERSECT in addition to\nUNION since MariaDB 10.3.\n \nAll behavior for naming columns, ORDER BY and LIMIT is the\nsame as for UNION.\n \nEXCEPT implicitly supposes a DISTINCT operation.\n \nThe result of EXCEPT is all records of the left SELECT\nresult except records which are in right SELECT result set,\ni.e. it is subtraction of two result sets.\n \nEXCEPT and UNION have the same operation precedence.\n \n\nParentheses\n \nFrom MariaDB 10.4.0, parentheses can be used to specify\nprecedence. Before this, a syntax error would be returned.\n \nExamples\n-------- \nShow customers which are not employees:\n \n(SELECT e_name AS name, email FROM customers)\nEXCEPT\n(SELECT c_name AS name, email FROM employees);\n \nDifference between UNION, EXCEPT and INTERSECT:\n \nCREATE TABLE seqs (i INT);\nINSERT INTO seqs VALUES (1),(2),(3),(4),(5),(6);\n \nSELECT i FROM seqs WHERE i =3;\n \n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n| 3 |\n| 4 |\n| 5 |\n| 6 |\n+------+\n \nSELECT i FROM seqs WHERE i =3;\n \n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n+------+\n \nSELECT i FROM seqs WHERE i =3;\n \n+------+\n| i |\n+------+\n| 3 |\n+------+\n \nParentheses for specifying precedence, from MariaDB 10.4.0\n \nCREATE OR REPLACE TABLE t1 (a INT);\nCREATE OR REPLACE TABLE t2 (b INT);\nCREATE OR REPLACE TABLE t3 (c INT);\n \nINSERT INTO t1 VALUES (1),(2),(3),(4);\nINSERT INTO t2 VALUES (5),(6);\nINSERT INTO t3 VALUES (1),(6);\n \n((SELECT a FROM t1) UNION (SELECT b FROM t2)) EXCEPT (SELECT\nc FROM t3);\n+------+\n| a |\n+------+\n| 2 |\n| 3 |\n| 4 |\n| 5 |\n+------+\n \n(SELECT a FROM t1) UNION ((SELECT b FROM t2) EXCEPT (SELECT\nc FROM t3));\n+------+\n| a |\n+------+\n| 1 |\n| 2 |\n| 3 |\n| 4 |\n| 5 |\n+------+\n \n\n\nURL: https://mariadb.com/kb/en/except/','','https://mariadb.com/kb/en/except/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (414,27,'FOR UPDATE','The FOR UPDATE clause of SELECT applies only when autocommit\nis set to 0 or the SELECT is enclosed in a transaction. A\nlock is acquired on the rows, and other transactions are\nprevented from writing the rows, acquire locks, and from\nreading them (unless their isolation level is READ\nUNCOMMITTED).\n \nIf autocommit is set to 1, the LOCK IN SHARE MODE and FOR\nUPDATE clauses have no effect.\n \nIf the isolation level is set to SERIALIZABLE, all plain\nSELECT statements are converted to SELECT ... LOCK IN SHARE\nMODE.\n \nExample\n \nSELECT * FROM trans WHERE period=2001 FOR UPDATE;\n \n\n\nURL: https://mariadb.com/kb/en/for-update/','','https://mariadb.com/kb/en/for-update/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (415,27,'GROUP BY','Use the GROUP BY clause in a SELECT statement to group rows\ntogether that have the same value in one or more column, or\nthe same computed value using expressions with any\nfunctions and operators except\ngrouping functions. When you\nuse a GROUP BY clause, you will get a single result row for\neach group of rows\nthat have the same value for the expression given in GROUP\nBY.\n \nWhen grouping rows, grouping values are compared as if by\nthe = operator.\nFor string values, the = operator ignores trailing\nwhitespace and may normalize\ncharacters and ignore case, depending on the collation in\nuse.\n \nYou can use any of the grouping functions in your select\nexpression. Their values will\nbe calculated based on all the rows that have been grouped\ntogether for each result\nrow. If you select a non-grouped column or a value computed\nfrom a non-grouped\ncolumn, it is undefined which row the returned value is\ntaken from. This is not permitted if the ONLY_FULL_GROUP_BY\nSQL_MODE is used.\n \nYou can use multiple expressions in the GROUP BY clause,\nseparated by commas.\nRows are grouped together if they match on each of the\nexpressions.\n \nYou can also use a single integer as the grouping\nexpression. If you use an integer n,\nthe results will be grouped by the nth column in the select\nexpression.\n \nThe WHERE clause is applied before the GROUP BY clause. It\nfilters non-aggregated\nrows before the rows are grouped together. To filter grouped\nrows based on aggregate values,\nuse the HAVING clause. The HAVING clause takes any\nexpression and evaluates it as\na boolean, just like the WHERE clause. You can use grouping\nfunctions in the HAVING\nclause. As with the select expression, if you reference\nnon-grouped columns in the HAVING\nclause, the behavior is undefined.\n \nBy default, if a GROUP BY clause is present, the rows in the\noutput will be sorted by the expressions used in the GROUP\nBY. You can also specify ASC or DESC (ascending, descending)\nafter those expressions, like in ORDER BY. The default is\nASC.\n \nIf you want the rows to be sorted by another field, you can\nadd an explicit ORDER BY. If you don\'t want the result to\nbe ordered, you can add ORDER BY NULL.\n \nWITH ROLLUP\n \nThe WITH ROLLUP modifer adds extra rows to the resultset\nthat represent super-aggregate summaries. For a full\ndescription with examples, see SELECT WITH ROLLUP.\n \nGROUP BY Examples\n \nConsider the following table that records how many times\neach user has played and won a game:\n \nCREATE TABLE plays (name VARCHAR(16), plays INT, wins INT);\nINSERT INTO plays VALUES \n (\"John\", 20, 5), \n (\"Robert\", 22, 8), \n (\"Wanda\", 32, 8), \n (\"Susan\", 17, 3);\n \nGet a list of win counts along with a count:\n \nSELECT wins, COUNT(*) FROM plays GROUP BY wins;\n \n+------+----------+\n| wins | COUNT(*) |\n+------+----------+\n| 3 | 1 |\n| 5 | 1 |\n| 8 | 2 |\n+------+----------+\n3 rows in set (0.00 sec)\n \nThe GROUP BY expression can be a computed value, and can\nrefer back to an identifer\nspecified with AS. Get a list of win averages along with a\ncount:\n \nSELECT (wins / plays) AS winavg, COUNT(*) FROM plays GROUP\nBY winavg;\n \n+--------+----------+\n| winavg | COUNT(*) |\n+--------+----------+\n| 0.1765 | 1 |\n| 0.2500 | 2 |\n| 0.3636 | 1 |\n+--------+----------+\n3 rows in set (0.00 sec)\n \nYou can use any grouping function\nin the select expression. For each win average as above, get\na list of the average play\ncount taken to get that average:\n \nSELECT (wins / plays) AS winavg, AVG(plays) FROM plays \n GROUP BY winavg;\n \n+--------+------------+\n| winavg | AVG(plays) |\n+--------+------------+\n| 0.1765 | 17.0000 |\n| 0.2500 | 26.0000 |\n| 0.3636 | 22.0000 |\n+--------+------------+\n3 rows in set (0.00 sec)\n \nYou can filter on aggregate information using the HAVING\nclause. The HAVING\nclause is applied after GROUP BY and allows you to filter on\naggregate data that is\nnot available to the WHERE clause. Restrict the above\nexample to results that involve\nan average number of plays over 20:\n \nSELECT (wins / plays) AS winavg, AVG(plays) FROM plays \n GROUP BY winavg HAVING AVG(plays) > 20;\n \n+--------+------------+\n| winavg | AVG(plays) |\n+--------+------------+\n| 0.2500 | 26.0000 |\n| 0.3636 | 22.0000 |\n+--------+------------+\n2 rows in set (0.00 sec)\n \nSee Also\n \nSELECT\nJoins and Subqueries\nLIMIT\nORDER BY\nCommon Table Expressions\nSELECT WITH ROLLUP\nSELECT INTO OUTFILE\nSELECT INTO DUMPFILE\nFOR UPDATE\nLOCK IN SHARE MODE\nOptimizer Hints\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/group-by/','','https://mariadb.com/kb/en/group-by/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (416,27,'HANDLER Commands','Syntax\n------ \nHANDLER tbl_name OPEN [ [AS] alias]\nHANDLER tbl_name READ index_name { = | >= | = | \n\nURL: https://mariadb.com/kb/en/handler-commands/','','https://mariadb.com/kb/en/handler-commands/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (417,27,'HIGH_PRIORITY and LOW_PRIORITY','The XtraDB/InnoDB storage engine uses row-level locking to\nensure data integrity. However some storage engines (such as\nMEMORY, MyISAM, Aria and MERGE) lock the whole table to\nprevent conflicts. These storage engines use two separate\nqueues to remember pending statements; one is for SELECTs\nand the other one is for write statements (INSERT, DELETE,\nUPDATE). By default, the latter has a higher priority.\n \nTo give write operations a lower priority, the\nlow_priority_updates server system variable can be set to\nON. The option is available on both the global and session\nlevels, and it can be set at startup or via the SET\nstatement.\n \nWhen too many table locks have been set by write statements,\nsome pending SELECTs are executed. The maximum number of\nwrite locks that can be acquired before this happens is\ndetermined by the max_write_lock_count server system\nvariable, which is dynamic.\n \nIf write statements have a higher priority (default), the\npriority of individual write statements (INSERT, REPLACE,\nUPDATE, DELETE) can be changed via the LOW_PRIORITY\nattribute, and the priority of a SELECT statement can be\nraised via the HIGH_PRIORITY attribute. Also, LOCK TABLES\nsupports a LOW_PRIORITY attribute for WRITE locks.\n \nIf read statements have a higher priority, the priority of\nan INSERT can be changed via the HIGH_PRIORITY attribute.\nHowever, the priority of other write statements cannot be\nraised individually.\n \nThe use of LOW_PRIORITY or HIGH_PRIORITY for an INSERT\nprevents Concurrent Inserts from being used.\n \n\n\nURL:\nhttps://mariadb.com/kb/en/high_priority-and-low_priority/','','https://mariadb.com/kb/en/high_priority-and-low_priority/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (418,27,'IGNORE','The IGNORE option tells the server to ignore some common\nerrors.\n \nIGNORE can be used with the following statements:\nDELETE\nINSERT (see also INSERT IGNORE)\nLOAD DATA INFILE\nUPDATE\nALTER TABLE\nCREATE TABLE ... SELECT\nINSERT ... SELECT\n \nThe logic used:\nVariables out of ranges are replaced with the\nmaximum/minimum value.\n \nSQL_MODEs STRICT_TRANS_TABLES, STRICT_ALL_TABLES,\nNO_ZERO_IN_DATE, NO_ZERO_DATE are ignored.\n \nInserting NULL in a NOT NULL field will insert 0 ( in a\nnumerical\n field), 0000-00-00 ( in a date field) or an empty string (\nin a character\n field).\n \nRows that cause a duplicate key error or break a foreign key\nconstraint are\n not inserted, updated, or deleted.\n \nThe following errors are ignored:\n \nError number | Symbolic error name | Description | \n \n1022 | ER_DUP_KEY | Can\'t write; duplicate key in table\n\'%s\' | \n \n1048 | ER_BAD_NULL_ERROR | Column \'%s\' cannot be null | \n \n1062 | ER_DUP_ENTRY | Duplicate entry \'%s\' for key %d | \n \n1242 | ER_SUBQUERY_NO_1_ROW | Subquery returns more than 1\nrow | \n \n1264 | ER_WARN_DATA_OUT_OF_RANGE | Out of range value for\ncolumn \'%s\' at row %ld | \n \n1265 | WARN_DATA_TRUNCATED | Data truncated for column\n\'%s\' at row %ld | \n \n1292 | ER_TRUNCATED_WRONG_VALUE | Truncated incorrect %s\nvalue: \'%s\' | \n \n1366 | ER_TRUNCATED_WRONG_VALUE_FOR_FIELD | Incorrect\ninteger value | \n \n1369 | ER_VIEW_CHECK_FAILED | CHECK OPTION failed \'%s.%s\'\n| \n \n1451 | ER_ROW_IS_REFERENCED_2 | Cannot delete or update a\nparent row | \n \n1452 | ER_NO_REFERENCED_ROW_2 | Cannot add or update a child\nrow: a foreign key constraint fails (%s) | \n \n1526 | ER_NO_PARTITION_FOR_GIVEN_VALUE | Table has no\npartition for value %s | \n \n1586 | ER_DUP_ENTRY_WITH_KEY_NAME | Duplicate entry \'%s\'\nfor key \'%s\' | \n \n1591 | ER_NO_PARTITION_FOR_GIVEN_VALUE_SILENT | Table has no\npartition for some existing values | \n \n1748 | ER_ROW_DOES_NOT_MATCH_GIVEN_PARTITION_SET | Found a\nrow not matching the given partition set | \n \nIgnored errors normally generate a warning.\n \nA property of the IGNORE clause consists in causing\ntransactional engines and non-transactional engines (like\nXtraDB and Aria) to behave the same way. For example,\nnormally a multi-row insert which tries to violate a UNIQUE\ncontraint is completely rolled back on XtraDB/InnoDB, but\nmight be partially executed on Aria. With the IGNORE clause,\nthe statement will be partially executed in both engines.\n \nStarting from MariaDB 5.5.28 duplicate key errors also\ngenerate warnings. The OLD_MODE server variable can be used\nto prevent this.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/ignore/','','https://mariadb.com/kb/en/ignore/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (419,27,'INSERT','Syntax\n------ \nINSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [PARTITION (partition_list)] [(col,...)]\n {VALUES | VALUE} ({expr | DEFAULT},...),(...),...\n [ ON DUPLICATE KEY UPDATE\n col=expr\n [, col=expr] ... ]\n \nOr:\n \nINSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [PARTITION (partition_list)]\n SET col={expr | DEFAULT}, ...\n [ ON DUPLICATE KEY UPDATE\n col=expr\n [, col=expr] ... ]\n \nOr:\n \nINSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [PARTITION (partition_list)] [(col,...)]\n SELECT ...\n [ ON DUPLICATE KEY UPDATE\n col=expr\n [, col=expr] ... ]\n \nThe INSERT statement is used to insert new rows into an\nexisting table. The INSERT ... VALUES\nand INSERT ... SET forms of the statement insert rows based\non explicitly specified values. The INSERT ... SELECT form\ninserts rows selected from another table or tables. INSERT\n... SELECT is discussed further in the INSERT ... SELECT\narticle.\n \nThe table name can be specified in the form db_name.tbl_name\nor, if a default database is selected, in the form tbl_name\n(see Identifier Qualifiers). This allows to use INSERT ...\nSELECT to copy rows between different databases.\n \nThe PARTITION clause was introduced in MariaDB 10.0. It can\nbe used in both the INSERT and the SELECT part. See\nPartition Pruning and Selection for details.\n \nThe columns list is optional. It specifies which values are\nexplicitly inserted, and in which order. If this clause is\nnot specified, all values must be explicitly specified, in\nthe same order they are listed in the table definition.\n \nThe list of value follow the VALUES or VALUE keyword (which\nare interchangeable, regardless how much values you want to\ninsert), and is wrapped by parenthesis. The values must be\nlisted in the same order as the columns list. It is possible\nto specify more than one list to insert more than one rows\nwith a single statement. If many rows are inserted, this is\na speed optimization.\n \nFor one-row statements, the SET clause may be more simple,\nbecause you don\'t need to remember the columns order. All\nvalues are specified in the form col = expr.\n \nValues can also be specified in the form of a SQL expression\nor subquery. However, the subquery cannot access the same\ntable that is named in the INTO clause.\n \nIf you use the LOW_PRIORITY keyword, execution of the INSERT\nis delayed until no other clients are reading from the\ntable. If you use the HIGH_PRIORITY keyword, the statement\nhas the same priority as SELECTs. This affects only storage\nengines that use only table-level locking (MyISAM, MEMORY,\nMERGE). However, if one of these keywords is specified,\nconcurrent inserts cannot be used. See HIGH_PRIORITY and\nLOW_PRIORITY clauses for details.\n \nINSERT DELAYED\n \nFor more details on the DELAYED option, see INSERT DELAYED.\n \nHIGH PRIORITY and LOW PRIORITY\n \nSee HIGH_PRIORITY and LOW_PRIORITY.\n \nDefaults and Duplicate Values\n \nSee INSERT - Default & Duplicate Values for details..\n \nINSERT IGNORE\n \nSee INSERT IGNORE.\n \nINSERT ON DUPLICATE KEY UPDATE\n \nSee INSERT ON DUPLICATE KEY UPDATE.\n \nExamples\n-------- \nSpecifying the column names:\n \nINSERT INTO person (first_name, last_name) VALUES (\'John\',\n\'Doe\');\n \nInserting more than 1 row at a time:\n \nINSERT INTO tbl_name VALUES (1, \"row 1\"), (2, \"row 2\");\n \nUsing the SET clause:\n \nINSERT INTO person SET first_name = \'John\', last_name =\n\'Doe\';\n \nSELECTing from another table:\n \nINSERT INTO contractor SELECT * FROM person WHERE status =\n\'c\';\n \nSee INSERT ON DUPLICATE KEY UPDATE and INSERT IGNORE for\nfurther examples.\n \n\n\nURL: https://mariadb.com/kb/en/insert/','','https://mariadb.com/kb/en/insert/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (420,27,'INSERT - Default &amp; Duplicate Values','Default Values\n \nIf the SQL_MODE contains STRICT_TRANS_TABLES and you are\ninserting into a transactional table (like InnoDB), or if\nthe SQL_MODE contains STRICT_ALL_TABLES, all NOT NULL\ncolumns which does not have a DEFAULT value (and is not\nAUTO_INCREMENT) must be explicitly referenced in INSERT\nstatements. If not, an error like this is produced:\n \nERROR 1364 (HY000): Field \'col\' doesn\'t have a default\nvalue\n \nIn all other cases, if a NOT NULL column without a DEFAULT\nvalue is not referenced, an empty value will be inserted\n(for example, 0 for INTEGER columns and \'\' for CHAR\ncolumns). See NULL Values in MariaDB:Inserting for examples.\n \nIf a NOT NULL column having a DEFAULT value is not\nreferenced, NULL will be inserted.\n \nIf a NULL column having a DEFAULT value is not referenced,\nits default value will be inserted. It is also possible to\nexplicitly assign the default value using the DEFAULT\nkeyword or the DEFAULT() function.\n \nIf the DEFAULT keyword is used but the column does not have\na DEFAULT value, an error like this is produced:\n \nERROR 1364 (HY000): Field \'col\' doesn\'t have a default\nvalue\n \nDuplicate Values\n \nBy default, if you try to insert a duplicate row and there\nis a UNIQUE index, INSERT stops and an error like this is\nproduced:\n \nERROR 1062 (23000): Duplicate entry \'dup_value\' for key\n\'col\'\n \nTo handle duplicates you can use the IGNORE clause, INSERT\nON DUPLICATE KEY UPDATE or the REPLACE statement. Note that\nthe IGNORE and DELAYED options are ignored when you use ON\nDUPLICATE KEY UPDATE.\n \n\n\nURL:\nhttps://mariadb.com/kb/en/insert-default-duplicate-values/','','https://mariadb.com/kb/en/insert-default-duplicate-values/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (421,27,'INSERT DELAYED','Syntax\n------ \nINSERT DELAYED ...\n \nDescription\n----------- \nThe DELAYED option for the INSERT\nstatement is a MariaDB/MySQL extension to standard SQL that\nis very useful if you have\nclients that cannot or need not wait for the INSERT to\ncomplete. This is a common situation when you use MariaDB\nfor logging and you\nalso periodically run SELECT and UPDATE\nstatements that take a long time to complete.\n \nWhen a client uses INSERT DELAYED, it gets an okay from the\nserver at once, and the row is queued to be inserted when\nthe table is not in\nuse by any other thread.\n \nAnother major benefit of using INSERT DELAYED is that\ninserts from many clients are bundled together and written\nin one block. This\nis much faster than performing many separate inserts.\n \nNote that INSERT DELAYED is slower than a normal\n INSERT if the table is not otherwise in use. There is also\nthe additional overhead for the server to handle a separate\nthread for each\ntable for which there are delayed rows. This means that you\nshould use\nINSERT DELAYED only when you are really sure that you need\nit.\n \nThe queued rows are held only in memory until they are\ninserted into the table.\nThis means that if you terminate mysqld forcibly (for\nexample, with kill -9) or\nif mysqld dies unexpectedly, any queued rows that have not\nbeen written to disk\nare lost.\n \nThe number of concurrent INSERT DELAYED threads is limited\nby the max_delayed_threads server system variables. If it is\nset to 0, INSERT DELAYED is disabled. The session value can\nbe equal to the global value, or 0 to disable this statement\nfor the current session. If this limit has been reached, the\nDELAYED clause will be silently ignore for subsequent\nstatements (no error will be produced).\n \nThere are some constraints on the use of DELAYED:\nINSERT DELAYED works only with MyISAM, MEMORY, ARCHIVE,\n and BLACKHOLE tables. If you execute INSERT DELAYED with\nanother storage engine, you will get an error like this:\nERROR 1616 (HY000): DELAYED option not supported for table\n\'tab_name\'\nFor MyISAM tables, if there are no free blocks in the middle\nof the data\n file, concurrent SELECT and INSERT statements are\nsupported. Under these\n circumstances, you very seldom need to use INSERT DELAYED\n with MyISAM.\nINSERT DELAYED should be used only for\n INSERT statements that specify value lists. The server\n ignores DELAYED for INSERT ... SELECT\n or INSERT ... ON DUPLICATE KEY UPDATE statements.\nBecause the INSERT DELAYED statement returns immediately,\n before the rows are inserted, you cannot use\n LAST_INSERT_ID() to get the\n AUTO_INCREMENT value that the statement might generate.\nDELAYED rows are not visible to SELECT\n statements until they actually have been inserted.\nAfter INSERT DELAYED, ROW_COUNT() returns the number of the\nrows you tried to insert, not the number of the successful\nwrites.\nDELAYED is ignored on slave replication servers, so that \n INSERT DELAYED is treated as a normal\n INSERT on slaves. This is because\n DELAYED could cause the slave to have different data than\n the master. INSERT DELAYED statements are not safe for\nreplication.\nPending INSERT DELAYED statements are lost if a table is\n write locked and ALTER TABLE is used to modify the table\nstructure.\nINSERT DELAYED is not supported for views. If you try, you\nwill get an error like this: ERROR 1347 (HY000):\n\'view_name\' is not BASE TABLE\nINSERT DELAYED is not supported for partitioned tables.\nINSERT DELAYED is not supported within stored programs.\n \n\n\nURL: https://mariadb.com/kb/en/insert-delayed/','','https://mariadb.com/kb/en/insert-delayed/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (422,27,'INSERT IGNORE','Ignoring Errors\n \nNormally INSERT stops and rolls back when it encounters an\nerror.\n \nBy using the IGNORE keyword all errors are converted to\nwarnings, which will not stop inserts of additional rows.\n \nThe IGNORE and DELAYED options are ignored when you use ON\nDUPLICATE KEY UPDATE.\n \nIncompatibilities\n \nMariaDB until 5.5.28\nMySQL and MariaDB before 5.5.28 didn\'t give warnings for\nduplicate key errors when using IGNORE.\nYou can get the old behaviour if you set OLD_MODE to\nNO_DUP_KEY_WARNINGS_WITH_IGNORE\n \nExamples\n-------- \nCREATE TABLE t1 (x INT UNIQUE);\n \nINSERT INTO t1 VALUES(1),(2);\n \nINSERT INTO t1 VALUES(2),(3);\nERROR 1062 (23000): Duplicate entry \'2\' for key \'x\'\nSELECT * FROM t1;\n \n+------+\n| x |\n+------+\n| 1 |\n| 2 |\n+------+\n2 rows in set (0.00 sec)\n \nINSERT IGNORE INTO t1 VALUES(2),(3);\nQuery OK, 1 row affected, 1 warning (0.04 sec)\n \nSHOW WARNINGS;\n \n+---------+------+---------------------------------+\n| Level | Code | Message |\n+---------+------+---------------------------------+\n| Warning | 1062 | Duplicate entry \'2\' for key \'x\' |\n+---------+------+---------------------------------+\n \nSELECT * FROM t1;\n \n+------+\n| x |\n+------+\n| 1 |\n| 2 |\n| 3 |\n+------+\n \nSee INSERT ON DUPLICATE KEY UPDATE for further examples\nusing that syntax.\n \n\n\nURL: https://mariadb.com/kb/en/insert-ignore/','','https://mariadb.com/kb/en/insert-ignore/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (423,27,'INSERT ON DUPLICATE KEY UPDATE','Syntax\n------ \nINSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [PARTITION (partition_list)] [(col,...)]\n {VALUES | VALUE} ({expr | DEFAULT},...),(...),...\n [ ON DUPLICATE KEY UPDATE\n col=expr\n [, col=expr] ... ]\n \nOr:\n \nINSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [PARTITION (partition_list)]\n SET col={expr | DEFAULT}, ...\n [ ON DUPLICATE KEY UPDATE\n col=expr\n [, col=expr] ... ]\n \nOr:\n \nINSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [PARTITION (partition_list)] [(col,...)]\n SELECT ...\n [ ON DUPLICATE KEY UPDATE\n col=expr\n [, col=expr] ... ]\n \nDescription\n----------- \nINSERT ... ON DUPLICATE KEY UPDATE is a MariaDB/MySQL\nextension to the INSERT statement that, if it finds a\nduplicate unique or primary key, will instead perform an\nUPDATE.\n \nThe row/s affected value is reported as 1 if a row is\ninserted, and 2 if a row is updated, unless the API\'s\nCLIENT_FOUND_ROWS flag is set.\n \nIf more than one unique index is matched, only the first is\nupdated. It is not recommended to use this statement on\ntables with more than one unique index.\n \nIf the table has an AUTO_INCREMENT primary key and the\nstatement inserts or updates a row, the LAST_INSERT_ID()\nfunction returns its AUTO_INCREMENT value.\n \nThe VALUES() function can only be used in a ON DUPLICATE KEY\nUPDATE clause and has no meaning in any other context. It\nreturns the column values from the INSERT portion of the\nstatement. This function is particularly useful for\nmulti-rows inserts.\n \nThe IGNORE and DELAYED options are ignored when you use ON\nDUPLICATE KEY UPDATE.\n \nThe PARTITION clause was introduced in MariaDB 10.0. See\nPartition Pruning and Selection for details.\n \nThis statement activates INSERT and UPDATE triggers. See\nTrigger Overview for details.\n \nSee also a similar statement, REPLACE.\n \nExamples\n-------- \nCREATE TABLE ins_duplicate (id INT PRIMARY KEY, animal\nVARCHAR(30));\nINSERT INTO ins_duplicate VALUES (1,\'Aardvark\'),\n(2,\'Cheetah\'), (3,\'Zebra\');\n \nIf there is no existing key, the statement runs as a regular\nINSERT:\n \nINSERT INTO ins_duplicate VALUES (4,\'Gorilla\') ON\nDUPLICATE KEY UPDATE animal=\'Gorilla\';\nQuery OK, 1 row affected (0.07 sec)\n \nSELECT * FROM ins_duplicate;\n+----+----------+\n| id | animal |\n+----+----------+\n| 1 | Aardvark |\n| 2 | Cheetah |\n| 3 | Zebra |\n| 4 | Gorilla |\n+----+----------+\n \nA regular INSERT with a primary key value of 1 will fail,\ndue to the existing key:\n \nINSERT INTO ins_duplicate VALUES (1,\'Antelope\');\nERROR 1062 (23000): Duplicate entry \'1\' for key\n\'PRIMARY\'\n \nHowever, we can use an INSERT ON DUPLICATE KEY UPDATE\ninstead:\n \nINSERT INTO ins_duplicate VALUES (1,\'Antelope\') ON\nDUPLICATE KEY UPDATE animal=\'Antelope\';\nQuery OK, 2 rows affected (0.09 sec)\n \nNote that there are two rows reported as affected, but this\nrefers only to the UPDATE.\n \nSELECT * FROM ins_duplicate;\n+----+----------+\n| id | animal |\n+----+----------+\n| 1 | Antelope |\n| 2 | Cheetah |\n| 3 | Zebra |\n| 4 | Gorilla |\n+----+----------+\n \nAdding a second unique column:\n \nALTER TABLE ins_duplicate ADD id2 INT;\nUPDATE ins_duplicate SET id2=id+10;\nALTER TABLE ins_duplicate ADD UNIQUE KEY(id2);\n \nWhere two rows match the unique keys match, only the first\nis updated. This can be unsafe and is not recommended unless\nyou are certain what you are doing. Note that the warning\nshown below appears in MariaDB 5.5 and before, but has been\nremoved in MariaDB 10.0, as MariaDB now assumes that the\nkeys are checked in order, as shown in SHOW CREATE TABLE.\n \nINSERT INTO ins_duplicate VALUES (2,\'Lion\',13) ON\nDUPLICATE KEY UPDATE animal=\'Lion\';\nQuery OK, 2 rows affected, 1 warning (0.06 sec)\n \nSHOW WARNINGS;\n+-------+------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n| Level | Code | Message |\n+-------+------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n| Note | 1592 | Unsafe statement written to the binary log\nusing statement format since BINLOG_FORMAT = STATEMENT.\nINSERT... ON DUPLICATE KEY UPDATE on a table with more than\none UNIQUE KEY is unsafe |\n+-------+------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n \nSELECT * FROM ins_duplicate;\n+----+----------+------+\n| id | animal | id2 |\n+----+----------+------+\n| 1 | Antelope | 11 |\n| 2 | Lion | 12 |\n| 3 | Zebra | 13 |\n| 4 | Gorilla | 14 |\n+----+----------+------+\n \nAlthough the third row with an id of 3 has an id2 of 13,\nwhich also matched, it was not updated.\n \nChanging id to an auto_increment field. If a new row is\nadded, the auto_increment is moved forward. If the row is\nupdated, it remains the same.\n \nALTER TABLE `ins_duplicate` CHANGE `id` `id` INT( 11 ) NOT\nNULL AUTO_INCREMENT;\nALTER TABLE ins_duplicate DROP id2;\nSELECT Auto_increment FROM INFORMATION_SCHEMA.TABLES WHERE\nTABLE_NAME=\'ins_duplicate\';\n+----------------+\n| Auto_increment |\n+----------------+\n| 5 |\n+----------------+\n \nINSERT INTO ins_duplicate VALUES (2,\'Leopard\') ON\nDUPLICATE KEY UPDATE animal=\'Leopard\';\nQuery OK, 2 rows affected (0.00 sec)\n \nSELECT Auto_increment FROM INFORMATION_SCHEMA.TABLES WHERE\nTABLE_NAME=\'ins_duplicate\';\n+----------------+\n| Auto_increment |\n+----------------+\n| 5 |\n+----------------+\n \nINSERT INTO ins_duplicate VALUES (5,\'Wild Dog\') ON\nDUPLICATE KEY UPDATE animal=\'Wild Dog\';\nQuery OK, 1 row affected (0.09 sec)\n \nSELECT * FROM ins_duplicate;\n+----+----------+\n| id | animal |\n+----+----------+\n| 1 | Antelope |\n| 2 | Leopard |\n| 3 | Zebra |\n| 4 | Gorilla |\n| 5 | Wild Dog |\n+----+----------+\n \nSELECT Auto_increment FROM INFORMATION_SCHEMA.TABLES WHERE\nTABLE_NAME=\'ins_duplicate\';\n+----------------+\n| Auto_increment |\n+----------------+\n| 6 |\n+----------------+\n \nRefering to column values from the INSERT portion of the\nstatement: \n \nINSERT INTO table (a,b,c) VALUES (1,2,3),(4,5,6)\n ON DUPLICATE KEY UPDATE c=VALUES(a)+VALUES(b);\n \nSee the VALUES() function for more.\n \n\n\nURL:\nhttps://mariadb.com/kb/en/insert-on-duplicate-key-update/','','https://mariadb.com/kb/en/insert-on-duplicate-key-update/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (424,27,'INSERT SELECT','Syntax\n------ \nINSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [(col_name,...)]\n SELECT ...\n [ ON DUPLICATE KEY UPDATE col_name=expr, ... ]\n \nDescription\n----------- \nWith INSERT ... SELECT, you can quickly insert many rows\ninto a table from one or more other 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 \ntbl_name can also be specified in the form db_name.tbl_name\n(see Identifier Qualifiers). This allows to copy rows\nbetween different databases.\n \nIf the new table has a primary key or UNIQUE indexes, you\ncan use IGNORE to handle duplicate key errors during the\nquery. The newer values will not be inserted if an identical\nvalue already exists.\n \nREPLACE can be used instead of INSERT to prevent duplicates\non UNIQUE indexes by deleting old values. In that case, ON\nDUPLICATE KEY UPDATE cannot be used.\n \nINSERT ... SELECT works for tables which already exist. To\ncreate a table for a given resultset, you can use CREATE\nTABLE ... SELECT.\n \n\n\nURL: https://mariadb.com/kb/en/insert-select/','','https://mariadb.com/kb/en/insert-select/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (425,27,'INTERSECT','INTERSECT was introduced in MariaDB 10.3.0.\n \nThe result of an intersect is the intersection of right and\nleft SELECT results, i.e. only records that are present in\nboth result sets will be included in the result of the\noperation.\n \nSyntax\n------ \nSELECT ...\n(INTERSECT | EXCEPT | UNION [ALL | DISTINCT]) SELECT ...\n[(INTERSECT | EXCEPT | UNION [ALL | DISTINCT]) SELECT ...]\n[ORDER BY [column [, column ...]]]\n[LIMIT {[offset,] row_count | row_count OFFSET offset}]\n \nPlease note:\nALL is not supported by INTERSECT (and it is difficult to\nmake sense of ALL with INTERSECT).\nBrackets for explicit operation precedence are not\nsupported; use a subquery in the FROM clause as a\nworkaround).\n \nDescription\n----------- \nMariaDB has supported INTERSECT (as well as EXCEPT) in\naddition to UNION since MariaDB 10.3.\n \nAll behavior for naming columns, ORDER BY and LIMIT is the\nsame as for UNION.\n \nINTERSECT implicitly supposes a DISTINCT operation.\n \nThe result of an intersect is the intersection of right and\nleft SELECT results, i.e. only records that are present in\nboth result sets will be included in the result of the\noperation.\n \nINTERSECT has higher precedence than UNION and EXCEPT. If\npossible it will be executed linearly but if not it will be\ntranslated to a subquery in the FROM clause:\n \n(select a,b from t1)\nunion\n(select c,d from t2)\nintersect\n(select e,f from t3)\nunion\n(select 4,4);\n \nwill be translated to:\n \n(select a,b from t1)\nunion\nselect c,d from\n ((select c,d from t2)\n intersect\n (select e,f from t3)) dummy_subselect\nunion\n(select 4,4)\n \n\n \nParentheses\n \nFrom MariaDB 10.4.0, parentheses can be used to specify\nprecedence. Before this, a syntax error would be returned.\n \nExamples\n-------- \nShow customers which are employees:\n \n(SELECT e_name AS name, email FROM employees)\nINTERSECT\n(SELECT c_name AS name, email FROM customers);\n \nDifference between UNION, EXCEPT and INTERSECT:\n \nCREATE TABLE seqs (i INT);\nINSERT INTO seqs VALUES (1),(2),(3),(4),(5),(6);\n \nSELECT i FROM seqs WHERE i =3;\n \n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n| 3 |\n| 4 |\n| 5 |\n| 6 |\n+------+\n \nSELECT i FROM seqs WHERE i =3;\n \n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n+------+\n \nSELECT i FROM seqs WHERE i =3;\n \n+------+\n| i |\n+------+\n| 3 |\n+------+\n \nParentheses for specifying precedence, from MariaDB 10.4.0\n \nCREATE OR REPLACE TABLE t1 (a INT);\nCREATE OR REPLACE TABLE t2 (b INT);\nCREATE OR REPLACE TABLE t3 (c INT);\n \nINSERT INTO t1 VALUES (1),(2),(3),(4);\nINSERT INTO t2 VALUES (5),(6);\nINSERT INTO t3 VALUES (1),(6);\n \n((SELECT a FROM t1) UNION (SELECT b FROM t2)) INTERSECT\n(SELECT c FROM t3);\n+------+\n| a |\n+------+\n| 1 |\n| 6 |\n+------+\n \n(SELECT a FROM t1) UNION ((SELECT b FROM t2) INTERSECT\n(SELECT c FROM t3));\n+------+\n| a |\n+------+\n| 1 |\n| 2 |\n| 3 |\n| 4 |\n| 6 |\n+------+\n \n\n\nURL: https://mariadb.com/kb/en/intersect/','','https://mariadb.com/kb/en/intersect/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (426,27,'JOIN Syntax','Description\n----------- \nMariaDB supports the following JOIN syntaxes for\nthe table_references part of SELECT statements and\nmultiple-table DELETE and UPDATE statements:\n \ntable_references:\n table_reference [, table_reference] ...\n \ntable_reference:\n table_factor\n | join_table\n \ntable_factor:\n tbl_name [PARTITION (partition_list)]\n [query_system_time_period_specification] [[AS] alias]\n[index_hint_list]\n | table_subquery [query_system_time_period_specification]\n[AS] alias\n | ( table_references )\n | { ON table_reference LEFT OUTER JOIN table_reference\n ON conditional_expr }\n \njoin_table:\n table_reference [INNER | CROSS] JOIN table_factor\n[join_condition]\n | table_reference STRAIGHT_JOIN table_factor\n | table_reference STRAIGHT_JOIN table_factor ON\nconditional_expr\n | table_reference {LEFT|RIGHT} [OUTER] JOIN table_reference\njoin_condition\n | table_reference NATURAL [{LEFT|RIGHT} [OUTER]] JOIN\ntable_factor\n \njoin_condition:\n ON conditional_expr\n | USING (column_list)\n \nquery_system_time_period_specification:\n FOR SYSTEM_TIME AS OF point_in_time\n | FOR SYSTEM_TIME BETWEEN point_in_time AND point_in_time\n | FOR SYSTEM_TIME FROM point_in_time TO point_in_time\n | FOR SYSTEM_TIME ALL\n \npoint_in_time:\n [TIMESTAMP] expression\n | TRANSACTION expression\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 \nEach table can also be specified as db_name.tabl_name. This\nallows to write queries which involve multiple databases.\nSee Identifier Qualifiers for syntax details.\n \nThe syntax of table_factor is extended in comparison with\nthe\nSQL Standard. The latter accepts only table_reference, not a\nlist of them inside a pair of parentheses.\n \nThis is a conservative extension if we consider each comma\nin a list of\ntable_reference items as equivalent to an inner join. For\nexample:\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 MariaDB, CROSS JOIN is a syntactic equivalent to\nINNER JOIN (they can replace each other). In standard SQL,\nthey are not equivalent. INNER JOIN is used with an\nON clause, CROSS JOIN is used otherwise.\n \nIn general, parentheses can be ignored in join expressions\ncontaining only\ninner join operations. MariaDB also supports nested joins\n(see\nhttp://dev.mysql.com/doc/refman/5.1/en/nested-join-optimization.html).\n \nSee System-versioned tables for more information\nabout FOR SYSTEM_TIME syntax.\n \nIndex hints can be specified to affect how the MariaDB\noptimizer makes\nuse of indexes. For more information, see How to force query\nplans.\n \nExamples\n-------- \nSELECT left_tbl.*\n FROM left_tbl LEFT JOIN right_tbl ON left_tbl.id =\nright_tbl.id\n WHERE right_tbl.id IS NULL;\n \n\n \n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/join-syntax/','','https://mariadb.com/kb/en/join-syntax/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (427,27,'LIMIT','Description\n----------- \nUse the LIMIT clause to restrict the number of returned\nrows. When you use a single\ninteger n with LIMIT, the first n rows will be returned. Use\nthe ORDER BY\nclause to control which rows come first. You can also select\na number of rows after an offset\nusing either of the following:\n \nLIMIT offset, row_count\nLIMIT row_count OFFSET offset\n \nWhen you provide an offset m with a limit n, the first m\nrows will be ignored, and the\nfollowing n rows will be returned.\n \nExecuting an UPDATE with the LIMIT clause is not safe for\nreplication.\n \nSince MariaDB 10.0.11, LIMIT 0 has been an exception to this\nrule (see MDEV-6170).\n \nBeginning in MariaDB 5.5.21, there is a LIMIT ROWS EXAMINED\noptimization which provides the\nmeans to terminate the execution of SELECT statements which\nexamine too\nmany rows, and thus use too many resources. See LIMIT ROWS\nEXAMINED.\n \nMulti-Table Updates\n \nUntil MariaDB 10.3.1, it was not possible to use LIMIT (or\nORDER BY) in a multi-table UPDATE statement. This\nrestriction was lifted in MariaDB 10.3.2.\n \nGROUP_CONCAT\n \nStarting from MariaDB 10.3.3, it is possible to use LIMIT\nwith GROUP_CONCAT().\n \nExamples\n-------- \nCREATE TABLE members (name VARCHAR(20));\nINSERT INTO members\nVALUES(\'Jagdish\'),(\'Kenny\'),(\'Rokurou\'),(\'Immaculada\');\n \nSELECT * FROM members;\n \n+------------+\n| name |\n+------------+\n| Jagdish |\n| Kenny |\n| Rokurou |\n| Immaculada |\n+------------+\n \nSelect the first two names (no ordering specified):\n \nSELECT * FROM members LIMIT 2;\n \n+---------+\n| name |\n+---------+\n| Jagdish |\n| Kenny |\n+---------+\n \nAll the names in alphabetical order:\n \nSELECT * FROM members ORDER BY name;\n \n+------------+\n| name |\n+------------+\n| Immaculada |\n| Jagdish |\n| Kenny |\n| Rokurou |\n+------------+\n \nThe first two names, ordered alphabetically:\n \nSELECT * FROM members ORDER BY name LIMIT 2;\n \n+------------+\n| name |\n+------------+\n| Immaculada |\n| Jagdish |\n+------------+\n \nThe third name, ordered alphabetically (the first name would\nbe offset zero, so the third is offset two):\n \nSELECT * FROM members ORDER BY name LIMIT 2,1;\n \n+-------+\n| name |\n+-------+\n| Kenny |\n+-------+\n \nFrom MariaDB 10.3.2, LIMIT can be used in a multi-table\nupdate:\n \nCREATE TABLE warehouse (product_id INT, qty INT);\nINSERT INTO warehouse VALUES\n(1,100),(2,100),(3,100),(4,100);\n \nCREATE TABLE store (product_id INT, qty INT);\nINSERT INTO store VALUES (1,5),(2,5),(3,5),(4,5);\n \nUPDATE warehouse,store SET warehouse.qty = warehouse.qty-2,\nstore.qty = store.qty+2 \n WHERE (warehouse.product_id = store.product_id AND\nstore.product_id >= 1) \n ORDER BY store.product_id DESC LIMIT 2;\n \nSELECT * FROM warehouse;\n \n+------------+------+\n| product_id | qty |\n+------------+------+\n| 1 | 100 |\n| 2 | 100 |\n| 3 | 98 |\n| 4 | 98 |\n+------------+------+\n \nSELECT * FROM store;\n \n+------------+------+\n| product_id | qty |\n+------------+------+\n| 1 | 5 |\n| 2 | 5 |\n| 3 | 7 |\n| 4 | 7 |\n+------------+------+\n \nFrom MariaDB 10.3.3, LIMIT can be used with GROUP_CONCAT,\nso, for example, given the following table:\n \nCREATE TABLE d (dd DATE, cc INT);\n \nINSERT INTO d VALUES (\'2017-01-01\',1);\nINSERT INTO d VALUES (\'2017-01-02\',2);\nINSERT INTO d VALUES (\'2017-01-04\',3);\n \nthe following query:\n \nSELECT SUBSTRING_INDEX(GROUP_CONCAT(CONCAT_WS(\":\",dd,cc)\nORDER BY cc DESC),\",\",1) FROM d;\n \n+----------------------------------------------------------------------------+\n| SUBSTRING_INDEX(GROUP_CONCAT(CONCAT_WS(\":\",dd,cc) ORDER\nBY cc DESC),\",\",1) |\n+----------------------------------------------------------------------------+\n| 2017-01-04:3 |\n+----------------------------------------------------------------------------+\n \ncan be more simply rewritten as:\n \nSELECT GROUP_CONCAT(CONCAT_WS(\":\",dd,cc) ORDER BY cc DESC\nLIMIT 1) FROM d;\n \n+-------------------------------------------------------------+\n| GROUP_CONCAT(CONCAT_WS(\":\",dd,cc) ORDER BY cc DESC LIMIT\n1) |\n+-------------------------------------------------------------+\n| 2017-01-04:3 |\n+-------------------------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/limit/','','https://mariadb.com/kb/en/limit/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (428,27,'LOAD DATA INFILE','Syntax\n------ \nLOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE\n\'file_name\'\n [REPLACE | IGNORE]\n INTO TABLE tbl_name\n [CHARACTER SET charset_name]\n [{FIELDS | COLUMNS}\n [TERMINATED BY \'string\']\n [[OPTIONALLY] ENCLOSED BY \'char\']\n [ESCAPED BY \'char\']\n ]\n [LINES\n [STARTING BY \'string\']\n [TERMINATED BY \'string\']\n ]\n [IGNORE number LINES]\n [(col_name_or_user_var,...)]\n [SET col_name = expr,...]\n \nDescription\n----------- \nReads rows from a text file into the designated table on the\ndatabase at a very high speed. The file name must be given\nas a literal string. \n \nFiles are written to disk using the SELECT INTO OUTFILE\nstatement. You can then read the files back into a table\nusing the LOAD DATA INFILE statement. The FIELDS and LINES\nclauses are the same in both statements. These clauses are\noptional, but if both are specified then the FIELDS clause\nmust precede LINES.\n \nIn releases after MariaDB 5.5, LOAD DATA INFILE is unsafe\nfor statement-based replication.\n \nExecuting this statement activates INSERT triggers.\n \nREPLACE and IGNORE\n \nIn cases where you load data from a file into a table that\nalready contains data and has a Primary Key, you may\nencounter issues where the statement attempts to insert a\nrow with a Primary Key that already exists. When this\nhappens, the statement fails with Error 1064, protecting the\ndata already on the table. In cases where you want MariaDB\nto overwrite duplicates, use the REPLACE keyword.\n \nThe REPLACE keyword works like the REPLACE statement. Here,\nthe statement attempts to load the data from the file. If\nthe row does not exist, it adds it to the table. If the row\ncontains an existing Primary Key, it replaces the table\ndata. That is, in the event of a conflict, it assumes the\nfile contains the desired row. \n \nThis operation can cause a degradation in load speed by a\nfactor of 20 or more if the part that has already been\nloaded is larger than the capacity of the InnoDB Buffer\nPool. This happens because it causes a lot of turnaround in\nthe Buffer Pool.\n \nUse the IGNORE keyword when you want to skip any rows that\ncontain a conflicting Primary Key. Here, the statement\nattempts to load the data from the file. If the row does not\nexist, it adds it to the table. If the row contains an\nexisting Primary Key, it ignores the addition request and\nmoves on to the next. That is, in the event of a conflict,\nit assumes the table contains the desired row.\n \nLOCAL\n \nWhen you issue this statement, the Server attempts to read\nfiles from the host file system. Using the LOCAL keyword,\nthe statement instead attempts to read files from the\nclient. This allows you to insert files from the client\'s\nlocal file system into the database.\n \nIn the event that you don\'t want the server to permit this\noperation, (such as for security reasons), you can disable\nsupport using local_infile. When this system variable is set\nto 0, MariaDB rejects LOAD DATA LOCAL INFILE statements,\nfailing with an error message.\n \nCharacter-sets\n \nWhen the statement opens the file, it attempts to read the\ncontents using the default character-set, as defined by the\ncharacter_set_database system variable. \n \nIn the cases where the file was written using a\ncharacter-set other than the default, you can specify the\ncharacter-set to use with the CHARACTER SET clause in the\nstatement. It ignores character-sets specified by the SET\nNAMES statement and by the character_set_client system\nvariable. Setting the CHARACTER SET clause to a value of\nbinary indicates \"no conversion.\"\n \nThe statement interprets all fields in the file as having\nthe same character-set, regardless of the column data type.\nTo properly interpret file contents, you must ensure that it\nwas written with the correct character-set. If you write a\ndata file with mysqldump -T or with the SELECT INTO OUTFILE\nstatement with the mysql client, be sure to use the\n--default-character-set option, so that the output is\nwritten with the desired character-set.\n \nWhen using mixed character sets, use the CHARACTER SET\nclause in both SELECT INTO OUTFILE and LOAD DATA INFILE to\nensure that MariaDB correctly interprets the escape\nsequences.\n \nThe character_set_filesystem system variable controls the\ninterpretation of the filename.\n \nIt is currently not possible to load data files that use the\nucs2 character set.\n \nPriority and Concurrency\n \nIn loading data from a file, there\'s a risk that the\nstatement will attempt insertions concurrent with reads from\nanother client, which can result in the read serving a\nresult-set that contains only part of the update from the\nLOAD DATA INFILE statement.\n \nUsing the LOW_PRIORITY keyword, MariaDB delays insertions\nuntil no other clients are reading from the table.\nAlternatively, you can use the CONCURRENT keyword to perform\nconcurrent insertion.\n \nThe LOW_PRIORITY and CONCURRENT keywords are mutually\nexclusive. They cannot be used in the same statement.\n \nProgress Reporting\n \nSince MariaDB 5.3, the LOAD DATA INFILE statement supports\nprogress reporting. You may find this useful when dealing\nwith long-running operations. Using another client you can\nissue a SHOW PROCESSLIST query to check the progress of the\ndata load.\n \nUsing mysqlimport\n \nMariaDB ships with a separate utility for loading data from\nfiles: mysqlimport. It operates by sending LOAD DATA INFILE\nstatements to the server.\n \nUsing mysqlimport you can compress the file using the\n--compress option, to get better performance over slow\nnetworks, providing both the client and server support the\ncompressed protocol. Use the --local option to load from the\nlocal file system.\n \nIndexing\n \nIn cases where the storage engine supports ALTER TABLE...\nDISABLE KEYS statements, the LOAD DATA INFILE statement\nautomatically disables indexes during the execution.\n \n\n\nURL: https://mariadb.com/kb/en/load-data-infile/','','https://mariadb.com/kb/en/load-data-infile/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (429,27,'LOAD XML','Syntax\n------ \nLOAD XML [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE\n\'file_name\'\n [REPLACE | IGNORE]\n INTO TABLE [db_name.]tbl_name\n [CHARACTER SET charset_name]\n [ROWS IDENTIFIED BY \'\']\n [IGNORE number {LINES | ROWS}]\n [(column_or_user_var,...)]\n [SET col_name = expr,...]\n \nDescription\n----------- \nThe LOAD XML statement reads data from an XML file into a\ntable. The\nfile_name must be given as a literal string. The tagname in\nthe\noptional ROWS IDENTIFIED BY clause must also be given as a\nliteral\nstring, and must be surrounded by angle brackets (< and >).\n \nLOAD XML acts as the complement of running the mysql client\nin XML\noutput mode (that is, starting the client with the --xml\noption). To\nwrite data from a table to an XML file, use a command such\nas 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\ndefault,\nthe element is considered to be the equivalent of a\ndatabase\ntable row; this can be changed using the ROWS IDENTIFIED BY\nclause.\n \nThis statement supports three different XML formats:\nColumn names as attributes and column values as attribute\nvalues:\n \nColumn names as tags and column values as the content of\nthese tags:\n \n value1\n value2\n \nColumn names are the name attributes of tags, and values\nare\n the contents of these tags:\n \n value1\n value2\n \n This is the format used by other tools, such as mysqldump.\n \nAll 3 formats can be used in the same XML file; the import\nroutine\nautomatically detects the format for each row and interprets\nit\ncorrectly. Tags are matched based on the tag or attribute\nname and the\ncolumn name.\n \nThe following clauses work essentially the same way for LOAD\nXML as\nthey do for LOAD DATA:\nLOW_PRIORITY or CONCURRENT\nLOCAL\nREPLACE or IGNORE\nCHARACTER SET\n(column_or_user_var,...)\nSET\n \nSee LOAD DATA for more information about these clauses.\n \nThe IGNORE number LINES or IGNORE number ROWS clause causes\nthe first\nnumber rows in the XML file to be skipped. It is analogous\nto the LOAD\nDATA statement\'s IGNORE ... LINES clause.\n \nIf the LOW_PRIORITY keyword is used, insertions are delayed\nuntil no other clients are reading from the table. The\nCONCURRENT keyword allowes the use of concurrent inserts.\nThese clauses cannot be specified together.\n \nThis statement activates INSERT triggers.\n \n\n\nURL: https://mariadb.com/kb/en/load-xml/','','https://mariadb.com/kb/en/load-xml/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (430,27,'LOCK IN SHARE MODE','When LOCK IN SHARE MODE is specified in a SELECT statement,\nMariaDB will wait until all transactions that have modified\nthe rows are committed. Then, a write lock is acquired. All\ntransactions can read the rows, but if they want to modify\nthem, they have to wait until your transaction is committed.\n \nInnoDB/XtraDB supports row-level locking. selected rows can\nbe locked using LOCK IN SHARE MODE or FOR UPDATE. In both\ncases, a lock is acquired on the rows read by the query, and\nit will be released when the current transaction is\ncommitted.\n \nIf autocommit is set to 1, the LOCK IN SHARE MODE and FOR\nUPDATE clauses have no effect.\n \n\n\nURL: https://mariadb.com/kb/en/lock-in-share-mode/','','https://mariadb.com/kb/en/lock-in-share-mode/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (431,27,'Non-Recursive Common Table Expressions Overview','Common Table Expressions (CTEs) are a standard SQL feature,\nand are essentially temporary named result sets. There are\ntwo kinds of CTEs: Non-Recursive, which this article covers;\nand Recursive.\n \nCommon table expressions were introduced in MariaDB 10.2.1.\n \nNon-Recursive CTEs\n \nThe WITH keyword signifies a CTE. It is given a name,\nfollowed by a body (the main query) as follows:\n \nCTEs are similar to derived tables. For example\n \nWITH engineers AS \n ( SELECT * FROM employees\n WHERE dept = \'Engineering\' )\n \nSELECT * FROM engineers\nWHERE ...\n \nSELECT * FROM\n ( SELECT * FROM employees\n WHERE dept = \'Engineering\' ) AS engineers\nWHERE\n...\n \nA non-recursive CTE is basically a query-local VIEW. There\nare several advantages and caveats to them. The syntax is\nmore readable than nested FROM (SELECT ...).\nA CTE can refer to another and it can be referenced from\nmultiple places.\n \nA CTE referencing Another CTE\n \nUsing this format makes for a more readable SQL than a\nnested FROM(SELECT ...) clause. Below is an example of this:\n \nWITH engineers AS (\nSELECT * FROM employees\nWHERE dept IN(\'Development\',\'Support\') ),\neu_engineers AS ( SELECT * FROM engineers WHERE country\nIN(\'NL\',...) )\nSELECT\n...\nFROM eu_engineers;\n \nMultiple Uses of a CTE\n \nThis can be an \'anti-self join\', for example:\n \nWITH engineers AS (\nSELECT * FROM employees\nWHERE dept IN(\'Development\',\'Support\') )\n \nSELECT * FROM engineers E1\nWHERE NOT EXISTS\n (SELECT 1 FROM engineers E2\n WHERE E2.country=E1.country\n AND E2.name E1.name );\n \nOr, for year-over-year comparisons, for example:\n \nWITH sales_product_year AS (\nSELECT product, YEAR(ship_date) AS year,\nSUM(price) AS total_amt\nFROM item_sales\nGROUP BY product, year )\n \nSELECT *\nFROM sales_product_year CUR,\nsales_product_year PREV,\nWHERE CUR.product=PREV.product \nAND CUR.year=PREV.year + 1 \nAND CUR.total_amt > PREV.total_amt\n \nAnother use is to compare individuals against their group.\nBelow is an example of how this might be executed:\n \nWITH sales_product_year AS (\nSELECT product,\nYEAR(ship_date) AS year,\nSUM(price) AS total_amt\nFROM item_sales\nGROUP BY product, year\n)\n \nSELECT * \nFROM sales_product_year S1\nWHERE\ntotal_amt > \n (SELECT 0.1 * SUM(total_amt)\n FROM sales_product_year S2\n WHERE S2.year = S1.year)\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/non-recursive-common-table-expressions-overview/','','https://mariadb.com/kb/en/non-recursive-common-table-expressions-overview/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (432,27,'ORDER BY','Description\n----------- \nUse the ORDER BY clause to order a resultset, such as that\nare returned from a SELECT\nstatement. You can specify just a column or use any\nexpression with functions. If you are\nusing the GROUP BY clause, you can use grouping functions in\nORDER BY.\nOrdering is done after grouping.\n \nYou can use multiple ordering expressions, separated by\ncommas. Rows will be sorted by\nthe first expression, then by the second expression if they\nhave the same value for the\nfirst, and so on.\n \nYou can use the keywords ASC and DESC after each ordering\nexpression to\nforce that ordering to be ascending or descending,\nrespectively. Ordering is ascending\nby default.\n \nYou can also use a single integer as the ordering\nexpression. If you use an integer n,\nthe results will be ordered by the nth column in the select\nexpression.\n \nWhen string values are compared, they are compared as if by\nthe STRCMP\nfunction. STRCMP ignores trailing whitespace and may\nnormalize\ncharacters and ignore case, depending on the collation in\nuse.\n \nStarting from MariaDB 5.5.35 duplicated entries in the ORDER\nBY clause are removed. MySQL 5.6 also removes duplicated\nfields.\n \nORDER BY can also be used to order the activities of a\nDELETE or UPDATE statement (usually with the LIMIT clause). \n \nUntil MariaDB 10.3.1, it was not possible to use ORDER BY\n(or LIMIT) in a multi-table UPDATE statement. This\nrestriction was lifted in MariaDB 10.3.2.\n \nExamples\n-------- \nCREATE TABLE seq (i INT, x VARCHAR(1));\nINSERT INTO seq VALUES (1,\'a\'), (2,\'b\'), (3,\'b\'),\n(4,\'f\'), (5,\'e\');\n \nSELECT * FROM seq ORDER BY i;\n \n+------+------+\n| i | x |\n+------+------+\n| 1 | a |\n| 2 | b |\n| 3 | b |\n| 4 | f |\n| 5 | e |\n+------+------+\n \nSELECT * FROM seq ORDER BY i DESC;\n \n+------+------+\n| i | x |\n+------+------+\n| 5 | e |\n| 4 | f |\n| 3 | b |\n| 2 | b |\n| 1 | a |\n+------+------+\n \nSELECT * FROM seq ORDER BY x,i;\n \n+------+------+\n| i | x |\n+------+------+\n| 1 | a |\n| 2 | b |\n| 3 | b |\n| 5 | e |\n| 4 | f |\n+------+------+\n \nORDER BY in an UPDATE statement, in conjunction with LIMIT:\n \nUPDATE seq SET x=\'z\' WHERE x=\'b\' ORDER BY i DESC LIMIT\n1;\n \nSELECT * FROM seq;\n \n+------+------+\n| i | x |\n+------+------+\n| 1 | a |\n| 2 | b |\n| 3 | z |\n| 4 | f |\n| 5 | e |\n+------+------+\n \nFrom MariaDB 10.3.2, ORDER BY can be used in a multi-table\nupdate:\n \nCREATE TABLE warehouse (product_id INT, qty INT);\nINSERT INTO warehouse VALUES\n(1,100),(2,100),(3,100),(4,100);\n \nCREATE TABLE store (product_id INT, qty INT);\nINSERT INTO store VALUES (1,5),(2,5),(3,5),(4,5);\n \nUPDATE warehouse,store SET warehouse.qty = warehouse.qty-2,\nstore.qty = store.qty+2 \n WHERE (warehouse.product_id = store.product_id AND\nstore.product_id >= 1) \n ORDER BY store.product_id DESC LIMIT 2;\n \nSELECT * FROM warehouse;\n \n+------------+------+\n| product_id | qty |\n+------------+------+\n| 1 | 100 |\n| 2 | 100 |\n| 3 | 98 |\n| 4 | 98 |\n+------------+------+\n \nSELECT * FROM store;\n \n+------------+------+\n| product_id | qty |\n+------------+------+\n| 1 | 5 |\n| 2 | 5 |\n| 3 | 7 |\n| 4 | 7 |\n+------------+------+\n \n\n\nURL: https://mariadb.com/kb/en/order-by/','','https://mariadb.com/kb/en/order-by/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (433,27,'PROCEDURE','The PROCEDURE clause of SELECT passes the whole result set\nto a Procedure which will process it. These Procedures are\nnot Stored Procedures, and can only be written in the C\nlanguage, so it is necessary to recompile the server.\n \nCurrently, the only available procedure is ANALYSE, which\nexamines the resultset and suggests the optimal datatypes\nfor each column. It is defined in the sql/sql_analyse.cc\nfile, and can be used as an example to create more\nProcedures.\n \nThis clause cannot be used in a view\'s definition.\n \n\n\nURL: https://mariadb.com/kb/en/procedure/','','https://mariadb.com/kb/en/procedure/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (434,27,'Recursive Common Table Expressions Overview','Recursive Common Table Expressions have been supported since\nMariaDB 10.2.2.\n \nCommon Table Expressions (CTEs) are a standard SQL feature,\nand are essentially temporary named result sets. CTEs first\nappeared in the SQL standard in 1999, and the first\nimplementations began appearing in 2007.\n \nThere are two kinds of CTEs:\nNon-recursive\nRecursive, which this article covers.\n \nSQL is generally poor at recursive structures.\n \nCTEs permit a query to reference itself. A recursive CTE\nwill repeatedly execute subsets of the data until it obtains\nthe complete result set. This makes it particularly useful\nfor handing hierarchical or tree-structured data.\n \nSyntax example\n \nWITH RECURSIVE signifies a recursive CTE. It is given a\nname, followed by a body (the main query) as follows:\n \n\nComputation\n \nGiven the following structure:\n \nFirst execute the anchor part of the query:\n \nNext, execute the recursive part of the query:\n \n\n \n\nSummary so far\n \nwith recursive R as (\n select anchor_data\n union [all]\n select recursive_part\n from R, ...\n)\nselect ...\nCompute anchor_data\nCompute recursive_part to get the new data\nif (new data is non-empty) goto 2;\n \nCAST to avoid truncating data\n \nAs currently implemented by MariaDB and by the SQL Standard,\ndata may be truncated if not correctly cast. It is necessary\nto CAST the column to the correct width if the CTE\'s\nrecursive part produces wider values for a column than the\nCTE\'s nonrecursive part. Some other DBMS give an error in\nthis situation, and MariaDB\'s behavior may change in future\n- see MDEV-12325. See the examples below.\n \nExamples\n-------- \nTransitive closure - determining bus destinations\n \nSample data:\n \nCREATE TABLE bus_routes (origin varchar(50), dst\nvarchar(50));\nINSERT INTO bus_routes VALUES \n (\'New York\', \'Boston\'), \n (\'Boston\', \'New York\'), \n (\'New York\', \'Washington\'), \n (\'Washington\', \'Boston\'), \n (\'Washington\', \'Raleigh\');\n \nNow, we want to return the bus destinations with New York as\nthe origin:\n \nWITH RECURSIVE bus_dst as ( \n SELECT origin as dst FROM bus_routes WHERE origin=\'New\nYork\' \n UNION\n SELECT bus_routes.dst FROM bus_routes, bus_dst WHERE\nbus_dst.dst= bus_routes.origin \n) \nSELECT * FROM bus_dst;\n \n+------------+\n| dst |\n+------------+\n| New York |\n| Boston |\n| Washington |\n| Raleigh |\n+------------+\n \nThe above example is computed as follows:\n \nFirst, the anchor data is calculated:\nStarting from New York\nBoston and Washington are added\n \nNext, the recursive part:\nStarting from Boston and then Washington\nRaleigh is added\nUNION excludes nodes that are already present.\n \nComputing paths - determining bus routes\n \nThis time, we are trying to get bus routes such as “New\nYork -> Washington -> Raleighâ€.\n \nUsing the same sample data as the previous example:\n \nWITH RECURSIVE paths (cur_path, cur_dest) AS (\n SELECT origin, origin FROM bus_routes WHERE origin=\'New\nYork\' \n UNION\n SELECT CONCAT(paths.cur_path, \',\', bus_routes.dst),\nbus_routes.dst \n FROM paths, bus_routes \n WHERE paths.cur_dest = bus_routes.origin AND \n LOCATE(bus_routes.dst, paths.cur_path)=0 \n) \nSELECT * FROM paths;\n \n+-----------------------------+------------+\n| cur_path | cur_dest |\n+-----------------------------+------------+\n| New York | New York |\n| New York,Boston | Boston |\n| New York,Washington | Washington |\n| New York,Washington,Boston | Boston |\n| New York,Washington,Raleigh | Raleigh |\n+-----------------------------+------------+\n \nCAST to avoid data truncation\n \nIn the following example, data is truncated because the\nresults are not specifically cast to a wide enough type:\n \nWITH RECURSIVE tbl AS (\n SELECT NULL AS col\n UNION\n SELECT \"THIS NEVER SHOWS UP\" AS col FROM tbl\n)\n+------+\n| col |\n+------+\n| NULL |\n| |\n+------+\n \nExplicitly use CAST to overcome this:\n \nWITH RECURSIVE tbl AS (\n SELECT CAST(NULL AS CHAR(50)) AS col\n UNION SELECT \"THIS NEVER SHOWS UP\" AS col FROM tbl\n) \nSELECT * FROM tbl;\n \n+---------------------+\n| col |\n+---------------------+\n| NULL |\n| THIS NEVER SHOWS UP |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/recursive-common-table-expressions-overview/','','https://mariadb.com/kb/en/recursive-common-table-expressions-overview/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (435,27,'REPLACE','Syntax\n------ \nREPLACE [LOW_PRIORITY | DELAYED]\n [INTO] tbl_name [PARTITION (partition_list)] [(col,...)]\n {VALUES | VALUE} ({expr | DEFAULT},...),(...),...\n \nOr:\n \nREPLACE [LOW_PRIORITY | DELAYED]\n [INTO] tbl_name [PARTITION (partition_list)]\n SET col={expr | DEFAULT}, ...\n \nOr:\n \nREPLACE [LOW_PRIORITY | DELAYED]\n [INTO] tbl_name [PARTITION (partition_list)] [(col,...)]\n SELECT ...\n \nDescription\n----------- \n REPLACE works exactly like\n INSERT, except that if an old row in the table\n has the same value as a new row for a PRIMARY KEY or a\n UNIQUE index, the old row is deleted before the new row is\n inserted. If the table has more than one UNIQUE keys, it is\npossible that the new row conflicts with more than one row.\nIn this case, all conflicting rows will be deleted.\n \nThe table name can be specified in the form db_name.tbl_name\nor, if a default database is selected, in the form tbl_name\n(see Identifier Qualifiers). This allows to use REPLACE ...\nSELECT to copy rows between different databases.\n \nBasically it works like this:\n \nBEGIN;\nSELECT 1 FROM t1 WHERE key=# FOR UPDATE;\nIF found-row\n DELETE FROM t1 WHERE key=# ;\n INSERT INTO t1 VALUES (...);\nENDIF\nEND;\n \nThe above can be replaced with:\n \nREPLACE INTO t1 VALUES (...)\n \n REPLACE is a MariaDB/MySQL extension to the SQL standard.\nIt\n either inserts, or deletes and inserts. For other\nMariaDB/MySQL extensions to\n standard SQL --- that also handle duplicate values --- see\nIGNORE and INSERT ON DUPLICATE KEY UPDATE.\n \nNote that unless the table has a PRIMARY KEY or\n UNIQUE index, using a REPLACE statement\nmakes no sense. It becomes equivalent to INSERT, because\nthere 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\nin the\n REPLACE statement. Any missing columns are set to their\ndefault values, just as happens for INSERT. You cannot refer\nto values from the current row and use them in the new row.\nIf you use an\nassignment such as \'SET col = col + 1\', the\nreference to the column name on the right hand side is\ntreated as\n DEFAULT(col), so the assignment is equivalent to\n \'SET col = DEFAULT(col) + 1\'.\n \nTo use REPLACE, you must have both the\n INSERT and DELETE privileges\nfor the table.\n \nThere are some gotchas you should be aware of, before using\nREPLACE:\nIf there is an AUTO_INCREMENT field, a new value will be\ngenerated.\nIf there are foreign keys, ON DELETE action will be\nactivated by REPLACE.\nTriggers on DELETE and INSERT will be activated by REPLACE.\n \nTo avoid some of these behaviors, you can use INSERT ... ON\nDUPLICATE KEY UPDATE.\n \nThe PARTITION clause was introduced in MariaDB 10.0. See\nPartition Pruning and Selection for details.\n \nThis statement activates INSERT and DELETE triggers. See\nTrigger Overview for details.\n \n\n\nURL: https://mariadb.com/kb/en/replace/','','https://mariadb.com/kb/en/replace/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (436,27,'SELECT','Syntax\n------ \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} [ASC | DESC], ...\n[WITH ROLLUP]]\n [HAVING where_condition]\n [ORDER BY {col_name | expr | position} [ASC | DESC], ...]\n [LIMIT {[offset,] row_count | row_count OFFSET offset}]\n procedure|[PROCEDURE procedure_name(argument_list)]\n [INTO OUTFILE \'file_name\' [CHARACTER SET charset_name]\n[export_options]\n \nINTO DUMPFILE \'file_name\' | INTO var_name [, var_name] ] |\n\n \n [[FOR UPDATE | LOCK IN SHARE MODE] [WAIT n | NOWAIT] ] ]\n \nexport_options:\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 \nDescription\n----------- \nSELECT is used to retrieve rows selected from one or more\ntables, and can include UNION statements and subqueries.\nEach select_expr expression indicates a column or data that\nyou want to retrieve. You\nmust have at least one select expression. See Select\nExpressions below.\n \nThe FROM clause indicates the table or tables from which to\nretrieve rows.\nUse either a single table name or a JOIN expression. See\nJOIN\nfor details. If no table is involved, FROM DUAL can be\nspecified.\n \nThe PARTITION clause was introduced in MariaDB 10.0. See\nPartition Pruning and Selection for details.\nEach table can also be specified as db_name.tabl_name. Each\ncolumn can also be specified as tbl_name.col_name or even\ndb_name.tbl_name.col_name. This allows to write queries\nwhich involve multiple databases. See Identifier Qualifiers\nfor syntax details.\n \nThe WHERE clause, if given, indicates the condition or\n conditions that rows must satisfy to be selected.\n where_condition is an expression that evaluates to true for\n each row to be selected. The statement selects all rows if\nthere is no WHERE\n clause.\nIn the WHERE clause, you can use any of the functions and\n operators that MariaDB supports, except for aggregate\n(summary) functions. See Functions and Operators and\nFunctions and Modifiers for use with GROUP BY (aggregate).\n \nUse the ORDER BY clause to order the results.\n \nUse the LIMIT clause allows you to restrict the results to\nonly\na certain number of rows, optionally with an offset.\n \nUse the GROUP BY and HAVING clauses to group\nrows together when they have columns or computed values in\ncommon.\n \nSELECT can also be used to retrieve rows computed without\nreference to\nany table.\n \nSelect Expressions\n \nA SELECT statement must contain one or more select\nexpressions, separated\nby commas. Each select expression can be one of the\nfollowing:\nThe name of a column.\nAny expression using functions and operators.\n* to select all columns from all tables in the FROM clause.\ntbl_name.* to select all columns from just the table\ntbl_name.\n \nWhen specifying a column, you can either use just the column\nname or qualify the column\nname with the name of the table using tbl_name.col_name. The\nqualified form is\nuseful if you are joining multiple tables in the FROM\nclause. If you do not qualify the\ncolumn names when selecting from multiple tables, MariaDB\nwill try to find the column in\neach table. It is an error if that column name exists in\nmultiple tables.\n \nYou can quote column names using backticks. If you are\nqualifying column names\nwith table names, quote each part separately as\n`tbl_name`.`col_name`.\n \nIf you use any grouping functions\nin any of the select expressions, all rows in your results\nwill be implicitly grouped, as if\nyou had used GROUP BY NULL.\n \nDISTINCT\n \nA query may produce some identical rows. By default, all\nrows are retrieved, even when their values are the same. To\nexplicitly specify that you want to retrieve identical rows,\nuse the ALL option. If you want duplicates to be removed\nfrom the resultset, use the DISTINCT option. DISTINCTROW is\na synonym for DISTINCT. See also COUNT DISTINCT and SELECT\nUNIQUE in Oracle mode.\n \nINTO\n \nThe INTO clause is used to specify that the query results\nshould be written to a file or variable.\nSELECT INTO OUTFILE - formatting and writing the result to\nan external file.\nSELECT INTO DUMPFILE - binary-safe writing of the\nunformatted results to an external file.\nSELECT INTO Variable - selecting and setting variables.\n \nThe reverse of SELECT INTO OUTFILE is LOAD DATA.\n \nWAIT/NOWAIT\n \nSet the lock wait timeout. See WAIT and NOWAIT.\n \nPROCEDURE\n \nPasses the whole result set to a C Procedure. See PROCEDURE\nand PROCEDURE ANALYSE (the only built-in procedure not\nrequiring the server to be recompiled).\n \n\nmax_statement_time clause\n \nBy using max_statement_time in conjunction with SET\nSTATEMENT, it is possible to limit the execution time of\nindividual queries. For example:\n \nSET STATEMENT max_statement_time=100 FOR \n SELECT field1 FROM table_name ORDER BY field1;\n \n\n\nURL: https://mariadb.com/kb/en/select/','','https://mariadb.com/kb/en/select/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (437,27,'SELECT INTO DUMPFILE','Syntax\n------ \nSELECT ... INTO DUMPFILE \'file_path\'\n \nDescription\n----------- \nSELECT ... INTO DUMPFILE is a SELECT clause which writes the\nresultset into a single unformatted row, without any\nseparators, in a file. The results will not be returned to\nthe client.\n \nfile_path can be an absolute path, or a relative path\nstarting from the data directory. It can only be specified\nas a string literal, not as a variable. However, the\nstatement can be dynamically composed and executed as a\nprepared statement to work around this limitation.\n \nThis statement is binary-safe and so is particularly useful\nfor writing BLOB values to file. It can be used, for\nexample, to copy an image or an audio document from the\ndatabase to a file. SELECT ... INTO FILE can be used to save\na text file.\n \nThe file must not exist. It cannot be overwritten. A user\nneeds the FILE privilege to run this statement. Also,\nMariaDB needs permission to write files in the specified\nlocation. If the secure_file_priv system variable is set to\na non-empty directory name, the file can only be written to\nthat directory.\n \nSince MariaDB 5.1, the character_set_filesystem system\nvariable has controlled interpretation of file names that\nare given as literal strings.\n \nExample\n \nSELECT _utf8\'Hello world!\' INTO DUMPFILE \'/tmp/world\';\n \nSELECT LOAD_FILE(\'/tmp/world\') AS world;\n \n+--------------+\n| world |\n+--------------+\n| Hello world! |\n+--------------+\n \n\n\nURL: https://mariadb.com/kb/en/select-into-dumpfile/','','https://mariadb.com/kb/en/select-into-dumpfile/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (438,27,'SELECT INTO OUTFILE','Syntax\n------ \nSELECT ... INTO OUTFILE \'file_name\'\n [CHARACTER SET charset_name]\n [export_options]\n \nexport_options:\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 \nDescription\n----------- \nSELECT INTO OUTFILE writes the resulting rows to a file, and\nallows the use of column and row terminators to specify a\nparticular output format. The default is to terminate fields\nwith tabs (\\t) and lines with newlines (\\n).\n \nThe file must not exist. It cannot be overwritten. A user\nneeds the FILE privilege to run this statement. Also,\nMariaDB needs permission to write files in the specified\nlocation. If the secure_file_priv system variable is set to\na non-empty directory name, the file can only be written to\nthat directory.\n \nThe LOAD DATA INFILE statement complements SELECT INTO\nOUTFILE.\n \nCharacter-sets\n \nThe CHARACTER SET clause specifies the character set in\nwhich the results are to be written. Without the clause, no\nconversion takes place (the binary character set). In this\ncase, if there are multiple character sets, the output will\ncontain these too, and may not easily be able to be\nreloaded.\n \nIn cases where you have two servers using different\ncharacter-sets, using SELECT INTO OUTFILE to transfer data\nfrom one to the other can have unexpected results. To ensure\nthat MariaDB correctly interprets the escape sequences, use\nthe CHARACTER SET clause on both the SELECT INTO OUTFILE\nstatement and the subsequent LOAD DATA INFILE statement.\n \nExample\n \nThe following example produces a file in the CSV format:\n \nSELECT customer_id, firstname, surname INTO OUTFILE\n\'/exportdata/customers.txt\'\n FIELDS TERMINATED BY \',\' OPTIONALLY ENCLOSED BY \'\"\'\n LINES TERMINATED BY \'\\n\'\n FROM customers;\n \n\n\nURL: https://mariadb.com/kb/en/select-into-outfile/','','https://mariadb.com/kb/en/select-into-outfile/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (439,27,'SELECT WITH ROLLUP','Syntax\n------ \nSee SELECT for the full syntax.\n \nDescription\n----------- \nThe WITH ROLLUP modifier adds extra rows to the resultset\nthat represent super-aggregate summaries. The\nsuper-aggregated column is represented by a NULL value.\nMultiple aggregates over different columns will be added if\nthere are multiple GROUP BY columns.\n \nThe LIMIT clause can be used at the same time, and is\napplied after the WITH ROLLUP rows have been added.\n \nWITH ROLLUP cannot be used with ORDER BY. Some sorting is\nstill possible by using ASC or DESC clauses with the GROUP\nBY column, although the super-aggregate rows will always be\nadded last.\n \nExamples\n-------- \nThese examples use the following sample table\n \nCREATE TABLE booksales ( \n country VARCHAR(35), genre\nENUM(\'fiction\',\'non-fiction\'), year YEAR, sales INT);\n \nINSERT INTO booksales VALUES\n (\'Senegal\',\'fiction\',2014,12234),\n(\'Senegal\',\'fiction\',2015,15647),\n (\'Senegal\',\'non-fiction\',2014,64980),\n(\'Senegal\',\'non-fiction\',2015,78901),\n (\'Paraguay\',\'fiction\',2014,87970),\n(\'Paraguay\',\'fiction\',2015,76940),\n (\'Paraguay\',\'non-fiction\',2014,8760),\n(\'Paraguay\',\'non-fiction\',2015,9030);\n \nThe addition of the WITH ROLLUP modifier in this example\nadds an extra row that aggregates both years:\n \nSELECT year, SUM(sales) FROM booksales GROUP BY year;\n \n+------+------------+\n| year | SUM(sales) |\n+------+------------+\n| 2014 | 173944 |\n| 2015 | 180518 |\n+------+------------+\n2 rows in set (0.08 sec)\n \nSELECT year, SUM(sales) FROM booksales GROUP BY year WITH\nROLLUP;\n \n+------+------------+\n| year | SUM(sales) |\n+------+------------+\n| 2014 | 173944 |\n| 2015 | 180518 |\n| NULL | 354462 |\n+------+------------+\n \nIn the following example, each time the genre, the year or\nthe country change, another super-aggregate row is added:\n \nSELECT country, year, genre, SUM(sales) \n FROM booksales GROUP BY country, year, genre;\n \n+----------+------+-------------+------------+\n| country | year | genre | SUM(sales) |\n+----------+------+-------------+------------+\n| Paraguay | 2014 | fiction | 87970 |\n| Paraguay | 2014 | non-fiction | 8760 |\n| Paraguay | 2015 | fiction | 76940 |\n| Paraguay | 2015 | non-fiction | 9030 |\n| Senegal | 2014 | fiction | 12234 |\n| Senegal | 2014 | non-fiction | 64980 |\n| Senegal | 2015 | fiction | 15647 |\n| Senegal | 2015 | non-fiction | 78901 |\n+----------+------+-------------+------------+\n \nSELECT country, year, genre, SUM(sales) \n FROM booksales GROUP BY country, year, genre WITH ROLLUP;\n \n+----------+------+-------------+------------+\n| country | year | genre | SUM(sales) |\n+----------+------+-------------+------------+\n| Paraguay | 2014 | fiction | 87970 |\n| Paraguay | 2014 | non-fiction | 8760 |\n| Paraguay | 2014 | NULL | 96730 |\n| Paraguay | 2015 | fiction | 76940 |\n| Paraguay | 2015 | non-fiction | 9030 |\n| Paraguay | 2015 | NULL | 85970 |\n| Paraguay | NULL | NULL | 182700 |\n| Senegal | 2014 | fiction | 12234 |\n| Senegal | 2014 | non-fiction | 64980 |\n| Senegal | 2014 | NULL | 77214 |\n| Senegal | 2015 | fiction | 15647 |\n| Senegal | 2015 | non-fiction | 78901 |\n| Senegal | 2015 | NULL | 94548 |\n| Senegal | NULL | NULL | 171762 |\n| NULL | NULL | NULL | 354462 |\n+----------+------+-------------+------------+\n \nThe LIMIT clause, applied after WITH ROLLUP:\n \nSELECT country, year, genre, SUM(sales) \n FROM booksales GROUP BY country, year, genre WITH ROLLUP\nLIMIT 4;\n \n+----------+------+-------------+------------+\n| country | year | genre | SUM(sales) |\n+----------+------+-------------+------------+\n| Paraguay | 2014 | fiction | 87970 |\n| Paraguay | 2014 | non-fiction | 8760 |\n| Paraguay | 2014 | NULL | 96730 |\n| Paraguay | 2015 | fiction | 76940 |\n+----------+------+-------------+------------+\n \nSorting by year descending:\n \nSELECT country, year, genre, SUM(sales) \n FROM booksales GROUP BY country, year DESC, genre WITH\nROLLUP;\n \n+----------+------+-------------+------------+\n| country | year | genre | SUM(sales) |\n+----------+------+-------------+------------+\n| Paraguay | 2015 | fiction | 76940 |\n| Paraguay | 2015 | non-fiction | 9030 |\n| Paraguay | 2015 | NULL | 85970 |\n| Paraguay | 2014 | fiction | 87970 |\n| Paraguay | 2014 | non-fiction | 8760 |\n| Paraguay | 2014 | NULL | 96730 |\n| Paraguay | NULL | NULL | 182700 |\n| Senegal | 2015 | fiction | 15647 |\n| Senegal | 2015 | non-fiction | 78901 |\n| Senegal | 2015 | NULL | 94548 |\n| Senegal | 2014 | fiction | 12234 |\n| Senegal | 2014 | non-fiction | 64980 |\n| Senegal | 2014 | NULL | 77214 |\n| Senegal | NULL | NULL | 171762 |\n| NULL | NULL | NULL | 354462 |\n+----------+------+-------------+------------+\n \n\n\nURL: https://mariadb.com/kb/en/select-with-rollup/','','https://mariadb.com/kb/en/select-with-rollup/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (440,27,'UNION','UNION is used to combine the results from multiple SELECT\nstatements into a single result set.\n \nSyntax\n------ \nSELECT ...\nUNION [ALL | DISTINCT] SELECT ...\n[UNION [ALL | DISTINCT] SELECT ...]\n[ORDER BY [column [, column ...]]]\n[LIMIT {[offset,] row_count | row_count OFFSET offset}]\n \nDescription\n----------- \nUNION is used to combine the results from multiple SELECT\nstatements into a single result set.\n \nThe column names from the first SELECT statement are used as\nthe column names for the results returned. Selected columns\nlisted in corresponding positions of each SELECT statement\nshould have the same data type. (For example, the first\ncolumn selected by the first statement should have the same\ntype as the first column selected by the other statements.)\n \nIf they don\'t, the type and length of the columns in the\nresult take into account the values returned by all of the\nSELECTs, so there is no need for explicit casting. Note that\ncurrently this is not the case for recursive CTEs - see\nMDEV-12325.\n \nTable names can be specified as db_name.tbl_name. This\npermits writing UNIONs which involve multiple databases. See\nIdentifier Qualifiers for syntax details.\n \nUNION queries cannot be used with aggregate functions.\n \nALL/DISTINCT\n \nThe ALL keyword causes duplicate rows to be preserved. The\nDISTINCT keyword (the default if the keyword is omitted)\ncauses duplicate rows to be removed by the results.\n \nUNION ALL and UNION DISTINCT can both be present in a query.\nIn this case, UNION DISTINCT will override any UNION ALLs to\nits left.\n \nUntil MariaDB 10.1.1, all UNION ALL statements required the\nserver to create a temporary table. Since MariaDB 10.1.1,\nthe server can in most cases execute UNION ALL without\ncreating a temporary table, improving performance (see\nMDEV-334).\n \nORDER BY and LIMIT\n \nIndividual SELECTs can contain their own ORDER BY and LIMIT\nclauses. In this case, the individual queries need to be\nwrapped between parentheses. However, this does not affect\nthe order of the UNION, so they only are useful to limit the\nrecord read by one SELECT.\n \nThe UNION can have global ORDER BY and LIMIT clauses, which\naffect the whole resultset. If the columns retrieved by\nindividual SELECT statements have an alias (AS), the ORDER\nBY must use that alias, not the real column names.\n \nHIGH_PRIORITY\n \nSpecifying a query as HIGH_PRIORITY will not work inside a\nUNION. If applied to the first SELECT, it will be ignored.\nApplying to a later SELECT results in a syntax error:\n \nERROR 1234 (42000): Incorrect usage/placement of\n\'HIGH_PRIORITY\'\n \nSELECT ... INTO ...\n \nIndividual SELECTs cannot be written INTO DUMPFILE or INTO\nOUTFILE. If the last SELECT statement specifies INTO\nDUMPFILE or INTO OUTFILE, the entire result of the UNION\nwill be written. Placing the clause after any other SELECT\nwill result in a syntax error.\n \nIf the result is a single row, SELECT ... INTO @var_name can\nalso be used.\n \n\nParentheses\n \nFrom MariaDB 10.4.0, parentheses can be used to specify\nprecedence. Before this, a syntax error would be returned.\n \nExamples\n-------- \nUNION between tables having different column names:\n \n(SELECT e_name AS name, email FROM employees)\nUNION\n(SELECT c_name AS name, email FROM customers);\n \nSpecifying the UNION\'s global order and limiting total\nrows:\n \n(SELECT name, email FROM employees)\nUNION\n(SELECT name, email FROM customers)\nORDER BY name LIMIT 10;\n \nAdding a constant row:\n \n(SELECT \'John Doe\' AS name, \'john.doe@example.net\' AS\nemail)\nUNION\n(SELECT name, email FROM customers);\n \nDiffering types:\n \nSELECT CAST(\'x\' AS CHAR(1)) UNION SELECT REPEAT(\'y\',4);\n+----------------------+\n| CAST(\'x\' AS CHAR(1)) |\n+----------------------+\n| x |\n| yyyy |\n+----------------------+\n \nReturning the results in order of each individual SELECT by\nuse of a sort column:\n \n(SELECT 1 AS sort_column, e_name AS name, email FROM\nemployees)\nUNION\n(SELECT 2, c_name AS name, email FROM customers) ORDER BY\nsort_column;\n \nDifference between UNION, EXCEPT and INTERSECT:\n \nCREATE TABLE seqs (i INT);\nINSERT INTO seqs VALUES (1),(2),(3),(4),(5),(6);\n \nSELECT i FROM seqs WHERE i =3;\n \n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n| 3 |\n| 4 |\n| 5 |\n| 6 |\n+------+\n \nSELECT i FROM seqs WHERE i =3;\n \n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n+------+\n \nSELECT i FROM seqs WHERE i =3;\n \n+------+\n| i |\n+------+\n| 3 |\n+------+\n \nParentheses for specifying precedence, from MariaDB 10.4.0\n \nCREATE OR REPLACE TABLE t1 (a INT);\nCREATE OR REPLACE TABLE t2 (b INT);\nCREATE OR REPLACE TABLE t3 (c INT);\n \nINSERT INTO t1 VALUES (1),(2),(3),(4);\nINSERT INTO t2 VALUES (5),(6);\nINSERT INTO t3 VALUES (1),(6);\n \n((SELECT a FROM t1) UNION (SELECT b FROM t2)) INTERSECT\n(SELECT c FROM t3);\n+------+\n| a |\n+------+\n| 1 |\n| 6 |\n+------+\n \n(SELECT a FROM t1) UNION ((SELECT b FROM t2) INTERSECT\n(SELECT c FROM t3));\n+------+\n| a |\n+------+\n| 1 |\n| 2 |\n| 3 |\n| 4 |\n| 6 |\n+------+\n \n\n\nURL: https://mariadb.com/kb/en/union/','','https://mariadb.com/kb/en/union/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (441,27,'UPDATE','Syntax\n------ \nSingle-table syntax:\n \nUPDATE [LOW_PRIORITY] [IGNORE] table_reference \n [PARTITION (partition_list)]\n SET col1={expr1|DEFAULT} [,col2={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 col1={expr1|DEFAULT} [, col2={expr2|DEFAULT}] ...\n [WHERE where_condition]\n \nDescription\n----------- \nFor the single-table syntax, the UPDATE statement updates\ncolumns of existing rows in the named table with new values.\nThe\nSET clause indicates which columns to modify and the values\nthey should be given. Each value can be given as an\nexpression, or the keyword\nDEFAULT to set a column explicitly to its default value. The\nWHERE clause, if given, specifies the conditions that\nidentify\nwhich rows to update. With no WHERE clause, all rows are\nupdated. If the ORDER BY clause is specified, the rows are\nupdated in the order that is specified. The LIMIT clause\nplaces a limit on the number of rows that can be updated.\n \nThe PARTITION clause was introduced in MariaDB 10.0. See\nPartition Pruning and Selection for details.\n \nUntil MariaDB 10.3.2, for the multiple-table syntax, UPDATE\nupdates rows in each\ntable named in table_references that satisfy the conditions.\nIn this case,\nORDER BY and LIMIT cannot be used. This restriction was\nlifted in MariaDB 10.3.2 and both clauses can be used with\nmultiple-table updates. An UPDATE can also reference tables\nwhich are located in different databases; see Identifier\nQualifiers for the syntax.\n \nwhere_condition is an expression that evaluates to true for\neach row to be updated.\n \ntable_references and where_condition are as\nspecified as described in SELECT.\n \nAssignments are evaluated in left-to-right order, unless the\nSIMULTANEOUS_ASSIGNMENT sql_mode (available from MariaDB\n10.3.5) is set, in which case the UPDATE statement evaluates\nall assignments simultaneously. \n \nYou need the UPDATE privilege only for columns referenced in\nan UPDATE that are actually updated. You need only the\nSELECT privilege for any columns that are read but\nnot modified. See GRANT.\n \nThe UPDATE statement supports the following modifiers:\nIf you use the LOW_PRIORITY keyword, execution of\n the UPDATE is delayed until no other clients are reading\nfrom\n the table. This affects only storage engines that use only\ntable-level\n locking (MyISAM, MEMORY, MERGE). See HIGH_PRIORITY and\nLOW_PRIORITY clauses for details.\nIf you use the IGNORE keyword, the update statement does \n not abort even if errors occur during the update. Rows for\nwhich\n duplicate-key conflicts occur are not updated. Rows for\nwhich columns are\n updated to values that would cause data conversion errors\nare updated to the\n closest valid values instead.\n \nUPDATE Statements With the Same Source and Target\n \nFrom MariaDB 10.3.2, UPDATE statements may have the same\nsource and target.\n \nFor example, given the following table:\n \nDROP TABLE t1;\n \nCREATE TABLE t1 (c1 INT, c2 INT);\nINSERT INTO t1 VALUES (10,10), (20,20);\n \nUntil MariaDB 10.3.1, the following UPDATE statement would\nnot work:\n \nUPDATE t1 SET c1=c1+1 WHERE c2=(SELECT MAX(c2) FROM t1);\nERROR 1093 (HY000): Table \'t1\' is specified twice, \n both as a target for \'UPDATE\' and as a separate source\nfor data\n \nFrom MariaDB 10.3.2, the statement executes successfully:\n \nUPDATE t1 SET c1=c1+1 WHERE c2=(SELECT MAX(c2) FROM t1);\n \nSELECT * FROM t1;\n \n+------+------+\n| c1 | c2 |\n+------+------+\n| 10 | 10 |\n| 21 | 20 |\n+------+------+\n \nExample\n \nSingle-table syntax:\n \nUPDATE table_name SET column1 = value1, column2 = value2\nWHERE id=100;\n \nMultiple-table syntax:\n \nUPDATE tab1, tab2 SET tab1.column1 = value1, tab1.column2 =\nvalue2 WHERE tab1.id = tab2.id;\n \n\n\nURL: https://mariadb.com/kb/en/update/','','https://mariadb.com/kb/en/update/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (442,27,'WITH','The WITH keyword signifies a Common Table Expression (CTE).\nIt allows you to refer to a subquery expression many times\nin a query, as if having a temporary table that only exists\nfor the duration of a query.\n \nThere are two kinds of CTEs:\nNon-Recursive\nRecursive\n \nCommon Table Expression WITH was introduced in MariaDB\n10.2.1.\n \nRecursive WITH has been supported since MariaDB 10.2.2.\n \nSyntax\n------ \nWITH [RECURSIVE] table_reference as (SELECT ...)\n SELECT ...\n \nYou can use table_reference as any normal table in the\nexternal SELECT part. You can also use WITH in sub queries.\nWITH can also be used with EXPLAIN and SELECT.\n \nBelow is an example with the WITH at the top level:\n \nWITH t AS (SELECT a FROM t1 WHERE b >= \'c\') \n SELECT * FROM t2, t WHERE t2.c = t.a;\n \nThe example below uses WITH in a subquery:\n \nSELECT t1.a, t1.b FROM t1, t2\n WHERE t1.a > t2.c \n AND t2.c IN(WITH t AS (SELECT * FROM t1 WHERE t1.a \n\nURL: https://mariadb.com/kb/en/with/','','https://mariadb.com/kb/en/with/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (443,28,'DESCRIBE','Syntax\n------ \n{DESCRIBE | DESC} tbl_name [col_name | wild]\n \nDescription\n----------- \nDESCRIBE provides information about the columns in a table.\nIt is a shortcut for SHOW COLUMNS FROM.\nThese statements also display information for views.\n \ncol_name can be a column name, or a string containing the\nSQL \"%\" and \"_\" wildcard characters to\nobtain output only for the columns with names matching the\nstring. There is no\nneed to enclose the string within quotes unless it contains\nspaces or other\nspecial characters.\n \nDESCRIBE city;\n \n+------------+----------+------+-----+---------+----------------+\n| Field | Type | Null | Key | Default | Extra |\n+------------+----------+------+-----+---------+----------------+\n| Id | int(11) | NO | PRI | NULL | auto_increment |\n| Name | char(35) | YES | | NULL | |\n| Country | char(3) | NO | UNI | | |\n| District | char(20) | YES | MUL | | |\n| Population | int(11) | YES | | NULL | |\n+------------+----------+------+-----+---------+----------------+\n \nThe description for SHOW COLUMNS provides\nmore information about the output columns.\n \n\n\nURL: https://mariadb.com/kb/en/describe/','','https://mariadb.com/kb/en/describe/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (444,28,'ANALYZE Statement','The ANALYZE statement was introduced in MariaDB 10.1.0.\n \nDescription\n----------- \nThe ANALYZE statement is similar to the EXPLAIN statement.\nANALYZE statement will invoke the optimizer, execute the\nstatement, and then produce EXPLAIN output instead of the\nresult set. The EXPLAIN output will be annotated with\nstatistics from statement execution.\n \nThis lets one check how close the optimizer\'s estimates\nabout the query plan are to the reality. ANALYZE produces an\noverview, while the\nANALYZE FORMAT=JSON command provides a more detailed view of\nthe query plan and the query execution.\n \nThe syntax is \n \nANALYZE explainable_statement;\n \nwhere the statement is any statement for which one can run\nEXPLAIN.\n \nCommand Output\n \nConsider an example:\n \nANALYZE SELECT * FROM tbl1 \nWHERE key1 \n BETWEEN 10 AND 200 AND \n col1 LIKE \'foo%\'\\G\n \n*************************** 1. row\n***************************\n id: 1\n select_type: SIMPLE\n table: tbl1\n type: range\npossible_keys: key1\n key: key1\n key_len: 5\n ref: NULL\n rows: 181\n r_rows: 181\n filtered: 100.00\n r_filtered: 10.50\n Extra: Using index condition; Using where\n \nCompared to EXPLAIN, ANALYZE produces two extra columns:\nr_rows is an observation-based counterpart of the rows\ncolumn. It shows how many rows were actually read from the\ntable. \nr_filtered is an observation-based counterpart of the\nfiltered column. It shows which fraction of rows was left\nafter applying the WHERE condition.\n \nInterpreting the Output\n \nJoins\n \nLet\'s consider a more complicated example.\n \nANALYZE SELECT *\nFROM orders, customer \nWHERE\n customer.c_custkey=orders.o_custkey AND\n customer.c_acctbal 200*1000\n \n+----+-------------+----------+------+---------------+-------------+---------+--------------------+--------+--------+----------+------------+-------------+\n| id | select_type | table | type | possible_keys | key |\nkey_len | ref | rows | r_rows | filtered | r_filtered |\nExtra |\n+----+-------------+----------+------+---------------+-------------+---------+--------------------+--------+--------+----------+------------+-------------+\n| 1 | SIMPLE | customer | ALL | PRIMARY,... | NULL | NULL |\nNULL | 149095 | 150000 | 18.08 | 9.13 | Using where |\n| 1 | SIMPLE | orders | ref | i_o_custkey | i_o_custkey | 5\n| customer.c_custkey | 7 | 10 | 100.00 | 30.03 | Using where\n|\n+----+-------------+----------+------+---------------+-------------+---------+--------------------+--------+--------+----------+------------+-------------+\n \nHere, one can see that\nFor table customer, customer.rows=149095,\ncustomer.r_rows=150000. The estimate for number of rows we\nwill read was fairly precise\ncustomer.filtered=18.08, customer.r_filtered=9.13. The\noptimizer somewhat overestimated the number of records that\nwill match selectivity of condition attached to `customer`\ntable (in general, when you have a full scan and r_filtered\nis less than 15%, it\'s time to consider adding an\nappropriate index).\nFor table orders, orders.rows=7, orders.r_rows=10. This\nmeans that on average, there are 7 orders for a given\nc_custkey, but in our case there were 10, which is close to\nthe expectation (when this number is consistently far from\nthe expectation, it may be time to run ANALYZE TABLE, or\neven edit the table statistics manually to get better query\nplans).\norders.filtered=100, orders.r_filtered=30.03. The optimizer\ndidn\'t have any way to estimate which fraction of records\nwill be left after it checks the condition that is attached\nto table orders (it\'s orders.o_totalprice > 200*1000). So,\nit used 100%. In reality, it is 30%. 30% is typically not\nselective enough to warrant adding new indexes. For joins\nwith many tables, it might be worth to collect and use\ncolumn statistics for columns in question, this may help the\noptimizer to pick a better query plan.\n \nMeaning of NULL in r_rows and r_filtered\n \nLet\'s modify the previous example slightly\n \nANALYZE SELECT * \nFROM orders, customer \nWHERE\n customer.c_custkey=orders.o_custkey AND\n customer.c_acctbal 200*1000;\n \n+----+-------------+----------+------+---------------+-------------+---------+--------------------+--------+--------+----------+------------+-------------+\n| id | select_type | table | type | possible_keys | key |\nkey_len | ref | rows | r_rows | filtered | r_filtered |\nExtra |\n+----+-------------+----------+------+---------------+-------------+---------+--------------------+--------+--------+----------+------------+-------------+\n| 1 | SIMPLE | customer | ALL | PRIMARY,... | NULL | NULL |\nNULL | 149095 | 150000 | 18.08 | 0.00 | Using where |\n| 1 | SIMPLE | orders | ref | i_o_custkey | i_o_custkey | 5\n| customer.c_custkey | 7 | NULL | 100.00 | NULL | Using\nwhere |\n+----+-------------+----------+------+---------------+-------------+---------+--------------------+--------+--------+----------+------------+-------------+\n \nHere, one can see that orders.r_rows=NULL and\norders.r_filtered=NULL. This means that table orders was not\nscanned even once. \nIndeed, we can also see customer.r_filtered=0.00. This shows\nthat a part of WHERE attached to table `customer` was never\nsatisfied (or, satisfied in less than 0.01% of cases).\n \nANALYZE FORMAT=JSON\n \nANALYZE FORMAT=JSON produces JSON output. It produces much\nmore information than tabular ANALYZE.\n \nNotes\n \nANALYZE UPDATE or ANALYZE DELETE will actually make\nupdates/deletes (ANALYZE SELECT will perform the select\noperation and then discard the resultset).\nPostgreSQL has a similar command, EXPLAIN ANALYZE.\nThe EXPLAIN in the slow query log feature allows MariaDB to\nhave ANALYZE output of slow queries printed into the slow\nquery log (see MDEV-6388).\n \n\n\nURL: https://mariadb.com/kb/en/analyze-statement/','','https://mariadb.com/kb/en/analyze-statement/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (445,28,'EXPLAIN','Syntax\n------ \nEXPLAIN tbl_name\n \nOr\n \nEXPLAIN [EXTENDED | PARTITIONS] \n {SELECT select_options | UPDATE update_options | DELETE\ndelete_options}\n \nDescription\n----------- \nThe EXPLAIN statement can be used either as a synonym for\nDESCRIBE or as a way to obtain information about how MariaDB\nexecutes a SELECT (as well as UPDATE and DELETE since\nMariaDB 10.0.5) statement:\n\'EXPLAIN tbl_name\' is synonymous with \n \'DESCRIBE tbl_name\' or \n \'SHOW COLUMNS FROM tbl_name\'.\nWhen you precede a SELECT statement (or, since MariaDB\n10.0.5, an UPDATE or a DELETE as well) with the keyword \n EXPLAIN, MariaDB displays information from the optimizer\n about the query execution plan. That is, MariaDB explains\nhow it would\n process the SELECT, UPDATE or DELETE, including information\nabout how tables\n are joined and in which order. EXPLAIN EXTENDED can be\n used to provide additional information.\nEXPLAIN PARTITIONS has been available since MySQL 5.1.5. It\nis useful only when examining queries involving partitioned\ntables. For details, see Partition pruning and selection.\nANALYZE statement, which performs the query as well as\nproducing EXPLAIN output, and provides actual as well as\nestimated statistics, has been available from MariaDB\n10.1.0.\nSince MariaDB 10.0.5, it has been possible to have EXPLAIN\noutput printed in the slow query log. See EXPLAIN in the\nSlow Query Log for details.\n \nSince MariaDB 10.0, SHOW EXPLAIN shows the output of a\nrunning statement. In some cases, its output can be closer\nto reality than EXPLAIN.\n \nSince MariaDB 10.1, the ANALYZE statement runs a statement\nand returns information about its execution plan. It also\nshows additional columns, to check how much the optimizer\'s\nestimation about filtering and found rows are close to\nreality.\n \nThere is an online EXPLAIN Analyzer that you can use to\nshare EXPLAIN and EXPLAIN EXTENDED output with others.\n \nEXPLAIN can acquire metadata locks in the same way that\nSELECT does, as it needs to know table metadata and,\nsometimes, data as well.\n \nThe columns in EXPLAIN ... SELECT\n \nColumn name | Description | \n \nid | Sequence number that shows in which order tables are\njoined. | \n \nselect_type | What kind of SELECT the table comes from. | \n \ntable | Alias name of table. Materialized temporary tables\nfor sub queries are named | \n \ntype | How rows are found from the table (join type). | \n \npossible_keys | keys in table that could be used to find\nrows in the table | \n \nkey | The name of the key that is used to retrieve rows.\nNULL is no key was used. | \n \nkey_len | How many bytes of the key that was used (shows if\nwe are using only parts of the multi-column key). | \n \nref | The reference that is used to as the key value. | \n \nrows | An estimate of how many rows we will find in the\ntable for each key lookup. | \n \nExtra | Extra information about this join. | \n \nHere are descriptions of the values for some of the more\ncomplex columns in EXPLAIN ... SELECT:\n \n\"select_type\" column\n \nThe select_type column can have the following values:\n \nValue | Description | \n \nDEPENDENT SUBQUERY | The SUBQUERY is DEPENDENT. | \n \nDEPENDENT UNION | The UNION is DEPENDENT. | \n \nDERIVED | The SELECT is DERIVED from the PRIMARY. | \n \nMATERIALIZED | The SUBQUERY is MATERIALIZED. | \n \nPRIMARY | The SELECT is a PRIMARY one. | \n \nSIMPLE | The SELECT is a SIMPLE one. | \n \nSUBQUERY | The SELECT is a SUBQUERY of the PRIMARY. | \n \nUNCACHEABLE SUBQUERY | The SUBQUERY is UNCACHEABLE. | \n \nUNCACHEABLE UNION | The UNION is UNCACHEABLE. | \n \nUNION | The SELECT is a UNION of the PRIMARY. | \n \nUNION RESULT | The result of the UNION. | \n \n\"Type\" column\n \nThis column contains information on how the table is\naccessed.\n \nValue | Description | \n \nALL | A full table scan is done for the table (all rows are\nread). This is bad if the table is large and the table is\njoined against a previous table! This happens when the\noptimizer could not find any usable index to access rows. | \n \nconst | There is only one possibly matching row in the\ntable. The row is read before the optimization phase and all\ncolumns in the table are treated as constants. | \n \neq_ref | A unique index is used to find the rows. This is\nthe best possible plan to find the row. | \n \nfulltext | A fulltext index is used to access the rows. | \n \nindex_merge | A \'range\' access is done for for several\nindex and the found rows are merged. The key column shows\nwhich keys are used. | \n \nindex_subquery | This is similar as ref, but used for sub\nqueries that are transformed to key lookups. | \n \nindex | A full scan over the used index. Better than ALL but\nstill bad if index is large and the table is joined against\na previous table. | \n \nrange | The table will be accessed with a key over one or\nmore value ranges. | \n \nref_or_null | Like \'ref\' but in addition another search\nfor the \'null\' value is done if the first value was not\nfound. This happens usually with sub queries. | \n \nref | A non unique index or prefix of an unique index is\nused to find the rows. Good if the prefix doesn\'t match\nmany rows. | \n \nsystem | The table has 0 or 1 rows. | \n \nunique_subquery | This is similar as eq_ref, but used for\nsub queries that are transformed to key lookups | \n \n\"Extra\" column\n \nThis column consists of one or more of the following values,\nseparated by \';\'\n \n Note that some of these values are detected after the\noptimization phase.\n \nThe optimization phase can do the following changes to the\nWHERE clause:\nAdd the expressions from the ON and USING clauses to the\nWHERE\n clause.\nConstant propagation: If there is column=constant, replace\nall column\n instances with this constant.\nReplace all columns from \'const\' tables with their values.\nRemove the used key columns from the WHERE (as this will be\ntested as\n part of the key lookup).\nRemove impossible constant sub expressions.\n For example WHERE \'(a=1 and a=2) OR b=1\' becomes \'b=1\'.\nReplace columns with other columns that has identical\nvalues:\n Example: WHERE a=b and a=c may be treated\n as \'WHERE a=b and a=c and b=c\'.\nAdd extra conditions to detect impossible row conditions\nearlier. This\n happens mainly with OUTER JOIN where we in some cases add\ndetection\n of NULL values in the WHERE (Part of \'Not exists\'\noptimization).\n This can cause an unexpected \'Using where\' in the Extra\ncolumn.\nFor each table level we remove expressions that have already\nbeen tested when\n we read the previous row. Example: When joining tables t1\nwith t2\n using the following WHERE \'t1.a=1 and t1.a=t2.b\', we\ndon\'t have to\n test \'t1.a=1\' when checking rows in t2 as we already know\nthat this\n expression is true. \n \nValue | Description | \n \nconst row not found | The table was a system table (a table\nwith should exactly one row), but no row was found. | \n \nDistinct | If distinct optimization (remove duplicates) was\nused. This is marked only for the last table in the SELECT.\n| \n \nFull scan on NULL key | The table is a part of the sub query\nand if the value that is used to match the sub query will be\nNULL, we will do a full table scan. | \n \nImpossible HAVING | The used HAVING clause is always false\nso the SELECT will return no rows. | \n \nImpossible WHERE noticed after reading const tables. | The\nused WHERE clause is always false so the SELECT will return\nno rows. This case was detected after we had read all\n\'const\' tables and used the column values as constant in\nthe WHERE clause. For example: WHERE const_column=5 and\nconst_column had a value of 4. | \n \nImpossible WHERE | The used WHERE clause is always false so\nthe SELECT will return no rows. For example: WHERE 1=2 | \n \nNo matching min/max row | During early optimization of\nMIN()/MAX() values it was detected that no row could match\nthe WHERE clause. The MIN()/MAX() function will return NULL.\n| \n \nno matching row in const table | The table was a const table\n(a table with only one possible matching row), but no row\nwas found. | \n \nNo tables used | The SELECT was a sub query that did not use\nany tables. For example a there was no FROM clause or a FROM\nDUAL clause. | \n \nNot exists | Stop searching after more row if we find one\nsingle matching row. This optimization is used with LEFT\nJOIN where one is explicitly searching for rows that\ndoesn\'t exists in the LEFT JOIN TABLE. Example: SELECT *\nFROM t1 LEFT JOIN t2 on (...) WHERE t2.not_null_column IS\nNULL. As t2.not_null_column can only be NULL if there was no\nmatching row for on condition, we can stop searching if we\nfind a single matching row. | \n \nOpen_frm_only | For information_schema tables. Only the frm\n(table definition file was opened) was opened for each\nmatching row. | \n \nOpen_full_table | For information_schema tables. A full\ntable open for each matching row is done to retrieve the\nrequested information. (Slow) | \n \nOpen_trigger_only | For information_schema tables. Only the\ntrigger file definition was opened for each matching row. | \n \nRange checked for each record (index map: ...) | This only\nhappens when there was no good default index to use but\nthere may some index that could be used when we can treat\nall columns from previous table as constants. For each row\ncombination the optimizer will decide which index to use (if\nany) to fetch a row from this table. This is not fast, but\nfaster than a full table scan that is the only other choice.\nThe index map is a bitmask that shows which index are\nconsidered for each row condition. | \n \nScanned 0/1/all databases | For information_schema tables.\nShows how many times we had to do a directory scan. | \n \nSelect tables optimized away | All tables in the join was\noptimized away. This happens when we are only using\nCOUNT(*), MIN() and MAX() functions in the SELECT and we\nwhere able to replace all of these with constants. | \n \nSkip_open_table | For information_schema tables. The queried\ntable didn\'t need to be opened. | \n \nunique row not found | The table was detected to be a const\ntable (a table with only one possible matching row) during\nthe early optimization phase, but no row was found. | \n \nUsing filesort | Filesort is needed to resolve the query.\nThis means an extra phase where we first collect all columns\nto sort, sort them with a disk based merge sort and then use\nthe sorted set to retrieve the rows in sorted order. If the\ncolumn set is small, we store all the columns in the sort\nfile to not have to go to the database to retrieve them\nagain. | \n \nUsing index | Only the index is used to retrieve the needed\ninformation from the table. There is no need to perform an\nextra seek to retrieve the actual record. | \n \nUsing index condition | Like \'Using where\' but the where\ncondition is pushed down to the table engine for internal\noptimization at the index level. | \n \nUsing index condition(BKA) | Like \'Using index condition\'\nbut in addition we use batch key access to retrieve rows. | \n \nUsing index for group-by | The index is being used to\nresolve a GROUP BY or DISTINCT query. The rows are not read.\nThis is very efficient if the table has a lot of identical\nindex entries as duplicates are quickly jumped over. | \n \nUsing intersect(...) | For index_merge joins. Shows which\nindex are part of the intersect. | \n \nUsing join buffer | We store previous row combinations in a\nrow buffer to be able to match each row against all of the\nrows combinations in the join buffer at one go. | \n \nUsing sort_union(...) | For index_merge joins. Shows which\nindex are part of the union. | \n \nUsing temporary | A temporary table is created to hold the\nresult. This typically happens if you are using GROUP BY,\nDISTINCT or ORDER BY. | \n \nUsing where | A WHERE expression (in additional to the\npossible key lookup) is used to check if the row should be\naccepted. If you don\'t have \'Using where\' together with a\njoin type of ALL, you are probably doing something wrong! | \n \nUsing where with pushed condition | Like \'Using where\' but\nthe where condition is pushed down to the table engine for\ninternal optimization at the row level. | \n \nUsing buffer | The UPDATE statement will first buffer the\nrows, and then run the updates, rather than do updates on\nthe fly. See Using Buffer UPDATE Algorithm for a detailed\nexplanation. | \n \nEXPLAIN EXTENDED\n \nThe EXTENDED keyword adds another column, filtered, to the\noutput. This is a percentage estimate of the table rows that\nwill be filtered by the condition.\n \nAn EXPLAIN EXTENDED will always throw a warning, as it adds\nextra Message information to a subsequent SHOW WARNINGS\nstatement. This includes what the SELECT query would look\nlike after optimizing and rewriting rules are applied and\nhow the optimizer qualifies columns and tables.\n \nExamples\n-------- \nAs synonym for DESCRIBE or SHOW COLUMNS FROM:\n \nDESCRIBE city;\n \n+------------+----------+------+-----+---------+----------------+\n| Field | Type | Null | Key | Default | Extra |\n+------------+----------+------+-----+---------+----------------+\n| Id | int(11) | NO | PRI | NULL | auto_increment |\n| Name | char(35) | YES | | NULL | |\n| Country | char(3) | NO | UNI | | |\n| District | char(20) | YES | MUL | | |\n| Population | int(11) | YES | | NULL | |\n+------------+----------+------+-----+---------+----------------+\n \nA simple set of examples to see how EXPLAIN can identify\npoor index usage:\n \nCREATE TABLE IF NOT EXISTS `employees_example` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `first_name` varchar(30) NOT NULL,\n `last_name` varchar(40) NOT NULL,\n `position` varchar(25) NOT NULL,\n `home_address` varchar(50) NOT NULL,\n `home_phone` varchar(12) NOT NULL,\n `employee_code` varchar(25) NOT NULL,\n PRIMARY KEY (`id`),\n UNIQUE KEY `employee_code` (`employee_code`),\n KEY `first_name` (`first_name`,`last_name`)\n) ENGINE=Aria;\n \nINSERT INTO `employees_example` (`first_name`, `last_name`,\n`position`, `home_address`, `home_phone`, `employee_code`)\n VALUES\n (\'Mustapha\', \'Mond\', \'Chief Executive Officer\', \'692\nPromiscuous Plaza\', \'326-555-3492\', \'MM1\'),\n (\'Henry\', \'Foster\', \'Store Manager\', \'314 Savage\nCircle\', \'326-555-3847\', \'HF1\'),\n (\'Bernard\', \'Marx\', \'Cashier\', \'1240 Ambient\nAvenue\', \'326-555-8456\', \'BM1\'),\n (\'Lenina\', \'Crowne\', \'Cashier\', \'281 Bumblepuppy\nBoulevard\', \'328-555-2349\', \'LC1\'),\n (\'Fanny\', \'Crowne\', \'Restocker\', \'1023 Bokanovsky\nLane\', \'326-555-6329\', \'FC1\'),\n (\'Helmholtz\', \'Watson\', \'Janitor\', \'944 Soma\nCourt\', \'329-555-2478\', \'HW1\');\n \nSHOW INDEXES FROM employees_example;\n \n+-------------------+------------+---------------+--------------+---------------+-----------+-------------+----------+--------+------+------------+---------+---------------+\n| Table | Non_unique | Key_name | Seq_in_index | Column_name\n| Collation | Cardinality | Sub_part | Packed | Null |\nIndex_type | Comment | Index_comment |\n+-------------------+------------+---------------+--------------+---------------+-----------+-------------+----------+--------+------+------------+---------+---------------+\n| employees_example | 0 | PRIMARY | 1 | id | A | 7 | NULL |\nNULL | | BTREE | | |\n| employees_example | 0 | employee_code | 1 | employee_code\n| A | 7 | NULL | NULL | | BTREE | | |\n| employees_example | 1 | first_name | 1 | first_name | A |\nNULL | NULL | NULL | | BTREE | | |\n| employees_example | 1 | first_name | 2 | last_name | A |\nNULL | NULL | NULL | | BTREE | | |\n+-------------------+------------+---------------+--------------+---------------+-----------+-------------+----------+--------+------+------------+---------+---------------+\n \nSELECT on a primary key:\n \nEXPLAIN SELECT * FROM employees_example WHERE id=1;\n \n+------+-------------+-------------------+-------+---------------+---------+---------+-------+------+-------+\n| id | select_type | table | type | possible_keys | key |\nkey_len | ref | rows | Extra |\n+------+-------------+-------------------+-------+---------------+---------+---------+-------+------+-------+\n| 1 | SIMPLE | employees_example | const | PRIMARY | PRIMARY\n| 4 | const | 1 | |\n+------+-------------+-------------------+-------+---------------+---------+---------+-------+------+-------+\n \nThe type is const, which means that only one possible result\ncould be returned. \nNow, returning the same record but searching by their phone\nnumber:\n \nEXPLAIN SELECT * FROM employees_example WHERE\nhome_phone=\'326-555-3492\';\n \n+------+-------------+-------------------+------+---------------+------+---------+------+------+-------------+\n| id | select_type | table | type | possible_keys | key |\nkey_len | ref | rows | Extra |\n+------+-------------+-------------------+------+---------------+------+---------+------+------+-------------+\n| 1 | SIMPLE | employees_example | ALL | NULL | NULL | NULL\n| NULL | 6 | Using where |\n+------+-------------+-------------------+------+---------------+------+---------+------+------+-------------+\n \nHere, the type is All, which means no index could be used.\nLooking at the rows count, a full table scan (all six rows)\nhad to be performed in order to retrieve the record. If\nit\'s a requirement to search by phone number, an index will\nhave to be created.\n \nSHOW EXPLAIN example:\n \nSHOW EXPLAIN FOR 1;\n \n+------+-------------+-------+-------+---------------+------+---------+------+---------+-------------+\n| id | select_type | table | type | possible_keys | key |\nkey_len | ref | rows | Extra |\n+------+-------------+-------+-------+---------------+------+---------+------+---------+-------------+\n| 1 | SIMPLE | tbl | index | NULL | a | 5 | NULL | 1000107 |\nUsing index |\n+------+-------------+-------+-------+---------------+------+---------+------+---------+-------------+\n1 row in set, 1 warning (0.00 sec)\n \nExample of ref_or_null optimization\n \nSELECT * FROM table_name\n WHERE key_column=expr OR key_column IS NULL;\n \nref_or_null is something that often happens when you use\nsubqueries with NOT IN as then one has to do an extra check\nfor NULL values if the first value didn\'t have a matching\nrow. \n \n\n\nURL: https://mariadb.com/kb/en/explain/','','https://mariadb.com/kb/en/explain/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (446,28,'EXPLAIN ANALYZE','The syntax for the EXPLAIN ANALYZE feature was changed to\nANALYZE statement, available since MariaDB 10.1.0. See\nANALYZE statement. \n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/explain-analyze/','','https://mariadb.com/kb/en/explain-analyze/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (447,28,'ANALYZE FORMAT=JSON','ANALYZE FORMAT=JSON is a mix of the EXPLAIN FORMAT=JSON and\nANALYZE statement features. ANALYZE FORMAT=JSON $statement\nwill execute $statement, and then print the output of\nEXPLAIN FORMAT=JSON, amended with the data from query\nexecution.\n \nBasic Execution Data\n \nYou can get the following also from tabular ANALYZE\nstatement form:\nr_rows is provided for any node that reads rows. It shows\nhow many rows were read, on average \nr_filtered is provided whenever there is a condition that is\nchecked. It shows the percentage of rows left after checking\nthe condition.\n \nAdvanced Execution Data\n \nThe most important data that is not available in tabula\nANALYZE statement are:\nr_loops field. This shows how many times the node was\nexecuted. Most query plan elements have this field.\nr_total_time_ms field. It shows how much time in total was\nspent executing this node. If the node has subnodes, their\nexecution time is included.\nr_buffer_size field. Query plan nodes that make use of\nbuffers report the size of buffer that was was used.\n \nData About Individual Query Plan Nodes\n \nfilesort node reports whether sorting was done with LIMIT n\nparameter, and how many rows were in the sort result. \nblock-nl-join node has r_loops field, which allows to tell\nwhether Using join buffer was efficient \nrange-checked-for-each-record reports counters that show the\nresult of the check. \nexpression-cache is used for subqueries, and it reports how\nmany times the cache was used, and what cache hit ratio was.\nunion_result node has r_rows so one can see how many rows\nwere produced after UNION operation\nand so forth\n \nUse Cases\n \nSee Examples of ANALYZE FORMAT=JSON.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/analyze-format-json/','','https://mariadb.com/kb/en/analyze-format-json/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (448,28,'ANALYZE FORMAT=JSON Examples','Example #1\n \nCustomers who have ordered more than 1M goods.\n \nANALYZE FORMAT=JSON\nSELECT CONT(*)\nFROM customer\nWHERE\n (SELECT SUM(o_totalprice) FROM orders WHERE\no_custkey=c_custkey) > 1000*1000;\n \nThe query takes 40 seconds over cold cache\n \nEXPLAIN: {\n \"query_block\": {\n \"select_id\": 1,\n \"r_loops\": 1,\n \"r_total_time_ms\": 39872,\n \"table\": {\n \"table_name\": \"customer\",\n \"access_type\": \"index\",\n \"key\": \"i_c_nationkey\",\n \"key_length\": \"5\",\n \"used_key_parts\": [\"c_nationkey\"],\n \"r_loops\": 1,\n \"rows\": 150303,\n \"r_rows\": 150000,\n \"r_total_time_ms\": 270.3,\n \"filtered\": 100,\n \"r_filtered\": 60.691,\n \"attached_condition\": \"((subquery#2) > ((1000 *\n1000)))\",\n \"using_index\": true\n },\n \"subqueries\": [\n {\n \"query_block\": {\n \"select_id\": 2,\n \"r_loops\": 150000,\n \"r_total_time_ms\": 39531,\n \"table\": {\n \"table_name\": \"orders\",\n \"access_type\": \"ref\",\n \"possible_keys\": [\"i_o_custkey\"],\n \"key\": \"i_o_custkey\",\n \"key_length\": \"5\",\n \"used_key_parts\": [\"o_custkey\"],\n \"ref\": [\"dbt3sf1.customer.c_custkey\"],\n \"r_loops\": 150000,\n \"rows\": 7,\n \"r_rows\": 10,\n \"r_total_time_ms\": 39208,\n \"filtered\": 100,\n \"r_filtered\": 100\n }\n }\n }\n ]\n }\n}\nANALYZE shows that 39.2 seconds were spent in the subquery,\nwhich was executed 150K times (for every row of outer\ntable).\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/analyze-formatjson-examples/','','https://mariadb.com/kb/en/analyze-formatjson-examples/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (449,28,'EXPLAIN FORMAT=JSON','Starting from version 10.1.2, MariaDB supports the EXPLAIN\nFORMAT=JSON syntax.\n \nSynopsis\n \nEXPLAIN FORMAT=JSON is a variant of EXPLAIN command that\nproduces output in JSON form. The output always has one row\nwhich has only one column titled \"JSON\". The contents are\na JSON representation of the query plan, formatted for\nreadability:\n \nEXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE col1=1\\G\n \n*************************** 1. row\n***************************\nEXPLAIN: {\n \"query_block\": {\n \"select_id\": 1,\n \"table\": {\n \"table_name\": \"t1\",\n \"access_type\": \"ALL\",\n \"rows\": 1000,\n \"filtered\": 100,\n \"attached_condition\": \"(t1.col1 = 1)\"\n }\n }\n}\n \nOutput is different from MySQL\n \nThe output of MariaDB\'s EXPLAIN FORMAT=JSON is different\nfrom EXPLAIN FORMAT=JSON in MySQL.The reasons for that are:\nMySQL\'s output has deficiencies. Some are listed here:\nEXPLAIN FORMAT=JSON in MySQL)\nThe output of MySQL\'s EXPLAIN FORMAT=JSON is not defined.\nEven MySQL Workbench has trouble parsing it (see this blog\npost).\nMariaDB has query optimizations that MySQL does not have.\nErgo, MariaDB generates query plans that MySQL does not\ngenerate.\n \nA (as yet incomplete) list of how MariaDB\'s output is\ndifferent from MySQL can be found here: EXPLAIN FORMAT=JSON\ndifferences from MySQL. \n \nOutput format\n \nTODO: MariaDB\'s output format description.\n \n\n\nURL: https://mariadb.com/kb/en/explain-format-json/','','https://mariadb.com/kb/en/explain-format-json/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (450,30,'CONTAINS','Syntax\n------ \nContains(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether a geometry g1 completely\ncontains geometry g2. CONTAINS() is based on the original\nMySQL implementation and uses object bounding rectangles,\nwhile ST_CONTAINS() uses object shapes. \n \nThis tests the opposite relationship to Within().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/contains/','','https://mariadb.com/kb/en/contains/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (451,30,'CROSSES','Syntax\n------ \nCrosses(g1,g2)\n \nDescription\n----------- \nReturns 1 if g1 spatially crosses g2. Returns NULL if g1 is\na Polygon or a MultiPolygon, or if g2 is a\nPoint or a MultiPoint. Otherwise, returns 0.\n \nThe term spatially crosses denotes a spatial relation\nbetween two\ngiven geometries that has the following properties:\nThe two geometries intersect\nTheir intersection results in a geometry that has a\ndimension that is one\n less than the maximum dimension of the two given geometries\nTheir intersection is not equal to either of the two given\ngeometries\n \nCROSSES() is based on the original MySQL implementation, and\nuses object bounding rectangles, while ST_CROSSES() uses\nobject shapes.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/crosses/','','https://mariadb.com/kb/en/crosses/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (452,30,'DISJOINT','Syntax\n------ \nDisjoint(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether g1 is spatially disjoint\nfrom\n(does not intersect) g2.\n \nDISJOINT() tests the opposite relationship to INTERSECTS().\n \nDISJOINT() is based on the original MySQL implementation and\nuses object bounding rectangles, while ST_DISJOINT() uses\nobject shapes.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/disjoint/','','https://mariadb.com/kb/en/disjoint/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (453,30,'EQUALS','Syntax\n------ \nEquals(g1,g2)\n \nFrom MariaDB 10.2.3:\n \nMBREQUALS(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether g1 is spatially equal to\ng2.\n \nEQUALS() is based on the original MySQL implementation and\nuses object bounding rectangles, while ST_EQUALS() uses\nobject shapes.\n \nFrom MariaDB 10.2.3, MBREQUALS is a synonym for Equals.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/equals/','','https://mariadb.com/kb/en/equals/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (454,30,'INTERSECTS','Syntax\n------ \nINTERSECTS(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether geometry g1 spatially\nintersects geometry g2.\n \nINTERSECTS() is based on the original MySQL implementation\nand uses object bounding rectangles, while ST_INTERSECTS()\nuses object shapes.\n \nINTERSECTS() tests the opposite relationship to DISJOINT().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/intersects/','','https://mariadb.com/kb/en/intersects/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (455,30,'OVERLAPS','Syntax\n------ \nOVERLAPS(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether g1 spatially overlaps g2.\nThe term spatially overlaps is used if two geometries\nintersect and their\nintersection results in a geometry of the same dimension but\nnot equal to\neither of the given geometries.\n \nOVERLAPS() is based on the original MySQL implementation and\nuses object bounding rectangles, while ST_OVERLAPS() uses\nobject shapes.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/overlaps/','','https://mariadb.com/kb/en/overlaps/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (456,30,'ST_CONTAINS','Syntax\n------ \nST_CONTAINS(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether a geometry g1 completely\ncontains geometry g2.\n \nST_CONTAINS() uses object shapes, while CONTAINS(), based on\nthe original MySQL implementation, uses object bounding\nrectangles.\n \nST_CONTAINS tests the opposite relationship to ST_WITHIN().\n \nExamples\n-------- \nSET @g1 = ST_GEOMFROMTEXT(\'POLYGON((175 150, 20 40, 50 60,\n125 100, 175 150))\');\n \nSET @g2 = ST_GEOMFROMTEXT(\'POINT(174 149)\');\n \nSELECT ST_CONTAINS(@g1,@g2);\n+----------------------+\n| ST_CONTAINS(@g1,@g2) |\n+----------------------+\n| 1 |\n+----------------------+\n \nSET @g2 = ST_GEOMFROMTEXT(\'POINT(175 151)\');\n \nSELECT ST_CONTAINS(@g1,@g2);\n+----------------------+\n| ST_CONTAINS(@g1,@g2) |\n+----------------------+\n| 0 |\n+----------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st-contains/','','https://mariadb.com/kb/en/st-contains/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (457,30,'ST_CROSSES','Syntax\n------ \nST_CROSSES(g1,g2)\n \nDescription\n----------- \nReturns 1 if geometry g1 spatially crosses geometry g2.\nReturns NULL if g1 is a Polygon or a MultiPolygon, or if g2\nis a\nPoint or a MultiPoint. Otherwise, returns 0.\n \nThe term spatially crosses denotes a spatial relation\nbetween two\ngiven geometries that has the following properties:\nThe two geometries intersect\nTheir intersection results in a geometry that has a\ndimension that is one\n less than the maximum dimension of the two given geometries\nTheir intersection is not equal to either of the two given\ngeometries\n \nST_CROSSES() uses object shapes, while CROSSES(), based on\nthe original MySQL implementation, uses object bounding\nrectangles.\n \nExamples\n-------- \nSET @g1 = ST_GEOMFROMTEXT(\'LINESTRING(174 149, 176 151)\');\n \nSET @g2 = ST_GEOMFROMTEXT(\'POLYGON((175 150, 20 40, 50 60,\n125 100, 175 150))\');\n \nSELECT ST_CROSSES(@g1,@g2);\n+---------------------+\n| ST_CROSSES(@g1,@g2) |\n+---------------------+\n| 1 |\n+---------------------+\n \nSET @g1 = ST_GEOMFROMTEXT(\'LINESTRING(176 149, 176 151)\');\n \nSELECT ST_CROSSES(@g1,@g2);\n+---------------------+\n| ST_CROSSES(@g1,@g2) |\n+---------------------+\n| 0 |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st-crosses/','','https://mariadb.com/kb/en/st-crosses/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (458,30,'ST_DIFFERENCE','Syntax\n------ \nST_DIFFERENCE(g1,g2)\n \nDescription\n----------- \nReturns a geometry representing the point set difference of\nthe given geometry values.\n \nExample\n \nSET @g1 = POINT(10,10), @g2 = POINT(20,20);\n \nSELECT ST_AsText(ST_Difference(@g1, @g2));\n+------------------------------------+\n| ST_AsText(ST_Difference(@g1, @g2)) |\n+------------------------------------+\n| POINT(10 10) |\n+------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_difference/','','https://mariadb.com/kb/en/st_difference/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (459,30,'ST_DISJOINT','Syntax\n------ \nST_DISJOINT(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether geometry g1 is spatially\ndisjoint from\n(does not intersect with) geometry g2.\n \nST_DISJOINT() uses object shapes, while DISJOINT(), based on\nthe original MySQL implementation, uses object bounding\nrectangles.\n \nST_DISJOINT() tests the opposite relationship to\nST_INTERSECTS().\n \nExamples\n-------- \nSET @g1 = ST_GEOMFROMTEXT(\'POINT(0 0)\');\n \nSET @g2 = ST_GEOMFROMTEXT(\'LINESTRING(2 0, 0 2)\');\n \nSELECT ST_DISJOINT(@g1,@g2);\n+----------------------+\n| ST_DISJOINT(@g1,@g2) |\n+----------------------+\n| 1 |\n+----------------------+\n \nSET @g2 = ST_GEOMFROMTEXT(\'LINESTRING(0 0, 0 2)\');\n \nSELECT ST_DISJOINT(@g1,@g2);\n+----------------------+\n| ST_DISJOINT(@g1,@g2) |\n+----------------------+\n| 0 |\n+----------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_disjoint/','','https://mariadb.com/kb/en/st_disjoint/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (460,30,'ST_DISTANCE','ST_DISTANCE() was introduced in MariaDB 5.3.3.\n \nSyntax\n------ \nST_DISTANCE(g1,g2)\n \nDescription\n----------- \nReturns the distance between two geometries, or null if not\ngiven valid inputs.\n \nExample\n \nSELECT ST_Distance(POINT(1,2),POINT(2,2));\n+------------------------------------+\n| ST_Distance(POINT(1,2),POINT(2,2)) |\n+------------------------------------+\n| 1 |\n+------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_distance/','','https://mariadb.com/kb/en/st_distance/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (461,30,'ST_EQUALS','Syntax\n------ \nST_EQUALS(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether geometry g1 is spatially\nequal to geometry g2.\n \nST_EQUALS() uses object shapes, while EQUALS(), based on the\noriginal MySQL implementation, uses object bounding\nrectangles.\n \nExamples\n-------- \nSET @g1 = ST_GEOMFROMTEXT(\'LINESTRING(174 149, 176 151)\');\n \nSET @g2 = ST_GEOMFROMTEXT(\'LINESTRING(176 151, 174 149)\');\n \nSELECT ST_EQUALS(@g1,@g2);\n+--------------------+\n| ST_EQUALS(@g1,@g2) |\n+--------------------+\n| 1 |\n+--------------------+\n \nSET @g1 = ST_GEOMFROMTEXT(\'POINT(0 2)\');\n \nSET @g1 = ST_GEOMFROMTEXT(\'POINT(2 0)\');\n \nSELECT ST_EQUALS(@g1,@g2);\n+--------------------+\n| ST_EQUALS(@g1,@g2) |\n+--------------------+\n| 0 |\n+--------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st-equals/','','https://mariadb.com/kb/en/st-equals/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (462,30,'ST_INTERSECTS','Syntax\n------ \nST_INTERSECTS(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether geometry g1 spatially\nintersects geometry g2.\n \nST_INTERSECTS() uses object shapes, while INTERSECTS(),\nbased on the original MySQL implementation, uses object\nbounding rectangles.\n \nST_INTERSECTS() tests the opposite relationship to\nST_DISJOINT().\n \nExamples\n-------- \nSET @g1 = ST_GEOMFROMTEXT(\'POINT(0 0)\');\n \nSET @g2 = ST_GEOMFROMTEXT(\'LINESTRING(0 0, 0 2)\');\n \nSELECT ST_INTERSECTS(@g1,@g2);\n+------------------------+\n| ST_INTERSECTS(@g1,@g2) |\n+------------------------+\n| 1 |\n+------------------------+\n \nSET @g2 = ST_GEOMFROMTEXT(\'LINESTRING(2 0, 0 2)\');\n \nSELECT ST_INTERSECTS(@g1,@g2);\n+------------------------+\n| ST_INTERSECTS(@g1,@g2) |\n+------------------------+\n| 0 |\n+------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st-intersects/','','https://mariadb.com/kb/en/st-intersects/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (463,30,'ST_LENGTH','Syntax\n------ \nST_LENGTH(ls)\n \nDescription\n----------- \nReturns as a double-precision number the length of the\nLineString value ls in its associated spatial reference.\n \nExamples\n-------- \nSET @ls = \'LineString(1 1,2 2,3 3)\';\n \nSELECT ST_LENGTH(ST_GeomFromText(@ls));\n+---------------------------------+\n| ST_LENGTH(ST_GeomFromText(@ls)) |\n+---------------------------------+\n| 2.82842712474619 |\n+---------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_length/','','https://mariadb.com/kb/en/st_length/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (464,30,'ST_OVERLAPS','Syntax\n------ \nST_OVERLAPS(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether geometry g1 spatially\noverlaps geometry g2.\n \nThe term spatially overlaps is used if two geometries\nintersect and their\nintersection results in a geometry of the same dimension but\nnot equal to\neither of the given geometries.\n \nST_OVERLAPS() uses object shapes, while OVERLAPS(), based on\nthe original MySQL implementation, uses object bounding\nrectangles.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st-overlaps/','','https://mariadb.com/kb/en/st-overlaps/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (465,30,'ST_TOUCHES','Syntax\n------ \nST_TOUCHES(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether geometry g1 spatially\ntouches geometry g2. Two geometries spatially touch if the\ninteriors of the geometries do not intersect,\nbut the boundary of one of the geometries intersects either\nthe boundary or the\ninterior of the other.\n \nST_TOUCHES() uses object shapes, while TOUCHES(), based on\nthe original MySQL implementation, uses object bounding\nrectangles.\n \nExamples\n-------- \nSET @g1 = ST_GEOMFROMTEXT(\'POINT(2 0)\');\n \nSET @g2 = ST_GEOMFROMTEXT(\'LINESTRING(2 0, 0 2)\');\n \nSELECT ST_TOUCHES(@g1,@g2);\n+---------------------+\n| ST_TOUCHES(@g1,@g2) |\n+---------------------+\n| 1 |\n+---------------------+\n \nSET @g1 = ST_GEOMFROMTEXT(\'POINT(2 1)\');\n \nSELECT ST_TOUCHES(@g1,@g2);\n+---------------------+\n| ST_TOUCHES(@g1,@g2) |\n+---------------------+\n| 0 |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st-touches/','','https://mariadb.com/kb/en/st-touches/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (466,30,'ST_WITHIN','Syntax\n------ \nST_WITHIN(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether geometry g1 is spatially\nwithin geometry g2.\n \nThis tests the opposite relationship as ST_CONTAINS().\n \nST_WITHIN() uses object shapes, while WITHIN(), based on the\noriginal MySQL implementation, uses object bounding\nrectangles.\n \nExamples\n-------- \nSET @g1 = ST_GEOMFROMTEXT(\'POINT(174 149)\');\n \nSET @g2 = ST_GEOMFROMTEXT(\'POLYGON((175 150, 20 40, 50 60,\n125 100, 175 150))\');\n \nSELECT ST_WITHIN(@g1,@g2);\n+--------------------+\n| ST_WITHIN(@g1,@g2) |\n+--------------------+\n| 1 |\n+--------------------+\n \nSET @g1 = ST_GEOMFROMTEXT(\'POINT(176 151)\');\n \nSELECT ST_WITHIN(@g1,@g2);\n+--------------------+\n| ST_WITHIN(@g1,@g2) |\n+--------------------+\n| 0 |\n+--------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st-within/','','https://mariadb.com/kb/en/st-within/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (467,30,'TOUCHES','Syntax\n------ \nTouches(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether g1 spatially touches g2.\nTwo\ngeometries spatially touch if the interiors of the\ngeometries do not intersect,\nbut the boundary of one of the geometries intersects either\nthe boundary or the\ninterior of the other.\n \nTOUCHES() is based on the original MySQL implementation and\nuses object bounding rectangles, while ST_TOUCHES() uses\nobject shapes.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/touches/','','https://mariadb.com/kb/en/touches/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (468,30,'WITHIN','Syntax\n------ \nWithin(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether g1 is spatially within\ng2.\nThis tests the opposite relationship as Contains().\n \nWITHIN() is based on the original MySQL implementation, and\nuses object bounding rectangles, while ST_WITHIN() uses\nobject shapes.\n \nExamples\n-------- \nSET @g1 = GEOMFROMTEXT(\'POINT(174 149)\');\nSET @g2 = GEOMFROMTEXT(\'POINT(176 151)\');\nSET @g3 = GEOMFROMTEXT(\'POLYGON((175 150, 20 40, 50 60, 125\n100, 175 150))\');\n \nSELECT within(@g1,@g3);\n+-----------------+\n| within(@g1,@g3) |\n+-----------------+\n| 1 |\n+-----------------+\n \nSELECT within(@g2,@g3);\n+-----------------+\n| within(@g2,@g3) |\n+-----------------+\n| 0 |\n+-----------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/within/','','https://mariadb.com/kb/en/within/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (469,31,'ADDDATE','Syntax\n------ \nADDDATE(date,INTERVAL expr unit), ADDDATE(expr,days)\n \nDescription\n----------- \nWhen invoked with the INTERVAL form of the second argument,\nADDDATE()\nis a synonym for DATE_ADD(). The related function\nSUBDATE() is a synonym for DATE_SUB(). For\ninformation on the INTERVAL unit argument, see the\ndiscussion for\nDATE_ADD().\n \nWhen invoked with the days form of the second argument,\nMariaDB treats it as an\ninteger number of days to be added to expr.\n \nExamples\n-------- \nSELECT DATE_ADD(\'2008-01-02\', INTERVAL 31 DAY);\n+-----------------------------------------+\n| DATE_ADD(\'2008-01-02\', INTERVAL 31 DAY) |\n+-----------------------------------------+\n| 2008-02-02 |\n+-----------------------------------------+\n \nSELECT ADDDATE(\'2008-01-02\', INTERVAL 31 DAY);\n+----------------------------------------+\n| ADDDATE(\'2008-01-02\', INTERVAL 31 DAY) |\n+----------------------------------------+\n| 2008-02-02 |\n+----------------------------------------+\n \nSELECT ADDDATE(\'2008-01-02\', 31);\n+---------------------------+\n| ADDDATE(\'2008-01-02\', 31) |\n+---------------------------+\n| 2008-02-02 |\n+---------------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n (\"2007-01-30 21:31:07\"),\n (\"1983-10-15 06:42:51\"),\n (\"2011-04-21 12:34:56\"),\n (\"2011-10-30 06:31:41\"),\n (\"2011-01-30 14:03:25\"),\n (\"2004-10-07 11:19:34\");\n \nSELECT d, ADDDATE(d, 10) from t1;\n \n+---------------------+---------------------+\n| d | ADDDATE(d, 10) |\n+---------------------+---------------------+\n| 2007-01-30 21:31:07 | 2007-02-09 21:31:07 |\n| 1983-10-15 06:42:51 | 1983-10-25 06:42:51 |\n| 2011-04-21 12:34:56 | 2011-05-01 12:34:56 |\n| 2011-10-30 06:31:41 | 2011-11-09 06:31:41 |\n| 2011-01-30 14:03:25 | 2011-02-09 14:03:25 |\n| 2004-10-07 11:19:34 | 2004-10-17 11:19:34 |\n+---------------------+---------------------+\n \nSELECT d, ADDDATE(d, INTERVAL 10 HOUR) from t1;\n \n+---------------------+------------------------------+\n| d | ADDDATE(d, INTERVAL 10 HOUR) |\n+---------------------+------------------------------+\n| 2007-01-30 21:31:07 | 2007-01-31 07:31:07 |\n| 1983-10-15 06:42:51 | 1983-10-15 16:42:51 |\n| 2011-04-21 12:34:56 | 2011-04-21 22:34:56 |\n| 2011-10-30 06:31:41 | 2011-10-30 16:31:41 |\n| 2011-01-30 14:03:25 | 2011-01-31 00:03:25 |\n| 2004-10-07 11:19:34 | 2004-10-07 21:19:34 |\n+---------------------+------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/adddate/','','https://mariadb.com/kb/en/adddate/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (470,31,'ADDTIME','Syntax\n------ \nADDTIME(expr1,expr2)\n \nDescription\n----------- \nADDTIME() adds expr2 to expr1 and returns the result. expr1\nis a time\nor datetime expression, and expr2 is a time expression.\n \nExamples\n-------- \nSELECT ADDTIME(\'2007-12-31 23:59:59.999999\', \'1\n1:1:1.000002\');\n+---------------------------------------------------------+\n| ADDTIME(\'2007-12-31 23:59:59.999999\', \'1\n1:1:1.000002\') |\n+---------------------------------------------------------+\n| 2008-01-02 01:01:01.000001 |\n+---------------------------------------------------------+\n \nSELECT ADDTIME(\'01:00:00.999999\', \'02:00:00.999998\');\n+-----------------------------------------------+\n| ADDTIME(\'01:00:00.999999\', \'02:00:00.999998\') |\n+-----------------------------------------------+\n| 03:00:01.999997 |\n+-----------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/addtime/','','https://mariadb.com/kb/en/addtime/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (471,31,'CONVERT_TZ','Syntax\n------ \nCONVERT_TZ(dt,from_tz,to_tz)\n \nDescription\n----------- \nCONVERT_TZ() converts a datetime value dt from the time zone\ngiven by from_tz to the time zone given by to_tz and returns\nthe resulting value.\n \nIn order to use named time zones, such as GMT, MET or\nAfrica/Johannesburg, the time_zone tables must be loaded\n(see mysql_tzinfo_to_sql).\n \nNo conversion will take place if the value falls outside of\nthe supported TIMESTAMP range (\'1970-01-01 00:00:01\' to\n\'2038-01-19 05:14:07\' UTC) when converted from from_tz to\nUTC.\n \nThis function returns NULL if the arguments are invalid (or\nnamed time zones have not been loaded).\n \nSee time zones for more information.\n \nExamples\n-------- \nSELECT CONVERT_TZ(\'2016-01-01\n12:00:00\',\'+00:00\',\'+10:00\');\n+-----------------------------------------------------+\n| CONVERT_TZ(\'2016-01-01 12:00:00\',\'+00:00\',\'+10:00\')\n|\n+-----------------------------------------------------+\n| 2016-01-01 22:00:00 |\n+-----------------------------------------------------+\n \nUsing named time zones (with the time zone tables loaded):\n \nSELECT CONVERT_TZ(\'2016-01-01\n12:00:00\',\'GMT\',\'Africa/Johannesburg\');\n+---------------------------------------------------------------+\n| CONVERT_TZ(\'2016-01-01\n12:00:00\',\'GMT\',\'Africa/Johannesburg\') |\n+---------------------------------------------------------------+\n| 2016-01-01 14:00:00 |\n+---------------------------------------------------------------+\n \nThe value is out of the TIMESTAMP range, so no conversion\ntakes place:\n \nSELECT CONVERT_TZ(\'1969-12-31\n22:00:00\',\'+00:00\',\'+10:00\');\n+-----------------------------------------------------+\n| CONVERT_TZ(\'1969-12-31 22:00:00\',\'+00:00\',\'+10:00\')\n|\n+-----------------------------------------------------+\n| 1969-12-31 22:00:00 |\n+-----------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/convert_tz/','','https://mariadb.com/kb/en/convert_tz/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (472,31,'CURDATE','Syntax\n------ \nCURDATE()\n \nDescription\n----------- \nReturns the current date as a value in \'YYYY-MM-DD\' or\nYYYYMMDD\nformat, depending on whether the function is used in a\nstring or\nnumeric context.\n \nExamples\n-------- \nSELECT CURDATE();\n+------------+\n| CURDATE() |\n+------------+\n| 2019-03-05 |\n+------------+\n \nIn a numeric context (note this is not performing date\ncalculations):\n \nSELECT CURDATE() +0;\n \n+--------------+\n| CURDATE() +0 |\n+--------------+\n| 20190305 |\n+--------------+\n \nData calculation:\n \nSELECT CURDATE() - INTERVAL 5 DAY;\n \n+----------------------------+\n| CURDATE() - INTERVAL 5 DAY |\n+----------------------------+\n| 2019-02-28 |\n+----------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/curdate/','','https://mariadb.com/kb/en/curdate/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (473,31,'CURRENT_DATE','Syntax\n------ \nCURRENT_DATE, CURRENT_DATE()\n \nDescription\n----------- \nCURRENT_DATE and CURRENT_DATE() are synonyms for CURDATE().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/current_date/','','https://mariadb.com/kb/en/current_date/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (474,31,'CURRENT_TIME','Syntax\n------ \nCURRENT_TIME\nCURRENT_TIME([precision])\n \nDescription\n----------- \nCURRENT_TIME and CURRENT_TIME() are synonyms for CURTIME().\n \n\n\nURL: https://mariadb.com/kb/en/current_time/','','https://mariadb.com/kb/en/current_time/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (475,31,'CURRENT_TIMESTAMP','Syntax\n------ \nCURRENT_TIMESTAMP\nCURRENT_TIMESTAMP([precision])\n \nDescription\n----------- \nCURRENT_TIMESTAMP and CURRENT_TIMESTAMP() are synonyms for\nNOW().\n \n\n\nURL: https://mariadb.com/kb/en/current_timestamp/','','https://mariadb.com/kb/en/current_timestamp/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (476,31,'CURTIME','Syntax\n------ \nCURTIME([precision])\n \nDescription\n----------- \nReturns the current time as a value in \'HH:MM:SS\' or\nHHMMSS.uuuuuu format, depending on whether the function is\nused in a string or numeric context. The value is expressed\nin the current time zone.\n \nThe optional precision determines the microsecond precision.\nSee Microseconds in MariaDB.\n \nExamples\n-------- \nSELECT CURTIME();\n+-----------+\n| CURTIME() |\n+-----------+\n| 12:45:39 |\n+-----------+\n \nSELECT CURTIME() + 0;\n \n+---------------+\n| CURTIME() + 0 |\n+---------------+\n| 124545.000000 |\n+---------------+\n \nWith precision:\n \nSELECT CURTIME(2);\n+-------------+\n| CURTIME(2) |\n+-------------+\n| 09:49:08.09 |\n+-------------+\n \n\n\nURL: https://mariadb.com/kb/en/curtime/','','https://mariadb.com/kb/en/curtime/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (477,31,'DATE FUNCTION','Syntax\n------ \nDATE(expr)\n \nDescription\n----------- \nExtracts the date part of the date or datetime expression\nexpr.\n \nExamples\n-------- \nSELECT DATE(\'2013-07-18 12:21:32\');\n+-----------------------------+\n| DATE(\'2013-07-18 12:21:32\') |\n+-----------------------------+\n| 2013-07-18 |\n+-----------------------------+\n \nError Handling\n \nUntil MariaDB 5.5.32, some versions of MariaDB returned\n0000-00-00 when passed an invalid date. From 5.5.32, NULL is\nreturned.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/date-function/','','https://mariadb.com/kb/en/date-function/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (478,31,'DATEDIFF','Syntax\n------ \nDATEDIFF(expr1,expr2)\n \nDescription\n----------- \nDATEDIFF() returns (expr1 – expr2) expressed\nas a value in days from one date to the other. expr1 and\nexpr2 are date\nor date-and-time expressions. Only the date parts of the\nvalues are used in the\ncalculation.\n \nExamples\n-------- \nSELECT DATEDIFF(\'2007-12-31 23:59:59\',\'2007-12-30\');\n+----------------------------------------------+\n| DATEDIFF(\'2007-12-31 23:59:59\',\'2007-12-30\') |\n+----------------------------------------------+\n| 1 |\n+----------------------------------------------+\n \nSELECT DATEDIFF(\'2010-11-30 23:59:59\',\'2010-12-31\');\n+----------------------------------------------+\n| DATEDIFF(\'2010-11-30 23:59:59\',\'2010-12-31\') |\n+----------------------------------------------+\n| -31 |\n+----------------------------------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n (\"2007-01-30 21:31:07\"),\n (\"1983-10-15 06:42:51\"),\n (\"2011-04-21 12:34:56\"),\n (\"2011-10-30 06:31:41\"),\n (\"2011-01-30 14:03:25\"),\n (\"2004-10-07 11:19:34\");\n \nSELECT NOW();\n+---------------------+\n| NOW() |\n+---------------------+\n| 2011-05-23 10:56:05 |\n+---------------------+\n \nSELECT d, DATEDIFF(NOW(),d) FROM t1;\n \n+---------------------+-------------------+\n| d | DATEDIFF(NOW(),d) |\n+---------------------+-------------------+\n| 2007-01-30 21:31:07 | 1574 |\n| 1983-10-15 06:42:51 | 10082 |\n| 2011-04-21 12:34:56 | 32 |\n| 2011-10-30 06:31:41 | -160 |\n| 2011-01-30 14:03:25 | 113 |\n| 2004-10-07 11:19:34 | 2419 |\n+---------------------+-------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/datediff/','','https://mariadb.com/kb/en/datediff/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (479,31,'DATE_ADD','Syntax\n------ \nDATE_ADD(date,INTERVAL expr unit)\n \nDescription\n----------- \nPerforms date arithmetic. The date argument specifies the\nstarting date or datetime value. expr is an expression\nspecifying the\ninterval value to be added or subtracted from the starting\ndate. expr is a\nstring; it may start with a \"-\" for negative intervals.\nunit is a\nkeyword indicating the units in which the expression should\nbe interpreted. See Date and Time Units for a complete list\nof permitted units. \n \nSee also DATE_SUB().\n \nExamples\n-------- \nSELECT \'2008-12-31 23:59:59\' + INTERVAL 1 SECOND;\n \n+-------------------------------------------+\n| \'2008-12-31 23:59:59\' + INTERVAL 1 SECOND |\n+-------------------------------------------+\n| 2009-01-01 00:00:00 |\n+-------------------------------------------+\n \nSELECT INTERVAL 1 DAY + \'2008-12-31\';\n \n+-------------------------------+\n| INTERVAL 1 DAY + \'2008-12-31\' |\n+-------------------------------+\n| 2009-01-01 |\n+-------------------------------+\n \nSELECT \'2005-01-01\' - INTERVAL 1 SECOND;\n \n+----------------------------------+\n| \'2005-01-01\' - INTERVAL 1 SECOND |\n+----------------------------------+\n| 2004-12-31 23:59:59 |\n+----------------------------------+\n \nSELECT DATE_ADD(\'2000-12-31 23:59:59\', INTERVAL 1 SECOND);\n+----------------------------------------------------+\n| DATE_ADD(\'2000-12-31 23:59:59\', INTERVAL 1 SECOND) |\n+----------------------------------------------------+\n| 2001-01-01 00:00:00 |\n+----------------------------------------------------+\n \nSELECT DATE_ADD(\'2010-12-31 23:59:59\', INTERVAL 1 DAY);\n+-------------------------------------------------+\n| DATE_ADD(\'2010-12-31 23:59:59\', INTERVAL 1 DAY) |\n+-------------------------------------------------+\n| 2011-01-01 23:59:59 |\n+-------------------------------------------------+\n \nSELECT DATE_ADD(\'2100-12-31 23:59:59\', INTERVAL \'1:1\'\nMINUTE_SECOND);\n+---------------------------------------------------------------+\n| DATE_ADD(\'2100-12-31 23:59:59\', INTERVAL \'1:1\'\nMINUTE_SECOND) |\n+---------------------------------------------------------------+\n| 2101-01-01 00:01:00 |\n+---------------------------------------------------------------+\n \nSELECT DATE_ADD(\'1900-01-01 00:00:00\', INTERVAL \'-1 10\'\nDAY_HOUR);\n+------------------------------------------------------------+\n| DATE_ADD(\'1900-01-01 00:00:00\', INTERVAL \'-1 10\'\nDAY_HOUR) |\n+------------------------------------------------------------+\n| 1899-12-30 14:00:00 |\n+------------------------------------------------------------+\n \nSELECT DATE_ADD(\'1992-12-31 23:59:59.000002\', INTERVAL\n\'1.999999\' SECOND_MICROSECOND);\n+--------------------------------------------------------------------------------+\n| DATE_ADD(\'1992-12-31 23:59:59.000002\', INTERVAL\n\'1.999999\' SECOND_MICROSECOND) |\n+--------------------------------------------------------------------------------+\n| 1993-01-01 00:00:01.000001 |\n+--------------------------------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/date_add/','','https://mariadb.com/kb/en/date_add/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (480,31,'DATE_FORMAT','Syntax\n------ \nDATE_FORMAT(date, format[, locale])\n \nDescription\n----------- \nFormats the date value according to the format string. \n \nThe language used for the names is controlled by the value\nof the lc_time_names system variable. See server locale for\nmore on the supported locales.\n \nThe options that can be used by DATE_FORMAT(), as well as\nits inverse STR_TO_DATE() and the FROM_UNIXTIME() function,\nare:\n \nOption | Description | \n \n%a | Short weekday name in current locale (Variable\nlc_time_names). | \n \n%b | Short form month name in current locale. For locale\nen_US this is one of:\nJan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov or Dec. | \n \n%c | Month with 1 or 2 digits. | \n \n%D | Day with English suffix \'th\', \'nd\', \'st\' or\n\'rd\'\'. (1st, 2nd, 3rd...). | \n \n%d | Day with 2 digits. | \n \n%e | Day with 1 or 2 digits. | \n \n%f | Sub seconds 6 digits. | \n \n%H | Hour with 2 digits between 00-23. | \n \n%h | Hour with 2 digits between 01-12. | \n \n%I | Hour with 2 digits between 01-12. | \n \n%i | Minute with 2 digits. | \n \n%j | Day of the year (001-366) | \n \n%k | Hour with 1 digits between 0-23. | \n \n%l | Hour with 1 digits between 1-12. | \n \n%M | Full month name in current locale (Variable\nlc_time_names). | \n \n%m | Month with 2 digits. | \n \n%p | AM/PM according to current locale (Variable\nlc_time_names). | \n \n%r | Time in 12 hour format, followed by AM/PM. Short for\n\'%I:%i:%S %p\'. | \n \n%S | Seconds with 2 digits. | \n \n%s | Seconds with 2 digits. | \n \n%T | Time in 24 hour format. Short for \'%H:%i:%S\'. | \n \n%U | Week number (00-53), when first day of the week is\nSunday. | \n \n%u | Week number (00-53), when first day of the week is\nMonday. | \n \n%V | Week number (01-53), when first day of the week is\nSunday. Used with %X. | \n \n%v | Week number (01-53), when first day of the week is\nMonday. Used with %x. | \n \n%W | Full weekday name in current locale (Variable\nlc_time_names). | \n \n%w | Day of the week. 0 = Sunday, 6 = Saturday. | \n \n%X | Year with 4 digits when first day of the week is\nSunday. Used with %V. | \n \n%x | Year with 4 digits when first day of the week is\nMonday. Used with %v. | \n \n%Y | Year with 4 digits. | \n \n%y | Year with 2 digits. | \n \n%# | For str_to_date(), skip all numbers. | \n \n%. | For str_to_date(), skip all punctation characters. | \n \n%@ | For str_to_date(), skip all alpha characters. | \n \n%% | A literal % character. | \n \nTo get a date in one of the standard formats, GET_FORMAT()\ncan be used.\n \nExamples\n-------- \nSELECT DATE_FORMAT(\'2009-10-04 22:23:00\', \'%W %M %Y\');\n+------------------------------------------------+\n| DATE_FORMAT(\'2009-10-04 22:23:00\', \'%W %M %Y\') |\n+------------------------------------------------+\n| Sunday October 2009 |\n+------------------------------------------------+\n \nSELECT DATE_FORMAT(\'2007-10-04 22:23:00\', \'%H:%i:%s\');\n+------------------------------------------------+\n| DATE_FORMAT(\'2007-10-04 22:23:00\', \'%H:%i:%s\') |\n+------------------------------------------------+\n| 22:23:00 |\n+------------------------------------------------+\n \nSELECT DATE_FORMAT(\'1900-10-04 22:23:00\', \'%D %y %a %d %m\n%b %j\');\n+------------------------------------------------------------+\n| DATE_FORMAT(\'1900-10-04 22:23:00\', \'%D %y %a %d %m %b\n%j\') |\n+------------------------------------------------------------+\n| 4th 00 Thu 04 10 Oct 277 |\n+------------------------------------------------------------+\n \nSELECT DATE_FORMAT(\'1997-10-04 22:23:00\', \'%H %k %I %r %T\n%S %w\');\n+------------------------------------------------------------+\n| DATE_FORMAT(\'1997-10-04 22:23:00\', \'%H %k %I %r %T %S\n%w\') |\n+------------------------------------------------------------+\n| 22 22 10 10:23:00 PM 22:23:00 00 6 |\n+------------------------------------------------------------+\n \nSELECT DATE_FORMAT(\'1999-01-01\', \'%X %V\');\n+------------------------------------+\n| DATE_FORMAT(\'1999-01-01\', \'%X %V\') |\n+------------------------------------+\n| 1998 52 |\n+------------------------------------+\n \nSELECT DATE_FORMAT(\'2006-06-00\', \'%d\');\n+---------------------------------+\n| DATE_FORMAT(\'2006-06-00\', \'%d\') |\n+---------------------------------+\n| 00 |\n+---------------------------------+\n \nOptionally, the locale can be explicitly specified as the\nthird DATE_FORMAT() argument. Doing so makes the function\nindependent from the session settings, and the three\nargument version of DATE_FORMAT() can be used in virtual\nindexed and persistent generated-columns:\n \nSELECT DATE_FORMAT(\'2006-01-01\', \'%W\', \'el_GR\');\n+------------------------------------------+\n| DATE_FORMAT(\'2006-01-01\', \'%W\', \'el_GR\') |\n+------------------------------------------+\n| ΚυÏιακή |\n+------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/date_format/','','https://mariadb.com/kb/en/date_format/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (481,31,'DATE_SUB','Syntax\n------ \nDATE_SUB(date,INTERVAL expr unit)\n \nDescription\n----------- \nPerforms date arithmetic. The date argument specifies the\nstarting date or datetime value. expr is an expression\nspecifying the\ninterval value to be added or subtracted from the starting\ndate. expr is a\nstring; it may start with a \"-\" for negative intervals.\nunit is a\nkeyword indicating the units in which the expression should\nbe interpreted. See Date and Time Units for a complete list\nof permitted units. \n \nSee also DATE_ADD().\n \nExamples\n-------- \nSELECT DATE_SUB(\'1998-01-02\', INTERVAL 31 DAY);\n+-----------------------------------------+\n| DATE_SUB(\'1998-01-02\', INTERVAL 31 DAY) |\n+-----------------------------------------+\n| 1997-12-02 |\n+-----------------------------------------+\n \nSELECT DATE_SUB(\'2005-01-01 00:00:00\', INTERVAL \'1\n1:1:1\' DAY_SECOND);\n+----------------------------------------------------------------+\n| DATE_SUB(\'2005-01-01 00:00:00\', INTERVAL \'1 1:1:1\'\nDAY_SECOND) |\n+----------------------------------------------------------------+\n| 2004-12-30 22:58:59 |\n+----------------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/date_sub/','','https://mariadb.com/kb/en/date_sub/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (482,31,'DAY','Syntax\n------ \nDAY(date)\n \nDescription\n----------- \nDAY() is a synonym for DAYOFMONTH().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/day/','','https://mariadb.com/kb/en/day/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (483,31,'DAYNAME','Syntax\n------ \nDAYNAME(date)\n \nDescription\n----------- \nReturns the name of the weekday for date. The language used\nfor the name is controlled by the value\nof the lc_time_names system variable. See server locale for\nmore on the supported locales.\n \nExamples\n-------- \nSELECT DAYNAME(\'2007-02-03\');\n+-----------------------+\n| DAYNAME(\'2007-02-03\') |\n+-----------------------+\n| Saturday |\n+-----------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n (\"2007-01-30 21:31:07\"),\n (\"1983-10-15 06:42:51\"),\n (\"2011-04-21 12:34:56\"),\n (\"2011-10-30 06:31:41\"),\n (\"2011-01-30 14:03:25\"),\n (\"2004-10-07 11:19:34\");\n \nSELECT d, DAYNAME(d) FROM t1;\n \n+---------------------+------------+\n| d | DAYNAME(d) |\n+---------------------+------------+\n| 2007-01-30 21:31:07 | Tuesday |\n| 1983-10-15 06:42:51 | Saturday |\n| 2011-04-21 12:34:56 | Thursday |\n| 2011-10-30 06:31:41 | Sunday |\n| 2011-01-30 14:03:25 | Sunday |\n| 2004-10-07 11:19:34 | Thursday |\n+---------------------+------------+\n \nChanging the locale:\n \nSET lc_time_names = \'fr_CA\';\n \nSELECT DAYNAME(\'2013-04-01\');\n+-----------------------+\n| DAYNAME(\'2013-04-01\') |\n+-----------------------+\n| lundi |\n+-----------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/dayname/','','https://mariadb.com/kb/en/dayname/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (484,31,'DAYOFMONTH','Syntax\n------ \nDAYOFMONTH(date)\n \nDescription\n----------- \nReturns the day of the month for date, in the range 1 to 31,\nor 0\nfor dates such as \'0000-00-00\' or \'2008-00-00\' which\nhave a zero day\npart.\n \nDAY() is a synonym.\n \nExamples\n-------- \nSELECT DAYOFMONTH(\'2007-02-03\');\n+--------------------------+\n| DAYOFMONTH(\'2007-02-03\') |\n+--------------------------+\n| 3 |\n+--------------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n (\"2007-01-30 21:31:07\"),\n (\"1983-10-15 06:42:51\"),\n (\"2011-04-21 12:34:56\"),\n (\"2011-10-30 06:31:41\"),\n (\"2011-01-30 14:03:25\"),\n (\"2004-10-07 11:19:34\");\n \nSELECT d FROM t1 where DAYOFMONTH(d) = 30;\n \n+---------------------+\n| d |\n+---------------------+\n| 2007-01-30 21:31:07 |\n| 2011-10-30 06:31:41 |\n| 2011-01-30 14:03:25 |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/dayofmonth/','','https://mariadb.com/kb/en/dayofmonth/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (485,31,'DAYOFWEEK','Syntax\n------ \nDAYOFWEEK(date)\n \nDescription\n----------- \nReturns the day of the week index for the date (1 = Sunday,\n2 = Monday, ..., 7 =\nSaturday). These index values correspond to the ODBC\nstandard.\n \nThis contrasts with WEEKDAY() which follows a different\nindex numbering\n(0 = Monday, 1 = Tuesday, ... 6 = Sunday).\n \nExamples\n-------- \nSELECT DAYOFWEEK(\'2007-02-03\');\n+-------------------------+\n| DAYOFWEEK(\'2007-02-03\') |\n+-------------------------+\n| 7 |\n+-------------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n (\"2007-01-30 21:31:07\"),\n (\"1983-10-15 06:42:51\"),\n (\"2011-04-21 12:34:56\"),\n (\"2011-10-30 06:31:41\"),\n (\"2011-01-30 14:03:25\"),\n (\"2004-10-07 11:19:34\");\n \nSELECT d, DAYNAME(d), DAYOFWEEK(d), WEEKDAY(d) from t1;\n \n+---------------------+------------+--------------+------------+\n| d | DAYNAME(d) | DAYOFWEEK(d) | WEEKDAY(d) |\n+---------------------+------------+--------------+------------+\n| 2007-01-30 21:31:07 | Tuesday | 3 | 1 |\n| 1983-10-15 06:42:51 | Saturday | 7 | 5 |\n| 2011-04-21 12:34:56 | Thursday | 5 | 3 |\n| 2011-10-30 06:31:41 | Sunday | 1 | 6 |\n| 2011-01-30 14:03:25 | Sunday | 1 | 6 |\n| 2004-10-07 11:19:34 | Thursday | 5 | 3 |\n+---------------------+------------+--------------+------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/dayofweek/','','https://mariadb.com/kb/en/dayofweek/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (486,31,'DAYOFYEAR','Syntax\n------ \nDAYOFYEAR(date)\n \nDescription\n----------- \nReturns the day of the year for date, in the range 1 to 366.\n \nExamples\n-------- \nSELECT DAYOFYEAR(\'2018-02-16\');\n+-------------------------+\n| DAYOFYEAR(\'2018-02-16\') |\n+-------------------------+\n| 47 |\n+-------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/dayofyear/','','https://mariadb.com/kb/en/dayofyear/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (487,31,'EXTRACT','Syntax\n------ \nEXTRACT(unit FROM date)\n \nDescription\n----------- \nThe EXTRACT() function extracts the required unit from the\ndate. See Date and Time Units for a complete list of\npermitted units.\n \nIn MariaDB 10.0.7 and MariaDB 5.5.35, EXTRACT (HOUR FROM\n...) was changed to return a value from 0 to 23, adhering to\nthe SQL standard. Until MariaDB 10.0.6 and MariaDB 5.5.34,\nand in all versions of MySQL at least as of MySQL 5.7, it\ncould return a value > 23. HOUR() is not a standard\nfunction, so continues to adhere to the old behaviour\ninherited from MySQL.\n \nExamples\n-------- \nSELECT EXTRACT(YEAR FROM \'2009-07-02\');\n+---------------------------------+\n| EXTRACT(YEAR FROM \'2009-07-02\') |\n+---------------------------------+\n| 2009 |\n+---------------------------------+\n \nSELECT EXTRACT(YEAR_MONTH FROM \'2009-07-02 01:02:03\');\n+------------------------------------------------+\n| EXTRACT(YEAR_MONTH FROM \'2009-07-02 01:02:03\') |\n+------------------------------------------------+\n| 200907 |\n+------------------------------------------------+\n \nSELECT EXTRACT(DAY_MINUTE FROM \'2009-07-02 01:02:03\');\n+------------------------------------------------+\n| EXTRACT(DAY_MINUTE FROM \'2009-07-02 01:02:03\') |\n+------------------------------------------------+\n| 20102 |\n+------------------------------------------------+\n \nSELECT EXTRACT(MICROSECOND FROM \'2003-01-02\n10:30:00.000123\');\n+--------------------------------------------------------+\n| EXTRACT(MICROSECOND FROM \'2003-01-02 10:30:00.000123\') |\n+--------------------------------------------------------+\n| 123 |\n+--------------------------------------------------------+\n \nFrom MariaDB 10.0.7 and MariaDB 5.5.35, EXTRACT (HOUR\nFROM...) returns a value from 0 to 23, as per the SQL\nstandard. HOUR is not a standard function, so continues to\nadhere to the old behaviour inherited from MySQL.\n \nSELECT EXTRACT(HOUR FROM \'26:30:00\'), HOUR(\'26:30:00\');\n+-------------------------------+------------------+\n| EXTRACT(HOUR FROM \'26:30:00\') | HOUR(\'26:30:00\') |\n+-------------------------------+------------------+\n| 2 | 26 |\n+-------------------------------+------------------+\n \n\n\nURL: https://mariadb.com/kb/en/extract/','','https://mariadb.com/kb/en/extract/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (488,31,'FROM_DAYS','Syntax\n------ \nFROM_DAYS(N)\n \nDescription\n----------- \nGiven a day number N, returns a DATE value. The day count is\nbased on the number of days from the start of the standard\ncalendar (0000-00-00). \n \nThe function is not designed for use with dates before the\nadvent of the Gregorian calendar in October 1582. Results\nwill not be reliable since it doesn\'t account for the lost\ndays when the calendar changed from the Julian calendar.\n \nThis is the converse of the TO_DAYS() function.\n \nExamples\n-------- \nSELECT FROM_DAYS(730669);\n+-------------------+\n| FROM_DAYS(730669) |\n+-------------------+\n| 2000-07-03 |\n+-------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/from_days/','','https://mariadb.com/kb/en/from_days/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (489,31,'FROM_UNIXTIME','Syntax\n------ \nFROM_UNIXTIME(unix_timestamp),\nFROM_UNIXTIME(unix_timestamp,format)\n \nDescription\n----------- \nReturns a representation of the unix_timestamp argument as a\nvalue in\n\'YYYY-MM-DD HH:MM:SS\' or YYYYMMDDHHMMSS.uuuuuu format,\ndepending on\nwhether the function is used in a string or numeric context.\nThe value\nis expressed in the current time zone. unix_timestamp is an\ninternal\ntimestamp value such as is produced by the UNIX_TIMESTAMP()\nfunction.\n \nIf format is given, the result is formatted according to the\nformat\nstring, which is used the same way as listed in the entry\nfor the\nDATE_FORMAT() function.\n \nTimestamps in MariaDB have a maximum value of 2147483647,\nequivalent to 2038-01-19 05:14:07. This is due to the\nunderlying 32-bit limitation. Using the function on a\ntimestamp beyond this will result in NULL being returned.\nUse DATETIME as a storage type if you require dates beyond\nthis.\n \nThe options that can be used by FROM_UNIXTIME(), as well as\nDATE_FORMAT() and STR_TO_DATE(), are:\n \nOption | Description | \n \n%a | Short weekday name in current locale (Variable\nlc_time_names). | \n \n%b | Short form month name in current locale. For locale\nen_US this is one of:\nJan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov or Dec. | \n \n%c | Month with 1 or 2 digits. | \n \n%D | Day with English suffix \'th\', \'nd\', \'st\' or\n\'rd\'\'. (1st, 2nd, 3rd...). | \n \n%d | Day with 2 digits. | \n \n%e | Day with 1 or 2 digits. | \n \n%f | Sub seconds 6 digits. | \n \n%H | Hour with 2 digits between 00-23. | \n \n%h | Hour with 2 digits between 01-12. | \n \n%I | Hour with 2 digits between 01-12. | \n \n%i | Minute with 2 digits. | \n \n%j | Day of the year (001-366) | \n \n%k | Hour with 1 digits between 0-23. | \n \n%l | Hour with 1 digits between 1-12. | \n \n%M | Full month name in current locale (Variable\nlc_time_names). | \n \n%m | Month with 2 digits. | \n \n%p | AM/PM according to current locale (Variable\nlc_time_names). | \n \n%r | Time in 12 hour format, followed by AM/PM. Short for\n\'%I:%i:%S %p\'. | \n \n%S | Seconds with 2 digits. | \n \n%s | Seconds with 2 digits. | \n \n%T | Time in 24 hour format. Short for \'%H:%i:%S\'. | \n \n%U | Week number (00-53), when first day of the week is\nSunday. | \n \n%u | Week number (00-53), when first day of the week is\nMonday. | \n \n%V | Week number (01-53), when first day of the week is\nSunday. Used with %X. | \n \n%v | Week number (01-53), when first day of the week is\nMonday. Used with %x. | \n \n%W | Full weekday name in current locale (Variable\nlc_time_names). | \n \n%w | Day of the week. 0 = Sunday, 1 = Saturday. | \n \n%X | Year with 4 digits when first day of the week is\nSunday. Used with %V. | \n \n%x | Year with 4 digits when first day of the week is\nSunday. Used with %v. | \n \n%Y | Year with 4 digits. | \n \n%y | Year with 2 digits. | \n \n%# | For str_to_date(), skip all numbers. | \n \n%. | For str_to_date(), skip all punctation characters. | \n \n%@ | For str_to_date(), skip all alpha characters. | \n \n%% | A literal % character. | \n \nPerformance Considerations\n \nIf your session time zone is set to SYSTEM (the default),\nFROM_UNIXTIME() will call the OS function to convert the\ndata using the system time zone. At least on Linux, the\ncorresponding function (localtime_r) uses a global mutex\ninside glibc that can cause contention under high concurrent\nload.\n \nSet your time zone to a named time zone to avoid this issue.\nSee mysql time zone tables for details on how to do this.\n \nExamples\n-------- \nSELECT FROM_UNIXTIME(1196440219);\n+---------------------------+\n| FROM_UNIXTIME(1196440219) |\n+---------------------------+\n| 2007-11-30 11:30:19 |\n+---------------------------+\n \nSELECT FROM_UNIXTIME(1196440219) + 0;\n \n+-------------------------------+\n| FROM_UNIXTIME(1196440219) + 0 |\n+-------------------------------+\n| 20071130113019.000000 |\n+-------------------------------+\n \nSELECT FROM_UNIXTIME(UNIX_TIMESTAMP(), \'%Y %D %M %h:%i:%s\n%x\');\n+---------------------------------------------------------+\n| FROM_UNIXTIME(UNIX_TIMESTAMP(), \'%Y %D %M %h:%i:%s %x\')\n|\n+---------------------------------------------------------+\n| 2010 27th March 01:03:47 2010 |\n+---------------------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/from_unixtime/','','https://mariadb.com/kb/en/from_unixtime/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (490,31,'GET_FORMAT','Syntax\n------ \nGET_FORMAT({DATE|DATETIME|TIME},\n{\'EUR\'|\'USA\'|\'JIS\'|\'ISO\'|\'INTERNAL\'})\n \nDescription\n----------- \nReturns a format string. This function is useful in\ncombination with\nthe DATE_FORMAT() and the STR_TO_DATE() functions.\n \nPossible result formats are:\n \nFunction Call | Result Format | \n \nGET_FORMAT(DATE,\'EUR\') | \'%d.%m.%Y\' | \n \nGET_FORMAT(DATE,\'USA\') | \'%m.%d.%Y\' | \n \nGET_FORMAT(DATE,\'JIS\') | \'%Y-%m-%d\' | \n \nGET_FORMAT(DATE,\'ISO\') | \'%Y-%m-%d\' | \n \nGET_FORMAT(DATE,\'INTERNAL\') | \'%Y%m%d\' | \n \nGET_FORMAT(DATETIME,\'EUR\') | \'%Y-%m-%d %H.%i.%s\' | \n \nGET_FORMAT(DATETIME,\'USA\') | \'%Y-%m-%d %H.%i.%s\' | \n \nGET_FORMAT(DATETIME,\'JIS\') | \'%Y-%m-%d %H:%i:%s\' | \n \nGET_FORMAT(DATETIME,\'ISO\') | \'%Y-%m-%d %H:%i:%s\' | \n \nGET_FORMAT(DATETIME,\'INTERNAL\') | \'%Y%m%d%H%i%s\' | \n \nGET_FORMAT(TIME,\'EUR\') | \'%H.%i.%s\' | \n \nGET_FORMAT(TIME,\'USA\') | \'%h:%i:%s %p\' | \n \nGET_FORMAT(TIME,\'JIS\') | \'%H:%i:%s\' | \n \nGET_FORMAT(TIME,\'ISO\') | \'%H:%i:%s\' | \n \nGET_FORMAT(TIME,\'INTERNAL\') | \'%H%i%s\' | \n \nExamples\n-------- \nObtaining the string matching to the standard European date\nformat:\n \nSELECT GET_FORMAT(DATE, \'EUR\');\n+-------------------------+\n| GET_FORMAT(DATE, \'EUR\') |\n+-------------------------+\n| %d.%m.%Y |\n+-------------------------+\n \nUsing the same string to format a date:\n \nSELECT DATE_FORMAT(\'2003-10-03\',GET_FORMAT(DATE,\'EUR\'));\n+--------------------------------------------------+\n| DATE_FORMAT(\'2003-10-03\',GET_FORMAT(DATE,\'EUR\')) |\n+--------------------------------------------------+\n| 03.10.2003 |\n+--------------------------------------------------+\n \nSELECT STR_TO_DATE(\'10.31.2003\',GET_FORMAT(DATE,\'USA\'));\n+--------------------------------------------------+\n| STR_TO_DATE(\'10.31.2003\',GET_FORMAT(DATE,\'USA\')) |\n+--------------------------------------------------+\n| 2003-10-31 |\n+--------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/get_format/','','https://mariadb.com/kb/en/get_format/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (491,31,'HOUR','Syntax\n------ \nHOUR(time)\n \nDescription\n----------- \nReturns the hour for time. The range of the return value is\n0 to 23\nfor time-of-day values. However, the range of TIME values\nactually is\nmuch larger, so HOUR can return values greater than 23.\n \nThe return value is always positive, even if a negative TIME\nvalue is provided.\n \nExamples\n-------- \nSELECT HOUR(\'10:05:03\');\n+------------------+\n| HOUR(\'10:05:03\') |\n+------------------+\n| 10 |\n+------------------+\n \nSELECT HOUR(\'272:59:59\');\n+-------------------+\n| HOUR(\'272:59:59\') |\n+-------------------+\n| 272 |\n+-------------------+\n \nDifference between EXTRACT (HOUR FROM ...) (>= MariaDB\n10.0.7 and MariaDB 5.5.35) and HOUR:\n \nSELECT EXTRACT(HOUR FROM \'26:30:00\'), HOUR(\'26:30:00\');\n+-------------------------------+------------------+\n| EXTRACT(HOUR FROM \'26:30:00\') | HOUR(\'26:30:00\') |\n+-------------------------------+------------------+\n| 2 | 26 |\n+-------------------------------+------------------+\n \n\n\nURL: https://mariadb.com/kb/en/hour/','','https://mariadb.com/kb/en/hour/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (492,31,'LAST_DAY','Syntax\n------ \nLAST_DAY(date)\n \nDescription\n----------- \nTakes a date or datetime value and returns the corresponding\nvalue for\nthe last day of the month. Returns NULL if the argument is\ninvalid.\n \nExamples\n-------- \nSELECT LAST_DAY(\'2003-02-05\');\n+------------------------+\n| LAST_DAY(\'2003-02-05\') |\n+------------------------+\n| 2003-02-28 |\n+------------------------+\n \nSELECT LAST_DAY(\'2004-02-05\');\n+------------------------+\n| LAST_DAY(\'2004-02-05\') |\n+------------------------+\n| 2004-02-29 |\n+------------------------+\n \nSELECT LAST_DAY(\'2004-01-01 01:01:01\');\n+---------------------------------+\n| LAST_DAY(\'2004-01-01 01:01:01\') |\n+---------------------------------+\n| 2004-01-31 |\n+---------------------------------+\n \nSELECT LAST_DAY(\'2003-03-32\');\n+------------------------+\n| LAST_DAY(\'2003-03-32\') |\n+------------------------+\n| NULL |\n+------------------------+\n1 row in set, 1 warning (0.00 sec)\n \nWarning (Code 1292): Incorrect datetime value:\n\'2003-03-32\'\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/last_day/','','https://mariadb.com/kb/en/last_day/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (493,31,'LOCALTIME','Syntax\n------ \nLOCALTIME\nLOCALTIME([precision])\n \nDescription\n----------- \nLOCALTIME and LOCALTIME() are synonyms for NOW().\n \n\n\nURL: https://mariadb.com/kb/en/localtime/','','https://mariadb.com/kb/en/localtime/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (494,31,'LOCALTIMESTAMP','Syntax\n------ \nLOCALTIMESTAMP\nLOCALTIMESTAMP([precision])\n \nDescription\n----------- \nLOCALTIMESTAMP and LOCALTIMESTAMP() are synonyms for NOW().\n \n\n\nURL: https://mariadb.com/kb/en/localtimestamp/','','https://mariadb.com/kb/en/localtimestamp/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (495,31,'MAKEDATE','Syntax\n------ \nMAKEDATE(year,dayofyear)\n \nDescription\n----------- \nReturns a date, given year and day-of-year values. dayofyear\nmust be\ngreater than 0 or the result is NULL.\n \nExamples\n-------- \nSELECT MAKEDATE(2011,31), MAKEDATE(2011,32);\n+-------------------+-------------------+\n| MAKEDATE(2011,31) | MAKEDATE(2011,32) |\n+-------------------+-------------------+\n| 2011-01-31 | 2011-02-01 |\n+-------------------+-------------------+\n \nSELECT MAKEDATE(2011,365), MAKEDATE(2014,365);\n+--------------------+--------------------+\n| MAKEDATE(2011,365) | MAKEDATE(2014,365) |\n+--------------------+--------------------+\n| 2011-12-31 | 2014-12-31 |\n+--------------------+--------------------+\n \nSELECT MAKEDATE(2011,0);\n+------------------+\n| MAKEDATE(2011,0) |\n+------------------+\n| NULL |\n+------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/makedate/','','https://mariadb.com/kb/en/makedate/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (496,31,'MAKETIME','Syntax\n------ \nMAKETIME(hour,minute,second)\n \nDescription\n----------- \nReturns a time value calculated from the hour, minute, and\nsecond arguments.\n \nIf minute or second are out of the range 0 to 60, NULL is\nreturned. The hour can be in the range -838 to 838, outside\nof which the value is truncated with a warning.\n \nExamples\n-------- \nSELECT MAKETIME(13,57,33);\n+--------------------+\n| MAKETIME(13,57,33) |\n+--------------------+\n| 13:57:33 |\n+--------------------+\n \nSELECT MAKETIME(-13,57,33);\n+---------------------+\n| MAKETIME(-13,57,33) |\n+---------------------+\n| -13:57:33 |\n+---------------------+\n \nSELECT MAKETIME(13,67,33);\n+--------------------+\n| MAKETIME(13,67,33) |\n+--------------------+\n| NULL |\n+--------------------+\n \nSELECT MAKETIME(-1000,57,33);\n+-----------------------+\n| MAKETIME(-1000,57,33) |\n+-----------------------+\n| -838:59:59 |\n+-----------------------+\n1 row in set, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+---------+------+-----------------------------------------------+\n| Level | Code | Message |\n+---------+------+-----------------------------------------------+\n| Warning | 1292 | Truncated incorrect time value:\n\'-1000:57:33\' |\n+---------+------+-----------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/maketime/','','https://mariadb.com/kb/en/maketime/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (497,31,'MICROSECOND','Syntax\n------ \nMICROSECOND(expr)\n \nDescription\n----------- \nReturns the microseconds from the time or datetime\nexpression expr as a number in the range from 0 to 999999.\n \nIf expr is a time with no microseconds, zero is returned,\nwhile if expr is a date with no time, zero with a warning is\nreturned.\n \nExamples\n-------- \nSELECT MICROSECOND(\'12:00:00.123456\');\n+--------------------------------+\n| MICROSECOND(\'12:00:00.123456\') |\n+--------------------------------+\n| 123456 |\n+--------------------------------+\n \nSELECT MICROSECOND(\'2009-12-31 23:59:59.000010\');\n+-------------------------------------------+\n| MICROSECOND(\'2009-12-31 23:59:59.000010\') |\n+-------------------------------------------+\n| 10 |\n+-------------------------------------------+\n \nSELECT MICROSECOND(\'2013-08-07 12:13:14\');\n+------------------------------------+\n| MICROSECOND(\'2013-08-07 12:13:14\') |\n+------------------------------------+\n| 0 |\n+------------------------------------+\n \nSELECT MICROSECOND(\'2013-08-07\');\n+---------------------------+\n| MICROSECOND(\'2013-08-07\') |\n+---------------------------+\n| 0 |\n+---------------------------+\n1 row in set, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+---------+------+----------------------------------------------+\n| Level | Code | Message |\n+---------+------+----------------------------------------------+\n| Warning | 1292 | Truncated incorrect time value:\n\'2013-08-07\' |\n+---------+------+----------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/microsecond/','','https://mariadb.com/kb/en/microsecond/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (498,31,'MINUTE','Syntax\n------ \nMINUTE(time)\n \nDescription\n----------- \nReturns the minute for time, in the range 0 to 59. \n \nExamples\n-------- \nSELECT MINUTE(\'2013-08-03 11:04:03\');\n+-------------------------------+\n| MINUTE(\'2013-08-03 11:04:03\') |\n+-------------------------------+\n| 4 |\n+-------------------------------+\n \n SELECT MINUTE (\'23:12:50\');\n+---------------------+\n| MINUTE (\'23:12:50\') |\n+---------------------+\n| 12 |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/minute/','','https://mariadb.com/kb/en/minute/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (499,31,'MONTH','Syntax\n------ \nMONTH(date)\n \nDescription\n----------- \nReturns the month for date in the range 1 to 12 for January\nto\nDecember, or 0 for dates such as \'0000-00-00\' or\n\'2008-00-00\' that\nhave a zero month part.\n \nExamples\n-------- \nSELECT MONTH(\'2019-01-03\');\n+---------------------+\n| MONTH(\'2019-01-03\') |\n+---------------------+\n| 1 |\n+---------------------+\n \nSELECT MONTH(\'2019-00-03\');\n+---------------------+\n| MONTH(\'2019-00-03\') |\n+---------------------+\n| 0 |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/month/','','https://mariadb.com/kb/en/month/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (500,31,'MONTHNAME','Syntax\n------ \nMONTHNAME(date)\n \nDescription\n----------- \nReturns the full name of the month for date. The language\nused for the name is controlled by the value of the\nlc_time_names system variable. See server locale for more on\nthe supported locales.\n \nExamples\n-------- \nSELECT MONTHNAME(\'2019-02-03\');\n+-------------------------+\n| MONTHNAME(\'2019-02-03\') |\n+-------------------------+\n| February |\n+-------------------------+\n \nChanging the locale:\n \nSET lc_time_names = \'fr_CA\';\n \nSELECT MONTHNAME(\'2019-05-21\');\n+-------------------------+\n| MONTHNAME(\'2019-05-21\') |\n+-------------------------+\n| mai |\n+-------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/monthname/','','https://mariadb.com/kb/en/monthname/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (501,31,'NOW','Syntax\n------ \nNOW([precision])\nCURRENT_TIMESTAMP\nCURRENT_TIMESTAMP([precision])\nLOCALTIME, LOCALTIME([precision])\nLOCALTIMESTAMP\nLOCALTIMESTAMP([precision])\n \nDescription\n----------- \nReturns the current date and time as a value in \'YYYY-MM-DD\nHH:MM:SS\'\nor YYYYMMDDHHMMSS.uuuuuu format, depending on whether the\nfunction is\nused in a string or numeric context. The value is expressed\nin the\ncurrent time zone.\n \nThe optional precision determines the microsecond precision.\nSee Microseconds in MariaDB.\n \nNOW() (or its synonyms) can be used as the default value for\nTIMESTAMP columns as well as, since MariaDB 10.0.1, DATETIME\ncolumns. Before MariaDB 10.0.1, it was only possible for a\nsingle TIMESTAMP column per table to contain the\nCURRENT_TIMESTAMP as its default.\n \nWhen displayed in the INFORMATION_SCHEMA.COLUMNS table, a\ndefault CURRENT TIMESTAMP is displayed as CURRENT_TIMESTAMP\nup until MariaDB 10.2.2, and as current_timestamp() from\nMariaDB 10.2.3, due to to MariaDB 10.2 accepting expressions\nin the DEFAULT clause.\n \nExamples\n-------- \nSELECT NOW();\n+---------------------+\n| NOW() |\n+---------------------+\n| 2010-03-27 13:13:25 |\n+---------------------+\n \nSELECT NOW() + 0;\n \n+-----------------------+\n| NOW() + 0 |\n+-----------------------+\n| 20100327131329.000000 |\n+-----------------------+\n \nWith precision:\n \nSELECT CURRENT_TIMESTAMP(2);\n+------------------------+\n| CURRENT_TIMESTAMP(2) |\n+------------------------+\n| 2018-07-10 09:47:26.24 |\n+------------------------+\n \nUsed as a default TIMESTAMP:\n \nCREATE TABLE t (createdTS TIMESTAMP NOT NULL DEFAULT\nCURRENT_TIMESTAMP);\n \nFrom MariaDB 10.2.2:\n \nSELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE\nTABLE_SCHEMA=\'test\'\n AND COLUMN_NAME LIKE \'%ts%\'\\G\n*************************** 1. row\n***************************\n TABLE_CATALOG: def\n TABLE_SCHEMA: test\n TABLE_NAME: t\n COLUMN_NAME: ts\n ORDINAL_POSITION: 1\n COLUMN_DEFAULT: current_timestamp()\n...\n \n\n\nURL: https://mariadb.com/kb/en/now/','','https://mariadb.com/kb/en/now/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (502,31,'PERIOD_ADD','Syntax\n------ \nPERIOD_ADD(P,N)\n \nDescription\n----------- \nAdds N months to period P. P is in the format YYMM or\nYYYYMM, and is not a date value. If P contains a two-digit\nyear, values from 00 to 69 are converted to from 2000 to\n2069, while values from 70 are converted to 1970 upwards.\n \nReturns a value in the format YYYYMM.\n \nExamples\n-------- \nSELECT PERIOD_ADD(200801,2);\n+----------------------+\n| PERIOD_ADD(200801,2) |\n+----------------------+\n| 200803 |\n+----------------------+\n \nSELECT PERIOD_ADD(6910,2);\n+--------------------+\n| PERIOD_ADD(6910,2) |\n+--------------------+\n| 206912 |\n+--------------------+\n \nSELECT PERIOD_ADD(7010,2);\n+--------------------+\n| PERIOD_ADD(7010,2) |\n+--------------------+\n| 197012 |\n+--------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/period_add/','','https://mariadb.com/kb/en/period_add/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (503,31,'PERIOD_DIFF','Syntax\n------ \nPERIOD_DIFF(P1,P2)\n \nDescription\n----------- \nReturns the number of months between periods P1 and P2. P1\nand P2 \ncan be in the format YYMM or YYYYMM, and are not date\nvalues.\n \nIf P1 or P2 contains a two-digit year, values from 00 to 69\nare converted to from 2000 to 2069, while values from 70 are\nconverted to 1970 upwards.\n \nExamples\n-------- \nSELECT PERIOD_DIFF(200802,200703);\n+----------------------------+\n| PERIOD_DIFF(200802,200703) |\n+----------------------------+\n| 11 |\n+----------------------------+\n \nSELECT PERIOD_DIFF(6902,6803);\n+------------------------+\n| PERIOD_DIFF(6902,6803) |\n+------------------------+\n| 11 |\n+------------------------+\n \nSELECT PERIOD_DIFF(7002,6803);\n+------------------------+\n| PERIOD_DIFF(7002,6803) |\n+------------------------+\n| -1177 |\n+------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/period_diff/','','https://mariadb.com/kb/en/period_diff/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (504,31,'QUARTER','Syntax\n------ \nQUARTER(date)\n \nDescription\n----------- \nReturns the quarter of the year for date, in the range 1 to\n4. Returns 0 if month contains a zero value, or NULL if the\ngiven value is not otherwise a valid date (zero values are\naccepted).\n \nExamples\n-------- \nSELECT QUARTER(\'2008-04-01\');\n+-----------------------+\n| QUARTER(\'2008-04-01\') |\n+-----------------------+\n| 2 |\n+-----------------------+\n \nSELECT QUARTER(\'2019-00-01\');\n+-----------------------+\n| QUARTER(\'2019-00-01\') |\n+-----------------------+\n| 0 |\n+-----------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/quarter/','','https://mariadb.com/kb/en/quarter/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (505,31,'SECOND','Syntax\n------ \nSECOND(time)\n \nDescription\n----------- \nReturns the second for a given time (which can include\nmicroseconds), in the range 0 to 59, or NULL if not given a\nvalid time value.\n \nExamples\n-------- \nSELECT SECOND(\'10:05:03\');\n+--------------------+\n| SECOND(\'10:05:03\') |\n+--------------------+\n| 3 |\n+--------------------+\n \nSELECT SECOND(\'10:05:01.999999\');\n+---------------------------+\n| SECOND(\'10:05:01.999999\') |\n+---------------------------+\n| 1 |\n+---------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/second/','','https://mariadb.com/kb/en/second/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (506,31,'SEC_TO_TIME','Syntax\n------ \nSEC_TO_TIME(seconds)\n \nDescription\n----------- \nReturns the seconds argument, converted to hours, minutes,\nand\nseconds, as a TIME value. The range of the result is\nconstrained to\nthat of the TIME data type. A warning occurs if the argument\ncorresponds to a value outside that range.\n \nThe time will be returned in the format hh:mm:ss, or hhmmss\nif used in a numeric calculation.\n \nExamples\n-------- \nSELECT SEC_TO_TIME(12414);\n+--------------------+\n| SEC_TO_TIME(12414) |\n+--------------------+\n| 03:26:54 |\n+--------------------+\n \nSELECT SEC_TO_TIME(12414)+0;\n \n+----------------------+\n| SEC_TO_TIME(12414)+0 |\n+----------------------+\n| 32654 |\n+----------------------+\n \nSELECT SEC_TO_TIME(9999999);\n+----------------------+\n| SEC_TO_TIME(9999999) |\n+----------------------+\n| 838:59:59 |\n+----------------------+\n1 row in set, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+---------+------+-------------------------------------------+\n| Level | Code | Message |\n+---------+------+-------------------------------------------+\n| Warning | 1292 | Truncated incorrect time value:\n\'9999999\' |\n+---------+------+-------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/sec_to_time/','','https://mariadb.com/kb/en/sec_to_time/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (507,31,'STR_TO_DATE','Syntax\n------ \nSTR_TO_DATE(str,format)\n \nDescription\n----------- \nThis is the inverse of the DATE_FORMAT() function. It takes\na string str and a format string format. STR_TO_DATE()\nreturns a\nDATETIME value if the format string contains both date and\ntime parts, or a\nDATE or TIME value if the string contains only date or time\nparts.\n \nThe date, time, or datetime values contained in str should\nbe given in the format indicated by format. If str contains\nan illegal date, time, or datetime value, STR_TO_DATE()\nreturns NULL. An illegal value also produces a warning.\n \nThe options that can be used by STR_TO_DATE(), as well as\nits inverse DATE_FORMAT() and the FROM_UNIXTIME() function,\nare:\n \nOption | Description | \n \n%a | Short weekday name in current locale (Variable\nlc_time_names). | \n \n%b | Short form month name in current locale. For locale\nen_US this is one of:\nJan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov or Dec. | \n \n%c | Month with 1 or 2 digits. | \n \n%D | Day with English suffix \'th\', \'nd\', \'st\' or\n\'rd\'\'. (1st, 2nd, 3rd...). | \n \n%d | Day with 2 digits. | \n \n%e | Day with 1 or 2 digits. | \n \n%f | Sub seconds 6 digits. | \n \n%H | Hour with 2 digits between 00-23. | \n \n%h | Hour with 2 digits between 01-12. | \n \n%I | Hour with 2 digits between 01-12. | \n \n%i | Minute with 2 digits. | \n \n%j | Day of the year (001-366) | \n \n%k | Hour with 1 digits between 0-23. | \n \n%l | Hour with 1 digits between 1-12. | \n \n%M | Full month name in current locale (Variable\nlc_time_names). | \n \n%m | Month with 2 digits. | \n \n%p | AM/PM according to current locale (Variable\nlc_time_names). | \n \n%r | Time in 12 hour format, followed by AM/PM. Short for\n\'%I:%i:%S %p\'. | \n \n%S | Seconds with 2 digits. | \n \n%s | Seconds with 2 digits. | \n \n%T | Time in 24 hour format. Short for \'%H:%i:%S\'. | \n \n%U | Week number (00-53), when first day of the week is\nSunday. | \n \n%u | Week number (00-53), when first day of the week is\nMonday. | \n \n%V | Week number (01-53), when first day of the week is\nSunday. Used with %X. | \n \n%v | Week number (01-53), when first day of the week is\nMonday. Used with %x. | \n \n%W | Full weekday name in current locale (Variable\nlc_time_names). | \n \n%w | Day of the week. 0 = Sunday, 6 = Saturday. | \n \n%X | Year with 4 digits when first day of the week is\nSunday. Used with %V. | \n \n%x | Year with 4 digits when first day of the week is\nMonday. Used with %v. | \n \n%Y | Year with 4 digits. | \n \n%y | Year with 2 digits. | \n \n%# | For str_to_date(), skip all numbers. | \n \n%. | For str_to_date(), skip all punctation characters. | \n \n%@ | For str_to_date(), skip all alpha characters. | \n \n%% | A literal % character. | \n \nExamples\n-------- \nSELECT STR_TO_DATE(\'Wednesday, June 2, 2014\', \'%W, %M %e,\n%Y\');\n+---------------------------------------------------------+\n| STR_TO_DATE(\'Wednesday, June 2, 2014\', \'%W, %M %e,\n%Y\') |\n+---------------------------------------------------------+\n| 2014-06-02 |\n+---------------------------------------------------------+\n \nSELECT STR_TO_DATE(\'Wednesday23423, June 2, 2014\', \'%W,\n%M %e, %Y\');\n+--------------------------------------------------------------+\n| STR_TO_DATE(\'Wednesday23423, June 2, 2014\', \'%W, %M %e,\n%Y\') |\n+--------------------------------------------------------------+\n| NULL |\n+--------------------------------------------------------------+\n1 row in set, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+---------+------+-----------------------------------------------------------------------------------+\n| Level | Code | Message |\n+---------+------+-----------------------------------------------------------------------------------+\n| Warning | 1411 | Incorrect datetime value:\n\'Wednesday23423, June 2, 2014\' for function str_to_date |\n+---------+------+-----------------------------------------------------------------------------------+\n \nSELECT STR_TO_DATE(\'Wednesday23423, June 2, 2014\', \'%W%#,\n%M %e, %Y\');\n+----------------------------------------------------------------+\n| STR_TO_DATE(\'Wednesday23423, June 2, 2014\', \'%W%#, %M\n%e, %Y\') |\n+----------------------------------------------------------------+\n| 2014-06-02 |\n+----------------------------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/str_to_date/','','https://mariadb.com/kb/en/str_to_date/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (508,31,'SUBDATE','Syntax\n------ \nSUBDATE(date,INTERVAL expr unit), SUBDATE(expr,days)\n \nDescription\n----------- \nWhen invoked with the INTERVAL form of the second argument,\nSUBDATE()\nis a synonym for DATE_SUB(). See Date and Time Units for a\ncomplete list of permitted units. \n \nThe second form allows the use of an integer value for days.\nIn such\ncases, it is interpreted as the number of days to be\nsubtracted from\nthe date or datetime expression expr.\n \nExamples\n-------- \nSELECT DATE_SUB(\'2008-01-02\', INTERVAL 31 DAY);\n+-----------------------------------------+\n| DATE_SUB(\'2008-01-02\', INTERVAL 31 DAY) |\n+-----------------------------------------+\n| 2007-12-02 |\n+-----------------------------------------+\n \nSELECT SUBDATE(\'2008-01-02\', INTERVAL 31 DAY);\n+----------------------------------------+\n| SUBDATE(\'2008-01-02\', INTERVAL 31 DAY) |\n+----------------------------------------+\n| 2007-12-02 |\n+----------------------------------------+\n \nSELECT SUBDATE(\'2008-01-02 12:00:00\', 31);\n+------------------------------------+\n| SUBDATE(\'2008-01-02 12:00:00\', 31) |\n+------------------------------------+\n| 2007-12-02 12:00:00 |\n+------------------------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n (\"2007-01-30 21:31:07\"),\n (\"1983-10-15 06:42:51\"),\n (\"2011-04-21 12:34:56\"),\n (\"2011-10-30 06:31:41\"),\n (\"2011-01-30 14:03:25\"),\n (\"2004-10-07 11:19:34\");\n \nSELECT d, SUBDATE(d, 10) from t1;\n \n+---------------------+---------------------+\n| d | SUBDATE(d, 10) |\n+---------------------+---------------------+\n| 2007-01-30 21:31:07 | 2007-01-20 21:31:07 |\n| 1983-10-15 06:42:51 | 1983-10-05 06:42:51 |\n| 2011-04-21 12:34:56 | 2011-04-11 12:34:56 |\n| 2011-10-30 06:31:41 | 2011-10-20 06:31:41 |\n| 2011-01-30 14:03:25 | 2011-01-20 14:03:25 |\n| 2004-10-07 11:19:34 | 2004-09-27 11:19:34 |\n+---------------------+---------------------+\n \nSELECT d, SUBDATE(d, INTERVAL 10 MINUTE) from t1;\n \n+---------------------+--------------------------------+\n| d | SUBDATE(d, INTERVAL 10 MINUTE) |\n+---------------------+--------------------------------+\n| 2007-01-30 21:31:07 | 2007-01-30 21:21:07 |\n| 1983-10-15 06:42:51 | 1983-10-15 06:32:51 |\n| 2011-04-21 12:34:56 | 2011-04-21 12:24:56 |\n| 2011-10-30 06:31:41 | 2011-10-30 06:21:41 |\n| 2011-01-30 14:03:25 | 2011-01-30 13:53:25 |\n| 2004-10-07 11:19:34 | 2004-10-07 11:09:34 |\n+---------------------+--------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/subdate/','','https://mariadb.com/kb/en/subdate/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (509,31,'SUBTIME','Syntax\n------ \nSUBTIME(expr1,expr2)\n \nDescription\n----------- \nSUBTIME() returns expr1 - expr2 expressed as a value in the\nsame\nformat as expr1. expr1 is a time or datetime expression, and\nexpr2 is\na time expression.\n \nExamples\n-------- \nSELECT SUBTIME(\'2007-12-31 23:59:59.999999\',\'1\n1:1:1.000002\');\n+--------------------------------------------------------+\n| SUBTIME(\'2007-12-31 23:59:59.999999\',\'1 1:1:1.000002\')\n|\n+--------------------------------------------------------+\n| 2007-12-30 22:58:58.999997 |\n+--------------------------------------------------------+\n \nSELECT SUBTIME(\'01:00:00.999999\', \'02:00:00.999998\');\n+-----------------------------------------------+\n| SUBTIME(\'01:00:00.999999\', \'02:00:00.999998\') |\n+-----------------------------------------------+\n| -00:59:59.999999 |\n+-----------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/subtime/','','https://mariadb.com/kb/en/subtime/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (510,31,'SYSDATE','Syntax\n------ \nSYSDATE([precision])\n \nDescription\n----------- \nReturns the current date and time as a value in \'YYYY-MM-DD\nHH:MM:SS\'\nor YYYYMMDDHHMMSS.uuuuuu format, depending on whether the\nfunction is\nused in a string or numeric context.\n \nThe optional precision determines the microsecond precision.\nSee Microseconds in MariaDB.\n \nSYSDATE() returns the time at which it executes. This\ndiffers from the\nbehavior for NOW(), which returns a constant time that\nindicates the\ntime at which the statement began to execute. (Within a\nstored routine\nor trigger, NOW() returns the time at which the routine or\ntriggering\nstatement began to execute.)\n \nIn addition, changing the timestamp system variable with a\nSET timestamp statement affects the value returned by\nNOW() but not by SYSDATE(). This means that timestamp\nsettings in the\nbinary log have no effect on invocations of SYSDATE().\n \nBecause SYSDATE() can return different values even within\nthe same\nstatement, and is not affected by SET TIMESTAMP, it is\nnon-deterministic and therefore unsafe for replication if\nstatement-based binary logging is used. If that is a\nproblem, you can\nuse row-based logging, or start the server with the mysqld\noption --sysdate-is-now to cause SYSDATE() to be an alias\nfor NOW(). The non-deterministic nature of SYSDATE() also\nmeans that indexes cannot be used for evaluating expressions\nthat refer to it, and that statements using the SYSDATE()\nfunction are unsafe for statement-based replication.\n \nExamples\n-------- \nDifference between NOW() and SYSDATE():\n \nSELECT NOW(), SLEEP(2), NOW();\n+---------------------+----------+---------------------+\n| NOW() | SLEEP(2) | NOW() |\n+---------------------+----------+---------------------+\n| 2010-03-27 13:23:40 | 0 | 2010-03-27 13:23:40 |\n+---------------------+----------+---------------------+\n \nSELECT SYSDATE(), SLEEP(2), SYSDATE();\n+---------------------+----------+---------------------+\n| SYSDATE() | SLEEP(2) | SYSDATE() |\n+---------------------+----------+---------------------+\n| 2010-03-27 13:23:52 | 0 | 2010-03-27 13:23:54 |\n+---------------------+----------+---------------------+\n \nWith precision:\n \nSELECT SYSDATE(4);\n+--------------------------+\n| SYSDATE(4) |\n+--------------------------+\n| 2018-07-10 10:17:13.1689 |\n+--------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/sysdate/','','https://mariadb.com/kb/en/sysdate/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (511,31,'TIME Function','Syntax\n------ \nTIME(expr)\n \nDescription\n----------- \nExtracts the time part of the time or datetime expression\nexpr and\nreturns it as a string.\n \nExamples\n-------- \nSELECT TIME(\'2003-12-31 01:02:03\');\n+-----------------------------+\n| TIME(\'2003-12-31 01:02:03\') |\n+-----------------------------+\n| 01:02:03 |\n+-----------------------------+\n \nSELECT TIME(\'2003-12-31 01:02:03.000123\');\n+------------------------------------+\n| TIME(\'2003-12-31 01:02:03.000123\') |\n+------------------------------------+\n| 01:02:03.000123 |\n+------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/time-function/','','https://mariadb.com/kb/en/time-function/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (512,31,'TIMEDIFF','Syntax\n------ \nTIMEDIFF(expr1,expr2)\n \nDescription\n----------- \nTIMEDIFF() returns expr1 - expr2 expressed as a time value.\nexpr1 and\nexpr2 are time or date-and-time expressions, but both must\nbe of the\nsame type.\n \nExamples\n-------- \nSELECT TIMEDIFF(\'2000:01:01 00:00:00\', \'2000:01:01\n00:00:00.000001\');\n+---------------------------------------------------------------+\n| TIMEDIFF(\'2000:01:01 00:00:00\', \'2000:01:01\n00:00:00.000001\') |\n+---------------------------------------------------------------+\n| -00:00:00.000001 |\n+---------------------------------------------------------------+\n \nSELECT TIMEDIFF(\'2008-12-31 23:59:59.000001\', \'2008-12-30\n01:01:01.000002\');\n+----------------------------------------------------------------------+\n| TIMEDIFF(\'2008-12-31 23:59:59.000001\', \'2008-12-30\n01:01:01.000002\') |\n+----------------------------------------------------------------------+\n| 46:58:57.999999 |\n+----------------------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/timediff/','','https://mariadb.com/kb/en/timediff/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (513,31,'TIMESTAMP FUNCTION','Syntax\n------ \nTIMESTAMP(expr), TIMESTAMP(expr1,expr2)\n \nDescription\n----------- \nWith a single argument, this function returns the date or\ndatetime\nexpression expr as a datetime value. With two arguments, it\nadds the\ntime expression expr2 to the date or datetime expression\nexpr1 and\nreturns the result as a datetime value.\n \nExamples\n-------- \nSELECT TIMESTAMP(\'2003-12-31\');\n+-------------------------+\n| TIMESTAMP(\'2003-12-31\') |\n+-------------------------+\n| 2003-12-31 00:00:00 |\n+-------------------------+\n \nSELECT TIMESTAMP(\'2003-12-31 12:00:00\',\'6:30:00\');\n+--------------------------------------------+\n| TIMESTAMP(\'2003-12-31 12:00:00\',\'6:30:00\') |\n+--------------------------------------------+\n| 2003-12-31 18:30:00 |\n+--------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/timestamp-function/','','https://mariadb.com/kb/en/timestamp-function/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (514,31,'TIMESTAMPADD','Syntax\n------ \nTIMESTAMPADD(unit,interval,datetime_expr)\n \nDescription\n----------- \nAdds the integer expression interval to the date or datetime\nexpression datetime_expr. The unit for interval is given by\nthe unit\nargument, which should be one of the following values:\nMICROSECOND, SECOND, MINUTE, HOUR, DAY, WEEK, MONTH,\nQUARTER, or YEAR.\n \nThe unit value may be specified using one of keywords as\nshown, or\nwith a prefix of SQL_TSI_. For example, DAY and SQL_TSI_DAY\nboth are\nlegal.\n \nBefore MariaDB 5.5, FRAC_SECOND was permitted as a synonym\nfor MICROSECOND.\n \nExamples\n-------- \nSELECT TIMESTAMPADD(MINUTE,1,\'2003-01-02\');\n+-------------------------------------+\n| TIMESTAMPADD(MINUTE,1,\'2003-01-02\') |\n+-------------------------------------+\n| 2003-01-02 00:01:00 |\n+-------------------------------------+\n \nSELECT TIMESTAMPADD(WEEK,1,\'2003-01-02\');\n+-----------------------------------+\n| TIMESTAMPADD(WEEK,1,\'2003-01-02\') |\n+-----------------------------------+\n| 2003-01-09 |\n+-----------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/timestampadd/','','https://mariadb.com/kb/en/timestampadd/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (515,31,'TIMESTAMPDIFF','Syntax\n------ \nTIMESTAMPDIFF(unit,datetime_expr1,datetime_expr2)\n \nDescription\n----------- \nReturns datetime_expr2 - datetime_expr1, where\ndatetime_expr1 and\ndatetime_expr2 are date or datetime expressions. One\nexpression may be\na date and the other a datetime; a date value is treated as\na datetime\nhaving the time part \'00:00:00\' where necessary. The unit\nfor the\nresult (an integer) is given by the unit argument. The legal\nvalues\nfor unit are the same as those listed in the description of\nthe\nTIMESTAMPADD() function, i.e MICROSECOND, SECOND, MINUTE,\nHOUR, DAY, WEEK, MONTH, QUARTER, or YEAR.\n \nTIMESTAMPDIFF can also be used to calculate age.\n \nExamples\n-------- \nSELECT TIMESTAMPDIFF(MONTH,\'2003-02-01\',\'2003-05-01\');\n+------------------------------------------------+\n| TIMESTAMPDIFF(MONTH,\'2003-02-01\',\'2003-05-01\') |\n+------------------------------------------------+\n| 3 |\n+------------------------------------------------+\n \nSELECT TIMESTAMPDIFF(YEAR,\'2002-05-01\',\'2001-01-01\');\n+-----------------------------------------------+\n| TIMESTAMPDIFF(YEAR,\'2002-05-01\',\'2001-01-01\') |\n+-----------------------------------------------+\n| -1 |\n+-----------------------------------------------+\n \nSELECT TIMESTAMPDIFF(MINUTE,\'2003-02-01\',\'2003-05-01\n12:05:55\');\n+----------------------------------------------------------+\n| TIMESTAMPDIFF(MINUTE,\'2003-02-01\',\'2003-05-01\n12:05:55\') |\n+----------------------------------------------------------+\n| 128885 |\n+----------------------------------------------------------+\n \nCalculating age:\n \nSELECT CURDATE();\n+------------+\n| CURDATE() |\n+------------+\n| 2019-05-27 |\n+------------+\n \nSELECT TIMESTAMPDIFF(YEAR, \'1971-06-06\', CURDATE()) AS\nage;\n \n+------+\n| age |\n+------+\n| 47 |\n+------+\n \nSELECT TIMESTAMPDIFF(YEAR, \'1971-05-06\', CURDATE()) AS\nage;\n \n+------+\n| age |\n+------+\n| 48 |\n+------+\n \nAge as of 2014-08-02:\n \nSELECT name, date_of_birth,\nTIMESTAMPDIFF(YEAR,date_of_birth,\'2014-08-02\') AS age \n FROM student_details;\n \n+---------+---------------+------+\n| name | date_of_birth | age |\n+---------+---------------+------+\n| Chun | 1993-12-31 | 20 |\n| Esben | 1946-01-01 | 68 |\n| Kaolin | 1996-07-16 | 18 |\n| Tatiana | 1988-04-13 | 26 |\n+---------+---------------+------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/timestampdiff/','','https://mariadb.com/kb/en/timestampdiff/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (516,31,'TIME_FORMAT','Syntax\n------ \nTIME_FORMAT(time,format)\n \nDescription\n----------- \nThis is used like the DATE_FORMAT() function, but the format\nstring\nmay contain format specifiers only for hours, minutes, and\nseconds.\nOther specifiers produce a NULL value or 0.\n \nExamples\n-------- \nSELECT TIME_FORMAT(\'100:00:00\', \'%H %k %h %I %l\');\n+--------------------------------------------+\n| TIME_FORMAT(\'100:00:00\', \'%H %k %h %I %l\') |\n+--------------------------------------------+\n| 100 100 04 04 4 |\n+--------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/time_format/','','https://mariadb.com/kb/en/time_format/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (517,31,'TIME_TO_SEC','Syntax\n------ \nTIME_TO_SEC(time)\n \nDescription\n----------- \nReturns the time argument, converted to seconds.\n \nThe value returned by TIME_TO_SEC is of type DOUBLE. Before\nMariaDB 5.3 (and MySQL 5.6), the type was INT. See\nMicroseconds in MariaDB.\n \nExamples\n-------- \nSELECT TIME_TO_SEC(\'22:23:00\');\n+-------------------------+\n| TIME_TO_SEC(\'22:23:00\') |\n+-------------------------+\n| 80580 |\n+-------------------------+\n \nSELECT TIME_TO_SEC(\'00:39:38\');\n+-------------------------+\n| TIME_TO_SEC(\'00:39:38\') |\n+-------------------------+\n| 2378 |\n+-------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/time_to_sec/','','https://mariadb.com/kb/en/time_to_sec/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (518,31,'TO_DAYS','Syntax\n------ \nTO_DAYS(date)\n \nDescription\n----------- \nGiven a date date, returns the number of days since the\nstart of the current calendar (0000-00-00).\n \nThe function is not designed for use with dates before the\nadvent of the Gregorian calendar in October 1582. Results\nwill not be reliable since it doesn\'t account for the lost\ndays when the calendar changed from the Julian calendar.\n \nThis is the converse of the FROM_DAYS() function.\n \nExamples\n-------- \nSELECT TO_DAYS(\'2007-10-07\');\n+-----------------------+\n| TO_DAYS(\'2007-10-07\') |\n+-----------------------+\n| 733321 |\n+-----------------------+\n \nSELECT TO_DAYS(\'0000-01-01\');\n+-----------------------+\n| TO_DAYS(\'0000-01-01\') |\n+-----------------------+\n| 1 |\n+-----------------------+\n \nSELECT TO_DAYS(950501);\n+-----------------+\n| TO_DAYS(950501) |\n+-----------------+\n| 728779 |\n+-----------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/to_days/','','https://mariadb.com/kb/en/to_days/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (519,31,'TO_SECONDS','Syntax\n------ \nTO_SECONDS(expr)\n \nDescription\n----------- \nReturns the number of seconds from year 0 till expr, or NULL\nif expr is not a valid date or datetime.\n \nExamples\n-------- \nSELECT TO_SECONDS(\'2013-06-13\');\n+--------------------------+\n| TO_SECONDS(\'2013-06-13\') |\n+--------------------------+\n| 63538300800 |\n+--------------------------+\n \nSELECT TO_SECONDS(\'2013-06-13 21:45:13\');\n+-----------------------------------+\n| TO_SECONDS(\'2013-06-13 21:45:13\') |\n+-----------------------------------+\n| 63538379113 |\n+-----------------------------------+\n \nSELECT TO_SECONDS(NOW());\n+-------------------+\n| TO_SECONDS(NOW()) |\n+-------------------+\n| 63543530875 |\n+-------------------+\n \nSELECT TO_SECONDS(20130513);\n+----------------------+\n| TO_SECONDS(20130513) |\n+----------------------+\n| 63535622400 |\n+----------------------+\n1 row in set (0.00 sec)\n \nSELECT TO_SECONDS(130513);\n+--------------------+\n| TO_SECONDS(130513) |\n+--------------------+\n| 63535622400 |\n+--------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/to_seconds/','','https://mariadb.com/kb/en/to_seconds/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (520,31,'UNIX_TIMESTAMP','Syntax\n------ \nUNIX_TIMESTAMP()\nUNIX_TIMESTAMP(date)\n \nDescription\n----------- \nIf called with no argument, returns a Unix timestamp\n(seconds since\n\'1970-01-01 00:00:00\' UTC) as an unsigned integer. If\nUNIX_TIMESTAMP()\nis called with a date argument, it returns the value of the\nargument as seconds\nsince \'1970-01-01 00:00:00\' UTC. date may be a DATE\nstring, a\nDATETIME string, a TIMESTAMP, or a number in\nthe format YYMMDD or YYYYMMDD. The server interprets date as\na value in the\ncurrent time zone and converts it to an internal value in\nUTC. Clients can set\ntheir time zone as described in time zones.\n \nThe inverse function of UNIX_TIMESTAMP() is FROM_UNIXTIME()\n \nUNIX_TIMESTAMP() supports microseconds.\n \nTimestamps in MariaDB have a maximum value of 2147483647,\nequivalent to 2038-01-19 05:14:07. This is due to the\nunderlying 32-bit limitation. Using the function on a date\nbeyond this will result in NULL being returned. Use DATETIME\nas a storage type if you require dates beyond this.\n \nError Handling\n \nReturns NULL for wrong arguments to UNIX_TIMESTAMP(). In\nMySQL and MariaDB before 5.3 wrong arguments to\nUNIX_TIMESTAMP() returned 0. \n \nCompatibility\n \nAs you can see in the examples above,\nUNIX_TIMESTAMP(constant-date-string) returns a timestamp\nwith 6 decimals while MariaDB 5.2 and before returns it\nwithout decimals. This can cause a problem if you are using\nUNIX_TIMESTAMP() as a partitioning function. You can fix\nthis by using FLOOR(UNIX_TIMESTAMP(..)) or changing the date\nstring to a date number, like 20080101000000. \n \nExamples\n-------- \nSELECT UNIX_TIMESTAMP();\n+------------------+\n| UNIX_TIMESTAMP() |\n+------------------+\n| 1269711082 |\n+------------------+\n \nSELECT UNIX_TIMESTAMP(\'2007-11-30 10:30:19\');\n+---------------------------------------+\n| UNIX_TIMESTAMP(\'2007-11-30 10:30:19\') |\n+---------------------------------------+\n| 1196436619.000000 |\n+---------------------------------------+\n \nSELECT UNIX_TIMESTAMP(\"2007-11-30 10:30:19.123456\");\n+----------------------------------------------+\n| unix_timestamp(\"2007-11-30 10:30:19.123456\") |\n+----------------------------------------------+\n| 1196411419.123456 |\n+----------------------------------------------+\n \nSELECT FROM_UNIXTIME(UNIX_TIMESTAMP(\'2007-11-30\n10:30:19\'));\n+------------------------------------------------------+\n| FROM_UNIXTIME(UNIX_TIMESTAMP(\'2007-11-30 10:30:19\')) |\n+------------------------------------------------------+\n| 2007-11-30 10:30:19.000000 |\n+------------------------------------------------------+\n \nSELECT FROM_UNIXTIME(FLOOR(UNIX_TIMESTAMP(\'2007-11-30\n10:30:19\')));\n+-------------------------------------------------------------+\n| FROM_UNIXTIME(FLOOR(UNIX_TIMESTAMP(\'2007-11-30\n10:30:19\'))) |\n+-------------------------------------------------------------+\n| 2007-11-30 10:30:19 |\n+-------------------------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/unix_timestamp/','','https://mariadb.com/kb/en/unix_timestamp/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (521,31,'UTC_DATE','Syntax\n------ \nUTC_DATE, UTC_DATE()\n \nDescription\n----------- \nReturns the current UTC date as a value in \'YYYY-MM-DD\' or\nYYYYMMDD\nformat, depending on whether the function is used in a\nstring or numeric context. \n \nExamples\n-------- \nSELECT UTC_DATE(), UTC_DATE() + 0;\n \n+------------+----------------+\n| UTC_DATE() | UTC_DATE() + 0 |\n+------------+----------------+\n| 2010-03-27 | 20100327 |\n+------------+----------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/utc_date/','','https://mariadb.com/kb/en/utc_date/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (522,31,'UTC_TIME','Syntax\n------ \nUTC_TIME\nUTC_TIME([precision])\n \nDescription\n----------- \nReturns the current UTC time as a value in \'HH:MM:SS\' or\nHHMMSS.uuuuuu format, depending on whether the function is\nused in a string or numeric context. \n \nThe optional precision determines the microsecond precision.\nSee Microseconds in MariaDB.\n \nExamples\n-------- \nSELECT UTC_TIME(), UTC_TIME() + 0;\n \n+------------+----------------+\n| UTC_TIME() | UTC_TIME() + 0 |\n+------------+----------------+\n| 17:32:34 | 173234.000000 |\n+------------+----------------+\n \nWith precision:\n \nSELECT UTC_TIME(5);\n+----------------+\n| UTC_TIME(5) |\n+----------------+\n| 07:52:50.78369 |\n+----------------+\n \n\n\nURL: https://mariadb.com/kb/en/utc_time/','','https://mariadb.com/kb/en/utc_time/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (523,31,'UTC_TIMESTAMP','Syntax\n------ \nUTC_TIMESTAMP\nUTC_TIMESTAMP([precision])\n \nDescription\n----------- \nReturns the current UTC date and time as a value in\n\'YYYY-MM-DD\nHH:MM:SS\' or YYYYMMDDHHMMSS.uuuuuu format, depending on\nwhether the\nfunction is used in a string or numeric context.\n \nThe optional precision determines the microsecond precision.\nSee Microseconds in MariaDB.\n \nExamples\n-------- \nSELECT UTC_TIMESTAMP(), UTC_TIMESTAMP() + 0;\n \n+---------------------+-----------------------+\n| UTC_TIMESTAMP() | UTC_TIMESTAMP() + 0 |\n+---------------------+-----------------------+\n| 2010-03-27 17:33:16 | 20100327173316.000000 |\n+---------------------+-----------------------+\n \nWith precision:\n \nSELECT UTC_TIMESTAMP(4);\n+--------------------------+\n| UTC_TIMESTAMP(4) |\n+--------------------------+\n| 2018-07-10 07:51:09.1019 |\n+--------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/utc_timestamp/','','https://mariadb.com/kb/en/utc_timestamp/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (524,31,'WEEK','Syntax\n------ \nWEEK(date[,mode])\n \nDescription\n----------- \nThis function returns the week number for date. The\ntwo-argument form of\nWEEK() allows you to specify whether the week starts on\nSunday or Monday\nand whether the return value should be in the range from 0\nto 53 or from 1 to\n53. If the mode argument is omitted, the value of the\ndefault_week_format system variable is used.\n \nModes\n \nMode | 1st day of week | Range | Week 1 is the 1st week with\n| \n \n0 | Sunday | 0-53 | a Sunday in this year | \n \n1 | Monday | 0-53 | more than 3 days this year | \n \n2 | Sunday | 1-53 | a Sunday in this year | \n \n3 | Monday | 1-53 | more than 3 days this year | \n \n4 | Sunday | 0-53 | more than 3 days this year | \n \n5 | Monday | 0-53 | a Monday in this year | \n \n6 | Sunday | 1-53 | more than 3 days this year | \n \n7 | Monday | 1-53 | a Monday in this year | \n \nExamples\n-------- \nSELECT WEEK(\'2008-02-20\');\n+--------------------+\n| WEEK(\'2008-02-20\') |\n+--------------------+\n| 7 |\n+--------------------+\n \nSELECT WEEK(\'2008-02-20\',0);\n+----------------------+\n| WEEK(\'2008-02-20\',0) |\n+----------------------+\n| 7 |\n+----------------------+\n \nSELECT WEEK(\'2008-02-20\',1);\n+----------------------+\n| WEEK(\'2008-02-20\',1) |\n+----------------------+\n| 8 |\n+----------------------+\n \nSELECT WEEK(\'2008-12-31\',0);\n+----------------------+\n| WEEK(\'2008-12-31\',0) |\n+----------------------+\n| 52 |\n+----------------------+\n \nSELECT WEEK(\'2008-12-31\',1);\n+----------------------+\n| WEEK(\'2008-12-31\',1) |\n+----------------------+\n| 53 |\n+----------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n (\"2007-01-30 21:31:07\"),\n (\"1983-10-15 06:42:51\"),\n (\"2011-04-21 12:34:56\"),\n (\"2011-10-30 06:31:41\"),\n (\"2011-01-30 14:03:25\"),\n (\"2004-10-07 11:19:34\");\n \nSELECT d, WEEK(d,0), WEEK(d,1) from t1;\n \n+---------------------+-----------+-----------+\n| d | WEEK(d,0) | WEEK(d,1) |\n+---------------------+-----------+-----------+\n| 2007-01-30 21:31:07 | 4 | 5 |\n| 1983-10-15 06:42:51 | 41 | 41 |\n| 2011-04-21 12:34:56 | 16 | 16 |\n| 2011-10-30 06:31:41 | 44 | 43 |\n| 2011-01-30 14:03:25 | 5 | 4 |\n| 2004-10-07 11:19:34 | 40 | 41 |\n+---------------------+-----------+-----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/week/','','https://mariadb.com/kb/en/week/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (525,31,'WEEKDAY','Syntax\n------ \nWEEKDAY(date)\n \nDescription\n----------- \nReturns the weekday index for date \n(0 = Monday, 1 = Tuesday, ... 6 = Sunday).\n \nThis contrasts with DAYOFWEEK() which follows the ODBC\nstandard\n(1 = Sunday, 2 = Monday, ..., 7 = Saturday).\n \nExamples\n-------- \nSELECT WEEKDAY(\'2008-02-03 22:23:00\');\n+--------------------------------+\n| WEEKDAY(\'2008-02-03 22:23:00\') |\n+--------------------------------+\n| 6 |\n+--------------------------------+\n \nSELECT WEEKDAY(\'2007-11-06\');\n+-----------------------+\n| WEEKDAY(\'2007-11-06\') |\n+-----------------------+\n| 1 |\n+-----------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n (\"2007-01-30 21:31:07\"),\n (\"1983-10-15 06:42:51\"),\n (\"2011-04-21 12:34:56\"),\n (\"2011-10-30 06:31:41\"),\n (\"2011-01-30 14:03:25\"),\n (\"2004-10-07 11:19:34\");\n \nSELECT d FROM t1 where WEEKDAY(d) = 6;\n \n+---------------------+\n| d |\n+---------------------+\n| 2011-10-30 06:31:41 |\n| 2011-01-30 14:03:25 |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/weekday/','','https://mariadb.com/kb/en/weekday/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (526,31,'WEEKOFYEAR','Syntax\n------ \nWEEKOFYEAR(date)\n \nDescription\n----------- \nReturns the calendar week of the date as a number in the\nrange from 1\nto 53. WEEKOFYEAR() is a compatibility function that is\nequivalent to\nWEEK(date,3).\n \nExamples\n-------- \nSELECT WEEKOFYEAR(\'2008-02-20\');\n+--------------------------+\n| WEEKOFYEAR(\'2008-02-20\') |\n+--------------------------+\n| 8 |\n+--------------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n (\"2007-01-30 21:31:07\"),\n (\"1983-10-15 06:42:51\"),\n (\"2011-04-21 12:34:56\"),\n (\"2011-10-30 06:31:41\"),\n (\"2011-01-30 14:03:25\"),\n (\"2004-10-07 11:19:34\");\n \n select * from t1;\n \n+---------------------+\n| d |\n+---------------------+\n| 2007-01-30 21:31:07 |\n| 1983-10-15 06:42:51 |\n| 2011-04-21 12:34:56 |\n| 2011-10-30 06:31:41 |\n| 2011-01-30 14:03:25 |\n| 2004-10-07 11:19:34 |\n+---------------------+\n \nSELECT d, WEEKOFYEAR(d), WEEK(d,3) from t1;\n \n+---------------------+---------------+-----------+\n| d | WEEKOFYEAR(d) | WEEK(d,3) |\n+---------------------+---------------+-----------+\n| 2007-01-30 21:31:07 | 5 | 5 |\n| 1983-10-15 06:42:51 | 41 | 41 |\n| 2011-04-21 12:34:56 | 16 | 16 |\n| 2011-10-30 06:31:41 | 43 | 43 |\n| 2011-01-30 14:03:25 | 4 | 4 |\n| 2004-10-07 11:19:34 | 41 | 41 |\n+---------------------+---------------+-----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/weekofyear/','','https://mariadb.com/kb/en/weekofyear/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (527,31,'YEAR','Syntax\n------ \nYEAR(date)\n \nDescription\n----------- \nReturns the year for the given date, in the range 1000 to\n9999, or 0 for the\n\"zero\" date.\n \nExamples\n-------- \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n (\"2007-01-30 21:31:07\"),\n (\"1983-10-15 06:42:51\"),\n (\"2011-04-21 12:34:56\"),\n (\"2011-10-30 06:31:41\"),\n (\"2011-01-30 14:03:25\"),\n (\"2004-10-07 11:19:34\");\n \nSELECT * FROM t1;\n \n+---------------------+\n| d |\n+---------------------+\n| 2007-01-30 21:31:07 |\n| 1983-10-15 06:42:51 |\n| 2011-04-21 12:34:56 |\n| 2011-10-30 06:31:41 |\n| 2011-01-30 14:03:25 |\n| 2004-10-07 11:19:34 |\n+---------------------+\n \nSELECT * FROM t1 WHERE YEAR(d) = 2011;\n \n+---------------------+\n| d |\n+---------------------+\n| 2011-04-21 12:34:56 |\n| 2011-10-30 06:31:41 |\n| 2011-01-30 14:03:25 |\n+---------------------+\n \nSELECT YEAR(\'1987-01-01\');\n+--------------------+\n| YEAR(\'1987-01-01\') |\n+--------------------+\n| 1987 |\n+--------------------+\n \n\n\nURL: https://mariadb.com/kb/en/year/','','https://mariadb.com/kb/en/year/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (528,31,'YEARWEEK','Syntax\n------ \nYEARWEEK(date), YEARWEEK(date,mode)\n \nDescription\n----------- \nReturns year and week for a date. The mode argument works\nexactly like the mode\nargument to WEEK(). The year in the result may be different\nfrom the\nyear in the date argument for the first and the last week of\nthe year.\n \nExamples\n-------- \nSELECT YEARWEEK(\'1987-01-01\');\n+------------------------+\n| YEARWEEK(\'1987-01-01\') |\n+------------------------+\n| 198652 |\n+------------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n (\"2007-01-30 21:31:07\"),\n (\"1983-10-15 06:42:51\"),\n (\"2011-04-21 12:34:56\"),\n (\"2011-10-30 06:31:41\"),\n (\"2011-01-30 14:03:25\"),\n (\"2004-10-07 11:19:34\");\n \nSELECT * FROM t1;\n \n+---------------------+\n| d |\n+---------------------+\n| 2007-01-30 21:31:07 |\n| 1983-10-15 06:42:51 |\n| 2011-04-21 12:34:56 |\n| 2011-10-30 06:31:41 |\n| 2011-01-30 14:03:25 |\n| 2004-10-07 11:19:34 |\n+---------------------+\n6 rows in set (0.02 sec)\n \nSELECT YEARWEEK(d) FROM t1 WHERE YEAR(d) = 2011;\n \n+-------------+\n| YEARWEEK(d) |\n+-------------+\n| 201116 |\n| 201144 |\n| 201105 |\n+-------------+\n3 rows in set (0.03 sec)\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/yearweek/','','https://mariadb.com/kb/en/yearweek/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (529,32,'Well-Known Binary (WKB) Format','WKB stands for Well-Known Binary, a format for representing\ngeographical and geometrical data.\n \nWKB uses 1-byte unsigned integers, 4-byte unsigned integers,\nand 8-byte double-precision numbers.\nThe first byte indicates the byte order. 00 for big endian,\nor 01 for little endian.\nThe next 4 bytes indicate the geometry type. Values from 1\nto 7 indicate whether the type is Point, LineString,\nPolygon, MultiPoint, MultiLineString, MultiPolygon, or\nGeometryCollection respectively. \nThe 8-byte floats represent the co-ordinates.\n \nTake the following example, a sequence of 21 bytes each\nrepresented by two hex digits:\n \n000000000140000000000000004010000000000000\nIt\'s big endian\n000000000140000000000000004010000000000000\n \nIt\'s a POINT\n000000000140000000000000004010000000000000\n \nThe X co-ordinate is 2.0\n000000000140000000000000004010000000000000\n \nThe Y-co-ordinate is 4.0\n000000000140000000000000004010000000000000\n \n\n \n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/well-known-binary-wkb-format/','','https://mariadb.com/kb/en/well-known-binary-wkb-format/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (530,32,'AsBinary','A synonym for ST_AsBinary().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/wkb-asbinary/','','https://mariadb.com/kb/en/wkb-asbinary/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (531,32,'AsWKB','A synonym for ST_AsBinary().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/aswkb/','','https://mariadb.com/kb/en/aswkb/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (532,32,'MLineFromWKB','Syntax\n------ \nMLineFromWKB(wkb[,srid])\nMultiLineStringFromWKB(wkb[,srid])\n \nDescription\n----------- \nConstructs a MULTILINESTRING value using its WKB\nrepresentation and SRID.\n \nMLineFromWKB() and MultiLineStringFromWKB() are synonyms.\n \nExamples\n-------- \nSET @g = ST_AsBinary(MLineFromText(\'MULTILINESTRING((10\n48,10 21,10 0),(16 0,16 23,16 48))\'));\n \nSELECT ST_AsText(MLineFromWKB(@g));\n+--------------------------------------------------------+\n| ST_AsText(MLineFromWKB(@g)) |\n+--------------------------------------------------------+\n| MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48)) |\n+--------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/mlinefromwkb/','','https://mariadb.com/kb/en/mlinefromwkb/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (533,32,'MPointFromWKB','Syntax\n------ \nMPointFromWKB(wkb[,srid])\nMultiPointFromWKB(wkb[,srid])\n \nDescription\n----------- \nConstructs a MULTIPOINT value using its WKB representation\nand SRID.\n \nMPointFromWKB() and MultiPointFromWKB() are synonyms.\n \nExamples\n-------- \nSET @g = ST_AsBinary(MPointFromText(\'MultiPoint( 1 1, 2 2,\n5 3, 7 2, 9 3, 8 4, 6 6, 6 9, 4 9, 1 5 )\'));\n \nSELECT ST_AsText(MPointFromWKB(@g));\n+-----------------------------------------------------+\n| ST_AsText(MPointFromWKB(@g)) |\n+-----------------------------------------------------+\n| MULTIPOINT(1 1,2 2,5 3,7 2,9 3,8 4,6 6,6 9,4 9,1 5) |\n+-----------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/mpointfromwkb/','','https://mariadb.com/kb/en/mpointfromwkb/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (534,32,'MPolyFromWKB','Syntax\n------ \nMPolyFromWKB(wkb[,srid])\nMultiPolygonFromWKB(wkb[,srid])\n \nDescription\n----------- \nConstructs a MULTIPOLYGON value using its WKB representation\nand SRID.\n \nMPolyFromWKB() and MultiPolygonFromWKB() are synonyms.\n \nExamples\n-------- \nSET @g = ST_AsBinary(MPointFromText(\'MULTIPOLYGON(((28\n26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52\n18)),((59 18,67 18,67 13,59 13,59 18)))\'));\n \nSELECT ST_AsText(MPolyFromWKB(@g));\n+---------------------------------------------------------------------------------------------------------------+\n| ST_AsText(MPolyFromWKB(@g)) |\n+---------------------------------------------------------------------------------------------------------------+\n| MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66\n23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) |\n+---------------------------------------------------------------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/mpolyfromwkb/','','https://mariadb.com/kb/en/mpolyfromwkb/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (535,32,'GeomCollFromWKB','A synonym for ST_GeomCollFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/wkb-geomcollfromwkb/','','https://mariadb.com/kb/en/wkb-geomcollfromwkb/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (536,32,'GeometryCollectionFromWKB','A synonym for ST_GeomCollFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/geometrycollectionfromwkb/','','https://mariadb.com/kb/en/geometrycollectionfromwkb/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (537,32,'GeometryFromWKB','A synonym for ST_GeomFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/geometryfromwkb/','','https://mariadb.com/kb/en/geometryfromwkb/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (538,32,'GeomFromWKB','A synonym for ST_GeomFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/wkb-geomfromwkb/','','https://mariadb.com/kb/en/wkb-geomfromwkb/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (539,32,'LineFromWKB','A synonym for ST_LineFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/wkb-linefromwkb/','','https://mariadb.com/kb/en/wkb-linefromwkb/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (540,32,'LineStringFromWKB','A synonym for ST_LineFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/linestringfromwkb/','','https://mariadb.com/kb/en/linestringfromwkb/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (541,32,'MultiLineStringFromWKB','A synonym for MLineFromWKB().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/multilinestringfromwkb/','','https://mariadb.com/kb/en/multilinestringfromwkb/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (542,32,'MultiPointFromWKB','A synonym for MPointFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/multipointfromwkb/','','https://mariadb.com/kb/en/multipointfromwkb/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (543,32,'MultiPolygonFromWKB','Synonym for MPolyFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/multipolygonfromwkb/','','https://mariadb.com/kb/en/multipolygonfromwkb/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (544,32,'PointFromWKB','A synonym for ST_PointFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/wkb-pointfromwkb/','','https://mariadb.com/kb/en/wkb-pointfromwkb/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (545,32,'PolyFromWKB','A synonym for ST_PolyFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/wkb-polyfromwkb/','','https://mariadb.com/kb/en/wkb-polyfromwkb/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (546,32,'PolygonFromWKB','A synonym for ST_PolyFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/polygonfromwkb/','','https://mariadb.com/kb/en/polygonfromwkb/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (547,32,'ST_AsBinary','Syntax\n------ \nST_AsBinary(g)\nAsBinary(g)\nST_AsWKB(g)\nAsWKB(g)\n \nDescription\n----------- \nConverts a value in internal geometry format to its WKB\nrepresentation and returns the binary result.\n \nST_AsBinary(), AsBinary(), ST_AsWKB() and AsWKB() are\nsynonyms,\n \nExamples\n-------- \nSET @poly = ST_GeomFromText(\'POLYGON((0 0,0 1,1 1,1 0,0\n0))\');\nSELECT ST_AsBinary(@poly);\n \nSELECT ST_AsText(ST_GeomFromWKB(ST_AsWKB(@poly)));\n+--------------------------------------------+\n| ST_AsText(ST_GeomFromWKB(ST_AsWKB(@poly))) |\n+--------------------------------------------+\n| POLYGON((0 0,0 1,1 1,1 0,0 0)) |\n+--------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_asbinary/','','https://mariadb.com/kb/en/st_asbinary/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (548,32,'ST_AsWKB','A synonym for ST_AsBinary().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_aswkb/','','https://mariadb.com/kb/en/st_aswkb/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (549,32,'ST_GeomCollFromWKB','Syntax\n------ \nST_GeomCollFromWKB(wkb[,srid])\nST_GeometryCollectionFromWKB(wkb[,srid])\nGeomCollFromWKB(wkb[,srid])\nGeometryCollectionFromWKB(wkb[,srid])\n \nDescription\n----------- \nConstructs a GEOMETRYCOLLECTION value using its WKB\nrepresentation and SRID.\n \nST_GeomCollFromWKB(), ST_GeometryCollectionFromWKB(),\nGeomCollFromWKB() and GeometryCollectionFromWKB() are\nsynonyms.\n \nExamples\n-------- \nSET @g =\nST_AsBinary(ST_GeomFromText(\'GEOMETRYCOLLECTION(POLYGON((5\n5,10 5,10 10,5 5)),POINT(10 10))\'));\n \nSELECT ST_AsText(ST_GeomCollFromWKB(@g));\n+----------------------------------------------------------------+\n| ST_AsText(ST_GeomCollFromWKB(@g)) |\n+----------------------------------------------------------------+\n| GEOMETRYCOLLECTION(POLYGON((5 5,10 5,10 10,5 5)),POINT(10\n10)) |\n+----------------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_geomcollfromwkb/','','https://mariadb.com/kb/en/st_geomcollfromwkb/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (550,32,'ST_GeometryCollectionFromWKB','A synonym for ST_GeomCollFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_geometrycollectionfromwkb/','','https://mariadb.com/kb/en/st_geometrycollectionfromwkb/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (551,32,'ST_GeometryFromWKB','A synonym for ST_GeomFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_geometryfromwkb/','','https://mariadb.com/kb/en/st_geometryfromwkb/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (552,32,'ST_GeomFromWKB','Syntax\n------ \nST_GeomFromWKB(wkb[,srid])\nST_GeometryFromWKB(wkb[,srid])\nGeomFromWKB(wkb[,srid])\nGeometryFromWKB(wkb[,srid])\n \nDescription\n----------- \nConstructs a geometry value of any type using its WKB\nrepresentation and SRID.\n \nST_GeomFromWKB(), ST_GeometryFromWKB(), GeomFromWKB() and\nGeometryFromWKB() are synonyms.\n \nExamples\n-------- \nSET @g = ST_AsBinary(ST_LineFromText(\'LINESTRING(0 4, 4\n6)\'));\n \nSELECT ST_AsText(ST_GeomFromWKB(@g));\n+-------------------------------+\n| ST_AsText(ST_GeomFromWKB(@g)) |\n+-------------------------------+\n| LINESTRING(0 4,4 6) |\n+-------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_geomfromwkb/','','https://mariadb.com/kb/en/st_geomfromwkb/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (553,32,'ST_LineFromWKB','Syntax\n------ \nST_LineFromWKB(wkb[,srid])\nLineFromWKB(wkb[,srid])\nST_LineStringFromWKB(wkb[,srid])\nLineStringFromWKB(wkb[,srid])\n \nDescription\n----------- \nConstructs a LINESTRING value using its WKB representation\nand SRID.\n \nST_LineFromWKB(), LineFromWKB(), ST_LineStringFromWKB(), and\nLineStringFromWKB() are synonyms.\n \nExamples\n-------- \nSET @g = ST_AsBinary(ST_LineFromText(\'LineString(0 4,4\n6)\'));\n \nSELECT ST_AsText(ST_LineFromWKB(@g)) AS l;\n \n+---------------------+\n| l |\n+---------------------+\n| LINESTRING(0 4,4 6) |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_linefromwkb/','','https://mariadb.com/kb/en/st_linefromwkb/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (554,32,'ST_LineStringFromWKB','A synonym for ST_LineFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_linestringfromwkb/','','https://mariadb.com/kb/en/st_linestringfromwkb/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (555,32,'ST_PointFromWKB','Syntax\n------ \nST_PointFromWKB(wkb[,srid])\nPointFromWKB(wkb[,srid])\n \nDescription\n----------- \nConstructs a POINT value using its WKB representation and\nSRID.\n \nST_PointFromWKB() and PointFromWKB() are synonyms.\n \nExamples\n-------- \nSET @g = ST_AsBinary(ST_PointFromText(\'POINT(0 4)\'));\n \nSELECT ST_AsText(ST_PointFromWKB(@g)) AS p;\n \n+------------+\n| p |\n+------------+\n| POINT(0 4) |\n+------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_pointfromwkb/','','https://mariadb.com/kb/en/st_pointfromwkb/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (556,32,'ST_PolyFromWKB','Syntax\n------ \nST_PolyFromWKB(wkb[,srid])\nST_PolygonFromWKB(wkb[,srid])\nPolyFromWKB(wkb[,srid])\nPolygonFromWKB(wkb[,srid])\n \nDescription\n----------- \nConstructs a POLYGON value using its WKB representation and\nSRID.\n \nST_PolyFromWKB(), ST_PolygonFromWKB(), PolyFromWKB() and\nPolygonFromWKB() are synonyms.\n \nExamples\n-------- \nSET @g = ST_AsBinary(ST_PolyFromText(\'POLYGON((1 1,1 5,4\n9,6 9,9 3,7 2,1 1))\'));\n \nSELECT ST_AsText(ST_PolyFromWKB(@g)) AS p;\n \n+----------------------------------------+\n| p |\n+----------------------------------------+\n| POLYGON((1 1,1 5,4 9,6 9,9 3,7 2,1 1)) |\n+----------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_polyfromwkb/','','https://mariadb.com/kb/en/st_polyfromwkb/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (557,32,'ST_PolygonFromWKB','A synonym for ST_PolyFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_polygonfromwkb/','','https://mariadb.com/kb/en/st_polygonfromwkb/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (558,36,'BOUNDARY','A synonym for ST_BOUNDARY.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/geometry-properties-boundary/','','https://mariadb.com/kb/en/geometry-properties-boundary/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (559,36,'DIMENSION','A synonym for ST_DIMENSION.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/dimension/','','https://mariadb.com/kb/en/dimension/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (560,36,'ENVELOPE','A synonym for ST_ENVELOPE.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/geometry-properties-envelope/','','https://mariadb.com/kb/en/geometry-properties-envelope/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (561,36,'GeometryN','A synonym for ST_GeometryN.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/geometry-properties-geometryn/','','https://mariadb.com/kb/en/geometry-properties-geometryn/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (562,36,'GeometryType','A synonym for ST_GeometryType.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/geometry-properties-geometrytype/','','https://mariadb.com/kb/en/geometry-properties-geometrytype/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (563,36,'IsClosed','A synonym for ST_IsClosed.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/isclosed/','','https://mariadb.com/kb/en/isclosed/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (564,36,'IsEmpty','A synonym for ST_IsEmpty.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/geometry-properties-isempty/','','https://mariadb.com/kb/en/geometry-properties-isempty/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (565,36,'IsRing','A synonym for ST_IsRing.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/isring/','','https://mariadb.com/kb/en/isring/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (566,36,'IsSimple','A synonym for ST_IsSImple.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/geometry-properties-issimple/','','https://mariadb.com/kb/en/geometry-properties-issimple/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (567,36,'NumGeometries','A synonym for ST_NumGeometries.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/geometry-properties-numgeometries/','','https://mariadb.com/kb/en/geometry-properties-numgeometries/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (568,36,'SRID','A synonym for ST_SRID.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/geometry-properties-srid/','','https://mariadb.com/kb/en/geometry-properties-srid/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (569,36,'ST_BOUNDARY','The ST_BOUNDARY function was introduced in MariaDB 10.1.2\n \nSyntax\n------ \nST_BOUNDARY(g)\nBOUNDARY(g)\n \nDescription\n----------- \nReturns a geometry that is the closure of the combinatorial\nboundary of the geometry value g.\n \nBOUNDARY() is a synonym.\n \nExamples\n-------- \nSELECT ST_AsText(ST_Boundary(ST_GeomFromText(\'LINESTRING(3\n3,0 0, -3 3)\')));\n+----------------------------------------------------------------------+\n| ST_AsText(ST_Boundary(ST_GeomFromText(\'LINESTRING(3 3,0\n0, -3 3)\'))) |\n+----------------------------------------------------------------------+\n| MULTIPOINT(3 3,-3 3) |\n+----------------------------------------------------------------------+\n \nSELECT ST_AsText(ST_Boundary(ST_GeomFromText(\'POLYGON((3\n3,0 0, -3 3, 3 3))\')));\n+--------------------------------------------------------------------------+\n| ST_AsText(ST_Boundary(ST_GeomFromText(\'POLYGON((3 3,0 0,\n-3 3, 3 3))\'))) |\n+--------------------------------------------------------------------------+\n| LINESTRING(3 3,0 0,-3 3,3 3) |\n+--------------------------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_boundary/','','https://mariadb.com/kb/en/st_boundary/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (570,36,'ST_DIMENSION','Syntax\n------ \nST_Dimension(g)\nDimension(g)\n \nDescription\n----------- \nReturns the inherent dimension of the geometry value g. The\nresult can\nbe\n \nDimension | Definition | \n \n -1 | empty geometry | \n \n 0 | geometry with no length or area | \n \n 1 | geometry with no area but nonzero length | \n \n 2 | geometry with nonzero area | \n \nST_Dimension() and Dimension() are synonyms.\n \nExamples\n-------- \nSELECT Dimension(GeomFromText(\'LineString(1 1,2 2)\'));\n+------------------------------------------------+\n| Dimension(GeomFromText(\'LineString(1 1,2 2)\')) |\n+------------------------------------------------+\n| 1 |\n+------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_dimension/','','https://mariadb.com/kb/en/st_dimension/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (571,36,'ST_ENVELOPE','Syntax\n------ \nST_ENVELOPE(g)\nENVELOPE(g)\n \nDescription\n----------- \nReturns the Minimum Bounding Rectangle (MBR) for the\ngeometry value g. The result is returned as a Polygon value.\n \nThe polygon is defined by the corner points of the bounding\nbox:\n \nPOLYGON((MINX MINY, MAXX MINY, MAXX MAXY, MINX MAXY, MINX\nMINY))\n \nST_ENVELOPE() and ENVELOPE() are synonyms.\n \nExamples\n-------- \nSELECT AsText(ST_ENVELOPE(GeomFromText(\'LineString(1 1,4\n4)\')));\n+----------------------------------------------------------+\n| AsText(ST_ENVELOPE(GeomFromText(\'LineString(1 1,4 4)\')))\n|\n+----------------------------------------------------------+\n| POLYGON((1 1,4 1,4 4,1 4,1 1)) |\n+----------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_envelope/','','https://mariadb.com/kb/en/st_envelope/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (572,36,'ST_GEOMETRYN','Syntax\n------ \nST_GeometryN(gc,N)\nGeometryN(gc,N)\n \nDescription\n----------- \nReturns the N-th geometry in the GeometryCollection gc.\nGeometries are numbered beginning with 1.\n \nST_GeometryN() and GeometryN() are synonyms.\n \nExample\n \nSET @gc = \'GeometryCollection(Point(1 1),LineString(12 14,\n9 11))\';\n \nSELECT AsText(GeometryN(GeomFromText(@gc),1));\n+----------------------------------------+\n| AsText(GeometryN(GeomFromText(@gc),1)) |\n+----------------------------------------+\n| POINT(1 1) |\n+----------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_geometryn/','','https://mariadb.com/kb/en/st_geometryn/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (573,36,'ST_GEOMETRYTYPE','Syntax\n------ \nST_GeometryType(g)\nGeometryType(g)\n \nDescription\n----------- \nReturns as a string the name of the geometry type of which\nthe\ngeometry instance g is a member. The name corresponds to one\nof the\ninstantiable Geometry subclasses.\n \nST_GeometryType() and GeometryType() are synonyms.\n \nExamples\n-------- \nSELECT GeometryType(GeomFromText(\'POINT(1 1)\'));\n+------------------------------------------+\n| GeometryType(GeomFromText(\'POINT(1 1)\')) |\n+------------------------------------------+\n| POINT |\n+------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_geometrytype/','','https://mariadb.com/kb/en/st_geometrytype/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (574,36,'ST_ISCLOSED','Syntax\n------ \nST_IsClosed(g)\nIsClosed(g)\n \nDescription\n----------- \nReturns 1 if a given LINESTRING\'s start and end points are\nthe same, or 0 if they are not the same. Before MariaDB\n10.1.5, returns NULL if not given a LINESTRING. After\nMariaDB 10.1.5, returns -1.\n \nST_IsClosed() and IsClosed() are synonyms.\n \nExamples\n-------- \nSET @ls = \'LineString(0 0, 0 4, 4 4, 0 0)\';\n \nSELECT ST_ISCLOSED(GEOMFROMTEXT(@ls));\n+--------------------------------+\n| ST_ISCLOSED(GEOMFROMTEXT(@ls)) |\n+--------------------------------+\n| 1 |\n+--------------------------------+\n \nSET @ls = \'LineString(0 0, 0 4, 4 4, 0 1)\';\n \nSELECT ST_ISCLOSED(GEOMFROMTEXT(@ls));\n+--------------------------------+\n| ST_ISCLOSED(GEOMFROMTEXT(@ls)) |\n+--------------------------------+\n| 0 |\n+--------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_isclosed/','','https://mariadb.com/kb/en/st_isclosed/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (575,36,'ST_ISEMPTY','Syntax\n------ \nST_IsEmpty(g)\nIsEmpty(g)\n \nDescription\n----------- \nIsEmpty is a function defined by the OpenGIS specification,\nbut is not fully implemented by MariaDB or MySQL. \n \nSince MariaDB and MySQL do not support GIS EMPTY values such\nas POINT EMPTY, as implemented it simply returns 1 if the\ngeometry value g is invalid, 0 if it is valid, and NULL if\nthe argument is NULL.\n \nST_IsEmpty() and IsEmpty() are synonyms.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_isempty/','','https://mariadb.com/kb/en/st_isempty/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (576,36,'ST_IsRing','The ST_IsRing function was introduced in MariaDB 10.1.2\n \nSyntax\n------ \nST_IsRing(g)\nIsRing(g)\n \nDescription\n----------- \nReturns true if a given LINESTRING is a ring, that is, both\nST_IsClosed and ST_IsSimple. A simple curve does not pass\nthrough the same point more than once. However, see\nMDEV-7510.\n \nSt_IsRing() and IsRing() are synonyms.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_isring/','','https://mariadb.com/kb/en/st_isring/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (577,36,'ST_IsSimple','Syntax\n------ \nST_IsSimple(g)\nIsSimple(g)\n \nDescription\n----------- \nReturns true if the given Geometry has no anomalous\ngeometric points, false if it does, or NULL if given a NULL\nvalue.\n \nST_IsSimple() and IsSimple() are synonyms.\n \nExamples\n-------- \nA POINT is always simple.\n \nSET @g = \'Point(1 2)\';\n \nSELECT ST_ISSIMPLE(GEOMFROMTEXT(@g));\n+-------------------------------+\n| ST_ISSIMPLE(GEOMFROMTEXT(@g)) |\n+-------------------------------+\n| 1 |\n+-------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_issimple/','','https://mariadb.com/kb/en/st_issimple/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (578,36,'ST_NUMGEOMETRIES','Syntax\n------ \nST_NumGeometries(gc)\nNumGeometries(gc)\n \nDescription\n----------- \nReturns the number of geometries in the GeometryCollection\ngc.\n \nST_NumGeometries() and NumGeometries() are synonyms.\n \nExample\n \nSET @gc = \'GeometryCollection(Point(1 1),LineString(2 2, 3\n3))\';\n \nSELECT NUMGEOMETRIES(GeomFromText(@gc));\n+----------------------------------+\n| NUMGEOMETRIES(GeomFromText(@gc)) |\n+----------------------------------+\n| 2 |\n+----------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_numgeometries/','','https://mariadb.com/kb/en/st_numgeometries/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (579,36,'ST_RELATE','The ST_RELATE() function was introduced in MariaDB 10.1.2\n \nSyntax\n------ \nST_Relate(g1, g2, i)\n \nDescription\n----------- \nReturns true if Geometry g1 is spatially related to\nGeometryg2 by testing for intersections between the\ninterior, boundary and exterior of the two geometries as\nspecified by the values in intersection matrix pattern i.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_relate/','','https://mariadb.com/kb/en/st_relate/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (580,36,'ST_SRID','Syntax\n------ \nST_SRID(g)\nSRID(g)\n \nDescription\n----------- \nReturns an integer indicating the Spatial Reference System\nID for the\ngeometry value g.\n \nIn MariaDB, the SRID value is just an integer associated\nwith the\ngeometry value. All calculations are done assuming Euclidean\n(planar)\ngeometry.\n \nST_SRID() and SRID() are synonyms.\n \nExamples\n-------- \nSELECT SRID(GeomFromText(\'LineString(1 1,2 2)\',101));\n+-----------------------------------------------+\n| SRID(GeomFromText(\'LineString(1 1,2 2)\',101)) |\n+-----------------------------------------------+\n| 101 |\n+-----------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/st_srid/','','https://mariadb.com/kb/en/st_srid/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (581,37,'ASCII','Syntax\n------ \nASCII(str)\n \nDescription\n----------- \nReturns the numeric ASCII value of the leftmost character of\nthe string argument. Returns 0 if the given string is empty\nand NULL if it is NULL.\n \nASCII() works for 8-bit characters.\n \nExamples\n-------- \nSELECT ASCII(9);\n+----------+\n| ASCII(9) |\n+----------+\n| 57 |\n+----------+\n \nSELECT ASCII(\'9\');\n+------------+\n| ASCII(\'9\') |\n+------------+\n| 57 |\n+------------+\n \nSELECT ASCII(\'abc\');\n+--------------+\n| ASCII(\'abc\') |\n+--------------+\n| 97 |\n+--------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/ascii/','','https://mariadb.com/kb/en/ascii/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (582,37,'BIN','Syntax\n------ \nBIN(N)\n \nDescription\n----------- \nReturns a string representation of the binary value of the\ngiven longlong (that is, BIGINT) number. This is equivalent\nto CONV(N,10,2). The argument should be positive. If it is a\nFLOAT, it will be truncated. Returns NULL if the argument is\nNULL.\n \nExamples\n-------- \nSELECT BIN(12);\n+---------+\n| BIN(12) |\n+---------+\n| 1100 |\n+---------+\n \n\n\nURL: https://mariadb.com/kb/en/bin/','','https://mariadb.com/kb/en/bin/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (583,37,'BINARY Operator','Syntax\n------ \nBINARY\n \nDescription\n----------- \nThe BINARY operator casts the string following it to a\nbinary string. This is an easy way to force a column\ncomparison to be done byte by byte rather than character by\ncharacter. This causes the comparison to be case sensitive\neven if the column isn\'t defined as BINARY or BLOB. \n \nBINARY also causes trailing spaces to be significant.\n \nExamples\n-------- \nSELECT \'a\' = \'A\';\n \n+-----------+\n| \'a\' = \'A\' |\n+-----------+\n| 1 |\n+-----------+\n \nSELECT BINARY \'a\' = \'A\';\n \n+------------------+\n| BINARY \'a\' = \'A\' |\n+------------------+\n| 0 |\n+------------------+\n \nSELECT \'a\' = \'a \';\n \n+------------+\n| \'a\' = \'a \' |\n+------------+\n| 1 |\n+------------+\n \nSELECT BINARY \'a\' = \'a \';\n \n+-------------------+\n| BINARY \'a\' = \'a \' |\n+-------------------+\n| 0 |\n+-------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/binary-operator/','','https://mariadb.com/kb/en/binary-operator/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (584,37,'BIT_LENGTH','Syntax\n------ \nBIT_LENGTH(str)\n \nDescription\n----------- \nReturns the length of the given string argument in bits. If\nthe argument is not a string, it will be converted to\nstring. If the argument is NULL, it returns NULL.\n \nExamples\n-------- \nSELECT BIT_LENGTH(\'text\');\n+--------------------+\n| BIT_LENGTH(\'text\') |\n+--------------------+\n| 32 |\n+--------------------+\n \nSELECT BIT_LENGTH(\'\');\n+----------------+\n| BIT_LENGTH(\'\') |\n+----------------+\n| 0 |\n+----------------+\n \nCompatibility\n \nPostgreSQL and Sybase support BIT_LENGTH().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/bit_length/','','https://mariadb.com/kb/en/bit_length/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (585,37,'CAST','Syntax\n------ \nCAST(expr AS type)\n \nDescription\n----------- \nThe CAST() function takes a value of one type and produces a\nvalue of another type, similar to the CONVERT() function.\nFor more information, see the description of CONVERT(). \n \nThe main difference between the CAST() and CONVERT() is that\nCONVERT(expr,type) is ODBC syntax while CAST(expr as type)\nand CONVERT(... USING ...) are SQL92 syntax.\n \nIn MariaDB 10.4 and later, you can use the CAST() function\nwith the INTERVAL keyword.\n \nUntil MariaDB 5.5.31, X\'HHHH\', the standard SQL syntax for\nbinary string literals, erroneously worked in the same way\nas 0xHHHH. In 5.5.31 it was intentionally changed to behave\nas a string in all contexts (and never as a number).\n \nThis introduces an incompatibility with previous versions of\nMariaDB, and all versions of MySQL (see the example below). \n \nExamples\n-------- \nSimple casts:\n \nSELECT CAST(\"abc\" AS BINARY);\nSELECT CAST(\"1\" AS UNSIGNED INTEGER);\nSELECT CAST(123 AS CHAR CHARACTER SET utf8)\n \nNote that when one casts to CHAR without specifying the\ncharacter set, the collation_connection character set\ncollation will be used. When used with CHAR CHARACTER SET,\nthe default collation for that character set will be used.\n \nSELECT COLLATION(CAST(123 AS CHAR));\n+------------------------------+\n| COLLATION(CAST(123 AS CHAR)) |\n+------------------------------+\n| latin1_swedish_ci |\n+------------------------------+\n \nSELECT COLLATION(CAST(123 AS CHAR CHARACTER SET utf8));\n+-------------------------------------------------+\n| COLLATION(CAST(123 AS CHAR CHARACTER SET utf8)) |\n+-------------------------------------------------+\n| utf8_general_ci |\n+-------------------------------------------------+\n \nIf you also want to change the collation, you have to use\nthe COLLATE operator:\n \nSELECT COLLATION(CAST(123 AS CHAR CHARACTER SET utf8) \n COLLATE utf8_unicode_ci);\n+-------------------------------------------------------------------------+\n| COLLATION(CAST(123 AS CHAR CHARACTER SET utf8) COLLATE\nutf8_unicode_ci) |\n+-------------------------------------------------------------------------+\n| utf8_unicode_ci |\n+-------------------------------------------------------------------------+\n \nUsing CAST() to order an ENUM field as a CHAR rather than\nthe internal numerical value:\n \nCREATE TABLE enum_list (enum_field enum(\'c\',\'a\',\'b\'));\n \nINSERT INTO enum_list (enum_field) \nVALUES(\'c\'),(\'a\'),(\'c\'),(\'b\');\n \nSELECT * FROM enum_list \nORDER BY enum_field;\n \n+------------+\n| enum_field |\n+------------+\n| c |\n| c |\n| a |\n| b |\n+------------+\n \nSELECT * FROM enum_list \nORDER BY CAST(enum_field AS CHAR);\n+------------+\n| enum_field |\n+------------+\n| a |\n| b |\n| c |\n| c |\n+------------+\n \nFrom MariaDB 5.5.31, the following will trigger warnings,\nsince x\'aa\' and \'X\'aa\' no longer behave as a number.\nPreviously, and in all versions of MySQL, no warnings are\ntriggered since they did erroneously behave as a number:\n \nSELECT CAST(0xAA AS UNSIGNED), CAST(x\'aa\' AS UNSIGNED),\nCAST(X\'aa\' AS UNSIGNED);\n+------------------------+-------------------------+-------------------------+\n| CAST(0xAA AS UNSIGNED) | CAST(x\'aa\' AS UNSIGNED) |\nCAST(X\'aa\' AS UNSIGNED) |\n+------------------------+-------------------------+-------------------------+\n| 170 | 0 | 0 |\n+------------------------+-------------------------+-------------------------+\n1 row in set, 2 warnings (0.00 sec)\n \nWarning (Code 1292): Truncated incorrect INTEGER value:\n\'\\xAA\'\nWarning (Code 1292): Truncated incorrect INTEGER value:\n\'\\xAA\'\n \nCasting to intervals:\n \nSELECT CAST(2019-01-04 INTERVAL AS DAY_SECOND(2)) AS\n\"Cast\";\n \n+-------------+\n| Cast |\n+-------------+\n| 00:20:17.00 |\n+-------------+\n \n\n\nURL: https://mariadb.com/kb/en/cast/','','https://mariadb.com/kb/en/cast/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (586,37,'CHAR Function','Syntax\n------ \nCHAR(N,... [USING charset_name])\n \nDescription\n----------- \nCHAR() interprets each argument as an INT and returns a\nstring consisting of the characters given by the code values\nof those integers. NULL values are skipped. By default,\nCHAR() returns a binary string. To produce a string in a\ngiven character set, use the optional USING clause:\n \nSELECT 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\ngiven character set, a warning is issued. Also, if strict\nSQL mode is enabled, the result from CHAR() becomes NULL.\n \nExamples\n-------- \nSELECT CHAR(77,97,114,\'105\',97,\'68\',66);\n+----------------------------------+\n| CHAR(77,97,114,\'105\',97,\'68\',66) |\n+----------------------------------+\n| MariaDB |\n+----------------------------------+\n \nSELECT CHAR(77,77.3,\'77.3\');\n+----------------------+\n| CHAR(77,77.3,\'77.3\') |\n+----------------------+\n| MMM |\n+----------------------+\n1 row in set, 1 warning (0.00 sec)\n \nWarning (Code 1292): Truncated incorrect INTEGER value:\n\'77.3\'\n \n\n\nURL: https://mariadb.com/kb/en/char-function/','','https://mariadb.com/kb/en/char-function/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (587,37,'CHARACTER_LENGTH','Syntax\n------ \nCHARACTER_LENGTH(str)\n \nDescription\n----------- \nCHARACTER_LENGTH() is a synonym for CHAR_LENGTH().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/character_length/','','https://mariadb.com/kb/en/character_length/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (588,37,'CHAR_LENGTH','Syntax\n------ \nCHAR_LENGTH(str)\n \nDescription\n----------- \nReturns the length of the given string argument, measured in\ncharacters. A multi-byte character counts as a single\ncharacter. This means that for a string containing five\ntwo-byte characters, LENGTH() (or OCTET_LENGTH() in Oracle\nmode) returns 10, whereas CHAR_LENGTH() returns 5. If the\nargument is NULL, it returns NULL. \n \nIf the argument is not a string value, it is converted into\na string.\n \nIt is synonymous with the CHARACTER_LENGTH() function.\n \nUntil MariaDB 10.3.1, returns MYSQL_TYPE_LONGLONG, or\nbigint(10), in all cases. From MariaDB 10.3.1, returns\nMYSQL_TYPE_LONG, or int(10), when the result would fit\nwithin 32-bits.\n \nExamples\n-------- \nSELECT CHAR_LENGTH(\'MariaDB\');\n+------------------------+\n| CHAR_LENGTH(\'MariaDB\') |\n+------------------------+\n| 7 |\n+------------------------+\n \nSELECT CHAR_LENGTH(\'Ï€\');\n+-------------------+\n| CHAR_LENGTH(\'Ï€\') |\n+-------------------+\n| 1 |\n+-------------------+\n \n\n\nURL: https://mariadb.com/kb/en/char_length/','','https://mariadb.com/kb/en/char_length/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (589,37,'CHR','The CHR() function was introduced in MariaDB 10.3.1 to\nprovide Oracle compatibility\n \nSyntax\n------ \nCHR(N)\n \nDescription\n----------- \nCHR() interprets each argument N as an integer and returns a\nVARCHAR(1) string consisting of the character given by the\ncode values of the integer. The character set and collation\nof the string are set according to the values of the\ncharacter_set_database and collation_database system\nvariables.\n \nCHR() is similar to the CHAR() function, but only accepts a\nsingle argument.\n \nCHR() is available in all sql_modes.\n \nExamples\n-------- \nSELECT CHR(67);\n+---------+\n| CHR(67) |\n+---------+\n| C |\n+---------+\n \nSELECT CHR(\'67\');\n+-----------+\n| CHR(\'67\') |\n+-----------+\n| C |\n+-----------+\n \nSELECT CHR(\'C\');\n+----------+\n| CHR(\'C\') |\n+----------+\n| |\n+----------+\n1 row in set, 1 warning (0.000 sec)\n \nSHOW WARNINGS;\n \n+---------+------+----------------------------------------+\n| Level | Code | Message |\n+---------+------+----------------------------------------+\n| Warning | 1292 | Truncated incorrect INTEGER value: \'C\'\n|\n+---------+------+----------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/chr/','','https://mariadb.com/kb/en/chr/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (590,37,'CONCAT','Syntax\n------ \nCONCAT(str1,str2,...)\n \nDescription\n----------- \nReturns the string that results from concatenating the\narguments. May have one or more arguments. If all arguments\nare non-binary strings, the result is a non-binary string.\nIf the arguments include any binary strings, the result is a\nbinary string. A numeric argument is converted to its\nequivalent binary string form; if you want to avoid that,\nyou can use an explicit type cast, as in this example:\n \nSELECT CONCAT(CAST(int_col AS CHAR), char_col);\n \nCONCAT() returns NULL if any argument is NULL.\n \nA NULL parameter hides all information contained in other\nparameters from the result. Sometimes this is not desirable;\nto avoid this, you can:\nUse the CONCAT_WS() function with an empty separator,\nbecause that function is NULL-safe.\nUse IFNULL() to turn NULLs into empty strings.\n \nOracle Mode\n \nIn Oracle mode from MariaDB 10.3, CONCAT ignores NULL.\n \nExamples\n-------- \nSELECT CONCAT(\'Ma\', \'ria\', \'DB\');\n+---------------------------+\n| CONCAT(\'Ma\', \'ria\', \'DB\') |\n+---------------------------+\n| MariaDB |\n+---------------------------+\n \nSELECT CONCAT(\'Ma\', \'ria\', NULL, \'DB\');\n+---------------------------------+\n| CONCAT(\'Ma\', \'ria\', NULL, \'DB\') |\n+---------------------------------+\n| NULL |\n+---------------------------------+\n \nSELECT CONCAT(42.0);\n+--------------+\n| CONCAT(42.0) |\n+--------------+\n| 42.0 |\n+--------------+\n \nUsing IFNULL() to handle NULLs:\n \nSELECT CONCAT(\'The value of @v is: \', IFNULL(@v, \'\'));\n+------------------------------------------------+\n| CONCAT(\'The value of @v is: \', IFNULL(@v, \'\')) |\n+------------------------------------------------+\n| The value of @v is: |\n+------------------------------------------------+\n \nIn Oracle mode, from MariaDB 10.3:\n \nSELECT CONCAT(\'Ma\', \'ria\', NULL, \'DB\');\n+---------------------------------+\n| CONCAT(\'Ma\', \'ria\', NULL, \'DB\') |\n+---------------------------------+\n| MariaDB |\n+---------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/concat/','','https://mariadb.com/kb/en/concat/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (591,37,'CONCAT_WS','Syntax\n------ \nCONCAT_WS(separator,str1,str2,...)\n \nDescription\n----------- \nCONCAT_WS() stands for Concatenate With Separator and is a\nspecial form of CONCAT(). The first argument is the\nseparator for the rest of the arguments. The separator is\nadded between the strings to be concatenated. The separator\ncan be a string, as can the rest of the arguments.\n \nIf the separator is NULL, the result is NULL; all other NULL\nvalues are skipped. This makes CONCAT_WS() suitable when you\nwant to concatenate some values and avoid losing all\ninformation if one of them is NULL.\n \nExamples\n-------- \nSELECT CONCAT_WS(\',\',\'First name\',\'Second name\',\'Last\nName\');\n+-------------------------------------------------------+\n| CONCAT_WS(\',\',\'First name\',\'Second name\',\'Last\nName\') |\n+-------------------------------------------------------+\n| First name,Second name,Last Name |\n+-------------------------------------------------------+\n \nSELECT CONCAT_WS(\'-\',\'Floor\',NULL,\'Room\');\n+------------------------------------+\n| CONCAT_WS(\'-\',\'Floor\',NULL,\'Room\') |\n+------------------------------------+\n| Floor-Room |\n+------------------------------------+\n \nIn some cases, remember to include a space in the separator\nstring:\n \nSET @a = \'gnu\', @b = \'penguin\', @c = \'sea lion\';\n \nQuery OK, 0 rows affected (0.00 sec)\n \nSELECT CONCAT_WS(\', \', @a, @b, @c);\n+-----------------------------+\n| CONCAT_WS(\', \', @a, @b, @c) |\n+-----------------------------+\n| gnu, penguin, sea lion |\n+-----------------------------+\n \nUsing CONCAT_WS() to handle NULLs:\n \nSET @a = \'a\', @b = NULL, @c = \'c\';\n \nSELECT CONCAT_WS(\'\', @a, @b, @c);\n+---------------------------+\n| CONCAT_WS(\'\', @a, @b, @c) |\n+---------------------------+\n| ac |\n+---------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/concat_ws/','','https://mariadb.com/kb/en/concat_ws/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (592,37,'CONVERT','Syntax\n------ \nCONVERT(expr,type), CONVERT(expr USING transcoding_name)\n \nDescription\n----------- \nThe CONVERT() and CAST() functions take a value of one type\nand produce a value of another type.\n \nThe type can be one of the following values:\nBINARY\nCHAR\nDATE\nDATETIME \nDECIMAL[(M[,D])]\nDOUBLE \nFLOAT — From MariaDB 10.4.5\nINTEGER \nShort for SIGNED INTEGER\n \nSIGNED [INTEGER]\nTIME \nUNSIGNED [INTEGER]\n \nNote that in MariaDB, INT and INTEGER are the same thing.\n \nBINARY produces a string with the BINARY data type. If the\noptional length is given, BINARY(N) causes the cast to use\nno more than N bytes of the argument. Values shorter than\nthe given number in bytes are padded with 0x00 bytes to make\nthem equal the length value.\n \nCHAR(N) causes the cast to use no more than the number of\ncharacters given in the argument.\n \nThe main difference between the CAST() and CONVERT() is that\nCONVERT(expr,type) is ODBC syntax while CAST(expr as type)\nand CONVERT(... USING ...) are SQL92 syntax.\n \nCONVERT() with USING is used to convert data between\ndifferent character sets. In MariaDB, transcoding names are\nthe same as the\ncorresponding character set names. For example, this\nstatement\nconverts the string \'abc\' in the default character set to\nthe\ncorresponding string in the utf8 character set:\n \nSELECT CONVERT(\'abc\' USING utf8);\n \nExamples\n-------- \nSELECT enum_col FROM tbl_name \nORDER BY CAST(enum_col AS CHAR);\n \nConverting a BINARY to string to permit the LOWER function\nto work:\n \nSET @x = \'AardVark\';\n \nSET @x = BINARY \'AardVark\';\n \nSELECT LOWER(@x), LOWER(CONVERT (@x USING latin1));\n+-----------+----------------------------------+\n| LOWER(@x) | LOWER(CONVERT (@x USING latin1)) |\n+-----------+----------------------------------+\n| AardVark | aardvark |\n+-----------+----------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/convert/','','https://mariadb.com/kb/en/convert/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (593,37,'ELT','Syntax\n------ \nELT(N, str1[, str2, str3,...])\n \nDescription\n----------- \nTakes a numeric argument and a series of string arguments.\nReturns the string that corresponds to the given numeric\nposition. For instance, it returns str1 if N is 1, str2 if N\nis 2, and so on. If the numeric argument is a FLOAT, MariaDB\nrounds it to the nearest INTEGER. If the numeric argument is\nless than 1, greater than the total number of arguments, or\nnot a number, ELT() returns NULL. It must have at least two\narguments.\n \nIt is complementary to the FIELD() function.\n \nExamples\n-------- \nSELECT ELT(1, \'ej\', \'Heja\', \'hej\', \'foo\');\n+------------------------------------+\n| ELT(1, \'ej\', \'Heja\', \'hej\', \'foo\') |\n+------------------------------------+\n| ej |\n+------------------------------------+\n \nSELECT ELT(4, \'ej\', \'Heja\', \'hej\', \'foo\');\n+------------------------------------+\n| ELT(4, \'ej\', \'Heja\', \'hej\', \'foo\') |\n+------------------------------------+\n| foo |\n+------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/elt/','','https://mariadb.com/kb/en/elt/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (594,37,'EXPORT_SET','Syntax\n------ \nEXPORT_SET(bits, on, off[, separator[, number_of_bits]])\n \nDescription\n----------- \nTakes a minimum of three arguments. Returns a string where\neach bit in the given bits argument is returned, with the\nstring values given for on and off. \n \nBits are examined from right to left, (from low-order to\nhigh-order bits). Strings are added to the result from left\nto right, separated by a separator string (defaults as\n\',\'). You can optionally limit the number of bits the\nEXPORT_SET() function examines using the number_of_bits\noption. \n \nIf any of the arguments are set as NULL, the function\nreturns NULL.\n \nExamples\n-------- \nSELECT EXPORT_SET(5,\'Y\',\'N\',\',\',4);\n+-----------------------------+\n| EXPORT_SET(5,\'Y\',\'N\',\',\',4) |\n+-----------------------------+\n| Y,N,Y,N |\n+-----------------------------+\n \nSELECT EXPORT_SET(6,\'1\',\'0\',\',\',10);\n+------------------------------+\n| EXPORT_SET(6,\'1\',\'0\',\',\',10) |\n+------------------------------+\n| 0,1,1,0,0,0,0,0,0,0 |\n+------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/export_set/','','https://mariadb.com/kb/en/export_set/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (595,37,'EXTRACTVALUE','Syntax\n------ \nEXTRACTVALUE(xml_frag, xpath_expr)\n \nDescription\n----------- \nThe EXTRACTVALUE() function takes two string arguments: a\nfragment of XML markup and an XPath expression, (also known\nas a locator). It returns the text (That is, CDDATA), of the\nfirst text node which is a child of the element or elements\nmatching the XPath expression. \n \nIn cases where a valid XPath expression does not match any\ntext nodes in a valid XML fragment, (including the implicit\n/text() expression), the EXTRACTVALUE() function returns an\nempty string.\n \nInvalid Arguments\n \nWhen either the XML fragment or the XPath expression is\nNULL, the EXTRACTVALUE() function returns NULL. When the XML\nfragment is invalid, it raises a warning Code 1525:\n \nWarning (Code 1525): Incorrect XML value: \'parse error at\nline 1 pos 11: unexpected END-OF-INPUT\'\n \nWhen the XPath value is invalid, it generates an Error 1105:\n \nERROR 1105 (HY000): XPATH syntax error: \')\'\n \nExplicit text() Expressions\n \nThis function is the equivalent of performing a match using\nthe XPath expression after appending /text(). In other\nwords:\n \nSELECT\n EXTRACTVALUE(\'example\', \'/cases/case\') AS \'Base\nExample\',\n EXTRACTVALUE(\'example\', \'/cases/case/text()\') AS\n\'text() Example\';\n \n+--------------+----------------+\n| Base Example | text() Example |\n+--------------+----------------+\n| example | example |\n+--------------+----------------+\n \nCount Matches\n \nWhen EXTRACTVALUE() returns multiple matches, it returns the\ncontent of the first child text node of each matching\nelement, in the matched order, as a single, space-delimited\nstring.\n \nBy design, the EXTRACTVALUE() function makes no distinction\nbetween a match on an empty element and no match at all. If\nyou need to determine whether no matching element was found\nin the XML fragment or if an element was found that\ncontained no child text nodes, use the XPath count()\nfunction. \n \nFor instance, when looking for a value that exists, but\ncontains no child text nodes, you would get a count of the\nnumber of matching instances:\n \nSELECT\n EXTRACTVALUE(\'\', \'/cases/case\') AS \'Empty Example\',\n EXTRACTVALUE(\'\', \'/cases/case/count()\') AS \'count()\nExample\';\n \n+---------------+-----------------+\n| Empty Example | count() Example |\n+---------------+-----------------+\n| | 1 |\n+---------------+-----------------+\n \nAlternatively, when looking for a value that doesn\'t exist,\ncount() returns 0.\n \nSELECT\n EXTRACTVALUE(\'\', \'/cases/person\') AS \'No Match\nExample\',\n EXTRACTVALUE(\'\', \'/cases/person/count()\') AS \'count()\nExample\';\n \n+------------------+-----------------+\n| No Match Example | count() Example |\n+------------------+-----------------+\n| | 0|\n+------------------+-----------------+\n \nMatches\n \nImportant: The EXTRACTVALUE() function only returns CDDATA.\nIt does not return tags that the element might contain or\nthe text that these child elements contain.\n \nSELECT EXTRACTVALUE(\'Personx@example.com\', \'/cases\') AS\nCase;\n \n+--------+\n| Case |\n+--------+\n| Person |\n+--------+\n \nNote, in the above example, while the XPath expression\nmatches to the parent instance, it does not return the\ncontained tag or its content.\n \nExamples\n-------- \nSELECT\n ExtractValue(\'cccddd\', \'/a\') AS val1,\n ExtractValue(\'cccddd\', \'/a/b\') AS val2,\n ExtractValue(\'cccddd\', \'//b\') AS val3,\n ExtractValue(\'cccddd\', \'/b\') AS val4,\n ExtractValue(\'cccdddeee\', \'//b\') AS val5;\n \n+------+------+------+------+---------+\n| val1 | val2 | val3 | val4 | val5 |\n+------+------+------+------+---------+\n| ccc | ddd | ddd | | ddd eee |\n+------+------+------+------+---------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/extractvalue/','','https://mariadb.com/kb/en/extractvalue/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (596,37,'FIELD','Syntax\n------ \nFIELD(pattern, str1[,str2,...])\n \nDescription\n----------- \nReturns the index position of the string or number matching\nthe given pattern. Returns 0 in the event that none of the\narguments match the pattern. Raises an Error 1582 if not\ngiven at least two arguments.\n \nWhen all arguments given to the FIELD() function are\nstrings, they are treated as case-insensitive. When all the\narguments are numbers, they are treated as numbers.\nOtherwise, they are treated as doubles. \n \nIf the given pattern occurs more than once, the FIELD()\nfunction only returns the index of the first instance. If\nthe given pattern is NULL, the function returns 0, as a NULL\npattern always fails to match.\n \nThis function is complementary to the ELT() function.\n \nExamples\n-------- \nSELECT FIELD(\'ej\', \'Hej\', \'ej\', \'Heja\', \'hej\',\n\'foo\') \n AS \'Field Results\';\n \n+---------------+\n| Field Results | \n+---------------+\n| 2 |\n+---------------+\n \nSELECT FIELD(\'fo\', \'Hej\', \'ej\', \'Heja\', \'hej\',\n\'foo\')\n AS \'Field Results\';\n \n+---------------+\n| Field Results | \n+---------------+\n| 0 |\n+---------------+\n \nSELECT FIELD(1, 2, 3, 4, 5, 1) AS \'Field Results\';\n \n+---------------+\n| Field Results |\n+---------------+\n| 5 |\n+---------------+\n \nSELECT FIELD(NULL, 2, 3) AS \'Field Results\';\n \n+---------------+\n| Field Results |\n+---------------+\n| 0 |\n+---------------+\n \nSELECT FIELD(\'fail\') AS \'Field Results\';\n \nError 1582 (42000): Incorrect parameter count in call\nto native function \'field\'\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/field/','','https://mariadb.com/kb/en/field/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (597,37,'FIND_IN_SET','Syntax\n------ \nFIND_IN_SET(pattern, strlist)\n \nDescription\n----------- \nReturns the index position where the given pattern occurs in\na string list. The first argument is the pattern you want to\nsearch for. The second argument is a string containing\ncomma-separated variables. If the second argument is of the\nSET data-type, the function is optimized to use bit\narithmetic.\n \nIf the pattern does not occur in the string list or if the\nstring list is an empty string, the function returns 0. If\neither argument is NULL, the function returns NULL. The\nfunction does not return the correct result if the pattern\ncontains a comma (\",\") character.\n \nExamples\n-------- \nSELECT FIND_IN_SET(\'b\',\'a,b,c,d\') AS \"Found Results\";\n \n+---------------+\n| Found Results |\n+---------------+\n| 2 |\n+---------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/find_in_set/','','https://mariadb.com/kb/en/find_in_set/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (598,37,'FORMAT','Syntax\n------ \nFORMAT(num, decimal_position[, locale])\n \nDescription\n----------- \nFormats the given number for display as a string, adding\nseparators to appropriate position and rounding the results\nto the given decimal position. For instance, it would format\n15233.345 to 15,233.35.\n \nIf the given decimal position is 0, it rounds to return no\ndecimal point or fractional part. You can optionally specify\na locale value to format numbers to the pattern appropriate\nfor the given region.\n \nExamples\n-------- \nSELECT FORMAT(1234567890.09876543210, 4) AS \'Format\';\n \n+--------------------+\n| Format |\n+--------------------+\n| 1,234,567,890.0988 |\n+--------------------+\n \nSELECT FORMAT(1234567.89, 4) AS \'Format\';\n \n+----------------+\n| Format |\n+----------------+\n| 1,234,567.8900 |\n+----------------+\n \nSELECT FORMAT(1234567.89, 0) AS \'Format\';\n \n+-----------+\n| Format |\n+-----------+\n| 1,234,568 |\n+-----------+\n \nSELECT FORMAT(123456789,2,\'rm_CH\') AS \'Format\';\n \n+----------------+\n| Format |\n+----------------+\n| 123\'456\'789,00 |\n+----------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/format/','','https://mariadb.com/kb/en/format/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (599,37,'FROM_BASE64','The FROM_BASE64() function was introduced in MariaDB 10.0.5.\n \nSyntax\n------ \nFROM_BASE64(str)\n \nDescription\n----------- \nDecodes the given base-64 encode string, returning the\nresult as a binary string. Returns NULL if the given string\nis NULL or if it\'s invalid.\n \nIt is the reverse of the TO_BASE64 function.\n \nThere are numerous methods to base-64 encode a string.\nMariaDB uses the following:\nIt encodes alphabet value 64 as \'+\'.\nIt encodes alphabet value 63 as \'/\'.\nIt codes output in groups of four printable characters. Each\nthree byte of data encoded uses four characters. If the\nfinal group is incomplete, it pads the difference with the\n\'=\' character.\nIt divides long output, adding a new line very 76\ncharacters.\nIn decoding, it recognizes and ignores newlines, carriage\nreturns, tabs and space whitespace characters.\n \nSELECT TO_BASE64(\'Maria\') AS \'Input\';\n \n+-----------+\n| Input |\n+-----------+\n| TWFyaWE= |\n+-----------+\n \nSELECT FROM_BASE64(\'TWFyaWE=\') AS \'Output\';\n \n+--------+\n| Output |\n+--------+\n| Maria |\n+--------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/from_base64/','','https://mariadb.com/kb/en/from_base64/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (600,37,'HEX','Syntax\n------ \nHEX(N_or_S)\n \nDescription\n----------- \nIf N_or_S is a number, returns a string representation of\nthe hexadecimal\nvalue of N, where N is a longlong (BIGINT) number. This is\nequivalent to CONV(N,10,16).\n \nIf N_or_S is a string, returns a hexadecimal string\nrepresentation of\nN_or_S where each byte of each character in N_or_S is\nconverted to two hexadecimal\ndigits. If N_or_S is NULL, returns NULL. The inverse of this\noperation is performed by the UNHEX()\nfunction.\n \nExamples\n-------- \nSELECT HEX(255);\n+----------+\n| HEX(255) |\n+----------+\n| FF |\n+----------+\n \nSELECT 0x4D617269614442;\n \n+------------------+\n| 0x4D617269614442 |\n+------------------+\n| MariaDB |\n+------------------+\n \nSELECT HEX(\'MariaDB\');\n+----------------+\n| HEX(\'MariaDB\') |\n+----------------+\n| 4D617269614442 |\n+----------------+\n \n\n\nURL: https://mariadb.com/kb/en/hex/','','https://mariadb.com/kb/en/hex/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (601,37,'INSERT Function','Syntax\n------ \nINSERT(str,pos,len,newstr)\n \nDescription\n----------- \nReturns the string str, with the substring beginning at\nposition pos\nand len characters long replaced by the string newstr.\nReturns the\noriginal string if pos is not within the length of the\nstring.\nReplaces the rest of the string from position pos if len is\nnot within\nthe length of the rest of the string. Returns NULL if any\nargument is\nNULL.\n \nExamples\n-------- \nSELECT INSERT(\'Quadratic\', 3, 4, \'What\');\n+-----------------------------------+\n| INSERT(\'Quadratic\', 3, 4, \'What\') |\n+-----------------------------------+\n| QuWhattic |\n+-----------------------------------+\n \nSELECT INSERT(\'Quadratic\', -1, 4, \'What\');\n+------------------------------------+\n| INSERT(\'Quadratic\', -1, 4, \'What\') |\n+------------------------------------+\n| Quadratic |\n+------------------------------------+\n \nSELECT INSERT(\'Quadratic\', 3, 100, \'What\');\n+-------------------------------------+\n| INSERT(\'Quadratic\', 3, 100, \'What\') |\n+-------------------------------------+\n| QuWhat |\n+-------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/insert-function/','','https://mariadb.com/kb/en/insert-function/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (602,37,'INSTR','Syntax\n------ \nINSTR(str,substr)\n \nDescription\n----------- \nReturns the position of the first occurrence of substring\nsubstr in\nstring str. This is the same as the two-argument form of\nLOCATE(),\nexcept that the order of the arguments is reversed.\n \nINSTR() performs a case-insensitive search.\n \nIf any argument is NULL, returns NULL.\n \nExamples\n-------- \nSELECT INSTR(\'foobarbar\', \'bar\');\n+---------------------------+\n| INSTR(\'foobarbar\', \'bar\') |\n+---------------------------+\n| 4 |\n+---------------------------+\n \nSELECT INSTR(\'My\', \'Maria\');\n+----------------------+\n| INSTR(\'My\', \'Maria\') |\n+----------------------+\n| 0 |\n+----------------------+\n \n\n\nURL: https://mariadb.com/kb/en/instr/','','https://mariadb.com/kb/en/instr/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (603,37,'LCASE','Syntax\n------ \nLCASE(str)\n \nDescription\n----------- \nLCASE() is a synonym for LOWER().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/lcase/','','https://mariadb.com/kb/en/lcase/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (604,37,'LEFT','Syntax\n------ \nLEFT(str,len)\n \nDescription\n----------- \nReturns the leftmost len characters from the string str, or\nNULL if\nany argument is NULL.\n \nExamples\n-------- \nSELECT LEFT(\'MariaDB\', 5);\n+--------------------+\n| LEFT(\'MariaDB\', 5) |\n+--------------------+\n| Maria |\n+--------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/left/','','https://mariadb.com/kb/en/left/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (605,37,'LENGTH','Syntax\n------ \nLENGTH(str)\n \nDescription\n----------- \nReturns the length of the string str, measured in bytes. A\nmulti-byte\ncharacter counts as multiple bytes. This means that for a\nstring\ncontaining five two-byte characters, LENGTH() returns 10,\nwhereas\nCHAR_LENGTH() returns 5. \n \nIf str is not a string value, it is converted into a string.\nIf str is NULL, the function returns NULL.\n \nUntil MariaDB 10.3.1, returns MYSQL_TYPE_LONGLONG, or\nbigint(10), in all cases. From MariaDB 10.3.1, returns\nMYSQL_TYPE_LONG, or int(10), when the result would fit\nwithin 32-bits.\n \nOracle Mode\n \nWhen running Oracle mode from MariaDB 10.3, LENGTH() is a\nsynonym for CHAR_LENGTH().\n \nExamples\n-------- \nSELECT LENGTH(\'MariaDB\');\n+-------------------+\n| LENGTH(\'MariaDB\') |\n+-------------------+\n| 7 |\n+-------------------+\n \nSELECT LENGTH(\'Ï€\');\n+--------------+\n| LENGTH(\'Ï€\') |\n+--------------+\n| 2 |\n+--------------+\n \nIn Oracle mode from MariaDB 10.3:\n \nSELECT LENGTH(\'Ï€\');\n+--------------+\n| LENGTH(\'Ï€\') |\n+--------------+\n| 1 |\n+--------------+\n \n\n\nURL: https://mariadb.com/kb/en/length/','','https://mariadb.com/kb/en/length/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (606,37,'LENGTHB','Introduced in MariaDB 10.3.1 as part of the Oracle\ncompatibility enhancements.\n \nSyntax\n------ \nLENGTHB(str)\n \nDescription\n----------- \nLENGTHB() is a synonym for LENGTH().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/lengthb/','','https://mariadb.com/kb/en/lengthb/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (607,37,'LIKE','Syntax\n------ \nexpr LIKE pat [ESCAPE \'escape_char\']\nexpr NOT LIKE pat [ESCAPE \'escape_char\']\n \nDescription\n----------- \nTests whether expr matches the pattern pat. Returns either 1\n(TRUE) or 0 (FALSE).\nBoth expr and pat may be any valid expression and are\nevaluated to strings.\nPatterns may use the following wildcard characters:\n% matches any number of characters, including zero.\n_ matches any single character.\n \nUse NOT LIKE to test if a string does not match a pattern.\nThis is equivalent to using\nthe NOT operator on the entire LIKE expression.\n \nIf either the expression or the pattern is NULL, the result\nis NULL.\n \nLIKE performs case-insensitive substring matches if the\ncollation for the\nexpression and pattern is case-insensitive. For\ncase-sensitive matches, declare either argument\nto use a binary collation using COLLATE, or coerce either of\nthem to a BINARY\nstring using CAST. Use SHOW COLLATION to get a list of\navailable collations. Collations ending in _bin are\ncase-sensitive.\n \nNumeric arguments are coerced to binary strings.\n \nThe _ wildcard matches a single character, not byte. It will\nonly match a multi-byte character\nif it is valid in the expression\'s character set. For\nexample, _ will match _utf8\"€\", but it\nwill not match _latin1\"€\" because the Euro sign is not a\nvalid latin1 character. If necessary,\nuse CONVERT to use the expression in a different character\nset.\n \nIf you need to match the characters _ or %, you must escape\nthem. By default,\nyou can prefix the wildcard characters the backslash\ncharacter \\ to escape them.\nThe backslash is used both to encode special characters like\nnewlines when a string is\nparsed as well as to escape wildcards in a pattern after\nparsing. Thus, to match an\nactual backslash, you sometimes need to double-escape it as\n\"\\\\\\\\\".\n \nTo avoid difficulties with the backslash character, you can\nchange the wildcard escape\ncharacter using ESCAPE in a LIKE expression. The argument to\nESCAPE\nmust be a single-character string.\n \nExamples\n-------- \nSelect the days that begin with \"T\":\n \nCREATE TABLE t1 (d VARCHAR(16));\nINSERT INTO t1 VALUES (\"Monday\"), (\"Tuesday\"),\n(\"Wednesday\"), (\"Thursday\"), (\"Friday\"),\n(\"Saturday\"), (\"Sunday\");\nSELECT * FROM t1 WHERE d LIKE \"T%\";\n \nSELECT * FROM t1 WHERE d LIKE \"T%\";\n+----------+\n| d |\n+----------+\n| Tuesday |\n| Thursday |\n+----------+\n \nSelect the days that contain the substring \"es\":\n \nSELECT * FROM t1 WHERE d LIKE \"%es%\";\n \nSELECT * FROM t1 WHERE d LIKE \"%es%\";\n+-----------+\n| d |\n+-----------+\n| Tuesday |\n| Wednesday |\n+-----------+\n \nSelect the six-character day names:\n \nSELECT * FROM t1 WHERE d like \"___day\";\n \nSELECT * FROM t1 WHERE d like \"___day\";\n+---------+\n| d |\n+---------+\n| Monday |\n| Friday |\n| Sunday |\n+---------+\n \nWith the default collations, LIKE is case-insensitive:\n \nSELECT * FROM t1 where d like \"t%\";\n \nSELECT * FROM t1 where d like \"t%\";\n+----------+\n| d |\n+----------+\n| Tuesday |\n| Thursday |\n+----------+\n \nUse COLLATE to specify a binary collation, forcing\ncase-sensitive matches:\n \nSELECT * FROM t1 WHERE d like \"t%\" COLLATE latin1_bin;\n \nSELECT * FROM t1 WHERE d like \"t%\" COLLATE latin1_bin;\nEmpty set (0.00 sec)\n \nYou can include functions and operators in the expression to\nmatch. Select dates\nbased on their day name:\n \nCREATE TABLE t2 (d DATETIME);\nINSERT INTO t2 VALUES\n (\"2007-01-30 21:31:07\"),\n (\"1983-10-15 06:42:51\"),\n (\"2011-04-21 12:34:56\"),\n (\"2011-10-30 06:31:41\"),\n (\"2011-01-30 14:03:25\"),\n (\"2004-10-07 11:19:34\");\nSELECT * FROM t2 WHERE DAYNAME(d) LIKE \"T%\";\n \nSELECT * FROM t2 WHERE DAYNAME(d) LIKE \"T%\";\n+------------------+\n| d |\n+------------------+\n| 2007-01-30 21:31 |\n| 2011-04-21 12:34 |\n| 2004-10-07 11:19 |\n+------------------+\n3 rows in set, 7 warnings (0.00 sec)\n \nOptimizing LIKE\n \nMariaDB can use indexes for LIKE on string columns in the\ncase where the LIKE doesn\'t start with % or _.\nStarting from MariaDB 10.0, one can set the\noptimizer_use_condition_selectivity variable to 5. If this\nis done, then the optimizer will read\noptimizer_selectivity_sampling_limit rows to calculate the\nselectivity of the LIKE expression before starting to\ncalculate the query plan. This can help speed up some LIKE\nqueries by providing the optimizer with more information\nabout your data.\n \n\n\nURL: https://mariadb.com/kb/en/like/','','https://mariadb.com/kb/en/like/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (608,37,'LOAD_FILE','Syntax\n------ \nLOAD_FILE(file_name)\n \nDescription\n----------- \nReads the file and returns the file contents as a string. To\nuse this function, the file must be located on the server\nhost, you must specify the full path name to the file, and\nyou must have the FILE privilege. The file must be readable\nby all and it must be less than the size, in bytes, of the\nmax_allowed_packet system variable. If the secure_file_priv\nsystem variable is set to a non-empty directory name, the\nfile to be loaded must be located in that directory.\n \nIf the file does not exist or cannot be read because one of\nthe preceding conditions is not satisfied, the function\nreturns NULL.\n \nSince MariaDB 5.1, the character_set_filesystem system\nvariable has controlled interpretation of file names that\nare given as literal strings.\n \nStatements using the LOAD_FILE() function are not safe for\nstatement based replication. This is because the slave will\nexecute the LOAD_FILE() command itself. If the file doesn\'t\nexist on the slave, the function will return NULL.\n \nExamples\n-------- \nUPDATE t SET blob_col=LOAD_FILE(\'/tmp/picture\') WHERE\nid=1;\n \n\n\nURL: https://mariadb.com/kb/en/load_file/','','https://mariadb.com/kb/en/load_file/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (609,37,'LOCATE','Syntax\n------ \nLOCATE(substr,str), LOCATE(substr,str,pos)\n \nDescription\n----------- \nThe first syntax returns the position of the first\noccurrence of\nsubstring substr in string str. The second syntax returns\nthe position\nof the first occurrence of substring substr in string str,\nstarting at\nposition pos. Returns 0 if substr is not in str.\n \nLOCATE() performs a case-insensitive search.\n \nIf any argument is NULL, returns NULL.\n \nINSTR() is a synonym of LOCATE() without the third argument.\n \nExamples\n-------- \nSELECT LOCATE(\'bar\', \'foobarbar\');\n+----------------------------+\n| LOCATE(\'bar\', \'foobarbar\') |\n+----------------------------+\n| 4 |\n+----------------------------+\n \nSELECT LOCATE(\'My\', \'Maria\');\n+-----------------------+\n| LOCATE(\'My\', \'Maria\') |\n+-----------------------+\n| 0 |\n+-----------------------+\n \nSELECT LOCATE(\'bar\', \'foobarbar\', 5);\n+-------------------------------+\n| LOCATE(\'bar\', \'foobarbar\', 5) |\n+-------------------------------+\n| 7 |\n+-------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/locate/','','https://mariadb.com/kb/en/locate/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (610,37,'LOWER','Syntax\n------ \nLOWER(str)\n \nDescription\n----------- \nReturns the string str with all characters changed to\nlowercase\naccording to the current character set mapping. The default\nis latin1\n(cp1252 West European).\n \nExamples\n-------- \n SELECT LOWER(\'QUADRATICALLY\');\n+------------------------+\n| LOWER(\'QUADRATICALLY\') |\n+------------------------+\n| quadratically |\n+------------------------+\n \nLOWER() (and UPPER()) are ineffective when applied to binary\nstrings (BINARY, VARBINARY, BLOB). \nTo perform lettercase conversion, CONVERT the string to a\nnon-binary string:\n \nSET @str = BINARY \'North Carolina\';\n \nSELECT LOWER(@str), LOWER(CONVERT(@str USING latin1));\n+----------------+-----------------------------------+\n| LOWER(@str) | LOWER(CONVERT(@str USING latin1)) |\n+----------------+-----------------------------------+\n| North Carolina | north carolina |\n+----------------+-----------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/lower/','','https://mariadb.com/kb/en/lower/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (611,37,'LPAD','Syntax\n------ \nLPAD(str, len [,padstr])\n \nDescription\n----------- \nReturns the string str, left-padded with the string padstr\nto a length\nof len characters. If str is longer than len, the return\nvalue is\nshortened to len characters. If padstr is omitted, the LPAD\nfunction pads spaces.\n \nPrior to MariaDB 10.3.1, the padstr parameter was mandatory.\n \nReturns NULL if given a NULL argument. If the result is\nempty (zero length), returns either an empty string or, from\nMariaDB 10.3.6 with SQL_MODE=Oracle, NULL.\n \nThe Oracle mode version of the function can be accessed\noutside of Oracle mode by using LPAD_ORACLE as the function\nname.\n \nExamples\n-------- \nSELECT LPAD(\'hello\',10,\'.\');\n+----------------------+\n| LPAD(\'hello\',10,\'.\') |\n+----------------------+\n| .....hello |\n+----------------------+\n \nSELECT LPAD(\'hello\',2,\'.\');\n+---------------------+\n| LPAD(\'hello\',2,\'.\') |\n+---------------------+\n| he |\n+---------------------+\n \nFrom MariaDB 10.3.1, with the pad string defaulting to\nspace.\n \nSELECT LPAD(\'hello\',10);\n+------------------+\n| LPAD(\'hello\',10) |\n+------------------+\n| hello |\n+------------------+\n \nOracle mode version from MariaDB 10.3.6:\n \nSELECT LPAD(\'\',0),LPAD_ORACLE(\'\',0);\n+------------+-------------------+\n| LPAD(\'\',0) | LPAD_ORACLE(\'\',0) |\n+------------+-------------------+\n| | NULL |\n+------------+-------------------+\n \n\n\nURL: https://mariadb.com/kb/en/lpad/','','https://mariadb.com/kb/en/lpad/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (612,37,'LTRIM','Syntax\n------ \nLTRIM(str)\n \nDescription\n----------- \nReturns the string str with leading space characters\nremoved.\n \nReturns NULL if given a NULL argument. If the result is\nempty, returns either an empty string, or, from MariaDB\n10.3.6 with SQL_MODE=Oracle, NULL.\n \nThe Oracle mode version of the function can be accessed\noutside of Oracle mode by using LTRIM_ORACLE as the function\nname.\n \nExamples\n-------- \nSELECT QUOTE(LTRIM(\' MariaDB \'));\n+-------------------------------+\n| QUOTE(LTRIM(\' MariaDB \')) |\n+-------------------------------+\n| \'MariaDB \' |\n+-------------------------------+\n \nOracle mode version from MariaDB 10.3.6:\n \nSELECT LTRIM(\'\'),LTRIM_ORACLE(\'\');\n+-----------+------------------+\n| LTRIM(\'\') | LTRIM_ORACLE(\'\') |\n+-----------+------------------+\n| | NULL |\n+-----------+------------------+\n \n\n\nURL: https://mariadb.com/kb/en/ltrim/','','https://mariadb.com/kb/en/ltrim/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (613,37,'MAKE_SET','Syntax\n------ \nMAKE_SET(bits,str1,str2,...)\n \nDescription\n----------- \nReturns a set value (a string containing substrings\nseparated by \",\"\ncharacters) consisting of the strings that have the\ncorresponding bit\nin bits set. str1 corresponds to bit 0, str2 to bit 1, and\nso on. NULL\nvalues in str1, str2, ... are not appended to the result.\n \nExamples\n-------- \nSELECT MAKE_SET(1,\'a\',\'b\',\'c\');\n+-------------------------+\n| MAKE_SET(1,\'a\',\'b\',\'c\') |\n+-------------------------+\n| a |\n+-------------------------+\n \nSELECT MAKE_SET(1 | 4,\'hello\',\'nice\',\'world\');\n+----------------------------------------+\n| MAKE_SET(1 | 4,\'hello\',\'nice\',\'world\') |\n+----------------------------------------+\n| hello,world |\n+----------------------------------------+\n \nSELECT MAKE_SET(1 | 4,\'hello\',\'nice\',NULL,\'world\');\n+---------------------------------------------+\n| MAKE_SET(1 | 4,\'hello\',\'nice\',NULL,\'world\') |\n+---------------------------------------------+\n| hello |\n+---------------------------------------------+\n \nSELECT QUOTE(MAKE_SET(0,\'a\',\'b\',\'c\'));\n+--------------------------------+\n| QUOTE(MAKE_SET(0,\'a\',\'b\',\'c\')) |\n+--------------------------------+\n| \'\' |\n+--------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/make_set/','','https://mariadb.com/kb/en/make_set/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (614,37,'MATCH AGAINST','Syntax\n------ \nMATCH (col1,col2,...) AGAINST (expr [search_modifier])\n \nDescription\n----------- \nA special construct used to perform a fulltext search on a\nfulltext index.\n \nSee Fulltext Index Overview for a full description, and\nFull-text Indexes for more articles on the topic.\n \nExamples\n-------- \nCREATE TABLE ft_myisam(copy TEXT,FULLTEXT(copy))\nENGINE=MyISAM;\n \nINSERT INTO ft_myisam(copy) VALUES (\'Once upon a time\'),\n(\'There was a wicked witch\'), \n (\'Who ate everybody up\');\n \nSELECT * FROM ft_myisam WHERE MATCH(copy)\nAGAINST(\'wicked\');\n+--------------------------+\n| copy |\n+--------------------------+\n| There was a wicked witch |\n+--------------------------+\n \nSELECT 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|\n| 6 | When configured properly, MySQL ... | 1.3114095926285\n|\n+----+-------------------------------------+-----------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/match-against/','','https://mariadb.com/kb/en/match-against/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (615,37,'MID','Syntax\n------ \nMID(str,pos,len)\n \nDescription\n----------- \nMID(str,pos,len) is a synonym for SUBSTRING(str,pos,len).\n \nExamples\n-------- \nSELECT MID(\'abcd\',4,1);\n+-----------------+\n| MID(\'abcd\',4,1) |\n+-----------------+\n| d |\n+-----------------+\n \nSELECT MID(\'abcd\',2,2);\n+-----------------+\n| MID(\'abcd\',2,2) |\n+-----------------+\n| bc |\n+-----------------+\n \nA negative starting position:\n \nSELECT MID(\'abcd\',-2,4);\n+------------------+\n| MID(\'abcd\',-2,4) |\n+------------------+\n| cd |\n+------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/mid/','','https://mariadb.com/kb/en/mid/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (616,37,'NOT LIKE','Syntax\n------ \nexpr NOT LIKE pat [ESCAPE \'escape_char\']\n \nDescription\n----------- \nThis is the same as NOT (expr LIKE pat [ESCAPE\n\'escape_char\']).\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/not-like/','','https://mariadb.com/kb/en/not-like/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (617,37,'NOT REGEXP','Syntax\n------ \nexpr NOT REGEXP pat, expr NOT RLIKE pat\n \nDescription\n----------- \nThis is the same as NOT (expr REGEXP pat).\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/not-regexp/','','https://mariadb.com/kb/en/not-regexp/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (618,37,'OCTET_LENGTH','Syntax\n------ \nOCTET_LENGTH(str)\n \nDescription\n----------- \nOCTET_LENGTH() is normally a synonym for LENGTH(). When\nrunning Oracle mode from MariaDB 10.3, they are not\nsynonyms, but OCTET_LENGTH() behaves as LENGTH() would when\nnot in Oracle mode.\n \n\n\nURL: https://mariadb.com/kb/en/octet_length/','','https://mariadb.com/kb/en/octet_length/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (619,37,'ORD','Syntax\n------ \nORD(str)\n \nDescription\n----------- \nIf the leftmost character of the string str is a multi-byte\ncharacter,\nreturns the code for that character, calculated from the\nnumeric\nvalues of its constituent bytes using this formula:\n \n (1st byte code)\n+ (2nd byte code x 256)\n+ (3rd byte code x 256 x 256) ...\n \nIf the leftmost character is not a multi-byte character,\nORD() returns\nthe same value as the ASCII() function.\n \nExamples\n-------- \nSELECT ORD(\'2\');\n+----------+\n| ORD(\'2\') |\n+----------+\n| 50 |\n+----------+\n \n\n\nURL: https://mariadb.com/kb/en/ord/','','https://mariadb.com/kb/en/ord/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (620,37,'POSITION','Syntax\n------ \nPOSITION(substr IN str)\n \nDescription\n----------- \nPOSITION(substr IN str) is a synonym for LOCATE(substr,str).\n \nIt\'s part of ODBC 3.0.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/position/','','https://mariadb.com/kb/en/position/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (621,37,'QUOTE','Syntax\n------ \nQUOTE(str)\n \nDescription\n----------- \nQuotes a string to produce a result that can be used as a\nproperly escaped data\nvalue in an SQL statement. The string is returned enclosed\nby single quotes and\nwith each instance of single quote (\"\'\"), backslash\n(\"\\\"),\nASCII NUL, and Control-Z preceded by a backslash. If the\nargument\nis NULL, the return value is the word \"NULL\" without\nenclosing single\nquotes.\n \nExamples\n-------- \nSELECT QUOTE(\"Don\'t!\");\n+-----------------+\n| QUOTE(\"Don\'t!\") |\n+-----------------+\n| \'Don\\\'t!\' |\n+-----------------+\n \nSELECT QUOTE(NULL); \n+-------------+\n| QUOTE(NULL) |\n+-------------+\n| NULL |\n+-------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/quote/','','https://mariadb.com/kb/en/quote/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (622,37,'REGEXP_INSTR','REGEXP_INSTR was introduced in MariaDB 10.0.5.\n \nSyntax\n------ \nREGEXP_INSTR(subject, pattern)\n \nReturns the position of the first occurrence of the regular\nexpression pattern in the string subject, or 0 if pattern\nwas not found.\n \nThe positions start with 1 and are measured in characters\n(i.e. not in bytes), which is important for multi-byte\ncharacter sets. You can cast a multi-byte character set to\nBINARY to get offsets in bytes.\n \nThe function follows the case sensitivity rules of the\neffective collation. Matching is performed case\ninsensitively for case insensitive collations, and case\nsensitively for case sensitive collations and for binary\ndata.\n \nThe collation case sensitivity can be overwritten using the\n(?i) and (?-i) PCRE flags.\n \nMariaDB 10.0.5 switched to the PCRE regular expression\nlibrary for enhanced regular expression performance, and\nREGEXP_INSTR was introduced as part of this enhancement.\n \nExamples\n-------- \nSELECT REGEXP_INSTR(\'abc\',\'b\');\n-> 2\n \nSELECT REGEXP_INSTR(\'abc\',\'x\');\n-> 0\n \nSELECT REGEXP_INSTR(\'BJÖRN\',\'N\');\n-> 5\n \nCasting a multi-byte character set as BINARY to get offsets\nin bytes:\n \nSELECT REGEXP_INSTR(BINARY \'BJÖRN\',\'N\') AS\ncast_utf8_to_binary;\n-> 6\n \nCase sensitivity:\n \nSELECT REGEXP_INSTR(\'ABC\',\'b\');\n-> 2\n \nSELECT REGEXP_INSTR(\'ABC\' COLLATE utf8_bin,\'b\');\n-> 0\n \nSELECT REGEXP_INSTR(BINARY\'ABC\',\'b\');\n-> 0\n \nSELECT REGEXP_INSTR(\'ABC\',\'(?-i)b\');\n-> 0\n \nSELECT REGEXP_INSTR(\'ABC\' COLLATE utf8_bin,\'(?i)b\');\n-> 2\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/regexp_instr/','','https://mariadb.com/kb/en/regexp_instr/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (623,37,'REGEXP_REPLACE','REGEXP_REPLACE was introduced in MariaDB 10.0.5.\n \nSyntax\n------ \nREGEXP_REPLACE(subject, pattern, replace)\n \nDescription\n----------- \nREGEXP_REPLACE returns the string subject with all\noccurrences of the regular expression pattern replaced by\nthe string replace. If no occurrences are found, then\nsubject is returned as is.\n \nThe replace string can have backreferences to the\nsubexpressions in the form \\N, where N is a number from 1\nto 9.\n \nThe function follows the case sensitivity rules of the\neffective collation. Matching is performed case\ninsensitively for case insensitive collations, and case\nsensitively for case sensitive collations and for binary\ndata.\n \nThe collation case sensitivity can be overwritten using the\n(?i) and (?-i) PCRE flags.\n \nMariaDB 10.0.5 switched to the PCRE regular expression\nlibrary for enhanced regular expression performance, and\nREGEXP_REPLACE was introduced as part of this enhancement.\n \nMariaDB 10.0.11 introduced the default_regex_flags variable\nto address the remaining compatibilities between PCRE and\nthe old regex library. \n \nExamples\n-------- \nSELECT REGEXP_REPLACE(\'ab12cd\',\'[0-9]\',\'\') AS\nremove_digits;\n-> abcd\n \nSELECT REGEXP_REPLACE(\'titlebody\', \'\',\' \')\nAS strip_html;\n-> title body\n \nBackreferences to the subexpressions in the form \\N, where\nN is a number from 1 to 9:\n \nSELECT REGEXP_REPLACE(\'James Bond\',\'^(.*)\n(.*)$\',\'\\\\2, \\\\1\') AS reorder_name;\n-> Bond, James\n \nCase insensitive and case sensitive matches:\n \nSELECT REGEXP_REPLACE(\'ABC\',\'b\',\'-\') AS\ncase_insensitive;\n-> A-C\n \nSELECT REGEXP_REPLACE(\'ABC\' COLLATE utf8_bin,\'b\',\'-\')\nAS case_sensitive;\n-> ABC\n \nSELECT REGEXP_REPLACE(BINARY \'ABC\',\'b\',\'-\') AS\nbinary_data;\n-> ABC\n \nOverwriting the collation case sensitivity using the (?i)\nand (?-i) PCRE flags.\n \nSELECT REGEXP_REPLACE(\'ABC\',\'(?-i)b\',\'-\') AS\nforce_case_sensitive;\n-> ABC\n \nSELECT REGEXP_REPLACE(BINARY \'ABC\',\'(?i)b\',\'-\') AS\nforce_case_insensitive;\n-> A-C\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/regexp_replace/','','https://mariadb.com/kb/en/regexp_replace/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (624,37,'REGEXP_SUBSTR','REGEXP_SUBSTR was introduced in MariaDB 10.0.5.\n \nSyntax\n------ \nREGEXP_SUBSTR(subject,pattern)\n \nDescription\n----------- \nReturns the part of the string subject that matches the\nregular expression pattern, or an empty string if pattern\nwas not found.\n \nThe function follows the case sensitivity rules of the\neffective collation. Matching is performed case\ninsensitively for case insensitive collations, and case\nsensitively for case sensitive collations and for binary\ndata.\n \nThe collation case sensitivity can be overwritten using the\n(?i) and (?-i) PCRE flags.\n \nMariaDB 10.0.5 switched to the PCRE regular expression\nlibrary for enhanced regular expression performance, and\nREGEXP_SUBSTR was introduced as part of this enhancement.\n \nMariaDB 10.0.11 introduced the default_regex_flags variable\nto address the remaining compatibilities between PCRE and\nthe old regex library. \n \nExamples\n-------- \nSELECT REGEXP_SUBSTR(\'ab12cd\',\'[0-9]+\');\n-> 12\n \nSELECT REGEXP_SUBSTR(\n \'See https://mariadb.org/en/foundation/ for details\',\n \'https?://[^/]*\');\n-> https://mariadb.org\n \nSELECT REGEXP_SUBSTR(\'ABC\',\'b\');\n-> B\n \nSELECT REGEXP_SUBSTR(\'ABC\' COLLATE utf8_bin,\'b\');\n->\n \nSELECT REGEXP_SUBSTR(BINARY\'ABC\',\'b\');\n->\n \nSELECT REGEXP_SUBSTR(\'ABC\',\'(?i)b\');\n-> B\n \nSELECT REGEXP_SUBSTR(\'ABC\' COLLATE utf8_bin,\'(?+i)b\');\n-> B\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/regexp_substr/','','https://mariadb.com/kb/en/regexp_substr/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (625,37,'REPEAT Function','Syntax\n------ \nREPEAT(str,count)\n \nDescription\n----------- \nReturns a string consisting of the string str repeated count\ntimes. If\ncount is less than 1, returns an empty string. Returns NULL\nif str or\ncount are NULL.\n \nExamples\n-------- \nSELECT QUOTE(REPEAT(\'MariaDB \',4));\n+------------------------------------+\n| QUOTE(REPEAT(\'MariaDB \',4)) |\n+------------------------------------+\n| \'MariaDB MariaDB MariaDB MariaDB \' |\n+------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/repeat-function/','','https://mariadb.com/kb/en/repeat-function/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (626,37,'REPLACE Function','Syntax\n------ \nREPLACE(str,from_str,to_str)\n \nDescription\n----------- \nReturns the string str with all occurrences of the string\nfrom_str\nreplaced by the string to_str. REPLACE() performs a\ncase-sensitive\nmatch when searching for from_str.\n \nExamples\n-------- \nSELECT REPLACE(\'www.mariadb.org\', \'w\', \'Ww\');\n+---------------------------------------+\n| REPLACE(\'www.mariadb.org\', \'w\', \'Ww\') |\n+---------------------------------------+\n| WwWwWw.mariadb.org |\n+---------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/replace-function/','','https://mariadb.com/kb/en/replace-function/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (627,37,'REVERSE','Syntax\n------ \nREVERSE(str)\n \nDescription\n----------- \nReturns the string str with the order of the characters\nreversed.\n \nExamples\n-------- \nSELECT REVERSE(\'desserts\');\n+---------------------+\n| REVERSE(\'desserts\') |\n+---------------------+\n| stressed |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/reverse/','','https://mariadb.com/kb/en/reverse/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (628,37,'RIGHT','Syntax\n------ \nRIGHT(str,len)\n \nDescription\n----------- \nReturns the rightmost len characters from the string str, or\nNULL if\nany argument is NULL.\n \nExamples\n-------- \nSELECT RIGHT(\'MariaDB\', 2);\n+---------------------+\n| RIGHT(\'MariaDB\', 2) |\n+---------------------+\n| DB |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/right/','','https://mariadb.com/kb/en/right/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (629,37,'RPAD','Syntax\n------ \nRPAD(str, len [, padstr])\n \nDescription\n----------- \nReturns the string str, right-padded with the string padstr\nto a\nlength of len characters. If str is longer than len, the\nreturn value\nis shortened to len characters. If padstr is omitted, the\nRPAD function pads spaces.\n \nPrior to MariaDB 10.3.1, the padstr parameter was mandatory.\n \nReturns NULL if given a NULL argument. If the result is\nempty (a length of zero), returns either an empty string,\nor, from MariaDB 10.3.6 with SQL_MODE=Oracle, NULL.\n \nThe Oracle mode version of the function can be accessed\noutside of Oracle mode by using RPAD_ORACLE as the function\nname.\n \nExamples\n-------- \nSELECT RPAD(\'hello\',10,\'.\');\n+----------------------+\n| RPAD(\'hello\',10,\'.\') |\n+----------------------+\n| hello..... |\n+----------------------+\n \nSELECT RPAD(\'hello\',2,\'.\');\n+---------------------+\n| RPAD(\'hello\',2,\'.\') |\n+---------------------+\n| he |\n+---------------------+\n \nFrom MariaDB 10.3.1, with the pad string defaulting to\nspace.\n \nSELECT RPAD(\'hello\',30);\n+--------------------------------+\n| RPAD(\'hello\',30) |\n+--------------------------------+\n| hello |\n+--------------------------------+\n \nOracle mode version from MariaDB 10.3.6:\n \nSELECT RPAD(\'\',0),RPAD_ORACLE(\'\',0);\n+------------+-------------------+\n| RPAD(\'\',0) | RPAD_ORACLE(\'\',0) |\n+------------+-------------------+\n| | NULL |\n+------------+-------------------+\n \n\n\nURL: https://mariadb.com/kb/en/rpad/','','https://mariadb.com/kb/en/rpad/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (630,37,'RTRIM','Syntax\n------ \nRTRIM(str)\n \nDescription\n----------- \nReturns the string str with trailing space characters\nremoved.\n \nReturns NULL if given a NULL argument. If the result is\nempty, returns either an empty string, or, from MariaDB\n10.3.6 with SQL_MODE=Oracle, NULL.\n \nThe Oracle mode version of the function can be accessed\noutside of Oracle mode by using RTRIM_ORACLE as the function\nname.\n \nExamples\n-------- \nSELECT QUOTE(RTRIM(\'MariaDB \'));\n+-----------------------------+\n| QUOTE(RTRIM(\'MariaDB \')) |\n+-----------------------------+\n| \'MariaDB\' |\n+-----------------------------+\n \nOracle mode version from MariaDB 10.3.6:\n \nSELECT RTRIM(\'\'),RTRIM_ORACLE(\'\');\n+-----------+------------------+\n| RTRIM(\'\') | RTRIM_ORACLE(\'\') |\n+-----------+------------------+\n| | NULL |\n+-----------+------------------+\n \n\n\nURL: https://mariadb.com/kb/en/rtrim/','','https://mariadb.com/kb/en/rtrim/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (631,37,'SOUNDEX','Syntax\n------ \nSOUNDEX(str)\n \nDescription\n----------- \nReturns a soundex string from str. Two strings that sound\nalmost the\nsame should have identical soundex strings. A standard\nsoundex string is four\ncharacters long, but the SOUNDEX() function returns an\narbitrarily long\nstring. You can use SUBSTRING() on the result to get a\nstandard soundex\nstring. All non-alphabetic characters in str are ignored.\nAll\ninternational alphabetic characters outside the A-Z range\nare treated as\nvowels.\n \nImportant: When using SOUNDEX(), you should be aware of the\nfollowing limitations:\nThis function, as currently implemented, is intended to work\nwell with\n strings that are in the English language only. Strings in\nother languages may\n not produce reliable results.\n \nExamples\n-------- \nSOUNDEX(\'Hello\');\n+------------------+\n| SOUNDEX(\'Hello\') |\n+------------------+\n| H400 |\n+------------------+\n \nSELECT SOUNDEX(\'MariaDB\');\n+--------------------+\n| SOUNDEX(\'MariaDB\') |\n+--------------------+\n| M631 |\n+--------------------+\n \nSELECT SOUNDEX(\'Knowledgebase\');\n+--------------------------+\n| SOUNDEX(\'Knowledgebase\') |\n+--------------------------+\n| K543212 |\n+--------------------------+\n \nSELECT givenname, surname FROM users WHERE\nSOUNDEX(givenname) = SOUNDEX(\"robert\");\n+-----------+---------+\n| givenname | surname |\n+-----------+---------+\n| Roberto | Castro |\n+-----------+---------+\n \n\n\nURL: https://mariadb.com/kb/en/soundex/','','https://mariadb.com/kb/en/soundex/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (632,37,'SOUNDS LIKE','Syntax\n------ \nexpr1 SOUNDS LIKE expr2\n \nDescription\n----------- \nThis is the same as SOUNDEX(expr1) = SOUNDEX(expr2).\n \nExample\n \nSELECT givenname, surname FROM users WHERE givenname SOUNDS\nLIKE \"robert\";\n \n+-----------+---------+\n| givenname | surname |\n+-----------+---------+\n| Roberto | Castro |\n+-----------+---------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/sounds-like/','','https://mariadb.com/kb/en/sounds-like/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (633,37,'SPACE','Syntax\n------ \nSPACE(N)\n \nDescription\n----------- \nReturns a string consisting of N space characters. If N is\nNULL, returns NULL.\n \nExamples\n-------- \nSELECT QUOTE(SPACE(6));\n+-----------------+\n| QUOTE(SPACE(6)) |\n+-----------------+\n| \' \' |\n+-----------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/space/','','https://mariadb.com/kb/en/space/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (634,37,'STRCMP','Syntax\n------ \nSTRCMP(expr1,expr2)\n \nDescription\n----------- \nSTRCMP() returns 0 if the strings are the same, -1 if the\nfirst\nargument is smaller than the second according to the current\nsort order,\nand 1 otherwise.\n \nExamples\n-------- \nSELECT STRCMP(\'text\', \'text2\');\n+-------------------------+\n| STRCMP(\'text\', \'text2\') |\n+-------------------------+\n| -1 |\n+-------------------------+\n \nSELECT STRCMP(\'text2\', \'text\');\n+-------------------------+\n| STRCMP(\'text2\', \'text\') |\n+-------------------------+\n| 1 |\n+-------------------------+\n \nSELECT STRCMP(\'text\', \'text\');\n+------------------------+\n| STRCMP(\'text\', \'text\') |\n+------------------------+\n| 0 |\n+------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/strcmp/','','https://mariadb.com/kb/en/strcmp/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (635,37,'SUBSTR','Description\n----------- \nSUBSTR() is a synonym for SUBSTRING().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/substr/','','https://mariadb.com/kb/en/substr/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (636,37,'SUBSTRING','Syntax\n------ \nSUBSTRING(str,pos), \nSUBSTRING(str FROM pos), \nSUBSTRING(str,pos,len),\nSUBSTRING(str FROM pos FOR len)\n \nSUBSTR(str,pos), \nSUBSTR(str FROM pos), \nSUBSTR(str,pos,len),\nSUBSTR(str FROM pos FOR len)\n \nDescription\n----------- \nThe forms without a len argument return a substring from\nstring str starting at position pos.\n \nThe forms with a len argument return a substring len\ncharacters long from string str, starting at position pos.\n \nThe forms that use FROM are standard SQL syntax.\n \nIt is also possible to use a negative value for pos. In this\ncase, the beginning of the substring is pos characters from\nthe end of the string, rather than the beginning. A negative\nvalue may be used for pos in any of the forms of this\nfunction.\n \nBy default, the position of the first character in the\nstring from which the substring is to be extracted is\nreckoned as 1. For Oracle-compatibility, from MariaDB\n10.3.3, when sql_mode is set to \'oracle\', position zero is\ntreated as position 1 (although the first character is still\nreckoned as 1).\n \nIf any argument is NULL, returns NULL.\n \nExamples\n-------- \nSELECT SUBSTRING(\'Knowledgebase\',5);\n+------------------------------+\n| SUBSTRING(\'Knowledgebase\',5) |\n+------------------------------+\n| ledgebase |\n+------------------------------+\n \nSELECT SUBSTRING(\'MariaDB\' FROM 6);\n+-----------------------------+\n| SUBSTRING(\'MariaDB\' FROM 6) |\n+-----------------------------+\n| DB |\n+-----------------------------+\n \nSELECT SUBSTRING(\'Knowledgebase\',3,7);\n+--------------------------------+\n| SUBSTRING(\'Knowledgebase\',3,7) |\n+--------------------------------+\n| owledge |\n+--------------------------------+\n \nSELECT SUBSTRING(\'Knowledgebase\', -4);\n+--------------------------------+\n| SUBSTRING(\'Knowledgebase\', -4) |\n+--------------------------------+\n| base |\n+--------------------------------+\n \nSELECT SUBSTRING(\'Knowledgebase\', -8, 4);\n+-----------------------------------+\n| SUBSTRING(\'Knowledgebase\', -8, 4) |\n+-----------------------------------+\n| edge |\n+-----------------------------------+\n \nSELECT SUBSTRING(\'Knowledgebase\' FROM -8 FOR 4);\n+------------------------------------------+\n| SUBSTRING(\'Knowledgebase\' FROM -8 FOR 4) |\n+------------------------------------------+\n| edge |\n+------------------------------------------+\n \nOracle mode from MariaDB 10.3.3:\n \nSELECT SUBSTR(\'abc\',0,3);\n+-------------------+\n| SUBSTR(\'abc\',0,3) |\n+-------------------+\n| |\n+-------------------+\n \nSELECT SUBSTR(\'abc\',1,2);\n+-------------------+\n| SUBSTR(\'abc\',1,2) |\n+-------------------+\n| ab |\n+-------------------+\n \nSET sql_mode=\'oracle\';\n \nSELECT SUBSTR(\'abc\',0,3);\n+-------------------+\n| SUBSTR(\'abc\',0,3) |\n+-------------------+\n| abc |\n+-------------------+\n \nSELECT SUBSTR(\'abc\',1,2);\n+-------------------+\n| SUBSTR(\'abc\',1,2) |\n+-------------------+\n| ab |\n+-------------------+\n \n\n\nURL: https://mariadb.com/kb/en/substring/','','https://mariadb.com/kb/en/substring/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (637,37,'SUBSTRING_INDEX','Syntax\n------ \nSUBSTRING_INDEX(str,delim,count)\n \nDescription\n----------- \nReturns the substring from string str before count\noccurrences of the\ndelimiter delim. If count is positive, everything to the\nleft\nof the final delimiter (counting from the left) is returned.\nIf count\nis negative, everything to the right of the final delimiter\n(counting from the\nright) is returned. SUBSTRING_INDEX() performs a\ncase-sensitive match when\nsearching for delim.\n \nIf any argument is NULL, returns NULL.\n \nExamples\n-------- \nSELECT SUBSTRING_INDEX(\'www.mariadb.org\', \'.\', 2);\n+--------------------------------------------+\n| SUBSTRING_INDEX(\'www.mariadb.org\', \'.\', 2) |\n+--------------------------------------------+\n| www.mariadb |\n+--------------------------------------------+\n \nSELECT SUBSTRING_INDEX(\'www.mariadb.org\', \'.\', -2);\n+---------------------------------------------+\n| SUBSTRING_INDEX(\'www.mariadb.org\', \'.\', -2) |\n+---------------------------------------------+\n| mariadb.org |\n+---------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/substring_index/','','https://mariadb.com/kb/en/substring_index/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (638,37,'TO_BASE64','The TO_BASE64() function was introduced in MariaDB 10.0.5.\n \nSyntax\n------ \nTO_BASE64(str)\n \nDescription\n----------- \nConverts the string argument str to its base-64 encoded\nform, returning the result as a character string in the\nconnection character set and collation.\n \nThe argument str will be converted to string first if it is\nnot a string. A NULL argument will return a NULL result.\n \nThe reverse function, FROM_BASE64(), decodes an encoded\nbase-64 string.\n \nThere are a numerous different methods to base-64 encode a\nstring. The following are used by MariaDB and MySQL:\nAlphabet value 64 is encoded as \'+\'.\nAlphabet value 63 is encoded as \'/\'.\nEncoding output is made up of groups of four printable\ncharacters, with each three bytes of data encoded using four\ncharacters. If the final group is not complete, it is padded\nwith \'=\' characters to make up a length of four.\nTo divide long output, a newline is added after every 76\ncharacters.\nDecoding will recognize and ignore newlines, carriage\nreturns, tabs, and spaces. \n \nExamples\n-------- \nSELECT TO_BASE64(\'Maria\');\n+--------------------+\n| TO_BASE64(\'Maria\') |\n+--------------------+\n| TWFyaWE= |\n+--------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/to_base64/','','https://mariadb.com/kb/en/to_base64/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (639,37,'TRIM','Syntax\n------ \nTRIM([{BOTH | LEADING | TRAILING} [remstr] FROM] str),\nTRIM([remstr FROM] str)\n \nDescription\n----------- \nReturns the string str with all remstr prefixes or suffixes\nremoved. If none of the specifiers BOTH, LEADING, or\nTRAILING is given, BOTH is assumed. remstr is optional and,\nif not specified, spaces are removed.\n \nReturns NULL if given a NULL argument. If the result is\nempty, returns either an empty string, or, from MariaDB\n10.3.6 with SQL_MODE=Oracle, NULL.\n \nThe Oracle mode version of the function can be accessed\noutside of Oracle mode by using TRIM_ORACLE as the function\nname.\n \nExamples\n-------- \nSELECT TRIM(\' bar \')\\G\n*************************** 1. row\n***************************\nTRIM(\' bar \'): bar\n \nSELECT TRIM(LEADING \'x\' FROM \'xxxbarxxx\')\\G\n*************************** 1. row\n***************************\nTRIM(LEADING \'x\' FROM \'xxxbarxxx\'): barxxx\n \nSELECT TRIM(BOTH \'x\' FROM \'xxxbarxxx\')\\G\n*************************** 1. row\n***************************\nTRIM(BOTH \'x\' FROM \'xxxbarxxx\'): bar\n \nSELECT TRIM(TRAILING \'xyz\' FROM \'barxxyz\')\\G\n*************************** 1. row\n***************************\nTRIM(TRAILING \'xyz\' FROM \'barxxyz\'): barx\n \nOracle mode version from MariaDB 10.3.6:\n \nSELECT TRIM(\'\'),TRIM_ORACLE(\'\');\n+----------+-----------------+\n| TRIM(\'\') | TRIM_ORACLE(\'\') |\n+----------+-----------------+\n| | NULL |\n+----------+-----------------+\n \n\n\nURL: https://mariadb.com/kb/en/trim/','','https://mariadb.com/kb/en/trim/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (640,37,'UCASE','Syntax\n------ \nUCASE(str)\n \nDescription\n----------- \nUCASE() is a synonym for UPPER().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/ucase/','','https://mariadb.com/kb/en/ucase/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (641,37,'UNHEX','Syntax\n------ \nUNHEX(str)\n \nDescription\n----------- \nPerforms the inverse operation of HEX(str). That is, it\ninterprets\neach pair of hexadecimal digits in the argument as a number\nand\nconverts it to the character represented by the number. The\nresulting\ncharacters are returned as a binary string.\n \nIf str is NULL, UNHEX() returns NULL.\n \nExamples\n-------- \nSELECT HEX(\'MariaDB\');\n+----------------+\n| HEX(\'MariaDB\') |\n+----------------+\n| 4D617269614442 |\n+----------------+\n \nSELECT UNHEX(\'4D617269614442\');\n+-------------------------+\n| UNHEX(\'4D617269614442\') |\n+-------------------------+\n| MariaDB |\n+-------------------------+\n \nSELECT 0x4D617269614442;\n \n+------------------+\n| 0x4D617269614442 |\n+------------------+\n| MariaDB |\n+------------------+\n \nSELECT UNHEX(HEX(\'string\'));\n+----------------------+\n| UNHEX(HEX(\'string\')) |\n+----------------------+\n| string |\n+----------------------+\n \nSELECT HEX(UNHEX(\'1267\'));\n+--------------------+\n| HEX(UNHEX(\'1267\')) |\n+--------------------+\n| 1267 |\n+--------------------+\n \n\n\nURL: https://mariadb.com/kb/en/unhex/','','https://mariadb.com/kb/en/unhex/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (642,37,'UPDATEXML','Syntax\n------ \nUpdateXML(xml_target, xpath_expr, new_xml)\n \nDescription\n----------- \nThis function replaces a single portion of a given fragment\nof XML markup\nxml_target with a new XML fragment new_xml, and then returns\nthe\nchanged XML. The portion of xml_target that is replaced\nmatches an XPath\nexpression xpath_expr supplied by the user. If no expression\nmatching\nxpath_expr is found, or if multiple matches are found, the\nfunction returns\nthe original xml_target XML fragment. All three arguments\nshould be\nstrings.\n \nExamples\n-------- \nSELECT\n UpdateXML(\'ccc\', \'/a\', \'fff\') AS val1,\n UpdateXML(\'ccc\', \'/b\', \'fff\') AS val2,\n UpdateXML(\'ccc\', \'//b\', \'fff\') AS val3,\n UpdateXML(\'ccc\', \'/a/d\', \'fff\') AS val4,\n UpdateXML(\'ccc\', \'/a/d\', \'fff\') AS val5\n \\G\n*************************** 1. row\n***************************\nval1: fff\nval2: ccc\nval3: fff\nval4: cccfff\nval5: ccc\n1 row in set (0.00 sec)\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/updatexml/','','https://mariadb.com/kb/en/updatexml/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (643,37,'UPPER','Syntax\n------ \nUPPER(str)\n \nDescription\n----------- \nReturns the string str with all characters changed to\nuppercase\naccording to the current character set mapping. The default\nis latin1\n(cp1252 West European).\n \nSELECT UPPER(surname), givenname FROM users ORDER BY\nsurname;\n \n+----------------+------------+\n| UPPER(surname) | givenname |\n+----------------+------------+\n| ABEL | Jacinto |\n| CASTRO | Robert |\n| COSTA | Phestos |\n| MOSCHELLA | Hippolytos |\n+----------------+------------+\n \nUPPER() is ineffective when applied to binary strings\n(BINARY,\nVARBINARY, BLOB). The description of \nLOWER() shows how to\nperform lettercase conversion of binary strings.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/upper/','','https://mariadb.com/kb/en/upper/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (644,37,'WEIGHT_STRING','The WEIGHT_STRING function was introduced in MariaDB 10.0.5.\n \nSyntax\n------ \nWEIGHT_STRING(str [AS {CHAR|BINARY}(N)] [LEVEL levels]\n[flags])\n levels: N [ASC|DESC|REVERSE] [, N [ASC|DESC|REVERSE]] ... \n \nDescription\n----------- \nReturns a binary string representing the string\'s sorting\nand comparison value. A string with a lower result means\nthat for sorting purposes the string appears before a string\nwith a higher result.\n \nWEIGHT_STRING() is particularly useful when adding new\ncollations, for testing purposes.\n \nIf str is a non-binary string (CHAR, VARCHAR or TEXT),\nWEIGHT_STRING returns the string\'s collation weight. If str\nis a binary string (BINARY, VARBINARY or BLOB), the return\nvalue is simply the input value, since the weight for each\nbyte in a binary string is the byte value.\n \nWEIGHT_STRING() returns NULL if given a NULL input. \n \nThe optional AS clause permits casting the input string to a\nbinary or non-binary string, as well as to a particular\nlength.\n \nAS BINARY(N) measures the length in bytes rather than\ncharacters, and right pads with 0x00 bytes to the desired\nlength. \n \nAS CHAR(N) measures the length in characters, and right pads\nwith spaces to the desired length.\n \nN has a minimum value of 1, and if it is less than the\nlength of the input string, the string is truncated without\nwarning.\n \nThe optional LEVEL clause specifies that the return value\nshould contain weights for specific collation levels. The\nlevels specifier can either be a single integer, a\ncomma-separated list of integers, or a range of integers\nseparated by a dash (whitespace is ignored). Integers can\nrange from 1 to a maximum of 6, dependent on the collation,\nand need to be listed in ascending order.\n \nIf the LEVEL clause is no provided, a default of 1 to the\nmaximum for the collation is assumed.\n \nIf the LEVEL is specified without using a range, an optional\nmodifier is permitted.\n \nASC, the default, returns the weights without any\nmodification.\n \nDESC returns bitwise-inverted weights.\n \nREVERSE returns the weights in reverse order.\n \nExamples\n-------- \nThe examples below use the HEX() function to represent\nnon-printable results in hexadecimal format.\n \nSELECT HEX(WEIGHT_STRING(\'x\'));\n+-------------------------+\n| HEX(WEIGHT_STRING(\'x\')) |\n+-------------------------+\n| 0058 |\n+-------------------------+\n \nSELECT HEX(WEIGHT_STRING(\'x\' AS BINARY(4)));\n+--------------------------------------+\n| HEX(WEIGHT_STRING(\'x\' AS BINARY(4))) |\n+--------------------------------------+\n| 78000000 |\n+--------------------------------------+\n \nSELECT HEX(WEIGHT_STRING(\'x\' AS CHAR(4)));\n+------------------------------------+\n| HEX(WEIGHT_STRING(\'x\' AS CHAR(4))) |\n+------------------------------------+\n| 0058002000200020 |\n+------------------------------------+\n \nSELECT HEX(WEIGHT_STRING(0xaa22ee LEVEL 1));\n+--------------------------------------+\n| HEX(WEIGHT_STRING(0xaa22ee LEVEL 1)) |\n+--------------------------------------+\n| AA22EE |\n+--------------------------------------+\n \nSELECT HEX(WEIGHT_STRING(0xaa22ee LEVEL 1 DESC));\n+-------------------------------------------+\n| HEX(WEIGHT_STRING(0xaa22ee LEVEL 1 DESC)) |\n+-------------------------------------------+\n| 55DD11 |\n+-------------------------------------------+\n \nSELECT HEX(WEIGHT_STRING(0xaa22ee LEVEL 1 REVERSE));\n+----------------------------------------------+\n| HEX(WEIGHT_STRING(0xaa22ee LEVEL 1 REVERSE)) |\n+----------------------------------------------+\n| EE22AA |\n+----------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/weight_string/','','https://mariadb.com/kb/en/weight_string/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (645,39,'ALTER DATABASE','Modifies a database, changing its overall characteristics.\n \nSyntax\n------ \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 \nDescription\n----------- \nALTER DATABASE enables you to change the overall\ncharacteristics of a\ndatabase. These characteristics are stored in the db.opt\nfile in the\ndatabase directory. To use ALTER DATABASE, you need the\nALTER\nprivilege on the database. ALTER SCHEMA is a synonym for\nALTER\nDATABASE.\n \nThe CHARACTER SET clause changes the default database\ncharacter set.\nThe COLLATE clause changes the default database collation.\nSee Character Sets and Collations for more.\n \nYou can see what character sets and collations are available\nusing,\nrespectively, the SHOW CHARACTER SET and SHOW COLLATION\nstatements.\n \nChanging the default character set/collation of a database\ndoes not change the character set/collation of any stored\nprocedures or stored functions that were previously created,\nand relied on the defaults. These need to be dropped and\nrecreated in order to apply the character set/collation\nchanges.\n \nThe database name can be omitted from the first syntax, in\nwhich case\nthe statement applies to the default database.\n \nThe syntax that includes the UPGRADE DATA DIRECTORY NAME\nclause was\nadded in MySQL 5.1.23. It updates the name of the directory\nassociated\nwith the database to use the encoding implemented in MySQL\n5.1 for\nmapping database names to database directory names (see\nIdentifier to File Name Mapping). This\nclause is for use under these conditions:\nIt is intended when upgrading MySQL to 5.1 or later from\nolder versions.\nIt is intended to update a database directory name to the\ncurrent encoding format if the name contains special\ncharacters that need encoding.\nThe statement is used by mysqlcheck (as invoked by\nmysql_upgrade).\n \nFor example,if a database in MySQL 5.0 has a name of a-b-c,\nthe name\ncontains instance of the `-\' character. In 5.0, the\ndatabase directory\nis also named a-b-c, which is not necessarily safe for all\nfile\nsystems. In MySQL 5.1 and up, the same database name is\nencoded as\na@002db@002dc to produce a file system-neutral directory\nname.\n \nWhen a MySQL installation is upgraded to MySQL 5.1 or later\nfrom an\nolder version,the server displays a name such as a-b-c\n(which is in\nthe old format) as #mysql50#a-b-c, and you must refer to the\nname\nusing the #mysql50# prefix. Use UPGRADE DATA DIRECTORY NAME\nin this\ncase to explicitly tell the server to re-encode the database\ndirectory\nname to the current encoding format:\n \nALTER DATABASE `#mysql50#a-b-c` UPGRADE DATA DIRECTORY NAME;\n \nAfter executing this statement, you can refer to the\ndatabase as a-b-c\nwithout the special #mysql50# prefix.\n \nExamples\n-------- \nALTER DATABASE test CHARACTER SET = \'utf8\' COLLATE =\n\'utf8_bin\';\n \n\n\nURL: https://mariadb.com/kb/en/alter-database/','','https://mariadb.com/kb/en/alter-database/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (646,39,'ALTER EVENT','Modifies one or more characteristics of an existing event.\n \nSyntax\n------ \nALTER\n [DEFINER = { user | CURRENT_USER }]\n EVENT event_name\n [ON SCHEDULE schedule]\n [ON COMPLETION [NOT] PRESERVE]\n [RENAME TO new_event_name]\n [ENABLE | DISABLE | DISABLE ON SLAVE]\n [COMMENT \'comment\']\n [DO sql_statement]\n \nDescription\n----------- \nThe ALTER EVENT statement is used to change one or more of\nthe\ncharacteristics of an existing event without the need to\ndrop and recreate it.\nThe syntax for each of the DEFINER, ON SCHEDULE, ON\nCOMPLETION,\nCOMMENT, ENABLE / DISABLE, and DO clauses is exactly the\nsame as when used with CREATE EVENT.\n \nThis statement requires the EVENT privilege.\nWhen a user executes a successful ALTER EVENT statement,\nthat user becomes\nthe definer for the affected event.\n \n(In MySQL 5.1.11 and earlier, an event could be altered only\nby its definer, or\nby a user having the SUPER privilege.)\n \nALTER EVENT works only with an existing event:\n \nALTER EVENT no_such_event ON SCHEDULE EVERY \'2:3\'\nDAY_HOUR;\nERROR 1539 (HY000): Unknown event \'no_such_event\'\n \nExamples\n-------- \nALTER EVENT myevent \n ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 2 HOUR \n DO \n UPDATE myschema.mytable SET mycol = mycol + 1;\n \n\n\nURL: https://mariadb.com/kb/en/alter-event/','','https://mariadb.com/kb/en/alter-event/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (647,39,'ALTER FUNCTION','Syntax\n------ \nALTER FUNCTION func_name [characteristic ...]\n \ncharacteristic:\n { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL\nDATA }\n | SQL SECURITY { DEFINER | INVOKER }\n | COMMENT \'string\'\n \nDescription\n----------- \nThis statement can be used to change the characteristics of\na stored\nfunction. More than one change may be specified in an ALTER\nFUNCTION\nstatement. However, you cannot change the parameters or body\nof a\nstored function using this statement; to make such changes,\nyou must\ndrop and re-create the function using DROP FUNCTION and\nCREATE FUNCTION.\n \nYou must have the ALTER ROUTINE privilege for the function.\n(That\nprivilege is granted automatically to the function creator.)\nIf binary\nlogging is enabled, the ALTER FUNCTION statement might also\nrequire\nthe SUPER privilege, as described in Binary Logging of\nStored Routines.\n \nExample\n \nALTER FUNCTION hello SQL SECURITY INVOKER;\n \n\n\nURL: https://mariadb.com/kb/en/alter-function/','','https://mariadb.com/kb/en/alter-function/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (648,39,'ALTER LOGFILE GROUP','Syntax\n------ \nALTER LOGFILE GROUP logfile_group\n ADD UNDOFILE \'file_name\'\n [INITIAL_SIZE [=] size]\n [WAIT]\n ENGINE [=] engine_name\n \nThe ALTER LOGFILE GROUP statement is not supported by\nMariaDB. It was originally inherited from MySQL NDB Cluster.\nSee MDEV-19295 for more information.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/alter-logfile-group/','','https://mariadb.com/kb/en/alter-logfile-group/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (649,39,'ALTER PROCEDURE','Syntax\n------ \nALTER PROCEDURE proc_name [characteristic ...]\n \ncharacteristic:\n { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL\nDATA }\n | SQL SECURITY { DEFINER | INVOKER }\n | COMMENT \'string\'\n \nDescription\n----------- \nThis statement can be used to change the characteristics of\na stored\nprocedure. More than one change may be specified in an ALTER\nPROCEDURE\nstatement. However, you cannot change the parameters or body\nof a\nstored procedure using this statement. To make such changes,\nyou must\ndrop and re-create the procedure using either CREATE OR\nREPLACE PROCEDURE (since MariaDB 10.1.3) or DROP PROCEDURE\nand CREATE PROCEDURE (MariaDB 10.1.2 and before).\n \nYou must have the ALTER ROUTINE privilege for the procedure.\nBy default, that privilege is granted automatically to the\nprocedure creator. See Stored Routine Privileges.\n \nExample\n \nALTER PROCEDURE simpleproc SQL SECURITY INVOKER;\n \n\n\nURL: https://mariadb.com/kb/en/alter-procedure/','','https://mariadb.com/kb/en/alter-procedure/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (650,39,'ALTER SEQUENCE','ALTER SEQUENCE was introduced in MariaDB 10.3.\n \nSyntax\n------ \nALTER SEQUENCE [IF EXISTS] sequence_name\n[ INCREMENT [ BY | = ] increment ]\n[ MINVALUE [=] minvalue | NO MINVALUE | NOMINVALUE ]\n[ MAXVALUE [=] maxvalue | NO MAXVALUE | NOMAXVALUE ]\n[ START [ WITH | = ] start ] [ CACHE [=] cache ] [ [ NO ]\nCYCLE ]\n[ RESTART [[WITH | =] restart]\n \nALTER SEQUENCE allows one to change any values for a\nSEQUENCE created with CREATE SEQUENCE.\n \nThe options for ALTER SEQUENCE can be given in any order.\n \nDescription\n----------- \nALTER SEQUENCE changes the parameters of an existing\nsequence generator. Any parameters not specifically set in\nthe ALTER SEQUENCE command retain their prior settings.\n \nALTER SEQUENCE requires the ALTER privilege.\n \nArguments to ALTER SEQUENCE\n \nThe following options may be used:\n \nOption | Default value | Description | \n \nINCREMENT | 1 | Increment to use for values. May be\nnegative. | \n \nMINVALUE | 1 if INCREMENT > 0 and -9223372036854775807 if\nINCREMENT < 0 | Minimum value for the sequence. | \n \nMAXVALUE | 9223372036854775806 if INCREMENT > 0 and -1 if\nINCREMENT < 0 | Max value for sequence. | \n \nSTART | MINVALUE if INCREMENT > 0 and MAX_VALUE if\nINCREMENT< 0 | First value that the sequence will generate.\n| \n \nCACHE | 1000 | Number of values that should be cached. 0 if\nno CACHE. The underlying table will be updated first time a\nnew sequence number is generated and each time the cache\nruns out. | \n \nCYCLE | 0 (= NO CYCLE) | 1 if the sequence should start\nagain from MINVALUE# after it has run out of values. | \n \nRESTART | START if restart value not is given |  If RESTART\noption is used, NEXT VALUE will return the restart value. | \n \nThe optional clause RESTART [ WITH restart ] sets the next\nvalue for the sequence. This is equivalent to calling the\nSETVAL() function with the is_used argument as 0. The\nspecified value will be returned by the next call of\nnextval. Using RESTART with no restart value is\nequivalent to supplying the start value that was recorded by\nCREATE SEQUENCE or last set by ALTER SEQUENCE START WITH.\n \nALTER SEQUENCE will not allow you to change the sequence so\nthat it\'s inconsistent. For example:\n \nCREATE SEQUENCE s1;\nALTER SEQUENCE s1 MINVALUE 10;\nERROR 4061 (HY000): Sequence \'test.t1\' values are\nconflicting\n \nALTER SEQUENCE s1 MINVALUE 10 RESTART 10;\nERROR 4061 (HY000): Sequence \'test.t1\' values are\nconflicting\n \nALTER SEQUENCE s1 MINVALUE 10 START 10 RESTART 10;\n \nINSERT\n \nTo allow SEQUENCE objects to be backed up by old tools, like\nmysqldump, one can use SELECT to read the current state of a\nSEQUENCE object and use an INSERT to update the SEQUENCE\nobject. INSERT is only allowed if all fields are specified:\n \nCREATE SEQUENCE s1;\nINSERT INTO s1 VALUES(1000,10,2000,1005,1,1000,0,0);\nSELECT * FROM s1;\n \n+------------+-----------+-----------+-------+-----------+-------+-------+-------+\n| next_value | min_value | max_value | start | increment |\ncache | cycle | round |\n+------------+-----------+-----------+-------+-----------+-------+-------+-------+\n| 1000 | 10 | 2000 | 1005 | 1 | 1000 | 0 | 0 |\n+------------+-----------+-----------+-------+-----------+-------+-------+-------+\n \nSHOW CREATE SEQUENCE s1;\n+-------+--------------------------------------------------------------------------------------------------------------+\n| Table | Create Table |\n+-------+--------------------------------------------------------------------------------------------------------------+\n| s1 | CREATE SEQUENCE `s1` start with 1005 minvalue 10\nmaxvalue 2000 increment by 1 cache 1000 nocycle ENGINE=Aria\n|\n+-------+--------------------------------------------------------------------------------------------------------------+\n \nNotes\n \nALTER SEQUENCE will instantly affect all future SEQUENCE\noperations. This is in contrast to some other databases\nwhere the changes requested by ALTER SEQUENCE will not be\nseen until the sequence cache has run out.\n \nALTER SEQUENCE will take a full table lock of the sequence\nobject during\nits (brief) operation. This ensures that ALTER SEQUENCE is\nreplicated\ncorrectly. If you only want to set the next sequence value\nto a\nhigher value than current, then you should use SETVAL()\ninstead, as this is not blocking.\n \nIf you want to change storage engine, sequence comment or\nrename the sequence, you can use ALTER TABLE for this.\n \n\n\nURL: https://mariadb.com/kb/en/alter-sequence/','','https://mariadb.com/kb/en/alter-sequence/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (651,39,'ALTER SERVER','Syntax\n------ \nALTER SERVER server_name\n OPTIONS (option [, option] ...)\n \nDescription\n----------- \nAlters the server information for server_name, adjusting the\nspecified\noptions as per the CREATE SERVER command. The corresponding\nfields in the mysql.servers table are updated accordingly.\nThis statement requires the SUPER privilege.\n \nExamples\n-------- \nALTER SERVER s OPTIONS (USER \'sally\');\n \n\n\nURL: https://mariadb.com/kb/en/alter-server/','','https://mariadb.com/kb/en/alter-server/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (652,39,'ALTER TABLE','Syntax\n------ \nALTER [ONLINE] [IGNORE] TABLE tbl_name\n [WAIT n | NOWAIT]\n alter_specification [, alter_specification] ...\n \nalter_specification:\n table_option ...\n | ADD [COLUMN] [IF NOT EXISTS] col_name column_definition\n [FIRST | AFTER col_name ]\n | ADD [COLUMN] [IF NOT EXISTS] (col_name\ncolumn_definition,...)\n | ADD {INDEX|KEY} [IF NOT EXISTS] [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 [IF NOT EXISTS] [index_name]\n(index_col_name,...)\n reference_definition\n | ADD PERIOD FOR SYSTEM_TIME (start_column_name,\nend_column_name)\n | ALTER [COLUMN] col_name SET DEFAULT literal\n| (expression)\n | ALTER [COLUMN] col_name DROP DEFAULT\n | CHANGE [COLUMN] [IF EXISTS] old_col_name new_col_name\ncolumn_definition\n [FIRST|AFTER col_name]\n | MODIFY [COLUMN] [IF EXISTS] col_name column_definition\n [FIRST | AFTER col_name]\n | DROP [COLUMN] [IF EXISTS] col_name [RESTRICT|CASCADE]\n | DROP PRIMARY KEY\n | DROP {INDEX|KEY} [IF EXISTS] index_name\n | DROP FOREIGN KEY [IF EXISTS] fk_symbol\n | DROP CONSTRAINT [IF EXISTS] constraint_name\n | DISABLE KEYS\n | ENABLE KEYS\n | RENAME [TO] new_tbl_name\n | ORDER BY col_name [, col_name] ...\n | CONVERT TO CHARACTER SET charset_name [COLLATE\ncollation_name]\n | [DEFAULT] CHARACTER SET [=] charset_name\n | [DEFAULT] COLLATE [=] collation_name\n | DISCARD TABLESPACE\n | IMPORT TABLESPACE\n | ALGORITHM [=] {DEFAULT|INPLACE|COPY|NOCOPY|INSTANT}\n | LOCK [=] {DEFAULT|NONE|SHARED|EXCLUSIVE}\n | FORCE\n | partition_options\n | ADD PARTITION (partition_definition)\n | DROP PARTITION partition_names\n | COALESCE PARTITION number\n | REORGANIZE PARTITION [partition_names INTO\n(partition_definitions)]\n | ANALYZE PARTITION partition_names\n | CHECK PARTITION partition_names\n | OPTIMIZE PARTITION partition_names\n | REBUILD PARTITION partition_names\n | REPAIR PARTITION partition_names\n | EXCHANGE PARTITION partition_name WITH TABLE tbl_name\n | REMOVE PARTITIONING\n | ADD SYSTEM VERSIONING\n | DROP SYSTEM VERSIONING\n \nindex_col_name:\n col_name [(length)] [ASC | DESC]\n \nindex_type:\n USING {BTREE | HASH | RTREE}\n \nindex_option:\n KEY_BLOCK_SIZE [=] value\n | index_type\n | WITH PARSER parser_name\n | COMMENT \'string\'\n | CLUSTERING={YES| NO}\n \ntable_options:\n table_option [[,] table_option] ...\nIn MariaDB 10.0.2 and later, IF EXISTS and IF NOT EXISTS\nclauses have been added for the following:\n \nADD COLUMN [IF NOT EXISTS]\nADD INDEX [IF NOT EXISTS]\nADD FOREIGN KEY [IF NOT EXISTS]\nADD PARTITION [IF NOT EXISTS]\nCREATE INDEX [IF NOT EXISTS]\n \nDROP COLUMN [IF EXISTS]\nDROP INDEX [IF EXISTS]\nDROP FOREIGN KEY [IF EXISTS]\nDROP PARTITION [IF EXISTS]\nCHANGE COLUMN [IF EXISTS]\nMODIFY COLUMN [IF EXISTS]\nDROP INDEX [IF EXISTS]\nWhen IF EXISTS and IF NOT EXISTS are used in clauses,\nqueries will not\nreport errors when the condition is triggered for that\nclause. A warning with\nthe same message text will be issued and the ALTER will move\non to the next\nclause in the statement (or end if finished).\n \nThis was done in MDEV-318.\n \nDescription\n----------- \nALTER TABLE enables you to change the structure of an\nexisting table.\nFor example, you can add or delete columns, create or\ndestroy indexes,\nchange the type of existing columns, or rename columns or\nthe table\nitself. You can also change the comment for the table and\nthe storage engine of the\ntable.\n \nIf another connection is using the table, a metadata lock is\nactive, and this statement will wait until the lock is\nreleased. This is also true for non-transactional tables.\n \nWhen adding a UNIQUE index on a column (or a set of columns)\nwhich have duplicated values, an error will be produced and\nthe statement will be stopped. To suppress the error and\nforce the creation of UNIQUE indexes, discarding duplicates,\nthe IGNORE option can be specified. This can be useful if a\ncolumn (or a set of columns) should be UNIQUE but it\ncontains duplicate values; however, this technique provides\nno control on which rows are preserved and which are\ndeleted. Also, note that IGNORE is accepted but ignored in\nALTER TABLE ... EXCHANGE PARTITION statements.\n \nThis statement can also be used to rename a table. For\ndetails see RENAME TABLE.\n \nWhen an index is created, the storage engine may use a\nconfigurable buffer in the process. Incrementing the buffer\nspeeds up the index creation. Aria and MyISAM allocate a\nbuffer whose size is defined by aria_sort_buffer_size or\nmyisam_sort_buffer_size, also used for REPAIR TABLE.\nInnoDB/XtraDB allocates three buffers whose size is defined\nby innodb_sort_buffer_size.\n \nPrivileges\n \nExecuting the ALTER TABLE statement generally requires at\nleast the ALTER privilege for the table or the database..\n \nIf you are renaming a table, then it also requires the DROP,\nCREATE and INSERT privileges for the table or the database\nas well.\n \nOnline DDL\n \nIn MariaDB 10.0 and later, online DDL is supported with the\nALGORITHM and LOCK clauses.\n \nSee InnoDB Online DDL Overview for more information on\nonline DDL with InnoDB.\n \nALTER ONLINE TABLE\n \nALTER ONLINE TABLE has also worked for partitioned tables\nsince MariaDB 10.0.11.\n \nOnline ALTER TABLE is available by executing the following:\n \nALTER ONLINE TABLE ...;\n \nThis statement has the following semantics:\n \nIn MariaDB 10.0.12 and later, this statement is equivalent\nto the following:\n \nALTER TABLE ... LOCK=NONE;\n \nSee the LOCK alter specification for more information.\n \nIn MariaDB 10.0.11, this statement is equivalent to the\nfollowing:\n \nALTER TABLE ... ALGORITHM=INPLACE;\n \nSee the ALGORITHM alter specification for more information.\n \nMariaDB until 10.0.10\n \nIn MariaDB 10.0.10 and before, this statement ensures that\nthe ALTER TABLE statement does not make a copy of the table.\n \nWAIT/NOWAIT\n \nSet the lock wait timeout. See WAIT and NOWAIT.\n \nColumn Definitions\n \nSee CREATE TABLE: Column Definitions for information about\ncolumn definitions.\n \nIndex Definitions\n \nSee CREATE TABLE: Index Definitions for information about\nindex definitions.\n \nThe CREATE INDEX and DROP INDEX statements can also be used\nto add or remove an index.\n \nCharacter Sets and Collations\n \nCONVERT TO CHARACTER SET charset_name [COLLATE\ncollation_name]\n[DEFAULT] CHARACTER SET [=] charset_name\n[DEFAULT] COLLATE [=] collation_name\nSee Setting Character Sets and Collations for details on\nsetting the character sets and collations.\n \nAlter Specifications\n \nTable Options\n \nSee CREATE TABLE: Table Options for information about table\noptions.\n \nADD COLUMN\n \n... ADD COLUMN [IF NOT EXISTS] (col_name\ncolumn_definition,...)\nAdds a column to the table. The syntax is the same as in\nCREATE TABLE.\nIf you are using IF NOT_EXISTS the column will not be added\nif it was not there already. This is very useful when doing\nscripts to modify tables.\n \nThe FIRST and AFTER clauses affect the physical order of\ncolumns in the datafile. Use FIRST to add a column in the\nfirst (leftmost) position, or AFTER followed by a column\nname to add the new column in any other position. Note that,\nnowadays, the physical position of a column is usually\nirrelevant.\n \nSee also Instant ADD COLUMN for InnoDB.\n \nDROP COLUMN\n \n... DROP COLUMN [IF EXISTS] col_name [CASCADE|RESTRICT]\nDrops the column from the table.\nIf you are using IF EXISTS you will not get an error if the\ncolumn didn\'t exist.\nIf the column is part of any index, the column will be\ndropped from them, except if you add a new column with\nidentical name at the same time. The index will be dropped\nif all columns from the index were dropped.\nIf the column was used in a view or trigger, you will get an\nerror next time the view or trigger is accessed.\n \nDropping a column that is part of a multi-column UNIQUE\nconstraint is not permitted. For example:\n \nCREATE TABLE a (\n a int,\n b int,\n primary key (a,b)\n);\n \nALTER TABLE x DROP COLUMN a;\n[42000][1072] Key column \'A\' doesn\'t exist in table\n \nThe reason is that dropping column a would result in the new\nconstraint that all values in column b be unique. In order\nto drop the column, an explicit DROP PRIMARY KEY and ADD\nPRIMARY KEY would be required. Up until MariaDB 10.2.7, the\ncolumn was dropped and the additional constraint applied,\nresulting in the following structure:\n \nALTER TABLE x DROP COLUMN a;\nQuery OK, 0 rows affected (0.46 sec)\n \nDESC x;\n+-------+---------+------+-----+---------+-------+\n| Field | Type | Null | Key | Default | Extra |\n+-------+---------+------+-----+---------+-------+\n| b | int(11) | NO | PRI | NULL | |\n+-------+---------+------+-----+---------+-------+\n \nMariaDB 10.4.0 supports instant DROP COLUMN. DROP COLUMN of\nan indexed column would imply DROP INDEX (and in the case of\na non-UNIQUE multi-column index, possibly ADD INDEX). These\nwill not be allowed with ALGORITHM=INSTANT, but unlike\nbefore, they can be allowed with ALGORITHM=NOCOPY\n \nRESTRICT and CASCADE are allowed to make porting from other\ndatabase systems easier. In MariaDB, they do nothing.\n \nMODIFY COLUMN\n \nAllows you to modify the type of a column. The column will\nbe at the same place as the original column and all indexes\non the column will be kept. Note that when modifying column,\nyou should specify all attributes for the new column.\n \nCREATE TABLE t1 (a INT UNSIGNED AUTO_INCREMENT, PRIMARY\nKEY((a));\nALTER TABLE t1 MODIFY a BIGINT UNSIGNED AUTO_INCREMENT;\n \nCHANGE COLUMN\n \nWorks like MODIFY COLUMN except that you can also change the\nname of the column. The column will be at the same place as\nthe original column and all index on the column will be\nkept.\n \nCREATE TABLE t1 (a INT UNSIGNED AUTO_INCREMENT, PRIMARY\nKEY(a));\nALTER TABLE t1 CHANGE a b BIGINT UNSIGNED AUTO_INCREMENT;\n \nALTER COLUMN\n \nThis lets you change column options.\n \nCREATE TABLE t1 (a INT UNSIGNED AUTO_INCREMENT, b\nvarchar(50), PRIMARY KEY(a));\nALTER TABLE t1 ALTER b SET DEFAULT \'hello\';\n \nADD PRIMARY KEY\n \nAdd a primary key.\n \nFor PRIMARY KEY indexes, you can specify a name for the\nindex, but it is silently ignored, and the name of the index\nis always PRIMARY.\n \nSee Getting Started with Indexes: Primary Key for more\ninformation.\n \nDROP PRIMARY KEY\n \nDrop a primary key.\n \nFor PRIMARY KEY indexes, you can specify a name for the\nindex, but it is silently ignored, and the name of the index\nis always PRIMARY.\n \nSee Getting Started with Indexes: Primary Key for more\ninformation.\n \nADD FOREIGN KEY\n \nAdd a foreign key.\n \nFor FOREIGN KEY indexes, a reference definition must be\nprovided.\n \nFor FOREIGN KEY indexes, you can specify a name for the\nconstraint, using the CONSTRAINT keyword. That name will be\nused in error messages.\n \nFirst, you have to specify the name of the target (parent)\ntable and a column or a column list which must be indexed\nand whose values must match to the foreign key\'s values.\nThe MATCH clause is accepted to improve the compatibility\nwith other DBMS\'s, but has no meaning in MariaDB. The ON\nDELETE and ON UPDATE clauses specify what must be done when\na DELETE (or a REPLACE) statements attempts to delete a\nreferenced row from the parent table, and when an UPDATE\nstatement attempts to modify the referenced foreign key\ncolumns in a parent table row, respectively. The following\noptions are allowed:\nRESTRICT: The delete/update operation is not performed. The\nstatement terminates with a 1451 error (SQLSTATE \'2300\').\nNO ACTION: Synonym for RESTRICT.\nCASCADE: The delete/update operation is performed in both\ntables.\nSET NULL: The update or delete goes ahead in the parent\ntable, and the corresponding foreign key fields in the child\ntable are set to NULL. (They must not be defined as NOT NULL\nfor this to succeed).\n \nMariaDB until 5.3\nSET DEFAULT: This option is currently implemented only for\nthe PBXT storage engine, which is disabled by default and no\nlonger maintained. It sets the child table\'s foreign key\nfields to their DEFAULT values when the referenced parent\ntable key entries are updated or deleted.\n \nIf either clause is omitted, the default behavior for the\nomitted clause is RESTRICT.\n \nSee Foreign Keys for more information.\n \nDROP FOREIGN KEY\n \nDrop a foreign key.\n \nSee Foreign Keys for more information.\n \nADD INDEX\n \nAdd a plain index.\n \nPlain indexes are regular indexes that are not unique, and\nare not acting as a primary key or a foreign key. They are\nalso not the \"specialized\" FULLTEXT or SPATIAL indexes.\n \nSee Getting Started with Indexes: Plain Indexes for more\ninformation.\n \nDROP INDEX\n \nDrop a plain index.\n \nPlain indexes are regular indexes that are not unique, and\nare not acting as a primary key or a foreign key. They are\nalso not the \"specialized\" FULLTEXT or SPATIAL indexes.\n \nSee Getting Started with Indexes: Plain Indexes for more\ninformation.\n \nADD UNIQUE INDEX\n \nAdd a unique index.\n \nThe UNIQUE keyword means that the index will not accept\nduplicated values, except for NULLs. An error will raise if\nyou try to insert duplicate values in a UNIQUE index.\n \nFor UNIQUE indexes, you can specify a name for the\nconstraint, using the CONSTRAINT keyword. That name will be\nused in error messages.\n \nSee Getting Started with Indexes: Unique Index for more\ninformation.\n \nDROP UNIQUE INDEX\n \nDrop a unique index.\n \nThe UNIQUE keyword means that the index will not accept\nduplicated values, except for NULLs. An error will raise if\nyou try to insert duplicate values in a UNIQUE index.\n \nFor UNIQUE indexes, you can specify a name for the\nconstraint, using the CONSTRAINT keyword. That name will be\nused in error messages.\n \nSee Getting Started with Indexes: Unique Index for more\ninformation.\n \nADD FULLTEXT INDEX\n \nAdd a FULLTEXT index.\n \nSee Full-Text Indexes for more information.\n \nDROP FULLTEXT INDEX\n \nDrop a FULLTEXT index.\n \nSee Full-Text Indexes for more information.\n \nADD SPATIAL INDEX\n \nAdd a SPATIAL index.\n \nSee SPATIAL INDEX for more information.\n \nDROP SPATIAL INDEX\n \nDrop a SPATIAL index.\n \nSee SPATIAL INDEX for more information.\n \nENABLE/ DISABLE KEYS\n \nDISABLE KEYS will disable all non unique keys for the table\nfor storage engines that support this (at least MyISAM and\nAria). This can be used to speed up inserts into empty\ntables.\n \nENABLE KEYS will enable all disabled keys.\n \nRENAME TO\n \nRenames the table. See also RENAME TABLE.\n \nADD CONSTRAINT\n \nModifies the table adding a constraint on a particular\ncolumn or columns.\n \nMariaDB 10.2.1 introduced new ways to define a constraint.\n \nNote: Before MariaDB 10.2.1, constraint expressions were\naccepted in syntax, but ignored.\n \nALTER TABLE table_name \nADD CONSTRAINT [constraint_name] CHECK(expression);\nBefore a row is inserted or updated, all constraints are\nevaluated in the order they are defined. If any constraint\nfails, then the row will not be updated. One can use most\ndeterministic functions in a constraint, including UDF\'s.\n \nCREATE TABLE account_ledger (\n id INT PRIMARY KEY AUTO_INCREMENT,\n transaction_name VARCHAR(100),\n credit_account VARCHAR(100),\n credit_amount INT,\n debit_account VARCHAR(100),\n debit_amount INT);\n \nALTER TABLE account_ledger \nADD CONSTRAINT is_balanced \n CHECK((debit_amount + credit_amount) = 0);\n \nThe constraint_name is optional. If you don\'t provide one\nin the ALTER TABLE statement, MariaDB auto-generates a name\nfor you. This is done so that you can remove it later using\nDROP CONSTRAINT clause.\n \nYou can disable all constraint expression checks by setting\nthe variable check_constraint_checks to OFF. You may find\nthis useful when loading a table that violates some\nconstraints that you want to later find and fix in SQL.\n \nTo view constraints on a table, query\ninformation_schema.TABLE_CONSTRAINTS:\n \nSELECT CONSTRAINT_NAME, TABLE_NAME, CONSTRAINT_TYPE \nFROM information_schema.TABLE_CONSTRAINTS\nWHERE TABLE_NAME = \'account_ledger\';\n \n+-----------------+----------------+-----------------+\n| CONSTRAINT_NAME | TABLE_NAME | CONSTRAINT_TYPE |\n+-----------------+----------------+-----------------+\n| is_balanced | account_ledger | CHECK |\n+-----------------+----------------+-----------------+\n \nDROP CONSTRAINT\n \nDROP CONSTRAINT for UNIQUE and FOREIGN KEY constraints was\nintroduced in MariaDB 10.2.22 and MariaDB 10.3.13.\n \nDROP CONSTRAINT for CHECK constraints was introduced in\nMariaDB 10.2.1\n \nModifies the table, removing the given constraint.\n \nALTER TABLE table_name\nDROP CONSTRAINT constraint_name;\n \nWhen you add a constraint to a table, whether through a\nCREATE TABLE or ALTER TABLE...ADD CONSTRAINT statement, you\ncan either set a constraint_name yourself, or allow MariaDB\nto auto-generate one for you. To view constraints on a\ntable, query information_schema.TABLE_CONSTRAINTS. For\ninstance,\n \nCREATE TABLE t (\n a INT,\n b INT,\n c INT,\n CONSTRAINT CHECK(a > b),\n CONSTRAINT check_equals CHECK(a = c)); \n \nSELECT CONSTRAINT_NAME, TABLE_NAME, CONSTRAINT_TYPE \nFROM information_schema.TABLE_CONSTRAINTS\nWHERE TABLE_NAME = \'t\';\n \n+-----------------+----------------+-----------------+\n| CONSTRAINT_NAME | TABLE_NAME | CONSTRAINT_TYPE |\n+-----------------+----------------+-----------------+\n| check_equals | t | CHECK |\n| CONSTRAINT_1 | t | CHECK |\n+-----------------+----------------+-----------------+\n \nTo remove a constraint from the table, issue an ALTER\nTABLE...DROP CONSTRAINT statement. For example,\n \nALTER TABLE t DROP CONSTRAINT is_unique;\n \nADD SYSTEM VERSIONING\n \nSystem-versioned tables was added in MariaDB 10.3.4.\n \nAdd system versioning.\n \nDROP SYSTEM VERSIONING\n \nSystem-versioned tables was added in MariaDB 10.3.4.\n \nDrop system versioning.\n \nADD PERIOD FOR SYSTEM_TIME\n \nSystem-versioned tables was added in MariaDB 10.3.4.\n \nFORCE\n \nALTER TABLE ... FORCE can force MariaDB to re-build the\ntable.\n \nIn MariaDB 5.5 and before, this could only be done by\nsetting the ENGINE table option to its old value. For\nexample, for an InnoDB table, one could execute the\nfollowing:\n \nALTER TABLE tab_name ENGINE = InnoDB;\n \nIn MariaDB 10.0 and later, the FORCE option can be used\ninstead. For example, :\n \nALTER TABLE tab_name FORCE;\n \nWith InnoDB, the table rebuild will only reclaim unused\nspace (i.e. the space previously used for deleted rows) if\nthe innodb_file_per_table system variable is set to ON. If\nthe system variable is OFF, then the space will not be\nreclaimed, but it will be-re-used for new data that\'s later\nadded.\n \nEXCHANGE PARTITION\n \nALTER TABLE ... EXCHANGE PARTITION was introduced in MariaDB\n10.0.4\n \nThis is used to exchange the tablespace files between a\npartition and another table.\n \nSee copying InnoDB\'s transportable tablespaces for more\ninformation.\n \nDISCARD TABLESPACE\n \nThis is used to discard an InnoDB table\'s tablespace.\n \nSee copying I','','https://mariadb.com/kb/en/alter-table/');
-update help_topic set description = CONCAT(description, 'nnoDB\'s transportable tablespaces for more\ninformation.\n \nIMPORT TABLESPACE\n \nThis is used to import an InnoDB table\'s tablespace. The\ntablespace should have been copied from its original server\nafter executing FLUSH TABLES FOR EXPORT.\n \nSee copying InnoDB\'s transportable tablespaces for more\ninformation.\n \nALTER TABLE ... IMPORT only applies to InnoDB tables. Most\nother popular storage engines, such as Aria and MyISAM, will\nrecognize their data files as soon as they\'ve been placed\nin the proper directory under the datadir, and no special\nDDL is required to import them.\n \nALGORITHM\n \nIn MariaDB 5.5 and before, ALTER TABLE operations required\nmaking a temporary copy of the table, which can be slow for\nlarge tables.\n \nIn MariaDB 10.0 and later, the ALTER TABLE statement\nsupports the ALGORITHM clause. This clause is one of the\nclauses that is used to implement online DDL. ALTER TABLE\nsupports several different algorithms. An algorithm can be\nexplicitly chosen for an ALTER TABLE operation by setting\nthe ALGORITHM clause. The supported values are:\nALGORITHM=DEFAULT - This implies the default behavior for\nthe specific statement, such as if no ALGORITHM clause is\nspecified.\nALGORITHM=COPY\nALGORITHM=INPLACE\nALGORITHM=NOCOPY - This was added in MariaDB 10.3.7.\nALGORITHM=INSTANT - This was added in MariaDB 10.3.7.\n \nSee InnoDB Online DDL Overview: ALGORITHM for information on\nhow the ALGORITHM clause affects InnoDB.\n \nALGORITHM=DEFAULT\n \nThe default behavior, which occurs if ALGORITHM=DEFAULT is\nspecified, or if ALGORITHM is not specified at all, usually\nonly makes a copy if the operation doesn\'t support being\ndone in-place at all. In this case, the most efficient\navailable algorithm will usually be used.\n \nHowever, in MariaDB 10.3.6 and before, if the value of the\nold_alter_table system variable is set to ON, then the\ndefault behavior is to perform ALTER TABLE operations by\nmaking a copy of the table using the old algorithm.\n \nIn MariaDB 10.3.7 and later, the old_alter_table system\nvariable is deprecated. Instead, the alter_algorithm system\nvariable defines the default algorithm for ALTER TABLE\noperations.\n \nALGORITHM=COPY\n \nALGORITHM=COPY was introduced in MariaDB 10.0 as the name\nfor the original ALTER TABLE algorithm.\n \nWhen ALGORITHM=COPY is set, MariaDB essentially does the\nfollowing operations:\n \n-- Create a temporary table with the new definition\nCREATE TEMPORARY TABLE tmp_tab (\n...\n);\n \n-- Copy the data from the original table\nINSERT INTO tmp_tab\n SELECT * FROM original_tab;\n \n-- Drop the original table\nDROP TABLE original_tab;\n \n-- Rename the temporary table, so that it replaces the\noriginal one\nRENAME TABLE tmp_tab TO original_tab;\n \nThis algorithm is very inefficient, but it is generic, so it\nworks for all storage engines.\n \nIf ALGORITHM=COPY is specified, then the copy algorithm will\nbe used even if it is not necessary. This can result in a\nlengthy table copy. If multiple ALTER TABLE operations are\nrequired that each require the table to be rebuilt, then it\nis best to specify all operations in a single ALTER TABLE\nstatement, so that the table is only rebuilt once.\n \nALGORITHM=INPLACE\n \nALGORITHM=INPLACE was introduced in MariaDB 10.0.\n \nALGORITHM=COPY can be incredibly slow, because the whole\ntable has to be copied and rebuilt. ALGORITHM=INPLACE was\nintroduced as a way to avoid this by performing operations\nin-place and avoiding the table copy and rebuild, when\npossible.\n \nWhen ALGORITHM=INPLACE is set, the underlying storage engine\nuses optimizations to perform the operation while avoiding\nthe table copy and rebuild. However, INPLACE is a bit of a\nmisnomer, since some operations may still require the table\nto be rebuilt for some storage engines. Regardless, several\noperations can be performed without a full copy of the table\nfor some storage engines.\n \nA more accurate name would have been ALGORITHM=ENGINE, where\nENGINE refers to an \"engine-specific\" algorithm.\n \nIf an ALTER TABLE operation supports ALGORITHM=INPLACE, then\nit can be performed using optimizations by the underlying\nstorage engine, but it may rebuilt.\n \nSee InnoDB Online DDL Operations with ALGORITHM=INPLACE for\nmore.\n \nALGORITHM=NOCOPY\n \nALGORITHM=NOCOPY was introduced in MariaDB 10.3.7.\n \nALGORITHM=INPLACE can sometimes be surprisingly slow in\ninstances where it has to rebuild the clustered index,\nbecause when the clustered index has to be rebuilt, the\nwhole table has to be rebuilt. ALGORITHM=NOCOPY was\nintroduced as a way to avoid this. \n \nIf an ALTER TABLE operation supports ALGORITHM=NOCOPY, then\nit can be performed without rebuilding the clustered index.\n \nIf ALGORITHM=NOCOPY is specified for an ALTER TABLE\noperation that does not support ALGORITHM=NOCOPY, then an\nerror will be raised. In this case, raising an error is\npreferable, if the alternative is for the operation to\nrebuild the clustered index, and perform unexpectedly\nslowly.\n \nSee InnoDB Online DDL Operations with ALGORITHM=NOCOPY for\nmore.\n \nALGORITHM=INSTANT\n \nALGORITHM=INSTANT was introduced in MariaDB 10.3.7.\n \nALGORITHM=INPLACE can sometimes be surprisingly slow in\ninstances where it has to modify data files.\nALGORITHM=INSTANT was introduced as a way to avoid this.\n \nIf an ALTER TABLE operation supports ALGORITHM=INSTANT, then\nit can be performed without modifying any data files.\n \nIf ALGORITHM=INSTANT is specified for an ALTER TABLE\noperation that does not support ALGORITHM=INSTANT, then an\nerror will be raised. In this case, raising an error is\npreferable, if the alternative is for the operation to\nmodify data files, and perform unexpectedly slowly.\n \nSee InnoDB Online DDL Operations with ALGORITHM=INSTANT for\nmore.\n \nLOCK\n \nIn MariaDB 10.0 and later, the ALTER TABLE statement\nsupports the LOCK clause. This clause is one of the clauses\nthat is used to implement online DDL. ALTER TABLE supports\nseveral different locking strategies. A locking strategy can\nbe explicitly chosen for an ALTER TABLE operation by setting\nthe LOCK clause. The supported values are:\nDEFAULT: Acquire the least restrictive lock on the table\nthat is supported for the specific operation. Permit the\nmaximum amount of concurrency that is supported for the\nspecific operation.\nNONE: Acquire no lock on the table. Permit all concurrent\nDML. If this locking strategy is not permitted for an\noperation, then an error is raised.\nSHARED: Acquire a read lock on the table. Permit read-only\nconcurrent DML. If this locking strategy is not permitted\nfor an operation, then an error is raised.\nEXCLUSIVE: Acquire a write lock on the table. Do not permit\nconcurrent DML.\n \nDifferent storage engines support different locking\nstrategies for different operations. If a specific locking\nstrategy is chosen for an ALTER TABLE operation, and that\ntable\'s storage engine does not support that locking\nstrategy for that specific operation, then an error will be\nraised.\n \nIf the LOCK clause is not explicitly set, then the operation\nuses LOCK=DEFAULT.\n \nALTER ONLINE TABLE is equivalent to LOCK=NONE. Therefore,\nthe ALTER ONLINE TABLE statement can be used to ensure that\nyour ALTER TABLE operation allows all concurrent DML.\n \nSee InnoDB Online DDL Overview: LOCK for information on how\nthe LOCK clause affects InnoDB.\n \nProgress Reporting\n \nMariaDB provides progress reporting for ALTER TABLE\nstatement for clients\nthat support the new progress reporting protocol. For\nexample, if you were using the mysql client, then the\nprogress report might look like this::\n \nALTER TABLE test ENGINE=Aria;\nStage: 1 of 2 \'copy to tmp table\' 46% of stage\n \nThe progress report is also shown in the output of the SHOW\nPROCESSLIST statement and in the contents of the\ninformation_schema.PROCESSLIST table.\n \nSee Progress Reporting for more information.\n \nAborting ALTER TABLE Operations\n \nIf an ALTER TABLE operation is being performed and the\nconnection is killed, the changes will be rolled back in a\ncontrolled manner. The rollback can be a slow operation as\nthe time it takes is relative to how far the operation has\nprogressed.\n \nAborting ALTER TABLE ... ALGORITHM=COPY was made faster by\nremoving excessive undo logging (MDEV-11415). This\nsignificantly shortens the time it takes to abort a running\nALTER TABLE operation.\n \nExamples\n-------- \nAdding a new column:\n \nALTER TABLE t1 ADD x INT;\n \nDropping a column:\n \nALTER TABLE t1 DROP x;\n \nModifying the type of a column:\n \nALTER TABLE t1 MODIFY x bigint unsigned;\n \nChanging the name and type of a column:\n \nALTER TABLE t1 CHANGE a b bigint unsigned auto_increment;\n \nCombining multiple clauses in a single ALTER TABLE\nstatement, separated by commas:\n \nALTER TABLE t1 DROP x, ADD x2 INT, CHANGE y y2 INT;\n \nChanging the storage engine:\n \nALTER TABLE t1 ENGINE = InnoDB;\n \nRebuilding the table (the previous example will also rebuild\nthe table if it was already InnoDB):\n \nALTER TABLE t1 FORCE;\n \n\n\nURL: https://mariadb.com/kb/en/alter-table/') WHERE help_topic_id = 652;
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (653,39,'ALTER TABLESPACE','The ALTER TABLESPACE statement is not supported by MariaDB.\nIt was originally inherited from MySQL NDB Cluster. In MySQL\n5.7 and later, the statement is also supported for InnoDB.\nHowever, MariaDB has chosen not to include that specific\nfeature. See MDEV-19294 for more information.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/alter-tablespace/','','https://mariadb.com/kb/en/alter-tablespace/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (654,39,'ALTER VIEW','Syntax\n------ \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 \nDescription\n----------- \nThis statement changes the definition of a view, which must\nexist. The\nsyntax is similar to that for CREATE VIEW and the effect is\nthe same\nas for CREATE OR REPLACE VIEW if the view exists. This\nstatement\nrequires the CREATE VIEW and DROP privileges for the view,\nand some\nprivilege for each column referred to in the SELECT\nstatement. As of\nMariaDB 5.1.23, ALTER VIEW is allowed only to the definer or\nusers with\nthe SUPER privilege.\n \nExample\n \nALTER VIEW v AS SELECT a, a*3 AS a2 FROM t;\n \n\n\nURL: https://mariadb.com/kb/en/alter-view/','','https://mariadb.com/kb/en/alter-view/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (655,39,'CONSTRAINT','MariaDB supports the implementation of constraints at the\ntable-level using either CREATE TABLE or ALTER TABLE\nstatements. A table constraint restricts the data you can\nadd to the table. If you attempt to insert invalid data on a\ncolumn, MariaDB throws an error. \n \nSyntax\n------ \n[CONSTRAINT [symbol]] constraint_expression\n \nconstraint_expression:\n | PRIMARY KEY [index_type] (index_col_name, ...)\n[index_option] ...\n | FOREIGN KEY [index_name] (index_col_name, ...) \n REFERENCES tbl_name (index_col_name, ...)\n [ON DELETE reference_option]\n [ON UPDATE reference_option]\n | UNIQUE [INDEX|KEY] [index_name]\n [index_type] (index_col_name, ...) [index_option] ...\n | CHECK (check_constraints)\n \nindex_type:\n USING {BTREE | HASH | RTREE}\n \nindex_col_name:\n col_name [(length)] [ASC | DESC]\n \nindex_option:\n | KEY_BLOCK_SIZE [=] value\n | index_type\n | WITH PARSER parser_name\n | COMMENT \'string\'\n | CLUSTERING={YES|NO}\n \nreference_option:\n RESTRICT | CASCADE | SET NULL | NO ACTION | SET DEFAULT\n \nDescription\n----------- \nConstraints provide restrictions on the data you can add to\na table. This allows you to enforce data integrity from\nMariaDB, rather than through application logic. When a\nstatement violates a constraint, MariaDB throws an error.\n \nThere are four types of table constraints:\n \nConstraint | Description | \n \nPRIMARY KEY | Sets the column for referencing rows. Values\nmust be unique and not null. | \n \nFOREIGN KEY | Sets the column to reference the primary key\non another table. | \n \nUNIQUE | Requires values in column or columns only occur\nonce in the table. | \n \nCHECK | Checks whether the data meets the given condition. |\n\n \nFOREIGN KEY Constraints\n \nInnoDB supports foreign key constraints. The syntax for a\nforeign key\nconstraint definition in InnoDB looks like this:\n \n[CONSTRAINT [symbol]] FOREIGN KEY\n [index_name] (index_col_name, ...)\n REFERENCES tbl_name (index_col_name,...)\n [ON DELETE reference_option]\n [ON UPDATE reference_option]\n \nreference_option:\n RESTRICT | CASCADE | SET NULL | NO ACTION\n \nCHECK Constraints\n \nFrom MariaDB 10.2.1, constraints are enforced. Before\nMariaDB 10.2.1 constraint expressions were accepted in the\nsyntax but ignored.\n \nIn MariaDB 10.2.1 you can define constraints in 2 different\nways:\nCHECK(expression) given as part of a column definition.\nCONSTRAINT [constraint_name] CHECK (expression)\n \nBefore a row is inserted or updated, all constraints are\nevaluated in the order they are defined. If any constraint\nexpression returns false, then the row will not be inserted\nor updated.\nOne can use most deterministic functions in a constraint,\nincluding UDFs.\n \nCREATE TABLE t1 (a INT CHECK (a>2), b INT CHECK (b>2),\nCONSTRAINT a_greater CHECK (a>b));\n \nIf you use the second format and you don\'t give a name to\nthe constraint, then the constraint will get an\nautomatically generated name. This is done so that you can\nlater delete the constraint with ALTER TABLE DROP\nconstraint_name.\n \nOne can disable all constraint expression checks by setting\nthe check_constraint_checks variable to OFF. This is useful\nfor example when loading a table that violates some\nconstraints that you want to later find and fix in SQL.\n \nReplication\n \nIn row-based replication, only the master checks\nconstraints, and failed statements will not be replicated.\nIn statement-based replication, the slaves will also check\nconstraints. Constraints should therefore be identical, as\nwell as deterministic, in a replication environment.\n \nAuto_increment\n \nFrom MariaDB 10.2.6, auto_increment columns are no longer\npermitted in check constraints. Previously they were\npermitted, but would not work correctly. See MDEV-11117.\n \nExamples\n-------- \nCREATE TABLE product (category INT NOT NULL, id INT NOT\nNULL,\n price DECIMAL,\n PRIMARY KEY(category, id)) ENGINE=INNODB;\n \nCREATE TABLE customer (id INT NOT NULL,\n PRIMARY KEY (id)) ENGINE=INNODB;\n \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 \nThe following examples will work from MariaDB 10.2.1\nonwards.\n \nNumeric constraints and comparisons:\n \nCREATE TABLE t1 (a INT CHECK (a>2), b INT CHECK (b>2),\nCONSTRAINT a_greater CHECK (a>b));\n \nINSERT INTO t1(a) VALUES (1);\nERROR 4022 (23000): CONSTRAINT `a` failed for `test`.`t1`\n \nINSERT INTO t1(a,b) VALUES (3,4);\nERROR 4022 (23000): CONSTRAINT `a_greater` failed for\n`test`.`t1`\n \nINSERT INTO t1(a,b) VALUES (4,3);\nQuery OK, 1 row affected (0.04 sec)\n \nDropping a constraint:\n \nALTER TABLE t1 DROP CONSTRAINT a_greater;\n \nAdding a constraint:\n \nALTER TABLE t1 ADD CONSTRAINT a_greater CHECK (a>b);\n \nDate comparisons and character length:\n \nCREATE TABLE t2 (name VARCHAR(30) CHECK\n(CHAR_LENGTH(name)>2), start_date DATE, \n end_date DATE CHECK (start_date IS NULL OR end_date IS NULL\nOR start_date2)), start_date DATE, \n end_date DATE CHECK (start_date IS NULL OR end_date IS NULL\nOR start_date2 is very different to CHAR_LENGTH(name>2) as\nthe latter mistakenly performs a numeric comparison on the\nname field, leading to unexpected results.\n \n\n\nURL: https://mariadb.com/kb/en/constraint/','','https://mariadb.com/kb/en/constraint/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (656,39,'CREATE DATABASE','Syntax\n------ \nCREATE [OR REPLACE] {DATABASE | SCHEMA} [IF NOT EXISTS]\ndb_name\n [create_specification] ...\n \ncreate_specification:\n [DEFAULT] CHARACTER SET [=] charset_name\n | [DEFAULT] COLLATE [=] collation_name\n \nDescription\n----------- \nCREATE DATABASE creates a database with the given name. To\nuse this statement, you need the CREATE privilege for the\ndatabase. CREATE SCHEMA is a synonym for CREATE DATABASE.\n \nFor valid identifiers to use as database names, see\nIdentifier Names.\n \nOR REPLACE\n \nThe OR REPLACE clause was added in MariaDB 10.1.3\n \nIf the optional OR REPLACE clause is used, it acts as a\nshortcut for:\n \nDROP DATABASE IF EXISTS db_name;\n \nCREATE DATABASE db_name ...;\n \nIF NOT EXISTS\n \nWhen the IF NOT EXISTS clause is used, MariaDB will return a\nwarning instead of an error if the specified database\nalready exists.\n \nExamples\n-------- \nCREATE DATABASE db1;\n \nQuery OK, 1 row affected (0.18 sec)\n \nCREATE DATABASE db1;\n \nERROR 1007 (HY000): Can\'t create database \'db1\'; database\nexists\n \nCREATE OR REPLACE DATABASE db1;\nQuery OK, 2 rows affected (0.00 sec)\n \nCREATE DATABASE IF NOT EXISTS db1;\nQuery OK, 1 row affected, 1 warning (0.01 sec)\n \nSHOW WARNINGS;\n+-------+------+----------------------------------------------+\n| Level | Code | Message |\n+-------+------+----------------------------------------------+\n| Note | 1007 | Can\'t create database \'db1\';\n database exists |\n+-------+------+----------------------------------------------+\n \nSetting the character sets and collation. See Setting\nCharacter Sets and Collations for more details.\n \nCREATE DATABASE czech_slovak_names \n CHARACTER SET = \'keybcs2\'\n COLLATE = \'keybcs2_bin\';\n \n\n\nURL: https://mariadb.com/kb/en/create-database/','','https://mariadb.com/kb/en/create-database/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (657,39,'CREATE EVENT','Syntax\n------ \nCREATE [OR REPLACE]\n [DEFINER = { user | CURRENT_USER | role | CURRENT_ROLE }]\n EVENT \n [IF NOT EXISTS]\n event_name \n ON SCHEDULE schedule\n [ON COMPLETION [NOT] PRESERVE]\n [ENABLE | DISABLE | DISABLE ON SLAVE]\n [COMMENT \'comment\']\n DO sql_statement;\n \nschedule:\n AT timestamp [+ INTERVAL interval] ...\n | EVERY interval \n [STARTS timestamp [+ INTERVAL interval] ...] \n [ENDS timestamp [+ INTERVAL interval] ...]\n \ninterval:\n quantity {YEAR | QUARTER | MONTH | DAY | HOUR | MINUTE |\n WEEK | SECOND | YEAR_MONTH | DAY_HOUR | DAY_MINUTE |\n DAY_SECOND | HOUR_MINUTE | HOUR_SECOND | MINUTE_SECOND}\n \nDescription\n----------- \nThis statement creates and schedules a new event. It\nrequires the\nEVENT privilege for the schema in which the event is to be\ncreated.\n \nThe minimum requirements for a valid CREATE EVENT statement\nare as\nfollows:\nThe keywords CREATE EVENT plus an event name, which uniquely\nidentifies\n the event in the current schema. (Prior to MySQL 5.1.12,\nthe event name\n needed to be unique only among events created by the same\nuser on a given\n database.)\nAn ON SCHEDULE clause, which determines when and how often\nthe event\n executes.\nA DO clause, which contains the SQL statement to be executed\nby an\n event.\n \nHere 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\nevent executes once\n— one hour following its creation\n— by running an SQL statement that increments the\nvalue of the myschema.mytable table\'s mycol column by 1.\n \nThe event_name must be a valid MariaDB identifier with a\nmaximum length\nof 64 characters. It may be delimited using back ticks, and\nmay be\nqualified with the name of a database schema. An event is\nassociated\nwith both a MariaDB user (the definer) and a schema, and its\nname must\nbe unique among names of events within that schema. In\ngeneral, the\nrules governing event names are the same as those for names\nof stored\nroutines. See Identifier Names.\n \nIf no schema is indicated as part of event_name, the default\n(current)\nschema is assumed.\n \nFor valid identifiers to use as event names, see Identifier\nNames.\n \nOR REPLACE\n \nThe OR REPLACE clause was included in MariaDB 10.1.4. If\nused and the event already exists, instead of an error being\nreturned, the existing event will be dropped and replaced by\nthe newly defined event.\n \nIF NOT EXISTS\n \nIf the IF NOT EXISTS clause is used, MariaDB will return a\nwarning instead of an error if the event already exists.\nCannot be used together with OR REPLACE.\n \nON SCHEDULE\n \nThe ON SCHEDULE clause can be used to specify when the event\nmust be triggered.\n \nAT\n \nIf you want to execute the event only once (one time event),\nyou can use the AT keyword, followed by a timestamp. If you\nuse CURRENT_TIMESTAMP, the event acts as soon as it is\ncreated. As a convenience, you can add one or more intervals\nto that timestamp. You can also specify a timestamp in the\npast, so that the event is stored but not triggered, until\nyou modify it via ALTER EVENT.\n \nThe following example shows how to create an event that will\nbe triggered tomorrow at a certain time:\n \nCREATE EVENT example\nON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 DAY + INTERVAL\n3 HOUR\nDO something;\n \nYou can also specify that an event must be triggered at a\nregular interval (recurring event). In such cases, use the\nEVERY clause followed by the interval.\n \nIf an event is recurring, you can specify when the first\nexecution must happen via the STARTS clause and a maximum\ntime for the last execution via the ENDS clause. STARTS and\nENDS clauses are followed by a timestamp and, optionally,\none or more intervals. The ENDS clause can specify a\ntimestamp in the past, so that the event is stored but not\nexecuted until you modify it via ALTER EVENT.\n \nIn the following example, next month a recurring event will\nbe triggered hourly for a week:\n \nCREATE EVENT example\nON SCHEDULE EVERY 1 HOUR\nSTARTS CURRENT_TIMESTAMP + INTERVAL 1 MONTH\nENDS CURRENT_TIMESTAMP + INTERVAL 1 MONTH + INTERVAL 1 WEEK\nDO some_task;\n \nIntervals consist of a quantity and a time unit. The time\nunits are the same used for other staments and time\nfunctions, except that you can\'t use microseconds for\nevents. For simple time units, like HOUR or MINUTE, the\nquantity is an integer number, for example \'10 MINUTE\'.\nFor composite time units, like HOUR_MINUTE or HOUR_SECOND,\nthe quantity must be a string with all involved simple\nvalues and their separators, for example \'2:30\' or\n\'2:30:30\'.\n \nON COMPLETION [NOT] PRESERVE\n \nThe ON COMPLETION clause can be used to specify if the event\nmust be deleted after its last execution (that is, after its\nAT or ENDS timestamp is past). By default, events are\ndropped when they are expired. To explicitly state that this\nis the desired behaviour, you can use ON COMPLETION NOT\nPRESERVE. Instead, if you want the event to be preserved,\nyou can use ON COMPLETION PRESERVE.\n \nIn you specify ON COMPLETION NOT PRESERVE, and you specify a\ntimestamp in the past for AT or ENDS clause, the event will\nbe immediatly dropped. In such cases, you will get a Note\n1558: \"Event execution time is in the past and ON\nCOMPLETION NOT PRESERVE is set. The event was dropped\nimmediately after creation\".\n \nENABLE/DISABLE/DISABLE ON SLAVE\n \nEvents are ENABLEd by default. If you want to stop MariaDB\nfrom executing\nan event, you may specify DISABLE. When it is ready to be\nactivated, you\nmay enable it using ALTER EVENT. Another option is\nDISABLE ON SLAVE, which indicates that an event was created\non a master and has been replicated to the slave, which is\nprevented from executing the event. If DISABLE ON SLAVE is\nspecifically set, the event will not be executed.\n \nCOMMENT\n \nThe COMMENT clause may be used to set a comment for the\nevent. Maximum\nlength for comments is 64 characters. The comment is a\nstring, so it must be\nquoted. To see events comments, you can query the\nINFORMATION_SCHEMA.EVENTS table (the column is named\nEVENT_COMMENT).\n \nExamples\n-------- \nMinimal 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 \nAn event that will be triggered tomorrow at a certain time:\n \nCREATE EVENT example\nON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 DAY + INTERVAL\n3 HOUR\nDO something;\n \nNext month a recurring event will be triggered hourly for a\nweek:\n \nCREATE EVENT example\nON SCHEDULE EVERY 1 HOUR\nSTARTS CURRENT_TIMESTAMP + INTERVAL 1 MONTH\nENDS CURRENT_TIMESTAMP + INTERVAL 1 MONTH + INTERVAL 1 WEEK\nDO some_task;\n \nOR REPLACE and IF NOT EXISTS:\n \nCREATE EVENT myevent\n ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR\n DO\n UPDATE myschema.mytable SET mycol = mycol + 1;\n \nERROR 1537 (HY000): Event \'myevent\' already exists\n \nCREATE OR REPLACE EVENT myevent\n ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR\n DO\n UPDATE myschema.mytable SET mycol = mycol + 1;;\nQuery OK, 0 rows affected (0.00 sec)\n \nCREATE EVENT IF NOT EXISTS myevent\n ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR\n DO\n UPDATE myschema.mytable SET mycol = mycol + 1;\n \nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n \n SHOW WARNINGS;\n \n+-------+------+--------------------------------+\n| Level | Code | Message |\n+-------+------+--------------------------------+\n| Note | 1537 | Event \'myevent\' already exists |\n+-------+------+--------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/create-event/','','https://mariadb.com/kb/en/create-event/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (658,39,'CREATE FUNCTION','Syntax\n------ \nCREATE [OR REPLACE]\n [DEFINER = {user | CURRENT_USER | role | CURRENT_ROLE }]\n [AGGREGATE] FUNCTION [IF NOT EXISTS] func_name\n([func_parameter[,...]])\n RETURNS type\n [characteristic ...]\n RETURN func_body\n \nfunc_parameter:\n param_name type\n \ntype:\n Any valid MariaDB data type\n \ncharacteristic:\n LANGUAGE SQL\n | [NOT] DETERMINISTIC\n | { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL\nDATA }\n | SQL SECURITY { DEFINER | INVOKER }\n | COMMENT \'string\'\n \nfunc_body:\n Valid SQL procedure statement\n \nDescription\n----------- \nUse the CREATE FUNCTION statement to create a new stored\nfunction. You must have\nthe CREATE ROUTINE database privilege to use CREATE\nFUNCTION.\nA function takes any number of arguments and returns a value\nfrom the function body. The\nfunction body can be any valid SQL expression as you would\nuse, for example, in any select\nexpression. If you have the appropriate privileges, you can\ncall the function exactly as you\nwould any built-in function. See Security below for details\non privileges.\n \nYou can also use a variant of the CREATE FUNCTION statement\nto install a user-defined\nfunction (UDF) defined by a plugin. See CREATE FUNCTION\n(UDF)\nfor details.\n \nYou can use a SELECT statement for the function body by\nenclosing it in\nparentheses, exactly as you would to use a subselect for any\nother expression. The SELECT\nstatement must return a single value. If more than one\ncolumn is returned when the function is called,\nerror 1241 results. If more than one row is returned when\nthe function is called, error 1242\nresults. Use a LIMIT clause to ensure only one row is\nreturned.\n \nYou can also replace the RETURN clause with a BEGIN...END\ncompound\nstatement. The compound statement must contain a RETURN\nstatement. When the function is\ncalled, the RETURN statement immediately returns its result,\nand any statements after RETURN\nare effectively ignored.\n \nBy default, a function is associated with the default\ndatabase. To associate the function explicitly\nwith a given database, specify the fully-qualified name as\ndb_name.func_name\nwhen you create it. If the function name is the same as the\nname of a built-in function, you must\nuse the fully qualified name when you call it.\n \nThe parameter list enclosed within parentheses must always\nbe present.\nIf there are no parameters, an empty parameter list of ()\nshould be\nused. Parameter names are not case sensitive.\n \nEach parameter can be declared to use any valid data type,\nexcept that\nthe COLLATE attribute cannot be used.\n \nFor valid identifiers to use as function names, see\nIdentifier Names.\n \nAGGREGATE\n \nFrom MariaDB 10.3.3, it is possible to create stored\naggregate functions as well. See Stored Aggregate Functions\nfor details.\n \nRETURNS\n \nThe RETURNS clause specifies the return type of the\nfunction. NULL values are permitted with all return types.\n \nWhat happens if the RETURN clause returns a value of a\ndifferent type? It depends on the SQL_MODE in effect at the\nmoment of the function creation.\n \nIf the SQL_MODE is strict (STRICT_ALL_TABLES or\nSTRICT_TRANS_TABLES flags are specified), a 1366 error will\nbe produced.\n \nOtherwise, the value is coerced to the proper type. For\nexample, if a function\nspecifies an ENUM or SET value in the RETURNS clause, but\nthe RETURN\nclause returns an integer, the value returned from the\nfunction is the string for the corresponding ENUM\nmember of set of SET members.\n \nMariaDB stores the SQL_MODE system variable setting that is\nin effect at the\ntime a routine is created, and always executes the routine\nwith this setting in\nforce, regardless of the server SQL mode in effect when the\nroutine is invoked.\n \nLANGUAGE SQL\n \nLANGUAGE SQL is a standard SQL clause, and it can be used in\nMariaDB for portability. However that clause has no meaning,\nbecause SQL is the only supported language for stored\nfunctions.\n \nA function is deterministic if it can produce only one\nresult for a given list of parameters. If the result may be\naffected by stored data, server variables, random numbers or\nany value that is not explicitly passed, then the function\nis not deterministic. Also, a function is non-deterministic\nif it uses non-deterministic functions like NOW() or\nCURRENT_TIMESTAMP(). The optimizer may choose a faster\nexecution plan if it known that the function is\ndeterministic. In such cases, you should declare the routine\nusing the DETERMINISTIC keyword. If you want to explicitly\nstate that the function is not deterministic (which is the\ndefault) you can use the NOT DETERMINISTIC keywords.\n \nIf you declare a non-deterministic function as\nDETERMINISTIC, you may get incorrect results. If you declare\na deterministic function as NOT DETERMINISTIC, in some cases\nthe queries will be slower.\n \nOR REPLACE\n \nIf the optional OR REPLACE clause is used, it acts as a\nshortcut for:\n \nDROP FUNCTION IF EXISTS function_name;\n \nCREATE FUNCTION function_name ...;\n \nwith the exception that any existing privileges for the\nfunction are not dropped.\n \nIF NOT EXISTS\n \nIf the IF NOT EXISTS clause is used, MariaDB will return a\nwarning instead of an error if the function already exists.\nCannot be used together with OR REPLACE.\n \n[NOT] DETERMINISTIC\n \nThe [NOT] DETERMINISTIC clause also affects binary logging,\nbecause the STATEMENT format can not be used to store or\nreplicate non-deterministic statements.\n \nCONTAINS SQL, NO SQL, READS SQL DATA, and MODIFIES SQL DATA\nare informative clauses that tell the server what the\nfunction does. MariaDB does not check in any way whether the\nspecified clause is correct. If none of these clauses are\nspecified, CONTAINS SQL is used by default.\n \nMODIFIES SQL DATA\n \nMODIFIES SQL DATA means that the function contains\nstatements that may modify data stored in databases. This\nhappens if the function contains statements like DELETE,\nUPDATE, INSERT, REPLACE or DDL.\n \nREADS SQL DATA\n \nREADS SQL DATA means that the function reads data stored in\ndatabases, but does not modify any data. This happens if\nSELECT statements are used, but there no write operations\nare executed.\n \nCONTAINS SQL\n \nCONTAINS SQL means that the function contains at least one\nSQL statement, but it does not read or write any data stored\nin a database. Examples include SET or DO.\n \nNO SQL\n \nNO SQL means nothing, because MariaDB does not currently\nsupport any language other than SQL.\n \nOracle Mode\n \nFrom MariaDB 10.3, a subset of Oracle\'s PL/SQL language has\nbeen supported in addition to the traditional SQL/PSM-based\nMariaDB syntax. See Oracle mode from MariaDB 10.3 for\ndetails on changes when running Oracle mode.\n \nSecurity\n \nYou must have the EXECUTE privilege on a function to call\nit.\nMariaDB automatically grants the EXECUTE and ALTER ROUTINE\nprivileges to the\naccount that called CREATE FUNCTION, even if the DEFINER\nclause was used.\n \nEach function has an account associated as the definer. By\ndefault, the definer is the account\nthat created the function. Use the DEFINER clause to specify\na different account as the\ndefiner. You must have the SUPER privilege to use the\nDEFINER\nclause. See Account Names for details on specifying\naccounts.\n \nThe SQL SECURITY clause specifies what privileges are used\nwhen a function is called.\nIf SQL SECURITY is INVOKER, the function body will be\nevaluated using the privileges\nof the user calling the function. If SQL SECURITY is\nDEFINER, the function body is\nalways evaluated using the privileges of the definer\naccount. DEFINER is the default.\n \nThis allows you to create functions that grant limited\naccess to certain data. For example, say\nyou have a table that stores some employee information, and\nthat you\'ve granted SELECT\nprivileges only on certain columns to the user account\nroger.\n \nCREATE TABLE employees (name TINYTEXT, dept TINYTEXT, salary\nINT);\nGRANT SELECT (name, dept) ON employees TO roger;\n \nTo allow the user the get the maximum salary for a\ndepartment, define a function and grant\nthe EXECUTE privilege:\n \nCREATE FUNCTION max_salary (dept TINYTEXT) RETURNS INT\nRETURN\n (SELECT MAX(salary) FROM employees WHERE employees.dept =\ndept);\nGRANT EXECUTE ON FUNCTION max_salary TO roger;\n \nSince SQL SECURITY defaults to DEFINER, whenever the user\nroger calls\nthis function, the subselect will execute with your\nprivileges. As long as you have privileges to\nselect the salary of each employee, the caller of the\nfunction will be able to get the maximum\nsalary for each department without being able to see\nindividual salaries.\n \nCharacter sets and collations\n \nFunction return types can be declared to use any valid\ncharacter set and collation. If used, the COLLATE attribute\nneeds to be preceded by a CHARACTER SET attribute.\n \nIf the character set and collation are not specifically set\nin the statement, the database defaults at the time of\ncreation will be used. If the database defaults change at a\nlater stage, the stored function character set/collation\nwill not be changed at the same time; the stored function\nneeds to be dropped and recreated to ensure the same\ncharacter set/collation as the database is used.\n \nExamples\n-------- \nThe following example function takes a parameter, performs\nan operation using\nan SQL function, and returns the result.\n \nCREATE FUNCTION hello (s CHAR(20))\n RETURNS CHAR(50) DETERMINISTIC\n RETURN CONCAT(\'Hello, \',s,\'!\');\n \nSELECT hello(\'world\');\n+----------------+\n| hello(\'world\') |\n+----------------+\n| Hello, world! |\n+----------------+\n \nYou can use a compound statement in a function to manipulate\ndata with statements\nlike INSERT and UPDATE. The following example creates a\ncounter function\nthat uses a temporary table to store the current value.\nBecause the compound statement\ncontains statements terminated with semicolons, you have to\nfirst change the statement\ndelimiter with the DELIMITER statement to allow the\nsemicolon to be used in the\nfunction body. See Delimiters in the mysql client for more.\n \nCREATE TEMPORARY TABLE counter (c INT);\nINSERT INTO counter VALUES (0);\nDELIMITER //\nCREATE FUNCTION counter () RETURNS INT\n BEGIN\n UPDATE counter SET c = c + 1;\n \n RETURN (SELECT c FROM counter LIMIT 1);\n END //\nDELIMITER ;\n \nCharacter set and collation:\n \nCREATE FUNCTION hello2 (s CHAR(20))\n RETURNS CHAR(50) CHARACTER SET \'utf8\' COLLATE\n\'utf8_bin\' DETERMINISTIC\n RETURN CONCAT(\'Hello, \',s,\'!\');\n \n\n\nURL: https://mariadb.com/kb/en/create-function/','','https://mariadb.com/kb/en/create-function/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (659,39,'CREATE INDEX','Syntax\n------ \nCREATE [OR REPLACE] [UNIQUE|FULLTEXT|SPATIAL] INDEX \n [IF NOT EXISTS] index_name\n [index_type]\n ON tbl_name (index_col_name,...)\n [WAIT n | NOWAIT]\n [index_option]\n [algorithm_option | lock_option] ...\n \nindex_col_name:\n col_name [(length)] [ASC | DESC]\n \nindex_type:\n USING {BTREE | HASH | RTREE}\n \nindex_option:\n KEY_BLOCK_SIZE [=] value\n | index_type\n | WITH PARSER parser_name\n | COMMENT \'string\'\n \nalgorithm_option:\n ALGORITHM [=] {DEFAULT|INPLACE|COPY|NOCOPY|INSTANT}\n \nlock_option:\n LOCK [=] {DEFAULT|NONE|SHARED|EXCLUSIVE}\n \nDescription\n----------- \nCREATE INDEX is mapped to an ALTER TABLE statement to create\nindexes.\nSee ALTER TABLE. CREATE INDEX cannot be used to create a\nPRIMARY KEY; use ALTER TABLE instead.\n \nIf another connection is using the table, a metadata lock is\nactive, and this statement will wait until the lock is\nreleased. This is also true for non-transactional tables.\n \nAnother shortcut, DROP INDEX, allows the removal of an\nindex.\n \nFor valid identifiers to use as index names, see Identifier\nNames.\n \nNote that KEY_BLOCK_SIZE is currently ignored in CREATE\nINDEX, although it is included in the output of SHOW CREATE\nTABLE.\n \nPrivileges\n \nExecuting the CREATE INDEX statement requires the INDEX\nprivilege for the table or the database.\n \nOnline DDL\n \nIn MariaDB 10.0 and later, online DDL is supported with the\nALGORITHM and LOCK clauses.\n \nSee InnoDB Online DDL Overview for more information on\nonline DDL with InnoDB.\n \nCREATE OR REPLACE INDEX ...\n \nThe OR REPLACE clause was added in MariaDB 10.1.4.\n \nIf the OR REPLACE clause is used and if the index already\nexists, then instead of returning an error, the server will\ndrop the existing index and replace it with the newly\ndefined index.\n \nCREATE INDEX IF NOT EXISTS ...\n \nIf the IF NOT EXISTS clause is used, then the index will\nonly be created if an index with the same name does not\nalready exist. If the index already exists, then a warning\nwill be triggered by default.\n \nIndex Definitions\n \nSee CREATE TABLE: Index Definitions for information about\nindex definitions.\n \nWAIT/NOWAIT\n \nSet the lock wait timeout. See WAIT and NOWAIT.\n \nALGORITHM\n \nSee ALTER TABLE: ALGORITHM for more information.\n \nLOCK\n \nSee ALTER TABLE: LOCK for more information.\n \nProgress Reporting\n \nMariaDB provides progress reporting for CREATE INDEX\nstatement for clients\nthat support the new progress reporting protocol. For\nexample, if you were using the mysql client, then the\nprogress report might look like this::\n \nCREATE INDEX ON tab (num);;\nStage: 1 of 2 \'copy to tmp table\' 46% of stage\n \nThe progress report is also shown in the output of the SHOW\nPROCESSLIST statement and in the contents of the\ninformation_schema.PROCESSLIST table.\n \nSee Progress Reporting for more information.\n \nExamples\n-------- \nCreating a unique index:\n \nCREATE UNIQUE INDEX HomePhone ON Employees(Home_Phone);\n \nOR REPLACE and IF NOT EXISTS:\n \nCREATE INDEX xi ON xx5 (x);\nQuery OK, 0 rows affected (0.03 sec)\n \nCREATE INDEX xi ON xx5 (x);\nERROR 1061 (42000): Duplicate key name \'xi\'\n \nCREATE OR REPLACE INDEX xi ON xx5 (x);\nQuery OK, 0 rows affected (0.03 sec)\n \nCREATE INDEX IF NOT EXISTS xi ON xx5 (x);\nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+-------+------+-------------------------+\n| Level | Code | Message |\n+-------+------+-------------------------+\n| Note | 1061 | Duplicate key name \'xi\' |\n+-------+------+-------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/create-index/','','https://mariadb.com/kb/en/create-index/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (660,39,'CREATE PACKAGE','Oracle-style packages were introduced in MariaDB 10.3.5.\n \nSyntax\n------ \nCREATE\n [ OR REPLACE]\n [DEFINER = { user | CURRENT_USER | role | CURRENT_ROLE }]\n PACKAGE [ IF NOT EXISTS ]\n [ db_name . ] package_name\n [ package_characteristic ... ]\n{ AS | IS }\n [ package_specification_element ... ]\nEND [ package_name ]\n \npackage_characteristic:\n COMMENT \'string\'\n | SQL SECURITY { DEFINER | INVOKER }\n \npackage_specification_element:\n FUNCTION_SYM package_specification_function ;\n | PROCEDURE_SYM package_specification_procedure ;\n \npackage_specification_function:\n func_name [ ( func_param [, func_param]... ) ]\n RETURNS func_return_type\n [ package_routine_characteristic... ]\n \npackage_specification_procedure:\n proc_name [ ( proc_param [, proc_param]... ) ]\n [ package_routine_characteristic... ]\n \nfunc_return_type:\n type\n \nfunc_param:\n param_name type\n \nproc_param:\n param_name { IN | OUT | INOUT | IN OUT } type\n \ntype:\n Any valid MariaDB explicit or anchored data type\n \npackage_routine_characteristic:\n COMMENT \'string\'\n | LANGUAGE SQL\n | { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL\nDATA }\n | SQL SECURITY { DEFINER | INVOKER }\n \nDescription\n----------- \nThe CREATE PACKAGE statement can be used when Oracle\nSQL_MODE is set.\n \nThe CREATE PACKAGE creates the specification for a stored\npackage (a collection of logically related stored objects).\nA stored package specification declares public routines\n(procedures and functions) of the package, but does not\nimplement these routines.\n \nA package whose specification was created by the CREATE\nPACKAGE statement, should later be implemented using the\nCREATE PACKAGE BODY statement.\n \nExamples\n-------- \nSET sql_mode=ORACLE;\nDELIMITER $$\nCREATE OR REPLACE PACKAGE employee_tools AS\n FUNCTION getSalary(eid INT) RETURN DECIMAL(10,2);\n PROCEDURE raiseSalary(eid INT, amount DECIMAL(10,2));\n PROCEDURE raiseSalaryStd(eid INT);\n PROCEDURE hire(ename TEXT, esalary DECIMAL(10,2));\nEND;\n$$\nDELIMITER ;\n \n\n\nURL: https://mariadb.com/kb/en/create-package/','','https://mariadb.com/kb/en/create-package/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (661,39,'CREATE PACKAGE BODY','Oracle-style packages were introduced in MariaDB 10.3.5.\n \nSyntax\n------ \nCREATE [ OR REPLACE ]\n [DEFINER = { user | CURRENT_USER | role | CURRENT_ROLE }]\n PACKAGE BODY\n [ IF NOT EXISTS ]\n [ db_name . ] package_name\n [ package_characteristic... ]\n{ AS | IS }\n package_implementation_declare_section\n package_implementation_executable_section\nEND [ package_name]\n \npackage_implementation_declare_section:\n package_implementation_item_declaration\n [ package_implementation_item_declaration... ]\n [ package_implementation_routine_definition... ]\n | package_implementation_routine_definition\n [ package_implementation_routine_definition...]\n \npackage_implementation_item_declaration:\n variable_declaration ;\n \nvariable_declaration:\n variable_name[,...] type [:= expr ]\n \npackage_implementation_routine_definition:\n FUNCTION package_specification_function\n [ package_implementation_function_body ] ;\n | PROCEDURE package_specification_procedure\n [ package_implementation_procedure_body ] ;\n \npackage_implementation_function_body:\n { AS | IS } package_routine_body [func_name]\n \npackage_implementation_procedure_body:\n { AS | IS } package_routine_body [proc_name]\n \npackage_routine_body:\n [ package_routine_declarations ]\n BEGIN\n statements [ EXCEPTION exception_handlers ]\n END\n \npackage_routine_declarations:\n package_routine_declaration \';\'\n[package_routine_declaration \';\']...\n \npackage_routine_declaration:\n variable_declaration\n | condition_name CONDITION FOR condition_value\n | user_exception_name EXCEPTION\n | CURSOR_SYM cursor_name\n [ ( cursor_formal_parameters ) ]\n IS select_statement\n ;\n \npackage_implementation_executable_section:\n END\n | BEGIN\n statement ; [statement ; ]...\n [EXCEPTION exception_handlers]\n END\n \nexception_handlers:\n exception_handler [exception_handler...]\n \nexception_handler:\n WHEN_SYM condition_value [, condition_value]...\n THEN_SYM statement ; [statement ;]...\n \ncondition_value:\n condition_name\n | user_exception_name\n | SQLWARNING\n | SQLEXCEPTION\n | NOT FOUND\n | OTHERS_SYM\n | SQLSTATE [VALUE] sqlstate_value\n | mariadb_error_code\n \n\nDescription\n----------- \nThe CREATE PACKAGE BODY statement can be used when Oracle\nSQL_MODE is set.\n \nThe CREATE PACKAGE BODY statement creates the package body\nfor a stored package. The package specification must be\npreviously created using the CREATE PACKAGE statement.\n \nA package body provides implementations of the package\npublic routines and can optionally have:\npackage-wide private variables\npackage private routines\nforward declarations for private routines\nan executable initialization section\n \nExamples\n-------- \nSET sql_mode=ORACLE;\nDELIMITER $$\nCREATE OR REPLACE PACKAGE employee_tools AS\n FUNCTION getSalary(eid INT) RETURN DECIMAL(10,2);\n PROCEDURE raiseSalary(eid INT, amount DECIMAL(10,2));\n PROCEDURE raiseSalaryStd(eid INT);\n PROCEDURE hire(ename TEXT, esalary DECIMAL(10,2));\nEND;\n$$\nCREATE PACKAGE BODY employee_tools AS\n -- package body variables\n stdRaiseAmount DECIMAL(10,2):=500;\n \n -- private routines\n PROCEDURE log (eid INT, ecmnt TEXT) AS\n BEGIN\n INSERT INTO employee_log (id, cmnt) VALUES (eid, ecmnt);\n END;\n \n -- public routines\n PROCEDURE hire(ename TEXT, esalary DECIMAL(10,2)) AS\n eid INT;\n BEGIN\n INSERT INTO employee (name, salary) VALUES (ename,\nesalary);\n eid:= last_insert_id();\n log(eid, \'hire \' || ename);\n END;\n \n FUNCTION getSalary(eid INT) RETURN DECIMAL(10,2) AS\n nSalary DECIMAL(10,2);\n BEGIN\n SELECT salary INTO nSalary FROM employee WHERE id=eid;\n log(eid, \'getSalary id=\' || eid || \' salary=\' ||\nnSalary);\n RETURN nSalary;\n END;\n \n PROCEDURE raiseSalary(eid INT, amount DECIMAL(10,2)) AS\n BEGIN\n UPDATE employee SET salary=salary+amount WHERE id=eid;\n log(eid, \'raiseSalary id=\' || eid || \' amount=\' ||\namount);\n END;\n \n PROCEDURE raiseSalaryStd(eid INT) AS\n BEGIN\n raiseSalary(eid, stdRaiseAmount);\n log(eid, \'raiseSalaryStd id=\' || eid);\n END;\n \nBEGIN\n -- This code is executed when the current session\n -- accesses any of the package routines for the first time\n log(0, \'Session \' || connection_id() || \' \' ||\ncurrent_user || \' started\');\nEND;\n$$\n \nDELIMITER ;\n \n\n\nURL: https://mariadb.com/kb/en/create-package-body/','','https://mariadb.com/kb/en/create-package-body/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (662,39,'CREATE PROCEDURE','Syntax\n------ \nCREATE\n [OR REPLACE]\n [DEFINER = { user | CURRENT_USER | role | CURRENT_ROLE }]\n PROCEDURE sp_name ([proc_parameter[,...]])\n [characteristic ...] routine_body\n \nproc_parameter:\n [ IN | OUT | INOUT ] param_name type\n \ntype:\n Any valid MariaDB data type\n \ncharacteristic:\n LANGUAGE SQL\n | [NOT] DETERMINISTIC\n | { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL\nDATA }\n | SQL SECURITY { DEFINER | INVOKER }\n | COMMENT \'string\'\n \nroutine_body:\n Valid SQL procedure statement\n \nDescription\n----------- \nCreates a stored procedure. By default, a routine is\nassociated with the default database. To associate the\nroutine\nexplicitly with a given database, specify the name as\ndb_name.sp_name\nwhen you create it.\n \nWhen the routine is invoked, an implicit USE db_name is\nperformed (and\nundone when the routine terminates). The causes the routine\nto have\nthe given default database while it executes. USE statements\nwithin\nstored routines are disallowed.\n \nWhen a stored procedure has been created, you invoke it by\nusing the CALL statement (see CALL).\n \nTo execute the CREATE PROCEDURE statement, it is\nnecessary to have the CREATE ROUTINE privilege. By default,\nMariaDB\nautomatically grants the ALTER ROUTINE and EXECUTE\nprivileges to the\nroutine creator. See also Stored Routine Privileges.\n \nThe DEFINER and SQL SECURITY clauses specify the security\ncontext to\nbe used when checking access privileges at routine execution\ntime, as\ndescribed later.\n \nIf the routine name is the same as the name of a built-in\nSQL\nfunction, you must use a space between the name and the\nfollowing\nparenthesis when defining the routine, or a syntax error\noccurs. This\nis also true when you invoke the routine later. For this\nreason, we\nsuggest that it is better to avoid re-using the names of\nexisting SQL\nfunctions for your own stored routines.\n \nThe IGNORE_SPACE SQL mode applies to built-in functions, not\nto stored\nroutines. It is always allowable to have spaces after a\nroutine name,\nregardless of whether IGNORE_SPACE is enabled.\n \nThe parameter list enclosed within parentheses must always\nbe present.\nIf there are no parameters, an empty parameter list of ()\nshould be\nused. Parameter names are not case sensitive.\n \nEach parameter can be declared to use any valid data type,\nexcept that\nthe COLLATE attribute cannot be used.\n \nFor valid identifiers to use as procedure names, see\nIdentifier Names.\n \nIN/OUT/INOUT\n \nEach parameter is an IN parameter by default. To specify\notherwise for\na parameter, use the keyword OUT or INOUT before the\nparameter name.\n \nAn IN parameter passes a value into a procedure. The\nprocedure might\nmodify the value, but the modification is not visible to the\ncaller\nwhen the procedure returns. An OUT parameter passes a value\nfrom the\nprocedure back to the caller. Its initial value is NULL\nwithin the\nprocedure, and its value is visible to the caller when the\nprocedure\nreturns. An INOUT parameter is initialized by the caller,\ncan be\nmodified by the procedure, and any change made by the\nprocedure is\nvisible to the caller when the procedure returns.\n \nFor each OUT or INOUT parameter, pass a user-defined\nvariable in the\nCALL statement that invokes the procedure so that you can\nobtain its\nvalue when the procedure returns. If you are calling the\nprocedure\nfrom within another stored procedure or function, you can\nalso pass a\nroutine parameter or local routine variable as an IN or\nINOUT\nparameter.\n \nDETERMINISTIC/NOT DETERMINISTIC\n \nDETERMINISTIC and NOT DETERMINISTIC apply only to functions.\nSpecifying DETERMINISTC or NON-DETERMINISTIC in procedures\nhas no effect. The default value is NOT DETERMINISTIC.\nFunctions are DETERMINISTIC when they always return the same\nvalue for the same input. For example, a truncate or\nsubstring function. Any function involving data, therefore,\nis always NOT DETERMINISTIC.\n \nCONTAINS SQL/NO SQL/READS SQL DATA/MODIFIES SQL DATA\n \nCONTAINS SQL, NO SQL, READS SQL DATA, and MODIFIES SQL DATA\nare informative clauses that tell the server what the\nfunction does. MariaDB does not check in any way whether the\nspecified clause is correct. If none of these clauses are\nspecified, CONTAINS SQL is used by default.\n \nMODIFIES SQL DATA means that the function contains\nstatements that may modify data stored in databases. This\nhappens if the function contains statements like DELETE,\nUPDATE, INSERT, REPLACE or DDL.\n \nREADS SQL DATA means that the function reads data stored in\ndatabases, but does not modify any data. This happens if\nSELECT statements are used, but there no write operations\nare executed.\n \nCONTAINS SQL means that the function contains at least one\nSQL statement, but it does not read or write any data stored\nin a database. Examples include SET or DO.\n \nNO SQL means nothing, because MariaDB does not currently\nsupport any language other than SQL.\n \nThe routine_body consists of a valid SQL procedure\nstatement. This can\nbe a simple statement such as SELECT or INSERT, or it can be\na\ncompound statement written using BEGIN and END. Compound\nstatements\ncan contain declarations, loops, and other control structure\nstatements. See Programmatic and Compound Statements for\nsyntax details.\n \nMariaDB allows routines to contain DDL statements, such as\nCREATE and\nDROP. MariaDB also allows stored procedures (but not stored\nfunctions)\nto contain SQL transaction statements such as COMMIT.\n \nFor additional information about statements that are not\nallowed in\nstored routines, see Stored Routine Limitations.\n \nInvoking stored procedure from within programs\n \nFor information about invoking stored procedures from within\nprograms written in a language that has a MariaDB/MySQL\ninterface, see CALL.\n \nOR REPLACE\n \nIf the optional OR REPLACE clause is used, it acts as a\nshortcut for:\n \nDROP PROCEDURE IF EXISTS name;\n \nCREATE PROCEDURE name ...;\n \nwith the exception that any existing privileges for the\nprocedure are not dropped.\n \nsql_mode\n \nMariaDB stores the sql_mode system variable setting that is\nin effect at the time a routine is created, and always\nexecutes the routine with this setting in force, regardless\nof the server SQL mode in effect when the routine is\ninvoked.\n \nCharacter Sets and Collations\n \nProcedure parameters can be declared with any character\nset/collation. If the character set and collation are not\nspecifically set, the database defaults at the time of\ncreation will be used. If the database defaults change at a\nlater stage, the stored procedure character set/collation\nwill not be changed at the same time; the stored procedure\nneeds to be dropped and recreated to ensure the same\ncharacter set/collation as the database is used.\n \nOracle Mode\n \nFrom MariaDB 10.3, a subset of Oracle\'s PL/SQL language has\nbeen supported in addition to the traditional SQL/PSM-based\nMariaDB syntax. See Oracle mode from MariaDB 10.3 for\ndetails on changes when running Oracle mode.\n \nExamples\n-------- \nThe following example shows a simple stored procedure that\nuses an OUT\nparameter. It uses the DELIMITER command to set a new\ndelimiter for the duration of the process — see Delimiters\nin the mysql client.\n \nDELIMITER //\n \nCREATE PROCEDURE simpleproc (OUT param1 INT)\n BEGIN\n SELECT COUNT(*) INTO param1 FROM t;\n END;\n//\n \nDELIMITER ;\n \nCALL simpleproc(@a);\n \nSELECT @a;\n+------+\n| @a |\n+------+\n| 1 |\n+------+\n \nCharacter set and collation:\n \nDELIMITER //\n \nCREATE PROCEDURE simpleproc2 (\n OUT param1 CHAR(10) CHARACTER SET \'utf8\' COLLATE\n\'utf8_bin\'\n)\n BEGIN\n SELECT CONCAT(\'a\'),f1 INTO param1 FROM t;\n END;\n//\n \nDELIMITER ;\n \nCREATE OR REPLACE:\n \nDELIMITER //\n \nCREATE PROCEDURE simpleproc2 (\n OUT param1 CHAR(10) CHARACTER SET \'utf8\' COLLATE\n\'utf8_bin\'\n)\n BEGIN\n SELECT CONCAT(\'a\'),f1 INTO param1 FROM t;\n \n END;\n \n//\nERROR 1304 (42000): PROCEDURE simpleproc2 already exists\n \nDELIMITER ;\n \nDELIMITER //\n \nCREATE OR REPLACE PROCEDURE simpleproc2 (\n OUT param1 CHAR(10) CHARACTER SET \'utf8\' COLLATE\n\'utf8_bin\'\n)\n BEGIN\n SELECT CONCAT(\'a\'),f1 INTO param1 FROM t;\n \n END;\n \n//\nERROR 1304 (42000): PROCEDURE simpleproc2 already exists\n \nDELIMITER ;\n \nQuery OK, 0 rows affected (0.03 sec)\n \n\n\nURL: https://mariadb.com/kb/en/create-procedure/','','https://mariadb.com/kb/en/create-procedure/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (663,39,'CREATE SEQUENCE','CREATE SEQUENCE was introduced in MariaDB 10.3.\n \nSyntax\n------ \nCREATE [OR REPLACE] [TEMPORARY] SEQUENCE [IF NOT EXISTS]\nsequence_name\n[ INCREMENT [ BY | = ] increment ]\n[ MINVALUE [=] minvalue | NO MINVALUE | NOMINVALUE ]\n[ MAXVALUE [=] maxvalue | NO MAXVALUE | NOMAXVALUE ]\n[ START [ WITH | = ] start ] \n[ CACHE [=] cache | NOCACHE ] [ CYCLE | NOCYCLE] \n[table_options]\n \nThe options for CREATE SEQUENCE can be given in any order,\noptionally followed by table_options.\n \ntable_options can be any of the normal table options in\nCREATE TABLE but the most usable ones are ENGINE=... and\nCOMMENT=.\n \nNOMAXVALUE and NOMINVALUE are there to allow one to create\nSEQUENCEs using the Oracle syntax.\n \nDescription\n----------- \nCREATE SEQUENCE will create a sequence that generates new\nvalues when called with NEXT VALUE FOR sequence_name. It\'s\nan alternative to AUTO INCREMENT when one wants to have more\ncontrol of how the numbers are generated. As the SEQUENCE\ncaches values (up to CACHE) it can in some cases be much\nfaster than AUTO INCREMENT. Another benefit is that one can\naccess the last value generated by all used sequences, which\nsolves one of the limitations with LAST_INSERT_ID().\n \nCREATE SEQUENCE requires the CREATE privilege.\n \nDROP SEQUENCE can be used to drop a sequence, and ALTER\nSEQUENCE to change it.\n \nArguments to Create\n \nThe following options may be used:\n \nOption | Default value |  Description | \n \nINCREMENT |  1 | Increment to use for values. May be\nnegative. Setting an increment of 0 causes the sequence to\nuse the value of the auto_increment_increment system\nvariable at the time of creation, which is always a positive\nnumber. (see MDEV-16035). | \n \nMINVALUE | 1 if INCREMENT > 0 and -9223372036854775807 if\nINCREMENT < 0 | Minimum value for the sequence | \n \nMAXVALUE | 9223372036854775806 if INCREMENT > 0 and -1 if\nINCREMENT < 0 | Max value for sequence | \n \nSTART | MINVALUE if INCREMENT > 0 and MAX_VALUE if\nINCREMENT< 0 | First value that the sequence will generate |\n\n \nCACHE | 1000 |  Number of values that should be cached. 0\nif no CACHE. The underlying table will be updated first time\na new sequence number is generated and each time the cache\nruns out. | \n \nIf CYCLE is used then the sequence should start again from\nMINVALUE after it has run out of values. Default value is\nNOCYCLE.\n \nConstraints on Create Arguments\n \nTo be able to create a legal sequence, the following must\nhold:\nMAXVALUE >= start\nMAXVALUE > MINVALUE\nSTART >= MINVALUE\nMAXVALUE = -9223372036854775807 (LONGLONG_MIN+1)\n \nNote that sequences can\'t generate the maximum/minimum 64\nbit number because of the constraint of\nMINVALUE and MAXVALUE. \n \nExamples\n-------- \nCREATE SEQUENCE s START WITH 100 INCREMENT BY 10;\n \nCREATE SEQUENCE s2 START WITH -100 INCREMENT BY -10;\n \nThe following statement fails, as the increment conflicts\nwith the defaults\n \nCREATE SEQUENCE s3 START WITH -100 INCREMENT BY 10;\n \nERROR 4082 (HY000): Sequence \'test.s3\' values are\nconflicting\n \nThe sequence can be created by specifying workable minimum\nand maximum values:\n \nCREATE SEQUENCE s3 START WITH -100 INCREMENT BY 10\nMINVALUE=-100 MAXVALUE=1000;\n \n\n\nURL: https://mariadb.com/kb/en/create-sequence/','','https://mariadb.com/kb/en/create-sequence/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (664,39,'CREATE SERVER','Syntax\n------ \nCREATE [OR REPLACE] SERVER [IF NOT EXISTS] 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 \nDescription\n----------- \nThis statement creates the definition of a server for use\nwith the Spider,\nFEDERATED or FederatedX storage\nengine. The CREATE SERVER statement creates a new row within\nthe\nservers table within the mysql database. This statement\nrequires the SUPER privilege.\n \nThe server_name should be a unique reference to the server.\nServer definitions\nare global within the scope of the server, it is not\npossible to qualify the\nserver definition to a specific database. server_name has a\nmaximum length of\n64 characters (names longer than 64 characters are silently\ntruncated), and is\ncase insensitive. You may specify the name as a quoted\nstring.\n \nThe wrapper_name should be mysql, and may be quoted with\nsingle quotes.\nOther values for wrapper_name are not currently supported.\n \nFor each option you must specify either a character literal\nor numeric literal.\nCharacter literals are UTF-8, support a maximum length of 64\ncharacters and\ndefault to a blank (empty) string. String literals are\nsilently truncated to 64\ncharacters. Numeric literals must be a number between 0 and\n9999, default value\nis 0.\n \nNote: The OWNER option is currently not applied, and has no\neffect on\nthe ownership or operation of the server connection that is\ncreated.\n \nThe CREATE SERVER statement creates an entry in the\nmysql.servers table that can later be used with the\nCREATE TABLE statement when creating a Spider, FederatedX or\nFEDERATED table. The options that you specify will\nbe used to populate the columns in the mysql.servers table.\nThe table columns\nare Server_name, Host, Db, Username, Password, Port and\nSocket.\n \n DROP SERVER removes a previously created server definition.\n\n \nCREATE SERVER is not written to the binary log, irrespective\nof\nthe binary log format being used.\n \nFor valid identifiers to use as server names, see Identifier\nNames.\n \nOR REPLACE\n \nIf the optional OR REPLACE clause is used, it acts as a\nshortcut for:\n \nDROP SERVER IF EXISTS name;\n \nCREATE SERVER server_name ...;\n \nIF NOT EXISTS\n \nIf the IF NOT EXISTS clause is used, MariaDB will return a\nwarning instead of an error if the server already exists.\nCannot be used together with OR REPLACE.\n \nExamples\n-------- \nCREATE SERVER s\nFOREIGN DATA WRAPPER mysql\nOPTIONS (USER \'Remote\', HOST \'192.168.1.106\', DATABASE\n\'test\');\n \nOR REPLACE and IF NOT EXISTS:\n \nCREATE SERVER s \nFOREIGN DATA WRAPPER mysql \nOPTIONS (USER \'Remote\', HOST \'192.168.1.106\', DATABASE\n\'test\');\nERROR 1476 (HY000): The foreign server, s, you are trying to\ncreate already exists\n \nCREATE OR REPLACE SERVER s \nFOREIGN DATA WRAPPER mysql \nOPTIONS (USER \'Remote\', HOST \'192.168.1.106\', DATABASE\n\'test\');\nQuery OK, 0 rows affected (0.00 sec)\n \nCREATE SERVER IF NOT EXISTS s \nFOREIGN DATA WRAPPER mysql \nOPTIONS (USER \'Remote\', HOST \'192.168.1.106\', DATABASE\n\'test\');\nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+-------+------+----------------------------------------------------------------+\n| Level | Code | Message |\n+-------+------+----------------------------------------------------------------+\n| Note | 1476 | The foreign server, s, you are trying to\ncreate already exists |\n+-------+------+----------------------------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/create-server/','','https://mariadb.com/kb/en/create-server/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (665,39,'CREATE TABLE','Syntax\n------ \nCREATE [OR REPLACE] [TEMPORARY] TABLE [IF NOT EXISTS]\ntbl_name\n (create_definition,...) [table_options ]...\n[partition_options]\nCREATE [OR REPLACE] [TEMPORARY] TABLE [IF NOT EXISTS]\ntbl_name\n [(create_definition,...)] [table_options ]...\n[partition_options]\n select_statement\nCREATE [OR REPLACE] [TEMPORARY] TABLE [IF NOT EXISTS]\ntbl_name\n { LIKE old_table_name | (LIKE old_table_name) }\n \nselect_statement:\n [IGNORE | REPLACE] [AS] SELECT ... (Some legal select\nstatement)\n \nDescription\n----------- \nUse the CREATE TABLE statement to create a table with the\ngiven name.\n \nIn its most basic form, the CREATE TABLE statement provides\na table name\nfollowed by a list of columns, indexes, and constraints. By\ndefault, the table\nis created in the default database. Specify a database with\ndb_name.tbl_name.\nIf you quote the table name, you must quote the database\nname and table name\nseparately as `db_name`.`tbl_name`. This is particularly\nuseful for CREATE TABLE ... SELECT, because it allows to\ncreate a table into a database, which contains data from\nother databases. See Identifier Qualifiers.\n \nIf a table with the same name exists, error 1050 results.\nUse IF NOT EXISTS\nto suppress this error and issue a note instead. Use SHOW\nWARNINGS\nto see notes.\n \nThe CREATE TABLE statement automatically commits the current\ntransaction,\nexcept when using the TEMPORARY keyword.\n \nFor valid identifiers to use as table names, see Identifier\nNames.\n \nNote: if the default_storage_engine is set to ColumnStore\nthen it needs setting on all UMs. Otherwise when the tables\nusing the default engine are replicated across UMs they will\nuse the wrong engine. You should therefore not use this\noption as a session variable with ColumnStore.\n \nMicrosecond precision can be between 0-6. If no precision is\nspecified it is assumed to be 0, for backward compatibility\nreasons.\n \nPrivileges\n \nExecuting the CREATE TABLE statement requires the CREATE\nprivilege for the table or the database.\n \nCREATE OR REPLACE TABLE ...\n \nThe OR REPLACE clause was added in MariaDB 10.0.8.\n \nIf the OR REPLACE clause is used and if the table already\nexists, then instead of returning an error, the server will\ndrop the existing table and replace it with the newly\ndefined table.\n \nThis syntax was originally added to make replication more\nrobust if it has to rollback and repeat statements such as\nCREATE ... SELECT on slaves.\n \nCREATE OR REPLACE TABLE table_name (a int);\n \nis basically the same as:\n \nDROP TABLE IF EXISTS table_name;\nCREATE TABLE table_name (a int);\n \nwith the following exceptions:\nIf table_name was locked with LOCK TABLES it will continue\nto be locked after the statement.\nTemporary tables are only dropped if the TEMPORARY keyword\nwas used. (With DROP TABLE, temporary tables are preferred\nto be dropped before normal tables).\n \nThings to be Aware of With CREATE OR REPLACE\n \nThe table is dropped first (if it existed), after that the\nCREATE is done. Because of this, if the CREATE fails, then\nthe table will not exist anymore after the statement. If the\ntable was used with LOCK TABLES it will be unlocked.\nOne can\'t use OR REPLACE together with IF EXISTS.\nSlaves in replication will by default use CREATE OR REPLACE\nwhen replicating CREATE statements that don\'\'t use IF\nEXISTS. This can be changed by setting the variable\nslave-ddl-exec-mode to STRICT.\n \nCREATE TABLE IF NOT EXISTS ...\n \nIf the IF NOT EXISTS clause is used, then the index will\nonly be created if an index with the same name does not\nalready exist. If the index already exists, then a warning\nwill be triggered by default.\n \nCREATE TEMPORARY TABLE ...\n \nUse the TEMPORARY keyword to create a temporary table that\nis only available to your current session. Temporary tables\nare dropped when the your session ends. Temporary table\nnames are specific to your session. They will not conflict\nwith other temporary tables from other session even if they\nshare the same name. They will shadow names of non-temporary\ntables or views, if they are identical. A temporary table\ncan have the same name as a non-temporary table which is\nlocated in the same database. In that case, their name will\nreference the temporary table when used in SQL statements.\nYou must have the CREATE TEMPORARY TABLES privilege on the\ndatabase to create temporary tables. If no storage engine is\nspecified, the default_tmp_storage_engine setting will\ndetermine the engine.\n \nCREATE TABLE ... LIKE\n \nUse the LIKE clause instead of a full table definition to\ncreate a table with the same definition as another table,\nincluding columns, indexes, and table options. Foreign key\ndefinitions, as well as any DATA DIRECTORY or INDEX\nDIRECTORY table options specified on the original table,\nwill not be created.\n \nCREATE TABLE ... SELECT\n \nYou can create a table containing data from other tables\nusing the CREATE ... SELECT statement. Columns will be\ncreated in the table for each field returned by the SELECT\nquery.\n \nYou can also define some columns normally and add other\ncolumns from a SELECT. You can also create columns in the\nnormal way and assign them some values using the query, this\nis done to force a certain type or other field\ncharacteristics. The columns that are not named in the query\nwill be placed before the others. For example:\n \nCREATE TABLE test (a INT NOT NULL, b CHAR(10)) ENGINE=MyISAM\n SELECT 5 AS b, c, d FROM another_table;\n \nRemember that the query just returns data. If you want to\nuse the same indexes, or the same columns attributes ([NOT]\nNULL, DEFAULT, AUTO_INCREMENT) in the new table, you need to\nspecify them manually. Types and sizes are not automatically\npreserved if no data returned by the SELECT requires the\nfull size, and VARCHAR could be converted into CHAR. The\nCAST() function can be used to forcee the new table to use\ncertain types.\n \nAliases (AS) are taken into account, and they should always\nbe used when you SELECT an expression (function,\narithmetical operation, etc).\n \nIf an error occurs during the query, the table will not be\ncreated at all.\n \nIf the new table has a primary key or UNIQUE indexes, you\ncan use the IGNORE or REPLACE keywords to handle duplicate\nkey errors during the query. IGNORE means that the newer\nvalues must not be inserted an identical value exists in the\nindex. REPLACE means that older values must be overwritten.\n \nIf the columns in the new table are more than the rows\nreturned by the query, the columns populated by the query\nwill be placed after other columns. Note that if the strict\nSQL_MODE is on, and the columns that are not names in the\nquery do not have a DEFAULT value, an error will raise and\nno rows will be copied.\n \nConcurrent inserts are not used during the execution of a\nCREATE ... SELECT.\n \nIf the table already exists, an error similar to the\nfollowing will be returned:\n \nERROR 1050 (42S01): Table \'t\' already exists\n \nIf the IF NOT EXISTS clause is used and the table exists, a\nnote will be produced instead of an error.\n \nTo insert rows from a query into an existing table, INSERT\n... SELECT can be used.\n \nColumn Definitions\n \ncreate_definition:\n { col_name column_definition | index_definition |\nperiod_definition | CHECK (expr) }\n \ncolumn_definition:\n data_type\n [NOT NULL | NULL] [DEFAULT default_value | (expression)]\n [AUTO_INCREMENT] [ZEROFILL] [UNIQUE [KEY] | [PRIMARY] KEY]\n [INVISIBLE] [{WITH|WITHOUT} SYSTEM VERSIONING]\n [COMMENT \'string\']\n [COLUMN_FORMAT {FIXED|DYNAMIC|DEFAULT}]\n [reference_definition]\n | data_type [GENERATED ALWAYS] \n AS { { ROW {START|END} } | { (expression) [VIRTUAL |\nPERSISTENT | STORED] } }\n [UNIQUE [KEY]] [COMMENT \'string\']\n \nconstraint_definition:\n CONSTRAINT [constraint_name] CHECK (expression)\nNote: MariaDB accepts the REFERENCES clause in ALTER TABLE\nand CREATE TABLE column definitions, but that syntax does\nnothing. MariaDB simply parses it without returning any\nerror or warning, for compatibility with other DBMS\'s.\nBefore MariaDB 10.2.1 this was also true for CHECK\nconstraints. Only the syntax for indexes described below\ncreates foreign keys.\n \nEach definition either creates a column in the table or\nspecifies and index or\nconstraint on one or more columns. See Indexes below for\ndetails\non creating indexes.\n \nCreate a column by specifying a column name and a data type,\noptionally\nfollowed by column options. See Data Types for a full list\nof data types allowed in MariaDB.\n \nNULL and NOT NULL\n \nUse the NULL or NOT NULL options to specify that values in\nthe column\nmay or may not be NULL, respectively. By default, values may\nbe NULL. See also NULL Values in MariaDB.\n \nDEFAULT Column Option\n \nThe DEFAULT clause was enhanced in MariaDB 10.2.1. Some\nenhancements include\nBLOB and TEXT columns now support DEFAULT.\nThe DEFAULT clause can now be used with an expression or\nfunction.\n \nSpecify a default value using the DEFAULT clause. If you\ndon\'t specify DEFAULT then the following rules apply:\nIf the column is not defined with NOT NULL, AUTO_INCREMENT\nor TIMESTAMP, an explicit DEFAULT NULL will be added.\nNote that in MySQL and in MariaDB before 10.1.6, you may get\nan explicit DEFAULT for primary key parts, if not specified\nwith NOT NULL.\n \nThe default value will be used if you INSERT a row without\nspecifying a value for that column, or if you specify\nDEFAULT for that column.\nBefore MariaDB 10.2.1 you couldn\'t usually provide an\nexpression or function to evaluate at\ninsertion time. You had to provide a constant default value\ninstead. The one\nexception is that you may use CURRENT_TIMESTAMP as\nthe default value for a TIMESTAMP column to use the current\ntimestamp at insertion time.\n \nCURRENT_TIMESTAMP may also be used as\nthe default value for a DATETIME\n \nFrom MariaDB 10.2.1 you can use most functions in DEFAULT.\nExpressions should have parentheses around them. If you use\na non deterministic function in DEFAULT then all inserts to\nthe table will be replicated in row mode. You can even refer\nto earlier columns in the DEFAULT expression:\n \nCREATE TABLE t1 (a int DEFAULT (1+1), b int DEFAULT (a+1));\nCREATE TABLE t2 (a bigint primary key DEFAULT UUID_SHORT());\n \nThe DEFAULT clause cannot contain any stored functions or\nsubqueries, and a column used in the clause must already\nhave been defined earlier in the statement.\n \nSince MariaDB 10.2.1, it is possible to assign BLOB or TEXT\ncolumns a DEFAULT value. In earlier versions, assigning a\ndefault to these columns was not possible.\n \nStarting from 10.3.3 you can also use DEFAULT (NEXT VALUE\nFOR sequence)\n \nAUTO_INCREMENT Column Option\n \nUse AUTO_INCREMENT to create a column whose value can\ncan be set automatically from a simple counter. You can only\nuse AUTO_INCREMENT\non a column with an integer type. The column must be a key,\nand there can only be\none AUTO_INCREMENT column in a table. If you insert a row\nwithout specifying\na value for that column (or if you specify 0, NULL, or\nDEFAULT\nas the value), the actual value will be taken from the\ncounter, with each insertion\nincrementing the counter by one. You can still insert a\nvalue explicitly. If you\ninsert a value that is greater than the current counter\nvalue, the counter is\nset based on the new value. An AUTO_INCREMENT column is\nimplicitly NOT NULL.\nUse LAST_INSERT_ID to get the AUTO_INCREMENT value\nmost recently used by an INSERT statement.\n \nZEROFILL Column Option\n \nIf the ZEROFILL column option is specified for a column\nusing a numeric data type, then the column will be set to\nUNSIGNED and the spaces used by default to pad the field are\nreplaced with zeros. ZEROFILL is ignored in expressions or\nas part of a UNION. ZEROFILL is a non-standard MySQL and\nMariaDB enhancement.\n \nPRIMARY KEY Column Option\n \nUse PRIMARY KEY (or just KEY) to make a column a primary\nkey. A primary key is a special type of a unique key. There\ncan be at most one primary key per table, and it is\nimplicitly NOT NULL.\n \nSpecifying a column as a unique key creates a unique index\non that column. See the Index Definitions section below for\nmore information.\n \nUNIQUE KEY Column Option\n \nUse UNIQUE KEY (or just UNIQUE) to specify that all values\nin the column\nmust be distinct from each other. Unless the column is NOT\nNULL, there may be\nmultiple rows with NULL in the column. \n \nSpecifying a column as a unique key creates a unique index\non that column. See the Index Definitions section below for\nmore information.\n \nCOMMENT Column Option\n \nYou can provide a comment for each column using the COMMENT\nclause. The maximum length is 1024 characters (it was 255\ncharacters before MariaDB 5.5). Use\nthe SHOW FULL COLUMNS statement to see column comments.\n \nGenerated Columns\n \nA generated column is a column in a table that cannot\nexplicitly be set to a specific value in a DML query.\nInstead, its value is automatically generated based on an\nexpression. This expression might generate the value based\non the values of other columns in the table, or it might\ngenerate the value by calling built-in functions or\nuser-defined functions (UDFs).\n \nThere are two types of generated columns:\nPERSISTENT or STORED: This type\'s value is actually stored\nin the table.\nVIRTUAL: This type\'s value is not stored at all. Instead,\nthe value is generated dynamically when the table is\nqueried. This type is the default.\n \nGenerated columns are also sometimes called computed columns\nor virtual columns.\n \nFor a complete description about generated columns and their\nlimitations, see Generated (Virtual and Persistent/Stored)\nColumns.\n \nCOLUMN_FORMAT\n \nCOLUMN_FORMAT is only used by MySQL Cluster, and is silently\nignored in MariaDB.\n \nCOMPRESSED\n \nCertain columns may be compressed. See Storage-Engine\nIndependent Column Compression.\n \nINVISIBLE\n \nColumns may be made invisible, and hidden in certain\ncontexts. See Invisible Columns.\n \nWITH SYSTEM VERSIONING Column Option\n \nColumns may be explicitly marked as included from system\nversioning. See System-versioned tables for details.\n \nWITHOUT SYSTEM VERSIONING Column Option\n \nColumns may be explicitly marked as excluded from system\nversioning. See System-versioned tables for details.\n \nIndex Definitions\n \nindex_definition:\n {INDEX|KEY} [index_name] [index_type] (index_col_name,...)\n[index_option] ...\n | {FULLTEXT|SPATIAL} [INDEX|KEY] [index_name]\n(index_col_name,...) [index_option] ...\n | [CONSTRAINT [symbol]] PRIMARY KEY [index_type]\n(index_col_name,...) [index_option] ...\n | [CONSTRAINT [symbol]] UNIQUE [INDEX|KEY] [index_name]\n[index_type] (index_col_name,...) [index_option] ...\n | [CONSTRAINT [symbol]] FOREIGN KEY [index_name]\n(index_col_name,...) reference_definition\n \nindex_col_name:\n col_name [(length)] [ASC | DESC]\n \nindex_type:\n USING {BTREE | HASH | RTREE}\n \nindex_option:\n KEY_BLOCK_SIZE [=] value\n | index_type\n | WITH PARSER parser_name\n | COMMENT \'string\'\n | CLUSTERING={YES| NO}\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\nINDEX and KEY are synonyms. \n \nIndex names are optional, if not specified an automatic name\nwill be assigned. Index name are needed to drop indexes and\nappear in error messages when a constraint is violated.\n \nIndex Categories\n \nPlain Indexes\n \nPlain indexes are regular indexes that are not unique, and\nare not acting as a primary key or a foreign key. They are\nalso not the \"specialized\" FULLTEXT or SPATIAL indexes.\n \nSee Getting Started with Indexes: Plain Indexes for more\ninformation.\n \nPRIMARY KEY\n \nFor PRIMARY KEY indexes, you can specify a name for the\nindex, but it is silently ignored, and the name of the index\nis always PRIMARY.\n \nSee Getting Started with Indexes: Primary Key for more\ninformation.\n \nUNIQUE\n \nThe UNIQUE keyword means that the index will not accept\nduplicated values, except for NULLs. An error will raise if\nyou try to insert duplicate values in a UNIQUE index.\n \nFor UNIQUE indexes, you can specify a name for the\nconstraint, using the CONSTRAINT keyword. That name will be\nused in error messages.\n \nSee Getting Started with Indexes: Unique Index for more\ninformation.\n \nFOREIGN KEY\n \nFor FOREIGN KEY indexes, a reference definition must be\nprovided.\n \nFor FOREIGN KEY indexes, you can specify a name for the\nconstraint, using the CONSTRAINT keyword. That name will be\nused in error messages.\n \nFirst, you have to specify the name of the target (parent)\ntable and a column or a column list which must be indexed\nand whose values must match to the foreign key\'s values.\nThe MATCH clause is accepted to improve the compatibility\nwith other DBMS\'s, but has no meaning in MariaDB. The ON\nDELETE and ON UPDATE clauses specify what must be done when\na DELETE (or a REPLACE) statements attempts to delete a\nreferenced row from the parent table, and when an UPDATE\nstatement attempts to modify the referenced foreign key\ncolumns in a parent table row, respectively. The following\noptions are allowed:\nRESTRICT: The delete/update operation is not performed. The\nstatement terminates with a 1451 error (SQLSTATE \'2300\').\nNO ACTION: Synonym for RESTRICT.\nCASCADE: The delete/update operation is performed in both\ntables.\nSET NULL: The update or delete goes ahead in the parent\ntable, and the corresponding foreign key fields in the child\ntable are set to NULL. (They must not be defined as NOT NULL\nfor this to succeed).\nSET DEFAULT: This option is currently implemented only for\nthe PBXT storage engine, which is disabled by default and no\nlonger maintained. It sets the child table\'s foreign key\nfields to their DEFAULT values when the referenced parent\ntable key entries are updated or deleted.\n \nIf either clause is omitted, the default behavior for the\nomitted clause is RESTRICT.\n \nSee Foreign Keys for more information.\n \nFULLTEXT\n \nUse the FULLTEXT keyword to create full-text indexes.\n \nSee Full-Text Indexes for more information.\n \nSPATIAL\n \nUse the SPATIAL keyword to create geometric indexes.\n \nSee SPATIAL INDEX for more information.\n \nIndex Options\n \nKEY_BLOCK_SIZE Index Option\n \nThe KEY_BLOCK_SIZE index option is similar to the\nKEY_BLOCK_SIZE table option.\n \nWith the InnoDB storage engine, if you specify a non-zero\nvalue for the KEY_BLOCK_SIZE table option for the whole\ntable, then the table will implicitly be created with the\nROW_FORMAT table option set to COMPRESSED. However, this\ndoes not happen if you just set the KEY_BLOCK_SIZE index\noption for one or more indexes in the table. The InnoDB\nstorage engine ignores the KEY_BLOCK_SIZE index option.\nHowever, the SHOW CREATE TABLE statement may still report it\nfor the index.\n \nFor information about the KEY_BLOCK_SIZE index option, see\nthe KEY_BLOCK_SIZE table option below.\n \nIndex Types\n \nEach storage engine supports some or all index types. See\nStorage Engine Index Types for details on permitted index\ntypes for each storage engine.\n \nDifferent index types are optimized for different kind of\noperations:\nBTREE is the default type','','https://mariadb.com/kb/en/create-table/');
-update help_topic set description = CONCAT(description, ', and normally is the best choice.\nIt is supported by all storage engines. It can be used to\ncompare a column\'s value with a value using the =, >, >=,\n0) ,b int check (b> 0), constraint abc check (a>b));\n \nIf you use the second format and you don\'t give a name to\nthe constraint, then the constraint will get a auto\ngenerated name. This is done so that you can later delete\nthe constraint with ALTER TABLE DROP constraint_name.\n \nOne can disable all constraint expression checks by setting\nthe variable check_constraint_checks to OFF. This is useful\nfor example when loading a table that violates some\nconstraints that you want to later find and fix in SQL.\n \nSee CONSTRAINT for more information.\n \nTable Options\n \nFor each individual table you create (or alter), you can set\nsome table options. The general syntax for setting options\nis:\n \n = , [ = ...]\n \nThe equal sign is optional.\n \nSome options are supported by the server and can be used for\nall tables, no matter what storage engine they use; other\noptions can be specified for all storage engines, but have a\nmeaning only for some engines. Also, engines can extend\nCREATE TABLE with new options.\n \nIf the IGNORE_BAD_TABLE_OPTIONS SQL_MODE is enabled, wrong\ntable options generate a warning; otherwise, they generate\nan error.\n \ntable_option: \n [STORAGE] 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 | ENCRYPTED [=] {YES | NO}\n | ENCRYPTION_KEY_ID [=] value\n | IETF_QUOTES [=] {YES | NO}\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 | PAGE_CHECKSUM [=] {0 | 1}\n | PAGE_COMPRESSED [=] {0 | 1}\n | PAGE_COMPRESSION_LEVEL [=] {0 .. 9}\n | PASSWORD [=] \'string\'\n | ROW_FORMAT [=]\n{DEFAULT|DYNAMIC|FIXED|COMPRESSED|REDUNDANT|COMPACT|PAGE}\n | SEQUENCE [=] {0|1}\n | STATS_AUTO_RECALC [=] {DEFAULT|0|1}\n | STATS_PERSISTENT [=] {DEFAULT|0|1}\n | STATS_SAMPLE_PAGES [=] {DEFAULT|value}\n | TABLESPACE tablespace_name\n | TRANSACTIONAL [=] {0 | 1}\n | UNION [=] (tbl_name[,tbl_name]...)\n | WITH SYSTEM VERSIONING\n \n[STORAGE] ENGINE\n \n[STORAGE] ENGINE specifies a storage engine for the table.\nIf this option is not used, the default storage engine is\nused instead. That is, the storage_engine session option\nvalue if it is set, or the value specified for the\n--default-storage-engine mysqld startup options, or InnoDB.\nIf the specified storage engine is not installed and active,\nthe default value will be used, unless the\nNO_ENGINE_SUBSTITUTION SQL MODE is set (default since\nMariaDB 10.0). This is only true for CREATE TABLE, not for\nALTER TABLE. For a list of storage engines that are present\nin your server, issue a SHOW ENGINES.\n \nAUTO_INCREMENT\n \nAUTO_INCREMENT specifies the initial value for the\nAUTO_INCREMENT primary key. This works for MyISAM, Aria,\nInnoDB/XtraDB, MEMORY, and ARCHIVE tables. You can change\nthis option with ALTER TABLE, but in that case the new value\nmust be higher than the highest value which is present in\nthe AUTO_INCREMENT column. If the storage engine does not\nsupport this option, you can insert (and then delete) a row\nhaving the wanted value - 1 in the AUTO_INCREMENT column.\n \nAVG_ROW_LENGTH\n \nAVG_ROW_LENGTH is the average rows size. It only applies to\ntables using MyISAM and Aria storage engines that have the\nROW_FORMAT table option set to FIXED format.\n \nMyISAM uses MAX_ROWS and AVG_ROW_LENGTH to decide the\nmaximum size of a table (default: 256TB, or the maximum file\nsize allowed by the system).\n \n[DEFAULT] CHARACTER SET/CHARSET\n \n[DEFAULT] CHARACTER SET (or [DEFAULT] CHARSET) is used to\nset a default character set for the table. This is the\ncharacter set used for all columns where an explicit\ncharacter set is not specified. If this option is omitted or\nDEFAULT is specified, database\'s default character set will\nbe used. See Setting Character Sets and Collations for\ndetails on setting the character sets.\n \nCHECKSUM/TABLE_CHECKSUM\n \nCHECKSUM (or TABLE_CHECKSUM) can be set to 1 to maintain a\nlive checksum for all table\'s rows. This makes write\noperations slower, but CHECKSUM TABLE will be very fast.\nThis option is only supported for MyISAM and Aria tables.\n \n[DEFAULT] COLLATE\n \n[DEFAULT] COLLATE is used to set a default collation for the\ntable. This is the collation used for all columns where an\nexplicit character set is not specified. If this option is\nomitted or DEFAULT is specified, database\'s default option\nwill be used. See Setting Character Sets and Collations for\ndetails on setting the collations\n \nCOMMENT\n \nCOMMENT is a comment for the table. Maximum length is 2048\ncharacters (before mariaDB 5.5 it was 60 characters). Also\nused to define table parameters when creating a Spider\ntable.\n \nCONNECTION\n \nCONNECTION is used to specify a server name or a connection\nstring for a Spider, CONNECT, Federated or FederatedX table.\n \nDATA DIRECTORY/INDEX DIRECTORY\n \nDATA DIRECTORY and INDEX DIRECTORY were only supported for\nMyISAM and Aria, before MariaDB 5.5. Since 5.5, DATA\nDIRECTORY has also been supported by InnoDB if the\ninnodb_file_per_table server system variable is enabled, but\nonly in CREATE TABLE, not in ALTER TABLE. So, carefully\nchoose a path for InnoDB tables at creation time, because it\ncannot be changed without dropping and re-creating the\ntable. These options specify the paths for data files and\nindex files, respectively. If these options are omitted, the\ndatabase\'s directory will be used to store data files and\nindex files. Note that these table options do not work for\npartitioned tables (use the partition options instead), or\nif the server has been invoked with the\n--skip-symbolic-links startup option. To avoid the\noverwriting of old files with the same name that could be\npresent in the directories, you can use the\n--keep_files_on_create option (an error will be issued if\nfiles already exist). These options are ignored if the\nNO_DIR_IN_CREATE SQL_MODE is enabled (useful for replication\nslaves). Also note that symbolic links cannot be used for\nInnoDB tables.\n \nDATA DIRECTORY works by creating symlinks from where the\ntable would normally have been (inside the datadir) to where\nthe option specifies. For security reasons, to avoid\nbypassing the privilege system, the server does not permit\nsymlinks inside the datadir. Therefore, DATA DIRECTORY\ncannot be used to specify a location inside the datadir. An\nattempt to do so will result in an error 1210 (HY000)\nIncorrect arguments to DATA DIRECTORY.\n \nDELAY_KEY_WRITE\n \nDELAY_KEY_WRITE is supported by MyISAM and Aria, and can be\nset to 1 to speed up write operations. In that case, when\ndata are modified, the indexes are not updated until the\ntable is closed. Writing the changes to the index file\naltogether can be much faster. However, note that this\noption is applied only if the delay_key_write server\nvariable is set to \'ON\'. If it is \'OFF\' the delayed\nindex writes are always disabled, and if it is \'ALL\' the\ndelayed index writes are always used, disregarding the value\nof DELAY_KEY_WRITE.\n \nENCRYPTED\n \nThe ENCRYPTED table option was added in MariaDB 10.1.4\n \nThe ENCRYPTED table option can be used to manually set the\nencryption status of an InnoDB table. See InnoDB / XtraDB\nEncryption for more information.\n \nAria does not currently support the ENCRYPTED table option.\nSee MDEV-18049 about that.\n \nSee Data-at-Rest Encryption for more information.\n \nENCRYPTION_KEY_ID\n \nThe ENCRYPTION_KEY_ID table option was added in MariaDB\n10.1.4\n \nThe ENCRYPTION_KEY_ID table option can be used to manually\nset the encryption key of an InnoDB table. See InnoDB /\nXtraDB Encryption for more information.\n \nAria does not currently support the ENCRYPTION_KEY_ID table\noption. See MDEV-18049 about that.\n \nSee Data-at-Rest Encryption for more information.\n \nIETF_QUOTES\n \nThe IETF_QUOTES option was added in MariaDB 10.1.8\n \nFor the CSV storage engine, the IETF_QUOTES option, when set\nto YES, enables IETF-compatible parsing of embedded quote\nand comma characters. Enabling this option for a table\nimproves compatibility with other tools that use CSV, but is\nnot compatible with MySQL CSV tables, or MariaDB CSV tables\ncreated without this option. Disabled by default.\n \nINSERT_METHOD\n \nINSERT_METHOD is only used with MERGE tables. This option\ndetermines in which underlying table the new rows should be\ninserted. If you set it to \'NO\' (which is the default) no\nnew rows can be added to the table (but you will still be\nable to perform INSERTs directly against the underlying\ntables). FIRST means that the rows are inserted into the\nfirst table, and LAST means that thet are inserted into the\nlast table.\n \nKEY_BLOCK_SIZE\n \nKEY_BLOCK_SIZE is used to determine the size of key blocks,\nin bytes or kilobytes. However, this value is just a hint,\nand the storage engine could modify or ignore it. If\nKEY_BLOCK_SIZE is set to 0, the storage engine\'s default\nvalue will be used.\n \nWith the InnoDB storage engine, if you specify a non-zero\nvalue for the KEY_BLOCK_SIZE table option for the whole\ntable, then the table will implicitly be created with the\nROW_FORMAT table option set to COMPRESSED.\n \nMIN_ROWS/MAX_ROWS\n \nMIN_ROWS and MAX_ROWS let the storage engine know how many\nrows you are planning to store as a minimum and as a\nmaximum. These values will not be used as real limits, but\nthey help the storage engine to optimize the table. MIN_ROWS\nis only used by MEMORY storage engine to decide the minimum\nmemory that is always allocated. MAX_ROWS is used to decide\nthe minimum size for indexes.\n \nPACK_KEYS\n \nPACK_KEYS can be used to determine whether the indexes will\nbe compressed. Set it to 1 to compress all keys. With a\nvalue of 0, compression will not be used. With the DEFAULT\nvalue, only long strings will be compressed. Uncompressed\nkeys are faster.\n \nPAGE_CHECKSUM\n \nPAGE_CHECKSUM is only applicable to Aria tables, and\ndetermines whether indexes and data should use page\nchecksums for extra safety. \n \nPAGE_COMPRESSED\n \nPAGE_COMPRESSED is used to enable InnoDB page compression\nfor InnoDB tables.\n \nPAGE_COMPRESSION_LEVEL\n \nPAGE_COMPRESSION_LEVEL is used to set the compression level\nfor InnoDB page compression for InnoDB tables. The table\nmust also have the PAGE_COMPRESSED table option set to 1.\n \nValid values for PAGE_COMPRESSION_LEVEL are 1 (the best\nspeed) through 9 (the best compression), .\n \nPASSWORD\n \nPASSWORD is unused.\n \nRAID_TYPE\n \nRAID_TYPE is an obsolete option, as the raid support has\nbeen disabled since MySQL 5.0.\n \nROW_FORMAT\n \nThe ROW_FORMAT table option specifies the row format for the\ndata file. Possible values are engine-dependent.\n \nSupported MyISAM Row Formats\n \nFor MyISAM, the supported row formats are: \nFIXED\nDYNAMIC\nCOMPRESSED\n \nThe COMPRESSED row format can only be set by the myisampack\ncommand line tool.\n \nSee MyISAM Storage Formats for more information.\n \nSupported Aria Row Formats\n \nFor Aria, the supported row formats are:\nPAGE\nFIXED\nDYNAMIC.\n \nSee Aria Storage Formats for more information.\n \nSupported InnoDB Row Formats\n \nFor InnoDB/XtraDB, the supported row formats are:\nCOMPACT\nREDUNDANT\nCOMPRESSED\nDYNAMIC.\n \nIf the ROW_FORMAT table option is set to FIXED for an InnoDB\ntable, then the server will either return an error or a\nwarning depending on the value of the innodb_strict_mode\nsystem variable. If the innodb_strict_mode system variable\nis set to OFF, then a warning is issued, and MariaDB will\ncreate the table using the default row format for the\nspecific MariaDB server version. If the innodb_strict_mode\nsystem variable is set to ON, then an error will be raised.\n \nSee XtraDB/InnoDB Storage Formats for more information.\n \nOther Storage Engines and ROW_FORMAT\n \nOther storage engines do not support the ROW_FORMAT table\noption.\n \nSEQUENCE\n \nIf the table is a sequence, then it will have the SEQUENCE\nset to 1.\n \nSTATS_AUTO_RECALC\n \nSTATS_AUTO_RECALC is available only in MariaDB 10.0+. It\nindicates whether to automatically recalculate persistent\nstatistics (see STATS_PERSISTENT, below) for an InnoDB\ntable.\nIf set to 1, statistics will be recalculated when more than\n10% of the data has changed. When set to 0, stats will be\nrecalculated only when an ANALYZE TABLE is run. If set to\nDEFAULT, or left out, the value set by the\ninnodb_stats_auto_recalc system variable applies. See InnoDB\nPersistent Statistics.\n \nSTATS_PERSISTENT\n \nSTATS_PERSISTENT is available only in MariaDB 10.0+. It\nindicates whether the InnoDB statistics created by ANALYZE\nTABLE will remain on disk or not. It can be set to 1 (on\ndisk), 0 (not on disk, the pre-MariaDB 10 behavior), or\nDEFAULT (the same as leaving out the option), in which case\nthe value set by the innodb_stats_persistent system variable\nwill apply. Persistent statistics stored on disk allow the\nstatistics to survive server restarts, and provide better\nquery plan stability. See InnoDB Persistent Statistics.\n \nSTATS_SAMPLE_PAGES\n \nSTATS_SAMPLE_PAGES is available only in MariaDB 10.0+. It\nindicates how many pages are used to sample index\nstatistics. If 0 or DEFAULT, the default value, the\ninnodb_stats_sample_pages value is used. See InnoDB\nPersistent Statistics.\n \nTRANSACTIONAL\n \nTRANSACTIONAL is only applicable for Aria tables. In future\nAria tables created with this option will be fully\ntransactional, but currently this provides a form of crash\nprotection. See Aria Storage Engine for more details.\n \nUNION\n \nUNION must be specified when you create a MERGE table. This\noption contains a comma-separated list of MyISAM tables\nwhich are accessed by the new table. The list is enclosed\nbetween parenthesis. Example: UNION = (t1,t2)\n \nWITH SYSTEM VERSIONING\n \nWITH SYSTEM VERSIONING is used for creating System-versioned\ntables.\n \nPartitions\n \npartition_options:\n PARTITION BY\n { [LINEAR] HASH(expr)\n | [LINEAR] KEY(column_list)\n | RANGE(expr)\n | LIST(expr)\n | SYSTEM_TIME [INTERVAL time_quantity time_unit] [LIMIT\nnum] }\n [PARTITIONS num]\n [SUBPARTITION BY\n { [LINEAR] HASH(expr)\n | [LINEAR] KEY(column_list) }\n [SUBPARTITIONS num]\n ]\n [(partition_definition [, partition_definition] ...)]\n \npartition_definition:\n PARTITION partition_name\n [VALUES {LESS THAN {(expr) | MAXVALUE} | IN (value_list)}]\n [[STORAGE] ENGINE [=] engine_name]\n [COMMENT [=] \'comment_text\' ]\n [DATA DIRECTORY [=] \'data_dir\']\n [INDEX DIRECTORY [=] \'index_dir\']\n [MAX_ROWS [=] max_number_of_rows]\n [MIN_ROWS [=] min_number_of_rows]\n [TABLESPACE [=] tablespace_name]\n [NODEGROUP [=] node_group_id]\n [(subpartition_definition [, subpartition_definition] ...)]\n \nsubpartition_definition:\n SUBPARTITION logical_name\n [[STORAGE] ENGINE [=] engine_name]\n [COMMENT [=] \'comment_text\' ]\n [DATA DIRECTORY [=] \'data_dir\']\n [INDEX DIRECTORY [=] \'index_dir\']\n [MAX_ROWS [=] max_number_of_rows]\n [MIN_ROWS [=] min_number_of_rows]\n [TABLESPACE [=] tablespace_name]\n [NODEGROUP [=] node_group_id]\nIf the PARTITION BY clause is used, the table will be\npartitioned. A partition method must be explicitly indicated\nfor partitions and subpartitions. Partition methods are:\n[LINEAR] HASH creates a hash key which will be used to read\nand write rows. The partition function can be any valid SQL\nexpression which returns an INTEGER number. Thus, it is\npossible to use the HASH method on an integer column, or on\nfunctions which accept integer columns as an argument.\nHowever, VALUES LESS THAN and VALUES IN clauses can not be\nused with HASH. An example:\n \nCREATE TABLE t1 (a INT, b CHAR(5), c DATETIME)\n PARTITION BY HASH ( YEAR(c) );\n \n [LINEAR] HASH can be used for subpartitions, too.\n[LINEAR] KEY is similar to HASH, but the index has an even\ndistribution of data. Also, the expression can only be a\ncolumn or a list of columns. VALUES LESS THAN and VALUES IN\nclauses can not be used with KEY.\nRANGE partitions the rows using on a range of values, using\nthe VALUES LESS THAN operator. VALUES IN is not allowed with\nRANGE. The partition function can be any valid SQL\nexpression which returns a single value.\nLIST assignes partitions based on a table\'s column with a\nrestricted set of possible values. It is similar to RANGE,\nbut VALUES IN must be used for at least 1 columns, and\nVALUES LESS THAN is disallowed.\nSYSTEM_TIME partitioning is used for System-versioned tables\nto store historical data separately from current data.\n \nOnly HASH and KEY can be used for subpartitions, and they\ncan be [LINEAR].\n \nIt is possible to define up to 1024 partitions and\nsubpartitions.\n \nThe number of defined partitions can be optionally specified\nas PARTITION count. This can be done to avoid specifying all\npartitions individually. But you can also declare each\nindividual partition and, additionally, specify a PARTITIONS\ncount clause; in the case, the number of PARTITIONs must\nequal count.\n \nAlso see Partitioning Types Overview.\n \nSequences\n \nCREATE TABLE can also be used to create a SEQUENCE. See\nCREATE SEQUENCE and Sequence Overview.\n \nExamples\n-------- \ncreate table if not exists test (\na bigint auto_increment primary key,\nname varchar(128) charset utf8,\nkey name (name(32))\n) engine=InnoDB default charset latin1;\n \nThis example shows a couple of things:\nUsage of IF NOT EXISTS; If the table already existed, it\nwill not be created. There will not be any error for the\nclient, just a warning.\nHow to create a PRIMARY KEY that is automatically generated.\nHow to specify a table-specific character set and another\nfor a column.\nHow to create an index (name) that is only partly indexed\n(to save space).\n \nThe following clauses will work from MariaDB 10.2.1 only.\n \nCREATE TABLE t1(\n a int DEFAULT (1+1),\n b int DEFAULT (a+1),\n expires DATETIME DEFAULT(NOW() + INTERVAL 1 YEAR),\n x BLOB DEFAULT USER()\n);\n \n\n\nURL: https://mariadb.com/kb/en/create-table/') WHERE help_topic_id = 665;
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (666,39,'CREATE TABLESPACE','The CREATE TABLESPACE statement is not supported by MariaDB.\nIt was originally inherited from MySQL NDB Cluster. In MySQL\n5.7 and later, the statement is also supported for InnoDB.\nHowever, MariaDB has chosen not to include that specific\nfeature. See MDEV-19294 for more information.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/create-tablespace/','','https://mariadb.com/kb/en/create-tablespace/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (667,39,'CREATE TRIGGER','Syntax\n------ \nCREATE [OR REPLACE]\n [DEFINER = { user | CURRENT_USER | role | CURRENT_ROLE }]\n TRIGGER [IF NOT EXISTS] trigger_name trigger_time\ntrigger_event\n ON tbl_name FOR EACH ROW\n [{ FOLLOWS | PRECEDES } other_trigger_name ]\n trigger_stmt\n \nDescription\n----------- \nThis statement creates a new trigger. A trigger is a named\ndatabase\nobject that is associated with a table, and that activates\nwhen a\nparticular event occurs for the table. The trigger becomes\nassociated\nwith the table named tbl_name, which must refer to a\npermanent table.\nYou cannot associate a trigger with a TEMPORARY table or a\nview.\n \nCREATE TRIGGER requires the TRIGGER privilege for the table\nassociated\nwith the trigger. (Before MySQL 5.1.6, this statement\nrequires the\nSUPER privilege.)\n \nYou can have multiple triggers for the same trigger_time and\ntrigger_event.\n \nFor valid identifiers to use as trigger names, see\nIdentifier Names.\n \nOR REPLACE\n \nIf used and the trigger already exists, instead of an error\nbeing returned, the existing trigger will be dropped and\nreplaced by the newly defined trigger.\n \nDEFINER\n \nThe DEFINER clause determines the security context to be\nused when\nchecking access privileges at trigger activation time.\n \nIF NOT EXISTS\n \nIf the IF NOT EXISTS clause is used, the trigger will only\nbe created if a trigger of the same name does not exist. If\nthe trigger already exists, by default a warning will be\nreturned.\n \ntrigger_time\n \ntrigger_time is the trigger action time. It can be BEFORE or\nAFTER to\nindicate that the trigger activates before or after each row\nto be\nmodified.\n \ntrigger_event\n \ntrigger_event indicates the kind of statement that activates\nthe\ntrigger. The trigger_event can be one of the following:\nINSERT: The trigger is activated whenever a new row is\ninserted into the table; for example, through INSERT, LOAD\nDATA, and REPLACE statements.\nUPDATE: The trigger is activated whenever a row is modified;\nfor example, through UPDATE statements.\nDELETE: The trigger is activated whenever a row is deleted\nfrom the table; for example, through DELETE and REPLACE\nstatements. However, DROP TABLE and TRUNCATE statements on\nthe table do not activate this trigger, because they do not\nuse DELETE. Dropping a partition does not activate DELETE\ntriggers, either.\n \nFOLLOWS/PRECEDES other_trigger_name\n \nThe FOLLOWS other_trigger_name and PRECEDES\nother_trigger_name options were added in MariaDB 10.2.3 as\npart of supporting multiple triggers per action time.\nThis is the same syntax used by MySQL 5.7, although MySQL\n5.7 does not have multi-trigger support.\n \nFOLLOWS adds the new trigger after another trigger while\nPRECEDES adds the new trigger before another trigger. If\nneither option is used, the new trigger is added last for\nthe given action and time.\n \nFOLLOWS and PRECEDES are not stored in the trigger\ndefinition. However the trigger order is guaranteed to not\nchange over time. mysqldump and other backup methods will\nnot change trigger order.\nYou can verify the trigger order from the ACTION_ORDER\ncolumn in INFORMATION_SCHEMA.TRIGGERS table.\n \nSELECT trigger_name, action_order FROM\ninformation_schema.triggers \n WHERE event_object_table=\'t1\';\n \nExamples\n-------- \nCREATE DEFINER=`root`@`localhost` TRIGGER increment_animal\n AFTER INSERT ON animals FOR EACH ROW \n UPDATE animal_count SET animal_count.animals =\nanimal_count.animals+1;\n \nOR REPLACE and IF NOT EXISTS\n \nCREATE DEFINER=`root`@`localhost` TRIGGER increment_animal\n AFTER INSERT ON animals FOR EACH ROW\n UPDATE animal_count SET animal_count.animals =\nanimal_count.animals+1;\n \nERROR 1359 (HY000): Trigger already exists\n \nCREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER\nincrement_animal\n AFTER INSERT ON animals FOR EACH ROW\n UPDATE animal_count SET animal_count.animals =\nanimal_count.animals+1;\n \nQuery OK, 0 rows affected (0.12 sec)\n \nCREATE DEFINER=`root`@`localhost` TRIGGER IF NOT EXISTS\nincrement_animal\n AFTER INSERT ON animals FOR EACH ROW\n UPDATE animal_count SET animal_count.animals =\nanimal_count.animals+1;\n \nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+-------+------+------------------------+\n| Level | Code | Message |\n+-------+------+------------------------+\n| Note | 1359 | Trigger already exists |\n+-------+------+------------------------+\n1 row in set (0.00 sec)\n \n\n\nURL: https://mariadb.com/kb/en/create-trigger/','','https://mariadb.com/kb/en/create-trigger/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (668,39,'CREATE VIEW','Syntax\n------ \nCREATE\n [OR REPLACE]\n [ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}]\n [DEFINER = { user | CURRENT_USER | role | CURRENT_ROLE }]\n [SQL SECURITY { DEFINER | INVOKER }]\n VIEW [IF NOT EXISTS] view_name [(column_list)]\n AS select_statement\n [WITH [CASCADED | LOCAL] CHECK OPTION]\n \nDescription\n----------- \nThe CREATE VIEW statement creates a new view, or replaces an\nexisting\none if the OR REPLACE clause is given. If the view does not\nexist, CREATE OR\nREPLACE VIEW is the same as CREATE VIEW. If the view does\nexist, CREATE OR\nREPLACE VIEW is the same as ALTER VIEW.\n \nThe select_statement is a SELECT statement that provides the\ndefinition of\nthe view. (When you select from the view, you select in\neffect using the SELECT\nstatement.) select_statement can select from base tables or\nother views.\n \nThe view definition is \"frozen\" at creation time, so\nchanges to the underlying\ntables afterwards do not affect the view definition. For\nexample, if a view is\ndefined as SELECT * on a table, new columns added to the\ntable later do not\nbecome part of the view. A SHOW CREATE VIEW shows that\nsuch queries are rewritten and column names are included in\nthe view\ndefinition.\n \nThe view definition must be a query that does not return\nerrors at view\ncreation times. However, the base tables used by the views\nmight be altered\nlater and the query may not be valid anymore. In this case,\nquerying the view\nwill result in an error. CHECK TABLE helps in finding this\nkind\nof problems.\n \nThe ALGORITHM clause affects how MariaDB processes the\nview. The DEFINER and SQL SECURITY clauses specify the\nsecurity context to be\nused when checking access privileges at view invocation\ntime. The WITH CHECK\nOPTION clause can be given to constrain inserts or updates\nto rows in tables\nreferenced by the view. These clauses are described later in\nthis section.\n \nThe CREATE VIEW statement requires the CREATE VIEW privilege\nfor the\nview, and some privilege for each column selected by the\nSELECT\nstatement. For columns used elsewhere in the SELECT\nstatement you must\nhave the SELECT privilege. If the OR REPLACE clause is\npresent, you\nmust also have the DROP privilege for the view.\n \nA view belongs to a database. By default, a new view is\ncreated in the\ndefault database. To create the view explicitly in a given\ndatabase,\nspecify the name as db_name.view_name when you create it.\n \nCREATE VIEW test.v AS SELECT * FROM t;\n \nBase tables and views share the same namespace within a\ndatabase, so a\ndatabase cannot contain a base table and a view that have\nthe same\nname.\n \nViews must have unique column names with no duplicates, just\nlike base\ntables. By default, the names of the columns retrieved by\nthe SELECT\nstatement are used for the view column names. To define\nexplicit names\nfor the view columns, the optional column_list clause can be\ngiven as\na list of comma-separated identifiers. The number of names\nin\ncolumn_list must be the same as the number of columns\nretrieved by the\nSELECT statement.\n \nMySQL until 5.1.28\n \nPrior to MySQL 5.1.29, When you modify an existing view, the\ncurrent view definition is backed up and saved. It is stored\nin that\ntable\'s database directory, in a subdirectory named arc.\nThe backup\nfile for a view v is named v.frm-00001. If you alter the\nview again,\nthe next backup is named v.frm-00002. The three latest view\nbackup\ndefinitions are stored. Backed up view definitions are not\npreserved\nby mysqldump, or any other such programs, but you can retain\nthem\nusing a file copy operation. However, they are not needed\nfor anything\nbut to provide you with a backup of your previous view\ndefinition. It\nis safe to remove these backup definitions, but only while\nmysqld is\nnot running. If you delete the arc subdirectory or its files\nwhile\nmysqld is running, you will receive an error the next time\nyou try to\nalter the view: \n \nMariaDB [test]> ALTER VIEW v AS SELECT * FROM t; \nERROR 6 (HY000): Error on delete of\n\'.\\test\\arc/v.frm-0004\' (Errcode: 2)\n \nColumns retrieved by the SELECT statement can be simple\nreferences to\ntable columns. They can also be expressions that use\nfunctions,\nconstant values, operators, and so forth.\n \nUnqualified table or view names in the SELECT statement are\ninterpreted with respect to the default database. A view can\nrefer to\ntables or views in other databases by qualifying the table\nor view\nname with the proper database name.\n \nA view can be created from many kinds of SELECT statements.\nIt can\nrefer to base tables or other views. It can use joins,\nUNION, and\nsubqueries. The SELECT need not even refer to any tables.\nThe\nfollowing example defines a view that selects two columns\nfrom another\ntable, as well as an expression calculated from those\ncolumns:\n \nCREATE TABLE t (qty INT, price INT);\n \nINSERT INTO t VALUES(3, 50);\n \nCREATE VIEW v AS SELECT qty, price, qty*price AS value FROM\nt;\n \nSELECT * FROM v;\n+------+-------+-------+\n| qty | price | value |\n+------+-------+-------+\n| 3 | 50 | 150 |\n+------+-------+-------+\n \nA view definition is subject to the following restrictions:\nThe SELECT statement cannot contain a subquery in the FROM\nclause.\nThe SELECT statement cannot refer to system or user\nvariables.\nWithin a stored program, the definition cannot refer to\nprogram parameters or local variables.\nThe SELECT statement cannot refer to prepared statement\nparameters.\nAny table or view referred to in the definition must exist.\nHowever, after a view has been created, it is possible to\ndrop a table or view that the definition refers to. In this\ncase, use of the view results in an error. To check a view\ndefinition for problems of this kind, use the CHECK TABLE\nstatement.\nThe definition cannot refer to a TEMPORARY table, and you\ncannot create a TEMPORARY view.\nAny tables named in the view definition must exist at\ndefinition time.\nYou cannot associate a trigger with a view.\nFor valid identifiers to use as view names, see Identifier\nNames.\n \nORDER BY is allowed in a view definition, but it is ignored\nif you\nselect from a view using a statement that has its own ORDER\nBY.\n \nFor other options or clauses in the definition, they are\nadded to the\noptions or clauses of the statement that references the\nview, but the\neffect is undefined. For example, if a view definition\nincludes a\nLIMIT clause, and you select from the view using a statement\nthat has\nits own LIMIT clause, it is undefined which limit applies.\nThis same\nprinciple applies to options such as ALL, DISTINCT, or\nSQL_SMALL_RESULT that follow the SELECT keyword, and to\nclauses such\nas INTO, FOR UPDATE, and LOCK IN SHARE MODE.\n \nThe PROCEDURE clause cannot be used in a view definition,\nand it cannot be used if a view is referenced in the FROM\nclause.\n \nIf you create a view and then change the query processing\nenvironment\nby changing system variables, that may affect the results\nthat you get\nfrom the view:\n \nCREATE VIEW v (mycol) AS SELECT \'abc\';\n \nSET sql_mode = \'\';\n \nSELECT \"mycol\" FROM v;\n+-------+\n| mycol |\n+-------+\n| mycol | \n+-------+\n \nSET sql_mode = \'ANSI_QUOTES\';\n \nSELECT \"mycol\" FROM v;\n+-------+\n| mycol |\n+-------+\n| abc | \n+-------+\n \nThe DEFINER and SQL SECURITY clauses determine which MariaDB\naccount to\nuse when checking access privileges for the view when a\nstatement is\nexecuted that references the view. They were added in MySQL\n5.1.2.\nThe legal SQL SECURITY characteristic values are DEFINER and\nINVOKER.\nThese indicate that the required privileges must be held by\nthe user\nwho defined or invoked the view, respectively. The default\nSQL\nSECURITY value is DEFINER.\n \nIf a user value is given for the DEFINER clause, it should\nbe a MariaDB\naccount in \'user_name\'@\'host_name\' format (the same\nformat used in the\nGRANT statement). The user_name and host_name values both\nare\nrequired. The definer can also be given as CURRENT_USER or\nCURRENT_USER(). The default DEFINER value is the user who\nexecutes the\nCREATE VIEW statement. This is the same as specifying\nDEFINER =\nCURRENT_USER explicitly.\n \nIf you specify the DEFINER clause, these rules determine the\nlegal\nDEFINER user values:\nIf you do not have the SUPER privilege, the only legal user\nvalue is your own account, either specified literally or by\nusing CURRENT_USER. You cannot set the definer to some other\naccount.\nIf you have the SUPER privilege, you can specify any\nsyntactically legal account name. If the account does not\nactually exist, a warning is generated.\nIf the SQL SECURITY value is DEFINER but the definer account\ndoes not exist when the view is referenced, an error occurs.\n \nWithin a view definition, CURRENT_USER returns the view\'s\nDEFINER\nvalue by default. Before MySQL 5.1.12, and for views\ndefined with the SQL SECURITY INVOKER characteristic,\nCURRENT_USER\nreturns the account for the view\'s invoker. For information\nabout user\nauditing within views, see\nhttp://dev.mysql.com/doc/refman/5.1/en/account-activity-auditing.html.\n \nWithin a stored routine that is defined with the SQL\nSECURITY DEFINER\ncharacteristic, CURRENT_USER returns the routine\'s DEFINER\nvalue. This\nalso affects a view defined within such a program, if the\nview\ndefinition contains a DEFINER value of CURRENT_USER.\n \nView privileges are checked like this:\nAt view definition time, the view creator must have the\nprivileges needed to use the top-level objects accessed by\nthe view. For example, if the view definition refers to\ntable columns, the creator must have privileges for the\ncolumns, as described previously. If the definition refers\nto a stored function, only the privileges needed to invoke\nthe function can be checked. The privileges required when\nthe function runs can be checked only as it executes: For\ndifferent invocations of the function, different execution\npaths within the function might be taken.\nWhen a view is referenced, privileges for objects accessed\nby the view are checked against the privileges held by the\nview creator or invoker, depending on whether the SQL\nSECURITY characteristic is DEFINER or INVOKER, respectively.\nIf reference to a view causes execution of a stored\nfunction, privilege checking for statements executed within\nthe function depend on whether the function is defined with\na SQL SECURITY characteristic of DEFINER or INVOKER. If the\nsecurity characteristic is DEFINER, the function runs with\nthe privileges of its creator. If the characteristic is\nINVOKER, the function runs with the privileges determined by\nthe view\'s SQL SECURITY characteristic.\n \nMySQL until 5.1.1\n \nPrior to MySQL 5.1.2 (before the DEFINER and SQL SECURITY\nclauses were\nimplemented), privileges required for objects used in a view\nare\nchecked at view creation time.\n \nExample: A view might depend on a stored function, and that\nfunction\nmight invoke other stored routines. For example, the\nfollowing 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()\nneed to be\nchecked when f() executes. This might mean that privileges\nare needed\nfor p1() or p2(), depending on the execution path within\nf(). Those\nprivileges must be checked at runtime, and the user who must\npossess\nthe privileges is determined by the SQL SECURITY values of\nthe view v\nand the function f().\n \nThe DEFINER and SQL SECURITY clauses for views are\nextensions to\nstandard SQL. In standard SQL, views are handled using the\nrules for\nSQL SECURITY INVOKER.\n \nIf you invoke a view that was created before MySQL 5.1.2, it\nis\ntreated as though it was created with a SQL SECURITY DEFINER\nclause\nand with a DEFINER value that is the same as your account.\nHowever,\nbecause the actual definer is unknown, MySQL issues a\nwarning. To make\nthe warning go away, it is sufficient to re-create the view\nso that\nthe view definition includes a DEFINER clause.\n \nThe optional ALGORITHM clause is an extension to standard\nSQL. It\naffects how MariaDB processes the view. ALGORITHM takes\nthree values:\nMERGE, TEMPTABLE, or UNDEFINED. The default algorithm is\nUNDEFINED if\nno ALGORITHM clause is present. See View Algorithms for more\ninformation.\n \nSome views are updatable. That is, you can use them in\nstatements such\nas UPDATE, DELETE, or INSERT to update the contents of the\nunderlying\ntable. For a view to be updatable, there must be a\none-to-one\nrelationship between the rows in the view and the rows in\nthe\nunderlying table. There are also certain other constructs\nthat make a\nview non-updatable. See Inserting and Updating with Views.\n \nWITH CHECK OPTION\n \nThe WITH CHECK OPTION clause can be given for an updatable\nview to\nprevent inserts or updates to rows except those for which\nthe WHERE\nclause in the select_statement is true.\n \nIn a WITH CHECK OPTION clause for an updatable view, the\nLOCAL and\nCASCADED keywords determine the scope of check testing when\nthe view\nis defined in terms of another view. The LOCAL keyword\nrestricts the\nCHECK OPTION only to the view being defined. CASCADED causes\nthe\nchecks for underlying views to be evaluated as well. When\nneither\nkeyword is given, the default is CASCADED.\n \nFor more information about updatable views and the WITH\nCHECK OPTION\nclause, see\nInserting and Updating with Views.\n \nIF NOT EXISTS\n \nThe IF NOT EXISTS clause was added in MariaDB 10.1.3\n \nWhen the IF NOT EXISTS clause is used, MariaDB will return a\nwarning instead of an error if the specified view already\nexists. Cannot be used together with the OR REPLACE clause.\n \nExamples\n-------- \nCREATE TABLE t (a INT, b INT) ENGINE = InnoDB;\n \nINSERT INTO t VALUES (1,1), (2,2), (3,3);\n \nCREATE VIEW v AS SELECT a, a*2 AS a2 FROM t;\n \nSELECT * FROM v;\n \n+------+------+\n| a | a2 |\n+------+------+\n| 1 | 2 |\n| 2 | 4 |\n| 3 | 6 |\n+------+------+\n \nOR REPLACE and IF NOT EXISTS:\n \nCREATE VIEW v AS SELECT a, a*2 AS a2 FROM t;\n \nERROR 1050 (42S01): Table \'v\' already exists\n \nCREATE OR REPLACE VIEW v AS SELECT a, a*2 AS a2 FROM t;\n \nQuery OK, 0 rows affected (0.04 sec)\n \nCREATE VIEW IF NOT EXISTS v AS SELECT a, a*2 AS a2 FROM t;\n \nQuery OK, 0 rows affected, 1 warning (0.01 sec)\n \nSHOW WARNINGS;\n \n+-------+------+--------------------------+\n| Level | Code | Message |\n+-------+------+--------------------------+\n| Note | 1050 | Table \'v\' already exists |\n+-------+------+--------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/create-view/','','https://mariadb.com/kb/en/create-view/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (669,39,'DROP DATABASE','Syntax\n------ \nDROP {DATABASE | SCHEMA} [IF EXISTS] db_name\n \nDescription\n----------- \nDROP DATABASE drops all tables in the database and deletes\nthe database. Be very careful with this statement! To use\nDROP DATABASE,\nyou need the DROP privilege on the database. DROP SCHEMA is\na synonym for DROP DATABASE.\n \nImportant: When a database is dropped, user privileges on\nthe database are not automatically dropped. See GRANT.\n \nIF EXISTS\n \nUse IF EXISTS to prevent an error from occurring for\ndatabases that do not exist. A NOTE is generated for each\nnon-existent database when using IF EXISTS. See SHOW\nWARNINGS.\n \nExamples\n-------- \nDROP DATABASE bufg;\n \nQuery OK, 0 rows affected (0.39 sec)\n \nDROP DATABASE bufg;\n \nERROR 1008 (HY000): Can\'t drop database \'bufg\'; database\ndoesn\'t exist\n \n \\W\nShow warnings enabled.\n \nDROP DATABASE IF EXISTS bufg;\n \nQuery OK, 0 rows affected, 1 warning (0.00 sec)\nNote (Code 1008): Can\'t drop database \'bufg\'; database\ndoesn\'t exist\n \n\n\nURL: https://mariadb.com/kb/en/drop-database/','','https://mariadb.com/kb/en/drop-database/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (670,39,'DROP EVENT','Syntax\n------ \nDROP EVENT [IF EXISTS] event_name\n \nDescription\n----------- \nThis statement drops the event named event_name. The event\nimmediately\nceases being active, and is deleted completely from the\nserver.\n \nIf the event does not exist, the error\nERROR 1517 (HY000): Unknown event \'event_name\'\nresults. You can override this and cause the\nstatement to generate a NOTE for non-existent events instead\nby using\nIF EXISTS. See SHOW WARNINGS.\n \nThis statement requires the EVENT privilege. In MySQL 5.1.11\nand earlier, an event could be dropped only\nby its definer, or by a user having the SUPER privilege.\n \nExamples\n-------- \nDROP EVENT myevent3;\n \nUsing the IF EXISTS clause:\n \nDROP EVENT IF EXISTS myevent3;\n \nQuery OK, 0 rows affected, 1 warning (0.01 sec)\n \nSHOW WARNINGS;\n \n+-------+------+-------------------------------+\n| Level | Code | Message |\n+-------+------+-------------------------------+\n| Note | 1305 | Event myevent3 does not exist |\n+-------+------+-------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/drop-event/','','https://mariadb.com/kb/en/drop-event/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (671,39,'DROP FUNCTION','Syntax\n------ \nDROP FUNCTION [IF EXISTS] f_name\n \nDescription\n----------- \nThe DROP FUNCTION statement is used to drop a stored\nfunction or a user-defined function (UDF). That is, the\nspecified routine is removed from the server, along with all\nprivileges specific to the function. You must have the ALTER\nROUTINE privilege for the routine in order to drop it. If\nthe automatic_sp_privileges server system variable is set,\nboth the ALTER ROUTINE and EXECUTE privileges are granted\nautomatically to the routine creator - see Stored Routine\nPrivileges.\n \nIF EXISTS\n \nThe IF EXISTS clause is a MySQL/MariaDB extension. It\nprevents an error from occurring if the function does not\nexist. A\nNOTE is produced that can be viewed with SHOW WARNINGS.\n \nFor dropping a user-defined functions (UDF), see DROP\nFUNCTION UDF.\n \nExamples\n-------- \nDROP FUNCTION hello;\n \nQuery OK, 0 rows affected (0.042 sec)\n \nDROP FUNCTION hello;\n \nERROR 1305 (42000): FUNCTION test.hello does not exist\n \nDROP FUNCTION IF EXISTS hello;\n \nQuery OK, 0 rows affected, 1 warning (0.000 sec)\n \nSHOW WARNINGS;\n \n+-------+------+------------------------------------+\n| Level | Code | Message |\n+-------+------+------------------------------------+\n| Note | 1305 | FUNCTION test.hello does not exist |\n+-------+------+------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/drop-function/','','https://mariadb.com/kb/en/drop-function/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (672,39,'DROP INDEX','Syntax\n------ \nDROP INDEX [IF EXISTS] index_name ON tbl_name \n [WAIT n |NOWAIT]\n [algorithm_option | lock_option] ...\n \nalgorithm_option:\n ALGORITHM [=] {DEFAULT|INPLACE|COPY|NOCOPY|INSTANT}\n \nlock_option:\n LOCK [=] {DEFAULT|NONE|SHARED|EXCLUSIVE}\n \nDescription\n----------- \nDROP INDEX drops the index named index_name from the table\ntbl_name.\nThis statement is mapped to an ALTER TABLE statement to drop\nthe\nindex.\n \nIf another connection is using the table, a metadata lock is\nactive, and this statement will wait until the lock is\nreleased. This is also true for non-transactional tables.\n \nSee ALTER TABLE.\n \nAnother shortcut, CREATE INDEX, allows the creation of an\nindex.\n \nTo remove the primary key, `PRIMARY` must be specified as\nindex_name. Note that the quotes are necessary, because\nPRIMARY is a keyword.\n \nPrivileges\n \nExecuting the DROP INDEX statement requires the INDEX\nprivilege for the table or the database.\n \nOnline DDL\n \nIn MariaDB 10.0 and later, online DDL is supported with the\nALGORITHM and LOCK clauses.\n \nSee InnoDB Online DDL Overview for more information on\nonline DDL with InnoDB.\n \nDROP INDEX IF EXISTS ...\n \nThe IF EXISTS clause was added in MariaDB 10.1.4.\n \nIf the IF EXISTS clause is used, then MariaDB will return a\nwarning instead of an error if the index does not exist.\n \nWAIT/NOWAIT\n \nSet the lock wait timeout. See WAIT and NOWAIT.\n \nALGORITHM\n \nSee ALTER TABLE: ALGORITHM for more information.\n \nLOCK\n \nSee ALTER TABLE: LOCK for more information.\n \nProgress Reporting\n \nMariaDB provides progress reporting for DROP INDEX statement\nfor clients\nthat support the new progress reporting protocol. For\nexample, if you were using the mysql client, then the\nprogress report might look like this::\n \n\n\nURL: https://mariadb.com/kb/en/drop-index/','','https://mariadb.com/kb/en/drop-index/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (673,39,'DROP PACKAGE','Oracle-style packages were introduced in MariaDB 10.3.5.\n \nSyntax\n------ \nDROP PACKAGE [IF EXISTS] [ db_name . ] package_name\n \nDescription\n----------- \nThe DROP PACKAGE statement can be used when Oracle SQL_MODE\nis set.\n \nThe DROP PACKAGE statement drops a stored package entirely:\nDrops the package specification (earlier created using the\nCREATE PACKAGE statement).\nDrops the package implementation, if the implementation was\nalready created using the CREATE PACKAGE BODY statement.\n \n\n\nURL: https://mariadb.com/kb/en/drop-package/','','https://mariadb.com/kb/en/drop-package/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (674,39,'DROP PACKAGE BODY','Oracle-style packages were introduced in MariaDB 10.3.5.\n \nSyntax\n------ \nDROP PACKAGE BODY [IF EXISTS] [ db_name . ] package_name\n \nDescription\n----------- \nThe DROP PACKAGE BODY statement can be used when Oracle\nSQL_MODE is set.\n \nThe DROP PACKAGE BODY statement drops the package body (i.e\nthe implementation), previously created using the CREATE\nPACKAGE BODY statement.\n \nNote, DROP PACKAGE BODY drops only the package\nimplementation, but does not drop the package specification.\nUse DROP PACKAGE to drop the package entirely (i.e. both\nimplementation and specification).\n \n\n\nURL: https://mariadb.com/kb/en/drop-package-body/','','https://mariadb.com/kb/en/drop-package-body/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (675,39,'DROP PROCEDURE','Syntax\n------ \nDROP PROCEDURE [IF EXISTS] sp_name\n \nDescription\n----------- \nThis statement is used to drop a stored procedure. That is,\nthe\nspecified routine is removed from the server along with all\nprivileges specific to the procedure. You must have the\nALTER ROUTINE privilege for the routine. If the\nautomatic_sp_privileges server system variable is set, that\nprivilege and EXECUTE are granted automatically to the\nroutine creator - see Stored Routine Privileges.\n \nThe IF EXISTS clause is a MySQL/MariaDB extension. It\nprevents an error from occurring if the procedure or\nfunction does not exist. A\nNOTE is produced that can be viewed with SHOW WARNINGS.\n \nWhile this statement takes effect immediately, threads which\nare executing a procedure can continue execution.\n \nExamples\n-------- \nDROP PROCEDURE simpleproc;\n \nIF EXISTS:\n \nDROP PROCEDURE simpleproc;\n \nERROR 1305 (42000): PROCEDURE test.simpleproc does not exist\n \nDROP PROCEDURE IF EXISTS simpleproc;\n \nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+-------+------+------------------------------------------+\n| Level | Code | Message |\n+-------+------+------------------------------------------+\n| Note | 1305 | PROCEDURE test.simpleproc does not exist |\n+-------+------+------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/drop-procedure/','','https://mariadb.com/kb/en/drop-procedure/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (676,39,'DROP SEQUENCE','DROP SEQUENCE was introduced in MariaDB 10.3.\n \nSyntax\n------ \nDROP [TEMPORARY] SEQUENCE [IF EXISTS] [/*COMMENT TO SAVE*/]\n sequence_name [, sequence_name] ...\n \nDescription\n----------- \nDROP SEQUENCE removes one or more sequences created with\nCREATE SEQUENCE. You must have the DROP privilege for each\nsequence. MariaDB returns an error indicating by name which\nnon-existing tables it was unable to drop, but it also drops\nall of the tables in the list that do exist.\n \nImportant: When a table is dropped, user privileges on the\ntable are not automatically dropped. See GRANT.\n \nIf another connection is using the sequence, a metadata lock\nis active, and this statement will wait until the lock is\nreleased. This is also true for non-transactional tables.\n \nFor each referenced sequence, DROP SEQUENCE drops a\ntemporary sequence with that name, if it exists. If it does\nnot exist, and the TEMPORARY keyword is not used, it drops a\nnon-temporary sequence with the same name, if it exists. The\nTEMPORARY keyword ensures that a non-temporary sequence will\nnot accidentally be dropped.\n \nUse IF EXISTS to prevent an error from occurring for\nsequences that do not exist. A NOTE is generated for each\nnon-existent sequence when using IF EXISTS. See SHOW\nWARNINGS.\n \nDROP SEQUENCE requires the DROP privilege.\n \nNotes\n \nDROP SEQUENCE only removes sequences, not tables. However,\nDROP TABLE can remove both sequences and tables.\n \n\n\nURL: https://mariadb.com/kb/en/drop-sequence/','','https://mariadb.com/kb/en/drop-sequence/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (677,39,'DROP SERVER','Syntax\n------ \nDROP SERVER [ IF EXISTS ] server_name\n \nDescription\n----------- \nDrops the server definition for the server named\nserver_name. The\ncorresponding row within the mysql.servers table will be\ndeleted. This\nstatement requires the SUPER privilege. \n \nDropping a server for a table does not affect any\nFederatedX, FEDERATED or Spider tables that used this\nconnection information when they were created. \n \nIF EXISTS\n \nIf the IF EXISTS clause is used, MariaDB will not return an\nerror if the server does not exist. Unlike all other\nstatements, DROP SERVER IF EXISTS does not issue a note if\nthe server does not exist. See MDEV-9400.\n \nExamples\n-------- \nDROP SERVER s;\n \nIF EXISTS:\n \nDROP SERVER s;\n \nERROR 1477 (HY000): The foreign server name you are trying\nto reference \n does not exist. Data source error: s\n \nDROP SERVER IF EXISTS s;\n \nQuery OK, 0 rows affected (0.00 sec)\n \n\n\nURL: https://mariadb.com/kb/en/drop-server/','','https://mariadb.com/kb/en/drop-server/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (678,39,'DROP TABLE','Syntax\n------ \nDROP [TEMPORARY] TABLE [IF EXISTS] [/*COMMENT TO SAVE*/]\n tbl_name [, tbl_name] ...\n [WAIT n|NOWAIT]\n [RESTRICT | CASCADE]\n \nDescription\n----------- \nDROP TABLE removes one or more tables. You must have the\nDROP privilege\nfor each table. All table data and the table definition are\nremoved, as well as triggers associated to the table, so be\ncareful with this statement! If any of the tables named in\nthe argument list do\nnot exist, MariaDB returns an error indicating by name which\nnon-existing tables\nit was unable to drop, but it also drops all of the tables\nin the list that do\nexist.\n \nImportant: When a table is dropped, user privileges on the\ntable are not\nautomatically dropped. See GRANT.\n \nIf another connection is using the table, a metadata lock is\nactive, and this statement will wait until the lock is\nreleased. This is also true for non-transactional tables.\n \nNote that for a partitioned table, DROP TABLE permanently\nremoves the table\ndefinition, all of its partitions, and all of the data which\nwas stored in\nthose partitions. It also removes the partitioning\ndefinition (.par) file\nassociated with the dropped table.\n \nFor each referenced table, DROP TABLE drops a temporary\ntable with that name, if it exists. If it does not exist,\nand the TEMPORARY keyword is not used, it drops a\nnon-temporary table with the same name, if it exists. The\nTEMPORARY keyword ensures that a non-temporary table will\nnot accidentally be dropped.\n \nUse IF EXISTS to prevent an error from occurring for tables\nthat do not\nexist. A NOTE is generated for each non-existent table when\nusing\nIF EXISTS. See SHOW WARNINGS.\n \nIf a foreign key references this table, the table cannot be\ndropped. In this case, it is necessary to drop the foreign\nkey first.\n \nRESTRICT and CASCADE are allowed to make porting from other\ndatabase systems easier. In MariaDB, they do nothing.\n \nSince MariaDB 5.5.27, the comment before the tablenames\n(that /*COMMENT TO SAVE*/) is stored in the binary log. That\nfeature can be used by replication tools to send their\ninternal messages.\n \nIt is possible to specify table names as db_name.tab_name.\nThis is useful to delete tables from multiple databases with\none statement. See Identifier Qualifiers for details.\n \nThe DROP privilege is required to use DROP TABLE on\nnon-temporary tables. For temporary tables, no privilege is\nrequired, because such tables are only visible for the\ncurrent session.\n \nNote: DROP TABLE automatically commits the current active\ntransaction,\nunless you use the TEMPORARY keyword.\n \nWAIT/NOWAIT\n \nSet the lock wait timeout. See WAIT and NOWAIT.\n \nDROP TABLE in replication\n \nDROP TABLE has the following characteristics in replication:\nDROP TABLE IF EXISTS are always logged.\nDROP TABLE without IF EXISTS for tables that don\'t exist\nare not written to the binary log.\nDropping of TEMPORARY tables are prefixed in the log with\nTEMPORARY. These drops are only logged when running\nstatement or mixed mode replication.\nOne DROP TABLE statement can be logged with up to 3\ndifferent DROP statements:\nDROP TEMPORARY TABLE\nlist_of_non_transactional_temporary_tables\nDROP TEMPORARY TABLE list_of_transactional_temporary_tables\nDROP TABLE list_of_normal_tables\n \nStarting from MariaDB 10.0.8, DROP TABLE on the master is\ntreated on the slave as DROP TABLE IF EXISTS. You can change\nthat by setting slave-ddl-exec-mode to STRICT.\n \nDropping an Internal #sql-... Table\n \nIf the mysqld process is killed during an ALTER TABLE you\nmay find a table named #sql-... in your data directory. In\nMariaDB 10.3, InnoDB tables with this prefix will de deleted\nautomatically during startup.\nIn MariaDB 10.4 we will ensure that these temporary tables\nwill always be deleted automatically.\n \nIf you want to delete one of these tables explicitly you can\ndo so by using the following syntax:\n \nDROP TABLE `#mysql50##sql-...`;\n \nWhen running an ALTER TABLE…ALGORITHM=INPLACE that\nrebuilds the table, InnoDB will create an internal #sql-ib\ntable. For these tables, the .frm file will be called\nsomething else. In order to drop such a table after a server\ncrash, you must rename the #sql*.frm file to match the\n#sql-ib*.ibd file.\n \nDropping All Tables in a Database\n \nThe best way to drop all tables in a database is by\nexecuting DROP DATABASE, which will drop the database\nitself, and all tables in it.\n \nHowever, if you want to drop all tables in the database, but\nyou also want to keep the database itself and any other\nnon-table objects in it, then you would need to execute DROP\nTABLE to drop each individual table. You can construct these\nDROP TABLE commands by querying the TABLES table in the\ninformation_schema database. For example:\n \nSELECT CONCAT(\'DROP TABLE IF EXISTS `\', TABLE_SCHEMA,\n\'`.`\', TABLE_NAME, \'`;\')\nFROM information_schema.TABLES\nWHERE TABLE_SCHEMA = \'mydb\';\n \nExamples\n-------- \nDROP TABLE Employees, Customers;\n \nNotes\n \nBeware that DROP TABLE can drop both tables and sequences.\nThis is mainly done to allow old tools like mysqldump to\nwork with sequences.\n \n\n\nURL: https://mariadb.com/kb/en/drop-table/','','https://mariadb.com/kb/en/drop-table/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (679,39,'DROP TABLESPACE','The DROP TABLESPACE statement is not supported by MariaDB.\nIt was originally inherited from MySQL NDB Cluster. In MySQL\n5.7 and later, the statement is also supported for InnoDB.\nHowever, MariaDB has chosen not to include that specific\nfeature. See MDEV-19294 for more information.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/drop-tablespace/','','https://mariadb.com/kb/en/drop-tablespace/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (680,39,'DROP TRIGGER','Syntax\n------ \nDROP TRIGGER [IF EXISTS] [schema_name.]trigger_name\n \nDescription\n----------- \nThis statement drops a trigger. The schema (database) name\nis optional. If the\nschema is omitted, the trigger is dropped from the default\nschema.\nIts use requires the TRIGGER privilege for the table\nassociated with the trigger.\n \nUse IF EXISTS to prevent an error from occurring for a\ntrigger that does not exist. A NOTE is generated for a\nnon-existent trigger\nwhen using IF EXISTS. See SHOW WARNINGS.\n \nNote: Triggers for a table are also dropped if you drop the\ntable.\n \nExamples\n-------- \nDROP TRIGGER test.example_trigger;\n \nUsing the IF EXISTS clause:\n \nDROP TRIGGER IF EXISTS test.example_trigger;\n \nQuery OK, 0 rows affected, 1 warning (0.01 sec)\n \nSHOW WARNINGS;\n \n+-------+------+------------------------+\n| Level | Code | Message |\n+-------+------+------------------------+\n| Note | 1360 | Trigger does not exist |\n+-------+------+------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/drop-trigger/','','https://mariadb.com/kb/en/drop-trigger/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (681,39,'DROP VIEW','Syntax\n------ \nDROP VIEW [IF EXISTS]\n view_name [, view_name] ...\n [RESTRICT | CASCADE]\n \nDescription\n----------- \nDROP VIEW removes one or more views. You must have the DROP\nprivilege for\neach view. If any of the views named in the argument list do\nnot exist, MariaDB\nreturns an error indicating by name which non-existing views\nit was unable to\ndrop, but it also drops all of the views in the list that do\nexist.\n \nThe IF EXISTS clause prevents an error from occurring for\nviews that don\'t\nexist. When this clause is given, a NOTE is generated for\neach non-existent\nview. See SHOW WARNINGS.\n \nRESTRICT and CASCADE, if given, are parsed and ignored.\n \nIt is possible to specify view names as db_name.view_name.\nThis is useful to delete views from multiple databases with\none statement. See Identifier Qualifiers for details.\n \nThe DROP privilege is required to use DROP TABLE on\nnon-temporary tables. For temporary tables, no privilege is\nrequired, because such tables are only visible for the\ncurrent session.\n \nIf a view references another view, it will be possible to\ndrop the referenced view. However, the other view will\nreference a view which does not exist any more. Thus,\nquerying it will produce an error similar to the following:\n \nERROR 1356 (HY000): View \'db_name.view_name\' references\ninvalid table(s) or \ncolumn(s) or function(s) or definer/invoker of view lack\nrights to use them\n \nThis problem is reported in the output of CHECK TABLE.\n \nNote that it is not necessary to use DROP VIEW to replace an\nexisting view, because CREATE VIEW has an OR REPLACE clause.\n \nExamples\n-------- \nDROP VIEW v,v2;\n \nGiven views v and v2, but no view v3\n \nDROP VIEW v,v2,v3;\nERROR 1051 (42S02): Unknown table \'v3\'\n \nDROP VIEW IF EXISTS v,v2,v3;\nQuery OK, 0 rows affected, 1 warning (0.01 sec)\n \nSHOW WARNINGS;\n+-------+------+-------------------------+\n| Level | Code | Message |\n+-------+------+-------------------------+\n| Note | 1051 | Unknown table \'test.v3\' |\n+-------+------+-------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/drop-view/','','https://mariadb.com/kb/en/drop-view/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (682,39,'Invisible Columns','Invisible columns (sometimes also called hidden columns)\nfirst appeared in MariaDB 10.3.3.\n \nColumns can be given an INVISIBLE attribute in a CREATE\nTABLE or ALTER TABLE statement. These columns will then not\nbe listed in the results of a SELECT * statement, nor do\nthey need to be assigned a value in an INSERT statement,\nunless INSERT explicitly mentions them by name.\n \nSince SELECT * does not return the invisible columns, new\ntables or views created in this manner will have no trace of\nthe invisible columns. If specifically referenced in the\nSELECT statement, the columns will be brought into the\nview/new table, but the INVISIBLE attribute will not.\n \nInvisible columns can be declared as NOT NULL, but then\nrequire a DEFAULT value.\n \nIt is not possible for all columns in a table to be\ninvisible.\n \nExamples\n-------- \nCREATE TABLE t (x INT, y INT INVISIBLE, z INT INVISIBLE NOT\nNULL);\nERROR 4106 (HY000): Invisible column `z` must have a default\nvalue\n \nCREATE TABLE t (x INT, y INT INVISIBLE, z INT INVISIBLE NOT\nNULL DEFAULT 4);\n \nINSERT INTO t VALUES (1),(2);\n \nINSERT INTO t (x,y) VALUES (3,33);\n \nSELECT * FROM t;\n \n+------+\n| x |\n+------+\n| 1 |\n| 2 |\n| 3 |\n+------+\n \nSELECT x,y,z FROM t;\n \n+------+------+---+\n| x | y | z |\n+------+------+---+\n| 1 | NULL | 4 |\n| 2 | NULL | 4 |\n| 3 | 33 | 4 |\n+------+------+---+\n \nDESC t;\n \n+-------+---------+------+-----+---------+-----------+\n| Field | Type | Null | Key | Default | Extra |\n+-------+---------+------+-----+---------+-----------+\n| x | int(11) | YES | | NULL | |\n| y | int(11) | YES | | NULL | INVISIBLE |\n| z | int(11) | NO | | 4 | INVISIBLE |\n+-------+---------+------+-----+---------+-----------+\n \nALTER TABLE t MODIFY x INT INVISIBLE, MODIFY y INT, MODIFY z\nINT NOT NULL DEFAULT 4;\n \nDESC t;\n \n+-------+---------+------+-----+---------+-----------+\n| Field | Type | Null | Key | Default | Extra |\n+-------+---------+------+-----+---------+-----------+\n| x | int(11) | YES | | NULL | INVISIBLE |\n| y | int(11) | YES | | NULL | |\n| z | int(11) | NO | | 4 | |\n+-------+---------+------+-----+---------+-----------+\n \nCreating a view from a table with hidden columns:\n \nCREATE VIEW v1 AS SELECT * FROM t;\n \nDESC v1;\n \n+-------+---------+------+-----+---------+-------+\n| Field | Type | Null | Key | Default | Extra |\n+-------+---------+------+-----+---------+-------+\n| x | int(11) | YES | | NULL | |\n+-------+---------+------+-----+---------+-------+\n \nCREATE VIEW v2 AS SELECT x,y,z FROM t;\n \nDESC v2;\n \n+-------+---------+------+-----+---------+-------+\n| Field | Type | Null | Key | Default | Extra |\n+-------+---------+------+-----+---------+-------+\n| x | int(11) | YES | | NULL | |\n| y | int(11) | YES | | NULL | |\n| z | int(11) | NO | | 4 | |\n+-------+---------+------+-----+---------+-------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/invisible-columns/','','https://mariadb.com/kb/en/invisible-columns/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (683,39,'MERGE','Description\n----------- \nThe MERGE storage engine, also known as the MRG_MyISAM\nengine, is a\ncollection of identical MyISAM tables that can be used as\none.\n\"Identical\" means that all tables have identical column\nand index\ninformation. You cannot merge MyISAM tables in which the\ncolumns are\nlisted in a different order, do not have exactly the same\ncolumns, or\nhave the indexes in different order. However, any or all of\nthe MyISAM\ntables can be compressed with myisampack. Columns names and\nindexes names can be different, as long as data types and\nNULL/NOT NULL clauses are the same. Differences in\ntable options such as AVG_ROW_LENGTH, MAX_ROWS, or PACK_KEYS\ndo not\nmatter.\n \nEach index in a MERGE table must match an index in\nunderlying MyISAM tables, but the opposite is not true.\nAlso, a MERGE table cannot have a PRIMARY KEY or UNIQUE\nindexes, because it cannot enforce uniqueness over all\nunderlying tables.\n \nThe following options are meaningful for MERGE tables:\nUNION. This option specifies the list of the underlying\nMyISAM tables. The list is enclosed between parentheses and\nseparated with commas.\nINSERT_METHOD. This options specifies whether, and how,\nINSERTs are allowed for the table. Allowed values are: NO\n(INSERTs are not allowed), FIRST (new rows will be written\ninto the first table specified in the UNION list), LAST (new\nrows will be written into the last table specified in the\nUNION list). The default value is NO.\n \nIf you define a MERGE table with a definition which is\ndifferent from the underlying MyISAM tables, or one of the\nunderlying tables is not MyISAM, the CREATE TABLE statement\nwill not return any error. But any statement which involves\nthe table will produce an error like the following:\n \nERROR 1168 (HY000): Unable to open underlying table which is\ndifferently defined \n or of non-MyISAM type or doesn\'t exist\n \nA CHECK TABLE will show more information about the problem.\n \nThe error is also produced if the table is properly define,\nbut an underlying table\'s definition changes at some point\nin time.\n \nIf you try to insert a new row into a MERGE table with\nINSERT_METHOD=NO, you will get an error like the following:\n \nERROR 1036 (HY000): Table \'tbl_name\' is read only\n \nIt is possible to build a MERGE table on MyISAM tables which\nhave one or more virtual columns. MERGE itself does not\nsupport virtual columns, thus such columns will be seen as\nregular columns. The data types and sizes will still need to\nbe identical, and they cannot be NOT NULL.\n \nExamples\n-------- \nCREATE TABLE t1 (\n a INT NOT NULL AUTO_INCREMENT PRIMARY KEY,\n message CHAR(20)) ENGINE=MyISAM;\n \nCREATE TABLE t2 (\n a INT NOT NULL AUTO_INCREMENT PRIMARY KEY,\n message CHAR(20)) ENGINE=MyISAM;\n \nINSERT INTO t1 (message) VALUES\n(\'Testing\'),(\'table\'),(\'t1\');\n \nINSERT INTO t2 (message) VALUES\n(\'Testing\'),(\'table\'),(\'t2\');\n \nCREATE 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 \nSELECT * FROM total;\n \n+---+---------+\n| a | message |\n+---+---------+\n| 1 | Testing |\n| 2 | table |\n| 3 | t1 |\n| 1 | Testing |\n| 2 | table |\n| 3 | t2 |\n+---+---------+\n \nIn the following example, we\'ll create three MyISAM tables,\nand then a MERGE table on them. However, one of them uses a\ndifferent data type for the column b, so a SELECT will\nproduce an error:\n \nCREATE TABLE t1 (\n a INT,\n b INT\n) ENGINE = MyISAM;\n \nCREATE TABLE t2 (\n a INT,\n b INT\n) ENGINE = MyISAM;\n \nCREATE TABLE t3 (\n a INT,\n b TINYINT\n) ENGINE = MyISAM;\n \nCREATE TABLE t_mrg (\n a INT,\n b INT\n) ENGINE = MERGE,UNION=(t1,t2,t3);\n \nSELECT * FROM t_mrg;\n \nERROR 1168 (HY000): Unable to open underlying table which is\ndifferently defined\n or of non-MyISAM type or doesn\'t exist\n \nTo find out what\'s wrong, we\'ll use a CHECK TABLE:\n \nCHECK TABLE t_mrg;\n \n+------------+-------+----------+-----------------------------------------------------------------------------------------------------+\n| Table | Op | Msg_type | Msg_text |\n+------------+-------+----------+-----------------------------------------------------------------------------------------------------+\n| test.t_mrg | check | Error | Table \'test.t3\' is\ndifferently defined or of non-MyISAM type or doesn\'t exist\n|\n| test.t_mrg | check | Error | Unable to open underlying\ntable which is differently defined or of non-MyISAM type or\ndoesn\'t exist |\n| test.t_mrg | check | error | Corrupt |\n+------------+-------+----------+-----------------------------------------------------------------------------------------------------+\n \nNow, we know that the problem is in t3\'s definition.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/merge/','','https://mariadb.com/kb/en/merge/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (684,39,'RENAME TABLE','Syntax\n------ \nRENAME TABLE tbl_name \n [WAIT n | NOWAIT]\n TO new_tbl_name\n [, tbl_name2 TO new_tbl_name2] ...\n \nDescription\n----------- \nThis statement renames one or more tables or views, but not\nthe privileges associated to them.\n \nThe rename operation is done atomically, which means that no\nother session can\naccess any of the tables while the rename is running. For\nexample, if you have\nan existing table old_table, you can create another table\nnew_table that has the same structure but is empty, and then\nreplace the existing table with the empty one as follows\n(assuming that\nbackup_table does not already exist):\n \nCREATE TABLE new_table (...);\nRENAME TABLE old_table TO backup_table, new_table TO\nold_table;\n \ntbl_name can optionally be specified as db_name.tbl_name.\nSee Identifier Qualifiers. This allows to use RENAME to move\na table from a database to another (as long as they are on\nthe same filesystem):\n \nRENAME TABLE db1.t TO db2.t;\n \nNote that moving a table to another database is not possible\nif it has some triggers. Trying to do so produces the\nfollowing error:\n \nERROR 1435 (HY000): Trigger in wrong schema\n \nAlso, views cannot be moved to another database:\n \nERROR 1450 (HY000): Changing schema from \'old_db\' to\n\'new_db\' is not allowed.\n \nIf a RENAME TABLE renames more than one table and one\nrenaming fails, all renames executed by the same statement\nare rolled back.\n \nRenames are always executed in the specified order. Knowing\nthis, it is also possible to swap two tables\' names:\n \nRENAME TABLE t1 TO tmp_table,\n t2 TO t1,\n tmp_table TO t2;\n \nPrivileges\n \nExecuting the RENAME TABLE statement requires the DROP,\nCREATE and INSERT privileges for the table or the database.\n \nWAIT/NOWAIT\n \nSet the lock wait timeout. See WAIT and NOWAIT.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/rename-table/','','https://mariadb.com/kb/en/rename-table/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (685,39,'Silent Column Changes','When a CREATE TABLE or ALTER TABLE command is issued,\nMariaDB will silently change a column specification in the\nfollowing cases:\nPRIMARY KEY columns are always NOT NULL.\nAny trailing spaces from SET and ENUM values are discarded.\nTIMESTAMP columns are always NOT NULL, and display sizes are\ndiscarded\nA row-size limit of 65535 bytes applies\nIf strict SQL mode is not enabled, a VARCHAR column longer\nthan 65535 become TEXT, and a VARBINARY columns longer than\n65535 becomes a BLOB. If strict mode is enabled the silent\nchanges will not be made, and an error will occur.\nIf a USING clause specifies an index that\'s not permitted\nby the storage engine, the engine will instead use another\navailable index type that can be applied without affecting\nresults.\nIf the CHARACTER SET binary attribute is specified, the\ncolumn is created as the matching binary data type. A TEXT\nbecomes a BLOB, CHAR a BINARY and VARCHAR a VARBINARY. ENUMs\nand SETs are created as defined.\n \nTo ease imports from other RDBMS\'s, MariaDB will also\nsilently map the following data types:\n \nOther Vendor Type | MariaDB Type | \n \nBOOL | TINYINT | \n \nBOOLEAN | TINYINT | \n \nCHARACTER VARYING(M) | VARCHAR(M) | \n \nFIXED | DECIMAL | \n \nFLOAT4 | FLOAT | \n \nFLOAT8 | DOUBLE | \n \nINT1 | TINYINT | \n \nINT2 | SMALLINT | \n \nINT3 | MEDIUMINT | \n \nINT4 | INT | \n \nINT8 | BIGINT | \n \nLONG VARBINARY | MEDIUMBLOB | \n \nLONG VARCHAR | MEDIUMTEXT | \n \nLONG | MEDIUMTEXT | \n \nMIDDLEINT | MEDIUMINT | \n \nNUMERIC | DECIMAL | \n \nCurrently, all MySQL types are supported in MariaDB.\n \nFor type mapping between Cassandra and MariaDB, see\nCassandra storage engine.\n \nExample\n \nSilent changes in action:\n \nCREATE TABLE SilenceIsGolden\n (\n f1 TEXT CHARACTER SET binary,\n f2 VARCHAR(15) CHARACTER SET binary,\n f3 CHAR CHARACTER SET binary,\n f4 ENUM(\'x\',\'y\',\'z\') CHARACTER SET binary,\n f5 VARCHAR (65536),\n f6 VARBINARY (65536),\n f7 INT1\n );\nQuery OK, 0 rows affected, 2 warnings (0.31 sec)\n \nSHOW WARNINGS;\n \n+-------+------+-----------------------------------------------+\n| Level | Code | Message |\n+-------+------+-----------------------------------------------+\n| Note | 1246 | Converting column \'f5\' from VARCHAR to\nTEXT |\n| Note | 1246 | Converting column \'f6\' from VARBINARY to\nBLOB |\n+-------+------+-----------------------------------------------+\n \nDESCRIBE SilenceIsGolden;\n \n+-------+-------------------+------+-----+---------+-------+\n| Field | Type | Null | Key | Default | Extra |\n+-------+-------------------+------+-----+---------+-------+\n| f1 | blob | YES | | NULL | |\n| f2 | varbinary(15) | YES | | NULL | |\n| f3 | binary(1) | YES | | NULL | |\n| f4 | enum(\'x\',\'y\',\'z\') | YES | | NULL | |\n| f5 | mediumtext | YES | | NULL | |\n| f6 | mediumblob | YES | | NULL | |\n| f7 | tinyint(4) | YES | | NULL | |\n+-------+-------------------+------+-----+---------+-------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/silent-column-changes/','','https://mariadb.com/kb/en/silent-column-changes/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (686,39,'TRUNCATE TABLE','Syntax\n------ \nTRUNCATE [TABLE] tbl_name\n [WAIT n | NOWAIT]\n \nDescription\n----------- \nTRUNCATE TABLE empties a table completely. It requires the\nDROP privilege. See GRANT.\n \ntbl_name can also be specified in the form db_name.tbl_name\n(see Identifier Qualifiers).\n \nLogically, TRUNCATE TABLE is equivalent to a DELETE\nstatement that deletes all rows, but there are practical\ndifferences under some circumstances.\n \nTRUNCATE TABLE will fail for an InnoDB table if any FOREIGN\nKEY constraints from other tables reference the table,\nreturning the error:\n \nERROR 1701 (42000): Cannot truncate a table referenced in a\nforeign key constraint\n \nForeign Key constraints between columns in the same table\nare permitted.\n \nFor an InnoDB table, if there are no FOREIGN KEY\nconstraints, InnoDB performs fast truncation by dropping the\noriginal table and creating an empty one with the same\ndefinition, which is much faster than deleting rows one by\none. The AUTO_INCREMENT counter is reset by TRUNCATE TABLE,\nregardless of whether there is a FOREIGN KEY constraint.\n \nThe count of rows affected by TRUNCATE TABLE is accurate\nonly\nwhen it is mapped to a DELETE statement.\n \nFor other storage engines, TRUNCATE TABLE differs from\nDELETE in the following ways:\nTruncate operations drop and re-create the table, which is\nmuch\n faster than deleting rows one by one, particularly for\nlarge tables.\nTruncate operations cause an implicit commit.\nTruncation operations cannot be performed if the session\nholds an\n active table lock.\nTruncation operations do not return a meaningful value for\nthe number\n of deleted rows. The usual result is \"0 rows affected,\"\nwhich should\n be interpreted as \"no information.\"\nAs long as the table format file tbl_name.frm is valid, the\n table can be re-created as an empty table\n with TRUNCATE TABLE, even if the data or index files have\nbecome\n corrupted.\nThe table handler does not remember the last\n used AUTO_INCREMENT value, but starts counting\n from the beginning. This is true even for MyISAM and\nInnoDB, which normally\n do not reuse sequence values.\nWhen used with partitioned tables, TRUNCATE TABLE preserves\n the partitioning; that is, the data and index files are\ndropped and\n re-created, while the partition definitions (.par) file is\n unaffected.\nSince truncation of a table does not make any use of DELETE,\n the TRUNCATE statement does not invoke ON DELETE triggers.\nTRUNCATE TABLE will only reset the values in the Performance\nSchema summary tables to zero or null, and will not remove\nthe rows.\n \nFor the purposes of binary logging and replication, TRUNCATE\nTABLE is treated as DROP TABLE followed by CREATE TABLE (DDL\nrather than DML).\n \nTRUNCATE TABLE does not work on views. Currently, TRUNCATE\nTABLE drops all historical records from a system-versioned\ntable.\n \nWAIT/NOWAIT\n \nSet the lock wait timeout. See WAIT and NOWAIT.\n \nOracle-mode\n \nOracle-mode from MariaDB 10.3 permits the optional keywords\nREUSE STORAGE or DROP STORAGE to be used.\n \nTRUNCATE [TABLE] tbl_name [{DROP | REUSE} STORAGE]\n \nThese have no effect on the operation.\n \nPerformance\n \nTRUNCATE TABLE is faster than DELETE, because it drops and\nre-creates a table.\n \nWith XtraDB/InnoDB, TRUNCATE TABLE is slower if\ninnodb_file_per_table=ON is set (the default since MariaDB\n5.5). This is because TRUNCATE TABLE unlinks the underlying\ntablespace file, which can be an expensive operation. See\nMDEV-8069 for more details.\n \nThe performance issues with innodb_file_per_table=ON can be\nexacerbated in cases where the InnoDB buffer pool is very\nlarge and innodb_adaptive_hash_index=ON is set. In that\ncase, using DROP TABLE followed by CREATE TABLE instead of\nTRUNCATE TABLE may perform better. Setting\ninnodb_adaptive_hash_index=OFF can also help. In MariaDB\n10.2.19 and later, this performance can also be improved by\nsetting innodb_safe_truncate=OFF. See MDEV-9459 for more\ndetails.\n \nSetting innodb_adaptive_hash_index=OFF can also improve\nTRUNCATE TABLE performance in general. See MDEV-16796 for\nmore details.\n \n\n\nURL: https://mariadb.com/kb/en/truncate-table/','','https://mariadb.com/kb/en/truncate-table/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (687,39,'Generated (Virtual and Persistent/Stored) Columns','Syntax\n------ \n [GENERATED ALWAYS] AS ( )\n[VIRTUAL | PERSISTENT | STORED] [UNIQUE] [UNIQUE KEY]\n[COMMENT ]\n \nMariaDB\'s generated columns syntax is designed to be\nsimilar to the syntax for Microsoft SQL Server\'s computed\ncolumns and Oracle Database\'s virtual columns. In MariaDB\n10.2 and later, the syntax is also compatible with the\nsyntax for MySQL\'s generated columns.\n \nDescription\n----------- \nA generated column is a column in a table that cannot\nexplicitly be set to a specific value in a DML query.\nInstead, its value is automatically generated based on an\nexpression. This expression might generate the value based\non the values of other columns in the table, or it might\ngenerate the value by calling built-in functions or\nuser-defined functions (UDFs).\n \nThere are two types of generated columns:\nPERSISTENT or STORED: This type\'s value is actually stored\nin the table.\nVIRTUAL: This type\'s value is not stored at all. Instead,\nthe value is generated dynamically when the table is\nqueried. This type is the default.\n \nGenerated columns are also sometimes called computed columns\nor virtual columns.\n \nSupported Features\n \nStorage Engine Support\n \nGenerated columns can only be used with storage engines\nwhich support them. If you try to use a storage engine that\ndoes not support them, then you will see an error similar to\nthe following:\n \nERROR 1910 (HY000): TokuDB storage engine does not support\ncomputed columns\nInnoDB, Aria, MyISAM and CONNECT support generated columns.\n \nA column in a MERGE table can be built on a PERSISTENT\ngenerated column.\nHowever, a column in a MERGE table can not be defined as a\nVIRTUAL and PERSISTENT generated column.\n \n\nData Type Support\n \nAll data types are supported when defining generated\ncolumns.\n \nUsing the ZEROFILL column option is supported when defining\ngenerated columns.\n \nIn MariaDB 10.2.6 and later, the following statements apply\nto data types for generated columns:\nUsing the AUTO_INCREMENT column option is not supported when\ndefining generated columns. Previously, it was supported,\nbut this support was removed, because it would not work\ncorrectly. See MDEV-11117.\n \nIndex Support\n \nUsing a generated column as a table\'s primary key is not\nsupported. See MDEV-5590 for more information. If you try to\nuse one as a primary key, then you will see an error similar\nto the following:\n \nERROR 1903 (HY000): Primary key cannot be defined upon a\ncomputed column\nUsing PERSISTENT generated columns as part of a foreign key\nis supported.\n \nReferencing PERSISTENT generated columns as part of a\nforeign key is also supported.\nHowever, using the ON UPDATE CASCADE, ON UPDATE SET NULL, or\nON DELETE SET NULL clauses is not supported. If you try to\nuse an unsupported clause, then you will see an error\nsimilar to the following:\n \nERROR 1905 (HY000): Cannot define foreign key with ON UPDATE\nSET NULL clause on a computed column\n \nIn MariaDB 10.2.3 and later, the following statements apply\nto indexes for generated columns:\nDefining indexes on both VIRTUAL and PERSISTENT generated\ncolumns is supported.\nIf an index is defined on a generated column, then the\noptimizer considers using it in the same way as indexes\nbased on \"real\" columns.\n \n\nMariaDB until 10.2.2\n \nIn MariaDB 10.2.2 and before, the following statements apply\nto indexes for generated columns:\nDefining indexes on VIRTUAL generated columns is not\nsupported.\n \nDefining indexes on PERSISTENT generated columns is\nsupported.\nIf an index is defined on a generated column, then the\noptimizer considers using it in the same way as indexes\nbased on \"real\" columns.\n \n\nStatement Support\n \nGenerated columns are used in DML queries just as if they\nwere \"real\" columns.\nHowever, VIRTUAL and PERSISTENT generated columns differ in\nhow their data is stored.\nValues for PERSISTENT generated columns are generated\nwhenever a DML queries inserts or updates the row with the\nspecial DEFAULT value. This generates the columns value, and\nit is stored in the table like the other \"real\" columns.\nThis value can be read by other DML queries just like the\nother \"real\" columns.\nValues for VIRTUAL generated columns are not stored in the\ntable. Instead, the value is generated dynamically whenever\nthe column is queried. If other columns in a row are\nqueried, but the VIRTUAL generated column is not one of the\nqueried columns, then the column\'s value is not generated.\n \nThe SELECT statement supports generated columns.\n \nGenerated columns can be referenced in the INSERT, UPDATE,\nand DELETE statements.\nHowever, VIRTUAL or PERSISTENT generated columns cannot be\nexplicitly set to any other values than NULL or DEFAULT. If\na generated column is explicitly set to any other value,\nthen the outcome depends on whether strict mode is enabled\nin SQL_MODE. If it is not enabled, then a warning will be\nraised and the default generated value will be used instead.\nIf it is enabled, then an error will be raised instead.\n \nThe CREATE TABLE statement has limited support for generated\ncolumns.\nIt supports defining generated columns in a new table.\nIt supports using generated columns to partition tables.\nIt does not support using the versioning clauses with\ngenerated columns.\n \nThe ALTER TABLE statement has limited support for generated\ncolumns.\nIt supports the MODIFY and CHANGE clauses for PERSISTENT\ngenerated columns.\nIt does not support the MODIFY clause for VIRTUAL generated\ncolumns if ALGORITHM is not set to COPY. See MDEV-15476 for\nmore information.\nIt does not support the CHANGE clause for VIRTUAL generated\ncolumns if ALGORITHM is not set to COPY. See MDEV-17035 for\nmore information.\nIt does not support altering a table if ALGORITHM is not set\nto COPY if the table has a VIRTUAL generated column that is\nindexed. See MDEV-14046 for more information.\nIt does not support adding a VIRTUAL generated column with\nthe ADD clause if the same statement is also adding other\ncolumns if ALGORITHM is not set to COPY. See MDEV-17468 for\nmore information.\nIt also does not support altering an existing column into a\nVIRTUAL generated column.\nIt supports using generated columns to partition tables.\nIt does not support using the versioning clauses with\ngenerated columns.\n \nThe SHOW CREATE TABLE statement supports generated columns.\n \nThe DESCRIBE statement can be used to check whether a table\nhas generated columns.\nYou can tell which columns are generated by looking for the\nones where the Extra column is set to either VIRTUAL or\nPERSISTENT. For example:\n \nDESCRIBE table1;\n \n+-------+-------------+------+-----+---------+------------+\n| Field | Type | Null | Key | Default | Extra |\n+-------+-------------+------+-----+---------+------------+\n| a | int(11) | NO | | NULL | |\n| b | varchar(32) | YES | | NULL | |\n| c | int(11) | YES | | NULL | VIRTUAL |\n| d | varchar(5) | YES | | NULL | PERSISTENT |\n+-------+-------------+------+-----+---------+------------+\nGenerated columns can be properly referenced in the NEW and\nOLD rows in triggers.\n \nStored procedures support generated columns.\n \nThe HANDLER statement supports generated columns.\n \nExpression Support\n \nMost legal, deterministic expressions which can be\ncalculated are supported in expressions for generated\ncolumns.\n \nMost built-in functions are supported in expressions for\ngenerated columns.\nHowever, some built-in functions can\'t be supported for\ntechnical reasons. For example, If you try to use an\nunsupported function in an expression, then you will see an\nerror similar to the following:\n \nERROR 1901 (HY000): Function or expression \'dayname()\'\ncannot be used in the GENERATED ALWAYS AS clause of `v`\nSubqueries are not supported in expressions for generated\ncolumns because the underlying data can change.\n \nUsing anything that depends on data outside the row is not\nsupported in expressions for generated columns.\n \nStored functions are not supported in expressions for\ngenerated columns. See MDEV-17587 for more information.\n \nIn MariaDB 10.2.1 and later, the following statements apply\nto expressions for generated columns:\nNon-deterministic built-in functions are supported in\nexpressions for PERSISTENT generated columns.\nIf a non-deterministic function is used for a PERSISTENT\ngenerated column, then any changes made to this table should\nbe logged to the binary log in the row-based logging format\nwhen the binlog_format system variable is set to MIXED.\nHowever, this does not always happen. Therefore, it is\nrecommended to set the binlog_format system variable to ROW.\nSee MDEV-10436 for more information.\n \nNon-deterministic built-in functions are not supported in\nexpressions for VIRTUAL generated columns.\n \nUser-defined functions (UDFs) are supported in expressions\nfor generated columns.\nHowever, MariaDB can\'t check whether a UDF is\ndeterministic, so it is up to the user to be sure that they\ndo not use non-deterministic UDFs with VIRTUAL generated\ncolumns.\n \nDefining a generated column based on other generated columns\ndefined before it in the table definition is supported. For\nexample:\n \nCREATE TABLE t1 (a int as (1), b int as (a));\nHowever, defining a generated column based on other\ngenerated columns defined after in the table definition is\nnot supported in expressions for generation columns because\ngenerated columns are calculated in the order they are\ndefined.\n \nUsing an expression that exceeds 255 characters in length is\nsupported in expressions for generated columns. The new\nlimit for the entire table definition, including all\nexpressions for generated columns, is 65,535 bytes.\n \nUsing constant expressions is supported in expressions for\ngenerated columns. For example:\n \nCREATE TABLE t1 (a int as (1));\n \nMariaDB until 10.2.0\n \nIn MariaDB 10.2.0 and before, the following statements apply\nto expressions for generated columns:\nNon-deterministic built-in functions are not supported in\nexpressions for generated columns.\n \nUser-defined functions (UDFs) are not supported in\nexpressions for generated columns.\n \nDefining a generated column based on other generated columns\ndefined in the table is not supported. Otherwise, it would\ngenerate errors like this:\n \nERROR 1900 (HY000): A computed column cannot be based on a\ncomputed column\nUsing an expression that exceeds 255 characters in length is\nnot supported in expressions for generated columns.\n \nUsing constant expressions is not supported in expressions\nfor generated columns. Otherwise, it would generate errors\nlike this:\n \nERROR 1908 (HY000): Constant expression in computed column\nfunction is not allowed\n \nMySQL Compatibility Support\n \nIn MariaDB 10.2.1 and later, the following statements apply\nto MySQL compatibility for generated columns:\nThe STORED keyword is supported as an alias for the\nPERSISTENT keyword.\n \nTables created with MySQL 5.7 or later that contain MySQL\'s\ngenerated columns can be imported into MariaDB without a\ndump and restore.\n \nMariaDB until 10.2.0\n \nIn MariaDB 10.2.0 and before, the following statements apply\nto MySQL compatibility for generated columns:\nThe STORED keyword is not supported as an alias for the\nPERSISTENT keyword.\n \nTables created with MySQL 5.7 or later that contain MySQL\'s\ngenerated columns can not be imported into MariaDB without a\ndump and restore.\n \nImplementation Differences\n \nGenerated columns are subject to various constraints in\nother DBMSs that are not present in MariaDB\'s\nimplementation. Generated columns may also be called\ncomputed columns or virtual columns in different\nimplementations. The various details for a specific\nimplementation can be found in the documentation for each\nspecific DBMS.\n \nImplementation Differences Compared to Microsoft SQL Server\n \nMariaDB\'s generated columns implementation does not enforce\nthe following\nrestrictions that are present in Microsoft SQL Server\'s\ncomputed columns implementation:\nMariaDB allows server variables in generated column\nexpressions, including those that change dynamically, such\nas warning_count.\nMariaDB allows the CONVERT_TZ() function to be called with a\nnamed time zone as an argument, even though time zone names\nand time offsets are configurable.\nMariaDB allows the CAST() function to be used with\nnon-unicode character sets, even though character sets are\nconfigurable and differ between binaries/versions.\nMariaDB allows FLOAT expressions to be used in generated\ncolumns. Microsoft SQL Server considers these expressions to\nbe \"imprecise\" due to potential cross-platform differences\nin floating-point implementations and precision.\nMicrosoft SQL Server requires the ARITHABORT mode to be set,\nso that division by zero returns an error, and not a NULL.\nMicrosoft SQL Server requires QUOTED_IDENTIFIER to be set in\nSQL_MODE. In MariaDB, if data is inserted without\nANSI_QUOTES set in SQL_MODE, then it will be processed and\nstored differently in a generated column that contains\nquoted identifiers.\nIn MariaDB 10.2.0 and before, it does not allow user-defined\nfunctions (UDFs) to be used in expressions for generated\ncolumns.\n \nMicrosoft SQL Server enforces the above restrictions by\ndoing one of the following things:\nRefusing to create computed columns.\nRefusing to allow updates to a table containing them.\nRefusing to use an index over such a column if it can not be\nguaranteed that the expression is fully deterministic.\n \nIn MariaDB, as long as the SQL_MODE, language, and other\nsettings that were in effect during the CREATE TABLE remain\nunchanged, the generated column expression will always be\nevaluated the same. If any of these things change, then\nplease be aware that the generated column expression might\nnot be\nevaluated the same way as it previously was.\n \nIn MariaDB 5.2, you will get a warning if you try to update\na virtual column. In MariaDB 5.3 and later, this warning\nwill be converted to an error if strict mode is enabled in\nSQL_MODE.\n \nDevelopment History\n \nGenerated columns was originally developed by Andrey Zhakov.\nIt was then modified by Sanja Byelkin and Igor Babaev at\nMonty Program for inclusion in MariaDB. Monty did the work\non MariaDB 10.2 to lift a some of the old limitations.\n \nExamples\n-------- \nHere is an example table that uses both VIRTUAL and\nPERSISTENT virtual columns:\n \nUSE TEST;\n \nCREATE TABLE table1 (\n a INT NOT NULL,\n b VARCHAR(32),\n c INT AS (a mod 10) VIRTUAL,\n d VARCHAR(5) AS (left(b,5)) PERSISTENT);\n \nIf you describe the table, you can easily see which columns\nare virtual by\nlooking in the \"Extra\" column:\n \nDESCRIBE table1;\n \n+-------+-------------+------+-----+---------+------------+\n| Field | Type | Null | Key | Default | Extra |\n+-------+-------------+------+-----+---------+------------+\n| a | int(11) | NO | | NULL | |\n| b | varchar(32) | YES | | NULL | |\n| c | int(11) | YES | | NULL | VIRTUAL |\n| d | varchar(5) | YES | | NULL | PERSISTENT |\n+-------+-------------+------+-----+---------+------------+\n \nTo find out what function(s) generate the value of the\nvirtual column you can use SHOW CREATE TABLE:\n \nSHOW CREATE TABLE table1;\n \n| table1 | CREATE TABLE `table1` (\n `a` int(11) NOT NULL,\n `b` varchar(32) DEFAULT NULL,\n `c` int(11) AS (a mod 10) VIRTUAL,\n `d` varchar(5) AS (left(b,5)) PERSISTENT\n) ENGINE=MyISAM DEFAULT CHARSET=latin1 |\n \nIf you try to insert non-default values into a virtual\ncolumn, you will receive\na warning and what you tried to insert will be ignored and\nthe derived value\ninserted instead:\n \nWARNINGS;\nShow warnings enabled.\n \nINSERT INTO table1 VALUES (1, \'some\ntext\',default,default);\nQuery OK, 1 row affected (0.00 sec)\n \nINSERT INTO table1 VALUES (2, \'more text\',5,default);\nQuery OK, 1 row affected, 1 warning (0.00 sec)\n \nWarning (Code 1645): The value specified for computed column\n\'c\' in table \'table1\' has been ignored.\n \nINSERT INTO table1 VALUES (123, \'even more\ntext\',default,\'something\');\nQuery OK, 1 row affected, 2 warnings (0.00 sec)\n \nWarning (Code 1645): The value specified for computed column\n\'d\' in table \'table1\' has been ignored.\nWarning (Code 1265): Data truncated for column \'d\' at row\n1\n \nSELECT * FROM table1;\n+-----+----------------+------+-------+\n| a | b | c | d |\n+-----+----------------+------+-------+\n| 1 | some text | 1 | some |\n| 2 | more text | 2 | more |\n| 123 | even more text | 3 | even |\n+-----+----------------+------+-------+\n3 rows in set (0.00 sec)\n \nIf the ZEROFILL clause is specified, it should be placed\ndirectly after the type definition, before the AS ():\n \nCREATE TABLE table2 (a INT, b INT ZEROFILL AS (a*2)\nVIRTUAL);\nINSERT INTO table2 (a) VALUES (1);\n \nSELECT * FROM table2;\n \n+------+------------+\n| a | b |\n+------+------------+\n| 1 | 0000000002 |\n+------+------------+\n1 row in set (0.00 sec)\n \nYou can also use virtual columns to implement a \"poor\nman\'s partial index\". See example at the end of Unique\nIndex.\n \n\n\nURL: https://mariadb.com/kb/en/generated-columns/','','https://mariadb.com/kb/en/generated-columns/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (688,40,'LASTVAL','LASTVAL is a synonym for PREVIOUS VALUE for sequence_name.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/lastval/','','https://mariadb.com/kb/en/lastval/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (689,40,'NEXT VALUE for sequence_name','SEQUENCEs were introduced in MariaDB 10.3\n \nSyntax\n------ \nNEXT VALUE FOR sequence\n \nor\n \nNEXTVAL(sequence_name)\n \nor in Oracle mode (SQL_MODE=ORACLE)\n \nsequence_name.nextval\n \nNEXT VALUE FOR is ANSI SQL syntax while NEXTVAL() is\nPostgreSQL syntax.\n \nDescription\n----------- \nGenerate next value for a SEQUENCE.\nYou can greatly speed up NEXT VALUE by creating the sequence\nwith the CACHE option. If not, every NEXT VALUE usage will\ncause changes in the stored SEQUENCE table.\nWhen using NEXT VALUE the value will be reserved at once and\nwill not be reused, except if the SEQUENCE was created with\nCYCLE. This means that when you are using SEQUENCEs you have\nto expect gaps in the generated sequence numbers.\nIf one updates the SEQUENCE with SETVAL() or ALTER SEQUENCE\n... RESTART, NEXT VALUE FOR will notice this and start from\nthe next requested value.\nFLUSH TABLES will close the sequence and the next sequence\nnumber generated will be according to what\'s stored in the\nSEQUENCE object. In effect, this will discard the cached\nvalues.\nNEXT VALUE requires the INSERT privilege.\n \nYou can also use NEXT VALUE FOR sequence for column DEFAULT.\n \n\n\nURL: https://mariadb.com/kb/en/next-value-for-sequence_name/','','https://mariadb.com/kb/en/next-value-for-sequence_name/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (690,40,'NEXTVAL','NEXTVAL is a synonym for NEXT VALUE for sequence_name.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/nextval/','','https://mariadb.com/kb/en/nextval/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (691,40,'PREVIOUS VALUE FOR sequence_name','SEQUENCEs were introduced in MariaDB 10.3.\n \nSyntax\n------ \nPREVIOUS VALUE FOR sequence_name\n \nor\n \nLASTVAL(sequence_name)\n \nor in Oracle mode (SQL_MODE=ORACLE)\n \nsequence_name.currval\n \nPREVIOUS VALUE FOR is IBM DB2 syntax while LASTVAL() is\nPostgreSQL syntax.\n \nDescription\n----------- \nGet last value in the current connection generated from a\nsequence.\nIf the sequence has not yet been used by the connection,\nPREVIOUS VALUE FOR returns NULL\nIf a SEQUENCE has been dropped and re-created then it\'s\ntreated as a new SEQUENCE and PREVIOUS VALUE FOR will return\nNULL.\nFLUSH TABLES has no effect on PREVIOUS VALUE FOR.\nPrevious values for all used sequences are stored per\nconnection until connection ends.\n \nPREVIOUS VALUE FOR requires the SELECT privilege.\n \nExample\n \nSELECT PREVIOUS VALUE FOR s;\n \n+----------------------+\n| PREVIOUS VALUE FOR s |\n+----------------------+\n| 100 |\n+----------------------+\n \n\n\nURL:\nhttps://mariadb.com/kb/en/previous-value-for-sequence_name/','','https://mariadb.com/kb/en/previous-value-for-sequence_name/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (692,40,'Sequence Overview','Sequences were introduced in MariaDB 10.3.\n \nIntroduction\n \nA sequence is an object that generates a sequence of numeric\nvalues, as specified by the CREATE SEQUENCE statement. \n \nCREATE SEQUENCE will create a sequence that generates new\nvalues when called with NEXT VALUE FOR sequence_name. It\'s\nan alternative to AUTO INCREMENT when one wants to have more\ncontrol of how the numbers are generated. As the SEQUENCE\ncaches values (up to the CACHE value in the CREATE SEQUENCE\nstatement, by default 1000) it can in some cases be much\nfaster than AUTO INCREMENT. Another benefit is that one can\naccess the last value generated by all used sequences, which\nsolves one of the limitations with LAST_INSERT_ID().\n \nCreating a Sequence\n \nThe CREATE SEQUENCE statement is used to create a sequence.\nHere is an example of a sequence starting at 100,\nincrementing by 10 each time:\n \nCREATE SEQUENCE s START WITH 100 INCREMENT BY 10;\n \nThe CREATE SEQUENCE statement, along with defaults, can be\nviewd with the SHOW CREATE SEQUENCE STATEMENT, for example:\n \nSHOW CREATE SEQUENCE s\\G\n*************************** 1. row\n***************************\n Table: s\nCreate Table: CREATE SEQUENCE `s` start with 100 minvalue 1\nmaxvalue 9223372036854775806 \n increment by 10 cache 1000 nocycle ENGINE=InnoDB\n \nUsing Sequence Objects\n \nTo get the next value from a sequence, use\n \nNEXT VALUE FOR sequence_name\n \nor\n \nNEXTVAL(sequence_name)\n \nor in Oracle mode (SQL_MODE=ORACLE)\n \nsequence_name.nextval\n \nFor retrieving the last value used by the current connection\nfrom a sequence\nuse:\n \nPREVIOUS VALUE FOR sequence_name\n \nor\n \nLASTVAL(sequence_name)\n \nor in Oracle mode (SQL_MODE=ORACLE)\n \nsequence_name.currval\n \nFor example:\n \nSELECT NEXTVAL(s);\n+------------+\n| NEXTVAL(s) |\n+------------+\n| 100 |\n+------------+\n \nSELECT NEXTVAL(s);\n+------------+\n| NEXTVAL(s) |\n+------------+\n| 110 |\n+------------+\n \nSELECT LASTVAL(s);\n+------------+\n| LASTVAL(s) |\n+------------+\n| 110 |\n+------------+\n \nUsing Sequences in DEFAULT\n \nStarting from 10.3.3 you can use Sequences in DEFAULT:\n \ncreate sequence s1;\n \ncreate table t1 (a int primary key default (next value for\ns1), b int);\ninsert into t1 (b) values (1),(2);\nselect * from t1;\n \n+---+------+\n| a | b |\n+---+------+\n| 1 | 1 |\n| 2 | 2 |\n+---+------+\n \nChanging a Sequence\n \nThe ALTER SEQUENCE statement is used for changing sequences.\nFor example, to restart the sequence at another value:\n \nALTER SEQUENCE s RESTART 50;\n \nSELECT NEXTVAL(s);\n+------------+\n| NEXTVAL(s) |\n+------------+\n| 50 |\n+------------+\n \nThe SETVAL function can also be used to set the next value\nto be returned for a SEQUENCE, for example:\n \nSELECT SETVAL(s, 100);\n+----------------+\n| SETVAL(s, 100) |\n+----------------+\n| 100 |\n+----------------+\n \nSETVAL can only be used to increase the sequence value.\nAttempting to set a lower value will fail, returning NULL:\n \nSELECT SETVAL(s, 50);\n+---------------+\n| SETVAL(s, 50) |\n+---------------+\n| NULL |\n+---------------+\n \nDropping a Sequence\n \nThe DROP SEQUENCE statement is used to drop a sequence, for\nexample:\n \nDROP SEQUENCE s;\n \nReplication\n \nIf one wants to use Sequences in a master-master setup or\nwith Galera one\nshould use INCREMENT=0. This will tell the Sequence to use\nauto_increment_increment and auto_increment_offset to\ngenerate unique values for each server.\n \nStandards Compliance\n \nMariaDB 10.3 supports both ANSI SQL and Oracle syntax for\nsequences.\n \nHowever as SEQUENCE is implemented as a special kind of\ntable, it uses the same namespace as tables. The benefits\nare that sequences show up in SHOW TABLES, and one can also\ncreate a sequence with CREATE TABLE and drop it with DROP\nTABLE. One can SELECT from it as from any other table. This\nensures that all old tools that work with tables should work\nwith sequences.\n \nSince sequence objects act as regular tables in many\ncontexts, they will be affected by LOCK TABLES. This is not\nthe case in other DBMS, such as Oracle, where LOCK TABLE\ndoes not affect sequences.\n \nNotes\n \nOne of the goals with the Sequence implementation is that\nall old\ntools, such as mysqldump, should work unchanged, while still\nkeeping the\nnormal usage of sequence standard compatibly.\n \nTo make this possible, sequence is currently implemented as\na table with a few exclusive properties.\n \nThe special properties for sequence tables are:\nA sequence table has always one row.\nWhen one creates a sequence, either with CREATE TABLE or\nCREATE SEQUENCE, one row will be inserted.\nIf one tries to insert into a sequence table, the single row\nwill be updated. This allows mysqldump to work but also\ngives the additional benefit that one can change all\nproperties of a sequence with a single insert. New\napplications should of course also use ALTER SEQUENCE.\nUPDATE or DELETE can\'t be performed on Sequence objects.\nDoing a select on the sequence shows the current state of\nthe sequence, except the values that are reserved in the\ncache. The next_value column shows the next value not\nreserved by the cache.\nFLUSH TABLES will close the sequence and the next sequence\nnumber generated will be according to what\'s stored in the\nSequence object. In effect, this will discard the cached\nvalues.\nA number of normal table operations work on Sequence tables.\nSee next section.\n \nTable Operations that Work with Sequences\n \nSHOW CREATE TABLE sequence_name. This shows the table\nstructure that is behind the SEQUENCE including the field\nnames that can be used with SELECT or even CREATE TABLE.\nCREATE TABLE sequence-structure ... SEQUENCE=1\nALTER TABLE sequence RENAME TO sequence2\nRENAME TABLE sequence_name TO new_sequence_name\nDROP TABLE sequence_name. This is allowed mainly to get old\ntools like mysqldump to work with sequence tables.\nSHOW TABLES\n \nImplementation\n \nInternally, sequence tables are created as a normal table\nwithout\nrollback (the InnoDB, Aria and MySAM engines support this),\nwrapped by a\nsequence engine object. This allowed us to create sequences\nwith\nalmost no performance impact for normal tables. (The cost is\none \'if\'\nper insert if the binary log is enabled).\n \nUnderlying Table Structure\n \nThe following example shows the table structure of sequences\nand how it\ncan be used as a table.\n(Output of results are slightly edited to make them easier\nto read)\n \ncreate sequence t1;\nshow create sequence t1\\G\n***** 1. row *****\n CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue\n9223372036854775806\n increment by 1 cache 1000 nocycle ENGINE=InnoDB\n \nshow create table t1\\G\n***** 1. row *****\nCreate Table: CREATE TABLE `t1` (\n `next_not_cached_value` bigint(21) NOT NULL,\n `minimum_value` bigint(21) NOT NULL,\n `maximum_value` bigint(21) NOT NULL,\n `start_value` bigint(21) NOT NULL COMMENT \'start value\nwhen sequences is created or value if RESTART is used\',\n `increment` bigint(21) NOT NULL COMMENT \'increment\nvalue\',\n `cache_size` bigint(21) unsigned NOT NULL,\n `cycle_option` tinyint(1) unsigned NOT NULL COMMENT \'0 if\nno cycles are allowed, 1 if the sequence should begin a new\ncycle when maximum_value is passed\',\n `cycle_count` bigint(21) NOT NULL COMMENT \'How many cycles\nhave been done\'\n) ENGINE=InnoDB SEQUENCE=1\n \nselect * from t1\\G\nnext_not_cached_value: 1\n minimum_value: 1\n maximum_value: 9223372036854775806\n start_value: 1\n increment: 1\n cache_size: 1000\n cycle_option: 0\n cycle_count: 0\nThe cycle_count column is incremented every time the\nsequence wraps around.\n \nCredits\n \nThanks to Jianwe Zhao from Aliyun for his work on SEQUENCE\nin AliSQL, which gave ideas and inspiration for this work.\nThanks to Peter Gulutzan,who helped test and gave useful\ncomments about the implementation.\n \n\n\nURL: https://mariadb.com/kb/en/sequence-overview/','','https://mariadb.com/kb/en/sequence-overview/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (693,40,'SETVAL()','SEQUENCEs were introduced in MariaDB 10.3.\n \nSyntax\n------ \nSETVAL(sequence_name, next_value, [is_used, [round]])\n \nDescription\n----------- \nSet the next value to be returned for a SEQUENCE.\n \nThis function is compatible with PostgreSQL syntax, extended\nwith the round argument.\n \nIf the is_used argument is not given or is 1 or true, then\nthe next used value will\none after the given value. If is_used is 0 or false then the\nnext generated value\nwill be the given value.\n \nIf round is used then it will set the round value (or the\ninternal cycle count, starting at zero) for the sequence.\nIf round is not used, it\'s assumed to be 0.\n \nnext_value must be an integer literal.\n \nFor SEQUENCE tables defined with CYCLE (see CREATE SEQUENCE)\none should use both next_value and round to define the next\nvalue. In this case the\ncurrent sequence value is defined to be round, next_value.\n \nThe result returned by SETVAL() is next_value or NULL if the\ngiven next_value and round is smaller than the current\nvalue.\n \nSETVAL() will not set the SEQUENCE value to a something that\nis less than\nits current value. This is needed to ensure that SETVAL()\nis replication safe. If you want to set the SEQUENCE to a\nsmaller number\nuse ALTER SEQUENCE.\n \nIf CYCLE is used, first round and then next_value are\ncompared\nto see if the value is bigger than the current value.\n \nInternally, in the MariaDB server, SETVAL() is used to\ninform\nslaves that a SEQUENCE has changed value. The slave may get\nSETVAL() statements out of order, but this is ok as only the\nbiggest one will have an effect.\n \nSETVAL requires the INSERT privilege.\n \nExamples\n-------- \nSELECT setval(foo, 42); -- Next nextval will return 43\nSELECT setval(foo, 42, true); -- Same as above\nSELECT setval(foo, 42, false); -- Next nextval will return\n42\n \nSETVAL setting higher and lower values on a sequence with an\nincrement of 10:\n \nSELECT NEXTVAL(s);\n+------------+\n| NEXTVAL(s) |\n+------------+\n| 50 |\n+------------+\n \nSELECT SETVAL(s, 100);\n+----------------+\n| SETVAL(s, 100) |\n+----------------+\n| 100 |\n+----------------+\n \nSELECT NEXTVAL(s);\n+------------+\n| NEXTVAL(s) |\n+------------+\n| 110 |\n+------------+\n \nSELECT SETVAL(s, 50);\n+---------------+\n| SETVAL(s, 50) |\n+---------------+\n| NULL |\n+---------------+\n \nSELECT NEXTVAL(s);\n+------------+\n| NEXTVAL(s) |\n+------------+\n| 120 |\n+------------+\n \nExample demonstrating round:\n \nCREATE OR REPLACE SEQUENCE s1\n START WITH 1\n MINVALUE 1\n MAXVALUE 99\n INCREMENT BY 1 \n CACHE 20 \n CYCLE;\n \nSELECT SETVAL(s1, 99, 1, 0);\n+----------------------+\n| SETVAL(s1, 99, 1, 0) |\n+----------------------+\n| 99 |\n+----------------------+\n \nSELECT NEXTVAL(s1);\n+-------------+\n| NEXTVAL(s1) |\n+-------------+\n| 1 |\n+-------------+\n \nThe following statement returns NULL, as the given\nnext_value and round is smaller than the current value.\n \nSELECT SETVAL(s1, 99, 1, 0);\n+----------------------+\n| SETVAL(s1, 99, 1, 0) |\n+----------------------+\n| NULL |\n+----------------------+\n \nSELECT NEXTVAL(s1);\n+-------------+\n| NEXTVAL(s1) |\n+-------------+\n| 2 |\n+-------------+\n \nIncreasing the round from zero to 1 will allow next_value to\nbe returned.\n \nSELECT SETVAL(s1, 99, 1, 1);\n+----------------------+\n| SETVAL(s1, 99, 1, 1) |\n+----------------------+\n| 99 |\n+----------------------+\n \nSELECT NEXTVAL(s1);\n+-------------+\n| NEXTVAL(s1) |\n+-------------+\n| 1 |\n+-------------+\n \n\n\nURL: https://mariadb.com/kb/en/setval/','','https://mariadb.com/kb/en/setval/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (694,41,'Differences between JSON_QUERY and JSON_VALUE','JSON functions were added in MariaDB 10.2.3.\n \nThe primary difference between the two functions is that\nJSON_QUERY returns an object or an array, while JSON_VALUE\nreturns a scalar. \n \nTake the following JSON document as an example\n \nSET @json=\'{ \"x\": [0,1], \"y\": \"[0,1]\", \"z\":\n\"Monty\" }\';\n \nNote that data member \"x\" is an array, and data members\n\"y\" and \"z\" are strings. The following examples\ndemonstrate the differences between the two functions.\n \nSELECT JSON_QUERY(@json,\'$\'), JSON_VALUE(@json,\'$\');\n+--------------------------------------------+-----------------------+\n| JSON_QUERY(@json,\'$\') | JSON_VALUE(@json,\'$\') |\n+--------------------------------------------+-----------------------+\n| { \"x\": [0,1], \"y\": \"[0,1]\", \"z\": \"Monty\" } |\nNULL |\n+--------------------------------------------+-----------------------+\n \nSELECT JSON_QUERY(@json,\'$.x\'), JSON_VALUE(@json,\'$.x\');\n+-------------------------+-------------------------+\n| JSON_QUERY(@json,\'$.x\') | JSON_VALUE(@json,\'$.x\') |\n+-------------------------+-------------------------+\n| [0,1] | NULL |\n+-------------------------+-------------------------+\n \nSELECT JSON_QUERY(@json,\'$.y\'), JSON_VALUE(@json,\'$.y\');\n+-------------------------+-------------------------+\n| JSON_QUERY(@json,\'$.y\') | JSON_VALUE(@json,\'$.y\') |\n+-------------------------+-------------------------+\n| NULL | [0,1] |\n+-------------------------+-------------------------+\n \nSELECT JSON_QUERY(@json,\'$.z\'), JSON_VALUE(@json,\'$.z\');\n+-------------------------+-------------------------+\n| JSON_QUERY(@json,\'$.z\') | JSON_VALUE(@json,\'$.z\') |\n+-------------------------+-------------------------+\n| NULL | Monty |\n+-------------------------+-------------------------+\n \nSELECT JSON_QUERY(@json,\'$.x[0]\'),\nJSON_VALUE(@json,\'$.x[0]\');\n+----------------------------+----------------------------+\n| JSON_QUERY(@json,\'$.x[0]\') |\nJSON_VALUE(@json,\'$.x[0]\') |\n+----------------------------+----------------------------+\n| NULL | 0 |\n+----------------------------+----------------------------+\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/differences-between-json_query-and-json_value/','','https://mariadb.com/kb/en/differences-between-json_query-and-json_value/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (695,41,'JSON_ARRAY','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_ARRAY([value[, value2] ...])\n \nDescription\n----------- \nReturns a JSON array containing the listed values. The list\ncan be empty.\n \nExample\n \nSELECT Json_Array(56, 3.1416, \'My name is \"Foo\"\', NULL);\n+--------------------------------------------------+\n| Json_Array(56, 3.1416, \'My name is \"Foo\"\', NULL) |\n+--------------------------------------------------+\n| [56, 3.1416, \"My name is \\\"Foo\\\"\", null] |\n+--------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_array/','','https://mariadb.com/kb/en/json_array/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (696,41,'JSON_ARRAY_APPEND','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_ARRAY_APPEND(json_doc, path, value[, path, value] ...)\n \nDescription\n----------- \nAppends values to the end of the specified arrays within a\nJSON document, returning the result, or NULL if any of the\narguments are NULL.\n \nEvaluation is performed from left to right, with the\nresulting document from the previous pair becoming the new\nvalue against which the next pair is evaluated.\n \nIf the json_doc is not a valid JSON document, or if any of\nthe paths are not valid, or contain a * or ** wildcard, an\nerror is returned.\n \nExamples\n-------- \nSET @json = \'[1, 2, [3, 4]]\';\n \nSELECT JSON_ARRAY_APPEND(@json, \'$[0]\', 5)\n+-------------------------------------+\n| JSON_ARRAY_APPEND(@json, \'$[0]\', 5) |\n+-------------------------------------+\n| [[1, 5], 2, [3, 4]] |\n+-------------------------------------+\n \nSELECT JSON_ARRAY_APPEND(@json, \'$[1]\', 6);\n+-------------------------------------+\n| JSON_ARRAY_APPEND(@json, \'$[1]\', 6) |\n+-------------------------------------+\n| [1, [2, 6], [3, 4]] |\n+-------------------------------------+\n \nSELECT JSON_ARRAY_APPEND(@json, \'$[1]\', 6, \'$[2]\', 7);\n+------------------------------------------------+\n| JSON_ARRAY_APPEND(@json, \'$[1]\', 6, \'$[2]\', 7) |\n+------------------------------------------------+\n| [1, [2, 6], [3, 4, 7]] |\n+------------------------------------------------+\n \nSELECT JSON_ARRAY_APPEND(@json, \'$\', 5);\n+----------------------------------+\n| JSON_ARRAY_APPEND(@json, \'$\', 5) |\n+----------------------------------+\n| [1, 2, [3, 4], 5] |\n+----------------------------------+\n \nSET @json = \'{\"A\": 1, \"B\": [2], \"C\": [3, 4]}\';\n \nSELECT JSON_ARRAY_APPEND(@json, \'$.B\', 5);\n+------------------------------------+\n| JSON_ARRAY_APPEND(@json, \'$.B\', 5) |\n+------------------------------------+\n| {\"A\": 1, \"B\": [2, 5], \"C\": [3, 4]} |\n+------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_array_append/','','https://mariadb.com/kb/en/json_array_append/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (697,41,'JSON_ARRAY_INSERT','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_ARRAY_INSERT(json_doc, path, value[, path, value] ...)\n \nDescription\n----------- \nInserts a value into a JSON document, returning the modified\ndocument, or NULL if any of the arguments are NULL.\n \nEvaluation is performed from left to right, with the\nresulting document from the previous pair becoming the new\nvalue against which the next pair is evaluated.\n \nIf the json_doc is not a valid JSON document, or if any of\nthe paths are not valid, or contain a * or ** wildcard, an\nerror is returned.\n \nExamples\n-------- \nSET @json = \'[1, 2, [3, 4]]\';\n \nSELECT JSON_ARRAY_INSERT(@json, \'$[0]\', 5);\n+-------------------------------------+\n| JSON_ARRAY_INSERT(@json, \'$[0]\', 5) |\n+-------------------------------------+\n| [5, 1, 2, [3, 4]] |\n+-------------------------------------+\n \nSELECT JSON_ARRAY_INSERT(@json, \'$[1]\', 6);\n+-------------------------------------+\n| JSON_ARRAY_INSERT(@json, \'$[1]\', 6) |\n+-------------------------------------+\n| [1, 6, 2, [3, 4]] |\n+-------------------------------------+\n \nSELECT JSON_ARRAY_INSERT(@json, \'$[1]\', 6, \'$[2]\', 7);\n+------------------------------------------------+\n| JSON_ARRAY_INSERT(@json, \'$[1]\', 6, \'$[2]\', 7) |\n+------------------------------------------------+\n| [1, 6, 7, 2, [3, 4]] |\n+------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_array_insert/','','https://mariadb.com/kb/en/json_array_insert/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (698,41,'JSON_COMPACT','This function was added in MariaDB 10.2.4.\n \nSyntax\n------ \nJSON_COMPACT(json_doc)\n \nDescription\n----------- \nRemoves all unnecessary spaces so the json document is as\nshort as possible.\n \nExample\n \nSET @j = \'{ \"A\": 1, \"B\": [2, 3]}\';\n \nSELECT JSON_COMPACT(@j), @j;\n+-------------------+------------------------+\n| JSON_COMPACT(@j) | @j |\n+-------------------+------------------------+\n| {\"A\":1,\"B\":[2,3]} | { \"A\": 1, \"B\": [2, 3]} |\n+-------------------+------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_compact/','','https://mariadb.com/kb/en/json_compact/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (699,41,'JSON_CONTAINS','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_CONTAINS(json_doc, val[, path])\n \nDescription\n----------- \nReturns whether or not the specified value is found in the\ngiven JSON document or, optionally, at the specified path\nwithin the document. Returns 1 if it does, 0 if not and NULL\nif any of the arguments are null. An error occurs if the\ndocument or path is not valid, or contains the * or **\nwildcards.\n \nExamples\n-------- \nSET @json = \'{\"A\": 0, \"B\": {\"C\": 1}, \"D\": 2}\';\n \nSELECT JSON_CONTAINS(@json, \'2\', \'$.A\');\n+----------------------------------+\n| JSON_CONTAINS(@json, \'2\', \'$.A\') |\n+----------------------------------+\n| 0 |\n+----------------------------------+\n \nSELECT JSON_CONTAINS(@json, \'2\', \'$.D\');\n+----------------------------------+\n| JSON_CONTAINS(@json, \'2\', \'$.D\') |\n+----------------------------------+\n| 1 |\n+----------------------------------+\n \nSELECT JSON_CONTAINS(@json, \'{\"C\": 1}\', \'$.A\');\n+-----------------------------------------+\n| JSON_CONTAINS(@json, \'{\"C\": 1}\', \'$.A\') |\n+-----------------------------------------+\n| 0 |\n+-----------------------------------------+\n \nSELECT JSON_CONTAINS(@json, \'{\"C\": 1}\', \'$.B\');\n+-----------------------------------------+\n| JSON_CONTAINS(@json, \'{\"C\": 1}\', \'$.B\') |\n+-----------------------------------------+\n| 1 |\n+-----------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_contains/','','https://mariadb.com/kb/en/json_contains/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (700,41,'JSON_CONTAINS_PATH','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_CONTAINS_PATH(json_doc, return_arg, path[, path] ...)\n \nDescription\n----------- \nIndicates whether the given JSON document contains data at\nthe specified path or paths. Returns 1 if it does, 0 if not\nand NULL if any of the arguments are null.\n \nThe return_arg can be one or all:\none - Returns 1 if at least one path exists within the JSON\ndocument. \nall - Returns 1 only if all paths exist within the JSON\ndocument.\n \nExamples\n-------- \nSET @json = \'{\"A\": 1, \"B\": [2], \"C\": [3, 4]}\';\n \nSELECT JSON_CONTAINS_PATH(@json, \'one\', \'$.A\', \'$.D\');\n+------------------------------------------------+\n| JSON_CONTAINS_PATH(@json, \'one\', \'$.A\', \'$.D\') |\n+------------------------------------------------+\n| 1 |\n+------------------------------------------------+\n1 row in set (0.00 sec)\n \nSELECT JSON_CONTAINS_PATH(@json, \'all\', \'$.A\', \'$.D\');\n+------------------------------------------------+\n| JSON_CONTAINS_PATH(@json, \'all\', \'$.A\', \'$.D\') |\n+------------------------------------------------+\n| 0 |\n+------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_contains_path/','','https://mariadb.com/kb/en/json_contains_path/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (701,41,'JSON_DEPTH','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_DEPTH(json_doc)\n \nDescription\n----------- \nReturns the maximum depth of the given JSON document, or\nNULL if the argument is null. An error will occur if the\nargument is an invalid JSON document.\nScalar values or empty arrays or objects have a depth of 1.\nArrays or objects that are not empty but contain only\nelements or member values of depth 1 will have a depth of 2.\nIn other cases, the depth will be greater than 2.\n \nExamples\n-------- \nSELECT JSON_DEPTH(\'[]\'), JSON_DEPTH(\'true\'),\nJSON_DEPTH(\'{}\');\n+------------------+--------------------+------------------+\n| JSON_DEPTH(\'[]\') | JSON_DEPTH(\'true\') |\nJSON_DEPTH(\'{}\') |\n+------------------+--------------------+------------------+\n| 1 | 1 | 1 |\n+------------------+--------------------+------------------+\n \nSELECT JSON_DEPTH(\'[1, 2, 3]\'), JSON_DEPTH(\'[[], {},\n[]]\');\n+-------------------------+----------------------------+\n| JSON_DEPTH(\'[1, 2, 3]\') | JSON_DEPTH(\'[[], {}, []]\') |\n+-------------------------+----------------------------+\n| 2 | 2 |\n+-------------------------+----------------------------+\n \nSELECT JSON_DEPTH(\'[1, 2, [3, 4, 5, 6], 7]\');\n+---------------------------------------+\n| JSON_DEPTH(\'[1, 2, [3, 4, 5, 6], 7]\') |\n+---------------------------------------+\n| 3 |\n+---------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_depth/','','https://mariadb.com/kb/en/json_depth/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (702,41,'JSON_DETAILED','This function was added in MariaDB 10.2.4.\n \nSyntax\n------ \nJSON_DETAILED(json_doc[, tab_size])\n \nDescription\n----------- \nRepresents JSON in the most understandable way emphasizing\nnested structures.\n \nExample\n \nSET @j = \'{ \"A\":1,\"B\":[2,3]}\';\n \nSELECT @j;\n+--------------------+\n| @j |\n+--------------------+\n| { \"A\":1,\"B\":[2,3]} |\n+--------------------+\n \nSELECT JSON_DETAILED(@j);\n+------------------------------------------------------------+\n| JSON_DETAILED(@j) |\n+------------------------------------------------------------+\n| {\n \"A\": 1,\n \"B\": \n [\n 2,\n 3\n ]\n} |\n+------------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_detailed/','','https://mariadb.com/kb/en/json_detailed/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (703,41,'JSON_EXISTS','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nDescription\n----------- \nDetermines whether a specified JSON value exists in the\ngiven data. Returns 1 if found, 0 if not, or NULL if any of\nthe inputs were NULL.\n \nExamples\n-------- \nSELECT JSON_EXISTS(\'{\"key1\":\"xxxx\", \"key2\":[1, 2,\n3]}\', \"$.key2\");\n+------------------------------------------------------------+\n| JSON_EXISTS(\'{\"key1\":\"xxxx\", \"key2\":[1, 2, 3]}\',\n\"$.key2\") |\n+------------------------------------------------------------+\n| 1 |\n+------------------------------------------------------------+\n \nSELECT JSON_EXISTS(\'{\"key1\":\"xxxx\", \"key2\":[1, 2,\n3]}\', \"$.key3\");\n+------------------------------------------------------------+\n| JSON_EXISTS(\'{\"key1\":\"xxxx\", \"key2\":[1, 2, 3]}\',\n\"$.key3\") |\n+------------------------------------------------------------+\n| 0 |\n+------------------------------------------------------------+\n \nSELECT JSON_EXISTS(\'{\"key1\":\"xxxx\", \"key2\":[1, 2,\n3]}\', \"$.key2[1]\");\n+---------------------------------------------------------------+\n| JSON_EXISTS(\'{\"key1\":\"xxxx\", \"key2\":[1, 2, 3]}\',\n\"$.key2[1]\") |\n+---------------------------------------------------------------+\n| 1 |\n+---------------------------------------------------------------+\n \nSELECT JSON_EXISTS(\'{\"key1\":\"xxxx\", \"key2\":[1, 2,\n3]}\', \"$.key2[10]\");\n+----------------------------------------------------------------+\n| JSON_EXISTS(\'{\"key1\":\"xxxx\", \"key2\":[1, 2, 3]}\',\n\"$.key2[10]\") |\n+----------------------------------------------------------------+\n| 0 |\n+----------------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_exists/','','https://mariadb.com/kb/en/json_exists/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (704,41,'JSON_EXTRACT','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_EXTRACT(json_doc, path[, path] ...)\n \nDescription\n----------- \nExtracts data from a JSON document. The extracted data is\nselected from the parts matching the path arguments. Returns\nall matched values; either as a single matched value, or, if\nthe arguments could return multiple values, a result\nautowrapped as an array in the matching order.\n \nReturns NULL if no paths match or if any of the arguments\nare NULL. \n \nAn error will occur if any path argument is not a valid\npath, or if the json_doc argument is not a valid JSON\ndocument.\n \nExamples\n-------- \nSET @json = \'[1, 2, [3, 4]]\';\n \nSELECT JSON_EXTRACT(@json, \'$[1]\');\n+-----------------------------+\n| JSON_EXTRACT(@json, \'$[1]\') |\n+-----------------------------+\n| 2 |\n+-----------------------------+\n \nSELECT JSON_EXTRACT(@json, \'$[2]\');\n+-----------------------------+\n| JSON_EXTRACT(@json, \'$[2]\') |\n+-----------------------------+\n| [3, 4] |\n+-----------------------------+\n \nSELECT JSON_EXTRACT(@json, \'$[2][1]\');\n+--------------------------------+\n| JSON_EXTRACT(@json, \'$[2][1]\') |\n+--------------------------------+\n| 4 |\n+--------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_extract/','','https://mariadb.com/kb/en/json_extract/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (705,41,'JSON_INSERT','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_INSERT(json_doc, path, val[, path, val] ...)\n \nDescription\n----------- \nInserts data into a JSON document, returning the resulting\ndocument or NULL if any argument is null. \n \nAn error will occur if the JSON document is not invalid, or\nif any of the paths are invalid or contain a * or **\nwildcard.\n \nJSON_INSERT can only insert data while JSON_REPLACE can only\nupdate. JSON_SET can update or insert data. \n \nExamples\n-------- \nSET @json = \'{ \"A\": 0, \"B\": [1, 2]}\';\n \nSELECT JSON_INSERT(@json, \'$.C\', \'[3, 4]\');\n+--------------------------------------+\n| JSON_INSERT(@json, \'$.C\', \'[3, 4]\') |\n+--------------------------------------+\n| { \"A\": 0, \"B\": [1, 2], \"C\":\"[3, 4]\"} |\n+--------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_insert/','','https://mariadb.com/kb/en/json_insert/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (706,41,'JSON_KEYS','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_KEYS(json_doc[, path])\n \nDescription\n----------- \nReturns the keys as a JSON array from the top-level value of\na JSON object or, if the optional path argument is provided,\nthe top-level keys from the path. \n \nExcludes keys from nested sub-objects in the top level\nvalue. The resulting array will be empty if the selected\nobject is empty.\n \nReturns NULL if any of the arguments are null, a given path\ndoes not locate an object, or if the json_doc argument is\nnot an object.\n \nAn error will occur if JSON document is invalid, the path is\ninvalid or if the path contains a * or ** wildcard.\n \nExamples\n-------- \nSELECT JSON_KEYS(\'{\"A\": 1, \"B\": {\"C\": 2}}\');\n+--------------------------------------+\n| JSON_KEYS(\'{\"A\": 1, \"B\": {\"C\": 2}}\') |\n+--------------------------------------+\n| [\"A\", \"B\"] |\n+--------------------------------------+\n \nSELECT JSON_KEYS(\'{\"A\": 1, \"B\": 2, \"C\": {\"D\":\n3}}\', \'$.C\');\n+-----------------------------------------------------+\n| JSON_KEYS(\'{\"A\": 1, \"B\": 2, \"C\": {\"D\": 3}}\',\n\'$.C\') |\n+-----------------------------------------------------+\n| [\"D\"] |\n+-----------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_keys/','','https://mariadb.com/kb/en/json_keys/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (707,41,'JSON_LENGTH','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_LENGTH(json_doc[, path])\n \nDescription\n----------- \nReturns the length of a JSON document, or, if the optional\npath argument is given, the length of the value within the\ndocument specified by the path. \n \nReturns NULL if any of the arguments argument are null or\nthe path argument does not identify a value in the document.\n\n \nAn error will occur if the JSON document is invalid, the\npath is invalid or if the path contains a * or ** wildcard.\n \nLength will be determined as follow:\nA scalar\'s length is always 1.\nIf an array, the number of elements in the array.\nIf an object, the number of members in the object.\n \nThe length of nested arrays or objects are not counted.\n \nExamples\n-------- \n\n \n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_length/','','https://mariadb.com/kb/en/json_length/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (708,41,'JSON_LOOSE','This function was added in MariaDB 10.2.4.\n \nSyntax\n------ \nJSON_LOOSE(json_doc)\n \nDescription\n----------- \nAdds spaces to a JSON document to make it look more\nreadable.\n \nExample\n \nSET @j = \'{ \"A\":1,\"B\":[2,3]}\';\n \nSELECT JSON_LOOSE(@j), @j;\n+-----------------------+--------------------+\n| JSON_LOOSE(@j) | @j |\n+-----------------------+--------------------+\n| {\"A\": 1, \"B\": [2, 3]} | { \"A\":1,\"B\":[2,3]} |\n+-----------------------+--------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_loose/','','https://mariadb.com/kb/en/json_loose/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (709,41,'JSON_MERGE','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_MERGE(json_doc, json_doc[, json_doc] ...)\n \nDescription\n----------- \nMerges the given JSON documents.\n \nReturns the merged result,or NULL if any argument is NULL.\n \nAn error occurs if any of the arguments are not valid JSON\ndocuments.\n \nJSON_MERGE has been deprecated since MariaDB 10.2.25,\nMariaDB 10.3.16 and MariaDB 10.4.5. JSON_MERGE_PATCH is an\nRFC 7396-compliant replacement, and JSON_MERGE_PRESERVE is a\nsynonym.\n \nExample\n \nSET @json1 = \'[1, 2]\';\n \nSET @json2 = \'[3, 4]\';\n \nSELECT JSON_MERGE(@json1,@json2);\n+---------------------------+\n| JSON_MERGE(@json1,@json2) |\n+---------------------------+\n| [1, 2, 3, 4] |\n+---------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/json_merge/','','https://mariadb.com/kb/en/json_merge/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (710,41,'JSON_MERGE_PATCH','JSON_MERGE_PATCH was introduced in MariaDB 10.2.25, MariaDB\n10.3.16 and MariaDB 10.4.5.\n \nSyntax\n------ \nJSON_MERGE_PATCH(json_doc, json_doc[, json_doc] ...)\n \nDescription\n----------- \nMerges the given JSON documents, returning the merged\nresult, or NULL if any argument is NULL.\n \nJSON_MERGE_PATCH is an RFC 7396-compliant replacement for\nJSON_MERGE, which has been deprecated.\n \nExample\n \nSET @json1 = \'[1, 2]\';\n \nSET @json2 = \'[2, 3]\';\n \nSELECT\nJSON_MERGE_PATCH(@json1,@json2),JSON_MERGE_PRESERVE(@json1,@json2);\n+---------------------------------+------------------------------------+\n| JSON_MERGE_PATCH(@json1,@json2) |\nJSON_MERGE_PRESERVE(@json1,@json2) |\n+---------------------------------+------------------------------------+\n| [2, 3] | [1, 2, 2, 3] |\n+---------------------------------+------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_merge_patch/','','https://mariadb.com/kb/en/json_merge_patch/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (711,41,'JSON_MERGE_PRESERVE','JSON_MERGE_PRESERVE was introduced in MariaDB 10.2.25,\nMariaDB 10.3.16 and MariaDB 10.4.5.\n \nSyntax\n------ \nJSON_MERGE_PRESERVE(json_doc, json_doc[, json_doc] ...)\n \nDescription\n----------- \nMerges the given JSON documents, returning the merged\nresult, or NULL if any argument is NULL.\n \nJSON_MERGE_PRESERVE was introduced in MariaDB 10.2.25,\nMariaDB 10.3.16 and MariaDB 10.4.5 as a synonym for\nJSON_MERGE, which has been deprecated.\n \nExample\n \nSET @json1 = \'[1, 2]\';\n \nSET @json2 = \'[2, 3]\';\n \nSELECT\nJSON_MERGE_PATCH(@json1,@json2),JSON_MERGE_PRESERVE(@json1,@json2);\n+---------------------------------+------------------------------------+\n| JSON_MERGE_PATCH(@json1,@json2) |\nJSON_MERGE_PRESERVE(@json1,@json2) |\n+---------------------------------+------------------------------------+\n| [2, 3] | [1, 2, 2, 3] |\n+---------------------------------+------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/json_merge_preserve/','','https://mariadb.com/kb/en/json_merge_preserve/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (712,41,'JSON_OBJECT','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_OBJECT([key, value[, key, value] ...])\n \nDescription\n----------- \nReturns a JSON object containing the given key/value pairs.\nThe key/value list can be empty.\n \nAn error will occur if there are an odd number of arguments,\nor any key name is NULL.\n \nExample\n \nSELECT JSON_OBJECT(\"id\", 1, \"name\", \"Monty\");\n+---------------------------------------+\n| JSON_OBJECT(\"id\", 1, \"name\", \"Monty\") |\n+---------------------------------------+\n| {\"id\": 1, \"name\": \"Monty\"} |\n+---------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_object/','','https://mariadb.com/kb/en/json_object/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (713,41,'JSON_QUERY','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_QUERY(json_doc, path)\n \nDescription\n----------- \nGiven a JSON document, returns an object or array specified\nby the path. Returns NULL if not given a valid JSON\ndocument, or if there is no match.\n \nExamples\n-------- \nselect json_query(\'{\"key1\":{\"a\":1, \"b\":[1,2]}}\',\n\'$.key1\');\n+-----------------------------------------------------+\n| json_query(\'{\"key1\":{\"a\":1, \"b\":[1,2]}}\',\n\'$.key1\') |\n+-----------------------------------------------------+\n| {\"a\":1, \"b\":[1,2]} |\n+-----------------------------------------------------+\n \nselect json_query(\'{\"key1\":123, \"key1\": [1,2,3]}\',\n\'$.key1\');\n+-------------------------------------------------------+\n| json_query(\'{\"key1\":123, \"key1\": [1,2,3]}\',\n\'$.key1\') |\n+-------------------------------------------------------+\n| [1,2,3] |\n+-------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_query/','','https://mariadb.com/kb/en/json_query/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (714,41,'JSON_QUOTE','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_QUOTE(json_value)\n \nDescription\n----------- \nQuotes a string as a JSON value, usually for producing valid\nJSON string literals for inclusion in JSON documents. Wraps\nthe string with double quote characters and escapes interior\nquotes and other special characters, returning a utf8mb4\nstring. \n \nReturns NULL if the argument is NULL.\n \nExamples\n-------- \nSELECT JSON_QUOTE(\'A\'), JSON_QUOTE(\"B\"),\nJSON_QUOTE(\'\"C\"\');\n+-----------------+-----------------+-------------------+\n| JSON_QUOTE(\'A\') | JSON_QUOTE(\"B\") |\nJSON_QUOTE(\'\"C\"\') |\n+-----------------+-----------------+-------------------+\n| \"A\" | \"B\" | \"\\\"C\\\"\" |\n+-----------------+-----------------+-------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_quote/','','https://mariadb.com/kb/en/json_quote/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (715,41,'JSON_REMOVE','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_REMOVE(json_doc, path[, path] ...)\n \nDescription\n----------- \nRemoves data from a JSON document returning the result, or\nNULL if any of the arguments are null. If the element does\nnot exist in the document, no changes are made.\n \nAn error will occur if JSON document is invalid, the path is\ninvalid or if the path contains a * or ** wildcard.\n \nPath arguments are evaluated from left to right, with the\nresult from the earlier evaluation being used as the value\nfor the next.\n \nExamples\n-------- \nSELECT JSON_REMOVE(\'{\"A\": 1, \"B\": 2, \"C\": {\"D\":\n3}}\', \'$.C\');\n+-------------------------------------------------------+\n| JSON_REMOVE(\'{\"A\": 1, \"B\": 2, \"C\": {\"D\": 3}}\',\n\'$.C\') |\n+-------------------------------------------------------+\n| {\"A\": 1, \"B\": 2} |\n+-------------------------------------------------------+\n \nSELECT JSON_REMOVE(\'[\"A\", \"B\", [\"C\", \"D\"],\n\"E\"]\', \'$[1]\');\n+----------------------------------------------------+\n| JSON_REMOVE(\'[\"A\", \"B\", [\"C\", \"D\"], \"E\"]\',\n\'$[1]\') |\n+----------------------------------------------------+\n| [\"A\", [\"C\", \"D\"], \"E\"] |\n+----------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_remove/','','https://mariadb.com/kb/en/json_remove/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (716,41,'JSON_REPLACE','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_REPLACE(json_doc, path, val[, path, val] ...)\n \nDescription\n----------- \nReplaces existing values in a JSON document, returning the\nresult, or NULL if any of the arguments are NULL. \n \nAn error will occur if the JSON document is invalid, the\npath is invalid or if the path contains a * or ** wildcard.\n \nPaths and values are evaluated from left to right, with the\nresult from the earlier evaluation being used as the value\nfor the next.\n \nJSON_REPLACE can only update data, while JSON_INSERT can\nonly insert. JSON_SET can update or insert data. \n \nExamples\n-------- \nSELECT JSON_REPLACE(\'{ \"A\": 1, \"B\": [2, 3]}\',\n\'$.B[1]\', 4);\n+-----------------------------------------------------+\n| JSON_REPLACE(\'{ \"A\": 1, \"B\": [2, 3]}\', \'$.B[1]\',\n4) |\n+-----------------------------------------------------+\n| { \"A\": 1, \"B\": [2, 4]} |\n+-----------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_replace/','','https://mariadb.com/kb/en/json_replace/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (717,41,'JSON_SEARCH','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_SEARCH(json_doc, return_arg, search_str[, escape_char[,\npath] ...])\n \nDescription\n----------- \nReturns the path to the given string within a JSON document,\nor NULL if any of json_doc, search_str or a path argument is\nNULL; if the search string is not found, or if no path\nexists within the document. \n \nA warning will occur if the JSON document is not valid, any\nof the path arguments are not valid, if return_arg is\nneither one nor all, or if the escape character is not a\nconstant. NULL will be returned.\n \nreturn_arg can be one of two values:\n\'one: Terminates after finding the first match, so will\nreturn one path string. If there is more than one match, it\nis undefined which is considered first.\nall: Returns all matching path strings, without duplicates.\nMultiple strings are autowrapped as an array. The order is\nundefined.\n \nExamples\n-------- \nSET @json = \'[\"A\", [{\"B\": \"1\"}], {\"C\":\"AB\"},\n{\"D\":\"BC\"}]\';\n \nSELECT JSON_SEARCH(@json, \'one\', \'AB\');\n+---------------------------------+\n| JSON_SEARCH(@json, \'one\', \'AB\') |\n+---------------------------------+\n| \"$[2].C\" |\n+---------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_search/','','https://mariadb.com/kb/en/json_search/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (718,41,'JSON_SET','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_SET(json_doc, path, val[, path, val] ...)\n \nDescription\n----------- \nUpdates or inserts data into a JSON document, returning the\nresult, or NULL if any of the arguments are NULL or the\noptional path fails to find an object.\n \nAn error will occur if the JSON document is invalid, the\npath is invalid or if the path contains a * or wildcard.\n \nJSON_SET can update or insert data, while JSON_REPLACE can\nonly update, and JSON_INSERT only insert. \n \nExamples\n-------- \n\n \n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_set/','','https://mariadb.com/kb/en/json_set/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (719,41,'JSON_TYPE','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_TYPE(json_val)\n \nDescription\n----------- \nReturns the type of a JSON value, or NULL if the argument is\nnull.\n \nAn error will occur if the argument is an invalid JSON\nvalue.\n \nThe following is a complete list of the possible return\ntypes:\n \nReturn type | Value | \n \nARRAY | JSON array | \n \nBIT | MariaDB BIT scalar | \n \nBLOB | MariaDB binary types (BINARY, VARBINARY or BLOB) | \n \nBOOLEAN | JSON true/false literals | \n \nDATE | MariaDB DATE scalar | \n \nDATETIME | MariaDB DATETIME or TIMESTAMP scalar | \n \nDECIMAL | MariaDB DECIMAL or NUMERIC scalar | \n \nDOUBLE | MariaDB DOUBLE FLOAT scalar | \n \nINTEGER | MariaDB integer types (TINYINT, SMALLINT,\nMEDIUMINT, INT or BIGINT) | \n \nNULL | JSON null literal or NULL argument | \n \nOBJECT | JSON object | \n \nOPAQUE | Any valid JSON value that is not one of the other\ntypes. | \n \nSTRING | MariaDB character types (CHAR, VARCHAR, TEXT, ENUM\nor SET) | \n \nTIME | MariaDB TIME scalar | \n \nExamples\n-------- \nSELECT JSON_TYPE(\'{\"A\": 1, \"B\": 2, \"C\": 3}\');\n+---------------------------------------+\n| JSON_TYPE(\'{\"A\": 1, \"B\": 2, \"C\": 3}\') |\n+---------------------------------------+\n| OBJECT |\n+---------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_type/','','https://mariadb.com/kb/en/json_type/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (720,41,'JSON_UNQUOTE','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_UNQUOTE(val)\n \nDescription\n----------- \nUnquotes a JSON value, returning a string, or NULL if the\nargument is null. \n \nAn error will occur if the given value begins and ends with\ndouble quotes and is an invalid JSON string literal.\n \nCertain character sequences have special meanings within a\nstring. Usually, a backspace is ignored, but the escape\nsequences in the table below are recognised by MariaDB,\nunless the SQL Mode is set to NO_BACKSLASH_ESCAPES SQL.\n \nEscape sequence | Character | \n \n\\\" | Double quote (\") | \n \n\\b | Backspace | \n \n\\f | Formfeed | \n \n\\n | Newline (linefeed) | \n \n\\r | Carriage return | \n \n\\t | Tab | \n \n\\\\ | Backslash (\\) | \n \n\\uXXXX | UTF-8 bytes for Unicode value XXXX | \n \nExamples\n-------- \nSELECT JSON_UNQUOTE(\'\"Monty\"\');\n+-------------------------+\n| JSON_UNQUOTE(\'\"Monty\"\') |\n+-------------------------+\n| Monty |\n+-------------------------+\n \nWith the default SQL Mode:\n \nSELECT JSON_UNQUOTE(\'Si\\bng\\ting\');\n+-----------------------------+\n| JSON_UNQUOTE(\'Si\\bng\\ting\') |\n+-----------------------------+\n| Sng ing |\n+-----------------------------+\n \nSetting NO_BACKSLASH_ESCAPES:\n \nSET @@sql_mode = \'NO_BACKSLASH_ESCAPES\';\n \nSELECT JSON_UNQUOTE(\'Si\\bng\\ting\');\n+-----------------------------+\n| JSON_UNQUOTE(\'Si\\bng\\ting\') |\n+-----------------------------+\n| Si\\bng\\ting |\n+-----------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_unquote/','','https://mariadb.com/kb/en/json_unquote/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (721,41,'JSON_VALID','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_VALID(value)\n \nDescription\n----------- \nIndicates whether the given value is a valid JSON document\nor not. Returns 1 if valid, 0 if not, and NULL if the\nargument is NULL.\n \nFrom MariaDB 10.4.3, the JSON_VALID function is\nautomatically used as a CHECK constraint for the JSON data\ntype alias in order to ensure that a valid json document is\ninserted. \n \nExamples\n-------- \nSELECT JSON_VALID(\'{\"id\": 1, \"name\": \"Monty\"}\');\n+------------------------------------------+\n| JSON_VALID(\'{\"id\": 1, \"name\": \"Monty\"}\') |\n+------------------------------------------+\n| 1 |\n+------------------------------------------+\n \nSELECT JSON_VALID(\'{\"id\": 1, \"name\": \"Monty\",\n\"oddfield\"}\');\n+------------------------------------------------------+\n| JSON_VALID(\'{\"id\": 1, \"name\": \"Monty\",\n\"oddfield\"}\') |\n+------------------------------------------------------+\n| 0 |\n+------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_valid/','','https://mariadb.com/kb/en/json_valid/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (722,41,'JSON_VALUE','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_VALUE(json_doc, path)\n \nDescription\n----------- \nGiven a JSON document, returns the scalar specified by the\npath. Returns NULL if not given a valid JSON document, or if\nthere is no match.\n \nExamples\n-------- \nselect json_value(\'{\"key1\":123}\', \'$.key1\');\n+--------------------------------------+\n| json_value(\'{\"key1\":123}\', \'$.key1\') |\n+--------------------------------------+\n| 123 |\n+--------------------------------------+\n \nselect json_value(\'{\"key1\": [1,2,3], \"key1\":123}\',\n\'$.key1\');\n+-------------------------------------------------------+\n| json_value(\'{\"key1\": [1,2,3], \"key1\":123}\',\n\'$.key1\') |\n+-------------------------------------------------------+\n| 123 |\n+-------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_value/','','https://mariadb.com/kb/en/json_value/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (723,42,'Window Functions Overview','Window functions were introduced in MariaDB 10.2.\n \nIntroduction\n \nWindow functions allow calculations to be performed across a\nset of rows related to the current row.\n \nSyntax\n------ \nfunction (expression) OVER (\n [ PARTITION BY expression_list ]\n [ ORDER BY order_list [ frame_clause ] ] ) \n \nfunction:\n A valid window function\n \nexpression_list:\n expression | column_name [, expr_list ]\n \norder_list:\n expression | column_name [ ASC | DESC ] \n [, ... ]\n \nframe_clause:\n {ROWS | RANGE} {frame_border | BETWEEN frame_border AND\nframe_border}\n \nframe_border:\n | UNBOUNDED PRECEDING\n | UNBOUNDED FOLLOWING\n | CURRENT ROW\n | expr PRECEDING\n | expr FOLLOWING\n \nDescription\n----------- \nIn some ways, window functions are similar to aggregate\nfunctions in that they perform calculations across a set of\nrows. However, unlike aggregate functions, the output is not\ngrouped into a single row. \n \nNon-aggregate window functions include \nCUME_DIST\nDENSE_RANK\nFIRST_VALUE\nLAG\nLAST_VALUE\nLEAD\nMEDIAN\nNTH_VALUE\nNTILE\nPERCENT_RANK\nPERCENTILE_CONT\nPERCENTILE_DISC\nRANK, ROW_NUMBER\n \nAggregate functions that can also be used as window\nfunctions include \nAVG\nBIT_AND\nBIT_OR\nBIT_XOR\nCOUNT\nMAX\nMIN\nSTD\nSTDDEV\nSTDDEV_POP\nSTDDEV_SAMP\nSUM\nVAR_POP\nVAR_SAMP\nVARIANCE\n \nWindow function queries are characterised by the OVER\nkeyword, following which the set of rows used for the\ncalculation is specified. By default, the set of rows used\nfor the calculation (the \"window) is the entire dataset,\nwhich can be ordered with the ORDER BY clause. The PARTITION\nBY clause is used to reduce the window to a particular group\nwithin the dataset.\n \nFor example, given the following data:\n \nCREATE TABLE student (name CHAR(10), test CHAR(10), score\nTINYINT); \n \nINSERT INTO student VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87), (\'Tatiana\', \'Tuning\', 83);\n \nthe following two queries return the average partitioned by\ntest and by name respectively:\n \nSELECT name, test, score, AVG(score) OVER (PARTITION BY\ntest) \n AS average_by_test FROM student;\n \n+---------+--------+-------+-----------------+\n| name | test | score | average_by_test |\n+---------+--------+-------+-----------------+\n| Chun | SQL | 75 | 65.2500 |\n| Chun | Tuning | 73 | 68.7500 |\n| Esben | SQL | 43 | 65.2500 |\n| Esben | Tuning | 31 | 68.7500 |\n| Kaolin | SQL | 56 | 65.2500 |\n| Kaolin | Tuning | 88 | 68.7500 |\n| Tatiana | SQL | 87 | 65.2500 |\n| Tatiana | Tuning | 83 | 68.7500 |\n+---------+--------+-------+-----------------+\n \nSELECT name, test, score, AVG(score) OVER (PARTITION BY\nname) \n AS average_by_name FROM student;\n \n+---------+--------+-------+-----------------+\n| name | test | score | average_by_name |\n+---------+--------+-------+-----------------+\n| Chun | SQL | 75 | 74.0000 |\n| Chun | Tuning | 73 | 74.0000 |\n| Esben | SQL | 43 | 37.0000 |\n| Esben | Tuning | 31 | 37.0000 |\n| Kaolin | SQL | 56 | 72.0000 |\n| Kaolin | Tuning | 88 | 72.0000 |\n| Tatiana | SQL | 87 | 85.0000 |\n| Tatiana | Tuning | 83 | 85.0000 |\n+---------+--------+-------+-----------------+\n \nIt is also possible to specify which rows to include for the\nwindow function (for example, the current row and all\npreceding rows). See Window Frames for more details.\n \nScope\n \nWindow functions were introduced in SQL:2003, and their\ndefinition was expanded in subsequent versions of the\nstandard. The last expansion was in the latest version of\nthe standard, SQL:2011. \n \nMost database products support a subset of the standard,\nthey implement some functions defined as late as in\nSQL:2011, and at the same time leave some parts of SQL:2008\nunimplemented.\n \nMariaDB:\nSupports ROWS and RANGE-type frames\nAll kinds of frame bounds are supported, including RANGE\nPRECEDING|FOLLOWING n frame bounds (unlike PostgreSQL or MS\nSQL Server)\nDoes not yet support DATE[TIME] datatype and arithmetic for\nRANGE-type frames (MDEV-9727)\n \nDoes not support GROUPS-type frames (it seems that no\npopular database supports it, either)\n \nDoes not support frame exclusion (no other database seems to\nsupport it, either) (MDEV-9724)\nDoes not support explicit NULLS FIRST or NULLS LAST.\nDoes not support nested navigation in window functions (this\nis VALUE_OF(expr AT row_marker [, default_value) syntax)\n \nThe following window functions are supported:\n\"Streamable\" window functions: ROW_NUMBER, RANK,\nDENSE_RANK, \nWindow functions that can be streamed once the number of\nrows in partition is known: PERCENT_RANK, CUME_DIST, NTILE\n \nAggregate functions that are currently supported as window\nfunctions are: COUNT, SUM, AVG, BIT_OR, BIT_AND, BIT_XOR.\nAggregate functions with the DISTINCT specifier (e.g. COUNT(\nDISTINCT x)) are not supported as window functions.\n \nLinks\n \nMDEV-6115 is the main jira task for window functions\ndevelopment. Other tasks are are attached as sub-tasks\nbb-10.2-mdev9543 is the feature tree for window functions.\nDevelopment is ongoing, and this tree has the newest\nchanges.\nTestcases are in mysql-test/t/win*.test\n \nExamples\n-------- \nGiven the following sample data:\n \nCREATE TABLE users (\n email VARCHAR(30), \n first_name VARCHAR(30), \n last_name VARCHAR(30), \n account_type VARCHAR(30)\n);\n \nINSERT INTO users VALUES \n (\'admin@boss.org\', \'Admin\', \'Boss\', \'admin\'), \n (\'bob.carlsen@foo.bar\', \'Bob\', \'Carlsen\',\n\'regular\'),\n (\'eddie.stevens@data.org\', \'Eddie\', \'Stevens\',\n\'regular\'),\n (\'john.smith@xyz.org\', \'John\', \'Smith\', \'regular\'),\n\n (\'root@boss.org\', \'Root\', \'Chief\', \'admin\')\n \nFirst, let\'s order the records by email alphabetically,\ngiving each an ascending rnum value starting with 1. This\nwill make use of the ROW_NUMBER window function:\n \nSELECT row_number() OVER (ORDER BY email) AS rnum,\n email, first_name, last_name, account_type\nFROM users ORDER BY email;\n \n+------+------------------------+------------+-----------+--------------+\n| rnum | email | first_name | last_name | account_type |\n+------+------------------------+------------+-----------+--------------+\n| 1 | admin@boss.org | Admin | Boss | admin |\n| 2 | bob.carlsen@foo.bar | Bob | Carlsen | regular |\n| 3 | eddie.stevens@data.org | Eddie | Stevens | regular |\n| 4 | john.smith@xyz.org | John | Smith | regular |\n| 5 | root@boss.org | Root | Chief | admin |\n+------+------------------------+------------+-----------+--------------\n \nWe can generate separate sequences based on account type,\nusing the PARTITION BY clause:\n \nSELECT row_number() OVER (PARTITION BY account_type ORDER BY\nemail) AS rnum, \n email, first_name, last_name, account_type \nFROM users ORDER BY account_type,email;\n \n+------+------------------------+------------+-----------+--------------+\n| rnum | email | first_name | last_name | account_type |\n+------+------------------------+------------+-----------+--------------+\n| 1 | admin@boss.org | Admin | Boss | admin |\n| 2 | root@boss.org | Root | Chief | admin |\n| 1 | bob.carlsen@foo.bar | Bob | Carlsen | regular |\n| 2 | eddie.stevens@data.org | Eddie | Stevens | regular |\n| 3 | john.smith@xyz.org | John | Smith | regular |\n+------+------------------------+------------+-----------+--------------+\n \nGiven the following structure and data, we want to find the\ntop 5 salaries from each department. \n \nCREATE TABLE employee_salaries (dept VARCHAR(20), name\nVARCHAR(20), salary INT(11));\n \nINSERT INTO employee_salaries VALUES\n(\'Engineering\', \'Dharma\', 3500),\n(\'Engineering\', \'Bình\', 3000),\n(\'Engineering\', \'Adalynn\', 2800),\n(\'Engineering\', \'Samuel\', 2500),\n(\'Engineering\', \'Cveta\', 2200),\n(\'Engineering\', \'Ebele\', 1800),\n(\'Sales\', \'Carbry\', 500),\n(\'Sales\', \'Clytemnestra\', 400),\n(\'Sales\', \'Juraj\', 300),\n(\'Sales\', \'Kalpana\', 300),\n(\'Sales\', \'Svantepolk\', 250),\n(\'Sales\', \'Angelo\', 200);\n \nWe could do this without using window functions, as follows:\n \nselect dept, name, salary\nfrom employee_salaries as t1\nwhere (select count(t2.salary)\n from employee_salaries as t2\n where t1.name != t2.name and\n t1.dept = t2.dept and\n t2.salary > t1.salary) \n\nURL:\nhttps://mariadb.com/kb/en/library/window-functions-overview/','','https://mariadb.com/kb/en/library/window-functions-overview/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (724,42,'Aggregate Functions as Window Functions','Window functions were first introduced in MariaDB 10.2.0.\n \nIt is possible to use aggregate functions as window\nfunctions. An aggregate function used as a window function\nmust have the OVER clause. For example, here\'s COUNT() used\nas a window function:\n \nselect COUNT(*) over (order by column) from table;\n \nMariaDB currently allows these aggregate functions to be\nused as window functions: \nAVG\nBIT_AND\nBIT_OR\nBIT_XOR\nCOUNT\nMAX\nMIN\nSTD\nSTDDEV\nSTDDEV_POP\nSTDDEV_SAMP\nSUM\nVAR_POP\nVAR_SAMP\nVARIANCE\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/aggregate-functions-as-window-functions/','','https://mariadb.com/kb/en/library/aggregate-functions-as-window-functions/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (725,42,'Window Frames','Window functions were first introduced in MariaDB 10.2.0.\n \nSyntax\n------ \nframe_clause:\n {ROWS | RANGE} {frame_border | BETWEEN frame_border AND\nframe_border}\n \nframe_border:\n | UNBOUNDED PRECEDING\n | UNBOUNDED FOLLOWING\n | CURRENT ROW\n | expr PRECEDING\n | expr FOLLOWING\n \nDescription\n----------- \nA basic overview of window functions is described in Window\nFunctions Overview. Window frames expand this functionality\nby allowing the function to include a specified a number of\nrows around the current row.\n \nThese include:\nAll rows before the current row (UNBOUNDED PRECEDING), for\nexample RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW\nAll rows after the current row (UNBOUNDED FOLLOWING), for\nexample RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING\nA set number of rows before the current row (expr PRECEDING)\nfor example RANGE BETWEEN 6 PRECEDING AND CURRENT ROW\nA set number of rows after the current row (expr PRECEDING\nAND expr FOLLOWING) for example RANGE BETWEEN CURRENT ROW\nAND 2 FOLLOWING\nA specified number of rows both before and after the current\nrow, for example RANGE BETWEEN 6 PRECEDING AND 3 FOLLOWING \n \nThe following functions operate on window frames:\nAVG\nBIT_AND\nBIT_OR\nBIT_XOR\nCOUNT\nLEAD\nMAX\nMIN\nNTILE\nSTD\nSTDDEV\nSTDDEV_POP\nSTDDEV_SAMP\nSUM\nVAR_POP\nVAR_SAMP\nVARIANCE\n \nWindow frames are determined by the frame_clause in the\nwindow function request. \n \nTake the following example:\n \nCREATE TABLE `student_test` (\n name char(10),\n test char(10),\n score tinyint(4)\n);\n \nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87);\n \nSELECT name, test, score, SUM(score) \n OVER () AS total_score \n FROM student_test;\n \n+---------+--------+-------+-------------+\n| name | test | score | total_score |\n+---------+--------+-------+-------------+\n| Chun | SQL | 75 | 453 |\n| Chun | Tuning | 73 | 453 |\n| Esben | SQL | 43 | 453 |\n| Esben | Tuning | 31 | 453 |\n| Kaolin | SQL | 56 | 453 |\n| Kaolin | Tuning | 88 | 453 |\n| Tatiana | SQL | 87 | 453 |\n+---------+--------+-------+-------------+\n \nBy not specifying an OVER condition, the SUM function is run\nover the entire dataset. However, if we specify an ORDER BY\ncondition based on score (and order the entire result in the\nsame way for clarity), the following result is returned:\n \nSELECT name, test, score, SUM(score) \n OVER (ORDER BY score) AS total_score \n FROM student_test ORDER BY score;\n \n+---------+--------+-------+-------------+\n| name | test | score | total_score |\n+---------+--------+-------+-------------+\n| Esben | Tuning | 31 | 31 |\n| Esben | SQL | 43 | 74 |\n| Kaolin | SQL | 56 | 130 |\n| Chun | Tuning | 73 | 203 |\n| Chun | SQL | 75 | 278 |\n| Tatiana | SQL | 87 | 365 |\n| Kaolin | Tuning | 88 | 453 |\n+---------+--------+-------+-------------+\n \nThe total_score column represents a running total of the\ncurrent row, and all previous rows. The window frame in this\nexample expands as the function proceeds.\n \nThe above query makes use of the default to define the\nwindow frame. It could be written explicitly as follows:\n \nSELECT name, test, score, SUM(score) \n OVER (ORDER BY score RANGE BETWEEN UNBOUNDED PRECEDING AND\nCURRENT ROW) AS total_score \n FROM student_test ORDER BY score;\n \n+---------+--------+-------+-------------+\n| name | test | score | total_score |\n+---------+--------+-------+-------------+\n| Esben | Tuning | 31 | 31 |\n| Esben | SQL | 43 | 74 |\n| Kaolin | SQL | 56 | 130 |\n| Chun | Tuning | 73 | 203 |\n| Chun | SQL | 75 | 278 |\n| Tatiana | SQL | 87 | 365 |\n| Kaolin | Tuning | 88 | 453 |\n+---------+--------+-------+-------------+\n \nLet\'s look at some alternatives:\n \nFirstly, applying the window function to the current row and\nall following rows can be done with the use of UNBOUNDED\nFOLLOWING:\n \nSELECT name, test, score, SUM(score) \n OVER (ORDER BY score RANGE BETWEEN CURRENT ROW AND\nUNBOUNDED FOLLOWING) AS total_score \n FROM student_test ORDER BY score;\n \n+---------+--------+-------+-------------+\n| name | test | score | total_score |\n+---------+--------+-------+-------------+\n| Esben | Tuning | 31 | 453 |\n| Esben | SQL | 43 | 422 |\n| Kaolin | SQL | 56 | 379 |\n| Chun | Tuning | 73 | 323 |\n| Chun | SQL | 75 | 250 |\n| Tatiana | SQL | 87 | 175 |\n| Kaolin | Tuning | 88 | 88 |\n+---------+--------+-------+-------------+\n \nIt\'s possible to specify a number of rows, rather than the\nentire unbounded following or preceding set. The following\nexample takes the current row, as well as the previous row:\n \nSELECT name, test, score, SUM(score) \n OVER (ORDER BY score ROWS BETWEEN 1 PRECEDING AND CURRENT\nROW) AS total_score \n FROM student_test ORDER BY score;\n \n+---------+--------+-------+-------------+\n| name | test | score | total_score |\n+---------+--------+-------+-------------+\n| Esben | Tuning | 31 | 31 |\n| Esben | SQL | 43 | 74 |\n| Kaolin | SQL | 56 | 99 |\n| Chun | Tuning | 73 | 129 |\n| Chun | SQL | 75 | 148 |\n| Tatiana | SQL | 87 | 162 |\n| Kaolin | Tuning | 88 | 175 |\n+---------+--------+-------+-------------+\n \nThe current row and the following row:\n \nSELECT name, test, score, SUM(score) \n OVER (ORDER BY score ROWS BETWEEN 1 PRECEDING AND 1\nFOLLOWING) AS total_score \n FROM student_test ORDER BY score;\n \n+---------+--------+-------+-------------+\n| name | test | score | total_score |\n+---------+--------+-------+-------------+\n| Esben | Tuning | 31 | 74 |\n| Esben | SQL | 43 | 130 |\n| Kaolin | SQL | 56 | 172 |\n| Chun | Tuning | 73 | 204 |\n| Chun | SQL | 75 | 235 |\n| Tatiana | SQL | 87 | 250 |\n| Kaolin | Tuning | 88 | 175 |\n+---------+--------+-------+-------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/window-frames/','','https://mariadb.com/kb/en/library/window-frames/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (726,42,'CUME_DIST','The CUME_DIST() function was first introduced with window\nfunctions in MariaDB 10.2.0.\n \nSyntax\n------ \nCUME_DIST() OVER ( \n [ PARTITION BY partition_expression ] \n [ ORDER BY order_list ]\n)\n \nDescription\n----------- \nCUME_DIST() is a window function that returns the cumulative\ndistribution of a given row. The following formula is used\nto calculate the value:\n \n(number of rows \n\nURL: https://mariadb.com/kb/en/cume_dist/','','https://mariadb.com/kb/en/cume_dist/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (727,42,'DENSE_RANK','The DENSE_RANK() function was first introduced with window\nfunctions in MariaDB 10.2.0.\n \nSyntax\n------ \nDENSE_RANK() OVER (\n [ PARTITION BY partition_expression ]\n [ ORDER BY order_list ]\n) \n \nDescription\n----------- \nDENSE_RANK() is a window function that displays the number\nof a given row, starting at one and following the ORDER BY\nsequence of the window function, with identical values\nreceiving the same result. Unlike the RANK() function, there\nare no skipped values if the preceding results are\nidentical. It is also similar to the ROW_NUMBER() function\nexcept that in that function, identical values will receive\na different row number for each result.\n \nExamples\n-------- \nThe distinction between DENSE_RANK(), RANK() and\nROW_NUMBER():\n \nCREATE TABLE student(course VARCHAR(10), mark int, name\nvarchar(10));\n \nINSERT INTO student VALUES \n (\'Maths\', 60, \'Thulile\'),\n (\'Maths\', 60, \'Pritha\'),\n (\'Maths\', 70, \'Voitto\'),\n (\'Maths\', 55, \'Chun\'),\n (\'Biology\', 60, \'Bilal\'),\n (\'Biology\', 70, \'Roger\');\n \nSELECT \n RANK() OVER (PARTITION BY course ORDER BY mark DESC) AS\nrank, \n DENSE_RANK() OVER (PARTITION BY course ORDER BY mark DESC)\nAS dense_rank, \n ROW_NUMBER() OVER (PARTITION BY course ORDER BY mark DESC)\nAS row_num, \n course, mark, name \nFROM student ORDER BY course, mark DESC;\n \n+------+------------+---------+---------+------+---------+\n| rank | dense_rank | row_num | course | mark | name |\n+------+------------+---------+---------+------+---------+\n| 1 | 1 | 1 | Biology | 70 | Roger |\n| 2 | 2 | 2 | Biology | 60 | Bilal |\n| 1 | 1 | 1 | Maths | 70 | Voitto |\n| 2 | 2 | 2 | Maths | 60 | Thulile |\n| 2 | 2 | 3 | Maths | 60 | Pritha |\n| 4 | 3 | 4 | Maths | 55 | Chun |\n+------+------------+---------+---------+------+---------+\n \n\n\nURL: https://mariadb.com/kb/en/dense_rank/','','https://mariadb.com/kb/en/dense_rank/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (728,42,'FIRST_VALUE','The FIRST_VALUE() function was first introduced with other\nwindow functions in MariaDB 10.2.\n \nSyntax\n------ \nFIRST_VALUE(expr) OVER (\n [ PARTITION BY partition_expression ]\n [ ORDER BY order_list ]\n) \n \nDescription\n----------- \nFIRST_VALUE returns the first result from an ordered set, or\nNULL if no such result exists.\n \nExamples\n-------- \nCREATE TABLE t1 (\n pk int primary key,\n a int,\n b int,\n c char(10),\n d decimal(10, 3),\n e real\n);\n \nINSERT INTO t1 VALUES\n( 1, 0, 1, \'one\', 0.1, 0.001),\n( 2, 0, 2, \'two\', 0.2, 0.002),\n( 3, 0, 3, \'three\', 0.3, 0.003),\n( 4, 1, 2, \'three\', 0.4, 0.004),\n( 5, 1, 1, \'two\', 0.5, 0.005),\n( 6, 1, 1, \'one\', 0.6, 0.006),\n( 7, 2, NULL, \'n_one\', 0.5, 0.007),\n( 8, 2, 1, \'n_two\', NULL, 0.008),\n( 9, 2, 2, NULL, 0.7, 0.009),\n(10, 2, 0, \'n_four\', 0.8, 0.010),\n(11, 2, 10, NULL, 0.9, NULL);\n \nSELECT pk, FIRST_VALUE(pk) OVER (ORDER BY pk) AS first_asc,\n LAST_VALUE(pk) OVER (ORDER BY pk) AS last_asc,\n FIRST_VALUE(pk) OVER (ORDER BY pk DESC) AS first_desc,\n LAST_VALUE(pk) OVER (ORDER BY pk DESC) AS last_desc\nFROM t1\nORDER BY pk DESC;\n \n+----+-----------+----------+------------+-----------+\n| pk | first_asc | last_asc | first_desc | last_desc |\n+----+-----------+----------+------------+-----------+\n| 11 | 1 | 11 | 11 | 11 |\n| 10 | 1 | 10 | 11 | 10 |\n| 9 | 1 | 9 | 11 | 9 |\n| 8 | 1 | 8 | 11 | 8 |\n| 7 | 1 | 7 | 11 | 7 |\n| 6 | 1 | 6 | 11 | 6 |\n| 5 | 1 | 5 | 11 | 5 |\n| 4 | 1 | 4 | 11 | 4 |\n| 3 | 1 | 3 | 11 | 3 |\n| 2 | 1 | 2 | 11 | 2 |\n| 1 | 1 | 1 | 11 | 1 |\n+----+-----------+----------+------------+-----------+\n \nCREATE OR REPLACE TABLE t1 (i int);\nINSERT INTO t1 VALUES\n(1),(2),(3),(4),(5),(6),(7),(8),(9),(10);\n \nSELECT i,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW\nand 1 FOLLOWING) AS f_1f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW and\n1 FOLLOWING) AS l_1f,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 PRECEDING\nAND 1 FOLLOWING) AS f_1p1f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 PRECEDING AND\n1 FOLLOWING) AS f_1p1f,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 2 PRECEDING\nAND 1 PRECEDING) AS f_2p1p,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 2 PRECEDING AND\n1 PRECEDING) AS f_2p1p,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 FOLLOWING\nAND 2 FOLLOWING) AS f_1f2f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 FOLLOWING AND\n2 FOLLOWING) AS f_1f2f\nFROM t1;\n \n+------+------+------+--------+--------+--------+--------+--------+--------+\n| i | f_1f | l_1f | f_1p1f | f_1p1f | f_2p1p | f_2p1p |\nf_1f2f | f_1f2f |\n+------+------+------+--------+--------+--------+--------+--------+--------+\n| 1 | 1 | 2 | 1 | 2 | NULL | NULL | 2 | 3 |\n| 2 | 2 | 3 | 1 | 3 | 1 | 1 | 3 | 4 |\n| 3 | 3 | 4 | 2 | 4 | 1 | 2 | 4 | 5 |\n| 4 | 4 | 5 | 3 | 5 | 2 | 3 | 5 | 6 |\n| 5 | 5 | 6 | 4 | 6 | 3 | 4 | 6 | 7 |\n| 6 | 6 | 7 | 5 | 7 | 4 | 5 | 7 | 8 |\n| 7 | 7 | 8 | 6 | 8 | 5 | 6 | 8 | 9 |\n| 8 | 8 | 9 | 7 | 9 | 6 | 7 | 9 | 10 |\n| 9 | 9 | 10 | 8 | 10 | 7 | 8 | 10 | 10 |\n| 10 | 10 | 10 | 9 | 10 | 8 | 9 | NULL | NULL |\n+------+------+------+--------+--------+--------+--------+--------+--------+\n \n\n\nURL: https://mariadb.com/kb/en/first_value/','','https://mariadb.com/kb/en/first_value/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (729,42,'LAG','The LAG() function was first introduced with other window\nfunctions in MariaDB 10.2.\n \nSyntax\n------ \nLAG (expr[, offset]) OVER ( \n [ PARTITION BY partition_expression ] \n < ORDER BY order_list >\n)\n \nDescription\n----------- \nThe LAG function accesses data from a previous row according\nto the ORDER BY clause without the need for a self-join. The\nspecific row is determined by the offset (default 1), which\nspecifies the number of rows behind the current row to use.\nAn offset of 0 is the current row.\n \nExamples\n-------- \nCREATE TABLE t1 (pk int primary key, a int, b int, c\nchar(10), d decimal(10, 3), e real);\n \nINSERT INTO t1 VALUES\n ( 1, 0, 1, \'one\', 0.1, 0.001),\n ( 2, 0, 2, \'two\', 0.2, 0.002),\n ( 3, 0, 3, \'three\', 0.3, 0.003),\n ( 4, 1, 2, \'three\', 0.4, 0.004),\n ( 5, 1, 1, \'two\', 0.5, 0.005),\n ( 6, 1, 1, \'one\', 0.6, 0.006),\n ( 7, 2, NULL, \'n_one\', 0.5, 0.007),\n ( 8, 2, 1, \'n_two\', NULL, 0.008),\n ( 9, 2, 2, NULL, 0.7, 0.009),\n (10, 2, 0, \'n_four\', 0.8, 0.010),\n (11, 2, 10, NULL, 0.9, NULL);\n \nSELECT pk, LAG(pk) OVER (ORDER BY pk) AS l,\n LAG(pk,1) OVER (ORDER BY pk) AS l1,\n LAG(pk,2) OVER (ORDER BY pk) AS l2,\n LAG(pk,0) OVER (ORDER BY pk) AS l0,\n LAG(pk,-1) OVER (ORDER BY pk) AS lm1,\n LAG(pk,-2) OVER (ORDER BY pk) AS lm2 \nFROM t1;\n \n+----+------+------+------+------+------+------+\n| pk | l | l1 | l2 | l0 | lm1 | lm2 |\n+----+------+------+------+------+------+------+\n| 1 | NULL | NULL | NULL | 1 | 2 | 3 |\n| 2 | 1 | 1 | NULL | 2 | 3 | 4 |\n| 3 | 2 | 2 | 1 | 3 | 4 | 5 |\n| 4 | 3 | 3 | 2 | 4 | 5 | 6 |\n| 5 | 4 | 4 | 3 | 5 | 6 | 7 |\n| 6 | 5 | 5 | 4 | 6 | 7 | 8 |\n| 7 | 6 | 6 | 5 | 7 | 8 | 9 |\n| 8 | 7 | 7 | 6 | 8 | 9 | 10 |\n| 9 | 8 | 8 | 7 | 9 | 10 | 11 |\n| 10 | 9 | 9 | 8 | 10 | 11 | NULL |\n| 11 | 10 | 10 | 9 | 11 | NULL | NULL |\n+----+------+------+------+------+------+------+\n \n\n\nURL: https://mariadb.com/kb/en/lag/','','https://mariadb.com/kb/en/lag/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (730,42,'LEAD','The LEAD() function was first introduced with other window\nfunctions in MariaDB 10.2.\n \nSyntax\n------ \nLEAD (expr[, offset]) OVER ( \n [ PARTITION BY partition_expression ] \n [ ORDER BY order_list ]\n)\n \nDescription\n----------- \nThe LEAD function accesses data from a following row in the\nsame result set without the need for a self-join. The\nspecific row is determined by the offset (default 1), which\nspecifies the number of rows ahead the current row to use.\nAn offset of 0 is the current row.\n \nExample\n \nCREATE TABLE t1 (pk int primary key, a int, b int, c\nchar(10), d decimal(10, 3), e real);\n \nINSERT INTO t1 VALUES\n ( 1, 0, 1, \'one\', 0.1, 0.001),\n ( 2, 0, 2, \'two\', 0.2, 0.002),\n ( 3, 0, 3, \'three\', 0.3, 0.003),\n ( 4, 1, 2, \'three\', 0.4, 0.004),\n ( 5, 1, 1, \'two\', 0.5, 0.005),\n ( 6, 1, 1, \'one\', 0.6, 0.006),\n ( 7, 2, NULL, \'n_one\', 0.5, 0.007),\n ( 8, 2, 1, \'n_two\', NULL, 0.008),\n ( 9, 2, 2, NULL, 0.7, 0.009),\n (10, 2, 0, \'n_four\', 0.8, 0.010),\n (11, 2, 10, NULL, 0.9, NULL);\n \nSELECT pk, LEAD(pk) OVER (ORDER BY pk) AS l,\n LEAD(pk,1) OVER (ORDER BY pk) AS l1,\n LEAD(pk,2) OVER (ORDER BY pk) AS l2,\n LEAD(pk,0) OVER (ORDER BY pk) AS l0,\n LEAD(pk,-1) OVER (ORDER BY pk) AS lm1,\n LEAD(pk,-2) OVER (ORDER BY pk) AS lm2 \nFROM t1;\n \n+----+------+------+------+------+------+------+\n| pk | l | l1 | l2 | l0 | lm1 | lm2 |\n+----+------+------+------+------+------+------+\n| 1 | 2 | 2 | 3 | 1 | NULL | NULL |\n| 2 | 3 | 3 | 4 | 2 | 1 | NULL |\n| 3 | 4 | 4 | 5 | 3 | 2 | 1 |\n| 4 | 5 | 5 | 6 | 4 | 3 | 2 |\n| 5 | 6 | 6 | 7 | 5 | 4 | 3 |\n| 6 | 7 | 7 | 8 | 6 | 5 | 4 |\n| 7 | 8 | 8 | 9 | 7 | 6 | 5 |\n| 8 | 9 | 9 | 10 | 8 | 7 | 6 |\n| 9 | 10 | 10 | 11 | 9 | 8 | 7 |\n| 10 | 11 | 11 | NULL | 10 | 9 | 8 |\n| 11 | NULL | NULL | NULL | 11 | 10 | 9 |\n+----+------+------+------+------+------+------+\n \n\n\nURL: https://mariadb.com/kb/en/lead/','','https://mariadb.com/kb/en/lead/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (731,42,'Median Window Function','The MEDIAN() window function was first introduced with in\nMariaDB 10.3.3.\n \nSyntax\n------ \nMEDIAN(median expression) OVER (\n [ PARTITION BY partition_expression ] \n)\n \nDescription\n----------- \nMEDIAN() is a window function that returns the median value\nof a range of values.\n \nIt is a specific case of PERCENTILE_CONT, with an argument\nof 0.5 and the ORDER BY column the one in MEDIAN\'s\nargument. \n \nMEDIAN() OVER ( [ PARTITION BY partition_expression] )\n \nIs equivalent to:\n \nPERCENTILE_CONT(0.5) WITHIN \n GROUP (ORDER BY ) OVER ( [ PARTITION BY\npartition_expression ])\n \nExamples\n-------- \nCREATE TABLE book_rating (name CHAR(30), star_rating\nTINYINT);\n \nINSERT INTO book_rating VALUES (\'Lord of the Ladybirds\',\n5);\nINSERT INTO book_rating VALUES (\'Lord of the Ladybirds\',\n3);\nINSERT INTO book_rating VALUES (\'Lady of the Flies\', 1);\nINSERT INTO book_rating VALUES (\'Lady of the Flies\', 2);\nINSERT INTO book_rating VALUES (\'Lady of the Flies\', 5);\n \nSELECT name, median(star_rating) OVER (PARTITION BY name)\nFROM book_rating;\n \n+-----------------------+----------------------------------------------+\n| name | median(star_rating) OVER (PARTITION BY name) |\n+-----------------------+----------------------------------------------+\n| Lord of the Ladybirds | 4.0000000000 |\n| Lord of the Ladybirds | 4.0000000000 |\n| Lady of the Flies | 2.0000000000 |\n| Lady of the Flies | 2.0000000000 |\n| Lady of the Flies | 2.0000000000 |\n+-----------------------+----------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/median/','','https://mariadb.com/kb/en/median/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (732,42,'NTH_VALUE','The NTH_VALUE() function was first introduced with other\nwindow functions in MariaDB 10.2.\n \nSyntax\n------ \nNTH_VALUE (expr[, num_row]) OVER ( \n [ PARTITION BY partition_expression ] \n [ ORDER BY order_list ]\n)\n \nDescription\n----------- \nThe NTH_VALUE function returns the value evaluated at row\nnumber num_row of the window frame, starting from 1, or NULL\nif the row does not exist.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/nth_value/','','https://mariadb.com/kb/en/nth_value/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (733,42,'NTILE','The NTILE() function was first introduced with window\nfunctions in MariaDB 10.2.0.\n \nSyntax\n------ \nNTILE (expr) OVER ( \n [ PARTITION BY partition_expression ] \n [ ORDER BY order_list ]\n)\n \nDescription\n----------- \nNTILE() is a window function that returns an integer\nindicating which group a given row falls into. The number of\ngroups is specified in the argument (expr), starting at one.\nOrdered rows in the partition are divided into the specified\nnumber of groups with as equal a size as possible. \n \nExamples\n-------- \ncreate table t1 (\n pk int primary key,\n a int,\n b int\n );\n \ninsert into t1 values\n (11 , 0, 10),\n (12 , 0, 10),\n (13 , 1, 10),\n (14 , 1, 10),\n (18 , 2, 10),\n (15 , 2, 20),\n (16 , 2, 20),\n (17 , 2, 20),\n (19 , 4, 20),\n (20 , 4, 20);\n \nselect pk, a, b,\n ntile(1) over (order by pk)\n from t1;\n \n+----+------+------+-----------------------------+\n| pk | a | b | ntile(1) over (order by pk) |\n+----+------+------+-----------------------------+\n| 11 | 0 | 10 | 1 |\n| 12 | 0 | 10 | 1 |\n| 13 | 1 | 10 | 1 |\n| 14 | 1 | 10 | 1 |\n| 15 | 2 | 20 | 1 |\n| 16 | 2 | 20 | 1 |\n| 17 | 2 | 20 | 1 |\n| 18 | 2 | 10 | 1 |\n| 19 | 4 | 20 | 1 |\n| 20 | 4 | 20 | 1 |\n+----+------+------+-----------------------------+\n \nselect pk, a, b,\n ntile(4) over (order by pk)\n from t1;\n \n+----+------+------+-----------------------------+\n| pk | a | b | ntile(4) over (order by pk) |\n+----+------+------+-----------------------------+\n| 11 | 0 | 10 | 1 |\n| 12 | 0 | 10 | 1 |\n| 13 | 1 | 10 | 1 |\n| 14 | 1 | 10 | 2 |\n| 15 | 2 | 20 | 2 |\n| 16 | 2 | 20 | 2 |\n| 17 | 2 | 20 | 3 |\n| 18 | 2 | 10 | 3 |\n| 19 | 4 | 20 | 4 |\n| 20 | 4 | 20 | 4 |\n+----+------+------+-----------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/ntile/','','https://mariadb.com/kb/en/ntile/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (734,42,'PERCENT_RANK','The PERCENT_RANK() function was first introduced with window\nfunctions in MariaDB 10.2.0.\n \nSyntax\n------ \nPERCENT_RANK() OVER (\n [ PARTITION BY partition_expression ] \n [ ORDER BY order_list ]\n)\n \nDescription\n----------- \nPERCENT_RANK() is a window function that returns the\nrelative percent rank of a given row. The following formula\nis used to calculate the percent rank:\n \n(rank - 1) / (number of rows in the window or partition - 1)\n \nExamples\n-------- \ncreate table t1 (\n pk int primary key,\n a int,\n b int\n);\n \ninsert into t1 values\n( 1 , 0, 10),\n( 2 , 0, 10),\n( 3 , 1, 10),\n( 4 , 1, 10),\n( 8 , 2, 10),\n( 5 , 2, 20),\n( 6 , 2, 20),\n( 7 , 2, 20),\n( 9 , 4, 20),\n(10 , 4, 20);\n \nselect pk, a, b,\n rank() over (order by a) as rank,\n percent_rank() over (order by a) as pct_rank,\n cume_dist() over (order by a) as cume_dist\nfrom t1;\n \n+----+------+------+------+--------------+--------------+\n| pk | a | b | rank | pct_rank | cume_dist |\n+----+------+------+------+--------------+--------------+\n| 1 | 0 | 10 | 1 | 0.0000000000 | 0.2000000000 |\n| 2 | 0 | 10 | 1 | 0.0000000000 | 0.2000000000 |\n| 3 | 1 | 10 | 3 | 0.2222222222 | 0.4000000000 |\n| 4 | 1 | 10 | 3 | 0.2222222222 | 0.4000000000 |\n| 5 | 2 | 20 | 5 | 0.4444444444 | 0.8000000000 |\n| 6 | 2 | 20 | 5 | 0.4444444444 | 0.8000000000 |\n| 7 | 2 | 20 | 5 | 0.4444444444 | 0.8000000000 |\n| 8 | 2 | 10 | 5 | 0.4444444444 | 0.8000000000 |\n| 9 | 4 | 20 | 9 | 0.8888888889 | 1.0000000000 |\n| 10 | 4 | 20 | 9 | 0.8888888889 | 1.0000000000 |\n+----+------+------+------+--------------+--------------+\n \nselect pk, a, b,\n percent_rank() over (order by pk) as pct_rank,\n cume_dist() over (order by pk) as cume_dist\nfrom t1 order by pk;\n \n+----+------+------+--------------+--------------+\n| pk | a | b | pct_rank | cume_dist |\n+----+------+------+--------------+--------------+\n| 1 | 0 | 10 | 0.0000000000 | 0.1000000000 |\n| 2 | 0 | 10 | 0.1111111111 | 0.2000000000 |\n| 3 | 1 | 10 | 0.2222222222 | 0.3000000000 |\n| 4 | 1 | 10 | 0.3333333333 | 0.4000000000 |\n| 5 | 2 | 20 | 0.4444444444 | 0.5000000000 |\n| 6 | 2 | 20 | 0.5555555556 | 0.6000000000 |\n| 7 | 2 | 20 | 0.6666666667 | 0.7000000000 |\n| 8 | 2 | 10 | 0.7777777778 | 0.8000000000 |\n| 9 | 4 | 20 | 0.8888888889 | 0.9000000000 |\n| 10 | 4 | 20 | 1.0000000000 | 1.0000000000 |\n+----+------+------+--------------+--------------+\n \nselect pk, a, b,\n percent_rank() over (partition by a order by a) as\npct_rank,\n cume_dist() over (partition by a order by a) as cume_dist\nfrom t1;\n \n+----+------+------+--------------+--------------+\n| pk | a | b | pct_rank | cume_dist |\n+----+------+------+--------------+--------------+\n| 1 | 0 | 10 | 0.0000000000 | 1.0000000000 |\n| 2 | 0 | 10 | 0.0000000000 | 1.0000000000 |\n| 3 | 1 | 10 | 0.0000000000 | 1.0000000000 |\n| 4 | 1 | 10 | 0.0000000000 | 1.0000000000 |\n| 5 | 2 | 20 | 0.0000000000 | 1.0000000000 |\n| 6 | 2 | 20 | 0.0000000000 | 1.0000000000 |\n| 7 | 2 | 20 | 0.0000000000 | 1.0000000000 |\n| 8 | 2 | 10 | 0.0000000000 | 1.0000000000 |\n| 9 | 4 | 20 | 0.0000000000 | 1.0000000000 |\n| 10 | 4 | 20 | 0.0000000000 | 1.0000000000 |\n+----+------+------+--------------+--------------+\n \n\n\nURL: https://mariadb.com/kb/en/percent_rank/','','https://mariadb.com/kb/en/percent_rank/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (735,42,'PERCENTILE_CONT','The PERCENTILE_CONT() window function was first introduced\nwith in MariaDB 10.3.3.\n \nSyntax\n------ \nDescription\n----------- \nPERCENTILE_CONT() (standing for continuous percentile) is a\nwindow function which returns a value which corresponds to\nthe given fraction in the sort order. If required, it will\ninterpolate between adjacent input items.\n \nEssentially, the following process is followed to find the\nvalue to return:\nGet the number of rows in the partition, denoted by N\nRN = p*(N-1), where p denotes the argument to the\nPERCENTILE_CONT function\ncalculate the FRN(floor row number) and CRN(column row\nnumber for the group( FRN= floor(RN) and CRN = ceil(RN))\nlook up rows FRN and CRN\nIf (CRN = FRN = RN) then the result is (value of expression\nfrom row at RN)\nOtherwise the result is\n(CRN - RN) * (value of expression for row at FRN) +\n(RN - FRN) * (value of expression for row at CRN)\n \nThe MEDIAN function is a specific case of PERCENTILE_CONT,\nequivalent to PERCENTILE_CONT(0.5).\n \nExamples\n-------- \nCREATE TABLE book_rating (name CHAR(30), star_rating\nTINYINT);\n \nINSERT INTO book_rating VALUES (\'Lord of the Ladybirds\',\n5);\nINSERT INTO book_rating VALUES (\'Lord of the Ladybirds\',\n3);\nINSERT INTO book_rating VALUES (\'Lady of the Flies\', 1);\nINSERT INTO book_rating VALUES (\'Lady of the Flies\', 2);\nINSERT INTO book_rating VALUES (\'Lady of the Flies\', 5);\n \nSELECT name, PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY\nstar_rating) \n OVER (PARTITION BY name) AS pc \n FROM book_rating;\n \n+-----------------------+--------------+\n| name | pc |\n+-----------------------+--------------+\n| Lord of the Ladybirds | 4.0000000000 |\n| Lord of the Ladybirds | 4.0000000000 |\n| Lady of the Flies | 2.0000000000 |\n| Lady of the Flies | 2.0000000000 |\n| Lady of the Flies | 2.0000000000 |\n+-----------------------+--------------+\n \nSELECT name, PERCENTILE_CONT(1) WITHIN GROUP (ORDER BY\nstar_rating) \n OVER (PARTITION BY name) AS pc \n FROM book_rating;\n \n+-----------------------+--------------+\n| name | pc |\n+-----------------------+--------------+\n| Lord of the Ladybirds | 5.0000000000 |\n| Lord of the Ladybirds | 5.0000000000 |\n| Lady of the Flies | 5.0000000000 |\n| Lady of the Flies | 5.0000000000 |\n| Lady of the Flies | 5.0000000000 |\n+-----------------------+--------------+\n \nSELECT name, PERCENTILE_CONT(0) WITHIN GROUP (ORDER BY\nstar_rating) \n OVER (PARTITION BY name) AS pc \n FROM book_rating;\n \n+-----------------------+--------------+\n| name | pc |\n+-----------------------+--------------+\n| Lord of the Ladybirds | 3.0000000000 |\n| Lord of the Ladybirds | 3.0000000000 |\n| Lady of the Flies | 1.0000000000 |\n| Lady of the Flies | 1.0000000000 |\n| Lady of the Flies | 1.0000000000 |\n+-----------------------+--------------+\n \nSELECT name, PERCENTILE_CONT(0.6) WITHIN GROUP (ORDER BY\nstar_rating) \n OVER (PARTITION BY name) AS pc \n FROM book_rating;\n \n+-----------------------+--------------+\n| name | pc |\n+-----------------------+--------------+\n| Lord of the Ladybirds | 4.2000000000 |\n| Lord of the Ladybirds | 4.2000000000 |\n| Lady of the Flies | 2.6000000000 |\n| Lady of the Flies | 2.6000000000 |\n| Lady of the Flies | 2.6000000000 |\n+-----------------------+--------------+\n \n\n\nURL: https://mariadb.com/kb/en/percentile_cont/','','https://mariadb.com/kb/en/percentile_cont/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (736,42,'PERCENTILE_DISC','The PERCENTILE_DISC() window function was first introduced\nwith in MariaDB 10.3.3.\n \nSyntax\n------ \n\nDescription\n----------- \nPERCENTILE_DISC() (standing for discrete percentile) is a\nwindow function which returns the first value in the set\nwhose ordered position is the same or more than the\nspecified fraction.\n \nEssentially, the following process is followed to find the\nvalue to return:\nGet the number of rows in the partition.\nWalk through the partition, in order, until finding the the\nfirst row with CUME_DIST() > function_argument.\n \nExamples\n-------- \nCREATE TABLE book_rating (name CHAR(30), star_rating\nTINYINT);\n \nINSERT INTO book_rating VALUES (\'Lord of the Ladybirds\',\n5);\nINSERT INTO book_rating VALUES (\'Lord of the Ladybirds\',\n3);\nINSERT INTO book_rating VALUES (\'Lady of the Flies\', 1);\nINSERT INTO book_rating VALUES (\'Lady of the Flies\', 2);\nINSERT INTO book_rating VALUES (\'Lady of the Flies\', 5);\n \nSELECT name, PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY\nstar_rating)\n OVER (PARTITION BY name) AS pc FROM book_rating;\n \n+-----------------------+------+\n| name | pc |\n+-----------------------+------+\n| Lord of the Ladybirds | 3 |\n| Lord of the Ladybirds | 3 |\n| Lady of the Flies | 2 |\n| Lady of the Flies | 2 |\n| Lady of the Flies | 2 |\n+-----------------------+------+\n5 rows in set (0.000 sec)\n \nSELECT name, PERCENTILE_DISC(0) WITHIN GROUP (ORDER BY\nstar_rating) \n OVER (PARTITION BY name) AS pc FROM book_rating;\n \n+-----------------------+------+\n| name | pc |\n+-----------------------+------+\n| Lord of the Ladybirds | 3 |\n| Lord of the Ladybirds | 3 |\n| Lady of the Flies | 1 |\n| Lady of the Flies | 1 |\n| Lady of the Flies | 1 |\n+-----------------------+------+\n5 rows in set (0.000 sec)\n \nSELECT name, PERCENTILE_DISC(1) WITHIN GROUP (ORDER BY\nstar_rating) \n OVER (PARTITION BY name) AS pc FROM book_rating;\n \n+-----------------------+------+\n| name | pc |\n+-----------------------+------+\n| Lord of the Ladybirds | 5 |\n| Lord of the Ladybirds | 5 |\n| Lady of the Flies | 5 |\n| Lady of the Flies | 5 |\n| Lady of the Flies | 5 |\n+-----------------------+------+\n5 rows in set (0.000 sec)\n \nSELECT name, PERCENTILE_DISC(0.6) WITHIN GROUP (ORDER BY\nstar_rating) \n OVER (PARTITION BY name) AS pc FROM book_rating;\n \n+-----------------------+------+\n| name | pc |\n+-----------------------+------+\n| Lord of the Ladybirds | 5 |\n| Lord of the Ladybirds | 5 |\n| Lady of the Flies | 2 |\n| Lady of the Flies | 2 |\n| Lady of the Flies | 2 |\n+-----------------------+------\n \n\n\nURL: https://mariadb.com/kb/en/percentile_disc/','','https://mariadb.com/kb/en/percentile_disc/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (737,42,'RANK','The RANK() function was first introduced with window\nfunctions in MariaDB 10.2.0.\n \nSyntax\n------ \nRANK() OVER (\n [ PARTITION BY partition_expression ]\n [ ORDER BY order_list ]\n) \n \nDescription\n----------- \nRANK() is a window function that displays the number of a\ngiven row, starting at one and following the ORDER BY\nsequence of the window function, with identical values\nreceiving the same result. It is similar to the ROW_NUMBER()\nfunction except that in that function, identical values will\nreceive a different row number for each result.\n \nExamples\n-------- \nThe distinction between DENSE_RANK(), RANK() and\nROW_NUMBER():\n \nCREATE TABLE student(course VARCHAR(10), mark int, name\nvarchar(10));\n \nINSERT INTO student VALUES \n (\'Maths\', 60, \'Thulile\'),\n (\'Maths\', 60, \'Pritha\'),\n (\'Maths\', 70, \'Voitto\'),\n (\'Maths\', 55, \'Chun\'),\n (\'Biology\', 60, \'Bilal\'),\n (\'Biology\', 70, \'Roger\');\n \nSELECT \n RANK() OVER (PARTITION BY course ORDER BY mark DESC) AS\nrank, \n DENSE_RANK() OVER (PARTITION BY course ORDER BY mark DESC)\nAS dense_rank, \n ROW_NUMBER() OVER (PARTITION BY course ORDER BY mark DESC)\nAS row_num, \n course, mark, name \nFROM student ORDER BY course, mark DESC;\n \n+------+------------+---------+---------+------+---------+\n| rank | dense_rank | row_num | course | mark | name |\n+------+------------+---------+---------+------+---------+\n| 1 | 1 | 1 | Biology | 70 | Roger |\n| 2 | 2 | 2 | Biology | 60 | Bilal |\n| 1 | 1 | 1 | Maths | 70 | Voitto |\n| 2 | 2 | 2 | Maths | 60 | Thulile |\n| 2 | 2 | 3 | Maths | 60 | Pritha |\n| 4 | 3 | 4 | Maths | 55 | Chun |\n+------+------------+---------+---------+------+---------+\n \n\n\nURL: https://mariadb.com/kb/en/rank/','','https://mariadb.com/kb/en/rank/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (738,42,'ROW_NUMBER','ROW_NUMBER() was first introduced with window functions in\nMariaDB 10.2.0.\n \nSyntax\n------ \nROW_NUMBER() OVER (\n [ PARTITION BY partition_expression ]\n [ ORDER BY order_list ]\n) \n \nDescription\n----------- \nROW_NUMBER() is a window function that displays the number\nof a given row, starting at one and following the ORDER BY\nsequence of the window function, with identical values\nreceiving different row numbers. It is similar to the RANK()\nand DENSE_RANK() functions except that in that function,\nidentical values will receive the same rank for each result.\n \nExamples\n-------- \nThe distinction between DENSE_RANK(), RANK() and\nROW_NUMBER():\n \nCREATE TABLE student(course VARCHAR(10), mark int, name\nvarchar(10));\n \nINSERT INTO student VALUES \n (\'Maths\', 60, \'Thulile\'),\n (\'Maths\', 60, \'Pritha\'),\n (\'Maths\', 70, \'Voitto\'),\n (\'Maths\', 55, \'Chun\'),\n (\'Biology\', 60, \'Bilal\'),\n (\'Biology\', 70, \'Roger\');\n \nSELECT \n RANK() OVER (PARTITION BY course ORDER BY mark DESC) AS\nrank, \n DENSE_RANK() OVER (PARTITION BY course ORDER BY mark DESC)\nAS dense_rank, \n ROW_NUMBER() OVER (PARTITION BY course ORDER BY mark DESC)\nAS row_num, \n course, mark, name \nFROM student ORDER BY course, mark DESC;\n \n+------+------------+---------+---------+------+---------+\n| rank | dense_rank | row_num | course | mark | name |\n+------+------------+---------+---------+------+---------+\n| 1 | 1 | 1 | Biology | 70 | Roger |\n| 2 | 2 | 2 | Biology | 60 | Bilal |\n| 1 | 1 | 1 | Maths | 70 | Voitto |\n| 2 | 2 | 2 | Maths | 60 | Thulile |\n| 2 | 2 | 3 | Maths | 60 | Pritha |\n| 4 | 3 | 4 | Maths | 55 | Chun |\n+------+------------+---------+---------+------+---------+\n \n\n\nURL: https://mariadb.com/kb/en/row_number/','','https://mariadb.com/kb/en/row_number/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (739,43,'SPIDER_BG_DIRECT_SQL','Syntax\n------ \nSPIDER_BG_DIRECT_SQL(\'sql\', \'tmp_table_list\',\n\'parameters\')\n \nDescription\n----------- \nExecutes the given SQL statement in the background on the\nremote server, as defined in the parameters listing. If the\nquery returns a result-set, it sttores the results in the\ngiven temporary table. When the given SQL statement executes\nsuccessfully, this function returns the number of called\nUDF\'s. It returns 0 when the given SQL statement fails.\n \nThis function is a UDF installed with the Spider storage\nengine.\n \nExamples\n-------- \nSELECT SPIDER_BG_DIRECT_SQL(\'SELECT * FROM example_table\',\n\'\', \n \'srv \"node1\", port \"8607\"\') AS \"Direct Query\";\n+--------------+\n| Direct Query | \n+--------------+\n| 1 |\n+--------------+\n \nParameters\n \nerror_rw_mode\n \nDescription: Returns empty results on network error.\n0 : Return error on getting network error.\n1: Return 0 records on getting network error.\n \nDefault Table Value: 0\nDSN Parameter Name: erwm\n \n\n\nURL: https://mariadb.com/kb/en/spider_bg_direct_sql/','','https://mariadb.com/kb/en/spider_bg_direct_sql/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (740,43,'SPIDER_COPY_TABLES','Syntax\n------ \nSPIDER_COPY_TABLES(spider_table_name, \n source_link_id, destination_link_id_list [,parameters])\n \nDescription\n----------- \nA UDF installed with the Spider Storage Engine, this\nfunction copies table data from source_link_id to\ndestination_link_id_list. The service does not need to be\nstopped in order to copy.\n \nIf the Spider table is partitioned, the name must be of the\nformat table_name#P#partition_name. The partition name can\nbe viewed in the mysql.spider_tables table, for example:\n \nSELECT table_name FROM mysql.spider_tables;\n+-------------+\n| table_name |\n+-------------+\n| spt_a#P#pt1 |\n| spt_a#P#pt2 |\n| spt_a#P#pt3 |\n+-------------+\n \nReturns 1 if the data was copied successfully, or 0 if\ncopying the data failed.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/spider_copy_tables/','','https://mariadb.com/kb/en/spider_copy_tables/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (741,43,'SPIDER_DIRECT_SQL','Syntax\n------ \nSPIDER_DIRECT_SQL(\'sql\', \'tmp_table_list\',\n\'parameters\')\n \nDescription\n----------- \nA UDF installed with the Spider Storage Engine, this\nfunction is used to execute the SQL string sql on the remote\nserver, as defined in parameters. If any resultsets are\nreturned, they are stored in the tmp_table_list.\n \nThe function returns 1 if the SQL executes successfully, or\n0 if it fails.\n \nExamples\n-------- \nSELECT SPIDER_DIRECT_SQL(\'SELECT * FROM s\', \'\', \'srv\n\"node1\", port \"8607\"\');\n+----------------------------------------------------------------------+\n| SPIDER_DIRECT_SQL(\'SELECT * FROM s\', \'\', \'srv\n\"node1\", port \"8607\"\') |\n+----------------------------------------------------------------------+\n| 1 |\n+----------------------------------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/spider_direct_sql/','','https://mariadb.com/kb/en/spider_direct_sql/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (742,43,'SPIDER_FLUSH_TABLE_MON_CACHE','Syntax\n------ \nSPIDER_FLUSH_TABLE_MON_CACHE()\n \nDescription\n----------- \nA UDF installed with the Spider Storage Engine, this\nfunction is used for refreshing monitoring server\ninformation. It returns a value of 1.\n \nExamples\n-------- \nSELECT SPIDER_FLUSH_TABLE_MON_CACHE();\n+--------------------------------+\n| SPIDER_FLUSH_TABLE_MON_CACHE() |\n+--------------------------------+\n| 1 |\n+--------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/spider_flush_table_mon_cache/','','https://mariadb.com/kb/en/spider_flush_table_mon_cache/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (743,44,'COLUMN_ADD','The Dynamic columns feature was introduced in MariaDB 5.3.\n \nSyntax\n------ \nCOLUMN_ADD(dyncol_blob, column_nr, value [as type],\n[column_nr, value [as type]]...);\nCOLUMN_ADD(dyncol_blob, column_name, value [as type],\n[column_name, value [as type]]...);\n \nDescription\n----------- \nAdds or updates dynamic columns.\ndyncol_blob must be either a valid dynamic columns blob (for\nexample, COLUMN_CREATE returns such blob), or an empty\nstring.\ncolumn_name specifies the name of the column to be added. If\ndyncol_blob already has a column with this name, it will be\noverwritten.\nvalue specifies the new value for the column. Passing a NULL\nvalue will cause the column to be deleted.\nas type is optional. See #datatypes section for a discussion\nabout types.\n \nThe return value is a dynamic column blob after the\nmodifications.\n \nExamples\n-------- \n-- MariaDB 5.3+:\nUPDATE tbl SET dyncol_blob=COLUMN_ADD(dyncol_blob, 1\n/*column id*/, \"value\") WHERE id=1;\n \n-- MariaDB 10.0.1+:\nUPDATE t1 SET dyncol_blob=COLUMN_ADD(dyncol_blob,\n\"column_name\", \"value\") WHERE id=1;\n \nNote: COLUMN_ADD() is a regular function (just like\nCONCAT()), hence, in order to update the value in the table\nyou have to use the UPDATE ... SET\ndynamic_col=COLUMN_ADD(dynamic_col,\n....) pattern.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/column_add/','','https://mariadb.com/kb/en/column_add/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (744,44,'COLUMN_CHECK','The COLUMN_CHECK function was added in MariaDB 10.0.1.\n \nSyntax\n------ \nCOLUMN_CHECK(dyncol_blob);\n \nDescription\n----------- \nCheck if dyncol_blob is a valid packed dynamic columns blob.\nReturn value of 1 means the blob is valid, return value of 0\nmeans it is not.\n \nRationale:\nNormally, one works with valid dynamic column blobs.\nFunctions like COLUMN_CREATE, COLUMN_ADD, COLUMN_DELETE\nalways return valid dynamic column blobs. However, if a\ndynamic column blob is accidentally truncated, or transcoded\nfrom one character set to another, it will be corrupted.\nThis function can be used to check if a value in a blob\nfield is a valid dynamic column blob.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/column_check/','','https://mariadb.com/kb/en/column_check/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (745,44,'COLUMN_CREATE','The Dynamic columns feature was introduced in MariaDB 5.3.\n \nSyntax\n------ \nCOLUMN_CREATE(column_nr, value [as type], [column_nr, value\n[as type]]...);\nCOLUMN_CREATE(column_name, value [as type], [column_name,\nvalue [as type]]...);\n \nDescription\n----------- \nReturns a dynamic columns blob that stores the specified\ncolumns with values.\n \nThe return value is suitable for \nstoring in a table\nfurther modification with other dynamic columns functions\n \nThe as type part allows one to specify the value type. In\nmost cases,\nthis is redundant because MariaDB will be able to deduce the\ntype of the\nvalue. Explicit type specification may be needed when the\ntype of the value is\nnot apparent. For example, a literal \'2012-12-01\' has a\nCHAR type by\ndefault, one will need to specify \'2012-12-01\' AS DATE to\nhave it stored as\na date. See Dynamic Columns:Datatypes for further details.\n \nExamples\n-------- \n-- MariaDB 5.3+:\nINSERT INTO tbl SET dyncol_blob=COLUMN_CREATE(1 /*column\nid*/, \"value\");\n-- MariaDB 10.0.1+:\nINSERT INTO tbl SET\ndyncol_blob=COLUMN_CREATE(\"column_name\", \"value\");\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/column_create/','','https://mariadb.com/kb/en/column_create/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (746,44,'COLUMN_DELETE','The Dynamic columns feature was introduced in MariaDB 5.3.\n \nSyntax\n------ \nCOLUMN_DELETE(dyncol_blob, column_nr, column_nr...);\nCOLUMN_DELETE(dyncol_blob, column_name, column_name...);\n \nDescription\n----------- \nDeletes a dynamic column with the specified name. Multiple\nnames can be given. The return value is a dynamic column\nblob after the modification.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/column_delete/','','https://mariadb.com/kb/en/column_delete/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (747,44,'COLUMN_EXISTS','The Dynamic columns feature was introduced in MariaDB 5.3.\n \nSyntax\n------ \nCOLUMN_EXISTS(dyncol_blob, column_nr);\nCOLUMN_EXISTS(dyncol_blob, column_name);\n \nDescription\n----------- \nChecks if a column with name column_name exists in\ndyncol_blob. If yes, return 1, otherwise return 0. See\ndynamic columns for more information.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/column_exists/','','https://mariadb.com/kb/en/column_exists/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (748,44,'COLUMN_GET','The Dynamic columns feature was introduced in MariaDB 5.3.\n \nSyntax\n------ \nCOLUMN_GET(dyncol_blob, column_nr as type);\nCOLUMN_GET(dyncol_blob, column_name as type);\n \nDescription\n----------- \nGets the value of a dynamic column by its name. If no column\nwith the given name exists, NULL will be returned.\n \ncolumn_name as type requires that one specify the datatype\nof the dynamic column they are reading. \n \nThis may seem counter-intuitive: why would one need to\nspecify which datatype they\'re retrieving? Can\'t the\ndynamic columns system figure the datatype from the data\nbeing stored?\n \nThe answer is: SQL is a statically-typed language. The SQL\ninterpreter needs to know the datatypes of all expressions\nbefore the query is run (for example, when one is using\nprepared statements and runs \"select COLUMN_GET(...)\", the\nprepared statement API requires the server to inform the\nclient about the datatype of the column being read before\nthe query is executed and the server can see what datatype\nthe column actually has).\n \nA note about lengths\n \nIf you\'re running queries like:\n \nSELECT COLUMN_GET(blob, \'colname\' as CHAR) ...\n \nwithout specifying a maximum length (i.e. using #as CHAR#,\nnot as CHAR(n)), MariaDB will report the maximum length of\nthe resultset column to be 53,6870,911 for MariaDB\n5.3-10.0.0 and 16,777,216 for MariaDB 10.0.1+. This may\ncause excessive memory usage in some client libraries,\nbecause they try to pre-allocate a buffer of maximum\nresultset width. To avoid this problem, use CHAR(n) whenever\nyou\'re using COLUMN_GET in the select list.\n \nSee Dynamic Columns:Datatypes for more information about\ndatatypes.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/column_get/','','https://mariadb.com/kb/en/column_get/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (749,44,'COLUMN_JSON','COLUMN_JSON was introduced in MariaDB 10.0.1\n \nSyntax\n------ \nCOLUMN_JSON(dyncol_blob)\n \nDescription\n----------- \nReturns a JSON representation of data in dyncol_blob. Can\nalso be used to display nested columns. See dynamic columns\nfor more information.\n \nExample\n \nselect item_name, COLUMN_JSON(dynamic_cols) from assets;\n+-----------------+----------------------------------------+\n| item_name | COLUMN_JSON(dynamic_cols) |\n+-----------------+----------------------------------------+\n| MariaDB T-shirt | {\"size\":\"XL\",\"color\":\"blue\"} |\n| Thinkpad Laptop | {\"color\":\"black\",\"warranty\":\"3\nyears\"} |\n+-----------------+----------------------------------------+\n \nLimitation: COLUMN_JSON will decode nested dynamic columns\nat a nesting level of not more than 10 levels deep. Dynamic\ncolumns that are nested deeper than 10 levels will be shown\nas BINARY string, without encoding.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/column_json/','','https://mariadb.com/kb/en/column_json/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (750,44,'COLUMN_LIST','The Dynamic columns feature was introduced in MariaDB 5.3.\n \nSyntax\n------ \nCOLUMN_LIST(dyncol_blob);\n \nDescription\n----------- \nSince MariaDB 10.0.1, this function returns a\ncomma-separated list of column names. The names are quoted\nwith backticks.\n \nBefore MariaDB 10.0.1, it returned a comma-separated list of\ncolumn numbers, not names.\n \nSee dynamic columns for more information.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/column_list/','','https://mariadb.com/kb/en/column_list/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (751,46,'Instant ADD COLUMN for InnoDB','Instant ALTER TABLE ... ADD COLUMN for InnoDB was introduced\nin MariaDB 10.3.2. The INSTANT option for the ALGORITHM\nclause was introduced in MariaDB 10.3.7.\n \nNormally, adding a column to a table requires the full table\nto be rebuilt. The complexity of the operation is\nproportional to the size of the table, or O(n·m) where n is\nthe number of rows in the table and m is the number of\nindexes. \n \nIn MariaDB 10.0 and later, the ALTER TABLE statement\nsupports online DDL for storage engines that have\nimplemented the relevant online DDL algorithms and locking\nstrategies.\n \nThe InnoDB storage engine has implemented online DDL for\nmany operations. These online DDL optimizations allow\nconcurrent DML to the table in many cases, even if the table\nneeds to be rebuilt.\n \nSee InnoDB Online DDL Overview for more information about\nonline DDL with InnoDB.\n \nAllowing concurrent DML during the operation does not solve\nall problems. When a column was added to a table with the\nolder in-place optimization, the resulting table rebuild\ncould still significantly increase the I/O and memory\nconsumption and cause replication lag.\n \nIn contrast, with the new instant ALTER TABLE ... ADD\nCOLUMN, all that is needed is an O(log n) operation to\ninsert a special hidden record into the table, and an update\nof the data dictionary. For a large table, instead of taking\nseveral hours, the operation would be completed in the blink\nof an eye. The ALTER TABLE ... ADD COLUMN operation is only\nslightly more expensive than a regular INSERT, due to\nlocking constraints.\n \nIn the past, some developers may have implemented a kind of\n\"instant add column\" in the application by encoding\nmultiple columns in a single TEXT or BLOB column. MariaDB\nDynamic Columns was an early example of that. A more recent\nexample is JSON and related string manipulation functions.\n \nAdding real columns has the following advantages over\nencoding columns into a single \"expandable\" column:\nEfficient storage in a native binary format\nData type safety\nIndexes can be built natively\nConstraints are available: UNIQUE, CHECK, FOREIGN KEY\nDEFAULT values can be specified\nTriggers can be written more easily\n \nWith instant ALTER TABLE ... ADD COLUMN, you can enjoy all\nthe benefits of structured storage without the drawback of\nhaving to rebuild the table.\n \nInstant ALTER TABLE ... ADD COLUMN is available for both old\nand new InnoDB tables. Basically you can just upgrade from\nMySQL 5.x or MariaDB and start adding columns instantly.\n \nColumns instantly added to a table exist in a separate data\nstructure from the main table definition, similar to how\nInnoDB separates BLOB columns. If the table ever becomes\nempty, (such as from TRUNCATE or DELETE statements), InnoDB\nincorporates the instantly added columns into the main table\ndefinition. See InnoDB Online DDL Operations with\nALGORITHM=INSTANT: Non-canonical Storage Format Caused by\nSome Operations for more information.\n \nThe operation is also crash safe. If the server is killed\nwhile executing an instant ALTER TABLE ... ADD COLUMN, when\nthe table is restored InnoDB integrates the new column,\nflattening the table definition.\n \nLimitations\n \nIn MariaDB 10.3, instant ALTER TABLE ... ADD COLUMN only\napplies when the added columns appear last in the table. The\nplace specifier LAST is the default. If AFTER col is\nspecified, then col must be the last column, or the\noperation will require the table to be rebuilt. In MariaDB\n10.4, this restriction has been lifted.\n \nIf the table contains a hidden FTS_DOC_ID column due to a\nFULLTEXT INDEX, then instant ALTER TABLE ... ADD COLUMN will\nnot be possible.\n \nInnoDB data files after instant ALTER TABLE ... ADD COLUMN\ncannot be imported to older versions of MariaDB or MySQL\nwithout first being rebuilt.\n \nAfter using Instant ALTER TABLE ... ADD COLUMN, any\ntable-rebuilding operation such as ALTER TABLE … FORCE\nwill incorporate instantaneously added columns into the main\ntable body.\n \nInstant ALTER TABLE ... ADD COLUMN is not available for\nROW_FORMAT=COMPRESSED.\n \nIn MariaDB 10.3, ALTER TABLE … DROP COLUMN requires the\ntable to be rebuilt. In MariaDB 10.4, this restriction has\nbeen lifted.\n \nExample\n \nCREATE TABLE t(id INT PRIMARY KEY, u INT UNSIGNED NOT NULL\nUNIQUE)\nENGINE=InnoDB;\n \nINSERT INTO t(id,u) VALUES(1,1),(2,2),(3,3);\n \nALTER TABLE t ADD COLUMN\n(d DATETIME DEFAULT current_timestamp(),\n p POINT NOT NULL DEFAULT ST_GeomFromText(\'POINT(0 0)\'),\n t TEXT CHARSET utf8 DEFAULT \'The quick brown fox jumps\nover the lazy dog\');\n \nUPDATE t SET t=NULL WHERE id=3;\n \nSELECT id,u,d,ST_AsText(p),t FROM t;\n \nSELECT variable_value FROM information_schema.global_status\nWHERE variable_name = \'innodb_instant_alter_column\';\n \nThe above example illustrates that when the added columns\nare declared NOT NULL, a DEFAULT value must be available,\neither implied by the data type or set explicitly by the\nuser. The expression need not be constant, but it must not\nrefer to the columns of the table, such as DEFAULT u+1 (a\nMariaDB extension). The DEFAULT current_timestamp() would be\nevaluated at the time of the ALTER TABLE and apply to each\nrow, like it does for non-instant ALTER TABLE. If a\nsubsequent ALTER TABLE changes the DEFAULT value for\nsubsequent INSERT, the values of the columns in existing\nrecords will naturally be unaffected.\n \nThe design was brainstormed in April by engineers from\nMariaDB Corporation, Alibaba and Tencent. A prototype was\ndeveloped by Vin Chen (陈ç¦è£) from the Tencent Game DBA\nTeam.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/instant-add-column-for-innodb/','','https://mariadb.com/kb/en/instant-add-column-for-innodb/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (752,48,'Full-Text Index Overview','MariaDB has support for full-text indexing and searching:\nA full-text index in MariaDB is an index of type FULLTEXT,\nand it allows more options when searching for portions of\ntext from a field.\nFull-text indexes can be used only with MyISAM and Aria\ntables, from MariaDB 10.0.5 with InnoDB tables and from\nMariaDB 10.0.15 with Mroonga tables, and can be created only\nfor CHAR, VARCHAR, or TEXT columns.\nPartitioned tables cannot contain fulltext indexes, even if\nthe storage engine supports them.\nA FULLTEXT index definition can be given in the CREATE TABLE\nstatement when a\n table is created, or added later using ALTER TABLE or\nCREATE INDEX.\nFor large data sets, it is much faster to load your data\ninto a table that\n has no FULLTEXT index and then create the index after that,\nthan to load data\n into a table that has an existing FULLTEXT index.\n \nFull-text searching is performed using MATCH() ... AGAINST\nsyntax.\nMATCH() takes a comma-separated list that names the columns\nto be\nsearched. AGAINST takes a string to search for, and an\noptional\nmodifier that indicates what type of search to perform. The\nsearch\nstring must be a literal string, not a variable or a column\nname.\n \nMATCH (col1,col2,...) AGAINST (expr [search_modifier])\n \nExcluded Results\n \nPartial words are excluded.\nWords less than 4 characters in length (3 or less) will not\nbe stored in the fulltext index. This value can be adjusted\nby changing the ft_min_word_length system variable (or, for\nInnoDB, innodb_ft_min_token_size).\nWords longer than 84 characters in length will also not be\nstored in the fulltext index. This values can be adjusted by\nchanging the ft_max_word_length system variable (or, for\nInnoDB, innodb_ft_max_token_size).\nStopwords are a list of common words such as \"once\" or\n\"then\" that do not reflect in the search results unless IN\nBOOLEAN MODE is used. The stopword list for MyISAM/Aria\ntables and InnoDB tables can differ. See stopwords for\ndetails and a full list, as well as for details on how to\nchange the default list.\nFor MyISAM/Aria fulltext indexes only, if a word appears in\nmore than half the rows, it is also excluded from the\nresults of a fulltext search.\nFor InnoDB indexes, only committed rows appear -\nmodifications from the current transaction do not apply.\n \nRelevance\n \nMariaDB calculates a relevance for each result, based on a\nnumber of factors, including the number of words in the\nindex, the number of unique words in a row, the total number\nof words in both the index and the result, and the weight of\nthe word. In English, \'cool\' will be weighted less than\n\'dandy\', at least at present! The relevance can be\nreturned as part of a query simply by using the MATCH\nfunction in the field list.\n \nTypes of Full-Text search\n \nIN NATURAL LANGUAGE MODE\n \nIN NATURAL LANGUAGE MODE is the default type of full-text\nsearch, and the keywords can be omitted. There are no\nspecial operators, and searches consist of one or more\ncomma-separated keywords.\n \nSearches are returned in descending order of relevance.\n \nIN BOOLEAN MODE\n \nBoolean search permits the use of a number of special\noperators:\n \nOperator | Description | \n \n+ | The word is mandatory in all rows returned. | \n \n- | The word cannot appear in any row returned. | \n \n< | The word that follows has a lower relevance than other\nwords, although rows containing it will still match | \n \n> | The word that follows has a higher relevance than other\nwords. | \n \n() | Used to group words into subexpressions. | \n \n~ | The word following contributes negatively to the\nrelevance of the row (which is different to the \'-\'\noperator, which specifically excludes the word, or the \'\n\nURL: https://mariadb.com/kb/en/full-text-index-overview/','','https://mariadb.com/kb/en/full-text-index-overview/');
-insert into help_keyword (help_keyword_id,name) values (1,'account');
-insert into help_keyword (help_keyword_id,name) values (2,'aggregate');
-insert into help_keyword (help_keyword_id,name) values (3,'add');
-insert into help_keyword (help_keyword_id,name) values (4,'after');
-insert into help_keyword (help_keyword_id,name) values (5,'alter');
-insert into help_keyword (help_keyword_id,name) values (6,'completion');
-insert into help_keyword (help_keyword_id,name) values (7,'schedule');
-insert into help_keyword (help_keyword_id,name) values (8,'server');
-insert into help_keyword (help_keyword_id,name) values (9,'columns');
-insert into help_keyword (help_keyword_id,name) values (10,'drop');
-insert into help_keyword (help_keyword_id,name) values (11,'analyze');
-insert into help_keyword (help_keyword_id,name) values (12,'json');
-insert into help_keyword (help_keyword_id,name) values (13,'value');
-insert into help_keyword (help_keyword_id,name) values (14,'master_ssl_ca');
-insert into help_keyword (help_keyword_id,name) values (15,'master_ssl_verify_cert');
-insert into help_keyword (help_keyword_id,name) values (16,'nchar');
-insert into help_keyword (help_keyword_id,name) values (17,'action');
-insert into help_keyword (help_keyword_id,name) values (18,'create');
-insert into help_keyword (help_keyword_id,name) values (19,'at');
-insert into help_keyword (help_keyword_id,name) values (20,'starts');
-insert into help_keyword (help_keyword_id,name) values (21,'returns');
-insert into help_keyword (help_keyword_id,name) values (22,'host');
-insert into help_keyword (help_keyword_id,name) values (23,'row_format');
-insert into help_keyword (help_keyword_id,name) values (24,'deallocate prepare');
-insert into help_keyword (help_keyword_id,name) values (25,'drop prepare');
-insert into help_keyword (help_keyword_id,name) values (26,'against');
-insert into help_keyword (help_keyword_id,name) values (27,'fulltext');
-insert into help_keyword (help_keyword_id,name) values (28,'escape');
-insert into help_keyword (help_keyword_id,name) values (29,'mode');
-insert into help_keyword (help_keyword_id,name) values (30,'repeat');
-insert into help_keyword (help_keyword_id,name) values (31,'sql_big_result');
-insert into help_keyword (help_keyword_id,name) values (32,'isolation');
-insert into help_keyword (help_keyword_id,name) values (33,'read committed');
-insert into help_keyword (help_keyword_id,name) values (34,'read uncommitted');
-insert into help_keyword (help_keyword_id,name) values (35,'repeatable read');
-insert into help_keyword (help_keyword_id,name) values (36,'serializable');
-insert into help_keyword (help_keyword_id,name) values (37,'work');
-insert into help_relation (help_topic_id,help_keyword_id) values (95,14);
-insert into help_relation (help_topic_id,help_keyword_id) values (95,15);
-insert into help_relation (help_topic_id,help_keyword_id) values (97,24);
-insert into help_relation (help_topic_id,help_keyword_id) values (97,10);
-insert into help_relation (help_topic_id,help_keyword_id) values (97,25);
-insert into help_relation (help_topic_id,help_keyword_id) values (108,32);
-insert into help_relation (help_topic_id,help_keyword_id) values (108,33);
-insert into help_relation (help_topic_id,help_keyword_id) values (108,34);
-insert into help_relation (help_topic_id,help_keyword_id) values (108,35);
-insert into help_relation (help_topic_id,help_keyword_id) values (108,36);
-insert into help_relation (help_topic_id,help_keyword_id) values (110,37);
-insert into help_relation (help_topic_id,help_keyword_id) values (116,1);
-insert into help_relation (help_topic_id,help_keyword_id) values (118,1);
-insert into help_relation (help_topic_id,help_keyword_id) values (118,18);
-insert into help_relation (help_topic_id,help_keyword_id) values (119,1);
-insert into help_relation (help_topic_id,help_keyword_id) values (119,5);
-insert into help_relation (help_topic_id,help_keyword_id) values (120,10);
-insert into help_relation (help_topic_id,help_keyword_id) values (127,18);
-insert into help_relation (help_topic_id,help_keyword_id) values (183,2);
-insert into help_relation (help_topic_id,help_keyword_id) values (184,2);
-insert into help_relation (help_topic_id,help_keyword_id) values (185,2);
-insert into help_relation (help_topic_id,help_keyword_id) values (186,2);
-insert into help_relation (help_topic_id,help_keyword_id) values (187,2);
-insert into help_relation (help_topic_id,help_keyword_id) values (188,2);
-insert into help_relation (help_topic_id,help_keyword_id) values (189,2);
-insert into help_relation (help_topic_id,help_keyword_id) values (190,2);
-insert into help_relation (help_topic_id,help_keyword_id) values (191,2);
-insert into help_relation (help_topic_id,help_keyword_id) values (192,2);
-insert into help_relation (help_topic_id,help_keyword_id) values (193,2);
-insert into help_relation (help_topic_id,help_keyword_id) values (194,2);
-insert into help_relation (help_topic_id,help_keyword_id) values (196,2);
-insert into help_relation (help_topic_id,help_keyword_id) values (197,2);
-insert into help_relation (help_topic_id,help_keyword_id) values (199,2);
-insert into help_relation (help_topic_id,help_keyword_id) values (251,11);
-insert into help_relation (help_topic_id,help_keyword_id) values (258,18);
-insert into help_relation (help_topic_id,help_keyword_id) values (258,2);
-insert into help_relation (help_topic_id,help_keyword_id) values (258,21);
-insert into help_relation (help_topic_id,help_keyword_id) values (259,10);
-insert into help_relation (help_topic_id,help_keyword_id) values (264,13);
-insert into help_relation (help_topic_id,help_keyword_id) values (271,16);
-insert into help_relation (help_topic_id,help_keyword_id) values (280,12);
-insert into help_relation (help_topic_id,help_keyword_id) values (316,30);
-insert into help_relation (help_topic_id,help_keyword_id) values (317,13);
-insert into help_relation (help_topic_id,help_keyword_id) values (320,13);
-insert into help_relation (help_topic_id,help_keyword_id) values (357,9);
-insert into help_relation (help_topic_id,help_keyword_id) values (419,13);
-insert into help_relation (help_topic_id,help_keyword_id) values (435,13);
-insert into help_relation (help_topic_id,help_keyword_id) values (436,29);
-insert into help_relation (help_topic_id,help_keyword_id) values (436,31);
-insert into help_relation (help_topic_id,help_keyword_id) values (444,11);
-insert into help_relation (help_topic_id,help_keyword_id) values (446,11);
-insert into help_relation (help_topic_id,help_keyword_id) values (447,11);
-insert into help_relation (help_topic_id,help_keyword_id) values (447,12);
-insert into help_relation (help_topic_id,help_keyword_id) values (448,12);
-insert into help_relation (help_topic_id,help_keyword_id) values (449,12);
-insert into help_relation (help_topic_id,help_keyword_id) values (607,28);
-insert into help_relation (help_topic_id,help_keyword_id) values (614,26);
-insert into help_relation (help_topic_id,help_keyword_id) values (614,29);
-insert into help_relation (help_topic_id,help_keyword_id) values (625,30);
-insert into help_relation (help_topic_id,help_keyword_id) values (645,5);
-insert into help_relation (help_topic_id,help_keyword_id) values (646,5);
-insert into help_relation (help_topic_id,help_keyword_id) values (646,6);
-insert into help_relation (help_topic_id,help_keyword_id) values (646,7);
-insert into help_relation (help_topic_id,help_keyword_id) values (647,5);
-insert into help_relation (help_topic_id,help_keyword_id) values (648,5);
-insert into help_relation (help_topic_id,help_keyword_id) values (649,5);
-insert into help_relation (help_topic_id,help_keyword_id) values (650,5);
-insert into help_relation (help_topic_id,help_keyword_id) values (651,8);
-insert into help_relation (help_topic_id,help_keyword_id) values (652,3);
-insert into help_relation (help_topic_id,help_keyword_id) values (652,4);
-insert into help_relation (help_topic_id,help_keyword_id) values (652,5);
-insert into help_relation (help_topic_id,help_keyword_id) values (652,9);
-insert into help_relation (help_topic_id,help_keyword_id) values (652,10);
-insert into help_relation (help_topic_id,help_keyword_id) values (653,5);
-insert into help_relation (help_topic_id,help_keyword_id) values (654,5);
-insert into help_relation (help_topic_id,help_keyword_id) values (655,17);
-insert into help_relation (help_topic_id,help_keyword_id) values (656,18);
-insert into help_relation (help_topic_id,help_keyword_id) values (657,19);
-insert into help_relation (help_topic_id,help_keyword_id) values (657,18);
-insert into help_relation (help_topic_id,help_keyword_id) values (657,6);
-insert into help_relation (help_topic_id,help_keyword_id) values (657,7);
-insert into help_relation (help_topic_id,help_keyword_id) values (657,20);
-insert into help_relation (help_topic_id,help_keyword_id) values (658,18);
-insert into help_relation (help_topic_id,help_keyword_id) values (659,18);
-insert into help_relation (help_topic_id,help_keyword_id) values (660,18);
-insert into help_relation (help_topic_id,help_keyword_id) values (661,18);
-insert into help_relation (help_topic_id,help_keyword_id) values (662,18);
-insert into help_relation (help_topic_id,help_keyword_id) values (663,18);
-insert into help_relation (help_topic_id,help_keyword_id) values (664,18);
-insert into help_relation (help_topic_id,help_keyword_id) values (664,22);
-insert into help_relation (help_topic_id,help_keyword_id) values (665,17);
-insert into help_relation (help_topic_id,help_keyword_id) values (665,9);
-insert into help_relation (help_topic_id,help_keyword_id) values (665,18);
-insert into help_relation (help_topic_id,help_keyword_id) values (665,23);
-insert into help_relation (help_topic_id,help_keyword_id) values (666,18);
-insert into help_relation (help_topic_id,help_keyword_id) values (667,18);
-insert into help_relation (help_topic_id,help_keyword_id) values (668,18);
-insert into help_relation (help_topic_id,help_keyword_id) values (669,10);
-insert into help_relation (help_topic_id,help_keyword_id) values (670,10);
-insert into help_relation (help_topic_id,help_keyword_id) values (671,10);
-insert into help_relation (help_topic_id,help_keyword_id) values (672,10);
-insert into help_relation (help_topic_id,help_keyword_id) values (673,10);
-insert into help_relation (help_topic_id,help_keyword_id) values (674,10);
-insert into help_relation (help_topic_id,help_keyword_id) values (675,10);
-insert into help_relation (help_topic_id,help_keyword_id) values (676,10);
-insert into help_relation (help_topic_id,help_keyword_id) values (677,10);
-insert into help_relation (help_topic_id,help_keyword_id) values (678,10);
-insert into help_relation (help_topic_id,help_keyword_id) values (680,10);
-insert into help_relation (help_topic_id,help_keyword_id) values (681,10);
-insert into help_relation (help_topic_id,help_keyword_id) values (724,2);
-insert into help_relation (help_topic_id,help_keyword_id) values (751,3);
-insert into help_relation (help_topic_id,help_keyword_id) values (752,26);
-insert into help_relation (help_topic_id,help_keyword_id) values (752,27);
-insert into help_relation (help_topic_id,help_keyword_id) values (753,27);
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (1,9,'HELP_DATE','This help information was generated from the MariaDB Knowledge Base\non 22 July 2019.','','');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (2,2,'AREA','A synonym for ST_AREA.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/polygon-properties-area/','','https://mariadb.com/kb/en/library/polygon-properties-area/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (3,2,'CENTROID','A synonym for ST_CENTROID.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/centroid/','','https://mariadb.com/kb/en/library/centroid/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (4,2,'ExteriorRing','A synonym for ST_ExteriorRing.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/polygon-properties-exteriorring/','','https://mariadb.com/kb/en/library/polygon-properties-exteriorring/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (5,2,'InteriorRingN','A synonym for ST_InteriorRingN.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/polygon-properties-interiorringn/','','https://mariadb.com/kb/en/library/polygon-properties-interiorringn/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (6,2,'NumInteriorRings','A synonym for ST_NumInteriorRings.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/polygon-properties-numinteriorrings/','','https://mariadb.com/kb/en/library/polygon-properties-numinteriorrings/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (7,2,'ST_AREA','Syntax\n------ \nST_Area(poly)\nArea(poly)\n \nDescription\n----------- \nReturns as a double-precision number the area of the Polygon\nvalue poly, as measured in its spatial reference system.\n \nST_Area() and Area() are synonyms.\n \nExamples\n-------- \nSET @poly = \'Polygon((0 0,0 3,3 0,0 0),(1 1,1 2,2 1,1\n1))\';\n \nSELECT Area(GeomFromText(@poly));\n+---------------------------+\n| Area(GeomFromText(@poly)) |\n+---------------------------+\n| 4 |\n+---------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_area/','','https://mariadb.com/kb/en/library/st_area/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (8,2,'ST_CENTROID','Syntax\n------ \nST_Centroid(mpoly)\nCentroid(mpoly)\n \nDescription\n----------- \nReturns a point reflecting the mathematical centroid\n(geometric center) for the MultiPolygon mpoly. The resulting\npoint will not necessarily be on the MultiPolygon. \n \nST_Centroid() and Centroid() are synonyms.\n \nExamples\n-------- \nSET @poly = ST_GeomFromText(\'POLYGON((0 0,20 0,20 20,0 20,0\n0))\');\nSELECT ST_AsText(ST_Centroid(@poly)) AS center;\n \n+--------------+\n| center |\n+--------------+\n| POINT(10 10) |\n+--------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_centroid/','','https://mariadb.com/kb/en/library/st_centroid/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (9,2,'ST_ExteriorRing','Syntax\n------ \nST_ExteriorRing(poly)\nExteriorRing(poly)\n \nDescription\n----------- \nReturns the exterior ring of the Polygon value poly as a\nLineString.\n \nST_ExteriorRing() and ExteriorRing() are synonyms.\n \nExamples\n-------- \nSET @poly = \'Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2\n1,1 1))\';\n \nSELECT 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 \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_exteriorring/','','https://mariadb.com/kb/en/library/st_exteriorring/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (10,2,'ST_InteriorRingN','Syntax\n------ \nST_InteriorRingN(poly,N)\nInteriorRingN(poly,N)\n \nDescription\n----------- \nReturns the N-th interior ring for the Polygon value poly as\na LineString. Rings are numbered beginning with 1.\n \nST_InteriorRingN() and InteriorRingN() are synonyms.\n \nExamples\n-------- \nSET @poly = \'Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2\n1,1 1))\';\n \nSELECT 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 \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_interiorringn/','','https://mariadb.com/kb/en/library/st_interiorringn/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (11,2,'ST_NumInteriorRings','Syntax\n------ \nST_NumInteriorRings(poly)\nNumInteriorRings(poly)\n \nDescription\n----------- \nReturns an integer containing the number of interior rings\nin the Polygon value poly.\n \nNote that according the the OpenGIS standard, a POLYGON\nshould have exactly one ExteriorRing and all other rings\nshould lie within that ExteriorRing and thus be the\nInteriorRings. Practically, however, some systems, including\nMariaDB\'s, permit polygons to have several\n\'ExteriorRings\'. In the case of there being multiple,\nnon-overlapping exterior rings ST_NumInteriorRings() will\nreturn 1.\n \nST_NumInteriorRings() and NumInteriorRings() are synonyms.\n \nExamples\n-------- \nSET @poly = \'Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2\n1,1 1))\';\n \nSELECT NumInteriorRings(GeomFromText(@poly));\n+---------------------------------------+\n| NumInteriorRings(GeomFromText(@poly)) |\n+---------------------------------------+\n| 1 |\n+---------------------------------------+\n \nNon-overlapping \'polygon\':\n \nSELECT ST_NumInteriorRings(ST_PolyFromText(\'POLYGON((0 0,10\n0,10 10,0 10,0 0),\n (-1 -1,-5 -1,-5 -5,-1 -5,-1 -1))\')) AS NumInteriorRings;\n \n+------------------+\n| NumInteriorRings |\n+------------------+\n| 1 |\n+------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_numinteriorrings/','','https://mariadb.com/kb/en/library/st_numinteriorrings/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (12,3,'WKT Definition','Description\n----------- \nThe Well-Known Text (WKT) representation of Geometry is\ndesigned to exchange geometry data in ASCII form. Examples\nof the basic geometry types include:\n \nGeometry Types | \n \nPOINT | \n \nLINESTRING | \n \nPOLYGON | \n \nMULTIPOINT | \n \nMULTILINESTRING | \n \nMULTIPOLYGON | \n \nGEOMETRYCOLLECTION | \n \nGEOMETRY | \n \n\n\nURL: https://mariadb.com/kb/en/library/wkt-definition/','','https://mariadb.com/kb/en/library/wkt-definition/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (13,3,'AsText','A synonym for ST_AsText().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/wkt-astext/','','https://mariadb.com/kb/en/library/wkt-astext/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (14,3,'AsWKT','A synonym for ST_AsText().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/wkt-aswkt/','','https://mariadb.com/kb/en/library/wkt-aswkt/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (15,3,'GeomCollFromText','A synonym for ST_GeomCollFromText.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/wkt-geomcollfromtext/','','https://mariadb.com/kb/en/library/wkt-geomcollfromtext/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (16,3,'GeometryCollectionFromText','A synonym for ST_GeomCollFromText.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/geometrycollectionfromtext/','','https://mariadb.com/kb/en/library/geometrycollectionfromtext/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (17,3,'GeometryFromText','A synonym for ST_GeomFromText.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/geometryfromtext/','','https://mariadb.com/kb/en/library/geometryfromtext/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (18,3,'GeomFromText','A synonym for ST_GeomFromText.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/wkt-geomfromtext/','','https://mariadb.com/kb/en/library/wkt-geomfromtext/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (19,3,'LineFromText','A synonym for ST_LineFromText.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/wkt-linefromtext/','','https://mariadb.com/kb/en/library/wkt-linefromtext/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (20,3,'LineStringFromText','A synonym for ST_LineFromText.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/linestringfromtext/','','https://mariadb.com/kb/en/library/linestringfromtext/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (21,3,'MLineFromText','Syntax\n------ \nMLineFromText(wkt[,srid])\nMultiLineStringFromText(wkt[,srid])\n \nDescription\n----------- \nConstructs a MULTILINESTRING value using its WKT\nrepresentation and SRID.\n \nMLineFromText() and MultiLineStringFromText() are synonyms.\n \nExamples\n-------- \nCREATE TABLE gis_multi_line (g MULTILINESTRING);\nSHOW FIELDS FROM gis_multi_line;\n \nINSERT INTO gis_multi_line VALUES\n (MultiLineStringFromText(\'MULTILINESTRING((10 48,10 21,10\n0),(16 0,16 23,16 48))\')),\n (MLineFromText(\'MULTILINESTRING((10 48,10 21,10 0))\')),\n (MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2),\nPoint(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21,\n7))))));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/mlinefromtext/','','https://mariadb.com/kb/en/library/mlinefromtext/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (22,3,'MPointFromText','Syntax\n------ \nMPointFromText(wkt[,srid])\nMultiPointFromText(wkt[,srid])\n \nDescription\n----------- \nConstructs a MULTIPOINT value using its WKT representation\nand SRID.\n \nMPointFromText() and MultiPointFromText() are synonyms.\n \nExamples\n-------- \nCREATE TABLE gis_multi_point (g MULTIPOINT);\nSHOW FIELDS FROM gis_multi_point;\n \nINSERT INTO gis_multi_point VALUES\n (MultiPointFromText(\'MULTIPOINT(0 0,10 10,10 20,20\n20)\')),\n (MPointFromText(\'MULTIPOINT(1 1,11 11,11 21,21 21)\')),\n (MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4,\n10)))));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/mpointfromtext/','','https://mariadb.com/kb/en/library/mpointfromtext/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (23,3,'MPolyFromText','Syntax\n------ \nMPolyFromText(wkt[,srid])\nMultiPolygonFromText(wkt[,srid])\n \nDescription\n----------- \nConstructs a MULTIPOLYGON value using its WKT representation\nand SRID.\n \nMPolyFromText() and MultiPolygonFromText() are synonyms.\n \nExamples\n-------- \nCREATE TABLE gis_multi_polygon (g MULTIPOLYGON);\nSHOW FIELDS FROM gis_multi_polygon;\n \nINSERT INTO gis_multi_polygon VALUES\n (MultiPolygonFromText(\'MULTIPOLYGON(((28 26,28 0,84 0,84\n42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67\n13,59 13,59 18)))\')),\n (MPolyFromText(\'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28\n26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59\n13,59 18)))\')),\n (MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0,\n3), Point(3, 3), Point(3, 0), Point(0, 3)))))));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/mpolyfromtext/','','https://mariadb.com/kb/en/library/mpolyfromtext/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (24,3,'MultiLineStringFromText','A synonym for MLineFromText.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/multilinestringfromtext/','','https://mariadb.com/kb/en/library/multilinestringfromtext/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (25,3,'MultiPointFromText','A synonym for MPointFromText.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/multipointfromtext/','','https://mariadb.com/kb/en/library/multipointfromtext/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (26,3,'MultiPolygonFromText','A synonym for MPolyFromText.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/multipolygonfromtext/','','https://mariadb.com/kb/en/library/multipolygonfromtext/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (27,3,'PointFromText','A synonym for ST_PointFromText.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/wkt-pointfromtext/','','https://mariadb.com/kb/en/library/wkt-pointfromtext/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (28,3,'PolyFromText','A synonym for ST_PolyFromText.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/wkt-polyfromtext/','','https://mariadb.com/kb/en/library/wkt-polyfromtext/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (29,3,'PolygonFromText','A synonym for ST_PolyFromText.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/polygonfromtext/','','https://mariadb.com/kb/en/library/polygonfromtext/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (30,3,'ST_AsText','Syntax\n------ \nST_AsText(g)\nAsText(g)\nST_AsWKT(g)\nAsWKT(g)\n \nDescription\n----------- \nConverts a value in internal geometry format to its WKT\nrepresentation and returns the string result.\n \nST_AsText(), AsText(), ST_AsWKT() and AsWKT() are all\nsynonyms.\n \nExamples\n-------- \nSET @g = \'LineString(1 1,4 4,6 6)\';\n \nSELECT ST_AsText(ST_GeomFromText(@g));\n+--------------------------------+\n| ST_AsText(ST_GeomFromText(@g)) |\n+--------------------------------+\n| LINESTRING(1 1,4 4,6 6) |\n+--------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_astext/','','https://mariadb.com/kb/en/library/st_astext/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (31,3,'ST_ASWKT','A synonym for ST_ASTEXT().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_aswkt/','','https://mariadb.com/kb/en/library/st_aswkt/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (32,3,'ST_GeomCollFromText','Syntax\n------ \nST_GeomCollFromText(wkt[,srid])\nST_GeometryCollectionFromText(wkt[,srid])\nGeomCollFromText(wkt[,srid])\nGeometryCollectionFromText(wkt[,srid])\n \nDescription\n----------- \nConstructs a GEOMETRYCOLLECTION value using its WKT \nrepresentation and SRID.\n \nST_GeomCollFromText(), ST_GeometryCollectionFromText(),\nGeomCollFromText() and GeometryCollectionFromText() are all\nsynonyms.\n \nExample\n \nCREATE TABLE gis_geometrycollection (g GEOMETRYCOLLECTION);\nSHOW FIELDS FROM gis_geometrycollection;\n \nINSERT INTO gis_geometrycollection VALUES\n (GeomCollFromText(\'GEOMETRYCOLLECTION(POINT(0 0),\nLINESTRING(0 0,10 10))\')),\n (GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6),\nLineString(Point(3, 6), Point(7, 9)))))),\n (GeomFromText(\'GeometryCollection()\')),\n (GeomFromText(\'GeometryCollection EMPTY\'));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_geomcollfromtext/','','https://mariadb.com/kb/en/library/st_geomcollfromtext/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (33,3,'ST_GeometryCollectionFromText','A synonym for ST_GeomCollFromText.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/st_geometrycollectionfromtext/','','https://mariadb.com/kb/en/library/st_geometrycollectionfromtext/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (34,3,'ST_GeometryFromText','A synonym for ST_GeomFromText.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_geometryfromtext/','','https://mariadb.com/kb/en/library/st_geometryfromtext/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (35,3,'ST_GeomFromText','Syntax\n------ \nST_GeomFromText(wkt[,srid])\nST_GeometryFromText(wkt[,srid])\nGeomFromText(wkt[,srid])\nGeometryFromText(wkt[,srid])\n \nDescription\n----------- \nConstructs a geometry value of any type using its WKT\nrepresentation and SRID.\n \nGeomFromText(), GeometryFromText(), ST_GeomFromText() and\nST_GeometryFromText() are all synonyms.\n \nExample\n \nSET @g = ST_GEOMFROMTEXT(\'POLYGON((1 1,1 5,4 9,6 9,9 3,7\n2,1 1))\');\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_geomfromtext/','','https://mariadb.com/kb/en/library/st_geomfromtext/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (36,3,'ST_LineFromText','Syntax\n------ \nST_LineFromText(wkt[,srid])\nST_LineStringFromText(wkt[,srid])\nLineFromText(wkt[,srid])\nLineStringFromText(wkt[,srid])\n \nDescription\n----------- \nConstructs a LINESTRING value using its WKT representation\nand SRID.\n \nST_LineFromText(), ST_LineStringFromText(),\nST_LineFromText() and ST_LineStringFromText() are all\nsynonyms.\n \nExamples\n-------- \nCREATE TABLE gis_line (g LINESTRING);\nSHOW FIELDS FROM gis_line;\n \nINSERT INTO gis_line VALUES\n (LineFromText(\'LINESTRING(0 0,0 10,10 0)\')),\n (LineStringFromText(\'LINESTRING(10 10,20 10,20 20,10 20,10\n10)\')),\n (LineStringFromWKB(AsWKB(LineString(Point(10, 10),\nPoint(40, 10)))));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_linefromtext/','','https://mariadb.com/kb/en/library/st_linefromtext/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (37,3,'ST_LineStringFromText','A synonym for ST_LineFromText.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/st_linestringfromtext/','','https://mariadb.com/kb/en/library/st_linestringfromtext/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (38,3,'ST_PointFromText','Syntax\n------ \nST_PointFromText(wkt[,srid])\nPointFromText(wkt[,srid])\n \nDescription\n----------- \nConstructs a POINT value using its WKT representation and\nSRID.\n \nST_PointFromText() and PointFromText() are synonyms.\n \nExamples\n-------- \nCREATE TABLE gis_point (g POINT);\nSHOW FIELDS FROM gis_point;\n \nINSERT INTO gis_point VALUES\n (PointFromText(\'POINT(10 10)\')),\n (PointFromText(\'POINT(20 10)\')),\n (PointFromText(\'POINT(20 20)\')),\n (PointFromWKB(AsWKB(PointFromText(\'POINT(10 20)\'))));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_pointfromtext/','','https://mariadb.com/kb/en/library/st_pointfromtext/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (39,3,'ST_PolyFromText','Syntax\n------ \nST_PolyFromText(wkt[,srid])\nST_PolygonFromText(wkt[,srid])\nPolyFromText(wkt[,srid])\nPolygonFromText(wkt[,srid])\n \nDescription\n----------- \nConstructs a POLYGON value using its WKT representation and\nSRID.\n \nST_PolyFromText(), ST_PolygonFromText(), PolyFromText() and\nST_PolygonFromText() are all synonyms.\n \nExamples\n-------- \nCREATE TABLE gis_polygon (g POLYGON);\nINSERT INTO gis_polygon VALUES\n (PolygonFromText(\'POLYGON((10 10,20 10,20 20,10 20,10\n10))\')),\n (PolyFromText(\'POLYGON((0 0,50 0,50 50,0 50,0 0), (10\n10,20 10,20 20,10 20,10 10))\'));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_polyfromtext/','','https://mariadb.com/kb/en/library/st_polyfromtext/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (40,3,'ST_PolygonFromText','A synonym for ST_PolyFromText.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_polygonfromtext/','','https://mariadb.com/kb/en/library/st_polygonfromtext/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (41,4,'Addition Operator (+)','Syntax\n------ \n+\n \nDescription\n----------- \nAddition.\n \nIf both operands are integers, the result is calculated with\nBIGINT precision. If either integer is unsigned, the result\nis also an unsigned integer.\n \nFor real or string operands, the operand with the highest\nprecision determines the result precision.\n \nExamples\n-------- \nSELECT 3+5;\n \n+-----+\n| 3+5 |\n+-----+\n| 8 |\n+-----+\n \n\n\nURL: https://mariadb.com/kb/en/library/addition-operator/','','https://mariadb.com/kb/en/library/addition-operator/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (42,4,'Subtraction Operator (-)','Syntax\n------ \n-\n \nDescription\n----------- \nSubtraction. The operator is also used as the unary minus\nfor changing sign.\n \nIf both operands are integers, the result is calculated with\nBIGINT precision. If either integer is unsigned, the result\nis also an unsigned integer, unless the\nNO_UNSIGNED_SUBTRACTION SQL_MODE is enabled, in which case\nthe result is always signed.\n \nFor real or string operands, the operand with the highest\nprecision determines the result precision.\n \nExamples\n-------- \nSELECT 96-9;\n \n+------+\n| 96-9 |\n+------+\n| 87 |\n+------+\n \nSELECT 15-17;\n \n+-------+\n| 15-17 |\n+-------+\n| -2 |\n+-------+\n \nSELECT 3.66 + 1.333;\n \n+--------------+\n| 3.66 + 1.333 |\n+--------------+\n| 4.993 |\n+--------------+\n \nUnary minus:\n \n SELECT - (3+5);\n+---------+\n| - (3+5) |\n+---------+\n| -8 |\n+---------+\n \n\n\nURL:\nhttps://mariadb.com/kb/en/library/subtraction-operator-/','','https://mariadb.com/kb/en/library/subtraction-operator-/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (43,4,'Division Operator (/)','Syntax\n------ \n/\n \nDescription\n----------- \nDivision operator. Dividing by zero will return NULL. By\ndefault, returns four digits after the decimal. This is\ndetermined by the server system variable\ndiv_precision_increment which by default is four. It can be\nset from 0 to 30.\n \nDividing by zero returns NULL. If the\nERROR_ON_DIVISION_BY_ZERO SQL_MODE is used (the default\nsince MariaDB 10.2.4), a division by zero also produces a\nwarning.\n \nExamples\n-------- \nSELECT 4/5;\n \n+--------+\n| 4/5 |\n+--------+\n| 0.8000 |\n+--------+\n \nSELECT 300/(2-2);\n+-----------+\n| 300/(2-2) |\n+-----------+\n| NULL |\n+-----------+\n \nSELECT 300/7;\n \n+---------+\n| 300/7 |\n+---------+\n| 42.8571 |\n+---------+\n \nChanging div_precision_increment for the session from the\ndefault of four to six:\n \nSET div_precision_increment = 6;\n \nSELECT 300/7;\n \n+-----------+\n| 300/7 |\n+-----------+\n| 42.857143 |\n+-----------+\n \nSELECT 300/7;\n \n+-----------+\n| 300/7 |\n+-----------+\n| 42.857143 |\n+-----------+\n \n\n\nURL: https://mariadb.com/kb/en/library/division-operator/','','https://mariadb.com/kb/en/library/division-operator/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (44,4,'Multiplication Operator (*)','Syntax\n------ \n*\n \nDescription\n----------- \nMultiplication operator.\n \nExamples\n-------- \nSELECT 7*6;\n \n+-----+\n| 7*6 |\n+-----+\n| 42 |\n+-----+\n \nSELECT 1234567890*9876543210;\n \n+-----------------------+\n| 1234567890*9876543210 |\n+-----------------------+\n| -6253480962446024716 |\n+-----------------------+\n \nSELECT 18014398509481984*18014398509481984.0;\n \n+---------------------------------------+\n| 18014398509481984*18014398509481984.0 |\n+---------------------------------------+\n| 324518553658426726783156020576256.0 |\n+---------------------------------------+\n \nSELECT 18014398509481984*18014398509481984;\n \n+-------------------------------------+\n| 18014398509481984*18014398509481984 |\n+-------------------------------------+\n| 0 |\n+-------------------------------------+\n \n\n\nURL:\nhttps://mariadb.com/kb/en/library/multiplication-operator/','','https://mariadb.com/kb/en/library/multiplication-operator/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (45,4,'Modulo Operator (%)','Syntax\n------ \nN % M\n \nDescription\n----------- \nModulo operator. Returns the remainder of N divided by M.\nSee also MOD.\n \nExamples\n-------- \nSELECT 1042 % 50;\n \n+-----------+\n| 1042 % 50 |\n+-----------+\n| 42 |\n+-----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/modulo-operator/','','https://mariadb.com/kb/en/library/modulo-operator/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (46,4,'DIV','Syntax\n------ \nDIV\n \nDescription\n----------- \nInteger division. Similar to FLOOR(), but is safe with\nBIGINT values.\nIncorrect results may occur for non-integer operands that\nexceed BIGINT range.\n \nIf the ERROR_ON_DIVISION_BY_ZERO SQL_MODE is used, a\ndivision by zero produces an error. Otherwise, it returns\nNULL.\n \nThe remainder of a division can be obtained using the MOD\noperator.\n \nExamples\n-------- \nSELECT 300 DIV 7;\n \n+-----------+\n| 300 DIV 7 |\n+-----------+\n| 42 |\n+-----------+\n \nSELECT 300 DIV 0;\n \n+-----------+\n| 300 DIV 0 |\n+-----------+\n| NULL |\n+-----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/div/','','https://mariadb.com/kb/en/library/div/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (47,4,'ABS','Syntax\n------ \nABS(X)\n \nDescription\n----------- \nReturns the absolute (non-negative) value of X. If X is not\na number, it is converted to a numeric type.\n \nExamples\n-------- \nSELECT ABS(42);\n+---------+\n| ABS(42) |\n+---------+\n| 42 |\n+---------+\n \nSELECT ABS(-42);\n+----------+\n| ABS(-42) |\n+----------+\n| 42 |\n+----------+\n \nSELECT ABS(DATE \'1994-01-01\');\n+------------------------+\n| ABS(DATE \'1994-01-01\') |\n+------------------------+\n| 19940101 |\n+------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/abs/','','https://mariadb.com/kb/en/library/abs/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (48,4,'ACOS','Syntax\n------ \nACOS(X)\n \nDescription\n----------- \nReturns the arc cosine of X, that is, the value whose cosine\nis X.\nReturns NULL if X is not in the range -1 to 1.\n \nExamples\n-------- \nSELECT ACOS(1);\n+---------+\n| ACOS(1) |\n+---------+\n| 0 |\n+---------+\n \nSELECT ACOS(1.0001);\n+--------------+\n| ACOS(1.0001) |\n+--------------+\n| NULL |\n+--------------+\n \nSELECT ACOS(0);\n+-----------------+\n| ACOS(0) |\n+-----------------+\n| 1.5707963267949 |\n+-----------------+\n \nSELECT ACOS(0.234);\n+------------------+\n| ACOS(0.234) |\n+------------------+\n| 1.33460644244679 |\n+------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/acos/','','https://mariadb.com/kb/en/library/acos/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (49,4,'ASIN','Syntax\n------ \nASIN(X)\n \nDescription\n----------- \nReturns the arc sine of X, that is, the value whose sine is\nX. Returns\nNULL if X is not in the range -1 to 1.\n \nExamples\n-------- \nSELECT ASIN(0.2);\n+--------------------+\n| ASIN(0.2) |\n+--------------------+\n| 0.2013579207903308 |\n+--------------------+\n \nSELECT ASIN(\'foo\');\n+-------------+\n| ASIN(\'foo\') |\n+-------------+\n| 0 |\n+-------------+\n \nSHOW WARNINGS;\n \n+---------+------+-----------------------------------------+\n| Level | Code | Message |\n+---------+------+-----------------------------------------+\n| Warning | 1292 | Truncated incorrect DOUBLE value: \'foo\'\n|\n+---------+------+-----------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/asin/','','https://mariadb.com/kb/en/library/asin/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (50,4,'ATAN','Syntax\n------ \nATAN(X)\n \nDescription\n----------- \nReturns the arc tangent of X, that is, the value whose\ntangent is X.\n \nExamples\n-------- \nSELECT ATAN(2);\n+--------------------+\n| ATAN(2) |\n+--------------------+\n| 1.1071487177940904 |\n+--------------------+\n \nSELECT ATAN(-2);\n+---------------------+\n| ATAN(-2) |\n+---------------------+\n| -1.1071487177940904 |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/atan/','','https://mariadb.com/kb/en/library/atan/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (51,4,'ATAN2','Syntax\n------ \nATAN(Y,X), ATAN2(Y,X)\n \nDescription\n----------- \nReturns the arc tangent of the two variables X and Y. It is\nsimilar to\ncalculating the arc tangent of Y / X, except that the signs\nof both\narguments are used to determine the quadrant of the result.\n \nExamples\n-------- \nSELECT ATAN(-2,2);\n+---------------------+\n| ATAN(-2,2) |\n+---------------------+\n| -0.7853981633974483 |\n+---------------------+\n \nSELECT ATAN2(PI(),0);\n+--------------------+\n| ATAN2(PI(),0) |\n+--------------------+\n| 1.5707963267948966 |\n+--------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/atan2/','','https://mariadb.com/kb/en/library/atan2/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (52,4,'CEIL','Syntax\n------ \nCEIL(X)\n \nDescription\n----------- \nCEIL() is a synonym for CEILING().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/ceil/','','https://mariadb.com/kb/en/library/ceil/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (53,4,'CEILING','Syntax\n------ \nCEILING(X)\n \nDescription\n----------- \nReturns the smallest integer value not less than X.\n \nExamples\n-------- \nSELECT CEILING(1.23);\n+---------------+\n| CEILING(1.23) |\n+---------------+\n| 2 |\n+---------------+\n \nSELECT CEILING(-1.23);\n+----------------+\n| CEILING(-1.23) |\n+----------------+\n| -1 |\n+----------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/ceiling/','','https://mariadb.com/kb/en/library/ceiling/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (54,4,'CONV','Syntax\n------ \nCONV(N,from_base,to_base)\n \nDescription\n----------- \nConverts numbers between different number bases. Returns a\nstring\nrepresentation of the number N, converted from base\nfrom_base\nto base to_base.\n \nReturns NULL if any argument is NULL, or if the second or\nthird argument are not in the allowed range.\n \nThe argument N is interpreted as an integer, but may be\nspecified as an\ninteger or a string. The minimum base is 2 and the maximum\nbase is 36. If\nto_base is a negative number, N is regarded as a signed\nnumber.\nOtherwise, N is treated as unsigned. CONV() works with\n64-bit\nprecision.\n \nSome shortcuts for this function are also available: BIN(),\nOCT(), HEX(), UNHEX(). Also, MariaDB allows binary literal\nvalues and hexadecimal literal values.\n \nExamples\n-------- \nSELECT CONV(\'a\',16,2);\n+----------------+\n| CONV(\'a\',16,2) |\n+----------------+\n| 1010 |\n+----------------+\n \nSELECT CONV(\'6E\',18,8);\n+-----------------+\n| CONV(\'6E\',18,8) |\n+-----------------+\n| 172 |\n+-----------------+\n \nSELECT CONV(-17,10,-18);\n+------------------+\n| CONV(-17,10,-18) |\n+------------------+\n| -H |\n+------------------+\n \nSELECT CONV(12+\'10\'+\'10\'+0xa,10,10);\n+------------------------------+\n| CONV(12+\'10\'+\'10\'+0xa,10,10) |\n+------------------------------+\n| 42 |\n+------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/conv/','','https://mariadb.com/kb/en/library/conv/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (55,4,'COS','Syntax\n------ \nCOS(X)\n \nDescription\n----------- \nReturns the cosine of X, where X is given in radians.\n \nExamples\n-------- \nSELECT COS(PI());\n+-----------+\n| COS(PI()) |\n+-----------+\n| -1 |\n+-----------\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/cos/','','https://mariadb.com/kb/en/library/cos/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (56,4,'COT','Syntax\n------ \nCOT(X)\n \nDescription\n----------- \nReturns the cotangent of X.\n \nExamples\n-------- \nSELECT COT(42);\n+--------------------+\n| COT(42) |\n+--------------------+\n| 0.4364167060752729 |\n+--------------------+\n \nSELECT COT(12);\n+---------------------+\n| COT(12) |\n+---------------------+\n| -1.5726734063976893 |\n+---------------------+\n \nSELECT COT(0);\nERROR 1690 (22003): DOUBLE value is out of range in\n\'cot(0)\'\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/cot/','','https://mariadb.com/kb/en/library/cot/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (57,4,'CRC32','Syntax\n------ \nCRC32(expr)\n \nDescription\n----------- \nComputes a cyclic redundancy check value and returns a\n32-bit unsigned\nvalue. The result is NULL if the argument is NULL. The\nargument is\nexpected to be a string and (if possible) is treated as one\nif it is\nnot.\n \nExamples\n-------- \nSELECT CRC32(\'MariaDB\');\n+------------------+\n| CRC32(\'MariaDB\') |\n+------------------+\n| 4227209140 |\n+------------------+\n \nSELECT CRC32(\'mariadb\');\n+------------------+\n| CRC32(\'mariadb\') |\n+------------------+\n| 2594253378 |\n+------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/crc32/','','https://mariadb.com/kb/en/library/crc32/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (58,4,'DEGREES','Syntax\n------ \nDEGREES(X)\n \nDescription\n----------- \nReturns the argument X, converted from radians to degrees.\n \nThis is the converse of the RADIANS() function.\n \nExamples\n-------- \nSELECT DEGREES(PI());\n+---------------+\n| DEGREES(PI()) |\n+---------------+\n| 180 |\n+---------------+\n \nSELECT DEGREES(PI() / 2);\n+-------------------+\n| DEGREES(PI() / 2) |\n+-------------------+\n| 90 |\n+-------------------+\n \nSELECT DEGREES(45);\n+-----------------+\n| DEGREES(45) |\n+-----------------+\n| 2578.3100780887 |\n+-----------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/degrees/','','https://mariadb.com/kb/en/library/degrees/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (59,4,'EXP','Syntax\n------ \nEXP(X)\n \nDescription\n----------- \nReturns the value of e (the base of natural logarithms)\nraised to the\npower of X. The inverse of this function is LOG() (using a\nsingle\nargument only) or LN().\n \nIf X is NULL, this function returns NULL.\n \nExamples\n-------- \nSELECT EXP(2);\n+------------------+\n| EXP(2) |\n+------------------+\n| 7.38905609893065 |\n+------------------+\n \nSELECT EXP(-2);\n+--------------------+\n| EXP(-2) |\n+--------------------+\n| 0.1353352832366127 |\n+--------------------+\n \nSELECT EXP(0);\n+--------+\n| EXP(0) |\n+--------+\n| 1 |\n+--------+\n \nSELECT EXP(NULL);\n+-----------+\n| EXP(NULL) |\n+-----------+\n| NULL |\n+-----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/exp/','','https://mariadb.com/kb/en/library/exp/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (60,4,'FLOOR','Syntax\n------ \nFLOOR(X)\n \nDescription\n----------- \nReturns the largest integer value not greater than X.\n \nExamples\n-------- \nSELECT FLOOR(1.23);\n+-------------+\n| FLOOR(1.23) |\n+-------------+\n| 1 |\n+-------------+\n \nSELECT FLOOR(-1.23);\n+--------------+\n| FLOOR(-1.23) |\n+--------------+\n| -2 |\n+--------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/floor/','','https://mariadb.com/kb/en/library/floor/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (61,4,'LN','Syntax\n------ \nLN(X)\n \nDescription\n----------- \nReturns the natural logarithm of X; that is, the base-e\nlogarithm of X.\nIf X is less than or equal to 0, or NULL, then NULL is\nreturned.\n \nThe inverse of this function is EXP().\n \nExamples\n-------- \nSELECT LN(2);\n+-------------------+\n| LN(2) |\n+-------------------+\n| 0.693147180559945 |\n+-------------------+\n \nSELECT LN(-2);\n+--------+\n| LN(-2) |\n+--------+\n| NULL |\n+--------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/ln/','','https://mariadb.com/kb/en/library/ln/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (62,4,'LOG','Syntax\n------ \nLOG(X), LOG(B,X)\n \nDescription\n----------- \nIf called with one parameter, this function returns the\nnatural\nlogarithm of X. If X is less than or equal to 0, then NULL\nis\nreturned.\n \nIf called with two parameters, it returns the logarithm of X\nto the base B. If B is \n\nURL: https://mariadb.com/kb/en/library/log/','','https://mariadb.com/kb/en/library/log/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (63,4,'LOG10','Syntax\n------ \nLOG10(X)\n \nDescription\n----------- \nReturns the base-10 logarithm of X.\n \nExamples\n-------- \nSELECT LOG10(2);\n+-------------------+\n| LOG10(2) |\n+-------------------+\n| 0.301029995663981 |\n+-------------------+\n \nSELECT LOG10(100);\n+------------+\n| LOG10(100) |\n+------------+\n| 2 |\n+------------+\n \nSELECT LOG10(-100);\n+-------------+\n| LOG10(-100) |\n+-------------+\n| NULL |\n+-------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/log10/','','https://mariadb.com/kb/en/library/log10/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (64,4,'LOG2','Syntax\n------ \nLOG2(X)\n \nDescription\n----------- \nReturns the base-2 logarithm of X.\n \nExamples\n-------- \nSELECT LOG2(4398046511104);\n+---------------------+\n| LOG2(4398046511104) |\n+---------------------+\n| 42 |\n+---------------------+\n \nSELECT LOG2(65536);\n+-------------+\n| LOG2(65536) |\n+-------------+\n| 16 |\n+-------------+\n \nSELECT LOG2(-100);\n+------------+\n| LOG2(-100) |\n+------------+\n| NULL |\n+------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/log2/','','https://mariadb.com/kb/en/library/log2/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (65,4,'MOD','Syntax\n------ \nMOD(N,M), N % M, N MOD M\n \nDescription\n----------- \nModulo operation. Returns the remainder of N divided by M.\nSee also Modulo Operator.\n \nIf the ERROR_ON_DIVISION_BY_ZERO SQL_MODE is used, any\nnumber modulus zero produces an error. Otherwise, it returns\nNULL.\n \nThe integer part of a division can be obtained using DIV.\n \nExamples\n-------- \nSELECT 1042 % 50;\n \n+-----------+\n| 1042 % 50 |\n+-----------+\n| 42 |\n+-----------+\n \nSELECT MOD(234, 10);\n+--------------+\n| MOD(234, 10) |\n+--------------+\n| 4 |\n+--------------+\n \nSELECT 253 % 7;\n \n+---------+\n| 253 % 7 |\n+---------+\n| 1 |\n+---------+\n \nSELECT MOD(29,9);\n+-----------+\n| MOD(29,9) |\n+-----------+\n| 2 |\n+-----------+\n \nSELECT 29 MOD 9;\n \n+----------+\n| 29 MOD 9 |\n+----------+\n| 2 |\n+----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/mod/','','https://mariadb.com/kb/en/library/mod/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (66,4,'OCT','Syntax\n------ \nOCT(N)\n \nDescription\n----------- \nReturns a string representation of the octal value of N,\nwhere N is a longlong (BIGINT) number. This is equivalent to\nCONV(N,10,8). Returns NULL if N is NULL.\n \nExamples\n-------- \nSELECT OCT(34);\n+---------+\n| OCT(34) |\n+---------+\n| 42 |\n+---------+\n \nSELECT OCT(12);\n+---------+\n| OCT(12) |\n+---------+\n| 14 |\n+---------+\n \n\n\nURL: https://mariadb.com/kb/en/library/oct/','','https://mariadb.com/kb/en/library/oct/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (67,4,'PI','Syntax\n------ \nPI()\n \nDescription\n----------- \nReturns the value of π (pi). The default number of decimal\nplaces\ndisplayed is six, but MariaDB uses the full double-precision\nvalue\ninternally.\n \nExamples\n-------- \nSELECT PI();\n+----------+\n| PI() |\n+----------+\n| 3.141593 |\n+----------+\n \nSELECT PI()+0.0000000000000000000000;\n \n+-------------------------------+\n| PI()+0.0000000000000000000000 |\n+-------------------------------+\n| 3.1415926535897931159980 |\n+-------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/pi/','','https://mariadb.com/kb/en/library/pi/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (68,4,'POW','Syntax\n------ \nPOW(X,Y)\n \nDescription\n----------- \nReturns the value of X raised to the power of Y.\n \nPOWER() is a synonym.\n \nExamples\n-------- \nSELECT POW(2,3);\n+----------+\n| POW(2,3) |\n+----------+\n| 8 |\n+----------+\n \nSELECT POW(2,-2);\n+-----------+\n| POW(2,-2) |\n+-----------+\n| 0.25 |\n+-----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/pow/','','https://mariadb.com/kb/en/library/pow/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (69,4,'POWER','Syntax\n------ \nPOWER(X,Y)\n \nDescription\n----------- \nThis is a synonym for POW(), which returns the value of X\nraised to the power of Y.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/power/','','https://mariadb.com/kb/en/library/power/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (70,4,'RADIANS','Syntax\n------ \nRADIANS(X)\n \nDescription\n----------- \nReturns the argument X, converted from degrees to radians.\nNote that\nπ radians equals 180 degrees. \n \nThis is the converse of the DEGREES() function.\n \nExamples\n-------- \nSELECT RADIANS(45);\n+-------------------+\n| RADIANS(45) |\n+-------------------+\n| 0.785398163397448 |\n+-------------------+\n \nSELECT RADIANS(90);\n+-----------------+\n| RADIANS(90) |\n+-----------------+\n| 1.5707963267949 |\n+-----------------+\n \nSELECT RADIANS(PI());\n+--------------------+\n| RADIANS(PI()) |\n+--------------------+\n| 0.0548311355616075 |\n+--------------------+\n \nSELECT RADIANS(180);\n+------------------+\n| RADIANS(180) |\n+------------------+\n| 3.14159265358979 |\n+------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/radians/','','https://mariadb.com/kb/en/library/radians/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (71,4,'RAND','Syntax\n------ \nRAND(), RAND(N)\n \nDescription\n----------- \nReturns a random DOUBLE precision floating point value v in\nthe range 0 \n\nURL: https://mariadb.com/kb/en/library/rand/','','https://mariadb.com/kb/en/library/rand/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (72,4,'ROUND','Syntax\n------ \nROUND(X), ROUND(X,D)\n \nDescription\n----------- \nRounds the argument X to D decimal places. The rounding\nalgorithm\ndepends on the data type of X. D defaults to 0 if not\nspecified.\nD can be negative to cause D digits left of the decimal\npoint of the\nvalue X to become zero.\n \nExamples\n-------- \nSELECT ROUND(-1.23);\n+--------------+\n| ROUND(-1.23) |\n+--------------+\n| -1 |\n+--------------+\n \nSELECT ROUND(-1.58);\n+--------------+\n| ROUND(-1.58) |\n+--------------+\n| -2 |\n+--------------+\n \nSELECT ROUND(1.58); \n+-------------+\n| ROUND(1.58) |\n+-------------+\n| 2 |\n+-------------+\n \nSELECT ROUND(1.298, 1);\n+-----------------+\n| ROUND(1.298, 1) |\n+-----------------+\n| 1.3 |\n+-----------------+\n \nSELECT ROUND(1.298, 0);\n+-----------------+\n| ROUND(1.298, 0) |\n+-----------------+\n| 1 |\n+-----------------+\n \nSELECT ROUND(23.298, -1);\n+-------------------+\n| ROUND(23.298, -1) |\n+-------------------+\n| 20 |\n+-------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/round/','','https://mariadb.com/kb/en/library/round/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (73,4,'SIGN','Syntax\n------ \nSIGN(X)\n \nDescription\n----------- \nReturns the sign of the argument as -1, 0, or 1, depending\non whether\nX is negative, zero, or positive.\n \nExamples\n-------- \nSELECT SIGN(-32);\n+-----------+\n| SIGN(-32) |\n+-----------+\n| -1 |\n+-----------+\n \nSELECT SIGN(0);\n+---------+\n| SIGN(0) |\n+---------+\n| 0 |\n+---------+\n \nSELECT SIGN(234);\n+-----------+\n| SIGN(234) |\n+-----------+\n| 1 |\n+-----------+\n \n\n\nURL: https://mariadb.com/kb/en/library/sign/','','https://mariadb.com/kb/en/library/sign/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (74,4,'SIN','Syntax\n------ \nSIN(X)\n \nDescription\n----------- \nReturns the sine of X, where X is given in radians.\n \nExamples\n-------- \nSELECT SIN(1.5707963267948966);\n+-------------------------+\n| SIN(1.5707963267948966) |\n+-------------------------+\n| 1 |\n+-------------------------+\n \nSELECT SIN(PI());\n+----------------------+\n| SIN(PI()) |\n+----------------------+\n| 1.22460635382238e-16 |\n+----------------------+\n \nSELECT ROUND(SIN(PI()));\n+------------------+\n| ROUND(SIN(PI())) |\n+------------------+\n| 0 |\n+------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/sin/','','https://mariadb.com/kb/en/library/sin/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (75,4,'SQRT','Syntax\n------ \nSQRT(X)\n \nDescription\n----------- \nReturns the square root of X. If X is negative, NULL is\nreturned.\n \nExamples\n-------- \nSELECT SQRT(4);\n+---------+\n| SQRT(4) |\n+---------+\n| 2 |\n+---------+\n \nSELECT SQRT(20);\n+------------------+\n| SQRT(20) |\n+------------------+\n| 4.47213595499958 |\n+------------------+\n \nSELECT SQRT(-16);\n+-----------+\n| SQRT(-16) |\n+-----------+\n| NULL |\n+-----------+\n \nSELECT SQRT(1764);\n+------------+\n| SQRT(1764) |\n+------------+\n| 42 |\n+------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/sqrt/','','https://mariadb.com/kb/en/library/sqrt/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (76,4,'TAN','Syntax\n------ \nTAN(X)\n \nDescription\n----------- \nReturns the tangent of X, where X is given in radians.\n \nExamples\n-------- \nSELECT TAN(0.7853981633974483);\n+-------------------------+\n| TAN(0.7853981633974483) |\n+-------------------------+\n| 0.9999999999999999 |\n+-------------------------+\n \nSELECT TAN(PI());\n+-----------------------+\n| TAN(PI()) |\n+-----------------------+\n| -1.22460635382238e-16 |\n+-----------------------+\n \nSELECT TAN(PI()+1);\n+-----------------+\n| TAN(PI()+1) |\n+-----------------+\n| 1.5574077246549 |\n+-----------------+\n \nSELECT TAN(RADIANS(PI()));\n+--------------------+\n| TAN(RADIANS(PI())) |\n+--------------------+\n| 0.0548861508080033 |\n+--------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/tan/','','https://mariadb.com/kb/en/library/tan/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (77,4,'TRUNCATE','This page documents the TRUNCATE function. See TRUNCATE\nTABLE for the DDL statement.\n \nSyntax\n------ \nTRUNCATE(X,D)\n \nDescription\n----------- \nReturns the number X, truncated to D decimal places. If D is\n0, the\nresult has no decimal point or fractional part. D can be\nnegative to\ncause D digits left of the decimal point of the value X to\nbecome\nzero.\n \nExamples\n-------- \nSELECT TRUNCATE(1.223,1);\n+-------------------+\n| TRUNCATE(1.223,1) |\n+-------------------+\n| 1.2 |\n+-------------------+\n \nSELECT TRUNCATE(1.999,1);\n+-------------------+\n| TRUNCATE(1.999,1) |\n+-------------------+\n| 1.9 |\n+-------------------+\n \nSELECT TRUNCATE(1.999,0); \n+-------------------+\n| TRUNCATE(1.999,0) |\n+-------------------+\n| 1 |\n+-------------------+\n \nSELECT TRUNCATE(-1.999,1);\n+--------------------+\n| TRUNCATE(-1.999,1) |\n+--------------------+\n| -1.9 |\n+--------------------+\n \nSELECT TRUNCATE(122,-2);\n+------------------+\n| TRUNCATE(122,-2) |\n+------------------+\n| 100 |\n+------------------+\n \nSELECT TRUNCATE(10.28*100,0);\n+-----------------------+\n| TRUNCATE(10.28*100,0) |\n+-----------------------+\n| 1028 |\n+-----------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/truncate/','','https://mariadb.com/kb/en/library/truncate/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (78,5,'Plugin Overview','Plugins are server components that enhance MariaDB in some\nway. These can be anything from new storage engines, plugins\nfor enhancing full-text parsing, or even small enhancements,\nsuch as a plugin to get a timestamp as an integer.\n \nQuerying Plugin Information\n \nThere are a number of ways to see which plugins are\ncurrently active.\n \nA server almost always has a large number of active plugins,\nbecause the server contains a large number of built-in\nplugins, which are active by default and cannot be\nuninstalled.\n \nQuerying Plugin Information with SHOW PLUGINS\n \nThe SHOW PLUGINS statement can be used to query information\nabout all active plugins.\n \nFor example:\n \nSHOW PLUGINS;\n \n+----------------------------+----------+--------------------+---------+---------+\n| Name | Status | Type | Library | License |\n+----------------------------+----------+--------------------+---------+---------+\n...\n| mysql_native_password | ACTIVE | AUTHENTICATION | NULL |\nGPL |\n| mysql_old_password | ACTIVE | AUTHENTICATION | NULL | GPL\n|\n| MRG_MyISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |\n...\n+----------------------------+----------+--------------------+---------+---------+\n \nIf a plugin\'s Library column has the NULL value, then the\nplugin is built-in, and it cannot be uninstalled.\n \nQuerying Plugin Information with information_schema.PLUGINS\n \nThe information_schema.PLUGINS table can be queried to get\nmore detailed information about plugins.\n \nFor example:\n \nSELECT * FROM information_schema.PLUGINS\\G\n...\n*************************** 6. row\n***************************\n PLUGIN_NAME: CSV\n PLUGIN_VERSION: 1.0\n PLUGIN_STATUS: ACTIVE\n PLUGIN_TYPE: STORAGE ENGINE\n PLUGIN_TYPE_VERSION: 100003.0\n PLUGIN_LIBRARY: NULL\nPLUGIN_LIBRARY_VERSION: NULL\n PLUGIN_AUTHOR: Brian Aker, MySQL AB\n PLUGIN_DESCRIPTION: CSV storage engine\n PLUGIN_LICENSE: GPL\n LOAD_OPTION: FORCE\n PLUGIN_MATURITY: Stable\n PLUGIN_AUTH_VERSION: 1.0\n*************************** 7. row\n***************************\n PLUGIN_NAME: MEMORY\n PLUGIN_VERSION: 1.0\n PLUGIN_STATUS: ACTIVE\n PLUGIN_TYPE: STORAGE ENGINE\n PLUGIN_TYPE_VERSION: 100003.0\n PLUGIN_LIBRARY: NULL\nPLUGIN_LIBRARY_VERSION: NULL\n PLUGIN_AUTHOR: MySQL AB\n PLUGIN_DESCRIPTION: Hash based, stored in memory, useful\nfor temporary tables\n PLUGIN_LICENSE: GPL\n LOAD_OPTION: FORCE\n PLUGIN_MATURITY: Stable\n PLUGIN_AUTH_VERSION: 1.0\n...\n \nIf a plugin\'s PLUGIN_LIBRARY column has the NULL value,\nthen the plugin is built-in, and it cannot be uninstalled.\n \nQuerying Plugin Information with mysql.plugin\n \nThe mysql.plugin table can be queried to get information\nabout installed plugins.\n \nThis table only contains information about plugins that have\nbeen installed via the following methods:\nThe INSTALL SONAME statement.\nThe INSTALL PLUGIN statement.\nThe mysql_plugin utility.\n \nThis table does not contain information about:\nBuilt-in plugins.\nPlugins loaded with the --plugin-load-add option.\nPlugins loaded with the --plugin-load option.\n \nThis table only contains enough information to reload the\nplugin when the server is restarted, which means it only\ncontains the plugin name and the plugin library.\n \nFor example:\n \nSELECT * FROM mysql.plugin;\n \n+------+------------+\n| name | dl |\n+------+------------+\n| PBXT | libpbxt.so |\n+------+------------+\n \nInstalling a Plugin\n \nThere are three primary ways to install a plugin:\nA plugin can be installed dynamically with an SQL statement.\nA plugin can be installed with a mysqld option, but it\nrequires a server restart.\nA plugin can be installed with the mysql_plugin utility,\nwhile the server is completely offline.\n \nWhen you are installing a plugin, you also have to ensure\nthat:\nThe server\'s plugin directory is properly configured, and\nthe plugin\'s library is in the plugin directory.\nThe server\'s minimum plugin maturity is properly\nconfigured, and the plugin is mature enough to be installed.\n \nInstalling a Plugin Dynamically\n \nA plugin can be installed dynamically by executing either\nthe INSTALL SONAME or the INSTALL PLUGIN statement.\n \nIf a plugin is installed with one of these statements, then\na record will be added to the mysql.plugins table for the\nplugin. This means that the plugin will automatically be\nloaded every time the server restarts, unless specifically\nuninstalled or deactivated.\n \nInstalling a Plugin with INSTALL SONAME\n \nYou can install a plugin dynamically by executing the\nINSTALL SONAME statement. INSTALL SONAME installs all\nplugins from the given plugin library. This could be\nrequired for some plugin libraries.\n \nFor example, to install all plugins in the server_audit\nplugin library (which is currently only the server_audit\naudit plugin), you could execute the following:\n \nINSTALL SONAME \'server_audit\';\n \nInstalling a Plugin with INSTALL PLUGIN\n \nYou can install a plugin dynamically by executing the\nINSTALL PLUGIN statement. INSTALL PLUGIN installs a single\nplugin from the given plugin library.\n \nFor example, to install the server_audit audit plugin from\nthe server_audit plugin library, you could execute the\nfollowing:\n \nINSTALL PLUGIN server_audit SONAME \'server_audit\';\n \nInstalling a Plugin with Plugin Load Options\n \nA plugin can be installed with a mysqld option by providing\neither the --plugin-load-add or the --plugin-load option.\n \nIf a plugin is installed with one of these options, then a\nrecord will not be added to the mysql.plugins table for the\nplugin. This means that if the server is restarted without\nthe same option set, then the plugin will not automatically\nbe loaded.\n \nInstalling a Plugin with --plugin-load-add\n \nYou can install a plugin with the --plugin-load-add option\nby specifying the option as a command-line argument to\nmysqld or by specifying the option in a relevant server\noption group in an option file.\n \nThe --plugin-load-add option uses the following format:\nPlugins can be specified in the format name=library, where\nname is the plugin name and library is the plugin library.\nThis format installs a single plugin from the given plugin\nlibrary.\nPlugins can also be specified in the format library, where\nlibrary is the plugin library. This format installs all\nplugins from the given plugin library.\nMultiple plugins can be specified by separating them with\nsemicolons.\n \nFor example, to install all plugins in the server_audit\nplugin library (which is currently only the server_audit\naudit plugin) and also the ed25519 authentication plugin\nfrom the auth_ed25519 plugin library, you could set the\noption to the following values on the command-line:\n \n$ mysqld --user=mysql --plugin-load-add=\'server_audit\'\n--plugin-load-add=\'ed25519=auth_ed25519\'\n \nYou could also set the option to the same values in an\noption file:\n \n[mariadb]\n...\nplugin_load_add = server_audit\nplugin_load_add = ed25519=auth_ed25519\n \nSpecial care must be taken when specifying both the\n--plugin-load option and the --plugin-load-add option\ntogether. The --plugin-load option resets the plugin load\nlist, and this can cause unexpected problems if you are not\naware. The --plugin-load-add option does not reset the\nplugin load list, so it is much safer to use. See Specifying\nMultiple Plugin Load Options for more information.\n \nInstalling a Plugin with --plugin-load\n \nYou can install a plugin with the --plugin-load option by\nspecifying the option as a command-line argument to mysqld\nor by specifying the option in a relevant server option\ngroup in an option file.\n \nThe --plugin-load option uses the following format:\nPlugins can be specified in the format name=library, where\nname is the plugin name and library is the plugin library.\nThis format installs a single plugin from the given plugin\nlibrary.\nPlugins can also be specified in the format library, where\nlibrary is the plugin library. This format installs all\nplugins from the given plugin library.\nMultiple plugins can be specified by separating them with\nsemicolons.\n \nFor example, to install all plugins in the server_audit\nplugin library (which is currently only the server_audit\naudit plugin) and also the ed25519 authentication plugin\nfrom the auth_ed25519 plugin library, you could set the\noption to the following values on the command-line:\n \n$ mysqld --user=mysql\n--plugin-load=\'server_audit;ed25519=auth_ed25519\'\n \nYou could also set the option to the same values in an\noption file:\n \n[mariadb]\n...\nplugin_load = server_audit;ed25519=auth_ed25519\n \nSpecial care must be taken when specifying the --plugin-load\noption multiple times, or when specifying both the\n--plugin-load option and the --plugin-load-add option\ntogether. The --plugin-load option resets the plugin load\nlist, and this can cause unexpected problems if you are not\naware. The --plugin-load-add option does not reset the\nplugin load list, so it is much safer to use. See Specifying\nMultiple Plugin Load Options for more information.\n \nSpecifying Multiple Plugin Load Options\n \nSpecial care must be taken when specifying the --plugin-load\noption multiple times, or when specifying both the\n--plugin-load option and the --plugin-load-add option. The\n--plugin-load option resets the plugin load list, and this\ncan cause unexpected problems if you are not aware. The\n--plugin-load-add option does not reset the plugin load\nlist, so it is much safer to use.\n \nThis can have the following consequences:\nIf the --plugin-load option is specified multiple times,\nthen only the last instance will have any effect. For\nexample, in the following case, the first instance of the\noption is reset:\n \n[mariadb]\n...\nplugin_load = server_audit\nplugin_load = ed25519=auth_ed25519\nIf the --plugin-load option is specified after the\n--plugin-load-add option, then it will also reset the\nchanges made by that option. For example, in the following\ncase, the --plugin-load-add option does not do anything,\nbecause the subsequent --plugin-load option resets the\nplugin load list:\n \n[mariadb]\n...\nplugin_load_add = server_audit\nplugin_load = ed25519=auth_ed25519\nIn contrast, if the --plugin-load option is specified before\nthe --plugin-load-add option, then it will work fine,\nbecause the --plugin-load-add option does not reset the\nplugin load list. For example, in the following case, both\nplugins are properly loaded:\n \n[mariadb]\n...\nplugin_load = server_audit\nplugin_load_add = ed25519=auth_ed25519\n \nInstalling a Plugin with mysql_plugin\n \nA plugin can be installed with the mysql_plugin utility if\nthe server is completely offline. \n \nThe syntax is:\n \nmysql_plugin [options] \n ENABLE|DISABLE\n \nFor example, to install the server_audit audit plugin, you\ncould execute the following:\n \nmysql_plugin server_audit ENABLE\n \nIf a plugin is installed with this utility, then a record\nwill be added to the mysql.plugins table for the plugin.\nThis means that the plugin will automatically be loaded\nevery time the server restarts, unless specifically\nuninstalled or deactivated.\n \nConfiguring the Plugin Directory\n \nWhen a plugin is being installed, the server looks for the\nplugin\'s library in the server\'s plugin directory. This\ndirectory is configured by the plugin_dir system variable.\nThis can be specified as a command-line argument to mysqld\nor it can be specified in a relevant server option group in\nan option file. For example:\n \n[mariadb]\n...\nplugin_dir = /usr/lib64/mysql/plugin\n \nConfiguring the Minimum Plugin Maturity\n \nWhen a plugin is being installed, the server compares the\nplugin\'s maturity level against the server\'s minimum\nallowed plugin maturity. This can help prevent users from\nusing unstable plugins on production servers. This minimum\nplugin maturity is configured by the plugin_maturity system\nvariable. This can be specified as a command-line argument\nto mysqld or it can be specified in a relevant server option\ngroup in an option file. For example:\n \n[mariadb]\n...\nplugin_maturity = stable\n \nConfiguring Plugin Activation at Server Startup\n \nA plugin will be loaded by default when the server starts\nif:\nThe plugin was installed with the INSTALL SONAME statement.\nThe plugin was installed with the INSTALL PLUGIN statement.\nThe plugin was installed with the mysql_plugin utility.\nThe server is configured to load the plugin with the\n--plugin-load-add option.\nThe server is configured to load the plugin with the\n--plugin-load option.\n \nThis behavior can be changed with special options that take\nthe form --plugin-name. For example, for the server_audit\naudit plugin, the special option is called --server-audit.\n \nThe possible values for these special options are:\n \nOption Value | Description | \n \nOFF | Disables the plugin without removing it from the\nmysql.plugins table. | \n \nON | Enables the plugin. If the plugin cannot be\ninitialized, then the server will still continue starting\nup, but the plugin will be disabled. | \n \nFORCE | Enables the plugin. If the plugin cannot be\ninitialized, then the server will fail to start with an\nerror. | \n \nFORCE_PLUS_PERMANENT | Enables the plugin. If the plugin\ncannot be initialized, then the server will fail to start\nwith an error. In addition, the plugin cannot be uninstalled\nwith UNINSTALL SONAME or UNINSTALL PLUGIN while the server\nis running. | \n \nA plugin\'s status can be found by looking at the\nPLUGIN_STATUS column of the information_schema.PLUGINS\ntable.\n \nUninstalling Plugins\n \nPlugins that are found in the mysql.plugin table, that is\nthose that were installed with INSTALL SONAME, INSTALL\nPLUGIN or mysql_plugin can be uninstalled in one of two\nways:\nThe UNINSTALL SONAME or the UNINSTALL PLUGIN statement while\nthe server is running\nWith mysql_plugin while the server is offline.\n \nPlugins that were enabled as a --plugin-load option do not\nneed to be uninstalled. If --plugin-load is omitted the next\ntime the server starts, or the plugin is not listed as one\nof the --plugin-load entries, the plugin will not be loaded.\n \nUNINSTALL PLUGIN uninstalls a single installed plugin, while\nUNINSTALL SONAME uninstalls all plugins belonging to a given\nlibrary.\n \n\n\nURL: https://mariadb.com/kb/en/library/plugin-overview/','','https://mariadb.com/kb/en/library/plugin-overview/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (79,5,'INSTALL PLUGIN','Syntax\n------ \nINSTALL PLUGIN [IF NOT EXISTS] plugin_name SONAME\n\'plugin_library\'\n \nDescription\n----------- \nThis statement installs an individual plugin from the\nspecified library. To install the whole library (which could\nbe required), use INSTALL SONAME.\n \nplugin_name is the name of the plugin as defined in the\nplugin declaration structure contained in the library file.\nPlugin names are\nnot case sensitive. For maximal compatibility, plugin names\nshould be limited\nto ASCII letters, digits, and underscore, because they are\nused in C source\nfiles, shell command lines, M4 and Bourne shell scripts, and\nSQL environments.\n \nplugin_library is the name of the shared library that\ncontains the plugin code. Before MariaDB 5.5.21, the name\nshould include the file name extension (for\nexample, libmyplugin.so or libmyplugin.dll). Starting from\nMariaDB 5.5.21, the file name extension can be omitted\n(which makes the statement look the same on all\narchitectures).\n \nThe shared library must be located in the plugin directory\n(that is,\nthe directory named by the plugin_dir system variable). The\nlibrary must be in the plugin directory itself, not in a\nsubdirectory. By\ndefault, plugin_dir is plugin directory under the directory\nnamed by\nthe pkglibdir configuration variable, but it can be changed\nby setting\nthe value of plugin_dir at server startup. For example, set\nits value in a my.cnf file:\n \n[mysqld]\nplugin_dir=/path/to/plugin/directory\nIf the value of plugin_dir is a relative path name, it is\ntaken to be relative to the MySQL base directory (the value\nof the basedir\nsystem variable).\n \nINSTALL PLUGIN adds a line to the mysql.plugin table that\ndescribes the plugin. This table contains the plugin name\nand library file\nname.\n \nINSTALL PLUGIN causes the server to read\noption (my.cnf) files just as during server startup. This\nenables the plugin to\npick up any relevant options from those files. It is\npossible to add plugin\noptions to an option file even before loading a plugin (if\nthe loose prefix is\nused). It is also possible to uninstall a plugin, edit\nmy.cnf, and install the\nplugin again. Restarting the plugin this way enables it to\nthe new option\nvalues without a server restart.\n \nBefore MySQL 5.1.33, a plugin was started with each option\nset to its\ndefault value.\n \nINSTALL PLUGIN also loads and initializes the plugin code to\nmake the plugin available for use. A plugin is initialized\nby executing its\ninitialization function, which handles any setup that the\nplugin must perform\nbefore it can be used.\n \nTo use INSTALL PLUGIN, you must have the\nINSERT privilege for the mysql.plugin table.\n \nAt server startup, the server loads and initializes any\nplugin that is\nlisted in the mysql.plugin table. This means that a plugin\nis installed\nwith INSTALL PLUGIN only once, not every time the server\nstarts. Plugin loading at startup does not occur if the\nserver is started with\nthe --skip-grant-tables option.\n \nWhen the server shuts down, it executes the deinitialization\nfunction\nfor each plugin that is loaded so that the plugin has a\nchance to\nperform any final cleanup.\n \nIf you need to load plugins for a single server startup when\nthe\n--skip-grant-tables option is given (which tells the server\nnot to read system tables), use the \n--plugin-load mysqld option.\n \nIF NOT EXISTS\n \nWhen the IF NOT EXISTS clause is used, MariaDB will return a\nnote instead of an error if the specified plugin already\nexists. See SHOW WARNINGS.\n \nExamples\n-------- \nINSTALL PLUGIN sphinx SONAME \'ha_sphinx.so\';\n \nStarting from MariaDB 5.5.21, the extension can be omitted:\n \nINSTALL PLUGIN innodb SONAME \'ha_xtradb\';\n \nFrom MariaDB 10.4.0:\n \nINSTALL PLUGIN IF NOT EXISTS example SONAME \'ha_example\';\n \nQuery OK, 0 rows affected (0.104 sec)\n \nINSTALL PLUGIN IF NOT EXISTS example SONAME \'ha_example\';\n \nQuery OK, 0 rows affected, 1 warning (0.000 sec)\n \nSHOW WARNINGS;\n \n+-------+------+------------------------------------+\n| Level | Code | Message |\n+-------+------+------------------------------------+\n| Note | 1968 | Plugin \'example\' already installed |\n+-------+------+------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/install-plugin/','','https://mariadb.com/kb/en/library/install-plugin/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (80,5,'UNINSTALL PLUGIN','Syntax\n------ \nUNINSTALL PLUGIN [IF EXISTS] plugin_name\n \nDescription\n----------- \nThis statement removes a single installed plugin. To\nuninstall the whole library which contains the plugin, use\nUNINSTALL SONAME. You cannot uninstall a plugin if any table\nthat uses it is open.\n \nplugin_name must be the name of some plugin that is listed\nin the mysql.plugin table. The server executes the plugin\'s\ndeinitialization\nfunction and removes the row for the plugin from the\nmysql.plugin\ntable, so that subsequent server restarts will not load and\ninitialize\nthe plugin. UNINSTALL PLUGIN does not remove the plugin\'s\nshared library file.\n \nTo use UNINSTALL PLUGIN, you must have the\nDELETE privilege for the mysql.plugin table.\n \nIF EXISTS\n \nIf the IF EXISTS clause is used, MariaDB will return a note\ninstead of an error if the plugin does not exist. See SHOW\nWARNINGS.\n \nExamples\n-------- \nUNINSTALL PLUGIN example;\n \nFrom MariaDB 10.4.0:\n \nUNINSTALL PLUGIN IF EXISTS example;\n \nQuery OK, 0 rows affected (0.099 sec)\n \nUNINSTALL PLUGIN IF EXISTS example;\n \nQuery OK, 0 rows affected, 1 warning (0.000 sec)\n \nSHOW WARNINGS;\n \n+-------+------+-------------------------------+\n| Level | Code | Message |\n+-------+------+-------------------------------+\n| Note | 1305 | PLUGIN example does not exist |\n+-------+------+-------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/uninstall-plugin/','','https://mariadb.com/kb/en/library/uninstall-plugin/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (81,5,'INSTALL SONAME','INSTALL SONAME has been supported since MariaDB 5.5.21.\n \nSyntax\n------ \nINSTALL SONAME \'plugin_library\'\n \nDescription\n----------- \nThis statement is a variant of INSTALL PLUGIN. It installs\nall plugins from a given plugin_library. See INSTALL PLUGIN\nfor details.\n \nplugin_library is the name of the shared library that\ncontains the plugin code. The file name extension (for\nexample, libmyplugin.so or libmyplugin.dll) can be omitted\n(which makes the statement look the same on all\narchitectures).\n \nThe shared library must be located in the plugin directory\n(that is,\nthe directory named by the plugin_dir system variable). The\nlibrary must be in the plugin directory itself, not in a\nsubdirectory. By\ndefault, plugin_dir is plugin directory under the directory\nnamed by\nthe pkglibdir configuration variable, but it can be changed\nby setting\nthe value of plugin_dir at server startup. For example, set\nits value in a my.cnf file:\n \n[mysqld]\nplugin_dir=/path/to/plugin/directory\nIf the value of plugin_dir is a relative path name, it is\ntaken to be relative to the MySQL base directory (the value\nof the basedir\nsystem variable).\n \nINSTALL SONAME adds one or more lines to the mysql.plugin\ntable that\ndescribes the plugin. This table contains the plugin name\nand library file\nname.\n \nINSTALL SONAME causes the server to read\noption (my.cnf) files just as during server startup. This\nenables the plugin to\npick up any relevant options from those files. It is\npossible to add plugin\noptions to an option file even before loading a plugin (if\nthe loose prefix is\nused). It is also possible to uninstall a plugin, edit\nmy.cnf, and install the\nplugin again. Restarting the plugin this way enables it to\nthe new option\nvalues without a server restart.\n \nINSTALL SONAME also loads and initializes the plugin code to\nmake the plugin available for use. A plugin is initialized\nby executing its\ninitialization function, which handles any setup that the\nplugin must perform\nbefore it can be used.\n \nTo use INSTALL SONAME, you must have the\nINSERT privilege for the mysql.plugin table.\n \nAt server startup, the server loads and initializes any\nplugin that is\nlisted in the mysql.plugin table. This means that a plugin\nis installed\nwith INSTALL SONAME only once, not every time the server\nstarts. Plugin loading at startup does not occur if the\nserver is started with\nthe --skip-grant-tables option.\n \nWhen the server shuts down, it executes the deinitialization\nfunction\nfor each plugin that is loaded so that the plugin has a\nchance to\nperform any final cleanup.\n \nIf you need to load plugins for a single server startup when\nthe\n--skip-grant-tables option is given (which tells the server\nnot to read system tables), use the \n--plugin-load mysqld option.\n \nIf you need to install only one plugin from a library, use\nthe INSTALL PLUGIN statement.\n \nExamples\n-------- \nTo load the XtraDB storage engine and all of its\ninformation_schema tables with one statement, use\n \nINSTALL SONAME \'ha_xtradb\';\n \nThis statement can be used instead of INSTALL PLUGIN even\nwhen the library contains only one plugin:\n \nINSTALL SONAME \'ha_sequence\';\n \n\n\nURL: https://mariadb.com/kb/en/library/install-soname/','','https://mariadb.com/kb/en/library/install-soname/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (82,5,'UNINSTALL SONAME','UNINSTALL SONAMEhas been supported since MariaDB 5.5.21.\n \nSyntax\n------ \nUNINSTALL SONAME [IF EXISTS] \'plugin_library\'\n \nDescription\n----------- \nThis statement is a variant of UNINSTALL PLUGIN statement,\nthat removes all plugins belonging to a specified\nplugin_library. See UNINSTALL PLUGIN for details.\n \nplugin_library is the name of the shared library that\ncontains the plugin code. The file name extension (for\nexample, libmyplugin.so or libmyplugin.dll) can be omitted\n(which makes the statement look the same on all\narchitectures).\n \nTo use UNINSTALL SONAME, you must have the\nDELETE privilege for the mysql.plugin table.\n \nIF EXISTS\n \nIf the IF EXISTS clause is used, MariaDB will return a note\ninstead of an error if the plugin library does not exist.\nSee SHOW WARNINGS.\n \nExamples\n-------- \nTo uninstall the XtraDB plugin and all of its\ninformation_schema tables with one statement, use\n \nUNINSTALL SONAME \'ha_xtradb\';\n \nFrom MariaDB 10.4.0:\n \nUNINSTALL SONAME IF EXISTS \'ha_example\';\n \nQuery OK, 0 rows affected (0.099 sec)\n \nUNINSTALL SONAME IF EXISTS \'ha_example\';\n \nQuery OK, 0 rows affected, 1 warning (0.000 sec)\n \nSHOW WARNINGS;\n \n+-------+------+-------------------------------------+\n| Level | Code | Message |\n+-------+------+-------------------------------------+\n| Note | 1305 | SONAME ha_example.so does not exist |\n+-------+------+-------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/uninstall-soname/','','https://mariadb.com/kb/en/library/uninstall-soname/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (83,6,'MBR Definition','Description\n----------- \nThe MBR (Minimum Bounding Rectangle), or Envelope is the\nbounding\ngeometry, formed by the minimum and maximum (X,Y)\ncoordinates:\n \nExamples\n-------- \n((MINX MINY, MAXX MINY, MAXX MAXY, MINX MAXY, MINX MINY))\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/mbr-definition/','','https://mariadb.com/kb/en/library/mbr-definition/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (84,6,'MBRContains','Syntax\n------ \nMBRContains(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether the Minimum Bounding\nRectangle of\ng1 contains the Minimum Bounding Rectangle of g2. This tests\nthe\nopposite relationship as MBRWithin().\n \nExamples\n-------- \nSET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\n \nSET @g2 = GeomFromText(\'Point(1 1)\');\n \nSELECT MBRContains(@g1,@g2), MBRContains(@g2,@g1);\n+----------------------+----------------------+\n| MBRContains(@g1,@g2) | MBRContains(@g2,@g1) |\n+----------------------+----------------------+\n| 1 | 0 |\n+----------------------+----------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/mbrcontains/','','https://mariadb.com/kb/en/library/mbrcontains/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (85,6,'MBRDisjoint','Syntax\n------ \nMBRDisjoint(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether the Minimum Bounding\nRectangles of the two geometries g1 and g2 are disjoint. Two\ngeometries are disjoint if they do not intersect, that is\ntouch or overlap.\n \nExamples\n-------- \nSET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((4 4,4 7,7 7,7 4,4 4))\');\nSELECTmbrdisjoint(@g1,@g2);\n+----------------------+\n| mbrdisjoint(@g1,@g2) |\n+----------------------+\n| 1 |\n+----------------------+\n \nSET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((3 3,3 6,6 6,6 3,3 3))\');\nSELECT mbrdisjoint(@g1,@g2);\n+----------------------+\n| mbrdisjoint(@g1,@g2) |\n+----------------------+\n| 0 |\n+----------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/mbrdisjoint/','','https://mariadb.com/kb/en/library/mbrdisjoint/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (86,6,'MBREqual','Syntax\n------ \nMBREqual(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether the Minimum Bounding\nRectangles of\nthe two geometries g1 and g2 are the same.\n \nExamples\n-------- \nSET @g1=GEOMFROMTEXT(\'LINESTRING(0 0, 1 2)\');\nSET @g2=GEOMFROMTEXT(\'POLYGON((0 0, 0 2, 1 2, 1 0, 0\n0))\');\nSELECT MbrEqual(@g1,@g2);\n+-------------------+\n| MbrEqual(@g1,@g2) |\n+-------------------+\n| 1 |\n+-------------------+\n \nSET @g1=GEOMFROMTEXT(\'LINESTRING(0 0, 1 3)\');\nSET @g2=GEOMFROMTEXT(\'POLYGON((0 0, 0 2, 1 4, 1 0, 0\n0))\');\nSELECT MbrEqual(@g1,@g2);\n+-------------------+\n| MbrEqual(@g1,@g2) |\n+-------------------+\n| 0 |\n+-------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/mbrequal/','','https://mariadb.com/kb/en/library/mbrequal/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (87,6,'MBRIntersects','Syntax\n------ \nMBRIntersects(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether the Minimum Bounding\nRectangles of the two geometries g1 and g2 intersect.\n \nExamples\n-------- \nSET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((3 3,3 6,6 6,6 3,3 3))\');\nSELECT mbrintersects(@g1,@g2);\n+------------------------+\n| mbrintersects(@g1,@g2) |\n+------------------------+\n| 1 |\n+------------------------+\n \nSET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((4 4,4 7,7 7,7 4,4 4))\');\nSELECT mbrintersects(@g1,@g2);\n+------------------------+\n| mbrintersects(@g1,@g2) |\n+------------------------+\n| 0 |\n+------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/mbrintersects/','','https://mariadb.com/kb/en/library/mbrintersects/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (88,6,'MBROverlaps','Syntax\n------ \nMBROverlaps(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether the Minimum Bounding\nRectangles of\nthe two geometries g1 and g2 overlap. The term spatially\noverlaps is\nused if two geometries intersect and their intersection\nresults in a\ngeometry of the same dimension but not equal to either of\nthe given\ngeometries.\n \nExamples\n-------- \nSET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((4 4,4 7,7 7,7 4,4 4))\');\nSELECT mbroverlaps(@g1,@g2);\n+----------------------+\n| mbroverlaps(@g1,@g2) |\n+----------------------+\n| 0 |\n+----------------------+\n \nSET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((3 3,3 6,6 6,6 3,3 3))\');\nSELECT mbroverlaps(@g1,@g2);\n+----------------------+\n| mbroverlaps(@g1,@g2) |\n+----------------------+\n| 0 |\n+----------------------+\n \nSET @g1 = GeomFromText(\'Polygon((0 0,0 4,4 4,4 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((3 3,3 6,6 6,6 3,3 3))\');\nSELECT mbroverlaps(@g1,@g2);\n+----------------------+\n| mbroverlaps(@g1,@g2) |\n+----------------------+\n| 1 |\n+----------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/mbroverlaps/','','https://mariadb.com/kb/en/library/mbroverlaps/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (89,6,'MBRTouches','Syntax\n------ \nMBRTouches(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether the Minimum Bounding\nRectangles of\nthe two geometries g1 and g2 touch. Two geometries spatially\ntouch if\nthe interiors of the geometries do not intersect, but the\nboundary of\none of the geometries intersects either the boundary or the\ninterior\nof the other.\n \nExamples\n-------- \nSET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((4 4,4 7,7 7,7 4,4 4))\');\nSELECT mbrtouches(@g1,@g2);\n+---------------------+\n| mbrtouches(@g1,@g2) |\n+---------------------+\n| 0 |\n+---------------------+\n \nSET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((3 3,3 6,6 6,6 3,3 3))\');\nSELECT mbrtouches(@g1,@g2);\n+---------------------+\n| mbrtouches(@g1,@g2) |\n+---------------------+\n| 1 |\n+---------------------+\n \nSET @g1 = GeomFromText(\'Polygon((0 0,0 4,4 4,4 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((3 3,3 6,6 6,6 3,3 3))\');\nSELECT mbrtouches(@g1,@g2);\n+---------------------+\n| mbrtouches(@g1,@g2) |\n+---------------------+\n| 0 |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/mbrtouches/','','https://mariadb.com/kb/en/library/mbrtouches/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (90,6,'MBRWithin','Syntax\n------ \nMBRWithin(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether the Minimum Bounding\nRectangle of\ng1 is within the Minimum Bounding Rectangle of g2. This\ntests the\nopposite relationship as MBRContains().\n \nExamples\n-------- \nSET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((0 0,0 5,5 5,5 0,0 0))\');\nSELECT MBRWithin(@g1,@g2), MBRWithin(@g2,@g1);\n+--------------------+--------------------+\n| MBRWithin(@g1,@g2) | MBRWithin(@g2,@g1) |\n+--------------------+--------------------+\n| 1 | 0 |\n+--------------------+--------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/mbrwithin/','','https://mariadb.com/kb/en/library/mbrwithin/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (91,7,'CASE OPERATOR','Syntax\n------ \nCASE value WHEN [compare_value] THEN result [WHEN\n[compare_value] THEN\nresult ...] [ELSE result] END\n \nCASE WHEN [condition] THEN result [WHEN [condition] THEN\nresult ...]\n[ELSE result] END\n \nDescription\n----------- \nThe first version returns the result where\nvalue=compare_value. The\nsecond version returns the result for the first condition\nthat is\ntrue. If there was no matching result value, the result\nafter ELSE is\nreturned, or NULL if there is no ELSE part.\n \nThere is also a CASE statement, which differs from the CASE\noperator described here.\n \nExamples\n-------- \nSELECT CASE 1 WHEN 1 THEN \'one\' WHEN 2 THEN \'two\' ELSE\n\'more\' END;\n \n+------------------------------------------------------------+\n| CASE 1 WHEN 1 THEN \'one\' WHEN 2 THEN \'two\' ELSE\n\'more\' END |\n+------------------------------------------------------------+\n| one |\n+------------------------------------------------------------+\n \nSELECT CASE WHEN 1>0 THEN \'true\' ELSE \'false\' END;\n \n+--------------------------------------------+\n| CASE WHEN 1>0 THEN \'true\' ELSE \'false\' END |\n+--------------------------------------------+\n| true |\n+--------------------------------------------+\n \nSELECT CASE BINARY \'B\' WHEN \'a\' THEN 1 WHEN \'b\' THEN 2\nEND;\n \n+-----------------------------------------------------+\n| CASE BINARY \'B\' WHEN \'a\' THEN 1 WHEN \'b\' THEN 2 END\n|\n+-----------------------------------------------------+\n| NULL |\n+-----------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/case-operator/','','https://mariadb.com/kb/en/library/case-operator/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (92,7,'IF Function','Syntax\n------ \nIF(expr1,expr2,expr3)\n \nDescription\n----------- \nIf expr1 is TRUE (expr1 0 and expr1 NULL) then IF()\nreturns expr2; otherwise it returns expr3. IF() returns a\nnumeric\nor string value, depending on the context in which it is\nused.\n \nNote: There is also an IF statement which differs from the\nIF() function described here.\n \nExamples\n-------- \nSELECT IF(1>2,2,3);\n+-------------+\n| IF(1>2,2,3) |\n+-------------+\n| 3 |\n+-------------+\n \nSELECT IF(1\n\nURL: https://mariadb.com/kb/en/library/if-function/','','https://mariadb.com/kb/en/library/if-function/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (93,7,'IFNULL','Syntax\n------ \nIFNULL(expr1,expr2)\n \nDescription\n----------- \nIf expr1 is not NULL, IFNULL() returns expr1; otherwise it\nreturns\nexpr2. IFNULL() returns a numeric or string value, depending\non the\ncontext in which it is used.\n \nExamples\n-------- \nSELECT IFNULL(1,0); \n+-------------+\n| IFNULL(1,0) |\n+-------------+\n| 1 |\n+-------------+\n \nSELECT IFNULL(NULL,10);\n+-----------------+\n| IFNULL(NULL,10) |\n+-----------------+\n| 10 |\n+-----------------+\n \nSELECT IFNULL(1/0,10);\n+----------------+\n| IFNULL(1/0,10) |\n+----------------+\n| 10.0000 |\n+----------------+\n \nSELECT IFNULL(1/0,\'yes\');\n+-------------------+\n| IFNULL(1/0,\'yes\') |\n+-------------------+\n| yes |\n+-------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/ifnull/','','https://mariadb.com/kb/en/library/ifnull/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (94,7,'NULLIF','Syntax\n------ \nNULLIF(expr1,expr2)\n \nDescription\n----------- \nReturns NULL if expr1 = expr2 is true, otherwise returns\nexpr1. This is\nthe same as CASE WHEN expr1 = expr2 THEN NULL ELSE expr1\nEND.\n \nExamples\n-------- \nSELECT NULLIF(1,1);\n+-------------+\n| NULLIF(1,1) |\n+-------------+\n| NULL |\n+-------------+\n \nSELECT NULLIF(1,2);\n+-------------+\n| NULLIF(1,2) |\n+-------------+\n| 1 |\n+-------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/nullif/','','https://mariadb.com/kb/en/library/nullif/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (95,8,'CHANGE MASTER TO','Syntax\n------ \nCHANGE MASTER [\'connection_name\'] TO master_def [,\nmaster_def] ...\n \nmaster_def:\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_DELAY = interval\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_CRL = \'crl_file_name\'\n | MASTER_SSL_CRLPATH = \'crl_directory_name\'\n | MASTER_SSL_KEY = \'key_file_name\'\n | MASTER_SSL_CIPHER = \'cipher_list\'\n | MASTER_SSL_VERIFY_SERVER_CERT = {0|1}\n | MASTER_USE_GTID = {current_pos|slave_pos|no}\n | IGNORE_SERVER_IDS = (server_id_list)\n | DO_DOMAIN_IDS = ([N,..])\n | IGNORE_DOMAIN_IDS = ([N,..])\n \nDescription\n----------- \nThe CHANGE MASTER statement sets the options that a\nreplication slave uses to connect to and replicate from a\nreplication master. \n \nMariaDB until 10.0.7\n \nIn MariaDB 10.0.7 and before, the relay_log_purge system\nvariable was silently set to 0 when CHANGE MASTER was\nexecuted.\n \nMulti-Source Replication\n \nMulti-source replication was added in MariaDB 10.0.1.\n \nIf you are using multi-source replication, then you need to\nspecify a connection name when you execute CHANGE MASTER.\nThere are two ways to do this:\nSetting the default_master_connection system variable prior\nto executing CHANGE MASTER.\nSetting the connection_name parameter when executing CHANGE\nMASTER.\n \ndefault_master_connection\n \nSET default_master_connection = \'gandalf\';\n \nSTOP SLAVE;\n \nCHANGE MASTER TO \n MASTER_PASSWORD=\'new3cret\';\n \nSTART SLAVE;\n \nconnection_name\n \nSTOP SLAVE \'gandalf\';\n \nCHANGE MASTER \'gandalf\' TO \n MASTER_PASSWORD=\'new3cret\';\n \nSTART SLAVE \'gandalf\';\n \nOptions\n \nConnection Options\n \nMASTER_USER\n \nThe MASTER_USER option for CHANGE MASTER defines the user\naccount that the replication slave will use to connect to\nthe replication master.\n \nThis user account will need the REPLICATION SLAVE privilege\non the master.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_USER=\'repl\',\n MASTER_PASSWORD=\'new3cret\';\n \nSTART SLAVE;\n \nMASTER_PASSWORD\n \nThe MASTER_USER option for CHANGE MASTER defines the\npassword that the replication slave will use to connect to\nthe replication master as the user account defined by the\nMASTER_USER option.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO \n MASTER_PASSWORD=\'new3cret\';\n \nSTART SLAVE;\n \nMASTER_HOST\n \nThe MASTER_HOST option for CHANGE MASTER defines the\nhostname or IP address of the replication master.\n \nIf you set the value of the MASTER_HOST option to the empty\nstring, then that is not the same as not setting the\noption\'s value at all. In MariaDB 5.5 and later, if you set\nthe value of the MASTER_HOST option to the empty string,\nthen the CHANGE MASTER command will fail with an error. In\nMariaDB 5.3 and before, if you set the value of the\nMASTER_HOST option to the empty string, then the CHANGE\nMASTER command would succeed, but the subsequent START SLAVE\ncommand would fail.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_HOST=\'dbserver1.example.com\',\n MASTER_USER=\'repl\',\n MASTER_PASSWORD=\'new3cret\',\n MASTER_USE_GTID=slave_pos;\n \nSTART SLAVE;\n \nIf you set the value of the MASTER_HOST option in a CHANGE\nMASTER command, then the slave assumes that the master is\ndifferent from before, even if you set the value of this\noption to the same value it had previously. In this\nscenario, the slave will consider the old values for the\nmaster\'s binary\nlog file name and position to be invalid for the new master.\nAs a side effect, if you do not explicitly set the values of\nthe MASTER_LOG_FILE and MASTER_LOG_POS options in the\nstatement, then the statement will be implicitly appended\nwith MASTER_LOG_FILE=\'\' and MASTER_LOG_POS=4. However, if\nyou enable GTID mode for replication by setting the\nMASTER_USE_GTID option to some value other than no in the\nstatement, then these values will effectively be ignored\nanyway.\n \nReplication slaves cannot connect to replication masters\nusing Unix socket files or Windows named pipes. The\nreplication slave must connect to the replication master\nusing TCP/IP.\n \nMASTER_PORT\n \nThe MASTER_PORT option for CHANGE MASTER defines the TCP/IP\nport of the replication master.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_HOST=\'dbserver1.example.com\',\n MASTER_PORT=3307,\n MASTER_USER=\'repl\',\n MASTER_PASSWORD=\'new3cret\',\n MASTER_USE_GTID=slave_pos;\n \nSTART SLAVE;\n \nIf you set the value of the MASTER_PORT option in a CHANGE\nMASTER command, then the slave assumes that the master is\ndifferent from before, even if you set the value of this\noption to the same value it had previously. In this\nscenario, the slave will consider the old values for the\nmaster\'s binary\nlog file name and position to be invalid for the new master.\nAs a side effect, if you do not explicitly set the values of\nthe MASTER_LOG_FILE and MASTER_LOG_POS options in the\nstatement, then the statement will be implicitly appended\nwith MASTER_LOG_FILE=\'\' and MASTER_LOG_POS=4. However, if\nyou enable GTID mode for replication by setting the\nMASTER_USE_GTID option to some value other than no in the\nstatement, then these values will effectively be ignored\nanyway.\n \nReplication slaves cannot connect to replication masters\nusing Unix socket files or Windows named pipes. The\nreplication slave must connect to the replication master\nusing TCP/IP.\n \nMASTER_CONNECT_RETRY\n \nThe MASTER_CONNECT_RETRY option for CHANGE MASTER defines\nhow many seconds that the slave will wait between connection\nretries. The default is 60.\n \nSTOP SLAVE;\n \nCHANGE MASTER TO \n MASTER_CONNECT_RETRY=20;\n \nSTART SLAVE;\n \nThe number of connection attempts is limited by the\nmaster_retry_count option. It can be set either on the\ncommand-line or in a server option group in an option file\nprior to starting up the server. For example:\n \n[mariadb]\n...\nmaster_retry_count=4294967295\n \nMASTER_BIND\n \nThe MASTER_BIND option for CHANGE MASTER is only supported\nby MySQL 5.6.2 and later and by MySQL NDB Cluster 7.3.1 and\nlater. This option is not yet supported by MariaDB. See\nMDEV-19248 for more information.\n \nThe MASTER_BIND option for CHANGE MASTER can be used on\nreplication slaves that have multiple network interfaces to\nchoose which network interface the slave will use to connect\nto the master.\n \nMASTER_HEARTBEAT_PERIOD\n \nThe MASTER_HEARTBEAT_PERIOD option for CHANGE MASTER can be\nused to set the interval in seconds between replication\nheartbeats. Whenever the master\'s binary log is updated\nwith an event, the waiting period for the next heartbeat is\nreset.\n \nThis option\'s interval argument has the following\ncharacteristics:\nIt is a decimal value with a range of 0 to 4294967 seconds.\nIt has a resolution of hundredths of a second.\nIts smallest valid non-zero value is 0.001.\nIts default value is the value of the slave_net_timeout\nsystem variable divided by 2.\nIf it\'s set to 0, then heartbeats are disabled.\n \nHeartbeats are sent by the master only if there are no\nunsent events in the binary log file for a period longer\nthan the interval.\n \nIf the RESET SLAVE statement is executed, then the heartbeat\ninterval is reset to the default.\n \nIf the slave_net_timeout system variable is set to a value\nthat is lower than the current heartbeat interval, then a\nwarning will be issued.\n \nTLS Options\n \nThe TLS options are used for providing information about\nTLS. The options can be set even on slaves that are compiled\nwithout TLS support. The TLS options are saved to either the\ndefault master.info file or the file that is configured by\nthe master_info_file option, but these TLS options are\nignored unless the slave supports TLS.\n \nSee Replication with Secure Connections for more\ninformation.\n \nMASTER_SSL\n \nThe MASTER_SSL option for CHANGE MASTER tells the slave\nwhether to force TLS for the connection. The valid values\nare 0 or 1.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_SSL=1;\n \nSTART SLAVE;\n \nMASTER_SSL_CA\n \nThe MASTER_SSL_CA option for CHANGE MASTER defines a path to\na PEM file that should contain one or more X509 certificates\nfor trusted Certificate Authorities (CAs) to use for TLS.\nThis option requires that you use the absolute path, not a\nrelative path. This option implies the MASTER_SSL option.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_SSL_CERT=\'/etc/my.cnf.d/certificates/server-cert.pem\',\n MASTER_SSL_KEY=\'/etc/my.cnf.d/certificates/server-key.pem\',\n MASTER_SSL_CA=\'/etc/my.cnf.d/certificates/ca.pem\',\n MASTER_SSL_VERIFY_SERVER_CERT=1;\n \nSTART SLAVE;\n \nSee Secure Connections Overview: Certificate Authorities\n(CAs) for more information.\n \nMASTER_SSL_CAPATH\n \nThe MASTER_SSL_CAPATH option for CHANGE MASTER defines a\npath to a directory that contains one or more PEM files that\nshould each contain one X509 certificate for a trusted\nCertificate Authority (CA) to use for TLS. This option\nrequires that you use the absolute path, not a relative\npath. The directory specified by this option needs to be run\nthrough the openssl rehash command. This option implies the\nMASTER_SSL option.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_SSL_CERT=\'/etc/my.cnf.d/certificates/server-cert.pem\',\n MASTER_SSL_KEY=\'/etc/my.cnf.d/certificates/server-key.pem\',\n MASTER_SSL_CAPATH=\'/etc/my.cnf.d/certificates/ca/\',\n MASTER_SSL_VERIFY_SERVER_CERT=1;\n \nSTART SLAVE;\n \nSee Secure Connections Overview: Certificate Authorities\n(CAs) for more information.\n \nMASTER_SSL_CERT\n \nThe MASTER_SSL_CERT option for CHANGE MASTER defines a path\nto the X509 certificate file to use for TLS. This option\nrequires that you use the absolute path, not a relative\npath. This option implies the MASTER_SSL option.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_SSL_CERT=\'/etc/my.cnf.d/certificates/server-cert.pem\',\n MASTER_SSL_KEY=\'/etc/my.cnf.d/certificates/server-key.pem\',\n MASTER_SSL_CA=\'/etc/my.cnf.d/certificates/ca.pem\',\n MASTER_SSL_VERIFY_SERVER_CERT=1;\n \nSTART SLAVE;\n \nMASTER_SSL_CRL\n \nThe MASTER_SSL_CRL option for CHANGE MASTER defines a path\nto a PEM file that should contain one or more revoked X509\ncertificates to use for TLS. This option requires that you\nuse the absolute path, not a relative path.\n \nThis option is only supported if the server was built with\nOpenSSL. If the server was built with yaSSL, then this\noption is not supported. See TLS and Cryptography Libraries\nUsed by MariaDB for more information about which libraries\nare used on which platforms.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_SSL_CERT=\'/etc/my.cnf.d/certificates/server-cert.pem\',\n MASTER_SSL_KEY=\'/etc/my.cnf.d/certificates/server-key.pem\',\n MASTER_SSL_CA=\'/etc/my.cnf.d/certificates/ca.pem\',\n MASTER_SSL_VERIFY_SERVER_CERT=1,\n MASTER_SSL_CRL=\'/etc/my.cnf.d/certificates/crl.pem\';\n \nSTART SLAVE;\n \nSee Secure Connections Overview: Certificate Revocation\nLists (CRLs) for more information.\n \nMASTER_SSL_CRLPATH\n \nThe MASTER_SSL_CRLPATH option for CHANGE MASTER defines a\npath to a directory that contains one or more PEM files that\nshould each contain one revoked X509 certificate to use for\nTLS. This option requires that you use the absolute path,\nnot a relative path. The directory specified by this\nvariable needs to be run through the openssl rehash command.\n \nThis option is only supported if the server was built with\nOpenSSL. If the server was built with yaSSL, then this\noption is not supported. See TLS and Cryptography Libraries\nUsed by MariaDB for more information about which libraries\nare used on which platforms.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_SSL_CERT=\'/etc/my.cnf.d/certificates/server-cert.pem\',\n MASTER_SSL_KEY=\'/etc/my.cnf.d/certificates/server-key.pem\',\n MASTER_SSL_CA=\'/etc/my.cnf.d/certificates/ca.pem\',\n MASTER_SSL_VERIFY_SERVER_CERT=1,\n MASTER_SSL_CRLPATH=\'/etc/my.cnf.d/certificates/crl/\';\n \nSTART SLAVE;\n \nSee Secure Connections Overview: Certificate Revocation\nLists (CRLs) for more information.\n \nMASTER_SSL_KEY\n \nThe MASTER_SSL_KEY option for CHANGE MASTER defines a path\nto a private key file to use for TLS. This option requires\nthat you use the absolute path, not a relative path. This\noption implies the MASTER_SSL option.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_SSL_CERT=\'/etc/my.cnf.d/certificates/server-cert.pem\',\n MASTER_SSL_KEY=\'/etc/my.cnf.d/certificates/server-key.pem\',\n MASTER_SSL_CA=\'/etc/my.cnf.d/certificates/ca.pem\',\n MASTER_SSL_VERIFY_SERVER_CERT=1;\n \nSTART SLAVE;\n \nMASTER_SSL_CIPHER\n \nThe MASTER_SSL_CIPHER option for CHANGE MASTER defines the\nlist of permitted ciphers or cipher suites to use for TLS.\nBesides cipher names, if MariaDB was compiled with OpenSSL,\nthis option could be set to \"SSLv3\" or \"TLSv1.2\" to\nallow all SSLv3 or all TLSv1.2 ciphers. Note that the\nTLSv1.3 ciphers cannot be excluded when using OpenSSL, even\nby using this option. See Using TLSv1.3 for details. This\noption implies the MASTER_SSL option.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_SSL_CERT=\'/etc/my.cnf.d/certificates/server-cert.pem\',\n MASTER_SSL_KEY=\'/etc/my.cnf.d/certificates/server-key.pem\',\n MASTER_SSL_CA=\'/etc/my.cnf.d/certificates/ca.pem\',\n MASTER_SSL_VERIFY_SERVER_CERT=1,\n MASTER_SSL_CIPHER=\'TLSv1.2\';\n \nSTART SLAVE;\n \nMASTER_SSL_VERIFY_SERVER_CERT\n \nThe MASTER_SSL_VERIFY_SERVER_CERT option for CHANGE MASTER\nenables server certificate verification. This option is\ndisabled by default.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_SSL_CERT=\'/etc/my.cnf.d/certificates/server-cert.pem\',\n MASTER_SSL_KEY=\'/etc/my.cnf.d/certificates/server-key.pem\',\n MASTER_SSL_CA=\'/etc/my.cnf.d/certificates/ca.pem\',\n MASTER_SSL_VERIFY_SERVER_CERT=1;\n \nSTART SLAVE;\n \nSee Secure Connections Overview: Server Certificate\nVerification for more information.\n \nBinary Log Options\n \nThese options are related to the binary log position on the\nmaster.\n \nMASTER_LOG_FILE\n \nThe MASTER_LOG_FILE option for CHANGE MASTER can be used\nalong with MASTER_LOG_POS to specify the coordinates at\nwhich the slave\'s I/O thread should begin reading from the\nmaster\'s binary logs the next time the thread starts.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_LOG_FILE=\'master2-bin.001\',\n MASTER_LOG_POS=4;\n \nSTART SLAVE;\n \nThe MASTER_LOG_FILE and MASTER_LOG_POS options cannot be\nspecified if the RELAY_LOG_FILE and RELAY_LOG_POS options\nwere also specified.\n \nThe MASTER_LOG_FILE and MASTER_LOG_POS options are\neffectively ignored if you enable GTID mode for replication\nby setting the MASTER_USE_GTID option to some value other\nthan no in the statement.\n \nMASTER_LOG_POS\n \nThe MASTER_LOG_POS option for CHANGE MASTER can be used\nalong with MASTER_LOG_FILE to specify the coordinates at\nwhich the slave\'s I/O thread should begin reading from the\nmaster\'s binary logs the next time the thread starts.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_LOG_FILE=\'master2-bin.001\',\n MASTER_LOG_POS=4;\n \nSTART SLAVE;\n \nThe MASTER_LOG_FILE and MASTER_LOG_POS options cannot be\nspecified if the RELAY_LOG_FILE and RELAY_LOG_POS options\nwere also specified.\n \nThe MASTER_LOG_FILE and MASTER_LOG_POS options are\neffectively ignored if you enable GTID mode for replication\nby setting the MASTER_USE_GTID option to some value other\nthan no in the statement.\n \nRelay Log Options\n \nThese options are related to the relay log position on the\nslave.\n \nRELAY_LOG_FILE\n \nThe RELAY_LOG_FILE option for CHANGE MASTER can be used\nalong with the RELAY_LOG_POS option to specify the\ncoordinates at which the slave\'s SQL thread should begin\nreading from the relay log the next time the thread starts.\n \nThe CHANGE MASTER statement usually deletes all relay log\nfiles. However, if the RELAY_LOG_FILE and/or RELAY_LOG_POS\noptions are specified, then existing relay log files are\nkept.\n \nWhen you want to change the relay log position, you only\nneed to stop the slave\'s SQL thread. The slave\'s I/O\nthread can continue running. The STOP SLAVE and START SLAVE\nstatements support the SQL_THREAD option for this scenario.\nFor example:\n \nSTOP SLAVE SQL_THREAD;\n \nCHANGE MASTER TO\n RELAY_LOG_FILE=\'slave-relay-bin.006\',\n RELAY_LOG_POS=4025;\n \nSTART SLAVE SQL_THREAD;\n \nWhen the value of this option is changed, the metadata about\nthe slave\'s SQL thread\'s position in the relay logs will\nalso be changed in the relay-log.info file or the file that\nis configured by the relay_log_info_file system variable.\n \nThe RELAY_LOG_FILE and RELAY_LOG_POS options cannot be\nspecified if the MASTER_LOG_FILE and MASTER_LOG_POS options\nwere also specified.\n \nRELAY_LOG_POS\n \nThe RELAY_LOG_POS option for CHANGE MASTER can be used along\nwith the RELAY_LOG_FILE option to specify the coordinates at\nwhich the slave\'s SQL thread should begin reading from the\nrelay log the next time the thread starts.\n \nThe CHANGE MASTER statement usually deletes all relay log\nfiles. However, if the RELAY_LOG_FILE and/or RELAY_LOG_POS\noptions are specified, then existing relay log files are\nkept.\n \nWhen you want to change the relay log position, you only\nneed to stop the slave\'s SQL thread. The slave\'s I/O\nthread can continue running. The STOP SLAVE and START SLAVE\nstatements support the SQL_THREAD option for this scenario.\nFor example:\n \nSTOP SLAVE SQL_THREAD;\n \nCHANGE MASTER TO\n RELAY_LOG_FILE=\'slave-relay-bin.006\',\n RELAY_LOG_POS=4025;\n \nSTART SLAVE SQL_THREAD;\n \nWhen the value of this option is changed, the metadata about\nthe slave\'s SQL thread\'s position in the relay logs will\nalso be changed in the relay-log.info file or the file that\nis configured by the relay_log_info_file system variable.\n \nThe RELAY_LOG_FILE and RELAY_LOG_POS options cannot be\nspecified if the MASTER_LOG_FILE and MASTER_LOG_POS options\nwere also specified.\n \nGTID Options\n \nMASTER_USE_GTID\n \nThe MASTER_USE_GTID option for CHANGE MASTER was first added\nin MariaDB 10.0.2 to enable replication with Global\nTransaction IDs (GTIDs).\n \nThe MASTER_USE_GTID option for CHANGE MASTER can be used to\nconfigure the slave to use the global transaction ID (GTID)\nwhen connecting to a master. The possible values are:\ncurrent_pos - Replicate in GTID mode and use\ngtid_current_pos as the position to start downloading\ntransactions from the master.\nslave_pos - Replicate in GTID mode and use gtid_slave_pos as\nthe position to start downloading transactions from the\nmaster.\nno - Don\'t replicate in GTID mode.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_USE_GTID = current_pos;\n \nSTART SLAVE;\n \nOr:\n \nSTOP SLAVE;\n \nSET GLOBAL gtid_slave_pos=\'0-1-153\';\n \nCHANGE MASTER TO\n MASTER_USE_GTID = slave','','https://mariadb.com/kb/en/library/change-master-to/');
+update help_topic set description = CONCAT(description, '_pos;\n \nSTART SLAVE;\n \nReplication Filter Options\n \nIGNORE_SERVER_IDS\n \nThe IGNORE_SERVER_IDS option for CHANGE MASTER can be used\nto configure a replication slave to ignore binary log events\nthat originated from certain servers. Filtered binary log\nevents will not get logged to the slave’s relay log, and\nthey will not be applied by the slave.\n \nThe option\'s value can be specified by providing a\ncomma-separated list of server_id values. For example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO \n IGNORE_SERVER_IDS = (3,5);\nSTART SLAVE;\n \nIf you would like to clear a previously set list, then you\ncan set the value to an empty list. For example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO \n IGNORE_SERVER_IDS = ();\nSTART SLAVE;\n \nDO_DOMAIN_IDS\n \nThe DO_DOMAIN_IDS option for CHANGE MASTER was first added\nin MariaDB 10.1.2.\n \nThe DO_DOMAIN_IDS option for CHANGE MASTER can be used to\nconfigure a replication slave to only apply binary log\nevents if the transaction\'s GTID is in a specific\ngtid_domain_id value. Filtered binary log events will not\nget logged to the slave’s relay log, and they will not be\napplied by the slave.\n \nThe option\'s value can be specified by providing a\ncomma-separated list of gtid_domain_id values. Duplicate\nvalues are automatically ignored. For example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO \n DO_DOMAIN_IDS = (1,2);\nSTART SLAVE;\n \nIf you would like to clear a previously set list, then you\ncan set the value to an empty list. For example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO \n DO_DOMAIN_IDS = ();\nSTART SLAVE;\n \nThe DO_DOMAIN_IDS option and the IGNORE_DOMAIN_IDS option\ncannot both be set to non-empty values at the same time. If\nyou want to set the DO_DOMAIN_IDS option, and the\nIGNORE_DOMAIN_IDS option was previously set, then you need\nto clear the value of the IGNORE_DOMAIN_IDS option. For\nexample:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO \n IGNORE_DOMAIN_IDS = (), \n DO_DOMAIN_IDS = (1,2);\nSTART SLAVE;\n \nThe DO_DOMAIN_IDS option can only be specified if the slave\nis replicating in GTID mode. Therefore, the MASTER_USE_GTID\noption must also be set to some value other than no in order\nto use this option.\n \nIGNORE_DOMAIN_IDS\n \nThe IGNORE_DOMAIN_IDS option for CHANGE MASTER was first\nadded in MariaDB 10.1.2.\n \nThe IGNORE_DOMAIN_IDS option for CHANGE MASTER can be used\nto configure a replication slave to ignore binary log events\nif the transaction\'s GTID is in a specific gtid_domain_id\nvalue. Filtered binary log events will not get logged to the\nslave’s relay log, and they will not be applied by the\nslave.\n \nThe option\'s value can be specified by providing a\ncomma-separated list of gtid_domain_id values. Duplicate\nvalues are automatically ignored. For example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO \n IGNORE_DOMAIN_IDS = (1,2);\nSTART SLAVE;\n \nIf you would like to clear a previously set list, then you\ncan set the value to an empty list. For example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO \n IGNORE_DOMAIN_IDS = ();\nSTART SLAVE;\n \nThe DO_DOMAIN_IDS option and the IGNORE_DOMAIN_IDS option\ncannot both be set to non-empty values at the same time. If\nyou want to set the IGNORE_DOMAIN_IDS option, and the\nDO_DOMAIN_IDS option was previously set, then you need to\nclear the value of the DO_DOMAIN_IDS option. For example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO \n DO_DOMAIN_IDS = (), \n IGNORE_DOMAIN_IDS = (1,2);\nSTART SLAVE;\n \nThe IGNORE_DOMAIN_IDS option can only be specified if the\nslave is replicating in GTID mode. Therefore, the\nMASTER_USE_GTID option must also be set to some value other\nthan no in order to use this option.\n \nDelayed Replication Options\n \nMASTER_DELAY\n \nThe MASTER_DELAY option for CHANGE MASTER was first added in\nMariaDB 10.2.3 to enable delayed replication.\n \nThe MASTER_DELAY option for CHANGE MASTER can be used to\nenable delayed replication. This option specifies the time\nin seconds (at least) that a replication slave should lag\nbehind the master. Before executing an event, the slave will\nfirst wait, if necessary, until the given time has passed\nsince the event was created on the master. The result is\nthat the slave will reflect the state of the master some\ntime back in the past. The default is zero, no delay.\n \nSTOP SLAVE;\n \nCHANGE MASTER TO \n MASTER_DELAY=3600;\n \nSTART SLAVE;\n \nChanging Option Values\n \nIf you don\'t specify a given option when executing the\nCHANGE MASTER statement, then the option keeps its old value\nin most cases. Most of the time, there is no need to specify\nthe options that do not need to change. For example, if the\npassword for the user account that the slave uses to connect\nto its master has changed, but no other options need to\nchange, then you can just change the MASTER_PASSWORD option\nby executing the following commands:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO \n MASTER_PASSWORD=\'new3cret\';\n \nSTART SLAVE;\n \nThere are some cases where options are implicitly reset,\nsuch as when the MASTER_HOST and MASTER_PORT options are\nchanged.\n \nOption Persistence\n \nThe values of the MASTER_LOG_FILE and MASTER_LOG_POS options\n(i.e. the binary log position on the master) and most other\noptions are written to either the default master.info file\nor the file that is configured by the master_info_file\noption. The slave\'s I/O thread keeps this binary log\nposition updated as it downloads events only when\nMASTER_USE_GTID option\n is set to NO. Otherwise the file is not updated on a per\nevent basis.\n \nThe master_info_file option can be set either on the\ncommand-line or in a server option group in an option file\nprior to starting up the server. For example:\n \n[mariadb]\n...\nmaster_info_file=/mariadb/myserver1-master.info\n \nThe values of the RELAY_LOG_FILE and RELAY_LOG_POS options\n(i.e. the relay log position) are written to either the\ndefault relay-log.info file or the file that is configured\nby the relay_log_info_file system variable. The slave\'s SQL\nthread keeps this relay log position updated as it applies\nevents.\n \nThe relay_log_info_file system variable can be set either on\nthe command-line or in a server option group in an option\nfile prior to starting up the server. For example:\n \n[mariadb]\n...\nrelay_log_info_file=/mariadb/myserver1-relay-log.info\n \nGTID Persistence\n \nIf the slave is replicating binary log events that contain\nGTIDs, then the slave\'s SQL thread will write every GTID\nthat it applies to the mysql.gtid_slave_pos table. This GTID\ncan be inspected and modified through the gtid_slave_pos\nsystem variable.\n \nIf the slave has the log_slave_updates system variable\nenabled and if the slave has the binary log enabled, then\nevery write by the slave\'s SQL thread will also go into the\nslave\'s binary log. This means that GTIDs of replicated\ntransactions would be reflected in the value of the\ngtid_binlog_pos system variable.\n \nCreating a Slave from a Backup\n \nThe CHANGE MASTER statement is useful for setting up a slave\nwhen you have a backup of the master and you also have the\nbinary log position or GTID position corresponding to the\nbackup.\n \nAfter restoring the backup on the slave, you could execute\nsomething like this to use the binary log position:\n \nCHANGE MASTER TO\n MASTER_LOG_FILE=\'master2-bin.001\',\n MASTER_LOG_POS=4;\n \nSTART SLAVE;\n \nOr you could execute something like this to use the GTID\nposition:\n \nSET GLOBAL gtid_slave_pos=\'0-1-153\';\n \nCHANGE MASTER TO\n MASTER_USE_GTID=slave_pos;\n \nSTART SLAVE;\n \nSee Setting up a Replication Slave with Mariabackup for more\ninformation on how to do this with Mariabackup.\n \nExample\n \nThe following example changes the master and master\'s\nbinary log coordinates.\nThis is used when you want to set up the slave to replicate\nthe 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 \nSTART SLAVE;\n \n\n\nURL: https://mariadb.com/kb/en/library/change-master-to/') WHERE help_topic_id = 95;
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (96,8,'COMMIT','The COMMIT statement ends a transaction, saving any changes\nto the data so that they become visible to subsequent\ntransactions. Also, unlocks metadata changed by current\ntransaction. If autocommit is set to 1, an implicit commit\nis performed after each statement. Otherwise, all\ntransactions which don\'t end with an explicit COMMIT are\nimplicitly rollbacked and the changes are lost. The ROLLBACK\nstatement can be used to do this explicitly.\n \nThe required syntax for the COMMIT statement is as follows:\n \nCOMMIT [WORK] [AND [NO] CHAIN] [[NO] RELEASE]\n \nCOMMIT is the more important transaction terminator, as well\nas the more interesting one. The basic form of the COMMIT\nstatement is simply the keyword COMMIT (the keyword WORK is\nsimply noise and can be omitted without changing the\neffect).\n \nThe optional AND CHAIN clause is a convenience for\ninitiating a new transaction as soon as the old transaction\nterminates. If AND CHAIN is specified, then there is\neffectively nothing between the old and new transactions,\nalthough they remain separate. The characteristics of the\nnew transaction will be the same as the characteristics of\nthe old one — that is, the new transaction will have the\nsame access mode, isolation level and diagnostics area size\n(we\'ll discuss all of these shortly) as the transaction\njust terminated. \n \nRELEASE tells the server to disconnect the client\nimmediately after the current transaction.\n \nThere are NO RELEASE and AND NO CHAIN options. By default,\ncommits do not RELEASE or CHAIN, but it\'s possible to\nchange this default behavior with the completion_type server\nsystem variable. In this case, the AND NO CHAIN and NO\nRELEASE options override the server default.\n \n\n\nURL: https://mariadb.com/kb/en/library/commit/','','https://mariadb.com/kb/en/library/commit/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (97,8,'DEALLOCATE / DROP PREPARE','Syntax\n------ \n{DEALLOCATE | DROP} PREPARE stmt_name\n \nDescription\n----------- \nTo deallocate a prepared statement produced with PREPARE,\nuse a\nDEALLOCATE PREPARE statement that refers to the prepared\nstatement\nname.\n \nA prepared statement is implicitly deallocated when a new\nPREPARE command is issued. In that case, there is no need to\nuse DEALLOCATE.\n \nAttempting to execute a prepared statement after\ndeallocating it\nresults in an error, as if it was not prepared at all:\n \nERROR 1243 (HY000): Unknown prepared statement handler\n(stmt_name) given to EXECUTE\n \nIf the specified statement has not been PREPAREd, an error\nsimilar to the following will be produced:\n \nERROR 1243 (HY000): Unknown prepared statement handler\n(stmt_name) given to DEALLOCATE PREPARE\n \nExample\n \nSee example in PREPARE.\n \n\n\nURL:\nhttps://mariadb.com/kb/en/library/deallocate-drop-prepared-statement/','','https://mariadb.com/kb/en/library/deallocate-drop-prepared-statement/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (98,8,'EXECUTE Statement','Syntax\n------ \nEXECUTE stmt_name\n [USING expression[, expression] ...]\n \nEXECUTE with expression as parameters was introduced in\nMariaDB 10.2.3. Before that one could only use variables\n(@var_name) as parameters.\n \nDescription\n----------- \nAfter preparing a statement with PREPARE, you execute it\nwith an\nEXECUTE statement that refers to the prepared statement\nname. If the\nprepared statement contains any parameter markers, you must\nsupply a\nUSING clause that lists user variables containing the values\nto be\nbound to the parameters. Parameter values can be supplied\nonly by user\nvariables, and the USING clause must name exactly as many\nvariables as\nthe number of parameter markers in the statement.\n \nYou can execute a given prepared statement multiple times,\npassing\ndifferent variables to it or setting the variables to\ndifferent values\nbefore each execution.\n \nIf the specified statement has not been PREPAREd, an error\nsimilar to the following is produced:\n \nERROR 1243 (HY000): Unknown prepared statement handler\n(stmt_name) given to EXECUTE\n \nExample\n \nSee example in PREPARE.\n \n\n\nURL: https://mariadb.com/kb/en/library/execute-statement/','','https://mariadb.com/kb/en/library/execute-statement/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (99,8,'EXECUTE IMMEDIATE','EXECUTE IMMEDIATE was introduced in MariaDB 10.2.3.\n \nSyntax\n------ \nEXECUTE IMMEDIATE statement\n \nDescription\n----------- \nEXECUTE IMMEDIATE executes a dynamic SQL statement created\non the fly, which can reduce performance overhead.\n \nFor example:\n \nEXECUTE IMMEDIATE \'SELECT 1\' \n \nwhich is shorthand for:\n \nprepare stmt from \"select 1\";\n \nexecute stmt;\n \ndeallocate prepare stmt;\n \nEXECUTE IMMEDIATE supports complex expressions as prepare\nsource and parameters:\n \nEXECUTE IMMEDIATE CONCAT(\'SELECT COUNT(*) FROM \', \'t1\',\n\' WHERE a=?\') USING 5+5;\n \nLimitations: subselects and stored function calls are not\nsupported as a prepare source.\n \nThe following examples return an error:\n \nCREATE OR REPLACE FUNCTION f1() RETURNS VARCHAR(64) RETURN\n\'SELECT * FROM t1\';\nEXECUTE IMMEDIATE f1();\nERROR 1970 (42000): EXECUTE IMMEDIATE does not support\nsubqueries or stored functions\n \nEXECUTE IMMEDIATE (SELECT \'SELECT * FROM t1\');\nERROR 1064 (42000): You have an error in your SQL syntax;\ncheck the manual that \n corresponds to your MariaDB server version for the right\nsyntax to use near \n \'SELECT \'SELECT * FROM t1\')\' at line 1\n \nCREATE OR REPLACE FUNCTION f1() RETURNS INT RETURN 10;\nEXECUTE IMMEDIATE \'SELECT * FROM t1 WHERE a=?\' USING f1();\nERROR 1970 (42000): EXECUTE..USING does not support\nsubqueries or stored functions\n \nEXECUTE IMMEDIATE \'SELECT * FROM t1 WHERE a=?\' USING\n(SELECT 10);\nERROR 1064 (42000): You have an error in your SQL syntax;\ncheck the manual that \n corresponds to your MariaDB server version for the right\nsyntax to use near \n \'SELECT 10)\' at line 1\n \nOne can use a user or an SP variable as a workaround:\n \nCREATE OR REPLACE FUNCTION f1() RETURNS VARCHAR(64) RETURN\n\'SELECT * FROM t1\';\nSET @stmt=f1();\nEXECUTE IMMEDIATE @stmt;\n \nSET @stmt=(SELECT \'SELECT 1\');\nEXECUTE IMMEDIATE @stmt;\n \nCREATE OR REPLACE FUNCTION f1() RETURNS INT RETURN 10;\nSET @param=f1();\nEXECUTE IMMEDIATE \'SELECT * FROM t1 WHERE a=?\' USING\n@param;\n \nSET @param=(SELECT 10);\nEXECUTE IMMEDIATE \'SELECT * FROM t1 WHERE a=?\' USING\n@param;\n \nEXECUTE IMMEDIATE supports user variables and SP variables\nas OUT parameters\n \nDELIMITER $$\nCREATE OR REPLACE PROCEDURE p1(OUT a INT)\nBEGIN\n SET a:= 10;\nEND;\n$$\nDELIMITER ;\nSET @a=2;\nEXECUTE IMMEDIATE \'CALL p1(?)\' USING @a;\nSELECT @a;\n+------+\n| @a |\n+------+\n| 10 |\n+------+\n \nSimilar to PREPARE, EXECUTE IMMEDIATE is allowed in stored\nprocedures but is not allowed in stored functions.\n \nThis example uses EXECUTE IMMEDIATE inside a stored\nprocedure:\n \nDELIMITER $$\nCREATE OR REPLACE PROCEDURE p1()\nBEGIN\n EXECUTE IMMEDIATE \'SELECT 1\';\nEND;\n$$\nDELIMITER ;\nCALL p1;\n+---+\n| 1 |\n+---+\n| 1 |\n+---+\n \nThis script returns an error:\n \nDELIMITER $$\nCREATE FUNCTION f1() RETURNS INT\nBEGIN\n EXECUTE IMMEDIATE \'DO 1\';\n RETURN 1;\nEND;\n$$\nERROR 1336 (0A000): Dynamic SQL is not allowed in stored\nfunction or trigger\n \nEXECUTE IMMEDIATE can use DEFAULT and IGNORE indicators as\nbind parameters:\n \nCREATE OR REPLACE TABLE t1 (a INT DEFAULT 10);\nEXECUTE IMMEDIATE \'INSERT INTO t1 VALUES (?)\' USING\nDEFAULT;\nSELECT * FROM t1;\n+------+\n| a |\n+------+\n| 10 |\n+------+\n \nEXECUTE IMMEDIATE increments the Com_execute_immediate\nstatus variable, as well as the Com_stmt_prepare,\nCom_stmt_execute and Com_stmt_close status variables.\n \nNote, EXECUTE IMMEDIATE does not increment the\nCom_execute_sql status variable. Com_execute_sql is used\nonly for PREPARE..EXECUTE.\n \nThis session screenshot demonstrates how EXECUTE IMMEDIATE\naffects status variables:\n \nSELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE\nVARIABLE_NAME RLIKE \n (\'COM_(EXECUTE|STMT_PREPARE|STMT_EXECUTE|STMT_CLOSE)\');\n \n+-----------------------+----------------+\n| VARIABLE_NAME | VARIABLE_VALUE |\n+-----------------------+----------------+\n| COM_EXECUTE_IMMEDIATE | 0 |\n| COM_EXECUTE_SQL | 0 |\n| COM_STMT_CLOSE | 0 |\n| COM_STMT_EXECUTE | 0 |\n| COM_STMT_PREPARE | 0 |\n+-----------------------+----------------+\n \nEXECUTE IMMEDIATE \'SELECT 1\';\n+---+\n| 1 |\n+---+\n| 1 |\n+---+\n \nSELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE\nVARIABLE_NAME RLIKE \n (\'COM_(EXECUTE|STMT_PREPARE|STMT_EXECUTE|STMT_CLOSE)\');\n+-----------------------+----------------+\n| VARIABLE_NAME | VARIABLE_VALUE |\n+-----------------------+----------------+\n| COM_EXECUTE_IMMEDIATE | 1 |\n| COM_EXECUTE_SQL | 0 |\n| COM_STMT_CLOSE | 1 |\n| COM_STMT_EXECUTE | 1 |\n| COM_STMT_PREPARE | 1 |\n+-----------------------+----------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/execute-immediate/','','https://mariadb.com/kb/en/library/execute-immediate/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (100,8,'LOCK TABLES','Syntax\n------ \nLOCK TABLE[S]\n tbl_name [[AS] alias] lock_type\n [, tbl_name [[AS] alias] lock_type] ...\n [WAIT n|NOWAIT]\n \nlock_type:\n READ [LOCAL]\n | [LOW_PRIORITY] WRITE\n | WRITE CONCURRENT\n \nUNLOCK TABLES\n \nDescription\n----------- \nThe lock_type can be one of:\n \nOption | Description | \n \nREAD | Read lock, no writes allowed | \n \nREAD LOCAL | Read lock, but allow concurrent inserts | \n \nWRITE | Exclusive write lock. No other connections can read\nor write to this table | \n \nLOW_PRIORITY WRITE | Exclusive write lock, but allow new\nread locks on the table until we get the write lock. | \n \nWRITE CONCURRENT | Exclusive write lock, but allow READ\nLOCAL locks to the table. | \n \nMariaDB enables client sessions to acquire table locks\nexplicitly for the\npurpose of cooperating with other sessions for access to\ntables, or to\nprevent other sessions from modifying tables during periods\nwhen a\nsession requires exclusive access to them. A session can\nacquire or\nrelease locks only for itself. One session cannot acquire\nlocks for\nanother session or release locks held by another session.\n \nLocks may be used to emulate transactions or to get more\nspeed when\nupdating tables.\n \nLOCK TABLES explicitly acquires table locks for the current\nclient session.\nTable locks can be acquired for base tables or views. To use\nLOCK TABLES,\nyou must have the LOCK TABLES privilege, and the SELECT\nprivilege for\neach object to be locked. See GRANT\n \nFor view locking, LOCK TABLES adds all base tables used in\nthe view to the\nset of tables to be locked and locks them automatically. If\nyou lock a table\nexplicitly with LOCK TABLES, any tables used in triggers are\nalso locked\nimplicitly, as described in Triggers and Implicit Locks.\n \nUNLOCK TABLES explicitly releases any table locks held by\nthe\ncurrent session.\n \nWAIT/NOWAIT\n \nSet the lock wait timeout. See WAIT and NOWAIT.\n \nLimitations\n \nLOCK TABLES doesn\'t work when using Galera cluster. You may\nexperience crashes or locks when used with Galera.\n \nLOCK TABLES works on XtraDB/InnoDB tables only if the\ninnodb_table_locks system variable is set to 1 (the default)\nand autocommit is set to 0 (1 is default). Please note that\nno error message will be returned on LOCK TABLES with\ninnodb_table_locks = 0.\n \nLOCK TABLES implicitly commits the active transaction, if\nany. Also, starting a transaction always releases all table\nlocks acquired with LOCK TABLES. This means that there is no\nway to have table locks and an active transaction at the\nsame time. The only exceptions are the transactions in\nautocommit mode. To preserve the data integrity between\ntransactional and non-transactional tables, the GET_LOCK()\nfunction can be used.\n \nWhile a connection holds an explicit read lock on a table,\nit cannot modify it. If you try, the following error will be\nproduced:\n \nERROR 1099 (HY000): Table \'tab_name\' was locked with a\nREAD lock and can\'t be updated\n \nWhile a connection holds an explicit lock on a table, it\ncannot access a non-locked table. If you try, the following\nerror will be produced:\n \nERROR 1100 (HY000): Table \'tab_name\' was not locked with\nLOCK TABLES\n \nWhile a connection holds an explicit lock on a table, it\ncannot issue the following: INSERT DELAYED, CREATE TABLE,\nCREATE TABLE ... LIKE, and DDL statements involving stored\nprograms and views (except for triggers). If you try, the\nfollowing error will be produced:\n \nERROR 1192 (HY000): Can\'t execute the given command because\nyou have active locked tables or an active transaction\n \nLOCK TABLES can not be used in stored routines - if you try,\nthe following error will be produced on creation:\n \nERROR 1314 (0A000): LOCK is not allowed in stored procedures\n \n\n\nURL: https://mariadb.com/kb/en/library/lock-tables/','','https://mariadb.com/kb/en/library/lock-tables/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (101,8,'ROLLBACK','The ROLLBACK statement rolls back (ends) a transaction,\ndestroying any changes to SQL-data so that they never become\nvisible to subsequent transactions. The required syntax for\nthe ROLLBACK statement is as follows. \n \nROLLBACK [ WORK ] [ AND [ NO ] CHAIN ] \n[ TO [ SAVEPOINT ] { | } ]\n \nThe ROLLBACK statement will either end a transaction,\ndestroying all data changes that happened during any of the\ntransaction, or it will just destroy any data changes that\nhappened since you established a savepoint. The basic form\nof the ROLLBACK statement is just the keyword ROLLBACK (the\nkeyword WORK is simply noise and can be omitted without\nchanging the effect). \n \nThe optional AND CHAIN clause is a convenience for\ninitiating a new transaction as soon as the old transaction\nterminates. If AND CHAIN is specified, then there is\neffectively nothing between the old and new transactions,\nalthough they remain separate. The characteristics of the\nnew transaction will be the same as the characteristics of\nthe old one — that is, the new transaction will have the\nsame access mode, isolation level and diagnostics area size\n(we\'ll discuss all of these shortly) as the transaction\njust terminated. The AND NO CHAIN option just tells your\nDBMS to end the transaction — that is, these four SQL\nstatements are equivalent: \n \nROLLBACK;\n \nROLLBACK WORK;\n \nROLLBACK AND NO CHAIN;\n \nROLLBACK WORK AND NO CHAIN;\n \nAll of them end a transaction without saving any transaction\ncharacteristics. The only other options, the equivalent\nstatements: \n \nROLLBACK AND CHAIN;\n \nROLLBACK WORK AND CHAIN;\n \nboth tell your DBMS to end a transaction, but to save that\ntransaction\'s characteristics for the next transaction. \n \nROLLBACK is much simpler than COMMIT: it may involve no more\nthan a few deletions (of Cursors, locks, prepared SQL\nstatements and log-file entries). It\'s usually assumed that\nROLLBACK can\'t fail, although such a thing is conceivable\n(for example, an encompassing transaction might reject an\nattempt to ROLLBACK because it\'s lining up for a COMMIT). \n \nROLLBACK cancels all effects of a transaction. It does not\ncancel effects on objects outside the DBMS\'s control (for\nexample the values in host program variables or the settings\nmade by some SQL/CLI function calls). But in general, it is\na convenient statement for those situations when you say\n\"oops, this isn\'t working\" or when you simply don\'t care\nwhether your temporary work becomes permanent or not.\n \nHere is a moot question. If all you\'ve been doing is\nSELECTs, so that there have been no data changes, should you\nend the transaction with ROLLBACK or COMMIT? It shouldn\'t\nreally matter because both ROLLBACK and COMMIT do the same\ntransaction-terminating job. However, the popular conception\nis that ROLLBACK implies failure, so after a successful\nseries of SELECT statements the convention is to end the\ntransaction with COMMIT rather than ROLLBACK.\n \nMariaDB (and most other DBMSs) supports rollback of SQL-data\nchange statements, but not of SQL-Schema statements. This\nmeans that if you use any of CREATE, ALTER, DROP, GRANT,\nREVOKE, you are implicitly committing at execution time.\n \nINSERT INTO Table_2 VALUES(5); \nDROP TABLE Table_3 CASCADE;\n \nROLLBACK;\n \nThe result will be that both the INSERT and the DROP will go\nthrough as separate transactions so the ROLLBACK will have\nno effect. \n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/rollback/','','https://mariadb.com/kb/en/library/rollback/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (102,8,'SAVEPOINT','Syntax\n------ \nSAVEPOINT identifier\nROLLBACK [WORK] TO [SAVEPOINT] identifier\nRELEASE SAVEPOINT identifier\n \nDescription\n----------- \nInnoDB supports the SQL statements SAVEPOINT,\nROLLBACK TO SAVEPOINT, RELEASE SAVEPOINT\nand the optional WORK keyword for\nROLLBACK.\n \nEach savepoint must have a legal MariaDB identifier. A\nsavepoint is a named sub-transaction.\n \nNormally ROLLBACK undoes the changes performed by the whole\ntransaction. When used with the TO clause, it undoes the\nchanges performed after the specified savepoint, and erases\nall subsequent savepoints. However, all locks that have been\nacquired after the save point will survive. RELEASE\nSAVEPOINT does not rollback or commit any changes, but\nremoves the specified savepoint.\n \nWhen the execution of a trigger or a stored function begins,\nit is not possible to use statements which reference a\nsavepoint which was defined from out of that stored program.\n \nWhen a COMMIT (including implicit commits) or a ROLLBACK\nstatement (with no TO clause) is performed, they act on the\nwhole transaction, and all savepoints are removed.\n \nErrors\n \nIf COMMIT or ROLLBACK is issued and no transaction was\nstarted, no error is reported.\n \nIf SAVEPOINT is issued and no transaction was started, no\nerror is reported but no savepoint is created. When ROLLBACK\nTO SAVEPOINT or RELEASE SAVEPOINT is called for a savepoint\nthat does not exist, an error like this is issued:\n \nERROR 1305 (42000): SAVEPOINT svp_name does not exist\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/savepoint/','','https://mariadb.com/kb/en/library/savepoint/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (103,8,'Metadata Locking','Metadata locking has been supported since MariaDB 5.5. This\nmeans that when a transaction (including XA transactions)\nuses a table, it locks its metadata until the end of\ntransaction. Non-transactional tables are also locked, as\nwell as views and objects which are related to locked\ntables/views (stored functions, triggers, etc). When a\nconnection tries to use a DDL statement (like an ALTER\nTABLE) which modifies a table that is locked, that\nconnection is queued, and has to wait until it\'s unlocked.\nUsing savepoints and performing a partial rollback does not\nrelease metadata locks.\n \nLOCK TABLES ... WRITE are also queued. Some wrong statements\nwhich produce an error may not need to wait for the lock to\nbe freed.\n \nMetadata lock\'s timeout is determined by the value of the\nlock_wait_timeout server system variable (in seconds).\nHowever, note that its default value is 31536000 (1 year).\nIf this timeout exceeds, the following error is returned:\n \nERROR 1205 (HY000): Lock wait timeout exceeded;\n try restarting transaction\n \nIf the metadata_lock_info plugin is installed, the\nInformation Schema metadata_lock_info table stores\ninformation about existing metadata locks.\n \nExample\n \nLet\'s use the following MEMORY (non-transactional) table:\n \nCREATE TABLE t (a INT) ENGINE = MEMORY;\n \nConnection 1 starts a transaction, and INSERTs a row into t:\n \nSTART TRANSACTION;\n \nINSERT INTO t SET a=1;\n \nt\'s metadata is now locked by connection 1. Connection 2\ntries to alter t, but has to wait:\n \nALTER TABLE t ADD COLUMN b INT;\n \nConnection 2\'s prompt is blocked now.\n \nNow connection 1 ends the transaction:\n \nCOMMIT;\n \n...and connection 2 finally gets the output of its command:\n \nQuery OK, 1 row affected (35.23 sec)\nRecords: 1 Duplicates: 0 Warnings: 0\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/metadata-locking/','','https://mariadb.com/kb/en/library/metadata-locking/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (104,8,'PREPARE Statement','Syntax\n------ \nPREPARE stmt_name FROM preparable_stmt\n \nDescription\n----------- \nThe PREPARE statement prepares a statement and assigns it a\nname,\nstmt_name, by which to refer to the statement later.\nStatement names\nare not case sensitive. preparable_stmt is either a string\nliteral or a user variable (not a local variable, an SQL\nexpression or a subquery) that contains the text of the\nstatement. The text must \nrepresent a single SQL statement, not multiple statements.\nWithin the\nstatement, \"?\" characters can be used as parameter markers\nto indicate\nwhere data values are to be bound to the query later when\nyou execute\nit. The \"?\" characters should not be enclosed within\nquotes, even if\nyou intend to bind them to string values. Parameter markers\ncan be used\nonly where data values should appear, not for SQL keywords,\nidentifiers, and so forth.\n \nThe scope of a prepared statement is the session within\nwhich it is\ncreated. Other sessions cannot see it.\n \nIf a prepared statement with the given name already exists,\nit is\ndeallocated implicitly before the new statement is prepared.\nThis means\nthat if the new statement contains an error and cannot be\nprepared, an\nerror is returned and no statement with the given name\nexists.\n \nPrepared statements can be PREPAREd and EXECUTEd in a stored\nprocedure, but not in a stored function or trigger. Also,\neven if the statement is PREPAREd in a procedure, it will\nnot be deallocated when the procedure execution ends.\n \nA prepared statement can access user-defined variables, but\nnot local variables or procedure\'s parameters.\n \nIf the prepared statement contains a syntax error, PREPARE\nwill fail. As a side effect, stored procedures can use it to\ncheck if a statement is valid. For example:\n \nCREATE PROCEDURE `test_stmt`(IN sql_text TEXT)\nBEGIN\n DECLARE EXIT HANDLER FOR SQLEXCEPTION\n BEGIN\n SELECT CONCAT(sql_text, \' is not valid\');\n END;\n SET @SQL := sql_text;\n PREPARE stmt FROM @SQL;\n DEALLOCATE PREPARE stmt;\nEND;\n \nThe FOUND_ROWS() and ROW_COUNT() functions, if called\nimmediatly after EXECUTE, return the number of rows read or\naffected by the prepared statements; however, if they are\ncalled after DEALLOCATE PREPARE, they provide information\nabout this statement. If the prepared statement produces\nerrors or warnings, GET DIAGNOSTICS return information about\nthem. DEALLOCATE PREPARE shouldn\'t clear the diagnostics\narea, unless it produces an error.\n \nA prepared statement is executed with EXECUTE and released \nwith DEALLOCATE PREPARE.\n \nThe max_prepared_stmt_count server system variable\ndetermines the number of allowed prepared statements that\ncan be prepared on the server. If it is set to 0, prepared\nstatements are not allowed. If the limit is reached, an\nerror similar to the following will be produced:\n \nERROR 1461 (42000): Can\'t create more than\nmax_prepared_stmt_count statements \n (current value: 0)\n \nOracle Mode\n \nIn Oracle mode from MariaDB 10.3, PREPARE stmt FROM \'SELECT\n:1, :2\' is used, instead of ?.\n \nPermitted Statements\n \nNot all statements can be prepared. Only the following SQL\ncommands are permitted:\nALTER TABLE\nANALYZE TABLE\nBINLOG\nCACHE INDEX\nCALL\nCHANGE MASTER\nCHECKSUM {TABLE | TABLES}\nCOMMIT\n{CREATE | DROP} DATABASE\n{CREATE | DROP} INDEX\n{CREATE | RENAME | DROP} TABLE\n{CREATE | RENAME | DROP} USER\n{CREATE | DROP} VIEW\nDELETE\nDESCRIBE\nDO\nEXPLAIN\nFLUSH {TABLE | TABLES | TABLES WITH READ LOCK | HOSTS |\nPRIVILEGES | LOGS | STATUS | \n MASTER | SLAVE | DES_KEY_FILE | USER_RESOURCES | QUERY\nCACHE | TABLE_STATISTICS | \n INDEX_STATISTICS | USER_STATISTICS | CLIENT_STATISTICS}\nGRANT\nINSERT\nINSTALL {PLUGIN | SONAME}\nHANDLER READ\nKILL\nLOAD INDEX INTO CACHE\nOPTIMIZE TABLE\nREPAIR TABLE\nREPLACE\nRESET {MASTER | SLAVE | QUERY CACHE}\nREVOKE\nROLLBACK\nSELECT\nSET\nSET GLOBAL SQL_SLAVE_SKIP_COUNTER\nSET ROLE\nSET SQL_LOG_BIN\nSET TRANSACTION ISOLATION LEVEL\nSHOW EXPLAIN\nSHOW {DATABASES | TABLES | OPEN TABLES | TABLE STATUS |\nCOLUMNS | INDEX | TRIGGERS | \n EVENTS | GRANTS | CHARACTER SET | COLLATION | ENGINES |\nPLUGINS [SONAME] | PRIVILEGES | \n PROCESSLIST | PROFILE | PROFILES | VARIABLES | STATUS |\nWARNINGS | ERRORS | \n TABLE_STATISTICS | INDEX_STATISTICS | USER_STATISTICS |\nCLIENT_STATISTICS | AUTHORS | \n CONTRIBUTORS}\nSHOW CREATE {DATABASE | TABLE | VIEW | PROCEDURE | FUNCTION\n| TRIGGER | EVENT}\nSHOW {FUNCTION | PROCEDURE} CODE\nSHOW BINLOG EVENTS\nSHOW SLAVE HOSTS\nSHOW {MASTER | BINARY} LOGS\nSHOW {MASTER | SLAVE | TABLES | INNODB | FUNCTION |\nPROCEDURE} STATUS\nSLAVE {START | STOP}\nTRUNCATE TABLE\nSHUTDOWN\nUNINSTALL {PLUGIN | SONAME}\nUPDATE\n \nSynonyms are not listed here, but can be used. For example,\nDESC can be used instead of DESCRIBE.\n \nCompound statements can be prepared too.\n \nNote that if a statement can be run in a stored routine, it\nwill work even if it is called by a prepared statement. For\nexample, SIGNAL can\'t be directly prepared. However, it is\nallowed in stored routines. If the x() procedure contains\nSIGNAL, you can still prepare and execute the \'CALL x();\'\nprepared statement.\n \nPREPARE now supports most kinds of expressions as well, for\nexample:\n \nPREPARE stmt FROM CONCAT(\'SELECT * FROM \', table_name);\n \nWhen PREPARE is used with a statement which is not\nsupported, the following error is produced:\n \nERROR 1295 (HY000): This command is not supported in the\nprepared statement protocol yet\n \nExample\n \ncreate table t1 (a int,b char(10));\ninsert into t1 values (1,\"one\"),(2,\n\"two\"),(3,\"three\");\nprepare test from \"select * from t1 where a=?\";\nset @param=2;\nexecute test using @param;\n+------+------+\n| a | b |\n+------+------+\n| 2 | two |\n+------+------+\nset @param=3;\nexecute test using @param;\n+------+-------+\n| a | b |\n+------+-------+\n| 3 | three |\n+------+-------+\ndeallocate prepare test;\n \nSince identifiers are not permitted as prepared statements\nparameters, sometimes it is necessary to dynamically compose\nan SQL statement. This technique is called dynamic SQL). The\nfollowing example shows how to use dynamic SQL:\n \nCREATE PROCEDURE test.stmt_test(IN tab_name VARCHAR(64))\nBEGIN\n SET @sql = CONCAT(\'SELECT COUNT(*) FROM \', tab_name);\n PREPARE stmt FROM @sql;\n EXECUTE stmt;\n DEALLOCATE PREPARE stmt;\nEND;\n \nCALL test.stmt_test(\'mysql.user\');\n+----------+\n| COUNT(*) |\n+----------+\n| 4 |\n+----------+\n \nUse of variables in prepared statements:\n \nPREPARE stmt FROM \'SELECT @x;\';\n \nSET @x = 1;\n \nEXECUTE stmt;\n+------+\n| @x |\n+------+\n| 1 |\n+------+\n \nSET @x = 0;\n \nEXECUTE stmt;\n+------+\n| @x |\n+------+\n| 0 |\n+------+\n \nDEALLOCATE PREPARE stmt;\n \n\n\nURL: https://mariadb.com/kb/en/library/prepare-statement/','','https://mariadb.com/kb/en/library/prepare-statement/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (105,8,'PURGE BINARY LOGS','Syntax\n------ \nPURGE { BINARY | MASTER } LOGS\n { TO \'log_name\' | BEFORE datetime_expr }\n \nDescription\n----------- \nThe PURGE BINARY LOGS statement deletes all the binary log\nfiles listed in the log index file prior to the specified\nlog file name or\ndate. BINARY and MASTER are synonyms.\nDeleted log files also are removed from the list recorded in\nthe index file, so\nthat the given log file becomes the first in the list.\n \nThe datetime expression is in the format \'YYYY-MM-DD\nhh:mm:ss\'. \n \nIf a slave is active but has yet to read from a binary log\nfile you attempt to delete, the statement will fail with an\nerror. However, if the slave is not connected and has yet to\nread from a log file you delete, the file will be deleted,\nbut the slave will be unable to continue replicating once it\nconnects again.\n \nThis statement has no effect if the server was not started\nwith the\n--log-bin option to enable binary logging.\n \nTo list the binary log files on the server, use SHOW BINARY\nLOGS. To see which files they are reading, use SHOW SLAVE\nSTATUS. You can only delete the files that are older than\nthe oldest file that is used by the slaves.\n \nTo delete all binary log files, use RESET MASTER.\nTo move to a new log file (for example if you want to remove\nthe current log file), use FLUSH LOGS before you execute\nPURGE LOGS.\n \nIf the expire_logs_days server system variable is not set to\n0, the server automatically deletes binary log files after\nthe given number of days.\n \nExamples\n-------- \nPURGE BINARY LOGS TO \'mariadb-bin.000063\';\n \nPURGE BINARY LOGS BEFORE \'2013-04-21\';\n \nPURGE BINARY LOGS BEFORE \'2013-04-22 09:55:22\';\n \n\n\nURL: https://mariadb.com/kb/en/library/purge-binary-logs/','','https://mariadb.com/kb/en/library/purge-binary-logs/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (106,8,'RESET MASTER','RESET MASTER [TO #]\n \nDeletes all binary log files listed in the index file,\nresets the\nbinary log index file to be empty, and creates a new binary\nlog file with a suffix of .000001.\n \nIf TO # is given, then the first new binary log file will\nstart from number #.\n \nThis statement is for use only when the master is started\nfor the first time, and should never be used if any slaves\nare actively replicating from the binary log.\n \n\n\nURL: https://mariadb.com/kb/en/library/reset-master/','','https://mariadb.com/kb/en/library/reset-master/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (107,8,'RESET SLAVE','RESET SLAVE [\"connection_name\"] [ALL] \n \nRESET SLAVE makes the slave forget its replication position\nin the\nmaster\'s binary log. This statement is meant to be used for\na clean\nstart. It deletes the master.info and relay-log.info files,\nall the\nrelay log files, and starts a new relay log file. To use\nRESET SLAVE,\nthe slave replication threads must be stopped (use STOP\nSLAVE if\nnecessary).\n \nNote: All relay log files are deleted, even if they have not\nbeen\ncompletely executed by the slave SQL thread. (This is a\ncondition\nlikely to exist on a replication slave if you have issued a\nSTOP SLAVE\nstatement or if the slave is highly loaded.)\n \nConnection information stored in the master.info file is\nimmediately\nreset using any values specified in the corresponding\nstartup options.\nThis information includes values such as master host, master\nport,\nmaster user, and master password. If the slave SQL thread\nwas in the\nmiddle of replicating temporary tables when it was stopped,\nand RESET\nSLAVE is issued, these replicated temporary tables are\ndeleted on the\nslave.\n \nThe ALL also resets the PORT, HOST, USER and PASSWORD\nparameters for the slave. If you are using a connection\nname, it will permanently delete it and it will not show up\nanymore in SHOW ALL SLAVES STATUS.\n \nconnection_name\n \nThe connection_name option was added as part of multi-source\nreplication added in MariaDB 10.0\n \nIf there is only one nameless master, or the default master\n(as specified by the default_master_connection system\nvariable) is intended, connection_name can be omitted. If\nprovided, the RESET SLAVE statement will apply to the\nspecified master. connection_name is case-insensitive.\n \n\n\nURL:\nhttps://mariadb.com/kb/en/library/reset-slave-connection_name/','','https://mariadb.com/kb/en/library/reset-slave-connection_name/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (108,8,'SET TRANSACTION','Syntax\n------ \nSET [GLOBAL | SESSION] TRANSACTION\n transaction_property [, transaction_property] ...\n \ntransaction_property:\n ISOLATION LEVEL level\n | READ WRITE\n | READ ONLY\n \nlevel:\n REPEATABLE READ\n | READ COMMITTED\n | READ UNCOMMITTED\n | SERIALIZABLE\n \nDescription\n----------- \nThis statement sets the transaction isolation level or the\ntransaction access mode globally, for the current session,\nor for the next transaction:\nWith the GLOBAL keyword, the statement sets the default\n transaction level globally for all subsequent sessions.\nExisting sessions are\n unaffected.\nWith the SESSION keyword, the statement sets the default\n transaction level for all subsequent transactions performed\nwithin the\n current session.\nWithout any SESSION or GLOBAL keyword,\n the statement sets the isolation level for the next (not\nstarted) transaction\n performed within the current session.\n \nA change to the global default isolation level requires the \nSUPER privilege. Any session is free to change its\nsession isolation level (even in the middle of a\ntransaction), or the isolation\nlevel for its next transaction.\n \nIsolation Level\n \nTo set the global default isolation level at server startup,\nuse the\n--transaction-isolation=level option on the command line or\nin an option file. Values of level for this option use\ndashes\nrather than spaces, so the allowable values are\nREAD-UNCOMMITTED,\nREAD-COMMITTED, REPEATABLE-READ, or\nSERIALIZABLE. For example, to set the default isolation\nlevel to REPEATABLE READ, use these lines in the [mysqld]\nsection of an option file:\n \n[mysqld]\ntransaction-isolation = REPEATABLE-READ\nTo determine the global and session transaction isolation\nlevels at\nruntime, check the value of the tx_isolation system\nvariable:\n \nSELECT @@GLOBAL.tx_isolation, @@tx_isolation;\n \nInnoDB supports each of the translation isolation levels\ndescribed here\nusing different locking strategies. The default level is \nREPEATABLE READ. For additional information about InnoDB\nrecord-level locks and how it uses them to execute various\ntypes of statements,\nsee XtraDB/InnoDB Lock Modes,\nand\nhttp://dev.mysql.com/doc/refman/en/innodb-locks-set.html.\n \nIsolation Levels\n \nThe following sections describe how MariaDB supports the\ndifferent transaction levels.\n \nREAD UNCOMMITTED\n \nSELECT statements are performed in a non-locking fashion,\nbut a possible earlier version of a row might be used. Thus,\nusing this\nisolation level, such reads are not consistent. This is also\ncalled a \"dirty\nread.\" Otherwise, this isolation level works like \nREAD COMMITTED.\n \nREAD COMMITTED\n \nA somewhat Oracle-like isolation level with respect to\nconsistent\n(non-locking) reads: Each consistent read, even within the\nsame\ntransaction, sets and reads its own fresh snapshot. See\nhttp://dev.mysql.com/doc/refman/en/innodb-consistent-read.html.\n \nFor locking reads (SELECT with FOR UPDATE\nor LOCK IN SHARE MODE), InnoDB locks only index records, not\nthe gaps before them, and thus allows the free insertion of\nnew records next to\nlocked records. For UPDATE and DELETE\nstatements, locking depends on whether the statement uses a\nunique index with a\nunique search condition (such as WHERE id = 100), or a\nrange-type search condition (such as WHERE id > 100). For a\nunique index with a unique search condition, InnoDB locks\nonly the index record\nfound, not the gap before it. For range-type searches,\nInnoDB locks the index\nrange scanned, using gap locks or next-key (gap plus\nindex-record) locks to\nblock insertions by other sessions into the gaps covered by\nthe range. This is\nnecessary because \"phantom rows\" must be blocked for MySQL\nreplication and\nrecovery to work.\n \nNote: Since MariaDB 5.1, if the READ COMMITTED isolation\nlevel is used or the innodb_locks_unsafe_for_binlog system\nvariable is enabled,\nthere is no InnoDB gap locking except for foreign-key\nconstraint checking and\nduplicate-key checking. Also, record locks for non-matching\nrows are released\nafter MariaDB has evaluated the WHERE condition. As of\nMariaDB/MySQL\n5.1, if you use READ COMMITTED or enable\ninnodb_locks_unsafe_for_binlog, you must use row-based\nbinary logging.\n \nREPEATABLE READ\n \nThis is the default isolation level for InnoDB. For\nconsistent reads,\nthere is an important difference from the READ COMMITTED\nisolation level: All consistent reads within the same\ntransaction read the\nsnapshot established by the first read. This convention\nmeans that if you issue\nseveral plain (non-locking) SELECT statements within the\nsame transaction, these SELECT statements are consistent\nalso with respect to each other. See\nhttp://dev.mysql.com/doc/refman/en/innodb-consistent-read.html.\n \nFor locking reads (SELECT with FOR UPDATE or LOCK IN SHARE\nMODE),\nUPDATE, and DELETE statements, locking depends on whether\nthe\nstatement uses a unique index with a unique search\ncondition, or a\nrange-type search condition. For a unique index with a\nunique search\ncondition, InnoDB locks only the index record found, not the\ngap\nbefore it. For other search conditions, InnoDB locks the\nindex range\nscanned, using gap locks or next-key (gap plus index-record)\nlocks to\nblock insertions by other sessions into the gaps covered by\nthe range.\n \nThis is the minimum isolation level for non-distributed XA\ntransactions.\n \nSERIALIZABLE\n \nThis level is like REPEATABLE READ, but InnoDB implicitly\nconverts all\nplain SELECT statements to SELECT ... LOCK IN SHARE MODE if\nautocommit\nis disabled. If autocommit is enabled, the SELECT is its own\ntransaction. It therefore is known to be read only and can\nbe\nserialized if performed as a consistent (non-locking) read\nand need\nnot block for other transactions. (This means that to force\na plain\nSELECT to block if other transactions have modified the\nselected rows,\nyou should disable autocommit.)\n \nDistributed XA transactions should always use this isolation\nlevel.\n \nAccess Mode\n \nThese clauses appeared in MariaDB 10.0.\n \nThe access mode specifies whether the transaction is allowed\nto write data or not. By default, transactions are in READ\nWRITE mode (see the tx_read_only system variable). READ ONLY\nmode allows the storage engine to apply optimizations that\ncannot be used for transactions which write data. The only\nexception to this rule is that read only transactions can\nperform DDL statements on temporary tables.\n \nIt is not permitted to specify both READ WRITE and READ ONLY\nin the same statement.\n \nREAD WRITE and READ ONLY can also be specified in the START\nTRANSACTION statement, in which case the specified mode is\nonly valid for one transaction.\n \nExamples\n-------- \nSET GLOBAL TRANSACTION ISOLATION LEVEL SERIALIZABLE;\n \nAttempting to set the isolation level within an existing\ntransaction without specifying GLOBAL or SESSION.\n \nSTART TRANSACTION;\n \nSET TRANSACTION ISOLATION LEVEL SERIALIZABLE;\nERROR 1568 (25001): Transaction characteristics can\'t be\nchanged while a transaction is in progress\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/set-transaction/','','https://mariadb.com/kb/en/library/set-transaction/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (109,8,'START SLAVE','Syntax\n------ \nSTART SLAVE [\"connection_name\"] [thread_type [,\nthread_type] ... ]\nSTART SLAVE [\"connection_name\"] [SQL_THREAD] UNTIL \n MASTER_LOG_FILE = \'log_name\', MASTER_LOG_POS = log_pos\nSTART SLAVE [\"connection_name\"] [SQL_THREAD] UNTIL\n RELAY_LOG_FILE = \'log_name\', RELAY_LOG_POS = log_pos\nSTART SLAVE [\"connection_name\"] [SQL_THREAD] UNTIL\n MASTER_GTID_POS = \nSTART ALL SLAVES [thread_type [, thread_type]]\nthread_type: IO_THREAD | SQL_THREAD\n \nDescription\n----------- \nSTART SLAVE with no thread_type options starts both of the\nslave\nthreads (see replication). The I/O thread reads events from\nthe master server and stores\nthem in the relay log. The SQL thread reads events from the\nrelay log\nand executes them. START SLAVE requires the SUPER privilege.\n \nIf START SLAVE succeeds in starting the slave threads, it\nreturns\nwithout any error. However, even in that case, it might be\nthat the\nslave threads start and then later stop (for example,\nbecause they do\nnot manage to connect to the master or read its binary log,\nor some\nother problem). START SLAVE does not warn you about this.\nYou must\ncheck the slave\'s error log for error messages generated by\nthe slave\nthreads, or check that they are running satisfactorily with\nSHOW SLAVE\nSTATUS.\n \nSTART SLAVE UNTIL\n \nSTART SLAVE UNTIL refers to the SQL_THREAD slave position at\nwhich the SQL_THREAD replication will halt. If SQL_THREAD\nisn\'t specified both threads are started.\n \nSince version 10.0.2, START SLAVE UNTIL master_gtid_pos=xxx\nhas also been supported. See Global Transaction ID/START\nSLAVE UNTIL master_gtid_pos=xxx for more details.\n \nconnection_name\n \nThe connection_name option was added as part of multi-source\nreplication added in MariaDB 10.0\n \nIf there is only one nameless master, or the default master\n(as specified by the default_master_connection system\nvariable) is intended, connection_name can be omitted. If\nprovided, the START SLAVE statement will apply to the\nspecified master. connection_name is case-insensitive.\n \nSTART ALL SLAVES\n \nSTART ALL SLAVES starts all configured slaves (slaves with\nmaster_host not empty) that were not started before. It will\ngive a note for all started connections. You can check the\nnotes with SHOW WARNINGS.\n \n\n\nURL: https://mariadb.com/kb/en/library/start-slave/','','https://mariadb.com/kb/en/library/start-slave/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (110,8,'START TRANSACTION','Syntax\n------ \nSTART TRANSACTION [transaction_property [,\ntransaction_property] ...] | BEGIN [WORK]\nCOMMIT [WORK] [AND [NO] CHAIN] [[NO] RELEASE]\nROLLBACK [WORK] [AND [NO] CHAIN] [[NO] RELEASE]\nSET autocommit = {0 | 1}\n \ntransaction_property:\n WITH CONSISTENT SNAPSHOT\n | READ WRITE\n | READ ONLY\n \nDescription\n----------- \nThe START TRANSACTION or BEGIN statement\nbegins a new transaction. COMMIT commits the current\ntransaction, making its changes permanent. ROLLBACK rolls\nback the current transaction, canceling its changes. The SET\nautocommit statement disables or enables the default\nautocommit mode for the current session.\n \nSTART TRANSACTION and SET autocommit = 1 implicitly commit\nthe current transaction, if any.\n \nThe optional WORK keyword is supported for\nCOMMIT and ROLLBACK, as are the\nCHAIN and RELEASE clauses.\nCHAIN and RELEASE can be used for\nadditional control over transaction completion. The value of\nthe\ncompletion_type system variable determines the default\ncompletion behavior.\n \nThe AND CHAIN clause causes a new transaction to begin as\nsoon as the current one ends, and the new transaction has\nthe same isolation\nlevel as the just-terminated transaction. The RELEASE clause\ncauses the server to disconnect the current client session\nafter terminating\nthe current transaction. Including the NO keyword suppresses\nCHAIN or RELEASE completion, which can be\nuseful if the completion_type system variable is set to\ncause chaining or release completion by default.\n \nAccess Mode\n \nThese clauses appeared in MariaDB 10.0.\n \nThe access mode specifies whether the transaction is allowed\nto write data or not. By default, transactions are in READ\nWRITE mode (see the tx_read_only system variable). READ ONLY\nmode allows the storage engine to apply optimizations that\ncannot be used for transactions which write data. The only\nexception to this rule is that read only transactions can\nperform DDL statements on temporary tables.\n \nIt is not permitted to specify both READ WRITE and READ ONLY\nin the same statement.\n \nREAD WRITE and READ ONLY can also be specified in the SET\nTRANSACTION statement, in which case the specified mode is\nvalid for all sessions, or for all subsequent transaction\nused by the current session.\n \nautocommit\n \nBy default, MariaDB runs with autocommit mode enabled. This\nmeans that as soon as you execute a statement that updates\n(modifies) a table, MariaDB stores the update on disk to\nmake it permanent. To disable autocommit mode, use the\nfollowing statement:\n \nSET autocommit=0;\n \nAfter disabling autocommit mode by setting the autocommit\nvariable to zero, changes to transaction-safe tables (such\nas those for InnoDB or\nNDBCLUSTER) are not made permanent immediately. You must use\nCOMMIT to store your changes to disk or ROLLBACK to ignore\nthe changes.\n \nTo disable autocommit mode for a single series of\nstatements, use the START TRANSACTION statement.\n \nDDL Statements\n \nDDL statements (CREATE, ALTER, DROP) and administrative\nstatements (FLUSH, RESET, OPTIMIZE, ANALYZE, CHECK, REPAIR,\nCACHE INDEX), and LOAD DATA INFILE, cause an implicit COMMIT\nand start a new transaction. An exception to this rule are\nthe DDL that operate on temporary tables: you can CREATE,\nALTER and DROP them without causing any COMMIT, but those\nactions cannot be rolled back. This means that if you call\nROLLBACK, the temporary tables you created in the\ntransaction will remain, while the rest of the transaction\nwill be rolled back.\n \nTransactions cannot be used in Stored Functions or Triggers.\nIn Stored Procedures and Events BEGIN is not allowed, so you\nshould use START TRANSACTION instead.\n \nA transaction acquires a metadata lock on every table it\naccesses to prevent other connections from altering their\nstructure. The lock is released at the end of the\ntransaction. This happens even with non-transactional\nstorage engines (like MEMORY or CONNECT), so it makes sense\nto use transactions with non-transactional tables.\n \nin_transaction\n \nThe in_transaction system variable appeared in MariaDB 5.3.\n \nIt is a session-only, read-only variable that returns 1\ninside a transaction, and 0 if not in a transaction.\n \nWITH CONSISTENT SNAPSHOT\n \nThe WITH CONSISTENT SNAPSHOT option starts a consistent read\nfor storage engines such as XtraDB and InnoDB that can do\nso, the same as if a START TRANSACTION followed by a SELECT\nfrom any InnoDB table was issued. \n \nMariaDB 5.3 introduced enhancements to this feature. See\nEnhancements for START TRANSACTION WITH CONSISTENT SNAPSHOT.\n \nExamples\n-------- \nSTART TRANSACTION;\n \nSELECT @A:=SUM(salary) FROM table1 WHERE type=1;\n \nUPDATE table2 SET summary=@A WHERE type=1;\n \nCOMMIT;\n \n\n\nURL: https://mariadb.com/kb/en/library/start-transaction/','','https://mariadb.com/kb/en/library/start-transaction/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (111,8,'STOP SLAVE','Syntax\n------ \nSTOP SLAVE [\"connection_name\"] [thread_type [,\nthread_type] ... ]\n \nSTOP ALL SLAVES [thread_type [, thread_type]]\n \nthread_type: IO_THREAD | SQL_THREAD\n \nDescription\n----------- \nStops the slave threads. STOP SLAVE requires the SUPER\nprivilege.\n \nLike START SLAVE, this statement may be used with the\nIO_THREAD and\nSQL_THREAD options to name the thread or threads to be\nstopped. In almost all cases, one never need to use the\nthread_type options.\n \nSTOP SLAVE waits until any current replication event group\naffecting\none or more non-transactional tables has finished executing\n(if there\nis any such replication group), or until the user issues a\nKILL QUERY or KILL CONNECTION statement.\n \nNote that STOP SLAVE doesn\'t delete the connection\npermanently. Next time you execute START SLAVE or the\nMariaDB server restarts, the slave connection is restored\nwith it\'s original arguments. If you want to delete a\nconnection, you should execute RESET SLAVE.\n \nSTOP ALL SLAVES\n \nSTOP ALL SLAVES stops all your running slaves. It will give\nyou a note for every stopped connection. You can check the\nnotes with SHOW WARNINGS.\n \nconnection_name\n \nThe connection_name option was added as part of multi-source\nreplication added in MariaDB 10.0\n \nIf there is only one nameless master, or the default master\n(as specified by the default_master_connection system\nvariable) is intended, connection_name can be omitted. If\nprovided, the STOP SLAVE statement will apply to the\nspecified master. connection_name is case-insensitive.\n \n\n\nURL: https://mariadb.com/kb/en/library/stop-slave/','','https://mariadb.com/kb/en/library/stop-slave/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (112,8,'Transaction Timeouts','MariaDB has always had the wait_timeout and\ninteractive_timeout settings, which close connections after\na certain period of inactivity.\n \nHowever, these are by default set to a long wait period. In\nsituations where transactions may be started, but not\ncommitted or rolled back, more granular control and a\nshorter timeout may be desirable so as to avoid locks being\nheld for too long.\n \nMariaDB 10.3 introduced three new variables to handle this\nsituation.\nidle_transaction_timeout (all transactions)\nidle_write_transaction_timeout (write transactions - called\nidle_readwrite_transaction_timeout until MariaDB 10.3.2)\nidle_readonly_transaction_timeout (read transactions)\n \nThese accept a time in seconds to time out, by closing the\nconnection, transactions that are idle for longer than this\nperiod. By default all are set to zero, or no timeout.\n \nidle_transaction_timeout affects all transactions,\nidle_write_transaction_timeout affects write transactions\nonly and idle_readonly_transaction_timeout affects read\ntransactions only. The latter two variables work\nindependently. However, if either is set along with\nidle_transaction_timeout, the settings for\nidle_write_transaction_timeout or\nidle_readonly_transaction_timeout will take precedence.\n \nExamples\n-------- \nSET SESSION idle_transaction_timeout=2;\n \nBEGIN;\n \nSELECT * FROM t;\n \nEmpty set (0.000 sec)\n## wait 3 seconds\nSELECT * FROM t;\n \nERROR 2006 (HY000): MySQL server has gone away\n \nSET SESSION idle_write_transaction_timeout=2;\n \nBEGIN;\n \nSELECT * FROM t;\n \nEmpty set (0.000 sec)\n## wait 3 seconds\nSELECT * FROM t;\n \nEmpty set (0.000 sec)\nINSERT INTO t VALUES(1);\n## wait 3 seconds\nSELECT * FROM t;\n \nERROR 2006 (HY000): MySQL server has gone away\n \nSET SESSION idle_transaction_timeout=2, SESSION\nidle_readonly_transaction_timeout=10;\n \nBEGIN;\n \nSELECT * FROM t;\n \nEmpty set (0.000 sec)\n ## wait 3 seconds\nSELECT * FROM t;\n \nEmpty set (0.000 sec)\n## wait 11 seconds\nSELECT * FROM t;\n \nERROR 2006 (HY000): MySQL server has gone away\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/transaction-timeouts/','','https://mariadb.com/kb/en/library/transaction-timeouts/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (113,8,'UNLOCK TABLES','Syntax\n------ \nUNLOCK TABLES\n \nDescription\n----------- \nUNLOCK TABLES explicitly releases any table locks held by\nthe\ncurrent session. See LOCK TABLES for more information.\n \nIn addition to releasing table locks acquired by the LOCK\nTABLES statement, the UNLOCK TABLES statement also releases\nthe global read lock acquired by the FLUSH TABLES WITH READ\nLOCK statement. The FLUSH TABLES WITH READ LOCK statement is\nvery useful for performing backups. See FLUSH for more\ninformation about FLUSH TABLES WITH READ LOCK.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/transactions-unlock-tables/','','https://mariadb.com/kb/en/library/transactions-unlock-tables/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (114,8,'WAIT and NOWAIT','MariaDB 10.3.0 introduced extended syntax so that it is\npossible to set innodb_lock_wait_timeout and\nlock_wait_timeout for the following statements:\n \nSyntax\n------ \nALTER TABLE tbl_name [WAIT n|NOWAIT] ...\nCREATE ... INDEX ON tbl_name (index_col_name, ...) [WAIT\nn|NOWAIT] ...\nDROP INDEX ... [WAIT n|NOWAIT]\nDROP TABLE tbl_name [WAIT n|NOWAIT] ...\nLOCK TABLE ... [WAIT n|NOWAIT]\nOPTIMIZE TABLE tbl_name [WAIT n|NOWAIT]\nRENAME TABLE tbl_name [WAIT n|NOWAIT] ...\nSELECT ... FOR UPDATE [WAIT n|NOWAIT]\nSELECT ... LOCK IN SHARE MODE [WAIT n|NOWAIT]\nTRUNCATE TABLE tbl_name [WAIT n|NOWAIT]\n \nDescription\n----------- \nThe lock wait timeout can be explicitly set in the statement\nby using either WAIT n (to set the wait in seconds) or\nNOWAIT, in which case the statement will immediately fail if\nthe lock cannot be obtained. WAIT 0 is equivalent to NOWAIT.\n \n\n\nURL: https://mariadb.com/kb/en/library/wait-and-nowait/','','https://mariadb.com/kb/en/library/wait-and-nowait/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (115,8,'XA Transactions','Overview\n \nThe MariaDB XA implementation is based on the X/Open CAE\ndocument Distributed Transaction Processing: The XA\nSpecification. This document is published by The Open Group\nand available at\nhttp://www.opengroup.org/public/pubs/catalog/c193.htm.\n \nXA transactions are designed to allow distributed\ntransactions, where a transaction manager (the application)\ncontrols a transaction which involves multiple resources.\nSuch resources are usually DBMSs, but could be resources of\nany type. The whole set of required transactional operations\nis called a global transaction. Each subset of operations\nwhich involve a single resource is called a local\ntransaction. XA used a 2-phases commit (2PC). With the first\ncommit, the transaction manager tells each resource to\nprepare an effective commit, and waits for a confirm\nmessage. The changes are not still made effective at this\npoint. If any of the resources encountered an error, the\ntransaction manager will rollback the global transaction. If\nall resources communicate that the first commit is\nsuccessful, the transaction manager can require a second\ncommit, which makes the changes effective.\n \nIn MariaDB, XA transactions can only be used with storage\nengines that support them. At least InnoDB, TokuDB, SPIDER\nand MyRocks support them. For InnoDB, XA transactions can be\ndisabled by setting the innodb_support_xa server system\nvariable to 0. \n \nLike regular transactions, XA transactions create metadata\nlocks on accessed tables.\n \nXA transactions require REPEATABLE READ as a minimum\nisolation level. However, distributed transactions should\nalways use SERIALIZABLE.\n \nTrying to start more than one XA transaction at the same\ntime produces a 1400 error (SQLSTATE \'XAE09\'). The same\nerror is produced when attempting to start an XA transaction\nwhile a regular transaction is in effect. Trying to start a\nregular transaction while an XA transaction is in effect\nproduces a 1399 error (SQLSTATE \'XAE07\').\n \nThe statements that cause an implicit COMMIT for regular\ntransactions produce a 1400 error (SQLSTATE \'XAE09\') if a\nXA transaction is in effect.\n \nInternal XA vs External XA\n \nXA transactions are an overloaded term in MariaDB. If a\nstorage engine is XA-capable, it can mean one or both of\nthese:\nIt supports MariaDB\'s internal two-phase commit API. This\nis transparent to the user. Sometimes this is called\n\"internal XA\", since MariaDB\'s internal transaction\ncoordinator log can handle coordinating these transactions.\n \nIt supports XA transactions, with the XA START, XA PREPARE,\nXA COMMIT, etc. statements. Sometimes this is called\n\"external XA\", since it requires the use of an external\ntransaction coordinator to use this feature properly.\n \nTransaction Coordinator Log\n \nIf you have two or more XA-capable storage engines enabled,\nthen a transaction coordinator log must be available.\n \nThere are currently two implementations of the transaction\ncoordinator log:\nBinary log-based transaction coordinator log\nMemory-mapped file-based transaction coordinator log\n \nIf the binary log is enabled on a server, then the server\nwill use the binary log-based transaction coordinator log.\nOtherwise, it will use the memory-mapped file-based\ntransaction coordinator log.\n \nSee Transaction Coordinator Log for more information.\n \nSyntax\n------ \nXA {START|BEGIN} xid [JOIN|RESUME]\n \nXA END xid [SUSPEND [FOR MIGRATE]]\n \nXA PREPARE xid\n \nXA COMMIT xid [ONE PHASE]\n \nXA ROLLBACK xid\n \nXA RECOVER [FORMAT=[\'RAW\'|\'SQL\']]\n \nxid: gtrid [, bqual [, formatID ]]\n \nThe interface to XA transactions is a set of SQL statements\nstarting with XA. Each statement changes a transaction\'s\nstate, determining which actions it can perform. A\ntransaction which does not exist is in the NON-EXISTING\nstate.\n \nXA START (or BEGIN) starts a transaction and defines its xid\n(a transaction identifier). The JOIN or RESUME keywords have\nno effect. The new transaction will be in ACTIVE state.\n \nThe xid can have 3 components, though only the first one is\nmandatory. gtrid is a quoted string representing a global\ntransaction identifier. bqual is a quoted string\nrepresenting a local transaction identifier. formatID is an\nunsigned integer indicating the format used for the first\ntwo components; if not specified, defaults to 1. MariaDB\ndoes not interpret in any way these components, and only\nuses them to identify a transaction. xids of transactions in\neffect must be unique.\n \nXA END declares that the specified ACTIVE transaction is\nfinished and it changes its state to IDLE. SUSPEND [FOR\nMIGRATE] has no effect.\n \nXA PREPARE prepares an IDLE transaction for commit, changing\nits state to PREPARED. This is the first commit.\n \nXA COMMIT definitely commits and terminates a transaction\nwhich has already been PREPARED. If the ONE PHASE clause is\nspecified, this statements performs a 1-phase commit on an\nIDLE transaction.\n \nXA ROLLBACK rolls back and terminates an IDLE or PREPARED\ntransaction.\n \nXA RECOVER shows information about all PREPARED\ntransactions.\n \nWhen trying to execute an operation which is not allowed for\nthe transaction\'s current state, an error is produced:\n \nXA COMMIT \'test\' ONE PHASE;\n \nERROR 1399 (XAE07): XAER_RMFAIL: The command cannot be\nexecuted when global transaction is in the ACTIVE state\n \nXA COMMIT \'test2\';\n \nERROR 1399 (XAE07): XAER_RMFAIL: The command cannot be\nexecuted when global transaction is in the NON-EXISTING\nstate\n \nXA RECOVER\n \nThe XA RECOVER statement shows information about all\ntransactions which are in the PREPARED state. It does not\nmatter which connection created the transaction: if it has\nbeen PREPARED, it appears. But this does not mean that a\nconnection can commit or rollback a transaction which was\nstarted by another connection. Note that transactions using\na 1-phase commit are never in the PREPARED state, so they\ncannot be shown by XA RECOVER.\n \nXA RECOVER produces four columns:\n \nXA RECOVER;\n \n+----------+--------------+--------------+------+\n| formatID | gtrid_length | bqual_length | data |\n+----------+--------------+--------------+------+\n| 1 | 4 | 0 | test |\n+----------+--------------+--------------+------+\n \nYou can use XA RECOVER FORMAT=\'SQL\' to get the data in a\nhuman readable\nform that can be directly copy-pasted into XA COMMIT or XA\nROLLBACK. This is particularly useful for binary xid\ngenerated by some transaction coordinators.\n \nformatID is the formatID part of xid.\n \ndata are the gtrid and bqual parts of xid, concatenated.\n \ngtrid_length and bqual_length are the lengths of gtrid and\nbqual, respectevely.\n \nExamples\n-------- \n2-phases commit:\n \nXA START \'test\';\n \nINSERT INTO t VALUES (1,2);\n \nXA END \'test\';\n \nXA PREPARE \'test\';\n \nXA COMMIT \'test\';\n \n1-phase commit:\n \nXA START \'test\';\n \nINSERT INTO t VALUES (1,2);\n \nXA END \'test\';\n \nXA COMMIT \'test\' ONE PHASE;\n \nHuman-readable:\n \nxa start \'12\\r34\\t67\\v78\', \'abc\\ndef\', 3;\n \ninsert t1 values (40);\n \nxa end \'12\\r34\\t67\\v78\', \'abc\\ndef\', 3;\n \nxa prepare \'12\\r34\\t67\\v78\', \'abc\\ndef\', 3;\n \nxa recover format=\'RAW\';\n \n+----------+--------------+--------------+--------------------+\n| formatID | gtrid_length | bqual_length | data |\n+----------+--------------+--------------+--------------------+\n34 67v78abc 11 | 7 | 12\ndef |\n+----------+--------------+--------------+--------------------+\n \nxa recover format=\'SQL\';\n \n+----------+--------------+--------------+-----------------------------------------------+\n| formatID | gtrid_length | bqual_length | data |\n+----------+--------------+--------------+-----------------------------------------------+\n| 3 | 11 | 7 |\nX\'31320d3334093637763738\',X\'6162630a646566\',3 |\n+----------+--------------+--------------+-----------------------------------------------+\n \nxa rollback\nX\'31320d3334093637763738\',X\'6162630a646566\',3;\n \nKnown Issues\n \nMariaDB Galera Cluster\n \nMariaDB Galera Cluster does not support XA transactions. See\nMDEV-10532 for more information on that. The request to\nimplement that feature is being tracked at MDEV-17099.\n \nHowever, MariaDB Galera Cluster builds include a built-in\nplugin called wsrep. Prior to MariaDB 10.4.3, this plugin\nwas internally considered an XA-capable storage engine.\nConsequently, these MariaDB Galera Cluster builds have\nmultiple XA-capable storage engines by default, even if the\nonly \"real\" storage engine that supports external XA\ntransactions enabled on these builds by default is InnoDB.\nTherefore, when using one these builds MariaDB would be\nforced to use a transaction coordinator log by default,\nwhich could have performance implications.\n \nSee Transaction Coordinator Log Overview: MariaDB Galera\nCluster for more information.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/xa-transactions/','','https://mariadb.com/kb/en/library/xa-transactions/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (116,10,'Account Locking','Account locking was introduced in MariaDB 10.4.2.\n \nDescription\n----------- \nAccount locking permits privileged administrators to\nlock/unlock user accounts. No new client connections will be\npermitted if an account is locked (existing connections are\nnot affected).\n \nUser accounts can be locked at creation, with the CREATE\nUSER statement, or modified after creation with the ALTER\nUSER statement. For example:\n \nCREATE USER \'lorin\'@\'localhost\' ACCOUNT LOCK;\n \nor\n \nALTER USER \'marijn\'@\'localhost\' ACCOUNT LOCK;\n \nThe server will return an ER_ACCOUNT_HAS_BEEN_LOCKED error\nwhen locked users attempt to connect:\n \nmysql -ulorin\n ERROR 4151 (HY000): Access denied, this account is locked\n \nThe ALTER USER statement is also used to unlock a user:\n \nALTER USER \'lorin\'@\'localhost\' ACCOUNT UNLOCK;\n \nThe SHOW CREATE USER statement will show whether the account\nis locked:\n \nSHOW CREATE USER \'marijn\'@\'localhost\';\n \n+-----------------------------------------------+\n| CREATE USER for marijn@localhost |\n+-----------------------------------------------+\n| CREATE USER \'marijn\'@\'localhost\' ACCOUNT LOCK |\n+-----------------------------------------------+\n \nas well as querying the mysql.global_priv table:\n \nSELECT CONCAT(user, \'@\', host, \' => \',\nJSON_DETAILED(priv)) FROM mysql.global_priv \n WHERE user=\'marijn\';\n+--------------------------------------------------------------------------------------+\n| CONCAT(user, \'@\', host, \' => \', JSON_DETAILED(priv)) |\n+--------------------------------------------------------------------------------------+\n| marijn@localhost => {\n \"access\": 0,\n \"plugin\": \"mysql_native_password\",\n \"authentication_string\": \"\",\n \"account_locked\": true,\n \"password_last_changed\": 1558017158\n} |\n+--------------------------------------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/account-locking/','','https://mariadb.com/kb/en/library/account-locking/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (117,10,'Authentication from MariaDB 10.4','MariaDB 10.4 introduces a number of changes to the\nauthentication process, intended to make things easier and\nmore intuitive.\n \nOverview\n \nThere are four main changes relating to authentication:\nIt is possible to use more than one authentication plugin\nfor each user account. For example, this can be useful to\nslowly migrate users to the more secure ed25519\nauthentication plugin over time, while allowing the old\nmysql_native_password authentication plugin as an\nalternative for the transitional period.\nThe root@localhost user account created by mysql_install_db\nis created with the ability to use two authentication\nplugins.\nFirst, it is configured to try to use the unix_socket\nauthentication plugin. This allows the the root@localhost\nuser to login without a password via the local Unix socket\nfile defined by the socket system variable, as long as the\nlogin is attempted from a process owned by the operating\nsystem root user account.\nSecond, if authentication fails with the unix_socket\nauthentication plugin, then it is configured to try to use\nthe mysql_native_password authentication plugin. However, an\ninvalid password is initially set, so in order to\nauthenticate this way, a password must be set with SET\nPASSWORD.\nHowever, just using the unix_socket authentication plugin\nmay be fine for many users, and it is very secure. You may\nwant to try going without password authentication to see how\nwell it works for you. Remember, the best way to keep your\npassword safe is not to have one!\n \nAll user accounts, passwords, and global privileges are now\nstored in the mysql.global_priv table. The mysql.user table\nstill exists and has exactly the same set of columns as\nbefore, but it’s now a view that references the\nmysql.global_priv table. Tools that analyze the mysql.user\ntable should continue to workas before.\nMariaDB 10.4 supports User Password Expiry, which is not\nactive by default.\n \nDescription\n----------- \nAs a result of the above changes, the open-for-everyone\nall-powerful root account is finally gone. And installation\nscripts will no longer demand that you “PLEASE REMEMBER TO\nSET A PASSWORD FOR THE MariaDB root USER !â€, because the\nroot account is securely created automatically.\n \nTwo all-powerful accounts are created by default — root\nand the OS user that owns the data directory, typically\nmysql. They are created as:\n \nCREATE USER root@localhost IDENTIFIED VIA unix_socket OR\nmysql_native_password USING \'invalid\'\nCREATE USER mysql@localhost IDENTIFIED VIA unix_socket OR\nmysql_native_password USING \'invalid\'\n \nUsing unix_socket means that if you are the system root\nuser, you can login as root@locahost without a password.\nThis technique was pioneered by Otto Kekäläinen in Debian\nMariaDB packages and has been successfully used in Debian\nsince as early as MariaDB 10.0. \n \nIt is based on a simple fact that asking the system root for\na password adds no extra security — root has full access\nto all the data files and all process memory anyway. But not\nasking for a password means, there is no root password to\nforget (no need for the numerous tutorials on “how to\nreset MariaDB root passwordâ€). And if you want to script\nsome tedious database work, there is no need to store the\nroot password in plain text for the scipt to use (no need\nfor debian-sys-maint user).\n \nStill, some users may wish to log in as MariaDB root without\nusing sudo. Hence the old authentication method —\nconventional MariaDB password — is still available. By\ndefault it is disabled (“invalid†is not a valid\npassword hash), but one can set the password with a usual\nSET PASSWORD statement. And still retain the password-less\naccess via sudo.\n \nIf you install MariaDB locally (say from a tarball, you\nwould not want to use sudo to be able to login. This is why\nMariaDB creates a second all-powerful user with the same\nname as a system user that owns the data directory. In local\n(not system-wide) installations, this will be the user who\ninstalled MariaDB — they automatically get convenient\npassword-less root-like access, because they can access all\nthe data files anyway.\n \nEven if MariaDB is installed system-wide, you may not want\nto run your database maintenance scripts as system root —\nnow you can run them as system mysql user. And you will know\nthat they will never destroy your entire system, even if you\nmake a typo in a shell script.\n \nHowever, seasoned MariaDB DBAs who are used to the old ways\ndo need to makes some changes. See the examples below for\ncommon tasks. \n \nCookbook\n \nAfter installing MariaDB system-wide the first thing\nyou’ve got used to doing is logging in into the\nunprotected root account and protecting it, that is, setting\nthe root password:\n \n$ sudo dnf install MariaDB-server\n$ mysql -uroot\n...\nMariaDB> set password = password(\"XH4VmT3_jt\");\n \nThis is not only unnecessary now, it will simply not work\n— there is no unprotected root account. To login as root\nuse\n \n$ sudo dnf install MariaDB-server\n$ sudo mysql\n \nNote that it implies you are connecting via the unix socket,\nnot tcp. If you happen to have protocol=tcp in a system-wide\n/etc/my.cnf file, use sudo mysql --protocol=socket.\n \nAfter installing MariaDB locally you’ve also used to\nconnect to the unprotected root account using mysql -uroot.\nThis will not work either, simply use mysql without\nspecifying a username.\n \nIf you\'ve forgotten your root password, no problem — you\ncan still connect using sudo and change the password. And if\nyou\'ve also removed unix_socket authentication, to restore\naccess do as follows:\nrestart MariaDB with --skip-grant-tables\nlogin into the unprotected server\nrun FLUSH PRIVILEGES (note, before 10.4 this would’ve been\nthe last step, not anymore). This disables\n--skip-grant-tables and allows you to change the stored\nauthentication method.\nrun SET PASSWORD FOR root@localhost to change the root\npassword\n \nTo view inside privilege tables, the old mysql.user table\nstill exists. You can select from it as before, although you\ncannot update it anymore. It doesn’t show alternative\nauthentication plugins and this was one of the reasons for\nswitching to the mysql.global_priv table — complex\nauthentication rules did not fit into rigid structure of a\nrelational table. You can select from the new table, for\nexample: \n \nselect concat(user, \'@\', host, \' => \',\njson_detailed(priv)) from mysql.global_priv;\n \nReverting to the Previous Authentication Method for\nroot@localhost\n \nIf you don\'t want the root@localhost user account created\nby mysql_install_db to use unix_socket authentication by\ndefault, then there are a few ways to revert to the previous\nmysql_native_password authentication method for this user\naccount.\n \nConfiguring mysql_install_db to Revert to the Previous\nAuthentication Method\n \nOne way to revert to the previous mysql_native_password\nauthentication method for the root@localhost user account is\nto execute mysql_install_db with a special option. If\nmysql_install_db is executed while\n--auth-root-authentication-method=normal is specified, then\nit will create the default user accounts using the default\nbehavior of MariaDB 10.3 and before.\n \nThis means that the root@localhost user account will use\nmysql_native_password authentication by default. There are\nsome other differences as well. See mysql_install_db: User\nAccounts Created by Default for more information.\n \nFor example, the option can be set on the command-line while\nrunning mysql_install_db:\n \nmysql_install_db --user=mysql --datadir=/var/lib/mysql\n--auth-root-authentication-method=normal\n \nThe option can also be set in an option file in an option\ngroup supported by mysql_install_db. For example:\n \n[mysql_install_db]\nauth_root_authentication_method=normal\n \nIf the option is set in an option file and if\nmysql_install_db is executed, then mysql_install_db will\nread this option from the option file, and it will\nautomatically set this option.\n \nAltering the User Account to Revert to the Previous\nAuthentication Method\n \nIf you have already installed MariaDB, and if the\nroot@localhost user account is already using unix_socket\nauthentication, then you can revert to the old\nmysql_native_password authentication method for the user\naccount by executing the following:\n \nALTER USER root@localhost IDENTIFIED VIA\nmysql_native_password USING PASSWORD(\"verysecret\")\n \n\n\nURL:\nhttps://mariadb.com/kb/en/library/authentication-from-mariadb-104/','','https://mariadb.com/kb/en/library/authentication-from-mariadb-104/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (118,10,'CREATE USER','Syntax\n------ \nCREATE [OR REPLACE] USER [IF NOT EXISTS] \n user_specification [,user_specification ...] \n [REQUIRE {NONE | tls_option [[AND] tls_option ...] }]\n [WITH resource_option [resource_option ...] ]\n [password_option | lock_option] \n \nuser_specification:\n username [authentication_option]\n \nauthentication_option:\n IDENTIFIED BY \'password\' \n | IDENTIFIED BY PASSWORD \'password_hash\'\n | IDENTIFIED {VIA|WITH} authentication_rule [OR\nauthentication_rule ...]\n \nauthentication_rule:\n authentication_plugin\n | authentication_plugin {USING|AS}\n\'authentication_string\'\n | authentication_plugin {USING|AS} PASSWORD(\'password\')\n \ntls_option:\n SSL \n | X509\n | CIPHER \'cipher\'\n | ISSUER \'issuer\'\n | SUBJECT \'subject\'\n \nresource_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 | MAX_STATEMENT_TIME time\n \npassword_option:\n PASSWORD EXPIRE\n | PASSWORD EXPIRE DEFAULT\n | PASSWORD EXPIRE NEVER\n | PASSWORD EXPIRE INTERVAL N DAY\n \nlock_option:\n ACCOUNT LOCK\n | ACCOUNT UNLOCK\n}\n \nDescription\n----------- \nThe CREATE USER statement creates new MariaDB accounts. To\nuse it, you must have the global CREATE USER privilege or\nthe INSERT privilege for the mysql database. For each\naccount, CREATE USER creates a new row in\nthe mysql.user table that has no privileges.\n \nIf any of the specified accounts, or any permissions for the\nspecified accounts, already exist, then the server returns\nERROR 1396 (HY000). If an error occurs, CREATE USER will\nstill create the accounts that do not result in an error.\nOnly one error is produced for all users which have not been\ncreated:\n \nERROR 1396 (HY000): \n Operation CREATE USER failed for \'u1\'@\'%\',\'u2\'@\'%\'\n \nCREATE USER, DROP USER, CREATE ROLE, and DROP ROLE all\nproduce the\nsame error code when they fail.\n \nSee Account Names below for details on how account names are\nspecified. \n \nOR REPLACE\n \nIf the optional OR REPLACE clause is used, it is basically a\nshortcut for:\n \nDROP USER IF EXISTS name;\n \nCREATE USER name ...;\n \nFor example:\n \nCREATE USER foo2@test IDENTIFIED BY \'password\';\n \nERROR 1396 (HY000): Operation CREATE USER failed for\n\'foo2\'@\'test\'\n \nCREATE OR REPLACE USER foo2@test IDENTIFIED BY \'password\';\n \nQuery OK, 0 rows affected (0.00 sec)\n \nIF NOT EXISTS\n \nWhen the IF NOT EXISTS clause is used, MariaDB will return a\nwarning instead of an error if the specified user already\nexists.\n \nFor example:\n \nCREATE USER foo2@test IDENTIFIED BY \'password\';\n \nERROR 1396 (HY000): Operation CREATE USER failed for\n\'foo2\'@\'test\'\n \nCREATE USER IF NOT EXISTS foo2@test IDENTIFIED BY\n\'password\';\n \nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+-------+------+----------------------------------------------------+\n| Level | Code | Message |\n+-------+------+----------------------------------------------------+\n| Note | 1973 | Can\'t create user \'foo2\'@\'test\';\n it already exists |\n+-------+------+----------------------------------------------------+\n1 row in set (0.00 sec\n \nAuthentication Options\n \nIDENTIFIED BY \'password\'\n \nThe optional IDENTIFIED BY clause can be used to provide an\naccount with a password. The password should be specified in\nplain text. It will be hashed by the PASSWORD function prior\nto being stored to the mysql.user table.\n \nFor example, if our password is mariadb, then we can create\nthe user with:\n \nCREATE USER foo2@test IDENTIFIED BY \'mariadb\';\n \nIf you do not specify a password with the IDENTIFIED BY\nclause, the user\nwill be able to connect without a password. A blank password\nis not a wildcard\nto match any password. The user must connect without\nproviding a password if no\npassword is set.\n \nThe only authentication plugins that this clause supports\nare mysql_native_password and mysql_old_password.\n \nIDENTIFIED BY PASSWORD \'password_hash\'\n \nThe optional IDENTIFIED BY PASSWORD clause can be used to\nprovide an account with a password that has already been\nhashed. The password should be specified as a hash that was\nprovided by the PASSWORD function. It will be stored to the\nmysql.user table as-is.\n \nFor example, if our password is mariadb, then we can find\nthe hash with:\n \nSELECT PASSWORD(\'mariadb\');\n+-------------------------------------------+\n| PASSWORD(\'mariadb\') |\n+-------------------------------------------+\n| *54958E764CE10E50764C2EECBB71D01F08549980 |\n+-------------------------------------------+\n1 row in set (0.00 sec)\n \nAnd then we can create a user with the hash:\n \nCREATE USER foo2@test IDENTIFIED BY PASSWORD\n\'*54958E764CE10E50764C2EECBB71D01F08549980\';\n \nIf you do not specify a password with the IDENTIFIED BY\nclause, the user\nwill be able to connect without a password. A blank password\nis not a wildcard\nto match any password. The user must connect without\nproviding a password if no\npassword is set.\n \nThe only authentication plugins that this clause supports\nare mysql_native_password and mysql_old_password.\n \nIDENTIFIED {VIA|WITH} authentication_plugin\n \nThe optional IDENTIFIED VIA authentication_plugin allows you\nto specify that the account should be authenticated by a\nspecific authentication plugin. The plugin name must be an\nactive authentication plugin as per SHOW PLUGINS. If it\ndoesn\'t show up in that output, then you will need to\ninstall it with INSTALL PLUGIN or INSTALL SONAME.\n \nFor example, this could be used with the PAM authentication\nplugin:\n \nCREATE USER foo2@test IDENTIFIED VIA pam;\n \nSome authentication plugins allow additional arguments to be\nspecified after a USING or AS keyword. For example, the PAM\nauthentication plugin accepts a service name:\n \nCREATE USER foo2@test IDENTIFIED VIA pam USING \'mariadb\';\n \nThe exact meaning of the additional argument would depend on\nthe specific authentication plugin.\n \nThe USING or AS keyword can also be used to provide a\nplain-text password to a plugin if it\'s provided as an\nargument to the PASSWORD() function. This is only valid for\nauthentication plugins that have implemented a hook for the\nPASSWORD() function. For example, the ed25519 authentication\nplugin supports this:\n \nCREATE USER safe@\'%\' IDENTIFIED VIA ed25519 USING\nPASSWORD(\'secret\');\n \nOne can specify many authentication plugins, they all works\nas alternatives ways of authenticating a user:\n \nCREATE USER safe@\'%\' IDENTIFIED VIA ed25519 USING\nPASSWORD(\'secret\') OR unix_socket;\n \nTLS Options\n \nBy default, MariaDB transmits data between the server and\nclients without encrypting it. This is generally acceptable\nwhen the server and client run on the same host or in\nnetworks where security is guaranteed through other means.\nHowever, in cases where the server and client exist on\nseparate networks or they are in a high-risk network, the\nlack of encryption does introduce security concerns as a\nmalicious actor could potentially eavesdrop on the traffic\nas it is sent over the network between them.\n \nTo mitigate this concern, MariaDB allows you to encrypt data\nin transit between the server and clients using the\nTransport Layer Security (TLS) protocol. TLS was formerly\nknown as Secure Socket Layer (SSL), but strictly speaking\nthe SSL protocol is a predecessor to TLS and, that version\nof the protocol is now considered insecure. The\ndocumentation still uses the term SSL often and for\ncompatibility reasons TLS-related server system and status\nvariables still use the prefix ssl_, but internally, MariaDB\nonly supports its secure successors.\n \nSee Secure Connections Overview for more information about\nhow to determine whether your MariaDB server has TLS\nsupport.\n \nYou can set certain TLS-related restrictions for specific\nuser accounts. For instance, you might use this with user\naccounts that require access to sensitive data while sending\nit across networks that you do not control. These\nrestrictions can be enabled for a user account with the\nCREATE USER, ALTER USER, or GRANT statements. The following\noptions are available:\n \nOption | Description | \n \nREQUIRE NONE | TLS is not required for this account, but can\nstill be used. | \n \nREQUIRE SSL | The account must use TLS, but no valid X509\ncertificate is required. This option cannot be combined with\nother TLS options. | \n \nREQUIRE X509 | The account must use TLS and must have a\nvalid X509 certificate. This option implies REQUIRE SSL.\nThis option cannot be combined with other TLS options. | \n \nREQUIRE ISSUER \'issuer\' | The account must use TLS and\nmust have a valid X509 certificate. Also, the Certificate\nAuthority must be the one specified via the string issuer.\nThis option implies REQUIRE X509. This option can be\ncombined with the SUBJECT, and CIPHER options in any order.\n| \n \nREQUIRE SUBJECT \'subject\' | The account must use TLS and\nmust have a valid X509 certificate. Also, the certificate\'s\nSubject must be the one specified via the string subject.\nThis option implies REQUIRE X509. This option can be\ncombined with the ISSUER, and CIPHER options in any order. |\n\n \nREQUIRE CIPHER \'cipher\' | The account must use TLS, but no\nvalid X509 certificate is required. Also, the encryption\nused for the connection must use one of the methods\nspecified in the string cipher. This option implies REQUIRE\nSSL. This option can be combined with the ISSUER, and\nSUBJECT options in any order. | \n \nThe REQUIRE keyword must be used only once for all specified\noptions, and the AND keyword can be used to separate\nindividual options, but it is not required.\n \nFor example, you can create a user account that requires\nthese TLS options with the following:\n \nCREATE USER \'alice\'@\'%\'\n REQUIRE SUBJECT \'/CN=alice/O=My Dom,\nInc./C=US/ST=Oregon/L=Portland\'\n AND ISSUER \'/C=FI/ST=Somewhere/L=City/ O=Some\nCompany/CN=Peter Parker/emailAddress=p.parker@marvel.com\'\n AND CIPHER \'TLSv1.2\';\n \nIf any of these options are set for a specific user account,\nthen any client who tries to connect with that user account\nwill have to be configured to connect with TLS.\n \nSee Securing Connections for Client and Server for\ninformation on how to enable TLS on the client and server.\n \nResource Limit Options\n \nMariaDB 10.2.0 introduced a number of resource limit\noptions.\n \nIt is possible to set per-account limits for certain server\nresources. The following table shows the values that can be\nset per account:\n \nLimit Type | Decription | \n \nMAX_QUERIES_PER_HOUR | Number of statements that the account\ncan issue per hour (including updates) | \n \nMAX_UPDATES_PER_HOUR | Number of updates (not queries) that\nthe account can issue per hour | \n \nMAX_CONNECTIONS_PER_HOUR | Number of connections that the\naccount can start per hour | \n \nMAX_USER_CONNECTIONS | Number of simultaneous connections\nthat can be accepted from the same account; if it is 0,\nmax_connections will be used instead; if max_connections is\n0, there is no limit for this account\'s simultaneous\nconnections. | \n \nMAX_STATEMENT_TIME | Timeout, in seconds, for statements\nexecuted by the user. See also Aborting Statements that\nExceed a Certain Time to Execute. | \n \nIf any of these limits are set to 0, then there is no limit\nfor that resource for that user.\n \nHere is an example showing how to create a user with\nresource limits:\n \nCREATE USER \'someone\'@\'localhost\' WITH\n MAX_USER_CONNECTIONS 10\n MAX_QUERIES_PER_HOUR 200;\n \nThe resources are tracked per account, which means\n\'user\'@\'server\'; not per user name or per connection.\n \nThe count can be reset for all users using FLUSH\nUSER_RESOURCES, FLUSH PRIVILEGES or mysqladmin reload.\n \nPer account resource limits are stored in the user table, in\nthe mysql database. Columns used for resources limits are\nnamed max_questions, max_updates, max_connections (for\nMAX_CONNECTIONS_PER_HOUR), and max_user_connections (for\nMAX_USER_CONNECTIONS).\n \nAccount Names\n \nAccount names have both a user name component and a host\nname component, and are specified as\n\'user_name\'@\'host_name\'.\n \nThe user name and host name may be unquoted, quoted as\nstrings using double quotes (\") or\nsingle quotes (\'), or quoted as identifiers using backticks\n(`). You must use quotes\nwhen using special characters (such as a hyphen) or wildcard\ncharacters. If you quote, you \nmust quote the user name and host name separately (for\nexample \'user_name\'@\'host_name\').\n \nHost Name Component\n \nIf the host name is not provided, it is assumed to be \'%\'.\n \nHost names may contain the wildcard characters % and _. They\nare matched as if by\nthe LIKE clause. If you need to use a wildcard character\nliterally (for example, to\nmatch a domain name with an underscore), prefix the\ncharacter with a backslash. See LIKE\nfor more information on escaping wildcard characters.\n \nHost name matches are case-insensitive. Host names can match\neither domain names or IP\naddresses. Use \'localhost\' as the host name to allow only\nlocal client connections.\n \nYou can use a netmask to match a range of IP addresses using\n\'base_ip/netmask\' as the\nhost name. A user with an IP address ip_addr will be allowed\nto connect if the following\ncondition is true:\n \nip_addr & netmask = base_ip\n \nYou can only use netmasks that specify a multiple of 8 bits\nof the address to match. That is,\nonly the following netmasks are allowed:\n \n255.0.0.0\n255.255.0.0\n255.255.255.0\n255.255.255.255\n \nUsing 255.255.255.255 is equivalent to not using a netmask\nat all.\n \nUser Name Component\n \nUser names must match exactly, including case. A user name\nthat is empty is known as an anonymous account and is\nallowed to match a login attempt with any user name\ncomponent. These are described more in the next section.\n \nFor valid identifiers to use as user names, see Identifier\nNames.\n \nIt is possible for more than one account to match when a\nuser connects. MariaDB selects\nthe first matching account after sorting according to the\nfollowing criteria:\nAccounts with an exact host name are sorted before accounts\nusing a wildcard in the\nhost name. Host names using a netmask are considered to be\nexact for sorting.\nAccounts with a wildcard in the host name are sorted\naccording to the position of\nthe first wildcard character. Those with a wildcard\ncharacter later in the host name\nsort before those with a wildcard character earlier in the\nhost name.\nAccounts with a non-empty user name sort before accounts\nwith an empty user name.\nAccounts with an empty user name are sorted last. As\nmentioned previously, these are known as anonymous accounts.\nThese are described more in the next section.\n \nThe following table shows a list of example account as\nsorted by these criteria:\n \n+---------+-------------+\n| User | Host |\n+---------+-------------+\n| joffrey | 192.168.0.3 |\n| | 192.168.0.% |\n| joffrey | 192.168.% |\n| | 192.168.% |\n+---------+-------------+\n \nOnce connected, you only have the privileges granted to the\naccount that matched,\nnot all accounts that could have matched. For example,\nconsider the following\ncommands:\n \nCREATE USER \'joffrey\'@\'192.168.0.3\';\n \nCREATE USER \'joffrey\'@\'%\';\n \nGRANT SELECT ON test.t1 to \'joffrey\'@\'192.168.0.3\';\n \nGRANT SELECT ON test.t2 to \'joffrey\'@\'%\';\n \nIf you connect as joffrey from 192.168.0.3, you will have\nthe SELECT\nprivilege on the table test.t1, but not on the table\ntest.t2. If you connect as joffrey from any other IP\naddress, you will have the SELECT privilege on the table\ntest.t2, but not\non the table test.t1.\n \nBeginning with MariaDB 5.5.31, usernames can be up to 80\ncharacters long. From MariaDB 10.0 the system tables are all\nby default this length. However, in order to enable this\nfeature in MariaDB 5.5, the following schema changes must be\nmade:\n \nALTER TABLE mysql.user MODIFY User CHAR(80) BINARY NOT NULL\nDEFAULT \'\';\n \nALTER TABLE mysql.db MODIFY User CHAR(80) BINARY NOT NULL\nDEFAULT \'\';\n \nALTER TABLE mysql.tables_priv MODIFY User CHAR(80) BINARY\nNOT NULL DEFAULT \'\';\n \nALTER TABLE mysql.columns_priv MODIFY User CHAR(80) BINARY\nNOT NULL DEFAULT \'\';\n \nALTER TABLE mysql.procs_priv MODIFY User CHAR(80) BINARY NOT\nNULL DEFAULT \'\';\n \nALTER TABLE mysql.proc MODIFY definer CHAR(141) COLLATE\nutf8_bin NOT NULL DEFAULT \'\';\n \nALTER TABLE mysql.event MODIFY definer CHAR(141) COLLATE\nutf8_bin NOT NULL DEFAULT \'\';\n \nALTER TABLE mysql.proxies_priv MODIFY User CHAR(80) COLLATE\nutf8_bin NOT NULL DEFAULT \'\';\n \nALTER TABLE mysql.proxies_priv MODIFY Proxied_user CHAR(80)\nCOLLATE utf8_bin NOT NULL DEFAULT \'\';\n \nALTER TABLE mysql.proxies_priv MODIFY Grantor CHAR(141)\nCOLLATE utf8_bin NOT NULL DEFAULT \'\';\n \nALTER TABLE mysql.servers MODIFY Username CHAR(80) NOT NULL\nDEFAULT \'\';\n \nALTER TABLE mysql.procs_priv MODIFY Grantor CHAR(141)\nCOLLATE utf8_bin NOT NULL DEFAULT \'\';\n \nALTER TABLE mysql.tables_priv MODIFY Grantor CHAR(141)\nCOLLATE utf8_bin NOT NULL DEFAULT \'\';\n \nFLUSH PRIVILEGES;\n \nAnonymous Accounts\n \nAnonymous accounts are accounts where the user name portion\nof the account name is empty. These accounts act as special\ncatch-all accounts. If a user attempts to log into the\nsystem from a host, and an anonymous account exists with a\nhost name portion that matches the user\'s host, then the\nuser will log in as the anonymous account if there is no\nmore specific account match for the user name that the user\nentered.\n \nFor example, here are some anonymous accounts:\n \nCREATE USER \'\'@\'localhost\';\n \nCREATE USER \'\'@\'192.168.0.3\';\n \nFixing a Legacy Default Anonymous Account\n \nOn some systems, the mysql.db table has some entries for the\n\'\'@\'%\' anonymous account by default. Unfortunately,\nthere is no matching entry in the mysql.user table, which\nmeans that this anonymous account doesn\'t exactly exist,\nbut it does have privileges--usually on the default test\ndatabase created by mysql_install_db. These account-less\nprivileges are a legacy that is leftover from a time when\nMySQL\'s privilege system was less advanced.\n \nThis situation means that you will run into errors if you\ntry to create a \'\'@\'%\' account. For example:\n \nCREATE USER \'\'@\'%\';\n \nERROR 1396 (HY000): Operation CREATE USER failed for\n\'\'@\'%\'\n \nThe fix is to DELETE the row in the mysql.db table and then\nexecute FLUSH PRIVILEGES:\n \nDELETE FROM mysql.db WHERE User=\'\' AND Host=\'%\';\n \nFLUSH PRIVILEGES;\n \nAnd then the account can be created:\n \nCREATE USER \'\'@\'%\';\n \nQuery OK, 0 rows affected (0.01 sec)\n \nSee MDEV-13486 for more information.\n \nPassword Expiry\n \nBesides automatic password expiry, as determined by\ndefault_password_lifetime, password expiry times can be set\non an individual user basis, overriding the global setting,\nfor example:\n \nCREATE USER \'monty\'@\'localhost\' PASSWORD EXPIRE INTERVAL\n120 DAY;\n \nSee User Password Expiry for more details.\n \nAccount Locking\n \nAccount locking permits privileged administrators to\nlock/unlock user accounts. No new client connections will be\npermitted if an account is locked (existing connections are\nnot affected). For example:\n \nCREATE USER \'marijn\'@\'localhost\' ACCOUNT LOCK;\n \nSee Account Locking','','https://mariadb.com/kb/en/library/create-user/');
+update help_topic set description = CONCAT(description, ' for more details.\n \n\n\nURL: https://mariadb.com/kb/en/library/create-user/') WHERE help_topic_id = 118;
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (119,10,'ALTER USER','The ALTER USER statement was introduced in MariaDB 10.2.0.\n \nSyntax\n------ \nALTER USER [IF EXISTS] \n user_specification [,user_specification] ...\n [REQUIRE {NONE | tls_option [[AND] tls_option] ...}]\n [WITH resource_option [resource_option] ...]\n [password_option | lock_option] \n \nuser_specification:\n username [authentication_option]\n \nauthentication_option:\n IDENTIFIED BY \'password\' \n | IDENTIFIED BY PASSWORD \'password_hash\'\n | IDENTIFIED {VIA|WITH} authentication_plugin\n | IDENTIFIED {VIA|WITH} authentication_plugin {USING|AS}\n\'authentication_string\'\n | IDENTIFIED {VIA|WITH} authentication_plugin {USING|AS}\nPASSWORD(\'password\')\n \ntls_option\n SSL \n | X509\n | CIPHER \'cipher\'\n | ISSUER \'issuer\'\n | SUBJECT \'subject\'\n \nresource_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 | MAX_STATEMENT_TIME time\n \npassword_option:\n PASSWORD EXPIRE\n | PASSWORD EXPIRE DEFAULT\n | PASSWORD EXPIRE NEVER\n | PASSWORD EXPIRE INTERVAL N DAY\n \nlock_option:\n ACCOUNT LOCK\n | ACCOUNT UNLOCK\n}\n \nDescription\n----------- \nThe ALTER USER statement modifies existing MariaDB accounts.\nTo use it, you must have the global CREATE USER privilege or\nthe UPDATE privilege for the mysql database. The global\nSUPER privilege is also required if the read_only system\nvariable is enabled.\n \nIf any of the specified user accounts do not yet exist, an\nerror results. If an error occurs, ALTER USER will still\nmodify the accounts that do not result in an error. Only one\nerror is produced for all users which have not been\nmodified.\n \nIF EXISTS\n \nWhen the IF EXISTS clause is used, MariaDB will return a\nwarning instead of an error for each specified user that\ndoes not exist.\n \nAccount Names\n \nFor ALTER USER statements, account names are specified as\nthe username argument in the same way as they are for CREATE\nUSER statements. See account names from the CREATE USER page\nfor details on how account names are specified.\n \nCURRENT_USER or CURRENT_USER() can also be used to alter the\naccount logged into the current session. For example, to\nchange the current user\'s password to mariadb:\n \nALTER USER CURRENT_USER() IDENTIFIED BY \'mariadb\';\n \nAuthentication Options\n \nIDENTIFIED BY \'password\'\n \nThe optional IDENTIFIED BY clause can be used to provide an\naccount with a password. The password should be specified in\nplain text. It will be hashed by the PASSWORD function prior\nto being stored to the mysql.user table.\n \nFor example, if our password is mariadb, then we can set the\naccount\'s password with:\n \nALTER USER foo2@test IDENTIFIED BY \'mariadb\';\n \nIf you do not specify a password with the IDENTIFIED BY\nclause, the user\nwill be able to connect without a password. A blank password\nis not a wildcard\nto match any password. The user must connect without\nproviding a password if no\npassword is set.\n \nThe only authentication plugins that this clause supports\nare mysql_native_password and mysql_old_password.\n \nIDENTIFIED BY PASSWORD \'password_hash\'\n \nThe optional IDENTIFIED BY PASSWORD clause can be used to\nprovide an account with a password that has already been\nhashed. The password should be specified as a hash that was\nprovided by the PASSWORD function. It will be stored to the\nmysql.user table as-is.\n \nFor example, if our password is mariadb, then we can find\nthe hash with:\n \nSELECT PASSWORD(\'mariadb\');\n+-------------------------------------------+\n| PASSWORD(\'mariadb\') |\n+-------------------------------------------+\n| *54958E764CE10E50764C2EECBB71D01F08549980 |\n+-------------------------------------------+\n1 row in set (0.00 sec)\n \nAnd then we can set an account\'s password with the hash:\n \nALTER USER foo2@test IDENTIFIED BY PASSWORD\n\'*54958E764CE10E50764C2EECBB71D01F08549980\';\n \nIf you do not specify a password with the IDENTIFIED BY\nclause, the user\nwill be able to connect without a password. A blank password\nis not a wildcard\nto match any password. The user must connect without\nproviding a password if no\npassword is set.\n \nThe only authentication plugins that this clause supports\nare mysql_native_password and mysql_old_password.\n \nIDENTIFIED {VIA|WITH} authentication_plugin\n \nThe optional IDENTIFIED VIA authentication_plugin allows you\nto specify that the account should be authenticated by a\nspecific authentication plugin. The plugin name must be an\nactive authentication plugin as per SHOW PLUGINS. If it\ndoesn\'t show up in that output, then you will need to\ninstall it with INSTALL PLUGIN or INSTALL SONAME.\n \nFor example, this could be used with the PAM authentication\nplugin:\n \nALTER USER foo2@test IDENTIFIED VIA pam;\n \nSome authentication plugins allow additional arguments to be\nspecified after a USING or AS keyword. For example, the PAM\nauthentication plugin accepts a service name:\n \nALTER USER foo2@test IDENTIFIED VIA pam USING \'mariadb\';\n \nThe exact meaning of the additional argument would depend on\nthe specific authentication plugin.\n \nIn MariaDB 10.4 and later, the USING or AS keyword can also\nbe used to provide a plain-text password to a plugin if\nit\'s provided as an argument to the PASSWORD() function.\nThis is only valid for authentication plugins that have\nimplemented a hook for the PASSWORD() function. For example,\nthe ed25519 authentication plugin supports this:\n \nALTER USER safe@\'%\' IDENTIFIED VIA ed25519 USING\nPASSWORD(\'secret\');\n \nTLS Options\n \nBy default, MariaDB transmits data between the server and\nclients without encrypting it. This is generally acceptable\nwhen the server and client run on the same host or in\nnetworks where security is guaranteed through other means.\nHowever, in cases where the server and client exist on\nseparate networks or they are in a high-risk network, the\nlack of encryption does introduce security concerns as a\nmalicious actor could potentially eavesdrop on the traffic\nas it is sent over the network between them.\n \nTo mitigate this concern, MariaDB allows you to encrypt data\nin transit between the server and clients using the\nTransport Layer Security (TLS) protocol. TLS was formerly\nknown as Secure Socket Layer (SSL), but strictly speaking\nthe SSL protocol is a predecessor to TLS and, that version\nof the protocol is now considered insecure. The\ndocumentation still uses the term SSL often and for\ncompatibility reasons TLS-related server system and status\nvariables still use the prefix ssl_, but internally, MariaDB\nonly supports its secure successors.\n \nSee Secure Connections Overview for more information about\nhow to determine whether your MariaDB server has TLS\nsupport.\n \nYou can set certain TLS-related restrictions for specific\nuser accounts. For instance, you might use this with user\naccounts that require access to sensitive data while sending\nit across networks that you do not control. These\nrestrictions can be enabled for a user account with the\nCREATE USER, ALTER USER, or GRANT statements. The following\noptions are available:\n \nOption | Description | \n \nREQUIRE NONE | TLS is not required for this account, but can\nstill be used. | \n \nREQUIRE SSL | The account must use TLS, but no valid X509\ncertificate is required. This option cannot be combined with\nother TLS options. | \n \nREQUIRE X509 | The account must use TLS and must have a\nvalid X509 certificate. This option implies REQUIRE SSL.\nThis option cannot be combined with other TLS options. | \n \nREQUIRE ISSUER \'issuer\' | The account must use TLS and\nmust have a valid X509 certificate. Also, the Certificate\nAuthority must be the one specified via the string issuer.\nThis option implies REQUIRE X509. This option can be\ncombined with the SUBJECT, and CIPHER options in any order.\n| \n \nREQUIRE SUBJECT \'subject\' | The account must use TLS and\nmust have a valid X509 certificate. Also, the certificate\'s\nSubject must be the one specified via the string subject.\nThis option implies REQUIRE X509. This option can be\ncombined with the ISSUER, and CIPHER options in any order. |\n\n \nREQUIRE CIPHER \'cipher\' | The account must use TLS, but no\nvalid X509 certificate is required. Also, the encryption\nused for the connection must use one of the methods\nspecified in the string cipher. This option implies REQUIRE\nSSL. This option can be combined with the ISSUER, and\nSUBJECT options in any order. | \n \nThe REQUIRE keyword must be used only once for all specified\noptions, and the AND keyword can be used to separate\nindividual options, but it is not required.\n \nFor example, you can alter a user account to require these\nTLS options with the following:\n \nALTER USER \'alice\'@\'%\'\n REQUIRE SUBJECT \'/CN=alice/O=My Dom,\nInc./C=US/ST=Oregon/L=Portland\'\n AND ISSUER \'/C=FI/ST=Somewhere/L=City/ O=Some\nCompany/CN=Peter Parker/emailAddress=p.parker@marvel.com\'\n AND CIPHER \'TLSv1.2\';\n \nIf any of these options are set for a specific user account,\nthen any client who tries to connect with that user account\nwill have to be configured to connect with TLS.\n \nSee Securing Connections for Client and Server for\ninformation on how to enable TLS on the client and server.\n \nResource Limit Options\n \nMariaDB 10.2.0 introduced a number of resource limit\noptions.\n \nIt is possible to set per-account limits for certain server\nresources. The following table shows the values that can be\nset per account:\n \nLimit Type | Decription | \n \nMAX_QUERIES_PER_HOUR | Number of statements that the account\ncan issue per hour (including updates) | \n \nMAX_UPDATES_PER_HOUR | Number of updates (not queries) that\nthe account can issue per hour | \n \nMAX_CONNECTIONS_PER_HOUR | Number of connections that the\naccount can start per hour | \n \nMAX_USER_CONNECTIONS | Number of simultaneous connections\nthat can be accepted from the same account; if it is 0,\nmax_connections will be used instead; if max_connections is\n0, there is no limit for this account\'s simultaneous\nconnections. | \n \nMAX_STATEMENT_TIME | Timeout, in seconds, for statements\nexecuted by the user. See also Aborting Statements that\nExceed a Certain Time to Execute. | \n \nIf any of these limits are set to 0, then there is no limit\nfor that resource for that user.\n \nHere is an example showing how to set an account\'s resource\nlimits:\n \nALTER USER \'someone\'@\'localhost\' WITH\n MAX_USER_CONNECTIONS 10\n MAX_QUERIES_PER_HOUR 200;\n \nThe resources are tracked per account, which means\n\'user\'@\'server\'; not per user name or per connection.\n \nThe count can be reset for all users using FLUSH\nUSER_RESOURCES, FLUSH PRIVILEGES or mysqladmin reload.\n \nPer account resource limits are stored in the user table, in\nthe mysql database. Columns used for resources limits are\nnamed max_questions, max_updates, max_connections (for\nMAX_CONNECTIONS_PER_HOUR), and max_user_connections (for\nMAX_USER_CONNECTIONS).\n \nPassword Expiry\n \nBesides automatic password expiry, as determined by\ndefault_password_lifetime, password expiry times can be set\non an individual user basis, overriding the global setting,\nfor example:\n \nALTER USER \'monty\'@\'localhost\' PASSWORD EXPIRE INTERVAL\n120 DAY;\n \nALTER USER \'monty\'@\'localhost\' PASSWORD EXPIRE NEVER;\n \nALTER USER \'monty\'@\'localhost\' PASSWORD EXPIRE DEFAULT;\n \nSee User Password Expiry for more details.\n \nAccount Locking\n \nAccount locking permits privileged administrators to\nlock/unlock user accounts. No new client connections will be\npermitted if an account is locked (existing connections are\nnot affected). For example:\n \nALTER USER \'marijn\'@\'localhost\' ACCOUNT LOCK;\n \nSee Account Locking for more details.\n \n\n\nURL: https://mariadb.com/kb/en/library/alter-user/','','https://mariadb.com/kb/en/library/alter-user/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (120,10,'DROP USER','Syntax\n------ \nDROP USER [IF EXISTS] user_name [, user_name] ...\n \nDescription\n----------- \nThe DROP USER statement removes one or more MariaDB\naccounts. It removes\nprivilege rows for the account from all grant tables. To use\nthis statement,\nyou must have the global CREATE USER privilege\nor the DELETE privilege for the mysql database.\nEach account is named using the same format as for the\nCREATE USER\nstatement; for example, \'jeffrey\'@\'localhost\'. If you\nspecify\nonly the user name part of the account name, a host name\npart of \'%\' is\nused. For additional information about specifying account\nnames, see\nCREATE USER.\n \nNote that, if you specify an account that is currently\nconnected, it will not\nbe deleted until the connection is closed. The connection\nwill not be\nautomatically closed.\n \nIf any of the specified user accounts do not exist, ERROR\n1396 (HY000)\nresults. If an error occurs, DROP USER will still drop the\naccounts that do\nnot result in an error. Only one error is produced for all\nusers which have not\nbeen dropped:\n \nERROR 1396 (HY000): Operation DROP USER failed for\n\'u1\'@\'%\',\'u2\'@\'%\'\n \nFailed CREATE or DROP operations, for both users and roles,\nproduce the\nsame error code.\n \nIF EXISTS\n \nThe IF EXISTS clause was added in MariaDB 10.1.3\n \nIf the IF EXISTS clause is used, MariaDB will return a note\ninstead of an error if the user does not exist.\n \nExamples\n-------- \nDROP USER bob;\n \nIF EXISTS:\n \nDROP USER bob;\n \nERROR 1396 (HY000): Operation DROP USER failed for\n\'bob\'@\'%\'\n \nDROP USER IF EXISTS bob;\n \nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+-------+------+---------------------------------------------+\n| Level | Code | Message |\n+-------+------+---------------------------------------------+\n| Note | 1974 | Can\'t drop user \'bob\'@\'%\'; it doesn\'t\nexist |\n+-------+------+---------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/drop-user/','','https://mariadb.com/kb/en/library/drop-user/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (121,10,'GRANT','Syntax\n------ \nGRANT\n priv_type [(column_list)]\n [, priv_type [(column_list)]] ...\n ON [object_type] priv_level\n TO user_specification [ user_options ...]\n \nuser_specification:\n username [authentication_option]\n \nauthentication_option:\n IDENTIFIED BY \'password\' \n | IDENTIFIED BY PASSWORD \'password_hash\'\n | IDENTIFIED {VIA|WITH} authentication_rule [OR\nauthentication_rule ...]\n \nauthentication_rule:\n authentication_plugin\n | authentication_plugin {USING|AS}\n\'authentication_string\'\n | authentication_plugin {USING|AS} PASSWORD(\'password\')\n \nGRANT PROXY ON username\n TO username [, username] ...\n [WITH GRANT OPTION]\n \nuser_options:\n [REQUIRE {NONE | tls_option [[AND] tls_option] ...}]\n [WITH with_option [with_option] ...]\n \nobject_type:\n TABLE\n | FUNCTION\n | PROCEDURE\n \npriv_level:\n *\n | *.*\n | db_name.*\n | db_name.tbl_name\n | tbl_name\n | db_name.routine_name\n \nwith_option:\n GRANT OPTION\n | resource_option\n \nresource_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 | MAX_STATEMENT_TIME time\n \ntls_option:\n SSL \n | X509\n | CIPHER \'cipher\'\n | ISSUER \'issuer\'\n | SUBJECT \'subject\'\n \nDescription\n----------- \nThe GRANT statement allows you to grant privileges or roles\nto accounts. To use GRANT, you must have the GRANT OPTION\nprivilege, and you must have the privileges that you are\ngranting.\n \nUse the REVOKE statement to revoke privileges granted with\nthe GRANT statement.\n \nUse the SHOW GRANTS statement to determine what privileges\nan account has.\n \nAccount Names\n \nFor GRANT statements, account names are specified as the\nusername argument in the same way as they are for CREATE\nUSER statements. See account names from the CREATE USER page\nfor details on how account names are specified.\n \nImplicit Account Creation\n \nThe GRANT statement also allows you to implicitly create\naccounts in some cases.\n \nIf the account does not yet exist, then GRANT can implicitly\ncreate it. To implicitly create an account with GRANT, a\nuser is required to have the same privileges that would be\nrequired to explicitly create the account with the CREATE\nUSER statement.\n \nIf the NO_AUTO_CREATE_USER SQL_MODE is set, then accounts\ncan only be created if authentication information is\nspecified, or with a CREATE USER statement. If no\nauthentication information is provided, GRANT will produce\nan error when the specified account does not exist, for\nexample:\n \nshow variables like \'%sql_mode%\' ;\n+---------------+--------------------------------------------+\n| Variable_name | Value |\n+---------------+--------------------------------------------+\n| sql_mode | NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |\n+---------------+--------------------------------------------+\n \nGRANT USAGE ON *.* TO \'user123\'@\'%\' IDENTIFIED BY \'\';\nERROR 1133 (28000): Can\'t find any matching row in the user\ntable\n \nGRANT USAGE ON *.* TO \'user123\'@\'%\' IDENTIFIED VIA PAM\nusing \'mariadb\' require ssl ;\nQuery OK, 0 rows affected (0.00 sec)\n \nselect host, user from mysql.user where user=\'user123\' ;\n \n+------+----------+\n| host | user |\n+------+----------+\n| % | user123 |\n+------+----------+\n \nPrivilege Levels\n \nPrivileges can be set globally, for an entire database, for\na table or routine,\nor for individual columns in a table. Certain privileges can\nonly be set at\ncertain levels.\nGlobal privileges are granted using *.* for\npriv_level. Global privileges include privileges to\nadminister the database\nand manage user accounts, as well as privileges for all\ntables, functions, and\nprocedures. Global privileges are stored in the mysql.user\ntable.\nDatabase privileges are granted using db_name.*\nfor priv_level, or using just * to use default database.\nDatabase\nprivileges include privileges to create tables and\nfunctions, as well as\nprivileges for all tables, functions, and procedures in the\ndatabase. Database privileges are stored in the mysql.db\ntable.\nTable privileges are granted using db_name.tbl_name\nfor priv_level, or using just tbl_name to specify a table in\nthe default\ndatabase. The TABLE keyword is optional. Table privileges\ninclude the\nability to select and change data in the table. Certain\ntable privileges can\nbe granted for individual columns.\nColumn privileges are granted by specifying a table for\npriv_level and providing a column list after the privilege\ntype. They allow\nyou to control exactly which columns in a table users can\nselect and change.\nFunction privileges are granted using FUNCTION\ndb_name.routine_name\nfor priv_level, or using just FUNCTION routine_name to\nspecify a function\nin the default database.\nProcedure privileges are granted using PROCEDURE\ndb_name.routine_name\nfor priv_level, or using just PROCEDURE routine_name to\nspecify a procedure\nin the default database.\n \nThe USAGE Privilege\n \nThe USAGE privilege grants no real privileges. The SHOW\nGRANTS\nstatement will show a global USAGE privilege for a\nnewly-created user. You\ncan use USAGE with the GRANT statement to change options\nlike GRANT OPTION\nand MAX_USER_CONNECTIONS without changing any account\nprivileges.\n \nThe ALL PRIVILEGES Privilege\n \nThe ALL PRIVILEGES privilege grants all available\nprivileges. Granting all\nprivileges only affects the given privilege level. For\nexample, granting all\nprivileges on a table does not grant any privileges on the\ndatabase or globally.\n \nUsing ALL PRIVILEGES does not grant the special GRANT OPTION\nprivilege.\n \nYou can use ALL instead of ALL PRIVILEGES.\n \nThe GRANT OPTION Privilege\n \nUse the WITH GRANT OPTION clause to give users the ability\nto grant privileges\nto other users at the given privilege level. Users with the\nGRANT OPTION privilege can\nonly grant privileges they have. They cannot grant\nprivileges at a higher privilege level than\nthey have the GRANT OPTION privilege.\n \nThe GRANT OPTION privilege cannot be set for individual\ncolumns.\nIf you use WITH GRANT OPTION when specifying column\nprivileges,\nthe GRANT OPTION privilege will be granted for the entire\ntable.\n \nUsing the WITH GRANT OPTION clause is equivalent to listing\nGRANT OPTION\nas a privilege.\n \nGlobal Privileges\n \nThe following table lists the privileges that can be granted\nglobally. You can\nalso grant all database, table, and function privileges\nglobally. When granted\nglobally, these privileges apply to all databases, tables,\nor functions,\nincluding those created later.\n \nTo set a global privilege, use *.* for priv_level.\n \nPrivilege | Description | \n \nCREATE USER | Create a user using the CREATE USER statement,\nor implicitly create a user with the GRANT statement. | \n \nFILE | Read and write files on the server, using statements\nlike LOAD DATA INFILE or functions like LOAD_FILE(). Also\nneeded to create CONNECT outward tables. MariaDB server must\nhave the permissions to access those files. | \n \nGRANT OPTION | Grant global privileges. You can only grant\nprivileges that you have. | \n \nPROCESS | Show information about the active processes, via\nSHOW PROCESSLIST or mysqladmin processlist. | \n \nRELOAD | Execute FLUSH statements or equivalent mysqladmin\ncommands. | \n \nREPLICATION CLIENT | Execute SHOW MASTER STATUS and SHOW\nSLAVE STATUS informative statements. | \n \nREPLICATION SLAVE | Accounts used by slave servers on the\nmaster need this privilege. This is needed to get the\nupdates made on the master. | \n \nSHOW DATABASES | List all databases using the SHOW DATABASES\nstatement. Without the SHOW DATABASES privilege, you can\nstill issue the SHOW DATABASES statement, but it will only\nlist databases containing tables on which you have\nprivileges. | \n \nSHUTDOWN | Shut down the server using SHUTDOWN or the\nmysqladmin shutdown command. | \n \nSUPER | Execute superuser statements: CHANGE MASTER TO, KILL\n(users who do not have this privilege can only KILL their\nown threads), PURGE LOGS, SET global system variables, or\nthe mysqladmin debug command. Also, this permission allows\nthe user to write data even if the read_only startup option\nis set, enable or disable logging, enable or disable\nreplication on slaves, specify a DEFINER for statements that\nsupport that clause, connect once after reaching the\nMAX_CONNECTIONS. If a statement has been specified for the\ninit-connect mysqld option, that command will not be\nexecuted when a user with SUPER privileges connects to the\nserver. | \n \nDatabase Privileges\n \nThe following table lists the privileges that can be granted\nat the database\nlevel. You can also grant all table and function privileges\nat the database\nlevel. Table and function privileges on a database apply to\nall tables or\nfunctions in that database, including those created later.\n \nTo set a privilege for a database, specify the database\nusing\ndb_name.* for priv_level, or just use *\nto specify the default database.\n \nPrivilege | Description | \n \nCREATE | Create a database using the CREATE DATABASE\nstatement, when the privilege is granted for a database. You\ncan grant the CREATE privilege on databases that do not yet\nexist. This also grants the CREATE privilege on all tables\nin the database. | \n \nCREATE ROUTINE | Create Stored Programs using the CREATE\nPROCEDURE and CREATE FUNCTION statements. | \n \nCREATE TEMPORARY TABLES | Create temporary tables with the\nCREATE TEMPORARY TABLE statement. This privilege enable\nwriting and dropping those temporary tables | \n \nDROP | Drop a database using the DROP DATABASE statement,\nwhen the privilege is granted for a database. This also\ngrants the DROP privilege on all tables in the database. | \n \nEVENT | Create, drop and alter EVENTs. Added in MySQL 5.1.6.\n| \n \nGRANT OPTION | Grant database privileges. You can only grant\nprivileges that you have. | \n \nLOCK TABLES | Acquire explicit locks using the LOCK TABLES\nstatement; you also need to have the SELECT privilege on a\ntable, in order to lock it. | \n \nTable Privileges\n \nPrivilege | Description | \n \nALTER | Change the structure of an existing table using the\nALTER TABLE statement. | \n \nCREATE | Create a table using the CREATE TABLE statement.\nYou can grant the CREATE privilege on tables that do not yet\nexist. | \n \nCREATE VIEW | Create a view using the CREATE_VIEW statement.\n| \n \nDELETE | Remove rows from a table using the DELETE\nstatement. | \n \nDELETE HISTORY | Remove historical rows from a table using\nthe DELETE HISTORY statement. Displays as DELETE VERSIONING\nROWS when running SHOW GRANTS (MDEV-17655). From MariaDB\n10.3.4. From MariaDB 10.3.5, if a user has the SUPER\nprivilege but not this privilege, running mysql_upgrade will\ngrant this privilege as well. | \n \nDROP | Drop a table using the DROP TABLE statement or a view\nusing the DROP VIEW statement. Also required to execute the\nTRUNCATE TABLE statement. | \n \nGRANT OPTION | Grant table privileges. You can only grant\nprivileges that you have. | \n \nINDEX | Create an index on a table using the CREATE INDEX\nstatement. Without the INDEX privilege, you can still create\nindexes when creating a table using the CREATE TABLE\nstatement if the you have the CREATE privilege, and you can\ncreate indexes using the ALTER TABLE statement if you have\nthe ALTER privilege. | \n \nINSERT | Add rows to a table using the INSERT statement. The\nINSERT privilege can also be set on individual columns; see\nColumn Privileges below for details. | \n \nREFERENCES | Unused. | \n \nSELECT | Read data from a table using the SELECT statement.\nThe SELECT privilege can also be set on individual columns;\nsee Column Privileges below for details. | \n \nSHOW VIEW | Show the CREATE VIEW statement to create a view\nusing the SHOW CREATE VIEW statement. | \n \nTRIGGER | Execute triggers associated to tables you update,\nexecute the CREATE TRIGGER and DROP TRIGGER statements. You\nwill still be able to see triggers. | \n \nUPDATE | Update existing rows in a table using the UPDATE\nstatement. UPDATE statements usually include a WHERE clause\nto update only certain rows. You must have SELECT privileges\non the table or the appropriate columns for the WHERE\nclause. The UPDATE privilege can also be set on individual\ncolumns; see Column Privileges below for details. | \n \nColumn Privileges\n \nSome table privileges can be set for individual columns of a\ntable. To use\ncolumn privileges, specify the table explicitly and provide\na list of column\nnames after the privilege type. For example, the following\nstatement would allow\nthe user to read the names and positions of employees, but\nnot other information\nfrom the same table, such as salaries.\n \nGRANT SELECT (name, position) on Employee to\n\'jeffrey\'@\'localhost\';\n \nPrivilege | Description | \n \nINSERT (column_list) | Add rows specifying values in columns\nusing the INSERT statement. If you only have column-level\nINSERT privileges, you must specify the columns you are\nsetting in the INSERT statement. All other columns will be\nset to their default values, or NULL. | \n \nREFERENCES (column_list) | Unused. | \n \nSELECT (column_list) | Read values in columns using the\nSELECT statement. You cannot access or query any columns for\nwhich you do not have SELECT privileges, including in WHERE,\nON, GROUP BY, and ORDER BY clauses. | \n \nUPDATE (column_list) | Update values in columns of existing\nrows using the UPDATE statement. UPDATE statements usually\ninclude a WHERE clause to update only certain rows. You must\nhave SELECT privileges on the table or the appropriate\ncolumns for the WHERE clause. | \n \nFunction Privileges\n \nPrivilege | Description | \n \nALTER ROUTINE | Change the characteristics of a stored\nfunction using the ALTER FUNCTION statement. | \n \nEXECUTE | Use a stored function. You need SELECT privileges\nfor any tables or columns accessed by the function. | \n \nGRANT OPTION | Grant function privileges. You can only grant\nprivileges that you have. | \n \nProcedure Privileges\n \nPrivilege | Description | \n \nALTER ROUTINE | Change the characteristics of a stored\nprocedure using the ALTER PROCEDURE statement. | \n \nEXECUTE | Execute a stored procedure using the CALL\nstatement. The privilege to call a procedure may allow you\nto perform actions you wouldn\'t otherwise be able to do,\nsuch as insert rows into a table. | \n \nGRANT OPTION | Grant procedure privileges. You can only\ngrant privileges that you have. | \n \nProxy Privileges\n \nPrivilege | Description | \n \nPROXY | Permits one user to be a proxy for another. | \n \nThe PROXY privilege allows one user to proxy as another\nuser, which means their privileges change to that of the\nproxy user, and the CURRENT_USER() function returns the user\nname of the proxy user.\n \nThe PROXY privilege only works with authentication plugins\nthat support it. The default mysql_native_password\nauthentication plugin does not support proxy users.\n \nThe pam authentication plugin is the only plugin included\nwith MariaDB that currently supports proxy users. The PROXY\nprivilege is commonly used with the pam authentication\nplugin to enable user and group mapping with PAM.\n \nFor example, to grant the PROXY privilege to an anonymous\naccount that authenticates with the pam authentication\nplugin, you could execute the following:\n \nCREATE USER \'dba\'@\'%\' IDENTIFIED BY \'strongpassword\';\n \nGRANT ALL PRIVILEGES ON *.* TO \'dba\'@\'%\' ;\n \nCREATE USER \'\'@\'%\' IDENTIFIED VIA pam USING \'mariadb\';\n \nGRANT PROXY ON \'dba\'@\'%\' TO \'\'@\'%\';\n \nA user account can only grant the PROXY privilege for a\nspecific user account if the granter also has the PROXY\nprivilege for that specific user account, and if that\nprivilege is defined WITH GRANT OPTION. For example, the\nfollowing example fails because the granter does not have\nthe PROXY privilege for that specific user account at all:\n \nSELECT USER(), CURRENT_USER();\n+-----------------+-----------------+\n| USER() | CURRENT_USER() |\n+-----------------+-----------------+\n| alice@localhost | alice@localhost |\n+-----------------+-----------------+\n \nSHOW GRANTS;\n \n+-----------------------------------------------------------------------------------------------------------------------+\n| Grants for alice@localhost |\n+-----------------------------------------------------------------------------------------------------------------------+\n| GRANT ALL PRIVILEGES ON *.* TO \'alice\'@\'localhost\'\nIDENTIFIED BY PASSWORD\n\'*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19\' |\n+-----------------------------------------------------------------------------------------------------------------------+\n \nGRANT PROXY ON \'dba\'@\'localhost\' TO\n\'bob\'@\'localhost\';\n \nERROR 1698 (28000): Access denied for user\n\'alice\'@\'localhost\'\n \nAnd the following example fails because the granter does\nhave the PROXY privilege for that specific user account, but\nit is not defined WITH GRANT OPTION:\n \nSELECT USER(), CURRENT_USER();\n+-----------------+-----------------+\n| USER() | CURRENT_USER() |\n+-----------------+-----------------+\n| alice@localhost | alice@localhost |\n+-----------------+-----------------+\n \nSHOW GRANTS;\n \n+-----------------------------------------------------------------------------------------------------------------------+\n| Grants for alice@localhost |\n+-----------------------------------------------------------------------------------------------------------------------+\n| GRANT ALL PRIVILEGES ON *.* TO \'alice\'@\'localhost\'\nIDENTIFIED BY PASSWORD\n\'*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19\' |\n| GRANT PROXY ON \'dba\'@\'localhost\' TO\n\'alice\'@\'localhost\' |\n+-----------------------------------------------------------------------------------------------------------------------+\n \nMariaDB [(none)]> GRANT PROXY ON \'dba\'@\'localhost\' TO\n\'bob\'@\'localhost\';\n \nERROR 1698 (28000): Access denied for user\n\'alice\'@\'localhost\'\n \nBut the following example succeeds because the granter does\nhave the PROXY privilege for that specific user account, and\nit is defined WITH GRANT OPTION:\n \nSELECT USER(), CURRENT_USER();\n+-----------------+-----------------+\n| USER() | CURRENT_USER() |\n+-----------------+-----------------+\n| alice@localhost | alice@localhost |\n+-----------------+-----------------+\n \nSHOW GRANTS;\n \n+-----------------------------------------------------------------------------------------------------------------------------------------+\n| Grants for alice@localhost |\n+-----------------------------------------------------------------------------------------------------------------------------------------+\n| GRANT ALL PRIVILEGES ON *.* TO \'alice\'@\'localhost\'\nIDENTIFIED BY PASSWORD\n\'*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19\' WITH GRANT\nOPTION |\n| GRANT PROXY ON \'dba\'@\'localhost\' TO\n\'alice\'@\'localhost\' WITH GRANT OPTION |\n+-----------------------------------------------------------------------------------------------------------------------------------------+\n \nGRANT PROXY ON \'dba\'@\'localhost\' TO\n\'bob\'@\'localhost\';\n \nQuery OK, 0 rows affected (0.004 sec)\n \nA user account can grant the PROXY privilege for any other\nuser account if the granter has the PROXY privilege for the\n\'\'@\'%\' anonymous user account, like this:\n \nGR','','https://mariadb.com/kb/en/library/grant/');
+update help_topic set description = CONCAT(description, 'ANT PROXY ON \'\'@\'%\' TO \'dba\'@\'localhost\' WITH\nGRANT OPTION;\n \nFor example, the following example succeeds because the user\ncan grant the PROXY privilege for any other user account:\n \nSELECT USER(), CURRENT_USER();\n+-----------------+-----------------+\n| USER() | CURRENT_USER() |\n+-----------------+-----------------+\n| alice@localhost | alice@localhost |\n+-----------------+-----------------+\n \nSHOW GRANTS;\n \n+-----------------------------------------------------------------------------------------------------------------------------------------+\n| Grants for alice@localhost |\n+-----------------------------------------------------------------------------------------------------------------------------------------+\n| GRANT ALL PRIVILEGES ON *.* TO \'alice\'@\'localhost\'\nIDENTIFIED BY PASSWORD\n\'*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19\' WITH GRANT\nOPTION |\n| GRANT PROXY ON \'\'@\'%\' TO \'alice\'@\'localhost\' WITH\nGRANT OPTION |\n+-----------------------------------------------------------------------------------------------------------------------------------------+\n \nGRANT PROXY ON \'app1_dba\'@\'localhost\' TO\n\'bob\'@\'localhost\';\n \nQuery OK, 0 rows affected (0.004 sec)\n \nGRANT PROXY ON \'app2_dba\'@\'localhost\' TO\n\'carol\'@\'localhost\';\n \nQuery OK, 0 rows affected (0.004 sec)\n \nThe default root user accounts created by mysql_install_db\nhave this privilege. For example:\n \nGRANT ALL PRIVILEGES ON *.* TO \'root\'@\'localhost\' WITH\nGRANT OPTION;\n \nGRANT PROXY ON \'\'@\'%\' TO \'root\'@\'localhost\' WITH\nGRANT OPTION;\n \nThis allows the default root user accounts to grant the\nPROXY privilege for any other user account, and it also\nallows the default root user accounts to grant others the\nprivilege to do the same.\n \nAuthentication Options\n \nThe authentication options for the GRANT statement are the\nsame as those for the CREATE USER statement.\n \nIDENTIFIED BY \'password\'\n \nThe optional IDENTIFIED BY clause can be used to provide an\naccount with a password. The password should be specified in\nplain text. It will be hashed by the PASSWORD function prior\nto being stored to the mysql.user table.\n \nFor example, if our password is mariadb, then we can create\nthe user with:\n \nGRANT USAGE ON *.* TO foo2@test IDENTIFIED BY \'mariadb\';\n \nIf you do not specify a password with the IDENTIFIED BY\nclause, the user\nwill be able to connect without a password. A blank password\nis not a wildcard\nto match any password. The user must connect without\nproviding a password if no\npassword is set.\n \nIf the user account already exists and if you provide the\nIDENTIFIED BY clause, then the user\'s password will be\nchanged. You must have the privileges needed for the SET\nPASSWORD\nstatement to change a user\'s password with GRANT.\n \nThe only authentication plugins that this clause supports\nare mysql_native_password and mysql_old_password.\n \nIDENTIFIED BY PASSWORD \'password_hash\'\n \nThe optional IDENTIFIED BY PASSWORD clause can be used to\nprovide an account with a password that has already been\nhashed. The password should be specified as a hash that was\nprovided by the PASSWORD function. It will be stored to the\nmysql.user table as-is.\n \nFor example, if our password is mariadb, then we can find\nthe hash with:\n \nSELECT PASSWORD(\'mariadb\');\n+-------------------------------------------+\n| PASSWORD(\'mariadb\') |\n+-------------------------------------------+\n| *54958E764CE10E50764C2EECBB71D01F08549980 |\n+-------------------------------------------+\n1 row in set (0.00 sec)\n \nAnd then we can create a user with the hash:\n \nGRANT USAGE ON *.* TO foo2@test IDENTIFIED BY PASSWORD\n\'*54958E764CE10E50764C2EECBB71D01F08549980\';\n \nIf you do not specify a password with the IDENTIFIED BY\nclause, the user\nwill be able to connect without a password. A blank password\nis not a wildcard\nto match any password. The user must connect without\nproviding a password if no\npassword is set.\n \nIf the user account already exists and if you provide the\nIDENTIFIED BY clause, then the user\'s password will be\nchanged. You must have the privileges needed for the SET\nPASSWORD\nstatement to change a user\'s password with GRANT.\n \nThe only authentication plugins that this clause supports\nare mysql_native_password and mysql_old_password.\n \nIDENTIFIED {VIA|WITH} authentication_plugin\n \nThe optional IDENTIFIED VIA authentication_plugin allows you\nto specify that the account should be authenticated by a\nspecific authentication plugin. The plugin name must be an\nactive authentication plugin as per SHOW PLUGINS. If it\ndoesn\'t show up in that output, then you will need to\ninstall it with INSTALL PLUGIN or INSTALL SONAME.\n \nFor example, this could be used with the PAM authentication\nplugin:\n \nGRANT USAGE ON *.* TO foo2@test IDENTIFIED VIA pam;\n \nSome authentication plugins allow additional arguments to be\nspecified after a USING or AS keyword. For example, the PAM\nauthentication plugin accepts a service name:\n \nGRANT USAGE ON *.* TO foo2@test IDENTIFIED VIA pam USING\n\'mariadb\';\n \nThe exact meaning of the additional argument would depend on\nthe specific authentication plugin.\n \nThe USING or AS keyword can also be used to provide a\nplain-text password to a plugin if it\'s provided as an\nargument to the PASSWORD() function. This is only valid for\nauthentication plugins that have implemented a hook for the\nPASSWORD() function. For example, the ed25519 authentication\nplugin supports this:\n \nCREATE USER safe@\'%\' IDENTIFIED VIA ed25519 USING\nPASSWORD(\'secret\');\n \nOne can specify many authentication plugins, they all works\nas alternatives ways of authenticating a user:\n \nCREATE USER safe@\'%\' IDENTIFIED VIA ed25519 USING\nPASSWORD(\'secret\') OR unix_socket;\n \nResource Limit Options\n \nMariaDB 10.2.0 introduced a number of resource limit\noptions.\n \nIt is possible to set per-account limits for certain server\nresources. The following table shows the values that can be\nset per account:\n \nLimit Type | Decription | \n \nMAX_QUERIES_PER_HOUR | Number of statements that the account\ncan issue per hour (including updates) | \n \nMAX_UPDATES_PER_HOUR | Number of updates (not queries) that\nthe account can issue per hour | \n \nMAX_CONNECTIONS_PER_HOUR | Number of connections that the\naccount can start per hour | \n \nMAX_USER_CONNECTIONS | Number of simultaneous connections\nthat can be accepted from the same account; if it is 0,\nmax_connections will be used instead; if max_connections is\n0, there is no limit for this account\'s simultaneous\nconnections. | \n \nMAX_STATEMENT_TIME | Timeout, in seconds, for statements\nexecuted by the user. See also Aborting Statements that\nExceed a Certain Time to Execute. | \n \nIf any of these limits are set to 0, then there is no limit\nfor that resource for that user.\n \nTo set resource limits for an account, if you do not want to\nchange that account\'s privileges, you can issue a GRANT\nstatement with the USAGE privilege, which has no meaning.\nThe statement can name some or all limit types, in any\norder.\n \nHere is an example showing how to set resource limits:\n \nGRANT USAGE ON *.* TO \'someone\'@\'localhost\' WITH\n MAX_USER_CONNECTIONS 0\n MAX_QUERIES_PER_HOUR 200;\n \nThe resources are tracked per account, which means\n\'user\'@\'server\'; not per user name or per connection.\n \nThe count can be reset for all users using FLUSH\nUSER_RESOURCES, FLUSH PRIVILEGES or mysqladmin reload.\n \nPer account resource limits are stored in the user table, in\nthe mysql database. Columns used for resources limits are\nnamed max_questions, max_updates, max_connections (for\nMAX_CONNECTIONS_PER_HOUR), and max_user_connections (for\nMAX_USER_CONNECTIONS).\n \nTLS Options\n \nBy default, MariaDB transmits data between the server and\nclients without encrypting it. This is generally acceptable\nwhen the server and client run on the same host or in\nnetworks where security is guaranteed through other means.\nHowever, in cases where the server and client exist on\nseparate networks or they are in a high-risk network, the\nlack of encryption does introduce security concerns as a\nmalicious actor could potentially eavesdrop on the traffic\nas it is sent over the network between them.\n \nTo mitigate this concern, MariaDB allows you to encrypt data\nin transit between the server and clients using the\nTransport Layer Security (TLS) protocol. TLS was formerly\nknown as Secure Socket Layer (SSL), but strictly speaking\nthe SSL protocol is a predecessor to TLS and, that version\nof the protocol is now considered insecure. The\ndocumentation still uses the term SSL often and for\ncompatibility reasons TLS-related server system and status\nvariables still use the prefix ssl_, but internally, MariaDB\nonly supports its secure successors.\n \nSee Secure Connections Overview for more information about\nhow to determine whether your MariaDB server has TLS\nsupport.\n \nYou can set certain TLS-related restrictions for specific\nuser accounts. For instance, you might use this with user\naccounts that require access to sensitive data while sending\nit across networks that you do not control. These\nrestrictions can be enabled for a user account with the\nCREATE USER, ALTER USER, or GRANT statements. The following\noptions are available:\n \nOption | Description | \n \nREQUIRE NONE | TLS is not required for this account, but can\nstill be used. | \n \nREQUIRE SSL | The account must use TLS, but no valid X509\ncertificate is required. This option cannot be combined with\nother TLS options. | \n \nREQUIRE X509 | The account must use TLS and must have a\nvalid X509 certificate. This option implies REQUIRE SSL.\nThis option cannot be combined with other TLS options. | \n \nREQUIRE ISSUER \'issuer\' | The account must use TLS and\nmust have a valid X509 certificate. Also, the Certificate\nAuthority must be the one specified via the string issuer.\nThis option implies REQUIRE X509. This option can be\ncombined with the SUBJECT, and CIPHER options in any order.\n| \n \nREQUIRE SUBJECT \'subject\' | The account must use TLS and\nmust have a valid X509 certificate. Also, the certificate\'s\nSubject must be the one specified via the string subject.\nThis option implies REQUIRE X509. This option can be\ncombined with the ISSUER, and CIPHER options in any order. |\n\n \nREQUIRE CIPHER \'cipher\' | The account must use TLS, but no\nvalid X509 certificate is required. Also, the encryption\nused for the connection must use one of the methods\nspecified in the string cipher. This option implies REQUIRE\nSSL. This option can be combined with the ISSUER, and\nSUBJECT options in any order. | \n \nThe REQUIRE keyword must be used only once for all specified\noptions, and the AND keyword can be used to separate\nindividual options, but it is not required.\n \nFor example, you can create a user account that requires\nthese TLS options with the following:\n \nGRANT USAGE ON *.* TO \'alice\'@\'%\'\n REQUIRE SUBJECT \'/CN=alice/O=My Dom,\nInc./C=US/ST=Oregon/L=Portland\'\n AND ISSUER \'/C=FI/ST=Somewhere/L=City/ O=Some\nCompany/CN=Peter Parker/emailAddress=p.parker@marvel.com\'\n AND CIPHER \'TLSv1.2\';\n \nIf any of these options are set for a specific user account,\nthen any client who tries to connect with that user account\nwill have to be configured to connect with TLS.\n \nSee Securing Connections for Client and Server for\ninformation on how to enable TLS on the client and server.\n \nRoles\n \nRoles were introduced in MariaDB 10.0.5.\n \nSyntax\n------ \nGRANT role TO grantee [, grantee2 ... ]\n[ WITH ADMIN OPTION ]\n \nThe GRANT statement is also used to grant the use a role to\none or more users or other roles. In order to be able to\ngrant a role, the grantor doing so must have permission to\ndo so (see WITH ADMIN in the CREATE ROLE article).\n \nSpecifying the WITH ADMIN OPTION permits the grantee to in\nturn grant the role to another.\n \nFor example, the following commands show how to grant the\nsame role to a couple different users.\n \nGRANT journalist TO hulda;\n \nGRANT journalist TO berengar WITH ADMIN OPTION;\n \nIf a user has been granted a role, they do not automatically\nobtain all permissions associated with that role. These\npermissions are only in use when the user activates the role\nwith the SET ROLE statement.\n \nGrant Examples\n \nGranting Root-like Privileges\n \nYou can create a user that has privileges similar to the\ndefault root accounts by executing the following:\n \nCREATE USER \'alexander\'@\'localhost\';\n \nGRANT ALL PRIVILEGES ON *.* to \'alexander\'@\'localhost\'\nWITH GRANT OPTION;\n \n\n\nURL: https://mariadb.com/kb/en/library/grant/') WHERE help_topic_id = 121;
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (122,10,'User Password Expiry','User password expiry was introduced in MariaDB 10.4.3.\n \nPassword expiry permits administrators to expire user\npasswords, either manually or automatically. \n \nSystem Variables\n \nThere are two system variables which affect password expiry:\ndefault_password_lifetime, which determines the amount of\ntime between requiring the user to change their password. 0,\nthe default, means automatic password expiry is not active.\n \nThe second variable, disconnect_on_expired_password\ndetermines whether a client is permitted to connect if their\npassword has expired, or whether they are permitted to\nconnect in sandbox mode, able to perform a limited subset of\nqueries related to resetting the password, in particular SET\nPASSWORD and SET.\n \nSetting a Password Expiry Limit for a User\n \nBesides automatic password expiry, as determined by\ndefault_password_lifetime, password expiry times can be set\non an individual user basis, overriding the global using the\nCREATE USER or ALTER USER statements, for example:\n \nCREATE USER \'monty\'@\'localhost\' PASSWORD EXPIRE INTERVAL\n120 DAY;\n \nALTER USER \'monty\'@\'localhost\' PASSWORD EXPIRE INTERVAL\n120 DAY;\n \nLimits can be disabled by use of the NEVER keyword, for\nexample:\n \nCREATE USER \'monty\'@\'localhost\' PASSWORD EXPIRE NEVER;\n \nALTER USER \'monty\'@\'localhost\' PASSWORD EXPIRE NEVER;\n \nA manually set limit can be restored the system default by\nuse of DEFAULT, for example:\n \nCREATE USER \'monty\'@\'localhost\' PASSWORD EXPIRE DEFAULT;\n \nALTER USER \'monty\'@\'localhost\' PASSWORD EXPIRE DEFAULT;\n \nSHOW CREATE USER\n \nThe SHOW CREATE USER statement will display information\nabout the password expiry status of the user. Unlike MySQL,\nit will not display if the user is unlocked, or if the\npassword expiry is set to default.\n \nCREATE USER \'monty\'@\'localhost\' PASSWORD EXPIRE INTERVAL\n120 DAY;\n \nCREATE USER \'konstantin\'@\'localhost\' PASSWORD EXPIRE\nNEVER;\n \nCREATE USER \'amse\'@\'localhost\' PASSWORD EXPIRE DEFAULT;\n \nSHOW CREATE USER \'monty\'@\'localhost\';\n \n+------------------------------------------------------------------+\n| CREATE USER for monty@localhost |\n+------------------------------------------------------------------+\n| CREATE USER \'monty\'@\'localhost\' PASSWORD EXPIRE\nINTERVAL 120 DAY |\n+------------------------------------------------------------------+\n \nSHOW CREATE USER \'konstantin\'@\'localhost\';\n \n+------------------------------------------------------------+\n| CREATE USER for konstantin@localhost |\n+------------------------------------------------------------+\n| CREATE USER \'konstantin\'@\'localhost\' PASSWORD EXPIRE\nNEVER |\n+------------------------------------------------------------+\n \nSHOW CREATE USER \'amse\'@\'localhost\';\n \n+--------------------------------+\n| CREATE USER for amse@localhost |\n+--------------------------------+\n| CREATE USER \'amse\'@\'localhost\' |\n+--------------------------------+\n \n--connect-expired-password Client Option\n \nThe mysql client --connect-expired-password option notifies\nthe server that the client is prepared to handle expired\npassword sandbox mode (even if the --batch option was\nspecified).\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/user-password-expiry/','','https://mariadb.com/kb/en/library/user-password-expiry/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (123,10,'RENAME USER','Syntax\n------ \nRENAME USER old_user TO new_user\n [, old_user TO new_user] ...\n \nDescription\n----------- \nThe RENAME USER statement renames existing MariaDB accounts.\nTo use it,\nyou must have the global CREATE USER privilege\nor the UPDATE privilege for the mysql database.\nEach account is named using the same format as for the\nCREATE USER\nstatement; for example, \'jeffrey\'@\'localhost\'.\nIf you specify only the user name part of the account name,\na host\nname part of \'%\' is used.\n \nIf any of the old user accounts do not exist or any of the\nnew user accounts already\nexist, ERROR 1396 (HY000) results. If an error occurs,\nRENAME USER\nwill still rename the accounts that do not result in an\nerror.\n \nExamples\n-------- \nCREATE USER \'donald\', \'mickey\';\n \nRENAME USER \'donald\' TO \'duck\'@\'localhost\', \'mickey\'\nTO \'mouse\'@\'localhost\';\n \n\n \n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/rename-user/','','https://mariadb.com/kb/en/library/rename-user/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (124,10,'REVOKE','Privileges\n \nSyntax\n------ \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 \nDescription\n----------- \nThe REVOKE statement enables system administrators to revoke\nprivileges (or roles - see section below) from MariaDB\naccounts. Each account is named using the same format\nas for the GRANT statement; for example,\n\'jeffrey\'@\'localhost\'. If you specify only the user name\npart\nof the account name, a host name part of \'%\' is used. For\ndetails on the levels at which privileges exist, the\nallowable\npriv_type and priv_level values, and the\nsyntax for specifying users and passwords, see GRANT.\n \nTo use the first REVOKE syntax, you must have the\nGRANT OPTION privilege, and you must have the privileges\nthat\nyou are revoking.\n \nTo revoke all privileges, use the second syntax, which drops\nall\nglobal, database, table, column, and routine privileges for\nthe named\nuser or users:\n \nREVOKE ALL PRIVILEGES, GRANT OPTION FROM user [, user] ...\n \nTo use this REVOKE syntax, you must have the global\nCREATE USER privilege or the\nUPDATE privilege for the mysql database. See\nGRANT.\n \nExamples\n-------- \nREVOKE SUPER ON *.* FROM \'alexander\'@\'localhost\';\n \nRoles\n \nRoles were introduced in MariaDB 10.0.5.\n \nSyntax\n------ \nREVOKE role [, role ...]\n FROM grantee [, grantee2 ... ]\n \nDescription\n----------- \nREVOKE is also used to remove a role from a user or another\nrole that it\'s previously been assigned to. If a role has\npreviously been set as a default role, REVOKE does not\nremove the record of the default role from the mysql.user\ntable. If the role is subsequently granted again, it will\nagain be the user\'s default. Use SET DEFAULT ROLE NONE to\nexplicitly remove this.\n \nBefore MariaDB 10.1.13, the REVOKE role statement was not\npermitted in prepared statements.\n \nExample\n \nREVOKE journalist FROM hulda\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/revoke/','','https://mariadb.com/kb/en/library/revoke/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (125,10,'SET PASSWORD','Syntax\n------ \nSET PASSWORD [FOR user] =\n {\n PASSWORD(\'some password\')\n | OLD_PASSWORD(\'some password\')\n | \'encrypted password\'\n }\n \nDescription\n----------- \nThe SET PASSWORD statement assigns a password to an existing\nMariaDB user\naccount.\n \nIf the password is specified using the PASSWORD() or\nOLD_PASSWORD()\nfunction, the literal text of the password should be given.\nIf the\npassword is specified without using either function, the\npassword\nshould be the already-encrypted password value as returned\nby\nPASSWORD().\n \nOLD_PASSWORD() should only be used if your MariaDB/MySQL\nclients are very old (< 4.0.0).\n \nWith no FOR clause, this statement sets the password for the\ncurrent\nuser. Any client that has connected to the server using a\nnon-anonymous\naccount can change the password for that account.\n \nWith a FOR clause, this statement sets the password for a\nspecific\naccount on the current server host. Only clients that have\nthe UPDATE\nprivilege for the mysql database can do this. The user value\nshould be\ngiven in user_name@host_name format, where user_name and\nhost_name are\nexactly as they are listed in the User and Host columns of\nthe\nmysql.user table entry. \n \nThe argument to PASSWORD() and the password given to MariaDB\nclients can be of arbitrary length.\n \nAuthentication Plugin Support\n \nIn MariaDB 10.4 and later, SET PASSWORD (with or without\nPASSWORD()) works for accounts authenticated via any\nauthentication plugin that supports passwords stored in the\nmysql.global_priv table.\n \nThe ed25519, mysql_native_password, and mysql_old_password\nauthentication plugins store passwords in the\nmysql.global_priv table.\n \nIf you run SET PASSWORD on an account that authenticates\nwith one of these authentication plugins that stores\npasswords in the mysql.global_priv table, then the\nPASSWORD() function is evaluated by the specific\nauthentication plugin used by the account. The\nauthentication plugin hashes the password with a method that\nis compatible with that specific authentication plugin.\n \nThe unix_socket, named_pipe, gssapi, and pam authentication\nplugins do not store passwords in the mysql.global_priv\ntable. These authentication plugins rely on other methods to\nauthenticate the user.\n \nIf you attempt to run SET PASSWORD on an account that\nauthenticates with one of these authentication plugins that\ndoesn\'t store a password in the mysql.global_priv table,\nthen MariaDB Server will raise a warning like the following:\n \nSET PASSWORD is ignored for users authenticating via\nunix_socket plugin\n \nSee Authentication from MariaDB 10.4 for an overview of\nauthentication changes in MariaDB 10.4.\n \nMariaDB until 10.3\n \nIn MariaDB 10.3 and before, SET PASSWORD (with or without\nPASSWORD()) only works for accounts authenticated via\nmysql_native_password or mysql_old_password authentication\nplugins\n \nPasswordless User Accounts\n \nUser accounts do not always require passwords to login.\n \nThe unix_socket and named_pipe authentication plugins do not\nrequire a password to authenticate the user.\n \nThe gssapi and pam authentication plugins may or may not\nrequire a password to authenticate the user, depending on\nthe specific configuration.\n \nThe mysql_native_password and mysql_old_password\nauthentication plugins require passwords for authentication,\nbut the password can be blank. In that case, no password is\nrequired.\n \nIf you provide a password while attempting to log into the\nserver as an account that doesn\'t require a password, then\nMariaDB server will simply ignore the password.\n \nIn MariaDB 10.4 and later, a user account can be defined to\nuse multiple authentication plugins in a specific order of\npreference. This specific scenario may be more noticeable in\nthese versions, since an account could be associated with\nsome authentication plugins that require a password, and\nsome that do not.\n \nExample\n \nFor example, if you had an entry with User and\nHost column values of \'bob\' and \n\'%.loc.gov\', you would write the\nstatement like this:\n \nSET PASSWORD FOR \'bob\'@\'%.loc.gov\' =\nPASSWORD(\'newpass\');\n \n\n\nURL: https://mariadb.com/kb/en/library/set-password/','','https://mariadb.com/kb/en/library/set-password/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (126,10,'Roles Overview','Roles were introduced in MariaDB 10.0.5.\n \nDescription\n----------- \nA role bundles a number of privileges together. It assists\nlarger organizations where, typically, a number of users\nwould have the same privileges, and, previously, the only\nway to change the privileges for a group of users was by\nchanging each user\'s privileges individually. \n \nAlternatively, multiple external users could have been\nassigned the same user, and there would have been no way to\nsee which actual user was responsible for which action.\n \nWith roles, managing this is easy. For example, there could\nbe a number of users assigned to a journalist role, with\nidentical privileges. Changing the privileges for all the\njournalists is a matter of simply changing the role\'s\nprivileges, while the individual user is still linked with\nany changes that take place.\n \nRoles are created with the CREATE ROLE statement, and\ndropped with the DROP ROLE statement. Roles are then\nassigned to a user with an extension to the GRANT statement,\nwhile privileges are assigned to a role in the regular way\nwith GRANT. Similarly, the REVOKE statement can be used to\nboth revoke a role from a user, or revoke a privilege from a\nrole.\n \nOnce a user has connected, he can obtain all privileges\nassociated with a role by setting a role with the SET ROLE\nstatement. The CURRENT_ROLE function returns the currently\nset role for the session, if any.\n \nOnly roles granted directly to a user can be set, roles\ngranted to other roles cannot. Instead the privileges\ngranted to a role, which is, in turn, granted to another\nrole (grantee), will be immediately available to any user\nwho sets this second grantee role.\n \nRoles were implemented as a GSoC 2013 project by Vicentiu\nCiorbaru. \n \nThe SET DEFAULT ROLE statement allows one to set a default\nrole for a user. A default role is automatically enabled\nwhen a user connects (an implicit SET ROLE statement is\nexecuted immediately after a connection is established).\n \nSystem Tables\n \nInformation about roles and who they\'ve been granted to can\nbe found in the Information Schema APPLICABLE_ROLES table as\nwell as the mysql.ROLES_MAPPING table.\n \nThe Information Schema ENABLED_ROLES table shows the enabled\nroles for the current session.\n \nExamples\n-------- \nCreating a role and granting a privilege:\n \nCREATE ROLE journalist;\n \nGRANT SHOW DATABASES ON *.* TO journalist;\n \nGRANT journalist to hulda;\n \nNote, that hulda has no SHOW DATABASES privilege, even\nthough she was granted the journalist role. She needs to set\nthe role first:\n \nSHOW DATABASES;\n \n+--------------------+\n| Database |\n+--------------------+\n| information_schema |\n+--------------------+\n \nSELECT CURRENT_ROLE;\n \n+--------------+\n| CURRENT_ROLE |\n+--------------+\n| NULL |\n+--------------+\n \nSET ROLE journalist;\n \nSELECT CURRENT_ROLE;\n \n+--------------+\n| CURRENT_ROLE |\n+--------------+\n| journalist |\n+--------------+\n \nSHOW DATABASES;\n \n+--------------------+\n| Database |\n+--------------------+\n| ... |\n| information_schema |\n| mysql |\n| performance_schema |\n| test |\n| ... |\n+--------------------+\n \nSET ROLE NONE;\n \nRoles can be granted to roles:\n \nCREATE ROLE writer;\n \nGRANT SELECT ON data.* TO writer;\n \nGRANT writer TO journalist;\n \nBut one does not need to set a role granted to a role. For\nexample, hulda will automatically get all writer privileges\nwhen she sets the journalist role:\n \nSELECT CURRENT_ROLE;\n \n+--------------+\n| CURRENT_ROLE |\n+--------------+\n| NULL |\n+--------------+\n \nSHOW TABLES FROM data;\n \nEmpty set (0.01 sec)\n \nSET ROLE journalist;\n \nSELECT CURRENT_ROLE;\n \n+--------------+\n| CURRENT_ROLE |\n+--------------+\n| journalist |\n+--------------+\n \nSHOW TABLES FROM data;\n \n+------------------------------+\n| Tables_in_data |\n+------------------------------+\n| set1 |\n| ... |\n+------------------------------+\n \nRoles and Views (and Stored Routines)\n \nWhen a user sets a role, he, in a sense, has two identities\nwith two associated sets of privileges.\nBut a view (or a stored routine) can have only one definer.\nSo, when a view (or a stored routine) is created with the\nSQL SECURITY DEFINER, one can specify whether the definer\nshould be CURRENT_USER (and the view will have none of the\nprivileges of the user\'s role) or CURRENT_ROLE (in this\ncase, the view will use role\'s privileges, but none of the\nuser\'s privileges). As a result, sometimes one can create a\nview that is impossible to use.\n \nCREATE ROLE r1;\n \nGRANT ALL ON db1.* TO r1;\n \nGRANT r1 TO foo@localhost;\n \nGRANT ALL ON db.* TO foo@localhost;\n \nSELECT CURRENT_USER\n+---------------+\n| current_user |\n+---------------+\n| foo@localhost |\n+---------------+\n \nSET ROLE r1;\n \nCREATE TABLE db1.t1 (i int);\n \nCREATE VIEW db.v1 AS SELECT * FROM db1.t1;\n \nSHOW CREATE VIEW db.v1;\n \n+------+------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+\n| View | Create View | character_set_client |\ncollation_connection |\n+------+------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+\n| v1 | CREATE ALGORITHM=UNDEFINED DEFINER=`foo`@`localhost`\nSQL SECURITY DEFINER VIEW `db`.`v1` AS SELECT `db1`.`t1`.`i`\nAS `i` from `db1`.`t1` | utf8 | utf8_general_ci |\n+------+------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+\n \nCREATE DEFINER=CURRENT_ROLE VIEW db.v2 AS SELECT * FROM\ndb1.t1;\n \nSHOW CREATE VIEW db.b2;\n \n+------+-----------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+\n| View | Create View | character_set_client |\ncollation_connection |\n+------+-----------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+\n| v2 | CREATE ALGORITHM=UNDEFINED DEFINER=`r1` SQL SECURITY\nDEFINER VIEW `db`.`v2` AS select `db1`.`t1`.`a` AS `a` from\n`db1`.`t1` | utf8 | utf8_general_ci |\n+------+-----------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+\n \nOther Resources\n \nRoles Review by Peter Gulutzan\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/roles_overview/','','https://mariadb.com/kb/en/library/roles_overview/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (127,10,'CREATE ROLE','Roles were introduced in MariaDB 10.0.5.\n \nSyntax\n------ \nCREATE [OR REPLACE] ROLE [IF NOT EXISTS] role \n [WITH ADMIN \n {CURRENT_USER | CURRENT_ROLE | user | role}]\n \nDescription\n----------- \nThe CREATE ROLE statement creates one or more MariaDB roles.\nTo\nuse it, you must have the global CREATE USER\nprivilege or the INSERT privilege for the mysql\ndatabase. For each account, CREATE ROLE creates a new row in\nthe\nmysql.user table that has no privileges, and with the\ncorresponding is_role field set to Y. It also creates a\nrecord in the\nmysql.roles_mapping table.\n \nIf any of the specified roles already exist, ERROR 1396\n(HY000) results. If\nan error occurs, CREATE ROLE will still create the roles\nthat do not result\nin an error. The maximum length for a role is 128\ncharacters. Role names can be\nquoted, as explained in the Identifier names page. Only\none error is produced for all roles which have not been\ncreated:\n \nERROR 1396 (HY000): Operation CREATE ROLE failed for\n\'a\',\'b\',\'c\'\n \nFailed CREATE or DROP operations, for both users and roles,\nproduce the\nsame error code.\n \nPUBLIC and NONE are reserved, and cannot be used as role\nnames.\n \nBefore MariaDB 10.1.13, the CREATE ROLE statement was not\npermitted in prepared statements.\n \nFor valid identifiers to use as role names, see Identifier\nNames.\n \nWITH ADMIN\n \nThe optional WITH ADMIN clause determines whether the\ncurrent user, the\ncurrent role or another user or role has use of the newly\ncreated role. If the\nclause is omitted, WITH ADMIN CURRENT_USER is treated as the\ndefault, which\nmeans that the current user will be able to GRANT this role\nto\nusers.\n \nOR REPLACE\n \nThe OR REPLACE clause was added in MariaDB 10.1.3\n \nIf the optional OR REPLACE clause is used, it acts as a\nshortcut for:\n \nDROP ROLE IF EXISTS name;\n \nCREATE ROLE name ...;\n \nIF NOT EXISTS\n \nThe IF NOT EXISTS clause was added in MariaDB 10.1.3\n \nWhen the IF NOT EXISTS clause is used, MariaDB will return a\nwarning instead of an error if the specified role already\nexists. Cannot be used together with the OR REPLACE clause.\n \nExamples\n-------- \nCREATE ROLE journalist;\n \nCREATE ROLE developer WITH ADMIN lorinda;\n \nThe OR REPLACE and IF NOT EXISTS clauses:\n \nCREATE ROLE journalist;\nERROR 1396 (HY000): Operation CREATE ROLE failed for\n\'journalist\'\n \nCREATE OR REPLACE ROLE journalist;\nQuery OK, 0 rows affected (0.00 sec)\n \nCREATE ROLE IF NOT EXISTS journalist;\nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n+-------+------+---------------------------------------------------+\n| Level | Code | Message |\n+-------+------+---------------------------------------------------+\n| Note | 1975 | Can\'t create role \'journalist\'; it\nalready exists |\n+-------+------+---------------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/create-role/','','https://mariadb.com/kb/en/library/create-role/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (128,10,'DROP ROLE','Roles were introduced in MariaDB 10.0.5.\n \nSyntax\n------ \nDROP ROLE [IF EXISTS] role_name [,role_name ...]\n \nDescription\n----------- \nThe DROP ROLE statement removes one or more MariaDB roles.\nTo use this\nstatement, you must have the global CREATE USER privilege or\nthe DELETE privilege for the mysql database.\n \nDROP ROLE does not disable roles for connections which\nselected them with SET ROLE. If a role has previously been\nset as a default role, DROP ROLE does not remove the record\nof the default role from the mysql.user table. If the role\nis subsequently recreated and granted, it will again be the\nuser\'s default. Use SET DEFAULT ROLE NONE to explicitly\nremove this.\n \nIf any of the specified user accounts do not exist, ERROR\n1396 (HY000)\nresults. If an error occurs, DROP ROLE will still drop the\nroles that\ndo not result in an error. Only one error is produced for\nall roles which have not been dropped:\n \nERROR 1396 (HY000): Operation DROP ROLE failed for\n\'a\',\'b\',\'c\'\n \nFailed CREATE or DROP operations, for both users and roles,\nproduce the same error code.\n \nBefore MariaDB 10.1.13, the DROP ROLE statement was not\npermitted in prepared statements.\n \nIF EXISTS\n \nThe IF EXISTS clause was added in MariaDB 10.1.3\n \nIf the IF EXISTS clause is used, MariaDB will return a\nwarning instead of an error if the role does not exist.\n \nExamples\n-------- \nDROP ROLE journalist;\n \nThe same thing using the optional IF EXISTS clause:\n \nDROP ROLE journalist;\n \nERROR 1396 (HY000): Operation DROP ROLE failed for\n\'journalist\'\n \nDROP ROLE IF EXISTS journalist;\n \nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n \nNote (Code 1975): Can\'t drop role \'journalist\'; it\ndoesn\'t exist\n \n\n\nURL: https://mariadb.com/kb/en/library/drop-role/','','https://mariadb.com/kb/en/library/drop-role/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (129,10,'SET ROLE','Roles were introduced in MariaDB 10.0.5.\n \nSyntax\n------ \nSET ROLE { role | NONE }\n \nDescription\n----------- \nThe SET ROLE statement enables a role, along with all of its\nassociated permissions, for the current session. To unset a\nrole, use NONE .\n \nIf a role that doesn\'t exist, or to which the user has not\nbeen assigned, is specified, an ERROR 1959 (OP000): Invalid\nrole specification error occurs.\n \nFrom MariaDB 10.1.1, an automatic SET ROLE is implicitly\nperformed when a user connects if that user has been\nassigned a default role. See SET DEFAULT ROLE.\n \nExample\n \nSELECT CURRENT_ROLE;\n \n+--------------+\n| CURRENT_ROLE |\n+--------------+\n| NULL |\n+--------------+\n \nSET ROLE staff;\n \nSELECT CURRENT_ROLE;\n \n+--------------+\n| CURRENT_ROLE |\n+--------------+\n| staff |\n+--------------+\n \nSET ROLE NONE;\n \nQuery OK, 0 rows affected (0.00 sec)\n \nSELECT CURRENT_ROLE();\n+----------------+\n| CURRENT_ROLE() |\n+----------------+\n| NULL |\n+----------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/set-role/','','https://mariadb.com/kb/en/library/set-role/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (130,10,'SET DEFAULT ROLE','Default roles were implemented in MariaDB 10.1.1.\n \nSyntax\n------ \nSET DEFAULT ROLE { role | NONE } [ FOR user@host ]\n \nDescription\n----------- \nThe SET DEFAULT ROLE statement sets a default role for a\nspecified (or current) user. A default role is automatically\nenabled when a user connects (an implicit SET ROLE statement\nis executed immediately after a connection is established).\n \nTo be able to set a role as a default, one needs the\nprivileges to enable this role (if you cannot do SET ROLE X,\nyou won\'t be able to do SET DEFAULT ROLE X). To set a\ndefault role for another user one needs to have write access\nto the mysql database.\n \nTo remove a user\'s default role, use SET DEFAULT ROLE NONE\n[ FOR user@host ]. The record of the default role is not\nremoved if the role is dropped or revoked, so if the role is\nsubsequently re-created or granted, it will again be the\nuser\'s default role.\n \nThe default role is stored in a new column in the mysql.user\ntable, and currently viewing this table is the only way to\nsee which role has been assigned to a user as the default. \n \nExamples\n-------- \nSetting a default role for the current user:\n \nSET DEFAULT ROLE journalist;\n \nRemoving a default role from the current user:\n \nSET DEFAULT ROLE NONE;\n \n\n \n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/set-default-role/','','https://mariadb.com/kb/en/library/set-default-role/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (131,11,'ST_X','Syntax\n------ \nST_X(p)\nX(p)\n \nDescription\n----------- \nReturns the X-coordinate value for the point p as a\ndouble-precision number.\n \nST_X() and X() are synonyms.\n \nExamples\n-------- \nSET @pt = \'Point(56.7 53.34)\';\n \nSELECT X(GeomFromText(@pt));\n+----------------------+\n| X(GeomFromText(@pt)) |\n+----------------------+\n| 56.7 |\n+----------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_x/','','https://mariadb.com/kb/en/library/st_x/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (132,11,'ST_Y','Syntax\n------ \nST_Y(p)\nY(p)\n \nDescription\n----------- \nReturns the Y-coordinate value for the point p as a\ndouble-precision number.\n \nST_Y() and Y() are synonyms.\n \nExamples\n-------- \nSET @pt = \'Point(56.7 53.34)\';\n \nSELECT Y(GeomFromText(@pt));\n+----------------------+\n| Y(GeomFromText(@pt)) |\n+----------------------+\n| 53.34 |\n+----------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_y/','','https://mariadb.com/kb/en/library/st_y/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (133,11,'X','A synonym for ST_X.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/point-properties-x/','','https://mariadb.com/kb/en/library/point-properties-x/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (134,11,'Y','A synonym for ST_Y.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/point-properties-y/','','https://mariadb.com/kb/en/library/point-properties-y/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (135,12,'AES_DECRYPT','Syntax\n------ \nAES_DECRYPT(crypt_str,key_str)\n \nDescription\n----------- \nThis function allows decryption of data using the official\nAES\n(Advanced Encryption Standard) algorithm. For more\ninformation, see\nthe description of AES_ENCRYPT().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/aes_decrypt/','','https://mariadb.com/kb/en/library/aes_decrypt/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (136,12,'AES_ENCRYPT','Syntax\n------ \nAES_ENCRYPT(str,key_str)\n \nDescription\n----------- \nAES_ENCRYPT() and AES_DECRYPT() allow encryption and\ndecryption of\ndata using the official AES (Advanced Encryption Standard)\nalgorithm,\npreviously known as \"Rijndael.\" Encoding with a 128-bit\nkey length is\nused, but you can extend it up to 256 bits by modifying the\nsource. We\nchose 128 bits because it is much faster and it is secure\nenough for\nmost purposes.\n \nAES_ENCRYPT() encrypts a string str using the key key_str,\nand returns a binary string.\n \nAES_DECRYPT() decrypts the encrypted string and returns the\noriginal\nstring.\n \nThe 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\nencode\nuneven length strings and so the result string length may be\ncalculated using this formula:\n \n16 x (trunc(string_length / 16) + 1)\n \nIf AES_DECRYPT() detects invalid data or incorrect padding,\nit returns\nNULL. However, it is possible for AES_DECRYPT() to return a\nnon-NULL\nvalue (possibly garbage) if the input data or the key is\ninvalid.\n \nExamples\n-------- \nINSERT INTO t VALUES\n(AES_ENCRYPT(\'text\',SHA2(\'password\',512)));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/aes_encrypt/','','https://mariadb.com/kb/en/library/aes_encrypt/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (137,12,'COMPRESS','Syntax\n------ \nCOMPRESS(string_to_compress)\n \nDescription\n----------- \nCompresses a string and returns the result as a binary\nstring. This\nfunction requires MariaDB to have been compiled with a\ncompression\nlibrary such as zlib. Otherwise, the return value is always\nNULL. The\ncompressed string can be uncompressed with UNCOMPRESS().\n \nThe have_compress server system variable indicates whether a\ncompression library is present. \n \nExamples\n-------- \nSELECT LENGTH(COMPRESS(REPEAT(\'a\',1000)));\n+------------------------------------+\n| LENGTH(COMPRESS(REPEAT(\'a\',1000))) |\n+------------------------------------+\n| 21 |\n+------------------------------------+\n \nSELECT LENGTH(COMPRESS(\'\'));\n+----------------------+\n| LENGTH(COMPRESS(\'\')) |\n+----------------------+\n| 0 |\n+----------------------+\n \nSELECT LENGTH(COMPRESS(\'a\'));\n+-----------------------+\n| LENGTH(COMPRESS(\'a\')) |\n+-----------------------+\n| 13 |\n+-----------------------+\n \nSELECT LENGTH(COMPRESS(REPEAT(\'a\',16)));\n+----------------------------------+\n| LENGTH(COMPRESS(REPEAT(\'a\',16))) |\n+----------------------------------+\n| 15 |\n+----------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/compress/','','https://mariadb.com/kb/en/library/compress/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (138,12,'DECODE','Syntax\n------ \nDECODE(crypt_str,pass_str)\n \nDescription\n----------- \nDecrypts the encrypted string crypt_str using pass_str as\nthe\npassword. crypt_str should be a string returned from\nENCODE(). The resulting string will be the original string\nonly if pass_str is the same.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/decode/','','https://mariadb.com/kb/en/library/decode/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (139,12,'DES_DECRYPT','Syntax\n------ \nDES_DECRYPT(crypt_str[,key_str])\n \nDescription\n----------- \nDecrypts a string encrypted with DES_ENCRYPT(). If an error\noccurs,\nthis function returns NULL.\n \nThis function works only if MariaDB has been configured with\nTLS\nsupport.\n \nIf no key_str argument is given, DES_DECRYPT() examines the\nfirst byte\nof the encrypted string to determine the DES key number that\nwas used\nto encrypt the original string, and then reads the key from\nthe DES\nkey file to decrypt the message. For this to work, the user\nmust have\nthe SUPER privilege. The key file can be specified with the\n--des-key-file server option.\n \nIf you pass this function a key_str argument, that string is\nused as\nthe key for decrypting the message.\n \nIf the crypt_str argument does not appear to be an encrypted\nstring,\nMariaDB returns the given crypt_str.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/des_decrypt/','','https://mariadb.com/kb/en/library/des_decrypt/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (140,12,'DES_ENCRYPT','Syntax\n------ \nDES_ENCRYPT(str[,{key_num|key_str}])\n \nDescription\n----------- \nEncrypts the string with the given key using the Triple-DES\nalgorithm.\n \nThis function works only if MariaDB has been configured with\nTLS support.\n \nThe encryption key to use is chosen based on the second\nargument to\nDES_ENCRYPT(), if one was given. With no argument, the first\nkey from\nthe DES key file is used. With a key_num argument, the given\nkey \nnumber (0-9) from the DES key file is used. With a key_str\nargument,\nthe given key string is used to encrypt str. \n \nThe key file can be specified with the --des-key-file server\noption.\n \nThe return string is a binary string where the first\ncharacter is \nCHAR(128 | key_num). If an error occurs, DES_ENCRYPT()\nreturns NULL.\n \nThe 128 is added to make it easier to recognize an encrypted\nkey. 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\n9. Lines in\nthe file may be in any order. des_key_str is the string that\nis used\nto encrypt the message. There should be at least one space\nbetween the\nnumber and the key. The first key is the default key that is\nused if\nyou do not specify any key argument to DES_ENCRYPT().\n \nYou can tell MariaDB to read new key values from the key\nfile with the\nFLUSH DES_KEY_FILE statement. This requires the RELOAD\nprivilege.\n \nOne benefit of having a set of default keys is that it gives\napplications a way to check for the existence of encrypted\ncolumn\nvalues, without giving the end user the right to decrypt\nthose values.\n \nExamples\n-------- \nSELECT customer_address FROM customer_table \n WHERE crypted_credit_card =\nDES_ENCRYPT(\'credit_card_number\');\n \n\n\nURL: https://mariadb.com/kb/en/library/des_encrypt/','','https://mariadb.com/kb/en/library/des_encrypt/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (141,12,'ENCODE','Syntax\n------ \nENCODE(str,pass_str)\n \nDescription\n----------- \nENCODE is not considered cryptographically secure, and\nshould not be used for password encryption.\n \nEncrypt str using pass_str as the password. To decrypt the\nresult, 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\nrandom generator is. \n \nIt is not recommended to rely on the encryption performed by\nthe ENCODE function. Using a salt value (changed when a\npassword is updated) will improve matters somewhat, but for\nstoring passwords, consider a more cryptographically secure\nfunction, such as SHA2().\n \nExamples\n-------- \nENCODE(\'not so secret text\',\nCONCAT(\'random_salt\',\'password\'))\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/encode/','','https://mariadb.com/kb/en/library/encode/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (142,12,'ENCRYPT','Syntax\n------ \nENCRYPT(str[,salt])\n \nDescription\n----------- \nEncrypts a string using the Unix crypt() system call,\nreturning an encrypted binary string. The salt argument\nshould be a string with at least two characters or the\nreturned result will be NULL. If no salt argument is given,\na random value of sufficient length is used.\n \nIt is not recommended to use ENCRYPT() with utf16, utf32 or\nucs2 multi-byte character sets because the crypt() system\ncall expects a string terminated with a zero byte.\n \nNote that the underlying crypt() system call may have some\nlimitations, such as ignoring all but the first eight\ncharacters.\n \nIf the have_crypt system variable is set to NO (because the\ncrypt() system call is not available), the ENCRYPT function\nwill always return NULL.\n \nExamples\n-------- \nSELECT ENCRYPT(\'encrypt me\');\n+-----------------------+\n| ENCRYPT(\'encrypt me\') |\n+-----------------------+\n| 4I5BsEx0lqTDk |\n+-----------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/encrypt/','','https://mariadb.com/kb/en/library/encrypt/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (143,12,'MD5','Syntax\n------ \nMD5(str)\n \nDescription\n----------- \nCalculates an MD5 128-bit checksum for the string. \n \nThe return value is a 32-hex digit string, and as of MariaDB\n5.5, is a nonbinary string in the connection character set\nand collation, determined by the values of the\ncharacter_set_connection and collation_connection system\nvariables. Before 5.5, the return value was a binary string.\n \nNULL is returned if the argument was NULL. \n \nExamples\n-------- \nSELECT MD5(\'testing\');\n+----------------------------------+\n| MD5(\'testing\') |\n+----------------------------------+\n| ae2b1fca515949e5d54fb22b8ed95575 |\n+----------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/md5/','','https://mariadb.com/kb/en/library/md5/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (144,12,'OLD_PASSWORD','Syntax\n------ \nOLD_PASSWORD(str)\n \nDescription\n----------- \nOLD_PASSWORD() was added to MySQL when the implementation of\n\nPASSWORD() was changed to improve security. OLD_PASSWORD()\nreturns the\nvalue of the old (pre-MySQL 4.1) implementation of\nPASSWORD() as a\nstring, and is intended to permit you to reset passwords for\nany\npre-4.1 clients that need to connect to a more recent MySQL\nserver version, or any version of MariaDB,\nwithout locking them out.\n \nAs of MariaDB 5.5, the return value is a nonbinary string in\nthe connection character set and collation, determined by\nthe values of the character_set_connection and\ncollation_connection system variables. Before 5.5, the\nreturn value was a binary string.\n \nThe return value is 16 bytes in length, or NULL if the\nargument was NULL.\n \n\n\nURL: https://mariadb.com/kb/en/library/old_password/','','https://mariadb.com/kb/en/library/old_password/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (145,12,'PASSWORD','Syntax\n------ \nPASSWORD(str)\n \nDescription\n----------- \nThe PASSWORD() function is used for hashing passwords for\nuse in authentication by the MariaDB server. It is not\nintended for use in other applications.\n \nCalculates and returns a hashed password string from the\nplaintext password str. Returns an empty string (>= MariaDB\n10.0.4) or NULL (\n\nURL: https://mariadb.com/kb/en/library/password/','','https://mariadb.com/kb/en/library/password/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (146,12,'SHA1','Syntax\n------ \nSHA1(str), SHA(str)\n \nDescription\n----------- \nCalculates an SHA-1 160-bit checksum for the string str, as\ndescribed in\nRFC 3174 (Secure Hash Algorithm).\n \nThe value is returned as a string of 40 hex digits, or NULL\nif the argument was NULL. As of MariaDB 5.5, the return\nvalue is a nonbinary string in the connection character set\nand collation, determined by the values of the\ncharacter_set_connection and collation_connection system\nvariables. Before 5.5, the return value was a binary string.\n \nExamples\n-------- \nSELECT SHA1(\'some boring text\');\n+------------------------------------------+\n| SHA1(\'some boring text\') |\n+------------------------------------------+\n| af969fc2085b1bb6d31e517d5c456def5cdd7093 |\n+------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/sha1/','','https://mariadb.com/kb/en/library/sha1/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (147,12,'SHA2','SHA2() was introduced in MariaDB 5.5\n \nSyntax\n------ \nSHA2(str,hash_len)\n \nDescription\n----------- \nGiven a string str, calculates an SHA-2 checksum, which is\nconsidered more cryptographically secure than its SHA-1\nequivalent. The SHA-2 family includes SHA-224, SHA-256,\nSHA-384, and SHA-512, and the hash_len must correspond to\none of these, i.e. 224, 256, 384 or 512. 0 is equivalent to\n256.\n \nThe return value is a nonbinary string in the connection\ncharacter set and collation, determined by the values of the\ncharacter_set_connection and collation_connection system\nvariables. \n \nNULL is returned if the hash length is not valid, or the\nstring str is NULL.\n \nSHA2 will only work if MariaDB was has been configured with\nTLS support. \n \nExamples\n-------- \nSELECT SHA2(\'Maria\',224);\n+----------------------------------------------------------+\n| SHA2(\'Maria\',224) |\n+----------------------------------------------------------+\n| 6cc67add32286412efcab9d0e1675a43a5c2ef3cec8879f81516ff83 |\n+----------------------------------------------------------+\n \nSELECT SHA2(\'Maria\',256);\n+------------------------------------------------------------------+\n| SHA2(\'Maria\',256) |\n+------------------------------------------------------------------+\n|\n9ff18ebe7449349f358e3af0b57cf7a032c1c6b2272cb2656ff85eb112232f16\n|\n+------------------------------------------------------------------+\n \nSELECT SHA2(\'Maria\',0);\n+------------------------------------------------------------------+\n| SHA2(\'Maria\',0) |\n+------------------------------------------------------------------+\n|\n9ff18ebe7449349f358e3af0b57cf7a032c1c6b2272cb2656ff85eb112232f16\n|\n+------------------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/sha2/','','https://mariadb.com/kb/en/library/sha2/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (148,12,'UNCOMPRESS','Syntax\n------ \nUNCOMPRESS(string_to_uncompress)\n \nDescription\n----------- \nUncompresses a string compressed by the COMPRESS() function.\nIf the\nargument is not a compressed value, the result is NULL. This\nfunction\nrequires MariaDB to have been compiled with a compression\nlibrary such\nas zlib. Otherwise, the return value is always NULL. The\nhave_compress server system variable indicates whether a\ncompression library is present. \n \nExamples\n-------- \nSELECT UNCOMPRESS(COMPRESS(\'a string\'));\n+----------------------------------+\n| UNCOMPRESS(COMPRESS(\'a string\')) |\n+----------------------------------+\n| a string |\n+----------------------------------+\n \nSELECT UNCOMPRESS(\'a string\');\n+------------------------+\n| UNCOMPRESS(\'a string\') |\n+------------------------+\n| NULL |\n+------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/uncompress/','','https://mariadb.com/kb/en/library/uncompress/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (149,12,'UNCOMPRESSED_LENGTH','Syntax\n------ \nUNCOMPRESSED_LENGTH(compressed_string)\n \nDescription\n----------- \nReturns the length that the compressed string had before\nbeing\ncompressed with COMPRESS().\n \nUNCOMPRESSED_LENGTH() returns NULL or an incorrect result if\nthe string is not compressed.\n \nUntil MariaDB 10.3.1, returns MYSQL_TYPE_LONGLONG, or\nbigint(10), in all cases. From MariaDB 10.3.1, returns\nMYSQL_TYPE_LONG, or int(10), when the result would fit\nwithin 32-bits.\n \nExamples\n-------- \nSELECT UNCOMPRESSED_LENGTH(COMPRESS(REPEAT(\'a\',30)));\n+-----------------------------------------------+\n| UNCOMPRESSED_LENGTH(COMPRESS(REPEAT(\'a\',30))) |\n+-----------------------------------------------+\n| 30 |\n+-----------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/uncompressed_length/','','https://mariadb.com/kb/en/library/uncompressed_length/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (150,13,'ENDPOINT','A synonym for ST_ENDPOINT.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/linestring-properties-endpoint/','','https://mariadb.com/kb/en/library/linestring-properties-endpoint/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (151,13,'GLENGTH','Syntax\n------ \nGLength(ls)\n \nDescription\n----------- \nReturns as a double-precision number the length of the\nLineString value ls in its associated spatial reference.\n \nExamples\n-------- \nSET @ls = \'LineString(1 1,2 2,3 3)\';\n \nSELECT GLength(GeomFromText(@ls));\n+----------------------------+\n| GLength(GeomFromText(@ls)) |\n+----------------------------+\n| 2.82842712474619 |\n+----------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/glength/','','https://mariadb.com/kb/en/library/glength/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (152,13,'NumPoints','A synonym for ST_NumPoints.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/linestring-properties-numpoints/','','https://mariadb.com/kb/en/library/linestring-properties-numpoints/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (153,13,'PointN','A synonym for ST_PointN.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/linestring-properties-pointn/','','https://mariadb.com/kb/en/library/linestring-properties-pointn/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (154,13,'STARTPOINT','A synonym for ST_STARTPOINT.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/linestring-properties-startpoint/','','https://mariadb.com/kb/en/library/linestring-properties-startpoint/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (155,13,'ST_ENDPOINT','Syntax\n------ \nST_EndPoint(ls)\nEndPoint(ls)\n \nDescription\n----------- \nReturns the Point that is the endpoint of the\nLineString value ls.\n \nST_EndPoint() and EndPoint() are synonyms.\n \nExamples\n-------- \nSET @ls = \'LineString(1 1,2 2,3 3)\';\n \nSELECT AsText(EndPoint(GeomFromText(@ls)));\n+-------------------------------------+\n| AsText(EndPoint(GeomFromText(@ls))) |\n+-------------------------------------+\n| POINT(3 3) |\n+-------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_endpoint/','','https://mariadb.com/kb/en/library/st_endpoint/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (156,13,'ST_NUMPOINTS','Syntax\n------ \nST_NumPoints(ls)\nNumPoints(ls)\n \nDescription\n----------- \nReturns the number of Point objects in the LineString\nvalue ls.\n \nST_NumPoints() and NumPoints() are synonyms.\n \nExamples\n-------- \nSET @ls = \'LineString(1 1,2 2,3 3)\';\n \nSELECT NumPoints(GeomFromText(@ls));\n+------------------------------+\n| NumPoints(GeomFromText(@ls)) |\n+------------------------------+\n| 3 |\n+------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_numpoints/','','https://mariadb.com/kb/en/library/st_numpoints/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (157,13,'ST_POINTN','Syntax\n------ \nST_PointN(ls,N)\nPointN(ls,N)\n \nDescription\n----------- \nReturns the N-th Point in the LineString value ls.\nPoints are numbered beginning with 1.\n \nST_PointN() and PointN() are synonyms.\n \nExamples\n-------- \nSET @ls = \'LineString(1 1,2 2,3 3)\';\n \nSELECT AsText(PointN(GeomFromText(@ls),2));\n+-------------------------------------+\n| AsText(PointN(GeomFromText(@ls),2)) |\n+-------------------------------------+\n| POINT(2 2) |\n+-------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_pointn/','','https://mariadb.com/kb/en/library/st_pointn/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (158,14,'GET_LOCK','Syntax\n------ \nGET_LOCK(str,timeout)\n \nDescription\n----------- \nTries to obtain a lock with a name given by the string str,\nusing a timeout of timeout seconds. Returns 1 if the lock\nwas obtained successfully, 0 if the attempt timed out (for\nexample, because another client has previously locked the\nname), or NULL if an error occurred (such as running out of\nmemory or the thread was killed with mysqladmin kill).\n \nA lock is released with RELEASE_LOCK(), when the connection\nterminates (either normally or abnormally), or before\nMariaDB 10.0.2, when the connection executes another\nGET_LOCK statement. From MariaDB 10.0.2, a connection can\nhold multiple locks at the same time, so a lock that is no\nlonger needed needs to be explicitly released.\n \nThe IS_FREE_LOCK function returns whether a specified lock a\nfree or not, and the IS_USED_LOCK whether the function is in\nuse or not.\n \nLocks obtained with GET_LOCK() do not interact with\ntransactions. That is, committing a transaction does not\nrelease any such locks obtained during the transaction.\n \nFrom MariaDB 10.0.2, it is also possible to recursively set\nthe same lock. If a lock with the same name is set n times,\nit needs to be released n times as well. \n \nstr is case insensitive for GET_LOCK() and related\nfunctions. If str is an empty string or NULL, GET_LOCK()\nreturns NULL and does nothing. From MariaDB 10.2.2, timeout\nsupports microseconds. Before then, it was rounded to the\nclosest integer.\n \nIf the metadata_lock_info plugin is installed, locks\nacquired with this function are visible in the Information\nSchema METADATA_LOCK_INFO table.\n \nThis function can be used to implement application locks or\nto simulate record locks. Names are locked on a server-wide\nbasis. If a name has been locked by one client, GET_LOCK()\nblocks any request by another client for a lock with the\nsame name. This allows clients that agree on a given lock\nname to use the name to perform cooperative advisory\nlocking. But be aware that it also allows a client that is\nnot among the set of cooperating clients to lock a name,\neither inadvertently or deliberately, and thus prevent any\nof the cooperating clients from locking that name. One way\nto reduce the likelihood of this is to use lock names that\nare database-specific or application-specific. For example,\nuse lock names of the form db_name.str or app_name.str.\n \nStatements using the GET_LOCK() function are not safe for\nreplication.\n \nThe patch to permit multiple locks was contributed by\nKonstantin \"Kostja\" Osipov (MDEV-3917).\n \nExamples\n-------- \nSELECT GET_LOCK(\'lock1\',10);\n+----------------------+\n| GET_LOCK(\'lock1\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nSELECT IS_FREE_LOCK(\'lock1\'), IS_USED_LOCK(\'lock1\');\n+-----------------------+-----------------------+\n| IS_FREE_LOCK(\'lock1\') | IS_USED_LOCK(\'lock1\') |\n+-----------------------+-----------------------+\n| 0 | 46 |\n+-----------------------+-----------------------+\n \nSELECT IS_FREE_LOCK(\'lock2\'), IS_USED_LOCK(\'lock2\');\n+-----------------------+-----------------------+\n| IS_FREE_LOCK(\'lock2\') | IS_USED_LOCK(\'lock2\') |\n+-----------------------+-----------------------+\n| 1 | NULL |\n+-----------------------+-----------------------+\n \nFrom MariaDB 10.0.2, multiple locks can be held:\n \nSELECT GET_LOCK(\'lock2\',10);\n+----------------------+\n| GET_LOCK(\'lock2\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nSELECT IS_FREE_LOCK(\'lock1\'), IS_FREE_LOCK(\'lock2\');\n+-----------------------+-----------------------+\n| IS_FREE_LOCK(\'lock1\') | IS_FREE_LOCK(\'lock2\') |\n+-----------------------+-----------------------+\n| 0 | 0 |\n+-----------------------+-----------------------+\n \nSELECT RELEASE_LOCK(\'lock1\'), RELEASE_LOCK(\'lock2\');\n+-----------------------+-----------------------+\n| RELEASE_LOCK(\'lock1\') | RELEASE_LOCK(\'lock2\') |\n+-----------------------+-----------------------+\n| 1 | 1 |\n+-----------------------+-----------------------+\n \nBefore MariaDB 10.0.2, a connection could only hold a single\nlock:\n \nSELECT GET_LOCK(\'lock2\',10);\n+----------------------+\n| GET_LOCK(\'lock2\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nSELECT IS_FREE_LOCK(\'lock1\'), IS_FREE_LOCK(\'lock2\');\n+-----------------------+-----------------------+\n| IS_FREE_LOCK(\'lock1\') | IS_FREE_LOCK(\'lock2\') |\n+-----------------------+-----------------------+\n| 1 | 0 |\n+-----------------------+-----------------------+\n \nSELECT RELEASE_LOCK(\'lock1\'), RELEASE_LOCK(\'lock2\');\n+-----------------------+-----------------------+\n| RELEASE_LOCK(\'lock1\') | RELEASE_LOCK(\'lock2\') |\n+-----------------------+-----------------------+\n| NULL | 1 |\n+-----------------------+-----------------------+\n \nFrom MariaDB 10.0.2, it is possible to hold the same lock\nrecursively. This example is viewed using the\nmetadata_lock_info plugin:\n \nSELECT GET_LOCK(\'lock3\',10);\n+----------------------+\n| GET_LOCK(\'lock3\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nSELECT GET_LOCK(\'lock3\',10);\n+----------------------+\n| GET_LOCK(\'lock3\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nSELECT * FROM INFORMATION_SCHEMA.METADATA_LOCK_INFO;\n \n+-----------+---------------------+---------------+-----------+--------------+------------+\n| THREAD_ID | LOCK_MODE | LOCK_DURATION | LOCK_TYPE |\nTABLE_SCHEMA | TABLE_NAME |\n+-----------+---------------------+---------------+-----------+--------------+------------+\n| 46 | MDL_SHARED_NO_WRITE | NULL | User lock | lock3 | |\n+-----------+---------------------+---------------+-----------+--------------+------------+\n \nSELECT RELEASE_LOCK(\'lock3\');\n+-----------------------+\n| RELEASE_LOCK(\'lock3\') |\n+-----------------------+\n| 1 |\n+-----------------------+\n \nSELECT * FROM INFORMATION_SCHEMA.METADATA_LOCK_INFO;\n \n+-----------+---------------------+---------------+-----------+--------------+------------+\n| THREAD_ID | LOCK_MODE | LOCK_DURATION | LOCK_TYPE |\nTABLE_SCHEMA | TABLE_NAME |\n+-----------+---------------------+---------------+-----------+--------------+------------+\n| 46 | MDL_SHARED_NO_WRITE | NULL | User lock | lock3 | |\n+-----------+---------------------+---------------+-----------+--------------+------------+\n \nSELECT RELEASE_LOCK(\'lock3\');\n+-----------------------+\n| RELEASE_LOCK(\'lock3\') |\n+-----------------------+\n| 1 |\n+-----------------------+\n \nSELECT * FROM INFORMATION_SCHEMA.METADATA_LOCK_INFO;\n \nEmpty set (0.000 sec)\n \nTimeout example: Connection 1:\n \nSELECT GET_LOCK(\'lock4\',10);\n+----------------------+\n| GET_LOCK(\'lock4\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nConnection 2:\n \nSELECT GET_LOCK(\'lock4\',10);\n \nAfter 10 seconds...\n \n+----------------------+\n| GET_LOCK(\'lock4\',10) |\n+----------------------+\n| 0 |\n+----------------------+\n \nDeadlocks are automatically detected and resolved.\nConnection 1:\n \nSELECT GET_LOCK(\'lock5\',10); \n+----------------------+\n| GET_LOCK(\'lock5\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nConnection 2:\n \nSELECT GET_LOCK(\'lock6\',10);\n+----------------------+\n| GET_LOCK(\'lock6\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nConnection 1:\n \nSELECT GET_LOCK(\'lock6\',10); \n+----------------------+\n| GET_LOCK(\'lock6\',10) |\n+----------------------+\n| 0 |\n+----------------------+\n \nConnection 2:\n \nSELECT GET_LOCK(\'lock5\',10);\nERROR 1213 (40001): Deadlock found when trying to get lock;\n try restarting transaction\n \n\n\nURL: https://mariadb.com/kb/en/library/get_lock/','','https://mariadb.com/kb/en/library/get_lock/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (159,14,'INET6_ATON','INET6_ATON() has been available since MariaDB 10.0.12.\n \nSyntax\n------ \nINET6_ATON(expr)\n \nDescription\n----------- \nGiven an IPv6 or IPv4 network address as a string, returns a\nbinary string that represents the numeric value of the\naddress.\n \nNo trailing zone ID\'s or traling network masks are\npermitted. For IPv4 addresses, or IPv6 addresses with IPv4\naddress parts, no classful addresses or trailing port\nnumbers are permitted and octal numbers are not supported.\n \nThe returned binary string will be VARBINARY(16) or\nVARBINARY(4) for IPv6 and IPv4 addresses respectively.\n \nReturns NULL if the argument is not understood.\n \nExamples\n-------- \nSELECT HEX(INET6_ATON(\'10.0.1.1\'));\n+-----------------------------+\n| HEX(INET6_ATON(\'10.0.1.1\')) |\n+-----------------------------+\n| 0A000101 |\n+-----------------------------+\n \nSELECT HEX(INET6_ATON(\'48f3::d432:1431:ba23:846f\'));\n+----------------------------------------------+\n| HEX(INET6_ATON(\'48f3::d432:1431:ba23:846f\')) |\n+----------------------------------------------+\n| 48F3000000000000D4321431BA23846F |\n+----------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/inet6_aton/','','https://mariadb.com/kb/en/library/inet6_aton/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (160,14,'INET6_NTOA','INET6_NTOA() has been available from MariaDB 10.0.12.\n \nSyntax\n------ \nINET6_NTOA(expr)\n \nDescription\n----------- \nGiven an IPv6 or IPv4 network address as a numeric binary\nstring, returns the address as a nonbinary string in the\nconnection character set.\n \nThe return string is lowercase, and is platform independent,\nsince it does not use functions specific to the operating\nsystem. It has a maximum length of 39 characters.\n \nReturns NULL if the argument is not understood.\n \nExamples\n-------- \nSELECT INET6_NTOA(UNHEX(\'0A000101\'));\n+-------------------------------+\n| INET6_NTOA(UNHEX(\'0A000101\')) |\n+-------------------------------+\n| 10.0.1.1 |\n+-------------------------------+\n \nSELECT\nINET6_NTOA(UNHEX(\'48F3000000000000D4321431BA23846F\'));\n+-------------------------------------------------------+\n| INET6_NTOA(UNHEX(\'48F3000000000000D4321431BA23846F\')) |\n+-------------------------------------------------------+\n| 48f3::d432:1431:ba23:846f |\n+-------------------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/inet6_ntoa/','','https://mariadb.com/kb/en/library/inet6_ntoa/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (161,14,'INET_ATON','Syntax\n------ \nINET_ATON(expr)\n \nDescription\n----------- \nGiven the dotted-quad representation of an IPv4 network\naddress as a string,\nreturns an integer that represents the numeric value of the\naddress.\nAddresses may be 4- or 8-byte addresses.\n \nReturns NULL if the argument is not understood.\n \nExamples\n-------- \nSELECT INET_ATON(\'192.168.1.1\');\n+--------------------------+\n| INET_ATON(\'192.168.1.1\') |\n+--------------------------+\n| 3232235777 |\n+--------------------------+\n \nThis is calculated as follows: 192 x 2563 + 168 x 256 2 + 1\nx 256 + 1\n \n\n\nURL: https://mariadb.com/kb/en/library/inet_aton/','','https://mariadb.com/kb/en/library/inet_aton/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (162,14,'INET_NTOA','Syntax\n------ \nINET_NTOA(expr)\n \nDescription\n----------- \nGiven a numeric IPv4 network address in network byte order\n(4 or 8 byte),\nreturns the dotted-quad representation of the address as a\nstring.\n \nExamples\n-------- \nSELECT INET_NTOA(3232235777);\n+-----------------------+\n| INET_NTOA(3232235777) |\n+-----------------------+\n| 192.168.1.1 |\n+-----------------------+\n \n192.168.1.1 corresponds to 3232235777 since 192 x 2563 + 168\nx 256 2 + 1 x 256 + 1 = 3232235777\n \n\n\nURL: https://mariadb.com/kb/en/library/inet_ntoa/','','https://mariadb.com/kb/en/library/inet_ntoa/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (163,14,'IS_FREE_LOCK','Syntax\n------ \nIS_FREE_LOCK(str)\n \nDescription\n----------- \nChecks whether the lock named str is free to use (that is,\nnot locked).\nReturns 1 if the lock is free (no one is using the lock),\n 0 if the lock is in use, and NULL if an\nerror occurs (such as an incorrect argument, like an empty\nstring or NULL). str is case insensitive.\n \nIf the metadata_lock_info plugin is installed, the\nInformation Schema metadata_lock_info table contains\ninformation about locks of this kind (as well as metadata\nlocks).\n \nStatements using the IS_FREE_LOCK() function are not safe\nfor replication.\n \n\n\nURL: https://mariadb.com/kb/en/library/is_free_lock/','','https://mariadb.com/kb/en/library/is_free_lock/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (164,14,'IS_IPV4','IS_IPV4() has been available since MariaDB 10.0.12.\n \nSyntax\n------ \nIS_IPV4(expr)\n \nDescription\n----------- \nIf the expression is a valid IPv4 address, returns 1,\notherwise returns 0.\n \nIS_IPV4() is stricter than INET_ATON(), but as strict as\nINET6_ATON(), in determining the validity of an IPv4\naddress. This implies that if IS_IPV4 returns 1, the same\nexpression will always return a non-NULL result when passed\nto INET_ATON(), but that the reverse may not apply.\n \nExamples\n-------- \nSELECT IS_IPV4(\'1110.0.1.1\');\n+-----------------------+\n| IS_IPV4(\'1110.0.1.1\') |\n+-----------------------+\n| 0 |\n+-----------------------+\n \nSELECT IS_IPV4(\'48f3::d432:1431:ba23:846f\');\n+--------------------------------------+\n| IS_IPV4(\'48f3::d432:1431:ba23:846f\') |\n+--------------------------------------+\n| 0 |\n+--------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/is_ipv4/','','https://mariadb.com/kb/en/library/is_ipv4/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (165,14,'IS_IPV4_COMPAT','IS_IPV4_COMPAT() has been available since MariaDB 10.0.12.\n \nSyntax\n------ \nIS_IPV4_COMPAT(expr)\n \nDescription\n----------- \nReturns 1 if a given numeric binary string IPv6 address,\nsuch as returned by INET6_ATON(), is IPv4-compatible,\notherwise returns 0. \n \nExamples\n-------- \nSELECT IS_IPV4_COMPAT(INET6_ATON(\'::10.0.1.1\'));\n+------------------------------------------+\n| IS_IPV4_COMPAT(INET6_ATON(\'::10.0.1.1\')) |\n+------------------------------------------+\n| 1 |\n+------------------------------------------+\n \nSELECT\nIS_IPV4_COMPAT(INET6_ATON(\'::48f3::d432:1431:ba23:846f\'));\n+-----------------------------------------------------------+\n|\nIS_IPV4_COMPAT(INET6_ATON(\'::48f3::d432:1431:ba23:846f\'))\n|\n+-----------------------------------------------------------+\n| 0 |\n+-----------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/is_ipv4_compat/','','https://mariadb.com/kb/en/library/is_ipv4_compat/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (166,14,'IS_IPV4_MAPPED','IS_IPV4_MAPPED() has been available since MariaDB 10.0.12.\n \nSyntax\n------ \nIS_IPV4_MAPPED(expr)\n \nDescription\n----------- \nReturns 1 if a given a numeric binary string IPv6 address,\nsuch as returned by INET6_ATON(), is a valid IPv4-mapped\naddress, otherwise returns 0.\n \nExamples\n-------- \nSELECT IS_IPV4_MAPPED(INET6_ATON(\'::10.0.1.1\'));\n+------------------------------------------+\n| IS_IPV4_MAPPED(INET6_ATON(\'::10.0.1.1\')) |\n+------------------------------------------+\n| 0 |\n+------------------------------------------+\n \nSELECT IS_IPV4_MAPPED(INET6_ATON(\'::ffff:10.0.1.1\'));\n+-----------------------------------------------+\n| IS_IPV4_MAPPED(INET6_ATON(\'::ffff:10.0.1.1\')) |\n+-----------------------------------------------+\n| 1 |\n+-----------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/is_ipv4_mapped/','','https://mariadb.com/kb/en/library/is_ipv4_mapped/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (167,14,'IS_IPV6','IS_IPV6() has been available since MariaDB 10.0.12.\n \nSyntax\n------ \nIS_IPV6(expr)\n \nDescription\n----------- \nReturns 1 if the expression is a valid IPv6 address\nspecified as a string, otherwise returns 0. Does not\nconsider IPv4 addresses to be valid IPv6 addresses.\n \nExamples\n-------- \n SELECT IS_IPV6(\'48f3::d432:1431:ba23:846f\');\n+--------------------------------------+\n| IS_IPV6(\'48f3::d432:1431:ba23:846f\') |\n+--------------------------------------+\n| 1 |\n+--------------------------------------+\n1 row in set (0.02 sec)\n \nSELECT IS_IPV6(\'10.0.1.1\');\n+---------------------+\n| IS_IPV6(\'10.0.1.1\') |\n+---------------------+\n| 0 |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/is_ipv6/','','https://mariadb.com/kb/en/library/is_ipv6/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (168,14,'IS_USED_LOCK','Syntax\n------ \nIS_USED_LOCK(str)\n \nDescription\n----------- \nChecks whether the lock named str is in use (that is,\nlocked). If so,\nit returns the connection identifier of the client that\nholds the\nlock. Otherwise, it returns NULL. str is case insensitive.\n \nIf the metadata_lock_info plugin is installed, the\nInformation Schema metadata_lock_info table contains\ninformation about locks of this kind (as well as metadata\nlocks).\n \nStatements using the IS_USED_LOCK() function are not safe\nfor replication.\n \n\n\nURL: https://mariadb.com/kb/en/library/is_used_lock/','','https://mariadb.com/kb/en/library/is_used_lock/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (169,14,'MASTER_GTID_WAIT','MASTER_GTID_WAIT() was included in MariaDB 10.0.9.\n \nSyntax\n------ \nMASTER_GTID_WAIT(gtid-list[, timeout)\n \nDescription\n----------- \nThis function takes a string containing a comma-separated\nlist of global transaction id\'s\n(similar to the value of, for example, gtid_binlog_pos). It\nwaits until the value of gtid_slave_pos has the same or\nhigher seq_no within all replication domains specified in\nthe gtid-list; in other words, it waits until the slave has\nreached the specified GTID position.\n \nAn optional second argument gives a timeout in seconds. If\nthe timeout\nexpires before the specified GTID position is reached, then\nthe function\nreturns -1. Passing NULL or a negative number for the\ntimeout means no timeout, and the function will wait\nindefinitely.\n \n If the wait completes without a timeout, 0 is returned.\nPassing NULL for the\n gtid-list makes the function return NULL immediately,\nwithout waiting.\n \nThe gtid-list may be the empty string, in which case\nMASTER_GTID_WAIT()\nreturns immediately. If the gtid-list contains fewer domains\nthan\ngtid_slave_pos, then only those domains are waited upon. If\ngtid-list\ncontains a domain that is not present in @@gtid_slave_pos,\nthen\nMASTER_GTID_WAIT() will wait until an event containing such\ndomain_id arrives\non the slave (or until timed out or killed).\n \nMASTER_GTID_WAIT() can be useful to ensure that a slave has\ncaught up to\na master. Simply take the value of gtid_binlog_pos on the\nmaster, and use it in a MASTER_GTID_WAIT() call on the\nslave; when the call completes, the slave\nwill have caught up with that master position.\n \nMASTER_GTID_WAIT() can also be used in client applications\ntogether with the\nlast_gtid session variable. This is useful in a\nread-scaleout replication setup, where the application\nwrites to a single master but divides the\nreads out to a number of slaves to distribute the load. In\nsuch a setup, there\nis a risk that an application could first do an update on\nthe master, and then\na bit later do a read on a slave, and if the slave is not\nfast enough, the\ndata read from the slave might not include the update just\nmade, possibly\nconfusing the application and/or the end-user. One way to\navoid this is to\nrequest the value of last_gtid on the master just after the\nupdate. Then\nbefore doing the read on the slave, do a MASTER_GTID_WAIT()\non the value\nobtained from the master; this will ensure that the read is\nnot performed\nuntil the slave has replicated sufficiently far for the\nupdate to have become\nvisible.\n \nNote that MASTER_GTID_WAIT() can be used even if the slave\nis configured not\nto use GTID for connections (CHANGE MASTER TO\nmaster_use_gtid=no). This is\nbecause from MariaDB 10, GTIDs are always logged on the\nmaster server, and\nalways recorded on the slave servers.\n \nDifferences to MASTER_POS_WAIT()\n \nMASTER_GTID_WAIT() is global; it waits for any master\nconnection to reach\n the specified GTID position. MASTER_POS_WAIT() works only\nagainst a\n specific connection. This also means that while\nMASTER_POS_WAIT() aborts if\n its master connection is terminated with STOP SLAVE or due\nto an error,\n MASTER_GTID_WAIT() continues to wait while slaves are\nstopped.\n \nMASTER_GTID_WAIT() can take its timeout as a floating-point\nvalue, so a\n timeout in fractional seconds is supported, eg.\nMASTER_GTID_WAIT(\"0-1-100\",\n 0.5). (The minimum wait is one microsecond, 0.000001\nseconds).\n \nMASTER_GTID_WAIT() allows one to specify a timeout of zero\nin order to do a\n non-blocking check to see if the slaves have progressed to\na specific GTID position\n (MASTER_POS_WAIT() takes a zero timeout as meaning an\ninfinite wait). To do\n an infinite MASTER_GTID_WAIT(), specify a negative timeout,\nor omit the\n timeout argument.\n \nMASTER_GTID_WAIT() does not return the number of events\nexecuted since the\n wait started, nor does it return NULL if a slave thread is\nstopped. It\n always returns either 0 for successful wait completed, or\n-1 for timeout\n reached (or NULL if the specified gtid-pos is NULL).\n \nSince MASTER_GTID_WAIT() looks only at the seq_no part of\nthe GTIDs, not the\nserver_id, care is needed if a slave becomes diverged from\nanother server so\nthat two different GTIDs with the same seq_no (in the same\ndomain) arrive at\nthe same server. This situation is in any case best avoided;\nsetting\ngtid_strict_mode is recommended, as this will prevent any\nsuch out-of-order sequence numbers from ever being\nreplicated on a slave.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/master_gtid_wait/','','https://mariadb.com/kb/en/library/master_gtid_wait/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (170,14,'MASTER_POS_WAIT','MASTER_POS_WAIT was introduced in MariaDB 10.0.9.\n \nSyntax\n------ \nMASTER_POS_WAIT(log_name,log_pos[,timeout,[\"connection_name\"]])\n \nDescription\n----------- \nThis function is useful in replication for controlling\nmaster/slave synchronization. It blocks until the slave has\nread and applied all updates up to the specified position\n(log_name,log_pos) in the master log. The return value is\nthe number of log events the slave had to wait for to\nadvance to the specified position. The function returns NULL\nif\nthe slave SQL thread is not started, the slave\'s master\ninformation is not\ninitialized, the arguments are incorrect, or an error\noccurs. It returns -1 if\nthe timeout has been exceeded. If the slave SQL thread stops\nwhile\n MASTER_POS_WAIT() is waiting, the function returns NULL. If\nthe slave is past the specified position, the function\nreturns immediately.\n \nIf a timeout value is specified, MASTER_POS_WAIT() stops\nwaiting when timeout seconds have elapsed. timeout must be\ngreater than 0; a\nzero or negative timeout means no timeout.\n \nThe connection_name is used when you are using\nmulti-source-replication. If you don\'t specify it, it\'s\nset to the value of the default_master_connection system\nvariable.\n \nStatements using the MASTER_POS_WAIT() function are not safe\nfor replication.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/master_pos_wait/','','https://mariadb.com/kb/en/library/master_pos_wait/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (171,14,'NAME_CONST','Syntax\n------ \nNAME_CONST(name,value)\n \nDescription\n----------- \nReturns the given value. When used to produce a result set\ncolumn,\n NAME_CONST() causes the column to have the given name. The\narguments should be constants.\n \nThis function is used internally when replicating stored\nprocedures. It makes little sense to use it explicitly in\nSQL statements, and it was not supposed to be used like\nthat.\n \nSELECT NAME_CONST(\'myname\', 14);\n+--------+\n| myname |\n+--------+\n| 14 |\n+--------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/name_const/','','https://mariadb.com/kb/en/library/name_const/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (172,14,'RELEASE_LOCK','Syntax\n------ \nRELEASE_LOCK(str)\n \nDescription\n----------- \nReleases the lock named by the string str that was obtained\nwith GET_LOCK(). Returns 1 if the lock was released, 0 if\nthe lock was not established by this thread (in which case\nthe lock is not\nreleased), and NULL if the named lock did not exist. The\nlock does not exist if it was never obtained by a call to\nGET_LOCK() or if it has previously been released.\n \nMariaDB until 10.0.1\n \nBefore 10.0.2, GET_LOCK() released the existing lock, if\nany. Since 10.0.2 this does not happen, because multiple\nlocks are allowed.\n \nstr is case insensitive. If str is an empty string or NULL,\nRELEASE_LOCK() returns NULL and does nothing.\n \nStatements using the RELEASE_LOCK() function are not safe\nfor replication.\n \nThe DO statement is convenient to use with RELEASE_LOCK().\n \nExamples\n-------- \nConnection1:\n \nSELECT GET_LOCK(\'lock1\',10);\n+----------------------+\n| GET_LOCK(\'lock1\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nConnection 2:\n \nSELECT GET_LOCK(\'lock2\',10);\n+----------------------+\n| GET_LOCK(\'lock2\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nConnection 1:\n \nSELECT RELEASE_LOCK(\'lock1\'), RELEASE_LOCK(\'lock2\'),\nRELEASE_LOCK(\'lock3\');\n+-----------------------+-----------------------+-----------------------+\n| RELEASE_LOCK(\'lock1\') | RELEASE_LOCK(\'lock2\') |\nRELEASE_LOCK(\'lock3\') |\n+-----------------------+-----------------------+-----------------------+\n| 1 | 0 | NULL |\n+-----------------------+-----------------------+-----------------------+\n \nFrom MariaDB 10.0.2, it is possible to hold the same lock\nrecursively. This example is viewed using the\nmetadata_lock_info plugin:\n \nSELECT GET_LOCK(\'lock3\',10);\n+----------------------+\n| GET_LOCK(\'lock3\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nSELECT GET_LOCK(\'lock3\',10);\n+----------------------+\n| GET_LOCK(\'lock3\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nSELECT * FROM INFORMATION_SCHEMA.METADATA_LOCK_INFO;\n \n+-----------+---------------------+---------------+-----------+--------------+------------+\n| THREAD_ID | LOCK_MODE | LOCK_DURATION | LOCK_TYPE |\nTABLE_SCHEMA | TABLE_NAME |\n+-----------+---------------------+---------------+-----------+--------------+------------+\n| 46 | MDL_SHARED_NO_WRITE | NULL | User lock | lock3 | |\n+-----------+---------------------+---------------+-----------+--------------+------------+\n \nSELECT RELEASE_LOCK(\'lock3\');\n+-----------------------+\n| RELEASE_LOCK(\'lock3\') |\n+-----------------------+\n| 1 |\n+-----------------------+\n \nSELECT * FROM INFORMATION_SCHEMA.METADATA_LOCK_INFO;\n \n+-----------+---------------------+---------------+-----------+--------------+------------+\n| THREAD_ID | LOCK_MODE | LOCK_DURATION | LOCK_TYPE |\nTABLE_SCHEMA | TABLE_NAME |\n+-----------+---------------------+---------------+-----------+--------------+------------+\n| 46 | MDL_SHARED_NO_WRITE | NULL | User lock | lock3 | |\n+-----------+---------------------+---------------+-----------+--------------+------------+\n \nSELECT RELEASE_LOCK(\'lock3\');\n+-----------------------+\n| RELEASE_LOCK(\'lock3\') |\n+-----------------------+\n| 1 |\n+-----------------------+\n \nSELECT * FROM INFORMATION_SCHEMA.METADATA_LOCK_INFO;\n \nEmpty set (0.000 sec)\n \n\n\nURL: https://mariadb.com/kb/en/library/release_lock/','','https://mariadb.com/kb/en/library/release_lock/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (173,14,'SLEEP','Syntax\n------ \nSLEEP(duration)\n \nDescription\n----------- \nSleeps (pauses) for the number of seconds given by the\nduration argument, then\nreturns 0. If SLEEP() is interrupted, it\nreturns 1. The duration may have a fractional part given in\nmicroseconds.\n \nStatements using the SLEEP() function are not safe for\nreplication.\n \nExample\n \nSELECT SLEEP(5.5);\n+------------+\n| SLEEP(5.5) |\n+------------+\n| 0 |\n+------------+\n1 row in set (5.50 sec)\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/sleep/','','https://mariadb.com/kb/en/library/sleep/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (174,14,'UUID','Syntax\n------ \nUUID()\n \nDescription\n----------- \nReturns a Universal Unique Identifier (UUID) generated\naccording to \"DCE 1.1:\nRemote Procedure Call\" (Appendix A) CAE (Common\nApplications Environment)\nSpecifications published by The Open Group in October\n1997 \n(Document Number C706).\n \nA UUID is designed as a number that is globally unique in\nspace and time. Two\ncalls to UUID() are expected to generate two different\nvalues, even if these calls are performed on two separate\ncomputers that are\nnot connected to each other.\n \nA UUID is a 128-bit number represented by a utf8 string of\nfive\nhexadecimal numbers in aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee\nformat:\nThe first three numbers are generated from a timestamp.\nThe fourth number preserves temporal uniqueness in case the\ntimestamp value\n loses monotonicity (for example, due to daylight saving\ntime).\nThe fifth number is an IEEE 802 node number that provides\nspatial uniqueness.\n A random number is substituted if the latter is not\navailable (for example,\n because the host computer has no Ethernet card, or we do\nnot know how to find\n the hardware address of an interface on your operating\nsystem). In this case,\n spatial uniqueness cannot be guaranteed. Nevertheless, a\ncollision should\n have very low probability.\n \nCurrently, the MAC address of an interface is taken into\naccount only on FreeBSD and Linux. On other operating\nsystems, MariaDB uses a randomly generated 48-bit number.\n \nStatements using the UUID() function are not safe for\nreplication.\n \nUUID() results are intended to be unique, but cannot always\nbe relied upon to unpredictable and unguessable, so should\nnot be relied upon for these purposes.\n \nExamples\n-------- \nSELECT UUID();\n+--------------------------------------+\n| UUID() |\n+--------------------------------------+\n| cd41294a-afb0-11df-bc9b-00241dd75637 |\n+--------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/uuid/','','https://mariadb.com/kb/en/library/uuid/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (175,14,'UUID_SHORT','Syntax\n------ \nUUID_SHORT()\n \nDescription\n----------- \nReturns a \"short\" universal identifier as a 64-bit\nunsigned integer (rather\nthan a string-form 128-bit identifier as returned by the\nUUID() function).\n \nThe value of UUID_SHORT() is guaranteed to be unique if the\nfollowing conditions hold:\nThe server_id of the current host is unique among your set\nof master and\n slave servers\nserver_id is between 0 and 255\nYou don\'t set back your system time for your server between\nmysqld restarts\nYou do not invoke UUID_SHORT() on average more than 16\n million times per second between mysqld restarts\n \nThe UUID_SHORT() return value is constructed this way:\n \n (server_id & 255) \n\nURL: https://mariadb.com/kb/en/library/uuid_short/','','https://mariadb.com/kb/en/library/uuid_short/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (176,14,'VALUES / VALUE','Syntax\n------ \nVALUE(col_name) \n \nMariaDB until 10.3.2\n \nVALUES(col_name) \n \nDescription\n----------- \nIn an INSERT ... ON DUPLICATE KEY UPDATE statement, you can\nuse the VALUES(col_name) function in the UPDATE clause to\nrefer to column values from the INSERT portion of the\nstatement. In other words, VALUES(col_name) in the UPDATE\nclause refers to the value of col_name that would be\ninserted, had no duplicate-key conflict occurred. This\nfunction is especially useful in multiple-row inserts.\n \nThe VALUES() function is meaningful only in INSERT ... ON\nDUPLICATE KEY UPDATE statements and returns NULL otherwise.\n \nIn MariaDB 10.3.3 this function was renamed to VALUE(),\nbecause it\'s incompatible with the standard Table Value\nConstructors syntax, implemented in MariaDB 10.3.3.\n \nThe VALUES() function can still be used even from MariaDB\n10.3.3, but only in INSERT ... ON DUPLICATE KEY UPDATE\nstatements; it\'s a syntax error otherwise.\n \nExamples\n-------- \nINSERT INTO t (a,b,c) VALUES (1,2,3),(4,5,6)\n ON DUPLICATE KEY UPDATE c=VALUE(a)+VALUE(b);\n \nMariaDB until 10.3.2\n \nINSERT INTO t (a,b,c) VALUES (1,2,3),(4,5,6)\n ON DUPLICATE KEY UPDATE c=VALUES(a)+VALUES(b);\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/values-value/','','https://mariadb.com/kb/en/library/values-value/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (177,15,'!','Syntax\n------ \nNOT, !\n \nDescription\n----------- \nLogical NOT. Evaluates to 1 if the operand is 0, to 0 if the\noperand\nis non-zero, and NOT NULL returns NULL.\n \nBy default, the ! operator has a higher precedence. If the\nHIGH_NOT_PRECEDENCE SQL_MODE flag is set, NOT and ! have the\nsame precedence.\n \nExamples\n-------- \nSELECT NOT 10;\n \n+--------+\n| NOT 10 |\n+--------+\n| 0 |\n+--------+\n \nSELECT NOT 0;\n \n+-------+\n| NOT 0 |\n+-------+\n| 1 |\n+-------+\n \nSELECT NOT NULL;\n \n+----------+\n| NOT NULL |\n+----------+\n| NULL |\n+----------+\n \nSELECT ! (1+1);\n+---------+\n| ! (1+1) |\n+---------+\n| 0 |\n+---------+\n \nSELECT ! 1+1;\n \n+-------+\n| ! 1+1 |\n+-------+\n| 1 |\n+-------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/not/','','https://mariadb.com/kb/en/library/not/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (178,15,'&amp;&amp;','Syntax\n------ \nAND, &&\n \nDescription\n----------- \nLogical AND. Evaluates to 1 if all operands are non-zero and\nnot NULL,\nto 0 if one or more operands are 0, otherwise NULL is\nreturned.\n \nFor this operator, short-circuit evaluation can be used.\n \nExamples\n-------- \nSELECT 1 && 1;\n \n+--------+\n| 1 && 1 |\n+--------+\n| 1 |\n+--------+\n \nSELECT 1 && 0;\n \n+--------+\n| 1 && 0 |\n+--------+\n| 0 |\n+--------+\n \nSELECT 1 && NULL;\n \n+-----------+\n| 1 && NULL |\n+-----------+\n| NULL |\n+-----------+\n \nSELECT 0 && NULL;\n \n+-----------+\n| 0 && NULL |\n+-----------+\n| 0 |\n+-----------+\n \nSELECT NULL && 0;\n \n+-----------+\n| NULL && 0 |\n+-----------+\n| 0 |\n+-----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/and/','','https://mariadb.com/kb/en/library/and/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (179,15,'||','Syntax\n------ \nOR, ||\n \nDescription\n----------- \nLogical OR. When both operands are non-NULL, the result is 1\nif any\noperand is non-zero, and 0 otherwise. With a NULL operand,\nthe result\nis 1 if the other operand is non-zero, and NULL otherwise.\nIf both\noperands are NULL, the result is NULL.\n \nFor this operator, short-circuit evaluation can be used.\n \nNote that, if the PIPES_AS_CONCAT SQL_MODE is set, || is\nused as a string concatenation operator. This means that a\n|| b is the same as CONCAT(a,b). See CONCAT() for details.\n \nOracle Mode\n \nIn Oracle mode from MariaDB 10.3, || ignores NULL.\n \nExamples\n-------- \nSELECT 1 || 1;\n \n+--------+\n| 1 || 1 |\n+--------+\n| 1 |\n+--------+\n \nSELECT 1 || 0;\n \n+--------+\n| 1 || 0 |\n+--------+\n| 1 |\n+--------+\n \nSELECT 0 || 0;\n \n+--------+\n| 0 || 0 |\n+--------+\n| 0 |\n+--------+\n \nSELECT 0 || NULL;\n \n+-----------+\n| 0 || NULL |\n+-----------+\n| NULL |\n+-----------+\n \nSELECT 1 || NULL;\n \n+-----------+\n| 1 || NULL |\n+-----------+\n| 1 |\n+-----------+\n \nIn Oracle mode, from MariaDB 10.3:\n \nSELECT 0 || NULL;\n \n+-----------+\n| 0 || NULL |\n+-----------+\n| 0 |\n+-----------+\n \n\n\nURL: https://mariadb.com/kb/en/library/or/','','https://mariadb.com/kb/en/library/or/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (180,15,'XOR','Syntax\n------ \nXOR\n \nDescription\n----------- \nXOR stands for eXclusive OR. Returns NULL if either operand\nis NULL. For non-NULL\noperands, evaluates to 1 if an odd number of operands is\nnon-zero,\notherwise 0 is returned.\n \nExamples\n-------- \nSELECT 1 XOR 1;\n \n+---------+\n| 1 XOR 1 |\n+---------+\n| 0 |\n+---------+\n \nSELECT 1 XOR 0;\n \n+---------+\n| 1 XOR 0 |\n+---------+\n| 1 |\n+---------+\n \nSELECT 1 XOR NULL;\n \n+------------+\n| 1 XOR NULL |\n+------------+\n| NULL |\n+------------+\n \nIn the following example, the right 1 XOR 1 is evaluated\nfirst, and returns 0. Then, 1 XOR 0 is evaluated, and 1 is\nreturned.\n \nSELECT 1 XOR 1 XOR 1;\n \n+---------------+\n| 1 XOR 1 XOR 1 |\n+---------------+\n| 1 |\n+---------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/xor/','','https://mariadb.com/kb/en/library/xor/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (181,15,'Assignment Operator (=)','Syntax\n------ \nidentifier = expr\n \nDescription\n----------- \nThe equal sign is used as both an assignment operator in\ncertain contexts, and as a comparison operator. When used as\nassignment operator, the value on the right is assigned to\nthe variable (or column, in some contexts) on the left.\n \nSince its use can be ambiguous, unlike the := assignment\noperator, the = assignment operator cannot be used in all\ncontexts, and is only valid as part of a SET statement, or\nthe SET clause of an UPDATE statement\n \nThis operator works with both user-defined variables and\nlocal variables.\n \nExamples\n-------- \nUPDATE table_name SET x = 2 WHERE x > 100;\n \nSET @x = 1, @y := 2;\n \n\n \n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/assignment-operators-assignment-operator/','','https://mariadb.com/kb/en/library/assignment-operators-assignment-operator/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (182,15,'Assignment Operator (:=)','Syntax\n------ \nvar_name := expr\n \nDescription\n----------- \nAssignment operator for assigning a value. The value on the\nright is assigned to the variable on left.\n \nUnlike the = operator, := can always be used to assign a\nvalue to a variable.\n \nThis operator works with both user-defined variables and\nlocal variables.\n \nWhen assigning the same value to several variables,\nLAST_VALUE() can be useful.\n \nExamples\n-------- \n SELECT @x := 10;\n \n+----------+\n| @x := 10 |\n+----------+\n| 10 |\n+----------+\n \nSELECT @x, @y := @x;\n \n+------+----------+\n| @x | @y := @x |\n+------+----------+\n| 10 | 10 |\n+------+----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/assignment-operator/','','https://mariadb.com/kb/en/library/assignment-operator/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (183,16,'Stored Aggregate Functions','The ability to create stored aggregate functions was added\nin MariaDB 10.3.3.\n \nAggregate functions are functions that are computed over a\nsequence of rows and return one result for the sequence of\nrows.\n \nCreating a custom aggregate function is done using the\nCREATE FUNCTION statement with two main differences:\nThe addition of the AGGREGATE keyword, so CREATE AGGREGATE\nFUNCTION\nThe FETCH GROUP NEXT ROW instruction inside the loop\nOracle PL/SQL compatibility using SQL/PL is provided\n \nStandard Syntax\n \nCREATE AGGREGATE FUNCTION function_name (parameters) RETURNS\nreturn_type\nBEGIN\n All types of declarations\n DECLARE CONTINUE HANDLER FOR NOT FOUND RETURN return_val;\n LOOP\n FETCH GROUP NEXT ROW; // fetches next row from table\n other instructions\n END LOOP;\nEND\n \nStored aggregate functions were a 2016 Google Summer of Code\nproject by Varun Gupta.\n \nUsing SQL/PL\n \nSET sql_mode=Oracle;\nDELIMITER //\n \nCREATE AGGREGATE FUNCTION function_name (parameters) RETURN\nreturn_type\n declarations\nBEGIN\n LOOP\n FETCH GROUP NEXT ROW; -- fetches next row from table\n -- other instructions\n \n END LOOP;\nEXCEPTION\n WHEN NO_DATA_FOUND THEN\n RETURN return_val;\nEND //\n \nDELIMITER ;\n \nExamples\n-------- \nFirst a simplified example:\n \nCREATE TABLE marks(stud_id INT, grade_count INT);\n \nINSERT INTO marks VALUES (1,6), (2,4), (3,7), (4,5), (5,8);\n \nSELECT * FROM marks;\n \n+---------+-------------+\n| stud_id | grade_count |\n+---------+-------------+\n| 1 | 6 |\n| 2 | 4 |\n| 3 | 7 |\n| 4 | 5 |\n| 5 | 8 |\n+---------+-------------+\n \nDELIMITER //\nCREATE AGGREGATE FUNCTION IF NOT EXISTS aggregate_count(x\nINT) RETURNS INT\nBEGIN\n DECLARE count_students INT DEFAULT 0;\n \n DECLARE CONTINUE HANDLER FOR NOT FOUND\n RETURN count_students;\n \n LOOP\n FETCH GROUP NEXT ROW;\n \n IF x THEN\n SET count_students = count_students+1;\n \n END IF;\n \n END LOOP;\n \nEND //\nDELIMITER ;\n \nA non-trivial example that cannot easily be rewritten using\nexisting functions:\n \nDELIMITER //\nCREATE AGGREGATE FUNCTION medi_int(x INT) RETURNS DOUBLE\nBEGIN\n DECLARE CONTINUE HANDLER FOR NOT FOUND\n BEGIN\n DECLARE res DOUBLE;\n \n DECLARE cnt INT DEFAULT (SELECT COUNT(*) FROM tt);\n DECLARE lim INT DEFAULT (cnt-1) DIV 2;\n \n IF cnt % 2 = 0 THEN\n SET res = (SELECT AVG(a) FROM (SELECT a FROM tt ORDER BY a\nLIMIT lim,2) ttt);\n ELSE\n SET res = (SELECT a FROM tt ORDER BY a LIMIT lim,1);\n END IF;\n \n DROP TEMPORARY TABLE tt;\n \n RETURN res;\n \n END;\n \n CREATE TEMPORARY TABLE tt (a INT);\n LOOP\n FETCH GROUP NEXT ROW;\n \n INSERT INTO tt VALUES (x);\n END LOOP;\n \nEND //\nDELIMITER ;\n \nSQL/PL Example\n \nThis uses the same marks table as created above.\n \nSET sql_mode=Oracle;\n \nDELIMITER //\n \nCREATE AGGREGATE FUNCTION aggregate_count(x INT) RETURN INT\nAS count_students INT DEFAULT 0;\n \nBEGIN\n LOOP\n FETCH GROUP NEXT ROW;\n \n IF x THEN\n SET count_students := count_students+1;\n \n END IF;\n \n END LOOP;\n \nEXCEPTION\n WHEN NO_DATA_FOUND THEN\n RETURN count_students;\n \nEND aggregate_count //\nDELIMITER ;\n \nSELECT aggregate_count(stud_id) FROM marks;\n \n\n\nURL:\nhttps://mariadb.com/kb/en/library/stored-aggregate-functions/','','https://mariadb.com/kb/en/library/stored-aggregate-functions/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (184,16,'AVG','Syntax\n------ \nAVG([DISTINCT] expr)\n \nDescription\n----------- \nReturns the average value of expr. The DISTINCT option can\nbe used to return the average of the distinct values of\nexpr. NULL values are ignored. It is an aggregate function,\nand so can be used with the GROUP BY clause.\n \nAVG() returns NULL if there were no matching rows.\n \nFrom MariaDB 10.2.0, AVG() can be used as a window function.\n \nExamples\n-------- \nCREATE TABLE sales (sales_value INT);\n \nINSERT INTO sales VALUES(10),(20),(20),(40);\n \nSELECT AVG(sales_value) FROM sales;\n \n+------------------+\n| AVG(sales_value) |\n+------------------+\n| 22.5000 |\n+------------------+\n \nSELECT AVG(DISTINCT(sales_value)) FROM sales;\n \n+----------------------------+\n| AVG(DISTINCT(sales_value)) |\n+----------------------------+\n| 23.3333 |\n+----------------------------+\n \nCommonly, AVG() is used with a GROUP BY clause:\n \nCREATE TABLE student (name CHAR(10), test CHAR(10), score\nTINYINT); \n \nINSERT INTO student VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87), (\'Tatiana\', \'Tuning\', 83);\n \nSELECT name, AVG(score) FROM student GROUP BY name;\n \n+---------+------------+\n| name | AVG(score) |\n+---------+------------+\n| Chun | 74.0000 |\n| Esben | 37.0000 |\n| Kaolin | 72.0000 |\n| Tatiana | 85.0000 |\n+---------+------------+\n \nBe careful to avoid this common mistake, not grouping\ncorrectly and returning mismatched data: \n \nSELECT name,test,AVG(score) FROM student;\n \n+------+------+------------+\n| name | test | MIN(score) |\n+------+------+------------+\n| Chun | SQL | 31 |\n+------+------+------------+\n \nAs a window function:\n \nCREATE TABLE student_test (name CHAR(10), test CHAR(10),\nscore TINYINT); \n \nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87), (\'Tatiana\', \'Tuning\', 83);\n \nSELECT name, test, score, AVG(score) OVER (PARTITION BY\ntest) \n AS average_by_test FROM student_test;\n \n+---------+--------+-------+-----------------+\n| name | test | score | average_by_test |\n+---------+--------+-------+-----------------+\n| Chun | SQL | 75 | 65.2500 |\n| Chun | Tuning | 73 | 68.7500 |\n| Esben | SQL | 43 | 65.2500 |\n| Esben | Tuning | 31 | 68.7500 |\n| Kaolin | SQL | 56 | 65.2500 |\n| Kaolin | Tuning | 88 | 68.7500 |\n| Tatiana | SQL | 87 | 65.2500 |\n| Tatiana | Tuning | 83 | 68.7500 |\n+---------+--------+-------+-----------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/avg/','','https://mariadb.com/kb/en/library/avg/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (185,16,'BIT_AND','Syntax\n------ \nBIT_AND(expr)\n \nDescription\n----------- \nReturns the bitwise AND of all bits in expr. The calculation\nis performed with 64-bit (BIGINT) precision. It is an\naggregate function, and so can be used with the GROUP BY\nclause.\n \nFrom MariaDB 10.2.0, BIT_AND() can be used as a window\nfunction.\n \nExamples\n-------- \nCREATE TABLE vals (x INT);\n \nINSERT INTO vals VALUES(111),(110),(100);\n \nSELECT BIT_AND(x), BIT_OR(x), BIT_XOR(x) FROM vals;\n \n+------------+-----------+------------+\n| BIT_AND(x) | BIT_OR(x) | BIT_XOR(x) |\n+------------+-----------+------------+\n| 100 | 111 | 101 |\n+------------+-----------+------------+\n \nAs an aggregate function:\n \nCREATE TABLE vals2 (category VARCHAR(1), x INT);\n \nINSERT INTO vals2 VALUES\n (\'a\',111),(\'a\',110),(\'a\',100),\n (\'b\',\'000\'),(\'b\',001),(\'b\',011);\n \nSELECT category, BIT_AND(x), BIT_OR(x), BIT_XOR(x) \n FROM vals GROUP BY category;\n \n+----------+------------+-----------+------------+\n| category | BIT_AND(x) | BIT_OR(x) | BIT_XOR(x) |\n+----------+------------+-----------+------------+\n| a | 100 | 111 | 101 |\n| b | 0 | 11 | 10 |\n+----------+------------+-----------+------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/bit_and/','','https://mariadb.com/kb/en/library/bit_and/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (186,16,'BIT_OR','Syntax\n------ \nBIT_OR(expr)\n \nDescription\n----------- \nReturns the bitwise OR of all bits in expr. The calculation\nis performed with 64-bit (BIGINT) precision. It is an\naggregate function, and so can be used with the GROUP BY\nclause.\n \nFrom MariaDB 10.2.0, BIT_OR can be used as a window\nfunction.\n \nExamples\n-------- \nCREATE TABLE vals (x INT);\n \nINSERT INTO vals VALUES(111),(110),(100);\n \nSELECT BIT_AND(x), BIT_OR(x), BIT_XOR(x) FROM vals;\n \n+------------+-----------+------------+\n| BIT_AND(x) | BIT_OR(x) | BIT_XOR(x) |\n+------------+-----------+------------+\n| 100 | 111 | 101 |\n+------------+-----------+------------+\n \nAs an aggregate function:\n \nCREATE TABLE vals2 (category VARCHAR(1), x INT);\n \nINSERT INTO vals2 VALUES\n (\'a\',111),(\'a\',110),(\'a\',100),\n (\'b\',\'000\'),(\'b\',001),(\'b\',011);\n \nSELECT category, BIT_AND(x), BIT_OR(x), BIT_XOR(x) \n FROM vals GROUP BY category;\n \n+----------+------------+-----------+------------+\n| category | BIT_AND(x) | BIT_OR(x) | BIT_XOR(x) |\n+----------+------------+-----------+------------+\n| a | 100 | 111 | 101 |\n| b | 0 | 11 | 10 |\n+----------+------------+-----------+------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/bit_or/','','https://mariadb.com/kb/en/library/bit_or/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (187,16,'BIT_XOR','Syntax\n------ \nBIT_XOR(expr)\n \nDescription\n----------- \nReturns the bitwise XOR of all bits in expr. The calculation\nis performed with 64-bit (BIGINT) precision. It is an\naggregate function, and so can be used with the GROUP BY\nclause.\n \nFrom MariaDB 10.2.0, BIT_XOR() can be used as a window\nfunction.\n \nExamples\n-------- \nCREATE TABLE vals (x INT);\n \nINSERT INTO vals VALUES(111),(110),(100);\n \nSELECT BIT_AND(x), BIT_OR(x), BIT_XOR(x) FROM vals;\n \n+------------+-----------+------------+\n| BIT_AND(x) | BIT_OR(x) | BIT_XOR(x) |\n+------------+-----------+------------+\n| 100 | 111 | 101 |\n+------------+-----------+------------+\n \nAs an aggregate function:\n \nCREATE TABLE vals2 (category VARCHAR(1), x INT);\n \nINSERT INTO vals2 VALUES\n (\'a\',111),(\'a\',110),(\'a\',100),\n (\'b\',\'000\'),(\'b\',001),(\'b\',011);\n \nSELECT category, BIT_AND(x), BIT_OR(x), BIT_XOR(x) \n FROM vals GROUP BY category;\n \n+----------+------------+-----------+------------+\n| category | BIT_AND(x) | BIT_OR(x) | BIT_XOR(x) |\n+----------+------------+-----------+------------+\n| a | 100 | 111 | 101 |\n| b | 0 | 11 | 10 |\n+----------+------------+-----------+------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/bit_xor/','','https://mariadb.com/kb/en/library/bit_xor/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (188,16,'COUNT','Syntax\n------ \nCOUNT(expr)\n \nDescription\n----------- \nReturns a count of the number of non-NULL values of expr in\nthe rows retrieved by a SELECT statement. The result is a\nBIGINT value. It is an aggregate function, and so can be\nused with the GROUP BY clause.\n \nCOUNT(*) counts the total number of rows in a table.\n \nCOUNT() returns 0 if there were no matching rows.\n \nFrom MariaDB 10.2.0, COUNT() can be used as a window\nfunction.\n \nExamples\n-------- \nCREATE TABLE student (name CHAR(10), test CHAR(10), score\nTINYINT); \n \nINSERT INTO student VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87), (\'Tatiana\', \'Tuning\', 83);\n \nSELECT COUNT(*) FROM student;\n \n+----------+\n| COUNT(*) |\n+----------+\n| 8 |\n+----------+\n \nCOUNT(DISTINCT) example:\n \nSELECT COUNT(DISTINCT (name)) FROM student;\n \n+------------------------+\n| COUNT(DISTINCT (name)) |\n+------------------------+\n| 4 |\n+------------------------+\n \nAs a window function\n \nCREATE OR REPLACE TABLE student_test (name CHAR(10), test\nCHAR(10), score TINYINT);\n \nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87);\n \nSELECT name, test, score, COUNT(score) OVER (PARTITION BY\nname) \n AS tests_written FROM student_test;\n \n+---------+--------+-------+---------------+\n| name | test | score | tests_written |\n+---------+--------+-------+---------------+\n| Chun | SQL | 75 | 2 |\n| Chun | Tuning | 73 | 2 |\n| Esben | SQL | 43 | 2 |\n| Esben | Tuning | 31 | 2 |\n| Kaolin | SQL | 56 | 2 |\n| Kaolin | Tuning | 88 | 2 |\n| Tatiana | SQL | 87 | 1 |\n+---------+--------+-------+---------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/count/','','https://mariadb.com/kb/en/library/count/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (189,16,'GROUP_CONCAT','Syntax\n------ \nGROUP_CONCAT(expr)\n \nDescription\n----------- \nThis function returns a string result with the concatenated\nnon-NULL\nvalues from a group. It returns NULL if there are no\nnon-NULL values.\n \nThe maximum returned length in bytes is determined by the\ngroup_concat_max_len server system variable, which defaults\nto 1M (>= MariaDB 10.2.4) or 1K (\n\nURL: https://mariadb.com/kb/en/library/group_concat/','','https://mariadb.com/kb/en/library/group_concat/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (190,16,'MAX','Syntax\n------ \nMAX([DISTINCT] expr)\n \nDescription\n----------- \nReturns the largest, or maximum, value of expr. MAX() can\nalso take a string\nargument in which case it returns the maximum string value.\nThe DISTINCT\nkeyword can be used to find the maximum of the distinct\nvalues of expr,\nhowever, this produces the same result as omitting DISTINCT.\n \nNote that SET and ENUM fields are currently compared by\ntheir string value rather than their relative position in\nthe set, so MAX() may produce a different highest result\nthan ORDER BY DESC.\n \nIt is an aggregate function, and so can be used with the\nGROUP BY clause.\n \nFrom MariaDB 10.2.2, MAX() can be used as a window function.\n \nMAX() returns NULL if there were no matching rows.\n \nExamples\n-------- \nCREATE TABLE student (name CHAR(10), test CHAR(10), score\nTINYINT); \n \nINSERT INTO student VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87), (\'Tatiana\', \'Tuning\', 83);\n \nSELECT name, MAX(score) FROM student GROUP BY name;\n \n+---------+------------+\n| name | MAX(score) |\n+---------+------------+\n| Chun | 75 |\n| Esben | 43 |\n| Kaolin | 88 |\n| Tatiana | 87 |\n+---------+------------+\n \nMAX string:\n \nSELECT MAX(name) FROM student;\n \n+-----------+\n| MAX(name) |\n+-----------+\n| Tatiana |\n+-----------+\n \nBe careful to avoid this common mistake, not grouping\ncorrectly and returning mismatched data: \n \nSELECT name,test,MAX(SCORE) FROM student;\n \n+------+------+------------+\n| name | test | MAX(SCORE) |\n+------+------+------------+\n| Chun | SQL | 88 |\n+------+------+------------+\n \nDifference between ORDER BY DESC and MAX():\n \nCREATE TABLE student2(name CHAR(10),grade\nENUM(\'b\',\'c\',\'a\'));\n \nINSERT INTO student2\nVALUES(\'Chun\',\'b\'),(\'Esben\',\'c\'),(\'Kaolin\',\'a\');\n \nSELECT MAX(grade) FROM student2;\n \n+------------+\n| MAX(grade) |\n+------------+\n| c |\n+------------+\n \nSELECT grade FROM student2 ORDER BY grade DESC LIMIT 1;\n \n+-------+\n| grade |\n+-------+\n| a |\n+-------+\n \nAs a window function:\n \nCREATE OR REPLACE TABLE student_test (name CHAR(10), test\nCHAR(10), score TINYINT);\nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87);\n \nSELECT name, test, score, MAX(score) \n OVER (PARTITION BY name) AS highest_score FROM\nstudent_test;\n \n+---------+--------+-------+---------------+\n| name | test | score | highest_score |\n+---------+--------+-------+---------------+\n| Chun | SQL | 75 | 75 |\n| Chun | Tuning | 73 | 75 |\n| Esben | SQL | 43 | 43 |\n| Esben | Tuning | 31 | 43 |\n| Kaolin | SQL | 56 | 88 |\n| Kaolin | Tuning | 88 | 88 |\n| Tatiana | SQL | 87 | 87 |\n+---------+--------+-------+---------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/max/','','https://mariadb.com/kb/en/library/max/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (191,16,'MIN','Syntax\n------ \nMIN([DISTINCT] expr)\n \nDescription\n----------- \nReturns the minimum value of expr. MIN() may take a string\nargument, in which case it returns the minimum string value.\nThe DISTINCT\nkeyword can be used to find the minimum of the distinct\nvalues of expr,\nhowever, this produces the same result as omitting DISTINCT.\n \nNote that SET and ENUM fields are currently compared by\ntheir string value rather than their relative position in\nthe set, so MIN() may produce a different lowest result than\nORDER BY ASC.\n \nIt is an aggregate function, and so can be used with the\nGROUP BY clause.\n \nFrom MariaDB 10.2.2, MIN() can be used as a window function.\n \nMIN() returns NULL if there were no matching rows.\n \nExamples\n-------- \nCREATE TABLE student (name CHAR(10), test CHAR(10), score\nTINYINT); \n \nINSERT INTO student VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87), (\'Tatiana\', \'Tuning\', 83);\n \nSELECT name, MIN(score) FROM student GROUP BY name;\n \n+---------+------------+\n| name | MIN(score) |\n+---------+------------+\n| Chun | 73 |\n| Esben | 31 |\n| Kaolin | 56 |\n| Tatiana | 83 |\n+---------+------------+\n \nMIN() with a string:\n \nSELECT MIN(name) FROM student;\n \n+-----------+\n| MIN(name) |\n+-----------+\n| Chun |\n+-----------+\n \nBe careful to avoid this common mistake, not grouping\ncorrectly and returning mismatched data: \n \nSELECT name,test,MIN(score) FROM student;\n \n+------+------+------------+\n| name | test | MIN(score) |\n+------+------+------------+\n| Chun | SQL | 31 |\n+------+------+------------+\n \nDifference between ORDER BY ASC and MIN():\n \nCREATE TABLE student2(name CHAR(10),grade\nENUM(\'b\',\'c\',\'a\'));\n \nINSERT INTO student2\nVALUES(\'Chun\',\'b\'),(\'Esben\',\'c\'),(\'Kaolin\',\'a\');\n \nSELECT MIN(grade) FROM student2;\n \n+------------+\n| MIN(grade) |\n+------------+\n| a |\n+------------+\n \nSELECT grade FROM student2 ORDER BY grade ASC LIMIT 1;\n \n+-------+\n| grade |\n+-------+\n| b |\n+-------+\n \nAs a window function:\n \nCREATE OR REPLACE TABLE student_test (name CHAR(10), test\nCHAR(10), score TINYINT);\nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87);\n \nSELECT name, test, score, MIN(score) \n OVER (PARTITION BY name) AS lowest_score FROM student_test;\n \n+---------+--------+-------+--------------+\n| name | test | score | lowest_score |\n+---------+--------+-------+--------------+\n| Chun | SQL | 75 | 73 |\n| Chun | Tuning | 73 | 73 |\n| Esben | SQL | 43 | 31 |\n| Esben | Tuning | 31 | 31 |\n| Kaolin | SQL | 56 | 56 |\n| Kaolin | Tuning | 88 | 56 |\n| Tatiana | SQL | 87 | 87 |\n+---------+--------+-------+--------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/min/','','https://mariadb.com/kb/en/library/min/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (192,16,'STD','Syntax\n------ \nSTD(expr)\n \nDescription\n----------- \nReturns the population standard deviation of expr. This is\nan extension\nto standard SQL. The standard SQL function STDDEV_POP() can\nbe used instead. \n \nIt is an aggregate function, and so can be used with the\nGROUP BY clause.\n \nFrom MariaDB 10.2.2, STD() can be used as a window function.\n \nThis function returns NULL if there were no matching rows.\n \nExamples\n-------- \nAs an aggregate function:\n \nCREATE OR REPLACE TABLE stats (category VARCHAR(2), x INT);\n \nINSERT INTO stats VALUES \n (\'a\',1),(\'a\',2),(\'a\',3),\n (\'b\',11),(\'b\',12),(\'b\',20),(\'b\',30),(\'b\',60);\n \nSELECT category, STDDEV_POP(x), STDDEV_SAMP(x), VAR_POP(x) \n FROM stats GROUP BY category;\n \n+----------+---------------+----------------+------------+\n| category | STDDEV_POP(x) | STDDEV_SAMP(x) | VAR_POP(x) |\n+----------+---------------+----------------+------------+\n| a | 0.8165 | 1.0000 | 0.6667 |\n| b | 18.0400 | 20.1693 | 325.4400 |\n+----------+---------------+----------------+------------+\n \nAs a window function:\n \nCREATE OR REPLACE TABLE student_test (name CHAR(10), test\nCHAR(10), score TINYINT);\n \nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87);\n \nSELECT name, test, score, STDDEV_POP(score) \n OVER (PARTITION BY test) AS stddev_results FROM\nstudent_test;\n \n+---------+--------+-------+----------------+\n| name | test | score | stddev_results |\n+---------+--------+-------+----------------+\n| Chun | SQL | 75 | 16.9466 |\n| Chun | Tuning | 73 | 24.1247 |\n| Esben | SQL | 43 | 16.9466 |\n| Esben | Tuning | 31 | 24.1247 |\n| Kaolin | SQL | 56 | 16.9466 |\n| Kaolin | Tuning | 88 | 24.1247 |\n| Tatiana | SQL | 87 | 16.9466 |\n+---------+--------+-------+----------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/std/','','https://mariadb.com/kb/en/library/std/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (193,16,'STDDEV','Syntax\n------ \nSTDDEV(expr)\n \nDescription\n----------- \nReturns the population standard deviation of expr. This\nfunction is\nprovided for compatibility with Oracle. The standard SQL\nfunction\nSTDDEV_POP() can be used instead.\n \nIt is an aggregate function, and so can be used with the\nGROUP BY clause.\n \nFrom MariaDB 10.2.2, STDDEV() can be used as a window\nfunction.\n \nThis function returns NULL if there were no matching rows.\n \nExamples\n-------- \nAs an aggregate function:\n \nCREATE OR REPLACE TABLE stats (category VARCHAR(2), x INT);\n \nINSERT INTO stats VALUES \n (\'a\',1),(\'a\',2),(\'a\',3),\n (\'b\',11),(\'b\',12),(\'b\',20),(\'b\',30),(\'b\',60);\n \nSELECT category, STDDEV_POP(x), STDDEV_SAMP(x), VAR_POP(x) \n FROM stats GROUP BY category;\n \n+----------+---------------+----------------+------------+\n| category | STDDEV_POP(x) | STDDEV_SAMP(x) | VAR_POP(x) |\n+----------+---------------+----------------+------------+\n| a | 0.8165 | 1.0000 | 0.6667 |\n| b | 18.0400 | 20.1693 | 325.4400 |\n+----------+---------------+----------------+------------+\n \nAs a window function:\n \nCREATE OR REPLACE TABLE student_test (name CHAR(10), test\nCHAR(10), score TINYINT);\n \nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87);\n \nSELECT name, test, score, STDDEV_POP(score) \n OVER (PARTITION BY test) AS stddev_results FROM\nstudent_test;\n \n+---------+--------+-------+----------------+\n| name | test | score | stddev_results |\n+---------+--------+-------+----------------+\n| Chun | SQL | 75 | 16.9466 |\n| Chun | Tuning | 73 | 24.1247 |\n| Esben | SQL | 43 | 16.9466 |\n| Esben | Tuning | 31 | 24.1247 |\n| Kaolin | SQL | 56 | 16.9466 |\n| Kaolin | Tuning | 88 | 24.1247 |\n| Tatiana | SQL | 87 | 16.9466 |\n+---------+--------+-------+----------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/stddev/','','https://mariadb.com/kb/en/library/stddev/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (194,16,'STDDEV_POP','Syntax\n------ \nSTDDEV_POP(expr)\n \nDescription\n----------- \nReturns the population standard deviation of expr (the\nsquare root of\nVAR_POP()). You can also use STD() or\nSTDDEV(), which are equivalent but not standard SQL.\n \nIt is an aggregate function, and so can be used with the\nGROUP BY clause.\n \nFrom MariaDB 10.2.2, STDDEV_POP() can be used as a window\nfunction.\n \nSTDDEV_POP() returns NULL if there were no matching rows.\n \nExamples\n-------- \nAs an aggregate function:\n \nCREATE OR REPLACE TABLE stats (category VARCHAR(2), x INT);\n \nINSERT INTO stats VALUES \n (\'a\',1),(\'a\',2),(\'a\',3),\n (\'b\',11),(\'b\',12),(\'b\',20),(\'b\',30),(\'b\',60);\n \nSELECT category, STDDEV_POP(x), STDDEV_SAMP(x), VAR_POP(x) \n FROM stats GROUP BY category;\n \n+----------+---------------+----------------+------------+\n| category | STDDEV_POP(x) | STDDEV_SAMP(x) | VAR_POP(x) |\n+----------+---------------+----------------+------------+\n| a | 0.8165 | 1.0000 | 0.6667 |\n| b | 18.0400 | 20.1693 | 325.4400 |\n+----------+---------------+----------------+------------+\n \nAs a window function:\n \nCREATE OR REPLACE TABLE student_test (name CHAR(10), test\nCHAR(10), score TINYINT);\n \nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87);\n \nSELECT name, test, score, STDDEV_POP(score) \n OVER (PARTITION BY test) AS stddev_results FROM\nstudent_test;\n \n+---------+--------+-------+----------------+\n| name | test | score | stddev_results |\n+---------+--------+-------+----------------+\n| Chun | SQL | 75 | 16.9466 |\n| Chun | Tuning | 73 | 24.1247 |\n| Esben | SQL | 43 | 16.9466 |\n| Esben | Tuning | 31 | 24.1247 |\n| Kaolin | SQL | 56 | 16.9466 |\n| Kaolin | Tuning | 88 | 24.1247 |\n| Tatiana | SQL | 87 | 16.9466 |\n+---------+--------+-------+----------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/stddev_pop/','','https://mariadb.com/kb/en/library/stddev_pop/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (195,16,'STDDEV_SAMP','Syntax\n------ \nSTDDEV_SAMP(expr)\n \nDescription\n----------- \nReturns the sample standard deviation of expr (the square\nroot of VAR_SAMP()).\n \nIt is an aggregate function, and so can be used with the\nGROUP BY clause.\n \nFrom MariaDB 10.2.2, STDDEV_SAMP() can be used as a window\nfunction.\n \nSTDDEV_SAMP() returns NULL if there were no matching rows.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/stddev_samp/','','https://mariadb.com/kb/en/library/stddev_samp/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (196,16,'SUM','Syntax\n------ \nSUM([DISTINCT] expr)\n \nDescription\n----------- \nReturns the sum of expr. If the return set has no rows,\nSUM() returns\nNULL. The DISTINCT keyword can be used to sum only the\ndistinct values\nof expr.\n \nFrom MariaDB 10.2.0, SUM() can be used as a window function,\nalthough not with the DISTINCT specifier.\n \nExamples\n-------- \nCREATE TABLE sales (sales_value INT);\nINSERT INTO sales VALUES(10),(20),(20),(40);\n \nSELECT SUM(sales_value) FROM sales;\n \n+------------------+\n| SUM(sales_value) |\n+------------------+\n| 90 |\n+------------------+\n \nSELECT SUM(DISTINCT(sales_value)) FROM sales;\n \n+----------------------------+\n| SUM(DISTINCT(sales_value)) |\n+----------------------------+\n| 70 |\n+----------------------------+\n \nCommonly, SUM is used with a GROUP BY clause:\n \nCREATE TABLE sales (name CHAR(10), month CHAR(10), units\nINT);\n \nINSERT INTO sales VALUES \n (\'Chun\', \'Jan\', 75), (\'Chun\', \'Feb\', 73),\n (\'Esben\', \'Jan\', 43), (\'Esben\', \'Feb\', 31),\n (\'Kaolin\', \'Jan\', 56), (\'Kaolin\', \'Feb\', 88),\n (\'Tatiana\', \'Jan\', 87), (\'Tatiana\', \'Feb\', 83);\n \nSELECT name, SUM(units) FROM sales GROUP BY name;\n \n+---------+------------+\n| name | SUM(units) |\n+---------+------------+\n| Chun | 148 |\n| Esben | 74 |\n| Kaolin | 144 |\n| Tatiana | 170 |\n+---------+------------+\n \nThe GROUP BY clause is required when using an aggregate\nfunction along with regular column data, otherwise the\nresult will be a mismatch, as in the following common type\nof mistake:\n \nSELECT name,SUM(units) FROM sales\n;\n+------+------------+\n| name | SUM(units) |\n+------+------------+\n| Chun | 536 |\n+------+------------+\n \nAs a window function:\n \nCREATE OR REPLACE TABLE student_test (name CHAR(10), test\nCHAR(10), score TINYINT);\nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87);\n \nSELECT name, test, score, SUM(score) OVER (PARTITION BY\nname) AS total_score FROM student_test;\n \n+---------+--------+-------+-------------+\n| name | test | score | total_score |\n+---------+--------+-------+-------------+\n| Chun | SQL | 75 | 148 |\n| Chun | Tuning | 73 | 148 |\n| Esben | SQL | 43 | 74 |\n| Esben | Tuning | 31 | 74 |\n| Kaolin | SQL | 56 | 144 |\n| Kaolin | Tuning | 88 | 144 |\n| Tatiana | SQL | 87 | 87 |\n+---------+--------+-------+-------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/sum/','','https://mariadb.com/kb/en/library/sum/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (197,16,'VARIANCE','Syntax\n------ \nVARIANCE(expr) \n \nDescription\n----------- \nReturns the population standard variance of expr. This is an\nextension to\nstandard SQL. The standard SQL function VAR_POP() can be\nused\ninstead.\n \nVariance is calculated by\nworking out the mean for the set\nfor each number, subtracting the mean and squaring the\nresult\ncalculate the average of the resulting differences\n \nIt is an aggregate function, and so can be used with the\nGROUP BY clause.\n \nFrom MariaDB 10.2.2, VARIANCE() can be used as a window\nfunction.\n \nVARIANCE() returns NULL if there were no matching rows.\n \nExamples\n-------- \nCREATE TABLE v(i tinyint);\n \nINSERT INTO v VALUES(101),(99);\n \nSELECT VARIANCE(i) FROM v;\n \n+-------------+\n| VARIANCE(i) |\n+-------------+\n| 1.0000 |\n+-------------+\n \nINSERT INTO v VALUES(120),(80);\n \nSELECT VARIANCE(i) FROM v;\n \n+-------------+\n| VARIANCE(i) |\n+-------------+\n| 200.5000 |\n+-------------+\n \nAs an aggregate function:\n \nCREATE OR REPLACE TABLE stats (category VARCHAR(2), x INT);\n \nINSERT INTO stats VALUES \n (\'a\',1),(\'a\',2),(\'a\',3),\n (\'b\',11),(\'b\',12),(\'b\',20),(\'b\',30),(\'b\',60);\n \nSELECT category, STDDEV_POP(x), STDDEV_SAMP(x), VAR_POP(x) \n FROM stats GROUP BY category;\n \n+----------+---------------+----------------+------------+\n| category | STDDEV_POP(x) | STDDEV_SAMP(x) | VAR_POP(x) |\n+----------+---------------+----------------+------------+\n| a | 0.8165 | 1.0000 | 0.6667 |\n| b | 18.0400 | 20.1693 | 325.4400 |\n+----------+---------------+----------------+------------+\n \nAs a window function:\n \nCREATE OR REPLACE TABLE student_test (name CHAR(10), test\nCHAR(10), score TINYINT);\n \nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87);\n \nSELECT name, test, score, VAR_POP(score) \n OVER (PARTITION BY test) AS variance_results FROM\nstudent_test;\n \n+---------+--------+-------+------------------+\n| name | test | score | variance_results |\n+---------+--------+-------+------------------+\n| Chun | SQL | 75 | 287.1875 |\n| Chun | Tuning | 73 | 582.0000 |\n| Esben | SQL | 43 | 287.1875 |\n| Esben | Tuning | 31 | 582.0000 |\n| Kaolin | SQL | 56 | 287.1875 |\n| Kaolin | Tuning | 88 | 582.0000 |\n| Tatiana | SQL | 87 | 287.1875 |\n+---------+--------+-------+------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/variance/','','https://mariadb.com/kb/en/library/variance/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (198,16,'VAR_POP','Syntax\n------ \nVAR_POP(expr)\n \nDescription\n----------- \nReturns the population standard variance of expr. It\nconsiders rows as\nthe whole population, not as a sample, so it has the number\nof rows as\nthe denominator. You can also use VARIANCE(), which is\nequivalent but\nis not standard SQL.\n \nVariance is calculated by\nworking out the mean for the set\nfor each number, subtracting the mean and squaring the\nresult\ncalculate the average of the resulting differences\n \nIt is an aggregate function, and so can be used with the\nGROUP BY clause.\n \nFrom MariaDB 10.2.2, VAR_POP() can be used as a window\nfunction.\n \nVAR_POP() returns NULL if there were no matching rows.\n \nExamples\n-------- \nCREATE TABLE v(i tinyint);\n \nINSERT INTO v VALUES(101),(99);\n \nSELECT VAR_POP(i) FROM v;\n \n+------------+\n| VAR_POP(i) |\n+------------+\n| 1.0000 |\n+------------+\n \nINSERT INTO v VALUES(120),(80);\n \nSELECT VAR_POP(i) FROM v;\n \n+------------+\n| VAR_POP(i) |\n+------------+\n| 200.5000 |\n+------------+\n \nAs an aggregate function:\n \nCREATE OR REPLACE TABLE stats (category VARCHAR(2), x INT);\n \nINSERT INTO stats VALUES \n (\'a\',1),(\'a\',2),(\'a\',3),\n (\'b\',11),(\'b\',12),(\'b\',20),(\'b\',30),(\'b\',60);\n \nSELECT category, STDDEV_POP(x), STDDEV_SAMP(x), VAR_POP(x) \n FROM stats GROUP BY category;\n \n+----------+---------------+----------------+------------+\n| category | STDDEV_POP(x) | STDDEV_SAMP(x) | VAR_POP(x) |\n+----------+---------------+----------------+------------+\n| a | 0.8165 | 1.0000 | 0.6667 |\n| b | 18.0400 | 20.1693 | 325.4400 |\n+----------+---------------+----------------+------------+\n \nAs a window function:\n \nCREATE OR REPLACE TABLE student_test (name CHAR(10), test\nCHAR(10), score TINYINT);\n \nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87);\n \nSELECT name, test, score, VAR_POP(score) \n OVER (PARTITION BY test) AS variance_results FROM\nstudent_test;\n \n+---------+--------+-------+------------------+\n| name | test | score | variance_results |\n+---------+--------+-------+------------------+\n| Chun | SQL | 75 | 287.1875 |\n| Chun | Tuning | 73 | 582.0000 |\n| Esben | SQL | 43 | 287.1875 |\n| Esben | Tuning | 31 | 582.0000 |\n| Kaolin | SQL | 56 | 287.1875 |\n| Kaolin | Tuning | 88 | 582.0000 |\n| Tatiana | SQL | 87 | 287.1875 |\n+---------+--------+-------+------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/var_pop/','','https://mariadb.com/kb/en/library/var_pop/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (199,16,'VAR_SAMP','Syntax\n------ \nVAR_SAMP(expr)\n \nDescription\n----------- \nReturns the sample variance of expr. That is, the\ndenominator is the number of rows minus one.\n \nIt is an aggregate function, and so can be used with the\nGROUP BY clause.\n \nFrom MariaDB 10.2.2, VAR_SAMP() can be used as a window\nfunction.\n \nVAR_SAMP() returns NULL if there were no matching rows.\n \nExamples\n-------- \nAs an aggregate function:\n \nCREATE OR REPLACE TABLE stats (category VARCHAR(2), x INT);\n \nINSERT INTO stats VALUES \n (\'a\',1),(\'a\',2),(\'a\',3),\n (\'b\',11),(\'b\',12),(\'b\',20),(\'b\',30),(\'b\',60);\n \nSELECT category, STDDEV_POP(x), STDDEV_SAMP(x), VAR_POP(x) \n FROM stats GROUP BY category;\n \n+----------+---------------+----------------+------------+\n| category | STDDEV_POP(x) | STDDEV_SAMP(x) | VAR_POP(x) |\n+----------+---------------+----------------+------------+\n| a | 0.8165 | 1.0000 | 0.6667 |\n| b | 18.0400 | 20.1693 | 325.4400 |\n+----------+---------------+----------------+------------+\n \nAs a window function:\n \nCREATE OR REPLACE TABLE student_test (name CHAR(10), test\nCHAR(10), score TINYINT);\n \nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87);\n \nSELECT name, test, score, VAR_SAMP(score) \n OVER (PARTITION BY test) AS variance_results FROM\nstudent_test;\n \n+---------+--------+-------+------------------+\n| name | test | score | variance_results |\n+---------+--------+-------+------------------+\n| Chun | SQL | 75 | 382.9167 |\n| Chun | Tuning | 73 | 873.0000 |\n| Esben | SQL | 43 | 382.9167 |\n| Esben | Tuning | 31 | 873.0000 |\n| Kaolin | SQL | 56 | 382.9167 |\n| Kaolin | Tuning | 88 | 873.0000 |\n| Tatiana | SQL | 87 | 382.9167 |\n+---------+--------+-------+------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/var_samp/','','https://mariadb.com/kb/en/library/var_samp/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (200,17,'BENCHMARK','Syntax\n------ \nBENCHMARK(count,expr)\n \nDescription\n----------- \nThe BENCHMARK() function executes the expression expr\nrepeatedly count\ntimes. It may be used to time how quickly MariaDB processes\nthe\nexpression. The result value is always 0. The intended use\nis from\nwithin the mysql client, which reports query execution\ntimes.\n \nExamples\n-------- \nSELECT BENCHMARK(1000000,ENCODE(\'hello\',\'goodbye\'));\n+----------------------------------------------+\n| BENCHMARK(1000000,ENCODE(\'hello\',\'goodbye\')) |\n+----------------------------------------------+\n| 0 |\n+----------------------------------------------+\n1 row in set (0.21 sec)\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/benchmark/','','https://mariadb.com/kb/en/library/benchmark/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (201,17,'BINLOG_GTID_POS','From version 10.0.2, MariaDB supports global transaction IDs\nfor replication.\n \nSyntax\n------ \nBINLOG_GTID_POS(binlog_filename,binlog_offset)\n \nDescription\n----------- \nThe BINLOG_GTID_POS() function takes as input an old-style\nbinary log position in the form of a file name and a file\noffset. It looks up the position in the current binlog, and\nreturns a string representation of the corresponding GTID\nposition. If the position is not found in the current\nbinlog, NULL is returned.\n \nExamples\n-------- \nSELECT BINLOG_GTID_POS(\"master-bin.000001\", 600);\n \n\n\nURL: https://mariadb.com/kb/en/library/binlog_gtid_pos/','','https://mariadb.com/kb/en/library/binlog_gtid_pos/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (202,17,'CHARSET','Syntax\n------ \nCHARSET(str)\n \nDescription\n----------- \nReturns the character set of the string argument. If str is\nnot a string, it is considered as a binary string (so the\nfunction returns \'binary\'). This applies to NULL, too. The\nreturn value is a string in the utf8 character set.\n \nExamples\n-------- \nSELECT CHARSET(\'abc\');\n+----------------+\n| CHARSET(\'abc\') |\n+----------------+\n| latin1 |\n+----------------+\n \nSELECT CHARSET(CONVERT(\'abc\' USING utf8));\n+------------------------------------+\n| CHARSET(CONVERT(\'abc\' USING utf8)) |\n+------------------------------------+\n| utf8 |\n+------------------------------------+\n \nSELECT CHARSET(USER());\n+-----------------+\n| CHARSET(USER()) |\n+-----------------+\n| utf8 |\n+-----------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/charset/','','https://mariadb.com/kb/en/library/charset/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (203,17,'COERCIBILITY','Syntax\n------ \nCOERCIBILITY(str)\n \nDescription\n----------- \nReturns the collation coercibility value of the string\nargument. Coercibility defines what will be converted to\nwhat in case of collation conflict, with an expression with\nhigher coercibility being converted to the collation of an\nexpression with lower coercibility.\n \nCoercibility | Description | Example | \n \n0 | Explicit | Value using a COLLATE clause | \n \n1 | No collation | Concatenated strings using different\ncollations | \n \n2 | Implicit | Column value | \n \n3 | Constant | USER() return value | \n \n4 | Coercible | Literal string | \n \n5 | Ignorable | NULL or derived from NULL | \n \nExamples\n-------- \nSELECT COERCIBILITY(\'abc\' COLLATE latin1_swedish_ci);\n+-----------------------------------------------+\n| COERCIBILITY(\'abc\' COLLATE latin1_swedish_ci) |\n+-----------------------------------------------+\n| 0 |\n+-----------------------------------------------+\n \nSELECT COERCIBILITY(USER());\n+----------------------+\n| COERCIBILITY(USER()) |\n+----------------------+\n| 3 |\n+----------------------+\n \nSELECT COERCIBILITY(\'abc\');\n+---------------------+\n| COERCIBILITY(\'abc\') |\n+---------------------+\n| 4 |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/coercibility/','','https://mariadb.com/kb/en/library/coercibility/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (204,17,'COLLATION','Syntax\n------ \nCOLLATION(str)\n \nDescription\n----------- \nReturns the collation of the string argument. If str is not\na string, it is considered as a binary string (so the\nfunction returns \'binary\'). This applies to NULL, too. The\nreturn value is a string in the utf8 character set.\n \nSee Character Sets and Collations.\n \nExamples\n-------- \nSELECT COLLATION(\'abc\');\n+-------------------+\n| COLLATION(\'abc\') |\n+-------------------+\n| latin1_swedish_ci |\n+-------------------+\n \nSELECT COLLATION(_utf8\'abc\');\n+-----------------------+\n| COLLATION(_utf8\'abc\') |\n+-----------------------+\n| utf8_general_ci |\n+-----------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/collation/','','https://mariadb.com/kb/en/library/collation/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (205,17,'CONNECTION_ID','Syntax\n------ \nCONNECTION_ID()\n \nDescription\n----------- \nReturns the connection ID (thread ID) for the connection.\nEvery\nthread (including events) has an ID that is unique among the\nset of currently\nconnected clients.\n \nUntil MariaDB 10.3.1, returns MYSQL_TYPE_LONGLONG, or\nbigint(10), in all cases. From MariaDB 10.3.1, returns\nMYSQL_TYPE_LONG, or int(10), when the result would fit\nwithin 32-bits.\n \nExamples\n-------- \nSELECT CONNECTION_ID();\n+-----------------+\n| CONNECTION_ID() |\n+-----------------+\n| 3 |\n+-----------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/connection_id/','','https://mariadb.com/kb/en/library/connection_id/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (206,17,'CURRENT_ROLE','Roles were introduced in MariaDB 10.0.5.\n \nSyntax\n------ \nCURRENT_ROLE, CURRENT_ROLE()\n \nDescription\n----------- \nReturns the current role name. This determines your access\nprivileges. The return value is a string in the\nutf8 character set.\n \nIf there is no current role, NULL is returned.\n \nThe output of SELECT CURRENT_ROLE is equivalent to the\ncontents of the ENABLED_ROLES Information Schema table.\n \nUSER() returns the combination of user and host used to\nlogin. CURRENT_USER() returns the account used to determine\ncurrent connection\'s privileges.\n \nExamples\n-------- \nSELECT CURRENT_ROLE;\n \n+--------------+\n| CURRENT_ROLE |\n+--------------+\n| NULL |\n+--------------+\n \nSET ROLE staff;\n \nSELECT CURRENT_ROLE;\n \n+--------------+\n| CURRENT_ROLE |\n+--------------+\n| staff |\n+--------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/current_role/','','https://mariadb.com/kb/en/library/current_role/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (207,17,'CURRENT_USER','Syntax\n------ \nCURRENT_USER, CURRENT_USER()\n \nDescription\n----------- \nReturns the user name and host name combination for the\nMariaDB account\nthat the server used to authenticate the current client.\nThis account\ndetermines your access privileges. The return value is a\nstring in the\nutf8 character set.\n \nThe value of CURRENT_USER() can differ from the value of\nUSER(). CURRENT_ROLE() returns the current active role.\n \nExamples\n-------- \nshell> mysql --user=\"anonymous\"\n \nMariaDB [(none)]> select user(),current_user();\n+---------------------+----------------+\n| user() | current_user() |\n+---------------------+----------------+\n| anonymous@localhost | @localhost |\n+---------------------+----------------+\n \nWhen calling CURRENT_USER() in a stored procedure, it\nreturns the owner of the stored procedure, as defined with\nDEFINER.\n \n\n\nURL: https://mariadb.com/kb/en/library/current_user/','','https://mariadb.com/kb/en/library/current_user/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (208,17,'DATABASE','Syntax\n------ \nDATABASE()\n \nDescription\n----------- \nReturns the default (current) database name as a string in\nthe utf8 character set. If there is no default database,\nDATABASE() returns NULL. Within a stored routine, the\ndefault database is the database that the routine is\nassociated with, which is not necessarily the same as the\ndatabase that is the default in the calling context.\n \nSCHEMA() is a synonym for DATABASE().\n \nTo select a default database, the USE statement can be run.\nAnother way to set the default database is specifying its\nname at mysql command line client startup.\n \nExamples\n-------- \nSELECT DATABASE();\n+------------+\n| DATABASE() |\n+------------+\n| NULL |\n+------------+\n \nUSE test;\n \nDatabase changed\n \nSELECT DATABASE();\n+------------+\n| DATABASE() |\n+------------+\n| test |\n+------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/database/','','https://mariadb.com/kb/en/library/database/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (209,17,'DECODE_HISTOGRAM','DECODE_HISTOGRAM() was introduced in MariaDB 10.0.2\n \nSyntax\n------ \nDECODE_HISTOGRAM(hist_type,histogram)\n \nNote: Before MariaDB 10.0.10 the arguments were reversed.\n \nDescription\n----------- \nReturns a string of comma separated numeric values\ncorresponding to a probability distribution represented by\nthe histogram of type hist_type (SINGLE_PREC_HB or\nDOUBLE_PREC_HB). The hist_type and histogram would be\ncommonly used from the mysql.column_stats table.\n \nSee Histogram Based Statistics for details.\n \nExamples\n-------- \nCREATE TABLE origin (\n i INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,\n v INT UNSIGNED NOT NULL\n);\n \nINSERT INTO origin(v) VALUES \n (1),(2),(3),(4),(5),(10),(20),\n (30),(40),(50),(60),(70),(80),\n (90),(100),(200),(400),(800);\n \nSET histogram_size=10,histogram_type=SINGLE_PREC_HB;\n \nANALYZE TABLE origin PERSISTENT FOR ALL;\n \n+-------------+---------+----------+-----------------------------------------+\n| Table | Op | Msg_type | Msg_text |\n+-------------+---------+----------+-----------------------------------------+\n| test.origin | analyze | status | Engine-independent\nstatistics collected |\n| test.origin | analyze | status | OK |\n+-------------+---------+----------+-----------------------------------------+\n \nSELECT db_name,table_name,column_name,hist_type,\n hex(histogram),decode_histogram(hist_type,histogram) \n FROM mysql.column_stats WHERE db_name=\'test\' and\ntable_name=\'origin\';\n \n+---------+------------+-------------+----------------+----------------------+-------------------------------------------------------------------+\n| db_name | table_name | column_name | hist_type |\nhex(histogram) | decode_histogram(hist_type,histogram) |\n+---------+------------+-------------+----------------+----------------------+-------------------------------------------------------------------+\n| test | origin | i | SINGLE_PREC_HB | 0F2D3C5A7887A5C3D2F0\n|\n0.059,0.118,0.059,0.118,0.118,0.059,0.118,0.118,0.059,0.118,0.059\n|\n| test | origin | v | SINGLE_PREC_HB | 000001060C0F161C1F7F\n|\n0.000,0.000,0.004,0.020,0.024,0.012,0.027,0.024,0.012,0.376,0.502\n|\n+---------+------------+-------------+----------------+----------------------+-------------------------------------------------------------------+\n \nSET histogram_size=20,histogram_type=DOUBLE_PREC_HB;\n \nANALYZE TABLE origin PERSISTENT FOR ALL;\n \n+-------------+---------+----------+-----------------------------------------+\n| Table | Op | Msg_type | Msg_text |\n+-------------+---------+----------+-----------------------------------------+\n| test.origin | analyze | status | Engine-independent\nstatistics collected |\n| test.origin | analyze | status | OK |\n+-------------+---------+----------+-----------------------------------------+\n \nSELECT db_name,table_name,column_name,\n hist_type,hex(histogram),decode_histogram(hist_type,histogram)\n\n FROM mysql.column_stats WHERE db_name=\'test\' and\ntable_name=\'origin\';\n \n+---------+------------+-------------+----------------+------------------------------------------+-----------------------------------------------------------------------------------------+\n| db_name | table_name | column_name | hist_type |\nhex(histogram) | decode_histogram(hist_type,histogram) |\n+---------+------------+-------------+----------------+------------------------------------------+-----------------------------------------------------------------------------------------+\n| test | origin | i | DOUBLE_PREC_HB |\n0F0F2D2D3C3C5A5A78788787A5A5C3C3D2D2F0F0 |\n0.05882,0.11765,0.05882,0.11765,0.11765,0.05882,0.11765,0.11765,0.05882,0.11765,0.05882\n|\n| test | origin | v | DOUBLE_PREC_HB |\n5200F600480116067E0CB30F1B16831CB81FD67F |\n0.00125,0.00250,0.00125,0.01877,0.02502,0.01253,0.02502,0.02502,0.01253,0.37546,0.50063\n|\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/decode_histogram/','','https://mariadb.com/kb/en/library/decode_histogram/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (210,17,'DEFAULT','Syntax\n------ \nDEFAULT(col_name)\n \nDescription\n----------- \nReturns the default value for a table column. If the column\nhas no default value, NULL is returned.\nFor integer columns using AUTO_INCREMENT, 0 is returned.\n \nWhen using DEFAULT as a value to set in an INSERT or UPDATE\nstatement, you can use the bare keyword DEFAULT without the\nparentheses and argument to\nrefer to the column in context. You can only use DEFAULT as\na bare keyword if you are using it\nalone without a surrounding expression or function.\n \nExamples\n-------- \nSelect only non-default values for a column:\n \nSELECT i FROM t WHERE i != DEFAULT(i);\n \nUpdate values to be one greater than the default value:\n \nUPDATE t SET i = DEFAULT(i)+1 WHERE i \n\nURL: https://mariadb.com/kb/en/library/default/','','https://mariadb.com/kb/en/library/default/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (211,17,'FOUND_ROWS','Syntax\n------ \nFOUND_ROWS()\n \nDescription\n----------- \nA SELECT statement may include a LIMIT clause to restrict\nthe number\nof rows the server returns to the client. In some cases, it\nis\ndesirable to know how many rows the statement would have\nreturned\nwithout the LIMIT, but without running the statement again.\nTo obtain\nthis row count, include a SQL_CALC_FOUND_ROWS option in the\nSELECT\nstatement, and then invoke FOUND_ROWS() afterwards.\n \nYou can also use FOUND_ROWS() to obtain the number of rows\nreturned by a SELECT which does not contain a LIMIT clause.\nIn this case you don\'t need to use the SQL_CALC_FOUND_ROWS\noption. This can be useful for example in a stored\nprocedure.\n \nAlso, this function works with some other statements which\nreturn a resultset, including SHOW, DESC and HELP. For\nDELETE ... RETURNING you should use ROW_COUNT(). It also\nworks as a prepared statement, or after executing a prepared\nstatement.\n \nStatements which don\'t return any results don\'t affect\nFOUND_ROWS() - the previous value will still be returned.\n \nWarning: When used after a CALL statement, this function\nreturns the number of rows selected by the last query in the\nprocedure, not by the whole procedure.\n \nStatements using the FOUND_ROWS() function are not safe for\nreplication.\n \nExamples\n-------- \nSHOW ENGINES;\n \n+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+\n| Engine | Support | Comment | Transactions | XA |\nSavepoints |\n+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+\n| InnoDB | DEFAULT | Supports transactions, row-level\nlocking, and foreign keys | YES | YES | YES |\n...\n| SPHINX | YES | Sphinx storage engine | NO | NO | NO |\n+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+\n11 rows in set (0.01 sec)\n \nSELECT FOUND_ROWS();\n+--------------+\n| FOUND_ROWS() |\n+--------------+\n| 11 |\n+--------------+\n \nSELECT SQL_CALC_FOUND_ROWS * FROM tbl_name WHERE id > 100\nLIMIT 10;\n \nSELECT FOUND_ROWS();\n+--------------+\n| FOUND_ROWS() |\n+--------------+\n| 23 |\n+--------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/found_rows/','','https://mariadb.com/kb/en/library/found_rows/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (212,17,'LAST_INSERT_ID','Syntax\n------ \nLAST_INSERT_ID(), LAST_INSERT_ID(expr)\n \nDescription\n----------- \nLAST_INSERT_ID() (no arguments) returns\nthe first automatically generated value successfully\ninserted for an\nAUTO_INCREMENT column as a result of the most recently\nexecuted INSERT\nstatement. The value of LAST_INSERT_ID() remains unchanged\nif no rows\nare successfully inserted.\n \nIf one gives an argument to LAST_INSERT_ID(), then it will\nreturn the value of the expression and\nthe next call to LAST_INSERT_ID() will return the same\nvalue. The value will also be sent to the client\nand can be accessed by the mysql_insert_id function.\n \nFor example, after inserting a row that generates an\nAUTO_INCREMENT\nvalue, you can get the value like this:\n \nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n| 9 |\n+------------------+\n \nYou can also use LAST_INSERT_ID() to delete the last\ninserted row:\n \nDELETE FROM product WHERE id = LAST_INSERT_ID();\n \nIf no rows were successfully inserted, LAST_INSERT_ID()\nreturns 0.\n \nThe value of LAST_INSERT_ID() will be consistent across all\nversions\nif all rows in the INSERT or UPDATE statement were\nsuccessful.\n \nThe currently executing statement does not affect the value\nof\nLAST_INSERT_ID(). Suppose that you generate an\nAUTO_INCREMENT value\nwith one statement, and then refer to LAST_INSERT_ID() in a\nmultiple-row INSERT statement that inserts rows into a table\nwith its\nown AUTO_INCREMENT column. The value of LAST_INSERT_ID()\nwill remain\nstable in the second statement; its value for the second and\nlater\nrows is not affected by the earlier row insertions.\n(However, if you\nmix references to LAST_INSERT_ID() and LAST_INSERT_ID(expr),\nthe\neffect is undefined.)\n \nIf the previous statement returned an error, the value of\nLAST_INSERT_ID() is undefined. For transactional tables, if\nthe\nstatement is rolled back due to an error, the value of\nLAST_INSERT_ID() is left undefined. For manual ROLLBACK, the\nvalue of\nLAST_INSERT_ID() is not restored to that before the\ntransaction; it\nremains as it was at the point of the ROLLBACK.\n \nWithin the body of a stored routine (procedure or function)\nor a\ntrigger, the value of LAST_INSERT_ID() changes the same way\nas for\nstatements executed outside the body of these kinds of\nobjects. The\neffect of a stored routine or trigger upon the value of\nLAST_INSERT_ID() that is seen by following statements\ndepends on the\nkind of routine:\nIf a stored procedure executes statements that change the\nvalue of LAST_INSERT_ID(), the new value will be seen by\nstatements that follow the procedure call.\n \nFor stored functions and triggers that change the value, the\nvalue is restored when the function or trigger ends, so\nfollowing statements will not see a changed value.\n \nExamples\n-------- \nCREATE TABLE t (\n id INTEGER UNSIGNED AUTO_INCREMENT PRIMARY KEY, \n f VARCHAR(1)) \nENGINE = InnoDB;\n \nINSERT INTO t(f) VALUES(\'a\');\n \nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n| 1 |\n+------------------+\n \nINSERT INTO t(f) VALUES(\'b\');\n \nINSERT INTO t(f) VALUES(\'c\');\n \nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n| 3 |\n+------------------+\n \nINSERT INTO t(f) VALUES(\'d\'),(\'e\');\n \nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n| 4 |\n+------------------+\n \nSELECT * FROM t;\n \n+----+------+\n| id | f |\n+----+------+\n| 1 | a |\n| 2 | b |\n| 3 | c |\n| 4 | d |\n| 5 | e |\n+----+------+\n \nSELECT LAST_INSERT_ID(12);\n+--------------------+\n| LAST_INSERT_ID(12) |\n+--------------------+\n| 12 |\n+--------------------+\n \nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n| 12 |\n+------------------+\n \nINSERT INTO t(f) VALUES(\'f\');\n \nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n| 6 |\n+------------------+\n \nSELECT * FROM t;\n \n+----+------+\n| id | f |\n+----+------+\n| 1 | a |\n| 2 | b |\n| 3 | c |\n| 4 | d |\n| 5 | e |\n| 6 | f |\n+----+------+\n \nSELECT LAST_INSERT_ID(12);\n+--------------------+\n| LAST_INSERT_ID(12) |\n+--------------------+\n| 12 |\n+--------------------+\n \nINSERT INTO t(f) VALUES(\'g\');\n \nSELECT * FROM t;\n \n+----+------+\n| id | f |\n+----+------+\n| 1 | a |\n| 2 | b |\n| 3 | c |\n| 4 | d |\n| 5 | e |\n| 6 | f |\n| 7 | g |\n+----+------+\n \n\n\nURL: https://mariadb.com/kb/en/library/last_insert_id/','','https://mariadb.com/kb/en/library/last_insert_id/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (213,17,'LAST_VALUE','Syntax\n------ \nLAST_VALUE(expr,[expr,...])\n \nLAST_VALUE(expr) OVER (\n [ PARTITION BY partition_expression ]\n [ ORDER BY order_list ]\n) \n \nDescription\n----------- \nLAST_VALUE() evaluates all expressions and returns the last.\n \nThis is useful together with setting user variables to a\nvalue with @var:=expr, for example when you want to get data\nof rows updated/deleted without having to do two queries\nagainst the table.\n \nSince MariaDB 10.2.2, LAST_VALUE can be used as a window\nfunction.\n \nReturns NULL if no last value exists.\n \nExamples\n-------- \nCREATE TABLE t1 (a int, b int);\nINSERT INTO t1 VALUES(1,10),(2,20);\nDELETE FROM t1 WHERE a=1 AND last_value(@a:=a,@b:=b,1);\nSELECT @a,@b;\n \n+------+------+\n| @a | @b |\n+------+------+\n| 1 | 10 |\n+------+------+\n \nAs a window function:\n \nCREATE TABLE t1 (\n pk int primary key,\n a int,\n b int,\n c char(10),\n d decimal(10, 3),\n e real\n);\n \nINSERT INTO t1 VALUES\n( 1, 0, 1, \'one\', 0.1, 0.001),\n( 2, 0, 2, \'two\', 0.2, 0.002),\n( 3, 0, 3, \'three\', 0.3, 0.003),\n( 4, 1, 2, \'three\', 0.4, 0.004),\n( 5, 1, 1, \'two\', 0.5, 0.005),\n( 6, 1, 1, \'one\', 0.6, 0.006),\n( 7, 2, NULL, \'n_one\', 0.5, 0.007),\n( 8, 2, 1, \'n_two\', NULL, 0.008),\n( 9, 2, 2, NULL, 0.7, 0.009),\n(10, 2, 0, \'n_four\', 0.8, 0.010),\n(11, 2, 10, NULL, 0.9, NULL);\n \nSELECT pk, FIRST_VALUE(pk) OVER (ORDER BY pk) AS first_asc,\n LAST_VALUE(pk) OVER (ORDER BY pk) AS last_asc,\n FIRST_VALUE(pk) OVER (ORDER BY pk DESC) AS first_desc,\n LAST_VALUE(pk) OVER (ORDER BY pk DESC) AS last_desc\nFROM t1\nORDER BY pk DESC;\n \n+----+-----------+----------+------------+-----------+\n| pk | first_asc | last_asc | first_desc | last_desc |\n+----+-----------+----------+------------+-----------+\n| 11 | 1 | 11 | 11 | 11 |\n| 10 | 1 | 10 | 11 | 10 |\n| 9 | 1 | 9 | 11 | 9 |\n| 8 | 1 | 8 | 11 | 8 |\n| 7 | 1 | 7 | 11 | 7 |\n| 6 | 1 | 6 | 11 | 6 |\n| 5 | 1 | 5 | 11 | 5 |\n| 4 | 1 | 4 | 11 | 4 |\n| 3 | 1 | 3 | 11 | 3 |\n| 2 | 1 | 2 | 11 | 2 |\n| 1 | 1 | 1 | 11 | 1 |\n+----+-----------+----------+------------+-----------+\n \nCREATE OR REPLACE TABLE t1 (i int);\nINSERT INTO t1 VALUES\n(1),(2),(3),(4),(5),(6),(7),(8),(9),(10);\n \nSELECT i,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW\nand 1 FOLLOWING) AS f_1f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW and\n1 FOLLOWING) AS l_1f,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 PRECEDING\nAND 1 FOLLOWING) AS f_1p1f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 PRECEDING AND\n1 FOLLOWING) AS f_1p1f,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 2 PRECEDING\nAND 1 PRECEDING) AS f_2p1p,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 2 PRECEDING AND\n1 PRECEDING) AS f_2p1p,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 FOLLOWING\nAND 2 FOLLOWING) AS f_1f2f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 FOLLOWING AND\n2 FOLLOWING) AS f_1f2f\nFROM t1;\n \n+------+------+------+--------+--------+--------+--------+--------+--------+\n| i | f_1f | l_1f | f_1p1f | f_1p1f | f_2p1p | f_2p1p |\nf_1f2f | f_1f2f |\n+------+------+------+--------+--------+--------+--------+--------+--------+\n| 1 | 1 | 2 | 1 | 2 | NULL | NULL | 2 | 3 |\n| 2 | 2 | 3 | 1 | 3 | 1 | 1 | 3 | 4 |\n| 3 | 3 | 4 | 2 | 4 | 1 | 2 | 4 | 5 |\n| 4 | 4 | 5 | 3 | 5 | 2 | 3 | 5 | 6 |\n| 5 | 5 | 6 | 4 | 6 | 3 | 4 | 6 | 7 |\n| 6 | 6 | 7 | 5 | 7 | 4 | 5 | 7 | 8 |\n| 7 | 7 | 8 | 6 | 8 | 5 | 6 | 8 | 9 |\n| 8 | 8 | 9 | 7 | 9 | 6 | 7 | 9 | 10 |\n| 9 | 9 | 10 | 8 | 10 | 7 | 8 | 10 | 10 |\n| 10 | 10 | 10 | 9 | 10 | 8 | 9 | NULL | NULL |\n+------+------+------+--------+--------+--------+--------+--------+--------+\n \n\n\nURL: https://mariadb.com/kb/en/library/last_value/','','https://mariadb.com/kb/en/library/last_value/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (214,17,'PROCEDURE ANALYSE','Syntax\n------ \nanalyse([max_elements[,max_memory]])\n \nDescription\n----------- \nThis procedure is defined in the sql/sql_analyse.cc file. It\nexamines\nthe result from a query and returns an analysis of the\nresults that\nsuggests optimal data types for each column. To obtain this\nanalysis,\nappend PROCEDURE ANALYSE to the end of a SELECT statement:\n \nSELECT ... FROM ... WHERE ... PROCEDURE\nANALYSE([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\nthe query,\nand propose an optimal data type for the columns. This can\nbe helpful\nfor checking your existing tables, or after importing new\ndata. You\nmay need to try different settings for the arguments so that\nPROCEDURE\nANALYSE() does not suggest the ENUM data type when it is not\nappropriate.\n \nThe arguments are optional and are used as follows:\nmax_elements (default 256) is the maximum number of distinct\nvalues that analyse notices per column. This is used by\nanalyse to check whether the optimal data type should be of\ntype ENUM; if there are more than max_elements distinct\nvalues, then ENUM is not a suggested type.\nmax_memory (default 8192) is the maximum amount of memory\nthat analyse should allocate per column while trying to find\nall distinct values.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/procedure-analyse/','','https://mariadb.com/kb/en/library/procedure-analyse/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (215,17,'ROW_COUNT','Syntax\n------ \nROW_COUNT()\n \nDescription\n----------- \nROW_COUNT() returns the number of rows updated, inserted or\ndeleted\nby the preceding statement. This is the same as the row\ncount that the\nmysql client displays and the value from the\nmysql_affected_rows() C\nAPI function.\n \nGenerally:\nFor statements which return a result set (such as SELECT,\nSHOW, DESC or HELP), returns -1, even when the result set is\nempty. This is also true for administrative statements, such\nas OPTIMIZE.\nFor DML statements other than SELECT and for ALTER TABLE,\nreturns the number of affected rows.\nFor DDL statements (including TRUNCATE) and for other\nstatements which don\'t return any result set (such as USE,\nDO, SIGNAL or DEALLOCATE PREPARE), returns 0.\n \nFor UPDATE, affected rows is by default the number of rows\nthat were actually changed. If the CLIENT_FOUND_ROWS flag to\nmysql_real_connect() is specified when connecting to mysqld,\naffected rows is instead the number of rows matched by the\nWHERE clause. \n \nFor REPLACE, deleted rows are also counted. So, if REPLACE\ndeletes a row and adds a new row, ROW_COUNT() returns 2.\n \nFor INSERT ... ON DUPLICATE KEY, updated rows are counted\ntwice. So, if INSERT adds a new rows and modifies another\nrow, ROW_COUNT() returns 3.\n \nROW_COUNT() does not take into account rows that are not\ndirectly deleted/updated by the last statement. This means\nthat rows deleted by foreign keys or triggers are not\ncounted.\n \nWarning: You can use ROW_COUNT() with prepared statements,\nbut you need to call it after EXECUTE, not after DEALLOCATE\nPREPARE, because the row count for allocate prepare is\nalways 0.\n \nWarning: When used after a CALL statement, this function\nreturns the number of rows affected by the last statement in\nthe procedure, not by the whole procedure.\n \nWarning: After INSERT DELAYED, ROW_COUNT() returns the\nnumber of the rows you tried to insert, not the number of\nthe successful writes.\n \nThis information can also be found in the diagnostics area.\n \nStatements using the ROW_COUNT() function are not safe for\nreplication.\n \nExamples\n-------- \nCREATE TABLE t (A INT);\n \nINSERT INTO t VALUES(1),(2),(3);\n \nSELECT ROW_COUNT();\n+-------------+\n| ROW_COUNT() |\n+-------------+\n| 3 |\n+-------------+\n \nDELETE FROM t WHERE A IN(1,2);\n \nSELECT ROW_COUNT(); \n+-------------+\n| ROW_COUNT() |\n+-------------+\n| 2 |\n+-------------+\n \nExample with prepared statements:\n \nSET @q = \'INSERT INTO t VALUES(1),(2),(3);\';\n \nPREPARE stmt FROM @q;\n \nEXECUTE stmt;\n \nQuery OK, 3 rows affected (0.39 sec)\nRecords: 3 Duplicates: 0 Warnings: 0\n \nSELECT ROW_COUNT();\n+-------------+\n| ROW_COUNT() |\n+-------------+\n| 3 |\n+-------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/row_count/','','https://mariadb.com/kb/en/library/row_count/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (216,17,'SCHEMA','Syntax\n------ \nSCHEMA()\n \nDescription\n----------- \nThis function is a synonym for DATABASE().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/schema/','','https://mariadb.com/kb/en/library/schema/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (217,17,'SESSION_USER','Syntax\n------ \nSESSION_USER()\n \nDescription\n----------- \nSESSION_USER() is a synonym for USER().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/session_user/','','https://mariadb.com/kb/en/library/session_user/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (218,17,'SYSTEM_USER','Syntax\n------ \nSYSTEM_USER()\n \nDescription\n----------- \nSYSTEM_USER() is a synonym for USER().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/system_user/','','https://mariadb.com/kb/en/library/system_user/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (219,17,'USER','Syntax\n------ \nUSER()\n \nDescription\n----------- \nReturns the current MariaDB user name and host name, given\nwhen authenticating to MariaDB, as a string in the utf8\ncharacter set.\n \nNote that the value of USER() may differ from the value of\nCURRENT_USER(), which is the user used to authenticate the\ncurrent client. \nCURRENT_ROLE() returns the current active role.\n \nSYSTEM_USER() and SESSION_USER are synonyms for USER().\n \nStatements using the USER() function or one of its synonyms\nare not safe for statement level replication.\n \nExamples\n-------- \nshell> mysql --user=\"anonymous\"\n \nMariaDB [(none)]> select user(),current_user();\n+---------------------+----------------+\n| user() | current_user() |\n+---------------------+----------------+\n| anonymous@localhost | @localhost |\n+---------------------+----------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/user/','','https://mariadb.com/kb/en/library/user/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (220,17,'VERSION','Syntax\n------ \nVERSION()\n \nDescription\n----------- \nReturns a string that indicates the MariaDB server version.\nThe string\nuses the utf8 character set.\n \nExamples\n-------- \nSELECT VERSION();\n+------------------------------+\n| VERSION() |\n+------------------------------+\n| 10.0.3-MariaDB-1~precise-log |\n+------------------------------+\n \nThe VERSION() string may have one or more of the following\nsuffixes:\n \nSuffix | Description | \n \n-embedded | The server is an embedded server (libmysqld). | \n \n-log | General logging, slow logging or binary (replication)\nlogging is enabled. | \n \n-debug | The server is compiled for debugging. | \n \n-valgrind |  The server is compiled to be instrumented with\nvalgrind. | \n \nChanging the Version String\n \nSome old legacy code may break because they are parsing the\nVERSION string and expecting a MySQL string or a simple\nversion\nstring like Joomla til API17, see MDEV-7780.\n \nIn MariaDB 10.2 one can fool these applications by setting\nthe version string from the command line or the my.cnf files\nwith --version=....\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/version/','','https://mariadb.com/kb/en/library/version/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (221,18,'!=','Syntax\n------ \n, !=\n \nDescription\n----------- \nNot equal operator. Evaluates both SQL expressions and\nreturns 1 if they are not equal and 0 if they are equal, or\nNULL if either expression is NULL. If the expressions return\ndifferent data types, (for instance, a number and a string),\nperforms type conversion.\n \nWhen used in row comparisons these two queries return the\nsame results:\n \nSELECT (t1.a, t1.b) != (t2.x, t2.y) \nFROM t1 INNER JOIN t2;\n \nSELECT (t1.a != t2.x) OR (t1.b != t2.y)\nFROM t1 INNER JOIN t2;\n \nExamples\n-------- \nSELECT \'.01\' \'0.01\';\n \n+-----------------+\n| \'.01\' \'0.01\' |\n+-----------------+\n| 1 |\n+-----------------+\n \nSELECT .01 \'0.01\';\n \n+---------------+\n| .01 \'0.01\' |\n+---------------+\n| 0 |\n+---------------+\n \nSELECT \'zapp\' \'zappp\';\n \n+-------------------+\n| \'zapp\' \'zappp\' |\n+-------------------+\n| 1 |\n+-------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/not-equal/','','https://mariadb.com/kb/en/library/not-equal/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (222,18,'&lt;','Syntax\n------ \n\n\nURL: https://mariadb.com/kb/en/library/less-than/','','https://mariadb.com/kb/en/library/less-than/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (223,18,'&lt;=','Syntax\n------ \n\n\nURL: https://mariadb.com/kb/en/library/less-than-or-equal/','','https://mariadb.com/kb/en/library/less-than-or-equal/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (224,18,'&lt;=&gt;','Syntax\n------ \n\n \nDescription\n----------- \nNULL-safe equal operator. It performs an equality comparison\nlike\nthe = operator, but returns 1 rather than NULL if both\noperands are\nNULL, and 0 rather than NULL if one operand is NULL.\n \na b is equivalent to a = b OR (a IS NULL AND b IS NULL).\n \nWhen used in row comparisons these two queries return the\nsame results:\n \nSELECT (t1.a, t1.b) (t2.x, t2.y) \nFROM t1 INNER JOIN t2;\n \nSELECT (t1.a t2.x) AND (t1.b t2.y)\nFROM t1 INNER JOIN t2;\n \nSee also NULL Values in MariaDB.\n \nExamples\n-------- \nSELECT 1 1, NULL NULL, 1 NULL;\n \n+---------+---------------+------------+\n| 1 1 | NULL NULL | 1 NULL |\n+---------+---------------+------------+\n| 1 | 1 | 0 |\n+---------+---------------+------------+\n \nSELECT 1 = 1, NULL = NULL, 1 = NULL;\n \n+-------+-------------+----------+\n| 1 = 1 | NULL = NULL | 1 = NULL |\n+-------+-------------+----------+\n| 1 | NULL | NULL |\n+-------+-------------+----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/null-safe-equal/','','https://mariadb.com/kb/en/library/null-safe-equal/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (225,18,'=','Syntax\n------ \nleft_expr = right_expr\n \nDescription\n----------- \nEqual operator. Evaluates both SQL expressions and returns 1\nif they are equal, 0 if they are not equal, or NULL if\neither expression is NULL. If the expressions return\ndifferent data types (for example, a number and a string), a\ntype conversion is performed.\n \nWhen used in row comparisons these two queries are\nsynonymous and return the same results:\n \nSELECT (t1.a, t1.b) = (t2.x, t2.y) FROM t1 INNER JOIN t2;\n \nSELECT (t1.a = t2.x) AND (t1.b = t2.y) FROM t1 INNER JOIN\nt2;\n \nTo perform a NULL-safe comparison, use the operator.\n \n= can also be used as an assignment operator.\n \nExamples\n-------- \nSELECT 1 = 0;\n \n+-------+\n| 1 = 0 |\n+-------+\n| 0 |\n+-------+\n \nSELECT \'0\' = 0;\n \n+---------+\n| \'0\' = 0 |\n+---------+\n| 1 |\n+---------+\n \nSELECT \'0.0\' = 0;\n \n+-----------+\n| \'0.0\' = 0 |\n+-----------+\n| 1 |\n+-----------+\n \nSELECT \'0.01\' = 0;\n \n+------------+\n| \'0.01\' = 0 |\n+------------+\n| 0 |\n+------------+\n \nSELECT \'.01\' = 0.01;\n \n+--------------+\n| \'.01\' = 0.01 |\n+--------------+\n| 1 |\n+--------------+\n \nSELECT (5 * 2) = CONCAT(\'1\', \'0\');\n+----------------------------+\n| (5 * 2) = CONCAT(\'1\', \'0\') |\n+----------------------------+\n| 1 |\n+----------------------------+\n \nSELECT 1 = NULL;\n \n+----------+\n| 1 = NULL |\n+----------+\n| NULL |\n+----------+\n \nSELECT NULL = NULL;\n \n+-------------+\n| NULL = NULL |\n+-------------+\n| NULL |\n+-------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/equal/','','https://mariadb.com/kb/en/library/equal/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (226,18,'&gt;','Syntax\n------ \n>\n \nDescription\n----------- \nGreater than operator. Evaluates both SQL expressions and\nreturns 1 if the left value is greater than the right value\nand 0 if it is not, or NULL if either expression is NULL. If\nthe expressions return different data types, (for instance,\na number and a string), performs type conversion.\n \nWhen used in row comparisons these two queries return the\nsame results:\n \nSELECT (t1.a, t1.b) > (t2.x, t2.y) \nFROM t1 INNER JOIN t2;\n \nSELECT (t1.a > t2.x) OR ((t1.a = t2.x) AND (t1.b > t2.y))\nFROM t1 INNER JOIN t2;\n \nExamples\n-------- \nSELECT 2 > 2;\n \n+-------+\n| 2 > 2 |\n+-------+\n| 0 |\n+-------+\n \nSELECT \'b\' > \'a\';\n \n+-----------+\n| \'b\' > \'a\' |\n+-----------+\n| 1 |\n+-----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/greater-than/','','https://mariadb.com/kb/en/library/greater-than/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (227,18,'&gt;=','Syntax\n------ \n>=\n \nDescription\n----------- \nGreater than or equal operator. Evaluates both SQL\nexpressions and returns 1 if the left value is greater than\nor equal to the right value and 0 if it is not, or NULL if\neither expression is NULL. If the expressions return\ndifferent data types, (for instance, a number and a string),\nperforms type conversion.\n \nWhen used in row comparisons these two queries return the\nsame results:\n \nSELECT (t1.a, t1.b) >= (t2.x, t2.y) \nFROM t1 INNER JOIN t2;\n \nSELECT (t1.a > t2.x) OR ((t1.a = t2.x) AND (t1.b >= t2.y))\nFROM t1 INNER JOIN t2;\n \nExamples\n-------- \nSELECT 2 >= 2;\n \n+--------+\n| 2 >= 2 |\n+--------+\n| 1 |\n+--------+\n \nSELECT \'A\' >= \'a\';\n \n+------------+\n| \'A\' >= \'a\' |\n+------------+\n| 1 |\n+------------+\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/greater-than-or-equal/','','https://mariadb.com/kb/en/library/greater-than-or-equal/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (228,18,'BETWEEN AND','Syntax\n------ \nexpr BETWEEN min AND max\n \nDescription\n----------- \nIf expr is greater than or equal to min and expr is less\nthan or equal\nto max, BETWEEN returns 1, otherwise it returns 0. This is\nequivalent\nto the expression (min \n\nURL: https://mariadb.com/kb/en/library/between-and/','','https://mariadb.com/kb/en/library/between-and/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (229,18,'COALESCE','Syntax\n------ \nCOALESCE(value,...)\n \nDescription\n----------- \nReturns the first non-NULL value in the list, or NULL if\nthere are no\nnon-NULL values. At least one parameter must be passed.\n \nSee also NULL Values in MariaDB.\n \nExamples\n-------- \nSELECT COALESCE(NULL,1);\n+------------------+\n| COALESCE(NULL,1) |\n+------------------+\n| 1 |\n+------------------+\n \nSELECT COALESCE(NULL,NULL,NULL);\n+--------------------------+\n| COALESCE(NULL,NULL,NULL) |\n+--------------------------+\n| NULL |\n+--------------------------+\n \nWhen two arguments are given, COALESCE() is the same as\nIFNULL():\n \nSET @a=NULL, @b=1;\n \nSELECT COALESCE(@a, @b), IFNULL(@a, @b);\n+------------------+----------------+\n| COALESCE(@a, @b) | IFNULL(@a, @b) |\n+------------------+----------------+\n| 1 | 1 |\n+------------------+----------------+\n \nHex type confusion:\n \nCREATE TABLE t1 (a INT, b VARCHAR(10));\nINSERT INTO t1 VALUES (0x31, 0x61),(COALESCE(0x31),\nCOALESCE(0x61));\n \nSELECT * FROM t1;\n \n+------+------+\n| a | b |\n+------+------+\n| 49 | a |\n| 1 | a |\n+------+------+\n \nThe reason for the differing results above is that when 0x31\nis inserted directly to the column, it\'s treated as a\nnumber (see Hexadecimal Literals), while when 0x31 is passed\nto COALESCE(), it\'s treated as a string, because:\nHEX values have a string data type by default.\nCOALESCE() has the same data type as the argument. \n \n\n\nURL: https://mariadb.com/kb/en/library/coalesce/','','https://mariadb.com/kb/en/library/coalesce/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (230,18,'GREATEST','Syntax\n------ \nGREATEST(value1,value2,...)\n \nDescription\n----------- \nWith two or more arguments, returns the largest\n(maximum-valued)\nargument. The arguments are compared using the same rules as\nfor\nLEAST().\n \nExamples\n-------- \nSELECT GREATEST(2,0);\n+---------------+\n| GREATEST(2,0) |\n+---------------+\n| 2 |\n+---------------+\n \nSELECT GREATEST(34.0,3.0,5.0,767.0);\n+------------------------------+\n| GREATEST(34.0,3.0,5.0,767.0) |\n+------------------------------+\n| 767.0 |\n+------------------------------+\n \nSELECT GREATEST(\'B\',\'A\',\'C\');\n+-----------------------+\n| GREATEST(\'B\',\'A\',\'C\') |\n+-----------------------+\n| C |\n+-----------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/greatest/','','https://mariadb.com/kb/en/library/greatest/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (231,18,'IN','Syntax\n------ \nexpr IN (value,...)\n \nDescription\n----------- \nReturns 1 if expr is equal to any of the values in the IN\nlist, else\nreturns 0. If all values are constants, they are evaluated\naccording\nto the type of expr and sorted. The search for the item then\nis done\nusing a binary search. This means IN is very quick if the IN\nvalue\nlist consists entirely of constants. Otherwise, type\nconversion takes\nplace according to the rules described at Type Conversion,\nbut\napplied to all the arguments.\n \nIf expr is NULL, IN always returns NULL. If at least one of\nthe values in the list is NULL, and one of the comparisons\nis true, the result is 1. If at least one of the values in\nthe list is NULL and none of the comparisons is true, the\nresult is NULL.\n \nExamples\n-------- \nSELECT 2 IN (0,3,5,7);\n+----------------+\n| 2 IN (0,3,5,7) |\n+----------------+\n| 0 |\n+----------------+\n \nSELECT \'wefwf\' IN (\'wee\',\'wefwf\',\'weg\');\n+----------------------------------+\n| \'wefwf\' IN (\'wee\',\'wefwf\',\'weg\') |\n+----------------------------------+\n| 1 |\n+----------------------------------+ \n \nType conversion:\n \nSELECT 1 IN (\'1\', \'2\', \'3\');\n+----------------------+\n| 1 IN (\'1\', \'2\', \'3\') |\n+----------------------+\n| 1 |\n+----------------------+\n \nSELECT NULL IN (1, 2, 3);\n+-------------------+\n| NULL IN (1, 2, 3) |\n+-------------------+\n| NULL |\n+-------------------+\n \nMariaDB [(none)]> SELECT 1 IN (1, 2, NULL);\n+-------------------+\n| 1 IN (1, 2, NULL) |\n+-------------------+\n| 1 |\n+-------------------+\n \nMariaDB [(none)]> SELECT 5 IN (1, 2, NULL);\n+-------------------+\n| 5 IN (1, 2, NULL) |\n+-------------------+\n| NULL |\n+-------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/in/','','https://mariadb.com/kb/en/library/in/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (232,18,'INTERVAL','Syntax\n------ \nINTERVAL(N,N1,N2,N3,...)\n \nDescription\n----------- \nReturns the index of the last argument that is less than the\nfirst argument or is NULL. \n \nReturns 0 if N < N1, 1 if N < N2, 2 if N < N3 and so on or\n-1 if N is NULL. All\narguments are treated as integers. It is required that N1 <\nN2 < N3 \n\nURL: https://mariadb.com/kb/en/library/interval/','','https://mariadb.com/kb/en/library/interval/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (233,18,'IS','Syntax\n------ \nIS boolean_value\n \nDescription\n----------- \nTests a value against a boolean value, where boolean_value\ncan be\nTRUE, FALSE, or UNKNOWN.\n \nThere is an important difference between using IS TRUE or\ncomparing a value with TRUE using =. When using =, only 1\nequals to TRUE. But when using IS TRUE, all values which are\nlogically true (like a number > 1) return TRUE.\n \nExamples\n-------- \nSELECT 1 IS TRUE, 0 IS FALSE, NULL IS UNKNOWN;\n+-----------+------------+-----------------+\n| 1 IS TRUE | 0 IS FALSE | NULL IS UNKNOWN |\n+-----------+------------+-----------------+\n| 1 | 1 | 1 |\n+-----------+------------+-----------------+\n \nDifference between = and IS TRUE:\n \nSELECT 2 = TRUE, 2 IS TRUE;\n+----------+-----------+\n| 2 = TRUE | 2 IS TRUE |\n+----------+-----------+\n| 0 | 1 |\n+----------+-----------+\n \n\n\nURL: https://mariadb.com/kb/en/library/is/','','https://mariadb.com/kb/en/library/is/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (234,18,'IS NOT','Syntax\n------ \nIS NOT boolean_value\n \nDescription\n----------- \nTests a value against a boolean value, where boolean_value\ncan be\nTRUE, FALSE, or UNKNOWN. \n \nExamples\n-------- \nSELECT 1 IS NOT UNKNOWN, 0 IS NOT UNKNOWN, NULL IS NOT\nUNKNOWN;\n+------------------+------------------+---------------------+\n| 1 IS NOT UNKNOWN | 0 IS NOT UNKNOWN | NULL IS NOT UNKNOWN\n|\n+------------------+------------------+---------------------+\n| 1 | 1 | 0 |\n+------------------+------------------+---------------------+\n \nSELECT NULL IS NOT TRUE, NULL IS NOT FALSE;\n+------------------+-------------------+\n| NULL IS NOT TRUE | NULL IS NOT FALSE |\n+------------------+-------------------+\n| 1 | 1 |\n+------------------+-------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/is-not/','','https://mariadb.com/kb/en/library/is-not/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (235,18,'IS NOT NULL','Syntax\n------ \nIS NOT NULL\n \nDescription\n----------- \nTests whether a value is not NULL. See also NULL Values in\nMariaDB.\n \nExamples\n-------- \nSELECT 1 IS NOT NULL, 0 IS NOT NULL, NULL IS NOT NULL;\n+---------------+---------------+------------------+\n| 1 IS NOT NULL | 0 IS NOT NULL | NULL IS NOT NULL |\n+---------------+---------------+------------------+\n| 1 | 1 | 0 |\n+---------------+---------------+------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/is-not-null/','','https://mariadb.com/kb/en/library/is-not-null/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (236,18,'IS NULL','Syntax\n------ \nIS NULL\n \nDescription\n----------- \nTests whether a value is NULL. See also NULL Values in\nMariaDB.\n \nExamples\n-------- \nSELECT 1 IS NULL, 0 IS NULL, NULL IS NULL;\n+-----------+-----------+--------------+\n| 1 IS NULL | 0 IS NULL | NULL IS NULL |\n+-----------+-----------+--------------+\n| 0 | 0 | 1 |\n+-----------+-----------+--------------+\n \nCompatibility\n \nSome ODBC applications use the syntax auto_increment_field\nIS NOT NULL to find the latest row that was inserted with an\nautogenerated key value. If your applications need this, you\ncan set the sql_auto_is_null variable to 1.\n \nSET @@sql_auto_is_null=1;\nCREATE TABLE t1 (auto_increment_column INT NOT NULL\nAUTO_INCREMENT PRIMARY KEY);\nINSERT INTO t1 VALUES (NULL);\nSELECT * FROM t1 WHERE auto_increment_column IS NULL;\n \n+-----------------------+\n| auto_increment_column |\n+-----------------------+\n| 1 |\n+-----------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/is-null/','','https://mariadb.com/kb/en/library/is-null/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (237,18,'ISNULL','Syntax\n------ \nISNULL(expr)\n \nDescription\n----------- \nIf expr is NULL, ISNULL() returns 1, otherwise it returns 0.\n \nSee also NULL Values in MariaDB.\n \nExamples\n-------- \nSELECT ISNULL(1+1);\n+-------------+\n| ISNULL(1+1) |\n+-------------+\n| 0 |\n+-------------+\n \nSELECT ISNULL(1/0);\n+-------------+\n| ISNULL(1/0) |\n+-------------+\n| 1 |\n+-------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/isnull/','','https://mariadb.com/kb/en/library/isnull/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (238,18,'LEAST','Syntax\n------ \nLEAST(value1,value2,...)\n \nDescription\n----------- \nWith two or more arguments, returns the smallest\n(minimum-valued)\nargument. The arguments are compared using the following\nrules:\nIf the return value is used in an INTEGER context or all\narguments are integer-valued, they are compared as integers.\nIf the return value is used in a REAL context or all\narguments are real-valued, they are compared as reals.\nIf any argument is a case-sensitive string, the arguments\nare compared as case-sensitive strings.\nIn all other cases, the arguments are compared as\ncase-insensitive strings.\n \nLEAST() returns NULL if any argument is NULL.\n \nExamples\n-------- \nSELECT LEAST(2,0);\n+------------+\n| LEAST(2,0) |\n+------------+\n| 0 |\n+------------+\n \nSELECT LEAST(34.0,3.0,5.0,767.0);\n+---------------------------+\n| LEAST(34.0,3.0,5.0,767.0) |\n+---------------------------+\n| 3.0 |\n+---------------------------+\n \nSELECT LEAST(\'B\',\'A\',\'C\');\n+--------------------+\n| LEAST(\'B\',\'A\',\'C\') |\n+--------------------+\n| A |\n+--------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/least/','','https://mariadb.com/kb/en/library/least/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (239,18,'NOT BETWEEN','Syntax\n------ \nexpr NOT BETWEEN min AND max\n \nDescription\n----------- \nThis is the same as NOT (expr BETWEEN min AND max).\n \nNote that the meaning of the alternative form NOT expr\nBETWEEN min AND max is affected by the HIGH_NOT_PRECEDENCE\nSQL_MODE flag.\n \nExamples\n-------- \nSELECT 1 NOT BETWEEN 2 AND 3;\n+-----------------------+\n| 1 NOT BETWEEN 2 AND 3 |\n+-----------------------+\n| 1 |\n+-----------------------+\n \nSELECT \'b\' NOT BETWEEN \'a\' AND \'c\';\n+-----------------------------+\n| \'b\' NOT BETWEEN \'a\' AND \'c\' |\n+-----------------------------+\n| 0 |\n+-----------------------------+\n \nNULL:\n \nSELECT 1 NOT BETWEEN 1 AND NULL;\n+--------------------------+\n| 1 NOT BETWEEN 1 AND NULL |\n+--------------------------+\n| NULL |\n+--------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/not-between/','','https://mariadb.com/kb/en/library/not-between/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (240,18,'NOT IN','Syntax\n------ \nexpr NOT IN (value,...)\n \nDescription\n----------- \nThis is the same as NOT (expr IN (value,...)).\n \nExamples\n-------- \nSELECT 2 NOT IN (0,3,5,7);\n+--------------------+\n| 2 NOT IN (0,3,5,7) |\n+--------------------+\n| 1 |\n+--------------------+\n \nSELECT \'wefwf\' NOT IN (\'wee\',\'wefwf\',\'weg\');\n+--------------------------------------+\n| \'wefwf\' NOT IN (\'wee\',\'wefwf\',\'weg\') |\n+--------------------------------------+\n| 0 |\n+--------------------------------------+\n \nSELECT 1 NOT IN (\'1\', \'2\', \'3\');\n+--------------------------+\n| 1 NOT IN (\'1\', \'2\', \'3\') |\n+--------------------------+\n| 0 |\n+--------------------------+\n \nNULL:\n \nSELECT NULL NOT IN (1, 2, 3);\n+-----------------------+\n| NULL NOT IN (1, 2, 3) |\n+-----------------------+\n| NULL |\n+-----------------------+\n \nSELECT 1 NOT IN (1, 2, NULL);\n+-----------------------+\n| 1 NOT IN (1, 2, NULL) |\n+-----------------------+\n| 0 |\n+-----------------------+\n \nSELECT 5 NOT IN (1, 2, NULL);\n+-----------------------+\n| 5 NOT IN (1, 2, NULL) |\n+-----------------------+\n| NULL |\n+-----------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/not-in/','','https://mariadb.com/kb/en/library/not-in/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (241,19,'Operator Precedence','The precedence is the order in which the SQL operators are\nevaluated.\n \nThe following list shows the SQL operator precedence.\nOperators that appear first in the list have a higher\nprecedence. Operators which are listed together have the\nsame precedence.\nINTERVAL\nBINARY, COLLATE\n!\n- (unary minus), [[bitwise-not|]] (unary bit inversion)\n|| (string concatenation)\n^\n*, /, DIV, %, MOD\n-, +\n \n&\n|\n= (comparison), , >=, >, \n\nURL: https://mariadb.com/kb/en/library/operator-precedence/','','https://mariadb.com/kb/en/library/operator-precedence/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (242,19,'&amp;','Syntax\n------ \n&\n \nDescription\n----------- \nBitwise AND. Converts the values to binary and compares\nbits. Only if both the corresponding bits are 1 is the\nresulting bit also 1.\n \nSee also bitwise OR.\n \nExamples\n-------- \nSELECT 2&1;\n+-----+\n| 2&1 |\n+-----+\n| 0 |\n+-----+\n \nSELECT 3&1;\n+-----+\n| 3&1 |\n+-----+\n| 1 |\n+-----+\n \nSELECT 29 & 15;\n+---------+\n| 29 & 15 |\n+---------+\n| 13 |\n+---------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/bitwise_and/','','https://mariadb.com/kb/en/library/bitwise_and/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (243,19,'&lt;&lt;','Syntax\n------ \nvalue1 \n\nURL: https://mariadb.com/kb/en/library/shift-left/','','https://mariadb.com/kb/en/library/shift-left/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (244,19,'&gt;&gt;','Syntax\n------ \nvalue1 >> value2\n \nDescription\n----------- \nConverts a longlong (BIGINT) number (value1) to binary and\nshifts value2 units to the right.\n \nExamples\n-------- \nSELECT 4 >> 2;\n+--------+\n| 4 >> 2 |\n+--------+\n| 1 |\n+--------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/shift-right/','','https://mariadb.com/kb/en/library/shift-right/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (245,19,'BIT_COUNT','Syntax\n------ \nBIT_COUNT(N)\n \nDescription\n----------- \nReturns the number of bits that are set in the argument N.\n \nExamples\n-------- \nSELECT BIT_COUNT(29), BIT_COUNT(b\'101010\');\n+---------------+----------------------+\n| BIT_COUNT(29) | BIT_COUNT(b\'101010\') |\n+---------------+----------------------+\n| 4 | 3 |\n+---------------+----------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/bit_count/','','https://mariadb.com/kb/en/library/bit_count/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (246,19,'^','Syntax\n------ \n^\n \nDescription\n----------- \nBitwise XOR. Converts the values to binary and compares\nbits. If one (and only one) of the corresponding bits is 1\nis the resulting bit also 1.\n \nExamples\n-------- \nSELECT 1 ^ 1;\n+-------+\n| 1 ^ 1 |\n+-------+\n| 0 |\n+-------+\n \nSELECT 1 ^ 0;\n+-------+\n| 1 ^ 0 |\n+-------+\n| 1 |\n+-------+\n \nSELECT 11 ^ 3;\n+--------+\n| 11 ^ 3 |\n+--------+\n| 8 |\n+--------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/bitwise-xor/','','https://mariadb.com/kb/en/library/bitwise-xor/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (247,19,'|','Syntax\n------ \n|\n \nDescription\n----------- \nBitwise OR. Converts the values to binary and compares bits.\nIf either of the corresponding bits has a value of 1, the\nresulting bit is also 1.\n \nSee also bitwise AND.\n \nExamples\n-------- \nSELECT 2|1;\n+-----+\n| 2|1 |\n+-----+\n| 3 |\n+-----+\n \nSELECT 29 | 15;\n+---------+\n| 29 | 15 |\n+---------+\n| 31 |\n+---------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/bitwise-or/','','https://mariadb.com/kb/en/library/bitwise-or/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (248,19,'~','Syntax\n------ \n~\n \nDescription\n----------- \nBitwise NOT. Converts the value to 4 bytes binary and\ninverts all bits.\n \nExamples\n-------- \nSELECT 3 & ~1;\n+--------+\n| 3 & ~1 |\n+--------+\n| 2 |\n+--------+\n \nSELECT 5 & ~1;\n+--------+\n| 5 & ~1 |\n+--------+\n| 4 |\n+--------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/bitwise-not/','','https://mariadb.com/kb/en/library/bitwise-not/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (249,19,'Parentheses','Parentheses are sometimes called precedence operators - this\nmeans that they can be used to change the other operator\'s\nprecedence in an expression. The expressions that are\nwritten between parentheses are computed before the\nexpressions that are written outside. Parentheses must\nalways contain an expression (that is, they cannot be\nempty), and can be nested.\n \nFor example, the following expressions could return\ndifferent results:\nNOT a OR b\nNOT (a OR b)\n \nIn the first case, NOT applies to a, so if a is FALSE or b\nis TRUE, the expression returns TRUE. In the second case,\nNOT applies to the result of a OR b, so if at least one of a\nor b is TRUE, the expression is TRUE.\n \nWhen the precedence of operators is not intuitive, you can\nuse parentheses to make it immediately clear for whoever\nreads the statement.\n \nThe precedence of the NOT operator can also be affected by\nthe HIGH_NOT_PRECEDENCE SQL_MODE flag.\n \nOther uses\n \nParentheses must always be used to enclose subqueries.\n \nParentheses can also be used in a JOIN statement between\nmultiple tables to determine which tables must be joined\nfirst.\n \nAlso, parentheses are used to enclose the list of parameters\nto be passed to built-in functions, user-defined functions\nand stored routines. However, when no parameter is passed to\na stored procedure, parentheses are optional. For builtin\nfunctions and user-defined functions, spaces are not allowed\nbetween the function name and the open parenthesis, unless\nthe IGNORE_SPACE SQL_MODE is set. For stored routines (and\nfor functions if IGNORE_SPACE is set) spaces are allowed\nbefore the open parenthesis, including tab characters and\nnew line characters.\n \nSyntax errors\n \nIf there are more open parentheses than closed parentheses,\nthe error usually looks like this:\n \nERROR 1064 (42000): You have an error in your SQL syntax;\ncheck the manual that\ncorresponds to your MariaDB server version for the right\nsyntax to use near \'\' a\nt line 1\n \nNote the empty string.\n \nIf there are more closed parentheses than open parentheses,\nthe error usually looks like this:\n \nERROR 1064 (42000): You have an error in your SQL syntax;\ncheck the manual that\ncorresponds to your MariaDB server version for the right\nsyntax to use near \')\'\nat line 1\n \nNote the quoted closed parenthesis.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/parentheses/','','https://mariadb.com/kb/en/library/parentheses/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (250,19,'TRUE FALSE','Description\n----------- \nThe constants TRUE and FALSE evaluate to 1 and 0,\nrespectively. The\nconstant names can be written in any lettercase.\n \nExamples\n-------- \nSELECT TRUE, true, FALSE, false;\n \n+------+------+-------+-------+\n| TRUE | TRUE | FALSE | FALSE |\n+------+------+-------+-------+\n| 1 | 1 | 0 | 0 |\n+------+------+-------+-------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/true-false/','','https://mariadb.com/kb/en/library/true-false/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (251,20,'ANALYZE TABLE','Syntax\n------ \nANALYZE [NO_WRITE_TO_BINLOG | LOCAL] TABLE tbl_name\n[,tbl_name ...] \n [PERSISTENT FOR [ALL|COLUMNS ([col_name [,col_name ...]])] \n [INDEXES ([index_name [,index_name ...]])]] \n \nDescription\n----------- \nANALYZE TABLE analyzes and stores the key distribution for a\ntable (index statistics). During the analysis, the table is\nlocked with a read lock. This statement works with MyISAM,\nAria and InnoDB tables. For MyISAM tables, this statement is\nequivalent\nto using myisamchk --analyze.\n \nFor more information on how the analysis works within\nInnoDB, see\nInnoDB Limitations.\n \nMariaDB uses the stored key distribution to decide the order\nin which\ntables should be joined when you perform a join on something\nother than\na constant. In addition, key distributions can be used when\ndeciding\nwhich indexes to use for a specific table within a query.\n \nThis statement requires SELECT and INSERT privileges for the\ntable.\n \nBy default, ANALYZE TABLE statements are written to the\nbinary log and will be replicated. The NO_WRITE_TO_BINLOG\nkeyword (LOCAL is an alias) will ensure the statement is not\nwritten to the binary log. \n \nANALYZE TABLE is also supported for partitioned tables. You\ncan use ALTER TABLE ... ANALYZE PARTITION to analyze one or\nmore partitions.\n \nEngine-Independent Statistics\n \nMariaDB 10.0.1 extended ANALYZE TABLE to support\nengine-independent statistics.\n \nEngine-independent statistics are collected by doing full\ntable and full index scans, and collecting can be quite\nexpensive. \n \nANALYZE TABLE behavior depends on the value of the\nuse_stat_tables system variable.\n \nIf use_stat_tables is set to never (default in = MariaDB\n10.4.1), ANALYZE TABLE t will collect storage engine\nstatistics, and not engine-independent statistics.\n \nIf use_stat_tables is set to complementary or preferably,\nANALYZE TABLE t will collect engine-independent statistics. \n \nIn order to collect engine-independent statistics when\nuse_stat_tables is not set to one of the above two values\n(it is not by default), the extended form of ANALYZE TABLE,\nusing PERSISTENT FOR, must be used. This also allows one to\ncollect statistics only for particular columns or indexes.\nNote that engine-independent statistics are used by default\nfrom MariaDB 10.4 (use_stat_tables=preferably_for_queries),\nso you will probably want to use PERSISTENT FOR.\n \nIt is recommended to collect engine-independent statistics\non as-needed basis, so typically one will not have\nengine-independent statistics for all indexes/all columns. \n \nNote that statistics for blob and text columns are not\ncollected. If explicitly specified, a warning is returned.\n \n-- update all engine-independent statistics for all columns\nand indexes\nANALYZE TABLE tbl PERSISTENT FOR ALL;\n \n-- update specific columns and indexes:\nANALYZE TABLE tbl PERSISTENT FOR COLUMNS (col1,col2,...)\nINDEXES (idx1,idx2,...);\n \n-- empty lists are allowed:\nANALYZE TABLE tbl PERSISTENT FOR COLUMNS (col1,col2,...)\nINDEXES ();\nANALYZE TABLE tbl PERSISTENT FOR COLUMNS () INDEXES\n(idx1,idx2,...);\n \n-- the following will only update mysql.table_stat fields:\nANALYZE TABLE tbl PERSISTENT FOR COLUMNS () INDEXES ();\n \n-- with use_stat_tables = COMPLEMENTARY, a simple ANALYZE\nTABLE \n-- collects engine-independent statistics for all columns\nand indexes.\nSET SESSION use_stat_tables=\'COMPLEMENTARY\';\n \nANALYZE TABLE tbl;\n \nThe PERSISTENT FOR is required to update the\nengine-independent statistics even if the table has the\noption STATS_PERSISTENT=1 (which refers to InnoDB Persistent\nStatistics).\n \nThe Aria storage engine supports progress reporting for the\nANALYZE TABLE statement.\n \n\n\nURL: https://mariadb.com/kb/en/library/analyze-table/','','https://mariadb.com/kb/en/library/analyze-table/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (252,20,'CHECK TABLE','Syntax\n------ \nCHECK TABLE tbl_name [, tbl_name] ... [option] ...\n \noption = {FOR UPGRADE | QUICK | FAST | MEDIUM | EXTENDED |\nCHANGED}\n \nDescription\n----------- \nCHECK TABLE checks a table or tables for errors. CHECK TABLE\nworks for\nArchive, Aria, CSV, InnoDB, and MyISAM tables. For Aria and\nMyISAM tables, the\nkey statistics are updated as well. For CSV, see also\nChecking and Repairing CSV Tables.\n \nAs an alternative, myisamchk is a commandline tool for\nchecking MyISAM tables when the tables are not being\naccessed.\n \nFor checking dynamic columns integrity, COLUMN_CHECK() can\nbe used.\n \nCHECK TABLE can also check views for problems, such as\ntables\nthat are referenced in the view definition that no longer\nexist.\n \nCHECK TABLE is also supported for partitioned tables. You\ncan\nuse ALTER TABLE ... CHECK PARTITION \nto check one or more partitions.\n \nThe meaning of the different options are as follows - note\nthat this can vary a bit between\nstorage engines:\n \nFOR UPGRADE | Do a very quick check if the storage format\nfor the table has changed so that one needs to do a REPAIR.\nThis is only needed when one upgrades between major versions\nof MariaDB or MySQL. This is usually done by running\nmysql_upgrade. | \n \nFAST | Only check tables that has not been closed properly\nor are marked as corrupt. Only supported by the MyISAM and\nAria engines. For other engines the table is checked\nnormally | \n \nCHANGED | Check only tables that has changed since last\nREPAIR / CHECK. Only supported by the MyISAM and Aria\nengines. For other engines the table is checked normally. | \n \nQUICK | Do a fast check. For MyISAM and Aria engine this\nmeans we skip checking the delete link chain which may take\nsome time. | \n \nMEDIUM | Scan also the data files. Checks integrity between\ndata and index files with checksums. In most cases this\nshould find all possible errors. | \n \nEXTENDED | Does a full check to verify every possible error.\nFor MyISAM and Aria we verify for each row that all it keys\nexists and points to the row. This may take a long time on\nbig tables! | \n \nFor most cases running CHECK TABLE without options or MEDIUM\nshould be\ngood enough.\n \nSince MariaDB 5.3, the Aria storage engine supports progress\nreporting for this statement.\n \nIf you want to know if two tables are identical, take a look\nat CHECKSUM TABLE.\n \nXtraDB/InnoDB\n \nIf CHECK TABLE finds an error in an InnoDB table, MariaDB\nmight shutdown to prevent the error propagation. In this\ncase, the problem will be reported in the error log.\nOtherwise, since MariaDB 5.5, the table or an index might be\nmarked as corrupted, to prevent use. This does not happen\nwith some minor problems, like a wrong number of entries in\na secondary index. Those problems are reported in the output\nof CHECK TABLE.\n \nEach tablespace contains a header with metadata. This header\nis not checked by this statement.\n \nDuring the execution of CHECK TABLE, other threads may be\nblocked.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/sql-commands-check-table/','','https://mariadb.com/kb/en/library/sql-commands-check-table/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (253,20,'CHECK VIEW','CHECK VIEW was introduced in MariaDB 10.0.18.\n \nSyntax\n------ \nCHECK VIEW view_name\n \nDescription\n----------- \nThe CHECK VIEW statement was introduced in MariaDB 10.0.18\nto assist with fixing MDEV-6916, an issue introduced in\nMariaDB 5.2 where the view algorithms were swapped. It\nchecks whether the view algorithm is correct. It is run as\npart of mysql_upgrade, and should not normally be required\nin regular use.\n \n\n\nURL: https://mariadb.com/kb/en/library/check-view/','','https://mariadb.com/kb/en/library/check-view/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (254,20,'CHECKSUM TABLE','Syntax\n------ \nCHECKSUM TABLE tbl_name [, tbl_name] ... [ QUICK | EXTENDED\n]\n \nDescription\n----------- \nCHECKSUM TABLE reports a table checksum. This is very\nuseful if you want to know if two tables are the same (for\nexample on a master\nand slave).\n \nWith QUICK, the live table checksum is reported if it is\navailable, or NULL otherwise. This is very fast. A live\nchecksum is enabled by specifying the CHECKSUM=1 table\noption when you create the table; currently, this is\nsupported\nonly for Aria and MyISAM tables.\n \nWith EXTENDED, the entire table is read row by row and the\nchecksum is calculated. This can be very slow for large\ntables.\n \nIf neither QUICK nor EXTENDED is\nspecified, MariaDB returns a live checksum if the table\nstorage engine supports\nit and scans the table otherwise.\n \nCHECKSUM TABLE requires the SELECT privilege for the table.\n \nFor a nonexistent table, CHECKSUM TABLE returns\nNULL and generates a warning.\n \nThe table row format affects the checksum value. If the row\nformat changes, the checksum will change. This means that\nwhen a table created with a MariaDB/MySQL version is\nupgraded to another version, the checksum value will\nprobably change.\n \nTwo identical tables should always match to the same\nchecksum value; however, also for non-identical tables there\nis a very slight chance that they will return the same value\nas the hashing algorithm is not completely collision-free.\n \nDifferences Between MariaDB and MySQL\n \nCHECKSUM TABLE may give a different result as MariaDB\ndoesn\'t\nignore NULLs in the columns as MySQL 5.1 does (Later MySQL\nversions should calculate checksums the same way as\nMariaDB). You can get the\n\'old style\' checksum in MariaDB by starting mysqld with\nthe\n--old option. Note however that that the MyISAM and Aria\nstorage engines in MariaDB are using the new checksum\ninternally, so if you are\nusing --old, the CHECKSUM command will be\nslower as it needs to calculate the checksum row by row.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/checksum-table/','','https://mariadb.com/kb/en/library/checksum-table/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (255,20,'OPTIMIZE TABLE','Syntax\n------ \nOPTIMIZE [NO_WRITE_TO_BINLOG | LOCAL] TABLE\n tbl_name [, tbl_name] ...\n [WAIT n | NOWAIT]\n \nDescription\n----------- \nOPTIMIZE TABLE has two main functions. It can either be used\nto defragment tables, or to update the InnoDB fulltext\nindex.\n \nWAIT/NOWAIT\n \nSet the lock wait timeout. See WAIT and NOWAIT.\n \nDefragmenting\n \nOPTIMIZE TABLE works for InnoDB (before MariaDB 10.1.1, only\nif the innodb_file_per_table server system variable is set),\nAria, MyISAM and ARCHIVE tables, and should be used if you\nhave deleted a large part of a table or if you have made\nmany changes to a table with variable-length\nrows (tables that have VARCHAR, VARBINARY, BLOB, or TEXT\ncolumns). Deleted rows are maintained in a\nlinked list and subsequent INSERT operations reuse old row\npositions.\n \nThis statement requires SELECT and INSERT privileges for the\ntable.\n \nBy default, OPTIMIZE TABLE statements are written to the\nbinary log and will be replicated. The NO_WRITE_TO_BINLOG\nkeyword (LOCAL is an alias) will ensure the statement is not\nwritten to the binary log. \n \nOPTIMIZE TABLE is also supported for partitioned tables. You\ncan use \nALTER TABLE ... OPTIMIZE PARTITION \nto optimize one or more partitions.\n \nYou can use OPTIMIZE TABLE to reclaim the unused\nspace and to defragment the data file. With other storage\nengines, OPTIMIZE TABLE does nothing by default, and returns\nthis message: \" The storage engine for the table doesn\'t\nsupport optimize\". However, if the server has been started\nwith the --skip-new option, OPTIMIZE TABLE is linked to\nALTER TABLE, and recreates the table. This operation frees\nthe unused space and updates index statistics.\n \nSince MariaDB 5.3, the Aria storage engine supports progress\nreporting for this statement.\n \nIf a MyISAM table is fragmented, concurrent inserts will not\nbe performed until an OPTIMIZE TABLE statement is executed\non that table, unless the concurrent_insert server system\nvariable is set to ALWAYS.\n \nUpdating an InnoDB fulltext index\n \nWhen rows are added or deleted to an InnoDB fulltext index,\nthe index is not immediately re-organized, as this can be an\nexpensive operation. Change statistics are stored in a\nseparate location . The fulltext index is only fully\nre-organized when an OPTIMIZE TABLE statement is run.\n \nBy default, an OPTIMIZE TABLE will defragment a table. In\norder to use it to update fulltext index statistics, the\ninnodb_optimize_fulltext_only system variable must be set to\n1. This is intended to be a temporary setting, and should be\nreset to 0 once the fulltext index has been re-organized.\n \nSince fulltext re-organization can take a long time, the\ninnodb_ft_num_word_optimize variable limits the\nre-organization to a number of words (2000 by default). You\ncan run multiple OPTIMIZE statements to fully re-organize\nthe index.\n \nDefragmenting InnoDB tablespaces\n \nMariaDB 10.1.1 merged the Facebook/Kakao defragmentation\npatch \n \nMariaDB 10.1.1 merged the Facebook/Kakao defragmentation\npatch, allowing one to use OPTIMIZE TABLE to defragment\nInnoDB tablespaces. For this functionality to be enabled,\nthe innodb_defragment system variable must be enabled. No\nnew tables are created and there is no need to copy data\nfrom old tables to new tables. Instead, this feature loads n\npages (determined by innodb-defragment-n-pages) and tries to\nmove records so that pages would be full of records and then\nfrees pages that are fully empty after the operation. Note\nthat tablespace files (including ibdata1) will not shrink as\nthe result of defragmentation, but one will get better\nmemory utilization in the InnoDB buffer pool as there are\nfewer data pages in use.\n \nSee Defragmenting InnoDB Tablespaces for more details.\n \n\n\nURL: https://mariadb.com/kb/en/library/optimize-table/','','https://mariadb.com/kb/en/library/optimize-table/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (256,20,'REPAIR TABLE','Syntax\n------ \nREPAIR [NO_WRITE_TO_BINLOG | LOCAL] TABLE\n tbl_name [, tbl_name] ...\n [QUICK] [EXTENDED] [USE_FRM]\n \nDescription\n----------- \nREPAIR TABLE repairs a possibly corrupted table. By default,\nit has the same effect as\n \nmyisamchk --recover tbl_name\n \nor\n \naria_chk --recover tbl_name\n \nSee aria_chk and myisamchk for more.\n \nREPAIR TABLE works for Archive, Aria, CSV and MyISAM tables.\nFor XtraDB/InnoDB, see recovery modes. For CSV, see also\nChecking and Repairing CSV Tables. For Archive, this\nstatement also improves compression. If the storage engine\ndoes not support this statement, a warning is issued.\n \nThis statement requires SELECT and INSERT privileges for the\ntable.\n \nBy default, REPAIR TABLE statements are written to the\nbinary log and will be replicated. The NO_WRITE_TO_BINLOG\nkeyword (LOCAL is an alias) will ensure the statement is not\nwritten to the binary log.\n \nWhen an index is recreated, the storage engine may use a\nconfigurable buffer in the process. Incrementing the buffer\nspeeds up the index creation. Aria and MyISAM allocate a\nbuffer whose size is defined by aria_sort_buffer_size or\nmyisam_sort_buffer_size, also used for ALTER TABLE.\n \nREPAIR TABLE is also supported for partitioned tables.\nHowever, the USE_FRM option cannot be used with this\nstatement\non a partitioned table.\n \n ALTER TABLE ... REPAIR PARTITION can be used\nto repair one or more partitions.\n \nThe Aria storage engine supports progress reporting for this\nstatement.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/repair-table/','','https://mariadb.com/kb/en/library/repair-table/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (257,20,'REPAIR VIEW','REPAIR VIEW was introduced in MariaDB 10.0.18 and MariaDB\n5.5.43.\n \nSyntax\n------ \nREPAIR [NO_WRITE_TO_BINLOG | LOCAL] VIEW view_name[,\nview_name] ... [FROM MYSQL]\n \nDescription\n----------- \nThe REPAIR VIEW statement was introduced to assist with\nfixing MDEV-6916, an issue introduced in MariaDB 5.2 where\nthe view algorithms were swapped compared to their MySQL on\ndisk representation. It checks whether the view algorithm is\ncorrect. It is run as part of mysql_upgrade, and should not\nnormally be required in regular use.\n \nBy default it corrects the checksum and if necessary adds\nthe mariadb-version field. If the optional FROM MYSQL clause\nis used, and no mariadb-version field is present, the MERGE\nand TEMPTABLE algorithms are toggled.\n \nBy default, REPAIR VIEW statements are written to the binary\nlog and will be replicated. The NO_WRITE_TO_BINLOG keyword\n(LOCAL is an alias) will ensure the statement is not written\nto the binary log.\n \nNote that REPAIR VIEW in MariaDB 10.0.18 and MariaDB 5.5.43\ncould crash the server (see MDEV-8115). Upgrade to a later\nversion.\n \n\n\nURL: https://mariadb.com/kb/en/library/repair-view/','','https://mariadb.com/kb/en/library/repair-view/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (258,21,'CREATE FUNCTION UDF','Syntax\n------ \nCREATE [OR REPLACE] [AGGREGATE] FUNCTION [IF NOT EXISTS]\nfunction_name\n RETURNS {STRING|INTEGER|REAL|DECIMAL}\n SONAME shared_library_name\n \nDescription\n----------- \nA user-defined function (UDF) is a way to extend MariaDB\nwith a new function\nthat works like a native (built-in) MariaDB function such as\nABS() or\nCONCAT().\n \nfunction_name is the name that should be used in SQL\nstatements to invoke\nthe function. \n \nTo create a function, you must have the INSERT privilege for\nthe\nmysql database. This is necessary because CREATE FUNCTION\nadds a row to the\nmysql.func system table that records the function\'s name,\ntype, and shared library name. If you do not have this\ntable, you should run\nthe mysql_upgrade command to create it.\n \nUDFs need to be written in C, C++ or another language that\nuses C calling\nconventions, MariaDB needs to have been dynamically\ncompiled, and your\noperating system must support dynamic loading.\n \nFor an example, see sql/udf_example.cc in the source tree.\nFor a collection of existing UDFs see\nhttp://www.mysqludf.org/.\n \nStatements making use of user-defined functions are not\nsafe for replication.\n \nFor creating a stored function as opposed to a user-defined\nfunction, see\nCREATE FUNCTION.\n \nFor valid identifiers to use as function names, see\nIdentifier Names.\n \nRETURNS\n \nThe RETURNS clause indicates the type of the function\'s\nreturn value, and can be one of STRING, INTEGER, REAL or\nDECIMAL. DECIMAL functions currently return string values\nand should be written like STRING functions.\n \nshared_library_name\n \nshared_library_name is the basename of the shared object\nfile that contains\nthe code that implements the function. The file must be\nlocated in the plugin\ndirectory. This directory is given by the value of the\nplugin_dir system variable. Note that\nbefore MariaDB/MySQL 5.1, the shared object could be located\nin any directory\nthat was searched by your system\'s dynamic linker.\n \nAGGREGATE\n \nAggregate functions are summary functions such as SUM() and\nAVG().\n \nAggregate UDF functions can be used as window functions.\n \nOR REPLACE\n \nThe OR REPLACE clause was added in MariaDB 10.1.3\n \nIf the optional OR REPLACE clause is used, it acts as a\nshortcut for:\n \nDROP FUNCTION IF EXISTS function_name;\n \nCREATE FUNCTION name ...;\n \nIF NOT EXISTS\n \nThe IF NOT EXISTS clause was added in MariaDB 10.1.3\n \nWhen the IF NOT EXISTS clause is used, MariaDB will return a\nwarning instead of an error if the specified function\nalready exists. Cannot be used together with OR REPLACE.\n \nUpgrading a UDF\n \nTo upgrade the UDF\'s shared library, first run a\nDROP FUNCTION statement, then upgrade the shared library and\nfinally run the CREATE FUNCTION statement. If you upgrade\nwithout following\nthis process, you may crash the server.\n \nExamples\n-------- \nCREATE FUNCTION jsoncontains_path RETURNS integer SONAME\n\'ha_connect.so\';\n \nQuery OK, 0 rows affected (0.00 sec)\n \nOR REPLACE and IF NOT EXISTS:\n \nCREATE FUNCTION jsoncontains_path RETURNS integer SONAME\n\'ha_connect.so\';\n \nERROR 1125 (HY000): Function \'jsoncontains_path\' already\nexists\n \nCREATE OR REPLACE FUNCTION jsoncontains_path RETURNS integer\nSONAME \'ha_connect.so\';\n \nQuery OK, 0 rows affected (0.00 sec)\n \nCREATE FUNCTION IF NOT EXISTS jsoncontains_path RETURNS\ninteger SONAME \'ha_connect.so\';\n \nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+-------+------+---------------------------------------------+\n| Level | Code | Message |\n+-------+------+---------------------------------------------+\n| Note | 1125 | Function \'jsoncontains_path\' already\nexists |\n+-------+------+---------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/create-function-udf/','','https://mariadb.com/kb/en/library/create-function-udf/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (259,21,'DROP FUNCTION UDF','Syntax\n------ \nDROP FUNCTION [IF EXISTS] function_name\n \nDescription\n----------- \nThis statement drops the user-defined function (UDF) named\nfunction_name.\n \nTo drop a function, you must have the DELETE privilege for\nthe mysql database. This is because DROP FUNCTION removes\nthe row from the mysql.func system table that records the\nfunction\'s name, type and shared library name.\n \nFor dropping a stored function, see DROP FUNCTION.\n \nUpgrading a UDF\n \nTo upgrade the UDF\'s shared library, first run a DROP\nFUNCTION statement, then upgrade the shared library and\nfinally run the CREATE FUNCTION statement. If you upgrade\nwithout following this process, you may crash the server.\n \nExamples\n-------- \nDROP FUNCTION jsoncontains_path;\n \nIF EXISTS:\n \nDROP FUNCTION jsoncontains_path;\n \nERROR 1305 (42000): FUNCTION test.jsoncontains_path does not\nexist\n \nDROP FUNCTION IF EXISTS jsoncontains_path;\n \nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+-------+------+------------------------------------------------+\n| Level | Code | Message |\n+-------+------+------------------------------------------------+\n| Note | 1305 | FUNCTION test.jsoncontains_path does not\nexist |\n+-------+------+------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/drop-function-udf/','','https://mariadb.com/kb/en/library/drop-function-udf/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (260,21,'Creating User-Defined Functions','User-defined functions allow MariaDB to be extended with a\nnew function that works like a native (built-in) MariaDB\nfunction such as ABS() or CONCAT(). There are alternative\nways to add a new function: writing a native function (which\nrequires modifying and compiling the server source code), or\nwriting a stored function.\n \nStatements making use of user-defined functions are not safe\nfor replication.\n \nFunctions are written in C or C++, and to make use of them,\nthe operating system must support dynamic loading. \n \nEach new SQL function requires corresponding functions\nwritten in C/C++. In the list below, at least the main\nfunction - x() - and one other, are required. x should be\nreplaced by the name of the function you are creating.\n \nAll functions need to be thread-safe, so not global or\nstatic variables that change can be allocated. Memory is\nallocated in x_init()/ and freed in x_deinit(). \n \nSimple Functions\n \nx()\n \nRequired for all UDF\'s, this is where the results are\ncalculated.\n \nC/C++ type | SQL type | \n \nchar * | STRING | \n \nlong long | INTEGER | \n \ndouble | REAL | \n \nDECIMAL functions return string values, and so should be\nwritten accordingly. It is not possible to create ROW\nfunctions.\n \nx_init()\n \nInitialization function for x(). Can be used for the\nfollowing:\nCheck the number of arguments to X() (the SQL equivalent).\nVerify the argument types, or to force arguments to be of a\nparticular type after the function is called.\nSpecify whether the result can be NULL.\nSpecify the maximum result length.\nFor REAL functions, specify the maximum number of decimals\nfor the result.\nAllocate any required memory.\n To verify that the arguments are of a required type or,\nalternatively, to tell MySQL to coerce arguments to the\nrequired types when the main function is called.\n \nx_deinit()\n \nDe-initialization function for x(). Used to de-allocate\nmemory that was allocated in x_init().\n \nDescription\n----------- \nEach time the SQL function X() is called:\nMariaDB will first call the C/C++ initialization function,\nx_init(), assuming it exists. All setup will be performed,\nand if it returns an error, the SQL statement is aborted and\nno further functions are called.\nIf there is no x_init() function, or it has been called and\ndid not return an error, x() is then called once per row.\nAfter all rows have finished processing, x_deinit() is\ncalled, if present, to clean up by de-allocating any memory\nthat was allocated in x_init().\nSee User-defined Functions Calling Sequences for more\ndetails on the functions.\n \nAggregate Functions\n \nThe following functions are required for aggregate\nfunctions, such as AVG() and SUM(). \n \nx_clear()\n \nUsed to reset the current aggregate, but without inserting\nthe argument as the initial aggregate value for the new\ngroup.\n \nx_add()\n \nUsed to add the argument to the current aggregate. \n \nx_remove()\n \nStaring from MariaDB 10.4 it improves the support of window\nfunctions (so it is not obligatory to add it) and should\nremove the argument from the current aggregate.\n \nDescription\n----------- \nEach time the aggregate SQL function X() is called:\nMariaDB will first call the C/C++ initialization function,\nx_init(), assuming it exists. All setup will be performed,\nand if it returns an error, the SQL statement is aborted and\nno further functions are called.\nIf there is no x_init() function, or it has been called and\ndid not return an error, x() is then called once per row.\nAfter all rows have finished processing, x_deinit() is\ncalled, if present, to clean up by de-allocating any memory\nthat was allocated in x_init().\n \nMariaDB will first call the C/C++ initialization function,\nx_init(), assuming it exists. All setup will be performed,\nand if it returns an error, the SQL statement is aborted and\nno further functions are called.\nThe table is sorted according to the GROUP BY expression.\nx_clear() is called for the first row of each new group.\nx_add() is called once per row for each row in the same\ngroup.\nx() is called when the group changes, or after the last row,\nto get the aggregate result. \nThe latter three steps are repeated until all rows have been\nprocessed.\nAfter all rows have finished processing, x_deinit() is\ncalled, if present, to clean up by de-allocating any memory\nthat was allocated in x_init().\n \nExamples\n-------- \nFor an example, see sql/udf_example.cc in the source tree.\nFor a collection of existing UDFs see\nhttps://github.com/mysqludf.\n \n\n\nURL:\nhttps://mariadb.com/kb/en/library/creating-user-defined-functions/','','https://mariadb.com/kb/en/library/creating-user-defined-functions/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (261,21,'User-Defined Functions Calling Sequences','The functions described in Creating User-defined Functions\nare expanded on this page. They are declared as follows:\n \nSimple Functions\n \nx()\n \nIf x() returns an integer, it is declared as follows:\n \nlong long x(UDF_INIT *initid, UDF_ARGS *args,\n char *is_null, char *error);\n \nIf x() returns a string (DECIMAL functions also return\nstring values), it is declared as follows:\n \nchar *x(UDF_INIT *initid, UDF_ARGS *args,\n char *result, unsigned long *length,\n char *is_null, char *error);\n \nIf x() returns a real, it is declared as follows:\n \ndouble x(UDF_INIT *initid, UDF_ARGS *args,\n char *is_null, char *error);\n \nx_init()\n \nmy_bool x_init(UDF_INIT *initid, UDF_ARGS *args, char\n*message);\n \nx_deinit()\n \nvoid x_deinit(UDF_INIT *initid);\n \nDescription\n----------- \ninitid is a parameter passed to all three functions that\npoints to a UDF_INIT structure, used for communicating\ninformation between the functions. Its structure members\nare:\nmy_bool maybe_null\nmaybe_null should be set to 1 if x_init can return a NULL\nvalue, Defaults to 1 if any arguments are declared\nmaybe_null.\n \nunsigned int decimals\nNumber of decimals after the decimal point. The default, if\nan explicit number of decimals is passed in the arguments to\nthe main function, is the maximum number of decimals, so if\n9.5, 9.55 and 9.555 are passed to the function, the default\nwould be three (based on 9.555, the maximum). If there are\nno explicit number of decimals, the default is set to 31, or\none more than the maximum for the DOUBLE, FLOAT and DECIMAL\ntypes. This default can be changed in the function to suit\nthe actual calculation.\n \nunsigned int max_length\nMaximum length of the result. For integers, the default is\n21. For strings, the length of the longest argument. For\nreals, the default is 13 plus the number of decimals\nindicated by initid->decimals. The length includes any signs\nor decimal points. Can also be set to 65KB or 16MB in order\nto return a BLOB. The memory remains unallocated, but this\nis used to decide on the data type to use if the data needs\nto be temporarily stored.\n \nchar *ptr\nA pointer for use as required by the function. Commonly,\ninitid->ptr is used to communicate allocated memory, with\nx_init() allocating the memory and assigning it to this\npointer, x() using it, and x_deinit() de-allocating it.\n \nmy_bool const_item\nShould be set to 1 in x_init() if x() always returns the\nsame value, otherwise 0.\n \n\nAggregate Functions\n \nx_clear()\n \nx_clear() is a required function for aggregate functions,\nand is declared as follows:\n \nvoid x_clear(UDF_INIT *initid, char *is_null, char *error);\n \nIt is called when the summary results need to be reset, that\nis at the beginning of each new group. but also to reset the\nvalues when there were no matching rows.\n \nis_null is set to point to CHAR(0) before calling x_clear().\n \nIn the case of an error, you can store the value to which\nthe error argument points (a single-byte variable, not a\nstring string buffer) in the variable.\n \nx_reset()\n \nx_reset() is declared as follows:\n \nvoid x_reset(UDF_INIT *initid, UDF_ARGS *args,\n char *is_null, char *error);\n \nIt is called on finding the first row in a new group. Should\nreset the summary variables, and then use UDF_ARGS as the\nfirst value in the group\'s internal summary value. The\nfunction is not required if the UDF interface uses\nx_clear().\n \nx_add()\n \nx_add() is declared as follows:\n \nvoid x_add(UDF_INIT *initid, UDF_ARGS *args,\n char *is_null, char *error);\n \nIt is called for all rows belonging to the same group, and\nshould be used to add the value in UDF_ARGS to the internal\nsummary variable.\n \nx_remove()\n \nx_remove() was added in MariaDB 10.4 and is declared as\nfollows (same as x_add()):\n \nvoid x_remove(UDF_INIT* initid, UDF_ARGS* args,\n char* is_null, char *error );\n \nIt adds more efficient support of aggregate UDFs as window\nfunctions. x_remove() should \"subtract\" the row (reverse\nx_add()). In MariaDB 10.4 aggregate UDFs will work as WINDOW\nfunctions without x_remove() but it will not be so\nefficient.\n \nIf x_remove() supported (defined) detected automatically.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/user-defined-functions-calling-sequences/','','https://mariadb.com/kb/en/library/user-defined-functions-calling-sequences/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (262,21,'User-Defined Functions Security','The MariaDB server imposes a number of limitations on\nuser-defined functions for security purposes.\nThe INSERT privilege for the mysql database is required to\nrun CREATE FUNCTION, as a record will be added to the\nmysql.func-table.\nThe DELETE privilege for the mysql database is required to\nrun DROP FUNCTION as the corresponding record will be\nremoved from the mysql.func-table.\nUDF object files can only be placed in the plugin directory,\nas specified by the value of the plugin_dir system variable.\nAt least one symbol, beyond the required x() - corresponding\nto an SQL function X()) - is required. These can be\nx_init(), x_deinit(), xxx_reset(), x_clear() and x_add()\nfunctions (see Creating User-defined Functions). The\nallow-suspicious-udfs mysqld option (by default unset)\nprovides a workaround, permitting only one symbol to be\nused. This is not recommended, as it opens the possibility\nof loading shared objects that are not legitimate\nuser-defined functions.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/user-defined-functions-security/','','https://mariadb.com/kb/en/library/user-defined-functions-security/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (263,21,'mysql.func Table','The mysql.func table stores information about user-defined\nfunctions (UDFs) created with the CREATE FUNCTION UDF\nstatement.\n \nIn MariaDB 10.4 and later, this table uses the Aria storage\nengine.\n \nMariaDB until 10.3\n \nIn MariaDB 10.3 and before, this table uses the MyISAM\nstorage engine.\n \nThe mysql.func table contains the following fields:\n \nField | Type | Null | Key | Default | Description | \n \nname | char(64) | NO | PRI | | UDF name | \n \nret | tinyint(1) | NO | | 0 | | \n \ndl | char(128) | NO | | | Shared library name | \n \ntype | enum(\'function\',\'aggregate\') | NO | | NULL |\nType, either function or aggregate. Aggregate functions are\nsummary functions such as SUM() and AVG(). | \n \nExample\n \nSELECT * FROM mysql.func;\n+------------------------------+-----+--------------+-----------+\n| name | ret | dl | type |\n+------------------------------+-----+--------------+-----------+\n| spider_direct_sql | 2 | ha_spider.so | function |\n| spider_bg_direct_sql | 2 | ha_spider.so | aggregate |\n| spider_ping_table | 2 | ha_spider.so | function |\n| spider_copy_tables | 2 | ha_spider.so | function |\n| spider_flush_table_mon_cache | 2 | ha_spider.so | function\n|\n+------------------------------+-----+--------------+-----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/mysqlfunc-table/','','https://mariadb.com/kb/en/library/mysqlfunc-table/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (264,22,'AUTO_INCREMENT','Description\n----------- \nThe AUTO_INCREMENT attribute can be used to generate a\nunique identity for new rows. When you insert a new record\nto the table, and the auto_increment field is NULL or\nDEFAULT, the value will automatically be incremented. This\nalso applies to 0, unless the NO_AUTO_VALUE_ON_ZERO SQL_MODE\nis enabled.\n \nAUTO_INCREMENT columns start from 1 by default. The\nautomatically generated value can never be lower than 0.\n \nEach table can have only one AUTO_INCREMENT column. It must\ndefined as a key (not necessarily the PRIMARY KEY or UNIQUE\nkey). In some storage engines (including the default\nInnoDB), if the key consists of multiple columns, the\nAUTO_INCREMENT column must be the first column. Storage\nengines that permit the column to be placed elsewhere are\nAria, MyISAM, MERGE, Spider, TokuDB, BLACKHOLE, FederatedX\nand Federated.\n \nCREATE 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 (\'fox\'),(\'whale\'),(\'ostrich\');\n \nSELECT * FROM animals;\n \n+----+---------+\n| id | name |\n+----+---------+\n| 1 | dog |\n| 2 | cat |\n| 3 | penguin |\n| 4 | fox |\n| 5 | whale |\n| 6 | ostrich |\n+----+---------+\n \nSERIAL is an alias for BIGINT UNSIGNED NOT NULL\nAUTO_INCREMENT UNIQUE.\n \nCREATE TABLE t (id SERIAL, c CHAR(1)) ENGINE=InnoDB;\n \nSHOW CREATE TABLE t \\G\n*************************** 1. row\n***************************\n Table: t\nCreate Table: CREATE TABLE `t` (\n `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,\n `c` char(1) DEFAULT NULL,\n UNIQUE KEY `id` (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=latin1\n \nSetting or Changing the Auto_Increment Value\n \nYou can use an ALTER TABLE statement to assign a new value\nto the auto_increment table option, or set the insert_id\nserver system variable to change the next AUTO_INCREMENT\nvalue inserted by the current session.\n \nLAST_INSERT_ID() can be used to see the last AUTO_INCREMENT\nvalue inserted by the current session.\n \nALTER TABLE animals AUTO_INCREMENT=8;\n \nINSERT INTO animals (name) VALUES (\'aardvark\');\n \nSELECT * FROM animals;\n \n+----+-----------+\n| id | name |\n+----+-----------+\n| 1 | dog |\n| 2 | cat |\n| 3 | penguin |\n| 4 | fox |\n| 5 | whale |\n| 6 | ostrich |\n| 8 | aardvark |\n+----+-----------+\n \nSET insert_id=12;\n \nINSERT INTO animals (name) VALUES (\'gorilla\');\n \nSELECT * FROM animals;\n \n+----+-----------+\n| id | name |\n+----+-----------+\n| 1 | dog |\n| 2 | cat |\n| 3 | penguin |\n| 4 | fox |\n| 5 | whale |\n| 6 | ostrich |\n| 8 | aardvark |\n| 12 | gorilla |\n+----+-----------+\n \nInnoDB/XtraDB\n \nUntil MariaDB 10.2.3, InnoDB and XtraDB used an\nauto-increment counter that is stored in memory. When the\nserver restarts, the counter is re-initialized to the\nhighest value used in the table, which cancels the effects\nof any AUTO_INCREMENT = N option in the table statements.\n \nFrom MariaDB 10.2.4, this restriction has been lifted and\nAUTO_INCREMENT is persistent.\n \nSee also AUTO_INCREMENT Handling in XtraDB/InnoDB.\n \nSetting Explicit Values\n \nIt is possible to specify a value for an AUTO_INCREMENT\ncolumn. The value must not exist in the key.\n \nIf the new value is higher than the current maximum value,\nthe AUTO_INCREMENT value is updated, so the next value will\nbe higher. If the new value is lower than the current\nmaximum value, the AUTO_INCREMENT value remains unchanged.\n \nThe following example demonstrates these behaviours:\n \nCREATE TABLE t (id INTEGER UNSIGNED AUTO_INCREMENT PRIMARY\nKEY) ENGINE = InnoDB;\n \nINSERT INTO t VALUES (NULL);\nSELECT id FROM t;\n \n+----+\n| id |\n+----+\n| 1 |\n+----+\n \nINSERT INTO t VALUES (10); -- higher value\nSELECT id FROM t;\n \n+----+\n| id |\n+----+\n| 1 |\n| 10 |\n+----+\n \nINSERT INTO t VALUES (2); -- lower value\nINSERT INTO t VALUES (NULL); -- auto value\nSELECT id FROM t;\n \n+----+\n| id |\n+----+\n| 1 |\n| 2 |\n| 10 |\n| 11 |\n+----+\n \nThe ARCHIVE storage engine does not allow to insert a value\nthat is lower than the current maximum.\n \nMissing Values\n \nAn AUTO_INCREMENT column normally has missing values. This\nhappens because if a row is deleted, or an AUTO_INCREMENT\nvalue is explicitly updated, old values are never re-used.\nThe REPLACE statement also deletes a row, and its value is\nwasted. With InnoDB, values can be reserved by a\ntransaction; but if the transaction fails (for example,\nbecause of a ROLLBACK) the reserved value will be lost.\n \nThus AUTO_INCREMENT values can be used to sort results in a\nchronological order, but not to create a numeric sequence.\n \nReplication\n \nTo make master-master or Galera safe to use AUTO_INCREMENT\none should use the system variables \n auto_increment_increment and auto_increment_offset to\ngenerate unique values for each server.\n \nCHECK Constraints, DEFAULT Values and Virtual Columns\n \nFrom MariaDB 10.2.6 auto_increment columns are no longer\npermitted in CHECK constraints, DEFAULT value expressions\nand virtual columns. They were permitted in earlier\nversions, but did not work correctly. See MDEV-11117.\n \n\n\nURL: https://mariadb.com/kb/en/library/auto_increment/','','https://mariadb.com/kb/en/library/auto_increment/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (265,22,'BIGINT','Syntax\n------ \nBIGINT[(M)] [SIGNED | UNSIGNED | ZEROFILL]\n \nDescription\n----------- \nA large integer. The signed range is -9223372036854775808 to\n9223372036854775807. The unsigned range is 0 to\n18446744073709551615.\n \nIf a column has been set to ZEROFILL, all values will be\nprepended by zeros so that the BIGINT value contains a\nnumber of M digits.\n \nNote: If the ZEROFILL attribute has been specified, the\ncolumn will automatically become UNSIGNED.\n \nFor more details on the attributes, see Numeric Data Type\nOverview.\n \nSERIAL is an alias for:\n \nBIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE\n \nExamples\n-------- \nCREATE TABLE bigints (a BIGINT,b BIGINT UNSIGNED,c BIGINT\nZEROFILL);\n \nINSERT INTO bigints VALUES (-10,-10,-10);\nQuery OK, 1 row affected, 2 warnings (0.08 sec)\nWarning (Code 1264): Out of range value for column \'b\' at\nrow 1\nWarning (Code 1264): Out of range value for column \'c\' at\nrow 1\n \nINSERT INTO bigints VALUES (-10,10,-10);Query OK, 1 row\naffected, 1 warning (0.08 sec)\nWarning (Code 1264): Out of range value for column \'c\' at\nrow 1\n \nINSERT INTO bigints VALUES (-10,10,10);\n \nINSERT INTO bigints VALUES\n(9223372036854775808,9223372036854775808,9223372036854775808);\nQuery OK, 1 row affected, 1 warning (0.07 sec)\nWarning (Code 1264): Out of range value for column \'a\' at\nrow 1\n \nINSERT INTO bigints VALUES\n(9223372036854775807,9223372036854775808,9223372036854775808);\n \nSELECT * FROM bigints;\n+---------------------+---------------------+----------------------+\n| a | b | c |\n+---------------------+---------------------+----------------------+\n| -10 | 0 | 00000000000000000000 |\n| -10 | 10 | 00000000000000000000 |\n| -10 | 10 | 00000000000000000010 |\n| 9223372036854775807 | 9223372036854775808 |\n09223372036854775808 |\n| 9223372036854775807 | 9223372036854775808 |\n09223372036854775808 |\n+---------------------+---------------------+----------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/bigint/','','https://mariadb.com/kb/en/library/bigint/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (266,22,'BINARY','Syntax\n------ \nBINARY(M)\n \nDescription\n----------- \nThe BINARY type is similar to the CHAR type, but stores\nbinary\nbyte strings rather than non-binary character strings. M\nrepresents the\ncolumn length in bytes.\n \nIt contains no character set, and comparison and sorting are\nbased on the numeric value of the bytes.\n \nIf the maximum length is exceeded, and SQL strict mode is\nnot enabled , the extra characters will be dropped with a\nwarning. If strict mode is enabled, an error will occur.\n \nBINARY values are right-padded with 0x00 (the zero byte) to\nthe specified length when inserted. The padding is not\nremoved on select, so this needs to be taken into account\nwhen sorting and comparing, where all bytes are significant.\nThe zero byte, 0x00 is less than a space for comparison\npurposes.\n \nExamples\n-------- \nInserting too many characters, first with strict mode off,\nthen with it on:\n \nCREATE TABLE bins (a BINARY(10));\n \nINSERT INTO bins VALUES(\'12345678901\');\nQuery OK, 1 row affected, 1 warning (0.04 sec)\n \nSELECT * FROM bins;\n \n+------------+\n| a |\n+------------+\n| 1234567890 |\n+------------+\n \nSET sql_mode=\'STRICT_ALL_TABLES\';\n \nINSERT INTO bins VALUES(\'12345678901\');\nERROR 1406 (22001): Data too long for column \'a\' at row 1\n \nSorting is performed with the byte value:\n \nTRUNCATE bins;\n \nINSERT INTO bins VALUES(\'A\'),(\'B\'),(\'a\'),(\'b\');\n \nSELECT * FROM bins ORDER BY a;\n \n+------+\n| a |\n+------+\n| A |\n| B |\n| a |\n| b |\n+------+\n \nUsing CAST to sort as a CHAR instead:\n \nSELECT * FROM bins ORDER BY CAST(a AS CHAR);\n+------+\n| a |\n+------+\n| a |\n| A |\n| b |\n| B |\n+------+\n \nThe field is a BINARY(10), so padding of two \'\\0\'s are\ninserted, causing comparisons that don\'t take this into\naccount to fail:\n \nTRUNCATE bins;\n \nINSERT INTO bins VALUES(\'12345678\');\n \nSELECT a = \'12345678\', a = \'12345678\\0\\0\' from bins;\n \n+----------------+--------------------+\n| a = \'12345678\' | a = \'12345678\\0\\0\' |\n+----------------+--------------------+\n| 0 | 1 |\n+----------------+--------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/binary/','','https://mariadb.com/kb/en/library/binary/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (267,22,'BIT','Syntax\n------ \nBIT[(M)]\n \nDescription\n----------- \nA bit-field type. M indicates the number of bits per value,\nfrom 1 to\n64. The default is 1 if M is omitted.\n \nBit values can be inserted with b\'value\' notation, where\nvalue is the bit value in 0\'s and 1\'s.\n \nBit fields are automatically zero-padded from the left to\nthe full length of the bit, so for example in a BIT(4)\nfield, \'10\' is equivalent to \'0010\'.\n \nBits are returned as binary, so to display them, either add\n0, or use a function such as HEX, OCT or BIN to convert\nthem.\n \nExamples\n-------- \nCREATE TEMPORARY TABLE b ( b1 BIT(8) );\nINSERT INTO b VALUES\n(b\'11111111\'),(b\'01010101\'),(b\'1111111111111\');\nQuery OK, 3 rows affected, 1 warning (0.10 sec)\nRecords: 3 Duplicates: 0 Warnings: 1\n \nSHOW WARNINGS;\n+---------+------+---------------------------------------------+\n| Level | Code | Message |\n+---------+------+---------------------------------------------+\n| Warning | 1264 | Out of range value for column \'b1\' at\nrow 3 |\n+---------+------+---------------------------------------------+\n \nSELECT b1+0, HEX(b1), OCT(b1), BIN(b1) FROM b;\n+------+---------+---------+----------+\n| b1+0 | HEX(b1) | OCT(b1) | BIN(b1) |\n+------+---------+---------+----------+\n| 255 | FF | 377 | 11111111 |\n| 85 | 55 | 125 | 1010101 |\n| 255 | FF | 377 | 11111111 |\n+------+---------+---------+----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/bit/','','https://mariadb.com/kb/en/library/bit/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (268,22,'BLOB','Syntax\n------ \nBLOB[(M)]\n \nDescription\n----------- \nA BLOB column with a maximum length of 65,535 (216 - 1)\nbytes. Each\nBLOB value is stored using a two-byte length prefix that\nindicates the\nnumber of bytes in the value.\n \nAn optional length M can be given for this type. If this is\ndone,\nMariaDB creates the column as the smallest BLOB type large\nenough to\nhold values M bytes long.\n \nBLOBS can also be used to store dynamic columns.\n \nBefore MariaDB 10.2.1, BLOB and TEXT columns could not be\nassigned a DEFAULT value. This restriction was lifted in\nMariaDB 10.2.1.\n \nIndexing\n \nIn MariaDB 10.4, it is possible to set a Unique index on a\ncolumn that uses the BLOB data type. In previous releases\nthis was not possible, as the index would only guarantee the\nuniqueness of a fixed number of characters.\n \nOracle Mode\n \nIn Oracle mode from MariaDB 10.3, BLOB is a synonym for\nLONGBLOB.\n \n\n\nURL: https://mariadb.com/kb/en/library/blob/','','https://mariadb.com/kb/en/library/blob/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (269,22,'BLOB and TEXT Data Types','Description\n----------- \nA BLOB is a binary large object that can hold a variable\namount of\ndata. The four BLOB types are \nTINYBLOB,\nBLOB, \nMEDIUMBLOB, and\nLONGBLOB.\n \nThese differ only in the maximum length of the values they\ncan hold. \n \nThe TEXT types are \nTINYTEXT,\nTEXT,\nMEDIUMTEXT, and\nLONGTEXT.\nJSON (alias for LONGTEXT)\n \nThese correspond to the four BLOB types and have the same\nmaximum lengths and storage requirements.\n \nStarting from MariaDB 10.2.1, BLOB and TEXT columns can have\na DEFAULT value.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/blob-and-text-data-types/','','https://mariadb.com/kb/en/library/blob-and-text-data-types/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (270,22,'BOOLEAN','Syntax\n------ \nBOOL, BOOLEAN\n \nDescription\n----------- \nThese types are synonyms for TINYINT(1). \nA value of zero is considered false. Non-zero values are\nconsidered 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\nand 0,\nrespectively, as shown here:\n \nmysql> SELECT IF(0 = FALSE, \'true\', \'false\');\n \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 \nUNKNOWN is an alias for NULL.\n \nThe last two statements display the results shown because 2\nis equal\nto neither 1 nor 0.\n \n\n\nURL: https://mariadb.com/kb/en/library/boolean/','','https://mariadb.com/kb/en/library/boolean/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (271,22,'CHAR','This article covers the CHAR data type. See CHAR Function\nfor the function.\n \nSyntax\n------ \n[NATIONAL] CHAR[(M)] [CHARACTER SET charset_name] [COLLATE\ncollation_name]\n \nDescription\n----------- \nA fixed-length string that is always right-padded with\nspaces to the specified\nlength when stored. M represents the column length in\ncharacters. The range\nof M is 0 to 255. If M is omitted, the length is 1.\n \nCHAR(0) columns can contain 2 values: an empty string or\nNULL. Such columns cannot be part of an index. The CONNECT\nstorage engine does not support CHAR(0).\n \nNote: Trailing spaces are removed when CHAR values are\nretrieved\nunless the PAD_CHAR_TO_FULL_LENGTH SQL mode is enabled.\n \nBefore MariaDB 10.2, all collations were of type PADSPACE,\nmeaning that CHAR (as well as VARCHAR and TEXT) values are\ncompared without regard for trailing spaces. This does not\napply to the LIKE pattern-matching operator, which takes\ninto account trailing spaces.\n \nIf a unique index consists of a column where trailing pad\ncharacters are stripped or ignored, inserts into that column\nwhere values differ only by the number of trailing pad\ncharacters will result in a duplicate-key error.\n \nExamples\n-------- \nTrailing spaces:\n \nCREATE TABLE strtest (c CHAR(10));\nINSERT INTO strtest VALUES(\'Maria \');\n \nSELECT c=\'Maria\',c=\'Maria \' FROM strtest;\n \n+-----------+--------------+\n| c=\'Maria\' | c=\'Maria \' |\n+-----------+--------------+\n| 1 | 1 |\n+-----------+--------------+\n \nSELECT c LIKE \'Maria\',c LIKE \'Maria \' FROM strtest;\n \n+----------------+-------------------+\n| c LIKE \'Maria\' | c LIKE \'Maria \' |\n+----------------+-------------------+\n| 1 | 0 |\n+----------------+-------------------+\n \nNO PAD Collations\n \nNO PAD collations regard trailing spaces as normal\ncharacters. You can get a list of all NO PAD collations by\nquerying the Information Schema Collations table, for\nexample:\n \nSELECT collation_name FROM information_schema.collations \n WHERE collation_name LIKE \"%nopad%\";\n \n+------------------------------+\n| collation_name |\n+------------------------------+\n| big5_chinese_nopad_ci |\n| big5_nopad_bin |\n...\n \n\n\nURL: https://mariadb.com/kb/en/library/char/','','https://mariadb.com/kb/en/library/char/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (272,22,'CHAR BYTE','Description\n----------- \nThe CHAR BYTE data type is an alias for the \nBINARY data type. This is a\ncompatibility feature.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/char-byte/','','https://mariadb.com/kb/en/library/char-byte/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (273,22,'DATE','Syntax\n------ \nDATE\n \nDescription\n----------- \nA date. The supported range is \'1000-01-01\' to\n\'9999-12-31\'. MariaDB\ndisplays DATE values in \'YYYY-MM-DD\' format, but can be\nassigned dates in looser formats, including strings or\nnumbers, as long as they make sense. These include a short\nyear, YY-MM-DD, no delimiters, YYMMDD, or any other\nacceptable delimiter, for example YYYY/MM/DD. For details,\nsee date and time literals.\n \n\'0000-00-00\' is a permitted special value (zero-date),\nunless the NO_ZERO_DATE SQL_MODE is used. Also, individual\ncomponents of a date can be set to 0 (for example:\n\'2015-00-12\'), unless the NO_ZERO_IN_DATE SQL_MODE is\nused. In many cases, the result of en expression involving a\nzero-date, or a date with zero-parts, is NULL. If the\nALLOW_INVALID_DATES SQL_MODE is enabled, if the day part is\nin the range between 1 and 31, the date does not produce any\nerror, even for months that have less than 31 days.\n \nExamples\n-------- \nCREATE TABLE t1 (d DATE);\n \nINSERT INTO t1 VALUES (\"2010-01-12\"), (\"2011-2-28\"),\n(\'120314\'),(\'13*04*21\');\n \nSELECT * FROM t1;\n \n+------------+\n| d |\n+------------+\n| 2010-01-12 |\n| 2011-02-28 |\n| 2012-03-14 |\n| 2013-04-21 |\n+------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/date/','','https://mariadb.com/kb/en/library/date/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (274,22,'DATETIME','Syntax\n------ \nDATETIME [(microsecond precision)]\n \nDescription\n----------- \nA date and time combination. The supported range is\n\'1000-01-01 00:00:00.000000\' to \'9999-12-31\n23:59:59.999999\'.\nMariaDB displays DATETIME values in \'YYYY-MM-DD HH:MM:SS\'\nformat, but\nallows assignment of values to DATETIME columns using either\nstrings or\nnumbers. For details, see date and time literals.\n \nThe microsecond precision can be from 0-6. If not specified\n0 is used.\n \n\'0000-00-00\' is a permitted special value (zero-date),\nunless the NO_ZERO_DATE SQL_MODE is used. Also, individual\ncomponents of a date can be set to 0 (for example:\n\'2015-00-12\'), unless the NO_ZERO_IN_DATE SQL_MODE is\nused. In many cases, the result of en expression involving a\nzero-date, or a date with zero-parts, is NULL. If the\nALLOW_INVALID_DATES SQL_MODE is enabled, if the day part is\nin the range between 1 and 31, the date does not produce any\nerror, even for months that have less than 31 days.\n \nSince MariaDB 10.0.1, DATETIME columns also accept\nCURRENT_TIMESTAMP as the default value.\n \nMariaDB 10.1.2 introduced the --mysql56-temporal-format\noption, on by default, which allows MariaDB to store\nDATETMEs using the same low-level format MySQL 5.6 uses. For\nmore information, see Internal Format, below.\n \nFor storage requirements, see Data Type Storage\nRequirements.\n \nOracle Mode\n \nIn Oracle mode from MariaDB 10.3, DATE with a time portion\nis a synonym for DATETIME.\n \nInternal Format\n \nIn MariaDB 10.1.2 a new temporal format was introduced from\nMySQL 5.6 that alters how the TIME, DATETIME and TIMESTAMP\ncolumns operate at lower levels. These changes allow these\ntemporal data types to have fractional parts and negative\nvalues. You can disable this feature using the\nmysql56_temporal_format system variable.\n \nTables that include TIMESTAMP values that were created on an\nolder version of MariaDB or that were created while the\nmysql56_temporal_format system variable was disabled\ncontinue to store data using the older data type format.\n \nIn order to update table columns from the older format to\nthe newer format, execute an ALTER TABLE... MODIFY COLUMN\nstatement that changes the column to the *same* data type.\nThis change may be needed if you want to export the table\'s\ntablespace and import it onto a server that has\nmysql56_temporal_format=ON set (see MDEV-15225).\n \nFor instance, if you have a DATETIME column in your table: \n \nSHOW VARIABLES LIKE \'mysql56_temporal_format\';\n \n+-------------------------+-------+\n| Variable_name | Value |\n+-------------------------+-------+\n| mysql56_temporal_format | ON |\n+-------------------------+-------+\n \nALTER TABLE example_table MODIFY ts_col DATETIME;\n \nWhen MariaDB executes the ALTER TABLE statement, it converts\nthe data from the older temporal format to the newer one. \n \nIn the event that you have several tables and columns using\ntemporal data types that you want to switch over to the new\nformat, make sure the system variable is enabled, then\nperform a dump and restore using mysqldump. The columns\nusing relevant temporal data types are restored using the\nnew temporal format.\n \nExamples\n-------- \nCREATE TABLE t1 (d DATETIME);\n \nINSERT INTO t1 VALUES (\"2011-03-11\"), (\"2012-04-19\n13:08:22\"),\n (\"2013-07-18 13:44:22.123456\");\n \nSELECT * FROM t1;\n \n+---------------------+\n| d |\n+---------------------+\n| 2011-03-11 00:00:00 |\n| 2012-04-19 13:08:22 |\n| 2013-07-18 13:44:22 |\n+---------------------+\n \nCREATE TABLE t2 (d DATETIME(6));\n \nINSERT INTO t2 VALUES (\"2011-03-11\"), (\"2012-04-19\n13:08:22\"),\n (\"2013-07-18 13:44:22.123456\");\n \nSELECT * FROM t2;\n \n+----------------------------+\n| d |\n+----------------------------+\n| 2011-03-11 00:00:00.000000 |\n| 2012-04-19 13:08:22.000000 |\n| 2013-07-18 13:44:22.123456 |\n+----------------------------++\n \nStrings used in datetime context are automatically converted\nto datetime(6). If you want to have a datetime without\nseconds, you should use CONVERT(..,datetime).\n \nSELECT CONVERT(\'2007-11-30 10:30:19\',datetime);\n+-----------------------------------------+\n| CONVERT(\'2007-11-30 10:30:19\',datetime) |\n+-----------------------------------------+\n| 2007-11-30 10:30:19 |\n+-----------------------------------------+\n \nSELECT CONVERT(\'2007-11-30 10:30:19\',datetime(6));\n+--------------------------------------------+\n| CONVERT(\'2007-11-30 10:30:19\',datetime(6)) |\n+--------------------------------------------+\n| 2007-11-30 10:30:19.000000 |\n+--------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/datetime/','','https://mariadb.com/kb/en/library/datetime/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (275,22,'DECIMAL','Syntax\n------ \nDECIMAL[(M[,D])] [SIGNED | UNSIGNED | ZEROFILL]\n \nDescription\n----------- \nA packed \"exact\" fixed-point number. M is the total number\nof digits (the\nprecision) and D is the number of digits after the decimal\npoint (the\nscale). The decimal point and (for negative numbers) the\n\"-\" sign are not\ncounted in M. If D is 0, values have no decimal point or\nfractional\npart and on INSERT the value will be rounded to the nearest\nDECIMAL. The maximum number of digits (M) for DECIMAL is 65.\nThe maximum number of supported decimals (D) is 30 before\nMariadB 10.2.1 and 38 afterwards. If D is omitted, the\ndefault is 0. If M is omitted, the default is 10.\n \nUNSIGNED, if specified, disallows negative values.\n \nZEROFILL, if specified, pads the number with zeros, up to\nthe total number\nof digits specified by M.\n \nAll basic calculations (+, -, *, /) with DECIMAL columns are\ndone with\na precision of 65 digits.\n \nFor more details on the attributes, see Numeric Data Type\nOverview.\n \nOracle Mode\n \nIn Oracle mode from MariaDB 10.3, NUMBER is a synonym.\n \nExamples\n-------- \nCREATE TABLE t1 (d DECIMAL UNSIGNED ZEROFILL);\n \nINSERT INTO t1 VALUES (1),(2),(3),(4.0),(5.2),(5.7);\nQuery OK, 6 rows affected, 2 warnings (0.16 sec)\nRecords: 6 Duplicates: 0 Warnings: 2\n \nNote (Code 1265): Data truncated for column \'d\' at row 5\nNote (Code 1265): Data truncated for column \'d\' at row 6\n \nSELECT * FROM t1;\n \n+------------+\n| d |\n+------------+\n| 0000000001 |\n| 0000000002 |\n| 0000000003 |\n| 0000000004 |\n| 0000000005 |\n| 0000000006 |\n+------------+\n \nINSERT INTO t1 VALUES (-7);\nERROR 1264 (22003): Out of range value for column \'d\' at\nrow 1\n \n\n\nURL: https://mariadb.com/kb/en/library/decimal/','','https://mariadb.com/kb/en/library/decimal/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (276,22,'ENUM','Syntax\n------ \nENUM(\'value1\',\'value2\',...) [CHARACTER SET charset_name]\n[COLLATE collation_name]\n \nDescription\n----------- \nAn enumeration. A string object that can have only one\nvalue, chosen\nfrom the list of values \'value1\', \'value2\', ..., NULL or\nthe special \n\'\' error value. In theory, an ENUM column can have a\nmaximum of 65,535 distinct\nvalues; in practice, the real maximum depends on many\nfactors. ENUM values are represented internally as integers.\n \nTrailing spaces are automatically stripped from ENUM values\non table creation.\n \nENUMs require relatively little storage space compared to\nstrings, either one or two bytes depending on the number of\nenumeration values.\n \nNULL and empty values\n \nAn ENUM can also contain NULL and empty values. If the ENUM\ncolumn is declared to permit NULL values, NULL becomes a\nvalid value, as well as the default value (see below). If\nstrict SQL Mode is not enabled, and an invalid value is\ninserted into an ENUM, a special empty string, with an index\nvalue of zero (see Numeric index, below), is inserted, with\na warning. This may be confusing, because the empty string\nis also a possible value, and the only difference if that in\nthis case its index is not 0. Inserting will fail with an\nerror if strict mode is active.\n \nIf a DEFAULT clause is missing, the default value will be:\nNULL is the column is nullable;\notherwise, the first value in the enumaration.\n \nNumeric index\n \nENUM values are indexed numerically in the order they are\ndefined, and sorting will be performed in this numeric\norder. We suggest not using ENUM to store numerals, as there\nis little to no storage space benefit, and it is easy to\nconfuse the enum integer with the enum numeral value by\nleaving out the quotes.\n \nAn ENUM defined as ENUM(\'apple\',\'orange\',\'pear\') would\nhave the following index values:\n \nIndex | Value | \n \nNULL | NULL | \n \n0 | \'\' | \n \n1 | \'apple\' | \n \n2 | \'orange\' | \n \n3 | \'pear\' | \n \nExamples\n-------- \nCREATE TABLE fruits (\n id INT NOT NULL auto_increment PRIMARY KEY,\n fruit ENUM(\'apple\',\'orange\',\'pear\'),\n bushels INT);\n \nDESCRIBE fruits;\n \n+---------+-------------------------------+------+-----+---------+----------------+\n| Field | Type | Null | Key | Default | Extra |\n+---------+-------------------------------+------+-----+---------+----------------+\n| id | int(11) | NO | PRI | NULL | auto_increment |\n| fruit | enum(\'apple\',\'orange\',\'pear\') | YES | | NULL\n| |\n| bushels | int(11) | YES | | NULL | |\n+---------+-------------------------------+------+-----+---------+----------------+\n \nINSERT INTO fruits\n (fruit,bushels) VALUES\n (\'pear\',20),\n (\'apple\',100),\n (\'orange\',25);\n \nINSERT INTO fruits\n (fruit,bushels) VALUES\n (\'avocado\',10);\nERROR 1265 (01000): Data truncated for column \'fruit\' at\nrow 1\n \nSELECT * FROM fruits;\n \n+----+--------+---------+\n| id | fruit | bushels |\n+----+--------+---------+\n| 1 | pear | 20 |\n| 2 | apple | 100 |\n| 3 | orange | 25 |\n+----+--------+---------+\n \nSelecting by numeric index:\n \nSELECT * FROM fruits WHERE fruit=2;\n \n+----+--------+---------+\n| id | fruit | bushels |\n+----+--------+---------+\n| 3 | orange | 25 |\n+----+--------+---------+\n \nSorting is according to the index value:\n \nCREATE TABLE enums (a ENUM(\'2\',\'1\'));\n \nINSERT INTO enums VALUES (\'1\'),(\'2\');\n \nSELECT * FROM enums ORDER BY a ASC;\n \n+------+\n| a |\n+------+\n| 2 |\n| 1 |\n+------+\n \nIt\'s easy to get confused between returning the enum\ninteger with the stored value, so we don\'t suggest using\nENUM to store numerals. The first example returns the 1st\nindexed field (\'2\' has an index value of 1, as it\'s\ndefined first), while the second example returns the string\nvalue \'1\'.\n \nSELECT * FROM enums WHERE a=1;\n \n+------+\n| a |\n+------+\n| 2 |\n+------+\n \nSELECT * FROM enums WHERE a=\'1\';\n \n+------+\n| a |\n+------+\n| 1 |\n+------+\n \n\n\nURL: https://mariadb.com/kb/en/library/enum/','','https://mariadb.com/kb/en/library/enum/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (277,22,'DOUBLE','Syntax\n------ \nDOUBLE[(M,D)] [SIGNED | UNSIGNED | ZEROFILL]\nDOUBLE PRECISION[(M,D)] [SIGNED | UNSIGNED | ZEROFILL]\nREAL[(M,D)] [SIGNED | UNSIGNED | ZEROFILL]\n \nDescription\n----------- \nA normal-size (double-precision) floating-point number (see\nFLOAT for a single-precision floating-point number).\n \nAllowable values are:\n-1.7976931348623157E+308 to -2.2250738585072014E-308\n0\n2.2250738585072014E-308 to 1.7976931348623157E+308\n \nThese are the theoretical limits, based on the IEEE\nstandard. The actual range\nmight be slightly smaller depending on your hardware or\noperating system.\n \nM is the total number of digits and D is the number of\ndigits\nfollowing the decimal point. If M and D are omitted, values\nare stored\nto the limits allowed by the hardware. A double-precision\nfloating-point number is accurate to approximately 15\ndecimal places.\n \nUNSIGNED, if specified, disallows negative values.\n \nZEROFILL, if specified, pads the number with zeros, up to\nthe total number\nof digits specified by M.\n \nREAL and DOUBLE PRECISION are synonyms, unless the\nREAL_AS_FLOAT SQL mode is enabled, in which case REAL is a\nsynonym for FLOAT rather than DOUBLE.\n \nSee Floating Point Accuracy for issues when using\nfloating-point numbers.\n \nFor more details on the attributes, see Numeric Data Type\nOverview.\n \nExamples\n-------- \nCREATE TABLE t1 (d DOUBLE(5,0) zerofill);\n \nINSERT INTO t1 VALUES (1),(2),(3),(4);\n \nSELECT * FROM t1;\n \n+-------+\n| d |\n+-------+\n| 00001 |\n| 00002 |\n| 00003 |\n| 00004 |\n+-------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/double/','','https://mariadb.com/kb/en/library/double/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (278,22,'FLOAT','Syntax\n------ \nFLOAT[(M,D)] [SIGNED | UNSIGNED | ZEROFILL]\n \nDescription\n----------- \nA small (single-precision) floating-point number (see DOUBLE\nfor a regular-size floating point number). Allowable values\nare:\n-3.402823466E+38 to -1.175494351E-38\n0\n1.175494351E-38 to 3.402823466E+38. \n \nThese are the theoretical limits, based on the IEEE \nstandard. The actual range might be slightly smaller\ndepending on your\nhardware or operating system.\n \nM is the total number of digits and D is the number of\ndigits\nfollowing the decimal point. If M and D are omitted, values\nare stored\nto the limits allowed by the hardware. A single-precision\nfloating-point number is accurate to approximately 7 decimal\nplaces.\n \nUNSIGNED, if specified, disallows negative values.\n \nUsing FLOAT might give you some unexpected problems because\nall\ncalculations in MariaDB are done with double precision. See\nFloating Point Accuracy.\n \nFor more details on the attributes, see Numeric Data Type\nOverview.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/float/','','https://mariadb.com/kb/en/library/float/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (279,22,'Geometry Types','Description\n----------- \nMariaDB provides a standard way of creating spatial columns\nfor geometry types,\nfor example, with CREATE TABLE or ALTER TABLE.\nCurrently, spatial columns are supported for MyISAM, InnoDB,\nNDB, and ARCHIVE\ntables. See also SPATIAL INDEX.\n \nThe basic geometry type is GEOMETRY. But the type can be\nmore specific. The following types are supported:\n \nGeometry Types | \n \nPOINT | \n \nLINESTRING | \n \nPOLYGON | \n \nMULTIPOINT | \n \nMULTILINESTRING | \n \nMULTIPOLYGON | \n \nGEOMETRYCOLLECTION | \n \nGEOMETRY | \n \nExamples\n-------- \nNote: For clarity, only one type is listed per table in the\nexamples below, but a table\nrow can contain multiple types. For example:\n \nCREATE TABLE object (shapeA POLYGON, shapeB LINESTRING);\n \nPOINT\n \nCREATE TABLE gis_point (g POINT);\nSHOW FIELDS FROM gis_point;\n \nINSERT INTO gis_point VALUES\n (PointFromText(\'POINT(10 10)\')),\n (PointFromText(\'POINT(20 10)\')),\n (PointFromText(\'POINT(20 20)\')),\n (PointFromWKB(AsWKB(PointFromText(\'POINT(10 20)\'))));\n \nLINESTRING\n \nCREATE TABLE gis_line (g LINESTRING);\nSHOW FIELDS FROM gis_line;\n \nINSERT INTO gis_line VALUES\n (LineFromText(\'LINESTRING(0 0,0 10,10 0)\')),\n (LineStringFromText(\'LINESTRING(10 10,20 10,20 20,10 20,10\n10)\')),\n (LineStringFromWKB(AsWKB(LineString(Point(10, 10),\nPoint(40, 10)))));\n \nPOLYGON\n \nCREATE TABLE gis_polygon (g POLYGON);\nSHOW FIELDS FROM gis_polygon;\n \nINSERT INTO gis_polygon VALUES\n (PolygonFromText(\'POLYGON((10 10,20 10,20 20,10 20,10\n10))\')),\n (PolyFromText(\'POLYGON((0 0,50 0,50 50,0 50,0 0), (10\n10,20 10,20 20,10 20,10 10))\')),\n (PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0),\nPoint(30, 0), Point(30, 30), Point(0, 0))))));\n \nMULTIPOINT\n \nCREATE TABLE gis_multi_point (g MULTIPOINT);\nSHOW FIELDS FROM gis_multi_point;\n \nINSERT INTO gis_multi_point VALUES\n (MultiPointFromText(\'MULTIPOINT(0 0,10 10,10 20,20\n20)\')),\n (MPointFromText(\'MULTIPOINT(1 1,11 11,11 21,21 21)\')),\n (MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4,\n10)))));\n \nMULTILINESTRING\n \nCREATE TABLE gis_multi_line (g MULTILINESTRING);\nSHOW FIELDS FROM gis_multi_line;\n \nINSERT INTO gis_multi_line VALUES\n (MultiLineStringFromText(\'MULTILINESTRING((10 48,10 21,10\n0),(16 0,16 23,16 48))\')),\n (MLineFromText(\'MULTILINESTRING((10 48,10 21,10 0))\')),\n (MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2),\nPoint(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21,\n7))))));\n \nMULTIPOLYGON\n \nCREATE TABLE gis_multi_polygon (g MULTIPOLYGON);\nSHOW FIELDS FROM gis_multi_polygon;\n \nINSERT INTO gis_multi_polygon VALUES\n (MultiPolygonFromText(\'MULTIPOLYGON(((28 26,28 0,84 0,84\n42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67\n13,59 13,59 18)))\')),\n (MPolyFromText(\'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28\n26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59\n13,59 18)))\')),\n (MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0,\n3), Point(3, 3), Point(3, 0), Point(0, 3)))))));\n \nGEOMETRYCOLLECTION\n \nCREATE TABLE gis_geometrycollection (g GEOMETRYCOLLECTION);\nSHOW FIELDS FROM gis_geometrycollection;\n \nINSERT INTO gis_geometrycollection VALUES\n (GeomCollFromText(\'GEOMETRYCOLLECTION(POINT(0 0),\nLINESTRING(0 0,10 10))\')),\n (GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6),\nLineString(Point(3, 6), Point(7, 9)))))),\n (GeomFromText(\'GeometryCollection()\')),\n (GeomFromText(\'GeometryCollection EMPTY\'));\n \nGEOMETRY\n \nCREATE TABLE gis_geometry (g GEOMETRY);\nSHOW FIELDS FROM gis_geometry;\n \nINSERT into gis_geometry SELECT * FROM gis_point;\n \nINSERT into gis_geometry SELECT * FROM gis_line;\n \nINSERT into gis_geometry SELECT * FROM gis_polygon;\n \nINSERT into gis_geometry SELECT * FROM gis_multi_point;\n \nINSERT into gis_geometry SELECT * FROM gis_multi_line;\n \nINSERT into gis_geometry SELECT * FROM gis_multi_polygon;\n \nINSERT into gis_geometry SELECT * FROM\ngis_geometrycollection;\n \n\n \n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/geometry-types/','','https://mariadb.com/kb/en/library/geometry-types/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (280,22,'JSON Data Type','The JSON alias was added in MariaDB 10.2.7. This was done to\nmake it possible to use JSON columns in statement based\nreplication from MySQL to MariaDB and to make it possible\nfor MariaDB to read mysqldumps from MySQL.\n \nJSON is an alias for LONGTEXT introduced for compatibility\nreasons with MySQL\'s JSON data type. MariaDB implements\nthis as a LONGTEXT rather, as the JSON data type contradicts\nthe SQL standard, and MariaDB\'s benchmarks indicate that\nperformance is at least equivalent.\n \nIn order to ensure that a a valid json document is inserted,\nthe JSON_VALID function can be used as a CHECK constraint.\nThis constraint is automatically included for types using\nthe JSON alias from MariaDB 10.4.3.\n \nExamples\n-------- \nCREATE TABLE t (j JSON);\n \nDESC t;\n+-------+----------+------+-----+---------+-------+\n| Field | Type | Null | Key | Default | Extra |\n+-------+----------+------+-----+---------+-------+\n| j | longtext | YES | | NULL | |\n+-------+----------+------+-----+---------+-------+\n \nWith validation:\n \nCREATE TABLE t2 (\n j JSON \n CHECK (JSON_VALID(j))\n);\n \nINSERT INTO t2 VALUES (\'invalid\');\nERROR 4025 (23000): CONSTRAINT `j` failed for `test`.`t2`\n \nINSERT INTO t2 VALUES (\'{\"id\": 1, \"name\":\n\"Monty\"}\');\nQuery OK, 1 row affected (0.13 sec)\n \nReplicating JSON Data Between MySQL and MariaDB\n \nThe JSON type in MySQL stores the JSON object in a compact\nform, not as LONGTEXT as in MariaDB.\nThis means that row based replication will not work for JSON\ntypes from MySQL to MariaDB.\n \nThere are a a few different ways to solve this:\nUse statement based replication.\nChange the JSON column to type TEXT in MySQL\n \nConverting a MySQL TABLE with JSON Fields to MariaDB\n \nMariaDB can\'t directly access MySQL JSON format.\n \nThere is a a few different ways to move the table to\nMariaDB:\nChange the JSON column to type TEXT in MySQL. After this\nMariaDB can directly use the table without any need for a\ndump and restore.\nUse mysqldump to copy the table.\n \nDifferences Between MySQL JSON Strings and MariaDB JSON\nStrings\n \nIn MySQL, JSON is an object and is compared according to\njson values. In MariaDB JSON strings are normal strings and\ncompared as strings. One exception is when using\nJSON_EXTRACT() in which case strings are unescaped before\ncomparison.\n \n\n\nURL: https://mariadb.com/kb/en/library/json-data-type/','','https://mariadb.com/kb/en/library/json-data-type/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (281,22,'LONGBLOB','Syntax\n------ \nLONGBLOB\n \nDescription\n----------- \nA BLOB column with a \nmaximum length of 4,294,967,295 bytes or 4GB (232 - 1). The\neffective maximum length of LONGBLOB columns depends on the\nconfigured maximum packet size in the client/server protocol\nand\navailable memory. Each LONGBLOB value is stored using a\nfour-byte\nlength prefix that indicates the number of bytes in the\nvalue.\n \nOracle Mode\n \nIn Oracle mode from MariaDB 10.3, BLOB is a synonym for\nLONGBLOB.\n \n\n\nURL: https://mariadb.com/kb/en/library/longblob/','','https://mariadb.com/kb/en/library/longblob/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (282,22,'LONGTEXT','Syntax\n------ \nLONGTEXT [CHARACTER SET charset_name] [COLLATE\ncollation_name]\n \nDescription\n----------- \nA TEXT column with a maximum length of 4,294,967,295 or 4GB\n(232 - 1) characters. The effective maximum length is less\nif the value contains multi-byte characters. The effective\nmaximum length of LONGTEXT columns also depends on the\nconfigured maximum packet size in the client/server protocol\nand available memory. Each LONGTEXT value is stored using a\nfour-byte length prefix that indicates the number of bytes\nin the value.\n \nFrom MariaDB 10.2.7, JSON is an alias for LONGTEXT. See JSON\nData Type for details.\n \nOracle Mode\n \nIn Oracle mode from MariaDB 10.3, CLOB is a synonym for\nLONGTEXT.\n \n\n\nURL: https://mariadb.com/kb/en/library/longtext/','','https://mariadb.com/kb/en/library/longtext/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (283,22,'MEDIUMBLOB','Syntax\n------ \nMEDIUMBLOB\n \nDescription\n----------- \nA BLOB column with a maximum\nlength of 16,777,215 (224 - 1) bytes.\nEach MEDIUMBLOB value is stored using a three-byte length\nprefix that\nindicates the number of bytes in the value. \n \n\n\nURL: https://mariadb.com/kb/en/library/mediumblob/','','https://mariadb.com/kb/en/library/mediumblob/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (284,22,'MEDIUMINT','Syntax\n------ \nMEDIUMINT[(M)] [SIGNED | UNSIGNED | ZEROFILL]\n \nDescription\n----------- \nA medium-sized integer. The signed range is -8388608 to\n8388607. The\nunsigned range is 0 to 16777215.\n \nZEROFILL pads the integer with zeroes and assumes UNSIGNED\n(even if UNSIGNED is not specified).\n \nFor details on the attributes, see Numeric Data Type\nOverview.\n \nExamples\n-------- \nCREATE TABLE mediumints (a MEDIUMINT,b MEDIUMINT UNSIGNED,c\nMEDIUMINT ZEROFILL);\n \nDESCRIBE mediumints;\n+-------+--------------------------------+------+-----+---------+-------+\n| Field | Type | Null | Key | Default | Extra |\n+-------+--------------------------------+------+-----+---------+-------+\n| a | mediumint(9) | YES | | NULL | |\n| b | mediumint(8) unsigned | YES | | NULL | |\n| c | mediumint(8) unsigned zerofill | YES | | NULL | |\n+-------+--------------------------------+------+-----+---------+-------+\n \nINSERT INTO mediumints VALUES (-10,-10,-10);\nQuery OK, 1 row affected, 2 warnings (0.05 sec)\nWarning (Code 1264): Out of range value for column \'b\' at\nrow 1\nWarning (Code 1264): Out of range value for column \'c\' at\nrow 1\n \nINSERT INTO mediumints VALUES (-10,10,-10);\nQuery OK, 1 row affected, 1 warning (0.08 sec)\nWarning (Code 1264): Out of range value for column \'c\' at\nrow 1\n \nINSERT INTO mediumints VALUES (-10,10,10);\n \nINSERT INTO mediumints VALUES (8388608,8388608,8388608);\nQuery OK, 1 row affected, 1 warning (0.05 sec)\nWarning (Code 1264): Out of range value for column \'a\' at\nrow 1\n \nINSERT INTO mediumints VALUES (8388607,8388608,8388608);\n \nSELECT * FROM mediumints;\n+---------+---------+----------+\n| a | b | c |\n+---------+---------+----------+\n| -10 | 0 | 00000000 |\n| -10 | 0 | 00000000 |\n| -10 | 10 | 00000000 |\n| -10 | 10 | 00000010 |\n| 8388607 | 8388608 | 08388608 |\n| 8388607 | 8388608 | 08388608 |\n+---------+---------+----------+\n \n\n\nURL: https://mariadb.com/kb/en/library/mediumint/','','https://mariadb.com/kb/en/library/mediumint/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (285,22,'MEDIUMTEXT','Syntax\n------ \nMEDIUMTEXT [CHARACTER SET charset_name] [COLLATE\ncollation_name]\n \nDescription\n----------- \nA TEXT column with a \nmaximum length of 16,777,215 (224 - 1)\ncharacters. The effective maximum length is less if the\nvalue\ncontains multi-byte characters. Each MEDIUMTEXT value is\nstored using\na three-byte length prefix that indicates the number of\nbytes in the\nvalue.\n \n\n\nURL: https://mariadb.com/kb/en/library/mediumtext/','','https://mariadb.com/kb/en/library/mediumtext/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (286,22,'Numeric Data Type Overview','There are a number of numeric data types:\nTINYINT\nBOOLEAN - Synonym for TINYINT(1)\nSMALLINT\nMEDIUMINT\nINT, INTEGER\nBIGINT\nDECIMAL, DEC, NUMERIC, FIXED\nFLOAT\nDOUBLE, DOUBLE PRECISION, REAL\nBIT\n \nSee the specific articles for detailed information on each.\n \nSIGNED, UNSIGNED and ZEROFILL\n \nMost numeric types can be defined as SIGNED, UNSIGNED or\nZEROFILL, for example:\n \nTINYINT[(M)] [SIGNED | UNSIGNED | ZEROFILL]\n \nIf SIGNED, or no attribute, is specified, a portion of the\nnumeric type will be reserved for the sign (plus or minus).\nFor example, a TINYINT SIGNED can range from -128 to 127. \n \nIf UNSIGNED is specified, no portion of the numeric type is\nreserved for the sign, so for integer types range can be\nlarger. For example, a TINYINT UNSIGNED can range from 0 to\n255. Floating point and fixed-point types also can be\nUNSIGNED, but this only prevents negative values from being\nstored and doesn\'t alter the range. \n \nIf ZEROFILL is specified, the column will be set to UNSIGNED\nand the spaces used by default to pad the field are replaced\nwith zeros. ZEROFILL is ignored in expressions or as part of\na UNION. ZEROFILL is a non-standard MySQL and MariaDB\nenhancement.\n \nNote that although the preferred syntax indicates that the\nattributes are exclusive, more than one attribute can be\nspecified.\n \nUntil MariaDB 10.2.7 (MDEV-8659), any combination of the\nattributes could be used in any order, with duplicates. In\nthis case:\nthe presence of ZEROFILL makes the column UNSIGNED ZEROFILL.\nthe presence of UNSIGNED makes the column UNSIGNED.\n \nFrom MariaDB 10.2.8, only the following combinations are\nsupported:\nSIGNED\nUNSIGNED\nZEROFILL\nUNSIGNED ZEROFILL\nZEROFILL UNSIGNED\n \nThe latter two should be replaced with simply ZEROFILL, but\nare still accepted by the parser.\n \nExamples\n-------- \nCREATE TABLE zf (\n i1 TINYINT SIGNED,\n i2 TINYINT UNSIGNED,\n i3 TINYINT ZEROFILL\n);\n \nINSERT INTO zf VALUES (2,2,2);\n \nSELECT * FROM zf;\n \n+------+------+------+\n| i1 | i2 | i3 |\n+------+------+------+\n| 2 | 2 | 002 |\n+------+------+------+\n \nRange\n \nWhen attempting to add a value that is out of the valid\nrange for the numeric type, MariaDB will react depending on\nthe strict SQL_MODE setting.\n \nIf strict_mode has been set (the default from MariaDB\n10.2.4), MariaDB will return an error.\n \nIf strict_mode has not been set (the default until MariaDB\n10.2.3), MariaDB will adjust the number to fit in the field,\nreturning a warning.\n \nExamples\n-------- \nWith strict_mode set:\n \nSHOW VARIABLES LIKE \'sql_mode\';\n \n+---------------+-------------------------------------------------------------------------------------------+\n| Variable_name | Value |\n+---------------+-------------------------------------------------------------------------------------------+\n| sql_mode |\nSTRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION\n|\n+---------------+-------------------------------------------------------------------------------------------+\n \nCREATE TABLE ranges (i1 TINYINT, i2 SMALLINT, i3 TINYINT\nUNSIGNED);\n \nINSERT INTO ranges VALUES (257,257,257);\nERROR 1264 (22003): Out of range value for column \'i1\' at\nrow 1\n \nSELECT * FROM ranges;\n \nEmpty set (0.10 sec)\n \nWith strict_mode unset:\n \nSHOW VARIABLES LIKE \'sql_mode%\';\n \n+---------------+-------+\n| Variable_name | Value |\n+---------------+-------+\n| sql_mode | |\n+---------------+-------+\n \nCREATE TABLE ranges (i1 TINYINT, i2 SMALLINT, i3 TINYINT\nUNSIGNED);\n \nINSERT INTO ranges VALUES (257,257,257);\nQuery OK, 1 row affected, 2 warnings (0.00 sec)\n \nSHOW WARNINGS;\n \n+---------+------+---------------------------------------------+\n| Level | Code | Message |\n+---------+------+---------------------------------------------+\n| Warning | 1264 | Out of range value for column \'i1\' at\nrow 1 |\n| Warning | 1264 | Out of range value for column \'i3\' at\nrow 1 |\n+---------+------+---------------------------------------------+\n2 rows in set (0.00 sec)\n \nSELECT * FROM ranges;\n \n+------+------+------+\n| i1 | i2 | i3 |\n+------+------+------+\n| 127 | 257 | 255 |\n+------+------+------+\n \nAuto_increment\n \nThe AUTO_INCREMENT attribute can be used to generate a\nunique identity for new rows. For more details, see\nauto_increment.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/numeric-data-type-overview/','','https://mariadb.com/kb/en/library/numeric-data-type-overview/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (287,22,'ROW','The ROW data type was introduced in MariaDB 10.3.0.\n \nSyntax\n------ \nROW ( [{, }... ])\n \nDescription\n----------- \nROW is a data type for stored procedure variables.\n \nFeatures\n \nROW fields as normal variables\n \nROW fields (members) act as normal variables, and are able\nto appear in all\nquery parts where a stored procedure variable is allowed:\nAssignment is using the := operator and the SET command:\n \na.x:= 10;\n \na.x:= b.x;\n \nSET a.x= 10, a.y=20, a.z= b.z;\n \nPassing to functions and operators:\n \nSELECT f1(rec.a), rec.a\n\nURL: https://mariadb.com/kb/en/library/row/','','https://mariadb.com/kb/en/library/row/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (288,22,'SET Data Type','Syntax\n------ \nSET(\'value1\',\'value2\',...) [CHARACTER SET charset_name]\n[COLLATE collation_name]\n \nDescription\n----------- \nA set. A string object that can have zero or more values,\neach of\nwhich must be chosen from the list of values \'value1\',\n\'value2\', ... A\nSET column can have a maximum of 64 members. SET values are\nrepresented internally as integers.\n \n\n\nURL: https://mariadb.com/kb/en/library/set-data-type/','','https://mariadb.com/kb/en/library/set-data-type/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (289,22,'SMALLINT','Syntax\n------ \nSMALLINT[(M)] [SIGNED | UNSIGNED | ZEROFILL]\n \nDescription\n----------- \nA small integer. The signed range is -32768 to 32767. The\nunsigned range is 0 to 65535.\n \nIf a column has been set to ZEROFILL, all values will be\nprepended by zeros so that the SMALLINT value contains a\nnumber of M digits.\n \nNote: If the ZEROFILL attribute has been specified, the\ncolumn will automatically become UNSIGNED.\n \nFor more details on the attributes, see Numeric Data Type\nOverview.\n \nExamples\n-------- \nCREATE TABLE smallints (a SMALLINT,b SMALLINT UNSIGNED,c\nSMALLINT ZEROFILL);\n \nINSERT INTO smallints VALUES (-10,-10,-10);\nQuery OK, 1 row affected, 2 warnings (0.09 sec)\nWarning (Code 1264): Out of range value for column \'b\' at\nrow 1\nWarning (Code 1264): Out of range value for column \'c\' at\nrow 1\n \nINSERT INTO smallints VALUES (-10,10,-10);\nQuery OK, 1 row affected, 1 warning (0.08 sec)\nWarning (Code 1264): Out of range value for column \'c\' at\nrow 1\n \nINSERT INTO smallints VALUES (-10,10,10);\n \nINSERT INTO smallints VALUES (32768,32768,32768);\nQuery OK, 1 row affected, 1 warning (0.04 sec)\nWarning (Code 1264): Out of range value for column \'a\' at\nrow 1\n \nINSERT INTO smallints VALUES (32767,32768,32768);\n \nSELECT * FROM smallints;\n+-------+-------+-------+\n| a | b | c |\n+-------+-------+-------+\n| -10 | 0 | 00000 |\n| -10 | 10 | 00000 |\n| -10 | 10 | 00010 |\n| 32767 | 32768 | 32768 |\n| 32767 | 32768 | 32768 |\n+-------+-------+-------+\n \n\n\nURL: https://mariadb.com/kb/en/library/smallint/','','https://mariadb.com/kb/en/library/smallint/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (290,22,'String Literals','Strings are sequences of characters and are enclosed with\nquotes.\n \nThe syntax is:\n \n[_charset_name]\'string\' [COLLATE collation_name]\n \nFor example:\n \n\'The MariaDB Foundation\'\n_utf8 \'Foundation\' COLLATE utf8_unicode_ci;\n \nStrings can either be enclosed in single quotes or in double\nquotes (the same character must be used to both open and\nclose the string).\n \nThe ANSI SQL-standard does not permit double quotes for\nenclosing strings, and although MariaDB does by default, if\nthe MariaDB server has enabled the ANSI_QUOTES_SQL SQL_MODE,\ndouble quotes will be treated as being used for identifiers\ninstead of strings.\n \nStrings that are next to each other are automatically\nconcatenated. For example:\n \n\'The \' \'MariaDB \' \'Foundation\'\n \nand\n \n\'The MariaDB Foundation\'\n \nare equivalent.\n \nThe \\ (backslash character) is used to escape characters.\nFor example:\n \n\'MariaDB\'s new features\'\n \nis not a valid string because of the single quote in the\nmiddle of the string, which is treated as if it closes the\nstring, but is actually meant as part of the string, an\napostrophe. The backslash character helps in situations like\nthis:\n \n\'MariaDB\\\'s new features\'\n \nis now a valid string, and if displayed, will appear without\nthe backslash.\n \nSELECT \'MariaDB\\\'s new features\';\n+------------------------+\n| MariaDB\'s new features |\n+------------------------+\n| MariaDB\'s new features |\n+------------------------+\n \nAnother way to escape the quoting character is repeating it\ntwice:\n \nSELECT \'I\'\'m here\', \"\"\"Double\"\"\";\n+----------+----------+\n| I\'m here | \"Double\" |\n+----------+----------+\n| I\'m here | \"Double\" |\n+----------+----------+\n \nEscape sequences\n \nThere are other escape sequences also. Here is a full list:\n \nEscape sequence | Character | \n \n\\0 | ASCII NUL (0x00). | \n \n\\\' | Single quote (“\'â€). | \n \n\\\" | Double quote (“\"â€). | \n \n\\b | Backspace. | \n \n\\n | Newline, or linefeed,. | \n \n\\r | Carriage return. | \n \n\\t | Tab. | \n \n\\Z | ASCII 26 (Control+Z). See note following the table. | \n \n\\\\ | Backslash (“\\â€). | \n \n\\% | “%†character. See note following the table. | \n \n\\_ | A “_†character. See note following the table. | \n \nEscaping the % and _ characters can be necessary when using\nthe LIKE operator, which treats them as special characters.\n \nThe ASCII 26 character (\\Z) needs to be escaped when\nincluded in a batch file which needs to be executed in\nWindows. The reason is that ASCII 26, in Windows, is the end\nof file (EOF).\n \nBackslash (\\), if not used as an escape character, must\nalways be escaped. When followed by a character that is not\nin the above table, backslashes will simply be ignored.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/string-literals/','','https://mariadb.com/kb/en/library/string-literals/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (291,22,'TEXT','Syntax\n------ \nTEXT[(M)] [CHARACTER SET charset_name] [COLLATE\ncollation_name]\n \nDescription\n----------- \nA TEXT column with a maximum length of 65,535 (216 - 1)\ncharacters. The effective maximum length is less if the\nvalue contains\nmulti-byte characters. Each TEXT value is stored using a\ntwo-byte length\nprefix that indicates the number of bytes in the value. If\nyou need a bigger storage, consider using MEDIUMTEXT\ninstead.\n \nAn optional length M can be given for this type. If this is\ndone, MariaDB\ncreates the column as the smallest TEXT type large enough to\nhold values\nM characters long.\n \nBefore MariaDB 10.2, all MariaDB collations were of type\nPADSPACE, meaning that TEXT (as well as VARCHAR and CHAR\nvalues) are compared without regard for trailing spaces.\nThis does not apply to the LIKE pattern-matching operator,\nwhich takes into account trailing spaces.\n \nBefore MariaDB 10.2.1, BLOB and TEXT columns could not be\nassigned a DEFAULT value. This restriction was lifted in\nMariaDB 10.2.1.\n \nExamples\n-------- \nTrailing spaces:\n \nCREATE TABLE strtest (d TEXT(10));\nINSERT INTO strtest VALUES(\'Maria \');\n \nSELECT d=\'Maria\',d=\'Maria \' FROM strtest;\n+-----------+--------------+\n| d=\'Maria\' | d=\'Maria \' |\n+-----------+--------------+\n| 1 | 1 |\n+-----------+--------------+\n \nSELECT d LIKE \'Maria\',d LIKE \'Maria \' FROM strtest;\n+----------------+-------------------+\n| d LIKE \'Maria\' | d LIKE \'Maria \' |\n+----------------+-------------------+\n| 0 | 1 |\n+----------------+-------------------+\n \nDifference between VARCHAR and TEXT\n \nVARCHAR columns can be fully indexed. TEXT columns can only\nbe indexed over a specified length.\nUsing TEXT or BLOB in a SELECT query that uses temporary\ntables for storing intermediate results will force the\ntemporary table to be disk based (using the Aria storage\nengine instead of the memory storage engine, which is a bit\nslower. This is not that bad as the Aria storage engine\ncaches the rows in memory. To get the benefit of this, one\nshould ensure that the aria_pagecache_buffer_size variable\nis big enough to hold most of the row and index data for\ntemporary tables.\n \nFor Storage Engine Developers\n \nInternally the full length of the VARCHAR column is\nallocated inside each TABLE objects record[] structure. As\nthere are three such buffers, each open table will allocate\n3 times max-length-to-store-varchar bytes of memory.\nTEXT and BLOB columns are stored with a pointer (4 or 8\nbytes) + a 1-4 bytes length. The TEXT data is only stored\nonce. This means that internally TEXT uses less memory for\neach open table but instead has the additional overhead that\neach TEXT object needs to be allocated and freed for each\nrow access (with some caching in between).\n \n\n\nURL: https://mariadb.com/kb/en/library/text/','','https://mariadb.com/kb/en/library/text/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (292,22,'TIME','Syntax\n------ \nTIME [()]\n \nDescription\n----------- \nA time. The range is \'-838:59:59.999999\' to\n\'838:59:59.999999\'. Microsecond precision can be from 0-6;\nif not specified 0 is used. Microseconds have been available\nsince MariaDB 5.3. \n \nMariaDB displays TIME values in \'HH:MM:SS.ssssss\' format,\nbut allows assignment of times in looser formats, including\n\'D HH:MM:SS\', \'HH:MM:SS\', \'HH:MM\', \'D HH:MM\', \'D\nHH\', \'SS\', or \'HHMMSS\', as well as permitting dropping\nof any leading zeros when a delimiter is provided, for\nexample \'3:9:10\'. For details, see date and time literals.\n \nMariaDB 10.1.2 introduced the --mysql56-temporal-format\noption, on by default, which allows MariaDB to store TIMEs\nusing the same low-level format MySQL 5.6 uses.\n \nInternal Format\n \nIn MariaDB 10.1.2 a new temporal format was introduced from\nMySQL 5.6 that alters how the TIME, DATETIME and TIMESTAMP\ncolumns operate at lower levels. These changes allow these\ntemporal data types to have fractional parts and negative\nvalues. You can disable this feature using the\nmysql56_temporal_format system variable.\n \nTables that include TIMESTAMP values that were created on an\nolder version of MariaDB or that were created while the\nmysql56_temporal_format system variable was disabled\ncontinue to store data using the older data type format.\n \nIn order to update table columns from the older format to\nthe newer format, execute an ALTER TABLE... MODIFY COLUMN\nstatement that changes the column to the *same* data type.\nThis change may be needed if you want to export the table\'s\ntablespace and import it onto a server that has\nmysql56_temporal_format=ON set (see MDEV-15225).\n \nFor instance, if you have a TIME column in your table: \n \nSHOW VARIABLES LIKE \'mysql56_temporal_format\';\n \n+-------------------------+-------+\n| Variable_name | Value |\n+-------------------------+-------+\n| mysql56_temporal_format | ON |\n+-------------------------+-------+\n \nALTER TABLE example_table MODIFY ts_col TIME;\n \nWhen MariaDB executes the ALTER TABLE statement, it converts\nthe data from the older temporal format to the newer one. \n \nIn the event that you have several tables and columns using\ntemporal data types that you want to switch over to the new\nformat, make sure the system variable is enabled, then\nperform a dump and restore using mysqldump. The columns\nusing relevant temporal data types are restored using the\nnew temporal format.\n \nExamples\n-------- \nINSERT INTO time VALUES (\'90:00:00\'), (\'800:00:00\'),\n(800), (22), (151413), (\'9:6:3\'), (\'12 09\');\n \nSELECT * FROM time;\n+-----------+\n| t |\n+-----------+\n| 90:00:00 |\n| 800:00:00 |\n| 00:08:00 |\n| 00:00:22 |\n| 15:14:13 |\n| 09:06:03 |\n| 297:00:00 |\n+-----------+\n \n\n\nURL: https://mariadb.com/kb/en/library/time/','','https://mariadb.com/kb/en/library/time/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (293,22,'TIMESTAMP','Syntax\n------ \nTIMESTAMP [(\n\nURL: https://mariadb.com/kb/en/library/timestamp/','','https://mariadb.com/kb/en/library/timestamp/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (294,22,'TINYBLOB','Syntax\n------ \nTINYBLOB\n \nDescription\n----------- \nA BLOB column with a maximum length of \n255 (28 - 1) bytes. Each\nTINYBLOB value is stored using a one-byte length prefix that\nindicates\nthe number of bytes in the value.\n \n\n\nURL: https://mariadb.com/kb/en/library/tinyblob/','','https://mariadb.com/kb/en/library/tinyblob/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (295,22,'TINYINT','Syntax\n------ \nTINYINT[(M)] [SIGNED | UNSIGNED | ZEROFILL]\n \nDescription\n----------- \nA very small integer. The signed range is -128 to 127. The\nunsigned range is 0 to 255. For details on the attributes,\nsee Numeric Data Type Overview.\n \nExamples\n-------- \nCREATE TABLE tinyints (a TINYINT,b TINYINT UNSIGNED,c\nTINYINT ZEROFILL);\nQuery OK, 0 rows affected (0.43 sec)\n \nINSERT INTO tinyints VALUES (-10,-10,-10);\nQuery OK, 1 row affected, 2 warnings (0.08 sec)\nWarning (Code 1264): Out of range value for column \'b\' at\nrow 1\nWarning (Code 1264): Out of range value for column \'c\' at\nrow 1\n \nINSERT INTO tinyints VALUES (-10,10,-10);\nQuery OK, 1 row affected, 1 warning (0.11 sec)\nWarning (Code 1264): Out of range value for column \'c\' at\nrow 1\n \nINSERT INTO tinyints VALUES (-10,10,10);\n \nSELECT * FROM tinyints;\n+------+------+------+\n| a | b | c |\n+------+------+------+\n| -10 | 0 | 000 |\n| -10 | 10 | 000 |\n| -10 | 10 | 010 |\n+------+------+------+\n \nINSERT INTO tinyints VALUES (128,128,128);\nQuery OK, 1 row affected, 1 warning (0.19 sec)\nWarning (Code 1264): Out of range value for column \'a\' at\nrow 1\n \nINSERT INTO tinyints VALUES (127,128,128);\n \nSELECT * FROM tinyints;\n+------+------+------+\n| a | b | c |\n+------+------+------+\n| -10 | 0 | 000 |\n| -10 | 10 | 000 |\n| -10 | 10 | 010 |\n| 127 | 128 | 128 |\n| 127 | 128 | 128 |\n+------+------+------+\n \n\n\nURL: https://mariadb.com/kb/en/library/tinyint/','','https://mariadb.com/kb/en/library/tinyint/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (296,22,'TINYTEXT','Syntax\n------ \nTINYTEXT [CHARACTER SET charset_name] [COLLATE\ncollation_name]\n \nDescription\n----------- \nA TEXT column with a maximum length of 255 (28 - 1)\ncharacters. The effective maximum length is less if the\nvalue contains multi-byte characters. Each TINYTEXT value is\nstored using a one-byte length prefix that indicates the\nnumber of bytes in the value.\n \n\n\nURL: https://mariadb.com/kb/en/library/tinytext/','','https://mariadb.com/kb/en/library/tinytext/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (297,22,'VARBINARY','Syntax\n------ \nVARBINARY(M)\n \nDescription\n----------- \nThe VARBINARY type is similar to the VARCHAR type, but\nstores binary byte strings rather than non-binary character\nstrings. M represents the maximum column length in bytes. \n \nIt contains no character set, and comparison and sorting are\nbased on the numeric value of the bytes.\n \nIf the maximum length is exceeded, and SQL strict mode is\nnot enabled , the extra characters will be dropped with a\nwarning. If strict mode is enabled, an error will occur.\n \nUnlike BINARY values, VARBINARYs are not right-padded when\ninserting.\n \nOracle Mode\n \nIn Oracle mode from MariaDB 10.3, RAW is a synonym for\nVARBINARY.\n \nExamples\n-------- \nInserting too many characters, first with strict mode off,\nthen with it on:\n \nCREATE TABLE varbins (a VARBINARY(10));\n \nINSERT INTO varbins VALUES(\'12345678901\');\nQuery OK, 1 row affected, 1 warning (0.04 sec)\n \nSELECT * FROM varbins;\n \n+------------+\n| a |\n+------------+\n| 1234567890 |\n+------------+\n \nSET sql_mode=\'STRICT_ALL_TABLES\';\n \nINSERT INTO varbins VALUES(\'12345678901\');\nERROR 1406 (22001): Data too long for column \'a\' at row 1\n \nSorting is performed with the byte value:\n \nTRUNCATE varbins;\n \nINSERT INTO varbins VALUES(\'A\'),(\'B\'),(\'a\'),(\'b\');\n \nSELECT * FROM varbins ORDER BY a;\n \n+------+\n| a |\n+------+\n| A |\n| B |\n| a |\n| b |\n+------+\n \nUsing CAST to sort as a CHAR instead:\n \nSELECT * FROM varbins ORDER BY CAST(a AS CHAR);\n+------+\n| a |\n+------+\n| a |\n| A |\n| b |\n| B |\n+------+\n \n\n\nURL: https://mariadb.com/kb/en/library/varbinary/','','https://mariadb.com/kb/en/library/varbinary/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (298,22,'VARCHAR','Syntax\n------ \n[NATIONAL] VARCHAR(M) [CHARACTER SET charset_name] [COLLATE\ncollation_name]\n \nDescription\n----------- \nA variable-length string. M represents the maximum column\nlength in\ncharacters. The range of M is 0 to 65,532. The effective\nmaximum\nlength of a VARCHAR is subject to the maximum row size and\nthe character set used. For\nexample, utf8 characters can require up to three bytes per\ncharacter,\nso a VARCHAR column that uses the utf8 character set can be\ndeclared\nto be a maximum of 21,844 characters.\n \nMariaDB stores VARCHAR values as a one-byte or two-byte\nlength prefix\nplus data. The length prefix indicates the number of bytes\nin the\nvalue. A VARCHAR column uses one length byte if values\nrequire no more\nthan 255 bytes, two length bytes if values may require more\nthan 255\nbytes.\n \nNote: MariaDB 5.1 and later follow the standard SQL\nspecification, \nand do not remove trailing spaces from VARCHAR values.\n \nVARCHAR(0) columns can contain 2 values: an empty string or\nNULL. Such columns cannot be part of an index. The CONNECT\nstorage engine does not support VARCHAR(0).\n \nVARCHAR is shorthand for CHARACTER VARYING. NATIONAL VARCHAR\nis the\nstandard SQL way to define that a VARCHAR column should use\nsome\npredefined character set. MariaDB uses utf8 as this\npredefined character set, as does MySQL 4.1 and up.\nNVARCHAR is shorthand for NATIONAL VARCHAR.\n \nBefore MariaDB 10.2, all MariaDB collations were of type\nPADSPACE, meaning that VARCHAR (as well as CHAR and TEXT\nvalues) are compared without regard for trailing spaces.\nThis does not apply to the LIKE pattern-matching operator,\nwhich takes into account trailing spaces. From MariaDB 10.2,\na number of NO PAD collations are available.\n \nIf a unique index consists of a column where trailing pad\ncharacters are stripped or ignored, inserts into that column\nwhere values differ only by the number of trailing pad\ncharacters will result in a duplicate-key error.\n \nExamples\n-------- \nThe following are equivalent:\n \nVARCHAR(30) CHARACTER SET utf8\nNATIONAL VARCHAR(30)\nNVARCHAR(30)\nNCHAR VARCHAR(30)\nNATIONAL CHARACTER VARYING(30)\nNATIONAL CHAR VARYING(30)\n \nTrailing spaces:\n \nCREATE TABLE strtest (v VARCHAR(10));\nINSERT INTO strtest VALUES(\'Maria \');\n \nSELECT v=\'Maria\',v=\'Maria \' FROM strtest;\n+-----------+--------------+\n| v=\'Maria\' | v=\'Maria \' |\n+-----------+--------------+\n| 1 | 1 |\n+-----------+--------------+\n \nSELECT v LIKE \'Maria\',v LIKE \'Maria \' FROM strtest;\n+----------------+-------------------+\n| v LIKE \'Maria\' | v LIKE \'Maria \' |\n+----------------+-------------------+\n| 0 | 1 |\n+----------------+-------------------+\n \nTruncation\n \nDepending on whether or not strict sql mode is set, you will\neither get a warning or an error if you try to insert a\nstring that is too long into a VARCHAR column. If the extra\ncharacters are spaces, the spaces that can\'t fit will be\nremoved and you will always get a warning, regardless of the\nsql mode setting.\n \nDifference Between VARCHAR and TEXT\n \nVARCHAR columns can be fully indexed. TEXT columns can only\nbe indexed over a specified length.\nUsing TEXT or BLOB in a SELECT query that uses temporary\ntables for storing intermediate results will force the\ntemporary table to be disk based (using the Aria storage\nengine instead of the memory storage engine, which is a bit\nslower. This is not that bad as the Aria storage engine\ncaches the rows in memory. To get the benefit of this, one\nshould ensure that the aria_pagecache_buffer_size variable\nis big enough to hold most of the row and index data for\ntemporary tables.\n \nOracle Mode\n \nIn Oracle mode from MariaDB 10.3, VARCHAR2 is a synonym.\n \nFor Storage Engine Developers\n \nInternally the full length of the VARCHAR column is\nallocated inside each TABLE objects record[] structure. As\nthere are three such buffers, each open table will allocate\n3 times max-length-to-store-varchar bytes of memory.\nTEXT and BLOB columns are stored with a pointer (4 or 8\nbytes) + a 1-4 bytes length. The TEXT data is only stored\nonce. This means that internally TEXT uses less memory for\neach open table but instead has the additional overhead that\neach TEXT object needs to be allocated and freed for each\nrow access (with some caching in between).\n \n\n\nURL: https://mariadb.com/kb/en/library/varchar/','','https://mariadb.com/kb/en/library/varchar/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (299,22,'YEAR Data Type','Syntax\n------ \nYEAR[(4)]\n \nDescription\n----------- \nA year in two-digit or four-digit format. The default is\nfour-digit format. Note that the two-digit format has been\ndeprecated since 5.5.27. \n \nIn four-digit format, the allowable values are 1901 to 2155,\nand 0000. In two-digit format, the allowable values are 70\nto 69,\nrepresenting years from 1970 to 2069. MariaDB displays YEAR\nvalues in\nYYYY format, but allows you to assign values to YEAR columns\nusing\neither strings or numbers.\n \nInserting numeric zero has a different result for YEAR(4)\nand YEAR(2). For YEAR(2), the value 00 reflects the year\n2000. For YEAR(4), the value 0000 reflects the year zero.\nThis only applies to numeric zero. String zero always\nreflects the year 2000.\n \nExamples\n-------- \nAccepting a string or a number:\n \nCREATE TABLE y(y YEAR);\n \nINSERT INTO y VALUES (1990),(\'2012\');\n \nSELECT * FROM y;\n+------+\n| y |\n+------+\n| 1990 |\n| 2012 |\n+------+\n \nOut of range:\n \nINSERT INTO y VALUES (1005),(\'3080\');\nQuery OK, 2 rows affected, 2 warnings (0.05 sec)\nRecords: 2 Duplicates: 0 Warnings: 2\n \nSHOW WARNINGS;\n+---------+------+--------------------------------------------+\n| Level | Code | Message |\n+---------+------+--------------------------------------------+\n| Warning | 1264 | Out of range value for column \'y\' at\nrow 1 |\n| Warning | 1264 | Out of range value for column \'y\' at\nrow 2 |\n+---------+------+--------------------------------------------+\n \nSELECT * FROM y;\n+------+\n| y |\n+------+\n| 1990 |\n| 2012 |\n| 0000 |\n| 0000 |\n+------+\n \nTruncating:\n \nINSERT INTO y VALUES (\'2013-12-12\');\nQuery OK, 1 row affected, 1 warning (0.05 sec)\n \nSHOW WARNINGS;\n+---------+------+----------------------------------------+\n| Level | Code | Message |\n+---------+------+----------------------------------------+\n| Warning | 1265 | Data truncated for column \'y\' at row 1\n|\n+---------+------+----------------------------------------+\n \nSELECT * FROM y;\n+------+\n| y |\n+------+\n| 1990 |\n| 2012 |\n| 0000 |\n| 0000 |\n| 2013 |\n+------+\n \nDifference between YEAR(2) and YEAR(4), and string and\nnumeric zero:\n \nCREATE TABLE y2(y YEAR(4), y2 YEAR(2));\nQuery OK, 0 rows affected, 1 warning (0.40 sec)\n \nNote (Code 1287): \'YEAR(2)\' is deprecated and will be\nremoved in a future release. Please use YEAR(4) instead\n \nINSERT INTO y2 VALUES(0,0),(\'0\',\'0\');\n \nSELECT YEAR(y),YEAR(y2) FROM y;\n+---------+----------+\n| YEAR(y) | YEAR(y2) |\n+---------+----------+\n| 0 | 2000 |\n| 2000 | 2000 |\n+---------+----------+\n \n\n\nURL: https://mariadb.com/kb/en/library/year-data-type/','','https://mariadb.com/kb/en/library/year-data-type/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (300,23,'BEGIN END','Syntax\n------ \n[begin_label:] BEGIN [NOT ATOMIC]\n [statement_list]\nEND [end_label]\n \nNOT ATOMIC is required when used outside of a stored\nprocedure. Inside stored procedures or within an anonymous\nblock, BEGIN alone starts a new anonymous block.\n \nDescription\n----------- \nBEGIN ... END syntax is used for writing compound\nstatements. A compound statement can contain multiple\nstatements, enclosed by the BEGIN and END keywords.\nstatement_list represents a list of one or more statements,\neach\nterminated by a semicolon (i.e., ;) statement delimiter.\nstatement_list is\noptional, which means that the empty compound statement\n(BEGIN END) is\nlegal.\n \nNote that END will perform a commit. If you are running in\nautocommit mode, every statement will be committed\nseparately. If you are not running in autocommit mode, you\nmust execute a COMMIT or ROLLBACK after END to get the\ndatabase up to date.\n \nUse of multiple statements requires that a client is able to\nsend statement strings containing the ; statement delimiter.\nThis is handled in the mysql command-line client with the\nDELIMITER command.\nChanging the ; end-of-statement delimiter (for example, to\n//) allows ; to be used in a program body.\n \nA compound statement within a stored program can be\nlabeled. end_label cannot be given unless begin_label also\nis present. If both are present, they must be the same.\n \nBEGIN ... END constructs can be nested. Each block can\ndefine its own variables, a CONDITION, a HANDLER and a\nCURSOR, which don\'t exist in the outer blocks. The most\nlocal declarations override the outer objects which use the\nsame name (see example below).\n \nThe declarations order is the following:\nDECLARE local variables;\nDECLARE CONDITIONs;\nDECLARE CURSORs;\nDECLARE HANDLERs;\n \nNote that DECLARE HANDLER contains another BEGIN ... END\nconstruct.\n \nHere is an example of a very simple, anonymous block:\n \nBEGIN NOT ATOMIC\nSET @a=1;\n \nCREATE TABLE test.t1(a INT);\nEND|\n \nBelow is an example of nested blocks in a stored procedure:\n \nCREATE PROCEDURE t( )\nBEGIN\n DECLARE x TINYINT UNSIGNED DEFAULT 1;\n \n BEGIN\n DECLARE x CHAR(2) DEFAULT \'02\';\n \n DECLARE y TINYINT UNSIGNED DEFAULT 10;\n \n SELECT x, y;\n \n END;\n \n SELECT x;\n \nEND;\n \nIn this example, a TINYINT variable, x is declared in the\noutter block. But in the inner block x is re-declared as a\nCHAR and an y variable is declared. The inner SELECT shows\nthe \"new\" value of x, and the value of y. But when x is\nselected in the outer block, the \"old\" value is returned.\nThe final SELECT doesn\'t try to read y, because it doesn\'t\nexist in that context.\n \n\n\nURL: https://mariadb.com/kb/en/library/begin-end/','','https://mariadb.com/kb/en/library/begin-end/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (301,23,'CASE Statement','Syntax\n------ \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 \nDescription\n----------- \nThe CASE statement for stored programs implements a complex\nconditional\nconstruct. If a search_condition evaluates to true, the\ncorresponding SQL\nstatement list is executed. If no search condition matches,\nthe statement list\nin the ELSE clause is executed. Each statement_list consists\nof one or\nmore statements.\n \nIf no when_value or search_condition matches the value\ntested and the CASE\nstatement contains no ELSE clause, a Case not found for CASE\nstatement\nerror results.\n \nEach statement_list consists of one or more statements; an\nempty\nstatement_list is not allowed. To handle situations where no\nvalue is\nmatched by any WHEN clause, use an ELSE containing an\nempty BEGIN ... END block, as shown in this example:\n \nDELIMITER |\nCREATE PROCEDURE p()\nBEGIN\n DECLARE v INT DEFAULT 1;\n \n CASE v\n WHEN 2 THEN SELECT v;\n \n WHEN 3 THEN SELECT 0;\n \n ELSE BEGIN END;\n \n END CASE;\n \nEND;\n \n|\n \nThe indentation used here in the ELSE clause is for purposes\nof clarity only,\nand is not otherwise significant. See Delimiters in the\nmysql client for more on the use of the delimiter command.\n \nNote: The syntax of the CASE statement used inside stored\nprograms\ndiffers slightly from that of the SQL CASE expression\ndescribed in\nCASE OPERATOR.\nThe CASE statement cannot have an ELSE NULL clause, and it\nis\nterminated with END CASE instead of END.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/case-statement/','','https://mariadb.com/kb/en/library/case-statement/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (302,23,'CLOSE','Syntax\n------ \nCLOSE cursor_name\n \nDescription\n----------- \nThis statement closes a previously opened cursor. The cursor\nmust have been previously opened or else an error occurs.\n \nIf not closed explicitly, a cursor is closed at the end of\nthe\ncompound statement in which it was declared.\n \nSee Cursor Overview for an example.\n \n\n\nURL: https://mariadb.com/kb/en/library/close/','','https://mariadb.com/kb/en/library/close/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (303,23,'DECLARE CONDITION','Syntax\n------ \nDECLARE condition_name CONDITION FOR condition_value\n \ncondition_value:\n SQLSTATE [VALUE] sqlstate_value\n | mysql_error_code\n \nDescription\n----------- \nThe DECLARE ... CONDITION statement defines a named error\ncondition.\nIt specifies a condition that needs specific handling and\nassociates a\nname with that condition. Later, the name can be used in a\nDECLARE ... HANDLER, SIGNAL or RESIGNAL statement (as long\nas the statement is located in the same BEGIN ... END\nblock).\n \nConditions must be declared after local variables, but\nbefore CURSORs and HANDLERs.\n \nA condition_value for DECLARE ... CONDITION can be an\nSQLSTATE value (a\n5-character string literal) or a MySQL error code (a\nnumber). You should not\nuse SQLSTATE value \'00000\' or MySQL error code 0, because\nthose indicate sucess\nrather than an error condition. If you try, or if you\nspecify an invalid SQLSTATE value, an error like this is\nproduced:\n \nERROR 1407 (42000): Bad SQLSTATE: \'00000\'\n \nFor a list of SQLSTATE values and MariaDB error\ncodes, see MariaDB Error Codes.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/declare-condition/','','https://mariadb.com/kb/en/library/declare-condition/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (304,23,'DECLARE CURSOR','Syntax\n------ \n\n\nURL: https://mariadb.com/kb/en/library/declare-cursor/','','https://mariadb.com/kb/en/library/declare-cursor/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (305,23,'DECLARE HANDLER','Syntax\n------ \nDECLARE handler_type HANDLER\n FOR condition_value [, condition_value] ...\n statement\n \nhandler_type:\n CONTINUE\n | EXIT \n | UNDO\n \ncondition_value:\n SQLSTATE [VALUE] sqlstate_value\n | condition_name\n | SQLWARNING\n | NOT FOUND\n | SQLEXCEPTION\n | mariadb_error_code\n \nDescription\n----------- \nThe DECLARE ... HANDLER statement specifies handlers that\neach may\ndeal with one or more conditions. If one of these conditions\noccurs,\nthe specified statement is executed. statement can be a\nsimple\nstatement (for example, SET var_name = value), or it can be\na compound\nstatement written using BEGIN and END.\n \nHandlers must be declared after local variables, a CONDITION\nand a CURSOR.\n \nFor a CONTINUE handler, execution of the current program\ncontinues\nafter execution of the handler statement. For an EXIT\nhandler,\nexecution terminates for the BEGIN ... END compound\nstatement in which\nthe handler is declared. (This is true even if the condition\noccurs in\nan inner block.) The UNDO handler type statement is not\nsupported.\n \nIf a condition occurs for which no handler has been\ndeclared, the\ndefault action is EXIT.\n \nA condition_value for DECLARE ... HANDLER can be any of the\nfollowing\nvalues:\nAn SQLSTATE value (a 5-character string literal) or a\nMariaDB error\ncode (a number). You should not use SQLSTATE value \'00000\'\nor MariaDB\nerror code 0, because those indicate sucess rather than an\nerror\ncondition. For a list of SQLSTATE values and MariaDB error\ncodes, see\nMariaDB Error Codes.\nA condition name previously specified with DECLARE ...\nCONDITION. It must be in the same stored program. See\nDECLARE CONDITION.\nSQLWARNING is shorthand for the class of SQLSTATE values\nthat begin\nwith \'01\'.\nNOT FOUND is shorthand for the class of SQLSTATE values that\nbegin\nwith \'02\'. This is relevant only the context of cursors\nand is used to\ncontrol what happens when a cursor reaches the end of a data\nset. If\nno more rows are available, a No Data condition occurs with\nSQLSTATE\nvalue 02000. To detect this condition, you can set up a\nhandler for it\n(or for a NOT FOUND condition). An example is shown in\nCursor Overview. This condition also occurs for SELECT ...\nINTO var_list statements that retrieve no\nrows.\nSQLEXCEPTION is shorthand for the class of SQLSTATE values\nthat do\nnot begin with \'00\', \'01\', or \'02\'.\n \nWhen an error raises, in some cases it could be handled by\nmultiple HANDLERs. For example, there may be an handler for\n1050 error, a separate handler for the 42S01 SQLSTATE, and\nanother separate handler for the SQLEXCEPTION class: in\ntheory all occurrences of HANDLER may catch the 1050 error,\nbut MariaDB chooses the HANDLER with the highest precedence.\nHere are the precedence rules:\nHandlers which refer to an error code have the highest\nprecedence.\nHandlers which refer to a SQLSTATE come next.\nHandlers which refer to an error class have the lowest\nprecedence.\n \nIn some cases, a statement could produce multiple errors. If\nthis happens, in some cases multiple handlers could have the\nhighest precedence. In such cases, the choice of the handler\nis indeterminate.\n \nNote that if an error occurs within a CONTINUE HANDLER\nblock, it can be handled by another HANDLER. However, a\nHANDLER which is already in the stack (that is, it has been\ncalled to handle an error and its execution didn\'t finish\nyet) cannot handle new errors—this prevents endless loops.\nFor example, suppose that a stored procedure contains a\nCONTINUE HANDLER for SQLWARNING and another CONTINUE HANDLER\nfor NOT FOUND. At some point, a NOT FOUND error occurs, and\nthe execution enters the NOT FOUND HANDLER. But within that\nhandler, a warning occurs, and the execution enters the\nSQLWARNING HANDLER. If another NOT FOUND error occurs, it\ncannot be handled again by the NOT FOUND HANDLER, because\nits execution is not finished.\n \nWhen a DECLARE HANDLER block can handle more than one error\ncondition, it may be useful to know which errors occurred.\nTo do so, you can use the GET DIAGNOSTICS statement.\n \nAn error that is handled by a DECLARE HANDLER construct can\nbe issued again using the RESIGNAL statement.\n \nBelow is an example using DECLARE HANDLER:\n \nCREATE TABLE test.t (s1 INT, PRIMARY KEY (s1));\n \nDELIMITER //\n \nCREATE PROCEDURE handlerdemo ( )\n BEGIN\n DECLARE CONTINUE HANDLER FOR SQLSTATE \'23000\' SET @x2 =\n1;\n \n SET @x = 1;\n \n INSERT INTO test.t VALUES (1);\n SET @x = 2;\n \n INSERT INTO test.t VALUES (1);\n SET @x = 3;\n \n END;\n \n //\n \nDELIMITER ;\n \nCALL handlerdemo( );\n \nSELECT @x;\n \n+------+\n| @x |\n+------+\n| 3 |\n+------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/declare-handler/','','https://mariadb.com/kb/en/library/declare-handler/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (306,23,'DECLARE Variable','Syntax\n------ \nDECLARE var_name [, var_name] ... [[ROW] TYPE OF]] type\n[DEFAULT value]\n \nDescription\n----------- \nThis statement is used to declare local variables within\nstored programs. To\nprovide a default value for the variable, include a DEFAULT\nclause. The\nvalue can be specified as an expression (even subqueries are\npermitted); it need not be a constant. If the\nDEFAULT clause is missing, the initial value is NULL.\n \nLocal variables are treated like stored routine parameters\nwith respect to data\ntype and overflow checking. See CREATE PROCEDURE.\n \nLocal variables must be declared before CONDITIONs, CURSORs\nand HANDLERs.\n \nLocal variable names are not case sensitive.\n \nThe scope of a local variable is within the BEGIN ... END\nblock where it is\ndeclared. The variable can be referred to in blocks nested\nwithin the declaring\nblock, except those blocks that declare a variable with the\nsame name.\n \nTYPE OF / ROW TYPE OF\n \nTYPE OF and ROW TYPE OF anchored data types for stored\nroutines were introduced in MariaDB 10.3.\n \nAnchored data types allow a data type to be defined based on\nanother object, such as a table row, rather than\nspecifically set in the declaration. If the anchor object\nchanges, so will the anchored data type. This can lead to\nroutines being easier to maintain, so that if the data type\nin the table is changed, it will automatically be changed in\nthe routine as well.\n \nVariables declared with ROW TYPE OF will have the same\nfeatures as implicit ROW variables. It is not possible to\nuse ROW TYPE OF variables in a LIMIT clause.\n \nThe real data type of TYPE OF and ROW TYPE OF table_name\nwill become known at the very beginning of the stored\nroutine call. ALTER TABLE or DROP TABLE statements performed\ninside the current routine on the tables that appear in\nanchors won\'t affect the data type of the anchored\nvariables, even if the variable is declared after an ALTER\nTABLE or DROP TABLE statement.\n \nThe real data type of a ROW TYPE OF cursor_name variable\nwill become known when execution enters into the block where\nthe variable is declared. Data type instantiation will\nhappen only once. In a cursor ROW TYPE OF variable that is\ndeclared inside a loop, its data type will become known on\nthe very first iteration and won\'t change on further loop\niterations.\n \nThe tables referenced in TYPE OF and ROW TYPE OF\ndeclarations will be checked for existence at the beginning\nof the stored routine call. CREATE PROCEDURE or CREATE\nFUNCTION will not check the referenced tables for existence.\n \nExamples\n-------- \nTYPE OF and ROW TYPE OF from MariaDB 10.3:\n \nDECLARE tmp TYPE OF t1.a;\n -- Get the data type from the column {{a}} in the table\n{{t1}}\n \nDECLARE rec1 ROW TYPE OF t1;\n -- Get the row data type from the table {{t1}}\n \nDECLARE rec2 ROW TYPE OF cur1;\n -- Get the row data type from the cursor {{cur1}}\n \n\n\nURL: https://mariadb.com/kb/en/library/declare-variable/','','https://mariadb.com/kb/en/library/declare-variable/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (307,23,'FETCH','Syntax\n------ \nFETCH cursor_name INTO var_name [, var_name] ...\n \nDescription\n----------- \nThis statement fetches the next row (if a row exists) using\nthe\nspecified open cursor, and advances the cursor pointer.\n \nvar_name can be a local variable, but not a user-defined\nvariable.\n \nIf no more rows are available, a No Data condition occurs\nwith\nSQLSTATE value 02000. To detect this condition, you can set\nup a\nhandler for it (or for a NOT FOUND condition).\n \nSee Cursor Overview for an example.\n \n\n\nURL: https://mariadb.com/kb/en/library/fetch/','','https://mariadb.com/kb/en/library/fetch/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (308,23,'FOR','FOR loops were introduced in MariaDB 10.3.\n \nSyntax\n------ \nInteger range FOR loop:\n \n[begin_label:]\nFOR var_name IN [ REVERSE ] lower_bound .. upper_bound\nDO statement_list\nEND FOR [ end_label ]\n \nExplicit cursor FOR loop\n \n[begin_label:]\nFOR record_name IN cursor_name [ (\ncursor_actual_parameter_list)]\nDO statement_list\nEND FOR [ end_label ]\n \nExplicit cursor FOR loop (Oracle mode)\n \n[begin_label:]\nFOR record_name IN cursor_name [ (\ncursor_actual_parameter_list)]\nLOOP\n statement_list\nEND LOOP [ end_label ]\n \nImplicit cursor FOR loop\n \n[begin_label:]\nFOR record_name IN ( select_statement )\nDO statement_list\nEND FOR [ end_label ]\n \nDescription\n----------- \nFOR loops allow code to be executed a fixed number of times.\n \nIn an integer range FOR loop, MariaDB will compare the lower\nbound and upper bound values, and assign the lower bound\nvalue to a counter. If REVERSE is not specified, and the\nupper bound value is greater than or equal to the counter,\nthe counter will be incremented and the statement will\ncontinue, after which the loop is entered again. If the\nupper bound value is greater than the counter, the loop will\nbe exited.\n \nIf REVERSE is specified, the counter is decremented, and the\nupper bound value needs to be less than or equal for the\nloop to continue.\n \nExamples\n-------- \nIntger range FOR loop:\n \nCREATE TABLE t1 (a INT);\n \nDELIMITER //\n \nFOR i IN 1..3\nDO\n INSERT INTO t1 VALUES (i);\nEND FOR;\n \n//\n \nDELIMITER ;\n \nSELECT * FROM t1;\n \n+------+\n| a |\n+------+\n| 1 |\n| 2 |\n| 3 |\n+------+\n \nREVERSE integer range FOR loop:\n \nCREATE OR REPLACE TABLE t1 (a INT);\n \nDELIMITER //\nFOR i IN REVERSE 12..4\n DO\n INSERT INTO t1 VALUES (i);\nEND FOR;\n \n//\nQuery OK, 9 rows affected (0.422 sec)\n \nDELIMITER ;\n \nSELECT * FROM t1;\n \n+------+\n| a |\n+------+\n| 12 |\n| 11 |\n| 10 |\n| 9 |\n| 8 |\n| 7 |\n| 6 |\n| 5 |\n| 4 |\n+------+\n \nExplicit cursor in Oracle mode:\n \nSET sql_mode=ORACLE;\n \nCREATE OR REPLACE TABLE t1 (a INT, b VARCHAR(32));\n \nINSERT INTO t1 VALUES (10,\'b0\');\nINSERT INTO t1 VALUES (11,\'b1\');\nINSERT INTO t1 VALUES (12,\'b2\');\n \nDELIMITER //\n \nCREATE OR REPLACE PROCEDURE p1(pa INT) AS \n CURSOR cur(va INT) IS\n SELECT a, b FROM t1 WHERE a=va;\n \nBEGIN\n FOR rec IN cur(pa)\n LOOP\n SELECT rec.a, rec.b;\n \n END LOOP;\n \nEND;\n \n//\n \nDELIMITER ;\n \nCALL p1(10);\n+-------+-------+\n| rec.a | rec.b |\n+-------+-------+\n| 10 | b0 |\n+-------+-------+\n \nCALL p1(11);\n+-------+-------+\n| rec.a | rec.b |\n+-------+-------+\n| 11 | b1 |\n+-------+-------+\n \nCALL p1(12);\n+-------+-------+\n| rec.a | rec.b |\n+-------+-------+\n| 12 | b2 |\n+-------+-------+\n \nCALL p1(13);\nQuery OK, 0 rows affected (0.000 sec)\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/for/','','https://mariadb.com/kb/en/library/for/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (309,23,'GOTO','The GOTO statement was introduced in MariaDB 10.3 for Oracle\ncompatibility.\n \nSyntax\n------ \nGOTO label\n \nDescription\n----------- \nThe GOTO statement causes the code to jump to the specified\nlabel, and continue operating from there. It is only\naccepted when in Oracle mode.\n \nExample\n \nSET sql_mode=ORACLE;\n \nDELIMITER //\n \nCREATE OR REPLACE PROCEDURE p1 AS\n \nBEGIN\n \n SELECT 1;\n \n GOTO label;\n \n SELECT 2;\n \n SELECT 3;\n \nEND;\n \n//\n \nDELIMITER \n \ncall p1();\n+---+\n| 1 |\n+---+\n| 1 |\n+---+\n1 row in set (0.000 sec)\n \n+---+\n| 3 |\n+---+\n| 3 |\n+---+\n1 row in set (0.000 sec)\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/goto/','','https://mariadb.com/kb/en/library/goto/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (310,23,'IF','Syntax\n------ \nIF search_condition THEN statement_list\n [ELSEIF search_condition THEN statement_list] ...\n [ELSE statement_list]\nEND IF;\n \nDescription\n----------- \nIF implements a basic conditional construct. If the\nsearch_condition\nevaluates to true, the corresponding SQL statement list is\nexecuted.\nIf no search_condition matches, the statement list in the\nELSE clause\nis executed. Each statement_list consists of one or more\nstatements.\n \n\n\nURL: https://mariadb.com/kb/en/library/if/','','https://mariadb.com/kb/en/library/if/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (311,23,'ITERATE','Syntax\n------ \nITERATE label\n \nITERATE can appear only within LOOP, REPEAT, and WHILE\nstatements.\nITERATE means \"do the loop again\", and uses the\nstatement\'s label to determine which statements to repeat.\nThe label must be in the same stored program, not in a\ncaller procedure.\n \nIf you try to use ITERATE with a non-existing label, or if\nthe label is associated to a construct which is not a loop,\nthe following error will be produced:\n \nERROR 1308 (42000): ITERATE with no matching label: \n \nBelow is an example of how ITERATE might be used:\n \nCREATE PROCEDURE doiterate(p1 INT)\nBEGIN\n label1: LOOP\n SET p1 = p1 + 1;\n \n IF p1 \n\nURL: https://mariadb.com/kb/en/library/iterate/','','https://mariadb.com/kb/en/library/iterate/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (312,23,'Labels','Syntax\n------ \nlabel: \n[label]\n \nLabels are MariaDB identifiers which can be used to identify\na BEGIN ... END construct or a loop. They have a maximum\nlength of 16 characters and can be quoted with backticks\n(i.e.., `).\n \nLabels have a start part and an end part. The start part\nmust precede the portion of code it refers to, must be\nfollowed by a colon (:) and can be on the same or different\nline. The end part is optional and adds nothing, but can\nmake the code more readable. If used, the end part must\nprecede the construct\'s delimiter (;). Constructs\nidentified by a label can be nested. Each construct can be\nidentified by only one label.\n \nLabels need not be unique in the stored program they belong\nto. However, a label for an inner loop cannot be identical\nto a label for an outer loop. In this case, the following\nerror would be produced:\n \nERROR 1309 (42000): Redefining label \n \nLEAVE and ITERATE statements can be used to exit or repeat a\nportion of code identified by a label. They must be in the\nsame Stored Routine, Trigger or Event which contains the\ntarget label.\n \nBelow is an example using a simple label that is used to\nexit a LOOP:\n \nCREATE PROCEDURE `test_sp`()\nBEGIN\n `my_label`:\n LOOP\n SELECT \'looping\';\n \n LEAVE `my_label`;\n \n END LOOP;\n \n SELECT \'out of loop\';\n \nEND;\n \nThe following label is used to exit a procedure, and has an\nend part:\n \nCREATE PROCEDURE `test_sp`()\n`my_label`:\nBEGIN\n IF @var = 1 THEN\n LEAVE `my_label`;\n \n END IF;\n \n DO something();\nEND `my_label`;\n \n\n \n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/labels/','','https://mariadb.com/kb/en/library/labels/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (313,23,'LEAVE','Syntax\n------ \nLEAVE label\n \nThis statement is used to exit the flow control construct\nthat has the\ngiven label. The label must be in the same stored program,\nnot in a caller procedure. LEAVE can be used within BEGIN\n... END or loop constructs\n(LOOP, REPEAT, WHILE). In Stored Procedures, Triggers and\nEvents, LEAVE can refer to the outmost BEGIN ... END\nconstruct; in that case, the program exits the procedure. In\nStored Functions, RETURN can be used instead.\n \nNote that LEAVE cannot be used to exit a DECLARE HANDLER\nblock.\n \nIf you try to LEAVE a non-existing label, or if you try to\nLEAVE a HANDLER block, the following error will be produced:\n \nERROR 1308 (42000): LEAVE with no matching label: \n \nThe following example uses LEAVE to exit the procedure if a\ncondition is true:\n \nCREATE PROCEDURE proc(IN p TINYINT)\nCONTAINS SQL\n`whole_proc`:\nBEGIN\n SELECT 1;\n \n IF p \n\nURL: https://mariadb.com/kb/en/library/leave/','','https://mariadb.com/kb/en/library/leave/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (314,23,'LOOP','Syntax\n------ \n[begin_label:] LOOP\n statement_list\nEND LOOP [end_label]\n \nDescription\n----------- \nLOOP implements a simple loop construct, enabling repeated\nexecution\nof the statement list, which consists of one or more\nstatements, each\nterminated by a semicolon (i.e., ;) statement delimiter. The\nstatements\nwithin the loop are repeated until the loop is exited;\nusually this is\naccomplished with a LEAVE statement.\n \nA LOOP statement can be labeled. end_label cannot be given\nunless\nbegin_label also is present. If both are present, they must\nbe the\nsame.\n \nSee Delimiters in the mysql client for more on delimiter\nusage in the client.\n \n\n\nURL: https://mariadb.com/kb/en/library/loop/','','https://mariadb.com/kb/en/library/loop/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (315,23,'OPEN','Syntax\n------ \n\n\nURL: https://mariadb.com/kb/en/library/open/','','https://mariadb.com/kb/en/library/open/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (316,23,'REPEAT LOOP','Syntax\n------ \n[begin_label:] REPEAT\n statement_list\nUNTIL search_condition\nEND REPEAT [end_label]\n \nThe statement list within a REPEAT statement is repeated\nuntil the\nsearch_condition is true. Thus, a REPEAT always enters the\nloop at\nleast once. statement_list consists of one or more\nstatements, each\nterminated by a semicolon (i.e., ;) statement delimiter.\n \nA REPEAT statement can be labeled. end_label cannot be given\nunless\nbegin_label also is present. If both are present, they must\nbe the\nsame.\n \nSee Delimiters in the mysql client for more on client\ndelimiter usage.\n \nDELIMITER //\n \nCREATE PROCEDURE dorepeat(p1 INT)\n BEGIN\n SET @x = 0;\n \n REPEAT SET @x = @x + 1;\n UNTIL @x > p1 END REPEAT;\n \n END\n//\n \nCALL dorepeat(1000)//\n \nSELECT @x//\n+------+\n| @x |\n+------+\n| 1001 |\n+------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/repeat-loop/','','https://mariadb.com/kb/en/library/repeat-loop/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (317,23,'RESIGNAL','SIGNAL and RESIGNAL were both introduced in MariaDB 5.5.\n \nSyntax\n------ \nRESIGNAL [error_condition]\n [SET error_property\n [, error_property] ...]\n \nerror_condition:\n SQLSTATE [VALUE] \'sqlstate_value\'\n | condition_name\n \nerror_property:\n error_property_name = \n \nerror_property_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 \nDescription\n----------- \nThe syntax of RESIGNAL and its semantics are very similar to\nSIGNAL. This statement can only be used within an error\nHANDLER. It produces an error, like SIGNAL. RESIGNAL clauses\nare the same as SIGNAL, except that they all are optional,\neven SQLSTATE. All the properties which are not specified in\nRESIGNAL, will be identical to the properties of the error\nthat was received by the error HANDLER. For a description of\nthe clauses, see diagnostics area.\n \nNote that RESIGNAL does not empty the diagnostics area: it\njust appends another error condition.\n \nRESIGNAL, without any clauses, produces an error which is\nidentical to the error that was received by HANDLER.\n \nIf used out of a HANDLER construct, RESIGNAL produces the\nfollowing error:\n \nERROR 1645 (0K000): RESIGNAL when handler not active\n \nIn MariaDB 5.5, if a HANDLER contained a CALL to another\nprocedure, that procedure could use RESIGNAL. Since MariaDB\n10.0, trying to do this raises the above error.\n \nFor a list of SQLSTATE values and MariaDB error codes, see\nMariaDB Error Codes.\n \nThe following procedure tries to query two tables which\ndon\'t exist, producing a 1146 error in both cases. Those\nerrors will trigger the HANDLER. The first time the error\nwill be ignored and the client will not receive it, but the\nsecond time, the error is re-signaled, so the client will\nreceive it.\n \nCREATE PROCEDURE test_error( )\nBEGIN\n DECLARE CONTINUE HANDLER\n FOR 1146\n BEGIN\n IF @hide_errors IS FALSE THEN\n RESIGNAL;\n \n END IF;\n \n END;\n \n SET @hide_errors = TRUE;\n \n SELECT \'Next error will be ignored\' AS msg;\n \n SELECT `c` FROM `temptab_one`;\n \n SELECT \'Next error won\'\'t be ignored\' AS msg;\n \n SET @hide_errors = FALSE;\n \n SELECT `c` FROM `temptab_two`;\n \nEND;\n \nCALL test_error( );\n \n+----------------------------+\n| msg |\n+----------------------------+\n| Next error will be ignored |\n+----------------------------+\n \n+-----------------------------+\n| msg |\n+-----------------------------+\n| Next error won\'t be ignored |\n+-----------------------------+\n \nERROR 1146 (42S02): Table \'test.temptab_two\' doesn\'t\nexist\n \nThe following procedure re-signals an error, modifying only\nthe error message to clarify the cause of the problem.\n \nCREATE PROCEDURE test_error()\nBEGIN\n DECLARE CONTINUE HANDLER\n FOR 1146\n BEGIN\n RESIGNAL SET\n MESSAGE_TEXT = \'`temptab` does not exist\';\n \n END;\n \n SELECT `c` FROM `temptab`;\n \nEND;\n \nCALL test_error( );\nERROR 1146 (42S02): `temptab` does not exist\n \nAs explained above, this works on MariaDB 5.5, but produces\na 1645 error since 10.0.\n \nCREATE PROCEDURE handle_error()\nBEGIN\n RESIGNAL;\n \nEND;\n \nCREATE PROCEDURE p()\nBEGIN\n DECLARE EXIT HANDLER FOR SQLEXCEPTION CALL p();\n SIGNAL SQLSTATE \'45000\';\n \nEND;\n \n\n\nURL: https://mariadb.com/kb/en/library/resignal/','','https://mariadb.com/kb/en/library/resignal/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (318,23,'RETURN','Syntax\n------ \nRETURN expr \n \nThe RETURN statement terminates execution of a stored\nfunction and\nreturns the value expr to the function caller. There must be\nat least\none RETURN statement in a stored function. If the function\nhas multiple exit points, all exit points must have a\nRETURN.\n \nThis statement is not used in stored procedures, triggers,\nor events. LEAVE can be used instead.\n \nThe following example shows that RETURN can return the\nresult of a scalar subquery:\n \nCREATE FUNCTION users_count() RETURNS BOOL\n READS SQL DATA\nBEGIN\n RETURN (SELECT COUNT(DISTINCT User) FROM mysql.user);\nEND;\n \n\n \n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/return/','','https://mariadb.com/kb/en/library/return/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (319,23,'SELECT INTO','Syntax\n------ \nSELECT col_name [, col_name] ...\n INTO var_name [, var_name] ...\n table_expr\n \nDescription\n----------- \nSELECT ... INTO enables selected columns to be stored\ndirectly\ninto variables. No resultset is produced. The query should\nreturn a single row. If the query\nreturns no rows, a warning with error code 1329 occurs (No\ndata), and\nthe variable values remain unchanged. If the query returns\nmultiple\nrows, error 1172 occurs (Result consisted of more than one\nrow). If it\nis possible that the statement may retrieve multiple rows,\nyou can use\nLIMIT 1 to limit the result set to a single row.\n \nThe INTO clause can also be specified at the end of the\nstatement.\n \nIn the context of such statements that occur as part of\nevents\nexecuted by the Event Scheduler, diagnostics messages (not\nonly\nerrors, but also warnings) are written to the error log,\nand, on\nWindows, to the application event log.\n \nThis statement can be used with both local variables and\nuser-defined variables.\n \nFor the complete syntax, see SELECT.\n \nAnother way to set a variable\'s value is the SET statement.\n \nSELECT ... INTO results are not stored in the query cache\neven if SQL_CACHE is specified.\n \nExamples\n-------- \nSELECT id, data INTO @x,@y \nFROM test.t1 LIMIT 1;\n \n\n\nURL: https://mariadb.com/kb/en/library/selectinto/','','https://mariadb.com/kb/en/library/selectinto/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (320,23,'SIGNAL','SIGNAL and RESIGNAL were both introduced in MariaDB 5.5.\n \nSyntax\n------ \nSIGNAL error_condition\n [SET error_property\n [, error_property] ...]\n \nerror_condition:\n SQLSTATE [VALUE] \'sqlstate_value\'\n | condition_name\n \nerror_property:\n error_property_name = \n \nerror_property_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 \nSIGNAL empties the diagnostics area and produces a custom\nerror. This statement can be used anywhere, but is generally\nuseful when used inside a stored program. When the error is\nproduced, it can be caught by a HANDLER. If not, the current\nstored program, or the current statement, will terminate\nwith the specified error.\n \nSometimes an error HANDLER just needs to SIGNAL the same\nerror it received, optionally with some changes. Usually the\nRESIGNAL statement is the most convenient way to do this.\n \nerror_condition can be an SQLSTATE value or a named error\ncondition defined via DECLARE CONDITION. SQLSTATE must be a\nconstant string consisting of five characters. These codes\nare standard to ODBC and ANSI SQL. For customized errors,\nthe recommended SQLSTATE is \'45000\'. For a list of\nSQLSTATE values used by MariaDB, see the MariaDB Error Codes\npage. The SQLSTATE can be read via the API method\nmysql_sqlstate( ). \n \nTo specify error properties user-defined variables and local\nvariables can be used, as well as character set conversions\n(but you can\'t set a collation).\n \nThe error properties, their type and their default values\nare explained in the diagnostics area page.\n \nErrors\n \nIf the SQLSTATE is not valid, the following error like this\nwill be produced:\n \nERROR 1407 (42000): Bad SQLSTATE: \'123456\'\n \nIf a property is specified more than once, an error like\nthis will be produced:\n \nERROR 1641 (42000): Duplicate condition information item\n\'MESSAGE_TEXT\'\n \nIf you specify a condition name which is not declared, an\nerror like this will be produced:\n \nERROR 1319 (42000): Undefined CONDITION: cond_name\n \nIf MYSQL_ERRNO is out of range, you will get an error like\nthis:\n \nERROR 1231 (42000): Variable \'MYSQL_ERRNO\' can\'t be set\nto the value of \'0\'\n \nExamples\n-------- \nHere\'s what happens if SIGNAL is used in the client to\ngenerate errors:\n \nSIGNAL SQLSTATE \'01000\';\n \nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+---------+------+------------------------------------------+\n| Level | Code | Message |\n+---------+------+------------------------------------------+\n| Warning | 1642 | Unhandled user-defined warning condition\n|\n+---------+------+------------------------------------------+\n1 row in set (0.06 sec)\n \nSIGNAL SQLSTATE \'02000\';\n \nERROR 1643 (02000): Unhandled user-defined not found\ncondition\n \nHow to specify MYSQL_ERRNO and MESSAGE_TEXT properties:\n \nSIGNAL SQLSTATE \'45000\' SET MYSQL_ERRNO=30001,\nMESSAGE_TEXT=\'H\nello, world!\';\n \nERROR 30001 (45000): Hello, world!\n \nThe following code shows how to use user variables, local\nvariables and character set conversion with SIGNAL:\n \nCREATE PROCEDURE test_error(x INT)\nBEGIN\n DECLARE errno SMALLINT UNSIGNED DEFAULT 31001;\n \n SET @errmsg = \'Hello, world!\';\n \n IF x = 1 THEN\n SIGNAL SQLSTATE \'45000\' SET\n MYSQL_ERRNO = errno,\n MESSAGE_TEXT = @errmsg;\n \n ELSE\n SIGNAL SQLSTATE \'45000\' SET\n MYSQL_ERRNO = errno,\n MESSAGE_TEXT = _utf8\'Hello, world!\';\n \n END IF;\n \nEND;\n \nHow to use named error conditions:\n \nCREATE PROCEDURE test_error(n INT)\nBEGIN\n DECLARE `too_big` CONDITION FOR SQLSTATE \'45000\';\n \n IF n > 10 THEN\n SIGNAL `too_big`;\n \n END IF;\n \nEND;\n \nIn this example, we\'ll define a HANDLER for an error code.\nWhen the error occurs, we SIGNAL a more informative error\nwhich makes sense for our procedure:\n \nCREATE PROCEDURE test_error()\nBEGIN\n DECLARE EXIT HANDLER\n FOR 1146\n BEGIN\n SIGNAL SQLSTATE \'45000\' SET\n MESSAGE_TEXT = \'Temporary tables not found; did you call\ninit() procedure?\';\n \n END;\n \n -- this will produce a 1146 error\n SELECT `c` FROM `temptab`;\n \nEND;\n \n\n\nURL: https://mariadb.com/kb/en/library/signal/','','https://mariadb.com/kb/en/library/signal/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (321,23,'WHILE','Syntax\n------ \n[begin_label:] WHILE search_condition DO\n statement_list\nEND WHILE [end_label]\n \nDescription\n----------- \nThe statement list within a WHILE statement is repeated as\nlong as the\nsearch_condition is true. statement_list consists of one or\nmore\nstatements. If the loop must be executed at least once,\nREPEAT ... LOOP can be used instead.\n \nA WHILE statement can be labeled. end_label cannot be given\nunless\nbegin_label also is present. If both are present, they must\nbe the\nsame.\n \nExamples\n-------- \nCREATE PROCEDURE dowhile()\nBEGIN\n DECLARE v1 INT DEFAULT 5;\n \n WHILE v1 > 0 DO\n ...\n SET v1 = v1 - 1;\n \n END WHILE;\n \nEND\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/while/','','https://mariadb.com/kb/en/library/while/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (322,24,'BUFFER','A synonym for ST_BUFFER.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/buffer/','','https://mariadb.com/kb/en/library/buffer/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (323,24,'CONVEXHULL','A synonym for ST_CONVEXHULL.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/convexhull/','','https://mariadb.com/kb/en/library/convexhull/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (324,24,'GEOMETRYCOLLECTION','Syntax\n------ \nGeometryCollection(g1,g2,...)\n \nDescription\n----------- \nConstructs a WKB GeometryCollection. If any argument is not\na well-formed WKB representation of a geometry, the return\nvalue is NULL.\n \nExamples\n-------- \nCREATE TABLE gis_geometrycollection (g GEOMETRYCOLLECTION);\nSHOW FIELDS FROM gis_geometrycollection;\n \nINSERT INTO gis_geometrycollection VALUES\n (GeomCollFromText(\'GEOMETRYCOLLECTION(POINT(0 0),\nLINESTRING(0 0,10 10))\')),\n (GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6),\nLineString(Point(3, 6), Point(7, 9)))))),\n (GeomFromText(\'GeometryCollection()\')),\n (GeomFromText(\'GeometryCollection EMPTY\'));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/geometrycollection/','','https://mariadb.com/kb/en/library/geometrycollection/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (325,24,'LINESTRING','Syntax\n------ \nLineString(pt1,pt2,...)\n \nDescription\n----------- \nConstructs a WKB LineString value from a number of WKB Point\narguments. If any argument is not a WKB Point, the return\nvalue is\nNULL. If the number of Point arguments is less than two, the\nreturn value is NULL.\n \nExamples\n-------- \nSET @ls = \'LineString(1 1,2 2,3 3)\';\n \nSELECT AsText(EndPoint(GeomFromText(@ls)));\n+-------------------------------------+\n| AsText(EndPoint(GeomFromText(@ls))) |\n+-------------------------------------+\n| POINT(3 3) |\n+-------------------------------------+\n \nCREATE TABLE gis_line (g LINESTRING);\nINSERT INTO gis_line VALUES\n (LineFromText(\'LINESTRING(0 0,0 10,10 0)\')),\n (LineStringFromText(\'LINESTRING(10 10,20 10,20 20,10 20,10\n10)\')),\n (LineStringFromWKB(AsWKB(LineString(Point(10, 10),\nPoint(40, 10)))));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/linestring/','','https://mariadb.com/kb/en/library/linestring/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (326,24,'MULTILINESTRING','Syntax\n------ \nMultiLineString(ls1,ls2,...)\n \nDescription\n----------- \nConstructs a WKB MultiLineString value using WKB LineString\narguments. If any argument is not a WKB LineString, the\nreturn value is\nNULL.\n \nExample\n \nCREATE TABLE gis_multi_line (g MULTILINESTRING);\nINSERT INTO gis_multi_line VALUES\n (MultiLineStringFromText(\'MULTILINESTRING((10 48,10 21,10\n0),(16 0,16 23,16 48))\')),\n (MLineFromText(\'MULTILINESTRING((10 48,10 21,10 0))\')),\n (MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2),\nPoint(3, 5)), LineString(Point(2, 5),Point(5, 8),Point(21,\n7))))));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/multilinestring/','','https://mariadb.com/kb/en/library/multilinestring/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (327,24,'MULTIPOINT','Syntax\n------ \nMultiPoint(pt1,pt2,...)\n \nDescription\n----------- \nConstructs a WKB MultiPoint value using WKB Point arguments.\nIf any argument is not a WKB Point, the return value is\nNULL.\n \nExamples\n-------- \nSET @g = ST_GEOMFROMTEXT(\'MultiPoint( 1 1, 2 2, 5 3, 7 2, 9\n3, 8 4, 6 6, 6 9, 4 9, 1 5 )\');\n \nCREATE TABLE gis_multi_point (g MULTIPOINT);\nINSERT INTO gis_multi_point VALUES\n (MultiPointFromText(\'MULTIPOINT(0 0,10 10,10 20,20\n20)\')),\n (MPointFromText(\'MULTIPOINT(1 1,11 11,11 21,21 21)\')),\n (MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4,\n10)))));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/multipoint/','','https://mariadb.com/kb/en/library/multipoint/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (328,24,'MULTIPOLYGON','Syntax\n------ \nMultiPolygon(poly1,poly2,...)\n \nDescription\n----------- \nConstructs a WKB MultiPolygon value from a set of WKB\nPolygon arguments. If any argument is not a WKB Polygon, the\nreturn value is NULL.\n \nExample\n \nCREATE TABLE gis_multi_polygon (g MULTIPOLYGON);\nINSERT INTO gis_multi_polygon VALUES\n (MultiPolygonFromText(\'MULTIPOLYGON(((28 26,28 0,84 0,84\n42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67\n13,59 13,59 18)))\')),\n (MPolyFromText(\'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28\n26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59\n13,59 18)))\')),\n (MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0,\n3), Point(3, 3), Point(3, 0), Point(0, 3)))))));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/multipolygon/','','https://mariadb.com/kb/en/library/multipolygon/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (329,24,'POINT','Syntax\n------ \nPoint(x,y)\n \nDescription\n----------- \nConstructs a WKB Point using the given coordinates.\n \nExamples\n-------- \nSET @g = ST_GEOMFROMTEXT(\'Point(1 1)\');\n \nCREATE TABLE gis_point (g POINT);\nINSERT INTO gis_point VALUES\n (PointFromText(\'POINT(10 10)\')),\n (PointFromText(\'POINT(20 10)\')),\n (PointFromText(\'POINT(20 20)\')),\n (PointFromWKB(AsWKB(PointFromText(\'POINT(10 20)\'))));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/point/','','https://mariadb.com/kb/en/library/point/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (330,24,'PointOnSurface','A synonym for ST_PointOnSurface.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/pointonsurface/','','https://mariadb.com/kb/en/library/pointonsurface/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (331,24,'POLYGON','Syntax\n------ \nPolygon(ls1,ls2,...)\n \nDescription\n----------- \nConstructs a WKB Polygon value from a number of WKB\nLineString\narguments. If any argument does not represent the WKB of a\nLinearRing (that is,\nnot a closed and simple LineString) the return value is\nNULL.\n \nNote that according to the OpenGIS standard, a POLYGON\nshould have exactly one ExteriorRing and all other rings\nshould lie within that ExteriorRing and thus be the\nInteriorRings. Practically, however, some systems, including\nMariaDB\'s, permit polygons to have several\n\'ExteriorRings\'. In the case of there being multiple,\nnon-overlapping exterior rings ST_NUMINTERIORRINGS() will\nreturn 1.\n \nExamples\n-------- \nSET @g = ST_GEOMFROMTEXT(\'POLYGON((1 1,1 5,4 9,6 9,9 3,7\n2,1 1))\');\n \nCREATE TABLE gis_polygon (g POLYGON);\nINSERT INTO gis_polygon VALUES\n (PolygonFromText(\'POLYGON((10 10,20 10,20 20,10 20,10\n10))\')),\n (PolyFromText(\'POLYGON((0 0,50 0,50 50,0 50,0 0), (10\n10,20 10,20 20,10 20,10 10))\')),\n (PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0),\nPoint(30, 0), Point(30, 30), Point(0, 0))))));\n \nNon-overlapping \'polygon\':\n \nSELECT ST_NumInteriorRings(ST_PolyFromText(\'POLYGON((0 0,10\n0,10 10,0 10,0 0),\n (-1 -1,-5 -1,-5 -5,-1 -5,-1 -1))\')) AS NumInteriorRings;\n \n+------------------+\n| NumInteriorRings |\n+------------------+\n| 1 |\n+------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/polygon/','','https://mariadb.com/kb/en/library/polygon/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (332,24,'ST_BUFFER','Syntax\n------ \nST_BUFFER(g1,r)\nBUFFER(g1,r)\n \nDescription\n----------- \nReturns a geometry that represents all points whose distance\nfrom geometry g1 is less than or equal to distance, or\nradius, r.\n \nUses for this function could include creating for example a\nnew geometry representing a buffer zone around an island.\n \nBUFFER() is a synonym.\n \nExamples\n-------- \nDetermining whether a point is within a buffer zone:\n \nSET @g1 = ST_GEOMFROMTEXT(\'POLYGON((10 10, 10 20, 20 20, 20\n10, 10 10))\');\n \nSET @g2 = ST_GEOMFROMTEXT(\'POINT(8 8)\');\n \nSELECT ST_WITHIN(@g2,ST_BUFFER(@g1,5));\n+---------------------------------+\n| ST_WITHIN(@g2,ST_BUFFER(@g1,5)) |\n+---------------------------------+\n| 1 |\n+---------------------------------+\n \nSELECT ST_WITHIN(@g2,ST_BUFFER(@g1,1));\n+---------------------------------+\n| ST_WITHIN(@g2,ST_BUFFER(@g1,1)) |\n+---------------------------------+\n| 0 |\n+---------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_buffer/','','https://mariadb.com/kb/en/library/st_buffer/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (333,24,'ST_CONVEXHULL','ST_ConvexHull() was introduced in MariaDB 10.1.2\n \nSyntax\n------ \nST_ConvexHull(g)\nConvexHull(g)\n \nDescription\n----------- \nGiven a geometry, returns a geometry that is the minimum\nconvex geometry enclosing all geometries within the set.\nReturns NULL if the geometry value is NULL or an empty\nvalue.\n \nST_ConvexHull() and ConvexHull() are synonyms.\n \nExamples\n-------- \nThe ConvexHull of a single point is simply the single point:\n \nSET @g = ST_GEOMFROMTEXT(\'Point(0 0)\');\n \nSELECT ST_ASTEXT(ST_CONVEXHULL(@g));\n+------------------------------+\n| ST_ASTEXT(ST_CONVEXHULL(@g)) |\n+------------------------------+\n| POINT(0 0) |\n+------------------------------+\n \nSET @g = ST_GEOMFROMTEXT(\'MultiPoint(0 0, 1 2, 2 3)\');\n \nSELECT ST_ASTEXT(ST_CONVEXHULL(@g));\n+------------------------------+\n| ST_ASTEXT(ST_CONVEXHULL(@g)) |\n+------------------------------+\n| POLYGON((0 0,1 2,2 3,0 0)) |\n+------------------------------+\n \nSET @g = ST_GEOMFROMTEXT(\'MultiPoint( 1 1, 2 2, 5 3, 7 2, 9\n3, 8 4, 6 6, 6 9, 4 9, 1 5 )\');\n \nSELECT ST_ASTEXT(ST_CONVEXHULL(@g));\n+----------------------------------------+\n| ST_ASTEXT(ST_CONVEXHULL(@g)) |\n+----------------------------------------+\n| POLYGON((1 1,1 5,4 9,6 9,9 3,7 2,1 1)) |\n+----------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_convexhull/','','https://mariadb.com/kb/en/library/st_convexhull/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (334,24,'ST_INTERSECTION','Syntax\n------ \nST_INTERSECTION(g1,g2)\n \nDescription\n----------- \nReturns a geometry that is the intersection, or shared\nportion, of geometry g1 and geometry g2.\n \nExamples\n-------- \nSET @g1 = ST_GEOMFROMTEXT(\'POINT(2 1)\');\n \nSET @g2 = ST_GEOMFROMTEXT(\'LINESTRING(2 1, 0 2)\');\n \nSELECT ASTEXT(ST_INTERSECTION(@g1,@g2));\n+----------------------------------+\n| ASTEXT(ST_INTERSECTION(@g1,@g2)) |\n+----------------------------------+\n| POINT(2 1) |\n+----------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_intersection/','','https://mariadb.com/kb/en/library/st_intersection/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (335,24,'ST_POINTONSURFACE','ST_POINTONSURFACE() was introduced in MariaDB 10.1.2\n \nSyntax\n------ \nST_PointOnSurface(g)\nPointOnSurface(g)\n \nDescription\n----------- \nGiven a geometry, returns a POINT guaranteed to intersect a\nsurface. However, see MDEV-7514.\n \nST_PointOnSurface() and PointOnSurface() are synonyms.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_pointonsurface/','','https://mariadb.com/kb/en/library/st_pointonsurface/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (336,24,'ST_SYMDIFFERENCE','Syntax\n------ \nST_SYMDIFFERENCE(g1,g2)\n \nDescription\n----------- \nReturns a geometry that represents the portions of geometry\ng1 and geometry g2 that don\'t intersect.\n \nExamples\n-------- \nSET @g1 = ST_GEOMFROMTEXT(\'LINESTRING(10 20, 10 40)\');\n \nSET @g2 = ST_GEOMFROMTEXT(\'LINESTRING(10 15, 10 25)\');\n \nSELECT ASTEXT(ST_SYMDIFFERENCE(@g1,@g2));\n+----------------------------------------------+\n| ASTEXT(ST_SYMDIFFERENCE(@g1,@g2)) |\n+----------------------------------------------+\n| MULTILINESTRING((10 15,10 20),(10 25,10 40)) |\n+----------------------------------------------+\n \nSET @g2 = ST_GeomFromText(\'LINESTRING(10 20, 10 41)\');\n \nSELECT ASTEXT(ST_SYMDIFFERENCE(@g1,@g2));\n+-----------------------------------+\n| ASTEXT(ST_SYMDIFFERENCE(@g1,@g2)) |\n+-----------------------------------+\n| LINESTRING(10 40,10 41) |\n+-----------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_symdifference/','','https://mariadb.com/kb/en/library/st_symdifference/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (337,24,'ST_UNION','Syntax\n------ \nST_UNION(g1,g2)\n \nDescription\n----------- \nReturns a geometry that is the union of the geometry g1 and\ngeometry g2.\n \nExamples\n-------- \nSET @g1 = GEOMFROMTEXT(\'POINT (0 2)\');\n \nSET @g2 = GEOMFROMTEXT(\'POINT (2 0)\');\n \nSELECT ASTEXT(ST_UNION(@g1,@g2));\n+---------------------------+\n| ASTEXT(ST_UNION(@g1,@g2)) |\n+---------------------------+\n| MULTIPOINT(2 0,0 2) |\n+---------------------------+\n \nSET @g1 = GEOMFROMTEXT(\'POLYGON((0 0,0 3,3 3,3 0,0 0))\');\n \nSET @g2 = GEOMFROMTEXT(\'POLYGON((2 2,4 2,4 4,2 4,2 2))\');\n \nSELECT ASTEXT(ST_UNION(@g1,@g2));\n+------------------------------------------------+\n| ASTEXT(ST_UNION(@g1,@g2)) |\n+------------------------------------------------+\n| POLYGON((0 0,0 3,2 3,2 4,4 4,4 2,3 2,3 0,0 0)) |\n+------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_union/','','https://mariadb.com/kb/en/library/st_union/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (338,26,'BINLOG','Syntax\n------ \nBINLOG \'str\'\n \nDescription\n----------- \nBINLOG is an internal-use statement. It is generated by the\nmysqlbinlog program as the printable representation of\ncertain events\nin binary log files. The \'str\' value is a base 64-encoded\nstring the that server decodes to determine the data change\nindicated by the\ncorresponding event. This statement requires the SUPER\nprivilege. It was added in MySQL 5.1.5.\n \n\n\nURL: https://mariadb.com/kb/en/library/binlog/','','https://mariadb.com/kb/en/library/binlog/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (339,26,'CACHE INDEX','Syntax\n------ \nCACHE INDEX \n tbl_index_list [, tbl_index_list] ...\n IN key_cache_name \n \ntbl_index_list:\n tbl_name [[INDEX|KEY] (index_name[, index_name] ...)]\n \nDescription\n----------- \nThe CACHE INDEX statement assigns table indexes to a\nspecific key\ncache. It is used only for MyISAM tables.\n \nA default key cache exists and cannot be destroyed. To\ncreate more key caches, the key_buffer_size server system\nvariable.\n \nThe associations between tables indexes and key caches are\nlost on server restart. To recreate them automatically, it\nis necessary to configure caches in a configuration file and\ninclude some CACHE INDEX (and optionally LOAD INDEX)\nstatements in the init file.\n \nExamples\n-------- \nThe following statement assigns indexes from the tables t1,\nt2, and t3\nto the key cache named hot_cache:\n \nCACHE 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 \nImplementation (for MyISAM)\n \nNormally CACHE INDEX should not take a long time to execute.\nInternally it\'s implemented the following way:\nFind the right key cache (under\nLOCK_global_system_variables)\nOpen the table with a TL_READ_NO_INSERT lock.\nFlush the original key cache for the given file (under key\ncache lock)\nFlush the new key cache for the given file (safety)\nMove the file to the new key cache (under file share lock)\n \nThe only possible long operations are getting the locks for\nthe table and flushing the original key cache, if there were\nmany key blocks for the file in it.\n \nWe plan to also add CACHE INDEX for Aria tables if there is\na need for this.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/cache-index/','','https://mariadb.com/kb/en/library/cache-index/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (340,26,'FLUSH','Syntax\n------ \nFLUSH [NO_WRITE_TO_BINLOG | LOCAL]\n flush_option [, flush_option] ...\n \nor when flushing tables:\n \nFLUSH [NO_WRITE_TO_BINLOG | LOCAL] TABLES [table_list]\n[table_flush_option]\n \nwhere table_list is a list of tables separated by , (comma).\n \nDescription\n----------- \nThe FLUSH statement clears or reloads various internal\ncaches used by\nMariaDB. To execute FLUSH, you must have the RELOAD\nprivilege. See GRANT.\n \nThe RESET statement is similar to FLUSH. See\nRESET.\n \nYou cannot issue a FLUSH statement from within a stored\nfunction or a trigger. Doing so within a stored procedure is\npermitted, as long as it is not called by a stored function\nor trigger. See Stored Routine Limitations, Stored Function\nLimitations and Trigger Limitations.\n \nIf a listed table is a view, an error like the following\nwill be produced:\n \nERROR 1347 (HY000): \'test.v\' is not BASE TABLE\n \nBy default, FLUSH statements are written to the binary log\nand will be replicated. The NO_WRITE_TO_BINLOG keyword\n(LOCAL is an alias) will ensure the statement is not written\nto the binary log. \n \nThe different flush options are:\n \nOption | Description | \n \nCHANGED_PAGE_BITMAPS | Internal command used for backup\npurposes. See the Information Schema CHANGED_PAGE_BITMAPS\nTable. | \n \nCLIENT_STATISTICS | Reset client statistics (see SHOW\nCLIENT_STATISTICS). | \n \nDES_KEY_FILE | Reloads the DES key file (Specified with the\n--des-key-file startup option). | \n \nHOSTS | Flush the hostname cache (used for converting ip to\nhost names and for unblocking blocked hosts. See\nmax_connect_errors) | \n \nINDEX_STATISTICS | Reset index statistics (see SHOW\nINDEX_STATISTICS). | \n \n[ERROR | ENGINE | GENERAL | SLOW | BINARY | RELAY] LOGS |\nClose and reopen the specified log type, or all log types if\nnone are specified. FLUSH RELAY LOGS [connection-name] can\nbe used to flush the relay logs for a specific connection.\nOnly one connection can be specified per FLUSH command. See\nMulti-source replication. FLUSH ENGINE LOGS will delete all\nunneeded Aria redo logs. | \n \nMASTER | Deprecated option, use RESET MASTER instead. | \n \nPRIVILEGES | Reload all privileges from the privilege tables\nin the mysql database. If the server is started with\n--skip-grant-table option, this will activate the privilege\ntables again. | \n \nQUERY CACHE | Defragment the query cache to better utilize\nits memory. If you want to reset the query cache, you can do\nit with RESET QUERY CACHE. | \n \nQUERY_RESPONSE_TIME | See the QUERY_RESPONSE_TIME plugin. | \n \nSLAVE | Deprecated option, use RESET SLAVE instead. | \n \nSSL | Used to dynamically reinitialize the server\'s TLS\ncontext by reloading the files defined by several TLS system\nvariables. See FLUSH SSL for more information. This command\nwas first added in MariaDB 10.4.1. | \n \nSTATUS | Resets all server status variables that can be\nreset to 0. Not all global status variables support this, so\nnot all global values are reset. See FLUSH STATUS for more\ninformation. | \n \nTABLE | Close tables given as options or all open tables if\nno table list was used. From MariaDB 10.4.1, using without\nany table list will only close tables not in use, and tables\nnot locked by the FLUSH TABLES connection. If there are no\nlocked tables, FLUSH TABLES will be instant and will not\ncause any waits, as it no longer waits for tables in use.\nWhen a table list is provided, from MariaDB 10.4.1, the\nserver will wait for the end of any transactions that are\nusing the tables. Previously, FLUSH TABLES only waited for\nthe statements to complete. | \n \nTABLES | Same as FLUSH TABLE. | \n \nTABLES ... FOR EXPORT | For InnoDB tables, flushes table\nchanges to disk to permit binary table copies while the\nserver is running. Introduced in MariaDB 10.0.8. See FLUSH\nTABLES ... FOR EXPORT for more. | \n \nTABLES WITH READ LOCK | Closes all open tables. New tables\nare only allowed to be opened with read locks until an\nUNLOCK TABLES is given. | \n \nTABLES WITH READ LOCK AND DISABLE CHECKPOINT | As TABLES\nWITH READ LOCK but also disable all checkpoint writes by\ntransactional table engines. This is useful when doing a\ndisk snapshot of all tables. | \n \nTABLE_STATISTICS | Reset table statistics (see SHOW\nTABLE_STATISTICS). | \n \nUSER_RESOURCES | Resets all per hour user resources. This\nenables clients that have exhausted their resources to\nconnect again. | \n \nUSER_STATISTICS | Reset user statistics (see SHOW\nUSER_STATISTICS). | \n \nYou can also use the mysqladmin client to flush things. Use\nmysqladmin --help to examine what flush commands it\nsupports.\n \nFLUSH STATUS\n \nServer status variables can be reset by executing the\nfollowing:\n \nFLUSH STATUS;\n \nGlobal Status Variables that Support FLUSH STATUS\n \nNot all global status variables support being reset by FLUSH\nSTATUS. Currently, the following status variables are reset\nby FLUSH STATUS:\nAborted_clients\nAborted_connects\nAria_pagecache_blocks_not_flushed\nAria_pagecache_blocks_unused\nAria_pagecache_blocks_used\nBinlog_cache_disk_use\nBinlog_cache_use\nBinlog_stmt_cache_disk_use\nBinlog_stmt_cache_use\nConnection_errors_accept\nConnection_errors_internal\nConnection_errors_max_connections\nConnection_errors_peer_address\nConnection_errors_select\nConnection_errors_tcpwrap\nCreated_tmp_files\nDelayed_errors\nDelayed_writes\nFeature_check_constraint\nFeature_delay_key_write\nMax_used_connections\nOpened_plugin_libraries\nPerformance_schema_accounts_lost\nPerformance_schema_cond_instances_lost\nPerformance_schema_digest_lost\nPerformance_schema_file_handles_lost\nPerformance_schema_file_instances_lost\nPerformance_schema_hosts_lost\nPerformance_schema_locker_lost\nPerformance_schema_mutex_instances_lost\nPerformance_schema_rwlock_instances_lost\nPerformance_schema_session_connect_attrs_lost\nPerformance_schema_socket_instances_lost\nPerformance_schema_stage_classes_lost\nPerformance_schema_statement_classes_lost\nPerformance_schema_table_handles_lost\nPerformance_schema_table_instances_lost\nPerformance_schema_thread_instances_lost\nPerformance_schema_users_lost\nQcache_hits\nQcache_inserts\nQcache_lowmem_prunes\nQcache_not_cached\nRpl_semi_sync_master_no_times\nRpl_semi_sync_master_no_tx\nRpl_semi_sync_master_timefunc_failures\nRpl_semi_sync_master_wait_pos_backtraverse\nRpl_semi_sync_master_yes_tx\nRpl_transactions_multi_engine\nServer_audit_writes_failed\nSlave_retried_transactions\nSlow_launch_threads\nSsl_accept_renegotiates\nSsl_accepts\nSsl_callback_cache_hits\nSsl_client_connects\nSsl_connect_renegotiates\nSsl_ctx_verify_depth\nSsl_ctx_verify_mode\nSsl_finished_accepts\nSsl_finished_connects\nSsl_session_cache_hits\nSsl_session_cache_misses\nSsl_session_cache_overflows\nSsl_session_cache_size\nSsl_session_cache_timeouts\nSsl_sessions_reused\nSsl_used_session_cache_entries\nSubquery_cache_hit\nSubquery_cache_miss\nTable_locks_immediate\nTable_locks_waited\nTc_log_max_pages_used\nTc_log_page_waits\nTransactions_gtid_foreign_engine\nTransactions_multi_engine\n \nFLUSH SSL\n \nThe FLUSH SSL command was first added in MariaDB 10.4.\n \nIn MariaDB 10.4 and later, the FLUSH SSL command can be used\nto dynamically reinitialize the server\'s TLS context. This\nis most useful if you need to replace a certificate that is\nabout to expire without restarting the server.\n \nThis operation is performed by reloading the files defined\nby the following TLS system variables:\nssl_cert\nssl_key\nssl_ca\nssl_capath\nssl_crl\nssl_crlpath\n \nThese TLS system variables are not dynamic, so their values\ncan not be changed without restarting the server.\n \nIf you want to dynamically reinitialize the server\'s TLS\ncontext, then you need to change the certificate and key\nfiles at the relevant paths defined by these TLS system\nvariables, without actually changing the values of the\nvariables. See MDEV-19341 for more information.\n \nReducing Memory Usage\n \nTo flush some of the global caches that take up memory, you\ncould execute the following command:\n \nFLUSH LOCAL HOSTS,\n QUERY CACHE, \n TABLE_STATISTICS, \n INDEX_STATISTICS, \n USER_STATISTICS;\n \n\n \n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/flush/','','https://mariadb.com/kb/en/library/flush/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (341,26,'FLUSH QUERY CACHE','Description\n----------- \nYou can defragment the query cache to better utilize its\nmemory with\nthe FLUSH QUERY CACHE statement. The statement does not\nremove any queries from the cache.\n \nThe RESET QUERY CACHE statement removes all query results\nfrom the query cache.\nThe FLUSH TABLES statement also does this.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/flush-query-cache/','','https://mariadb.com/kb/en/library/flush-query-cache/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (342,26,'FLUSH TABLES FOR EXPORT','FLUSH TABLES ... FOR EXPORT was introduced in MariaDB\n10.0.8.\n \nSyntax\n------ \nFLUSH TABLES table_name [, table_name] FOR EXPORT\n \nDescription\n----------- \nFLUSH TABLES ... FOR EXPORT flushes changes to the specified\ntables to disk so that binary copies can be made while the\nserver is still running. This works for Archive, Aria, CSV,\nInnoDB, MyISAM, MERGE, and XtraDB tables.\n \nThe table is read locked until one has issued UNLOCK TABLES.\n \nIf a storage engine does not support FLUSH TABLES FOR\nEXPORT, a 1031 error (SQLSTATE \'HY000\') is produced.\n \nIf FLUSH TABLES ... FOR EXPORT is in effect in the session,\nthe following statements will produce an error if attempted:\nFLUSH TABLES WITH READ LOCK\nFLUSH TABLES ... WITH READ LOCK\nFLUSH TABLES ... FOR EXPORT\nAny statement trying to update any table\n \nIf any of the following statements is in effect in the\nsession, attempting FLUSH TABLES ... FOR EXPORT will\nproduce an error.\nFLUSH TABLES ... WITH READ LOCK\nFLUSH TABLES ... FOR EXPORT\nLOCK TABLES ... READ\nLOCK TABLES ... WRITE\n \nFLUSH FOR EXPORT is not written to the binary log.\n \nThis statement requires the RELOAD and the LOCK TABLES\nprivileges.\n \nIf one of the specified tables cannot be locked, none of the\ntables will be locked.\n \nIf a table does not exist, an error like the following will\nbe produced:\n \nERROR 1146 (42S02): Table \'test.xxx\' doesn\'t exist\n \nIf a table is a view, an error like the following will be\nproduced:\n \nERROR 1347 (HY000): \'test.v\' is not BASE TABLE\n \nExample\n \nFLUSH TABLES test.t1 FOR EXPORT;\n# Copy files related to the table (see below)\nUNLOCK TABLES;\n \nFor a full description, please see copying MariaDB tables.\n \n\n\nURL:\nhttps://mariadb.com/kb/en/library/flush-tables-for-export/','','https://mariadb.com/kb/en/library/flush-tables-for-export/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (343,26,'HELP Command','Syntax\n------ \nHELP search_string\n \nDescription\n----------- \nThe HELP command can be used in any MariaDB client, such as\nthe mysql command-line client, to get basic syntax help and\na short description for most commands and functions. \n \nIf you provide an argument to the HELP command, the mysql\nclient uses it as a search string to access server-side\nhelp. The proper operation of this command requires that the\nhelp tables in the mysql database be initialized with help\ntopic information.\n \nIf there is no match for the search string, the search\nfails. Use help contents to see a list of the help\ncategories:\n \nHELP contents\nYou asked for help about help category: \"Contents\"\nFor more information, type \'help \', where is one of the\nfollowing\ncategories:\n \n Account Management\n Administration\n Compound Statements\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 Table Maintenance\n Transactions\n User-Defined Functions\n Utility\n \nIf a search string matches multiple items, MariaDB shows a\nlist of matching topics:\n \nHELP create\nMany help items for your request exist.\nTo make a more specific request, please type \'help \',\nwhere is one of the following\ntopics:\n CREATE DATABASE\n CREATE EVENT\n CREATE FUNCTION\n CREATE FUNCTION UDF\n CREATE INDEX\n CREATE PROCEDURE\n CREATE SERVER\n CREATE TABLE\n CREATE TABLESPACE\n CREATE TRIGGER\n CREATE USER\n CREATE VIEW\n SHOW\n SHOW CREATE DATABASE\n SHOW CREATE EVENT\n SHOW CREATE FUNCTION\n SHOW CREATE PROCEDURE\n SHOW CREATE TABLE\n SPATIAL\n \nThen you can enter a topic as the search string to see the\nhelp entry for that topic.\n \nThe help is provided with the MariaDB server and makes use\nof four help tables found in the mysql database:\nhelp_relation, help_topic, help_category and help_keyword.\nThese tables are populated by the mysql_install_db or\nfill_help_table.sql scripts which currently contain data\ngenerated from an old version of MySQL.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/help-command/','','https://mariadb.com/kb/en/library/help-command/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (344,26,'KILL [CONNECTION | QUERY]','Syntax\n------ \nKILL [HARD | SOFT] [CONNECTION | QUERY [ID] ] [thread_id |\nUSER user_name | query_id]\n \nMariaDB 5.3.2\n \nThe options HARD | SOFT and USER username were introduced in\nMariaDB 5.3.2\n \nMariaDB 10.0.5\n \nKILL QUERY ID query_id, which permits killing a query by\nquery id rather than thread id, was introduced in MariaDB\n10.0.5.\n \nDescription\n----------- \nEach connection to mysqld runs in a separate thread. You can\nsee which threads\nare running with the SHOW PROCESSLIST statement and kill a\nthread with the KILL thread_id statement. \nKILL allows the optional CONNECTION or\nQUERY modifier:\nKILL CONNECTION is the same as KILL with no\n modifier: It terminates the connection associated with the\ngiven thread or query id.\nKILL QUERY terminates the statement that the connection\nthread_id is\n currently executing, but leaves the connection itself\nintact.\nKILL QUERY ID (introduced in MariaDB 10.0.5) terminates the\nquery by query_id, leaving the connection intact.\n \nIf a connection is terminated that has an active\ntransaction, the transaction will be rolled back. If only a\nquery is killed, the current transaction will stay active.\nSee also idle_transaction_timeout.\n \nIf you have the PROCESS privilege, you can see all threads.\nIf\nyou have the SUPER privilege, you can kill all threads and\nstatements. Otherwise, you can see and kill only your own\nthreads and\nstatements.\n \nKilling queries that repair or create indexes on MyISAM and\nAria tables may result in corrupted tables. Use the SOFT\noption to avoid this!\n \nThe HARD option (default) kills a command as soon as\npossible. If you use\nSOFT, then critical operations that may leave a table in an\ninconsistent state will not be interrupted. Such operations\ninclude REPAIR and INDEX creation for MyISAM and Aria tables\n(REPAIR TABLE, OPTIMIZE TABLE).\n \nKILL ... USER username will kill all connections/queries for\na\ngiven user. USER can be specified one of the following ways:\nusername (Kill without regard to hostname)\nusername@hostname\nCURRENT_USER or CURRENT_USER()\n \nIf you specify a thread id and that thread does not exist,\nyou get the following error:\n \nERROR 1094 (HY000): Unknown thread id: \n \nIf you specify a query id that doesn\'t exist, you get the\nfollowing error:\n \nERROR 1957 (HY000): Unknown query id: \n \nHowever, if you specify a user name, no error is issued for\nnon-connected (or even non-existing) users. To check if the\nconnection/query has been killed, you can use the\nROW_COUNT() function.\n \nA client whose connection is killed receives the following\nerror:\n \nERROR 1317 (70100): Query execution was interrupted\n \nTo obtain a list of existing sessions, use the SHOW\nPROCESSLIST statement or query the Information Schema\nPROCESSLIST table.\n \nNote: You cannot use KILL with the Embedded MySQL Server\nlibrary because the embedded server merely runs inside the\nthreads of the host\napplication. It does not create any connection threads of\nits own.\n \nNote: You can also use \nmysqladmin kill thread_id [,thread_id...]\nto kill connections. To get a list of running queries,\nuse mysqladmin processlist. See mysqladmin.\n \nPercona Toolkit contains a program, pt-kill that can be used\nto automatically kill connections that match certain\ncriteria. For example, it can be used to terminate idle\nconnections, or connections that have been busy for more\nthan 60 seconds.\n \n\n\nURL:\nhttps://mariadb.com/kb/en/library/data-manipulation-kill-connection-query/','','https://mariadb.com/kb/en/library/data-manipulation-kill-connection-query/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (345,26,'LOAD INDEX','Syntax\n------ \nLOAD INDEX INTO CACHE\n tbl_index_list [, tbl_index_list] ...\n \ntbl_index_list:\n tbl_name\n [[INDEX|KEY] (index_name[, index_name] ...)]\n [IGNORE LEAVES]\n \nDescription\n----------- \nThe LOAD INDEX INTO CACHE statement preloads a table index\ninto the key\ncache to which it has been assigned by an explicit CACHE\nINDEX\nstatement, or into the default key cache otherwise. \nLOAD INDEX INTO CACHE is used only for MyISAM or Aria\ntables. Until MariaDB 5.3, it was not supported for tables\nhaving user-defined partitioning, but this limitation was\nremoved in MariaDB 5.5.\n \nThe IGNORE LEAVES modifier causes only blocks for the\nnonleaf nodes of\nthe index to be preloaded.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/load-index/','','https://mariadb.com/kb/en/library/load-index/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (346,26,'RESET','Syntax\n------ \nRESET reset_option [, reset_option] ...\n \nDescription\n----------- \nThe RESET statement is used to clear the state of various\nserver\noperations. You must have the RELOAD privilege to execute\nRESET.\n \nRESET acts as a stronger version of the FLUSH statement.\n \nThe different RESET options are:\n \nOption | Description | \n \nSLAVE [\"connection_name\"] [ALL] | Deletes all relay logs\nfrom the slave and reset the replication position in the\nmaster binary log. | \n \nMASTER | Deletes all old binary logs, makes the binary index\nfile (--log-bin-index) empty and creates a new binary log\nfile. This is useful when you want to reset the master to an\ninitial state. If you want to just delete old, not used\nbinary logs, you should use the PURGE BINARY LOGS command. |\n\n \nQUERY CACHE | Removes all queries from the query cache. See\nalso FLUSH QUERY CACHE. | \n \n\n \n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/reset/','','https://mariadb.com/kb/en/library/reset/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (347,26,'SET','Syntax\n------ \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 \nOne can also set a user variable in any expression with this\nsyntax:\n \nuser_var_name:= expr\n \nDescription\n----------- \nThe SET statement assigns values to different types of\nvariables that affect the operation of the server or your\nclient. Older\nversions of MySQL employed SET OPTION, but this syntax was\ndeprecated in favor of SET without OPTION, and was removed\nin MariaDB 10.0.\n \nChanging a system variable by using the SET statement does\nnot make the change permanently. To do so, the change must\nbe made in a configuration file.\n \nFor setting variables on a per-query basis (from MariaDB\n10.1.2), see SET STATEMENT.\n \nSee SHOW VARIABLES for documentation on viewing server\nsystem variables.\n \nSee Server System Variables for a list of all the system\nvariables.\n \nGLOBAL / SESSION\n \nWhen setting a system variable, the scope can be specified\nas either GLOBAL or SESSION.\n \nA global variable change affects all new sessions. It does\nnot affect any currently open sessions, including the one\nthat made the change. \n \nA session variable change affects the current session only.\n \nIf the variable has a session value, not specifying either\nGLOBAL or SESSION will be the same as specifying SESSION. If\nthe variable only has a global value, not specifying GLOBAL\nor SESSION will apply to the change to the global value.\n \nDEFAULT\n \nSetting a global variable to DEFAULT will restore it to the\nserver default, and setting a session variable to DEFAULT\nwill restore it to the current global value.\n \nExamples\n-------- \ninnodb_sync_spin_loops is a global variable.\nskip_parallel_replication is a session variable.\nmax_error_count is both global and session.\n \nSELECT VARIABLE_NAME, SESSION_VALUE, GLOBAL_VALUE FROM\n INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE \n VARIABLE_NAME LIKE \'max_error_count\' OR \n VARIABLE_NAME LIKE \'skip_parallel_replication\' OR \n VARIABLE_NAME LIKE \'innodb_sync_spin_loops\';\n \n+---------------------------+---------------+--------------+\n| VARIABLE_NAME | SESSION_VALUE | GLOBAL_VALUE |\n+---------------------------+---------------+--------------+\n| MAX_ERROR_COUNT | 64 | 64 |\n| SKIP_PARALLEL_REPLICATION | OFF | NULL |\n| INNODB_SYNC_SPIN_LOOPS | NULL | 30 |\n+---------------------------+---------------+--------------+\n \nSetting the session values:\n \nSET max_error_count=128;\nQuery OK, 0 rows affected (0.000 sec)\n \nSET skip_parallel_replication=ON;\nQuery OK, 0 rows affected (0.000 sec)\n \nSET innodb_sync_spin_loops=60;\n \nERROR 1229 (HY000): Variable \'innodb_sync_spin_loops\' is a\nGLOBAL variable \n and should be set with SET GLOBAL\n \nSELECT VARIABLE_NAME, SESSION_VALUE, GLOBAL_VALUE FROM\n INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE \n VARIABLE_NAME LIKE \'max_error_count\' OR \n VARIABLE_NAME LIKE \'skip_parallel_replication\' OR \n VARIABLE_NAME LIKE \'innodb_sync_spin_loops\';\n \n+---------------------------+---------------+--------------+\n| VARIABLE_NAME | SESSION_VALUE | GLOBAL_VALUE |\n+---------------------------+---------------+--------------+\n| MAX_ERROR_COUNT | 128 | 64 |\n| SKIP_PARALLEL_REPLICATION | ON | NULL |\n| INNODB_SYNC_SPIN_LOOPS | NULL | 30 |\n+---------------------------+---------------+--------------+\n \nSetting the global values:\n \nSET GLOBAL max_error_count=256;\n \nSET GLOBAL skip_parallel_replication=ON;\n \nERROR 1228 (HY000): Variable \'skip_parallel_replication\'\nis a SESSION variable \n and can\'t be used with SET GLOBAL\n \nSET GLOBAL innodb_sync_spin_loops=120;\n \nSELECT VARIABLE_NAME, SESSION_VALUE, GLOBAL_VALUE FROM\n INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE \n VARIABLE_NAME LIKE \'max_error_count\' OR \n VARIABLE_NAME LIKE \'skip_parallel_replication\' OR \n VARIABLE_NAME LIKE \'innodb_sync_spin_loops\';\n \n+---------------------------+---------------+--------------+\n| VARIABLE_NAME | SESSION_VALUE | GLOBAL_VALUE |\n+---------------------------+---------------+--------------+\n| MAX_ERROR_COUNT | 128 | 256 |\n| SKIP_PARALLEL_REPLICATION | ON | NULL |\n| INNODB_SYNC_SPIN_LOOPS | NULL | 120 |\n+---------------------------+---------------+--------------+\n \nSHOW VARIABLES will by default return the session value\nunless the variable is global only.\n \nSHOW VARIABLES LIKE \'max_error_count\';\n \n+-----------------+-------+\n| Variable_name | Value |\n+-----------------+-------+\n| max_error_count | 128 |\n+-----------------+-------+\n \nSHOW VARIABLES LIKE \'skip_parallel_replication\';\n \n+---------------------------+-------+\n| Variable_name | Value |\n+---------------------------+-------+\n| skip_parallel_replication | ON |\n+---------------------------+-------+\n \nSHOW VARIABLES LIKE \'innodb_sync_spin_loops\';\n \n+------------------------+-------+\n| Variable_name | Value |\n+------------------------+-------+\n| innodb_sync_spin_loops | 120 |\n+------------------------+-------+\n \nUsing the inplace syntax:\n \nSELECT (@a:=1);\n+---------+\n| (@a:=1) |\n+---------+\n| 1 |\n+---------+\n \nSELECT @a;\n \n+------+\n| @a |\n+------+\n| 1 |\n+------+\n \n\n\nURL: https://mariadb.com/kb/en/library/set/','','https://mariadb.com/kb/en/library/set/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (348,26,'About SHOW','SHOW has many forms that provide information about\ndatabases, tables, columns, or status information about the\nserver. These include:\nSHOW AUTHORS\nSHOW CHARACTER SET [like_or_where]\nSHOW COLLATION [like_or_where]\nSHOW [FULL] COLUMNS FROM tbl_name [FROM db_name]\n[like_or_where]\nSHOW CONTRIBUTORS\nSHOW CREATE DATABASE db_name\nSHOW CREATE EVENT event_name\nSHOW CREATE PACKAGE package_name\nSHOW CREATE PACKAGE BODY package_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 [FULL] EVENTS\nSHOW FUNCTION CODE func_name\nSHOW FUNCTION STATUS [like_or_where]\nSHOW GRANTS FOR user\nSHOW INDEX FROM tbl_name [FROM db_name]\nSHOW INNODB STATUS\nSHOW OPEN TABLES [FROM db_name] [like_or_where]\nSHOW PLUGINS\nSHOW PROCEDURE CODE proc_name\nSHOW PROCEDURE STATUS [like_or_where]\nSHOW PRIVILEGES\nSHOW [FULL] PROCESSLIST\nSHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]\nSHOW PROFILES\nSHOW [GLOBAL | SESSION] STATUS [like_or_where]\nSHOW TABLE STATUS [FROM db_name] [like_or_where]\nSHOW 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\nLIKE \'pattern\' part, \'pattern\' is a\nstring that can contain the SQL \"%\" and\n\"_\" wildcard characters. The pattern is useful for\nrestricting statement output to matching values.\n \nSeveral SHOW statements also accept a\nWHERE clause that provides more flexibility in specifying\nwhich rows to display. See Extended Show.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/about-show/','','https://mariadb.com/kb/en/library/about-show/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (349,26,'SHOW AUTHORS','Syntax\n------ \nSHOW AUTHORS\n \nDescription\n----------- \nThe SHOW AUTHORS statement displays information about the\npeople who work on MariaDB. For each author, it displays\nName, Location, and\nComment values. All columns are encoded as latin1.\n \nIn MariaDB 5.5 this is in somewhat random order.\n \nIn MariaDB 10.0.5 and later you have:\nFirst the active people in MariaDB are listed.\nThen the active people in MySQL.\nLast the people that has contributed to MariaDB/MySQL in the\npast.\n \nThe order is somewhat related to importance of the\ncontribution given to the MariaDB project, but this is not\n100% accurate. There is still room for improvements and\ndebate...\n \nExample\n \nSHOW AUTHORS;\n+--------------------------------+---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+\n| Name | Location | Comment |\n+--------------------------------+---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+\n| Michael (Monty) Widenius | Tusby, Finland | Lead developer\nand main author |\n| Sergei Golubchik | Kerpen, Germany | Architect, Full-text\nsearch, precision math, plugin framework, merges etc |\n| Igor Babaev | Bellevue, USA | Optimizer, keycache, core\nwork |\n| Sergey Petrunia | St. Petersburg, Russia | Optimizer |\n| Oleksandr Byelkin | Lugansk, Ukraine | Query Cache (4.0),\nSubqueries (4.1), Views (5.0) |\n| Timour Katchaounov | Sofia , Bulgaria | Optimizer |\n| Kristian Nielsen | Copenhagen, Denmark | Replication,\nAsync client prototocol, General buildbot stuff |\n| Alexander (Bar) Barkov | Izhevsk, Russia | Unicode and\ncharacter sets |\n| Alexey Botchkov (Holyfoot) | Izhevsk, Russia | GIS\nextensions, embedded server, precision math |\n| Daniel Bartholomew | Raleigh, USA | MariaDB documentation\n|\n| Colin Charles | Selangor, Malesia | MariaDB documentation,\ntalks at a LOT of conferences |\n| Sergey Vojtovich | Izhevsk, Russia | initial\nimplementation of plugin architecture, maintained native\nstorage engines (MyISAM, MEMORY, ARCHIVE, etc), rewrite of\ntable cache |\n| Vladislav Vaintroub | Mannheim, Germany | MariaDB Java\nconnector, new thread pool, Windows optimizations |\n| Elena Stepanova | Sankt Petersburg, Russia | QA, test\ncases |\n| Georg Richter | Heidelberg, Germany | New LGPL C\nconnector, PHP connector |\n| Jan Lindström | Ylämylly, Finland | Working on InnoDB |\n| Lixun Peng | Hangzhou, China | Multi Source replication |\n| Percona | CA, USA | XtraDB, microslow patches, extensions\nto slow log \n...\n \nSee Also\n \nSHOW CONTRIBUTORS. This list all members and sponsors of the\nMariaDB Foundation and other sponsors.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-authors/','','https://mariadb.com/kb/en/library/show-authors/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (350,26,'SHOW BINARY LOGS','Syntax\n------ \nSHOW BINARY LOGS\nSHOW MASTER LOGS\n \nDescription\n----------- \nLists the binary log files on the server. This statement is\nused as part of the\nprocedure described in \nPURGE BINARY LOGS, that shows how to\ndetermine which logs can be purged.\n \nExamples\n-------- \nSHOW BINARY LOGS;\n+--------------------+-----------+\n| Log_name | File_size |\n+--------------------+-----------+\n| mariadb-bin.000001 | 19039 |\n| mariadb-bin.000002 | 717389 |\n| mariadb-bin.000003 | 300 |\n| mariadb-bin.000004 | 333 |\n| mariadb-bin.000005 | 899 |\n| mariadb-bin.000006 | 125 |\n| mariadb-bin.000007 | 18907 |\n| mariadb-bin.000008 | 19530 |\n| mariadb-bin.000009 | 151 |\n| mariadb-bin.000010 | 151 |\n| mariadb-bin.000011 | 125 |\n| mariadb-bin.000012 | 151 |\n| mariadb-bin.000013 | 151 |\n| mariadb-bin.000014 | 125 |\n| mariadb-bin.000015 | 151 |\n| mariadb-bin.000016 | 314 |\n+--------------------+-----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-binary-logs/','','https://mariadb.com/kb/en/library/show-binary-logs/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (351,26,'SHOW BINLOG EVENTS','Syntax\n------ \nSHOW BINLOG EVENTS\n [IN \'log_name\'] [FROM pos] [LIMIT [offset,] row_count]\n \nDescription\n----------- \nShows the events in the binary log. If you do not specify\n\'log_name\',\nthe first binary log is displayed.\n \nExample\n \nSHOW BINLOG EVENTS IN \'mysql_sandbox10019-bin.000002\';\n+-------------------------------+-----+-------------------+-----------+-------------+------------------------------------------------+\n| Log_name | Pos | Event_type | Server_id | End_log_pos |\nInfo |\n+-------------------------------+-----+-------------------+-----------+-------------+------------------------------------------------+\n| mysql_sandbox10019-bin.000002 | 4 | Format_desc | 1 | 248\n| Server ver: 10.0.19-MariaDB-log, Binlog ver: 4 |\n| mysql_sandbox10019-bin.000002 | 248 | Gtid_list | 1 | 273\n| [] |\n| mysql_sandbox10019-bin.000002 | 273 | Binlog_checkpoint |\n1 | 325 | mysql_sandbox10019-bin.000002 |\n| mysql_sandbox10019-bin.000002 | 325 | Gtid | 1 | 363 |\nGTID 0-1-1 |\n| mysql_sandbox10019-bin.000002 | 363 | Query | 1 | 446 |\nCREATE DATABASE blog |\n| mysql_sandbox10019-bin.000002 | 446 | Gtid | 1 | 484 |\nGTID 0-1-2 |\n| mysql_sandbox10019-bin.000002 | 484 | Query | 1 | 571 |\nuse `blog`; CREATE TABLE bb (id INT) |\n+-------------------------------+-----+-------------------+-----------+-------------+------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-binlog-events/','','https://mariadb.com/kb/en/library/show-binlog-events/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (352,26,'SHOW CHARACTER SET','Syntax\n------ \nSHOW CHARACTER SET\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \nThe SHOW CHARACTER SET statement shows all available\ncharacter sets. The LIKE clause, if present on its own,\nindicates which character\nset names to match. The WHERE and LIKE clauses can be given\nto select rows using more general conditions, as discussed\nin Extended SHOW.\n \nThe same information can be queried from the\ninformation_schema.CHARACTER_SETS table.\n \nSee Setting Character Sets and Collations for details on\nspecifying the character set at the server, database, table\nand column levels.\n \nExamples\n-------- \nSHOW 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 |\n1 |\n| latin5 | ISO 8859-9 Turkish | latin5_turkish_ci | 1 |\n| latin7 | ISO 8859-13 Baltic | latin7_general_ci | 1 |\n+---------+-----------------------------+-------------------+--------+\n \nSHOW CHARACTER SET WHERE Maxlen LIKE \'2\';\n+---------+---------------------------+-------------------+--------+\n| Charset | Description | Default collation | Maxlen |\n+---------+---------------------------+-------------------+--------+\n| big5 | Big5 Traditional Chinese | big5_chinese_ci | 2 |\n| sjis | Shift-JIS Japanese | sjis_japanese_ci | 2 |\n| euckr | EUC-KR Korean | euckr_korean_ci | 2 |\n| gb2312 | GB2312 Simplified Chinese | gb2312_chinese_ci | 2\n|\n| gbk | GBK Simplified Chinese | gbk_chinese_ci | 2 |\n| ucs2 | UCS-2 Unicode | ucs2_general_ci | 2 |\n| cp932 | SJIS for Windows Japanese | cp932_japanese_ci | 2\n|\n+---------+---------------------------+-------------------+--------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-character-set/','','https://mariadb.com/kb/en/library/show-character-set/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (353,26,'SHOW CLIENT_STATISTICS','MariaDB 5.2 introduced the User Statistics feature.\n \nSyntax\n------ \nSHOW CLIENT_STATISTICS\n \nDescription\n----------- \nThe SHOW CLIENT_STATISTICS statement was introduced in\nMariaDB 5.2 as part of the User Statistics feature. It was\nremoved as a separate statement in MariaDB 10.1.1, but\neffectively replaced by the generic SHOW\ninformation_schema_table statement. The\ninformation_schema.CLIENT_STATISTICS table holds statistics\nabout client connections.\n \nThe userstat system variable must be set to 1 to activate\nthis feature. See the User Statistics and\ninformation_schema.CLIENT_STATISTICS articles for more\ninformation.\n \nExample\n \nFrom MariaDB 10.0:\n \nSHOW CLIENT_STATISTICS\\G\n*************************** 1. row\n***************************\n Client: localhost\n Total_connections: 35\nConcurrent_connections: 0\n Connected_time: 708\n Busy_time: 2.5557979999999985\n Cpu_time: 0.04123740000000002\n Bytes_received: 3883\n Bytes_sent: 21595\n Binlog_bytes_written: 0\n Rows_read: 18\n Rows_sent: 115\n Rows_deleted: 0\n Rows_inserted: 0\n Rows_updated: 0\n Select_commands: 70\n Update_commands: 0\n Other_commands: 0\n Commit_transactions: 1\n Rollback_transactions: 0\n Denied_connections: 0\n Lost_connections: 0\n Access_denied: 0\n Empty_queries: 35\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/show-client-statistics/','','https://mariadb.com/kb/en/library/show-client-statistics/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (354,26,'SHOW COLLATION','Syntax\n------ \nSHOW COLLATION\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \nThe output from SHOW COLLATION includes all available\ncollations. The LIKE clause, if present on its own,\nindicates which collation names to match. The WHERE and LIKE\nclauses can be given to select rows using more general\nconditions, as discussed in Extended SHOW.\n \nThe same information can be queried from the\ninformation_schema.COLLATIONS table.\n \nSee Setting Character Sets and Collations for details on\nspecifying the collation at the server, database, table and\ncolumn levels.\n \nExamples\n-------- \nSHOW COLLATION LIKE \'latin1%\';\n+-------------------+---------+----+---------+----------+---------+\n| Collation | Charset | Id | Default | Compiled | Sortlen |\n+-------------------+---------+----+---------+----------+---------+\n| latin1_german1_ci | latin1 | 5 | | Yes | 1 |\n| latin1_swedish_ci | latin1 | 8 | Yes | Yes | 1 |\n| latin1_danish_ci | latin1 | 15 | | Yes | 1 |\n| latin1_german2_ci | latin1 | 31 | | Yes | 2 |\n| latin1_bin | latin1 | 47 | | Yes | 1 |\n| latin1_general_ci | latin1 | 48 | | Yes | 1 |\n| latin1_general_cs | latin1 | 49 | | Yes | 1 |\n| latin1_spanish_ci | latin1 | 94 | | Yes | 1 |\n+-------------------+---------+----+---------+----------+---------+\n \nSHOW COLLATION WHERE Sortlen LIKE \'8\' AND Charset LIKE\n\'utf8\';\n+--------------------+---------+-----+---------+----------+---------+\n| Collation | Charset | Id | Default | Compiled | Sortlen |\n+--------------------+---------+-----+---------+----------+---------+\n| utf8_unicode_ci | utf8 | 192 | | Yes | 8 |\n| utf8_icelandic_ci | utf8 | 193 | | Yes | 8 |\n| utf8_latvian_ci | utf8 | 194 | | Yes | 8 |\n| utf8_romanian_ci | utf8 | 195 | | Yes | 8 |\n| utf8_slovenian_ci | utf8 | 196 | | Yes | 8 |\n| utf8_polish_ci | utf8 | 197 | | Yes | 8 |\n| utf8_estonian_ci | utf8 | 198 | | Yes | 8 |\n| utf8_spanish_ci | utf8 | 199 | | Yes | 8 |\n| utf8_swedish_ci | utf8 | 200 | | Yes | 8 |\n| utf8_turkish_ci | utf8 | 201 | | Yes | 8 |\n| utf8_czech_ci | utf8 | 202 | | Yes | 8 |\n| utf8_danish_ci | utf8 | 203 | | Yes | 8 |\n| utf8_lithuanian_ci | utf8 | 204 | | Yes | 8 |\n| utf8_slovak_ci | utf8 | 205 | | Yes | 8 |\n| utf8_spanish2_ci | utf8 | 206 | | Yes | 8 |\n| utf8_roman_ci | utf8 | 207 | | Yes | 8 |\n| utf8_persian_ci | utf8 | 208 | | Yes | 8 |\n| utf8_esperanto_ci | utf8 | 209 | | Yes | 8 |\n| utf8_hungarian_ci | utf8 | 210 | | Yes | 8 |\n| utf8_sinhala_ci | utf8 | 211 | | Yes | 8 |\n| utf8_croatian_ci | utf8 | 213 | | Yes | 8 |\n+--------------------+---------+-----+---------+----------+---------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-collation/','','https://mariadb.com/kb/en/library/show-collation/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (355,26,'SHOW COLUMNS','Syntax\n------ \nSHOW [FULL] {COLUMNS | FIELDS} FROM tbl_name [FROM db_name]\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \nSHOW COLUMNS displays information about the columns in a\ngiven table. It also works for views. The LIKE clause, if\npresent on its own, indicates which column names to match.\nThe WHERE and LIKE clauses can be given to select rows using\nmore general conditions, as discussed in Extended SHOW.\n \nIf the data types differ from what you expect them to be\nbased on a\nCREATE TABLE statement, note that MariaDB sometimes changes\ndata types when you create or alter a table. The conditions\nunder which this\noccurs are described in the Silent Column Changes article.\n \nThe FULL keyword causes the output to include the column\ncollation and comments, as well as the privileges you have\nfor each column.\n \nYou can use db_name.tbl_name as an alternative to the\ntbl_name FROM db_name syntax. In other words, these two\nstatements are equivalent:\n \nSHOW COLUMNS FROM mytable FROM mydb;\nSHOW COLUMNS FROM mydb.mytable;\n \nSHOW COLUMNS displays the following values for each table\ncolumn:\n \nField indicates the column name.\n \nType indicates the column data type.\n \nCollation indicates the collation for non-binary string\ncolumns, or\nNULL for other columns. This value is displayed only if you\nuse the\nFULL keyword.\n \nThe Null field contains YES if NULL values can be stored in\nthe column,\nNO if not.\n \nThe Key field indicates whether the column is indexed:\nIf Key is empty, the column either is not indexed or is\nindexed only as a\n secondary column in a multiple-column, non-unique index.\nIf Key is PRI, the column is a PRIMARY KEY or\n is one of the columns in a multiple-column PRIMARY KEY.\nIf Key is UNI, the column is the first column of a\nunique-valued\n index that cannot contain NULL values.\nIf Key is MUL, multiple occurrences of a given value are\nallowed\n within the column. The column is the first column of a\nnon-unique index or a\n unique-valued index that can contain NULL values.\n \nIf more than one of the Key values applies to a given column\nof a\ntable, Key displays the one with the highest priority, in\nthe order\nPRI, UNI, MUL.\n \nA UNIQUE index may be displayed as PRI if\nit cannot contain NULL values and there is no\nPRIMARY KEY in the table. A UNIQUE index\nmay display as MUL if several columns form a composite\nUNIQUE index; although the combination of the columns is\nunique, each column can still hold multiple occurrences of a\ngiven value.\n \nThe Default field indicates the default value that is\nassigned to the\ncolumn.\n \nThe Extra field contains any additional information that is\navailable about a given column.\n \nValue | Description | \n \nAUTO_INCREMENT | The column was created with the\nAUTO_INCREMENT keyword. | \n \nPERSISTENT | The column was created with the PERSISTENT\nkeyword. (New in 5.3) | \n \nVIRTUAL | The column was created with the VIRTUAL keyword.\n(New in 5.3) | \n \non update CURRENT_TIMESTAMP | The column is a TIMESTAMP\ncolumn that is automatically updated on INSERT and UPDATE. |\n\n \nPrivileges indicates the privileges you have for the column.\nThis\nvalue is displayed only if you use the FULL keyword.\n \nComment indicates any comment the column has. This value is\ndisplayed\nonly if you use the FULL keyword.\n \nSHOW FIELDS is a synonym for\nSHOW COLUMNS. Also DESCRIBE and EXPLAIN can be used as\nshortcuts.\n \nYou can also list a table\'s columns with: \n \nmysqlshow db_name tbl_name\n \nSee the mysqlshow command for more details.\n \nThe DESCRIBE statement provides information similar to SHOW\nCOLUMNS. The information_schema.COLUMNS table provides\nsimilar, but more complete, information.\n \nThe SHOW CREATE TABLE, SHOW TABLE STATUS, and SHOW INDEX\nstatements also provide information about tables.\n \nExamples\n-------- \nSHOW 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+------------+----------+------+-----+---------+----------------+\n \nSHOW COLUMNS FROM employees WHERE Type LIKE \'Varchar%\';\n+---------------+-------------+------+-----+---------+-------+\n| Field | Type | Null | Key | Default | Extra |\n+---------------+-------------+------+-----+---------+-------+\n| first_name | varchar(30) | NO | MUL | NULL | |\n| last_name | varchar(40) | NO | | NULL | |\n| position | varchar(25) | NO | | NULL | |\n| home_address | varchar(50) | NO | | NULL | |\n| home_phone | varchar(12) | NO | | NULL | |\n| employee_code | varchar(25) | NO | UNI | NULL | |\n+---------------+-------------+------+-----+---------+-------+\n \n\n\nURL: https://mariadb.com/kb/en/library/show-columns/','','https://mariadb.com/kb/en/library/show-columns/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (356,26,'SHOW CONTRIBUTORS','Syntax\n------ \nSHOW CONTRIBUTORS\n \nDescription\n----------- \nThe SHOW CONTRIBUTORS statement displays information about\nthe companies and people who financially contribute to\nMariaDB. For each contributor, it displays Name, Location,\nand Comment values. All columns are encoded as latin1.\n \nIn MariaDB 5.5 this is in somewhat random order, and the\nfeature was deprecated.\n \nIn MariaDB 10.0.5 it was un-deprecated, and since then\ndisplays all members and sponsors of the MariaDB Foundation\nas well as other financial contributors.\n \nExample\n \nSHOW CONTRIBUTORS;\n+---------------------+-------------------------------+-------------------------------------------------------------+\n| Name | Location | Comment |\n+---------------------+-------------------------------+-------------------------------------------------------------+\n| Booking.com | https://www.booking.com | Founding member,\nPlatinum Sponsor of the MariaDB Foundation |\n| Alibaba Cloud | https://www.alibabacloud.com/ | Platinum\nSponsor of the MariaDB Foundation |\n| Tencent Cloud | https://cloud.tencent.com | Platinum\nSponsor of the MariaDB Foundation |\n| Microsoft | https://microsoft.com/ | Platinum Sponsor of\nthe MariaDB Foundation |\n| MariaDB Corporation | https://mariadb.com | Founding\nmember, Platinum Sponsor of the MariaDB Foundation |\n| Visma | https://visma.com | Gold Sponsor of the MariaDB\nFoundation |\n| DBS | https://dbs.com | Gold Sponsor of the MariaDB\nFoundation |\n| IBM | https://www.ibm.com | Gold Sponsor of the MariaDB\nFoundation |\n| Tencent Games | http://game.qq.com/ | Gold Sponsor of the\nMariaDB Foundation |\n| Nexedi | https://www.nexedi.com | Silver Sponsor of the\nMariaDB Foundation |\n| Acronis | https://www.acronis.com | Silver Sponsor of the\nMariaDB Foundation |\n| Verkkokauppa.com | https://www.verkkokauppa.com | Bronze\nSponsor of the MariaDB Foundation |\n| Virtuozzo | https://virtuozzo.com | Bronze Sponsor of the\nMariaDB Foundation |\n| Tencent Game DBA | http://tencentdba.com/about | Bronze\nSponsor of the MariaDB Foundation |\n| Tencent TDSQL | http://tdsql.org | Bronze Sponsor of the\nMariaDB Foundation |\n| Percona | https://www.percona.com/ | Bronze Sponsor of the\nMariaDB Foundation |\n| Google | USA | Sponsoring encryption, parallel replication\nand GTID |\n| Facebook | USA | Sponsoring non-blocking API, LIMIT ROWS\nEXAMINED etc |\n| Ronald Bradford | Brisbane, Australia | EFF contribution\nfor UC2006 Auction |\n| Sheeri Kritzer | Boston, Mass. USA | EFF contribution for\nUC2006 Auction |\n| Mark Shuttleworth | London, UK. | EFF contribution for\nUC2006 Auction |\n+---------------------+-------------------------------+-------------------------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/show-contributors/','','https://mariadb.com/kb/en/library/show-contributors/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (357,26,'SHOW CREATE DATABASE','Syntax\n------ \nSHOW CREATE {DATABASE | SCHEMA} db_name\n \nDescription\n----------- \nShows the CREATE DATABASE statement that\ncreates the given database. SHOW CREATE SCHEMA is a synonym\nfor SHOW CREATE DATABASE. SHOW CREATE DATABASE quotes\ndatabase names according to the value of the\nsql_quote_show_create server system variable.\n \nExamples\n-------- \nSHOW CREATE DATABASE test;\n+----------+-----------------------------------------------------------------+\n| Database | Create Database |\n+----------+-----------------------------------------------------------------+\n| test | CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER\nSET latin1 */ |\n+----------+-----------------------------------------------------------------+\n \nSHOW CREATE SCHEMA test;\n+----------+-----------------------------------------------------------------+\n| Database | Create Database |\n+----------+-----------------------------------------------------------------+\n| test | CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER\nSET latin1 */ |\n+----------+-----------------------------------------------------------------+\n \nWith sql_quote_show_create off:\n \nSHOW CREATE DATABASE test;\n+----------+---------------------------------------------------------------+\n| Database | Create Database |\n+----------+---------------------------------------------------------------+\n| test | CREATE DATABASE test /*!40100 DEFAULT CHARACTER SET\nlatin1 */ |\n+----------+---------------------------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/show-create-database/','','https://mariadb.com/kb/en/library/show-create-database/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (358,26,'SHOW CREATE EVENT','Syntax\n------ \nSHOW CREATE EVENT event_name\n \nDescription\n----------- \nThis statement displays the CREATE EVENT\nstatement needed to re-create a given event, as well as the\nSQL_MODE that was used when the trigger has been created and\nthe character set used by the connection.. To find out which\nevents are present, use SHOW EVENTS.\n \nThe output of this statement is unreliably affected by the\nsql_quote_show_create server system variable - see\nhttp://bugs.mysql.com/bug.php?id=12719\n \nThe information_schema.EVENTS table provides similar, but\nmore complete, information.\n \nExamples\n-------- \nSHOW CREATE EVENT test.e_daily\\G\n*************************** 1. row\n***************************\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 \n\n\nURL: https://mariadb.com/kb/en/library/show-create-event/','','https://mariadb.com/kb/en/library/show-create-event/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (359,26,'SHOW CREATE FUNCTION','Syntax\n------ \nSHOW CREATE FUNCTION func_name\n \nDescription\n----------- \nThis statement is similar to \nSHOW CREATE PROCEDURE but for\nstored functions.\n \nThe output of this statement is unreliably affected by the\nsql_quote_show_create server system variable - see\nhttp://bugs.mysql.com/bug.php?id=12719\n \nExample\n \nMariaDB [test]> SHOW CREATE FUNCTION VatCents\\G\n*************************** 1. row\n***************************\n Function: VatCents\n sql_mode: \n Create Function: CREATE DEFINER=`root`@`localhost` FUNCTION\n`VatCents`(price DECIMAL(10,2)) RETURNS int(11)\n DETERMINISTIC\nBEGIN\n DECLARE x INT;\n SET x = price * 114;\n RETURN x;\nEND\ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n Database Collation: latin1_swedish_ci\n \n\n\nURL: https://mariadb.com/kb/en/library/show-create-function/','','https://mariadb.com/kb/en/library/show-create-function/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (360,26,'SHOW CREATE PACKAGE','Oracle-style packages were introduced in MariaDB 10.3.5.\n \nSyntax\n------ \nSHOW CREATE PACKAGE [ db_name . ] package_name\n \nDescription\n----------- \nThe SHOW CREATE PACKAGE statement can be used when Oracle\nSQL_MODE is set.\n \nShows the CREATE statement that creates the given package\nspecification.\n \nExamples\n-------- \nSHOW CREATE PACKAGE employee_tools\\G\n*************************** 1. row\n***************************\n Package: employee_tools\n sql_mode:\nPIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUTO_CREATE_USER\n Create Package: CREATE DEFINER=\"root\"@\"localhost\"\nPACKAGE \"employee_tools\" AS\n FUNCTION getSalary(eid INT) RETURN DECIMAL(10,2);\n PROCEDURE raiseSalary(eid INT, amount DECIMAL(10,2));\n PROCEDURE raiseSalaryStd(eid INT);\n PROCEDURE hire(ename TEXT, esalary DECIMAL(10,2));\nEND\ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n Database Collation: latin1_swedish_ci\n \n\n\nURL: https://mariadb.com/kb/en/library/show-create-package/','','https://mariadb.com/kb/en/library/show-create-package/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (361,26,'SHOW CREATE PACKAGE BODY','Oracle-style packages were introduced in MariaDB 10.3.5.\n \nSyntax\n------ \nSHOW CREATE PACKAGE BODY [ db_name . ] package_name\n \nDescription\n----------- \nThe SHOW CREATE PACKAGE BODY statement can be used when\nOracle SQL_MODE is set.\n \nShows the CREATE statement that creates the given package\nbody (i.e. the implementation).\n \nExamples\n-------- \nSHOW CREATE PACKAGE BODY employee_tools\\G\n*************************** 1. row\n***************************\n Package body: employee_tools\n sql_mode:\nPIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUTO_CREATE_USER\n Create Package Body: CREATE DEFINER=\"root\"@\"localhost\"\nPACKAGE BODY \"employee_tools\" AS\n \n stdRaiseAmount DECIMAL(10,2):=500;\n \n PROCEDURE log (eid INT, ecmnt TEXT) AS\n BEGIN\n INSERT INTO employee_log (id, cmnt) VALUES (eid, ecmnt);\n END;\n \n PROCEDURE hire(ename TEXT, esalary DECIMAL(10,2)) AS\n eid INT;\n BEGIN\n INSERT INTO employee (name, salary) VALUES (ename,\nesalary);\n eid:= last_insert_id();\n log(eid, \'hire \' || ename);\n END;\n \n FUNCTION getSalary(eid INT) RETURN DECIMAL(10,2) AS\n nSalary DECIMAL(10,2);\n BEGIN\n SELECT salary INTO nSalary FROM employee WHERE id=eid;\n log(eid, \'getSalary id=\' || eid || \' salary=\' ||\nnSalary);\n RETURN nSalary;\n END;\n \n PROCEDURE raiseSalary(eid INT, amount DECIMAL(10,2)) AS\n BEGIN\n UPDATE employee SET salary=salary+amount WHERE id=eid;\n log(eid, \'raiseSalary id=\' || eid || \' amount=\' ||\namount);\n END;\n \n PROCEDURE raiseSalaryStd(eid INT) AS\n BEGIN\n raiseSalary(eid, stdRaiseAmount);\n log(eid, \'raiseSalaryStd id=\' || eid);\n END;\n \nBEGIN \n log(0, \'Session \' || connection_id() || \' \' ||\ncurrent_user || \' started\');\nEND\ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n Database Collation: latin1_swedish_ci\n \n\n\nURL:\nhttps://mariadb.com/kb/en/library/show-create-package-body/','','https://mariadb.com/kb/en/library/show-create-package-body/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (362,26,'SHOW CREATE PROCEDURE','Syntax\n------ \nSHOW CREATE PROCEDURE proc_name\n \nDescription\n----------- \nThis statement is a MariaDB extension. It returns the exact\nstring that\ncan be used to re-create the named stored procedure, as well\nas the SQL_MODE that was used when the trigger has been\ncreated and the character set used by the connection.. A\nsimilar\nstatement, SHOW CREATE FUNCTION,\ndisplays information about stored functions.\n \nBoth statements require that you are the owner of the\nroutine or have the SELECT privilege on the mysql.proc\ntable. When neither is true, the statements display NULL for\nthe Create Procedure or Create Function field.\n \nWarning Users with SELECT privileges on mysql.proc or USAGE\nprivileges on *.* can view the text of routines, even when\nthey do not have privileges for the function or procedure\nitself.\n \nThe output of these statements is unreliably affected by the\nsql_quote_show_create server system variable - see\nhttp://bugs.mysql.com/bug.php?id=12719\n \nExamples\n-------- \nHere\'s a comparison of the SHOW CREATE PROCEDURE and SHOW\nCREATE FUNCTION statements.\n \nSHOW CREATE PROCEDURE test.simpleproc\\G\n*************************** 1. row\n***************************\n Procedure: simpleproc\n sql_mode: \n Create Procedure: CREATE PROCEDURE `simpleproc`(OUT param1\nINT)\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 \nSHOW CREATE FUNCTION test.hello\\G\n*************************** 1. row\n***************************\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 \nWhen the user issuing the statement does not have privileges\non the routine, attempting to CALL the procedure raises\nError 1370.\n \nCALL test.prc1();\nError 1370 (42000): execute command denieed to user\n\'test_user\'@\'localhost\' for routine \'test\'.\'prc1\'\n \nIf the user neither has privilege to the routine nor the\nSELECT privilege on mysql.proc table, it raises Error 1305,\ninforming them that the procedure does not exist.\n \nSHOW CREATE TABLES test.prc1\\G\nError 1305 (42000): PROCEDURE prc1 does not exist\n \n\n\nURL:\nhttps://mariadb.com/kb/en/library/show-create-procedure/','','https://mariadb.com/kb/en/library/show-create-procedure/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (363,26,'SHOW CREATE SEQUENCE','Sequences were introduced in MariaDB 10.3.\n \nSyntax\n------ \nSHOW CREATE SEQUENCE sequence_name;\n \nDescription\n----------- \nShows the CREATE SEQUENCE statement that created the given\nsequence. The statement requires the SELECT privilege for\nthe table.\n \nExample\n \nCREATE SEQUENCE s1 START WITH 50;\n \nSHOW CREATE SEQUENCE s1\\G;\n \n*************************** 1. row\n***************************\n Table: t1\nCreate Table: CREATE SEQUENCE `s1` start with 50 minvalue 1\nmaxvalue 9223372036854775806\nincrement by 1 cache 1000 nocycle ENGINE=Aria\n \nNotes\n \nIf you want to see the underlying table structure used for\nthe SEQUENCE\nyou can use SHOW CREATE TABLE on the SEQUENCE. You can also\nuse SELECT to read the current recorded state of the\nSEQUENCE:\n \nCREATE SEQUENCE t1;\n \nSHOW CREATE TABLE s1\\G\n*************************** 1. row\n***************************\n Table: s1\nCreate Table: CREATE TABLE `s1` (\n `next_value` bigint(21) NOT NULL COMMENT \'next not cached\nvalue\',\n `min_value` bigint(21) NOT NULL COMMENT \'min value\',\n `max_value` bigint(21) NOT NULL COMMENT \'max value\',\n `start` bigint(21) NOT NULL COMMENT \'start value\',\n `increment` bigint(21) NOT NULL COMMENT \'increment\nvalue\',\n `cache` bigint(21) NOT NULL COMMENT \'cache size\',\n `cycle` tinyint(1) unsigned NOT NULL COMMENT \'cycle\nstate\',\n `round` bigint(21) NOT NULL COMMENT \'How many cycles has\nbeen done\'\n) ENGINE=Aria SEQUENCE=1\n \nSELECT * FROM s1;\n \n+------------+-----------+---------------------+-------+-----------+-------+-------+-------+\n| next_value | min_value | max_value | start | increment |\ncache | cycle | round |\n+------------+-----------+---------------------+-------+-----------+-------+-------+-------+\n| 1 | 1 | 9223372036854775806 | 1 | 1 | 1000 | 0 | 0 |\n+------------+-----------+---------------------+-------+-----------+-------+-------+-------+\n \n\n\nURL: https://mariadb.com/kb/en/library/show-create-sequence/','','https://mariadb.com/kb/en/library/show-create-sequence/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (364,26,'SHOW CREATE TABLE','Syntax\n------ \nSHOW CREATE TABLE tbl_name\n \nDescription\n----------- \nShows the CREATE TABLE statement that created the given\ntable. The statement requires the SELECT privilege for the\ntable. This statement also works with views and SEQUENCE.\n \nSHOW CREATE TABLE quotes table and\ncolumn names according to the value of the\nsql_quote_show_create server system variable.\n \nMariaDB and MySQL-specific table options, column options,\nand index options are not included in the output of this\nstatement if the NO_TABLE_OPTIONS, NO_FIELD_OPTIONS and\nNO_KEY_OPTIONS SQL_MODE flags are used.\n \nInvalid table options, column options and index options are\nnormally commented out (note, that it is possible to create\na table with invalid options, by altering a table of a\ndifferent engine, where these options were valid). To have\nthem uncommented, enable IGNORE_BAD_TABLE_OPTIONS SQL_MODE.\nRemember that replaying a CREATE TABLE statement with\nuncommented invalid options will fail with an error, unless\nIGNORE_BAD_TABLE_OPTIONS SQL_MODE is in effect.\n \nNote that SHOW CREATE TABLE is not meant to provide metadata\nabout a table. It provides information about how the table\nwas declared, but the real table structure could differ a\nbit. For example, if an index has been declared as HASH, the\nCREATE TABLE statement returned by SHOW CREATE TABLE will\ndeclare that index as HASH; however, it is possible that the\nindex is in fact a BTREE, because the storage engine does\nnot support HASH.\n \nMariaDB 10.2.1 permits TEXT and BLOB data types to be\nassigned a DEFAULT value. As a result, from MariaDB 10.2.1,\nSHOW CREATE TABLE will append a DEFAULT NULL to nullable\nTEXT or BLOB fields if no specific default is provided. \n \nFrom MariaDB 10.2.2, numbers are no longer quoted in the\nDEFAULT clause in SHOW CREATE statement. Previously, MariaDB\nquoted numbers. \n \nExamples\n-------- \nSHOW CREATE TABLE t\\G\n*************************** 1. row\n***************************\n Table: t\nCreate Table: CREATE TABLE `t` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `s` char(60) DEFAULT NULL,\n PRIMARY KEY (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=latin1\n \nWith sql_quote_show_create off:\n \nSHOW CREATE TABLE t\\G\n*************************** 1. row\n***************************\n Table: t\nCreate Table: CREATE TABLE t (\n id int(11) NOT NULL AUTO_INCREMENT,\n s char(60) DEFAULT NULL,\n PRIMARY KEY (id)\n) ENGINE=InnoDB DEFAULT CHARSET=latin1\n \nUnquoted numeric DEFAULTs, from MariaDB 10.2.2:\n \nCREATE TABLE td (link TINYINT DEFAULT 1);\n \nSHOW CREATE TABLE td\\G\n*************************** 1. row\n***************************\n Table: td\nCreate Table: CREATE TABLE `td` (\n `link` tinyint(4) DEFAULT 1\n) ENGINE=InnoDB DEFAULT CHARSET=latin1\n \nQuoted numeric DEFAULTs, until MariaDB 10.2.1:\n \nCREATE TABLE td (link TINYINT DEFAULT 1);\n \nSHOW CREATE TABLE td\\G\n*************************** 1. row\n***************************\n Table: td\nCreate Table: CREATE TABLE `td` (\n `link` tinyint(4) DEFAULT \'1\'\n) ENGINE=InnoDB DEFAULT CHARSET=latin1\n \n\n\nURL: https://mariadb.com/kb/en/library/show-create-table/','','https://mariadb.com/kb/en/library/show-create-table/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (365,26,'SHOW CREATE TRIGGER','Syntax\n------ \nSHOW CREATE TRIGGER trigger_name\n \nDescription\n----------- \nThis statement shows a CREATE TRIGGER\nstatement that creates the given trigger, as well as the\nSQL_MODE that was used when the trigger has been created and\nthe character set used by the connection.\n \nThe output of this statement is unreliably affected by the\nsql_quote_show_create server system variable - see\nhttp://bugs.mysql.com/bug.php?id=12719\n \nExamples\n-------- \nSHOW CREATE TRIGGER example\\G\n*************************** 1. row\n***************************\n Trigger: example\n sql_mode:\nONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,STRICT_ALL_TABLES\n,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_\nENGINE_SUBSTITUTION\nSQL Original Statement: CREATE DEFINER=`root`@`localhost`\nTRIGGER example BEFORE\n INSERT ON t FOR EACH ROW\nBEGIN\n SET NEW.c = NEW.c * 2;\nEND\n character_set_client: cp850\n collation_connection: cp850_general_ci\n Database Collation: utf8_general_ci\n Created: 2016-09-29 13:53:34.35\n \nThe Created column was added in MySQL 5.7 and MariaDB 10.2.3\nas part of introducing multiple trigger events per action.\n \n\n\nURL: https://mariadb.com/kb/en/library/show-create-trigger/','','https://mariadb.com/kb/en/library/show-create-trigger/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (366,26,'SHOW CREATE USER','SHOW CREATE USER was introduced in MariaDB 10.2.0\n \nSyntax\n------ \nSHOW CREATE USER user_name\n \nDescription\n----------- \nShows the CREATE USER statement that created the given\nuser. The statement requires the SELECT privilege for the\nmysql database, except for the current user.\n \nExamples\n-------- \nCREATE USER foo4@test require cipher \'text\' \n issuer \'foo_issuer\' subject \'foo_subject\';\n \nSHOW CREATE USER foo4@test\\G\n*************************** 1. row\n***************************\nCREATE USER \'foo4\'@\'test\' \n REQUIRE ISSUER \'foo_issuer\' \n SUBJECT \'foo_subject\' \n CIPHER \'text\'\n \nUser Password Expiry:\n \nCREATE USER \'monty\'@\'localhost\' PASSWORD EXPIRE INTERVAL\n120 DAY;\n \nSHOW CREATE USER \'monty\'@\'localhost\';\n \n+------------------------------------------------------------------+\n| CREATE USER for monty@localhost |\n+------------------------------------------------------------------+\n| CREATE USER \'monty\'@\'localhost\' PASSWORD EXPIRE\nINTERVAL 120 DAY |\n+------------------------------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/show-create-user/','','https://mariadb.com/kb/en/library/show-create-user/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (367,26,'SHOW CREATE VIEW','Syntax\n------ \nSHOW CREATE VIEW view_name\n \nDescription\n----------- \nThis statement shows a CREATE VIEW statement that creates\nthe given view, as well as the character set used by the\nconnection when the view was created. This statement\nalso works with views.\n \nSHOW CREATE VIEW quotes table, column and stored function\nnames according to the value of the sql_quote_show_create\nserver system variable.\n \nExamples\n-------- \nSHOW CREATE VIEW example\\G\n*************************** 1. row\n***************************\n View: example\n Create View: CREATE ALGORITHM=UNDEFINED\nDEFINER=`root`@`localhost` SQL\nSECURITY DEFINER VIEW `example` AS (select `t`.`id` AS\n`id`,`t`.`s` AS `s` from\n`t`)\ncharacter_set_client: cp850\ncollation_connection: cp850_general_ci\n \nWith sql_quote_show_create off:\n \nSHOW CREATE VIEW example\\G\n*************************** 1. row\n***************************\n View: example\n Create View: CREATE ALGORITHM=UNDEFINED\nDEFINER=root@localhost SQL SECU\nRITY DEFINER VIEW example AS (select t.id AS id,t.s AS s\nfrom t)\ncharacter_set_client: cp850\ncollation_connection: cp850_general_ci\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-create-view/','','https://mariadb.com/kb/en/library/show-create-view/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (368,26,'SHOW DATABASES','Syntax\n------ \nSHOW {DATABASES | SCHEMAS}\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \nSHOW DATABASES lists the databases on the MariaDB server\nhost.\nSHOW SCHEMAS is a synonym for \nSHOW DATABASES. The LIKE clause, if\npresent on its own, indicates which database names to match.\nThe WHERE and LIKE clauses can be given to select rows using\nmore general conditions, as discussed in Extended SHOW.\n \nYou see only those databases for which you have some kind of\nprivilege, unless you have the global \nSHOW DATABASES privilege. You\ncan also get this list using the mysqlshow command.\n \nIf the server was started with the --skip-show-database\noption, you cannot use this statement at all unless you have\nthe\nSHOW DATABASES privilege.\n \nExample\n \nSHOW DATABASES;\n+--------------------+\n| Database |\n+--------------------+\n| information_schema |\n| mysql |\n| performance_schema |\n| test |\n+--------------------+\n \nSHOW DATABASES LIKE \'m%\';\n+---------------+\n| Database (m%) |\n+---------------+\n| mysql |\n+---------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-databases/','','https://mariadb.com/kb/en/library/show-databases/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (369,26,'SHOW ENGINE','Syntax\n------ \nSHOW ENGINE engine_name {STATUS | MUTEX}\n \nDescription\n----------- \nSHOW ENGINE displays operational information about a storage\nengine. The following statements currently are supported:\n \nSHOW ENGINE INNODB STATUS\nSHOW ENGINE INNODB MUTEX\nSHOW ENGINE PERFORMANCE_SCHEMA STATUS\n \nIf the Sphinx Storage Engine is installed, the following is\nalso supported:\n \nSHOW ENGINE SPHINX STATUS\n \nSee SHOW ENGINE SPHINX STATUS.\n \nOlder (and now removed) synonyms were SHOW INNODB STATUS\nfor SHOW ENGINE INNODB STATUS and \nSHOW MUTEX STATUS for \nSHOW ENGINE INNODB MUTEX.\n \nSHOW ENGINE BDB LOGS formerly displayed status information\nabout BDB log files. It was deprecated in MySQL 5.1.12 and\nremoved in MariaDB and MySQL 5.5, so now produces an error.\n \nSHOW ENGINE INNODB STATUS\n \nSHOW ENGINE INNODB STATUS displays extensive information\nfrom the standard InnoDB Monitor about the state of the\nInnoDB storage engine.\nSee SHOW ENGINE INNODB STATUS for more.\n \nSHOW ENGINE INNODB MUTEX\n \nSHOW ENGINE INNODB MUTEX displays InnoDB mutex statistics.\n \nThe statement displays the following output fields:\nType: Always InnoDB.\nName: The source file where the mutex is implemented, and\nthe line number\n in the file where the mutex is created. The line number is\ndependent on the MariaDB version.\nStatus: This field displays the following values if\nUNIV_DEBUG was defined at compilation time (for example, in\ninclude/univ.h in the InnoDB part of the source tree). Only\nthe os_waits value is displayed if UNIV_DEBUG was not\ndefined. Without UNIV_DEBUG, the information on which the\noutput is based is insufficient to distinguish regular\nmutexes and mutexes that protect\n rw-locks (which allow multiple readers or a single writer).\nConsequently, the\n output may appear to contain multiple rows for the same\nmutex.\ncount indicates how many times the mutex was requested.\nspin_waits indicates how many times the spinlock had to run.\nspin_rounds indicates the number of spinlock rounds.\n(spin_rounds divided by\n spin_waits provides the average round count.)\nos_waits indicates the number of operating system waits.\nThis occurs when\n the spinlock did not work (the mutex was not locked during\nthe spinlock and\n it was necessary to yield to the operating system and\nwait).\nos_yields indicates the number of times a the thread trying\nto lock a mutex\n gave up its timeslice and yielded to the operating system\n(on the\n presumption that allowing other threads to run will free\nthe mutex so that\n it can be locked).\nos_wait_times indicates the amount of time (in ms) spent in\noperating system\n waits, if the timed_mutexes system variable is 1 (ON). If\ntimed_mutexes is 0\n (OFF), timing is disabled, so os_wait_times is 0.\ntimed_mutexes is off by\n default.\n \nInformation from this statement can be used to diagnose\nsystem problems. For\nexample, large values of spin_waits and spin_rounds may\nindicate scalability\nproblems.\n \nThe information_schema.INNODB_MUTEXES table provides similar\ninformation.\n \nSHOW ENGINE PERFORMANCE_SCHEMA STATUS\n \nThis statement shows how much memory is used for\nperformance_schema tables and internal buffers.\n \nThe output contains the following fields:\nType: Always performance_schema.\nName: The name of a table, the name of an internal buffer,\nor the performance_schema word, followed by a dot and an\nattribute. Internal buffers names are enclosed by\nparenthesis. performance_schema means that the attribute\nrefers to the whole database (it is a total). \nStatus: The value for the attribute.\n \nThe following attributes are shown, in this order, for all\ntables:\nrow_size: The memory used for an individual record. This\nvalue will never change.\nrow_count: The number of rows in the table or buffer. For\nsome tables, this value depends on a server system variable.\nmemory: For tables and performance_schema, this is the\nresult of row_size * row_count.\n \nFor internal buffers, the attributes are:\ncount\nsize\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-engine/','','https://mariadb.com/kb/en/library/show-engine/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (370,26,'SHOW ENGINE INNODB STATUS','SHOW ENGINE INNODB STATUS is a specific form of the SHOW\nENGINE statement that displays the InnoDB Monitor output,\nwhich is extensive InnoDB information which can be useful in\ndiagnosing problems.\n \nThe following sections are displayed\nStatus: Shows the timestamp, monitor name and the number of\nseconds, or the elapsed time between the current time and\nthe time the InnoDB Monitor output was last displayed. The\nper-second averages are based upon this time.\nBACKGROUND THREAD: srv_master_thread lines show work\nperformed by the main background thread.\nSEMAPHORES: Threads waiting for a semaphore and stats on how\nthe number of times threads have needed a spin or a wait on\na mutex or rw-lock semaphore. If this number of threads is\nlarge, there may be I/O or contention issues. Reducing the\nsize of the innodb_thread_concurrency system variable may\nhelp if contention is related to thread scheduling. Spin\nrounds per wait shows the number of spinlock rounds per OS\nwait for a mutex. \nLATEST FOREIGN KEY ERROR: Only shown if there has been a\nforeign key constraint error, it displays the failed\nstatement and information about the constraint and the\nrelated tables.\nLATEST DETECTED DEADLOCK: Only shown if there has been a\ndeadlock, it displays the transactions involved in the\ndeadlock and the statements being executed, held and\nrequired locked and the transaction rolled back to.\nTRANSACTIONS: The output of this section can help identify\nlock contention, as well as reasons for the deadlocks.\nFILE I/O: InnoDB thread information as well as pending I/O\noperations and I/O performance statistics.\nINSERT BUFFER AND ADAPTIVE HASH INDEX: InnoDB insert buffer\nand adaptive hash index status information, including the\nnumber of each type of operation performed, and adaptive\nhash index performance.\nLOG: InnoDB log information, including current log sequence\nnumber, how far the log has been flushed to disk, the\nposition at which InnoDB last took a checkpoint, pending\nwrites and write performance statistics.\nBUFFER POOL AND MEMORY: Information on buffer pool pages\nread and written, which allows you to see the number of data\nfile I/O operations performed by your queries. See InnoDB\nBuffer Pool for more. Similar information is also available\nfrom the INFORMATION_SCHEMA.INNODB_BUFFER_POOL_STATS table.\nROW OPERATIONS:Information about the main thread, including\nthe number and performance rate for each type of row\noperation. \n \nIf the innodb_status_output_locks system variable is set to\n1, extended lock information will be displayed.\n \nExample output:\n \n=====================================\n2016-09-12 04:42:15 7f226145fb00 INNODB MONITOR OUTPUT\n=====================================\nPer second averages calculated from the last 29 seconds\n-----------------\nBACKGROUND THREAD\n-----------------\nsrv_master_thread loops: 0 srv_active, 0 srv_shutdown, 527\nsrv_idle\nsrv_master_thread log flush and writes: 527\n----------\nSEMAPHORES\n----------\nOS WAIT ARRAY INFO: reservation count 4\nOS WAIT ARRAY INFO: signal count 4\nMutex spin waits 2, rounds 60, OS waits 2\nRW-shared spins 2, rounds 60, OS waits 2\nRW-excl spins 0, rounds 0, OS waits 0\nSpin rounds per wait: 30.00 mutex, 30.00 RW-shared, 0.00\nRW-excl\n------------\nTRANSACTIONS\n------------\nTrx id counter 2308\nPurge done for trx\'s n:o < 0 undo n:o < 0 state: running\nbut idle\nHistory list length 0\nLIST OF TRANSACTIONS FOR EACH SESSION:\n---TRANSACTION 0, not started\nMySQL thread id 3, OS thread handle 0x7f226145fb00, query id\n4 localhost root init\nSHOW ENGINE INNODB STATUS\n--------\nFILE I/O\n--------\nI/O thread 0 state: waiting for completed aio requests\n(insert buffer thread)\nI/O thread 1 state: waiting for completed aio requests (log\nthread)\nI/O thread 2 state: waiting for completed aio requests (read\nthread)\nI/O thread 3 state: waiting for completed aio requests (read\nthread)\nI/O thread 4 state: waiting for completed aio requests (read\nthread)\nI/O thread 5 state: waiting for completed aio requests (read\nthread)\nI/O thread 6 state: waiting for completed aio requests\n(write thread)\nI/O thread 7 state: waiting for completed aio requests\n(write thread)\nI/O thread 8 state: waiting for completed aio requests\n(write thread)\nI/O thread 9 state: waiting for completed aio requests\n(write thread)\nPending normal aio reads: 0 [0, 0, 0, 0] , aio writes: 0 [0,\n0, 0, 0] ,\n ibuf aio reads: 0, log i/o\'s: 0, sync i/o\'s: 0\nPending flushes (fsync) log: 0; buffer pool: 0\n172 OS file reads, 5 OS file writes, 5 OS fsyncs\n0.00 reads/s, 0 avg bytes/read, 0.00 writes/s, 0.00 fsyncs/s\n-------------------------------------\nINSERT BUFFER AND ADAPTIVE HASH INDEX\n-------------------------------------\nIbuf: size 1, free list len 0, seg size 2, 0 merges\nmerged operations:\n insert 0, delete mark 0, delete 0\ndiscarded operations:\n insert 0, delete mark 0, delete 0\n0.00 hash searches/s, 0.00 non-hash searches/s\n---\nLOG\n---\nLog sequence number 1616829\nLog flushed up to 1616829\nPages flushed up to 1616829\nLast checkpoint at 1616829\nMax checkpoint age 80826164\nCheckpoint age target 78300347\nModified age 0\nCheckpoint age 0\n0 pending log writes, 0 pending chkp writes\n8 log i/o\'s done, 0.00 log i/o\'s/second\n----------------------\nBUFFER POOL AND MEMORY\n----------------------\nTotal memory allocated 140771328; in additional pool\nallocated 0\nTotal memory allocated by read views 88\nInternal hash tables (constant factor + variable factor)\n Adaptive hash index 2217568 (2213368 + 4200)\n Page hash 139112 (buffer pool 0 only)\n Dictionary cache 630703 (554768 + 75935)\n File system 817648 (812272 + 5376)\n Lock system 333232 (332872 + 360)\n Recovery system 0 (0 + 0)\nDictionary memory allocated 75935\nBuffer pool size 8191\nBuffer pool size, bytes 134201344\nFree buffers 8037\nDatabase pages 154\nOld database pages 0\nModified db pages 0\nPercent of dirty pages(LRU & free pages): 0.000\nMax dirty pages percent: 75.000\nPending reads 0\nPending writes: LRU 0, flush list 0, single page 0\nPages made young 0, not young 0\n0.00 youngs/s, 0.00 non-youngs/s\nPages read 154, created 0, written 1\n0.00 reads/s, 0.00 creates/s, 0.00 writes/s\nNo buffer pool page gets since the last printout\nPages read ahead 0.00/s, evicted without access 0.00/s,\nRandom read ahead 0.00/s\nLRU len: 154, unzip_LRU len: 0\nI/O sum[0]:cur[0], unzip sum[0]:cur[0]\n--------------\nROW OPERATIONS\n--------------\n0 queries inside InnoDB, 0 queries in queue\n0 read views open inside InnoDB\n0 RW transactions active inside InnoDB\n0 RO transactions active inside InnoDB\n0 out of 1000 descriptors used\nMain thread process no. 3337, id 139784957703936, state:\nsleeping\nNumber of rows inserted 0, updated 0, deleted 0, read 0\n0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s\nNumber of system rows inserted 0, updated 0, deleted 0, read\n0\n0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s\n----------------------------\nEND OF INNODB MONITOR OUTPUT\n============================\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/show-engine-innodb-status/','','https://mariadb.com/kb/en/library/show-engine-innodb-status/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (371,26,'SHOW ENGINES','Syntax\n------ \nSHOW [STORAGE] ENGINES\n \nDescription\n----------- \nSHOW ENGINES displays status information about the server\'s\nstorage engines. This is particularly useful for checking\nwhether a storage\nengine is supported, or to see what the default engine is. \nSHOW TABLE TYPES is a deprecated synonym.\n \nThe information_schema.ENGINES table provides the same\ninformation.\n \nSince storage engines are plugins, different information\nabout them is also shown in the information_schema.PLUGINS\ntable and by the SHOW PLUGINS statement.\n \nNote that both MySQL\'s InnoDB and Percona\'s XtraDB\nreplacement are labeled as InnoDB. However, if XtraDB is in\nuse, it will be specified in the COMMENT field. See XtraDB\nand InnoDB. The same applies to FederatedX.\n \nThe output consists of the following columns:\nEngine indicates the engine\'s name.\nSupport indicates whether the engine is installed, and\nwhether it is the default engine for the current session.\nComment is a brief description.\nTransactions, XA and Savepoints indicate whether\ntransactions, XA transactions and transaction savepoints are\nsupported by the engine.\n \nExamples\n-------- \nSHOW ENGINES\\G\n*************************** 1. row\n***************************\n Engine: InnoDB\n Support: DEFAULT\n Comment: Supports transactions, row-level locking, and\nforeign keys\nTransactions: YES\n XA: YES\n Savepoints: YES\n*************************** 2. row\n***************************\n Engine: CSV\n Support: YES\n Comment: CSV storage engine\nTransactions: NO\n XA: NO\n Savepoints: NO\n*************************** 3. row\n***************************\n Engine: MyISAM\n Support: YES\n Comment: MyISAM storage engine\nTransactions: NO\n XA: NO\n Savepoints: NO\n*************************** 4. row\n***************************\n Engine: BLACKHOLE\n Support: YES\n Comment: /dev/null storage engine (anything you write to it\ndisappears)\nTransactions: NO\n XA: NO\n Savepoints: NO\n*************************** 5. row\n***************************\n Engine: FEDERATED\n Support: YES\n Comment: FederatedX pluggable storage engine\nTransactions: YES\n XA: NO\n Savepoints: YES\n*************************** 6. row\n***************************\n Engine: MRG_MyISAM\n Support: YES\n Comment: Collection of identical MyISAM tables\nTransactions: NO\n XA: NO\n Savepoints: NO\n*************************** 7. row\n***************************\n Engine: ARCHIVE\n Support: YES\n Comment: Archive storage engine\nTransactions: NO\n XA: NO\n Savepoints: NO\n*************************** 8. row\n***************************\n Engine: MEMORY\n Support: YES\n Comment: Hash based, stored in memory, useful for temporary\ntables\nTransactions: NO\n XA: NO\n Savepoints: NO\n*************************** 9. row\n***************************\n Engine: PERFORMANCE_SCHEMA\n Support: YES\n Comment: Performance Schema\nTransactions: NO\n XA: NO\n Savepoints: NO\n*************************** 10. row\n***************************\n Engine: Aria\n Support: YES\n Comment: Crash-safe tables with MyISAM heritage\nTransactions: NO\n XA: NO\n Savepoints: NO\n10 rows in set (0.00 sec)\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-engines/','','https://mariadb.com/kb/en/library/show-engines/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (372,26,'SHOW ERRORS','Syntax\n------ \nSHOW ERRORS [LIMIT [offset,] row_count]\nSHOW ERRORS [LIMIT row_count OFFSET offset]\nSHOW COUNT(*) ERRORS\n \nDescription\n----------- \nThis statement is similar to SHOW WARNINGS, except that\ninstead of\ndisplaying errors, warnings, and notes, it displays only\nerrors.\n \nThe LIMIT clause has the same syntax as for the\nSELECT statement.\n \nThe SHOW COUNT(*) ERRORS statement displays the number of\nerrors. You can also retrieve this number from the\nerror_count variable.\n \nSHOW COUNT(*) ERRORS;\nSELECT @@error_count;\n \nThe value of error_count might be greater than the number of\nmessages displayed by SHOW WARNINGS if the max_error_count\nsystem variable is set so low that not all messages are\nstored.\n \nFor a list of MariaDB error codes, see MariaDB Error Codes.\n \nExamples\n-------- \nSELECT f();\nERROR 1305 (42000): FUNCTION f does not exist\n \nSHOW COUNT(*) ERRORS;\n \n+-----------------------+\n| @@session.error_count |\n+-----------------------+\n| 1 |\n+-----------------------+\n \nSHOW ERRORS;\n \n+-------+------+---------------------------+\n| Level | Code | Message |\n+-------+------+---------------------------+\n| Error | 1305 | FUNCTION f does not exist |\n+-------+------+---------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-errors/','','https://mariadb.com/kb/en/library/show-errors/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (373,26,'SHOW EVENTS','Syntax\n------ \nSHOW EVENTS [{FROM | IN} schema_name]\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \nShows information about Event Manager events (created with\nCREATE EVENT). Requires the EVENT privilege. Without any\narguments, SHOW EVENTS lists all of the events in the\ncurrent schema:\n \nSELECT CURRENT_USER(), SCHEMA();\n+----------------+----------+\n| CURRENT_USER() | SCHEMA() |\n+----------------+----------+\n| jon@ghidora | myschema |\n+----------------+----------+\n \nSHOW EVENTS\\G\n*************************** 1. row\n***************************\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 the event action, use SHOW CREATE EVENT instead, or\nlook at the information_schema.EVENTS table.\n \nTo see events for a specific schema, use the FROM clause.\nFor example, to see events for the test schema, use the\nfollowing statement:\n \nSHOW EVENTS FROM test;\n \nThe LIKE clause, if present, indicates which event names to\nmatch. The WHERE clause can be given to select rows using\nmore general conditions, as discussed in Extended Show.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-events/','','https://mariadb.com/kb/en/library/show-events/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (374,26,'SHOW EXPLAIN','The SHOW EXPLAIN command is a new feature in MariaDB 10.0.0.\n \nCommand description\n \nThe SHOW EXPLAIN command allows one to get an EXPLAIN (that\nis, a\ndescription of a query plan) of a query running in a certain\nthread.\n \nThe syntax is:\n \nSHOW EXPLAIN FOR ;\n \nwhich will produce an EXPLAIN output for the query that\nthread number thread_id is running. The thread id can be\nobtained with SHOW PROCESSLIST.\n \nSHOW EXPLAIN FOR 1;\n \n+------+-------------+-------+-------+---------------+------+---------+------+---------+-------------+\n| id | select_type | table | type | possible_keys | key |\nkey_len | ref | rows | Extra |\n+------+-------------+-------+-------+---------------+------+---------+------+---------+-------------+\n| 1 | SIMPLE | tbl | index | NULL | a | 5 | NULL | 1000107 |\nUsing index |\n+------+-------------+-------+-------+---------------+------+---------+------+---------+-------------+\n1 row in set, 1 warning (0.00 sec)\n \nThe output is always accompanied with a warning which shows\nthe query the\ntarget thread is running (this shows what the EXPLAIN is\nfor):\n \nSHOW WARNINGS;\n \n+-------+------+------------------------+\n| Level | Code | Message |\n+-------+------+------------------------+\n| Note | 1003 | select sum(a) from tbl |\n+-------+------+------------------------+\n1 row in set (0.00 sec)\n \nPossible errors\n \nThe output can be only produced if the target thread is\ncurrently running a\nquery, which has a ready query plan. If this is not the\ncase, the output will\nbe:\n \nSHOW EXPLAIN FOR 2;\n \nERROR 1932 (HY000): Target is not running an EXPLAINable\ncommand\n \nYou will get this error when:\nthe target thread is not running a command for which one can\nrun EXPLAIN\nthe target thread is running a command for which one can run\nEXPLAIN, but\nthere is no query plan yet (for example, tables are open and\nlocks are\n acquired before the query plan is produced)\n \n\nDifferences between SHOW EXPLAIN and EXPLAIN outputs\n \nBackground\n \nIn MySQL, EXPLAIN execution takes a slightly different route\nfrom the way\nthe real query (typically the SELECT) is optimized. This is\nunfortunate,\nand has caused a number of bugs in EXPLAIN. (For example,\nsee\nMDEV-326, MDEV-410, and\nlp:1013343.\nlp:992942 is not directly\nabout EXPLAIN, but it also would not have existed if MySQL\ndidn\'t try to delete\nparts of a query plan in the middle of the query) \n \nSHOW EXPLAIN examines a running SELECT, and hence its output\nmay be\nslightly different from what EXPLAIN SELECT would produce.\nWe did our best\nto make sure that either the difference is negligible, or\nSHOW EXPLAIN\'s\noutput is closer to reality than EXPLAIN\'s output.\n \nList of recorded differences\n \nSHOW EXPLAIN may have Extra=\'no matching row in const\ntable\', where EXPLAIN would produce Extra=\'Impossible\nWHERE ...\'\nFor queries with subqueries, SHOW EXPLAIN may print\nselect_type==PRIMARY where regular EXPLAIN used to print\nselect_type==SIMPLE, or vice versa.\n \nRequired permissions\n \nRunning SHOW EXPLAIN requires the same permissions as\nrunning SHOW PROCESSLIST would.\n \n\n\nURL: https://mariadb.com/kb/en/library/show-explain/','','https://mariadb.com/kb/en/library/show-explain/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (375,26,'SHOW FUNCTION CODE','Syntax\n------ \nSHOW FUNCTION CODE func_name\n \nDescription\n----------- \nSHOW FUNCTION CODE shows a representation of the internal\nimplementation of the stored function.\n \nIt is similar to SHOW PROCEDURE CODE but for stored\nfunctions.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-function-code/','','https://mariadb.com/kb/en/library/show-function-code/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (376,26,'SHOW FUNCTION STATUS','Syntax\n------ \nSHOW FUNCTION STATUS\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \nThis statement is similar to \nSHOW PROCEDURE STATUS but for\nstored functions.\n \nThe LIKE clause, if present on its own, indicates which\nfunction names to match. \n \nThe WHERE and LIKE clauses can be given to select rows using\nmore general conditions, as discussed in Extended SHOW.\n \nThe information_schema.ROUTINES table contains more detailed\ninformation.\n \nExamples\n-------- \nShowing all stored functions:\n \nSHOW FUNCTION STATUS\\G\n*************************** 1. row\n***************************\n Db: test\n Name: VatCents\n Type: FUNCTION\n Definer: root@localhost\n Modified: 2013-06-01 12:40:31\n Created: 2013-06-01 12:40:31\n Security_type: DEFINER\n Comment: \ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n Database Collation: latin1_swedish_ci\n \nStored functions whose name starts with \'V\': \n \nSHOW FUNCTION STATUS LIKE \'V%\' \\G\n*************************** 1. row\n***************************\n Db: test\n Name: VatCents\n Type: FUNCTION\n Definer: root@localhost\n Modified: 2013-06-01 12:40:31\n Created: 2013-06-01 12:40:31\n Security_type: DEFINER\n Comment: \ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n Database Collation: latin1_swedish_ci\n \nStored functions with a security type of \'DEFINER\':\n \nSHOW FUNCTION STATUS WHERE Security_type LIKE \'DEFINER\'\n\\G\n*************************** 1. row\n***************************\n Db: test\n Name: VatCents\n Type: FUNCTION\n Definer: root@localhost\n Modified: 2013-06-01 12:40:31\n Created: 2013-06-01 12:40:31\n Security_type: DEFINER\n Comment: \ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n Database Collation: latin1_swedish_ci\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-function-status/','','https://mariadb.com/kb/en/library/show-function-status/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (377,26,'SHOW GRANTS','Users\n \nSyntax\n------ \nSHOW GRANTS [FOR user]\n \nDescription\n----------- \nThis statement lists the GRANT statement or\nstatements that must be issued to duplicate the privileges\nthat are granted to\na MariaDB user account. The account is named using the same\nformat as for the\nGRANT statement; for example,\n\'jeffrey\'@\'localhost\'. If you specify only the user name\npart\nof the account name, a host name part of \'%\' is used. For\nadditional information about specifying account names, see\nGRANT.\n \nSHOW GRANTS FOR \'root\'@\'localhost\';\n+---------------------------------------------------------------------+\n| Grants for root@localhost |\n+---------------------------------------------------------------------+\n| GRANT ALL PRIVILEGES ON *.* TO \'root\'@\'localhost\' WITH\nGRANT OPTION |\n+---------------------------------------------------------------------+\n \nTo list the privileges granted to the account that you are\nusing to\nconnect to the server, you can use any of the following\nstatements:\n \nSHOW GRANTS;\n \nSHOW GRANTS FOR CURRENT_USER;\n \nSHOW GRANTS FOR CURRENT_USER();\n \nIf SHOW GRANTS FOR CURRENT_USER (or any\nof the equivalent syntaxes) is used in DEFINER context (such\nas within a stored procedure that is defined with \n SQL SECURITY DEFINER), the grants displayed are those of\nthe\ndefiner and not the invoker.\n \nNote that the DELETE HISTORY privilege, introduced in\nMariaDB 10.3.4, is displayed as DELETE VERSIONING ROWS when\nrunning SHOW GRANTS (MDEV-17655).\n \nRoles\n \nRoles were introduced in MariaDB 10.0.5.\n \nSyntax\n------ \nSHOW GRANTS [FOR role]\n \nDescription\n----------- \nFrom MariaDB 10.0.5, SHOW GRANTS can also be used to view\nthe privileges granted to a role.\n \nExample\n \nSHOW GRANTS FOR journalist;\n+------------------------------------------+\n| Grants for journalist |\n+------------------------------------------+\n| GRANT USAGE ON *.* TO \'journalist\' |\n| GRANT DELETE ON `test`.* TO \'journalist\' |\n+------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/show-grants/','','https://mariadb.com/kb/en/library/show-grants/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (378,26,'SHOW INDEX','Syntax\n------ \nSHOW {INDEX | INDEXES | KEYS} \n FROM tbl_name [FROM db_name]\n [WHERE expr]\n \nDescription\n----------- \nSHOW INDEX returns table index information. The format\nresembles that of the SQLStatistics call in ODBC.\n \nYou can use db_name.tbl_name as an alternative to the\n tbl_name FROM db_name syntax. These two statements are\n equivalent:\n \nSHOW INDEX FROM mytable FROM mydb;\nSHOW INDEX FROM mydb.mytable;\n \nSHOW KEYS and SHOW INDEXES are synonyms for SHOW INDEX.\n \nYou can also list a table\'s indexes with the following\ncommand: \n \nmysqlshow -k db_name tbl_name\n \nSee mysqlshow for more details.\n \nThe information_schema.STATISTICS table stores similar\ninformation.\n \nThe following fields are returned by SHOW INDEX.\n \nField | Description | \n \nTable | Table name | \n \nNon_unique | 1 if the index permits duplicate values, 0 if\nvalues must be unique. | \n \nKey_name | Index name. The primary key is always named\nPRIMARY. | \n \nSeq_in_index | The column\'s sequence in the index,\nbeginning with 1. | \n \nColumn_name | Column name. | \n \nCollation | Either A, if the column is sorted in ascending\norder in the index, or NULL if it\'s not sorted. | \n \nCardinality | Estimated number of unique values in the\nindex. The cardinality statistics are calculated at various\ntimes, and can help the optimizer make improved decisions. |\n\n \nSub_part | NULL if the entire column is included in the\nindex, or the number of included characters if not. | \n \nPacked | NULL if the index is not packed, otherwise how the\nindex is packed. | \n \nNull | NULL if NULL values are permitted in the column, an\nempty string if NULL\'s are not permitted. | \n \nIndex_type | The index type, which can be BTREE, FULLTEXT,\nHASH or RTREE. See Storage Engine Index Types. | \n \nComment | Other information, such as whether the index is\ndisabled. | \n \nIndex_comment | Contents of the COMMENT attribute when the\nindex was created. | \n \nThe WHERE and LIKE clauses can be given to select rows using\nmore general conditions, as discussed in Extended SHOW.\n \nExamples\n-------- \nCREATE TABLE IF NOT EXISTS `employees_example` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `first_name` varchar(30) NOT NULL,\n `last_name` varchar(40) NOT NULL,\n `position` varchar(25) NOT NULL,\n `home_address` varchar(50) NOT NULL,\n `home_phone` varchar(12) NOT NULL,\n `employee_code` varchar(25) NOT NULL,\n PRIMARY KEY (`id`),\n UNIQUE KEY `employee_code` (`employee_code`),\n KEY `first_name` (`first_name`,`last_name`)\n) ENGINE=Aria;\n \nINSERT INTO `employees_example` (`first_name`, `last_name`,\n`position`, `home_address`, `home_phone`, `employee_code`)\n VALUES\n (\'Mustapha\', \'Mond\', \'Chief Executive Officer\', \'692\nPromiscuous Plaza\', \'326-555-3492\', \'MM1\'),\n (\'Henry\', \'Foster\', \'Store Manager\', \'314 Savage\nCircle\', \'326-555-3847\', \'HF1\'),\n (\'Bernard\', \'Marx\', \'Cashier\', \'1240 Ambient\nAvenue\', \'326-555-8456\', \'BM1\'),\n (\'Lenina\', \'Crowne\', \'Cashier\', \'281 Bumblepuppy\nBoulevard\', \'328-555-2349\', \'LC1\'),\n (\'Fanny\', \'Crowne\', \'Restocker\', \'1023 Bokanovsky\nLane\', \'326-555-6329\', \'FC1\'),\n (\'Helmholtz\', \'Watson\', \'Janitor\', \'944 Soma\nCourt\', \'329-555-2478\', \'HW1\');\n \nSHOW INDEXES FROM employees_example;\n \n+-------------------+------------+---------------+--------------+---------------+-----------+-------------+----------+--------+------+------------+---------+---------------+\n| Table | Non_unique | Key_name | Seq_in_index | Column_name\n| Collation | Cardinality | Sub_part | Packed | Null |\nIndex_type | Comment | Index_comment |\n+-------------------+------------+---------------+--------------+---------------+-----------+-------------+----------+--------+------+------------+---------+---------------+\n| employees_example | 0 | PRIMARY | 1 | id | A | 7 | NULL |\nNULL | | BTREE | | |\n| employees_example | 0 | employee_code | 1 | employee_code\n| A | 7 | NULL | NULL | | BTREE | | |\n| employees_example | 1 | first_name | 1 | first_name | A |\nNULL | NULL | NULL | | BTREE | | |\n| employees_example | 1 | first_name | 2 | last_name | A |\nNULL | NULL | NULL | | BTREE | | |\n+-------------------+------------+---------------+--------------+---------------+-----------+-------------+----------+--------+------+------------+---------+---------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-index/','','https://mariadb.com/kb/en/library/show-index/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (379,26,'SHOW LOCALES','SHOW LOCALES was introduced as part of the Information\nSchema plugin extension in MariaDB 10.1.1.\n \nSHOW LOCALES is used to return locales information as part\nof the Locales plugin. While the information_schema.LOCALES\ntable has 8 columns, the SHOW LOCALES statement will only\ndisplay 4 of them:\n \nExample\n \nSHOW LOCALES;\n+-----+-------+-------------------------------------+------------------------+\n| Id | Name | Description | Error_Message_Language |\n+-----+-------+-------------------------------------+------------------------+\n| 0 | en_US | English - United States | english |\n| 1 | en_GB | English - United Kingdom | english |\n| 2 | ja_JP | Japanese - Japan | japanese |\n| 3 | sv_SE | Swedish - Sweden | swedish |\n...\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-locales/','','https://mariadb.com/kb/en/library/show-locales/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (380,26,'SHOW MASTER STATUS','Syntax\n------ \nSHOW MASTER STATUS\n \nDescription\n----------- \nProvides status information about the binary log files of\nthe master.\n \nThis statement requires the SUPER or the REPLICATION_CLIENT\nprivilege.\n \nTo see information about the current GTIDs in the binary\nlog, use the\ngtid_binlog_pos variable.\n \nExample\n \nSHOW MASTER STATUS;\n+--------------------+----------+--------------+------------------+\n| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |\n+--------------------+----------+--------------+------------------+\n| mariadb-bin.000016 | 475 | | |\n+--------------------+----------+--------------+------------------+\nSELECT @@global.gtid_binlog_pos;\n+--------------------------+\n| @@global.gtid_binlog_pos |\n+--------------------------+\n| 0-1-2 |\n+--------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/show-master-status/','','https://mariadb.com/kb/en/library/show-master-status/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (381,26,'SHOW OPEN TABLES','Syntax\n------ \nSHOW OPEN TABLES [FROM db_name]\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \n SHOW OPEN TABLES lists the non-TEMPORARY\ntables that are currently open in the table cache. See\nhttp://dev.mysql.com/doc/refman/5.1/en/table-cache.html.\n \nThe FROM and LIKE clauses may be used.\n \nThe FROM\nclause, if present, restricts the tables shown to those\npresent in the\ndb_name database. \n \nThe LIKE clause, if\npresent on its own, indicates which table names to match.\nThe WHERE and LIKE clauses can be given to select rows using\nmore general conditions, as discussed in Extended SHOW.\n \nThe following information is returned:\n \nColumn | Description | \n \nDatabase | Database name. | \n \nName | Table name. | \n \nIn_use | Number of table instances being used. | \n \nName_locked | 1 if the table is name-locked, e.g. if it is\nbeing dropped or renamed, otherwise 0. | \n \nBefore MariaDB 5.5, each use of, for example, LOCK TABLE ...\nWRITE would increment In_use for that table. With the\nimplementation of the metadata locking improvements in\nMariaDB 5.5, LOCK TABLE... WRITE acquires a strong MDL lock,\nand concurrent connections will wait on this MDL lock, so\nany subsequent LOCK TABLE... WRITE will not increment\nIn_use.\n \nExample\n \nSHOW OPEN TABLES;\n \n+----------+---------------------------+--------+-------------+\n| Database | Table | In_use | Name_locked |\n+----------+---------------------------+--------+-------------+\n...\n| test | xjson | 0 | 0 |\n| test | jauthor | 0 | 0 |\n| test | locks | 1 | 0 |\n...\n+----------+---------------------------+--------+-------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-open-tables/','','https://mariadb.com/kb/en/library/show-open-tables/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (382,26,'SHOW PACKAGE BODY STATUS','Oracle-style packages were introduced in MariaDB 10.3.5.\n \nSyntax\n------ \nSHOW PACKAGE BODY STATUS\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \nThe SHOW PACKAGE BODY STATUS statement returns\ncharacteristics of stored package bodies (implementations),\nsuch as the database, name, type, creator, creation and\nmodification dates, and character set information. A similar\nstatement, SHOW PACKAGE STATUS, displays information about\nstored package specifications.\n \nThe LIKE clause, if present, indicates which package names\nto match. The WHERE and LIKE clauses can be given to select\nrows using more general conditions, as discussed in Extended\nSHOW.\n \nThe ROUTINES table in the INFORMATION_SCHEMA database\ncontains more detailed information.\n \nExamples\n-------- \nSHOW PACKAGE BODY STATUS LIKE \'pkg1\'\\G\n*************************** 1. row\n***************************\n Db: test\n Name: pkg1\n Type: PACKAGE BODY\n Definer: root@localhost\n Modified: 2018-02-27 14:44:14\n Created: 2018-02-27 14:44:14\n Security_type: DEFINER\n Comment: This is my first package body\ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n Database Collation: latin1_swedish_ci\n \n\n\nURL:\nhttps://mariadb.com/kb/en/library/show-package-body-status/','','https://mariadb.com/kb/en/library/show-package-body-status/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (383,26,'SHOW PACKAGE STATUS','Oracle-style packages were introduced in MariaDB 10.3.5.\n \nSyntax\n------ \nSHOW PACKAGE STATUS\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \nThe SHOW PACKAGE STATUS statement returns characteristics of\nstored package specifications, such as the database, name,\ntype, creator, creation and modification dates, and\ncharacter set information. A similar statement, SHOW PACKAGE\nBODY STATUS, displays information about stored package\nbodies (i.e. implementations).\n \nThe LIKE clause, if present, indicates which package names\nto match. The WHERE and LIKE clauses can be given to select\nrows using more general conditions, as discussed in Extended\nSHOW.\n \nThe ROUTINES table in the INFORMATION_SCHEMA database\ncontains more detailed information.\n \nExamples\n-------- \nSHOW PACKAGE STATUS LIKE \'pkg1\'\\G\n*************************** 1. row\n***************************\n Db: test\n Name: pkg1\n Type: PACKAGE\n Definer: root@localhost\n Modified: 2018-02-27 14:38:15\n Created: 2018-02-27 14:38:15\n Security_type: DEFINER\n Comment: This is my first package\ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n Database Collation: latin1_swedish_ci\n \n\n\nURL: https://mariadb.com/kb/en/library/show-package-status/','','https://mariadb.com/kb/en/library/show-package-status/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (384,26,'SHOW PLUGINS','Syntax\n------ \nSHOW PLUGINS;\n \nDescription\n----------- \n SHOW PLUGINS displays information about installed plugins.\nThe Library column indicates the plugin library - if it is\nNULL, the plugin is built-in and cannot be uninstalled.\n \nThe PLUGINS table in the information_schema database\ncontains more detailed information.\n \nFor specific information about storage engines (a particular\ntype of plugin), see the information_schema.ENGINES table\nand the SHOW ENGINES statement.\n \nExamples\n-------- \nSHOW PLUGINS;\n+----------------------------+----------+--------------------+-------------+---------+\n| Name | Status | Type | Library | License |\n+----------------------------+----------+--------------------+-------------+---------+\n| binlog | ACTIVE | STORAGE ENGINE | NULL | GPL |\n| mysql_native_password | ACTIVE | AUTHENTICATION | NULL |\nGPL |\n| mysql_old_password | ACTIVE | AUTHENTICATION | NULL | GPL\n|\n| MRG_MyISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |\n| MyISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |\n| CSV | ACTIVE | STORAGE ENGINE | NULL | GPL |\n| MEMORY | ACTIVE | STORAGE ENGINE | NULL | GPL |\n| FEDERATED | ACTIVE | STORAGE ENGINE | NULL | GPL |\n| PERFORMANCE_SCHEMA | ACTIVE | STORAGE ENGINE | NULL | GPL\n|\n| Aria | ACTIVE | STORAGE ENGINE | NULL | GPL |\n| InnoDB | ACTIVE | STORAGE ENGINE | NULL | GPL |\n| INNODB_TRX | ACTIVE | INFORMATION SCHEMA | NULL | GPL |\n...\n| INNODB_SYS_FOREIGN | ACTIVE | INFORMATION SCHEMA | NULL |\nGPL |\n| INNODB_SYS_FOREIGN_COLS | ACTIVE | INFORMATION SCHEMA |\nNULL | GPL |\n| SPHINX | ACTIVE | STORAGE ENGINE | NULL | GPL |\n| ARCHIVE | ACTIVE | STORAGE ENGINE | NULL | GPL |\n| BLACKHOLE | ACTIVE | STORAGE ENGINE | NULL | GPL |\n| FEEDBACK | DISABLED | INFORMATION SCHEMA | NULL | GPL |\n| partition | ACTIVE | STORAGE ENGINE | NULL | GPL |\n| pam | ACTIVE | AUTHENTICATION | auth_pam.so | GPL |\n+----------------------------+----------+--------------------+-------------+---------+\n \n\n\nURL: https://mariadb.com/kb/en/library/show-plugins/','','https://mariadb.com/kb/en/library/show-plugins/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (385,26,'SHOW PLUGINS SONAME','MariaDB 10.0.2\n \nSHOW PLUGINS SONAME was introduced in MariaDB 10.0.2\n \nSyntax\n------ \nSHOW PLUGINS SONAME { library | LIKE \'pattern\' | WHERE\nexpr };\n \nDescription\n----------- \nSHOW PLUGINS SONAME displays information about compiled-in\nand all server plugins in the plugin_dir directory,\nincluding plugins that haven\'t been installed.\n \nExamples\n-------- \nSHOW PLUGINS SONAME \'ha_example.so\';\n+----------+---------------+----------------+---------------+---------+\n| Name | Status | Type | Library | License |\n+----------+---------------+----------------+---------------+---------+\n| EXAMPLE | NOT INSTALLED | STORAGE ENGINE | ha_example.so |\nGPL |\n| UNUSABLE | NOT INSTALLED | DAEMON | ha_example.so | GPL |\n+----------+---------------+----------------+---------------+---------+\n \nThere is also a corresponding information_schema table,\ncalled ALL_PLUGINS, which contains more complete\ninformation.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-plugins-soname/','','https://mariadb.com/kb/en/library/show-plugins-soname/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (386,26,'SHOW PRIVILEGES','Syntax\n------ \nSHOW PRIVILEGES\n \nDescription\n----------- \n SHOW PRIVILEGES shows the list of system privileges that\nthe MariaDB server supports. The exact list of privileges\ndepends on the version of your server.\n \nExamples\n-------- \nSHOW PRIVILEGES;\n+-------------------------+---------------------------------------+-------------------------------------------------------+\n| Privilege | Context | Comment |\n+-------------------------+---------------------------------------+-------------------------------------------------------+\n| Alter | Tables | To alter the table |\n| Alter routine | Functions,Procedures | To alter or drop\nstored functions/procedures |\n| Create | Databases,Tables,Indexes | To create new\ndatabases and tables |\n| Create routine | Databases | To use CREATE\nFUNCTION/PROCEDURE |\n| Create temporary tables | Databases | To use CREATE\nTEMPORARY TABLE |\n| Create view | Tables | To create new views |\n| Create user | Server Admin | To create new users |\n| Delete | Tables | To delete existing rows |\n| Drop | Databases,Tables | To drop databases, tables, and\nviews |\n| Event | Server Admin | To create, alter, drop and execute\nevents |\n| Execute | Functions,Procedures | To execute stored\nroutines |\n| File | File access on server | To read and write files on\nthe server |\n| Grant option | Databases,Tables,Functions,Procedures | To\ngive to other users those privileges you possess |\n| Index | Tables | To create or drop indexes |\n| Insert | Tables | To insert data into tables |\n| Lock tables | Databases | To use LOCK TABLES (together\nwith SELECT privilege) |\n| Process | Server Admin | To view the plain text of\ncurrently executing queries |\n| Proxy | Server Admin | To make proxy user possible |\n| References | Databases,Tables | To have references on\ntables |\n| Reload | Server Admin | To reload or refresh tables, logs\nand privileges |\n| Replication client | Server Admin | To ask where the slave\nor master servers are |\n| Replication slave | Server Admin | To read binary log\nevents from the master |\n| Select | Tables | To retrieve rows from table |\n| Show databases | Server Admin | To see all databases with\nSHOW DATABASES |\n| Show view | Tables | To see views with SHOW CREATE VIEW |\n| Shutdown | Server Admin | To shut down the server |\n| Super | Server Admin | To use KILL thread, SET GLOBAL,\nCHANGE MASTER, etc. |\n| Trigger | Tables | To use triggers |\n| Create tablespace | Server Admin | To create/alter/drop\ntablespaces |\n| Update | Tables | To update existing rows |\n| Usage | Server Admin | No privileges - allow connect only\n|\n+-------------------------+---------------------------------------+-------------------------------------------------------+\n31 rows in set (0.07 sec)\n \n\n\nURL: https://mariadb.com/kb/en/library/show-privileges/','','https://mariadb.com/kb/en/library/show-privileges/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (387,26,'SHOW PROCEDURE CODE','Syntax\n------ \nSHOW PROCEDURE CODE proc_name\n \nDescription\n----------- \nThis statement is a MariaDB extension that is available only\nfor servers that\nhave been built with debugging support. It displays a\nrepresentation of the\ninternal implementation of the named stored procedure. A\nsimilar statement,\n SHOW FUNCTION CODE, displays\ninformation about stored functions.\n \nBoth statements require that you be the owner of the routine\nor have\n SELECT access to the mysql.proc table.\n \nIf the named routine is available, each statement produces a\nresult\nset. Each row in the result set corresponds to one\n\"instruction\" in\nthe routine. The first column is Pos, which is an ordinal\nnumber\nbeginning with 0. The second column is Instruction, which\ncontains an\nSQL statement (usually changed from the original source), or\na\ndirective which has meaning only to the stored-routine\nhandler.\n \nExamples\n-------- \nDELIMITER //\n \nCREATE 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 \nSHOW 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+-----+----------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/show-procedure-code/','','https://mariadb.com/kb/en/library/show-procedure-code/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (388,26,'SHOW PROCEDURE STATUS','Syntax\n------ \nSHOW PROCEDURE STATUS\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \nThis statement is a MariaDB extension. It returns\ncharacteristics of a stored\nprocedure, such as the database, name, type, creator,\ncreation and modification\ndates, and character set information. A similar statement, \n SHOW FUNCTION STATUS, displays\ninformation about stored functions.\n \nThe LIKE clause, if present, indicates which procedure or\nfunction names to match. The WHERE and LIKE clauses can be\ngiven to select rows using more general conditions, as\ndiscussed in Extended SHOW.\n \nThe ROUTINES table in the INFORMATION_SCHEMA database\ncontains more detailed information.\n \nExamples\n-------- \nSHOW PROCEDURE STATUS LIKE \'p1\'\\G\n*************************** 1. row\n***************************\n Db: test\n Name: p1\n Type: PROCEDURE\n Definer: root@localhost\n Modified: 2010-08-23 13:23:03\n Created: 2010-08-23 13:23:03\n Security_type: DEFINER\n Comment: \ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n \n\n\nURL:\nhttps://mariadb.com/kb/en/library/show-procedure-status/','','https://mariadb.com/kb/en/library/show-procedure-status/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (389,26,'SHOW PROCESSLIST','Syntax\n------ \nSHOW [FULL] PROCESSLIST\n \nDescription\n----------- \n SHOW PROCESSLIST shows you which threads are running. You\ncan also get this information from the\ninformation_schema.PROCESSLIST table or the mysqladmin\nprocesslist command. If you have the \nPROCESS privilege, you can see all threads.\nOtherwise, you can see only your own threads (that is,\nthreads associated with\nthe MariaDB account that you are using). If you do not use\nthe\nFULL keyword, only the first 100 characters of each\nstatement are shown in the Info field.\n \nThe columns shown in SHOW PROCESSLIST\n are:\n \nName | Description | Introduced | \n \nID | The client\'s process ID. | | \n \nUSER | The username associated with the process. | | \n \nHOST | The host the client is connected to. | | \n \nDB | The default database of the process (NULL if no\ndefault). | | \n \nCOMMAND | The command type. See Thread Command Values. | | \n \nTIME | The amount of time, in seconds, the process has been\nin its current state. For a slave SQL thread before MariaDB\n10.1, this is the time in seconds between the last\nreplicated event\'s timestamp and the slave machine\'s real\ntime. | | \n \nSTATE | See Thread States. | | \n \nINFO | The statement being executed. | | \n \nPROGRESS | The total progress of the process (0-100%) (see\nProgress Reporting). | MariaDB 5.3 | \n \nSee TIME_MS column in information_schema.PROCESSLIST for\ndifferences in the TIME column between MariaDB and MySQL.\n \nThe information_schema.PROCESSLIST table contains the\nfollowing additional columns:\n \nName | Description | Introduced | \n \nTIME_MS | The amount of time, in milliseconds, the process\nhas been in its current state. | MariaDB 5.1 | \n \nSTAGE | The stage the process is currently in. |\nMariaDB 5.3 | \n \nMAX_STAGE | The maximum number of stages. | MariaDB 5.3 | \n \nPROGRESS | The progress of the process within the current\nstage (0-100%). | MariaDB 5.3 | \n \nMEMORY_USED | The amount of memory used by the process. |\nMariaDB 10.0.1 | \n \nEXAMINED_ROWS | The number of rows the process has examined.\n| MariaDB 10.0.1 | \n \nQUERY_ID | Query ID. | MariaDB 10.0.5 | \n \nNote that the PROGRESS field from the information schema,\nand the PROGRESS field from SHOW PROCESSLIST display\ndifferent results. SHOW PROCESSLIST shows the total\nprogress, while the information schema shows the progress\nfor the current stage only.\n \nThreads can be killed using their thread_id, or, since\nMariaDB 10.0.5, their query_id, with the KILL statement.\n \nSince queries on this table are locking, if the\nperformance_schema is enabled, you may want to query the\nTHREADS table instead.\n \nExamples\n-------- \nFrom MariaDB 5.1.x\n \nSHOW FULL PROCESSLIST;\n+---------+-------+-----------+------+---------+------+-------+-----------------------+\n| Id | User | Host | db | Command | Time | State | Info |\n+---------+-------+-----------+------+---------+------+-------+-----------------------+\n| 1988880 | dbart | localhost | NULL | Query | 0 | NULL |\nSHOW FULL PROCESSLIST |\n+---------+-------+-----------+------+---------+------+-------+-----------------------+\n \nSELECT * FROM information_schema.processlist;\n+---------+-------+-----------+------+---------+------+-----------+----------------------------------------------+---------+\n| ID | USER | HOST | DB | COMMAND | TIME | STATE | INFO |\nTIME_MS |\n+---------+-------+-----------+------+---------+------+-----------+----------------------------------------------+---------+\n| 1988880 | dbart | localhost | NULL | Query | 0 | executing\n| SELECT * FROM information_schema.processlist | 0.444 |\n+---------+-------+-----------+------+---------+------+-----------+----------------------------------------------+---------+\n \nFrom MariaDB 5.5.x\n \nSHOW FULL PROCESSLIST;\n+-----+------+-----------+------+---------+------+-------+-----------------------+----------+\n| Id | User | Host | db | Command | Time | State | Info |\nProgress |\n+-----+------+-----------+------+---------+------+-------+-----------------------+----------+\n| 126 | root | localhost | NULL | Query | 0 | NULL | SHOW\nFULL PROCESSLIST | 0.000 |\n+-----+------+-----------+------+---------+------+-------+-----------------------+----------+\n \nSELECT * FROM information_schema.processlist;\n+-----+--------+-----------+------+---------+------+-----------+----------------------------------------------+---------+-------+-----------+----------+\n| ID | USER | HOST | DB | COMMAND | TIME | STATE | INFO |\nTIME_MS | STAGE | MAX_STAGE | PROGRESS |\n+-----+--------+-----------+------+---------+------+-----------+----------------------------------------------+---------+-------+-----------+----------+\n| 126 | root | localhost | NULL | Query | 0 | executing |\nSELECT * FROM information_schema.processlist | 344.718 | 0 |\n0 | 0.000 |\n+-----+--------+-----------+------+---------+------+-----------+----------------------------------------------+---------+-------+-----------+----------+\n \nFrom MariaDB 10.0.x\n \nSHOW PROCESSLIST;\n+----+-----------------+-----------+------+---------+------+------------------------+------------------+----------+\n| Id | User | Host | db | Command | Time | State | Info |\nProgress |\n+----+-----------------+-----------+------+---------+------+------------------------+------------------+----------+\n| 2 | event_scheduler | localhost | NULL | Daemon | 2693 |\nWaiting on empty queue | NULL | 0.000 |\n| 4 | root | localhost | NULL | Query | 0 | Table lock |\nSHOW PROCESSLIST | 0.000 |\n+----+-----------------+-----------+------+---------+------+------------------------+------------------+----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-processlist/','','https://mariadb.com/kb/en/library/show-processlist/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (390,26,'SHOW PROFILE','Syntax\n------ \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 \nDescription\n----------- \nThe SHOW PROFILE and \nSHOW PROFILES statements display profiling\ninformation that indicates resource usage for statements\nexecuted during the\ncourse of the current session.\n \nProfiling is controlled by the profiling session variable,\nwhich has a default value of 0 (OFF). Profiling is enabled\nby setting profiling to 1 or ON:\n \nSET profiling = 1;\n \nSHOW PROFILES displays a list of the most recent statements\nsent to the master. The size of the list is controlled by\nthe\nprofiling_history_size session variable, which has a default\nvalue of 15. The maximum value is 100. Setting the value to\n0 has the practical effect of disabling profiling.\n \nAll statements are profiled except SHOW PROFILES and \nSHOW PROFILE, so you will find neither of those statements\nin the profile list. Malformed statements are profiled. For\nexample, \n SHOW PROFILING is an illegal statement, and a syntax error\noccurs if you try to execute it, but it will show up in the\nprofiling list.\n \n SHOW PROFILE displays detailed information about a single\nstatement. Without the FOR QUERY n clause, the output\npertains to the most recently executed statement. If \n FOR QUERY n is included,\n SHOW PROFILE displays information for statement n. The\nvalues of n correspond to\nthe Query_ID values displayed by SHOW PROFILES.\n \nThe LIMIT row_count clause may be given to limit the\noutput to row_count rows. If LIMIT is given, \n OFFSET offset may be added to begin the output offset\nrows into the full set of rows.\n \nBy default, SHOW PROFILE displays Status and Duration\ncolumns. The Status values are like the State values\ndisplayed by \nSHOW PROCESSLIST,\nalthough there might be some minor differences in\ninterpretation for\nthe two statements for some status values (see\nhttp://dev.mysql.com/doc/refman/5.6/en/thread-information.html).\n \nOptional type values may be specified to display specific\nadditional\ntypes of information:\nALL displays all information\nBLOCK IO displays counts for block input and output\noperations\nCONTEXT SWITCHES displays counts for voluntary and\ninvoluntary context switches\nCPU displays user and system CPU usage times\nIPC displays counts for messages sent and received\nMEMORY is not currently implemented\nPAGE FAULTS displays counts for major and minor page faults\nSOURCE displays the names of functions from the source code,\ntogether with the name and line number of the file in which\nthe function occurs\nSWAPS displays swap counts\n \nProfiling is enabled per session. When a session ends, its\nprofiling information is lost.\n \nThe information_schema.PROFILING table contains similar\ninformation.\n \nExamples\n-------- \nSELECT @@profiling;\n+-------------+\n| @@profiling |\n+-------------+\n| 0 |\n+-------------+\n \nSET profiling = 1;\n \nUSE test;\n \nDROP TABLE IF EXISTS t1;\n \nCREATE TABLE T1 (id INT);\n \nSHOW PROFILES;\n+----------+------------+--------------------------+\n| Query_ID | Duration | Query |\n+----------+------------+--------------------------+\n| 1 | 0.00009200 | SELECT DATABASE() |\n| 2 | 0.00023800 | show databases |\n| 3 | 0.00018900 | show tables |\n| 4 | 0.00014700 | DROP TABLE IF EXISTS t1 |\n| 5 | 0.24476900 | CREATE TABLE T1 (id INT) |\n+----------+------------+--------------------------+\n \nSHOW PROFILE;\n+----------------------+----------+\n| Status | Duration |\n+----------------------+----------+\n| starting | 0.000042 |\n| checking permissions | 0.000044 |\n| creating table | 0.244645 |\n| After create | 0.000013 |\n| query end | 0.000003 |\n| freeing items | 0.000016 |\n| logging slow query | 0.000003 |\n| cleaning up | 0.000003 |\n+----------------------+----------+\n \nSHOW PROFILE FOR QUERY 4;\n+--------------------+----------+\n| Status | Duration |\n+--------------------+----------+\n| starting | 0.000126 |\n| query end | 0.000004 |\n| freeing items | 0.000012 |\n| logging slow query | 0.000003 |\n| cleaning up | 0.000002 |\n+--------------------+----------+\n \nSHOW PROFILE CPU FOR QUERY 5;\n+----------------------+----------+----------+------------+\n| Status | Duration | CPU_user | CPU_system |\n+----------------------+----------+----------+------------+\n| starting | 0.000042 | 0.000000 | 0.000000 |\n| checking permissions | 0.000044 | 0.000000 | 0.000000 |\n| creating table | 0.244645 | 0.000000 | 0.000000 |\n| After create | 0.000013 | 0.000000 | 0.000000 |\n| query end | 0.000003 | 0.000000 | 0.000000 |\n| freeing items | 0.000016 | 0.000000 | 0.000000 |\n| logging slow query | 0.000003 | 0.000000 | 0.000000 |\n| cleaning up | 0.000003 | 0.000000 | 0.000000 |\n+----------------------+----------+----------+------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-profile/','','https://mariadb.com/kb/en/library/show-profile/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (391,26,'SHOW PROFILES','Syntax\n------ \nSHOW PROFILES\n \nDescription\n----------- \nThe SHOW PROFILES statement displays profiling information\nthat indicates resource usage for statements executed during\nthe course of the\ncurrent session. It is used together with \nSHOW PROFILE.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-profiles/','','https://mariadb.com/kb/en/library/show-profiles/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (392,26,'SHOW QUERY_RESPONSE_TIME','SHOW QUERY_RESPONSE_TIME was introduced in MariaDB 10.1.1.\n \nStarting with MariaDB 10.1.1, which introduced the\nInformation Schema plugin extension, it is possible to use\nSHOW QUERY_RESPONSE_TIME as an alternative for retrieving\ninformation from the QUERY_RESPONSE_TIME plugin.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/show-query_response_time/','','https://mariadb.com/kb/en/library/show-query_response_time/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (393,26,'SHOW RELAYLOG EVENTS','Syntax\n------ \nSHOW RELAYLOG [\'connection_name\'] EVENTS\n [IN \'log_name\'] [FROM pos] [LIMIT [offset,] row_count]\n \nDescription\n----------- \nOn replication slaves this command shows the events in the\nrelay log. If \'log_name\' is not specified, the first relay\nlog is shown.\n \nSyntax for the LIMIT clause is the same as for SELECT ...\nLIMIT.\n \nUsing the LIMIT clause is highly recommended because the\nSHOW RELAYLOG EVENTS command returns the complete contents\nof the relay log, which can be quite large.\n \nThis command does not return events related to setting user\nand system variables. If you need those, use mysqlbinlog.\n \nOn the replication master, this command does nothing.\n \nconnection_name\n \nconnection_name was added as part of multi-source\nreplication added in MariaDB 10.0.1\n \nIf there is only one nameless master, or the default master\n(as specified by the default_master_connection system\nvariable) is intended, connection_name can be omitted. If\nprovided, the SHOW RELAYLOG statement will apply to the\nspecified master. connection_name is case-insensitive.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-relaylog-events/','','https://mariadb.com/kb/en/library/show-relaylog-events/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (394,26,'SHOW SLAVE HOSTS','Syntax\n------ \nSHOW SLAVE HOSTS\n \nDescription\n----------- \nThis command is run on the master and displays a list of\nreplication slaves that are currently registered with it.\nOnly slaves started with the --report-host=host_name option\nare visible in this list.\n \nThe list is displayed on any server (not just the master\nserver). The output\nlooks like this:\n \nSHOW SLAVE HOSTS;\n+------------+-----------+------+-----------+\n| Server_id | Host | Port | Master_id |\n+------------+-----------+------+-----------+\n| 192168010 | iconnect2 | 3306 | 192168011 |\n| 1921680101 | athena | 3306 | 192168011 |\n+------------+-----------+------+-----------+\nServer_id: The unique server ID of the slave server, as\nconfigured in the server\'s option file, or on the command\nline with --server-id=value.\nHost: The host name of the slave server, as configured in\nthe server\'s option file, or on the command line with\n--report-host=host_name. Note that this can differ from the\nmachine name as configured in the operating system.\nPort: The port the slave server is listening on.\nMaster_id: The unique server ID of the master server that\nthe slave server is replicating from.\n \nSome MariaDB and MySQL versions report another variable,\nrpl_recovery_rank. This\nvariable was never used, and was eventually removed in\nMariaDB 10.1.2 and MySQL 5.6.\n \n\n\nURL: https://mariadb.com/kb/en/library/show-slave-hosts/','','https://mariadb.com/kb/en/library/show-slave-hosts/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (395,26,'SHOW SLAVE STATUS','Syntax\n------ \nSHOW SLAVE [\"connection_name\"] STATUS\n \nor\n \nSHOW ALL SLAVES STATUS\n \nDescription\n----------- \nThis statement is to be run on a slave and provides status\ninformation on essential parameters of the replication slave\nthreads.\n \nThis statement requires the SUPER or the REPLICATION_CLIENT\nprivilege.\n \nMulti-source\n \nMariaDB 10.0 introduced the FULL and \"connection_name\"\noptions to\nallow you to connect to many masters at the same time.\n \nALL SLAVES gives you a list of all connections to the\nmaster.\n \nThe rows will be sorted according to Connection_name.\n \nIf you specify a connection_name, you only get the\ninformation about that\nconnection. If connection_name is not used, then the name\nset by default_master_connection is used. If the connection\nname doesn\'t exist you will get an error:\nThere is no master connection for \'xxx\'.\n \nColumn descriptions\n \nName | Description | Added | \n \nConnection_name | Name of the master connection. Returned\nwith SHOW ALL SLAVES STATUS only. | MariaDB 10.0 | \n \nSlave_SQL_State | State of SQL thread. Returned with SHOW\nALL SLAVES STATUS only. See Slave SQL Thread States. |\nMariaDB 10.0 | \n \nSlave_IO_State | State of I/O thread. See Slave I/O Thread\nStates. | MariaDB 10.0 | \n \nMaster_host | Master host that the slave is connected to. | \n| \n \nMaster_user | Account user name being used to connect to the\nmaster. | | \n \nMaster_port | The port being used to connect to the master.\n| | \n \nConnect_Retry | Time in seconds between retries to connect.\nThe default is 60. The CHANGE MASTER TO statement can set\nthis. The master-retry-count option determines the maximum\nnumber of reconnection attempts. | | \n \nMaster_Log_File | Name of the master binary log file that\nthe I/O thread is currently reading from. | | \n \nRead_Master_Log_Pos | Position up to which the I/O thread\nhas read in the current master binary log file. | | \n \nRelay_Log_File | Name of the relay log file that the SQL\nthread is currently processing. | | \n \nRelay_Log_Pos | Position up to which the SQL thread has\nfinished processing in the current relay log file. | | \n \nRelay_Master_Log_File | Name of the master binary log file\nthat contains the most recent event executed by the SQL\nthread. | | \n \nSlave_IO_Running | Whether the slave I/O thread is running\nand connected (Yes), running but not connected to a master\n(Connecting) or not running (No). | | \n \nSlave_SQL_Running | Whether or not the SQL thread is\nrunning. | | \n \nReplicate_Do_DB | Databases specified for replicating with\nthe replicate_do_db option. | | \n \nReplicate_Ignore_DB | Databases specified for ignoring with\nthe replicate_ignore_db option. | | \n \nReplicate_Do_Table | Tables specified for replicating with\nthe replicate_do_table option. | | \n \nReplicate_Ignore_Table | Tables specified for ignoring with\nthe replicate_ignore_table option. | | \n \nReplicate_Wild_Do_Table | Tables specified for replicating\nwith the replicate_wild_do_table option. | | \n \nReplicate_Wild_Ignore_Table | Tables specified for ignoring\nwith the replicate_wild_ignore_table option. | | \n \nLast_Errno | Alias for Last_SQL_Errno (see below) | | \n \nLast Error | Alias for Last_SQL_Error (see below) | | \n \nSkip_Counter | Number of events that a slave skips from the\nmaster, as recorded in the sql_slave_skip_counter system\nvariable. | | \n \nExec_Master_Log_Pos | Position up to which the SQL thread\nhas processed in the current master binary log file. Can be\nused to start a new slave from a current slave with the\nCHANGE MASTER TO ... MASTER_LOG_POS option. | | \n \nRelay_Log_Space | Total size of all relay log files\ncombined. | | \n \nUntil_Condition | | | \n \nUntil_Log_File | The MASTER_LOG_FILE value of the START\nSLAVE UNTIL condition. | | \n \nUntil_Log_Pos | The MASTER_LOG_POS value of the START SLAVE\nUNTIL condition. | | \n \nMaster_SSL_Allowed | Whether an SSL connection is permitted\n(Yes), not permitted (No) or permitted but without the slave\nhaving SSL support enabled (Ignored) | | \n \nMaster_SSL_CA_File | The MASTER_SSL_CA option of the CHANGE\nMASTER TO statement. | | \n \nMaster_SSL_CA_Path | The MASTER_SSL_CAPATH option of the\nCHANGE MASTER TO statement. | | \n \nMaster_SSL_Cert | The MASTER_SSL_CERT option of the CHANGE\nMASTER TO statement. | | \n \nMaster_SSL_Cipher | The MASTER_SSL_CIPHER option of the\nCHANGE MASTER TO statement. | | \n \nMaster_SSL_Key | The MASTER_SSL_KEY option of the CHANGE\nMASTER TO statement. | | \n \nSeconds_Behind_Master | Difference between the timestamp\nlogged on the master for the event that the slave is\ncurrently processing, and the current timestamp on the\nslave. Zero if the slave is not currently processing an\nevent. From MariaDB 10.0.23 and MariaDB 10.1.9, with\nparallel replication, seconds_behind_master is updated only\nafter transactions commit. | | \n \nMaster_SSL_Verify_Server_Cert | The\nMASTER_SSL_VERIFY_SERVER_CERT option of the CHANGE MASTER TO\nstatement. | | \n \nLast_IO_Errno | Error code of the most recent error that\ncaused the I/O thread to stop (also recorded in the slave\'s\nerror log). 0 means no error. RESET SLAVE or RESET MASTER\nwill reset this value. | | \n \nLast_IO_Error | Error message of the most recent error that\ncaused the I/O thread to stop (also recorded in the slave\'s\nerror log). An empty string means no error. RESET SLAVE or\nRESET MASTER will reset this value. | | \n \nLast_SQL_Errno | Error code of the most recent error that\ncaused the SQL thread to stop (also recorded in the slave\'s\nerror log). 0 means no error. RESET SLAVE or RESET MASTER\nwill reset this value. | | \n \nLast_SQL_Error | Error message of the most recent error that\ncaused the SQL thread to stop (also recorded in the slave\'s\nerror log). An empty string means no error. RESET SLAVE or\nRESET MASTER will reset this value. | | \n \nReplicate_Ignore_Server_Ids | List of server_ids that are\ncurrently being ignored for replication purposes, or an\nempty string for none, as specified in the IGNORE_SERVER_IDS\noption of the CHANGE MASTER TO statement. | | \n \nMaster_Server_Id | The master\'s server_id value. | | \n \nMaster_SSL_Crl | The MASTER_SSL_CRL option of the CHANGE\nMASTER TO statement. | MariaDB 10.0 | \n \nMaster_SSL_Crlpath | The MASTER_SSL_CRLPATH option of the\nCHANGE MASTER TO statement. | MariaDB 10.0 | \n \nUsing_Gtid | Whether or not global transaction ID\'s are\nbeing used for replication (can be No, Slave_Pos, or\nCurrent_Pos). | MariaDB 10.0.2 | \n \nGtid_IO_Pos | Current global transaction ID value. | MariaDB\n10.0.2 | \n \nRetried_transactions | Number of retried transactions for\nthis connection. Returned with SHOW ALL SLAVES STATUS only.\n| MariaDB 10.0 | \n \nMax_relay_log_size | Max relay log size for this connection.\nReturned with SHOW ALL SLAVES STATUS only. | MariaDB 10.0 | \n \nExecuted_log_entries | How many log entries the slave has\nexecuted. Returned with SHOW ALL SLAVES STATUS only. |\nMariaDB 10.0 | \n \nSlave_received_heartbeats | How many heartbeats we have got\nfrom the master. Returned with SHOW ALL SLAVES STATUS only.\n| MariaDB 10.0 | \n \nSlave_heartbeat_period | How often to request a heartbeat\npacket from the master (in seconds). Returned with SHOW ALL\nSLAVES STATUS only. | MariaDB 10.0 | \n \nGtid_Slave_Pos | GTID of the last event group replicated on\na slave server, for each replication domain, as stored in\nthe gtid_slave_pos system variable. Returned with SHOW ALL\nSLAVES STATUS only. | MariaDB 10.0 | \n \nSQL_Delay | Value specified by MASTER_DELAY in CHANGE MASTER\n(or 0 if none). | MariaDB 10.2.3 | \n \nSQL_Remaining_Delay | When the slave is delaying the\nexecution of an event due to MASTER_DELAY, this is the\nnumber of seconds of delay remaining before the event will\nbe applied. Otherwise, the value is NULL. | MariaDB 10.2.3 |\n\n \nSlave_SQL_Running_State | The state of the SQL driver\nthreads, same as in SHOW PROCESSLIST. When the slave is\ndelaying the execution of an event due to MASTER_DELAY, this\nfield displays: \"Waiting until MASTER_DELAY seconds after\nmaster executed event\". | MariaDB 10.2.3 | \n \nExamples\n-------- \nIf you issue this statement using the mysql client,\nyou can use a \\G statement terminator rather than a\nsemicolon to\nobtain a more readable vertical layout.\n \nSHOW SLAVE STATUS\\G\n*************************** 1. row\n***************************\n Slave_IO_State: Waiting for master to send event\n Master_Host: db01.example.com\n Master_User: replicant\n Master_Port: 3306\n Connect_Retry: 60\n Master_Log_File: mariadb-bin.000010\n Read_Master_Log_Pos: 548\n Relay_Log_File: relay-bin.000004\n Relay_Log_Pos: 837\n Relay_Master_Log_File: mariadb-bin.000010\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: 548\n Relay_Log_Space: 1497\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: 0\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: \n Master_Server_Id: 101\n Master_SSL_Crl: \n Master_SSL_Crlpath: \n Using_Gtid: No\n Gtid_IO_Pos: \n \nMariaDB [(none)]> SHOW ALL SLAVES STATUS\\G\n*************************** 1. row\n***************************\n Connection_name: \n Slave_SQL_State: Slave has read all relay log; waiting for\nthe slave I/O thread to update it\n Slave_IO_State: Waiting for master to send event\n Master_Host: db01.example.com\n Master_User: replicant\n Master_Port: 3306\n Connect_Retry: 60\n Master_Log_File: mariadb-bin.000010\n Read_Master_Log_Pos: 3608\n Relay_Log_File: relay-bin.000004\n Relay_Log_Pos: 3897\n Relay_Master_Log_File: mariadb-bin.000010\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: 3608\n Relay_Log_Space: 4557\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: 0\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: \n Master_Server_Id: 101\n Master_SSL_Crl: \n Master_SSL_Crlpath: \n Using_Gtid: No\n Gtid_IO_Pos:\n Retried_transactions: 0\n Max_relay_log_size: 104857600\n Executed_log_entries: 40\n Slave_received_heartbeats: 11\n Slave_heartbeat_period: 1800.000\n Gtid_Slave_Pos: 0-101-2320\n \nYou can also access some of the variables directly from\nstatus variables:\n \nSET @@default_master_connection=\"test\" ;\nshow status like \"%slave%\"\n \nVariable_name Value\nCom_show_slave_hosts 0\nCom_show_slave_status 0\nCom_start_all_slaves 0\nCom_start_slave 0\nCom_stop_all_slaves 0\nCom_stop_slave 0\nRpl_semi_sync_slave_status OFF\nSlave_connections 0\nSlave_heartbeat_period 1800.000\nSlave_open_temp_tables 0\nSlave_received_heartbeats 0\nSlave_retried_transactions 0\nSlave_running OFF\nSlaves_connected 0\nSlaves_running 1\n \n\n\nURL: https://mariadb.com/kb/en/library/show-slave-status/','','https://mariadb.com/kb/en/library/show-slave-status/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (396,26,'SHOW STATUS','Syntax\n------ \nSHOW [GLOBAL | SESSION] STATUS\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \nSHOW STATUS provides server status information. This\ninformation also can be obtained using the mysqladmin\nextended-status command, or by querying the Information\nSchema GLOBAL_STATUS and SESSION_STATUS tables.\nThe LIKE clause, if present, indicates which variable names\nto match. The WHERE clause can be given to select rows using\nmore general conditions.\n \nWith the GLOBAL modifier, SHOW STATUS\ndisplays the status values for all connections to MariaDB.\nWith\nSESSION, it displays the status values\nfor the current connection. If no modifier is present, the\ndefault is\n SESSION. LOCAL is a synonym for\n SESSION. If you see a lot of 0 values, the reason is\nprobably that you have used SHOW STATUS with a new\nconnection instead of SHOW GLOBAL STATUS.\n \nSome status variables have only a global value. For these,\nyou get the\nsame value for both GLOBAL and SESSION.\n \nSee Server Status Variables for a full list, scope and\ndescription of the variables that can be viewed with SHOW\nSTATUS.\n \nThe LIKE clause, if present on its own, indicates which\nvariable name to match.\n \nThe WHERE and LIKE clauses can be given to select rows using\nmore general conditions, as discussed in Extended SHOW.\n \nExamples\n-------- \nFull output from MariaDB 10.1.17:\n \nSHOW GLOBAL STATUS;\n \n+--------------------------------------------------------------+----------------------------------------+\n| Variable_name | Value |\n+--------------------------------------------------------------+----------------------------------------+\n| Aborted_clients | 0 |\n| Aborted_connects | 0 |\n| Access_denied_errors | 0 |\n| Acl_column_grants | 0 |\n| Acl_database_grants | 2 |\n| Acl_function_grants | 0 |\n| Acl_procedure_grants | 0 |\n| Acl_proxy_users | 2 |\n| Acl_role_grants | 0 |\n| Acl_roles | 0 |\n| Acl_table_grants | 0 |\n| Acl_users | 6 |\n| Aria_pagecache_blocks_not_flushed | 0 |\n| Aria_pagecache_blocks_unused | 15706 |\n| Aria_pagecache_blocks_used | 0 |\n| Aria_pagecache_read_requests | 0 |\n| Aria_pagecache_reads | 0 |\n| Aria_pagecache_write_requests | 0 |\n| Aria_pagecache_writes | 0 |\n| Aria_transaction_log_syncs | 0 |\n| Binlog_commits | 0 |\n| Binlog_group_commits | 0 |\n| Binlog_group_commit_trigger_count | 0 |\n| Binlog_group_commit_trigger_lock_wait | 0 |\n| Binlog_group_commit_trigger_timeout | 0 |\n| Binlog_snapshot_file | |\n| Binlog_snapshot_position | 0 |\n| Binlog_bytes_written | 0 |\n| Binlog_cache_disk_use | 0 |\n| Binlog_cache_use | 0 |\n| Binlog_stmt_cache_disk_use | 0 |\n| Binlog_stmt_cache_use | 0 |\n| Busy_time | 0.000000 |\n| Bytes_received | 432 |\n| Bytes_sent | 15183 |\n| Com_admin_commands | 1 |\n| Com_alter_db | 0 |\n| Com_alter_db_upgrade | 0 |\n| Com_alter_event | 0 |\n| Com_alter_function | 0 |\n| Com_alter_procedure | 0 |\n| Com_alter_server | 0 |\n| Com_alter_table | 0 |\n| Com_alter_tablespace | 0 |\n| Com_analyze | 0 |\n| Com_assign_to_keycache | 0 |\n| Com_begin | 0 |\n| Com_binlog | 0 |\n| Com_call_procedure | 0 |\n| Com_change_db | 0 |\n| Com_change_master | 0 |\n| Com_check | 0 |\n| Com_checksum | 0 |\n| Com_commit | 0 |\n| Com_compound_sql | 0 |\n| Com_create_db | 0 |\n| Com_create_event | 0 |\n| Com_create_function | 0 |\n| Com_create_index | 0 |\n| Com_create_procedure | 0 |\n| Com_create_role | 0 |\n| Com_create_server | 0 |\n| Com_create_table | 0 |\n| Com_create_temporary_table | 0 |\n| Com_create_trigger | 0 |\n| Com_create_udf | 0 |\n| Com_create_user | 0 |\n| Com_create_view | 0 |\n| Com_dealloc_sql | 0 |\n| Com_delete | 0 |\n| Com_delete_multi | 0 |\n| Com_do | 0 |\n| Com_drop_db | 0 |\n| Com_drop_event | 0 |\n| Com_drop_function | 0 |\n| Com_drop_index | 0 |\n| Com_drop_procedure | 0 |\n| Com_drop_role | 0 |\n| Com_drop_server | 0 |\n| Com_drop_table | 0 |\n| Com_drop_temporary_table | 0 |\n| Com_drop_trigger | 0 |\n| Com_drop_user | 0 |\n| Com_drop_view | 0 |\n| Com_empty_query | 0 |\n| Com_execute_sql | 0 |\n| Com_flush | 0 |\n| Com_get_diagnostics | 0 |\n| Com_grant | 0 |\n| Com_grant_role | 0 |\n| Com_ha_close | 0 |\n| Com_ha_open | 0 |\n| Com_ha_read | 0 |\n| Com_help | 0 |\n| Com_insert | 0 |\n| Com_insert_select | 0 |\n| Com_install_plugin | 0 |\n| Com_kill | 0 |\n| Com_load | 0 |\n| Com_lock_tables | 0 |\n| Com_optimize | 0 |\n| Com_preload_keys | 0 |\n| Com_prepare_sql | 0 |\n| Com_purge | 0 |\n| Com_purge_before_date | 0 |\n| Com_release_savepoint | 0 |\n| Com_rename_table | 0 |\n| Com_rename_user | 0 |\n| Com_repair | 0 |\n| Com_replace | 0 |\n| Com_replace_select | 0 |\n| Com_reset | 0 |\n| Com_resignal | 0 |\n| Com_revoke | 0 |\n| Com_revoke_all | 0 |\n| Com_revoke_role | 0 |\n| Com_rollback | 0 |\n| Com_rollback_to_savepoint | 0 |\n| Com_savepoint | 0 |\n| Com_select | 1 |\n| Com_set_option | 0 |\n| Com_show_authors | 0 |\n| Com_show_binlog_events | 0 |\n| Com_show_binlogs | 0 |\n| Com_show_charsets | 0 |\n| Com_show_collations | 0 |\n| Com_show_contributors | 0 |\n| Com_show_create_db | 0 |\n| Com_show_create_event | 0 |\n| Com_show_create_func | 0 |\n| Com_show_create_proc | 0 |\n| Com_show_create_table | 0 |\n| Com_show_create_trigger | 0 |\n| Com_show_databases | 0 |\n| Com_show_engine_logs | 0 |\n| Com_show_engine_mutex | 0 |\n| Com_show_engine_status | 0 |\n| Com_show_errors | 0 |\n| Com_show_events | 0 |\n| Com_show_explain | 0 |\n| Com_show_fields | 0 |\n| Com_show_function_status | 0 |\n| Com_show_generic | 0 |\n| Com_show_grants | 0 |\n| Com_show_keys | 0 |\n| Com_show_master_status | 0 |\n| Com_show_open_tables | 0 |\n| Com_show_plugins | 0 |\n| Com_show_privileges | 0 |\n| Com_show_procedure_status | 0 |\n| Com_show_processlist | 0 |\n| Com_show_profile | 0 |\n| Com_show_profiles | 0 |\n| Com_show_relaylog_events | 0 |\n| Com_show_slave_hosts | 0 |\n| Com_show_slave_status | 0 |\n| Com_show_status | 2 |\n| Com_show_storage_engines | 0 |\n| Com_show_table_status | 0 |\n| Com_show_tables | 0 |\n| Com_show_triggers | 0 |\n| Com_show_variables | 0 |\n| Com_show_warnings | 0 |\n| Com_shutdown | 0 |\n| Com_signal | 0 |\n| Com_start_all_slaves | 0 |\n| Com_start_slave | 0 |\n| Com_stmt_close | 0 |\n| Com_stmt_execute | 0 |\n| Com_stmt_fetch | 0 |\n| Com_stmt_prepare | 0 |\n| Com_stmt_reprepare | 0 |\n| Com_stmt_reset | 0 |\n| Com_stmt_send_long_data | 0 |\n| Com_stop_all_slaves | 0 |\n| Com_stop_slave | 0 |\n| Com_truncate | 0 |\n| Com_uninstall_plugin | 0 |\n| Com_unlock_tables | 0 |\n| Com_update | 0 |\n| Com_update_multi | 0 |\n| Com_xa_commit | 0 |\n| Com_xa_end | 0 |\n| Com_xa_prepare | 0 |\n| Com_xa_recover | 0 |\n| Com_xa_rollback | 0 |\n| Com_xa_start | 0 |\n| Compression | OFF |\n| Connection_errors_accept | 0 |\n| Connection_errors_internal | 0 |\n| Connection_errors_max_connections | 0 |\n| Connection_errors_peer_address | 0 |\n| Connection_errors_select | 0 |\n| Connection_errors_tcpwrap | 0 |\n| Connections | 4 |\n| Cpu_time | 0.000000 |\n| Created_tmp_disk_tables | 0 |\n| Created_tmp_files | 6 |\n| Created_tmp_tables | 2 |\n| Delayed_errors | 0 |\n| Delayed_insert_threads | 0 |\n| Delayed_writes | 0 |\n| Delete_scan | 0 |\n| Empty_queries | 0 |\n| Executed_events | 0 |\n| Executed_triggers | 0 |\n| Feature_delay_key_write | 0 |\n| Feature_dynamic_columns | 0 |\n| Feature_fulltext | 0 |\n| Feature_gis | 0 |\n| Feature_locale | 0 |\n| Feature_subquery | 0 |\n| Feature_timezone | 0 |\n| Feature_trigger | 0 |\n| Feature_xml | 0 |\n| Flush_commands | 1 |\n| Handler_commit | 1 |\n| Handler_delete | 0 |\n| Handler_discover | 0 |\n| Handler_external_lock | 0 |\n| Handler_icp_attempts | 0 |\n| Handler_icp_match | 0 |\n| Handler_mrr_init | 0 |\n| Handler_mrr_key_refills | 0 |\n| Handler_mrr_rowid_refills | 0 |\n| Handler_prepare | 0 |\n| Handler_read_first | 3 |\n| Handler_read_key | 0 |\n| Handler_read_last | 0 |\n| Handler_read_next | 0 |\n| Handler_read_prev | 0 |\n| Handler_read_retry | 0 |\n| Handler_read_rnd | 0 |\n| Handler_read_rnd_deleted | 0 |\n| Handler_read_rnd_next | 537 |\n| Handler_rollback | 0 |\n| Handler_savepoint | 0 |\n| Handler_savepoint_rollback | 0 |\n| Handler_tmp_update | 0 |\n| Handler_tmp_write | 516 |\n| Handler_update | 0 |\n| Handler_write | 0 |\n| Innodb_available_undo_logs | 128 |\n| Innodb_background_log_sync | 222 |\n| Innodb_buffer_pool_bytes_data | 2523136 |\n| Innodb_buffer_pool_bytes_dirty | 0 |\n| Innodb_buffer_pool_dump_status | Dumping buffer pool(s)\nnot yet started |\n| Innodb_buffer_pool_load_status | Loading buffer pool(s)\nnot yet started |\n| Innodb_buffer_pool_pages_data | 154 |\n| Innodb_buffer_pool_pages_dirty | 0 |\n| Innodb_buffer_pool_pages_flushed | 1 |\n| Innodb_buffer_pool_pages_free | 8037 |\n| Innodb_buffer_pool_pages_lru_flushed | 0 |\n| Innodb_buffer_pool_pages_made_not_young | 0 |\n| Innodb_buffer_pool_pages_made_young | 0 |\n| Innodb_buffer_pool_pages_misc | 0 |\n| Innodb_buffer_pool_pages_old | 0 |\n| Innodb_buffer_pool_pages_total | 8191 |\n| Innodb_buffer_pool_read_ahead | 0 |\n| Innodb_buffer_pool_read_ahead_evicted | 0 |\n| Innodb_buffer_pool_read_ahead_rnd | 0 |\n| Innodb_buffer_pool_read_requests | 558 |\n| Innodb_buffer_pool_reads | 155 |\n| Innodb_buffer_pool_wait_free | 0 |\n| Innodb_buffer_pool_write_requests | 1 |\n| Innodb_checkpoint_age | 0 |\n| Innodb_checkpoint_max_age | 80826164 |\n| Innodb_data_fsyncs | 5 |\n| Innodb_data_pending_fsyncs | 0 |\n| Innodb_data_pending_reads | 0 |\n| Innodb_data_pending_writes | 0 |\n| Innodb_data_read | 2609664 |\n| Innodb_data_reads | 172 |\n| Innodb_data_writes | 5 |\n| Innodb_data_written | 34304 |\n| Innodb_dblwr_pages_written | 1 |\n| Innodb_dblwr_writes | 1 |\n| Innodb_deadlocks | 0 |\n| Innodb_have_atomic_builtins | ON |\n| Innodb_history_list_length | 0 |\n| Innodb_ibuf_discarded_delete_marks | 0 |\n| Innodb_ibuf_discarded_deletes | 0 |\n| Innodb_ibuf_discarded_inserts | 0 |\n| Innodb_ibuf_free_list | 0 |\n| Innodb_ibuf_merged_delete_marks | 0 |\n| Innodb_ibuf_merged_deletes | 0 |\n| Innodb_ibuf_merged_inserts | 0 |\n| Innodb_ibuf_merges | 0 |\n| Innodb_ibuf_segment_size | 2 |\n| Innodb_ibuf_size | 1 |\n| Innodb_log_waits | 0 |\n| Innodb_log_write_requests | 0 |\n| Innodb_log_writes | 1 |\n| Innodb_lsn_current | 1616829 |\n| Innodb_lsn_flushed | 1616829 |\n| Innodb_lsn_last_checkpoint | 1616829 |\n| Innodb_master_thread_active_loops | 0 |\n| Innodb_master_thread_idle_loops | 222 |\n| Innodb_max_trx_id | 2308 |\n| Innodb_mem_adaptive_hash | 2217568 |\n| Innodb_mem_dictionary | 630703 |\n| Innodb_mem_total | 140771328 |\n| Innodb_mutex_os_waits | 1 |\n| Innodb_mutex_spin_rounds | 30 |\n| Innodb_mutex_spin_waits | 1 |\n| Innodb_oldest_view_low_limit_trx_id | 0 |\n| Innodb_os_log_fsyncs | 3 |\n| Innodb_os_log_pending_fsyncs | 0 |\n| Innodb_os_log_pending_writes | 0 |\n| Innodb_os_log_written | 512 |\n| Innodb_page_size | 16384 |\n| Innodb_pages_created | 0 |\n| Innodb_pages_read | 154 |\n| Innodb_pages_written | 1 |\n| Innodb_purge_trx_id | 0 |\n| Innodb_purge_undo_no | 0 |\n| Innodb_read_views_memory | 88 |\n| Innodb_row_lock_current_waits | 0 |\n| Innodb_row_lock_time | 0 |\n| Innodb_row_lock_time_avg | 0 |\n| Innodb_row_lock_time_max | 0 |\n| Innodb_row_lock_waits | 0 |\n| Innodb_rows_deleted | 0 |\n| Innodb_rows_inserted | 0 |\n| Innodb_rows_read | 0 |\n| Innodb_rows_updated | 0 |\n| Innodb_system_rows_deleted | 0 |\n| Innodb_system_rows_inserted | 0 |\n| Innodb_system_rows_read | 0 |\n| Innodb_system_rows_updated | 0 |\n| Innodb_s_lock_os_waits | 2 |\n| Innodb_s_lock_spin_rounds | 60 |\n| Innodb_s_lock_spin_waits | 2 |\n| Innodb_truncated_status_writes | 0 |\n| Innodb_x_lock_os_waits | 0 |\n| Innodb_x_lock_spin_rounds | 0 |\n| Innodb_x_lock_spin_waits | 0 |\n| Innodb_page_compression_saved | 0 |\n| Innodb_page_compression_trim_sect512 | 0 |\n| Innodb_page_compression_trim_sect1024 | 0 |\n| Innodb_page_compression_trim_sect2048 | 0 |\n| Innodb_page_compression_trim_sect4096 | 0 |\n| Innodb_page_compression_trim_sect8192 | 0 |\n| Innodb_page_compression_trim_sect16384 | 0 |\n| Innodb_page_compression_trim_sect32768 | 0 |\n| Innodb_num_index_pages_written | 0 |\n| Innodb_num_non_index_pages_written | 5 |\n| Innodb_num_pages_page_compressed | 0 |\n| Innodb_num_page_compressed_trim_op | 0 |\n| Innodb_num_page_compressed_trim_op_saved | 0 |\n| Innodb_num_pages_page_decompressed | 0 |\n| Innodb_num_pages_page_compression_error | 0 |\n| Innodb_num_pages_encrypted | 0 |\n| Innodb_num_pages_decrypted | 0 |\n| Innodb_have_lz4 | OFF |\n| Innodb_have_lzo | OFF |\n| Innodb_have_lzma | OFF |\n| Innodb_have_bzip2 | OFF |\n| Innodb_have_snappy | OFF |\n| Innodb_defragment_compression_failures | 0 |\n| Innodb_defragment_failures | 0 |\n| Innodb_defragment_count | 0 |\n| Innodb_onlineddl_rowlog_rows | 0 |\n| Innodb_onlineddl_rowlog_pct_used | 0 |\n| Innodb_onlineddl_pct_progress | 0 |\n| Innodb_secondary_index_triggered_cluster_reads | 0 |\n| Innodb_secondary_index_triggered_cluster_reads_avoided | 0\n|\n| Innodb_encryption_rotation_pages_read_from_cache | 0 |\n| Innodb_encryption_rotation_pages_read_from_disk | 0 |\n| Innodb_encryption_rotation_pages_modified | 0 |\n| Innodb_encryption_rotation_pages_flushed | 0 |\n| Innodb_encryption_rotation_estimated_iops | 0 |\n| Innodb_scrub_background_page_reorganizations | 0 |\n| Innodb_scrub_background_page_splits | 0 |\n| Innodb_scrub_background_page_split_failures_underflow | 0\n|\n|\nInnodb_scrub_background_page_split_failures_out_of_filespace\n| 0 |\n| Innodb_scrub_background_page_split_failures_missing_index\n| 0 |\n| Innodb_scrub_background_page_split_failures_unknown | 0 |\n| Key_blocks_not_flushed | 0 |\n| Key_blocks_unused | 107163 |\n| Key_blocks_used | 0 |\n| Key_blocks_warm | 0 |\n| Key_read_requests | 0 |\n| Key_reads | 0 |\n| Key_write_requests | 0 |\n| Key_writes | 0 |\n| Last_query_cost | 0.000000 |\n| Master_gtid_wait_count | 0 |\n| Master_gtid_wait_time | 0 |\n| Master_gtid_wait_timeouts | 0 |\n| Max_statement_time_exceeded | 0 |\n| Max_used_connections | 1 |\n| Memory_used | 273614696 |\n| Not_flushed_delayed_rows | 0 |\n| Open_files | 25 |\n| Open_streams | 0 |\n| Open_table_definitions | 18 |\n| Open_tables | 11 |\n| Opened_files | 77 |\n| Opened_plugin_libraries | 0 |\n| Opened_table_definitions | 18 |\n| Opened_tables | 18 |\n| Opened_views | 0 |\n| Performance_schema_accounts_lost | 0 |\n| Performance_schema_cond_classes_lost | 0 |\n| Performance_schema_cond_instances_lost | 0 |\n| Performance_schema_digest_lost | 0 |\n| Performance_schema_file_classes_lost | 0 |\n| Performance_schema_file_handles_lost | 0 |\n| Performance_schema_file_instances_lost | 0 |\n| Performance_schema_hosts_lost | 0 |\n| Performance_schema_locker_lost | 0 |\n| Performance_schema_mutex_classes_lost | 0 |\n| Performance_schema_mutex_instances_lost | 0 |\n| Performance_schema_rwlock_classes_lost | 0 |\n| Performance_schema_rwlock_instances_lost | 0 |\n| Performance_schema_session_connect_attrs_lost | 0 |\n| Performance_schema_socket_classes_lost | 0 |\n| Performance_schema_socket_instances_lost | 0 |\n| Performance_schema_stage_classes_lost | 0 |\n| Performance_schema_statement_classes_lost | 0 |\n| Performance_schema_table_handles_lost | 0 |\n| Performance_schema_table_instances_lost | 0 |\n| Performance_schema_thread_classes_lost | 0 |\n| Performance_schema_thread_instances_lost | 0 |\n| Performance_schema_users_lost | 0 |\n| Prepared_stmt_count | 0 |\n| Qcache_free_blocks | 1 |\n| Qcache_free_memory | 1031336 |\n| Qcache_hits | 0 |\n| Qcache_inserts | 0 |\n| Qcache_lowmem_prunes | 0 |\n| Qcache_not_cached | 0 |\n| Qcache_queries_in_cache | 0 |\n| Qcache_total_blocks | 1 |\n| Queries | 4 |\n| Questions | 4 |\n| Rows_read | 10 |\n| Rows_sent | 517 |\n| Rows_tmp_read | 516 |\n| Rpl_status | AUTH_MASTER |\n| Select_full_join | 0 |\n| Select_full_range_join | 0 |\n| Select_range | 0 |\n| Select_range_check | 0 |\n| Select_scan | 2 |\n| Slave_connections | 0 |\n| Slave_heartbeat_period | 0.000 |\n| Slave_open_temp_tables | 0 |\n| Slave_received_heartbeats | 0 |\n| Slave_retried_transactions | 0 |\n| Slave_running | OFF |\n| Slave_skipped_errors | 0 |\n| Slaves_connected | 0 |\n| Slaves_running | 0 |\n| Slow_launch_threads | 0 |\n| Slow_queries | 0 |\n| Sort_merge_passes | 0 |\n| Sort_priority_queue_sorts | 0 |\n| Sort_range | 0 |\n| Sort_rows | 0 |\n| Sort_scan | 0 |\n| Ssl_accept_renegotiates | 0 |\n| Ssl_accepts | 0 |\n| Ssl_callback_cache_hits | 0 |\n| Ssl_cipher | |\n| Ssl_cipher_list | |\n| Ssl_client_connects | 0 |\n| Ssl_connect_renegotiates | 0 |\n| Ssl_ctx_verify_depth | 0 |\n| Ssl_ctx_verify_mode | 0 |\n| Ssl_default_timeout | 0 |\n| Ssl_finished_accepts | 0 |\n| Ssl_finished_connects | 0 |\n| Ssl_server_not_after | |\n| Ssl_server_not_before | |\n| Ssl_session_cache_hits | 0 |\n| Ssl_session_cache_misses | 0 |\n| Ssl_session_cache_mode | NONE |\n| Ssl_session_cache_overflows | 0 |\n| Ssl_session_cache_size | 0 |\n| Ssl_session_cache_timeouts | 0 |\n| Ssl_sessions_reused | 0 |\n| Ssl_used_session_cache_entries | 0 |\n| Ssl_verify_depth | 0 |\n| Ssl_verify_mode | 0 |\n| Ssl_version | |\n| Subquery_cache_hit | 0 |\n| Subquery_cache_miss | 0 |\n| Syncs | 2 |\n| Table_locks_immediate | 21 |\n| Table_locks_waited | 0 |\n| Tc_log_max_pages_used | 0 |\n| Tc_log_page_size | 4096 |\n| Tc_log_page_waits | 0 |\n| Threadpool_idle_threads | 0 |\n| Threadpool_threads | 0 |\n| Threads_cached | 0 |\n| Threads_connected | 1 |\n| Threads_created | 2 |\n| Threads_running | 1 |\n| Update_scan | 0 |\n| Uptime | 223 |\n| Uptime_since_flush_status | 223 |\n| wsrep_cluster_conf_id | 18446744073709551615 |\n| wsrep_cluster_size | 0 |\n| wsrep_cluster_state_uuid | |\n| wsrep_cluster_status | Disconnected |\n| wsrep_connected | OFF |\n| wsrep_local_bf_aborts | 0 |\n| wsrep_local_index | 18446744073709551615 |\n| wsrep_provider_name | |\n| wsrep_provider_vendor | |\n| wsrep_provider_version | |\n| wsrep_ready | OFF |\n| wsrep_thread_count | 0 |\n+--------------------------------------------------------------+----------------------------------------+\n516 rows in set (0.00 sec)\n \nExample of filtered output:\n \nSHOW STATUS LIKE \'Key%\';\n \n+------------------------+--------+\n| Variable_name | Value |\n+------------------------+--------+\n| Key_blocks_not_flushed | 0 |\n| Key_blocks_unused | 107163 |\n| Key_blocks_used | 0 |\n| Key_blocks_warm | 0 |\n| Key_read_requests | 0 |\n| Key_reads | 0 |\n| Key_write_requests | 0 |\n| Key_writes | 0 |\n+------------------------+--------+\n8 rows in set (0.00 sec)\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-status/','','https://mariadb.com/kb/en/library/show-status/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (397,26,'SHOW TABLE STATUS','Syntax\n------ \nSHOW TABLE STATUS [{FROM | IN} db_name]\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \n SHOW TABLE STATUS works like \n SHOW TABLES, but provides more extensive information about\neach non-TEMPORARY table.\n \nThe LIKE clause, if present on its own, indicates which\ntable names to\nmatch. The WHERE and LIKE clauses can be given to select\nrows using more general conditions, as discussed in Extended\nSHOW.\n \nThe following information is returned:\n \nColumn | Description | \n \nName | Table name. | \n \nEngine | Table storage engine. | \n \nVersion | Version number from the table\'s .frm file. | \n \nRow_format | Row format (see InnoDB, Aria and MyISAM row\nformats). | \n \nRows | Number of rows in the table. Some engines, such as\nXtraDB and InnoDB may store an estimate. | \n \nAvg_row_length | Average row length in the table. | \n \nData_length | For InnoDB/XtraDB, the index size, in pages,\nmultiplied by the page size. For Aria and MyISAM, length of\nthe data file, in bytes. For MEMORY, the approximate\nallocated memory. | \n \nMax_data_length | Maximum length of the data file, ie the\ntotal number of bytes that could be stored in the table. Not\nused in XtraDB and InnoDB. | \n \nIndex_length | Length of the index file. | \n \nData_free | Bytes allocated but unused. For InnoDB tables in\na shared tablespace, the free space of the shared tablespace\nwith small safety margin. An estimate in the case of\npartitioned tables - see the PARTITIONS table. | \n \nAuto_increment | Next AUTO_INCREMENT value. | \n \nCreate_time | Time the table was created. | \n \nUpdate_time | Time the table was last updated. On Windows,\nthe timestamp is not updated on update, so MyISAM values\nwill be inaccurate. In InnoDB, if shared tablespaces are\nused, will be NULL, while buffering can also delay the\nupdate, so the value will differ from the actual time of the\nlast UPDATE, INSERT or DELETE. | \n \nCheck_time | Time the table was last checked. Not kept by\nall storage engines, in which case will be NULL. | \n \nCollation | Character set and collation. | \n \nChecksum | Live checksum value, if any. | \n \nCreate_options | Extra CREATE TABLE options. | \n \nComment | Table comment provided when MariaDB created the\ntable. | \n \nSimilar information can be found in the\ninformation_schema.TABLES table as well as by using\nmysqlshow:\n \nmysqlshow --status db_name\n \nExample\n \nshow table status\\G\n*************************** 1. row\n***************************\n Name: bus_routes\n Engine: InnoDB\n Version: 10\n Row_format: Dynamic\n Rows: 5\n Avg_row_length: 3276\n Data_length: 16384\nMax_data_length: 0\n Index_length: 0\n Data_free: 0\n Auto_increment: NULL\n Create_time: 2017-05-24 11:17:46\n Update_time: NULL\n Check_time: NULL\n Collation: latin1_swedish_ci\n Checksum: NULL\n Create_options: \n Comment:\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-table-status/','','https://mariadb.com/kb/en/library/show-table-status/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (398,26,'SHOW TABLES','Syntax\n------ \nSHOW [FULL] TABLES [FROM db_name]\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \nSHOW TABLES lists the non-TEMPORARY tables, sequences and\nviews in a given database. \n \nThe LIKE clause, if present on its own, indicates which\ntable names to match. The WHERE and LIKE clauses can be\ngiven to select rows using more general conditions, as\ndiscussed in Extended SHOW. For example, when searching for\ntables in the test database, the column name for use in the\nWHERE and LIKE clauses will be Tables_in_test\n \nThe FULL modifier is supported such that SHOW FULL TABLES\ndisplays a second output column. Values for the second\ncolumn. Table_type, are BASE TABLE for a table, VIEW for a\nview and SEQUENCE for a sequence.\n \nYou can also get this information using:\n \nmysqlshow db_name\n \nSee mysqlshow for more details.\n \nIf you have no privileges for a base table or view, it does\nnot show up in the output from SHOW TABLES or mysqlshow\ndb_name.\n \nThe information_schema.TABLES table, as well as the SHOW\nTABLE STATUS statement, provide extended information about\ntables.\n \nExamples\n-------- \nSHOW TABLES;\n+----------------------+\n| Tables_in_test |\n+----------------------+\n| animal_count |\n| animals |\n| are_the_mooses_loose |\n| aria_test2 |\n| t1 |\n| view1 |\n+----------------------+\n \nShowing the tables beginning with a only.\n \nSHOW TABLES WHERE Tables_in_test LIKE \'a%\';\n+----------------------+\n| Tables_in_test |\n+----------------------+\n| animal_count |\n| animals |\n| are_the_mooses_loose |\n| aria_test2 |\n+----------------------+\n \nShowing tables and table types:\n \nSHOW FULL TABLES;\n+----------------+------------+\n| Tables_in_test | Table_type |\n+----------------+------------+\n| s1 | SEQUENCE |\n| student | BASE TABLE |\n| v1 | VIEW |\n+----------------+------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/show-tables/','','https://mariadb.com/kb/en/library/show-tables/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (399,26,'SHOW TABLE_STATISTICS','MariaDB 5.2 introduced the User Statistics feature.\n \nSyntax\n------ \nSHOW TABLE_STATISTICS\n \nDescription\n----------- \nThe SHOW TABLE_STATISTICS statement was introduced in\nMariaDB 5.2 as part of the User Statistics feature. It was\nremoved as a separate statement in MariaDB 10.1.1, but\neffectively replaced by the generic SHOW\ninformation_schema_table statement. The\ninformation_schema.TABLE_STATISTICS table shows statistics\non table usage\n \nThe userstat system variable must be set to 1 to activate\nthis feature. See the User Statistics and\ninformation_schema.TABLE_STATISTICS articles for more\ninformation.\n \nExample\n \nFrom MariaDB 10.0\n \nSHOW TABLE_STATISTICS\\G\n*************************** 1. row\n***************************\n Table_schema: mysql\n Table_name: proxies_priv\n Rows_read: 2\n Rows_changed: 0\nRows_changed_x_#indexes: 0\n*************************** 2. row\n***************************\n Table_schema: test\n Table_name: employees_example\n Rows_read: 7\n Rows_changed: 0\nRows_changed_x_#indexes: 0\n*************************** 3. row\n***************************\n Table_schema: mysql\n Table_name: user\n Rows_read: 16\n Rows_changed: 0\nRows_changed_x_#indexes: 0\n*************************** 4. row\n***************************\n Table_schema: mysql\n Table_name: db\n Rows_read: 2\n Rows_changed: 0\nRows_changed_x_#indexes: 0\n \n\n \n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/show-table-statistics/','','https://mariadb.com/kb/en/library/show-table-statistics/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (400,26,'SHOW TRIGGERS','Syntax\n------ \nSHOW TRIGGERS [FROM db_name]\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \n SHOW TRIGGERS lists the triggers currently defined for\ntables in a database (the default database unless a FROM\nclause is given). This statement requires the\nTRIGGER privilege (prior to MySQL\n5.1.22, it required the SUPER privilege). \n \nThe LIKE clause, if present on its own, indicates which\ntable names to\nmatch and causes the statement to display triggers for those\ntables. The WHERE and LIKE clauses can be given to select\nrows using more general conditions, as discussed in Extended\nSHOW.\n \nSimilar information is stored in the\ninformation_schema.TRIGGERS table.\n \nIf there are multiple triggers for the same action, then the\ntriggers are shown in action order.\n \nExamples\n-------- \nFor the trigger defined at Trigger Overview:\n \nSHOW triggers Like \'animals\' \\G\n*************************** 1. row\n***************************\n Trigger: the_mooses_are_loose\n Event: INSERT\n Table: animals\n Statement: BEGIN\n IF NEW.name = \'Moose\' THEN\n UPDATE animal_count SET animal_count.animals =\nanimal_count.animals+100;\n ELSE \n UPDATE animal_count SET animal_count.animals =\nanimal_count.animals+1;\n END IF;\nEND\n Timing: AFTER\n Created: 2016-09-29 13:53:34.35\n sql_mode: \n Definer: root@localhost\ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n Database Collation: latin1_swedish_ci\n \nListing all triggers associated with a certain table:\n \nSHOW TRIGGERS FROM test WHERE `Table` = \'user\' \\G\n*************************** 1. row\n***************************\n Trigger: user_ai\n Event: INSERT\n Table: user\n Statement: BEGIN END\n Timing: AFTER\n Created: 2016-09-29 13:53:34.35\n sql_mode: \n Definer: root@%\ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n Database Collation: latin1_swedish_ci\n \nSHOW triggers WHERE Event Like \'Insert\' \\G\n*************************** 1. row\n***************************\n Trigger: the_mooses_are_loose\n Event: INSERT\n Table: animals\n Statement: BEGIN\n IF NEW.name = \'Moose\' THEN\n UPDATE animal_count SET animal_count.animals =\nanimal_count.animals+100;\n ELSE \n UPDATE animal_count SET animal_count.animals =\nanimal_count.animals+1;\n END IF;\nEND\n Timing: AFTER\n Created: 2016-09-29 13:53:34.35\n sql_mode: \n Definer: root@localhost\ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n Database Collation: latin1_swedish_ci\ncharacter_set_client is the session value of the\ncharacter_set_client system variable when the trigger was\ncreated. \ncollation_connection is the session value of the\ncollation_connection system variable when the trigger was\n created. \nDatabase Collation is the collation of the database \n with which the trigger is associated.\n \nThese columns were added in MariaDB/MySQL 5.1.21.\n \nOld triggers created before MySQL 5.7 and MariaDB 10.2.3 has\nNULL in the Created column.\n \n\n\nURL: https://mariadb.com/kb/en/library/show-triggers/','','https://mariadb.com/kb/en/library/show-triggers/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (401,26,'SHOW USER_STATISTICS','MariaDB 5.2 introduced the User Statistics feature.\n \nSyntax\n------ \nSHOW USER_STATISTICS\n \nDescription\n----------- \nThe SHOW USER_STATISTICS statement was introduced in MariaDB\n5.2 as part of the User Statistics feature. It was removed\nas a separate statement in MariaDB 10.1.1, but effectively\nreplaced by the generic SHOW information_schema_table\nstatement. The information_schema.USER_STATISTICS table\nholds statistics about user activity. You can use this table\nto find out such things as which user is causing the most\nload and which users are being abusive. You can also use\nthis table to measure how close to capacity the server may\nbe.\n \nThe userstat system variable must be set to 1 to activate\nthis feature. See the User Statistics and\ninformation_schema.USER_STATISTICS table for more\ninformation.\n \nExample\n \nFrom MariaDB 10.0:\n \nSHOW USER_STATISTICS\\G\n*************************** 1. row\n***************************\n User: root\n Total_connections: 1\nConcurrent_connections: 0\n Connected_time: 3297\n Busy_time: 0.14113400000000006\n Cpu_time: 0.017637000000000003\n Bytes_received: 969\n Bytes_sent: 22355\n Binlog_bytes_written: 0\n Rows_read: 10\n Rows_sent: 67\n Rows_deleted: 0\n Rows_inserted: 0\n Rows_updated: 0\n Select_commands: 7\n Update_commands: 0\n Other_commands: 0\n Commit_transactions: 1\n Rollback_transactions: 0\n Denied_connections: 0\n Lost_connections: 0\n Access_denied: 0\n Empty_queries: 7\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-user-statistics/','','https://mariadb.com/kb/en/library/show-user-statistics/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (402,26,'SHOW VARIABLES','Syntax\n------ \nSHOW [GLOBAL | SESSION] VARIABLES\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \nSHOW VARIABLES shows the values of MariaDB system variables.\nThis\ninformation also can be obtained using the mysqladmin\nvariables\ncommand. The LIKE clause, if present, indicates which\nvariable names\nto match. The WHERE clause can be given to select rows using\nmore\ngeneral conditions.\n \nWith the GLOBAL modifier, SHOW VARIABLES displays the values\nthat are\nused for new connections to MariaDB. With SESSION, it\ndisplays the\nvalues that are in effect for the current connection. If no\nmodifier\nis present, the default is SESSION. LOCAL is a synonym for\nSESSION.\nWith a LIKE clause, the statement displays only rows for\nthose\nvariables with names that match the pattern. To obtain the\nrow for a\nspecific variable, use a LIKE clause as shown:\n \nSHOW VARIABLES LIKE \'maria_group_commit\';\n \nSHOW SESSION VARIABLES LIKE \'maria_group_commit\';\n \nTo get a list of variables whose name match a pattern, use\nthe \"%\"\nwildcard character in a LIKE clause:\n \nSHOW VARIABLES LIKE \'%maria%\';\n \nSHOW GLOBAL VARIABLES LIKE \'%maria%\';\n \nWildcard characters can be used in any position within the\npattern to\nbe matched. Strictly speaking, because \"_\" is a wildcard\nthat matches\nany single character, you should escape it as \"\\_\" to\nmatch it\nliterally. In practice, this is rarely necessary.\n \nThe WHERE and LIKE clauses can be given to select rows using\nmore general conditions, as discussed in Extended SHOW.\n \nSee SET for information on setting server system variables.\n \nSee Server System Variables for a list of all the variables\nthat can be set.\n \nYou can also see the server variables by querying the\nInformation Schema GLOBAL_VARIABLES and SESSION_VARIABLES\ntables.\n \nExamples\n-------- \nSHOW VARIABLES LIKE \'aria%\';\n \n+------------------------------------------+---------------------+\n| Variable_name | Value |\n+------------------------------------------+---------------------+\n| aria_block_size | 8192 |\n| aria_checkpoint_interval | 30 |\n| aria_checkpoint_log_activity | 1048576 |\n| aria_force_start_after_recovery_failures | 0 |\n| aria_group_commit | none |\n| aria_group_commit_interval | 0 |\n| aria_log_file_size | 1073741824 |\n| aria_log_purge_type | immediate |\n| aria_max_sort_file_size | 9223372036853727232 |\n| aria_page_checksum | ON |\n| aria_pagecache_age_threshold | 300 |\n| aria_pagecache_buffer_size | 134217728 |\n| aria_pagecache_division_limit | 100 |\n| aria_recover | NORMAL |\n| aria_repair_threads | 1 |\n| aria_sort_buffer_size | 134217728 |\n| aria_stats_method | nulls_unequal |\n| aria_sync_log_dir | NEWFILE |\n| aria_used_for_temp_tables | ON |\n+------------------------------------------+---------------------+\n \nSELECT VARIABLE_NAME, SESSION_VALUE, GLOBAL_VALUE FROM\n INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE\n VARIABLE_NAME LIKE \'max_error_count\' OR\n VARIABLE_NAME LIKE \'innodb_sync_spin_loops\';\n \n+---------------------------+---------------+--------------+\n| VARIABLE_NAME | SESSION_VALUE | GLOBAL_VALUE |\n+---------------------------+---------------+--------------+\n| MAX_ERROR_COUNT | 64 | 64 |\n| INNODB_SYNC_SPIN_LOOPS | NULL | 30 |\n+---------------------------+---------------+--------------+\n \nSET GLOBAL max_error_count=128;\n \nSELECT VARIABLE_NAME, SESSION_VALUE, GLOBAL_VALUE FROM\n INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE\n VARIABLE_NAME LIKE \'max_error_count\' OR\n VARIABLE_NAME LIKE \'innodb_sync_spin_loops\';\n \n+---------------------------+---------------+--------------+\n| VARIABLE_NAME | SESSION_VALUE | GLOBAL_VALUE |\n+---------------------------+---------------+--------------+\n| MAX_ERROR_COUNT | 64 | 128 |\n| INNODB_SYNC_SPIN_LOOPS | NULL | 30 |\n+---------------------------+---------------+--------------+\n \nSET GLOBAL max_error_count=128;\n \nSHOW VARIABLES LIKE \'max_error_count\';\n \n+-----------------+-------+\n| Variable_name | Value |\n+-----------------+-------+\n| max_error_count | 64 |\n+-----------------+-------+\n \nSHOW GLOBAL VARIABLES LIKE \'max_error_count\';\n \n+-----------------+-------+\n| Variable_name | Value |\n+-----------------+-------+\n| max_error_count | 128 |\n+-----------------+-------+\n \nBecause the following variable only has a global scope, the\nglobal value is returned even when specifying SESSION (in\nthis case by default):\n \nSHOW VARIABLES LIKE \'innodb_sync_spin_loops\';\n \n+------------------------+-------+\n| Variable_name | Value |\n+------------------------+-------+\n| innodb_sync_spin_loops | 30 |\n+------------------------+-------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-variables/','','https://mariadb.com/kb/en/library/show-variables/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (403,26,'SHOW WARNINGS','Syntax\n------ \nSHOW WARNINGS [LIMIT [offset,] row_count]\nSHOW ERRORS [LIMIT row_count OFFSET offset]\nSHOW COUNT(*) WARNINGS\n \nDescription\n----------- \n SHOW WARNINGS shows the error, warning, and note messages\nthat resulted from the last statement that generated\nmessages in the\ncurrent session. It shows nothing if the last statement used\na table\nand generated no messages. (That is, a statement that uses a\ntable but\ngenerates no messages clears the message list.) Statements\nthat do not\nuse tables and do not generate messages have no effect on\nthe message\nlist.\n \nA note is different to a warning in that it only appears if\nthe sql_notes variable is set to 1 (the default), and is not\nconverted to an error if strict mode is enabled.\n \nA related statement, SHOW ERRORS, shows only the errors.\n \nThe SHOW COUNT(*) WARNINGS statement displays the total\nnumber of errors, warnings, and notes. You can also retrieve\nthis number from\nthe warning_count variable:\n \nSHOW COUNT(*) WARNINGS;\nSELECT @@warning_count;\n \nThe value of warning_count might be greater than the number\nof messages displayed by SHOW WARNINGS if the\nmax_error_count system variable is set so low that not all\nmessages are stored.\n \nThe LIMIT clause has the same syntax as for the\n SELECT statement.\n \nSHOW WARNINGS can be used after EXPLAIN EXTENDED to see how\na query is internally rewritten by MariaDB.\n \nIf the sql_notes server variable is set to 1, Notes are\nincluded in the output of SHOW WARNINGS; if it is set to 0,\nthis statement will not show (or count) Notes.\n \nThe results of SHOW WARNINGS and SHOW COUNT(*) WARNINGS are\ndirectly sent to the client. If you need to access those\ninformation in a stored program, you can use the GET\nDIAGNOSTICS statement instead.\n \nFor a list of MariaDB error codes, see MariaDB Error Codes.\n \nThe mysql client also has a number of options related to\nwarnings. The \\W command will show warnings after every\nstatement, while \\w will disable this. Starting the client\nwith the --show-warnings option will show warnings after\nevery statement.\n \nMariaDB 10.3.1 implements a stored routine error stack\ntrace. SHOW WARNINGS can also be used to show more\ninformation. See the example below.\n \nExamples\n-------- \nSELECT 1/0;\n+------+\n| 1/0 |\n+------+\n| NULL |\n+------+\n \nSHOW COUNT(*) WARNINGS;\n+-------------------------+\n| @@session.warning_count |\n+-------------------------+\n| 1 |\n+-------------------------+\n \nSHOW WARNINGS;\n+---------+------+---------------+\n| Level | Code | Message |\n+---------+------+---------------+\n| Warning | 1365 | Division by 0 |\n+---------+------+---------------+\n \nStack Trace\n \nFrom MariaDB 10.3.1, displaying a stack trace:\n \nDELIMITER $$\nCREATE OR REPLACE PROCEDURE p1()\n BEGIN\n DECLARE c CURSOR FOR SELECT * FROM not_existing;\n OPEN c;\n CLOSE c;\n END;\n$$\nCREATE OR REPLACE PROCEDURE p2()\n BEGIN\n CALL p1;\n END;\n$$\nDELIMITER ;\nCALL p2;\nERROR 1146 (42S02): Table \'test.not_existing\' doesn\'t\nexist\n \nSHOW WARNINGS;\n+-------+------+-----------------------------------------+\n| Level | Code | Message |\n+-------+------+-----------------------------------------+\n| Error | 1146 | Table \'test.not_existing\' doesn\'t exist\n|\n| Note | 4091 | At line 6 in test.p1 |\n| Note | 4091 | At line 4 in test.p2 |\n+-------+------+-----------------------------------------+\n \nSHOW WARNINGS displays a stack trace, showing where the\nerror actually happened:\nLine 4 in test.p1 is the OPEN command which actually raised\nthe error\nLine 3 in test.p2 is the CALL statement, calling p1 from p2.\n \n\n\nURL: https://mariadb.com/kb/en/library/show-warnings/','','https://mariadb.com/kb/en/library/show-warnings/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (404,26,'SHOW WSREP_MEMBERSHIP','MariaDB 10.1.2\n \nSHOW WSREP_MEMBERSHIP was introduced with the WSREP_INFO\nplugin in MariaDB 10.1.2.\n \nSyntax\n------ \nSHOW WSREP_MEMBERSHIP\n \nDescription\n----------- \nThe SHOW WSREP_MEMBERSHIP statement returns Galera node\ncluster membership information. It returns the same\ninformation as found in the\ninformation_schema.WSREP_MEMBERSHIP table. Only users with\nthe SUPER privilege can access this information.\n \nExamples\n-------- \nSHOW WSREP_MEMBERSHIP;\n+-------+--------------------------------------+----------+-----------------+\n| Index | Uuid | Name | Address |\n+-------+--------------------------------------+----------+-----------------+\n| 0 | 19058073-8940-11e4-8570-16af7bf8fced | my_node1 |\n10.0.2.15:16001 |\n| 1 | 19f2b0e0-8942-11e4-9cb8-b39e8ee0b5dd | my_node3 |\n10.0.2.15:16003 |\n| 2 | d85e62db-8941-11e4-b1ef-4bc9980e476d | my_node2 |\n10.0.2.15:16002 |\n+-------+--------------------------------------+----------+-----------------+\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/show-wsrep_membership/','','https://mariadb.com/kb/en/library/show-wsrep_membership/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (405,26,'SHOW WSREP_STATUS','MariaDB 10.1.2\n \nSHOW WSREP_STATUS was introduced with the WSREP_INFO plugin\nin MariaDB 10.1.2.\n \nSyntax\n------ \nSHOW WSREP_STATUS\n \nDescription\n----------- \nThe SHOW WSREP_STATUS statement returns Galera node and\ncluster status information. It returns the same information\nas found in the information_schema.WSREP_STATUS table. Only\nusers with the SUPER privilege can access this information.\n \nExamples\n-------- \nSHOW WSREP_STATUS;\n+------------+-------------+----------------+--------------+\n| Node_Index | Node_Status | Cluster_Status | Cluster_Size |\n+------------+-------------+----------------+--------------+\n| 0 | Synced | Primary | 3 |\n+------------+-------------+----------------+--------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-wsrep_status/','','https://mariadb.com/kb/en/library/show-wsrep_status/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (406,27,'CALL','Syntax\n------ \nCALL sp_name([parameter[,...]])\nCALL sp_name[()]\n \nDescription\n----------- \nThe CALL statement invokes a stored procedure that was\ndefined previously with CREATE PROCEDURE. \n \nStored procedure names can be specified as\ndatabase_name.procedure_name. Procedure names and database\nnames can be quoted with backticks (). This is necessary if\nthey are reserved words, or contain special characters. See\nidentifier qualifiers for details.\n \nBefore MySQL 5.1.13, stored procedures that take no\narguments required parentheses. In current releases of\nMariaDB, CALL p() and CALL p are equivalent.\n \nIf parentheses are used, any number of spaces, tab\ncharacters and new line characters is allowed between the\nprocedure\'s name and the open parenthesis.\n \nCALL can pass back values to its caller using parameters\nthat are declared as OUT or INOUT\nparameters. If no value is assigned to an OUT parameter,\nNULL is assigned (and its former value is lost). To pass\nsuch values from another stored program you can use\nuser-defined variables, local variables or routine\'s\nparameters; in other contexts, you can only use user-defined\nvariables. \n \nCALL can also be executed as a prepared statement.\nPlaceholders can be used for IN parameters in all versions\nof MariaDB; for OUT and INOUT parameters, placeholders can\nbe used since MariaDB 5.5.\n \nWhen the procedure returns, a client program can also obtain\nthe\nnumber of rows affected for the final statement executed\nwithin the routine: At\nthe SQL level, call the ROW_COUNT() function; from the C\nAPI, call the mysql_affected_rows() function.\n \nIf the CLIENT_MULTI_RESULTS API flag is set, CALL can return\nany number of resultsets and the called stored procedure can\nexecute prepared statements. If it is not set, at most one\nresultset can be returned and prepared statements cannot be\nused within procedures.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/call/','','https://mariadb.com/kb/en/library/call/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (407,27,'Concurrent Inserts','The MyISAM storage engine supports concurrent inserts. This\nfeature allows SELECT statements to be executed during\nINSERT operations, reducing contention.\n \nWhether concurrent inserts can be used or not depends on the\nvalue of the concurrent_insert server system variable:\nNEVER (0) disables concurrent inserts.\nAUTO (1) allows concurrent inserts only when the target\ntable has no free blocks (no data in the middle of the table\nhas been deleted after the last OPTIMIZE TABLE). This is the\ndefault.\nALWAYS (2) always enables concurrent inserts.\n \nIf the binary log is used, CREATE TABLE ... SELECT and\nINSERT ... SELECT statements cannot use concurrent inserts.\nThese statements acquire a read lock on the table, so\nconcurrent inserts will need to wait. This way the log can\nbe safely used to restore data.\n \nConcurrent inserts is not used by slaves with the row based\nreplication (see binary log formats).\n \nIf an INSERT statement contain the HIGH_PRIORITY clause,\nconcurrent inserts cannot be used. INSERT ... DELAYED is\nusually unneeded if concurrent inserts are enabled.\n \nLOAD DATA INFILE uses concurrent inserts if the CONCURRENT\nkeyword is specified and concurrent_insert is not NEVER.\nThis makes the statement slower (even if no other sessions\naccess the table) but reduces contention.\n \nLOCK TABLES allows non-conflicting concurrent inserts if a\nREAD LOCAL lock is used. Concurrent inserts are not allowed\nif the LOCAL keyword is omitted.\n \nNotes\n \nThe decision to enable concurrent insert for a table is done\nwhen the table is opened. If you change the value of\nconcurrent_insert it will only affect new opened tables. If\nyou want it to work for also for tables in use or cached,\nyou should do FLUSH TABLES after setting the variable.\n \n\n\nURL: https://mariadb.com/kb/en/library/concurrent-inserts/','','https://mariadb.com/kb/en/library/concurrent-inserts/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (408,27,'DELETE','Syntax\n------ \nSingle-table syntax:\n \nDELETE [LOW_PRIORITY] [QUICK] [IGNORE] \n FROM tbl_name [PARTITION (partition_list)]\n [WHERE where_condition]\n [ORDER BY ...]\n [LIMIT row_count]\n [RETURNING select_expr \n [, select_expr ...]]\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 \nTrimming history:\n \nDELETE HISTORY\n FROM tbl_name [PARTITION (partition_list)]\n [BEFORE SYSTEM_TIME [TIMESTAMP|TRANSACTION] expression]\n \nDescription\n----------- \nOption | Description | \n \nLOW_PRIORITY | Wait until all SELECT\'s are done before\nstarting the statement. Used with storage engines that uses\ntable locking (MyISAM, Aria etc). See HIGH_PRIORITY and\nLOW_PRIORITY clauses for details. | \n \nQUICK | Signal the storage engine that it should expect that\na lot of rows are deleted. The storage engine engine can do\nthings to speed up the DELETE like ignoring merging of data\nblocks until all rows are deleted from the block (instead of\nwhen a block is half full). This speeds up things at the\nexpanse of lost space in data blocks. At least MyISAM and\nAria support this feature. | \n \nIGNORE | Don\'t stop the query even if a not-critical error\noccurs (like data overflow). See How IGNORE works for a full\ndescription. | \n \nFor the single-table syntax, the DELETE statement deletes\nrows\nfrom tbl_name and returns a count of the number of deleted\nrows. This count can\nbe obtained by calling the ROW_COUNT() function. The\nWHERE clause, if given, specifies the conditions that\nidentify\nwhich rows to delete. With no WHERE clause, all rows are\ndeleted. If the ORDER BY clause is specified, the rows are\ndeleted in the order that is specified. The LIMIT clause\nplaces a limit on the number of rows that can be deleted.\n \nFor the multiple-table syntax, DELETE deletes from each\ntbl_name the rows that satisfy the conditions. In this case,\nORDER BY and LIMIT> cannot be used. A DELETE can also\nreference tables which are located in different databases;\nsee Identifier Qualifiers for the syntax.\n \nwhere_condition is an expression that evaluates to true for\neach row to be deleted. It is specified as described in\nSELECT.\n \nCurrently, you cannot delete from a table and select from\nthe same\ntable in a subquery.\n \nYou need the DELETE privilege on a table to delete rows from\nit. You need only the SELECT privilege for any columns that\nare only read, such as those named in the WHERE clause. See\nGRANT.\n \nThe PARTITION clause was introduced in MariaDB 10.0. See\nPartition Pruning and Selection for details.\n \nAs stated, a DELETE statement with no WHERE\nclause deletes all rows. A faster way to do this, when you\ndo not need to know\nthe number of deleted rows, is to use TRUNCATE TABLE.\nHowever,\nwithin a transaction or if you have a lock on the table, \nTRUNCATE TABLE cannot be used whereas DELETE\ncan. See TRUNCATE TABLE, and\nLOCK.\n \nFrom MariaDB 10.0.5, it is possible to return a resultset of\nthe deleted rows for a single table to the client by using\nthe syntax DELETE ... RETURNING select_expr [, select_expr2\n...]]\n \nAny of SQL expression that can be calculated from a single\nrow fields is allowed. Subqueries are allowed. The AS\nkeyword is allowed, so it is possible to use aliases.\n \nThe use of aggregate functions is not allowed. RETURNING\ncannot be used in multi-table DELETEs.\n \nSame Source and Target Table\n \nUntil MariaDB 10.3.1, deleting from a table with the same\nsource and target was not possible. From MariaDB 10.3.1,\nthis is now possible. For example:\n \nDELETE FROM t1 WHERE c1 IN (SELECT b.c1 FROM t1 b WHERE\nb.c2=0);\n \nOne can use DELETE HISTORY to delete historical information\nfrom System-versioned tables.\n \nExamples\n-------- \nHow to use the ORDER BY and LIMIT clauses:\n \nDELETE FROM page_hit ORDER BY timestamp LIMIT 1000000;\n \nHow to use the RETURNING clause:\n \nDELETE FROM t RETURNING f1;\n \n+------+\n| f1 |\n+------+\n| 5 |\n| 50 |\n| 500 |\n+------+ \n \nThe following statement joins two tables: one is only used\nto satisfy a WHERE condition, but no row is deleted from it;\nrows from the other table are deleted, instead.\n \nDELETE post FROM blog INNER JOIN post WHERE blog.id =\npost.blog_id;\n \nDeleting from the Same Source and Target\n \nCREATE TABLE t1 (c1 INT, c2 INT);\nDELETE FROM t1 WHERE c1 IN (SELECT b.c1 FROM t1 b WHERE\nb.c2=0);\n \nUntil MariaDB 10.3.1, this returned:\n \nERROR 1093 (HY000): Table \'t1\' is specified twice, both as\na target for \'DELETE\' \n and as a separate source for\n \nFrom MariaDB 10.3.1:\n \nQuery OK, 0 rows affected (0.00 sec)\n \n\n\nURL: https://mariadb.com/kb/en/library/delete/','','https://mariadb.com/kb/en/library/delete/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (409,27,'DO','Syntax\n------ \nDO expr [, expr] ...\n \nDescription\n----------- \n DO executes the expressions but does not return any\nresults. In most respects, DO is shorthand for\n SELECT expr, ..., but has the advantage that it is slightly\nfaster when you do not care about the result.\n \n DO is useful primarily with functions that have side\n effects, such as RELEASE_LOCK().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/do/','','https://mariadb.com/kb/en/library/do/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (410,27,'DUAL','Description\n----------- \nYou are allowed to specify DUAL as a dummy table name in\nsituations where no tables are referenced, such as the\nfollowing SELECT statement:\n \nSELECT 1 + 1 FROM DUAL;\n \n+-------+\n| 1 + 1 |\n+-------+\n| 2 |\n+-------+\n \n DUAL is purely for the convenience of people who require\n that all SELECT statements should have\n FROM and possibly other clauses. MariaDB ignores the\n clauses. MariaDB does not require FROM DUAL if no tables\n are referenced.\n \nFROM DUAL could be used when you only SELECT computed\nvalues, but require a WHERE clause, perhaps to test that a\nscript correctly handles empty resultsets:\n \nSELECT 1 FROM DUAL WHERE FALSE;\n \nEmpty set (0.00 sec)\n \n\n\nURL: https://mariadb.com/kb/en/library/dual/','','https://mariadb.com/kb/en/library/dual/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (411,27,'EXCEPT','EXCEPT was introduced in MariaDB 10.3.0.\n \nThe result of EXCEPT is all records of the left SELECT\nresult set except records which are in right SELECT result\nset, i.e. it is subtraction of two result sets.\n \nSyntax\n------ \nSELECT ...\n(INTERSECT | EXCEPT | UNION [ALL | DISTINCT]) SELECT ...\n[(INTERSECT | EXCEPT | UNION [ALL | DISTINCT]) SELECT ...]\n[ORDER BY [column [, column ...]]]\n[LIMIT {[offset,] row_count | row_count OFFSET offset}]\n \nPlease note:\nALL is not supported by EXCEPT (and it is difficult to make\nsense of ALL with EXCEPT).\nBrackets for explicit operation precedence are not\nsupported; use a subquery in the FROM clause as a\nworkaround).\n \nDescription\n----------- \nMariaDB has supported EXCEPT and INTERSECT in addition to\nUNION since MariaDB 10.3.\n \nAll behavior for naming columns, ORDER BY and LIMIT is the\nsame as for UNION.\n \nEXCEPT implicitly supposes a DISTINCT operation.\n \nThe result of EXCEPT is all records of the left SELECT\nresult except records which are in right SELECT result set,\ni.e. it is subtraction of two result sets.\n \nEXCEPT and UNION have the same operation precedence.\n \n\nParentheses\n \nFrom MariaDB 10.4.0, parentheses can be used to specify\nprecedence. Before this, a syntax error would be returned.\n \nExamples\n-------- \nShow customers which are not employees:\n \n(SELECT e_name AS name, email FROM customers)\nEXCEPT\n(SELECT c_name AS name, email FROM employees);\n \nDifference between UNION, EXCEPT and INTERSECT:\n \nCREATE TABLE seqs (i INT);\nINSERT INTO seqs VALUES (1),(2),(3),(4),(5),(6);\n \nSELECT i FROM seqs WHERE i =3;\n \n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n| 3 |\n| 4 |\n| 5 |\n| 6 |\n+------+\n \nSELECT i FROM seqs WHERE i =3;\n \n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n+------+\n \nSELECT i FROM seqs WHERE i =3;\n \n+------+\n| i |\n+------+\n| 3 |\n+------+\n \nParentheses for specifying precedence, from MariaDB 10.4.0\n \nCREATE OR REPLACE TABLE t1 (a INT);\nCREATE OR REPLACE TABLE t2 (b INT);\nCREATE OR REPLACE TABLE t3 (c INT);\n \nINSERT INTO t1 VALUES (1),(2),(3),(4);\nINSERT INTO t2 VALUES (5),(6);\nINSERT INTO t3 VALUES (1),(6);\n \n((SELECT a FROM t1) UNION (SELECT b FROM t2)) EXCEPT (SELECT\nc FROM t3);\n+------+\n| a |\n+------+\n| 2 |\n| 3 |\n| 4 |\n| 5 |\n+------+\n \n(SELECT a FROM t1) UNION ((SELECT b FROM t2) EXCEPT (SELECT\nc FROM t3));\n+------+\n| a |\n+------+\n| 1 |\n| 2 |\n| 3 |\n| 4 |\n| 5 |\n+------+\n \n\n\nURL: https://mariadb.com/kb/en/library/except/','','https://mariadb.com/kb/en/library/except/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (412,27,'FOR UPDATE','The FOR UPDATE clause of SELECT applies only when autocommit\nis set to 0 or the SELECT is enclosed in a transaction. A\nlock is acquired on the rows, and other transactions are\nprevented from writing the rows, acquire locks, and from\nreading them (unless their isolation level is READ\nUNCOMMITTED).\n \nIf autocommit is set to 1, the LOCK IN SHARE MODE and FOR\nUPDATE clauses have no effect.\n \nIf the isolation level is set to SERIALIZABLE, all plain\nSELECT statements are converted to SELECT ... LOCK IN SHARE\nMODE.\n \nExample\n \nSELECT * FROM trans WHERE period=2001 FOR UPDATE;\n \n\n\nURL: https://mariadb.com/kb/en/library/for-update/','','https://mariadb.com/kb/en/library/for-update/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (413,27,'GROUP BY','Use the GROUP BY clause in a SELECT statement to group rows\ntogether that have the same value in one or more column, or\nthe same computed value using expressions with any\nfunctions and operators except\ngrouping functions. When you\nuse a GROUP BY clause, you will get a single result row for\neach group of rows\nthat have the same value for the expression given in GROUP\nBY.\n \nWhen grouping rows, grouping values are compared as if by\nthe = operator.\nFor string values, the = operator ignores trailing\nwhitespace and may normalize\ncharacters and ignore case, depending on the collation in\nuse.\n \nYou can use any of the grouping functions in your select\nexpression. Their values will\nbe calculated based on all the rows that have been grouped\ntogether for each result\nrow. If you select a non-grouped column or a value computed\nfrom a non-grouped\ncolumn, it is undefined which row the returned value is\ntaken from. This is not permitted if the ONLY_FULL_GROUP_BY\nSQL_MODE is used.\n \nYou can use multiple expressions in the GROUP BY clause,\nseparated by commas.\nRows are grouped together if they match on each of the\nexpressions.\n \nYou can also use a single integer as the grouping\nexpression. If you use an integer n,\nthe results will be grouped by the nth column in the select\nexpression.\n \nThe WHERE clause is applied before the GROUP BY clause. It\nfilters non-aggregated\nrows before the rows are grouped together. To filter grouped\nrows based on aggregate values,\nuse the HAVING clause. The HAVING clause takes any\nexpression and evaluates it as\na boolean, just like the WHERE clause. You can use grouping\nfunctions in the HAVING\nclause. As with the select expression, if you reference\nnon-grouped columns in the HAVING\nclause, the behavior is undefined.\n \nBy default, if a GROUP BY clause is present, the rows in the\noutput will be sorted by the expressions used in the GROUP\nBY. You can also specify ASC or DESC (ascending, descending)\nafter those expressions, like in ORDER BY. The default is\nASC.\n \nIf you want the rows to be sorted by another field, you can\nadd an explicit ORDER BY. If you don\'t want the result to\nbe ordered, you can add ORDER BY NULL.\n \nWITH ROLLUP\n \nThe WITH ROLLUP modifer adds extra rows to the resultset\nthat represent super-aggregate summaries. For a full\ndescription with examples, see SELECT WITH ROLLUP.\n \nGROUP BY Examples\n \nConsider the following table that records how many times\neach user has played and won a game:\n \nCREATE TABLE plays (name VARCHAR(16), plays INT, wins INT);\nINSERT INTO plays VALUES \n (\"John\", 20, 5), \n (\"Robert\", 22, 8), \n (\"Wanda\", 32, 8), \n (\"Susan\", 17, 3);\n \nGet a list of win counts along with a count:\n \nSELECT wins, COUNT(*) FROM plays GROUP BY wins;\n \n+------+----------+\n| wins | COUNT(*) |\n+------+----------+\n| 3 | 1 |\n| 5 | 1 |\n| 8 | 2 |\n+------+----------+\n3 rows in set (0.00 sec)\n \nThe GROUP BY expression can be a computed value, and can\nrefer back to an identifer\nspecified with AS. Get a list of win averages along with a\ncount:\n \nSELECT (wins / plays) AS winavg, COUNT(*) FROM plays GROUP\nBY winavg;\n \n+--------+----------+\n| winavg | COUNT(*) |\n+--------+----------+\n| 0.1765 | 1 |\n| 0.2500 | 2 |\n| 0.3636 | 1 |\n+--------+----------+\n3 rows in set (0.00 sec)\n \nYou can use any grouping function\nin the select expression. For each win average as above, get\na list of the average play\ncount taken to get that average:\n \nSELECT (wins / plays) AS winavg, AVG(plays) FROM plays \n GROUP BY winavg;\n \n+--------+------------+\n| winavg | AVG(plays) |\n+--------+------------+\n| 0.1765 | 17.0000 |\n| 0.2500 | 26.0000 |\n| 0.3636 | 22.0000 |\n+--------+------------+\n3 rows in set (0.00 sec)\n \nYou can filter on aggregate information using the HAVING\nclause. The HAVING\nclause is applied after GROUP BY and allows you to filter on\naggregate data that is\nnot available to the WHERE clause. Restrict the above\nexample to results that involve\nan average number of plays over 20:\n \nSELECT (wins / plays) AS winavg, AVG(plays) FROM plays \n GROUP BY winavg HAVING AVG(plays) > 20;\n \n+--------+------------+\n| winavg | AVG(plays) |\n+--------+------------+\n| 0.2500 | 26.0000 |\n| 0.3636 | 22.0000 |\n+--------+------------+\n2 rows in set (0.00 sec)\n \nSee Also\n \nSELECT\nJoins and Subqueries\nLIMIT\nORDER BY\nCommon Table Expressions\nSELECT WITH ROLLUP\nSELECT INTO OUTFILE\nSELECT INTO DUMPFILE\nFOR UPDATE\nLOCK IN SHARE MODE\nOptimizer Hints\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/group-by/','','https://mariadb.com/kb/en/library/group-by/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (414,27,'HANDLER Commands','Syntax\n------ \nHANDLER tbl_name OPEN [ [AS] alias]\nHANDLER tbl_name READ index_name { = | >= | = | \n\nURL: https://mariadb.com/kb/en/library/handler-commands/','','https://mariadb.com/kb/en/library/handler-commands/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (415,27,'HIGH_PRIORITY and LOW_PRIORITY','The XtraDB/InnoDB storage engine uses row-level locking to\nensure data integrity. However some storage engines (such as\nMEMORY, MyISAM, Aria and MERGE) lock the whole table to\nprevent conflicts. These storage engines use two separate\nqueues to remember pending statements; one is for SELECTs\nand the other one is for write statements (INSERT, DELETE,\nUPDATE). By default, the latter has a higher priority.\n \nTo give write operations a lower priority, the\nlow_priority_updates server system variable can be set to\nON. The option is available on both the global and session\nlevels, and it can be set at startup or via the SET\nstatement.\n \nWhen too many table locks have been set by write statements,\nsome pending SELECTs are executed. The maximum number of\nwrite locks that can be acquired before this happens is\ndetermined by the max_write_lock_count server system\nvariable, which is dynamic.\n \nIf write statements have a higher priority (default), the\npriority of individual write statements (INSERT, REPLACE,\nUPDATE, DELETE) can be changed via the LOW_PRIORITY\nattribute, and the priority of a SELECT statement can be\nraised via the HIGH_PRIORITY attribute. Also, LOCK TABLES\nsupports a LOW_PRIORITY attribute for WRITE locks.\n \nIf read statements have a higher priority, the priority of\nan INSERT can be changed via the HIGH_PRIORITY attribute.\nHowever, the priority of other write statements cannot be\nraised individually.\n \nThe use of LOW_PRIORITY or HIGH_PRIORITY for an INSERT\nprevents Concurrent Inserts from being used.\n \n\n\nURL:\nhttps://mariadb.com/kb/en/library/high_priority-and-low_priority/','','https://mariadb.com/kb/en/library/high_priority-and-low_priority/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (416,27,'IGNORE','The IGNORE option tells the server to ignore some common\nerrors.\n \nIGNORE can be used with the following statements:\nDELETE\nINSERT (see also INSERT IGNORE)\nLOAD DATA INFILE\nUPDATE\nALTER TABLE\nCREATE TABLE ... SELECT\nINSERT ... SELECT\n \nThe logic used:\nVariables out of ranges are replaced with the\nmaximum/minimum value.\n \nSQL_MODEs STRICT_TRANS_TABLES, STRICT_ALL_TABLES,\nNO_ZERO_IN_DATE, NO_ZERO_DATE are ignored.\n \nInserting NULL in a NOT NULL field will insert 0 ( in a\nnumerical\n field), 0000-00-00 ( in a date field) or an empty string (\nin a character\n field).\n \nRows that cause a duplicate key error or break a foreign key\nconstraint are\n not inserted, updated, or deleted.\n \nThe following errors are ignored:\n \nError number | Symbolic error name | Description | \n \n1022 | ER_DUP_KEY | Can\'t write; duplicate key in table\n\'%s\' | \n \n1048 | ER_BAD_NULL_ERROR | Column \'%s\' cannot be null | \n \n1062 | ER_DUP_ENTRY | Duplicate entry \'%s\' for key %d | \n \n1242 | ER_SUBQUERY_NO_1_ROW | Subquery returns more than 1\nrow | \n \n1264 | ER_WARN_DATA_OUT_OF_RANGE | Out of range value for\ncolumn \'%s\' at row %ld | \n \n1265 | WARN_DATA_TRUNCATED | Data truncated for column\n\'%s\' at row %ld | \n \n1292 | ER_TRUNCATED_WRONG_VALUE | Truncated incorrect %s\nvalue: \'%s\' | \n \n1366 | ER_TRUNCATED_WRONG_VALUE_FOR_FIELD | Incorrect\ninteger value | \n \n1369 | ER_VIEW_CHECK_FAILED | CHECK OPTION failed \'%s.%s\'\n| \n \n1451 | ER_ROW_IS_REFERENCED_2 | Cannot delete or update a\nparent row | \n \n1452 | ER_NO_REFERENCED_ROW_2 | Cannot add or update a child\nrow: a foreign key constraint fails (%s) | \n \n1526 | ER_NO_PARTITION_FOR_GIVEN_VALUE | Table has no\npartition for value %s | \n \n1586 | ER_DUP_ENTRY_WITH_KEY_NAME | Duplicate entry \'%s\'\nfor key \'%s\' | \n \n1591 | ER_NO_PARTITION_FOR_GIVEN_VALUE_SILENT | Table has no\npartition for some existing values | \n \n1748 | ER_ROW_DOES_NOT_MATCH_GIVEN_PARTITION_SET | Found a\nrow not matching the given partition set | \n \nIgnored errors normally generate a warning.\n \nA property of the IGNORE clause consists in causing\ntransactional engines and non-transactional engines (like\nXtraDB and Aria) to behave the same way. For example,\nnormally a multi-row insert which tries to violate a UNIQUE\ncontraint is completely rolled back on XtraDB/InnoDB, but\nmight be partially executed on Aria. With the IGNORE clause,\nthe statement will be partially executed in both engines.\n \nStarting from MariaDB 5.5.28 duplicate key errors also\ngenerate warnings. The OLD_MODE server variable can be used\nto prevent this.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/ignore/','','https://mariadb.com/kb/en/library/ignore/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (417,27,'INSERT','Syntax\n------ \nINSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [PARTITION (partition_list)] [(col,...)]\n {VALUES | VALUE} ({expr | DEFAULT},...),(...),...\n [ ON DUPLICATE KEY UPDATE\n col=expr\n [, col=expr] ... ]\n \nOr:\n \nINSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [PARTITION (partition_list)]\n SET col={expr | DEFAULT}, ...\n [ ON DUPLICATE KEY UPDATE\n col=expr\n [, col=expr] ... ]\n \nOr:\n \nINSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [PARTITION (partition_list)] [(col,...)]\n SELECT ...\n [ ON DUPLICATE KEY UPDATE\n col=expr\n [, col=expr] ... ]\n \nThe INSERT statement is used to insert new rows into an\nexisting table. The INSERT ... VALUES\nand INSERT ... SET forms of the statement insert rows based\non explicitly specified values. The INSERT ... SELECT form\ninserts rows selected from another table or tables. INSERT\n... SELECT is discussed further in the INSERT ... SELECT\narticle.\n \nThe table name can be specified in the form db_name.tbl_name\nor, if a default database is selected, in the form tbl_name\n(see Identifier Qualifiers). This allows to use INSERT ...\nSELECT to copy rows between different databases.\n \nThe PARTITION clause was introduced in MariaDB 10.0. It can\nbe used in both the INSERT and the SELECT part. See\nPartition Pruning and Selection for details.\n \nThe columns list is optional. It specifies which values are\nexplicitly inserted, and in which order. If this clause is\nnot specified, all values must be explicitly specified, in\nthe same order they are listed in the table definition.\n \nThe list of value follow the VALUES or VALUE keyword (which\nare interchangeable, regardless how much values you want to\ninsert), and is wrapped by parenthesis. The values must be\nlisted in the same order as the columns list. It is possible\nto specify more than one list to insert more than one rows\nwith a single statement. If many rows are inserted, this is\na speed optimization.\n \nFor one-row statements, the SET clause may be more simple,\nbecause you don\'t need to remember the columns order. All\nvalues are specified in the form col = expr.\n \nValues can also be specified in the form of a SQL expression\nor subquery. However, the subquery cannot access the same\ntable that is named in the INTO clause.\n \nIf you use the LOW_PRIORITY keyword, execution of the INSERT\nis delayed until no other clients are reading from the\ntable. If you use the HIGH_PRIORITY keyword, the statement\nhas the same priority as SELECTs. This affects only storage\nengines that use only table-level locking (MyISAM, MEMORY,\nMERGE). However, if one of these keywords is specified,\nconcurrent inserts cannot be used. See HIGH_PRIORITY and\nLOW_PRIORITY clauses for details.\n \nINSERT DELAYED\n \nFor more details on the DELAYED option, see INSERT DELAYED.\n \nHIGH PRIORITY and LOW PRIORITY\n \nSee HIGH_PRIORITY and LOW_PRIORITY.\n \nDefaults and Duplicate Values\n \nSee INSERT - Default & Duplicate Values for details..\n \nINSERT IGNORE\n \nSee INSERT IGNORE.\n \nINSERT ON DUPLICATE KEY UPDATE\n \nSee INSERT ON DUPLICATE KEY UPDATE.\n \nExamples\n-------- \nSpecifying the column names:\n \nINSERT INTO person (first_name, last_name) VALUES (\'John\',\n\'Doe\');\n \nInserting more than 1 row at a time:\n \nINSERT INTO tbl_name VALUES (1, \"row 1\"), (2, \"row 2\");\n \nUsing the SET clause:\n \nINSERT INTO person SET first_name = \'John\', last_name =\n\'Doe\';\n \nSELECTing from another table:\n \nINSERT INTO contractor SELECT * FROM person WHERE status =\n\'c\';\n \nSee INSERT ON DUPLICATE KEY UPDATE and INSERT IGNORE for\nfurther examples.\n \n\n\nURL: https://mariadb.com/kb/en/library/insert/','','https://mariadb.com/kb/en/library/insert/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (418,27,'INSERT - Default &amp; Duplicate Values','Default Values\n \nIf the SQL_MODE contains STRICT_TRANS_TABLES and you are\ninserting into a transactional table (like InnoDB), or if\nthe SQL_MODE contains STRICT_ALL_TABLES, all NOT NULL\ncolumns which does not have a DEFAULT value (and is not\nAUTO_INCREMENT) must be explicitly referenced in INSERT\nstatements. If not, an error like this is produced:\n \nERROR 1364 (HY000): Field \'col\' doesn\'t have a default\nvalue\n \nIn all other cases, if a NOT NULL column without a DEFAULT\nvalue is not referenced, an empty value will be inserted\n(for example, 0 for INTEGER columns and \'\' for CHAR\ncolumns). See NULL Values in MariaDB:Inserting for examples.\n \nIf a NOT NULL column having a DEFAULT value is not\nreferenced, NULL will be inserted.\n \nIf a NULL column having a DEFAULT value is not referenced,\nits default value will be inserted. It is also possible to\nexplicitly assign the default value using the DEFAULT\nkeyword or the DEFAULT() function.\n \nIf the DEFAULT keyword is used but the column does not have\na DEFAULT value, an error like this is produced:\n \nERROR 1364 (HY000): Field \'col\' doesn\'t have a default\nvalue\n \nDuplicate Values\n \nBy default, if you try to insert a duplicate row and there\nis a UNIQUE index, INSERT stops and an error like this is\nproduced:\n \nERROR 1062 (23000): Duplicate entry \'dup_value\' for key\n\'col\'\n \nTo handle duplicates you can use the IGNORE clause, INSERT\nON DUPLICATE KEY UPDATE or the REPLACE statement. Note that\nthe IGNORE and DELAYED options are ignored when you use ON\nDUPLICATE KEY UPDATE.\n \n\n\nURL:\nhttps://mariadb.com/kb/en/library/insert-default-duplicate-values/','','https://mariadb.com/kb/en/library/insert-default-duplicate-values/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (419,27,'INSERT DELAYED','Syntax\n------ \nINSERT DELAYED ...\n \nDescription\n----------- \nThe DELAYED option for the INSERT\nstatement is a MariaDB/MySQL extension to standard SQL that\nis very useful if you have\nclients that cannot or need not wait for the INSERT to\ncomplete. This is a common situation when you use MariaDB\nfor logging and you\nalso periodically run SELECT and UPDATE\nstatements that take a long time to complete.\n \nWhen a client uses INSERT DELAYED, it gets an okay from the\nserver at once, and the row is queued to be inserted when\nthe table is not in\nuse by any other thread.\n \nAnother major benefit of using INSERT DELAYED is that\ninserts from many clients are bundled together and written\nin one block. This\nis much faster than performing many separate inserts.\n \nNote that INSERT DELAYED is slower than a normal\n INSERT if the table is not otherwise in use. There is also\nthe additional overhead for the server to handle a separate\nthread for each\ntable for which there are delayed rows. This means that you\nshould use\nINSERT DELAYED only when you are really sure that you need\nit.\n \nThe queued rows are held only in memory until they are\ninserted into the table.\nThis means that if you terminate mysqld forcibly (for\nexample, with kill -9) or\nif mysqld dies unexpectedly, any queued rows that have not\nbeen written to disk\nare lost.\n \nThe number of concurrent INSERT DELAYED threads is limited\nby the max_delayed_threads server system variables. If it is\nset to 0, INSERT DELAYED is disabled. The session value can\nbe equal to the global value, or 0 to disable this statement\nfor the current session. If this limit has been reached, the\nDELAYED clause will be silently ignore for subsequent\nstatements (no error will be produced).\n \nThere are some constraints on the use of DELAYED:\nINSERT DELAYED works only with MyISAM, MEMORY, ARCHIVE,\n and BLACKHOLE tables. If you execute INSERT DELAYED with\nanother storage engine, you will get an error like this:\nERROR 1616 (HY000): DELAYED option not supported for table\n\'tab_name\'\nFor MyISAM tables, if there are no free blocks in the middle\nof the data\n file, concurrent SELECT and INSERT statements are\nsupported. Under these\n circumstances, you very seldom need to use INSERT DELAYED\n with MyISAM.\nINSERT DELAYED should be used only for\n INSERT statements that specify value lists. The server\n ignores DELAYED for INSERT ... SELECT\n or INSERT ... ON DUPLICATE KEY UPDATE statements.\nBecause the INSERT DELAYED statement returns immediately,\n before the rows are inserted, you cannot use\n LAST_INSERT_ID() to get the\n AUTO_INCREMENT value that the statement might generate.\nDELAYED rows are not visible to SELECT\n statements until they actually have been inserted.\nAfter INSERT DELAYED, ROW_COUNT() returns the number of the\nrows you tried to insert, not the number of the successful\nwrites.\nDELAYED is ignored on slave replication servers, so that \n INSERT DELAYED is treated as a normal\n INSERT on slaves. This is because\n DELAYED could cause the slave to have different data than\n the master. INSERT DELAYED statements are not safe for\nreplication.\nPending INSERT DELAYED statements are lost if a table is\n write locked and ALTER TABLE is used to modify the table\nstructure.\nINSERT DELAYED is not supported for views. If you try, you\nwill get an error like this: ERROR 1347 (HY000):\n\'view_name\' is not BASE TABLE\nINSERT DELAYED is not supported for partitioned tables.\nINSERT DELAYED is not supported within stored programs.\n \n\n\nURL: https://mariadb.com/kb/en/library/insert-delayed/','','https://mariadb.com/kb/en/library/insert-delayed/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (420,27,'INSERT IGNORE','Ignoring Errors\n \nNormally INSERT stops and rolls back when it encounters an\nerror.\n \nBy using the IGNORE keyword all errors are converted to\nwarnings, which will not stop inserts of additional rows.\n \nThe IGNORE and DELAYED options are ignored when you use ON\nDUPLICATE KEY UPDATE.\n \nIncompatibilities\n \nMariaDB until 5.5.28\nMySQL and MariaDB before 5.5.28 didn\'t give warnings for\nduplicate key errors when using IGNORE.\nYou can get the old behaviour if you set OLD_MODE to\nNO_DUP_KEY_WARNINGS_WITH_IGNORE\n \nExamples\n-------- \nCREATE TABLE t1 (x INT UNIQUE);\n \nINSERT INTO t1 VALUES(1),(2);\n \nINSERT INTO t1 VALUES(2),(3);\nERROR 1062 (23000): Duplicate entry \'2\' for key \'x\'\nSELECT * FROM t1;\n \n+------+\n| x |\n+------+\n| 1 |\n| 2 |\n+------+\n2 rows in set (0.00 sec)\n \nINSERT IGNORE INTO t1 VALUES(2),(3);\nQuery OK, 1 row affected, 1 warning (0.04 sec)\n \nSHOW WARNINGS;\n \n+---------+------+---------------------------------+\n| Level | Code | Message |\n+---------+------+---------------------------------+\n| Warning | 1062 | Duplicate entry \'2\' for key \'x\' |\n+---------+------+---------------------------------+\n \nSELECT * FROM t1;\n \n+------+\n| x |\n+------+\n| 1 |\n| 2 |\n| 3 |\n+------+\n \nSee INSERT ON DUPLICATE KEY UPDATE for further examples\nusing that syntax.\n \n\n\nURL: https://mariadb.com/kb/en/library/insert-ignore/','','https://mariadb.com/kb/en/library/insert-ignore/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (421,27,'INSERT ON DUPLICATE KEY UPDATE','Syntax\n------ \nINSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [PARTITION (partition_list)] [(col,...)]\n {VALUES | VALUE} ({expr | DEFAULT},...),(...),...\n [ ON DUPLICATE KEY UPDATE\n col=expr\n [, col=expr] ... ]\n \nOr:\n \nINSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [PARTITION (partition_list)]\n SET col={expr | DEFAULT}, ...\n [ ON DUPLICATE KEY UPDATE\n col=expr\n [, col=expr] ... ]\n \nOr:\n \nINSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [PARTITION (partition_list)] [(col,...)]\n SELECT ...\n [ ON DUPLICATE KEY UPDATE\n col=expr\n [, col=expr] ... ]\n \nDescription\n----------- \nINSERT ... ON DUPLICATE KEY UPDATE is a MariaDB/MySQL\nextension to the INSERT statement that, if it finds a\nduplicate unique or primary key, will instead perform an\nUPDATE.\n \nThe row/s affected value is reported as 1 if a row is\ninserted, and 2 if a row is updated, unless the API\'s\nCLIENT_FOUND_ROWS flag is set.\n \nIf more than one unique index is matched, only the first is\nupdated. It is not recommended to use this statement on\ntables with more than one unique index.\n \nIf the table has an AUTO_INCREMENT primary key and the\nstatement inserts or updates a row, the LAST_INSERT_ID()\nfunction returns its AUTO_INCREMENT value.\n \nThe VALUES() function can only be used in a ON DUPLICATE KEY\nUPDATE clause and has no meaning in any other context. It\nreturns the column values from the INSERT portion of the\nstatement. This function is particularly useful for\nmulti-rows inserts.\n \nThe IGNORE and DELAYED options are ignored when you use ON\nDUPLICATE KEY UPDATE.\n \nThe PARTITION clause was introduced in MariaDB 10.0. See\nPartition Pruning and Selection for details.\n \nThis statement activates INSERT and UPDATE triggers. See\nTrigger Overview for details.\n \nSee also a similar statement, REPLACE.\n \nExamples\n-------- \nCREATE TABLE ins_duplicate (id INT PRIMARY KEY, animal\nVARCHAR(30));\nINSERT INTO ins_duplicate VALUES (1,\'Aardvark\'),\n(2,\'Cheetah\'), (3,\'Zebra\');\n \nIf there is no existing key, the statement runs as a regular\nINSERT:\n \nINSERT INTO ins_duplicate VALUES (4,\'Gorilla\') ON\nDUPLICATE KEY UPDATE animal=\'Gorilla\';\nQuery OK, 1 row affected (0.07 sec)\n \nSELECT * FROM ins_duplicate;\n+----+----------+\n| id | animal |\n+----+----------+\n| 1 | Aardvark |\n| 2 | Cheetah |\n| 3 | Zebra |\n| 4 | Gorilla |\n+----+----------+\n \nA regular INSERT with a primary key value of 1 will fail,\ndue to the existing key:\n \nINSERT INTO ins_duplicate VALUES (1,\'Antelope\');\nERROR 1062 (23000): Duplicate entry \'1\' for key\n\'PRIMARY\'\n \nHowever, we can use an INSERT ON DUPLICATE KEY UPDATE\ninstead:\n \nINSERT INTO ins_duplicate VALUES (1,\'Antelope\') ON\nDUPLICATE KEY UPDATE animal=\'Antelope\';\nQuery OK, 2 rows affected (0.09 sec)\n \nNote that there are two rows reported as affected, but this\nrefers only to the UPDATE.\n \nSELECT * FROM ins_duplicate;\n+----+----------+\n| id | animal |\n+----+----------+\n| 1 | Antelope |\n| 2 | Cheetah |\n| 3 | Zebra |\n| 4 | Gorilla |\n+----+----------+\n \nAdding a second unique column:\n \nALTER TABLE ins_duplicate ADD id2 INT;\nUPDATE ins_duplicate SET id2=id+10;\nALTER TABLE ins_duplicate ADD UNIQUE KEY(id2);\n \nWhere two rows match the unique keys match, only the first\nis updated. This can be unsafe and is not recommended unless\nyou are certain what you are doing. Note that the warning\nshown below appears in MariaDB 5.5 and before, but has been\nremoved in MariaDB 10.0, as MariaDB now assumes that the\nkeys are checked in order, as shown in SHOW CREATE TABLE.\n \nINSERT INTO ins_duplicate VALUES (2,\'Lion\',13) ON\nDUPLICATE KEY UPDATE animal=\'Lion\';\nQuery OK, 2 rows affected, 1 warning (0.06 sec)\n \nSHOW WARNINGS;\n+-------+------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n| Level | Code | Message |\n+-------+------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n| Note | 1592 | Unsafe statement written to the binary log\nusing statement format since BINLOG_FORMAT = STATEMENT.\nINSERT... ON DUPLICATE KEY UPDATE on a table with more than\none UNIQUE KEY is unsafe |\n+-------+------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n \nSELECT * FROM ins_duplicate;\n+----+----------+------+\n| id | animal | id2 |\n+----+----------+------+\n| 1 | Antelope | 11 |\n| 2 | Lion | 12 |\n| 3 | Zebra | 13 |\n| 4 | Gorilla | 14 |\n+----+----------+------+\n \nAlthough the third row with an id of 3 has an id2 of 13,\nwhich also matched, it was not updated.\n \nChanging id to an auto_increment field. If a new row is\nadded, the auto_increment is moved forward. If the row is\nupdated, it remains the same.\n \nALTER TABLE `ins_duplicate` CHANGE `id` `id` INT( 11 ) NOT\nNULL AUTO_INCREMENT;\nALTER TABLE ins_duplicate DROP id2;\nSELECT Auto_increment FROM INFORMATION_SCHEMA.TABLES WHERE\nTABLE_NAME=\'ins_duplicate\';\n+----------------+\n| Auto_increment |\n+----------------+\n| 5 |\n+----------------+\n \nINSERT INTO ins_duplicate VALUES (2,\'Leopard\') ON\nDUPLICATE KEY UPDATE animal=\'Leopard\';\nQuery OK, 2 rows affected (0.00 sec)\n \nSELECT Auto_increment FROM INFORMATION_SCHEMA.TABLES WHERE\nTABLE_NAME=\'ins_duplicate\';\n+----------------+\n| Auto_increment |\n+----------------+\n| 5 |\n+----------------+\n \nINSERT INTO ins_duplicate VALUES (5,\'Wild Dog\') ON\nDUPLICATE KEY UPDATE animal=\'Wild Dog\';\nQuery OK, 1 row affected (0.09 sec)\n \nSELECT * FROM ins_duplicate;\n+----+----------+\n| id | animal |\n+----+----------+\n| 1 | Antelope |\n| 2 | Leopard |\n| 3 | Zebra |\n| 4 | Gorilla |\n| 5 | Wild Dog |\n+----+----------+\n \nSELECT Auto_increment FROM INFORMATION_SCHEMA.TABLES WHERE\nTABLE_NAME=\'ins_duplicate\';\n+----------------+\n| Auto_increment |\n+----------------+\n| 6 |\n+----------------+\n \nRefering to column values from the INSERT portion of the\nstatement: \n \nINSERT INTO table (a,b,c) VALUES (1,2,3),(4,5,6)\n ON DUPLICATE KEY UPDATE c=VALUES(a)+VALUES(b);\n \nSee the VALUES() function for more.\n \n\n\nURL:\nhttps://mariadb.com/kb/en/library/insert-on-duplicate-key-update/','','https://mariadb.com/kb/en/library/insert-on-duplicate-key-update/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (422,27,'INSERT SELECT','Syntax\n------ \nINSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [(col_name,...)]\n SELECT ...\n [ ON DUPLICATE KEY UPDATE col_name=expr, ... ]\n \nDescription\n----------- \nWith INSERT ... SELECT, you can quickly insert many rows\ninto a table from one or more other 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 \ntbl_name can also be specified in the form db_name.tbl_name\n(see Identifier Qualifiers). This allows to copy rows\nbetween different databases.\n \nIf the new table has a primary key or UNIQUE indexes, you\ncan use IGNORE to handle duplicate key errors during the\nquery. The newer values will not be inserted if an identical\nvalue already exists.\n \nREPLACE can be used instead of INSERT to prevent duplicates\non UNIQUE indexes by deleting old values. In that case, ON\nDUPLICATE KEY UPDATE cannot be used.\n \nINSERT ... SELECT works for tables which already exist. To\ncreate a table for a given resultset, you can use CREATE\nTABLE ... SELECT.\n \n\n\nURL: https://mariadb.com/kb/en/library/insert-select/','','https://mariadb.com/kb/en/library/insert-select/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (423,27,'INTERSECT','INTERSECT was introduced in MariaDB 10.3.0.\n \nThe result of an intersect is the intersection of right and\nleft SELECT results, i.e. only records that are present in\nboth result sets will be included in the result of the\noperation.\n \nSyntax\n------ \nSELECT ...\n(INTERSECT | EXCEPT | UNION [ALL | DISTINCT]) SELECT ...\n[(INTERSECT | EXCEPT | UNION [ALL | DISTINCT]) SELECT ...]\n[ORDER BY [column [, column ...]]]\n[LIMIT {[offset,] row_count | row_count OFFSET offset}]\n \nPlease note:\nALL is not supported by INTERSECT (and it is difficult to\nmake sense of ALL with INTERSECT).\nBrackets for explicit operation precedence are not\nsupported; use a subquery in the FROM clause as a\nworkaround).\n \nDescription\n----------- \nMariaDB has supported INTERSECT (as well as EXCEPT) in\naddition to UNION since MariaDB 10.3.\n \nAll behavior for naming columns, ORDER BY and LIMIT is the\nsame as for UNION.\n \nINTERSECT implicitly supposes a DISTINCT operation.\n \nThe result of an intersect is the intersection of right and\nleft SELECT results, i.e. only records that are present in\nboth result sets will be included in the result of the\noperation.\n \nINTERSECT has higher precedence than UNION and EXCEPT. If\npossible it will be executed linearly but if not it will be\ntranslated to a subquery in the FROM clause:\n \n(select a,b from t1)\nunion\n(select c,d from t2)\nintersect\n(select e,f from t3)\nunion\n(select 4,4);\n \nwill be translated to:\n \n(select a,b from t1)\nunion\nselect c,d from\n ((select c,d from t2)\n intersect\n (select e,f from t3)) dummy_subselect\nunion\n(select 4,4)\n \n\n \nParentheses\n \nFrom MariaDB 10.4.0, parentheses can be used to specify\nprecedence. Before this, a syntax error would be returned.\n \nExamples\n-------- \nShow customers which are employees:\n \n(SELECT e_name AS name, email FROM employees)\nINTERSECT\n(SELECT c_name AS name, email FROM customers);\n \nDifference between UNION, EXCEPT and INTERSECT:\n \nCREATE TABLE seqs (i INT);\nINSERT INTO seqs VALUES (1),(2),(3),(4),(5),(6);\n \nSELECT i FROM seqs WHERE i =3;\n \n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n| 3 |\n| 4 |\n| 5 |\n| 6 |\n+------+\n \nSELECT i FROM seqs WHERE i =3;\n \n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n+------+\n \nSELECT i FROM seqs WHERE i =3;\n \n+------+\n| i |\n+------+\n| 3 |\n+------+\n \nParentheses for specifying precedence, from MariaDB 10.4.0\n \nCREATE OR REPLACE TABLE t1 (a INT);\nCREATE OR REPLACE TABLE t2 (b INT);\nCREATE OR REPLACE TABLE t3 (c INT);\n \nINSERT INTO t1 VALUES (1),(2),(3),(4);\nINSERT INTO t2 VALUES (5),(6);\nINSERT INTO t3 VALUES (1),(6);\n \n((SELECT a FROM t1) UNION (SELECT b FROM t2)) INTERSECT\n(SELECT c FROM t3);\n+------+\n| a |\n+------+\n| 1 |\n| 6 |\n+------+\n \n(SELECT a FROM t1) UNION ((SELECT b FROM t2) INTERSECT\n(SELECT c FROM t3));\n+------+\n| a |\n+------+\n| 1 |\n| 2 |\n| 3 |\n| 4 |\n| 6 |\n+------+\n \n\n\nURL: https://mariadb.com/kb/en/library/intersect/','','https://mariadb.com/kb/en/library/intersect/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (424,27,'JOIN Syntax','Description\n----------- \nMariaDB supports the following JOIN syntaxes for\nthe table_references part of SELECT statements and\nmultiple-table DELETE and UPDATE statements:\n \ntable_references:\n table_reference [, table_reference] ...\n \ntable_reference:\n table_factor\n | join_table\n \ntable_factor:\n tbl_name [PARTITION (partition_list)]\n [query_system_time_period_specification] [[AS] alias]\n[index_hint_list]\n | table_subquery [query_system_time_period_specification]\n[AS] alias\n | ( table_references )\n | { ON table_reference LEFT OUTER JOIN table_reference\n ON conditional_expr }\n \njoin_table:\n table_reference [INNER | CROSS] JOIN table_factor\n[join_condition]\n | table_reference STRAIGHT_JOIN table_factor\n | table_reference STRAIGHT_JOIN table_factor ON\nconditional_expr\n | table_reference {LEFT|RIGHT} [OUTER] JOIN table_reference\njoin_condition\n | table_reference NATURAL [{LEFT|RIGHT} [OUTER]] JOIN\ntable_factor\n \njoin_condition:\n ON conditional_expr\n | USING (column_list)\n \nquery_system_time_period_specification:\n FOR SYSTEM_TIME AS OF point_in_time\n | FOR SYSTEM_TIME BETWEEN point_in_time AND point_in_time\n | FOR SYSTEM_TIME FROM point_in_time TO point_in_time\n | FOR SYSTEM_TIME ALL\n \npoint_in_time:\n [TIMESTAMP] expression\n | TRANSACTION expression\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 \nEach table can also be specified as db_name.tabl_name. This\nallows to write queries which involve multiple databases.\nSee Identifier Qualifiers for syntax details.\n \nThe syntax of table_factor is extended in comparison with\nthe\nSQL Standard. The latter accepts only table_reference, not a\nlist of them inside a pair of parentheses.\n \nThis is a conservative extension if we consider each comma\nin a list of\ntable_reference items as equivalent to an inner join. For\nexample:\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 MariaDB, CROSS JOIN is a syntactic equivalent to\nINNER JOIN (they can replace each other). In standard SQL,\nthey are not equivalent. INNER JOIN is used with an\nON clause, CROSS JOIN is used otherwise.\n \nIn general, parentheses can be ignored in join expressions\ncontaining only\ninner join operations. MariaDB also supports nested joins\n(see\nhttp://dev.mysql.com/doc/refman/5.1/en/nested-join-optimization.html).\n \nSee System-versioned tables for more information\nabout FOR SYSTEM_TIME syntax.\n \nIndex hints can be specified to affect how the MariaDB\noptimizer makes\nuse of indexes. For more information, see How to force query\nplans.\n \nExamples\n-------- \nSELECT left_tbl.*\n FROM left_tbl LEFT JOIN right_tbl ON left_tbl.id =\nright_tbl.id\n WHERE right_tbl.id IS NULL;\n \n\n \n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/join-syntax/','','https://mariadb.com/kb/en/library/join-syntax/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (425,27,'LIMIT','Description\n----------- \nUse the LIMIT clause to restrict the number of returned\nrows. When you use a single\ninteger n with LIMIT, the first n rows will be returned. Use\nthe ORDER BY\nclause to control which rows come first. You can also select\na number of rows after an offset\nusing either of the following:\n \nLIMIT offset, row_count\nLIMIT row_count OFFSET offset\n \nWhen you provide an offset m with a limit n, the first m\nrows will be ignored, and the\nfollowing n rows will be returned.\n \nExecuting an UPDATE with the LIMIT clause is not safe for\nreplication.\n \nSince MariaDB 10.0.11, LIMIT 0 has been an exception to this\nrule (see MDEV-6170).\n \nBeginning in MariaDB 5.5.21, there is a LIMIT ROWS EXAMINED\noptimization which provides the\nmeans to terminate the execution of SELECT statements which\nexamine too\nmany rows, and thus use too many resources. See LIMIT ROWS\nEXAMINED.\n \nMulti-Table Updates\n \nUntil MariaDB 10.3.1, it was not possible to use LIMIT (or\nORDER BY) in a multi-table UPDATE statement. This\nrestriction was lifted in MariaDB 10.3.2.\n \nGROUP_CONCAT\n \nStarting from MariaDB 10.3.3, it is possible to use LIMIT\nwith GROUP_CONCAT().\n \nExamples\n-------- \nCREATE TABLE members (name VARCHAR(20));\nINSERT INTO members\nVALUES(\'Jagdish\'),(\'Kenny\'),(\'Rokurou\'),(\'Immaculada\');\n \nSELECT * FROM members;\n \n+------------+\n| name |\n+------------+\n| Jagdish |\n| Kenny |\n| Rokurou |\n| Immaculada |\n+------------+\n \nSelect the first two names (no ordering specified):\n \nSELECT * FROM members LIMIT 2;\n \n+---------+\n| name |\n+---------+\n| Jagdish |\n| Kenny |\n+---------+\n \nAll the names in alphabetical order:\n \nSELECT * FROM members ORDER BY name;\n \n+------------+\n| name |\n+------------+\n| Immaculada |\n| Jagdish |\n| Kenny |\n| Rokurou |\n+------------+\n \nThe first two names, ordered alphabetically:\n \nSELECT * FROM members ORDER BY name LIMIT 2;\n \n+------------+\n| name |\n+------------+\n| Immaculada |\n| Jagdish |\n+------------+\n \nThe third name, ordered alphabetically (the first name would\nbe offset zero, so the third is offset two):\n \nSELECT * FROM members ORDER BY name LIMIT 2,1;\n \n+-------+\n| name |\n+-------+\n| Kenny |\n+-------+\n \nFrom MariaDB 10.3.2, LIMIT can be used in a multi-table\nupdate:\n \nCREATE TABLE warehouse (product_id INT, qty INT);\nINSERT INTO warehouse VALUES\n(1,100),(2,100),(3,100),(4,100);\n \nCREATE TABLE store (product_id INT, qty INT);\nINSERT INTO store VALUES (1,5),(2,5),(3,5),(4,5);\n \nUPDATE warehouse,store SET warehouse.qty = warehouse.qty-2,\nstore.qty = store.qty+2 \n WHERE (warehouse.product_id = store.product_id AND\nstore.product_id >= 1) \n ORDER BY store.product_id DESC LIMIT 2;\n \nSELECT * FROM warehouse;\n \n+------------+------+\n| product_id | qty |\n+------------+------+\n| 1 | 100 |\n| 2 | 100 |\n| 3 | 98 |\n| 4 | 98 |\n+------------+------+\n \nSELECT * FROM store;\n \n+------------+------+\n| product_id | qty |\n+------------+------+\n| 1 | 5 |\n| 2 | 5 |\n| 3 | 7 |\n| 4 | 7 |\n+------------+------+\n \nFrom MariaDB 10.3.3, LIMIT can be used with GROUP_CONCAT,\nso, for example, given the following table:\n \nCREATE TABLE d (dd DATE, cc INT);\n \nINSERT INTO d VALUES (\'2017-01-01\',1);\nINSERT INTO d VALUES (\'2017-01-02\',2);\nINSERT INTO d VALUES (\'2017-01-04\',3);\n \nthe following query:\n \nSELECT SUBSTRING_INDEX(GROUP_CONCAT(CONCAT_WS(\":\",dd,cc)\nORDER BY cc DESC),\",\",1) FROM d;\n \n+----------------------------------------------------------------------------+\n| SUBSTRING_INDEX(GROUP_CONCAT(CONCAT_WS(\":\",dd,cc) ORDER\nBY cc DESC),\",\",1) |\n+----------------------------------------------------------------------------+\n| 2017-01-04:3 |\n+----------------------------------------------------------------------------+\n \ncan be more simply rewritten as:\n \nSELECT GROUP_CONCAT(CONCAT_WS(\":\",dd,cc) ORDER BY cc DESC\nLIMIT 1) FROM d;\n \n+-------------------------------------------------------------+\n| GROUP_CONCAT(CONCAT_WS(\":\",dd,cc) ORDER BY cc DESC LIMIT\n1) |\n+-------------------------------------------------------------+\n| 2017-01-04:3 |\n+-------------------------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/limit/','','https://mariadb.com/kb/en/library/limit/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (426,27,'LOAD DATA INFILE','Syntax\n------ \nLOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE\n\'file_name\'\n [REPLACE | IGNORE]\n INTO TABLE tbl_name\n [CHARACTER SET charset_name]\n [{FIELDS | COLUMNS}\n [TERMINATED BY \'string\']\n [[OPTIONALLY] ENCLOSED BY \'char\']\n [ESCAPED BY \'char\']\n ]\n [LINES\n [STARTING BY \'string\']\n [TERMINATED BY \'string\']\n ]\n [IGNORE number LINES]\n [(col_name_or_user_var,...)]\n [SET col_name = expr,...]\n \nDescription\n----------- \nReads rows from a text file into the designated table on the\ndatabase at a very high speed. The file name must be given\nas a literal string. \n \nFiles are written to disk using the SELECT INTO OUTFILE\nstatement. You can then read the files back into a table\nusing the LOAD DATA INFILE statement. The FIELDS and LINES\nclauses are the same in both statements. These clauses are\noptional, but if both are specified then the FIELDS clause\nmust precede LINES.\n \nIn releases after MariaDB 5.5, LOAD DATA INFILE is unsafe\nfor statement-based replication.\n \nExecuting this statement activates INSERT triggers.\n \nREPLACE and IGNORE\n \nIn cases where you load data from a file into a table that\nalready contains data and has a Primary Key, you may\nencounter issues where the statement attempts to insert a\nrow with a Primary Key that already exists. When this\nhappens, the statement fails with Error 1064, protecting the\ndata already on the table. In cases where you want MariaDB\nto overwrite duplicates, use the REPLACE keyword.\n \nThe REPLACE keyword works like the REPLACE statement. Here,\nthe statement attempts to load the data from the file. If\nthe row does not exist, it adds it to the table. If the row\ncontains an existing Primary Key, it replaces the table\ndata. That is, in the event of a conflict, it assumes the\nfile contains the desired row. \n \nThis operation can cause a degradation in load speed by a\nfactor of 20 or more if the part that has already been\nloaded is larger than the capacity of the InnoDB Buffer\nPool. This happens because it causes a lot of turnaround in\nthe Buffer Pool.\n \nUse the IGNORE keyword when you want to skip any rows that\ncontain a conflicting Primary Key. Here, the statement\nattempts to load the data from the file. If the row does not\nexist, it adds it to the table. If the row contains an\nexisting Primary Key, it ignores the addition request and\nmoves on to the next. That is, in the event of a conflict,\nit assumes the table contains the desired row.\n \nLOCAL\n \nWhen you issue this statement, the Server attempts to read\nfiles from the host file system. Using the LOCAL keyword,\nthe statement instead attempts to read files from the\nclient. This allows you to insert files from the client\'s\nlocal file system into the database.\n \nIn the event that you don\'t want the server to permit this\noperation, (such as for security reasons), you can disable\nsupport using local_infile. When this system variable is set\nto 0, MariaDB rejects LOAD DATA LOCAL INFILE statements,\nfailing with an error message.\n \nCharacter-sets\n \nWhen the statement opens the file, it attempts to read the\ncontents using the default character-set, as defined by the\ncharacter_set_database system variable. \n \nIn the cases where the file was written using a\ncharacter-set other than the default, you can specify the\ncharacter-set to use with the CHARACTER SET clause in the\nstatement. It ignores character-sets specified by the SET\nNAMES statement and by the character_set_client system\nvariable. Setting the CHARACTER SET clause to a value of\nbinary indicates \"no conversion.\"\n \nThe statement interprets all fields in the file as having\nthe same character-set, regardless of the column data type.\nTo properly interpret file contents, you must ensure that it\nwas written with the correct character-set. If you write a\ndata file with mysqldump -T or with the SELECT INTO OUTFILE\nstatement with the mysql client, be sure to use the\n--default-character-set option, so that the output is\nwritten with the desired character-set.\n \nWhen using mixed character sets, use the CHARACTER SET\nclause in both SELECT INTO OUTFILE and LOAD DATA INFILE to\nensure that MariaDB correctly interprets the escape\nsequences.\n \nThe character_set_filesystem system variable controls the\ninterpretation of the filename.\n \nIt is currently not possible to load data files that use the\nucs2 character set.\n \nPriority and Concurrency\n \nIn loading data from a file, there\'s a risk that the\nstatement will attempt insertions concurrent with reads from\nanother client, which can result in the read serving a\nresult-set that contains only part of the update from the\nLOAD DATA INFILE statement.\n \nUsing the LOW_PRIORITY keyword, MariaDB delays insertions\nuntil no other clients are reading from the table.\nAlternatively, you can use the CONCURRENT keyword to perform\nconcurrent insertion.\n \nThe LOW_PRIORITY and CONCURRENT keywords are mutually\nexclusive. They cannot be used in the same statement.\n \nProgress Reporting\n \nSince MariaDB 5.3, the LOAD DATA INFILE statement supports\nprogress reporting. You may find this useful when dealing\nwith long-running operations. Using another client you can\nissue a SHOW PROCESSLIST query to check the progress of the\ndata load.\n \nUsing mysqlimport\n \nMariaDB ships with a separate utility for loading data from\nfiles: mysqlimport. It operates by sending LOAD DATA INFILE\nstatements to the server.\n \nUsing mysqlimport you can compress the file using the\n--compress option, to get better performance over slow\nnetworks, providing both the client and server support the\ncompressed protocol. Use the --local option to load from the\nlocal file system.\n \nIndexing\n \nIn cases where the storage engine supports ALTER TABLE...\nDISABLE KEYS statements, the LOAD DATA INFILE statement\nautomatically disables indexes during the execution.\n \n\n\nURL: https://mariadb.com/kb/en/library/load-data-infile/','','https://mariadb.com/kb/en/library/load-data-infile/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (427,27,'LOAD XML','Syntax\n------ \nLOAD XML [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE\n\'file_name\'\n [REPLACE | IGNORE]\n INTO TABLE [db_name.]tbl_name\n [CHARACTER SET charset_name]\n [ROWS IDENTIFIED BY \'\']\n [IGNORE number {LINES | ROWS}]\n [(column_or_user_var,...)]\n [SET col_name = expr,...]\n \nDescription\n----------- \nThe LOAD XML statement reads data from an XML file into a\ntable. The\nfile_name must be given as a literal string. The tagname in\nthe\noptional ROWS IDENTIFIED BY clause must also be given as a\nliteral\nstring, and must be surrounded by angle brackets (< and >).\n \nLOAD XML acts as the complement of running the mysql client\nin XML\noutput mode (that is, starting the client with the --xml\noption). To\nwrite data from a table to an XML file, use a command such\nas 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\ndefault,\nthe element is considered to be the equivalent of a\ndatabase\ntable row; this can be changed using the ROWS IDENTIFIED BY\nclause.\n \nThis statement supports three different XML formats:\nColumn names as attributes and column values as attribute\nvalues:\n \nColumn names as tags and column values as the content of\nthese tags:\n \n value1\n value2\n \nColumn names are the name attributes of tags, and values\nare\n the contents of these tags:\n \n value1\n value2\n \n This is the format used by other tools, such as mysqldump.\n \nAll 3 formats can be used in the same XML file; the import\nroutine\nautomatically detects the format for each row and interprets\nit\ncorrectly. Tags are matched based on the tag or attribute\nname and the\ncolumn name.\n \nThe following clauses work essentially the same way for LOAD\nXML as\nthey do for LOAD DATA:\nLOW_PRIORITY or CONCURRENT\nLOCAL\nREPLACE or IGNORE\nCHARACTER SET\n(column_or_user_var,...)\nSET\n \nSee LOAD DATA for more information about these clauses.\n \nThe IGNORE number LINES or IGNORE number ROWS clause causes\nthe first\nnumber rows in the XML file to be skipped. It is analogous\nto the LOAD\nDATA statement\'s IGNORE ... LINES clause.\n \nIf the LOW_PRIORITY keyword is used, insertions are delayed\nuntil no other clients are reading from the table. The\nCONCURRENT keyword allowes the use of concurrent inserts.\nThese clauses cannot be specified together.\n \nThis statement activates INSERT triggers.\n \n\n\nURL: https://mariadb.com/kb/en/library/load-xml/','','https://mariadb.com/kb/en/library/load-xml/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (428,27,'LOCK IN SHARE MODE','When LOCK IN SHARE MODE is specified in a SELECT statement,\nMariaDB will wait until all transactions that have modified\nthe rows are committed. Then, a write lock is acquired. All\ntransactions can read the rows, but if they want to modify\nthem, they have to wait until your transaction is committed.\n \nInnoDB/XtraDB supports row-level locking. selected rows can\nbe locked using LOCK IN SHARE MODE or FOR UPDATE. In both\ncases, a lock is acquired on the rows read by the query, and\nit will be released when the current transaction is\ncommitted.\n \nIf autocommit is set to 1, the LOCK IN SHARE MODE and FOR\nUPDATE clauses have no effect.\n \n\n\nURL: https://mariadb.com/kb/en/library/lock-in-share-mode/','','https://mariadb.com/kb/en/library/lock-in-share-mode/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (429,27,'Non-Recursive Common Table Expressions Overview','Common Table Expressions (CTEs) are a standard SQL feature,\nand are essentially temporary named result sets. There are\ntwo kinds of CTEs: Non-Recursive, which this article covers;\nand Recursive.\n \nCommon table expressions were introduced in MariaDB 10.2.1.\n \nNon-Recursive CTEs\n \nThe WITH keyword signifies a CTE. It is given a name,\nfollowed by a body (the main query) as follows:\n \nCTEs are similar to derived tables. For example\n \nWITH engineers AS \n ( SELECT * FROM employees\n WHERE dept = \'Engineering\' )\n \nSELECT * FROM engineers\nWHERE ...\n \nSELECT * FROM\n ( SELECT * FROM employees\n WHERE dept = \'Engineering\' ) AS engineers\nWHERE\n...\n \nA non-recursive CTE is basically a query-local VIEW. There\nare several advantages and caveats to them. The syntax is\nmore readable than nested FROM (SELECT ...).\nA CTE can refer to another and it can be referenced from\nmultiple places.\n \nA CTE referencing Another CTE\n \nUsing this format makes for a more readable SQL than a\nnested FROM(SELECT ...) clause. Below is an example of this:\n \nWITH engineers AS (\nSELECT * FROM employees\nWHERE dept IN(\'Development\',\'Support\') ),\neu_engineers AS ( SELECT * FROM engineers WHERE country\nIN(\'NL\',...) )\nSELECT\n...\nFROM eu_engineers;\n \nMultiple Uses of a CTE\n \nThis can be an \'anti-self join\', for example:\n \nWITH engineers AS (\nSELECT * FROM employees\nWHERE dept IN(\'Development\',\'Support\') )\n \nSELECT * FROM engineers E1\nWHERE NOT EXISTS\n (SELECT 1 FROM engineers E2\n WHERE E2.country=E1.country\n AND E2.name E1.name );\n \nOr, for year-over-year comparisons, for example:\n \nWITH sales_product_year AS (\nSELECT product, YEAR(ship_date) AS year,\nSUM(price) AS total_amt\nFROM item_sales\nGROUP BY product, year )\n \nSELECT *\nFROM sales_product_year CUR,\nsales_product_year PREV,\nWHERE CUR.product=PREV.product \nAND CUR.year=PREV.year + 1 \nAND CUR.total_amt > PREV.total_amt\n \nAnother use is to compare individuals against their group.\nBelow is an example of how this might be executed:\n \nWITH sales_product_year AS (\nSELECT product,\nYEAR(ship_date) AS year,\nSUM(price) AS total_amt\nFROM item_sales\nGROUP BY product, year\n)\n \nSELECT * \nFROM sales_product_year S1\nWHERE\ntotal_amt > \n (SELECT 0.1 * SUM(total_amt)\n FROM sales_product_year S2\n WHERE S2.year = S1.year)\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/non-recursive-common-table-expressions-overview/','','https://mariadb.com/kb/en/library/non-recursive-common-table-expressions-overview/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (430,27,'ORDER BY','Description\n----------- \nUse the ORDER BY clause to order a resultset, such as that\nare returned from a SELECT\nstatement. You can specify just a column or use any\nexpression with functions. If you are\nusing the GROUP BY clause, you can use grouping functions in\nORDER BY.\nOrdering is done after grouping.\n \nYou can use multiple ordering expressions, separated by\ncommas. Rows will be sorted by\nthe first expression, then by the second expression if they\nhave the same value for the\nfirst, and so on.\n \nYou can use the keywords ASC and DESC after each ordering\nexpression to\nforce that ordering to be ascending or descending,\nrespectively. Ordering is ascending\nby default.\n \nYou can also use a single integer as the ordering\nexpression. If you use an integer n,\nthe results will be ordered by the nth column in the select\nexpression.\n \nWhen string values are compared, they are compared as if by\nthe STRCMP\nfunction. STRCMP ignores trailing whitespace and may\nnormalize\ncharacters and ignore case, depending on the collation in\nuse.\n \nStarting from MariaDB 5.5.35 duplicated entries in the ORDER\nBY clause are removed. MySQL 5.6 also removes duplicated\nfields.\n \nORDER BY can also be used to order the activities of a\nDELETE or UPDATE statement (usually with the LIMIT clause). \n \nUntil MariaDB 10.3.1, it was not possible to use ORDER BY\n(or LIMIT) in a multi-table UPDATE statement. This\nrestriction was lifted in MariaDB 10.3.2.\n \nExamples\n-------- \nCREATE TABLE seq (i INT, x VARCHAR(1));\nINSERT INTO seq VALUES (1,\'a\'), (2,\'b\'), (3,\'b\'),\n(4,\'f\'), (5,\'e\');\n \nSELECT * FROM seq ORDER BY i;\n \n+------+------+\n| i | x |\n+------+------+\n| 1 | a |\n| 2 | b |\n| 3 | b |\n| 4 | f |\n| 5 | e |\n+------+------+\n \nSELECT * FROM seq ORDER BY i DESC;\n \n+------+------+\n| i | x |\n+------+------+\n| 5 | e |\n| 4 | f |\n| 3 | b |\n| 2 | b |\n| 1 | a |\n+------+------+\n \nSELECT * FROM seq ORDER BY x,i;\n \n+------+------+\n| i | x |\n+------+------+\n| 1 | a |\n| 2 | b |\n| 3 | b |\n| 5 | e |\n| 4 | f |\n+------+------+\n \nORDER BY in an UPDATE statement, in conjunction with LIMIT:\n \nUPDATE seq SET x=\'z\' WHERE x=\'b\' ORDER BY i DESC LIMIT\n1;\n \nSELECT * FROM seq;\n \n+------+------+\n| i | x |\n+------+------+\n| 1 | a |\n| 2 | b |\n| 3 | z |\n| 4 | f |\n| 5 | e |\n+------+------+\n \nFrom MariaDB 10.3.2, ORDER BY can be used in a multi-table\nupdate:\n \nCREATE TABLE warehouse (product_id INT, qty INT);\nINSERT INTO warehouse VALUES\n(1,100),(2,100),(3,100),(4,100);\n \nCREATE TABLE store (product_id INT, qty INT);\nINSERT INTO store VALUES (1,5),(2,5),(3,5),(4,5);\n \nUPDATE warehouse,store SET warehouse.qty = warehouse.qty-2,\nstore.qty = store.qty+2 \n WHERE (warehouse.product_id = store.product_id AND\nstore.product_id >= 1) \n ORDER BY store.product_id DESC LIMIT 2;\n \nSELECT * FROM warehouse;\n \n+------------+------+\n| product_id | qty |\n+------------+------+\n| 1 | 100 |\n| 2 | 100 |\n| 3 | 98 |\n| 4 | 98 |\n+------------+------+\n \nSELECT * FROM store;\n \n+------------+------+\n| product_id | qty |\n+------------+------+\n| 1 | 5 |\n| 2 | 5 |\n| 3 | 7 |\n| 4 | 7 |\n+------------+------+\n \n\n\nURL: https://mariadb.com/kb/en/library/order-by/','','https://mariadb.com/kb/en/library/order-by/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (431,27,'PROCEDURE','The PROCEDURE clause of SELECT passes the whole result set\nto a Procedure which will process it. These Procedures are\nnot Stored Procedures, and can only be written in the C\nlanguage, so it is necessary to recompile the server.\n \nCurrently, the only available procedure is ANALYSE, which\nexamines the resultset and suggests the optimal datatypes\nfor each column. It is defined in the sql/sql_analyse.cc\nfile, and can be used as an example to create more\nProcedures.\n \nThis clause cannot be used in a view\'s definition.\n \n\n\nURL: https://mariadb.com/kb/en/library/procedure/','','https://mariadb.com/kb/en/library/procedure/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (432,27,'Recursive Common Table Expressions Overview','Recursive Common Table Expressions have been supported since\nMariaDB 10.2.2.\n \nCommon Table Expressions (CTEs) are a standard SQL feature,\nand are essentially temporary named result sets. CTEs first\nappeared in the SQL standard in 1999, and the first\nimplementations began appearing in 2007.\n \nThere are two kinds of CTEs:\nNon-recursive\nRecursive, which this article covers.\n \nSQL is generally poor at recursive structures.\n \nCTEs permit a query to reference itself. A recursive CTE\nwill repeatedly execute subsets of the data until it obtains\nthe complete result set. This makes it particularly useful\nfor handing hierarchical or tree-structured data.\n \nSyntax example\n \nWITH RECURSIVE signifies a recursive CTE. It is given a\nname, followed by a body (the main query) as follows:\n \n\nComputation\n \nGiven the following structure:\n \nFirst execute the anchor part of the query:\n \nNext, execute the recursive part of the query:\n \n\n \n\nSummary so far\n \nwith recursive R as (\n select anchor_data\n union [all]\n select recursive_part\n from R, ...\n)\nselect ...\nCompute anchor_data\nCompute recursive_part to get the new data\nif (new data is non-empty) goto 2;\n \nCAST to avoid truncating data\n \nAs currently implemented by MariaDB and by the SQL Standard,\ndata may be truncated if not correctly cast. It is necessary\nto CAST the column to the correct width if the CTE\'s\nrecursive part produces wider values for a column than the\nCTE\'s nonrecursive part. Some other DBMS give an error in\nthis situation, and MariaDB\'s behavior may change in future\n- see MDEV-12325. See the examples below.\n \nExamples\n-------- \nTransitive closure - determining bus destinations\n \nSample data:\n \nCREATE TABLE bus_routes (origin varchar(50), dst\nvarchar(50));\nINSERT INTO bus_routes VALUES \n (\'New York\', \'Boston\'), \n (\'Boston\', \'New York\'), \n (\'New York\', \'Washington\'), \n (\'Washington\', \'Boston\'), \n (\'Washington\', \'Raleigh\');\n \nNow, we want to return the bus destinations with New York as\nthe origin:\n \nWITH RECURSIVE bus_dst as ( \n SELECT origin as dst FROM bus_routes WHERE origin=\'New\nYork\' \n UNION\n SELECT bus_routes.dst FROM bus_routes, bus_dst WHERE\nbus_dst.dst= bus_routes.origin \n) \nSELECT * FROM bus_dst;\n \n+------------+\n| dst |\n+------------+\n| New York |\n| Boston |\n| Washington |\n| Raleigh |\n+------------+\n \nThe above example is computed as follows:\n \nFirst, the anchor data is calculated:\nStarting from New York\nBoston and Washington are added\n \nNext, the recursive part:\nStarting from Boston and then Washington\nRaleigh is added\nUNION excludes nodes that are already present.\n \nComputing paths - determining bus routes\n \nThis time, we are trying to get bus routes such as “New\nYork -> Washington -> Raleighâ€.\n \nUsing the same sample data as the previous example:\n \nWITH RECURSIVE paths (cur_path, cur_dest) AS (\n SELECT origin, origin FROM bus_routes WHERE origin=\'New\nYork\' \n UNION\n SELECT CONCAT(paths.cur_path, \',\', bus_routes.dst),\nbus_routes.dst \n FROM paths, bus_routes \n WHERE paths.cur_dest = bus_routes.origin AND \n LOCATE(bus_routes.dst, paths.cur_path)=0 \n) \nSELECT * FROM paths;\n \n+-----------------------------+------------+\n| cur_path | cur_dest |\n+-----------------------------+------------+\n| New York | New York |\n| New York,Boston | Boston |\n| New York,Washington | Washington |\n| New York,Washington,Boston | Boston |\n| New York,Washington,Raleigh | Raleigh |\n+-----------------------------+------------+\n \nCAST to avoid data truncation\n \nIn the following example, data is truncated because the\nresults are not specifically cast to a wide enough type:\n \nWITH RECURSIVE tbl AS (\n SELECT NULL AS col\n UNION\n SELECT \"THIS NEVER SHOWS UP\" AS col FROM tbl\n)\n+------+\n| col |\n+------+\n| NULL |\n| |\n+------+\n \nExplicitly use CAST to overcome this:\n \nWITH RECURSIVE tbl AS (\n SELECT CAST(NULL AS CHAR(50)) AS col\n UNION SELECT \"THIS NEVER SHOWS UP\" AS col FROM tbl\n) \nSELECT * FROM tbl;\n \n+---------------------+\n| col |\n+---------------------+\n| NULL |\n| THIS NEVER SHOWS UP |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/recursive-common-table-expressions-overview/','','https://mariadb.com/kb/en/library/recursive-common-table-expressions-overview/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (433,27,'REPLACE','Syntax\n------ \nREPLACE [LOW_PRIORITY | DELAYED]\n [INTO] tbl_name [PARTITION (partition_list)] [(col,...)]\n {VALUES | VALUE} ({expr | DEFAULT},...),(...),...\n \nOr:\n \nREPLACE [LOW_PRIORITY | DELAYED]\n [INTO] tbl_name [PARTITION (partition_list)]\n SET col={expr | DEFAULT}, ...\n \nOr:\n \nREPLACE [LOW_PRIORITY | DELAYED]\n [INTO] tbl_name [PARTITION (partition_list)] [(col,...)]\n SELECT ...\n \nDescription\n----------- \n REPLACE works exactly like\n INSERT, except that if an old row in the table\n has the same value as a new row for a PRIMARY KEY or a\n UNIQUE index, the old row is deleted before the new row is\n inserted. If the table has more than one UNIQUE keys, it is\npossible that the new row conflicts with more than one row.\nIn this case, all conflicting rows will be deleted.\n \nThe table name can be specified in the form db_name.tbl_name\nor, if a default database is selected, in the form tbl_name\n(see Identifier Qualifiers). This allows to use REPLACE ...\nSELECT to copy rows between different databases.\n \nBasically it works like this:\n \nBEGIN;\nSELECT 1 FROM t1 WHERE key=# FOR UPDATE;\nIF found-row\n DELETE FROM t1 WHERE key=# ;\n INSERT INTO t1 VALUES (...);\nENDIF\nEND;\n \nThe above can be replaced with:\n \nREPLACE INTO t1 VALUES (...)\n \n REPLACE is a MariaDB/MySQL extension to the SQL standard.\nIt\n either inserts, or deletes and inserts. For other\nMariaDB/MySQL extensions to\n standard SQL --- that also handle duplicate values --- see\nIGNORE and INSERT ON DUPLICATE KEY UPDATE.\n \nNote that unless the table has a PRIMARY KEY or\n UNIQUE index, using a REPLACE statement\nmakes no sense. It becomes equivalent to INSERT, because\nthere 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\nin the\n REPLACE statement. Any missing columns are set to their\ndefault values, just as happens for INSERT. You cannot refer\nto values from the current row and use them in the new row.\nIf you use an\nassignment such as \'SET col = col + 1\', the\nreference to the column name on the right hand side is\ntreated as\n DEFAULT(col), so the assignment is equivalent to\n \'SET col = DEFAULT(col) + 1\'.\n \nTo use REPLACE, you must have both the\n INSERT and DELETE privileges\nfor the table.\n \nThere are some gotchas you should be aware of, before using\nREPLACE:\nIf there is an AUTO_INCREMENT field, a new value will be\ngenerated.\nIf there are foreign keys, ON DELETE action will be\nactivated by REPLACE.\nTriggers on DELETE and INSERT will be activated by REPLACE.\n \nTo avoid some of these behaviors, you can use INSERT ... ON\nDUPLICATE KEY UPDATE.\n \nThe PARTITION clause was introduced in MariaDB 10.0. See\nPartition Pruning and Selection for details.\n \nThis statement activates INSERT and DELETE triggers. See\nTrigger Overview for details.\n \n\n\nURL: https://mariadb.com/kb/en/library/replace/','','https://mariadb.com/kb/en/library/replace/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (434,27,'SELECT','Syntax\n------ \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} [ASC | DESC], ...\n[WITH ROLLUP]]\n [HAVING where_condition]\n [ORDER BY {col_name | expr | position} [ASC | DESC], ...]\n [LIMIT {[offset,] row_count | row_count OFFSET offset}]\n [PROCEDURE procedure_name(argument_list)]\n [INTO OUTFILE \'file_name\' [CHARACTER SET charset_name]\n[export_options]\n \nINTO DUMPFILE \'file_name\' | INTO var_name [, var_name] ] |\n\n \n [[FOR UPDATE | LOCK IN SHARE MODE] [WAIT n | NOWAIT] ] ]\n \nexport_options:\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 \nDescription\n----------- \nSELECT is used to retrieve rows selected from one or more\ntables, and can include UNION statements and subqueries.\nEach select_expr expression indicates a column or data that\nyou want to retrieve. You\nmust have at least one select expression. See Select\nExpressions below.\n \nThe FROM clause indicates the table or tables from which to\nretrieve rows.\nUse either a single table name or a JOIN expression. See\nJOIN\nfor details. If no table is involved, FROM DUAL can be\nspecified.\n \nThe PARTITION clause was introduced in MariaDB 10.0. See\nPartition Pruning and Selection for details.\nEach table can also be specified as db_name.tabl_name. Each\ncolumn can also be specified as tbl_name.col_name or even\ndb_name.tbl_name.col_name. This allows to write queries\nwhich involve multiple databases. See Identifier Qualifiers\nfor syntax details.\n \nThe WHERE clause, if given, indicates the condition or\n conditions that rows must satisfy to be selected.\n where_condition is an expression that evaluates to true for\n each row to be selected. The statement selects all rows if\nthere is no WHERE\n clause.\nIn the WHERE clause, you can use any of the functions and\n operators that MariaDB supports, except for aggregate\n(summary) functions. See Functions and Operators and\nFunctions and Modifiers for use with GROUP BY (aggregate).\n \nUse the ORDER BY clause to order the results.\n \nUse the LIMIT clause allows you to restrict the results to\nonly\na certain number of rows, optionally with an offset.\n \nUse the GROUP BY and HAVING clauses to group\nrows together when they have columns or computed values in\ncommon.\n \nSELECT can also be used to retrieve rows computed without\nreference to\nany table.\n \nSelect Expressions\n \nA SELECT statement must contain one or more select\nexpressions, separated\nby commas. Each select expression can be one of the\nfollowing:\nThe name of a column.\nAny expression using functions and operators.\n* to select all columns from all tables in the FROM clause.\ntbl_name.* to select all columns from just the table\ntbl_name.\n \nWhen specifying a column, you can either use just the column\nname or qualify the column\nname with the name of the table using tbl_name.col_name. The\nqualified form is\nuseful if you are joining multiple tables in the FROM\nclause. If you do not qualify the\ncolumn names when selecting from multiple tables, MariaDB\nwill try to find the column in\neach table. It is an error if that column name exists in\nmultiple tables.\n \nYou can quote column names using backticks. If you are\nqualifying column names\nwith table names, quote each part separately as\n`tbl_name`.`col_name`.\n \nIf you use any grouping functions\nin any of the select expressions, all rows in your results\nwill be implicitly grouped, as if\nyou had used GROUP BY NULL.\n \nDISTINCT\n \nA query may produce some identical rows. By default, all\nrows are retrieved, even when their values are the same. To\nexplicitly specify that you want to retrieve identical rows,\nuse the ALL option. If you want duplicates to be removed\nfrom the resultset, use the DISTINCT option. DISTINCTROW is\na synonym for DISTINCT. See also COUNT DISTINCT and SELECT\nUNIQUE in Oracle mode.\n \nINTO\n \nThe INTO clause is used to specify that the query results\nshould be written to a file or variable.\nSELECT INTO OUTFILE - formatting and writing the result to\nan external file.\nSELECT INTO DUMPFILE - binary-safe writing of the\nunformatted results to an external file.\nSELECT INTO Variable - selecting and setting variables.\n \nThe reverse of SELECT INTO OUTFILE is LOAD DATA.\n \nWAIT/NOWAIT\n \nSet the lock wait timeout. See WAIT and NOWAIT.\n \n\nmax_statement_time clause\n \nBy using max_statement_time in conjunction with SET\nSTATEMENT, it is possible to limit the execution time of\nindividual queries. For example:\n \nSET STATEMENT max_statement_time=100 FOR \n SELECT field1 FROM table_name ORDER BY field1;\n \n\n\nURL: https://mariadb.com/kb/en/library/select/','','https://mariadb.com/kb/en/library/select/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (435,27,'SELECT INTO DUMPFILE','Syntax\n------ \nSELECT ... INTO DUMPFILE \'file_path\'\n \nDescription\n----------- \nSELECT ... INTO DUMPFILE is a SELECT clause which writes the\nresultset into a single unformatted row, without any\nseparators, in a file. The results will not be returned to\nthe client.\n \nfile_path can be an absolute path, or a relative path\nstarting from the data directory. It can only be specified\nas a string literal, not as a variable. However, the\nstatement can be dynamically composed and executed as a\nprepared statement to work around this limitation.\n \nThis statement is binary-safe and so is particularly useful\nfor writing BLOB values to file. It can be used, for\nexample, to copy an image or an audio document from the\ndatabase to a file. SELECT ... INTO FILE can be used to save\na text file.\n \nThe file must not exist. It cannot be overwritten. A user\nneeds the FILE privilege to run this statement. Also,\nMariaDB needs permission to write files in the specified\nlocation. If the secure_file_priv system variable is set to\na non-empty directory name, the file can only be written to\nthat directory.\n \nSince MariaDB 5.1, the character_set_filesystem system\nvariable has controlled interpretation of file names that\nare given as literal strings.\n \nExample\n \nSELECT _utf8\'Hello world!\' INTO DUMPFILE \'/tmp/world\';\n \nSELECT LOAD_FILE(\'/tmp/world\') AS world;\n \n+--------------+\n| world |\n+--------------+\n| Hello world! |\n+--------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/select-into-dumpfile/','','https://mariadb.com/kb/en/library/select-into-dumpfile/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (436,27,'SELECT INTO OUTFILE','Syntax\n------ \nSELECT ... INTO OUTFILE \'file_name\'\n [CHARACTER SET charset_name]\n [export_options]\n \nexport_options:\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 \nDescription\n----------- \nSELECT INTO OUTFILE writes the resulting rows to a file, and\nallows the use of column and row terminators to specify a\nparticular output format. The default is to terminate fields\nwith tabs (\\t) and lines with newlines (\\n).\n \nThe file must not exist. It cannot be overwritten. A user\nneeds the FILE privilege to run this statement. Also,\nMariaDB needs permission to write files in the specified\nlocation. If the secure_file_priv system variable is set to\na non-empty directory name, the file can only be written to\nthat directory.\n \nThe LOAD DATA INFILE statement complements SELECT INTO\nOUTFILE.\n \nCharacter-sets\n \nThe CHARACTER SET clause specifies the character set in\nwhich the results are to be written. Without the clause, no\nconversion takes place (the binary character set). In this\ncase, if there are multiple character sets, the output will\ncontain these too, and may not easily be able to be\nreloaded.\n \nIn cases where you have two servers using different\ncharacter-sets, using SELECT INTO OUTFILE to transfer data\nfrom one to the other can have unexpected results. To ensure\nthat MariaDB correctly interprets the escape sequences, use\nthe CHARACTER SET clause on both the SELECT INTO OUTFILE\nstatement and the subsequent LOAD DATA INFILE statement.\n \nExample\n \nThe following example produces a file in the CSV format:\n \nSELECT customer_id, firstname, surname INTO OUTFILE\n\'/exportdata/customers.txt\'\n FIELDS TERMINATED BY \',\' OPTIONALLY ENCLOSED BY \'\"\'\n LINES TERMINATED BY \'\\n\'\n FROM customers;\n \n\n\nURL: https://mariadb.com/kb/en/library/select-into-outfile/','','https://mariadb.com/kb/en/library/select-into-outfile/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (437,27,'SELECT WITH ROLLUP','Syntax\n------ \nSee SELECT for the full syntax.\n \nDescription\n----------- \nThe WITH ROLLUP modifier adds extra rows to the resultset\nthat represent super-aggregate summaries. The\nsuper-aggregated column is represented by a NULL value.\nMultiple aggregates over different columns will be added if\nthere are multiple GROUP BY columns.\n \nThe LIMIT clause can be used at the same time, and is\napplied after the WITH ROLLUP rows have been added.\n \nWITH ROLLUP cannot be used with ORDER BY. Some sorting is\nstill possible by using ASC or DESC clauses with the GROUP\nBY column, although the super-aggregate rows will always be\nadded last.\n \nExamples\n-------- \nThese examples use the following sample table\n \nCREATE TABLE booksales ( \n country VARCHAR(35), genre\nENUM(\'fiction\',\'non-fiction\'), year YEAR, sales INT);\n \nINSERT INTO booksales VALUES\n (\'Senegal\',\'fiction\',2014,12234),\n(\'Senegal\',\'fiction\',2015,15647),\n (\'Senegal\',\'non-fiction\',2014,64980),\n(\'Senegal\',\'non-fiction\',2015,78901),\n (\'Paraguay\',\'fiction\',2014,87970),\n(\'Paraguay\',\'fiction\',2015,76940),\n (\'Paraguay\',\'non-fiction\',2014,8760),\n(\'Paraguay\',\'non-fiction\',2015,9030);\n \nThe addition of the WITH ROLLUP modifier in this example\nadds an extra row that aggregates both years:\n \nSELECT year, SUM(sales) FROM booksales GROUP BY year;\n \n+------+------------+\n| year | SUM(sales) |\n+------+------------+\n| 2014 | 173944 |\n| 2015 | 180518 |\n+------+------------+\n2 rows in set (0.08 sec)\n \nSELECT year, SUM(sales) FROM booksales GROUP BY year WITH\nROLLUP;\n \n+------+------------+\n| year | SUM(sales) |\n+------+------------+\n| 2014 | 173944 |\n| 2015 | 180518 |\n| NULL | 354462 |\n+------+------------+\n \nIn the following example, each time the genre, the year or\nthe country change, another super-aggregate row is added:\n \nSELECT country, year, genre, SUM(sales) \n FROM booksales GROUP BY country, year, genre;\n \n+----------+------+-------------+------------+\n| country | year | genre | SUM(sales) |\n+----------+------+-------------+------------+\n| Paraguay | 2014 | fiction | 87970 |\n| Paraguay | 2014 | non-fiction | 8760 |\n| Paraguay | 2015 | fiction | 76940 |\n| Paraguay | 2015 | non-fiction | 9030 |\n| Senegal | 2014 | fiction | 12234 |\n| Senegal | 2014 | non-fiction | 64980 |\n| Senegal | 2015 | fiction | 15647 |\n| Senegal | 2015 | non-fiction | 78901 |\n+----------+------+-------------+------------+\n \nSELECT country, year, genre, SUM(sales) \n FROM booksales GROUP BY country, year, genre WITH ROLLUP;\n \n+----------+------+-------------+------------+\n| country | year | genre | SUM(sales) |\n+----------+------+-------------+------------+\n| Paraguay | 2014 | fiction | 87970 |\n| Paraguay | 2014 | non-fiction | 8760 |\n| Paraguay | 2014 | NULL | 96730 |\n| Paraguay | 2015 | fiction | 76940 |\n| Paraguay | 2015 | non-fiction | 9030 |\n| Paraguay | 2015 | NULL | 85970 |\n| Paraguay | NULL | NULL | 182700 |\n| Senegal | 2014 | fiction | 12234 |\n| Senegal | 2014 | non-fiction | 64980 |\n| Senegal | 2014 | NULL | 77214 |\n| Senegal | 2015 | fiction | 15647 |\n| Senegal | 2015 | non-fiction | 78901 |\n| Senegal | 2015 | NULL | 94548 |\n| Senegal | NULL | NULL | 171762 |\n| NULL | NULL | NULL | 354462 |\n+----------+------+-------------+------------+\n \nThe LIMIT clause, applied after WITH ROLLUP:\n \nSELECT country, year, genre, SUM(sales) \n FROM booksales GROUP BY country, year, genre WITH ROLLUP\nLIMIT 4;\n \n+----------+------+-------------+------------+\n| country | year | genre | SUM(sales) |\n+----------+------+-------------+------------+\n| Paraguay | 2014 | fiction | 87970 |\n| Paraguay | 2014 | non-fiction | 8760 |\n| Paraguay | 2014 | NULL | 96730 |\n| Paraguay | 2015 | fiction | 76940 |\n+----------+------+-------------+------------+\n \nSorting by year descending:\n \nSELECT country, year, genre, SUM(sales) \n FROM booksales GROUP BY country, year DESC, genre WITH\nROLLUP;\n \n+----------+------+-------------+------------+\n| country | year | genre | SUM(sales) |\n+----------+------+-------------+------------+\n| Paraguay | 2015 | fiction | 76940 |\n| Paraguay | 2015 | non-fiction | 9030 |\n| Paraguay | 2015 | NULL | 85970 |\n| Paraguay | 2014 | fiction | 87970 |\n| Paraguay | 2014 | non-fiction | 8760 |\n| Paraguay | 2014 | NULL | 96730 |\n| Paraguay | NULL | NULL | 182700 |\n| Senegal | 2015 | fiction | 15647 |\n| Senegal | 2015 | non-fiction | 78901 |\n| Senegal | 2015 | NULL | 94548 |\n| Senegal | 2014 | fiction | 12234 |\n| Senegal | 2014 | non-fiction | 64980 |\n| Senegal | 2014 | NULL | 77214 |\n| Senegal | NULL | NULL | 171762 |\n| NULL | NULL | NULL | 354462 |\n+----------+------+-------------+------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/select-with-rollup/','','https://mariadb.com/kb/en/library/select-with-rollup/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (438,27,'UNION','UNION is used to combine the results from multiple SELECT\nstatements into a single result set.\n \nSyntax\n------ \nSELECT ...\nUNION [ALL | DISTINCT] SELECT ...\n[UNION [ALL | DISTINCT] SELECT ...]\n[ORDER BY [column [, column ...]]]\n[LIMIT {[offset,] row_count | row_count OFFSET offset}]\n \nDescription\n----------- \nUNION is used to combine the results from multiple SELECT\nstatements into a single result set.\n \nThe column names from the first SELECT statement are used as\nthe column names for the results returned. Selected columns\nlisted in corresponding positions of each SELECT statement\nshould have the same data type. (For example, the first\ncolumn selected by the first statement should have the same\ntype as the first column selected by the other statements.)\n \nIf they don\'t, the type and length of the columns in the\nresult take into account the values returned by all of the\nSELECTs, so there is no need for explicit casting. Note that\ncurrently this is not the case for recursive CTEs - see\nMDEV-12325.\n \nTable names can be specified as db_name.tbl_name. This\npermits writing UNIONs which involve multiple databases. See\nIdentifier Qualifiers for syntax details.\n \nUNION queries cannot be used with aggregate functions.\n \nALL/DISTINCT\n \nThe ALL keyword causes duplicate rows to be preserved. The\nDISTINCT keyword (the default if the keyword is omitted)\ncauses duplicate rows to be removed by the results.\n \nUNION ALL and UNION DISTINCT can both be present in a query.\nIn this case, UNION DISTINCT will override any UNION ALLs to\nits left.\n \nUntil MariaDB 10.1.1, all UNION ALL statements required the\nserver to create a temporary table. Since MariaDB 10.1.1,\nthe server can in most cases execute UNION ALL without\ncreating a temporary table, improving performance (see\nMDEV-334).\n \nORDER BY and LIMIT\n \nIndividual SELECTs can contain their own ORDER BY and LIMIT\nclauses. In this case, the individual queries need to be\nwrapped between parentheses. However, this does not affect\nthe order of the UNION, so they only are useful to limit the\nrecord read by one SELECT.\n \nThe UNION can have global ORDER BY and LIMIT clauses, which\naffect the whole resultset. If the columns retrieved by\nindividual SELECT statements have an alias (AS), the ORDER\nBY must use that alias, not the real column names.\n \nHIGH_PRIORITY\n \nSpecifying a query as HIGH_PRIORITY will not work inside a\nUNION. If applied to the first SELECT, it will be ignored.\nApplying to a later SELECT results in a syntax error:\n \nERROR 1234 (42000): Incorrect usage/placement of\n\'HIGH_PRIORITY\'\n \nSELECT ... INTO ...\n \nIndividual SELECTs cannot be written INTO DUMPFILE or INTO\nOUTFILE. If the last SELECT statement specifies INTO\nDUMPFILE or INTO OUTFILE, the entire result of the UNION\nwill be written. Placing the clause after any other SELECT\nwill result in a syntax error.\n \nIf the result is a single row, SELECT ... INTO @var_name can\nalso be used.\n \n\nParentheses\n \nFrom MariaDB 10.4.0, parentheses can be used to specify\nprecedence. Before this, a syntax error would be returned.\n \nExamples\n-------- \nUNION between tables having different column names:\n \n(SELECT e_name AS name, email FROM employees)\nUNION\n(SELECT c_name AS name, email FROM customers);\n \nSpecifying the UNION\'s global order and limiting total\nrows:\n \n(SELECT name, email FROM employees)\nUNION\n(SELECT name, email FROM customers)\nORDER BY name LIMIT 10;\n \nAdding a constant row:\n \n(SELECT \'John Doe\' AS name, \'john.doe@example.net\' AS\nemail)\nUNION\n(SELECT name, email FROM customers);\n \nDiffering types:\n \nSELECT CAST(\'x\' AS CHAR(1)) UNION SELECT REPEAT(\'y\',4);\n+----------------------+\n| CAST(\'x\' AS CHAR(1)) |\n+----------------------+\n| x |\n| yyyy |\n+----------------------+\n \nReturning the results in order of each individual SELECT by\nuse of a sort column:\n \n(SELECT 1 AS sort_column, e_name AS name, email FROM\nemployees)\nUNION\n(SELECT 2, c_name AS name, email FROM customers) ORDER BY\nsort_column;\n \nDifference between UNION, EXCEPT and INTERSECT:\n \nCREATE TABLE seqs (i INT);\nINSERT INTO seqs VALUES (1),(2),(3),(4),(5),(6);\n \nSELECT i FROM seqs WHERE i =3;\n \n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n| 3 |\n| 4 |\n| 5 |\n| 6 |\n+------+\n \nSELECT i FROM seqs WHERE i =3;\n \n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n+------+\n \nSELECT i FROM seqs WHERE i =3;\n \n+------+\n| i |\n+------+\n| 3 |\n+------+\n \nParentheses for specifying precedence, from MariaDB 10.4.0\n \nCREATE OR REPLACE TABLE t1 (a INT);\nCREATE OR REPLACE TABLE t2 (b INT);\nCREATE OR REPLACE TABLE t3 (c INT);\n \nINSERT INTO t1 VALUES (1),(2),(3),(4);\nINSERT INTO t2 VALUES (5),(6);\nINSERT INTO t3 VALUES (1),(6);\n \n((SELECT a FROM t1) UNION (SELECT b FROM t2)) INTERSECT\n(SELECT c FROM t3);\n+------+\n| a |\n+------+\n| 1 |\n| 6 |\n+------+\n \n(SELECT a FROM t1) UNION ((SELECT b FROM t2) INTERSECT\n(SELECT c FROM t3));\n+------+\n| a |\n+------+\n| 1 |\n| 2 |\n| 3 |\n| 4 |\n| 6 |\n+------+\n \n\n\nURL: https://mariadb.com/kb/en/library/union/','','https://mariadb.com/kb/en/library/union/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (439,27,'UPDATE','Syntax\n------ \nSingle-table syntax:\n \nUPDATE [LOW_PRIORITY] [IGNORE] table_reference \n [PARTITION (partition_list)]\n SET col1={expr1|DEFAULT} [,col2={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 col1={expr1|DEFAULT} [, col2={expr2|DEFAULT}] ...\n [WHERE where_condition]\n \nDescription\n----------- \nFor the single-table syntax, the UPDATE statement updates\ncolumns of existing rows in the named table with new values.\nThe\nSET clause indicates which columns to modify and the values\nthey should be given. Each value can be given as an\nexpression, or the keyword\nDEFAULT to set a column explicitly to its default value. The\nWHERE clause, if given, specifies the conditions that\nidentify\nwhich rows to update. With no WHERE clause, all rows are\nupdated. If the ORDER BY clause is specified, the rows are\nupdated in the order that is specified. The LIMIT clause\nplaces a limit on the number of rows that can be updated.\n \nThe PARTITION clause was introduced in MariaDB 10.0. See\nPartition Pruning and Selection for details.\n \nUntil MariaDB 10.3.2, for the multiple-table syntax, UPDATE\nupdates rows in each\ntable named in table_references that satisfy the conditions.\nIn this case,\nORDER BY and LIMIT cannot be used. This restriction was\nlifted in MariaDB 10.3.2 and both clauses can be used with\nmultiple-table updates. An UPDATE can also reference tables\nwhich are located in different databases; see Identifier\nQualifiers for the syntax.\n \nwhere_condition is an expression that evaluates to true for\neach row to be updated.\n \ntable_references and where_condition are as\nspecified as described in SELECT.\n \nAssignments are evaluated in left-to-right order, unless the\nSIMULTANEOUS_ASSIGNMENT sql_mode (available from MariaDB\n10.3.5) is set, in which case the UPDATE statement evaluates\nall assignments simultaneously. \n \nYou need the UPDATE privilege only for columns referenced in\nan UPDATE that are actually updated. You need only the\nSELECT privilege for any columns that are read but\nnot modified. See GRANT.\n \nThe UPDATE statement supports the following modifiers:\nIf you use the LOW_PRIORITY keyword, execution of\n the UPDATE is delayed until no other clients are reading\nfrom\n the table. This affects only storage engines that use only\ntable-level\n locking (MyISAM, MEMORY, MERGE). See HIGH_PRIORITY and\nLOW_PRIORITY clauses for details.\nIf you use the IGNORE keyword, the update statement does \n not abort even if errors occur during the update. Rows for\nwhich\n duplicate-key conflicts occur are not updated. Rows for\nwhich columns are\n updated to values that would cause data conversion errors\nare updated to the\n closest valid values instead.\n \nUPDATE Statements With the Same Source and Target\n \nFrom MariaDB 10.3.2, UPDATE statements may have the same\nsource and target.\n \nFor example, given the following table:\n \nDROP TABLE t1;\n \nCREATE TABLE t1 (c1 INT, c2 INT);\nINSERT INTO t1 VALUES (10,10), (20,20);\n \nUntil MariaDB 10.3.1, the following UPDATE statement would\nnot work:\n \nUPDATE t1 SET c1=c1+1 WHERE c2=(SELECT MAX(c2) FROM t1);\nERROR 1093 (HY000): Table \'t1\' is specified twice, \n both as a target for \'UPDATE\' and as a separate source\nfor data\n \nFrom MariaDB 10.3.2, the statement executes successfully:\n \nUPDATE t1 SET c1=c1+1 WHERE c2=(SELECT MAX(c2) FROM t1);\n \nSELECT * FROM t1;\n \n+------+------+\n| c1 | c2 |\n+------+------+\n| 10 | 10 |\n| 21 | 20 |\n+------+------+\n \nExample\n \nSingle-table syntax:\n \nUPDATE table_name SET column1 = value1, column2 = value2\nWHERE id=100;\n \nMultiple-table syntax:\n \nUPDATE tab1, tab2 SET tab1.column1 = value1, tab1.column2 =\nvalue2 WHERE tab1.id = tab2.id;\n \n\n\nURL: https://mariadb.com/kb/en/library/update/','','https://mariadb.com/kb/en/library/update/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (440,27,'WITH','The WITH keyword signifies a Common Table Expression (CTE).\nIt allows you to refer to a subquery expression many times\nin a query, as if having a temporary table that only exists\nfor the duration of a query.\n \nThere are two kinds of CTEs:\nNon-Recursive\nRecursive\n \nCommon Table Expression WITH was introduced in MariaDB\n10.2.1.\n \nRecursive WITH has been supported since MariaDB 10.2.2.\n \nSyntax\n------ \nWITH [RECURSIVE] table_reference as (SELECT ...)\n SELECT ...\n \nYou can use table_reference as any normal table in the\nexternal SELECT part. You can also use WITH in sub queries.\nWITH can also be used with EXPLAIN and SELECT.\n \nBelow is an example with the WITH at the top level:\n \nWITH t AS (SELECT a FROM t1 WHERE b >= \'c\') \n SELECT * FROM t2, t WHERE t2.c = t.a;\n \nThe example below uses WITH in a subquery:\n \nSELECT t1.a, t1.b FROM t1, t2\n WHERE t1.a > t2.c \n AND t2.c IN(WITH t AS (SELECT * FROM t1 WHERE t1.a \n\nURL: https://mariadb.com/kb/en/library/with/','','https://mariadb.com/kb/en/library/with/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (441,28,'DESCRIBE','Syntax\n------ \n{DESCRIBE | DESC} tbl_name [col_name | wild]\n \nDescription\n----------- \nDESCRIBE provides information about the columns in a table.\nIt is a shortcut for SHOW COLUMNS FROM.\nThese statements also display information for views.\n \ncol_name can be a column name, or a string containing the\nSQL \"%\" and \"_\" wildcard characters to\nobtain output only for the columns with names matching the\nstring. There is no\nneed to enclose the string within quotes unless it contains\nspaces or other\nspecial characters.\n \nDESCRIBE city;\n \n+------------+----------+------+-----+---------+----------------+\n| Field | Type | Null | Key | Default | Extra |\n+------------+----------+------+-----+---------+----------------+\n| Id | int(11) | NO | PRI | NULL | auto_increment |\n| Name | char(35) | YES | | NULL | |\n| Country | char(3) | NO | UNI | | |\n| District | char(20) | YES | MUL | | |\n| Population | int(11) | YES | | NULL | |\n+------------+----------+------+-----+---------+----------------+\n \nThe description for SHOW COLUMNS provides\nmore information about the output columns.\n \n\n\nURL: https://mariadb.com/kb/en/library/describe/','','https://mariadb.com/kb/en/library/describe/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (442,28,'EXPLAIN','Syntax\n------ \nEXPLAIN tbl_name\n \nOr\n \nEXPLAIN [EXTENDED | PARTITIONS] \n {SELECT select_options | UPDATE update_options | DELETE\ndelete_options}\n \nDescription\n----------- \nThe EXPLAIN statement can be used either as a synonym for\nDESCRIBE or as a way to obtain information about how MariaDB\nexecutes a SELECT (as well as UPDATE and DELETE since\nMariaDB 10.0.5) statement:\n\'EXPLAIN tbl_name\' is synonymous with \n \'DESCRIBE tbl_name\' or \n \'SHOW COLUMNS FROM tbl_name\'.\nWhen you precede a SELECT statement (or, since MariaDB\n10.0.5, an UPDATE or a DELETE as well) with the keyword \n EXPLAIN, MariaDB displays information from the optimizer\n about the query execution plan. That is, MariaDB explains\nhow it would\n process the SELECT, UPDATE or DELETE, including information\nabout how tables\n are joined and in which order. EXPLAIN EXTENDED can be\n used to provide additional information.\nEXPLAIN PARTITIONS has been available since MySQL 5.1.5. It\nis useful only when examining queries involving partitioned\ntables. For details, see Partition pruning and selection.\nANALYZE statement, which performs the query as well as\nproducing EXPLAIN output, and provides actual as well as\nestimated statistics, has been available from MariaDB\n10.1.0.\nSince MariaDB 10.0.5, it has been possible to have EXPLAIN\noutput printed in the slow query log. See EXPLAIN in the\nSlow Query Log for details.\n \nSince MariaDB 10.0, SHOW EXPLAIN shows the output of a\nrunning statement. In some cases, its output can be closer\nto reality than EXPLAIN.\n \nSince MariaDB 10.1, the ANALYZE statement runs a statement\nand returns information about its execution plan. It also\nshows additional columns, to check how much the optimizer\'s\nestimation about filtering and found rows are close to\nreality.\n \nThere is an online EXPLAIN Analyzer that you can use to\nshare EXPLAIN and EXPLAIN EXTENDED output with others.\n \nEXPLAIN can acquire metadata locks in the same way that\nSELECT does, as it needs to know table metadata and,\nsometimes, data as well.\n \nThe columns in EXPLAIN ... SELECT\n \nColumn name | Description | \n \nid | Sequence number that shows in which order tables are\njoined. | \n \nselect_type | What kind of SELECT the table comes from. | \n \ntable | Alias name of table. Materialized temporary tables\nfor sub queries are named | \n \ntype | How rows are found from the table (join type). | \n \npossible_keys | keys in table that could be used to find\nrows in the table | \n \nkey | The name of the key that is used to retrieve rows.\nNULL is no key was used. | \n \nkey_len | How many bytes of the key that was used (shows if\nwe are using only parts of the multi-column key). | \n \nref | The reference that is used to as the key value. | \n \nrows | An estimate of how many rows we will find in the\ntable for each key lookup. | \n \nExtra | Extra information about this join. | \n \nHere are descriptions of the values for some of the more\ncomplex columns in EXPLAIN ... SELECT:\n \n\"select_type\" column\n \nThe select_type column can have the following values:\n \nValue | Description | \n \nDEPENDENT SUBQUERY | The SUBQUERY is DEPENDENT. | \n \nDEPENDENT UNION | The UNION is DEPENDENT. | \n \nDERIVED | The SELECT is DERIVED from the PRIMARY. | \n \nMATERIALIZED | The SUBQUERY is MATERIALIZED. | \n \nPRIMARY | The SELECT is a PRIMARY one. | \n \nSIMPLE | The SELECT is a SIMPLE one. | \n \nSUBQUERY | The SELECT is a SUBQUERY of the PRIMARY. | \n \nUNCACHEABLE SUBQUERY | The SUBQUERY is UNCACHEABLE. | \n \nUNCACHEABLE UNION | The UNION is UNCACHEABLE. | \n \nUNION | The SELECT is a UNION of the PRIMARY. | \n \nUNION RESULT | The result of the UNION. | \n \n\"Type\" column\n \nThis column contains information on how the table is\naccessed.\n \nValue | Description | \n \nALL | A full table scan is done for the table (all rows are\nread). This is bad if the table is large and the table is\njoined against a previous table! This happens when the\noptimizer could not find any usable index to access rows. | \n \nconst | There is only one possibly matching row in the\ntable. The row is read before the optimization phase and all\ncolumns in the table are treated as constants. | \n \neq_ref | A unique index is used to find the rows. This is\nthe best possible plan to find the row. | \n \nfulltext | A fulltext index is used to access the rows. | \n \nindex_merge | A \'range\' access is done for for several\nindex and the found rows are merged. The key column shows\nwhich keys are used. | \n \nindex_subquery | This is similar as ref, but used for sub\nqueries that are transformed to key lookups. | \n \nindex | A full scan over the used index. Better than ALL but\nstill bad if index is large and the table is joined against\na previous table. | \n \nrange | The table will be accessed with a key over one or\nmore value ranges. | \n \nref_or_null | Like \'ref\' but in addition another search\nfor the \'null\' value is done if the first value was not\nfound. This happens usually with sub queries. | \n \nref | A non unique index or prefix of an unique index is\nused to find the rows. Good if the prefix doesn\'t match\nmany rows. | \n \nsystem | The table has 0 or 1 rows. | \n \nunique_subquery | This is similar as eq_ref, but used for\nsub queries that are transformed to key lookups | \n \n\"Extra\" column\n \nThis column consists of one or more of the following values,\nseparated by \';\'\n \n Note that some of these values are detected after the\noptimization phase.\n \nThe optimization phase can do the following changes to the\nWHERE clause:\nAdd the expressions from the ON and USING clauses to the\nWHERE\n clause.\nConstant propagation: If there is column=constant, replace\nall column\n instances with this constant.\nReplace all columns from \'const\' tables with their values.\nRemove the used key columns from the WHERE (as this will be\ntested as\n part of the key lookup).\nRemove impossible constant sub expressions.\n For example WHERE \'(a=1 and a=2) OR b=1\' becomes \'b=1\'.\nReplace columns with other columns that has identical\nvalues:\n Example: WHERE a=b and a=c may be treated\n as \'WHERE a=b and a=c and b=c\'.\nAdd extra conditions to detect impossible row conditions\nearlier. This\n happens mainly with OUTER JOIN where we in some cases add\ndetection\n of NULL values in the WHERE (Part of \'Not exists\'\noptimization).\n This can cause an unexpected \'Using where\' in the Extra\ncolumn.\nFor each table level we remove expressions that have already\nbeen tested when\n we read the previous row. Example: When joining tables t1\nwith t2\n using the following WHERE \'t1.a=1 and t1.a=t2.b\', we\ndon\'t have to\n test \'t1.a=1\' when checking rows in t2 as we already know\nthat this\n expression is true. \n \nValue | Description | \n \nconst row not found | The table was a system table (a table\nwith should exactly one row), but no row was found. | \n \nDistinct | If distinct optimization (remove duplicates) was\nused. This is marked only for the last table in the SELECT.\n| \n \nFull scan on NULL key | The table is a part of the sub query\nand if the value that is used to match the sub query will be\nNULL, we will do a full table scan. | \n \nImpossible HAVING | The used HAVING clause is always false\nso the SELECT will return no rows. | \n \nImpossible WHERE noticed after reading const tables. | The\nused WHERE clause is always false so the SELECT will return\nno rows. This case was detected after we had read all\n\'const\' tables and used the column values as constant in\nthe WHERE clause. For example: WHERE const_column=5 and\nconst_column had a value of 4. | \n \nImpossible WHERE | The used WHERE clause is always false so\nthe SELECT will return no rows. For example: WHERE 1=2 | \n \nNo matching min/max row | During early optimization of\nMIN()/MAX() values it was detected that no row could match\nthe WHERE clause. The MIN()/MAX() function will return NULL.\n| \n \nno matching row in const table | The table was a const table\n(a table with only one possible matching row), but no row\nwas found. | \n \nNo tables used | The SELECT was a sub query that did not use\nany tables. For example a there was no FROM clause or a FROM\nDUAL clause. | \n \nNot exists | Stop searching after more row if we find one\nsingle matching row. This optimization is used with LEFT\nJOIN where one is explicitly searching for rows that\ndoesn\'t exists in the LEFT JOIN TABLE. Example: SELECT *\nFROM t1 LEFT JOIN t2 on (...) WHERE t2.not_null_column IS\nNULL. As t2.not_null_column can only be NULL if there was no\nmatching row for on condition, we can stop searching if we\nfind a single matching row. | \n \nOpen_frm_only | For information_schema tables. Only the frm\n(table definition file was opened) was opened for each\nmatching row. | \n \nOpen_full_table | For information_schema tables. A full\ntable open for each matching row is done to retrieve the\nrequested information. (Slow) | \n \nOpen_trigger_only | For information_schema tables. Only the\ntrigger file definition was opened for each matching row. | \n \nRange checked for each record (index map: ...) | This only\nhappens when there was no good default index to use but\nthere may some index that could be used when we can treat\nall columns from previous table as constants. For each row\ncombination the optimizer will decide which index to use (if\nany) to fetch a row from this table. This is not fast, but\nfaster than a full table scan that is the only other choice.\nThe index map is a bitmask that shows which index are\nconsidered for each row condition. | \n \nScanned 0/1/all databases | For information_schema tables.\nShows how many times we had to do a directory scan. | \n \nSelect tables optimized away | All tables in the join was\noptimized away. This happens when we are only using\nCOUNT(*), MIN() and MAX() functions in the SELECT and we\nwhere able to replace all of these with constants. | \n \nSkip_open_table | For information_schema tables. The queried\ntable didn\'t need to be opened. | \n \nunique row not found | The table was detected to be a const\ntable (a table with only one possible matching row) during\nthe early optimization phase, but no row was found. | \n \nUsing filesort | Filesort is needed to resolve the query.\nThis means an extra phase where we first collect all columns\nto sort, sort them with a disk based merge sort and then use\nthe sorted set to retrieve the rows in sorted order. If the\ncolumn set is small, we store all the columns in the sort\nfile to not have to go to the database to retrieve them\nagain. | \n \nUsing index | Only the index is used to retrieve the needed\ninformation from the table. There is no need to perform an\nextra seek to retrieve the actual record. | \n \nUsing index condition | Like \'Using where\' but the where\ncondition is pushed down to the table engine for internal\noptimization at the index level. | \n \nUsing index condition(BKA) | Like \'Using index condition\'\nbut in addition we use batch key access to retrieve rows. | \n \nUsing index for group-by | The index is being used to\nresolve a GROUP BY or DISTINCT query. The rows are not read.\nThis is very efficient if the table has a lot of identical\nindex entries as duplicates are quickly jumped over. | \n \nUsing intersect(...) | For index_merge joins. Shows which\nindex are part of the intersect. | \n \nUsing join buffer | We store previous row combinations in a\nrow buffer to be able to match each row against all of the\nrows combinations in the join buffer at one go. | \n \nUsing sort_union(...) | For index_merge joins. Shows which\nindex are part of the union. | \n \nUsing temporary | A temporary table is created to hold the\nresult. This typically happens if you are using GROUP BY,\nDISTINCT or ORDER BY. | \n \nUsing where | A WHERE expression (in additional to the\npossible key lookup) is used to check if the row should be\naccepted. If you don\'t have \'Using where\' together with a\njoin type of ALL, you are probably doing something wrong! | \n \nUsing where with pushed condition | Like \'Using where\' but\nthe where condition is pushed down to the table engine for\ninternal optimization at the row level. | \n \nUsing buffer | The UPDATE statement will first buffer the\nrows, and then run the updates, rather than do updates on\nthe fly. See Using Buffer UPDATE Algorithm for a detailed\nexplanation. | \n \nEXPLAIN EXTENDED\n \nThe EXTENDED keyword adds another column, filtered, to the\noutput. This is a percentage estimate of the table rows that\nwill be filtered by the condition.\n \nAn EXPLAIN EXTENDED will always throw a warning, as it adds\nextra Message information to a subsequent SHOW WARNINGS\nstatement. This includes what the SELECT query would look\nlike after optimizing and rewriting rules are applied and\nhow the optimizer qualifies columns and tables.\n \nExamples\n-------- \nAs synonym for DESCRIBE or SHOW COLUMNS FROM:\n \nDESCRIBE city;\n \n+------------+----------+------+-----+---------+----------------+\n| Field | Type | Null | Key | Default | Extra |\n+------------+----------+------+-----+---------+----------------+\n| Id | int(11) | NO | PRI | NULL | auto_increment |\n| Name | char(35) | YES | | NULL | |\n| Country | char(3) | NO | UNI | | |\n| District | char(20) | YES | MUL | | |\n| Population | int(11) | YES | | NULL | |\n+------------+----------+------+-----+---------+----------------+\n \nA simple set of examples to see how EXPLAIN can identify\npoor index usage:\n \nCREATE TABLE IF NOT EXISTS `employees_example` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `first_name` varchar(30) NOT NULL,\n `last_name` varchar(40) NOT NULL,\n `position` varchar(25) NOT NULL,\n `home_address` varchar(50) NOT NULL,\n `home_phone` varchar(12) NOT NULL,\n `employee_code` varchar(25) NOT NULL,\n PRIMARY KEY (`id`),\n UNIQUE KEY `employee_code` (`employee_code`),\n KEY `first_name` (`first_name`,`last_name`)\n) ENGINE=Aria;\n \nINSERT INTO `employees_example` (`first_name`, `last_name`,\n`position`, `home_address`, `home_phone`, `employee_code`)\n VALUES\n (\'Mustapha\', \'Mond\', \'Chief Executive Officer\', \'692\nPromiscuous Plaza\', \'326-555-3492\', \'MM1\'),\n (\'Henry\', \'Foster\', \'Store Manager\', \'314 Savage\nCircle\', \'326-555-3847\', \'HF1\'),\n (\'Bernard\', \'Marx\', \'Cashier\', \'1240 Ambient\nAvenue\', \'326-555-8456\', \'BM1\'),\n (\'Lenina\', \'Crowne\', \'Cashier\', \'281 Bumblepuppy\nBoulevard\', \'328-555-2349\', \'LC1\'),\n (\'Fanny\', \'Crowne\', \'Restocker\', \'1023 Bokanovsky\nLane\', \'326-555-6329\', \'FC1\'),\n (\'Helmholtz\', \'Watson\', \'Janitor\', \'944 Soma\nCourt\', \'329-555-2478\', \'HW1\');\n \nSHOW INDEXES FROM employees_example;\n \n+-------------------+------------+---------------+--------------+---------------+-----------+-------------+----------+--------+------+------------+---------+---------------+\n| Table | Non_unique | Key_name | Seq_in_index | Column_name\n| Collation | Cardinality | Sub_part | Packed | Null |\nIndex_type | Comment | Index_comment |\n+-------------------+------------+---------------+--------------+---------------+-----------+-------------+----------+--------+------+------------+---------+---------------+\n| employees_example | 0 | PRIMARY | 1 | id | A | 7 | NULL |\nNULL | | BTREE | | |\n| employees_example | 0 | employee_code | 1 | employee_code\n| A | 7 | NULL | NULL | | BTREE | | |\n| employees_example | 1 | first_name | 1 | first_name | A |\nNULL | NULL | NULL | | BTREE | | |\n| employees_example | 1 | first_name | 2 | last_name | A |\nNULL | NULL | NULL | | BTREE | | |\n+-------------------+------------+---------------+--------------+---------------+-----------+-------------+----------+--------+------+------------+---------+---------------+\n \nSELECT on a primary key:\n \nEXPLAIN SELECT * FROM employees_example WHERE id=1;\n \n+------+-------------+-------------------+-------+---------------+---------+---------+-------+------+-------+\n| id | select_type | table | type | possible_keys | key |\nkey_len | ref | rows | Extra |\n+------+-------------+-------------------+-------+---------------+---------+---------+-------+------+-------+\n| 1 | SIMPLE | employees_example | const | PRIMARY | PRIMARY\n| 4 | const | 1 | |\n+------+-------------+-------------------+-------+---------------+---------+---------+-------+------+-------+\n \nThe type is const, which means that only one possible result\ncould be returned. \nNow, returning the same record but searching by their phone\nnumber:\n \nEXPLAIN SELECT * FROM employees_example WHERE\nhome_phone=\'326-555-3492\';\n \n+------+-------------+-------------------+------+---------------+------+---------+------+------+-------------+\n| id | select_type | table | type | possible_keys | key |\nkey_len | ref | rows | Extra |\n+------+-------------+-------------------+------+---------------+------+---------+------+------+-------------+\n| 1 | SIMPLE | employees_example | ALL | NULL | NULL | NULL\n| NULL | 6 | Using where |\n+------+-------------+-------------------+------+---------------+------+---------+------+------+-------------+\n \nHere, the type is All, which means no index could be used.\nLooking at the rows count, a full table scan (all six rows)\nhad to be performed in order to retrieve the record. If\nit\'s a requirement to search by phone number, an index will\nhave to be created.\n \nSHOW EXPLAIN example:\n \nSHOW EXPLAIN FOR 1;\n \n+------+-------------+-------+-------+---------------+------+---------+------+---------+-------------+\n| id | select_type | table | type | possible_keys | key |\nkey_len | ref | rows | Extra |\n+------+-------------+-------+-------+---------------+------+---------+------+---------+-------------+\n| 1 | SIMPLE | tbl | index | NULL | a | 5 | NULL | 1000107 |\nUsing index |\n+------+-------------+-------+-------+---------------+------+---------+------+---------+-------------+\n1 row in set, 1 warning (0.00 sec)\n \nExample of ref_or_null optimization\n \nSELECT * FROM table_name\n WHERE key_column=expr OR key_column IS NULL;\n \nref_or_null is something that often happens when you use\nsubqueries with NOT IN as then one has to do an extra check\nfor NULL values if the first value didn\'t have a matching\nrow. \n \n\n\nURL: https://mariadb.com/kb/en/library/explain/','','https://mariadb.com/kb/en/library/explain/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (443,28,'EXPLAIN ANALYZE','The syntax for the EXPLAIN ANALYZE feature was changed to\nANALYZE statement, available since MariaDB 10.1.0. See\nANALYZE statement. \n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/explain-analyze/','','https://mariadb.com/kb/en/library/explain-analyze/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (444,28,'ANALYZE FORMAT=JSON','ANALYZE FORMAT=JSON is a mix of the EXPLAIN FORMAT=JSON and\nANALYZE statement features. ANALYZE FORMAT=JSON $statement\nwill execute $statement, and then print the output of\nEXPLAIN FORMAT=JSON, amended with the data from query\nexecution.\n \nBasic Execution Data\n \nYou can get the following also from tabular ANALYZE\nstatement form:\nr_rows is provided for any node that reads rows. It shows\nhow many rows were read, on average \nr_filtered is provided whenever there is a condition that is\nchecked. It shows the percentage of rows left after checking\nthe condition.\n \nAdvanced Execution Data\n \nThe most important data that is not available in tabula\nANALYZE statement are:\nr_loops field. This shows how many times the node was\nexecuted. Most query plan elements have this field.\nr_total_time_ms field. It shows how much time in total was\nspent executing this node. If the node has subnodes, their\nexecution time is included.\nr_buffer_size field. Query plan nodes that make use of\nbuffers report the size of buffer that was was used.\n \nData About Individual Query Plan Nodes\n \nfilesort node reports whether sorting was done with LIMIT n\nparameter, and how many rows were in the sort result. \nblock-nl-join node has r_loops field, which allows to tell\nwhether Using join buffer was efficient \nrange-checked-for-each-record reports counters that show the\nresult of the check. \nexpression-cache is used for subqueries, and it reports how\nmany times the cache was used, and what cache hit ratio was.\nunion_result node has r_rows so one can see how many rows\nwere produced after UNION operation\nand so forth\n \nUse Cases\n \nSee Examples of ANALYZE FORMAT=JSON.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/analyze-format-json/','','https://mariadb.com/kb/en/library/analyze-format-json/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (445,28,'ANALYZE FORMAT=JSON Examples','Example #1\n \nCustomers who have ordered more than 1M goods.\n \nANALYZE FORMAT=JSON\nSELECT CONT(*)\nFROM customer\nWHERE\n (SELECT SUM(o_totalprice) FROM orders WHERE\no_custkey=c_custkey) > 1000*1000;\n \nThe query takes 40 seconds over cold cache\n \nEXPLAIN: {\n \"query_block\": {\n \"select_id\": 1,\n \"r_loops\": 1,\n \"r_total_time_ms\": 39872,\n \"table\": {\n \"table_name\": \"customer\",\n \"access_type\": \"index\",\n \"key\": \"i_c_nationkey\",\n \"key_length\": \"5\",\n \"used_key_parts\": [\"c_nationkey\"],\n \"r_loops\": 1,\n \"rows\": 150303,\n \"r_rows\": 150000,\n \"r_total_time_ms\": 270.3,\n \"filtered\": 100,\n \"r_filtered\": 60.691,\n \"attached_condition\": \"((subquery#2) > ((1000 *\n1000)))\",\n \"using_index\": true\n },\n \"subqueries\": [\n {\n \"query_block\": {\n \"select_id\": 2,\n \"r_loops\": 150000,\n \"r_total_time_ms\": 39531,\n \"table\": {\n \"table_name\": \"orders\",\n \"access_type\": \"ref\",\n \"possible_keys\": [\"i_o_custkey\"],\n \"key\": \"i_o_custkey\",\n \"key_length\": \"5\",\n \"used_key_parts\": [\"o_custkey\"],\n \"ref\": [\"dbt3sf1.customer.c_custkey\"],\n \"r_loops\": 150000,\n \"rows\": 7,\n \"r_rows\": 10,\n \"r_total_time_ms\": 39208,\n \"filtered\": 100,\n \"r_filtered\": 100\n }\n }\n }\n ]\n }\n}\nANALYZE shows that 39.2 seconds were spent in the subquery,\nwhich was executed 150K times (for every row of outer\ntable).\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/analyze-formatjson-examples/','','https://mariadb.com/kb/en/library/analyze-formatjson-examples/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (446,30,'CONTAINS','Syntax\n------ \nContains(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether a geometry g1 completely\ncontains geometry g2. CONTAINS() is based on the original\nMySQL implementation and uses object bounding rectangles,\nwhile ST_CONTAINS() uses object shapes. \n \nThis tests the opposite relationship to Within().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/contains/','','https://mariadb.com/kb/en/library/contains/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (447,30,'CROSSES','Syntax\n------ \nCrosses(g1,g2)\n \nDescription\n----------- \nReturns 1 if g1 spatially crosses g2. Returns NULL if g1 is\na Polygon or a MultiPolygon, or if g2 is a\nPoint or a MultiPoint. Otherwise, returns 0.\n \nThe term spatially crosses denotes a spatial relation\nbetween two\ngiven geometries that has the following properties:\nThe two geometries intersect\nTheir intersection results in a geometry that has a\ndimension that is one\n less than the maximum dimension of the two given geometries\nTheir intersection is not equal to either of the two given\ngeometries\n \nCROSSES() is based on the original MySQL implementation, and\nuses object bounding rectangles, while ST_CROSSES() uses\nobject shapes.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/crosses/','','https://mariadb.com/kb/en/library/crosses/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (448,30,'DISJOINT','Syntax\n------ \nDisjoint(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether g1 is spatially disjoint\nfrom\n(does not intersect) g2.\n \nDISJOINT() tests the opposite relationship to INTERSECTS().\n \nDISJOINT() is based on the original MySQL implementation and\nuses object bounding rectangles, while ST_DISJOINT() uses\nobject shapes.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/disjoint/','','https://mariadb.com/kb/en/library/disjoint/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (449,30,'EQUALS','Syntax\n------ \nEquals(g1,g2)\n \nFrom MariaDB 10.2.3:\n \nMBREQUALS(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether g1 is spatially equal to\ng2.\n \nEQUALS() is based on the original MySQL implementation and\nuses object bounding rectangles, while ST_EQUALS() uses\nobject shapes.\n \nFrom MariaDB 10.2.3, MBREQUALS is a synonym for Equals.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/equals/','','https://mariadb.com/kb/en/library/equals/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (450,30,'INTERSECTS','Syntax\n------ \nINTERSECTS(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether geometry g1 spatially\nintersects geometry g2.\n \nINTERSECTS() is based on the original MySQL implementation\nand uses object bounding rectangles, while ST_INTERSECTS()\nuses object shapes.\n \nINTERSECTS() tests the opposite relationship to DISJOINT().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/intersects/','','https://mariadb.com/kb/en/library/intersects/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (451,30,'OVERLAPS','Syntax\n------ \nOVERLAPS(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether g1 spatially overlaps g2.\nThe term spatially overlaps is used if two geometries\nintersect and their\nintersection results in a geometry of the same dimension but\nnot equal to\neither of the given geometries.\n \nOVERLAPS() is based on the original MySQL implementation and\nuses object bounding rectangles, while ST_OVERLAPS() uses\nobject shapes.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/overlaps/','','https://mariadb.com/kb/en/library/overlaps/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (452,30,'ST_CONTAINS','Syntax\n------ \nST_CONTAINS(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether a geometry g1 completely\ncontains geometry g2.\n \nST_CONTAINS() uses object shapes, while CONTAINS(), based on\nthe original MySQL implementation, uses object bounding\nrectangles.\n \nST_CONTAINS tests the opposite relationship to ST_WITHIN().\n \nExamples\n-------- \nSET @g1 = ST_GEOMFROMTEXT(\'POLYGON((175 150, 20 40, 50 60,\n125 100, 175 150))\');\n \nSET @g2 = ST_GEOMFROMTEXT(\'POINT(174 149)\');\n \nSELECT ST_CONTAINS(@g1,@g2);\n+----------------------+\n| ST_CONTAINS(@g1,@g2) |\n+----------------------+\n| 1 |\n+----------------------+\n \nSET @g2 = ST_GEOMFROMTEXT(\'POINT(175 151)\');\n \nSELECT ST_CONTAINS(@g1,@g2);\n+----------------------+\n| ST_CONTAINS(@g1,@g2) |\n+----------------------+\n| 0 |\n+----------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st-contains/','','https://mariadb.com/kb/en/library/st-contains/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (453,30,'ST_CROSSES','Syntax\n------ \nST_CROSSES(g1,g2)\n \nDescription\n----------- \nReturns 1 if geometry g1 spatially crosses geometry g2.\nReturns NULL if g1 is a Polygon or a MultiPolygon, or if g2\nis a\nPoint or a MultiPoint. Otherwise, returns 0.\n \nThe term spatially crosses denotes a spatial relation\nbetween two\ngiven geometries that has the following properties:\nThe two geometries intersect\nTheir intersection results in a geometry that has a\ndimension that is one\n less than the maximum dimension of the two given geometries\nTheir intersection is not equal to either of the two given\ngeometries\n \nST_CROSSES() uses object shapes, while CROSSES(), based on\nthe original MySQL implementation, uses object bounding\nrectangles.\n \nExamples\n-------- \nSET @g1 = ST_GEOMFROMTEXT(\'LINESTRING(174 149, 176 151)\');\n \nSET @g2 = ST_GEOMFROMTEXT(\'POLYGON((175 150, 20 40, 50 60,\n125 100, 175 150))\');\n \nSELECT ST_CROSSES(@g1,@g2);\n+---------------------+\n| ST_CROSSES(@g1,@g2) |\n+---------------------+\n| 1 |\n+---------------------+\n \nSET @g1 = ST_GEOMFROMTEXT(\'LINESTRING(176 149, 176 151)\');\n \nSELECT ST_CROSSES(@g1,@g2);\n+---------------------+\n| ST_CROSSES(@g1,@g2) |\n+---------------------+\n| 0 |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st-crosses/','','https://mariadb.com/kb/en/library/st-crosses/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (454,30,'ST_DIFFERENCE','Syntax\n------ \nST_DIFFERENCE(g1,g2)\n \nDescription\n----------- \nReturns a geometry representing the point set difference of\nthe given geometry values.\n \nExample\n \nSET @g1 = POINT(10,10), @g2 = POINT(20,20);\n \nSELECT ST_AsText(ST_Difference(@g1, @g2));\n+------------------------------------+\n| ST_AsText(ST_Difference(@g1, @g2)) |\n+------------------------------------+\n| POINT(10 10) |\n+------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_difference/','','https://mariadb.com/kb/en/library/st_difference/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (455,30,'ST_DISJOINT','Syntax\n------ \nST_DISJOINT(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether geometry g1 is spatially\ndisjoint from\n(does not intersect with) geometry g2.\n \nST_DISJOINT() uses object shapes, while DISJOINT(), based on\nthe original MySQL implementation, uses object bounding\nrectangles.\n \nST_DISJOINT() tests the opposite relationship to\nST_INTERSECTS().\n \nExamples\n-------- \nSET @g1 = ST_GEOMFROMTEXT(\'POINT(0 0)\');\n \nSET @g2 = ST_GEOMFROMTEXT(\'LINESTRING(2 0, 0 2)\');\n \nSELECT ST_DISJOINT(@g1,@g2);\n+----------------------+\n| ST_DISJOINT(@g1,@g2) |\n+----------------------+\n| 1 |\n+----------------------+\n \nSET @g2 = ST_GEOMFROMTEXT(\'LINESTRING(0 0, 0 2)\');\n \nSELECT ST_DISJOINT(@g1,@g2);\n+----------------------+\n| ST_DISJOINT(@g1,@g2) |\n+----------------------+\n| 0 |\n+----------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_disjoint/','','https://mariadb.com/kb/en/library/st_disjoint/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (456,30,'ST_DISTANCE','ST_DISTANCE() was introduced in MariaDB 5.3.3.\n \nSyntax\n------ \nST_DISTANCE(g1,g2)\n \nDescription\n----------- \nReturns the distance between two geometries, or null if not\ngiven valid inputs.\n \nExample\n \nSELECT ST_Distance(POINT(1,2),POINT(2,2));\n+------------------------------------+\n| ST_Distance(POINT(1,2),POINT(2,2)) |\n+------------------------------------+\n| 1 |\n+------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_distance/','','https://mariadb.com/kb/en/library/st_distance/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (457,30,'ST_EQUALS','Syntax\n------ \nST_EQUALS(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether geometry g1 is spatially\nequal to geometry g2.\n \nST_EQUALS() uses object shapes, while EQUALS(), based on the\noriginal MySQL implementation, uses object bounding\nrectangles.\n \nExamples\n-------- \nSET @g1 = ST_GEOMFROMTEXT(\'LINESTRING(174 149, 176 151)\');\n \nSET @g2 = ST_GEOMFROMTEXT(\'LINESTRING(176 151, 174 149)\');\n \nSELECT ST_EQUALS(@g1,@g2);\n+--------------------+\n| ST_EQUALS(@g1,@g2) |\n+--------------------+\n| 1 |\n+--------------------+\n \nSET @g1 = ST_GEOMFROMTEXT(\'POINT(0 2)\');\n \nSET @g1 = ST_GEOMFROMTEXT(\'POINT(2 0)\');\n \nSELECT ST_EQUALS(@g1,@g2);\n+--------------------+\n| ST_EQUALS(@g1,@g2) |\n+--------------------+\n| 0 |\n+--------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st-equals/','','https://mariadb.com/kb/en/library/st-equals/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (458,30,'ST_INTERSECTS','Syntax\n------ \nST_INTERSECTS(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether geometry g1 spatially\nintersects geometry g2.\n \nST_INTERSECTS() uses object shapes, while INTERSECTS(),\nbased on the original MySQL implementation, uses object\nbounding rectangles.\n \nST_INTERSECTS() tests the opposite relationship to\nST_DISJOINT().\n \nExamples\n-------- \nSET @g1 = ST_GEOMFROMTEXT(\'POINT(0 0)\');\n \nSET @g2 = ST_GEOMFROMTEXT(\'LINESTRING(0 0, 0 2)\');\n \nSELECT ST_INTERSECTS(@g1,@g2);\n+------------------------+\n| ST_INTERSECTS(@g1,@g2) |\n+------------------------+\n| 1 |\n+------------------------+\n \nSET @g2 = ST_GEOMFROMTEXT(\'LINESTRING(2 0, 0 2)\');\n \nSELECT ST_INTERSECTS(@g1,@g2);\n+------------------------+\n| ST_INTERSECTS(@g1,@g2) |\n+------------------------+\n| 0 |\n+------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st-intersects/','','https://mariadb.com/kb/en/library/st-intersects/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (459,30,'ST_LENGTH','Syntax\n------ \nST_LENGTH(ls)\n \nDescription\n----------- \nReturns as a double-precision number the length of the\nLineString value ls in its associated spatial reference.\n \nExamples\n-------- \nSET @ls = \'LineString(1 1,2 2,3 3)\';\n \nSELECT ST_LENGTH(ST_GeomFromText(@ls));\n+---------------------------------+\n| ST_LENGTH(ST_GeomFromText(@ls)) |\n+---------------------------------+\n| 2.82842712474619 |\n+---------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_length/','','https://mariadb.com/kb/en/library/st_length/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (460,30,'ST_OVERLAPS','Syntax\n------ \nST_OVERLAPS(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether geometry g1 spatially\noverlaps geometry g2.\n \nThe term spatially overlaps is used if two geometries\nintersect and their\nintersection results in a geometry of the same dimension but\nnot equal to\neither of the given geometries.\n \nST_OVERLAPS() uses object shapes, while OVERLAPS(), based on\nthe original MySQL implementation, uses object bounding\nrectangles.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st-overlaps/','','https://mariadb.com/kb/en/library/st-overlaps/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (461,30,'ST_TOUCHES','Syntax\n------ \nST_TOUCHES(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether geometry g1 spatially\ntouches geometry g2. Two geometries spatially touch if the\ninteriors of the geometries do not intersect,\nbut the boundary of one of the geometries intersects either\nthe boundary or the\ninterior of the other.\n \nST_TOUCHES() uses object shapes, while TOUCHES(), based on\nthe original MySQL implementation, uses object bounding\nrectangles.\n \nExamples\n-------- \nSET @g1 = ST_GEOMFROMTEXT(\'POINT(2 0)\');\n \nSET @g2 = ST_GEOMFROMTEXT(\'LINESTRING(2 0, 0 2)\');\n \nSELECT ST_TOUCHES(@g1,@g2);\n+---------------------+\n| ST_TOUCHES(@g1,@g2) |\n+---------------------+\n| 1 |\n+---------------------+\n \nSET @g1 = ST_GEOMFROMTEXT(\'POINT(2 1)\');\n \nSELECT ST_TOUCHES(@g1,@g2);\n+---------------------+\n| ST_TOUCHES(@g1,@g2) |\n+---------------------+\n| 0 |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st-touches/','','https://mariadb.com/kb/en/library/st-touches/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (462,30,'ST_WITHIN','Syntax\n------ \nST_WITHIN(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether geometry g1 is spatially\nwithin geometry g2.\n \nThis tests the opposite relationship as ST_CONTAINS().\n \nST_WITHIN() uses object shapes, while WITHIN(), based on the\noriginal MySQL implementation, uses object bounding\nrectangles.\n \nExamples\n-------- \nSET @g1 = ST_GEOMFROMTEXT(\'POINT(174 149)\');\n \nSET @g2 = ST_GEOMFROMTEXT(\'POLYGON((175 150, 20 40, 50 60,\n125 100, 175 150))\');\n \nSELECT ST_WITHIN(@g1,@g2);\n+--------------------+\n| ST_WITHIN(@g1,@g2) |\n+--------------------+\n| 1 |\n+--------------------+\n \nSET @g1 = ST_GEOMFROMTEXT(\'POINT(176 151)\');\n \nSELECT ST_WITHIN(@g1,@g2);\n+--------------------+\n| ST_WITHIN(@g1,@g2) |\n+--------------------+\n| 0 |\n+--------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st-within/','','https://mariadb.com/kb/en/library/st-within/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (463,30,'TOUCHES','Syntax\n------ \nTouches(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether g1 spatially touches g2.\nTwo\ngeometries spatially touch if the interiors of the\ngeometries do not intersect,\nbut the boundary of one of the geometries intersects either\nthe boundary or the\ninterior of the other.\n \nTOUCHES() is based on the original MySQL implementation and\nuses object bounding rectangles, while ST_TOUCHES() uses\nobject shapes.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/touches/','','https://mariadb.com/kb/en/library/touches/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (464,30,'WITHIN','Syntax\n------ \nWithin(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether g1 is spatially within\ng2.\nThis tests the opposite relationship as Contains().\n \nWITHIN() is based on the original MySQL implementation, and\nuses object bounding rectangles, while ST_WITHIN() uses\nobject shapes.\n \nExamples\n-------- \nSET @g1 = GEOMFROMTEXT(\'POINT(174 149)\');\nSET @g2 = GEOMFROMTEXT(\'POINT(176 151)\');\nSET @g3 = GEOMFROMTEXT(\'POLYGON((175 150, 20 40, 50 60, 125\n100, 175 150))\');\n \nSELECT within(@g1,@g3);\n+-----------------+\n| within(@g1,@g3) |\n+-----------------+\n| 1 |\n+-----------------+\n \nSELECT within(@g2,@g3);\n+-----------------+\n| within(@g2,@g3) |\n+-----------------+\n| 0 |\n+-----------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/within/','','https://mariadb.com/kb/en/library/within/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (465,31,'ADDDATE','Syntax\n------ \nADDDATE(date,INTERVAL expr unit), ADDDATE(expr,days)\n \nDescription\n----------- \nWhen invoked with the INTERVAL form of the second argument,\nADDDATE()\nis a synonym for DATE_ADD(). The related function\nSUBDATE() is a synonym for DATE_SUB(). For\ninformation on the INTERVAL unit argument, see the\ndiscussion for\nDATE_ADD().\n \nWhen invoked with the days form of the second argument,\nMariaDB treats it as an\ninteger number of days to be added to expr.\n \nExamples\n-------- \nSELECT DATE_ADD(\'2008-01-02\', INTERVAL 31 DAY);\n+-----------------------------------------+\n| DATE_ADD(\'2008-01-02\', INTERVAL 31 DAY) |\n+-----------------------------------------+\n| 2008-02-02 |\n+-----------------------------------------+\n \nSELECT ADDDATE(\'2008-01-02\', INTERVAL 31 DAY);\n+----------------------------------------+\n| ADDDATE(\'2008-01-02\', INTERVAL 31 DAY) |\n+----------------------------------------+\n| 2008-02-02 |\n+----------------------------------------+\n \nSELECT ADDDATE(\'2008-01-02\', 31);\n+---------------------------+\n| ADDDATE(\'2008-01-02\', 31) |\n+---------------------------+\n| 2008-02-02 |\n+---------------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n (\"2007-01-30 21:31:07\"),\n (\"1983-10-15 06:42:51\"),\n (\"2011-04-21 12:34:56\"),\n (\"2011-10-30 06:31:41\"),\n (\"2011-01-30 14:03:25\"),\n (\"2004-10-07 11:19:34\");\n \nSELECT d, ADDDATE(d, 10) from t1;\n \n+---------------------+---------------------+\n| d | ADDDATE(d, 10) |\n+---------------------+---------------------+\n| 2007-01-30 21:31:07 | 2007-02-09 21:31:07 |\n| 1983-10-15 06:42:51 | 1983-10-25 06:42:51 |\n| 2011-04-21 12:34:56 | 2011-05-01 12:34:56 |\n| 2011-10-30 06:31:41 | 2011-11-09 06:31:41 |\n| 2011-01-30 14:03:25 | 2011-02-09 14:03:25 |\n| 2004-10-07 11:19:34 | 2004-10-17 11:19:34 |\n+---------------------+---------------------+\n \nSELECT d, ADDDATE(d, INTERVAL 10 HOUR) from t1;\n \n+---------------------+------------------------------+\n| d | ADDDATE(d, INTERVAL 10 HOUR) |\n+---------------------+------------------------------+\n| 2007-01-30 21:31:07 | 2007-01-31 07:31:07 |\n| 1983-10-15 06:42:51 | 1983-10-15 16:42:51 |\n| 2011-04-21 12:34:56 | 2011-04-21 22:34:56 |\n| 2011-10-30 06:31:41 | 2011-10-30 16:31:41 |\n| 2011-01-30 14:03:25 | 2011-01-31 00:03:25 |\n| 2004-10-07 11:19:34 | 2004-10-07 21:19:34 |\n+---------------------+------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/adddate/','','https://mariadb.com/kb/en/library/adddate/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (466,31,'ADDTIME','Syntax\n------ \nADDTIME(expr1,expr2)\n \nDescription\n----------- \nADDTIME() adds expr2 to expr1 and returns the result. expr1\nis a time\nor datetime expression, and expr2 is a time expression.\n \nExamples\n-------- \nSELECT ADDTIME(\'2007-12-31 23:59:59.999999\', \'1\n1:1:1.000002\');\n+---------------------------------------------------------+\n| ADDTIME(\'2007-12-31 23:59:59.999999\', \'1\n1:1:1.000002\') |\n+---------------------------------------------------------+\n| 2008-01-02 01:01:01.000001 |\n+---------------------------------------------------------+\n \nSELECT ADDTIME(\'01:00:00.999999\', \'02:00:00.999998\');\n+-----------------------------------------------+\n| ADDTIME(\'01:00:00.999999\', \'02:00:00.999998\') |\n+-----------------------------------------------+\n| 03:00:01.999997 |\n+-----------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/addtime/','','https://mariadb.com/kb/en/library/addtime/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (467,31,'CONVERT_TZ','Syntax\n------ \nCONVERT_TZ(dt,from_tz,to_tz)\n \nDescription\n----------- \nCONVERT_TZ() converts a datetime value dt from the time zone\ngiven by from_tz to the time zone given by to_tz and returns\nthe resulting value.\n \nIn order to use named time zones, such as GMT, MET or\nAfrica/Johannesburg, the time_zone tables must be loaded\n(see mysql_tzinfo_to_sql).\n \nNo conversion will take place if the value falls outside of\nthe supported TIMESTAMP range (\'1970-01-01 00:00:01\' to\n\'2038-01-19 05:14:07\' UTC) when converted from from_tz to\nUTC.\n \nThis function returns NULL if the arguments are invalid (or\nnamed time zones have not been loaded).\n \nSee time zones for more information.\n \nExamples\n-------- \nSELECT CONVERT_TZ(\'2016-01-01\n12:00:00\',\'+00:00\',\'+10:00\');\n+-----------------------------------------------------+\n| CONVERT_TZ(\'2016-01-01 12:00:00\',\'+00:00\',\'+10:00\')\n|\n+-----------------------------------------------------+\n| 2016-01-01 22:00:00 |\n+-----------------------------------------------------+\n \nUsing named time zones (with the time zone tables loaded):\n \nSELECT CONVERT_TZ(\'2016-01-01\n12:00:00\',\'GMT\',\'Africa/Johannesburg\');\n+---------------------------------------------------------------+\n| CONVERT_TZ(\'2016-01-01\n12:00:00\',\'GMT\',\'Africa/Johannesburg\') |\n+---------------------------------------------------------------+\n| 2016-01-01 14:00:00 |\n+---------------------------------------------------------------+\n \nThe value is out of the TIMESTAMP range, so no conversion\ntakes place:\n \nSELECT CONVERT_TZ(\'1969-12-31\n22:00:00\',\'+00:00\',\'+10:00\');\n+-----------------------------------------------------+\n| CONVERT_TZ(\'1969-12-31 22:00:00\',\'+00:00\',\'+10:00\')\n|\n+-----------------------------------------------------+\n| 1969-12-31 22:00:00 |\n+-----------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/convert_tz/','','https://mariadb.com/kb/en/library/convert_tz/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (468,31,'CURDATE','Syntax\n------ \nCURDATE()\n \nDescription\n----------- \nReturns the current date as a value in \'YYYY-MM-DD\' or\nYYYYMMDD\nformat, depending on whether the function is used in a\nstring or\nnumeric context.\n \nExamples\n-------- \nSELECT CURDATE();\n+------------+\n| CURDATE() |\n+------------+\n| 2019-03-05 |\n+------------+\n \nIn a numeric context (note this is not performing date\ncalculations):\n \nSELECT CURDATE() +0;\n \n+--------------+\n| CURDATE() +0 |\n+--------------+\n| 20190305 |\n+--------------+\n \nData calculation:\n \nSELECT CURDATE() - INTERVAL 5 DAY;\n \n+----------------------------+\n| CURDATE() - INTERVAL 5 DAY |\n+----------------------------+\n| 2019-02-28 |\n+----------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/curdate/','','https://mariadb.com/kb/en/library/curdate/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (469,31,'CURRENT_DATE','Syntax\n------ \nCURRENT_DATE, CURRENT_DATE()\n \nDescription\n----------- \nCURRENT_DATE and CURRENT_DATE() are synonyms for CURDATE().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/current_date/','','https://mariadb.com/kb/en/library/current_date/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (470,31,'CURRENT_TIME','Syntax\n------ \nCURRENT_TIME\nCURRENT_TIME([precision])\n \nDescription\n----------- \nCURRENT_TIME and CURRENT_TIME() are synonyms for CURTIME().\n \n\n\nURL: https://mariadb.com/kb/en/library/current_time/','','https://mariadb.com/kb/en/library/current_time/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (471,31,'CURRENT_TIMESTAMP','Syntax\n------ \nCURRENT_TIMESTAMP\nCURRENT_TIMESTAMP([precision])\n \nDescription\n----------- \nCURRENT_TIMESTAMP and CURRENT_TIMESTAMP() are synonyms for\nNOW().\n \n\n\nURL: https://mariadb.com/kb/en/library/current_timestamp/','','https://mariadb.com/kb/en/library/current_timestamp/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (472,31,'CURTIME','Syntax\n------ \nCURTIME([precision])\n \nDescription\n----------- \nReturns the current time as a value in \'HH:MM:SS\' or\nHHMMSS.uuuuuu format, depending on whether the function is\nused in a string or numeric context. The value is expressed\nin the current time zone.\n \nThe optional precision determines the microsecond precision.\nSee Microseconds in MariaDB.\n \nExamples\n-------- \nSELECT CURTIME();\n+-----------+\n| CURTIME() |\n+-----------+\n| 12:45:39 |\n+-----------+\n \nSELECT CURTIME() + 0;\n \n+---------------+\n| CURTIME() + 0 |\n+---------------+\n| 124545.000000 |\n+---------------+\n \nWith precision:\n \nSELECT CURTIME(2);\n+-------------+\n| CURTIME(2) |\n+-------------+\n| 09:49:08.09 |\n+-------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/curtime/','','https://mariadb.com/kb/en/library/curtime/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (473,31,'DATE FUNCTION','Syntax\n------ \nDATE(expr)\n \nDescription\n----------- \nExtracts the date part of the date or datetime expression\nexpr.\n \nExamples\n-------- \nSELECT DATE(\'2013-07-18 12:21:32\');\n+-----------------------------+\n| DATE(\'2013-07-18 12:21:32\') |\n+-----------------------------+\n| 2013-07-18 |\n+-----------------------------+\n \nError Handling\n \nUntil MariaDB 5.5.32, some versions of MariaDB returned\n0000-00-00 when passed an invalid date. From 5.5.32, NULL is\nreturned.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/date-function/','','https://mariadb.com/kb/en/library/date-function/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (474,31,'DATEDIFF','Syntax\n------ \nDATEDIFF(expr1,expr2)\n \nDescription\n----------- \nDATEDIFF() returns (expr1 – expr2) expressed\nas a value in days from one date to the other. expr1 and\nexpr2 are date\nor date-and-time expressions. Only the date parts of the\nvalues are used in the\ncalculation.\n \nExamples\n-------- \nSELECT DATEDIFF(\'2007-12-31 23:59:59\',\'2007-12-30\');\n+----------------------------------------------+\n| DATEDIFF(\'2007-12-31 23:59:59\',\'2007-12-30\') |\n+----------------------------------------------+\n| 1 |\n+----------------------------------------------+\n \nSELECT DATEDIFF(\'2010-11-30 23:59:59\',\'2010-12-31\');\n+----------------------------------------------+\n| DATEDIFF(\'2010-11-30 23:59:59\',\'2010-12-31\') |\n+----------------------------------------------+\n| -31 |\n+----------------------------------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n (\"2007-01-30 21:31:07\"),\n (\"1983-10-15 06:42:51\"),\n (\"2011-04-21 12:34:56\"),\n (\"2011-10-30 06:31:41\"),\n (\"2011-01-30 14:03:25\"),\n (\"2004-10-07 11:19:34\");\n \nSELECT NOW();\n+---------------------+\n| NOW() |\n+---------------------+\n| 2011-05-23 10:56:05 |\n+---------------------+\n \nSELECT d, DATEDIFF(NOW(),d) FROM t1;\n \n+---------------------+-------------------+\n| d | DATEDIFF(NOW(),d) |\n+---------------------+-------------------+\n| 2007-01-30 21:31:07 | 1574 |\n| 1983-10-15 06:42:51 | 10082 |\n| 2011-04-21 12:34:56 | 32 |\n| 2011-10-30 06:31:41 | -160 |\n| 2011-01-30 14:03:25 | 113 |\n| 2004-10-07 11:19:34 | 2419 |\n+---------------------+-------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/datediff/','','https://mariadb.com/kb/en/library/datediff/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (475,31,'DATE_ADD','Syntax\n------ \nDATE_ADD(date,INTERVAL expr unit)\n \nDescription\n----------- \nPerforms date arithmetic. The date argument specifies the\nstarting date or datetime value. expr is an expression\nspecifying the\ninterval value to be added or subtracted from the starting\ndate. expr is a\nstring; it may start with a \"-\" for negative intervals.\nunit is a\nkeyword indicating the units in which the expression should\nbe interpreted. See Date and Time Units for a complete list\nof permitted units. \n \nSee also DATE_SUB().\n \nExamples\n-------- \nSELECT \'2008-12-31 23:59:59\' + INTERVAL 1 SECOND;\n \n+-------------------------------------------+\n| \'2008-12-31 23:59:59\' + INTERVAL 1 SECOND |\n+-------------------------------------------+\n| 2009-01-01 00:00:00 |\n+-------------------------------------------+\n \nSELECT INTERVAL 1 DAY + \'2008-12-31\';\n \n+-------------------------------+\n| INTERVAL 1 DAY + \'2008-12-31\' |\n+-------------------------------+\n| 2009-01-01 |\n+-------------------------------+\n \nSELECT \'2005-01-01\' - INTERVAL 1 SECOND;\n \n+----------------------------------+\n| \'2005-01-01\' - INTERVAL 1 SECOND |\n+----------------------------------+\n| 2004-12-31 23:59:59 |\n+----------------------------------+\n \nSELECT DATE_ADD(\'2000-12-31 23:59:59\', INTERVAL 1 SECOND);\n+----------------------------------------------------+\n| DATE_ADD(\'2000-12-31 23:59:59\', INTERVAL 1 SECOND) |\n+----------------------------------------------------+\n| 2001-01-01 00:00:00 |\n+----------------------------------------------------+\n \nSELECT DATE_ADD(\'2010-12-31 23:59:59\', INTERVAL 1 DAY);\n+-------------------------------------------------+\n| DATE_ADD(\'2010-12-31 23:59:59\', INTERVAL 1 DAY) |\n+-------------------------------------------------+\n| 2011-01-01 23:59:59 |\n+-------------------------------------------------+\n \nSELECT DATE_ADD(\'2100-12-31 23:59:59\', INTERVAL \'1:1\'\nMINUTE_SECOND);\n+---------------------------------------------------------------+\n| DATE_ADD(\'2100-12-31 23:59:59\', INTERVAL \'1:1\'\nMINUTE_SECOND) |\n+---------------------------------------------------------------+\n| 2101-01-01 00:01:00 |\n+---------------------------------------------------------------+\n \nSELECT DATE_ADD(\'1900-01-01 00:00:00\', INTERVAL \'-1 10\'\nDAY_HOUR);\n+------------------------------------------------------------+\n| DATE_ADD(\'1900-01-01 00:00:00\', INTERVAL \'-1 10\'\nDAY_HOUR) |\n+------------------------------------------------------------+\n| 1899-12-30 14:00:00 |\n+------------------------------------------------------------+\n \nSELECT DATE_ADD(\'1992-12-31 23:59:59.000002\', INTERVAL\n\'1.999999\' SECOND_MICROSECOND);\n+--------------------------------------------------------------------------------+\n| DATE_ADD(\'1992-12-31 23:59:59.000002\', INTERVAL\n\'1.999999\' SECOND_MICROSECOND) |\n+--------------------------------------------------------------------------------+\n| 1993-01-01 00:00:01.000001 |\n+--------------------------------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/date_add/','','https://mariadb.com/kb/en/library/date_add/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (476,31,'DATE_FORMAT','Syntax\n------ \nDATE_FORMAT(date, format[, locale])\n \nDescription\n----------- \nFormats the date value according to the format string. \n \nThe language used for the names is controlled by the value\nof the lc_time_names system variable. See server locale for\nmore on the supported locales.\n \nThe options that can be used by DATE_FORMAT(), as well as\nits inverse STR_TO_DATE() and the FROM_UNIXTIME() function,\nare:\n \nOption | Description | \n \n%a | Short weekday name in current locale (Variable\nlc_time_names). | \n \n%b | Short form month name in current locale. For locale\nen_US this is one of:\nJan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov or Dec. | \n \n%c | Month with 1 or 2 digits. | \n \n%D | Day with English suffix \'th\', \'nd\', \'st\' or\n\'rd\'\'. (1st, 2nd, 3rd...). | \n \n%d | Day with 2 digits. | \n \n%e | Day with 1 or 2 digits. | \n \n%f | Sub seconds 6 digits. | \n \n%H | Hour with 2 digits between 00-23. | \n \n%h | Hour with 2 digits between 01-12. | \n \n%I | Hour with 2 digits between 01-12. | \n \n%i | Minute with 2 digits. | \n \n%j | Day of the year (001-366) | \n \n%k | Hour with 1 digits between 0-23. | \n \n%l | Hour with 1 digits between 1-12. | \n \n%M | Full month name in current locale (Variable\nlc_time_names). | \n \n%m | Month with 2 digits. | \n \n%p | AM/PM according to current locale (Variable\nlc_time_names). | \n \n%r | Time in 12 hour format, followed by AM/PM. Short for\n\'%I:%i:%S %p\'. | \n \n%S | Seconds with 2 digits. | \n \n%s | Seconds with 2 digits. | \n \n%T | Time in 24 hour format. Short for \'%H:%i:%S\'. | \n \n%U | Week number (00-53), when first day of the week is\nSunday. | \n \n%u | Week number (00-53), when first day of the week is\nMonday. | \n \n%V | Week number (01-53), when first day of the week is\nSunday. Used with %X. | \n \n%v | Week number (01-53), when first day of the week is\nMonday. Used with %x. | \n \n%W | Full weekday name in current locale (Variable\nlc_time_names). | \n \n%w | Day of the week. 0 = Sunday, 6 = Saturday. | \n \n%X | Year with 4 digits when first day of the week is\nSunday. Used with %V. | \n \n%x | Year with 4 digits when first day of the week is\nMonday. Used with %v. | \n \n%Y | Year with 4 digits. | \n \n%y | Year with 2 digits. | \n \n%# | For str_to_date(), skip all numbers. | \n \n%. | For str_to_date(), skip all punctation characters. | \n \n%@ | For str_to_date(), skip all alpha characters. | \n \n%% | A literal % character. | \n \nTo get a date in one of the standard formats, GET_FORMAT()\ncan be used.\n \nExamples\n-------- \nSELECT DATE_FORMAT(\'2009-10-04 22:23:00\', \'%W %M %Y\');\n+------------------------------------------------+\n| DATE_FORMAT(\'2009-10-04 22:23:00\', \'%W %M %Y\') |\n+------------------------------------------------+\n| Sunday October 2009 |\n+------------------------------------------------+\n \nSELECT DATE_FORMAT(\'2007-10-04 22:23:00\', \'%H:%i:%s\');\n+------------------------------------------------+\n| DATE_FORMAT(\'2007-10-04 22:23:00\', \'%H:%i:%s\') |\n+------------------------------------------------+\n| 22:23:00 |\n+------------------------------------------------+\n \nSELECT DATE_FORMAT(\'1900-10-04 22:23:00\', \'%D %y %a %d %m\n%b %j\');\n+------------------------------------------------------------+\n| DATE_FORMAT(\'1900-10-04 22:23:00\', \'%D %y %a %d %m %b\n%j\') |\n+------------------------------------------------------------+\n| 4th 00 Thu 04 10 Oct 277 |\n+------------------------------------------------------------+\n \nSELECT DATE_FORMAT(\'1997-10-04 22:23:00\', \'%H %k %I %r %T\n%S %w\');\n+------------------------------------------------------------+\n| DATE_FORMAT(\'1997-10-04 22:23:00\', \'%H %k %I %r %T %S\n%w\') |\n+------------------------------------------------------------+\n| 22 22 10 10:23:00 PM 22:23:00 00 6 |\n+------------------------------------------------------------+\n \nSELECT DATE_FORMAT(\'1999-01-01\', \'%X %V\');\n+------------------------------------+\n| DATE_FORMAT(\'1999-01-01\', \'%X %V\') |\n+------------------------------------+\n| 1998 52 |\n+------------------------------------+\n \nSELECT DATE_FORMAT(\'2006-06-00\', \'%d\');\n+---------------------------------+\n| DATE_FORMAT(\'2006-06-00\', \'%d\') |\n+---------------------------------+\n| 00 |\n+---------------------------------+\n \nOptionally, the locale can be explicitly specified as the\nthird DATE_FORMAT() argument. Doing so makes the function\nindependent from the session settings, and the three\nargument version of DATE_FORMAT() can be used in virtual\nindexed and persistent generated-columns:\n \nSELECT DATE_FORMAT(\'2006-01-01\', \'%W\', \'el_GR\');\n+------------------------------------------+\n| DATE_FORMAT(\'2006-01-01\', \'%W\', \'el_GR\') |\n+------------------------------------------+\n| ΚυÏιακή |\n+------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/date_format/','','https://mariadb.com/kb/en/library/date_format/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (477,31,'DATE_SUB','Syntax\n------ \nDATE_SUB(date,INTERVAL expr unit)\n \nDescription\n----------- \nPerforms date arithmetic. The date argument specifies the\nstarting date or datetime value. expr is an expression\nspecifying the\ninterval value to be added or subtracted from the starting\ndate. expr is a\nstring; it may start with a \"-\" for negative intervals.\nunit is a\nkeyword indicating the units in which the expression should\nbe interpreted. See Date and Time Units for a complete list\nof permitted units. \n \nSee also DATE_ADD().\n \nExamples\n-------- \nSELECT DATE_SUB(\'1998-01-02\', INTERVAL 31 DAY);\n+-----------------------------------------+\n| DATE_SUB(\'1998-01-02\', INTERVAL 31 DAY) |\n+-----------------------------------------+\n| 1997-12-02 |\n+-----------------------------------------+\n \nSELECT DATE_SUB(\'2005-01-01 00:00:00\', INTERVAL \'1\n1:1:1\' DAY_SECOND);\n+----------------------------------------------------------------+\n| DATE_SUB(\'2005-01-01 00:00:00\', INTERVAL \'1 1:1:1\'\nDAY_SECOND) |\n+----------------------------------------------------------------+\n| 2004-12-30 22:58:59 |\n+----------------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/date_sub/','','https://mariadb.com/kb/en/library/date_sub/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (478,31,'DAY','Syntax\n------ \nDAY(date)\n \nDescription\n----------- \nDAY() is a synonym for DAYOFMONTH().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/day/','','https://mariadb.com/kb/en/library/day/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (479,31,'DAYNAME','Syntax\n------ \nDAYNAME(date)\n \nDescription\n----------- \nReturns the name of the weekday for date. The language used\nfor the name is controlled by the value\nof the lc_time_names system variable. See server locale for\nmore on the supported locales.\n \nExamples\n-------- \nSELECT DAYNAME(\'2007-02-03\');\n+-----------------------+\n| DAYNAME(\'2007-02-03\') |\n+-----------------------+\n| Saturday |\n+-----------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n (\"2007-01-30 21:31:07\"),\n (\"1983-10-15 06:42:51\"),\n (\"2011-04-21 12:34:56\"),\n (\"2011-10-30 06:31:41\"),\n (\"2011-01-30 14:03:25\"),\n (\"2004-10-07 11:19:34\");\n \nSELECT d, DAYNAME(d) FROM t1;\n \n+---------------------+------------+\n| d | DAYNAME(d) |\n+---------------------+------------+\n| 2007-01-30 21:31:07 | Tuesday |\n| 1983-10-15 06:42:51 | Saturday |\n| 2011-04-21 12:34:56 | Thursday |\n| 2011-10-30 06:31:41 | Sunday |\n| 2011-01-30 14:03:25 | Sunday |\n| 2004-10-07 11:19:34 | Thursday |\n+---------------------+------------+\n \nChanging the locale:\n \nSET lc_time_names = \'fr_CA\';\n \nSELECT DAYNAME(\'2013-04-01\');\n+-----------------------+\n| DAYNAME(\'2013-04-01\') |\n+-----------------------+\n| lundi |\n+-----------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/dayname/','','https://mariadb.com/kb/en/library/dayname/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (480,31,'DAYOFMONTH','Syntax\n------ \nDAYOFMONTH(date)\n \nDescription\n----------- \nReturns the day of the month for date, in the range 1 to 31,\nor 0\nfor dates such as \'0000-00-00\' or \'2008-00-00\' which\nhave a zero day\npart.\n \nDAY() is a synonym.\n \nExamples\n-------- \nSELECT DAYOFMONTH(\'2007-02-03\');\n+--------------------------+\n| DAYOFMONTH(\'2007-02-03\') |\n+--------------------------+\n| 3 |\n+--------------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n (\"2007-01-30 21:31:07\"),\n (\"1983-10-15 06:42:51\"),\n (\"2011-04-21 12:34:56\"),\n (\"2011-10-30 06:31:41\"),\n (\"2011-01-30 14:03:25\"),\n (\"2004-10-07 11:19:34\");\n \nSELECT d FROM t1 where DAYOFMONTH(d) = 30;\n \n+---------------------+\n| d |\n+---------------------+\n| 2007-01-30 21:31:07 |\n| 2011-10-30 06:31:41 |\n| 2011-01-30 14:03:25 |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/dayofmonth/','','https://mariadb.com/kb/en/library/dayofmonth/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (481,31,'DAYOFWEEK','Syntax\n------ \nDAYOFWEEK(date)\n \nDescription\n----------- \nReturns the day of the week index for the date (1 = Sunday,\n2 = Monday, ..., 7 =\nSaturday). These index values correspond to the ODBC\nstandard.\n \nThis contrasts with WEEKDAY() which follows a different\nindex numbering\n(0 = Monday, 1 = Tuesday, ... 6 = Sunday).\n \nExamples\n-------- \nSELECT DAYOFWEEK(\'2007-02-03\');\n+-------------------------+\n| DAYOFWEEK(\'2007-02-03\') |\n+-------------------------+\n| 7 |\n+-------------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n (\"2007-01-30 21:31:07\"),\n (\"1983-10-15 06:42:51\"),\n (\"2011-04-21 12:34:56\"),\n (\"2011-10-30 06:31:41\"),\n (\"2011-01-30 14:03:25\"),\n (\"2004-10-07 11:19:34\");\n \nSELECT d, DAYNAME(d), DAYOFWEEK(d), WEEKDAY(d) from t1;\n \n+---------------------+------------+--------------+------------+\n| d | DAYNAME(d) | DAYOFWEEK(d) | WEEKDAY(d) |\n+---------------------+------------+--------------+------------+\n| 2007-01-30 21:31:07 | Tuesday | 3 | 1 |\n| 1983-10-15 06:42:51 | Saturday | 7 | 5 |\n| 2011-04-21 12:34:56 | Thursday | 5 | 3 |\n| 2011-10-30 06:31:41 | Sunday | 1 | 6 |\n| 2011-01-30 14:03:25 | Sunday | 1 | 6 |\n| 2004-10-07 11:19:34 | Thursday | 5 | 3 |\n+---------------------+------------+--------------+------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/dayofweek/','','https://mariadb.com/kb/en/library/dayofweek/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (482,31,'DAYOFYEAR','Syntax\n------ \nDAYOFYEAR(date)\n \nDescription\n----------- \nReturns the day of the year for date, in the range 1 to 366.\n \nExamples\n-------- \nSELECT DAYOFYEAR(\'2018-02-16\');\n+-------------------------+\n| DAYOFYEAR(\'2018-02-16\') |\n+-------------------------+\n| 47 |\n+-------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/dayofyear/','','https://mariadb.com/kb/en/library/dayofyear/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (483,31,'EXTRACT','Syntax\n------ \nEXTRACT(unit FROM date)\n \nDescription\n----------- \nThe EXTRACT() function extracts the required unit from the\ndate. See Date and Time Units for a complete list of\npermitted units.\n \nIn MariaDB 10.0.7 and MariaDB 5.5.35, EXTRACT (HOUR FROM\n...) was changed to return a value from 0 to 23, adhering to\nthe SQL standard. Until MariaDB 10.0.6 and MariaDB 5.5.34,\nand in all versions of MySQL at least as of MySQL 5.7, it\ncould return a value > 23. HOUR() is not a standard\nfunction, so continues to adhere to the old behaviour\ninherited from MySQL.\n \nExamples\n-------- \nSELECT EXTRACT(YEAR FROM \'2009-07-02\');\n+---------------------------------+\n| EXTRACT(YEAR FROM \'2009-07-02\') |\n+---------------------------------+\n| 2009 |\n+---------------------------------+\n \nSELECT EXTRACT(YEAR_MONTH FROM \'2009-07-02 01:02:03\');\n+------------------------------------------------+\n| EXTRACT(YEAR_MONTH FROM \'2009-07-02 01:02:03\') |\n+------------------------------------------------+\n| 200907 |\n+------------------------------------------------+\n \nSELECT EXTRACT(DAY_MINUTE FROM \'2009-07-02 01:02:03\');\n+------------------------------------------------+\n| EXTRACT(DAY_MINUTE FROM \'2009-07-02 01:02:03\') |\n+------------------------------------------------+\n| 20102 |\n+------------------------------------------------+\n \nSELECT EXTRACT(MICROSECOND FROM \'2003-01-02\n10:30:00.000123\');\n+--------------------------------------------------------+\n| EXTRACT(MICROSECOND FROM \'2003-01-02 10:30:00.000123\') |\n+--------------------------------------------------------+\n| 123 |\n+--------------------------------------------------------+\n \nFrom MariaDB 10.0.7 and MariaDB 5.5.35, EXTRACT (HOUR\nFROM...) returns a value from 0 to 23, as per the SQL\nstandard. HOUR is not a standard function, so continues to\nadhere to the old behaviour inherited from MySQL.\n \nSELECT EXTRACT(HOUR FROM \'26:30:00\'), HOUR(\'26:30:00\');\n+-------------------------------+------------------+\n| EXTRACT(HOUR FROM \'26:30:00\') | HOUR(\'26:30:00\') |\n+-------------------------------+------------------+\n| 2 | 26 |\n+-------------------------------+------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/extract/','','https://mariadb.com/kb/en/library/extract/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (484,31,'FROM_DAYS','Syntax\n------ \nFROM_DAYS(N)\n \nDescription\n----------- \nGiven a day number N, returns a DATE value. The day count is\nbased on the number of days from the start of the standard\ncalendar (0000-00-00). \n \nThe function is not designed for use with dates before the\nadvent of the Gregorian calendar in October 1582. Results\nwill not be reliable since it doesn\'t account for the lost\ndays when the calendar changed from the Julian calendar.\n \nThis is the converse of the TO_DAYS() function.\n \nExamples\n-------- \nSELECT FROM_DAYS(730669);\n+-------------------+\n| FROM_DAYS(730669) |\n+-------------------+\n| 2000-07-03 |\n+-------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/from_days/','','https://mariadb.com/kb/en/library/from_days/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (485,31,'FROM_UNIXTIME','Syntax\n------ \nFROM_UNIXTIME(unix_timestamp),\nFROM_UNIXTIME(unix_timestamp,format)\n \nDescription\n----------- \nReturns a representation of the unix_timestamp argument as a\nvalue in\n\'YYYY-MM-DD HH:MM:SS\' or YYYYMMDDHHMMSS.uuuuuu format,\ndepending on\nwhether the function is used in a string or numeric context.\nThe value\nis expressed in the current time zone. unix_timestamp is an\ninternal\ntimestamp value such as is produced by the UNIX_TIMESTAMP()\nfunction.\n \nIf format is given, the result is formatted according to the\nformat\nstring, which is used the same way as listed in the entry\nfor the\nDATE_FORMAT() function.\n \nTimestamps in MariaDB have a maximum value of 2147483647,\nequivalent to 2038-01-19 05:14:07. This is due to the\nunderlying 32-bit limitation. Using the function on a\ntimestamp beyond this will result in NULL being returned.\nUse DATETIME as a storage type if you require dates beyond\nthis.\n \nThe options that can be used by FROM_UNIXTIME(), as well as\nDATE_FORMAT() and STR_TO_DATE(), are:\n \nOption | Description | \n \n%a | Short weekday name in current locale (Variable\nlc_time_names). | \n \n%b | Short form month name in current locale. For locale\nen_US this is one of:\nJan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov or Dec. | \n \n%c | Month with 1 or 2 digits. | \n \n%D | Day with English suffix \'th\', \'nd\', \'st\' or\n\'rd\'\'. (1st, 2nd, 3rd...). | \n \n%d | Day with 2 digits. | \n \n%e | Day with 1 or 2 digits. | \n \n%f | Sub seconds 6 digits. | \n \n%H | Hour with 2 digits between 00-23. | \n \n%h | Hour with 2 digits between 01-12. | \n \n%I | Hour with 2 digits between 01-12. | \n \n%i | Minute with 2 digits. | \n \n%j | Day of the year (001-366) | \n \n%k | Hour with 1 digits between 0-23. | \n \n%l | Hour with 1 digits between 1-12. | \n \n%M | Full month name in current locale (Variable\nlc_time_names). | \n \n%m | Month with 2 digits. | \n \n%p | AM/PM according to current locale (Variable\nlc_time_names). | \n \n%r | Time in 12 hour format, followed by AM/PM. Short for\n\'%I:%i:%S %p\'. | \n \n%S | Seconds with 2 digits. | \n \n%s | Seconds with 2 digits. | \n \n%T | Time in 24 hour format. Short for \'%H:%i:%S\'. | \n \n%U | Week number (00-53), when first day of the week is\nSunday. | \n \n%u | Week number (00-53), when first day of the week is\nMonday. | \n \n%V | Week number (01-53), when first day of the week is\nSunday. Used with %X. | \n \n%v | Week number (01-53), when first day of the week is\nMonday. Used with %x. | \n \n%W | Full weekday name in current locale (Variable\nlc_time_names). | \n \n%w | Day of the week. 0 = Sunday, 1 = Saturday. | \n \n%X | Year with 4 digits when first day of the week is\nSunday. Used with %V. | \n \n%x | Year with 4 digits when first day of the week is\nSunday. Used with %v. | \n \n%Y | Year with 4 digits. | \n \n%y | Year with 2 digits. | \n \n%# | For str_to_date(), skip all numbers. | \n \n%. | For str_to_date(), skip all punctation characters. | \n \n%@ | For str_to_date(), skip all alpha characters. | \n \n%% | A literal % character. | \n \nPerformance Considerations\n \nIf your session time zone is set to SYSTEM (the default),\nFROM_UNIXTIME() will call the OS function to convert the\ndata using the system time zone. At least on Linux, the\ncorresponding function (localtime_r) uses a global mutex\ninside glibc that can cause contention under high concurrent\nload.\n \nSet your time zone to a named time zone to avoid this issue.\nSee mysql time zone tables for details on how to do this.\n \nExamples\n-------- \nSELECT FROM_UNIXTIME(1196440219);\n+---------------------------+\n| FROM_UNIXTIME(1196440219) |\n+---------------------------+\n| 2007-11-30 11:30:19 |\n+---------------------------+\n \nSELECT FROM_UNIXTIME(1196440219) + 0;\n \n+-------------------------------+\n| FROM_UNIXTIME(1196440219) + 0 |\n+-------------------------------+\n| 20071130113019.000000 |\n+-------------------------------+\n \nSELECT FROM_UNIXTIME(UNIX_TIMESTAMP(), \'%Y %D %M %h:%i:%s\n%x\');\n+---------------------------------------------------------+\n| FROM_UNIXTIME(UNIX_TIMESTAMP(), \'%Y %D %M %h:%i:%s %x\')\n|\n+---------------------------------------------------------+\n| 2010 27th March 01:03:47 2010 |\n+---------------------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/from_unixtime/','','https://mariadb.com/kb/en/library/from_unixtime/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (486,31,'GET_FORMAT','Syntax\n------ \nGET_FORMAT({DATE|DATETIME|TIME},\n{\'EUR\'|\'USA\'|\'JIS\'|\'ISO\'|\'INTERNAL\'})\n \nDescription\n----------- \nReturns a format string. This function is useful in\ncombination with\nthe DATE_FORMAT() and the STR_TO_DATE() functions.\n \nPossible result formats are:\n \nFunction Call | Result Format | \n \nGET_FORMAT(DATE,\'EUR\') | \'%d.%m.%Y\' | \n \nGET_FORMAT(DATE,\'USA\') | \'%m.%d.%Y\' | \n \nGET_FORMAT(DATE,\'JIS\') | \'%Y-%m-%d\' | \n \nGET_FORMAT(DATE,\'ISO\') | \'%Y-%m-%d\' | \n \nGET_FORMAT(DATE,\'INTERNAL\') | \'%Y%m%d\' | \n \nGET_FORMAT(DATETIME,\'EUR\') | \'%Y-%m-%d %H.%i.%s\' | \n \nGET_FORMAT(DATETIME,\'USA\') | \'%Y-%m-%d %H.%i.%s\' | \n \nGET_FORMAT(DATETIME,\'JIS\') | \'%Y-%m-%d %H:%i:%s\' | \n \nGET_FORMAT(DATETIME,\'ISO\') | \'%Y-%m-%d %H:%i:%s\' | \n \nGET_FORMAT(DATETIME,\'INTERNAL\') | \'%Y%m%d%H%i%s\' | \n \nGET_FORMAT(TIME,\'EUR\') | \'%H.%i.%s\' | \n \nGET_FORMAT(TIME,\'USA\') | \'%h:%i:%s %p\' | \n \nGET_FORMAT(TIME,\'JIS\') | \'%H:%i:%s\' | \n \nGET_FORMAT(TIME,\'ISO\') | \'%H:%i:%s\' | \n \nGET_FORMAT(TIME,\'INTERNAL\') | \'%H%i%s\' | \n \nExamples\n-------- \nObtaining the string matching to the standard European date\nformat:\n \nSELECT GET_FORMAT(DATE, \'EUR\');\n+-------------------------+\n| GET_FORMAT(DATE, \'EUR\') |\n+-------------------------+\n| %d.%m.%Y |\n+-------------------------+\n \nUsing the same string to format a date:\n \nSELECT DATE_FORMAT(\'2003-10-03\',GET_FORMAT(DATE,\'EUR\'));\n+--------------------------------------------------+\n| DATE_FORMAT(\'2003-10-03\',GET_FORMAT(DATE,\'EUR\')) |\n+--------------------------------------------------+\n| 03.10.2003 |\n+--------------------------------------------------+\n \nSELECT STR_TO_DATE(\'10.31.2003\',GET_FORMAT(DATE,\'USA\'));\n+--------------------------------------------------+\n| STR_TO_DATE(\'10.31.2003\',GET_FORMAT(DATE,\'USA\')) |\n+--------------------------------------------------+\n| 2003-10-31 |\n+--------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/get_format/','','https://mariadb.com/kb/en/library/get_format/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (487,31,'HOUR','Syntax\n------ \nHOUR(time)\n \nDescription\n----------- \nReturns the hour for time. The range of the return value is\n0 to 23\nfor time-of-day values. However, the range of TIME values\nactually is\nmuch larger, so HOUR can return values greater than 23.\n \nThe return value is always positive, even if a negative TIME\nvalue is provided.\n \nExamples\n-------- \nSELECT HOUR(\'10:05:03\');\n+------------------+\n| HOUR(\'10:05:03\') |\n+------------------+\n| 10 |\n+------------------+\n \nSELECT HOUR(\'272:59:59\');\n+-------------------+\n| HOUR(\'272:59:59\') |\n+-------------------+\n| 272 |\n+-------------------+\n \nDifference between EXTRACT (HOUR FROM ...) (>= MariaDB\n10.0.7 and MariaDB 5.5.35) and HOUR:\n \nSELECT EXTRACT(HOUR FROM \'26:30:00\'), HOUR(\'26:30:00\');\n+-------------------------------+------------------+\n| EXTRACT(HOUR FROM \'26:30:00\') | HOUR(\'26:30:00\') |\n+-------------------------------+------------------+\n| 2 | 26 |\n+-------------------------------+------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/hour/','','https://mariadb.com/kb/en/library/hour/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (488,31,'LAST_DAY','Syntax\n------ \nLAST_DAY(date)\n \nDescription\n----------- \nTakes a date or datetime value and returns the corresponding\nvalue for\nthe last day of the month. Returns NULL if the argument is\ninvalid.\n \nExamples\n-------- \nSELECT LAST_DAY(\'2003-02-05\');\n+------------------------+\n| LAST_DAY(\'2003-02-05\') |\n+------------------------+\n| 2003-02-28 |\n+------------------------+\n \nSELECT LAST_DAY(\'2004-02-05\');\n+------------------------+\n| LAST_DAY(\'2004-02-05\') |\n+------------------------+\n| 2004-02-29 |\n+------------------------+\n \nSELECT LAST_DAY(\'2004-01-01 01:01:01\');\n+---------------------------------+\n| LAST_DAY(\'2004-01-01 01:01:01\') |\n+---------------------------------+\n| 2004-01-31 |\n+---------------------------------+\n \nSELECT LAST_DAY(\'2003-03-32\');\n+------------------------+\n| LAST_DAY(\'2003-03-32\') |\n+------------------------+\n| NULL |\n+------------------------+\n1 row in set, 1 warning (0.00 sec)\n \nWarning (Code 1292): Incorrect datetime value:\n\'2003-03-32\'\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/last_day/','','https://mariadb.com/kb/en/library/last_day/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (489,31,'LOCALTIME','Syntax\n------ \nLOCALTIME\nLOCALTIME([precision])\n \nDescription\n----------- \nLOCALTIME and LOCALTIME() are synonyms for NOW().\n \n\n\nURL: https://mariadb.com/kb/en/library/localtime/','','https://mariadb.com/kb/en/library/localtime/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (490,31,'LOCALTIMESTAMP','Syntax\n------ \nLOCALTIMESTAMP\nLOCALTIMESTAMP([precision])\n \nDescription\n----------- \nLOCALTIMESTAMP and LOCALTIMESTAMP() are synonyms for NOW().\n \n\n\nURL: https://mariadb.com/kb/en/library/localtimestamp/','','https://mariadb.com/kb/en/library/localtimestamp/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (491,31,'MAKEDATE','Syntax\n------ \nMAKEDATE(year,dayofyear)\n \nDescription\n----------- \nReturns a date, given year and day-of-year values. dayofyear\nmust be\ngreater than 0 or the result is NULL.\n \nExamples\n-------- \nSELECT MAKEDATE(2011,31), MAKEDATE(2011,32);\n+-------------------+-------------------+\n| MAKEDATE(2011,31) | MAKEDATE(2011,32) |\n+-------------------+-------------------+\n| 2011-01-31 | 2011-02-01 |\n+-------------------+-------------------+\n \nSELECT MAKEDATE(2011,365), MAKEDATE(2014,365);\n+--------------------+--------------------+\n| MAKEDATE(2011,365) | MAKEDATE(2014,365) |\n+--------------------+--------------------+\n| 2011-12-31 | 2014-12-31 |\n+--------------------+--------------------+\n \nSELECT MAKEDATE(2011,0);\n+------------------+\n| MAKEDATE(2011,0) |\n+------------------+\n| NULL |\n+------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/makedate/','','https://mariadb.com/kb/en/library/makedate/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (492,31,'MAKETIME','Syntax\n------ \nMAKETIME(hour,minute,second)\n \nDescription\n----------- \nReturns a time value calculated from the hour, minute, and\nsecond arguments.\n \nIf minute or second are out of the range 0 to 60, NULL is\nreturned. The hour can be in the range -838 to 838, outside\nof which the value is truncated with a warning.\n \nExamples\n-------- \nSELECT MAKETIME(13,57,33);\n+--------------------+\n| MAKETIME(13,57,33) |\n+--------------------+\n| 13:57:33 |\n+--------------------+\n \nSELECT MAKETIME(-13,57,33);\n+---------------------+\n| MAKETIME(-13,57,33) |\n+---------------------+\n| -13:57:33 |\n+---------------------+\n \nSELECT MAKETIME(13,67,33);\n+--------------------+\n| MAKETIME(13,67,33) |\n+--------------------+\n| NULL |\n+--------------------+\n \nSELECT MAKETIME(-1000,57,33);\n+-----------------------+\n| MAKETIME(-1000,57,33) |\n+-----------------------+\n| -838:59:59 |\n+-----------------------+\n1 row in set, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+---------+------+-----------------------------------------------+\n| Level | Code | Message |\n+---------+------+-----------------------------------------------+\n| Warning | 1292 | Truncated incorrect time value:\n\'-1000:57:33\' |\n+---------+------+-----------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/maketime/','','https://mariadb.com/kb/en/library/maketime/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (493,31,'MICROSECOND','Syntax\n------ \nMICROSECOND(expr)\n \nDescription\n----------- \nReturns the microseconds from the time or datetime\nexpression expr as a number in the range from 0 to 999999.\n \nIf expr is a time with no microseconds, zero is returned,\nwhile if expr is a date with no time, zero with a warning is\nreturned.\n \nExamples\n-------- \nSELECT MICROSECOND(\'12:00:00.123456\');\n+--------------------------------+\n| MICROSECOND(\'12:00:00.123456\') |\n+--------------------------------+\n| 123456 |\n+--------------------------------+\n \nSELECT MICROSECOND(\'2009-12-31 23:59:59.000010\');\n+-------------------------------------------+\n| MICROSECOND(\'2009-12-31 23:59:59.000010\') |\n+-------------------------------------------+\n| 10 |\n+-------------------------------------------+\n \nSELECT MICROSECOND(\'2013-08-07 12:13:14\');\n+------------------------------------+\n| MICROSECOND(\'2013-08-07 12:13:14\') |\n+------------------------------------+\n| 0 |\n+------------------------------------+\n \nSELECT MICROSECOND(\'2013-08-07\');\n+---------------------------+\n| MICROSECOND(\'2013-08-07\') |\n+---------------------------+\n| 0 |\n+---------------------------+\n1 row in set, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+---------+------+----------------------------------------------+\n| Level | Code | Message |\n+---------+------+----------------------------------------------+\n| Warning | 1292 | Truncated incorrect time value:\n\'2013-08-07\' |\n+---------+------+----------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/microsecond/','','https://mariadb.com/kb/en/library/microsecond/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (494,31,'MINUTE','Syntax\n------ \nMINUTE(time)\n \nDescription\n----------- \nReturns the minute for time, in the range 0 to 59. \n \nExamples\n-------- \nSELECT MINUTE(\'2013-08-03 11:04:03\');\n+-------------------------------+\n| MINUTE(\'2013-08-03 11:04:03\') |\n+-------------------------------+\n| 4 |\n+-------------------------------+\n \n SELECT MINUTE (\'23:12:50\');\n+---------------------+\n| MINUTE (\'23:12:50\') |\n+---------------------+\n| 12 |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/minute/','','https://mariadb.com/kb/en/library/minute/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (495,31,'MONTH','Syntax\n------ \nMONTH(date)\n \nDescription\n----------- \nReturns the month for date in the range 1 to 12 for January\nto\nDecember, or 0 for dates such as \'0000-00-00\' or\n\'2008-00-00\' that\nhave a zero month part.\n \nExamples\n-------- \nSELECT MONTH(\'2019-01-03\');\n+---------------------+\n| MONTH(\'2019-01-03\') |\n+---------------------+\n| 1 |\n+---------------------+\n \nSELECT MONTH(\'2019-00-03\');\n+---------------------+\n| MONTH(\'2019-00-03\') |\n+---------------------+\n| 0 |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/month/','','https://mariadb.com/kb/en/library/month/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (496,31,'MONTHNAME','Syntax\n------ \nMONTHNAME(date)\n \nDescription\n----------- \nReturns the full name of the month for date. The language\nused for the name is controlled by the value of the\nlc_time_names system variable. See server locale for more on\nthe supported locales.\n \nExamples\n-------- \nSELECT MONTHNAME(\'2019-02-03\');\n+-------------------------+\n| MONTHNAME(\'2019-02-03\') |\n+-------------------------+\n| February |\n+-------------------------+\n \nChanging the locale:\n \nSET lc_time_names = \'fr_CA\';\n \nSELECT MONTHNAME(\'2019-05-21\');\n+-------------------------+\n| MONTHNAME(\'2019-05-21\') |\n+-------------------------+\n| mai |\n+-------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/monthname/','','https://mariadb.com/kb/en/library/monthname/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (497,31,'NOW','Syntax\n------ \nNOW([precision])\nCURRENT_TIMESTAMP\nCURRENT_TIMESTAMP([precision])\nLOCALTIME, LOCALTIME([precision])\nLOCALTIMESTAMP\nLOCALTIMESTAMP([precision])\n \nDescription\n----------- \nReturns the current date and time as a value in \'YYYY-MM-DD\nHH:MM:SS\'\nor YYYYMMDDHHMMSS.uuuuuu format, depending on whether the\nfunction is\nused in a string or numeric context. The value is expressed\nin the\ncurrent time zone.\n \nThe optional precision determines the microsecond precision.\nSee Microseconds in MariaDB.\n \nNOW() (or its synonyms) can be used as the default value for\nTIMESTAMP columns as well as, since MariaDB 10.0.1, DATETIME\ncolumns. Before MariaDB 10.0.1, it was only possible for a\nsingle TIMESTAMP column per table to contain the\nCURRENT_TIMESTAMP as its default.\n \nWhen displayed in the INFORMATION_SCHEMA.COLUMNS table, a\ndefault CURRENT TIMESTAMP is displayed as CURRENT_TIMESTAMP\nup until MariaDB 10.2.2, and as current_timestamp() from\nMariaDB 10.2.3, due to to MariaDB 10.2 accepting expressions\nin the DEFAULT clause.\n \nExamples\n-------- \nSELECT NOW();\n+---------------------+\n| NOW() |\n+---------------------+\n| 2010-03-27 13:13:25 |\n+---------------------+\n \nSELECT NOW() + 0;\n \n+-----------------------+\n| NOW() + 0 |\n+-----------------------+\n| 20100327131329.000000 |\n+-----------------------+\n \nWith precision:\n \nSELECT CURRENT_TIMESTAMP(2);\n+------------------------+\n| CURRENT_TIMESTAMP(2) |\n+------------------------+\n| 2018-07-10 09:47:26.24 |\n+------------------------+\n \nUsed as a default TIMESTAMP:\n \nCREATE TABLE t (createdTS TIMESTAMP NOT NULL DEFAULT\nCURRENT_TIMESTAMP);\n \nFrom MariaDB 10.2.2:\n \nSELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE\nTABLE_SCHEMA=\'test\'\n AND COLUMN_NAME LIKE \'%ts%\'\\G\n*************************** 1. row\n***************************\n TABLE_CATALOG: def\n TABLE_SCHEMA: test\n TABLE_NAME: t\n COLUMN_NAME: ts\n ORDINAL_POSITION: 1\n COLUMN_DEFAULT: current_timestamp()\n...\n \n\n\nURL: https://mariadb.com/kb/en/library/now/','','https://mariadb.com/kb/en/library/now/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (498,31,'PERIOD_ADD','Syntax\n------ \nPERIOD_ADD(P,N)\n \nDescription\n----------- \nAdds N months to period P. P is in the format YYMM or\nYYYYMM, and is not a date value. If P contains a two-digit\nyear, values from 00 to 69 are converted to from 2000 to\n2069, while values from 70 are converted to 1970 upwards.\n \nReturns a value in the format YYYYMM.\n \nExamples\n-------- \nSELECT PERIOD_ADD(200801,2);\n+----------------------+\n| PERIOD_ADD(200801,2) |\n+----------------------+\n| 200803 |\n+----------------------+\n \nSELECT PERIOD_ADD(6910,2);\n+--------------------+\n| PERIOD_ADD(6910,2) |\n+--------------------+\n| 206912 |\n+--------------------+\n \nSELECT PERIOD_ADD(7010,2);\n+--------------------+\n| PERIOD_ADD(7010,2) |\n+--------------------+\n| 197012 |\n+--------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/period_add/','','https://mariadb.com/kb/en/library/period_add/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (499,31,'PERIOD_DIFF','Syntax\n------ \nPERIOD_DIFF(P1,P2)\n \nDescription\n----------- \nReturns the number of months between periods P1 and P2. P1\nand P2 \ncan be in the format YYMM or YYYYMM, and are not date\nvalues.\n \nIf P1 or P2 contains a two-digit year, values from 00 to 69\nare converted to from 2000 to 2069, while values from 70 are\nconverted to 1970 upwards.\n \nExamples\n-------- \nSELECT PERIOD_DIFF(200802,200703);\n+----------------------------+\n| PERIOD_DIFF(200802,200703) |\n+----------------------------+\n| 11 |\n+----------------------------+\n \nSELECT PERIOD_DIFF(6902,6803);\n+------------------------+\n| PERIOD_DIFF(6902,6803) |\n+------------------------+\n| 11 |\n+------------------------+\n \nSELECT PERIOD_DIFF(7002,6803);\n+------------------------+\n| PERIOD_DIFF(7002,6803) |\n+------------------------+\n| -1177 |\n+------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/period_diff/','','https://mariadb.com/kb/en/library/period_diff/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (500,31,'QUARTER','Syntax\n------ \nQUARTER(date)\n \nDescription\n----------- \nReturns the quarter of the year for date, in the range 1 to\n4. Returns 0 if month contains a zero value, or NULL if the\ngiven value is not otherwise a valid date (zero values are\naccepted).\n \nExamples\n-------- \nSELECT QUARTER(\'2008-04-01\');\n+-----------------------+\n| QUARTER(\'2008-04-01\') |\n+-----------------------+\n| 2 |\n+-----------------------+\n \nSELECT QUARTER(\'2019-00-01\');\n+-----------------------+\n| QUARTER(\'2019-00-01\') |\n+-----------------------+\n| 0 |\n+-----------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/quarter/','','https://mariadb.com/kb/en/library/quarter/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (501,31,'SECOND','Syntax\n------ \nSECOND(time)\n \nDescription\n----------- \nReturns the second for a given time (which can include\nmicroseconds), in the range 0 to 59, or NULL if not given a\nvalid time value.\n \nExamples\n-------- \nSELECT SECOND(\'10:05:03\');\n+--------------------+\n| SECOND(\'10:05:03\') |\n+--------------------+\n| 3 |\n+--------------------+\n \nSELECT SECOND(\'10:05:01.999999\');\n+---------------------------+\n| SECOND(\'10:05:01.999999\') |\n+---------------------------+\n| 1 |\n+---------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/second/','','https://mariadb.com/kb/en/library/second/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (502,31,'SEC_TO_TIME','Syntax\n------ \nSEC_TO_TIME(seconds)\n \nDescription\n----------- \nReturns the seconds argument, converted to hours, minutes,\nand\nseconds, as a TIME value. The range of the result is\nconstrained to\nthat of the TIME data type. A warning occurs if the argument\ncorresponds to a value outside that range.\n \nThe time will be returned in the format hh:mm:ss, or hhmmss\nif used in a numeric calculation.\n \nExamples\n-------- \nSELECT SEC_TO_TIME(12414);\n+--------------------+\n| SEC_TO_TIME(12414) |\n+--------------------+\n| 03:26:54 |\n+--------------------+\n \nSELECT SEC_TO_TIME(12414)+0;\n \n+----------------------+\n| SEC_TO_TIME(12414)+0 |\n+----------------------+\n| 32654 |\n+----------------------+\n \nSELECT SEC_TO_TIME(9999999);\n+----------------------+\n| SEC_TO_TIME(9999999) |\n+----------------------+\n| 838:59:59 |\n+----------------------+\n1 row in set, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+---------+------+-------------------------------------------+\n| Level | Code | Message |\n+---------+------+-------------------------------------------+\n| Warning | 1292 | Truncated incorrect time value:\n\'9999999\' |\n+---------+------+-------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/sec_to_time/','','https://mariadb.com/kb/en/library/sec_to_time/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (503,31,'STR_TO_DATE','Syntax\n------ \nSTR_TO_DATE(str,format)\n \nDescription\n----------- \nThis is the inverse of the DATE_FORMAT() function. It takes\na string str and a format string format. STR_TO_DATE()\nreturns a\nDATETIME value if the format string contains both date and\ntime parts, or a\nDATE or TIME value if the string contains only date or time\nparts.\n \nThe date, time, or datetime values contained in str should\nbe given in the format indicated by format. If str contains\nan illegal date, time, or datetime value, STR_TO_DATE()\nreturns NULL. An illegal value also produces a warning.\n \nThe options that can be used by STR_TO_DATE(), as well as\nits inverse DATE_FORMAT() and the FROM_UNIXTIME() function,\nare:\n \nOption | Description | \n \n%a | Short weekday name in current locale (Variable\nlc_time_names). | \n \n%b | Short form month name in current locale. For locale\nen_US this is one of:\nJan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov or Dec. | \n \n%c | Month with 1 or 2 digits. | \n \n%D | Day with English suffix \'th\', \'nd\', \'st\' or\n\'rd\'\'. (1st, 2nd, 3rd...). | \n \n%d | Day with 2 digits. | \n \n%e | Day with 1 or 2 digits. | \n \n%f | Sub seconds 6 digits. | \n \n%H | Hour with 2 digits between 00-23. | \n \n%h | Hour with 2 digits between 01-12. | \n \n%I | Hour with 2 digits between 01-12. | \n \n%i | Minute with 2 digits. | \n \n%j | Day of the year (001-366) | \n \n%k | Hour with 1 digits between 0-23. | \n \n%l | Hour with 1 digits between 1-12. | \n \n%M | Full month name in current locale (Variable\nlc_time_names). | \n \n%m | Month with 2 digits. | \n \n%p | AM/PM according to current locale (Variable\nlc_time_names). | \n \n%r | Time in 12 hour format, followed by AM/PM. Short for\n\'%I:%i:%S %p\'. | \n \n%S | Seconds with 2 digits. | \n \n%s | Seconds with 2 digits. | \n \n%T | Time in 24 hour format. Short for \'%H:%i:%S\'. | \n \n%U | Week number (00-53), when first day of the week is\nSunday. | \n \n%u | Week number (00-53), when first day of the week is\nMonday. | \n \n%V | Week number (01-53), when first day of the week is\nSunday. Used with %X. | \n \n%v | Week number (01-53), when first day of the week is\nMonday. Used with %x. | \n \n%W | Full weekday name in current locale (Variable\nlc_time_names). | \n \n%w | Day of the week. 0 = Sunday, 6 = Saturday. | \n \n%X | Year with 4 digits when first day of the week is\nSunday. Used with %V. | \n \n%x | Year with 4 digits when first day of the week is\nMonday. Used with %v. | \n \n%Y | Year with 4 digits. | \n \n%y | Year with 2 digits. | \n \n%# | For str_to_date(), skip all numbers. | \n \n%. | For str_to_date(), skip all punctation characters. | \n \n%@ | For str_to_date(), skip all alpha characters. | \n \n%% | A literal % character. | \n \nExamples\n-------- \nSELECT STR_TO_DATE(\'Wednesday, June 2, 2014\', \'%W, %M %e,\n%Y\');\n+---------------------------------------------------------+\n| STR_TO_DATE(\'Wednesday, June 2, 2014\', \'%W, %M %e,\n%Y\') |\n+---------------------------------------------------------+\n| 2014-06-02 |\n+---------------------------------------------------------+\n \nSELECT STR_TO_DATE(\'Wednesday23423, June 2, 2014\', \'%W,\n%M %e, %Y\');\n+--------------------------------------------------------------+\n| STR_TO_DATE(\'Wednesday23423, June 2, 2014\', \'%W, %M %e,\n%Y\') |\n+--------------------------------------------------------------+\n| NULL |\n+--------------------------------------------------------------+\n1 row in set, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+---------+------+-----------------------------------------------------------------------------------+\n| Level | Code | Message |\n+---------+------+-----------------------------------------------------------------------------------+\n| Warning | 1411 | Incorrect datetime value:\n\'Wednesday23423, June 2, 2014\' for function str_to_date |\n+---------+------+-----------------------------------------------------------------------------------+\n \nSELECT STR_TO_DATE(\'Wednesday23423, June 2, 2014\', \'%W%#,\n%M %e, %Y\');\n+----------------------------------------------------------------+\n| STR_TO_DATE(\'Wednesday23423, June 2, 2014\', \'%W%#, %M\n%e, %Y\') |\n+----------------------------------------------------------------+\n| 2014-06-02 |\n+----------------------------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/str_to_date/','','https://mariadb.com/kb/en/library/str_to_date/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (504,31,'SUBDATE','Syntax\n------ \nSUBDATE(date,INTERVAL expr unit), SUBDATE(expr,days)\n \nDescription\n----------- \nWhen invoked with the INTERVAL form of the second argument,\nSUBDATE()\nis a synonym for DATE_SUB(). See Date and Time Units for a\ncomplete list of permitted units. \n \nThe second form allows the use of an integer value for days.\nIn such\ncases, it is interpreted as the number of days to be\nsubtracted from\nthe date or datetime expression expr.\n \nExamples\n-------- \nSELECT DATE_SUB(\'2008-01-02\', INTERVAL 31 DAY);\n+-----------------------------------------+\n| DATE_SUB(\'2008-01-02\', INTERVAL 31 DAY) |\n+-----------------------------------------+\n| 2007-12-02 |\n+-----------------------------------------+\n \nSELECT SUBDATE(\'2008-01-02\', INTERVAL 31 DAY);\n+----------------------------------------+\n| SUBDATE(\'2008-01-02\', INTERVAL 31 DAY) |\n+----------------------------------------+\n| 2007-12-02 |\n+----------------------------------------+\n \nSELECT SUBDATE(\'2008-01-02 12:00:00\', 31);\n+------------------------------------+\n| SUBDATE(\'2008-01-02 12:00:00\', 31) |\n+------------------------------------+\n| 2007-12-02 12:00:00 |\n+------------------------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n (\"2007-01-30 21:31:07\"),\n (\"1983-10-15 06:42:51\"),\n (\"2011-04-21 12:34:56\"),\n (\"2011-10-30 06:31:41\"),\n (\"2011-01-30 14:03:25\"),\n (\"2004-10-07 11:19:34\");\n \nSELECT d, SUBDATE(d, 10) from t1;\n \n+---------------------+---------------------+\n| d | SUBDATE(d, 10) |\n+---------------------+---------------------+\n| 2007-01-30 21:31:07 | 2007-01-20 21:31:07 |\n| 1983-10-15 06:42:51 | 1983-10-05 06:42:51 |\n| 2011-04-21 12:34:56 | 2011-04-11 12:34:56 |\n| 2011-10-30 06:31:41 | 2011-10-20 06:31:41 |\n| 2011-01-30 14:03:25 | 2011-01-20 14:03:25 |\n| 2004-10-07 11:19:34 | 2004-09-27 11:19:34 |\n+---------------------+---------------------+\n \nSELECT d, SUBDATE(d, INTERVAL 10 MINUTE) from t1;\n \n+---------------------+--------------------------------+\n| d | SUBDATE(d, INTERVAL 10 MINUTE) |\n+---------------------+--------------------------------+\n| 2007-01-30 21:31:07 | 2007-01-30 21:21:07 |\n| 1983-10-15 06:42:51 | 1983-10-15 06:32:51 |\n| 2011-04-21 12:34:56 | 2011-04-21 12:24:56 |\n| 2011-10-30 06:31:41 | 2011-10-30 06:21:41 |\n| 2011-01-30 14:03:25 | 2011-01-30 13:53:25 |\n| 2004-10-07 11:19:34 | 2004-10-07 11:09:34 |\n+---------------------+--------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/subdate/','','https://mariadb.com/kb/en/library/subdate/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (505,31,'SUBTIME','Syntax\n------ \nSUBTIME(expr1,expr2)\n \nDescription\n----------- \nSUBTIME() returns expr1 - expr2 expressed as a value in the\nsame\nformat as expr1. expr1 is a time or datetime expression, and\nexpr2 is\na time expression.\n \nExamples\n-------- \nSELECT SUBTIME(\'2007-12-31 23:59:59.999999\',\'1\n1:1:1.000002\');\n+--------------------------------------------------------+\n| SUBTIME(\'2007-12-31 23:59:59.999999\',\'1 1:1:1.000002\')\n|\n+--------------------------------------------------------+\n| 2007-12-30 22:58:58.999997 |\n+--------------------------------------------------------+\n \nSELECT SUBTIME(\'01:00:00.999999\', \'02:00:00.999998\');\n+-----------------------------------------------+\n| SUBTIME(\'01:00:00.999999\', \'02:00:00.999998\') |\n+-----------------------------------------------+\n| -00:59:59.999999 |\n+-----------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/subtime/','','https://mariadb.com/kb/en/library/subtime/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (506,31,'SYSDATE','Syntax\n------ \nSYSDATE([precision])\n \nDescription\n----------- \nReturns the current date and time as a value in \'YYYY-MM-DD\nHH:MM:SS\'\nor YYYYMMDDHHMMSS.uuuuuu format, depending on whether the\nfunction is\nused in a string or numeric context.\n \nThe optional precision determines the microsecond precision.\nSee Microseconds in MariaDB.\n \nSYSDATE() returns the time at which it executes. This\ndiffers from the\nbehavior for NOW(), which returns a constant time that\nindicates the\ntime at which the statement began to execute. (Within a\nstored routine\nor trigger, NOW() returns the time at which the routine or\ntriggering\nstatement began to execute.)\n \nIn addition, changing the timestamp system variable with a\nSET timestamp statement affects the value returned by\nNOW() but not by SYSDATE(). This means that timestamp\nsettings in the\nbinary log have no effect on invocations of SYSDATE().\n \nBecause SYSDATE() can return different values even within\nthe same\nstatement, and is not affected by SET TIMESTAMP, it is\nnon-deterministic and therefore unsafe for replication if\nstatement-based binary logging is used. If that is a\nproblem, you can\nuse row-based logging, or start the server with the mysqld\noption --sysdate-is-now to cause SYSDATE() to be an alias\nfor NOW(). The non-deterministic nature of SYSDATE() also\nmeans that indexes cannot be used for evaluating expressions\nthat refer to it, and that statements using the SYSDATE()\nfunction are unsafe for statement-based replication.\n \nExamples\n-------- \nDifference between NOW() and SYSDATE():\n \nSELECT NOW(), SLEEP(2), NOW();\n+---------------------+----------+---------------------+\n| NOW() | SLEEP(2) | NOW() |\n+---------------------+----------+---------------------+\n| 2010-03-27 13:23:40 | 0 | 2010-03-27 13:23:40 |\n+---------------------+----------+---------------------+\n \nSELECT SYSDATE(), SLEEP(2), SYSDATE();\n+---------------------+----------+---------------------+\n| SYSDATE() | SLEEP(2) | SYSDATE() |\n+---------------------+----------+---------------------+\n| 2010-03-27 13:23:52 | 0 | 2010-03-27 13:23:54 |\n+---------------------+----------+---------------------+\n \nWith precision:\n \nSELECT SYSDATE(4);\n+--------------------------+\n| SYSDATE(4) |\n+--------------------------+\n| 2018-07-10 10:17:13.1689 |\n+--------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/sysdate/','','https://mariadb.com/kb/en/library/sysdate/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (507,31,'TIME Function','Syntax\n------ \nTIME(expr)\n \nDescription\n----------- \nExtracts the time part of the time or datetime expression\nexpr and\nreturns it as a string.\n \nExamples\n-------- \nSELECT TIME(\'2003-12-31 01:02:03\');\n+-----------------------------+\n| TIME(\'2003-12-31 01:02:03\') |\n+-----------------------------+\n| 01:02:03 |\n+-----------------------------+\n \nSELECT TIME(\'2003-12-31 01:02:03.000123\');\n+------------------------------------+\n| TIME(\'2003-12-31 01:02:03.000123\') |\n+------------------------------------+\n| 01:02:03.000123 |\n+------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/time-function/','','https://mariadb.com/kb/en/library/time-function/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (508,31,'TIMEDIFF','Syntax\n------ \nTIMEDIFF(expr1,expr2)\n \nDescription\n----------- \nTIMEDIFF() returns expr1 - expr2 expressed as a time value.\nexpr1 and\nexpr2 are time or date-and-time expressions, but both must\nbe of the\nsame type.\n \nExamples\n-------- \nSELECT TIMEDIFF(\'2000:01:01 00:00:00\', \'2000:01:01\n00:00:00.000001\');\n+---------------------------------------------------------------+\n| TIMEDIFF(\'2000:01:01 00:00:00\', \'2000:01:01\n00:00:00.000001\') |\n+---------------------------------------------------------------+\n| -00:00:00.000001 |\n+---------------------------------------------------------------+\n \nSELECT TIMEDIFF(\'2008-12-31 23:59:59.000001\', \'2008-12-30\n01:01:01.000002\');\n+----------------------------------------------------------------------+\n| TIMEDIFF(\'2008-12-31 23:59:59.000001\', \'2008-12-30\n01:01:01.000002\') |\n+----------------------------------------------------------------------+\n| 46:58:57.999999 |\n+----------------------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/timediff/','','https://mariadb.com/kb/en/library/timediff/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (509,31,'TIMESTAMP FUNCTION','Syntax\n------ \nTIMESTAMP(expr), TIMESTAMP(expr1,expr2)\n \nDescription\n----------- \nWith a single argument, this function returns the date or\ndatetime\nexpression expr as a datetime value. With two arguments, it\nadds the\ntime expression expr2 to the date or datetime expression\nexpr1 and\nreturns the result as a datetime value.\n \nExamples\n-------- \nSELECT TIMESTAMP(\'2003-12-31\');\n+-------------------------+\n| TIMESTAMP(\'2003-12-31\') |\n+-------------------------+\n| 2003-12-31 00:00:00 |\n+-------------------------+\n \nSELECT TIMESTAMP(\'2003-12-31 12:00:00\',\'6:30:00\');\n+--------------------------------------------+\n| TIMESTAMP(\'2003-12-31 12:00:00\',\'6:30:00\') |\n+--------------------------------------------+\n| 2003-12-31 18:30:00 |\n+--------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/timestamp-function/','','https://mariadb.com/kb/en/library/timestamp-function/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (510,31,'TIMESTAMPADD','Syntax\n------ \nTIMESTAMPADD(unit,interval,datetime_expr)\n \nDescription\n----------- \nAdds the integer expression interval to the date or datetime\nexpression datetime_expr. The unit for interval is given by\nthe unit\nargument, which should be one of the following values:\nMICROSECOND, SECOND, MINUTE, HOUR, DAY, WEEK, MONTH,\nQUARTER, or YEAR.\n \nThe unit value may be specified using one of keywords as\nshown, or\nwith a prefix of SQL_TSI_. For example, DAY and SQL_TSI_DAY\nboth are\nlegal.\n \nBefore MariaDB 5.5, FRAC_SECOND was permitted as a synonym\nfor MICROSECOND.\n \nExamples\n-------- \nSELECT TIMESTAMPADD(MINUTE,1,\'2003-01-02\');\n+-------------------------------------+\n| TIMESTAMPADD(MINUTE,1,\'2003-01-02\') |\n+-------------------------------------+\n| 2003-01-02 00:01:00 |\n+-------------------------------------+\n \nSELECT TIMESTAMPADD(WEEK,1,\'2003-01-02\');\n+-----------------------------------+\n| TIMESTAMPADD(WEEK,1,\'2003-01-02\') |\n+-----------------------------------+\n| 2003-01-09 |\n+-----------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/timestampadd/','','https://mariadb.com/kb/en/library/timestampadd/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (511,31,'TIMESTAMPDIFF','Syntax\n------ \nTIMESTAMPDIFF(unit,datetime_expr1,datetime_expr2)\n \nDescription\n----------- \nReturns datetime_expr2 - datetime_expr1, where\ndatetime_expr1 and\ndatetime_expr2 are date or datetime expressions. One\nexpression may be\na date and the other a datetime; a date value is treated as\na datetime\nhaving the time part \'00:00:00\' where necessary. The unit\nfor the\nresult (an integer) is given by the unit argument. The legal\nvalues\nfor unit are the same as those listed in the description of\nthe\nTIMESTAMPADD() function, i.e MICROSECOND, SECOND, MINUTE,\nHOUR, DAY, WEEK, MONTH, QUARTER, or YEAR.\n \nTIMESTAMPDIFF can also be used to calculate age.\n \nExamples\n-------- \nSELECT TIMESTAMPDIFF(MONTH,\'2003-02-01\',\'2003-05-01\');\n+------------------------------------------------+\n| TIMESTAMPDIFF(MONTH,\'2003-02-01\',\'2003-05-01\') |\n+------------------------------------------------+\n| 3 |\n+------------------------------------------------+\n \nSELECT TIMESTAMPDIFF(YEAR,\'2002-05-01\',\'2001-01-01\');\n+-----------------------------------------------+\n| TIMESTAMPDIFF(YEAR,\'2002-05-01\',\'2001-01-01\') |\n+-----------------------------------------------+\n| -1 |\n+-----------------------------------------------+\n \nSELECT TIMESTAMPDIFF(MINUTE,\'2003-02-01\',\'2003-05-01\n12:05:55\');\n+----------------------------------------------------------+\n| TIMESTAMPDIFF(MINUTE,\'2003-02-01\',\'2003-05-01\n12:05:55\') |\n+----------------------------------------------------------+\n| 128885 |\n+----------------------------------------------------------+\n \nCalculating age:\n \nSELECT CURDATE();\n+------------+\n| CURDATE() |\n+------------+\n| 2019-05-27 |\n+------------+\n \nSELECT TIMESTAMPDIFF(YEAR, \'1971-06-06\', CURDATE()) AS\nage;\n \n+------+\n| age |\n+------+\n| 47 |\n+------+\n \nSELECT TIMESTAMPDIFF(YEAR, \'1971-05-06\', CURDATE()) AS\nage;\n \n+------+\n| age |\n+------+\n| 48 |\n+------+\n \nAge as of 2014-08-02:\n \nSELECT name, date_of_birth,\nTIMESTAMPDIFF(YEAR,date_of_birth,\'2014-08-02\') AS age \n FROM student_details;\n \n+---------+---------------+------+\n| name | date_of_birth | age |\n+---------+---------------+------+\n| Chun | 1993-12-31 | 20 |\n| Esben | 1946-01-01 | 68 |\n| Kaolin | 1996-07-16 | 18 |\n| Tatiana | 1988-04-13 | 26 |\n+---------+---------------+------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/timestampdiff/','','https://mariadb.com/kb/en/library/timestampdiff/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (512,31,'TIME_FORMAT','Syntax\n------ \nTIME_FORMAT(time,format)\n \nDescription\n----------- \nThis is used like the DATE_FORMAT() function, but the format\nstring\nmay contain format specifiers only for hours, minutes, and\nseconds.\nOther specifiers produce a NULL value or 0.\n \nExamples\n-------- \nSELECT TIME_FORMAT(\'100:00:00\', \'%H %k %h %I %l\');\n+--------------------------------------------+\n| TIME_FORMAT(\'100:00:00\', \'%H %k %h %I %l\') |\n+--------------------------------------------+\n| 100 100 04 04 4 |\n+--------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/time_format/','','https://mariadb.com/kb/en/library/time_format/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (513,31,'TIME_TO_SEC','Syntax\n------ \nTIME_TO_SEC(time)\n \nDescription\n----------- \nReturns the time argument, converted to seconds.\n \nThe value returned by TIME_TO_SEC is of type DOUBLE. Before\nMariaDB 5.3 (and MySQL 5.6), the type was INT. See\nMicroseconds in MariaDB.\n \nExamples\n-------- \nSELECT TIME_TO_SEC(\'22:23:00\');\n+-------------------------+\n| TIME_TO_SEC(\'22:23:00\') |\n+-------------------------+\n| 80580 |\n+-------------------------+\n \nSELECT TIME_TO_SEC(\'00:39:38\');\n+-------------------------+\n| TIME_TO_SEC(\'00:39:38\') |\n+-------------------------+\n| 2378 |\n+-------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/time_to_sec/','','https://mariadb.com/kb/en/library/time_to_sec/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (514,31,'TO_DAYS','Syntax\n------ \nTO_DAYS(date)\n \nDescription\n----------- \nGiven a date date, returns the number of days since the\nstart of the current calendar (0000-00-00).\n \nThe function is not designed for use with dates before the\nadvent of the Gregorian calendar in October 1582. Results\nwill not be reliable since it doesn\'t account for the lost\ndays when the calendar changed from the Julian calendar.\n \nThis is the converse of the FROM_DAYS() function.\n \nExamples\n-------- \nSELECT TO_DAYS(\'2007-10-07\');\n+-----------------------+\n| TO_DAYS(\'2007-10-07\') |\n+-----------------------+\n| 733321 |\n+-----------------------+\n \nSELECT TO_DAYS(\'0000-01-01\');\n+-----------------------+\n| TO_DAYS(\'0000-01-01\') |\n+-----------------------+\n| 1 |\n+-----------------------+\n \nSELECT TO_DAYS(950501);\n+-----------------+\n| TO_DAYS(950501) |\n+-----------------+\n| 728779 |\n+-----------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/to_days/','','https://mariadb.com/kb/en/library/to_days/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (515,31,'TO_SECONDS','Syntax\n------ \nTO_SECONDS(expr)\n \nDescription\n----------- \nReturns the number of seconds from year 0 till expr, or NULL\nif expr is not a valid date or datetime.\n \nExamples\n-------- \nSELECT TO_SECONDS(\'2013-06-13\');\n+--------------------------+\n| TO_SECONDS(\'2013-06-13\') |\n+--------------------------+\n| 63538300800 |\n+--------------------------+\n \nSELECT TO_SECONDS(\'2013-06-13 21:45:13\');\n+-----------------------------------+\n| TO_SECONDS(\'2013-06-13 21:45:13\') |\n+-----------------------------------+\n| 63538379113 |\n+-----------------------------------+\n \nSELECT TO_SECONDS(NOW());\n+-------------------+\n| TO_SECONDS(NOW()) |\n+-------------------+\n| 63543530875 |\n+-------------------+\n \nSELECT TO_SECONDS(20130513);\n+----------------------+\n| TO_SECONDS(20130513) |\n+----------------------+\n| 63535622400 |\n+----------------------+\n1 row in set (0.00 sec)\n \nSELECT TO_SECONDS(130513);\n+--------------------+\n| TO_SECONDS(130513) |\n+--------------------+\n| 63535622400 |\n+--------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/to_seconds/','','https://mariadb.com/kb/en/library/to_seconds/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (516,31,'UNIX_TIMESTAMP','Syntax\n------ \nUNIX_TIMESTAMP()\nUNIX_TIMESTAMP(date)\n \nDescription\n----------- \nIf called with no argument, returns a Unix timestamp\n(seconds since\n\'1970-01-01 00:00:00\' UTC) as an unsigned integer. If\nUNIX_TIMESTAMP()\nis called with a date argument, it returns the value of the\nargument as seconds\nsince \'1970-01-01 00:00:00\' UTC. date may be a DATE\nstring, a\nDATETIME string, a TIMESTAMP, or a number in\nthe format YYMMDD or YYYYMMDD. The server interprets date as\na value in the\ncurrent time zone and converts it to an internal value in\nUTC. Clients can set\ntheir time zone as described in time zones.\n \nThe inverse function of UNIX_TIMESTAMP() is FROM_UNIXTIME()\n \nUNIX_TIMESTAMP() supports microseconds.\n \nTimestamps in MariaDB have a maximum value of 2147483647,\nequivalent to 2038-01-19 05:14:07. This is due to the\nunderlying 32-bit limitation. Using the function on a date\nbeyond this will result in NULL being returned. Use DATETIME\nas a storage type if you require dates beyond this.\n \nError Handling\n \nReturns NULL for wrong arguments to UNIX_TIMESTAMP(). In\nMySQL and MariaDB before 5.3 wrong arguments to\nUNIX_TIMESTAMP() returned 0. \n \nCompatibility\n \nAs you can see in the examples above,\nUNIX_TIMESTAMP(constant-date-string) returns a timestamp\nwith 6 decimals while MariaDB 5.2 and before returns it\nwithout decimals. This can cause a problem if you are using\nUNIX_TIMESTAMP() as a partitioning function. You can fix\nthis by using FLOOR(UNIX_TIMESTAMP(..)) or changing the date\nstring to a date number, like 20080101000000. \n \nExamples\n-------- \nSELECT UNIX_TIMESTAMP();\n+------------------+\n| UNIX_TIMESTAMP() |\n+------------------+\n| 1269711082 |\n+------------------+\n \nSELECT UNIX_TIMESTAMP(\'2007-11-30 10:30:19\');\n+---------------------------------------+\n| UNIX_TIMESTAMP(\'2007-11-30 10:30:19\') |\n+---------------------------------------+\n| 1196436619.000000 |\n+---------------------------------------+\n \nSELECT UNIX_TIMESTAMP(\"2007-11-30 10:30:19.123456\");\n+----------------------------------------------+\n| unix_timestamp(\"2007-11-30 10:30:19.123456\") |\n+----------------------------------------------+\n| 1196411419.123456 |\n+----------------------------------------------+\n \nSELECT FROM_UNIXTIME(UNIX_TIMESTAMP(\'2007-11-30\n10:30:19\'));\n+------------------------------------------------------+\n| FROM_UNIXTIME(UNIX_TIMESTAMP(\'2007-11-30 10:30:19\')) |\n+------------------------------------------------------+\n| 2007-11-30 10:30:19.000000 |\n+------------------------------------------------------+\n \nSELECT FROM_UNIXTIME(FLOOR(UNIX_TIMESTAMP(\'2007-11-30\n10:30:19\')));\n+-------------------------------------------------------------+\n| FROM_UNIXTIME(FLOOR(UNIX_TIMESTAMP(\'2007-11-30\n10:30:19\'))) |\n+-------------------------------------------------------------+\n| 2007-11-30 10:30:19 |\n+-------------------------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/unix_timestamp/','','https://mariadb.com/kb/en/library/unix_timestamp/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (517,31,'UTC_DATE','Syntax\n------ \nUTC_DATE, UTC_DATE()\n \nDescription\n----------- \nReturns the current UTC date as a value in \'YYYY-MM-DD\' or\nYYYYMMDD\nformat, depending on whether the function is used in a\nstring or numeric context. \n \nExamples\n-------- \nSELECT UTC_DATE(), UTC_DATE() + 0;\n \n+------------+----------------+\n| UTC_DATE() | UTC_DATE() + 0 |\n+------------+----------------+\n| 2010-03-27 | 20100327 |\n+------------+----------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/utc_date/','','https://mariadb.com/kb/en/library/utc_date/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (518,31,'UTC_TIME','Syntax\n------ \nUTC_TIME\nUTC_TIME([precision])\n \nDescription\n----------- \nReturns the current UTC time as a value in \'HH:MM:SS\' or\nHHMMSS.uuuuuu format, depending on whether the function is\nused in a string or numeric context. \n \nThe optional precision determines the microsecond precision.\nSee Microseconds in MariaDB.\n \nExamples\n-------- \nSELECT UTC_TIME(), UTC_TIME() + 0;\n \n+------------+----------------+\n| UTC_TIME() | UTC_TIME() + 0 |\n+------------+----------------+\n| 17:32:34 | 173234.000000 |\n+------------+----------------+\n \nWith precision:\n \nSELECT UTC_TIME(5);\n+----------------+\n| UTC_TIME(5) |\n+----------------+\n| 07:52:50.78369 |\n+----------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/utc_time/','','https://mariadb.com/kb/en/library/utc_time/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (519,31,'UTC_TIMESTAMP','Syntax\n------ \nUTC_TIMESTAMP\nUTC_TIMESTAMP([precision])\n \nDescription\n----------- \nReturns the current UTC date and time as a value in\n\'YYYY-MM-DD\nHH:MM:SS\' or YYYYMMDDHHMMSS.uuuuuu format, depending on\nwhether the\nfunction is used in a string or numeric context.\n \nThe optional precision determines the microsecond precision.\nSee Microseconds in MariaDB.\n \nExamples\n-------- \nSELECT UTC_TIMESTAMP(), UTC_TIMESTAMP() + 0;\n \n+---------------------+-----------------------+\n| UTC_TIMESTAMP() | UTC_TIMESTAMP() + 0 |\n+---------------------+-----------------------+\n| 2010-03-27 17:33:16 | 20100327173316.000000 |\n+---------------------+-----------------------+\n \nWith precision:\n \nSELECT UTC_TIMESTAMP(4);\n+--------------------------+\n| UTC_TIMESTAMP(4) |\n+--------------------------+\n| 2018-07-10 07:51:09.1019 |\n+--------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/utc_timestamp/','','https://mariadb.com/kb/en/library/utc_timestamp/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (520,31,'WEEK','Syntax\n------ \nWEEK(date[,mode])\n \nDescription\n----------- \nThis function returns the week number for date. The\ntwo-argument form of\nWEEK() allows you to specify whether the week starts on\nSunday or Monday\nand whether the return value should be in the range from 0\nto 53 or from 1 to\n53. If the mode argument is omitted, the value of the\ndefault_week_format system variable is used.\n \nModes\n \nMode | 1st day of week | Range | Week 1 is the 1st week with\n| \n \n0 | Sunday | 0-53 | a Sunday in this year | \n \n1 | Monday | 0-53 | more than 3 days this year | \n \n2 | Sunday | 1-53 | a Sunday in this year | \n \n3 | Monday | 1-53 | more than 3 days this year | \n \n4 | Sunday | 0-53 | more than 3 days this year | \n \n5 | Monday | 0-53 | a Monday in this year | \n \n6 | Sunday | 1-53 | more than 3 days this year | \n \n7 | Monday | 1-53 | a Monday in this year | \n \nExamples\n-------- \nSELECT WEEK(\'2008-02-20\');\n+--------------------+\n| WEEK(\'2008-02-20\') |\n+--------------------+\n| 7 |\n+--------------------+\n \nSELECT WEEK(\'2008-02-20\',0);\n+----------------------+\n| WEEK(\'2008-02-20\',0) |\n+----------------------+\n| 7 |\n+----------------------+\n \nSELECT WEEK(\'2008-02-20\',1);\n+----------------------+\n| WEEK(\'2008-02-20\',1) |\n+----------------------+\n| 8 |\n+----------------------+\n \nSELECT WEEK(\'2008-12-31\',0);\n+----------------------+\n| WEEK(\'2008-12-31\',0) |\n+----------------------+\n| 52 |\n+----------------------+\n \nSELECT WEEK(\'2008-12-31\',1);\n+----------------------+\n| WEEK(\'2008-12-31\',1) |\n+----------------------+\n| 53 |\n+----------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n (\"2007-01-30 21:31:07\"),\n (\"1983-10-15 06:42:51\"),\n (\"2011-04-21 12:34:56\"),\n (\"2011-10-30 06:31:41\"),\n (\"2011-01-30 14:03:25\"),\n (\"2004-10-07 11:19:34\");\n \nSELECT d, WEEK(d,0), WEEK(d,1) from t1;\n \n+---------------------+-----------+-----------+\n| d | WEEK(d,0) | WEEK(d,1) |\n+---------------------+-----------+-----------+\n| 2007-01-30 21:31:07 | 4 | 5 |\n| 1983-10-15 06:42:51 | 41 | 41 |\n| 2011-04-21 12:34:56 | 16 | 16 |\n| 2011-10-30 06:31:41 | 44 | 43 |\n| 2011-01-30 14:03:25 | 5 | 4 |\n| 2004-10-07 11:19:34 | 40 | 41 |\n+---------------------+-----------+-----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/week/','','https://mariadb.com/kb/en/library/week/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (521,31,'WEEKDAY','Syntax\n------ \nWEEKDAY(date)\n \nDescription\n----------- \nReturns the weekday index for date \n(0 = Monday, 1 = Tuesday, ... 6 = Sunday).\n \nThis contrasts with DAYOFWEEK() which follows the ODBC\nstandard\n(1 = Sunday, 2 = Monday, ..., 7 = Saturday).\n \nExamples\n-------- \nSELECT WEEKDAY(\'2008-02-03 22:23:00\');\n+--------------------------------+\n| WEEKDAY(\'2008-02-03 22:23:00\') |\n+--------------------------------+\n| 6 |\n+--------------------------------+\n \nSELECT WEEKDAY(\'2007-11-06\');\n+-----------------------+\n| WEEKDAY(\'2007-11-06\') |\n+-----------------------+\n| 1 |\n+-----------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n (\"2007-01-30 21:31:07\"),\n (\"1983-10-15 06:42:51\"),\n (\"2011-04-21 12:34:56\"),\n (\"2011-10-30 06:31:41\"),\n (\"2011-01-30 14:03:25\"),\n (\"2004-10-07 11:19:34\");\n \nSELECT d FROM t1 where WEEKDAY(d) = 6;\n \n+---------------------+\n| d |\n+---------------------+\n| 2011-10-30 06:31:41 |\n| 2011-01-30 14:03:25 |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/weekday/','','https://mariadb.com/kb/en/library/weekday/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (522,31,'WEEKOFYEAR','Syntax\n------ \nWEEKOFYEAR(date)\n \nDescription\n----------- \nReturns the calendar week of the date as a number in the\nrange from 1\nto 53. WEEKOFYEAR() is a compatibility function that is\nequivalent to\nWEEK(date,3).\n \nExamples\n-------- \nSELECT WEEKOFYEAR(\'2008-02-20\');\n+--------------------------+\n| WEEKOFYEAR(\'2008-02-20\') |\n+--------------------------+\n| 8 |\n+--------------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n (\"2007-01-30 21:31:07\"),\n (\"1983-10-15 06:42:51\"),\n (\"2011-04-21 12:34:56\"),\n (\"2011-10-30 06:31:41\"),\n (\"2011-01-30 14:03:25\"),\n (\"2004-10-07 11:19:34\");\n \n select * from t1;\n \n+---------------------+\n| d |\n+---------------------+\n| 2007-01-30 21:31:07 |\n| 1983-10-15 06:42:51 |\n| 2011-04-21 12:34:56 |\n| 2011-10-30 06:31:41 |\n| 2011-01-30 14:03:25 |\n| 2004-10-07 11:19:34 |\n+---------------------+\n \nSELECT d, WEEKOFYEAR(d), WEEK(d,3) from t1;\n \n+---------------------+---------------+-----------+\n| d | WEEKOFYEAR(d) | WEEK(d,3) |\n+---------------------+---------------+-----------+\n| 2007-01-30 21:31:07 | 5 | 5 |\n| 1983-10-15 06:42:51 | 41 | 41 |\n| 2011-04-21 12:34:56 | 16 | 16 |\n| 2011-10-30 06:31:41 | 43 | 43 |\n| 2011-01-30 14:03:25 | 4 | 4 |\n| 2004-10-07 11:19:34 | 41 | 41 |\n+---------------------+---------------+-----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/weekofyear/','','https://mariadb.com/kb/en/library/weekofyear/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (523,31,'YEAR','Syntax\n------ \nYEAR(date)\n \nDescription\n----------- \nReturns the year for the given date, in the range 1000 to\n9999, or 0 for the\n\"zero\" date.\n \nExamples\n-------- \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n (\"2007-01-30 21:31:07\"),\n (\"1983-10-15 06:42:51\"),\n (\"2011-04-21 12:34:56\"),\n (\"2011-10-30 06:31:41\"),\n (\"2011-01-30 14:03:25\"),\n (\"2004-10-07 11:19:34\");\n \nSELECT * FROM t1;\n \n+---------------------+\n| d |\n+---------------------+\n| 2007-01-30 21:31:07 |\n| 1983-10-15 06:42:51 |\n| 2011-04-21 12:34:56 |\n| 2011-10-30 06:31:41 |\n| 2011-01-30 14:03:25 |\n| 2004-10-07 11:19:34 |\n+---------------------+\n \nSELECT * FROM t1 WHERE YEAR(d) = 2011;\n \n+---------------------+\n| d |\n+---------------------+\n| 2011-04-21 12:34:56 |\n| 2011-10-30 06:31:41 |\n| 2011-01-30 14:03:25 |\n+---------------------+\n \nSELECT YEAR(\'1987-01-01\');\n+--------------------+\n| YEAR(\'1987-01-01\') |\n+--------------------+\n| 1987 |\n+--------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/year/','','https://mariadb.com/kb/en/library/year/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (524,31,'YEARWEEK','Syntax\n------ \nYEARWEEK(date), YEARWEEK(date,mode)\n \nDescription\n----------- \nReturns year and week for a date. The mode argument works\nexactly like the mode\nargument to WEEK(). The year in the result may be different\nfrom the\nyear in the date argument for the first and the last week of\nthe year.\n \nExamples\n-------- \nSELECT YEARWEEK(\'1987-01-01\');\n+------------------------+\n| YEARWEEK(\'1987-01-01\') |\n+------------------------+\n| 198652 |\n+------------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n (\"2007-01-30 21:31:07\"),\n (\"1983-10-15 06:42:51\"),\n (\"2011-04-21 12:34:56\"),\n (\"2011-10-30 06:31:41\"),\n (\"2011-01-30 14:03:25\"),\n (\"2004-10-07 11:19:34\");\n \nSELECT * FROM t1;\n \n+---------------------+\n| d |\n+---------------------+\n| 2007-01-30 21:31:07 |\n| 1983-10-15 06:42:51 |\n| 2011-04-21 12:34:56 |\n| 2011-10-30 06:31:41 |\n| 2011-01-30 14:03:25 |\n| 2004-10-07 11:19:34 |\n+---------------------+\n6 rows in set (0.02 sec)\n \nSELECT YEARWEEK(d) FROM t1 WHERE YEAR(d) = 2011;\n \n+-------------+\n| YEARWEEK(d) |\n+-------------+\n| 201116 |\n| 201144 |\n| 201105 |\n+-------------+\n3 rows in set (0.03 sec)\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/yearweek/','','https://mariadb.com/kb/en/library/yearweek/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (525,32,'Well-Known Binary (WKB) Format','WKB stands for Well-Known Binary, a format for representing\ngeographical and geometrical data.\n \nWKB uses 1-byte unsigned integers, 4-byte unsigned integers,\nand 8-byte double-precision numbers.\nThe first byte indicates the byte order. 00 for big endian,\nor 01 for little endian.\nThe next 4 bytes indicate the geometry type. Values from 1\nto 7 indicate whether the type is Point, LineString,\nPolygon, MultiPoint, MultiLineString, MultiPolygon, or\nGeometryCollection respectively. \nThe 8-byte floats represent the co-ordinates.\n \nTake the following example, a sequence of 21 bytes each\nrepresented by two hex digits:\n \n000000000140000000000000004010000000000000\nIt\'s big endian\n000000000140000000000000004010000000000000\n \nIt\'s a POINT\n000000000140000000000000004010000000000000\n \nThe X co-ordinate is 2.0\n000000000140000000000000004010000000000000\n \nThe Y-co-ordinate is 4.0\n000000000140000000000000004010000000000000\n \n\n \n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/well-known-binary-wkb-format/','','https://mariadb.com/kb/en/library/well-known-binary-wkb-format/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (526,32,'AsBinary','A synonym for ST_AsBinary().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/wkb-asbinary/','','https://mariadb.com/kb/en/library/wkb-asbinary/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (527,32,'AsWKB','A synonym for ST_AsBinary().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/aswkb/','','https://mariadb.com/kb/en/library/aswkb/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (528,32,'MLineFromWKB','Syntax\n------ \nMLineFromWKB(wkb[,srid])\nMultiLineStringFromWKB(wkb[,srid])\n \nDescription\n----------- \nConstructs a MULTILINESTRING value using its WKB\nrepresentation and SRID.\n \nMLineFromWKB() and MultiLineStringFromWKB() are synonyms.\n \nExamples\n-------- \nSET @g = ST_AsBinary(MLineFromText(\'MULTILINESTRING((10\n48,10 21,10 0),(16 0,16 23,16 48))\'));\n \nSELECT ST_AsText(MLineFromWKB(@g));\n+--------------------------------------------------------+\n| ST_AsText(MLineFromWKB(@g)) |\n+--------------------------------------------------------+\n| MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48)) |\n+--------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/mlinefromwkb/','','https://mariadb.com/kb/en/library/mlinefromwkb/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (529,32,'MPointFromWKB','Syntax\n------ \nMPointFromWKB(wkb[,srid])\nMultiPointFromWKB(wkb[,srid])\n \nDescription\n----------- \nConstructs a MULTIPOINT value using its WKB representation\nand SRID.\n \nMPointFromWKB() and MultiPointFromWKB() are synonyms.\n \nExamples\n-------- \nSET @g = ST_AsBinary(MPointFromText(\'MultiPoint( 1 1, 2 2,\n5 3, 7 2, 9 3, 8 4, 6 6, 6 9, 4 9, 1 5 )\'));\n \nSELECT ST_AsText(MPointFromWKB(@g));\n+-----------------------------------------------------+\n| ST_AsText(MPointFromWKB(@g)) |\n+-----------------------------------------------------+\n| MULTIPOINT(1 1,2 2,5 3,7 2,9 3,8 4,6 6,6 9,4 9,1 5) |\n+-----------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/mpointfromwkb/','','https://mariadb.com/kb/en/library/mpointfromwkb/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (530,32,'MPolyFromWKB','Syntax\n------ \nMPolyFromWKB(wkb[,srid])\nMultiPolygonFromWKB(wkb[,srid])\n \nDescription\n----------- \nConstructs a MULTIPOLYGON value using its WKB representation\nand SRID.\n \nMPolyFromWKB() and MultiPolygonFromWKB() are synonyms.\n \nExamples\n-------- \nSET @g = ST_AsBinary(MPointFromText(\'MULTIPOLYGON(((28\n26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52\n18)),((59 18,67 18,67 13,59 13,59 18)))\'));\n \nSELECT ST_AsText(MPolyFromWKB(@g));\n+---------------------------------------------------------------------------------------------------------------+\n| ST_AsText(MPolyFromWKB(@g)) |\n+---------------------------------------------------------------------------------------------------------------+\n| MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66\n23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) |\n+---------------------------------------------------------------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/mpolyfromwkb/','','https://mariadb.com/kb/en/library/mpolyfromwkb/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (531,32,'GeomCollFromWKB','A synonym for ST_GeomCollFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/wkb-geomcollfromwkb/','','https://mariadb.com/kb/en/library/wkb-geomcollfromwkb/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (532,32,'GeometryCollectionFromWKB','A synonym for ST_GeomCollFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/geometrycollectionfromwkb/','','https://mariadb.com/kb/en/library/geometrycollectionfromwkb/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (533,32,'GeometryFromWKB','A synonym for ST_GeomFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/geometryfromwkb/','','https://mariadb.com/kb/en/library/geometryfromwkb/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (534,32,'GeomFromWKB','A synonym for ST_GeomFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/wkb-geomfromwkb/','','https://mariadb.com/kb/en/library/wkb-geomfromwkb/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (535,32,'LineFromWKB','A synonym for ST_LineFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/wkb-linefromwkb/','','https://mariadb.com/kb/en/library/wkb-linefromwkb/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (536,32,'LineStringFromWKB','A synonym for ST_LineFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/linestringfromwkb/','','https://mariadb.com/kb/en/library/linestringfromwkb/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (537,32,'MultiLineStringFromWKB','A synonym for MLineFromWKB().\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/multilinestringfromwkb/','','https://mariadb.com/kb/en/library/multilinestringfromwkb/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (538,32,'MultiPointFromWKB','A synonym for MPointFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/multipointfromwkb/','','https://mariadb.com/kb/en/library/multipointfromwkb/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (539,32,'MultiPolygonFromWKB','Synonym for MPolyFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/multipolygonfromwkb/','','https://mariadb.com/kb/en/library/multipolygonfromwkb/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (540,32,'PointFromWKB','A synonym for ST_PointFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/wkb-pointfromwkb/','','https://mariadb.com/kb/en/library/wkb-pointfromwkb/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (541,32,'PolyFromWKB','A synonym for ST_PolyFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/wkb-polyfromwkb/','','https://mariadb.com/kb/en/library/wkb-polyfromwkb/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (542,32,'PolygonFromWKB','A synonym for ST_PolyFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/polygonfromwkb/','','https://mariadb.com/kb/en/library/polygonfromwkb/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (543,32,'ST_AsBinary','Syntax\n------ \nST_AsBinary(g)\nAsBinary(g)\nST_AsWKB(g)\nAsWKB(g)\n \nDescription\n----------- \nConverts a value in internal geometry format to its WKB\nrepresentation and returns the binary result.\n \nST_AsBinary(), AsBinary(), ST_AsWKB() and AsWKB() are\nsynonyms,\n \nExamples\n-------- \nSET @poly = ST_GeomFromText(\'POLYGON((0 0,0 1,1 1,1 0,0\n0))\');\nSELECT ST_AsBinary(@poly);\n \nSELECT ST_AsText(ST_GeomFromWKB(ST_AsWKB(@poly)));\n+--------------------------------------------+\n| ST_AsText(ST_GeomFromWKB(ST_AsWKB(@poly))) |\n+--------------------------------------------+\n| POLYGON((0 0,0 1,1 1,1 0,0 0)) |\n+--------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_asbinary/','','https://mariadb.com/kb/en/library/st_asbinary/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (544,32,'ST_AsWKB','A synonym for ST_AsBinary().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_aswkb/','','https://mariadb.com/kb/en/library/st_aswkb/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (545,32,'ST_GeomCollFromWKB','Syntax\n------ \nST_GeomCollFromWKB(wkb[,srid])\nST_GeometryCollectionFromWKB(wkb[,srid])\nGeomCollFromWKB(wkb[,srid])\nGeometryCollectionFromWKB(wkb[,srid])\n \nDescription\n----------- \nConstructs a GEOMETRYCOLLECTION value using its WKB\nrepresentation and SRID.\n \nST_GeomCollFromWKB(), ST_GeometryCollectionFromWKB(),\nGeomCollFromWKB() and GeometryCollectionFromWKB() are\nsynonyms.\n \nExamples\n-------- \nSET @g =\nST_AsBinary(ST_GeomFromText(\'GEOMETRYCOLLECTION(POLYGON((5\n5,10 5,10 10,5 5)),POINT(10 10))\'));\n \nSELECT ST_AsText(ST_GeomCollFromWKB(@g));\n+----------------------------------------------------------------+\n| ST_AsText(ST_GeomCollFromWKB(@g)) |\n+----------------------------------------------------------------+\n| GEOMETRYCOLLECTION(POLYGON((5 5,10 5,10 10,5 5)),POINT(10\n10)) |\n+----------------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_geomcollfromwkb/','','https://mariadb.com/kb/en/library/st_geomcollfromwkb/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (546,32,'ST_GeometryCollectionFromWKB','A synonym for ST_GeomCollFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/st_geometrycollectionfromwkb/','','https://mariadb.com/kb/en/library/st_geometrycollectionfromwkb/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (547,32,'ST_GeometryFromWKB','A synonym for ST_GeomFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_geometryfromwkb/','','https://mariadb.com/kb/en/library/st_geometryfromwkb/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (548,32,'ST_GeomFromWKB','Syntax\n------ \nST_GeomFromWKB(wkb[,srid])\nST_GeometryFromWKB(wkb[,srid])\nGeomFromWKB(wkb[,srid])\nGeometryFromWKB(wkb[,srid])\n \nDescription\n----------- \nConstructs a geometry value of any type using its WKB\nrepresentation and SRID.\n \nST_GeomFromWKB(), ST_GeometryFromWKB(), GeomFromWKB() and\nGeometryFromWKB() are synonyms.\n \nExamples\n-------- \nSET @g = ST_AsBinary(ST_LineFromText(\'LINESTRING(0 4, 4\n6)\'));\n \nSELECT ST_AsText(ST_GeomFromWKB(@g));\n+-------------------------------+\n| ST_AsText(ST_GeomFromWKB(@g)) |\n+-------------------------------+\n| LINESTRING(0 4,4 6) |\n+-------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_geomfromwkb/','','https://mariadb.com/kb/en/library/st_geomfromwkb/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (549,32,'ST_LineFromWKB','Syntax\n------ \nST_LineFromWKB(wkb[,srid])\nLineFromWKB(wkb[,srid])\nST_LineStringFromWKB(wkb[,srid])\nLineStringFromWKB(wkb[,srid])\n \nDescription\n----------- \nConstructs a LINESTRING value using its WKB representation\nand SRID.\n \nST_LineFromWKB(), LineFromWKB(), ST_LineStringFromWKB(), and\nLineStringFromWKB() are synonyms.\n \nExamples\n-------- \nSET @g = ST_AsBinary(ST_LineFromText(\'LineString(0 4,4\n6)\'));\n \nSELECT ST_AsText(ST_LineFromWKB(@g)) AS l;\n \n+---------------------+\n| l |\n+---------------------+\n| LINESTRING(0 4,4 6) |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_linefromwkb/','','https://mariadb.com/kb/en/library/st_linefromwkb/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (550,32,'ST_LineStringFromWKB','A synonym for ST_LineFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_linestringfromwkb/','','https://mariadb.com/kb/en/library/st_linestringfromwkb/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (551,32,'ST_PointFromWKB','Syntax\n------ \nST_PointFromWKB(wkb[,srid])\nPointFromWKB(wkb[,srid])\n \nDescription\n----------- \nConstructs a POINT value using its WKB representation and\nSRID.\n \nST_PointFromWKB() and PointFromWKB() are synonyms.\n \nExamples\n-------- \nSET @g = ST_AsBinary(ST_PointFromText(\'POINT(0 4)\'));\n \nSELECT ST_AsText(ST_PointFromWKB(@g)) AS p;\n \n+------------+\n| p |\n+------------+\n| POINT(0 4) |\n+------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_pointfromwkb/','','https://mariadb.com/kb/en/library/st_pointfromwkb/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (552,32,'ST_PolyFromWKB','Syntax\n------ \nST_PolyFromWKB(wkb[,srid])\nST_PolygonFromWKB(wkb[,srid])\nPolyFromWKB(wkb[,srid])\nPolygonFromWKB(wkb[,srid])\n \nDescription\n----------- \nConstructs a POLYGON value using its WKB representation and\nSRID.\n \nST_PolyFromWKB(), ST_PolygonFromWKB(), PolyFromWKB() and\nPolygonFromWKB() are synonyms.\n \nExamples\n-------- \nSET @g = ST_AsBinary(ST_PolyFromText(\'POLYGON((1 1,1 5,4\n9,6 9,9 3,7 2,1 1))\'));\n \nSELECT ST_AsText(ST_PolyFromWKB(@g)) AS p;\n \n+----------------------------------------+\n| p |\n+----------------------------------------+\n| POLYGON((1 1,1 5,4 9,6 9,9 3,7 2,1 1)) |\n+----------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_polyfromwkb/','','https://mariadb.com/kb/en/library/st_polyfromwkb/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (553,32,'ST_PolygonFromWKB','A synonym for ST_PolyFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_polygonfromwkb/','','https://mariadb.com/kb/en/library/st_polygonfromwkb/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (554,36,'BOUNDARY','A synonym for ST_BOUNDARY.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/geometry-properties-boundary/','','https://mariadb.com/kb/en/library/geometry-properties-boundary/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (555,36,'DIMENSION','A synonym for ST_DIMENSION.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/dimension/','','https://mariadb.com/kb/en/library/dimension/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (556,36,'ENVELOPE','A synonym for ST_ENVELOPE.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/geometry-properties-envelope/','','https://mariadb.com/kb/en/library/geometry-properties-envelope/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (557,36,'GeometryN','A synonym for ST_GeometryN.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/geometry-properties-geometryn/','','https://mariadb.com/kb/en/library/geometry-properties-geometryn/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (558,36,'GeometryType','A synonym for ST_GeometryType.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/geometry-properties-geometrytype/','','https://mariadb.com/kb/en/library/geometry-properties-geometrytype/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (559,36,'IsClosed','A synonym for ST_IsClosed.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/isclosed/','','https://mariadb.com/kb/en/library/isclosed/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (560,36,'IsEmpty','A synonym for ST_IsEmpty.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/geometry-properties-isempty/','','https://mariadb.com/kb/en/library/geometry-properties-isempty/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (561,36,'IsRing','A synonym for ST_IsRing.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/isring/','','https://mariadb.com/kb/en/library/isring/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (562,36,'IsSimple','A synonym for ST_IsSImple.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/geometry-properties-issimple/','','https://mariadb.com/kb/en/library/geometry-properties-issimple/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (563,36,'NumGeometries','A synonym for ST_NumGeometries.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/geometry-properties-numgeometries/','','https://mariadb.com/kb/en/library/geometry-properties-numgeometries/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (564,36,'SRID','A synonym for ST_SRID.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/geometry-properties-srid/','','https://mariadb.com/kb/en/library/geometry-properties-srid/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (565,36,'ST_BOUNDARY','The ST_BOUNDARY function was introduced in MariaDB 10.1.2\n \nSyntax\n------ \nST_BOUNDARY(g)\nBOUNDARY(g)\n \nDescription\n----------- \nReturns a geometry that is the closure of the combinatorial\nboundary of the geometry value g.\n \nBOUNDARY() is a synonym.\n \nExamples\n-------- \nSELECT ST_AsText(ST_Boundary(ST_GeomFromText(\'LINESTRING(3\n3,0 0, -3 3)\')));\n+----------------------------------------------------------------------+\n| ST_AsText(ST_Boundary(ST_GeomFromText(\'LINESTRING(3 3,0\n0, -3 3)\'))) |\n+----------------------------------------------------------------------+\n| MULTIPOINT(3 3,-3 3) |\n+----------------------------------------------------------------------+\n \nSELECT ST_AsText(ST_Boundary(ST_GeomFromText(\'POLYGON((3\n3,0 0, -3 3, 3 3))\')));\n+--------------------------------------------------------------------------+\n| ST_AsText(ST_Boundary(ST_GeomFromText(\'POLYGON((3 3,0 0,\n-3 3, 3 3))\'))) |\n+--------------------------------------------------------------------------+\n| LINESTRING(3 3,0 0,-3 3,3 3) |\n+--------------------------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_boundary/','','https://mariadb.com/kb/en/library/st_boundary/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (566,36,'ST_DIMENSION','Syntax\n------ \nST_Dimension(g)\nDimension(g)\n \nDescription\n----------- \nReturns the inherent dimension of the geometry value g. The\nresult can\nbe\n \nDimension | Definition | \n \n -1 | empty geometry | \n \n 0 | geometry with no length or area | \n \n 1 | geometry with no area but nonzero length | \n \n 2 | geometry with nonzero area | \n \nST_Dimension() and Dimension() are synonyms.\n \nExamples\n-------- \nSELECT Dimension(GeomFromText(\'LineString(1 1,2 2)\'));\n+------------------------------------------------+\n| Dimension(GeomFromText(\'LineString(1 1,2 2)\')) |\n+------------------------------------------------+\n| 1 |\n+------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_dimension/','','https://mariadb.com/kb/en/library/st_dimension/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (567,36,'ST_ENVELOPE','Syntax\n------ \nST_ENVELOPE(g)\nENVELOPE(g)\n \nDescription\n----------- \nReturns the Minimum Bounding Rectangle (MBR) for the\ngeometry value g. The result is returned as a Polygon value.\n \nThe polygon is defined by the corner points of the bounding\nbox:\n \nPOLYGON((MINX MINY, MAXX MINY, MAXX MAXY, MINX MAXY, MINX\nMINY))\n \nST_ENVELOPE() and ENVELOPE() are synonyms.\n \nExamples\n-------- \nSELECT AsText(ST_ENVELOPE(GeomFromText(\'LineString(1 1,4\n4)\')));\n+----------------------------------------------------------+\n| AsText(ST_ENVELOPE(GeomFromText(\'LineString(1 1,4 4)\')))\n|\n+----------------------------------------------------------+\n| POLYGON((1 1,4 1,4 4,1 4,1 1)) |\n+----------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_envelope/','','https://mariadb.com/kb/en/library/st_envelope/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (568,36,'ST_GEOMETRYN','Syntax\n------ \nST_GeometryN(gc,N)\nGeometryN(gc,N)\n \nDescription\n----------- \nReturns the N-th geometry in the GeometryCollection gc.\nGeometries are numbered beginning with 1.\n \nST_GeometryN() and GeometryN() are synonyms.\n \nExample\n \nSET @gc = \'GeometryCollection(Point(1 1),LineString(12 14,\n9 11))\';\n \nSELECT AsText(GeometryN(GeomFromText(@gc),1));\n+----------------------------------------+\n| AsText(GeometryN(GeomFromText(@gc),1)) |\n+----------------------------------------+\n| POINT(1 1) |\n+----------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_geometryn/','','https://mariadb.com/kb/en/library/st_geometryn/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (569,36,'ST_GEOMETRYTYPE','Syntax\n------ \nST_GeometryType(g)\nGeometryType(g)\n \nDescription\n----------- \nReturns as a string the name of the geometry type of which\nthe\ngeometry instance g is a member. The name corresponds to one\nof the\ninstantiable Geometry subclasses.\n \nST_GeometryType() and GeometryType() are synonyms.\n \nExamples\n-------- \nSELECT GeometryType(GeomFromText(\'POINT(1 1)\'));\n+------------------------------------------+\n| GeometryType(GeomFromText(\'POINT(1 1)\')) |\n+------------------------------------------+\n| POINT |\n+------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_geometrytype/','','https://mariadb.com/kb/en/library/st_geometrytype/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (570,36,'ST_ISCLOSED','Syntax\n------ \nST_IsClosed(g)\nIsClosed(g)\n \nDescription\n----------- \nReturns 1 if a given LINESTRING\'s start and end points are\nthe same, or 0 if they are not the same. Before MariaDB\n10.1.5, returns NULL if not given a LINESTRING. After\nMariaDB 10.1.5, returns -1.\n \nST_IsClosed() and IsClosed() are synonyms.\n \nExamples\n-------- \nSET @ls = \'LineString(0 0, 0 4, 4 4, 0 0)\';\n \nSELECT ST_ISCLOSED(GEOMFROMTEXT(@ls));\n+--------------------------------+\n| ST_ISCLOSED(GEOMFROMTEXT(@ls)) |\n+--------------------------------+\n| 1 |\n+--------------------------------+\n \nSET @ls = \'LineString(0 0, 0 4, 4 4, 0 1)\';\n \nSELECT ST_ISCLOSED(GEOMFROMTEXT(@ls));\n+--------------------------------+\n| ST_ISCLOSED(GEOMFROMTEXT(@ls)) |\n+--------------------------------+\n| 0 |\n+--------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_isclosed/','','https://mariadb.com/kb/en/library/st_isclosed/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (571,36,'ST_ISEMPTY','Syntax\n------ \nST_IsEmpty(g)\nIsEmpty(g)\n \nDescription\n----------- \nIsEmpty is a function defined by the OpenGIS specification,\nbut is not fully implemented by MariaDB or MySQL. \n \nSince MariaDB and MySQL do not support GIS EMPTY values such\nas POINT EMPTY, as implemented it simply returns 1 if the\ngeometry value g is invalid, 0 if it is valid, and NULL if\nthe argument is NULL.\n \nST_IsEmpty() and IsEmpty() are synonyms.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_isempty/','','https://mariadb.com/kb/en/library/st_isempty/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (572,36,'ST_IsRing','The ST_IsRing function was introduced in MariaDB 10.1.2\n \nSyntax\n------ \nST_IsRing(g)\nIsRing(g)\n \nDescription\n----------- \nReturns true if a given LINESTRING is a ring, that is, both\nST_IsClosed and ST_IsSimple. A simple curve does not pass\nthrough the same point more than once. However, see\nMDEV-7510.\n \nSt_IsRing() and IsRing() are synonyms.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_isring/','','https://mariadb.com/kb/en/library/st_isring/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (573,36,'ST_IsSimple','Syntax\n------ \nST_IsSimple(g)\nIsSimple(g)\n \nDescription\n----------- \nReturns true if the given Geometry has no anomalous\ngeometric points, false if it does, or NULL if given a NULL\nvalue.\n \nST_IsSimple() and IsSimple() are synonyms.\n \nExamples\n-------- \nA POINT is always simple.\n \nSET @g = \'Point(1 2)\';\n \nSELECT ST_ISSIMPLE(GEOMFROMTEXT(@g));\n+-------------------------------+\n| ST_ISSIMPLE(GEOMFROMTEXT(@g)) |\n+-------------------------------+\n| 1 |\n+-------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_issimple/','','https://mariadb.com/kb/en/library/st_issimple/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (574,36,'ST_NUMGEOMETRIES','Syntax\n------ \nST_NumGeometries(gc)\nNumGeometries(gc)\n \nDescription\n----------- \nReturns the number of geometries in the GeometryCollection\ngc.\n \nST_NumGeometries() and NumGeometries() are synonyms.\n \nExample\n \nSET @gc = \'GeometryCollection(Point(1 1),LineString(2 2, 3\n3))\';\n \nSELECT NUMGEOMETRIES(GeomFromText(@gc));\n+----------------------------------+\n| NUMGEOMETRIES(GeomFromText(@gc)) |\n+----------------------------------+\n| 2 |\n+----------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_numgeometries/','','https://mariadb.com/kb/en/library/st_numgeometries/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (575,36,'ST_RELATE','The ST_RELATE() function was introduced in MariaDB 10.1.2\n \nSyntax\n------ \nST_Relate(g1, g2, i)\n \nDescription\n----------- \nReturns true if Geometry g1 is spatially related to\nGeometryg2 by testing for intersections between the\ninterior, boundary and exterior of the two geometries as\nspecified by the values in intersection matrix pattern i.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_relate/','','https://mariadb.com/kb/en/library/st_relate/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (576,36,'ST_SRID','Syntax\n------ \nST_SRID(g)\nSRID(g)\n \nDescription\n----------- \nReturns an integer indicating the Spatial Reference System\nID for the\ngeometry value g.\n \nIn MariaDB, the SRID value is just an integer associated\nwith the\ngeometry value. All calculations are done assuming Euclidean\n(planar)\ngeometry.\n \nST_SRID() and SRID() are synonyms.\n \nExamples\n-------- \nSELECT SRID(GeomFromText(\'LineString(1 1,2 2)\',101));\n+-----------------------------------------------+\n| SRID(GeomFromText(\'LineString(1 1,2 2)\',101)) |\n+-----------------------------------------------+\n| 101 |\n+-----------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_srid/','','https://mariadb.com/kb/en/library/st_srid/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (577,37,'ASCII','Syntax\n------ \nASCII(str)\n \nDescription\n----------- \nReturns the numeric ASCII value of the leftmost character of\nthe string argument. Returns 0 if the given string is empty\nand NULL if it is NULL.\n \nASCII() works for 8-bit characters.\n \nExamples\n-------- \nSELECT ASCII(9);\n+----------+\n| ASCII(9) |\n+----------+\n| 57 |\n+----------+\n \nSELECT ASCII(\'9\');\n+------------+\n| ASCII(\'9\') |\n+------------+\n| 57 |\n+------------+\n \nSELECT ASCII(\'abc\');\n+--------------+\n| ASCII(\'abc\') |\n+--------------+\n| 97 |\n+--------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/ascii/','','https://mariadb.com/kb/en/library/ascii/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (578,37,'BIN','Syntax\n------ \nBIN(N)\n \nDescription\n----------- \nReturns a string representation of the binary value of the\ngiven longlong (that is, BIGINT) number. This is equivalent\nto CONV(N,10,2). The argument should be positive. If it is a\nFLOAT, it will be truncated. Returns NULL if the argument is\nNULL.\n \nExamples\n-------- \nSELECT BIN(12);\n+---------+\n| BIN(12) |\n+---------+\n| 1100 |\n+---------+\n \n\n\nURL: https://mariadb.com/kb/en/library/bin/','','https://mariadb.com/kb/en/library/bin/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (579,37,'BINARY Operator','Syntax\n------ \nBINARY\n \nDescription\n----------- \nThe BINARY operator casts the string following it to a\nbinary string. This is an easy way to force a column\ncomparison to be done byte by byte rather than character by\ncharacter. This causes the comparison to be case sensitive\neven if the column isn\'t defined as BINARY or BLOB. \n \nBINARY also causes trailing spaces to be significant.\n \nExamples\n-------- \nSELECT \'a\' = \'A\';\n \n+-----------+\n| \'a\' = \'A\' |\n+-----------+\n| 1 |\n+-----------+\n \nSELECT BINARY \'a\' = \'A\';\n \n+------------------+\n| BINARY \'a\' = \'A\' |\n+------------------+\n| 0 |\n+------------------+\n \nSELECT \'a\' = \'a \';\n \n+------------+\n| \'a\' = \'a \' |\n+------------+\n| 1 |\n+------------+\n \nSELECT BINARY \'a\' = \'a \';\n \n+-------------------+\n| BINARY \'a\' = \'a \' |\n+-------------------+\n| 0 |\n+-------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/binary-operator/','','https://mariadb.com/kb/en/library/binary-operator/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (580,37,'BIT_LENGTH','Syntax\n------ \nBIT_LENGTH(str)\n \nDescription\n----------- \nReturns the length of the given string argument in bits. If\nthe argument is not a string, it will be converted to\nstring. If the argument is NULL, it returns NULL.\n \nExamples\n-------- \nSELECT BIT_LENGTH(\'text\');\n+--------------------+\n| BIT_LENGTH(\'text\') |\n+--------------------+\n| 32 |\n+--------------------+\n \nSELECT BIT_LENGTH(\'\');\n+----------------+\n| BIT_LENGTH(\'\') |\n+----------------+\n| 0 |\n+----------------+\n \nCompatibility\n \nPostgreSQL and Sybase support BIT_LENGTH().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/bit_length/','','https://mariadb.com/kb/en/library/bit_length/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (581,37,'CAST','Syntax\n------ \nCAST(expr AS type)\n \nDescription\n----------- \nThe CAST() function takes a value of one type and produces a\nvalue of another type, similar to the CONVERT() function.\nFor more information, see the description of CONVERT(). \n \nThe main difference between the CAST() and CONVERT() is that\nCONVERT(expr,type) is ODBC syntax while CAST(expr as type)\nand CONVERT(... USING ...) are SQL92 syntax.\n \nIn MariaDB 10.4 and later, you can use the CAST() function\nwith the INTERVAL keyword.\n \nUntil MariaDB 5.5.31, X\'HHHH\', the standard SQL syntax for\nbinary string literals, erroneously worked in the same way\nas 0xHHHH. In 5.5.31 it was intentionally changed to behave\nas a string in all contexts (and never as a number).\n \nThis introduces an incompatibility with previous versions of\nMariaDB, and all versions of MySQL (see the example below). \n \nExamples\n-------- \nSimple casts:\n \nSELECT CAST(\"abc\" AS BINARY);\nSELECT CAST(\"1\" AS UNSIGNED INTEGER);\nSELECT CAST(123 AS CHAR CHARACTER SET utf8)\n \nNote that when one casts to CHAR without specifying the\ncharacter set, the collation_connection character set\ncollation will be used. When used with CHAR CHARACTER SET,\nthe default collation for that character set will be used.\n \nSELECT COLLATION(CAST(123 AS CHAR));\n+------------------------------+\n| COLLATION(CAST(123 AS CHAR)) |\n+------------------------------+\n| latin1_swedish_ci |\n+------------------------------+\n \nSELECT COLLATION(CAST(123 AS CHAR CHARACTER SET utf8));\n+-------------------------------------------------+\n| COLLATION(CAST(123 AS CHAR CHARACTER SET utf8)) |\n+-------------------------------------------------+\n| utf8_general_ci |\n+-------------------------------------------------+\n \nIf you also want to change the collation, you have to use\nthe COLLATE operator:\n \nSELECT COLLATION(CAST(123 AS CHAR CHARACTER SET utf8) \n COLLATE utf8_unicode_ci);\n+-------------------------------------------------------------------------+\n| COLLATION(CAST(123 AS CHAR CHARACTER SET utf8) COLLATE\nutf8_unicode_ci) |\n+-------------------------------------------------------------------------+\n| utf8_unicode_ci |\n+-------------------------------------------------------------------------+\n \nUsing CAST() to order an ENUM field as a CHAR rather than\nthe internal numerical value:\n \nCREATE TABLE enum_list (enum_field enum(\'c\',\'a\',\'b\'));\n \nINSERT INTO enum_list (enum_field) \nVALUES(\'c\'),(\'a\'),(\'c\'),(\'b\');\n \nSELECT * FROM enum_list \nORDER BY enum_field;\n \n+------------+\n| enum_field |\n+------------+\n| c |\n| c |\n| a |\n| b |\n+------------+\n \nSELECT * FROM enum_list \nORDER BY CAST(enum_field AS CHAR);\n+------------+\n| enum_field |\n+------------+\n| a |\n| b |\n| c |\n| c |\n+------------+\n \nFrom MariaDB 5.5.31, the following will trigger warnings,\nsince x\'aa\' and \'X\'aa\' no longer behave as a number.\nPreviously, and in all versions of MySQL, no warnings are\ntriggered since they did erroneously behave as a number:\n \nSELECT CAST(0xAA AS UNSIGNED), CAST(x\'aa\' AS UNSIGNED),\nCAST(X\'aa\' AS UNSIGNED);\n+------------------------+-------------------------+-------------------------+\n| CAST(0xAA AS UNSIGNED) | CAST(x\'aa\' AS UNSIGNED) |\nCAST(X\'aa\' AS UNSIGNED) |\n+------------------------+-------------------------+-------------------------+\n| 170 | 0 | 0 |\n+------------------------+-------------------------+-------------------------+\n1 row in set, 2 warnings (0.00 sec)\n \nWarning (Code 1292): Truncated incorrect INTEGER value:\n\'\\xAA\'\nWarning (Code 1292): Truncated incorrect INTEGER value:\n\'\\xAA\'\n \nCasting to intervals:\n \nSELECT CAST(2019-01-04 INTERVAL AS DAY_SECOND(2)) AS\n\"Cast\";\n \n+-------------+\n| Cast |\n+-------------+\n| 00:20:17.00 |\n+-------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/cast/','','https://mariadb.com/kb/en/library/cast/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (582,37,'CHAR Function','Syntax\n------ \nCHAR(N,... [USING charset_name])\n \nDescription\n----------- \nCHAR() interprets each argument as an INT and returns a\nstring consisting of the characters given by the code values\nof those integers. NULL values are skipped. By default,\nCHAR() returns a binary string. To produce a string in a\ngiven character set, use the optional USING clause:\n \nSELECT 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\ngiven character set, a warning is issued. Also, if strict\nSQL mode is enabled, the result from CHAR() becomes NULL.\n \nExamples\n-------- \nSELECT CHAR(77,97,114,\'105\',97,\'68\',66);\n+----------------------------------+\n| CHAR(77,97,114,\'105\',97,\'68\',66) |\n+----------------------------------+\n| MariaDB |\n+----------------------------------+\n \nSELECT CHAR(77,77.3,\'77.3\');\n+----------------------+\n| CHAR(77,77.3,\'77.3\') |\n+----------------------+\n| MMM |\n+----------------------+\n1 row in set, 1 warning (0.00 sec)\n \nWarning (Code 1292): Truncated incorrect INTEGER value:\n\'77.3\'\n \n\n\nURL: https://mariadb.com/kb/en/library/char-function/','','https://mariadb.com/kb/en/library/char-function/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (583,37,'CHARACTER_LENGTH','Syntax\n------ \nCHARACTER_LENGTH(str)\n \nDescription\n----------- \nCHARACTER_LENGTH() is a synonym for CHAR_LENGTH().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/character_length/','','https://mariadb.com/kb/en/library/character_length/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (584,37,'CHAR_LENGTH','Syntax\n------ \nCHAR_LENGTH(str)\n \nDescription\n----------- \nReturns the length of the given string argument, measured in\ncharacters. A multi-byte character counts as a single\ncharacter. This means that for a string containing five\ntwo-byte characters, LENGTH() (or OCTET_LENGTH() in Oracle\nmode) returns 10, whereas CHAR_LENGTH() returns 5. If the\nargument is NULL, it returns NULL. \n \nIf the argument is not a string value, it is converted into\na string.\n \nIt is synonymous with the CHARACTER_LENGTH() function.\n \nUntil MariaDB 10.3.1, returns MYSQL_TYPE_LONGLONG, or\nbigint(10), in all cases. From MariaDB 10.3.1, returns\nMYSQL_TYPE_LONG, or int(10), when the result would fit\nwithin 32-bits.\n \nExamples\n-------- \nSELECT CHAR_LENGTH(\'MariaDB\');\n+------------------------+\n| CHAR_LENGTH(\'MariaDB\') |\n+------------------------+\n| 7 |\n+------------------------+\n \nSELECT CHAR_LENGTH(\'Ï€\');\n+-------------------+\n| CHAR_LENGTH(\'Ï€\') |\n+-------------------+\n| 1 |\n+-------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/char_length/','','https://mariadb.com/kb/en/library/char_length/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (585,37,'CHR','The CHR() function was introduced in MariaDB 10.3.1 to\nprovide Oracle compatibility\n \nSyntax\n------ \nCHR(N)\n \nDescription\n----------- \nCHR() interprets each argument N as an integer and returns a\nVARCHAR(1) string consisting of the character given by the\ncode values of the integer. The character set and collation\nof the string are set according to the values of the\ncharacter_set_database and collation_database system\nvariables.\n \nCHR() is similar to the CHAR() function, but only accepts a\nsingle argument.\n \nCHR() is available in all sql_modes.\n \nExamples\n-------- \nSELECT CHR(67);\n+---------+\n| CHR(67) |\n+---------+\n| C |\n+---------+\n \nSELECT CHR(\'67\');\n+-----------+\n| CHR(\'67\') |\n+-----------+\n| C |\n+-----------+\n \nSELECT CHR(\'C\');\n+----------+\n| CHR(\'C\') |\n+----------+\n| |\n+----------+\n1 row in set, 1 warning (0.000 sec)\n \nSHOW WARNINGS;\n \n+---------+------+----------------------------------------+\n| Level | Code | Message |\n+---------+------+----------------------------------------+\n| Warning | 1292 | Truncated incorrect INTEGER value: \'C\'\n|\n+---------+------+----------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/chr/','','https://mariadb.com/kb/en/library/chr/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (586,37,'CONCAT','Syntax\n------ \nCONCAT(str1,str2,...)\n \nDescription\n----------- \nReturns the string that results from concatenating the\narguments. May have one or more arguments. If all arguments\nare non-binary strings, the result is a non-binary string.\nIf the arguments include any binary strings, the result is a\nbinary string. A numeric argument is converted to its\nequivalent binary string form; if you want to avoid that,\nyou can use an explicit type cast, as in this example:\n \nSELECT CONCAT(CAST(int_col AS CHAR), char_col);\n \nCONCAT() returns NULL if any argument is NULL.\n \nA NULL parameter hides all information contained in other\nparameters from the result. Sometimes this is not desirable;\nto avoid this, you can:\nUse the CONCAT_WS() function with an empty separator,\nbecause that function is NULL-safe.\nUse IFNULL() to turn NULLs into empty strings.\n \nOracle Mode\n \nIn Oracle mode from MariaDB 10.3, CONCAT ignores NULL.\n \nExamples\n-------- \nSELECT CONCAT(\'Ma\', \'ria\', \'DB\');\n+---------------------------+\n| CONCAT(\'Ma\', \'ria\', \'DB\') |\n+---------------------------+\n| MariaDB |\n+---------------------------+\n \nSELECT CONCAT(\'Ma\', \'ria\', NULL, \'DB\');\n+---------------------------------+\n| CONCAT(\'Ma\', \'ria\', NULL, \'DB\') |\n+---------------------------------+\n| NULL |\n+---------------------------------+\n \nSELECT CONCAT(42.0);\n+--------------+\n| CONCAT(42.0) |\n+--------------+\n| 42.0 |\n+--------------+\n \nUsing IFNULL() to handle NULLs:\n \nSELECT CONCAT(\'The value of @v is: \', IFNULL(@v, \'\'));\n+------------------------------------------------+\n| CONCAT(\'The value of @v is: \', IFNULL(@v, \'\')) |\n+------------------------------------------------+\n| The value of @v is: |\n+------------------------------------------------+\n \nIn Oracle mode, from MariaDB 10.3:\n \nSELECT CONCAT(\'Ma\', \'ria\', NULL, \'DB\');\n+---------------------------------+\n| CONCAT(\'Ma\', \'ria\', NULL, \'DB\') |\n+---------------------------------+\n| MariaDB |\n+---------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/concat/','','https://mariadb.com/kb/en/library/concat/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (587,37,'CONCAT_WS','Syntax\n------ \nCONCAT_WS(separator,str1,str2,...)\n \nDescription\n----------- \nCONCAT_WS() stands for Concatenate With Separator and is a\nspecial form of CONCAT(). The first argument is the\nseparator for the rest of the arguments. The separator is\nadded between the strings to be concatenated. The separator\ncan be a string, as can the rest of the arguments.\n \nIf the separator is NULL, the result is NULL; all other NULL\nvalues are skipped. This makes CONCAT_WS() suitable when you\nwant to concatenate some values and avoid losing all\ninformation if one of them is NULL.\n \nExamples\n-------- \nSELECT CONCAT_WS(\',\',\'First name\',\'Second name\',\'Last\nName\');\n+-------------------------------------------------------+\n| CONCAT_WS(\',\',\'First name\',\'Second name\',\'Last\nName\') |\n+-------------------------------------------------------+\n| First name,Second name,Last Name |\n+-------------------------------------------------------+\n \nSELECT CONCAT_WS(\'-\',\'Floor\',NULL,\'Room\');\n+------------------------------------+\n| CONCAT_WS(\'-\',\'Floor\',NULL,\'Room\') |\n+------------------------------------+\n| Floor-Room |\n+------------------------------------+\n \nIn some cases, remember to include a space in the separator\nstring:\n \nSET @a = \'gnu\', @b = \'penguin\', @c = \'sea lion\';\n \nQuery OK, 0 rows affected (0.00 sec)\n \nSELECT CONCAT_WS(\', \', @a, @b, @c);\n+-----------------------------+\n| CONCAT_WS(\', \', @a, @b, @c) |\n+-----------------------------+\n| gnu, penguin, sea lion |\n+-----------------------------+\n \nUsing CONCAT_WS() to handle NULLs:\n \nSET @a = \'a\', @b = NULL, @c = \'c\';\n \nSELECT CONCAT_WS(\'\', @a, @b, @c);\n+---------------------------+\n| CONCAT_WS(\'\', @a, @b, @c) |\n+---------------------------+\n| ac |\n+---------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/concat_ws/','','https://mariadb.com/kb/en/library/concat_ws/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (588,37,'CONVERT','Syntax\n------ \nCONVERT(expr,type), CONVERT(expr USING transcoding_name)\n \nDescription\n----------- \nThe CONVERT() and CAST() functions take a value of one type\nand produce a value of another type.\n \nThe type can be one of the following values:\nBINARY\nCHAR\nDATE\nDATETIME \nDECIMAL[(M[,D])]\nDOUBLE \nFLOAT — From MariaDB 10.4.5\nINTEGER \nShort for SIGNED INTEGER\n \nSIGNED [INTEGER]\nTIME \nUNSIGNED [INTEGER]\n \nNote that in MariaDB, INT and INTEGER are the same thing.\n \nBINARY produces a string with the BINARY data type. If the\noptional length is given, BINARY(N) causes the cast to use\nno more than N bytes of the argument. Values shorter than\nthe given number in bytes are padded with 0x00 bytes to make\nthem equal the length value.\n \nCHAR(N) causes the cast to use no more than the number of\ncharacters given in the argument.\n \nThe main difference between the CAST() and CONVERT() is that\nCONVERT(expr,type) is ODBC syntax while CAST(expr as type)\nand CONVERT(... USING ...) are SQL92 syntax.\n \nCONVERT() with USING is used to convert data between\ndifferent character sets. In MariaDB, transcoding names are\nthe same as the\ncorresponding character set names. For example, this\nstatement\nconverts the string \'abc\' in the default character set to\nthe\ncorresponding string in the utf8 character set:\n \nSELECT CONVERT(\'abc\' USING utf8);\n \nExamples\n-------- \nSELECT enum_col FROM tbl_name \nORDER BY CAST(enum_col AS CHAR);\n \nConverting a BINARY to string to permit the LOWER function\nto work:\n \nSET @x = \'AardVark\';\n \nSET @x = BINARY \'AardVark\';\n \nSELECT LOWER(@x), LOWER(CONVERT (@x USING latin1));\n+-----------+----------------------------------+\n| LOWER(@x) | LOWER(CONVERT (@x USING latin1)) |\n+-----------+----------------------------------+\n| AardVark | aardvark |\n+-----------+----------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/convert/','','https://mariadb.com/kb/en/library/convert/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (589,37,'ELT','Syntax\n------ \nELT(N, str1[, str2, str3,...])\n \nDescription\n----------- \nTakes a numeric argument and a series of string arguments.\nReturns the string that corresponds to the given numeric\nposition. For instance, it returns str1 if N is 1, str2 if N\nis 2, and so on. If the numeric argument is a FLOAT, MariaDB\nrounds it to the nearest INTEGER. If the numeric argument is\nless than 1, greater than the total number of arguments, or\nnot a number, ELT() returns NULL. It must have at least two\narguments.\n \nIt is complementary to the FIELD() function.\n \nExamples\n-------- \nSELECT ELT(1, \'ej\', \'Heja\', \'hej\', \'foo\');\n+------------------------------------+\n| ELT(1, \'ej\', \'Heja\', \'hej\', \'foo\') |\n+------------------------------------+\n| ej |\n+------------------------------------+\n \nSELECT ELT(4, \'ej\', \'Heja\', \'hej\', \'foo\');\n+------------------------------------+\n| ELT(4, \'ej\', \'Heja\', \'hej\', \'foo\') |\n+------------------------------------+\n| foo |\n+------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/elt/','','https://mariadb.com/kb/en/library/elt/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (590,37,'EXPORT_SET','Syntax\n------ \nEXPORT_SET(bits, on, off[, separator[, number_of_bits]])\n \nDescription\n----------- \nTakes a minimum of three arguments. Returns a string where\neach bit in the given bits argument is returned, with the\nstring values given for on and off. \n \nBits are examined from right to left, (from low-order to\nhigh-order bits). Strings are added to the result from left\nto right, separated by a separator string (defaults as\n\',\'). You can optionally limit the number of bits the\nEXPORT_SET() function examines using the number_of_bits\noption. \n \nIf any of the arguments are set as NULL, the function\nreturns NULL.\n \nExamples\n-------- \nSELECT EXPORT_SET(5,\'Y\',\'N\',\',\',4);\n+-----------------------------+\n| EXPORT_SET(5,\'Y\',\'N\',\',\',4) |\n+-----------------------------+\n| Y,N,Y,N |\n+-----------------------------+\n \nSELECT EXPORT_SET(6,\'1\',\'0\',\',\',10);\n+------------------------------+\n| EXPORT_SET(6,\'1\',\'0\',\',\',10) |\n+------------------------------+\n| 0,1,1,0,0,0,0,0,0,0 |\n+------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/export_set/','','https://mariadb.com/kb/en/library/export_set/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (591,37,'EXTRACTVALUE','Syntax\n------ \nEXTRACTVALUE(xml_frag, xpath_expr)\n \nDescription\n----------- \nThe EXTRACTVALUE() function takes two string arguments: a\nfragment of XML markup and an XPath expression, (also known\nas a locator). It returns the text (That is, CDDATA), of the\nfirst text node which is a child of the element or elements\nmatching the XPath expression. \n \nIn cases where a valid XPath expression does not match any\ntext nodes in a valid XML fragment, (including the implicit\n/text() expression), the EXTRACTVALUE() function returns an\nempty string.\n \nInvalid Arguments\n \nWhen either the XML fragment or the XPath expression is\nNULL, the EXTRACTVALUE() function returns NULL. When the XML\nfragment is invalid, it raises a warning Code 1525:\n \nWarning (Code 1525): Incorrect XML value: \'parse error at\nline 1 pos 11: unexpected END-OF-INPUT\'\n \nWhen the XPath value is invalid, it generates an Error 1105:\n \nERROR 1105 (HY000): XPATH syntax error: \')\'\n \nExplicit text() Expressions\n \nThis function is the equivalent of performing a match using\nthe XPath expression after appending /text(). In other\nwords:\n \nSELECT\n EXTRACTVALUE(\'example\', \'/cases/case\') AS \'Base\nExample\',\n EXTRACTVALUE(\'example\', \'/cases/case/text()\') AS\n\'text() Example\';\n \n+--------------+----------------+\n| Base Example | text() Example |\n+--------------+----------------+\n| example | example |\n+--------------+----------------+\n \nCount Matches\n \nWhen EXTRACTVALUE() returns multiple matches, it returns the\ncontent of the first child text node of each matching\nelement, in the matched order, as a single, space-delimited\nstring.\n \nBy design, the EXTRACTVALUE() function makes no distinction\nbetween a match on an empty element and no match at all. If\nyou need to determine whether no matching element was found\nin the XML fragment or if an element was found that\ncontained no child text nodes, use the XPath count()\nfunction. \n \nFor instance, when looking for a value that exists, but\ncontains no child text nodes, you would get a count of the\nnumber of matching instances:\n \nSELECT\n EXTRACTVALUE(\'\', \'/cases/case\') AS \'Empty Example\',\n EXTRACTVALUE(\'\', \'/cases/case/count()\') AS \'count()\nExample\';\n \n+---------------+-----------------+\n| Empty Example | count() Example |\n+---------------+-----------------+\n| | 1 |\n+---------------+-----------------+\n \nAlternatively, when looking for a value that doesn\'t exist,\ncount() returns 0.\n \nSELECT\n EXTRACTVALUE(\'\', \'/cases/person\') AS \'No Match\nExample\',\n EXTRACTVALUE(\'\', \'/cases/person/count()\') AS \'count()\nExample\';\n \n+------------------+-----------------+\n| No Match Example | count() Example |\n+------------------+-----------------+\n| | 0|\n+------------------+-----------------+\n \nMatches\n \nImportant: The EXTRACTVALUE() function only returns CDDATA.\nIt does not return tags that the element might contain or\nthe text that these child elements contain.\n \nSELECT EXTRACTVALUE(\'Personx@example.com\', \'/cases\') AS\nCase;\n \n+--------+\n| Case |\n+--------+\n| Person |\n+--------+\n \nNote, in the above example, while the XPath expression\nmatches to the parent instance, it does not return the\ncontained tag or its content.\n \nExamples\n-------- \nSELECT\n ExtractValue(\'cccddd\', \'/a\') AS val1,\n ExtractValue(\'cccddd\', \'/a/b\') AS val2,\n ExtractValue(\'cccddd\', \'//b\') AS val3,\n ExtractValue(\'cccddd\', \'/b\') AS val4,\n ExtractValue(\'cccdddeee\', \'//b\') AS val5;\n \n+------+------+------+------+---------+\n| val1 | val2 | val3 | val4 | val5 |\n+------+------+------+------+---------+\n| ccc | ddd | ddd | | ddd eee |\n+------+------+------+------+---------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/extractvalue/','','https://mariadb.com/kb/en/library/extractvalue/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (592,37,'FIELD','Syntax\n------ \nFIELD(pattern, str1[,str2,...])\n \nDescription\n----------- \nReturns the index position of the string or number matching\nthe given pattern. Returns 0 in the event that none of the\narguments match the pattern. Raises an Error 1582 if not\ngiven at least two arguments.\n \nWhen all arguments given to the FIELD() function are\nstrings, they are treated as case-insensitive. When all the\narguments are numbers, they are treated as numbers.\nOtherwise, they are treated as doubles. \n \nIf the given pattern occurs more than once, the FIELD()\nfunction only returns the index of the first instance. If\nthe given pattern is NULL, the function returns 0, as a NULL\npattern always fails to match.\n \nThis function is complementary to the ELT() function.\n \nExamples\n-------- \nSELECT FIELD(\'ej\', \'Hej\', \'ej\', \'Heja\', \'hej\',\n\'foo\') \n AS \'Field Results\';\n \n+---------------+\n| Field Results | \n+---------------+\n| 2 |\n+---------------+\n \nSELECT FIELD(\'fo\', \'Hej\', \'ej\', \'Heja\', \'hej\',\n\'foo\')\n AS \'Field Results\';\n \n+---------------+\n| Field Results | \n+---------------+\n| 0 |\n+---------------+\n \nSELECT FIELD(1, 2, 3, 4, 5, 1) AS \'Field Results\';\n \n+---------------+\n| Field Results |\n+---------------+\n| 5 |\n+---------------+\n \nSELECT FIELD(NULL, 2, 3) AS \'Field Results\';\n \n+---------------+\n| Field Results |\n+---------------+\n| 0 |\n+---------------+\n \nSELECT FIELD(\'fail\') AS \'Field Results\';\n \nError 1582 (42000): Incorrect parameter count in call\nto native function \'field\'\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/field/','','https://mariadb.com/kb/en/library/field/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (593,37,'FIND_IN_SET','Syntax\n------ \nFIND_IN_SET(pattern, strlist)\n \nDescription\n----------- \nReturns the index position where the given pattern occurs in\na string list. The first argument is the pattern you want to\nsearch for. The second argument is a string containing\ncomma-separated variables. If the second argument is of the\nSET data-type, the function is optimized to use bit\narithmetic.\n \nIf the pattern does not occur in the string list or if the\nstring list is an empty string, the function returns 0. If\neither argument is NULL, the function returns NULL. The\nfunction does not return the correct result if the pattern\ncontains a comma (\",\") character.\n \nExamples\n-------- \nSELECT FIND_IN_SET(\'b\',\'a,b,c,d\') AS \"Found Results\";\n \n+---------------+\n| Found Results |\n+---------------+\n| 2 |\n+---------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/find_in_set/','','https://mariadb.com/kb/en/library/find_in_set/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (594,37,'FORMAT','Syntax\n------ \nFORMAT(num, decimal_position[, locale])\n \nDescription\n----------- \nFormats the given number for display as a string, adding\nseparators to appropriate position and rounding the results\nto the given decimal position. For instance, it would format\n15233.345 to 15,233.35.\n \nIf the given decimal position is 0, it rounds to return no\ndecimal point or fractional part. You can optionally specify\na locale value to format numbers to the pattern appropriate\nfor the given region.\n \nExamples\n-------- \nSELECT FORMAT(1234567890.09876543210, 4) AS \'Format\';\n \n+--------------------+\n| Format |\n+--------------------+\n| 1,234,567,890.0988 |\n+--------------------+\n \nSELECT FORMAT(1234567.89, 4) AS \'Format\';\n \n+----------------+\n| Format |\n+----------------+\n| 1,234,567.8900 |\n+----------------+\n \nSELECT FORMAT(1234567.89, 0) AS \'Format\';\n \n+-----------+\n| Format |\n+-----------+\n| 1,234,568 |\n+-----------+\n \nSELECT FORMAT(123456789,2,\'rm_CH\') AS \'Format\';\n \n+----------------+\n| Format |\n+----------------+\n| 123\'456\'789,00 |\n+----------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/format/','','https://mariadb.com/kb/en/library/format/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (595,37,'FROM_BASE64','The FROM_BASE64() function was introduced in MariaDB 10.0.5.\n \nSyntax\n------ \nFROM_BASE64(str)\n \nDescription\n----------- \nDecodes the given base-64 encode string, returning the\nresult as a binary string. Returns NULL if the given string\nis NULL or if it\'s invalid.\n \nIt is the reverse of the TO_BASE64 function.\n \nThere are numerous methods to base-64 encode a string.\nMariaDB uses the following:\nIt encodes alphabet value 64 as \'+\'.\nIt encodes alphabet value 63 as \'/\'.\nIt codes output in groups of four printable characters. Each\nthree byte of data encoded uses four characters. If the\nfinal group is incomplete, it pads the difference with the\n\'=\' character.\nIt divides long output, adding a new line very 76\ncharacters.\nIn decoding, it recognizes and ignores newlines, carriage\nreturns, tabs and space whitespace characters.\n \nSELECT TO_BASE64(\'Maria\') AS \'Input\';\n \n+-----------+\n| Input |\n+-----------+\n| TWFyaWE= |\n+-----------+\n \nSELECT FROM_BASE64(\'TWFyaWE=\') AS \'Output\';\n \n+--------+\n| Output |\n+--------+\n| Maria |\n+--------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/from_base64/','','https://mariadb.com/kb/en/library/from_base64/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (596,37,'HEX','Syntax\n------ \nHEX(N_or_S)\n \nDescription\n----------- \nIf N_or_S is a number, returns a string representation of\nthe hexadecimal\nvalue of N, where N is a longlong (BIGINT) number. This is\nequivalent to CONV(N,10,16).\n \nIf N_or_S is a string, returns a hexadecimal string\nrepresentation of\nN_or_S where each byte of each character in N_or_S is\nconverted to two hexadecimal\ndigits. If N_or_S is NULL, returns NULL. The inverse of this\noperation is performed by the UNHEX()\nfunction.\n \nExamples\n-------- \nSELECT HEX(255);\n+----------+\n| HEX(255) |\n+----------+\n| FF |\n+----------+\n \nSELECT 0x4D617269614442;\n \n+------------------+\n| 0x4D617269614442 |\n+------------------+\n| MariaDB |\n+------------------+\n \nSELECT HEX(\'MariaDB\');\n+----------------+\n| HEX(\'MariaDB\') |\n+----------------+\n| 4D617269614442 |\n+----------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/hex/','','https://mariadb.com/kb/en/library/hex/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (597,37,'INSERT Function','Syntax\n------ \nINSERT(str,pos,len,newstr)\n \nDescription\n----------- \nReturns the string str, with the substring beginning at\nposition pos\nand len characters long replaced by the string newstr.\nReturns the\noriginal string if pos is not within the length of the\nstring.\nReplaces the rest of the string from position pos if len is\nnot within\nthe length of the rest of the string. Returns NULL if any\nargument is\nNULL.\n \nExamples\n-------- \nSELECT INSERT(\'Quadratic\', 3, 4, \'What\');\n+-----------------------------------+\n| INSERT(\'Quadratic\', 3, 4, \'What\') |\n+-----------------------------------+\n| QuWhattic |\n+-----------------------------------+\n \nSELECT INSERT(\'Quadratic\', -1, 4, \'What\');\n+------------------------------------+\n| INSERT(\'Quadratic\', -1, 4, \'What\') |\n+------------------------------------+\n| Quadratic |\n+------------------------------------+\n \nSELECT INSERT(\'Quadratic\', 3, 100, \'What\');\n+-------------------------------------+\n| INSERT(\'Quadratic\', 3, 100, \'What\') |\n+-------------------------------------+\n| QuWhat |\n+-------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/insert-function/','','https://mariadb.com/kb/en/library/insert-function/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (598,37,'INSTR','Syntax\n------ \nINSTR(str,substr)\n \nDescription\n----------- \nReturns the position of the first occurrence of substring\nsubstr in\nstring str. This is the same as the two-argument form of\nLOCATE(),\nexcept that the order of the arguments is reversed.\n \nINSTR() performs a case-insensitive search.\n \nIf any argument is NULL, returns NULL.\n \nExamples\n-------- \nSELECT INSTR(\'foobarbar\', \'bar\');\n+---------------------------+\n| INSTR(\'foobarbar\', \'bar\') |\n+---------------------------+\n| 4 |\n+---------------------------+\n \nSELECT INSTR(\'My\', \'Maria\');\n+----------------------+\n| INSTR(\'My\', \'Maria\') |\n+----------------------+\n| 0 |\n+----------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/instr/','','https://mariadb.com/kb/en/library/instr/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (599,37,'LCASE','Syntax\n------ \nLCASE(str)\n \nDescription\n----------- \nLCASE() is a synonym for LOWER().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/lcase/','','https://mariadb.com/kb/en/library/lcase/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (600,37,'LEFT','Syntax\n------ \nLEFT(str,len)\n \nDescription\n----------- \nReturns the leftmost len characters from the string str, or\nNULL if\nany argument is NULL.\n \nExamples\n-------- \nSELECT LEFT(\'MariaDB\', 5);\n+--------------------+\n| LEFT(\'MariaDB\', 5) |\n+--------------------+\n| Maria |\n+--------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/left/','','https://mariadb.com/kb/en/library/left/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (601,37,'LENGTH','Syntax\n------ \nLENGTH(str)\n \nDescription\n----------- \nReturns the length of the string str, measured in bytes. A\nmulti-byte\ncharacter counts as multiple bytes. This means that for a\nstring\ncontaining five two-byte characters, LENGTH() returns 10,\nwhereas\nCHAR_LENGTH() returns 5. \n \nIf str is not a string value, it is converted into a string.\nIf str is NULL, the function returns NULL.\n \nUntil MariaDB 10.3.1, returns MYSQL_TYPE_LONGLONG, or\nbigint(10), in all cases. From MariaDB 10.3.1, returns\nMYSQL_TYPE_LONG, or int(10), when the result would fit\nwithin 32-bits.\n \nOracle Mode\n \nWhen running Oracle mode from MariaDB 10.3, LENGTH() is a\nsynonym for CHAR_LENGTH().\n \nExamples\n-------- \nSELECT LENGTH(\'MariaDB\');\n+-------------------+\n| LENGTH(\'MariaDB\') |\n+-------------------+\n| 7 |\n+-------------------+\n \nSELECT LENGTH(\'Ï€\');\n+--------------+\n| LENGTH(\'Ï€\') |\n+--------------+\n| 2 |\n+--------------+\n \nIn Oracle mode from MariaDB 10.3:\n \nSELECT LENGTH(\'Ï€\');\n+--------------+\n| LENGTH(\'Ï€\') |\n+--------------+\n| 1 |\n+--------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/length/','','https://mariadb.com/kb/en/library/length/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (602,37,'LENGTHB','Introduced in MariaDB 10.3.1 as part of the Oracle\ncompatibility enhancements.\n \nSyntax\n------ \nLENGTHB(str)\n \nDescription\n----------- \nLENGTHB() is a synonym for LENGTH().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/lengthb/','','https://mariadb.com/kb/en/library/lengthb/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (603,37,'LIKE','Syntax\n------ \nexpr LIKE pat [ESCAPE \'escape_char\']\nexpr NOT LIKE pat [ESCAPE \'escape_char\']\n \nDescription\n----------- \nTests whether expr matches the pattern pat. Returns either 1\n(TRUE) or 0 (FALSE).\nBoth expr and pat may be any valid expression and are\nevaluated to strings.\nPatterns may use the following wildcard characters:\n% matches any number of characters, including zero.\n_ matches any single character.\n \nUse NOT LIKE to test if a string does not match a pattern.\nThis is equivalent to using\nthe NOT operator on the entire LIKE expression.\n \nIf either the expression or the pattern is NULL, the result\nis NULL.\n \nLIKE performs case-insensitive substring matches if the\ncollation for the\nexpression and pattern is case-insensitive. For\ncase-sensitive matches, declare either argument\nto use a binary collation using COLLATE, or coerce either of\nthem to a BINARY\nstring using CAST. Use SHOW COLLATION to get a list of\navailable collations. Collations ending in _bin are\ncase-sensitive.\n \nNumeric arguments are coerced to binary strings.\n \nThe _ wildcard matches a single character, not byte. It will\nonly match a multi-byte character\nif it is valid in the expression\'s character set. For\nexample, _ will match _utf8\"€\", but it\nwill not match _latin1\"€\" because the Euro sign is not a\nvalid latin1 character. If necessary,\nuse CONVERT to use the expression in a different character\nset.\n \nIf you need to match the characters _ or %, you must escape\nthem. By default,\nyou can prefix the wildcard characters the backslash\ncharacter \\ to escape them.\nThe backslash is used both to encode special characters like\nnewlines when a string is\nparsed as well as to escape wildcards in a pattern after\nparsing. Thus, to match an\nactual backslash, you sometimes need to double-escape it as\n\"\\\\\\\\\".\n \nTo avoid difficulties with the backslash character, you can\nchange the wildcard escape\ncharacter using ESCAPE in a LIKE expression. The argument to\nESCAPE\nmust be a single-character string.\n \nExamples\n-------- \nSelect the days that begin with \"T\":\n \nCREATE TABLE t1 (d VARCHAR(16));\nINSERT INTO t1 VALUES (\"Monday\"), (\"Tuesday\"),\n(\"Wednesday\"), (\"Thursday\"), (\"Friday\"),\n(\"Saturday\"), (\"Sunday\");\nSELECT * FROM t1 WHERE d LIKE \"T%\";\n \nSELECT * FROM t1 WHERE d LIKE \"T%\";\n+----------+\n| d |\n+----------+\n| Tuesday |\n| Thursday |\n+----------+\n \nSelect the days that contain the substring \"es\":\n \nSELECT * FROM t1 WHERE d LIKE \"%es%\";\n \nSELECT * FROM t1 WHERE d LIKE \"%es%\";\n+-----------+\n| d |\n+-----------+\n| Tuesday |\n| Wednesday |\n+-----------+\n \nSelect the six-character day names:\n \nSELECT * FROM t1 WHERE d like \"___day\";\n \nSELECT * FROM t1 WHERE d like \"___day\";\n+---------+\n| d |\n+---------+\n| Monday |\n| Friday |\n| Sunday |\n+---------+\n \nWith the default collations, LIKE is case-insensitive:\n \nSELECT * FROM t1 where d like \"t%\";\n \nSELECT * FROM t1 where d like \"t%\";\n+----------+\n| d |\n+----------+\n| Tuesday |\n| Thursday |\n+----------+\n \nUse COLLATE to specify a binary collation, forcing\ncase-sensitive matches:\n \nSELECT * FROM t1 WHERE d like \"t%\" COLLATE latin1_bin;\n \nSELECT * FROM t1 WHERE d like \"t%\" COLLATE latin1_bin;\nEmpty set (0.00 sec)\n \nYou can include functions and operators in the expression to\nmatch. Select dates\nbased on their day name:\n \nCREATE TABLE t2 (d DATETIME);\nINSERT INTO t2 VALUES\n (\"2007-01-30 21:31:07\"),\n (\"1983-10-15 06:42:51\"),\n (\"2011-04-21 12:34:56\"),\n (\"2011-10-30 06:31:41\"),\n (\"2011-01-30 14:03:25\"),\n (\"2004-10-07 11:19:34\");\nSELECT * FROM t2 WHERE DAYNAME(d) LIKE \"T%\";\n \nSELECT * FROM t2 WHERE DAYNAME(d) LIKE \"T%\";\n+------------------+\n| d |\n+------------------+\n| 2007-01-30 21:31 |\n| 2011-04-21 12:34 |\n| 2004-10-07 11:19 |\n+------------------+\n3 rows in set, 7 warnings (0.00 sec)\n \nOptimizing LIKE\n \nMariaDB can use indexes for LIKE on string columns in the\ncase where the LIKE doesn\'t start with % or _.\nStarting from MariaDB 10.0, one can set the\noptimizer_use_condition_selectivity variable to 5. If this\nis done, then the optimizer will read\noptimizer_selectivity_sampling_limit rows to calculate the\nselectivity of the LIKE expression before starting to\ncalculate the query plan. This can help speed up some LIKE\nqueries by providing the optimizer with more information\nabout your data.\n \n\n\nURL: https://mariadb.com/kb/en/library/like/','','https://mariadb.com/kb/en/library/like/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (604,37,'LOAD_FILE','Syntax\n------ \nLOAD_FILE(file_name)\n \nDescription\n----------- \nReads the file and returns the file contents as a string. To\nuse this function, the file must be located on the server\nhost, you must specify the full path name to the file, and\nyou must have the FILE privilege. The file must be readable\nby all and it must be less than the size, in bytes, of the\nmax_allowed_packet system variable. If the secure_file_priv\nsystem variable is set to a non-empty directory name, the\nfile to be loaded must be located in that directory.\n \nIf the file does not exist or cannot be read because one of\nthe preceding conditions is not satisfied, the function\nreturns NULL.\n \nSince MariaDB 5.1, the character_set_filesystem system\nvariable has controlled interpretation of file names that\nare given as literal strings.\n \nStatements using the LOAD_FILE() function are not safe for\nstatement based replication. This is because the slave will\nexecute the LOAD_FILE() command itself. If the file doesn\'t\nexist on the slave, the function will return NULL.\n \nExamples\n-------- \nUPDATE t SET blob_col=LOAD_FILE(\'/tmp/picture\') WHERE\nid=1;\n \n\n\nURL: https://mariadb.com/kb/en/library/load_file/','','https://mariadb.com/kb/en/library/load_file/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (605,37,'LOCATE','Syntax\n------ \nLOCATE(substr,str), LOCATE(substr,str,pos)\n \nDescription\n----------- \nThe first syntax returns the position of the first\noccurrence of\nsubstring substr in string str. The second syntax returns\nthe position\nof the first occurrence of substring substr in string str,\nstarting at\nposition pos. Returns 0 if substr is not in str.\n \nLOCATE() performs a case-insensitive search.\n \nIf any argument is NULL, returns NULL.\n \nINSTR() is a synonym of LOCATE() without the third argument.\n \nExamples\n-------- \nSELECT LOCATE(\'bar\', \'foobarbar\');\n+----------------------------+\n| LOCATE(\'bar\', \'foobarbar\') |\n+----------------------------+\n| 4 |\n+----------------------------+\n \nSELECT LOCATE(\'My\', \'Maria\');\n+-----------------------+\n| LOCATE(\'My\', \'Maria\') |\n+-----------------------+\n| 0 |\n+-----------------------+\n \nSELECT LOCATE(\'bar\', \'foobarbar\', 5);\n+-------------------------------+\n| LOCATE(\'bar\', \'foobarbar\', 5) |\n+-------------------------------+\n| 7 |\n+-------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/locate/','','https://mariadb.com/kb/en/library/locate/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (606,37,'LOWER','Syntax\n------ \nLOWER(str)\n \nDescription\n----------- \nReturns the string str with all characters changed to\nlowercase\naccording to the current character set mapping. The default\nis latin1\n(cp1252 West European).\n \nExamples\n-------- \n SELECT LOWER(\'QUADRATICALLY\');\n+------------------------+\n| LOWER(\'QUADRATICALLY\') |\n+------------------------+\n| quadratically |\n+------------------------+\n \nLOWER() (and UPPER()) are ineffective when applied to binary\nstrings (BINARY, VARBINARY, BLOB). \nTo perform lettercase conversion, CONVERT the string to a\nnon-binary string:\n \nSET @str = BINARY \'North Carolina\';\n \nSELECT LOWER(@str), LOWER(CONVERT(@str USING latin1));\n+----------------+-----------------------------------+\n| LOWER(@str) | LOWER(CONVERT(@str USING latin1)) |\n+----------------+-----------------------------------+\n| North Carolina | north carolina |\n+----------------+-----------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/lower/','','https://mariadb.com/kb/en/library/lower/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (607,37,'LPAD','Syntax\n------ \nLPAD(str, len [,padstr])\n \nDescription\n----------- \nReturns the string str, left-padded with the string padstr\nto a length\nof len characters. If str is longer than len, the return\nvalue is\nshortened to len characters. If padstr is omitted, the LPAD\nfunction pads spaces.\n \nPrior to MariaDB 10.3.1, the padstr parameter was mandatory.\n \nReturns NULL if given a NULL argument. If the result is\nempty (zero length), returns either an empty string or, from\nMariaDB 10.3.6 with SQL_MODE=Oracle, NULL.\n \nThe Oracle mode version of the function can be accessed\noutside of Oracle mode by using LPAD_ORACLE as the function\nname.\n \nExamples\n-------- \nSELECT LPAD(\'hello\',10,\'.\');\n+----------------------+\n| LPAD(\'hello\',10,\'.\') |\n+----------------------+\n| .....hello |\n+----------------------+\n \nSELECT LPAD(\'hello\',2,\'.\');\n+---------------------+\n| LPAD(\'hello\',2,\'.\') |\n+---------------------+\n| he |\n+---------------------+\n \nFrom MariaDB 10.3.1, with the pad string defaulting to\nspace.\n \nSELECT LPAD(\'hello\',10);\n+------------------+\n| LPAD(\'hello\',10) |\n+------------------+\n| hello |\n+------------------+\n \nOracle mode version from MariaDB 10.3.6:\n \nSELECT LPAD(\'\',0),LPAD_ORACLE(\'\',0);\n+------------+-------------------+\n| LPAD(\'\',0) | LPAD_ORACLE(\'\',0) |\n+------------+-------------------+\n| | NULL |\n+------------+-------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/lpad/','','https://mariadb.com/kb/en/library/lpad/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (608,37,'LTRIM','Syntax\n------ \nLTRIM(str)\n \nDescription\n----------- \nReturns the string str with leading space characters\nremoved.\n \nReturns NULL if given a NULL argument. If the result is\nempty, returns either an empty string, or, from MariaDB\n10.3.6 with SQL_MODE=Oracle, NULL.\n \nThe Oracle mode version of the function can be accessed\noutside of Oracle mode by using LTRIM_ORACLE as the function\nname.\n \nExamples\n-------- \nSELECT QUOTE(LTRIM(\' MariaDB \'));\n+-------------------------------+\n| QUOTE(LTRIM(\' MariaDB \')) |\n+-------------------------------+\n| \'MariaDB \' |\n+-------------------------------+\n \nOracle mode version from MariaDB 10.3.6:\n \nSELECT LTRIM(\'\'),LTRIM_ORACLE(\'\');\n+-----------+------------------+\n| LTRIM(\'\') | LTRIM_ORACLE(\'\') |\n+-----------+------------------+\n| | NULL |\n+-----------+------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/ltrim/','','https://mariadb.com/kb/en/library/ltrim/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (609,37,'MAKE_SET','Syntax\n------ \nMAKE_SET(bits,str1,str2,...)\n \nDescription\n----------- \nReturns a set value (a string containing substrings\nseparated by \",\"\ncharacters) consisting of the strings that have the\ncorresponding bit\nin bits set. str1 corresponds to bit 0, str2 to bit 1, and\nso on. NULL\nvalues in str1, str2, ... are not appended to the result.\n \nExamples\n-------- \nSELECT MAKE_SET(1,\'a\',\'b\',\'c\');\n+-------------------------+\n| MAKE_SET(1,\'a\',\'b\',\'c\') |\n+-------------------------+\n| a |\n+-------------------------+\n \nSELECT MAKE_SET(1 | 4,\'hello\',\'nice\',\'world\');\n+----------------------------------------+\n| MAKE_SET(1 | 4,\'hello\',\'nice\',\'world\') |\n+----------------------------------------+\n| hello,world |\n+----------------------------------------+\n \nSELECT MAKE_SET(1 | 4,\'hello\',\'nice\',NULL,\'world\');\n+---------------------------------------------+\n| MAKE_SET(1 | 4,\'hello\',\'nice\',NULL,\'world\') |\n+---------------------------------------------+\n| hello |\n+---------------------------------------------+\n \nSELECT QUOTE(MAKE_SET(0,\'a\',\'b\',\'c\'));\n+--------------------------------+\n| QUOTE(MAKE_SET(0,\'a\',\'b\',\'c\')) |\n+--------------------------------+\n| \'\' |\n+--------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/make_set/','','https://mariadb.com/kb/en/library/make_set/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (610,37,'MATCH AGAINST','Syntax\n------ \nMATCH (col1,col2,...) AGAINST (expr [search_modifier])\n \nDescription\n----------- \nA special construct used to perform a fulltext search on a\nfulltext index.\n \nSee Fulltext Index Overview for a full description, and\nFull-text Indexes for more articles on the topic.\n \nExamples\n-------- \nCREATE TABLE ft_myisam(copy TEXT,FULLTEXT(copy))\nENGINE=MyISAM;\n \nINSERT INTO ft_myisam(copy) VALUES (\'Once upon a time\'),\n(\'There was a wicked witch\'), \n (\'Who ate everybody up\');\n \nSELECT * FROM ft_myisam WHERE MATCH(copy)\nAGAINST(\'wicked\');\n+--------------------------+\n| copy |\n+--------------------------+\n| There was a wicked witch |\n+--------------------------+\n \nSELECT 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|\n| 6 | When configured properly, MySQL ... | 1.3114095926285\n|\n+----+-------------------------------------+-----------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/match-against/','','https://mariadb.com/kb/en/library/match-against/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (611,37,'MID','Syntax\n------ \nMID(str,pos,len)\n \nDescription\n----------- \nMID(str,pos,len) is a synonym for SUBSTRING(str,pos,len).\n \nExamples\n-------- \nSELECT MID(\'abcd\',4,1);\n+-----------------+\n| MID(\'abcd\',4,1) |\n+-----------------+\n| d |\n+-----------------+\n \nSELECT MID(\'abcd\',2,2);\n+-----------------+\n| MID(\'abcd\',2,2) |\n+-----------------+\n| bc |\n+-----------------+\n \nA negative starting position:\n \nSELECT MID(\'abcd\',-2,4);\n+------------------+\n| MID(\'abcd\',-2,4) |\n+------------------+\n| cd |\n+------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/mid/','','https://mariadb.com/kb/en/library/mid/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (612,37,'NOT LIKE','Syntax\n------ \nexpr NOT LIKE pat [ESCAPE \'escape_char\']\n \nDescription\n----------- \nThis is the same as NOT (expr LIKE pat [ESCAPE\n\'escape_char\']).\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/not-like/','','https://mariadb.com/kb/en/library/not-like/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (613,37,'NOT REGEXP','Syntax\n------ \nexpr NOT REGEXP pat, expr NOT RLIKE pat\n \nDescription\n----------- \nThis is the same as NOT (expr REGEXP pat).\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/not-regexp/','','https://mariadb.com/kb/en/library/not-regexp/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (614,37,'OCTET_LENGTH','Syntax\n------ \nOCTET_LENGTH(str)\n \nDescription\n----------- \nOCTET_LENGTH() is normally a synonym for LENGTH(). When\nrunning Oracle mode from MariaDB 10.3, they are not\nsynonyms, but OCTET_LENGTH() behaves as LENGTH() would when\nnot in Oracle mode.\n \n\n\nURL: https://mariadb.com/kb/en/library/octet_length/','','https://mariadb.com/kb/en/library/octet_length/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (615,37,'ORD','Syntax\n------ \nORD(str)\n \nDescription\n----------- \nIf the leftmost character of the string str is a multi-byte\ncharacter,\nreturns the code for that character, calculated from the\nnumeric\nvalues of its constituent bytes using this formula:\n \n (1st byte code)\n+ (2nd byte code x 256)\n+ (3rd byte code x 256 x 256) ...\n \nIf the leftmost character is not a multi-byte character,\nORD() returns\nthe same value as the ASCII() function.\n \nExamples\n-------- \nSELECT ORD(\'2\');\n+----------+\n| ORD(\'2\') |\n+----------+\n| 50 |\n+----------+\n \n\n\nURL: https://mariadb.com/kb/en/library/ord/','','https://mariadb.com/kb/en/library/ord/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (616,37,'POSITION','Syntax\n------ \nPOSITION(substr IN str)\n \nDescription\n----------- \nPOSITION(substr IN str) is a synonym for LOCATE(substr,str).\n \nIt\'s part of ODBC 3.0.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/position/','','https://mariadb.com/kb/en/library/position/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (617,37,'QUOTE','Syntax\n------ \nQUOTE(str)\n \nDescription\n----------- \nQuotes a string to produce a result that can be used as a\nproperly escaped data\nvalue in an SQL statement. The string is returned enclosed\nby single quotes and\nwith each instance of single quote (\"\'\"), backslash\n(\"\\\"),\nASCII NUL, and Control-Z preceded by a backslash. If the\nargument\nis NULL, the return value is the word \"NULL\" without\nenclosing single\nquotes.\n \nExamples\n-------- \nSELECT QUOTE(\"Don\'t!\");\n+-----------------+\n| QUOTE(\"Don\'t!\") |\n+-----------------+\n| \'Don\\\'t!\' |\n+-----------------+\n \nSELECT QUOTE(NULL); \n+-------------+\n| QUOTE(NULL) |\n+-------------+\n| NULL |\n+-------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/quote/','','https://mariadb.com/kb/en/library/quote/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (618,37,'REGEXP_INSTR','REGEXP_INSTR was introduced in MariaDB 10.0.5.\n \nSyntax\n------ \nREGEXP_INSTR(subject, pattern)\n \nReturns the position of the first occurrence of the regular\nexpression pattern in the string subject, or 0 if pattern\nwas not found.\n \nThe positions start with 1 and are measured in characters\n(i.e. not in bytes), which is important for multi-byte\ncharacter sets. You can cast a multi-byte character set to\nBINARY to get offsets in bytes.\n \nThe function follows the case sensitivity rules of the\neffective collation. Matching is performed case\ninsensitively for case insensitive collations, and case\nsensitively for case sensitive collations and for binary\ndata.\n \nThe collation case sensitivity can be overwritten using the\n(?i) and (?-i) PCRE flags.\n \nMariaDB 10.0.5 switched to the PCRE regular expression\nlibrary for enhanced regular expression performance, and\nREGEXP_INSTR was introduced as part of this enhancement.\n \nExamples\n-------- \nSELECT REGEXP_INSTR(\'abc\',\'b\');\n-> 2\n \nSELECT REGEXP_INSTR(\'abc\',\'x\');\n-> 0\n \nSELECT REGEXP_INSTR(\'BJÖRN\',\'N\');\n-> 5\n \nCasting a multi-byte character set as BINARY to get offsets\nin bytes:\n \nSELECT REGEXP_INSTR(BINARY \'BJÖRN\',\'N\') AS\ncast_utf8_to_binary;\n-> 6\n \nCase sensitivity:\n \nSELECT REGEXP_INSTR(\'ABC\',\'b\');\n-> 2\n \nSELECT REGEXP_INSTR(\'ABC\' COLLATE utf8_bin,\'b\');\n-> 0\n \nSELECT REGEXP_INSTR(BINARY\'ABC\',\'b\');\n-> 0\n \nSELECT REGEXP_INSTR(\'ABC\',\'(?-i)b\');\n-> 0\n \nSELECT REGEXP_INSTR(\'ABC\' COLLATE utf8_bin,\'(?i)b\');\n-> 2\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/regexp_instr/','','https://mariadb.com/kb/en/regexp_instr/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (619,37,'REGEXP_REPLACE','REGEXP_REPLACE was introduced in MariaDB 10.0.5.\n \nSyntax\n------ \nREGEXP_REPLACE(subject, pattern, replace)\n \nDescription\n----------- \nREGEXP_REPLACE returns the string subject with all\noccurrences of the regular expression pattern replaced by\nthe string replace. If no occurrences are found, then\nsubject is returned as is.\n \nThe replace string can have backreferences to the\nsubexpressions in the form \\N, where N is a number from 1\nto 9.\n \nThe function follows the case sensitivity rules of the\neffective collation. Matching is performed case\ninsensitively for case insensitive collations, and case\nsensitively for case sensitive collations and for binary\ndata.\n \nThe collation case sensitivity can be overwritten using the\n(?i) and (?-i) PCRE flags.\n \nMariaDB 10.0.5 switched to the PCRE regular expression\nlibrary for enhanced regular expression performance, and\nREGEXP_REPLACE was introduced as part of this enhancement.\n \nMariaDB 10.0.11 introduced the default_regex_flags variable\nto address the remaining compatibilities between PCRE and\nthe old regex library. \n \nExamples\n-------- \nSELECT REGEXP_REPLACE(\'ab12cd\',\'[0-9]\',\'\') AS\nremove_digits;\n-> abcd\n \nSELECT REGEXP_REPLACE(\'titlebody\', \'\',\' \')\nAS strip_html;\n-> title body\n \nBackreferences to the subexpressions in the form \\N, where\nN is a number from 1 to 9:\n \nSELECT REGEXP_REPLACE(\'James Bond\',\'^(.*)\n(.*)$\',\'\\\\2, \\\\1\') AS reorder_name;\n-> Bond, James\n \nCase insensitive and case sensitive matches:\n \nSELECT REGEXP_REPLACE(\'ABC\',\'b\',\'-\') AS\ncase_insensitive;\n-> A-C\n \nSELECT REGEXP_REPLACE(\'ABC\' COLLATE utf8_bin,\'b\',\'-\')\nAS case_sensitive;\n-> ABC\n \nSELECT REGEXP_REPLACE(BINARY \'ABC\',\'b\',\'-\') AS\nbinary_data;\n-> ABC\n \nOverwriting the collation case sensitivity using the (?i)\nand (?-i) PCRE flags.\n \nSELECT REGEXP_REPLACE(\'ABC\',\'(?-i)b\',\'-\') AS\nforce_case_sensitive;\n-> ABC\n \nSELECT REGEXP_REPLACE(BINARY \'ABC\',\'(?i)b\',\'-\') AS\nforce_case_insensitive;\n-> A-C\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/regexp_replace/','','https://mariadb.com/kb/en/regexp_replace/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (620,37,'REGEXP_SUBSTR','REGEXP_SUBSTR was introduced in MariaDB 10.0.5.\n \nSyntax\n------ \nREGEXP_SUBSTR(subject,pattern)\n \nDescription\n----------- \nReturns the part of the string subject that matches the\nregular expression pattern, or an empty string if pattern\nwas not found.\n \nThe function follows the case sensitivity rules of the\neffective collation. Matching is performed case\ninsensitively for case insensitive collations, and case\nsensitively for case sensitive collations and for binary\ndata.\n \nThe collation case sensitivity can be overwritten using the\n(?i) and (?-i) PCRE flags.\n \nMariaDB 10.0.5 switched to the PCRE regular expression\nlibrary for enhanced regular expression performance, and\nREGEXP_SUBSTR was introduced as part of this enhancement.\n \nMariaDB 10.0.11 introduced the default_regex_flags variable\nto address the remaining compatibilities between PCRE and\nthe old regex library. \n \nExamples\n-------- \nSELECT REGEXP_SUBSTR(\'ab12cd\',\'[0-9]+\');\n-> 12\n \nSELECT REGEXP_SUBSTR(\n \'See https://mariadb.org/en/foundation/ for details\',\n \'https?://[^/]*\');\n-> https://mariadb.org\n \nSELECT REGEXP_SUBSTR(\'ABC\',\'b\');\n-> B\n \nSELECT REGEXP_SUBSTR(\'ABC\' COLLATE utf8_bin,\'b\');\n->\n \nSELECT REGEXP_SUBSTR(BINARY\'ABC\',\'b\');\n->\n \nSELECT REGEXP_SUBSTR(\'ABC\',\'(?i)b\');\n-> B\n \nSELECT REGEXP_SUBSTR(\'ABC\' COLLATE utf8_bin,\'(?+i)b\');\n-> B\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/regexp_substr/','','https://mariadb.com/kb/en/regexp_substr/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (621,37,'REPEAT Function','Syntax\n------ \nREPEAT(str,count)\n \nDescription\n----------- \nReturns a string consisting of the string str repeated count\ntimes. If\ncount is less than 1, returns an empty string. Returns NULL\nif str or\ncount are NULL.\n \nExamples\n-------- \nSELECT QUOTE(REPEAT(\'MariaDB \',4));\n+------------------------------------+\n| QUOTE(REPEAT(\'MariaDB \',4)) |\n+------------------------------------+\n| \'MariaDB MariaDB MariaDB MariaDB \' |\n+------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/repeat-function/','','https://mariadb.com/kb/en/library/repeat-function/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (622,37,'REPLACE Function','Syntax\n------ \nREPLACE(str,from_str,to_str)\n \nDescription\n----------- \nReturns the string str with all occurrences of the string\nfrom_str\nreplaced by the string to_str. REPLACE() performs a\ncase-sensitive\nmatch when searching for from_str.\n \nExamples\n-------- \nSELECT REPLACE(\'www.mariadb.org\', \'w\', \'Ww\');\n+---------------------------------------+\n| REPLACE(\'www.mariadb.org\', \'w\', \'Ww\') |\n+---------------------------------------+\n| WwWwWw.mariadb.org |\n+---------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/replace-function/','','https://mariadb.com/kb/en/library/replace-function/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (623,37,'REVERSE','Syntax\n------ \nREVERSE(str)\n \nDescription\n----------- \nReturns the string str with the order of the characters\nreversed.\n \nExamples\n-------- \nSELECT REVERSE(\'desserts\');\n+---------------------+\n| REVERSE(\'desserts\') |\n+---------------------+\n| stressed |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/reverse/','','https://mariadb.com/kb/en/library/reverse/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (624,37,'RIGHT','Syntax\n------ \nRIGHT(str,len)\n \nDescription\n----------- \nReturns the rightmost len characters from the string str, or\nNULL if\nany argument is NULL.\n \nExamples\n-------- \nSELECT RIGHT(\'MariaDB\', 2);\n+---------------------+\n| RIGHT(\'MariaDB\', 2) |\n+---------------------+\n| DB |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/right/','','https://mariadb.com/kb/en/library/right/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (625,37,'RPAD','Syntax\n------ \nRPAD(str, len [, padstr])\n \nDescription\n----------- \nReturns the string str, right-padded with the string padstr\nto a\nlength of len characters. If str is longer than len, the\nreturn value\nis shortened to len characters. If padstr is omitted, the\nRPAD function pads spaces.\n \nPrior to MariaDB 10.3.1, the padstr parameter was mandatory.\n \nReturns NULL if given a NULL argument. If the result is\nempty (a length of zero), returns either an empty string,\nor, from MariaDB 10.3.6 with SQL_MODE=Oracle, NULL.\n \nThe Oracle mode version of the function can be accessed\noutside of Oracle mode by using RPAD_ORACLE as the function\nname.\n \nExamples\n-------- \nSELECT RPAD(\'hello\',10,\'.\');\n+----------------------+\n| RPAD(\'hello\',10,\'.\') |\n+----------------------+\n| hello..... |\n+----------------------+\n \nSELECT RPAD(\'hello\',2,\'.\');\n+---------------------+\n| RPAD(\'hello\',2,\'.\') |\n+---------------------+\n| he |\n+---------------------+\n \nFrom MariaDB 10.3.1, with the pad string defaulting to\nspace.\n \nSELECT RPAD(\'hello\',30);\n+--------------------------------+\n| RPAD(\'hello\',30) |\n+--------------------------------+\n| hello |\n+--------------------------------+\n \nOracle mode version from MariaDB 10.3.6:\n \nSELECT RPAD(\'\',0),RPAD_ORACLE(\'\',0);\n+------------+-------------------+\n| RPAD(\'\',0) | RPAD_ORACLE(\'\',0) |\n+------------+-------------------+\n| | NULL |\n+------------+-------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/rpad/','','https://mariadb.com/kb/en/library/rpad/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (626,37,'RTRIM','Syntax\n------ \nRTRIM(str)\n \nDescription\n----------- \nReturns the string str with trailing space characters\nremoved.\n \nReturns NULL if given a NULL argument. If the result is\nempty, returns either an empty string, or, from MariaDB\n10.3.6 with SQL_MODE=Oracle, NULL.\n \nThe Oracle mode version of the function can be accessed\noutside of Oracle mode by using RTRIM_ORACLE as the function\nname.\n \nExamples\n-------- \nSELECT QUOTE(RTRIM(\'MariaDB \'));\n+-----------------------------+\n| QUOTE(RTRIM(\'MariaDB \')) |\n+-----------------------------+\n| \'MariaDB\' |\n+-----------------------------+\n \nOracle mode version from MariaDB 10.3.6:\n \nSELECT RTRIM(\'\'),RTRIM_ORACLE(\'\');\n+-----------+------------------+\n| RTRIM(\'\') | RTRIM_ORACLE(\'\') |\n+-----------+------------------+\n| | NULL |\n+-----------+------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/rtrim/','','https://mariadb.com/kb/en/library/rtrim/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (627,37,'SOUNDEX','Syntax\n------ \nSOUNDEX(str)\n \nDescription\n----------- \nReturns a soundex string from str. Two strings that sound\nalmost the\nsame should have identical soundex strings. A standard\nsoundex string is four\ncharacters long, but the SOUNDEX() function returns an\narbitrarily long\nstring. You can use SUBSTRING() on the result to get a\nstandard soundex\nstring. All non-alphabetic characters in str are ignored.\nAll\ninternational alphabetic characters outside the A-Z range\nare treated as\nvowels.\n \nImportant: When using SOUNDEX(), you should be aware of the\nfollowing limitations:\nThis function, as currently implemented, is intended to work\nwell with\n strings that are in the English language only. Strings in\nother languages may\n not produce reliable results.\n \nExamples\n-------- \nSOUNDEX(\'Hello\');\n+------------------+\n| SOUNDEX(\'Hello\') |\n+------------------+\n| H400 |\n+------------------+\n \nSELECT SOUNDEX(\'MariaDB\');\n+--------------------+\n| SOUNDEX(\'MariaDB\') |\n+--------------------+\n| M631 |\n+--------------------+\n \nSELECT SOUNDEX(\'Knowledgebase\');\n+--------------------------+\n| SOUNDEX(\'Knowledgebase\') |\n+--------------------------+\n| K543212 |\n+--------------------------+\n \nSELECT givenname, surname FROM users WHERE\nSOUNDEX(givenname) = SOUNDEX(\"robert\");\n+-----------+---------+\n| givenname | surname |\n+-----------+---------+\n| Roberto | Castro |\n+-----------+---------+\n \n\n\nURL: https://mariadb.com/kb/en/library/soundex/','','https://mariadb.com/kb/en/library/soundex/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (628,37,'SOUNDS LIKE','Syntax\n------ \nexpr1 SOUNDS LIKE expr2\n \nDescription\n----------- \nThis is the same as SOUNDEX(expr1) = SOUNDEX(expr2).\n \nExample\n \nSELECT givenname, surname FROM users WHERE givenname SOUNDS\nLIKE \"robert\";\n \n+-----------+---------+\n| givenname | surname |\n+-----------+---------+\n| Roberto | Castro |\n+-----------+---------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/sounds-like/','','https://mariadb.com/kb/en/library/sounds-like/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (629,37,'SPACE','Syntax\n------ \nSPACE(N)\n \nDescription\n----------- \nReturns a string consisting of N space characters. If N is\nNULL, returns NULL.\n \nExamples\n-------- \nSELECT QUOTE(SPACE(6));\n+-----------------+\n| QUOTE(SPACE(6)) |\n+-----------------+\n| \' \' |\n+-----------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/space/','','https://mariadb.com/kb/en/library/space/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (630,37,'STRCMP','Syntax\n------ \nSTRCMP(expr1,expr2)\n \nDescription\n----------- \nSTRCMP() returns 0 if the strings are the same, -1 if the\nfirst\nargument is smaller than the second according to the current\nsort order,\nand 1 otherwise.\n \nExamples\n-------- \nSELECT STRCMP(\'text\', \'text2\');\n+-------------------------+\n| STRCMP(\'text\', \'text2\') |\n+-------------------------+\n| -1 |\n+-------------------------+\n \nSELECT STRCMP(\'text2\', \'text\');\n+-------------------------+\n| STRCMP(\'text2\', \'text\') |\n+-------------------------+\n| 1 |\n+-------------------------+\n \nSELECT STRCMP(\'text\', \'text\');\n+------------------------+\n| STRCMP(\'text\', \'text\') |\n+------------------------+\n| 0 |\n+------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/strcmp/','','https://mariadb.com/kb/en/library/strcmp/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (631,37,'SUBSTR','Description\n----------- \nSUBSTR() is a synonym for SUBSTRING().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/substr/','','https://mariadb.com/kb/en/library/substr/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (632,37,'SUBSTRING','Syntax\n------ \nSUBSTRING(str,pos), \nSUBSTRING(str FROM pos), \nSUBSTRING(str,pos,len),\nSUBSTRING(str FROM pos FOR len)\n \nSUBSTR(str,pos), \nSUBSTR(str FROM pos), \nSUBSTR(str,pos,len),\nSUBSTR(str FROM pos FOR len)\n \nDescription\n----------- \nThe forms without a len argument return a substring from\nstring str starting at position pos.\n \nThe forms with a len argument return a substring len\ncharacters long from string str, starting at position pos.\n \nThe forms that use FROM are standard SQL syntax.\n \nIt is also possible to use a negative value for pos. In this\ncase, the beginning of the substring is pos characters from\nthe end of the string, rather than the beginning. A negative\nvalue may be used for pos in any of the forms of this\nfunction.\n \nBy default, the position of the first character in the\nstring from which the substring is to be extracted is\nreckoned as 1. For Oracle-compatibility, from MariaDB\n10.3.3, when sql_mode is set to \'oracle\', position zero is\ntreated as position 1 (although the first character is still\nreckoned as 1).\n \nIf any argument is NULL, returns NULL.\n \nExamples\n-------- \nSELECT SUBSTRING(\'Knowledgebase\',5);\n+------------------------------+\n| SUBSTRING(\'Knowledgebase\',5) |\n+------------------------------+\n| ledgebase |\n+------------------------------+\n \nSELECT SUBSTRING(\'MariaDB\' FROM 6);\n+-----------------------------+\n| SUBSTRING(\'MariaDB\' FROM 6) |\n+-----------------------------+\n| DB |\n+-----------------------------+\n \nSELECT SUBSTRING(\'Knowledgebase\',3,7);\n+--------------------------------+\n| SUBSTRING(\'Knowledgebase\',3,7) |\n+--------------------------------+\n| owledge |\n+--------------------------------+\n \nSELECT SUBSTRING(\'Knowledgebase\', -4);\n+--------------------------------+\n| SUBSTRING(\'Knowledgebase\', -4) |\n+--------------------------------+\n| base |\n+--------------------------------+\n \nSELECT SUBSTRING(\'Knowledgebase\', -8, 4);\n+-----------------------------------+\n| SUBSTRING(\'Knowledgebase\', -8, 4) |\n+-----------------------------------+\n| edge |\n+-----------------------------------+\n \nSELECT SUBSTRING(\'Knowledgebase\' FROM -8 FOR 4);\n+------------------------------------------+\n| SUBSTRING(\'Knowledgebase\' FROM -8 FOR 4) |\n+------------------------------------------+\n| edge |\n+------------------------------------------+\n \nOracle mode from MariaDB 10.3.3:\n \nSELECT SUBSTR(\'abc\',0,3);\n+-------------------+\n| SUBSTR(\'abc\',0,3) |\n+-------------------+\n| |\n+-------------------+\n \nSELECT SUBSTR(\'abc\',1,2);\n+-------------------+\n| SUBSTR(\'abc\',1,2) |\n+-------------------+\n| ab |\n+-------------------+\n \nSET sql_mode=\'oracle\';\n \nSELECT SUBSTR(\'abc\',0,3);\n+-------------------+\n| SUBSTR(\'abc\',0,3) |\n+-------------------+\n| abc |\n+-------------------+\n \nSELECT SUBSTR(\'abc\',1,2);\n+-------------------+\n| SUBSTR(\'abc\',1,2) |\n+-------------------+\n| ab |\n+-------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/substring/','','https://mariadb.com/kb/en/library/substring/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (633,37,'SUBSTRING_INDEX','Syntax\n------ \nSUBSTRING_INDEX(str,delim,count)\n \nDescription\n----------- \nReturns the substring from string str before count\noccurrences of the\ndelimiter delim. If count is positive, everything to the\nleft\nof the final delimiter (counting from the left) is returned.\nIf count\nis negative, everything to the right of the final delimiter\n(counting from the\nright) is returned. SUBSTRING_INDEX() performs a\ncase-sensitive match when\nsearching for delim.\n \nIf any argument is NULL, returns NULL.\n \nExamples\n-------- \nSELECT SUBSTRING_INDEX(\'www.mariadb.org\', \'.\', 2);\n+--------------------------------------------+\n| SUBSTRING_INDEX(\'www.mariadb.org\', \'.\', 2) |\n+--------------------------------------------+\n| www.mariadb |\n+--------------------------------------------+\n \nSELECT SUBSTRING_INDEX(\'www.mariadb.org\', \'.\', -2);\n+---------------------------------------------+\n| SUBSTRING_INDEX(\'www.mariadb.org\', \'.\', -2) |\n+---------------------------------------------+\n| mariadb.org |\n+---------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/substring_index/','','https://mariadb.com/kb/en/library/substring_index/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (634,37,'TO_BASE64','The TO_BASE64() function was introduced in MariaDB 10.0.5.\n \nSyntax\n------ \nTO_BASE64(str)\n \nDescription\n----------- \nConverts the string argument str to its base-64 encoded\nform, returning the result as a character string in the\nconnection character set and collation.\n \nThe argument str will be converted to string first if it is\nnot a string. A NULL argument will return a NULL result.\n \nThe reverse function, FROM_BASE64(), decodes an encoded\nbase-64 string.\n \nThere are a numerous different methods to base-64 encode a\nstring. The following are used by MariaDB and MySQL:\nAlphabet value 64 is encoded as \'+\'.\nAlphabet value 63 is encoded as \'/\'.\nEncoding output is made up of groups of four printable\ncharacters, with each three bytes of data encoded using four\ncharacters. If the final group is not complete, it is padded\nwith \'=\' characters to make up a length of four.\nTo divide long output, a newline is added after every 76\ncharacters.\nDecoding will recognize and ignore newlines, carriage\nreturns, tabs, and spaces. \n \nExamples\n-------- \nSELECT TO_BASE64(\'Maria\');\n+--------------------+\n| TO_BASE64(\'Maria\') |\n+--------------------+\n| TWFyaWE= |\n+--------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/to_base64/','','https://mariadb.com/kb/en/library/to_base64/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (635,37,'TRIM','Syntax\n------ \nTRIM([{BOTH | LEADING | TRAILING} [remstr] FROM] str),\nTRIM([remstr FROM] str)\n \nDescription\n----------- \nReturns the string str with all remstr prefixes or suffixes\nremoved. If none of the specifiers BOTH, LEADING, or\nTRAILING is given, BOTH is assumed. remstr is optional and,\nif not specified, spaces are removed.\n \nReturns NULL if given a NULL argument. If the result is\nempty, returns either an empty string, or, from MariaDB\n10.3.6 with SQL_MODE=Oracle, NULL.\n \nThe Oracle mode version of the function can be accessed\noutside of Oracle mode by using TRIM_ORACLE as the function\nname.\n \nExamples\n-------- \nSELECT TRIM(\' bar \')\\G\n*************************** 1. row\n***************************\nTRIM(\' bar \'): bar\n \nSELECT TRIM(LEADING \'x\' FROM \'xxxbarxxx\')\\G\n*************************** 1. row\n***************************\nTRIM(LEADING \'x\' FROM \'xxxbarxxx\'): barxxx\n \nSELECT TRIM(BOTH \'x\' FROM \'xxxbarxxx\')\\G\n*************************** 1. row\n***************************\nTRIM(BOTH \'x\' FROM \'xxxbarxxx\'): bar\n \nSELECT TRIM(TRAILING \'xyz\' FROM \'barxxyz\')\\G\n*************************** 1. row\n***************************\nTRIM(TRAILING \'xyz\' FROM \'barxxyz\'): barx\n \nOracle mode version from MariaDB 10.3.6:\n \nSELECT TRIM(\'\'),TRIM_ORACLE(\'\');\n+----------+-----------------+\n| TRIM(\'\') | TRIM_ORACLE(\'\') |\n+----------+-----------------+\n| | NULL |\n+----------+-----------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/trim/','','https://mariadb.com/kb/en/library/trim/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (636,37,'UCASE','Syntax\n------ \nUCASE(str)\n \nDescription\n----------- \nUCASE() is a synonym for UPPER().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/ucase/','','https://mariadb.com/kb/en/library/ucase/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (637,37,'UNHEX','Syntax\n------ \nUNHEX(str)\n \nDescription\n----------- \nPerforms the inverse operation of HEX(str). That is, it\ninterprets\neach pair of hexadecimal digits in the argument as a number\nand\nconverts it to the character represented by the number. The\nresulting\ncharacters are returned as a binary string.\n \nIf str is NULL, UNHEX() returns NULL.\n \nExamples\n-------- \nSELECT HEX(\'MariaDB\');\n+----------------+\n| HEX(\'MariaDB\') |\n+----------------+\n| 4D617269614442 |\n+----------------+\n \nSELECT UNHEX(\'4D617269614442\');\n+-------------------------+\n| UNHEX(\'4D617269614442\') |\n+-------------------------+\n| MariaDB |\n+-------------------------+\n \nSELECT 0x4D617269614442;\n \n+------------------+\n| 0x4D617269614442 |\n+------------------+\n| MariaDB |\n+------------------+\n \nSELECT UNHEX(HEX(\'string\'));\n+----------------------+\n| UNHEX(HEX(\'string\')) |\n+----------------------+\n| string |\n+----------------------+\n \nSELECT HEX(UNHEX(\'1267\'));\n+--------------------+\n| HEX(UNHEX(\'1267\')) |\n+--------------------+\n| 1267 |\n+--------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/unhex/','','https://mariadb.com/kb/en/library/unhex/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (638,37,'UPDATEXML','Syntax\n------ \nUpdateXML(xml_target, xpath_expr, new_xml)\n \nDescription\n----------- \nThis function replaces a single portion of a given fragment\nof XML markup\nxml_target with a new XML fragment new_xml, and then returns\nthe\nchanged XML. The portion of xml_target that is replaced\nmatches an XPath\nexpression xpath_expr supplied by the user. If no expression\nmatching\nxpath_expr is found, or if multiple matches are found, the\nfunction returns\nthe original xml_target XML fragment. All three arguments\nshould be\nstrings.\n \nExamples\n-------- \nSELECT\n UpdateXML(\'ccc\', \'/a\', \'fff\') AS val1,\n UpdateXML(\'ccc\', \'/b\', \'fff\') AS val2,\n UpdateXML(\'ccc\', \'//b\', \'fff\') AS val3,\n UpdateXML(\'ccc\', \'/a/d\', \'fff\') AS val4,\n UpdateXML(\'ccc\', \'/a/d\', \'fff\') AS val5\n \\G\n*************************** 1. row\n***************************\nval1: fff\nval2: ccc\nval3: fff\nval4: cccfff\nval5: ccc\n1 row in set (0.00 sec)\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/updatexml/','','https://mariadb.com/kb/en/library/updatexml/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (639,37,'UPPER','Syntax\n------ \nUPPER(str)\n \nDescription\n----------- \nReturns the string str with all characters changed to\nuppercase\naccording to the current character set mapping. The default\nis latin1\n(cp1252 West European).\n \nSELECT UPPER(surname), givenname FROM users ORDER BY\nsurname;\n \n+----------------+------------+\n| UPPER(surname) | givenname |\n+----------------+------------+\n| ABEL | Jacinto |\n| CASTRO | Robert |\n| COSTA | Phestos |\n| MOSCHELLA | Hippolytos |\n+----------------+------------+\n \nUPPER() is ineffective when applied to binary strings\n(BINARY,\nVARBINARY, BLOB). The description of \nLOWER() shows how to\nperform lettercase conversion of binary strings.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/upper/','','https://mariadb.com/kb/en/library/upper/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (640,37,'WEIGHT_STRING','The WEIGHT_STRING function was introduced in MariaDB 10.0.5.\n \nSyntax\n------ \nWEIGHT_STRING(str [AS {CHAR|BINARY}(N)] [LEVEL levels]\n[flags])\n levels: N [ASC|DESC|REVERSE] [, N [ASC|DESC|REVERSE]] ... \n \nDescription\n----------- \nReturns a binary string representing the string\'s sorting\nand comparison value. A string with a lower result means\nthat for sorting purposes the string appears before a string\nwith a higher result.\n \nWEIGHT_STRING() is particularly useful when adding new\ncollations, for testing purposes.\n \nIf str is a non-binary string (CHAR, VARCHAR or TEXT),\nWEIGHT_STRING returns the string\'s collation weight. If str\nis a binary string (BINARY, VARBINARY or BLOB), the return\nvalue is simply the input value, since the weight for each\nbyte in a binary string is the byte value.\n \nWEIGHT_STRING() returns NULL if given a NULL input. \n \nThe optional AS clause permits casting the input string to a\nbinary or non-binary string, as well as to a particular\nlength.\n \nAS BINARY(N) measures the length in bytes rather than\ncharacters, and right pads with 0x00 bytes to the desired\nlength. \n \nAS CHAR(N) measures the length in characters, and right pads\nwith spaces to the desired length.\n \nN has a minimum value of 1, and if it is less than the\nlength of the input string, the string is truncated without\nwarning.\n \nThe optional LEVEL clause specifies that the return value\nshould contain weights for specific collation levels. The\nlevels specifier can either be a single integer, a\ncomma-separated list of integers, or a range of integers\nseparated by a dash (whitespace is ignored). Integers can\nrange from 1 to a maximum of 6, dependent on the collation,\nand need to be listed in ascending order.\n \nIf the LEVEL clause is no provided, a default of 1 to the\nmaximum for the collation is assumed.\n \nIf the LEVEL is specified without using a range, an optional\nmodifier is permitted.\n \nASC, the default, returns the weights without any\nmodification.\n \nDESC returns bitwise-inverted weights.\n \nREVERSE returns the weights in reverse order.\n \nExamples\n-------- \nThe examples below use the HEX() function to represent\nnon-printable results in hexadecimal format.\n \nSELECT HEX(WEIGHT_STRING(\'x\'));\n+-------------------------+\n| HEX(WEIGHT_STRING(\'x\')) |\n+-------------------------+\n| 0058 |\n+-------------------------+\n \nSELECT HEX(WEIGHT_STRING(\'x\' AS BINARY(4)));\n+--------------------------------------+\n| HEX(WEIGHT_STRING(\'x\' AS BINARY(4))) |\n+--------------------------------------+\n| 78000000 |\n+--------------------------------------+\n \nSELECT HEX(WEIGHT_STRING(\'x\' AS CHAR(4)));\n+------------------------------------+\n| HEX(WEIGHT_STRING(\'x\' AS CHAR(4))) |\n+------------------------------------+\n| 0058002000200020 |\n+------------------------------------+\n \nSELECT HEX(WEIGHT_STRING(0xaa22ee LEVEL 1));\n+--------------------------------------+\n| HEX(WEIGHT_STRING(0xaa22ee LEVEL 1)) |\n+--------------------------------------+\n| AA22EE |\n+--------------------------------------+\n \nSELECT HEX(WEIGHT_STRING(0xaa22ee LEVEL 1 DESC));\n+-------------------------------------------+\n| HEX(WEIGHT_STRING(0xaa22ee LEVEL 1 DESC)) |\n+-------------------------------------------+\n| 55DD11 |\n+-------------------------------------------+\n \nSELECT HEX(WEIGHT_STRING(0xaa22ee LEVEL 1 REVERSE));\n+----------------------------------------------+\n| HEX(WEIGHT_STRING(0xaa22ee LEVEL 1 REVERSE)) |\n+----------------------------------------------+\n| EE22AA |\n+----------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/weight_string/','','https://mariadb.com/kb/en/library/weight_string/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (641,39,'ALTER DATABASE','Modifies a database, changing its overall characteristics.\n \nSyntax\n------ \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 \nDescription\n----------- \nALTER DATABASE enables you to change the overall\ncharacteristics of a\ndatabase. These characteristics are stored in the db.opt\nfile in the\ndatabase directory. To use ALTER DATABASE, you need the\nALTER\nprivilege on the database. ALTER SCHEMA is a synonym for\nALTER\nDATABASE.\n \nThe CHARACTER SET clause changes the default database\ncharacter set.\nThe COLLATE clause changes the default database collation.\nSee Character Sets and Collations for more.\n \nYou can see what character sets and collations are available\nusing,\nrespectively, the SHOW CHARACTER SET and SHOW COLLATION\nstatements.\n \nChanging the default character set/collation of a database\ndoes not change the character set/collation of any stored\nprocedures or stored functions that were previously created,\nand relied on the defaults. These need to be dropped and\nrecreated in order to apply the character set/collation\nchanges.\n \nThe database name can be omitted from the first syntax, in\nwhich case\nthe statement applies to the default database.\n \nThe syntax that includes the UPGRADE DATA DIRECTORY NAME\nclause was\nadded in MySQL 5.1.23. It updates the name of the directory\nassociated\nwith the database to use the encoding implemented in MySQL\n5.1 for\nmapping database names to database directory names (see\nIdentifier to File Name Mapping). This\nclause is for use under these conditions:\nIt is intended when upgrading MySQL to 5.1 or later from\nolder versions.\nIt is intended to update a database directory name to the\ncurrent encoding format if the name contains special\ncharacters that need encoding.\nThe statement is used by mysqlcheck (as invoked by\nmysql_upgrade).\n \nFor example,if a database in MySQL 5.0 has a name of a-b-c,\nthe name\ncontains instance of the `-\' character. In 5.0, the\ndatabase directory\nis also named a-b-c, which is not necessarily safe for all\nfile\nsystems. In MySQL 5.1 and up, the same database name is\nencoded as\na@002db@002dc to produce a file system-neutral directory\nname.\n \nWhen a MySQL installation is upgraded to MySQL 5.1 or later\nfrom an\nolder version,the server displays a name such as a-b-c\n(which is in\nthe old format) as #mysql50#a-b-c, and you must refer to the\nname\nusing the #mysql50# prefix. Use UPGRADE DATA DIRECTORY NAME\nin this\ncase to explicitly tell the server to re-encode the database\ndirectory\nname to the current encoding format:\n \nALTER DATABASE `#mysql50#a-b-c` UPGRADE DATA DIRECTORY NAME;\n \nAfter executing this statement, you can refer to the\ndatabase as a-b-c\nwithout the special #mysql50# prefix.\n \nExamples\n-------- \nALTER DATABASE test CHARACTER SET = \'utf8\' COLLATE =\n\'utf8_bin\';\n \n\n\nURL: https://mariadb.com/kb/en/library/alter-database/','','https://mariadb.com/kb/en/library/alter-database/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (642,39,'ALTER EVENT','Modifies one or more characteristics of an existing event.\n \nSyntax\n------ \nALTER\n [DEFINER = { user | CURRENT_USER }]\n EVENT event_name\n [ON SCHEDULE schedule]\n [ON COMPLETION [NOT] PRESERVE]\n [RENAME TO new_event_name]\n [ENABLE | DISABLE | DISABLE ON SLAVE]\n [COMMENT \'comment\']\n [DO sql_statement]\n \nDescription\n----------- \nThe ALTER EVENT statement is used to change one or more of\nthe\ncharacteristics of an existing event without the need to\ndrop and recreate it.\nThe syntax for each of the DEFINER, ON SCHEDULE, ON\nCOMPLETION,\nCOMMENT, ENABLE / DISABLE, and DO clauses is exactly the\nsame as when used with CREATE EVENT.\n \nThis statement requires the EVENT privilege.\nWhen a user executes a successful ALTER EVENT statement,\nthat user becomes\nthe definer for the affected event.\n \n(In MySQL 5.1.11 and earlier, an event could be altered only\nby its definer, or\nby a user having the SUPER privilege.)\n \nALTER EVENT works only with an existing event:\n \nALTER EVENT no_such_event ON SCHEDULE EVERY \'2:3\'\nDAY_HOUR;\nERROR 1539 (HY000): Unknown event \'no_such_event\'\n \nExamples\n-------- \nALTER EVENT myevent \n ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 2 HOUR \n DO \n UPDATE myschema.mytable SET mycol = mycol + 1;\n \n\n\nURL: https://mariadb.com/kb/en/library/alter-event/','','https://mariadb.com/kb/en/library/alter-event/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (643,39,'ALTER FUNCTION','Syntax\n------ \nALTER FUNCTION func_name [characteristic ...]\n \ncharacteristic:\n { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL\nDATA }\n | SQL SECURITY { DEFINER | INVOKER }\n | COMMENT \'string\'\n \nDescription\n----------- \nThis statement can be used to change the characteristics of\na stored\nfunction. More than one change may be specified in an ALTER\nFUNCTION\nstatement. However, you cannot change the parameters or body\nof a\nstored function using this statement; to make such changes,\nyou must\ndrop and re-create the function using DROP FUNCTION and\nCREATE FUNCTION.\n \nYou must have the ALTER ROUTINE privilege for the function.\n(That\nprivilege is granted automatically to the function creator.)\nIf binary\nlogging is enabled, the ALTER FUNCTION statement might also\nrequire\nthe SUPER privilege, as described in Binary Logging of\nStored Routines.\n \nExample\n \nALTER FUNCTION hello SQL SECURITY INVOKER;\n \n\n\nURL: https://mariadb.com/kb/en/library/alter-function/','','https://mariadb.com/kb/en/library/alter-function/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (644,39,'ALTER LOGFILE GROUP','Syntax\n------ \nALTER LOGFILE GROUP logfile_group\n ADD UNDOFILE \'file_name\'\n [INITIAL_SIZE [=] size]\n [WAIT]\n ENGINE [=] engine_name\n \nThe ALTER LOGFILE GROUP statement is not supported by\nMariaDB. It was originally inherited from MySQL NDB Cluster.\nSee MDEV-19295 for more information.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/alter-logfile-group/','','https://mariadb.com/kb/en/library/alter-logfile-group/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (645,39,'ALTER PROCEDURE','Syntax\n------ \nALTER PROCEDURE proc_name [characteristic ...]\n \ncharacteristic:\n { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL\nDATA }\n | SQL SECURITY { DEFINER | INVOKER }\n | COMMENT \'string\'\n \nDescription\n----------- \nThis statement can be used to change the characteristics of\na stored\nprocedure. More than one change may be specified in an ALTER\nPROCEDURE\nstatement. However, you cannot change the parameters or body\nof a\nstored procedure using this statement. To make such changes,\nyou must\ndrop and re-create the procedure using either CREATE OR\nREPLACE PROCEDURE (since MariaDB 10.1.3) or DROP PROCEDURE\nand CREATE PROCEDURE (MariaDB 10.1.2 and before).\n \nYou must have the ALTER ROUTINE privilege for the procedure.\nBy default, that privilege is granted automatically to the\nprocedure creator. See Stored Routine Privileges.\n \nExample\n \nALTER PROCEDURE simpleproc SQL SECURITY INVOKER;\n \n\n\nURL: https://mariadb.com/kb/en/library/alter-procedure/','','https://mariadb.com/kb/en/library/alter-procedure/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (646,39,'ALTER SERVER','Syntax\n------ \nALTER SERVER server_name\n OPTIONS (option [, option] ...)\n \nDescription\n----------- \nAlters the server information for server_name, adjusting the\nspecified\noptions as per the CREATE SERVER command. The corresponding\nfields in the mysql.servers table are updated accordingly.\nThis statement requires the SUPER privilege.\n \nExamples\n-------- \nALTER SERVER s OPTIONS (USER \'sally\');\n \n\n\nURL: https://mariadb.com/kb/en/library/alter-server/','','https://mariadb.com/kb/en/library/alter-server/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (647,39,'ALTER TABLE','Syntax\n------ \nALTER [ONLINE] [IGNORE] TABLE tbl_name\n [WAIT n | NOWAIT]\n alter_specification [, alter_specification] ...\n \nalter_specification:\n table_option ...\n | ADD [COLUMN] [IF NOT EXISTS] col_name column_definition\n [FIRST | AFTER col_name ]\n | ADD [COLUMN] [IF NOT EXISTS] (col_name\ncolumn_definition,...)\n | ADD {INDEX|KEY} [IF NOT EXISTS] [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 [IF NOT EXISTS] [index_name]\n(index_col_name,...)\n reference_definition\n | ADD PERIOD FOR SYSTEM_TIME (start_column_name,\nend_column_name)\n | ALTER [COLUMN] col_name SET DEFAULT literal\n| (expression)\n | ALTER [COLUMN] col_name DROP DEFAULT\n | CHANGE [COLUMN] [IF EXISTS] old_col_name new_col_name\ncolumn_definition\n [FIRST|AFTER col_name]\n | MODIFY [COLUMN] [IF EXISTS] col_name column_definition\n [FIRST | AFTER col_name]\n | DROP [COLUMN] [IF EXISTS] col_name [RESTRICT|CASCADE]\n | DROP PRIMARY KEY\n | DROP {INDEX|KEY} [IF EXISTS] index_name\n | DROP FOREIGN KEY [IF EXISTS] fk_symbol\n | DROP CONSTRAINT [IF EXISTS] constraint_name\n | DISABLE KEYS\n | ENABLE KEYS\n | RENAME [TO] new_tbl_name\n | ORDER BY col_name [, col_name] ...\n | CONVERT TO CHARACTER SET charset_name [COLLATE\ncollation_name]\n | [DEFAULT] CHARACTER SET [=] charset_name\n | [DEFAULT] COLLATE [=] collation_name\n | DISCARD TABLESPACE\n | IMPORT TABLESPACE\n | ALGORITHM [=] {DEFAULT|INPLACE|COPY|NOCOPY|INSTANT}\n | LOCK [=] {DEFAULT|NONE|SHARED|EXCLUSIVE}\n | FORCE\n | partition_options\n | ADD PARTITION (partition_definition)\n | DROP PARTITION partition_names\n | COALESCE PARTITION number\n | REORGANIZE PARTITION [partition_names INTO\n(partition_definitions)]\n | ANALYZE PARTITION partition_names\n | CHECK PARTITION partition_names\n | OPTIMIZE PARTITION partition_names\n | REBUILD PARTITION partition_names\n | REPAIR PARTITION partition_names\n | EXCHANGE PARTITION partition_name WITH TABLE tbl_name\n | REMOVE PARTITIONING\n | ADD SYSTEM VERSIONING\n | DROP SYSTEM VERSIONING\n \nindex_col_name:\n col_name [(length)] [ASC | DESC]\n \nindex_type:\n USING {BTREE | HASH | RTREE}\n \nindex_option:\n KEY_BLOCK_SIZE [=] value\n | index_type\n | WITH PARSER parser_name\n | COMMENT \'string\'\n | CLUSTERING={YES| NO}\n \ntable_options:\n table_option [[,] table_option] ...\nIn MariaDB 10.0.2 and later, IF EXISTS and IF NOT EXISTS\nclauses have been added for the following:\n \nADD COLUMN [IF NOT EXISTS]\nADD INDEX [IF NOT EXISTS]\nADD FOREIGN KEY [IF NOT EXISTS]\nADD PARTITION [IF NOT EXISTS]\nCREATE INDEX [IF NOT EXISTS]\n \nDROP COLUMN [IF EXISTS]\nDROP INDEX [IF EXISTS]\nDROP FOREIGN KEY [IF EXISTS]\nDROP PARTITION [IF EXISTS]\nCHANGE COLUMN [IF EXISTS]\nMODIFY COLUMN [IF EXISTS]\nDROP INDEX [IF EXISTS]\nWhen IF EXISTS and IF NOT EXISTS are used in clauses,\nqueries will not\nreport errors when the condition is triggered for that\nclause. A warning with\nthe same message text will be issued and the ALTER will move\non to the next\nclause in the statement (or end if finished).\n \nThis was done in MDEV-318.\n \nDescription\n----------- \nALTER TABLE enables you to change the structure of an\nexisting table.\nFor example, you can add or delete columns, create or\ndestroy indexes,\nchange the type of existing columns, or rename columns or\nthe table\nitself. You can also change the comment for the table and\nthe storage engine of the\ntable.\n \nIf another connection is using the table, a metadata lock is\nactive, and this statement will wait until the lock is\nreleased. This is also true for non-transactional tables.\n \nWhen adding a UNIQUE index on a column (or a set of columns)\nwhich have duplicated values, an error will be produced and\nthe statement will be stopped. To suppress the error and\nforce the creation of UNIQUE indexes, discarding duplicates,\nthe IGNORE option can be specified. This can be useful if a\ncolumn (or a set of columns) should be UNIQUE but it\ncontains duplicate values; however, this technique provides\nno control on which rows are preserved and which are\ndeleted. Also, note that IGNORE is accepted but ignored in\nALTER TABLE ... EXCHANGE PARTITION statements.\n \nThis statement can also be used to rename a table. For\ndetails see RENAME TABLE.\n \nWhen an index is created, the storage engine may use a\nconfigurable buffer in the process. Incrementing the buffer\nspeeds up the index creation. Aria and MyISAM allocate a\nbuffer whose size is defined by aria_sort_buffer_size or\nmyisam_sort_buffer_size, also used for REPAIR TABLE.\nInnoDB/XtraDB allocates three buffers whose size is defined\nby innodb_sort_buffer_size.\n \nPrivileges\n \nExecuting the ALTER TABLE statement generally requires at\nleast the ALTER privilege for the table or the database..\n \nIf you are renaming a table, then it also requires the DROP,\nCREATE and INSERT privileges for the table or the database\nas well.\n \nOnline DDL\n \nIn MariaDB 10.0 and later, online DDL is supported with the\nALGORITHM and LOCK clauses.\n \nSee InnoDB Online DDL Overview for more information on\nonline DDL with InnoDB.\n \nALTER ONLINE TABLE\n \nALTER ONLINE TABLE has also worked for partitioned tables\nsince MariaDB 10.0.11.\n \nOnline ALTER TABLE is available by executing the following:\n \nALTER ONLINE TABLE ...;\n \nThis statement has the following semantics:\n \nIn MariaDB 10.0.12 and later, this statement is equivalent\nto the following:\n \nALTER TABLE ... LOCK=NONE;\n \nSee the LOCK alter specification for more information.\n \nIn MariaDB 10.0.11, this statement is equivalent to the\nfollowing:\n \nALTER TABLE ... ALGORITHM=INPLACE;\n \nSee the ALGORITHM alter specification for more information.\n \nMariaDB until 10.0.10\n \nIn MariaDB 10.0.10 and before, this statement ensures that\nthe ALTER TABLE statement does not make a copy of the table.\n \nWAIT/NOWAIT\n \nSet the lock wait timeout. See WAIT and NOWAIT.\n \nColumn Definitions\n \nSee CREATE TABLE: Column Definitions for information about\ncolumn definitions.\n \nIndex Definitions\n \nSee CREATE TABLE: Index Definitions for information about\nindex definitions.\n \nThe CREATE INDEX and DROP INDEX statements can also be used\nto add or remove an index.\n \nCharacter Sets and Collations\n \nCONVERT TO CHARACTER SET charset_name [COLLATE\ncollation_name]\n[DEFAULT] CHARACTER SET [=] charset_name\n[DEFAULT] COLLATE [=] collation_name\nSee Setting Character Sets and Collations for details on\nsetting the character sets and collations.\n \nAlter Specifications\n \nTable Options\n \nSee CREATE TABLE: Table Options for information about table\noptions.\n \nADD COLUMN\n \n... ADD COLUMN [IF NOT EXISTS] (col_name\ncolumn_definition,...)\nAdds a column to the table. The syntax is the same as in\nCREATE TABLE.\nIf you are using IF NOT_EXISTS the column will not be added\nif it was not there already. This is very useful when doing\nscripts to modify tables.\n \nThe FIRST and AFTER clauses affect the physical order of\ncolumns in the datafile. Use FIRST to add a column in the\nfirst (leftmost) position, or AFTER followed by a column\nname to add the new column in any other position. Note that,\nnowadays, the physical position of a column is usually\nirrelevant.\n \nSee also Instant ADD COLUMN for InnoDB.\n \nDROP COLUMN\n \n... DROP COLUMN [IF EXISTS] col_name [CASCADE|RESTRICT]\nDrops the column from the table.\nIf you are using IF EXISTS you will not get an error if the\ncolumn didn\'t exist.\nIf the column is part of any index, the column will be\ndropped from them, except if you add a new column with\nidentical name at the same time. The index will be dropped\nif all columns from the index were dropped.\nIf the column was used in a view or trigger, you will get an\nerror next time the view or trigger is accessed.\n \nDropping a column that is part of a multi-column UNIQUE\nconstraint is not permitted. For example:\n \nCREATE TABLE a (\n a int,\n b int,\n primary key (a,b)\n);\n \nALTER TABLE x DROP COLUMN a;\n[42000][1072] Key column \'A\' doesn\'t exist in table\n \nThe reason is that dropping column a would result in the new\nconstraint that all values in column b be unique. In order\nto drop the column, an explicit DROP PRIMARY KEY and ADD\nPRIMARY KEY would be required. Up until MariaDB 10.2.7, the\ncolumn was dropped and the additional constraint applied,\nresulting in the following structure:\n \nALTER TABLE x DROP COLUMN a;\nQuery OK, 0 rows affected (0.46 sec)\n \nDESC x;\n+-------+---------+------+-----+---------+-------+\n| Field | Type | Null | Key | Default | Extra |\n+-------+---------+------+-----+---------+-------+\n| b | int(11) | NO | PRI | NULL | |\n+-------+---------+------+-----+---------+-------+\n \nMariaDB 10.4.0 supports instant DROP COLUMN. DROP COLUMN of\nan indexed column would imply DROP INDEX (and in the case of\na non-UNIQUE multi-column index, possibly ADD INDEX). These\nwill not be allowed with ALGORITHM=INSTANT, but unlike\nbefore, they can be allowed with ALGORITHM=NOCOPY\n \nRESTRICT and CASCADE are allowed to make porting from other\ndatabase systems easier. In MariaDB, they do nothing.\n \nMODIFY COLUMN\n \nAllows you to modify the type of a column. The column will\nbe at the same place as the original column and all indexes\non the column will be kept. Note that when modifying column,\nyou should specify all attributes for the new column.\n \nCREATE TABLE t1 (a INT UNSIGNED AUTO_INCREMENT, PRIMARY\nKEY((a));\nALTER TABLE t1 MODIFY a BIGINT UNSIGNED AUTO_INCREMENT;\n \nCHANGE COLUMN\n \nWorks like MODIFY COLUMN except that you can also change the\nname of the column. The column will be at the same place as\nthe original column and all index on the column will be\nkept.\n \nCREATE TABLE t1 (a INT UNSIGNED AUTO_INCREMENT, PRIMARY\nKEY(a));\nALTER TABLE t1 CHANGE a b BIGINT UNSIGNED AUTO_INCREMENT;\n \nALTER COLUMN\n \nThis lets you change column options.\n \nCREATE TABLE t1 (a INT UNSIGNED AUTO_INCREMENT, b\nvarchar(50), PRIMARY KEY(a));\nALTER TABLE t1 ALTER b SET DEFAULT \'hello\';\n \nADD PRIMARY KEY\n \nAdd a primary key.\n \nFor PRIMARY KEY indexes, you can specify a name for the\nindex, but it is silently ignored, and the name of the index\nis always PRIMARY.\n \nSee Getting Started with Indexes: Primary Key for more\ninformation.\n \nDROP PRIMARY KEY\n \nDrop a primary key.\n \nFor PRIMARY KEY indexes, you can specify a name for the\nindex, but it is silently ignored, and the name of the index\nis always PRIMARY.\n \nSee Getting Started with Indexes: Primary Key for more\ninformation.\n \nADD FOREIGN KEY\n \nAdd a foreign key.\n \nFor FOREIGN KEY indexes, a reference definition must be\nprovided.\n \nFor FOREIGN KEY indexes, you can specify a name for the\nconstraint, using the CONSTRAINT keyword. That name will be\nused in error messages.\n \nFirst, you have to specify the name of the target (parent)\ntable and a column or a column list which must be indexed\nand whose values must match to the foreign key\'s values.\nThe MATCH clause is accepted to improve the compatibility\nwith other DBMS\'s, but has no meaning in MariaDB. The ON\nDELETE and ON UPDATE clauses specify what must be done when\na DELETE (or a REPLACE) statements attempts to delete a\nreferenced row from the parent table, and when an UPDATE\nstatement attempts to modify the referenced foreign key\ncolumns in a parent table row, respectively. The following\noptions are allowed:\nRESTRICT: The delete/update operation is not performed. The\nstatement terminates with a 1451 error (SQLSTATE \'2300\').\nNO ACTION: Synonym for RESTRICT.\nCASCADE: The delete/update operation is performed in both\ntables.\nSET NULL: The update or delete goes ahead in the parent\ntable, and the corresponding foreign key fields in the child\ntable are set to NULL. (They must not be defined as NOT NULL\nfor this to succeed).\n \nMariaDB until 5.3\nSET DEFAULT: This option is currently implemented only for\nthe PBXT storage engine, which is disabled by default and no\nlonger maintained. It sets the child table\'s foreign key\nfields to their DEFAULT values when the referenced parent\ntable key entries are updated or deleted.\n \nIf either clause is omitted, the default behavior for the\nomitted clause is RESTRICT.\n \nSee Foreign Keys for more information.\n \nDROP FOREIGN KEY\n \nDrop a foreign key.\n \nSee Foreign Keys for more information.\n \nADD INDEX\n \nAdd a plain index.\n \nPlain indexes are regular indexes that are not unique, and\nare not acting as a primary key or a foreign key. They are\nalso not the \"specialized\" FULLTEXT or SPATIAL indexes.\n \nSee Getting Started with Indexes: Plain Indexes for more\ninformation.\n \nDROP INDEX\n \nDrop a plain index.\n \nPlain indexes are regular indexes that are not unique, and\nare not acting as a primary key or a foreign key. They are\nalso not the \"specialized\" FULLTEXT or SPATIAL indexes.\n \nSee Getting Started with Indexes: Plain Indexes for more\ninformation.\n \nADD UNIQUE INDEX\n \nAdd a unique index.\n \nThe UNIQUE keyword means that the index will not accept\nduplicated values, except for NULLs. An error will raise if\nyou try to insert duplicate values in a UNIQUE index.\n \nFor UNIQUE indexes, you can specify a name for the\nconstraint, using the CONSTRAINT keyword. That name will be\nused in error messages.\n \nSee Getting Started with Indexes: Unique Index for more\ninformation.\n \nDROP UNIQUE INDEX\n \nDrop a unique index.\n \nThe UNIQUE keyword means that the index will not accept\nduplicated values, except for NULLs. An error will raise if\nyou try to insert duplicate values in a UNIQUE index.\n \nFor UNIQUE indexes, you can specify a name for the\nconstraint, using the CONSTRAINT keyword. That name will be\nused in error messages.\n \nSee Getting Started with Indexes: Unique Index for more\ninformation.\n \nADD FULLTEXT INDEX\n \nAdd a FULLTEXT index.\n \nSee Full-Text Indexes for more information.\n \nDROP FULLTEXT INDEX\n \nDrop a FULLTEXT index.\n \nSee Full-Text Indexes for more information.\n \nADD SPATIAL INDEX\n \nAdd a SPATIAL index.\n \nSee SPATIAL INDEX for more information.\n \nDROP SPATIAL INDEX\n \nDrop a SPATIAL index.\n \nSee SPATIAL INDEX for more information.\n \nENABLE/ DISABLE KEYS\n \nDISABLE KEYS will disable all non unique keys for the table\nfor storage engines that support this (at least MyISAM and\nAria). This can be used to speed up inserts into empty\ntables.\n \nENABLE KEYS will enable all disabled keys.\n \nRENAME TO\n \nRenames the table. See also RENAME TABLE.\n \nADD CONSTRAINT\n \nModifies the table adding a constraint on a particular\ncolumn or columns.\n \nMariaDB 10.2.1 introduced new ways to define a constraint.\n \nNote: Before MariaDB 10.2.1, constraint expressions were\naccepted in syntax, but ignored.\n \nALTER TABLE table_name \nADD CONSTRAINT [constraint_name] CHECK(expression);\nBefore a row is inserted or updated, all constraints are\nevaluated in the order they are defined. If any constraint\nfails, then the row will not be updated. One can use most\ndeterministic functions in a constraint, including UDF\'s.\n \nCREATE TABLE account_ledger (\n id INT PRIMARY KEY AUTO_INCREMENT,\n transaction_name VARCHAR(100),\n credit_account VARCHAR(100),\n credit_amount INT,\n debit_account VARCHAR(100),\n debit_amount INT);\n \nALTER TABLE account_ledger \nADD CONSTRAINT is_balanced \n CHECK((debit_amount + credit_amount) = 0);\n \nThe constraint_name is optional. If you don\'t provide one\nin the ALTER TABLE statement, MariaDB auto-generates a name\nfor you. This is done so that you can remove it later using\nDROP CONSTRAINT clause.\n \nYou can disable all constraint expression checks by setting\nthe variable check_constraint_checks to OFF. You may find\nthis useful when loading a table that violates some\nconstraints that you want to later find and fix in SQL.\n \nTo view constraints on a table, query\ninformation_schema.TABLE_CONSTRAINTS:\n \nSELECT CONSTRAINT_NAME, TABLE_NAME, CONSTRAINT_TYPE \nFROM information_schema.TABLE_CONSTRAINTS\nWHERE TABLE_NAME = \'account_ledger\';\n \n+-----------------+----------------+-----------------+\n| CONSTRAINT_NAME | TABLE_NAME | CONSTRAINT_TYPE |\n+-----------------+----------------+-----------------+\n| is_balanced | account_ledger | CHECK |\n+-----------------+----------------+-----------------+\n \nDROP CONSTRAINT\n \nDROP CONSTRAINT for UNIQUE and FOREIGN KEY constraints was\nintroduced in MariaDB 10.2.22 and MariaDB 10.3.13.\n \nDROP CONSTRAINT for CHECK constraints was introduced in\nMariaDB 10.2.1\n \nModifies the table, removing the given constraint.\n \nALTER TABLE table_name\nDROP CONSTRAINT constraint_name;\n \nWhen you add a constraint to a table, whether through a\nCREATE TABLE or ALTER TABLE...ADD CONSTRAINT statement, you\ncan either set a constraint_name yourself, or allow MariaDB\nto auto-generate one for you. To view constraints on a\ntable, query information_schema.TABLE_CONSTRAINTS. For\ninstance,\n \nCREATE TABLE t (\n a INT,\n b INT,\n c INT,\n CONSTRAINT CHECK(a > b),\n CONSTRAINT check_equals CHECK(a = c)); \n \nSELECT CONSTRAINT_NAME, TABLE_NAME, CONSTRAINT_TYPE \nFROM information_schema.TABLE_CONSTRAINTS\nWHERE TABLE_NAME = \'t\';\n \n+-----------------+----------------+-----------------+\n| CONSTRAINT_NAME | TABLE_NAME | CONSTRAINT_TYPE |\n+-----------------+----------------+-----------------+\n| check_equals | t | CHECK |\n| CONSTRAINT_1 | t | CHECK |\n+-----------------+----------------+-----------------+\n \nTo remove a constraint from the table, issue an ALTER\nTABLE...DROP CONSTRAINT statement. For example,\n \nALTER TABLE t DROP CONSTRAINT is_unique;\n \nADD SYSTEM VERSIONING\n \nSystem-versioned tables was added in MariaDB 10.3.4.\n \nAdd system versioning.\n \nDROP SYSTEM VERSIONING\n \nSystem-versioned tables was added in MariaDB 10.3.4.\n \nDrop system versioning.\n \nADD PERIOD FOR SYSTEM_TIME\n \nSystem-versioned tables was added in MariaDB 10.3.4.\n \nFORCE\n \nALTER TABLE ... FORCE can force MariaDB to re-build the\ntable.\n \nIn MariaDB 5.5 and before, this could only be done by\nsetting the ENGINE table option to its old value. For\nexample, for an InnoDB table, one could execute the\nfollowing:\n \nALTER TABLE tab_name ENGINE = InnoDB;\n \nIn MariaDB 10.0 and later, the FORCE option can be used\ninstead. For example, :\n \nALTER TABLE tab_name FORCE;\n \nWith InnoDB, the table rebuild will only reclaim unused\nspace (i.e. the space previously used for deleted rows) if\nthe innodb_file_per_table system variable is set to ON. If\nthe system variable is OFF, then the space will not be\nreclaimed, but it will be-re-used for new data that\'s later\nadded.\n \nEXCHANGE PARTITION\n \nALTER TABLE ... EXCHANGE PARTITION was introduced in MariaDB\n10.0.4\n \nThis is used to exchange the tablespace files between a\npartition and another table.\n \nSee copying InnoDB\'s transportable tablespaces for more\ninformation.\n \nDISCARD TABLESPACE\n \nThis is used to discard an InnoDB table\'s tablespace.\n \nSee copying I','','https://mariadb.com/kb/en/library/alter-table/');
+update help_topic set description = CONCAT(description, 'nnoDB\'s transportable tablespaces for more\ninformation.\n \nIMPORT TABLESPACE\n \nThis is used to import an InnoDB table\'s tablespace. The\ntablespace should have been copied from its original server\nafter executing FLUSH TABLES FOR EXPORT.\n \nSee copying InnoDB\'s transportable tablespaces for more\ninformation.\n \nALTER TABLE ... IMPORT only applies to InnoDB tables. Most\nother popular storage engines, such as Aria and MyISAM, will\nrecognize their data files as soon as they\'ve been placed\nin the proper directory under the datadir, and no special\nDDL is required to import them.\n \nALGORITHM\n \nIn MariaDB 5.5 and before, ALTER TABLE operations required\nmaking a temporary copy of the table, which can be slow for\nlarge tables.\n \nIn MariaDB 10.0 and later, the ALTER TABLE statement\nsupports the ALGORITHM clause. This clause is one of the\nclauses that is used to implement online DDL. ALTER TABLE\nsupports several different algorithms. An algorithm can be\nexplicitly chosen for an ALTER TABLE operation by setting\nthe ALGORITHM clause. The supported values are:\nALGORITHM=DEFAULT - This implies the default behavior for\nthe specific statement, such as if no ALGORITHM clause is\nspecified.\nALGORITHM=COPY\nALGORITHM=INPLACE\nALGORITHM=NOCOPY - This was added in MariaDB 10.3.7.\nALGORITHM=INSTANT - This was added in MariaDB 10.3.7.\n \nSee InnoDB Online DDL Overview: ALGORITHM for information on\nhow the ALGORITHM clause affects InnoDB.\n \nALGORITHM=DEFAULT\n \nThe default behavior, which occurs if ALGORITHM=DEFAULT is\nspecified, or if ALGORITHM is not specified at all, usually\nonly makes a copy if the operation doesn\'t support being\ndone in-place at all. In this case, the most efficient\navailable algorithm will usually be used.\n \nHowever, in MariaDB 10.3.6 and before, if the value of the\nold_alter_table system variable is set to ON, then the\ndefault behavior is to perform ALTER TABLE operations by\nmaking a copy of the table using the old algorithm.\n \nIn MariaDB 10.3.7 and later, the old_alter_table system\nvariable is deprecated. Instead, the alter_algorithm system\nvariable defines the default algorithm for ALTER TABLE\noperations.\n \nALGORITHM=COPY\n \nALGORITHM=COPY was introduced in MariaDB 10.0 as the name\nfor the original ALTER TABLE algorithm.\n \nWhen ALGORITHM=INPLACE is set, MariaDB essentially does the\nfollowing operations:\n \n-- Create a temporary table with the new definition\nCREATE TEMPORARY TABLE tmp_tab (\n...\n);\n \n-- Copy the data from the original table\nINSERT INTO tmp_tab\n SELECT * FROM original_tab;\n \n-- Drop the original table\nDROP TABLE original_tab;\n \n-- Rename the temporary table, so that it replaces the\noriginal one\nRENAME TABLE tmp_tab TO original_tab;\n \nThis algorithm is very inefficient, but it is generic, so it\nworks for all storage engines.\n \nIf ALGORITHM=COPY is specified, then the copy algorithm will\nbe used even if it is not necessary. This can result in a\nlengthy table copy. If multiple ALTER TABLE operations are\nrequired that each require the table to be rebuilt, then it\nis best to specify all operations in a single ALTER TABLE\nstatement, so that the table is only rebuilt once.\n \nALGORITHM=INPLACE\n \nALGORITHM=INPLACE was introduced in MariaDB 10.0.\n \nALGORITHM=COPY can be incredibly slow, because the whole\ntable has to be copied and rebuilt. ALGORITHM=INPLACE was\nintroduced as a way to avoid this by performing operations\nin-place and avoiding the table copy and rebuild, when\npossible.\n \nWhen ALGORITHM=INPLACE is set, the underlying storage engine\nuses optimizations to perform the operation while avoiding\nthe table copy and rebuild. However, INPLACE is a bit of a\nmisnomer, since some operations may still require the table\nto be rebuilt for some storage engines. Regardless, several\noperations can be performed without a full copy of the table\nfor some storage engines.\n \nA more accurate name would have been ALGORITHM=ENGINE, where\nENGINE refers to an \"engine-specific\" algorithm.\n \nIf an ALTER TABLE operation supports ALGORITHM=INPLACE, then\nit can be performed using optimizations by the underlying\nstorage engine, but it may rebuilt.\n \nSee InnoDB Online DDL Operations with ALGORITHM=INPLACE for\nmore.\n \nALGORITHM=NOCOPY\n \nALGORITHM=NOCOPY was introduced in MariaDB 10.3.7.\n \nALGORITHM=INPLACE can sometimes be surprisingly slow in\ninstances where it has to rebuild the clustered index,\nbecause when the clustered index has to be rebuilt, the\nwhole table has to be rebuilt. ALGORITHM=NOCOPY was\nintroduced as a way to avoid this. \n \nIf an ALTER TABLE operation supports ALGORITHM=NOCOPY, then\nit can be performed without rebuilding the clustered index.\n \nIf ALGORITHM=NOCOPY is specified for an ALTER TABLE\noperation that does not support ALGORITHM=NOCOPY, then an\nerror will be raised. In this case, raising an error is\npreferable, if the alternative is for the operation to\nrebuild the clustered index, and perform unexpectedly\nslowly.\n \nSee InnoDB Online DDL Operations with ALGORITHM=NOCOPY for\nmore.\n \nALGORITHM=INSTANT\n \nALGORITHM=INSTANT was introduced in MariaDB 10.3.7.\n \nALGORITHM=INPLACE can sometimes be surprisingly slow in\ninstances where it has to modify data files.\nALGORITHM=INSTANT was introduced as a way to avoid this.\n \nIf an ALTER TABLE operation supports ALGORITHM=INSTANT, then\nit can be performed without modifying any data files.\n \nIf ALGORITHM=INSTANT is specified for an ALTER TABLE\noperation that does not support ALGORITHM=INSTANT, then an\nerror will be raised. In this case, raising an error is\npreferable, if the alternative is for the operation to\nmodify data files, and perform unexpectedly slowly.\n \nSee InnoDB Online DDL Operations with ALGORITHM=INSTANT for\nmore.\n \nLOCK\n \nIn MariaDB 10.0 and later, the ALTER TABLE statement\nsupports the LOCK clause. This clause is one of the clauses\nthat is used to implement online DDL. ALTER TABLE supports\nseveral different locking strategies. A locking strategy can\nbe explicitly chosen for an ALTER TABLE operation by setting\nthe LOCK clause. The supported values are:\nDEFAULT: Acquire the least restrictive lock on the table\nthat is supported for the specific operation. Permit the\nmaximum amount of concurrency that is supported for the\nspecific operation.\nNONE: Acquire no lock on the table. Permit all concurrent\nDML. If this locking strategy is not permitted for an\noperation, then an error is raised.\nSHARED: Acquire a read lock on the table. Permit read-only\nconcurrent DML. If this locking strategy is not permitted\nfor an operation, then an error is raised.\nEXCLUSIVE: Acquire a write lock on the table. Do not permit\nconcurrent DML.\n \nDifferent storage engines support different locking\nstrategies for different operations. If a specific locking\nstrategy is chosen for an ALTER TABLE operation, and that\ntable\'s storage engine does not support that locking\nstrategy for that specific operation, then an error will be\nraised.\n \nIf the LOCK clause is not explicitly set, then the operation\nuses LOCK=DEFAULT.\n \nALTER ONLINE TABLE is equivalent to LOCK=NONE. Therefore,\nthe ALTER ONLINE TABLE statement can be used to ensure that\nyour ALTER TABLE operation allows all concurrent DML.\n \nSee InnoDB Online DDL Overview: LOCK for information on how\nthe LOCK clause affects InnoDB.\n \nProgress Reporting\n \nMariaDB provides progress reporting for ALTER TABLE\nstatement for clients\nthat support the new progress reporting protocol. For\nexample, if you were using the mysql client, then the\nprogress report might look like this::\n \nALTER TABLE test ENGINE=Aria;\nStage: 1 of 2 \'copy to tmp table\' 46% of stage\n \nThe progress report is also shown in the output of the SHOW\nPROCESSLIST statement and in the contents of the\ninformation_schema.PROCESSLIST table.\n \nSee Progress Reporting for more information.\n \nAborting ALTER TABLE Operations\n \nIf an ALTER TABLE operation is being performed and the\nconnection is killed, the changes will be rolled back in a\ncontrolled manner. The rollback can be a slow operation as\nthe time it takes is relative to how far the operation has\nprogressed.\n \nAborting ALTER TABLE ... ALGORITHM=COPY was made faster by\nremoving excessive undo logging (MDEV-11415). This\nsignificantly shortens the time it takes to abort a running\nALTER TABLE operation.\n \nExamples\n-------- \nAdding a new column:\n \nALTER TABLE t1 ADD x INT;\n \nDropping a column:\n \nALTER TABLE t1 DROP x;\n \nModifying the type of a column:\n \nALTER TABLE t1 MODIFY x bigint unsigned;\n \nChanging the name and type of a column:\n \nALTER TABLE t1 CHANGE a b bigint unsigned auto_increment;\n \nCombining multiple clauses in a single ALTER TABLE\nstatement, separated by commas:\n \nALTER TABLE t1 DROP x, ADD x2 INT, CHANGE y y2 INT;\n \nChanging the storage engine:\n \nALTER TABLE t1 ENGINE = InnoDB;\n \nRebuilding the table (the previous example will also rebuild\nthe table if it was already InnoDB):\n \nALTER TABLE t1 FORCE;\n \n\n\nURL: https://mariadb.com/kb/en/library/alter-table/') WHERE help_topic_id = 647;
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (648,39,'ALTER TABLESPACE','The ALTER TABLESPACE statement is not supported by MariaDB.\nIt was originally inherited from MySQL NDB Cluster. In MySQL\n5.7 and later, the statement is also supported for InnoDB.\nHowever, MariaDB has chosen not to include that specific\nfeature. See MDEV-19294 for more information.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/alter-tablespace/','','https://mariadb.com/kb/en/library/alter-tablespace/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (649,39,'ALTER VIEW','Syntax\n------ \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 \nDescription\n----------- \nThis statement changes the definition of a view, which must\nexist. The\nsyntax is similar to that for CREATE VIEW and the effect is\nthe same\nas for CREATE OR REPLACE VIEW if the view exists. This\nstatement\nrequires the CREATE VIEW and DROP privileges for the view,\nand some\nprivilege for each column referred to in the SELECT\nstatement. As of\nMariaDB 5.1.23, ALTER VIEW is allowed only to the definer or\nusers with\nthe SUPER privilege.\n \nExample\n \nALTER VIEW v AS SELECT a, a*3 AS a2 FROM t;\n \n\n\nURL: https://mariadb.com/kb/en/library/alter-view/','','https://mariadb.com/kb/en/library/alter-view/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (650,39,'CONSTRAINT','MariaDB supports the implementation of constraints at the\ntable-level using either CREATE TABLE or ALTER TABLE\nstatements. A table constraint restricts the data you can\nadd to the table. If you attempt to insert invalid data on a\ncolumn, MariaDB throws an error. \n \nSyntax\n------ \n[CONSTRAINT [symbol]] constraint_expression\n \nconstraint_expression:\n | PRIMARY KEY [index_type] (index_col_name, ...)\n[index_option] ...\n | FOREIGN KEY [index_name] (index_col_name, ...) \n REFERENCES tbl_name (index_col_name, ...)\n [ON DELETE reference_option]\n [ON UPDATE reference_option]\n | UNIQUE [INDEX|KEY] [index_name]\n [index_type] (index_col_name, ...) [index_option] ...\n | CHECK (check_constraints)\n \nindex_type:\n USING {BTREE | HASH | RTREE}\n \nindex_col_name:\n col_name [(length)] [ASC | DESC]\n \nindex_option:\n | KEY_BLOCK_SIZE [=] value\n | index_type\n | WITH PARSER parser_name\n | COMMENT \'string\'\n | CLUSTERING={YES|NO}\n \nreference_option:\n RESTRICT | CASCADE | SET NULL | NO ACTION | SET DEFAULT\n \nDescription\n----------- \nConstraints provide restrictions on the data you can add to\na table. This allows you to enforce data integrity from\nMariaDB, rather than through application logic. When a\nstatement violates a constraint, MariaDB throws an error.\n \nThere are four types of table constraints:\n \nConstraint | Description | \n \nPRIMARY KEY | Sets the column for referencing rows. Values\nmust be unique and not null. | \n \nFOREIGN KEY | Sets the column to reference the primary key\non another table. | \n \nUNIQUE | Requires values in column or columns only occur\nonce in the table. | \n \nCHECK | Checks whether the data meets the given condition. |\n\n \nFOREIGN KEY Constraints\n \nInnoDB supports foreign key constraints. The syntax for a\nforeign key\nconstraint definition in InnoDB looks like this:\n \n[CONSTRAINT [symbol]] FOREIGN KEY\n [index_name] (index_col_name, ...)\n REFERENCES tbl_name (index_col_name,...)\n [ON DELETE reference_option]\n [ON UPDATE reference_option]\n \nreference_option:\n RESTRICT | CASCADE | SET NULL | NO ACTION\n \nCHECK Constraints\n \nFrom MariaDB 10.2.1, constraints are enforced. Before\nMariaDB 10.2.1 constraint expressions were accepted in the\nsyntax but ignored.\n \nIn MariaDB 10.2.1 you can define constraints in 2 different\nways:\nCHECK(expression) given as part of a column definition.\nCONSTRAINT [constraint_name] CHECK (expression)\n \nBefore a row is inserted or updated, all constraints are\nevaluated in the order they are defined. If any constraint\nexpression returns false, then the row will not be inserted\nor updated.\nOne can use most deterministic functions in a constraint,\nincluding UDFs.\n \nCREATE TABLE t1 (a INT CHECK (a>2), b INT CHECK (b>2),\nCONSTRAINT a_greater CHECK (a>b));\n \nIf you use the second format and you don\'t give a name to\nthe constraint, then the constraint will get an\nautomatically generated name. This is done so that you can\nlater delete the constraint with ALTER TABLE DROP\nconstraint_name.\n \nOne can disable all constraint expression checks by setting\nthe check_constraint_checks variable to OFF. This is useful\nfor example when loading a table that violates some\nconstraints that you want to later find and fix in SQL.\n \nReplication\n \nIn row-based replication, only the master checks\nconstraints, and failed statements will not be replicated.\nIn statement-based replication, the slaves will also check\nconstraints. Constraints should therefore be identical, as\nwell as deterministic, in a replication environment.\n \nAuto_increment\n \nFrom MariaDB 10.2.6, auto_increment columns are no longer\npermitted in check constraints. Previously they were\npermitted, but would not work correctly. See MDEV-11117.\n \nExamples\n-------- \nCREATE TABLE product (category INT NOT NULL, id INT NOT\nNULL,\n price DECIMAL,\n PRIMARY KEY(category, id)) ENGINE=INNODB;\n \nCREATE TABLE customer (id INT NOT NULL,\n PRIMARY KEY (id)) ENGINE=INNODB;\n \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 \nThe following examples will work from MariaDB 10.2.1\nonwards.\n \nNumeric constraints and comparisons:\n \nCREATE TABLE t1 (a INT CHECK (a>2), b INT CHECK (b>2),\nCONSTRAINT a_greater CHECK (a>b));\n \nINSERT INTO t1(a) VALUES (1);\nERROR 4022 (23000): CONSTRAINT `a` failed for `test`.`t1`\n \nINSERT INTO t1(a,b) VALUES (3,4);\nERROR 4022 (23000): CONSTRAINT `a_greater` failed for\n`test`.`t1`\n \nINSERT INTO t1(a,b) VALUES (4,3);\nQuery OK, 1 row affected (0.04 sec)\n \nDropping a constraint:\n \nALTER TABLE t1 DROP CONSTRAINT a_greater;\n \nAdding a constraint:\n \nALTER TABLE t1 ADD CONSTRAINT a_greater CHECK (a>b);\n \nDate comparisons and character length:\n \nCREATE TABLE t2 (name VARCHAR(30) CHECK\n(CHAR_LENGTH(name)>2), start_date DATE, \n end_date DATE CHECK (start_date IS NULL OR end_date IS NULL\nOR start_date2)), start_date DATE, \n end_date DATE CHECK (start_date IS NULL OR end_date IS NULL\nOR start_date2 is very different to CHAR_LENGTH(name>2) as\nthe latter mistakenly performs a numeric comparison on the\nname field, leading to unexpected results.\n \n\n\nURL: https://mariadb.com/kb/en/library/constraint/','','https://mariadb.com/kb/en/library/constraint/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (651,39,'CREATE DATABASE','Syntax\n------ \nCREATE [OR REPLACE] {DATABASE | SCHEMA} [IF NOT EXISTS]\ndb_name\n [create_specification] ...\n \ncreate_specification:\n [DEFAULT] CHARACTER SET [=] charset_name\n | [DEFAULT] COLLATE [=] collation_name\n \nDescription\n----------- \nCREATE DATABASE creates a database with the given name. To\nuse this statement, you need the CREATE privilege for the\ndatabase. CREATE SCHEMA is a synonym for CREATE DATABASE.\n \nFor valid identifiers to use as database names, see\nIdentifier Names.\n \nOR REPLACE\n \nThe OR REPLACE clause was added in MariaDB 10.1.3\n \nIf the optional OR REPLACE clause is used, it acts as a\nshortcut for:\n \nDROP DATABASE IF EXISTS db_name;\n \nCREATE DATABASE db_name ...;\n \nIF NOT EXISTS\n \nWhen the IF NOT EXISTS clause is used, MariaDB will return a\nwarning instead of an error if the specified database\nalready exists.\n \nExamples\n-------- \nCREATE DATABASE db1;\n \nQuery OK, 1 row affected (0.18 sec)\n \nCREATE DATABASE db1;\n \nERROR 1007 (HY000): Can\'t create database \'db1\'; database\nexists\n \nCREATE OR REPLACE DATABASE db1;\nQuery OK, 2 rows affected (0.00 sec)\n \nCREATE DATABASE IF NOT EXISTS db1;\nQuery OK, 1 row affected, 1 warning (0.01 sec)\n \nSHOW WARNINGS;\n+-------+------+----------------------------------------------+\n| Level | Code | Message |\n+-------+------+----------------------------------------------+\n| Note | 1007 | Can\'t create database \'db1\';\n database exists |\n+-------+------+----------------------------------------------+\n \nSetting the character sets and collation. See Setting\nCharacter Sets and Collations for more details.\n \nCREATE DATABASE czech_slovak_names \n CHARACTER SET = \'keybcs2\'\n COLLATE = \'keybcs2_bin\';\n \n\n\nURL: https://mariadb.com/kb/en/library/create-database/','','https://mariadb.com/kb/en/library/create-database/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (652,39,'CREATE EVENT','Syntax\n------ \nCREATE [OR REPLACE]\n [DEFINER = { user | CURRENT_USER | role | CURRENT_ROLE }]\n EVENT \n [IF NOT EXISTS]\n event_name \n ON SCHEDULE schedule\n [ON COMPLETION [NOT] PRESERVE]\n [ENABLE | DISABLE | DISABLE ON SLAVE]\n [COMMENT \'comment\']\n DO sql_statement;\n \nschedule:\n AT timestamp [+ INTERVAL interval] ...\n | EVERY interval \n [STARTS timestamp [+ INTERVAL interval] ...] \n [ENDS timestamp [+ INTERVAL interval] ...]\n \ninterval:\n quantity {YEAR | QUARTER | MONTH | DAY | HOUR | MINUTE |\n WEEK | SECOND | YEAR_MONTH | DAY_HOUR | DAY_MINUTE |\n DAY_SECOND | HOUR_MINUTE | HOUR_SECOND | MINUTE_SECOND}\n \nDescription\n----------- \nThis statement creates and schedules a new event. It\nrequires the\nEVENT privilege for the schema in which the event is to be\ncreated.\n \nThe minimum requirements for a valid CREATE EVENT statement\nare as\nfollows:\nThe keywords CREATE EVENT plus an event name, which uniquely\nidentifies\n the event in the current schema. (Prior to MySQL 5.1.12,\nthe event name\n needed to be unique only among events created by the same\nuser on a given\n database.)\nAn ON SCHEDULE clause, which determines when and how often\nthe event\n executes.\nA DO clause, which contains the SQL statement to be executed\nby an\n event.\n \nHere 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\nevent executes once\n— one hour following its creation\n— by running an SQL statement that increments the\nvalue of the myschema.mytable table\'s mycol column by 1.\n \nThe event_name must be a valid MariaDB identifier with a\nmaximum length\nof 64 characters. It may be delimited using back ticks, and\nmay be\nqualified with the name of a database schema. An event is\nassociated\nwith both a MariaDB user (the definer) and a schema, and its\nname must\nbe unique among names of events within that schema. In\ngeneral, the\nrules governing event names are the same as those for names\nof stored\nroutines. See Identifier Names.\n \nIf no schema is indicated as part of event_name, the default\n(current)\nschema is assumed.\n \nFor valid identifiers to use as event names, see Identifier\nNames.\n \nOR REPLACE\n \nThe OR REPLACE clause was included in MariaDB 10.1.4. If\nused and the event already exists, instead of an error being\nreturned, the existing event will be dropped and replaced by\nthe newly defined event.\n \nIF NOT EXISTS\n \nIf the IF NOT EXISTS clause is used, MariaDB will return a\nwarning instead of an error if the event already exists.\nCannot be used together with OR REPLACE.\n \nON SCHEDULE\n \nThe ON SCHEDULE clause can be used to specify when the event\nmust be triggered.\n \nAT\n \nIf you want to execute the event only once (one time event),\nyou can use the AT keyword, followed by a timestamp. If you\nuse CURRENT_TIMESTAMP, the event acts as soon as it is\ncreated. As a convenience, you can add one or more intervals\nto that timestamp. You can also specify a timestamp in the\npast, so that the event is stored but not triggered, until\nyou modify it via ALTER EVENT.\n \nThe following example shows how to create an event that will\nbe triggered tomorrow at a certain time:\n \nCREATE EVENT example\nON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 DAY + INTERVAL\n3 HOUR\nDO something;\n \nYou can also specify that an event must be triggered at a\nregular interval (recurring event). In such cases, use the\nEVERY clause followed by the interval.\n \nIf an event is recurring, you can specify when the first\nexecution must happen via the STARTS clause and a maximum\ntime for the last execution via the ENDS clause. STARTS and\nENDS clauses are followed by a timestamp and, optionally,\none or more intervals. The ENDS clause can specify a\ntimestamp in the past, so that the event is stored but not\nexecuted until you modify it via ALTER EVENT.\n \nIn the following example, next month a recurring event will\nbe triggered hourly for a week:\n \nCREATE EVENT example\nON SCHEDULE EVERY 1 HOUR\nSTARTS CURRENT_TIMESTAMP + INTERVAL 1 MONTH\nENDS CURRENT_TIMESTAMP + INTERVAL 1 MONTH + INTERVAL 1 WEEK\nDO some_task;\n \nIntervals consist of a quantity and a time unit. The time\nunits are the same used for other staments and time\nfunctions, except that you can\'t use microseconds for\nevents. For simple time units, like HOUR or MINUTE, the\nquantity is an integer number, for example \'10 MINUTE\'.\nFor composite time units, like HOUR_MINUTE or HOUR_SECOND,\nthe quantity must be a string with all involved simple\nvalues and their separators, for example \'2:30\' or\n\'2:30:30\'.\n \nON COMPLETION [NOT] PRESERVE\n \nThe ON COMPLETION clause can be used to specify if the event\nmust be deleted after its last execution (that is, after its\nAT or ENDS timestamp is past). By default, events are\ndropped when they are expired. To explicitly state that this\nis the desired behaviour, you can use ON COMPLETION NOT\nPRESERVE. Instead, if you want the event to be preserved,\nyou can use ON COMPLETION PRESERVE.\n \nIn you specify ON COMPLETION NOT PRESERVE, and you specify a\ntimestamp in the past for AT or ENDS clause, the event will\nbe immediatly dropped. In such cases, you will get a Note\n1558: \"Event execution time is in the past and ON\nCOMPLETION NOT PRESERVE is set. The event was dropped\nimmediately after creation\".\n \nENABLE/DISABLE/DISABLE ON SLAVE\n \nEvents are ENABLEd by default. If you want to stop MariaDB\nfrom executing\nan event, you may specify DISABLE. When it is ready to be\nactivated, you\nmay enable it using ALTER EVENT. Another option is\nDISABLE ON SLAVE, which indicates that an event was created\non a master and has been replicated to the slave, which is\nprevented from executing the event. If DISABLE ON SLAVE is\nspecifically set, the event will not be executed.\n \nCOMMENT\n \nThe COMMENT clause may be used to set a comment for the\nevent. Maximum\nlength for comments is 64 characters. The comment is a\nstring, so it must be\nquoted. To see events comments, you can query the\nINFORMATION_SCHEMA.EVENTS table (the column is named\nEVENT_COMMENT).\n \nExamples\n-------- \nMinimal 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 \nAn event that will be triggered tomorrow at a certain time:\n \nCREATE EVENT example\nON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 DAY + INTERVAL\n3 HOUR\nDO something;\n \nNext month a recurring event will be triggered hourly for a\nweek:\n \nCREATE EVENT example\nON SCHEDULE EVERY 1 HOUR\nSTARTS CURRENT_TIMESTAMP + INTERVAL 1 MONTH\nENDS CURRENT_TIMESTAMP + INTERVAL 1 MONTH + INTERVAL 1 WEEK\nDO some_task;\n \nOR REPLACE and IF NOT EXISTS:\n \nCREATE EVENT myevent\n ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR\n DO\n UPDATE myschema.mytable SET mycol = mycol + 1;\n \nERROR 1537 (HY000): Event \'myevent\' already exists\n \nCREATE OR REPLACE EVENT myevent\n ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR\n DO\n UPDATE myschema.mytable SET mycol = mycol + 1;;\nQuery OK, 0 rows affected (0.00 sec)\n \nCREATE EVENT IF NOT EXISTS myevent\n ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR\n DO\n UPDATE myschema.mytable SET mycol = mycol + 1;\n \nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n \n SHOW WARNINGS;\n \n+-------+------+--------------------------------+\n| Level | Code | Message |\n+-------+------+--------------------------------+\n| Note | 1537 | Event \'myevent\' already exists |\n+-------+------+--------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/create-event/','','https://mariadb.com/kb/en/library/create-event/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (653,39,'CREATE FUNCTION','Syntax\n------ \nCREATE [OR REPLACE]\n [DEFINER = {user | CURRENT_USER | role | CURRENT_ROLE }]\n [AGGREGATE] FUNCTION [IF NOT EXISTS] func_name\n([func_parameter[,...]])\n RETURNS type\n [characteristic ...]\n RETURN func_body\n \nfunc_parameter:\n param_name type\n \ntype:\n Any valid MariaDB data type\n \ncharacteristic:\n LANGUAGE SQL\n | [NOT] DETERMINISTIC\n | { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL\nDATA }\n | SQL SECURITY { DEFINER | INVOKER }\n | COMMENT \'string\'\n \nfunc_body:\n Valid SQL procedure statement\n \nDescription\n----------- \nUse the CREATE FUNCTION statement to create a new stored\nfunction. You must have\nthe CREATE ROUTINE database privilege to use CREATE\nFUNCTION.\nA function takes any number of arguments and returns a value\nfrom the function body. The\nfunction body can be any valid SQL expression as you would\nuse, for example, in any select\nexpression. If you have the appropriate privileges, you can\ncall the function exactly as you\nwould any built-in function. See Security below for details\non privileges.\n \nYou can also use a variant of the CREATE FUNCTION statement\nto install a user-defined\nfunction (UDF) defined by a plugin. See CREATE FUNCTION\n(UDF)\nfor details.\n \nYou can use a SELECT statement for the function body by\nenclosing it in\nparentheses, exactly as you would to use a subselect for any\nother expression. The SELECT\nstatement must return a single value. If more than one\ncolumn is returned when the function is called,\nerror 1241 results. If more than one row is returned when\nthe function is called, error 1242\nresults. Use a LIMIT clause to ensure only one row is\nreturned.\n \nYou can also replace the RETURN clause with a BEGIN...END\ncompound\nstatement. The compound statement must contain a RETURN\nstatement. When the function is\ncalled, the RETURN statement immediately returns its result,\nand any statements after RETURN\nare effectively ignored.\n \nBy default, a function is associated with the default\ndatabase. To associate the function explicitly\nwith a given database, specify the fully-qualified name as\ndb_name.func_name\nwhen you create it. If the function name is the same as the\nname of a built-in function, you must\nuse the fully qualified name when you call it.\n \nThe parameter list enclosed within parentheses must always\nbe present.\nIf there are no parameters, an empty parameter list of ()\nshould be\nused. Parameter names are not case sensitive.\n \nEach parameter can be declared to use any valid data type,\nexcept that\nthe COLLATE attribute cannot be used.\n \nFor valid identifiers to use as function names, see\nIdentifier Names.\n \nAGGREGATE\n \nFrom MariaDB 10.3.3, it is possible to create stored\naggregate functions as well. See Stored Aggregate Functions\nfor details.\n \nRETURNS\n \nThe RETURNS clause specifies the return type of the\nfunction. NULL values are permitted with all return types.\n \nWhat happens if the RETURN clause returns a value of a\ndifferent type? It depends on the SQL_MODE in effect at the\nmoment of the function creation.\n \nIf the SQL_MODE is strict (STRICT_ALL_TABLES or\nSTRICT_TRANS_TABLES flags are specified), a 1366 error will\nbe produced.\n \nOtherwise, the value is coerced to the proper type. For\nexample, if a function\nspecifies an ENUM or SET value in the RETURNS clause, but\nthe RETURN\nclause returns an integer, the value returned from the\nfunction is the string for the corresponding ENUM\nmember of set of SET members.\n \nMariaDB stores the SQL_MODE system variable setting that is\nin effect at the\ntime a routine is created, and always executes the routine\nwith this setting in\nforce, regardless of the server SQL mode in effect when the\nroutine is invoked.\n \nLANGUAGE SQL\n \nLANGUAGE SQL is a standard SQL clause, and it can be used in\nMariaDB for portability. However that clause has no meaning,\nbecause SQL is the only supported language for stored\nfunctions.\n \nA function is deterministic if it can produce only one\nresult for a given list of parameters. If the result may be\naffected by stored data, server variables, random numbers or\nany value that is not explicitly passed, then the function\nis not deterministic. Also, a function is non-deterministic\nif it uses non-deterministic functions like NOW() or\nCURRENT_TIMESTAMP(). The optimizer may choose a faster\nexecution plan if it known that the function is\ndeterministic. In such cases, you should declare the routine\nusing the DETERMINISTIC keyword. If you want to explicitly\nstate that the function is not deterministic (which is the\ndefault) you can use the NOT DETERMINISTIC keywords.\n \nIf you declare a non-deterministic function as\nDETERMINISTIC, you may get incorrect results. If you declare\na deterministic function as NOT DETERMINISTIC, in some cases\nthe queries will be slower.\n \nOR REPLACE\n \nIf the optional OR REPLACE clause is used, it acts as a\nshortcut for:\n \nDROP FUNCTION IF EXISTS function_name;\n \nCREATE FUNCTION function_name ...;\n \nwith the exception that any existing privileges for the\nfunction are not dropped.\n \nIF NOT EXISTS\n \nIf the IF NOT EXISTS clause is used, MariaDB will return a\nwarning instead of an error if the function already exists.\nCannot be used together with OR REPLACE.\n \n[NOT] DETERMINISTIC\n \nThe [NOT] DETERMINISTIC clause also affects binary logging,\nbecause the STATEMENT format can not be used to store or\nreplicate non-deterministic statements.\n \nCONTAINS SQL, NO SQL, READS SQL DATA, and MODIFIES SQL DATA\nare informative clauses that tell the server what the\nfunction does. MariaDB does not check in any way whether the\nspecified clause is correct. If none of these clauses are\nspecified, CONTAINS SQL is used by default.\n \nMODIFIES SQL DATA\n \nMODIFIES SQL DATA means that the function contains\nstatements that may modify data stored in databases. This\nhappens if the function contains statements like DELETE,\nUPDATE, INSERT, REPLACE or DDL.\n \nREADS SQL DATA\n \nREADS SQL DATA means that the function reads data stored in\ndatabases, but does not modify any data. This happens if\nSELECT statements are used, but there no write operations\nare executed.\n \nCONTAINS SQL\n \nCONTAINS SQL means that the function contains at least one\nSQL statement, but it does not read or write any data stored\nin a database. Examples include SET or DO.\n \nNO SQL\n \nNO SQL means nothing, because MariaDB does not currently\nsupport any language other than SQL.\n \nOracle Mode\n \nFrom MariaDB 10.3, a subset of Oracle\'s PL/SQL language has\nbeen supported in addition to the traditional SQL/PSM-based\nMariaDB syntax. See Oracle mode from MariaDB 10.3 for\ndetails on changes when running Oracle mode.\n \nSecurity\n \nYou must have the EXECUTE privilege on a function to call\nit.\nMariaDB automatically grants the EXECUTE and ALTER ROUTINE\nprivileges to the\naccount that called CREATE FUNCTION, even if the DEFINER\nclause was used.\n \nEach function has an account associated as the definer. By\ndefault, the definer is the account\nthat created the function. Use the DEFINER clause to specify\na different account as the\ndefiner. You must have the SUPER privilege to use the\nDEFINER\nclause. See Account Names for details on specifying\naccounts.\n \nThe SQL SECURITY clause specifies what privileges are used\nwhen a function is called.\nIf SQL SECURITY is INVOKER, the function body will be\nevaluated using the privileges\nof the user calling the function. If SQL SECURITY is\nDEFINER, the function body is\nalways evaluated using the privileges of the definer\naccount. DEFINER is the default.\n \nThis allows you to create functions that grant limited\naccess to certain data. For example, say\nyou have a table that stores some employee information, and\nthat you\'ve granted SELECT\nprivileges only on certain columns to the user account\nroger.\n \nCREATE TABLE employees (name TINYTEXT, dept TINYTEXT, salary\nINT);\nGRANT SELECT (name, dept) ON employees TO roger;\n \nTo allow the user the get the maximum salary for a\ndepartment, define a function and grant\nthe EXECUTE privilege:\n \nCREATE FUNCTION max_salary (dept TINYTEXT) RETURNS INT\nRETURN\n (SELECT MAX(salary) FROM employees WHERE employees.dept =\ndept);\nGRANT EXECUTE ON FUNCTION max_salary TO roger;\n \nSince SQL SECURITY defaults to DEFINER, whenever the user\nroger calls\nthis function, the subselect will execute with your\nprivileges. As long as you have privileges to\nselect the salary of each employee, the caller of the\nfunction will be able to get the maximum\nsalary for each department without being able to see\nindividual salaries.\n \nCharacter sets and collations\n \nFunction return types can be declared to use any valid\ncharacter set and collation. If used, the COLLATE attribute\nneeds to be preceded by a CHARACTER SET attribute.\n \nIf the character set and collation are not specifically set\nin the statement, the database defaults at the time of\ncreation will be used. If the database defaults change at a\nlater stage, the stored function character set/collation\nwill not be changed at the same time; the stored function\nneeds to be dropped and recreated to ensure the same\ncharacter set/collation as the database is used.\n \nExamples\n-------- \nThe following example function takes a parameter, performs\nan operation using\nan SQL function, and returns the result.\n \nCREATE FUNCTION hello (s CHAR(20))\n RETURNS CHAR(50) DETERMINISTIC\n RETURN CONCAT(\'Hello, \',s,\'!\');\n \nSELECT hello(\'world\');\n+----------------+\n| hello(\'world\') |\n+----------------+\n| Hello, world! |\n+----------------+\n \nYou can use a compound statement in a function to manipulate\ndata with statements\nlike INSERT and UPDATE. The following example creates a\ncounter function\nthat uses a temporary table to store the current value.\nBecause the compound statement\ncontains statements terminated with semicolons, you have to\nfirst change the statement\ndelimiter with the DELIMITER statement to allow the\nsemicolon to be used in the\nfunction body. See Delimiters in the mysql client for more.\n \nCREATE TEMPORARY TABLE counter (c INT);\nINSERT INTO counter VALUES (0);\nDELIMITER //\nCREATE FUNCTION counter () RETURNS INT\n BEGIN\n UPDATE counter SET c = c + 1;\n \n RETURN (SELECT c FROM counter LIMIT 1);\n END //\nDELIMITER ;\n \nCharacter set and collation:\n \nCREATE FUNCTION hello2 (s CHAR(20))\n RETURNS CHAR(50) CHARACTER SET \'utf8\' COLLATE\n\'utf8_bin\' DETERMINISTIC\n RETURN CONCAT(\'Hello, \',s,\'!\');\n \n\n\nURL: https://mariadb.com/kb/en/library/create-function/','','https://mariadb.com/kb/en/library/create-function/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (654,39,'CREATE INDEX','Syntax\n------ \nCREATE [OR REPLACE] [UNIQUE|FULLTEXT|SPATIAL] INDEX \n [IF NOT EXISTS] index_name\n [index_type]\n ON tbl_name (index_col_name,...)\n [WAIT n | NOWAIT]\n [index_option]\n [algorithm_option | lock_option] ...\n \nindex_col_name:\n col_name [(length)] [ASC | DESC]\n \nindex_type:\n USING {BTREE | HASH | RTREE}\n \nindex_option:\n KEY_BLOCK_SIZE [=] value\n | index_type\n | WITH PARSER parser_name\n | COMMENT \'string\'\n \nalgorithm_option:\n ALGORITHM [=] {DEFAULT|INPLACE|COPY|NOCOPY|INSTANT}\n \nlock_option:\n LOCK [=] {DEFAULT|NONE|SHARED|EXCLUSIVE}\n \nDescription\n----------- \nCREATE INDEX is mapped to an ALTER TABLE statement to create\nindexes.\nSee ALTER TABLE. CREATE INDEX cannot be used to create a\nPRIMARY KEY; use ALTER TABLE instead.\n \nIf another connection is using the table, a metadata lock is\nactive, and this statement will wait until the lock is\nreleased. This is also true for non-transactional tables.\n \nAnother shortcut, DROP INDEX, allows the removal of an\nindex.\n \nFor valid identifiers to use as index names, see Identifier\nNames.\n \nNote that KEY_BLOCK_SIZE is currently ignored in CREATE\nINDEX, although it is included in the output of SHOW CREATE\nTABLE.\n \nPrivileges\n \nExecuting the CREATE INDEX statement requires the INDEX\nprivilege for the table or the database.\n \nOnline DDL\n \nIn MariaDB 10.0 and later, online DDL is supported with the\nALGORITHM and LOCK clauses.\n \nSee InnoDB Online DDL Overview for more information on\nonline DDL with InnoDB.\n \nCREATE OR REPLACE INDEX ...\n \nThe OR REPLACE clause was added in MariaDB 10.1.4.\n \nIf the OR REPLACE clause is used and if the index already\nexists, then instead of returning an error, the server will\ndrop the existing index and replace it with the newly\ndefined index.\n \nCREATE INDEX IF NOT EXISTS ...\n \nIf the IF NOT EXISTS clause is used, then the index will\nonly be created if an index with the same name does not\nalready exist. If the index already exists, then a warning\nwill be triggered by default.\n \nIndex Definitions\n \nSee CREATE TABLE: Index Definitions for information about\nindex definitions.\n \nWAIT/NOWAIT\n \nSet the lock wait timeout. See WAIT and NOWAIT.\n \nALGORITHM\n \nSee ALTER TABLE: ALGORITHM for more information.\n \nLOCK\n \nSee ALTER TABLE: LOCK for more information.\n \nProgress Reporting\n \nMariaDB provides progress reporting for CREATE INDEX\nstatement for clients\nthat support the new progress reporting protocol. For\nexample, if you were using the mysql client, then the\nprogress report might look like this::\n \nCREATE INDEX ON tab (num);;\nStage: 1 of 2 \'copy to tmp table\' 46% of stage\n \nThe progress report is also shown in the output of the SHOW\nPROCESSLIST statement and in the contents of the\ninformation_schema.PROCESSLIST table.\n \nSee Progress Reporting for more information.\n \nExamples\n-------- \nCreating a unique index:\n \nCREATE UNIQUE INDEX HomePhone ON Employees(Home_Phone);\n \nOR REPLACE and IF NOT EXISTS:\n \nCREATE INDEX xi ON xx5 (x);\nQuery OK, 0 rows affected (0.03 sec)\n \nCREATE INDEX xi ON xx5 (x);\nERROR 1061 (42000): Duplicate key name \'xi\'\n \nCREATE OR REPLACE INDEX xi ON xx5 (x);\nQuery OK, 0 rows affected (0.03 sec)\n \nCREATE INDEX IF NOT EXISTS xi ON xx5 (x);\nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+-------+------+-------------------------+\n| Level | Code | Message |\n+-------+------+-------------------------+\n| Note | 1061 | Duplicate key name \'xi\' |\n+-------+------+-------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/create-index/','','https://mariadb.com/kb/en/library/create-index/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (655,39,'CREATE PACKAGE','Oracle-style packages were introduced in MariaDB 10.3.5.\n \nSyntax\n------ \nCREATE\n [ OR REPLACE]\n [DEFINER = { user | CURRENT_USER | role | CURRENT_ROLE }]\n PACKAGE [ IF NOT EXISTS ]\n [ db_name . ] package_name\n [ package_characteristic ... ]\n{ AS | IS }\n [ package_specification_element ... ]\nEND [ package_name ]\n \npackage_characteristic:\n COMMENT \'string\'\n | SQL SECURITY { DEFINER | INVOKER }\n \npackage_specification_element:\n FUNCTION_SYM package_specification_function ;\n | PROCEDURE_SYM package_specification_procedure ;\n \npackage_specification_function:\n func_name [ ( func_param [, func_param]... ) ]\n RETURNS func_return_type\n [ package_routine_characteristic... ]\n \npackage_specification_procedure:\n proc_name [ ( proc_param [, proc_param]... ) ]\n [ package_routine_characteristic... ]\n \nfunc_return_type:\n type\n \nfunc_param:\n param_name type\n \nproc_param:\n param_name { IN | OUT | INOUT | IN OUT } type\n \ntype:\n Any valid MariaDB explicit or anchored data type\n \npackage_routine_characteristic:\n COMMENT \'string\'\n | LANGUAGE SQL\n | { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL\nDATA }\n | SQL SECURITY { DEFINER | INVOKER }\n \nDescription\n----------- \nThe CREATE PACKAGE statement can be used when Oracle\nSQL_MODE is set.\n \nThe CREATE PACKAGE creates the specification for a stored\npackage (a collection of logically related stored objects).\nA stored package specification declares public routines\n(procedures and functions) of the package, but does not\nimplement these routines.\n \nA package whose specification was created by the CREATE\nPACKAGE statement, should later be implemented using the\nCREATE PACKAGE BODY statement.\n \nExamples\n-------- \nSET sql_mode=ORACLE;\nDELIMITER $$\nCREATE OR REPLACE PACKAGE employee_tools AS\n FUNCTION getSalary(eid INT) RETURN DECIMAL(10,2);\n PROCEDURE raiseSalary(eid INT, amount DECIMAL(10,2));\n PROCEDURE raiseSalaryStd(eid INT);\n PROCEDURE hire(ename TEXT, esalary DECIMAL(10,2));\nEND;\n$$\nDELIMITER ;\n \n\n\nURL: https://mariadb.com/kb/en/library/create-package/','','https://mariadb.com/kb/en/library/create-package/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (656,39,'CREATE PACKAGE BODY','Oracle-style packages were introduced in MariaDB 10.3.5.\n \nSyntax\n------ \nCREATE [ OR REPLACE ]\n [DEFINER = { user | CURRENT_USER | role | CURRENT_ROLE }]\n PACKAGE BODY\n [ IF NOT EXISTS ]\n [ db_name . ] package_name\n [ package_characteristic... ]\n{ AS | IS }\n package_implementation_declare_section\n package_implementation_executable_section\nEND [ package_name]\n \npackage_implementation_declare_section:\n package_implementation_item_declaration\n [ package_implementation_item_declaration... ]\n [ package_implementation_routine_definition... ]\n | package_implementation_routine_definition\n [ package_implementation_routine_definition...]\n \npackage_implementation_item_declaration:\n variable_declaration ;\n \nvariable_declaration:\n variable_name[,...] type [:= expr ]\n \npackage_implementation_routine_definition:\n FUNCTION package_specification_function\n [ package_implementation_function_body ] ;\n | PROCEDURE package_specification_procedure\n [ package_implementation_procedure_body ] ;\n \npackage_implementation_function_body:\n { AS | IS } package_routine_body [func_name]\n \npackage_implementation_procedure_body:\n { AS | IS } package_routine_body [proc_name]\n \npackage_routine_body:\n [ package_routine_declarations ]\n BEGIN\n statements [ EXCEPTION exception_handlers ]\n END\n \npackage_routine_declarations:\n package_routine_declaration \';\'\n[package_routine_declaration \';\']...\n \npackage_routine_declaration:\n variable_declaration\n | condition_name CONDITION FOR condition_value\n | user_exception_name EXCEPTION\n | CURSOR_SYM cursor_name\n [ ( cursor_formal_parameters ) ]\n IS select_statement\n ;\n \npackage_implementation_executable_section:\n END\n | BEGIN\n statement ; [statement ; ]...\n [EXCEPTION exception_handlers]\n END\n \nexception_handlers:\n exception_handler [exception_handler...]\n \nexception_handler:\n WHEN_SYM condition_value [, condition_value]...\n THEN_SYM statement ; [statement ;]...\n \ncondition_value:\n condition_name\n | user_exception_name\n | SQLWARNING\n | SQLEXCEPTION\n | NOT FOUND\n | OTHERS_SYM\n | SQLSTATE [VALUE] sqlstate_value\n | mariadb_error_code\n \n\nDescription\n----------- \nThe CREATE PACKAGE BODY statement can be used when Oracle\nSQL_MODE is set.\n \nThe CREATE PACKAGE BODY statement creates the package body\nfor a stored package. The package specification must be\npreviously created using the CREATE PACKAGE statement.\n \nA package body provides implementations of the package\npublic routines and can optionally have:\npackage-wide private variables\npackage private routines\nforward declarations for private routines\nan executable initialization section\n \nExamples\n-------- \nSET sql_mode=ORACLE;\nDELIMITER $$\nCREATE OR REPLACE PACKAGE employee_tools AS\n FUNCTION getSalary(eid INT) RETURN DECIMAL(10,2);\n PROCEDURE raiseSalary(eid INT, amount DECIMAL(10,2));\n PROCEDURE raiseSalaryStd(eid INT);\n PROCEDURE hire(ename TEXT, esalary DECIMAL(10,2));\nEND;\n$$\nCREATE PACKAGE BODY employee_tools AS\n -- package body variables\n stdRaiseAmount DECIMAL(10,2):=500;\n \n -- private routines\n PROCEDURE log (eid INT, ecmnt TEXT) AS\n BEGIN\n INSERT INTO employee_log (id, cmnt) VALUES (eid, ecmnt);\n END;\n \n -- public routines\n PROCEDURE hire(ename TEXT, esalary DECIMAL(10,2)) AS\n eid INT;\n BEGIN\n INSERT INTO employee (name, salary) VALUES (ename,\nesalary);\n eid:= last_insert_id();\n log(eid, \'hire \' || ename);\n END;\n \n FUNCTION getSalary(eid INT) RETURN DECIMAL(10,2) AS\n nSalary DECIMAL(10,2);\n BEGIN\n SELECT salary INTO nSalary FROM employee WHERE id=eid;\n log(eid, \'getSalary id=\' || eid || \' salary=\' ||\nnSalary);\n RETURN nSalary;\n END;\n \n PROCEDURE raiseSalary(eid INT, amount DECIMAL(10,2)) AS\n BEGIN\n UPDATE employee SET salary=salary+amount WHERE id=eid;\n log(eid, \'raiseSalary id=\' || eid || \' amount=\' ||\namount);\n END;\n \n PROCEDURE raiseSalaryStd(eid INT) AS\n BEGIN\n raiseSalary(eid, stdRaiseAmount);\n log(eid, \'raiseSalaryStd id=\' || eid);\n END;\n \nBEGIN\n -- This code is executed when the current session\n -- accesses any of the package routines for the first time\n log(0, \'Session \' || connection_id() || \' \' ||\ncurrent_user || \' started\');\nEND;\n$$\n \nDELIMITER ;\n \n\n\nURL: https://mariadb.com/kb/en/library/create-package-body/','','https://mariadb.com/kb/en/library/create-package-body/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (657,39,'CREATE PROCEDURE','Syntax\n------ \nCREATE\n [OR REPLACE]\n [DEFINER = { user | CURRENT_USER | role | CURRENT_ROLE }]\n PROCEDURE sp_name ([proc_parameter[,...]])\n [characteristic ...] routine_body\n \nproc_parameter:\n [ IN | OUT | INOUT ] param_name type\n \ntype:\n Any valid MariaDB data type\n \ncharacteristic:\n LANGUAGE SQL\n | [NOT] DETERMINISTIC\n | { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL\nDATA }\n | SQL SECURITY { DEFINER | INVOKER }\n | COMMENT \'string\'\n \nroutine_body:\n Valid SQL procedure statement\n \nDescription\n----------- \nCreates a stored procedure. By default, a routine is\nassociated with the default database. To associate the\nroutine\nexplicitly with a given database, specify the name as\ndb_name.sp_name\nwhen you create it.\n \nWhen the routine is invoked, an implicit USE db_name is\nperformed (and\nundone when the routine terminates). The causes the routine\nto have\nthe given default database while it executes. USE statements\nwithin\nstored routines are disallowed.\n \nWhen a stored procedure has been created, you invoke it by\nusing the CALL statement (see CALL).\n \nTo execute the CREATE PROCEDURE statement, it is\nnecessary to have the CREATE ROUTINE privilege. By default,\nMariaDB\nautomatically grants the ALTER ROUTINE and EXECUTE\nprivileges to the\nroutine creator. See also Stored Routine Privileges.\n \nThe DEFINER and SQL SECURITY clauses specify the security\ncontext to\nbe used when checking access privileges at routine execution\ntime, as\ndescribed later.\n \nIf the routine name is the same as the name of a built-in\nSQL\nfunction, you must use a space between the name and the\nfollowing\nparenthesis when defining the routine, or a syntax error\noccurs. This\nis also true when you invoke the routine later. For this\nreason, we\nsuggest that it is better to avoid re-using the names of\nexisting SQL\nfunctions for your own stored routines.\n \nThe IGNORE_SPACE SQL mode applies to built-in functions, not\nto stored\nroutines. It is always allowable to have spaces after a\nroutine name,\nregardless of whether IGNORE_SPACE is enabled.\n \nThe parameter list enclosed within parentheses must always\nbe present.\nIf there are no parameters, an empty parameter list of ()\nshould be\nused. Parameter names are not case sensitive.\n \nEach parameter can be declared to use any valid data type,\nexcept that\nthe COLLATE attribute cannot be used.\n \nFor valid identifiers to use as procedure names, see\nIdentifier Names.\n \nIN/OUT/INOUT\n \nEach parameter is an IN parameter by default. To specify\notherwise for\na parameter, use the keyword OUT or INOUT before the\nparameter name.\n \nAn IN parameter passes a value into a procedure. The\nprocedure might\nmodify the value, but the modification is not visible to the\ncaller\nwhen the procedure returns. An OUT parameter passes a value\nfrom the\nprocedure back to the caller. Its initial value is NULL\nwithin the\nprocedure, and its value is visible to the caller when the\nprocedure\nreturns. An INOUT parameter is initialized by the caller,\ncan be\nmodified by the procedure, and any change made by the\nprocedure is\nvisible to the caller when the procedure returns.\n \nFor each OUT or INOUT parameter, pass a user-defined\nvariable in the\nCALL statement that invokes the procedure so that you can\nobtain its\nvalue when the procedure returns. If you are calling the\nprocedure\nfrom within another stored procedure or function, you can\nalso pass a\nroutine parameter or local routine variable as an IN or\nINOUT\nparameter.\n \nDETERMINISTIC/NOT DETERMINISTIC\n \nDETERMINISTIC and NOT DETERMINISTIC apply only to functions.\nSpecifying DETERMINISTC or NON-DETERMINISTIC in procedures\nhas no effect. The default value is NOT DETERMINISTIC.\nFunctions are DETERMINISTIC when they always return the same\nvalue for the same input. For example, a truncate or\nsubstring function. Any function involving data, therefore,\nis always NOT DETERMINISTIC.\n \nCONTAINS SQL/NO SQL/READS SQL DATA/MODIFIES SQL DATA\n \nCONTAINS SQL, NO SQL, READS SQL DATA, and MODIFIES SQL DATA\nare informative clauses that tell the server what the\nfunction does. MariaDB does not check in any way whether the\nspecified clause is correct. If none of these clauses are\nspecified, CONTAINS SQL is used by default.\n \nMODIFIES SQL DATA means that the function contains\nstatements that may modify data stored in databases. This\nhappens if the function contains statements like DELETE,\nUPDATE, INSERT, REPLACE or DDL.\n \nREADS SQL DATA means that the function reads data stored in\ndatabases, but does not modify any data. This happens if\nSELECT statements are used, but there no write operations\nare executed.\n \nCONTAINS SQL means that the function contains at least one\nSQL statement, but it does not read or write any data stored\nin a database. Examples include SET or DO.\n \nNO SQL means nothing, because MariaDB does not currently\nsupport any language other than SQL.\n \nThe routine_body consists of a valid SQL procedure\nstatement. This can\nbe a simple statement such as SELECT or INSERT, or it can be\na\ncompound statement written using BEGIN and END. Compound\nstatements\ncan contain declarations, loops, and other control structure\nstatements. See Programmatic and Compound Statements for\nsyntax details.\n \nMariaDB allows routines to contain DDL statements, such as\nCREATE and\nDROP. MariaDB also allows stored procedures (but not stored\nfunctions)\nto contain SQL transaction statements such as COMMIT.\n \nFor additional information about statements that are not\nallowed in\nstored routines, see Stored Routine Limitations.\n \nInvoking stored procedure from within programs\n \nFor information about invoking stored procedures from within\nprograms written in a language that has a MariaDB/MySQL\ninterface, see CALL.\n \nOR REPLACE\n \nIf the optional OR REPLACE clause is used, it acts as a\nshortcut for:\n \nDROP PROCEDURE IF EXISTS name;\n \nCREATE PROCEDURE name ...;\n \nwith the exception that any existing privileges for the\nprocedure are not dropped.\n \nsql_mode\n \nMariaDB stores the sql_mode system variable setting that is\nin effect at the time a routine is created, and always\nexecutes the routine with this setting in force, regardless\nof the server SQL mode in effect when the routine is\ninvoked.\n \nCharacter Sets and Collations\n \nProcedure parameters can be declared with any character\nset/collation. If the character set and collation are not\nspecifically set, the database defaults at the time of\ncreation will be used. If the database defaults change at a\nlater stage, the stored procedure character set/collation\nwill not be changed at the same time; the stored procedure\nneeds to be dropped and recreated to ensure the same\ncharacter set/collation as the database is used.\n \nOracle Mode\n \nFrom MariaDB 10.3, a subset of Oracle\'s PL/SQL language has\nbeen supported in addition to the traditional SQL/PSM-based\nMariaDB syntax. See Oracle mode from MariaDB 10.3 for\ndetails on changes when running Oracle mode.\n \nExamples\n-------- \nThe following example shows a simple stored procedure that\nuses an OUT\nparameter. It uses the DELIMITER command to set a new\ndelimiter for the duration of the process — see Delimiters\nin the mysql client.\n \nDELIMITER //\n \nCREATE PROCEDURE simpleproc (OUT param1 INT)\n BEGIN\n SELECT COUNT(*) INTO param1 FROM t;\n END;\n//\n \nDELIMITER ;\n \nCALL simpleproc(@a);\n \nSELECT @a;\n+------+\n| @a |\n+------+\n| 1 |\n+------+\n \nCharacter set and collation:\n \nDELIMITER //\n \nCREATE PROCEDURE simpleproc2 (\n OUT param1 CHAR(10) CHARACTER SET \'utf8\' COLLATE\n\'utf8_bin\'\n)\n BEGIN\n SELECT CONCAT(\'a\'),f1 INTO param1 FROM t;\n END;\n//\n \nDELIMITER ;\n \nCREATE OR REPLACE:\n \nDELIMITER //\n \nCREATE PROCEDURE simpleproc2 (\n OUT param1 CHAR(10) CHARACTER SET \'utf8\' COLLATE\n\'utf8_bin\'\n)\n BEGIN\n SELECT CONCAT(\'a\'),f1 INTO param1 FROM t;\n \n END;\n \n//\nERROR 1304 (42000): PROCEDURE simpleproc2 already exists\n \nDELIMITER ;\n \nDELIMITER //\n \nCREATE OR REPLACE PROCEDURE simpleproc2 (\n OUT param1 CHAR(10) CHARACTER SET \'utf8\' COLLATE\n\'utf8_bin\'\n)\n BEGIN\n SELECT CONCAT(\'a\'),f1 INTO param1 FROM t;\n \n END;\n \n//\nERROR 1304 (42000): PROCEDURE simpleproc2 already exists\n \nDELIMITER ;\n \nQuery OK, 0 rows affected (0.03 sec)\n \n\n\nURL: https://mariadb.com/kb/en/library/create-procedure/','','https://mariadb.com/kb/en/library/create-procedure/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (658,39,'CREATE SEQUENCE','CREATE SEQUENCE was introduced in MariaDB 10.3.\n \nSyntax\n------ \nCREATE [OR REPLACE] [TEMPORARY] SEQUENCE [IF NOT EXISTS]\nsequence_name\n[ INCREMENT [ BY | = ] increment ]\n[ MINVALUE [=] minvalue | NO MINVALUE | NOMINVALUE ]\n[ MAXVALUE [=] maxvalue | NO MAXVALUE | NOMAXVALUE ]\n[ START [ WITH | = ] start ] \n[ CACHE [=] cache | NOCACHE ] [ CYCLE | NOCYCLE] \n[table_options]\n \nThe options for CREATE SEQUENCE can be given in any order,\noptionally followed by table_options.\n \ntable_options can be any of the normal table options in\nCREATE TABLE but the most usable ones are ENGINE=... and\nCOMMENT=.\n \nNOMAXVALUE and NOMINVALUE are there to allow one to create\nSEQUENCEs using the Oracle syntax.\n \nDescription\n----------- \nCREATE SEQUENCE will create a sequence that generates new\nvalues when called with NEXT VALUE FOR sequence_name. It\'s\nan alternative to AUTO INCREMENT when one wants to have more\ncontrol of how the numbers are generated. As the SEQUENCE\ncaches values (up to CACHE) it can in some cases be much\nfaster than AUTO INCREMENT. Another benefit is that one can\naccess the last value generated by all used sequences, which\nsolves one of the limitations with LAST_INSERT_ID().\n \nCREATE SEQUENCE requires the CREATE privilege.\n \nDROP SEQUENCE can be used to drop a sequence, and ALTER\nSEQUENCE to change it.\n \nArguments to Create\n \nThe following options may be used:\n \nOption | Default value |  Description | \n \nINCREMENT |  1 | Increment to use for values. May be\nnegative. Setting an increment of 0 causes the sequence to\nuse the value of the auto_increment_increment system\nvariable at the time of creation, which is always a positive\nnumber. (see MDEV-16035). | \n \nMINVALUE | 1 if INCREMENT > 0 and -9223372036854775807 if\nINCREMENT < 0 | Minimum value for the sequence | \n \nMAXVALUE | 9223372036854775806 if INCREMENT > 0 and -1 if\nINCREMENT < 0 | Max value for sequence | \n \nSTART | MINVALUE if INCREMENT > 0 and MAX_VALUE if\nINCREMENT< 0 | First value that the sequence will generate |\n\n \nCACHE | 1000 |  Number of values that should be cached. 0\nif no CACHE. The underlying table will be updated first time\na new sequence number is generated and each time the cache\nruns out. | \n \nIf CYCLE is used then the sequence should start again from\nMINVALUE after it has run out of values. Default value is\nNOCYCLE.\n \nConstraints on Create Arguments\n \nTo be able to create a legal sequence, the following must\nhold:\nMAXVALUE >= start\nMAXVALUE > MINVALUE\nSTART >= MINVALUE\nMAXVALUE = -9223372036854775807 (LONGLONG_MIN+1)\n \nNote that sequences can\'t generate the maximum/minimum 64\nbit number because of the constraint of\nMINVALUE and MAXVALUE. \n \nExamples\n-------- \nCREATE SEQUENCE s START WITH 100 INCREMENT BY 10;\n \nCREATE SEQUENCE s2 START WITH -100 INCREMENT BY -10;\n \nThe following statement fails, as the increment conflicts\nwith the defaults\n \nCREATE SEQUENCE s3 START WITH -100 INCREMENT BY 10;\n \nERROR 4082 (HY000): Sequence \'test.s3\' values are\nconflicting\n \nThe sequence can be created by specifying workable minimum\nand maximum values:\n \nCREATE SEQUENCE s3 START WITH -100 INCREMENT BY 10\nMINVALUE=-100 MAXVALUE=1000;\n \n\n\nURL: https://mariadb.com/kb/en/library/create-sequence/','','https://mariadb.com/kb/en/library/create-sequence/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (659,39,'CREATE SERVER','Syntax\n------ \nCREATE [OR REPLACE] SERVER [IF NOT EXISTS] 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 \nDescription\n----------- \nThis statement creates the definition of a server for use\nwith the Spider,\nFEDERATED or FederatedX storage\nengine. The CREATE SERVER statement creates a new row within\nthe\nservers table within the mysql database. This statement\nrequires the SUPER privilege.\n \nThe server_name should be a unique reference to the server.\nServer definitions\nare global within the scope of the server, it is not\npossible to qualify the\nserver definition to a specific database. server_name has a\nmaximum length of\n64 characters (names longer than 64 characters are silently\ntruncated), and is\ncase insensitive. You may specify the name as a quoted\nstring.\n \nThe wrapper_name should be mysql, and may be quoted with\nsingle quotes.\nOther values for wrapper_name are not currently supported.\n \nFor each option you must specify either a character literal\nor numeric literal.\nCharacter literals are UTF-8, support a maximum length of 64\ncharacters and\ndefault to a blank (empty) string. String literals are\nsilently truncated to 64\ncharacters. Numeric literals must be a number between 0 and\n9999, default value\nis 0.\n \nNote: The OWNER option is currently not applied, and has no\neffect on\nthe ownership or operation of the server connection that is\ncreated.\n \nThe CREATE SERVER statement creates an entry in the\nmysql.servers table that can later be used with the\nCREATE TABLE statement when creating a Spider, FederatedX or\nFEDERATED table. The options that you specify will\nbe used to populate the columns in the mysql.servers table.\nThe table columns\nare Server_name, Host, Db, Username, Password, Port and\nSocket.\n \n DROP SERVER removes a previously created server definition.\n\n \nCREATE SERVER is not written to the binary log, irrespective\nof\nthe binary log format being used.\n \nFor valid identifiers to use as server names, see Identifier\nNames.\n \nOR REPLACE\n \nIf the optional OR REPLACE clause is used, it acts as a\nshortcut for:\n \nDROP SERVER IF EXISTS name;\n \nCREATE SERVER server_name ...;\n \nIF NOT EXISTS\n \nIf the IF NOT EXISTS clause is used, MariaDB will return a\nwarning instead of an error if the server already exists.\nCannot be used together with OR REPLACE.\n \nExamples\n-------- \nCREATE SERVER s\nFOREIGN DATA WRAPPER mysql\nOPTIONS (USER \'Remote\', HOST \'192.168.1.106\', DATABASE\n\'test\');\n \nOR REPLACE and IF NOT EXISTS:\n \nCREATE SERVER s \nFOREIGN DATA WRAPPER mysql \nOPTIONS (USER \'Remote\', HOST \'192.168.1.106\', DATABASE\n\'test\');\nERROR 1476 (HY000): The foreign server, s, you are trying to\ncreate already exists\n \nCREATE OR REPLACE SERVER s \nFOREIGN DATA WRAPPER mysql \nOPTIONS (USER \'Remote\', HOST \'192.168.1.106\', DATABASE\n\'test\');\nQuery OK, 0 rows affected (0.00 sec)\n \nCREATE SERVER IF NOT EXISTS s \nFOREIGN DATA WRAPPER mysql \nOPTIONS (USER \'Remote\', HOST \'192.168.1.106\', DATABASE\n\'test\');\nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+-------+------+----------------------------------------------------------------+\n| Level | Code | Message |\n+-------+------+----------------------------------------------------------------+\n| Note | 1476 | The foreign server, s, you are trying to\ncreate already exists |\n+-------+------+----------------------------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/create-server/','','https://mariadb.com/kb/en/library/create-server/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (660,39,'CREATE TABLE','Syntax\n------ \nCREATE [OR REPLACE] [TEMPORARY] TABLE [IF NOT EXISTS]\ntbl_name\n (create_definition,...) [table_options ]...\n[partition_options]\nCREATE [OR REPLACE] [TEMPORARY] TABLE [IF NOT EXISTS]\ntbl_name\n [(create_definition,...)] [table_options ]...\n[partition_options]\n select_statement\nCREATE [OR REPLACE] [TEMPORARY] TABLE [IF NOT EXISTS]\ntbl_name\n { LIKE old_table_name | (LIKE old_table_name) }\n \nselect_statement:\n [IGNORE | REPLACE] [AS] SELECT ... (Some legal select\nstatement)\n \nDescription\n----------- \nUse the CREATE TABLE statement to create a table with the\ngiven name.\n \nIn its most basic form, the CREATE TABLE statement provides\na table name\nfollowed by a list of columns, indexes, and constraints. By\ndefault, the table\nis created in the default database. Specify a database with\ndb_name.tbl_name.\nIf you quote the table name, you must quote the database\nname and table name\nseparately as `db_name`.`tbl_name`. This is particularly\nuseful for CREATE TABLE ... SELECT, because it allows to\ncreate a table into a database, which contains data from\nother databases. See Identifier Qualifiers.\n \nIf a table with the same name exists, error 1050 results.\nUse IF NOT EXISTS\nto suppress this error and issue a note instead. Use SHOW\nWARNINGS\nto see notes.\n \nThe CREATE TABLE statement automatically commits the current\ntransaction,\nexcept when using the TEMPORARY keyword.\n \nFor valid identifiers to use as table names, see Identifier\nNames.\n \nNote: if the default_storage_engine is set to ColumnStore\nthen it needs setting on all UMs. Otherwise when the tables\nusing the default engine are replicated across UMs they will\nuse the wrong engine. You should therefore not use this\noption as a session variable with ColumnStore.\n \nMicrosecond precision can be between 0-6. If no precision is\nspecified it is assumed to be 0, for backward compatibility\nreasons.\n \nPrivileges\n \nExecuting the CREATE TABLE statement requires the CREATE\nprivilege for the table or the database.\n \nCREATE OR REPLACE TABLE ...\n \nThe OR REPLACE clause was added in MariaDB 10.0.8.\n \nIf the OR REPLACE clause is used and if the table already\nexists, then instead of returning an error, the server will\ndrop the existing table and replace it with the newly\ndefined table.\n \nThis syntax was originally added to make replication more\nrobust if it has to rollback and repeat statements such as\nCREATE ... SELECT on slaves.\n \nCREATE OR REPLACE TABLE table_name (a int);\n \nis basically the same as:\n \nDROP TABLE IF EXISTS table_name;\nCREATE TABLE table_name (a int);\n \nwith the following exceptions:\nIf table_name was locked with LOCK TABLES it will continue\nto be locked after the statement.\nTemporary tables are only dropped if the TEMPORARY keyword\nwas used. (With DROP TABLE, temporary tables are preferred\nto be dropped before normal tables).\n \nThings to be Aware of With CREATE OR REPLACE\n \nThe table is dropped first (if it existed), after that the\nCREATE is done. Because of this, if the CREATE fails, then\nthe table will not exist anymore after the statement. If the\ntable was used with LOCK TABLES it will be unlocked.\nOne can\'t use OR REPLACE together with IF EXISTS.\nSlaves in replication will by default use CREATE OR REPLACE\nwhen replicating CREATE statements that don\'\'t use IF\nEXISTS. This can be changed by setting the variable\nslave-ddl-exec-mode to STRICT.\n \nCREATE TABLE IF NOT EXISTS ...\n \nIf the IF NOT EXISTS clause is used, then the index will\nonly be created if an index with the same name does not\nalready exist. If the index already exists, then a warning\nwill be triggered by default.\n \nCREATE TEMPORARY TABLE ...\n \nUse the TEMPORARY keyword to create a temporary table that\nis only available to your current session. Temporary tables\nare dropped when the your session ends. Temporary table\nnames are specific to your session. They will not conflict\nwith other temporary tables from other session even if they\nshare the same name. They will shadow names of non-temporary\ntables or views, if they are identical. A temporary table\ncan have the same name as a non-temporary table which is\nlocated in the same database. In that case, their name will\nreference the temporary table when used in SQL statements.\nYou must have the CREATE TEMPORARY TABLES privilege on the\ndatabase to create temporary tables. If no storage engine is\nspecified, the default_tmp_storage_engine setting will\ndetermine the engine.\n \nCREATE TABLE ... LIKE\n \nUse the LIKE clause instead of a full table definition to\ncreate a table with the same definition as another table,\nincluding columns, indexes, and table options. Foreign key\ndefinitions, as well as any DATA DIRECTORY or INDEX\nDIRECTORY table options specified on the original table,\nwill not be created.\n \nCREATE TABLE ... SELECT\n \nYou can create a table containing data from other tables\nusing the CREATE ... SELECT statement. Columns will be\ncreated in the table for each field returned by the SELECT\nquery.\n \nYou can also define some columns normally and add other\ncolumns from a SELECT. You can also create columns in the\nnormal way and assign them some values using the query, this\nis done to force a certain type or other field\ncharacteristics. The columns that are not named in the query\nwill be placed before the others. For example:\n \nCREATE TABLE test (a INT NOT NULL, b CHAR(10)) ENGINE=MyISAM\n SELECT 5 AS b, c, d FROM another_table;\n \nRemember that the query just returns data. If you want to\nuse the same indexes, or the same columns attributes ([NOT]\nNULL, DEFAULT, AUTO_INCREMENT) in the new table, you need to\nspecify them manually. Types and sizes are not automatically\npreserved if no data returned by the SELECT requires the\nfull size, and VARCHAR could be converted into CHAR. The\nCAST() function can be used to forcee the new table to use\ncertain types.\n \nAliases (AS) are taken into account, and they should always\nbe used when you SELECT an expression (function,\narithmetical operation, etc).\n \nIf an error occurs during the query, the table will not be\ncreated at all.\n \nIf the new table has a primary key or UNIQUE indexes, you\ncan use the IGNORE or REPLACE keywords to handle duplicate\nkey errors during the query. IGNORE means that the newer\nvalues must not be inserted an identical value exists in the\nindex. REPLACE means that older values must be overwritten.\n \nIf the columns in the new table are more than the rows\nreturned by the query, the columns populated by the query\nwill be placed after other columns. Note that if the strict\nSQL_MODE is on, and the columns that are not names in the\nquery do not have a DEFAULT value, an error will raise and\nno rows will be copied.\n \nConcurrent inserts are not used during the execution of a\nCREATE ... SELECT.\n \nIf the table already exists, an error similar to the\nfollowing will be returned:\n \nERROR 1050 (42S01): Table \'t\' already exists\n \nIf the IF NOT EXISTS clause is used and the table exists, a\nnote will be produced instead of an error.\n \nTo insert rows from a query into an existing table, INSERT\n... SELECT can be used.\n \nColumn Definitions\n \ncreate_definition:\n { col_name column_definition | index_definition |\nperiod_definition | CHECK (expr) }\n \ncolumn_definition:\n data_type\n [NOT NULL | NULL] [DEFAULT default_value | (expression)]\n [AUTO_INCREMENT] [ZEROFILL] [UNIQUE [KEY] | [PRIMARY] KEY]\n [INVISIBLE] [{WITH|WITHOUT} SYSTEM VERSIONING]\n [COMMENT \'string\']\n [COLUMN_FORMAT {FIXED|DYNAMIC|DEFAULT}]\n [reference_definition]\n | data_type [GENERATED ALWAYS] AS { { ROW {START|END} } | {\n(expression) [VIRTUAL | PERSISTENT | STORED] } }\n [UNIQUE [KEY]] [COMMENT \'string\']\n \nconstraint_definition:\n CONSTRAINT [constraint_name] CHECK (expression)\nNote: MariaDB accepts the REFERENCES clause in ALTER TABLE\nand CREATE TABLE column definitions, but that syntax does\nnothing. MariaDB simply parses it without returning any\nerror or warning, for compatibility with other DBMS\'s.\nBefore MariaDB 10.2.1 this was also true for CHECK\nconstraints. Only the syntax for indexes described below\ncreates foreign keys.\n \nEach definition either creates a column in the table or\nspecifies and index or\nconstraint on one or more columns. See Indexes below for\ndetails\non creating indexes.\n \nCreate a column by specifying a column name and a data type,\noptionally\nfollowed by column options. See Data Types for a full list\nof data types allowed in MariaDB.\n \nNULL and NOT NULL\n \nUse the NULL or NOT NULL options to specify that values in\nthe column\nmay or may not be NULL, respectively. By default, values may\nbe NULL. See also NULL Values in MariaDB.\n \nDEFAULT Column Option\n \nThe DEFAULT clause was enhanced in MariaDB 10.2.1. Some\nenhancements include\nBLOB and TEXT columns now support DEFAULT.\nThe DEFAULT clause can now be used with an expression or\nfunction.\n \nSpecify a default value using the DEFAULT clause. If you\ndon\'t specify DEFAULT then the following rules apply:\nIf the column is not defined with NOT NULL, AUTO_INCREMENT\nor TIMESTAMP, an explicit DEFAULT NULL will be added.\nNote that in MySQL and in MariaDB before 10.1.6, you may get\nan explicit DEFAULT for primary key parts, if not specified\nwith NOT NULL.\n \nThe default value will be used if you INSERT a row without\nspecifying a value for that column, or if you specify\nDEFAULT for that column.\nBefore MariaDB 10.2.1 you couldn\'t usually provide an\nexpression or function to evaluate at\ninsertion time. You had to provide a constant default value\ninstead. The one\nexception is that you may use CURRENT_TIMESTAMP as\nthe default value for a TIMESTAMP column to use the current\ntimestamp at insertion time.\n \nCURRENT_TIMESTAMP may also be used as\nthe default value for a DATETIME\n \nFrom MariaDB 10.2.1 you can use most functions in DEFAULT.\nExpressions should have parentheses around them. If you use\na non deterministic function in DEFAULT then all inserts to\nthe table will be replicated in row mode. You can even refer\nto earlier columns in the DEFAULT expression:\n \nCREATE TABLE t1 (a int DEFAULT (1+1), b int DEFAULT (a+1));\nCREATE TABLE t2 (a bigint primary key DEFAULT UUID_SHORT());\n \nThe DEFAULT clause cannot contain any stored functions or\nsubqueries, and a column used in the clause must already\nhave been defined earlier in the statement.\n \nSince MariaDB 10.2.1, it is possible to assign BLOB or TEXT\ncolumns a DEFAULT value. In earlier versions, assigning a\ndefault to these columns was not possible.\n \nStarting from 10.3.3 you can also use DEFAULT (NEXT VALUE\nFOR sequence)\n \nAUTO_INCREMENT Column Option\n \nUse AUTO_INCREMENT to create a column whose value can\ncan be set automatically from a simple counter. You can only\nuse AUTO_INCREMENT\non a column with an integer type. The column must be a key,\nand there can only be\none AUTO_INCREMENT column in a table. If you insert a row\nwithout specifying\na value for that column (or if you specify 0, NULL, or\nDEFAULT\nas the value), the actual value will be taken from the\ncounter, with each insertion\nincrementing the counter by one. You can still insert a\nvalue explicitly. If you\ninsert a value that is greater than the current counter\nvalue, the counter is\nset based on the new value. An AUTO_INCREMENT column is\nimplicitly NOT NULL.\nUse LAST_INSERT_ID to get the AUTO_INCREMENT value\nmost recently used by an INSERT statement.\n \nZEROFILL Column Option\n \nIf the ZEROFILL column option is specified for a column\nusing a numeric data type, then the column will be set to\nUNSIGNED and the spaces used by default to pad the field are\nreplaced with zeros. ZEROFILL is ignored in expressions or\nas part of a UNION. ZEROFILL is a non-standard MySQL and\nMariaDB enhancement.\n \nPRIMARY KEY Column Option\n \nUse PRIMARY KEY (or just KEY) to make a column a primary\nkey. A primary key is a special type of a unique key. There\ncan be at most one primary key per table, and it is\nimplicitly NOT NULL.\n \nSpecifying a column as a unique key creates a unique index\non that column. See the Index Definitions section below for\nmore information.\n \nUNIQUE KEY Column Option\n \nUse UNIQUE KEY (or just UNIQUE) to specify that all values\nin the column\nmust be distinct from each other. Unless the column is NOT\nNULL, there may be\nmultiple rows with NULL in the column. \n \nSpecifying a column as a unique key creates a unique index\non that column. See the Index Definitions section below for\nmore information.\n \nCOMMENT Column Option\n \nYou can provide a comment for each column using the COMMENT\nclause. The maximum length is 1024 characters (it was 255\ncharacters before MariaDB 5.5). Use\nthe SHOW FULL COLUMNS statement to see column comments.\n \nGenerated Columns\n \nA generated column is a column in a table that cannot\nexplicitly be set to a specific value in a DML query.\nInstead, its value is automatically generated based on an\nexpression. This expression might generate the value based\non the values of other columns in the table, or it might\ngenerate the value by calling built-in functions or\nuser-defined functions (UDFs).\n \nThere are two types of generated columns:\nPERSISTENT or STORED: This type\'s value is actually stored\nin the table.\nVIRTUAL: This type\'s value is not stored at all. Instead,\nthe value is generated dynamically when the table is\nqueried. This type is the default.\n \nGenerated columns are also sometimes called computed columns\nor virtual columns.\n \nFor a complete description about generated columns and their\nlimitations, see Generated (Virtual and Persistent/Stored)\nColumns.\n \nCOLUMN_FORMAT\n \nCOLUMN_FORMAT is only used by MySQL Cluster, and is silently\nignored in MariaDB.\n \nCOMPRESSED\n \nCertain columns may be compressed. See Storage-Engine\nIndependent Column Compression.\n \nINVISIBLE\n \nColumns may be made invisible, and hidden in certain\ncontexts. See Invisible Columns.\n \nWITH SYSTEM VERSIONING Column Option\n \nColumns may be explicitly marked as included from system\nversioning. See System-versioned tables for details.\n \nWITHOUT SYSTEM VERSIONING Column Option\n \nColumns may be explicitly marked as excluded from system\nversioning. See System-versioned tables for details.\n \nIndex Definitions\n \nindex_definition:\n {INDEX|KEY} [index_name] [index_type] (index_col_name,...)\n[index_option] ...\n | {FULLTEXT|SPATIAL} [INDEX|KEY] [index_name]\n(index_col_name,...) [index_option] ...\n | [CONSTRAINT [symbol]] PRIMARY KEY [index_type]\n(index_col_name,...) [index_option] ...\n | [CONSTRAINT [symbol]] UNIQUE [INDEX|KEY] [index_name]\n[index_type] (index_col_name,...) [index_option] ...\n | [CONSTRAINT [symbol]] FOREIGN KEY [index_name]\n(index_col_name,...) reference_definition\n \nindex_col_name:\n col_name [(length)] [ASC | DESC]\n \nindex_type:\n USING {BTREE | HASH | RTREE}\n \nindex_option:\n KEY_BLOCK_SIZE [=] value\n | index_type\n | WITH PARSER parser_name\n | COMMENT \'string\'\n | CLUSTERING={YES| NO}\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\nINDEX and KEY are synonyms. \n \nIndex names are optional, if not specified an automatic name\nwill be assigned. Index name are needed to drop indexes and\nappear in error messages when a constraint is violated.\n \nIndex Categories\n \nPlain Indexes\n \nPlain indexes are regular indexes that are not unique, and\nare not acting as a primary key or a foreign key. They are\nalso not the \"specialized\" FULLTEXT or SPATIAL indexes.\n \nSee Getting Started with Indexes: Plain Indexes for more\ninformation.\n \nPRIMARY KEY\n \nFor PRIMARY KEY indexes, you can specify a name for the\nindex, but it is silently ignored, and the name of the index\nis always PRIMARY.\n \nSee Getting Started with Indexes: Primary Key for more\ninformation.\n \nUNIQUE\n \nThe UNIQUE keyword means that the index will not accept\nduplicated values, except for NULLs. An error will raise if\nyou try to insert duplicate values in a UNIQUE index.\n \nFor UNIQUE indexes, you can specify a name for the\nconstraint, using the CONSTRAINT keyword. That name will be\nused in error messages.\n \nSee Getting Started with Indexes: Unique Index for more\ninformation.\n \nFOREIGN KEY\n \nFor FOREIGN KEY indexes, a reference definition must be\nprovided.\n \nFor FOREIGN KEY indexes, you can specify a name for the\nconstraint, using the CONSTRAINT keyword. That name will be\nused in error messages.\n \nFirst, you have to specify the name of the target (parent)\ntable and a column or a column list which must be indexed\nand whose values must match to the foreign key\'s values.\nThe MATCH clause is accepted to improve the compatibility\nwith other DBMS\'s, but has no meaning in MariaDB. The ON\nDELETE and ON UPDATE clauses specify what must be done when\na DELETE (or a REPLACE) statements attempts to delete a\nreferenced row from the parent table, and when an UPDATE\nstatement attempts to modify the referenced foreign key\ncolumns in a parent table row, respectively. The following\noptions are allowed:\nRESTRICT: The delete/update operation is not performed. The\nstatement terminates with a 1451 error (SQLSTATE \'2300\').\nNO ACTION: Synonym for RESTRICT.\nCASCADE: The delete/update operation is performed in both\ntables.\nSET NULL: The update or delete goes ahead in the parent\ntable, and the corresponding foreign key fields in the child\ntable are set to NULL. (They must not be defined as NOT NULL\nfor this to succeed).\nSET DEFAULT: This option is currently implemented only for\nthe PBXT storage engine, which is disabled by default and no\nlonger maintained. It sets the child table\'s foreign key\nfields to their DEFAULT values when the referenced parent\ntable key entries are updated or deleted.\n \nIf either clause is omitted, the default behavior for the\nomitted clause is RESTRICT.\n \nSee Foreign Keys for more information.\n \nFULLTEXT\n \nUse the FULLTEXT keyword to create full-text indexes.\n \nSee Full-Text Indexes for more information.\n \nSPATIAL\n \nUse the SPATIAL keyword to create geometric indexes.\n \nSee SPATIAL INDEX for more information.\n \nIndex Options\n \nKEY_BLOCK_SIZE Index Option\n \nThe KEY_BLOCK_SIZE index option is similar to the\nKEY_BLOCK_SIZE table option.\n \nWith the InnoDB storage engine, if you specify a non-zero\nvalue for the KEY_BLOCK_SIZE table option for the whole\ntable, then the table will implicitly be created with the\nROW_FORMAT table option set to COMPRESSED. However, this\ndoes not happen if you just set the KEY_BLOCK_SIZE index\noption for one or more indexes in the table. The InnoDB\nstorage engine ignores the KEY_BLOCK_SIZE index option.\nHowever, the SHOW CREATE TABLE statement may still report it\nfor the index.\n \nFor information about the KEY_BLOCK_SIZE index option, see\nthe KEY_BLOCK_SIZE table option below.\n \nIndex Types\n \nEach storage engine supports some or all index types. See\nStorage Engine Index Types for details on permitted index\ntypes for each storage engine.\n \nDifferent index types are optimized for different kind of\noperations:\nBTREE is the default type, a','','https://mariadb.com/kb/en/library/create-table/');
+update help_topic set description = CONCAT(description, 'nd normally is the best choice.\nIt is supported by all storage engines. It can be used to\ncompare a column\'s value with a value using the =, >, >=,\n0) ,b int check (b> 0), constraint abc check (a>b));\n \nIf you use the second format and you don\'t give a name to\nthe constraint, then the constraint will get a auto\ngenerated name. This is done so that you can later delete\nthe constraint with ALTER TABLE DROP constraint_name.\n \nOne can disable all constraint expression checks by setting\nthe variable check_constraint_checks to OFF. This is useful\nfor example when loading a table that violates some\nconstraints that you want to later find and fix in SQL.\n \nSee CONSTRAINT for more information.\n \nTable Options\n \nFor each individual table you create (or alter), you can set\nsome table options. The general syntax for setting options\nis:\n \n = , [ = ...]\n \nThe equal sign is optional.\n \nSome options are supported by the server and can be used for\nall tables, no matter what storage engine they use; other\noptions can be specified for all storage engines, but have a\nmeaning only for some engines. Also, engines can extend\nCREATE TABLE with new options.\n \nIf the IGNORE_BAD_TABLE_OPTIONS SQL_MODE is enabled, wrong\ntable options generate a warning; otherwise, they generate\nan error.\n \ntable_option: \n [STORAGE] 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 | ENCRYPTED [=] {YES | NO}\n | ENCRYPTION_KEY_ID [=] value\n | IETF_QUOTES [=] {YES | NO}\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 | PAGE_CHECKSUM [=] {0 | 1}\n | PAGE_COMPRESSED [=] {0 | 1}\n | PAGE_COMPRESSION_LEVEL [=] {0 .. 9}\n | PASSWORD [=] \'string\'\n | ROW_FORMAT [=]\n{DEFAULT|DYNAMIC|FIXED|COMPRESSED|REDUNDANT|COMPACT|PAGE}\n | SEQUENCE [=] {0|1}\n | STATS_AUTO_RECALC [=] {DEFAULT|0|1}\n | STATS_PERSISTENT [=] {DEFAULT|0|1}\n | STATS_SAMPLE_PAGES [=] {DEFAULT|value}\n | TABLESPACE tablespace_name\n | TRANSACTIONAL [=] {0 | 1}\n | UNION [=] (tbl_name[,tbl_name]...)\n | WITH SYSTEM VERSIONING\n \n[STORAGE] ENGINE\n \n[STORAGE] ENGINE specifies a storage engine for the table.\nIf this option is not used, the default storage engine is\nused instead. That is, the storage_engine session option\nvalue if it is set, or the value specified for the\n--default-storage-engine mysqld startup options, or InnoDB.\nIf the specified storage engine is not installed and active,\nthe default value will be used, unless the\nNO_ENGINE_SUBSTITUTION SQL MODE is set (default since\nMariaDB 10.0). This is only true for CREATE TABLE, not for\nALTER TABLE. For a list of storage engines that are present\nin your server, issue a SHOW ENGINES.\n \nAUTO_INCREMENT\n \nAUTO_INCREMENT specifies the initial value for the\nAUTO_INCREMENT primary key. This works for MyISAM, Aria,\nInnoDB/XtraDB, MEMORY, and ARCHIVE tables. You can change\nthis option with ALTER TABLE, but in that case the new value\nmust be higher than the highest value which is present in\nthe AUTO_INCREMENT column. If the storage engine does not\nsupport this option, you can insert (and then delete) a row\nhaving the wanted value - 1 in the AUTO_INCREMENT column.\n \nAVG_ROW_LENGTH\n \nAVG_ROW_LENGTH is the average rows size. It only applies to\ntables using MyISAM and Aria storage engines that have the\nROW_FORMAT table option set to FIXED format.\n \nMyISAM uses MAX_ROWS and AVG_ROW_LENGTH to decide the\nmaximum size of a table (default: 256TB, or the maximum file\nsize allowed by the system).\n \n[DEFAULT] CHARACTER SET/CHARSET\n \n[DEFAULT] CHARACTER SET (or [DEFAULT] CHARSET) is used to\nset a default character set for the table. This is the\ncharacter set used for all columns where an explicit\ncharacter set is not specified. If this option is omitted or\nDEFAULT is specified, database\'s default character set will\nbe used. See Setting Character Sets and Collations for\ndetails on setting the character sets.\n \nCHECKSUM/TABLE_CHECKSUM\n \nCHECKSUM (or TABLE_CHECKSUM) can be set to 1 to maintain a\nlive checksum for all table\'s rows. This makes write\noperations slower, but CHECKSUM TABLE will be very fast.\nThis option is only supported for MyISAM and Aria tables.\n \n[DEFAULT] COLLATE\n \n[DEFAULT] COLLATE is used to set a default collation for the\ntable. This is the collation used for all columns where an\nexplicit character set is not specified. If this option is\nomitted or DEFAULT is specified, database\'s default option\nwill be used. See Setting Character Sets and Collations for\ndetails on setting the collations\n \nCOMMENT\n \nCOMMENT is a comment for the table. Maximum length is 2048\ncharacters (before mariaDB 5.5 it was 60 characters). Also\nused to define table parameters when creating a Spider\ntable.\n \nCONNECTION\n \nCONNECTION is used to specify a server name or a connection\nstring for a Spider, CONNECT, Federated or FederatedX table.\n \nDATA DIRECTORY/INDEX DIRECTORY\n \nDATA DIRECTORY and INDEX DIRECTORY were only supported for\nMyISAM and Aria, before MariaDB 5.5. Since 5.5, DATA\nDIRECTORY has also been supported by InnoDB if the\ninnodb_file_per_table server system variable is enabled, but\nonly in CREATE TABLE, not in ALTER TABLE. So, carefully\nchoose a path for InnoDB tables at creation time, because it\ncannot be changed without dropping and re-creating the\ntable. These options specify the paths for data files and\nindex files, respectively. If these options are omitted, the\ndatabase\'s directory will be used to store data files and\nindex files. Note that these table options do not work for\npartitioned tables (use the partition options instead), or\nif the server has been invoked with the\n--skip-symbolic-links startup option. To avoid the\noverwriting of old files with the same name that could be\npresent in the directories, you can use the\n--keep_files_on_create option (an error will be issued if\nfiles already exist). These options are ignored if the\nNO_DIR_IN_CREATE SQL_MODE is enabled (useful for replication\nslaves). Also note that symbolic links cannot be used for\nInnoDB tables.\n \nDATA DIRECTORY works by creating symlinks from where the\ntable would normally have been (inside the datadir) to where\nthe option specifies. For security reasons, to avoid\nbypassing the privilege system, the server does not permit\nsymlinks inside the datadir. Therefore, DATA DIRECTORY\ncannot be used to specify a location inside the datadir. An\nattempt to do so will result in an error 1210 (HY000)\nIncorrect arguments to DATA DIRECTORY.\n \nDELAY_KEY_WRITE\n \nDELAY_KEY_WRITE is supported by MyISAM and Aria, and can be\nset to 1 to speed up write operations. In that case, when\ndata are modified, the indexes are not updated until the\ntable is closed. Writing the changes to the index file\naltogether can be much faster. However, note that this\noption is applied only if the delay_key_write server\nvariable is set to \'ON\'. If it is \'OFF\' the delayed\nindex writes are always disabled, and if it is \'ALL\' the\ndelayed index writes are always used, disregarding the value\nof DELAY_KEY_WRITE.\n \nENCRYPTED\n \nThe ENCRYPTED table option was added in MariaDB 10.1.4\n \nThe ENCRYPTED table option can be used to manually set the\nencryption status of an InnoDB table. See InnoDB / XtraDB\nEncryption for more information.\n \nAria does not currently support the ENCRYPTED table option.\nSee MDEV-18049 about that.\n \nSee Data-at-Rest Encryption for more information.\n \nENCRYPTION_KEY_ID\n \nThe ENCRYPTION_KEY_ID table option was added in MariaDB\n10.1.4\n \nThe ENCRYPTION_KEY_ID table option can be used to manually\nset the encryption key of an InnoDB table. See InnoDB /\nXtraDB Encryption for more information.\n \nAria does not currently support the ENCRYPTION_KEY_ID table\noption. See MDEV-18049 about that.\n \nSee Data-at-Rest Encryption for more information.\n \nIETF_QUOTES\n \nThe IETF_QUOTES option was added in MariaDB 10.1.8\n \nFor the CSV storage engine, the IETF_QUOTES option, when set\nto YES, enables IETF-compatible parsing of embedded quote\nand comma characters. Enabling this option for a table\nimproves compatibility with other tools that use CSV, but is\nnot compatible with MySQL CSV tables, or MariaDB CSV tables\ncreated without this option. Disabled by default.\n \nINSERT_METHOD\n \nINSERT_METHOD is only used with MERGE tables. This option\ndetermines in which underlying table the new rows should be\ninserted. If you set it to \'NO\' (which is the default) no\nnew rows can be added to the table (but you will still be\nable to perform INSERTs directly against the underlying\ntables). FIRST means that the rows are inserted into the\nfirst table, and LAST means that thet are inserted into the\nlast table.\n \nKEY_BLOCK_SIZE\n \nKEY_BLOCK_SIZE is used to determine the size of key blocks,\nin bytes or kilobytes. However, this value is just a hint,\nand the storage engine could modify or ignore it. If\nKEY_BLOCK_SIZE is set to 0, the storage engine\'s default\nvalue will be used.\n \nWith the InnoDB storage engine, if you specify a non-zero\nvalue for the KEY_BLOCK_SIZE table option for the whole\ntable, then the table will implicitly be created with the\nROW_FORMAT table option set to COMPRESSED.\n \nMIN_ROWS/MAX_ROWS\n \nMIN_ROWS and MAX_ROWS let the storage engine know how many\nrows you are planning to store as a minimum and as a\nmaximum. These values will not be used as real limits, but\nthey help the storage engine to optimize the table. MIN_ROWS\nis only used by MEMORY storage engine to decide the minimum\nmemory that is always allocated. MAX_ROWS is used to decide\nthe minimum size for indexes.\n \nPACK_KEYS\n \nPACK_KEYS can be used to determine whether the indexes will\nbe compressed. Set it to 1 to compress all keys. With a\nvalue of 0, compression will not be used. With the DEFAULT\nvalue, only long strings will be compressed. Uncompressed\nkeys are faster.\n \nPAGE_CHECKSUM\n \nPAGE_CHECKSUM is only applicable to Aria tables, and\ndetermines whether indexes and data should use page\nchecksums for extra safety. \n \nPAGE_COMPRESSED\n \nPAGE_COMPRESSED is used to enable InnoDB page compression\nfor InnoDB tables.\n \nPAGE_COMPRESSION_LEVEL\n \nPAGE_COMPRESSION_LEVEL is used to set the compression level\nfor InnoDB page compression for InnoDB tables. The table\nmust also have the PAGE_COMPRESSED table option set to 1.\n \nValid values for PAGE_COMPRESSION_LEVEL are 1 (the best\nspeed) through 9 (the best compression), .\n \nPASSWORD\n \nPASSWORD is unused.\n \nRAID_TYPE\n \nRAID_TYPE is an obsolete option, as the raid support has\nbeen disabled since MySQL 5.0.\n \nROW_FORMAT\n \nThe ROW_FORMAT table option specifies the row format for the\ndata file. Possible values are engine-dependent.\n \nSupported MyISAM Row Formats\n \nFor MyISAM, the supported row formats are: \nFIXED\nDYNAMIC\nCOMPRESSED\n \nThe COMPRESSED row format can only be set by the myisampack\ncommand line tool.\n \nSee MyISAM Storage Formats for more information.\n \nSupported Aria Row Formats\n \nFor Aria, the supported row formats are:\nPAGE\nFIXED\nDYNAMIC.\n \nSee Aria Storage Formats for more information.\n \nSupported InnoDB Row Formats\n \nFor InnoDB/XtraDB, the supported row formats are:\nCOMPACT\nREDUNDANT\nCOMPRESSED\nDYNAMIC.\n \nIf the ROW_FORMAT table option is set to FIXED for an InnoDB\ntable, then the server will either return an error or a\nwarning depending on the value of the innodb_strict_mode\nsystem variable. If the innodb_strict_mode system variable\nis set to OFF, then a warning is issued, and MariaDB will\ncreate the table using the default row format for the\nspecific MariaDB server version. If the innodb_strict_mode\nsystem variable is set to ON, then an error will be raised.\n \nSee XtraDB/InnoDB Storage Formats for more information.\n \nOther Storage Engines and ROW_FORMAT\n \nOther storage engines do not support the ROW_FORMAT table\noption.\n \nSEQUENCE\n \nIf the table is a sequence, then it will have the SEQUENCE\nset to 1.\n \nSTATS_AUTO_RECALC\n \nSTATS_AUTO_RECALC is available only in MariaDB 10.0+. It\nindicates whether to automatically recalculate persistent\nstatistics (see STATS_PERSISTENT, below) for an InnoDB\ntable.\nIf set to 1, statistics will be recalculated when more than\n10% of the data has changed. When set to 0, stats will be\nrecalculated only when an ANALYZE TABLE is run. If set to\nDEFAULT, or left out, the value set by the\ninnodb_stats_auto_recalc system variable applies. See InnoDB\nPersistent Statistics.\n \nSTATS_PERSISTENT\n \nSTATS_PERSISTENT is available only in MariaDB 10.0+. It\nindicates whether the InnoDB statistics created by ANALYZE\nTABLE will remain on disk or not. It can be set to 1 (on\ndisk), 0 (not on disk, the pre-MariaDB 10 behavior), or\nDEFAULT (the same as leaving out the option), in which case\nthe value set by the innodb_stats_persistent system variable\nwill apply. Persistent statistics stored on disk allow the\nstatistics to survive server restarts, and provide better\nquery plan stability. See InnoDB Persistent Statistics.\n \nSTATS_SAMPLE_PAGES\n \nSTATS_SAMPLE_PAGES is available only in MariaDB 10.0+. It\nindicates how many pages are used to sample index\nstatistics. If 0 or DEFAULT, the default value, the\ninnodb_stats_sample_pages value is used. See InnoDB\nPersistent Statistics.\n \nTRANSACTIONAL\n \nTRANSACTIONAL is only applicable for Aria tables. In future\nAria tables created with this option will be fully\ntransactional, but currently this provides a form of crash\nprotection. See Aria Storage Engine for more details.\n \nUNION\n \nUNION must be specified when you create a MERGE table. This\noption contains a comma-separated list of MyISAM tables\nwhich are accessed by the new table. The list is enclosed\nbetween parenthesis. Example: UNION = (t1,t2)\n \nWITH SYSTEM VERSIONING\n \nWITH SYSTEM VERSIONING is used for creating System-versioned\ntables.\n \nPartitions\n \npartition_options:\n PARTITION BY\n { [LINEAR] HASH(expr)\n | [LINEAR] KEY(column_list)\n | RANGE(expr)\n | LIST(expr)\n | SYSTEM_TIME [INTERVAL time_quantity time_unit] [LIMIT\nnum] }\n [PARTITIONS num]\n [SUBPARTITION BY\n { [LINEAR] HASH(expr)\n | [LINEAR] KEY(column_list) }\n [SUBPARTITIONS num]\n ]\n [(partition_definition [, partition_definition] ...)]\n \npartition_definition:\n PARTITION partition_name\n [VALUES {LESS THAN {(expr) | MAXVALUE} | IN (value_list)}]\n [[STORAGE] ENGINE [=] engine_name]\n [COMMENT [=] \'comment_text\' ]\n [DATA DIRECTORY [=] \'data_dir\']\n [INDEX DIRECTORY [=] \'index_dir\']\n [MAX_ROWS [=] max_number_of_rows]\n [MIN_ROWS [=] min_number_of_rows]\n [TABLESPACE [=] tablespace_name]\n [NODEGROUP [=] node_group_id]\n [(subpartition_definition [, subpartition_definition] ...)]\n \nsubpartition_definition:\n SUBPARTITION logical_name\n [[STORAGE] ENGINE [=] engine_name]\n [COMMENT [=] \'comment_text\' ]\n [DATA DIRECTORY [=] \'data_dir\']\n [INDEX DIRECTORY [=] \'index_dir\']\n [MAX_ROWS [=] max_number_of_rows]\n [MIN_ROWS [=] min_number_of_rows]\n [TABLESPACE [=] tablespace_name]\n [NODEGROUP [=] node_group_id]\nIf the PARTITION BY clause is used, the table will be\npartitioned. A partition method must be explicitly indicated\nfor partitions and subpartitions. Partition methods are:\n[LINEAR] HASH creates a hash key which will be used to read\nand write rows. The partition function can be any valid SQL\nexpression which returns an INTEGER number. Thus, it is\npossible to use the HASH method on an integer column, or on\nfunctions which accept integer columns as an argument.\nHowever, VALUES LESS THAN and VALUES IN clauses can not be\nused with HASH. An example:\n \nCREATE TABLE t1 (a INT, b CHAR(5), c DATETIME)\n PARTITION BY HASH ( YEAR(c) );\n \n [LINEAR] HASH can be used for subpartitions, too.\n[LINEAR] KEY is similar to HASH, but the index has an even\ndistribution of data. Also, the expression can only be a\ncolumn or a list of columns. VALUES LESS THAN and VALUES IN\nclauses can not be used with KEY.\nRANGE partitions the rows using on a range of values, using\nthe VALUES LESS THAN operator. VALUES IN is not allowed with\nRANGE. The partition function can be any valid SQL\nexpression which returns a single value.\nLIST assignes partitions based on a table\'s column with a\nrestricted set of possible values. It is similar to RANGE,\nbut VALUES IN must be used for at least 1 columns, and\nVALUES LESS THAN is disallowed.\nSYSTEM_TIME partitioning is used for System-versioned tables\nto store historical data separately from current data.\n \nOnly HASH and KEY can be used for subpartitions, and they\ncan be [LINEAR].\n \nIt is possible to define up to 1024 partitions and\nsubpartitions.\n \nThe number of defined partitions can be optionally specified\nas PARTITION count. This can be done to avoid specifying all\npartitions individually. But you can also declare each\nindividual partition and, additionally, specify a PARTITIONS\ncount clause; in the case, the number of PARTITIONs must\nequal count.\n \nAlso see Partitioning Types Overview.\n \nSequences\n \nCREATE TABLE can also be used to create a SEQUENCE. See\nCREATE SEQUENCE and Sequence Overview.\n \nExamples\n-------- \ncreate table if not exists test (\na bigint auto_increment primary key,\nname varchar(128) charset utf8,\nkey name (name(32))\n) engine=InnoDB default charset latin1;\n \nThis example shows a couple of things:\nUsage of IF NOT EXISTS; If the table already existed, it\nwill not be created. There will not be any error for the\nclient, just a warning.\nHow to create a PRIMARY KEY that is automatically generated.\nHow to specify a table-specific character set and another\nfor a column.\nHow to create an index (name) that is only partly indexed\n(to save space).\n \nThe following clauses will work from MariaDB 10.2.1 only.\n \nCREATE TABLE t1(\n a int DEFAULT (1+1),\n b int DEFAULT (a+1),\n expires DATETIME DEFAULT(NOW() + INTERVAL 1 YEAR),\n x BLOB DEFAULT USER()\n);\n \n\n\nURL: https://mariadb.com/kb/en/library/create-table/') WHERE help_topic_id = 660;
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (661,39,'CREATE TABLESPACE','The CREATE TABLESPACE statement is not supported by MariaDB.\nIt was originally inherited from MySQL NDB Cluster. In MySQL\n5.7 and later, the statement is also supported for InnoDB.\nHowever, MariaDB has chosen not to include that specific\nfeature. See MDEV-19294 for more information.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/create-tablespace/','','https://mariadb.com/kb/en/library/create-tablespace/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (662,39,'CREATE TRIGGER','Syntax\n------ \nCREATE [OR REPLACE]\n [DEFINER = { user | CURRENT_USER | role | CURRENT_ROLE }]\n TRIGGER [IF NOT EXISTS] trigger_name trigger_time\ntrigger_event\n ON tbl_name FOR EACH ROW\n [{ FOLLOWS | PRECEDES } other_trigger_name ]\n trigger_stmt\n \nDescription\n----------- \nThis statement creates a new trigger. A trigger is a named\ndatabase\nobject that is associated with a table, and that activates\nwhen a\nparticular event occurs for the table. The trigger becomes\nassociated\nwith the table named tbl_name, which must refer to a\npermanent table.\nYou cannot associate a trigger with a TEMPORARY table or a\nview.\n \nCREATE TRIGGER requires the TRIGGER privilege for the table\nassociated\nwith the trigger. (Before MySQL 5.1.6, this statement\nrequires the\nSUPER privilege.)\n \nYou can have multiple triggers for the same trigger_time and\ntrigger_event.\n \nFor valid identifiers to use as trigger names, see\nIdentifier Names.\n \nOR REPLACE\n \nIf used and the trigger already exists, instead of an error\nbeing returned, the existing trigger will be dropped and\nreplaced by the newly defined trigger.\n \nDEFINER\n \nThe DEFINER clause determines the security context to be\nused when\nchecking access privileges at trigger activation time.\n \nIF NOT EXISTS\n \nIf the IF NOT EXISTS clause is used, the trigger will only\nbe created if a trigger of the same name does not exist. If\nthe trigger already exists, by default a warning will be\nreturned.\n \ntrigger_time\n \ntrigger_time is the trigger action time. It can be BEFORE or\nAFTER to\nindicate that the trigger activates before or after each row\nto be\nmodified.\n \ntrigger_event\n \ntrigger_event indicates the kind of statement that activates\nthe\ntrigger. The trigger_event can be one of the following:\nINSERT: The trigger is activated whenever a new row is\ninserted into the table; for example, through INSERT, LOAD\nDATA, and REPLACE statements.\nUPDATE: The trigger is activated whenever a row is modified;\nfor example, through UPDATE statements.\nDELETE: The trigger is activated whenever a row is deleted\nfrom the table; for example, through DELETE and REPLACE\nstatements. However, DROP TABLE and TRUNCATE statements on\nthe table do not activate this trigger, because they do not\nuse DELETE. Dropping a partition does not activate DELETE\ntriggers, either.\n \nFOLLOWS/PRECEDES other_trigger_name\n \nThe FOLLOWS other_trigger_name and PRECEDES\nother_trigger_name options were added in MariaDB 10.2.3 as\npart of supporting multiple triggers per action time.\nThis is the same syntax used by MySQL 5.7, although MySQL\n5.7 does not have multi-trigger support.\n \nFOLLOWS adds the new trigger after another trigger while\nPRECEDES adds the new trigger before another trigger. If\nneither option is used, the new trigger is added last for\nthe given action and time.\n \nFOLLOWS and PRECEDES are not stored in the trigger\ndefinition. However the trigger order is guaranteed to not\nchange over time. mysqldump and other backup methods will\nnot change trigger order.\nYou can verify the trigger order from the ACTION_ORDER\ncolumn in INFORMATION_SCHEMA.TRIGGERS table.\n \nSELECT trigger_name, action_order FROM\ninformation_schema.triggers \n WHERE event_object_table=\'t1\';\n \nExamples\n-------- \nCREATE DEFINER=`root`@`localhost` TRIGGER increment_animal\n AFTER INSERT ON animals FOR EACH ROW \n UPDATE animal_count SET animal_count.animals =\nanimal_count.animals+1;\n \nOR REPLACE and IF NOT EXISTS\n \nCREATE DEFINER=`root`@`localhost` TRIGGER increment_animal\n AFTER INSERT ON animals FOR EACH ROW\n UPDATE animal_count SET animal_count.animals =\nanimal_count.animals+1;\n \nERROR 1359 (HY000): Trigger already exists\n \nCREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER\nincrement_animal\n AFTER INSERT ON animals FOR EACH ROW\n UPDATE animal_count SET animal_count.animals =\nanimal_count.animals+1;\n \nQuery OK, 0 rows affected (0.12 sec)\n \nCREATE DEFINER=`root`@`localhost` TRIGGER IF NOT EXISTS\nincrement_animal\n AFTER INSERT ON animals FOR EACH ROW\n UPDATE animal_count SET animal_count.animals =\nanimal_count.animals+1;\n \nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+-------+------+------------------------+\n| Level | Code | Message |\n+-------+------+------------------------+\n| Note | 1359 | Trigger already exists |\n+-------+------+------------------------+\n1 row in set (0.00 sec)\n \n\n\nURL: https://mariadb.com/kb/en/library/create-trigger/','','https://mariadb.com/kb/en/library/create-trigger/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (663,39,'CREATE VIEW','Syntax\n------ \nCREATE\n [OR REPLACE]\n [ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}]\n [DEFINER = { user | CURRENT_USER | role | CURRENT_ROLE }]\n [SQL SECURITY { DEFINER | INVOKER }]\n VIEW [IF NOT EXISTS] view_name [(column_list)]\n AS select_statement\n [WITH [CASCADED | LOCAL] CHECK OPTION]\n \nDescription\n----------- \nThe CREATE VIEW statement creates a new view, or replaces an\nexisting\none if the OR REPLACE clause is given. If the view does not\nexist, CREATE OR\nREPLACE VIEW is the same as CREATE VIEW. If the view does\nexist, CREATE OR\nREPLACE VIEW is the same as ALTER VIEW.\n \nThe select_statement is a SELECT statement that provides the\ndefinition of\nthe view. (When you select from the view, you select in\neffect using the SELECT\nstatement.) select_statement can select from base tables or\nother views.\n \nThe view definition is \"frozen\" at creation time, so\nchanges to the underlying\ntables afterwards do not affect the view definition. For\nexample, if a view is\ndefined as SELECT * on a table, new columns added to the\ntable later do not\nbecome part of the view. A SHOW CREATE VIEW shows that\nsuch queries are rewritten and column names are included in\nthe view\ndefinition.\n \nThe view definition must be a query that does not return\nerrors at view\ncreation times. However, the base tables used by the views\nmight be altered\nlater and the query may not be valid anymore. In this case,\nquerying the view\nwill result in an error. CHECK TABLE helps in finding this\nkind\nof problems.\n \nThe ALGORITHM clause affects how MariaDB processes the\nview. The DEFINER and SQL SECURITY clauses specify the\nsecurity context to be\nused when checking access privileges at view invocation\ntime. The WITH CHECK\nOPTION clause can be given to constrain inserts or updates\nto rows in tables\nreferenced by the view. These clauses are described later in\nthis section.\n \nThe CREATE VIEW statement requires the CREATE VIEW privilege\nfor the\nview, and some privilege for each column selected by the\nSELECT\nstatement. For columns used elsewhere in the SELECT\nstatement you must\nhave the SELECT privilege. If the OR REPLACE clause is\npresent, you\nmust also have the DROP privilege for the view.\n \nA view belongs to a database. By default, a new view is\ncreated in the\ndefault database. To create the view explicitly in a given\ndatabase,\nspecify the name as db_name.view_name when you create it.\n \nCREATE VIEW test.v AS SELECT * FROM t;\n \nBase tables and views share the same namespace within a\ndatabase, so a\ndatabase cannot contain a base table and a view that have\nthe same\nname.\n \nViews must have unique column names with no duplicates, just\nlike base\ntables. By default, the names of the columns retrieved by\nthe SELECT\nstatement are used for the view column names. To define\nexplicit names\nfor the view columns, the optional column_list clause can be\ngiven as\na list of comma-separated identifiers. The number of names\nin\ncolumn_list must be the same as the number of columns\nretrieved by the\nSELECT statement.\n \nMySQL until 5.1.28\n \nPrior to MySQL 5.1.29, When you modify an existing view, the\ncurrent view definition is backed up and saved. It is stored\nin that\ntable\'s database directory, in a subdirectory named arc.\nThe backup\nfile for a view v is named v.frm-00001. If you alter the\nview again,\nthe next backup is named v.frm-00002. The three latest view\nbackup\ndefinitions are stored. Backed up view definitions are not\npreserved\nby mysqldump, or any other such programs, but you can retain\nthem\nusing a file copy operation. However, they are not needed\nfor anything\nbut to provide you with a backup of your previous view\ndefinition. It\nis safe to remove these backup definitions, but only while\nmysqld is\nnot running. If you delete the arc subdirectory or its files\nwhile\nmysqld is running, you will receive an error the next time\nyou try to\nalter the view: \n \nMariaDB [test]> ALTER VIEW v AS SELECT * FROM t; \nERROR 6 (HY000): Error on delete of\n\'.\\test\\arc/v.frm-0004\' (Errcode: 2)\n \nColumns retrieved by the SELECT statement can be simple\nreferences to\ntable columns. They can also be expressions that use\nfunctions,\nconstant values, operators, and so forth.\n \nUnqualified table or view names in the SELECT statement are\ninterpreted with respect to the default database. A view can\nrefer to\ntables or views in other databases by qualifying the table\nor view\nname with the proper database name.\n \nA view can be created from many kinds of SELECT statements.\nIt can\nrefer to base tables or other views. It can use joins,\nUNION, and\nsubqueries. The SELECT need not even refer to any tables.\nThe\nfollowing example defines a view that selects two columns\nfrom another\ntable, as well as an expression calculated from those\ncolumns:\n \nCREATE TABLE t (qty INT, price INT);\n \nINSERT INTO t VALUES(3, 50);\n \nCREATE VIEW v AS SELECT qty, price, qty*price AS value FROM\nt;\n \nSELECT * FROM v;\n+------+-------+-------+\n| qty | price | value |\n+------+-------+-------+\n| 3 | 50 | 150 |\n+------+-------+-------+\n \nA view definition is subject to the following restrictions:\nThe SELECT statement cannot contain a subquery in the FROM\nclause.\nThe SELECT statement cannot refer to system or user\nvariables.\nWithin a stored program, the definition cannot refer to\nprogram parameters or local variables.\nThe SELECT statement cannot refer to prepared statement\nparameters.\nAny table or view referred to in the definition must exist.\nHowever, after a view has been created, it is possible to\ndrop a table or view that the definition refers to. In this\ncase, use of the view results in an error. To check a view\ndefinition for problems of this kind, use the CHECK TABLE\nstatement.\nThe definition cannot refer to a TEMPORARY table, and you\ncannot create a TEMPORARY view.\nAny tables named in the view definition must exist at\ndefinition time.\nYou cannot associate a trigger with a view.\nFor valid identifiers to use as view names, see Identifier\nNames.\n \nORDER BY is allowed in a view definition, but it is ignored\nif you\nselect from a view using a statement that has its own ORDER\nBY.\n \nFor other options or clauses in the definition, they are\nadded to the\noptions or clauses of the statement that references the\nview, but the\neffect is undefined. For example, if a view definition\nincludes a\nLIMIT clause, and you select from the view using a statement\nthat has\nits own LIMIT clause, it is undefined which limit applies.\nThis same\nprinciple applies to options such as ALL, DISTINCT, or\nSQL_SMALL_RESULT that follow the SELECT keyword, and to\nclauses such\nas INTO, FOR UPDATE, and LOCK IN SHARE MODE.\n \nThe PROCEDURE clause cannot be used in a view definition,\nand it cannot be used if a view is referenced in the FROM\nclause.\n \nIf you create a view and then change the query processing\nenvironment\nby changing system variables, that may affect the results\nthat you get\nfrom the view:\n \nCREATE VIEW v (mycol) AS SELECT \'abc\';\n \nSET sql_mode = \'\';\n \nSELECT \"mycol\" FROM v;\n+-------+\n| mycol |\n+-------+\n| mycol | \n+-------+\n \nSET sql_mode = \'ANSI_QUOTES\';\n \nSELECT \"mycol\" FROM v;\n+-------+\n| mycol |\n+-------+\n| abc | \n+-------+\n \nThe DEFINER and SQL SECURITY clauses determine which MariaDB\naccount to\nuse when checking access privileges for the view when a\nstatement is\nexecuted that references the view. They were added in MySQL\n5.1.2.\nThe legal SQL SECURITY characteristic values are DEFINER and\nINVOKER.\nThese indicate that the required privileges must be held by\nthe user\nwho defined or invoked the view, respectively. The default\nSQL\nSECURITY value is DEFINER.\n \nIf a user value is given for the DEFINER clause, it should\nbe a MariaDB\naccount in \'user_name\'@\'host_name\' format (the same\nformat used in the\nGRANT statement). The user_name and host_name values both\nare\nrequired. The definer can also be given as CURRENT_USER or\nCURRENT_USER(). The default DEFINER value is the user who\nexecutes the\nCREATE VIEW statement. This is the same as specifying\nDEFINER =\nCURRENT_USER explicitly.\n \nIf you specify the DEFINER clause, these rules determine the\nlegal\nDEFINER user values:\nIf you do not have the SUPER privilege, the only legal user\nvalue is your own account, either specified literally or by\nusing CURRENT_USER. You cannot set the definer to some other\naccount.\nIf you have the SUPER privilege, you can specify any\nsyntactically legal account name. If the account does not\nactually exist, a warning is generated.\nIf the SQL SECURITY value is DEFINER but the definer account\ndoes not exist when the view is referenced, an error occurs.\n \nWithin a view definition, CURRENT_USER returns the view\'s\nDEFINER\nvalue by default. Before MySQL 5.1.12, and for views\ndefined with the SQL SECURITY INVOKER characteristic,\nCURRENT_USER\nreturns the account for the view\'s invoker. For information\nabout user\nauditing within views, see\nhttp://dev.mysql.com/doc/refman/5.1/en/account-activity-auditing.html.\n \nWithin a stored routine that is defined with the SQL\nSECURITY DEFINER\ncharacteristic, CURRENT_USER returns the routine\'s DEFINER\nvalue. This\nalso affects a view defined within such a program, if the\nview\ndefinition contains a DEFINER value of CURRENT_USER.\n \nView privileges are checked like this:\nAt view definition time, the view creator must have the\nprivileges needed to use the top-level objects accessed by\nthe view. For example, if the view definition refers to\ntable columns, the creator must have privileges for the\ncolumns, as described previously. If the definition refers\nto a stored function, only the privileges needed to invoke\nthe function can be checked. The privileges required when\nthe function runs can be checked only as it executes: For\ndifferent invocations of the function, different execution\npaths within the function might be taken.\nWhen a view is referenced, privileges for objects accessed\nby the view are checked against the privileges held by the\nview creator or invoker, depending on whether the SQL\nSECURITY characteristic is DEFINER or INVOKER, respectively.\nIf reference to a view causes execution of a stored\nfunction, privilege checking for statements executed within\nthe function depend on whether the function is defined with\na SQL SECURITY characteristic of DEFINER or INVOKER. If the\nsecurity characteristic is DEFINER, the function runs with\nthe privileges of its creator. If the characteristic is\nINVOKER, the function runs with the privileges determined by\nthe view\'s SQL SECURITY characteristic.\n \nMySQL until 5.1.1\n \nPrior to MySQL 5.1.2 (before the DEFINER and SQL SECURITY\nclauses were\nimplemented), privileges required for objects used in a view\nare\nchecked at view creation time.\n \nExample: A view might depend on a stored function, and that\nfunction\nmight invoke other stored routines. For example, the\nfollowing 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()\nneed to be\nchecked when f() executes. This might mean that privileges\nare needed\nfor p1() or p2(), depending on the execution path within\nf(). Those\nprivileges must be checked at runtime, and the user who must\npossess\nthe privileges is determined by the SQL SECURITY values of\nthe view v\nand the function f().\n \nThe DEFINER and SQL SECURITY clauses for views are\nextensions to\nstandard SQL. In standard SQL, views are handled using the\nrules for\nSQL SECURITY INVOKER.\n \nIf you invoke a view that was created before MySQL 5.1.2, it\nis\ntreated as though it was created with a SQL SECURITY DEFINER\nclause\nand with a DEFINER value that is the same as your account.\nHowever,\nbecause the actual definer is unknown, MySQL issues a\nwarning. To make\nthe warning go away, it is sufficient to re-create the view\nso that\nthe view definition includes a DEFINER clause.\n \nThe optional ALGORITHM clause is an extension to standard\nSQL. It\naffects how MariaDB processes the view. ALGORITHM takes\nthree values:\nMERGE, TEMPTABLE, or UNDEFINED. The default algorithm is\nUNDEFINED if\nno ALGORITHM clause is present. See View Algorithms for more\ninformation.\n \nSome views are updatable. That is, you can use them in\nstatements such\nas UPDATE, DELETE, or INSERT to update the contents of the\nunderlying\ntable. For a view to be updatable, there must be a\none-to-one\nrelationship between the rows in the view and the rows in\nthe\nunderlying table. There are also certain other constructs\nthat make a\nview non-updatable. See Inserting and Updating with Views.\n \nWITH CHECK OPTION\n \nThe WITH CHECK OPTION clause can be given for an updatable\nview to\nprevent inserts or updates to rows except those for which\nthe WHERE\nclause in the select_statement is true.\n \nIn a WITH CHECK OPTION clause for an updatable view, the\nLOCAL and\nCASCADED keywords determine the scope of check testing when\nthe view\nis defined in terms of another view. The LOCAL keyword\nrestricts the\nCHECK OPTION only to the view being defined. CASCADED causes\nthe\nchecks for underlying views to be evaluated as well. When\nneither\nkeyword is given, the default is CASCADED.\n \nFor more information about updatable views and the WITH\nCHECK OPTION\nclause, see\nInserting and Updating with Views.\n \nIF NOT EXISTS\n \nThe IF NOT EXISTS clause was added in MariaDB 10.1.3\n \nWhen the IF NOT EXISTS clause is used, MariaDB will return a\nwarning instead of an error if the specified view already\nexists. Cannot be used together with the OR REPLACE clause.\n \nExamples\n-------- \nCREATE TABLE t (a INT, b INT) ENGINE = InnoDB;\n \nINSERT INTO t VALUES (1,1), (2,2), (3,3);\n \nCREATE VIEW v AS SELECT a, a*2 AS a2 FROM t;\n \nSELECT * FROM v;\n \n+------+------+\n| a | a2 |\n+------+------+\n| 1 | 2 |\n| 2 | 4 |\n| 3 | 6 |\n+------+------+\n \nOR REPLACE and IF NOT EXISTS:\n \nCREATE VIEW v AS SELECT a, a*2 AS a2 FROM t;\n \nERROR 1050 (42S01): Table \'v\' already exists\n \nCREATE OR REPLACE VIEW v AS SELECT a, a*2 AS a2 FROM t;\n \nQuery OK, 0 rows affected (0.04 sec)\n \nCREATE VIEW IF NOT EXISTS v AS SELECT a, a*2 AS a2 FROM t;\n \nQuery OK, 0 rows affected, 1 warning (0.01 sec)\n \nSHOW WARNINGS;\n \n+-------+------+--------------------------+\n| Level | Code | Message |\n+-------+------+--------------------------+\n| Note | 1050 | Table \'v\' already exists |\n+-------+------+--------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/create-view/','','https://mariadb.com/kb/en/library/create-view/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (664,39,'DROP DATABASE','Syntax\n------ \nDROP {DATABASE | SCHEMA} [IF EXISTS] db_name\n \nDescription\n----------- \nDROP DATABASE drops all tables in the database and deletes\nthe database. Be very careful with this statement! To use\nDROP DATABASE,\nyou need the DROP privilege on the database. DROP SCHEMA is\na synonym for DROP DATABASE.\n \nImportant: When a database is dropped, user privileges on\nthe database are not automatically dropped. See GRANT.\n \nIF EXISTS\n \nUse IF EXISTS to prevent an error from occurring for\ndatabases that do not exist. A NOTE is generated for each\nnon-existent database when using IF EXISTS. See SHOW\nWARNINGS.\n \nExamples\n-------- \nDROP DATABASE bufg;\n \nQuery OK, 0 rows affected (0.39 sec)\n \nDROP DATABASE bufg;\n \nERROR 1008 (HY000): Can\'t drop database \'bufg\'; database\ndoesn\'t exist\n \n \\W\nShow warnings enabled.\n \nDROP DATABASE IF EXISTS bufg;\n \nQuery OK, 0 rows affected, 1 warning (0.00 sec)\nNote (Code 1008): Can\'t drop database \'bufg\'; database\ndoesn\'t exist\n \n\n\nURL: https://mariadb.com/kb/en/library/drop-database/','','https://mariadb.com/kb/en/library/drop-database/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (665,39,'DROP EVENT','Syntax\n------ \nDROP EVENT [IF EXISTS] event_name\n \nDescription\n----------- \nThis statement drops the event named event_name. The event\nimmediately\nceases being active, and is deleted completely from the\nserver.\n \nIf the event does not exist, the error\nERROR 1517 (HY000): Unknown event \'event_name\'\nresults. You can override this and cause the\nstatement to generate a NOTE for non-existent events instead\nby using\nIF EXISTS. See SHOW WARNINGS.\n \nThis statement requires the EVENT privilege. In MySQL 5.1.11\nand earlier, an event could be dropped only\nby its definer, or by a user having the SUPER privilege.\n \nExamples\n-------- \nDROP EVENT myevent3;\n \nUsing the IF EXISTS clause:\n \nDROP EVENT IF EXISTS myevent3;\n \nQuery OK, 0 rows affected, 1 warning (0.01 sec)\n \nSHOW WARNINGS;\n \n+-------+------+-------------------------------+\n| Level | Code | Message |\n+-------+------+-------------------------------+\n| Note | 1305 | Event myevent3 does not exist |\n+-------+------+-------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/drop-event/','','https://mariadb.com/kb/en/library/drop-event/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (666,39,'DROP FUNCTION','Syntax\n------ \nDROP FUNCTION [IF EXISTS] f_name\n \nDescription\n----------- \nThe DROP FUNCTION statement is used to drop a stored\nfunction or a user-defined function (UDF). That is, the\nspecified routine is removed from the server, along with all\nprivileges specific to the function. You must have the ALTER\nROUTINE privilege for the routine in order to drop it. If\nthe automatic_sp_privileges server system variable is set,\nboth the ALTER ROUTINE and EXECUTE privileges are granted\nautomatically to the routine creator - see Stored Routine\nPrivileges.\n \nIF EXISTS\n \nThe IF EXISTS clause is a MySQL/MariaDB extension. It\nprevents an error from occurring if the function does not\nexist. A\nNOTE is produced that can be viewed with SHOW WARNINGS.\n \nFor dropping a user-defined functions (UDF), see DROP\nFUNCTION UDF.\n \nExamples\n-------- \nDROP FUNCTION hello;\n \nQuery OK, 0 rows affected (0.042 sec)\n \nDROP FUNCTION hello;\n \nERROR 1305 (42000): FUNCTION test.hello does not exist\n \nDROP FUNCTION IF EXISTS hello;\n \nQuery OK, 0 rows affected, 1 warning (0.000 sec)\n \nSHOW WARNINGS;\n \n+-------+------+------------------------------------+\n| Level | Code | Message |\n+-------+------+------------------------------------+\n| Note | 1305 | FUNCTION test.hello does not exist |\n+-------+------+------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/drop-function/','','https://mariadb.com/kb/en/library/drop-function/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (667,39,'DROP INDEX','Syntax\n------ \nDROP INDEX [IF EXISTS] index_name ON tbl_name \n [WAIT n |NOWAIT]\n [algorithm_option | lock_option] ...\n \nalgorithm_option:\n ALGORITHM [=] {DEFAULT|INPLACE|COPY|NOCOPY|INSTANT}\n \nlock_option:\n LOCK [=] {DEFAULT|NONE|SHARED|EXCLUSIVE}\n \nDescription\n----------- \nDROP INDEX drops the index named index_name from the table\ntbl_name.\nThis statement is mapped to an ALTER TABLE statement to drop\nthe\nindex.\n \nIf another connection is using the table, a metadata lock is\nactive, and this statement will wait until the lock is\nreleased. This is also true for non-transactional tables.\n \nSee ALTER TABLE.\n \nAnother shortcut, CREATE INDEX, allows the creation of an\nindex.\n \nTo remove the primary key, `PRIMARY` must be specified as\nindex_name. Note that the quotes are necessary, because\nPRIMARY is a keyword.\n \nPrivileges\n \nExecuting the DROP INDEX statement requires the INDEX\nprivilege for the table or the database.\n \nOnline DDL\n \nIn MariaDB 10.0 and later, online DDL is supported with the\nALGORITHM and LOCK clauses.\n \nSee InnoDB Online DDL Overview for more information on\nonline DDL with InnoDB.\n \nDROP INDEX IF EXISTS ...\n \nThe IF EXISTS clause was added in MariaDB 10.1.4.\n \nIf the IF EXISTS clause is used, then MariaDB will return a\nwarning instead of an error if the index does not exist.\n \nWAIT/NOWAIT\n \nSet the lock wait timeout. See WAIT and NOWAIT.\n \nALGORITHM\n \nSee ALTER TABLE: ALGORITHM for more information.\n \nLOCK\n \nSee ALTER TABLE: LOCK for more information.\n \nProgress Reporting\n \nMariaDB provides progress reporting for DROP INDEX statement\nfor clients\nthat support the new progress reporting protocol. For\nexample, if you were using the mysql client, then the\nprogress report might look like this::\n \n\n\nURL: https://mariadb.com/kb/en/library/drop-index/','','https://mariadb.com/kb/en/library/drop-index/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (668,39,'DROP PACKAGE','Oracle-style packages were introduced in MariaDB 10.3.5.\n \nSyntax\n------ \nDROP PACKAGE [IF EXISTS] [ db_name . ] package_name\n \nDescription\n----------- \nThe DROP PACKAGE statement can be used when Oracle SQL_MODE\nis set.\n \nThe DROP PACKAGE statement drops a stored package entirely:\nDrops the package specification (earlier created using the\nCREATE PACKAGE statement).\nDrops the package implementation, if the implementation was\nalready created using the CREATE PACKAGE BODY statement.\n \n\n\nURL: https://mariadb.com/kb/en/library/drop-package/','','https://mariadb.com/kb/en/library/drop-package/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (669,39,'DROP PACKAGE BODY','Oracle-style packages were introduced in MariaDB 10.3.5.\n \nSyntax\n------ \nDROP PACKAGE BODY [IF EXISTS] [ db_name . ] package_name\n \nDescription\n----------- \nThe DROP PACKAGE BODY statement can be used when Oracle\nSQL_MODE is set.\n \nThe DROP PACKAGE BODY statement drops the package body (i.e\nthe implementation), previously created using the CREATE\nPACKAGE BODY statement.\n \nNote, DROP PACKAGE BODY drops only the package\nimplementation, but does not drop the package specification.\nUse DROP PACKAGE to drop the package entirely (i.e. both\nimplementation and specification).\n \n\n\nURL: https://mariadb.com/kb/en/library/drop-package-body/','','https://mariadb.com/kb/en/library/drop-package-body/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (670,39,'DROP PROCEDURE','Syntax\n------ \nDROP PROCEDURE [IF EXISTS] sp_name\n \nDescription\n----------- \nThis statement is used to drop a stored procedure. That is,\nthe\nspecified routine is removed from the server along with all\nprivileges specific to the procedure. You must have the\nALTER ROUTINE privilege for the routine. If the\nautomatic_sp_privileges server system variable is set, that\nprivilege and EXECUTE are granted automatically to the\nroutine creator - see Stored Routine Privileges.\n \nThe IF EXISTS clause is a MySQL/MariaDB extension. It\nprevents an error from occurring if the procedure or\nfunction does not exist. A\nNOTE is produced that can be viewed with SHOW WARNINGS.\n \nWhile this statement takes effect immediately, threads which\nare executing a procedure can continue execution.\n \nExamples\n-------- \nDROP PROCEDURE simpleproc;\n \nIF EXISTS:\n \nDROP PROCEDURE simpleproc;\n \nERROR 1305 (42000): PROCEDURE test.simpleproc does not exist\n \nDROP PROCEDURE IF EXISTS simpleproc;\n \nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+-------+------+------------------------------------------+\n| Level | Code | Message |\n+-------+------+------------------------------------------+\n| Note | 1305 | PROCEDURE test.simpleproc does not exist |\n+-------+------+------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/drop-procedure/','','https://mariadb.com/kb/en/library/drop-procedure/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (671,39,'DROP SEQUENCE','DROP SEQUENCE was introduced in MariaDB 10.3.\n \nSyntax\n------ \nDROP [TEMPORARY] SEQUENCE [IF EXISTS] [/*COMMENT TO SAVE*/]\n sequence_name [, sequence_name] ...\n \nDescription\n----------- \nDROP SEQUENCE removes one or more sequences created with\nCREATE SEQUENCE. You must have the DROP privilege for each\nsequence. MariaDB returns an error indicating by name which\nnon-existing tables it was unable to drop, but it also drops\nall of the tables in the list that do exist.\n \nImportant: When a table is dropped, user privileges on the\ntable are not automatically dropped. See GRANT.\n \nIf another connection is using the sequence, a metadata lock\nis active, and this statement will wait until the lock is\nreleased. This is also true for non-transactional tables.\n \nFor each referenced sequence, DROP SEQUENCE drops a\ntemporary sequence with that name, if it exists. If it does\nnot exist, and the TEMPORARY keyword is not used, it drops a\nnon-temporary sequence with the same name, if it exists. The\nTEMPORARY keyword ensures that a non-temporary sequence will\nnot accidentally be dropped.\n \nUse IF EXISTS to prevent an error from occurring for\nsequences that do not exist. A NOTE is generated for each\nnon-existent sequence when using IF EXISTS. See SHOW\nWARNINGS.\n \nDROP SEQUENCE requires the DROP privilege.\n \nNotes\n \nDROP SEQUENCE only removes sequences, not tables. However,\nDROP TABLE can remove both sequences and tables.\n \n\n\nURL: https://mariadb.com/kb/en/library/drop-sequence/','','https://mariadb.com/kb/en/library/drop-sequence/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (672,39,'DROP SERVER','Syntax\n------ \nDROP SERVER [ IF EXISTS ] server_name\n \nDescription\n----------- \nDrops the server definition for the server named\nserver_name. The\ncorresponding row within the mysql.servers table will be\ndeleted. This\nstatement requires the SUPER privilege. \n \nDropping a server for a table does not affect any\nFederatedX, FEDERATED or Spider tables that used this\nconnection information when they were created. \n \nIF EXISTS\n \nIf the IF EXISTS clause is used, MariaDB will not return an\nerror if the server does not exist. Unlike all other\nstatements, DROP SERVER IF EXISTS does not issue a note if\nthe server does not exist. See MDEV-9400.\n \nExamples\n-------- \nDROP SERVER s;\n \nIF EXISTS:\n \nDROP SERVER s;\n \nERROR 1477 (HY000): The foreign server name you are trying\nto reference \n does not exist. Data source error: s\n \nDROP SERVER IF EXISTS s;\n \nQuery OK, 0 rows affected (0.00 sec)\n \n\n\nURL: https://mariadb.com/kb/en/library/drop-server/','','https://mariadb.com/kb/en/library/drop-server/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (673,39,'DROP TABLE','Syntax\n------ \nDROP [TEMPORARY] TABLE [IF EXISTS] [/*COMMENT TO SAVE*/]\n tbl_name [, tbl_name] ...\n [WAIT n|NOWAIT]\n [RESTRICT | CASCADE]\n \nDescription\n----------- \nDROP TABLE removes one or more tables. You must have the\nDROP privilege\nfor each table. All table data and the table definition are\nremoved, as well as triggers associated to the table, so be\ncareful with this statement! If any of the tables named in\nthe argument list do\nnot exist, MariaDB returns an error indicating by name which\nnon-existing tables\nit was unable to drop, but it also drops all of the tables\nin the list that do\nexist.\n \nImportant: When a table is dropped, user privileges on the\ntable are not\nautomatically dropped. See GRANT.\n \nIf another connection is using the table, a metadata lock is\nactive, and this statement will wait until the lock is\nreleased. This is also true for non-transactional tables.\n \nNote that for a partitioned table, DROP TABLE permanently\nremoves the table\ndefinition, all of its partitions, and all of the data which\nwas stored in\nthose partitions. It also removes the partitioning\ndefinition (.par) file\nassociated with the dropped table.\n \nFor each referenced table, DROP TABLE drops a temporary\ntable with that name, if it exists. If it does not exist,\nand the TEMPORARY keyword is not used, it drops a\nnon-temporary table with the same name, if it exists. The\nTEMPORARY keyword ensures that a non-temporary table will\nnot accidentally be dropped.\n \nUse IF EXISTS to prevent an error from occurring for tables\nthat do not\nexist. A NOTE is generated for each non-existent table when\nusing\nIF EXISTS. See SHOW WARNINGS.\n \nIf a foreign key references this table, the table cannot be\ndropped. In this case, it is necessary to drop the foreign\nkey first.\n \nRESTRICT and CASCADE are allowed to make porting from other\ndatabase systems easier. In MariaDB, they do nothing.\n \nSince MariaDB 5.5.27, the comment before the tablenames\n(that /*COMMENT TO SAVE*/) is stored in the binary log. That\nfeature can be used by replication tools to send their\ninternal messages.\n \nIt is possible to specify table names as db_name.tab_name.\nThis is useful to delete tables from multiple databases with\none statement. See Identifier Qualifiers for details.\n \nThe DROP privilege is required to use DROP TABLE on\nnon-temporary tables. For temporary tables, no privilege is\nrequired, because such tables are only visible for the\ncurrent session.\n \nNote: DROP TABLE automatically commits the current active\ntransaction,\nunless you use the TEMPORARY keyword.\n \nWAIT/NOWAIT\n \nSet the lock wait timeout. See WAIT and NOWAIT.\n \nDROP TABLE in replication\n \nDROP TABLE has the following characteristics in replication:\nDROP TABLE IF EXISTS are always logged.\nDROP TABLE without IF EXISTS for tables that don\'t exist\nare not written to the binary log.\nDropping of TEMPORARY tables are prefixed in the log with\nTEMPORARY. These drops are only logged when running\nstatement or mixed mode replication.\nOne DROP TABLE statement can be logged with up to 3\ndifferent DROP statements:\nDROP TEMPORARY TABLE\nlist_of_non_transactional_temporary_tables\nDROP TEMPORARY TABLE list_of_transactional_temporary_tables\nDROP TABLE list_of_normal_tables\n \nStarting from MariaDB 10.0.8, DROP TABLE on the master is\ntreated on the slave as DROP TABLE IF EXISTS. You can change\nthat by setting slave-ddl-exec-mode to STRICT.\n \nDropping an Internal #sql-... Table\n \nIf the mysqld process is killed during an ALTER TABLE you\nmay find a table named #sql-... in your data directory. In\nMariaDB 10.3, InnoDB tables with this prefix will de deleted\nautomatically during startup.\nIn MariaDB 10.4 we will ensure that these temporary tables\nwill always be deleted automatically.\n \nIf you want to delete one of these tables explicitly you can\ndo so by using the following syntax:\n \nDROP TABLE `#mysql50##sql-...`;\n \nWhen running an ALTER TABLE…ALGORITHM=INPLACE that\nrebuilds the table, InnoDB will create an internal #sql-ib\ntable. For these tables, the .frm file will be called\nsomething else. In order to drop such a table after a server\ncrash, you must rename the #sql*.frm file to match the\n#sql-ib*.ibd file.\n \nExamples\n-------- \nDROP TABLE Employees, Customers;\n \nNotes\n \nBeware that DROP TABLE can drop both tables and sequences.\nThis is mainly done to allow old tools like mysqldump to\nwork with sequences.\n \n\n\nURL: https://mariadb.com/kb/en/library/drop-table/','','https://mariadb.com/kb/en/library/drop-table/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (674,39,'DROP TABLESPACE','The DROP TABLESPACE statement is not supported by MariaDB.\nIt was originally inherited from MySQL NDB Cluster. In MySQL\n5.7 and later, the statement is also supported for InnoDB.\nHowever, MariaDB has chosen not to include that specific\nfeature. See MDEV-19294 for more information.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/drop-tablespace/','','https://mariadb.com/kb/en/library/drop-tablespace/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (675,39,'DROP TRIGGER','Syntax\n------ \nDROP TRIGGER [IF EXISTS] [schema_name.]trigger_name\n \nDescription\n----------- \nThis statement drops a trigger. The schema (database) name\nis optional. If the\nschema is omitted, the trigger is dropped from the default\nschema.\nIts use requires the TRIGGER privilege for the table\nassociated with the trigger.\n \nUse IF EXISTS to prevent an error from occurring for a\ntrigger that does not exist. A NOTE is generated for a\nnon-existent trigger\nwhen using IF EXISTS. See SHOW WARNINGS.\n \nNote: Triggers for a table are also dropped if you drop the\ntable.\n \nExamples\n-------- \nDROP TRIGGER test.example_trigger;\n \nUsing the IF EXISTS clause:\n \nDROP TRIGGER IF EXISTS test.example_trigger;\n \nQuery OK, 0 rows affected, 1 warning (0.01 sec)\n \nSHOW WARNINGS;\n \n+-------+------+------------------------+\n| Level | Code | Message |\n+-------+------+------------------------+\n| Note | 1360 | Trigger does not exist |\n+-------+------+------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/drop-trigger/','','https://mariadb.com/kb/en/library/drop-trigger/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (676,39,'DROP VIEW','Syntax\n------ \nDROP VIEW [IF EXISTS]\n view_name [, view_name] ...\n [RESTRICT | CASCADE]\n \nDescription\n----------- \nDROP VIEW removes one or more views. You must have the DROP\nprivilege for\neach view. If any of the views named in the argument list do\nnot exist, MariaDB\nreturns an error indicating by name which non-existing views\nit was unable to\ndrop, but it also drops all of the views in the list that do\nexist.\n \nThe IF EXISTS clause prevents an error from occurring for\nviews that don\'t\nexist. When this clause is given, a NOTE is generated for\neach non-existent\nview. See SHOW WARNINGS.\n \nRESTRICT and CASCADE, if given, are parsed and ignored.\n \nIt is possible to specify view names as db_name.view_name.\nThis is useful to delete views from multiple databases with\none statement. See Identifier Qualifiers for details.\n \nThe DROP privilege is required to use DROP TABLE on\nnon-temporary tables. For temporary tables, no privilege is\nrequired, because such tables are only visible for the\ncurrent session.\n \nIf a view references another view, it will be possible to\ndrop the referenced view. However, the other view will\nreference a view which does not exist any more. Thus,\nquerying it will produce an error similar to the following:\n \nERROR 1356 (HY000): View \'db_name.view_name\' references\ninvalid table(s) or \ncolumn(s) or function(s) or definer/invoker of view lack\nrights to use them\n \nThis problem is reported in the output of CHECK TABLE.\n \nNote that it is not necessary to use DROP VIEW to replace an\nexisting view, because CREATE VIEW has an OR REPLACE clause.\n \nExamples\n-------- \nDROP VIEW v,v2;\n \nGiven views v and v2, but no view v3\n \nDROP VIEW v,v2,v3;\nERROR 1051 (42S02): Unknown table \'v3\'\n \nDROP VIEW IF EXISTS v,v2,v3;\nQuery OK, 0 rows affected, 1 warning (0.01 sec)\n \nSHOW WARNINGS;\n+-------+------+-------------------------+\n| Level | Code | Message |\n+-------+------+-------------------------+\n| Note | 1051 | Unknown table \'test.v3\' |\n+-------+------+-------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/drop-view/','','https://mariadb.com/kb/en/library/drop-view/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (677,39,'MERGE','Description\n----------- \nThe MERGE storage engine, also known as the MRG_MyISAM\nengine, is a\ncollection of identical MyISAM tables that can be used as\none.\n\"Identical\" means that all tables have identical column\nand index\ninformation. You cannot merge MyISAM tables in which the\ncolumns are\nlisted in a different order, do not have exactly the same\ncolumns, or\nhave the indexes in different order. However, any or all of\nthe MyISAM\ntables can be compressed with myisampack. Columns names and\nindexes names can be different, as long as data types and\nNULL/NOT NULL clauses are the same. Differences in\ntable options such as AVG_ROW_LENGTH, MAX_ROWS, or PACK_KEYS\ndo not\nmatter.\n \nEach index in a MERGE table must match an index in\nunderlying MyISAM tables, but the opposite is not true.\nAlso, a MERGE table cannot have a PRIMARY KEY or UNIQUE\nindexes, because it cannot enforce uniqueness over all\nunderlying tables.\n \nThe following options are meaningful for MERGE tables:\nUNION. This option specifies the list of the underlying\nMyISAM tables. The list is enclosed between parentheses and\nseparated with commas.\nINSERT_METHOD. This options specifies whether, and how,\nINSERTs are allowed for the table. Allowed values are: NO\n(INSERTs are not allowed), FIRST (new rows will be written\ninto the first table specified in the UNION list), LAST (new\nrows will be written into the last table specified in the\nUNION list). The default value is NO.\n \nIf you define a MERGE table with a definition which is\ndifferent from the underlying MyISAM tables, or one of the\nunderlying tables is not MyISAM, the CREATE TABLE statement\nwill not return any error. But any statement which involves\nthe table will produce an error like the following:\n \nERROR 1168 (HY000): Unable to open underlying table which is\ndifferently defined \n or of non-MyISAM type or doesn\'t exist\n \nA CHECK TABLE will show more information about the problem.\n \nThe error is also produced if the table is properly define,\nbut an underlying table\'s definition changes at some point\nin time.\n \nIf you try to insert a new row into a MERGE table with\nINSERT_METHOD=NO, you will get an error like the following:\n \nERROR 1036 (HY000): Table \'tbl_name\' is read only\n \nIt is possible to build a MERGE table on MyISAM tables which\nhave one or more virtual columns. MERGE itself does not\nsupport virtual columns, thus such columns will be seen as\nregular columns. The data types and sizes will still need to\nbe identical, and they cannot be NOT NULL.\n \nExamples\n-------- \nCREATE TABLE t1 (\n a INT NOT NULL AUTO_INCREMENT PRIMARY KEY,\n message CHAR(20)) ENGINE=MyISAM;\n \nCREATE TABLE t2 (\n a INT NOT NULL AUTO_INCREMENT PRIMARY KEY,\n message CHAR(20)) ENGINE=MyISAM;\n \nINSERT INTO t1 (message) VALUES\n(\'Testing\'),(\'table\'),(\'t1\');\n \nINSERT INTO t2 (message) VALUES\n(\'Testing\'),(\'table\'),(\'t2\');\n \nCREATE 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 \nSELECT * FROM total;\n \n+---+---------+\n| a | message |\n+---+---------+\n| 1 | Testing |\n| 2 | table |\n| 3 | t1 |\n| 1 | Testing |\n| 2 | table |\n| 3 | t2 |\n+---+---------+\n \nIn the following example, we\'ll create three MyISAM tables,\nand then a MERGE table on them. However, one of them uses a\ndifferent data type for the column b, so a SELECT will\nproduce an error:\n \nCREATE TABLE t1 (\n a INT,\n b INT\n) ENGINE = MyISAM;\n \nCREATE TABLE t2 (\n a INT,\n b INT\n) ENGINE = MyISAM;\n \nCREATE TABLE t3 (\n a INT,\n b TINYINT\n) ENGINE = MyISAM;\n \nCREATE TABLE t_mrg (\n a INT,\n b INT\n) ENGINE = MERGE,UNION=(t1,t2,t3);\n \nSELECT * FROM t_mrg;\n \nERROR 1168 (HY000): Unable to open underlying table which is\ndifferently defined\n or of non-MyISAM type or doesn\'t exist\n \nTo find out what\'s wrong, we\'ll use a CHECK TABLE:\n \nCHECK TABLE t_mrg;\n \n+------------+-------+----------+-----------------------------------------------------------------------------------------------------+\n| Table | Op | Msg_type | Msg_text |\n+------------+-------+----------+-----------------------------------------------------------------------------------------------------+\n| test.t_mrg | check | Error | Table \'test.t3\' is\ndifferently defined or of non-MyISAM type or doesn\'t exist\n|\n| test.t_mrg | check | Error | Unable to open underlying\ntable which is differently defined or of non-MyISAM type or\ndoesn\'t exist |\n| test.t_mrg | check | error | Corrupt |\n+------------+-------+----------+-----------------------------------------------------------------------------------------------------+\n \nNow, we know that the problem is in t3\'s definition.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/merge/','','https://mariadb.com/kb/en/library/merge/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (678,39,'RENAME TABLE','Syntax\n------ \nRENAME TABLE tbl_name \n [WAIT n | NOWAIT]\n TO new_tbl_name\n [, tbl_name2 TO new_tbl_name2] ...\n \nDescription\n----------- \nThis statement renames one or more tables or views, but not\nthe privileges associated to them.\n \nThe rename operation is done atomically, which means that no\nother session can\naccess any of the tables while the rename is running. For\nexample, if you have\nan existing table old_table, you can create another table\nnew_table that has the same structure but is empty, and then\nreplace the existing table with the empty one as follows\n(assuming that\nbackup_table does not already exist):\n \nCREATE TABLE new_table (...);\nRENAME TABLE old_table TO backup_table, new_table TO\nold_table;\n \ntbl_name can optionally be specified as db_name.tbl_name.\nSee Identifier Qualifiers. This allows to use RENAME to move\na table from a database to another (as long as they are on\nthe same filesystem):\n \nRENAME TABLE db1.t TO db2.t;\n \nNote that moving a table to another database is not possible\nif it has some triggers. Trying to do so produces the\nfollowing error:\n \nERROR 1435 (HY000): Trigger in wrong schema\n \nAlso, views cannot be moved to another database:\n \nERROR 1450 (HY000): Changing schema from \'old_db\' to\n\'new_db\' is not allowed.\n \nIf a RENAME TABLE renames more than one table and one\nrenaming fails, all renames executed by the same statement\nare rolled back.\n \nRenames are always executed in the specified order. Knowing\nthis, it is also possible to swap two tables\' names:\n \nRENAME TABLE t1 TO tmp_table,\n t2 TO t1,\n tmp_table TO t2;\n \nPrivileges\n \nExecuting the RENAME TABLE statement requires the DROP,\nCREATE and INSERT privileges for the table or the database.\n \nWAIT/NOWAIT\n \nSet the lock wait timeout. See WAIT and NOWAIT.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/rename-table/','','https://mariadb.com/kb/en/library/rename-table/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (679,39,'TRUNCATE TABLE','Syntax\n------ \nTRUNCATE [TABLE] tbl_name\n [WAIT n | NOWAIT]\n \nDescription\n----------- \nTRUNCATE TABLE empties a table completely. It requires the\nDROP privilege. See GRANT.\n \ntbl_name can also be specified in the form db_name.tbl_name\n(see Identifier Qualifiers).\n \nLogically, TRUNCATE TABLE is equivalent to a DELETE\nstatement that deletes all rows, but there are practical\ndifferences under some circumstances.\n \nTRUNCATE TABLE will fail for an InnoDB table if any FOREIGN\nKEY constraints from other tables reference the table,\nreturning the error:\n \nERROR 1701 (42000): Cannot truncate a table referenced in a\nforeign key constraint\n \nForeign Key constraints between columns in the same table\nare permitted.\n \nFor an InnoDB table, if there are no FOREIGN KEY\nconstraints, InnoDB performs fast truncation by dropping the\noriginal table and creating an empty one with the same\ndefinition, which is much faster than deleting rows one by\none. The AUTO_INCREMENT counter is reset by TRUNCATE TABLE,\nregardless of whether there is a FOREIGN KEY constraint.\n \nThe count of rows affected by TRUNCATE TABLE is accurate\nonly\nwhen it is mapped to a DELETE statement.\n \nFor other storage engines, TRUNCATE TABLE differs from\nDELETE in the following ways:\nTruncate operations drop and re-create the table, which is\nmuch\n faster than deleting rows one by one, particularly for\nlarge tables.\nTruncate operations cause an implicit commit.\nTruncation operations cannot be performed if the session\nholds an\n active table lock.\nTruncation operations do not return a meaningful value for\nthe number\n of deleted rows. The usual result is \"0 rows affected,\"\nwhich should\n be interpreted as \"no information.\"\nAs long as the table format file tbl_name.frm is valid, the\n table can be re-created as an empty table\n with TRUNCATE TABLE, even if the data or index files have\nbecome\n corrupted.\nThe table handler does not remember the last\n used AUTO_INCREMENT value, but starts counting\n from the beginning. This is true even for MyISAM and\nInnoDB, which normally\n do not reuse sequence values.\nWhen used with partitioned tables, TRUNCATE TABLE preserves\n the partitioning; that is, the data and index files are\ndropped and\n re-created, while the partition definitions (.par) file is\n unaffected.\nSince truncation of a table does not make any use of DELETE,\n the TRUNCATE statement does not invoke ON DELETE triggers.\nTRUNCATE TABLE will only reset the values in the Performance\nSchema summary tables to zero or null, and will not remove\nthe rows.\n \nFor the purposes of binary logging and replication, TRUNCATE\nTABLE is treated as DROP TABLE followed by CREATE TABLE (DDL\nrather than DML).\n \nTRUNCATE TABLE does not work on views. Currently, TRUNCATE\nTABLE drops all historical records from a system-versioned\ntable.\n \nWAIT/NOWAIT\n \nSet the lock wait timeout. See WAIT and NOWAIT.\n \nOracle-mode\n \nOracle-mode from MariaDB 10.3 permits the optional keywords\nREUSE STORAGE or DROP STORAGE to be used.\n \nTRUNCATE [TABLE] tbl_name [{DROP | REUSE} STORAGE]\n \nThese have no effect on the operation.\n \nPerformance\n \nTRUNCATE TABLE is faster than DELETE, because it drops and\nre-creates a table.\n \nWith XtraDB/InnoDB, TRUNCATE TABLE is slower if\ninnodb_file_per_table=ON is set (the default since MariaDB\n5.5). This is because TRUNCATE TABLE unlinks the underlying\ntablespace file, which can be an expensive operation. See\nMDEV-8069 for more details.\n \nThe performance issues with innodb_file_per_table=ON can be\nexacerbated in cases where the InnoDB buffer pool is very\nlarge and innodb_adaptive_hash_index=ON is set. In that\ncase, using DROP TABLE followed by CREATE TABLE instead of\nTRUNCATE TABLE may perform better. Setting\ninnodb_adaptive_hash_index=OFF can also help. In MariaDB\n10.2.19 and later, this performance can also be improved by\nsetting innodb_safe_truncate=OFF. See MDEV-9459 for more\ndetails.\n \nSetting innodb_adaptive_hash_index=OFF can also improve\nTRUNCATE TABLE performance in general. See MDEV-16796 for\nmore details.\n \n\n\nURL: https://mariadb.com/kb/en/library/truncate-table/','','https://mariadb.com/kb/en/library/truncate-table/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (680,40,'LASTVAL','LASTVAL is a synonym for PREVIOUS VALUE for sequence_name.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/lastval/','','https://mariadb.com/kb/en/library/lastval/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (681,40,'NEXT VALUE for sequence_name','SEQUENCEs were introduced in MariaDB 10.3\n \nSyntax\n------ \nNEXT VALUE FOR sequence\n \nor\n \nNEXTVAL(sequence_name)\n \nor in Oracle mode (SQL_MODE=ORACLE)\n \nsequence_name.nextval\n \nNEXT VALUE FOR is ANSI SQL syntax while NEXTVAL() is\nPostgreSQL syntax.\n \nDescription\n----------- \nGenerate next value for a SEQUENCE.\nYou can greatly speed up NEXT VALUE by creating the sequence\nwith the CACHE option. If not, every NEXT VALUE usage will\ncause changes in the stored SEQUENCE table.\nWhen using NEXT VALUE the value will be reserved at once and\nwill not be reused, except if the SEQUENCE was created with\nCYCLE. This means that when you are using SEQUENCEs you have\nto expect gaps in the generated sequence numbers.\nIf one updates the SEQUENCE with SETVAL() or ALTER SEQUENCE\n... RESTART, NEXT VALUE FOR will notice this and start from\nthe next requested value.\nFLUSH TABLES will close the sequence and the next sequence\nnumber generated will be according to what\'s stored in the\nSEQUENCE object. In effect, this will discard the cached\nvalues.\nNEXT VALUE requires the INSERT privilege.\n \nYou can also use NEXT VALUE FOR sequence for column DEFAULT.\n \n\n\nURL:\nhttps://mariadb.com/kb/en/library/next-value-for-sequence_name/','','https://mariadb.com/kb/en/library/next-value-for-sequence_name/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (682,40,'NEXTVAL','NEXTVAL is a synonym for NEXT VALUE for sequence_name.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/nextval/','','https://mariadb.com/kb/en/library/nextval/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (683,40,'PREVIOUS VALUE FOR sequence_name','SEQUENCEs were introduced in MariaDB 10.3.\n \nSyntax\n------ \nPREVIOUS VALUE FOR sequence_name\n \nor\n \nLASTVAL(sequence_name)\n \nor in Oracle mode (SQL_MODE=ORACLE)\n \nsequence_name.currval\n \nPREVIOUS VALUE FOR is IBM DB2 syntax while LASTVAL() is\nPostgreSQL syntax.\n \nDescription\n----------- \nGet last value in the current connection generated from a\nsequence.\nIf the sequence has not yet been used by the connection,\nPREVIOUS VALUE FOR returns NULL\nIf a SEQUENCE has been dropped and re-created then it\'s\ntreated as a new SEQUENCE and PREVIOUS VALUE FOR will return\nNULL.\nFLUSH TABLES has no effect on PREVIOUS VALUE FOR.\nPrevious values for all used sequences are stored per\nconnection until connection ends.\n \nPREVIOUS VALUE FOR requires the SELECT privilege.\n \nExample\n \nSELECT PREVIOUS VALUE FOR s;\n \n+----------------------+\n| PREVIOUS VALUE FOR s |\n+----------------------+\n| 100 |\n+----------------------+\n \n\n\nURL:\nhttps://mariadb.com/kb/en/library/previous-value-for-sequence_name/','','https://mariadb.com/kb/en/library/previous-value-for-sequence_name/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (684,40,'Sequence Overview','Sequences were introduced in MariaDB 10.3.\n \nIntroduction\n \nA sequence is an object that generates a sequence of numeric\nvalues, as specified by the CREATE SEQUENCE statement. \n \nCREATE SEQUENCE will create a sequence that generates new\nvalues when called with NEXT VALUE FOR sequence_name. It\'s\nan alternative to AUTO INCREMENT when one wants to have more\ncontrol of how the numbers are generated. As the SEQUENCE\ncaches values (up to the CACHE value in the CREATE SEQUENCE\nstatement, by default 1000) it can in some cases be much\nfaster than AUTO INCREMENT. Another benefit is that one can\naccess the last value generated by all used sequences, which\nsolves one of the limitations with LAST_INSERT_ID().\n \nCreating a Sequence\n \nThe CREATE SEQUENCE statement is used to create a sequence.\nHere is an example of a sequence starting at 100,\nincrementing by 10 each time:\n \nCREATE SEQUENCE s START WITH 100 INCREMENT BY 10;\n \nThe CREATE SEQUENCE statement, along with defaults, can be\nviewd with the SHOW CREATE SEQUENCE STATEMENT, for example:\n \nSHOW CREATE SEQUENCE s\\G\n*************************** 1. row\n***************************\n Table: s\nCreate Table: CREATE SEQUENCE `s` start with 100 minvalue 1\nmaxvalue 9223372036854775806 \n increment by 10 cache 1000 nocycle ENGINE=InnoDB\n \nUsing Sequence Objects\n \nTo get the next value from a sequence, use\n \nNEXT VALUE FOR sequence_name\n \nor\n \nNEXTVAL(sequence_name)\n \nor in Oracle mode (SQL_MODE=ORACLE)\n \nsequence_name.nextval\n \nFor retrieving the last value used by the current connection\nfrom a sequence\nuse:\n \nPREVIOUS VALUE FOR sequence_name\n \nor\n \nLASTVAL(sequence_name)\n \nor in Oracle mode (SQL_MODE=ORACLE)\n \nsequence_name.currval\n \nFor example:\n \nSELECT NEXTVAL(s);\n+------------+\n| NEXTVAL(s) |\n+------------+\n| 100 |\n+------------+\n \nSELECT NEXTVAL(s);\n+------------+\n| NEXTVAL(s) |\n+------------+\n| 110 |\n+------------+\n \nSELECT LASTVAL(s);\n+------------+\n| LASTVAL(s) |\n+------------+\n| 110 |\n+------------+\n \nUsing Sequences in DEFAULT\n \nStarting from 10.3.3 you can use Sequences in DEFAULT:\n \ncreate sequence s1;\n \ncreate table t1 (a int primary key default (next value for\ns1), b int);\ninsert into t1 (b) values (1),(2);\nselect * from t1;\n \n+---+------+\n| a | b |\n+---+------+\n| 1 | 1 |\n| 2 | 2 |\n+---+------+\n \nChanging a Sequence\n \nThe ALTER SEQUENCE statement is used for changing sequences.\nFor example, to restart the sequence at another value:\n \nALTER SEQUENCE s RESTART 50;\n \nSELECT NEXTVAL(s);\n+------------+\n| NEXTVAL(s) |\n+------------+\n| 50 |\n+------------+\n \nThe SETVAL function can also be used to set the next value\nto be returned for a SEQUENCE, for example:\n \nSELECT SETVAL(s, 100);\n+----------------+\n| SETVAL(s, 100) |\n+----------------+\n| 100 |\n+----------------+\n \nSETVAL can only be used to increase the sequence value.\nAttempting to set a lower value will fail, returning NULL:\n \nSELECT SETVAL(s, 50);\n+---------------+\n| SETVAL(s, 50) |\n+---------------+\n| NULL |\n+---------------+\n \nDropping a Sequence\n \nThe DROP SEQUENCE statement is used to drop a sequence, for\nexample:\n \nDROP SEQUENCE s;\n \nReplication\n \nIf one wants to use Sequences in a master-master setup or\nwith Galera one\nshould use INCREMENT=0. This will tell the Sequence to use\nauto_increment_increment and auto_increment_offset to\ngenerate unique values for each server.\n \nStandards Compliance\n \nMariaDB 10.3 supports both ANSI SQL and Oracle syntax for\nsequences.\n \nHowever as SEQUENCE is implemented as a special kind of\ntable, it uses the same namespace as tables. The benefits\nare that sequences show up in SHOW TABLES, and one can also\ncreate a sequence with CREATE TABLE and drop it with DROP\nTABLE. One can SELECT from it as from any other table. This\nensures that all old tools that work with tables should work\nwith sequences.\n \nSince sequence objects act as regular tables in many\ncontexts, they will be affected by LOCK TABLES. This is not\nthe case in other DBMS, such as Oracle, where LOCK TABLE\ndoes not affect sequences.\n \nNotes\n \nOne of the goals with the Sequence implementation is that\nall old\ntools, such as mysqldump, should work unchanged, while still\nkeeping the\nnormal usage of sequence standard compatibly.\n \nTo make this possible, sequence is currently implemented as\na table with a few exclusive properties.\n \nThe special properties for sequence tables are:\nA sequence table has always one row.\nWhen one creates a sequence, either with CREATE TABLE or\nCREATE SEQUENCE, one row will be inserted.\nIf one tries to insert into a sequence table, the single row\nwill be updated. This allows mysqldump to work but also\ngives the additional benefit that one can change all\nproperties of a sequence with a single insert. New\napplications should of course also use ALTER SEQUENCE.\nUPDATE or DELETE can\'t be performed on Sequence objects.\nDoing a select on the sequence shows the current state of\nthe sequence, except the values that are reserved in the\ncache. The next_value column shows the next value not\nreserved by the cache.\nFLUSH TABLES will close the sequence and the next sequence\nnumber generated will be according to what\'s stored in the\nSequence object. In effect, this will discard the cached\nvalues.\nA number of normal table operations work on Sequence tables.\nSee next section.\n \nTable Operations that Work with Sequences\n \nSHOW CREATE TABLE sequence_name. This shows the table\nstructure that is behind the SEQUENCE including the field\nnames that can be used with SELECT or even CREATE TABLE.\nCREATE TABLE sequence-structure ... SEQUENCE=1\nALTER TABLE sequence RENAME TO sequence2\nRENAME TABLE sequence_name TO new_sequence_name\nDROP TABLE sequence_name. This is allowed mainly to get old\ntools like mysqldump to work with sequence tables.\nSHOW TABLES\n \nImplementation\n \nInternally, sequence tables are created as a normal table\nwithout\nrollback (the InnoDB, Aria and MySAM engines support this),\nwrapped by a\nsequence engine object. This allowed us to create sequences\nwith\nalmost no performance impact for normal tables. (The cost is\none \'if\'\nper insert if the binary log is enabled).\n \nUnderlying Table Structure\n \nThe following example shows the table structure of sequences\nand how it\ncan be used as a table.\n(Output of results are slightly edited to make them easier\nto read)\n \ncreate sequence t1;\nshow create sequence t1\\G\n***** 1. row *****\n CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue\n9223372036854775806\n increment by 1 cache 1000 nocycle ENGINE=InnoDB\n \nshow create table t1\\G\n***** 1. row *****\nCreate Table: CREATE TABLE `t1` (\n `next_not_cached_value` bigint(21) NOT NULL,\n `minimum_value` bigint(21) NOT NULL,\n `maximum_value` bigint(21) NOT NULL,\n `start_value` bigint(21) NOT NULL COMMENT \'start value\nwhen sequences is created or value if RESTART is used\',\n `increment` bigint(21) NOT NULL COMMENT \'increment\nvalue\',\n `cache_size` bigint(21) unsigned NOT NULL,\n `cycle_option` tinyint(1) unsigned NOT NULL COMMENT \'0 if\nno cycles are allowed, 1 if the sequence should begin a new\ncycle when maximum_value is passed\',\n `cycle_count` bigint(21) NOT NULL COMMENT \'How many cycles\nhave been done\'\n) ENGINE=InnoDB SEQUENCE=1\n \nselect * from t1\\G\nnext_not_cached_value: 1\n minimum_value: 1\n maximum_value: 9223372036854775806\n start_value: 1\n increment: 1\n cache_size: 1000\n cycle_option: 0\n cycle_count: 0\nThe cycle_count column is incremented every time the\nsequence wraps around.\n \nCredits\n \nThanks to Jianwe Zhao from Aliyun for his work on SEQUENCE\nin AliSQL, which gave ideas and inspiration for this work.\nThanks to Peter Gulutzan,who helped test and gave useful\ncomments about the implementation.\n \n\n\nURL: https://mariadb.com/kb/en/library/sequence-overview/','','https://mariadb.com/kb/en/library/sequence-overview/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (685,40,'SETVAL()','SEQUENCEs were introduced in MariaDB 10.3.\n \nSyntax\n------ \nSETVAL(sequence_name, next_value, [is_used, [round]])\n \nDescription\n----------- \nSet the next value to be returned for a SEQUENCE.\n \nThis function is compatible with PostgreSQL syntax, extended\nwith the round argument.\n \nIf the is_used argument is not given or is 1 or true, then\nthe next used value will\none after the given value. If is_used is 0 or false then the\nnext generated value\nwill be the given value.\n \nIf round is used then it will set the round value (or the\ninternal cycle count, starting at zero) for the sequence.\nIf round is not used, it\'s assumed to be 0.\n \nnext_value must be an integer literal.\n \nFor SEQUENCE tables defined with CYCLE (see CREATE SEQUENCE)\none should use both next_value and round to define the next\nvalue. In this case the\ncurrent sequence value is defined to be round, next_value.\n \nThe result returned by SETVAL() is next_value or NULL if the\ngiven next_value and round is smaller than the current\nvalue.\n \nSETVAL() will not set the SEQUENCE value to a something that\nis less than\nits current value. This is needed to ensure that SETVAL()\nis replication safe. If you want to set the SEQUENCE to a\nsmaller number\nuse ALTER SEQUENCE.\n \nIf CYCLE is used, first round and then next_value are\ncompared\nto see if the value is bigger than the current value.\n \nInternally, in the MariaDB server, SETVAL() is used to\ninform\nslaves that a SEQUENCE has changed value. The slave may get\nSETVAL() statements out of order, but this is ok as only the\nbiggest one will have an effect.\n \nSETVAL requires the INSERT privilege.\n \nExamples\n-------- \nSELECT setval(foo, 42); -- Next nextval will return 43\nSELECT setval(foo, 42, true); -- Same as above\nSELECT setval(foo, 42, false); -- Next nextval will return\n42\n \nSETVAL setting higher and lower values on a sequence with an\nincrement of 10:\n \nSELECT NEXTVAL(s);\n+------------+\n| NEXTVAL(s) |\n+------------+\n| 50 |\n+------------+\n \nSELECT SETVAL(s, 100);\n+----------------+\n| SETVAL(s, 100) |\n+----------------+\n| 100 |\n+----------------+\n \nSELECT NEXTVAL(s);\n+------------+\n| NEXTVAL(s) |\n+------------+\n| 110 |\n+------------+\n \nSELECT SETVAL(s, 50);\n+---------------+\n| SETVAL(s, 50) |\n+---------------+\n| NULL |\n+---------------+\n \nSELECT NEXTVAL(s);\n+------------+\n| NEXTVAL(s) |\n+------------+\n| 120 |\n+------------+\n \nExample demonstrating round:\n \nCREATE OR REPLACE SEQUENCE s1\n START WITH 1\n MINVALUE 1\n MAXVALUE 99\n INCREMENT BY 1 \n CACHE 20 \n CYCLE;\n \nSELECT SETVAL(s1, 99, 1, 0);\n+----------------------+\n| SETVAL(s1, 99, 1, 0) |\n+----------------------+\n| 99 |\n+----------------------+\n \nSELECT NEXTVAL(s1);\n+-------------+\n| NEXTVAL(s1) |\n+-------------+\n| 1 |\n+-------------+\n \nThe following statement returns NULL, as the given\nnext_value and round is smaller than the current value.\n \nSELECT SETVAL(s1, 99, 1, 0);\n+----------------------+\n| SETVAL(s1, 99, 1, 0) |\n+----------------------+\n| NULL |\n+----------------------+\n \nSELECT NEXTVAL(s1);\n+-------------+\n| NEXTVAL(s1) |\n+-------------+\n| 2 |\n+-------------+\n \nIncreasing the round from zero to 1 will allow next_value to\nbe returned.\n \nSELECT SETVAL(s1, 99, 1, 1);\n+----------------------+\n| SETVAL(s1, 99, 1, 1) |\n+----------------------+\n| 99 |\n+----------------------+\n \nSELECT NEXTVAL(s1);\n+-------------+\n| NEXTVAL(s1) |\n+-------------+\n| 1 |\n+-------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/setval/','','https://mariadb.com/kb/en/library/setval/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (686,41,'JSON_ARRAY','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_ARRAY([value[, value2] ...])\n \nDescription\n----------- \nReturns a JSON array containing the listed values. The list\ncan be empty.\n \nExample\n \nSELECT Json_Array(56, 3.1416, \'My name is \"Foo\"\', NULL);\n+--------------------------------------------------+\n| Json_Array(56, 3.1416, \'My name is \"Foo\"\', NULL) |\n+--------------------------------------------------+\n| [56, 3.1416, \"My name is \\\"Foo\\\"\", null] |\n+--------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_array/','','https://mariadb.com/kb/en/json_array/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (687,41,'JSON_ARRAY_APPEND','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_ARRAY_APPEND(json_doc, path, value[, path, value] ...)\n \nDescription\n----------- \nAppends values to the end of the specified arrays within a\nJSON document, returning the result, or NULL if any of the\narguments are NULL.\n \nEvaluation is performed from left to right, with the\nresulting document from the previous pair becoming the new\nvalue against which the next pair is evaluated.\n \nIf the json_doc is not a valid JSON document, or if any of\nthe paths are not valid, or contain a * or ** wildcard, an\nerror is returned.\n \nExamples\n-------- \nSET @json = \'[1, 2, [3, 4]]\';\n \nSELECT JSON_ARRAY_APPEND(@json, \'$[0]\', 5)\n+-------------------------------------+\n| JSON_ARRAY_APPEND(@json, \'$[0]\', 5) |\n+-------------------------------------+\n| [[1, 5], 2, [3, 4]] |\n+-------------------------------------+\n \nSELECT JSON_ARRAY_APPEND(@json, \'$[1]\', 6);\n+-------------------------------------+\n| JSON_ARRAY_APPEND(@json, \'$[1]\', 6) |\n+-------------------------------------+\n| [1, [2, 6], [3, 4]] |\n+-------------------------------------+\n \nSELECT JSON_ARRAY_APPEND(@json, \'$[1]\', 6, \'$[2]\', 7);\n+------------------------------------------------+\n| JSON_ARRAY_APPEND(@json, \'$[1]\', 6, \'$[2]\', 7) |\n+------------------------------------------------+\n| [1, [2, 6], [3, 4, 7]] |\n+------------------------------------------------+\n \nSELECT JSON_ARRAY_APPEND(@json, \'$\', 5);\n+----------------------------------+\n| JSON_ARRAY_APPEND(@json, \'$\', 5) |\n+----------------------------------+\n| [1, 2, [3, 4], 5] |\n+----------------------------------+\n \nSET @json = \'{\"A\": 1, \"B\": [2], \"C\": [3, 4]}\';\n \nSELECT JSON_ARRAY_APPEND(@json, \'$.B\', 5);\n+------------------------------------+\n| JSON_ARRAY_APPEND(@json, \'$.B\', 5) |\n+------------------------------------+\n| {\"A\": 1, \"B\": [2, 5], \"C\": [3, 4]} |\n+------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_array_append/','','https://mariadb.com/kb/en/json_array_append/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (688,41,'JSON_ARRAY_INSERT','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_ARRAY_INSERT(json_doc, path, value[, path, value] ...)\n \nDescription\n----------- \nInserts a value into a JSON document, returning the modified\ndocument, or NULL if any of the arguments are NULL.\n \nEvaluation is performed from left to right, with the\nresulting document from the previous pair becoming the new\nvalue against which the next pair is evaluated.\n \nIf the json_doc is not a valid JSON document, or if any of\nthe paths are not valid, or contain a * or ** wildcard, an\nerror is returned.\n \nExamples\n-------- \nSET @json = \'[1, 2, [3, 4]]\';\n \nSELECT JSON_ARRAY_INSERT(@json, \'$[0]\', 5);\n+-------------------------------------+\n| JSON_ARRAY_INSERT(@json, \'$[0]\', 5) |\n+-------------------------------------+\n| [5, 1, 2, [3, 4]] |\n+-------------------------------------+\n \nSELECT JSON_ARRAY_INSERT(@json, \'$[1]\', 6);\n+-------------------------------------+\n| JSON_ARRAY_INSERT(@json, \'$[1]\', 6) |\n+-------------------------------------+\n| [1, 6, 2, [3, 4]] |\n+-------------------------------------+\n \nSELECT JSON_ARRAY_INSERT(@json, \'$[1]\', 6, \'$[2]\', 7);\n+------------------------------------------------+\n| JSON_ARRAY_INSERT(@json, \'$[1]\', 6, \'$[2]\', 7) |\n+------------------------------------------------+\n| [1, 6, 7, 2, [3, 4]] |\n+------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_array_insert/','','https://mariadb.com/kb/en/json_array_insert/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (689,41,'JSON_COMPACT','This function was added in MariaDB 10.2.4.\n \nSyntax\n------ \nJSON_COMPACT(json_doc)\n \nDescription\n----------- \nRemoves all unnecessary spaces so the json document is as\nshort as possible.\n \nExample\n \nSET @j = \'{ \"A\": 1, \"B\": [2, 3]}\';\n \nSELECT JSON_COMPACT(@j), @j;\n+-------------------+------------------------+\n| JSON_COMPACT(@j) | @j |\n+-------------------+------------------------+\n| {\"A\":1,\"B\":[2,3]} | { \"A\": 1, \"B\": [2, 3]} |\n+-------------------+------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_compact/','','https://mariadb.com/kb/en/json_compact/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (690,41,'JSON_CONTAINS','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_CONTAINS(json_doc, val[, path])\n \nDescription\n----------- \nReturns whether or not the specified value is found in the\ngiven JSON document or, optionally, at the specified path\nwithin the document. Returns 1 if it does, 0 if not and NULL\nif any of the arguments are null. An error occurs if the\ndocument or path is not valid, or contains the * or **\nwildcards.\n \nExamples\n-------- \nSET @json = \'{\"A\": 0, \"B\": {\"C\": 1}, \"D\": 2}\';\n \nSELECT JSON_CONTAINS(@json, \'2\', \'$.A\');\n+----------------------------------+\n| JSON_CONTAINS(@json, \'2\', \'$.A\') |\n+----------------------------------+\n| 0 |\n+----------------------------------+\n \nSELECT JSON_CONTAINS(@json, \'2\', \'$.D\');\n+----------------------------------+\n| JSON_CONTAINS(@json, \'2\', \'$.D\') |\n+----------------------------------+\n| 1 |\n+----------------------------------+\n \nSELECT JSON_CONTAINS(@json, \'{\"C\": 1}\', \'$.A\');\n+-----------------------------------------+\n| JSON_CONTAINS(@json, \'{\"C\": 1}\', \'$.A\') |\n+-----------------------------------------+\n| 0 |\n+-----------------------------------------+\n \nSELECT JSON_CONTAINS(@json, \'{\"C\": 1}\', \'$.B\');\n+-----------------------------------------+\n| JSON_CONTAINS(@json, \'{\"C\": 1}\', \'$.B\') |\n+-----------------------------------------+\n| 1 |\n+-----------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_contains/','','https://mariadb.com/kb/en/json_contains/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (691,41,'JSON_CONTAINS_PATH','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_CONTAINS_PATH(json_doc, return_arg, path[, path] ...)\n \nDescription\n----------- \nIndicates whether the given JSON document contains data at\nthe specified path or paths. Returns 1 if it does, 0 if not\nand NULL if any of the arguments are null.\n \nThe return_arg can be one or all:\none - Returns 1 if at least one path exists within the JSON\ndocument. \nall - Returns 1 only if all paths exist within the JSON\ndocument.\n \nExamples\n-------- \nSET @json = \'{\"A\": 1, \"B\": [2], \"C\": [3, 4]}\';\n \nSELECT JSON_CONTAINS_PATH(@json, \'one\', \'$.A\', \'$.D\');\n+------------------------------------------------+\n| JSON_CONTAINS_PATH(@json, \'one\', \'$.A\', \'$.D\') |\n+------------------------------------------------+\n| 1 |\n+------------------------------------------------+\n1 row in set (0.00 sec)\n \nSELECT JSON_CONTAINS_PATH(@json, \'all\', \'$.A\', \'$.D\');\n+------------------------------------------------+\n| JSON_CONTAINS_PATH(@json, \'all\', \'$.A\', \'$.D\') |\n+------------------------------------------------+\n| 0 |\n+------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_contains_path/','','https://mariadb.com/kb/en/json_contains_path/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (692,41,'JSON_DEPTH','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_DEPTH(json_doc)\n \nDescription\n----------- \nReturns the maximum depth of the given JSON document, or\nNULL if the argument is null. An error will occur if the\nargument is an invalid JSON document.\nScalar values or empty arrays or objects have a depth of 1.\nArrays or objects that are not empty but contain only\nelements or member values of depth 1 will have a depth of 2.\nIn other cases, the depth will be greater than 2.\n \nExamples\n-------- \nSELECT JSON_DEPTH(\'[]\'), JSON_DEPTH(\'true\'),\nJSON_DEPTH(\'{}\');\n+------------------+--------------------+------------------+\n| JSON_DEPTH(\'[]\') | JSON_DEPTH(\'true\') |\nJSON_DEPTH(\'{}\') |\n+------------------+--------------------+------------------+\n| 1 | 1 | 1 |\n+------------------+--------------------+------------------+\n \nSELECT JSON_DEPTH(\'[1, 2, 3]\'), JSON_DEPTH(\'[[], {},\n[]]\');\n+-------------------------+----------------------------+\n| JSON_DEPTH(\'[1, 2, 3]\') | JSON_DEPTH(\'[[], {}, []]\') |\n+-------------------------+----------------------------+\n| 2 | 2 |\n+-------------------------+----------------------------+\n \nSELECT JSON_DEPTH(\'[1, 2, [3, 4, 5, 6], 7]\');\n+---------------------------------------+\n| JSON_DEPTH(\'[1, 2, [3, 4, 5, 6], 7]\') |\n+---------------------------------------+\n| 3 |\n+---------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_depth/','','https://mariadb.com/kb/en/json_depth/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (693,41,'JSON_DETAILED','This function was added in MariaDB 10.2.4.\n \nSyntax\n------ \nJSON_DETAILED(json_doc[, tab_size])\n \nDescription\n----------- \nRepresents JSON in the most understandable way emphasizing\nnested structures.\n \nExample\n \nSET @j = \'{ \"A\":1,\"B\":[2,3]}\';\n \nSELECT @j;\n+--------------------+\n| @j |\n+--------------------+\n| { \"A\":1,\"B\":[2,3]} |\n+--------------------+\n \nSELECT JSON_DETAILED(@j);\n+------------------------------------------------------------+\n| JSON_DETAILED(@j) |\n+------------------------------------------------------------+\n| {\n \"A\": 1,\n \"B\": \n [\n 2,\n 3\n ]\n} |\n+------------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_detailed/','','https://mariadb.com/kb/en/json_detailed/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (694,41,'JSON_EXISTS','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nDescription\n----------- \nDetermines whether a specified JSON value exists in the\ngiven data. Returns 1 if found, 0 if not, or NULL if any of\nthe inputs were NULL.\n \nExamples\n-------- \nSELECT JSON_EXISTS(\'{\"key1\":\"xxxx\", \"key2\":[1, 2,\n3]}\', \"$.key2\");\n+------------------------------------------------------------+\n| JSON_EXISTS(\'{\"key1\":\"xxxx\", \"key2\":[1, 2, 3]}\',\n\"$.key2\") |\n+------------------------------------------------------------+\n| 1 |\n+------------------------------------------------------------+\n \nSELECT JSON_EXISTS(\'{\"key1\":\"xxxx\", \"key2\":[1, 2,\n3]}\', \"$.key3\");\n+------------------------------------------------------------+\n| JSON_EXISTS(\'{\"key1\":\"xxxx\", \"key2\":[1, 2, 3]}\',\n\"$.key3\") |\n+------------------------------------------------------------+\n| 0 |\n+------------------------------------------------------------+\n \nSELECT JSON_EXISTS(\'{\"key1\":\"xxxx\", \"key2\":[1, 2,\n3]}\', \"$.key2[1]\");\n+---------------------------------------------------------------+\n| JSON_EXISTS(\'{\"key1\":\"xxxx\", \"key2\":[1, 2, 3]}\',\n\"$.key2[1]\") |\n+---------------------------------------------------------------+\n| 1 |\n+---------------------------------------------------------------+\n \nSELECT JSON_EXISTS(\'{\"key1\":\"xxxx\", \"key2\":[1, 2,\n3]}\', \"$.key2[10]\");\n+----------------------------------------------------------------+\n| JSON_EXISTS(\'{\"key1\":\"xxxx\", \"key2\":[1, 2, 3]}\',\n\"$.key2[10]\") |\n+----------------------------------------------------------------+\n| 0 |\n+----------------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_exists/','','https://mariadb.com/kb/en/json_exists/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (695,41,'JSON_EXTRACT','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_EXTRACT(json_doc, path[, path] ...)\n \nDescription\n----------- \nExtracts data from a JSON document. The extracted data is\nselected from the parts matching the path arguments. Returns\nall matched values; either as a single matched value, or, if\nthe arguments could return multiple values, a result\nautowrapped as an array in the matching order.\n \nReturns NULL if no paths match or if any of the arguments\nare NULL. \n \nAn error will occur if any path argument is not a valid\npath, or if the json_doc argument is not a valid JSON\ndocument.\n \nExamples\n-------- \nSET @json = \'[1, 2, [3, 4]]\';\n \nSELECT JSON_EXTRACT(@json, \'$[1]\');\n+-----------------------------+\n| JSON_EXTRACT(@json, \'$[1]\') |\n+-----------------------------+\n| 2 |\n+-----------------------------+\n \nSELECT JSON_EXTRACT(@json, \'$[2]\');\n+-----------------------------+\n| JSON_EXTRACT(@json, \'$[2]\') |\n+-----------------------------+\n| [3, 4] |\n+-----------------------------+\n \nSELECT JSON_EXTRACT(@json, \'$[2][1]\');\n+--------------------------------+\n| JSON_EXTRACT(@json, \'$[2][1]\') |\n+--------------------------------+\n| 4 |\n+--------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_extract/','','https://mariadb.com/kb/en/json_extract/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (696,41,'JSON_INSERT','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_INSERT(json_doc, path, val[, path, val] ...)\n \nDescription\n----------- \nInserts data into a JSON document, returning the resulting\ndocument or NULL if any argument is null. \n \nAn error will occur if the JSON document is not invalid, or\nif any of the paths are invalid or contain a * or **\nwildcard.\n \nJSON_INSERT can only insert data while JSON_REPLACE can only\nupdate. JSON_SET can update or insert data. \n \nExamples\n-------- \nSET @json = \'{ \"A\": 0, \"B\": [1, 2]}\';\n \nSELECT JSON_INSERT(@json, \'$.C\', \'[3, 4]\');\n+--------------------------------------+\n| JSON_INSERT(@json, \'$.C\', \'[3, 4]\') |\n+--------------------------------------+\n| { \"A\": 0, \"B\": [1, 2], \"C\":\"[3, 4]\"} |\n+--------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_insert/','','https://mariadb.com/kb/en/json_insert/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (697,41,'JSON_KEYS','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_KEYS(json_doc[, path])\n \nDescription\n----------- \nReturns the keys as a JSON array from the top-level value of\na JSON object or, if the optional path argument is provided,\nthe top-level keys from the path. \n \nExcludes keys from nested sub-objects in the top level\nvalue. The resulting array will be empty if the selected\nobject is empty.\n \nReturns NULL if any of the arguments are null, a given path\ndoes not locate an object, or if the json_doc argument is\nnot an object.\n \nAn error will occur if JSON document is invalid, the path is\ninvalid or if the path contains a * or ** wildcard.\n \nExamples\n-------- \nSELECT JSON_KEYS(\'{\"A\": 1, \"B\": {\"C\": 2}}\');\n+--------------------------------------+\n| JSON_KEYS(\'{\"A\": 1, \"B\": {\"C\": 2}}\') |\n+--------------------------------------+\n| [\"A\", \"B\"] |\n+--------------------------------------+\n \nSELECT JSON_KEYS(\'{\"A\": 1, \"B\": 2, \"C\": {\"D\":\n3}}\', \'$.C\');\n+-----------------------------------------------------+\n| JSON_KEYS(\'{\"A\": 1, \"B\": 2, \"C\": {\"D\": 3}}\',\n\'$.C\') |\n+-----------------------------------------------------+\n| [\"D\"] |\n+-----------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_keys/','','https://mariadb.com/kb/en/json_keys/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (698,41,'JSON_LENGTH','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_LENGTH(json_doc[, path])\n \nDescription\n----------- \nReturns the length of a JSON document, or, if the optional\npath argument is given, the length of the value within the\ndocument specified by the path. \n \nReturns NULL if any of the arguments argument are null or\nthe path argument does not identify a value in the document.\n\n \nAn error will occur if the JSON document is invalid, the\npath is invalid or if the path contains a * or ** wildcard.\n \nLength will be determined as follow:\nA scalar\'s length is always 1.\nIf an array, the number of elements in the array.\nIf an object, the number of members in the object.\n \nThe length of nested arrays or objects are not counted.\n \nExamples\n-------- \n\n \n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_length/','','https://mariadb.com/kb/en/json_length/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (699,41,'JSON_LOOSE','This function was added in MariaDB 10.2.4.\n \nSyntax\n------ \nJSON_LOOSE(json_doc)\n \nDescription\n----------- \nAdds spaces to a JSON document to make it look more\nreadable.\n \nExample\n \nSET @j = \'{ \"A\":1,\"B\":[2,3]}\';\n \nSELECT JSON_LOOSE(@j), @j;\n+-----------------------+--------------------+\n| JSON_LOOSE(@j) | @j |\n+-----------------------+--------------------+\n| {\"A\": 1, \"B\": [2, 3]} | { \"A\":1,\"B\":[2,3]} |\n+-----------------------+--------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_loose/','','https://mariadb.com/kb/en/json_loose/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (700,41,'JSON_MERGE','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_MERGE(json_doc, json_doc[, json_doc] ...)\n \nDescription\n----------- \nMerges the given JSON documents.\n \nReturns the merged result,or NULL if any argument is NULL.\n \nAn error occurs if any of the arguments are not valid JSON\ndocuments.\n \nExample\n \nSET @json1 = \'[1, 2]\';\n \nSET @json2 = \'[3, 4]\';\n \nSELECT JSON_MERGE(@json1,@json2);\n+---------------------------+\n| JSON_MERGE(@json1,@json2) |\n+---------------------------+\n| [1, 2, 3, 4] |\n+---------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_merge/','','https://mariadb.com/kb/en/json_merge/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (701,41,'JSON_OBJECT','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_OBJECT([key, value[, key, value] ...])\n \nDescription\n----------- \nReturns a JSON object containing the given key/value pairs.\nThe key/value list can be empty.\n \nAn error will occur if there are an odd number of arguments,\nor any key name is NULL.\n \nExample\n \nSELECT JSON_OBJECT(\"id\", 1, \"name\", \"Monty\");\n+---------------------------------------+\n| JSON_OBJECT(\"id\", 1, \"name\", \"Monty\") |\n+---------------------------------------+\n| {\"id\": 1, \"name\": \"Monty\"} |\n+---------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_object/','','https://mariadb.com/kb/en/json_object/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (702,41,'JSON_QUERY','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_QUERY(json_doc, path)\n \nDescription\n----------- \nGiven a JSON document, returns an object or array specified\nby the path. Returns NULL if not given a valid JSON\ndocument, or if there is no match.\n \nExamples\n-------- \nselect json_query(\'{\"key1\":{\"a\":1, \"b\":[1,2]}}\',\n\'$.key1\');\n+-----------------------------------------------------+\n| json_query(\'{\"key1\":{\"a\":1, \"b\":[1,2]}}\',\n\'$.key1\') |\n+-----------------------------------------------------+\n| {\"a\":1, \"b\":[1,2]} |\n+-----------------------------------------------------+\n \nselect json_query(\'{\"key1\":123, \"key1\": [1,2,3]}\',\n\'$.key1\');\n+-------------------------------------------------------+\n| json_query(\'{\"key1\":123, \"key1\": [1,2,3]}\',\n\'$.key1\') |\n+-------------------------------------------------------+\n| [1,2,3] |\n+-------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_query/','','https://mariadb.com/kb/en/json_query/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (703,41,'JSON_QUOTE','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_QUOTE(json_value)\n \nDescription\n----------- \nQuotes a string as a JSON value, usually for producing valid\nJSON string literals for inclusion in JSON documents. Wraps\nthe string with double quote characters and escapes interior\nquotes and other special characters, returning a utf8mb4\nstring. \n \nReturns NULL if the argument is NULL.\n \nExamples\n-------- \nSELECT JSON_QUOTE(\'A\'), JSON_QUOTE(\"B\"),\nJSON_QUOTE(\'\"C\"\');\n+-----------------+-----------------+-------------------+\n| JSON_QUOTE(\'A\') | JSON_QUOTE(\"B\") |\nJSON_QUOTE(\'\"C\"\') |\n+-----------------+-----------------+-------------------+\n| \"A\" | \"B\" | \"\\\"C\\\"\" |\n+-----------------+-----------------+-------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_quote/','','https://mariadb.com/kb/en/json_quote/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (704,41,'JSON_REMOVE','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_REMOVE(json_doc, path[, path] ...)\n \nDescription\n----------- \nRemoves data from a JSON document returning the result, or\nNULL if any of the arguments are null. If the element does\nnot exist in the document, no changes are made.\n \nAn error will occur if JSON document is invalid, the path is\ninvalid or if the path contains a * or ** wildcard.\n \nPath arguments are evaluated from left to right, with the\nresult from the earlier evaluation being used as the value\nfor the next.\n \nExamples\n-------- \nSELECT JSON_REMOVE(\'{\"A\": 1, \"B\": 2, \"C\": {\"D\":\n3}}\', \'$.C\');\n+-------------------------------------------------------+\n| JSON_REMOVE(\'{\"A\": 1, \"B\": 2, \"C\": {\"D\": 3}}\',\n\'$.C\') |\n+-------------------------------------------------------+\n| {\"A\": 1, \"B\": 2} |\n+-------------------------------------------------------+\n \nSELECT JSON_REMOVE(\'[\"A\", \"B\", [\"C\", \"D\"],\n\"E\"]\', \'$[1]\');\n+----------------------------------------------------+\n| JSON_REMOVE(\'[\"A\", \"B\", [\"C\", \"D\"], \"E\"]\',\n\'$[1]\') |\n+----------------------------------------------------+\n| [\"A\", [\"C\", \"D\"], \"E\"] |\n+----------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_remove/','','https://mariadb.com/kb/en/json_remove/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (705,41,'JSON_REPLACE','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_REPLACE(json_doc, path, val[, path, val] ...)\n \nDescription\n----------- \nReplaces existing values in a JSON document, returning the\nresult, or NULL if any of the arguments are NULL. \n \nAn error will occur if the JSON document is invalid, the\npath is invalid or if the path contains a * or ** wildcard.\n \nPaths and values are evaluated from left to right, with the\nresult from the earlier evaluation being used as the value\nfor the next.\n \nJSON_REPLACE can only update data, while JSON_INSERT can\nonly insert. JSON_SET can update or insert data. \n \nExamples\n-------- \nSELECT JSON_REPLACE(\'{ \"A\": 1, \"B\": [2, 3]}\',\n\'$.B[1]\', 4);\n+-----------------------------------------------------+\n| JSON_REPLACE(\'{ \"A\": 1, \"B\": [2, 3]}\', \'$.B[1]\',\n4) |\n+-----------------------------------------------------+\n| { \"A\": 1, \"B\": [2, 4]} |\n+-----------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_replace/','','https://mariadb.com/kb/en/json_replace/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (706,41,'JSON_SEARCH','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_SEARCH(json_doc, return_arg, search_str[, escape_char[,\npath] ...])\n \nDescription\n----------- \nReturns the path to the given string within a JSON document,\nor NULL if any of json_doc, search_str or a path argument is\nNULL; if the search string is not found, or if no path\nexists within the document. \n \nA warning will occur if the JSON document is not valid, any\nof the path arguments are not valid, if return_arg is\nneither one nor all, or if the escape character is not a\nconstant. NULL will be returned.\n \nreturn_arg can be one of two values:\n\'one: Terminates after finding the first match, so will\nreturn one path string. If there is more than one match, it\nis undefined which is considered first.\nall: Returns all matching path strings, without duplicates.\nMultiple strings are autowrapped as an array. The order is\nundefined.\n \nExamples\n-------- \nSET @json = \'[\"A\", [{\"B\": \"1\"}], {\"C\":\"AB\"},\n{\"D\":\"BC\"}]\';\n \nSELECT JSON_SEARCH(@json, \'one\', \'AB\');\n+---------------------------------+\n| JSON_SEARCH(@json, \'one\', \'AB\') |\n+---------------------------------+\n| \"$[2].C\" |\n+---------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_search/','','https://mariadb.com/kb/en/json_search/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (707,41,'JSON_SET','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_SET(json_doc, path, val[, path, val] ...)\n \nDescription\n----------- \nUpdates or inserts data into a JSON document, returning the\nresult, or NULL if any of the arguments are NULL or the\noptional path fails to find an object.\n \nAn error will occur if the JSON document is invalid, the\npath is invalid or if the path contains a * or wildcard.\n \nJSON_SET can update or insert data, while JSON_REPLACE can\nonly update, and JSON_INSERT only insert. \n \nExamples\n-------- \n\n \n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_set/','','https://mariadb.com/kb/en/json_set/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (708,41,'JSON_TYPE','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_TYPE(json_val)\n \nDescription\n----------- \nReturns the type of a JSON value, or NULL if the argument is\nnull.\n \nAn error will occur if the argument is an invalid JSON\nvalue.\n \nThe following is a complete list of the possible return\ntypes:\n \nReturn type | Value | \n \nARRAY | JSON array | \n \nBIT | MariaDB BIT scalar | \n \nBLOB | MariaDB binary types (BINARY, VARBINARY or BLOB) | \n \nBOOLEAN | JSON true/false literals | \n \nDATE | MariaDB DATE scalar | \n \nDATETIME | MariaDB DATETIME or TIMESTAMP scalar | \n \nDECIMAL | MariaDB DECIMAL or NUMERIC scalar | \n \nDOUBLE | MariaDB DOUBLE FLOAT scalar | \n \nINTEGER | MariaDB integer types (TINYINT, SMALLINT,\nMEDIUMINT, INT or BIGINT) | \n \nNULL | JSON null literal or NULL argument | \n \nOBJECT | JSON object | \n \nOPAQUE | Any valid JSON value that is not one of the other\ntypes. | \n \nSTRING | MariaDB character types (CHAR, VARCHAR, TEXT, ENUM\nor SET) | \n \nTIME | MariaDB TIME scalar | \n \nExamples\n-------- \nSELECT JSON_TYPE(\'{\"A\": 1, \"B\": 2, \"C\": 3}\');\n+---------------------------------------+\n| JSON_TYPE(\'{\"A\": 1, \"B\": 2, \"C\": 3}\') |\n+---------------------------------------+\n| OBJECT |\n+---------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_type/','','https://mariadb.com/kb/en/json_type/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (709,41,'JSON_UNQUOTE','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_UNQUOTE(val)\n \nDescription\n----------- \nUnquotes a JSON value, returning a string, or NULL if the\nargument is null. \n \nAn error will occur if the given value begins and ends with\ndouble quotes and is an invalid JSON string literal.\n \nCertain character sequences have special meanings within a\nstring. Usually, a backspace is ignored, but the escape\nsequences in the table below are recognised by MariaDB,\nunless the SQL Mode is set to NO_BACKSLASH_ESCAPES SQL.\n \nEscape sequence | Character | \n \n\\\" | Double quote (\") | \n \n\\b | Backspace | \n \n\\f | Formfeed | \n \n\\n | Newline (linefeed) | \n \n\\r | Carriage return | \n \n\\t | Tab | \n \n\\\\ | Backslash (\\) | \n \n\\uXXXX | UTF-8 bytes for Unicode value XXXX | \n \nExamples\n-------- \nSELECT JSON_UNQUOTE(\'\"Monty\"\');\n+-------------------------+\n| JSON_UNQUOTE(\'\"Monty\"\') |\n+-------------------------+\n| Monty |\n+-------------------------+\n \nWith the default SQL Mode:\n \nSELECT JSON_UNQUOTE(\'Si\\bng\\ting\');\n+-----------------------------+\n| JSON_UNQUOTE(\'Si\\bng\\ting\') |\n+-----------------------------+\n| Sng ing |\n+-----------------------------+\n \nSetting NO_BACKSLASH_ESCAPES:\n \nSET @@sql_mode = \'NO_BACKSLASH_ESCAPES\';\n \nSELECT JSON_UNQUOTE(\'Si\\bng\\ting\');\n+-----------------------------+\n| JSON_UNQUOTE(\'Si\\bng\\ting\') |\n+-----------------------------+\n| Si\\bng\\ting |\n+-----------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_unquote/','','https://mariadb.com/kb/en/json_unquote/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (710,41,'JSON_VALID','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_VALID(value)\n \nDescription\n----------- \nIndicates whether the given value is a valid JSON document\nor not. Returns 1 if valid, 0 if not, and NULL if the\nargument is NULL.\n \nFrom MariaDB 10.4.3, the JSON_VALID function is\nautomatically used as a CHECK constraint for the JSON data\ntype alias in order to ensure that a valid json document is\ninserted. \n \nExamples\n-------- \nSELECT JSON_VALID(\'{\"id\": 1, \"name\": \"Monty\"}\');\n+------------------------------------------+\n| JSON_VALID(\'{\"id\": 1, \"name\": \"Monty\"}\') |\n+------------------------------------------+\n| 1 |\n+------------------------------------------+\n \nSELECT JSON_VALID(\'{\"id\": 1, \"name\": \"Monty\",\n\"oddfield\"}\');\n+------------------------------------------------------+\n| JSON_VALID(\'{\"id\": 1, \"name\": \"Monty\",\n\"oddfield\"}\') |\n+------------------------------------------------------+\n| 0 |\n+------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_valid/','','https://mariadb.com/kb/en/json_valid/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (711,41,'JSON_VALUE','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_VALUE(json_doc, path)\n \nDescription\n----------- \nGiven a JSON document, returns the scalar specified by the\npath. Returns NULL if not given a valid JSON document, or if\nthere is no match.\n \nExamples\n-------- \nselect json_value(\'{\"key1\":123}\', \'$.key1\');\n+--------------------------------------+\n| json_value(\'{\"key1\":123}\', \'$.key1\') |\n+--------------------------------------+\n| 123 |\n+--------------------------------------+\n \nselect json_value(\'{\"key1\": [1,2,3], \"key1\":123}\',\n\'$.key1\');\n+-------------------------------------------------------+\n| json_value(\'{\"key1\": [1,2,3], \"key1\":123}\',\n\'$.key1\') |\n+-------------------------------------------------------+\n| 123 |\n+-------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_value/','','https://mariadb.com/kb/en/json_value/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (712,42,'CUME_DIST','The CUME_DIST() function was first introduced with window\nfunctions in MariaDB 10.2.0.\n \nSyntax\n------ \nCUME_DIST() OVER ( \n [ PARTITION BY partition_expression ] \n [ ORDER BY order_list ]\n)\n \nDescription\n----------- \nCUME_DIST() is a window function that returns the cumulative\ndistribution of a given row. The following formula is used\nto calculate the value:\n \n(number of rows \n\nURL: https://mariadb.com/kb/en/cume_dist/','','https://mariadb.com/kb/en/cume_dist/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (713,42,'DENSE_RANK','The DENSE_RANK() function was first introduced with window\nfunctions in MariaDB 10.2.0.\n \nSyntax\n------ \nDENSE_RANK() OVER (\n [ PARTITION BY partition_expression ]\n [ ORDER BY order_list ]\n) \n \nDescription\n----------- \nDENSE_RANK() is a window function that displays the number\nof a given row, starting at one and following the ORDER BY\nsequence of the window function, with identical values\nreceiving the same result. Unlike the RANK() function, there\nare no skipped values if the preceding results are\nidentical. It is also similar to the ROW_NUMBER() function\nexcept that in that function, identical values will receive\na different row number for each result.\n \nExamples\n-------- \nThe distinction between DENSE_RANK(), RANK() and\nROW_NUMBER():\n \nCREATE TABLE student(course VARCHAR(10), mark int, name\nvarchar(10));\n \nINSERT INTO student VALUES \n (\'Maths\', 60, \'Thulile\'),\n (\'Maths\', 60, \'Pritha\'),\n (\'Maths\', 70, \'Voitto\'),\n (\'Maths\', 55, \'Chun\'),\n (\'Biology\', 60, \'Bilal\'),\n (\'Biology\', 70, \'Roger\');\n \nSELECT \n RANK() OVER (PARTITION BY course ORDER BY mark DESC) AS\nrank, \n DENSE_RANK() OVER (PARTITION BY course ORDER BY mark DESC)\nAS dense_rank, \n ROW_NUMBER() OVER (PARTITION BY course ORDER BY mark DESC)\nAS row_num, \n course, mark, name \nFROM student ORDER BY course, mark DESC;\n \n+------+------------+---------+---------+------+---------+\n| rank | dense_rank | row_num | course | mark | name |\n+------+------------+---------+---------+------+---------+\n| 1 | 1 | 1 | Biology | 70 | Roger |\n| 2 | 2 | 2 | Biology | 60 | Bilal |\n| 1 | 1 | 1 | Maths | 70 | Voitto |\n| 2 | 2 | 2 | Maths | 60 | Thulile |\n| 2 | 2 | 3 | Maths | 60 | Pritha |\n| 4 | 3 | 4 | Maths | 55 | Chun |\n+------+------------+---------+---------+------+---------+\n \n\n\nURL: https://mariadb.com/kb/en/dense_rank/','','https://mariadb.com/kb/en/dense_rank/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (714,42,'FIRST_VALUE','The FIRST_VALUE() function was first introduced with other\nwindow functions in MariaDB 10.2.\n \nSyntax\n------ \nFIRST_VALUE(expr) OVER (\n [ PARTITION BY partition_expression ]\n [ ORDER BY order_list ]\n) \n \nDescription\n----------- \nFIRST_VALUE returns the first result from an ordered set, or\nNULL if no such result exists.\n \nExamples\n-------- \nCREATE TABLE t1 (\n pk int primary key,\n a int,\n b int,\n c char(10),\n d decimal(10, 3),\n e real\n);\n \nINSERT INTO t1 VALUES\n( 1, 0, 1, \'one\', 0.1, 0.001),\n( 2, 0, 2, \'two\', 0.2, 0.002),\n( 3, 0, 3, \'three\', 0.3, 0.003),\n( 4, 1, 2, \'three\', 0.4, 0.004),\n( 5, 1, 1, \'two\', 0.5, 0.005),\n( 6, 1, 1, \'one\', 0.6, 0.006),\n( 7, 2, NULL, \'n_one\', 0.5, 0.007),\n( 8, 2, 1, \'n_two\', NULL, 0.008),\n( 9, 2, 2, NULL, 0.7, 0.009),\n(10, 2, 0, \'n_four\', 0.8, 0.010),\n(11, 2, 10, NULL, 0.9, NULL);\n \nSELECT pk, FIRST_VALUE(pk) OVER (ORDER BY pk) AS first_asc,\n LAST_VALUE(pk) OVER (ORDER BY pk) AS last_asc,\n FIRST_VALUE(pk) OVER (ORDER BY pk DESC) AS first_desc,\n LAST_VALUE(pk) OVER (ORDER BY pk DESC) AS last_desc\nFROM t1\nORDER BY pk DESC;\n \n+----+-----------+----------+------------+-----------+\n| pk | first_asc | last_asc | first_desc | last_desc |\n+----+-----------+----------+------------+-----------+\n| 11 | 1 | 11 | 11 | 11 |\n| 10 | 1 | 10 | 11 | 10 |\n| 9 | 1 | 9 | 11 | 9 |\n| 8 | 1 | 8 | 11 | 8 |\n| 7 | 1 | 7 | 11 | 7 |\n| 6 | 1 | 6 | 11 | 6 |\n| 5 | 1 | 5 | 11 | 5 |\n| 4 | 1 | 4 | 11 | 4 |\n| 3 | 1 | 3 | 11 | 3 |\n| 2 | 1 | 2 | 11 | 2 |\n| 1 | 1 | 1 | 11 | 1 |\n+----+-----------+----------+------------+-----------+\n \nCREATE OR REPLACE TABLE t1 (i int);\nINSERT INTO t1 VALUES\n(1),(2),(3),(4),(5),(6),(7),(8),(9),(10);\n \nSELECT i,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW\nand 1 FOLLOWING) AS f_1f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW and\n1 FOLLOWING) AS l_1f,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 PRECEDING\nAND 1 FOLLOWING) AS f_1p1f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 PRECEDING AND\n1 FOLLOWING) AS f_1p1f,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 2 PRECEDING\nAND 1 PRECEDING) AS f_2p1p,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 2 PRECEDING AND\n1 PRECEDING) AS f_2p1p,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 FOLLOWING\nAND 2 FOLLOWING) AS f_1f2f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 FOLLOWING AND\n2 FOLLOWING) AS f_1f2f\nFROM t1;\n \n+------+------+------+--------+--------+--------+--------+--------+--------+\n| i | f_1f | l_1f | f_1p1f | f_1p1f | f_2p1p | f_2p1p |\nf_1f2f | f_1f2f |\n+------+------+------+--------+--------+--------+--------+--------+--------+\n| 1 | 1 | 2 | 1 | 2 | NULL | NULL | 2 | 3 |\n| 2 | 2 | 3 | 1 | 3 | 1 | 1 | 3 | 4 |\n| 3 | 3 | 4 | 2 | 4 | 1 | 2 | 4 | 5 |\n| 4 | 4 | 5 | 3 | 5 | 2 | 3 | 5 | 6 |\n| 5 | 5 | 6 | 4 | 6 | 3 | 4 | 6 | 7 |\n| 6 | 6 | 7 | 5 | 7 | 4 | 5 | 7 | 8 |\n| 7 | 7 | 8 | 6 | 8 | 5 | 6 | 8 | 9 |\n| 8 | 8 | 9 | 7 | 9 | 6 | 7 | 9 | 10 |\n| 9 | 9 | 10 | 8 | 10 | 7 | 8 | 10 | 10 |\n| 10 | 10 | 10 | 9 | 10 | 8 | 9 | NULL | NULL |\n+------+------+------+--------+--------+--------+--------+--------+--------+\n \n\n\nURL: https://mariadb.com/kb/en/first_value/','','https://mariadb.com/kb/en/first_value/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (715,42,'LAG','The LAG() function was first introduced with other window\nfunctions in MariaDB 10.2.\n \nSyntax\n------ \nLAG (expr[, offset]) OVER ( \n [ PARTITION BY partition_expression ] \n < ORDER BY order_list >\n)\n \nDescription\n----------- \nThe LAG function accesses data from a previous row according\nto the ORDER BY clause without the need for a self-join. The\nspecific row is determined by the offset (default 1), which\nspecifies the number of rows behind the current row to use.\nAn offset of 0 is the current row.\n \nExamples\n-------- \nCREATE TABLE t1 (pk int primary key, a int, b int, c\nchar(10), d decimal(10, 3), e real);\n \nINSERT INTO t1 VALUES\n ( 1, 0, 1, \'one\', 0.1, 0.001),\n ( 2, 0, 2, \'two\', 0.2, 0.002),\n ( 3, 0, 3, \'three\', 0.3, 0.003),\n ( 4, 1, 2, \'three\', 0.4, 0.004),\n ( 5, 1, 1, \'two\', 0.5, 0.005),\n ( 6, 1, 1, \'one\', 0.6, 0.006),\n ( 7, 2, NULL, \'n_one\', 0.5, 0.007),\n ( 8, 2, 1, \'n_two\', NULL, 0.008),\n ( 9, 2, 2, NULL, 0.7, 0.009),\n (10, 2, 0, \'n_four\', 0.8, 0.010),\n (11, 2, 10, NULL, 0.9, NULL);\n \nSELECT pk, LAG(pk) OVER (ORDER BY pk) AS l,\n LAG(pk,1) OVER (ORDER BY pk) AS l1,\n LAG(pk,2) OVER (ORDER BY pk) AS l2,\n LAG(pk,0) OVER (ORDER BY pk) AS l0,\n LAG(pk,-1) OVER (ORDER BY pk) AS lm1,\n LAG(pk,-2) OVER (ORDER BY pk) AS lm2 \nFROM t1;\n \n+----+------+------+------+------+------+------+\n| pk | l | l1 | l2 | l0 | lm1 | lm2 |\n+----+------+------+------+------+------+------+\n| 1 | NULL | NULL | NULL | 1 | 2 | 3 |\n| 2 | 1 | 1 | NULL | 2 | 3 | 4 |\n| 3 | 2 | 2 | 1 | 3 | 4 | 5 |\n| 4 | 3 | 3 | 2 | 4 | 5 | 6 |\n| 5 | 4 | 4 | 3 | 5 | 6 | 7 |\n| 6 | 5 | 5 | 4 | 6 | 7 | 8 |\n| 7 | 6 | 6 | 5 | 7 | 8 | 9 |\n| 8 | 7 | 7 | 6 | 8 | 9 | 10 |\n| 9 | 8 | 8 | 7 | 9 | 10 | 11 |\n| 10 | 9 | 9 | 8 | 10 | 11 | NULL |\n| 11 | 10 | 10 | 9 | 11 | NULL | NULL |\n+----+------+------+------+------+------+------+\n \n\n\nURL: https://mariadb.com/kb/en/lag/','','https://mariadb.com/kb/en/lag/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (717,42,'MEDIAN','The MEDIAN() window function was first introduced with in\nMariaDB 10.3.3.\n \nSyntax\n------ \nMEDIAN(median expression) OVER (\n [ PARTITION BY partition_expression ] \n)\n \nDescription\n----------- \nMEDIAN() is a window function that returns the median value\nof a range of values.\n \nIt is a specific case of PERCENTILE_CONT, with an argument\nof 0.5 and the ORDER BY column the one in MEDIAN\'s\nargument. \n \nMEDIAN() OVER ( [ PARTITION BY partition_expression] )\n \nIs equivalent to:\n \nPERCENTILE_CONT(0.5) WITHIN \n GROUP (ORDER BY ) OVER ( [ PARTITION BY\npartition_expression ])\n \nExamples\n-------- \nCREATE TABLE book_rating (name CHAR(30), star_rating\nTINYINT);\n \nINSERT INTO book_rating VALUES (\'Lord of the Ladybirds\',\n5);\nINSERT INTO book_rating VALUES (\'Lord of the Ladybirds\',\n3);\nINSERT INTO book_rating VALUES (\'Lady of the Flies\', 1);\nINSERT INTO book_rating VALUES (\'Lady of the Flies\', 2);\nINSERT INTO book_rating VALUES (\'Lady of the Flies\', 5);\n \nSELECT name, median(star_rating) OVER (PARTITION BY name)\nFROM book_rating;\n \n+-----------------------+----------------------------------------------+\n| name | median(star_rating) OVER (PARTITION BY name) |\n+-----------------------+----------------------------------------------+\n| Lord of the Ladybirds | 4.0000000000 |\n| Lord of the Ladybirds | 4.0000000000 |\n| Lady of the Flies | 2.0000000000 |\n| Lady of the Flies | 2.0000000000 |\n| Lady of the Flies | 2.0000000000 |\n+-----------------------+----------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/median/','','https://mariadb.com/kb/en/median/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (718,42,'NTH_VALUE','The NTH_VALUE() function was first introduced with other\nwindow functions in MariaDB 10.2.\n \nSyntax\n------ \nNTH_VALUE (expr[, num_row]) OVER ( \n [ PARTITION BY partition_expression ] \n [ ORDER BY order_list ]\n)\n \nDescription\n----------- \nThe NTH_VALUE function returns the value evaluated at row\nnumber num_row of the window frame, starting from 1, or NULL\nif the row does not exist.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/nth_value/','','https://mariadb.com/kb/en/nth_value/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (719,42,'NTILE','The NTILE() function was first introduced with window\nfunctions in MariaDB 10.2.0.\n \nSyntax\n------ \nNTILE (expr) OVER ( \n [ PARTITION BY partition_expression ] \n [ ORDER BY order_list ]\n)\n \nDescription\n----------- \nNTILE() is a window function that returns an integer\nindicating which group a given row falls into. The number of\ngroups is specified in the argument (expr), starting at one.\nOrdered rows in the partition are divided into the specified\nnumber of groups with as equal a size as possible. \n \nExamples\n-------- \ncreate table t1 (\n pk int primary key,\n a int,\n b int\n );\n \ninsert into t1 values\n (11 , 0, 10),\n (12 , 0, 10),\n (13 , 1, 10),\n (14 , 1, 10),\n (18 , 2, 10),\n (15 , 2, 20),\n (16 , 2, 20),\n (17 , 2, 20),\n (19 , 4, 20),\n (20 , 4, 20);\n \nselect pk, a, b,\n ntile(1) over (order by pk)\n from t1;\n \n+----+------+------+-----------------------------+\n| pk | a | b | ntile(1) over (order by pk) |\n+----+------+------+-----------------------------+\n| 11 | 0 | 10 | 1 |\n| 12 | 0 | 10 | 1 |\n| 13 | 1 | 10 | 1 |\n| 14 | 1 | 10 | 1 |\n| 15 | 2 | 20 | 1 |\n| 16 | 2 | 20 | 1 |\n| 17 | 2 | 20 | 1 |\n| 18 | 2 | 10 | 1 |\n| 19 | 4 | 20 | 1 |\n| 20 | 4 | 20 | 1 |\n+----+------+------+-----------------------------+\n \nselect pk, a, b,\n ntile(4) over (order by pk)\n from t1;\n \n+----+------+------+-----------------------------+\n| pk | a | b | ntile(4) over (order by pk) |\n+----+------+------+-----------------------------+\n| 11 | 0 | 10 | 1 |\n| 12 | 0 | 10 | 1 |\n| 13 | 1 | 10 | 1 |\n| 14 | 1 | 10 | 2 |\n| 15 | 2 | 20 | 2 |\n| 16 | 2 | 20 | 2 |\n| 17 | 2 | 20 | 3 |\n| 18 | 2 | 10 | 3 |\n| 19 | 4 | 20 | 4 |\n| 20 | 4 | 20 | 4 |\n+----+------+------+-----------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/ntile/','','https://mariadb.com/kb/en/ntile/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (720,42,'PERCENT_RANK','The PERCENT_RANK() function was first introduced with window\nfunctions in MariaDB 10.2.0.\n \nSyntax\n------ \nPERCENT_RANK() OVER (\n [ PARTITION BY partition_expression ] \n [ ORDER BY order_list ]\n)\n \nDescription\n----------- \nPERCENT_RANK() is a window function that returns the\nrelative percent rank of a given row. The following formula\nis used to calculate the percent rank:\n \n(rank - 1) / (number of rows in the window or partition - 1)\n \nExamples\n-------- \ncreate table t1 (\n pk int primary key,\n a int,\n b int\n);\n \ninsert into t1 values\n( 1 , 0, 10),\n( 2 , 0, 10),\n( 3 , 1, 10),\n( 4 , 1, 10),\n( 8 , 2, 10),\n( 5 , 2, 20),\n( 6 , 2, 20),\n( 7 , 2, 20),\n( 9 , 4, 20),\n(10 , 4, 20);\n \nselect pk, a, b,\n rank() over (order by a) as rank,\n percent_rank() over (order by a) as pct_rank,\n cume_dist() over (order by a) as cume_dist\nfrom t1;\n \n+----+------+------+------+--------------+--------------+\n| pk | a | b | rank | pct_rank | cume_dist |\n+----+------+------+------+--------------+--------------+\n| 1 | 0 | 10 | 1 | 0.0000000000 | 0.2000000000 |\n| 2 | 0 | 10 | 1 | 0.0000000000 | 0.2000000000 |\n| 3 | 1 | 10 | 3 | 0.2222222222 | 0.4000000000 |\n| 4 | 1 | 10 | 3 | 0.2222222222 | 0.4000000000 |\n| 5 | 2 | 20 | 5 | 0.4444444444 | 0.8000000000 |\n| 6 | 2 | 20 | 5 | 0.4444444444 | 0.8000000000 |\n| 7 | 2 | 20 | 5 | 0.4444444444 | 0.8000000000 |\n| 8 | 2 | 10 | 5 | 0.4444444444 | 0.8000000000 |\n| 9 | 4 | 20 | 9 | 0.8888888889 | 1.0000000000 |\n| 10 | 4 | 20 | 9 | 0.8888888889 | 1.0000000000 |\n+----+------+------+------+--------------+--------------+\n \nselect pk, a, b,\n percent_rank() over (order by pk) as pct_rank,\n cume_dist() over (order by pk) as cume_dist\nfrom t1 order by pk;\n \n+----+------+------+--------------+--------------+\n| pk | a | b | pct_rank | cume_dist |\n+----+------+------+--------------+--------------+\n| 1 | 0 | 10 | 0.0000000000 | 0.1000000000 |\n| 2 | 0 | 10 | 0.1111111111 | 0.2000000000 |\n| 3 | 1 | 10 | 0.2222222222 | 0.3000000000 |\n| 4 | 1 | 10 | 0.3333333333 | 0.4000000000 |\n| 5 | 2 | 20 | 0.4444444444 | 0.5000000000 |\n| 6 | 2 | 20 | 0.5555555556 | 0.6000000000 |\n| 7 | 2 | 20 | 0.6666666667 | 0.7000000000 |\n| 8 | 2 | 10 | 0.7777777778 | 0.8000000000 |\n| 9 | 4 | 20 | 0.8888888889 | 0.9000000000 |\n| 10 | 4 | 20 | 1.0000000000 | 1.0000000000 |\n+----+------+------+--------------+--------------+\n \nselect pk, a, b,\n percent_rank() over (partition by a order by a) as\npct_rank,\n cume_dist() over (partition by a order by a) as cume_dist\nfrom t1;\n \n+----+------+------+--------------+--------------+\n| pk | a | b | pct_rank | cume_dist |\n+----+------+------+--------------+--------------+\n| 1 | 0 | 10 | 0.0000000000 | 1.0000000000 |\n| 2 | 0 | 10 | 0.0000000000 | 1.0000000000 |\n| 3 | 1 | 10 | 0.0000000000 | 1.0000000000 |\n| 4 | 1 | 10 | 0.0000000000 | 1.0000000000 |\n| 5 | 2 | 20 | 0.0000000000 | 1.0000000000 |\n| 6 | 2 | 20 | 0.0000000000 | 1.0000000000 |\n| 7 | 2 | 20 | 0.0000000000 | 1.0000000000 |\n| 8 | 2 | 10 | 0.0000000000 | 1.0000000000 |\n| 9 | 4 | 20 | 0.0000000000 | 1.0000000000 |\n| 10 | 4 | 20 | 0.0000000000 | 1.0000000000 |\n+----+------+------+--------------+--------------+\n \n\n\nURL: https://mariadb.com/kb/en/percent_rank/','','https://mariadb.com/kb/en/percent_rank/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (721,42,'PERCENTILE_CONT','The PERCENTILE_CONT() window function was first introduced\nwith in MariaDB 10.3.3.\n \nSyntax\n------ \nDescription\n----------- \nPERCENTILE_CONT() (standing for continuous percentile) is a\nwindow function which returns a value which corresponds to\nthe given fraction in the sort order. If required, it will\ninterpolate between adjacent input items.\n \nEssentially, the following process is followed to find the\nvalue to return:\nGet the number of rows in the partition, denoted by N\nRN = p*(N-1), where p denotes the argument to the\nPERCENTILE_CONT function\ncalculate the FRN(floor row number) and CRN(column row\nnumber for the group( FRN= floor(RN) and CRN = ceil(RN))\nlook up rows FRN and CRN\nIf (CRN = FRN = RN) then the result is (value of expression\nfrom row at RN)\nOtherwise the result is\n(CRN - RN) * (value of expression for row at FRN) +\n(RN - FRN) * (value of expression for row at CRN)\n \nThe MEDIAN function is a specific case of PERCENTILE_CONT,\nequivalent to PERCENTILE_CONT(0.5).\n \nExamples\n-------- \nCREATE TABLE book_rating (name CHAR(30), star_rating\nTINYINT);\n \nINSERT INTO book_rating VALUES (\'Lord of the Ladybirds\',\n5);\nINSERT INTO book_rating VALUES (\'Lord of the Ladybirds\',\n3);\nINSERT INTO book_rating VALUES (\'Lady of the Flies\', 1);\nINSERT INTO book_rating VALUES (\'Lady of the Flies\', 2);\nINSERT INTO book_rating VALUES (\'Lady of the Flies\', 5);\n \nSELECT name, PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY\nstar_rating) \n OVER (PARTITION BY name) AS pc \n FROM book_rating;\n \n+-----------------------+--------------+\n| name | pc |\n+-----------------------+--------------+\n| Lord of the Ladybirds | 4.0000000000 |\n| Lord of the Ladybirds | 4.0000000000 |\n| Lady of the Flies | 2.0000000000 |\n| Lady of the Flies | 2.0000000000 |\n| Lady of the Flies | 2.0000000000 |\n+-----------------------+--------------+\n \nSELECT name, PERCENTILE_CONT(1) WITHIN GROUP (ORDER BY\nstar_rating) \n OVER (PARTITION BY name) AS pc \n FROM book_rating;\n \n+-----------------------+--------------+\n| name | pc |\n+-----------------------+--------------+\n| Lord of the Ladybirds | 5.0000000000 |\n| Lord of the Ladybirds | 5.0000000000 |\n| Lady of the Flies | 5.0000000000 |\n| Lady of the Flies | 5.0000000000 |\n| Lady of the Flies | 5.0000000000 |\n+-----------------------+--------------+\n \nSELECT name, PERCENTILE_CONT(0) WITHIN GROUP (ORDER BY\nstar_rating) \n OVER (PARTITION BY name) AS pc \n FROM book_rating;\n \n+-----------------------+--------------+\n| name | pc |\n+-----------------------+--------------+\n| Lord of the Ladybirds | 3.0000000000 |\n| Lord of the Ladybirds | 3.0000000000 |\n| Lady of the Flies | 1.0000000000 |\n| Lady of the Flies | 1.0000000000 |\n| Lady of the Flies | 1.0000000000 |\n+-----------------------+--------------+\n \nSELECT name, PERCENTILE_CONT(0.6) WITHIN GROUP (ORDER BY\nstar_rating) \n OVER (PARTITION BY name) AS pc \n FROM book_rating;\n \n+-----------------------+--------------+\n| name | pc |\n+-----------------------+--------------+\n| Lord of the Ladybirds | 4.2000000000 |\n| Lord of the Ladybirds | 4.2000000000 |\n| Lady of the Flies | 2.6000000000 |\n| Lady of the Flies | 2.6000000000 |\n| Lady of the Flies | 2.6000000000 |\n+-----------------------+--------------+\n \n\n\nURL: https://mariadb.com/kb/en/percentile_cont/','','https://mariadb.com/kb/en/percentile_cont/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (722,42,'PERCENTILE_DISC','The PERCENTILE_DISC() window function was first introduced\nwith in MariaDB 10.3.3.\n \nSyntax\n------ \n\nDescription\n----------- \nPERCENTILE_DISC() (standing for discrete percentile) is a\nwindow function which returns the first value in the set\nwhose ordered position is the same or more than the\nspecified fraction.\n \nEssentially, the following process is followed to find the\nvalue to return:\nGet the number of rows in the partition.\nWalk through the partition, in order, until finding the the\nfirst row with CUME_DIST() > function_argument.\n \nExamples\n-------- \nCREATE TABLE book_rating (name CHAR(30), star_rating\nTINYINT);\n \nINSERT INTO book_rating VALUES (\'Lord of the Ladybirds\',\n5);\nINSERT INTO book_rating VALUES (\'Lord of the Ladybirds\',\n3);\nINSERT INTO book_rating VALUES (\'Lady of the Flies\', 1);\nINSERT INTO book_rating VALUES (\'Lady of the Flies\', 2);\nINSERT INTO book_rating VALUES (\'Lady of the Flies\', 5);\n \nSELECT name, PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY\nstar_rating)\n OVER (PARTITION BY name) AS pc FROM book_rating;\n \n+-----------------------+------+\n| name | pc |\n+-----------------------+------+\n| Lord of the Ladybirds | 3 |\n| Lord of the Ladybirds | 3 |\n| Lady of the Flies | 2 |\n| Lady of the Flies | 2 |\n| Lady of the Flies | 2 |\n+-----------------------+------+\n5 rows in set (0.000 sec)\n \nSELECT name, PERCENTILE_DISC(0) WITHIN GROUP (ORDER BY\nstar_rating) \n OVER (PARTITION BY name) AS pc FROM book_rating;\n \n+-----------------------+------+\n| name | pc |\n+-----------------------+------+\n| Lord of the Ladybirds | 3 |\n| Lord of the Ladybirds | 3 |\n| Lady of the Flies | 1 |\n| Lady of the Flies | 1 |\n| Lady of the Flies | 1 |\n+-----------------------+------+\n5 rows in set (0.000 sec)\n \nSELECT name, PERCENTILE_DISC(1) WITHIN GROUP (ORDER BY\nstar_rating) \n OVER (PARTITION BY name) AS pc FROM book_rating;\n \n+-----------------------+------+\n| name | pc |\n+-----------------------+------+\n| Lord of the Ladybirds | 5 |\n| Lord of the Ladybirds | 5 |\n| Lady of the Flies | 5 |\n| Lady of the Flies | 5 |\n| Lady of the Flies | 5 |\n+-----------------------+------+\n5 rows in set (0.000 sec)\n \nSELECT name, PERCENTILE_DISC(0.6) WITHIN GROUP (ORDER BY\nstar_rating) \n OVER (PARTITION BY name) AS pc FROM book_rating;\n \n+-----------------------+------+\n| name | pc |\n+-----------------------+------+\n| Lord of the Ladybirds | 5 |\n| Lord of the Ladybirds | 5 |\n| Lady of the Flies | 2 |\n| Lady of the Flies | 2 |\n| Lady of the Flies | 2 |\n+-----------------------+------\n \n\n\nURL: https://mariadb.com/kb/en/percentile_disc/','','https://mariadb.com/kb/en/percentile_disc/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (723,42,'RANK','The RANK() function was first introduced with window\nfunctions in MariaDB 10.2.0.\n \nSyntax\n------ \nRANK() OVER (\n [ PARTITION BY partition_expression ]\n [ ORDER BY order_list ]\n) \n \nDescription\n----------- \nRANK() is a window function that displays the number of a\ngiven row, starting at one and following the ORDER BY\nsequence of the window function, with identical values\nreceiving the same result. It is similar to the ROW_NUMBER()\nfunction except that in that function, identical values will\nreceive a different row number for each result.\n \nExamples\n-------- \nThe distinction between DENSE_RANK(), RANK() and\nROW_NUMBER():\n \nCREATE TABLE student(course VARCHAR(10), mark int, name\nvarchar(10));\n \nINSERT INTO student VALUES \n (\'Maths\', 60, \'Thulile\'),\n (\'Maths\', 60, \'Pritha\'),\n (\'Maths\', 70, \'Voitto\'),\n (\'Maths\', 55, \'Chun\'),\n (\'Biology\', 60, \'Bilal\'),\n (\'Biology\', 70, \'Roger\');\n \nSELECT \n RANK() OVER (PARTITION BY course ORDER BY mark DESC) AS\nrank, \n DENSE_RANK() OVER (PARTITION BY course ORDER BY mark DESC)\nAS dense_rank, \n ROW_NUMBER() OVER (PARTITION BY course ORDER BY mark DESC)\nAS row_num, \n course, mark, name \nFROM student ORDER BY course, mark DESC;\n \n+------+------------+---------+---------+------+---------+\n| rank | dense_rank | row_num | course | mark | name |\n+------+------------+---------+---------+------+---------+\n| 1 | 1 | 1 | Biology | 70 | Roger |\n| 2 | 2 | 2 | Biology | 60 | Bilal |\n| 1 | 1 | 1 | Maths | 70 | Voitto |\n| 2 | 2 | 2 | Maths | 60 | Thulile |\n| 2 | 2 | 3 | Maths | 60 | Pritha |\n| 4 | 3 | 4 | Maths | 55 | Chun |\n+------+------------+---------+---------+------+---------+\n \n\n\nURL: https://mariadb.com/kb/en/rank/','','https://mariadb.com/kb/en/rank/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (724,42,'ROW_NUMBER','ROW_NUMBER() was first introduced with window functions in\nMariaDB 10.2.0.\n \nSyntax\n------ \nROW_NUMBER() OVER (\n [ PARTITION BY partition_expression ]\n [ ORDER BY order_list ]\n) \n \nDescription\n----------- \nROW_NUMBER() is a window function that displays the number\nof a given row, starting at one and following the ORDER BY\nsequence of the window function, with identical values\nreceiving different row numbers. It is similar to the RANK()\nand DENSE_RANK() functions except that in that function,\nidentical values will receive the same rank for each result.\n \nExamples\n-------- \nThe distinction between DENSE_RANK(), RANK() and\nROW_NUMBER():\n \nCREATE TABLE student(course VARCHAR(10), mark int, name\nvarchar(10));\n \nINSERT INTO student VALUES \n (\'Maths\', 60, \'Thulile\'),\n (\'Maths\', 60, \'Pritha\'),\n (\'Maths\', 70, \'Voitto\'),\n (\'Maths\', 55, \'Chun\'),\n (\'Biology\', 60, \'Bilal\'),\n (\'Biology\', 70, \'Roger\');\n \nSELECT \n RANK() OVER (PARTITION BY course ORDER BY mark DESC) AS\nrank, \n DENSE_RANK() OVER (PARTITION BY course ORDER BY mark DESC)\nAS dense_rank, \n ROW_NUMBER() OVER (PARTITION BY course ORDER BY mark DESC)\nAS row_num, \n course, mark, name \nFROM student ORDER BY course, mark DESC;\n \n+------+------------+---------+---------+------+---------+\n| rank | dense_rank | row_num | course | mark | name |\n+------+------------+---------+---------+------+---------+\n| 1 | 1 | 1 | Biology | 70 | Roger |\n| 2 | 2 | 2 | Biology | 60 | Bilal |\n| 1 | 1 | 1 | Maths | 70 | Voitto |\n| 2 | 2 | 2 | Maths | 60 | Thulile |\n| 2 | 2 | 3 | Maths | 60 | Pritha |\n| 4 | 3 | 4 | Maths | 55 | Chun |\n+------+------------+---------+---------+------+---------+\n \n\n\nURL: https://mariadb.com/kb/en/row_number/','','https://mariadb.com/kb/en/row_number/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (725,43,'SPIDER_BG_DIRECT_SQL','Syntax\n------ \nSPIDER_BG_DIRECT_SQL(\'sql\', \'tmp_table_list\',\n\'parameters\')\n \nDescription\n----------- \nExecutes the given SQL statement in the background on the\nremote server, as defined in the parameters listing. If the\nquery returns a result-set, it sttores the results in the\ngiven temporary table. When the given SQL statement executes\nsuccessfully, this function returns the number of called\nUDF\'s. It returns 0 when the given SQL statement fails.\n \nThis function is a UDF installed with the Spider storage\nengine.\n \nExamples\n-------- \nSELECT SPIDER_BG_DIRECT_SQL(\'SELECT * FROM example_table\',\n\'\', \n \'srv \"node1\", port \"8607\"\') AS \"Direct Query\";\n+--------------+\n| Direct Query | \n+--------------+\n| 1 |\n+--------------+\n \nParameters\n \nerror_rw_mode\n \nDescription: Returns empty results on network error.\n0 : Return error on getting network error.\n1: Return 0 records on getting network error.\n \nDefault Table Value: 0\nDSN Parameter Name: erwm\n \n\n\nURL: https://mariadb.com/kb/en/spider_bg_direct_sql/','','https://mariadb.com/kb/en/spider_bg_direct_sql/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (726,43,'SPIDER_COPY_TABLES','Syntax\n------ \nSPIDER_COPY_TABLES(spider_table_name, \n source_link_id, destination_link_id_list [,parameters])\n \nDescription\n----------- \nA UDF installed with the Spider Storage Engine, this\nfunction copies table data from source_link_id to\ndestination_link_id_list. The service does not need to be\nstopped in order to copy.\n \nIf the Spider table is partitioned, the name must be of the\nformat table_name#P#partition_name. The partition name can\nbe viewed in the mysql.spider_tables table, for example:\n \nSELECT table_name FROM mysql.spider_tables;\n+-------------+\n| table_name |\n+-------------+\n| spt_a#P#pt1 |\n| spt_a#P#pt2 |\n| spt_a#P#pt3 |\n+-------------+\n \nReturns 1 if the data was copied successfully, or 0 if\ncopying the data failed.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/spider_copy_tables/','','https://mariadb.com/kb/en/spider_copy_tables/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (727,43,'SPIDER_DIRECT_SQL','Syntax\n------ \nSPIDER_DIRECT_SQL(\'sql\', \'tmp_table_list\',\n\'parameters\')\n \nDescription\n----------- \nA UDF installed with the Spider Storage Engine, this\nfunction is used to execute the SQL string sql on the remote\nserver, as defined in parameters. If any resultsets are\nreturned, they are stored in the tmp_table_list.\n \nThe function returns 1 if the SQL executes successfully, or\n0 if it fails.\n \nExamples\n-------- \nSELECT SPIDER_DIRECT_SQL(\'SELECT * FROM s\', \'\', \'srv\n\"node1\", port \"8607\"\');\n+----------------------------------------------------------------------+\n| SPIDER_DIRECT_SQL(\'SELECT * FROM s\', \'\', \'srv\n\"node1\", port \"8607\"\') |\n+----------------------------------------------------------------------+\n| 1 |\n+----------------------------------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/spider_direct_sql/','','https://mariadb.com/kb/en/spider_direct_sql/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (728,43,'SPIDER_FLUSH_TABLE_MON_CACHE','Syntax\n------ \nSPIDER_FLUSH_TABLE_MON_CACHE()\n \nDescription\n----------- \nA UDF installed with the Spider Storage Engine, this\nfunction is used for refreshing monitoring server\ninformation. It returns a value of 1.\n \nExamples\n-------- \nSELECT SPIDER_FLUSH_TABLE_MON_CACHE();\n+--------------------------------+\n| SPIDER_FLUSH_TABLE_MON_CACHE() |\n+--------------------------------+\n| 1 |\n+--------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/spider_flush_table_mon_cache/','','https://mariadb.com/kb/en/spider_flush_table_mon_cache/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (729,44,'COLUMN_ADD','The Dynamic columns feature was introduced in MariaDB 5.3.\n \nSyntax\n------ \nCOLUMN_ADD(dyncol_blob, column_nr, value [as type],\n[column_nr, value [as type]]...);\nCOLUMN_ADD(dyncol_blob, column_name, value [as type],\n[column_name, value [as type]]...);\n \nDescription\n----------- \nAdds or updates dynamic columns.\ndyncol_blob must be either a valid dynamic columns blob (for\nexample, COLUMN_CREATE returns such blob), or an empty\nstring.\ncolumn_name specifies the name of the column to be added. If\ndyncol_blob already has a column with this name, it will be\noverwritten.\nvalue specifies the new value for the column. Passing a NULL\nvalue will cause the column to be deleted.\nas type is optional. See #datatypes section for a discussion\nabout types.\n \nThe return value is a dynamic column blob after the\nmodifications.\n \nExamples\n-------- \n-- MariaDB 5.3+:\nUPDATE tbl SET dyncol_blob=COLUMN_ADD(dyncol_blob, 1\n/*column id*/, \"value\") WHERE id=1;\n \n-- MariaDB 10.0.1+:\nUPDATE t1 SET dyncol_blob=COLUMN_ADD(dyncol_blob,\n\"column_name\", \"value\") WHERE id=1;\n \nNote: COLUMN_ADD() is a regular function (just like\nCONCAT()), hence, in order to update the value in the table\nyou have to use the UPDATE ... SET\ndynamic_col=COLUMN_ADD(dynamic_col,\n....) pattern.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/column_add/','','https://mariadb.com/kb/en/column_add/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (730,44,'COLUMN_CHECK','The COLUMN_CHECK function was added in MariaDB 10.0.1.\n \nSyntax\n------ \nCOLUMN_CHECK(dyncol_blob);\n \nDescription\n----------- \nCheck if dyncol_blob is a valid packed dynamic columns blob.\nReturn value of 1 means the blob is valid, return value of 0\nmeans it is not.\n \nRationale:\nNormally, one works with valid dynamic column blobs.\nFunctions like COLUMN_CREATE, COLUMN_ADD, COLUMN_DELETE\nalways return valid dynamic column blobs. However, if a\ndynamic column blob is accidentally truncated, or transcoded\nfrom one character set to another, it will be corrupted.\nThis function can be used to check if a value in a blob\nfield is a valid dynamic column blob.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/column_check/','','https://mariadb.com/kb/en/column_check/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (731,44,'COLUMN_CREATE','The Dynamic columns feature was introduced in MariaDB 5.3.\n \nSyntax\n------ \nCOLUMN_CREATE(column_nr, value [as type], [column_nr, value\n[as type]]...);\nCOLUMN_CREATE(column_name, value [as type], [column_name,\nvalue [as type]]...);\n \nDescription\n----------- \nReturns a dynamic columns blob that stores the specified\ncolumns with values.\n \nThe return value is suitable for \nstoring in a table\nfurther modification with other dynamic columns functions\n \nThe as type part allows one to specify the value type. In\nmost cases,\nthis is redundant because MariaDB will be able to deduce the\ntype of the\nvalue. Explicit type specification may be needed when the\ntype of the value is\nnot apparent. For example, a literal \'2012-12-01\' has a\nCHAR type by\ndefault, one will need to specify \'2012-12-01\' AS DATE to\nhave it stored as\na date. See Dynamic Columns:Datatypes for further details.\n \nExamples\n-------- \n-- MariaDB 5.3+:\nINSERT INTO tbl SET dyncol_blob=COLUMN_CREATE(1 /*column\nid*/, \"value\");\n-- MariaDB 10.0.1+:\nINSERT INTO tbl SET\ndyncol_blob=COLUMN_CREATE(\"column_name\", \"value\");\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/column_create/','','https://mariadb.com/kb/en/column_create/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (732,44,'COLUMN_DELETE','The Dynamic columns feature was introduced in MariaDB 5.3.\n \nSyntax\n------ \nCOLUMN_DELETE(dyncol_blob, column_nr, column_nr...);\nCOLUMN_DELETE(dyncol_blob, column_name, column_name...);\n \nDescription\n----------- \nDeletes a dynamic column with the specified name. Multiple\nnames can be given. The return value is a dynamic column\nblob after the modification.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/column_delete/','','https://mariadb.com/kb/en/column_delete/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (733,44,'COLUMN_EXISTS','The Dynamic columns feature was introduced in MariaDB 5.3.\n \nSyntax\n------ \nCOLUMN_EXISTS(dyncol_blob, column_nr);\nCOLUMN_EXISTS(dyncol_blob, column_name);\n \nDescription\n----------- \nChecks if a column with name column_name exists in\ndyncol_blob. If yes, return 1, otherwise return 0. See\ndynamic columns for more information.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/column_exists/','','https://mariadb.com/kb/en/column_exists/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (734,44,'COLUMN_GET','The Dynamic columns feature was introduced in MariaDB 5.3.\n \nSyntax\n------ \nCOLUMN_GET(dyncol_blob, column_nr as type);\nCOLUMN_GET(dyncol_blob, column_name as type);\n \nDescription\n----------- \nGets the value of a dynamic column by its name. If no column\nwith the given name exists, NULL will be returned.\n \ncolumn_name as type requires that one specify the datatype\nof the dynamic column they are reading. \n \nThis may seem counter-intuitive: why would one need to\nspecify which datatype they\'re retrieving? Can\'t the\ndynamic columns system figure the datatype from the data\nbeing stored?\n \nThe answer is: SQL is a statically-typed language. The SQL\ninterpreter needs to know the datatypes of all expressions\nbefore the query is run (for example, when one is using\nprepared statements and runs \"select COLUMN_GET(...)\", the\nprepared statement API requires the server to inform the\nclient about the datatype of the column being read before\nthe query is executed and the server can see what datatype\nthe column actually has).\n \nA note about lengths\n \nIf you\'re running queries like:\n \nSELECT COLUMN_GET(blob, \'colname\' as CHAR) ...\n \nwithout specifying a maximum length (i.e. using #as CHAR#,\nnot as CHAR(n)), MariaDB will report the maximum length of\nthe resultset column to be 53,6870,911 for MariaDB\n5.3-10.0.0 and 16,777,216 for MariaDB 10.0.1+. This may\ncause excessive memory usage in some client libraries,\nbecause they try to pre-allocate a buffer of maximum\nresultset width. To avoid this problem, use CHAR(n) whenever\nyou\'re using COLUMN_GET in the select list.\n \nSee Dynamic Columns:Datatypes for more information about\ndatatypes.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/column_get/','','https://mariadb.com/kb/en/column_get/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (735,44,'COLUMN_JSON','COLUMN_JSON was introduced in MariaDB 10.0.1\n \nSyntax\n------ \nCOLUMN_JSON(dyncol_blob)\n \nDescription\n----------- \nReturns a JSON representation of data in dyncol_blob. Can\nalso be used to display nested columns. See dynamic columns\nfor more information.\n \nExample\n \nselect item_name, COLUMN_JSON(dynamic_cols) from assets;\n+-----------------+----------------------------------------+\n| item_name | COLUMN_JSON(dynamic_cols) |\n+-----------------+----------------------------------------+\n| MariaDB T-shirt | {\"size\":\"XL\",\"color\":\"blue\"} |\n| Thinkpad Laptop | {\"color\":\"black\",\"warranty\":\"3\nyears\"} |\n+-----------------+----------------------------------------+\n \nLimitation: COLUMN_JSON will decode nested dynamic columns\nat a nesting level of not more than 10 levels deep. Dynamic\ncolumns that are nested deeper than 10 levels will be shown\nas BINARY string, without encoding.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/column_json/','','https://mariadb.com/kb/en/column_json/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (736,44,'COLUMN_LIST','The Dynamic columns feature was introduced in MariaDB 5.3.\n \nSyntax\n------ \nCOLUMN_LIST(dyncol_blob);\n \nDescription\n----------- \nSince MariaDB 10.0.1, this function returns a\ncomma-separated list of column names. The names are quoted\nwith backticks.\n \nBefore MariaDB 10.0.1, it returned a comma-separated list of\ncolumn numbers, not names.\n \nSee dynamic columns for more information.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/column_list/','','https://mariadb.com/kb/en/column_list/');
+insert into help_keyword values (1,'master_ssl_verify_cert');
+insert into help_keyword values (2,'drop prepare');
+insert into help_keyword values (3,'work');
+insert into help_keyword values (4,'drop');
+insert into help_keyword values (5,'returns');
+insert into help_keyword values (6,'value');
+insert into help_keyword values (7,'nchar');
+insert into help_keyword values (8,'repeat');
+insert into help_keyword values (9,'columns');
+insert into help_keyword values (10,'sql_big_result');
+insert into help_keyword values (11,'escape');
+insert into help_keyword values (12,'mode');
+insert into help_keyword values (13,'schedule');
+insert into help_keyword values (14,'starts');
+insert into help_keyword values (15,'host');
+insert into help_keyword values (16,'row_format');
+insert into help_relation values (95,1);
+insert into help_relation values (97,2);
+insert into help_relation values (110,3);
+insert into help_relation values (120,4);
+insert into help_relation values (128,4);
+insert into help_relation values (258,5);
+insert into help_relation values (259,4);
+insert into help_relation values (264,6);
+insert into help_relation values (271,7);
+insert into help_relation values (316,8);
+insert into help_relation values (317,6);
+insert into help_relation values (320,6);
+insert into help_relation values (355,9);
+insert into help_relation values (417,6);
+insert into help_relation values (433,6);
+insert into help_relation values (434,10);
+insert into help_relation values (603,11);
+insert into help_relation values (610,12);
+insert into help_relation values (621,8);
+insert into help_relation values (642,13);
+insert into help_relation values (647,4);
+insert into help_relation values (652,14);
+insert into help_relation values (659,15);
+insert into help_relation values (660,16);
+insert into help_relation values (664,4);
+insert into help_relation values (665,4);
+insert into help_relation values (666,4);
+insert into help_relation values (667,4);
+insert into help_relation values (668,4);
+insert into help_relation values (669,4);
+insert into help_relation values (670,4);
+insert into help_relation values (671,4);
+insert into help_relation values (672,4);
+insert into help_relation values (673,4);
+insert into help_relation values (675,4);
+insert into help_relation values (676,4);
unlock tables;
diff --git a/scripts/mysql_convert_table_format.sh b/scripts/mysql_convert_table_format.sh
index 2001efae392..6b4d758a513 100644
--- a/scripts/mysql_convert_table_format.sh
+++ b/scripts/mysql_convert_table_format.sh
@@ -57,10 +57,10 @@ if ($opt_port)
}
if (length($opt_socket))
{
- $connect_opt.=";mysql_socket=$opt_socket";
+ $connect_opt.=";mariadb_socket=$opt_socket";
}
-$dbh = DBI->connect("DBI:mysql:$opt_database:${opt_host}$connect_opt",
+$dbh = DBI->connect("DBI:MariaDB:$opt_database:${opt_host}$connect_opt",
$opt_user,
$opt_password,
{ PrintError => 0})
diff --git a/scripts/mysql_setpermission.sh b/scripts/mysql_setpermission.sh
index 71462d28622..66decbd69af 100644
--- a/scripts/mysql_setpermission.sh
+++ b/scripts/mysql_setpermission.sh
@@ -86,7 +86,7 @@ if ($opt_password eq '')
# make the connection to MariaDB
-$dbh= DBI->connect("DBI:mysql:mysql:host=$sqlhost:port=$opt_port:mysql_socket=$opt_socket",$opt_user,$opt_password, {PrintError => 0}) ||
+$dbh= DBI->connect("DBI:MariaDB:mysql:host=$sqlhost:port=$opt_port:mariadb_socket=$opt_socket",$opt_user,$opt_password, {PrintError => 0}) ||
die("Can't make a connection to the mysql server.\n The error: $DBI::errstr");
# the start of the program
diff --git a/scripts/mysqlhotcopy.sh b/scripts/mysqlhotcopy.sh
index c56cdea470c..94e577a94a7 100644
--- a/scripts/mysqlhotcopy.sh
+++ b/scripts/mysqlhotcopy.sh
@@ -192,12 +192,12 @@ $opt{allowold} = 1 if $opt{keepold};
my $dsn;
$dsn = ";host=" . (defined($opt{host}) ? $opt{host} : "localhost");
$dsn .= ";port=$opt{port}" if $opt{port};
-$dsn .= ";mysql_socket=$opt{socket}" if $opt{socket};
+$dsn .= ";mariadb_socket=$opt{socket}" if $opt{socket};
-# use mysql_read_default_group=mysqlhotcopy so that [client] and
+# use mariadb_read_default_group=mysqlhotcopy so that [client] and
# [mysqlhotcopy] groups will be read from standard options files.
-my $dbh = DBI->connect("dbi:mysql:$dsn;mysql_read_default_group=mysqlhotcopy",
+my $dbh = DBI->connect("DBI:MariaDB:$dsn;mariadb_read_default_group=mysqlhotcopy",
$opt{user}, $opt{password},
{
RaiseError => 1,
@@ -796,7 +796,7 @@ sub record_log_pos {
my $row_hash = get_row_hash( $dbh, "show slave status" );
my ($master_host, $log_file, $log_pos );
- if ( $dbh->{mysql_serverinfo} =~ /^3\.23/ ) {
+ if ( $dbh->{mariadb_serverinfo} =~ /^3\.23/ ) {
($master_host, $log_file, $log_pos )
= @{$row_hash}{ qw / Master_Host Log_File Pos / };
} else {
diff --git a/scripts/mytop.sh b/scripts/mytop.sh
index 3ef0a59f27f..1c4d7a502f5 100644
--- a/scripts/mytop.sh
+++ b/scripts/mytop.sh
@@ -230,11 +230,11 @@ my $dsn;
## Socket takes precedence.
-$dsn ="DBI:mysql:database=$config{db};mysql_read_default_group=mytop;";
+$dsn ="DBI:MariaDB:database=$config{db};mariadb_read_default_group=mytop;";
if ($config{socket} and -S $config{socket})
{
- $dsn .= "mysql_socket=$config{socket}";
+ $dsn .= "mariadb_socket=$config{socket}";
}
else
{
@@ -1877,7 +1877,7 @@ following:
* Perl 5.005 or newer
* Getopt::Long
- * DBI and DBD::mysql
+ * DBI and DBD::MariaDB
* Term::ReadKey from CPAN
Most systems are likely to have all of those installed--except for
diff --git a/sql-bench/server-cfg.sh b/sql-bench/server-cfg.sh
index 3991d16c6b1..6ef39c4d91f 100644
--- a/sql-bench/server-cfg.sh
+++ b/sql-bench/server-cfg.sh
@@ -116,8 +116,8 @@ sub new
bless $self;
$self->{'cmp_name'} = "mysql";
- $self->{'data_source'} = "DBI:mysql:database=$database;host=$host";
- $self->{'data_source'} .= ";mysql_socket=$socket" if($socket);
+ $self->{'data_source'} = "DBI:MariaDB:database=$database;host=$host";
+ $self->{'data_source'} .= ";mariadb_socket=$socket" if($socket);
$self->{'data_source'} .= ";$connect_options" if($connect_options);
$self->{'limits'} = \%limits;
$self->{'blob'} = "blob";
diff --git a/sql-common/client.c b/sql-common/client.c
index 13c3c909e77..0546188f4d5 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -1,5 +1,5 @@
/* Copyright (c) 2003, 2016, Oracle and/or its affiliates.
- Copyright (c) 2009, 2017, MariaDB
+ Copyright (c) 2009, 2019, 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
@@ -69,9 +69,9 @@ my_bool net_flush(NET *net);
#include "errmsg.h"
#include <violite.h>
-#if !defined(__WIN__)
+#if !defined(_WIN32)
#include <my_pthread.h> /* because of signal() */
-#endif /* !defined(__WIN__) */
+#endif /* !defined(_WIN32) */
#include <sys/stat.h>
#include <signal.h>
@@ -81,29 +81,20 @@ my_bool net_flush(NET *net);
#include <pwd.h>
#endif
-#if !defined(__WIN__)
+#if !defined(_WIN32)
#ifdef HAVE_SELECT_H
# include <select.h>
#endif
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
-#endif /* !defined(__WIN__) */
+#endif /* !defined(_WIN32) */
#ifdef HAVE_SYS_UN_H
# include <sys/un.h>
#endif
-#ifndef _WIN32
-#include <errno.h>
-#define SOCKET_ERROR -1
-#define INVALID_SOCKET -1
-#endif
-#ifdef __WIN__
-#define CONNECT_TIMEOUT 20
-#else
#define CONNECT_TIMEOUT 0
-#endif
#include "client_settings.h"
#include <ssl_compat.h>
@@ -252,7 +243,7 @@ void set_mysql_extended_error(MYSQL *mysql, int errcode,
Create a named pipe connection
*/
-#ifdef __WIN__
+#ifdef _WIN32
HANDLE create_named_pipe(MYSQL *mysql, uint connect_timeout, char **arg_host,
char **arg_unix_socket)
@@ -2596,14 +2587,10 @@ set_connect_attributes(MYSQL *mysql, char *buff, size_t buf_len)
"_platform", MACHINE_TYPE);
rc+= mysql_options4(mysql, MYSQL_OPT_CONNECT_ATTR_ADD,
"_server_host", mysql->host);
-#ifdef __WIN__
- snprintf(buff, buf_len, "%lu", (ulong) GetCurrentProcessId());
-#else
snprintf(buff, buf_len, "%lu", (ulong) getpid());
-#endif
rc+= mysql_options4(mysql, MYSQL_OPT_CONNECT_ATTR_ADD, "_pid", buff);
-#ifdef __WIN__
+#ifdef _WIN32
snprintf(buff, buf_len, "%lu", (ulong) GetCurrentThreadId());
rc+= mysql_options4(mysql, MYSQL_OPT_CONNECT_ATTR_ADD, "_thread", buff);
#endif
@@ -2624,7 +2611,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
const char *scramble_plugin;
ulong pkt_length;
NET *net= &mysql->net;
-#ifdef __WIN__
+#ifdef _WIN32
HANDLE hPipe=INVALID_HANDLE_VALUE;
#endif
#ifdef HAVE_SYS_UN_H
@@ -2746,21 +2733,19 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
}
mysql->options.protocol=MYSQL_PROTOCOL_SOCKET;
}
-#elif defined(__WIN__)
+#elif defined(_WIN32)
if (!net->vio &&
(mysql->options.protocol == MYSQL_PROTOCOL_PIPE ||
- (host && !strcmp(host,LOCAL_HOST_NAMEDPIPE)) ||
- (! have_tcpip && (unix_socket || !host ))))
+ (host && !strcmp(host,LOCAL_HOST_NAMEDPIPE))))
{
if ((hPipe= create_named_pipe(mysql, mysql->options.connect_timeout,
(char**) &host, (char**) &unix_socket)) ==
INVALID_HANDLE_VALUE)
{
DBUG_PRINT("error",
- ("host: '%s' socket: '%s' have_tcpip: %d",
+ ("host: '%s' socket: '%s'",
host ? host : "<null>",
- unix_socket ? unix_socket : "<null>",
- (int) have_tcpip));
+ unix_socket ? unix_socket : "<null>"));
if (mysql->options.protocol == MYSQL_PROTOCOL_PIPE ||
(host && !strcmp(host,LOCAL_HOST_NAMEDPIPE)) ||
(unix_socket && !strcmp(unix_socket,MYSQL_NAMEDPIPE)))
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
index 52fab2a029f..7e780e066f9 100644
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
@@ -36,9 +36,10 @@ IF(WITH_WSREP AND NOT EMBEDDED_LIBRARY)
wsrep_plugin.cc
service_wsrep.cc
)
- SET(WSREP_LIB wsrep-lib wsrep_api_v26)
+ MYSQL_ADD_PLUGIN(wsrep ${WSREP_SOURCES} MANDATORY NOT_EMBEDDED EXPORT_SYMBOLS LINK_LIBRARIES wsrep-lib wsrep_api_v26)
ELSE()
- SET(WSREP_SOURCES wsrep_dummy.cc)
+ ADD_LIBRARY(wsrep STATIC wsrep_dummy.cc)
+ ADD_DEPENDENCIES(wsrep GenError)
ENDIF()
INCLUDE_DIRECTORIES(
@@ -79,7 +80,8 @@ SET (SQL_SOURCE
item_create.cc item_func.cc item_geofunc.cc item_row.cc
item_strfunc.cc item_subselect.cc item_sum.cc item_timefunc.cc
key.cc log.cc lock.cc
- log_event.cc rpl_record.cc rpl_reporting.cc
+ log_event.cc log_event_server.cc
+ rpl_record.cc rpl_reporting.cc
log_event_old.cc rpl_record_old.cc
mf_iocache.cc my_decimal.cc
mysqld.cc net_serv.cc keycaches.cc
@@ -110,13 +112,14 @@ SET (SQL_SOURCE
rpl_tblmap.cc sql_binlog.cc event_scheduler.cc event_data_objects.cc
event_queue.cc event_db_repository.cc
sql_tablespace.cc events.cc ../sql-common/my_user.c
- partition_info.cc rpl_utility.cc rpl_injector.cc sql_locale.cc
+ partition_info.cc rpl_utility.cc rpl_utility_server.cc
+ rpl_injector.cc sql_locale.cc
rpl_rli.cc rpl_mi.cc sql_servers.cc sql_audit.cc
sql_connect.cc scheduler.cc sql_partition_admin.cc
sql_profile.cc event_parse_data.cc sql_alter.cc
sql_signal.cc mdl.cc sql_admin.cc
transaction.cc sys_vars.cc sql_truncate.cc datadict.cc
- sql_reload.cc item_inetfunc.cc
+ sql_reload.cc
# added in MariaDB:
sql_explain.cc
@@ -133,6 +136,7 @@ SET (SQL_SOURCE
semisync.cc semisync_master.cc semisync_slave.cc
semisync_master_ack_receiver.cc
sql_type.cc sql_mode.cc sql_type_json.cc
+ sql_type_geom.cc
item_windowfunc.cc sql_window.cc
sql_cte.cc
item_vers.cc
@@ -141,14 +145,13 @@ SET (SQL_SOURCE
opt_split.cc
rowid_filter.cc rowid_filter.h
opt_trace.cc
- ${WSREP_SOURCES}
table_cache.cc encryption.cc temporary_tables.cc
proxy_protocol.cc backup.cc xa.cc
- ${CMAKE_CURRENT_BINARY_DIR}/sql_builtin.cc
${CMAKE_CURRENT_BINARY_DIR}/sql_yacc.cc
${CMAKE_CURRENT_BINARY_DIR}/sql_yacc_ora.cc
${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h
${CMAKE_CURRENT_BINARY_DIR}/lex_token.h
+ ${GEN_SOURCES}
${MYSYS_LIBWRAP_SOURCE}
)
@@ -163,6 +166,7 @@ IF ((CMAKE_SYSTEM_NAME MATCHES "Linux" OR
ENDIF()
SET(SQL_SOURCE ${SQL_SOURCE} threadpool_generic.cc)
SET(SQL_SOURCE ${SQL_SOURCE} threadpool_common.cc)
+ MYSQL_ADD_PLUGIN(thread_pool_info thread_pool_info.cc DEFAULT STATIC_ONLY NOT_EMBEDDED)
ENDIF()
IF(WIN32)
@@ -176,13 +180,19 @@ RECOMPILE_FOR_EMBEDDED)
ADD_LIBRARY(sql STATIC ${SQL_SOURCE})
DTRACE_INSTRUMENT(sql)
-TARGET_LINK_LIBRARIES(sql ${MYSQLD_STATIC_PLUGIN_LIBS}
+TARGET_LINK_LIBRARIES(sql
mysys mysys_ssl dbug strings vio pcre
${LIBWRAP} ${LIBCRYPT} ${LIBDL} ${CMAKE_THREAD_LIBS_INIT}
- ${WSREP_LIB}
${SSL_LIBRARIES}
${LIBSYSTEMD})
+FOREACH(se aria partition perfschema sql_sequence wsrep)
+ # These engines are used directly in sql sources.
+ IF(TARGET ${se})
+ TARGET_LINK_LIBRARIES(sql ${se})
+ ENDIF()
+ENDFOREACH()
+
IF(WIN32)
SET(MYSQLD_SOURCE main.cc nt_servc.cc message.rc)
TARGET_LINK_LIBRARIES(sql psapi)
@@ -266,6 +276,9 @@ IF(MSVC AND NOT WITHOUT_DYNAMIC_PLUGINS)
SET_TARGET_PROPERTIES(mysqld_import_lib PROPERTIES IMPORTED_LOCATION ${MYSQLD_LIB})
ENDIF()
+ADD_LIBRARY( sql_builtins ${CMAKE_CURRENT_BINARY_DIR}/sql_builtin.cc)
+TARGET_LINK_LIBRARIES(sql_builtins ${MYSQLD_STATIC_PLUGIN_LIBS})
+
MYSQL_ADD_EXECUTABLE(mysqld ${MYSQLD_SOURCE} DESTINATION ${INSTALL_SBINDIR} COMPONENT Server)
IF(APPLE)
@@ -293,7 +306,8 @@ IF(NOT WITHOUT_DYNAMIC_PLUGINS)
ENDIF()
ENDIF(NOT WITHOUT_DYNAMIC_PLUGINS)
-TARGET_LINK_LIBRARIES(mysqld LINK_PRIVATE sql)
+TARGET_LINK_LIBRARIES(mysqld LINK_PRIVATE sql sql_builtins)
+
# Provide plugins with minimal set of libraries
SET(INTERFACE_LIBS ${LIBRT})
diff --git a/sql/debug_sync.cc b/sql/debug_sync.cc
index bf721bddb85..19ea40106df 100644
--- a/sql/debug_sync.cc
+++ b/sql/debug_sync.cc
@@ -1451,12 +1451,10 @@ static void debug_sync_execute(THD *thd, st_debug_sync_action *action)
if (unlikely(error == ETIMEDOUT || error == ETIME))
{
// We should not make the statement fail, even if in strict mode.
- const bool save_abort_on_warning= thd->abort_on_warning;
- thd->abort_on_warning= false;
+ Abort_on_warning_instant_set aws(thd, false);
push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
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_ASSERT(0););
break;
}
diff --git a/sql/event_db_repository.cc b/sql/event_db_repository.cc
index dc47ed0b2e1..6783338ab10 100644
--- a/sql/event_db_repository.cc
+++ b/sql/event_db_repository.cc
@@ -1061,7 +1061,6 @@ Event_db_repository::load_named_event(THD *thd, const LEX_CSTRING *dbname,
Event_basic *etn)
{
bool ret;
- ulonglong saved_mode= thd->variables.sql_mode;
Open_tables_backup open_tables_backup;
TABLE_LIST event_table;
@@ -1072,7 +1071,7 @@ Event_db_repository::load_named_event(THD *thd, const LEX_CSTRING *dbname,
event_table.init_one_table(&MYSQL_SCHEMA_NAME, &MYSQL_EVENT_NAME, 0, TL_READ);
/* Reset sql_mode during data dictionary operations. */
- thd->variables.sql_mode= 0;
+ Sql_mode_instant_set sms(thd, 0);
/*
We don't use open_event_table() here to make sure that SHOW
@@ -1097,7 +1096,6 @@ Event_db_repository::load_named_event(THD *thd, const LEX_CSTRING *dbname,
close_system_tables(thd, &open_tables_backup);
}
- thd->variables.sql_mode= saved_mode;
DBUG_RETURN(ret);
}
diff --git a/sql/field.cc b/sql/field.cc
index 0eb53f40a54..b74c95909e8 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -58,7 +58,7 @@ const char field_separator=',';
((ulong) ((1LL << MY_MIN(arg, 4) * 8) - 1))
// Column marked for read or the field set to read out or record[0] or [1]
-inline bool Field::marked_for_read() const
+bool Field::marked_for_read() const
{
return !table ||
(!table->read_set ||
@@ -73,7 +73,7 @@ inline bool Field::marked_for_read() const
changed fields with DBUG_FIX_WRITE_SET() in table.cc
*/
-inline bool Field::marked_for_write_or_computed() const
+bool Field::marked_for_write_or_computed() const
{
return (!table ||
(!table->write_set ||
@@ -1871,9 +1871,9 @@ bool Field::send_binary(Protocol *protocol)
master's field size, @c false otherwise.
*/
bool Field::compatible_field_size(uint field_metadata,
- Relay_log_info *rli_arg __attribute__((unused)),
+ const Relay_log_info *rli_arg __attribute__((unused)),
uint16 mflags __attribute__((unused)),
- int *order_var)
+ int *order_var) const
{
uint const source_size= pack_length_from_metadata(field_metadata);
uint const destination_size= row_pack_length();
@@ -1887,13 +1887,16 @@ bool Field::compatible_field_size(uint field_metadata,
int Field::store(const char *to, size_t length, CHARSET_INFO *cs,
enum_check_fields check_level)
{
- int res;
- THD *thd= get_thd();
- enum_check_fields old_check_level= thd->count_cuted_fields;
- thd->count_cuted_fields= check_level;
- res= store(to, length, cs);
- thd->count_cuted_fields= old_check_level;
- return res;
+ Check_level_instant_set tmp_level(get_thd(), check_level);
+ return store(to, length, cs);
+}
+
+
+int Field::store_text(const char *to, size_t length, CHARSET_INFO *cs,
+ enum_check_fields check_level)
+{
+ Check_level_instant_set tmp_level(get_thd(), check_level);
+ return store_text(to, length, cs);
}
@@ -2012,24 +2015,24 @@ void Field::make_send_field(Send_field *field)
{
if (orig_table && orig_table->s->db.str && *orig_table->s->db.str)
{
- field->db_name= orig_table->s->db.str;
+ field->db_name= orig_table->s->db;
if (orig_table->pos_in_table_list &&
orig_table->pos_in_table_list->schema_table)
- field->org_table_name= (orig_table->pos_in_table_list->
- schema_table->table_name);
+ field->org_table_name= Lex_cstring_strlen(orig_table->pos_in_table_list->
+ schema_table->table_name);
else
- field->org_table_name= orig_table->s->table_name.str;
+ field->org_table_name= orig_table->s->table_name;
}
else
- field->org_table_name= field->db_name= "";
+ field->org_table_name= field->db_name= empty_clex_str;
if (orig_table && orig_table->alias.ptr())
{
- field->table_name= orig_table->alias.ptr();
+ field->table_name= orig_table->alias.lex_cstring();
field->org_col_name= field_name;
}
else
{
- field->table_name= "";
+ field->table_name= empty_clex_str;
field->org_col_name= empty_clex_str;
}
field->col_name= field_name;
@@ -2188,11 +2191,9 @@ Field_str::Field_str(uchar *ptr_arg,uint32 len_arg, uchar *null_ptr_arg,
:Field(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg)
{
- field_charset= collation.collation;
+ m_collation= collation;
if (collation.collation->state & MY_CS_BINSORT)
flags|=BINARY_FLAG;
- field_derivation= collation.derivation;
- field_repertoire= collation.repertoire;
}
@@ -2206,7 +2207,7 @@ bool Field_str::test_if_equality_guarantees_uniqueness(const Item *item) const
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) ||
+ if (!field_charset()->coll->propagate(field_charset(), 0, 0) ||
item->cmp_type() != STRING_RESULT)
return false;
/*
@@ -2217,8 +2218,8 @@ bool Field_str::test_if_equality_guarantees_uniqueness(const Item *item) const
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;
+ DTCollation tmp(dtcollation());
+ return !tmp.aggregate(item->collation) && tmp.collation == field_charset();
}
@@ -2488,7 +2489,7 @@ bool Field_null::is_equal(const Column_definition &new_field) const
{
DBUG_ASSERT(!compression_method());
return new_field.type_handler() == type_handler() &&
- new_field.charset == field_charset &&
+ new_field.charset == field_charset() &&
new_field.length == max_display_length();
}
@@ -3072,7 +3073,7 @@ String *Field_decimal::val_str(String *val_buffer __attribute__((unused)),
5.00 , -1.0, 05, -05, +5 with optional pre/end space
*/
-int Field_decimal::cmp(const uchar *a_ptr,const uchar *b_ptr)
+int Field_decimal::cmp(const uchar *a_ptr,const uchar *b_ptr) const
{
const uchar *end;
int swap=0;
@@ -3451,7 +3452,7 @@ my_decimal* Field_new_decimal::val_decimal(my_decimal *decimal_value)
}
-int Field_new_decimal::cmp(const uchar *a,const uchar*b)
+int Field_new_decimal::cmp(const uchar *a,const uchar*b) const
{
return memcmp(a, b, bin_size);
}
@@ -3484,11 +3485,12 @@ void Field_new_decimal::sql_type(String &str) const
@returns number of bytes written to metadata_ptr
*/
-int Field_new_decimal::save_field_metadata(uchar *metadata_ptr)
+
+Binlog_type_info Field_new_decimal::binlog_type_info() const
{
- *metadata_ptr= precision;
- *(metadata_ptr + 1)= decimals();
- return 2;
+ DBUG_ASSERT(Field_new_decimal::type() == binlog_type());
+ return Binlog_type_info(Field_new_decimal::type(), precision +
+ (decimals() << 8), 2, binlog_signedness());
}
@@ -3504,7 +3506,7 @@ int Field_new_decimal::save_field_metadata(uchar *metadata_ptr)
@returns The size of the field based on the field metadata.
*/
-uint Field_new_decimal::pack_length_from_metadata(uint field_metadata)
+uint Field_new_decimal::pack_length_from_metadata(uint field_metadata) const
{
uint const source_precision= (field_metadata >> 8U) & 0x00ff;
uint const source_decimal= field_metadata & 0x00ff;
@@ -3515,9 +3517,9 @@ uint Field_new_decimal::pack_length_from_metadata(uint field_metadata)
bool Field_new_decimal::compatible_field_size(uint field_metadata,
- Relay_log_info * __attribute__((unused)),
+ const Relay_log_info * __attribute__((unused)),
uint16 mflags __attribute__((unused)),
- int *order_var)
+ int *order_var) const
{
uint const source_precision= (field_metadata >> 8U) & 0x00ff;
uint const source_decimal= field_metadata & 0x00ff;
@@ -3638,6 +3640,17 @@ int Field_int::store_time_dec(const MYSQL_TIME *ltime, uint dec_arg)
}
+void Field_int::sql_type(String &res) const
+{
+ CHARSET_INFO *cs=res.charset();
+ Name name= type_handler()->type_handler_signed()->name();
+ res.length(cs->cset->snprintf(cs,(char*) res.ptr(),res.alloced_length(),
+ "%.*s(%d)", (int) name.length(), name.ptr(),
+ (int) field_length));
+ add_zerofill_and_unsigned(res);
+}
+
+
/****************************************************************************
** tiny int
****************************************************************************/
@@ -3773,7 +3786,7 @@ bool Field_tiny::send_binary(Protocol *protocol)
return protocol->store_tiny((longlong) (int8) ptr[0]);
}
-int Field_tiny::cmp(const uchar *a_ptr, const uchar *b_ptr)
+int Field_tiny::cmp(const uchar *a_ptr, const uchar *b_ptr) const
{
signed char a,b;
a=(signed char) a_ptr[0]; b= (signed char) b_ptr[0];
@@ -3790,14 +3803,6 @@ void Field_tiny::sort_string(uchar *to,uint length __attribute__((unused)))
to[0] = (char) (ptr[0] ^ (uchar) 128); /* Revers signbit */
}
-void Field_tiny::sql_type(String &res) const
-{
- CHARSET_INFO *cs=res.charset();
- res.length(cs->cset->snprintf(cs,(char*) res.ptr(),res.alloced_length(),
- "tinyint(%d)",(int) field_length));
- add_zerofill_and_unsigned(res);
-}
-
/****************************************************************************
Field type short int (2 byte)
****************************************************************************/
@@ -3942,7 +3947,7 @@ bool Field_short::send_binary(Protocol *protocol)
}
-int Field_short::cmp(const uchar *a_ptr, const uchar *b_ptr)
+int Field_short::cmp(const uchar *a_ptr, const uchar *b_ptr) const
{
short a,b;
a=sint2korr(a_ptr);
@@ -3963,15 +3968,6 @@ void Field_short::sort_string(uchar *to,uint length __attribute__((unused)))
to[1] = ptr[0];
}
-void Field_short::sql_type(String &res) const
-{
- CHARSET_INFO *cs=res.charset();
- res.length(cs->cset->snprintf(cs,(char*) res.ptr(),res.alloced_length(),
- "smallint(%d)",(int) field_length));
- add_zerofill_and_unsigned(res);
-}
-
-
/****************************************************************************
Field type medium int (3 byte)
****************************************************************************/
@@ -4135,7 +4131,7 @@ bool Field_medium::send_binary(Protocol *protocol)
}
-int Field_medium::cmp(const uchar *a_ptr, const uchar *b_ptr)
+int Field_medium::cmp(const uchar *a_ptr, const uchar *b_ptr) const
{
long a,b;
if (unsigned_flag)
@@ -4162,14 +4158,6 @@ void Field_medium::sort_string(uchar *to,uint length __attribute__((unused)))
}
-void Field_medium::sql_type(String &res) const
-{
- CHARSET_INFO *cs=res.charset();
- res.length(cs->cset->snprintf(cs,(char*) res.ptr(),res.alloced_length(),
- "mediumint(%d)",(int) field_length));
- add_zerofill_and_unsigned(res);
-}
-
/****************************************************************************
** long int
****************************************************************************/
@@ -4313,7 +4301,7 @@ bool Field_long::send_binary(Protocol *protocol)
return protocol->store_long(Field_long::val_int());
}
-int Field_long::cmp(const uchar *a_ptr, const uchar *b_ptr)
+int Field_long::cmp(const uchar *a_ptr, const uchar *b_ptr) const
{
int32 a,b;
a=sint4korr(a_ptr);
@@ -4335,14 +4323,6 @@ void Field_long::sort_string(uchar *to,uint length __attribute__((unused)))
}
-void Field_long::sql_type(String &res) const
-{
- CHARSET_INFO *cs=res.charset();
- res.length(cs->cset->snprintf(cs,(char*) res.ptr(),res.alloced_length(),
- "int(%d)",(int) field_length));
- add_zerofill_and_unsigned(res);
-}
-
/****************************************************************************
Field type longlong int (8 bytes)
****************************************************************************/
@@ -4459,7 +4439,7 @@ bool Field_longlong::send_binary(Protocol *protocol)
}
-int Field_longlong::cmp(const uchar *a_ptr, const uchar *b_ptr)
+int Field_longlong::cmp(const uchar *a_ptr, const uchar *b_ptr) const
{
longlong a,b;
a=sint8korr(a_ptr);
@@ -4486,14 +4466,6 @@ void Field_longlong::sort_string(uchar *to,uint length __attribute__((unused)))
}
-void Field_longlong::sql_type(String &res) const
-{
- CHARSET_INFO *cs=res.charset();
- res.length(cs->cset->snprintf(cs,(char*) res.ptr(),res.alloced_length(),
- "bigint(%d)",(int) field_length));
- add_zerofill_and_unsigned(res);
-}
-
void Field_longlong::set_max()
{
DBUG_ASSERT(marked_for_write_or_computed());
@@ -4594,7 +4566,7 @@ String *Field_float::val_str(String *val_buffer,
}
-int Field_float::cmp(const uchar *a_ptr, const uchar *b_ptr)
+int Field_float::cmp(const uchar *a_ptr, const uchar *b_ptr) const
{
float a,b;
float4get(a,a_ptr);
@@ -4656,26 +4628,11 @@ bool Field_float::send_binary(Protocol *protocol)
@returns number of bytes written to metadata_ptr
*/
-int Field_float::save_field_metadata(uchar *metadata_ptr)
+Binlog_type_info Field_float::binlog_type_info() const
{
- *metadata_ptr= pack_length();
- return 1;
-}
-
-
-void Field_float::sql_type(String &res) const
-{
- if (dec >= FLOATING_POINT_DECIMALS)
- {
- res.set_ascii(STRING_WITH_LEN("float"));
- }
- else
- {
- CHARSET_INFO *cs= res.charset();
- res.length(cs->cset->snprintf(cs,(char*) res.ptr(),res.alloced_length(),
- "float(%d,%d)",(int) field_length,dec));
- }
- add_zerofill_and_unsigned(res);
+ DBUG_ASSERT(Field_float::type() == binlog_type());
+ return Binlog_type_info(Field_float::type(), pack_length(), 1,
+ binlog_signedness());
}
@@ -4900,6 +4857,24 @@ Item *Field_real::get_equal_const_item(THD *thd, const Context &ctx,
}
+void Field_real::sql_type(String &res) const
+{
+ const Name name= type_handler()->name();
+ if (dec >= FLOATING_POINT_DECIMALS)
+ {
+ res.set_ascii(name.ptr(), name.length());
+ }
+ else
+ {
+ CHARSET_INFO *cs= res.charset();
+ res.length(cs->cset->snprintf(cs,(char*) res.ptr(),res.alloced_length(),
+ "%.*s(%d,%d)", (int) name.length(), name.ptr(),
+ (int) field_length,dec));
+ }
+ add_zerofill_and_unsigned(res);
+}
+
+
String *Field_double::val_str(String *val_buffer,
String *val_ptr __attribute__((unused)))
{
@@ -4936,7 +4911,7 @@ bool Field_double::send_binary(Protocol *protocol)
}
-int Field_double::cmp(const uchar *a_ptr, const uchar *b_ptr)
+int Field_double::cmp(const uchar *a_ptr, const uchar *b_ptr) const
{
double a,b;
float8get(a,a_ptr);
@@ -4967,26 +4942,11 @@ void Field_double::sort_string(uchar *to,uint length __attribute__((unused)))
@returns number of bytes written to metadata_ptr
*/
-int Field_double::save_field_metadata(uchar *metadata_ptr)
+Binlog_type_info Field_double::binlog_type_info() const
{
- *metadata_ptr= pack_length();
- return 1;
-}
-
-
-void Field_double::sql_type(String &res) const
-{
- CHARSET_INFO *cs=res.charset();
- if (dec >= FLOATING_POINT_DECIMALS)
- {
- res.set_ascii(STRING_WITH_LEN("double"));
- }
- else
- {
- res.length(cs->cset->snprintf(cs,(char*) res.ptr(),res.alloced_length(),
- "double(%d,%d)",(int) field_length,dec));
- }
- add_zerofill_and_unsigned(res);
+ DBUG_ASSERT(Field_double::type() == binlog_type());
+ return Binlog_type_info(Field_double::type(), pack_length(), 1,
+ binlog_signedness());
}
@@ -5357,7 +5317,7 @@ bool Field_timestamp::send_binary(Protocol *protocol)
}
-int Field_timestamp::cmp(const uchar *a_ptr, const uchar *b_ptr)
+int Field_timestamp::cmp(const uchar *a_ptr, const uchar *b_ptr) const
{
int32 a,b;
a=sint4korr(a_ptr);
@@ -5553,7 +5513,7 @@ bool Field_timestamp_with_dec::send_binary(Protocol *protocol)
}
-int Field_timestamp_hires::cmp(const uchar *a_ptr, const uchar *b_ptr)
+int Field_timestamp_hires::cmp(const uchar *a_ptr, const uchar *b_ptr) const
{
int32 a,b;
ulong a_sec_part, b_sec_part;
@@ -5626,6 +5586,11 @@ bool Field_timestampf::val_native(Native *to)
return Field::val_native(to);
}
+Binlog_type_info Field_timestampf::binlog_type_info() const
+{
+ return Binlog_type_info(Field_timestampf::binlog_type(), decimals(), 1);
+}
+
/*************************************************************/
sql_mode_t Field_temporal::can_handle_sql_mode_dependency_on_store() const
@@ -6017,7 +5982,7 @@ bool Field_time::send_binary(Protocol *protocol)
}
-int Field_time::cmp(const uchar *a_ptr, const uchar *b_ptr)
+int Field_time::cmp(const uchar *a_ptr, const uchar *b_ptr) const
{
int32 a,b;
a=(int32) sint3korr(a_ptr);
@@ -6205,7 +6170,7 @@ bool Field_time_hires::get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate)
}
-int Field_time_hires::cmp(const uchar *a_ptr, const uchar *b_ptr)
+int Field_time_hires::cmp(const uchar *a_ptr, const uchar *b_ptr) const
{
ulonglong a=read_bigendian(a_ptr, Field_time_hires::pack_length());
ulonglong b=read_bigendian(b_ptr, Field_time_hires::pack_length());
@@ -6251,6 +6216,10 @@ bool Field_timef::get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate)
TIME_from_longlong_time_packed(ltime, tmp);
return false;
}
+Binlog_type_info Field_timef::binlog_type_info() const
+{
+ return Binlog_type_info(Field_timef::binlog_type(), decimals(), 1);
+}
/****************************************************************************
** year type
@@ -6533,7 +6502,7 @@ String *Field_date::val_str(String *val_buffer,
}
-int Field_date::cmp(const uchar *a_ptr, const uchar *b_ptr)
+int Field_date::cmp(const uchar *a_ptr, const uchar *b_ptr) const
{
int32 a,b;
a=sint4korr(a_ptr);
@@ -6637,7 +6606,7 @@ bool Field_newdate::get_TIME(MYSQL_TIME *ltime, const uchar *pos,
}
-int Field_newdate::cmp(const uchar *a_ptr, const uchar *b_ptr)
+int Field_newdate::cmp(const uchar *a_ptr, const uchar *b_ptr) const
{
uint32 a,b;
a=(uint32) uint3korr(a_ptr);
@@ -6831,7 +6800,7 @@ bool Field_datetime::get_TIME(MYSQL_TIME *ltime, const uchar *pos,
}
-int Field_datetime::cmp(const uchar *a_ptr, const uchar *b_ptr)
+int Field_datetime::cmp(const uchar *a_ptr, const uchar *b_ptr) const
{
longlong a,b;
a=sint8korr(a_ptr);
@@ -6933,7 +6902,7 @@ bool Field_datetime_hires::get_TIME(MYSQL_TIME *ltime, const uchar *pos,
}
-int Field_datetime_hires::cmp(const uchar *a_ptr, const uchar *b_ptr)
+int Field_datetime_hires::cmp(const uchar *a_ptr, const uchar *b_ptr) const
{
ulonglong a=read_bigendian(a_ptr, Field_datetime_hires::pack_length());
ulonglong b=read_bigendian(b_ptr, Field_datetime_hires::pack_length());
@@ -6971,6 +6940,10 @@ bool Field_datetimef::get_TIME(MYSQL_TIME *ltime, const uchar *pos,
TIME_from_longlong_datetime_packed(ltime, tmp);
return validate_MMDD(tmp, ltime->month, ltime->day, fuzzydate);
}
+Binlog_type_info Field_datetimef::binlog_type_info() const
+{
+ return Binlog_type_info(Field_datetimef::binlog_type(), decimals(), 1);
+}
/****************************************************************************
** string type
@@ -7052,7 +7025,7 @@ Field_longstr::report_if_important_data(const char *pstr, const char *end,
if ((pstr < end) &&
(thd= get_thd())->count_cuted_fields > CHECK_FIELD_EXPRESSION)
{
- if (test_if_important_data(field_charset, pstr, end))
+ if (test_if_important_data(field_charset(), pstr, end))
{
if (thd->abort_on_warning)
set_warning(ER_DATA_TOO_LONG, 1);
@@ -7084,14 +7057,15 @@ int Field_string::store(const char *from, size_t length,CHARSET_INFO *cs)
rc= well_formed_copy_with_check((char*) ptr, field_length,
cs, from, length,
- field_length / field_charset->mbmaxlen,
+ Field_string::char_length(),
false, &copy_length);
/* Append spaces if the string was shorter than the field. */
if (copy_length < field_length)
- field_charset->cset->fill(field_charset,(char*) ptr+copy_length,
- field_length-copy_length,
- field_charset->pad_char);
+ field_charset()->cset->fill(field_charset(),
+ (char*) ptr + copy_length,
+ field_length - copy_length,
+ field_charset()->pad_char);
return rc;
}
@@ -7101,13 +7075,13 @@ int Field_str::store(longlong nr, bool unsigned_val)
{
char buff[64];
uint length;
- length= (uint) (field_charset->cset->longlong10_to_str)(field_charset,
- buff,
- sizeof(buff),
- (unsigned_val ? 10:
- -10),
- nr);
- return store(buff, length, field_charset);
+ length= (uint) (field_charset()->cset->longlong10_to_str)(field_charset(),
+ buff,
+ sizeof(buff),
+ (unsigned_val ? 10:
+ -10),
+ nr);
+ return store(buff, length, field_charset());
}
@@ -7123,8 +7097,7 @@ int Field_str::store(double nr)
{
DBUG_ASSERT(marked_for_write_or_computed());
char buff[DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE];
- uint local_char_length= MY_MIN(sizeof(buff),
- field_length / field_charset->mbmaxlen);
+ uint local_char_length= MY_MIN(sizeof(buff), Field_str::char_length());
size_t length= 0;
my_bool error= (local_char_length == 0);
@@ -7147,7 +7120,7 @@ bool Field_string::is_equal(const Column_definition &new_field) const
DBUG_ASSERT(!compression_method());
return new_field.type_handler() == type_handler() &&
new_field.char_length == char_length() &&
- new_field.charset == field_charset &&
+ new_field.charset == field_charset() &&
new_field.length == max_display_length();
}
@@ -7233,7 +7206,7 @@ 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)
+ field->field_charset() == &my_charset_bin)
{ }
@@ -7281,12 +7254,13 @@ String *Field_string::val_str(String *val_buffer __attribute__((unused)),
size_t length;
if (get_thd()->variables.sql_mode &
MODE_PAD_CHAR_TO_FULL_LENGTH)
- length= my_charpos(field_charset, ptr, ptr + field_length,
- field_length / field_charset->mbmaxlen);
+ length= my_charpos(field_charset(), ptr, ptr + field_length,
+ Field_string::char_length());
else
- length= field_charset->cset->lengthsp(field_charset, (const char*) ptr,
- field_length);
- val_ptr->set((const char*) ptr, length, field_charset);
+ length= field_charset()->cset->lengthsp(field_charset(),
+ (const char*) ptr,
+ field_length);
+ val_ptr->set((const char*) ptr, length, field_charset());
return val_ptr;
}
@@ -7306,7 +7280,7 @@ my_decimal *Field_string::val_decimal(my_decimal *decimal_value)
struct Check_field_param {
- Field *field;
+ const Field *field;
};
#ifdef HAVE_REPLICATION
@@ -7325,9 +7299,9 @@ check_field_for_37426(const void *param_arg)
bool
Field_string::compatible_field_size(uint field_metadata,
- Relay_log_info *rli_arg,
+ const Relay_log_info *rli_arg,
uint16 mflags __attribute__((unused)),
- int *order_var)
+ int *order_var) const
{
#ifdef HAVE_REPLICATION
const Check_field_param check_param = { this };
@@ -7339,15 +7313,15 @@ Field_string::compatible_field_size(uint field_metadata,
}
-int Field_string::cmp(const uchar *a_ptr, const uchar *b_ptr)
+int Field_string::cmp(const uchar *a_ptr, const uchar *b_ptr) const
{
size_t a_len, b_len;
- if (field_charset->mbmaxlen != 1)
+ if (mbmaxlen() != 1)
{
- size_t char_len= field_length/field_charset->mbmaxlen;
- a_len= my_charpos(field_charset, a_ptr, a_ptr + field_length, char_len);
- b_len= my_charpos(field_charset, b_ptr, b_ptr + field_length, char_len);
+ size_t char_len= Field_string::char_length();
+ a_len= my_charpos(field_charset(), a_ptr, a_ptr + field_length, char_len);
+ b_len= my_charpos(field_charset(), b_ptr, b_ptr + field_length, char_len);
}
else
a_len= b_len= field_length;
@@ -7355,9 +7329,9 @@ int Field_string::cmp(const uchar *a_ptr, const uchar *b_ptr)
We have to remove end space to be able to compare multi-byte-characters
like in latin_de 'ae' and 0xe4
*/
- return field_charset->coll->strnncollsp(field_charset,
- a_ptr, a_len,
- b_ptr, b_len);
+ return field_charset()->coll->strnncollsp(field_charset(),
+ a_ptr, a_len,
+ b_ptr, b_len);
}
@@ -7366,13 +7340,13 @@ void Field_string::sort_string(uchar *to,uint length)
#ifdef DBUG_ASSERT_EXISTS
size_t tmp=
#endif
- field_charset->coll->strnxfrm(field_charset,
- to, length,
- char_length() *
- field_charset->strxfrm_multiply,
- ptr, field_length,
- MY_STRXFRM_PAD_WITH_SPACE |
- MY_STRXFRM_PAD_TO_MAXLEN);
+ field_charset()->coll->strnxfrm(field_charset(),
+ to, length,
+ char_length() *
+ field_charset()->strxfrm_multiply,
+ ptr, field_length,
+ MY_STRXFRM_PAD_WITH_SPACE |
+ MY_STRXFRM_PAD_TO_MAXLEN);
DBUG_ASSERT(tmp == length);
}
@@ -7422,12 +7396,12 @@ void Field_string::sql_rpl_type(String *res) const
uchar *Field_string::pack(uchar *to, const uchar *from, uint max_length)
{
size_t length= MY_MIN(field_length,max_length);
- size_t local_char_length= max_length/field_charset->mbmaxlen;
+ size_t local_char_length= Field_string::char_length();
DBUG_PRINT("debug", ("Packing field '%s' - length: %zu ", field_name.str,
length));
if (length > local_char_length)
- local_char_length= my_charpos(field_charset, from, from+length,
+ local_char_length= my_charpos(field_charset(), from, from + length,
local_char_length);
set_if_smaller(length, local_char_length);
@@ -7437,13 +7411,14 @@ uchar *Field_string::pack(uchar *to, const uchar *from, uint max_length)
(this is for not packing padding adding bytes in BINARY
fields).
*/
- if (field_charset->mbmaxlen == 1)
+ if (mbmaxlen() == 1)
{
- while (length && from[length-1] == field_charset->pad_char)
+ while (length && from[length-1] == field_charset()->pad_char)
length --;
}
else
- length= field_charset->cset->lengthsp(field_charset, (const char*) from, length);
+ length= field_charset()->cset->lengthsp(field_charset(),
+ (const char*) from, length);
// Length always stored little-endian
*to++= (uchar) length;
@@ -7515,7 +7490,10 @@ Field_string::unpack(uchar *to, const uchar *from, const uchar *from_end,
memcpy(to, from, length);
// Pad the string with the pad character of the fields charset
- field_charset->cset->fill(field_charset, (char*) to + length, field_length - length, field_charset->pad_char);
+ field_charset()->cset->fill(field_charset(),
+ (char*) to + length,
+ field_length - length,
+ field_charset()->pad_char);
return from+length;
}
@@ -7550,15 +7528,25 @@ Field_string::unpack(uchar *to, const uchar *from, const uchar *from_end,
@returns number of bytes written to metadata_ptr
*/
-int Field_string::save_field_metadata(uchar *metadata_ptr)
+
+Binlog_type_info_fixed_string::Binlog_type_info_fixed_string(uchar type_code,
+ uint32 octets,
+ CHARSET_INFO *cs)
+ :Binlog_type_info(type_code, 0, 2, cs)
+{
+ DBUG_ASSERT(octets < 1024);
+ DBUG_ASSERT((type_code & 0xF0) == 0xF0);
+ DBUG_PRINT("debug", ("octets: %u, type_code: %u", octets, type_code));
+ m_metadata= (type_code ^ ((octets & 0x300) >> 4)) +
+ (((uint)(octets & 0xFF)) << 8);
+}
+
+
+Binlog_type_info Field_string::binlog_type_info() const
{
- DBUG_ASSERT(field_length < 1024);
- DBUG_ASSERT((real_type() & 0xF0) == 0xF0);
- DBUG_PRINT("debug", ("field_length: %u, real_type: %u",
- field_length, real_type()));
- *metadata_ptr= (real_type() ^ ((field_length & 0x300) >> 4));
- *(metadata_ptr + 1)= field_length & 0xFF;
- return 2;
+ DBUG_ASSERT(Field_string::type() == binlog_type());
+ return Binlog_type_info_fixed_string(Field_string::binlog_type(),
+ field_length, charset());
}
@@ -7578,13 +7566,15 @@ uint Field_string::max_packed_col_length(uint max_length)
uint Field_string::get_key_image(uchar *buff, uint length, imagetype type_arg)
{
- size_t bytes = my_charpos(field_charset, (char*) ptr,
- (char*) ptr + field_length,
- length / field_charset->mbmaxlen);
+ size_t bytes= my_charpos(field_charset(), (char*) ptr,
+ (char*) ptr + field_length,
+ length / mbmaxlen());
memcpy(buff, ptr, bytes);
if (bytes < length)
- field_charset->cset->fill(field_charset, (char*) buff + bytes,
- length - bytes, field_charset->pad_char);
+ field_charset()->cset->fill(field_charset(),
+ (char*) buff + bytes,
+ length - bytes,
+ field_charset()->pad_char);
return (uint)bytes;
}
@@ -7610,6 +7600,12 @@ Field *Field_string::make_new_field(MEM_ROOT *root, TABLE *new_table,
}
+en_fieldtype Field_string::tmp_engine_column_type(bool use_packed_rows) const
+{
+ return field_length >= MIN_STRING_LENGTH_TO_PACK_ROWS ? FIELD_SKIP_ENDSPACE :
+ FIELD_NORMAL;
+}
+
/****************************************************************************
VARCHAR type
Data in field->ptr is stored as:
@@ -7639,13 +7635,23 @@ const uint Field_varstring::MAX_SIZE= UINT_MAX16;
@returns number of bytes written to metadata_ptr
*/
-int Field_varstring::save_field_metadata(uchar *metadata_ptr)
+Binlog_type_info Field_varstring::binlog_type_info() const
{
- DBUG_ASSERT(field_length <= 65535);
- int2store((char*)metadata_ptr, field_length);
- return 2;
+ DBUG_ASSERT(Field_varstring::type() == binlog_type());
+ return Binlog_type_info(Field_varstring::type(), field_length, 2, charset());
}
+
+bool Field_varstring::memcpy_field_possible(const Field *from) const
+{
+ return (Field_str::memcpy_field_possible(from) &&
+ !compression_method() == !from->compression_method() &&
+ length_bytes == ((Field_varstring*) from)->length_bytes &&
+ (table->file && !(table->file->ha_table_flags() &
+ HA_RECORD_MUST_BE_CLEAN_ON_WRITE)));
+}
+
+
int Field_varstring::store(const char *from,size_t length,CHARSET_INFO *cs)
{
DBUG_ASSERT(marked_for_write_or_computed());
@@ -7654,7 +7660,7 @@ int Field_varstring::store(const char *from,size_t length,CHARSET_INFO *cs)
rc= well_formed_copy_with_check((char*) get_data(), field_length,
cs, from, length,
- field_length / field_charset->mbmaxlen,
+ Field_varstring::char_length(),
true, &copy_length);
store_length(copy_length);
@@ -7689,7 +7695,7 @@ String *Field_varstring::val_str(String *val_buffer __attribute__((unused)),
String *val_ptr)
{
DBUG_ASSERT(marked_for_read());
- val_ptr->set((const char*) get_data(), get_length(), field_charset);
+ val_ptr->set((const char*) get_data(), get_length(), field_charset());
return val_ptr;
}
@@ -7709,7 +7715,7 @@ my_decimal *Field_varstring::val_decimal(my_decimal *decimal_value)
int Field_varstring::cmp_max(const uchar *a_ptr, const uchar *b_ptr,
- uint max_len)
+ uint max_len) const
{
uint a_length, b_length;
int diff;
@@ -7726,13 +7732,9 @@ int Field_varstring::cmp_max(const uchar *a_ptr, const uchar *b_ptr,
}
set_if_smaller(a_length, max_len);
set_if_smaller(b_length, max_len);
- diff= field_charset->coll->strnncollsp(field_charset,
- a_ptr+
- length_bytes,
- a_length,
- b_ptr+
- length_bytes,
- b_length);
+ diff= field_charset()->coll->strnncollsp(field_charset(),
+ a_ptr + length_bytes, a_length,
+ b_ptr + length_bytes, b_length);
return diff;
}
@@ -7742,20 +7744,19 @@ int Field_varstring::cmp_max(const uchar *a_ptr, const uchar *b_ptr,
varstring and blob keys are ALWAYS stored with a 2 byte length prefix
*/
-int Field_varstring::key_cmp(const uchar *key_ptr, uint max_key_length)
+int Field_varstring::key_cmp(const uchar *key_ptr, uint max_key_length) const
{
size_t length= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr);
- size_t local_char_length= max_key_length / field_charset->mbmaxlen;
+ size_t local_char_length= max_key_length / mbmaxlen();
- local_char_length= my_charpos(field_charset, ptr + length_bytes,
- ptr + length_bytes + length, local_char_length);
+ local_char_length= my_charpos(field_charset(), ptr + length_bytes,
+ ptr + length_bytes + length, local_char_length);
set_if_smaller(length, local_char_length);
- return field_charset->coll->strnncollsp(field_charset,
- ptr + length_bytes,
- length,
- key_ptr+
- HA_KEY_BLOB_LENGTH,
- uint2korr(key_ptr));
+ return field_charset()->coll->strnncollsp(field_charset(),
+ ptr + length_bytes,
+ length,
+ key_ptr + HA_KEY_BLOB_LENGTH,
+ uint2korr(key_ptr));
}
@@ -7767,13 +7768,13 @@ int Field_varstring::key_cmp(const uchar *key_ptr, uint max_key_length)
(keys are created and compared in key.cc)
*/
-int Field_varstring::key_cmp(const uchar *a,const uchar *b)
+int Field_varstring::key_cmp(const uchar *a,const uchar *b) const
{
- return field_charset->coll->strnncollsp(field_charset,
- a + HA_KEY_BLOB_LENGTH,
- uint2korr(a),
- b + HA_KEY_BLOB_LENGTH,
- uint2korr(b));
+ return field_charset()->coll->strnncollsp(field_charset(),
+ a + HA_KEY_BLOB_LENGTH,
+ uint2korr(a),
+ b + HA_KEY_BLOB_LENGTH,
+ uint2korr(b));
}
@@ -7783,7 +7784,7 @@ void Field_varstring::sort_string(uchar *to,uint length)
val_str(&buf, &buf);
- if (field_charset == &my_charset_bin)
+ if (field_charset() == &my_charset_bin)
{
/* Store length last in high-byte order to sort longer strings first */
if (length_bytes == 1)
@@ -7796,11 +7797,13 @@ void Field_varstring::sort_string(uchar *to,uint length)
#ifdef DBUG_ASSERT_EXISTS
size_t rc=
#endif
- field_charset->coll->strnxfrm(field_charset, to, length,
- char_length() * field_charset->strxfrm_multiply,
- (const uchar*) buf.ptr(), buf.length(),
- MY_STRXFRM_PAD_WITH_SPACE |
- MY_STRXFRM_PAD_TO_MAXLEN);
+ field_charset()->coll->strnxfrm(field_charset(),
+ to, length,
+ char_length() *
+ field_charset()->strxfrm_multiply,
+ (const uchar*) buf.ptr(), buf.length(),
+ MY_STRXFRM_PAD_WITH_SPACE |
+ MY_STRXFRM_PAD_TO_MAXLEN);
DBUG_ASSERT(rc == length);
}
@@ -7964,7 +7967,7 @@ uint Field_varstring::get_key_image(uchar *buff, uint length,
val_str(&val, &val);
dbug_tmp_restore_column_map(table->read_set, old_map);
- local_char_length= val.charpos(length / field_charset->mbmaxlen);
+ local_char_length= val.charpos(length / mbmaxlen());
if (local_char_length < val.length())
val.length(local_char_length);
/* Key is always stored with 2 bytes */
@@ -7985,12 +7988,12 @@ uint Field_varstring::get_key_image(uchar *buff, uint length,
void Field_varstring::set_key_image(const uchar *buff,uint length)
{
length= uint2korr(buff); // Real length is here
- (void) store((const char*) buff + HA_KEY_BLOB_LENGTH, length, field_charset);
+ (void) store((const char*) buff + HA_KEY_BLOB_LENGTH, length, field_charset());
}
int Field_varstring::cmp_binary(const uchar *a_ptr, const uchar *b_ptr,
- uint32 max_length)
+ uint32 max_length) const
{
uint32 a_length,b_length;
@@ -8045,7 +8048,7 @@ bool Field_varstring::is_equal(const Column_definition &new_field) const
new_field.length == field_length &&
new_field.char_length == char_length() &&
!new_field.compression_method() == !compression_method() &&
- new_field.charset == field_charset;
+ new_field.charset == field_charset();
}
@@ -8109,10 +8112,10 @@ int Field_longstr::compress(char *to, uint to_length,
uint buf_length;
int rc= 0;
- if (String::needs_conversion_on_storage(length, cs, field_charset) ||
+ if (String::needs_conversion_on_storage(length, cs, field_charset()) ||
max_length < length)
{
- set_if_smaller(max_length, static_cast<ulonglong>(field_charset->mbmaxlen) * length + 1);
+ set_if_smaller(max_length, static_cast<ulonglong>(mbmaxlen()) * length + 1);
if (!(buf= (char*) my_malloc(max_length, MYF(MY_WME))))
{
*out_length= 0;
@@ -8163,7 +8166,7 @@ int Field_longstr::compress(char *to, uint to_length,
*/
String *Field_longstr::uncompress(String *val_buffer, String *val_ptr,
- const uchar *from, uint from_length)
+ const uchar *from, uint from_length) const
{
if (from_length)
{
@@ -8172,7 +8175,7 @@ String *Field_longstr::uncompress(String *val_buffer, String *val_ptr,
/* Uncompressed data */
if (!method)
{
- val_ptr->set((const char*) from + 1, from_length - 1, field_charset);
+ val_ptr->set((const char*) from + 1, from_length - 1, field_charset());
return val_ptr;
}
@@ -8181,7 +8184,7 @@ String *Field_longstr::uncompress(String *val_buffer, String *val_ptr,
if (!compression_methods[method].uncompress(val_buffer, from, from_length,
field_length))
{
- val_buffer->set_charset(field_charset);
+ val_buffer->set_charset(field_charset());
status_var_increment(get_thd()->status_var.column_decompressions);
return val_buffer;
}
@@ -8193,7 +8196,7 @@ String *Field_longstr::uncompress(String *val_buffer, String *val_ptr,
safer route, let's return a zero string and let the general
handler catch the error.
*/
- val_ptr->set("", 0, field_charset);
+ val_ptr->set("", 0, field_charset());
return val_ptr;
}
@@ -8225,7 +8228,7 @@ double Field_varstring_compressed::val_real(void)
THD *thd= get_thd();
String buf;
val_str(&buf, &buf);
- return Converter_strntod_with_warn(thd, Warn_filter(thd), field_charset,
+ return Converter_strntod_with_warn(thd, Warn_filter(thd), field_charset(),
buf.ptr(), buf.length()).result();
}
@@ -8236,13 +8239,13 @@ longlong Field_varstring_compressed::val_int(void)
THD *thd= get_thd();
String buf;
val_str(&buf, &buf);
- return Converter_strntoll_with_warn(thd, Warn_filter(thd), field_charset,
+ return Converter_strntoll_with_warn(thd, Warn_filter(thd), field_charset(),
buf.ptr(), buf.length()).result();
}
int Field_varstring_compressed::cmp_max(const uchar *a_ptr, const uchar *b_ptr,
- uint max_len)
+ uint max_len) const
{
String a, b;
uint a_length, b_length;
@@ -8266,7 +8269,12 @@ int Field_varstring_compressed::cmp_max(const uchar *a_ptr, const uchar *b_ptr,
if (b.length() > max_len)
b.length(max_len);
- return sortcmp(&a, &b, field_charset);
+ return sortcmp(&a, &b, field_charset());
+}
+Binlog_type_info Field_varstring_compressed::binlog_type_info() const
+{
+ return Binlog_type_info(Field_varstring_compressed::binlog_type(),
+ field_length, 2, charset());
}
@@ -8311,7 +8319,7 @@ uint32 Field_blob::get_length(const uchar *pos, uint packlength_arg) const
*/
int Field_blob::copy_value(Field_blob *from)
{
- DBUG_ASSERT(field_charset == from->charset());
+ DBUG_ASSERT(field_charset() == from->charset());
DBUG_ASSERT(!compression_method() == !from->compression_method());
int rc= 0;
uint32 length= from->get_length();
@@ -8319,7 +8327,7 @@ int Field_blob::copy_value(Field_blob *from)
if (packlength < from->packlength)
{
set_if_smaller(length, Field_blob::max_data_length());
- length= (uint32) Well_formed_prefix(field_charset,
+ length= (uint32) Well_formed_prefix(field_charset(),
(const char *) data, length).length();
rc= report_if_important_data((const char *) data + length,
(const char *) data + from->get_length(),
@@ -8356,7 +8364,7 @@ int Field_blob::store(const char *from,size_t length,CHARSET_INFO *cs)
if (table && table->blob_storage) // GROUP_CONCAT with ORDER BY | DISTINCT
{
DBUG_ASSERT(!f_is_hex_escape(flags));
- DBUG_ASSERT(field_charset == cs);
+ DBUG_ASSERT(field_charset() == cs);
DBUG_ASSERT(length <= max_data_length());
new_length= length;
@@ -8387,7 +8395,7 @@ int Field_blob::store(const char *from,size_t length,CHARSET_INFO *cs)
If content of the 'from'-address is cached in the 'value'-object
it is possible that the content needs a character conversion.
*/
- if (!String::needs_conversion_on_storage(length, cs, field_charset))
+ if (!String::needs_conversion_on_storage(length, cs, field_charset()))
{
Field_blob::store_length(length);
bmove(ptr + packlength, &from, sizeof(char*));
@@ -8398,14 +8406,14 @@ int Field_blob::store(const char *from,size_t length,CHARSET_INFO *cs)
from= tmpstr.ptr();
}
- new_length= MY_MIN(max_data_length(), field_charset->mbmaxlen * length);
+ new_length= MY_MIN(max_data_length(), mbmaxlen() * length);
if (value.alloc(new_length))
goto oom_error;
tmp= const_cast<char*>(value.ptr());
if (f_is_hex_escape(flags))
{
- copy_length= my_copy_with_hex_escaping(field_charset,
+ copy_length= my_copy_with_hex_escaping(field_charset(),
tmp, new_length,
from, length);
Field_blob::store_length(copy_length);
@@ -8493,15 +8501,15 @@ my_decimal *Field_blob::val_decimal(my_decimal *decimal_value)
int Field_blob::cmp(const uchar *a,uint32 a_length, const uchar *b,
- uint32 b_length)
+ uint32 b_length) const
{
- return field_charset->coll->strnncollsp(field_charset,
- a, a_length, b, b_length);
+ return field_charset()->coll->strnncollsp(field_charset(),
+ a, a_length, b, b_length);
}
int Field_blob::cmp_max(const uchar *a_ptr, const uchar *b_ptr,
- uint max_length)
+ uint max_length) const
{
uchar *blob1,*blob2;
memcpy(&blob1, a_ptr+packlength, sizeof(char*));
@@ -8514,7 +8522,7 @@ int Field_blob::cmp_max(const uchar *a_ptr, const uchar *b_ptr,
int Field_blob::cmp_binary(const uchar *a_ptr, const uchar *b_ptr,
- uint32 max_length)
+ uint32 max_length) const
{
char *a,*b;
uint diff;
@@ -8534,43 +8542,12 @@ int Field_blob::cmp_binary(const uchar *a_ptr, const uchar *b_ptr,
/* The following is used only when comparing a key */
-uint Field_blob::get_key_image(uchar *buff,uint length, imagetype type_arg)
+uint Field_blob::get_key_image_itRAW(uchar *buff, uint length)
{
size_t blob_length= get_length(ptr);
- uchar *blob;
-
-#ifdef HAVE_SPATIAL
- if (type_arg == itMBR)
- {
- const char *dummy;
- MBR mbr;
- Geometry_buffer buffer;
- Geometry *gobj;
- const uint image_length= SIZEOF_STORED_DOUBLE*4;
-
- if (blob_length < SRID_SIZE)
- {
- bzero(buff, image_length);
- return image_length;
- }
- blob= get_ptr();
- gobj= Geometry::construct(&buffer, (char*) blob, (uint32)blob_length);
- if (!gobj || gobj->get_mbr(&mbr, &dummy))
- bzero(buff, image_length);
- else
- {
- float8store(buff, mbr.xmin);
- float8store(buff+8, mbr.xmax);
- float8store(buff+16, mbr.ymin);
- float8store(buff+24, mbr.ymax);
- }
- return image_length;
- }
-#endif /*HAVE_SPATIAL*/
-
- blob= get_ptr();
- size_t local_char_length= length / field_charset->mbmaxlen;
- local_char_length= my_charpos(field_charset, blob, blob + blob_length,
+ uchar *blob= get_ptr();
+ size_t local_char_length= length / mbmaxlen();
+ local_char_length= my_charpos(field_charset(), blob, blob + blob_length,
local_char_length);
set_if_smaller(blob_length, local_char_length);
@@ -8593,11 +8570,11 @@ void Field_blob::set_key_image(const uchar *buff,uint length)
{
length= uint2korr(buff);
(void) Field_blob::store((const char*) buff+HA_KEY_BLOB_LENGTH, length,
- field_charset);
+ field_charset());
}
-int Field_blob::key_cmp(const uchar *key_ptr, uint max_key_length)
+int Field_blob::key_cmp(const uchar *key_ptr, uint max_key_length) const
{
uchar *blob1;
size_t blob_length=get_length(ptr);
@@ -8612,7 +8589,7 @@ int Field_blob::key_cmp(const uchar *key_ptr, uint max_key_length)
uint2korr(key_ptr));
}
-int Field_blob::key_cmp(const uchar *a,const uchar *b)
+int Field_blob::key_cmp(const uchar *a,const uchar *b) const
{
return Field_blob::cmp(a+HA_KEY_BLOB_LENGTH, uint2korr(a),
b+HA_KEY_BLOB_LENGTH, uint2korr(b));
@@ -8643,19 +8620,18 @@ Field *Field_blob::new_key_field(MEM_ROOT *root, TABLE *new_table,
@returns number of bytes written to metadata_ptr
*/
-int Field_blob::save_field_metadata(uchar *metadata_ptr)
+Binlog_type_info Field_blob::binlog_type_info() const
{
- DBUG_ENTER("Field_blob::save_field_metadata");
- *metadata_ptr= pack_length_no_ptr();
- DBUG_PRINT("debug", ("metadata: %u (pack_length_no_ptr)", *metadata_ptr));
- DBUG_RETURN(1);
+ DBUG_ASSERT(Field_blob::type() == binlog_type());
+ return Binlog_type_info(Field_blob::type(), pack_length_no_ptr(), 1,
+ charset());
}
uint32 Field_blob::sort_length() const
{
return (uint32) (get_thd()->variables.max_sort_length +
- (field_charset == &my_charset_bin ? 0 : packlength));
+ (field_charset() == &my_charset_bin ? 0 : packlength));
}
@@ -8664,11 +8640,11 @@ void Field_blob::sort_string(uchar *to,uint length)
String buf;
val_str(&buf, &buf);
- if (!buf.length() && field_charset->pad_char == 0)
+ if (!buf.length() && field_charset()->pad_char == 0)
bzero(to,length);
else
{
- if (field_charset == &my_charset_bin)
+ if (field_charset() == &my_charset_bin)
{
/*
Store length of blob last in blob to shorter blobs before longer blobs
@@ -8680,10 +8656,10 @@ void Field_blob::sort_string(uchar *to,uint length)
#ifdef DBUG_ASSERT_EXISTS
size_t rc=
#endif
- field_charset->coll->strnxfrm(field_charset, to, length, length,
- (const uchar*) buf.ptr(), buf.length(),
- MY_STRXFRM_PAD_WITH_SPACE |
- MY_STRXFRM_PAD_TO_MAXLEN);
+ field_charset()->coll->strnxfrm(field_charset(), to, length, length,
+ (const uchar*) buf.ptr(), buf.length(),
+ MY_STRXFRM_PAD_WITH_SPACE |
+ MY_STRXFRM_PAD_TO_MAXLEN);
DBUG_ASSERT(rc == length);
}
}
@@ -8818,7 +8794,7 @@ bool Field_blob::is_equal(const Column_definition &new_field) const
return new_field.type_handler() == type_handler() &&
!new_field.compression_method() == !compression_method() &&
new_field.pack_length == pack_length() &&
- new_field.charset == field_charset;
+ new_field.charset == field_charset();
}
@@ -8854,8 +8830,7 @@ int Field_blob_compressed::store(const char *from, size_t length,
DBUG_ASSERT(marked_for_write_or_computed());
uint compressed_length;
uint max_length= max_data_length();
- uint to_length= (uint) MY_MIN(max_length,
- field_charset->mbmaxlen * length + 1);
+ uint to_length= (uint) MY_MIN(max_length, mbmaxlen() * length + 1);
String tmp(from, length, cs);
int rc;
@@ -8889,7 +8864,7 @@ double Field_blob_compressed::val_real(void)
THD *thd= get_thd();
String buf;
val_str(&buf, &buf);
- return Converter_strntod_with_warn(thd, Warn_filter(thd), field_charset,
+ return Converter_strntod_with_warn(thd, Warn_filter(thd), field_charset(),
buf.ptr(), buf.length()).result();
}
@@ -8900,277 +8875,16 @@ longlong Field_blob_compressed::val_int(void)
THD *thd= get_thd();
String buf;
val_str(&buf, &buf);
- return Converter_strntoll_with_warn(thd, Warn_filter(thd), field_charset,
+ return Converter_strntoll_with_warn(thd, Warn_filter(thd), field_charset(),
buf.ptr(), buf.length()).result();
}
-
-#ifdef HAVE_SPATIAL
-/* Values 1-40 reserved for 1-byte options,
- 41-80 for 2-byte options,
- 81-120 for 4-byte options,
- 121-160 for 8-byte options,
- other - varied length in next 1-3 bytes.
-*/
-enum extra2_gis_field_options {
- FIELDGEOM_END=0,
- FIELDGEOM_STORAGE_MODEL=1,
- FIELDGEOM_PRECISION=2,
- FIELDGEOM_SCALE=3,
- FIELDGEOM_SRID=81,
-};
-
-
-uint gis_field_options_image(uchar *buff, List<Create_field> &create_fields)
-{
- uint image_size= 0;
- List_iterator<Create_field> it(create_fields);
- Create_field *field;
- while ((field= it++))
- {
- if (field->real_field_type() != MYSQL_TYPE_GEOMETRY)
- continue;
- if (buff)
- {
- uchar *cbuf= buff + image_size;
-
- cbuf[0]= FIELDGEOM_STORAGE_MODEL;
- cbuf[1]= (uchar) Field_geom::GEOM_STORAGE_WKB;
-
- cbuf[2]= FIELDGEOM_PRECISION;
- cbuf[3]= (uchar) field->length;
-
- cbuf[4]= FIELDGEOM_SCALE;
- cbuf[5]= (uchar) field->decimals;
-
- cbuf[6]= FIELDGEOM_SRID;
- int4store(cbuf + 7, ((uint32) field->srid));
-
- cbuf[11]= FIELDGEOM_END;
- }
- image_size+= 12;
- }
-
- return image_size;
-}
-
-
-uint gis_field_options_read(const uchar *buf, size_t buf_len,
- Field_geom::storage_type *st_type,uint *precision, uint *scale, uint *srid)
-{
- const uchar *buf_end= buf + buf_len;
- const uchar *cbuf= buf;
- int option_id;
-
- *precision= *scale= *srid= 0;
- *st_type= Field_geom::GEOM_STORAGE_WKB;
-
- if (!buf) /* can only happen with the old FRM file */
- goto end_of_record;
-
- while (cbuf < buf_end)
- {
- switch ((option_id= *(cbuf++)))
- {
- case FIELDGEOM_STORAGE_MODEL:
- *st_type= (Field_geom::storage_type) cbuf[0];
- break;
- case FIELDGEOM_PRECISION:
- *precision= cbuf[0];
- break;
- case FIELDGEOM_SCALE:
- *scale= cbuf[0];
- break;
- case FIELDGEOM_SRID:
- *srid= uint4korr(cbuf);
- break;
- case FIELDGEOM_END:
- goto end_of_record;
- }
- if (option_id > 0 && option_id <= 40)
- cbuf+= 1;
- else if (option_id > 40 && option_id <= 80)
- cbuf+= 2;
- else if (option_id > 80 && option_id <= 120)
- cbuf+= 4;
- else if (option_id > 120 && option_id <= 160)
- cbuf+= 8;
- else /* > 160 and <=255 */
- cbuf+= cbuf[0] ? 1 + cbuf[0] : 3 + uint2korr(cbuf+1);
- }
-
-end_of_record:
- return (uint)(cbuf - buf);
-}
-
-
-
-void Field_geom::sql_type(String &res) const
-{
- CHARSET_INFO *cs= &my_charset_latin1;
- switch (geom_type)
- {
- case GEOM_POINT:
- res.set(STRING_WITH_LEN("point"), cs);
- break;
- case GEOM_LINESTRING:
- res.set(STRING_WITH_LEN("linestring"), cs);
- break;
- case GEOM_POLYGON:
- res.set(STRING_WITH_LEN("polygon"), cs);
- break;
- case GEOM_MULTIPOINT:
- res.set(STRING_WITH_LEN("multipoint"), cs);
- break;
- case GEOM_MULTILINESTRING:
- res.set(STRING_WITH_LEN("multilinestring"), cs);
- break;
- case GEOM_MULTIPOLYGON:
- res.set(STRING_WITH_LEN("multipolygon"), cs);
- break;
- case GEOM_GEOMETRYCOLLECTION:
- res.set(STRING_WITH_LEN("geometrycollection"), cs);
- break;
- default:
- res.set(STRING_WITH_LEN("geometry"), cs);
- }
-}
-
-
-int Field_geom::store(double nr)
-{
- my_message(ER_CANT_CREATE_GEOMETRY_OBJECT,
- ER_THD(get_thd(), ER_CANT_CREATE_GEOMETRY_OBJECT), MYF(0));
- return -1;
-}
-
-
-int Field_geom::store(longlong nr, bool unsigned_val)
-{
- my_message(ER_CANT_CREATE_GEOMETRY_OBJECT,
- ER_THD(get_thd(), ER_CANT_CREATE_GEOMETRY_OBJECT), MYF(0));
- return -1;
-}
-
-
-int Field_geom::store_decimal(const my_decimal *)
-{
- my_message(ER_CANT_CREATE_GEOMETRY_OBJECT,
- ER_THD(get_thd(), ER_CANT_CREATE_GEOMETRY_OBJECT), MYF(0));
- return -1;
-}
-
-
-int Field_geom::store(const char *from, size_t length, CHARSET_INFO *cs)
-{
- if (!length)
- bzero(ptr, Field_blob::pack_length());
- else
- {
- if (from == Geometry::bad_geometry_data.ptr())
- goto err;
- // Check given WKB
- uint32 wkb_type;
- if (length < SRID_SIZE + WKB_HEADER_SIZE + 4)
- goto err;
- wkb_type= uint4korr(from + SRID_SIZE + 1);
- if (wkb_type < (uint32) Geometry::wkb_point ||
- wkb_type > (uint32) Geometry::wkb_last)
- goto err;
-
- if (geom_type != Field::GEOM_GEOMETRY &&
- geom_type != Field::GEOM_GEOMETRYCOLLECTION &&
- (uint32) geom_type != wkb_type)
- {
- const char *db= table->s->db.str;
- const char *tab_name= table->s->table_name.str;
-
- if (!db)
- db= "";
- if (!tab_name)
- tab_name= "";
-
- my_error(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, MYF(0),
- Geometry::ci_collection[geom_type]->m_name.str,
- Geometry::ci_collection[wkb_type]->m_name.str,
- db, tab_name, field_name.str,
- (ulong) table->in_use->get_stmt_da()->
- current_row_for_warning());
- goto err_exit;
- }
-
- Field_blob::store_length(length);
- if ((table->copy_blobs || length <= MAX_FIELD_WIDTH) &&
- from != value.ptr())
- { // Must make a copy
- value.copy(from, length, cs);
- from= value.ptr();
- }
- bmove(ptr + packlength, &from, sizeof(char*));
- }
- return 0;
-
-err:
- my_message(ER_CANT_CREATE_GEOMETRY_OBJECT,
- 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;
-}
-
-
-bool Field_geom::is_equal(const Column_definition &new_field) const
+Binlog_type_info Field_blob_compressed::binlog_type_info() const
{
- return new_field.type_handler() == type_handler() &&
- /*
- - Allow ALTER..INPLACE to supertype (GEOMETRY),
- e.g. POINT to GEOMETRY or POLYGON to GEOMETRY.
- - Allow ALTER..INPLACE to the same geometry type: POINT -> POINT
- */
- (new_field.geom_type == geom_type ||
- new_field.geom_type == GEOM_GEOMETRY);
+ return Binlog_type_info(Field_blob_compressed::binlog_type(),
+ pack_length_no_ptr(), 1, charset());
}
-
-bool Field_geom::can_optimize_range(const Item_bool_func *cond,
- const Item *item,
- bool is_eq_func) const
-{
- return item->cmp_type() == STRING_RESULT;
-}
-
-
-bool Field_geom::load_data_set_no_data(THD *thd, bool fixed_format)
-{
- return Field_geom::load_data_set_null(thd);
-}
-
-
-bool Field_geom::load_data_set_null(THD *thd)
-{
- Field_blob::reset();
- if (!maybe_null())
- {
- my_error(ER_WARN_NULL_TO_NOTNULL, MYF(0), field_name.str,
- thd->get_stmt_da()->current_row_for_warning());
- return true;
- }
- set_null();
- set_has_explicit_value(); // Do not auto-update this field
- return false;
-}
-
-
-#endif /*HAVE_SPATIAL*/
-
/****************************************************************************
** enum type.
** This is a string which only can have a selection of different values.
@@ -9214,17 +8928,17 @@ int Field_enum::store(const char *from,size_t length,CHARSET_INFO *cs)
String tmpstr(buff,sizeof(buff), &my_charset_bin);
/* Convert character set if necessary */
- if (String::needs_conversion_on_storage(length, cs, field_charset))
+ if (String::needs_conversion_on_storage(length, cs, field_charset()))
{
uint dummy_errors;
- tmpstr.copy(from, length, cs, field_charset, &dummy_errors);
+ tmpstr.copy(from, length, cs, field_charset(), &dummy_errors);
from= tmpstr.ptr();
length= tmpstr.length();
}
/* Remove end space */
- length= (uint)field_charset->cset->lengthsp(field_charset, from, length);
- uint tmp=find_type2(typelib, from, length, field_charset);
+ length= (uint)field_charset()->cset->lengthsp(field_charset(), from, length);
+ uint tmp=find_type2(typelib, from, length, field_charset());
if (!tmp)
{
if (length < 6) // Can't be more than 99999 enums
@@ -9285,9 +8999,13 @@ double Field_enum::val_real(void)
longlong Field_enum::val_int(void)
{
DBUG_ASSERT(marked_for_read());
- return read_lowendian(ptr, packlength);
+ return val_int(ptr);
}
+longlong Field_enum::val_int(const uchar *real_ptr) const
+{
+ return read_lowendian(real_ptr, packlength);
+}
/**
Save the field metadata for enum fields.
@@ -9300,11 +9018,11 @@ longlong Field_enum::val_int(void)
@returns number of bytes written to metadata_ptr
*/
-int Field_enum::save_field_metadata(uchar *metadata_ptr)
+Binlog_type_info Field_enum::binlog_type_info() const
{
- *metadata_ptr= real_type();
- *(metadata_ptr + 1)= pack_length();
- return 2;
+ DBUG_ASSERT(Field_enum::type() == binlog_type());
+ return Binlog_type_info(Field_enum::type(), real_type() + (pack_length() << 8),
+ 2, charset(), (TYPELIB *)get_typelib(), NULL);
}
@@ -9313,22 +9031,18 @@ String *Field_enum::val_str(String *val_buffer __attribute__((unused)),
{
uint tmp=(uint) Field_enum::val_int();
if (!tmp || tmp > typelib->count)
- val_ptr->set("", 0, field_charset);
+ val_ptr->set("", 0, field_charset());
else
val_ptr->set((const char*) typelib->type_names[tmp-1],
typelib->type_lengths[tmp-1],
- field_charset);
+ field_charset());
return val_ptr;
}
-int Field_enum::cmp(const uchar *a_ptr, const uchar *b_ptr)
+int Field_enum::cmp(const uchar *a_ptr, const uchar *b_ptr) const
{
- uchar *old= ptr;
- ptr= (uchar*) a_ptr;
- ulonglong a=Field_enum::val_int();
- ptr= (uchar*) b_ptr;
- ulonglong b=Field_enum::val_int();
- ptr= old;
+ ulonglong a=Field_enum::val_int(a_ptr);
+ ulonglong b=Field_enum::val_int(b_ptr);
return (a < b) ? -1 : (a > b) ? 1 : 0;
}
@@ -9400,14 +9114,14 @@ int Field_set::store(const char *from,size_t length,CHARSET_INFO *cs)
String tmpstr(buff,sizeof(buff), &my_charset_bin);
/* Convert character set if necessary */
- if (String::needs_conversion_on_storage(length, cs, field_charset))
+ if (String::needs_conversion_on_storage(length, cs, field_charset()))
{
uint dummy_errors;
- tmpstr.copy(from, length, cs, field_charset, &dummy_errors);
+ tmpstr.copy(from, length, cs, field_charset(), &dummy_errors);
from= tmpstr.ptr();
length= tmpstr.length();
}
- ulonglong tmp= find_set(typelib, from, length, field_charset,
+ ulonglong tmp= find_set(typelib, from, length, field_charset(),
&not_used, &not_used2, &got_warning);
if (!tmp && length && length < 22)
{
@@ -9467,7 +9181,7 @@ String *Field_set::val_str(String *val_buffer,
return val_buffer;
}
- val_buffer->set_charset(field_charset);
+ val_buffer->set_charset(field_charset());
val_buffer->length(0);
while (tmp && bitnr < (uint) typelib->count)
@@ -9478,7 +9192,7 @@ String *Field_set::val_str(String *val_buffer,
val_buffer->append(&field_separator, 1, &my_charset_latin1);
String str(typelib->type_names[bitnr],
typelib->type_lengths[bitnr],
- field_charset);
+ field_charset());
val_buffer->append(str);
}
tmp>>=1;
@@ -9511,6 +9225,13 @@ void Field_set::sql_type(String &res) const
res.append(')');
}
+Binlog_type_info Field_set::binlog_type_info() const
+{
+ DBUG_ASSERT(Field_set::type() == binlog_type());
+ return Binlog_type_info(Field_set::type(), real_type()
+ + (pack_length() << 8), 2, charset(), NULL, (TYPELIB *)get_typelib());
+}
+
/**
@retval
1 if the fields are equally defined
@@ -9533,7 +9254,8 @@ bool Field::eq_def(const Field *field) const
@return TRUE if the type names of t1 match those of t2. FALSE otherwise.
*/
-static bool compare_type_names(CHARSET_INFO *charset, TYPELIB *t1, TYPELIB *t2)
+static bool compare_type_names(CHARSET_INFO *charset, const TYPELIB *t1,
+ const TYPELIB *t2)
{
for (uint i= 0; i < t1->count; i++)
if (my_strnncoll(charset,
@@ -9552,7 +9274,7 @@ static bool compare_type_names(CHARSET_INFO *charset, TYPELIB *t1, TYPELIB *t2)
bool Field_enum::eq_def(const Field *field) const
{
- TYPELIB *values;
+ const TYPELIB *values;
if (!Field::eq_def(field))
return FALSE;
@@ -9563,7 +9285,7 @@ bool Field_enum::eq_def(const Field *field) const
if (typelib->count != values->count)
return FALSE;
- return compare_type_names(field_charset, typelib, values);
+ return compare_type_names(field_charset(), typelib, values);
}
@@ -9578,14 +9300,14 @@ bool Field_enum::eq_def(const Field *field) const
bool Field_enum::is_equal(const Column_definition &new_field) const
{
- TYPELIB *values= new_field.interval;
+ const TYPELIB *values= new_field.interval;
/*
The fields are compatible if they have the same flags,
type, charset and have the same underlying length.
*/
if (new_field.type_handler() != type_handler() ||
- new_field.charset != field_charset ||
+ new_field.charset != field_charset() ||
new_field.pack_length != pack_length())
return false;
@@ -9598,7 +9320,7 @@ bool Field_enum::is_equal(const Column_definition &new_field) const
return false;
/* Check whether there are modification before the end. */
- if (! compare_type_names(field_charset, typelib, new_field.interval))
+ if (! compare_type_names(field_charset(), typelib, new_field.interval))
return false;
return true;
@@ -9760,6 +9482,14 @@ Field_bit::Field_bit(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
}
+const DTCollation & Field_bit::dtcollation() const
+{
+ static DTCollation tmp(&my_charset_bin,
+ DERIVATION_IMPLICIT, MY_REPERTOIRE_UNICODE30);
+ return tmp;
+}
+
+
void Field_bit::hash(ulong *nr, ulong *nr2)
{
if (is_null())
@@ -9968,7 +9698,7 @@ my_decimal *Field_bit::val_decimal(my_decimal *deciaml_value)
The a and b pointer must be pointers to the field in a record
(not the table->record[0] necessarily)
*/
-int Field_bit::cmp_max(const uchar *a, const uchar *b, uint max_len)
+int Field_bit::cmp_max(const uchar *a, const uchar *b, uint max_len) const
{
my_ptrdiff_t a_diff= a - ptr;
my_ptrdiff_t b_diff= b - ptr;
@@ -9986,7 +9716,7 @@ int Field_bit::cmp_max(const uchar *a, const uchar *b, uint max_len)
}
-int Field_bit::key_cmp(const uchar *str, uint length)
+int Field_bit::key_cmp(const uchar *str, uint length) const
{
if (bit_len)
{
@@ -10030,33 +9760,6 @@ uint Field_bit::get_key_image(uchar *buff, uint length, imagetype type_arg)
/**
- Save the field metadata for bit fields.
-
- Saves the bit length in the first byte and bytes in record in the
- second byte of the field metadata array at index of *metadata_ptr and
- *(metadata_ptr + 1).
-
- @param metadata_ptr First byte of field metadata
-
- @returns number of bytes written to metadata_ptr
-*/
-int Field_bit::save_field_metadata(uchar *metadata_ptr)
-{
- DBUG_ENTER("Field_bit::save_field_metadata");
- DBUG_PRINT("debug", ("bit_len: %d, bytes_in_rec: %d",
- bit_len, bytes_in_rec));
- /*
- Since this class and Field_bit_as_char have different ideas of
- what should be stored here, we compute the values of the metadata
- explicitly using the field_length.
- */
- metadata_ptr[0]= field_length % 8;
- metadata_ptr[1]= field_length / 8;
- DBUG_RETURN(2);
-}
-
-
-/**
Returns the number of bytes field uses in row-based replication
row packed size.
@@ -10068,7 +9771,7 @@ int Field_bit::save_field_metadata(uchar *metadata_ptr)
@returns The size of the field based on the field metadata.
*/
-uint Field_bit::pack_length_from_metadata(uint field_metadata)
+uint Field_bit::pack_length_from_metadata(uint field_metadata) const
{
uint const from_len= (field_metadata >> 8U) & 0x00ff;
uint const from_bit_len= field_metadata & 0x00ff;
@@ -10079,9 +9782,9 @@ uint Field_bit::pack_length_from_metadata(uint field_metadata)
bool
Field_bit::compatible_field_size(uint field_metadata,
- Relay_log_info * __attribute__((unused)),
+ const Relay_log_info * __attribute__((unused)),
uint16 mflags,
- int *order_var)
+ int *order_var) const
{
DBUG_ENTER("Field_bit::compatible_field_size");
DBUG_ASSERT((field_metadata >> 16) == 0);
@@ -10311,7 +10014,8 @@ bool Column_definition::create_interval_from_interval_list(MEM_ROOT *mem_root,
{
DBUG_ENTER("Column_definition::create_interval_from_interval_list");
DBUG_ASSERT(!interval);
- if (!(interval= (TYPELIB*) alloc_root(mem_root, sizeof(TYPELIB))))
+ TYPELIB *tmpint;
+ if (!(interval= tmpint= (TYPELIB*) alloc_root(mem_root, sizeof(TYPELIB))))
DBUG_RETURN(true); // EOM
List_iterator<String> it(interval_list);
@@ -10325,17 +10029,17 @@ bool Column_definition::create_interval_from_interval_list(MEM_ROOT *mem_root,
DBUG_ASSERT(comma_length >= 0 && comma_length <= (int) sizeof(comma_buf));
if (!multi_alloc_root(mem_root,
- &interval->type_names,
+ &tmpint->type_names,
sizeof(char*) * (interval_list.elements + 1),
- &interval->type_lengths,
+ &tmpint->type_lengths,
sizeof(uint) * (interval_list.elements + 1),
NullS))
goto err; // EOM
- interval->name= "";
- interval->count= interval_list.elements;
+ tmpint->name= "";
+ tmpint->count= interval_list.elements;
- for (uint i= 0; i < interval->count; i++)
+ for (uint i= 0; i < interval_list.elements; i++)
{
uint32 dummy;
String *tmp= it++;
@@ -10373,11 +10077,11 @@ bool Column_definition::create_interval_from_interval_list(MEM_ROOT *mem_root,
goto err;
}
}
- interval->type_names[i]= value.str;
- interval->type_lengths[i]= (uint)value.length;
+ tmpint->type_names[i]= value.str;
+ tmpint->type_lengths[i]= (uint)value.length;
}
- interval->type_names[interval->count]= 0; // End marker
- interval->type_lengths[interval->count]= 0;
+ tmpint->type_names[interval_list.elements]= 0; // End marker
+ tmpint->type_lengths[interval_list.elements]= 0;
interval_list.empty(); // Don't need interval_list anymore
DBUG_RETURN(false);
err:
@@ -10469,13 +10173,11 @@ void Column_definition::create_length_to_internal_length_bit()
{
if (f_bit_as_char(pack_flag))
{
- key_length= pack_length= ((length + 7) & ~7) / 8;
+ pack_length= ((length + 7) & ~7) / 8;
}
else
{
pack_length= (uint) length / 8;
- /* We need one extra byte to store the bits we save among the null bits */
- key_length= pack_length + MY_TEST(length & 7);
}
}
@@ -10484,11 +10186,11 @@ void Column_definition::create_length_to_internal_length_newdecimal()
{
DBUG_ASSERT(length < UINT_MAX32);
uint prec= get_decimal_precision((uint)length, decimals, flags & UNSIGNED_FLAG);
- key_length= pack_length= my_decimal_get_binary_size(prec, decimals);
+ pack_length= my_decimal_get_binary_size(prec, decimals);
}
-bool check_expression(Virtual_column_info *vcol, LEX_CSTRING *name,
+bool check_expression(Virtual_column_info *vcol, const LEX_CSTRING *name,
enum_vcol_info_type type)
{
@@ -10613,6 +10315,7 @@ bool Column_definition::fix_attributes_temporal_with_time(uint int_part_length)
MAX_DATETIME_PRECISION);
return true;
}
+ decimals= (uint) length;
length+= int_part_length + (length ? 1 : 0);
return false;
}
@@ -10818,15 +10521,27 @@ bool Field_vers_trx_id::test_if_equality_guarantees_uniqueness(const Item* item)
Column_definition_attributes::Column_definition_attributes(const Field *field)
:length(field->character_octet_length() / field->charset()->mbmaxlen),
+ decimals(field->decimals()),
unireg_check(field->unireg_check),
interval(NULL),
charset(field->charset()), // May be NULL ptr
srid(0),
- geom_type(Field::GEOM_GEOMETRY),
pack_flag(0)
{}
+Column_definition_attributes::
+ Column_definition_attributes(const Type_all_attributes &attr)
+ :length(attr.max_length),
+ decimals(attr.decimals),
+ unireg_check(Field::NONE),
+ interval(attr.get_typelib()),
+ charset(attr.collation.collation),
+ srid(0),
+ pack_flag(attr.unsigned_flag ? 0 : FIELDFLAG_DECIMAL)
+{}
+
+
/** Create a field suitable for create of table. */
Column_definition::Column_definition(THD *thd, Field *old_field,
@@ -10837,10 +10552,8 @@ Column_definition::Column_definition(THD *thd, Field *old_field,
field_name= old_field->field_name;
flags= old_field->flags;
pack_length=old_field->pack_length();
- key_length= old_field->key_length();
set_handler(old_field->type_handler());
comment= old_field->comment;
- decimals= old_field->decimals();
vcol_info= old_field->vcol_info;
option_list= old_field->option_list;
compression_method_ptr= 0;
@@ -10922,7 +10635,6 @@ Column_definition::redefine_stage1_common(const Column_definition *dup_field,
schema->default_table_charset;
length= dup_field->char_length;
pack_length= dup_field->pack_length;
- key_length= dup_field->key_length;
decimals= dup_field->decimals;
unireg_check= dup_field->unireg_check;
flags= dup_field->flags;
@@ -11054,6 +10766,19 @@ Column_definition::set_compressed_deprecated_column_attribute(THD *thd,
}
+bool Column_definition::check_vcol_for_key(THD *thd) const
+{
+ if (vcol_info && (vcol_info->flags & VCOL_NOT_STRICTLY_DETERMINISTIC))
+ {
+ /* use check_expression() to report an error */
+ check_expression(vcol_info, &field_name, VCOL_GENERATED_STORED);
+ DBUG_ASSERT(thd->is_error());
+ return true;
+ }
+ return false;
+}
+
+
Send_field::Send_field(THD *thd, Item *item)
{
item->make_send_field(thd, this);
@@ -11073,11 +10798,11 @@ uint32 Field_blob::max_display_length() const
switch (packlength)
{
case 1:
- return 255 * field_charset->mbmaxlen;
+ return 255 * mbmaxlen();
case 2:
- return 65535 * field_charset->mbmaxlen;
+ return 65535 * mbmaxlen();
case 3:
- return 16777215 * field_charset->mbmaxlen;
+ return 16777215 * mbmaxlen();
case 4:
return (uint32) UINT_MAX32;
default:
@@ -11312,8 +11037,7 @@ bool Field::val_str_nopad(MEM_ROOT *mem_root, LEX_CSTRING *to)
StringBuffer<MAX_FIELD_WIDTH> str;
bool rc= false;
THD *thd= get_thd();
- sql_mode_t sql_mode_backup= thd->variables.sql_mode;
- thd->variables.sql_mode&= ~MODE_PAD_CHAR_TO_FULL_LENGTH;
+ Sql_mode_instant_remove sms(thd, MODE_PAD_CHAR_TO_FULL_LENGTH);
val_str(&str);
if (!(to->length= str.length()))
@@ -11321,7 +11045,6 @@ bool Field::val_str_nopad(MEM_ROOT *mem_root, LEX_CSTRING *to)
else if ((rc= !(to->str= strmake_root(mem_root, str.ptr(), str.length()))))
to->length= 0;
- thd->variables.sql_mode= sql_mode_backup;
return rc;
}
@@ -11339,7 +11062,7 @@ void Field_string::print_key_value(String *out, uint32 length)
{
if (charset() == &my_charset_bin)
{
- size_t len= field_charset->cset->lengthsp(field_charset, (const char*) ptr, length);
+ size_t len= field_charset()->cset->lengthsp(field_charset(), (const char*) ptr, length);
print_key_value_binary(out, ptr, static_cast<uint32>(len));
}
else
diff --git a/sql/field.h b/sql/field.h
index f07eab3a197..1af55487704 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -60,6 +60,45 @@ enum enum_check_fields
CHECK_FIELD_ERROR_FOR_NULL,
};
+
+enum enum_conv_type
+{
+ CONV_TYPE_PRECISE,
+ CONV_TYPE_VARIANT,
+ CONV_TYPE_SUBSET_TO_SUPERSET,
+ CONV_TYPE_SUPERSET_TO_SUBSET,
+ CONV_TYPE_IMPOSSIBLE
+};
+
+
+class Conv_param
+{
+ uint16 m_table_def_flags;
+public:
+ Conv_param(uint16 table_def_flags)
+ :m_table_def_flags(table_def_flags)
+ { }
+ uint16 table_def_flags() const { return m_table_def_flags; }
+};
+
+
+class Conv_source: public Type_handler_hybrid_field_type
+{
+ uint16 m_metadata;
+ CHARSET_INFO *m_cs;
+public:
+ Conv_source(const Type_handler *h, uint16 metadata, CHARSET_INFO *cs)
+ :Type_handler_hybrid_field_type(h),
+ m_metadata(metadata),
+ m_cs(cs)
+ {
+ DBUG_ASSERT(cs);
+ }
+ uint16 metadata() const { return m_metadata; }
+ uint mbmaxlen() const { return m_cs->mbmaxlen; }
+};
+
+
/*
Common declarations for Field and Item
*/
@@ -410,7 +449,7 @@ public:
{ // Use this when an item is [a part of] a boolean expression
public:
Context_boolean()
- :Context(ANY_SUBST, &type_handler_longlong, &my_charset_bin) { }
+ :Context(ANY_SUBST, &type_handler_slonglong, &my_charset_bin) { }
};
};
@@ -595,6 +634,101 @@ public:
inline void print(String*);
};
+class Binlog_type_info
+{
+public:
+ enum binlog_sign_t
+ {
+ SIGN_SIGNED,
+ SIGN_UNSIGNED,
+ SIGN_NOT_APPLICABLE // for non-numeric types
+ };
+ uchar m_type_code; // according to Field::binlog_type()
+ /**
+ Retrieve the field metadata for fields.
+ */
+ uint16 m_metadata;
+ uint8 m_metadata_size;
+ binlog_sign_t m_signedness;
+ CHARSET_INFO *m_cs; // NULL if not relevant
+ TYPELIB *m_enum_typelib; // NULL if not relevant
+ TYPELIB *m_set_typelib; // NULL if not relevant
+ uchar m_geom_type; // Non-geometry fields can return 0
+ Binlog_type_info(uchar type_code,
+ uint16 metadata,
+ uint8 metadata_size)
+ :m_type_code(type_code),
+ m_metadata(metadata),
+ m_metadata_size(metadata_size),
+ m_signedness(SIGN_NOT_APPLICABLE),
+ m_cs(NULL),
+ m_enum_typelib(NULL),
+ m_set_typelib(NULL),
+ m_geom_type(0)
+ {};
+ Binlog_type_info(uchar type_code, uint16 metadata,
+ uint8 metadata_size,
+ binlog_sign_t signedness)
+ :m_type_code(type_code),
+ m_metadata(metadata),
+ m_metadata_size(metadata_size),
+ m_signedness(signedness),
+ m_cs(NULL),
+ m_enum_typelib(NULL),
+ m_set_typelib(NULL),
+ m_geom_type(0)
+ {};
+ Binlog_type_info(uchar type_code, uint16 metadata,
+ uint8 metadata_size,
+ CHARSET_INFO *cs)
+ :m_type_code(type_code),
+ m_metadata(metadata),
+ m_metadata_size(metadata_size),
+ m_signedness(SIGN_NOT_APPLICABLE),
+ m_cs(cs),
+ m_enum_typelib(NULL),
+ m_set_typelib(NULL),
+ m_geom_type(0)
+ {};
+ Binlog_type_info(uchar type_code, uint16 metadata,
+ uint8 metadata_size,
+ CHARSET_INFO *cs,
+ TYPELIB *t_enum, TYPELIB *t_set)
+ :m_type_code(type_code),
+ m_metadata(metadata),
+ m_metadata_size(metadata_size),
+ m_signedness(SIGN_NOT_APPLICABLE),
+ m_cs(cs),
+ m_enum_typelib(t_enum),
+ m_set_typelib(t_set),
+ m_geom_type(0)
+ {};
+ Binlog_type_info(uchar type_code, uint16 metadata,
+ uint8 metadata_size, CHARSET_INFO *cs,
+ uchar geom_type)
+ :m_type_code(type_code),
+ m_metadata(metadata),
+ m_metadata_size(metadata_size),
+ m_signedness(SIGN_NOT_APPLICABLE),
+ m_cs(cs),
+ m_enum_typelib(NULL),
+ m_set_typelib(NULL),
+ m_geom_type(geom_type)
+ {};
+ static void *operator new(size_t size, MEM_ROOT *mem_root) throw ()
+ { return alloc_root(mem_root, size); }
+};
+
+
+class Binlog_type_info_fixed_string: public Binlog_type_info
+{
+public:
+ Binlog_type_info_fixed_string(uchar type_code,
+ uint32 octet_length,
+ CHARSET_INFO *cs);
+};
+
+
class Field: public Value_source
{
Field(const Item &); /* Prevent use of these */
@@ -608,6 +742,7 @@ protected:
}
void error_generated_column_function_is_not_allowed(THD *thd, bool error)
const;
+ static void do_field_eq(Copy_field *copy);
static void do_field_int(Copy_field *copy);
static void do_field_real(Copy_field *copy);
static void do_field_string(Copy_field *copy);
@@ -685,12 +820,6 @@ public:
TIMESTAMP_DNUN_FIELD=23, // TIMESTAMP DEFAULT NOW() ON UPDATE NOW()
TMYSQL_COMPRESSED= 24, // Compatibility with TMySQL
};
- enum geometry_type
- {
- GEOM_GEOMETRY = 0, GEOM_POINT = 1, GEOM_LINESTRING = 2, GEOM_POLYGON = 3,
- GEOM_MULTIPOINT = 4, GEOM_MULTILINESTRING = 5, GEOM_MULTIPOLYGON = 6,
- GEOM_GEOMETRYCOLLECTION = 7
- };
enum imagetype { itRAW, itMBR};
utype unireg_check;
@@ -748,15 +877,13 @@ public:
const LEX_CSTRING *field_name_arg);
virtual ~Field() {}
- DTCollation dtcollation() const
+ virtual Type_numeric_attributes type_numeric_attributes() const
{
- return DTCollation(charset(), derivation(), repertoire());
+ return Type_numeric_attributes(field_length, decimals(), is_unsigned());
}
- virtual Type_std_attributes type_std_attributes() const
+ Type_std_attributes type_std_attributes() const
{
- return Type_std_attributes(field_length, decimals(),
- MY_TEST(flags & UNSIGNED_FLAG),
- dtcollation());
+ return Type_std_attributes(type_numeric_attributes(), dtcollation());
}
bool is_unsigned() const { return flags & UNSIGNED_FLAG; }
@@ -767,6 +894,10 @@ public:
*/
typedef void Copy_func(Copy_field*);
virtual Copy_func *get_copy_func(const Field *from) const= 0;
+ virtual Copy_func *get_copy_func_to(const Field *to) const
+ {
+ return to->get_copy_func(this);
+ }
/* Store functions returns 1 on overflow and -1 on fatal error */
virtual int store_field(Field *from) { return from->save_in_field(this); }
virtual int save_in_field(Field *to)= 0;
@@ -785,6 +916,23 @@ public:
reset();
}
virtual int store(const char *to, size_t length,CHARSET_INFO *cs)=0;
+ /*
+ This is used by engines like CSV and Federated to signal the field
+ that the data is going to be in text (rather than binary) representation,
+ even if cs points to &my_charset_bin.
+
+ If a Field distinguishes between text and binary formats (e.g. INET6),
+ we cannot call store(str,length,&my_charset_bin),
+ to avoid "field" mis-interpreting the data format as binary.
+ */
+ virtual int store_text(const char *to, size_t length, CHARSET_INFO *cs)
+ {
+ return store(to, length, cs);
+ }
+ virtual int store_binary(const char *to, size_t length)
+ {
+ return store(to, length, &my_charset_bin);
+ }
virtual int store_hex_hybrid(const char *str, size_t length);
virtual int store(double nr)=0;
virtual int store(longlong nr, bool unsigned_val)=0;
@@ -809,6 +957,8 @@ public:
{ return store_time_dec(ltime, TIME_SECOND_PART_DIGITS); }
int store(const char *to, size_t length, CHARSET_INFO *cs,
enum_check_fields check_level);
+ int store_text(const char *to, size_t length, CHARSET_INFO *cs,
+ enum_check_fields check_level);
int store(const LEX_STRING *ls, CHARSET_INFO *cs)
{
DBUG_ASSERT(ls->length < UINT_MAX32);
@@ -824,8 +974,8 @@ public:
DBUG_ASSERT(ls.length < UINT_MAX32);
return store(ls.str, (uint) ls.length, cs);
}
- virtual double val_real(void)=0;
- virtual longlong val_int(void)=0;
+ virtual double val_real()=0;
+ virtual longlong val_int()=0;
/*
Get ulonglong representation.
Negative values are truncated to 0.
@@ -835,7 +985,7 @@ public:
longlong nr= val_int();
return nr < 0 ? 0 : (ulonglong) nr;
}
- virtual bool val_bool(void)= 0;
+ virtual bool val_bool()= 0;
virtual my_decimal *val_decimal(my_decimal *)=0;
inline String *val_str(String *str) { return val_str(str, str); }
/*
@@ -877,7 +1027,7 @@ public:
str_needs_quotes() returns TRUE if the value returned by val_str() needs
to be quoted when used in constructing an SQL query.
*/
- virtual bool str_needs_quotes() { return FALSE; }
+ virtual bool str_needs_quotes() const { return false; }
const Type_handler *type_handler_for_comparison() const
{
return type_handler()->type_handler_for_comparison();
@@ -910,30 +1060,15 @@ public:
table, which is located on disk).
*/
virtual uint32 pack_length_in_rec() const { return pack_length(); }
- virtual bool compatible_field_size(uint metadata, Relay_log_info *rli,
- uint16 mflags, int *order);
- virtual uint pack_length_from_metadata(uint field_metadata)
+ virtual bool compatible_field_size(uint metadata, const Relay_log_info *rli,
+ uint16 mflags, int *order) const;
+ virtual uint pack_length_from_metadata(uint field_metadata) const
{
DBUG_ENTER("Field::pack_length_from_metadata");
DBUG_RETURN(field_metadata);
}
virtual uint row_pack_length() const { return 0; }
-
- /**
- Retrieve the field metadata for fields.
-
- This default implementation returns 0 and saves 0 in the first_byte value.
-
- @param first_byte First byte of field metadata
-
- @returns 0 no bytes written.
- */
-
- virtual int save_field_metadata(uchar *first_byte)
- { return 0; }
-
-
/*
data_length() return the "real size" of the data in memory.
*/
@@ -970,7 +1105,7 @@ public:
return pack_length();
};
- virtual int reset(void) { bzero(ptr,pack_length()); return 0; }
+ virtual int reset() { bzero(ptr,pack_length()); return 0; }
virtual void reset_fields() {}
const uchar *ptr_in_record(const uchar *record) const
{
@@ -1016,6 +1151,8 @@ public:
virtual bool binary() const { return 1; }
virtual bool zero_pack() const { return 1; }
virtual enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }
+ virtual uint16 key_part_flag() const { return 0; }
+ virtual uint16 key_part_length_bytes() const { return 0; }
virtual uint32 key_length() const { return pack_length(); }
virtual const Type_handler *type_handler() const= 0;
virtual enum_field_types type() const
@@ -1074,19 +1211,39 @@ public:
*/
return type();
}
+ virtual Binlog_type_info binlog_type_info() const
+ {
+ DBUG_ASSERT(Field::type() == binlog_type());
+ return Binlog_type_info(Field::type(), 0, 0);
+ }
+ virtual en_fieldtype tmp_engine_column_type(bool use_packed_rows) const
+ {
+ return FIELD_NORMAL;
+ }
+ /*
+ Conversion type for from the source to the current field.
+ */
+ virtual enum_conv_type rpl_conv_type_from(const Conv_source &source,
+ const Relay_log_info *rli,
+ const Conv_param &param)
+ const= 0;
+ enum_conv_type rpl_conv_type_from_same_data_type(uint16 metadata,
+ const Relay_log_info *rli,
+ const Conv_param &param)
+ const;
inline int cmp(const uchar *str) { return cmp(ptr,str); }
- virtual int cmp_max(const uchar *a, const uchar *b, uint max_len)
+ virtual int cmp_max(const uchar *a, const uchar *b, uint max_len) const
{ return cmp(a, b); }
- virtual int cmp(const uchar *,const uchar *)=0;
- virtual int cmp_binary(const uchar *a,const uchar *b, uint32 max_length=~0U)
+ virtual int cmp(const uchar *,const uchar *) const=0;
+ virtual int cmp_binary(const uchar *a,const uchar *b, uint32 max_length=~0U) const
{ return memcmp(a,b,pack_length()); }
virtual int cmp_offset(my_ptrdiff_t row_offset)
{ return cmp(ptr,ptr+row_offset); }
virtual int cmp_binary_offset(uint row_offset)
{ return cmp_binary(ptr, ptr+row_offset); };
- virtual int key_cmp(const uchar *a,const uchar *b)
+ virtual int key_cmp(const uchar *a,const uchar *b) const
{ return cmp(a, b); }
- virtual int key_cmp(const uchar *str, uint length)
+ virtual int key_cmp(const uchar *str, uint length) const
{ return cmp(ptr,str); }
/*
Update the value m of the 'min_val' field with the current value v
@@ -1133,6 +1290,8 @@ public:
{
return Information_schema_character_attributes();
}
+ virtual void update_data_type_statistics(Data_type_statistics *st) const
+ { }
/*
Caller beware: sql_type can change str.Ptr, so check
ptr() to see if it changed if you are using your own buffer
@@ -1184,7 +1343,7 @@ public:
void load_data_set_value(const char *pos, uint length, CHARSET_INFO *cs);
/* @return true if this field is NULL-able (even if temporarily) */
- inline bool real_maybe_null(void) const { return null_ptr != 0; }
+ inline bool real_maybe_null() const { return null_ptr != 0; }
uint null_offset(const uchar *record) const
{ return (uint) (null_ptr - record); }
/*
@@ -1376,15 +1535,13 @@ public:
void copy_from_tmp(int offset);
uint fill_cache_field(struct st_cache_field *copy);
virtual bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate);
- virtual TYPELIB *get_typelib() const { return NULL; }
- virtual CHARSET_INFO *charset(void) const { return &my_charset_bin; }
+ virtual const TYPELIB *get_typelib() const { return NULL; }
+ virtual CHARSET_INFO *charset() const= 0;
+ virtual const DTCollation &dtcollation() const= 0;
virtual CHARSET_INFO *charset_for_protocol(void) const
{ return binary() ? &my_charset_bin : charset(); }
virtual CHARSET_INFO *sort_charset(void) const { return charset(); }
virtual bool has_charset(void) const { return FALSE; }
- virtual enum Derivation derivation(void) const
- { return DERIVATION_IMPLICIT; }
- virtual uint repertoire(void) const { return MY_REPERTOIRE_UNICODE30; }
virtual int set_time() { return 1; }
bool set_warning(Sql_condition::enum_warning_level, unsigned int code,
int cuted_increment, ulong current_row=0) const;
@@ -1536,12 +1693,6 @@ public:
{
return field_length / charset()->mbmaxlen;
}
- virtual geometry_type get_geometry_type() const
- {
- /* shouldn't get here. */
- DBUG_ASSERT(0);
- return GEOM_GEOMETRY;
- }
ha_storage_media field_storage_type() const
{
@@ -1778,6 +1929,11 @@ protected:
void prepend_zeros(String *value) const;
Item *get_equal_zerofill_const_item(THD *thd, const Context &ctx,
Item *const_item);
+ Binlog_type_info::binlog_sign_t binlog_signedness() const
+ {
+ return (flags & UNSIGNED_FLAG) ? Binlog_type_info::SIGN_UNSIGNED :
+ Binlog_type_info::SIGN_SIGNED;
+ }
public:
const uint8 dec;
bool zerofill,unsigned_flag; // Purify cannot handle bit fields
@@ -1785,11 +1941,17 @@ public:
uchar null_bit_arg, utype unireg_check_arg,
const LEX_CSTRING *field_name_arg,
uint8 dec_arg, bool zero_arg, bool unsigned_arg);
- 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; }
- sql_mode_t can_handle_sql_mode_dependency_on_store() const;
+ CHARSET_INFO *charset() const override
+ {
+ return DTCollation_numeric::singleton().collation;
+ }
+ const DTCollation &dtcollation() const override
+ {
+ return DTCollation_numeric::singleton();
+ }
+ sql_mode_t can_handle_sql_mode_dependency_on_store() const override;
Item *get_equal_const_item(THD *thd, const Context &ctx, Item *const_item)
+ override
{
return (flags & ZEROFILL_FLAG) ?
get_equal_zerofill_const_item(thd, ctx, const_item) :
@@ -1797,94 +1959,111 @@ public:
}
void add_zerofill_and_unsigned(String &res) const;
friend class Create_field;
- void make_send_field(Send_field *);
- uint decimals() const { return (uint) dec; }
- uint size_of() const { return sizeof(*this); }
- bool eq_def(const Field *field) const;
- Copy_func *get_copy_func(const Field *from) const
+ void make_send_field(Send_field *) override;
+ uint decimals() const override { return (uint) dec; }
+ uint size_of() const override { return sizeof(*this); }
+ bool eq_def(const Field *field) const override;
+ Copy_func *get_copy_func(const Field *from) const override
{
if (unsigned_flag && from->cmp_type() == DECIMAL_RESULT)
return do_field_decimal;
return do_field_int;
}
- int save_in_field(Field *to)
+ int save_in_field(Field *to) override
{
return to->store(val_int(), MY_TEST(flags & UNSIGNED_FLAG));
}
- bool is_equal(const Column_definition &new_field) const;
- uint row_pack_length() const { return pack_length(); }
- uint32 pack_length_from_metadata(uint field_metadata) {
+ bool is_equal(const Column_definition &new_field) const override;
+ uint row_pack_length() const override { return pack_length(); }
+ uint32 pack_length_from_metadata(uint field_metadata) const override
+ {
uint32 length= pack_length();
DBUG_PRINT("result", ("pack_length_from_metadata(%d): %u",
field_metadata, length));
return length;
}
- double pos_in_interval(Field *min, Field *max)
+ double pos_in_interval(Field *min, Field *max) override
{
return pos_in_interval_val_real(min, max);
}
SEL_ARG *get_mm_leaf(RANGE_OPT_PARAM *param, KEY_PART *key_part,
const Item_bool_func *cond,
- scalar_comparison_op op, Item *value);
+ scalar_comparison_op op, Item *value) override;
+ Binlog_type_info binlog_type_info() const override
+ {
+ DBUG_ASSERT(Field_num::type() == binlog_type());
+ return Binlog_type_info(Field_num::type(), 0, 0, binlog_signedness());
+ }
};
class Field_str :public Field {
protected:
- // TODO-10.2: Reuse DTCollation instead of these three members
- CHARSET_INFO *field_charset;
- enum Derivation field_derivation;
- uint field_repertoire;
+ DTCollation m_collation;
+ // A short alias for m_collation.collation with non-virtual linkage
+ const CHARSET_INFO *field_charset() const { return m_collation.collation; }
+ uint mbmaxlen() const { return m_collation.collation->mbmaxlen; }
public:
bool can_be_substituted_to_equal_item(const Context &ctx,
- const Item_equal *item_equal);
+ const Item_equal *item_equal) override;
Field_str(uchar *ptr_arg,uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg, utype unireg_check_arg,
const LEX_CSTRING *field_name_arg,
const DTCollation &collation);
- uint decimals() const { return NOT_FIXED_DEC; }
- int save_in_field(Field *to) { return save_in_field_str(to); }
- bool memcpy_field_possible(const Field *from) const
+ uint decimals() const override { return NOT_FIXED_DEC; }
+ int save_in_field(Field *to) override { return save_in_field_str(to); }
+ bool memcpy_field_possible(const Field *from) const override
{
return real_type() == from->real_type() &&
pack_length() == from->pack_length() &&
charset() == from->charset();
}
- int store(double nr);
- int store(longlong nr, bool unsigned_val);
- int store_decimal(const my_decimal *);
- int store(const char *to,size_t length,CHARSET_INFO *cs)=0;
- int store_hex_hybrid(const char *str, size_t length)
+ int store(double nr) override;
+ int store(longlong nr, bool unsigned_val) override;
+ int store_decimal(const my_decimal *) override;
+ int store(const char *to,size_t length,CHARSET_INFO *cs) override=0;
+ int store_hex_hybrid(const char *str, size_t length) override
{
return store(str, length, &my_charset_bin);
}
- uint repertoire(void) const { return field_repertoire; }
- CHARSET_INFO *charset(void) const { return field_charset; }
- enum Derivation derivation(void) const { return field_derivation; }
- bool binary() const { return field_charset == &my_charset_bin; }
- uint32 max_display_length() const { return field_length; }
- uint32 character_octet_length() const { return field_length; }
- uint32 char_length() const { return field_length / field_charset->mbmaxlen; }
+ CHARSET_INFO *charset() const override { return m_collation.collation; }
+ const DTCollation &dtcollation() const override
+ {
+ return m_collation;
+ }
+ bool binary() const override { return field_charset() == &my_charset_bin; }
+ uint32 max_display_length() const override { return field_length; }
+ uint32 character_octet_length() const override { return field_length; }
+ uint32 char_length() const override
+ {
+ return field_length / mbmaxlen();
+ }
Information_schema_character_attributes
- information_schema_character_attributes() const
+ information_schema_character_attributes() const override
{
return Information_schema_character_attributes(max_display_length(),
char_length());
}
friend class Create_field;
- my_decimal *val_decimal(my_decimal *);
- bool val_bool() { return val_real() != 0e0; }
- virtual bool str_needs_quotes() { return TRUE; }
- bool eq_cmp_as_binary() { return MY_TEST(flags & BINARY_FLAG); }
+ my_decimal *val_decimal(my_decimal *) override;
+ bool val_bool() override { return val_real() != 0e0; }
+ bool str_needs_quotes() const override { return true; }
+ bool eq_cmp_as_binary() override { return MY_TEST(flags & BINARY_FLAG); }
virtual uint length_size() const { return 0; }
- double pos_in_interval(Field *min, Field *max)
+ double pos_in_interval(Field *min, Field *max) override
{
return pos_in_interval_val_str(min, max, length_size());
}
- bool test_if_equality_guarantees_uniqueness(const Item *const_item) const;
+ bool test_if_equality_guarantees_uniqueness(const Item *const_item) const
+ override;
SEL_ARG *get_mm_leaf(RANGE_OPT_PARAM *param, KEY_PART *key_part,
const Item_bool_func *cond,
- scalar_comparison_op op, Item *value);
+ scalar_comparison_op op, Item *value) override;
+ Binlog_type_info binlog_type_info() const override
+ {
+ DBUG_ASSERT(Field_str::type() == binlog_type());
+ return Binlog_type_info(Field_str::type(), 0, 0, charset());
+ }
};
/* base class for Field_string, Field_varstring and Field_blob */
@@ -1913,7 +2092,7 @@ protected:
{
String_copier copier;
- *copy_length= copier.well_formed_copy(field_charset, to, to_length,
+ *copy_length= copier.well_formed_copy(field_charset(), to, to_length,
from_cs, from, from_length,
nchars);
@@ -1929,7 +2108,7 @@ protected:
uint *out_length,
CHARSET_INFO *cs, size_t nchars);
String *uncompress(String *val_buffer, String *val_ptr,
- const uchar *from, uint from_length);
+ const uchar *from, uint from_length) const;
public:
Field_longstr(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg, utype unireg_check_arg,
@@ -1938,7 +2117,9 @@ public:
:Field_str(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, unireg_check_arg,
field_name_arg, collation)
{}
-
+ enum_conv_type rpl_conv_type_from(const Conv_source &source,
+ const Relay_log_info *rli,
+ const Conv_param &param) const;
int store_decimal(const my_decimal *d);
uint32 max_data_length() const;
@@ -1975,19 +2156,23 @@ public:
field_name_arg, dec_arg, zero_arg, unsigned_arg),
not_fixed(dec_arg >= FLOATING_POINT_DECIMALS)
{}
- Copy_func *get_copy_func(const Field *from) const
+ Copy_func *get_copy_func(const Field *from) const override
{
return do_field_real;
}
+ enum_conv_type rpl_conv_type_from(const Conv_source &source,
+ const Relay_log_info *rli,
+ const Conv_param &param) const override;
Information_schema_numeric_attributes
- information_schema_numeric_attributes() const
+ information_schema_numeric_attributes() const override
{
return dec == NOT_FIXED_DEC ?
Information_schema_numeric_attributes(field_length) :
Information_schema_numeric_attributes(field_length, dec);
}
- int save_in_field(Field *to) { return to->store(val_real()); }
- bool memcpy_field_possible(const Field *from) const
+ void sql_type(String &str) const override;
+ int save_in_field(Field *to) override { return to->store(val_real()); }
+ bool memcpy_field_possible(const Field *from) const override
{
/*
Cannot do memcpy from a longer field to a shorter field,
@@ -2000,14 +2185,16 @@ public:
decimals() == from->decimals() &&
field_length >= from->field_length;
}
- int store_decimal(const my_decimal *dec) { return store(dec->to_double()); }
- int store_time_dec(const MYSQL_TIME *ltime, uint dec);
- bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate);
- my_decimal *val_decimal(my_decimal *);
- bool val_bool() { return val_real() != 0e0; }
- uint32 max_display_length() const { return field_length; }
- uint size_of() const { return sizeof(*this); }
- Item *get_equal_const_item(THD *thd, const Context &ctx, Item *const_item);
+ int store_decimal(const my_decimal *dec) override
+ { return store(dec->to_double()); }
+ int store_time_dec(const MYSQL_TIME *ltime, uint dec) override;
+ bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate) override;
+ my_decimal *val_decimal(my_decimal *) override;
+ bool val_bool() override { return val_real() != 0e0; }
+ uint32 max_display_length() const override { return field_length; }
+ uint size_of() const override { return sizeof *this; }
+ Item *get_equal_const_item(THD *thd, const Context &ctx, Item *const_item)
+ override;
};
@@ -2021,33 +2208,35 @@ public:
unireg_check_arg, field_name_arg,
dec_arg, zero_arg, unsigned_arg)
{}
- Field *make_new_field(MEM_ROOT *root, TABLE *new_table, bool keep_type);
- const Type_handler *type_handler() const { return &type_handler_olddecimal; }
- enum ha_base_keytype key_type() const
+ Field *make_new_field(MEM_ROOT *root, TABLE *new_table, bool keep_type)
+ override;
+ const Type_handler *type_handler() const override
+ { return &type_handler_olddecimal; }
+ enum ha_base_keytype key_type() const override
{ return zerofill ? HA_KEYTYPE_BINARY : HA_KEYTYPE_NUM; }
Information_schema_numeric_attributes
- information_schema_numeric_attributes() const
+ information_schema_numeric_attributes() const override
{
uint tmp= dec ? 2 : 1; // The sign and the decimal point
return Information_schema_numeric_attributes(field_length - tmp, dec);
}
- Copy_func *get_copy_func(const Field *from) const
+ Copy_func *get_copy_func(const Field *from) const override
{
return eq_def(from) ? get_identical_copy_func() : do_field_string;
}
- int reset(void);
- int store(const char *to,size_t length,CHARSET_INFO *charset);
- int store(double nr);
- int store(longlong nr, bool unsigned_val);
- double val_real(void);
- longlong val_int(void);
- String *val_str(String*,String *);
- int cmp(const uchar *,const uchar *);
- void sort_string(uchar *buff,uint length);
+ int reset() override;
+ int store(const char *to,size_t length,CHARSET_INFO *charset) override;
+ int store(double nr) override;
+ int store(longlong nr, bool unsigned_val) override;
+ double val_real() override;
+ longlong val_int() override;
+ String *val_str(String *, String *) override;
+ int cmp(const uchar *,const uchar *) const override;
+ void sort_string(uchar *buff,uint length) override;
void overflow(bool negative);
- bool zero_pack() const { return 0; }
- void sql_type(String &str) const;
- virtual uchar *pack(uchar* to, const uchar *from, uint max_length)
+ bool zero_pack() const override { return false; }
+ void sql_type(String &str) const override;
+ uchar *pack(uchar* to, const uchar *from, uint max_length) override
{
return Field::pack(to, from, max_length);
}
@@ -2056,8 +2245,6 @@ public:
/* New decimal/numeric field which use fixed point arithmetic */
class Field_new_decimal :public Field_num {
-private:
- int save_field_metadata(uchar *first_byte);
public:
/* The maximum number of decimal digits can be stored */
uint precision;
@@ -2073,20 +2260,21 @@ public:
enum utype unireg_check_arg,
const LEX_CSTRING *field_name_arg,
uint8 dec_arg, bool zero_arg, bool unsigned_arg);
- const Type_handler *type_handler() const { return &type_handler_newdecimal; }
- enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }
- Copy_func *get_copy_func(const Field *from) const
+ const Type_handler *type_handler() const override
+ { return &type_handler_newdecimal; }
+ enum ha_base_keytype key_type() const override { return HA_KEYTYPE_BINARY; }
+ Copy_func *get_copy_func(const Field *from) const override
{
// if (from->real_type() == MYSQL_TYPE_BIT) // QQ: why?
// return do_field_int;
return do_field_decimal;
}
- int save_in_field(Field *to)
+ int save_in_field(Field *to) override
{
my_decimal tmp(ptr, precision, dec);
return to->store_decimal(&tmp);
}
- bool memcpy_field_possible(const Field *from) const
+ bool memcpy_field_possible(const Field *from) const override
{
return real_type() == from->real_type() &&
pack_length() == from->pack_length() &&
@@ -2094,63 +2282,69 @@ public:
decimals() == from->decimals() &&
field_length == from->field_length;
}
- int reset(void);
+ enum_conv_type rpl_conv_type_from(const Conv_source &source,
+ const Relay_log_info *rli,
+ const Conv_param &param) const override;
+ int reset() override;
bool store_value(const my_decimal *decimal_value);
bool store_value(const my_decimal *decimal_value, int *native_error);
void set_value_on_overflow(my_decimal *decimal_value, bool sign);
- int store(const char *to, size_t length, CHARSET_INFO *charset);
- int store(double nr);
- int store(longlong nr, bool unsigned_val);
- int store_time_dec(const MYSQL_TIME *ltime, uint dec);
- int store_decimal(const my_decimal *);
- double val_real(void)
+ int store(const char *to, size_t length, CHARSET_INFO *charset) override;
+ int store(double nr) override;
+ int store(longlong nr, bool unsigned_val) override;
+ int store_time_dec(const MYSQL_TIME *ltime, uint dec) override;
+ int store_decimal(const my_decimal *) override;
+ double val_real() override
{
return my_decimal(ptr, precision, dec).to_double();
}
- longlong val_int(void)
+ longlong val_int() override
{
return my_decimal(ptr, precision, dec).to_longlong(unsigned_flag);
}
- ulonglong val_uint(void)
+ ulonglong val_uint() override
{
return (ulonglong) my_decimal(ptr, precision, dec).to_longlong(true);
}
- my_decimal *val_decimal(my_decimal *);
- String *val_str(String *val_buffer, String *val_ptr __attribute__((unused)))
+ my_decimal *val_decimal(my_decimal *) override;
+ String *val_str(String *val_buffer, String *) override
{
uint fixed_precision= zerofill ? precision : 0;
return my_decimal(ptr, precision, dec).
to_string(val_buffer, fixed_precision, dec, '0');
}
- bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate)
+ bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate) override
{
my_decimal nr(ptr, precision, dec);
return decimal_to_datetime_with_warn(get_thd(), &nr, ltime,
fuzzydate, table->s, field_name.str);
}
- bool val_bool()
+ bool val_bool() override
{
return my_decimal(ptr, precision, dec).to_bool();
}
- int cmp(const uchar *, const uchar *);
- void sort_string(uchar *buff, uint length);
- bool zero_pack() const { return 0; }
- void sql_type(String &str) const;
- uint32 max_display_length() const { return field_length; }
+ int cmp(const uchar *, const uchar *) const override;
+ void sort_string(uchar *buff, uint length) override;
+ bool zero_pack() const override { return false; }
+ void sql_type(String &str) const override;
+ uint32 max_display_length() const override { return field_length; }
Information_schema_numeric_attributes
- information_schema_numeric_attributes() const
+ information_schema_numeric_attributes() const override
{
return Information_schema_numeric_attributes(precision, dec);
}
- uint size_of() const { return sizeof(*this); }
- uint32 pack_length() const { return (uint32) bin_size; }
- uint pack_length_from_metadata(uint field_metadata);
- uint row_pack_length() const { return pack_length(); }
- bool compatible_field_size(uint field_metadata, Relay_log_info *rli,
- uint16 mflags, int *order_var);
- bool is_equal(const Column_definition &new_field) const;
- virtual const uchar *unpack(uchar* to, const uchar *from, const uchar *from_end, uint param_data);
- Item *get_equal_const_item(THD *thd, const Context &ctx, Item *const_item);
+ uint size_of() const override { return sizeof *this; }
+ uint32 pack_length() const override { return (uint32) bin_size; }
+ uint pack_length_from_metadata(uint field_metadata) const override;
+ uint row_pack_length() const override { return pack_length(); }
+ bool compatible_field_size(uint field_metadata, const Relay_log_info *rli,
+ uint16 mflags, int *order_var) const override;
+ bool is_equal(const Column_definition &new_field) const override;
+ const uchar *unpack(uchar* to, const uchar *from, const uchar *from_end,
+ uint param_data) override;
+ Item *get_equal_const_item(THD *thd, const Context &ctx, Item *const_item)
+ override;
+ Binlog_type_info binlog_type_info() const override;
};
@@ -2166,28 +2360,31 @@ public:
:Field_num(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg, 0, zero_arg, unsigned_arg)
{}
- bool memcpy_field_possible(const Field *from) const
+ enum_conv_type rpl_conv_type_from(const Conv_source &source,
+ const Relay_log_info *rli,
+ const Conv_param &param) const override;
+ bool memcpy_field_possible(const Field *from) const override
{
return real_type() == from->real_type() &&
pack_length() == from->pack_length() &&
is_unsigned() == from->is_unsigned();
}
- int store_decimal(const my_decimal *);
- my_decimal *val_decimal(my_decimal *);
- bool val_bool() { return val_int() != 0; }
- ulonglong val_uint()
+ int store_decimal(const my_decimal *) override;
+ my_decimal *val_decimal(my_decimal *) override;
+ bool val_bool() override { return val_int() != 0; }
+ ulonglong val_uint() override
{
longlong nr= val_int();
return nr < 0 && !unsigned_flag ? 0 : (ulonglong) nr;
}
- int store_time_dec(const MYSQL_TIME *ltime, uint dec);
- bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate);
+ int store_time_dec(const MYSQL_TIME *ltime, uint dec) override;
+ bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate) override;
virtual const Type_limits_int *type_limits_int() const= 0;
- uint32 max_display_length() const
+ uint32 max_display_length() const override
{
return type_limits_int()->char_length();
}
- Type_std_attributes type_std_attributes() const
+ Type_numeric_attributes type_numeric_attributes() const override
{
/*
For integer data types, the user-specified length does not constrain the
@@ -2201,19 +2398,19 @@ public:
*/
uint32 length1= max_display_length();
uint32 length2= field_length;
- return Type_std_attributes(MY_MAX(length1, length2), decimals(),
- MY_TEST(flags & UNSIGNED_FLAG),
- dtcollation());
+ return Type_numeric_attributes(MY_MAX(length1, length2),
+ decimals(), is_unsigned());
}
Information_schema_numeric_attributes
- information_schema_numeric_attributes() const
+ information_schema_numeric_attributes() const override
{
uint32 prec= type_limits_int()->precision();
return Information_schema_numeric_attributes(prec, 0);
}
+ void sql_type(String &str) const override;
SEL_ARG *get_mm_leaf(RANGE_OPT_PARAM *param, KEY_PART *key_part,
const Item_bool_func *cond,
- scalar_comparison_op op, Item *value)
+ scalar_comparison_op op, Item *value) override
{
return get_mm_leaf_int(param, key_part, cond, op, value, unsigned_flag);
}
@@ -2222,6 +2419,10 @@ public:
class Field_tiny :public Field_int
{
+ const Type_handler_general_purpose_int *type_handler_priv() const
+ {
+ return is_unsigned() ? &type_handler_utiny : &type_handler_stiny;
+ }
public:
Field_tiny(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg,
@@ -2230,41 +2431,41 @@ public:
:Field_int(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg, zero_arg, unsigned_arg)
{}
- const Type_handler *type_handler() const { return &type_handler_tiny; }
- enum ha_base_keytype key_type() const
+ const Type_handler *type_handler() const override
+ { return type_handler_priv(); }
+ enum ha_base_keytype key_type() const override
{ return unsigned_flag ? HA_KEYTYPE_BINARY : HA_KEYTYPE_INT8; }
- int store(const char *to,size_t length,CHARSET_INFO *charset);
- int store(double nr);
- int store(longlong nr, bool unsigned_val);
- int reset(void) { ptr[0]=0; return 0; }
- double val_real(void);
- longlong val_int(void);
- String *val_str(String*,String *);
- bool send_binary(Protocol *protocol);
- int cmp(const uchar *,const uchar *);
- void sort_string(uchar *buff,uint length);
- uint32 pack_length() const { return 1; }
- void sql_type(String &str) const;
- const Type_limits_int *type_limits_int() const
+ int store(const char *to,size_t length,CHARSET_INFO *charset) override;
+ int store(double nr) override;
+ int store(longlong nr, bool unsigned_val) override;
+ int reset() override { ptr[0]=0; return 0; }
+ double val_real() override;
+ longlong val_int() override;
+ String *val_str(String *, String *) override;
+ bool send_binary(Protocol *protocol) override;
+ int cmp(const uchar *,const uchar *) const override;
+ void sort_string(uchar *buff,uint length) override;
+ uint32 pack_length() const override { return 1; }
+ const Type_limits_int *type_limits_int() const override
{
- return type_handler_tiny.type_limits_int_by_unsigned_flag(is_unsigned());
+ return type_handler_priv()->type_limits_int();
}
- virtual uchar *pack(uchar* to, const uchar *from, uint max_length)
+ uchar *pack(uchar* to, const uchar *from, uint max_length) override
{
*to= *from;
return to + 1;
}
- virtual const uchar *unpack(uchar* to, const uchar *from,
- const uchar *from_end, uint param_data)
+ const uchar *unpack(uchar* to, const uchar *from,
+ const uchar *from_end, uint param_data) override
{
if (from == from_end)
return 0;
*to= *from;
return from + 1;
}
- virtual ulonglong get_max_int_value() const
+ ulonglong get_max_int_value() const override
{
return unsigned_flag ? 0xFFULL : 0x7FULL;
}
@@ -2273,6 +2474,10 @@ public:
class Field_short :public Field_int
{
+ const Type_handler_general_purpose_int *type_handler_priv() const
+ {
+ return is_unsigned() ? &type_handler_ushort : &type_handler_sshort;
+ }
public:
Field_short(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg,
@@ -2287,32 +2492,32 @@ public:
:Field_int((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0,0,
NONE, field_name_arg, 0, unsigned_arg)
{}
- const Type_handler *type_handler() const { return &type_handler_short; }
- enum ha_base_keytype key_type() const
+ const Type_handler *type_handler() const override
+ { return type_handler_priv(); }
+ enum ha_base_keytype key_type() const override
{ return unsigned_flag ? HA_KEYTYPE_USHORT_INT : HA_KEYTYPE_SHORT_INT;}
- int store(const char *to,size_t length,CHARSET_INFO *charset);
- int store(double nr);
- int store(longlong nr, bool unsigned_val);
- int reset(void) { ptr[0]=ptr[1]=0; return 0; }
- double val_real(void);
- longlong val_int(void);
- String *val_str(String*,String *);
- bool send_binary(Protocol *protocol);
- int cmp(const uchar *,const uchar *);
- void sort_string(uchar *buff,uint length);
- uint32 pack_length() const { return 2; }
- void sql_type(String &str) const;
- const Type_limits_int *type_limits_int() const
- {
- return type_handler_short.type_limits_int_by_unsigned_flag(is_unsigned());
- }
- virtual uchar *pack(uchar* to, const uchar *from, uint max_length)
+ int store(const char *to,size_t length,CHARSET_INFO *charset) override;
+ int store(double nr) override;
+ int store(longlong nr, bool unsigned_val) override;
+ int reset() override { ptr[0]=ptr[1]=0; return 0; }
+ double val_real() override;
+ longlong val_int() override;
+ String *val_str(String *, String *) override;
+ bool send_binary(Protocol *protocol) override;
+ int cmp(const uchar *,const uchar *) const override;
+ void sort_string(uchar *buff,uint length) override;
+ uint32 pack_length() const override { return 2; }
+ const Type_limits_int *type_limits_int() const override
+ {
+ return type_handler_priv()->type_limits_int();
+ }
+ uchar *pack(uchar* to, const uchar *from, uint) override
{ return pack_int16(to, from); }
- virtual const uchar *unpack(uchar* to, const uchar *from,
- const uchar *from_end, uint param_data)
+ const uchar *unpack(uchar* to, const uchar *from,
+ const uchar *from_end, uint) override
{ return unpack_int16(to, from, from_end); }
- virtual ulonglong get_max_int_value() const
+ ulonglong get_max_int_value() const override
{
return unsigned_flag ? 0xFFFFULL : 0x7FFFULL;
}
@@ -2320,6 +2525,10 @@ public:
class Field_medium :public Field_int
{
+ const Type_handler_general_purpose_int *type_handler_priv() const
+ {
+ return is_unsigned() ? &type_handler_uint24 : &type_handler_sint24;
+ }
public:
Field_medium(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg,
@@ -2328,30 +2537,30 @@ public:
:Field_int(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg, zero_arg, unsigned_arg)
{}
- const Type_handler *type_handler() const { return &type_handler_int24; }
- enum ha_base_keytype key_type() const
+ const Type_handler *type_handler() const override
+ { return type_handler_priv(); }
+ enum ha_base_keytype key_type() const override
{ return unsigned_flag ? HA_KEYTYPE_UINT24 : HA_KEYTYPE_INT24; }
- int store(const char *to,size_t length,CHARSET_INFO *charset);
- int store(double nr);
- int store(longlong nr, bool unsigned_val);
- int reset(void) { ptr[0]=ptr[1]=ptr[2]=0; return 0; }
- double val_real(void);
- longlong val_int(void);
- String *val_str(String*,String *);
- bool send_binary(Protocol *protocol);
- int cmp(const uchar *,const uchar *);
- void sort_string(uchar *buff,uint length);
- uint32 pack_length() const { return 3; }
- void sql_type(String &str) const;
- const Type_limits_int *type_limits_int() const
- {
- return type_handler_int24.type_limits_int_by_unsigned_flag(is_unsigned());
- }
- virtual uchar *pack(uchar* to, const uchar *from, uint max_length)
+ int store(const char *to,size_t length,CHARSET_INFO *charset) override;
+ int store(double nr) override;
+ int store(longlong nr, bool unsigned_val) override;
+ int reset() override { ptr[0]=ptr[1]=ptr[2]=0; return 0; }
+ double val_real() override;
+ longlong val_int() override;
+ String *val_str(String *, String *) override;
+ bool send_binary(Protocol *protocol) override;
+ int cmp(const uchar *,const uchar *) const override;
+ void sort_string(uchar *buff,uint length) override;
+ uint32 pack_length() const override { return 3; }
+ const Type_limits_int *type_limits_int() const override
+ {
+ return type_handler_priv()->type_limits_int();
+ }
+ uchar *pack(uchar* to, const uchar *from, uint max_length) override
{
return Field::pack(to, from, max_length);
}
- virtual ulonglong get_max_int_value() const
+ ulonglong get_max_int_value() const override
{
return unsigned_flag ? 0xFFFFFFULL : 0x7FFFFFULL;
}
@@ -2360,6 +2569,10 @@ public:
class Field_long :public Field_int
{
+ const Type_handler_general_purpose_int *type_handler_priv() const
+ {
+ return is_unsigned() ? &type_handler_ulong : &type_handler_slong;
+ }
public:
Field_long(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg,
@@ -2374,37 +2587,35 @@ public:
:Field_int((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0,0,
NONE, field_name_arg, 0, unsigned_arg)
{}
- const Type_handler *type_handler() const { return &type_handler_long; }
- enum ha_base_keytype key_type() const
+ const Type_handler *type_handler() const override
+ { return type_handler_priv(); }
+ enum ha_base_keytype key_type() const override
{ return unsigned_flag ? HA_KEYTYPE_ULONG_INT : HA_KEYTYPE_LONG_INT; }
- int store(const char *to,size_t length,CHARSET_INFO *charset);
- int store(double nr);
- int store(longlong nr, bool unsigned_val);
- int reset(void) { ptr[0]=ptr[1]=ptr[2]=ptr[3]=0; return 0; }
- double val_real(void);
- longlong val_int(void);
- bool send_binary(Protocol *protocol);
- String *val_str(String*,String *);
- int cmp(const uchar *,const uchar *);
- void sort_string(uchar *buff,uint length);
- uint32 pack_length() const { return 4; }
- void sql_type(String &str) const;
- const Type_limits_int *type_limits_int() const
- {
- return type_handler_long.type_limits_int_by_unsigned_flag(is_unsigned());
- }
- virtual uchar *pack(uchar* to, const uchar *from,
- uint max_length __attribute__((unused)))
+ int store(const char *to,size_t length,CHARSET_INFO *charset) override;
+ int store(double nr) override;
+ int store(longlong nr, bool unsigned_val) override;
+ int reset() override { ptr[0]=ptr[1]=ptr[2]=ptr[3]=0; return 0; }
+ double val_real() override;
+ longlong val_int() override;
+ bool send_binary(Protocol *protocol) override;
+ String *val_str(String *, String *) override;
+ int cmp(const uchar *,const uchar *) const override;
+ void sort_string(uchar *buff,uint length) override;
+ uint32 pack_length() const override { return 4; }
+ const Type_limits_int *type_limits_int() const override
+ {
+ return type_handler_priv()->type_limits_int();
+ }
+ uchar *pack(uchar* to, const uchar *from, uint) override
{
return pack_int32(to, from);
}
- virtual const uchar *unpack(uchar* to, const uchar *from,
- const uchar *from_end,
- uint param_data __attribute__((unused)))
+ const uchar *unpack(uchar* to, const uchar *from,
+ const uchar *from_end, uint) override
{
return unpack_int32(to, from, from_end);
}
- virtual ulonglong get_max_int_value() const
+ ulonglong get_max_int_value() const override
{
return unsigned_flag ? 0xFFFFFFFFULL : 0x7FFFFFFFULL;
}
@@ -2413,6 +2624,10 @@ public:
class Field_longlong :public Field_int
{
+ const Type_handler_general_purpose_int *type_handler_priv() const
+ {
+ return is_unsigned() ? &type_handler_ulonglong : &type_handler_slonglong;
+ }
public:
Field_longlong(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg,
@@ -2427,42 +2642,41 @@ public:
:Field_int((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0,0,
NONE, field_name_arg, 0, unsigned_arg)
{}
- const Type_handler *type_handler() const { return &type_handler_longlong; }
- enum ha_base_keytype key_type() const
- { return unsigned_flag ? HA_KEYTYPE_ULONGLONG : HA_KEYTYPE_LONGLONG; }
- int store(const char *to,size_t length,CHARSET_INFO *charset);
- int store(double nr);
- int store(longlong nr, bool unsigned_val);
- int reset(void)
+ const Type_handler *type_handler() const override
+ { return type_handler_priv(); }
+ enum ha_base_keytype key_type() const override
+ { return unsigned_flag ? HA_KEYTYPE_ULONGLONG : HA_KEYTYPE_LONGLONG; }
+ int store(const char *to,size_t length,CHARSET_INFO *charset) override;
+ int store(double nr) override;
+ int store(longlong nr, bool unsigned_val) override;
+ int reset() override
{
ptr[0]=ptr[1]=ptr[2]=ptr[3]=ptr[4]=ptr[5]=ptr[6]=ptr[7]=0;
return 0;
}
- double val_real(void);
- longlong val_int(void);
- String *val_str(String*,String *);
- bool send_binary(Protocol *protocol);
- int cmp(const uchar *,const uchar *);
- void sort_string(uchar *buff,uint length);
- uint32 pack_length() const { return 8; }
- void sql_type(String &str) const;
- const Type_limits_int *type_limits_int() const
+ double val_real() override;
+ longlong val_int() override;
+ String *val_str(String *, String *) override;
+ bool send_binary(Protocol *protocol) override;
+ int cmp(const uchar *,const uchar *) const override;
+ void sort_string(uchar *buff,uint length) override;
+ uint32 pack_length() const override { return 8; }
+ const Type_limits_int *type_limits_int() const override
{
- return type_handler_longlong.type_limits_int_by_unsigned_flag(is_unsigned());
+ return type_handler_priv()->type_limits_int();
}
- virtual uchar *pack(uchar* to, const uchar *from,
- uint max_length __attribute__((unused)))
+ uchar *pack(uchar* to, const uchar *from, uint) override
{
return pack_int64(to, from);
}
const uchar *unpack(uchar* to, const uchar *from, const uchar *from_end,
- uint param_data __attribute__((unused)))
+ uint) override
{
return unpack_int64(to, from, from_end);
}
- void set_max();
- bool is_max();
- virtual ulonglong get_max_int_value() const
+ void set_max() override;
+ bool is_max() override;
+ ulonglong get_max_int_value() const override
{
return unsigned_flag ? 0xFFFFFFFFFFFFFFFFULL : 0x7FFFFFFFFFFFFFFFULL;
}
@@ -2482,28 +2696,28 @@ public:
unsigned_arg),
cached(0)
{}
- const Type_handler *type_handler() const { return &type_handler_vers_trx_id; }
- uint size_of() const { return sizeof(*this); }
+ const Type_handler *type_handler() const override
+ { return &type_handler_vers_trx_id; }
+ uint size_of() const override { return sizeof *this; }
bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate, ulonglong trx_id);
- bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate)
+ bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate) override
{
return get_date(ltime, fuzzydate, (ulonglong) val_int());
}
- bool test_if_equality_guarantees_uniqueness(const Item *item) const;
- bool can_optimize_keypart_ref(const Item_bool_func *cond,
- const Item *item) const
+ bool test_if_equality_guarantees_uniqueness(const Item *item) const override;
+ bool can_optimize_keypart_ref(const Item_bool_func *, const Item *)
+ const override
{
return true;
}
- bool can_optimize_group_min_max(const Item_bool_func *cond,
- const Item *const_item) const
+ bool can_optimize_group_min_max(const Item_bool_func *, const Item *)
+ const override
{
return true;
}
- bool can_optimize_range(const Item_bool_func *cond,
- const Item *item,
- bool is_eq_func) const
+ bool can_optimize_range(const Item_bool_func *, const Item *, bool)
+ const override
{
return true;
}
@@ -2533,30 +2747,29 @@ public:
if (dec_arg >= FLOATING_POINT_DECIMALS)
dec_arg= NOT_FIXED_DEC;
}
- const Type_handler *type_handler() const { return &type_handler_float; }
- enum ha_base_keytype key_type() const { return HA_KEYTYPE_FLOAT; }
- int store(const char *to,size_t length,CHARSET_INFO *charset);
- int store(double nr);
- int store(longlong nr, bool unsigned_val);
- int reset(void) { bzero(ptr,sizeof(float)); return 0; }
- double val_real(void);
- longlong val_int(void);
- String *val_str(String*,String *);
- bool send_binary(Protocol *protocol);
- int cmp(const uchar *,const uchar *);
- void sort_string(uchar *buff,uint length);
- uint32 pack_length() const { return sizeof(float); }
- uint row_pack_length() const { return pack_length(); }
- void sql_type(String &str) const;
- virtual ulonglong get_max_int_value() const
+ const Type_handler *type_handler() const override
+ { return &type_handler_float; }
+ enum ha_base_keytype key_type() const override { return HA_KEYTYPE_FLOAT; }
+ int store(const char *to,size_t length,CHARSET_INFO *charset) override;
+ int store(double nr) override;
+ int store(longlong nr, bool unsigned_val) override;
+ int reset() override { bzero(ptr,sizeof(float)); return 0; }
+ double val_real() override;
+ longlong val_int() override;
+ String *val_str(String *, String *) override;
+ bool send_binary(Protocol *protocol) override;
+ int cmp(const uchar *,const uchar *) const override;
+ void sort_string(uchar *buff, uint length) override;
+ uint32 pack_length() const override { return sizeof(float); }
+ uint row_pack_length() const override { return pack_length(); }
+ ulonglong get_max_int_value() const override
{
/*
We use the maximum as per IEEE754-2008 standard, 2^24
*/
return 0x1000000ULL;
}
-private:
- int save_field_metadata(uchar *first_byte);
+ Binlog_type_info binlog_type_info() const override;
};
@@ -2592,36 +2805,35 @@ public:
if (dec_arg >= FLOATING_POINT_DECIMALS)
dec_arg= NOT_FIXED_DEC;
}
- void init_for_tmp_table(Field *org_field, TABLE *new_table)
+ void init_for_tmp_table(Field *org_field, TABLE *new_table) override
{
Field::init_for_tmp_table(org_field, new_table);
not_fixed= true;
}
- const Type_handler *type_handler() const { return &type_handler_double; }
- enum ha_base_keytype key_type() const { return HA_KEYTYPE_DOUBLE; }
- int store(const char *to,size_t length,CHARSET_INFO *charset);
- int store(double nr);
- int store(longlong nr, bool unsigned_val);
- int reset(void) { bzero(ptr,sizeof(double)); return 0; }
- double val_real(void);
- longlong val_int(void) { return val_int_from_real(false); }
- ulonglong val_uint(void) { return (ulonglong) val_int_from_real(true); }
- String *val_str(String*,String *);
- bool send_binary(Protocol *protocol);
- int cmp(const uchar *,const uchar *);
- void sort_string(uchar *buff,uint length);
- uint32 pack_length() const { return sizeof(double); }
- uint row_pack_length() const { return pack_length(); }
- void sql_type(String &str) const;
- virtual ulonglong get_max_int_value() const
+ const Type_handler *type_handler() const override
+ { return &type_handler_double; }
+ enum ha_base_keytype key_type() const override { return HA_KEYTYPE_DOUBLE; }
+ int store(const char *to,size_t length,CHARSET_INFO *charset) override;
+ int store(double nr) override;
+ int store(longlong nr, bool unsigned_val) override;
+ int reset() override { bzero(ptr,sizeof(double)); return 0; }
+ double val_real() override;
+ longlong val_int() override { return val_int_from_real(false); }
+ ulonglong val_uint() override { return (ulonglong) val_int_from_real(true); }
+ String *val_str(String *, String *) override;
+ bool send_binary(Protocol *protocol) override;
+ int cmp(const uchar *,const uchar *) const override;
+ void sort_string(uchar *buff, uint length) override;
+ uint32 pack_length() const override { return sizeof(double); }
+ uint row_pack_length() const override { return pack_length(); }
+ ulonglong get_max_int_value() const override
{
/*
We use the maximum as per IEEE754-2008 standard, 2^53
*/
return 0x20000000000000ULL;
}
-private:
- int save_field_metadata(uchar *first_byte);
+ Binlog_type_info binlog_type_info() const override;
};
@@ -2636,43 +2848,47 @@ public:
:Field_str(ptr_arg, len_arg, null, 1,
unireg_check_arg, field_name_arg, collation)
{}
- const Type_handler *type_handler() const { return &type_handler_null; }
+ const Type_handler *type_handler() const override
+ { return &type_handler_null; }
+ enum_conv_type rpl_conv_type_from(const Conv_source &source,
+ const Relay_log_info *rli,
+ const Conv_param &param) const override;
Information_schema_character_attributes
- information_schema_character_attributes() const
+ information_schema_character_attributes() const override
{
return Information_schema_character_attributes();
}
- Copy_func *get_copy_func(const Field *from) const
+ Copy_func *get_copy_func(const Field *from) const override
{
return do_field_string;
}
- int store(const char *to, size_t length, CHARSET_INFO *cs)
+ int store(const char *to, size_t length, CHARSET_INFO *cs) override
{ null[0]=1; return 0; }
- int store(double nr) { null[0]=1; return 0; }
- int store(longlong nr, bool unsigned_val) { null[0]=1; return 0; }
- int store_decimal(const my_decimal *d) { null[0]=1; return 0; }
- int reset(void) { return 0; }
- double val_real(void) { return 0.0;}
- longlong val_int(void) { return 0;}
- bool val_bool(void) { return false; }
- my_decimal *val_decimal(my_decimal *) { return 0; }
- String *val_str(String *value,String *value2)
+ int store(double nr) override { null[0]=1; return 0; }
+ int store(longlong nr, bool unsigned_val) override { null[0]=1; return 0; }
+ int store_decimal(const my_decimal *d) override { null[0]=1; return 0; }
+ int reset() override { return 0; }
+ double val_real() override { return 0.0;}
+ longlong val_int() override { return 0;}
+ bool val_bool() override { return false; }
+ my_decimal *val_decimal(my_decimal *) override { return 0; }
+ String *val_str(String *value,String *value2) override
{ value2->length(0); return value2;}
- bool is_equal(const Column_definition &new_field) const;
- int cmp(const uchar *a, const uchar *b) { return 0;}
- void sort_string(uchar *buff, uint length) {}
- uint32 pack_length() const { return 0; }
- void sql_type(String &str) const;
- uint size_of() const { return sizeof(*this); }
- uint32 max_display_length() const { return 4; }
- void move_field_offset(my_ptrdiff_t ptr_diff) {}
+ bool is_equal(const Column_definition &new_field) const override;
+ int cmp(const uchar *a, const uchar *b) const override { return 0;}
+ void sort_string(uchar *buff, uint length) override {}
+ uint32 pack_length() const override { return 0; }
+ void sql_type(String &str) const override;
+ uint size_of() const override { return sizeof *this; }
+ uint32 max_display_length() const override { return 4; }
+ void move_field_offset(my_ptrdiff_t ptr_diff) override {}
bool can_optimize_keypart_ref(const Item_bool_func *cond,
- const Item *item) const
+ const Item *item) const override
{
return false;
}
bool can_optimize_group_min_max(const Item_bool_func *cond,
- const Item *const_item) const
+ const Item *const_item) const override
{
return false;
}
@@ -2719,13 +2935,13 @@ public:
:Field(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, unireg_check_arg,
field_name_arg)
{ flags|= BINARY_FLAG; }
- int store_hex_hybrid(const char *str, size_t length)
+ int store_hex_hybrid(const char *str, size_t length) override
{
return store(str, length, &my_charset_bin);
}
- sql_mode_t can_handle_sql_mode_dependency_on_store() const;
- Copy_func *get_copy_func(const Field *from) const;
- int save_in_field(Field *to)
+ sql_mode_t can_handle_sql_mode_dependency_on_store() const override;
+ Copy_func *get_copy_func(const Field *from) const override;
+ int save_in_field(Field *to) override
{
MYSQL_TIME ltime;
// For temporal types no truncation needed. Rounding mode is not important.
@@ -2733,38 +2949,43 @@ public:
return to->reset();
return to->store_time_dec(&ltime, decimals());
}
- bool memcpy_field_possible(const Field *from) const;
- uint32 max_display_length() const { return field_length; }
- bool str_needs_quotes() { return TRUE; }
- 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; }
- CHARSET_INFO *sort_charset(void) const { return &my_charset_bin; }
- bool binary() const { return true; }
- bool val_bool() { return val_real() != 0e0; }
- bool is_equal(const Column_definition &new_field) const;
- bool eq_def(const Field *field) const
+ bool memcpy_field_possible(const Field *from) const override;
+ uint32 max_display_length() const override { return field_length; }
+ bool str_needs_quotes() const override { return true; }
+ CHARSET_INFO *charset() const override
+ {
+ return DTCollation_numeric::singleton().collation;
+ }
+ const DTCollation &dtcollation() const override
+ {
+ return DTCollation_numeric::singleton();
+ }
+ CHARSET_INFO *sort_charset() const override { return &my_charset_bin; }
+ bool binary() const override { return true; }
+ bool val_bool() override { return val_real() != 0e0; }
+ bool is_equal(const Column_definition &new_field) const override;
+ bool eq_def(const Field *field) const override
{
return (Field::eq_def(field) && decimals() == field->decimals());
}
- my_decimal *val_decimal(my_decimal*);
- double pos_in_interval(Field *min, Field *max)
+ my_decimal *val_decimal(my_decimal*) override;
+ double pos_in_interval(Field *min, Field *max) override
{
return pos_in_interval_val_real(min, max);
}
bool can_optimize_keypart_ref(const Item_bool_func *cond,
- const Item *item) const;
+ const Item *item) const override;
bool can_optimize_group_min_max(const Item_bool_func *cond,
- const Item *const_item) const;
+ const Item *const_item) const override;
bool can_optimize_range(const Item_bool_func *cond,
const Item *item,
- bool is_eq_func) const
+ bool is_eq_func) const override
{
return true;
}
SEL_ARG *get_mm_leaf(RANGE_OPT_PARAM *param, KEY_PART *key_part,
const Item_bool_func *cond,
- scalar_comparison_op op, Item *value);
+ scalar_comparison_op op, Item *value) override;
};
@@ -2824,29 +3045,34 @@ public:
enum utype unireg_check_arg,
const LEX_CSTRING *field_name_arg,
TABLE_SHARE *share);
- const Type_handler *type_handler() const { return &type_handler_timestamp; }
- enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONG_INT; }
- Copy_func *get_copy_func(const Field *from) const;
- sql_mode_t conversion_depends_on_sql_mode(THD *, Item *) const;
- int store(const char *to,size_t length,CHARSET_INFO *charset);
- int store(double nr);
- int store(longlong nr, bool unsigned_val);
- int store_time_dec(const MYSQL_TIME *ltime, uint dec);
- int store_decimal(const my_decimal *);
- int store_timestamp_dec(const timeval &ts, uint dec);
- int save_in_field(Field *to);
- double val_real(void);
- longlong val_int(void);
- String *val_str(String*,String *);
- bool send_binary(Protocol *protocol);
- int cmp(const uchar *,const uchar *);
- void sort_string(uchar *buff,uint length);
- uint32 pack_length() const { return 4; }
- void sql_type(String &str) const;
- bool zero_pack() const { return 0; }
- int set_time();
+ const Type_handler *type_handler() const override
+ { return &type_handler_timestamp; }
+ enum ha_base_keytype key_type() const override
+ { return HA_KEYTYPE_ULONG_INT; }
+ enum_conv_type rpl_conv_type_from(const Conv_source &source,
+ const Relay_log_info *rli,
+ const Conv_param &param) const override;
+ Copy_func *get_copy_func(const Field *from) const override;
+ sql_mode_t conversion_depends_on_sql_mode(THD *, Item *) const override;
+ int store(const char *to,size_t length,CHARSET_INFO *charset) override;
+ int store(double nr) override;
+ int store(longlong nr, bool unsigned_val) override;
+ int store_time_dec(const MYSQL_TIME *ltime, uint dec) override;
+ int store_decimal(const my_decimal *) override;
+ int store_timestamp_dec(const timeval &ts, uint dec) override;
+ int save_in_field(Field *to) override;
+ double val_real() override;
+ longlong val_int() override;
+ String *val_str(String *, String *) override;
+ bool send_binary(Protocol *protocol) override;
+ int cmp(const uchar *,const uchar *) const override;
+ void sort_string(uchar *buff,uint length) override;
+ uint32 pack_length() const override { return 4; }
+ void sql_type(String &str) const override;
+ bool zero_pack() const override { return false; }
+ int set_time() override;
/* Get TIMESTAMP field value as seconds since begging of Unix Epoch */
- my_time_t get_timestamp(const uchar *pos, ulong *sec_part) const;
+ my_time_t get_timestamp(const uchar *pos, ulong *sec_part) const override;
my_time_t get_timestamp(ulong *sec_part) const
{
return get_timestamp(ptr, sec_part);
@@ -2861,27 +3087,27 @@ public:
time_round_mode_t mode= Datetime::default_round_mode(get_thd());
store_TIMESTAMP(Timestamp(ts, sec_part).round(decimals(), mode, &warn));
}
- bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate);
- int store_native(const Native &value);
- bool val_native(Native *to);
- uchar *pack(uchar *to, const uchar *from,
- uint max_length __attribute__((unused)))
+ bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate) override;
+ int store_native(const Native &value) override;
+ bool val_native(Native *to) override;
+ uchar *pack(uchar *to, const uchar *from, uint) override
{
return pack_int32(to, from);
}
const uchar *unpack(uchar* to, const uchar *from, const uchar *from_end,
- uint param_data __attribute__((unused)))
+ uint) override
{
return unpack_int32(to, from, from_end);
}
- bool validate_value_in_record(THD *thd, const uchar *record) const;
+ bool validate_value_in_record(THD *thd, const uchar *record) const override;
Item *get_equal_const_item(THD *thd, const Context &ctx, Item *const_item)
+ override
{
return get_equal_const_item_datetime(thd, ctx, const_item);
}
- bool load_data_set_null(THD *thd);
- bool load_data_set_no_data(THD *thd, bool fixed_format);
- uint size_of() const { return sizeof(*this); }
+ bool load_data_set_null(THD *thd) override;
+ bool load_data_set_no_data(THD *thd, bool fixed_format) override;
+ uint size_of() const override { return sizeof *this; }
};
@@ -2906,23 +3132,23 @@ public:
{
DBUG_ASSERT(dec <= TIME_SECOND_PART_DIGITS);
}
- uint decimals() const { return dec; }
- enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }
- uchar *pack(uchar *to, const uchar *from, uint max_length)
+ uint decimals() const override { return dec; }
+ enum ha_base_keytype key_type() const override { return HA_KEYTYPE_BINARY; }
+ uchar *pack(uchar *to, const uchar *from, uint max_length) override
{ return Field::pack(to, from, max_length); }
const uchar *unpack(uchar* to, const uchar *from, const uchar *from_end,
- uint param_data)
+ uint param_data) override
{ return Field::unpack(to, from, from_end, param_data); }
- void make_send_field(Send_field *field);
- void sort_string(uchar *to, uint length)
+ void make_send_field(Send_field *field) override;
+ void sort_string(uchar *to, uint length) override
{
DBUG_ASSERT(length == pack_length());
memcpy(to, ptr, length);
}
- bool send_binary(Protocol *protocol);
- double val_real(void);
- my_decimal* val_decimal(my_decimal*);
- int set_time();
+ bool send_binary(Protocol *protocol) override;
+ double val_real() override;
+ my_decimal* val_decimal(my_decimal*) override;
+ int set_time() override;
};
@@ -2931,7 +3157,7 @@ class Field_timestamp_hires :public Field_timestamp_with_dec {
{
return Type_handler_timestamp::sec_part_bytes(dec);
}
- void store_TIMEVAL(const timeval &tv);
+ void store_TIMEVAL(const timeval &tv) override;
public:
Field_timestamp_hires(uchar *ptr_arg,
uchar *null_ptr_arg, uchar null_bit_arg,
@@ -2943,11 +3169,11 @@ public:
{
DBUG_ASSERT(dec);
}
- bool val_native(Native *to);
- my_time_t get_timestamp(const uchar *pos, ulong *sec_part) const;
- int cmp(const uchar *,const uchar *);
- uint32 pack_length() const { return 4 + sec_part_bytes(dec); }
- uint size_of() const { return sizeof(*this); }
+ bool val_native(Native *to) override;
+ my_time_t get_timestamp(const uchar *pos, ulong *sec_part) const override;
+ int cmp(const uchar *,const uchar *) const override;
+ uint32 pack_length() const override { return 4 + sec_part_bytes(dec); }
+ uint size_of() const override { return sizeof *this; }
};
@@ -2955,12 +3181,7 @@ public:
TIMESTAMP(0..6) - MySQL56 version
*/
class Field_timestampf :public Field_timestamp_with_dec {
- int save_field_metadata(uchar *metadata_ptr)
- {
- *metadata_ptr= (uchar) decimals();
- return 1;
- }
- void store_TIMEVAL(const timeval &tv);
+ void store_TIMEVAL(const timeval &tv) override;
public:
Field_timestampf(uchar *ptr_arg,
uchar *null_ptr_arg, uchar null_bit_arg,
@@ -2970,32 +3191,38 @@ public:
Field_timestamp_with_dec(ptr_arg, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg, share, dec_arg)
{}
- const Type_handler *type_handler() const { return &type_handler_timestamp2; }
- enum_field_types binlog_type() const { return MYSQL_TYPE_TIMESTAMP2; }
- uint32 pack_length() const
+ const Type_handler *type_handler() const override
+ { return &type_handler_timestamp2; }
+ enum_field_types binlog_type() const override
+ { return MYSQL_TYPE_TIMESTAMP2; }
+ enum_conv_type rpl_conv_type_from(const Conv_source &source,
+ const Relay_log_info *rli,
+ const Conv_param &param) const override;
+ uint32 pack_length() const override
{
return my_timestamp_binary_length(dec);
}
- uint row_pack_length() const { return pack_length(); }
- uint pack_length_from_metadata(uint field_metadata)
+ uint row_pack_length() const override { return pack_length(); }
+ uint pack_length_from_metadata(uint field_metadata) const override
{
DBUG_ENTER("Field_timestampf::pack_length_from_metadata");
uint tmp= my_timestamp_binary_length(field_metadata);
DBUG_RETURN(tmp);
}
- int cmp(const uchar *a_ptr,const uchar *b_ptr)
+ int cmp(const uchar *a_ptr,const uchar *b_ptr) const override
{
return memcmp(a_ptr, b_ptr, pack_length());
}
- void set_max();
- bool is_max();
- my_time_t get_timestamp(const uchar *pos, ulong *sec_part) const;
+ void set_max() override;
+ bool is_max() override;
+ my_time_t get_timestamp(const uchar *pos, ulong *sec_part) const override;
my_time_t get_timestamp(ulong *sec_part) const
{
return get_timestamp(ptr, sec_part);
}
- bool val_native(Native *to);
- uint size_of() const { return sizeof(*this); }
+ bool val_native(Native *to) override;
+ uint size_of() const override { return sizeof *this; }
+ Binlog_type_info binlog_type_info() const override;
};
@@ -3007,11 +3234,14 @@ public:
:Field_tiny(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg, 1, 1)
{}
- const Type_handler *type_handler() const
+ const Type_handler *type_handler() const override
{
return field_length == 2 ? &type_handler_year2 : &type_handler_year;
}
- Copy_func *get_copy_func(const Field *from) const
+ enum_conv_type rpl_conv_type_from(const Conv_source &source,
+ const Relay_log_info *rli,
+ const Conv_param &param) const override;
+ Copy_func *get_copy_func(const Field *from) const override
{
if (eq_def(from))
return get_identical_copy_func();
@@ -3038,22 +3268,22 @@ public:
}
return do_field_int;
}
- int store(const char *to,size_t length,CHARSET_INFO *charset);
- int store(double nr);
- int store(longlong nr, bool unsigned_val);
- int store_time_dec(const MYSQL_TIME *ltime, uint dec);
- double val_real(void);
- longlong val_int(void);
- String *val_str(String*,String *);
- bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate);
- bool send_binary(Protocol *protocol);
+ int store(const char *to,size_t length,CHARSET_INFO *charset) override;
+ int store(double nr) override;
+ int store(longlong nr, bool unsigned_val) override;
+ int store_time_dec(const MYSQL_TIME *ltime, uint dec) override;
+ double val_real() override;
+ longlong val_int() override;
+ String *val_str(String *, String *) override;
+ bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate) override;
+ bool send_binary(Protocol *protocol) override;
Information_schema_numeric_attributes
- information_schema_numeric_attributes() const
+ information_schema_numeric_attributes() const override
{
return Information_schema_numeric_attributes();
}
- uint32 max_display_length() const { return field_length; }
- void sql_type(String &str) const;
+ uint32 max_display_length() const override { return field_length; }
+ void sql_type(String &str) const override;
};
@@ -3070,79 +3300,90 @@ public:
null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg)
{}
- Copy_func *get_copy_func(const Field *from) const;
+ Copy_func *get_copy_func(const Field *from) const override;
SEL_ARG *get_mm_leaf(RANGE_OPT_PARAM *param, KEY_PART *key_part,
const Item_bool_func *cond,
- scalar_comparison_op op, Item *value);
- int store(const char *to, size_t length, CHARSET_INFO *charset);
- int store(double nr);
- int store(longlong nr, bool unsigned_val);
- int store_time_dec(const MYSQL_TIME *ltime, uint dec);
- int store_decimal(const my_decimal *);
+ scalar_comparison_op op, Item *value) override;
+ int store(const char *to, size_t length, CHARSET_INFO *charset) override;
+ int store(double nr) override;
+ int store(longlong nr, bool unsigned_val) override;
+ int store_time_dec(const MYSQL_TIME *ltime, uint dec) override;
+ int store_decimal(const my_decimal *) override;
};
class Field_date :public Field_date_common
{
- void store_TIME(const MYSQL_TIME *ltime);
- bool get_TIME(MYSQL_TIME *ltime, const uchar *pos, date_mode_t fuzzydate) const;
+ void store_TIME(const MYSQL_TIME *ltime) override;
+ bool get_TIME(MYSQL_TIME *ltime, const uchar *pos, date_mode_t fuzzydate)
+ const override;
public:
Field_date(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg)
:Field_date_common(ptr_arg, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg) {}
- const Type_handler *type_handler() const { return &type_handler_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, date_mode_t fuzzydate)
+ const Type_handler *type_handler() const override
+ { return &type_handler_date; }
+ enum ha_base_keytype key_type() const override
+ { return HA_KEYTYPE_ULONG_INT; }
+ enum_conv_type rpl_conv_type_from(const Conv_source &source,
+ const Relay_log_info *rli,
+ const Conv_param &param) const override;
+ int reset() override { ptr[0]=ptr[1]=ptr[2]=ptr[3]=0; return 0; }
+ bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate) override
{ return Field_date::get_TIME(ltime, ptr, fuzzydate); }
- double val_real(void);
- longlong val_int(void);
- String *val_str(String*,String *);
- bool send_binary(Protocol *protocol);
- int cmp(const uchar *,const uchar *);
- void sort_string(uchar *buff,uint length);
- uint32 pack_length() const { return 4; }
- void sql_type(String &str) const;
- uchar *pack(uchar* to, const uchar *from,
- uint max_length __attribute__((unused)))
+ double val_real() override;
+ longlong val_int() override;
+ String *val_str(String *, String *) override;
+ bool send_binary(Protocol *protocol) override;
+ int cmp(const uchar *,const uchar *) const override;
+ void sort_string(uchar *buff,uint length) override;
+ uint32 pack_length() const override { return 4; }
+ void sql_type(String &str) const override;
+ uchar *pack(uchar* to, const uchar *from, uint) override
{
return pack_int32(to, from);
}
const uchar *unpack(uchar* to, const uchar *from, const uchar *from_end,
- uint param_data __attribute__((unused)))
+ uint) override
{
return unpack_int32(to, from, from_end);
}
- uint size_of() const { return sizeof(*this); }
+ uint size_of() const override { return sizeof *this; }
};
class Field_newdate :public Field_date_common
{
- void store_TIME(const MYSQL_TIME *ltime);
- bool get_TIME(MYSQL_TIME *ltime, const uchar *pos, date_mode_t fuzzydate) const;
+ void store_TIME(const MYSQL_TIME *ltime) override;
+ bool get_TIME(MYSQL_TIME *ltime, const uchar *pos, date_mode_t fuzzydate)
+ const override;
public:
Field_newdate(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg)
:Field_date_common(ptr_arg, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg)
{}
- const Type_handler *type_handler() const { return &type_handler_newdate; }
- enum ha_base_keytype key_type() const { return HA_KEYTYPE_UINT24; }
- int reset(void) { ptr[0]=ptr[1]=ptr[2]=0; return 0; }
- double val_real(void);
- longlong val_int(void);
- String *val_str(String*,String *);
- bool send_binary(Protocol *protocol);
- int cmp(const uchar *,const uchar *);
- 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, date_mode_t fuzzydate)
+ const Type_handler *type_handler() const override
+ { return &type_handler_newdate; }
+ enum ha_base_keytype key_type() const override { return HA_KEYTYPE_UINT24; }
+ enum_conv_type rpl_conv_type_from(const Conv_source &source,
+ const Relay_log_info *rli,
+ const Conv_param &param) const override;
+ int reset() override { ptr[0]=ptr[1]=ptr[2]=0; return 0; }
+ double val_real() override;
+ longlong val_int() override;
+ String *val_str(String *, String *) override;
+ bool send_binary(Protocol *protocol) override;
+ int cmp(const uchar *,const uchar *) const override;
+ void sort_string(uchar *buff,uint length) override;
+ uint32 pack_length() const override { return 3; }
+ void sql_type(String &str) const override;
+ bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate) override
{ 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);
+ uint size_of() const override { return sizeof *this; }
+ Item *get_equal_const_item(THD *thd, const Context &ctx, Item *const_item)
+ override;
};
@@ -3155,10 +3396,7 @@ class Field_time :public Field_temporal {
long curdays;
protected:
virtual void store_TIME(const MYSQL_TIME *ltime);
- void store_TIME(const Time &t)
- {
- return store_TIME(t.get_mysql_time());
- }
+ void store_TIME(const Time &t) { return store_TIME(t.get_mysql_time()); }
int store_TIME_with_warning(const Time *ltime, const ErrConv *str, int warn);
bool check_zero_in_date_with_warn(date_mode_t fuzzydate);
static void do_field_time(Copy_field *copy);
@@ -3170,10 +3408,14 @@ public:
unireg_check_arg, field_name_arg), curdays(0)
{}
bool can_be_substituted_to_equal_item(const Context &ctx,
- const Item_equal *item_equal);
- const Type_handler *type_handler() const { return &type_handler_time; }
- enum ha_base_keytype key_type() const { return HA_KEYTYPE_INT24; }
- Copy_func *get_copy_func(const Field *from) const
+ const Item_equal *item_equal) override;
+ const Type_handler *type_handler() const override
+ { return &type_handler_time; }
+ enum ha_base_keytype key_type() const override { return HA_KEYTYPE_INT24; }
+ enum_conv_type rpl_conv_type_from(const Conv_source &source,
+ const Relay_log_info *rli,
+ const Conv_param &param) const override;
+ Copy_func *get_copy_func(const Field *from) const override
{
return from->cmp_type() == REAL_RESULT ? do_field_string : // MDEV-9344
from->type() == MYSQL_TYPE_YEAR ? do_field_int :
@@ -3181,32 +3423,33 @@ public:
eq_def(from) ? get_identical_copy_func() :
do_field_time;
}
- bool memcpy_field_possible(const Field *from) const
+ bool memcpy_field_possible(const Field *from) const override
{
return real_type() == from->real_type() &&
decimals() == from->decimals();
}
- sql_mode_t conversion_depends_on_sql_mode(THD *, Item *) const;
- int store_time_dec(const MYSQL_TIME *ltime, uint dec);
- int store(const char *to,size_t length,CHARSET_INFO *charset);
- int store(double nr);
- int store(longlong nr, bool unsigned_val);
- int store_decimal(const my_decimal *);
- double val_real(void);
- longlong val_int(void);
- String *val_str(String*,String *);
- bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate);
- bool send_binary(Protocol *protocol);
- int cmp(const uchar *,const uchar *);
- void sort_string(uchar *buff,uint length);
- uint32 pack_length() const { return 3; }
- void sql_type(String &str) const;
- uint size_of() const { return sizeof(*this); }
+ sql_mode_t conversion_depends_on_sql_mode(THD *, Item *) const override;
+ int store_time_dec(const MYSQL_TIME *ltime, uint dec) override;
+ int store(const char *to,size_t length,CHARSET_INFO *charset) override;
+ int store(double nr) override;
+ int store(longlong nr, bool unsigned_val) override;
+ int store_decimal(const my_decimal *) override;
+ double val_real() override;
+ longlong val_int() override;
+ String *val_str(String *, String *) override;
+ bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate) override;
+ bool send_binary(Protocol *protocol) override;
+ int cmp(const uchar *,const uchar *) const override;
+ void sort_string(uchar *buff,uint length) override;
+ uint32 pack_length() const override { return 3; }
+ void sql_type(String &str) const override;
+ uint size_of() const override { return sizeof *this; }
void set_curdays(THD *thd);
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);
+ uchar *new_null_ptr, uint new_null_bit) override;
+ Item *get_equal_const_item(THD *thd, const Context &ctx, Item *const_item)
+ override;
};
@@ -3229,11 +3472,11 @@ public:
{
DBUG_ASSERT(dec <= TIME_SECOND_PART_DIGITS);
}
- uint decimals() const { return dec; }
- enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }
- longlong val_int(void);
- double val_real(void);
- void make_send_field(Send_field *);
+ uint decimals() const override { return dec; }
+ enum ha_base_keytype key_type() const override { return HA_KEYTYPE_BINARY; }
+ longlong val_int() override;
+ double val_real() override;
+ void make_send_field(Send_field *) override;
};
@@ -3242,7 +3485,7 @@ public:
*/
class Field_time_hires :public Field_time_with_dec {
longlong zero_point;
- void store_TIME(const MYSQL_TIME *);
+ void store_TIME(const MYSQL_TIME *) override;
public:
Field_time_hires(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg,
@@ -3255,12 +3498,13 @@ public:
zero_point= sec_part_shift(
((TIME_MAX_VALUE_SECONDS+1LL)*TIME_SECOND_PART_FACTOR), dec);
}
- int reset(void);
- bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate);
- int cmp(const uchar *,const uchar *);
- void sort_string(uchar *buff,uint length);
- uint32 pack_length() const { return Type_handler_time::hires_bytes(dec); }
- uint size_of() const { return sizeof(*this); }
+ int reset() override;
+ bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate) override;
+ int cmp(const uchar *,const uchar *) const override;
+ void sort_string(uchar *buff,uint length) override;
+ uint32 pack_length() const override
+ { return Type_handler_time::hires_bytes(dec); }
+ uint size_of() const override { return sizeof *this; }
};
@@ -3268,12 +3512,7 @@ public:
TIME(0..6) - MySQL56 version
*/
class Field_timef :public Field_time_with_dec {
- void store_TIME(const MYSQL_TIME *ltime);
- int save_field_metadata(uchar *metadata_ptr)
- {
- *metadata_ptr= (uchar) decimals();
- return 1;
- }
+ void store_TIME(const MYSQL_TIME *ltime) override;
public:
Field_timef(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg,
@@ -3284,37 +3523,43 @@ public:
{
DBUG_ASSERT(dec <= TIME_SECOND_PART_DIGITS);
}
- const Type_handler *type_handler() const { return &type_handler_time2; }
- enum_field_types binlog_type() const { return MYSQL_TYPE_TIME2; }
- uint32 pack_length() const
+ const Type_handler *type_handler() const override
+ { return &type_handler_time2; }
+ enum_field_types binlog_type() const override { return MYSQL_TYPE_TIME2; }
+ enum_conv_type rpl_conv_type_from(const Conv_source &source,
+ const Relay_log_info *rli,
+ const Conv_param &param) const override;
+ uint32 pack_length() const override
{
return my_time_binary_length(dec);
}
- uint row_pack_length() const { return pack_length(); }
- uint pack_length_from_metadata(uint field_metadata)
+ uint row_pack_length() const override { return pack_length(); }
+ uint pack_length_from_metadata(uint field_metadata) const override
{
DBUG_ENTER("Field_timef::pack_length_from_metadata");
uint tmp= my_time_binary_length(field_metadata);
DBUG_RETURN(tmp);
}
- void sort_string(uchar *to, uint length)
+ void sort_string(uchar *to, uint length) override
{
DBUG_ASSERT(length == Field_timef::pack_length());
memcpy(to, ptr, length);
}
- int cmp(const uchar *a_ptr, const uchar *b_ptr)
+ int cmp(const uchar *a_ptr, const uchar *b_ptr) const override
{
return memcmp(a_ptr, b_ptr, pack_length());
}
- int reset();
- bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate);
- uint size_of() const { return sizeof(*this); }
+ int reset() override;
+ bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate) override;
+ uint size_of() const override { return sizeof *this; }
+ Binlog_type_info binlog_type_info() const override;
};
class Field_datetime :public Field_temporal_with_date {
- void store_TIME(const MYSQL_TIME *ltime);
- bool get_TIME(MYSQL_TIME *ltime, const uchar *pos, date_mode_t fuzzydate) const;
+ void store_TIME(const MYSQL_TIME *ltime) override;
+ bool get_TIME(MYSQL_TIME *ltime, const uchar *pos, date_mode_t fuzzydate)
+ const override;
protected:
int store_TIME_with_warning(const Datetime *ltime, const ErrConv *str,
int was_cut);
@@ -3329,40 +3574,45 @@ public:
unireg_check == TIMESTAMP_DNUN_FIELD)
flags|= ON_UPDATE_NOW_FLAG;
}
- const Type_handler *type_handler() const { return &type_handler_datetime; }
- enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONGLONG; }
- sql_mode_t conversion_depends_on_sql_mode(THD *, Item *) const;
- int store(const char *to, size_t length, CHARSET_INFO *charset);
- int store(double nr);
- int store(longlong nr, bool unsigned_val);
- int store_time_dec(const MYSQL_TIME *ltime, uint dec);
- int store_decimal(const my_decimal *);
- double val_real(void);
- longlong val_int(void);
- String *val_str(String*,String *);
- bool send_binary(Protocol *protocol);
- int cmp(const uchar *,const uchar *);
- 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, date_mode_t fuzzydate)
+ const Type_handler *type_handler() const override
+ { return &type_handler_datetime; }
+ enum ha_base_keytype key_type() const override
+ { return HA_KEYTYPE_ULONGLONG; }
+ sql_mode_t conversion_depends_on_sql_mode(THD *, Item *) const override;
+ enum_conv_type rpl_conv_type_from(const Conv_source &source,
+ const Relay_log_info *rli,
+ const Conv_param &param) const override;
+ int store(const char *to, size_t length, CHARSET_INFO *charset) override;
+ int store(double nr) override;
+ int store(longlong nr, bool unsigned_val) override;
+ int store_time_dec(const MYSQL_TIME *ltime, uint dec) override;
+ int store_decimal(const my_decimal *) override;
+ double val_real() override;
+ longlong val_int() override;
+ String *val_str(String *, String *) override;
+ bool send_binary(Protocol *protocol) override;
+ int cmp(const uchar *,const uchar *) const override;
+ void sort_string(uchar *buff,uint length) override;
+ uint32 pack_length() const override { return 8; }
+ void sql_type(String &str) const override;
+ bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate) override
{ return Field_datetime::get_TIME(ltime, ptr, fuzzydate); }
- int set_time();
- uchar *pack(uchar* to, const uchar *from,
- uint max_length __attribute__((unused)))
+ int set_time() override;
+ uchar *pack(uchar* to, const uchar *from, uint) override
{
return pack_int64(to, from);
}
const uchar *unpack(uchar* to, const uchar *from, const uchar *from_end,
- uint param_data __attribute__((unused)))
+ uint) override
{
return unpack_int64(to, from, from_end);
}
Item *get_equal_const_item(THD *thd, const Context &ctx, Item *const_item)
+ override
{
return get_equal_const_item_datetime(thd, ctx, const_item);
}
- uint size_of() const { return sizeof(*this); }
+ uint size_of() const override { return sizeof *this; }
};
@@ -3384,23 +3634,23 @@ public:
{
DBUG_ASSERT(dec <= TIME_SECOND_PART_DIGITS);
}
- uint decimals() const { return dec; }
- enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }
- void make_send_field(Send_field *field);
- bool send_binary(Protocol *protocol);
- uchar *pack(uchar *to, const uchar *from, uint max_length)
+ uint decimals() const override { return dec; }
+ enum ha_base_keytype key_type() const override { return HA_KEYTYPE_BINARY; }
+ void make_send_field(Send_field *field) override;
+ bool send_binary(Protocol *protocol) override;
+ uchar *pack(uchar *to, const uchar *from, uint max_length) override
{ return Field::pack(to, from, max_length); }
const uchar *unpack(uchar* to, const uchar *from, const uchar *from_end,
- uint param_data)
+ uint param_data) override
{ return Field::unpack(to, from, from_end, param_data); }
- void sort_string(uchar *to, uint length)
+ void sort_string(uchar *to, uint length) override
{
DBUG_ASSERT(length == pack_length());
memcpy(to, ptr, length);
}
- double val_real(void);
- longlong val_int(void);
- String *val_str(String*,String *);
+ double val_real() override;
+ longlong val_int() override;
+ String *val_str(String *, String *) override;
};
@@ -3408,8 +3658,9 @@ public:
DATETIME(1..6)
*/
class Field_datetime_hires :public Field_datetime_with_dec {
- void store_TIME(const MYSQL_TIME *ltime);
- bool get_TIME(MYSQL_TIME *ltime, const uchar *pos, date_mode_t fuzzydate) const;
+ void store_TIME(const MYSQL_TIME *ltime) override;
+ bool get_TIME(MYSQL_TIME *ltime, const uchar *pos, date_mode_t fuzzydate)
+ const override;
public:
Field_datetime_hires(uchar *ptr_arg, uchar *null_ptr_arg,
uchar null_bit_arg, enum utype unireg_check_arg,
@@ -3419,11 +3670,12 @@ public:
{
DBUG_ASSERT(dec);
}
- int cmp(const uchar *,const uchar *);
- uint32 pack_length() const { return Type_handler_datetime::hires_bytes(dec); }
- bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate)
+ int cmp(const uchar *,const uchar *) const override;
+ uint32 pack_length() const override
+ { return Type_handler_datetime::hires_bytes(dec); }
+ bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate) override
{ return Field_datetime_hires::get_TIME(ltime, ptr, fuzzydate); }
- uint size_of() const { return sizeof(*this); }
+ uint size_of() const override { return sizeof *this; }
};
@@ -3431,13 +3683,9 @@ public:
DATETIME(0..6) - MySQL56 version
*/
class Field_datetimef :public Field_datetime_with_dec {
- void store_TIME(const MYSQL_TIME *ltime);
- bool get_TIME(MYSQL_TIME *ltime, const uchar *pos, date_mode_t fuzzydate) const;
- int save_field_metadata(uchar *metadata_ptr)
- {
- *metadata_ptr= (uchar) decimals();
- return 1;
- }
+ void store_TIME(const MYSQL_TIME *ltime) override;
+ bool get_TIME(MYSQL_TIME *ltime, const uchar *pos, date_mode_t fuzzydate)
+ const override;
public:
Field_datetimef(uchar *ptr_arg, uchar *null_ptr_arg,
uchar null_bit_arg, enum utype unireg_check_arg,
@@ -3445,27 +3693,33 @@ public:
:Field_datetime_with_dec(ptr_arg, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg, dec_arg)
{}
- const Type_handler *type_handler() const { return &type_handler_datetime2; }
- enum_field_types binlog_type() const { return MYSQL_TYPE_DATETIME2; }
- uint32 pack_length() const
+ const Type_handler *type_handler() const override
+ { return &type_handler_datetime2; }
+ enum_field_types binlog_type() const override
+ { return MYSQL_TYPE_DATETIME2; }
+ enum_conv_type rpl_conv_type_from(const Conv_source &source,
+ const Relay_log_info *rli,
+ const Conv_param &param) const override;
+ uint32 pack_length() const override
{
return my_datetime_binary_length(dec);
}
- uint row_pack_length() const { return pack_length(); }
- uint pack_length_from_metadata(uint field_metadata)
+ uint row_pack_length() const override { return pack_length(); }
+ uint pack_length_from_metadata(uint field_metadata) const override
{
DBUG_ENTER("Field_datetimef::pack_length_from_metadata");
uint tmp= my_datetime_binary_length(field_metadata);
DBUG_RETURN(tmp);
}
- int cmp(const uchar *a_ptr, const uchar *b_ptr)
+ int cmp(const uchar *a_ptr, const uchar *b_ptr) const override
{
return memcmp(a_ptr, b_ptr, pack_length());
}
- int reset();
- bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate)
+ int reset() override;
+ bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate) override
{ return Field_datetimef::get_TIME(ltime, ptr, fuzzydate); }
- uint size_of() const { return sizeof(*this); }
+ uint size_of() const override { return sizeof *this; }
+ Binlog_type_info binlog_type_info() const override;
};
@@ -3547,66 +3801,71 @@ public:
NONE, field_name_arg, collation),
can_alter_field_type(1) {};
- const Type_handler *type_handler() const
+ const Type_handler *type_handler() const override
{
if (is_var_string())
return &type_handler_var_string;
return &type_handler_string;
}
- enum ha_base_keytype key_type() const
+ enum ha_base_keytype key_type() const override
{ return binary() ? HA_KEYTYPE_BINARY : HA_KEYTYPE_TEXT; }
- bool zero_pack() const { return 0; }
- Copy_func *get_copy_func(const Field *from) const;
- int reset(void)
+ en_fieldtype tmp_engine_column_type(bool use_packed_rows) const override;
+ bool zero_pack() const override { return false; }
+ Copy_func *get_copy_func(const Field *from) const override;
+ int reset() override
{
charset()->cset->fill(charset(),(char*) ptr, field_length,
(has_charset() ? ' ' : 0));
return 0;
}
- int store(const char *to,size_t length,CHARSET_INFO *charset);
+ int store(const char *to,size_t length,CHARSET_INFO *charset) override;
using Field_str::store;
- double val_real(void);
- longlong val_int(void);
- String *val_str(String*,String *);
- my_decimal *val_decimal(my_decimal *);
- int cmp(const uchar *,const uchar *);
- void sort_string(uchar *buff,uint length);
- void sql_type(String &str) const;
- void sql_rpl_type(String*) const;
- bool is_equal(const Column_definition &new_field) const;
+ double val_real() override;
+ longlong val_int() override;
+ String *val_str(String *, String *) override;
+ my_decimal *val_decimal(my_decimal *) override;
+ int cmp(const uchar *,const uchar *) const override;
+ void sort_string(uchar *buff,uint length) override;
+ void update_data_type_statistics(Data_type_statistics *st) const override
+ {
+ st->m_fixed_string_count++;
+ st->m_fixed_string_total_length+= pack_length();
+ }
+ void sql_type(String &str) const override;
+ void sql_rpl_type(String*) const override;
+ bool is_equal(const Column_definition &new_field) const override;
bool can_be_converted_by_engine(const Column_definition &new_type) const
+ override
{
return table->file->can_convert_string(this, new_type);
}
- virtual uchar *pack(uchar *to, const uchar *from,
- uint max_length);
- virtual const uchar *unpack(uchar* to, const uchar *from,
- const uchar *from_end,uint param_data);
- uint pack_length_from_metadata(uint field_metadata)
+ uchar *pack(uchar *to, const uchar *from, uint max_length) override;
+ const uchar *unpack(uchar* to, const uchar *from, const uchar *from_end,
+ uint param_data) override;
+ uint pack_length_from_metadata(uint field_metadata) const override
{
DBUG_PRINT("debug", ("field_metadata: 0x%04x", field_metadata));
if (field_metadata == 0)
return row_pack_length();
return (((field_metadata >> 4) & 0x300) ^ 0x300) + (field_metadata & 0x00ff);
}
- bool compatible_field_size(uint field_metadata, Relay_log_info *rli,
- uint16 mflags, int *order_var);
- uint row_pack_length() const { return field_length; }
+ bool compatible_field_size(uint field_metadata, const Relay_log_info *rli,
+ uint16 mflags, int *order_var) const override;
+ uint row_pack_length() const override { return field_length; }
int pack_cmp(const uchar *a,const uchar *b,uint key_length,
bool insert_or_update);
int pack_cmp(const uchar *b,uint key_length,bool insert_or_update);
- uint packed_col_length(const uchar *to, uint length);
- uint max_packed_col_length(uint max_length);
- uint size_of() const { return sizeof(*this); }
- bool has_charset(void) const
- { return charset() == &my_charset_bin ? FALSE : TRUE; }
- Field *make_new_field(MEM_ROOT *root, TABLE *new_table, bool keep_type);
- virtual uint get_key_image(uchar *buff,uint length, imagetype type);
- sql_mode_t value_depends_on_sql_mode() const;
- sql_mode_t can_handle_sql_mode_dependency_on_store() const;
- void print_key_value(String *out, uint32 length);
-private:
- int save_field_metadata(uchar *first_byte);
+ uint packed_col_length(const uchar *to, uint length) override;
+ uint max_packed_col_length(uint max_length) override;
+ uint size_of() const override { return sizeof *this; }
+ bool has_charset() const override { return charset() != &my_charset_bin; }
+ Field *make_new_field(MEM_ROOT *root, TABLE *new_table, bool keep_type)
+ override;
+ uint get_key_image(uchar *buff,uint length, imagetype type) override;
+ sql_mode_t value_depends_on_sql_mode() const override;
+ sql_mode_t can_handle_sql_mode_dependency_on_store() const override;
+ void print_key_value(String *out, uint32 length) override;
+ Binlog_type_info binlog_type_info() const override;
};
@@ -3657,67 +3916,77 @@ public:
share->varchar_fields++;
}
- const Type_handler *type_handler() const { return &type_handler_varchar; }
- enum ha_base_keytype key_type() const;
- uint row_pack_length() const { return field_length; }
- bool zero_pack() const { return 0; }
- int reset(void) { bzero(ptr,field_length+length_bytes); return 0; }
- uint32 pack_length() const { return (uint32) field_length+length_bytes; }
- uint32 key_length() const { return (uint32) field_length; }
- uint32 sort_length() const
+ const Type_handler *type_handler() const override
+ { return &type_handler_varchar; }
+ en_fieldtype tmp_engine_column_type(bool use_packed_rows) const override
{
- return (uint32) field_length + (field_charset == &my_charset_bin ?
+ return FIELD_VARCHAR;
+ }
+ enum ha_base_keytype key_type() const override;
+ uint16 key_part_flag() const override { return HA_VAR_LENGTH_PART; }
+ uint16 key_part_length_bytes() const override { return HA_KEY_BLOB_LENGTH; }
+ uint row_pack_length() const override { return field_length; }
+ bool zero_pack() const override { return false; }
+ int reset() override { bzero(ptr,field_length+length_bytes); return 0; }
+ uint32 pack_length() const override
+ { return (uint32) field_length+length_bytes; }
+ uint32 key_length() const override { return (uint32) field_length; }
+ uint32 sort_length() const override
+ {
+ return (uint32) field_length + (field_charset() == &my_charset_bin ?
length_bytes : 0);
}
- Copy_func *get_copy_func(const Field *from) const;
- bool memcpy_field_possible(const Field *from) const
+ Copy_func *get_copy_func(const Field *from) const override;
+ bool memcpy_field_possible(const Field *from) const override;
+ void update_data_type_statistics(Data_type_statistics *st) const override
{
- return Field_str::memcpy_field_possible(from) &&
- !compression_method() == !from->compression_method() &&
- length_bytes == ((Field_varstring*) from)->length_bytes;
+ st->m_variable_string_count++;
+ st->m_variable_string_total_length+= pack_length();
}
- int store(const char *to,size_t length,CHARSET_INFO *charset);
+ int store(const char *to,size_t length,CHARSET_INFO *charset) override;
using Field_str::store;
- double val_real(void);
- longlong val_int(void);
- String *val_str(String*,String *);
- my_decimal *val_decimal(my_decimal *);
- int cmp_max(const uchar *, const uchar *, uint max_length);
- int cmp(const uchar *a,const uchar *b)
+ double val_real() override;
+ longlong val_int() override;
+ String *val_str(String *, String *) override;
+ my_decimal *val_decimal(my_decimal *) override;
+ int cmp_max(const uchar *, const uchar *, uint max_length) const override;
+ int cmp(const uchar *a,const uchar *b) const override
{
return cmp_max(a, b, ~0U);
}
- void sort_string(uchar *buff,uint length);
- uint get_key_image(uchar *buff,uint length, imagetype type);
- void set_key_image(const uchar *buff,uint length);
- void sql_type(String &str) const;
- void sql_rpl_type(String*) const;
- virtual uchar *pack(uchar *to, const uchar *from, uint max_length);
- virtual const uchar *unpack(uchar* to, const uchar *from,
- const uchar *from_end, uint param_data);
- int cmp_binary(const uchar *a,const uchar *b, uint32 max_length=~0U);
- int key_cmp(const uchar *,const uchar*);
- int key_cmp(const uchar *str, uint length);
- uint packed_col_length(const uchar *to, uint length);
- uint max_packed_col_length(uint max_length);
- uint32 data_length();
- uint size_of() const { return sizeof(*this); }
- bool has_charset(void) const
+ void sort_string(uchar *buff,uint length) override;
+ uint get_key_image(uchar *buff,uint length, imagetype type) override;
+ void set_key_image(const uchar *buff,uint length) override;
+ void sql_type(String &str) const override;
+ void sql_rpl_type(String*) const override;
+ uchar *pack(uchar *to, const uchar *from, uint max_length) override;
+ const uchar *unpack(uchar* to, const uchar *from, const uchar *from_end,
+ uint param_data) override;
+ int cmp_binary(const uchar *a,const uchar *b, uint32 max_length=~0U) const
+ override;
+ int key_cmp(const uchar *,const uchar*) const override;
+ int key_cmp(const uchar *str, uint length) const override;
+ uint packed_col_length(const uchar *to, uint length) override;
+ uint max_packed_col_length(uint max_length) override;
+ uint32 data_length() override;
+ uint size_of() const override { return sizeof *this; }
+ bool has_charset() const override
{ return charset() == &my_charset_bin ? FALSE : TRUE; }
- Field *make_new_field(MEM_ROOT *root, TABLE *new_table, bool keep_type);
+ Field *make_new_field(MEM_ROOT *root, TABLE *new_table, bool keep_type)
+ override;
Field *new_key_field(MEM_ROOT *root, TABLE *new_table,
uchar *new_ptr, uint32 length,
- uchar *new_null_ptr, uint new_null_bit);
- bool is_equal(const Column_definition &new_field) const;
+ uchar *new_null_ptr, uint new_null_bit) override;
+ bool is_equal(const Column_definition &new_field) const override;
bool can_be_converted_by_engine(const Column_definition &new_type) const
+ override
{
return table->file->can_convert_varstring(this, new_type);
}
- void hash(ulong *nr, ulong *nr2);
- uint length_size() const { return length_bytes; }
- void print_key_value(String *out, uint32 length);
-private:
- int save_field_metadata(uchar *first_byte);
+ void hash(ulong *nr, ulong *nr2) override;
+ uint length_size() const override { return length_bytes; }
+ void print_key_value(String *out, uint32 length) override;
+ Binlog_type_info binlog_type_info() const override;
};
@@ -3734,38 +4003,41 @@ public:
null_bit_arg, unireg_check_arg, field_name_arg,
share, collation),
compression_method_ptr(compression_method_arg) { DBUG_ASSERT(len_arg > 0); }
- Compression_method *compression_method() const
+ Compression_method *compression_method() const override
{ return compression_method_ptr; }
private:
Compression_method *compression_method_ptr;
- int store(const char *to, size_t length, CHARSET_INFO *charset);
+ int store(const char *to, size_t length, CHARSET_INFO *charset) override;
using Field_str::store;
- String *val_str(String *, String *);
- double val_real(void);
- longlong val_int(void);
- uint size_of() const { return sizeof(*this); }
- enum_field_types binlog_type() const { return MYSQL_TYPE_VARCHAR_COMPRESSED; }
- void sql_type(String &str) const
+ String *val_str(String *, String *) override;
+ double val_real() override;
+ longlong val_int() override;
+ uint size_of() const override { return sizeof *this; }
+ enum_field_types binlog_type() const override
+ { return MYSQL_TYPE_VARCHAR_COMPRESSED; }
+ void sql_type(String &str) const override
{
Field_varstring::sql_type(str);
str.append(STRING_WITH_LEN(" /*!100301 COMPRESSED*/"));
}
- uint32 max_display_length() const { return field_length - 1; }
- uint32 character_octet_length() const { return field_length - 1; }
- uint32 char_length() const
+ uint32 max_display_length() const override { return field_length - 1; }
+ uint32 character_octet_length() const override { return field_length - 1; }
+ uint32 char_length() const override
{
- return (field_length - 1) / field_charset->mbmaxlen;
+ return (field_length - 1) / mbmaxlen();
}
- int cmp_max(const uchar *a_ptr, const uchar *b_ptr, uint max_len);
+ int cmp_max(const uchar *a_ptr, const uchar *b_ptr, uint max_len) const
+ override;
/*
Compressed fields can't have keys as two rows may have different
compression methods or compression levels.
*/
- int key_cmp(const uchar *str, uint length)
+ int key_cmp(const uchar *str, uint length) const override
{ DBUG_ASSERT(0); return 0; }
using Field_varstring::key_cmp;
+ Binlog_type_info binlog_type_info() const override;
};
@@ -3829,6 +4101,7 @@ protected:
static void do_copy_blob(Copy_field *copy);
static void do_conv_blob(Copy_field *copy);
+ uint get_key_image_itRAW(uchar *buff, uint length);
public:
Field_blob(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg,
@@ -3855,9 +4128,9 @@ public:
:Field_longstr((uchar*) 0, 0, (uchar*) "", 0, NONE, &temp_lex_str,
system_charset_info),
packlength(packlength_arg) {}
- const Type_handler *type_handler() const;
+ const Type_handler *type_handler() const override;
/* Note that the default copy constructor is used, in clone() */
- enum_field_types type() const
+ enum_field_types type() const override
{
/*
We cannot return type_handler()->field_type() here.
@@ -3869,27 +4142,36 @@ public:
*/
return MYSQL_TYPE_BLOB;
}
- enum_field_types real_type() const
+ enum_field_types real_type() const override
{
return MYSQL_TYPE_BLOB;
}
- enum ha_base_keytype key_type() const
+ enum ha_base_keytype key_type() const override
{ return binary() ? HA_KEYTYPE_VARBINARY2 : HA_KEYTYPE_VARTEXT2; }
- Type_std_attributes type_std_attributes() const
+ uint16 key_part_flag() const override { return HA_BLOB_PART; }
+ uint16 key_part_length_bytes() const override { return HA_KEY_BLOB_LENGTH; }
+ en_fieldtype tmp_engine_column_type(bool use_packed_rows) const override
+ {
+ return FIELD_BLOB;
+ }
+ Type_numeric_attributes type_numeric_attributes() const override
{
- return Type_std_attributes(Field_blob::max_display_length(), decimals(),
- MY_TEST(flags & UNSIGNED_FLAG),
- dtcollation());
+ return Type_numeric_attributes(Field_blob::max_display_length(),
+ decimals(), is_unsigned());
}
Information_schema_character_attributes
- information_schema_character_attributes() const
+ information_schema_character_attributes() const override
{
uint32 octets= Field_blob::character_octet_length();
- uint32 chars= octets / field_charset->mbminlen;
+ uint32 chars= octets / field_charset()->mbminlen;
return Information_schema_character_attributes(octets, chars);
}
- void make_send_field(Send_field *);
- Copy_func *get_copy_func(const Field *from) const
+ void update_data_type_statistics(Data_type_statistics *st) const override
+ {
+ st->m_blob_count++;
+ }
+ void make_send_field(Send_field *) override;
+ Copy_func *get_copy_func(const Field *from) const override
{
/*
TODO: MDEV-9331
@@ -3903,41 +4185,51 @@ public:
return do_copy_blob;
return get_identical_copy_func();
}
- int store_field(Field *from)
+ int store_field(Field *from) override
{ // Be sure the value is stored
+ if (field_charset() == &my_charset_bin &&
+ from->type_handler()->convert_to_binary_using_val_native())
+ {
+ NativeBuffer<64> tmp;
+ from->val_native(&tmp);
+ value.copy(tmp.ptr(), tmp.length(), &my_charset_bin);
+ return store(value.ptr(), value.length(), &my_charset_bin);
+ }
from->val_str(&value);
if (table->copy_blobs ||
(!value.is_alloced() && from->is_varchar_and_in_write_set()))
value.copy();
return store(value.ptr(), value.length(), from->charset());
}
- bool memcpy_field_possible(const Field *from) const
+ bool memcpy_field_possible(const Field *from) const override
{
return Field_str::memcpy_field_possible(from) &&
!compression_method() == !from->compression_method() &&
!table->copy_blobs;
}
- bool make_empty_rec_store_default_value(THD *thd, Item *item);
- int store(const char *to, size_t length, CHARSET_INFO *charset);
+ bool make_empty_rec_store_default_value(THD *thd, Item *item) override;
+ int store(const char *to, size_t length, CHARSET_INFO *charset) override;
using Field_str::store;
- double val_real(void);
- longlong val_int(void);
- String *val_str(String*,String *);
- my_decimal *val_decimal(my_decimal *);
- int cmp_max(const uchar *, const uchar *, uint max_length);
- int cmp(const uchar *a,const uchar *b)
+ double val_real() override;
+ longlong val_int() override;
+ String *val_str(String *, String *) override;
+ my_decimal *val_decimal(my_decimal *) override;
+ int cmp_max(const uchar *, const uchar *, uint max_length) const override;
+ int cmp(const uchar *a,const uchar *b) const override
{ return cmp_max(a, b, ~0U); }
- int cmp(const uchar *a, uint32 a_length, const uchar *b, uint32 b_length);
- int cmp_binary(const uchar *a,const uchar *b, uint32 max_length=~0U);
- int key_cmp(const uchar *,const uchar*);
- int key_cmp(const uchar *str, uint length);
+ int cmp(const uchar *a, uint32 a_length, const uchar *b, uint32 b_length)
+ const;
+ int cmp_binary(const uchar *a,const uchar *b, uint32 max_length=~0U) const
+ override;
+ int key_cmp(const uchar *,const uchar*) const override;
+ int key_cmp(const uchar *str, uint length) const override;
/* Never update the value of min_val for a blob field */
- bool update_min(Field *min_val, bool force_update) { return FALSE; }
+ bool update_min(Field *min_val, bool force_update) override { return false; }
/* Never update the value of max_val for a blob field */
- bool update_max(Field *max_val, bool force_update) { return FALSE; }
- uint32 key_length() const { return 0; }
- void sort_string(uchar *buff,uint length);
- uint32 pack_length() const
+ bool update_max(Field *max_val, bool force_update) override { return false; }
+ uint32 key_length() const override { return 0; }
+ void sort_string(uchar *buff,uint length) override;
+ uint32 pack_length() const override
{ return (uint32) (packlength + portable_sizeof_char_ptr); }
/**
@@ -3950,18 +4242,22 @@ public:
*/
uint32 pack_length_no_ptr() const
{ return (uint32) (packlength); }
- uint row_pack_length() const { return pack_length_no_ptr(); }
- uint32 sort_length() const;
- uint32 value_length() { return get_length(); }
- virtual uint32 max_data_length() const
+ uint row_pack_length() const override { return pack_length_no_ptr(); }
+ uint32 sort_length() const override;
+ uint32 value_length() override { return get_length(); }
+ virtual uint32 max_data_length() const override
{
return (uint32) (((ulonglong) 1 << (packlength*8)) -1);
}
- int reset(void) { bzero(ptr, packlength+sizeof(uchar*)); return 0; }
- void reset_fields() { bzero((uchar*) &value,sizeof(value)); bzero((uchar*) &read_value,sizeof(read_value)); }
- uint32 get_field_buffer_size(void) { return value.alloced_length(); }
+ int reset() override { bzero(ptr, packlength+sizeof(uchar*)); return 0; }
+ void reset_fields() override
+ {
+ bzero((uchar*) &value, sizeof value);
+ bzero((uchar*) &read_value, sizeof read_value);
+ }
+ uint32 get_field_buffer_size() { return value.alloced_length(); }
void store_length(uchar *i_ptr, uint i_packlength, uint32 i_number);
- inline void store_length(size_t number)
+ void store_length(size_t number)
{
DBUG_ASSERT(number < UINT_MAX32);
store_length(ptr, packlength, (uint32)number);
@@ -3994,12 +4290,16 @@ public:
set_ptr_offset(0, length, data);
}
int copy_value(Field_blob *from);
- uint get_key_image(uchar *buff,uint length, imagetype type);
- void set_key_image(const uchar *buff,uint length);
+ uint get_key_image(uchar *buff, uint length, imagetype type) override
+ {
+ DBUG_ASSERT(type == itRAW);
+ return get_key_image_itRAW(buff, length);
+ }
+ void set_key_image(const uchar *buff,uint length) override;
Field *new_key_field(MEM_ROOT *root, TABLE *new_table,
uchar *new_ptr, uint32 length,
- uchar *new_null_ptr, uint new_null_bit);
- void sql_type(String &str) const;
+ uchar *new_null_ptr, uint new_null_bit) override;
+ void sql_type(String &str) const override;
inline bool copy()
{
uchar *tmp= get_ptr();
@@ -4022,12 +4322,12 @@ public:
/* Set value pointer. Lengths are not important */
value.reset((char*) data, 1, 1, &my_charset_bin);
}
- virtual uchar *pack(uchar *to, const uchar *from, uint max_length);
- virtual const uchar *unpack(uchar *to, const uchar *from,
- const uchar *from_end, uint param_data);
- uint packed_col_length(const uchar *col_ptr, uint length);
- uint max_packed_col_length(uint max_length);
- void free()
+ uchar *pack(uchar *to, const uchar *from, uint max_length) override;
+ const uchar *unpack(uchar *to, const uchar *from, const uchar *from_end,
+ uint param_data) override;
+ uint packed_col_length(const uchar *col_ptr, uint length) override;
+ uint max_packed_col_length(uint max_length) override;
+ void free() override
{
value.free();
read_value.free();
@@ -4047,24 +4347,22 @@ public:
bzero((uchar*) &read_value, sizeof(read_value));
}
}
- uint size_of() const { return sizeof(*this); }
- bool has_charset(void) const
- { return charset() == &my_charset_bin ? FALSE : TRUE; }
- uint32 max_display_length() const;
- uint32 char_length() const;
- uint32 character_octet_length() const;
- bool is_equal(const Column_definition &new_field) const;
+ uint size_of() const override { return sizeof *this; }
+ bool has_charset() const override { return charset() != &my_charset_bin; }
+ uint32 max_display_length() const override;
+ uint32 char_length() const override;
+ uint32 character_octet_length() const override;
+ bool is_equal(const Column_definition &new_field) const override;
bool can_be_converted_by_engine(const Column_definition &new_type) const
+ override
{
return table->file->can_convert_blob(this, new_type);
}
- void print_key_value(String *out, uint32 length);
+ void print_key_value(String *out, uint32 length) override;
+ Binlog_type_info binlog_type_info() const override;
friend void TABLE::remember_blob_values(String *blob_storage);
friend void TABLE::restore_blob_values(String *blob_storage);
-
-private:
- int save_field_metadata(uchar *first_byte);
};
@@ -4078,18 +4376,19 @@ public:
Field_blob(ptr_arg, null_ptr_arg, null_bit_arg, unireg_check_arg,
field_name_arg, share, blob_pack_length, collation),
compression_method_ptr(compression_method_arg) {}
- Compression_method *compression_method() const
+ Compression_method *compression_method() const override
{ return compression_method_ptr; }
private:
Compression_method *compression_method_ptr;
- int store(const char *to, size_t length, CHARSET_INFO *charset);
+ int store(const char *to, size_t length, CHARSET_INFO *charset) override;
using Field_str::store;
- String *val_str(String *, String *);
- double val_real(void);
- longlong val_int(void);
- uint size_of() const { return sizeof(*this); }
- enum_field_types binlog_type() const { return MYSQL_TYPE_BLOB_COMPRESSED; }
- void sql_type(String &str) const
+ String *val_str(String *, String *) override;
+ double val_real() override;
+ longlong val_int() override;
+ uint size_of() const override { return sizeof *this; }
+ enum_field_types binlog_type() const override
+ { return MYSQL_TYPE_BLOB_COMPRESSED; }
+ void sql_type(String &str) const override
{
Field_blob::sql_type(str);
str.append(STRING_WITH_LEN(" /*!100301 COMPRESSED*/"));
@@ -4100,133 +4399,33 @@ private:
compression methods or compression levels.
*/
- uint get_key_image(uchar *buff, uint length, imagetype type_arg)
+ uint get_key_image(uchar *, uint, imagetype) override
{ DBUG_ASSERT(0); return 0; }
- void set_key_image(const uchar *buff, uint length)
+ void set_key_image(const uchar *, uint) override
{ DBUG_ASSERT(0); }
- int key_cmp(const uchar *a, const uchar *b)
+ int key_cmp(const uchar *, const uchar *) const override
{ DBUG_ASSERT(0); return 0; }
- int key_cmp(const uchar *str, uint length)
+ int key_cmp(const uchar *, uint) const override
{ DBUG_ASSERT(0); return 0; }
- Field *new_key_field(MEM_ROOT *root, TABLE *new_table,
- uchar *new_ptr, uint32 length,
- uchar *new_null_ptr, uint new_null_bit)
+ Field *new_key_field(MEM_ROOT *, TABLE *, uchar *, uint32, uchar *, uint)
+ override
{ DBUG_ASSERT(0); return 0; }
+ Binlog_type_info binlog_type_info() const override;
};
-#ifdef HAVE_SPATIAL
-class Field_geom :public Field_blob {
-public:
- enum geometry_type geom_type;
- uint srid;
- uint precision;
- enum storage_type { GEOM_STORAGE_WKB= 0, GEOM_STORAGE_BINARY= 1};
- enum storage_type storage;
-
- Field_geom(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
- enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg,
- TABLE_SHARE *share, uint blob_pack_length,
- enum geometry_type geom_type_arg, uint field_srid)
- :Field_blob(ptr_arg, null_ptr_arg, null_bit_arg, unireg_check_arg,
- field_name_arg, share, blob_pack_length, &my_charset_bin)
- { geom_type= geom_type_arg; srid= field_srid; }
- enum ha_base_keytype key_type() const { return HA_KEYTYPE_VARBINARY2; }
- const Type_handler *type_handler() const
- {
- return &type_handler_geometry;
- }
- enum_field_types type() const
- {
- return MYSQL_TYPE_GEOMETRY;
- }
- enum_field_types real_type() const
- {
- return MYSQL_TYPE_GEOMETRY;
- }
- Information_schema_character_attributes
- information_schema_character_attributes() const
- {
- return Information_schema_character_attributes();
- }
- void make_send_field(Send_field *to)
- {
- Field_longstr::make_send_field(to);
- }
- bool can_optimize_range(const Item_bool_func *cond,
- const Item *item,
- bool is_eq_func) const;
- void sql_type(String &str) const;
- Copy_func *get_copy_func(const Field *from) const
- {
- if (type_handler() == from->type_handler() &&
- (geom_type == GEOM_GEOMETRY ||
- geom_type == static_cast<const Field_geom*>(from)->geom_type))
- return get_identical_copy_func();
- return do_conv_blob;
- }
- bool memcpy_field_possible(const Field *from) const
- {
- return type_handler() == from->type_handler() &&
- (geom_type == GEOM_GEOMETRY ||
- geom_type == static_cast<const Field_geom*>(from)->geom_type) &&
- !table->copy_blobs;
- }
- bool is_equal(const Column_definition &new_field) const;
- bool can_be_converted_by_engine(const Column_definition &new_type) const
- {
- return table->file->can_convert_geom(this, new_type);
- }
-
- int store(const char *to, size_t length, CHARSET_INFO *charset);
- int store(double nr);
- int store(longlong nr, bool unsigned_val);
- int store_decimal(const my_decimal *);
- uint size_of() const { return sizeof(*this); }
- /**
- Key length is provided only to support hash joins. (compared byte for byte)
- Ex: SELECT .. FROM t1,t2 WHERE t1.field_geom1=t2.field_geom2.
-
- The comparison is not very relevant, as identical geometry might be
- represented differently, but we need to support it either way.
- */
- uint32 key_length() const { return packlength; }
-
- /**
- Non-nullable GEOMETRY types cannot have defaults,
- but the underlying blob must still be reset.
- */
- int reset(void) { return Field_blob::reset() || !maybe_null(); }
- bool load_data_set_null(THD *thd);
- bool load_data_set_no_data(THD *thd, bool fixed_format);
-
- geometry_type get_geometry_type() const { return geom_type; };
- static geometry_type geometry_type_merge(geometry_type, geometry_type);
- uint get_srid() { return srid; }
- void print_key_value(String *out, uint32 length)
- {
- out->append(STRING_WITH_LEN("unprintable_geometry_value"));
- }
-};
-
-uint gis_field_options_image(uchar *buff, List<Create_field> &create_fields);
-uint gis_field_options_read(const uchar *buf, size_t buf_len,
- Field_geom::storage_type *st_type,uint *precision, uint *scale, uint *srid);
-
-#endif /*HAVE_SPATIAL*/
-
-
class Field_enum :public Field_str {
static void do_field_enum(Copy_field *copy_field);
+ longlong val_int(const uchar *) const;
protected:
uint packlength;
public:
- TYPELIB *typelib;
+ const TYPELIB *typelib;
Field_enum(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg,
enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg,
uint packlength_arg,
- TYPELIB *typelib_arg,
+ const TYPELIB *typelib_arg,
const DTCollation &collation)
:Field_str(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg, collation),
@@ -4234,11 +4433,16 @@ public:
{
flags|=ENUM_FLAG;
}
- Field *make_new_field(MEM_ROOT *root, TABLE *new_table, bool keep_type);
- const Type_handler *type_handler() const { return &type_handler_enum; }
- enum ha_base_keytype key_type() const;
- sql_mode_t can_handle_sql_mode_dependency_on_store() const;
- Copy_func *get_copy_func(const Field *from) const
+ Field *make_new_field(MEM_ROOT *root, TABLE *new_table, bool keep_type)
+ override;
+ const Type_handler *type_handler() const override
+ { return &type_handler_enum; }
+ enum ha_base_keytype key_type() const override;
+ sql_mode_t can_handle_sql_mode_dependency_on_store() const override;
+ enum_conv_type rpl_conv_type_from(const Conv_source &source,
+ const Relay_log_info *rli,
+ const Conv_param &param) const override;
+ Copy_func *get_copy_func(const Field *from) const override
{
if (eq_def(from))
return get_identical_copy_func();
@@ -4249,7 +4453,7 @@ public:
return do_field_string;
return do_field_int;
}
- int store_field(Field *from)
+ int store_field(Field *from) override
{
if (from->real_type() == MYSQL_TYPE_ENUM && from->val_int() == 0)
{
@@ -4258,14 +4462,15 @@ public:
}
return from->save_in_field(this);
}
- int save_in_field(Field *to)
+ int save_in_field(Field *to) override
{
if (to->result_type() != STRING_RESULT)
return to->store(val_int(), 0);
return save_in_field_str(to);
}
- bool memcpy_field_possible(const Field *from) const { return false; }
- void make_empty_rec_reset(THD *thd)
+ bool memcpy_field_possible(const Field *from) const override
+ { return false; }
+ void make_empty_rec_reset(THD *) override
{
if (flags & NOT_NULL_FLAG)
{
@@ -4275,38 +4480,38 @@ public:
else
reset();
}
- int store(const char *to,size_t length,CHARSET_INFO *charset);
- int store(double nr);
- int store(longlong nr, bool unsigned_val);
- double val_real(void);
- longlong val_int(void);
- String *val_str(String*,String *);
- int cmp(const uchar *,const uchar *);
- void sort_string(uchar *buff,uint length);
- uint32 pack_length() const { return (uint32) packlength; }
+ int store(const char *to,size_t length,CHARSET_INFO *charset) override;
+ int store(double nr) override;
+ int store(longlong nr, bool unsigned_val) override;
+ double val_real() override;
+ longlong val_int() override;
+ String *val_str(String *, String *) override;
+ int cmp(const uchar *,const uchar *) const override;
+ void sort_string(uchar *buff,uint length) override;
+ uint32 pack_length() const override { return (uint32) packlength; }
void store_type(ulonglong value);
- void sql_type(String &str) const;
- uint size_of() const { return sizeof(*this); }
- uint pack_length_from_metadata(uint field_metadata)
+ void sql_type(String &str) const override;
+ uint size_of() const override { return sizeof *this; }
+ uint pack_length_from_metadata(uint field_metadata) const override
{ return (field_metadata & 0x00ff); }
- uint row_pack_length() const { return pack_length(); }
- virtual bool zero_pack() const { return 0; }
- bool optimize_range(uint idx, uint part) const { return 0; }
- bool eq_def(const Field *field) const;
- bool has_charset(void) const { return TRUE; }
+ uint row_pack_length() const override { return pack_length(); }
+ bool zero_pack() const override { return false; }
+ bool optimize_range(uint, uint) const override { return false; }
+ bool eq_def(const Field *field) const override;
+ bool has_charset() const override { return true; }
/* enum and set are sorted as integers */
- CHARSET_INFO *sort_charset(void) const { return &my_charset_bin; }
- uint decimals() const { return 0; }
- TYPELIB *get_typelib() const { return typelib; }
+ CHARSET_INFO *sort_charset() const override { return &my_charset_bin; }
+ uint decimals() const override { return 0; }
+ const TYPELIB *get_typelib() const override { return typelib; }
- virtual uchar *pack(uchar *to, const uchar *from, uint max_length);
- virtual const uchar *unpack(uchar *to, const uchar *from,
- const uchar *from_end, uint param_data);
+ uchar *pack(uchar *to, const uchar *from, uint max_length) override;
+ const uchar *unpack(uchar *to, const uchar *from, const uchar *from_end,
+ uint param_data) override;
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
+ const Item *item) const override;
+ bool can_optimize_group_min_max(const Item_bool_func *, const Item *)
+ const override
{
/*
Can't use GROUP_MIN_MAX optimization for ENUM and SET,
@@ -4319,10 +4524,10 @@ public:
}
bool can_optimize_range(const Item_bool_func *cond,
const Item *item,
- bool is_eq_func) const;
+ bool is_eq_func) const override;
+ Binlog_type_info binlog_type_info() const override;
private:
- int save_field_metadata(uchar *first_byte);
- bool is_equal(const Column_definition &new_field) const;
+ bool is_equal(const Column_definition &new_field) const override;
};
@@ -4332,7 +4537,7 @@ public:
uchar null_bit_arg,
enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg,
uint32 packlength_arg,
- TYPELIB *typelib_arg, const DTCollation &collation)
+ const TYPELIB *typelib_arg, const DTCollation &collation)
:Field_enum(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg,
packlength_arg,
@@ -4341,22 +4546,25 @@ public:
{
flags=(flags & ~ENUM_FLAG) | SET_FLAG;
}
- void make_empty_rec_reset(THD *thd)
+ void make_empty_rec_reset(THD *thd) override
{
Field::make_empty_rec_reset(thd);
}
- int store_field(Field *from) { return from->save_in_field(this); }
- int store(const char *to,size_t length,CHARSET_INFO *charset);
- int store(double nr) { return Field_set::store((longlong) nr, FALSE); }
- int store(longlong nr, bool unsigned_val);
-
- virtual bool zero_pack() const { return 1; }
- String *val_str(String*,String *);
- void sql_type(String &str) const;
- uint size_of() const { return sizeof(*this); }
- const Type_handler *type_handler() const { return &type_handler_set; }
- bool has_charset(void) const { return TRUE; }
+ int store_field(Field *from) override { return from->save_in_field(this); }
+ int store(const char *to,size_t length,CHARSET_INFO *charset) override;
+ int store(double nr) override
+ { return Field_set::store((longlong) nr, FALSE); }
+ int store(longlong nr, bool unsigned_val) override;
+
+ bool zero_pack() const override { return true; }
+ String *val_str(String *, String *) override;
+ void sql_type(String &str) const override;
+ uint size_of() const override { return sizeof *this; }
+ const Type_handler *type_handler() const override
+ { return &type_handler_set; }
+ bool has_charset() const override { return true; }
+ Binlog_type_info binlog_type_info() const override;
private:
const String empty_set_string;
};
@@ -4385,42 +4593,55 @@ public:
Field_bit(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg, uchar *bit_ptr_arg, uchar bit_ofs_arg,
enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg);
- const Type_handler *type_handler() const { return &type_handler_bit; }
- enum ha_base_keytype key_type() const { return HA_KEYTYPE_BIT; }
- uint32 key_length() const { return (uint32) (field_length + 7) / 8; }
- uint32 max_data_length() const { return (field_length + 7) / 8; }
- uint32 max_display_length() const { return field_length; }
+ const Type_handler *type_handler() const override
+ { return &type_handler_bit; }
+ enum ha_base_keytype key_type() const override { return HA_KEYTYPE_BIT; }
+ uint16 key_part_flag() const override { return HA_BIT_PART; }
+ uint32 key_length() const override
+ { return (uint32) (field_length + 7) / 8; }
+ uint32 max_data_length() const override { return key_length(); }
+ uint32 max_display_length() const override { return field_length; }
+ enum_conv_type rpl_conv_type_from(const Conv_source &source,
+ const Relay_log_info *rli,
+ const Conv_param &param) const override;
+ CHARSET_INFO *charset() const override { return &my_charset_bin; }
+ const DTCollation & dtcollation() const override;
Information_schema_numeric_attributes
- information_schema_numeric_attributes() const
+ information_schema_numeric_attributes() const override
{
return Information_schema_numeric_attributes(field_length);
}
- uint size_of() const { return sizeof(*this); }
- int reset(void) {
+ void update_data_type_statistics(Data_type_statistics *st) const override
+ {
+ st->m_uneven_bit_length+= field_length & 7;
+ }
+ uint size_of() const override { return sizeof *this; }
+ int reset() override
+ {
bzero(ptr, bytes_in_rec);
if (bit_ptr && (bit_len > 0)) // reset odd bits among null bits
clr_rec_bits(bit_ptr, bit_ofs, bit_len);
return 0;
}
- Copy_func *get_copy_func(const Field *from) const
+ Copy_func *get_copy_func(const Field *from) const override
{
if (from->cmp_type() == DECIMAL_RESULT)
return do_field_decimal;
return do_field_int;
}
- int save_in_field(Field *to) { return to->store(val_int(), true); }
- bool memcpy_field_possible(const Field *from) const { return false; }
- int store(const char *to, size_t length, CHARSET_INFO *charset);
- int store(double nr);
- int store(longlong nr, bool unsigned_val);
- int store_decimal(const my_decimal *);
- double val_real(void);
- longlong val_int(void);
- String *val_str(String*, String *);
- virtual bool str_needs_quotes() { return TRUE; }
- my_decimal *val_decimal(my_decimal *);
- bool val_bool() { return val_int() != 0; }
- int cmp(const uchar *a, const uchar *b)
+ int save_in_field(Field *to) override { return to->store(val_int(), true); }
+ bool memcpy_field_possible(const Field *from) const override{ return false; }
+ int store(const char *to, size_t length, CHARSET_INFO *charset) override;
+ int store(double nr) override;
+ int store(longlong nr, bool unsigned_val) override;
+ int store_decimal(const my_decimal *) override;
+ double val_real() override;
+ longlong val_int() override;
+ String *val_str(String*, String *) override;
+ bool str_needs_quotes() const override { return true; }
+ my_decimal *val_decimal(my_decimal *) override;
+ bool val_bool() override { return val_int() != 0; }
+ int cmp(const uchar *a, const uchar *b) const override
{
DBUG_ASSERT(ptr == a || ptr == b);
if (ptr == a)
@@ -4428,15 +4649,15 @@ public:
else
return Field_bit::key_cmp(a, bytes_in_rec + MY_TEST(bit_len)) * -1;
}
- int cmp_binary_offset(uint row_offset)
+ int cmp_binary_offset(uint row_offset) override
{ return cmp_offset(row_offset); }
- int cmp_max(const uchar *a, const uchar *b, uint max_length);
- int key_cmp(const uchar *a, const uchar *b)
+ int cmp_max(const uchar *a, const uchar *b, uint max_length) const override;
+ int key_cmp(const uchar *a, const uchar *b) const override
{ return cmp_binary((uchar *) a, (uchar *) b); }
- int key_cmp(const uchar *str, uint length);
- int cmp_offset(my_ptrdiff_t row_offset);
- bool update_min(Field *min_val, bool force_update)
- {
+ int key_cmp(const uchar *str, uint length) const override;
+ int cmp_offset(my_ptrdiff_t row_offset) override;
+ bool update_min(Field *min_val, bool force_update) override
+ {
longlong val= val_int();
bool update_fl= force_update || val < min_val->val_int();
if (update_fl)
@@ -4446,8 +4667,8 @@ public:
}
return update_fl;
}
- bool update_max(Field *max_val, bool force_update)
- {
+ bool update_max(Field *max_val, bool force_update) override
+ {
longlong val= val_int();
bool update_fl= force_update || val > max_val->val_int();
if (update_fl)
@@ -4457,72 +4678,94 @@ public:
}
return update_fl;
}
- void store_field_value(uchar *val, uint len)
+ void store_field_value(uchar *val, uint) override
{
store(*((longlong *)val), TRUE);
}
- double pos_in_interval(Field *min, Field *max)
+ double pos_in_interval(Field *min, Field *max) override
{
return pos_in_interval_val_real(min, max);
}
- void get_image(uchar *buff, uint length, CHARSET_INFO *cs)
- { get_key_image(buff, length, itRAW); }
- void set_image(const uchar *buff,uint length, CHARSET_INFO *cs)
+ void get_image(uchar *buff, uint length, CHARSET_INFO *) override
+ { get_key_image(buff, length, itRAW); }
+ void set_image(const uchar *buff,uint length, CHARSET_INFO *cs) override
{ Field_bit::store((char *) buff, length, cs); }
- uint get_key_image(uchar *buff, uint length, imagetype type);
- void set_key_image(const uchar *buff, uint length)
+ uint get_key_image(uchar *buff, uint length, imagetype type) override;
+ void set_key_image(const uchar *buff, uint length) override
{ Field_bit::store((char*) buff, length, &my_charset_bin); }
- void sort_string(uchar *buff, uint length)
+ void sort_string(uchar *buff, uint length) override
{ get_key_image(buff, length, itRAW); }
- uint32 pack_length() const { return (uint32) (field_length + 7) / 8; }
- uint32 pack_length_in_rec() const { return bytes_in_rec; }
- uint pack_length_from_metadata(uint field_metadata);
- uint row_pack_length() const
+ uint32 pack_length() const override
+ { return (uint32) (field_length + 7) / 8; }
+ uint32 pack_length_in_rec() const override { return bytes_in_rec; }
+ uint pack_length_from_metadata(uint field_metadata) const override;
+ uint row_pack_length() const override
{ return (bytes_in_rec + ((bit_len > 0) ? 1 : 0)); }
- bool compatible_field_size(uint metadata, Relay_log_info *rli,
- uint16 mflags, int *order_var);
- void sql_type(String &str) const;
- virtual uchar *pack(uchar *to, const uchar *from, uint max_length);
- virtual const uchar *unpack(uchar *to, const uchar *from,
- const uchar *from_end, uint param_data);
- virtual int set_default();
+ bool compatible_field_size(uint metadata, const Relay_log_info *rli,
+ uint16 mflags, int *order_var) const override;
+ void sql_type(String &str) const override;
+ uchar *pack(uchar *to, const uchar *from, uint max_length) override;
+ const uchar *unpack(uchar *to, const uchar *from,
+ const uchar *from_end, uint param_data) override;
+ int set_default() override;
Field *new_key_field(MEM_ROOT *root, TABLE *new_table,
uchar *new_ptr, uint32 length,
- uchar *new_null_ptr, uint new_null_bit);
+ uchar *new_null_ptr, uint new_null_bit) override;
void set_bit_ptr(uchar *bit_ptr_arg, uchar bit_ofs_arg)
{
bit_ptr= bit_ptr_arg;
bit_ofs= bit_ofs_arg;
}
- bool eq(Field *field)
+ bool eq(Field *field) override
{
return (Field::eq(field) &&
bit_ptr == ((Field_bit *)field)->bit_ptr &&
bit_ofs == ((Field_bit *)field)->bit_ofs);
}
- bool is_equal(const Column_definition &new_field) const;
- void move_field_offset(my_ptrdiff_t ptr_diff)
+ bool is_equal(const Column_definition &new_field) const override;
+ void move_field_offset(my_ptrdiff_t ptr_diff) override
{
Field::move_field_offset(ptr_diff);
bit_ptr= ADD_TO_PTR(bit_ptr, ptr_diff, uchar*);
}
- void hash(ulong *nr, ulong *nr2);
+ void hash(ulong *nr, ulong *nr2) override;
SEL_ARG *get_mm_leaf(RANGE_OPT_PARAM *param, KEY_PART *key_part,
const Item_bool_func *cond,
- scalar_comparison_op op, Item *value)
+ scalar_comparison_op op, Item *value) override
{
return get_mm_leaf_int(param, key_part, cond, op, value, true);
}
- void print_key_value(String *out, uint32 length)
+ void print_key_value(String *out, uint32 length) override
{
val_int_as_str(out, 1);
}
+ /**
+ Save the field metadata for bit fields.
+ Saves the bit length in the first byte and bytes in record in the
+ second byte of the field metadata array at index of *metadata_ptr and
+ *(metadata_ptr + 1).
+
+ @param metadata_ptr First byte of field metadata
+
+ @returns number of bytes written to metadata_ptr
+ */
+ Binlog_type_info binlog_type_info() const override
+ {
+ DBUG_PRINT("debug", ("bit_len: %d, bytes_in_rec: %d",
+ bit_len, bytes_in_rec));
+ /*
+ Since this class and Field_bit_as_char have different ideas of
+ what should be stored here, we compute the values of the metadata
+ explicitly using the field_length.
+ */
+ return Binlog_type_info(type(),
+ field_length % 8 + ((field_length / 8) << 8), 2);
+ }
private:
- virtual size_t do_last_null_byte() const;
- int save_field_metadata(uchar *first_byte);
+ size_t do_last_null_byte() const override;
};
@@ -4538,13 +4781,13 @@ public:
Field_bit_as_char(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg,
enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg);
- enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }
- uint size_of() const { return sizeof(*this); }
- int store(const char *to, size_t length, CHARSET_INFO *charset);
- int store(double nr) { return Field_bit::store(nr); }
- int store(longlong nr, bool unsigned_val)
+ enum ha_base_keytype key_type() const override { return HA_KEYTYPE_BINARY; }
+ uint size_of() const override { return sizeof *this; }
+ int store(const char *to, size_t length, CHARSET_INFO *charset) override;
+ int store(double nr) override { return Field_bit::store(nr); }
+ int store(longlong nr, bool unsigned_val) override
{ return Field_bit::store(nr, unsigned_val); }
- void sql_type(String &str) const;
+ void sql_type(String &str) const override;
};
@@ -4557,6 +4800,18 @@ public:
m_table(NULL)
{}
~Field_row();
+ en_fieldtype tmp_engine_column_type(bool use_packed_rows) const
+ {
+ DBUG_ASSERT(0);
+ return Field::tmp_engine_column_type(use_packed_rows);
+ }
+ enum_conv_type rpl_conv_type_from(const Conv_source &source,
+ const Relay_log_info *rli,
+ const Conv_param &param) const
+ {
+ DBUG_ASSERT(0);
+ return CONV_TYPE_IMPOSSIBLE;
+ }
Virtual_tmp_table **virtual_tmp_table_addr() { return &m_table; }
bool sp_prepare_and_store_item(THD *thd, Item **value);
};
@@ -4572,22 +4827,23 @@ public:
max number of characters.
*/
ulonglong length;
+ uint decimals;
Field::utype unireg_check;
- TYPELIB *interval; // Which interval to use
+ const TYPELIB *interval; // Which interval to use
CHARSET_INFO *charset;
uint32 srid;
- Field::geometry_type geom_type;
uint pack_flag;
Column_definition_attributes()
:length(0),
+ decimals(0),
unireg_check(Field::NONE),
interval(NULL),
charset(&my_charset_bin),
srid(0),
- geom_type(Field::GEOM_GEOMETRY),
pack_flag(0)
{ }
Column_definition_attributes(const Field *field);
+ Column_definition_attributes(const Type_all_attributes &attr);
Field *make_field(TABLE_SHARE *share, MEM_ROOT *mem_root,
const Record_addr *rec,
const Type_handler *handler,
@@ -4600,8 +4856,12 @@ public:
uint pack_flag_to_pack_length() const;
void frm_pack_basic(uchar *buff) const;
void frm_pack_charset(uchar *buff) const;
+ void frm_pack_numeric_with_dec(uchar *buff) const;
void frm_unpack_basic(const uchar *buff);
bool frm_unpack_charset(TABLE_SHARE *share, const uchar *buff);
+ bool frm_unpack_numeric_with_dec(TABLE_SHARE *share, const uchar *buff);
+ bool frm_unpack_temporal_with_dec(TABLE_SHARE *share, uint intlen,
+ const uchar *buff);
};
@@ -4671,7 +4931,7 @@ public:
for most of the types, or of bytes for BLOBs or numeric types.
*/
uint32 char_length;
- uint decimals, flags, pack_length, key_length;
+ uint flags, pack_length;
List<String> interval_list;
engine_option_value *option_list;
@@ -4694,8 +4954,8 @@ public:
:Type_handler_hybrid_field_type(&type_handler_null),
compression_method_ptr(0),
comment(null_clex_str),
- on_update(NULL), invisible(VISIBLE), char_length(0), decimals(0),
- flags(0), pack_length(0), key_length(0),
+ on_update(NULL), invisible(VISIBLE), char_length(0),
+ flags(0), pack_length(0),
option_list(NULL),
vcol_info(0), default_value(0), check_constraint(0),
versioning(VERSIONING_NOT_SET), period(NULL)
@@ -4708,11 +4968,11 @@ public:
void create_length_to_internal_length_null()
{
DBUG_ASSERT(length == 0);
- key_length= pack_length= 0;
+ pack_length= 0;
}
void create_length_to_internal_length_simple()
{
- key_length= pack_length= type_handler()->calc_pack_length((uint32) length);
+ pack_length= type_handler()->calc_pack_length((uint32) length);
}
void create_length_to_internal_length_string()
{
@@ -4720,14 +4980,12 @@ public:
if (real_field_type() == MYSQL_TYPE_VARCHAR && compression_method())
length++;
set_if_smaller(length, UINT_MAX32);
- key_length= (uint) length;
pack_length= type_handler()->calc_pack_length((uint32) length);
}
void create_length_to_internal_length_typelib()
{
/* Pack_length already calculated in sql_parse.cc */
length*= charset->mbmaxlen;
- key_length= pack_length;
}
bool vers_sys_field() const
{
@@ -4795,7 +5053,7 @@ public:
bool prepare_stage2_varchar(ulonglong table_flags);
bool prepare_stage2_typelib(const char *type_name, uint field_flags,
uint *dup_val_count);
- uint pack_flag_numeric(uint dec) const;
+ uint pack_flag_numeric() const;
uint sign_length() const { return flags & UNSIGNED_FLAG ? 0 : 1; }
bool check_length(uint mysql_errno, uint max_allowed_length) const;
bool fix_attributes_real(uint default_length);
@@ -4857,12 +5115,10 @@ public:
decimals= other.decimals;
flags= other.flags;
pack_length= other.pack_length;
- key_length= other.key_length;
unireg_check= other.unireg_check;
interval= other.interval;
charset= other.charset;
srid= other.srid;
- geom_type= other.geom_type;
pack_flag= other.pack_flag;
}
@@ -4880,6 +5136,8 @@ public:
{ compression_method_ptr= compression_method_arg; }
Compression_method *compression_method() const
{ return compression_method_ptr; }
+
+ bool check_vcol_for_key(THD *thd) const;
};
@@ -5056,7 +5314,7 @@ public:
LEX_CSTRING change; // If done with alter table
LEX_CSTRING after; // Put column after this one
Field *field; // For alter table
- TYPELIB *save_interval; // Temporary copy for the above
+ const TYPELIB *save_interval; // Temporary copy for the above
// Used only for UCS2 intervals
/** structure with parsed options (for comparing fields in ALTER TABLE) */
@@ -5093,22 +5351,21 @@ class Send_field :public Sql_alloc,
public Type_handler_hybrid_field_type
{
public:
- const char *db_name;
- const char *table_name,*org_table_name;
+ LEX_CSTRING db_name;
+ LEX_CSTRING table_name, org_table_name;
LEX_CSTRING col_name, org_col_name;
ulong length;
uint flags, decimals;
- Send_field() {}
Send_field(Field *field)
{
field->make_send_field(this);
- DBUG_ASSERT(table_name != 0);
+ DBUG_ASSERT(table_name.str != 0);
normalize();
}
Send_field(THD *thd, Item *item);
Send_field(Field *field,
- const char *db_name_arg,
- const char *table_name_arg)
+ const LEX_CSTRING &db_name_arg,
+ const LEX_CSTRING &table_name_arg)
:Type_handler_hybrid_field_type(field->type_handler()),
db_name(db_name_arg),
table_name(table_name_arg),
@@ -5163,12 +5420,27 @@ public:
}
// This should move to Type_handler eventually
- bool is_sane() const
+ bool is_sane_float() const
{
return (decimals <= FLOATING_POINT_DECIMALS ||
(type_handler()->field_type() != MYSQL_TYPE_FLOAT &&
type_handler()->field_type() != MYSQL_TYPE_DOUBLE));
}
+ bool is_sane_signess() const
+ {
+ if (type_handler() == type_handler()->type_handler_signed() &&
+ type_handler() == type_handler()->type_handler_unsigned())
+ return true; // Any signess is allowed, e.g. DOUBLE, DECIMAL
+ /*
+ We are here e.g. in case of INT data type.
+ The UNSIGNED_FLAG bit must match in flags and in the type handler.
+ */
+ return ((bool) (flags & UNSIGNED_FLAG)) == type_handler()->is_unsigned();
+ }
+ bool is_sane() const
+ {
+ return is_sane_float() && is_sane_signess();
+ }
};
@@ -5217,7 +5489,7 @@ enum_field_types get_blob_type_from_length(ulong length);
int set_field_to_null(Field *field);
int set_field_to_null_with_conversions(Field *field, bool no_conversions);
int convert_null_to_field_value_or_error(Field *field);
-bool check_expression(Virtual_column_info *vcol, LEX_CSTRING *name,
+bool check_expression(Virtual_column_info *vcol, const LEX_CSTRING *name,
enum_vcol_info_type type);
/*
@@ -5243,6 +5515,8 @@ bool check_expression(Virtual_column_info *vcol, LEX_CSTRING *name,
#define FIELDFLAG_DEC_SHIFT 8
#define FIELDFLAG_MAX_DEC 63U
+#define FIELDFLAG_DEC_MASK 0x3F00U
+
#define MTYP_TYPENR(type) ((type) & 127U) // Remove bits from type
#define f_is_dec(x) ((x) & FIELDFLAG_DECIMAL)
diff --git a/sql/field_conv.cc b/sql/field_conv.cc
index bcd4c5fbb38..f975597cf70 100644
--- a/sql/field_conv.cc
+++ b/sql/field_conv.cc
@@ -30,7 +30,7 @@
#include "sql_class.h" // THD
#include <m_ctype.h>
-static void do_field_eq(Copy_field *copy)
+void Field::do_field_eq(Copy_field *copy)
{
memcpy(copy->to_ptr,copy->from_ptr,copy->from_length);
}
@@ -638,7 +638,7 @@ void Copy_field::set(uchar *to,Field *from)
else
{
to_null_ptr= 0; // For easy debugging
- do_copy= do_field_eq;
+ do_copy= Field::do_field_eq;
}
}
@@ -719,7 +719,7 @@ void Copy_field::set(Field *to,Field *from,bool save)
if ((to->flags & BLOB_FLAG) && save)
do_copy2= do_save_blob;
else
- do_copy2= to->get_copy_func(from);
+ do_copy2= from->get_copy_func_to(to);
if (!do_copy) // Not null
do_copy=do_copy2;
}
@@ -786,7 +786,7 @@ Field::Copy_func *Field_string::get_copy_func(const Field *from) const
{
if (from->type() == MYSQL_TYPE_BIT)
return do_field_int;
- if (Field_string::real_type() != from->real_type() ||
+ if (Field_string::type_handler() != from->type_handler() ||
Field_string::charset() != from->charset())
return do_field_string;
if (Field_string::pack_length() < from->pack_length())
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index 5927b047f77..45ea9eb1552 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -72,7 +72,8 @@
#define PAR_ENGINES_OFFSET 12
#define PARTITION_ENABLED_TABLE_FLAGS (HA_FILE_BASED | \
HA_REC_NOT_IN_SEQ | \
- HA_CAN_REPAIR)
+ HA_CAN_REPAIR | \
+ HA_REUSES_FILE_NAMES)
#define PARTITION_DISABLED_TABLE_FLAGS (HA_CAN_GEOMETRY | \
HA_DUPLICATE_POS | \
HA_CAN_INSERT_DELAYED | \
@@ -125,7 +126,6 @@ static int partition_initialize(void *p)
handlerton *partition_hton;
partition_hton= (handlerton *)p;
- partition_hton->state= SHOW_OPTION_YES;
partition_hton->db_type= DB_TYPE_PARTITION_DB;
partition_hton->create= partition_create_handler;
partition_hton->partition_flags= partition_flags;
@@ -2547,9 +2547,9 @@ register_query_cache_dependant_tables(THD *thd,
sub_elem= subpart_it++;
part= i * num_subparts + j;
/* we store the end \0 as part of the key */
- end= strmov(engine_pos, sub_elem->partition_name);
+ end= strmov(engine_pos, sub_elem->partition_name) + 1;
length= (uint)(end - engine_key);
- /* Copy the suffix also to query cache key */
+ /* Copy the suffix and end 0 to query cache key */
memcpy(query_cache_key_end, engine_key_end, (end - engine_key_end));
if (reg_query_cache_dependant_table(thd, engine_key, length,
query_cache_key,
@@ -2565,7 +2565,7 @@ register_query_cache_dependant_tables(THD *thd,
{
char *end= engine_pos+1; // copy end \0
uint length= (uint)(end - engine_key);
- /* Copy the suffix also to query cache key */
+ /* Copy the suffix and end 0 to query cache key */
memcpy(query_cache_key_end, engine_key_end, (end - engine_key_end));
if (reg_query_cache_dependant_table(thd, engine_key, length,
query_cache_key,
@@ -4276,7 +4276,7 @@ int ha_partition::write_row(const uchar * buf)
bool have_auto_increment= table->next_number_field && buf == table->record[0];
my_bitmap_map *old_map;
THD *thd= ha_thd();
- sql_mode_t saved_sql_mode= thd->variables.sql_mode;
+ Sql_mode_save sms(thd);
bool saved_auto_inc_field_not_null= table->auto_increment_field_not_null;
DBUG_ENTER("ha_partition::write_row");
DBUG_PRINT("enter", ("partition this: %p", this));
@@ -4342,7 +4342,6 @@ int ha_partition::write_row(const uchar * buf)
reenable_binlog(thd);
exit:
- thd->variables.sql_mode= saved_sql_mode;
table->auto_increment_field_not_null= saved_auto_inc_field_not_null;
DBUG_RETURN(error);
}
@@ -10235,19 +10234,6 @@ end:
}
-void ha_partition::notify_table_changed()
-{
- handler **file;
-
- DBUG_ENTER("ha_partition::notify_table_changed");
-
- for (file= m_file; *file; file++)
- (*file)->ha_notify_table_changed();
-
- DBUG_VOID_RETURN;
-}
-
-
uint ha_partition::min_of_the_max_uint(
uint (handler::*operator_func)(void) const) const
{
diff --git a/sql/ha_partition.h b/sql/ha_partition.h
index 6407a607fe7..0fe98dc4608 100644
--- a/sql/ha_partition.h
+++ b/sql/ha_partition.h
@@ -1408,8 +1408,6 @@ public:
virtual bool commit_inplace_alter_table(TABLE *altered_table,
Alter_inplace_info *ha_alter_info,
bool commit);
- virtual void notify_table_changed();
-
/*
-------------------------------------------------------------------------
MODULE tablespace support
diff --git a/sql/ha_sequence.cc b/sql/ha_sequence.cc
index beaed6ef7df..87d8339881d 100644
--- a/sql/ha_sequence.cc
+++ b/sql/ha_sequence.cc
@@ -101,7 +101,7 @@ int ha_sequence::open(const char *name, int mode, uint flags)
ha_open() sets the following for us. We have to set this for the
underlying handler
*/
- file->cached_table_flags= file->table_flags();
+ file->cached_table_flags= (file->table_flags() | HA_REUSES_FILE_NAMES);
file->reset_statistics();
internal_tmp_table= file->internal_tmp_table=
@@ -413,7 +413,6 @@ static int sequence_initialize(void *p)
handlerton *local_sequence_hton= (handlerton *)p;
DBUG_ENTER("sequence_initialize");
- local_sequence_hton->state= SHOW_OPTION_YES;
local_sequence_hton->db_type= DB_TYPE_SEQUENCE;
local_sequence_hton->create= sequence_create_handler;
local_sequence_hton->panic= sequence_end;
diff --git a/sql/handle_connections_win.cc b/sql/handle_connections_win.cc
index e5b601d7fe0..3b29ad439ac 100644
--- a/sql/handle_connections_win.cc
+++ b/sql/handle_connections_win.cc
@@ -367,17 +367,14 @@ struct Pipe_Listener : public Listener
static void create_pipe_connection(HANDLE pipe)
{
- CONNECT *connect;
- if (!(connect= new CONNECT) || !(connect->vio= vio_new_win32pipe(pipe)))
+ if (auto connect= new CONNECT(pipe))
+ create_new_thread(connect);
+ else
{
CloseHandle(pipe);
- delete connect;
statistic_increment(aborted_connects, &LOCK_status);
statistic_increment(connection_errors_internal, &LOCK_status);
- return;
}
- connect->host= my_localhost;
- create_new_thread(connect);
}
/* Threadpool callback.*/
diff --git a/sql/handler.cc b/sql/handler.cc
index 72b11098060..67abe2362a3 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -297,7 +297,7 @@ handler *get_new_handler(TABLE_SHARE *share, MEM_ROOT *alloc,
DBUG_ENTER("get_new_handler");
DBUG_PRINT("enter", ("alloc: %p", alloc));
- if (db_type && db_type->state == SHOW_OPTION_YES && db_type->create)
+ if (ha_storage_engine_is_enabled(db_type))
{
if ((file= db_type->create(db_type, share, alloc)))
file->init();
@@ -482,15 +482,8 @@ int ha_finalize_handlerton(st_plugin_int *plugin)
if (!hton)
goto end;
- switch (hton->state) {
- case SHOW_OPTION_NO:
- case SHOW_OPTION_DISABLED:
- break;
- case SHOW_OPTION_YES:
- if (installed_htons[hton->db_type] == hton)
- installed_htons[hton->db_type]= NULL;
- break;
- };
+ if (installed_htons[hton->db_type] == hton)
+ installed_htons[hton->db_type]= NULL;
if (hton->panic)
hton->panic(hton, HA_PANIC_CLOSE);
@@ -557,7 +550,7 @@ int ha_initialize_handlerton(st_plugin_int *plugin)
if (plugin->plugin->init && plugin->plugin->init(hton))
{
sql_print_error("Plugin '%s' init function returned error.",
- plugin->name.str);
+ plugin->name.str);
goto err;
}
@@ -576,90 +569,78 @@ int ha_initialize_handlerton(st_plugin_int *plugin)
hton->discover_table_existence= full_discover_for_existence;
}
- switch (hton->state) {
- case SHOW_OPTION_NO:
- break;
- case SHOW_OPTION_YES:
- {
- uint tmp;
- ulong fslot;
-
- DBUG_EXECUTE_IF("unstable_db_type", {
- static int i= (int) DB_TYPE_FIRST_DYNAMIC;
- hton->db_type= (enum legacy_db_type)++i;
- });
-
- /* now check the db_type for conflict */
- if (hton->db_type <= DB_TYPE_UNKNOWN ||
- hton->db_type >= DB_TYPE_DEFAULT ||
- installed_htons[hton->db_type])
- {
- int idx= (int) DB_TYPE_FIRST_DYNAMIC;
+ uint tmp;
+ ulong fslot;
- while (idx < (int) DB_TYPE_DEFAULT && installed_htons[idx])
- idx++;
+ DBUG_EXECUTE_IF("unstable_db_type", {
+ static int i= (int) DB_TYPE_FIRST_DYNAMIC;
+ hton->db_type= (enum legacy_db_type)++i;
+ });
- if (idx == (int) DB_TYPE_DEFAULT)
- {
- sql_print_warning("Too many storage engines!");
- goto err_deinit;
- }
- if (hton->db_type != DB_TYPE_UNKNOWN)
- sql_print_warning("Storage engine '%s' has conflicting typecode. "
- "Assigning value %d.", plugin->plugin->name, idx);
- hton->db_type= (enum legacy_db_type) idx;
- }
+ /* now check the db_type for conflict */
+ if (hton->db_type <= DB_TYPE_UNKNOWN ||
+ hton->db_type >= DB_TYPE_DEFAULT ||
+ installed_htons[hton->db_type])
+ {
+ int idx= (int) DB_TYPE_FIRST_DYNAMIC;
- /*
- In case a plugin is uninstalled and re-installed later, it should
- reuse an array slot. Otherwise the number of uninstall/install
- cycles would be limited. So look for a free slot.
- */
- DBUG_PRINT("plugin", ("total_ha: %lu", total_ha));
- for (fslot= 0; fslot < total_ha; fslot++)
- {
- if (!hton2plugin[fslot])
- break;
- }
- if (fslot < total_ha)
- hton->slot= fslot;
- else
- {
- if (total_ha >= MAX_HA)
- {
- sql_print_error("Too many plugins loaded. Limit is %lu. "
- "Failed on '%s'", (ulong) MAX_HA, plugin->name.str);
- goto err_deinit;
- }
- hton->slot= total_ha++;
- }
- installed_htons[hton->db_type]= hton;
- tmp= hton->savepoint_offset;
- hton->savepoint_offset= savepoint_alloc_size;
- savepoint_alloc_size+= tmp;
- hton2plugin[hton->slot]=plugin;
- if (hton->prepare)
- {
- total_ha_2pc++;
- if (tc_log && tc_log != get_tc_log_implementation())
- {
- total_ha_2pc--;
- hton->prepare= 0;
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
- ER_UNKNOWN_ERROR,
- "Cannot enable tc-log at run-time. "
- "XA features of %s are disabled",
- plugin->name.str);
- }
- }
+ while (idx < (int) DB_TYPE_DEFAULT && installed_htons[idx])
+ idx++;
+
+ if (idx == (int) DB_TYPE_DEFAULT)
+ {
+ sql_print_warning("Too many storage engines!");
+ goto err_deinit;
+ }
+ if (hton->db_type != DB_TYPE_UNKNOWN)
+ sql_print_warning("Storage engine '%s' has conflicting typecode. "
+ "Assigning value %d.", plugin->plugin->name, idx);
+ hton->db_type= (enum legacy_db_type) idx;
+ }
+
+ /*
+ In case a plugin is uninstalled and re-installed later, it should
+ reuse an array slot. Otherwise the number of uninstall/install
+ cycles would be limited. So look for a free slot.
+ */
+ DBUG_PRINT("plugin", ("total_ha: %lu", total_ha));
+ for (fslot= 0; fslot < total_ha; fslot++)
+ {
+ if (!hton2plugin[fslot])
break;
+ }
+ if (fslot < total_ha)
+ hton->slot= fslot;
+ else
+ {
+ if (total_ha >= MAX_HA)
+ {
+ sql_print_error("Too many plugins loaded. Limit is %lu. "
+ "Failed on '%s'", (ulong) MAX_HA, plugin->name.str);
+ goto err_deinit;
}
- /* fall through */
- default:
- hton->state= SHOW_OPTION_DISABLED;
- break;
+ hton->slot= total_ha++;
}
-
+ installed_htons[hton->db_type]= hton;
+ tmp= hton->savepoint_offset;
+ hton->savepoint_offset= savepoint_alloc_size;
+ savepoint_alloc_size+= tmp;
+ hton2plugin[hton->slot]=plugin;
+ if (hton->prepare)
+ {
+ total_ha_2pc++;
+ if (tc_log && tc_log != get_tc_log_implementation())
+ {
+ total_ha_2pc--;
+ hton->prepare= 0;
+ push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_UNKNOWN_ERROR,
+ "Cannot enable tc-log at run-time. "
+ "XA features of %s are disabled",
+ plugin->name.str);
+ }
+ }
+
/*
This is entirely for legacy. We will create a new "disk based" hton and a
"memory" hton which will be configurable longterm. We should be able to
@@ -694,10 +675,10 @@ err_deinit:
*/
if (plugin->plugin->deinit)
(void) plugin->plugin->deinit(NULL);
-
+
err:
#ifdef DBUG_ASSERT_EXISTS
- if (hton->prepare && hton->state == SHOW_OPTION_YES)
+ if (hton->prepare)
failed_ha_2pc++;
#endif
my_free(hton);
@@ -742,7 +723,7 @@ static my_bool dropdb_handlerton(THD *unused1, plugin_ref plugin,
void *path)
{
handlerton *hton= plugin_hton(plugin);
- if (hton->state == SHOW_OPTION_YES && hton->drop_database)
+ if (hton->drop_database)
hton->drop_database(hton, (char *)path);
return FALSE;
}
@@ -758,7 +739,7 @@ static my_bool checkpoint_state_handlerton(THD *unused1, plugin_ref plugin,
void *disable)
{
handlerton *hton= plugin_hton(plugin);
- if (hton->state == SHOW_OPTION_YES && hton->checkpoint_state)
+ if (hton->checkpoint_state)
hton->checkpoint_state(hton, (int) *(bool*) disable);
return FALSE;
}
@@ -780,7 +761,7 @@ static my_bool commit_checkpoint_request_handlerton(THD *unused1, plugin_ref plu
{
st_commit_checkpoint_request *st= (st_commit_checkpoint_request *)data;
handlerton *hton= plugin_hton(plugin);
- if (hton->state == SHOW_OPTION_YES && hton->commit_checkpoint_request)
+ if (hton->commit_checkpoint_request)
{
void *cookie= st->cookie;
if (st->pre_hook)
@@ -807,34 +788,29 @@ ha_commit_checkpoint_request(void *cookie, void (*pre_hook)(void *))
}
-
-static my_bool closecon_handlerton(THD *thd, plugin_ref plugin,
- void *unused)
-{
- handlerton *hton= plugin_hton(plugin);
- /*
- there's no need to rollback here as all transactions must
- be rolled back already
- */
- if (hton->state == SHOW_OPTION_YES && thd_get_ha_data(thd, hton))
- {
- if (hton->close_connection)
- hton->close_connection(hton, thd);
- /* make sure ha_data is reset and ha_data_lock is released */
- thd_set_ha_data(thd, hton, NULL);
- }
- return FALSE;
-}
-
/**
@note
don't bother to rollback here, it's done already
+
+ there's no need to rollback here as all transactions must
+ be rolled back already
*/
void ha_close_connection(THD* thd)
{
- plugin_foreach_with_mask(thd, closecon_handlerton,
- MYSQL_STORAGE_ENGINE_PLUGIN,
- PLUGIN_IS_DELETED|PLUGIN_IS_READY, 0);
+ for (auto i= 0; i < MAX_HA; i++)
+ {
+ if (thd->ha_data[i].lock)
+ {
+ handlerton *hton= plugin_hton(thd->ha_data[i].lock);
+ if (hton->close_connection)
+ hton->close_connection(hton, thd);
+ /* make sure SE didn't reset ha_data in close_connection() */
+ DBUG_ASSERT(thd->ha_data[i].lock);
+ /* make sure ha_data is reset and ha_data_lock is released */
+ thd_set_ha_data(thd, hton, 0);
+ }
+ DBUG_ASSERT(!thd->ha_data[i].ha_ptr);
+ }
}
static my_bool kill_handlerton(THD *thd, plugin_ref plugin,
@@ -842,8 +818,7 @@ static my_bool kill_handlerton(THD *thd, plugin_ref plugin,
{
handlerton *hton= plugin_hton(plugin);
- if (hton->state == SHOW_OPTION_YES && hton->kill_query &&
- thd_get_ha_data(thd, hton))
+ if (hton->kill_query && thd_get_ha_data(thd, hton))
hton->kill_query(hton, thd, *(enum thd_kill_levels *) level);
return FALSE;
}
@@ -864,7 +839,7 @@ static my_bool plugin_prepare_for_backup(THD *unused1, plugin_ref plugin,
void *not_used)
{
handlerton *hton= plugin_hton(plugin);
- if (hton->state == SHOW_OPTION_YES && hton->prepare_for_backup)
+ if (hton->prepare_for_backup)
hton->prepare_for_backup();
return FALSE;
}
@@ -880,7 +855,7 @@ static my_bool plugin_end_backup(THD *unused1, plugin_ref plugin,
void *not_used)
{
handlerton *hton= plugin_hton(plugin);
- if (hton->state == SHOW_OPTION_YES && hton->end_backup)
+ if (hton->end_backup)
hton->end_backup();
return FALSE;
}
@@ -1562,8 +1537,9 @@ int ha_commit_trans(THD *thd, bool all)
#endif /* WITH_WSREP */
error= ha_commit_one_phase(thd, all);
#ifdef WITH_WSREP
- if (run_wsrep_hooks)
- error= error || wsrep_after_commit(thd, all);
+ // Here in case of error we must return 2 for inconsistency
+ if (run_wsrep_hooks && !error)
+ error= wsrep_after_commit(thd, all) ? 2 : 0;
#endif /* WITH_WSREP */
goto done;
}
@@ -1632,8 +1608,10 @@ int ha_commit_trans(THD *thd, bool all)
error= commit_one_phase_2(thd, all, trans, is_real_trans) ? 2 : 0;
#ifdef WITH_WSREP
- if (run_wsrep_hooks && (error || (error = wsrep_after_commit(thd, all))))
+ if (run_wsrep_hooks &&
+ (error || (error = wsrep_after_commit(thd, all))))
{
+ error = 2;
mysql_mutex_lock(&thd->LOCK_thd_data);
if (wsrep_must_abort(thd))
{
@@ -1958,7 +1936,7 @@ static my_bool xacommit_handlerton(THD *unused1, plugin_ref plugin,
void *arg)
{
handlerton *hton= plugin_hton(plugin);
- if (hton->state == SHOW_OPTION_YES && hton->recover)
+ if (hton->recover)
{
hton->commit_by_xid(hton, ((struct xahton_st *)arg)->xid);
((struct xahton_st *)arg)->result= 0;
@@ -1970,7 +1948,7 @@ static my_bool xarollback_handlerton(THD *unused1, plugin_ref plugin,
void *arg)
{
handlerton *hton= plugin_hton(plugin);
- if (hton->state == SHOW_OPTION_YES && hton->recover)
+ if (hton->recover)
{
hton->rollback_by_xid(hton, ((struct xahton_st *)arg)->xid);
((struct xahton_st *)arg)->result= 0;
@@ -2103,7 +2081,7 @@ static my_bool xarecover_handlerton(THD *unused, plugin_ref plugin,
struct xarecover_st *info= (struct xarecover_st *) arg;
int got;
- if (hton->state == SHOW_OPTION_YES && hton->recover)
+ if (hton->recover)
{
while ((got= hton->recover(hton, info->list, info->len)) > 0 )
{
@@ -2438,8 +2416,7 @@ static my_bool snapshot_handlerton(THD *thd, plugin_ref plugin,
void *arg)
{
handlerton *hton= plugin_hton(plugin);
- if (hton->state == SHOW_OPTION_YES &&
- hton->start_consistent_snapshot)
+ if (hton->start_consistent_snapshot)
{
if (hton->start_consistent_snapshot(hton, thd))
return TRUE;
@@ -2485,28 +2462,14 @@ static my_bool flush_handlerton(THD *thd, plugin_ref plugin,
void *arg)
{
handlerton *hton= plugin_hton(plugin);
- if (hton->state == SHOW_OPTION_YES && hton->flush_logs &&
- hton->flush_logs(hton))
- return TRUE;
- return FALSE;
+ return hton->flush_logs && hton->flush_logs(hton);
}
-bool ha_flush_logs(handlerton *db_type)
+bool ha_flush_logs()
{
- if (db_type == NULL)
- {
- if (plugin_foreach(NULL, flush_handlerton,
- MYSQL_STORAGE_ENGINE_PLUGIN, 0))
- return TRUE;
- }
- else
- {
- if (db_type->state != SHOW_OPTION_YES ||
- (db_type->flush_logs && db_type->flush_logs(db_type)))
- return TRUE;
- }
- return FALSE;
+ return plugin_foreach(NULL, flush_handlerton,
+ MYSQL_STORAGE_ENGINE_PLUGIN, 0);
}
@@ -2590,9 +2553,10 @@ int ha_delete_table(THD *thd, handlerton *table_type, const char *path,
it's not an error if the table doesn't exist in the engine.
warn the user, but still report DROP being a success
*/
- bool intercept= error == ENOENT || error == HA_ERR_NO_SUCH_TABLE;
+ bool intercept= (error == ENOENT || error == HA_ERR_NO_SUCH_TABLE ||
+ error == HA_ERR_UNSUPPORTED);
- if (!intercept || generate_warning)
+ if ((!intercept || generate_warning) && ! thd->is_error())
{
/* Fill up strucutures that print_error may need */
dummy_share.path.str= (char*) path;
@@ -2605,7 +2569,10 @@ int ha_delete_table(THD *thd, handlerton *table_type, const char *path,
file->print_error(error, MYF(intercept ? ME_WARNING : 0));
}
if (intercept)
+ {
+ thd->clear_error();
error= 0;
+ }
}
delete file;
@@ -2682,10 +2649,6 @@ double handler::keyread_time(uint index, uint ranges, ha_rows rows)
return cost;
}
-void **handler::ha_data(THD *thd) const
-{
- return thd_ha_data(thd, ht);
-}
THD *handler::ha_thd(void) const
{
@@ -4057,7 +4020,7 @@ int handler::check_collation_compatibility()
cs_number == 23 || /* cp1251_ukrainian_ci - bug #29461 */
cs_number == 26)) || /* cp1250_general_ci - bug #29461 */
(mysql_version < 50124 &&
- (cs_number == 33 || /* utf8_general_ci - bug #27877 */
+ (cs_number == 33 || /* utf8mb3_general_ci - bug #27877 */
cs_number == 35))) /* ucs2_general_ci - bug #27877 */
return HA_ADMIN_NEEDS_UPGRADE;
}
@@ -5340,7 +5303,7 @@ static my_bool discover_handlerton(THD *thd, plugin_ref plugin,
{
TABLE_SHARE *share= (TABLE_SHARE *)arg;
handlerton *hton= plugin_hton(plugin);
- if (hton->state == SHOW_OPTION_YES && hton->discover_table)
+ if (hton->discover_table)
{
share->db_plugin= plugin;
int error= hton->discover_table(hton, thd, share);
@@ -5416,7 +5379,7 @@ static my_bool discover_existence(THD *thd, plugin_ref plugin,
{
st_discover_existence_args *args= (st_discover_existence_args*)arg;
handlerton *ht= plugin_hton(plugin);
- if (ht->state != SHOW_OPTION_YES || !ht->discover_table_existence)
+ if (!ht->discover_table_existence)
return args->frm_exists;
args->hton= ht;
@@ -5706,7 +5669,7 @@ static my_bool discover_names(THD *thd, plugin_ref plugin,
st_discover_names_args *args= (st_discover_names_args *)arg;
handlerton *ht= plugin_hton(plugin);
- if (ht->state == SHOW_OPTION_YES && ht->discover_table_names)
+ if (ht->discover_table_names)
{
size_t old_elements= args->result->tables->elements();
if (ht->discover_table_names(ht, args->db, args->dirp, args->result))
@@ -5751,6 +5714,8 @@ int ha_discover_table_names(THD *thd, LEX_CSTRING *db, MY_DIR *dirp,
error= ext_table_discovery_simple(dirp, result) ||
plugin_foreach(thd, discover_names,
MYSQL_STORAGE_ENGINE_PLUGIN, &args);
+ if (args.possible_duplicates > 0)
+ result->remove_duplicates();
}
else
{
@@ -6105,7 +6070,7 @@ static my_bool showstat_handlerton(THD *thd, plugin_ref plugin,
{
enum ha_stat_type stat= *(enum ha_stat_type *) arg;
handlerton *hton= plugin_hton(plugin);
- if (hton->state == SHOW_OPTION_YES && hton->show_status &&
+ if (hton->show_status &&
hton->show_status(hton, thd, stat_print, stat))
return TRUE;
return FALSE;
@@ -6137,17 +6102,8 @@ bool ha_show_status(THD *thd, handlerton *db_type, enum ha_stat_type stat)
}
else
{
- if (db_type->state != SHOW_OPTION_YES)
- {
- const LEX_CSTRING *name= hton_name(db_type);
- result= stat_print(thd, name->str, name->length,
- "", 0, "DISABLED", 8) ? 1 : 0;
- }
- else
- {
- result= db_type->show_status &&
- db_type->show_status(db_type, thd, stat_print, stat) ? 1 : 0;
- }
+ result= db_type->show_status &&
+ db_type->show_status(db_type, thd, stat_print, stat) ? 1 : 0;
}
/*
@@ -7463,11 +7419,7 @@ bool Table_scope_and_contents_source_st::vers_check_system_fields(
if (!(alter_info->flags & ALTER_ADD_SYSTEM_VERSIONING))
return false;
- bool can_native= ha_check_storage_engine_flag(db_type,
- HTON_NATIVE_SYS_VERSIONING)
- || db_type->db_type == DB_TYPE_PARTITION_DB;
-
- return vers_info.check_sys_fields(table_name, db, alter_info, can_native);
+ return vers_info.check_sys_fields(table_name, db, alter_info);
}
@@ -7573,7 +7525,16 @@ bool Vers_parse_info::fix_alter_info(THD *thd, Alter_info *alter_info,
return false;
}
- return fix_implicit(thd, alter_info);
+ if (fix_implicit(thd, alter_info))
+ return true;
+
+ if (alter_info->flags & ALTER_ADD_SYSTEM_VERSIONING)
+ {
+ if (check_sys_fields(table_name, share->db, alter_info))
+ return true;
+ }
+
+ return false;
}
bool
@@ -7674,83 +7635,121 @@ bool Vers_parse_info::check_conditions(const Lex_table_name &table_name,
return false;
}
-static bool is_versioning_timestamp(const Create_field *f)
+static bool is_versioning_timestamp(const Column_definition *f)
{
return f->type_handler() == &type_handler_timestamp2 &&
f->length == MAX_DATETIME_FULL_WIDTH;
}
-static bool is_some_bigint(const Create_field *f)
+static bool is_some_bigint(const Column_definition *f)
{
- return f->type_handler() == &type_handler_longlong ||
+ return f->type_handler() == &type_handler_slonglong ||
+ f->type_handler() == &type_handler_ulonglong ||
f->type_handler() == &type_handler_vers_trx_id;
}
-static bool is_versioning_bigint(const Create_field *f)
+static bool is_versioning_bigint(const Column_definition *f)
{
return is_some_bigint(f) && f->flags & UNSIGNED_FLAG &&
f->length == MY_INT64_NUM_DECIMAL_DIGITS - 1;
}
-static bool require_timestamp(const Create_field *f, Lex_table_name table_name)
+static void require_timestamp_error(const char *field, const char *table)
{
- my_error(ER_VERS_FIELD_WRONG_TYPE, MYF(0), f->field_name.str, "TIMESTAMP(6)",
- table_name.str);
- return true;
+ my_error(ER_VERS_FIELD_WRONG_TYPE, MYF(0), field, "TIMESTAMP(6)", table);
}
-static bool require_bigint(const Create_field *f, Lex_table_name table_name)
+
+static void require_trx_id_error(const char *field, const char *table)
{
- my_error(ER_VERS_FIELD_WRONG_TYPE, MYF(0), f->field_name.str,
- "BIGINT(20) UNSIGNED", table_name.str);
- return true;
+ my_error(ER_VERS_FIELD_WRONG_TYPE, MYF(0), field, "BIGINT(20) UNSIGNED",
+ table);
+}
+
+
+bool Vers_type_timestamp::check_sys_fields(const LEX_CSTRING &table_name,
+ const Column_definition *row_start,
+ const Column_definition *row_end) const
+{
+ if (!is_versioning_timestamp(row_start))
+ {
+ require_timestamp_error(row_start->field_name.str, table_name.str);
+ return true;
+ }
+
+ if (row_end->type_handler()->vers() != this ||
+ !is_versioning_timestamp(row_end))
+ {
+ require_timestamp_error(row_end->field_name.str, table_name.str);
+ return true;
+ }
+
+ return false;
+}
+
+
+bool Vers_type_trx::check_sys_fields(const LEX_CSTRING &table_name,
+ const Column_definition *row_start,
+ const Column_definition *row_end) const
+{
+ if (!is_versioning_bigint(row_start))
+ {
+ require_trx_id_error(row_start->field_name.str, table_name.str);
+ return true;
+ }
+
+ if (row_end->type_handler()->vers() != this ||
+ !is_versioning_bigint(row_end))
+ {
+ require_trx_id_error(row_end->field_name.str, table_name.str);
+ return true;
+ }
+
+ if (!is_some_bigint(row_start))
+ {
+ require_timestamp_error(row_start->field_name.str, table_name.str);
+ return true;
+ }
+
+ if (!TR_table::use_transaction_registry)
+ {
+ my_error(ER_VERS_TRT_IS_DISABLED, MYF(0));
+ return true;
+ }
+
+ return false;
}
bool Vers_parse_info::check_sys_fields(const Lex_table_name &table_name,
const Lex_table_name &db,
- Alter_info *alter_info,
- bool can_native) const
+ Alter_info *alter_info) const
{
if (check_conditions(table_name, db))
return true;
+ List_iterator<Create_field> it(alter_info->create_list);
const Create_field *row_start= NULL;
const Create_field *row_end= NULL;
-
- List_iterator<Create_field> it(alter_info->create_list);
- while (Create_field *f= it++)
+ while (const Create_field *f= it++)
{
- if (!row_start && f->flags & VERS_SYS_START_FLAG)
+ if (f->flags & VERS_SYS_START_FLAG && !row_start)
row_start= f;
- else if (!row_end && f->flags & VERS_SYS_END_FLAG)
+ if (f->flags & VERS_SYS_END_FLAG && !row_end)
row_end= f;
}
- const bool expect_timestamp=
- !can_native || !is_some_bigint(row_start) || !is_some_bigint(row_end);
+ DBUG_ASSERT(row_start);
+ DBUG_ASSERT(row_end);
- if (expect_timestamp)
- {
- if (!is_versioning_timestamp(row_start))
- return require_timestamp(row_start, table_name);
+ const Vers_type_handler *row_start_vers= row_start->type_handler()->vers();
- if (!is_versioning_timestamp(row_end))
- return require_timestamp(row_end, table_name);
- }
- else
+ if (!row_start_vers)
{
- if (!is_versioning_bigint(row_start))
- return require_bigint(row_start, table_name);
-
- if (!is_versioning_bigint(row_end))
- return require_bigint(row_end, table_name);
+ require_timestamp_error(row_start->field_name.str, table_name);
+ return true;
}
- if (is_versioning_bigint(row_start) && is_versioning_bigint(row_end) &&
- !TR_table::use_transaction_registry)
- {
- my_error(ER_VERS_TRT_IS_DISABLED, MYF(0));
+ if (row_start_vers->check_sys_fields(table_name, row_start, row_end))
return true;
- }
return false;
}
diff --git a/sql/handler.h b/sql/handler.h
index 2d25568488b..c751817f5f1 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -52,7 +52,6 @@ class Rowid_filter;
class Field_string;
class Field_varstring;
class Field_blob;
-class Field_geom;
class Column_definition;
// the following is for checking tables
@@ -213,7 +212,8 @@ enum enum_alter_inplace_result {
#define HA_HAS_NEW_CHECKSUM (1ULL << 38)
#define HA_CAN_VIRTUAL_COLUMNS (1ULL << 39)
#define HA_MRR_CANT_SORT (1ULL << 40)
-#define HA_RECORD_MUST_BE_CLEAN_ON_WRITE (1ULL << 41) /* unused */
+/* All of VARCHAR is stored, including bytes after real varchar data */
+#define HA_RECORD_MUST_BE_CLEAN_ON_WRITE (1ULL << 41)
/*
This storage engine supports condition pushdown
@@ -297,6 +297,9 @@ enum enum_alter_inplace_result {
#define HA_PERSISTENT_TABLE (1ULL << 48)
+/* If storage engine uses another engine as a base */
+#define HA_REUSES_FILE_NAMES (1ULL << 49)
+
/*
Set of all binlog flags. Currently only contain the capabilities
flags.
@@ -511,6 +514,7 @@ enum legacy_db_type
DB_TYPE_BINLOG=21,
DB_TYPE_PBXT=23,
DB_TYPE_PERFORMANCE_SCHEMA=28,
+ DB_TYPE_S3=41,
DB_TYPE_ARIA=42,
DB_TYPE_TOKUDB=43,
DB_TYPE_SEQUENCE=44,
@@ -1019,11 +1023,7 @@ enum enum_schema_tables
SCH_TABLE_PRIVILEGES,
SCH_TRIGGERS,
SCH_USER_PRIVILEGES,
- SCH_VIEWS,
-#ifdef HAVE_SPATIAL
- SCH_GEOMETRY_COLUMNS,
- SCH_SPATIAL_REF_SYS,
-#endif /*HAVE_SPATIAL*/
+ SCH_VIEWS
};
struct TABLE_SHARE;
@@ -1237,11 +1237,6 @@ typedef struct st_order ORDER;
struct handlerton
{
/*
- Historical marker for if the engine is available of not
- */
- SHOW_COMP_OPTION state;
-
- /*
Historical number used for frm file to determine the correct
storage engine. This is going away and new engines will just use
"name" for this.
@@ -1640,6 +1635,14 @@ struct handlerton
int (*discover_table_structure)(handlerton *hton, THD* thd,
TABLE_SHARE *share, HA_CREATE_INFO *info);
+ /*
+ Notify the storage engine that the definition of the table (and the .frm
+ file) has changed. Returns 0 if ok.
+ */
+ int (*notify_tabledef_changed)(handlerton *hton, LEX_CSTRING *db,
+ LEX_CSTRING *table_name, LEX_CUSTRING *frm,
+ LEX_CUSTRING *org_tabledef_version);
+
/*
System Versioning
*/
@@ -1944,11 +1947,13 @@ enum enum_stats_auto_recalc { HA_STATS_AUTO_RECALC_DEFAULT= 0,
It stores the "schema_specification" part of the CREATE/ALTER statements and
is passed to mysql_create_db() and mysql_alter_db().
- Currently consists only of the schema default character set and collation.
+ Currently consists of the schema default character set, collation
+ and schema_comment.
*/
struct Schema_specification_st
{
CHARSET_INFO *default_table_charset;
+ LEX_CSTRING *schema_comment;
void init()
{
bzero(this, sizeof(*this));
@@ -1957,13 +1962,6 @@ struct Schema_specification_st
class Create_field;
-enum vers_sys_type_t
-{
- VERS_UNDEFINED= 0,
- VERS_TIMESTAMP,
- VERS_TRX_ID
-};
-
struct Table_period_info: Sql_alloc
{
Table_period_info() :
@@ -2046,8 +2044,7 @@ public:
bool fix_create_like(Alter_info &alter_info, HA_CREATE_INFO &create_info,
TABLE_LIST &src_table, TABLE_LIST &table);
bool check_sys_fields(const Lex_table_name &table_name,
- const Lex_table_name &db, Alter_info *alter_info,
- bool can_native) const;
+ const Lex_table_name &db, Alter_info *alter_info) const;
/**
At least one field was specified 'WITH/WITHOUT SYSTEM VERSIONING'.
@@ -4286,7 +4283,7 @@ public:
*) Update SQL-layer data-dictionary by installing .FRM file for the new version
of the table.
*) Inform the storage engine about this change by calling the
- handler::ha_notify_table_changed() method.
+ hton::notify_table_changed()
*) Destroy the Alter_inplace_info and handler_ctx objects.
*/
@@ -4353,16 +4350,6 @@ public:
bool commit);
- /**
- Public function wrapping the actual handler call.
- @see notify_table_changed()
- */
- void ha_notify_table_changed()
- {
- notify_table_changed();
- }
-
-
protected:
/**
Allows the storage engine to update internal structures with concurrent
@@ -4461,14 +4448,6 @@ protected:
return false;
}
-
- /**
- Notify the storage engine that the table structure (.FRM) has been updated.
-
- @note No errors are allowed during notify_table_changed().
- */
- virtual void notify_table_changed() { }
-
public:
/* End of On-line/in-place ALTER TABLE interface. */
@@ -4492,7 +4471,6 @@ public:
TABLE_SHARE* get_table_share() { return table_share; }
protected:
/* Service methods for use by storage engines. */
- void **ha_data(THD *) const;
THD *ha_thd(void) const;
/**
@@ -4851,11 +4829,6 @@ public:
{
return false;
}
- virtual bool can_convert_geom(const Field_geom *field,
- const Column_definition &new_type) const
- {
- return false;
- }
protected:
Handler_share *get_ha_share_ptr();
@@ -4909,8 +4882,7 @@ static inline bool ha_check_storage_engine_flag(const handlerton *db_type, uint3
static inline bool ha_storage_engine_is_enabled(const handlerton *db_type)
{
- return (db_type && db_type->create) ?
- (db_type->state == SHOW_OPTION_YES) : FALSE;
+ return db_type && db_type->create;
}
#define view_pseudo_hton ((handlerton *)1)
@@ -4926,7 +4898,7 @@ TYPELIB *ha_known_exts(void);
int ha_panic(enum ha_panic_function flag);
void ha_close_connection(THD* thd);
void ha_kill_query(THD* thd, enum thd_kill_levels level);
-bool ha_flush_logs(handlerton *db_type);
+bool ha_flush_logs();
void ha_drop_database(char* path);
void ha_checkpoint_state(bool disable);
void ha_commit_checkpoint_request(void *cookie, void (*pre_hook)(void *));
diff --git a/sql/item.cc b/sql/item.cc
index 900a973071b..bf59f4d8b85 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -329,6 +329,7 @@ my_decimal *Item::val_decimal_from_real(my_decimal *decimal_value)
my_decimal *Item::val_decimal_from_int(my_decimal *decimal_value)
{
+ DBUG_ASSERT(is_fixed());
longlong nr= val_int();
if (null_value)
return 0;
@@ -448,7 +449,7 @@ const TABLE_SHARE *Item::field_table_or_null()
tables.
*/
Item::Item(THD *thd, Item *item):
- Type_all_attributes(item),
+ Type_all_attributes(*item),
join_tab_idx(item->join_tab_idx),
is_expensive_cache(-1),
rsize(0),
@@ -623,33 +624,34 @@ Item* Item::set_expr_cache(THD *thd)
Item_ident::Item_ident(THD *thd, Name_resolution_context *context_arg,
- const char *db_name_arg,const char *table_name_arg,
- const LEX_CSTRING *field_name_arg)
+ const LEX_CSTRING &db_name_arg,
+ const LEX_CSTRING &table_name_arg,
+ const LEX_CSTRING &field_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),
+ orig_field_name(field_name_arg), context(context_arg),
db_name(db_name_arg), table_name(table_name_arg),
- field_name(*field_name_arg),
+ field_name(field_name_arg),
alias_name_used(FALSE), cached_field_index(NO_CACHED_FIELD_INDEX),
cached_table(0), depended_from(0), can_be_depended(TRUE)
{
- name= *field_name_arg;
+ name= field_name_arg;
}
Item_ident::Item_ident(THD *thd, TABLE_LIST *view_arg,
- const LEX_CSTRING *field_name_arg)
- :Item_result_field(thd), orig_db_name(NullS),
- orig_table_name(view_arg->table_name.str),
- orig_field_name(*field_name_arg),
+ const LEX_CSTRING &field_name_arg)
+ :Item_result_field(thd), orig_db_name(null_clex_str),
+ orig_table_name(view_arg->table_name),
+ orig_field_name(field_name_arg),
/* TODO: suspicious use of first_select_lex */
context(&view_arg->view->first_select_lex()->context),
- db_name(NullS), table_name(view_arg->alias.str),
- field_name(*field_name_arg),
+ db_name(null_clex_str), table_name(view_arg->alias),
+ field_name(field_name_arg),
alias_name_used(FALSE), cached_field_index(NO_CACHED_FIELD_INDEX),
cached_table(NULL), depended_from(NULL), can_be_depended(TRUE)
{
- name= *field_name_arg;
+ name= field_name_arg;
}
@@ -780,10 +782,10 @@ bool Item_field::rename_fields_processor(void *arg)
while ((def=def_it++))
{
if (def->change.str &&
- (!db_name || !db_name[0] ||
- !my_strcasecmp(table_alias_charset, db_name, rename->db_name.str)) &&
- (!table_name || !table_name[0] ||
- !my_strcasecmp(table_alias_charset, table_name, rename->table_name.str)) &&
+ (!db_name.str || !db_name.str[0] ||
+ !my_strcasecmp(table_alias_charset, db_name.str, rename->db_name.str)) &&
+ (!table_name.str || !table_name.str[0] ||
+ !my_strcasecmp(table_alias_charset, table_name.str, rename->table_name.str)) &&
!my_strcasecmp(system_charset_info, field_name.str, def->change.str))
{
field_name= def->field_name;
@@ -977,7 +979,7 @@ bool Item::check_type_general_purpose_string(const char *opname) const
bool Item::check_type_traditional_scalar(const char *opname) const
{
const Type_handler *handler= type_handler();
- if (handler->is_traditional_type() && handler->is_scalar_type())
+ if (handler->is_traditional_scalar_type())
return false;
my_error(ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION, MYF(0),
handler->name().ptr(), opname);
@@ -1291,7 +1293,7 @@ Item *Item::const_charset_converter(THD *thd, CHARSET_INFO *tocs,
uint conv_errors;
Item_string *conv= (func_name ?
new (mem_root)
- Item_static_string_func(thd, func_name,
+ Item_static_string_func(thd, Lex_cstring_strlen(func_name),
s, tocs, &conv_errors,
collation.derivation,
collation.repertoire) :
@@ -1410,7 +1412,7 @@ int Item::save_in_field_no_warnings(Field *field, bool no_conversions)
THD *thd= table->in_use;
enum_check_fields tmp= thd->count_cuted_fields;
my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->write_set);
- sql_mode_t sql_mode= thd->variables.sql_mode;
+ Sql_mode_save sms(thd);
thd->variables.sql_mode&= ~(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE);
thd->variables.sql_mode|= MODE_INVALID_DATES;
thd->count_cuted_fields= CHECK_FIELD_IGNORE;
@@ -1419,7 +1421,6 @@ int Item::save_in_field_no_warnings(Field *field, bool no_conversions)
thd->count_cuted_fields= tmp;
dbug_tmp_restore_column_map(table->write_set, old_map);
- thd->variables.sql_mode= sql_mode;
return res;
}
@@ -2014,7 +2015,7 @@ Item_name_const::Item_name_const(THD *thd, Item *name_arg, Item *val):
Item::maybe_null= TRUE;
if (name_item->basic_const_item() &&
(name_str= name_item->val_str(&name_buffer))) // Can't have a NULL name
- set_name(thd, name_str->ptr(), name_str->length(), name_str->charset());
+ set_name(thd, name_str->lex_cstring(), name_str->charset());
}
@@ -2059,7 +2060,7 @@ bool Item_name_const::fix_fields(THD *thd, Item **ref)
return TRUE;
}
if (value_item->collation.derivation == DERIVATION_NUMERIC)
- collation.set_numeric();
+ collation= DTCollation_numeric();
else
collation.set(value_item->collation.collation, DERIVATION_IMPLICIT);
max_length= value_item->max_length;
@@ -2089,8 +2090,8 @@ class Item_aggregate_ref : public Item_ref
{
public:
Item_aggregate_ref(THD *thd, Name_resolution_context *context_arg,
- Item **item, const char *table_name_arg,
- const LEX_CSTRING *field_name_arg):
+ Item **item, const LEX_CSTRING &table_name_arg,
+ const LEX_CSTRING &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)
@@ -2212,8 +2213,8 @@ void Item::split_sum_func2(THD *thd, Ref_ptr_array ref_pointer_array,
if (!(item_ref= (new (thd->mem_root)
Item_direct_ref(thd,
&thd->lex->current_select->context,
- &ref_pointer_array[el], 0,
- &name))))
+ &ref_pointer_array[el],
+ null_clex_str, name))))
return; // fatal_error is set
}
else
@@ -2221,8 +2222,8 @@ void Item::split_sum_func2(THD *thd, Ref_ptr_array ref_pointer_array,
if (!(item_ref= (new (thd->mem_root)
Item_aggregate_ref(thd,
&thd->lex->current_select->context,
- &ref_pointer_array[el], 0,
- &name))))
+ &ref_pointer_array[el],
+ null_clex_str, name))))
return; // fatal_error is set
}
if (type() == SUM_FUNC_ITEM)
@@ -2888,7 +2889,8 @@ Item* Item_ref::build_clone(THD *thd)
/**********************************************/
Item_field::Item_field(THD *thd, Field *f)
- :Item_ident(thd, 0, NullS, *f->table_name, &f->field_name),
+ :Item_ident(thd, 0, null_clex_str,
+ Lex_cstring_strlen(*f->table_name), f->field_name),
item_equal(0),
have_privileges(0), any_privileges(0)
{
@@ -2912,8 +2914,8 @@ Item_field::Item_field(THD *thd, Field *f)
Item_field::Item_field(THD *thd, Name_resolution_context *context_arg,
Field *f)
- :Item_ident(thd, context_arg, f->table->s->db.str, *f->table_name,
- &f->field_name),
+ :Item_ident(thd, context_arg, f->table->s->db,
+ Lex_cstring_strlen(*f->table_name), f->field_name),
item_equal(0),
have_privileges(0), any_privileges(0)
{
@@ -2935,13 +2937,12 @@ Item_field::Item_field(THD *thd, Name_resolution_context *context_arg,
procedures).
*/
{
- if (db_name)
- orig_db_name= thd->strdup(db_name);
- if (table_name)
- orig_table_name= thd->strdup(table_name);
+ if (db_name.str)
+ orig_db_name= thd->strmake_lex_cstring(db_name);
+ if (table_name.str)
+ orig_table_name= thd->strmake_lex_cstring(table_name);
if (field_name.str)
- thd->make_lex_string(&orig_field_name, field_name.str,
- field_name.length);
+ orig_field_name= thd->strmake_lex_cstring(field_name);
/*
We don't restore 'name' in cleanup because it's not changed
during execution. Still we need it to point to persistent
@@ -2955,8 +2956,9 @@ Item_field::Item_field(THD *thd, 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 LEX_CSTRING *field_name_arg)
+ const LEX_CSTRING &db_arg,
+ const LEX_CSTRING &table_name_arg,
+ const LEX_CSTRING &field_name_arg)
:Item_ident(thd, context_arg, db_arg, table_name_arg, field_name_arg),
field(0), item_equal(0),
have_privileges(0), any_privileges(0)
@@ -2989,9 +2991,9 @@ void Item_field::set_field(Field *field_par)
field=result_field=field_par; // for easy coding with fields
maybe_null=field->maybe_null();
Type_std_attributes::set(field_par->type_std_attributes());
- table_name= *field_par->table_name;
+ table_name= Lex_cstring_strlen(*field_par->table_name);
field_name= field_par->field_name;
- db_name= field_par->table->s->db.str;
+ db_name= field_par->table->s->db;
alias_name_used= field_par->table->alias_name_used;
fixed= 1;
@@ -3074,24 +3076,24 @@ bool Item_field::switch_to_nullable_fields_processor(void *arg)
const char *Item_ident::full_name() const
{
char *tmp;
- if (!table_name || !field_name.str)
+ if (!table_name.str || !field_name.str)
return field_name.str ? field_name.str : name.str ? name.str : "tmp_field";
- if (db_name && db_name[0])
+ if (db_name.str && db_name.str[0])
{
THD *thd= current_thd;
- tmp=(char*) thd->alloc((uint) strlen(db_name)+(uint) strlen(table_name)+
+ tmp=(char*) thd->alloc((uint) db_name.length+ (uint) table_name.length +
(uint) field_name.length+3);
- strxmov(tmp,db_name,".",table_name,".",field_name.str,NullS);
+ strxmov(tmp,db_name.str,".",table_name.str,".",field_name.str,NullS);
}
else
{
- if (table_name[0])
+ if (table_name.str[0])
{
THD *thd= current_thd;
- tmp= (char*) thd->alloc((uint) strlen(table_name) +
+ tmp= (char*) thd->alloc((uint) table_name.length +
field_name.length + 2);
- strxmov(tmp, table_name, ".", field_name.str, NullS);
+ strxmov(tmp, table_name.str, ".", field_name.str, NullS);
}
else
return field_name.str;
@@ -3103,12 +3105,14 @@ void Item_ident::print(String *str, enum_query_type query_type)
{
THD *thd= current_thd;
char d_name_buff[MAX_ALIAS_NAME], t_name_buff[MAX_ALIAS_NAME];
- const char *d_name= db_name, *t_name= table_name;
- bool use_table_name= table_name && table_name[0];
- bool use_db_name= use_table_name && db_name && db_name[0] && !alias_name_used;
+ LEX_CSTRING d_name= db_name;
+ LEX_CSTRING t_name= table_name;
+ bool use_table_name= table_name.str && table_name.str[0];
+ bool use_db_name= use_table_name && db_name.str && db_name.str[0] &&
+ !alias_name_used;
if (use_db_name && (query_type & QT_ITEM_IDENT_SKIP_DB_NAMES))
- use_db_name= !thd->db.str || strcmp(thd->db.str, db_name);
+ use_db_name= !thd->db.str || strcmp(thd->db.str, db_name.str);
if (use_db_name)
use_db_name= !(cached_table && cached_table->belong_to_view &&
@@ -3142,27 +3146,27 @@ void Item_ident::print(String *str, enum_query_type query_type)
{
if (use_table_name)
{
- strmov(t_name_buff, table_name);
+ strmov(t_name_buff, table_name.str);
my_casedn_str(files_charset_info, t_name_buff);
- t_name= t_name_buff;
+ t_name= Lex_cstring_strlen(t_name_buff);
}
if (use_db_name)
{
- strmov(d_name_buff, db_name);
+ strmov(d_name_buff, db_name.str);
my_casedn_str(files_charset_info, d_name_buff);
- d_name= d_name_buff;
+ d_name= Lex_cstring_strlen(d_name_buff);
}
}
if (use_db_name)
{
- append_identifier(thd, str, d_name, (uint)strlen(d_name));
+ append_identifier(thd, str, d_name.str, (uint) d_name.length);
str->append('.');
DBUG_ASSERT(use_table_name);
}
if (use_table_name)
{
- append_identifier(thd, str, t_name, (uint) strlen(t_name));
+ append_identifier(thd, str, t_name.str, (uint) t_name.length);
str->append('.');
}
append_identifier(thd, str, &field_name);
@@ -3310,12 +3314,12 @@ bool Item_field::eq(const Item *item, bool binary_cmp) const
*/
return (!lex_string_cmp(system_charset_info, &item_field->name,
&field_name) &&
- (!item_field->table_name || !table_name ||
- (!my_strcasecmp(table_alias_charset, item_field->table_name,
- table_name) &&
- (!item_field->db_name || !db_name ||
- (item_field->db_name && !strcmp(item_field->db_name,
- db_name))))));
+ (!item_field->table_name.str || !table_name.str ||
+ (!my_strcasecmp(table_alias_charset, item_field->table_name.str,
+ table_name.str) &&
+ (!item_field->db_name.str || !db_name.str ||
+ (item_field->db_name.str && !strcmp(item_field->db_name.str,
+ db_name.str))))));
}
@@ -3332,6 +3336,16 @@ table_map Item_field::all_used_tables() const
}
+bool Item_field::find_not_null_fields(table_map allowed)
+{
+ if (field->table->const_table)
+ return false;
+ if (!get_depended_from() && field->real_maybe_null())
+ bitmap_set_bit(&field->table->tmp_set, field->field_index);
+ return false;
+}
+
+
/*
@Note thd->fatal_error can be set in case of OOM
*/
@@ -3888,7 +3902,6 @@ void Item_param::sync_clones()
c->null_value= null_value;
c->Type_std_attributes::operator=(*this);
c->Type_handler_hybrid_field_type::operator=(*this);
- c->Type_geometry_attributes::operator=(*this);
c->state= state;
c->m_empty_string_is_null= m_empty_string_is_null;
@@ -3934,7 +3947,7 @@ void Item_param::set_int(longlong i, uint32 max_length_arg)
DBUG_ASSERT(value.type_handler()->cmp_type() == INT_RESULT);
value.integer= (longlong) i;
state= SHORT_DATA_VALUE;
- collation.set_numeric();
+ collation= DTCollation_numeric();
max_length= max_length_arg;
decimals= 0;
maybe_null= 0;
@@ -3948,7 +3961,7 @@ void Item_param::set_double(double d)
DBUG_ASSERT(value.type_handler()->cmp_type() == REAL_RESULT);
value.real= d;
state= SHORT_DATA_VALUE;
- collation.set_numeric();
+ collation= DTCollation_numeric();
max_length= DBL_DIG + 8;
decimals= NOT_FIXED_DEC;
maybe_null= 0;
@@ -3979,7 +3992,7 @@ void Item_param::set_decimal(const char *str, ulong length)
str2my_decimal(E_DEC_FATAL_ERROR, str, &value.m_decimal, &end);
state= SHORT_DATA_VALUE;
decimals= value.m_decimal.frac;
- collation.set_numeric();
+ collation= DTCollation_numeric();
max_length=
my_decimal_precision_to_length_no_truncation(value.m_decimal.precision(),
decimals, unsigned_flag);
@@ -3996,7 +4009,7 @@ void Item_param::set_decimal(const my_decimal *dv, bool unsigned_arg)
my_decimal2decimal(dv, &value.m_decimal);
decimals= (uint8) value.m_decimal.frac;
- collation.set_numeric();
+ collation= DTCollation_numeric();
unsigned_flag= unsigned_arg;
max_length= my_decimal_precision_to_length(value.m_decimal.intg + decimals,
decimals, unsigned_flag);
@@ -4008,7 +4021,7 @@ void Item_param::set_decimal(const my_decimal *dv, bool unsigned_arg)
void Item_param::fix_temporal(uint32 max_length_arg, uint decimals_arg)
{
state= SHORT_DATA_VALUE;
- collation.set_numeric();
+ collation= DTCollation_numeric();
max_length= max_length_arg;
decimals= decimals_arg;
maybe_null= 0;
@@ -4115,12 +4128,12 @@ bool Item_param::set_longdata(const char *str, ulong length)
(here), and first have to concatenate all pieces together,
write query to the binary log and only then perform conversion.
*/
- if (value.m_string.length() + length > max_long_data_size)
+ if (value.m_string.length() + length > current_thd->variables.max_allowed_packet)
{
my_message(ER_UNKNOWN_ERROR,
"Parameter of prepared statement which is set through "
"mysql_send_long_data() is longer than "
- "'max_long_data_size' bytes",
+ "'max_allowed_packet' bytes",
MYF(0));
DBUG_RETURN(true);
}
@@ -4574,9 +4587,9 @@ Item *Item_param::value_clone_item(THD *thd)
case DECIMAL_RESULT:
return 0; // Should create Item_decimal. See MDEV-11361.
case STRING_RESULT:
- return new (mem_root) Item_string(thd, name.str,
- value.m_string.c_ptr_quick(),
- value.m_string.length(),
+ return new (mem_root) Item_string(thd, name,
+ Lex_cstring(value.m_string.c_ptr_quick(),
+ value.m_string.length()),
value.m_string.charset(),
collation.derivation,
collation.repertoire);
@@ -4957,10 +4970,10 @@ static bool mark_as_dependent(THD *thd, SELECT_LEX *last, SELECT_LEX *current,
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 : "");
+ const char *db_name= (resolved_item->db_name.str ?
+ resolved_item->db_name.str : "");
+ const char *table_name= (resolved_item->table_name.str ?
+ resolved_item->table_name.str : "");
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
ER_WARN_FIELD_RESOLVED,
ER_THD(thd,ER_WARN_FIELD_RESOLVED),
@@ -5054,9 +5067,9 @@ void mark_select_range_as_dependent(THD *thd,
static Item** find_field_in_group_list(Item *find_item, ORDER *group_list)
{
- const char *db_name;
- const char *table_name;
- LEX_CSTRING *field_name;
+ LEX_CSTRING db_name;
+ LEX_CSTRING table_name;
+ LEX_CSTRING field_name;
ORDER *found_group= NULL;
int found_match_degree= 0;
char name_buff[SAFE_NAME_LEN+1];
@@ -5066,30 +5079,30 @@ static Item** find_field_in_group_list(Item *find_item, ORDER *group_list)
{
db_name= ((Item_ident*) find_item)->db_name;
table_name= ((Item_ident*) find_item)->table_name;
- field_name= &((Item_ident*) find_item)->field_name;
+ field_name= ((Item_ident*) find_item)->field_name;
}
else
return NULL;
- if (db_name && lower_case_table_names)
+ if (db_name.str && lower_case_table_names)
{
/* Convert database to lower case for comparison */
- strmake_buf(name_buff, db_name);
+ strmake_buf(name_buff, db_name.str);
my_casedn_str(files_charset_info, name_buff);
- db_name= name_buff;
+ db_name= Lex_cstring_strlen(name_buff);
}
- DBUG_ASSERT(field_name->str != 0);
+ DBUG_ASSERT(field_name.str != 0);
for (ORDER *cur_group= group_list ; cur_group ; cur_group= cur_group->next)
{
int cur_match_degree= 0;
/* SELECT list element with explicit alias */
- if ((*(cur_group->item))->name.str && !table_name &&
+ if ((*(cur_group->item))->name.str && !table_name.str &&
!(*(cur_group->item))->is_autogenerated_name &&
!lex_string_cmp(system_charset_info,
- &(*(cur_group->item))->name, field_name))
+ &(*(cur_group->item))->name, &field_name))
{
++cur_match_degree;
}
@@ -5098,30 +5111,30 @@ static Item** find_field_in_group_list(Item *find_item, ORDER *group_list)
(*(cur_group->item))->type() == Item::REF_ITEM )
{
Item_ident *cur_field= (Item_ident*) *cur_group->item;
- const char *l_db_name= cur_field->db_name;
- const char *l_table_name= cur_field->table_name;
+ const char *l_db_name= cur_field->db_name.str;
+ const char *l_table_name= cur_field->table_name.str;
LEX_CSTRING *l_field_name= &cur_field->field_name;
DBUG_ASSERT(l_field_name->str != 0);
if (!lex_string_cmp(system_charset_info,
- l_field_name, field_name))
+ l_field_name, &field_name))
++cur_match_degree;
else
continue;
- if (l_table_name && table_name)
+ if (l_table_name && table_name.str)
{
/* If field_name is qualified by a table name. */
- if (my_strcasecmp(table_alias_charset, l_table_name, table_name))
+ if (my_strcasecmp(table_alias_charset, l_table_name, table_name.str))
/* Same field names, different tables. */
return NULL;
++cur_match_degree;
- if (l_db_name && db_name)
+ if (l_db_name && db_name.str)
{
/* If field_name is also qualified by a database name. */
- if (strcmp(l_db_name, db_name))
+ if (strcmp(l_db_name, db_name.str))
/* Same field names, different databases. */
return NULL;
++cur_match_degree;
@@ -5590,14 +5603,14 @@ Item_field::fix_outer_field(THD *thd, Field **from_field, Item **reference)
rf= (place == IN_HAVING ?
new (thd->mem_root)
Item_ref(thd, context, ref, table_name,
- &field_name, alias_name_used) :
+ field_name, alias_name_used) :
(!select->group_list.elements ?
new (thd->mem_root)
Item_direct_ref(thd, context, ref, table_name,
- &field_name, alias_name_used) :
+ field_name, alias_name_used) :
new (thd->mem_root)
Item_outer_ref(thd, context, ref, table_name,
- &field_name, alias_name_used)));
+ field_name, alias_name_used)));
*ref= save;
if (!rf)
return -1;
@@ -5642,9 +5655,9 @@ Item_field::fix_outer_field(THD *thd, Field **from_field, Item **reference)
{
Item_ref *rf;
rf= new (thd->mem_root) Item_ref(thd, context,
- (*from_field)->table->s->db.str,
- (*from_field)->table->alias.c_ptr(),
- &field_name);
+ (*from_field)->table->s->db,
+ Lex_cstring_strlen((*from_field)->table->alias.c_ptr()),
+ field_name);
if (!rf)
return -1;
thd->change_item_tree(reference, rf);
@@ -5792,7 +5805,7 @@ bool Item_field::fix_fields(THD *thd, Item **reference)
Item_field created by the parser with the new Item_ref.
*/
Item_ref *rf= new (thd->mem_root)
- Item_ref(thd, context, db_name, table_name, &field_name);
+ Item_ref(thd, context, db_name, table_name, field_name);
if (!rf)
return 1;
bool err= rf->fix_fields(thd, (Item **) &rf) || rf->check_cols(1);
@@ -5975,7 +5988,7 @@ bool Item_field::post_fix_fields_part_expr_processor(void *int_arg)
/*
Update table_name to be real table name, not the alias. Because alias is
reallocated for every statement, and this item has a long life time */
- table_name= field->table->s->table_name.str;
+ table_name= field->table->s->table_name;
return FALSE;
}
@@ -6172,10 +6185,10 @@ Item *Item_field::replace_equal_field(THD *thd, uchar *arg)
void Item::init_make_send_field(Send_field *tmp_field,
const Type_handler *h)
{
- tmp_field->db_name= "";
- tmp_field->org_table_name= "";
+ tmp_field->db_name= empty_clex_str;
+ tmp_field->org_table_name= empty_clex_str;
tmp_field->org_col_name= empty_clex_str;
- tmp_field->table_name= "";
+ tmp_field->table_name= empty_clex_str;
tmp_field->col_name= name;
tmp_field->flags= (maybe_null ? 0 : NOT_NULL_FLAG) |
(my_binary_compare(charset_for_protocol()) ?
@@ -6334,15 +6347,15 @@ bool Item::eq_by_collation(Item *item, bool binary_cmp, CHARSET_INFO *cs)
void Item_field::make_send_field(THD *thd, Send_field *tmp_field)
{
field->make_send_field(tmp_field);
- DBUG_ASSERT(tmp_field->table_name != 0);
+ DBUG_ASSERT(tmp_field->table_name.str != 0);
if (name.str)
{
DBUG_ASSERT(name.length == strlen(name.str));
tmp_field->col_name= name; // Use user supplied name
}
- if (table_name)
+ if (table_name.str)
tmp_field->table_name= table_name;
- if (db_name)
+ if (db_name.str)
tmp_field->db_name= db_name;
}
@@ -6568,8 +6581,7 @@ 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, str_value.ptr(),
- str_value.length(), collation.collation);
+ Item_string(thd, name, str_value.lex_cstring(), collation.collation);
}
@@ -7178,7 +7190,7 @@ Item *Item_field::update_value_transformer(THD *thd, uchar *select_arg)
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);
+ table_name, field_name);
return ref;
}
return this;
@@ -7404,8 +7416,7 @@ Item *get_field_item_for_having(THD *thd, Item *item, st_select_lex *sel)
if (field_item)
{
Item_ref *ref= new (thd->mem_root) Item_ref(thd, &sel->context,
- NullS, NullS,
- &field_item->field_name);
+ field_item->field_name);
return ref;
}
DBUG_ASSERT(0);
@@ -7567,10 +7578,10 @@ void Item_temptable_field::print(String *str, enum_query_type query_type)
Item_ref::Item_ref(THD *thd, Name_resolution_context *context_arg,
- Item **item, const char *table_name_arg,
- const LEX_CSTRING *field_name_arg,
+ Item **item, const LEX_CSTRING &table_name_arg,
+ const LEX_CSTRING &field_name_arg,
bool alias_name_used_arg):
- Item_ident(thd, context_arg, NullS, table_name_arg, field_name_arg),
+ Item_ident(thd, context_arg, null_clex_str, table_name_arg, field_name_arg),
ref(item), reference_trough_name(0)
{
alias_name_used= alias_name_used_arg;
@@ -7617,7 +7628,7 @@ public:
};
Item_ref::Item_ref(THD *thd, TABLE_LIST *view_arg, Item **item,
- const LEX_CSTRING *field_name_arg,
+ const LEX_CSTRING &field_name_arg,
bool alias_name_used_arg):
Item_ident(thd, view_arg, field_name_arg),
ref(item), reference_trough_name(0)
@@ -8051,7 +8062,7 @@ void Item_ref::print(String *str, enum_query_type query_type)
if ((*ref)->type() != Item::CACHE_ITEM &&
(*ref)->type() != Item::WINDOW_FUNC_ITEM &&
ref_type() != VIEW_REF &&
- !table_name && name.str && alias_name_used)
+ !table_name.str && name.str && alias_name_used)
{
THD *thd= current_thd;
append_identifier(thd, str, &(*ref)->real_item()->name);
@@ -8285,13 +8296,13 @@ void Item_ref::make_send_field(THD *thd, Send_field *field)
/* Non-zero in case of a view */
if (name.str)
field->col_name= name;
- if (table_name)
+ if (table_name.str)
field->table_name= table_name;
- if (db_name)
+ if (db_name.str)
field->db_name= db_name;
if (orig_field_name.str)
field->org_col_name= orig_field_name;
- if (orig_table_name)
+ if (orig_table_name.str)
field->org_table_name= orig_table_name;
}
diff --git a/sql/item.h b/sql/item.h
index 2ac0964b682..880d4ec0d27 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -782,10 +782,11 @@ protected:
/**
Create a field based on the exact data type handler.
*/
- Field *create_table_field_from_handler(TABLE *table)
+ Field *create_table_field_from_handler(MEM_ROOT *root, TABLE *table)
{
const Type_handler *h= type_handler();
- return h->make_and_init_table_field(&name, Record_addr(maybe_null),
+ return h->make_and_init_table_field(root, &name,
+ Record_addr(maybe_null),
*this, table);
}
/**
@@ -798,11 +799,12 @@ protected:
@retval NULL error
@retval !NULL on success
*/
- Field *tmp_table_field_from_field_type(TABLE *table)
+ Field *tmp_table_field_from_field_type(MEM_ROOT *root, TABLE *table)
{
DBUG_ASSERT(is_fixed());
const Type_handler *h= type_handler()->type_handler_for_tmp_table(this);
- return h->make_and_init_table_field(&name, Record_addr(maybe_null),
+ return h->make_and_init_table_field(root, &name,
+ Record_addr(maybe_null),
*this, table);
}
/**
@@ -814,17 +816,20 @@ protected:
- does not need to set Field::is_created_from_null_item for the result
See create_tmp_field_ex() for details on parameters and return values.
*/
- Field *create_tmp_field_ex_simple(TABLE *table,
+ Field *create_tmp_field_ex_simple(MEM_ROOT *root,
+ TABLE *table,
Tmp_field_src *src,
const Tmp_field_param *param)
{
DBUG_ASSERT(!param->make_copy_field());
DBUG_ASSERT(!is_result_field());
DBUG_ASSERT(type() != NULL_ITEM);
- return tmp_table_field_from_field_type(table);
+ return tmp_table_field_from_field_type(root, table);
}
- Field *create_tmp_field_int(TABLE *table, uint convert_int_length);
- Field *tmp_table_field_from_field_type_maybe_null(TABLE *table,
+ Field *create_tmp_field_int(MEM_ROOT *root, TABLE *table,
+ uint convert_int_length);
+ Field *tmp_table_field_from_field_type_maybe_null(MEM_ROOT *root,
+ TABLE *table,
Tmp_field_src *src,
const Tmp_field_param *param,
bool is_explicit_null);
@@ -945,6 +950,11 @@ public:
#endif
} /*lint -e1509 */
void set_name(THD *thd, const char *str, size_t length, CHARSET_INFO *cs);
+ void set_name(THD *thd, const LEX_CSTRING &str,
+ CHARSET_INFO *cs= system_charset_info)
+ {
+ set_name(thd, str.str, str.length, cs);
+ }
void set_name_no_truncate(THD *thd, const char *str, uint length,
CHARSET_INFO *cs);
void init_make_send_field(Send_field *tmp_field, const Type_handler *h);
@@ -1108,9 +1118,9 @@ public:
{
return type_handler()->max_display_length(this);
}
- TYPELIB *get_typelib() const { return NULL; }
+ const TYPELIB *get_typelib() const { return NULL; }
void set_maybe_null(bool maybe_null_arg) { maybe_null= maybe_null_arg; }
- void set_typelib(TYPELIB *typelib)
+ void set_typelib(const TYPELIB *typelib)
{
// Non-field Items (e.g. hybrid functions) never have ENUM/SET types yet.
DBUG_ASSERT(0);
@@ -1457,7 +1467,6 @@ public:
{
return type_handler()->Item_val_bool(this);
}
- virtual String *val_raw(String*) { return 0; }
bool eval_const_cond()
{
@@ -1525,8 +1534,7 @@ public:
int save_str_value_in_field(Field *field, String *result);
virtual Field *get_tmp_table_field() { return 0; }
- virtual Field *create_field_for_create_select(TABLE *table);
- virtual Field *create_field_for_schema(THD *thd, TABLE *table);
+ virtual Field *create_field_for_create_select(MEM_ROOT *root, TABLE *table);
virtual const char *full_name() const { return name.str ? name.str : "???"; }
const char *field_name_or_null()
{ return real_item()->type() == Item::FIELD_ITEM ? name.str : NULL; }
@@ -2028,6 +2036,44 @@ public:
virtual bool check_index_dependence(void *arg) { return 0; }
/*============== End of Item processor list ======================*/
+ /*
+ Given a condition P from the WHERE clause or from an ON expression of
+ the processed SELECT S and a set of join tables from S marked in the
+ parameter 'allowed'={T} a call of P->find_not_null_fields({T}) has to
+ find the set fields {F} of the tables from 'allowed' such that:
+ - each field from {F} is declared as nullable
+ - each record of table t from {T} that contains NULL as the value for at
+ at least one field from {F} can be ignored when building the result set
+ for S
+ It is assumed here that the condition P is conjunctive and all its column
+ references belong to T.
+
+ Examples:
+ CREATE TABLE t1 (a int, b int);
+ CREATE TABLE t2 (a int, b int);
+
+ SELECT * FROM t1,t2 WHERE t1.a=t2.a and t1.b > 5;
+ A call of find_not_null_fields() for the whole WHERE condition and {t1,t2}
+ should find {t1.a,t1.b,t2.a}
+
+ SELECT * FROM t1 LEFT JOIN ON (t1.a=t2.a and t2.a > t2.b);
+ A call of find_not_null_fields() for the ON expression and {t2}
+ should find {t2.a,t2.b}
+
+ The function returns TRUE if it succeeds to prove that all records of
+ a table from {T} can be ignored. Otherwise it always returns FALSE.
+
+ Example:
+ SELECT * FROM t1,t2 WHERE t1.a=t2.a AND t2.a IS NULL;
+ A call of find_not_null_fields() for the WHERE condition and {t1,t2}
+ will return TRUE.
+
+ It is assumed that the implementation of this virtual function saves
+ the info on the found set of fields in the structures associates with
+ tables from {T}.
+ */
+ virtual bool find_not_null_fields(table_map allowed) { return false; }
+
virtual Item *get_copy(THD *thd)=0;
bool cache_const_expr_analyzer(uchar **arg);
@@ -2092,7 +2138,8 @@ public:
const Type_handler *type_handler_long_or_longlong() const
{
- return Type_handler::type_handler_long_or_longlong(max_char_length());
+ return Type_handler::type_handler_long_or_longlong(max_char_length(),
+ unsigned_flag);
}
/**
@@ -2103,7 +2150,8 @@ public:
@retval NULL (on error)
@retval a pointer to a newly create Field (on success)
*/
- virtual Field *create_tmp_field_ex(TABLE *table,
+ virtual Field *create_tmp_field_ex(MEM_ROOT *root,
+ TABLE *table,
Tmp_field_src *src,
const Tmp_field_param *param)= 0;
virtual Item_field *field_for_view_update() { return 0; }
@@ -2229,14 +2277,6 @@ public:
is_expensive_cache= walk(&Item::is_expensive_processor, 0, NULL);
return MY_TEST(is_expensive_cache);
}
- virtual Field::geometry_type get_geometry_type() const
- { return Field::GEOM_GEOMETRY; };
- uint uint_geometry_type() const
- { return get_geometry_type(); }
- void set_geometry_type(uint type)
- {
- DBUG_ASSERT(0);
- }
String *check_well_formed_result(String *str, bool send_error= 0);
bool eq_by_collation(Item *item, bool binary_cmp, CHARSET_INFO *cs);
bool too_big_for_varchar() const
@@ -2447,56 +2487,6 @@ public:
};
-class Type_geometry_attributes
-{
- uint m_geometry_type;
- static const uint m_geometry_type_unknown= Field::GEOM_GEOMETRYCOLLECTION + 1;
- void copy(const Type_handler *handler, const Type_all_attributes *gattr)
- {
- // Ignore implicit NULLs
- m_geometry_type= handler == &type_handler_geometry ?
- gattr->uint_geometry_type() :
- m_geometry_type_unknown;
- }
-public:
- Type_geometry_attributes()
- :m_geometry_type(m_geometry_type_unknown)
- { }
- Type_geometry_attributes(const Type_handler *handler,
- const Type_all_attributes *gattr)
- :m_geometry_type(m_geometry_type_unknown)
- {
- copy(handler, gattr);
- }
- void join(const Item *item)
- {
- // Ignore implicit NULLs
- if (m_geometry_type == m_geometry_type_unknown)
- copy(item->type_handler(), item);
- else if (item->type_handler() == &type_handler_geometry)
- {
- m_geometry_type=
- Field_geom::geometry_type_merge((Field_geom::geometry_type)
- m_geometry_type,
- (Field_geom::geometry_type)
- item->uint_geometry_type());
- }
- }
- Field::geometry_type get_geometry_type() const
- {
- return m_geometry_type == m_geometry_type_unknown ?
- Field::GEOM_GEOMETRY :
- (Field::geometry_type) m_geometry_type;
- }
- void set_geometry_type(uint type)
- {
- DBUG_ASSERT(type <= m_geometry_type_unknown);
- m_geometry_type= type;
- }
-};
-
-
-
/**
Compare two Items for List<Item>::add_unique()
*/
@@ -2736,7 +2726,8 @@ protected:
}
Item_basic_value(THD *thd): Item(thd) {}
public:
- Field *create_tmp_field_ex(TABLE *table, Tmp_field_src *src,
+ Field *create_tmp_field_ex(MEM_ROOT *root,
+ TABLE *table, Tmp_field_src *src,
const Tmp_field_param *param)
{
@@ -2748,7 +2739,8 @@ public:
DECLARE c CURSOR FOR SELECT 'test';
OPEN c;
*/
- return tmp_table_field_from_field_type_maybe_null(table, src, param,
+ return tmp_table_field_from_field_type_maybe_null(root,
+ table, src, param,
type() == Item::NULL_ITEM);
}
bool eq(const Item *item, bool binary_cmp) const;
@@ -2820,10 +2812,11 @@ public:
inline bool const_item() const;
- Field *create_tmp_field_ex(TABLE *table, Tmp_field_src *src,
+ Field *create_tmp_field_ex(MEM_ROOT *root,
+ TABLE *table, Tmp_field_src *src,
const Tmp_field_param *param)
{
- return create_tmp_field_ex_simple(table, src, param);
+ return create_tmp_field_ex_simple(root, table, src, param);
}
inline int save_in_field(Field *field, bool no_conversions);
inline bool send(Protocol *protocol, st_value *buffer);
@@ -2926,8 +2919,8 @@ public:
The inherited implementation would create a column
based on result_type(), which is less exact.
*/
- Field *create_field_for_create_select(TABLE *table)
- { return create_table_field_from_handler(table); }
+ Field *create_field_for_create_select(MEM_ROOT *root, TABLE *table)
+ { return create_table_field_from_handler(root, table); }
bool is_valid_limit_clause_variable_with_error() const
{
@@ -3116,7 +3109,8 @@ public:
return TRUE;
}
- Field *create_tmp_field_ex(TABLE *table, Tmp_field_src *src,
+ Field *create_tmp_field_ex(MEM_ROOT *root,
+ TABLE *table, Tmp_field_src *src,
const Tmp_field_param *param)
{
/*
@@ -3124,7 +3118,7 @@ public:
DECLARE c CURSOR FOR SELECT NAME_CONST('x','y') FROM t1;
OPEN c;
*/
- return tmp_table_field_from_field_type_maybe_null(table, src, param,
+ return tmp_table_field_from_field_type_maybe_null(root, table, src, param,
type() == Item::NULL_ITEM);
}
int save_in_field(Field *field, bool no_conversions)
@@ -3160,7 +3154,7 @@ public:
class Item_num: public Item_literal
{
public:
- Item_num(THD *thd): Item_literal(thd) { collation.set_numeric(); }
+ Item_num(THD *thd): Item_literal(thd) { collation= DTCollation_numeric(); }
Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs);
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)
{
@@ -3175,6 +3169,11 @@ class st_select_lex;
class Item_result_field :public Item_fixed_hybrid /* Item with result field */
{
+protected:
+ Field *create_tmp_field_ex_from_handler(MEM_ROOT *root, TABLE *table,
+ Tmp_field_src *src,
+ const Tmp_field_param *param,
+ const Type_handler *h);
public:
Field *result_field; /* Save result here */
Item_result_field(THD *thd): Item_fixed_hybrid(thd), result_field(0) {}
@@ -3184,8 +3183,13 @@ public:
{}
~Item_result_field() {} /* Required with gcc 2.95 */
Field *get_tmp_table_field() { return result_field; }
- Field *create_tmp_field_ex(TABLE *table, Tmp_field_src *src,
- const Tmp_field_param *param);
+ Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src,
+ const Tmp_field_param *param)
+ {
+ DBUG_ASSERT(fixed);
+ const Type_handler *h= type_handler()->type_handler_for_tmp_table(this);
+ return create_tmp_field_ex_from_handler(root, table, src, param, h);
+ }
void get_tmp_field_src(Tmp_field_src *src, const Tmp_field_param *param);
/*
This implementation of used_tables() used by Item_avg_field and
@@ -3212,14 +3216,14 @@ protected:
updated during fix_fields() to values from Field object and life-time
of those is shorter than life-time of Item_field.
*/
- const char *orig_db_name;
- const char *orig_table_name;
+ LEX_CSTRING orig_db_name;
+ LEX_CSTRING orig_table_name;
LEX_CSTRING orig_field_name;
public:
Name_resolution_context *context;
- const char *db_name;
- const char *table_name;
+ LEX_CSTRING db_name;
+ LEX_CSTRING table_name;
LEX_CSTRING field_name;
bool alias_name_used; /* true if item was resolved against alias */
/*
@@ -3249,10 +3253,10 @@ public:
*/
bool can_be_depended;
Item_ident(THD *thd, Name_resolution_context *context_arg,
- const char *db_name_arg, const char *table_name_arg,
- const LEX_CSTRING *field_name_arg);
+ const LEX_CSTRING &db_name_arg, const LEX_CSTRING &table_name_arg,
+ const LEX_CSTRING &field_name_arg);
Item_ident(THD *thd, Item_ident *item);
- Item_ident(THD *thd, TABLE_LIST *view_arg, const LEX_CSTRING *field_name_arg);
+ Item_ident(THD *thd, TABLE_LIST *view_arg, const LEX_CSTRING &field_name_arg);
const char *full_name() const;
void cleanup();
st_select_lex *get_depended_from() const;
@@ -3287,8 +3291,15 @@ public:
/* field need any privileges (for VIEW creation) */
bool any_privileges;
Item_field(THD *thd, Name_resolution_context *context_arg,
- const char *db_arg,const char *table_name_arg,
- const LEX_CSTRING *field_name_arg);
+ const LEX_CSTRING &db_arg, const LEX_CSTRING &table_name_arg,
+ const LEX_CSTRING &field_name_arg);
+ Item_field(THD *thd, Name_resolution_context *context_arg,
+ const LEX_CSTRING &field_name_arg)
+ :Item_field(thd, context_arg, null_clex_str, null_clex_str, field_name_arg)
+ { }
+ Item_field(THD *thd, Name_resolution_context *context_arg)
+ :Item_field(thd, context_arg, null_clex_str, null_clex_str, null_clex_str)
+ { }
/*
Constructor needed to process subselect with temporary tables (see Item)
*/
@@ -3365,12 +3376,13 @@ public:
return &type_handler_null;
return field->type_handler();
}
- Field *create_tmp_field_from_item_field(TABLE *new_table,
+ Field *create_tmp_field_from_item_field(MEM_ROOT *root, TABLE *new_table,
Item_ref *orig_item,
const Tmp_field_param *param);
- Field *create_tmp_field_ex(TABLE *table, Tmp_field_src *src,
+ Field *create_tmp_field_ex(MEM_ROOT *root,
+ TABLE *table, Tmp_field_src *src,
const Tmp_field_param *param);
- TYPELIB *get_typelib() const { return field->get_typelib(); }
+ const TYPELIB *get_typelib() const { return field->get_typelib(); }
enum_monotonicity_info get_monotonicity_info() const
{
return MONOTONIC_STRICT_INCREASING;
@@ -3422,6 +3434,7 @@ public:
bool is_result_field() { return false; }
void save_in_result_field(bool no_conversions);
Item *get_tmp_table_item(THD *thd);
+ bool find_not_null_fields(table_map allowed);
bool collect_item_field_processor(void * arg);
bool add_field_to_set_processor(void * arg);
bool find_item_in_field_list_processor(void *arg);
@@ -3487,11 +3500,6 @@ public:
DBUG_ASSERT(fixed);
return field->table->pos_in_table_list->outer_join;
}
- Field::geometry_type get_geometry_type() const
- {
- DBUG_ASSERT(field_type() == MYSQL_TYPE_GEOMETRY);
- return field->get_geometry_type();
- }
bool check_index_dependence(void *arg);
friend class Item_default_value;
friend class Item_insert_value;
@@ -3622,7 +3630,7 @@ public:
{
return result_field->type();
}
- Field *create_tmp_field_ex(TABLE *table, Tmp_field_src *src,
+ Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src,
const Tmp_field_param *param)
{
DBUG_ASSERT(0);
@@ -3669,8 +3677,7 @@ public:
class Item_param :public Item_basic_value,
private Settable_routine_parameter,
public Rewritable_query_parameter,
- private Type_handler_hybrid_field_type,
- public Type_geometry_attributes
+ private Type_handler_hybrid_field_type
{
/*
NO_VALUE is a special value meaning that the parameter has not been
@@ -3829,12 +3836,6 @@ public:
const Type_handler *type_handler() const
{ return Type_handler_hybrid_field_type::type_handler(); }
- Field::geometry_type get_geometry_type() const
- { return Type_geometry_attributes::get_geometry_type(); };
-
- void set_geometry_type(uint type)
- { Type_geometry_attributes::set_geometry_type(type); }
-
Item_param(THD *thd, const LEX_CSTRING *name_arg,
uint pos_in_query_arg, uint len_in_query_arg);
@@ -3977,7 +3978,7 @@ public:
bool set_limit_clause_param(longlong nr)
{
- value.set_handler(&type_handler_longlong);
+ value.set_handler(&type_handler_slonglong);
set_int(nr, MY_INT64_NUM_DECIMAL_DIGITS);
return !unsigned_flag && value.integer < 0;
}
@@ -4097,8 +4098,8 @@ public:
Item_int(THD *thd, const char *str_arg, size_t length=64);
const Type_handler *type_handler() const
{ return type_handler_long_or_longlong(); }
- Field *create_field_for_create_select(TABLE *table)
- { return tmp_table_field_from_field_type(table); }
+ Field *create_field_for_create_select(MEM_ROOT *root, TABLE *table)
+ { return tmp_table_field_from_field_type(root, table); }
const longlong *const_ptr_longlong() const { return &value; }
longlong val_int() { return value; }
longlong val_int_min() const { return value; }
@@ -4292,7 +4293,7 @@ protected:
const Metadata metadata)
{
fix_from_value(dv, metadata);
- set_name(thd, str_value.ptr(), str_value.length(), str_value.charset());
+ set_name(thd, str_value.lex_cstring(), str_value.charset());
}
protected:
/* Just create an item and do not fill string representation */
@@ -4339,21 +4340,21 @@ public:
fix_and_set_name_from_value(thd, dv, Metadata(&str_value, repertoire));
}
// Constructors with an externally provided item name
- Item_string(THD *thd, const char *name_par, const char *str, size_t length,
+ Item_string(THD *thd, const LEX_CSTRING &name_par, const LEX_CSTRING &str,
CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE)
:Item_literal(thd)
{
- str_value.set_or_copy_aligned(str, length, cs);
+ str_value.set_or_copy_aligned(str.str, str.length, cs);
fix_from_value(dv, Metadata(&str_value));
- set_name(thd, name_par,safe_strlen(name_par), system_charset_info);
+ set_name(thd, name_par);
}
- Item_string(THD *thd, const char *name_par, const char *str, size_t length,
+ Item_string(THD *thd, const LEX_CSTRING &name_par, const LEX_CSTRING &str,
CHARSET_INFO *cs, Derivation dv, uint repertoire)
:Item_literal(thd)
{
- str_value.set_or_copy_aligned(str, length, cs);
+ str_value.set_or_copy_aligned(str.str, str.length, cs);
fix_from_value(dv, Metadata(&str_value, repertoire));
- set_name(thd, name_par, safe_strlen(name_par), system_charset_info);
+ set_name(thd, name_par);
}
void print_value(String *to) const
{
@@ -4428,13 +4429,13 @@ public:
class Item_string_with_introducer :public Item_string
{
public:
- Item_string_with_introducer(THD *thd, const char *str, uint length,
+ Item_string_with_introducer(THD *thd, const LEX_CSTRING &str,
CHARSET_INFO *cs):
- Item_string(thd, str, length, cs)
+ Item_string(thd, str.str, str.length, cs)
{ }
- 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)
+ Item_string_with_introducer(THD *thd, const LEX_CSTRING &name_arg,
+ const LEX_CSTRING &str, CHARSET_INFO *tocs):
+ Item_string(thd, name_arg, str, tocs)
{ }
virtual bool is_cs_specified() const
{
@@ -4471,14 +4472,14 @@ public:
class Item_static_string_func :public Item_string
{
- const char *func_name;
+ const LEX_CSTRING func_name;
public:
- Item_static_string_func(THD *thd, const char *name_par, const char *str,
- uint length, CHARSET_INFO *cs,
+ Item_static_string_func(THD *thd, const LEX_CSTRING &name_par,
+ const LEX_CSTRING &str, CHARSET_INFO *cs,
Derivation dv= DERIVATION_COERCIBLE):
- Item_string(thd, NullS, str, length, cs, dv), func_name(name_par)
+ Item_string(thd, LEX_CSTRING({NullS,0}), str, cs, dv), func_name(name_par)
{}
- Item_static_string_func(THD *thd, const char *name_par,
+ Item_static_string_func(THD *thd, const LEX_CSTRING &name_par,
const String *str,
CHARSET_INFO *tocs, uint *conv_errors,
Derivation dv, uint repertoire):
@@ -4487,7 +4488,7 @@ public:
{}
Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs)
{
- return const_charset_converter(thd, tocs, true, func_name);
+ return const_charset_converter(thd, tocs, true, func_name.str);
}
virtual inline void print(String *str, enum_query_type query_type)
@@ -4500,7 +4501,7 @@ public:
bool check_vcol_func_processor(void *arg)
{ // VCOL_TIME_FUNC because the value is not constant, but does not
// require fix_fields() to be re-run for every statement.
- return mark_unsupported_function(func_name, arg, VCOL_TIME_FUNC);
+ return mark_unsupported_function(func_name.str, arg, VCOL_TIME_FUNC);
}
};
@@ -4509,53 +4510,16 @@ public:
class Item_partition_func_safe_string: public Item_string
{
public:
- Item_partition_func_safe_string(THD *thd, const char *name_arg, uint length,
- CHARSET_INFO *cs= NULL):
- Item_string(thd, name_arg, length, cs)
- {}
- bool check_vcol_func_processor(void *arg)
- {
- return mark_unsupported_function("safe_string", arg, VCOL_IMPOSSIBLE);
- }
-};
-
-
-class Item_return_date_time :public Item_partition_func_safe_string
-{
- enum_field_types date_time_field_type;
-public:
- Item_return_date_time(THD *thd, const char *name_arg, uint length_arg,
- enum_field_types field_type_arg, uint dec_arg= 0):
- Item_partition_func_safe_string(thd, name_arg, length_arg, &my_charset_bin),
- date_time_field_type(field_type_arg)
- { decimals= dec_arg; }
- const Type_handler *type_handler() const
- {
- return Type_handler::get_handler_by_field_type(date_time_field_type);
- }
-};
-
-
-class Item_blob :public Item_partition_func_safe_string
-{
-public:
- Item_blob(THD *thd, const char *name_arg, uint length):
- Item_partition_func_safe_string(thd, name_arg, (uint) safe_strlen(name_arg),
- &my_charset_bin)
- { max_length= length; }
- enum Type type() const { return TYPE_HOLDER; }
- const Type_handler *type_handler() const
+ Item_partition_func_safe_string(THD *thd, const LEX_CSTRING &name_arg,
+ uint length, CHARSET_INFO *cs):
+ Item_string(thd, name_arg, LEX_CSTRING({0,0}), cs)
{
- return Type_handler::blob_type_handler(max_length);
+ max_length= length;
}
- const Type_handler *real_type_handler() const
+ bool check_vcol_func_processor(void *arg)
{
- // Should not be called, Item_blob is used for SHOW purposes only.
- DBUG_ASSERT(0);
- return &type_handler_varchar;
+ return mark_unsupported_function("safe_string", arg, VCOL_IMPOSSIBLE);
}
- Field *create_field_for_schema(THD *thd, TABLE *table)
- { return tmp_table_field_from_field_type(table); }
};
@@ -4568,15 +4532,15 @@ public:
class Item_empty_string :public Item_partition_func_safe_string
{
public:
- 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.str= header;
- name.length= strlen(name.str);
- max_length= length * collation.collation->mbmaxlen;
- }
+ Item_empty_string(THD *thd, const LEX_CSTRING &header, uint length,
+ CHARSET_INFO *cs= &my_charset_utf8mb3_general_ci)
+ :Item_partition_func_safe_string(thd, header, length * cs->mbmaxlen, cs)
+ { }
+ Item_empty_string(THD *thd, const char *header, uint length,
+ CHARSET_INFO *cs= &my_charset_utf8mb3_general_ci)
+ :Item_partition_func_safe_string(thd, LEX_CSTRING({header, strlen(header)}),
+ length * cs->mbmaxlen, cs)
+ { }
void make_send_field(THD *thd, Send_field *field);
};
@@ -4593,7 +4557,9 @@ public:
}
const Type_handler *type_handler() const
{
- return Type_handler::get_handler_by_field_type(int_field_type);
+ const Type_handler *h=
+ Type_handler::get_handler_by_field_type(int_field_type);
+ return unsigned_flag ? h->type_handler_unsigned() : h;
}
};
@@ -4773,14 +4739,14 @@ public:
Item_temporal_literal(THD *thd, const MYSQL_TIME *ltime)
:Item_literal(thd)
{
- collation.set(&my_charset_numeric, DERIVATION_NUMERIC, MY_REPERTOIRE_ASCII);
+ collation= DTCollation_numeric();
decimals= 0;
cached_time= *ltime;
}
Item_temporal_literal(THD *thd, const MYSQL_TIME *ltime, uint dec_arg):
Item_literal(thd)
{
- collation.set(&my_charset_numeric, DERIVATION_NUMERIC, MY_REPERTOIRE_ASCII);
+ collation= DTCollation_numeric();
decimals= dec_arg;
cached_time= *ltime;
}
@@ -5170,10 +5136,14 @@ public:
Item **ref;
bool reference_trough_name;
Item_ref(THD *thd, Name_resolution_context *context_arg,
- const char *db_arg, const char *table_name_arg,
- const LEX_CSTRING *field_name_arg):
+ const LEX_CSTRING &db_arg, const LEX_CSTRING &table_name_arg,
+ const LEX_CSTRING &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) {}
+ Item_ref(THD *thd, Name_resolution_context *context_arg,
+ const LEX_CSTRING &field_name_arg)
+ :Item_ref(thd, context_arg, null_clex_str, null_clex_str, field_name_arg)
+ { }
/*
This constructor is used in two scenarios:
A) *item = NULL
@@ -5189,10 +5159,10 @@ public:
with Bar, and if we have a more broader set of problems like this.
*/
Item_ref(THD *thd, Name_resolution_context *context_arg, Item **item,
- const char *table_name_arg, const LEX_CSTRING *field_name_arg,
+ const LEX_CSTRING &table_name_arg, const LEX_CSTRING &field_name_arg,
bool alias_name_used_arg= FALSE);
Item_ref(THD *thd, TABLE_LIST *view_arg, Item **item,
- const LEX_CSTRING *field_name_arg, bool alias_name_used_arg= FALSE);
+ const LEX_CSTRING &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)
@@ -5239,7 +5209,7 @@ public:
Field *get_tmp_table_field()
{ return result_field ? result_field : (*ref)->get_tmp_table_field(); }
Item *get_tmp_table_item(THD *thd);
- Field *create_tmp_field_ex(TABLE *table, Tmp_field_src *src,
+ Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src,
const Tmp_field_param *param);
Item* propagate_equal_fields(THD *, const Context &, COND_EQUAL *);
table_map used_tables() const;
@@ -5268,6 +5238,10 @@ public:
{
return depended_from ? 0 : (*ref)->not_null_tables();
}
+ bool find_not_null_fields(table_map allowed)
+ {
+ return depended_from ? false : (*ref)->find_not_null_fields(allowed);
+ }
void save_in_result_field(bool no_conversions)
{
(*ref)->save_in_field(result_field, no_conversions);
@@ -5276,7 +5250,7 @@ public:
{
return ref ? (*ref)->real_item() : this;
}
- TYPELIB *get_typelib() const
+ const TYPELIB *get_typelib() const
{
return ref ? (*ref)->get_typelib() : NULL;
}
@@ -5409,8 +5383,8 @@ class Item_direct_ref :public Item_ref
{
public:
Item_direct_ref(THD *thd, Name_resolution_context *context_arg, Item **item,
- const char *table_name_arg,
- const LEX_CSTRING *field_name_arg,
+ const LEX_CSTRING &table_name_arg,
+ const LEX_CSTRING &field_name_arg,
bool alias_name_used_arg= FALSE):
Item_ref(thd, context_arg, item, table_name_arg,
field_name_arg, alias_name_used_arg)
@@ -5418,7 +5392,7 @@ public:
/* 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(THD *thd, TABLE_LIST *view_arg, Item **item,
- const LEX_CSTRING *field_name_arg,
+ const LEX_CSTRING &field_name_arg,
bool alias_name_used_arg= FALSE):
Item_ref(thd, view_arg, item, field_name_arg,
alias_name_used_arg)
@@ -5458,7 +5432,7 @@ class Item_direct_ref_to_ident :public Item_direct_ref
public:
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)
+ item->field_name, FALSE)
{
ident= item;
ref= (Item**)&ident;
@@ -5650,8 +5624,8 @@ class Item_direct_view_ref :public Item_direct_ref
public:
Item_direct_view_ref(THD *thd, Name_resolution_context *context_arg,
Item **item,
- const char *table_name_arg,
- LEX_CSTRING *field_name_arg,
+ LEX_CSTRING &table_name_arg,
+ LEX_CSTRING &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),
@@ -5824,7 +5798,7 @@ public:
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_field_arg->field_name),
outer_ref(outer_field_arg), in_sum_func(0),
found_in_select_list(0), found_in_group_by(0)
{
@@ -5833,7 +5807,7 @@ public:
fixed= 0; /* reset flag set in set_properties() */
}
Item_outer_ref(THD *thd, Name_resolution_context *context_arg, Item **item,
- const char *table_name_arg, LEX_CSTRING *field_name_arg,
+ const LEX_CSTRING &table_name_arg, LEX_CSTRING &field_name_arg,
bool alias_name_used_arg):
Item_direct_ref(thd, context_arg, item, table_name_arg, field_name_arg,
alias_name_used_arg),
@@ -5874,8 +5848,8 @@ protected:
public:
Item_ref_null_helper(THD *thd, Name_resolution_context *context_arg,
Item_in_subselect* master, Item **item,
- const char *table_name_arg,
- const LEX_CSTRING *field_name_arg):
+ const LEX_CSTRING &table_name_arg,
+ const LEX_CSTRING &field_name_arg):
Item_ref(thd, context_arg, item, table_name_arg, field_name_arg),
owner(master) {}
void save_val(Field *to);
@@ -5919,14 +5893,11 @@ public:
};
#ifdef MYSQL_SERVER
-#include "gstream.h"
-#include "spatial.h"
#include "item_sum.h"
#include "item_func.h"
#include "item_row.h"
#include "item_cmpfunc.h"
#include "item_strfunc.h"
-#include "item_geofunc.h"
#include "item_timefunc.h"
#include "item_subselect.h"
#include "item_xmlfunc.h"
@@ -6003,7 +5974,7 @@ public:
const Type_handler *type_handler() const
{ return Type_handler_hybrid_field_type::type_handler(); }
- Field *create_tmp_field_ex(TABLE *table, Tmp_field_src *src,
+ Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src,
const Tmp_field_param *param)
{
DBUG_ASSERT(0);
@@ -6243,16 +6214,13 @@ class Item_default_value : public Item_field
public:
Item *arg;
Item_default_value(THD *thd, Name_resolution_context *context_arg)
- :Item_field(thd, context_arg, (const char *)NULL, (const char *)NULL,
- &null_clex_str),
+ :Item_field(thd, context_arg),
arg(NULL) {}
Item_default_value(THD *thd, Name_resolution_context *context_arg, Item *a)
- :Item_field(thd, context_arg, (const char *)NULL, (const char *)NULL,
- &null_clex_str),
+ :Item_field(thd, context_arg),
arg(a) {}
Item_default_value(THD *thd, Name_resolution_context *context_arg, Field *a)
- :Item_field(thd, context_arg, (const char *)NULL, (const char *)NULL,
- &null_clex_str),
+ :Item_field(thd, context_arg),
arg(NULL) {}
enum Type type() const { return DEFAULT_VALUE_ITEM; }
bool eq(const Item *item, bool binary_cmp) const;
@@ -6339,8 +6307,7 @@ class Item_insert_value : public Item_field
public:
Item *arg;
Item_insert_value(THD *thd, Name_resolution_context *context_arg, Item *a)
- :Item_field(thd, context_arg, (const char *)NULL, (const char *)NULL,
- &null_clex_str),
+ :Item_field(thd, context_arg),
arg(a) {}
bool eq(const Item *item, bool binary_cmp) const;
bool fix_fields(THD *, Item **);
@@ -6401,10 +6368,9 @@ public:
Item_trigger_field(THD *thd, Name_resolution_context *context_arg,
row_version_type row_ver_arg,
- const LEX_CSTRING *field_name_arg,
+ const LEX_CSTRING &field_name_arg,
ulong priv, const bool ro)
- :Item_field(thd, context_arg,
- (const char *)NULL, (const char *)NULL, field_name_arg),
+ :Item_field(thd, context_arg, field_name_arg),
row_version(row_ver_arg), field_idx((uint)-1), original_privilege(priv),
want_privilege(priv), table_grants(NULL), read_only (ro)
{}
@@ -6526,10 +6492,10 @@ public:
const Type_handler *type_handler() const
{ return Type_handler_hybrid_field_type::type_handler(); }
- Field *create_tmp_field_ex(TABLE *table, Tmp_field_src *src,
+ Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src,
const Tmp_field_param *param)
{
- return create_tmp_field_ex_simple(table, src, param);
+ return create_tmp_field_ex_simple(root, table, src, param);
}
virtual void keep_array() {}
@@ -6629,8 +6595,6 @@ class Item_cache_int: public Item_cache
protected:
longlong value;
public:
- Item_cache_int(THD *thd): Item_cache(thd, &type_handler_longlong),
- value(0) {}
Item_cache_int(THD *thd, const Type_handler *handler):
Item_cache(thd, handler), value(0) {}
@@ -7027,11 +6991,10 @@ public:
single SP/PS execution.
*/
class Item_type_holder: public Item,
- public Type_handler_hybrid_field_type,
- public Type_geometry_attributes
+ public Type_handler_hybrid_field_type
{
protected:
- TYPELIB *enum_set_typelib;
+ const TYPELIB *enum_set_typelib;
public:
Item_type_holder(THD *thd, Item *item)
:Item(thd, item),
@@ -7048,7 +7011,6 @@ public:
bool maybe_null_arg)
:Item(thd),
Type_handler_hybrid_field_type(handler),
- Type_geometry_attributes(handler, attr),
enum_set_typelib(attr->get_typelib())
{
name= item->name;
@@ -7067,27 +7029,19 @@ public:
}
enum Type type() const { return TYPE_HOLDER; }
- TYPELIB *get_typelib() const { return enum_set_typelib; }
+ const TYPELIB *get_typelib() const { return enum_set_typelib; }
double val_real();
longlong val_int();
my_decimal *val_decimal(my_decimal *);
String *val_str(String*);
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate);
- Field *create_tmp_field_ex(TABLE *table, Tmp_field_src *src,
+ Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src,
const Tmp_field_param *param)
{
return Item_type_holder::real_type_handler()->
- make_and_init_table_field(&name, Record_addr(maybe_null),
+ make_and_init_table_field(root, &name, Record_addr(maybe_null),
*this, table);
}
- Field::geometry_type get_geometry_type() const
- {
- return Type_geometry_attributes::get_geometry_type();
- }
- void set_geometry_type(uint type)
- {
- Type_geometry_attributes::set_geometry_type(type);
- }
Item* get_copy(THD *thd) { return 0; }
};
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 9110f348a43..aaf6baf87f6 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -1230,6 +1230,15 @@ bool Item_in_optimizer::eval_not_null_tables(void *opt_arg)
}
+bool Item_in_optimizer::find_not_null_fields(table_map allowed)
+{
+ if (!(~allowed & used_tables()) && is_top_level_item())
+ {
+ return args[0]->find_not_null_fields(allowed);
+ }
+ return false;
+}
+
void Item_in_optimizer::print(String *str, enum_query_type query_type)
{
if (query_type & QT_PARSABLE)
@@ -2076,7 +2085,17 @@ bool Item_func_between::eval_not_null_tables(void *opt_arg)
(args[1]->not_null_tables() &
args[2]->not_null_tables()));
return 0;
-}
+}
+
+
+bool Item_func_between::find_not_null_fields(table_map allowed)
+{
+ if (negated || !is_top_level_item() || (~allowed & used_tables()))
+ return false;
+ return args[0]->find_not_null_fields(allowed) ||
+ args[1]->find_not_null_fields(allowed) ||
+ args[2]->find_not_null_fields(allowed);
+}
bool Item_func_between::count_sargable_conds(void *arg)
@@ -2134,7 +2153,7 @@ bool Item_func_between::fix_length_and_dec_numeric(THD *thd)
if (cvt_arg1 && cvt_arg2)
{
// Works for all types
- m_comparator.set_handler(&type_handler_longlong);
+ m_comparator.set_handler(&type_handler_slonglong);
}
}
}
@@ -4342,6 +4361,15 @@ Item_func_in::eval_not_null_tables(void *opt_arg)
}
+bool
+Item_func_in::find_not_null_fields(table_map allowed)
+{
+ if (negated || !is_top_level_item() || (~allowed & used_tables()))
+ return 0;
+ return args[0]->find_not_null_fields(allowed);
+}
+
+
void Item_func_in::fix_after_pullout(st_select_lex *new_parent, Item **ref,
bool merge)
{
@@ -4476,7 +4504,7 @@ bool Item_func_in::value_list_convert_const_to_int(THD *thd)
all_converted= false;
}
if (all_converted)
- m_comparator.set_handler(&type_handler_longlong);
+ m_comparator.set_handler(&type_handler_slonglong);
}
}
return thd->is_fatal_error; // Catch errrors in convert_const_to_int
@@ -4945,6 +4973,82 @@ Item_cond::eval_not_null_tables(void *opt_arg)
}
+/**
+ @note
+ This implementation of the virtual function find_not_null_fields()
+ infers null-rejectedness if fields from tables marked in 'allowed' from
+ this condition.
+ Currently only top level AND conjuncts that are not disjunctions are used
+ for the inference. Usage of any top level and-or formula with l OR levels
+ would require a stack of bitmaps for fields of the height h=2*l+1 So we
+ would have to allocate h-1 additional field bitmaps for each table marked
+ in 'allowed'.
+*/
+
+bool
+Item_cond::find_not_null_fields(table_map allowed)
+{
+ Item *item;
+ bool is_and_cond= functype() == Item_func::COND_AND_FUNC;
+ if (!is_and_cond)
+ {
+ /* Now only fields of top AND level conjuncts are taken into account */
+ return false;
+ }
+ uint isnull_func_cnt= 0;
+ List_iterator<Item> li(list);
+ while ((item=li++))
+ {
+ bool is_mult_eq= item->type() == Item::FUNC_ITEM &&
+ ((Item_func *) item)->functype() == Item_func::MULT_EQUAL_FUNC;
+ if (is_mult_eq)
+ {
+ if (!item->find_not_null_fields(allowed))
+ continue;
+ }
+
+ if (~allowed & item->used_tables())
+ continue;
+
+ /* It is assumed that all constant conjuncts are already eliminated */
+
+ /*
+ First infer null-rejectedness of fields from all conjuncts but
+ IS NULL predicates
+ */
+ bool isnull_func= item->type() == Item::FUNC_ITEM &&
+ ((Item_func *) item)->functype() == Item_func::ISNULL_FUNC;
+ if (isnull_func)
+ {
+ isnull_func_cnt++;
+ continue;
+ }
+ if (!item->find_not_null_fields(allowed))
+ continue;
+ }
+
+ /* Now try no get contradictions using IS NULL conjuncts */
+ if (isnull_func_cnt)
+ {
+ li.rewind();
+ while ((item=li++) && isnull_func_cnt)
+ {
+ if (~allowed & item->used_tables())
+ continue;
+
+ bool isnull_func= item->type() == Item::FUNC_ITEM &&
+ ((Item_func *) item)->functype() == Item_func::ISNULL_FUNC;
+ if (isnull_func)
+ {
+ if (item->find_not_null_fields(allowed))
+ return true;
+ isnull_func_cnt--;
+ }
+ }
+ }
+ return false;
+}
+
void Item_cond::fix_after_pullout(st_select_lex *new_parent, Item **ref,
bool merge)
{
@@ -5390,6 +5494,19 @@ longlong Item_func_isnull::val_int()
}
+bool Item_func_isnull::find_not_null_fields(table_map allowed)
+{
+ if (!(~allowed & used_tables()) &&
+ args[0]->real_item()->type() == Item::FIELD_ITEM)
+ {
+ Field *field= ((Item_field *)(args[0]->real_item()))->field;
+ if (bitmap_is_set(&field->table->tmp_set, field->field_index))
+ return true;
+ }
+ return false;
+}
+
+
void Item_func_isnull::print(String *str, enum_query_type query_type)
{
if (const_item() && !args[0]->maybe_null &&
@@ -6976,6 +7093,48 @@ void Item_equal::update_used_tables()
}
+/**
+ @note
+ This multiple equality can contains elements belonging not to tables {T}
+ marked in 'allowed' . So we can ascertain null-rejectedness of field f
+ belonging to table t from {T} only if one of the following equality
+ predicate can be extracted from this multiple equality:
+ - f=const
+ - f=f' where f' is a field of some table from {T}
+*/
+
+bool Item_equal::find_not_null_fields(table_map allowed)
+{
+ if (!(allowed & used_tables()))
+ return false;
+ bool checked= false;
+ Item_equal_fields_iterator it(*this);
+ Item *item;
+ while ((item= it++))
+ {
+ if (~allowed & item->used_tables())
+ continue;
+ if ((with_const || checked) && !item->find_not_null_fields(allowed))
+ continue;
+ Item_equal_fields_iterator it1(*this);
+ Item *item1;
+ while ((item1= it1++) && item1 != item)
+ {
+ if (~allowed & item1->used_tables())
+ continue;
+ if (!item->find_not_null_fields(allowed) &&
+ !item1->find_not_null_fields(allowed))
+ {
+ checked= true;
+ break;
+ }
+ }
+ }
+ return false;
+}
+
+
+
bool Item_equal::count_sargable_conds(void *arg)
{
SELECT_LEX *sel= (SELECT_LEX *) arg;
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index 0a91d45c2a2..ffe17f8a0bc 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -292,6 +292,7 @@ public:
Item_func_truth(thd, a, true, false) {}
~Item_func_isnottrue() {}
virtual const char* func_name() const { return "isnottrue"; }
+ bool find_not_null_fields(table_map allowed) { return false; }
Item *get_copy(THD *thd)
{ return get_item_copy<Item_func_isnottrue>(thd, this); }
bool eval_not_null_tables(void *) { not_null_tables_cache= 0; return false; }
@@ -324,6 +325,7 @@ public:
Item_func_truth(thd, a, false, false) {}
~Item_func_isnotfalse() {}
virtual const char* func_name() const { return "isnotfalse"; }
+ bool find_not_null_fields(table_map allowed) { return false; }
Item *get_copy(THD *thd)
{ return get_item_copy<Item_func_isnotfalse>(thd, this); }
bool eval_not_null_tables(void *) { not_null_tables_cache= 0; return false; }
@@ -386,6 +388,7 @@ public:
virtual void get_cache_parameters(List<Item> &parameters);
bool is_top_level_item();
bool eval_not_null_tables(void *opt_arg);
+ bool find_not_null_fields(table_map allowed);
void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge);
bool invisible_mode();
void reset_cache() { cache= NULL; }
@@ -582,6 +585,7 @@ public:
void print(String *str, enum_query_type query_type)
{ Item_func::print_op(str, query_type); }
longlong val_int();
+ bool find_not_null_fields(table_map allowed) { return false; }
Item *neg_transformer(THD *thd);
Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond)
{
@@ -603,6 +607,7 @@ public:
longlong val_int();
enum Functype functype() const { return NOT_FUNC; }
const char *func_name() const { return "not"; }
+ bool find_not_null_fields(table_map allowed) { return false; }
enum precedence precedence() const { return BANG_PRECEDENCE; }
Item *neg_transformer(THD *thd);
bool fix_fields(THD *, Item **);
@@ -747,6 +752,7 @@ public:
longlong val_int();
bool fix_length_and_dec();
table_map not_null_tables() const { return 0; }
+ bool find_not_null_fields(table_map allowed) { return false; }
enum Functype functype() const { return EQUAL_FUNC; }
enum Functype rev_functype() const { return EQUAL_FUNC; }
cond_result eq_cmp_result() const { return COND_TRUE; }
@@ -924,6 +930,7 @@ public:
bool fix_length_and_dec_numeric(THD *);
virtual void print(String *str, enum_query_type query_type);
bool eval_not_null_tables(void *opt_arg);
+ bool find_not_null_fields(table_map allowed);
void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge);
bool count_sargable_conds(void *arg);
void add_key_fields(JOIN *join, KEY_FIELD **key_fields,
@@ -1425,7 +1432,7 @@ public:
((Item_int*) item)->unsigned_flag= (bool)
((packed_longlong*) base)[pos].unsigned_flag;
}
- const Type_handler *type_handler() const { return &type_handler_longlong; }
+ const Type_handler *type_handler() const { return &type_handler_slonglong; }
friend int cmp_longlong(void *cmp_arg, packed_longlong *a,packed_longlong *b);
};
@@ -2449,6 +2456,7 @@ public:
const char *func_name() const { return "in"; }
enum precedence precedence() const { return CMP_PRECEDENCE; }
bool eval_not_null_tables(void *opt_arg);
+ bool find_not_null_fields(table_map allowed);
void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge);
bool count_sargable_conds(void *arg);
Item *get_copy(THD *thd)
@@ -2592,6 +2600,7 @@ public:
COND *remove_eq_conds(THD *thd, Item::cond_result *cond_value,
bool top_level);
table_map not_null_tables() const { return 0; }
+ bool find_not_null_fields(table_map allowed);
Item *neg_transformer(THD *thd);
Item *get_copy(THD *thd)
{ return get_item_copy<Item_func_isnull>(thd, this); }
@@ -2799,7 +2808,6 @@ class Regexp_processor_pcre
bool m_conversion_is_needed;
bool m_is_const;
int m_library_flags;
- CHARSET_INFO *m_data_charset;
CHARSET_INFO *m_library_charset;
String m_prev_pattern;
int m_pcre_exec_rc;
@@ -2816,8 +2824,7 @@ public:
Regexp_processor_pcre() :
m_pcre(NULL), m_conversion_is_needed(true), m_is_const(0),
m_library_flags(0),
- m_data_charset(&my_charset_utf8_general_ci),
- m_library_charset(&my_charset_utf8_general_ci)
+ m_library_charset(&my_charset_utf8mb3_general_ci)
{
m_pcre_extra.flags= PCRE_EXTRA_MATCH_LIMIT_RECURSION;
m_pcre_extra.match_limit_recursion= 100L;
@@ -2834,7 +2841,7 @@ public:
// Convert text data to utf-8.
m_library_charset= data_charset == &my_charset_bin ?
- &my_charset_bin : &my_charset_utf8_general_ci;
+ &my_charset_bin : &my_charset_utf8mb3_general_ci;
m_conversion_is_needed= (data_charset != &my_charset_bin) &&
!my_charset_same(data_charset, m_library_charset);
@@ -3016,6 +3023,7 @@ public:
Item *compile(THD *thd, Item_analyzer analyzer, uchar **arg_p,
Item_transformer transformer, uchar *arg_t);
bool eval_not_null_tables(void *opt_arg);
+ bool find_not_null_fields(table_map allowed);
Item *build_clone(THD *thd);
bool excl_dep_on_table(table_map tab_map);
bool excl_dep_on_grouping_fields(st_select_lex *sel);
@@ -3181,6 +3189,7 @@ public:
eval_item= NULL;
}
void update_used_tables();
+ bool find_not_null_fields(table_map allowed);
COND *build_equal_items(THD *thd, COND_EQUAL *inherited,
bool link_item_fields,
COND_EQUAL **cond_equal_ref);
diff --git a/sql/item_create.cc b/sql/item_create.cc
index 9b949835e27..e8eb76dfc12 100644
--- a/sql/item_create.cc
+++ b/sql/item_create.cc
@@ -33,118 +33,104 @@
#include "set_var.h"
#include "sp_head.h"
#include "sp.h"
-#include "item_inetfunc.h"
#include "sql_time.h"
+#include "sql_type_geom.h"
+#include <mysql/plugin_function_collection.h>
-/*
-=============================================================================
- LOCAL DECLARATIONS
-=============================================================================
-*/
-/**
- Adapter for functions that takes exactly zero arguments.
-*/
-
-class Create_func_arg0 : public Create_func
+extern "C" uchar*
+get_native_fct_hash_key(const uchar *buff, size_t *length,
+ my_bool /* unused */)
{
-public:
- virtual Item *create_func(THD *thd, LEX_CSTRING *name,
- List<Item> *item_list);
-
- /**
- Builder method, with no arguments.
- @param thd The current thread
- @return An item representing the function call
- */
- virtual Item *create_builder(THD *thd) = 0;
-
-protected:
- /** Constructor. */
- Create_func_arg0() {}
- /** Destructor. */
- virtual ~Create_func_arg0() {}
-};
-
+ Native_func_registry *func= (Native_func_registry*) buff;
+ *length= func->name.length;
+ return (uchar*) func->name.str;
+}
-/**
- Adapter for functions that takes exactly one argument.
-*/
-class Create_func_arg1 : public Create_func
+bool Plugin_function_collection::init()
{
-public:
- virtual Item *create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
-
- /**
- Builder method, with one argument.
- @param thd The current thread
- @param arg1 The first argument of the function
- @return An item representing the function call
- */
- virtual Item *create_1_arg(THD *thd, Item *arg1) = 0;
+ DBUG_ENTER("Plugin_function_collection::init");
+ if (my_hash_init(&m_hash,
+ system_charset_info,
+ (ulong) m_native_func_registry_array.count(),
+ 0,
+ 0,
+ (my_hash_get_key) get_native_fct_hash_key,
+ NULL, /* Nothing to free */
+ MYF(0)))
+ DBUG_RETURN(true);
-protected:
- /** Constructor. */
- Create_func_arg1() {}
- /** Destructor. */
- virtual ~Create_func_arg1() {}
-};
+ for (size_t i= 0; i < m_native_func_registry_array.count(); i++)
+ {
+ const Native_func_registry &func= m_native_func_registry_array.element(i);
+ DBUG_ASSERT(func.builder != NULL);
+ if (my_hash_insert(&m_hash, (uchar*) &func))
+ DBUG_RETURN(true);
+ }
+ DBUG_RETURN(false);
+}
-/**
- Adapter for functions that takes exactly two arguments.
-*/
-class Create_func_arg2 : public Create_func
+Create_func *
+Plugin_function_collection::find_native_function_builder(THD *thd,
+ const LEX_CSTRING &name)
+ const
{
-public:
- virtual Item *create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
-
- /**
- Builder method, with two arguments.
- @param thd The current thread
- @param arg1 The first argument of the function
- @param arg2 The second argument of the function
- @return An item representing the function call
- */
- virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) = 0;
-
-protected:
- /** Constructor. */
- Create_func_arg2() {}
- /** Destructor. */
- virtual ~Create_func_arg2() {}
-};
-
+ const Native_func_registry *func;
+ func= (const Native_func_registry*) my_hash_search(&m_hash,
+ (uchar*) name.str,
+ name.length);
+ return func ? func->builder : NULL;
+}
-/**
- Adapter for functions that takes exactly three arguments.
-*/
-class Create_func_arg3 : public Create_func
+class Plugin_find_native_func_builder_param
{
+ bool find_native_function_builder(THD *thd,
+ const Plugin_function_collection *pfc)
+ {
+ // plugin_foreach() will stop iterating when this function returns TRUE
+ return ((builder= pfc->find_native_function_builder(thd, name))) != NULL;
+ }
+ static my_bool find_in_plugin(THD *thd, plugin_ref plugin, void *data)
+ {
+ Plugin_find_native_func_builder_param *param=
+ reinterpret_cast<Plugin_find_native_func_builder_param*>(data);
+ const Plugin_function_collection *fc=
+ reinterpret_cast<Plugin_function_collection*>
+ (plugin_decl(plugin)->info);
+ return param->find_native_function_builder(thd, fc);
+ }
public:
- virtual Item *create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ LEX_CSTRING name;
+ Create_func *builder;
+ Plugin_find_native_func_builder_param(const LEX_CSTRING &name_arg)
+ :name(name_arg), builder(NULL)
+ { }
+ Create_func *find(THD *thd)
+ {
+ if (!plugin_foreach(thd,
+ Plugin_find_native_func_builder_param::find_in_plugin,
+ MariaDB_FUNCTION_COLLECTION_PLUGIN, this))
+ return NULL;
+ return builder;
+ }
+};
- /**
- Builder method, with three arguments.
- @param thd The current thread
- @param arg1 The first argument of the function
- @param arg2 The second argument of the function
- @param arg3 The third argument of the function
- @return An item representing the function call
- */
- virtual Item *create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *arg3) = 0;
-protected:
- /** Constructor. */
- Create_func_arg3() {}
- /** Destructor. */
- virtual ~Create_func_arg3() {}
-};
+#ifdef HAVE_SPATIAL
+extern Plugin_function_collection plugin_function_collection_geometry;
+#endif
+/*
+=============================================================================
+ LOCAL DECLARATIONS
+=============================================================================
+*/
+
/**
Function builder for Stored Functions.
*/
@@ -165,30 +151,6 @@ protected:
};
-#ifndef HAVE_SPATIAL
-/**
- Common (non) builder for geometry functions.
- This builder is used in <code>--without-geometry</code> builds only,
- to report an error.
-*/
-
-class Create_func_no_geom : public Create_func
-{
-public:
- virtual Item *create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
-
- /** Singleton. */
- static Create_func_no_geom s_singleton;
-
-protected:
- /** Constructor. */
- Create_func_no_geom() {}
- /** Destructor. */
- virtual ~Create_func_no_geom() {}
-};
-#endif
-
-
/*
Concrete functions builders (native functions).
Please keep this list sorted in alphabetical order,
@@ -260,51 +222,6 @@ protected:
};
-#ifdef HAVE_SPATIAL
-class Create_func_area : public Create_func_arg1
-{
-public:
- virtual Item *create_1_arg(THD *thd, Item *arg1);
-
- static Create_func_area s_singleton;
-
-protected:
- Create_func_area() {}
- virtual ~Create_func_area() {}
-};
-#endif
-
-
-#ifdef HAVE_SPATIAL
-class Create_func_as_wkb : public Create_func_arg1
-{
-public:
- virtual Item *create_1_arg(THD *thd, Item *arg1);
-
- static Create_func_as_wkb s_singleton;
-
-protected:
- Create_func_as_wkb() {}
- virtual ~Create_func_as_wkb() {}
-};
-#endif
-
-
-#ifdef HAVE_SPATIAL
-class Create_func_as_wkt : public Create_func_arg1
-{
-public:
- virtual Item *create_1_arg(THD *thd, Item *arg1);
-
- static Create_func_as_wkt s_singleton;
-
-protected:
- Create_func_as_wkt() {}
- virtual ~Create_func_as_wkt() {}
-};
-#endif
-
-
class Create_func_asin : public Create_func_arg1
{
public:
@@ -409,20 +326,6 @@ protected:
};
-#ifdef HAVE_SPATIAL
-class Create_func_centroid : public Create_func_arg1
-{
-public:
- virtual Item *create_1_arg(THD *thd, Item *arg1);
-
- static Create_func_centroid s_singleton;
-
-protected:
- Create_func_centroid() {}
- virtual ~Create_func_centroid() {}
-};
-
-
class Create_func_chr : public Create_func_arg1
{
public:
@@ -436,35 +339,6 @@ protected:
};
-class Create_func_convexhull : public Create_func_arg1
-{
-public:
- virtual Item *create_1_arg(THD *thd, Item *arg1);
-
- static Create_func_convexhull s_singleton;
-
-protected:
- Create_func_convexhull() {}
- virtual ~Create_func_convexhull() {}
-};
-
-
-class Create_func_pointonsurface : public Create_func_arg1
-{
-public:
- virtual Item *create_1_arg(THD *thd, Item *arg1);
-
- static Create_func_pointonsurface s_singleton;
-
-protected:
- Create_func_pointonsurface() {}
- virtual ~Create_func_pointonsurface() {}
-};
-
-
-#endif /*HAVE_SPATIAL*/
-
-
class Create_func_char_length : public Create_func_arg1
{
public:
@@ -630,34 +504,6 @@ protected:
};
-#ifdef HAVE_SPATIAL
-class Create_func_mbr_contains : public Create_func_arg2
-{
- public:
- virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2);
-
- static Create_func_mbr_contains s_singleton;
-
- protected:
- Create_func_mbr_contains() {}
- virtual ~Create_func_mbr_contains() {}
-};
-
-
-class Create_func_contains : public Create_func_arg2
-{
-public:
- virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2);
-
- static Create_func_contains s_singleton;
-
-protected:
- Create_func_contains() {}
- virtual ~Create_func_contains() {}
-};
-#endif
-
-
class Create_func_nvl2 : public Create_func_arg3
{
public:
@@ -736,21 +582,6 @@ protected:
};
-#ifdef HAVE_SPATIAL
-class Create_func_crosses : public Create_func_arg2
-{
-public:
- virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2);
-
- static Create_func_crosses s_singleton;
-
-protected:
- Create_func_crosses() {}
- virtual ~Create_func_crosses() {}
-};
-#endif
-
-
class Create_func_datediff : public Create_func_arg2
{
public:
@@ -855,62 +686,6 @@ protected:
};
-#ifdef HAVE_SPATIAL
-class Create_func_dimension : public Create_func_arg1
-{
-public:
- virtual Item *create_1_arg(THD *thd, Item *arg1);
-
- static Create_func_dimension s_singleton;
-
-protected:
- Create_func_dimension() {}
- virtual ~Create_func_dimension() {}
-};
-#endif
-
-
-#ifdef HAVE_SPATIAL
-class Create_func_mbr_disjoint : public Create_func_arg2
-{
- public:
- virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2);
-
- static Create_func_mbr_disjoint s_singleton;
-
- protected:
- Create_func_mbr_disjoint() {}
- virtual ~Create_func_mbr_disjoint() {}
-};
-
-
-class Create_func_disjoint : public Create_func_arg2
-{
-public:
- virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2);
-
- static Create_func_disjoint s_singleton;
-
-protected:
- Create_func_disjoint() {}
- virtual ~Create_func_disjoint() {}
-};
-
-
-class Create_func_distance : public Create_func_arg2
-{
- public:
- virtual Item* create_2_arg(THD *thd, Item *arg1, Item *arg2);
-
- static Create_func_distance s_singleton;
-
- protected:
- Create_func_distance() {}
- virtual ~Create_func_distance() {}
-};
-#endif
-
-
class Create_func_elt : public Create_native_func
{
public:
@@ -950,76 +725,6 @@ protected:
};
-#ifdef HAVE_SPATIAL
-class Create_func_endpoint : public Create_func_arg1
-{
-public:
- virtual Item *create_1_arg(THD *thd, Item *arg1);
-
- static Create_func_endpoint s_singleton;
-
-protected:
- Create_func_endpoint() {}
- virtual ~Create_func_endpoint() {}
-};
-#endif
-
-
-#ifdef HAVE_SPATIAL
-class Create_func_envelope : public Create_func_arg1
-{
-public:
- virtual Item *create_1_arg(THD *thd, Item *arg1);
-
- static Create_func_envelope s_singleton;
-
-protected:
- Create_func_envelope() {}
- virtual ~Create_func_envelope() {}
-};
-
-class Create_func_boundary : public Create_func_arg1
-{
-public:
- virtual Item *create_1_arg(THD *thd, Item *arg1);
-
- static Create_func_boundary s_singleton;
-
-protected:
- Create_func_boundary() {}
- virtual ~Create_func_boundary() {}
-};
-#endif /*HAVE_SPATIAL*/
-
-
-#ifdef HAVE_SPATIAL
-class Create_func_mbr_equals : public Create_func_arg2
-{
- public:
- virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2);
-
- static Create_func_mbr_equals s_singleton;
-
- protected:
- Create_func_mbr_equals() {}
- virtual ~Create_func_mbr_equals() {}
-};
-
-
-class Create_func_equals : public Create_func_arg2
-{
-public:
- virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2);
-
- static Create_func_equals s_singleton;
-
-protected:
- Create_func_equals() {}
- virtual ~Create_func_equals() {}
-};
-#endif
-
-
class Create_func_exp : public Create_func_arg1
{
public:
@@ -1046,21 +751,6 @@ protected:
};
-#ifdef HAVE_SPATIAL
-class Create_func_exteriorring : public Create_func_arg1
-{
-public:
- virtual Item *create_1_arg(THD *thd, Item *arg1);
-
- static Create_func_exteriorring s_singleton;
-
-protected:
- Create_func_exteriorring() {}
- virtual ~Create_func_exteriorring() {}
-};
-#endif
-
-
class Create_func_field : public Create_native_func
{
public:
@@ -1165,94 +855,6 @@ protected:
};
-#ifdef HAVE_SPATIAL
-class Create_func_geometry_from_text : public Create_native_func
-{
-public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
-
- static Create_func_geometry_from_text s_singleton;
-
-protected:
- Create_func_geometry_from_text() {}
- virtual ~Create_func_geometry_from_text() {}
-};
-#endif
-
-
-#ifdef HAVE_SPATIAL
-class Create_func_geometry_from_wkb : public Create_native_func
-{
-public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
-
- static Create_func_geometry_from_wkb s_singleton;
-
-protected:
- Create_func_geometry_from_wkb() {}
- virtual ~Create_func_geometry_from_wkb() {}
-};
-#endif
-
-
-#ifdef HAVE_SPATIAL
-class Create_func_geometry_from_json : public Create_native_func
-{
-public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
-
- static Create_func_geometry_from_json s_singleton;
-
-protected:
- Create_func_geometry_from_json() {}
- virtual ~Create_func_geometry_from_json() {}
-};
-
-
-class Create_func_as_geojson : public Create_native_func
-{
-public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
-
- static Create_func_as_geojson s_singleton;
-
-protected:
- Create_func_as_geojson() {}
- virtual ~Create_func_as_geojson() {}
-};
-#endif /*HAVE_SPATIAL*/
-
-
-#ifdef HAVE_SPATIAL
-class Create_func_geometry_type : public Create_func_arg1
-{
-public:
- virtual Item *create_1_arg(THD *thd, Item *arg1);
-
- static Create_func_geometry_type s_singleton;
-
-protected:
- Create_func_geometry_type() {}
- virtual ~Create_func_geometry_type() {}
-};
-#endif
-
-
-#ifdef HAVE_SPATIAL
-class Create_func_geometryn : public Create_func_arg2
-{
-public:
- virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2);
-
- static Create_func_geometryn s_singleton;
-
-protected:
- Create_func_geometryn() {}
- virtual ~Create_func_geometryn() {}
-};
-#endif
-
-
class Create_func_get_lock : public Create_func_arg2
{
public:
@@ -1266,36 +868,6 @@ protected:
};
-#if defined(HAVE_SPATIAL) && !defined(DBUG_OFF)
-class Create_func_gis_debug : public Create_func_arg1
-{
- public:
- virtual Item *create_1_arg(THD *thd, Item *arg1);
-
- static Create_func_gis_debug s_singleton;
-
- protected:
- Create_func_gis_debug() {}
- virtual ~Create_func_gis_debug() {}
-};
-#endif
-
-
-#ifdef HAVE_SPATIAL
-class Create_func_glength : public Create_func_arg1
-{
-public:
- virtual Item *create_1_arg(THD *thd, Item *arg1);
-
- static Create_func_glength s_singleton;
-
-protected:
- Create_func_glength() {}
- virtual ~Create_func_glength() {}
-};
-#endif
-
-
class Create_func_greatest : public Create_native_func
{
public:
@@ -1335,110 +907,6 @@ protected:
};
-class Create_func_inet_ntoa : public Create_func_arg1
-{
-public:
- virtual Item *create_1_arg(THD *thd, Item *arg1);
-
- static Create_func_inet_ntoa s_singleton;
-
-protected:
- Create_func_inet_ntoa() {}
- virtual ~Create_func_inet_ntoa() {}
-};
-
-
-class Create_func_inet_aton : public Create_func_arg1
-{
-public:
- virtual Item *create_1_arg(THD *thd, Item *arg1);
-
- static Create_func_inet_aton s_singleton;
-
-protected:
- Create_func_inet_aton() {}
- virtual ~Create_func_inet_aton() {}
-};
-
-
-class Create_func_inet6_aton : public Create_func_arg1
-{
-public:
- virtual Item *create_1_arg(THD *thd, Item *arg1);
-
- static Create_func_inet6_aton s_singleton;
-
-protected:
- Create_func_inet6_aton() {}
- virtual ~Create_func_inet6_aton() {}
-};
-
-
-class Create_func_inet6_ntoa : public Create_func_arg1
-{
-public:
- virtual Item *create_1_arg(THD *thd, Item *arg1);
-
- static Create_func_inet6_ntoa s_singleton;
-
-protected:
- Create_func_inet6_ntoa() {}
- virtual ~Create_func_inet6_ntoa() {}
-};
-
-
-class Create_func_is_ipv4 : public Create_func_arg1
-{
-public:
- virtual Item *create_1_arg(THD *thd, Item *arg1);
-
- static Create_func_is_ipv4 s_singleton;
-
-protected:
- Create_func_is_ipv4() {}
- virtual ~Create_func_is_ipv4() {}
-};
-
-
-class Create_func_is_ipv6 : public Create_func_arg1
-{
-public:
- virtual Item *create_1_arg(THD *thd, Item *arg1);
-
- static Create_func_is_ipv6 s_singleton;
-
-protected:
- Create_func_is_ipv6() {}
- virtual ~Create_func_is_ipv6() {}
-};
-
-
-class Create_func_is_ipv4_compat : public Create_func_arg1
-{
-public:
- virtual Item *create_1_arg(THD *thd, Item *arg1);
-
- static Create_func_is_ipv4_compat s_singleton;
-
-protected:
- Create_func_is_ipv4_compat() {}
- virtual ~Create_func_is_ipv4_compat() {}
-};
-
-
-class Create_func_is_ipv4_mapped : public Create_func_arg1
-{
-public:
- virtual Item *create_1_arg(THD *thd, Item *arg1);
-
- static Create_func_is_ipv4_mapped s_singleton;
-
-protected:
- Create_func_is_ipv4_mapped() {}
- virtual ~Create_func_is_ipv4_mapped() {}
-};
-
-
class Create_func_instr : public Create_func_arg2
{
public:
@@ -1452,127 +920,6 @@ protected:
};
-#ifdef HAVE_SPATIAL
-class Create_func_interiorringn : public Create_func_arg2
-{
-public:
- virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2);
-
- static Create_func_interiorringn s_singleton;
-
-protected:
- Create_func_interiorringn() {}
- virtual ~Create_func_interiorringn() {}
-};
-#endif
-
-
-#ifdef HAVE_SPATIAL
-class Create_func_relate : public Create_func_arg3
-{
-public:
- virtual Item *create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *arg3);
-
- static Create_func_relate s_singleton;
-
-protected:
- Create_func_relate() {}
- virtual ~Create_func_relate() {}
-};
-
-
-class Create_func_mbr_intersects : public Create_func_arg2
-{
- public:
- virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2);
-
- static Create_func_mbr_intersects s_singleton;
-
- protected:
- Create_func_mbr_intersects() {}
- virtual ~Create_func_mbr_intersects() {}
-};
-
-
-class Create_func_intersects : public Create_func_arg2
-{
-public:
- virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2);
-
- static Create_func_intersects s_singleton;
-
-protected:
- Create_func_intersects() {}
- virtual ~Create_func_intersects() {}
-};
-
-
-class Create_func_intersection : public Create_func_arg2
-{
-public:
- virtual Item* create_2_arg(THD *thd, Item *arg1, Item *arg2);
-
- static Create_func_intersection s_singleton;
-
-protected:
- Create_func_intersection() {}
- virtual ~Create_func_intersection() {}
-};
-
-
-class Create_func_difference : public Create_func_arg2
-{
-public:
- virtual Item* create_2_arg(THD *thd, Item *arg1, Item *arg2);
-
- static Create_func_difference s_singleton;
-
-protected:
- Create_func_difference() {}
- virtual ~Create_func_difference() {}
-};
-
-
-class Create_func_union : public Create_func_arg2
-{
-public:
- virtual Item* create_2_arg(THD *thd, Item *arg1, Item *arg2);
-
- static Create_func_union s_singleton;
-
-protected:
- Create_func_union() {}
- virtual ~Create_func_union() {}
-};
-
-
-class Create_func_symdifference : public Create_func_arg2
-{
-public:
- virtual Item* create_2_arg(THD *thd, Item *arg1, Item *arg2);
-
- static Create_func_symdifference s_singleton;
-
-protected:
- Create_func_symdifference() {}
- virtual ~Create_func_symdifference() {}
-};
-
-
-class Create_func_buffer : public Create_func_arg2
-{
-public:
- virtual Item* create_2_arg(THD *thd, Item *arg1, Item *arg2);
-
- static Create_func_buffer s_singleton;
-
-protected:
- Create_func_buffer() {}
- virtual ~Create_func_buffer() {}
-};
-#endif /*HAVE_SPATIAL*/
-
-
class Create_func_is_free_lock : public Create_func_arg1
{
public:
@@ -1599,49 +946,6 @@ protected:
};
-#ifdef HAVE_SPATIAL
-class Create_func_isclosed : public Create_func_arg1
-{
-public:
- virtual Item *create_1_arg(THD *thd, Item *arg1);
-
- static Create_func_isclosed s_singleton;
-
-protected:
- Create_func_isclosed() {}
- virtual ~Create_func_isclosed() {}
-};
-
-
-class Create_func_isring : public Create_func_arg1
-{
-public:
- virtual Item *create_1_arg(THD *thd, Item *arg1);
-
- static Create_func_isring s_singleton;
-
-protected:
- Create_func_isring() {}
- virtual ~Create_func_isring() {}
-};
-#endif
-
-
-#ifdef HAVE_SPATIAL
-class Create_func_isempty : public Create_func_arg1
-{
-public:
- virtual Item *create_1_arg(THD *thd, Item *arg1);
-
- static Create_func_isempty s_singleton;
-
-protected:
- Create_func_isempty() {}
- virtual ~Create_func_isempty() {}
-};
-#endif
-
-
class Create_func_isnull : public Create_func_arg1
{
public:
@@ -1655,21 +959,6 @@ protected:
};
-#ifdef HAVE_SPATIAL
-class Create_func_issimple : public Create_func_arg1
-{
-public:
- virtual Item *create_1_arg(THD *thd, Item *arg1);
-
- static Create_func_issimple s_singleton;
-
-protected:
- Create_func_issimple() {}
- virtual ~Create_func_issimple() {}
-};
-#endif
-
-
class Create_func_json_exists : public Create_func_arg2
{
public:
@@ -2378,51 +1667,6 @@ protected:
};
-#ifdef HAVE_SPATIAL
-class Create_func_numgeometries : public Create_func_arg1
-{
-public:
- virtual Item *create_1_arg(THD *thd, Item *arg1);
-
- static Create_func_numgeometries s_singleton;
-
-protected:
- Create_func_numgeometries() {}
- virtual ~Create_func_numgeometries() {}
-};
-#endif
-
-
-#ifdef HAVE_SPATIAL
-class Create_func_numinteriorring : public Create_func_arg1
-{
-public:
- virtual Item *create_1_arg(THD *thd, Item *arg1);
-
- static Create_func_numinteriorring s_singleton;
-
-protected:
- Create_func_numinteriorring() {}
- virtual ~Create_func_numinteriorring() {}
-};
-#endif
-
-
-#ifdef HAVE_SPATIAL
-class Create_func_numpoints : public Create_func_arg1
-{
-public:
- virtual Item *create_1_arg(THD *thd, Item *arg1);
-
- static Create_func_numpoints s_singleton;
-
-protected:
- Create_func_numpoints() {}
- virtual ~Create_func_numpoints() {}
-};
-#endif
-
-
class Create_func_oct : public Create_func_arg1
{
public:
@@ -2449,34 +1693,6 @@ protected:
};
-#ifdef HAVE_SPATIAL
-class Create_func_mbr_overlaps : public Create_func_arg2
-{
- public:
- virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2);
-
- static Create_func_mbr_overlaps s_singleton;
-
- protected:
- Create_func_mbr_overlaps() {}
- virtual ~Create_func_mbr_overlaps() {}
-};
-
-
-class Create_func_overlaps : public Create_func_arg2
-{
-public:
- virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2);
-
- static Create_func_overlaps s_singleton;
-
-protected:
- Create_func_overlaps() {}
- virtual ~Create_func_overlaps() {}
-};
-#endif
-
-
class Create_func_period_add : public Create_func_arg2
{
public:
@@ -2516,21 +1732,6 @@ protected:
};
-#ifdef HAVE_SPATIAL
-class Create_func_pointn : public Create_func_arg2
-{
-public:
- virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2);
-
- static Create_func_pointn s_singleton;
-
-protected:
- Create_func_pointn() {}
- virtual ~Create_func_pointn() {}
-};
-#endif
-
-
class Create_func_pow : public Create_func_arg2
{
public:
@@ -2848,36 +2049,6 @@ protected:
};
-#ifdef HAVE_SPATIAL
-class Create_func_srid : public Create_func_arg1
-{
-public:
- virtual Item *create_1_arg(THD *thd, Item *arg1);
-
- static Create_func_srid s_singleton;
-
-protected:
- Create_func_srid() {}
- virtual ~Create_func_srid() {}
-};
-#endif
-
-
-#ifdef HAVE_SPATIAL
-class Create_func_startpoint : public Create_func_arg1
-{
-public:
- virtual Item *create_1_arg(THD *thd, Item *arg1);
-
- static Create_func_startpoint s_singleton;
-
-protected:
- Create_func_startpoint() {}
- virtual ~Create_func_startpoint() {}
-};
-#endif
-
-
class Create_func_str_to_date : public Create_func_arg2
{
public:
@@ -3034,21 +2205,6 @@ protected:
};
-#ifdef HAVE_SPATIAL
-class Create_func_touches : public Create_func_arg2
-{
-public:
- virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2);
-
- static Create_func_touches s_singleton;
-
-protected:
- Create_func_touches() {}
- virtual ~Create_func_touches() {}
-};
-#endif
-
-
class Create_func_ucase : public Create_func_arg1
{
public:
@@ -3179,33 +2335,6 @@ protected:
};
-#ifdef HAVE_SPATIAL
-class Create_func_mbr_within : public Create_func_arg2
-{
- public:
- virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2);
-
- static Create_func_mbr_within s_singleton;
-
- protected:
- Create_func_mbr_within() {}
- virtual ~Create_func_mbr_within() {}
-};
-
-
-class Create_func_within : public Create_func_arg2
-{
-public:
- virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2);
-
- static Create_func_within s_singleton;
-
-protected:
- Create_func_within() {}
- virtual ~Create_func_within() {}
-};
-#endif
-
#ifdef WITH_WSREP
class Create_func_wsrep_last_written_gtid : public Create_func_arg0
{
@@ -3246,20 +2375,6 @@ protected:
};
#endif /* WITH_WSREP */
-#ifdef HAVE_SPATIAL
-class Create_func_x : public Create_func_arg1
-{
-public:
- virtual Item *create_1_arg(THD *thd, Item *arg1);
-
- static Create_func_x s_singleton;
-
-protected:
- Create_func_x() {}
- virtual ~Create_func_x() {}
-};
-#endif
-
class Create_func_xml_extractvalue : public Create_func_arg2
{
@@ -3287,21 +2402,6 @@ protected:
};
-#ifdef HAVE_SPATIAL
-class Create_func_y : public Create_func_arg1
-{
-public:
- virtual Item *create_1_arg(THD *thd, Item *arg1);
-
- static Create_func_y s_singleton;
-
-protected:
- Create_func_y() {}
- virtual ~Create_func_y() {}
-};
-#endif
-
-
class Create_func_year_week : public Create_native_func
{
public:
@@ -3344,21 +2444,6 @@ static bool has_named_parameters(List<Item> *params)
return false;
}
-#ifndef HAVE_SPATIAL
-Create_func_no_geom Create_func_no_geom::s_singleton;
-
-Item*
-Create_func_no_geom::create_func(THD * /* unused */,
- LEX_CSTRING /* unused */,
- List<Item> * /* unused */)
-{
- /* FIXME: error message can't be translated. */
- my_error(ER_FEATURE_DISABLED, MYF(0),
- sym_group_geom.name, sym_group_geom.needed_define);
- return NULL;
-}
-#endif
-
Item*
Create_qfunc::create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_list)
@@ -3710,39 +2795,6 @@ Create_func_aes_decrypt::create_2_arg(THD *thd, Item *arg1, Item *arg2)
}
-#ifdef HAVE_SPATIAL
-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(thd, arg1);
-}
-#endif
-
-
-#ifdef HAVE_SPATIAL
-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(thd, arg1);
-}
-#endif
-
-
-#ifdef HAVE_SPATIAL
-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(thd, arg1);
-}
-#endif
-
-
Create_func_asin Create_func_asin::s_singleton;
Item*
@@ -3854,16 +2906,6 @@ Create_func_ceiling::create_1_arg(THD *thd, Item *arg1)
}
-#ifdef HAVE_SPATIAL
-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(thd, arg1);
-}
-
-
Create_func_chr Create_func_chr::s_singleton;
Item*
@@ -3874,25 +2916,6 @@ Create_func_chr::create_1_arg(THD *thd, Item *arg1)
}
-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(thd, arg1);
-}
-
-
-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(thd, arg1);
-}
-#endif /*HAVE_SPATIAL*/
-
-
Create_func_char_length Create_func_char_length::s_singleton;
Item*
@@ -4050,28 +3073,6 @@ Create_func_connection_id::create_builder(THD *thd)
}
-#ifdef HAVE_SPATIAL
-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(thd, arg1, arg2,
- Item_func::SP_CONTAINS_FUNC);
-}
-
-
-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(thd, arg1, arg2,
- Item_func::SP_CONTAINS_FUNC);
-}
-#endif
-
-
Create_func_nvl2 Create_func_nvl2::s_singleton;
Item*
@@ -4125,19 +3126,6 @@ Create_func_crc32::create_1_arg(THD *thd, Item *arg1)
return new (thd->mem_root) Item_func_crc32(thd, arg1);
}
-
-#ifdef HAVE_SPATIAL
-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(thd, arg1, arg2,
- Item_func::SP_CROSSES_FUNC);
-}
-#endif
-
-
Create_func_datediff Create_func_datediff::s_singleton;
Item*
@@ -4270,48 +3258,6 @@ Create_func_des_encrypt::create_native(THD *thd, LEX_CSTRING *name,
}
-#ifdef HAVE_SPATIAL
-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(thd, arg1);
-}
-#endif
-
-
-#ifdef HAVE_SPATIAL
-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(thd, arg1, arg2,
- Item_func::SP_DISJOINT_FUNC);
-}
-
-
-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(thd, arg1, arg2,
- Item_func::SP_DISJOINT_FUNC);
-}
-
-
-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(thd, arg1, arg2);
-}
-#endif
-
-
Create_func_elt Create_func_elt::s_singleton;
Item*
@@ -4380,60 +3326,6 @@ Create_func_encrypt::create_native(THD *thd, LEX_CSTRING *name,
}
-#ifdef HAVE_SPATIAL
-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(thd, arg1,
- Item_func::SP_ENDPOINT);
-}
-#endif
-
-
-#ifdef HAVE_SPATIAL
-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(thd, arg1);
-}
-
-
-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(thd, arg1);
-}
-#endif
-
-
-#ifdef HAVE_SPATIAL
-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(thd, arg1, arg2,
- Item_func::SP_EQUALS_FUNC);
-}
-
-
-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(thd, arg1, arg2,
- Item_func::SP_EQUALS_FUNC);
-}
-#endif
-
-
Create_func_exp Create_func_exp::s_singleton;
Item*
@@ -4496,18 +3388,6 @@ Create_func_export_set::create_native(THD *thd, LEX_CSTRING *name,
}
-#ifdef HAVE_SPATIAL
-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(thd, arg1,
- Item_func::SP_EXTERIORRING);
-}
-#endif
-
-
Create_func_field Create_func_field::s_singleton;
Item*
@@ -4650,203 +3530,6 @@ Create_func_from_unixtime::create_native(THD *thd, LEX_CSTRING *name,
}
-#ifdef HAVE_SPATIAL
-Create_func_geometry_from_text Create_func_geometry_from_text::s_singleton;
-
-Item*
-Create_func_geometry_from_text::create_native(THD *thd, LEX_CSTRING *name,
- List<Item> *item_list)
-{
- Item *func= NULL;
- int arg_count= 0;
-
- if (item_list != NULL)
- arg_count= item_list->elements;
-
- switch (arg_count) {
- case 1:
- {
- Item *param_1= item_list->pop();
- func= new (thd->mem_root) Item_func_geometry_from_text(thd, param_1);
- thd->lex->uncacheable(UNCACHEABLE_RAND);
- break;
- }
- case 2:
- {
- Item *param_1= item_list->pop();
- Item *param_2= item_list->pop();
- func= new (thd->mem_root) Item_func_geometry_from_text(thd, param_1, param_2);
- break;
- }
- default:
- {
- my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name->str);
- break;
- }
- }
-
- return func;
-}
-#endif
-
-
-#ifdef HAVE_SPATIAL
-Create_func_geometry_from_wkb Create_func_geometry_from_wkb::s_singleton;
-
-Item*
-Create_func_geometry_from_wkb::create_native(THD *thd, LEX_CSTRING *name,
- List<Item> *item_list)
-{
- Item *func= NULL;
- int arg_count= 0;
-
- if (item_list != NULL)
- arg_count= item_list->elements;
-
- switch (arg_count) {
- case 1:
- {
- Item *param_1= item_list->pop();
- func= new (thd->mem_root) Item_func_geometry_from_wkb(thd, param_1);
- thd->lex->uncacheable(UNCACHEABLE_RAND);
- break;
- }
- case 2:
- {
- Item *param_1= item_list->pop();
- Item *param_2= item_list->pop();
- func= new (thd->mem_root) Item_func_geometry_from_wkb(thd, param_1, param_2);
- break;
- }
- default:
- {
- my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name->str);
- break;
- }
- }
-
- return func;
-}
-#endif
-
-
-#ifdef HAVE_SPATIAL
-Create_func_geometry_from_json Create_func_geometry_from_json::s_singleton;
-
-Item*
-Create_func_geometry_from_json::create_native(THD *thd, LEX_CSTRING *name,
- List<Item> *item_list)
-{
- Item *func= NULL;
- int arg_count= 0;
-
- if (item_list != NULL)
- arg_count= item_list->elements;
-
- switch (arg_count) {
- case 1:
- {
- Item *json= item_list->pop();
- func= new (thd->mem_root) Item_func_geometry_from_json(thd, json);
- thd->lex->uncacheable(UNCACHEABLE_RAND);
- break;
- }
- case 2:
- {
- Item *json= item_list->pop();
- Item *options= item_list->pop();
- func= new (thd->mem_root) Item_func_geometry_from_json(thd, json, options);
- break;
- }
- case 3:
- {
- Item *json= item_list->pop();
- Item *options= item_list->pop();
- Item *srid= item_list->pop();
- func= new (thd->mem_root) Item_func_geometry_from_json(thd, json, options,
- srid);
- break;
- }
- default:
- {
- my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name->str);
- break;
- }
- }
-
- return func;
-}
-
-
-Create_func_as_geojson Create_func_as_geojson::s_singleton;
-
-Item*
-Create_func_as_geojson::create_native(THD *thd, LEX_CSTRING *name,
- List<Item> *item_list)
-{
- Item *func= NULL;
- int arg_count= 0;
-
- if (item_list != NULL)
- arg_count= item_list->elements;
-
- switch (arg_count) {
- case 1:
- {
- Item *geom= item_list->pop();
- func= new (thd->mem_root) Item_func_as_geojson(thd, geom);
- thd->lex->uncacheable(UNCACHEABLE_RAND);
- break;
- }
- case 2:
- {
- Item *geom= item_list->pop();
- Item *max_dec= item_list->pop();
- func= new (thd->mem_root) Item_func_as_geojson(thd, geom, max_dec);
- break;
- }
- case 3:
- {
- Item *geom= item_list->pop();
- Item *max_dec= item_list->pop();
- Item *options= item_list->pop();
- func= new (thd->mem_root) Item_func_as_geojson(thd, geom, max_dec, options);
- break;
- }
- default:
- {
- my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name->str);
- break;
- }
- }
-
- return func;
-}
-#endif /*HAVE_SPATIAL*/
-
-
-#ifdef HAVE_SPATIAL
-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(thd, arg1);
-}
-#endif
-
-
-#ifdef HAVE_SPATIAL
-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(thd, arg1, arg2,
- Item_func::SP_GEOMETRYN);
-}
-#endif
-
Create_func_get_lock Create_func_get_lock::s_singleton;
@@ -4859,28 +3542,6 @@ Create_func_get_lock::create_2_arg(THD *thd, Item *arg1, Item *arg2)
}
-#if defined(HAVE_SPATIAL) && !defined(DBUG_OFF)
-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(thd, arg1);
-}
-#endif
-
-
-#ifdef HAVE_SPATIAL
-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(thd, arg1);
-}
-#endif
-
-
Create_func_greatest Create_func_greatest::s_singleton;
Item*
@@ -4920,78 +3581,6 @@ Create_func_ifnull::create_2_arg(THD *thd, Item *arg1, Item *arg2)
}
-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(thd, arg1);
-}
-
-
-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(thd, arg1);
-}
-
-
-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(thd, arg1);
-}
-
-
-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(thd, arg1);
-}
-
-
-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(thd, arg1);
-}
-
-
-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(thd, arg1);
-}
-
-
-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(thd, arg1);
-}
-
-
-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(thd, arg1);
-}
-
-
Create_func_instr Create_func_instr::s_singleton;
Item*
@@ -5001,98 +3590,6 @@ Create_func_instr::create_2_arg(THD *thd, Item *arg1, Item *arg2)
}
-#ifdef HAVE_SPATIAL
-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(thd, arg1, arg2,
- Item_func::SP_INTERIORRINGN);
-}
-#endif
-
-
-#ifdef HAVE_SPATIAL
-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_relate(thd, arg1, arg2, matrix);
-}
-
-
-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(thd, arg1, arg2,
- Item_func::SP_INTERSECTS_FUNC);
-}
-
-
-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(thd, arg1, arg2,
- Item_func::SP_INTERSECTS_FUNC);
-}
-
-
-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(thd, arg1, arg2,
- Gcalc_function::op_intersection);
-}
-
-
-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(thd, arg1, arg2,
- Gcalc_function::op_difference);
-}
-
-
-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(thd, arg1, arg2,
- Gcalc_function::op_union);
-}
-
-
-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(thd, arg1, arg2,
- Gcalc_function::op_symdifference);
-}
-
-
-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(thd, arg1, arg2);
-}
-#endif /*HAVE_SPATAI*/
-
-
Create_func_is_free_lock Create_func_is_free_lock::s_singleton;
Item*
@@ -5115,35 +3612,6 @@ Create_func_is_used_lock::create_1_arg(THD *thd, Item *arg1)
}
-#ifdef HAVE_SPATIAL
-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(thd, arg1);
-}
-
-
-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(thd, arg1);
-}
-
-
-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(thd, arg1);
-}
-#endif /*HAVE_SPATIAL*/
-
-
Create_func_isnull Create_func_isnull::s_singleton;
Item*
@@ -5153,17 +3621,6 @@ Create_func_isnull::create_1_arg(THD *thd, Item *arg1)
}
-#ifdef HAVE_SPATIAL
-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(thd, arg1);
-}
-#endif
-
-
Create_func_json_exists Create_func_json_exists::s_singleton;
Item*
@@ -6211,39 +4668,6 @@ Create_func_nullif::create_2_arg(THD *thd, Item *arg1, Item *arg2)
}
-#ifdef HAVE_SPATIAL
-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(thd, arg1);
-}
-#endif
-
-
-#ifdef HAVE_SPATIAL
-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(thd, arg1);
-}
-#endif
-
-
-#ifdef HAVE_SPATIAL
-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(thd, arg1);
-}
-#endif
-
-
Create_func_oct Create_func_oct::s_singleton;
Item*
@@ -6264,28 +4688,6 @@ Create_func_ord::create_1_arg(THD *thd, Item *arg1)
}
-#ifdef HAVE_SPATIAL
-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(thd, arg1, arg2,
- Item_func::SP_OVERLAPS_FUNC);
-}
-
-
-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(thd, arg1, arg2,
- Item_func::SP_OVERLAPS_FUNC);
-}
-#endif
-
-
Create_func_period_add Create_func_period_add::s_singleton;
Item*
@@ -6313,18 +4715,6 @@ Create_func_pi::create_builder(THD *thd)
}
-#ifdef HAVE_SPATIAL
-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(thd, arg1, arg2,
- Item_func::SP_POINTN);
-}
-#endif
-
-
Create_func_pow Create_func_pow::s_singleton;
Item*
@@ -6663,29 +5053,6 @@ Create_func_sqrt::create_1_arg(THD *thd, Item *arg1)
}
-#ifdef HAVE_SPATIAL
-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(thd, arg1);
-}
-#endif
-
-
-#ifdef HAVE_SPATIAL
-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(thd, arg1,
- Item_func::SP_STARTPOINT);
-}
-#endif
-
-
Create_func_str_to_date Create_func_str_to_date::s_singleton;
Item*
@@ -6819,18 +5186,6 @@ Create_func_to_seconds::create_1_arg(THD *thd, Item *arg1)
}
-#ifdef HAVE_SPATIAL
-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(thd, arg1, arg2,
- Item_func::SP_TOUCHES_FUNC);
-}
-#endif
-
-
Create_func_ucase Create_func_ucase::s_singleton;
Item*
@@ -6933,9 +5288,9 @@ 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(thd, "version()",
- server_version,
- (uint) strlen(server_version),
+ static Lex_cstring name(STRING_WITH_LEN("version()"));
+ return new (thd->mem_root) Item_static_string_func(thd, name,
+ Lex_cstring_strlen(server_version),
system_charset_info,
DERIVATION_SYSCONST);
}
@@ -6960,27 +5315,6 @@ Create_func_weekofyear::create_1_arg(THD *thd, Item *arg1)
}
-#ifdef HAVE_SPATIAL
-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(thd, arg1, arg2,
- Item_func::SP_WITHIN_FUNC);
-}
-
-
-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(thd, arg1, arg2,
- Item_func::SP_WITHIN_FUNC);
-}
-#endif
-
#ifdef WITH_WSREP
Create_func_wsrep_last_written_gtid
Create_func_wsrep_last_written_gtid::s_singleton;
@@ -7039,17 +5373,6 @@ Create_func_wsrep_sync_wait_upto::create_native(THD *thd,
}
#endif /* WITH_WSREP */
-#ifdef HAVE_SPATIAL
-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(thd, arg1);
-}
-#endif
-
-
Create_func_xml_extractvalue Create_func_xml_extractvalue::s_singleton;
Item*
@@ -7068,17 +5391,6 @@ Create_func_xml_update::create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *arg
}
-#ifdef HAVE_SPATIAL
-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(thd, arg1);
-}
-#endif
-
-
Create_func_year_week Create_func_year_week::s_singleton;
Item*
@@ -7119,12 +5431,6 @@ Create_func_year_week::create_native(THD *thd, LEX_CSTRING *name,
#define BUILDER(F) & F::s_singleton
-#ifdef HAVE_SPATIAL
- #define GEOM_BUILDER(F) & F::s_singleton
-#else
- #define GEOM_BUILDER(F) & Create_func_no_geom::s_singleton
-#endif
-
/*
MySQL native functions.
MAINTAINER:
@@ -7143,12 +5449,7 @@ static Native_func_registry func_array[] =
{ { STRING_WITH_LEN("ADDTIME") }, BUILDER(Create_func_addtime)},
{ { STRING_WITH_LEN("AES_DECRYPT") }, BUILDER(Create_func_aes_decrypt)},
{ { STRING_WITH_LEN("AES_ENCRYPT") }, BUILDER(Create_func_aes_encrypt)},
- { { STRING_WITH_LEN("AREA") }, GEOM_BUILDER(Create_func_area)},
- { { STRING_WITH_LEN("ASBINARY") }, GEOM_BUILDER(Create_func_as_wkb)},
{ { STRING_WITH_LEN("ASIN") }, BUILDER(Create_func_asin)},
- { { STRING_WITH_LEN("ASTEXT") }, GEOM_BUILDER(Create_func_as_wkt)},
- { { STRING_WITH_LEN("ASWKB") }, GEOM_BUILDER(Create_func_as_wkb)},
- { { STRING_WITH_LEN("ASWKT") }, GEOM_BUILDER(Create_func_as_wkt)},
{ { STRING_WITH_LEN("ATAN") }, BUILDER(Create_func_atan)},
{ { STRING_WITH_LEN("ATAN2") }, BUILDER(Create_func_atan)},
{ { STRING_WITH_LEN("BENCHMARK") }, BUILDER(Create_func_benchmark)},
@@ -7156,11 +5457,8 @@ static Native_func_registry func_array[] =
{ { STRING_WITH_LEN("BINLOG_GTID_POS") }, BUILDER(Create_func_binlog_gtid_pos)},
{ { STRING_WITH_LEN("BIT_COUNT") }, BUILDER(Create_func_bit_count)},
{ { STRING_WITH_LEN("BIT_LENGTH") }, BUILDER(Create_func_bit_length)},
- { { STRING_WITH_LEN("BOUNDARY") }, GEOM_BUILDER(Create_func_boundary)},
- { { STRING_WITH_LEN("BUFFER") }, GEOM_BUILDER(Create_func_buffer)},
{ { STRING_WITH_LEN("CEIL") }, BUILDER(Create_func_ceiling)},
{ { STRING_WITH_LEN("CEILING") }, BUILDER(Create_func_ceiling)},
- { { STRING_WITH_LEN("CENTROID") }, GEOM_BUILDER(Create_func_centroid)},
{ { STRING_WITH_LEN("CHARACTER_LENGTH") }, BUILDER(Create_func_char_length)},
{ { STRING_WITH_LEN("CHAR_LENGTH") }, BUILDER(Create_func_char_length)},
{ { STRING_WITH_LEN("CHR") }, BUILDER(Create_func_chr)},
@@ -7176,11 +5474,9 @@ static Native_func_registry func_array[] =
{ { STRING_WITH_LEN("CONNECTION_ID") }, BUILDER(Create_func_connection_id)},
{ { STRING_WITH_LEN("CONV") }, BUILDER(Create_func_conv)},
{ { STRING_WITH_LEN("CONVERT_TZ") }, BUILDER(Create_func_convert_tz)},
- { { STRING_WITH_LEN("CONVEXHULL") }, GEOM_BUILDER(Create_func_convexhull)},
{ { STRING_WITH_LEN("COS") }, BUILDER(Create_func_cos)},
{ { STRING_WITH_LEN("COT") }, BUILDER(Create_func_cot)},
{ { STRING_WITH_LEN("CRC32") }, BUILDER(Create_func_crc32)},
- { { STRING_WITH_LEN("CROSSES") }, GEOM_BUILDER(Create_func_crosses)},
{ { STRING_WITH_LEN("DATEDIFF") }, BUILDER(Create_func_datediff)},
{ { STRING_WITH_LEN("DAYNAME") }, BUILDER(Create_func_dayname)},
{ { STRING_WITH_LEN("DAYOFMONTH") }, BUILDER(Create_func_dayofmonth)},
@@ -7191,17 +5487,11 @@ static Native_func_registry func_array[] =
{ { STRING_WITH_LEN("DECODE_ORACLE") }, BUILDER(Create_func_decode_oracle)},
{ { STRING_WITH_LEN("DES_DECRYPT") }, BUILDER(Create_func_des_decrypt)},
{ { STRING_WITH_LEN("DES_ENCRYPT") }, BUILDER(Create_func_des_encrypt)},
- { { STRING_WITH_LEN("DIMENSION") }, GEOM_BUILDER(Create_func_dimension)},
- { { STRING_WITH_LEN("DISJOINT") }, GEOM_BUILDER(Create_func_mbr_disjoint)},
{ { STRING_WITH_LEN("ELT") }, BUILDER(Create_func_elt)},
{ { STRING_WITH_LEN("ENCODE") }, BUILDER(Create_func_encode)},
{ { STRING_WITH_LEN("ENCRYPT") }, BUILDER(Create_func_encrypt)},
- { { STRING_WITH_LEN("ENDPOINT") }, GEOM_BUILDER(Create_func_endpoint)},
- { { STRING_WITH_LEN("ENVELOPE") }, GEOM_BUILDER(Create_func_envelope)},
- { { STRING_WITH_LEN("EQUALS") }, GEOM_BUILDER(Create_func_equals)},
{ { STRING_WITH_LEN("EXP") }, BUILDER(Create_func_exp)},
{ { STRING_WITH_LEN("EXPORT_SET") }, BUILDER(Create_func_export_set)},
- { { STRING_WITH_LEN("EXTERIORRING") }, GEOM_BUILDER(Create_func_exteriorring)},
{ { STRING_WITH_LEN("EXTRACTVALUE") }, BUILDER(Create_func_xml_extractvalue)},
{ { STRING_WITH_LEN("FIELD") }, BUILDER(Create_func_field)},
{ { STRING_WITH_LEN("FIND_IN_SET") }, BUILDER(Create_func_find_in_set)},
@@ -7211,37 +5501,12 @@ static Native_func_registry func_array[] =
{ { STRING_WITH_LEN("FROM_BASE64") }, BUILDER(Create_func_from_base64)},
{ { STRING_WITH_LEN("FROM_DAYS") }, BUILDER(Create_func_from_days)},
{ { STRING_WITH_LEN("FROM_UNIXTIME") }, BUILDER(Create_func_from_unixtime)},
- { { STRING_WITH_LEN("GEOMCOLLFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
- { { STRING_WITH_LEN("GEOMCOLLFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
- { { STRING_WITH_LEN("GEOMETRYCOLLECTIONFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
- { { STRING_WITH_LEN("GEOMETRYCOLLECTIONFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
- { { STRING_WITH_LEN("GEOMETRYFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
- { { STRING_WITH_LEN("GEOMETRYFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
- { { STRING_WITH_LEN("GEOMETRYN") }, GEOM_BUILDER(Create_func_geometryn)},
- { { STRING_WITH_LEN("GEOMETRYTYPE") }, GEOM_BUILDER(Create_func_geometry_type)},
- { { STRING_WITH_LEN("GEOMFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
- { { STRING_WITH_LEN("GEOMFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
{ { STRING_WITH_LEN("GET_LOCK") }, BUILDER(Create_func_get_lock)},
- { { STRING_WITH_LEN("GLENGTH") }, GEOM_BUILDER(Create_func_glength)},
{ { STRING_WITH_LEN("GREATEST") }, BUILDER(Create_func_greatest)},
{ { STRING_WITH_LEN("HEX") }, BUILDER(Create_func_hex)},
{ { STRING_WITH_LEN("IFNULL") }, BUILDER(Create_func_ifnull)},
- { { STRING_WITH_LEN("INET_ATON") }, BUILDER(Create_func_inet_aton)},
- { { STRING_WITH_LEN("INET_NTOA") }, BUILDER(Create_func_inet_ntoa)},
- { { STRING_WITH_LEN("INET6_ATON") }, BUILDER(Create_func_inet6_aton)},
- { { STRING_WITH_LEN("INET6_NTOA") }, BUILDER(Create_func_inet6_ntoa)},
- { { STRING_WITH_LEN("IS_IPV4") }, BUILDER(Create_func_is_ipv4)},
- { { STRING_WITH_LEN("IS_IPV6") }, BUILDER(Create_func_is_ipv6)},
- { { STRING_WITH_LEN("IS_IPV4_COMPAT") }, BUILDER(Create_func_is_ipv4_compat)},
- { { STRING_WITH_LEN("IS_IPV4_MAPPED") }, BUILDER(Create_func_is_ipv4_mapped)},
{ { STRING_WITH_LEN("INSTR") }, BUILDER(Create_func_instr)},
- { { STRING_WITH_LEN("INTERIORRINGN") }, GEOM_BUILDER(Create_func_interiorringn)},
- { { STRING_WITH_LEN("INTERSECTS") }, GEOM_BUILDER(Create_func_mbr_intersects)},
- { { STRING_WITH_LEN("ISCLOSED") }, GEOM_BUILDER(Create_func_isclosed)},
- { { STRING_WITH_LEN("ISEMPTY") }, GEOM_BUILDER(Create_func_isempty)},
{ { STRING_WITH_LEN("ISNULL") }, BUILDER(Create_func_isnull)},
- { { STRING_WITH_LEN("ISRING") }, GEOM_BUILDER(Create_func_isring)},
- { { STRING_WITH_LEN("ISSIMPLE") }, GEOM_BUILDER(Create_func_issimple)},
{ { STRING_WITH_LEN("IS_FREE_LOCK") }, BUILDER(Create_func_is_free_lock)},
{ { STRING_WITH_LEN("IS_USED_LOCK") }, BUILDER(Create_func_is_used_lock)},
{ { STRING_WITH_LEN("JSON_ARRAY") }, BUILDER(Create_func_json_array)},
@@ -7282,10 +5547,6 @@ static Native_func_registry func_array[] =
{ { STRING_WITH_LEN("LIKE_RANGE_MIN") }, BUILDER(Create_func_like_range_min)},
{ { STRING_WITH_LEN("LIKE_RANGE_MAX") }, BUILDER(Create_func_like_range_max)},
#endif
- { { STRING_WITH_LEN("LINEFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
- { { STRING_WITH_LEN("LINEFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
- { { STRING_WITH_LEN("LINESTRINGFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
- { { STRING_WITH_LEN("LINESTRINGFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
{ { STRING_WITH_LEN("LN") }, BUILDER(Create_func_ln)},
{ { STRING_WITH_LEN("LOAD_FILE") }, BUILDER(Create_func_load_file)},
{ { STRING_WITH_LEN("LOCATE") }, BUILDER(Create_func_locate)},
@@ -7302,50 +5563,18 @@ static Native_func_registry func_array[] =
{ { STRING_WITH_LEN("MAKE_SET") }, BUILDER(Create_func_make_set)},
{ { STRING_WITH_LEN("MASTER_GTID_WAIT") }, BUILDER(Create_func_master_gtid_wait)},
{ { STRING_WITH_LEN("MASTER_POS_WAIT") }, BUILDER(Create_func_master_pos_wait)},
- { { STRING_WITH_LEN("MBRCONTAINS") }, GEOM_BUILDER(Create_func_mbr_contains)},
- { { STRING_WITH_LEN("MBRDISJOINT") }, GEOM_BUILDER(Create_func_mbr_disjoint)},
- { { STRING_WITH_LEN("MBREQUAL") }, GEOM_BUILDER(Create_func_mbr_equals)},
- { { STRING_WITH_LEN("MBREQUALS") }, GEOM_BUILDER(Create_func_mbr_equals)},
- { { STRING_WITH_LEN("MBRINTERSECTS") }, GEOM_BUILDER(Create_func_mbr_intersects)},
- { { STRING_WITH_LEN("MBROVERLAPS") }, GEOM_BUILDER(Create_func_mbr_overlaps)},
- { { STRING_WITH_LEN("MBRTOUCHES") }, GEOM_BUILDER(Create_func_touches)},
- { { STRING_WITH_LEN("MBRWITHIN") }, GEOM_BUILDER(Create_func_mbr_within)},
{ { STRING_WITH_LEN("MD5") }, BUILDER(Create_func_md5)},
- { { STRING_WITH_LEN("MLINEFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
- { { STRING_WITH_LEN("MLINEFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
{ { STRING_WITH_LEN("MONTHNAME") }, BUILDER(Create_func_monthname)},
- { { STRING_WITH_LEN("MPOINTFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
- { { STRING_WITH_LEN("MPOINTFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
- { { STRING_WITH_LEN("MPOLYFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
- { { STRING_WITH_LEN("MPOLYFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
- { { STRING_WITH_LEN("MULTILINESTRINGFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
- { { STRING_WITH_LEN("MULTILINESTRINGFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
- { { STRING_WITH_LEN("MULTIPOINTFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
- { { STRING_WITH_LEN("MULTIPOINTFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
- { { STRING_WITH_LEN("MULTIPOLYGONFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
- { { STRING_WITH_LEN("MULTIPOLYGONFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
{ { STRING_WITH_LEN("NAME_CONST") }, BUILDER(Create_func_name_const)},
{ { STRING_WITH_LEN("NVL") }, BUILDER(Create_func_ifnull)},
{ { STRING_WITH_LEN("NVL2") }, BUILDER(Create_func_nvl2)},
{ { STRING_WITH_LEN("NULLIF") }, BUILDER(Create_func_nullif)},
- { { STRING_WITH_LEN("NUMGEOMETRIES") }, GEOM_BUILDER(Create_func_numgeometries)},
- { { STRING_WITH_LEN("NUMINTERIORRINGS") }, GEOM_BUILDER(Create_func_numinteriorring)},
- { { STRING_WITH_LEN("NUMPOINTS") }, GEOM_BUILDER(Create_func_numpoints)},
{ { STRING_WITH_LEN("OCT") }, BUILDER(Create_func_oct)},
{ { STRING_WITH_LEN("OCTET_LENGTH") }, BUILDER(Create_func_octet_length)},
{ { STRING_WITH_LEN("ORD") }, BUILDER(Create_func_ord)},
- { { STRING_WITH_LEN("OVERLAPS") }, GEOM_BUILDER(Create_func_mbr_overlaps)},
{ { STRING_WITH_LEN("PERIOD_ADD") }, BUILDER(Create_func_period_add)},
{ { STRING_WITH_LEN("PERIOD_DIFF") }, BUILDER(Create_func_period_diff)},
{ { STRING_WITH_LEN("PI") }, BUILDER(Create_func_pi)},
- { { STRING_WITH_LEN("POINTFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
- { { STRING_WITH_LEN("POINTFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
- { { STRING_WITH_LEN("POINTN") }, GEOM_BUILDER(Create_func_pointn)},
- { { STRING_WITH_LEN("POINTONSURFACE") }, GEOM_BUILDER(Create_func_pointonsurface)},
- { { STRING_WITH_LEN("POLYFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
- { { STRING_WITH_LEN("POLYFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
- { { STRING_WITH_LEN("POLYGONFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
- { { STRING_WITH_LEN("POLYGONFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
{ { STRING_WITH_LEN("POW") }, BUILDER(Create_func_pow)},
{ { STRING_WITH_LEN("POWER") }, BUILDER(Create_func_pow)},
{ { STRING_WITH_LEN("QUOTE") }, BUILDER(Create_func_quote)},
@@ -7373,90 +5602,8 @@ static Native_func_registry func_array[] =
{ { STRING_WITH_LEN("SOUNDEX") }, BUILDER(Create_func_soundex)},
{ { STRING_WITH_LEN("SPACE") }, BUILDER(Create_func_space)},
{ { STRING_WITH_LEN("SQRT") }, BUILDER(Create_func_sqrt)},
- { { STRING_WITH_LEN("SRID") }, GEOM_BUILDER(Create_func_srid)},
- { { STRING_WITH_LEN("STARTPOINT") }, GEOM_BUILDER(Create_func_startpoint)},
{ { STRING_WITH_LEN("STRCMP") }, BUILDER(Create_func_strcmp)},
{ { STRING_WITH_LEN("STR_TO_DATE") }, BUILDER(Create_func_str_to_date)},
- { { STRING_WITH_LEN("ST_AREA") }, GEOM_BUILDER(Create_func_area)},
- { { STRING_WITH_LEN("ST_ASBINARY") }, GEOM_BUILDER(Create_func_as_wkb)},
- { { STRING_WITH_LEN("ST_ASGEOJSON") }, GEOM_BUILDER(Create_func_as_geojson)},
- { { STRING_WITH_LEN("ST_ASTEXT") }, GEOM_BUILDER(Create_func_as_wkt)},
- { { STRING_WITH_LEN("ST_ASWKB") }, GEOM_BUILDER(Create_func_as_wkb)},
- { { STRING_WITH_LEN("ST_ASWKT") }, GEOM_BUILDER(Create_func_as_wkt)},
- { { STRING_WITH_LEN("ST_BOUNDARY") }, GEOM_BUILDER(Create_func_boundary)},
- { { STRING_WITH_LEN("ST_BUFFER") }, GEOM_BUILDER(Create_func_buffer)},
- { { STRING_WITH_LEN("ST_CENTROID") }, GEOM_BUILDER(Create_func_centroid)},
- { { STRING_WITH_LEN("ST_CONTAINS") }, GEOM_BUILDER(Create_func_contains)},
- { { STRING_WITH_LEN("ST_CONVEXHULL") }, GEOM_BUILDER(Create_func_convexhull)},
- { { STRING_WITH_LEN("ST_CROSSES") }, GEOM_BUILDER(Create_func_crosses)},
- { { STRING_WITH_LEN("ST_DIFFERENCE") }, GEOM_BUILDER(Create_func_difference)},
- { { STRING_WITH_LEN("ST_DIMENSION") }, GEOM_BUILDER(Create_func_dimension)},
- { { STRING_WITH_LEN("ST_DISJOINT") }, GEOM_BUILDER(Create_func_disjoint)},
- { { STRING_WITH_LEN("ST_DISTANCE") }, GEOM_BUILDER(Create_func_distance)},
- { { STRING_WITH_LEN("ST_ENDPOINT") }, GEOM_BUILDER(Create_func_endpoint)},
- { { STRING_WITH_LEN("ST_ENVELOPE") }, GEOM_BUILDER(Create_func_envelope)},
- { { STRING_WITH_LEN("ST_EQUALS") }, GEOM_BUILDER(Create_func_equals)},
- { { STRING_WITH_LEN("ST_EXTERIORRING") }, GEOM_BUILDER(Create_func_exteriorring)},
- { { STRING_WITH_LEN("ST_GEOMCOLLFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
- { { STRING_WITH_LEN("ST_GEOMCOLLFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
- { { STRING_WITH_LEN("ST_GEOMETRYCOLLECTIONFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
- { { STRING_WITH_LEN("ST_GEOMETRYCOLLECTIONFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
- { { STRING_WITH_LEN("ST_GEOMETRYFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
- { { STRING_WITH_LEN("ST_GEOMETRYFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
- { { STRING_WITH_LEN("ST_GEOMETRYN") }, GEOM_BUILDER(Create_func_geometryn)},
- { { STRING_WITH_LEN("ST_GEOMETRYTYPE") }, GEOM_BUILDER(Create_func_geometry_type)},
- { { STRING_WITH_LEN("ST_GEOMFROMGEOJSON") }, GEOM_BUILDER(Create_func_geometry_from_json)},
- { { STRING_WITH_LEN("ST_GEOMFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
- { { STRING_WITH_LEN("ST_GEOMFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
-#ifndef DBUG_OFF
- { { STRING_WITH_LEN("ST_GIS_DEBUG") }, GEOM_BUILDER(Create_func_gis_debug)},
-#endif
- { { STRING_WITH_LEN("ST_EQUALS") }, GEOM_BUILDER(Create_func_equals)},
- { { STRING_WITH_LEN("ST_INTERIORRINGN") }, GEOM_BUILDER(Create_func_interiorringn)},
- { { STRING_WITH_LEN("ST_INTERSECTS") }, GEOM_BUILDER(Create_func_intersects)},
- { { STRING_WITH_LEN("ST_INTERSECTION") }, GEOM_BUILDER(Create_func_intersection)},
- { { STRING_WITH_LEN("ST_ISCLOSED") }, GEOM_BUILDER(Create_func_isclosed)},
- { { STRING_WITH_LEN("ST_ISEMPTY") }, GEOM_BUILDER(Create_func_isempty)},
- { { STRING_WITH_LEN("ST_ISRING") }, GEOM_BUILDER(Create_func_isring)},
- { { STRING_WITH_LEN("ST_ISSIMPLE") }, GEOM_BUILDER(Create_func_issimple)},
- { { STRING_WITH_LEN("ST_LENGTH") }, GEOM_BUILDER(Create_func_glength)},
- { { STRING_WITH_LEN("ST_LINEFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
- { { STRING_WITH_LEN("ST_LINEFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
- { { STRING_WITH_LEN("ST_LINESTRINGFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
- { { STRING_WITH_LEN("ST_LINESTRINGFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
- { { STRING_WITH_LEN("ST_MLINEFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
- { { STRING_WITH_LEN("ST_MLINEFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
- { { STRING_WITH_LEN("ST_MPOINTFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
- { { STRING_WITH_LEN("ST_MPOINTFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
- { { STRING_WITH_LEN("ST_MPOLYFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
- { { STRING_WITH_LEN("ST_MPOLYFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
- { { STRING_WITH_LEN("ST_MULTILINESTRINGFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
- { { STRING_WITH_LEN("ST_MULTILINESTRINGFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
- { { STRING_WITH_LEN("ST_MULTIPOINTFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
- { { STRING_WITH_LEN("ST_MULTIPOINTFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
- { { STRING_WITH_LEN("ST_MULTIPOLYGONFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
- { { STRING_WITH_LEN("ST_MULTIPOLYGONFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
- { { STRING_WITH_LEN("ST_NUMGEOMETRIES") }, GEOM_BUILDER(Create_func_numgeometries)},
- { { STRING_WITH_LEN("ST_NUMINTERIORRINGS") }, GEOM_BUILDER(Create_func_numinteriorring)},
- { { STRING_WITH_LEN("ST_NUMPOINTS") }, GEOM_BUILDER(Create_func_numpoints)},
- { { STRING_WITH_LEN("ST_OVERLAPS") }, GEOM_BUILDER(Create_func_overlaps)},
- { { STRING_WITH_LEN("ST_POINTFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
- { { STRING_WITH_LEN("ST_POINTFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
- { { STRING_WITH_LEN("ST_POINTN") }, GEOM_BUILDER(Create_func_pointn)},
- { { STRING_WITH_LEN("ST_POINTONSURFACE") }, GEOM_BUILDER(Create_func_pointonsurface)},
- { { STRING_WITH_LEN("ST_POLYFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
- { { STRING_WITH_LEN("ST_POLYFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
- { { STRING_WITH_LEN("ST_POLYGONFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
- { { STRING_WITH_LEN("ST_POLYGONFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
- { { STRING_WITH_LEN("ST_RELATE") }, GEOM_BUILDER(Create_func_relate)},
- { { STRING_WITH_LEN("ST_SRID") }, GEOM_BUILDER(Create_func_srid)},
- { { STRING_WITH_LEN("ST_STARTPOINT") }, GEOM_BUILDER(Create_func_startpoint)},
- { { STRING_WITH_LEN("ST_SYMDIFFERENCE") }, GEOM_BUILDER(Create_func_symdifference)},
- { { STRING_WITH_LEN("ST_TOUCHES") }, GEOM_BUILDER(Create_func_touches)},
- { { STRING_WITH_LEN("ST_UNION") }, GEOM_BUILDER(Create_func_union)},
- { { STRING_WITH_LEN("ST_WITHIN") }, GEOM_BUILDER(Create_func_within)},
- { { STRING_WITH_LEN("ST_X") }, GEOM_BUILDER(Create_func_x)},
- { { STRING_WITH_LEN("ST_Y") }, GEOM_BUILDER(Create_func_y)},
{ { STRING_WITH_LEN("SUBSTR_ORACLE") },
BUILDER(Create_func_substr_oracle)},
{ { STRING_WITH_LEN("SUBSTRING_INDEX") }, BUILDER(Create_func_substr_index)},
@@ -7465,7 +5612,6 @@ static Native_func_registry func_array[] =
{ { STRING_WITH_LEN("TIMEDIFF") }, BUILDER(Create_func_timediff)},
{ { STRING_WITH_LEN("TIME_FORMAT") }, BUILDER(Create_func_time_format)},
{ { STRING_WITH_LEN("TIME_TO_SEC") }, BUILDER(Create_func_time_to_sec)},
- { { STRING_WITH_LEN("TOUCHES") }, GEOM_BUILDER(Create_func_touches)},
{ { STRING_WITH_LEN("TO_BASE64") }, BUILDER(Create_func_to_base64)},
{ { STRING_WITH_LEN("TO_DAYS") }, BUILDER(Create_func_to_days)},
{ { STRING_WITH_LEN("TO_SECONDS") }, BUILDER(Create_func_to_seconds)},
@@ -7481,14 +5627,11 @@ static Native_func_registry func_array[] =
{ { STRING_WITH_LEN("VERSION") }, BUILDER(Create_func_version)},
{ { STRING_WITH_LEN("WEEKDAY") }, BUILDER(Create_func_weekday)},
{ { STRING_WITH_LEN("WEEKOFYEAR") }, BUILDER(Create_func_weekofyear)},
- { { STRING_WITH_LEN("WITHIN") }, GEOM_BUILDER(Create_func_within)},
#ifdef WITH_WSREP
{ { STRING_WITH_LEN("WSREP_LAST_WRITTEN_GTID") }, BUILDER(Create_func_wsrep_last_written_gtid)},
{ { STRING_WITH_LEN("WSREP_LAST_SEEN_GTID") }, BUILDER(Create_func_wsrep_last_seen_gtid)},
{ { STRING_WITH_LEN("WSREP_SYNC_WAIT_UPTO_GTID") }, BUILDER(Create_func_wsrep_sync_wait_upto)},
#endif /* WITH_WSREP */
- { { STRING_WITH_LEN("X") }, GEOM_BUILDER(Create_func_x)},
- { { STRING_WITH_LEN("Y") }, GEOM_BUILDER(Create_func_y)},
{ { STRING_WITH_LEN("YEARWEEK") }, BUILDER(Create_func_year_week)},
{ {0, 0}, NULL}
@@ -7496,15 +5639,6 @@ static Native_func_registry func_array[] =
static HASH native_functions_hash;
-extern "C" uchar*
-get_native_fct_hash_key(const uchar *buff, size_t *length,
- my_bool /* unused */)
-{
- Native_func_registry *func= (Native_func_registry*) buff;
- *length= func->name.length;
- return (uchar*) func->name.str;
-}
-
/*
Load the hash table for native functions.
Note: this code is not thread safe, and is intended to be used at server
@@ -7525,7 +5659,15 @@ int item_create_init()
MYF(0)))
DBUG_RETURN(1);
- DBUG_RETURN(item_create_append(func_array));
+ if (item_create_append(func_array))
+ DBUG_RETURN(1);
+
+#ifdef HAVE_SPATIAL
+ if (plugin_function_collection_geometry.init())
+ DBUG_RETURN(1);
+#endif
+
+ DBUG_RETURN(0);
}
int item_create_append(Native_func_registry array[])
@@ -7562,6 +5704,9 @@ void item_create_cleanup()
{
DBUG_ENTER("item_create_cleanup");
my_hash_free(& native_functions_hash);
+#ifdef HAVE_SPATIAL
+ plugin_function_collection_geometry.deinit();
+#endif
DBUG_VOID_RETURN;
}
@@ -7576,10 +5721,17 @@ find_native_function_builder(THD *thd, const LEX_CSTRING *name)
(uchar*) name->str,
name->length);
- if (func)
- {
- builder= func->builder;
- }
+ if (func && (builder= func->builder))
+ return builder;
+
+ if ((builder= Plugin_find_native_func_builder_param(*name).find(thd)))
+ return builder;
+
+#ifdef HAVE_SPATIAL
+ if (!builder)
+ builder= plugin_function_collection_geometry.
+ find_native_function_builder(thd, *name);
+#endif
return builder;
}
diff --git a/sql/item_create.h b/sql/item_create.h
index 5890e8ad057..3cbf8a70181 100644
--- a/sql/item_create.h
+++ b/sql/item_create.h
@@ -69,6 +69,111 @@ protected:
/**
+ Adapter for functions that takes exactly zero arguments.
+*/
+
+class Create_func_arg0 : public Create_func
+{
+public:
+ virtual Item *create_func(THD *thd, LEX_CSTRING *name,
+ List<Item> *item_list);
+
+ /**
+ Builder method, with no arguments.
+ @param thd The current thread
+ @return An item representing the function call
+ */
+ virtual Item *create_builder(THD *thd) = 0;
+
+protected:
+ /** Constructor. */
+ Create_func_arg0() {}
+ /** Destructor. */
+ virtual ~Create_func_arg0() {}
+};
+
+
+/**
+ Adapter for functions that takes exactly one argument.
+*/
+
+class Create_func_arg1 : public Create_func
+{
+public:
+ virtual Item *create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+
+ /**
+ Builder method, with one argument.
+ @param thd The current thread
+ @param arg1 The first argument of the function
+ @return An item representing the function call
+ */
+ virtual Item *create_1_arg(THD *thd, Item *arg1) = 0;
+
+protected:
+ /** Constructor. */
+ Create_func_arg1() {}
+ /** Destructor. */
+ virtual ~Create_func_arg1() {}
+};
+
+
+/**
+ Adapter for functions that takes exactly two arguments.
+*/
+
+class Create_func_arg2 : public Create_func
+{
+public:
+ virtual Item *create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+
+ /**
+ Builder method, with two arguments.
+ @param thd The current thread
+ @param arg1 The first argument of the function
+ @param arg2 The second argument of the function
+ @return An item representing the function call
+ */
+ virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) = 0;
+
+protected:
+ /** Constructor. */
+ Create_func_arg2() {}
+ /** Destructor. */
+ virtual ~Create_func_arg2() {}
+};
+
+
+/**
+ Adapter for functions that takes exactly three arguments.
+*/
+
+class Create_func_arg3 : public Create_func
+{
+public:
+ virtual Item *create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+
+ /**
+ Builder method, with three arguments.
+ @param thd The current thread
+ @param arg1 The first argument of the function
+ @param arg2 The second argument of the function
+ @param arg3 The third argument of the function
+ @return An item representing the function call
+ */
+ virtual Item *create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *arg3) = 0;
+
+protected:
+ /** Constructor. */
+ Create_func_arg3() {}
+ /** Destructor. */
+ virtual ~Create_func_arg3() {}
+};
+
+
+
+
+/**
Adapter for native functions with a variable number of arguments.
The main use of this class is to discard the following calls:
<code>foo(expr1 AS name1, expr2 AS name2, ...)</code>
diff --git a/sql/item_func.cc b/sql/item_func.cc
index e66fe12c57f..2e4a813990f 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -404,6 +404,25 @@ Item_func::eval_not_null_tables(void *opt_arg)
}
+bool
+Item_func::find_not_null_fields(table_map allowed)
+{
+ if (~allowed & used_tables())
+ return false;
+
+ Item **arg,**arg_end;
+ if (arg_count)
+ {
+ for (arg=args, arg_end=args+arg_count; arg != arg_end ; arg++)
+ {
+ if (!(*arg)->find_not_null_fields(allowed))
+ continue;
+ }
+ }
+ return false;
+}
+
+
void Item_func::fix_after_pullout(st_select_lex *new_parent, Item **ref,
bool merge)
{
@@ -656,16 +675,6 @@ bool Item_func::is_expensive_processor(uchar *arg)
}
*/
-my_decimal *Item_func::val_decimal(my_decimal *decimal_value)
-{
- DBUG_ASSERT(fixed);
- longlong nr= val_int();
- if (null_value)
- return 0; /* purecov: inspected */
- int2my_decimal(E_DEC_FATAL_ERROR, nr, unsigned_flag, decimal_value);
- return decimal_value;
-}
-
bool Item_hybrid_func::fix_attributes(Item **items, uint nitems)
{
@@ -1207,7 +1216,10 @@ void Item_func_minus::fix_unsigned_flag()
{
if (unsigned_flag &&
(current_thd->variables.sql_mode & MODE_NO_UNSIGNED_SUBTRACTION))
+ {
unsigned_flag=0;
+ set_handler(Item_func_minus::type_handler()->type_handler_signed());
+ }
}
@@ -1841,7 +1853,7 @@ void Item_func_neg::fix_length_and_dec_int()
Ensure that result is converted to DECIMAL, as longlong can't hold
the negated number
*/
- set_handler_by_result_type(DECIMAL_RESULT);
+ set_handler(&type_handler_newdecimal);
DBUG_PRINT("info", ("Type changed: DECIMAL_RESULT"));
}
}
@@ -4478,8 +4490,10 @@ bool Item_func_set_user_var::fix_fields(THD *thd, Item **ref)
null_item= (args[0]->type() == NULL_ITEM);
if (!m_var_entry->charset() || !null_item)
m_var_entry->set_charset(args[0]->collation.derivation == DERIVATION_NUMERIC ?
- default_charset() : args[0]->collation.collation);
- collation.set(m_var_entry->charset(), DERIVATION_IMPLICIT);
+ &my_charset_numeric : args[0]->collation.collation);
+ collation.set(m_var_entry->charset(),
+ args[0]->collation.derivation == DERIVATION_NUMERIC ?
+ DERIVATION_NUMERIC : DERIVATION_IMPLICIT);
switch (args[0]->result_type()) {
case STRING_RESULT:
case TIME_RESULT:
@@ -4491,7 +4505,8 @@ bool Item_func_set_user_var::fix_fields(THD *thd, Item **ref)
set_handler(&type_handler_double);
break;
case INT_RESULT:
- set_handler(Type_handler::type_handler_long_or_longlong(max_char_length()));
+ set_handler(Type_handler::type_handler_long_or_longlong(max_char_length(),
+ unsigned_flag));
break;
case DECIMAL_RESULT:
set_handler(&type_handler_newdecimal);
@@ -4531,11 +4546,14 @@ Item_func_set_user_var::fix_length_and_dec()
{
maybe_null=args[0]->maybe_null;
decimals=args[0]->decimals;
- collation.set(DERIVATION_IMPLICIT);
if (args[0]->collation.derivation == DERIVATION_NUMERIC)
- fix_length_and_charset(args[0]->max_char_length(), default_charset());
+ {
+ collation.set(DERIVATION_NUMERIC);
+ fix_length_and_charset(args[0]->max_char_length(), &my_charset_numeric);
+ }
else
{
+ collation.set(DERIVATION_IMPLICIT);
fix_length_and_charset(args[0]->max_char_length(),
args[0]->collation.collation);
}
@@ -4661,6 +4679,10 @@ update_hash(user_var_entry *entry, bool set_null, void *ptr, size_t length,
entry->unsigned_flag= unsigned_arg;
}
entry->type=type;
+#ifndef EMBEDDED_LIBRARY
+ THD *thd= current_thd;
+ thd->session_tracker.user_variables.mark_as_changed(thd, entry);
+#endif
return 0;
}
@@ -4750,7 +4772,7 @@ longlong user_var_entry::val_int(bool *null_value) const
/** Get the value of a variable as a string. */
String *user_var_entry::val_str(bool *null_value, String *str,
- uint decimals)
+ uint decimals) const
{
if ((*null_value= (value == 0)))
return (String*) 0;
@@ -4926,13 +4948,13 @@ Item_func_set_user_var::update()
case REAL_RESULT:
{
res= update_hash((void*) &save_result.vreal,sizeof(save_result.vreal),
- REAL_RESULT, default_charset(), 0);
+ REAL_RESULT, &my_charset_numeric, 0);
break;
}
case INT_RESULT:
{
res= update_hash((void*) &save_result.vint, sizeof(save_result.vint),
- INT_RESULT, default_charset(), unsigned_flag);
+ INT_RESULT, &my_charset_numeric, unsigned_flag);
break;
}
case STRING_RESULT:
@@ -4952,7 +4974,7 @@ Item_func_set_user_var::update()
else
res= update_hash((void*) save_result.vdec,
sizeof(my_decimal), DECIMAL_RESULT,
- default_charset(), 0);
+ &my_charset_numeric, 0);
break;
}
case ROW_RESULT:
@@ -5083,7 +5105,7 @@ void Item_func_set_user_var::make_send_field(THD *thd, Send_field *tmp_field)
if (result_field)
{
result_field->make_send_field(tmp_field);
- DBUG_ASSERT(tmp_field->table_name != 0);
+ DBUG_ASSERT(tmp_field->table_name.str != 0);
if (Item::name.str)
tmp_field->col_name= Item::name; // Use user supplied name
}
@@ -5391,22 +5413,29 @@ bool Item_func_get_user_var::fix_length_and_dec()
{
unsigned_flag= m_var_entry->unsigned_flag;
max_length= (uint32)m_var_entry->length;
- collation.set(m_var_entry->charset(), DERIVATION_IMPLICIT);
- set_handler_by_result_type(m_var_entry->type);
- switch (result_type()) {
+ switch (m_var_entry->type) {
case REAL_RESULT:
+ collation.set(&my_charset_numeric, DERIVATION_NUMERIC);
fix_char_length(DBL_DIG + 8);
+ set_handler(&type_handler_double);
break;
case INT_RESULT:
+ collation.set(&my_charset_numeric, DERIVATION_NUMERIC);
fix_char_length(MAX_BIGINT_WIDTH);
decimals=0;
+ set_handler(unsigned_flag ? &type_handler_ulonglong :
+ &type_handler_slonglong);
break;
case STRING_RESULT:
+ collation.set(m_var_entry->charset(), DERIVATION_IMPLICIT);
max_length= MAX_BLOB_WIDTH - 1;
+ set_handler(&type_handler_long_blob);
break;
case DECIMAL_RESULT:
+ collation.set(&my_charset_numeric, DERIVATION_NUMERIC);
fix_char_length(DECIMAL_MAX_STR_LENGTH);
decimals= DECIMAL_MAX_SCALE;
+ set_handler(&type_handler_newdecimal);
break;
case ROW_RESULT: // Keep compiler happy
case TIME_RESULT:
@@ -5603,7 +5632,7 @@ bool Item_func_get_system_var::fix_length_and_dec()
case SHOW_SINT:
case SHOW_SLONG:
case SHOW_SLONGLONG:
- collation.set_numeric();
+ collation= DTCollation_numeric();
fix_char_length(MY_INT64_NUM_DECIMAL_DIGITS);
decimals=0;
break;
@@ -5637,13 +5666,13 @@ bool Item_func_get_system_var::fix_length_and_dec()
break;
case SHOW_BOOL:
case SHOW_MY_BOOL:
- collation.set_numeric();
+ collation= DTCollation_numeric();
fix_char_length(1);
decimals=0;
break;
case SHOW_DOUBLE:
decimals= 6;
- collation.set_numeric();
+ collation= DTCollation_numeric();
fix_char_length(DBL_DIG + 6);
break;
default:
@@ -5689,11 +5718,12 @@ const Type_handler *Item_func_get_system_var::type_handler() const
case SHOW_SINT:
case SHOW_SLONG:
case SHOW_SLONGLONG:
+ return &type_handler_slonglong;
case SHOW_UINT:
case SHOW_ULONG:
case SHOW_ULONGLONG:
case SHOW_HA_ROWS:
- return &type_handler_longlong;
+ return &type_handler_ulonglong;
case SHOW_CHAR:
case SHOW_CHAR_PTR:
case SHOW_LEX_STRING:
diff --git a/sql/item_func.h b/sql/item_func.h
index 996a445617b..5b0093167d4 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -188,12 +188,10 @@ public:
void signal_divide_by_null();
friend class udf_handler;
- Field *create_field_for_create_select(TABLE *table)
- { return tmp_table_field_from_field_type(table); }
+ Field *create_field_for_create_select(MEM_ROOT *root, TABLE *table)
+ { return tmp_table_field_from_field_type(root, table); }
Item *get_tmp_table_item(THD *thd);
- my_decimal *val_decimal(my_decimal *);
-
void fix_char_length_ulonglong(ulonglong max_char_length_arg)
{
ulonglong max_result_length= max_char_length_arg *
@@ -212,6 +210,7 @@ public:
void traverse_cond(Cond_traverser traverser,
void * arg, traverse_order order);
bool eval_not_null_tables(void *opt_arg);
+ bool find_not_null_fields(table_map allowed);
// bool is_expensive_processor(void *arg);
// virtual bool is_expensive() { return 0; }
inline void raise_numeric_overflow(const char *type_name)
@@ -406,13 +405,13 @@ public:
class Item_real_func :public Item_func
{
public:
- Item_real_func(THD *thd): Item_func(thd) { collation.set_numeric(); }
+ Item_real_func(THD *thd): Item_func(thd) { collation= DTCollation_numeric(); }
Item_real_func(THD *thd, Item *a): Item_func(thd, a)
- { collation.set_numeric(); }
+ { collation= DTCollation_numeric(); }
Item_real_func(THD *thd, Item *a, Item *b): Item_func(thd, a, b)
- { collation.set_numeric(); }
+ { collation= DTCollation_numeric(); }
Item_real_func(THD *thd, List<Item> &list): Item_func(thd, list)
- { collation.set_numeric(); }
+ { collation= DTCollation_numeric(); }
String *val_str(String*str);
my_decimal *val_decimal(my_decimal *decimal_value);
longlong val_int()
@@ -436,8 +435,7 @@ public:
Functions whose returned field type is determined at fix_fields() time.
*/
class Item_hybrid_func: public Item_func,
- public Type_handler_hybrid_field_type,
- public Type_geometry_attributes
+ public Type_handler_hybrid_field_type
{
protected:
bool fix_attributes(Item **item, uint nitems);
@@ -452,12 +450,6 @@ public:
:Item_func(thd, item), Type_handler_hybrid_field_type(item) { }
const Type_handler *type_handler() const
{ return Type_handler_hybrid_field_type::type_handler(); }
- Field::geometry_type get_geometry_type() const
- { return Type_geometry_attributes::get_geometry_type(); };
- void set_geometry_type(uint type)
- {
- Type_geometry_attributes::set_geometry_type(type);
- }
};
@@ -475,9 +467,46 @@ public:
virtual my_decimal *val_decimal(Item_handled_func *, my_decimal *) const= 0;
virtual bool get_date(THD *thd, Item_handled_func *, MYSQL_TIME *, date_mode_t fuzzydate) const= 0;
virtual const Type_handler *return_type_handler() const= 0;
+ virtual const Type_handler *
+ type_handler_for_create_select(const Item_handled_func *item) const
+ {
+ return return_type_handler();
+ }
virtual bool fix_length_and_dec(Item_handled_func *) const= 0;
};
+ class Handler_str: public Handler
+ {
+ public:
+ String *val_str_ascii(Item_handled_func *item, String *str) const
+ {
+ return item->Item::val_str_ascii(str);
+ }
+ double val_real(Item_handled_func *item) const
+ {
+ DBUG_ASSERT(item->is_fixed());
+ StringBuffer<64> tmp;
+ String *res= item->val_str(&tmp);
+ return res ? item->double_from_string_with_check(res) : 0.0;
+ }
+ longlong val_int(Item_handled_func *item) const
+ {
+ DBUG_ASSERT(item->is_fixed());
+ StringBuffer<22> tmp;
+ String *res= item->val_str(&tmp);
+ return res ? item->longlong_from_string_with_check(res) : 0;
+ }
+ my_decimal *val_decimal(Item_handled_func *item, my_decimal *to) const
+ {
+ return item->val_decimal_from_string(to);
+ }
+ bool get_date(THD *thd, Item_handled_func *item, MYSQL_TIME *to,
+ date_mode_t fuzzydate) const
+ {
+ return item->get_date_from_string(thd, to, fuzzydate);
+ }
+ };
+
/**
Abstract class for functions returning TIME, DATE, DATETIME or string values,
whose data type depends on parameters and is set at fix_fields time.
@@ -504,6 +533,11 @@ public:
{
return &type_handler_string;
}
+ const Type_handler *
+ type_handler_for_create_select(const Item_handled_func *item) const
+ {
+ return return_type_handler()->type_handler_for_tmp_table(item);
+ }
double val_real(Item_handled_func *item) const
{
return Temporal_hybrid(item).to_double();
@@ -621,6 +655,14 @@ public:
{
return m_func_handler->return_type_handler();
}
+ Field *create_field_for_create_select(MEM_ROOT *root, TABLE *table)
+ {
+ DBUG_ASSERT(fixed);
+ const Type_handler *h= m_func_handler->type_handler_for_create_select(this);
+ return h->make_and_init_table_field(root, &name,
+ Record_addr(maybe_null),
+ *this, table);
+ }
String *val_str(String *to)
{
return m_func_handler->val_str(this, to);
@@ -730,19 +772,19 @@ public:
public:
Item_func_hybrid_field_type(THD *thd):
Item_hybrid_func(thd)
- { collation.set_numeric(); }
+ { collation= DTCollation_numeric(); }
Item_func_hybrid_field_type(THD *thd, Item *a):
Item_hybrid_func(thd, a)
- { collation.set_numeric(); }
+ { collation= DTCollation_numeric(); }
Item_func_hybrid_field_type(THD *thd, Item *a, Item *b):
Item_hybrid_func(thd, a, b)
- { collation.set_numeric(); }
+ { collation= DTCollation_numeric(); }
Item_func_hybrid_field_type(THD *thd, Item *a, Item *b, Item *c):
Item_hybrid_func(thd, a, b, c)
- { collation.set_numeric(); }
+ { collation= DTCollation_numeric(); }
Item_func_hybrid_field_type(THD *thd, List<Item> &list):
Item_hybrid_func(thd, list)
- { collation.set_numeric(); }
+ { collation= DTCollation_numeric(); }
double val_real()
{
@@ -882,6 +924,7 @@ public:
Item_func_case_expression(THD *thd, List<Item> &list):
Item_func_hybrid_field_type(thd, list)
{ }
+ bool find_not_null_fields(table_map allowed) { return false; }
};
@@ -943,7 +986,12 @@ public:
/* Base class for operations like '+', '-', '*' */
class Item_num_op :public Item_func_numhybrid
{
- public:
+protected:
+ bool check_arguments() const
+ {
+ return false; // Checked by aggregate_for_num_op()
+ }
+public:
Item_num_op(THD *thd, Item *a, Item *b): Item_func_numhybrid(thd, a, b) {}
virtual void result_precision()= 0;
@@ -954,7 +1002,7 @@ class Item_num_op :public Item_func_numhybrid
bool fix_type_handler(const Type_aggregator *aggregator);
void fix_length_and_dec_double()
{
- count_real_length(args, arg_count);
+ aggregate_numeric_attributes_real(args, arg_count);
max_length= float_length(decimals);
}
void fix_length_and_dec_decimal()
@@ -991,22 +1039,26 @@ public:
Min signed = -9,223,372,036,854,775,808 = 19 digits, 20 characters
*/
Item_int_func(THD *thd): Item_func(thd)
- { collation.set_numeric(); fix_char_length(21); }
+ { collation= DTCollation_numeric(); fix_char_length(21); }
Item_int_func(THD *thd, Item *a): Item_func(thd, a)
- { collation.set_numeric(); fix_char_length(21); }
+ { collation= DTCollation_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); }
+ { collation= DTCollation_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); }
+ { collation= DTCollation_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); }
+ { collation= DTCollation_numeric(); fix_char_length(21); }
Item_int_func(THD *thd, List<Item> &list): Item_func(thd, list)
- { collation.set_numeric(); fix_char_length(21); }
+ { collation= DTCollation_numeric(); fix_char_length(21); }
Item_int_func(THD *thd, Item_int_func *item) :Item_func(thd, item)
- { collation.set_numeric(); }
+ { collation= DTCollation_numeric(); }
double val_real();
String *val_str(String*str);
+ my_decimal *val_decimal(my_decimal *decimal_value)
+ {
+ return val_decimal_from_int(decimal_value);
+ }
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)
{ return get_date_from_int(thd, ltime, fuzzydate); }
const Type_handler *type_handler() const= 0;
@@ -1023,7 +1075,12 @@ public:
Item_long_func(THD *thd, Item *a, Item *b, Item *c): Item_int_func(thd, a, b, c) {}
Item_long_func(THD *thd, List<Item> &list): Item_int_func(thd, list) { }
Item_long_func(THD *thd, Item_long_func *item) :Item_int_func(thd, item) {}
- const Type_handler *type_handler() const { return &type_handler_long; }
+ const Type_handler *type_handler() const
+ {
+ if (unsigned_flag)
+ return &type_handler_ulong;
+ return &type_handler_slong;
+ }
bool fix_length_and_dec() { max_length= 11; return FALSE; }
};
@@ -1035,7 +1092,7 @@ public:
{}
longlong val_int();
bool fix_length_and_dec();
- const Type_handler *type_handler() const { return &type_handler_long; }
+ const Type_handler *type_handler() const { return &type_handler_slong; }
Item *get_copy(THD *thd)
{ return get_item_copy<Item_func_hash>(thd, this); }
const char *func_name() const { return "<hash>"; }
@@ -1052,7 +1109,12 @@ public:
Item_int_func(thd, a, b, c, d) {}
Item_longlong_func(THD *thd, List<Item> &list): Item_int_func(thd, list) { }
Item_longlong_func(THD *thd, Item_longlong_func *item) :Item_int_func(thd, item) {}
- const Type_handler *type_handler() const { return &type_handler_longlong; }
+ const Type_handler *type_handler() const
+ {
+ if (unsigned_flag)
+ return &type_handler_ulonglong;
+ return &type_handler_slonglong;
+ }
};
@@ -1120,7 +1182,10 @@ public:
}
const char *func_name() const { return "cast_as_signed"; }
const Type_handler *type_handler() const
- { return type_handler_long_or_longlong(); }
+ {
+ return Type_handler::type_handler_long_or_longlong(max_char_length(),
+ false);
+ }
longlong val_int()
{
longlong value= args[0]->val_int_signed_typecast();
@@ -1179,8 +1244,8 @@ public:
const Type_handler *type_handler() const
{
if (max_char_length() <= MY_INT32_NUM_DECIMAL_DIGITS - 1)
- return &type_handler_long;
- return &type_handler_longlong;
+ return &type_handler_ulong;
+ return &type_handler_ulonglong;
}
longlong val_int()
{
@@ -1207,7 +1272,7 @@ public:
:Item_func(thd, a)
{
decimals= (uint8) dec;
- collation.set_numeric();
+ collation= DTCollation_numeric();
fix_char_length(my_decimal_precision_to_length_no_truncation(len, dec,
unsigned_flag));
}
@@ -1823,6 +1888,10 @@ class Item_func_min_max :public Item_hybrid_func
String tmp_value;
int cmp_sign;
protected:
+ bool check_arguments() const
+ {
+ return false; // Checked by aggregate_for_min_max()
+ }
bool fix_attributes(Item **item, uint nitems);
public:
Item_func_min_max(THD *thd, List<Item> &list, int cmp_sign_arg):
@@ -1940,9 +2009,7 @@ public:
const Type_handler *type_handler() const { return args[0]->type_handler(); }
bool fix_length_and_dec()
{
- collation= args[0]->collation;
- max_length= args[0]->max_length;
- decimals=args[0]->decimals;
+ Type_std_attributes::set(*args[0]);
return FALSE;
}
Item *get_copy(THD *thd)
@@ -2012,6 +2079,10 @@ public:
not_null_tables_cache= 0;
return false;
}
+ bool find_not_null_fields(table_map allowed)
+ {
+ return false;
+ }
Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond)
{ return this; }
bool const_item() const { return true; }
@@ -2384,6 +2455,10 @@ public:
not_null_tables_cache= 0;
return 0;
}
+ bool find_not_null_fields(table_map allowed)
+ {
+ return false;
+ }
bool is_expensive() { return 1; }
virtual void print(String *str, enum_query_type query_type);
bool check_vcol_func_processor(void *arg)
@@ -2440,8 +2515,16 @@ public:
Item_udf_func(thd, udf_arg, list) {}
longlong val_int();
double val_real() { return (double) Item_func_udf_int::val_int(); }
+ my_decimal *val_decimal(my_decimal *decimal_value)
+ {
+ return val_decimal_from_int(decimal_value);
+ }
String *val_str(String *str);
- const Type_handler *type_handler() const { return &type_handler_longlong; }
+ const Type_handler *type_handler() const
+ {
+ return unsigned_flag ? &type_handler_ulonglong :
+ &type_handler_slonglong;
+ }
bool fix_length_and_dec() { decimals= 0; max_length= 21; return FALSE; }
Item *get_copy(THD *thd)
{ return get_item_copy<Item_func_udf_int>(thd, this); }
@@ -2533,7 +2616,7 @@ public:
Item_int_func(thd) {}
Item_func_udf_int(THD *thd, udf_func *udf_arg, List<Item> &list):
Item_int_func(thd, list) {}
- const Type_handler *type_handler() const { return &type_handler_longlong; }
+ const Type_handler *type_handler() const { return &type_handler_slonglong; }
longlong val_int() { DBUG_ASSERT(fixed == 1); return 0; }
};
@@ -2545,7 +2628,7 @@ public:
Item_int_func(thd) {}
Item_func_udf_decimal(THD *thd, udf_func *udf_arg, List<Item> &list):
Item_int_func(thd, list) {}
- const Type_handler *type_handler() const { return &type_handler_longlong; }
+ const Type_handler *type_handler() const { return &type_handler_slonglong; }
my_decimal *val_decimal(my_decimal *) { DBUG_ASSERT(fixed == 1); return 0; }
};
@@ -2698,10 +2781,15 @@ public:
Item_func_user_var(THD *thd, Item_func_user_var *item)
:Item_hybrid_func(thd, item),
m_var_entry(item->m_var_entry), name(item->name) { }
- Field *create_tmp_field_ex(TABLE *table, Tmp_field_src *src,
- const Tmp_field_param *param);
- Field *create_field_for_create_select(TABLE *table)
- { return create_table_field_from_handler(table); }
+ Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src,
+ const Tmp_field_param *param)
+ {
+ DBUG_ASSERT(fixed);
+ return create_tmp_field_ex_from_handler(root, table, src, param,
+ type_handler());
+ }
+ Field *create_field_for_create_select(MEM_ROOT *root, TABLE *table)
+ { return create_table_field_from_handler(root, table); }
bool check_vcol_func_processor(void *arg);
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)
{
@@ -2876,7 +2964,7 @@ public:
{
return 0;
}
- Field *create_tmp_field_ex(TABLE *table, Tmp_field_src *src,
+ Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src,
const Tmp_field_param *param)
{
DBUG_ASSERT(0);
@@ -2995,6 +3083,10 @@ public:
not_null_tables_cache= 0;
return 0;
}
+ bool find_not_null_fields(table_map allowed)
+ {
+ return false;
+ }
bool fix_fields(THD *thd, Item **ref);
bool eq(const Item *, bool binary_cmp) const;
/* The following should be safe, even if we compare doubles */
@@ -3128,12 +3220,15 @@ public:
set(handler, 0, 0);
}
const Type_handler *type_handler() const { return m_type_handler; }
- Item *create_typecast_item(THD *thd, Item *item, CHARSET_INFO *cs= NULL)
+ Item *create_typecast_item(THD *thd, Item *item,
+ CHARSET_INFO *cs= NULL) const
{
return m_type_handler->
create_typecast_item(thd, item,
Type_cast_attributes(length(), dec(), cs));
}
+ Item *create_typecast_item_or_error(THD *thd, Item *item,
+ CHARSET_INFO *cs= NULL) const;
};
@@ -3195,13 +3290,13 @@ public:
const Type_handler *type_handler() const;
- Field *create_tmp_field_ex(TABLE *table, Tmp_field_src *src,
+ Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src,
const Tmp_field_param *param);
- Field *create_field_for_create_select(TABLE *table)
+ Field *create_field_for_create_select(MEM_ROOT *root, TABLE *table)
{
return result_type() != STRING_RESULT ?
sp_result_field :
- create_table_field_from_handler(table);
+ create_table_field_from_handler(root, table);
}
void make_send_field(THD *thd, Send_field *tmp_field);
@@ -3295,6 +3390,10 @@ public:
}
bool excl_dep_on_grouping_fields(st_select_lex *sel)
{ return false; }
+ bool find_not_null_fields(table_map allowed)
+ {
+ return false;
+ }
};
@@ -3399,6 +3498,10 @@ public:
not_null_tables_cache= 0;
return 0;
}
+ bool find_not_null_fields(table_map allowed)
+ {
+ return false;
+ }
bool const_item() const { return 0; }
void evaluate_sideeffects();
void update_used_tables()
diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc
index 9e6c8ea9008..541edf6a3b5 100644
--- a/sql/item_geofunc.cc
+++ b/sql/item_geofunc.cc
@@ -38,6 +38,8 @@
#ifdef HAVE_SPATIAL
#include <m_ctype.h>
#include "opt_range.h"
+#include "item_geofunc.h"
+#include <mysql/plugin_function_collection.h>
bool Item_geometry_func::fix_length_and_dec()
@@ -324,12 +326,6 @@ String *Item_func_geometry_type::val_str_ascii(String *str)
}
-Field::geometry_type Item_func_envelope::get_geometry_type() const
-{
- return Field::GEOM_POLYGON;
-}
-
-
String *Item_func_envelope::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
@@ -478,12 +474,6 @@ mem_error:
}
-Field::geometry_type Item_func_centroid::get_geometry_type() const
-{
- return Field::GEOM_POINT;
-}
-
-
String *Item_func_centroid::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
@@ -901,12 +891,6 @@ err:
*/
-Field::geometry_type Item_func_point::get_geometry_type() const
-{
- return Field::GEOM_POINT;
-}
-
-
String *Item_func_point::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
@@ -1080,9 +1064,17 @@ Item_func_spatial_rel::get_mm_leaf(RANGE_OPT_PARAM *param,
if (param->using_real_indexes &&
!field->optimize_range(param->real_keynr[key_part->key],
key_part->part))
- DBUG_RETURN(0);
+ DBUG_RETURN(0);
- if (value->save_in_field_no_warnings(field, 1))
+ Field_geom *field_geom= dynamic_cast<Field_geom*>(field);
+ DBUG_ASSERT(field_geom);
+ const Type_handler_geometry *sav_geom_type= field_geom->type_handler_geom();
+ // We have to be able to store all sorts of spatial features here
+ field_geom->set_type_handler(&type_handler_geometry);
+ bool rc= value->save_in_field_no_warnings(field, 1);
+ field_geom->set_type_handler(sav_geom_type);
+
+ if (rc)
DBUG_RETURN(&sel_arg_impossible); // Bad GEOMETRY value
DBUG_ASSERT(!field->real_maybe_null()); // SPATIAL keys do not support NULL
@@ -2631,12 +2623,6 @@ mem_error:
}
-Field::geometry_type Item_func_pointonsurface::get_geometry_type() const
-{
- return Field::GEOM_POINT;
-}
-
-
#ifndef DBUG_OFF
longlong Item_func_gis_debug::val_int()
{
@@ -2645,4 +2631,1286 @@ longlong Item_func_gis_debug::val_int()
}
#endif
+
+/**********************************************************************/
+
+
+class Create_func_area : public Create_func_arg1
+{
+public:
+ Item *create_1_arg(THD *thd, Item *arg1) override
+ {
+ return new (thd->mem_root) Item_func_area(thd, arg1);
+ }
+
+ static Create_func_area s_singleton;
+
+protected:
+ Create_func_area() {}
+ virtual ~Create_func_area() {}
+};
+
+
+class Create_func_as_wkb : public Create_func_arg1
+{
+public:
+ Item *create_1_arg(THD *thd, Item *arg1) override
+ {
+ return new (thd->mem_root) Item_func_as_wkb(thd, arg1);
+ }
+
+ static Create_func_as_wkb s_singleton;
+
+protected:
+ Create_func_as_wkb() {}
+ virtual ~Create_func_as_wkb() {}
+};
+
+
+class Create_func_as_wkt : public Create_func_arg1
+{
+public:
+ Item *create_1_arg(THD *thd, Item *arg1) override
+ {
+ return new (thd->mem_root) Item_func_as_wkt(thd, arg1);
+ }
+
+ static Create_func_as_wkt s_singleton;
+
+protected:
+ Create_func_as_wkt() {}
+ virtual ~Create_func_as_wkt() {}
+};
+
+
+
+class Create_func_centroid : public Create_func_arg1
+{
+public:
+ Item *create_1_arg(THD *thd, Item *arg1) override
+ {
+ return new (thd->mem_root) Item_func_centroid(thd, arg1);
+ }
+
+ static Create_func_centroid s_singleton;
+
+protected:
+ Create_func_centroid() {}
+ virtual ~Create_func_centroid() {}
+};
+
+
+class Create_func_convexhull : public Create_func_arg1
+{
+public:
+ Item *create_1_arg(THD *thd, Item *arg1) override
+ {
+ return new (thd->mem_root) Item_func_convexhull(thd, arg1);
+ }
+
+ static Create_func_convexhull s_singleton;
+
+protected:
+ Create_func_convexhull() {}
+ virtual ~Create_func_convexhull() {}
+};
+
+
+class Create_func_pointonsurface : public Create_func_arg1
+{
+public:
+ Item *create_1_arg(THD *thd, Item *arg1) override
+ {
+ return new (thd->mem_root) Item_func_pointonsurface(thd, arg1);
+ }
+
+ static Create_func_pointonsurface s_singleton;
+
+protected:
+ Create_func_pointonsurface() {}
+ virtual ~Create_func_pointonsurface() {}
+};
+
+
+class Create_func_mbr_contains : public Create_func_arg2
+{
+public:
+ Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override
+ {
+ return new (thd->mem_root) Item_func_spatial_mbr_rel(thd, arg1, arg2,
+ Item_func::SP_CONTAINS_FUNC);
+ }
+
+ static Create_func_mbr_contains s_singleton;
+
+protected:
+ Create_func_mbr_contains() {}
+ virtual ~Create_func_mbr_contains() {}
+};
+
+
+class Create_func_contains : public Create_func_arg2
+{
+public:
+ Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override
+ {
+ return new (thd->mem_root) Item_func_spatial_precise_rel(thd, arg1, arg2,
+ Item_func::SP_CONTAINS_FUNC);
+ }
+ static Create_func_contains s_singleton;
+
+protected:
+ Create_func_contains() {}
+ virtual ~Create_func_contains() {}
+};
+
+
+class Create_func_crosses : public Create_func_arg2
+{
+public:
+ Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override
+ {
+ return new (thd->mem_root) Item_func_spatial_precise_rel(thd, arg1, arg2,
+ Item_func::SP_CROSSES_FUNC);
+ }
+ static Create_func_crosses s_singleton;
+
+protected:
+ Create_func_crosses() {}
+ virtual ~Create_func_crosses() {}
+};
+
+
+class Create_func_dimension : public Create_func_arg1
+{
+public:
+ Item *create_1_arg(THD *thd, Item *arg1) override
+ {
+ return new (thd->mem_root) Item_func_dimension(thd, arg1);
+ }
+
+ static Create_func_dimension s_singleton;
+
+protected:
+ Create_func_dimension() {}
+ virtual ~Create_func_dimension() {}
+};
+
+
+class Create_func_mbr_disjoint : public Create_func_arg2
+{
+public:
+ Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override
+ {
+ return new (thd->mem_root) Item_func_spatial_mbr_rel(thd, arg1, arg2,
+ Item_func::SP_DISJOINT_FUNC);
+ }
+
+ static Create_func_mbr_disjoint s_singleton;
+
+protected:
+ Create_func_mbr_disjoint() {}
+ virtual ~Create_func_mbr_disjoint() {}
+};
+
+
+class Create_func_disjoint : public Create_func_arg2
+{
+public:
+ Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override
+ {
+ return new (thd->mem_root) Item_func_spatial_precise_rel(thd, arg1, arg2,
+ Item_func::SP_DISJOINT_FUNC);
+ }
+ static Create_func_disjoint s_singleton;
+
+protected:
+ Create_func_disjoint() {}
+ virtual ~Create_func_disjoint() {}
+};
+
+
+class Create_func_distance : public Create_func_arg2
+{
+public:
+ Item* create_2_arg(THD *thd, Item *arg1, Item *arg2) override
+ {
+ return new (thd->mem_root) Item_func_distance(thd, arg1, arg2);
+ }
+
+ static Create_func_distance s_singleton;
+
+protected:
+ Create_func_distance() {}
+ virtual ~Create_func_distance() {}
+};
+
+
+
+class Create_func_endpoint : public Create_func_arg1
+{
+public:
+ Item *create_1_arg(THD *thd, Item *arg1) override
+ {
+ return new (thd->mem_root) Item_func_spatial_decomp(thd, arg1,
+ Item_func::SP_ENDPOINT);
+ }
+
+ static Create_func_endpoint s_singleton;
+
+protected:
+ Create_func_endpoint() {}
+ virtual ~Create_func_endpoint() {}
+};
+
+
+class Create_func_envelope : public Create_func_arg1
+{
+public:
+ Item *create_1_arg(THD *thd, Item *arg1) override
+ {
+ return new (thd->mem_root) Item_func_envelope(thd, arg1);
+ }
+
+ static Create_func_envelope s_singleton;
+
+protected:
+ Create_func_envelope() {}
+ virtual ~Create_func_envelope() {}
+};
+
+class Create_func_boundary : public Create_func_arg1
+{
+public:
+ Item *create_1_arg(THD *thd, Item *arg1) override
+ {
+ return new (thd->mem_root) Item_func_boundary(thd, arg1);
+ }
+
+ static Create_func_boundary s_singleton;
+
+protected:
+ Create_func_boundary() {}
+ virtual ~Create_func_boundary() {}
+};
+
+
+class Create_func_mbr_equals : public Create_func_arg2
+{
+public:
+ Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override
+ {
+ return new (thd->mem_root) Item_func_spatial_mbr_rel(thd, arg1, arg2,
+ Item_func::SP_EQUALS_FUNC);
+ }
+
+ static Create_func_mbr_equals s_singleton;
+
+protected:
+ Create_func_mbr_equals() {}
+ virtual ~Create_func_mbr_equals() {}
+};
+
+
+class Create_func_equals : public Create_func_arg2
+{
+public:
+ Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override
+ {
+ return new (thd->mem_root) Item_func_spatial_precise_rel(thd, arg1, arg2,
+ Item_func::SP_EQUALS_FUNC);
+ }
+
+ static Create_func_equals s_singleton;
+
+protected:
+ Create_func_equals() {}
+ virtual ~Create_func_equals() {}
+};
+
+
+class Create_func_exteriorring : public Create_func_arg1
+{
+public:
+ Item *create_1_arg(THD *thd, Item *arg1) override
+ {
+ return new (thd->mem_root) Item_func_spatial_decomp(thd, arg1,
+ Item_func::SP_EXTERIORRING);
+ }
+
+ static Create_func_exteriorring s_singleton;
+
+protected:
+ Create_func_exteriorring() {}
+ virtual ~Create_func_exteriorring() {}
+};
+
+
+
+class Create_func_geometry_from_text : public Create_native_func
+{
+public:
+ Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+
+ static Create_func_geometry_from_text s_singleton;
+
+protected:
+ Create_func_geometry_from_text() {}
+ virtual ~Create_func_geometry_from_text() {}
+};
+
+
+Item*
+Create_func_geometry_from_text::create_native(THD *thd, LEX_CSTRING *name,
+ List<Item> *item_list)
+{
+ Item *func= NULL;
+ int arg_count= 0;
+
+ if (item_list != NULL)
+ arg_count= item_list->elements;
+
+ switch (arg_count) {
+ case 1:
+ {
+ Item *param_1= item_list->pop();
+ func= new (thd->mem_root) Item_func_geometry_from_text(thd, param_1);
+ thd->lex->uncacheable(UNCACHEABLE_RAND);
+ break;
+ }
+ case 2:
+ {
+ Item *param_1= item_list->pop();
+ Item *param_2= item_list->pop();
+ func= new (thd->mem_root) Item_func_geometry_from_text(thd, param_1, param_2);
+ break;
+ }
+ default:
+ {
+ my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name->str);
+ break;
+ }
+ }
+
+ return func;
+}
+
+
+class Create_func_geometry_from_wkb : public Create_native_func
+{
+public:
+ Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+
+ static Create_func_geometry_from_wkb s_singleton;
+
+protected:
+ Create_func_geometry_from_wkb() {}
+ virtual ~Create_func_geometry_from_wkb() {}
+};
+
+
+Item*
+Create_func_geometry_from_wkb::create_native(THD *thd, LEX_CSTRING *name,
+ List<Item> *item_list)
+{
+ Item *func= NULL;
+ int arg_count= 0;
+
+ if (item_list != NULL)
+ arg_count= item_list->elements;
+
+ switch (arg_count) {
+ case 1:
+ {
+ Item *param_1= item_list->pop();
+ func= new (thd->mem_root) Item_func_geometry_from_wkb(thd, param_1);
+ thd->lex->uncacheable(UNCACHEABLE_RAND);
+ break;
+ }
+ case 2:
+ {
+ Item *param_1= item_list->pop();
+ Item *param_2= item_list->pop();
+ func= new (thd->mem_root) Item_func_geometry_from_wkb(thd, param_1, param_2);
+ break;
+ }
+ default:
+ {
+ my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name->str);
+ break;
+ }
+ }
+
+ return func;
+}
+
+
+class Create_func_geometry_from_json : public Create_native_func
+{
+public:
+ Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+
+ static Create_func_geometry_from_json s_singleton;
+
+protected:
+ Create_func_geometry_from_json() {}
+ virtual ~Create_func_geometry_from_json() {}
+};
+
+
+Item*
+Create_func_geometry_from_json::create_native(THD *thd, LEX_CSTRING *name,
+ List<Item> *item_list)
+{
+ Item *func= NULL;
+ int arg_count= 0;
+
+ if (item_list != NULL)
+ arg_count= item_list->elements;
+
+ switch (arg_count) {
+ case 1:
+ {
+ Item *json= item_list->pop();
+ func= new (thd->mem_root) Item_func_geometry_from_json(thd, json);
+ thd->lex->uncacheable(UNCACHEABLE_RAND);
+ break;
+ }
+ case 2:
+ {
+ Item *json= item_list->pop();
+ Item *options= item_list->pop();
+ func= new (thd->mem_root) Item_func_geometry_from_json(thd, json, options);
+ break;
+ }
+ case 3:
+ {
+ Item *json= item_list->pop();
+ Item *options= item_list->pop();
+ Item *srid= item_list->pop();
+ func= new (thd->mem_root) Item_func_geometry_from_json(thd, json, options,
+ srid);
+ break;
+ }
+ default:
+ {
+ my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name->str);
+ break;
+ }
+ }
+
+ return func;
+}
+
+
+class Create_func_as_geojson : public Create_native_func
+{
+public:
+ Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+
+ static Create_func_as_geojson s_singleton;
+
+protected:
+ Create_func_as_geojson() {}
+ virtual ~Create_func_as_geojson() {}
+};
+
+
+Item*
+Create_func_as_geojson::create_native(THD *thd, LEX_CSTRING *name,
+ List<Item> *item_list)
+{
+ Item *func= NULL;
+ int arg_count= 0;
+
+ if (item_list != NULL)
+ arg_count= item_list->elements;
+
+ switch (arg_count) {
+ case 1:
+ {
+ Item *geom= item_list->pop();
+ func= new (thd->mem_root) Item_func_as_geojson(thd, geom);
+ thd->lex->uncacheable(UNCACHEABLE_RAND);
+ break;
+ }
+ case 2:
+ {
+ Item *geom= item_list->pop();
+ Item *max_dec= item_list->pop();
+ func= new (thd->mem_root) Item_func_as_geojson(thd, geom, max_dec);
+ break;
+ }
+ case 3:
+ {
+ Item *geom= item_list->pop();
+ Item *max_dec= item_list->pop();
+ Item *options= item_list->pop();
+ func= new (thd->mem_root) Item_func_as_geojson(thd, geom, max_dec, options);
+ break;
+ }
+ default:
+ {
+ my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name->str);
+ break;
+ }
+ }
+
+ return func;
+}
+
+
+class Create_func_geometry_type : public Create_func_arg1
+{
+public:
+ Item *create_1_arg(THD *thd, Item *arg1) override
+ {
+ return new (thd->mem_root) Item_func_geometry_type(thd, arg1);
+ }
+
+ static Create_func_geometry_type s_singleton;
+
+protected:
+ Create_func_geometry_type() {}
+ virtual ~Create_func_geometry_type() {}
+};
+
+
+class Create_func_geometryn : public Create_func_arg2
+{
+public:
+ Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override
+ {
+ return new (thd->mem_root) Item_func_spatial_decomp_n(thd, arg1, arg2,
+ Item_func::SP_GEOMETRYN);
+ }
+
+ static Create_func_geometryn s_singleton;
+
+protected:
+ Create_func_geometryn() {}
+ virtual ~Create_func_geometryn() {}
+};
+
+
+#if !defined(DBUG_OFF)
+class Create_func_gis_debug : public Create_func_arg1
+{
+public:
+ Item *create_1_arg(THD *thd, Item *arg1) override
+ {
+ return new (thd->mem_root) Item_func_gis_debug(thd, arg1);
+ }
+
+ static Create_func_gis_debug s_singleton;
+
+protected:
+ Create_func_gis_debug() {}
+ virtual ~Create_func_gis_debug() {}
+};
+#endif
+
+
+class Create_func_glength : public Create_func_arg1
+{
+public:
+ Item *create_1_arg(THD *thd, Item *arg1) override
+ {
+ return new (thd->mem_root) Item_func_glength(thd, arg1);
+ }
+
+ static Create_func_glength s_singleton;
+
+protected:
+ Create_func_glength() {}
+ virtual ~Create_func_glength() {}
+};
+
+
+class Create_func_interiorringn : public Create_func_arg2
+{
+public:
+ Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override
+ {
+ return new (thd->mem_root) Item_func_spatial_decomp_n(thd, arg1, arg2,
+ Item_func::SP_INTERIORRINGN);
+ }
+
+ static Create_func_interiorringn s_singleton;
+
+protected:
+ Create_func_interiorringn() {}
+ virtual ~Create_func_interiorringn() {}
+};
+
+
+class Create_func_relate : public Create_func_arg3
+{
+public:
+ Item *create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *arg3) override
+ {
+ return new (thd->mem_root) Item_func_spatial_relate(thd, arg1, arg2, arg3);
+ }
+
+ static Create_func_relate s_singleton;
+
+protected:
+ Create_func_relate() {}
+ virtual ~Create_func_relate() {}
+};
+
+
+class Create_func_mbr_intersects : public Create_func_arg2
+{
+public:
+ Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override
+ {
+ return new (thd->mem_root) Item_func_spatial_mbr_rel(thd, arg1, arg2,
+ Item_func::SP_INTERSECTS_FUNC);
+ }
+
+ static Create_func_mbr_intersects s_singleton;
+
+protected:
+ Create_func_mbr_intersects() {}
+ virtual ~Create_func_mbr_intersects() {}
+};
+
+
+class Create_func_intersects : public Create_func_arg2
+{
+public:
+ Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override
+ {
+ return new (thd->mem_root) Item_func_spatial_precise_rel(thd, arg1, arg2,
+ Item_func::SP_INTERSECTS_FUNC);
+ }
+
+ static Create_func_intersects s_singleton;
+
+protected:
+ Create_func_intersects() {}
+ virtual ~Create_func_intersects() {}
+};
+
+
+class Create_func_intersection : public Create_func_arg2
+{
+public:
+ Item* create_2_arg(THD *thd, Item *arg1, Item *arg2) override
+ {
+ return new (thd->mem_root) Item_func_spatial_operation(thd, arg1, arg2,
+ Gcalc_function::op_intersection);
+ }
+
+ static Create_func_intersection s_singleton;
+
+protected:
+ Create_func_intersection() {}
+ virtual ~Create_func_intersection() {}
+};
+
+
+class Create_func_difference : public Create_func_arg2
+{
+public:
+ Item* create_2_arg(THD *thd, Item *arg1, Item *arg2) override
+ {
+ return new (thd->mem_root) Item_func_spatial_operation(thd, arg1, arg2,
+ Gcalc_function::op_difference);
+ }
+
+ static Create_func_difference s_singleton;
+
+protected:
+ Create_func_difference() {}
+ virtual ~Create_func_difference() {}
+};
+
+
+class Create_func_union : public Create_func_arg2
+{
+public:
+ Item* create_2_arg(THD *thd, Item *arg1, Item *arg2) override
+ {
+ return new (thd->mem_root) Item_func_spatial_operation(thd, arg1, arg2,
+ Gcalc_function::op_union);
+ }
+
+ static Create_func_union s_singleton;
+
+protected:
+ Create_func_union() {}
+ virtual ~Create_func_union() {}
+};
+
+
+class Create_func_symdifference : public Create_func_arg2
+{
+public:
+ Item* create_2_arg(THD *thd, Item *arg1, Item *arg2) override
+ {
+ return new (thd->mem_root) Item_func_spatial_operation(thd, arg1, arg2,
+ Gcalc_function::op_symdifference);
+ }
+
+ static Create_func_symdifference s_singleton;
+
+protected:
+ Create_func_symdifference() {}
+ virtual ~Create_func_symdifference() {}
+};
+
+
+class Create_func_buffer : public Create_func_arg2
+{
+public:
+ Item* create_2_arg(THD *thd, Item *arg1, Item *arg2) override
+ {
+ return new (thd->mem_root) Item_func_buffer(thd, arg1, arg2);
+ }
+
+ static Create_func_buffer s_singleton;
+
+protected:
+ Create_func_buffer() {}
+ virtual ~Create_func_buffer() {}
+};
+
+
+class Create_func_isclosed : public Create_func_arg1
+{
+public:
+ Item *create_1_arg(THD *thd, Item *arg1) override
+ {
+ return new (thd->mem_root) Item_func_isclosed(thd, arg1);
+ }
+
+ static Create_func_isclosed s_singleton;
+
+protected:
+ Create_func_isclosed() {}
+ virtual ~Create_func_isclosed() {}
+};
+
+
+class Create_func_isring : public Create_func_arg1
+{
+public:
+ Item *create_1_arg(THD *thd, Item *arg1) override
+ {
+ return new (thd->mem_root) Item_func_isring(thd, arg1);
+ }
+
+ static Create_func_isring s_singleton;
+
+protected:
+ Create_func_isring() {}
+ virtual ~Create_func_isring() {}
+};
+
+
+class Create_func_isempty : public Create_func_arg1
+{
+public:
+ Item *create_1_arg(THD *thd, Item *arg1) override
+ {
+ return new (thd->mem_root) Item_func_isempty(thd, arg1);
+ }
+
+ static Create_func_isempty s_singleton;
+
+protected:
+ Create_func_isempty() {}
+ virtual ~Create_func_isempty() {}
+};
+
+
+class Create_func_issimple : public Create_func_arg1
+{
+public:
+ Item *create_1_arg(THD *thd, Item *arg1) override
+ {
+ return new (thd->mem_root) Item_func_issimple(thd, arg1);
+ }
+
+ static Create_func_issimple s_singleton;
+
+protected:
+ Create_func_issimple() {}
+ virtual ~Create_func_issimple() {}
+};
+
+
+
+class Create_func_numgeometries : public Create_func_arg1
+{
+public:
+ Item *create_1_arg(THD *thd, Item *arg1) override
+ {
+ return new (thd->mem_root) Item_func_numgeometries(thd, arg1);
+ }
+
+ static Create_func_numgeometries s_singleton;
+
+protected:
+ Create_func_numgeometries() {}
+ virtual ~Create_func_numgeometries() {}
+};
+
+
+class Create_func_numinteriorring : public Create_func_arg1
+{
+public:
+ Item *create_1_arg(THD *thd, Item *arg1) override
+ {
+ return new (thd->mem_root) Item_func_numinteriorring(thd, arg1);
+ }
+
+ static Create_func_numinteriorring s_singleton;
+
+protected:
+ Create_func_numinteriorring() {}
+ virtual ~Create_func_numinteriorring() {}
+};
+
+
+class Create_func_numpoints : public Create_func_arg1
+{
+public:
+ Item *create_1_arg(THD *thd, Item *arg1) override
+ {
+ return new (thd->mem_root) Item_func_numpoints(thd, arg1);
+ }
+
+ static Create_func_numpoints s_singleton;
+
+protected:
+ Create_func_numpoints() {}
+ virtual ~Create_func_numpoints() {}
+};
+
+
+class Create_func_mbr_overlaps : public Create_func_arg2
+{
+public:
+ Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override
+ {
+ return new (thd->mem_root) Item_func_spatial_mbr_rel(thd, arg1, arg2,
+ Item_func::SP_OVERLAPS_FUNC);
+ }
+
+ static Create_func_mbr_overlaps s_singleton;
+
+protected:
+ Create_func_mbr_overlaps() {}
+ virtual ~Create_func_mbr_overlaps() {}
+};
+
+
+class Create_func_overlaps : public Create_func_arg2
+{
+public:
+ Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override
+ {
+ return new (thd->mem_root) Item_func_spatial_precise_rel(thd, arg1, arg2,
+ Item_func::SP_OVERLAPS_FUNC);
+ }
+
+ static Create_func_overlaps s_singleton;
+
+protected:
+ Create_func_overlaps() {}
+ virtual ~Create_func_overlaps() {}
+};
+
+
+
+
+
+class Create_func_pointn : public Create_func_arg2
+{
+public:
+ Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override
+ {
+ return new (thd->mem_root) Item_func_spatial_decomp_n(thd, arg1, arg2,
+ Item_func::SP_POINTN);
+ }
+ static Create_func_pointn s_singleton;
+
+protected:
+ Create_func_pointn() {}
+ virtual ~Create_func_pointn() {}
+};
+
+
+
+
+class Create_func_srid : public Create_func_arg1
+{
+public:
+ Item *create_1_arg(THD *thd, Item *arg1) override
+ {
+ return new (thd->mem_root) Item_func_srid(thd, arg1);
+ }
+
+ static Create_func_srid s_singleton;
+
+protected:
+ Create_func_srid() {}
+ virtual ~Create_func_srid() {}
+};
+
+
+class Create_func_startpoint : public Create_func_arg1
+{
+public:
+ Item *create_1_arg(THD *thd, Item *arg1) override
+ {
+ return new (thd->mem_root) Item_func_spatial_decomp(thd, arg1,
+ Item_func::SP_STARTPOINT);
+ }
+
+ static Create_func_startpoint s_singleton;
+
+protected:
+ Create_func_startpoint() {}
+ virtual ~Create_func_startpoint() {}
+};
+
+
+
+class Create_func_touches : public Create_func_arg2
+{
+public:
+ Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override
+ {
+ return new (thd->mem_root) Item_func_spatial_precise_rel(thd, arg1, arg2,
+ Item_func::SP_TOUCHES_FUNC);
+ }
+
+ static Create_func_touches s_singleton;
+
+protected:
+ Create_func_touches() {}
+ virtual ~Create_func_touches() {}
+};
+
+
+class Create_func_mbr_within : public Create_func_arg2
+{
+public:
+ Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override
+ {
+ return new (thd->mem_root) Item_func_spatial_mbr_rel(thd, arg1, arg2,
+ Item_func::SP_WITHIN_FUNC);
+ }
+
+ static Create_func_mbr_within s_singleton;
+
+protected:
+ Create_func_mbr_within() {}
+ virtual ~Create_func_mbr_within() {}
+};
+
+
+class Create_func_within : public Create_func_arg2
+{
+public:
+ Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override
+ {
+ return new (thd->mem_root) Item_func_spatial_precise_rel(thd, arg1, arg2,
+ Item_func::SP_WITHIN_FUNC);
+ }
+
+ static Create_func_within s_singleton;
+
+protected:
+ Create_func_within() {}
+ virtual ~Create_func_within() {}
+};
+
+
+class Create_func_x : public Create_func_arg1
+{
+public:
+ Item *create_1_arg(THD *thd, Item *arg1) override
+ {
+ return new (thd->mem_root) Item_func_x(thd, arg1);
+ }
+
+ static Create_func_x s_singleton;
+
+protected:
+ Create_func_x() {}
+ virtual ~Create_func_x() {}
+};
+
+
+class Create_func_y : public Create_func_arg1
+{
+public:
+ Item *create_1_arg(THD *thd, Item *arg1) override
+ {
+ return new (thd->mem_root) Item_func_y(thd, arg1);
+ }
+
+ static Create_func_y s_singleton;
+
+protected:
+ Create_func_y() {}
+ virtual ~Create_func_y() {}
+};
+
+
+/*****************************************************************/
+
+
+
+
+
+
+
+/*************************************************************************/
+
+#if !defined(DBUG_OFF)
+Create_func_gis_debug Create_func_gis_debug::s_singleton;
+#endif
+
+Create_func_area Create_func_area::s_singleton;
+Create_func_as_geojson Create_func_as_geojson::s_singleton;
+Create_func_as_wkb Create_func_as_wkb::s_singleton;
+Create_func_as_wkt Create_func_as_wkt::s_singleton;
+Create_func_boundary Create_func_boundary::s_singleton;
+Create_func_buffer Create_func_buffer::s_singleton;
+Create_func_centroid Create_func_centroid::s_singleton;
+Create_func_contains Create_func_contains::s_singleton;
+Create_func_convexhull Create_func_convexhull::s_singleton;
+Create_func_crosses Create_func_crosses::s_singleton;
+Create_func_difference Create_func_difference::s_singleton;
+Create_func_dimension Create_func_dimension::s_singleton;
+Create_func_disjoint Create_func_disjoint::s_singleton;
+Create_func_distance Create_func_distance::s_singleton;
+Create_func_endpoint Create_func_endpoint::s_singleton;
+Create_func_envelope Create_func_envelope::s_singleton;
+Create_func_equals Create_func_equals::s_singleton;
+Create_func_exteriorring Create_func_exteriorring::s_singleton;
+Create_func_geometry_from_json Create_func_geometry_from_json::s_singleton;
+Create_func_geometry_from_text Create_func_geometry_from_text::s_singleton;
+Create_func_geometry_from_wkb Create_func_geometry_from_wkb::s_singleton;
+Create_func_geometryn Create_func_geometryn::s_singleton;
+Create_func_geometry_type Create_func_geometry_type::s_singleton;
+Create_func_glength Create_func_glength::s_singleton;
+Create_func_interiorringn Create_func_interiorringn::s_singleton;
+Create_func_intersection Create_func_intersection::s_singleton;
+Create_func_intersects Create_func_intersects::s_singleton;
+Create_func_isclosed Create_func_isclosed::s_singleton;
+Create_func_isempty Create_func_isempty::s_singleton;
+Create_func_isring Create_func_isring::s_singleton;
+Create_func_issimple Create_func_issimple::s_singleton;
+Create_func_mbr_contains Create_func_mbr_contains::s_singleton;
+Create_func_mbr_disjoint Create_func_mbr_disjoint::s_singleton;
+Create_func_mbr_equals Create_func_mbr_equals::s_singleton;
+Create_func_mbr_intersects Create_func_mbr_intersects::s_singleton;
+Create_func_mbr_overlaps Create_func_mbr_overlaps::s_singleton;
+Create_func_mbr_within Create_func_mbr_within::s_singleton;
+Create_func_numgeometries Create_func_numgeometries::s_singleton;
+Create_func_numinteriorring Create_func_numinteriorring::s_singleton;
+Create_func_numpoints Create_func_numpoints::s_singleton;
+Create_func_overlaps Create_func_overlaps::s_singleton;
+Create_func_pointn Create_func_pointn::s_singleton;
+Create_func_pointonsurface Create_func_pointonsurface::s_singleton;
+Create_func_relate Create_func_relate::s_singleton;
+Create_func_srid Create_func_srid::s_singleton;
+Create_func_startpoint Create_func_startpoint::s_singleton;
+Create_func_symdifference Create_func_symdifference::s_singleton;
+Create_func_touches Create_func_touches::s_singleton;
+Create_func_union Create_func_union::s_singleton;
+Create_func_within Create_func_within::s_singleton;
+Create_func_x Create_func_x::s_singleton;
+Create_func_y Create_func_y::s_singleton;
+
+/*************************************************************************/
+
+
+class FHash: public HASH
+{
+public:
+ FHash()
+ {
+ bzero((HASH *) this, sizeof(HASH));
+ }
+};
+
+
+#define GEOM_BUILDER(F) & F::s_singleton
+
+
+static Native_func_registry func_array_geom[] =
+{
+#ifndef DBUG_OFF
+ { { STRING_WITH_LEN("ST_GIS_DEBUG") }, GEOM_BUILDER(Create_func_gis_debug)},
+#endif
+ { { STRING_WITH_LEN("AREA") }, GEOM_BUILDER(Create_func_area)},
+ { { STRING_WITH_LEN("ASBINARY") }, GEOM_BUILDER(Create_func_as_wkb)},
+ { { STRING_WITH_LEN("ASTEXT") }, GEOM_BUILDER(Create_func_as_wkt)},
+ { { STRING_WITH_LEN("ASWKB") }, GEOM_BUILDER(Create_func_as_wkb)},
+ { { STRING_WITH_LEN("ASWKT") }, GEOM_BUILDER(Create_func_as_wkt)},
+ { { STRING_WITH_LEN("BOUNDARY") }, GEOM_BUILDER(Create_func_boundary)},
+ { { STRING_WITH_LEN("BUFFER") }, GEOM_BUILDER(Create_func_buffer)},
+ { { STRING_WITH_LEN("CENTROID") }, GEOM_BUILDER(Create_func_centroid)},
+ { { STRING_WITH_LEN("CONTAINS") }, GEOM_BUILDER(Create_func_contains)},
+ { { STRING_WITH_LEN("CONVEXHULL") }, GEOM_BUILDER(Create_func_convexhull)},
+ { { STRING_WITH_LEN("CROSSES") }, GEOM_BUILDER(Create_func_crosses)},
+ { { STRING_WITH_LEN("DIMENSION") }, GEOM_BUILDER(Create_func_dimension)},
+ { { STRING_WITH_LEN("DISJOINT") }, GEOM_BUILDER(Create_func_mbr_disjoint)},
+ { { STRING_WITH_LEN("ENDPOINT") }, GEOM_BUILDER(Create_func_endpoint)},
+ { { STRING_WITH_LEN("ENVELOPE") }, GEOM_BUILDER(Create_func_envelope)},
+ { { STRING_WITH_LEN("EQUALS") }, GEOM_BUILDER(Create_func_equals)},
+ { { STRING_WITH_LEN("EXTERIORRING") }, GEOM_BUILDER(Create_func_exteriorring)},
+ { { STRING_WITH_LEN("GEOMCOLLFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
+ { { STRING_WITH_LEN("GEOMCOLLFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
+ { { STRING_WITH_LEN("GEOMETRYCOLLECTIONFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
+ { { STRING_WITH_LEN("GEOMETRYCOLLECTIONFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
+ { { STRING_WITH_LEN("GEOMETRYFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
+ { { STRING_WITH_LEN("GEOMETRYFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
+ { { STRING_WITH_LEN("GEOMETRYN") }, GEOM_BUILDER(Create_func_geometryn)},
+ { { STRING_WITH_LEN("GEOMETRYTYPE") }, GEOM_BUILDER(Create_func_geometry_type)},
+ { { STRING_WITH_LEN("GEOMFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
+ { { STRING_WITH_LEN("GEOMFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
+ { { STRING_WITH_LEN("GLENGTH") }, GEOM_BUILDER(Create_func_glength)},
+ { { STRING_WITH_LEN("INTERIORRINGN") }, GEOM_BUILDER(Create_func_interiorringn)},
+ { { STRING_WITH_LEN("INTERSECTS") }, GEOM_BUILDER(Create_func_mbr_intersects)},
+ { { STRING_WITH_LEN("ISCLOSED") }, GEOM_BUILDER(Create_func_isclosed)},
+ { { STRING_WITH_LEN("ISEMPTY") }, GEOM_BUILDER(Create_func_isempty)},
+ { { STRING_WITH_LEN("ISRING") }, GEOM_BUILDER(Create_func_isring)},
+ { { STRING_WITH_LEN("ISSIMPLE") }, GEOM_BUILDER(Create_func_issimple)},
+ { { STRING_WITH_LEN("LINEFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
+ { { STRING_WITH_LEN("LINEFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
+ { { STRING_WITH_LEN("LINESTRINGFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
+ { { STRING_WITH_LEN("LINESTRINGFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
+ { { STRING_WITH_LEN("MBRCONTAINS") }, GEOM_BUILDER(Create_func_mbr_contains)},
+ { { STRING_WITH_LEN("MBRDISJOINT") }, GEOM_BUILDER(Create_func_mbr_disjoint)},
+ { { STRING_WITH_LEN("MBREQUAL") }, GEOM_BUILDER(Create_func_mbr_equals)},
+ { { STRING_WITH_LEN("MBREQUALS") }, GEOM_BUILDER(Create_func_mbr_equals)},
+ { { STRING_WITH_LEN("MBRINTERSECTS") }, GEOM_BUILDER(Create_func_mbr_intersects)},
+ { { STRING_WITH_LEN("MBROVERLAPS") }, GEOM_BUILDER(Create_func_mbr_overlaps)},
+ { { STRING_WITH_LEN("MBRTOUCHES") }, GEOM_BUILDER(Create_func_touches)},
+ { { STRING_WITH_LEN("MBRWITHIN") }, GEOM_BUILDER(Create_func_mbr_within)},
+ { { STRING_WITH_LEN("MLINEFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
+ { { STRING_WITH_LEN("MLINEFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
+ { { STRING_WITH_LEN("MPOINTFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
+ { { STRING_WITH_LEN("MPOINTFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
+ { { STRING_WITH_LEN("MPOLYFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
+ { { STRING_WITH_LEN("MPOLYFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
+ { { STRING_WITH_LEN("MULTILINESTRINGFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
+ { { STRING_WITH_LEN("MULTILINESTRINGFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
+ { { STRING_WITH_LEN("MULTIPOINTFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
+ { { STRING_WITH_LEN("MULTIPOINTFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
+ { { STRING_WITH_LEN("MULTIPOLYGONFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
+ { { STRING_WITH_LEN("MULTIPOLYGONFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
+ { { STRING_WITH_LEN("NUMGEOMETRIES") }, GEOM_BUILDER(Create_func_numgeometries)},
+ { { STRING_WITH_LEN("NUMINTERIORRINGS") }, GEOM_BUILDER(Create_func_numinteriorring)},
+ { { STRING_WITH_LEN("NUMPOINTS") }, GEOM_BUILDER(Create_func_numpoints)},
+ { { STRING_WITH_LEN("OVERLAPS") }, GEOM_BUILDER(Create_func_mbr_overlaps)},
+ { { STRING_WITH_LEN("POINTFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
+ { { STRING_WITH_LEN("POINTFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
+ { { STRING_WITH_LEN("POINTN") }, GEOM_BUILDER(Create_func_pointn)},
+ { { STRING_WITH_LEN("POINTONSURFACE") }, GEOM_BUILDER(Create_func_pointonsurface)},
+ { { STRING_WITH_LEN("POLYFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
+ { { STRING_WITH_LEN("POLYFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
+ { { STRING_WITH_LEN("POLYGONFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
+ { { STRING_WITH_LEN("POLYGONFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
+ { { STRING_WITH_LEN("SRID") }, GEOM_BUILDER(Create_func_srid)},
+ { { STRING_WITH_LEN("ST_AREA") }, GEOM_BUILDER(Create_func_area)},
+ { { STRING_WITH_LEN("STARTPOINT") }, GEOM_BUILDER(Create_func_startpoint)},
+ { { STRING_WITH_LEN("ST_ASBINARY") }, GEOM_BUILDER(Create_func_as_wkb)},
+ { { STRING_WITH_LEN("ST_ASGEOJSON") }, GEOM_BUILDER(Create_func_as_geojson)},
+ { { STRING_WITH_LEN("ST_ASTEXT") }, GEOM_BUILDER(Create_func_as_wkt)},
+ { { STRING_WITH_LEN("ST_ASWKB") }, GEOM_BUILDER(Create_func_as_wkb)},
+ { { STRING_WITH_LEN("ST_ASWKT") }, GEOM_BUILDER(Create_func_as_wkt)},
+ { { STRING_WITH_LEN("ST_BOUNDARY") }, GEOM_BUILDER(Create_func_boundary)},
+ { { STRING_WITH_LEN("ST_BUFFER") }, GEOM_BUILDER(Create_func_buffer)},
+ { { STRING_WITH_LEN("ST_CENTROID") }, GEOM_BUILDER(Create_func_centroid)},
+ { { STRING_WITH_LEN("ST_CONTAINS") }, GEOM_BUILDER(Create_func_contains)},
+ { { STRING_WITH_LEN("ST_CONVEXHULL") }, GEOM_BUILDER(Create_func_convexhull)},
+ { { STRING_WITH_LEN("ST_CROSSES") }, GEOM_BUILDER(Create_func_crosses)},
+ { { STRING_WITH_LEN("ST_DIFFERENCE") }, GEOM_BUILDER(Create_func_difference)},
+ { { STRING_WITH_LEN("ST_DIMENSION") }, GEOM_BUILDER(Create_func_dimension)},
+ { { STRING_WITH_LEN("ST_DISJOINT") }, GEOM_BUILDER(Create_func_disjoint)},
+ { { STRING_WITH_LEN("ST_DISTANCE") }, GEOM_BUILDER(Create_func_distance)},
+ { { STRING_WITH_LEN("ST_ENDPOINT") }, GEOM_BUILDER(Create_func_endpoint)},
+ { { STRING_WITH_LEN("ST_ENVELOPE") }, GEOM_BUILDER(Create_func_envelope)},
+ { { STRING_WITH_LEN("ST_EQUALS") }, GEOM_BUILDER(Create_func_equals)},
+ { { STRING_WITH_LEN("ST_EQUALS") }, GEOM_BUILDER(Create_func_equals)},
+ { { STRING_WITH_LEN("ST_EXTERIORRING") }, GEOM_BUILDER(Create_func_exteriorring)},
+ { { STRING_WITH_LEN("ST_GEOMCOLLFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
+ { { STRING_WITH_LEN("ST_GEOMCOLLFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
+ { { STRING_WITH_LEN("ST_GEOMETRYCOLLECTIONFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
+ { { STRING_WITH_LEN("ST_GEOMETRYCOLLECTIONFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
+ { { STRING_WITH_LEN("ST_GEOMETRYFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
+ { { STRING_WITH_LEN("ST_GEOMETRYFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
+ { { STRING_WITH_LEN("ST_GEOMETRYN") }, GEOM_BUILDER(Create_func_geometryn)},
+ { { STRING_WITH_LEN("ST_GEOMETRYTYPE") }, GEOM_BUILDER(Create_func_geometry_type)},
+ { { STRING_WITH_LEN("ST_GEOMFROMGEOJSON") }, GEOM_BUILDER(Create_func_geometry_from_json)},
+ { { STRING_WITH_LEN("ST_GEOMFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
+ { { STRING_WITH_LEN("ST_GEOMFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
+ { { STRING_WITH_LEN("ST_INTERIORRINGN") }, GEOM_BUILDER(Create_func_interiorringn)},
+ { { STRING_WITH_LEN("ST_INTERSECTION") }, GEOM_BUILDER(Create_func_intersection)},
+ { { STRING_WITH_LEN("ST_INTERSECTS") }, GEOM_BUILDER(Create_func_intersects)},
+ { { STRING_WITH_LEN("ST_ISCLOSED") }, GEOM_BUILDER(Create_func_isclosed)},
+ { { STRING_WITH_LEN("ST_ISEMPTY") }, GEOM_BUILDER(Create_func_isempty)},
+ { { STRING_WITH_LEN("ST_ISRING") }, GEOM_BUILDER(Create_func_isring)},
+ { { STRING_WITH_LEN("ST_ISSIMPLE") }, GEOM_BUILDER(Create_func_issimple)},
+ { { STRING_WITH_LEN("ST_LENGTH") }, GEOM_BUILDER(Create_func_glength)},
+ { { STRING_WITH_LEN("ST_LINEFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
+ { { STRING_WITH_LEN("ST_LINEFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
+ { { STRING_WITH_LEN("ST_LINESTRINGFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
+ { { STRING_WITH_LEN("ST_LINESTRINGFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
+ { { STRING_WITH_LEN("ST_MLINEFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
+ { { STRING_WITH_LEN("ST_MLINEFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
+ { { STRING_WITH_LEN("ST_MPOINTFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
+ { { STRING_WITH_LEN("ST_MPOINTFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
+ { { STRING_WITH_LEN("ST_MPOLYFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
+ { { STRING_WITH_LEN("ST_MPOLYFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
+ { { STRING_WITH_LEN("ST_MULTILINESTRINGFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
+ { { STRING_WITH_LEN("ST_MULTILINESTRINGFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
+ { { STRING_WITH_LEN("ST_MULTIPOINTFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
+ { { STRING_WITH_LEN("ST_MULTIPOINTFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
+ { { STRING_WITH_LEN("ST_MULTIPOLYGONFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
+ { { STRING_WITH_LEN("ST_MULTIPOLYGONFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
+ { { STRING_WITH_LEN("ST_NUMGEOMETRIES") }, GEOM_BUILDER(Create_func_numgeometries)},
+ { { STRING_WITH_LEN("ST_NUMINTERIORRINGS") }, GEOM_BUILDER(Create_func_numinteriorring)},
+ { { STRING_WITH_LEN("ST_NUMPOINTS") }, GEOM_BUILDER(Create_func_numpoints)},
+ { { STRING_WITH_LEN("ST_OVERLAPS") }, GEOM_BUILDER(Create_func_overlaps)},
+ { { STRING_WITH_LEN("ST_POINTFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
+ { { STRING_WITH_LEN("ST_POINTFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
+ { { STRING_WITH_LEN("ST_POINTN") }, GEOM_BUILDER(Create_func_pointn)},
+ { { STRING_WITH_LEN("ST_POINTONSURFACE") }, GEOM_BUILDER(Create_func_pointonsurface)},
+ { { STRING_WITH_LEN("ST_POLYFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
+ { { STRING_WITH_LEN("ST_POLYFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
+ { { STRING_WITH_LEN("ST_POLYGONFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
+ { { STRING_WITH_LEN("ST_POLYGONFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
+ { { STRING_WITH_LEN("ST_RELATE") }, GEOM_BUILDER(Create_func_relate)},
+ { { STRING_WITH_LEN("ST_SRID") }, GEOM_BUILDER(Create_func_srid)},
+ { { STRING_WITH_LEN("ST_STARTPOINT") }, GEOM_BUILDER(Create_func_startpoint)},
+ { { STRING_WITH_LEN("ST_SYMDIFFERENCE") }, GEOM_BUILDER(Create_func_symdifference)},
+ { { STRING_WITH_LEN("ST_TOUCHES") }, GEOM_BUILDER(Create_func_touches)},
+ { { STRING_WITH_LEN("ST_UNION") }, GEOM_BUILDER(Create_func_union)},
+ { { STRING_WITH_LEN("ST_WITHIN") }, GEOM_BUILDER(Create_func_within)},
+ { { STRING_WITH_LEN("ST_X") }, GEOM_BUILDER(Create_func_x)},
+ { { STRING_WITH_LEN("ST_Y") }, GEOM_BUILDER(Create_func_y)},
+ { { STRING_WITH_LEN("TOUCHES") }, GEOM_BUILDER(Create_func_touches)},
+ { { STRING_WITH_LEN("WITHIN") }, GEOM_BUILDER(Create_func_within)},
+ { { STRING_WITH_LEN("X") }, GEOM_BUILDER(Create_func_x)},
+ { { STRING_WITH_LEN("Y") }, GEOM_BUILDER(Create_func_y)},
+};
+
+
+Plugin_function_collection
+ plugin_function_collection_geometry(
+ MariaDB_FUNCTION_COLLECTION_INTERFACE_VERSION,
+ Native_func_registry_array(func_array_geom,
+ array_elements(func_array_geom)));
+
#endif /*HAVE_SPATIAL*/
diff --git a/sql/item_geofunc.h b/sql/item_geofunc.h
index 4e7cda137c2..c38d0b986f1 100644
--- a/sql/item_geofunc.h
+++ b/sql/item_geofunc.h
@@ -26,6 +26,10 @@
#pragma interface /* gcc class implementation */
#endif
+#include "sql_type_geom.h"
+#include "item.h"
+#include "gstream.h"
+#include "spatial.h"
#include "gcalc_slicescan.h"
#include "gcalc_tools.h"
@@ -53,7 +57,8 @@ protected:
bool check_arguments() const
{
DBUG_ASSERT(arg_count == 1);
- return args[0]->check_type_or_binary(func_name(), &type_handler_geometry);
+ return Type_handler_geometry::check_type_geom_or_binary(func_name(),
+ args[0]);
}
public:
Item_real_func_args_geometry(THD *thd, Item *a)
@@ -69,7 +74,8 @@ class Item_long_func_args_geometry: public Item_long_func
bool check_arguments() const
{
DBUG_ASSERT(arg_count == 1);
- return args[0]->check_type_or_binary(func_name(), &type_handler_geometry);
+ return Type_handler_geometry::check_type_geom_or_binary(func_name(),
+ args[0]);
}
protected:
String value;
@@ -89,7 +95,8 @@ protected:
bool check_arguments() const
{
DBUG_ASSERT(arg_count == 1);
- return args[0]->check_type_or_binary(func_name(), &type_handler_geometry);
+ return Type_handler_geometry::check_type_geom_or_binary(func_name(),
+ args[0]);
}
public:
Item_bool_func_args_geometry(THD *thd, Item *a)
@@ -106,7 +113,8 @@ protected:
bool check_arguments() const
{
DBUG_ASSERT(arg_count >= 1);
- return args[0]->check_type_or_binary(func_name(), &type_handler_geometry);
+ return Type_handler_geometry::check_type_geom_or_binary(func_name(),
+ args[0]);
}
public:
Item_str_ascii_func_args_geometry(THD *thd, Item *a)
@@ -127,7 +135,8 @@ protected:
bool check_arguments() const
{
DBUG_ASSERT(arg_count >= 1);
- return args[0]->check_type_or_binary(func_name(), &type_handler_geometry);
+ return Type_handler_geometry::check_type_geom_or_binary(func_name(),
+ args[0]);
}
public:
Item_binary_func_args_geometry(THD *thd, Item *a)
@@ -144,7 +153,8 @@ protected:
bool check_arguments() const
{
DBUG_ASSERT(arg_count >= 1);
- return args[0]->check_type_or_binary(func_name(), &type_handler_geometry);
+ return Type_handler_geometry::check_type_geom_or_binary(func_name(),
+ args[0]);
}
public:
Item_geometry_func_args_geometry(THD *thd, Item *a)
@@ -163,7 +173,8 @@ protected:
bool check_arguments() const
{
DBUG_ASSERT(arg_count >= 2);
- return check_argument_types_or_binary(&type_handler_geometry, 0, 2);
+ return Type_handler_geometry::check_types_geom_or_binary(func_name(),
+ args, 0, 2);
}
public:
Item_real_func_args_geometry_geometry(THD *thd, Item *a, Item *b)
@@ -181,7 +192,8 @@ protected:
bool check_arguments() const
{
DBUG_ASSERT(arg_count >= 2);
- return check_argument_types_or_binary(&type_handler_geometry, 0, 2);
+ return Type_handler_geometry::check_types_geom_or_binary(func_name(),
+ args, 0, 2);
}
public:
Item_bool_func_args_geometry_geometry(THD *thd, Item *a, Item *b, Item *c)
@@ -210,8 +222,9 @@ class Item_func_geometry_from_wkb: public Item_geometry_func
{
bool check_arguments() const
{
- return args[0]->check_type_or_binary(func_name(), &type_handler_geometry) ||
- check_argument_types_can_return_int(1, MY_MIN(2, arg_count));
+ return
+ Type_handler_geometry::check_type_geom_or_binary(func_name(), args[0]) ||
+ check_argument_types_can_return_int(1, MY_MIN(2, arg_count));
}
public:
Item_func_geometry_from_wkb(THD *thd, Item *a): Item_geometry_func(thd, a) {}
@@ -363,7 +376,10 @@ public:
:Item_geometry_func_args_geometry(thd, a) {}
const char *func_name() const { return "st_centroid"; }
String *val_str(String *);
- Field::geometry_type get_geometry_type() const;
+ const Type_handler *type_handler() const
+ {
+ return &type_handler_point;
+ }
Item *get_copy(THD *thd)
{ return get_item_copy<Item_func_centroid>(thd, this); }
};
@@ -375,7 +391,10 @@ public:
:Item_geometry_func_args_geometry(thd, a) {}
const char *func_name() const { return "st_envelope"; }
String *val_str(String *);
- Field::geometry_type get_geometry_type() const;
+ const Type_handler *type_handler() const
+ {
+ return &type_handler_polygon;
+ }
Item *get_copy(THD *thd)
{ return get_item_copy<Item_func_envelope>(thd, this); }
};
@@ -425,7 +444,10 @@ public:
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;
+ const Type_handler *type_handler() const
+ {
+ return &type_handler_point;
+ }
Item *get_copy(THD *thd)
{ return get_item_copy<Item_func_point>(thd, this); }
};
@@ -493,7 +515,8 @@ class Item_func_spatial_collection: public Item_geometry_func
{
bool check_arguments() const
{
- return check_argument_types_or_binary(&type_handler_geometry, 0, arg_count);
+ return Type_handler_geometry::check_types_geom_or_binary(func_name(), args,
+ 0, arg_count);
}
enum Geometry::wkbType coll_type;
enum Geometry::wkbType item_type;
@@ -524,13 +547,112 @@ public:
}
return FALSE;
}
-
+};
+
+
+class Item_func_geometrycollection: public Item_func_spatial_collection
+{
+public:
+ Item_func_geometrycollection(THD *thd, List<Item> &list)
+ :Item_func_spatial_collection(thd, list,
+ Geometry::wkb_geometrycollection,
+ Geometry::wkb_point)
+ { }
+ const Type_handler *type_handler() const
+ {
+ return &type_handler_geometrycollection;
+ }
const char *func_name() const { return "geometrycollection"; }
Item *get_copy(THD *thd)
- { return get_item_copy<Item_func_spatial_collection>(thd, this); }
+ { return get_item_copy<Item_func_geometrycollection>(thd, this); }
};
+class Item_func_linestring: public Item_func_spatial_collection
+{
+public:
+ Item_func_linestring(THD *thd, List<Item> &list)
+ :Item_func_spatial_collection(thd, list,
+ Geometry::wkb_linestring,
+ Geometry::wkb_point)
+ { }
+ const Type_handler *type_handler() const { return &type_handler_linestring; }
+ const char *func_name() const { return "linestring"; }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_linestring>(thd, this); }
+};
+
+
+class Item_func_polygon: public Item_func_spatial_collection
+{
+public:
+ Item_func_polygon(THD *thd, List<Item> &list)
+ :Item_func_spatial_collection(thd, list,
+ Geometry::wkb_polygon,
+ Geometry::wkb_linestring)
+ { }
+ const Type_handler *type_handler() const { return &type_handler_polygon; }
+ const char *func_name() const { return "polygon"; }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_polygon>(thd, this); }
+};
+
+
+class Item_func_multilinestring: public Item_func_spatial_collection
+{
+public:
+ Item_func_multilinestring(THD *thd, List<Item> &list)
+ :Item_func_spatial_collection(thd, list,
+ Geometry::wkb_multilinestring,
+ Geometry::wkb_linestring)
+ { }
+ const Type_handler *type_handler() const
+ {
+ return &type_handler_multilinestring;
+ }
+ const char *func_name() const { return "multilinestring"; }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_multilinestring>(thd, this); }
+};
+
+
+class Item_func_multipoint: public Item_func_spatial_collection
+{
+public:
+ Item_func_multipoint(THD *thd, List<Item> &list)
+ :Item_func_spatial_collection(thd, list,
+ Geometry::wkb_multipoint,
+ Geometry::wkb_point)
+ { }
+ const Type_handler *type_handler() const
+ {
+ return &type_handler_multipoint;
+ }
+ const char *func_name() const { return "multipoint"; }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_multipoint>(thd, this); }
+};
+
+
+class Item_func_multipolygon: public Item_func_spatial_collection
+{
+public:
+ Item_func_multipolygon(THD *thd, List<Item> &list)
+ :Item_func_spatial_collection(thd, list,
+ Geometry::wkb_multipolygon,
+ Geometry::wkb_polygon)
+ { }
+ const Type_handler *type_handler() const
+ {
+ return &type_handler_multipolygon;
+ }
+ const char *func_name() const { return "multipolygon"; }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_multipolygon>(thd, this); }
+};
+
+
+
/*
Spatial relations
*/
@@ -546,7 +668,8 @@ protected:
bool check_arguments() const
{
DBUG_ASSERT(arg_count >= 2);
- return check_argument_types_or_binary(&type_handler_geometry, 0, 2);
+ return Type_handler_geometry::check_types_geom_or_binary(func_name(),
+ args, 0, 2);
}
public:
Item_func_spatial_rel(THD *thd, Item *a, Item *b, enum Functype sp_rel):
@@ -641,7 +764,8 @@ class Item_func_spatial_operation: public Item_geometry_func
bool check_arguments() const
{
DBUG_ASSERT(arg_count >= 2);
- return check_argument_types_or_binary(&type_handler_geometry, 0, 2);
+ return Type_handler_geometry::check_types_geom_or_binary(func_name(),
+ args, 0, 2);
}
public:
Gcalc_function::op_type spatial_op;
@@ -945,7 +1069,10 @@ public:
:Item_geometry_func_args_geometry(thd, a) {}
const char *func_name() const { return "st_pointonsurface"; }
String *val_str(String *);
- Field::geometry_type get_geometry_type() const;
+ const Type_handler *type_handler() const
+ {
+ return &type_handler_point;
+ }
Item *get_copy(THD *thd)
{ return get_item_copy<Item_func_pointonsurface>(thd, this); }
};
@@ -971,10 +1098,12 @@ class Item_func_gis_debug: public Item_long_func
#define GEOM_NEW(thd, obj_constructor) new (thd->mem_root) obj_constructor
+#define GEOM_TYPE(x) (x)
#else /*HAVE_SPATIAL*/
#define GEOM_NEW(thd, obj_constructor) NULL
+#define GEOM_TYPE(x) NULL
#endif /*HAVE_SPATIAL*/
#endif /* ITEM_GEOFUNC_INCLUDED */
diff --git a/sql/item_inetfunc.cc b/sql/item_inetfunc.cc
deleted file mode 100644
index 082584181a4..00000000000
--- a/sql/item_inetfunc.cc
+++ /dev/null
@@ -1,967 +0,0 @@
-/* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
- Copyright (c) 2014 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-1335 USA */
-
-#include "mariadb.h"
-#include "item_inetfunc.h"
-
-#include "my_net.h"
-
-///////////////////////////////////////////////////////////////////////////
-
-static const size_t IN_ADDR_SIZE= 4;
-static const size_t IN_ADDR_MAX_CHAR_LENGTH= 15;
-
-static const size_t IN6_ADDR_SIZE= 16;
-static const size_t IN6_ADDR_NUM_WORDS= IN6_ADDR_SIZE / 2;
-
-/**
- Non-abbreviated syntax is 8 groups, up to 4 digits each,
- plus 7 delimiters between the groups.
- Abbreviated syntax is even shorter.
-*/
-static const uint IN6_ADDR_MAX_CHAR_LENGTH= 8 * 4 + 7;
-
-static const char HEX_DIGITS[]= "0123456789abcdef";
-
-///////////////////////////////////////////////////////////////////////////
-
-longlong Item_func_inet_aton::val_int()
-{
- DBUG_ASSERT(fixed);
-
- uint byte_result= 0;
- ulonglong result= 0; // We are ready for 64 bit addresses
- const char *p,* end;
- char c= '.'; // we mark c to indicate invalid IP in case length is 0
- int dot_count= 0;
-
- StringBuffer<36> tmp;
- String *s= args[0]->val_str_ascii(&tmp);
-
- if (!s) // If null value
- goto err;
-
- null_value= 0;
-
- end= (p = s->ptr()) + s->length();
- while (p < end)
- {
- c= *p++;
- int digit= (int) (c - '0');
- if (digit >= 0 && digit <= 9)
- {
- if ((byte_result= byte_result * 10 + digit) > 255)
- goto err; // Wrong address
- }
- else if (c == '.')
- {
- dot_count++;
- result= (result << 8) + (ulonglong) byte_result;
- byte_result= 0;
- }
- else
- goto err; // Invalid character
- }
- if (c != '.') // IP number can't end on '.'
- {
- /*
- Attempt to support short forms of IP-addresses. It's however pretty
- basic one comparing to the BSD support.
- Examples:
- 127 -> 0.0.0.127
- 127.255 -> 127.0.0.255
- 127.256 -> NULL (should have been 127.0.1.0)
- 127.2.1 -> 127.2.0.1
- */
- switch (dot_count) {
- case 1: result<<= 8; /* Fall through */
- case 2: result<<= 8; /* Fall through */
- }
- return (result << 8) + (ulonglong) byte_result;
- }
-
-err:
- null_value=1;
- return 0;
-}
-
-
-String* Item_func_inet_ntoa::val_str(String* str)
-{
- DBUG_ASSERT(fixed);
-
- ulonglong n= (ulonglong) args[0]->val_int();
-
- /*
- We do not know if args[0] is NULL until we have called
- some val function on it if args[0] is not a constant!
-
- Also return null if n > 255.255.255.255
- */
- if ((null_value= (args[0]->null_value || n > 0xffffffff)))
- return 0; // Null value
-
- str->set_charset(collation.collation);
- str->length(0);
-
- uchar buf[8];
- int4store(buf, n);
-
- /* Now we can assume little endian. */
-
- char num[4];
- num[3]= '.';
-
- for (uchar *p= buf + 4; p-- > buf;)
- {
- uint c= *p;
- uint n1, n2; // Try to avoid divisions
- n1= c / 100; // 100 digits
- c-= n1 * 100;
- n2= c / 10; // 10 digits
- c-= n2 * 10; // last digit
- num[0]= (char) n1 + '0';
- num[1]= (char) n2 + '0';
- num[2]= (char) c + '0';
- uint length= (n1 ? 4 : n2 ? 3 : 2); // Remove pre-zero
- uint dot_length= (p <= buf) ? 1 : 0;
- (void) str->append(num + 4 - length, length - dot_length,
- &my_charset_latin1);
- }
-
- return str;
-}
-
-///////////////////////////////////////////////////////////////////////////
-
-
-class Inet4
-{
- char m_buffer[IN_ADDR_SIZE];
-protected:
- bool ascii_to_ipv4(const char *str, size_t length);
- bool character_string_to_ipv4(const char *str, size_t str_length,
- CHARSET_INFO *cs)
- {
- if (cs->state & MY_CS_NONASCII)
- {
- char tmp[IN_ADDR_MAX_CHAR_LENGTH];
- String_copier copier;
- uint length= copier.well_formed_copy(&my_charset_latin1, tmp, sizeof(tmp),
- cs, str, str_length);
- return ascii_to_ipv4(tmp, length);
- }
- return ascii_to_ipv4(str, str_length);
- }
- bool binary_to_ipv4(const char *str, size_t length)
- {
- if (length != sizeof(m_buffer))
- return true;
- memcpy(m_buffer, str, length);
- return false;
- }
- // Non-initializing constructor
- Inet4() { }
-public:
- void to_binary(char *dst, size_t dstsize) const
- {
- DBUG_ASSERT(dstsize >= sizeof(m_buffer));
- memcpy(dst, m_buffer, sizeof(m_buffer));
- }
- bool to_binary(String *to) const
- {
- return to->copy(m_buffer, sizeof(m_buffer), &my_charset_bin);
- }
- size_t to_string(char *dst, size_t dstsize) const;
- bool to_string(String *to) const
- {
- to->set_charset(&my_charset_latin1);
- if (to->alloc(INET_ADDRSTRLEN))
- return true;
- to->length((uint32) to_string((char*) to->ptr(), INET_ADDRSTRLEN));
- return false;
- }
-};
-
-
-class Inet4_null: public Inet4, public Null_flag
-{
-public:
- // Initialize from a text representation
- Inet4_null(const char *str, size_t length, CHARSET_INFO *cs)
- :Null_flag(character_string_to_ipv4(str, length, cs))
- { }
- Inet4_null(const String &str)
- :Inet4_null(str.ptr(), str.length(), str.charset())
- { }
- // Initialize from a binary representation
- Inet4_null(const char *str, size_t length)
- :Null_flag(binary_to_ipv4(str, length))
- { }
- Inet4_null(const Binary_string &str)
- :Inet4_null(str.ptr(), str.length())
- { }
-public:
- const Inet4& to_inet4() const
- {
- DBUG_ASSERT(!is_null());
- return *this;
- }
- void to_binary(char *dst, size_t dstsize) const
- {
- to_inet4().to_binary(dst, dstsize);
- }
- bool to_binary(String *to) const
- {
- return to_inet4().to_binary(to);
- }
- size_t to_string(char *dst, size_t dstsize) const
- {
- return to_inet4().to_string(dst, dstsize);
- }
- bool to_string(String *to) const
- {
- return to_inet4().to_string(to);
- }
-};
-
-
-class Inet6
-{
- char m_buffer[IN6_ADDR_SIZE];
-protected:
- bool make_from_item(Item *item);
- bool ascii_to_ipv6(const char *str, size_t str_length);
- bool character_string_to_ipv6(const char *str, size_t str_length,
- CHARSET_INFO *cs)
- {
- if (cs->state & MY_CS_NONASCII)
- {
- char tmp[IN6_ADDR_MAX_CHAR_LENGTH];
- String_copier copier;
- uint length= copier.well_formed_copy(&my_charset_latin1, tmp, sizeof(tmp),
- cs, str, str_length);
- return ascii_to_ipv6(tmp, length);
- }
- return ascii_to_ipv6(str, str_length);
- }
- bool binary_to_ipv6(const char *str, size_t length)
- {
- if (length != sizeof(m_buffer))
- return true;
- memcpy(m_buffer, str, length);
- return false;
- }
- // Non-initializing constructor
- Inet6() { }
-public:
- bool to_binary(String *to) const
- {
- return to->copy(m_buffer, sizeof(m_buffer), &my_charset_bin);
- }
- size_t to_string(char *dst, size_t dstsize) const;
- bool to_string(String *to) const
- {
- to->set_charset(&my_charset_latin1);
- if (to->alloc(INET6_ADDRSTRLEN))
- return true;
- to->length((uint32) to_string((char*) to->ptr(), INET6_ADDRSTRLEN));
- return false;
- }
- bool is_v4compat() const
- {
- static_assert(sizeof(in6_addr) == IN6_ADDR_SIZE, "unexpected in6_addr size");
- return IN6_IS_ADDR_V4COMPAT((struct in6_addr *) m_buffer);
- }
- bool is_v4mapped() const
- {
- static_assert(sizeof(in6_addr) == IN6_ADDR_SIZE, "unexpected in6_addr size");
- return IN6_IS_ADDR_V4MAPPED((struct in6_addr *) m_buffer);
- }
-};
-
-
-class Inet6_null: public Inet6, public Null_flag
-{
-public:
- // Initialize from a text representation
- Inet6_null(const char *str, size_t length, CHARSET_INFO *cs)
- :Null_flag(character_string_to_ipv6(str, length, cs))
- { }
- Inet6_null(const String &str)
- :Inet6_null(str.ptr(), str.length(), str.charset())
- { }
- // Initialize from a binary representation
- Inet6_null(const char *str, size_t length)
- :Null_flag(binary_to_ipv6(str, length))
- { }
- Inet6_null(const Binary_string &str)
- :Inet6_null(str.ptr(), str.length())
- { }
- // Initialize from an Item
- Inet6_null(Item *item)
- :Null_flag(make_from_item(item))
- { }
-public:
- const Inet6& to_inet6() const
- {
- DBUG_ASSERT(!is_null());
- return *this;
- }
- bool to_binary(String *to) const
- {
- DBUG_ASSERT(!is_null());
- return to_inet6().to_binary(to);
- }
- size_t to_string(char *dst, size_t dstsize) const
- {
- return to_inet6().to_string(dst, dstsize);
- }
- bool to_string(String *to) const
- {
- return to_inet6().to_string(to);
- }
- bool is_v4compat() const
- {
- return to_inet6().is_v4compat();
- }
- bool is_v4mapped() const
- {
- return to_inet6().is_v4mapped();
- }
-};
-
-
-bool Inet6::make_from_item(Item *item)
-{
- String tmp(m_buffer, sizeof(m_buffer), &my_charset_bin);
- String *str= item->val_str(&tmp);
- /*
- Charset could be tested in item->collation.collation before the val_str()
- call, but traditionally Inet6 functions still call item->val_str()
- for non-binary arguments and therefore execute side effects.
- */
- if (!str || str->length() != sizeof(m_buffer) ||
- str->charset() != &my_charset_bin)
- return true;
- if (str->ptr() != m_buffer)
- memcpy(m_buffer, str->ptr(), sizeof(m_buffer));
- return false;
-};
-
-
-/**
- Tries to convert given string to binary IPv4-address representation.
- This is a portable alternative to inet_pton(AF_INET).
-
- @param str String to convert.
- @param str_length String length.
-
- @return Completion status.
- @retval true - error, the given string does not represent an IPv4-address.
- @retval false - ok, the string has been converted sucessfully.
-
- @note The problem with inet_pton() is that it treats leading zeros in
- IPv4-part differently on different platforms.
-*/
-
-bool Inet4::ascii_to_ipv4(const char *str, size_t str_length)
-{
- if (str_length < 7)
- {
- DBUG_PRINT("error", ("ascii_to_ipv4(%.*s): "
- "invalid IPv4 address: too short.",
- (int) str_length, str));
- return true;
- }
-
- if (str_length > IN_ADDR_MAX_CHAR_LENGTH)
- {
- DBUG_PRINT("error", ("ascii_to_ipv4(%.*s): "
- "invalid IPv4 address: too long.",
- (int) str_length, str));
- return true;
- }
-
- unsigned char *ipv4_bytes= (unsigned char *) &m_buffer;
- const char *str_end= str + str_length;
- const char *p= str;
- int byte_value= 0;
- int chars_in_group= 0;
- int dot_count= 0;
- char c= 0;
-
- while (p < str_end && *p)
- {
- c= *p++;
-
- if (my_isdigit(&my_charset_latin1, c))
- {
- ++chars_in_group;
-
- if (chars_in_group > 3)
- {
- DBUG_PRINT("error", ("ascii_to_ipv4(%.*s): invalid IPv4 address: "
- "too many characters in a group.",
- (int) str_length, str));
- return true;
- }
-
- byte_value= byte_value * 10 + (c - '0');
-
- if (byte_value > 255)
- {
- DBUG_PRINT("error", ("ascii_to_ipv4(%.*s): invalid IPv4 address: "
- "invalid byte value.",
- (int) str_length, str));
- return true;
- }
- }
- else if (c == '.')
- {
- if (chars_in_group == 0)
- {
- DBUG_PRINT("error", ("ascii_to_ipv4(%.*s): invalid IPv4 address: "
- "too few characters in a group.",
- (int) str_length, str));
- return true;
- }
-
- ipv4_bytes[dot_count]= (unsigned char) byte_value;
-
- ++dot_count;
- byte_value= 0;
- chars_in_group= 0;
-
- if (dot_count > 3)
- {
- DBUG_PRINT("error", ("ascii_to_ipv4(%.*s): invalid IPv4 address: "
- "too many dots.", (int) str_length, str));
- return true;
- }
- }
- else
- {
- DBUG_PRINT("error", ("ascii_to_ipv4(%.*s): invalid IPv4 address: "
- "invalid character at pos %d.",
- (int) str_length, str, (int) (p - str)));
- return true;
- }
- }
-
- if (c == '.')
- {
- DBUG_PRINT("error", ("ascii_to_ipv4(%.*s): invalid IPv4 address: "
- "ending at '.'.", (int) str_length, str));
- return true;
- }
-
- if (dot_count != 3)
- {
- DBUG_PRINT("error", ("ascii_to_ipv4(%.*s): invalid IPv4 address: "
- "too few groups.",
- (int) str_length, str));
- return true;
- }
-
- ipv4_bytes[3]= (unsigned char) byte_value;
-
- DBUG_PRINT("info", ("ascii_to_ipv4(%.*s): valid IPv4 address: %d.%d.%d.%d",
- (int) str_length, str,
- ipv4_bytes[0], ipv4_bytes[1],
- ipv4_bytes[2], ipv4_bytes[3]));
- return false;
-}
-
-
-/**
- Tries to convert given string to binary IPv6-address representation.
- This is a portable alternative to inet_pton(AF_INET6).
-
- @param str String to convert.
- @param str_length String length.
-
- @return Completion status.
- @retval true - error, the given string does not represent an IPv6-address.
- @retval false - ok, the string has been converted sucessfully.
-
- @note The problem with inet_pton() is that it treats leading zeros in
- IPv4-part differently on different platforms.
-*/
-
-bool Inet6::ascii_to_ipv6(const char *str, size_t str_length)
-{
- if (str_length < 2)
- {
- DBUG_PRINT("error", ("ascii_to_ipv6(%.*s): invalid IPv6 address: too short.",
- (int) str_length, str));
- return true;
- }
-
- if (str_length > IN6_ADDR_MAX_CHAR_LENGTH)
- {
- DBUG_PRINT("error", ("ascii_to_ipv6(%.*s): invalid IPv6 address: too long.",
- (int) str_length, str));
- return true;
- }
-
- memset(m_buffer, 0, sizeof(m_buffer));
-
- const char *p= str;
-
- if (*p == ':')
- {
- ++p;
-
- if (*p != ':')
- {
- DBUG_PRINT("error", ("ascii_to_ipv6(%.*s): invalid IPv6 address: "
- "can not start with ':x'.", (int) str_length, str));
- return true;
- }
- }
-
- const char *str_end= str + str_length;
- char *ipv6_bytes_end= m_buffer + sizeof(m_buffer);
- char *dst= m_buffer;
- char *gap_ptr= NULL;
- const char *group_start_ptr= p;
- int chars_in_group= 0;
- int group_value= 0;
-
- while (p < str_end && *p)
- {
- char c= *p++;
-
- if (c == ':')
- {
- group_start_ptr= p;
-
- if (!chars_in_group)
- {
- if (gap_ptr)
- {
- DBUG_PRINT("error", ("ascii_to_ipv6(%.*s): invalid IPv6 address: "
- "too many gaps(::).", (int) str_length, str));
- return true;
- }
-
- gap_ptr= dst;
- continue;
- }
-
- if (!*p || p >= str_end)
- {
- DBUG_PRINT("error", ("ascii_to_ipv6(%.*s): invalid IPv6 address: "
- "ending at ':'.", (int) str_length, str));
- return true;
- }
-
- if (dst + 2 > ipv6_bytes_end)
- {
- DBUG_PRINT("error", ("ascii_to_ipv6(%.*s): invalid IPv6 address: "
- "too many groups (1).", (int) str_length, str));
- return true;
- }
-
- dst[0]= (unsigned char) (group_value >> 8) & 0xff;
- dst[1]= (unsigned char) group_value & 0xff;
- dst += 2;
-
- chars_in_group= 0;
- group_value= 0;
- }
- else if (c == '.')
- {
- if (dst + IN_ADDR_SIZE > ipv6_bytes_end)
- {
- DBUG_PRINT("error", ("ascii_to_ipv6(%.*s): invalid IPv6 address: "
- "unexpected IPv4-part.", (int) str_length, str));
- return true;
- }
-
- Inet4_null tmp(group_start_ptr, (size_t) (str_end - group_start_ptr),
- &my_charset_latin1);
- if (tmp.is_null())
- {
- DBUG_PRINT("error", ("ascii_to_ipv6(%.*s): invalid IPv6 address: "
- "invalid IPv4-part.", (int) str_length, str));
- return true;
- }
-
- tmp.to_binary(dst, IN_ADDR_SIZE);
- dst += IN_ADDR_SIZE;
- chars_in_group= 0;
-
- break;
- }
- else
- {
- const char *hdp= strchr(HEX_DIGITS, my_tolower(&my_charset_latin1, c));
-
- if (!hdp)
- {
- DBUG_PRINT("error", ("ascii_to_ipv6(%.*s): invalid IPv6 address: "
- "invalid character at pos %d.",
- (int) str_length, str, (int) (p - str)));
- return true;
- }
-
- if (chars_in_group >= 4)
- {
- DBUG_PRINT("error", ("ascii_to_ipv6(%.*s): invalid IPv6 address: "
- "too many digits in group.",
- (int) str_length, str));
- return true;
- }
-
- group_value <<= 4;
- group_value |= hdp - HEX_DIGITS;
-
- DBUG_ASSERT(group_value <= 0xffff);
-
- ++chars_in_group;
- }
- }
-
- if (chars_in_group > 0)
- {
- if (dst + 2 > ipv6_bytes_end)
- {
- DBUG_PRINT("error", ("ascii_to_ipv6(%.*s): invalid IPv6 address: "
- "too many groups (2).", (int) str_length, str));
- return true;
- }
-
- dst[0]= (unsigned char) (group_value >> 8) & 0xff;
- dst[1]= (unsigned char) group_value & 0xff;
- dst += 2;
- }
-
- if (gap_ptr)
- {
- if (dst == ipv6_bytes_end)
- {
- DBUG_PRINT("error", ("ascii_to_ipv6(%.*s): invalid IPv6 address: "
- "no room for a gap (::).", (int) str_length, str));
- return true;
- }
-
- int bytes_to_move= (int)(dst - gap_ptr);
-
- for (int i= 1; i <= bytes_to_move; ++i)
- {
- ipv6_bytes_end[-i]= gap_ptr[bytes_to_move - i];
- gap_ptr[bytes_to_move - i]= 0;
- }
-
- dst= ipv6_bytes_end;
- }
-
- if (dst < ipv6_bytes_end)
- {
- DBUG_PRINT("error", ("ascii_to_ipv6(%.*s): invalid IPv6 address: "
- "too few groups.", (int) str_length, str));
- return true;
- }
-
- return false;
-}
-
-
-/**
- Converts IPv4-binary-address to a string. This function is a portable
- alternative to inet_ntop(AF_INET).
-
- @param[in] ipv4 IPv4-address data (byte array)
- @param[out] dst A buffer to store string representation of IPv4-address.
- @param[in] dstsize Number of bytes avaiable in "dst"
-
- @note The problem with inet_ntop() is that it is available starting from
- Windows Vista, but the minimum supported version is Windows 2000.
-*/
-
-size_t Inet4::to_string(char *dst, size_t dstsize) const
-{
- return (size_t) my_snprintf(dst, dstsize, "%d.%d.%d.%d",
- (uchar) m_buffer[0], (uchar) m_buffer[1],
- (uchar) m_buffer[2], (uchar) m_buffer[3]);
-}
-
-
-/**
- Converts IPv6-binary-address to a string. This function is a portable
- alternative to inet_ntop(AF_INET6).
-
- @param[in] ipv6 IPv6-address data (byte array)
- @param[out] dst A buffer to store string representation of IPv6-address.
- It must be at least of INET6_ADDRSTRLEN.
- @param[in] dstsize Number of bytes available dst.
-
- @note The problem with inet_ntop() is that it is available starting from
- Windows Vista, but out the minimum supported version is Windows 2000.
-*/
-
-size_t Inet6::to_string(char *dst, size_t dstsize) const
-{
- struct Region
- {
- int pos;
- int length;
- };
-
- const char *ipv6= m_buffer;
- char *dstend= dst + dstsize;
- const unsigned char *ipv6_bytes= (const unsigned char *) ipv6;
-
- // 1. Translate IPv6-address bytes to words.
- // We can't just cast to short, because it's not guaranteed
- // that sizeof (short) == 2. So, we have to make a copy.
-
- uint16 ipv6_words[IN6_ADDR_NUM_WORDS];
-
- DBUG_ASSERT(dstsize > 0); // Need a space at least for the trailing '\0'
- for (size_t i= 0; i < IN6_ADDR_NUM_WORDS; ++i)
- ipv6_words[i]= (ipv6_bytes[2 * i] << 8) + ipv6_bytes[2 * i + 1];
-
- // 2. Find "the gap" -- longest sequence of zeros in IPv6-address.
-
- Region gap= { -1, -1 };
-
- {
- Region rg= { -1, -1 };
-
- for (size_t i= 0; i < IN6_ADDR_NUM_WORDS; ++i)
- {
- if (ipv6_words[i] != 0)
- {
- if (rg.pos >= 0)
- {
- if (rg.length > gap.length)
- gap= rg;
-
- rg.pos= -1;
- rg.length= -1;
- }
- }
- else
- {
- if (rg.pos >= 0)
- {
- ++rg.length;
- }
- else
- {
- rg.pos= (int) i;
- rg.length= 1;
- }
- }
- }
-
- if (rg.pos >= 0)
- {
- if (rg.length > gap.length)
- gap= rg;
- }
- }
-
- // 3. Convert binary data to string.
-
- char *p= dst;
-
- for (int i= 0; i < (int) IN6_ADDR_NUM_WORDS; ++i)
- {
- DBUG_ASSERT(dstend >= p);
- size_t dstsize_available= dstend - p;
- if (dstsize_available < 5)
- break;
- if (i == gap.pos)
- {
- // We're at the gap position. We should put trailing ':' and jump to
- // the end of the gap.
-
- if (i == 0)
- {
- // The gap starts from the beginning of the data -- leading ':'
- // should be put additionally.
-
- *p= ':';
- ++p;
- }
-
- *p= ':';
- ++p;
-
- i += gap.length - 1;
- }
- else if (i == 6 && gap.pos == 0 &&
- (gap.length == 6 || // IPv4-compatible
- (gap.length == 5 && ipv6_words[5] == 0xffff) // IPv4-mapped
- ))
- {
- // The data represents either IPv4-compatible or IPv4-mapped address.
- // The IPv6-part (zeros or zeros + ffff) has been already put into
- // the string (dst). Now it's time to dump IPv4-part.
-
- return (size_t) (p - dst) +
- Inet4_null((const char *) (ipv6_bytes + 12), 4).
- to_string(p, dstsize_available);
- }
- else
- {
- // Usual IPv6-address-field. Print it out using lower-case
- // hex-letters without leading zeros (recommended IPv6-format).
- //
- // If it is not the last field, append closing ':'.
-
- p += sprintf(p, "%x", ipv6_words[i]);
-
- if (i + 1 != IN6_ADDR_NUM_WORDS)
- {
- *p= ':';
- ++p;
- }
- }
- }
-
- *p= 0;
- return (size_t) (p - dst);
-}
-
-///////////////////////////////////////////////////////////////////////////
-
-/**
- Converts IP-address-string to IP-address-data.
-
- ipv4-string -> varbinary(4)
- ipv6-string -> varbinary(16)
-
- @return Completion status.
- @retval NULL Given string does not represent an IP-address.
- @retval !NULL The string has been converted sucessfully.
-*/
-
-String *Item_func_inet6_aton::val_str(String *buffer)
-{
- DBUG_ASSERT(fixed);
-
- Ascii_ptr_and_buffer<STRING_BUFFER_USUAL_SIZE> tmp(args[0]);
- if ((null_value= tmp.is_null()))
- return NULL;
-
- Inet4_null ipv4(*tmp.string());
- if (!ipv4.is_null())
- {
- ipv4.to_binary(buffer);
- return buffer;
- }
-
- Inet6_null ipv6(*tmp.string());
- if (!ipv6.is_null())
- {
- ipv6.to_binary(buffer);
- return buffer;
- }
-
- null_value= true;
- return NULL;
-}
-
-
-/**
- Converts IP-address-data to IP-address-string.
-*/
-
-String *Item_func_inet6_ntoa::val_str_ascii(String *buffer)
-{
- DBUG_ASSERT(fixed);
-
- // Binary string argument expected
- if (unlikely(args[0]->result_type() != STRING_RESULT ||
- args[0]->collation.collation != &my_charset_bin))
- {
- null_value= true;
- return NULL;
- }
-
- String_ptr_and_buffer<STRING_BUFFER_USUAL_SIZE> tmp(args[0]);
- if ((null_value= tmp.is_null()))
- return NULL;
-
- Inet4_null ipv4(static_cast<const Binary_string&>(*tmp.string()));
- if (!ipv4.is_null())
- {
- ipv4.to_string(buffer);
- return buffer;
- }
-
- Inet6_null ipv6(static_cast<const Binary_string&>(*tmp.string()));
- if (!ipv6.is_null())
- {
- ipv6.to_string(buffer);
- return buffer;
- }
-
- DBUG_PRINT("info", ("INET6_NTOA(): varbinary(4) or varbinary(16) expected."));
- null_value= true;
- return NULL;
-}
-
-
-/**
- Checks if the passed string represents an IPv4-address.
-*/
-
-longlong Item_func_is_ipv4::val_int()
-{
- DBUG_ASSERT(fixed);
- String_ptr_and_buffer<STRING_BUFFER_USUAL_SIZE> tmp(args[0]);
- return !tmp.is_null() && !Inet4_null(*tmp.string()).is_null();
-}
-
-
-/**
- Checks if the passed string represents an IPv6-address.
-*/
-
-longlong Item_func_is_ipv6::val_int()
-{
- DBUG_ASSERT(fixed);
- String_ptr_and_buffer<STRING_BUFFER_USUAL_SIZE> tmp(args[0]);
- return !tmp.is_null() && !Inet6_null(*tmp.string()).is_null();
-}
-
-
-/**
- Checks if the passed IPv6-address is an IPv4-compat IPv6-address.
-*/
-
-longlong Item_func_is_ipv4_compat::val_int()
-{
- Inet6_null ip6(args[0]);
- return !ip6.is_null() && ip6.is_v4compat();
-}
-
-
-/**
- Checks if the passed IPv6-address is an IPv4-mapped IPv6-address.
-*/
-
-longlong Item_func_is_ipv4_mapped::val_int()
-{
- Inet6_null ip6(args[0]);
- return !ip6.is_null() && ip6.is_v4mapped();
-}
diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc
index a90e7fb3a1a..72c0dfcdf6d 100644
--- a/sql/item_jsonfunc.cc
+++ b/sql/item_jsonfunc.cc
@@ -439,7 +439,17 @@ bool Item_func_json_value::fix_length_and_dec()
{
collation.set(args[0]->collation);
max_length= args[0]->max_length;
- path.set_constant_flag(args[1]->const_item());
+ set_constant_flag(args[1]->const_item());
+ maybe_null= 1;
+ return FALSE;
+}
+
+
+bool Item_func_json_query::fix_length_and_dec()
+{
+ collation.set(args[0]->collation);
+ max_length= args[0]->max_length;
+ set_constant_flag(args[1]->const_item());
maybe_null= 1;
return FALSE;
}
@@ -449,115 +459,100 @@ bool Item_func_json_value::fix_length_and_dec()
Returns NULL, not an error if the found value
is not a scalar.
*/
-String *Item_func_json_value::val_str(String *str)
+bool Json_path_extractor::extract(String *str, Item *item_js, Item *item_jp,
+ CHARSET_INFO *cs)
{
- json_engine_t je;
- String *js= args[0]->val_json(&tmp_js);
+ String *js= item_js->val_json(&tmp_js);
int error= 0;
uint array_counters[JSON_DEPTH_LIMIT];
- if (!path.parsed)
+ if (!parsed)
{
- String *s_p= args[1]->val_str(&tmp_path);
+ String *s_p= item_jp->val_str(&tmp_path);
if (s_p &&
- json_path_setup(&path.p, s_p->charset(), (const uchar *) s_p->ptr(),
+ json_path_setup(&p, s_p->charset(), (const uchar *) s_p->ptr(),
(const uchar *) s_p->ptr() + s_p->length()))
- goto err_return;
- path.parsed= path.constant;
+ return true;
+ parsed= constant;
}
- if ((null_value= args[0]->null_value || args[1]->null_value))
- return NULL;
-
- json_scan_start(&je, js->charset(),(const uchar *) js->ptr(),
- (const uchar *) js->ptr() + js->length());
+ if (item_js->null_value || item_jp->null_value)
+ return true;
+ Json_engine_scan je(*js);
str->length(0);
- str->set_charset(collation.collation);
+ str->set_charset(cs);
- path.cur_step= path.p.steps;
+ cur_step= p.steps;
continue_search:
- if (json_find_path(&je, &path.p, &path.cur_step, array_counters))
- {
- if (je.s.error)
- goto err_return;
-
- null_value= 1;
- return 0;
- }
+ if (json_find_path(&je, &p, &cur_step, array_counters))
+ return true;
if (json_read_value(&je))
- goto err_return;
+ return true;
if (unlikely(check_and_get_value(&je, str, &error)))
{
if (error)
- goto err_return;
+ return true;
goto continue_search;
}
- return str;
-
-err_return:
- null_value= 1;
- return 0;
+ return false;
}
-bool Item_func_json_value::check_and_get_value(json_engine_t *je, String *res,
- int *error)
+bool Json_engine_scan::check_and_get_value_scalar(String *res, int *error)
{
CHARSET_INFO *json_cs;
const uchar *js;
uint js_len;
- if (!json_value_scalar(je))
+ if (!json_value_scalar(this))
{
/* We only look for scalar values! */
- if (json_skip_level(je) || json_scan_next(je))
+ if (json_skip_level(this) || json_scan_next(this))
*error= 1;
return true;
}
- if (je->value_type == JSON_VALUE_TRUE ||
- je->value_type == JSON_VALUE_FALSE)
+ if (value_type == JSON_VALUE_TRUE ||
+ value_type == JSON_VALUE_FALSE)
{
json_cs= &my_charset_utf8mb4_bin;
- js= (const uchar *) ((je->value_type == JSON_VALUE_TRUE) ? "1" : "0");
+ js= (const uchar *) ((value_type == JSON_VALUE_TRUE) ? "1" : "0");
js_len= 1;
}
else
{
- json_cs= je->s.cs;
- js= je->value;
- js_len= je->value_len;
+ json_cs= s.cs;
+ js= value;
+ js_len= value_len;
}
- return st_append_json(res, json_cs, js, js_len);
+ return st_append_json(res, json_cs, js, js_len);
}
-bool Item_func_json_query::check_and_get_value(json_engine_t *je, String *res,
- int *error)
+bool Json_engine_scan::check_and_get_value_complex(String *res, int *error)
{
- const uchar *value;
- if (json_value_scalar(je))
+ if (json_value_scalar(this))
{
/* We skip scalar values. */
- if (json_scan_next(je))
+ if (json_scan_next(this))
*error= 1;
return true;
}
- value= je->value;
- if (json_skip_level(je))
+ const uchar *tmp_value= value;
+ if (json_skip_level(this))
{
*error= 1;
return true;
}
- res->set((const char *) je->value, (uint32)(je->s.c_str - value), je->s.cs);
+ res->set((const char *) value, (uint32)(s.c_str - tmp_value), s.cs);
return false;
}
@@ -600,7 +595,7 @@ String *Item_func_json_quote::val_str(String *str)
bool Item_func_json_unquote::fix_length_and_dec()
{
- collation.set(&my_charset_utf8_general_ci,
+ collation.set(&my_charset_utf8mb3_general_ci,
DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII);
max_length= args[0]->max_length;
maybe_null= 1;
@@ -645,12 +640,12 @@ String *Item_func_json_unquote::val_str(String *str)
return js;
str->length(0);
- str->set_charset(&my_charset_utf8_general_ci);
+ str->set_charset(&my_charset_utf8mb3_general_ci);
if (str->realloc_with_extra_if_needed(je.value_len) ||
(c_len= json_unescape(js->charset(),
je.value, je.value + je.value_len,
- &my_charset_utf8_general_ci,
+ &my_charset_utf8mb3_general_ci,
(uchar *) str->ptr(), (uchar *) (str->ptr() + je.value_len))) < 0)
goto error;
@@ -680,7 +675,7 @@ static int alloc_tmp_paths(THD *thd, uint n_paths,
return 1;
for (uint c_path=0; c_path < n_paths; c_path++)
- (*tmp_paths)[c_path].set_charset(&my_charset_utf8_general_ci);
+ (*tmp_paths)[c_path].set_charset(&my_charset_utf8mb3_general_ci);
}
return 0;
@@ -2619,7 +2614,7 @@ longlong Item_func_json_depth::val_int()
bool Item_func_json_type::fix_length_and_dec()
{
- collation.set(&my_charset_utf8_general_ci);
+ collation.set(&my_charset_utf8mb3_general_ci);
max_length= 12;
maybe_null= 1;
return FALSE;
@@ -2665,7 +2660,7 @@ String *Item_func_json_type::val_str(String *str)
break;
}
- str->set(type, strlen(type), &my_charset_utf8_general_ci);
+ str->set(type, strlen(type), &my_charset_utf8mb3_general_ci);
return str;
error:
@@ -3567,7 +3562,7 @@ int Arg_comparator::compare_json_str_basic(Item *j, Item *s)
if (value2.realloc_with_extra_if_needed(je.value_len) ||
(c_len= json_unescape(js->charset(), je.value,
je.value + je.value_len,
- &my_charset_utf8_general_ci,
+ &my_charset_utf8mb3_general_ci,
(uchar *) value2.ptr(),
(uchar *) (value2.ptr() + je.value_len))) < 0)
goto error;
@@ -3616,7 +3611,7 @@ int Arg_comparator::compare_e_json_str_basic(Item *j, Item *s)
if (value1.realloc_with_extra_if_needed(value_len) ||
(c_len= json_unescape(value1.charset(), (uchar *) value,
(uchar *) value+value_len,
- &my_charset_utf8_general_ci,
+ &my_charset_utf8mb3_general_ci,
(uchar *) value1.ptr(),
(uchar *) (value1.ptr() + value_len))) < 0)
return 1;
@@ -3626,3 +3621,25 @@ int Arg_comparator::compare_e_json_str_basic(Item *j, Item *s)
return MY_TEST(sortcmp(res1, res2, compare_collation()) == 0);
}
+
+
+String* Item_func_json_arrayagg::convert_to_json(Item *item, String *res)
+{
+ String tmp;
+ res->length(0);
+ append_json_value(res, item, &tmp);
+ return res;
+}
+
+
+String* Item_func_json_arrayagg::val_str(String *str)
+{
+ str= Item_func_group_concat::val_str(str);
+ String s;
+ s.append('[');
+ s.swap(*str);
+ str->append(s);
+ str->append(']');
+
+ return str;
+}
diff --git a/sql/item_jsonfunc.h b/sql/item_jsonfunc.h
index e9b77502e80..eadfbba7f29 100644
--- a/sql/item_jsonfunc.h
+++ b/sql/item_jsonfunc.h
@@ -23,6 +23,7 @@
#include <json_lib.h>
#include "item_cmpfunc.h" // Item_bool_func
#include "item_strfunc.h" // Item_str_func
+#include "item_sum.h"
class json_path_with_flags
@@ -40,6 +41,33 @@ public:
};
+class Json_engine_scan: public json_engine_t
+{
+public:
+ Json_engine_scan(CHARSET_INFO *i_cs, const uchar *str, const uchar *end)
+ {
+ json_scan_start(this, i_cs, str, end);
+ }
+ Json_engine_scan(const String &str)
+ :Json_engine_scan(str.charset(), (const uchar *) str.ptr(),
+ (const uchar *) str.end())
+ { }
+ bool check_and_get_value_scalar(String *res, int *error);
+ bool check_and_get_value_complex(String *res, int *error);
+};
+
+
+class Json_path_extractor: public json_path_with_flags
+{
+protected:
+ String tmp_js, tmp_path;
+ virtual ~Json_path_extractor() { }
+ virtual bool check_and_get_value(Json_engine_scan *je,
+ String *to, int *error)=0;
+ bool extract(String *to, Item *js, Item *jp, CHARSET_INFO *cs);
+};
+
+
class Item_func_json_valid: public Item_bool_func
{
protected:
@@ -78,33 +106,66 @@ public:
};
-class Item_func_json_value: public Item_str_func
+class Item_json_func: public Item_str_func
+{
+public:
+ Item_json_func(THD *thd)
+ :Item_str_func(thd) { }
+ Item_json_func(THD *thd, Item *a)
+ :Item_str_func(thd, a) { }
+ Item_json_func(THD *thd, Item *a, Item *b)
+ :Item_str_func(thd, a, b) { }
+ Item_json_func(THD *thd, List<Item> &list)
+ :Item_str_func(thd, list) { }
+ bool is_json_type() { return true; }
+};
+
+
+class Item_func_json_value: public Item_str_func,
+ public Json_path_extractor
{
-protected:
- json_path_with_flags path;
- String tmp_js, tmp_path;
public:
Item_func_json_value(THD *thd, Item *js, Item *i_path):
Item_str_func(thd, js, i_path) {}
- const char *func_name() const { return "json_value"; }
- bool fix_length_and_dec();
- String *val_str(String *);
- virtual bool check_and_get_value(json_engine_t *je, String *res, int *error);
- Item *get_copy(THD *thd)
+ const char *func_name() const override { return "json_value"; }
+ bool fix_length_and_dec() override ;
+ String *val_str(String *to) override
+ {
+ null_value= Json_path_extractor::extract(to, args[0], args[1],
+ collation.collation);
+ return null_value ? NULL : to;
+ }
+ bool check_and_get_value(Json_engine_scan *je,
+ String *res, int *error) override
+ {
+ return je->check_and_get_value_scalar(res, error);
+ }
+ Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_json_value>(thd, this); }
};
-class Item_func_json_query: public Item_func_json_value
+class Item_func_json_query: public Item_json_func,
+ public Json_path_extractor
{
public:
Item_func_json_query(THD *thd, Item *js, Item *i_path):
- Item_func_json_value(thd, js, i_path) {}
- bool is_json_type() { return true; }
- const char *func_name() const { return "json_query"; }
- bool check_and_get_value(json_engine_t *je, String *res, int *error);
- Item *get_copy(THD *thd)
+ Item_json_func(thd, js, i_path) {}
+ const char *func_name() const override { return "json_query"; }
+ bool fix_length_and_dec() override;
+ String *val_str(String *to) override
+ {
+ null_value= Json_path_extractor::extract(to, args[0], args[1],
+ collation.collation);
+ return null_value ? NULL : to;
+ }
+ bool check_and_get_value(Json_engine_scan *je,
+ String *res, int *error) override
+ {
+ return je->check_and_get_value_complex(res, error);
+ }
+ Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_json_query>(thd, this); }
};
@@ -139,18 +200,17 @@ public:
};
-class Item_json_str_multipath: public Item_str_func
+class Item_json_str_multipath: public Item_json_func
{
protected:
json_path_with_flags *paths;
String *tmp_paths;
public:
Item_json_str_multipath(THD *thd, List<Item> &list):
- Item_str_func(thd, list), tmp_paths(0) {}
+ Item_json_func(thd, list), tmp_paths(0) {}
bool fix_fields(THD *thd, Item **ref);
void cleanup();
virtual uint get_n_paths() const = 0;
- bool is_json_type() { return true; }
};
@@ -217,18 +277,17 @@ public:
};
-class Item_func_json_array: public Item_str_func
+class Item_func_json_array: public Item_json_func
{
protected:
String tmp_val;
ulong result_limit;
public:
Item_func_json_array(THD *thd):
- Item_str_func(thd) {}
+ Item_json_func(thd) {}
Item_func_json_array(THD *thd, List<Item> &list):
- Item_str_func(thd, list) {}
+ Item_json_func(thd, list) {}
String *val_str(String *);
- bool is_json_type() { return true; }
bool fix_length_and_dec();
const char *func_name() const { return "json_array"; }
Item *get_copy(THD *thd)
@@ -273,7 +332,6 @@ public:
Item_func_json_object(THD *thd, List<Item> &list):
Item_func_json_array(thd, list) {}
String *val_str(String *);
- bool is_json_type() { return true; }
const char *func_name() const { return "json_object"; }
Item *get_copy(THD *thd)
{ return get_item_copy<Item_func_json_object>(thd, this); }
@@ -288,7 +346,6 @@ public:
Item_func_json_merge(THD *thd, List<Item> &list):
Item_func_json_array(thd, list) {}
String *val_str(String *);
- bool is_json_type() { return true; }
const char *func_name() const { return "json_merge_preserve"; }
Item *get_copy(THD *thd)
{ return get_item_copy<Item_func_json_merge>(thd, this); }
@@ -439,7 +496,7 @@ public:
};
-class Item_func_json_format: public Item_str_func
+class Item_func_json_format: public Item_json_func
{
public:
enum formats
@@ -454,18 +511,44 @@ protected:
String tmp_js;
public:
Item_func_json_format(THD *thd, Item *js, formats format):
- Item_str_func(thd, js), fmt(format) {}
+ Item_json_func(thd, js), fmt(format) {}
Item_func_json_format(THD *thd, List<Item> &list):
- Item_str_func(thd, list), fmt(DETAILED) {}
+ Item_json_func(thd, list), fmt(DETAILED) {}
const char *func_name() const;
bool fix_length_and_dec();
String *val_str(String *str);
String *val_json(String *str);
- bool is_json_type() { return true; }
Item *get_copy(THD *thd)
{ return get_item_copy<Item_func_json_format>(thd, this); }
};
+class Item_func_json_arrayagg : public Item_func_group_concat
+{
+public:
+
+ Item_func_json_arrayagg(THD *thd, Name_resolution_context *context_arg,
+ bool is_distinct, List<Item> *is_select,
+ const SQL_I_List<ORDER> &is_order, String *is_separator,
+ bool limit_clause, Item *row_limit, Item *offset_limit):
+ Item_func_group_concat(thd, context_arg, is_distinct, is_select, is_order,
+ is_separator, limit_clause, row_limit, offset_limit)
+ {
+ }
+
+ const char *func_name() const { return "json_arrayagg("; }
+ enum Sumfunctype sum_func() const {return JSON_ARRAYAGG_FUNC;}
+
+ String* convert_to_json(Item *item, String *str);
+ String* val_str(String *str);
+
+ /* Overrides Item_func_group_concat::add() */
+ bool add()
+ {
+ return Item_func_group_concat::add(false);
+ }
+};
+
+
#endif /* ITEM_JSONFUNC_INCLUDED */
diff --git a/sql/item_row.cc b/sql/item_row.cc
index 150d57263b6..def1458df1b 100644
--- a/sql/item_row.cc
+++ b/sql/item_row.cc
@@ -87,6 +87,25 @@ Item_row::eval_not_null_tables(void *opt_arg)
}
+bool
+Item_row::find_not_null_fields(table_map allowed)
+{
+ if (~allowed & used_tables())
+ return false;
+
+ Item **arg,**arg_end;
+ if (arg_count)
+ {
+ for (arg= args, arg_end= args + arg_count; arg != arg_end ; arg++)
+ {
+ if (!(*arg)->find_not_null_fields(allowed))
+ continue;
+ }
+ }
+ return false;
+}
+
+
void Item_row::cleanup()
{
DBUG_ENTER("Item_row::cleanup");
diff --git a/sql/item_row.h b/sql/item_row.h
index ea5a0f21d8b..2872a498d55 100644
--- a/sql/item_row.h
+++ b/sql/item_row.h
@@ -60,7 +60,7 @@ public:
bool with_subquery() const { DBUG_ASSERT(fixed); return m_with_subquery; }
enum Type type() const { return ROW_ITEM; };
const Type_handler *type_handler() const { return &type_handler_row; }
- Field *create_tmp_field_ex(TABLE *table, Tmp_field_src *src,
+ Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src,
const Tmp_field_param *param)
{
return NULL; // Check with Vicentiu why it's called for Item_row
@@ -121,6 +121,7 @@ public:
}
Item *transform(THD *thd, Item_transformer transformer, uchar *arg);
bool eval_not_null_tables(void *opt_arg);
+ bool find_not_null_fields(table_map allowed);
uint cols() const { return arg_count; }
Item* element_index(uint i) { return args[i]; }
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index f571521b982..bf571473211 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -4407,24 +4407,7 @@ bool Item_func_dyncol_create::prepare_arguments(THD *thd, bool force_names_arg)
uint valpos= i * 2 + 1;
DYNAMIC_COLUMN_TYPE type= defs[i].type;
if (type == DYN_COL_NULL)
- switch (args[valpos]->field_type())
- {
- case MYSQL_TYPE_VARCHAR:
- case MYSQL_TYPE_ENUM:
- case MYSQL_TYPE_SET:
- case MYSQL_TYPE_TINY_BLOB:
- case MYSQL_TYPE_MEDIUM_BLOB:
- case MYSQL_TYPE_LONG_BLOB:
- case MYSQL_TYPE_BLOB:
- case MYSQL_TYPE_VAR_STRING:
- case MYSQL_TYPE_STRING:
- case MYSQL_TYPE_GEOMETRY:
- type= DYN_COL_STRING;
- break;
- default:
- break;
- }
-
+ type= args[valpos]->type_handler()->dyncol_type(args[valpos]);
if (type == DYN_COL_STRING &&
args[valpos]->type() == Item::FUNC_ITEM &&
((Item_func *)args[valpos])->functype() == DYNCOL_FUNC)
@@ -4441,63 +4424,7 @@ bool Item_func_dyncol_create::prepare_arguments(THD *thd, bool force_names_arg)
uint valpos= i * 2 + 1;
DYNAMIC_COLUMN_TYPE type= defs[i].type;
if (type == DYN_COL_NULL) // auto detect
- {
- /*
- We don't have a default here to ensure we get a warning if
- one adds a new not handled MYSQL_TYPE_...
- */
- switch (args[valpos]->field_type()) {
- case MYSQL_TYPE_DECIMAL:
- case MYSQL_TYPE_NEWDECIMAL:
- type= DYN_COL_DECIMAL;
- break;
- case MYSQL_TYPE_TINY:
- case MYSQL_TYPE_SHORT:
- case MYSQL_TYPE_LONG:
- case MYSQL_TYPE_LONGLONG:
- case MYSQL_TYPE_INT24:
- case MYSQL_TYPE_YEAR:
- case MYSQL_TYPE_BIT:
- type= args[valpos]->unsigned_flag ? DYN_COL_UINT : DYN_COL_INT;
- break;
- case MYSQL_TYPE_FLOAT:
- case MYSQL_TYPE_DOUBLE:
- type= DYN_COL_DOUBLE;
- break;
- case MYSQL_TYPE_NULL:
- type= DYN_COL_NULL;
- break;
- case MYSQL_TYPE_TIMESTAMP:
- case MYSQL_TYPE_TIMESTAMP2:
- case MYSQL_TYPE_DATETIME:
- case MYSQL_TYPE_DATETIME2:
- type= DYN_COL_DATETIME;
- break;
- case MYSQL_TYPE_DATE:
- case MYSQL_TYPE_NEWDATE:
- type= DYN_COL_DATE;
- break;
- case MYSQL_TYPE_TIME:
- case MYSQL_TYPE_TIME2:
- type= DYN_COL_TIME;
- break;
- case MYSQL_TYPE_VARCHAR:
- case MYSQL_TYPE_ENUM:
- case MYSQL_TYPE_SET:
- case MYSQL_TYPE_TINY_BLOB:
- case MYSQL_TYPE_MEDIUM_BLOB:
- case MYSQL_TYPE_LONG_BLOB:
- case MYSQL_TYPE_BLOB:
- case MYSQL_TYPE_VAR_STRING:
- case MYSQL_TYPE_STRING:
- case MYSQL_TYPE_GEOMETRY:
- type= DYN_COL_STRING;
- break;
- case MYSQL_TYPE_VARCHAR_COMPRESSED:
- case MYSQL_TYPE_BLOB_COMPRESSED:
- DBUG_ASSERT(0);
- }
- }
+ type= args[valpos]->type_handler()->dyncol_type(args[valpos]);
if (type == DYN_COL_STRING &&
args[valpos]->type() == Item::FUNC_ITEM &&
((Item_func *)args[valpos])->functype() == DYNCOL_FUNC)
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index 42b5b4f2aeb..81f72b6bb83 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -1802,8 +1802,8 @@ public:
TABLE *table;
Item_temptable_rowid(TABLE *table_arg);
const Type_handler *type_handler() const { return &type_handler_string; }
- Field *create_tmp_field(bool group, TABLE *table)
- { return create_table_field_from_handler(table); }
+ Field *create_tmp_field(MEM_ROOT *root, bool group, TABLE *table)
+ { return create_table_field_from_handler(root, table); }
String *val_str(String *str);
enum Functype functype() const { return TEMPTABLE_ROWID; }
const char *func_name() const { return "<rowid>"; }
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 86c607fb894..96344c0968b 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -47,6 +47,8 @@ double get_post_group_estimate(JOIN* join, double join_op_rows);
LEX_CSTRING exists_outer_expr_name= { STRING_WITH_LEN("<exists outer expr>") };
+LEX_CSTRING no_matter_name= {STRING_WITH_LEN("<no matter>") };
+
int check_and_do_in_subquery_rewrites(JOIN *join);
Item_subselect::Item_subselect(THD *thd_arg):
@@ -1938,8 +1940,8 @@ Item_in_subselect::single_value_transformer(JOIN *join)
*/
expr= new (thd->mem_root) Item_direct_ref(thd, &select_lex->context,
(Item**)optimizer->get_cache(),
- "<no matter>",
- &in_left_expr_name);
+ no_matter_name,
+ in_left_expr_name);
}
DBUG_RETURN(false);
@@ -2170,8 +2172,8 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN *join,
this,
&select_lex->
ref_pointer_array[0],
- (char *)"<ref>",
- &field_name));
+ {STRING_WITH_LEN("<ref>")},
+ field_name));
if (!abort_on_null && left_expr->maybe_null)
{
/*
@@ -2252,8 +2254,8 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN *join,
&select_lex->context,
this,
&select_lex->ref_pointer_array[0],
- (char *)"<no matter>",
- &field_name));
+ no_matter_name,
+ field_name));
if (!abort_on_null && left_expr->maybe_null)
{
disable_cond_guard_for_const_null_left_expr(0);
@@ -2438,21 +2440,21 @@ Item_in_subselect::create_row_in_to_exists_cond(JOIN * join,
Item_direct_ref(thd, &select_lex->context,
(*optimizer->get_cache())->
addr(i),
- (char *)"<no matter>",
- &in_left_expr_name),
+ no_matter_name,
+ in_left_expr_name),
new (thd->mem_root)
Item_ref(thd, &select_lex->context,
&select_lex->ref_pointer_array[i],
- (char *)"<no matter>",
- &list_ref));
+ no_matter_name,
+ 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>",
- &list_ref));
+ no_matter_name,
+ list_ref));
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 &&
@@ -2472,8 +2474,8 @@ Item_in_subselect::create_row_in_to_exists_cond(JOIN * join,
Item_ref(thd, &select_lex->context,
&select_lex->
ref_pointer_array[i],
- (char *)"<no matter>",
- &list_ref));
+ no_matter_name,
+ list_ref));
if (!abort_on_null && left_expr->element_index(i)->maybe_null &&
get_cond_guard(i) )
{
@@ -2507,14 +2509,14 @@ Item_in_subselect::create_row_in_to_exists_cond(JOIN * join,
Item_direct_ref(thd, &select_lex->context,
(*optimizer->get_cache())->
addr(i),
- (char *)"<no matter>",
- &in_left_expr_name),
+ no_matter_name,
+ in_left_expr_name),
new (thd->mem_root)
Item_direct_ref(thd, &select_lex->context,
&select_lex->
ref_pointer_array[i],
- (char *)"<no matter>",
- &list_ref));
+ no_matter_name,
+ list_ref));
if (!abort_on_null && select_lex->ref_pointer_array[i]->maybe_null)
{
Item *having_col_item=
@@ -2523,8 +2525,8 @@ Item_in_subselect::create_row_in_to_exists_cond(JOIN * join,
new (thd->mem_root)
Item_ref(thd, &select_lex->context,
&select_lex->ref_pointer_array[i],
- (char *)"<no matter>",
- &list_ref));
+ no_matter_name,
+ list_ref));
item_isnull= new (thd->mem_root)
Item_func_isnull(thd,
@@ -2532,8 +2534,8 @@ Item_in_subselect::create_row_in_to_exists_cond(JOIN * join,
Item_direct_ref(thd, &select_lex->context,
&select_lex->
ref_pointer_array[i],
- (char *)"<no matter>",
- &list_ref));
+ no_matter_name,
+ list_ref));
item= new (thd->mem_root) Item_cond_or(thd, item, item_isnull);
if (left_expr->element_index(i)->maybe_null && get_cond_guard(i))
{
@@ -3083,8 +3085,8 @@ bool Item_exists_subselect::exists2in_processor(void *opt_arg)
in_subs->expr= new (thd->mem_root)
Item_direct_ref(thd, &first_select->context,
(Item**)optimizer->get_cache(),
- (char *)"<no matter>",
- &in_left_expr_name);
+ no_matter_name,
+ in_left_expr_name);
if (in_subs->fix_fields(thd, optimizer->arguments() + 1))
{
res= TRUE;
@@ -3154,8 +3156,8 @@ bool Item_exists_subselect::exists2in_processor(void *opt_arg)
Item_direct_ref(thd,
&unit->outer_select()->context,
optimizer->arguments(),
- (char *)"<no matter>",
- &exists_outer_expr_name)),
+ no_matter_name,
+ exists_outer_expr_name)),
optimizer) :
(Item *)optimizer);
}
@@ -3178,8 +3180,8 @@ bool Item_exists_subselect::exists2in_processor(void *opt_arg)
Item_direct_ref(thd,
&unit->outer_select()->context,
optimizer->arguments()[0]->addr((int)i),
- (char *)"<no matter>",
- &exists_outer_expr_name)),
+ no_matter_name,
+ exists_outer_expr_name)),
thd->mem_root);
}
}
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 13a823fb10d..5476ddd9151 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -42,8 +42,9 @@
size_t Item_sum::ram_limitation(THD *thd)
{
- return (size_t)MY_MIN(thd->variables.tmp_memory_table_size,
- thd->variables.max_heap_table_size);
+ return MY_MAX(1024,
+ (size_t)MY_MIN(thd->variables.tmp_memory_table_size,
+ thd->variables.max_heap_table_size));
}
@@ -1293,21 +1294,22 @@ void Item_sum_min_max::setup_hybrid(THD *thd, Item *item, Item *value_arg)
}
-Field *Item_sum_min_max::create_tmp_field(bool group, TABLE *table)
+Field *Item_sum_min_max::create_tmp_field(MEM_ROOT *root,
+ bool group, TABLE *table)
{
DBUG_ENTER("Item_sum_min_max::create_tmp_field");
if (args[0]->type() == Item::FIELD_ITEM)
{
Field *field= ((Item_field*) args[0])->field;
- if ((field= field->create_tmp_field(table->in_use->mem_root, table, true)))
+ if ((field= field->create_tmp_field(root, table, true)))
{
DBUG_ASSERT((field->flags & NOT_NULL_FLAG) == 0);
field->field_name= name;
}
DBUG_RETURN(field);
}
- DBUG_RETURN(tmp_table_field_from_field_type(table));
+ DBUG_RETURN(tmp_table_field_from_field_type(root, table));
}
/***********************************************************************
@@ -1997,7 +1999,7 @@ Item *Item_sum_avg::copy_or_same(THD* thd)
}
-Field *Item_sum_avg::create_tmp_field(bool group, TABLE *table)
+Field *Item_sum_avg::create_tmp_field(MEM_ROOT *root, bool group, TABLE *table)
{
if (group)
@@ -2007,7 +2009,7 @@ 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 *field= new (table->in_use->mem_root)
+ Field *field= new (root)
Field_string(((result_type() == DECIMAL_RESULT) ?
dec_bin_size : sizeof(double)) + sizeof(longlong),
0, &name, &my_charset_bin);
@@ -2015,7 +2017,7 @@ Field *Item_sum_avg::create_tmp_field(bool group, TABLE *table)
field->init(table);
return field;
}
- return tmp_table_field_from_field_type(table);
+ return tmp_table_field_from_field_type(root, table);
}
@@ -2239,7 +2241,8 @@ Item *Item_sum_variance::copy_or_same(THD* thd)
If we're grouping, then we need some space to serialize variables into, to
pass around.
*/
-Field *Item_sum_variance::create_tmp_field(bool group, TABLE *table)
+Field *Item_sum_variance::create_tmp_field(MEM_ROOT *root,
+ bool group, TABLE *table)
{
Field *field;
if (group)
@@ -2249,11 +2252,12 @@ Field *Item_sum_variance::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(Stddev::binary_size(), 0, &name, &my_charset_bin);
+ field= new (root) Field_string(Stddev::binary_size(), 0,
+ &name, &my_charset_bin);
}
else
- field= new Field_double(max_length, maybe_null, &name, decimals,
- TRUE);
+ field= new (root) Field_double(max_length, maybe_null, &name, decimals,
+ TRUE);
if (field != NULL)
field->init(table);
@@ -3648,6 +3652,14 @@ int dump_leaf_key(void* key_arg, element_count count __attribute__((unused)),
if (item->limit_clause && !(*row_limit))
return 1;
+ if (item->sum_func() == Item_sum::JSON_ARRAYAGG_FUNC &&
+ item->arg_count_field > 1)
+ {
+ /* JSON_ARRAYAGG supports only one parameter */
+ my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), "JSON_ARRAYAGG");
+ return 1;
+ }
+
if (item->no_appended)
item->no_appended= FALSE;
else
@@ -3689,7 +3701,19 @@ int dump_leaf_key(void* key_arg, element_count count __attribute__((unused)),
res= (*arg)->val_str(&tmp);
}
if (res)
+ {
+ if (item->sum_func() == Item_sum::JSON_ARRAYAGG_FUNC)
+ {
+ /*
+ JSON_ARRAYAGG needs to convert the type into valid JSON before
+ appending it to the result
+ */
+ Item_func_json_arrayagg *arrayagg= (Item_func_json_arrayagg *) item_arg;
+ res= arrayagg->convert_to_json(*arg, res);
+ }
+
result->append(*res);
+ }
}
if (item->limit_clause)
@@ -3995,9 +4019,9 @@ bool Item_func_group_concat::repack_tree(THD *thd)
*/
#define GCONCAT_REPACK_FACTOR (1 << 10)
-bool Item_func_group_concat::add()
+bool Item_func_group_concat::add(bool exclude_nulls)
{
- if (always_null)
+ if (always_null && exclude_nulls)
return 0;
copy_fields(tmp_table_param);
if (copy_funcs(tmp_table_param->items_to_copy, table->in_use))
@@ -4015,7 +4039,8 @@ bool Item_func_group_concat::add()
Field *field= show_item->get_tmp_table_field();
if (field)
{
- if (field->is_null_in_record((const uchar*) table->record[0]))
+ if (field->is_null_in_record((const uchar*) table->record[0]) &&
+ exclude_nulls)
return 0; // Skip row if it contains null
if (tree && (res= field->val_str(&buf)))
row_str_len+= res->length();
diff --git a/sql/item_sum.h b/sql/item_sum.h
index 7ef1b7eb234..5b17b97b414 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -355,7 +355,7 @@ public:
ROW_NUMBER_FUNC, RANK_FUNC, DENSE_RANK_FUNC, PERCENT_RANK_FUNC,
CUME_DIST_FUNC, NTILE_FUNC, FIRST_VALUE_FUNC, LAST_VALUE_FUNC,
NTH_VALUE_FUNC, LEAD_FUNC, LAG_FUNC, PERCENTILE_CONT_FUNC,
- PERCENTILE_DISC_FUNC, SP_AGGREGATE_FUNC
+ PERCENTILE_DISC_FUNC, SP_AGGREGATE_FUNC, JSON_ARRAYAGG_FUNC
};
Item **ref_by; /* pointer to a ref to the object used to register it */
@@ -428,6 +428,7 @@ public:
case SUM_BIT_FUNC:
case UDF_SUM_FUNC:
case GROUP_CONCAT_FUNC:
+ case JSON_ARRAYAGG_FUNC:
return true;
default:
return false;
@@ -513,11 +514,11 @@ public:
}
virtual void make_unique() { force_copy_fields= TRUE; }
Item *get_tmp_table_item(THD *thd);
- virtual Field *create_tmp_field(bool group, TABLE *table);
- Field *create_tmp_field_ex(TABLE *table, Tmp_field_src *src,
+ virtual Field *create_tmp_field(MEM_ROOT *root, bool group, TABLE *table);
+ Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src,
const Tmp_field_param *param)
{
- return create_tmp_field(param->group(), table);
+ return create_tmp_field(root, param->group(), table);
}
virtual bool collect_outer_ref_processor(void *param);
bool init_sum_func_check(THD *thd);
@@ -753,7 +754,6 @@ public:
double val_real() { DBUG_ASSERT(fixed == 1); return (double) val_int(); }
String *val_str(String*str);
my_decimal *val_decimal(my_decimal *);
- const Type_handler *type_handler() const { return &type_handler_longlong; }
bool fix_length_and_dec()
{ decimals=0; max_length=21; maybe_null=null_value=0; return FALSE; }
};
@@ -869,6 +869,7 @@ public:
count=count_arg;
Item_sum::make_const();
}
+ const Type_handler *type_handler() const { return &type_handler_slonglong; }
longlong val_int();
void reset_field();
void update_field();
@@ -928,7 +929,7 @@ public:
return has_with_distinct() ? "avg(distinct " : "avg(";
}
Item *copy_or_same(THD* thd);
- Field *create_tmp_field(bool group, TABLE *table);
+ Field *create_tmp_field(MEM_ROOT *root, bool group, TABLE *table);
void cleanup()
{
count= 0;
@@ -1013,7 +1014,7 @@ public:
const char *func_name() const
{ return sample ? "var_samp(" : "variance("; }
Item *copy_or_same(THD* thd);
- Field *create_tmp_field(bool group, TABLE *table);
+ Field *create_tmp_field(MEM_ROOT *root, bool group, TABLE *table);
const Type_handler *type_handler() const { return &type_handler_double; }
void cleanup()
{
@@ -1052,11 +1053,11 @@ class Item_sum_hybrid: public Item_sum,
public:
Item_sum_hybrid(THD *thd, Item *item_par):
Item_sum(thd, item_par),
- Type_handler_hybrid_field_type(&type_handler_longlong)
+ Type_handler_hybrid_field_type(&type_handler_slonglong)
{ collation.set(&my_charset_bin); }
Item_sum_hybrid(THD *thd, Item *a, Item *b):
Item_sum(thd, a, b),
- Type_handler_hybrid_field_type(&type_handler_longlong)
+ Type_handler_hybrid_field_type(&type_handler_slonglong)
{ collation.set(&my_charset_bin); }
Item_sum_hybrid(THD *thd, Item_sum_hybrid *item)
:Item_sum(thd, item),
@@ -1111,7 +1112,7 @@ public:
{
return get_arg(0)->real_type_handler();
}
- TYPELIB *get_typelib() const { return args[0]->get_typelib(); }
+ const TYPELIB *get_typelib() const { return args[0]->get_typelib(); }
void update_field();
void min_max_update_str_field();
void min_max_update_real_field();
@@ -1122,7 +1123,7 @@ public:
bool any_value() { return was_values; }
void no_rows_in_result();
void restore_to_before_no_rows_in_result();
- Field *create_tmp_field(bool group, TABLE *table);
+ Field *create_tmp_field(MEM_ROOT *root, bool group, TABLE *table);
void setup_caches(THD *thd) { setup_hybrid(thd, arguments()[0], NULL); }
};
@@ -1176,6 +1177,7 @@ public:
longlong val_int();
void reset_field();
void update_field();
+ const Type_handler *type_handler() const { return &type_handler_ulonglong; }
bool fix_length_and_dec()
{
decimals= 0; max_length=21; unsigned_flag= 1; maybe_null= null_value= 0;
@@ -1345,9 +1347,9 @@ public:
{
return SP_AGGREGATE_FUNC;
}
- Field *create_field_for_create_select(TABLE *table)
+ Field *create_field_for_create_select(MEM_ROOT *root, TABLE *table)
{
- return create_table_field_from_handler(table);
+ return create_table_field_from_handler(root, table);
}
bool fix_length_and_dec();
bool fix_fields(THD *thd, Item **ref);
@@ -1429,10 +1431,10 @@ public:
unsigned_flag= item->unsigned_flag;
}
table_map used_tables() const { return (table_map) 1L; }
- Field *create_tmp_field_ex(TABLE *table, Tmp_field_src *src,
+ Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src,
const Tmp_field_param *param)
{
- return create_tmp_field_ex_simple(table, src, param);
+ return create_tmp_field_ex_simple(root, table, src, param);
}
void save_in_result_field(bool no_conversions) { DBUG_ASSERT(0); }
bool check_vcol_func_processor(void *arg)
@@ -1645,7 +1647,11 @@ public:
{ DBUG_ASSERT(fixed == 1); return (double) Item_sum_udf_int::val_int(); }
String *val_str(String*str);
my_decimal *val_decimal(my_decimal *);
- const Type_handler *type_handler() const { return &type_handler_longlong; }
+ const Type_handler *type_handler() const
+ {
+ return unsigned_flag ? &type_handler_ulonglong :
+ &type_handler_slonglong;
+ }
bool fix_length_and_dec() { decimals=0; max_length=21; return FALSE; }
Item *copy_or_same(THD* thd);
Item *get_copy(THD *thd)
@@ -1816,6 +1822,7 @@ C_MODE_END
class Item_func_group_concat : public Item_sum
{
+protected:
TMP_TABLE_PARAM *tmp_table_param;
String result;
String *separator;
@@ -1861,6 +1868,12 @@ class Item_func_group_concat : public Item_sum
*/
Item_func_group_concat *original;
+ /*
+ Used by Item_func_group_concat and Item_func_json_arrayagg. The latter
+ needs null values but the former doesn't.
+ */
+ bool add(bool exclude_nulls);
+
friend int group_concat_key_cmp_with_distinct(void* arg, const void* key1,
const void* key2);
friend int group_concat_key_cmp_with_order(void* arg, const void* key1,
@@ -1898,7 +1911,10 @@ public:
return &type_handler_varchar;
}
void clear();
- bool add();
+ bool add()
+ {
+ return add(true);
+ }
void reset_field() { DBUG_ASSERT(0); } // not used
void update_field() { DBUG_ASSERT(0); } // not used
bool fix_fields(THD *,Item **);
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 3b2ac55c59d..631829eee1d 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -986,7 +986,7 @@ String* Item_func_monthname::val_str(String* str)
return (String *) 0;
month_name= locale->month_names->type_names[d.get_mysql_time()->month - 1];
- str->copy(month_name, (uint) strlen(month_name), &my_charset_utf8_bin,
+ str->copy(month_name, (uint) strlen(month_name), &my_charset_utf8mb3_bin,
collation.collation, &err);
return str;
}
@@ -1130,7 +1130,7 @@ String* Item_func_dayname::val_str(String* str)
return (String*) 0;
day_name= locale->day_names->type_names[weekday];
- str->copy(day_name, (uint) strlen(day_name), &my_charset_utf8_bin,
+ str->copy(day_name, (uint) strlen(day_name), &my_charset_utf8mb3_bin,
collation.collation, &err);
return str;
}
@@ -1920,7 +1920,10 @@ bool Item_func_from_unixtime::fix_length_and_dec()
THD *thd= current_thd;
thd->time_zone_used= 1;
tz= thd->variables.time_zone;
- fix_attributes_datetime_not_fixed_dec(args[0]->decimals);
+ Type_std_attributes::set(
+ Type_temporal_attributes_not_fixed_dec(MAX_DATETIME_WIDTH,
+ args[0]->decimals, false),
+ DTCollation_numeric());
maybe_null= true;
return FALSE;
}
@@ -2001,7 +2004,7 @@ bool Item_date_add_interval::fix_length_and_dec()
{
enum_field_types arg0_field_type;
- if (!args[0]->type_handler()->is_traditional_type())
+ if (!args[0]->type_handler()->is_traditional_scalar_type())
{
my_error(ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION, MYF(0),
args[0]->type_handler()->name().ptr(),
@@ -2323,7 +2326,7 @@ uint Item_char_typecast::adjusted_length_with_warn(uint length)
}
-String *Item_char_typecast::val_str(String *str)
+String *Item_char_typecast::val_str_generic(String *str)
{
DBUG_ASSERT(fixed == 1);
String *res;
@@ -2379,11 +2382,75 @@ end:
}
+String *Item_char_typecast::val_str_binary_from_native(String *str)
+{
+ DBUG_ASSERT(fixed == 1);
+ DBUG_ASSERT(cast_cs == &my_charset_bin);
+ NativeBuffer<STRING_BUFFER_USUAL_SIZE> native;
+
+ if (args[0]->val_native(current_thd, &native))
+ {
+ null_value= 1;
+ return 0;
+ }
+
+ if (has_explicit_length())
+ {
+ cast_length= adjusted_length_with_warn(cast_length);
+ if (cast_length > native.length())
+ {
+ // add trailing 0x00s
+ DBUG_ASSERT(cast_length <= current_thd->variables.max_allowed_packet);
+ str->alloc(cast_length);
+ str->copy(native.ptr(), native.length(), &my_charset_bin);
+ bzero((char*) str->end(), cast_length - str->length());
+ str->length(cast_length);
+ }
+ else
+ str->copy(native.ptr(), cast_length, &my_charset_bin);
+ }
+ else
+ str->copy(native.ptr(), native.length(), &my_charset_bin);
+
+ return ((null_value= (str->length() >
+ adjusted_length_with_warn(str->length())))) ? 0 : str;
+}
+
+
+class Item_char_typecast_func_handler: public Item_handled_func::Handler_str
+{
+public:
+ const Type_handler *return_type_handler() const
+ {
+ return &type_handler_varchar;
+ }
+ const Type_handler *
+ type_handler_for_create_select(const Item_handled_func *item) const
+ {
+ return return_type_handler()->type_handler_for_tmp_table(item);
+ }
+
+ bool fix_length_and_dec(Item_handled_func *item) const
+ {
+ return false;
+ }
+ String *val_str(Item_handled_func *item, String *to) const
+ {
+ DBUG_ASSERT(dynamic_cast<const Item_char_typecast*>(item));
+ return static_cast<Item_char_typecast*>(item)->val_str_generic(to);
+ }
+};
+
+
+static Item_char_typecast_func_handler item_char_typecast_func_handler;
+
+
void Item_char_typecast::fix_length_and_dec_numeric()
{
fix_length_and_dec_internal(from_cs= cast_cs->mbminlen == 1 ?
cast_cs :
&my_charset_latin1);
+ set_func_handler(&item_char_typecast_func_handler);
}
@@ -2392,6 +2459,24 @@ void Item_char_typecast::fix_length_and_dec_generic()
fix_length_and_dec_internal(from_cs= args[0]->dynamic_result() ?
0 :
args[0]->collation.collation);
+ set_func_handler(&item_char_typecast_func_handler);
+}
+
+
+void Item_char_typecast::fix_length_and_dec_str()
+{
+ fix_length_and_dec_generic();
+ m_suppress_warning_to_error_escalation= true;
+ set_func_handler(&item_char_typecast_func_handler);
+}
+
+
+void
+Item_char_typecast::fix_length_and_dec_native_to_binary(uint32 octet_length)
+{
+ collation.set(&my_charset_bin, DERIVATION_IMPLICIT);
+ max_length= has_explicit_length() ? (uint32) cast_length : octet_length;
+ maybe_null|= current_thd->is_strict_mode();
}
@@ -2435,6 +2520,8 @@ void Item_char_typecast::fix_length_and_dec_internal(CHARSET_INFO *from_cs)
(cast_cs == &my_charset_bin ? 1 :
args[0]->collation.collation->mbmaxlen));
max_length= char_length * cast_cs->mbmaxlen;
+ // Add NULL-ability in strict mode. See Item_str_func::fix_fields()
+ maybe_null= maybe_null || current_thd->is_strict_mode();
}
@@ -2521,8 +2608,8 @@ bool Item_func_add_time::fix_length_and_dec()
{
enum_field_types arg0_field_type;
- if (!args[0]->type_handler()->is_traditional_type() ||
- !args[1]->type_handler()->is_traditional_type())
+ if (!args[0]->type_handler()->is_traditional_scalar_type() ||
+ !args[1]->type_handler()->is_traditional_scalar_type())
{
my_error(ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION, MYF(0),
args[0]->type_handler()->name().ptr(),
@@ -2932,8 +3019,8 @@ get_date_time_result_type(const char *format, uint length)
bool Item_func_str_to_date::fix_length_and_dec()
{
- if (!args[0]->type_handler()->is_traditional_type() ||
- !args[1]->type_handler()->is_traditional_type())
+ if (!args[0]->type_handler()->is_traditional_scalar_type() ||
+ !args[1]->type_handler()->is_traditional_scalar_type())
{
my_error(ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION, MYF(0),
args[0]->type_handler()->name().ptr(),
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h
index 2e9454804ae..97e9c2ac59b 100644
--- a/sql/item_timefunc.h
+++ b/sql/item_timefunc.h
@@ -170,7 +170,7 @@ class Item_func_month :public Item_func
{
public:
Item_func_month(THD *thd, Item *a): Item_func(thd, a)
- { collation.set_numeric(); }
+ { collation= DTCollation_numeric(); }
longlong val_int();
double val_real()
{ DBUG_ASSERT(fixed == 1); return (double) Item_func_month::val_int(); }
@@ -182,12 +182,16 @@ public:
str->set(nr, collation.collation);
return str;
}
+ my_decimal *val_decimal(my_decimal *decimal_value)
+ {
+ return val_decimal_from_int(decimal_value);
+ }
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)
{
return get_date_from_int(thd, ltime, fuzzydate);
}
const char *func_name() const { return "month"; }
- const Type_handler *type_handler() const { return &type_handler_long; }
+ const Type_handler *type_handler() const { return &type_handler_slong; }
bool fix_length_and_dec()
{
decimals= 0;
@@ -442,7 +446,7 @@ class Item_func_weekday :public Item_func
bool odbc_type;
public:
Item_func_weekday(THD *thd, Item *a, bool type_arg):
- Item_func(thd, a), odbc_type(type_arg) { collation.set_numeric(); }
+ Item_func(thd, a), odbc_type(type_arg) { collation= DTCollation_numeric(); }
longlong val_int();
double val_real() { DBUG_ASSERT(fixed == 1); return (double) val_int(); }
String *val_str(String *str)
@@ -451,6 +455,10 @@ public:
str->set(val_int(), &my_charset_bin);
return null_value ? 0 : str;
}
+ my_decimal *val_decimal(my_decimal *decimal_value)
+ {
+ return val_decimal_from_int(decimal_value);
+ }
const char *func_name() const
{
return (odbc_type ? "dayofweek" : "weekday");
@@ -459,7 +467,7 @@ public:
{
return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate);
}
- const Type_handler *type_handler() const { return &type_handler_long; }
+ const Type_handler *type_handler() const { return &type_handler_slong; }
bool fix_length_and_dec()
{
decimals= 0;
@@ -972,8 +980,8 @@ class Item_extract :public Item_int_func,
uint32 threashold)
{
if (length >= threashold)
- return &type_handler_longlong;
- return &type_handler_long;
+ return &type_handler_slonglong;
+ return &type_handler_slong;
}
void set_date_length(uint32 length)
{
@@ -1004,7 +1012,7 @@ class Item_extract :public Item_int_func,
const interval_type int_type; // keep it public
Item_extract(THD *thd, interval_type type_arg, Item *a):
Item_int_func(thd, a),
- Type_handler_hybrid_field_type(&type_handler_longlong),
+ Type_handler_hybrid_field_type(&type_handler_slonglong),
m_date_mode(date_mode_t(0)),
int_type(type_arg)
{ }
@@ -1066,14 +1074,16 @@ class Item_extract :public Item_int_func,
};
-class Item_char_typecast :public Item_str_func
+class Item_char_typecast :public Item_handled_func
{
uint cast_length;
CHARSET_INFO *cast_cs, *from_cs;
bool charset_conversion;
String tmp_value;
bool m_suppress_warning_to_error_escalation;
+public:
bool has_explicit_length() const { return cast_length != ~0U; }
+private:
String *reuse(String *src, size_t length);
String *copy(String *src, CHARSET_INFO *cs);
uint adjusted_length_with_warn(uint length);
@@ -1084,20 +1094,18 @@ public:
uint get_cast_length() const { return cast_length; }
public:
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),
+ Item_handled_func(thd, a), cast_length(length_arg), cast_cs(cs_arg),
m_suppress_warning_to_error_escalation(false) {}
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"; }
CHARSET_INFO *cast_charset() const { return cast_cs; }
- String *val_str(String *a);
+ String *val_str_generic(String *a);
+ String *val_str_binary_from_native(String *a);
void fix_length_and_dec_generic();
void fix_length_and_dec_numeric();
- void fix_length_and_dec_str()
- {
- fix_length_and_dec_generic();
- m_suppress_warning_to_error_escalation= true;
- }
+ void fix_length_and_dec_str();
+ void fix_length_and_dec_native_to_binary(uint32 octet_length);
bool fix_length_and_dec()
{
return args[0]->type_handler()->Item_char_typecast_fix_length_and_dec(this);
@@ -1550,9 +1558,11 @@ public:
{
uint dec= MY_MAX(item->arguments()[0]->datetime_precision(current_thd),
interval_dec(item->arguments()[1], int_type(item)));
- item->collation.set(item->default_charset(),
- DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII);
- item->fix_char_length_temporal_not_fixed_dec(MAX_DATETIME_WIDTH, dec);
+ item->Type_std_attributes::set(
+ Type_temporal_attributes_not_fixed_dec(MAX_DATETIME_WIDTH, dec, false),
+ DTCollation(item->default_charset(),
+ DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII));
+ item->fix_char_length(item->max_length);
return false;
}
bool get_date(THD *thd, Item_handled_func *item,
@@ -1657,9 +1667,11 @@ public:
uint dec0= item->arguments()[0]->decimals;
uint dec1= Interval_DDhhmmssff::fsp(current_thd, item->arguments()[1]);
uint dec= MY_MAX(dec0, dec1);
- item->collation.set(item->default_charset(),
- DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII);
- item->fix_char_length_temporal_not_fixed_dec(MAX_DATETIME_WIDTH, dec);
+ item->Type_std_attributes::set(
+ Type_temporal_attributes_not_fixed_dec(MAX_DATETIME_WIDTH, dec, false),
+ DTCollation(item->default_charset(),
+ DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII));
+ item->fix_char_length(item->max_length);
return false;
}
bool get_date(THD *thd, Item_handled_func *item,
diff --git a/sql/item_windowfunc.cc b/sql/item_windowfunc.cc
index 5ecb9510940..f20d20c81d6 100644
--- a/sql/item_windowfunc.cc
+++ b/sql/item_windowfunc.cc
@@ -463,7 +463,8 @@ bool Item_sum_hybrid_simple::get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t f
return retval;
}
-Field *Item_sum_hybrid_simple::create_tmp_field(bool group, TABLE *table)
+Field *Item_sum_hybrid_simple::create_tmp_field(MEM_ROOT *root,
+ bool group, TABLE *table)
{
DBUG_ASSERT(0);
return NULL;
diff --git a/sql/item_windowfunc.h b/sql/item_windowfunc.h
index 5b3aa4f0e41..8b53b2012e7 100644
--- a/sql/item_windowfunc.h
+++ b/sql/item_windowfunc.h
@@ -118,6 +118,8 @@ public:
Item_sum_row_number(THD *thd)
: Item_sum_int(thd), count(0) {}
+ const Type_handler *type_handler() const { return &type_handler_slonglong; }
+
void clear()
{
count= 0;
@@ -179,6 +181,8 @@ public:
Item_sum_rank(THD *thd) : Item_sum_int(thd), peer_tracker(NULL) {}
+ const Type_handler *type_handler() const { return &type_handler_slonglong; }
+
void clear()
{
/* This is called on partition start */
@@ -266,6 +270,7 @@ class Item_sum_dense_rank: public Item_sum_int
Item_sum_dense_rank(THD *thd)
: Item_sum_int(thd), dense_rank(0), first_add(true), peer_tracker(NULL) {}
+ const Type_handler *type_handler() const { return &type_handler_slonglong; }
enum Sumfunctype sum_func () const
{
return DENSE_RANK_FUNC;
@@ -318,7 +323,7 @@ class Item_sum_hybrid_simple : public Item_sum_hybrid
const Type_handler *type_handler() const
{ return Type_handler_hybrid_field_type::type_handler(); }
void update_field();
- Field *create_tmp_field(bool group, TABLE *table);
+ Field *create_tmp_field(MEM_ROOT *root, bool group, TABLE *table);
void clear()
{
value->clear();
@@ -690,7 +695,7 @@ class Item_sum_ntile : public Item_sum_window_with_row_count
void update_field() {}
- const Type_handler *type_handler() const { return &type_handler_longlong; }
+ const Type_handler *type_handler() const { return &type_handler_slonglong; }
Item *get_copy(THD *thd)
{ return get_item_copy<Item_sum_ntile>(thd, this); }
@@ -705,7 +710,7 @@ class Item_sum_percentile_disc : public Item_sum_cume_dist,
{
public:
Item_sum_percentile_disc(THD *thd, Item* arg) : Item_sum_cume_dist(thd, arg),
- Type_handler_hybrid_field_type(&type_handler_longlong),
+ Type_handler_hybrid_field_type(&type_handler_slonglong),
value(NULL), val_calculated(FALSE), first_call(TRUE),
prev_value(0), order_item(NULL){}
diff --git a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc
index 60218c8ee74..c8224157e0f 100644
--- a/sql/item_xmlfunc.cc
+++ b/sql/item_xmlfunc.cc
@@ -71,15 +71,6 @@ typedef struct my_xpath_lex_st
} MY_XPATH_LEX;
-/* Structure to store nodesets */
-typedef struct my_xpath_flt_st
-{
- uint num; /* absolute position in MY_XML_NODE array */
- uint pos; /* relative position in context */
- uint size; /* context size */
-} MY_XPATH_FLT;
-
-
/* XPath function creator */
typedef struct my_xpath_function_names_st
{
@@ -105,50 +96,13 @@ typedef struct my_xpath_st
Item *item; /* current expression */
Item *context; /* last scanned context */
Item *rootelement; /* The root element */
- String *context_cache; /* last context provider */
+ Native *context_cache; /* last context provider */
String *pxml; /* Parsed XML, an array of MY_XML_NODE */
CHARSET_INFO *cs; /* character set/collation string comparison */
int error;
} MY_XPATH;
-/* Dynamic array of MY_XPATH_FLT */
-class XPathFilter :public String
-{
-public:
- XPathFilter() :String() {}
- inline bool append_element(MY_XPATH_FLT *flt)
- {
- String *str= this;
- return str->append((const char*)flt, (uint32) sizeof(MY_XPATH_FLT));
- }
- inline bool append_element(uint32 num, uint32 pos)
- {
- MY_XPATH_FLT add;
- add.num= num;
- add.pos= pos;
- add.size= 0;
- return append_element(&add);
- }
- inline bool append_element(uint32 num, uint32 pos, uint32 size)
- {
- MY_XPATH_FLT add;
- add.num= num;
- add.pos= pos;
- add.size= size;
- return append_element(&add);
- }
- inline MY_XPATH_FLT *element(uint i)
- {
- return (MY_XPATH_FLT*) (ptr() + i * sizeof(MY_XPATH_FLT));
- }
- inline uint32 numelements()
- {
- return length() / sizeof(MY_XPATH_FLT);
- }
-};
-
-
static Type_handler_long_blob type_handler_xpath_nodeset;
@@ -158,13 +112,13 @@ static Type_handler_long_blob type_handler_xpath_nodeset;
class Item_nodeset_func :public Item_str_func
{
protected:
- String tmp_value, tmp2_value;
+ NativeNodesetBuffer tmp_native_value, tmp2_native_value;
MY_XPATH_FLT *fltbeg, *fltend;
MY_XML_NODE *nodebeg, *nodeend;
uint numnodes;
public:
String *pxml;
- String context_cache;
+ NativeNodesetBuffer context_cache;
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):
@@ -179,12 +133,12 @@ public:
nodeend= (MY_XML_NODE*) (pxml->ptr() + pxml->length());
numnodes= (uint)(nodeend - nodebeg);
}
- void prepare(String *nodeset)
+ void prepare(THD *thd, Native *nodeset)
{
prepare_nodes();
- String *res= args[0]->val_raw(&tmp_value);
- fltbeg= (MY_XPATH_FLT*) res->ptr();
- fltend= (MY_XPATH_FLT*) (res->ptr() + res->length());
+ args[0]->val_native(thd, &tmp_native_value);
+ fltbeg= (MY_XPATH_FLT*) tmp_native_value.ptr();
+ fltend= (MY_XPATH_FLT*) tmp_native_value.end();
nodeset->length(0);
}
const Type_handler *type_handler() const
@@ -195,7 +149,7 @@ public:
{
return &type_handler_xpath_nodeset;
}
- Field *create_tmp_field_ex(TABLE *table, Tmp_field_src *src,
+ Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src,
const Tmp_field_param *param)
{
DBUG_ASSERT(0);
@@ -204,9 +158,9 @@ public:
String *val_str(String *str)
{
prepare_nodes();
- String *res= val_raw(&tmp2_value);
- fltbeg= (MY_XPATH_FLT*) res->ptr();
- fltend= (MY_XPATH_FLT*) (res->ptr() + res->length());
+ val_native(current_thd, &tmp2_native_value);
+ fltbeg= (MY_XPATH_FLT*) tmp2_native_value.ptr();
+ fltend= (MY_XPATH_FLT*) tmp2_native_value.end();
String active;
active.alloc(numnodes);
bzero((char*) active.ptr(), numnodes);
@@ -235,7 +189,6 @@ public:
}
return str;
}
- enum Item_result result_type () const { return STRING_RESULT; }
bool fix_length_and_dec()
{
max_length= MAX_BLOB_WIDTH;
@@ -261,7 +214,7 @@ public:
Item_nodeset_func_rootelement(THD *thd, String *pxml):
Item_nodeset_func(thd, pxml) {}
const char *func_name() const { return "xpath_rootelement"; }
- String *val_raw(String *nodeset);
+ bool val_native(THD *thd, Native *nodeset);
Item *get_copy(THD *thd)
{ return get_item_copy<Item_nodeset_func_rootelement>(thd, this); }
};
@@ -274,7 +227,7 @@ public:
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_raw(String *nodeset);
+ bool val_native(THD *thd, Native *nodeset);
Item *get_copy(THD *thd)
{ return get_item_copy<Item_nodeset_func_union>(thd, this); }
};
@@ -308,7 +261,7 @@ public:
String *pxml):
Item_nodeset_func_axisbyname(thd, a, n_arg, l_arg, pxml) {}
const char *func_name() const { return "xpath_selfbyname"; }
- String *val_raw(String *nodeset);
+ bool val_native(THD *thd, Native *nodeset);
Item *get_copy(THD *thd)
{ return get_item_copy<Item_nodeset_func_selfbyname>(thd, this); }
};
@@ -322,7 +275,7 @@ public:
String *pxml):
Item_nodeset_func_axisbyname(thd, a, n_arg, l_arg, pxml) {}
const char *func_name() const { return "xpath_childbyname"; }
- String *val_raw(String *nodeset);
+ bool val_native(THD *thd, Native *nodeset);
Item *get_copy(THD *thd)
{ return get_item_copy<Item_nodeset_func_childbyname>(thd, this); }
};
@@ -338,7 +291,7 @@ public:
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_raw(String *nodeset);
+ bool val_native(THD *thd, Native *nodeset);
Item *get_copy(THD *thd)
{ return get_item_copy<Item_nodeset_func_descendantbyname>(thd, this); }
};
@@ -354,7 +307,7 @@ public:
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_raw(String *nodeset);
+ bool val_native(THD *thd, Native *nodeset);
Item *get_copy(THD *thd)
{ return get_item_copy<Item_nodeset_func_ancestorbyname>(thd, this); }
};
@@ -368,7 +321,7 @@ public:
String *pxml):
Item_nodeset_func_axisbyname(thd, a, n_arg, l_arg, pxml) {}
const char *func_name() const { return "xpath_parentbyname"; }
- String *val_raw(String *nodeset);
+ bool val_native(THD *thd, Native *nodeset);
Item *get_copy(THD *thd)
{ return get_item_copy<Item_nodeset_func_parentbyname>(thd, this); }
};
@@ -382,7 +335,7 @@ public:
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_raw(String *nodeset);
+ bool val_native(THD *thd, Native *nodeset);
Item *get_copy(THD *thd)
{ return get_item_copy<Item_nodeset_func_attributebyname>(thd, this); }
};
@@ -399,7 +352,7 @@ public:
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_raw(String *nodeset);
+ bool val_native(THD *thd, Native *nodeset);
Item *get_copy(THD *thd)
{ return get_item_copy<Item_nodeset_func_predicate>(thd, this); }
};
@@ -412,7 +365,7 @@ public:
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_raw(String *nodeset);
+ bool val_native(THD *thd, Native *nodeset);
Item *get_copy(THD *thd)
{ return get_item_copy<Item_nodeset_func_elementbyindex>(thd, this); }
};
@@ -427,7 +380,7 @@ public:
class Item_xpath_cast_bool :public Item_bool_func
{
String *pxml;
- String tmp_value;
+ NativeNodesetBuffer tmp_native_value;
public:
Item_xpath_cast_bool(THD *thd, Item *a, String *pxml_arg):
Item_bool_func(thd, a), pxml(pxml_arg) {}
@@ -436,8 +389,8 @@ public:
{
if (args[0]->fixed_type_handler() == &type_handler_xpath_nodeset)
{
- String *flt= args[0]->val_raw(&tmp_value);
- return flt->length() == sizeof(MY_XPATH_FLT) ? 1 : 0;
+ args[0]->val_native(current_thd, &tmp_native_value);
+ return tmp_native_value.elements() == 1 ? 1 : 0;
}
return args[0]->val_real() ? 1 : 0;
}
@@ -466,11 +419,13 @@ public:
class Item_nodeset_context_cache :public Item_nodeset_func
{
public:
- String *string_cache;
- Item_nodeset_context_cache(THD *thd, String *str_arg, String *pxml):
- Item_nodeset_func(thd, pxml), string_cache(str_arg) { }
- String *val_raw(String *res)
- { return string_cache; }
+ Native *native_cache;
+ Item_nodeset_context_cache(THD *thd, Native *native_arg, String *pxml):
+ Item_nodeset_func(thd, pxml), native_cache(native_arg) { }
+ bool val_native(THD *thd, Native *nodeset)
+ {
+ return nodeset->copy(*native_cache);
+ }
bool fix_length_and_dec() { max_length= MAX_BLOB_WIDTH;; return FALSE; }
Item *get_copy(THD *thd)
{ return get_item_copy<Item_nodeset_context_cache>(thd, this); }
@@ -480,7 +435,7 @@ public:
class Item_func_xpath_position :public Item_long_func
{
String *pxml;
- String tmp_value;
+ NativeNodesetBuffer tmp_native_value;
public:
Item_func_xpath_position(THD *thd, Item *a, String *p):
Item_long_func(thd, a), pxml(p) {}
@@ -488,9 +443,9 @@ public:
bool fix_length_and_dec() { max_length=10; return FALSE; }
longlong val_int()
{
- String *flt= args[0]->val_raw(&tmp_value);
- if (flt->length() == sizeof(MY_XPATH_FLT))
- return ((MY_XPATH_FLT*)flt->ptr())->pos + 1;
+ args[0]->val_native(current_thd, &tmp_native_value);
+ if (tmp_native_value.elements() == 1)
+ return tmp_native_value.element(0).pos + 1;
return 0;
}
Item *get_copy(THD *thd)
@@ -501,7 +456,7 @@ public:
class Item_func_xpath_count :public Item_long_func
{
String *pxml;
- String tmp_value;
+ NativeNodesetBuffer tmp_native_value;
public:
Item_func_xpath_count(THD *thd, Item *a, String *p):
Item_long_func(thd, a), pxml(p) {}
@@ -510,11 +465,11 @@ public:
longlong val_int()
{
uint predicate_supplied_context_size;
- String *res= args[0]->val_raw(&tmp_value);
- if (res->length() == sizeof(MY_XPATH_FLT) &&
- (predicate_supplied_context_size= ((MY_XPATH_FLT*)res->ptr())->size))
+ args[0]->val_native(current_thd, &tmp_native_value);
+ if (tmp_native_value.elements() == 1 &&
+ (predicate_supplied_context_size= tmp_native_value.element(0).size))
return predicate_supplied_context_size;
- return res->length() / sizeof(MY_XPATH_FLT);
+ return tmp_native_value.elements();
}
Item *get_copy(THD *thd)
{ return get_item_copy<Item_func_xpath_count>(thd, this); }
@@ -524,7 +479,7 @@ public:
class Item_func_xpath_sum :public Item_real_func
{
String *pxml;
- String tmp_value;
+ NativeNodesetBuffer tmp_native_value;
public:
Item_func_xpath_sum(THD *thd, Item *a, String *p):
Item_real_func(thd, a), pxml(p) {}
@@ -533,9 +488,9 @@ public:
double val_real()
{
double sum= 0;
- String *res= args[0]->val_raw(&tmp_value);
- MY_XPATH_FLT *fltbeg= (MY_XPATH_FLT*) res->ptr();
- MY_XPATH_FLT *fltend= (MY_XPATH_FLT*) (res->ptr() + res->length());
+ args[0]->val_native(current_thd, &tmp_native_value);
+ MY_XPATH_FLT *fltbeg= (MY_XPATH_FLT*) tmp_native_value.ptr();
+ MY_XPATH_FLT *fltend= (MY_XPATH_FLT*) tmp_native_value.end();
uint numnodes= pxml->length() / sizeof(MY_XML_NODE);
MY_XML_NODE *nodebeg= (MY_XML_NODE*) pxml->ptr();
@@ -596,7 +551,7 @@ public:
class Item_nodeset_to_const_comparator :public Item_bool_func
{
String *pxml;
- String tmp_nodeset;
+ NativeNodesetBuffer tmp_nodeset;
public:
Item_nodeset_to_const_comparator(THD *thd, Item *nodeset, Item *cmpfunc,
String *p):
@@ -606,7 +561,7 @@ public:
{
return mark_unsupported_function(func_name(), arg, VCOL_IMPOSSIBLE);
}
- Field *create_tmp_field_ex(TABLE *table, Tmp_field_src *src,
+ Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src,
const Tmp_field_param *param)
{
DBUG_ASSERT(0);
@@ -617,9 +572,9 @@ public:
Item_func *comp= (Item_func*)args[1];
Item_string_xml_non_const *fake=
(Item_string_xml_non_const*)(comp->arguments()[0]);
- String *res= args[0]->val_raw(&tmp_nodeset);
- MY_XPATH_FLT *fltbeg= (MY_XPATH_FLT*) res->ptr();
- MY_XPATH_FLT *fltend= (MY_XPATH_FLT*) (res->ptr() + res->length());
+ args[0]->val_native(current_thd, &tmp_nodeset);
+ MY_XPATH_FLT *fltbeg= (MY_XPATH_FLT*) tmp_nodeset.ptr();
+ MY_XPATH_FLT *fltend= (MY_XPATH_FLT*) tmp_nodeset.end();
MY_XML_NODE *nodebeg= (MY_XML_NODE*) pxml->ptr();
uint numnodes= pxml->length() / sizeof(MY_XML_NODE);
@@ -648,32 +603,32 @@ public:
};
-String *Item_nodeset_func_rootelement::val_raw(String *nodeset)
+bool Item_nodeset_func_rootelement::val_native(THD *thd, Native *nodeset)
{
nodeset->length(0);
- ((XPathFilter*)nodeset)->append_element(0, 0);
- return nodeset;
+ return MY_XPATH_FLT(0, 0).append_to(nodeset);
}
-String * Item_nodeset_func_union::val_raw(String *nodeset)
+bool Item_nodeset_func_union::val_native(THD *thd, Native *nodeset)
{
uint num_nodes= pxml->length() / sizeof(MY_XML_NODE);
- String set0, *s0= args[0]->val_raw(&set0);
- String set1, *s1= args[1]->val_raw(&set1);
+ NativeNodesetBuffer set0, set1;
+ args[0]->val_native(thd, &set0);
+ args[1]->val_native(thd, &set1);
String both_str;
both_str.alloc(num_nodes);
char *both= (char*) both_str.ptr();
bzero((void*)both, num_nodes);
MY_XPATH_FLT *flt;
- fltbeg= (MY_XPATH_FLT*) s0->ptr();
- fltend= (MY_XPATH_FLT*) (s0->ptr() + s0->length());
+ fltbeg= (MY_XPATH_FLT*) set0.ptr();
+ fltend= (MY_XPATH_FLT*) set0.end();
for (flt= fltbeg; flt < fltend; flt++)
both[flt->num]= 1;
- fltbeg= (MY_XPATH_FLT*) s1->ptr();
- fltend= (MY_XPATH_FLT*) (s1->ptr() + s1->length());
+ fltbeg= (MY_XPATH_FLT*) set1.ptr();
+ fltend= (MY_XPATH_FLT*) set1.end();
for (flt= fltbeg; flt < fltend; flt++)
both[flt->num]= 1;
@@ -681,29 +636,29 @@ String * Item_nodeset_func_union::val_raw(String *nodeset)
for (uint i= 0, pos= 0; i < num_nodes; i++)
{
if (both[i])
- ((XPathFilter*)nodeset)->append_element(i, pos++);
+ MY_XPATH_FLT(i, pos++).append_to(nodeset);
}
- return nodeset;
+ return false;
}
-String *Item_nodeset_func_selfbyname::val_raw(String *nodeset)
+bool Item_nodeset_func_selfbyname::val_native(THD *thd, Native *nodeset)
{
- prepare(nodeset);
+ prepare(thd, nodeset);
for (MY_XPATH_FLT *flt= fltbeg; flt < fltend; flt++)
{
uint pos= 0;
MY_XML_NODE *self= &nodebeg[flt->num];
if (validname(self))
- ((XPathFilter*)nodeset)->append_element(flt->num,pos++);
+ MY_XPATH_FLT(flt->num, pos++).append_to(nodeset);
}
- return nodeset;
+ return false;
}
-String *Item_nodeset_func_childbyname::val_raw(String *nodeset)
+bool Item_nodeset_func_childbyname::val_native(THD *thd, Native *nodeset)
{
- prepare(nodeset);
+ prepare(thd, nodeset);
for (MY_XPATH_FLT *flt= fltbeg; flt < fltend; flt++)
{
MY_XML_NODE *self= &nodebeg[flt->num];
@@ -715,40 +670,40 @@ String *Item_nodeset_func_childbyname::val_raw(String *nodeset)
if ((node->parent == flt->num) &&
(node->type == MY_XML_NODE_TAG) &&
validname(node))
- ((XPathFilter*)nodeset)->append_element(j, pos++);
+ MY_XPATH_FLT(j, pos++).append_to(nodeset);
}
}
- return nodeset;
+ return false;
}
-String *Item_nodeset_func_descendantbyname::val_raw(String *nodeset)
+bool Item_nodeset_func_descendantbyname::val_native(THD *thd, Native *nodeset)
{
- prepare(nodeset);
+ prepare(thd, nodeset);
for (MY_XPATH_FLT *flt= fltbeg; flt < fltend; flt++)
{
uint pos= 0;
MY_XML_NODE *self= &nodebeg[flt->num];
if (need_self && validname(self))
- ((XPathFilter*)nodeset)->append_element(flt->num,pos++);
+ MY_XPATH_FLT(flt->num, pos++).append_to(nodeset);
for (uint j= flt->num + 1 ; j < numnodes ; j++)
{
MY_XML_NODE *node= &nodebeg[j];
if (node->level <= self->level)
break;
if ((node->type == MY_XML_NODE_TAG) && validname(node))
- ((XPathFilter*)nodeset)->append_element(j,pos++);
+ MY_XPATH_FLT(j, pos++).append_to(nodeset);
}
}
- return nodeset;
+ return false;
}
-String *Item_nodeset_func_ancestorbyname::val_raw(String *nodeset)
+bool Item_nodeset_func_ancestorbyname::val_native(THD *thd, Native *nodeset)
{
char *active;
String active_str;
- prepare(nodeset);
+ prepare(thd, nodeset);
active_str.alloc(numnodes);
active= (char*) active_str.ptr();
bzero((void*)active, numnodes);
@@ -780,17 +735,17 @@ String *Item_nodeset_func_ancestorbyname::val_raw(String *nodeset)
for (uint j= 0; j < numnodes ; j++)
{
if (active[j])
- ((XPathFilter*)nodeset)->append_element(j, --pos);
+ MY_XPATH_FLT(j, --pos).append_to(nodeset);
}
- return nodeset;
+ return false;
}
-String *Item_nodeset_func_parentbyname::val_raw(String *nodeset)
+bool Item_nodeset_func_parentbyname::val_native(THD *thd, Native *nodeset)
{
char *active;
String active_str;
- prepare(nodeset);
+ prepare(thd, nodeset);
active_str.alloc(numnodes);
active= (char*) active_str.ptr();
bzero((void*)active, numnodes);
@@ -803,15 +758,15 @@ String *Item_nodeset_func_parentbyname::val_raw(String *nodeset)
for (uint j= 0, pos= 0; j < numnodes ; j++)
{
if (active[j])
- ((XPathFilter*)nodeset)->append_element(j, pos++);
+ MY_XPATH_FLT(j, pos++).append_to(nodeset);
}
- return nodeset;
+ return false;
}
-String *Item_nodeset_func_attributebyname::val_raw(String *nodeset)
+bool Item_nodeset_func_attributebyname::val_native(THD *thd, Native *nodeset)
{
- prepare(nodeset);
+ prepare(thd, nodeset);
for (MY_XPATH_FLT *flt= fltbeg; flt < fltend; flt++)
{
MY_XML_NODE *self= &nodebeg[flt->num];
@@ -823,52 +778,50 @@ String *Item_nodeset_func_attributebyname::val_raw(String *nodeset)
if ((node->parent == flt->num) &&
(node->type == MY_XML_NODE_ATTR) &&
validname(node))
- ((XPathFilter*)nodeset)->append_element(j, pos++);
+ MY_XPATH_FLT(j, pos++).append_to(nodeset);
}
}
- return nodeset;
+ return false;
}
-String *Item_nodeset_func_predicate::val_raw(String *str)
+bool Item_nodeset_func_predicate::val_native(THD *thd, Native *str)
{
Item_nodeset_func *nodeset_func= (Item_nodeset_func*) args[0];
Item_func *comp_func= (Item_func*)args[1];
uint pos= 0, size;
- prepare(str);
+ prepare(thd, str);
size= (uint)(fltend - fltbeg);
for (MY_XPATH_FLT *flt= fltbeg; flt < fltend; flt++)
{
nodeset_func->context_cache.length(0);
- ((XPathFilter*)(&nodeset_func->context_cache))->append_element(flt->num,
- flt->pos,
- size);
+ MY_XPATH_FLT(flt->num, flt->pos, size).
+ append_to(&nodeset_func->context_cache);
if (comp_func->val_int())
- ((XPathFilter*)str)->append_element(flt->num, pos++);
+ MY_XPATH_FLT(flt->num, pos++).append_to(str);
}
- return str;
+ return false;
}
-String *Item_nodeset_func_elementbyindex::val_raw(String *nodeset)
+bool Item_nodeset_func_elementbyindex::val_native(THD *thd, Native *nodeset)
{
Item_nodeset_func *nodeset_func= (Item_nodeset_func*) args[0];
- prepare(nodeset);
+ prepare(thd, nodeset);
MY_XPATH_FLT *flt;
uint pos, size= (uint)(fltend - fltbeg);
for (pos= 0, flt= fltbeg; flt < fltend; flt++)
{
nodeset_func->context_cache.length(0);
- ((XPathFilter*)(&nodeset_func->context_cache))->append_element(flt->num,
- flt->pos,
- size);
+ MY_XPATH_FLT(flt->num, flt->pos, size).
+ append_to(&nodeset_func->context_cache);
int index= (int) (args[1]->val_int()) - 1;
if (index >= 0 &&
(flt->pos == (uint) index ||
(args[1]->type_handler()->is_bool_type())))
- ((XPathFilter*)nodeset)->append_element(flt->num, pos++);
+ MY_XPATH_FLT(flt->num, pos++).append_to(nodeset);
}
- return nodeset;
+ return false;
}
@@ -1793,7 +1746,7 @@ my_xpath_parse_AxisSpecifier_NodeTest_opt_Predicate_list(MY_XPATH *xpath)
while (my_xpath_parse_term(xpath, MY_XPATH_LEX_LB))
{
Item *prev_context= xpath->context;
- String *context_cache;
+ Native *context_cache;
context_cache= &((Item_nodeset_func*)xpath->context)->context_cache;
xpath->context= new (xpath->thd->mem_root)
Item_nodeset_context_cache(xpath->thd, context_cache, xpath->pxml);
@@ -3070,19 +3023,20 @@ bool Item_func_xml_update::collect_result(String *str,
String *Item_func_xml_update::val_str(String *str)
{
- String *nodeset, *rep;
+ String *rep;
null_value= 0;
if (!nodeset_func || get_xml(&xml) ||
!(rep= args[2]->val_str(&tmp_value3)) ||
- !(nodeset= nodeset_func->val_raw(&tmp_value2)))
+ nodeset_func->type_handler() != &type_handler_xpath_nodeset ||
+ nodeset_func->val_native(current_thd, &tmp_native_value2))
{
null_value= 1;
return 0;
}
- MY_XPATH_FLT *fltbeg= (MY_XPATH_FLT*) nodeset->ptr();
- MY_XPATH_FLT *fltend= (MY_XPATH_FLT*) (nodeset->ptr() + nodeset->length());
+ MY_XPATH_FLT *fltbeg= (MY_XPATH_FLT*) tmp_native_value2.ptr();
+ MY_XPATH_FLT *fltend= (MY_XPATH_FLT*) tmp_native_value2.end();
/* Allow replacing of one tag only */
if (fltend - fltbeg != 1)
diff --git a/sql/item_xmlfunc.h b/sql/item_xmlfunc.h
index ce34697d9bd..806739d1139 100644
--- a/sql/item_xmlfunc.h
+++ b/sql/item_xmlfunc.h
@@ -2,6 +2,7 @@
#define ITEM_XMLFUNC_INCLUDED
/* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2009, 2019, 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
@@ -23,6 +24,42 @@
typedef struct my_xml_node_st MY_XML_NODE;
+/* Structure to store nodeset elements */
+class MY_XPATH_FLT
+{
+public:
+ uint num; // Absolute position in MY_XML_NODE array
+ uint pos; // Relative position in context
+ uint size; // Context size
+public:
+ MY_XPATH_FLT(uint32 num_arg, uint32 pos_arg)
+ :num(num_arg), pos(pos_arg), size(0)
+ { }
+ MY_XPATH_FLT(uint32 num_arg, uint32 pos_arg, uint32 size_arg)
+ :num(num_arg), pos(pos_arg), size(size_arg)
+ { }
+ bool append_to(Native *to) const
+ {
+ return to->append((const char*) this, (uint32) sizeof(*this));
+ }
+};
+
+
+class NativeNodesetBuffer: public NativeBuffer<16*sizeof(MY_XPATH_FLT)>
+{
+public:
+ const MY_XPATH_FLT &element(uint i) const
+ {
+ const MY_XPATH_FLT *p= (MY_XPATH_FLT*) (ptr() + i * sizeof(MY_XPATH_FLT));
+ return *p;
+ }
+ uint32 elements() const
+ {
+ return length() / sizeof(MY_XPATH_FLT);
+ }
+};
+
+
class Item_xml_str_func: public Item_str_func
{
protected:
@@ -103,7 +140,8 @@ public:
class Item_func_xml_update: public Item_xml_str_func
{
- String tmp_value2, tmp_value3;
+ NativeNodesetBuffer tmp_native_value2;
+ String tmp_value3;
bool collect_result(String *str,
const MY_XML_NODE *cut,
const String *replace);
diff --git a/sql/lex.h b/sql/lex.h
index ec657ff48df..df2de54dbc5 100644
--- a/sql/lex.h
+++ b/sql/lex.h
@@ -261,8 +261,6 @@ static SYMBOL symbols[] = {
{ "FUNCTION", SYM(FUNCTION_SYM)},
{ "GENERAL", SYM(GENERAL)},
{ "GENERATED", SYM(GENERATED_SYM)},
- { "GEOMETRY", SYM(GEOMETRY_SYM)},
- { "GEOMETRYCOLLECTION",SYM(GEOMETRYCOLLECTION)},
{ "GET_FORMAT", SYM(GET_FORMAT)},
{ "GET", SYM(GET_SYM)},
{ "GLOBAL", SYM(GLOBAL_SYM)},
@@ -343,7 +341,6 @@ static SYMBOL symbols[] = {
{ "LIMIT", SYM(LIMIT)},
{ "LINEAR", SYM(LINEAR_SYM)},
{ "LINES", SYM(LINES)},
- { "LINESTRING", SYM(LINESTRING)},
{ "LIST", SYM(LIST_SYM)},
{ "LOAD", SYM(LOAD)},
{ "LOCAL", SYM(LOCAL_SYM)},
@@ -409,9 +406,6 @@ static SYMBOL symbols[] = {
{ "MODIFIES", SYM(MODIFIES_SYM)},
{ "MODIFY", SYM(MODIFY_SYM)},
{ "MONTH", SYM(MONTH_SYM)},
- { "MULTILINESTRING", SYM(MULTILINESTRING)},
- { "MULTIPOINT", SYM(MULTIPOINT)},
- { "MULTIPOLYGON", SYM(MULTIPOLYGON)},
{ "MUTEX", SYM(MUTEX_SYM)},
{ "MYSQL", SYM(MYSQL_SYM)},
{ "MYSQL_ERRNO", SYM(MYSQL_ERRNO_SYM)},
@@ -476,8 +470,6 @@ static SYMBOL symbols[] = {
{ "PHASE", SYM(PHASE_SYM)},
{ "PLUGIN", SYM(PLUGIN_SYM)},
{ "PLUGINS", SYM(PLUGINS_SYM)},
- { "POINT", SYM(POINT_SYM)},
- { "POLYGON", SYM(POLYGON)},
{ "PORT", SYM(PORT_SYM)},
{ "PORTION", SYM(PORTION_SYM)},
{ "PRECEDES", SYM(PRECEDES_SYM)},
@@ -749,6 +741,7 @@ static SYMBOL sql_functions[] = {
{ "EXTRACT", SYM(EXTRACT_SYM)},
{ "FIRST_VALUE", SYM(FIRST_VALUE_SYM)},
{ "GROUP_CONCAT", SYM(GROUP_CONCAT_SYM)},
+ { "JSON_ARRAYAGG", SYM(JSON_ARRAYAGG_SYM)},
{ "LAG", SYM(LAG_SYM)},
{ "LEAD", SYM(LEAD_SYM)},
{ "MAX", SYM(MAX_SYM)},
diff --git a/sql/lex_string.h b/sql/lex_string.h
index 88a7154b064..a62609c6b60 100644
--- a/sql/lex_string.h
+++ b/sql/lex_string.h
@@ -18,8 +18,46 @@
#ifndef LEX_STRING_INCLUDED
#define LEX_STRING_INCLUDED
+
typedef struct st_mysql_const_lex_string LEX_CSTRING;
+
+class Lex_cstring : public LEX_CSTRING
+{
+ public:
+ Lex_cstring()
+ {
+ str= NULL;
+ length= 0;
+ }
+ Lex_cstring(const char *_str, size_t _len)
+ {
+ str= _str;
+ length= _len;
+ }
+ Lex_cstring(const char *start, const char *end)
+ {
+ DBUG_ASSERT(start <= end);
+ str= start;
+ length= end - start;
+ }
+ void set(const char *_str, size_t _len)
+ {
+ str= _str;
+ length= _len;
+ }
+};
+
+
+class Lex_cstring_strlen: public Lex_cstring
+{
+public:
+ Lex_cstring_strlen(const char *from)
+ :Lex_cstring(from, from ? strlen(from) : 0)
+ { }
+};
+
+
/* Functions to compare if two lex strings are equal */
static inline bool lex_string_cmp(CHARSET_INFO *charset, const LEX_CSTRING *a,
diff --git a/sql/log.cc b/sql/log.cc
index 7f632b43cb6..4f51a9a9c17 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -1680,9 +1680,6 @@ binlog_trans_log_truncate(THD *thd, my_off_t pos)
int binlog_init(void *p)
{
binlog_hton= (handlerton *)p;
- binlog_hton->state= (WSREP_ON || opt_bin_log) ? SHOW_OPTION_YES
- : SHOW_OPTION_NO;
- binlog_hton->db_type=DB_TYPE_BINLOG;
binlog_hton->savepoint_offset= sizeof(my_off_t);
binlog_hton->close_connection= binlog_close_connection;
binlog_hton->savepoint_set= binlog_savepoint_set;
@@ -1691,8 +1688,11 @@ int binlog_init(void *p)
binlog_savepoint_rollback_can_release_mdl;
binlog_hton->commit= binlog_commit;
binlog_hton->rollback= binlog_rollback;
- binlog_hton->prepare= binlog_prepare;
- binlog_hton->start_consistent_snapshot= binlog_start_consistent_snapshot;
+ if (WSREP_ON || opt_bin_log)
+ {
+ binlog_hton->prepare= binlog_prepare;
+ binlog_hton->start_consistent_snapshot= binlog_start_consistent_snapshot;
+ }
binlog_hton->flags= HTON_NOT_USER_SELECTABLE | HTON_HIDDEN;
return 0;
}
@@ -1723,7 +1723,6 @@ static int binlog_close_connection(handlerton *hton, THD *thd)
}
#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);
DBUG_RETURN(0);
@@ -2591,24 +2590,14 @@ end:
}
-void MYSQL_LOG::init(enum_log_type log_type_arg,
- enum cache_type io_cache_type_arg)
-{
- DBUG_ENTER("MYSQL_LOG::init");
- log_type= log_type_arg;
- io_cache_type= io_cache_type_arg;
- DBUG_PRINT("info",("log_type: %d", log_type));
- DBUG_VOID_RETURN;
-}
-
-
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);
+ log_type= log_type_arg;
+ io_cache_type= io_cache_type_arg;
if (new_name)
{
@@ -3459,7 +3448,6 @@ 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,
@@ -3470,7 +3458,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));
mysql_mutex_assert_owner(&LOCK_log);
@@ -3490,7 +3477,7 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
/* 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))
+ LOG_BIN, io_cache_type_arg))
{
sql_print_error("MYSQL_BIN_LOG::open failed to generate new file name.");
DBUG_RETURN(1);
@@ -4324,7 +4311,7 @@ bool MYSQL_BIN_LOG::reset_logs(THD *thd, bool create_new_log,
}
}
if (create_new_log && !open_index_file(index_file_name, 0, FALSE))
- if (unlikely((error= open(save_name, log_type, 0, next_log_number,
+ if (unlikely((error= open(save_name, 0, next_log_number,
io_cache_type, max_size, 0, FALSE))))
goto err;
my_free((void *) save_name);
@@ -5231,34 +5218,33 @@ int MYSQL_BIN_LOG::new_file_impl()
}
new_name_ptr=new_name;
- if (log_type == LOG_BIN)
{
+ /*
+ We log the whole file name for log file as the user may decide
+ to change base names at some point.
+ */
+ Rotate_log_event r(new_name + dirname_length(new_name), 0, LOG_EVENT_OFFSET,
+ is_relay_log ? Rotate_log_event::RELAY_LOG : 0);
+ /*
+ The current relay-log's closing Rotate event must have checksum
+ value computed with an algorithm of the last relay-logged FD event.
+ */
+ if (is_relay_log)
+ 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= write_event(&r)))
{
- /*
- We log the whole file name for log file as the user may decide
- to change base names at some point.
- */
- Rotate_log_event r(new_name+dirname_length(new_name), 0, LOG_EVENT_OFFSET,
- is_relay_log ? Rotate_log_event::RELAY_LOG : 0);
- /*
- The current relay-log's closing Rotate event must have checksum
- value computed with an algorithm of the last relay-logged FD event.
- */
- if (is_relay_log)
- 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= 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_THD_OR_DEFAULT(current_thd, ER_CANT_OPEN_FILE),
- MYF(ME_FATAL), name, errno);
- goto end;
- }
- bytes_written += r.data_written;
+ DBUG_EXECUTE_IF("fault_injection_new_file_rotate_event", errno= 2;);
+ close_on_error= TRUE;
+ my_printf_error(ER_ERROR_ON_WRITE,
+ ER_THD_OR_DEFAULT(current_thd, ER_CANT_OPEN_FILE),
+ MYF(ME_FATAL), name, errno);
+ goto end;
}
+ bytes_written+= r.data_written;
}
/*
@@ -5289,7 +5275,7 @@ int MYSQL_BIN_LOG::new_file_impl()
delay_close= true;
}
close(close_flag);
- if (log_type == LOG_BIN && checksum_alg_reset != BINLOG_CHECKSUM_ALG_UNDEF)
+ if (checksum_alg_reset != BINLOG_CHECKSUM_ALG_UNDEF)
{
DBUG_ASSERT(!is_relay_log);
DBUG_ASSERT(binlog_checksum_options != checksum_alg_reset);
@@ -5316,8 +5302,7 @@ int MYSQL_BIN_LOG::new_file_impl()
{
/* reopen the binary log file. */
file_to_open= new_name_ptr;
- error= open(old_name, log_type, new_name_ptr, 0, io_cache_type,
- max_size, 1, FALSE);
+ error= open(old_name, new_name_ptr, 0, io_cache_type, max_size, 1, FALSE);
}
/* handle reopening errors */
@@ -7750,7 +7735,7 @@ MYSQL_BIN_LOG::write_transaction_to_binlog_events(group_commit_entry *entry)
Release commit order and if leader, wait for prior commit to
complete. This establishes total order for group leaders.
*/
- if (wsrep_ordered_commit(entry->thd, entry->all, wsrep_apply_error()))
+ if (wsrep_ordered_commit(entry->thd, entry->all))
{
entry->thd->wakeup_subsequent_commits(1);
return 1;
@@ -8501,9 +8486,9 @@ void MYSQL_BIN_LOG::close(uint exiting)
if (log_state == LOG_OPENED)
{
+ DBUG_ASSERT(log_type == LOG_BIN);
#ifdef HAVE_REPLICATION
- if (log_type == LOG_BIN &&
- (exiting & LOG_CLOSE_STOP_EVENT))
+ if (exiting & LOG_CLOSE_STOP_EVENT)
{
Stop_log_event s;
// the checksumming rule for relay-log case is similar to Rotate
@@ -8540,8 +8525,7 @@ void MYSQL_BIN_LOG::close(uint exiting)
#endif /* HAVE_REPLICATION */
/* don't pwrite in a file opened with O_APPEND - it doesn't work */
- if (log_file.type == WRITE_CACHE && log_type == LOG_BIN
- && !(exiting & LOG_CLOSE_DELAYED_CLOSE))
+ if (log_file.type == WRITE_CACHE && !(exiting & LOG_CLOSE_DELAYED_CLOSE))
{
my_off_t org_position= mysql_file_tell(log_file.file, MYF(0));
if (!failed_to_save_state)
@@ -9692,7 +9676,7 @@ int TC_LOG_BINLOG::open(const char *opt_name)
{
mysql_mutex_lock(&LOCK_log);
/* generate a new binlog to mask a corrupted one */
- open(opt_name, LOG_BIN, 0, 0, WRITE_CACHE, max_binlog_size, 0, TRUE);
+ open(opt_name, 0, 0, WRITE_CACHE, max_binlog_size, 0, TRUE);
mysql_mutex_unlock(&LOCK_log);
cleanup();
return 1;
@@ -10439,24 +10423,6 @@ MYSQL_BIN_LOG::do_binlog_recovery(const char *opt_name, bool do_xa_recovery)
#ifdef INNODB_COMPATIBILITY_HOOKS
-/**
- Get the file name of the MySQL binlog.
- @return the name of the binlog file
-*/
-extern "C"
-const char* mysql_bin_log_file_name(void)
-{
- return mysql_bin_log.get_log_fname();
-}
-/**
- Get the current position of the MySQL binlog.
- @return byte offset from the beginning of the binlog
-*/
-extern "C"
-ulonglong mysql_bin_log_file_pos(void)
-{
- return (ulonglong) mysql_bin_log.get_log_file()->pos_in_file;
-}
/*
Get the current position of the MySQL binlog for transaction currently being
committed.
diff --git a/sql/log.h b/sql/log.h
index 52bab149381..bf1dbd30c6c 100644
--- a/sql/log.h
+++ b/sql/log.h
@@ -305,13 +305,6 @@ public:
enum_log_type log_type,
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,
@@ -335,7 +328,12 @@ public:
/** Instrumentation key to use for file io in @c log_file */
PSI_file_key m_log_file_key;
#endif
- /* for documentation of mutexes held in various places in code */
+
+ 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);
};
/* Tell the io thread if we can delay the master info sync. */
@@ -414,7 +412,6 @@ struct wait_for_commit;
class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG
{
- private:
#ifdef HAVE_PSI_INTERFACE
/** The instrumentation key to use for @ LOCK_index. */
PSI_mutex_key m_key_LOCK_index;
@@ -776,7 +773,6 @@ public:
void init_pthread_objects();
void cleanup();
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,
diff --git a/sql/log_event.cc b/sql/log_event.cc
index e31713468e0..0acc15f65f3 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2000, 2019, Oracle and/or its affiliates.
+ Copyright (c) 2000, 2018, Oracle and/or its affiliates.
Copyright (c) 2009, 2019, MariaDB
This program is free software; you can redistribute it and/or modify
@@ -39,7 +39,6 @@
#include "transaction.h"
#include <my_dir.h>
#include "sql_show.h" // append_identifier
-#include "debug_sync.h" // debug_sync
#include <mysql/psi/mysql_statement.h>
#include <strfunc.h>
#include "compat56.h"
@@ -80,9 +79,6 @@ TYPELIB binlog_checksum_typelib=
};
-
-#define log_cs &my_charset_latin1
-
#define FLAGSTR(V,F) ((V)&(F)?#F" ":"")
/*
@@ -107,179 +103,6 @@ const Version checksum_version_split_mariadb(5, 3, 0);
// First MySQL version with fraction seconds
const Version fsp_version_split_mysql(5, 6, 0);
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
-static int rows_event_stmt_cleanup(rpl_group_info *rgi, THD* thd);
-
-static const char *HA_ERR(int i)
-{
- /*
- This function should only be called in case of an error
- was detected
- */
- DBUG_ASSERT(i != 0);
- switch (i) {
- case HA_ERR_KEY_NOT_FOUND: return "HA_ERR_KEY_NOT_FOUND";
- case HA_ERR_FOUND_DUPP_KEY: return "HA_ERR_FOUND_DUPP_KEY";
- case HA_ERR_RECORD_CHANGED: return "HA_ERR_RECORD_CHANGED";
- case HA_ERR_WRONG_INDEX: return "HA_ERR_WRONG_INDEX";
- case HA_ERR_CRASHED: return "HA_ERR_CRASHED";
- case HA_ERR_WRONG_IN_RECORD: return "HA_ERR_WRONG_IN_RECORD";
- case HA_ERR_OUT_OF_MEM: return "HA_ERR_OUT_OF_MEM";
- case HA_ERR_NOT_A_TABLE: return "HA_ERR_NOT_A_TABLE";
- case HA_ERR_WRONG_COMMAND: return "HA_ERR_WRONG_COMMAND";
- case HA_ERR_OLD_FILE: return "HA_ERR_OLD_FILE";
- case HA_ERR_NO_ACTIVE_RECORD: return "HA_ERR_NO_ACTIVE_RECORD";
- case HA_ERR_RECORD_DELETED: return "HA_ERR_RECORD_DELETED";
- case HA_ERR_RECORD_FILE_FULL: return "HA_ERR_RECORD_FILE_FULL";
- case HA_ERR_INDEX_FILE_FULL: return "HA_ERR_INDEX_FILE_FULL";
- case HA_ERR_END_OF_FILE: return "HA_ERR_END_OF_FILE";
- case HA_ERR_UNSUPPORTED: return "HA_ERR_UNSUPPORTED";
- case HA_ERR_TO_BIG_ROW: return "HA_ERR_TO_BIG_ROW";
- case HA_WRONG_CREATE_OPTION: return "HA_WRONG_CREATE_OPTION";
- case HA_ERR_FOUND_DUPP_UNIQUE: return "HA_ERR_FOUND_DUPP_UNIQUE";
- case HA_ERR_UNKNOWN_CHARSET: return "HA_ERR_UNKNOWN_CHARSET";
- case HA_ERR_WRONG_MRG_TABLE_DEF: return "HA_ERR_WRONG_MRG_TABLE_DEF";
- case HA_ERR_CRASHED_ON_REPAIR: return "HA_ERR_CRASHED_ON_REPAIR";
- case HA_ERR_CRASHED_ON_USAGE: return "HA_ERR_CRASHED_ON_USAGE";
- case HA_ERR_LOCK_WAIT_TIMEOUT: return "HA_ERR_LOCK_WAIT_TIMEOUT";
- case HA_ERR_LOCK_TABLE_FULL: return "HA_ERR_LOCK_TABLE_FULL";
- case HA_ERR_READ_ONLY_TRANSACTION: return "HA_ERR_READ_ONLY_TRANSACTION";
- case HA_ERR_LOCK_DEADLOCK: return "HA_ERR_LOCK_DEADLOCK";
- case HA_ERR_CANNOT_ADD_FOREIGN: return "HA_ERR_CANNOT_ADD_FOREIGN";
- case HA_ERR_NO_REFERENCED_ROW: return "HA_ERR_NO_REFERENCED_ROW";
- case HA_ERR_ROW_IS_REFERENCED: return "HA_ERR_ROW_IS_REFERENCED";
- case HA_ERR_NO_SAVEPOINT: return "HA_ERR_NO_SAVEPOINT";
- case HA_ERR_NON_UNIQUE_BLOCK_SIZE: return "HA_ERR_NON_UNIQUE_BLOCK_SIZE";
- case HA_ERR_NO_SUCH_TABLE: return "HA_ERR_NO_SUCH_TABLE";
- case HA_ERR_TABLE_EXIST: return "HA_ERR_TABLE_EXIST";
- case HA_ERR_NO_CONNECTION: return "HA_ERR_NO_CONNECTION";
- case HA_ERR_NULL_IN_SPATIAL: return "HA_ERR_NULL_IN_SPATIAL";
- case HA_ERR_TABLE_DEF_CHANGED: return "HA_ERR_TABLE_DEF_CHANGED";
- case HA_ERR_NO_PARTITION_FOUND: return "HA_ERR_NO_PARTITION_FOUND";
- case HA_ERR_RBR_LOGGING_FAILED: return "HA_ERR_RBR_LOGGING_FAILED";
- case HA_ERR_DROP_INDEX_FK: return "HA_ERR_DROP_INDEX_FK";
- case HA_ERR_FOREIGN_DUPLICATE_KEY: return "HA_ERR_FOREIGN_DUPLICATE_KEY";
- case HA_ERR_TABLE_NEEDS_UPGRADE: return "HA_ERR_TABLE_NEEDS_UPGRADE";
- case HA_ERR_TABLE_READONLY: return "HA_ERR_TABLE_READONLY";
- case HA_ERR_AUTOINC_READ_FAILED: return "HA_ERR_AUTOINC_READ_FAILED";
- case HA_ERR_AUTOINC_ERANGE: return "HA_ERR_AUTOINC_ERANGE";
- case HA_ERR_GENERIC: return "HA_ERR_GENERIC";
- case HA_ERR_RECORD_IS_THE_SAME: return "HA_ERR_RECORD_IS_THE_SAME";
- case HA_ERR_LOGGING_IMPOSSIBLE: return "HA_ERR_LOGGING_IMPOSSIBLE";
- case HA_ERR_CORRUPT_EVENT: return "HA_ERR_CORRUPT_EVENT";
- case HA_ERR_ROWS_EVENT_APPLY : return "HA_ERR_ROWS_EVENT_APPLY";
- }
- return "No Error!";
-}
-
-
-/*
- Return true if an error caught during event execution is a temporary error
- that will cause automatic retry of the event group during parallel
- replication, false otherwise.
-
- In parallel replication, conflicting transactions can occasionally cause
- deadlocks; such errors are handled automatically by rolling back re-trying
- the transactions, so should not pollute the error log.
-*/
-static bool
-is_parallel_retry_error(rpl_group_info *rgi, int err)
-{
- if (!rgi->is_parallel_exec)
- return false;
- if (rgi->speculation == rpl_group_info::SPECULATE_OPTIMISTIC)
- return true;
- if (rgi->killed_for_retry &&
- (err == ER_QUERY_INTERRUPTED || err == ER_CONNECTION_KILLED))
- return true;
- return has_temporary_error(rgi->thd);
-}
-
-
-/**
- Error reporting facility for Rows_log_event::do_apply_event
-
- @param level error, warning or info
- @param ha_error HA_ERR_ code
- @param rli pointer to the active Relay_log_info instance
- @param thd pointer to the slave thread's thd
- @param table pointer to the event's table object
- @param type the type of the event
- @param log_name the master binlog file name
- @param pos the master binlog file pos (the next after the event)
-
-*/
-static void inline slave_rows_error_report(enum loglevel level, int ha_error,
- rpl_group_info *rgi, THD *thd,
- TABLE *table, const char * type,
- const char *log_name, my_off_t pos)
-{
- const char *handler_error= (ha_error ? HA_ERR(ha_error) : NULL);
- char buff[MAX_SLAVE_ERRMSG], *slider;
- const char *buff_end= buff + sizeof(buff);
- size_t len;
- Diagnostics_area::Sql_condition_iterator it=
- thd->get_stmt_da()->sql_conditions();
- Relay_log_info const *rli= rgi->rli;
- const Sql_condition *err;
- buff[0]= 0;
- int errcode= thd->is_error() ? thd->get_stmt_da()->sql_errno() : 0;
-
- /*
- In parallel replication, deadlocks or other temporary errors can happen
- occasionally in normal operation, they will be handled correctly and
- automatically by re-trying the transactions. So do not pollute the error
- log with messages about them.
- */
- if (is_parallel_retry_error(rgi, errcode))
- return;
-
- for (err= it++, slider= buff; err && slider < buff_end - 1;
- slider += len, err= it++)
- {
- len= my_snprintf(slider, buff_end - slider,
- " %s, Error_code: %d;", err->get_message_text(),
- err->get_sql_errno());
- }
-
- if (ha_error != 0)
- rli->report(level, errcode, rgi->gtid_info(),
- "Could not execute %s event on table %s.%s;"
- "%s handler error %s; "
- "the event's master log %s, end_log_pos %llu",
- type, table->s->db.str, table->s->table_name.str,
- buff, handler_error == NULL ? "<unknown>" : handler_error,
- log_name, pos);
- else
- rli->report(level, errcode, rgi->gtid_info(),
- "Could not execute %s event on table %s.%s;"
- "%s the event's master log %s, end_log_pos %llu",
- type, table->s->db.str, table->s->table_name.str,
- buff, log_name, pos);
-}
-#endif
-
-#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-static void set_thd_db(THD *thd, Rpl_filter *rpl_filter,
- const char *db, uint32 db_len)
-{
- char lcase_db_buf[NAME_LEN +1];
- LEX_CSTRING new_db;
- new_db.length= db_len;
- if (lower_case_table_names == 1)
- {
- strmov(lcase_db_buf, db);
- my_casedn_str(system_charset_info, lcase_db_buf);
- new_db.str= lcase_db_buf;
- }
- else
- new_db.str= db;
- /* TODO WARNING this makes rewrite_db respect lower_case_table_names values
- * for more info look MDEV-17446 */
- new_db.str= rpl_filter->get_rewrite_db(new_db.str, &new_db.length);
- thd->set_db(&new_db);
-}
-#endif
/*
Cache that will automatically be written to a dedicated file on
destruction.
@@ -292,7 +115,7 @@ class Write_on_release_cache
public:
enum flag
{
- FLUSH_F= 1
+ FLUSH_F
};
typedef unsigned short flag_set;
@@ -383,187 +206,6 @@ private:
Log_event *m_ev; // Used for Flashback
};
-/*
- pretty_print_str()
-*/
-
-#ifdef MYSQL_CLIENT
-static bool pretty_print_str(IO_CACHE* cache, const char* str, int len)
-{
- const char* end = str + len;
- if (my_b_write_byte(cache, '\''))
- goto err;
-
- while (str < end)
- {
- char c;
- int error;
-
- switch ((c=*str++)) {
- case '\n': error= my_b_write(cache, (uchar*)"\\n", 2); break;
- case '\r': error= my_b_write(cache, (uchar*)"\\r", 2); break;
- case '\\': error= my_b_write(cache, (uchar*)"\\\\", 2); break;
- case '\b': error= my_b_write(cache, (uchar*)"\\b", 2); break;
- case '\t': error= my_b_write(cache, (uchar*)"\\t", 2); break;
- case '\'': error= my_b_write(cache, (uchar*)"\\'", 2); break;
- case 0 : error= my_b_write(cache, (uchar*)"\\0", 2); break;
- default:
- error= my_b_write_byte(cache, c);
- break;
- }
- if (unlikely(error))
- goto err;
- }
- return my_b_write_byte(cache, '\'');
-
-err:
- return 1;
-}
-#endif /* MYSQL_CLIENT */
-
-#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-
-inline int idempotent_error_code(int err_code)
-{
- int ret= 0;
-
- switch (err_code)
- {
- case 0:
- ret= 1;
- break;
- /*
- The following list of "idempotent" errors
- means that an error from the list might happen
- because of idempotent (more than once)
- applying of a binlog file.
- Notice, that binlog has a ddl operation its
- second applying may cause
-
- case HA_ERR_TABLE_DEF_CHANGED:
- case HA_ERR_CANNOT_ADD_FOREIGN:
-
- which are not included into to the list.
-
- Note that HA_ERR_RECORD_DELETED is not in the list since
- do_exec_row() should not return that error code.
- */
- case HA_ERR_RECORD_CHANGED:
- case HA_ERR_KEY_NOT_FOUND:
- case HA_ERR_END_OF_FILE:
- case HA_ERR_FOUND_DUPP_KEY:
- case HA_ERR_FOUND_DUPP_UNIQUE:
- case HA_ERR_FOREIGN_DUPLICATE_KEY:
- case HA_ERR_NO_REFERENCED_ROW:
- case HA_ERR_ROW_IS_REFERENCED:
- ret= 1;
- break;
- default:
- ret= 0;
- break;
- }
- return (ret);
-}
-
-/**
- Ignore error code specified on command line.
-*/
-
-inline int ignored_error_code(int err_code)
-{
- if (use_slave_mask && bitmap_is_set(&slave_error_mask, err_code))
- {
- statistic_increment(slave_skipped_errors, LOCK_status);
- return 1;
- }
- return err_code == ER_SLAVE_IGNORED_TABLE;
-}
-
-/*
- This function converts an engine's error to a server error.
-
- If the thread does not have an error already reported, it tries to
- define it by calling the engine's method print_error. However, if a
- mapping is not found, it uses the ER_UNKNOWN_ERROR and prints out a
- warning message.
-*/
-int convert_handler_error(int error, THD* thd, TABLE *table)
-{
- uint actual_error= (thd->is_error() ? thd->get_stmt_da()->sql_errno() :
- 0);
-
- if (actual_error == 0)
- {
- table->file->print_error(error, MYF(0));
- actual_error= (thd->is_error() ? thd->get_stmt_da()->sql_errno() :
- ER_UNKNOWN_ERROR);
- if (actual_error == ER_UNKNOWN_ERROR)
- if (global_system_variables.log_warnings)
- sql_print_warning("Unknown error detected %d in handler", error);
- }
-
- return (actual_error);
-}
-
-inline bool concurrency_error_code(int error)
-{
- switch (error)
- {
- case ER_LOCK_WAIT_TIMEOUT:
- case ER_LOCK_DEADLOCK:
- case ER_XA_RBDEADLOCK:
- return TRUE;
- default:
- return (FALSE);
- }
-}
-
-inline bool unexpected_error_code(int unexpected_error)
-{
- switch (unexpected_error)
- {
- case ER_NET_READ_ERROR:
- case ER_NET_ERROR_ON_WRITE:
- case ER_QUERY_INTERRUPTED:
- case ER_STATEMENT_TIMEOUT:
- case ER_CONNECTION_KILLED:
- case ER_SERVER_SHUTDOWN:
- case ER_NEW_ABORTING_CONNECTION:
- return(TRUE);
- default:
- return(FALSE);
- }
-}
-
-/*
- pretty_print_str()
-*/
-
-static void
-pretty_print_str(String *packet, const char *str, int len)
-{
- const char *end= str + len;
- packet->append(STRING_WITH_LEN("'"));
- while (str < end)
- {
- char c;
- switch ((c=*str++)) {
- case '\n': packet->append(STRING_WITH_LEN("\\n")); break;
- case '\r': packet->append(STRING_WITH_LEN("\\r")); break;
- case '\\': packet->append(STRING_WITH_LEN("\\\\")); break;
- case '\b': packet->append(STRING_WITH_LEN("\\b")); break;
- case '\t': packet->append(STRING_WITH_LEN("\\t")); break;
- case '\'': packet->append(STRING_WITH_LEN("\\'")); break;
- case 0 : packet->append(STRING_WITH_LEN("\\0")); break;
- default:
- packet->append(&c, 1);
- break;
- }
- }
- packet->append(STRING_WITH_LEN("'"));
-}
-#endif /* !MYSQL_CLIENT */
-
#ifndef DBUG_OFF
#define DBUG_DUMP_EVENT_BUF(B,L) \
do { \
@@ -587,131 +229,6 @@ pretty_print_str(String *packet, const char *str, int len)
#define DBUG_DUMP_EVENT_BUF(B,L) do { } while(0)
#endif
-#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-
-/**
- Create a prefix for the temporary files that is to be used for
- load data file name for this master
-
- @param name Store prefix of name here
- @param connection_name Connection name
-
- @return pointer to end of name
-
- @description
- We assume that FN_REFLEN is big enough to hold
- MAX_CONNECTION_NAME * MAX_FILENAME_MBWIDTH characters + 2 numbers +
- a short extension.
-
- The resulting file name has the following parts, each separated with a '-'
- - PREFIX_SQL_LOAD (SQL_LOAD-)
- - If a connection name is given (multi-master setup):
- - Add an extra '-' to mark that this is a multi-master file
- - connection name in lower case, converted to safe file characters.
- (see create_logfile_name_with_suffix()).
- - server_id
- - A last '-' (after server_id).
-*/
-
-static char *load_data_tmp_prefix(char *name,
- LEX_CSTRING *connection_name)
-{
- name= strmov(name, PREFIX_SQL_LOAD);
- if (connection_name->length)
- {
- uint buf_length;
- uint errors;
- /* Add marker that this is a multi-master-file */
- *name++='-';
- /* Convert connection_name to a safe filename */
- buf_length= strconvert(system_charset_info, connection_name->str, FN_REFLEN,
- &my_charset_filename, name, FN_REFLEN, &errors);
- name+= buf_length;
- *name++= '-';
- }
- name= int10_to_str(global_system_variables.server_id, name, 10);
- *name++ = '-';
- *name= '\0'; // For testing prefixes
- return name;
-}
-
-
-/**
- Creates a temporary name for LOAD DATA INFILE
-
- @param buf Store new filename here
- @param file_id File_id (part of file name)
- @param event_server_id Event_id (part of file name)
- @param ext Extension for file name
-
- @return
- Pointer to start of extension
-*/
-
-static char *slave_load_file_stem(char *buf, uint file_id,
- int event_server_id, const char *ext,
- LEX_CSTRING *connection_name)
-{
- char *res;
- res= buf+ unpack_dirname(buf, slave_load_tmpdir);
- to_unix_path(buf);
- buf= load_data_tmp_prefix(res, connection_name);
- buf= int10_to_str(event_server_id, buf, 10);
- *buf++ = '-';
- res= int10_to_str(file_id, buf, 10);
- strmov(res, ext); // Add extension last
- return res; // Pointer to extension
-}
-#endif
-
-
-#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-
-/**
- Delete all temporary files used for SQL_LOAD.
-*/
-
-static void cleanup_load_tmpdir(LEX_CSTRING *connection_name)
-{
- MY_DIR *dirp;
- FILEINFO *file;
- uint i;
- char dir[FN_REFLEN], fname[FN_REFLEN];
- char prefbuf[31 + MAX_CONNECTION_NAME* MAX_FILENAME_MBWIDTH + 1];
- DBUG_ENTER("cleanup_load_tmpdir");
-
- unpack_dirname(dir, slave_load_tmpdir);
- if (!(dirp=my_dir(dir, MYF(MY_WME))))
- return;
-
- /*
- When we are deleting temporary files, we should only remove
- the files associated with the server id of our server.
- We don't use event_server_id here because since we've disabled
- direct binlogging of Create_file/Append_file/Exec_load events
- we cannot meet Start_log event in the middle of events from one
- LOAD DATA.
- */
-
- load_data_tmp_prefix(prefbuf, connection_name);
- DBUG_PRINT("enter", ("dir: '%s' prefix: '%s'", dir, prefbuf));
-
- for (i=0 ; i < (uint)dirp->number_of_files; i++)
- {
- file=dirp->dir_entry+i;
- if (is_prefix(file->name, prefbuf))
- {
- fn_format(fname,file->name,slave_load_tmpdir,"",MY_UNPACK_FILENAME);
- mysql_file_delete(key_file_misc, fname, MYF(0));
- }
- }
-
- my_dirend(dirp);
- DBUG_VOID_RETURN;
-}
-#endif
-
-
/*
read_str()
*/
@@ -1121,80 +638,6 @@ int binlog_buf_uncompress(const char *src, char *dst, uint32 len,
return 0;
}
-#ifndef MYSQL_CLIENT
-
-/**
- Append a version of the 'str' string suitable for use in a query to
- the 'to' string. To generate a correct escaping, the character set
- information in 'csinfo' is used.
-*/
-
-int append_query_string(CHARSET_INFO *csinfo, String *to,
- const char *str, size_t len, bool no_backslash)
-{
- char *beg, *ptr;
- uint32 const orig_len= to->length();
- if (to->reserve(orig_len + len * 2 + 4))
- return 1;
-
- beg= (char*) to->ptr() + to->length();
- ptr= beg;
- if (csinfo->escape_with_backslash_is_dangerous)
- ptr= str_to_hex(ptr, str, len);
- else
- {
- *ptr++= '\'';
- if (!no_backslash)
- {
- ptr+= escape_string_for_mysql(csinfo, ptr, 0, str, len);
- }
- else
- {
- const char *frm_str= str;
-
- for (; frm_str < (str + len); frm_str++)
- {
- /* Using '' way to represent "'" */
- if (*frm_str == '\'')
- *ptr++= *frm_str;
-
- *ptr++= *frm_str;
- }
- }
-
- *ptr++= '\'';
- }
- to->length((uint32)(orig_len + ptr - beg));
- return 0;
-}
-#endif
-
-
-/**
- Prints a "session_var=value" string. Used by mysqlbinlog to print some SET
- commands just before it prints a query.
-*/
-
-#ifdef MYSQL_CLIENT
-
-static bool print_set_option(IO_CACHE* file, uint32 bits_changed,
- uint32 option, uint32 flags, const char* name,
- bool* need_comma)
-{
- if (bits_changed & option)
- {
- if (*need_comma)
- if (my_b_write(file, (uchar*)", ", 2))
- goto err;
- if (my_b_printf(file, "%s=%d", name, MY_TEST(flags & option)))
- goto err;
- *need_comma= 1;
- }
- return 0;
-err:
- return 1;
-}
-#endif
/**************************************************************************
Log_event methods (= the parent class of all events)
@@ -1275,51 +718,6 @@ const char* Log_event::get_type_str()
Log_event::Log_event()
*/
-#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), thd(thd_arg),
- checksum_alg(BINLOG_CHECKSUM_ALG_UNDEF)
-{
- server_id= thd->variables.server_id;
- when= thd->start_time;
- when_sec_part=thd->start_time_sec_part;
-
- if (using_trans)
- cache_type= Log_event::EVENT_TRANSACTIONAL_CACHE;
- else
- cache_type= Log_event::EVENT_STMT_CACHE;
- flags= flags_arg |
- (thd->variables.option_bits & OPTION_SKIP_REPLICATION ?
- LOG_EVENT_SKIP_REPLICATION_F : 0);
-}
-
-/**
- This minimal constructor is for when you are not even sure that there
- is a valid THD. For example in the server when we are shutting down or
- flushing logs after receiving a SIGHUP (then we must write a Rotate to
- the binlog but we have no THD, so we need this minimal constructor).
-*/
-
-Log_event::Log_event()
- :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;
- /*
- We can't call my_time() here as this would cause a call before
- my_init() is called
- */
- when= 0;
- when_sec_part=0;
- log_pos= 0;
-}
-#endif /* !MYSQL_CLIENT */
-
-
-/*
- 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),
@@ -1390,395 +788,6 @@ Log_event::Log_event(const char* buf,
/* otherwise, go on with reading the header from buf (nothing now) */
}
-#ifndef MYSQL_CLIENT
-#ifdef HAVE_REPLICATION
-
-int Log_event::do_update_pos(rpl_group_info *rgi)
-{
- Relay_log_info *rli= rgi->rli;
- DBUG_ENTER("Log_event::do_update_pos");
-
- DBUG_ASSERT(!rli->belongs_to_client());
- /*
- rli is null when (as far as I (Guilhem) know) the caller is
- Load_log_event::do_apply_event *and* that one is called from
- Execute_load_log_event::do_apply_event. In this case, we don't
- do anything here ; Execute_load_log_event::do_apply_event will
- call Log_event::do_apply_event again later with the proper rli.
- Strictly speaking, if we were sure that rli is null only in the
- case discussed above, 'if (rli)' is useless here. But as we are
- not 100% sure, keep it for now.
-
- Matz: I don't think we will need this check with this refactoring.
- */
- if (rli)
- {
- /*
- In parallel execution, delay position update for the events that are
- not part of event groups (format description, rotate, and such) until
- the actual event execution reaches that point.
- */
- if (!rgi->is_parallel_exec || is_group_event(get_type_code()))
- rli->stmt_done(log_pos, thd, rgi);
- }
- DBUG_RETURN(0); // Cannot fail currently
-}
-
-
-Log_event::enum_skip_reason
-Log_event::do_shall_skip(rpl_group_info *rgi)
-{
- Relay_log_info *rli= rgi->rli;
- DBUG_PRINT("info", ("ev->server_id: %lu, ::server_id: %lu,"
- " rli->replicate_same_server_id: %d,"
- " rli->slave_skip_counter: %llu",
- (ulong) server_id,
- (ulong) global_system_variables.server_id,
- rli->replicate_same_server_id,
- rli->slave_skip_counter));
- if ((server_id == global_system_variables.server_id &&
- !rli->replicate_same_server_id) ||
- (rli->slave_skip_counter == 1 && rli->is_in_group()) ||
- (flags & LOG_EVENT_SKIP_REPLICATION_F &&
- opt_replicate_events_marked_for_skip != RPL_SKIP_REPLICATE))
- return EVENT_SKIP_IGNORE;
- if (rli->slave_skip_counter > 0)
- return EVENT_SKIP_COUNT;
- return EVENT_SKIP_NOT;
-}
-
-
-/*
- Log_event::pack_info()
-*/
-
-void Log_event::pack_info(Protocol *protocol)
-{
- protocol->store("", &my_charset_bin);
-}
-
-
-/**
- Only called by SHOW BINLOG EVENTS
-*/
-int Log_event::net_send(Protocol *protocol, const char* log_name, my_off_t pos)
-{
- const char *p= strrchr(log_name, FN_LIBCHAR);
- const char *event_type;
- if (p)
- log_name = p + 1;
-
- protocol->prepare_for_resend();
- protocol->store(log_name, &my_charset_bin);
- protocol->store((ulonglong) pos);
- event_type = get_type_str();
- protocol->store(event_type, strlen(event_type), &my_charset_bin);
- protocol->store((uint32) server_id);
- protocol->store((ulonglong) log_pos);
- pack_info(protocol);
- return protocol->write();
-}
-#endif /* HAVE_REPLICATION */
-
-
-/**
- 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.
-*/
-
-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_INT64_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_INT64_NUM_DECIMAL_DIGITS,
- MYSQL_TYPE_LONGLONG),
- mem_root);
- field_list->push_back(new (mem_root) Item_empty_string(thd, "Info", 20),
- mem_root);
-}
-
-/**
- A decider of whether to trigger checksum computation or not.
- To be invoked in Log_event::write() stack.
- The decision is positive
-
- S,M) if it's been marked for checksumming with @c checksum_alg
-
- M) otherwise, if @@global.binlog_checksum is not NONE and the event is
- directly written to the binlog file.
- The to-be-cached event decides at @c write_cache() time.
-
- Otherwise the decision is negative.
-
- @note A side effect of the method is altering Log_event::checksum_alg
- it the latter was undefined at calling.
-
- @return true (positive) or false (negative)
-*/
-my_bool Log_event::need_checksum()
-{
- DBUG_ENTER("Log_event::need_checksum");
- my_bool ret;
- /*
- few callers of Log_event::write
- (incl FD::write, FD constructing code on the slave side, Rotate relay log
- and Stop event)
- provides their checksum alg preference through Log_event::checksum_alg.
- */
- 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
- call (and therefore data_written is not zero) then `ret' must be
- TRUE. It may not be null because FD is always checksummed.
- */
-
- DBUG_ASSERT(get_type_code() != FORMAT_DESCRIPTION_EVENT || ret ||
- data_written == 0);
-
- DBUG_ASSERT(!ret ||
- ((checksum_alg == binlog_checksum_options ||
- /*
- Stop event closes the relay-log and its checksum alg
- preference is set by the caller can be different
- from the server's binlog_checksum_options.
- */
- get_type_code() == STOP_EVENT ||
- /*
- Rotate:s can be checksummed regardless of the server's
- binlog_checksum_options. That applies to both
- 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 ||
- get_type_code() == START_ENCRYPTION_EVENT ||
- /* FD is always checksummed */
- get_type_code() == FORMAT_DESCRIPTION_EVENT) &&
- checksum_alg != BINLOG_CHECKSUM_ALG_OFF));
-
- DBUG_ASSERT(checksum_alg != BINLOG_CHECKSUM_ALG_UNDEF);
-
- DBUG_ASSERT(((get_type_code() != ROTATE_EVENT &&
- get_type_code() != STOP_EVENT) ||
- get_type_code() != FORMAT_DESCRIPTION_EVENT) ||
- cache_type == Log_event::EVENT_NO_CACHE);
-
- DBUG_RETURN(ret);
-}
-
-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)
-{
- uchar *dst= 0;
- size_t dstsize= 0;
-
- if (ctx)
- {
- dstsize= encryption_encrypted_length((uint)len, ENCRYPTION_KEY_SYSTEM_DATA,
- crypto->key_version);
- if (!(dst= (uchar*)my_safe_alloca(dstsize)))
- return 1;
-
- uint dstlen;
- if (len == 0)
- dstlen= 0;
- else if (encryption_ctx_update(ctx, pos, (uint)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;
-}
-
-int Log_event_writer::write_header(uchar *pos, size_t len)
-{
- DBUG_ENTER("Log_event_writer::write_header");
- /*
- 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 (checksum_len)
- {
- uchar save=pos[FLAGS_OFFSET];
- pos[FLAGS_OFFSET]&= ~LOG_EVENT_BINLOG_IN_USE_F;
- crc= my_checksum(0, pos, len);
- pos[FLAGS_OFFSET]= save;
- }
-
- if (ctx)
- {
- uchar iv[BINLOG_IV_LENGTH];
- crypto->set_iv(iv, (uint32)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_header()
-*/
-
-bool Log_event::write_header(size_t event_data_length)
-{
- uchar header[LOG_EVENT_HEADER_LEN];
- ulong now;
- DBUG_ENTER("Log_event::write_header");
- DBUG_PRINT("enter", ("filepos: %lld length: %zu type: %d",
- (longlong) writer->pos(), event_data_length,
- (int) get_type_code()));
-
- writer->checksum_len= need_checksum() ? BINLOG_CHECKSUM_LEN : 0;
-
- /* 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
- change the position
- */
-
- if (is_artificial_event())
- {
- /*
- Artificial events are automatically generated and do not exist
- in master's binary log, so log_pos should be set to 0.
- */
- log_pos= 0;
- }
- else if (!log_pos)
- {
- /*
- Calculate the position of where the next event will start
- (end of this event, that is).
- */
-
- log_pos= writer->pos() + data_written;
-
- DBUG_EXECUTE_IF("dbug_master_binlog_over_2GB", log_pos += (1ULL <<31););
- }
-
- now= get_time(); // Query start time
-
- /*
- Header will be of size LOG_EVENT_HEADER_LEN for all events, except for
- FORMAT_DESCRIPTION_EVENT and ROTATE_EVENT, where it will be
- LOG_EVENT_MINIMAL_HEADER_LEN (remember these 2 have a frozen header,
- because we read them before knowing the format).
- */
-
- int4store(header, now); // timestamp
- header[EVENT_TYPE_OFFSET]= get_type_code();
- int4store(header+ SERVER_ID_OFFSET, server_id);
- int4store(header+ EVENT_LEN_OFFSET, data_written);
- int4store(header+ LOG_POS_OFFSET, log_pos);
- 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 parse the first
@@ -2293,2208 +1302,6 @@ exit:
DBUG_RETURN(ev);
}
-#ifdef MYSQL_CLIENT
-
-static bool hexdump_minimal_header_to_io_cache(IO_CACHE *file,
- my_off_t offset,
- uchar *ptr)
-{
- DBUG_ASSERT(LOG_EVENT_MINIMAL_HEADER_LEN == 19);
-
- /*
- Pretty-print the first LOG_EVENT_MINIMAL_HEADER_LEN (19) bytes of the
- common header, which contains the basic information about the log event.
- Every event will have at least this much header, but events could contain
- more headers (which must be printed by other methods, if desired).
- */
- char emit_buf[120]; // Enough for storing one line
- size_t emit_buf_written;
-
- if (my_b_printf(file,
- "# "
- "|Timestamp "
- "|Type "
- "|Master ID "
- "|Size "
- "|Master Pos "
- "|Flags\n"))
- goto err;
- emit_buf_written=
- my_snprintf(emit_buf, sizeof(emit_buf),
- "# %8llx " /* Position */
- "|%02x %02x %02x %02x " /* Timestamp */
- "|%02x " /* Type */
- "|%02x %02x %02x %02x " /* Master ID */
- "|%02x %02x %02x %02x " /* Size */
- "|%02x %02x %02x %02x " /* Master Pos */
- "|%02x %02x\n", /* Flags */
- (ulonglong) offset, /* Position */
- ptr[0], ptr[1], ptr[2], ptr[3], /* Timestamp */
- ptr[4], /* Type */
- ptr[5], ptr[6], ptr[7], ptr[8], /* Master ID */
- ptr[9], ptr[10], ptr[11], ptr[12], /* Size */
- ptr[13], ptr[14], ptr[15], ptr[16], /* Master Pos */
- ptr[17], ptr[18]); /* Flags */
-
- DBUG_ASSERT(static_cast<size_t>(emit_buf_written) < sizeof(emit_buf));
- if (my_b_write(file, reinterpret_cast<uchar*>(emit_buf), emit_buf_written) ||
- my_b_write(file, (uchar*)"#\n", 2))
- goto err;
-
- return 0;
-err:
- return 1;
-}
-
-
-/*
- The number of bytes to print per line. Should be an even number,
- and "hexdump -C" uses 16, so we'll duplicate that here.
-*/
-#define HEXDUMP_BYTES_PER_LINE 16
-
-static void format_hex_line(char *emit_buff)
-{
- memset(emit_buff + 1, ' ',
- 1 + 8 + 2 + (HEXDUMP_BYTES_PER_LINE * 3 + 1) + 2 +
- HEXDUMP_BYTES_PER_LINE);
- emit_buff[0]= '#';
- emit_buff[2 + 8 + 2 + (HEXDUMP_BYTES_PER_LINE * 3 + 1) + 1]= '|';
- emit_buff[2 + 8 + 2 + (HEXDUMP_BYTES_PER_LINE * 3 + 1) + 2 +
- HEXDUMP_BYTES_PER_LINE]= '|';
- emit_buff[2 + 8 + 2 + (HEXDUMP_BYTES_PER_LINE * 3 + 1) + 2 +
- HEXDUMP_BYTES_PER_LINE + 1]= '\n';
- emit_buff[2 + 8 + 2 + (HEXDUMP_BYTES_PER_LINE * 3 + 1) + 2 +
- HEXDUMP_BYTES_PER_LINE + 2]= '\0';
-}
-
-static bool hexdump_data_to_io_cache(IO_CACHE *file,
- my_off_t offset,
- uchar *ptr,
- my_off_t size)
-{
- /*
- 2 = '# '
- 8 = address
- 2 = ' '
- (HEXDUMP_BYTES_PER_LINE * 3 + 1) = Each byte prints as two hex digits,
- plus a space
- 2 = ' |'
- HEXDUMP_BYTES_PER_LINE = text representation
- 2 = '|\n'
- 1 = '\0'
- */
- char emit_buffer[2 + 8 + 2 + (HEXDUMP_BYTES_PER_LINE * 3 + 1) + 2 +
- HEXDUMP_BYTES_PER_LINE + 2 + 1 ];
- char *h,*c;
- my_off_t i;
-
- if (size == 0)
- return 0; // ok, nothing to do
-
- format_hex_line(emit_buffer);
- /*
- Print the rest of the event (without common header)
- */
- my_off_t starting_offset = offset;
- for (i= 0,
- c= emit_buffer + 2 + 8 + 2 + (HEXDUMP_BYTES_PER_LINE * 3 + 1) + 2,
- h= emit_buffer + 2 + 8 + 2;
- i < size;
- i++, ptr++)
- {
- my_snprintf(h, 4, "%02x ", *ptr);
- h+= 3;
-
- *c++= my_isprint(&my_charset_bin, *ptr) ? *ptr : '.';
-
- /* Print in groups of HEXDUMP_BYTES_PER_LINE characters. */
- if ((i % HEXDUMP_BYTES_PER_LINE) == (HEXDUMP_BYTES_PER_LINE - 1))
- {
- /* remove \0 left after printing hex byte representation */
- *h= ' ';
- /* prepare space to print address */
- memset(emit_buffer + 2, ' ', 8);
- /* print address */
- size_t const emit_buf_written= my_snprintf(emit_buffer + 2, 9, "%8llx",
- (ulonglong) starting_offset);
- /* remove \0 left after printing address */
- emit_buffer[2 + emit_buf_written]= ' ';
- if (my_b_write(file, reinterpret_cast<uchar*>(emit_buffer),
- sizeof(emit_buffer) - 1))
- goto err;
- c= emit_buffer + 2 + 8 + 2 + (HEXDUMP_BYTES_PER_LINE * 3 + 1) + 2;
- h= emit_buffer + 2 + 8 + 2;
- format_hex_line(emit_buffer);
- starting_offset+= HEXDUMP_BYTES_PER_LINE;
- }
- else if ((i % (HEXDUMP_BYTES_PER_LINE / 2))
- == ((HEXDUMP_BYTES_PER_LINE / 2) - 1))
- {
- /*
- In the middle of the group of HEXDUMP_BYTES_PER_LINE, emit an extra
- space in the hex string, to make two groups.
- */
- *h++= ' ';
- }
-
- }
-
- /*
- There is still data left in our buffer, which means that the previous
- line was not perfectly HEXDUMP_BYTES_PER_LINE characters, so write an
- incomplete line, with spaces to pad out to the same length as a full
- line would be, to make things more readable.
- */
- if (h != emit_buffer + 2 + 8 + 2)
- {
- *h= ' ';
- *c++= '|'; *c++= '\n';
- memset(emit_buffer + 2, ' ', 8);
- size_t const emit_buf_written= my_snprintf(emit_buffer + 2, 9, "%8llx",
- (ulonglong) starting_offset);
- emit_buffer[2 + emit_buf_written]= ' ';
- /* pad unprinted area */
- memset(h, ' ',
- (HEXDUMP_BYTES_PER_LINE * 3 + 1) - (h - (emit_buffer + 2 + 8 + 2)));
- if (my_b_write(file, reinterpret_cast<uchar*>(emit_buffer),
- c - emit_buffer))
- goto err;
- }
- if (my_b_write(file, (uchar*)"#\n", 2))
- goto err;
-
- return 0;
-err:
- return 1;
-}
-
-/*
- Log_event::print_header()
-*/
-
-bool Log_event::print_header(IO_CACHE* file,
- PRINT_EVENT_INFO* print_event_info,
- bool is_more __attribute__((unused)))
-{
- char llbuff[22];
- my_off_t hexdump_from= print_event_info->hexdump_from;
- DBUG_ENTER("Log_event::print_header");
-
- if (my_b_write_byte(file, '#') ||
- print_timestamp(file) ||
- my_b_printf(file, " server id %lu end_log_pos %s ", (ulong) server_id,
- llstr(log_pos,llbuff)))
- goto err;
-
- /* print the checksum */
-
- if (checksum_alg != BINLOG_CHECKSUM_ALG_OFF &&
- checksum_alg != BINLOG_CHECKSUM_ALG_UNDEF)
- {
- char checksum_buf[BINLOG_CHECKSUM_LEN * 2 + 4]; // to fit to "%p "
- size_t const bytes_written=
- my_snprintf(checksum_buf, sizeof(checksum_buf), "0x%08x ", crc);
- if (my_b_printf(file, "%s ", get_type(&binlog_checksum_typelib,
- checksum_alg)) ||
- my_b_printf(file, checksum_buf, bytes_written))
- goto err;
- }
-
- /* mysqlbinlog --hexdump */
- if (print_event_info->hexdump_from)
- {
- my_b_write_byte(file, '\n');
- uchar *ptr= (uchar*)temp_buf;
- my_off_t size= uint4korr(ptr + EVENT_LEN_OFFSET);
- my_off_t hdr_len= get_header_len(print_event_info->common_header_len);
-
- size-= hdr_len;
-
- if (my_b_printf(file, "# Position\n"))
- goto err;
-
- /* Write the header, nicely formatted by field. */
- if (hexdump_minimal_header_to_io_cache(file, hexdump_from, ptr))
- goto err;
-
- ptr+= hdr_len;
- hexdump_from+= hdr_len;
-
- /* Print the rest of the data, mimicking "hexdump -C" output. */
- if (hexdump_data_to_io_cache(file, hexdump_from, ptr, size))
- goto err;
-
- /*
- Prefix the next line so that the output from print_helper()
- will appear as a comment.
- */
- if (my_b_write(file, (uchar*)"# Event: ", 9))
- goto err;
- }
-
- DBUG_RETURN(0);
-
-err:
- DBUG_RETURN(1);
-}
-
-
-/**
- Prints a quoted string to io cache.
- Control characters are displayed as hex sequence, e.g. \x00
- Single-quote and backslash characters are escaped with a \
-
- @param[in] file IO cache
- @param[in] prt Pointer to string
- @param[in] length String length
-*/
-
-static void
-my_b_write_quoted(IO_CACHE *file, const uchar *ptr, uint length)
-{
- const uchar *s;
- my_b_write_byte(file, '\'');
- for (s= ptr; length > 0 ; s++, length--)
- {
- if (*s > 0x1F)
- my_b_write_byte(file, *s);
- else if (*s == '\'')
- my_b_write(file, (uchar*)"\\'", 2);
- else if (*s == '\\')
- my_b_write(file, (uchar*)"\\\\", 2);
- else
- {
- uchar hex[10];
- size_t len= my_snprintf((char*) hex, sizeof(hex), "%s%02x", "\\x", *s);
- my_b_write(file, hex, len);
- }
- }
- my_b_write_byte(file, '\'');
-}
-
-
-/**
- Prints a bit string to io cache in format b'1010'.
-
- @param[in] file IO cache
- @param[in] ptr Pointer to string
- @param[in] nbits Number of bits
-*/
-static void
-my_b_write_bit(IO_CACHE *file, const uchar *ptr, uint nbits)
-{
- uint bitnum, nbits8= ((nbits + 7) / 8) * 8, skip_bits= nbits8 - nbits;
- my_b_write(file, (uchar*)"b'", 2);
- for (bitnum= skip_bits ; bitnum < nbits8; bitnum++)
- {
- int is_set= (ptr[(bitnum) / 8] >> (7 - bitnum % 8)) & 0x01;
- my_b_write_byte(file, (is_set ? '1' : '0'));
- }
- my_b_write_byte(file, '\'');
-}
-
-
-/**
- Prints a packed string to io cache.
- The string consists of length packed to 1 or 2 bytes,
- followed by string data itself.
-
- @param[in] file IO cache
- @param[in] ptr Pointer to string
- @param[in] length String size
-
- @retval - number of bytes scanned.
-*/
-static size_t
-my_b_write_quoted_with_length(IO_CACHE *file, const uchar *ptr, uint length)
-{
- if (length < 256)
- {
- length= *ptr;
- my_b_write_quoted(file, ptr + 1, length);
- return length + 1;
- }
- else
- {
- length= uint2korr(ptr);
- my_b_write_quoted(file, ptr + 2, length);
- return length + 2;
- }
-}
-
-
-/**
- Prints a 32-bit number in both signed and unsigned representation
-
- @param[in] file IO cache
- @param[in] sl Signed number
- @param[in] ul Unsigned number
-*/
-static bool
-my_b_write_sint32_and_uint32(IO_CACHE *file, int32 si, uint32 ui)
-{
- bool res= my_b_printf(file, "%d", si);
- if (si < 0)
- if (my_b_printf(file, " (%u)", ui))
- res= 1;
- return res;
-}
-
-
-/**
- Print a packed value of the given SQL type into IO cache
-
- @param[in] file IO cache
- @param[in] ptr Pointer to string
- @param[in] type Column type
- @param[in] meta Column meta information
- @param[out] typestr SQL type string buffer (for verbose output)
- @param[out] typestr_length Size of typestr
-
- @retval - number of bytes scanned from ptr.
- Except in case of NULL, in which case we return 1 to indicate ok
-*/
-
-static size_t
-log_event_print_value(IO_CACHE *file, PRINT_EVENT_INFO *print_event_info,
- const uchar *ptr, uint type, uint meta,
- char *typestr, size_t typestr_length)
-{
- uint32 length= 0;
-
- if (type == MYSQL_TYPE_STRING)
- {
- if (meta >= 256)
- {
- uint byte0= meta >> 8;
- uint byte1= meta & 0xFF;
-
- if ((byte0 & 0x30) != 0x30)
- {
- /* a long CHAR() field: see #37426 */
- length= byte1 | (((byte0 & 0x30) ^ 0x30) << 4);
- type= byte0 | 0x30;
- }
- else
- length = meta & 0xFF;
- }
- else
- length= meta;
- }
-
- switch (type) {
- case MYSQL_TYPE_LONG:
- {
- strmake(typestr, "INT", typestr_length);
- if (!ptr)
- goto return_null;
-
- int32 si= sint4korr(ptr);
- uint32 ui= uint4korr(ptr);
- my_b_write_sint32_and_uint32(file, si, ui);
- return 4;
- }
-
- case MYSQL_TYPE_TINY:
- {
- strmake(typestr, "TINYINT", typestr_length);
- if (!ptr)
- goto return_null;
-
- my_b_write_sint32_and_uint32(file, (int) (signed char) *ptr,
- (uint) (unsigned char) *ptr);
- return 1;
- }
-
- case MYSQL_TYPE_SHORT:
- {
- strmake(typestr, "SHORTINT", typestr_length);
- if (!ptr)
- goto return_null;
-
- int32 si= (int32) sint2korr(ptr);
- uint32 ui= (uint32) uint2korr(ptr);
- my_b_write_sint32_and_uint32(file, si, ui);
- return 2;
- }
-
- case MYSQL_TYPE_INT24:
- {
- strmake(typestr, "MEDIUMINT", typestr_length);
- if (!ptr)
- goto return_null;
-
- int32 si= sint3korr(ptr);
- uint32 ui= uint3korr(ptr);
- my_b_write_sint32_and_uint32(file, si, ui);
- return 3;
- }
-
- case MYSQL_TYPE_LONGLONG:
- {
- strmake(typestr, "LONGINT", typestr_length);
- if (!ptr)
- goto return_null;
-
- char tmp[64];
- size_t length;
- longlong si= sint8korr(ptr);
- length= (longlong10_to_str(si, tmp, -10) - tmp);
- my_b_write(file, (uchar*)tmp, length);
- if (si < 0)
- {
- ulonglong ui= uint8korr(ptr);
- longlong10_to_str((longlong) ui, tmp, 10);
- my_b_printf(file, " (%s)", tmp);
- }
- return 8;
- }
-
- case MYSQL_TYPE_NEWDECIMAL:
- {
- uint precision= meta >> 8;
- uint decimals= meta & 0xFF;
- my_snprintf(typestr, typestr_length, "DECIMAL(%d,%d)",
- precision, decimals);
- if (!ptr)
- goto return_null;
-
- uint bin_size= my_decimal_get_binary_size(precision, decimals);
- my_decimal dec((const uchar *) ptr, precision, decimals);
- int length= DECIMAL_MAX_STR_LENGTH;
- char buff[DECIMAL_MAX_STR_LENGTH + 1];
- decimal2string(&dec, buff, &length, 0, 0, 0);
- my_b_write(file, (uchar*)buff, length);
- return bin_size;
- }
-
- case MYSQL_TYPE_FLOAT:
- {
- strmake(typestr, "FLOAT", typestr_length);
- if (!ptr)
- goto return_null;
-
- float fl;
- float4get(fl, ptr);
- char tmp[320];
- sprintf(tmp, "%-20g", (double) fl);
- my_b_printf(file, "%s", tmp); /* my_snprintf doesn't support %-20g */
- return 4;
- }
-
- case MYSQL_TYPE_DOUBLE:
- {
- double dbl;
- strmake(typestr, "DOUBLE", typestr_length);
- if (!ptr)
- goto return_null;
-
- float8get(dbl, ptr);
- char tmp[320];
- sprintf(tmp, "%-.20g", dbl); /* strmake doesn't support %-20g */
- my_b_printf(file, tmp, "%s");
- return 8;
- }
-
- case MYSQL_TYPE_BIT:
- {
- /* Meta-data: bit_len, bytes_in_rec, 2 bytes */
- uint nbits= ((meta >> 8) * 8) + (meta & 0xFF);
- my_snprintf(typestr, typestr_length, "BIT(%d)", nbits);
- if (!ptr)
- goto return_null;
-
- length= (nbits + 7) / 8;
- my_b_write_bit(file, ptr, nbits);
- return length;
- }
-
- case MYSQL_TYPE_TIMESTAMP:
- {
- strmake(typestr, "TIMESTAMP", typestr_length);
- if (!ptr)
- goto return_null;
-
- uint32 i32= uint4korr(ptr);
- my_b_printf(file, "%d", i32);
- return 4;
- }
-
- case MYSQL_TYPE_TIMESTAMP2:
- {
- my_snprintf(typestr, typestr_length, "TIMESTAMP(%d)", meta);
- if (!ptr)
- goto return_null;
-
- char buf[MAX_DATE_STRING_REP_LENGTH];
- struct timeval tm;
- my_timestamp_from_binary(&tm, ptr, meta);
- int buflen= my_timeval_to_str(&tm, buf, meta);
- my_b_write(file, (uchar*)buf, buflen);
- return my_timestamp_binary_length(meta);
- }
-
- case MYSQL_TYPE_DATETIME:
- {
- strmake(typestr, "DATETIME", typestr_length);
- if (!ptr)
- goto return_null;
-
- ulong d, t;
- uint64 i64= uint8korr(ptr); /* YYYYMMDDhhmmss */
- d= (ulong) (i64 / 1000000);
- t= (ulong) (i64 % 1000000);
-
- my_b_printf(file, "'%04d-%02d-%02d %02d:%02d:%02d'",
- (int) (d / 10000), (int) (d % 10000) / 100, (int) (d % 100),
- (int) (t / 10000), (int) (t % 10000) / 100, (int) t % 100);
- return 8;
- }
-
- case MYSQL_TYPE_DATETIME2:
- {
- my_snprintf(typestr, typestr_length, "DATETIME(%d)", meta);
- if (!ptr)
- goto return_null;
-
- char buf[MAX_DATE_STRING_REP_LENGTH];
- MYSQL_TIME ltime;
- longlong packed= my_datetime_packed_from_binary(ptr, meta);
- TIME_from_longlong_datetime_packed(&ltime, packed);
- int buflen= my_datetime_to_str(&ltime, buf, meta);
- my_b_write_quoted(file, (uchar *) buf, buflen);
- return my_datetime_binary_length(meta);
- }
-
- case MYSQL_TYPE_TIME:
- {
- strmake(typestr, "TIME", typestr_length);
- if (!ptr)
- goto return_null;
-
- int32 tmp= sint3korr(ptr);
- int32 i32= tmp >= 0 ? tmp : - tmp;
- const char *sign= tmp < 0 ? "-" : "";
- my_b_printf(file, "'%s%02d:%02d:%02d'",
- sign, i32 / 10000, (i32 % 10000) / 100, i32 % 100, i32);
- return 3;
- }
-
- case MYSQL_TYPE_TIME2:
- {
- my_snprintf(typestr, typestr_length, "TIME(%d)", meta);
- if (!ptr)
- goto return_null;
-
- char buf[MAX_DATE_STRING_REP_LENGTH];
- MYSQL_TIME ltime;
- longlong packed= my_time_packed_from_binary(ptr, meta);
- TIME_from_longlong_time_packed(&ltime, packed);
- int buflen= my_time_to_str(&ltime, buf, meta);
- my_b_write_quoted(file, (uchar *) buf, buflen);
- return my_time_binary_length(meta);
- }
-
- case MYSQL_TYPE_NEWDATE:
- {
- strmake(typestr, "DATE", typestr_length);
- if (!ptr)
- goto return_null;
-
- uint32 tmp= uint3korr(ptr);
- int part;
- char buf[11];
- char *pos= &buf[10]; // start from '\0' to the beginning
-
- /* Copied from field.cc */
- *pos--=0; // End NULL
- part=(int) (tmp & 31);
- *pos--= (char) ('0'+part%10);
- *pos--= (char) ('0'+part/10);
- *pos--= ':';
- part=(int) (tmp >> 5 & 15);
- *pos--= (char) ('0'+part%10);
- *pos--= (char) ('0'+part/10);
- *pos--= ':';
- part=(int) (tmp >> 9);
- *pos--= (char) ('0'+part%10); part/=10;
- *pos--= (char) ('0'+part%10); part/=10;
- *pos--= (char) ('0'+part%10); part/=10;
- *pos= (char) ('0'+part);
- my_b_printf(file , "'%s'", buf);
- return 3;
- }
-
- case MYSQL_TYPE_DATE:
- {
- strmake(typestr, "DATE", typestr_length);
- if (!ptr)
- goto return_null;
-
- uint i32= uint3korr(ptr);
- my_b_printf(file , "'%04d:%02d:%02d'",
- (int)(i32 / (16L * 32L)), (int)(i32 / 32L % 16L),
- (int)(i32 % 32L));
- return 3;
- }
-
- case MYSQL_TYPE_YEAR:
- {
- strmake(typestr, "YEAR", typestr_length);
- if (!ptr)
- goto return_null;
-
- uint32 i32= *ptr;
- my_b_printf(file, "%04d", i32+ 1900);
- return 1;
- }
-
- case MYSQL_TYPE_ENUM:
- switch (meta & 0xFF) {
- case 1:
- strmake(typestr, "ENUM(1 byte)", typestr_length);
- if (!ptr)
- goto return_null;
-
- my_b_printf(file, "%d", (int) *ptr);
- return 1;
- case 2:
- {
- strmake(typestr, "ENUM(2 bytes)", typestr_length);
- if (!ptr)
- goto return_null;
-
- int32 i32= uint2korr(ptr);
- my_b_printf(file, "%d", i32);
- return 2;
- }
- default:
- my_b_printf(file, "!! Unknown ENUM packlen=%d", meta & 0xFF);
- return 0;
- }
- break;
-
- case MYSQL_TYPE_SET:
- my_snprintf(typestr, typestr_length, "SET(%d bytes)", meta & 0xFF);
- if (!ptr)
- goto return_null;
-
- my_b_write_bit(file, ptr , (meta & 0xFF) * 8);
- return meta & 0xFF;
-
- case MYSQL_TYPE_BLOB:
- switch (meta) {
- case 1:
- strmake(typestr, "TINYBLOB/TINYTEXT", typestr_length);
- if (!ptr)
- goto return_null;
-
- length= *ptr;
- my_b_write_quoted(file, ptr + 1, length);
- return length + 1;
- case 2:
- strmake(typestr, "BLOB/TEXT", typestr_length);
- if (!ptr)
- goto return_null;
-
- length= uint2korr(ptr);
- my_b_write_quoted(file, ptr + 2, length);
- return length + 2;
- case 3:
- strmake(typestr, "MEDIUMBLOB/MEDIUMTEXT", typestr_length);
- if (!ptr)
- goto return_null;
-
- length= uint3korr(ptr);
- my_b_write_quoted(file, ptr + 3, length);
- return length + 3;
- case 4:
- strmake(typestr, "LONGBLOB/LONGTEXT", typestr_length);
- if (!ptr)
- goto return_null;
-
- length= uint4korr(ptr);
- my_b_write_quoted(file, ptr + 4, length);
- return length + 4;
- default:
- my_b_printf(file, "!! Unknown BLOB packlen=%d", length);
- return 0;
- }
-
- case MYSQL_TYPE_VARCHAR:
- case MYSQL_TYPE_VAR_STRING:
- length= meta;
- my_snprintf(typestr, typestr_length, "VARSTRING(%d)", length);
- if (!ptr)
- goto return_null;
-
- return my_b_write_quoted_with_length(file, ptr, length);
-
- case MYSQL_TYPE_STRING:
- my_snprintf(typestr, typestr_length, "STRING(%d)", length);
- if (!ptr)
- goto return_null;
-
- return my_b_write_quoted_with_length(file, ptr, length);
-
- case MYSQL_TYPE_DECIMAL:
- print_event_info->flush_for_error();
- fprintf(stderr, "\nError: Found Old DECIMAL (mysql-4.1 or earlier). "
- "Not enough metadata to display the value.\n");
- break;
- default:
- print_event_info->flush_for_error();
- fprintf(stderr,
- "\nError: Don't know how to handle column type: %d meta: %d (%04x)\n",
- type, meta, meta);
- break;
- }
- *typestr= 0;
- return 0;
-
-return_null:
- return my_b_write(file, (uchar*) "NULL", 4) ? 0 : 1;
-}
-
-
-/**
- Print a packed row into IO cache
-
- @param[in] file IO cache
- @param[in] td Table definition
- @param[in] print_event_into Print parameters
- @param[in] cols_bitmap Column bitmaps.
- @param[in] value Pointer to packed row
- @param[in] prefix Row's SQL clause ("SET", "WHERE", etc)
-
- @retval 0 error
- # number of bytes scanned.
-*/
-
-
-size_t
-Rows_log_event::print_verbose_one_row(IO_CACHE *file, table_def *td,
- PRINT_EVENT_INFO *print_event_info,
- MY_BITMAP *cols_bitmap,
- const uchar *value, const uchar *prefix,
- const my_bool no_fill_output)
-{
- const uchar *value0= value;
- const uchar *null_bits= value;
- uint null_bit_index= 0;
- char typestr[64]= "";
-
-#ifdef WHEN_FLASHBACK_REVIEW_READY
- /* Storing the review SQL */
- IO_CACHE *review_sql= &print_event_info->review_sql_cache;
- LEX_STRING review_str;
-#endif
-
- /*
- Skip metadata bytes which gives the information about nullabity of master
- columns. Master writes one bit for each affected column.
- */
-
- value+= (bitmap_bits_set(cols_bitmap) + 7) / 8;
-
- if (!no_fill_output)
- if (my_b_printf(file, "%s", prefix))
- goto err;
-
- for (uint i= 0; i < (uint)td->size(); i ++)
- {
- size_t size;
- int is_null= (null_bits[null_bit_index / 8]
- >> (null_bit_index % 8)) & 0x01;
-
- if (bitmap_is_set(cols_bitmap, i) == 0)
- continue;
-
- if (!no_fill_output)
- if (my_b_printf(file, "### @%d=", static_cast<int>(i + 1)))
- goto err;
-
- if (!is_null)
- {
- size_t fsize= td->calc_field_size((uint)i, (uchar*) value);
- if (value + fsize > m_rows_end)
- {
- if (!no_fill_output)
- if (my_b_printf(file, "***Corrupted replication event was detected."
- " Not printing the value***\n"))
- goto err;
- value+= fsize;
- return 0;
- }
- }
-
- if (!no_fill_output)
- {
- size= log_event_print_value(file, print_event_info, is_null? NULL: value,
- td->type(i), td->field_metadata(i),
- typestr, sizeof(typestr));
-#ifdef WHEN_FLASHBACK_REVIEW_READY
- if (need_flashback_review)
- {
- String tmp_str, hex_str;
- IO_CACHE tmp_cache;
-
- // Using a tmp IO_CACHE to get the value output
- open_cached_file(&tmp_cache, NULL, NULL, 0, MYF(MY_WME | MY_NABP));
- size= log_event_print_value(&tmp_cache, print_event_info,
- is_null ? NULL: value,
- td->type(i), td->field_metadata(i),
- typestr, sizeof(typestr));
- error= copy_event_cache_to_string_and_reinit(&tmp_cache, &review_str);
- close_cached_file(&tmp_cache);
- if (unlikely(error))
- return 0;
-
- switch (td->type(i)) // Converting a string to HEX format
- {
- case MYSQL_TYPE_VARCHAR:
- case MYSQL_TYPE_VAR_STRING:
- case MYSQL_TYPE_STRING:
- case MYSQL_TYPE_BLOB:
- // Avoid write_pos changed to a new area
- // tmp_str.free();
- tmp_str.append(review_str.str + 1, review_str.length - 2); // Removing quotation marks
- if (hex_str.alloc(tmp_str.length()*2+1)) // If out of memory
- {
- fprintf(stderr, "\nError: Out of memory. "
- "Could not print correct binlog event.\n");
- exit(1);
- }
- octet2hex((char*) hex_str.ptr(), tmp_str.ptr(), tmp_str.length());
- if (my_b_printf(review_sql, ", UNHEX('%s')", hex_str.ptr()))
- goto err;
- break;
- default:
- tmp_str.free();
- if (tmp_str.append(review_str.str, review_str.length) ||
- my_b_printf(review_sql, ", %s", tmp_str.ptr()))
- goto err;
- break;
- }
- my_free(revieww_str.str);
- }
-#endif
- }
- else
- {
- IO_CACHE tmp_cache;
- open_cached_file(&tmp_cache, NULL, NULL, 0, MYF(MY_WME | MY_NABP));
- size= log_event_print_value(&tmp_cache, print_event_info,
- is_null ? NULL: value,
- td->type(i), td->field_metadata(i),
- typestr, sizeof(typestr));
- close_cached_file(&tmp_cache);
- }
-
- if (!size)
- goto err;
-
- if (!is_null)
- value+= size;
-
- if (print_event_info->verbose > 1 && !no_fill_output)
- {
- if (my_b_write(file, (uchar*)" /* ", 4) ||
- my_b_printf(file, "%s ", typestr) ||
- my_b_printf(file, "meta=%d nullable=%d is_null=%d ",
- td->field_metadata(i),
- td->maybe_null(i), is_null) ||
- my_b_write(file, (uchar*)"*/", 2))
- goto err;
- }
-
- if (!no_fill_output)
- if (my_b_write_byte(file, '\n'))
- goto err;
-
- null_bit_index++;
- }
- return value - value0;
-
-err:
- return 0;
-}
-
-
-/**
- Exchange the SET part and WHERE part for the Update events.
- Revert the operations order for the Write and Delete events.
- And then revert the events order from the last one to the first one.
-
- @param[in] print_event_info PRINT_EVENT_INFO
- @param[in] rows_buff Packed event buff
-*/
-
-void Rows_log_event::change_to_flashback_event(PRINT_EVENT_INFO *print_event_info,
- uchar *rows_buff, Log_event_type ev_type)
-{
- Table_map_log_event *map;
- table_def *td;
- DYNAMIC_ARRAY rows_arr;
- uchar *swap_buff1, *swap_buff2;
- uchar *rows_pos= rows_buff + m_rows_before_size;
-
- if (!(map= print_event_info->m_table_map.get_table(m_table_id)) ||
- !(td= map->create_table_def()))
- return;
-
- /* If the write rows event contained no values for the AI */
- if (((get_general_type_code() == WRITE_ROWS_EVENT) && (m_rows_buf==m_rows_end)))
- goto end;
-
- (void) my_init_dynamic_array(&rows_arr, sizeof(LEX_STRING), 8, 8, MYF(0));
-
- for (uchar *value= m_rows_buf; value < m_rows_end; )
- {
- uchar *start_pos= value;
- size_t length1= 0;
- if (!(length1= print_verbose_one_row(NULL, td, print_event_info,
- &m_cols, value,
- (const uchar*) "", TRUE)))
- {
- fprintf(stderr, "\nError row length: %zu\n", length1);
- exit(1);
- }
- value+= length1;
-
- swap_buff1= (uchar *) my_malloc(length1, MYF(0));
- if (!swap_buff1)
- {
- fprintf(stderr, "\nError: Out of memory. "
- "Could not exchange to flashback event.\n");
- exit(1);
- }
- memcpy(swap_buff1, start_pos, length1);
-
- // For Update_event, we have the second part
- size_t length2= 0;
- if (ev_type == UPDATE_ROWS_EVENT ||
- ev_type == UPDATE_ROWS_EVENT_V1)
- {
- if (!(length2= print_verbose_one_row(NULL, td, print_event_info,
- &m_cols, value,
- (const uchar*) "", TRUE)))
- {
- fprintf(stderr, "\nError row length: %zu\n", length2);
- exit(1);
- }
- value+= length2;
-
- swap_buff2= (uchar *) my_malloc(length2, MYF(0));
- if (!swap_buff2)
- {
- fprintf(stderr, "\nError: Out of memory. "
- "Could not exchange to flashback event.\n");
- exit(1);
- }
- memcpy(swap_buff2, start_pos + length1, length2); // WHERE part
- }
-
- if (ev_type == UPDATE_ROWS_EVENT ||
- ev_type == UPDATE_ROWS_EVENT_V1)
- {
- /* Swap SET and WHERE part */
- memcpy(start_pos, swap_buff2, length2);
- memcpy(start_pos + length2, swap_buff1, length1);
- }
-
- /* Free tmp buffers */
- my_free(swap_buff1);
- if (ev_type == UPDATE_ROWS_EVENT ||
- ev_type == UPDATE_ROWS_EVENT_V1)
- my_free(swap_buff2);
-
- /* Copying one row into a buff, and pushing into the array */
- LEX_STRING one_row;
-
- one_row.length= length1 + length2;
- one_row.str= (char *) my_malloc(one_row.length, MYF(0));
- memcpy(one_row.str, start_pos, one_row.length);
- if (one_row.str == NULL || push_dynamic(&rows_arr, (uchar *) &one_row))
- {
- fprintf(stderr, "\nError: Out of memory. "
- "Could not push flashback event into array.\n");
- exit(1);
- }
- }
-
- /* Copying rows from the end to the begining into event */
- for (uint i= rows_arr.elements; i > 0; --i)
- {
- LEX_STRING *one_row= dynamic_element(&rows_arr, i - 1, LEX_STRING*);
-
- memcpy(rows_pos, (uchar *)one_row->str, one_row->length);
- rows_pos+= one_row->length;
- my_free(one_row->str);
- }
- delete_dynamic(&rows_arr);
-
-end:
- delete td;
-}
-
-/**
- Calc length of a packed value of the given SQL type
-
- @param[in] ptr Pointer to string
- @param[in] type Column type
- @param[in] meta Column meta information
-
- @retval - number of bytes scanned from ptr.
- Except in case of NULL, in which case we return 1 to indicate ok
-*/
-
-static size_t calc_field_event_length(const uchar *ptr, uint type, uint meta)
-{
- uint32 length= 0;
-
- if (type == MYSQL_TYPE_STRING)
- {
- if (meta >= 256)
- {
- uint byte0= meta >> 8;
- uint byte1= meta & 0xFF;
-
- if ((byte0 & 0x30) != 0x30)
- {
- /* a long CHAR() field: see #37426 */
- length= byte1 | (((byte0 & 0x30) ^ 0x30) << 4);
- type= byte0 | 0x30;
- }
- else
- length = meta & 0xFF;
- }
- else
- length= meta;
- }
-
- switch (type) {
- case MYSQL_TYPE_LONG:
- case MYSQL_TYPE_TIMESTAMP:
- return 4;
- case MYSQL_TYPE_TINY:
- case MYSQL_TYPE_YEAR:
- return 1;
- case MYSQL_TYPE_SHORT:
- return 2;
- case MYSQL_TYPE_INT24:
- case MYSQL_TYPE_TIME:
- case MYSQL_TYPE_NEWDATE:
- case MYSQL_TYPE_DATE:
- return 3;
- case MYSQL_TYPE_LONGLONG:
- case MYSQL_TYPE_DATETIME:
- return 8;
- case MYSQL_TYPE_NEWDECIMAL:
- {
- uint precision= meta >> 8;
- uint decimals= meta & 0xFF;
- uint bin_size= my_decimal_get_binary_size(precision, decimals);
- return bin_size;
- }
- case MYSQL_TYPE_FLOAT:
- return 4;
- case MYSQL_TYPE_DOUBLE:
- return 8;
- case MYSQL_TYPE_BIT:
- {
- /* Meta-data: bit_len, bytes_in_rec, 2 bytes */
- uint nbits= ((meta >> 8) * 8) + (meta & 0xFF);
- length= (nbits + 7) / 8;
- return length;
- }
- case MYSQL_TYPE_TIMESTAMP2:
- return my_timestamp_binary_length(meta);
- case MYSQL_TYPE_DATETIME2:
- return my_datetime_binary_length(meta);
- case MYSQL_TYPE_TIME2:
- return my_time_binary_length(meta);
- case MYSQL_TYPE_ENUM:
- switch (meta & 0xFF) {
- case 1:
- case 2:
- return (meta & 0xFF);
- default:
- /* Unknown ENUM packlen=%d", meta & 0xFF */
- return 0;
- }
- break;
- case MYSQL_TYPE_SET:
- return meta & 0xFF;
- case MYSQL_TYPE_BLOB:
- switch (meta) {
- default:
- return 0;
- case 1:
- return *ptr + 1;
- case 2:
- return uint2korr(ptr) + 2;
- case 3:
- return uint3korr(ptr) + 3;
- case 4:
- return uint4korr(ptr) + 4;
- }
- case MYSQL_TYPE_VARCHAR:
- case MYSQL_TYPE_VAR_STRING:
- length= meta;
- /* fall through */
- case MYSQL_TYPE_STRING:
- if (length < 256)
- return (uint) *ptr + 1;
- return uint2korr(ptr) + 2;
- case MYSQL_TYPE_DECIMAL:
- break;
- default:
- break;
- }
- return 0;
-}
-
-
-size_t
-Rows_log_event::calc_row_event_length(table_def *td,
- PRINT_EVENT_INFO *print_event_info,
- MY_BITMAP *cols_bitmap,
- const uchar *value)
-{
- const uchar *value0= value;
- const uchar *null_bits= value;
- uint null_bit_index= 0;
-
- /*
- Skip metadata bytes which gives the information about nullabity of master
- columns. Master writes one bit for each affected column.
- */
-
- value+= (bitmap_bits_set(cols_bitmap) + 7) / 8;
-
- for (uint i= 0; i < (uint)td->size(); i ++)
- {
- int is_null;
- is_null= (null_bits[null_bit_index / 8] >> (null_bit_index % 8)) & 0x01;
-
- if (bitmap_is_set(cols_bitmap, i) == 0)
- continue;
-
- if (!is_null)
- {
- size_t size;
- size_t fsize= td->calc_field_size((uint)i, (uchar*) value);
- if (value + fsize > m_rows_end)
- {
- /* Corrupted replication event was detected, skipping entry */
- return 0;
- }
- if (!(size= calc_field_event_length(value, td->type(i),
- td->field_metadata(i))))
- return 0;
- value+= size;
- }
- null_bit_index++;
- }
- return value - value0;
-}
-
-
-/**
- Calculate how many rows there are in the event
-
- @param[in] file IO cache
- @param[in] print_event_into Print parameters
-*/
-
-void Rows_log_event::count_row_events(PRINT_EVENT_INFO *print_event_info)
-{
- Table_map_log_event *map;
- table_def *td;
- uint row_events;
- Log_event_type general_type_code= get_general_type_code();
-
- switch (general_type_code) {
- case WRITE_ROWS_EVENT:
- case DELETE_ROWS_EVENT:
- row_events= 1;
- break;
- case UPDATE_ROWS_EVENT:
- row_events= 2;
- break;
- default:
- DBUG_ASSERT(0); /* Not possible */
- return;
- }
-
- if (!(map= print_event_info->m_table_map.get_table(m_table_id)) ||
- !(td= map->create_table_def()))
- {
- /* Row event for unknown table */
- return;
- }
-
- for (const uchar *value= m_rows_buf; value < m_rows_end; )
- {
- size_t length;
- print_event_info->row_events++;
-
- /* Print the first image */
- if (!(length= calc_row_event_length(td, print_event_info,
- &m_cols, value)))
- break;
- value+= length;
- DBUG_ASSERT(value <= m_rows_end);
-
- /* Print the second image (for UPDATE only) */
- if (row_events == 2)
- {
- if (!(length= calc_row_event_length(td, print_event_info,
- &m_cols_ai, value)))
- break;
- value+= length;
- DBUG_ASSERT(value <= m_rows_end);
- }
- }
- delete td;
-}
-
-
-/**
- Print a row event into IO cache in human readable form (in SQL format)
-
- @param[in] file IO cache
- @param[in] print_event_into Print parameters
-*/
-
-bool Rows_log_event::print_verbose(IO_CACHE *file,
- PRINT_EVENT_INFO *print_event_info)
-{
- Table_map_log_event *map;
- table_def *td= 0;
- const char *sql_command, *sql_clause1, *sql_clause2;
- const char *sql_command_short __attribute__((unused));
- Log_event_type general_type_code= get_general_type_code();
-#ifdef WHEN_FLASHBACK_REVIEW_READY
- IO_CACHE *review_sql= &print_event_info->review_sql_cache;
-#endif
-
- if (m_extra_row_data)
- {
- uint8 extra_data_len= m_extra_row_data[EXTRA_ROW_INFO_LEN_OFFSET];
- uint8 extra_payload_len= extra_data_len - EXTRA_ROW_INFO_HDR_BYTES;
- assert(extra_data_len >= EXTRA_ROW_INFO_HDR_BYTES);
-
- if (my_b_printf(file, "### Extra row data format: %u, len: %u :",
- m_extra_row_data[EXTRA_ROW_INFO_FORMAT_OFFSET],
- extra_payload_len))
- goto err;
- if (extra_payload_len)
- {
- /*
- Buffer for hex view of string, including '0x' prefix,
- 2 hex chars / byte and trailing 0
- */
- const int buff_len= 2 + (256 * 2) + 1;
- char buff[buff_len];
- str_to_hex(buff, (const char*) &m_extra_row_data[EXTRA_ROW_INFO_HDR_BYTES],
- extra_payload_len);
- if (my_b_printf(file, "%s", buff))
- goto err;
- }
- if (my_b_printf(file, "\n"))
- goto err;
- }
-
- switch (general_type_code) {
- case WRITE_ROWS_EVENT:
- sql_command= "INSERT INTO";
- sql_clause1= "### SET\n";
- sql_clause2= NULL;
- sql_command_short= "I";
- break;
- case DELETE_ROWS_EVENT:
- sql_command= "DELETE FROM";
- sql_clause1= "### WHERE\n";
- sql_clause2= NULL;
- sql_command_short= "D";
- break;
- case UPDATE_ROWS_EVENT:
- sql_command= "UPDATE";
- sql_clause1= "### WHERE\n";
- sql_clause2= "### SET\n";
- sql_command_short= "U";
- break;
- default:
- sql_command= sql_clause1= sql_clause2= NULL;
- sql_command_short= "";
- DBUG_ASSERT(0); /* Not possible */
- }
-
- if (!(map= print_event_info->m_table_map.get_table(m_table_id)) ||
- !(td= map->create_table_def()))
- {
- return (my_b_printf(file, "### Row event for unknown table #%lu",
- (ulong) m_table_id));
- }
-
- /* If the write rows event contained no values for the AI */
- if (((general_type_code == WRITE_ROWS_EVENT) && (m_rows_buf==m_rows_end)))
- {
- if (my_b_printf(file, "### INSERT INTO %`s.%`s VALUES ()\n",
- map->get_db_name(), map->get_table_name()))
- goto err;
- goto end;
- }
-
- for (const uchar *value= m_rows_buf; value < m_rows_end; )
- {
- size_t length;
- print_event_info->row_events++;
-
- if (my_b_printf(file, "### %s %`s.%`s\n",
- sql_command,
- map->get_db_name(), map->get_table_name()))
- goto err;
-#ifdef WHEN_FLASHBACK_REVIEW_READY
- if (need_flashback_review)
- if (my_b_printf(review_sql, "\nINSERT INTO `%s`.`%s` VALUES ('%s'",
- map->get_review_dbname(), map->get_review_tablename(),
- sql_command_short))
- goto err;
-#endif
-
- /* Print the first image */
- if (!(length= print_verbose_one_row(file, td, print_event_info,
- &m_cols, value,
- (const uchar*) sql_clause1)))
- goto err;
- value+= length;
-
- /* Print the second image (for UPDATE only) */
- if (sql_clause2)
- {
- if (!(length= print_verbose_one_row(file, td, print_event_info,
- &m_cols_ai, value,
- (const uchar*) sql_clause2)))
- goto err;
- value+= length;
- }
-#ifdef WHEN_FLASHBACK_REVIEW_READY
- else
- {
- if (need_flashback_review)
- for (size_t i= 0; i < td->size(); i ++)
- if (my_b_printf(review_sql, ", NULL"))
- goto err;
- }
-
- if (need_flashback_review)
- if (my_b_printf(review_sql, ")%s\n", print_event_info->delimiter))
- goto err;
-#endif
- }
-
-end:
- delete td;
- return 0;
-err:
- delete td;
- return 1;
-}
-
-void free_table_map_log_event(Table_map_log_event *event)
-{
- delete event;
-}
-
-/**
- Encode the event, optionally per 'do_print_encoded' arg store the
- result into the argument cache; optionally per event_info's
- 'verbose' print into the cache a verbose representation of the event.
- Note, no extra wrapping is done to the being io-cached data, like
- to producing a BINLOG query. It's left for a routine that extracts from
- the cache.
-
- @param file pointer to IO_CACHE
- @param print_event_info pointer to print_event_info specializing
- what out of and how to print the event
- @param do_print_encoded whether to store base64-encoded event
- into @file.
-*/
-bool Log_event::print_base64(IO_CACHE* file,
- PRINT_EVENT_INFO* print_event_info,
- bool do_print_encoded)
-{
- uchar *ptr= (uchar *)temp_buf;
- uint32 size= uint4korr(ptr + EVENT_LEN_OFFSET);
- DBUG_ENTER("Log_event::print_base64");
-
- if (is_flashback)
- {
- uint tmp_size= size;
- Rows_log_event *ev= NULL;
- Log_event_type ev_type = (enum Log_event_type) ptr[EVENT_TYPE_OFFSET];
- if (checksum_alg != BINLOG_CHECKSUM_ALG_UNDEF &&
- checksum_alg != BINLOG_CHECKSUM_ALG_OFF)
- tmp_size-= BINLOG_CHECKSUM_LEN; // checksum is displayed through the header
- switch (ev_type) {
- case WRITE_ROWS_EVENT:
- ptr[EVENT_TYPE_OFFSET]= DELETE_ROWS_EVENT;
- ev= new Delete_rows_log_event((const char*) ptr, tmp_size,
- glob_description_event);
- ev->change_to_flashback_event(print_event_info, ptr, ev_type);
- break;
- case WRITE_ROWS_EVENT_V1:
- ptr[EVENT_TYPE_OFFSET]= DELETE_ROWS_EVENT_V1;
- ev= new Delete_rows_log_event((const char*) ptr, tmp_size,
- glob_description_event);
- ev->change_to_flashback_event(print_event_info, ptr, ev_type);
- break;
- case DELETE_ROWS_EVENT:
- ptr[EVENT_TYPE_OFFSET]= WRITE_ROWS_EVENT;
- ev= new Write_rows_log_event((const char*) ptr, tmp_size,
- glob_description_event);
- ev->change_to_flashback_event(print_event_info, ptr, ev_type);
- break;
- case DELETE_ROWS_EVENT_V1:
- ptr[EVENT_TYPE_OFFSET]= WRITE_ROWS_EVENT_V1;
- ev= new Write_rows_log_event((const char*) ptr, tmp_size,
- glob_description_event);
- ev->change_to_flashback_event(print_event_info, ptr, ev_type);
- break;
- case UPDATE_ROWS_EVENT:
- case UPDATE_ROWS_EVENT_V1:
- ev= new Update_rows_log_event((const char*) ptr, tmp_size,
- glob_description_event);
- ev->change_to_flashback_event(print_event_info, ptr, ev_type);
- break;
- default:
- break;
- }
- delete ev;
- }
-
- if (do_print_encoded)
- {
- size_t const tmp_str_sz= my_base64_needed_encoded_length((int) size);
- char *tmp_str;
- if (!(tmp_str= (char *) my_malloc(tmp_str_sz, MYF(MY_WME))))
- goto err;
-
- if (my_base64_encode(ptr, (size_t) size, tmp_str))
- {
- DBUG_ASSERT(0);
- }
-
- my_b_printf(file, "%s\n", tmp_str);
- my_free(tmp_str);
- }
-
-#ifdef WHEN_FLASHBACK_REVIEW_READY
- if (print_event_info->verbose || print_event_info->print_row_count ||
- need_flashback_review)
-#else
- // Flashback need the table_map to parse the event
- if (print_event_info->verbose || print_event_info->print_row_count ||
- is_flashback)
-#endif
- {
- Rows_log_event *ev= NULL;
- Log_event_type et= (Log_event_type) ptr[EVENT_TYPE_OFFSET];
-
- if (checksum_alg != BINLOG_CHECKSUM_ALG_UNDEF &&
- checksum_alg != BINLOG_CHECKSUM_ALG_OFF)
- size-= BINLOG_CHECKSUM_LEN; // checksum is displayed through the header
-
- switch (et)
- {
- case TABLE_MAP_EVENT:
- {
- Table_map_log_event *map;
- map= new Table_map_log_event((const char*) ptr, size,
- glob_description_event);
-#ifdef WHEN_FLASHBACK_REVIEW_READY
- if (need_flashback_review)
- {
- map->set_review_dbname(m_review_dbname.ptr());
- map->set_review_tablename(m_review_tablename.ptr());
- }
-#endif
- print_event_info->m_table_map.set_table(map->get_table_id(), map);
- break;
- }
- case WRITE_ROWS_EVENT:
- case WRITE_ROWS_EVENT_V1:
- {
- ev= new Write_rows_log_event((const char*) ptr, size,
- glob_description_event);
- break;
- }
- case DELETE_ROWS_EVENT:
- case DELETE_ROWS_EVENT_V1:
- {
- ev= new Delete_rows_log_event((const char*) ptr, size,
- glob_description_event);
- break;
- }
- case UPDATE_ROWS_EVENT:
- case UPDATE_ROWS_EVENT_V1:
- {
- ev= new Update_rows_log_event((const char*) ptr, size,
- glob_description_event);
- break;
- }
- case WRITE_ROWS_COMPRESSED_EVENT:
- case WRITE_ROWS_COMPRESSED_EVENT_V1:
- {
- ev= new Write_rows_compressed_log_event((const char*) ptr, size,
- glob_description_event);
- break;
- }
- case UPDATE_ROWS_COMPRESSED_EVENT:
- case UPDATE_ROWS_COMPRESSED_EVENT_V1:
- {
- ev= new Update_rows_compressed_log_event((const char*) ptr, size,
- glob_description_event);
- break;
- }
- case DELETE_ROWS_COMPRESSED_EVENT:
- case DELETE_ROWS_COMPRESSED_EVENT_V1:
- {
- ev= new Delete_rows_compressed_log_event((const char*) ptr, size,
- glob_description_event);
- break;
- }
- default:
- break;
- }
-
- if (ev)
- {
- bool error= 0;
-
-#ifdef WHEN_FLASHBACK_REVIEW_READY
- ev->need_flashback_review= need_flashback_review;
- if (print_event_info->verbose)
- {
- if (ev->print_verbose(file, print_event_info))
- goto err;
- }
- else
- {
- IO_CACHE tmp_cache;
-
- if (open_cached_file(&tmp_cache, NULL, NULL, 0,
- MYF(MY_WME | MY_NABP)))
- {
- delete ev;
- goto err;
- }
-
- error= ev->print_verbose(&tmp_cache, print_event_info);
- close_cached_file(&tmp_cache);
- if (unlikely(error))
- {
- delete ev;
- goto err;
- }
- }
-#else
- if (print_event_info->verbose)
- {
- /*
- Verbose event printout can't start before encoded data
- got enquoted. This is done at this point though multi-row
- statement remain vulnerable.
- TODO: fix MDEV-10362 to remove this workaround.
- */
- if (print_event_info->base64_output_mode !=
- BASE64_OUTPUT_DECODE_ROWS)
- my_b_printf(file, "'%s\n", print_event_info->delimiter);
- error= ev->print_verbose(file, print_event_info);
- }
- else
- {
- ev->count_row_events(print_event_info);
- }
-#endif
- delete ev;
- if (unlikely(error))
- goto err;
- }
- }
- DBUG_RETURN(0);
-
-err:
- DBUG_RETURN(1);
-}
-
-
-/*
- Log_event::print_timestamp()
-*/
-
-bool Log_event::print_timestamp(IO_CACHE* file, time_t* ts)
-{
- struct tm *res;
- time_t my_when= when;
- DBUG_ENTER("Log_event::print_timestamp");
- if (!ts)
- ts = &my_when;
- res=localtime(ts);
-
- DBUG_RETURN(my_b_printf(file,"%02d%02d%02d %2d:%02d:%02d",
- res->tm_year % 100,
- res->tm_mon+1,
- res->tm_mday,
- res->tm_hour,
- res->tm_min,
- res->tm_sec));
-}
-
-#endif /* MYSQL_CLIENT */
-
-
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
-inline Log_event::enum_skip_reason
-Log_event::continue_group(rpl_group_info *rgi)
-{
- if (rgi->rli->slave_skip_counter == 1)
- return Log_event::EVENT_SKIP_IGNORE;
- return Log_event::do_shall_skip(rgi);
-}
-#endif
-
-/**************************************************************************
- Query_log_event methods
-**************************************************************************/
-
-#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-
-/**
- This (which is used only for SHOW BINLOG EVENTS) could be updated to
- print SET @@session_var=. But this is not urgent, as SHOW BINLOG EVENTS is
- only an information, it does not produce suitable queries to replay (for
- example it does not print LOAD DATA INFILE).
- @todo
- show the catalog ??
-*/
-
-void Query_log_event::pack_info(Protocol *protocol)
-{
- // TODO: show the catalog ??
- char buf_mem[1024];
- String buf(buf_mem, sizeof(buf_mem), system_charset_info);
- buf.real_alloc(9 + db_len + q_len);
- if (!(flags & LOG_EVENT_SUPPRESS_USE_F)
- && db && db_len)
- {
- buf.append(STRING_WITH_LEN("use "));
- append_identifier(protocol->thd, &buf, db, db_len);
- buf.append(STRING_WITH_LEN("; "));
- }
- if (query && q_len)
- buf.append(query, q_len);
- protocol->store(&buf);
-}
-#endif
-
-#ifndef MYSQL_CLIENT
-
-/**
- Utility function for the next method (Query_log_event::write()) .
-*/
-static void store_str_with_code_and_len(uchar **dst, const char *src,
- uint len, uint code)
-{
- /*
- only 1 byte to store the length of catalog, so it should not
- surpass 255
- */
- DBUG_ASSERT(len <= 255);
- DBUG_ASSERT(src);
- *((*dst)++)= (uchar) code;
- *((*dst)++)= (uchar) len;
- bmove(*dst, src, len);
- (*dst)+= len;
-}
-
-
-/**
- Query_log_event::write().
-
- @note
- In this event we have to modify the header to have the correct
- EVENT_LEN_OFFSET as we don't yet know how many status variables we
- will print!
-*/
-
-bool Query_log_event::write()
-{
- uchar buf[QUERY_HEADER_LEN + MAX_SIZE_LOG_EVENT_STATUS];
- uchar *start, *start_of_status;
- ulong event_length;
-
- if (!query)
- return 1; // Something wrong with event
-
- /*
- We want to store the thread id:
- (- as an information for the user when he reads the binlog)
- - if the query uses temporary table: for the slave SQL thread to know to
- which master connection the temp table belongs.
- Now imagine we (write()) are called by the slave SQL thread (we are
- logging a query executed by this thread; the slave runs with
- --log-slave-updates). Then this query will be logged with
- thread_id=the_thread_id_of_the_SQL_thread. Imagine that 2 temp tables of
- the same name were created simultaneously on the master (in the master
- binlog you have
- CREATE TEMPORARY TABLE t; (thread 1)
- CREATE TEMPORARY TABLE t; (thread 2)
- ...)
- then in the slave's binlog there will be
- CREATE TEMPORARY TABLE t; (thread_id_of_the_slave_SQL_thread)
- CREATE TEMPORARY TABLE t; (thread_id_of_the_slave_SQL_thread)
- which is bad (same thread id!).
-
- To avoid this, we log the thread's thread id EXCEPT for the SQL
- slave thread for which we log the original (master's) thread id.
- Now this moves the bug: what happens if the thread id on the
- master was 10 and when the slave replicates the query, a
- connection number 10 is opened by a normal client on the slave,
- and updates a temp table of the same name? We get a problem
- again. To avoid this, in the handling of temp tables (sql_base.cc)
- we use thread_id AND server_id. TODO when this is merged into
- 4.1: in 4.1, slave_proxy_id has been renamed to pseudo_thread_id
- and is a session variable: that's to make mysqlbinlog work with
- temp tables. We probably need to introduce
-
- SET PSEUDO_SERVER_ID
- for mysqlbinlog in 4.1. mysqlbinlog would print:
- SET PSEUDO_SERVER_ID=
- SET PSEUDO_THREAD_ID=
- for each query using temp tables.
- */
- int4store(buf + Q_THREAD_ID_OFFSET, slave_proxy_id);
- int4store(buf + Q_EXEC_TIME_OFFSET, exec_time);
- buf[Q_DB_LEN_OFFSET] = (char) db_len;
- int2store(buf + Q_ERR_CODE_OFFSET, error_code);
-
- /*
- You MUST always write status vars in increasing order of code. This
- guarantees that a slightly older slave will be able to parse those he
- knows.
- */
- start_of_status= start= buf+QUERY_HEADER_LEN;
- if (flags2_inited)
- {
- *start++= Q_FLAGS2_CODE;
- int4store(start, flags2);
- start+= 4;
- }
- if (sql_mode_inited)
- {
- *start++= Q_SQL_MODE_CODE;
- int8store(start, (ulonglong)sql_mode);
- start+= 8;
- }
- if (catalog_len) // i.e. this var is inited (false for 4.0 events)
- {
- 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
- a waste of one byte so we don't do it in x>=4 masters. We change code to
- Q_CATALOG_NZ_CODE, because re-using the old code would make x<4 slaves
- of this x>=4 master segfault (expecting a zero when there is
- none). Remaining compatibility problems are: the older slave will not
- find the catalog; but it is will not crash, and it's not an issue
- that it does not find the catalog as catalogs were not used in these
- older MySQL versions (we store it in binlog and read it from relay log
- but do nothing useful with it). What is an issue is that the older slave
- will stop processing the Q_* blocks (and jumps to the db/query) as soon
- as it sees unknown Q_CATALOG_NZ_CODE; so it will not be able to read
- Q_AUTO_INCREMENT*, Q_CHARSET and so replication will fail silently in
- various ways. Documented that you should not mix alpha/beta versions if
- they are not exactly the same version, with example of 5.0.3->5.0.2 and
- 5.0.4->5.0.3. If replication is from older to new, the new will
- recognize Q_CATALOG_CODE and have no problem.
- */
- }
- if (auto_increment_increment != 1 || auto_increment_offset != 1)
- {
- *start++= Q_AUTO_INCREMENT;
- int2store(start, auto_increment_increment);
- int2store(start+2, auto_increment_offset);
- start+= 4;
- }
- if (charset_inited)
- {
- *start++= Q_CHARSET_CODE;
- memcpy(start, charset, 6);
- start+= 6;
- }
- if (time_zone_len)
- {
- /* 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);
- store_str_with_code_and_len(&start,
- time_zone_str, time_zone_len, Q_TIME_ZONE_CODE);
- }
- if (lc_time_names_number)
- {
- DBUG_ASSERT(lc_time_names_number <= 0xFFFF);
- *start++= Q_LC_TIME_NAMES_CODE;
- int2store(start, lc_time_names_number);
- start+= 2;
- }
- if (charset_database_number)
- {
- DBUG_ASSERT(charset_database_number <= 0xFFFF);
- *start++= Q_CHARSET_DATABASE_CODE;
- int2store(start, charset_database_number);
- start+= 2;
- }
- if (table_map_for_update)
- {
- *start++= Q_TABLE_MAP_FOR_UPDATE_CODE;
- int8store(start, table_map_for_update);
- start+= 8;
- }
- if (master_data_written != 0)
- {
- /*
- Q_MASTER_DATA_WRITTEN_CODE only exists in relay logs where the master
- has binlog_version<4 and the slave has binlog_version=4. See comment
- for master_data_written in log_event.h for details.
- */
- *start++= Q_MASTER_DATA_WRITTEN_CODE;
- int4store(start, master_data_written);
- start+= 4;
- }
-
- if (thd && thd->need_binlog_invoker())
- {
- LEX_CSTRING user;
- LEX_CSTRING host;
- memset(&user, 0, sizeof(user));
- memset(&host, 0, sizeof(host));
-
- if (thd->slave_thread && thd->has_invoker())
- {
- /* user will be null, if master is older than this patch */
- user= thd->get_invoker_user();
- host= thd->get_invoker_host();
- }
- else
- {
- Security_context *ctx= thd->security_ctx;
-
- if (thd->need_binlog_invoker() == THD::INVOKER_USER)
- {
- user.str= ctx->priv_user;
- host.str= ctx->priv_host;
- host.length= strlen(host.str);
- }
- else
- {
- user.str= ctx->priv_role;
- host= empty_clex_str;
- }
- user.length= strlen(user.str);
- }
-
- if (user.length > 0)
- {
- *start++= Q_INVOKER;
-
- /*
- Store user length and user. The max length of use is 16, so 1 byte is
- enough to store the user's length.
- */
- *start++= (uchar)user.length;
- memcpy(start, user.str, user.length);
- start+= user.length;
-
- /*
- Store host length and host. The max length of host is 60, so 1 byte is
- enough to store the host's length.
- */
- *start++= (uchar)host.length;
- memcpy(start, host.str, host.length);
- start+= host.length;
- }
- }
-
- if (thd && thd->query_start_sec_part_used)
- {
- *start++= Q_HRNOW;
- get_time();
- int3store(start, when_sec_part);
- start+= 3;
- }
- /*
- NOTE: When adding new status vars, please don't forget to update
- the MAX_SIZE_LOG_EVENT_STATUS in log_event.h and update the function
- code_name() in this file.
-
- Here there could be code like
- if (command-line-option-which-says-"log_this_variable" && inited)
- {
- *start++= Q_THIS_VARIABLE_CODE;
- int4store(start, this_variable);
- start+= 4;
- }
- */
-
- /* Store length of status variables */
- status_vars_len= (uint) (start-start_of_status);
- DBUG_ASSERT(status_vars_len <= MAX_SIZE_LOG_EVENT_STATUS);
- int2store(buf + Q_STATUS_VARS_LEN_OFFSET, status_vars_len);
-
- /*
- Calculate length of whole event
- The "1" below is the \0 in the db's length
- */
- event_length= (uint) (start-buf) + get_post_header_size_for_derived() + db_len + 1 + q_len;
-
- 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();
-}
-
-bool Query_compressed_log_event::write()
-{
- const char *query_tmp = query;
- uint32 q_len_tmp = q_len;
- uint32 alloc_size;
- bool ret = true;
- q_len = alloc_size = binlog_get_compress_len(q_len);
- query = (char *)my_safe_alloca(alloc_size);
- if(query && !binlog_buf_compress(query_tmp, (char *)query, q_len_tmp, &q_len))
- {
- ret = Query_log_event::write();
- }
- my_safe_afree((void *)query, alloc_size);
- query = query_tmp;
- q_len = q_len_tmp;
- return ret;
-}
-
-/**
- The simplest constructor that could possibly work. This is used for
- creating static objects that have a special meaning and are invisible
- to the log.
-*/
-Query_log_event::Query_log_event()
- :Log_event(), data_buf(0)
-{
- memset(&user, 0, sizeof(user));
- memset(&host, 0, sizeof(host));
-}
-
-
-/*
- SYNOPSIS
- Query_log_event::Query_log_event()
- thd_arg - thread handle
- 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
-
- DESCRIPTION
- Creates an event for binlogging
- The value for `errcode' should be supplied by caller.
-*/
-Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg, size_t query_length, bool using_trans,
- bool direct, bool suppress_use, int errcode)
-
- :Log_event(thd_arg,
- (thd_arg->thread_specific_used ? LOG_EVENT_THREAD_SPECIFIC_F :
- 0) |
- (suppress_use ? LOG_EVENT_SUPPRESS_USE_F : 0),
- using_trans),
- data_buf(0), query(query_arg), catalog(thd_arg->catalog),
- db(thd_arg->db.str), q_len((uint32) query_length),
- thread_id(thd_arg->thread_id),
- /* save the original thread id; we already know the server id */
- slave_proxy_id((ulong)thd_arg->variables.pseudo_thread_id),
- flags2_inited(1), sql_mode_inited(1), charset_inited(1),
- sql_mode(thd_arg->variables.sql_mode),
- auto_increment_increment(thd_arg->variables.auto_increment_increment),
- auto_increment_offset(thd_arg->variables.auto_increment_offset),
- lc_time_names_number(thd_arg->variables.lc_time_names->number),
- charset_database_number(0),
- table_map_for_update((ulonglong)thd_arg->table_map_for_update),
- master_data_written(0)
-{
- time_t end_time;
-
-#ifdef WITH_WSREP
- /*
- If Query_log_event will contain non trans keyword (not BEGIN, COMMIT,
- SAVEPOINT or ROLLBACK) we disable PA for this transaction.
- */
- if (WSREP_ON && !is_trans_keyword())
- thd->wsrep_PA_safe= false;
-#endif /* WITH_WSREP */
-
- memset(&user, 0, sizeof(user));
- memset(&host, 0, sizeof(host));
-
- error_code= errcode;
-
- end_time= my_time(0);
- exec_time = (ulong) (end_time - thd_arg->start_time);
- /**
- @todo this means that if we have no catalog, then it is replicated
- as an existing catalog of length zero. is that safe? /sven
- */
- catalog_len = (catalog) ? (uint32) strlen(catalog) : 0;
- /* status_vars_len is set just before writing the event */
- db_len = (db) ? (uint32) strlen(db) : 0;
- if (thd_arg->variables.collation_database != thd_arg->db_charset)
- charset_database_number= thd_arg->variables.collation_database->number;
-
- /*
- We only replicate over the bits of flags2 that we need: the rest
- are masked out by "& OPTIONS_WRITTEN_TO_BINLOG".
-
- We also force AUTOCOMMIT=1. Rationale (cf. BUG#29288): After
- fixing BUG#26395, we always write BEGIN and COMMIT around all
- transactions (even single statements in autocommit mode). This is
- so that replication from non-transactional to transactional table
- and error recovery from XA to non-XA table should work as
- expected. The BEGIN/COMMIT are added in log.cc. However, there is
- one exception: MyISAM bypasses log.cc and writes directly to the
- binlog. So if autocommit is off, master has MyISAM, and slave has
- a transactional engine, then the slave will just see one long
- never-ending transaction. The only way to bypass explicit
- BEGIN/COMMIT in the binlog is by using a non-transactional table.
- So setting AUTOCOMMIT=1 will make this work as expected.
-
- Note: explicitly replicate AUTOCOMMIT=1 from master. We do not
- assume AUTOCOMMIT=1 on slave; the slave still reads the state of
- the autocommit flag as written by the master to the binlog. This
- behavior may change after WL#4162 has been implemented.
- */
- flags2= (uint32) (thd_arg->variables.option_bits &
- (OPTIONS_WRITTEN_TO_BIN_LOG & ~OPTION_NOT_AUTOCOMMIT));
- DBUG_ASSERT(thd_arg->variables.character_set_client->number < 256*256);
- DBUG_ASSERT(thd_arg->variables.collation_connection->number < 256*256);
- DBUG_ASSERT(thd_arg->variables.collation_server->number < 256*256);
- DBUG_ASSERT(thd_arg->variables.character_set_client->mbminlen == 1);
- int2store(charset, thd_arg->variables.character_set_client->number);
- int2store(charset+2, thd_arg->variables.collation_connection->number);
- int2store(charset+4, thd_arg->variables.collation_server->number);
- if (thd_arg->time_zone_used)
- {
- /*
- Note that our event becomes dependent on the Time_zone object
- representing the time zone. Fortunately such objects are never deleted
- or changed during mysqld's lifetime.
- */
- time_zone_len= thd_arg->variables.time_zone->get_name()->length();
- time_zone_str= thd_arg->variables.time_zone->get_name()->ptr();
- }
- else
- time_zone_len= 0;
-
- LEX *lex= thd->lex;
- /*
- Defines that the statement will be written directly to the binary log
- without being wrapped by a BEGIN...COMMIT. Otherwise, the statement
- will be written to either the trx-cache or stmt-cache.
-
- Note that a cache will not be used if the parameter direct is TRUE.
- */
- bool use_cache= FALSE;
- /*
- TRUE defines that the trx-cache must be used and by consequence the
- use_cache is TRUE.
-
- Note that a cache will not be used if the parameter direct is TRUE.
- */
- bool trx_cache= FALSE;
- cache_type= Log_event::EVENT_INVALID_CACHE;
-
- if (!direct)
- {
- switch (lex->sql_command)
- {
- case SQLCOM_DROP_TABLE:
- case SQLCOM_DROP_SEQUENCE:
- use_cache= (lex->tmp_table() && thd->in_multi_stmt_transaction_mode());
- break;
-
- case SQLCOM_CREATE_TABLE:
- case SQLCOM_CREATE_SEQUENCE:
- /*
- 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->first_select_lex()->item_list.elements &&
- 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;
- break;
- case SQLCOM_SET_OPTION:
- if (lex->autocommit)
- use_cache= trx_cache= FALSE;
- else
- use_cache= TRUE;
- break;
- case SQLCOM_RELEASE_SAVEPOINT:
- case SQLCOM_ROLLBACK_TO_SAVEPOINT:
- case SQLCOM_SAVEPOINT:
- use_cache= trx_cache= TRUE;
- break;
- default:
- use_cache= sqlcom_can_generate_row_events(thd);
- break;
- }
- }
-
- if (!use_cache || direct)
- {
- cache_type= Log_event::EVENT_NO_CACHE;
- }
- else if (using_trans || trx_cache || stmt_has_updated_trans_table(thd) ||
- thd->lex->is_mixed_stmt_unsafe(thd->in_multi_stmt_transaction_mode(),
- thd->variables.binlog_direct_non_trans_update,
- trans_has_updated_trans_table(thd),
- thd->tx_isolation))
- cache_type= Log_event::EVENT_TRANSACTIONAL_CACHE;
- 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 cache_tye: %d",
- (ulong) flags2, sql_mode, cache_type));
-}
-
-Query_compressed_log_event::Query_compressed_log_event(THD* thd_arg, const char* query_arg,
- ulong query_length, bool using_trans,
- bool direct, bool suppress_use, int errcode)
- :Query_log_event(thd_arg, query_arg, query_length, using_trans, direct,
- suppress_use, errcode),
- query_buf(0)
-{
-
-}
-#endif /* MYSQL_CLIENT */
/* 2 utility functions for the next method */
@@ -5149,962 +1956,10 @@ Query_log_event::begin_event(String *packet, ulong ev_offset,
}
-#ifdef MYSQL_CLIENT
-/**
- Query_log_event::print().
-
- @todo
- print the catalog ??
-*/
-bool Query_log_event::print_query_header(IO_CACHE* file,
- PRINT_EVENT_INFO* print_event_info)
-{
- // TODO: print the catalog ??
- char buff[64], *end; // Enough for SET TIMESTAMP
- bool different_db= 1;
- uint32 tmp;
-
- if (!print_event_info->short_form)
- {
- if (print_header(file, print_event_info, FALSE) ||
- my_b_printf(file,
- "\t%s\tthread_id=%lu\texec_time=%lu\terror_code=%d\n",
- get_type_str(), (ulong) thread_id, (ulong) exec_time,
- error_code))
- goto err;
- }
-
- if ((flags & LOG_EVENT_SUPPRESS_USE_F))
- {
- if (!is_trans_keyword())
- print_event_info->db[0]= '\0';
- }
- else if (db)
- {
- different_db= memcmp(print_event_info->db, db, db_len + 1);
- if (different_db)
- memcpy(print_event_info->db, db, db_len + 1);
- if (db[0] && different_db)
- if (my_b_printf(file, "use %`s%s\n", db, print_event_info->delimiter))
- goto err;
- }
-
- end=int10_to_str((long) when, strmov(buff,"SET TIMESTAMP="),10);
- if (when_sec_part && when_sec_part <= TIME_MAX_SECOND_PART)
- {
- *end++= '.';
- end=int10_to_str(when_sec_part, end, 10);
- }
- end= strmov(end, print_event_info->delimiter);
- *end++='\n';
- if (my_b_write(file, (uchar*) buff, (uint) (end-buff)))
- goto err;
- if ((!print_event_info->thread_id_printed ||
- ((flags & LOG_EVENT_THREAD_SPECIFIC_F) &&
- thread_id != print_event_info->thread_id)))
- {
- // If --short-form, print deterministic value instead of pseudo_thread_id.
- if (my_b_printf(file,"SET @@session.pseudo_thread_id=%lu%s\n",
- short_form ? 999999999 : (ulong)thread_id,
- print_event_info->delimiter))
- goto err;
- print_event_info->thread_id= thread_id;
- print_event_info->thread_id_printed= 1;
- }
-
- /*
- If flags2_inited==0, this is an event from 3.23 or 4.0; nothing to
- print (remember we don't produce mixed relay logs so there cannot be
- 5.0 events before that one so there is nothing to reset).
- */
- if (likely(flags2_inited)) /* likely as this will mainly read 5.0 logs */
- {
- /* tmp is a bitmask of bits which have changed. */
- if (likely(print_event_info->flags2_inited))
- /* All bits which have changed */
- tmp= (print_event_info->flags2) ^ flags2;
- else /* that's the first Query event we read */
- {
- print_event_info->flags2_inited= 1;
- tmp= ~((uint32)0); /* all bits have changed */
- }
-
- if (unlikely(tmp)) /* some bits have changed */
- {
- bool need_comma= 0;
- if (my_b_write_string(file, "SET ") ||
- print_set_option(file, tmp, OPTION_NO_FOREIGN_KEY_CHECKS, ~flags2,
- "@@session.foreign_key_checks", &need_comma)||
- print_set_option(file, tmp, OPTION_AUTO_IS_NULL, flags2,
- "@@session.sql_auto_is_null", &need_comma) ||
- print_set_option(file, tmp, OPTION_RELAXED_UNIQUE_CHECKS, ~flags2,
- "@@session.unique_checks", &need_comma) ||
- print_set_option(file, tmp, OPTION_NOT_AUTOCOMMIT, ~flags2,
- "@@session.autocommit", &need_comma) ||
- print_set_option(file, tmp, OPTION_NO_CHECK_CONSTRAINT_CHECKS,
- ~flags2,
- "@@session.check_constraint_checks", &need_comma) ||
- my_b_printf(file,"%s\n", print_event_info->delimiter))
- goto err;
- print_event_info->flags2= flags2;
- }
- }
-
- /*
- Now the session variables;
- it's more efficient to pass SQL_MODE as a number instead of a
- comma-separated list.
- FOREIGN_KEY_CHECKS, SQL_AUTO_IS_NULL, UNIQUE_CHECKS are session-only
- variables (they have no global version; they're not listed in
- sql_class.h), The tests below work for pure binlogs or pure relay
- logs. Won't work for mixed relay logs but we don't create mixed
- relay logs (that is, there is no relay log with a format change
- except within the 3 first events, which mysqlbinlog handles
- gracefully). So this code should always be good.
- */
-
- if (likely(sql_mode_inited) &&
- (unlikely(print_event_info->sql_mode != sql_mode ||
- !print_event_info->sql_mode_inited)))
- {
- char llbuff[22];
- if (my_b_printf(file,"SET @@session.sql_mode=%s%s\n",
- ullstr(sql_mode, llbuff), print_event_info->delimiter))
- goto err;
- print_event_info->sql_mode= sql_mode;
- print_event_info->sql_mode_inited= 1;
- }
- if (print_event_info->auto_increment_increment != auto_increment_increment ||
- print_event_info->auto_increment_offset != auto_increment_offset)
- {
- if (my_b_printf(file,"SET @@session.auto_increment_increment=%lu, @@session.auto_increment_offset=%lu%s\n",
- auto_increment_increment,auto_increment_offset,
- print_event_info->delimiter))
- goto err;
- print_event_info->auto_increment_increment= auto_increment_increment;
- print_event_info->auto_increment_offset= auto_increment_offset;
- }
-
- /* TODO: print the catalog when we feature SET CATALOG */
-
- if (likely(charset_inited) &&
- (unlikely(!print_event_info->charset_inited ||
- memcmp(print_event_info->charset, charset, 6))))
- {
- CHARSET_INFO *cs_info= get_charset(uint2korr(charset), MYF(MY_WME));
- if (cs_info)
- {
- /* for mysql client */
- if (my_b_printf(file, "/*!\\C %s */%s\n",
- cs_info->csname, print_event_info->delimiter))
- goto err;
- }
- if (my_b_printf(file,"SET "
- "@@session.character_set_client=%d,"
- "@@session.collation_connection=%d,"
- "@@session.collation_server=%d"
- "%s\n",
- uint2korr(charset),
- uint2korr(charset+2),
- uint2korr(charset+4),
- print_event_info->delimiter))
- goto err;
- memcpy(print_event_info->charset, charset, 6);
- print_event_info->charset_inited= 1;
- }
- if (time_zone_len)
- {
- if (memcmp(print_event_info->time_zone_str,
- time_zone_str, time_zone_len+1))
- {
- if (my_b_printf(file,"SET @@session.time_zone='%s'%s\n",
- time_zone_str, print_event_info->delimiter))
- goto err;
- memcpy(print_event_info->time_zone_str, time_zone_str, time_zone_len+1);
- }
- }
- if (lc_time_names_number != print_event_info->lc_time_names_number)
- {
- if (my_b_printf(file, "SET @@session.lc_time_names=%d%s\n",
- lc_time_names_number, print_event_info->delimiter))
- goto err;
- print_event_info->lc_time_names_number= lc_time_names_number;
- }
- if (charset_database_number != print_event_info->charset_database_number)
- {
- if (charset_database_number)
- {
- if (my_b_printf(file, "SET @@session.collation_database=%d%s\n",
- charset_database_number, print_event_info->delimiter))
- goto err;
- }
- else if (my_b_printf(file, "SET @@session.collation_database=DEFAULT%s\n",
- print_event_info->delimiter))
- goto err;
- print_event_info->charset_database_number= charset_database_number;
- }
- return 0;
-
-err:
- return 1;
-}
-
-
-bool Query_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
-{
- Write_on_release_cache cache(&print_event_info->head_cache, file, 0, this);
-
- /**
- reduce the size of io cache so that the write function is called
- for every call to my_b_write().
- */
- DBUG_EXECUTE_IF ("simulate_file_write_error",
- {(&cache)->write_pos= (&cache)->write_end- 500;});
- if (print_query_header(&cache, print_event_info))
- goto err;
- if (!is_flashback)
- {
- if (my_b_write(&cache, (uchar*) query, q_len) ||
- my_b_printf(&cache, "\n%s\n", print_event_info->delimiter))
- goto err;
- }
- else // is_flashback == 1
- {
- if (strcmp("BEGIN", query) == 0)
- {
- if (my_b_write(&cache, (uchar*) "COMMIT", 6) ||
- my_b_printf(&cache, "\n%s\n", print_event_info->delimiter))
- goto err;
- }
- else if (strcmp("COMMIT", query) == 0)
- {
- if (my_b_write(&cache, (uchar*) "BEGIN", 5) ||
- my_b_printf(&cache, "\n%s\n", print_event_info->delimiter))
- goto err;
- }
- }
- return cache.flush_data();
-err:
- return 1;
-}
-#endif /* MYSQL_CLIENT */
-
-
-/*
- Query_log_event::do_apply_event()
-*/
-
-#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-
-int Query_log_event::do_apply_event(rpl_group_info *rgi)
-{
- return do_apply_event(rgi, query, q_len);
-}
-
-/**
- Compare if two errors should be regarded as equal.
- This is to handle the case when you can get slightly different errors
- on master and slave for the same thing.
- @param
- expected_error Error we got on master
- actual_error Error we got on slave
-
- @return
- 1 Errors are equal
- 0 Errors are different
-*/
-
-bool test_if_equal_repl_errors(int expected_error, int actual_error)
-{
- if (expected_error == actual_error)
- return 1;
- switch (expected_error) {
- case ER_DUP_ENTRY:
- case ER_DUP_ENTRY_WITH_KEY_NAME:
- case ER_DUP_KEY:
- case ER_AUTOINC_READ_FAILED:
- return (actual_error == ER_DUP_ENTRY ||
- actual_error == ER_DUP_ENTRY_WITH_KEY_NAME ||
- actual_error == ER_DUP_KEY ||
- actual_error == ER_AUTOINC_READ_FAILED ||
- actual_error == HA_ERR_AUTOINC_ERANGE);
- case ER_UNKNOWN_TABLE:
- return actual_error == ER_IT_IS_A_VIEW;
- default:
- break;
- }
- return 0;
-}
-
-
-/**
- @todo
- Compare the values of "affected rows" around here. Something
- like:
- @code
- if ((uint32) affected_in_event != (uint32) affected_on_slave)
- {
- sql_print_error("Slave: did not get the expected number of affected \
- rows running query from master - expected %d, got %d (this numbers \
- should have matched modulo 4294967296).", 0, ...);
- thd->query_error = 1;
- }
- @endcode
- We may also want an option to tell the slave to ignore "affected"
- mismatch. This mismatch could be implemented with a new ER_ code, and
- to ignore it you would use --slave-skip-errors...
-*/
-int Query_log_event::do_apply_event(rpl_group_info *rgi,
- const char *query_arg, uint32 q_len_arg)
-{
- int expected_error,actual_error= 0;
- Schema_specification_st db_options;
- uint64 sub_id= 0;
- void *hton= NULL;
- rpl_gtid gtid;
- Relay_log_info const *rli= rgi->rli;
- Rpl_filter *rpl_filter= rli->mi->rpl_filter;
- bool current_stmt_is_commit;
- DBUG_ENTER("Query_log_event::do_apply_event");
-
- /*
- Colleagues: please never free(thd->catalog) in MySQL. This would
- lead to bugs as here thd->catalog is a part of an alloced block,
- not an entire alloced block (see
- Query_log_event::do_apply_event()). Same for thd->db. Thank
- you.
- */
- thd->catalog= catalog_len ? (char *) catalog : (char *)"";
-
- size_t valid_len= Well_formed_prefix(system_charset_info,
- db, db_len, NAME_LEN).length();
-
- if (valid_len != db_len)
- {
- rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
- ER_THD(thd, ER_SLAVE_FATAL_ERROR),
- "Invalid database name in Query event.");
- thd->is_slave_error= true;
- goto end;
- }
-
- set_thd_db(thd, rpl_filter, db, db_len);
-
- /*
- Setting the character set and collation of the current database thd->db.
- */
- load_db_opt_by_name(thd, thd->db.str, &db_options);
- if (db_options.default_table_charset)
- thd->db_charset= db_options.default_table_charset;
- thd->variables.auto_increment_increment= auto_increment_increment;
- thd->variables.auto_increment_offset= auto_increment_offset;
-
- DBUG_PRINT("info", ("log_pos: %lu", (ulong) log_pos));
-
- thd->clear_error(1);
- current_stmt_is_commit= is_commit();
-
- DBUG_ASSERT(!current_stmt_is_commit || !rgi->tables_to_lock);
- rgi->slave_close_thread_tables(thd);
-
- /*
- Note: We do not need to execute reset_one_shot_variables() if this
- db_ok() test fails.
- Reason: The db stored in binlog events is the same for SET and for
- its companion query. If the SET is ignored because of
- db_ok(), the companion query will also be ignored, and if
- the companion query is ignored in the db_ok() test of
- ::do_apply_event(), then the companion SET also have so
- we don't need to reset_one_shot_variables().
- */
- if (is_trans_keyword() || rpl_filter->db_ok(thd->db.str))
- {
- thd->set_time(when, when_sec_part);
- thd->set_query_and_id((char*)query_arg, q_len_arg,
- thd->charset(), next_query_id());
- thd->variables.pseudo_thread_id= thread_id; // for temp tables
- DBUG_PRINT("query",("%s", thd->query()));
-
- if (unlikely(!(expected_error= error_code)) ||
- ignored_error_code(expected_error) ||
- !unexpected_error_code(expected_error))
- {
- thd->slave_expected_error= expected_error;
- if (flags2_inited)
- /*
- all bits of thd->variables.option_bits which are 1 in OPTIONS_WRITTEN_TO_BIN_LOG
- must take their value from flags2.
- */
- thd->variables.option_bits= flags2|(thd->variables.option_bits & ~OPTIONS_WRITTEN_TO_BIN_LOG);
- /*
- else, we are in a 3.23/4.0 binlog; we previously received a
- Rotate_log_event which reset thd->variables.option_bits and sql_mode etc, so
- nothing to do.
- */
- /*
- We do not replicate MODE_NO_DIR_IN_CREATE. That is, if the master is a
- slave which runs with SQL_MODE=MODE_NO_DIR_IN_CREATE, this should not
- force us to ignore the dir too. Imagine you are a ring of machines, and
- one has a disk problem so that you temporarily need
- MODE_NO_DIR_IN_CREATE on this machine; you don't want it to propagate
- elsewhere (you don't want all slaves to start ignoring the dirs).
- */
- if (sql_mode_inited)
- thd->variables.sql_mode=
- (sql_mode_t) ((thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE) |
- (sql_mode & ~(sql_mode_t) MODE_NO_DIR_IN_CREATE));
- if (charset_inited)
- {
- rpl_sql_thread_info *sql_info= thd->system_thread_info.rpl_sql_info;
- if (sql_info->cached_charset_compare(charset))
- {
- /* Verify that we support the charsets found in the event. */
- if (!(thd->variables.character_set_client=
- get_charset(uint2korr(charset), MYF(MY_WME))) ||
- !(thd->variables.collation_connection=
- get_charset(uint2korr(charset+2), MYF(MY_WME))) ||
- !(thd->variables.collation_server=
- get_charset(uint2korr(charset+4), MYF(MY_WME))))
- {
- /*
- We updated the thd->variables with nonsensical values (0). Let's
- set them to something safe (i.e. which avoids crash), and we'll
- stop with EE_UNKNOWN_CHARSET in compare_errors (unless set to
- ignore this error).
- */
- set_slave_thread_default_charset(thd, rgi);
- goto compare_errors;
- }
- thd->update_charset(); // for the charset change to take effect
- /*
- Reset thd->query_string.cs to the newly set value.
- Note, there is a small flaw here. For a very short time frame
- if the new charset is different from the old charset and
- if another thread executes "SHOW PROCESSLIST" after
- the above thd->set_query_and_id() and before this thd->set_query(),
- and if the current query has some non-ASCII characters,
- the another thread may see some '?' marks in the PROCESSLIST
- result. This should be acceptable now. This is a reminder
- to fix this if any refactoring happens here sometime.
- */
- thd->set_query((char*) query_arg, q_len_arg, thd->charset());
- }
- }
- if (time_zone_len)
- {
- String tmp(time_zone_str, time_zone_len, &my_charset_bin);
- if (!(thd->variables.time_zone= my_tz_find(thd, &tmp)))
- {
- my_error(ER_UNKNOWN_TIME_ZONE, MYF(0), tmp.c_ptr());
- thd->variables.time_zone= global_system_variables.time_zone;
- goto compare_errors;
- }
- }
- if (lc_time_names_number)
- {
- if (!(thd->variables.lc_time_names=
- my_locale_by_number(lc_time_names_number)))
- {
- my_printf_error(ER_UNKNOWN_ERROR,
- "Unknown locale: '%d'", MYF(0), lc_time_names_number);
- thd->variables.lc_time_names= &my_locale_en_US;
- goto compare_errors;
- }
- }
- else
- thd->variables.lc_time_names= &my_locale_en_US;
- if (charset_database_number)
- {
- CHARSET_INFO *cs;
- if (!(cs= get_charset(charset_database_number, MYF(0))))
- {
- char buf[20];
- int10_to_str((int) charset_database_number, buf, -10);
- my_error(ER_UNKNOWN_COLLATION, MYF(0), buf);
- goto compare_errors;
- }
- thd->variables.collation_database= cs;
- }
- else
- thd->variables.collation_database= thd->db_charset;
-
- {
- const CHARSET_INFO *cs= thd->charset();
- /*
- We cannot ask for parsing a statement using a character set
- without state_maps (parser internal data).
- */
- if (!cs->state_map)
- {
- rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
- ER_THD(thd, ER_SLAVE_FATAL_ERROR),
- "character_set cannot be parsed");
- thd->is_slave_error= true;
- goto end;
- }
- }
-
- /*
- Record any GTID in the same transaction, so slave state is
- transactionally consistent.
- */
- if (current_stmt_is_commit)
- {
- thd->variables.option_bits&= ~OPTION_GTID_BEGIN;
- if (rgi->gtid_pending)
- {
- sub_id= rgi->gtid_sub_id;
- rgi->gtid_pending= false;
-
- gtid= rgi->current_gtid;
- if (unlikely(rpl_global_gtid_slave_state->record_gtid(thd, &gtid,
- sub_id,
- true, false,
- &hton)))
- {
- int errcode= thd->get_stmt_da()->sql_errno();
- if (!is_parallel_retry_error(rgi, errcode))
- rli->report(ERROR_LEVEL, ER_CANNOT_UPDATE_GTID_STATE,
- rgi->gtid_info(),
- "Error during COMMIT: failed to update GTID state in "
- "%s.%s: %d: %s",
- "mysql", rpl_gtid_slave_state_table_name.str,
- errcode,
- thd->get_stmt_da()->message());
- sub_id= 0;
- thd->is_slave_error= 1;
- goto end;
- }
- }
- }
-
- thd->table_map_for_update= (table_map)table_map_for_update;
- thd->set_invoker(&user, &host);
- /*
- Flag if we need to rollback the statement transaction on
- slave if it by chance succeeds.
- If we expected a non-zero error code and get nothing and,
- it is a concurrency issue or ignorable issue, effects
- of the statement should be rolled back.
- */
- if (unlikely(expected_error) &&
- (ignored_error_code(expected_error) ||
- concurrency_error_code(expected_error)))
- {
- thd->variables.option_bits|= OPTION_MASTER_SQL_ERROR;
- thd->variables.option_bits&= ~OPTION_GTID_BEGIN;
- }
- /* Execute the query (note that we bypass dispatch_command()) */
- Parser_state parser_state;
- if (!parser_state.init(thd, thd->query(), thd->query_length()))
- {
- DBUG_ASSERT(thd->m_digest == NULL);
- thd->m_digest= & thd->m_digest_state;
- DBUG_ASSERT(thd->m_statement_psi == NULL);
- thd->m_statement_psi= MYSQL_START_STATEMENT(&thd->m_statement_state,
- stmt_info_rpl.m_key,
- thd->db.str, thd->db.length,
- thd->charset());
- THD_STAGE_INFO(thd, stage_init);
- MYSQL_SET_STATEMENT_TEXT(thd->m_statement_psi, thd->query(), thd->query_length());
- if (thd->m_digest != NULL)
- thd->m_digest->reset(thd->m_token_array, max_digest_length);
-
- if (thd->slave_thread)
- {
- /*
- To be compatible with previous releases, the slave thread uses the global
- log_slow_disabled_statements value, wich can be changed dynamically, so we
- have to set the sql_log_slow respectively.
- */
- thd->variables.sql_log_slow= !MY_TEST(global_system_variables.log_slow_disabled_statements & LOG_SLOW_DISABLE_SLAVE);
- }
-
- mysql_parse(thd, thd->query(), thd->query_length(), &parser_state,
- FALSE, FALSE);
- /* Finalize server status flags after executing a statement. */
- thd->update_server_status();
- log_slow_statement(thd);
- thd->lex->restore_set_statement_var();
- }
-
- thd->variables.option_bits&= ~OPTION_MASTER_SQL_ERROR;
- }
- else
- {
- /*
- The query got a really bad error on the master (thread killed etc),
- which could be inconsistent. Parse it to test the table names: if the
- replicate-*-do|ignore-table rules say "this query must be ignored" then
- we exit gracefully; otherwise we warn about the bad error and tell DBA
- to check/fix it.
- */
- if (mysql_test_parse_for_slave(thd, thd->query(), thd->query_length()))
- thd->clear_error(1);
- else
- {
- rli->report(ERROR_LEVEL, expected_error, rgi->gtid_info(),
- "\
-Query partially completed on the master (error on master: %d) \
-and was aborted. There is a chance that your master is inconsistent at this \
-point. If you are sure that your master is ok, run this query manually on the \
-slave and then restart the slave with SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; \
-START SLAVE; . Query: '%s'", expected_error, thd->query());
- thd->is_slave_error= 1;
- }
- goto end;
- }
-
- /* If the query was not ignored, it is printed to the general log */
- if (likely(!thd->is_error()) ||
- thd->get_stmt_da()->sql_errno() != ER_SLAVE_IGNORED_TABLE)
- general_log_write(thd, COM_QUERY, thd->query(), thd->query_length());
- else
- {
- /*
- Bug#54201: If we skip an INSERT query that uses auto_increment, then we
- should reset any @@INSERT_ID set by an Intvar_log_event associated with
- the query; otherwise the @@INSERT_ID will linger until the next INSERT
- that uses auto_increment and may affect extra triggers on the slave etc.
-
- We reset INSERT_ID unconditionally; it is probably cheaper than
- checking if it is necessary.
- */
- thd->auto_inc_intervals_forced.empty();
- }
-
-compare_errors:
- /*
- In the slave thread, we may sometimes execute some DROP / * 40005
- TEMPORARY * / TABLE that come from parts of binlogs (likely if we
- use RESET SLAVE or CHANGE MASTER TO), while the temporary table
- has already been dropped. To ignore such irrelevant "table does
- not exist errors", we silently clear the error if TEMPORARY was used.
- */
- if ((thd->lex->sql_command == SQLCOM_DROP_TABLE ||
- thd->lex->sql_command == SQLCOM_DROP_SEQUENCE) &&
- thd->lex->tmp_table() &&
- thd->is_error() && thd->get_stmt_da()->sql_errno() == ER_BAD_TABLE_ERROR &&
- !expected_error)
- thd->get_stmt_da()->reset_diagnostics_area();
- /*
- If we expected a non-zero error code, and we don't get the same error
- code, and it should be ignored or is related to a concurrency issue.
- */
- actual_error= thd->is_error() ? thd->get_stmt_da()->sql_errno() : 0;
- DBUG_PRINT("info",("expected_error: %d sql_errno: %d",
- expected_error, actual_error));
-
- if ((unlikely(expected_error) &&
- !test_if_equal_repl_errors(expected_error, actual_error) &&
- !concurrency_error_code(expected_error)) &&
- !ignored_error_code(actual_error) &&
- !ignored_error_code(expected_error))
- {
- 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_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;
- }
- /*
- If we get the same error code as expected and it is not a concurrency
- issue, or should be ignored.
- */
- else if ((test_if_equal_repl_errors(expected_error, actual_error) &&
- !concurrency_error_code(expected_error)) ||
- ignored_error_code(actual_error))
- {
- DBUG_PRINT("info",("error ignored"));
- thd->clear_error(1);
- if (actual_error == ER_QUERY_INTERRUPTED ||
- actual_error == ER_CONNECTION_KILLED)
- thd->reset_killed();
- }
- /*
- Other cases: mostly we expected no error and get one.
- */
- else if (unlikely(thd->is_slave_error || thd->is_fatal_error))
- {
- if (!is_parallel_retry_error(rgi, actual_error))
- rli->report(ERROR_LEVEL, actual_error, rgi->gtid_info(),
- "Error '%s' on query. Default database: '%s'. Query: '%s'",
- (actual_error ? thd->get_stmt_da()->message() :
- "unexpected success or fatal error"),
- thd->get_db(), query_arg);
- thd->is_slave_error= 1;
-#ifdef WITH_WSREP
- if (wsrep_thd_is_toi(thd) && wsrep_must_ignore_error(thd))
- {
- thd->clear_error(1);
- thd->killed= NOT_KILLED;
- thd->wsrep_has_ignored_error= true;
- }
-#endif /* WITH_WSREP */
- }
-
- /*
- TODO: compare the values of "affected rows" around here. Something
- like:
- if ((uint32) affected_in_event != (uint32) affected_on_slave)
- {
- sql_print_error("Slave: did not get the expected number of affected \
- rows running query from master - expected %d, got %d (this numbers \
- should have matched modulo 4294967296).", 0, ...);
- thd->is_slave_error = 1;
- }
- We may also want an option to tell the slave to ignore "affected"
- mismatch. This mismatch could be implemented with a new ER_ code, and
- to ignore it you would use --slave-skip-errors...
-
- To do the comparison we need to know the value of "affected" which the
- above mysql_parse() computed. And we need to know the value of
- "affected" in the master's binlog. Both will be implemented later. The
- important thing is that we now have the format ready to log the values
- of "affected" in the binlog. So we can release 5.0.0 before effectively
- logging "affected" and effectively comparing it.
- */
- } /* End of if (db_ok(... */
-
- {
- /**
- The following failure injecion works in cooperation with tests
- setting @@global.debug= 'd,stop_slave_middle_group'.
- The sql thread receives the killed status and will proceed
- to shutdown trying to finish incomplete events group.
- */
- DBUG_EXECUTE_IF("stop_slave_middle_group",
- if (!current_stmt_is_commit && is_begin() == 0)
- {
- if (thd->transaction.all.modified_non_trans_table)
- const_cast<Relay_log_info*>(rli)->abort_slave= 1;
- };);
- }
-
-end:
- if (unlikely(sub_id && !thd->is_slave_error))
- rpl_global_gtid_slave_state->update_state_hash(sub_id, &gtid, hton, rgi);
-
- /*
- Probably we have set thd->query, thd->db, thd->catalog to point to places
- in the data_buf of this event. Now the event is going to be deleted
- probably, so data_buf will be freed, so the thd->... listed above will be
- pointers to freed memory.
- So we must set them to 0, so that those bad pointers values are not later
- used. Note that "cleanup" queries like automatic DROP TEMPORARY TABLE
- don't suffer from these assignments to 0 as DROP TEMPORARY
- TABLE uses the db.table syntax.
- */
- thd->catalog= 0;
- thd->set_db(&null_clex_str); /* will free the current database */
- thd->reset_query();
- DBUG_PRINT("info", ("end: query= 0"));
-
- /* Mark the statement completed. */
- MYSQL_END_STATEMENT(thd->m_statement_psi, thd->get_stmt_da());
- thd->m_statement_psi= NULL;
- thd->m_digest= NULL;
-
- /*
- As a disk space optimization, future masters will not log an event for
- LAST_INSERT_ID() if that function returned 0 (and thus they will be able
- to replace the THD::stmt_depends_on_first_successful_insert_id_in_prev_stmt
- variable by (THD->first_successful_insert_id_in_prev_stmt > 0) ; with the
- resetting below we are ready to support that.
- */
- thd->first_successful_insert_id_in_prev_stmt_for_binlog= 0;
- thd->first_successful_insert_id_in_prev_stmt= 0;
- thd->stmt_depends_on_first_successful_insert_id_in_prev_stmt= 0;
- free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
- DBUG_RETURN(thd->is_slave_error);
-}
-
-Log_event::enum_skip_reason
-Query_log_event::do_shall_skip(rpl_group_info *rgi)
-{
- Relay_log_info *rli= rgi->rli;
- DBUG_ENTER("Query_log_event::do_shall_skip");
- DBUG_PRINT("debug", ("query: '%s' q_len: %d", query, q_len));
- DBUG_ASSERT(query && q_len > 0);
- DBUG_ASSERT(thd == rgi->thd);
-
- /*
- An event skipped due to @@skip_replication must not be counted towards the
- number of events to be skipped due to @@sql_slave_skip_counter.
- */
- if (flags & LOG_EVENT_SKIP_REPLICATION_F &&
- opt_replicate_events_marked_for_skip != RPL_SKIP_REPLICATE)
- DBUG_RETURN(Log_event::EVENT_SKIP_IGNORE);
-
- if (rli->slave_skip_counter > 0)
- {
- if (is_begin())
- {
- thd->variables.option_bits|= OPTION_BEGIN | OPTION_GTID_BEGIN;
- DBUG_RETURN(Log_event::continue_group(rgi));
- }
-
- if (is_commit() || is_rollback())
- {
- thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_GTID_BEGIN);
- DBUG_RETURN(Log_event::EVENT_SKIP_COUNT);
- }
- }
-#ifdef WITH_WSREP
- else if (WSREP_ON && wsrep_mysql_replication_bundle && opt_slave_domain_parallel_threads == 0 &&
- thd->wsrep_mysql_replicated > 0 &&
- (is_begin() || is_commit()))
- {
- if (++thd->wsrep_mysql_replicated < (int)wsrep_mysql_replication_bundle)
- {
- WSREP_DEBUG("skipping wsrep commit %d", thd->wsrep_mysql_replicated);
- DBUG_RETURN(Log_event::EVENT_SKIP_IGNORE);
- }
- else
- {
- thd->wsrep_mysql_replicated = 0;
- }
- }
-#endif
- DBUG_RETURN(Log_event::do_shall_skip(rgi));
-}
-
-
-bool
-Query_log_event::peek_is_commit_rollback(const char *event_start,
- size_t event_len,
- enum enum_binlog_checksum_alg checksum_alg)
-{
- if (checksum_alg == BINLOG_CHECKSUM_ALG_CRC32)
- {
- if (event_len > BINLOG_CHECKSUM_LEN)
- event_len-= BINLOG_CHECKSUM_LEN;
- else
- event_len= 0;
- }
- else
- DBUG_ASSERT(checksum_alg == BINLOG_CHECKSUM_ALG_UNDEF ||
- checksum_alg == BINLOG_CHECKSUM_ALG_OFF);
-
- if (event_len < LOG_EVENT_HEADER_LEN + QUERY_HEADER_LEN || event_len < 9)
- return false;
- return !memcmp(event_start + (event_len-7), "\0COMMIT", 7) ||
- !memcmp(event_start + (event_len-9), "\0ROLLBACK", 9);
-}
-
-#endif
-
-
/**************************************************************************
Start_log_event_v3 methods
**************************************************************************/
-#ifndef MYSQL_CLIENT
-Start_log_event_v3::Start_log_event_v3()
- :Log_event(), created(0), binlog_version(BINLOG_VERSION),
- dont_set_created(0)
-{
- memcpy(server_version, ::server_version, ST_SERVER_VER_LEN);
-}
-#endif
-
-/*
- Start_log_event_v3::pack_info()
-*/
-
-#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-void Start_log_event_v3::pack_info(Protocol *protocol)
-{
- char buf[12 + ST_SERVER_VER_LEN + 14 + 22], *pos;
- pos= strmov(buf, "Server ver: ");
- pos= strmov(pos, server_version);
- pos= strmov(pos, ", Binlog ver: ");
- pos= int10_to_str(binlog_version, pos, 10);
- protocol->store(buf, (uint) (pos-buf), &my_charset_bin);
-}
-#endif
-
-
-/*
- Start_log_event_v3::print()
-*/
-
-#ifdef MYSQL_CLIENT
-bool Start_log_event_v3::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
-{
- DBUG_ENTER("Start_log_event_v3::print");
-
- Write_on_release_cache cache(&print_event_info->head_cache, file,
- Write_on_release_cache::FLUSH_F);
-
- if (!print_event_info->short_form)
- {
- if (print_header(&cache, print_event_info, FALSE) ||
- my_b_printf(&cache, "\tStart: binlog v %d, server v %s created ",
- binlog_version, server_version) ||
- print_timestamp(&cache))
- goto err;
- if (created)
- if (my_b_printf(&cache," at startup"))
- goto err;
- if (my_b_printf(&cache, "\n"))
- goto err;
- if (flags & LOG_EVENT_BINLOG_IN_USE_F)
- if (my_b_printf(&cache,
- "# Warning: this binlog is either in use or was not "
- "closed properly.\n"))
- goto err;
- }
- if (!is_artificial_event() && created)
- {
-#ifdef WHEN_WE_HAVE_THE_RESET_CONNECTION_SQL_COMMAND
- /*
- This is for mysqlbinlog: like in replication, we want to delete the stale
- tmp files left by an unclean shutdown of mysqld (temporary tables)
- and rollback unfinished transaction.
- Probably this can be done with RESET CONNECTION (syntax to be defined).
- */
- if (my_b_printf(&cache,"RESET CONNECTION%s\n",
- print_event_info->delimiter))
- goto err;
-#else
- if (my_b_printf(&cache,"ROLLBACK%s\n", print_event_info->delimiter))
- goto err;
-#endif
- }
- if (temp_buf &&
- print_event_info->base64_output_mode != BASE64_OUTPUT_NEVER &&
- !print_event_info->short_form)
- {
- /* BINLOG is matched with the delimiter below on the same level */
- bool do_print_encoded=
- print_event_info->base64_output_mode != BASE64_OUTPUT_DECODE_ROWS;
- if (do_print_encoded)
- my_b_printf(&cache, "BINLOG '\n");
-
- if (print_base64(&cache, print_event_info, do_print_encoded))
- goto err;
-
- if (do_print_encoded)
- my_b_printf(&cache, "'%s\n", print_event_info->delimiter);
-
- print_event_info->printed_fd_event= TRUE;
- }
- DBUG_RETURN(cache.flush_data());
-err:
- DBUG_RETURN(1);
-}
-#endif /* MYSQL_CLIENT */
-
-/*
- Start_log_event_v3::Start_log_event_v3()
-*/
Start_log_event_v3::Start_log_event_v3(const char* buf, uint event_len,
const Format_description_log_event
@@ -6127,108 +1982,6 @@ Start_log_event_v3::Start_log_event_v3(const char* buf, uint event_len,
}
-/*
- Start_log_event_v3::write()
-*/
-
-#ifndef MYSQL_CLIENT
-bool Start_log_event_v3::write()
-{
- char buff[START_V3_HEADER_LEN];
- int2store(buff + ST_BINLOG_VER_OFFSET,binlog_version);
- memcpy(buff + ST_SERVER_VER_OFFSET,server_version,ST_SERVER_VER_LEN);
- 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(sizeof(buff)) ||
- write_data(buff, sizeof(buff)) ||
- write_footer();
-}
-#endif
-
-
-#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-
-/**
- Start_log_event_v3::do_apply_event() .
- The master started
-
- IMPLEMENTATION
- - To handle the case where the master died without having time to write
- DROP TEMPORARY TABLE, DO RELEASE_LOCK (prepared statements' deletion is
- TODO), we clean up all temporary tables that we got, if we are sure we
- can (see below).
-
- @todo
- - Remove all active user locks.
- Guilhem 2003-06: this is true but not urgent: the worst it can cause is
- the use of a bit of memory for a user lock which will not be used
- anymore. If the user lock is later used, the old one will be released. In
- other words, no deadlock problem.
-*/
-
-int Start_log_event_v3::do_apply_event(rpl_group_info *rgi)
-{
- DBUG_ENTER("Start_log_event_v3::do_apply_event");
- int error= 0;
- Relay_log_info *rli= rgi->rli;
-
- switch (binlog_version)
- {
- case 3:
- case 4:
- /*
- This can either be 4.x (then a Start_log_event_v3 is only at master
- startup so we are sure the master has restarted and cleared his temp
- tables; the event always has 'created'>0) or 5.0 (then we have to test
- 'created').
- */
- if (created)
- {
- rli->close_temporary_tables();
-
- /*
- The following is only false if we get here with a BINLOG statement
- */
- if (rli->mi)
- cleanup_load_tmpdir(&rli->mi->cmp_connection_name);
- }
- break;
-
- /*
- Now the older formats; in that case load_tmpdir is cleaned up by the I/O
- thread.
- */
- case 1:
- if (strncmp(rli->relay_log.description_event_for_exec->server_version,
- "3.23.57",7) >= 0 && created)
- {
- /*
- Can distinguish, based on the value of 'created': this event was
- generated at master startup.
- */
- rli->close_temporary_tables();
- }
- /*
- Otherwise, can't distinguish a Start_log_event generated at
- master startup and one generated by master FLUSH LOGS, so cannot
- be sure temp tables have to be dropped. So do nothing.
- */
- break;
- default:
- /*
- This case is not expected. It can be either an event corruption or an
- unsupported binary log version.
- */
- rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
- ER_THD(thd, ER_SLAVE_FATAL_ERROR),
- "Binlog version not supported");
- DBUG_RETURN(1);
- }
- DBUG_RETURN(error);
-}
-#endif /* defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) */
-
/***************************************************************************
Format_description_log_event methods
****************************************************************************/
@@ -6478,159 +2231,6 @@ Format_description_log_event(const char* buf,
DBUG_VOID_RETURN;
}
-#ifndef MYSQL_CLIENT
-bool Format_description_log_event::write()
-{
- bool ret;
- bool no_checksum;
- /*
- We don't call Start_log_event_v3::write() because this would make 2
- my_b_safe_write().
- */
- uchar buff[START_V3_HEADER_LEN+1];
- size_t rec_size= sizeof(buff) + BINLOG_CHECKSUM_ALG_DESC_LEN +
- number_of_event_types;
- int2store(buff + ST_BINLOG_VER_OFFSET,binlog_version);
- memcpy((char*) buff + ST_SERVER_VER_OFFSET,server_version,ST_SERVER_VER_LEN);
- if (!dont_set_created)
- created= get_time();
- int4store(buff + ST_CREATED_OFFSET,created);
- buff[ST_COMMON_HEADER_LEN_OFFSET]= common_header_len;
- /*
- if checksum is requested
- record the checksum-algorithm descriptor next to
- post_header_len vector which will be followed by the checksum value.
- Master is supposed to trigger checksum computing by binlog_checksum_options,
- slave does it via marking the event according to
- FD_queue checksum_alg value.
- */
- compile_time_assert(BINLOG_CHECKSUM_ALG_DESC_LEN == 1);
-#ifdef DBUG_ASSERT_EXISTS
- data_written= 0; // to prepare for need_checksum assert
-#endif
- 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.
- Thereby a combination of (A) == 0, (V) != 0 means
- it's the checksum-aware server's FD event that heads checksum-free binlog
- file.
- Here 0 stands for checksumming OFF to evaluate (V) as 0 is that case.
- A combination of (A) != 0, (V) != 0 denotes FD of the checksum-aware server
- heading the checksummed binlog.
- (A), (V) presence in FD of the checksum-aware server makes the event
- 1 + 4 bytes bigger comparing to the former FD.
- */
-
- if ((no_checksum= (checksum_alg == BINLOG_CHECKSUM_ALG_OFF)))
- {
- checksum_alg= BINLOG_CHECKSUM_ALG_CRC32; // Forcing (V) room to fill anyway
- }
- 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;
-}
-#endif
-
-#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-int Format_description_log_event::do_apply_event(rpl_group_info *rgi)
-{
- int ret= 0;
- Relay_log_info *rli= rgi->rli;
- DBUG_ENTER("Format_description_log_event::do_apply_event");
-
- /*
- As a transaction NEVER spans on 2 or more binlogs:
- if we have an active transaction at this point, the master died
- while writing the transaction to the binary log, i.e. while
- flushing the binlog cache to the binlog. XA guarantees that master has
- rolled back. So we roll back.
- Note: this event could be sent by the master to inform us of the
- format of its binlog; in other words maybe it is not at its
- original place when it comes to us; we'll know this by checking
- log_pos ("artificial" events have log_pos == 0).
- */
- if (!is_artificial_event() && created && thd->transaction.all.ha_list)
- {
- /* This is not an error (XA is safe), just an information */
- rli->report(INFORMATION_LEVEL, 0, NULL,
- "Rolling back unfinished transaction (no COMMIT "
- "or ROLLBACK in relay log). A probable cause is that "
- "the master died while writing the transaction to "
- "its binary log, thus rolled back too.");
- rgi->cleanup_context(thd, 1);
- }
-
- /*
- If this event comes from ourselves, there is no cleaning task to
- perform, we don't call Start_log_event_v3::do_apply_event()
- (this was just to update the log's description event).
- */
- if (server_id != (uint32) global_system_variables.server_id)
- {
- /*
- If the event was not requested by the slave i.e. the master sent
- it while the slave asked for a position >4, the event will make
- rli->group_master_log_pos advance. Say that the slave asked for
- position 1000, and the Format_desc event's end is 96. Then in
- the beginning of replication rli->group_master_log_pos will be
- 0, then 96, then jump to first really asked event (which is
- >96). So this is ok.
- */
- ret= Start_log_event_v3::do_apply_event(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;
- rli->relay_log.description_event_for_exec= this;
- }
-
- DBUG_RETURN(ret);
-}
-
-int Format_description_log_event::do_update_pos(rpl_group_info *rgi)
-{
- if (server_id == (uint32) global_system_variables.server_id)
- {
- /*
- We only increase the relay log position if we are skipping
- events and do not touch any group_* variables, nor flush the
- relay log info. If there is a crash, we will have to re-skip
- the events again, but that is a minor issue.
-
- If we do not skip stepping the group log position (and the
- server id was changed when restarting the server), it might well
- be that we start executing at a position that is invalid, e.g.,
- at a Rows_log_event or a Query_log_event preceeded by a
- Intvar_log_event instead of starting at a Table_map_log_event or
- the Intvar_log_event respectively.
- */
- rgi->inc_event_relay_log_pos();
- return 0;
- }
- else
- {
- return Log_event::do_update_pos(rgi);
- }
-}
-
-Log_event::enum_skip_reason
-Format_description_log_event::do_shall_skip(rpl_group_info *rgi)
-{
- return Log_event::EVENT_SKIP_NOT;
-}
-
-#endif
-
bool Format_description_log_event::start_decryption(Start_encryption_log_event* sele)
{
DBUG_ASSERT(crypto_data.scheme == 0);
@@ -6766,42 +2366,7 @@ Start_encryption_log_event::Start_encryption_log_event(
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
-bool 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"));
- if (my_b_write(&cache, (uchar*)buf.ptr(), buf.length()))
- return 1;
- return (cache.flush_data());
-}
-#endif
/**************************************************************************
Load_log_event methods
General note about Load_log_event: the binlogging of LOAD DATA INFILE is
@@ -6819,252 +2384,6 @@ bool Start_encryption_log_event::print(FILE* file,
positions displayed in SHOW SLAVE STATUS then are fine too).
**************************************************************************/
-/*
- Load_log_event::print_query()
-*/
-
-#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-bool Load_log_event::print_query(THD *thd, bool need_db, const char *cs,
- String *buf, my_off_t *fn_start,
- my_off_t *fn_end, const char *qualify_db)
-{
- if (need_db && db && db_len)
- {
- buf->append(STRING_WITH_LEN("use "));
- append_identifier(thd, buf, db, db_len);
- buf->append(STRING_WITH_LEN("; "));
- }
-
- buf->append(STRING_WITH_LEN("LOAD DATA "));
-
- if (is_concurrent)
- buf->append(STRING_WITH_LEN("CONCURRENT "));
-
- if (fn_start)
- *fn_start= buf->length();
-
- if (check_fname_outside_temp_buf())
- buf->append(STRING_WITH_LEN("LOCAL "));
- buf->append(STRING_WITH_LEN("INFILE '"));
- buf->append_for_single_quote(fname, fname_len);
- buf->append(STRING_WITH_LEN("' "));
-
- if (sql_ex.opt_flags & REPLACE_FLAG)
- buf->append(STRING_WITH_LEN("REPLACE "));
- else if (sql_ex.opt_flags & IGNORE_FLAG)
- buf->append(STRING_WITH_LEN("IGNORE "));
-
- buf->append(STRING_WITH_LEN("INTO"));
-
- if (fn_end)
- *fn_end= buf->length();
-
- buf->append(STRING_WITH_LEN(" TABLE "));
- if (qualify_db)
- {
- append_identifier(thd, buf, qualify_db, strlen(qualify_db));
- buf->append(STRING_WITH_LEN("."));
- }
- append_identifier(thd, buf, table_name, table_name_len);
-
- if (cs != NULL)
- {
- buf->append(STRING_WITH_LEN(" CHARACTER SET "));
- buf->append(cs, strlen(cs));
- }
-
- /* We have to create all optional fields as the default is not empty */
- buf->append(STRING_WITH_LEN(" FIELDS TERMINATED BY "));
- pretty_print_str(buf, sql_ex.field_term, sql_ex.field_term_len);
- if (sql_ex.opt_flags & OPT_ENCLOSED_FLAG)
- buf->append(STRING_WITH_LEN(" OPTIONALLY "));
- buf->append(STRING_WITH_LEN(" ENCLOSED BY "));
- pretty_print_str(buf, sql_ex.enclosed, sql_ex.enclosed_len);
-
- buf->append(STRING_WITH_LEN(" ESCAPED BY "));
- pretty_print_str(buf, sql_ex.escaped, sql_ex.escaped_len);
-
- buf->append(STRING_WITH_LEN(" LINES TERMINATED BY "));
- pretty_print_str(buf, sql_ex.line_term, sql_ex.line_term_len);
- if (sql_ex.line_start_len)
- {
- buf->append(STRING_WITH_LEN(" STARTING BY "));
- pretty_print_str(buf, sql_ex.line_start, sql_ex.line_start_len);
- }
-
- if ((long) skip_lines > 0)
- {
- buf->append(STRING_WITH_LEN(" IGNORE "));
- buf->append_ulonglong(skip_lines);
- buf->append(STRING_WITH_LEN(" LINES "));
- }
-
- if (num_fields)
- {
- uint i;
- const char *field= fields;
- buf->append(STRING_WITH_LEN(" ("));
- for (i = 0; i < num_fields; i++)
- {
- if (i)
- {
- /*
- Yes, the space and comma is reversed here. But this is mostly dead
- code, at most used when reading really old binlogs from old servers,
- so better just leave it as is...
- */
- buf->append(STRING_WITH_LEN(" ,"));
- }
- append_identifier(thd, buf, field, field_lens[i]);
- field+= field_lens[i] + 1;
- }
- buf->append(STRING_WITH_LEN(")"));
- }
- return 0;
-}
-
-
-void Load_log_event::pack_info(Protocol *protocol)
-{
- char query_buffer[1024];
- String query_str(query_buffer, sizeof(query_buffer), system_charset_info);
-
- query_str.length(0);
- print_query(protocol->thd, TRUE, NULL, &query_str, 0, 0, NULL);
- protocol->store(query_str.ptr(), query_str.length(), &my_charset_bin);
-}
-#endif /* defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) */
-
-
-#ifndef MYSQL_CLIENT
-
-/*
- Load_log_event::write_data_header()
-*/
-
-bool Load_log_event::write_data_header()
-{
- char buf[LOAD_HEADER_LEN];
- int4store(buf + L_THREAD_ID_OFFSET, slave_proxy_id);
- int4store(buf + L_EXEC_TIME_OFFSET, exec_time);
- int4store(buf + L_SKIP_LINES_OFFSET, skip_lines);
- 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 write_data(buf, LOAD_HEADER_LEN) != 0;
-}
-
-
-/*
- Load_log_event::write_data_body()
-*/
-
-bool Load_log_event::write_data_body()
-{
- if (sql_ex.write_data(writer))
- return 1;
- if (num_fields && fields && field_lens)
- {
- if (write_data(field_lens, num_fields) ||
- write_data(fields, field_block_len))
- return 1;
- }
- return (write_data(table_name, table_name_len + 1) ||
- write_data(db, db_len + 1) ||
- write_data(fname, fname_len));
-}
-
-
-/*
- Load_log_event::Load_log_event()
-*/
-
-Load_log_event::Load_log_event(THD *thd_arg, const sql_exchange *ex,
- const char *db_arg, const char *table_name_arg,
- List<Item> &fields_arg,
- bool is_concurrent_arg,
- enum enum_duplicates handle_dup,
- bool ignore, bool using_trans)
- :Log_event(thd_arg,
- thd_arg->thread_specific_used ? LOG_EVENT_THREAD_SPECIFIC_F : 0,
- using_trans),
- thread_id(thd_arg->thread_id),
- slave_proxy_id((ulong)thd_arg->variables.pseudo_thread_id),
- num_fields(0),fields(0),
- field_lens(0),field_block_len(0),
- table_name(table_name_arg ? table_name_arg : ""),
- db(db_arg), fname(ex->file_name), local_fname(FALSE),
- is_concurrent(is_concurrent_arg)
-{
- time_t end_time;
- time(&end_time);
- exec_time = (ulong) (end_time - thd_arg->start_time);
- /* db can never be a zero pointer in 4.0 */
- db_len = (uint32) strlen(db);
- table_name_len = (uint32) strlen(table_name);
- fname_len = (fname) ? (uint) strlen(fname) : 0;
- sql_ex.field_term = ex->field_term->ptr();
- sql_ex.field_term_len = (uint8) ex->field_term->length();
- sql_ex.enclosed = ex->enclosed->ptr();
- sql_ex.enclosed_len = (uint8) ex->enclosed->length();
- sql_ex.line_term = ex->line_term->ptr();
- sql_ex.line_term_len = (uint8) ex->line_term->length();
- sql_ex.line_start = ex->line_start->ptr();
- sql_ex.line_start_len = (uint8) ex->line_start->length();
- sql_ex.escaped = ex->escaped->ptr();
- sql_ex.escaped_len = (uint8) ex->escaped->length();
- sql_ex.opt_flags = 0;
- sql_ex.cached_new_format = -1;
-
- if (ex->dumpfile)
- sql_ex.opt_flags|= DUMPFILE_FLAG;
- if (ex->opt_enclosed)
- sql_ex.opt_flags|= OPT_ENCLOSED_FLAG;
-
- sql_ex.empty_flags= 0;
-
- switch (handle_dup) {
- case DUP_REPLACE:
- sql_ex.opt_flags|= REPLACE_FLAG;
- break;
- case DUP_UPDATE: // Impossible here
- case DUP_ERROR:
- break;
- }
- if (ignore)
- sql_ex.opt_flags|= IGNORE_FLAG;
-
- if (!ex->field_term->length())
- sql_ex.empty_flags |= FIELD_TERM_EMPTY;
- if (!ex->enclosed->length())
- sql_ex.empty_flags |= ENCLOSED_EMPTY;
- if (!ex->line_term->length())
- sql_ex.empty_flags |= LINE_TERM_EMPTY;
- if (!ex->line_start->length())
- sql_ex.empty_flags |= LINE_START_EMPTY;
- if (!ex->escaped->length())
- sql_ex.empty_flags |= ESCAPED_EMPTY;
-
- skip_lines = ex->skip_lines;
-
- List_iterator<Item> li(fields_arg);
- field_lens_buf.length(0);
- fields_buf.length(0);
- Item* item;
- while ((item = li++))
- {
- num_fields++;
- uchar len= (uchar) item->name.length;
- field_block_len += len + 1;
- fields_buf.append(item->name.str, len + 1);
- field_lens_buf.append((char*)&len, 1);
- }
-
- field_lens = (const uchar*)field_lens_buf.ptr();
- fields = fields_buf.ptr();
-}
-#endif /* !MYSQL_CLIENT */
-
/**
@note
@@ -7162,531 +2481,10 @@ err:
}
-/*
- Load_log_event::print()
-*/
-
-#ifdef MYSQL_CLIENT
-bool Load_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
-{
- return print(file, print_event_info, 0);
-}
-
-
-bool Load_log_event::print(FILE* file_arg, PRINT_EVENT_INFO* print_event_info,
- bool commented)
-{
- Write_on_release_cache cache(&print_event_info->head_cache, file_arg);
- bool different_db= 1;
- DBUG_ENTER("Load_log_event::print");
-
- if (!print_event_info->short_form)
- {
- if (print_header(&cache, print_event_info, FALSE) ||
- my_b_printf(&cache, "\tQuery\tthread_id=%ld\texec_time=%ld\n",
- thread_id, exec_time))
- goto err;
- }
-
- if (db)
- {
- /*
- If the database is different from the one of the previous statement, we
- need to print the "use" command, and we update the last_db.
- But if commented, the "use" is going to be commented so we should not
- update the last_db.
- */
- if ((different_db= memcmp(print_event_info->db, db, db_len + 1)) &&
- !commented)
- memcpy(print_event_info->db, db, db_len + 1);
- }
-
- if (db && db[0] && different_db)
- if (my_b_printf(&cache, "%suse %`s%s\n",
- commented ? "# " : "",
- db, print_event_info->delimiter))
- goto err;
-
- if (flags & LOG_EVENT_THREAD_SPECIFIC_F)
- if (my_b_printf(&cache,"%sSET @@session.pseudo_thread_id=%lu%s\n",
- commented ? "# " : "", (ulong)thread_id,
- print_event_info->delimiter))
- goto err;
- if (my_b_printf(&cache, "%sLOAD DATA ",
- commented ? "# " : ""))
- goto err;
- if (check_fname_outside_temp_buf())
- if (my_b_write_string(&cache, "LOCAL "))
- goto err;
- if (my_b_printf(&cache, "INFILE '%-*s' ", fname_len, fname))
- goto err;
-
- if (sql_ex.opt_flags & REPLACE_FLAG)
- {
- if (my_b_write_string(&cache, "REPLACE "))
- goto err;
- }
- else if (sql_ex.opt_flags & IGNORE_FLAG)
- if (my_b_write_string(&cache, "IGNORE "))
- goto err;
-
- if (my_b_printf(&cache, "INTO TABLE `%s`", table_name) ||
- my_b_write_string(&cache, " FIELDS TERMINATED BY ") ||
- pretty_print_str(&cache, sql_ex.field_term, sql_ex.field_term_len))
- goto err;
-
- if (sql_ex.opt_flags & OPT_ENCLOSED_FLAG)
- if (my_b_write_string(&cache, " OPTIONALLY "))
- goto err;
- if (my_b_write_string(&cache, " ENCLOSED BY ") ||
- pretty_print_str(&cache, sql_ex.enclosed, sql_ex.enclosed_len) ||
- my_b_write_string(&cache, " ESCAPED BY ") ||
- pretty_print_str(&cache, sql_ex.escaped, sql_ex.escaped_len) ||
- my_b_write_string(&cache, " LINES TERMINATED BY ") ||
- pretty_print_str(&cache, sql_ex.line_term, sql_ex.line_term_len))
- goto err;
-
- if (sql_ex.line_start)
- {
- if (my_b_write_string(&cache," STARTING BY ") ||
- pretty_print_str(&cache, sql_ex.line_start, sql_ex.line_start_len))
- goto err;
- }
- if ((long) skip_lines > 0)
- if (my_b_printf(&cache, " IGNORE %ld LINES", (long) skip_lines))
- goto err;
-
- if (num_fields)
- {
- uint i;
- const char* field = fields;
- if (my_b_write_string(&cache, " ("))
- goto err;
- for (i = 0; i < num_fields; i++)
- {
- if (i)
- if (my_b_write_byte(&cache, ','))
- goto err;
- if (my_b_printf(&cache, "%`s", field))
- goto err;
- field += field_lens[i] + 1;
- }
- if (my_b_write_byte(&cache, ')'))
- goto err;
- }
-
- if (my_b_printf(&cache, "%s\n", print_event_info->delimiter))
- goto err;
- DBUG_RETURN(cache.flush_data());
-err:
- DBUG_RETURN(1);
-}
-#endif /* MYSQL_CLIENT */
-
-#ifndef MYSQL_CLIENT
-
-/**
- Load_log_event::set_fields()
-
- @note
- This function can not use the member variable
- for the database, since LOAD DATA INFILE on the slave
- can be for a different database than the current one.
- This is the reason for the affected_db argument to this method.
-*/
-
-void Load_log_event::set_fields(const char* affected_db,
- List<Item> &field_list,
- Name_resolution_context *context)
-{
- uint i;
- const char* field = fields;
- for (i= 0; i < num_fields; i++)
- {
- LEX_CSTRING field_name= {field, field_lens[i] };
- field_list.push_back(new (thd->mem_root)
- Item_field(thd, context, affected_db, table_name,
- &field_name),
- thd->mem_root);
- field+= field_lens[i] + 1;
- }
-}
-#endif /* !MYSQL_CLIENT */
-
-
-#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-/**
- Does the data loading job when executing a LOAD DATA on the slave.
-
- @param net
- @param rli
- @param use_rli_only_for_errors If set to 1, rli is provided to
- Load_log_event::exec_event only for this
- function to have RPL_LOG_NAME and
- rli->last_slave_error, both being used by
- error reports. rli's position advancing
- is skipped (done by the caller which is
- Execute_load_log_event::exec_event).
- If set to 0, rli is provided for full use,
- i.e. for error reports and position
- advancing.
-
- @todo
- fix this; this can be done by testing rules in
- Create_file_log_event::exec_event() and then discarding Append_block and
- al.
- @todo
- this is a bug - this needs to be moved to the I/O thread
-
- @retval
- 0 Success
- @retval
- 1 Failure
-*/
-
-int Load_log_event::do_apply_event(NET* net, rpl_group_info *rgi,
- bool use_rli_only_for_errors)
-{
- Relay_log_info const *rli= rgi->rli;
- Rpl_filter *rpl_filter= rli->mi->rpl_filter;
- DBUG_ENTER("Load_log_event::do_apply_event");
-
- DBUG_ASSERT(thd->query() == 0);
- set_thd_db(thd, rpl_filter, db, db_len);
- thd->clear_error(1);
-
- /* see Query_log_event::do_apply_event() and BUG#13360 */
- DBUG_ASSERT(!rgi->m_table_map.count());
- /*
- Usually lex_start() is called by mysql_parse(), but we need it here
- as the present method does not call mysql_parse().
- */
- lex_start(thd);
- thd->lex->local_file= local_fname;
- thd->reset_for_next_command(0); // Errors are cleared above
-
- /*
- We test replicate_*_db rules. Note that we have already prepared
- the file to load, even if we are going to ignore and delete it
- now. So it is possible that we did a lot of disk writes for
- nothing. In other words, a big LOAD DATA INFILE on the master will
- still consume a lot of space on the slave (space in the relay log
- + space of temp files: twice the space of the file to load...)
- even if it will finally be ignored. TODO: fix this; this can be
- done by testing rules in Create_file_log_event::do_apply_event()
- and then discarding Append_block and al. Another way is do the
- filtering in the I/O thread (more efficient: no disk writes at
- all).
-
-
- Note: We do not need to execute reset_one_shot_variables() if this
- db_ok() test fails.
- Reason: The db stored in binlog events is the same for SET and for
- its companion query. If the SET is ignored because of
- db_ok(), the companion query will also be ignored, and if
- the companion query is ignored in the db_ok() test of
- ::do_apply_event(), then the companion SET also have so
- we don't need to reset_one_shot_variables().
- */
- if (rpl_filter->db_ok(thd->db.str))
- {
- thd->set_time(when, when_sec_part);
- thd->set_query_id(next_query_id());
- thd->get_stmt_da()->opt_clear_warning_info(thd->query_id);
-
- TABLE_LIST tables;
- LEX_CSTRING db_name= { thd->strmake(thd->db.str, thd->db.length), thd->db.length };
- if (lower_case_table_names)
- my_casedn_str(system_charset_info, (char *)table_name);
- LEX_CSTRING tbl_name= { table_name, strlen(table_name) };
- tables.init_one_table(&db_name, &tbl_name, 0, TL_WRITE);
- tables.updating= 1;
-
- // the table will be opened in mysql_load
- if (rpl_filter->is_on() && !rpl_filter->tables_ok(thd->db.str, &tables))
- {
- // TODO: this is a bug - this needs to be moved to the I/O thread
- if (net)
- skip_load_data_infile(net);
- }
- else
- {
- enum enum_duplicates handle_dup;
- bool ignore= 0;
- char query_buffer[1024];
- String query_str(query_buffer, sizeof(query_buffer), system_charset_info);
- char *load_data_query;
-
- query_str.length(0);
- /*
- Forge LOAD DATA INFILE query which will be used in SHOW PROCESS LIST
- and written to slave's binlog if binlogging is on.
- */
- print_query(thd, FALSE, NULL, &query_str, NULL, NULL, NULL);
- if (!(load_data_query= (char *)thd->strmake(query_str.ptr(),
- query_str.length())))
- {
- /*
- This will set thd->fatal_error in case of OOM. So we surely will notice
- that something is wrong.
- */
- goto error;
- }
-
- thd->set_query(load_data_query, (uint) (query_str.length()));
-
- if (sql_ex.opt_flags & REPLACE_FLAG)
- handle_dup= DUP_REPLACE;
- else if (sql_ex.opt_flags & IGNORE_FLAG)
- {
- ignore= 1;
- handle_dup= DUP_ERROR;
- }
- else
- {
- /*
- When replication is running fine, if it was DUP_ERROR on the
- master then we could choose IGNORE here, because if DUP_ERROR
- suceeded on master, and data is identical on the master and slave,
- then there should be no uniqueness errors on slave, so IGNORE is
- the same as DUP_ERROR. But in the unlikely case of uniqueness errors
- (because the data on the master and slave happen to be different
- (user error or bug), we want LOAD DATA to print an error message on
- the slave to discover the problem.
-
- If reading from net (a 3.23 master), mysql_load() will change this
- to IGNORE.
- */
- handle_dup= DUP_ERROR;
- }
- /*
- We need to set thd->lex->sql_command and thd->lex->duplicates
- since InnoDB tests these variables to decide if this is a LOAD
- DATA ... REPLACE INTO ... statement even though mysql_parse()
- is not called. This is not needed in 5.0 since there the LOAD
- DATA ... statement is replicated using mysql_parse(), which
- sets the thd->lex fields correctly.
- */
- thd->lex->sql_command= SQLCOM_LOAD;
- thd->lex->duplicates= handle_dup;
-
- sql_exchange ex((char*)fname, sql_ex.opt_flags & DUMPFILE_FLAG);
- String field_term(sql_ex.field_term,sql_ex.field_term_len,log_cs);
- String enclosed(sql_ex.enclosed,sql_ex.enclosed_len,log_cs);
- String line_term(sql_ex.line_term,sql_ex.line_term_len,log_cs);
- String line_start(sql_ex.line_start,sql_ex.line_start_len,log_cs);
- String escaped(sql_ex.escaped,sql_ex.escaped_len, log_cs);
- ex.field_term= &field_term;
- ex.enclosed= &enclosed;
- ex.line_term= &line_term;
- ex.line_start= &line_start;
- ex.escaped= &escaped;
-
- ex.opt_enclosed = (sql_ex.opt_flags & OPT_ENCLOSED_FLAG);
- if (sql_ex.empty_flags & FIELD_TERM_EMPTY)
- ex.field_term->length(0);
-
- ex.skip_lines = skip_lines;
- List<Item> field_list;
- thd->lex->first_select_lex()->context.resolve_in_table_list_only(&tables);
- set_fields(tables.db.str,
- field_list, &thd->lex->first_select_lex()->context);
- thd->variables.pseudo_thread_id= thread_id;
- if (net)
- {
- // mysql_load will use thd->net to read the file
- thd->net.vio = net->vio;
- // Make sure the client does not get confused about the packet sequence
- thd->net.pkt_nr = net->pkt_nr;
- }
- /*
- It is safe to use tmp_list twice because we are not going to
- update it inside mysql_load().
- */
- List<Item> tmp_list;
- if (thd->open_temporary_tables(&tables) ||
- mysql_load(thd, &ex, &tables, field_list, tmp_list, tmp_list,
- handle_dup, ignore, net != 0))
- thd->is_slave_error= 1;
- if (thd->cuted_fields)
- {
- /* 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 %llu in log '%s' produced %ld "
- "warning(s). Default database: '%s'",
- (char*) table_name, log_pos, RPL_LOG_NAME,
- (ulong) thd->cuted_fields,
- thd->get_db());
- }
- if (net)
- net->pkt_nr= thd->net.pkt_nr;
- }
- }
- else
- {
- /*
- We will just ask the master to send us /dev/null if we do not
- want to load the data.
- TODO: this a bug - needs to be done in I/O thread
- */
- if (net)
- skip_load_data_infile(net);
- }
-
-error:
- thd->net.vio = 0;
- const char *remember_db= thd->get_db();
- thd->catalog= 0;
- thd->set_db(&null_clex_str); /* will free the current database */
- thd->reset_query();
- thd->get_stmt_da()->set_overwrite_status(true);
- thd->is_error() ? trans_rollback_stmt(thd) : trans_commit_stmt(thd);
- thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_GTID_BEGIN);
- thd->get_stmt_da()->set_overwrite_status(false);
- close_thread_tables(thd);
- /*
- - If transaction rollback was requested due to deadlock
- perform it and release metadata locks.
- - If inside a multi-statement transaction,
- defer the release of metadata locks until the current
- transaction is either committed or rolled back. This prevents
- other statements from modifying the table for the entire
- duration of this transaction. This provides commit ordering
- and guarantees serializability across multiple transactions.
- - If in autocommit mode, or outside a transactional context,
- automatically release metadata locks of the current statement.
- */
- if (thd->transaction_rollback_request)
- {
- trans_rollback_implicit(thd);
- thd->mdl_context.release_transactional_locks();
- }
- else if (! thd->in_multi_stmt_transaction_mode())
- thd->mdl_context.release_transactional_locks();
- else
- thd->mdl_context.release_statement_locks();
-
- DBUG_EXECUTE_IF("LOAD_DATA_INFILE_has_fatal_error",
- thd->is_slave_error= 0; thd->is_fatal_error= 1;);
-
- if (unlikely(thd->is_slave_error))
- {
- /* this err/sql_errno code is copy-paste from net_send_error() */
- const char *err;
- int sql_errno;
- if (thd->is_error())
- {
- err= thd->get_stmt_da()->message();
- sql_errno= thd->get_stmt_da()->sql_errno();
- }
- else
- {
- sql_errno=ER_UNKNOWN_ERROR;
- 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'",
- err, (char*)table_name, remember_db);
- free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
- DBUG_RETURN(1);
- }
- free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
-
- if (unlikely(thd->is_fatal_error))
- {
- char buf[256];
- my_snprintf(buf, sizeof(buf),
- "Running LOAD DATA INFILE on table '%-.64s'."
- " Default database: '%-.64s'",
- (char*)table_name,
- remember_db);
-
- rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, rgi->gtid_info(),
- ER_THD(thd, ER_SLAVE_FATAL_ERROR), buf);
- DBUG_RETURN(1);
- }
-
- DBUG_RETURN( use_rli_only_for_errors ? 0 : Log_event::do_apply_event(rgi) );
-}
-#endif
-
-
/**************************************************************************
Rotate_log_event methods
**************************************************************************/
-/*
- Rotate_log_event::pack_info()
-*/
-
-#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-void Rotate_log_event::pack_info(Protocol *protocol)
-{
- StringBuffer<256> tmp(log_cs);
- tmp.length(0);
- tmp.append(new_log_ident, ident_len);
- tmp.append(STRING_WITH_LEN(";pos="));
- tmp.append_ulonglong(pos);
- protocol->store(tmp.ptr(), tmp.length(), &my_charset_bin);
-}
-#endif
-
-
-/*
- Rotate_log_event::print()
-*/
-
-#ifdef MYSQL_CLIENT
-bool Rotate_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
-{
- if (print_event_info->short_form)
- return 0;
-
- char buf[22];
- Write_on_release_cache cache(&print_event_info->head_cache, file,
- Write_on_release_cache::FLUSH_F);
- if (print_header(&cache, print_event_info, FALSE) ||
- my_b_write_string(&cache, "\tRotate to "))
- goto err;
- if (new_log_ident)
- if (my_b_write(&cache, (uchar*) new_log_ident, (uint)ident_len))
- goto err;
- if (my_b_printf(&cache, " pos: %s\n", llstr(pos, buf)))
- goto err;
- return cache.flush_data();
-err:
- return 1;
-}
-#endif /* MYSQL_CLIENT */
-
-
-
-/*
- Rotate_log_event::Rotate_log_event() (2 constructors)
-*/
-
-
-#ifndef MYSQL_CLIENT
-Rotate_log_event::Rotate_log_event(const char* new_log_ident_arg,
- uint ident_len_arg, ulonglong pos_arg,
- uint flags_arg)
- :Log_event(), new_log_ident(new_log_ident_arg),
- pos(pos_arg),ident_len(ident_len_arg ? ident_len_arg :
- (uint) strlen(new_log_ident_arg)), flags(flags_arg)
-{
- DBUG_ENTER("Rotate_log_event::Rotate_log_event(...,flags)");
- 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));
- if (flags & RELAY_LOG)
- set_relay_log_event();
- DBUG_VOID_RETURN;
-}
-#endif
-
-
Rotate_log_event::Rotate_log_event(const char* buf, uint event_len,
const Format_description_log_event* description_event)
:Log_event(buf, description_event) ,new_log_ident(0), flags(DUP_NAME)
@@ -7708,191 +2506,10 @@ Rotate_log_event::Rotate_log_event(const char* buf, uint event_len,
}
-/*
- Rotate_log_event::write()
-*/
-
-#ifndef MYSQL_CLIENT
-bool Rotate_log_event::write()
-{
- char buf[ROTATE_HEADER_LEN];
- int8store(buf + R_POS_OFFSET, pos);
- 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
-
-
-#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-
-/*
- Got a rotate log event from the master.
-
- This is mainly used so that we can later figure out the logname and
- position for the master.
-
- We can't rotate the slave's BINlog as this will cause infinitive rotations
- in a A -> B -> A setup.
- The NOTES below is a wrong comment which will disappear when 4.1 is merged.
-
- This must only be called from the Slave SQL thread, since it calls
- Relay_log_info::flush().
-
- @retval
- 0 ok
- 1 error
-*/
-int Rotate_log_event::do_update_pos(rpl_group_info *rgi)
-{
- int error= 0;
- Relay_log_info *rli= rgi->rli;
- DBUG_ENTER("Rotate_log_event::do_update_pos");
-
- 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: %llu", this->pos));
-
- /*
- If we are in a transaction or in a group: the only normal case is
- when the I/O thread was copying a big transaction, then it was
- stopped and restarted: we have this in the relay log:
-
- BEGIN
- ...
- ROTATE (a fake one)
- ...
- COMMIT or ROLLBACK
-
- In that case, we don't want to touch the coordinates which
- correspond to the beginning of the transaction. Starting from
- 5.0.0, there also are some rotates from the slave itself, in the
- relay log, which shall not change the group positions.
-
- In parallel replication, rotate event is executed out-of-band with normal
- events, so we cannot update group_master_log_name or _pos here, it will
- be updated with the next normal event instead.
- */
- if ((server_id != global_system_variables.server_id ||
- rli->replicate_same_server_id) &&
- !is_relay_log_event() &&
- !rli->is_in_group() &&
- !rgi->is_parallel_exec)
- {
- mysql_mutex_lock(&rli->data_lock);
- DBUG_PRINT("info", ("old group_master_log_name: '%s' "
- "old group_master_log_pos: %lu",
- rli->group_master_log_name,
- (ulong) rli->group_master_log_pos));
- memcpy(rli->group_master_log_name, new_log_ident, ident_len+1);
- rli->notify_group_master_log_name_update();
- rli->inc_group_relay_log_pos(pos, rgi, TRUE /* skip_lock */);
- DBUG_PRINT("info", ("new group_master_log_name: '%s' "
- "new group_master_log_pos: %lu",
- rli->group_master_log_name,
- (ulong) rli->group_master_log_pos));
- mysql_mutex_unlock(&rli->data_lock);
- rpl_global_gtid_slave_state->record_and_update_gtid(thd, rgi);
- error= rli->flush();
-
- /*
- Reset thd->variables.option_bits and sql_mode etc, because this could
- be the signal of a master's downgrade from 5.0 to 4.0.
- However, no need to reset description_event_for_exec: indeed, if the next
- master is 5.0 (even 5.0.1) we will soon get a Format_desc; if the next
- master is 4.0 then the events are in the slave's format (conversion).
- */
- set_slave_thread_options(thd);
- set_slave_thread_default_charset(thd, rgi);
- thd->variables.sql_mode= global_system_variables.sql_mode;
- thd->variables.auto_increment_increment=
- thd->variables.auto_increment_offset= 1;
- }
- else
- rgi->inc_event_relay_log_pos();
-
- DBUG_RETURN(error);
-}
-
-
-Log_event::enum_skip_reason
-Rotate_log_event::do_shall_skip(rpl_group_info *rgi)
-{
- enum_skip_reason reason= Log_event::do_shall_skip(rgi);
-
- switch (reason) {
- case Log_event::EVENT_SKIP_NOT:
- case Log_event::EVENT_SKIP_COUNT:
- return Log_event::EVENT_SKIP_NOT;
-
- case Log_event::EVENT_SKIP_IGNORE:
- return Log_event::EVENT_SKIP_IGNORE;
- }
- DBUG_ASSERT(0);
- return Log_event::EVENT_SKIP_NOT; // To keep compiler happy
-}
-
-#endif
-
-
/**************************************************************************
Binlog_checkpoint_log_event methods
**************************************************************************/
-#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-void Binlog_checkpoint_log_event::pack_info(Protocol *protocol)
-{
- protocol->store(binlog_file_name, binlog_file_len, &my_charset_bin);
-}
-
-
-Log_event::enum_skip_reason
-Binlog_checkpoint_log_event::do_shall_skip(rpl_group_info *rgi)
-{
- enum_skip_reason reason= Log_event::do_shall_skip(rgi);
- if (reason == EVENT_SKIP_COUNT)
- reason= EVENT_SKIP_NOT;
- return reason;
-}
-#endif
-
-
-#ifdef MYSQL_CLIENT
-bool Binlog_checkpoint_log_event::print(FILE *file,
- PRINT_EVENT_INFO *print_event_info)
-{
- if (print_event_info->short_form)
- return 0;
-
- Write_on_release_cache cache(&print_event_info->head_cache, file,
- Write_on_release_cache::FLUSH_F);
-
- if (print_header(&cache, print_event_info, FALSE) ||
- my_b_write_string(&cache, "\tBinlog checkpoint ") ||
- my_b_write(&cache, (uchar*)binlog_file_name, binlog_file_len) ||
- my_b_write_byte(&cache, '\n'))
- return 1;
- return cache.flush_data();
-}
-#endif /* MYSQL_CLIENT */
-
-
-#ifdef MYSQL_SERVER
-Binlog_checkpoint_log_event::Binlog_checkpoint_log_event(
- const char *binlog_file_name_arg,
- uint binlog_file_len_arg)
- :Log_event(),
- binlog_file_name(my_strndup(binlog_file_name_arg, binlog_file_len_arg,
- MYF(MY_WME))),
- binlog_file_len(binlog_file_len_arg)
-{
- cache_type= EVENT_NO_CACHE;
-}
-#endif /* MYSQL_SERVER */
-
-
Binlog_checkpoint_log_event::Binlog_checkpoint_log_event(
const char *buf, uint event_len,
const Format_description_log_event *description_event)
@@ -7916,19 +2533,6 @@ Binlog_checkpoint_log_event::Binlog_checkpoint_log_event(
}
-#ifndef MYSQL_CLIENT
-bool Binlog_checkpoint_log_event::write()
-{
- uchar buf[BINLOG_CHECKPOINT_HEADER_LEN];
- int4store(buf, binlog_file_len);
- 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 */
-
-
/**************************************************************************
Global transaction ID stuff
**************************************************************************/
@@ -7962,333 +2566,6 @@ Gtid_log_event::Gtid_log_event(const char *buf, uint event_len,
}
-#ifdef MYSQL_SERVER
-
-Gtid_log_event::Gtid_log_event(THD *thd_arg, uint64 seq_no_arg,
- uint32 domain_id_arg, bool standalone,
- uint16 flags_arg, bool is_transactional,
- uint64 commit_id_arg)
- : Log_event(thd_arg, flags_arg, is_transactional),
- seq_no(seq_no_arg), commit_id(commit_id_arg), domain_id(domain_id_arg),
- flags2((standalone ? FL_STANDALONE : 0) | (commit_id_arg ? FL_GROUP_COMMIT_ID : 0))
-{
- cache_type= Log_event::EVENT_NO_CACHE;
- bool is_tmp_table= thd_arg->lex->stmt_accessed_temp_table();
- if (thd_arg->transaction.stmt.trans_did_wait() ||
- thd_arg->transaction.all.trans_did_wait())
- flags2|= FL_WAITED;
- if (thd_arg->transaction.stmt.trans_did_ddl() ||
- thd_arg->transaction.stmt.has_created_dropped_temp_table() ||
- thd_arg->transaction.all.trans_did_ddl() ||
- thd_arg->transaction.all.has_created_dropped_temp_table())
- flags2|= FL_DDL;
- else if (is_transactional && !is_tmp_table)
- flags2|= FL_TRANSACTIONAL;
- if (!(thd_arg->variables.option_bits & OPTION_RPL_SKIP_PARALLEL))
- flags2|= FL_ALLOW_PARALLEL;
- /* Preserve any DDL or WAITED flag in the slave's binlog. */
- if (thd_arg->rgi_slave)
- flags2|= (thd_arg->rgi_slave->gtid_ev_flags2 & (FL_DDL|FL_WAITED));
-}
-
-
-/*
- Used to record GTID while sending binlog to slave, without having to
- fully contruct every Gtid_log_event() needlessly.
-*/
-bool
-Gtid_log_event::peek(const char *event_start, size_t event_len,
- enum enum_binlog_checksum_alg checksum_alg,
- uint32 *domain_id, uint32 *server_id, uint64 *seq_no,
- uchar *flags2, const Format_description_log_event *fdev)
-{
- const char *p;
-
- if (checksum_alg == BINLOG_CHECKSUM_ALG_CRC32)
- {
- if (event_len > BINLOG_CHECKSUM_LEN)
- event_len-= BINLOG_CHECKSUM_LEN;
- else
- event_len= 0;
- }
- else
- DBUG_ASSERT(checksum_alg == BINLOG_CHECKSUM_ALG_UNDEF ||
- checksum_alg == BINLOG_CHECKSUM_ALG_OFF);
-
- if (event_len < (uint32)fdev->common_header_len + GTID_HEADER_LEN)
- return true;
- *server_id= uint4korr(event_start + SERVER_ID_OFFSET);
- p= event_start + fdev->common_header_len;
- *seq_no= uint8korr(p);
- p+= 8;
- *domain_id= uint4korr(p);
- p+= 4;
- *flags2= (uchar)*p;
- return false;
-}
-
-
-bool
-Gtid_log_event::write()
-{
- uchar buf[GTID_HEADER_LEN+2];
- size_t write_len;
-
- int8store(buf, seq_no);
- int4store(buf+8, domain_id);
- buf[12]= flags2;
- if (flags2 & FL_GROUP_COMMIT_ID)
- {
- int8store(buf+13, commit_id);
- write_len= GTID_HEADER_LEN + 2;
- }
- else
- {
- bzero(buf+13, GTID_HEADER_LEN-13);
- write_len= GTID_HEADER_LEN;
- }
- return write_header(write_len) ||
- write_data(buf, write_len) ||
- write_footer();
-}
-
-
-/*
- Replace a GTID event with either a BEGIN event, dummy event, or nothing, as
- appropriate to work with old slave that does not know global transaction id.
-
- The need_dummy_event argument is an IN/OUT argument. It is passed as TRUE
- if slave has capability lower than MARIA_SLAVE_CAPABILITY_TOLERATE_HOLES.
- It is returned TRUE if we return a BEGIN (or dummy) event to be sent to the
- slave, FALSE if event should be skipped completely.
-*/
-int
-Gtid_log_event::make_compatible_event(String *packet, bool *need_dummy_event,
- ulong ev_offset,
- enum enum_binlog_checksum_alg checksum_alg)
-{
- uchar flags2;
- if (packet->length() - ev_offset < LOG_EVENT_HEADER_LEN + GTID_HEADER_LEN)
- return 1;
- flags2= (*packet)[ev_offset + LOG_EVENT_HEADER_LEN + 12];
- if (flags2 & FL_STANDALONE)
- {
- if (*need_dummy_event)
- return Query_log_event::dummy_event(packet, ev_offset, checksum_alg);
- return 0;
- }
-
- *need_dummy_event= true;
- return Query_log_event::begin_event(packet, ev_offset, checksum_alg);
-}
-
-
-#ifdef HAVE_REPLICATION
-void
-Gtid_log_event::pack_info(Protocol *protocol)
-{
- char buf[6+5+10+1+10+1+20+1+4+20+1];
- char *p;
- p = strmov(buf, (flags2 & FL_STANDALONE ? "GTID " : "BEGIN GTID "));
- p= longlong10_to_str(domain_id, p, 10);
- *p++= '-';
- p= longlong10_to_str(server_id, p, 10);
- *p++= '-';
- p= longlong10_to_str(seq_no, p, 10);
- if (flags2 & FL_GROUP_COMMIT_ID)
- {
- p= strmov(p, " cid=");
- p= longlong10_to_str(commit_id, p, 10);
- }
-
- protocol->store(buf, p-buf, &my_charset_bin);
-}
-
-static char gtid_begin_string[] = "BEGIN";
-
-int
-Gtid_log_event::do_apply_event(rpl_group_info *rgi)
-{
- ulonglong bits= thd->variables.option_bits;
- thd->variables.server_id= this->server_id;
- thd->variables.gtid_domain_id= this->domain_id;
- thd->variables.gtid_seq_no= this->seq_no;
- rgi->gtid_ev_flags2= flags2;
- thd->reset_for_next_command();
-
- if (opt_gtid_strict_mode && opt_bin_log && opt_log_slave_updates)
- {
- if (mysql_bin_log.check_strict_gtid_sequence(this->domain_id,
- this->server_id, this->seq_no))
- return 1;
- }
-
- DBUG_ASSERT((bits & OPTION_GTID_BEGIN) == 0);
-
- Master_info *mi=rgi->rli->mi;
- switch (flags2 & (FL_DDL | FL_TRANSACTIONAL))
- {
- case FL_TRANSACTIONAL:
- mi->total_trans_groups++;
- break;
- case FL_DDL:
- mi->total_ddl_groups++;
- break;
- default:
- mi->total_non_trans_groups++;
- }
-
- if (flags2 & FL_STANDALONE)
- return 0;
-
- /* Execute this like a BEGIN query event. */
- bits|= OPTION_GTID_BEGIN;
- if (flags2 & FL_ALLOW_PARALLEL)
- bits&= ~(ulonglong)OPTION_RPL_SKIP_PARALLEL;
- else
- bits|= (ulonglong)OPTION_RPL_SKIP_PARALLEL;
- thd->variables.option_bits= bits;
- DBUG_PRINT("info", ("Set OPTION_GTID_BEGIN"));
- thd->set_query_and_id(gtid_begin_string, sizeof(gtid_begin_string)-1,
- &my_charset_bin, next_query_id());
- thd->lex->sql_command= SQLCOM_BEGIN;
- thd->is_slave_error= 0;
- status_var_increment(thd->status_var.com_stat[thd->lex->sql_command]);
- if (trans_begin(thd, 0))
- {
- DBUG_PRINT("error", ("trans_begin() failed"));
- thd->is_slave_error= 1;
- }
- thd->update_stats();
-
- if (likely(!thd->is_slave_error))
- general_log_write(thd, COM_QUERY, thd->query(), thd->query_length());
-
- thd->reset_query();
- free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
- return thd->is_slave_error;
-}
-
-
-int
-Gtid_log_event::do_update_pos(rpl_group_info *rgi)
-{
- rgi->inc_event_relay_log_pos();
- return 0;
-}
-
-
-Log_event::enum_skip_reason
-Gtid_log_event::do_shall_skip(rpl_group_info *rgi)
-{
- Relay_log_info *rli= rgi->rli;
- /*
- An event skipped due to @@skip_replication must not be counted towards the
- number of events to be skipped due to @@sql_slave_skip_counter.
- */
- if (flags & LOG_EVENT_SKIP_REPLICATION_F &&
- opt_replicate_events_marked_for_skip != RPL_SKIP_REPLICATE)
- return Log_event::EVENT_SKIP_IGNORE;
-
- if (rli->slave_skip_counter > 0)
- {
- if (!(flags2 & FL_STANDALONE))
- {
- thd->variables.option_bits|= OPTION_BEGIN;
- DBUG_ASSERT(rgi->rli->get_flag(Relay_log_info::IN_TRANSACTION));
- }
- return Log_event::continue_group(rgi);
- }
- return Log_event::do_shall_skip(rgi);
-}
-
-
-#endif /* HAVE_REPLICATION */
-
-#else /* !MYSQL_SERVER */
-
-bool
-Gtid_log_event::print(FILE *file, PRINT_EVENT_INFO *print_event_info)
-{
- Write_on_release_cache cache(&print_event_info->head_cache, file,
- Write_on_release_cache::FLUSH_F, this);
- char buf[21];
- char buf2[21];
-
- if (!print_event_info->short_form && !is_flashback)
- {
- print_header(&cache, print_event_info, FALSE);
- longlong10_to_str(seq_no, buf, 10);
- if (my_b_printf(&cache, "\tGTID %u-%u-%s", domain_id, server_id, buf))
- goto err;
- if (flags2 & FL_GROUP_COMMIT_ID)
- {
- longlong10_to_str(commit_id, buf2, 10);
- if (my_b_printf(&cache, " cid=%s", buf2))
- goto err;
- }
- if (flags2 & FL_DDL)
- if (my_b_write_string(&cache, " ddl"))
- goto err;
- if (flags2 & FL_TRANSACTIONAL)
- if (my_b_write_string(&cache, " trans"))
- goto err;
- if (flags2 & FL_WAITED)
- if (my_b_write_string(&cache, " waited"))
- goto err;
- if (my_b_printf(&cache, "\n"))
- goto err;
-
- if (!print_event_info->allow_parallel_printed ||
- print_event_info->allow_parallel != !!(flags2 & FL_ALLOW_PARALLEL))
- {
- if (my_b_printf(&cache,
- "/*!100101 SET @@session.skip_parallel_replication=%u*/%s\n",
- !(flags2 & FL_ALLOW_PARALLEL),
- print_event_info->delimiter))
- goto err;
- print_event_info->allow_parallel= !!(flags2 & FL_ALLOW_PARALLEL);
- print_event_info->allow_parallel_printed= true;
- }
-
- if (!print_event_info->domain_id_printed ||
- print_event_info->domain_id != domain_id)
- {
- if (my_b_printf(&cache,
- "/*!100001 SET @@session.gtid_domain_id=%u*/%s\n",
- domain_id, print_event_info->delimiter))
- goto err;
- print_event_info->domain_id= domain_id;
- print_event_info->domain_id_printed= true;
- }
-
- if (!print_event_info->server_id_printed ||
- print_event_info->server_id != server_id)
- {
- if (my_b_printf(&cache, "/*!100001 SET @@session.server_id=%u*/%s\n",
- server_id, print_event_info->delimiter))
- goto err;
- print_event_info->server_id= server_id;
- print_event_info->server_id_printed= true;
- }
-
- if (!is_flashback)
- if (my_b_printf(&cache, "/*!100001 SET @@session.gtid_seq_no=%s*/%s\n",
- buf, print_event_info->delimiter))
- goto err;
- }
- if (!(flags2 & FL_STANDALONE))
- if (my_b_printf(&cache, is_flashback ? "COMMIT\n%s\n" : "BEGIN\n%s\n", print_event_info->delimiter))
- goto err;
-
- return cache.flush_data();
-err:
- return 1;
-}
-
-#endif /* MYSQL_SERVER */
-
-
/* GTID list. */
Gtid_list_log_event::Gtid_list_log_event(const char *buf, uint event_len,
@@ -8350,213 +2627,6 @@ Gtid_list_log_event::Gtid_list_log_event(const char *buf, uint event_len,
}
-#ifdef MYSQL_SERVER
-
-Gtid_list_log_event::Gtid_list_log_event(rpl_binlog_state *gtid_set,
- uint32 gl_flags_)
- : count(gtid_set->count()), gl_flags(gl_flags_), list(0), sub_id_list(0)
-{
- cache_type= EVENT_NO_CACHE;
- /* Failure to allocate memory will be caught by is_valid() returning false. */
- if (count < (1<<28) &&
- (list = (rpl_gtid *)my_malloc(count * sizeof(*list) + (count == 0),
- MYF(MY_WME))))
- gtid_set->get_gtid_list(list, count);
-}
-
-
-Gtid_list_log_event::Gtid_list_log_event(slave_connection_state *gtid_set,
- uint32 gl_flags_)
- : count(gtid_set->count()), gl_flags(gl_flags_), list(0), sub_id_list(0)
-{
- cache_type= EVENT_NO_CACHE;
- /* Failure to allocate memory will be caught by is_valid() returning false. */
- if (count < (1<<28) &&
- (list = (rpl_gtid *)my_malloc(count * sizeof(*list) + (count == 0),
- MYF(MY_WME))))
- {
- gtid_set->get_gtid_list(list, count);
-#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
- if (gl_flags & FLAG_IGN_GTIDS)
- {
- uint32 i;
-
- if (!(sub_id_list= (uint64 *)my_malloc(count * sizeof(uint64),
- MYF(MY_WME))))
- {
- my_free(list);
- list= NULL;
- return;
- }
- for (i= 0; i < count; ++i)
- {
- if (!(sub_id_list[i]=
- rpl_global_gtid_slave_state->next_sub_id(list[i].domain_id)))
- {
- my_free(list);
- my_free(sub_id_list);
- list= NULL;
- sub_id_list= NULL;
- return;
- }
- }
- }
-#endif
- }
-}
-
-
-#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-bool
-Gtid_list_log_event::to_packet(String *packet)
-{
- uint32 i;
- uchar *p;
- uint32 needed_length;
-
- DBUG_ASSERT(count < 1<<28);
-
- needed_length= packet->length() + get_data_size();
- if (packet->reserve(needed_length))
- return true;
- p= (uchar *)packet->ptr() + packet->length();;
- packet->length(needed_length);
- int4store(p, (count & ((1<<28)-1)) | gl_flags);
- p += 4;
- /* Initialise the padding for empty Gtid_list. */
- if (count == 0)
- int2store(p, 0);
- for (i= 0; i < count; ++i)
- {
- int4store(p, list[i].domain_id);
- int4store(p+4, list[i].server_id);
- int8store(p+8, list[i].seq_no);
- p += 16;
- }
-
- return false;
-}
-
-
-bool
-Gtid_list_log_event::write()
-{
- char buf[128];
- String packet(buf, sizeof(buf), system_charset_info);
-
- packet.length(0);
- if (to_packet(&packet))
- return true;
- return write_header(get_data_size()) ||
- write_data(packet.ptr(), packet.length()) ||
- write_footer();
-}
-
-
-int
-Gtid_list_log_event::do_apply_event(rpl_group_info *rgi)
-{
- Relay_log_info *rli= const_cast<Relay_log_info*>(rgi->rli);
- int ret;
- if (gl_flags & FLAG_IGN_GTIDS)
- {
- void *hton= NULL;
- uint32 i;
-
- for (i= 0; i < count; ++i)
- {
- if ((ret= rpl_global_gtid_slave_state->record_gtid(thd, &list[i],
- sub_id_list[i],
- false, false, &hton)))
- return ret;
- rpl_global_gtid_slave_state->update_state_hash(sub_id_list[i], &list[i],
- hton, NULL);
- }
- }
- ret= Log_event::do_apply_event(rgi);
- if (rli->until_condition == Relay_log_info::UNTIL_GTID &&
- (gl_flags & FLAG_UNTIL_REACHED))
- {
- char str_buf[128];
- String str(str_buf, sizeof(str_buf), system_charset_info);
- rli->until_gtid_pos.to_string(&str);
- sql_print_information("Slave SQL thread stops because it reached its"
- " UNTIL master_gtid_pos %s", str.c_ptr_safe());
- rli->abort_slave= true;
- rli->stop_for_until= true;
- }
- free_root(thd->mem_root, MYF(MY_KEEP_PREALLOC));
- return ret;
-}
-
-
-Log_event::enum_skip_reason
-Gtid_list_log_event::do_shall_skip(rpl_group_info *rgi)
-{
- enum_skip_reason reason= Log_event::do_shall_skip(rgi);
- if (reason == EVENT_SKIP_COUNT)
- reason= EVENT_SKIP_NOT;
- return reason;
-}
-
-
-void
-Gtid_list_log_event::pack_info(Protocol *protocol)
-{
- char buf_mem[1024];
- String buf(buf_mem, sizeof(buf_mem), system_charset_info);
- uint32 i;
- bool first;
-
- buf.length(0);
- buf.append(STRING_WITH_LEN("["));
- first= true;
- for (i= 0; i < count; ++i)
- rpl_slave_state_tostring_helper(&buf, &list[i], &first);
- buf.append(STRING_WITH_LEN("]"));
-
- protocol->store(&buf);
-}
-#endif /* HAVE_REPLICATION */
-
-#else /* !MYSQL_SERVER */
-
-bool
-Gtid_list_log_event::print(FILE *file, PRINT_EVENT_INFO *print_event_info)
-{
- if (print_event_info->short_form)
- return 0;
-
- Write_on_release_cache cache(&print_event_info->head_cache, file,
- Write_on_release_cache::FLUSH_F);
- char buf[21];
- uint32 i;
-
- if (print_header(&cache, print_event_info, FALSE) ||
- my_b_printf(&cache, "\tGtid list ["))
- goto err;
-
- for (i= 0; i < count; ++i)
- {
- longlong10_to_str(list[i].seq_no, buf, 10);
- if (my_b_printf(&cache, "%u-%u-%s", list[i].domain_id,
- list[i].server_id, buf))
- goto err;
- if (i < count-1)
- if (my_b_printf(&cache, ",\n# "))
- goto err;
- }
- if (my_b_printf(&cache, "]\n"))
- goto err;
-
- return cache.flush_data();
-err:
- return 1;
-}
-
-#endif /* MYSQL_SERVER */
-
-
/*
Used to record gtid_list event while sending binlog to slave, without having to
fully contruct the event object.
@@ -8616,22 +2686,6 @@ Gtid_list_log_event::peek(const char *event_start, size_t event_len,
**************************************************************************/
/*
- Intvar_log_event::pack_info()
-*/
-
-#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-void Intvar_log_event::pack_info(Protocol *protocol)
-{
- char buf[256], *pos;
- pos= strmake(buf, get_var_type_name(), sizeof(buf)-23);
- *pos++= '=';
- pos= longlong10_to_str(val, pos, -10);
- protocol->store(buf, (uint) (pos-buf), &my_charset_bin);
-}
-#endif
-
-
-/*
Intvar_log_event::Intvar_log_event()
*/
@@ -8661,135 +2715,10 @@ const char* Intvar_log_event::get_var_type_name()
}
-/*
- Intvar_log_event::write()
-*/
-
-#ifndef MYSQL_CLIENT
-bool Intvar_log_event::write()
-{
- uchar buf[9];
- buf[I_TYPE_OFFSET]= (uchar) type;
- int8store(buf + I_VAL_OFFSET, val);
- return write_header(sizeof(buf)) ||
- write_data(buf, sizeof(buf)) ||
- write_footer();
-}
-#endif
-
-
-/*
- Intvar_log_event::print()
-*/
-
-#ifdef MYSQL_CLIENT
-bool Intvar_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
-{
- char llbuff[22];
- const char *UNINIT_VAR(msg);
- Write_on_release_cache cache(&print_event_info->head_cache, file,
- Write_on_release_cache::FLUSH_F);
-
- if (!print_event_info->short_form)
- {
- if (print_header(&cache, print_event_info, FALSE) ||
- my_b_write_string(&cache, "\tIntvar\n"))
- goto err;
- }
-
- if (my_b_printf(&cache, "SET "))
- goto err;
- switch (type) {
- case LAST_INSERT_ID_EVENT:
- msg="LAST_INSERT_ID";
- break;
- case INSERT_ID_EVENT:
- msg="INSERT_ID";
- break;
- case INVALID_INT_EVENT:
- default: // cannot happen
- msg="INVALID_INT";
- break;
- }
- if (my_b_printf(&cache, "%s=%s%s\n",
- msg, llstr(val,llbuff), print_event_info->delimiter))
- goto err;
-
- return cache.flush_data();
-err:
- return 1;
-}
-#endif
-
-
-#if defined(HAVE_REPLICATION)&& !defined(MYSQL_CLIENT)
-
-/*
- Intvar_log_event::do_apply_event()
-*/
-
-int Intvar_log_event::do_apply_event(rpl_group_info *rgi)
-{
- DBUG_ENTER("Intvar_log_event::do_apply_event");
- if (rgi->deferred_events_collecting)
- {
- DBUG_PRINT("info",("deferring event"));
- DBUG_RETURN(rgi->deferred_events->add(this));
- }
-
- switch (type) {
- case LAST_INSERT_ID_EVENT:
- thd->first_successful_insert_id_in_prev_stmt= val;
- DBUG_PRINT("info",("last_insert_id_event: %ld", (long) val));
- break;
- case INSERT_ID_EVENT:
- thd->force_one_auto_inc_interval(val);
- break;
- }
- DBUG_RETURN(0);
-}
-
-int Intvar_log_event::do_update_pos(rpl_group_info *rgi)
-{
- rgi->inc_event_relay_log_pos();
- return 0;
-}
-
-
-Log_event::enum_skip_reason
-Intvar_log_event::do_shall_skip(rpl_group_info *rgi)
-{
- /*
- It is a common error to set the slave skip counter to 1 instead of
- 2 when recovering from an insert which used a auto increment,
- rand, or user var. Therefore, if the slave skip counter is 1, we
- just say that this event should be skipped by ignoring it, meaning
- that we do not change the value of the slave skip counter since it
- will be decreased by the following insert event.
- */
- return continue_group(rgi);
-}
-
-#endif
-
-
/**************************************************************************
Rand_log_event methods
**************************************************************************/
-#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-void Rand_log_event::pack_info(Protocol *protocol)
-{
- char buf1[256], *pos;
- pos= strmov(buf1,"rand_seed1=");
- pos= int10_to_str((long) seed1, pos, 10);
- pos= strmov(pos, ",rand_seed2=");
- pos= int10_to_str((long) seed2, pos, 10);
- protocol->store(buf1, (uint) (pos-buf1), &my_charset_bin);
-}
-#endif
-
-
Rand_log_event::Rand_log_event(const char* buf,
const Format_description_log_event* description_event)
:Log_event(buf, description_event)
@@ -8802,118 +2731,10 @@ Rand_log_event::Rand_log_event(const char* buf,
}
-#ifndef MYSQL_CLIENT
-bool Rand_log_event::write()
-{
- uchar buf[16];
- int8store(buf + RAND_SEED1_OFFSET, seed1);
- int8store(buf + RAND_SEED2_OFFSET, seed2);
- return write_header(sizeof(buf)) ||
- write_data(buf, sizeof(buf)) ||
- write_footer();
-}
-#endif
-
-
-#ifdef MYSQL_CLIENT
-bool Rand_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
-{
- Write_on_release_cache cache(&print_event_info->head_cache, file,
- Write_on_release_cache::FLUSH_F);
-
- char llbuff[22],llbuff2[22];
- if (!print_event_info->short_form)
- {
- if (print_header(&cache, print_event_info, FALSE) ||
- my_b_write_string(&cache, "\tRand\n"))
- goto err;
- }
- if (my_b_printf(&cache, "SET @@RAND_SEED1=%s, @@RAND_SEED2=%s%s\n",
- llstr(seed1, llbuff),llstr(seed2, llbuff2),
- print_event_info->delimiter))
- goto err;
-
- return cache.flush_data();
-err:
- return 1;
-}
-#endif /* MYSQL_CLIENT */
-
-
-#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-int Rand_log_event::do_apply_event(rpl_group_info *rgi)
-{
- if (rgi->deferred_events_collecting)
- return rgi->deferred_events->add(this);
-
- thd->rand.seed1= (ulong) seed1;
- thd->rand.seed2= (ulong) seed2;
- return 0;
-}
-
-int Rand_log_event::do_update_pos(rpl_group_info *rgi)
-{
- rgi->inc_event_relay_log_pos();
- return 0;
-}
-
-
-Log_event::enum_skip_reason
-Rand_log_event::do_shall_skip(rpl_group_info *rgi)
-{
- /*
- It is a common error to set the slave skip counter to 1 instead of
- 2 when recovering from an insert which used a auto increment,
- rand, or user var. Therefore, if the slave skip counter is 1, we
- just say that this event should be skipped by ignoring it, meaning
- that we do not change the value of the slave skip counter since it
- will be decreased by the following insert event.
- */
- return continue_group(rgi);
-}
-
-/**
- Exec deferred Int-, Rand- and User- var events prefixing
- a Query-log-event event.
-
- @param thd THD handle
-
- @return false on success, true if a failure in an event applying occurred.
-*/
-bool slave_execute_deferred_events(THD *thd)
-{
- bool res= false;
- rpl_group_info *rgi= thd->rgi_slave;
-
- DBUG_ASSERT(rgi && (!rgi->deferred_events_collecting || rgi->deferred_events));
-
- if (!rgi->deferred_events_collecting || rgi->deferred_events->is_empty())
- return res;
-
- res= rgi->deferred_events->execute(rgi);
- rgi->deferred_events->rewind();
-
- return res;
-}
-
-#endif /* !MYSQL_CLIENT */
-
-
/**************************************************************************
Xid_log_event methods
**************************************************************************/
-#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-void Xid_log_event::pack_info(Protocol *protocol)
-{
- char buf[128], *pos;
- pos= strmov(buf, "COMMIT /* xid=");
- pos= longlong10_to_str(xid, pos, 10);
- pos= strmov(pos, " */");
- protocol->store(buf, (uint) (pos-buf), &my_charset_bin);
-}
-#endif
-
/**
@note
It's ok not to use int8store here,
@@ -8935,266 +2756,10 @@ Xid_log_event(const char* buf,
}
-#ifndef MYSQL_CLIENT
-bool Xid_log_event::write()
-{
- DBUG_EXECUTE_IF("do_not_write_xid", return 0;);
- return write_header(sizeof(xid)) ||
- write_data((uchar*)&xid, sizeof(xid)) ||
- write_footer();
-}
-#endif
-
-
-#ifdef MYSQL_CLIENT
-bool Xid_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
-{
- Write_on_release_cache cache(&print_event_info->head_cache, file,
- Write_on_release_cache::FLUSH_F, this);
-
- if (!print_event_info->short_form)
- {
- char buf[64];
- longlong10_to_str(xid, buf, 10);
-
- if (print_header(&cache, print_event_info, FALSE) ||
- my_b_printf(&cache, "\tXid = %s\n", buf))
- goto err;
- }
- if (my_b_printf(&cache, is_flashback ? "BEGIN%s\n" : "COMMIT%s\n",
- print_event_info->delimiter))
- goto err;
-
- return cache.flush_data();
-err:
- return 1;
-}
-#endif /* MYSQL_CLIENT */
-
-
-#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-int Xid_log_event::do_apply_event(rpl_group_info *rgi)
-{
- bool res;
- int err;
- rpl_gtid gtid;
- uint64 sub_id= 0;
- Relay_log_info const *rli= rgi->rli;
- void *hton= NULL;
-
- /*
- XID_EVENT works like a COMMIT statement. And it also updates the
- mysql.gtid_slave_pos table with the GTID of the current transaction.
-
- Therefore, it acts much like a normal SQL statement, so we need to do
- THD::reset_for_next_command() as if starting a new statement.
- */
- thd->reset_for_next_command();
- /*
- Record any GTID in the same transaction, so slave state is transactionally
- consistent.
- */
-#ifdef WITH_WSREP
- thd->wsrep_affected_rows= 0;
-#endif
-
- if (rgi->gtid_pending)
- {
- sub_id= rgi->gtid_sub_id;
- rgi->gtid_pending= false;
-
- gtid= rgi->current_gtid;
- err= rpl_global_gtid_slave_state->record_gtid(thd, &gtid, sub_id, true,
- false, &hton);
- if (unlikely(err))
- {
- int ec= thd->get_stmt_da()->sql_errno();
- /*
- Do not report an error if this is really a kill due to a deadlock.
- In this case, the transaction will be re-tried instead.
- */
- if (!is_parallel_retry_error(rgi, ec))
- rli->report(ERROR_LEVEL, ER_CANNOT_UPDATE_GTID_STATE, rgi->gtid_info(),
- "Error during XID COMMIT: failed to update GTID state in "
- "%s.%s: %d: %s",
- "mysql", rpl_gtid_slave_state_table_name.str, ec,
- thd->get_stmt_da()->message());
- thd->is_slave_error= 1;
- return err;
- }
-
- DBUG_EXECUTE_IF("gtid_fail_after_record_gtid",
- { my_error(ER_ERROR_DURING_COMMIT, MYF(0), HA_ERR_WRONG_COMMAND);
- thd->is_slave_error= 1;
- return 1;
- });
- }
-
- /* For a slave Xid_log_event is COMMIT */
- general_log_print(thd, COM_QUERY,
- "COMMIT /* implicit, from Xid_log_event */");
- thd->variables.option_bits&= ~OPTION_GTID_BEGIN;
- res= trans_commit(thd); /* Automatically rolls back on error. */
- thd->mdl_context.release_transactional_locks();
-
- if (likely(!res) && sub_id)
- rpl_global_gtid_slave_state->update_state_hash(sub_id, &gtid, hton, rgi);
-
- /*
- Increment the global status commit count variable
- */
- status_var_increment(thd->status_var.com_stat[SQLCOM_COMMIT]);
-
- return res;
-}
-
-Log_event::enum_skip_reason
-Xid_log_event::do_shall_skip(rpl_group_info *rgi)
-{
- DBUG_ENTER("Xid_log_event::do_shall_skip");
- if (rgi->rli->slave_skip_counter > 0)
- {
- DBUG_ASSERT(!rgi->rli->get_flag(Relay_log_info::IN_TRANSACTION));
- thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_GTID_BEGIN);
- DBUG_RETURN(Log_event::EVENT_SKIP_COUNT);
- }
-#ifdef WITH_WSREP
- else if (wsrep_mysql_replication_bundle && WSREP_ON &&
- opt_slave_domain_parallel_threads == 0)
- {
- if (++thd->wsrep_mysql_replicated < (int)wsrep_mysql_replication_bundle)
- {
- WSREP_DEBUG("skipping wsrep commit %d", thd->wsrep_mysql_replicated);
- DBUG_RETURN(Log_event::EVENT_SKIP_IGNORE);
- }
- else
- {
- thd->wsrep_mysql_replicated = 0;
- }
- }
-#endif
- DBUG_RETURN(Log_event::do_shall_skip(rgi));
-}
-#endif /* !MYSQL_CLIENT */
-
-
/**************************************************************************
User_var_log_event methods
**************************************************************************/
-#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-static bool
-user_var_append_name_part(THD *thd, String *buf,
- const char *name, size_t name_len)
-{
- return buf->append("@") ||
- append_identifier(thd, buf, name, name_len) ||
- buf->append("=");
-}
-
-void User_var_log_event::pack_info(Protocol* protocol)
-{
- if (is_null)
- {
- char buf_mem[FN_REFLEN+7];
- String buf(buf_mem, sizeof(buf_mem), system_charset_info);
- buf.length(0);
- if (user_var_append_name_part(protocol->thd, &buf, name, name_len) ||
- buf.append("NULL"))
- return;
- protocol->store(buf.ptr(), buf.length(), &my_charset_bin);
- }
- else
- {
- switch (type) {
- case REAL_RESULT:
- {
- double real_val;
- char buf2[MY_GCVT_MAX_FIELD_WIDTH+1];
- char buf_mem[FN_REFLEN + MY_GCVT_MAX_FIELD_WIDTH + 1];
- String buf(buf_mem, sizeof(buf_mem), system_charset_info);
- float8get(real_val, val);
- buf.length(0);
- if (user_var_append_name_part(protocol->thd, &buf, name, name_len) ||
- buf.append(buf2, my_gcvt(real_val, MY_GCVT_ARG_DOUBLE,
- MY_GCVT_MAX_FIELD_WIDTH, buf2, NULL)))
- return;
- protocol->store(buf.ptr(), buf.length(), &my_charset_bin);
- break;
- }
- case INT_RESULT:
- {
- char buf2[22];
- char buf_mem[FN_REFLEN + 22];
- String buf(buf_mem, sizeof(buf_mem), system_charset_info);
- buf.length(0);
- if (user_var_append_name_part(protocol->thd, &buf, name, name_len) ||
- buf.append(buf2,
- longlong10_to_str(uint8korr(val), buf2,
- ((flags & User_var_log_event::UNSIGNED_F) ? 10 : -10))-buf2))
- return;
- protocol->store(buf.ptr(), buf.length(), &my_charset_bin);
- break;
- }
- case DECIMAL_RESULT:
- {
- char buf_mem[FN_REFLEN + DECIMAL_MAX_STR_LENGTH];
- String buf(buf_mem, sizeof(buf_mem), system_charset_info);
- char buf2[DECIMAL_MAX_STR_LENGTH+1];
- String str(buf2, sizeof(buf2), &my_charset_bin);
- buf.length(0);
- my_decimal((const uchar *) (val + 2), val[0], val[1]).to_string(&str);
- if (user_var_append_name_part(protocol->thd, &buf, name, name_len) ||
- buf.append(buf2))
- return;
- protocol->store(buf.ptr(), buf.length(), &my_charset_bin);
- break;
- }
- case STRING_RESULT:
- {
- /* 15 is for 'COLLATE' and other chars */
- char buf_mem[FN_REFLEN + 512 + 1 + 2*MY_CS_NAME_SIZE+15];
- String buf(buf_mem, sizeof(buf_mem), system_charset_info);
- CHARSET_INFO *cs;
- buf.length(0);
- if (!(cs= get_charset(charset_number, MYF(0))))
- {
- if (buf.append("???"))
- return;
- }
- else
- {
- size_t old_len;
- char *beg, *end;
- if (user_var_append_name_part(protocol->thd, &buf, name, name_len) ||
- buf.append("_") ||
- buf.append(cs->csname) ||
- buf.append(" "))
- return;
- old_len= buf.length();
- if (buf.reserve(old_len + val_len * 2 + 3 + sizeof(" COLLATE ") +
- MY_CS_NAME_SIZE))
- return;
- beg= const_cast<char *>(buf.ptr()) + old_len;
- end= str_to_hex(beg, val, val_len);
- buf.length(old_len + (end - beg));
- if (buf.append(" COLLATE ") ||
- buf.append(cs->name))
- return;
- }
- protocol->store(buf.ptr(), buf.length(), &my_charset_bin);
- break;
- }
- case ROW_RESULT:
- default:
- DBUG_ASSERT(0);
- return;
- }
- }
-}
-#endif /* !MYSQL_CLIENT */
-
-
User_var_log_event::
User_var_log_event(const char* buf, uint event_len,
const Format_description_log_event* description_event)
@@ -9282,434 +2847,6 @@ err:
}
-#ifndef MYSQL_CLIENT
-bool User_var_log_event::write()
-{
- char buf[UV_NAME_LEN_SIZE];
- char buf1[UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE +
- UV_CHARSET_NUMBER_SIZE + UV_VAL_LEN_SIZE];
- uchar buf2[MY_MAX(8, DECIMAL_MAX_FIELD_SIZE + 2)], *pos= buf2;
- uint unsigned_len= 0;
- uint buf1_length;
- size_t event_length;
-
- int4store(buf, name_len);
-
- if ((buf1[0]= is_null))
- {
- buf1_length= 1;
- val_len= 0; // Length of 'pos'
- }
- else
- {
- buf1[1]= type;
- int4store(buf1 + 2, charset_number);
-
- switch (type) {
- case REAL_RESULT:
- float8store(buf2, *(double*) val);
- break;
- case INT_RESULT:
- int8store(buf2, *(longlong*) val);
- unsigned_len= 1;
- break;
- case DECIMAL_RESULT:
- {
- my_decimal *dec= (my_decimal *)val;
- dec->fix_buffer_pointer();
- buf2[0]= (char)(dec->intg + dec->frac);
- buf2[1]= (char)dec->frac;
- decimal2bin((decimal_t*)val, buf2+2, buf2[0], buf2[1]);
- val_len= decimal_bin_size(buf2[0], buf2[1]) + 2;
- break;
- }
- case STRING_RESULT:
- pos= (uchar*) val;
- break;
- case ROW_RESULT:
- default:
- DBUG_ASSERT(0);
- return 0;
- }
- int4store(buf1 + 2 + UV_CHARSET_NUMBER_SIZE, val_len);
- buf1_length= 10;
- }
-
- /* Length of the whole event */
- event_length= sizeof(buf)+ name_len + buf1_length + val_len + unsigned_len;
-
- 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
-
-
-/*
- User_var_log_event::print()
-*/
-
-#ifdef MYSQL_CLIENT
-bool User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
-{
- Write_on_release_cache cache(&print_event_info->head_cache, file,
- Write_on_release_cache::FLUSH_F);
-
- if (!print_event_info->short_form)
- {
- if (print_header(&cache, print_event_info, FALSE) ||
- my_b_write_string(&cache, "\tUser_var\n"))
- goto err;
- }
-
- if (my_b_write_string(&cache, "SET @") ||
- my_b_write_backtick_quote(&cache, name, name_len))
- goto err;
-
- if (is_null)
- {
- if (my_b_printf(&cache, ":=NULL%s\n", print_event_info->delimiter))
- goto err;
- }
- else
- {
- switch (type) {
- case REAL_RESULT:
- double real_val;
- char real_buf[FMT_G_BUFSIZE(14)];
- float8get(real_val, val);
- sprintf(real_buf, "%.14g", real_val);
- if (my_b_printf(&cache, ":=%s%s\n", real_buf,
- print_event_info->delimiter))
- goto err;
- break;
- case INT_RESULT:
- char int_buf[22];
- longlong10_to_str(uint8korr(val), int_buf,
- ((flags & User_var_log_event::UNSIGNED_F) ? 10 : -10));
- if (my_b_printf(&cache, ":=%s%s\n", int_buf,
- print_event_info->delimiter))
- goto err;
- break;
- case DECIMAL_RESULT:
- {
- char str_buf[200];
- int str_len= sizeof(str_buf) - 1;
- int precision= (int)val[0];
- int scale= (int)val[1];
- decimal_digit_t dec_buf[10];
- decimal_t dec;
- dec.len= 10;
- dec.buf= dec_buf;
-
- bin2decimal((uchar*) val+2, &dec, precision, scale);
- decimal2string(&dec, str_buf, &str_len, 0, 0, 0);
- str_buf[str_len]= 0;
- if (my_b_printf(&cache, ":=%s%s\n", str_buf,
- print_event_info->delimiter))
- goto err;
- break;
- }
- case STRING_RESULT:
- {
- /*
- Let's express the string in hex. That's the most robust way. If we
- print it in character form instead, we need to escape it with
- character_set_client which we don't know (we will know it in 5.0, but
- in 4.1 we don't know it easily when we are printing
- User_var_log_event). Explanation why we would need to bother with
- character_set_client (quoting Bar):
- > Note, the parser doesn't switch to another unescaping mode after
- > it has met a character set introducer.
- > For example, if an SJIS client says something like:
- > SET @a= _ucs2 \0a\0b'
- > the string constant is still unescaped according to SJIS, not
- > according to UCS2.
- */
- char *hex_str;
- CHARSET_INFO *cs;
- bool error;
-
- // 2 hex digits / byte
- hex_str= (char *) my_malloc(2 * val_len + 1 + 3, MYF(MY_WME));
- if (!hex_str)
- goto err;
- str_to_hex(hex_str, val, val_len);
- /*
- For proper behaviour when mysqlbinlog|mysql, we need to explicitly
- specify the variable's collation. It will however cause problems when
- people want to mysqlbinlog|mysql into another server not supporting the
- character set. But there's not much to do about this and it's unlikely.
- */
- if (!(cs= get_charset(charset_number, MYF(0))))
- { /*
- Generate an unusable command (=> syntax error) is probably the best
- thing we can do here.
- */
- error= my_b_printf(&cache, ":=???%s\n", print_event_info->delimiter);
- }
- else
- error= my_b_printf(&cache, ":=_%s %s COLLATE `%s`%s\n",
- cs->csname, hex_str, cs->name,
- print_event_info->delimiter);
- my_free(hex_str);
- if (unlikely(error))
- goto err;
- break;
- }
- case ROW_RESULT:
- default:
- DBUG_ASSERT(0);
- break;
- }
- }
-
- return cache.flush_data();
-err:
- return 1;
-}
-#endif
-
-
-/*
- User_var_log_event::do_apply_event()
-*/
-
-#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-int User_var_log_event::do_apply_event(rpl_group_info *rgi)
-{
- Item *it= 0;
- CHARSET_INFO *charset;
- DBUG_ENTER("User_var_log_event::do_apply_event");
- query_id_t sav_query_id= 0; /* memorize orig id when deferred applying */
-
- if (rgi->deferred_events_collecting)
- {
- set_deferred(current_thd->query_id);
- DBUG_RETURN(rgi->deferred_events->add(this));
- }
- else if (is_deferred())
- {
- sav_query_id= current_thd->query_id;
- current_thd->query_id= query_id; /* recreating original time context */
- }
-
- if (!(charset= get_charset(charset_number, MYF(MY_WME))))
- {
- rgi->rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
- ER_THD(thd, ER_SLAVE_FATAL_ERROR),
- "Invalid character set for User var event");
- DBUG_RETURN(1);
- }
- LEX_CSTRING user_var_name;
- user_var_name.str= name;
- user_var_name.length= name_len;
- double real_val;
- longlong int_val;
-
- if (is_null)
- {
- it= new (thd->mem_root) Item_null(thd);
- }
- else
- {
- switch (type) {
- case REAL_RESULT:
- if (val_len != 8)
- {
- rgi->rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
- ER_THD(thd, ER_SLAVE_FATAL_ERROR),
- "Invalid variable length at User var event");
- return 1;
- }
- float8get(real_val, val);
- 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:
- if (val_len != 8)
- {
- rgi->rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
- ER_THD(thd, ER_SLAVE_FATAL_ERROR),
- "Invalid variable length at User var event");
- return 1;
- }
- int_val= (longlong) uint8korr(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:
- {
- if (val_len < 3)
- {
- rgi->rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
- ER_THD(thd, ER_SLAVE_FATAL_ERROR),
- "Invalid variable length at User var event");
- return 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 (thd->mem_root) Item_string(thd, val, (uint)val_len, charset);
- break;
- case ROW_RESULT:
- default:
- DBUG_ASSERT(0);
- DBUG_RETURN(0);
- }
- }
-
- 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)
-
- Fix_fields() can fail, in which case a call of update_hash() might
- crash the server, so if fix fields fails, we just return with an
- error.
- */
- if (e->fix_fields(thd, 0))
- DBUG_RETURN(1);
-
- /*
- A variable can just be considered as a table with
- a single record and with a single column. Thus, like
- a column value, it could always have IMPLICIT derivation.
- */
- e->update_hash((void*) val, val_len, type, charset,
- (flags & User_var_log_event::UNSIGNED_F));
- if (!is_deferred())
- free_root(thd->mem_root, 0);
- else
- current_thd->query_id= sav_query_id; /* restore current query's context */
-
- DBUG_RETURN(0);
-}
-
-int User_var_log_event::do_update_pos(rpl_group_info *rgi)
-{
- rgi->inc_event_relay_log_pos();
- return 0;
-}
-
-Log_event::enum_skip_reason
-User_var_log_event::do_shall_skip(rpl_group_info *rgi)
-{
- /*
- It is a common error to set the slave skip counter to 1 instead
- of 2 when recovering from an insert which used a auto increment,
- rand, or user var. Therefore, if the slave skip counter is 1, we
- just say that this event should be skipped by ignoring it, meaning
- that we do not change the value of the slave skip counter since it
- will be decreased by the following insert event.
- */
- return continue_group(rgi);
-}
-#endif /* !MYSQL_CLIENT */
-
-#ifdef HAVE_REPLICATION
-#ifdef MYSQL_CLIENT
-bool Unknown_log_event::print(FILE* file_arg, PRINT_EVENT_INFO* print_event_info)
-{
- if (print_event_info->short_form)
- return 0;
-
- Write_on_release_cache cache(&print_event_info->head_cache, file_arg);
-
- if (what != ENCRYPTED)
- {
- if (print_header(&cache, print_event_info, FALSE) ||
- my_b_printf(&cache, "\n# Unknown event\n"))
- goto err;
- }
- else if (my_b_printf(&cache, "# Encrypted event\n"))
- goto err;
-
- return cache.flush_data();
-err:
- return 1;
-}
-#endif
-
-/**************************************************************************
- Stop_log_event methods
-**************************************************************************/
-
-/*
- Stop_log_event::print()
-*/
-
-#ifdef MYSQL_CLIENT
-bool Stop_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
-{
- if (print_event_info->short_form)
- return 0;
-
- Write_on_release_cache cache(&print_event_info->head_cache, file,
- Write_on_release_cache::FLUSH_F, this);
-
- if (print_header(&cache, print_event_info, FALSE) ||
- my_b_write_string(&cache, "\tStop\n"))
- return 1;
- return cache.flush_data();
-}
-#endif /* MYSQL_CLIENT */
-
-
-#ifndef MYSQL_CLIENT
-/*
- The master stopped. We used to clean up all temporary tables but
- this is useless as, as the master has shut down properly, it has
- written all DROP TEMPORARY TABLE (prepared statements' deletion is
- TODO only when we binlog prep stmts). We used to clean up
- slave_load_tmpdir, but this is useless as it has been cleared at the
- end of LOAD DATA INFILE. So we have nothing to do here. The place
- were we must do this cleaning is in
- Start_log_event_v3::do_apply_event(), not here. Because if we come
- here, the master was sane.
-
- This must only be called from the Slave SQL thread, since it calls
- Relay_log_info::flush().
-*/
-
-int Stop_log_event::do_update_pos(rpl_group_info *rgi)
-{
- int error= 0;
- Relay_log_info *rli= rgi->rli;
- DBUG_ENTER("Stop_log_event::do_update_pos");
- /*
- We do not want to update master_log pos because we get a rotate event
- before stop, so by now group_master_log_name is set to the next log.
- If we updated it, we will have incorrect master coordinates and this
- could give false triggers in MASTER_POS_WAIT() that we have reached
- the target position when in fact we have not.
- */
- if (rli->get_flag(Relay_log_info::IN_TRANSACTION))
- rgi->inc_event_relay_log_pos();
- else if (!rgi->is_parallel_exec)
- {
- rpl_global_gtid_slave_state->record_and_update_gtid(thd, rgi);
- rli->inc_group_relay_log_pos(0, rgi);
- if (rli->flush())
- error= 1;
- }
- DBUG_RETURN(error);
-}
-
-#endif /* !MYSQL_CLIENT */
-#endif /* HAVE_REPLICATION */
-
-
/**************************************************************************
Create_file_log_event methods
**************************************************************************/
@@ -9718,75 +2855,6 @@ int Stop_log_event::do_update_pos(rpl_group_info *rgi)
Create_file_log_event ctor
*/
-#ifndef MYSQL_CLIENT
-Create_file_log_event::
-Create_file_log_event(THD* thd_arg, sql_exchange* ex,
- const char* db_arg, const char* table_name_arg,
- List<Item>& fields_arg,
- bool is_concurrent_arg,
- enum enum_duplicates handle_dup,
- bool ignore,
- uchar* block_arg, uint block_len_arg, bool using_trans)
- :Load_log_event(thd_arg, ex, db_arg, table_name_arg, fields_arg,
- is_concurrent_arg,
- handle_dup, ignore, using_trans),
- fake_base(0), block(block_arg), event_buf(0), block_len(block_len_arg),
- file_id(thd_arg->file_id = mysql_bin_log.next_file_id())
-{
- DBUG_ENTER("Create_file_log_event");
- sql_ex.force_new_format();
- DBUG_VOID_RETURN;
-}
-
-
-/*
- Create_file_log_event::write_data_body()
-*/
-
-bool Create_file_log_event::write_data_body()
-{
- bool res;
- if ((res= Load_log_event::write_data_body()) || fake_base)
- return res;
- return write_data("", 1) ||
- write_data(block, block_len);
-}
-
-
-/*
- Create_file_log_event::write_data_header()
-*/
-
-bool Create_file_log_event::write_data_header()
-{
- bool res;
- uchar buf[CREATE_FILE_HEADER_LEN];
- if ((res= Load_log_event::write_data_header()) || fake_base)
- return res;
- int4store(buf + CF_FILE_ID_OFFSET, file_id);
- return write_data(buf, CREATE_FILE_HEADER_LEN) != 0;
-}
-
-
-/*
- Create_file_log_event::write_base()
-*/
-
-bool Create_file_log_event::write_base()
-{
- bool res;
- fake_base= 1; // pretend we are Load event
- res= write();
- fake_base= 0;
- return res;
-}
-
-#endif /* !MYSQL_CLIENT */
-
-/*
- Create_file_log_event ctor
-*/
-
Create_file_log_event::Create_file_log_event(const char* buf, uint len,
const Format_description_log_event* description_event)
:Load_log_event(buf,0,description_event),fake_base(0),block(0),inited_from_old(0)
@@ -9838,172 +2906,6 @@ Create_file_log_event::Create_file_log_event(const char* buf, uint len,
}
-/*
- Create_file_log_event::print()
-*/
-
-#ifdef MYSQL_CLIENT
-bool Create_file_log_event::print(FILE* file,
- PRINT_EVENT_INFO* print_event_info,
- bool enable_local)
-{
- if (print_event_info->short_form)
- {
- if (enable_local && check_fname_outside_temp_buf())
- return Load_log_event::print(file, print_event_info);
- return 0;
- }
-
- Write_on_release_cache cache(&print_event_info->head_cache, file);
-
- if (enable_local)
- {
- if (Load_log_event::print(file, print_event_info,
- !check_fname_outside_temp_buf()))
- goto err;
-
- /**
- reduce the size of io cache so that the write function is called
- for every call to my_b_printf().
- */
- DBUG_EXECUTE_IF ("simulate_create_event_write_error",
- {(&cache)->write_pos= (&cache)->write_end;
- DBUG_SET("+d,simulate_file_write_error");});
- /*
- That one is for "file_id: etc" below: in mysqlbinlog we want the #, in
- SHOW BINLOG EVENTS we don't.
- */
- if (my_b_write_byte(&cache, '#'))
- goto err;
- }
-
- if (my_b_printf(&cache, " file_id: %d block_len: %d\n", file_id, block_len))
- goto err;
-
- return cache.flush_data();
-err:
- return 1;
-
-}
-
-
-bool Create_file_log_event::print(FILE* file,
- PRINT_EVENT_INFO* print_event_info)
-{
- return print(file, print_event_info, 0);
-}
-#endif /* MYSQL_CLIENT */
-
-
-/*
- Create_file_log_event::pack_info()
-*/
-
-#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-void Create_file_log_event::pack_info(Protocol *protocol)
-{
- char buf[SAFE_NAME_LEN*2 + 30 + 21*2], *pos;
- pos= strmov(buf, "db=");
- memcpy(pos, db, db_len);
- pos= strmov(pos + db_len, ";table=");
- memcpy(pos, table_name, table_name_len);
- pos= strmov(pos + table_name_len, ";file_id=");
- pos= int10_to_str((long) file_id, pos, 10);
- pos= strmov(pos, ";block_len=");
- pos= int10_to_str((long) block_len, pos, 10);
- protocol->store(buf, (uint) (pos-buf), &my_charset_bin);
-}
-#endif /* defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) */
-
-
-/**
- Create_file_log_event::do_apply_event()
- Constructor for Create_file_log_event to intantiate an event
- from the relay log on the slave.
-
- @retval
- 0 Success
- @retval
- 1 Failure
-*/
-
-#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-int Create_file_log_event::do_apply_event(rpl_group_info *rgi)
-{
- char fname_buf[FN_REFLEN];
- char *ext;
- int fd = -1;
- IO_CACHE file;
- Log_event_writer lew(&file, 0);
- int error = 1;
- Relay_log_info const *rli= rgi->rli;
-
- THD_STAGE_INFO(thd, stage_making_temp_file_create_before_load_data);
- bzero((char*)&file, sizeof(file));
- ext= slave_load_file_stem(fname_buf, file_id, server_id, ".info",
- &rli->mi->connection_name);
- /* old copy may exist already */
- mysql_file_delete(key_file_log_event_info, fname_buf, MYF(0));
- if ((fd= mysql_file_create(key_file_log_event_info,
- fname_buf, CREATE_MODE,
- O_WRONLY | O_BINARY | O_EXCL | O_NOFOLLOW,
- MYF(MY_WME))) < 0 ||
- init_io_cache(&file, fd, IO_SIZE, WRITE_CACHE, (my_off_t)0, 0,
- MYF(MY_WME|MY_NABP)))
- {
- rli->report(ERROR_LEVEL, my_errno, rgi->gtid_info(),
- "Error in Create_file event: could not open file '%s'",
- fname_buf);
- goto err;
- }
-
- // a trick to avoid allocating another buffer
- fname= fname_buf;
- fname_len= (uint) (strmov(ext, ".data") - fname);
- 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(),
- "Error in Create_file event: could not write to file '%s'",
- fname_buf);
- goto err;
- }
- end_io_cache(&file);
- mysql_file_close(fd, MYF(0));
-
- // fname_buf now already has .data, not .info, because we did our trick
- /* old copy may exist already */
- mysql_file_delete(key_file_log_event_data, fname_buf, MYF(0));
- if ((fd= mysql_file_create(key_file_log_event_data,
- fname_buf, CREATE_MODE,
- O_WRONLY | O_BINARY | O_EXCL | O_NOFOLLOW,
- MYF(MY_WME))) < 0)
- {
- rli->report(ERROR_LEVEL, my_errno, rgi->gtid_info(),
- "Error in Create_file event: could not open file '%s'",
- fname_buf);
- goto err;
- }
- if (mysql_file_write(fd, (uchar*) block, block_len, MYF(MY_WME+MY_NABP)))
- {
- rli->report(ERROR_LEVEL, my_errno, rgi->gtid_info(),
- "Error in Create_file event: write to '%s' failed",
- fname_buf);
- goto err;
- }
- error=0; // Everything is ok
-
-err:
- if (unlikely(error))
- end_io_cache(&file);
- if (likely(fd >= 0))
- mysql_file_close(fd, MYF(0));
- return error != 0;
-}
-#endif /* defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) */
-
-
/**************************************************************************
Append_block_log_event methods
**************************************************************************/
@@ -10012,23 +2914,6 @@ err:
Append_block_log_event ctor
*/
-#ifndef MYSQL_CLIENT
-Append_block_log_event::Append_block_log_event(THD *thd_arg,
- const char *db_arg,
- uchar *block_arg,
- uint block_len_arg,
- bool using_trans)
- :Log_event(thd_arg,0, using_trans), block(block_arg),
- block_len(block_len_arg), file_id(thd_arg->file_id), db(db_arg)
-{
-}
-#endif
-
-
-/*
- Append_block_log_event ctor
-*/
-
Append_block_log_event::Append_block_log_event(const char* buf, uint len,
const Format_description_log_event* description_event)
:Log_event(buf, description_event),block(0)
@@ -10047,140 +2932,6 @@ Append_block_log_event::Append_block_log_event(const char* buf, uint len,
}
-/*
- Append_block_log_event::write()
-*/
-
-#ifndef MYSQL_CLIENT
-bool Append_block_log_event::write()
-{
- uchar buf[APPEND_BLOCK_HEADER_LEN];
- int4store(buf + AB_FILE_ID_OFFSET, file_id);
- return write_header(APPEND_BLOCK_HEADER_LEN + block_len) ||
- write_data(buf, APPEND_BLOCK_HEADER_LEN) ||
- write_data(block, block_len) ||
- write_footer();
-}
-#endif
-
-
-/*
- Append_block_log_event::print()
-*/
-
-#ifdef MYSQL_CLIENT
-bool Append_block_log_event::print(FILE* file,
- PRINT_EVENT_INFO* print_event_info)
-{
- if (print_event_info->short_form)
- return 0;
-
- Write_on_release_cache cache(&print_event_info->head_cache, file);
-
- if (print_header(&cache, print_event_info, FALSE) ||
- my_b_printf(&cache, "\n#%s: file_id: %d block_len: %d\n",
- get_type_str(), file_id, block_len))
- goto err;
-
- return cache.flush_data();
-err:
- return 1;
-}
-#endif /* MYSQL_CLIENT */
-
-
-/*
- Append_block_log_event::pack_info()
-*/
-
-#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-void Append_block_log_event::pack_info(Protocol *protocol)
-{
- char buf[256];
- uint length;
- length= (uint) sprintf(buf, ";file_id=%u;block_len=%u", file_id, block_len);
- protocol->store(buf, length, &my_charset_bin);
-}
-
-
-/*
- Append_block_log_event::get_create_or_append()
-*/
-
-int Append_block_log_event::get_create_or_append() const
-{
- return 0; /* append to the file, fail if not exists */
-}
-
-/*
- Append_block_log_event::do_apply_event()
-*/
-
-int Append_block_log_event::do_apply_event(rpl_group_info *rgi)
-{
- char fname[FN_REFLEN];
- int fd;
- int error = 1;
- Relay_log_info const *rli= rgi->rli;
- DBUG_ENTER("Append_block_log_event::do_apply_event");
-
- THD_STAGE_INFO(thd, stage_making_temp_file_append_before_load_data);
- slave_load_file_stem(fname, file_id, server_id, ".data",
- &rli->mi->cmp_connection_name);
- if (get_create_or_append())
- {
- /*
- Usually lex_start() is called by mysql_parse(), but we need it here
- as the present method does not call mysql_parse().
- */
- lex_start(thd);
- thd->reset_for_next_command();
- /* old copy may exist already */
- mysql_file_delete(key_file_log_event_data, fname, MYF(0));
- if ((fd= mysql_file_create(key_file_log_event_data,
- fname, CREATE_MODE,
- O_WRONLY | O_BINARY | O_EXCL | O_NOFOLLOW,
- MYF(MY_WME))) < 0)
- {
- rli->report(ERROR_LEVEL, my_errno, rgi->gtid_info(),
- "Error in %s event: could not create file '%s'",
- get_type_str(), fname);
- goto err;
- }
- }
- else if ((fd= mysql_file_open(key_file_log_event_data,
- fname,
- O_WRONLY | O_APPEND | O_BINARY | O_NOFOLLOW,
- MYF(MY_WME))) < 0)
- {
- rli->report(ERROR_LEVEL, my_errno, rgi->gtid_info(),
- "Error in %s event: could not open file '%s'",
- get_type_str(), fname);
- goto err;
- }
-
- DBUG_EXECUTE_IF("remove_slave_load_file_before_write",
- {
- my_delete(fname, MYF(0));
- });
-
- if (mysql_file_write(fd, (uchar*) block, block_len, MYF(MY_WME+MY_NABP)))
- {
- rli->report(ERROR_LEVEL, my_errno, rgi->gtid_info(),
- "Error in %s event: write to '%s' failed",
- get_type_str(), fname);
- goto err;
- }
- error=0;
-
-err:
- if (fd >= 0)
- mysql_file_close(fd, MYF(0));
- DBUG_RETURN(error);
-}
-#endif
-
-
/**************************************************************************
Delete_file_log_event methods
**************************************************************************/
@@ -10189,18 +2940,6 @@ err:
Delete_file_log_event ctor
*/
-#ifndef MYSQL_CLIENT
-Delete_file_log_event::Delete_file_log_event(THD *thd_arg, const char* db_arg,
- bool using_trans)
- :Log_event(thd_arg, 0, using_trans), file_id(thd_arg->file_id), db(db_arg)
-{
-}
-#endif
-
-/*
- Delete_file_log_event ctor
-*/
-
Delete_file_log_event::Delete_file_log_event(const char* buf, uint len,
const Format_description_log_event* description_event)
:Log_event(buf, description_event),file_id(0)
@@ -10213,76 +2952,6 @@ Delete_file_log_event::Delete_file_log_event(const char* buf, uint len,
}
-/*
- Delete_file_log_event::write()
-*/
-
-#ifndef MYSQL_CLIENT
-bool Delete_file_log_event::write()
-{
- uchar buf[DELETE_FILE_HEADER_LEN];
- int4store(buf + DF_FILE_ID_OFFSET, file_id);
- return write_header(sizeof(buf)) ||
- write_data(buf, sizeof(buf)) ||
- write_footer();
-}
-#endif
-
-
-/*
- Delete_file_log_event::print()
-*/
-
-#ifdef MYSQL_CLIENT
-bool Delete_file_log_event::print(FILE* file,
- PRINT_EVENT_INFO* print_event_info)
-{
- if (print_event_info->short_form)
- return 0;
-
- Write_on_release_cache cache(&print_event_info->head_cache, file);
-
- if (print_header(&cache, print_event_info, FALSE) ||
- my_b_printf(&cache, "\n#Delete_file: file_id=%u\n", file_id))
- return 1;
-
- return cache.flush_data();
-}
-#endif /* MYSQL_CLIENT */
-
-/*
- Delete_file_log_event::pack_info()
-*/
-
-#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-void Delete_file_log_event::pack_info(Protocol *protocol)
-{
- char buf[64];
- uint length;
- length= (uint) sprintf(buf, ";file_id=%u", (uint) file_id);
- protocol->store(buf, (int32) length, &my_charset_bin);
-}
-#endif
-
-/*
- Delete_file_log_event::do_apply_event()
-*/
-
-#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-int Delete_file_log_event::do_apply_event(rpl_group_info *rgi)
-{
- char fname[FN_REFLEN+10];
- Relay_log_info const *rli= rgi->rli;
- char *ext= slave_load_file_stem(fname, file_id, server_id, ".data",
- &rli->mi->cmp_connection_name);
- mysql_file_delete(key_file_log_event_data, fname, MYF(MY_WME));
- strmov(ext, ".info");
- mysql_file_delete(key_file_log_event_info, fname, MYF(MY_WME));
- return 0;
-}
-#endif /* defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) */
-
-
/**************************************************************************
Execute_load_log_event methods
**************************************************************************/
@@ -10291,20 +2960,6 @@ int Delete_file_log_event::do_apply_event(rpl_group_info *rgi)
Execute_load_log_event ctor
*/
-#ifndef MYSQL_CLIENT
-Execute_load_log_event::Execute_load_log_event(THD *thd_arg,
- const char* db_arg,
- bool using_trans)
- :Log_event(thd_arg, 0, using_trans), file_id(thd_arg->file_id), db(db_arg)
-{
-}
-#endif
-
-
-/*
- Execute_load_log_event ctor
-*/
-
Execute_load_log_event::Execute_load_log_event(const char* buf, uint len,
const Format_description_log_event* description_event)
:Log_event(buf, description_event), file_id(0)
@@ -10317,167 +2972,10 @@ Execute_load_log_event::Execute_load_log_event(const char* buf, uint len,
}
-/*
- Execute_load_log_event::write()
-*/
-
-#ifndef MYSQL_CLIENT
-bool Execute_load_log_event::write()
-{
- uchar buf[EXEC_LOAD_HEADER_LEN];
- int4store(buf + EL_FILE_ID_OFFSET, file_id);
- return write_header(sizeof(buf)) ||
- write_data(buf, sizeof(buf)) ||
- write_footer();
-}
-#endif
-
-
-/*
- Execute_load_log_event::print()
-*/
-
-#ifdef MYSQL_CLIENT
-bool Execute_load_log_event::print(FILE* file,
- PRINT_EVENT_INFO* print_event_info)
-{
- if (print_event_info->short_form)
- return 0;
-
- Write_on_release_cache cache(&print_event_info->head_cache, file);
-
- if (print_header(&cache, print_event_info, FALSE) ||
- my_b_printf(&cache, "\n#Exec_load: file_id=%d\n",
- file_id))
- return 1;
-
- return cache.flush_data();
-}
-#endif
-
-/*
- Execute_load_log_event::pack_info()
-*/
-
-#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-void Execute_load_log_event::pack_info(Protocol *protocol)
-{
- char buf[64];
- uint length;
- length= (uint) sprintf(buf, ";file_id=%u", (uint) file_id);
- protocol->store(buf, (int32) length, &my_charset_bin);
-}
-
-
-/*
- Execute_load_log_event::do_apply_event()
-*/
-
-int Execute_load_log_event::do_apply_event(rpl_group_info *rgi)
-{
- char fname[FN_REFLEN+10];
- char *ext;
- int fd;
- int error= 1;
- IO_CACHE file;
- Load_log_event *lev= 0;
- Relay_log_info const *rli= rgi->rli;
-
- ext= slave_load_file_stem(fname, file_id, server_id, ".info",
- &rli->mi->cmp_connection_name);
- if ((fd= mysql_file_open(key_file_log_event_info,
- fname, O_RDONLY | O_BINARY | O_NOFOLLOW,
- MYF(MY_WME))) < 0 ||
- init_io_cache(&file, fd, IO_SIZE, READ_CACHE, (my_off_t)0, 0,
- MYF(MY_WME|MY_NABP)))
- {
- rli->report(ERROR_LEVEL, my_errno, rgi->gtid_info(),
- "Error in Exec_load event: could not open file '%s'",
- fname);
- goto err;
- }
- if (!(lev= (Load_log_event*)
- Log_event::read_log_event(&file,
- rli->relay_log.description_event_for_exec,
- opt_slave_sql_verify_checksum)) ||
- lev->get_type_code() != NEW_LOAD_EVENT)
- {
- rli->report(ERROR_LEVEL, 0, rgi->gtid_info(), "Error in Exec_load event: "
- "file '%s' appears corrupted", fname);
- goto err;
- }
- lev->thd = thd;
- /*
- lev->do_apply_event should use rli only for errors i.e. should
- not advance rli's position.
-
- lev->do_apply_event is the place where the table is loaded (it
- calls mysql_load()).
- */
-
- if (lev->do_apply_event(0,rgi,1))
- {
- /*
- We want to indicate the name of the file that could not be loaded
- (SQL_LOADxxx).
- But as we are here we are sure the error is in rli->last_slave_error and
- rli->last_slave_errno (example of error: duplicate entry for key), so we
- don't want to overwrite it with the filename.
- What we want instead is add the filename to the current error message.
- */
- char *tmp= my_strdup(rli->last_error().message, MYF(MY_WME));
- if (tmp)
- {
- rli->report(ERROR_LEVEL, rli->last_error().number, rgi->gtid_info(),
- "%s. Failed executing load from '%s'", tmp, fname);
- my_free(tmp);
- }
- goto err;
- }
- /*
- We have an open file descriptor to the .info file; we need to close it
- or Windows will refuse to delete the file in mysql_file_delete().
- */
- if (fd >= 0)
- {
- mysql_file_close(fd, MYF(0));
- end_io_cache(&file);
- fd= -1;
- }
- mysql_file_delete(key_file_log_event_info, fname, MYF(MY_WME));
- memcpy(ext, ".data", 6);
- mysql_file_delete(key_file_log_event_data, fname, MYF(MY_WME));
- error = 0;
-
-err:
- delete lev;
- if (fd >= 0)
- {
- mysql_file_close(fd, MYF(0));
- end_io_cache(&file);
- }
- return error;
-}
-
-#endif /* defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) */
-
-
/**************************************************************************
Begin_load_query_log_event methods
**************************************************************************/
-#ifndef MYSQL_CLIENT
-Begin_load_query_log_event::
-Begin_load_query_log_event(THD* thd_arg, const char* db_arg, uchar* block_arg,
- uint block_len_arg, bool using_trans)
- :Append_block_log_event(thd_arg, db_arg, block_arg, block_len_arg,
- using_trans)
-{
- file_id= thd_arg->file_id= mysql_bin_log.next_file_id();
-}
-#endif
-
-
Begin_load_query_log_event::
Begin_load_query_log_event(const char* buf, uint len,
const Format_description_log_event* desc_event)
@@ -10486,49 +2984,11 @@ Begin_load_query_log_event(const char* buf, uint len,
}
-#if defined( HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-int Begin_load_query_log_event::get_create_or_append() const
-{
- return 1; /* create the file */
-}
-#endif /* defined( HAVE_REPLICATION) && !defined(MYSQL_CLIENT) */
-
-
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
-Log_event::enum_skip_reason
-Begin_load_query_log_event::do_shall_skip(rpl_group_info *rgi)
-{
- /*
- If the slave skip counter is 1, then we should not start executing
- on the next event.
- */
- return continue_group(rgi);
-}
-#endif
-
-
/**************************************************************************
Execute_load_query_log_event methods
**************************************************************************/
-#ifndef MYSQL_CLIENT
-Execute_load_query_log_event::
-Execute_load_query_log_event(THD *thd_arg, const char* query_arg,
- ulong query_length_arg, uint fn_pos_start_arg,
- uint fn_pos_end_arg,
- enum_load_dup_handling dup_handling_arg,
- bool using_trans, bool direct, bool suppress_use,
- int errcode):
- Query_log_event(thd_arg, query_arg, query_length_arg, using_trans, direct,
- suppress_use, errcode),
- file_id(thd_arg->file_id), fn_pos_start(fn_pos_start_arg),
- fn_pos_end(fn_pos_end_arg), dup_handling(dup_handling_arg)
-{
-}
-#endif /* !MYSQL_CLIENT */
-
-
Execute_load_query_log_event::
Execute_load_query_log_event(const char* buf, uint event_len,
const Format_description_log_event* desc_event):
@@ -10558,165 +3018,6 @@ 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()
-{
- 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 write_data(buf, EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN);
-}
-#endif
-
-
-#ifdef MYSQL_CLIENT
-bool Execute_load_query_log_event::print(FILE* file,
- PRINT_EVENT_INFO* print_event_info)
-{
- return print(file, print_event_info, 0);
-}
-
-/**
- Prints the query as LOAD DATA LOCAL and with rewritten filename.
-*/
-bool Execute_load_query_log_event::print(FILE* file,
- PRINT_EVENT_INFO* print_event_info,
- const char *local_fname)
-{
- Write_on_release_cache cache(&print_event_info->head_cache, file);
-
- if (print_query_header(&cache, print_event_info))
- goto err;
-
- /**
- reduce the size of io cache so that the write function is called
- for every call to my_b_printf().
- */
- DBUG_EXECUTE_IF ("simulate_execute_event_write_error",
- {(&cache)->write_pos= (&cache)->write_end;
- DBUG_SET("+d,simulate_file_write_error");});
-
- if (local_fname)
- {
- if (my_b_write(&cache, (uchar*) query, fn_pos_start) ||
- my_b_write_string(&cache, " LOCAL INFILE ") ||
- pretty_print_str(&cache, local_fname, (int)strlen(local_fname)))
- goto err;
-
- if (dup_handling == LOAD_DUP_REPLACE)
- if (my_b_write_string(&cache, " REPLACE"))
- goto err;
-
- if (my_b_write_string(&cache, " INTO") ||
- my_b_write(&cache, (uchar*) query + fn_pos_end, q_len-fn_pos_end) ||
- my_b_printf(&cache, "\n%s\n", print_event_info->delimiter))
- goto err;
- }
- else
- {
- if (my_b_write(&cache, (uchar*) query, q_len) ||
- my_b_printf(&cache, "\n%s\n", print_event_info->delimiter))
- goto err;
- }
-
- if (!print_event_info->short_form)
- my_b_printf(&cache, "# file_id: %d \n", file_id);
-
- return cache.flush_data();
-err:
- return 1;
-}
-#endif
-
-
-#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-void Execute_load_query_log_event::pack_info(Protocol *protocol)
-{
- char buf_mem[1024];
- String buf(buf_mem, sizeof(buf_mem), system_charset_info);
- buf.real_alloc(9 + db_len + q_len + 10 + 21);
- if (db && db_len)
- {
- if (buf.append(STRING_WITH_LEN("use ")) ||
- append_identifier(protocol->thd, &buf, db, db_len) ||
- buf.append(STRING_WITH_LEN("; ")))
- return;
- }
- if (query && q_len && buf.append(query, q_len))
- return;
- if (buf.append(" ;file_id=") ||
- buf.append_ulonglong(file_id))
- return;
- protocol->store(buf.ptr(), buf.length(), &my_charset_bin);
-}
-
-
-int
-Execute_load_query_log_event::do_apply_event(rpl_group_info *rgi)
-{
- char *p;
- char *buf;
- char *fname;
- char *fname_end;
- int error;
- Relay_log_info const *rli= rgi->rli;
-
- buf= (char*) my_malloc(q_len + 1 - (fn_pos_end - fn_pos_start) +
- (FN_REFLEN + 10) + 10 + 8 + 5, MYF(MY_WME));
-
- DBUG_EXECUTE_IF("LOAD_DATA_INFILE_has_fatal_error", my_free(buf); buf= NULL;);
-
- /* Replace filename and LOCAL keyword in query before executing it */
- if (buf == NULL)
- {
- rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, rgi->gtid_info(),
- ER_THD(rgi->thd, ER_SLAVE_FATAL_ERROR), "Not enough memory");
- return 1;
- }
-
- p= buf;
- memcpy(p, query, fn_pos_start);
- p+= fn_pos_start;
- fname= (p= strmake(p, STRING_WITH_LEN(" INFILE \'")));
- p= slave_load_file_stem(p, file_id, server_id, ".data",
- &rli->mi->cmp_connection_name);
- fname_end= p= strend(p); // Safer than p=p+5
- *(p++)='\'';
- switch (dup_handling) {
- case LOAD_DUP_IGNORE:
- p= strmake(p, STRING_WITH_LEN(" IGNORE"));
- break;
- case LOAD_DUP_REPLACE:
- p= strmake(p, STRING_WITH_LEN(" REPLACE"));
- break;
- default:
- /* Ordinary load data */
- break;
- }
- p= strmake(p, STRING_WITH_LEN(" INTO "));
- p= strmake(p, query+fn_pos_end, q_len-fn_pos_end);
-
- error= Query_log_event::do_apply_event(rgi, buf, (uint32)(p-buf));
-
- /* Forging file name for deletion in same buffer */
- *fname_end= 0;
-
- /*
- If there was an error the slave is going to stop, leave the
- file so that we can re-execute this event at START SLAVE.
- */
- if (unlikely(!error))
- mysql_file_delete(key_file_log_event_data, fname, MYF(MY_WME));
-
- my_free(buf);
- return error;
-}
-#endif
-
-
/**************************************************************************
sql_ex_info methods
**************************************************************************/
@@ -10771,105 +3072,12 @@ 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
**************************************************************************/
-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)
- : Log_event(thd_arg, 0, is_transactional),
- m_row_count(0),
- m_table(tbl_arg),
- m_table_id(tid),
- m_width(tbl_arg ? tbl_arg->s->fields : 1),
- m_rows_buf(0), m_rows_cur(0), m_rows_end(0), m_flags(0),
- m_type(event_type), m_extra_row_data(0)
-#ifdef HAVE_REPLICATION
- , m_curr_row(NULL), m_curr_row_end(NULL),
- m_key(NULL), m_key_info(NULL), m_key_nr(0),
- master_had_triggers(0)
-#endif
-{
- /*
- We allow a special form of dummy event when the table, and cols
- are null and the table id is ~0UL. This is a temporary
- solution, to be able to terminate a started statement in the
- binary log: the extraneous events will be removed in the future.
- */
- DBUG_ASSERT((tbl_arg && tbl_arg->s && tid != ~0UL) ||
- (!tbl_arg && !cols && tid == ~0UL));
-
- if (thd_arg->variables.option_bits & OPTION_NO_FOREIGN_KEY_CHECKS)
- set_flags(NO_FOREIGN_KEY_CHECKS_F);
- if (thd_arg->variables.option_bits & OPTION_RELAXED_UNIQUE_CHECKS)
- set_flags(RELAXED_UNIQUE_CHECKS_F);
- if (thd_arg->variables.option_bits & OPTION_NO_CHECK_CONSTRAINT_CHECKS)
- set_flags(NO_CHECK_CONSTRAINT_CHECKS_F);
- /* if my_bitmap_init fails, caught in is_valid() */
- if (likely(!my_bitmap_init(&m_cols,
- m_width <= sizeof(m_bitbuf)*8 ? m_bitbuf : NULL,
- m_width,
- false)))
- {
- /* Cols can be zero if this is a dummy binrows event */
- if (likely(cols != NULL))
- {
- memcpy(m_cols.bitmap, cols->bitmap, no_bytes_in_map(cols));
- create_last_word_mask(&m_cols);
- }
- }
- else
- {
- // Needed because my_bitmap_init() does not set it to null on failure
- m_cols.bitmap= 0;
- }
-}
-#endif
Rows_log_event::Rows_log_event(const char *buf, uint event_len,
const Format_description_log_event
@@ -11125,1150 +3333,10 @@ int Rows_log_event::get_data_size()
}
-#ifndef MYSQL_CLIENT
-int Rows_log_event::do_add_row_data(uchar *row_data, size_t length)
-{
- /*
- When the table has a primary key, we would probably want, by default, to
- log only the primary key value instead of the entire "before image". This
- would save binlog space. TODO
- */
- DBUG_ENTER("Rows_log_event::do_add_row_data");
- DBUG_PRINT("enter", ("row_data:%p length: %lu", 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.
- */
-#ifndef HAVE_valgrind
- DBUG_DUMP("row_data", row_data, MY_MIN(length, 32));
-#endif
-
- DBUG_ASSERT(m_rows_buf <= m_rows_cur);
- DBUG_ASSERT(!m_rows_buf || (m_rows_end && m_rows_buf < m_rows_end));
- DBUG_ASSERT(m_rows_cur <= m_rows_end);
-
- /* The cast will always work since m_rows_cur <= m_rows_end */
- if (static_cast<size_t>(m_rows_end - m_rows_cur) <= length)
- {
- size_t const block_size= 1024;
- size_t cur_size= m_rows_cur - m_rows_buf;
- DBUG_EXECUTE_IF("simulate_too_big_row_case1",
- cur_size= UINT_MAX32 - (block_size * 10);
- length= UINT_MAX32 - (block_size * 10););
- DBUG_EXECUTE_IF("simulate_too_big_row_case2",
- cur_size= UINT_MAX32 - (block_size * 10);
- length= block_size * 10;);
- DBUG_EXECUTE_IF("simulate_too_big_row_case3",
- cur_size= block_size * 10;
- length= UINT_MAX32 - (block_size * 10););
- DBUG_EXECUTE_IF("simulate_too_big_row_case4",
- cur_size= UINT_MAX32 - (block_size * 10);
- length= (block_size * 10) - block_size + 1;);
- size_t remaining_space= UINT_MAX32 - cur_size;
- /* Check that the new data fits within remaining space and we can add
- block_size without wrapping.
- */
- if (cur_size > UINT_MAX32 || length > remaining_space ||
- ((length + block_size) > remaining_space))
- {
- sql_print_error("The row data is greater than 4GB, which is too big to "
- "write to the binary log.");
- DBUG_RETURN(ER_BINLOG_ROW_LOGGING_FAILED);
- }
- size_t const new_alloc=
- block_size * ((cur_size + length + block_size - 1) / block_size);
-
- uchar* const new_buf= (uchar*)my_realloc((uchar*)m_rows_buf, new_alloc,
- MYF(MY_ALLOW_ZERO_PTR|MY_WME));
- if (unlikely(!new_buf))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
-
- /* If the memory moved, we need to move the pointers */
- if (new_buf != m_rows_buf)
- {
- m_rows_buf= new_buf;
- m_rows_cur= m_rows_buf + cur_size;
- }
-
- /*
- The end pointer should always be changed to point to the end of
- the allocated memory.
- */
- m_rows_end= m_rows_buf + new_alloc;
- }
-
- DBUG_ASSERT(m_rows_cur + length <= m_rows_end);
- memcpy(m_rows_cur, row_data, length);
- m_rows_cur+= length;
- m_row_count++;
- DBUG_RETURN(0);
-}
-#endif
-
-#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
-
-/**
- Restores empty table list as it was before trigger processing.
-
- @note We have a lot of ASSERTS that check the lists when we close tables.
- There was the same problem with MERGE MYISAM tables and so here we try to
- go the same way.
-*/
-static void restore_empty_query_table_list(LEX *lex)
-{
- if (lex->first_not_own_table())
- (*lex->first_not_own_table()->prev_global)= NULL;
- lex->query_tables= NULL;
- lex->query_tables_last= &lex->query_tables;
-}
-
-
-int Rows_log_event::do_apply_event(rpl_group_info *rgi)
-{
- Relay_log_info const *rli= rgi->rli;
- TABLE* table;
- DBUG_ENTER("Rows_log_event::do_apply_event(Relay_log_info*)");
- int error= 0;
- /*
- If m_table_id == ~0ULL, then we have a dummy event that does not
- contain any data. In that case, we just remove all tables in the
- tables_to_lock list, close the thread tables, and return with
- success.
- */
- if (m_table_id == ~0ULL)
- {
- /*
- This one is supposed to be set: just an extra check so that
- nothing strange has happened.
- */
- DBUG_ASSERT(get_flags(STMT_END_F));
-
- rgi->slave_close_thread_tables(thd);
- thd->clear_error();
- DBUG_RETURN(0);
- }
-
- /*
- 'thd' has been set by exec_relay_log_event(), just before calling
- do_apply_event(). We still check here to prevent future coding
- errors.
- */
- DBUG_ASSERT(rgi->thd == thd);
-
- /*
- If there is no locks taken, this is the first binrow event seen
- after the table map events. We should then lock all the tables
- used in the transaction and proceed with execution of the actual
- event.
- */
- if (!thd->lock)
- {
- /*
- Lock_tables() reads the contents of thd->lex, so they must be
- initialized.
-
- We also call the THD::reset_for_next_command(), since this
- is the logical start of the next "statement". Note that this
- call might reset the value of current_stmt_binlog_format, so
- we need to do any changes to that value after this function.
- */
- delete_explain_query(thd->lex);
- lex_start(thd);
- thd->reset_for_next_command();
- /*
- The current statement is just about to begin and
- has not yet modified anything. Note, all.modified is reset
- by THD::reset_for_next_command().
- */
- thd->transaction.stmt.modified_non_trans_table= FALSE;
- thd->transaction.stmt.m_unsafe_rollback_flags&= ~THD_TRANS::DID_WAIT;
- /*
- This is a row injection, so we flag the "statement" as
- such. Note that this code is called both when the slave does row
- injections and when the BINLOG statement is used to do row
- injections.
- */
- thd->lex->set_stmt_row_injection();
-
- /*
- There are a few flags that are replicated with each row event.
- Make sure to set/clear them before executing the main body of
- the event.
- */
- if (get_flags(NO_FOREIGN_KEY_CHECKS_F))
- thd->variables.option_bits|= OPTION_NO_FOREIGN_KEY_CHECKS;
- else
- thd->variables.option_bits&= ~OPTION_NO_FOREIGN_KEY_CHECKS;
-
- if (get_flags(RELAXED_UNIQUE_CHECKS_F))
- thd->variables.option_bits|= OPTION_RELAXED_UNIQUE_CHECKS;
- else
- thd->variables.option_bits&= ~OPTION_RELAXED_UNIQUE_CHECKS;
-
- if (get_flags(NO_CHECK_CONSTRAINT_CHECKS_F))
- thd->variables.option_bits|= OPTION_NO_CHECK_CONSTRAINT_CHECKS;
- else
- thd->variables.option_bits&= ~OPTION_NO_CHECK_CONSTRAINT_CHECKS;
-
- /* A small test to verify that objects have consistent types */
- DBUG_ASSERT(sizeof(thd->variables.option_bits) == sizeof(OPTION_RELAXED_UNIQUE_CHECKS));
-
- DBUG_EXECUTE_IF("rows_log_event_before_open_table",
- {
- const char action[] = "now SIGNAL before_open_table WAIT_FOR go_ahead_sql";
- DBUG_ASSERT(!debug_sync_set_action(thd, STRING_WITH_LEN(action)));
- };);
-
- if (slave_run_triggers_for_rbr)
- {
- LEX *lex= thd->lex;
- uint8 new_trg_event_map= get_trg_event_map();
-
- /*
- Trigger's procedures work with global table list. So we have to add
- rgi->tables_to_lock content there to get trigger's in the list.
-
- Then restore_empty_query_table_list() restore the list as it was
- */
- DBUG_ASSERT(lex->query_tables == NULL);
- if ((lex->query_tables= rgi->tables_to_lock))
- rgi->tables_to_lock->prev_global= &lex->query_tables;
-
- for (TABLE_LIST *tables= rgi->tables_to_lock; tables;
- tables= tables->next_global)
- {
- tables->trg_event_map= new_trg_event_map;
- lex->query_tables_last= &tables->next_global;
- }
- }
- if (unlikely(open_and_lock_tables(thd, rgi->tables_to_lock, FALSE, 0)))
- {
-#ifdef WITH_WSREP
- if (WSREP(thd))
- {
- WSREP_WARN("BF applier failed to open_and_lock_tables: %u, fatal: %d "
- "wsrep = (exec_mode: %d conflict_state: %d seqno: %lld)",
- thd->get_stmt_da()->sql_errno(),
- thd->is_fatal_error,
- thd->wsrep_cs().mode(),
- thd->wsrep_trx().state(),
- (long long) wsrep_thd_trx_seqno(thd));
- }
-#endif /* WITH_WSREP */
- if (thd->is_error() &&
- !is_parallel_retry_error(rgi, error= thd->get_stmt_da()->sql_errno()))
- {
- /*
- Error reporting borrowed from Query_log_event with many excessive
- simplifications.
- We should not honour --slave-skip-errors at this point as we are
- having severe errors which should not be skipped.
- */
- rli->report(ERROR_LEVEL, error, rgi->gtid_info(),
- "Error executing row event: '%s'",
- (error ? thd->get_stmt_da()->message() :
- "unexpected success or fatal error"));
- thd->is_slave_error= 1;
- }
- /* remove trigger's tables */
- goto err;
- }
-
- /*
- When the open and locking succeeded, we check all tables to
- ensure that they still have the correct type.
- */
-
- {
- DBUG_PRINT("debug", ("Checking compability of tables to lock - tables_to_lock: %p",
- rgi->tables_to_lock));
-
- /**
- When using RBR and MyISAM MERGE tables the base tables that make
- up the MERGE table can be appended to the list of tables to lock.
-
- Thus, we just check compatibility for those that tables that have
- a correspondent table map event (ie, those that are actually going
- to be accessed while applying the event). That's why the loop stops
- at rli->tables_to_lock_count .
-
- NOTE: The base tables are added here are removed when
- close_thread_tables is called.
- */
- TABLE_LIST *table_list_ptr= rgi->tables_to_lock;
- for (uint i=0 ; table_list_ptr && (i < rgi->tables_to_lock_count);
- table_list_ptr= table_list_ptr->next_global, i++)
- {
- /*
- Below if condition takes care of skipping base tables that
- make up the MERGE table (which are added by open_tables()
- call). They are added next to the merge table in the list.
- For eg: If RPL_TABLE_LIST is t3->t1->t2 (where t1 and t2
- are base tables for merge table 't3'), open_tables will modify
- the list by adding t1 and t2 again immediately after t3 in the
- list (*not at the end of the list*). New table_to_lock list will
- look like t3->t1'->t2'->t1->t2 (where t1' and t2' are TABLE_LIST
- objects added by open_tables() call). There is no flag(or logic) in
- open_tables() that can skip adding these base tables to the list.
- So the logic here should take care of skipping them.
-
- tables_to_lock_count logic will take care of skipping base tables
- that are added at the end of the list.
- For eg: If RPL_TABLE_LIST is t1->t2->t3, open_tables will modify
- the list into t1->t2->t3->t1'->t2'. t1' and t2' will be skipped
- because tables_to_lock_count logic in this for loop.
- */
- if (table_list_ptr->parent_l)
- continue;
- /*
- We can use a down cast here since we know that every table added
- to the tables_to_lock is a RPL_TABLE_LIST (or child table which is
- skipped above).
- */
- RPL_TABLE_LIST *ptr= static_cast<RPL_TABLE_LIST*>(table_list_ptr);
- DBUG_ASSERT(ptr->m_tabledef_valid);
- TABLE *conv_table;
- if (!ptr->m_tabledef.compatible_with(thd, rgi, ptr->table, &conv_table))
- {
- DBUG_PRINT("debug", ("Table: %s.%s is not compatible with master",
- ptr->table->s->db.str,
- ptr->table->s->table_name.str));
- /*
- We should not honour --slave-skip-errors at this point as we are
- having severe errors which should not be skiped.
- */
- thd->is_slave_error= 1;
- /* remove trigger's tables */
- error= ERR_BAD_TABLE_DEF;
- goto err;
- }
- DBUG_PRINT("debug", ("Table: %s.%s is compatible with master"
- " - conv_table: %p",
- ptr->table->s->db.str,
- ptr->table->s->table_name.str, conv_table));
- ptr->m_conv_table= conv_table;
- }
- }
-
- /*
- ... and then we add all the tables to the table map and but keep
- them in the tables to lock list.
-
- We also invalidate the query cache for all the tables, since
- they will now be changed.
-
- TODO [/Matz]: Maybe the query cache should not be invalidated
- here? It might be that a table is not changed, even though it
- was locked for the statement. We do know that each
- Rows_log_event contain at least one row, so after processing one
- Rows_log_event, we can invalidate the query cache for the
- associated table.
- */
- TABLE_LIST *ptr= rgi->tables_to_lock;
- for (uint i=0 ; ptr && (i < rgi->tables_to_lock_count); ptr= ptr->next_global, i++)
- {
- /*
- Please see comment in above 'for' loop to know the reason
- for this if condition
- */
- if (ptr->parent_l)
- continue;
- rgi->m_table_map.set_table(ptr->table_id, ptr->table);
- /*
- Following is passing flag about triggers on the server. The problem was
- to pass it between table map event and row event. I do it via extended
- TABLE_LIST (RPL_TABLE_LIST) but row event uses only TABLE so I need to
- find somehow the corresponding TABLE_LIST.
- */
- if (m_table_id == ptr->table_id)
- {
- ptr->table->master_had_triggers=
- ((RPL_TABLE_LIST*)ptr)->master_had_triggers;
- }
- }
-
-#ifdef HAVE_QUERY_CACHE
-#ifdef WITH_WSREP
- /*
- Moved invalidation right before the call to rows_event_stmt_cleanup(),
- to avoid query cache being polluted with stale entries,
- */
- if (! (WSREP(thd) && wsrep_thd_is_applying(thd)))
- {
-#endif /* WITH_WSREP */
- query_cache.invalidate_locked_for_write(thd, rgi->tables_to_lock);
-#ifdef WITH_WSREP
- }
-#endif /* WITH_WSREP */
-#endif
- }
-
- table= m_table= rgi->m_table_map.get_table(m_table_id);
-
- DBUG_PRINT("debug", ("m_table:%p, m_table_id: %llu%s",
- m_table, m_table_id,
- table && master_had_triggers ?
- " (master had triggers)" : ""));
- if (table)
- {
- master_had_triggers= table->master_had_triggers;
- bool transactional_table= table->file->has_transactions();
- /*
- table == NULL means that this table should not be replicated
- (this was set up by Table_map_log_event::do_apply_event()
- which tested replicate-* rules).
- */
-
- /*
- It's not needed to set_time() but
- 1) it continues the property that "Time" in SHOW PROCESSLIST shows how
- much slave is behind
- 2) it will be needed when we allow replication from a table with no
- TIMESTAMP column to a table with one.
- So we call set_time(), like in SBR. Presently it changes nothing.
- */
- thd->set_time(when, when_sec_part);
-
- if (m_width == table->s->fields && bitmap_is_set_all(&m_cols))
- set_flags(COMPLETE_ROWS_F);
-
- /*
- Set tables write and read sets.
-
- Read_set contains all slave columns (in case we are going to fetch
- a complete record from slave)
-
- Write_set equals the m_cols bitmap sent from master but it can be
- longer if slave has extra columns.
- */
-
- 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);
- table->rpl_write_set= table->write_set;
-
- /* 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
-
- // Do event specific preparations
- error= do_before_row_operations(rli);
-
- /*
- Bug#56662 Assertion failed: next_insert_id == 0, file handler.cc
- Don't allow generation of auto_increment value when processing
- rows event by setting 'MODE_NO_AUTO_VALUE_ON_ZERO'. The exception
- to this rule happens when the auto_inc column exists on some
- extra columns on the slave. In that case, do not force
- MODE_NO_AUTO_VALUE_ON_ZERO.
- */
- sql_mode_t saved_sql_mode= thd->variables.sql_mode;
- if (!is_auto_inc_in_extra_columns())
- thd->variables.sql_mode= MODE_NO_AUTO_VALUE_ON_ZERO;
-
- // row processing loop
-
- /*
- set the initial time of this ROWS statement if it was not done
- before in some other ROWS event.
- */
- rgi->set_row_stmt_start_timestamp();
-
- THD_STAGE_INFO(thd, stage_executing);
- do
- {
- /* in_use can have been set to NULL in close_tables_for_reopen */
- THD* old_thd= table->in_use;
- if (!table->in_use)
- table->in_use= thd;
-
- error= do_exec_row(rgi);
-
- if (unlikely(error))
- DBUG_PRINT("info", ("error: %s", HA_ERR(error)));
- DBUG_ASSERT(error != HA_ERR_RECORD_DELETED);
-
- table->in_use = old_thd;
-
- if (unlikely(error))
- {
- int actual_error= convert_handler_error(error, thd, table);
- bool idempotent_error= (idempotent_error_code(error) &&
- (slave_exec_mode == SLAVE_EXEC_MODE_IDEMPOTENT));
- bool ignored_error= (idempotent_error == 0 ?
- ignored_error_code(actual_error) : 0);
-
-#ifdef WITH_WSREP
- if (WSREP(thd) && wsrep_ignored_error_code(this, actual_error))
- {
- idempotent_error= true;
- thd->wsrep_has_ignored_error= true;
- }
-#endif /* WITH_WSREP */
- if (idempotent_error || ignored_error)
- {
- if (global_system_variables.log_warnings)
- slave_rows_error_report(WARNING_LEVEL, error, rgi, thd, table,
- get_type_str(),
- RPL_LOG_NAME, log_pos);
- thd->clear_error(1);
- error= 0;
- if (idempotent_error == 0)
- break;
- }
- }
-
- /*
- If m_curr_row_end was not set during event execution (e.g., because
- of errors) we can't proceed to the next row. If the error is transient
- (i.e., error==0 at this point) we must call unpack_current_row() to set
- m_curr_row_end.
- */
-
- DBUG_PRINT("info", ("curr_row: %p; curr_row_end: %p; rows_end:%p",
- m_curr_row, m_curr_row_end, m_rows_end));
-
- if (!m_curr_row_end && likely(!error))
- error= unpack_current_row(rgi);
-
- m_curr_row= m_curr_row_end;
-
- if (likely(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.
- */
- thd->variables.sql_mode= saved_sql_mode;
-
- {/**
- The following failure injecion works in cooperation with tests
- setting @@global.debug= 'd,stop_slave_middle_group'.
- The sql thread receives the killed status and will proceed
- to shutdown trying to finish incomplete events group.
- */
- DBUG_EXECUTE_IF("stop_slave_middle_group",
- if (thd->transaction.all.modified_non_trans_table)
- const_cast<Relay_log_info*>(rli)->abort_slave= 1;);
- }
-
- if (unlikely(error= do_after_row_operations(rli, error)) &&
- ignored_error_code(convert_handler_error(error, thd, table)))
- {
-
- if (global_system_variables.log_warnings)
- slave_rows_error_report(WARNING_LEVEL, error, rgi, thd, table,
- get_type_str(),
- RPL_LOG_NAME, log_pos);
- thd->clear_error(1);
- error= 0;
- }
- } // if (table)
-
-
- if (unlikely(error))
- {
- slave_rows_error_report(ERROR_LEVEL, error, rgi, thd, table,
- get_type_str(),
- RPL_LOG_NAME, log_pos);
- /*
- @todo We should probably not call
- reset_current_stmt_binlog_format_row() from here.
-
- Note: this applies to log_event_old.cc too.
- /Sven
- */
- thd->reset_current_stmt_binlog_format_row();
- thd->is_slave_error= 1;
- /* remove trigger's tables */
- goto err;
- }
-
- /* remove trigger's tables */
- if (slave_run_triggers_for_rbr)
- restore_empty_query_table_list(thd->lex);
-
-#if defined(WITH_WSREP) && defined(HAVE_QUERY_CACHE)
- if (WSREP(thd) && wsrep_thd_is_applying(thd))
- {
- query_cache.invalidate_locked_for_write(thd, rgi->tables_to_lock);
- }
-#endif /* WITH_WSREP && HAVE_QUERY_CACHE */
-
- if (unlikely(get_flags(STMT_END_F) &&
- (error= rows_event_stmt_cleanup(rgi, thd))))
- slave_rows_error_report(ERROR_LEVEL,
- thd->is_error() ? 0 : error,
- rgi, thd, table,
- get_type_str(),
- RPL_LOG_NAME, log_pos);
- DBUG_RETURN(error);
-
-err:
- if (slave_run_triggers_for_rbr)
- restore_empty_query_table_list(thd->lex);
- rgi->slave_close_thread_tables(thd);
- DBUG_RETURN(error);
-}
-
-Log_event::enum_skip_reason
-Rows_log_event::do_shall_skip(rpl_group_info *rgi)
-{
- /*
- If the slave skip counter is 1 and this event does not end a
- statement, then we should not start executing on the next event.
- Otherwise, we defer the decision to the normal skipping logic.
- */
- if (rgi->rli->slave_skip_counter == 1 && !get_flags(STMT_END_F))
- return Log_event::EVENT_SKIP_IGNORE;
- else
- return Log_event::do_shall_skip(rgi);
-}
-
-/**
- The function is called at Rows_log_event statement commit time,
- normally from Rows_log_event::do_update_pos() and possibly from
- Query_log_event::do_apply_event() of the COMMIT.
- The function commits the last statement for engines, binlog and
- releases resources have been allocated for the statement.
-
- @retval 0 Ok.
- @retval non-zero Error at the commit.
- */
-
-static int rows_event_stmt_cleanup(rpl_group_info *rgi, THD * thd)
-{
- int error;
- DBUG_ENTER("rows_event_stmt_cleanup");
-
- {
- /*
- This is the end of a statement or transaction, so close (and
- unlock) the tables we opened when processing the
- Table_map_log_event starting the statement.
-
- OBSERVER. This will clear *all* mappings, not only those that
- are open for the table. There is not good handle for on-close
- actions for tables.
-
- NOTE. Even if we have no table ('table' == 0) we still need to be
- here, so that we increase the group relay log position. If we didn't, we
- could have a group relay log position which lags behind "forever"
- (assume the last master's transaction is ignored by the slave because of
- replicate-ignore rules).
- */
- error= thd->binlog_flush_pending_rows_event(TRUE);
-
- /*
- If this event is not in a transaction, the call below will, if some
- transactional storage engines are involved, commit the statement into
- them and flush the pending event to binlog.
- If this event is in a transaction, the call will do nothing, but a
- Xid_log_event will come next which will, if some transactional engines
- are involved, commit the transaction and flush the pending event to the
- binlog.
- If there was a deadlock the transaction should have been rolled back
- already. So there should be no need to rollback the transaction.
- */
- DBUG_ASSERT(! thd->transaction_rollback_request);
- error|= (int)(error ? trans_rollback_stmt(thd) : trans_commit_stmt(thd));
-
- /*
- Now what if this is not a transactional engine? we still need to
- flush the pending event to the binlog; we did it with
- thd->binlog_flush_pending_rows_event(). Note that we imitate
- what is done for real queries: a call to
- ha_autocommit_or_rollback() (sometimes only if involves a
- transactional engine), and a call to be sure to have the pending
- event flushed.
- */
-
- /*
- @todo We should probably not call
- reset_current_stmt_binlog_format_row() from here.
-
- Note: this applies to log_event_old.cc too
-
- Btw, the previous comment about transactional engines does not
- seem related to anything that happens here.
- /Sven
- */
- thd->reset_current_stmt_binlog_format_row();
-
- /*
- Reset modified_non_trans_table that we have set in
- rows_log_event::do_apply_event()
- */
- if (!thd->in_multi_stmt_transaction_mode())
- {
- thd->transaction.all.modified_non_trans_table= 0;
- thd->transaction.all.m_unsafe_rollback_flags&= ~THD_TRANS::DID_WAIT;
- }
-
- rgi->cleanup_context(thd, 0);
- }
- DBUG_RETURN(error);
-}
-
-/**
- The method either increments the relay log position or
- commits the current statement and increments the master group
- possition if the event is STMT_END_F flagged and
- the statement corresponds to the autocommit query (i.e replicated
- without wrapping in BEGIN/COMMIT)
-
- @retval 0 Success
- @retval non-zero Error in the statement commit
- */
-int
-Rows_log_event::do_update_pos(rpl_group_info *rgi)
-{
- Relay_log_info *rli= rgi->rli;
- int error= 0;
- DBUG_ENTER("Rows_log_event::do_update_pos");
-
- DBUG_PRINT("info", ("flags: %s",
- get_flags(STMT_END_F) ? "STMT_END_F " : ""));
-
- if (get_flags(STMT_END_F))
- {
- /*
- Indicate that a statement is finished.
- Step the group log position if we are not in a transaction,
- otherwise increase the event log position.
- */
- error= rli->stmt_done(log_pos, thd, rgi);
- /*
- Clear any errors in thd->net.last_err*. It is not known if this is
- needed or not. It is believed that any errors that may exist in
- thd->net.last_err* are allowed. Examples of errors are "key not
- found", which is produced in the test case rpl_row_conflicts.test
- */
- thd->clear_error();
- }
- else
- {
- rgi->inc_event_relay_log_pos();
- }
-
- DBUG_RETURN(error);
-}
-
-#endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */
-
-#ifndef MYSQL_CLIENT
-bool Rows_log_event::write_data_header()
-{
- uchar buf[ROWS_HEADER_LEN_V2]; // No need to init the buffer
- DBUG_ASSERT(m_table_id != ~0ULL);
- DBUG_EXECUTE_IF("old_row_based_repl_4_byte_map_id_master",
- {
- int4store(buf + 0, m_table_id);
- int2store(buf + 4, m_flags);
- return (write_data(buf, 6));
- });
- int6store(buf + RW_MAPID_OFFSET, m_table_id);
- int2store(buf + RW_FLAGS_OFFSET, m_flags);
- return write_data(buf, ROWS_HEADER_LEN);
-}
-
-bool Rows_log_event::write_data_body()
-{
- /*
- Note that this should be the number of *bits*, not the number of
- bytes.
- */
- uchar sbuf[MAX_INT_WIDTH];
- my_ptrdiff_t const data_size= m_rows_cur - m_rows_buf;
- bool res= false;
- uchar *const sbuf_end= net_store_length(sbuf, (size_t) m_width);
- DBUG_ASSERT(static_cast<size_t>(sbuf_end - sbuf) <= sizeof(sbuf));
-
- DBUG_DUMP("m_width", 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 || write_data((uchar*)m_cols.bitmap, no_bytes_in_map(&m_cols));
- /*
- TODO[refactor write]: Remove the "down cast" here (and elsewhere).
- */
- if (get_general_type_code() == UPDATE_ROWS_EVENT)
- {
- DBUG_DUMP("m_cols_ai", (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 || write_data(m_rows_buf, (size_t) data_size);
-
- return res;
-
-}
-
-bool Rows_log_event::write_compressed()
-{
- uchar *m_rows_buf_tmp = m_rows_buf;
- uchar *m_rows_cur_tmp = m_rows_cur;
- bool ret = true;
- uint32 comlen, alloc_size;
- comlen= alloc_size= binlog_get_compress_len((uint32)(m_rows_cur_tmp - m_rows_buf_tmp));
- m_rows_buf = (uchar *)my_safe_alloca(alloc_size);
- if(m_rows_buf &&
- !binlog_buf_compress((const char *)m_rows_buf_tmp, (char *)m_rows_buf,
- (uint32)(m_rows_cur_tmp - m_rows_buf_tmp), &comlen))
- {
- m_rows_cur= comlen + m_rows_buf;
- ret= Log_event::write();
- }
- my_safe_afree(m_rows_buf, alloc_size);
- m_rows_buf= m_rows_buf_tmp;
- m_rows_cur= m_rows_cur_tmp;
- return ret;
-}
-#endif
-
-#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-void Rows_log_event::pack_info(Protocol *protocol)
-{
- char buf[256];
- char const *const flagstr=
- get_flags(STMT_END_F) ? " flags: STMT_END_F" : "";
- size_t bytes= my_snprintf(buf, sizeof(buf),
- "table_id: %llu%s", m_table_id, flagstr);
- protocol->store(buf, bytes, &my_charset_bin);
-}
-#endif
-
-#ifdef MYSQL_CLIENT
-
-const char str_binlog[]= "\nBINLOG '\n";
-const char fmt_delim[]= "'%s\n";
-const char fmt_n_delim[]= "\n'%s";
-const char fmt_frag[]= "\nSET @binlog_fragment_%d ='\n";
-const char fmt_binlog2[]= "BINLOG @binlog_fragment_0, @binlog_fragment_1%s\n";
-
-/**
- Print an event "body" cache to @c file possibly in two fragments.
- Each fragement is optionally per @c do_wrap to produce an SQL statement.
-
- @param file a file to print to
- @param body the "body" IO_CACHE of event
- @param do_wrap whether to wrap base64-encoded strings with
- SQL cover.
- @param delimiter delimiter string
-
- @param is_verbose MDEV-10362 workraround parameter to pass
- info on presence of verbose printout in cache encoded data
-
- The function signals on any error through setting @c body->error to -1.
-*/
-bool copy_cache_to_file_wrapped(IO_CACHE *body,
- FILE *file,
- bool do_wrap,
- const char *delimiter,
- bool is_verbose)
-{
- const my_off_t cache_size= my_b_tell(body);
-
- if (reinit_io_cache(body, READ_CACHE, 0L, FALSE, FALSE))
- goto err;
-
- if (!do_wrap)
- {
- my_b_copy_to_file(body, file, SIZE_T_MAX);
- }
- else if (4 + sizeof(str_binlog) + cache_size + sizeof(fmt_delim) >
- opt_binlog_rows_event_max_encoded_size)
- {
- /*
- 2 fragments can always represent near 1GB row-based
- base64-encoded event as two strings each of size less than
- max(max_allowed_packet). Greater number of fragments does not
- save from potential need to tweak (increase) @@max_allowed_packet
- before to process the fragments. So 2 is safe and enough.
-
- Split the big query when its packet size's estimation exceeds a
- limit. The estimate includes the maximum packet header
- contribution of non-compressed packet.
- */
- my_fprintf(file, fmt_frag, 0);
- if (my_b_copy_to_file(body, file, (size_t) cache_size/2 + 1))
- goto err;
- my_fprintf(file, fmt_n_delim, delimiter);
-
- my_fprintf(file, fmt_frag, 1);
- if (my_b_copy_to_file(body, file, SIZE_T_MAX))
- goto err;
- if (!is_verbose)
- my_fprintf(file, fmt_delim, delimiter);
-
- my_fprintf(file, fmt_binlog2, delimiter);
- }
- else
- {
- my_fprintf(file, str_binlog);
- if (my_b_copy_to_file(body, file, SIZE_T_MAX))
- goto err;
- if (!is_verbose)
- my_fprintf(file, fmt_delim, delimiter);
- }
- reinit_io_cache(body, WRITE_CACHE, 0, FALSE, TRUE);
-
- return false;
-
-err:
- body->error = -1;
- return true;
-}
-
-
-/**
- Print an event "body" cache to @c file possibly in two fragments.
- Each fragement is optionally per @c do_wrap to produce an SQL statement.
-
- @param file a file to print to
- @param body the "body" IO_CACHE of event
- @param do_wrap whether to wrap base64-encoded strings with
- SQL cover.
- @param delimiter delimiter string
-
- The function signals on any error through setting @c body->error to -1.
-*/
-bool copy_cache_to_string_wrapped(IO_CACHE *cache,
- LEX_STRING *to,
- bool do_wrap,
- const char *delimiter,
- bool is_verbose)
-{
- const my_off_t cache_size= my_b_tell(cache);
- // contribution to total size estimate of formating
- const size_t fmt_size=
- sizeof(str_binlog) + 2*(sizeof(fmt_frag) + 2 /* %d */) +
- sizeof(fmt_delim) + sizeof(fmt_n_delim) +
- sizeof(fmt_binlog2) +
- 3*PRINT_EVENT_INFO::max_delimiter_size;
-
- if (reinit_io_cache(cache, READ_CACHE, 0L, FALSE, FALSE))
- goto err;
-
- if (!(to->str= (char*) my_malloc((size_t)cache->end_of_file + fmt_size,
- MYF(0))))
- {
- perror("Out of memory: can't allocate memory in "
- "copy_cache_to_string_wrapped().");
- goto err;
- }
-
- if (!do_wrap)
- {
- if (my_b_read(cache, (uchar*) to->str,
- (to->length= (size_t)cache->end_of_file)))
- goto err;
- }
- else if (4 + sizeof(str_binlog) + cache_size + sizeof(fmt_delim) >
- opt_binlog_rows_event_max_encoded_size)
- {
- /*
- 2 fragments can always represent near 1GB row-based
- base64-encoded event as two strings each of size less than
- max(max_allowed_packet). Greater number of fragments does not
- save from potential need to tweak (increase) @@max_allowed_packet
- before to process the fragments. So 2 is safe and enough.
-
- Split the big query when its packet size's estimation exceeds a
- limit. The estimate includes the maximum packet header
- contribution of non-compressed packet.
- */
- char *str= to->str;
- size_t add_to_len;
-
- str += (to->length= sprintf(str, fmt_frag, 0));
- if (my_b_read(cache, (uchar*) str, (uint32) (cache_size/2 + 1)))
- goto err;
- str += (add_to_len = (uint32) (cache_size/2 + 1));
- to->length += add_to_len;
- str += (add_to_len= sprintf(str, fmt_n_delim, delimiter));
- to->length += add_to_len;
-
- str += (add_to_len= sprintf(str, fmt_frag, 1));
- to->length += add_to_len;
- if (my_b_read(cache, (uchar*) str, uint32(cache->end_of_file - (cache_size/2 + 1))))
- goto err;
- str += (add_to_len= uint32(cache->end_of_file - (cache_size/2 + 1)));
- to->length += add_to_len;
- if (!is_verbose)
- {
- str += (add_to_len= sprintf(str , fmt_delim, delimiter));
- to->length += add_to_len;
- }
- to->length += sprintf(str, fmt_binlog2, delimiter);
- }
- else
- {
- char *str= to->str;
-
- str += (to->length= sprintf(str, str_binlog));
- if (my_b_read(cache, (uchar*) str, (size_t)cache->end_of_file))
- goto err;
- str += cache->end_of_file;
- to->length += (size_t)cache->end_of_file;
- if (!is_verbose)
- to->length += sprintf(str , fmt_delim, delimiter);
- }
-
- reinit_io_cache(cache, WRITE_CACHE, 0, FALSE, TRUE);
-
- return false;
-
-err:
- cache->error= -1;
- return true;
-}
-
-/**
- The function invokes base64 encoder to run on the current
- event string and store the result into two caches.
- When the event ends the current statement the caches are is copied into
- the argument file.
- Copying is also concerned how to wrap the event, specifically to produce
- a valid SQL syntax.
- When the encoded data size is within max(MAX_ALLOWED_PACKET)
- a regular BINLOG query is composed. Otherwise it is build as fragmented
-
- SET @binlog_fragment_0='...';
- SET @binlog_fragment_1='...';
- BINLOG @binlog_fragment_0, @binlog_fragment_1;
-
- where fragments are represented by a pair of indexed user
- "one shot" variables.
-
- @note
- If any changes made don't forget to duplicate them to
- Old_rows_log_event as long as it's supported.
-
- @param file pointer to IO_CACHE
- @param print_event_info pointer to print_event_info specializing
- what out of and how to print the event
- @param name the name of a table that the event operates on
-
- The function signals on any error of cache access through setting
- that cache's @c error to -1.
-*/
-bool Rows_log_event::print_helper(FILE *file,
- PRINT_EVENT_INFO *print_event_info,
- char const *const name)
-{
- IO_CACHE *const head= &print_event_info->head_cache;
- IO_CACHE *const body= &print_event_info->body_cache;
-#ifdef WHEN_FLASHBACK_REVIEW_READY
- IO_CACHE *const sql= &print_event_info->review_sql_cache;
-#endif
- bool do_print_encoded=
- print_event_info->base64_output_mode != BASE64_OUTPUT_NEVER &&
- print_event_info->base64_output_mode != BASE64_OUTPUT_DECODE_ROWS &&
- !print_event_info->short_form;
- bool const last_stmt_event= get_flags(STMT_END_F);
-
- if (!print_event_info->short_form)
- {
- char llbuff[22];
-
- print_header(head, print_event_info, !last_stmt_event);
- if (my_b_printf(head, "\t%s: table id %s%s\n",
- name, ullstr(m_table_id, llbuff),
- last_stmt_event ? " flags: STMT_END_F" : ""))
- goto err;
- }
- if (!print_event_info->short_form || print_event_info->print_row_count)
- if (print_base64(body, print_event_info, do_print_encoded))
- goto err;
-
- if (last_stmt_event)
- {
- if (!is_flashback)
- {
- if (copy_event_cache_to_file_and_reinit(head, file) ||
- copy_cache_to_file_wrapped(body, file, do_print_encoded,
- print_event_info->delimiter,
- print_event_info->verbose))
- goto err;
- }
- else
- {
- LEX_STRING tmp_str;
-
- if (copy_event_cache_to_string_and_reinit(head, &tmp_str))
- return 1;
- output_buf.append(tmp_str.str, tmp_str.length); // Not \0 terminated);
- my_free(tmp_str.str);
-
- if (copy_cache_to_string_wrapped(body, &tmp_str, do_print_encoded,
- print_event_info->delimiter,
- print_event_info->verbose))
- return 1;
- output_buf.append(tmp_str.str, tmp_str.length);
- my_free(tmp_str.str);
-#ifdef WHEN_FLASHBACK_REVIEW_READY
- if (copy_event_cache_to_string_and_reinit(sql, &tmp_str))
- return 1;
- output_buf.append(tmp_str.str, tmp_str.length);
- my_free(tmp_str.str);
-#endif
- }
- }
-
- return 0;
-err:
- return 1;
-}
-#endif
-
/**************************************************************************
Annotate_rows_log_event member functions
**************************************************************************/
-#ifndef MYSQL_CLIENT
-Annotate_rows_log_event::Annotate_rows_log_event(THD *thd,
- bool using_trans,
- bool direct)
- : Log_event(thd, 0, using_trans),
- m_save_thd_query_txt(0),
- m_save_thd_query_len(0),
- m_saved_thd_query(false),
- m_used_query_txt(0)
-{
- m_query_txt= thd->query();
- m_query_len= thd->query_length();
- if (direct)
- cache_type= Log_event::EVENT_NO_CACHE;
-}
-#endif
-
Annotate_rows_log_event::Annotate_rows_log_event(const char *buf,
uint event_len,
const Format_description_log_event *desc)
@@ -12309,103 +3377,6 @@ bool Annotate_rows_log_event::is_valid() const
return (m_query_txt != NULL && m_query_len != 0);
}
-#ifndef MYSQL_CLIENT
-bool Annotate_rows_log_event::write_data_header()
-{
- return 0;
-}
-#endif
-
-#ifndef MYSQL_CLIENT
-bool Annotate_rows_log_event::write_data_body()
-{
- return write_data(m_query_txt, m_query_len);
-}
-#endif
-
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
-void Annotate_rows_log_event::pack_info(Protocol* protocol)
-{
- if (m_query_txt && m_query_len)
- protocol->store(m_query_txt, m_query_len, &my_charset_bin);
-}
-#endif
-
-#ifdef MYSQL_CLIENT
-bool Annotate_rows_log_event::print(FILE *file, PRINT_EVENT_INFO *pinfo)
-{
- char *pbeg; // beginning of the next line
- char *pend; // end of the next line
- uint cnt= 0; // characters counter
-
- if (!pinfo->short_form)
- {
- if (print_header(&pinfo->head_cache, pinfo, TRUE) ||
- my_b_printf(&pinfo->head_cache, "\tAnnotate_rows:\n"))
- goto err;
- }
- else if (my_b_printf(&pinfo->head_cache, "# Annotate_rows:\n"))
- goto err;
-
- for (pbeg= m_query_txt; ; pbeg= pend)
- {
- // skip all \r's and \n's at the beginning of the next line
- for (;; pbeg++)
- {
- if (++cnt > m_query_len)
- return 0;
-
- if (*pbeg != '\r' && *pbeg != '\n')
- break;
- }
-
- // find end of the next line
- for (pend= pbeg + 1;
- ++cnt <= m_query_len && *pend != '\r' && *pend != '\n';
- pend++)
- ;
-
- // print next line
- if (my_b_write(&pinfo->head_cache, (const uchar*) "#Q> ", 4) ||
- my_b_write(&pinfo->head_cache, (const uchar*) pbeg, pend - pbeg) ||
- my_b_write(&pinfo->head_cache, (const uchar*) "\n", 1))
- goto err;
- }
-
- return 0;
-err:
- return 1;
-}
-#endif
-
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
-int Annotate_rows_log_event::do_apply_event(rpl_group_info *rgi)
-{
- rgi->free_annotate_event();
- m_save_thd_query_txt= thd->query();
- m_save_thd_query_len= thd->query_length();
- m_saved_thd_query= true;
- m_used_query_txt= 1;
- thd->set_query(m_query_txt, m_query_len);
- return 0;
-}
-#endif
-
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
-int Annotate_rows_log_event::do_update_pos(rpl_group_info *rgi)
-{
- rgi->inc_event_relay_log_pos();
- return 0;
-}
-#endif
-
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
-Log_event::enum_skip_reason
-Annotate_rows_log_event::do_shall_skip(rpl_group_info *rgi)
-{
- return continue_group(rgi);
-}
-#endif
/**************************************************************************
Table_map_log_event member functions and support functions
@@ -12443,142 +3414,6 @@ Annotate_rows_log_event::do_shall_skip(rpl_group_info *rgi)
type used is uint32.
*/
-#if !defined(MYSQL_CLIENT)
-/**
- Save the field metadata based on the real_type of the field.
- The metadata saved depends on the type of the field. Some fields
- store a single byte for pack_length() while others store two bytes
- for field_length (max length).
-
- @retval 0 Ok.
-
- @todo
- We may want to consider changing the encoding of the information.
- Currently, the code attempts to minimize the number of bytes written to
- the tablemap. There are at least two other alternatives; 1) using
- net_store_length() to store the data allowing it to choose the number of
- bytes that are appropriate thereby making the code much easier to
- maintain (only 1 place to change the encoding), or 2) use a fixed number
- of bytes for each field. The problem with option 1 is that net_store_length()
- will use one byte if the value < 251, but 3 bytes if it is > 250. Thus,
- for fields like CHAR which can be no larger than 255 characters, the method
- will use 3 bytes when the value is > 250. Further, every value that is
- encoded using 2 parts (e.g., pack_length, field_length) will be numerically
- > 250 therefore will use 3 bytes for eah value. The problem with option 2
- is less wasteful for space but does waste 1 byte for every field that does
- not encode 2 parts.
-*/
-int Table_map_log_event::save_field_metadata()
-{
- DBUG_ENTER("Table_map_log_event::save_field_metadata");
- int index= 0;
- for (unsigned int i= 0 ; i < m_table->s->fields ; i++)
- {
- DBUG_PRINT("debug", ("field_type: %d", m_coltype[i]));
- index+= m_table->s->field[i]->save_field_metadata(&m_field_metadata[index]);
- }
- DBUG_RETURN(index);
-}
-#endif /* !defined(MYSQL_CLIENT) */
-
-/*
- Constructor used to build an event for writing to the binary log.
- Mats says tbl->s lives longer than this event so it's ok to copy pointers
- (tbl->s->db etc) and not pointer content.
- */
-#if !defined(MYSQL_CLIENT)
-Table_map_log_event::Table_map_log_event(THD *thd, TABLE *tbl, ulong tid,
- bool is_transactional)
- : Log_event(thd, 0, is_transactional),
- m_table(tbl),
- m_dbnam(tbl->s->db.str),
- m_dblen(m_dbnam ? tbl->s->db.length : 0),
- m_tblnam(tbl->s->table_name.str),
- m_tbllen(tbl->s->table_name.length),
- m_colcnt(tbl->s->fields),
- m_memory(NULL),
- m_table_id(tid),
- m_flags(TM_BIT_LEN_EXACT_F),
- m_data_size(0),
- m_field_metadata(0),
- m_field_metadata_size(0),
- m_null_bits(0),
- m_meta_memory(NULL)
-{
- uchar cbuf[MAX_INT_WIDTH];
- uchar *cbuf_end;
- DBUG_ENTER("Table_map_log_event::Table_map_log_event(TABLE)");
- DBUG_ASSERT(m_table_id != ~0ULL);
- /*
- In TABLE_SHARE, "db" and "table_name" are 0-terminated (see this comment in
- table.cc / alloc_table_share():
- Use the fact the key is db/0/table_name/0
- As we rely on this let's assert it.
- */
- DBUG_ASSERT((tbl->s->db.str == 0) ||
- (tbl->s->db.str[tbl->s->db.length] == 0));
- DBUG_ASSERT(tbl->s->table_name.str[tbl->s->table_name.length] == 0);
-
-
- m_data_size= TABLE_MAP_HEADER_LEN;
- DBUG_EXECUTE_IF("old_row_based_repl_4_byte_map_id_master", m_data_size= 6;);
- m_data_size+= m_dblen + 2; // Include length and terminating \0
- m_data_size+= m_tbllen + 2; // Include length and terminating \0
- cbuf_end= net_store_length(cbuf, (size_t) m_colcnt);
- DBUG_ASSERT(static_cast<size_t>(cbuf_end - cbuf) <= sizeof(cbuf));
- m_data_size+= (cbuf_end - cbuf) + m_colcnt; // COLCNT and column types
-
- if (tbl->triggers)
- m_flags|= TM_BIT_HAS_TRIGGERS_F;
-
- /* If malloc fails, caught in is_valid() */
- if ((m_memory= (uchar*) my_malloc(m_colcnt, MYF(MY_WME))))
- {
- m_coltype= reinterpret_cast<uchar*>(m_memory);
- for (unsigned int i= 0 ; i < m_table->s->fields ; ++i)
- m_coltype[i]= m_table->field[i]->binlog_type();
- }
-
- /*
- Calculate a bitmap for the results of maybe_null() for all columns.
- The bitmap is used to determine when there is a column from the master
- that is not on the slave and is null and thus not in the row data during
- replication.
- */
- uint num_null_bytes= (m_table->s->fields + 7) / 8;
- m_data_size+= num_null_bytes;
- m_meta_memory= (uchar *)my_multi_malloc(MYF(MY_WME),
- &m_null_bits, num_null_bytes,
- &m_field_metadata, (m_colcnt * 2),
- NULL);
-
- bzero(m_field_metadata, (m_colcnt * 2));
-
- /*
- Create an array for the field metadata and store it.
- */
- m_field_metadata_size= save_field_metadata();
- DBUG_ASSERT(m_field_metadata_size <= (m_colcnt * 2));
-
- /*
- Now set the size of the data to the size of the field metadata array
- plus one or three bytes (see pack.c:net_store_length) for number of
- elements in the field metadata array.
- */
- if (m_field_metadata_size < 251)
- m_data_size+= m_field_metadata_size + 1;
- else
- m_data_size+= m_field_metadata_size + 3;
-
- bzero(m_null_bits, num_null_bytes);
- for (unsigned int i= 0 ; i < m_table->s->fields ; ++i)
- if (m_table->field[i]->maybe_null())
- m_null_bits[(i / 8)]+= 1 << (i % 8);
-
- DBUG_VOID_RETURN;
-}
-#endif /* !defined(MYSQL_CLIENT) */
-
/*
Constructor used by slave to read the event from the binary log.
*/
@@ -12595,7 +3430,8 @@ Table_map_log_event::Table_map_log_event(const char *buf, uint event_len,
m_colcnt(0), m_coltype(0),
m_memory(NULL), m_table_id(ULONGLONG_MAX), m_flags(0),
m_data_size(0), m_field_metadata(0), m_field_metadata_size(0),
- m_null_bits(0), m_meta_memory(NULL)
+ m_null_bits(0), m_meta_memory(NULL),
+ m_optional_metadata_len(0), m_optional_metadata(NULL)
{
unsigned int bytes_read= 0;
DBUG_ENTER("Table_map_log_event::Table_map_log_event(const char*,uint,...)");
@@ -12684,8 +3520,28 @@ Table_map_log_event::Table_map_log_event(const char *buf, uint event_len,
memcpy(m_field_metadata, ptr_after_colcnt, m_field_metadata_size);
ptr_after_colcnt= (uchar*)ptr_after_colcnt + m_field_metadata_size;
memcpy(m_null_bits, ptr_after_colcnt, num_null_bytes);
+ ptr_after_colcnt= (unsigned char*)ptr_after_colcnt + num_null_bytes;
+ }
+
+ bytes_read= (uint) (ptr_after_colcnt - (uchar *)buf);
+
+ /* After null_bits field, there are some new fields for extra metadata. */
+ if (bytes_read < event_len)
+ {
+ m_optional_metadata_len= event_len - bytes_read;
+ m_optional_metadata=
+ static_cast<unsigned char*>(my_malloc(m_optional_metadata_len, MYF(MY_WME)));
+ memcpy(m_optional_metadata, ptr_after_colcnt, m_optional_metadata_len);
}
}
+#ifdef MYSQL_SERVER
+ if (!m_table)
+ DBUG_VOID_RETURN;
+ binlog_type_info_array= (Binlog_type_info *)thd->alloc(m_table->s->fields *
+ sizeof(Binlog_type_info));
+ for (uint i= 0; i < m_table->s->fields; i++)
+ binlog_type_info_array[i]= m_table->field[i]->binlog_type_info();
+#endif
DBUG_VOID_RETURN;
}
@@ -12695,1635 +3551,270 @@ Table_map_log_event::~Table_map_log_event()
{
my_free(m_meta_memory);
my_free(m_memory);
+ my_free(m_optional_metadata);
+ m_optional_metadata= NULL;
}
+/**
+ Parses SIGNEDNESS field.
-#ifdef MYSQL_CLIENT
-
-/*
- Rewrite database name for the event to name specified by new_db
- SYNOPSIS
- new_db Database name to change to
- new_len Length
- desc Event describing binlog that we're writing to.
-
- DESCRIPTION
- Reset db name. This function assumes that temp_buf member contains event
- representation taken from a binary log. It resets m_dbnam and m_dblen and
- rewrites temp_buf with new db name.
-
- RETURN
- 0 - Success
- other - Error
-*/
-
-int Table_map_log_event::rewrite_db(const char* new_db, size_t new_len,
- const Format_description_log_event* desc)
-{
- DBUG_ENTER("Table_map_log_event::rewrite_db");
- DBUG_ASSERT(temp_buf);
-
- uint header_len= MY_MIN(desc->common_header_len,
- LOG_EVENT_MINIMAL_HEADER_LEN) + TABLE_MAP_HEADER_LEN;
- int len_diff;
-
- if (!(len_diff= (int)(new_len - m_dblen)))
- {
- memcpy((void*) (temp_buf + header_len + 1), new_db, m_dblen + 1);
- memcpy((void*) m_dbnam, new_db, m_dblen + 1);
- DBUG_RETURN(0);
- }
-
- // Create new temp_buf
- ulong event_cur_len= uint4korr(temp_buf + EVENT_LEN_OFFSET);
- ulong event_new_len= event_cur_len + len_diff;
- char* new_temp_buf= (char*) my_malloc(event_new_len, MYF(MY_WME));
-
- if (!new_temp_buf)
- {
- sql_print_error("Table_map_log_event::rewrite_db: "
- "failed to allocate new temp_buf (%d bytes required)",
- event_new_len);
- DBUG_RETURN(-1);
- }
-
- // Rewrite temp_buf
- char* ptr= new_temp_buf;
- size_t cnt= 0;
-
- // Copy header and change event length
- memcpy(ptr, temp_buf, header_len);
- int4store(ptr + EVENT_LEN_OFFSET, event_new_len);
- ptr += header_len;
- cnt += header_len;
-
- // Write new db name length and new name
- DBUG_ASSERT(new_len < 0xff);
- *ptr++ = (char)new_len;
- memcpy(ptr, new_db, new_len + 1);
- ptr += new_len + 1;
- cnt += m_dblen + 2;
-
- // Copy rest part
- memcpy(ptr, temp_buf + cnt, event_cur_len - cnt);
-
- // Reregister temp buf
- free_temp_buf();
- register_temp_buf(new_temp_buf, TRUE);
-
- // Reset m_dbnam and m_dblen members
- m_dblen= new_len;
-
- // m_dbnam resides in m_memory together with m_tblnam and m_coltype
- uchar* memory= m_memory;
- char const* tblnam= m_tblnam;
- uchar* coltype= m_coltype;
-
- m_memory= (uchar*) my_multi_malloc(MYF(MY_WME),
- &m_dbnam, (uint) m_dblen + 1,
- &m_tblnam, (uint) m_tbllen + 1,
- &m_coltype, (uint) m_colcnt,
- NullS);
-
- if (!m_memory)
- {
- sql_print_error("Table_map_log_event::rewrite_db: "
- "failed to allocate new m_memory (%d + %d + %d bytes required)",
- m_dblen + 1, m_tbllen + 1, m_colcnt);
- DBUG_RETURN(-1);
- }
-
- memcpy((void*)m_dbnam, new_db, m_dblen + 1);
- memcpy((void*)m_tblnam, tblnam, m_tbllen + 1);
- memcpy(m_coltype, coltype, m_colcnt);
-
- my_free(memory);
- DBUG_RETURN(0);
-}
-#endif /* MYSQL_CLIENT */
-
-
-/*
- Return value is an error code, one of:
-
- -1 Failure to open table [from open_tables()]
- 0 Success
- 1 No room for more tables [from set_table()]
- 2 Out of memory [from set_table()]
- 3 Wrong table definition
- 4 Daisy-chaining RBR with SBR not possible
+ @param[out] vec stores the signedness flags extracted from field.
+ @param[in] field SIGNEDNESS field in table_map_event.
+ @param[in] length length of the field
*/
-
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
-
-enum enum_tbl_map_status
+static void parse_signedness(std::vector<bool> &vec,
+ unsigned char *field, unsigned int length)
{
- /* no duplicate identifier found */
- OK_TO_PROCESS= 0,
-
- /* this table map must be filtered out */
- FILTERED_OUT= 1,
-
- /* identifier mapping table with different properties */
- SAME_ID_MAPPING_DIFFERENT_TABLE= 2,
-
- /* a duplicate identifier was found mapping the same table */
- SAME_ID_MAPPING_SAME_TABLE= 3
-};
-
-/*
- Checks if this table map event should be processed or not. First
- it checks the filtering rules, and then looks for duplicate identifiers
- in the existing list of rli->tables_to_lock.
-
- It checks that there hasn't been any corruption by verifying that there
- are no duplicate entries with different properties.
-
- In some cases, some binary logs could get corrupted, showing several
- tables mapped to the same table_id, 0 (see: BUG#56226). Thus we do this
- early sanity check for such cases and avoid that the server crashes
- later.
-
- In some corner cases, the master logs duplicate table map events, i.e.,
- same id, same database name, same table name (see: BUG#37137). This is
- different from the above as it's the same table that is mapped again
- to the same identifier. Thus we cannot just check for same ids and
- assume that the event is corrupted we need to check every property.
-
- NOTE: in the event that BUG#37137 ever gets fixed, this extra check
- will still be valid because we would need to support old binary
- logs anyway.
-
- @param rli The relay log info reference.
- @param table_list A list element containing the table to check against.
- @return OK_TO_PROCESS
- if there was no identifier already in rli->tables_to_lock
-
- FILTERED_OUT
- if the event is filtered according to the filtering rules
-
- SAME_ID_MAPPING_DIFFERENT_TABLE
- if the same identifier already maps a different table in
- rli->tables_to_lock
-
- SAME_ID_MAPPING_SAME_TABLE
- if the same identifier already maps the same table in
- rli->tables_to_lock.
-*/
-static enum_tbl_map_status
-check_table_map(rpl_group_info *rgi, RPL_TABLE_LIST *table_list)
-{
- DBUG_ENTER("check_table_map");
- enum_tbl_map_status res= OK_TO_PROCESS;
- Relay_log_info *rli= rgi->rli;
- if ((rgi->thd->slave_thread /* filtering is for slave only */ ||
- IF_WSREP((WSREP(rgi->thd) && rgi->thd->wsrep_applier), 0)) &&
- (!rli->mi->rpl_filter->db_ok(table_list->db.str) ||
- (rli->mi->rpl_filter->is_on() && !rli->mi->rpl_filter->tables_ok("", table_list))))
- res= FILTERED_OUT;
- else
+ for (unsigned int i= 0; i < length; i++)
{
- RPL_TABLE_LIST *ptr= static_cast<RPL_TABLE_LIST*>(rgi->tables_to_lock);
- for(uint i=0 ; ptr && (i< rgi->tables_to_lock_count);
- ptr= static_cast<RPL_TABLE_LIST*>(ptr->next_local), i++)
- {
- if (ptr->table_id == table_list->table_id)
- {
-
- if (cmp(&ptr->db, &table_list->db) ||
- cmp(&ptr->alias, &table_list->table_name) ||
- ptr->lock_type != TL_WRITE) // the ::do_apply_event always sets TL_WRITE
- res= SAME_ID_MAPPING_DIFFERENT_TABLE;
- else
- res= SAME_ID_MAPPING_SAME_TABLE;
-
- break;
- }
- }
+ for (unsigned char c= 0x80; c != 0; c>>= 1)
+ vec.push_back(field[i] & c);
}
-
- DBUG_PRINT("debug", ("check of table map ended up with: %u", res));
-
- DBUG_RETURN(res);
}
-int Table_map_log_event::do_apply_event(rpl_group_info *rgi)
-{
- RPL_TABLE_LIST *table_list;
- char *db_mem, *tname_mem, *ptr;
- size_t dummy_len, db_mem_length, tname_mem_length;
- void *memory;
- Rpl_filter *filter;
- Relay_log_info const *rli= rgi->rli;
- DBUG_ENTER("Table_map_log_event::do_apply_event(Relay_log_info*)");
-
- /* Step the query id to mark what columns that are actually used. */
- thd->set_query_id(next_query_id());
-
- if (!(memory= my_multi_malloc(MYF(MY_WME),
- &table_list, (uint) sizeof(RPL_TABLE_LIST),
- &db_mem, (uint) NAME_LEN + 1,
- &tname_mem, (uint) NAME_LEN + 1,
- NullS)))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
-
- db_mem_length= strmov(db_mem, m_dbnam) - db_mem;
- tname_mem_length= strmov(tname_mem, m_tblnam) - tname_mem;
- if (lower_case_table_names)
- {
- my_casedn_str(files_charset_info, (char*)tname_mem);
- my_casedn_str(files_charset_info, (char*)db_mem);
- }
-
- /* call from mysql_client_binlog_statement() will not set rli->mi */
- filter= rgi->thd->slave_thread ? rli->mi->rpl_filter : global_rpl_filter;
-
- /* rewrite rules changed the database */
- if (((ptr= (char*) filter->get_rewrite_db(db_mem, &dummy_len)) != db_mem))
- db_mem_length= strmov(db_mem, ptr) - db_mem;
-
- LEX_CSTRING tmp_db_name= {db_mem, db_mem_length };
- LEX_CSTRING tmp_tbl_name= {tname_mem, tname_mem_length };
-
- table_list->init_one_table(&tmp_db_name, &tmp_tbl_name, 0, TL_WRITE);
- table_list->table_id= DBUG_EVALUATE_IF("inject_tblmap_same_id_maps_diff_table", 0, m_table_id);
- table_list->updating= 1;
- table_list->required_type= TABLE_TYPE_NORMAL;
-
- DBUG_PRINT("debug", ("table: %s is mapped to %llu",
- table_list->table_name.str,
- table_list->table_id));
- table_list->master_had_triggers= ((m_flags & TM_BIT_HAS_TRIGGERS_F) ? 1 : 0);
- DBUG_PRINT("debug", ("table->master_had_triggers=%d",
- (int)table_list->master_had_triggers));
-
- enum_tbl_map_status tblmap_status= check_table_map(rgi, table_list);
- if (tblmap_status == OK_TO_PROCESS)
- {
- DBUG_ASSERT(thd->lex->query_tables != table_list);
-
- /*
- Use placement new to construct the table_def instance in the
- memory allocated for it inside table_list.
-
- The memory allocated by the table_def structure (i.e., not the
- memory allocated *for* the table_def structure) is released
- inside Relay_log_info::clear_tables_to_lock() by calling the
- table_def destructor explicitly.
- */
- new (&table_list->m_tabledef)
- table_def(m_coltype, m_colcnt,
- m_field_metadata, m_field_metadata_size,
- m_null_bits, m_flags);
- table_list->m_tabledef_valid= TRUE;
- table_list->m_conv_table= NULL;
- table_list->open_type= OT_BASE_ONLY;
-
- /*
- We record in the slave's information that the table should be
- locked by linking the table into the list of tables to lock.
- */
- table_list->next_global= table_list->next_local= rgi->tables_to_lock;
- rgi->tables_to_lock= table_list;
- rgi->tables_to_lock_count++;
- /* 'memory' is freed in clear_tables_to_lock */
- }
- else // FILTERED_OUT, SAME_ID_MAPPING_*
- {
- /*
- If mapped already but with different properties, we raise an
- error.
- If mapped already but with same properties we skip the event.
- If filtered out we skip the event.
-
- In all three cases, we need to free the memory previously
- allocated.
- */
- if (tblmap_status == SAME_ID_MAPPING_DIFFERENT_TABLE)
- {
- /*
- Something bad has happened. We need to stop the slave as strange things
- could happen if we proceed: slave crash, wrong table being updated, ...
- As a consequence we push an error in this case.
- */
-
- char buf[256];
-
- my_snprintf(buf, sizeof(buf),
- "Found table map event mapping table id %u which "
- "was already mapped but with different settings.",
- table_list->table_id);
-
- if (thd->slave_thread)
- rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, rgi->gtid_info(),
- 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_error(ER_SLAVE_FATAL_ERROR, MYF(0), buf);
- }
-
- my_free(memory);
- }
-
- DBUG_RETURN(tblmap_status == SAME_ID_MAPPING_DIFFERENT_TABLE);
-}
-
-Log_event::enum_skip_reason
-Table_map_log_event::do_shall_skip(rpl_group_info *rgi)
-{
- /*
- If the slave skip counter is 1, then we should not start executing
- on the next event.
- */
- return continue_group(rgi);
-}
-
-int Table_map_log_event::do_update_pos(rpl_group_info *rgi)
-{
- rgi->inc_event_relay_log_pos();
- return 0;
-}
-
-#endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */
-
-#ifndef MYSQL_CLIENT
-bool Table_map_log_event::write_data_header()
-{
- DBUG_ASSERT(m_table_id != ~0ULL);
- uchar buf[TABLE_MAP_HEADER_LEN];
- DBUG_EXECUTE_IF("old_row_based_repl_4_byte_map_id_master",
- {
- int4store(buf + 0, m_table_id);
- int2store(buf + 4, m_flags);
- return (write_data(buf, 6));
- });
- int6store(buf + TM_MAPID_OFFSET, m_table_id);
- int2store(buf + TM_FLAGS_OFFSET, m_flags);
- return write_data(buf, TABLE_MAP_HEADER_LEN);
-}
-
-bool Table_map_log_event::write_data_body()
-{
- DBUG_ASSERT(m_dbnam != NULL);
- DBUG_ASSERT(m_tblnam != NULL);
- /* We use only one byte per length for storage in event: */
- DBUG_ASSERT(m_dblen <= MY_MIN(NAME_LEN, 255));
- DBUG_ASSERT(m_tbllen <= MY_MIN(NAME_LEN, 255));
-
- uchar const dbuf[]= { (uchar) m_dblen };
- uchar const tbuf[]= { (uchar) m_tbllen };
-
- uchar cbuf[MAX_INT_WIDTH];
- uchar *const cbuf_end= net_store_length(cbuf, (size_t) m_colcnt);
- DBUG_ASSERT(static_cast<size_t>(cbuf_end - cbuf) <= sizeof(cbuf));
-
- /*
- Store the size of the field metadata.
- */
- uchar mbuf[MAX_INT_WIDTH];
- uchar *const mbuf_end= net_store_length(mbuf, m_field_metadata_size);
-
- 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
-
-#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
+/**
+ Parses DEFAULT_CHARSET field.
-/*
- Print some useful information for the SHOW BINARY LOG information
- field.
+ @param[out] default_charset stores collation numbers extracted from field.
+ @param[in] field DEFAULT_CHARSET field in table_map_event.
+ @param[in] length length of the field
*/
-
-#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-void Table_map_log_event::pack_info(Protocol *protocol)
+static void parse_default_charset(Table_map_log_event::Optional_metadata_fields::
+ Default_charset &default_charset,
+ unsigned char *field, unsigned int length)
{
- char buf[256];
- size_t bytes= my_snprintf(buf, sizeof(buf),
- "table_id: %llu (%s.%s)",
- m_table_id, m_dbnam, m_tblnam);
- protocol->store(buf, bytes, &my_charset_bin);
-}
-#endif
+ unsigned char* p= field;
-
-#endif
-
-
-#ifdef MYSQL_CLIENT
-bool Table_map_log_event::print(FILE *file, PRINT_EVENT_INFO *print_event_info)
-{
- if (!print_event_info->short_form)
+ default_charset.default_charset= net_field_length(&p);
+ while (p < field + length)
{
- char llbuff[22];
-
- print_header(&print_event_info->head_cache, print_event_info, TRUE);
- if (my_b_printf(&print_event_info->head_cache,
- "\tTable_map: %`s.%`s mapped to number %s%s\n",
- m_dbnam, m_tblnam, ullstr(m_table_id, llbuff),
- ((m_flags & TM_BIT_HAS_TRIGGERS_F) ?
- " (has triggers)" : "")))
- goto err;
- }
- if (!print_event_info->short_form || print_event_info->print_row_count)
- {
- bool do_print_encoded=
- print_event_info->base64_output_mode != BASE64_OUTPUT_NEVER &&
- print_event_info->base64_output_mode != BASE64_OUTPUT_DECODE_ROWS &&
- !print_event_info->short_form;
-
- if (print_base64(&print_event_info->body_cache, print_event_info,
- do_print_encoded) ||
- copy_event_cache_to_file_and_reinit(&print_event_info->head_cache,
- file))
- goto err;
- }
+ unsigned int col_index= net_field_length(&p);
+ unsigned int col_charset= net_field_length(&p);
- return 0;
-err:
- return 1;
+ default_charset.charset_pairs.push_back(std::make_pair(col_index,
+ col_charset));
+ }
}
-#endif
-/**************************************************************************
- Write_rows_log_event member functions
-**************************************************************************/
+/**
+ Parses COLUMN_CHARSET field.
-/*
- Constructor used to build an event for writing to the binary log.
+ @param[out] vec stores collation numbers extracted from field.
+ @param[in] field COLUMN_CHARSET field in table_map_event.
+ @param[in] length length of the field
*/
-#if !defined(MYSQL_CLIENT)
-Write_rows_log_event::Write_rows_log_event(THD *thd_arg, TABLE *tbl_arg,
- ulong tid_arg,
- bool is_transactional)
- :Rows_log_event(thd_arg, tbl_arg, tid_arg, tbl_arg->rpl_write_set,
- is_transactional, WRITE_ROWS_EVENT_V1)
+static void parse_column_charset(std::vector<unsigned int> &vec,
+ unsigned char *field, unsigned int length)
{
-}
+ unsigned char* p= field;
-Write_rows_compressed_log_event::Write_rows_compressed_log_event(
- THD *thd_arg,
- TABLE *tbl_arg,
- ulong tid_arg,
- bool is_transactional)
- : Write_rows_log_event(thd_arg, tbl_arg, tid_arg, is_transactional)
-{
- m_type = WRITE_ROWS_COMPRESSED_EVENT_V1;
+ while (p < field + length)
+ vec.push_back(net_field_length(&p));
}
-bool Write_rows_compressed_log_event::write()
-{
- return Rows_log_event::write_compressed();
-}
-#endif
+/**
+ Parses COLUMN_NAME field.
-/*
- Constructor used by slave to read the event from the binary log.
+ @param[out] vec stores column names extracted from field.
+ @param[in] field COLUMN_NAME field in table_map_event.
+ @param[in] length length of the field
*/
-#ifdef HAVE_REPLICATION
-Write_rows_log_event::Write_rows_log_event(const char *buf, uint event_len,
- const Format_description_log_event
- *description_event)
-: Rows_log_event(buf, event_len, description_event)
-{
-}
-
-Write_rows_compressed_log_event::Write_rows_compressed_log_event(
- const char *buf, uint event_len,
- const Format_description_log_event
- *description_event)
-: Write_rows_log_event(buf, event_len, description_event)
-{
- uncompress_buf();
-}
-#endif
-
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
-int
-Write_rows_log_event::do_before_row_operations(const Slave_reporting_capability *const)
-{
- int error= 0;
-
- /*
- Increment the global status insert count variable
- */
- if (get_flags(STMT_END_F))
- status_var_increment(thd->status_var.com_stat[SQLCOM_INSERT]);
-
- /**
- todo: to introduce a property for the event (handler?) which forces
- applying the event in the replace (idempotent) fashion.
- */
- if (slave_exec_mode == SLAVE_EXEC_MODE_IDEMPOTENT)
- {
- /*
- We are using REPLACE semantics and not INSERT IGNORE semantics
- when writing rows, that is: new rows replace old rows. We need to
- inform the storage engine that it should use this behaviour.
- */
-
- /* Tell the storage engine that we are using REPLACE semantics. */
- thd->lex->duplicates= DUP_REPLACE;
-
- /*
- Pretend we're executing a REPLACE command: this is needed for
- InnoDB since it is not (properly) checking the lex->duplicates flag.
- */
- thd->lex->sql_command= SQLCOM_REPLACE;
- /*
- Do not raise the error flag in case of hitting to an unique attribute
- */
- m_table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
- /*
- The following is needed in case if we have AFTER DELETE triggers.
- */
- m_table->file->extra(HA_EXTRA_WRITE_CAN_REPLACE);
- m_table->file->extra(HA_EXTRA_IGNORE_NO_KEY);
- }
- if (slave_run_triggers_for_rbr && !master_had_triggers && m_table->triggers )
- m_table->prepare_triggers_for_insert_stmt_or_event();
-
- /* Honor next number column if present */
- m_table->next_number_field= m_table->found_next_number_field;
- /*
- * Fixed Bug#45999, In RBR, Store engine of Slave auto-generates new
- * sequence numbers for auto_increment fields if the values of them are 0.
- * If generateing a sequence number is decided by the values of
- * table->auto_increment_field_not_null and SQL_MODE(if includes
- * MODE_NO_AUTO_VALUE_ON_ZERO) in update_auto_increment function.
- * SQL_MODE of slave sql thread is always consistency with master's.
- * In RBR, auto_increment fields never are NULL, except if the auto_inc
- * column exists only on the slave side (i.e., in an extra column
- * on the slave's table).
- */
- if (!is_auto_inc_in_extra_columns())
- m_table->auto_increment_field_not_null= TRUE;
- else
- {
- /*
- Here we have checked that there is an extra field
- on this server's table that has an auto_inc column.
-
- Mark that the auto_increment field is null and mark
- the read and write set bits.
-
- (There can only be one AUTO_INC column, it is always
- indexed and it cannot have a DEFAULT value).
- */
- m_table->auto_increment_field_not_null= FALSE;
- m_table->mark_auto_increment_column();
- }
-
- return error;
-}
-
-int
-Write_rows_log_event::do_after_row_operations(const Slave_reporting_capability *const,
- int error)
+static void parse_column_name(std::vector<std::string> &vec,
+ unsigned char *field, unsigned int length)
{
- int local_error= 0;
-
- /**
- Clear the write_set bit for auto_inc field that only
- existed on the destination table as an extra column.
- */
- if (is_auto_inc_in_extra_columns())
- {
- bitmap_clear_bit(m_table->rpl_write_set,
- m_table->next_number_field->field_index);
- bitmap_clear_bit(m_table->read_set,
- m_table->next_number_field->field_index);
+ unsigned char* p= field;
- if (get_flags(STMT_END_F))
- m_table->file->ha_release_auto_increment();
- }
- m_table->next_number_field=0;
- m_table->auto_increment_field_not_null= FALSE;
- if (slave_exec_mode == SLAVE_EXEC_MODE_IDEMPOTENT)
- {
- m_table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
- m_table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE);
- /*
- resetting the extra with
- table->file->extra(HA_EXTRA_NO_IGNORE_NO_KEY);
- fires bug#27077
- explanation: file->reset() performs this duty
- ultimately. Still todo: fix
- */
- }
- if (unlikely((local_error= m_table->file->ha_end_bulk_insert())))
+ while (p < field + length)
{
- m_table->file->print_error(local_error, MYF(0));
+ unsigned len= net_field_length(&p);
+ vec.push_back(std::string(reinterpret_cast<char *>(p), len));
+ p+= len;
}
- return error? error : local_error;
-}
-
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
-
-bool Rows_log_event::process_triggers(trg_event_type event,
- trg_action_time_type time_type,
- bool old_row_is_record1)
-{
- bool result;
- DBUG_ENTER("Rows_log_event::process_triggers");
- m_table->triggers->mark_fields_used(event);
- if (slave_run_triggers_for_rbr == SLAVE_RUN_TRIGGERS_FOR_RBR_YES)
- {
- tmp_disable_binlog(thd); /* Do not replicate the low-level changes. */
- result= m_table->triggers->process_triggers(thd, event,
- time_type, old_row_is_record1);
- reenable_binlog(thd);
- }
- else
- result= m_table->triggers->process_triggers(thd, event,
- time_type, old_row_is_record1);
-
- DBUG_RETURN(result);
-}
-/*
- Check if there are more UNIQUE keys after the given key.
-*/
-static int
-last_uniq_key(TABLE *table, uint keyno)
-{
- while (++keyno < table->s->keys)
- if (table->key_info[keyno].flags & HA_NOSAME)
- return 0;
- return 1;
}
/**
- Check if an error is a duplicate key error.
+ Parses SET_STR_VALUE/ENUM_STR_VALUE field.
- This function is used to check if an error code is one of the
- duplicate key error, i.e., and error code for which it is sensible
- to do a <code>get_dup_key()</code> to retrieve the duplicate key.
-
- @param errcode The error code to check.
-
- @return <code>true</code> if the error code is such that
- <code>get_dup_key()</code> will return true, <code>false</code>
- otherwise.
+ @param[out] vec stores SET/ENUM column's string values extracted from
+ field. Each SET/ENUM column's string values are stored
+ into a string separate vector. All of them are stored
+ in 'vec'.
+ @param[in] field COLUMN_NAME field in table_map_event.
+ @param[in] length length of the field
*/
-bool
-is_duplicate_key_error(int errcode)
-{
- switch (errcode)
- {
- case HA_ERR_FOUND_DUPP_KEY:
- case HA_ERR_FOUND_DUPP_UNIQUE:
- return true;
- }
- return false;
-}
-
-/**
- Write the current row into event's table.
-
- The row is located in the row buffer, pointed by @c m_curr_row member.
- Number of columns of the row is stored in @c m_width member (it can be
- different from the number of columns in the table to which we insert).
- Bitmap @c m_cols indicates which columns are present in the row. It is assumed
- that event's table is already open and pointed by @c m_table.
-
- If the same record already exists in the table it can be either overwritten
- or an error is reported depending on the value of @c overwrite flag
- (error reporting not yet implemented). Note that the matching record can be
- different from the row we insert if we use primary keys to identify records in
- the table.
-
- The row to be inserted can contain values only for selected columns. The
- missing columns are filled with default values using @c prepare_record()
- function. If a matching record is found in the table and @c overwritte is
- true, the missing columns are taken from it.
-
- @param rli Relay log info (needed for row unpacking).
- @param overwrite
- Shall we overwrite if the row already exists or signal
- error (currently ignored).
-
- @returns Error code on failure, 0 on success.
-
- This method, if successful, sets @c m_curr_row_end pointer to point at the
- next row in the rows buffer. This is done when unpacking the row to be
- inserted.
-
- @note If a matching record is found, it is either updated using
- @c ha_update_row() or first deleted and then new record written.
-*/
-
-int
-Rows_log_event::write_row(rpl_group_info *rgi,
- const bool overwrite)
+static void parse_set_str_value(std::vector<Table_map_log_event::
+ Optional_metadata_fields::str_vector> &vec,
+ unsigned char *field, unsigned int length)
{
- DBUG_ENTER("write_row");
- DBUG_ASSERT(m_table != NULL && thd != NULL);
+ unsigned char* p= field;
- TABLE *table= m_table; // pointer to event's table
- int error;
- int UNINIT_VAR(keynum);
- const bool invoke_triggers=
- slave_run_triggers_for_rbr && !master_had_triggers && table->triggers;
- auto_afree_ptr<char> key(NULL);
-
- prepare_record(table, m_width, true);
-
- /* unpack row into table->record[0] */
- if (unlikely((error= unpack_current_row(rgi))))
- {
- table->file->print_error(error, MYF(0));
- DBUG_RETURN(error);
- }
-
- if (m_curr_row == m_rows_buf && !invoke_triggers)
+ while (p < field + length)
{
- /*
- This table has no triggers so we can do bulk insert.
-
- 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.
- */
- /* 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));
- ha_rows 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);
- }
+ unsigned int count= net_field_length(&p);
- /*
- Explicitly set the auto_inc to null to make sure that
- it gets an auto_generated value.
- */
- if (is_auto_inc_in_extra_columns())
- m_table->next_number_field->set_null();
-
- DBUG_DUMP("record[0]", table->record[0], table->s->reclength);
- DBUG_PRINT_BITSET("debug", "rpl_write_set: %s", table->rpl_write_set);
- DBUG_PRINT_BITSET("debug", "read_set: %s", table->read_set);
-
- if (invoke_triggers &&
- unlikely(process_triggers(TRG_EVENT_INSERT, TRG_ACTION_BEFORE, TRUE)))
- {
- DBUG_RETURN(HA_ERR_GENERIC); // in case if error is not set yet
- }
-
- // Handle INSERT.
- if (table->versioned(VERS_TIMESTAMP))
- {
- ulong sec_part;
- bitmap_set_bit(table->read_set, table->vers_start_field()->field_index);
- table->file->column_bitmaps_signal();
- // Check whether a row came from unversioned table and fix vers fields.
- if (table->vers_start_field()->get_timestamp(&sec_part) == 0 && sec_part == 0)
- table->vers_update_fields();
- }
-
- /*
- Try to write record. If a corresponding record already exists in the table,
- we try to change it using ha_update_row() if possible. Otherwise we delete
- it and repeat the whole process again.
-
- TODO: Add safety measures against infinite looping.
- */
-
- if (table->s->sequence)
- error= update_sequence();
- else while (unlikely(error= table->file->ha_write_row(table->record[0])))
- {
- if (error == HA_ERR_LOCK_DEADLOCK ||
- error == HA_ERR_LOCK_WAIT_TIMEOUT ||
- (keynum= table->file->get_dup_key(error)) < 0 ||
- !overwrite)
+ vec.push_back(std::vector<std::string>());
+ for (unsigned int i= 0; i < count; i++)
{
- DBUG_PRINT("info",("get_dup_key returns %d)", keynum));
- /*
- Deadlock, waiting for lock or just an error from the handler
- such as HA_ERR_FOUND_DUPP_KEY when overwrite is false.
- Retrieval of the duplicate key number may fail
- - either because the error was not "duplicate key" error
- - or because the information which key is not available
- */
- table->file->print_error(error, MYF(0));
- DBUG_RETURN(error);
- }
- /*
- We need to retrieve the old row into record[1] to be able to
- either update or delete the offending record. We either:
-
- - use rnd_pos() with a row-id (available as dupp_row) to the
- offending row, if that is possible (MyISAM and Blackhole), or else
-
- - use index_read_idx() with the key that is duplicated, to
- retrieve the offending row.
- */
- if (table->file->ha_table_flags() & HA_DUPLICATE_POS)
- {
- DBUG_PRINT("info",("Locating offending record using rnd_pos()"));
-
- if ((error= table->file->ha_rnd_init_with_error(0)))
- {
- DBUG_RETURN(error);
- }
-
- error= table->file->ha_rnd_pos(table->record[1], table->file->dup_ref);
- if (unlikely(error))
- {
- DBUG_PRINT("info",("rnd_pos() returns error %d",error));
- table->file->print_error(error, MYF(0));
- DBUG_RETURN(error);
- }
- table->file->ha_rnd_end();
- }
- else
- {
- DBUG_PRINT("info",("Locating offending record using index_read_idx()"));
-
- if (table->file->extra(HA_EXTRA_FLUSH_CACHE))
- {
- DBUG_PRINT("info",("Error when setting HA_EXTRA_FLUSH_CACHE"));
- DBUG_RETURN(my_errno);
- }
-
- if (key.get() == NULL)
- {
- key.assign(static_cast<char*>(my_alloca(table->s->max_unique_length)));
- if (key.get() == NULL)
- {
- DBUG_PRINT("info",("Can't allocate key buffer"));
- DBUG_RETURN(ENOMEM);
- }
- }
-
- key_copy((uchar*)key.get(), table->record[0], table->key_info + keynum,
- 0);
- error= table->file->ha_index_read_idx_map(table->record[1], keynum,
- (const uchar*)key.get(),
- HA_WHOLE_KEY,
- HA_READ_KEY_EXACT);
- if (unlikely(error))
- {
- DBUG_PRINT("info",("index_read_idx() returns %s", HA_ERR(error)));
- table->file->print_error(error, MYF(0));
- DBUG_RETURN(error);
- }
- }
-
- /*
- Now, record[1] should contain the offending row. That
- will enable us to update it or, alternatively, delete it (so
- that we can insert the new row afterwards).
- */
-
- /*
- If row is incomplete we will use the record found to fill
- missing columns.
- */
- if (!get_flags(COMPLETE_ROWS_F))
- {
- restore_record(table,record[1]);
- error= unpack_current_row(rgi);
- }
-
- 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);
-
- /*
- REPLACE is defined as either INSERT or DELETE + INSERT. If
- possible, we can replace it with an UPDATE, but that will not
- work on InnoDB if FOREIGN KEY checks are necessary.
-
- I (Matz) am not sure of the reason for the last_uniq_key()
- check as, but I'm guessing that it's something along the
- following lines.
-
- Suppose that we got the duplicate key to be a key that is not
- the last unique key for the table and we perform an update:
- then there might be another key for which the unique check will
- fail, so we're better off just deleting the row and inserting
- the correct row.
-
- Additionally we don't use UPDATE if rbr triggers should be invoked -
- when triggers are used we want a simple and predictable execution path.
- */
- if (last_uniq_key(table, keynum) && !invoke_triggers &&
- !table->file->referenced_by_foreign_key())
- {
- DBUG_PRINT("info",("Updating row using ha_update_row()"));
- error= table->file->ha_update_row(table->record[1],
- table->record[0]);
- switch (error) {
-
- case HA_ERR_RECORD_IS_THE_SAME:
- DBUG_PRINT("info",("ignoring HA_ERR_RECORD_IS_THE_SAME error from"
- " ha_update_row()"));
- error= 0;
-
- case 0:
- break;
-
- default:
- DBUG_PRINT("info",("ha_update_row() returns error %d",error));
- table->file->print_error(error, MYF(0));
- }
-
- DBUG_RETURN(error);
- }
- else
- {
- DBUG_PRINT("info",("Deleting offending row and trying to write new one again"));
- if (invoke_triggers &&
- unlikely(process_triggers(TRG_EVENT_DELETE, TRG_ACTION_BEFORE,
- TRUE)))
- error= HA_ERR_GENERIC; // in case if error is not set yet
- else
- {
- if (unlikely((error= table->file->ha_delete_row(table->record[1]))))
- {
- DBUG_PRINT("info",("ha_delete_row() returns error %d",error));
- table->file->print_error(error, MYF(0));
- DBUG_RETURN(error);
- }
- if (invoke_triggers &&
- unlikely(process_triggers(TRG_EVENT_DELETE, TRG_ACTION_AFTER,
- TRUE)))
- DBUG_RETURN(HA_ERR_GENERIC); // in case if error is not set yet
- }
- /* Will retry ha_write_row() with the offending row removed. */
+ unsigned len1= net_field_length(&p);
+ vec.back().push_back(std::string(reinterpret_cast<char *>(p), len1));
+ p+= len1;
}
}
-
- if (invoke_triggers &&
- unlikely(process_triggers(TRG_EVENT_INSERT, TRG_ACTION_AFTER, TRUE)))
- error= HA_ERR_GENERIC; // in case if error is not set yet
-
- DBUG_RETURN(error);
}
+/**
+ Parses GEOMETRY_TYPE field.
-int Rows_log_event::update_sequence()
+ @param[out] vec stores geometry column's types extracted from field.
+ @param[in] field GEOMETRY_TYPE field in table_map_event.
+ @param[in] length length of the field
+ */
+static void parse_geometry_type(std::vector<unsigned int> &vec,
+ unsigned char *field, unsigned int length)
{
- TABLE *table= m_table; // pointer to event's table
+ unsigned char* p= field;
- if (!bitmap_is_set(table->rpl_write_set, MIN_VALUE_FIELD_NO))
- {
- /* This event come from a setval function executed on the master.
- Update the sequence next_number and round, like we do with setval()
- */
- my_bitmap_map *old_map= dbug_tmp_use_all_columns(table,
- table->read_set);
- longlong nextval= table->field[NEXT_FIELD_NO]->val_int();
- longlong round= table->field[ROUND_FIELD_NO]->val_int();
- dbug_tmp_restore_column_map(table->read_set, old_map);
-
- return table->s->sequence->set_value(table, nextval, round, 0) > 0;
- }
-
- /*
- Update all fields in table and update the active sequence, like with
- ALTER SEQUENCE
- */
- return table->file->ha_write_row(table->record[0]);
+ while (p < field + length)
+ vec.push_back(net_field_length(&p));
}
+/**
+ Parses SIMPLE_PRIMARY_KEY field.
-#endif
-
-int
-Write_rows_log_event::do_exec_row(rpl_group_info *rgi)
+ @param[out] vec stores primary key's column information extracted from
+ field. Each column has an index and a prefix which are
+ stored as a unit_pair. prefix is always 0 for
+ SIMPLE_PRIMARY_KEY field.
+ @param[in] field SIMPLE_PRIMARY_KEY field in table_map_event.
+ @param[in] length length of the field
+ */
+static void parse_simple_pk(std::vector<Table_map_log_event::
+ Optional_metadata_fields::uint_pair> &vec,
+ unsigned char *field, unsigned int length)
{
- DBUG_ASSERT(m_table != NULL);
- const char *tmp= thd->get_proc_info();
- const char *message= "Write_rows_log_event::write_row()";
- int error;
-
-#ifdef WSREP_PROC_INFO
- my_snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1,
- "Write_rows_log_event::write_row(%lld)",
- (long long) wsrep_thd_trx_seqno(thd));
- message= thd->wsrep_info;
-#endif /* WSREP_PROC_INFO */
-
- thd_proc_info(thd, message);
- error= write_row(rgi, slave_exec_mode == SLAVE_EXEC_MODE_IDEMPOTENT);
- thd_proc_info(thd, tmp);
-
- if (unlikely(error) && unlikely(!thd->is_error()))
- {
- DBUG_ASSERT(0);
- my_error(ER_UNKNOWN_ERROR, MYF(0));
- }
+ unsigned char* p= field;
- return error;
+ while (p < field + length)
+ vec.push_back(std::make_pair(net_field_length(&p), 0));
}
-#endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */
+/**
+ Parses PRIMARY_KEY_WITH_PREFIX field.
-#ifdef MYSQL_CLIENT
-bool Write_rows_log_event::print(FILE *file, PRINT_EVENT_INFO* print_event_info)
-{
- DBUG_EXECUTE_IF("simulate_cache_read_error",
- {DBUG_SET("+d,simulate_my_b_fill_error");});
- return Rows_log_event::print_helper(file, print_event_info, is_flashback ? "Delete_rows" : "Write_rows");
-}
+ @param[out] vec stores primary key's column information extracted from
+ field. Each column has an index and a prefix which are
+ stored as a unit_pair.
+ @param[in] field PRIMARY_KEY_WITH_PREFIX field in table_map_event.
+ @param[in] length length of the field
+ */
-bool Write_rows_compressed_log_event::print(FILE *file,
- PRINT_EVENT_INFO* print_event_info)
+static void parse_pk_with_prefix(std::vector<Table_map_log_event::
+ Optional_metadata_fields::uint_pair> &vec,
+ unsigned char *field, unsigned int length)
{
- char *new_buf;
- ulong len;
- bool is_malloc = false;
- if(!row_log_event_uncompress(glob_description_event,
- checksum_alg == BINLOG_CHECKSUM_ALG_CRC32,
- temp_buf, UINT_MAX32, NULL, 0, &is_malloc, &new_buf, &len))
- {
- free_temp_buf();
- register_temp_buf(new_buf, true);
- if (Rows_log_event::print_helper(file, print_event_info,
- "Write_compressed_rows"))
- goto err;
- }
- else
+ unsigned char* p= field;
+
+ while (p < field + length)
{
- if (my_b_printf(&print_event_info->head_cache,
- "ERROR: uncompress write_compressed_rows failed\n"))
- goto err;
+ unsigned int col_index= net_field_length(&p);
+ unsigned int col_prefix= net_field_length(&p);
+ vec.push_back(std::make_pair(col_index, col_prefix));
}
-
- return 0;
-err:
- return 1;
-}
-#endif
-
-
-#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
-uint8 Write_rows_log_event::get_trg_event_map()
-{
- return trg2bit(TRG_EVENT_INSERT) | trg2bit(TRG_EVENT_UPDATE) |
- trg2bit(TRG_EVENT_DELETE);
}
-#endif
-/**************************************************************************
- Delete_rows_log_event member functions
-**************************************************************************/
-
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
-/*
- Compares table->record[0] and table->record[1]
-
- Returns TRUE if different.
-*/
-static bool record_compare(TABLE *table)
+Table_map_log_event::Optional_metadata_fields::
+Optional_metadata_fields(unsigned char* optional_metadata,
+ unsigned int optional_metadata_len)
{
- bool result= FALSE;
- /**
- Compare full record only if:
- - there are no blob fields (otherwise we would also need
- to compare blobs contents as well);
- - there are no varchar fields (otherwise we would also need
- to compare varchar contents as well);
- - there are no null fields, otherwise NULLed fields
- contents (i.e., the don't care bytes) may show arbitrary
- values, depending on how each engine handles internally.
- */
- if ((table->s->blob_fields +
- table->s->varchar_fields +
- table->s->null_fields) == 0)
- {
- result= cmp_record(table,record[1]);
- goto record_compare_exit;
- }
+ unsigned char* field= optional_metadata;
- /* Compare null bits */
- if (memcmp(table->null_flags,
- table->null_flags+table->s->rec_buff_length,
- table->s->null_bytes))
- {
- result= TRUE; // Diff in NULL value
- goto record_compare_exit;
- }
+ if (optional_metadata == NULL)
+ return;
- /* Compare fields */
- for (Field **ptr=table->field ; *ptr ; ptr++)
+ while (field < optional_metadata + optional_metadata_len)
{
- if (table->versioned() && (*ptr)->vers_sys_field())
- {
- continue;
- }
- /**
- We only compare field contents that are not null.
- NULL fields (i.e., their null bits) were compared
- earlier.
- */
- if (!(*(ptr))->is_null())
- {
- if ((*ptr)->cmp_binary_offset(table->s->rec_buff_length))
- {
- result= TRUE;
- goto record_compare_exit;
- }
- }
- }
+ unsigned int len;
+ Optional_metadata_field_type type=
+ static_cast<Optional_metadata_field_type>(field[0]);
-record_compare_exit:
- return result;
-}
-
-
-/**
- Find the best key to use when locating the row in @c find_row().
-
- A primary key is preferred if it exists; otherwise a unique index is
- preferred. Else we pick the index with the smalles rec_per_key value.
-
- If a suitable key is found, set @c m_key, @c m_key_nr and @c m_key_info
- member fields appropriately.
-
- @returns Error code on failure, 0 on success.
-*/
-int Rows_log_event::find_key()
-{
- uint i, best_key_nr, last_part;
- KEY *key, *UNINIT_VAR(best_key);
- ulong UNINIT_VAR(best_rec_per_key), tmp;
- DBUG_ENTER("Rows_log_event::find_key");
- DBUG_ASSERT(m_table);
+ // Get length and move field to the value.
+ field++;
+ len= net_field_length(&field);
- best_key_nr= MAX_KEY;
-
- /*
- Keys are sorted so that any primary key is first, followed by unique keys,
- followed by any other. So we will automatically pick the primary key if
- it exists.
- */
- for (i= 0, key= m_table->key_info; i < m_table->s->keys; i++, key++)
- {
- if (!m_table->s->keys_in_use.is_set(i))
- continue;
- /*
- We cannot use a unique key with NULL-able columns to uniquely identify
- a row (but we can still select it for range scan below if nothing better
- is available).
- */
- if ((key->flags & (HA_NOSAME | HA_NULL_PART_KEY)) == HA_NOSAME)
+ switch(type)
{
- best_key_nr= i;
- best_key= key;
+ case SIGNEDNESS:
+ parse_signedness(m_signedness, field, len);
break;
+ case DEFAULT_CHARSET:
+ parse_default_charset(m_default_charset, field, len);
+ break;
+ case COLUMN_CHARSET:
+ parse_column_charset(m_column_charset, field, len);
+ break;
+ case COLUMN_NAME:
+ parse_column_name(m_column_name, field, len);
+ break;
+ case SET_STR_VALUE:
+ parse_set_str_value(m_set_str_value, field, len);
+ break;
+ case ENUM_STR_VALUE:
+ parse_set_str_value(m_enum_str_value, field, len);
+ break;
+ case GEOMETRY_TYPE:
+ parse_geometry_type(m_geometry_type, field, len);
+ break;
+ case SIMPLE_PRIMARY_KEY:
+ parse_simple_pk(m_primary_key, field, len);
+ break;
+ case PRIMARY_KEY_WITH_PREFIX:
+ parse_pk_with_prefix(m_primary_key, field, len);
+ break;
+ case ENUM_AND_SET_DEFAULT_CHARSET:
+ parse_default_charset(m_enum_and_set_default_charset, field, len);
+ break;
+ case ENUM_AND_SET_COLUMN_CHARSET:
+ parse_column_charset(m_enum_and_set_column_charset, field, len);
+ break;
+ default:
+ DBUG_ASSERT(0);
}
- /*
- We can only use a non-unique key if it allows range scans (ie. skip
- FULLTEXT indexes and such).
- */
- last_part= key->user_defined_key_parts - 1;
- DBUG_PRINT("info", ("Index %s rec_per_key[%u]= %lu",
- key->name.str, last_part, key->rec_per_key[last_part]));
- if (!(m_table->file->index_flags(i, last_part, 1) & HA_READ_NEXT))
- continue;
-
- tmp= key->rec_per_key[last_part];
- if (best_key_nr == MAX_KEY || (tmp > 0 && tmp < best_rec_per_key))
- {
- best_key_nr= i;
- best_key= key;
- best_rec_per_key= tmp;
- }
- }
-
- if (best_key_nr == MAX_KEY)
- {
- m_key_info= NULL;
- DBUG_RETURN(0);
+ // next field
+ field+= len;
}
-
- // Allocate buffer for key searches
- m_key= (uchar *) my_malloc(best_key->key_length, MYF(MY_WME));
- if (m_key == NULL)
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- m_key_info= best_key;
- m_key_nr= best_key_nr;
-
- DBUG_RETURN(0);;
}
-/*
- Check if we are already spending too much time on this statement.
- if we are, warn user that it might be because table does not have
- a PK, but only if the warning was not printed before for this STMT.
-
- @param type The event type code.
- @param table_name The name of the table that the slave is
- operating.
- @param is_index_scan States whether the slave is doing an index scan
- or not.
- @param rli The relay metadata info.
-*/
-static inline
-void issue_long_find_row_warning(Log_event_type type,
- const char *table_name,
- bool is_index_scan,
- rpl_group_info *rgi)
-{
- if ((global_system_variables.log_warnings > 1 &&
- !rgi->is_long_find_row_note_printed()))
- {
- ulonglong now= microsecond_interval_timer();
- ulonglong stmt_ts= rgi->get_row_stmt_start_timestamp();
-
- DBUG_EXECUTE_IF("inject_long_find_row_note",
- stmt_ts-=(LONG_FIND_ROW_THRESHOLD*2*HRTIME_RESOLUTION););
-
- longlong delta= (now - stmt_ts)/HRTIME_RESOLUTION;
-
- if (delta > LONG_FIND_ROW_THRESHOLD)
- {
- rgi->set_long_find_row_note_printed();
- const char* evt_type= LOG_EVENT_IS_DELETE_ROW(type) ? " DELETE" : "n UPDATE";
- const char* scan_type= is_index_scan ? "scanning an index" : "scanning the table";
-
- sql_print_information("The slave is applying a ROW event on behalf of a%s statement "
- "on table %s and is currently taking a considerable amount "
- "of time (%lld seconds). This is due to the fact that it is %s "
- "while looking up records to be processed. Consider adding a "
- "primary key (or unique key) to the table to improve "
- "performance.",
- evt_type, table_name, (long) delta, scan_type);
- }
- }
-}
+/**************************************************************************
+ Write_rows_log_event member functions
+**************************************************************************/
/*
- HA_ERR_KEY_NOT_FOUND is a fatal error normally, but it's an expected
- error in speculate optimistic mode, so use something non-fatal instead
-*/
-static int row_not_found_error(rpl_group_info *rgi)
+ Constructor used by slave to read the event from the binary log.
+ */
+#ifdef HAVE_REPLICATION
+Write_rows_log_event::Write_rows_log_event(const char *buf, uint event_len,
+ const Format_description_log_event
+ *description_event)
+: Rows_log_event(buf, event_len, description_event)
{
- return rgi->speculation != rpl_group_info::SPECULATE_OPTIMISTIC
- ? HA_ERR_KEY_NOT_FOUND : HA_ERR_RECORD_CHANGED;
}
-/**
- Locate the current row in event's table.
-
- The current row is pointed by @c m_curr_row. Member @c m_width tells
- how many columns are there in the row (this can be differnet from
- the number of columns in the table). It is assumed that event's
- table is already open and pointed by @c m_table.
-
- If a corresponding record is found in the table it is stored in
- @c m_table->record[0]. Note that when record is located based on a primary
- key, it is possible that the record found differs from the row being located.
-
- If no key is specified or table does not have keys, a table scan is used to
- find the row. In that case the row should be complete and contain values for
- all columns. However, it can still be shorter than the table, i.e. the table
- can contain extra columns not present in the row. It is also possible that
- the table has fewer columns than the row being located.
-
- @returns Error code on failure, 0 on success.
-
- @post In case of success @c m_table->record[0] contains the record found.
- Also, the internal "cursor" of the table is positioned at the record found.
-
- @note If the engine allows random access of the records, a combination of
- @c position() and @c rnd_pos() will be used.
-
- Note that one MUST call ha_index_or_rnd_end() after this function if
- it returns 0 as we must leave the row position in the handler intact
- for any following update/delete command.
-*/
-
-int Rows_log_event::find_row(rpl_group_info *rgi)
+Write_rows_compressed_log_event::Write_rows_compressed_log_event(
+ const char *buf, uint event_len,
+ const Format_description_log_event
+ *description_event)
+: Write_rows_log_event(buf, event_len, description_event)
{
- DBUG_ENTER("Rows_log_event::find_row");
-
- DBUG_ASSERT(m_table && m_table->in_use != NULL);
-
- TABLE *table= m_table;
- int error= 0;
- bool is_table_scan= false, is_index_scan= false;
-
- /*
- rpl_row_tabledefs.test specifies that
- if the extra field on the slave does not have a default value
- and this is okay with Delete or Update events.
- Todo: fix wl3228 hld that requires defauls for all types of events
- */
-
- prepare_record(table, m_width, FALSE);
- error= unpack_current_row(rgi);
-
- m_vers_from_plain= false;
- if (table->versioned())
- {
- Field *row_end= table->vers_end_field();
- DBUG_ASSERT(table->read_set);
- bitmap_set_bit(table->read_set, row_end->field_index);
- // check whether master table is unversioned
- if (row_end->val_int() == 0)
- {
- bitmap_set_bit(table->write_set, row_end->field_index);
- // Plain source table may have a PRIMARY KEY. And row_end is always
- // a part of PRIMARY KEY. Set it to max value for engine to find it in
- // index. Needed for an UPDATE/DELETE cases.
- table->vers_end_field()->set_max();
- m_vers_from_plain= true;
- }
- table->file->column_bitmaps_signal();
- }
-
- DBUG_PRINT("info",("looking for the following record"));
- DBUG_DUMP("record[0]", table->record[0], table->s->reclength);
-
- if ((table->file->ha_table_flags() & HA_PRIMARY_KEY_REQUIRED_FOR_POSITION) &&
- table->s->primary_key < MAX_KEY)
- {
- /*
- Use a more efficient method to fetch the record given by
- table->record[0] if the engine allows it. We first compute a
- row reference using the position() member function (it will be
- stored in table->file->ref) and the use rnd_pos() to position
- the "cursor" (i.e., record[0] in this case) at the correct row.
-
- TODO: Add a check that the correct record has been fetched by
- comparing with the original record. Take into account that the
- record on the master and slave can be of different
- length. Something along these lines should work:
-
- ADD>>> store_record(table,record[1]);
- int error= table->file->ha_rnd_pos(table->record[0],
- table->file->ref);
- ADD>>> DBUG_ASSERT(memcmp(table->record[1], table->record[0],
- table->s->reclength) == 0);
-
- */
- int error;
- DBUG_PRINT("info",("locating record using primary key (position)"));
-
- error= table->file->ha_rnd_pos_by_record(table->record[0]);
- if (unlikely(error))
- {
- DBUG_PRINT("info",("rnd_pos returns error %d",error));
- if (error == HA_ERR_KEY_NOT_FOUND)
- error= row_not_found_error(rgi);
- table->file->print_error(error, MYF(0));
- }
- DBUG_RETURN(error);
- }
-
- // We can't use position() - try other methods.
-
- /*
- We need to retrieve all fields
- TODO: Move this out from this function to main loop
- */
- table->use_all_columns();
-
- /*
- Save copy of the record in table->record[1]. It might be needed
- later if linear search is used to find exact match.
- */
- store_record(table,record[1]);
-
- if (m_key_info)
- {
- DBUG_PRINT("info",("locating record using key #%u [%s] (index_read)",
- m_key_nr, m_key_info->name.str));
- /* We use this to test that the correct key is used in test cases. */
- DBUG_EXECUTE_IF("slave_crash_if_wrong_index",
- if(0 != strcmp(m_key_info->name.str,"expected_key")) abort(););
-
- /* The key is active: search the table using the index */
- if (!table->file->inited &&
- (error= table->file->ha_index_init(m_key_nr, FALSE)))
- {
- DBUG_PRINT("info",("ha_index_init returns error %d",error));
- table->file->print_error(error, MYF(0));
- goto end;
- }
-
- /* Fill key data for the row */
-
- DBUG_ASSERT(m_key);
- key_copy(m_key, table->record[0], m_key_info, 0);
-
- /*
- Don't print debug messages when running valgrind since they can
- trigger false warnings.
- */
-#ifndef HAVE_valgrind
- DBUG_DUMP("key data", m_key, m_key_info->key_length);
-#endif
-
- /*
- We need to set the null bytes to ensure that the filler bit are
- all set when returning. There are storage engines that just set
- the necessary bits on the bytes and don't set the filler bits
- correctly.
- */
- if (table->s->null_bytes > 0)
- table->record[0][table->s->null_bytes - 1]|=
- 256U - (1U << table->s->last_null_bit_pos);
-
- if (unlikely((error= table->file->ha_index_read_map(table->record[0],
- m_key,
- HA_WHOLE_KEY,
- HA_READ_KEY_EXACT))))
- {
- DBUG_PRINT("info",("no record matching the key found in the table"));
- if (error == HA_ERR_KEY_NOT_FOUND)
- error= row_not_found_error(rgi);
- table->file->print_error(error, MYF(0));
- table->file->ha_index_end();
- goto end;
- }
-
- /*
- Don't print debug messages when running valgrind since they can
- trigger false warnings.
- */
-#ifndef HAVE_valgrind
- DBUG_PRINT("info",("found first matching record"));
- DBUG_DUMP("record[0]", table->record[0], table->s->reclength);
-#endif
- /*
- Below is a minor "optimization". If the key (i.e., key number
- 0) has the HA_NOSAME flag set, we know that we have found the
- correct record (since there can be no duplicates); otherwise, we
- have to compare the record with the one found to see if it is
- the correct one.
-
- CAVEAT! This behaviour is essential for the replication of,
- e.g., the mysql.proc table since the correct record *shall* be
- found using the primary key *only*. There shall be no
- comparison of non-PK columns to decide if the correct record is
- found. I can see no scenario where it would be incorrect to
- chose the row to change only using a PK or an UNNI.
- */
- if (table->key_info->flags & HA_NOSAME)
- {
- /* Unique does not have non nullable part */
- if (!(table->key_info->flags & (HA_NULL_PART_KEY)))
- {
- error= 0;
- goto end;
- }
- else
- {
- KEY *keyinfo= table->key_info;
- /*
- Unique has nullable part. We need to check if there is any
- field in the BI image that is null and part of UNNI.
- */
- bool null_found= FALSE;
- for (uint i=0; i < keyinfo->user_defined_key_parts && !null_found; i++)
- {
- uint fieldnr= keyinfo->key_part[i].fieldnr - 1;
- Field **f= table->field+fieldnr;
- null_found= (*f)->is_null();
- }
-
- if (!null_found)
- {
- error= 0;
- goto end;
- }
-
- /* else fall through to index scan */
- }
- }
-
- is_index_scan=true;
-
- /*
- In case key is not unique, we still have to iterate over records found
- and find the one which is identical to the row given. A copy of the
- record we are looking for is stored in record[1].
- */
- DBUG_PRINT("info",("non-unique index, scanning it to find matching record"));
- /* We use this to test that the correct key is used in test cases. */
- DBUG_EXECUTE_IF("slave_crash_if_index_scan", abort(););
-
- while (record_compare(table))
- {
- while ((error= table->file->ha_index_next(table->record[0])))
- {
- DBUG_PRINT("info",("no record matching the given row found"));
- table->file->print_error(error, MYF(0));
- table->file->ha_index_end();
- goto end;
- }
- }
- }
- else
- {
- DBUG_PRINT("info",("locating record using table scan (rnd_next)"));
- /* We use this to test that the correct key is used in test cases. */
- DBUG_EXECUTE_IF("slave_crash_if_table_scan", abort(););
-
- /* We don't have a key: search the table using rnd_next() */
- if (unlikely((error= table->file->ha_rnd_init_with_error(1))))
- {
- DBUG_PRINT("info",("error initializing table scan"
- " (ha_rnd_init returns %d)",error));
- goto end;
- }
-
- is_table_scan= true;
-
- /* Continue until we find the right record or have made a full loop */
- do
- {
- error= table->file->ha_rnd_next(table->record[0]);
-
- if (unlikely(error))
- DBUG_PRINT("info", ("error: %s", HA_ERR(error)));
- switch (error) {
-
- case 0:
- DBUG_DUMP("record found", table->record[0], table->s->reclength);
- break;
-
- case HA_ERR_END_OF_FILE:
- DBUG_PRINT("info", ("Record not found"));
- table->file->ha_rnd_end();
- goto end;
-
- default:
- DBUG_PRINT("info", ("Failed to get next record"
- " (rnd_next returns %d)",error));
- table->file->print_error(error, MYF(0));
- table->file->ha_rnd_end();
- goto end;
- }
- }
- while (record_compare(table));
-
- /*
- Note: above record_compare will take into accout all record fields
- which might be incorrect in case a partial row was given in the event
- */
-
- DBUG_ASSERT(error == HA_ERR_END_OF_FILE || error == 0);
- }
-
-end:
- if (is_table_scan || is_index_scan)
- issue_long_find_row_warning(get_general_type_code(), m_table->alias.c_ptr(),
- is_index_scan, rgi);
- table->default_column_bitmaps();
- DBUG_RETURN(error);
+ uncompress_buf();
}
-
#endif
-/*
- Constructor used to build an event for writing to the binary log.
- */
-
-#ifndef MYSQL_CLIENT
-Delete_rows_log_event::Delete_rows_log_event(THD *thd_arg, TABLE *tbl_arg,
- ulong tid, bool is_transactional)
- : Rows_log_event(thd_arg, tbl_arg, tid, tbl_arg->read_set, is_transactional,
- DELETE_ROWS_EVENT_V1)
-{
-}
-
-Delete_rows_compressed_log_event::Delete_rows_compressed_log_event(
- THD *thd_arg, TABLE *tbl_arg,
- ulong tid_arg,
- bool is_transactional)
- : Delete_rows_log_event(thd_arg, tbl_arg, tid_arg, is_transactional)
-{
- m_type= DELETE_ROWS_COMPRESSED_EVENT_V1;
-}
-bool Delete_rows_compressed_log_event::write()
-{
- return Rows_log_event::write_compressed();
-}
-#endif /* #if !defined(MYSQL_CLIENT) */
+/**************************************************************************
+ Delete_rows_log_event member functions
+**************************************************************************/
/*
Constructor used by slave to read the event from the binary log.
@@ -14346,199 +3837,10 @@ Delete_rows_compressed_log_event::Delete_rows_compressed_log_event(
}
#endif
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
-
-int
-Delete_rows_log_event::do_before_row_operations(const Slave_reporting_capability *const)
-{
- /*
- Increment the global status delete count variable
- */
- if (get_flags(STMT_END_F))
- status_var_increment(thd->status_var.com_stat[SQLCOM_DELETE]);
-
- if ((m_table->file->ha_table_flags() & HA_PRIMARY_KEY_REQUIRED_FOR_POSITION) &&
- m_table->s->primary_key < MAX_KEY)
- {
- /*
- We don't need to allocate any memory for m_key since it is not used.
- */
- return 0;
- }
- if (slave_run_triggers_for_rbr && !master_had_triggers)
- m_table->prepare_triggers_for_delete_stmt_or_event();
-
- return find_key();
-}
-
-int
-Delete_rows_log_event::do_after_row_operations(const Slave_reporting_capability *const,
- int error)
-{
- m_table->file->ha_index_or_rnd_end();
- my_free(m_key);
- m_key= NULL;
- m_key_info= NULL;
-
- return error;
-}
-
-int Delete_rows_log_event::do_exec_row(rpl_group_info *rgi)
-{
- int error;
- const char *tmp= thd->get_proc_info();
- const char *message= "Delete_rows_log_event::find_row()";
- const bool invoke_triggers=
- slave_run_triggers_for_rbr && !master_had_triggers && m_table->triggers;
- DBUG_ASSERT(m_table != NULL);
-
-#ifdef WSREP_PROC_INFO
- my_snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1,
- "Delete_rows_log_event::find_row(%lld)",
- (long long) wsrep_thd_trx_seqno(thd));
- message= thd->wsrep_info;
-#endif /* WSREP_PROC_INFO */
-
- thd_proc_info(thd, message);
- if (likely(!(error= find_row(rgi))))
- {
- /*
- Delete the record found, located in record[0]
- */
- message= "Delete_rows_log_event::ha_delete_row()";
-#ifdef WSREP_PROC_INFO
- snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1,
- "Delete_rows_log_event::ha_delete_row(%lld)",
- (long long) wsrep_thd_trx_seqno(thd));
- message= thd->wsrep_info;
-#endif
- thd_proc_info(thd, message);
-
- if (invoke_triggers &&
- unlikely(process_triggers(TRG_EVENT_DELETE, TRG_ACTION_BEFORE, FALSE)))
- error= HA_ERR_GENERIC; // in case if error is not set yet
- if (likely(!error))
- {
- m_table->mark_columns_per_binlog_row_image();
- if (m_vers_from_plain && m_table->versioned(VERS_TIMESTAMP))
- {
- Field *end= m_table->vers_end_field();
- bitmap_set_bit(m_table->write_set, end->field_index);
- store_record(m_table, record[1]);
- end->set_time();
- error= m_table->file->ha_update_row(m_table->record[1],
- m_table->record[0]);
- }
- else
- {
- error= m_table->file->ha_delete_row(m_table->record[0]);
- }
- m_table->default_column_bitmaps();
- }
- if (invoke_triggers && likely(!error) &&
- unlikely(process_triggers(TRG_EVENT_DELETE, TRG_ACTION_AFTER, FALSE)))
- error= HA_ERR_GENERIC; // in case if error is not set yet
- m_table->file->ha_index_or_rnd_end();
- }
- thd_proc_info(thd, tmp);
- return error;
-}
-
-#endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */
-
-#ifdef MYSQL_CLIENT
-bool Delete_rows_log_event::print(FILE *file,
- PRINT_EVENT_INFO* print_event_info)
-{
- return Rows_log_event::print_helper(file, print_event_info, is_flashback ? "Write_rows" : "Delete_rows");
-}
-
-bool Delete_rows_compressed_log_event::print(FILE *file,
- PRINT_EVENT_INFO* print_event_info)
-{
- char *new_buf;
- ulong len;
- bool is_malloc = false;
- if(!row_log_event_uncompress(glob_description_event,
- checksum_alg == BINLOG_CHECKSUM_ALG_CRC32,
- temp_buf, UINT_MAX32, NULL, 0, &is_malloc, &new_buf, &len))
- {
- free_temp_buf();
- register_temp_buf(new_buf, true);
- if (Rows_log_event::print_helper(file, print_event_info,
- "Delete_compressed_rows"))
- goto err;
- }
- else
- {
- if (my_b_printf(&print_event_info->head_cache,
- "ERROR: uncompress delete_compressed_rows failed\n"))
- goto err;
- }
-
- return 0;
-err:
- return 1;
-}
-#endif
-
-
-#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
-uint8 Delete_rows_log_event::get_trg_event_map()
-{
- return trg2bit(TRG_EVENT_DELETE);
-}
-#endif
-
/**************************************************************************
Update_rows_log_event member functions
**************************************************************************/
-/*
- Constructor used to build an event for writing to the binary log.
- */
-#if !defined(MYSQL_CLIENT)
-Update_rows_log_event::Update_rows_log_event(THD *thd_arg, TABLE *tbl_arg,
- ulong tid,
- bool is_transactional)
-: Rows_log_event(thd_arg, tbl_arg, tid, tbl_arg->read_set, is_transactional,
- UPDATE_ROWS_EVENT_V1)
-{
- init(tbl_arg->rpl_write_set);
-}
-
-Update_rows_compressed_log_event::Update_rows_compressed_log_event(THD *thd_arg, TABLE *tbl_arg,
- ulong tid,
- bool is_transactional)
-: Update_rows_log_event(thd_arg, tbl_arg, tid, is_transactional)
-{
- m_type = UPDATE_ROWS_COMPRESSED_EVENT_V1;
-}
-
-bool Update_rows_compressed_log_event::write()
-{
- return Rows_log_event::write_compressed();
-}
-
-void Update_rows_log_event::init(MY_BITMAP const *cols)
-{
- /* if my_bitmap_init fails, caught in is_valid() */
- if (likely(!my_bitmap_init(&m_cols_ai,
- m_width <= sizeof(m_bitbuf_ai)*8 ? m_bitbuf_ai : NULL,
- m_width,
- false)))
- {
- /* Cols can be zero if this is a dummy binrows event */
- if (likely(cols != NULL))
- {
- memcpy(m_cols_ai.bitmap, cols->bitmap, no_bytes_in_map(cols));
- create_last_word_mask(&m_cols_ai);
- }
- }
-}
-#endif /* !defined(MYSQL_CLIENT) */
-
-
Update_rows_log_event::~Update_rows_log_event()
{
if (m_cols_ai.bitmap == m_bitbuf_ai) // no my_malloc happened
@@ -14569,202 +3871,6 @@ Update_rows_compressed_log_event::Update_rows_compressed_log_event(
}
#endif
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
-
-int
-Update_rows_log_event::do_before_row_operations(const Slave_reporting_capability *const)
-{
- /*
- Increment the global status update count variable
- */
- if (get_flags(STMT_END_F))
- status_var_increment(thd->status_var.com_stat[SQLCOM_UPDATE]);
-
- int err;
- if ((err= find_key()))
- return err;
-
- if (slave_run_triggers_for_rbr && !master_had_triggers)
- m_table->prepare_triggers_for_update_stmt_or_event();
-
- return 0;
-}
-
-int
-Update_rows_log_event::do_after_row_operations(const Slave_reporting_capability *const,
- int error)
-{
- /*error= ToDo:find out what this should really be, this triggers close_scan in nbd, returning error?*/
- m_table->file->ha_index_or_rnd_end();
- my_free(m_key); // Free for multi_malloc
- m_key= NULL;
- m_key_info= NULL;
-
- return error;
-}
-
-int
-Update_rows_log_event::do_exec_row(rpl_group_info *rgi)
-{
- const bool invoke_triggers=
- slave_run_triggers_for_rbr && !master_had_triggers && m_table->triggers;
- const char *tmp= thd->get_proc_info();
- const char *message= "Update_rows_log_event::find_row()";
- DBUG_ASSERT(m_table != NULL);
-
-#ifdef WSREP_PROC_INFO
- my_snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1,
- "Update_rows_log_event::find_row(%lld)",
- (long long) wsrep_thd_trx_seqno(thd));
- message= thd->wsrep_info;
-#endif /* WSREP_PROC_INFO */
-
- thd_proc_info(thd, message);
- int error= find_row(rgi);
- if (unlikely(error))
- {
- /*
- We need to read the second image in the event of error to be
- able to skip to the next pair of updates
- */
- if ((m_curr_row= m_curr_row_end))
- unpack_current_row(rgi, &m_cols_ai);
- thd_proc_info(thd, tmp);
- return error;
- }
-
- /*
- This is the situation after locating BI:
-
- ===|=== before image ====|=== after image ===|===
- ^ ^
- m_curr_row m_curr_row_end
-
- BI found in the table is stored in record[0]. We copy it to record[1]
- and unpack AI to record[0].
- */
-
- store_record(m_table,record[1]);
-
- m_curr_row= m_curr_row_end;
- message= "Update_rows_log_event::unpack_current_row()";
-#ifdef WSREP_PROC_INFO
- my_snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1,
- "Update_rows_log_event::unpack_current_row(%lld)",
- (long long) wsrep_thd_trx_seqno(thd));
- message= thd->wsrep_info;
-#endif /* WSREP_PROC_INFO */
-
- /* this also updates m_curr_row_end */
- thd_proc_info(thd, message);
- if (unlikely((error= unpack_current_row(rgi, &m_cols_ai))))
- goto err;
-
- /*
- Now we have the right row to update. The old row (the one we're
- looking for) is in record[1] and the new row is in record[0].
- */
-#ifndef HAVE_valgrind
- /*
- Don't print debug messages when running valgrind since they can
- trigger false warnings.
- */
- DBUG_PRINT("info",("Updating row in table"));
- DBUG_DUMP("old record", m_table->record[1], m_table->s->reclength);
- DBUG_DUMP("new values", m_table->record[0], m_table->s->reclength);
-#endif
-
- message= "Update_rows_log_event::ha_update_row()";
-#ifdef WSREP_PROC_INFO
- my_snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1,
- "Update_rows_log_event::ha_update_row(%lld)",
- (long long) wsrep_thd_trx_seqno(thd));
- message= thd->wsrep_info;
-#endif /* WSREP_PROC_INFO */
-
- thd_proc_info(thd, message);
- if (invoke_triggers &&
- unlikely(process_triggers(TRG_EVENT_UPDATE, TRG_ACTION_BEFORE, TRUE)))
- {
- error= HA_ERR_GENERIC; // in case if error is not set yet
- 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();
- if (m_vers_from_plain && m_table->versioned(VERS_TIMESTAMP))
- m_table->vers_update_fields();
- error= m_table->file->ha_update_row(m_table->record[1], m_table->record[0]);
- if (unlikely(error == HA_ERR_RECORD_IS_THE_SAME))
- error= 0;
- if (m_vers_from_plain && m_table->versioned(VERS_TIMESTAMP))
- {
- store_record(m_table, record[2]);
- error= vers_insert_history_row(m_table);
- restore_record(m_table, record[2]);
- }
- m_table->default_column_bitmaps();
-
- if (invoke_triggers && likely(!error) &&
- unlikely(process_triggers(TRG_EVENT_UPDATE, TRG_ACTION_AFTER, TRUE)))
- error= HA_ERR_GENERIC; // in case if error is not set yet
-
- thd_proc_info(thd, tmp);
-
-err:
- m_table->file->ha_index_or_rnd_end();
- return error;
-}
-
-#endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */
-
-#ifdef MYSQL_CLIENT
-bool Update_rows_log_event::print(FILE *file,
- PRINT_EVENT_INFO* print_event_info)
-{
- return Rows_log_event::print_helper(file, print_event_info, "Update_rows");
-}
-
-bool
-Update_rows_compressed_log_event::print(FILE *file,
- PRINT_EVENT_INFO *print_event_info)
-{
- char *new_buf;
- ulong len;
- bool is_malloc= false;
- if(!row_log_event_uncompress(glob_description_event,
- checksum_alg == BINLOG_CHECKSUM_ALG_CRC32,
- temp_buf, UINT_MAX32, NULL, 0, &is_malloc, &new_buf, &len))
- {
- free_temp_buf();
- register_temp_buf(new_buf, true);
- if (Rows_log_event::print_helper(file, print_event_info,
- "Update_compressed_rows"))
- goto err;
- }
- else
- {
- if (my_b_printf(&print_event_info->head_cache,
- "ERROR: uncompress update_compressed_rows failed\n"))
- goto err;
- }
-
- return 0;
-err:
- return 1;
-}
-#endif
-
-#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
-uint8 Update_rows_log_event::get_trg_event_map()
-{
- return trg2bit(TRG_EVENT_UPDATE);
-}
-#endif
-
Incident_log_event::Incident_log_event(const char *buf, uint event_len,
const Format_description_log_event *descr_event)
: Log_event(buf, descr_event)
@@ -14834,123 +3940,6 @@ Incident_log_event::description() const
}
-#ifndef MYSQL_CLIENT
-void Incident_log_event::pack_info(Protocol *protocol)
-{
- char buf[256];
- size_t bytes;
- if (m_message.length > 0)
- bytes= my_snprintf(buf, sizeof(buf), "#%d (%s)",
- m_incident, description());
- else
- bytes= my_snprintf(buf, sizeof(buf), "#%d (%s): %s",
- m_incident, description(), m_message.str);
- protocol->store(buf, bytes, &my_charset_bin);
-}
-#endif /* MYSQL_CLIENT */
-
-
-#if defined(WITH_WSREP) && !defined(MYSQL_CLIENT)
-/*
- 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
- (*buf_len) will be changed to account just being read bytes of the 1st event.
-*/
-#define WSREP_MAX_ALLOWED_PACKET 1024*1024*1024 // current protocol max
-
-Log_event* wsrep_read_log_event(
- char **arg_buf, size_t *arg_buf_len,
- const Format_description_log_event *description_event)
-{
- char *head= (*arg_buf);
- uint data_len = uint4korr(head + EVENT_LEN_OFFSET);
- char *buf= (*arg_buf);
- const char *error= 0;
- Log_event *res= 0;
- DBUG_ENTER("wsrep_read_log_event");
-
- if (data_len > WSREP_MAX_ALLOWED_PACKET)
- {
- error = "Event too big";
- goto err;
- }
-
- res= Log_event::read_log_event(buf, data_len, &error, description_event, false);
-
-err:
- if (!res)
- {
- DBUG_ASSERT(error != 0);
- sql_print_error("Error in Log_event::read_log_event(): "
- "'%s', data_len: %d, event_type: %d",
- error,data_len,(uchar)head[EVENT_TYPE_OFFSET]);
- }
- (*arg_buf)+= data_len;
- (*arg_buf_len)-= data_len;
- DBUG_RETURN(res);
-}
-#endif
-
-
-#ifdef MYSQL_CLIENT
-bool Incident_log_event::print(FILE *file,
- PRINT_EVENT_INFO *print_event_info)
-{
- if (print_event_info->short_form)
- return 0;
-
- Write_on_release_cache cache(&print_event_info->head_cache, file);
-
- if (print_header(&cache, print_event_info, FALSE) ||
- my_b_printf(&cache, "\n# Incident: %s\nRELOAD DATABASE; # Shall generate syntax error\n", description()))
- return 1;
- return cache.flush_data();
-}
-#endif
-
-#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-int
-Incident_log_event::do_apply_event(rpl_group_info *rgi)
-{
- Relay_log_info const *rli= rgi->rli;
- DBUG_ENTER("Incident_log_event::do_apply_event");
-
- if (ignored_error_code(ER_SLAVE_INCIDENT))
- {
- DBUG_PRINT("info", ("Ignoring Incident"));
- DBUG_RETURN(0);
- }
-
- rli->report(ERROR_LEVEL, ER_SLAVE_INCIDENT, NULL,
- 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()
-{
- 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);
- DBUG_RETURN(write_data(buf, sizeof(buf)));
-}
-
-bool
-Incident_log_event::write_data_body()
-{
- uchar tmp[1];
- DBUG_ENTER("Incident_log_event::write_data_body");
- tmp[0]= (uchar) m_message.length;
- DBUG_RETURN(write_data(tmp, sizeof(tmp)) ||
- write_data(m_message.str, m_message.length));
-}
-#endif
-
Ignorable_log_event::Ignorable_log_event(const char *buf,
const Format_description_log_event
*descr_event,
@@ -14966,154 +3955,8 @@ Ignorable_log_event::~Ignorable_log_event()
{
}
-#ifndef MYSQL_CLIENT
-/* Pack info for its unrecognized ignorable event */
-void Ignorable_log_event::pack_info(Protocol *protocol)
-{
- char buf[256];
- size_t bytes;
- bytes= my_snprintf(buf, sizeof(buf), "# Ignorable event type %d (%s)",
- number, description);
- protocol->store(buf, bytes, &my_charset_bin);
-}
-#endif
-
-#ifdef MYSQL_CLIENT
-/* Print for its unrecognized ignorable event */
-bool Ignorable_log_event::print(FILE *file,
- PRINT_EVENT_INFO *print_event_info)
-{
- if (print_event_info->short_form)
- return 0;
-
- if (print_header(&print_event_info->head_cache, print_event_info, FALSE) ||
- my_b_printf(&print_event_info->head_cache, "\tIgnorable\n") ||
- my_b_printf(&print_event_info->head_cache,
- "# Ignorable event type %d (%s)\n", number, description) ||
- copy_event_cache_to_file_and_reinit(&print_event_info->head_cache,
- file))
- return 1;
- return 0;
-}
-#endif
-
-
-#ifdef MYSQL_CLIENT
-/**
- The default values for these variables should be values that are
- *incorrect*, i.e., values that cannot occur in an event. This way,
- they will always be printed for the first event.
-*/
-st_print_event_info::st_print_event_info()
-{
- myf const flags = MYF(MY_WME | MY_NABP);
- /*
- Currently we only use static PRINT_EVENT_INFO objects, so zeroed at
- program's startup, but these explicit bzero() is for the day someone
- creates dynamic instances.
- */
- bzero(db, sizeof(db));
- bzero(charset, sizeof(charset));
- bzero(time_zone_str, sizeof(time_zone_str));
- delimiter[0]= ';';
- delimiter[1]= 0;
- flags2_inited= 0;
- sql_mode_inited= 0;
- row_events= 0;
- sql_mode= 0;
- auto_increment_increment= 0;
- auto_increment_offset= 0;
- charset_inited= 0;
- lc_time_names_number= ~0;
- charset_database_number= ILLEGAL_CHARSET_INFO_NUMBER;
- thread_id= 0;
- server_id= 0;
- domain_id= 0;
- thread_id_printed= false;
- server_id_printed= false;
- domain_id_printed= false;
- allow_parallel= true;
- allow_parallel_printed= false;
- found_row_event= false;
- print_row_count= false;
- short_form= false;
- skip_replication= 0;
- printed_fd_event=FALSE;
- file= 0;
- base64_output_mode=BASE64_OUTPUT_UNSPEC;
- open_cached_file(&head_cache, NULL, NULL, 0, flags);
- open_cached_file(&body_cache, NULL, NULL, 0, flags);
-#ifdef WHEN_FLASHBACK_REVIEW_READY
- open_cached_file(&review_sql_cache, NULL, NULL, 0, flags);
-#endif
-}
-
-
-bool copy_event_cache_to_string_and_reinit(IO_CACHE *cache, LEX_STRING *to)
-{
- reinit_io_cache(cache, READ_CACHE, 0L, FALSE, FALSE);
- if (cache->end_of_file > SIZE_T_MAX ||
- !(to->str= (char*) my_malloc((to->length= (size_t)cache->end_of_file), MYF(0))))
- {
- perror("Out of memory: can't allocate memory in copy_event_cache_to_string_and_reinit().");
- goto err;
- }
- if (my_b_read(cache, (uchar*) to->str, to->length))
- {
- my_free(to->str);
- perror("Can't read data from IO_CACHE");
- return true;
- }
- reinit_io_cache(cache, WRITE_CACHE, 0, FALSE, TRUE);
- return false;
-
-err:
- to->str= 0;
- to->length= 0;
- return true;
-}
-#endif /* MYSQL_CLIENT */
-
bool copy_event_cache_to_file_and_reinit(IO_CACHE *cache, FILE *file)
{
return (my_b_copy_all_to_file(cache, file) ||
reinit_io_cache(cache, WRITE_CACHE, 0, FALSE, TRUE));
}
-
-#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-Heartbeat_log_event::Heartbeat_log_event(const char* buf, uint event_len,
- const Format_description_log_event* description_event)
- :Log_event(buf, description_event)
-{
- uint8 header_size= description_event->common_header_len;
- ident_len = event_len - header_size;
- set_if_smaller(ident_len,FN_REFLEN-1);
- log_ident= buf + header_size;
-}
-#endif
-
-#if defined(MYSQL_SERVER)
-/**
- Check if we should write event to the relay log
-
- This is used to skip events that is only supported by MySQL
-
- Return:
- 0 ok
- 1 Don't write event
-*/
-
-bool event_that_should_be_ignored(const char *buf)
-{
- uint event_type= (uchar)buf[EVENT_TYPE_OFFSET];
- if (event_type == GTID_LOG_EVENT ||
- event_type == ANONYMOUS_GTID_LOG_EVENT ||
- event_type == PREVIOUS_GTIDS_LOG_EVENT ||
- event_type == TRANSACTION_CONTEXT_EVENT ||
- event_type == VIEW_CHANGE_EVENT ||
- event_type == XA_PREPARE_LOG_EVENT ||
- (uint2korr(buf + FLAGS_OFFSET) & LOG_EVENT_IGNORABLE_F))
- return 1;
- return 0;
-}
-#endif /* MYSQL_SERVER */
diff --git a/sql/log_event.h b/sql/log_event.h
index 274182af841..88a6e06c506 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -35,6 +35,11 @@
#include <my_bitmap.h>
#include "rpl_constants.h"
+#include <vector>
+#include <string>
+#include <functional>
+#include <memory>
+#include <map>
#ifdef MYSQL_CLIENT
#include "sql_const.h"
@@ -791,7 +796,6 @@ enum Int_event_type
INVALID_INT_EVENT = 0, LAST_INSERT_ID_EVENT = 1, INSERT_ID_EVENT = 2
};
-
#ifdef MYSQL_SERVER
class String;
class MYSQL_BIN_LOG;
@@ -881,6 +885,7 @@ typedef struct st_print_event_info
statement for it.
*/
bool skip_replication;
+ bool print_table_metadata;
/*
These two caches are used by the row-based replication events to
@@ -4063,6 +4068,18 @@ private:
ninth is in the least significant bit of the second byte, and so
on. </td>
</tr>
+ <tr>
+ <td>optional metadata fields</td>
+ <td>optional metadata fields are stored in Type, Length, Value(TLV) format.
+ Type takes 1 byte. Length is a packed integer value. Values takes
+ Length bytes.
+ </td>
+ <td>There are some optional metadata defined. They are listed in the table
+ @ref Table_table_map_event_optional_metadata. Optional metadata fields
+ follow null_bits. Whether binlogging an optional metadata is decided by the
+ server. The order is not defined, so they can be binlogged in any order.
+ </td>
+ </tr>
</table>
@@ -4268,6 +4285,123 @@ private:
</tr>
</table>
+ The table below lists all optional metadata types, along with the numerical
+ identifier for it and the size and interpretation of meta-data used
+ to describe the type.
+
+ @anchor Table_table_map_event_optional_metadata
+ <table>
+ <caption>Table_map_event optional metadata types: numerical identifier and
+ metadata. Optional metadata fields are stored in TLV fields.
+ Format of values are described in this table. </caption>
+ <tr>
+ <th>Type</th>
+ <th>Description</th>
+ <th>Format</th>
+ </tr>
+ <tr>
+ <td>SIGNEDNESS</td>
+ <td>signedness of numeric colums. This is included for all values of
+ binlog_row_metadata.</td>
+ <td>For each numeric column, a bit indicates whether the numeric
+ colunm has unsigned flag. 1 means it is unsigned. The number of
+ bytes needed for this is int((column_count + 7) / 8). The order is
+ the same as the order of column_type field.</td>
+ </tr>
+ <tr>
+ <td>DEFAULT_CHARSET</td>
+ <td>Charsets of character columns. It has a default charset for
+ the case that most of character columns have same charset and the
+ most used charset is binlogged as default charset.Collation
+ numbers are binlogged for identifying charsets. They are stored in
+ packed length format. Either DEFAULT_CHARSET or COLUMN_CHARSET is
+ included for all values of binlog_row_metadata.</td>
+ <td>Default charset's collation is logged first. The charsets which are not
+ same to default charset are logged following default charset. They are
+ logged as column index and charset collation number pair sequence. The
+ column index is counted only in all character columns. The order is same to
+ the order of column_type
+ field. </td>
+ </tr>
+ <tr>
+ <td>COLUMN_CHARSET</td>
+ <td>Charsets of character columns. For the case that most of columns have
+ different charsets, this field is logged. It is never logged with
+ DEFAULT_CHARSET together. Either DEFAULT_CHARSET or COLUMN_CHARSET is
+ included for all values of binlog_row_metadata.</td>
+ <td>It is a collation number sequence for all character columns.</td>
+ </tr>
+ <tr>
+ <td>COLUMN_NAME</td>
+ <td>Names of columns. This is only included if
+ binlog_row_metadata=FULL.</td>
+ <td>A sequence of column names. For each column name, 1 byte for
+ the string length in bytes is followed by a string without null
+ terminator.</td>
+ </tr>
+ <tr>
+ <td>SET_STR_VALUE</td>
+ <td>The string values of SET columns. This is only included if
+ binlog_row_metadata=FULL.</td>
+ <td>For each SET column, a pack_length representing the value
+ count is followed by a sequence of length and string pairs. length
+ is the byte count in pack_length format. The string has no null
+ terminator.</td>
+ </tr>
+ <tr>
+ <td>ENUM_STR_VALUE</td>
+ <td>The string values is ENUM columns. This is only included
+ if binlog_row_metadata=FULL.</td>
+ <td>The format is the same as SET_STR_VALUE.</td>
+ </tr>
+ <tr>
+ <td>GEOMETRY_TYPE</td>
+ <td>The real type of geometry columns. This is only included
+ if binlog_row_metadata=FULL.</td>
+ <td>A sequence of real type of geometry columns are stored in pack_length
+ format. </td>
+ </tr>
+ <tr>
+ <td>SIMPLE_PRIMARY_KEY</td>
+ <td>The primary key without any prefix. This is only included
+ if binlog_row_metadata=FULL and there is a primary key where every
+ key part covers an entire column.</td>
+ <td>A sequence of column indexes. The indexes are stored in pack_length
+ format.</td>
+ </tr>
+ <tr>
+ <td>PRIMARY_KEY_WITH_PREFIX</td>
+ <td>The primary key with some prefix. It doesn't appear together with
+ SIMPLE_PRIMARY_KEY. This is only included if
+ binlog_row_metadata=FULL and there is a primary key where some key
+ part covers a prefix of the column.</td>
+ <td>A sequence of column index and prefix length pairs. Both
+ column index and prefix length are in pack_length format. Prefix length
+ 0 means that the whole column value is used.</td>
+ </tr>
+ <tr>
+ <td>ENUM_AND_SET_DEFAULT_CHARSET</td>
+ <td>Charsets of ENUM and SET columns. It has the same layout as
+ DEFAULT_CHARSET. If there are SET or ENUM columns and
+ binlog_row_metadata=FULL, exactly one of
+ ENUM_AND_SET_DEFAULT_CHARSET and ENUM_AND_SET_COLUMN_CHARSET
+ appears (the encoder chooses the representation that uses the
+ least amount of space). Otherwise, none of them appears.</td>
+ <td>The same format as for DEFAULT_CHARSET, except it counts ENUM
+ and SET columns rather than character columns.</td>
+ </tr>
+ <tr>
+ <td>ENUM_AND_SET_COLUMN_CHARSET</td>
+ <td>Charsets of ENUM and SET columns. It has the same layout as
+ COLUMN_CHARSET. If there are SET or ENUM columns and
+ binlog_row_metadata=FULL, exactly one of
+ ENUM_AND_SET_DEFAULT_CHARSET and ENUM_AND_SET_COLUMN_CHARSET
+ appears (the encoder chooses the representation that uses the
+ least amount of space). Otherwise, none of them appears.</td>
+ <td>The same format as for COLUMN_CHARSET, except it counts ENUM
+ and SET columns rather than character columns.</td>
+ </tr>
+ </table>
*/
class Table_map_log_event : public Log_event
{
@@ -4303,6 +4437,124 @@ public:
};
typedef uint16 flag_set;
+ /**
+ DEFAULT_CHARSET and COLUMN_CHARSET don't appear together, and
+ ENUM_AND_SET_DEFAULT_CHARSET and ENUM_AND_SET_COLUMN_CHARSET don't
+ appear together. They are just alternative ways to pack character
+ set information. When binlogging, it logs character sets in the
+ way that occupies least storage.
+
+ SIMPLE_PRIMARY_KEY and PRIMARY_KEY_WITH_PREFIX don't appear together.
+ SIMPLE_PRIMARY_KEY is for the primary keys which only use whole values of
+ pk columns. PRIMARY_KEY_WITH_PREFIX is
+ for the primary keys which just use part value of pk columns.
+ */
+ enum Optional_metadata_field_type
+ {
+ SIGNEDNESS = 1, // UNSIGNED flag of numeric columns
+ DEFAULT_CHARSET, /* Character set of string columns, optimized to
+ minimize space when many columns have the
+ same charset. */
+ COLUMN_CHARSET, /* Character set of string columns, optimized to
+ minimize space when columns have many
+ different charsets. */
+ COLUMN_NAME,
+ SET_STR_VALUE, // String value of SET columns
+ ENUM_STR_VALUE, // String value of ENUM columns
+ GEOMETRY_TYPE, // Real type of geometry columns
+ SIMPLE_PRIMARY_KEY, // Primary key without prefix
+ PRIMARY_KEY_WITH_PREFIX, // Primary key with prefix
+ ENUM_AND_SET_DEFAULT_CHARSET, /* Character set of enum and set
+ columns, optimized to minimize
+ space when many columns have the
+ same charset. */
+ ENUM_AND_SET_COLUMN_CHARSET, /* Character set of enum and set
+ columns, optimized to minimize
+ space when many columns have the
+ same charset. */
+ };
+ /**
+ Metadata_fields organizes m_optional_metadata into a structured format which
+ is easy to access.
+ */
+ // Values for binlog_row_metadata sysvar
+ enum enum_binlog_row_metadata
+ {
+ BINLOG_ROW_METADATA_NO_LOG= 0,
+ BINLOG_ROW_METADATA_MINIMAL= 1,
+ BINLOG_ROW_METADATA_FULL= 2
+ };
+ struct Optional_metadata_fields
+ {
+ typedef std::pair<unsigned int, unsigned int> uint_pair;
+ typedef std::vector<std::string> str_vector;
+
+ struct Default_charset
+ {
+ Default_charset() : default_charset(0) {}
+ bool empty() const { return default_charset == 0; }
+
+ // Default charset for the columns which are not in charset_pairs.
+ unsigned int default_charset;
+
+ /* The uint_pair means <column index, column charset number>. */
+ std::vector<uint_pair> charset_pairs;
+ };
+
+ // Contents of DEFAULT_CHARSET field is converted into Default_charset.
+ Default_charset m_default_charset;
+ // Contents of ENUM_AND_SET_DEFAULT_CHARSET are converted into
+ // Default_charset.
+ Default_charset m_enum_and_set_default_charset;
+ std::vector<bool> m_signedness;
+ // Character set number of every string column
+ std::vector<unsigned int> m_column_charset;
+ // Character set number of every ENUM or SET column.
+ std::vector<unsigned int> m_enum_and_set_column_charset;
+ std::vector<std::string> m_column_name;
+ // each str_vector stores values of one enum/set column
+ std::vector<str_vector> m_enum_str_value;
+ std::vector<str_vector> m_set_str_value;
+ std::vector<unsigned int> m_geometry_type;
+ /*
+ The uint_pair means <column index, prefix length>. Prefix length is 0 if
+ whole column value is used.
+ */
+ std::vector<uint_pair> m_primary_key;
+
+ /*
+ It parses m_optional_metadata and populates into above variables.
+
+ @param[in] optional_metadata points to the begin of optional metadata
+ fields in table_map_event.
+ @param[in] optional_metadata_len length of optional_metadata field.
+ */
+ Optional_metadata_fields(unsigned char* optional_metadata,
+ unsigned int optional_metadata_len);
+ };
+
+ /**
+ Print column metadata. Its format looks like:
+ # Columns(colume_name type, colume_name type, ...)
+ if colume_name field is not logged into table_map_log_event, then
+ only type is printed.
+
+ @@param[out] file the place where colume metadata is printed
+ @@param[in] The metadata extracted from optional metadata fields
+ */
+ void print_columns(IO_CACHE *file,
+ const Optional_metadata_fields &fields);
+ /**
+ Print primary information. Its format looks like:
+ # Primary Key(colume_name, column_name(prifix), ...)
+ if colume_name field is not logged into table_map_log_event, then
+ colume index is printed.
+
+ @@param[out] file the place where primary key is printed
+ @@param[in] The metadata extracted from optional metadata fields
+ */
+ void print_primary_key(IO_CACHE *file,
+ const Optional_metadata_fields &fields);
/* Special constants representing sets of flags */
enum
@@ -4369,6 +4621,51 @@ private:
#ifdef MYSQL_SERVER
TABLE *m_table;
+ Binlog_type_info *binlog_type_info_array;
+
+
+ // Metadata fields buffer
+ StringBuffer<1024> m_metadata_buf;
+
+ /**
+ Capture the optional metadata fields which should be logged into
+ table_map_log_event and serialize them into m_metadata_buf.
+ */
+ void init_metadata_fields();
+ bool init_signedness_field();
+ /**
+ Capture and serialize character sets. Character sets for
+ character columns (TEXT etc) and character sets for ENUM and SET
+ columns are stored in different metadata fields. The reason is
+ that TEXT character sets are included even when
+ binlog_row_metadata=MINIMAL, whereas ENUM and SET character sets
+ are included only when binlog_row_metadata=FULL.
+
+ @param include_type Predicate to determine if a given Field object
+ is to be included in the metadata field.
+
+ @param default_charset_type Type code when storing in "default
+ charset" format. (See comment above Table_maps_log_event in
+ libbinlogevents/include/rows_event.h)
+
+ @param column_charset_type Type code when storing in "column
+ charset" format. (See comment above Table_maps_log_event in
+ libbinlogevents/include/rows_event.h)
+ */
+ bool init_charset_field(bool(* include_type)(Binlog_type_info *, Field *),
+ Optional_metadata_field_type default_charset_type,
+ Optional_metadata_field_type column_charset_type);
+ bool init_column_name_field();
+ bool init_set_str_value_field();
+ bool init_enum_str_value_field();
+ bool init_geometry_type_field();
+ bool init_primary_key_field();
+#endif
+
+#ifdef MYSQL_CLIENT
+ class Charset_iterator;
+ class Default_charset_iterator;
+ class Column_charset_iterator;
#endif
char const *m_dbnam;
size_t m_dblen;
@@ -4390,6 +4687,8 @@ private:
ulong m_field_metadata_size;
uchar *m_null_bits;
uchar *m_meta_memory;
+ unsigned int m_optional_metadata_len;
+ unsigned char *m_optional_metadata;
};
@@ -5261,5 +5560,4 @@ int row_log_event_uncompress(const Format_description_log_event *description_eve
const char *src, ulong src_len, char* buf, ulong buf_size, bool* is_malloc,
char **dst, ulong *newlen);
-
#endif /* _log_event_h */
diff --git a/sql/log_event_client.cc b/sql/log_event_client.cc
new file mode 100644
index 00000000000..cae4842355a
--- /dev/null
+++ b/sql/log_event_client.cc
@@ -0,0 +1,3902 @@
+/*
+ Copyright (c) 2000, 2018, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2019, 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+
+#ifndef MYSQL_CLIENT
+#error MYSQL_CLIENT must be defined here
+#endif
+
+#ifdef MYSQL_SERVER
+#error MYSQL_SERVER must not be defined here
+#endif
+
+
+static bool pretty_print_str(IO_CACHE* cache, const char* str,
+ size_t len, bool identifier)
+{
+ const char* end = str + len;
+ if (my_b_write_byte(cache, identifier ? '`' : '\''))
+ goto err;
+
+ while (str < end)
+ {
+ char c;
+ int error;
+
+ switch ((c=*str++)) {
+ case '\n': error= my_b_write(cache, (uchar*)"\\n", 2); break;
+ case '\r': error= my_b_write(cache, (uchar*)"\\r", 2); break;
+ case '\\': error= my_b_write(cache, (uchar*)"\\\\", 2); break;
+ case '\b': error= my_b_write(cache, (uchar*)"\\b", 2); break;
+ case '\t': error= my_b_write(cache, (uchar*)"\\t", 2); break;
+ case '\'': error= my_b_write(cache, (uchar*)"\\'", 2); break;
+ case 0 : error= my_b_write(cache, (uchar*)"\\0", 2); break;
+ default:
+ error= my_b_write_byte(cache, c);
+ break;
+ }
+ if (unlikely(error))
+ goto err;
+ }
+ return my_b_write_byte(cache, identifier ? '`' : '\'');
+
+err:
+ return 1;
+}
+
+/**
+ Print src as an string enclosed with "'"
+
+ @param[out] cache IO_CACHE where the string will be printed.
+ @param[in] str the string will be printed.
+ @param[in] len length of the string.
+*/
+static inline bool pretty_print_str(IO_CACHE* cache, const char* str,
+ size_t len)
+{
+ return pretty_print_str(cache, str, len, false);
+}
+
+/**
+ Print src as an identifier enclosed with "`"
+
+ @param[out] cache IO_CACHE where the identifier will be printed.
+ @param[in] str the string will be printed.
+ @param[in] len length of the string.
+ */
+static inline bool pretty_print_identifier(IO_CACHE* cache, const char* str,
+ size_t len)
+{
+ return pretty_print_str(cache, str, len, true);
+}
+
+
+
+/**
+ Prints a "session_var=value" string. Used by mysqlbinlog to print some SET
+ commands just before it prints a query.
+*/
+
+static bool print_set_option(IO_CACHE* file, uint32 bits_changed,
+ uint32 option, uint32 flags, const char* name,
+ bool* need_comma)
+{
+ if (bits_changed & option)
+ {
+ if (*need_comma)
+ if (my_b_write(file, (uchar*)", ", 2))
+ goto err;
+ if (my_b_printf(file, "%s=%d", name, MY_TEST(flags & option)))
+ goto err;
+ *need_comma= 1;
+ }
+ return 0;
+err:
+ return 1;
+}
+
+
+static bool hexdump_minimal_header_to_io_cache(IO_CACHE *file,
+ my_off_t offset,
+ uchar *ptr)
+{
+ DBUG_ASSERT(LOG_EVENT_MINIMAL_HEADER_LEN == 19);
+
+ /*
+ Pretty-print the first LOG_EVENT_MINIMAL_HEADER_LEN (19) bytes of the
+ common header, which contains the basic information about the log event.
+ Every event will have at least this much header, but events could contain
+ more headers (which must be printed by other methods, if desired).
+ */
+ char emit_buf[120]; // Enough for storing one line
+ size_t emit_buf_written;
+
+ if (my_b_printf(file,
+ "# "
+ "|Timestamp "
+ "|Type "
+ "|Master ID "
+ "|Size "
+ "|Master Pos "
+ "|Flags\n"))
+ goto err;
+ emit_buf_written=
+ my_snprintf(emit_buf, sizeof(emit_buf),
+ "# %8llx " /* Position */
+ "|%02x %02x %02x %02x " /* Timestamp */
+ "|%02x " /* Type */
+ "|%02x %02x %02x %02x " /* Master ID */
+ "|%02x %02x %02x %02x " /* Size */
+ "|%02x %02x %02x %02x " /* Master Pos */
+ "|%02x %02x\n", /* Flags */
+ (ulonglong) offset, /* Position */
+ ptr[0], ptr[1], ptr[2], ptr[3], /* Timestamp */
+ ptr[4], /* Type */
+ ptr[5], ptr[6], ptr[7], ptr[8], /* Master ID */
+ ptr[9], ptr[10], ptr[11], ptr[12], /* Size */
+ ptr[13], ptr[14], ptr[15], ptr[16], /* Master Pos */
+ ptr[17], ptr[18]); /* Flags */
+
+ DBUG_ASSERT(static_cast<size_t>(emit_buf_written) < sizeof(emit_buf));
+ if (my_b_write(file, reinterpret_cast<uchar*>(emit_buf), emit_buf_written) ||
+ my_b_write(file, (uchar*)"#\n", 2))
+ goto err;
+
+ return 0;
+err:
+ return 1;
+}
+
+
+/*
+ The number of bytes to print per line. Should be an even number,
+ and "hexdump -C" uses 16, so we'll duplicate that here.
+*/
+#define HEXDUMP_BYTES_PER_LINE 16
+
+static void format_hex_line(char *emit_buff)
+{
+ memset(emit_buff + 1, ' ',
+ 1 + 8 + 2 + (HEXDUMP_BYTES_PER_LINE * 3 + 1) + 2 +
+ HEXDUMP_BYTES_PER_LINE);
+ emit_buff[0]= '#';
+ emit_buff[2 + 8 + 2 + (HEXDUMP_BYTES_PER_LINE * 3 + 1) + 1]= '|';
+ emit_buff[2 + 8 + 2 + (HEXDUMP_BYTES_PER_LINE * 3 + 1) + 2 +
+ HEXDUMP_BYTES_PER_LINE]= '|';
+ emit_buff[2 + 8 + 2 + (HEXDUMP_BYTES_PER_LINE * 3 + 1) + 2 +
+ HEXDUMP_BYTES_PER_LINE + 1]= '\n';
+ emit_buff[2 + 8 + 2 + (HEXDUMP_BYTES_PER_LINE * 3 + 1) + 2 +
+ HEXDUMP_BYTES_PER_LINE + 2]= '\0';
+}
+
+static bool hexdump_data_to_io_cache(IO_CACHE *file,
+ my_off_t offset,
+ uchar *ptr,
+ my_off_t size)
+{
+ /*
+ 2 = '# '
+ 8 = address
+ 2 = ' '
+ (HEXDUMP_BYTES_PER_LINE * 3 + 1) = Each byte prints as two hex digits,
+ plus a space
+ 2 = ' |'
+ HEXDUMP_BYTES_PER_LINE = text representation
+ 2 = '|\n'
+ 1 = '\0'
+ */
+ char emit_buffer[2 + 8 + 2 + (HEXDUMP_BYTES_PER_LINE * 3 + 1) + 2 +
+ HEXDUMP_BYTES_PER_LINE + 2 + 1 ];
+ char *h,*c;
+ my_off_t i;
+
+ if (size == 0)
+ return 0; // ok, nothing to do
+
+ format_hex_line(emit_buffer);
+ /*
+ Print the rest of the event (without common header)
+ */
+ my_off_t starting_offset = offset;
+ for (i= 0,
+ c= emit_buffer + 2 + 8 + 2 + (HEXDUMP_BYTES_PER_LINE * 3 + 1) + 2,
+ h= emit_buffer + 2 + 8 + 2;
+ i < size;
+ i++, ptr++)
+ {
+ my_snprintf(h, 4, "%02x ", *ptr);
+ h+= 3;
+
+ *c++= my_isprint(&my_charset_bin, *ptr) ? *ptr : '.';
+
+ /* Print in groups of HEXDUMP_BYTES_PER_LINE characters. */
+ if ((i % HEXDUMP_BYTES_PER_LINE) == (HEXDUMP_BYTES_PER_LINE - 1))
+ {
+ /* remove \0 left after printing hex byte representation */
+ *h= ' ';
+ /* prepare space to print address */
+ memset(emit_buffer + 2, ' ', 8);
+ /* print address */
+ size_t const emit_buf_written= my_snprintf(emit_buffer + 2, 9, "%8llx",
+ (ulonglong) starting_offset);
+ /* remove \0 left after printing address */
+ emit_buffer[2 + emit_buf_written]= ' ';
+ if (my_b_write(file, reinterpret_cast<uchar*>(emit_buffer),
+ sizeof(emit_buffer) - 1))
+ goto err;
+ c= emit_buffer + 2 + 8 + 2 + (HEXDUMP_BYTES_PER_LINE * 3 + 1) + 2;
+ h= emit_buffer + 2 + 8 + 2;
+ format_hex_line(emit_buffer);
+ starting_offset+= HEXDUMP_BYTES_PER_LINE;
+ }
+ else if ((i % (HEXDUMP_BYTES_PER_LINE / 2))
+ == ((HEXDUMP_BYTES_PER_LINE / 2) - 1))
+ {
+ /*
+ In the middle of the group of HEXDUMP_BYTES_PER_LINE, emit an extra
+ space in the hex string, to make two groups.
+ */
+ *h++= ' ';
+ }
+
+ }
+
+ /*
+ There is still data left in our buffer, which means that the previous
+ line was not perfectly HEXDUMP_BYTES_PER_LINE characters, so write an
+ incomplete line, with spaces to pad out to the same length as a full
+ line would be, to make things more readable.
+ */
+ if (h != emit_buffer + 2 + 8 + 2)
+ {
+ *h= ' ';
+ *c++= '|'; *c++= '\n';
+ memset(emit_buffer + 2, ' ', 8);
+ size_t const emit_buf_written= my_snprintf(emit_buffer + 2, 9, "%8llx",
+ (ulonglong) starting_offset);
+ emit_buffer[2 + emit_buf_written]= ' ';
+ /* pad unprinted area */
+ memset(h, ' ',
+ (HEXDUMP_BYTES_PER_LINE * 3 + 1) - (h - (emit_buffer + 2 + 8 + 2)));
+ if (my_b_write(file, reinterpret_cast<uchar*>(emit_buffer),
+ c - emit_buffer))
+ goto err;
+ }
+ if (my_b_write(file, (uchar*)"#\n", 2))
+ goto err;
+
+ return 0;
+err:
+ return 1;
+}
+
+static inline bool is_numeric_type(uint type)
+{
+ switch (type)
+ {
+ case MYSQL_TYPE_TINY:
+ case MYSQL_TYPE_SHORT:
+ case MYSQL_TYPE_INT24:
+ case MYSQL_TYPE_LONG:
+ case MYSQL_TYPE_LONGLONG:
+ case MYSQL_TYPE_NEWDECIMAL:
+ case MYSQL_TYPE_FLOAT:
+ case MYSQL_TYPE_DOUBLE:
+ return true;
+ default:
+ return false;
+ }
+ return false;
+}
+
+static inline bool is_character_type(uint type)
+{
+ switch (type)
+ {
+ case MYSQL_TYPE_STRING:
+ case MYSQL_TYPE_VAR_STRING:
+ case MYSQL_TYPE_VARCHAR:
+ case MYSQL_TYPE_BLOB:
+ // Base class is blob for geom type
+ case MYSQL_TYPE_GEOMETRY:
+ return true;
+ default:
+ return false;
+ }
+}
+
+static inline bool is_enum_or_set_type(uint type) {
+ return type == MYSQL_TYPE_ENUM || type == MYSQL_TYPE_SET;
+}
+
+
+/*
+ Log_event::print_header()
+*/
+
+bool Log_event::print_header(IO_CACHE* file,
+ PRINT_EVENT_INFO* print_event_info,
+ bool is_more __attribute__((unused)))
+{
+ char llbuff[22];
+ my_off_t hexdump_from= print_event_info->hexdump_from;
+ DBUG_ENTER("Log_event::print_header");
+
+ if (my_b_write_byte(file, '#') ||
+ print_timestamp(file) ||
+ my_b_printf(file, " server id %lu end_log_pos %s ", (ulong) server_id,
+ llstr(log_pos,llbuff)))
+ goto err;
+
+ /* print the checksum */
+
+ if (checksum_alg != BINLOG_CHECKSUM_ALG_OFF &&
+ checksum_alg != BINLOG_CHECKSUM_ALG_UNDEF)
+ {
+ char checksum_buf[BINLOG_CHECKSUM_LEN * 2 + 4]; // to fit to "%p "
+ size_t const bytes_written=
+ my_snprintf(checksum_buf, sizeof(checksum_buf), "0x%08x ", crc);
+ if (my_b_printf(file, "%s ", get_type(&binlog_checksum_typelib,
+ checksum_alg)) ||
+ my_b_printf(file, checksum_buf, bytes_written))
+ goto err;
+ }
+
+ /* mysqlbinlog --hexdump */
+ if (print_event_info->hexdump_from)
+ {
+ my_b_write_byte(file, '\n');
+ uchar *ptr= (uchar*)temp_buf;
+ my_off_t size= uint4korr(ptr + EVENT_LEN_OFFSET);
+ my_off_t hdr_len= get_header_len(print_event_info->common_header_len);
+
+ size-= hdr_len;
+
+ if (my_b_printf(file, "# Position\n"))
+ goto err;
+
+ /* Write the header, nicely formatted by field. */
+ if (hexdump_minimal_header_to_io_cache(file, hexdump_from, ptr))
+ goto err;
+
+ ptr+= hdr_len;
+ hexdump_from+= hdr_len;
+
+ /* Print the rest of the data, mimicking "hexdump -C" output. */
+ if (hexdump_data_to_io_cache(file, hexdump_from, ptr, size))
+ goto err;
+
+ /*
+ Prefix the next line so that the output from print_helper()
+ will appear as a comment.
+ */
+ if (my_b_write(file, (uchar*)"# Event: ", 9))
+ goto err;
+ }
+
+ DBUG_RETURN(0);
+
+err:
+ DBUG_RETURN(1);
+}
+
+
+/**
+ Prints a quoted string to io cache.
+ Control characters are displayed as hex sequence, e.g. \x00
+ Single-quote and backslash characters are escaped with a \
+
+ @param[in] file IO cache
+ @param[in] prt Pointer to string
+ @param[in] length String length
+*/
+
+static void
+my_b_write_quoted(IO_CACHE *file, const uchar *ptr, uint length)
+{
+ const uchar *s;
+ my_b_write_byte(file, '\'');
+ for (s= ptr; length > 0 ; s++, length--)
+ {
+ if (*s > 0x1F)
+ my_b_write_byte(file, *s);
+ else if (*s == '\'')
+ my_b_write(file, (uchar*)"\\'", 2);
+ else if (*s == '\\')
+ my_b_write(file, (uchar*)"\\\\", 2);
+ else
+ {
+ uchar hex[10];
+ size_t len= my_snprintf((char*) hex, sizeof(hex), "%s%02x", "\\x", *s);
+ my_b_write(file, hex, len);
+ }
+ }
+ my_b_write_byte(file, '\'');
+}
+
+
+/**
+ Prints a bit string to io cache in format b'1010'.
+
+ @param[in] file IO cache
+ @param[in] ptr Pointer to string
+ @param[in] nbits Number of bits
+*/
+static void
+my_b_write_bit(IO_CACHE *file, const uchar *ptr, uint nbits)
+{
+ uint bitnum, nbits8= ((nbits + 7) / 8) * 8, skip_bits= nbits8 - nbits;
+ my_b_write(file, (uchar*)"b'", 2);
+ for (bitnum= skip_bits ; bitnum < nbits8; bitnum++)
+ {
+ int is_set= (ptr[(bitnum) / 8] >> (7 - bitnum % 8)) & 0x01;
+ my_b_write_byte(file, (is_set ? '1' : '0'));
+ }
+ my_b_write_byte(file, '\'');
+}
+
+
+/**
+ Prints a packed string to io cache.
+ The string consists of length packed to 1 or 2 bytes,
+ followed by string data itself.
+
+ @param[in] file IO cache
+ @param[in] ptr Pointer to string
+ @param[in] length String size
+
+ @retval - number of bytes scanned.
+*/
+static size_t
+my_b_write_quoted_with_length(IO_CACHE *file, const uchar *ptr, uint length)
+{
+ if (length < 256)
+ {
+ length= *ptr;
+ my_b_write_quoted(file, ptr + 1, length);
+ return length + 1;
+ }
+ else
+ {
+ length= uint2korr(ptr);
+ my_b_write_quoted(file, ptr + 2, length);
+ return length + 2;
+ }
+}
+
+
+/**
+ Prints a 32-bit number in both signed and unsigned representation
+
+ @param[in] file IO cache
+ @param[in] sl Signed number
+ @param[in] ul Unsigned number
+*/
+static bool
+my_b_write_sint32_and_uint32(IO_CACHE *file, int32 si, uint32 ui)
+{
+ bool res= my_b_printf(file, "%d", si);
+ if (si < 0)
+ if (my_b_printf(file, " (%u)", ui))
+ res= 1;
+ return res;
+}
+
+
+/**
+ Print a packed value of the given SQL type into IO cache
+
+ @param[in] file IO cache
+ @param[in] ptr Pointer to string
+ @param[in] type Column type
+ @param[in] meta Column meta information
+ @param[out] typestr SQL type string buffer (for verbose output)
+ @param[out] typestr_length Size of typestr
+
+ @retval - number of bytes scanned from ptr.
+ Except in case of NULL, in which case we return 1 to indicate ok
+*/
+
+static size_t
+log_event_print_value(IO_CACHE *file, PRINT_EVENT_INFO *print_event_info,
+ const uchar *ptr, uint type, uint meta,
+ char *typestr, size_t typestr_length)
+{
+ uint32 length= 0;
+
+ if (type == MYSQL_TYPE_STRING)
+ {
+ if (meta >= 256)
+ {
+ uint byte0= meta >> 8;
+ uint byte1= meta & 0xFF;
+
+ if ((byte0 & 0x30) != 0x30)
+ {
+ /* a long CHAR() field: see #37426 */
+ length= byte1 | (((byte0 & 0x30) ^ 0x30) << 4);
+ type= byte0 | 0x30;
+ }
+ else
+ length = meta & 0xFF;
+ }
+ else
+ length= meta;
+ }
+
+ switch (type) {
+ case MYSQL_TYPE_LONG:
+ {
+ strmake(typestr, "INT", typestr_length);
+ if (!ptr)
+ goto return_null;
+
+ int32 si= sint4korr(ptr);
+ uint32 ui= uint4korr(ptr);
+ my_b_write_sint32_and_uint32(file, si, ui);
+ return 4;
+ }
+
+ case MYSQL_TYPE_TINY:
+ {
+ strmake(typestr, "TINYINT", typestr_length);
+ if (!ptr)
+ goto return_null;
+
+ my_b_write_sint32_and_uint32(file, (int) (signed char) *ptr,
+ (uint) (unsigned char) *ptr);
+ return 1;
+ }
+
+ case MYSQL_TYPE_SHORT:
+ {
+ strmake(typestr, "SHORTINT", typestr_length);
+ if (!ptr)
+ goto return_null;
+
+ int32 si= (int32) sint2korr(ptr);
+ uint32 ui= (uint32) uint2korr(ptr);
+ my_b_write_sint32_and_uint32(file, si, ui);
+ return 2;
+ }
+
+ case MYSQL_TYPE_INT24:
+ {
+ strmake(typestr, "MEDIUMINT", typestr_length);
+ if (!ptr)
+ goto return_null;
+
+ int32 si= sint3korr(ptr);
+ uint32 ui= uint3korr(ptr);
+ my_b_write_sint32_and_uint32(file, si, ui);
+ return 3;
+ }
+
+ case MYSQL_TYPE_LONGLONG:
+ {
+ strmake(typestr, "LONGINT", typestr_length);
+ if (!ptr)
+ goto return_null;
+
+ char tmp[64];
+ size_t length;
+ longlong si= sint8korr(ptr);
+ length= (longlong10_to_str(si, tmp, -10) - tmp);
+ my_b_write(file, (uchar*)tmp, length);
+ if (si < 0)
+ {
+ ulonglong ui= uint8korr(ptr);
+ longlong10_to_str((longlong) ui, tmp, 10);
+ my_b_printf(file, " (%s)", tmp);
+ }
+ return 8;
+ }
+
+ case MYSQL_TYPE_NEWDECIMAL:
+ {
+ uint precision= meta >> 8;
+ uint decimals= meta & 0xFF;
+ my_snprintf(typestr, typestr_length, "DECIMAL(%d,%d)",
+ precision, decimals);
+ if (!ptr)
+ goto return_null;
+
+ uint bin_size= my_decimal_get_binary_size(precision, decimals);
+ my_decimal dec((const uchar *) ptr, precision, decimals);
+ int length= DECIMAL_MAX_STR_LENGTH;
+ char buff[DECIMAL_MAX_STR_LENGTH + 1];
+ decimal2string(&dec, buff, &length, 0, 0, 0);
+ my_b_write(file, (uchar*)buff, length);
+ return bin_size;
+ }
+
+ case MYSQL_TYPE_FLOAT:
+ {
+ strmake(typestr, "FLOAT", typestr_length);
+ if (!ptr)
+ goto return_null;
+
+ float fl;
+ float4get(fl, ptr);
+ char tmp[320];
+ sprintf(tmp, "%-20g", (double) fl);
+ my_b_printf(file, "%s", tmp); /* my_snprintf doesn't support %-20g */
+ return 4;
+ }
+
+ case MYSQL_TYPE_DOUBLE:
+ {
+ double dbl;
+ strmake(typestr, "DOUBLE", typestr_length);
+ if (!ptr)
+ goto return_null;
+
+ float8get(dbl, ptr);
+ char tmp[320];
+ sprintf(tmp, "%-.20g", dbl); /* strmake doesn't support %-20g */
+ my_b_printf(file, tmp, "%s");
+ return 8;
+ }
+
+ case MYSQL_TYPE_BIT:
+ {
+ /* Meta-data: bit_len, bytes_in_rec, 2 bytes */
+ uint nbits= ((meta >> 8) * 8) + (meta & 0xFF);
+ my_snprintf(typestr, typestr_length, "BIT(%d)", nbits);
+ if (!ptr)
+ goto return_null;
+
+ length= (nbits + 7) / 8;
+ my_b_write_bit(file, ptr, nbits);
+ return length;
+ }
+
+ case MYSQL_TYPE_TIMESTAMP:
+ {
+ strmake(typestr, "TIMESTAMP", typestr_length);
+ if (!ptr)
+ goto return_null;
+
+ uint32 i32= uint4korr(ptr);
+ my_b_printf(file, "%d", i32);
+ return 4;
+ }
+
+ case MYSQL_TYPE_TIMESTAMP2:
+ {
+ my_snprintf(typestr, typestr_length, "TIMESTAMP(%d)", meta);
+ if (!ptr)
+ goto return_null;
+
+ char buf[MAX_DATE_STRING_REP_LENGTH];
+ struct timeval tm;
+ my_timestamp_from_binary(&tm, ptr, meta);
+ int buflen= my_timeval_to_str(&tm, buf, meta);
+ my_b_write(file, (uchar*)buf, buflen);
+ return my_timestamp_binary_length(meta);
+ }
+
+ case MYSQL_TYPE_DATETIME:
+ {
+ strmake(typestr, "DATETIME", typestr_length);
+ if (!ptr)
+ goto return_null;
+
+ ulong d, t;
+ uint64 i64= uint8korr(ptr); /* YYYYMMDDhhmmss */
+ d= (ulong) (i64 / 1000000);
+ t= (ulong) (i64 % 1000000);
+
+ my_b_printf(file, "'%04d-%02d-%02d %02d:%02d:%02d'",
+ (int) (d / 10000), (int) (d % 10000) / 100, (int) (d % 100),
+ (int) (t / 10000), (int) (t % 10000) / 100, (int) t % 100);
+ return 8;
+ }
+
+ case MYSQL_TYPE_DATETIME2:
+ {
+ my_snprintf(typestr, typestr_length, "DATETIME(%d)", meta);
+ if (!ptr)
+ goto return_null;
+
+ char buf[MAX_DATE_STRING_REP_LENGTH];
+ MYSQL_TIME ltime;
+ longlong packed= my_datetime_packed_from_binary(ptr, meta);
+ TIME_from_longlong_datetime_packed(&ltime, packed);
+ int buflen= my_datetime_to_str(&ltime, buf, meta);
+ my_b_write_quoted(file, (uchar *) buf, buflen);
+ return my_datetime_binary_length(meta);
+ }
+
+ case MYSQL_TYPE_TIME:
+ {
+ strmake(typestr, "TIME", typestr_length);
+ if (!ptr)
+ goto return_null;
+
+ int32 tmp= sint3korr(ptr);
+ int32 i32= tmp >= 0 ? tmp : - tmp;
+ const char *sign= tmp < 0 ? "-" : "";
+ my_b_printf(file, "'%s%02d:%02d:%02d'",
+ sign, i32 / 10000, (i32 % 10000) / 100, i32 % 100, i32);
+ return 3;
+ }
+
+ case MYSQL_TYPE_TIME2:
+ {
+ my_snprintf(typestr, typestr_length, "TIME(%d)", meta);
+ if (!ptr)
+ goto return_null;
+
+ char buf[MAX_DATE_STRING_REP_LENGTH];
+ MYSQL_TIME ltime;
+ longlong packed= my_time_packed_from_binary(ptr, meta);
+ TIME_from_longlong_time_packed(&ltime, packed);
+ int buflen= my_time_to_str(&ltime, buf, meta);
+ my_b_write_quoted(file, (uchar *) buf, buflen);
+ return my_time_binary_length(meta);
+ }
+
+ case MYSQL_TYPE_NEWDATE:
+ {
+ strmake(typestr, "DATE", typestr_length);
+ if (!ptr)
+ goto return_null;
+
+ uint32 tmp= uint3korr(ptr);
+ int part;
+ char buf[11];
+ char *pos= &buf[10]; // start from '\0' to the beginning
+
+ /* Copied from field.cc */
+ *pos--=0; // End NULL
+ part=(int) (tmp & 31);
+ *pos--= (char) ('0'+part%10);
+ *pos--= (char) ('0'+part/10);
+ *pos--= ':';
+ part=(int) (tmp >> 5 & 15);
+ *pos--= (char) ('0'+part%10);
+ *pos--= (char) ('0'+part/10);
+ *pos--= ':';
+ part=(int) (tmp >> 9);
+ *pos--= (char) ('0'+part%10); part/=10;
+ *pos--= (char) ('0'+part%10); part/=10;
+ *pos--= (char) ('0'+part%10); part/=10;
+ *pos= (char) ('0'+part);
+ my_b_printf(file , "'%s'", buf);
+ return 3;
+ }
+
+ case MYSQL_TYPE_DATE:
+ {
+ strmake(typestr, "DATE", typestr_length);
+ if (!ptr)
+ goto return_null;
+
+ uint i32= uint3korr(ptr);
+ my_b_printf(file , "'%04d:%02d:%02d'",
+ (int)(i32 / (16L * 32L)), (int)(i32 / 32L % 16L),
+ (int)(i32 % 32L));
+ return 3;
+ }
+
+ case MYSQL_TYPE_YEAR:
+ {
+ strmake(typestr, "YEAR", typestr_length);
+ if (!ptr)
+ goto return_null;
+
+ uint32 i32= *ptr;
+ my_b_printf(file, "%04d", i32+ 1900);
+ return 1;
+ }
+
+ case MYSQL_TYPE_ENUM:
+ switch (meta & 0xFF) {
+ case 1:
+ strmake(typestr, "ENUM(1 byte)", typestr_length);
+ if (!ptr)
+ goto return_null;
+
+ my_b_printf(file, "%d", (int) *ptr);
+ return 1;
+ case 2:
+ {
+ strmake(typestr, "ENUM(2 bytes)", typestr_length);
+ if (!ptr)
+ goto return_null;
+
+ int32 i32= uint2korr(ptr);
+ my_b_printf(file, "%d", i32);
+ return 2;
+ }
+ default:
+ my_b_printf(file, "!! Unknown ENUM packlen=%d", meta & 0xFF);
+ return 0;
+ }
+ break;
+
+ case MYSQL_TYPE_SET:
+ my_snprintf(typestr, typestr_length, "SET(%d bytes)", meta & 0xFF);
+ if (!ptr)
+ goto return_null;
+
+ my_b_write_bit(file, ptr , (meta & 0xFF) * 8);
+ return meta & 0xFF;
+
+ case MYSQL_TYPE_BLOB:
+ switch (meta) {
+ case 1:
+ strmake(typestr, "TINYBLOB/TINYTEXT", typestr_length);
+ if (!ptr)
+ goto return_null;
+
+ length= *ptr;
+ my_b_write_quoted(file, ptr + 1, length);
+ return length + 1;
+ case 2:
+ strmake(typestr, "BLOB/TEXT", typestr_length);
+ if (!ptr)
+ goto return_null;
+
+ length= uint2korr(ptr);
+ my_b_write_quoted(file, ptr + 2, length);
+ return length + 2;
+ case 3:
+ strmake(typestr, "MEDIUMBLOB/MEDIUMTEXT", typestr_length);
+ if (!ptr)
+ goto return_null;
+
+ length= uint3korr(ptr);
+ my_b_write_quoted(file, ptr + 3, length);
+ return length + 3;
+ case 4:
+ strmake(typestr, "LONGBLOB/LONGTEXT", typestr_length);
+ if (!ptr)
+ goto return_null;
+
+ length= uint4korr(ptr);
+ my_b_write_quoted(file, ptr + 4, length);
+ return length + 4;
+ default:
+ my_b_printf(file, "!! Unknown BLOB packlen=%d", length);
+ return 0;
+ }
+
+ case MYSQL_TYPE_VARCHAR:
+ case MYSQL_TYPE_VAR_STRING:
+ length= meta;
+ my_snprintf(typestr, typestr_length, "VARSTRING(%d)", length);
+ if (!ptr)
+ goto return_null;
+
+ return my_b_write_quoted_with_length(file, ptr, length);
+
+ case MYSQL_TYPE_STRING:
+ my_snprintf(typestr, typestr_length, "STRING(%d)", length);
+ if (!ptr)
+ goto return_null;
+
+ return my_b_write_quoted_with_length(file, ptr, length);
+
+ case MYSQL_TYPE_DECIMAL:
+ print_event_info->flush_for_error();
+ fprintf(stderr, "\nError: Found Old DECIMAL (mysql-4.1 or earlier). "
+ "Not enough metadata to display the value.\n");
+ break;
+ default:
+ print_event_info->flush_for_error();
+ fprintf(stderr,
+ "\nError: Don't know how to handle column type: %d meta: %d (%04x)\n",
+ type, meta, meta);
+ break;
+ }
+ *typestr= 0;
+ return 0;
+
+return_null:
+ return my_b_write(file, (uchar*) "NULL", 4) ? 0 : 1;
+}
+
+
+/**
+ Print a packed row into IO cache
+
+ @param[in] file IO cache
+ @param[in] td Table definition
+ @param[in] print_event_into Print parameters
+ @param[in] cols_bitmap Column bitmaps.
+ @param[in] value Pointer to packed row
+ @param[in] prefix Row's SQL clause ("SET", "WHERE", etc)
+
+ @retval 0 error
+ # number of bytes scanned.
+*/
+
+
+size_t
+Rows_log_event::print_verbose_one_row(IO_CACHE *file, table_def *td,
+ PRINT_EVENT_INFO *print_event_info,
+ MY_BITMAP *cols_bitmap,
+ const uchar *value, const uchar *prefix,
+ const my_bool no_fill_output)
+{
+ const uchar *value0= value;
+ const uchar *null_bits= value;
+ uint null_bit_index= 0;
+ char typestr[64]= "";
+
+#ifdef WHEN_FLASHBACK_REVIEW_READY
+ /* Storing the review SQL */
+ IO_CACHE *review_sql= &print_event_info->review_sql_cache;
+ LEX_STRING review_str;
+#endif
+
+ /*
+ Skip metadata bytes which gives the information about nullabity of master
+ columns. Master writes one bit for each affected column.
+ */
+
+ value+= (bitmap_bits_set(cols_bitmap) + 7) / 8;
+
+ if (!no_fill_output)
+ if (my_b_printf(file, "%s", prefix))
+ goto err;
+
+ for (uint i= 0; i < (uint)td->size(); i ++)
+ {
+ size_t size;
+ int is_null= (null_bits[null_bit_index / 8]
+ >> (null_bit_index % 8)) & 0x01;
+
+ if (bitmap_is_set(cols_bitmap, i) == 0)
+ continue;
+
+ if (!no_fill_output)
+ if (my_b_printf(file, "### @%d=", static_cast<int>(i + 1)))
+ goto err;
+
+ if (!is_null)
+ {
+ size_t fsize= td->calc_field_size((uint)i, (uchar*) value);
+ if (value + fsize > m_rows_end)
+ {
+ if (!no_fill_output)
+ if (my_b_printf(file, "***Corrupted replication event was detected."
+ " Not printing the value***\n"))
+ goto err;
+ value+= fsize;
+ return 0;
+ }
+ }
+
+ if (!no_fill_output)
+ {
+ size= log_event_print_value(file, print_event_info, is_null? NULL: value,
+ td->type(i), td->field_metadata(i),
+ typestr, sizeof(typestr));
+#ifdef WHEN_FLASHBACK_REVIEW_READY
+ if (need_flashback_review)
+ {
+ String tmp_str, hex_str;
+ IO_CACHE tmp_cache;
+
+ // Using a tmp IO_CACHE to get the value output
+ open_cached_file(&tmp_cache, NULL, NULL, 0, MYF(MY_WME | MY_NABP));
+ size= log_event_print_value(&tmp_cache, print_event_info,
+ is_null ? NULL: value,
+ td->type(i), td->field_metadata(i),
+ typestr, sizeof(typestr));
+ error= copy_event_cache_to_string_and_reinit(&tmp_cache, &review_str);
+ close_cached_file(&tmp_cache);
+ if (unlikely(error))
+ return 0;
+
+ switch (td->type(i)) // Converting a string to HEX format
+ {
+ case MYSQL_TYPE_VARCHAR:
+ case MYSQL_TYPE_VAR_STRING:
+ case MYSQL_TYPE_STRING:
+ case MYSQL_TYPE_BLOB:
+ // Avoid write_pos changed to a new area
+ // tmp_str.free();
+ tmp_str.append(review_str.str + 1, review_str.length - 2); // Removing quotation marks
+ if (hex_str.alloc(tmp_str.length()*2+1)) // If out of memory
+ {
+ fprintf(stderr, "\nError: Out of memory. "
+ "Could not print correct binlog event.\n");
+ exit(1);
+ }
+ octet2hex((char*) hex_str.ptr(), tmp_str.ptr(), tmp_str.length());
+ if (my_b_printf(review_sql, ", UNHEX('%s')", hex_str.ptr()))
+ goto err;
+ break;
+ default:
+ tmp_str.free();
+ if (tmp_str.append(review_str.str, review_str.length) ||
+ my_b_printf(review_sql, ", %s", tmp_str.ptr()))
+ goto err;
+ break;
+ }
+ my_free(revieww_str.str);
+ }
+#endif
+ }
+ else
+ {
+ IO_CACHE tmp_cache;
+ open_cached_file(&tmp_cache, NULL, NULL, 0, MYF(MY_WME | MY_NABP));
+ size= log_event_print_value(&tmp_cache, print_event_info,
+ is_null ? NULL: value,
+ td->type(i), td->field_metadata(i),
+ typestr, sizeof(typestr));
+ close_cached_file(&tmp_cache);
+ }
+
+ if (!size)
+ goto err;
+
+ if (!is_null)
+ value+= size;
+
+ if (print_event_info->verbose > 1 && !no_fill_output)
+ {
+ if (my_b_write(file, (uchar*)" /* ", 4) ||
+ my_b_printf(file, "%s ", typestr) ||
+ my_b_printf(file, "meta=%d nullable=%d is_null=%d ",
+ td->field_metadata(i),
+ td->maybe_null(i), is_null) ||
+ my_b_write(file, (uchar*)"*/", 2))
+ goto err;
+ }
+
+ if (!no_fill_output)
+ if (my_b_write_byte(file, '\n'))
+ goto err;
+
+ null_bit_index++;
+ }
+ return value - value0;
+
+err:
+ return 0;
+}
+
+
+/**
+ Exchange the SET part and WHERE part for the Update events.
+ Revert the operations order for the Write and Delete events.
+ And then revert the events order from the last one to the first one.
+
+ @param[in] print_event_info PRINT_EVENT_INFO
+ @param[in] rows_buff Packed event buff
+*/
+
+void Rows_log_event::change_to_flashback_event(PRINT_EVENT_INFO *print_event_info,
+ uchar *rows_buff, Log_event_type ev_type)
+{
+ Table_map_log_event *map;
+ table_def *td;
+ DYNAMIC_ARRAY rows_arr;
+ uchar *swap_buff1, *swap_buff2;
+ uchar *rows_pos= rows_buff + m_rows_before_size;
+
+ if (!(map= print_event_info->m_table_map.get_table(m_table_id)) ||
+ !(td= map->create_table_def()))
+ return;
+
+ /* If the write rows event contained no values for the AI */
+ if (((get_general_type_code() == WRITE_ROWS_EVENT) && (m_rows_buf==m_rows_end)))
+ goto end;
+
+ (void) my_init_dynamic_array(&rows_arr, sizeof(LEX_STRING), 8, 8, MYF(0));
+
+ for (uchar *value= m_rows_buf; value < m_rows_end; )
+ {
+ uchar *start_pos= value;
+ size_t length1= 0;
+ if (!(length1= print_verbose_one_row(NULL, td, print_event_info,
+ &m_cols, value,
+ (const uchar*) "", TRUE)))
+ {
+ fprintf(stderr, "\nError row length: %zu\n", length1);
+ exit(1);
+ }
+ value+= length1;
+
+ swap_buff1= (uchar *) my_malloc(length1, MYF(0));
+ if (!swap_buff1)
+ {
+ fprintf(stderr, "\nError: Out of memory. "
+ "Could not exchange to flashback event.\n");
+ exit(1);
+ }
+ memcpy(swap_buff1, start_pos, length1);
+
+ // For Update_event, we have the second part
+ size_t length2= 0;
+ if (ev_type == UPDATE_ROWS_EVENT ||
+ ev_type == UPDATE_ROWS_EVENT_V1)
+ {
+ if (!(length2= print_verbose_one_row(NULL, td, print_event_info,
+ &m_cols, value,
+ (const uchar*) "", TRUE)))
+ {
+ fprintf(stderr, "\nError row length: %zu\n", length2);
+ exit(1);
+ }
+ value+= length2;
+
+ swap_buff2= (uchar *) my_malloc(length2, MYF(0));
+ if (!swap_buff2)
+ {
+ fprintf(stderr, "\nError: Out of memory. "
+ "Could not exchange to flashback event.\n");
+ exit(1);
+ }
+ memcpy(swap_buff2, start_pos + length1, length2); // WHERE part
+ }
+
+ if (ev_type == UPDATE_ROWS_EVENT ||
+ ev_type == UPDATE_ROWS_EVENT_V1)
+ {
+ /* Swap SET and WHERE part */
+ memcpy(start_pos, swap_buff2, length2);
+ memcpy(start_pos + length2, swap_buff1, length1);
+ }
+
+ /* Free tmp buffers */
+ my_free(swap_buff1);
+ if (ev_type == UPDATE_ROWS_EVENT ||
+ ev_type == UPDATE_ROWS_EVENT_V1)
+ my_free(swap_buff2);
+
+ /* Copying one row into a buff, and pushing into the array */
+ LEX_STRING one_row;
+
+ one_row.length= length1 + length2;
+ one_row.str= (char *) my_malloc(one_row.length, MYF(0));
+ memcpy(one_row.str, start_pos, one_row.length);
+ if (one_row.str == NULL || push_dynamic(&rows_arr, (uchar *) &one_row))
+ {
+ fprintf(stderr, "\nError: Out of memory. "
+ "Could not push flashback event into array.\n");
+ exit(1);
+ }
+ }
+
+ /* Copying rows from the end to the begining into event */
+ for (uint i= rows_arr.elements; i > 0; --i)
+ {
+ LEX_STRING *one_row= dynamic_element(&rows_arr, i - 1, LEX_STRING*);
+
+ memcpy(rows_pos, (uchar *)one_row->str, one_row->length);
+ rows_pos+= one_row->length;
+ my_free(one_row->str);
+ }
+ delete_dynamic(&rows_arr);
+
+end:
+ delete td;
+}
+
+/**
+ Calc length of a packed value of the given SQL type
+
+ @param[in] ptr Pointer to string
+ @param[in] type Column type
+ @param[in] meta Column meta information
+
+ @retval - number of bytes scanned from ptr.
+ Except in case of NULL, in which case we return 1 to indicate ok
+*/
+
+static size_t calc_field_event_length(const uchar *ptr, uint type, uint meta)
+{
+ uint32 length= 0;
+
+ if (type == MYSQL_TYPE_STRING)
+ {
+ if (meta >= 256)
+ {
+ uint byte0= meta >> 8;
+ uint byte1= meta & 0xFF;
+
+ if ((byte0 & 0x30) != 0x30)
+ {
+ /* a long CHAR() field: see #37426 */
+ length= byte1 | (((byte0 & 0x30) ^ 0x30) << 4);
+ type= byte0 | 0x30;
+ }
+ else
+ length = meta & 0xFF;
+ }
+ else
+ length= meta;
+ }
+
+ switch (type) {
+ case MYSQL_TYPE_LONG:
+ case MYSQL_TYPE_TIMESTAMP:
+ return 4;
+ case MYSQL_TYPE_TINY:
+ case MYSQL_TYPE_YEAR:
+ return 1;
+ case MYSQL_TYPE_SHORT:
+ return 2;
+ case MYSQL_TYPE_INT24:
+ case MYSQL_TYPE_TIME:
+ case MYSQL_TYPE_NEWDATE:
+ case MYSQL_TYPE_DATE:
+ return 3;
+ case MYSQL_TYPE_LONGLONG:
+ case MYSQL_TYPE_DATETIME:
+ return 8;
+ case MYSQL_TYPE_NEWDECIMAL:
+ {
+ uint precision= meta >> 8;
+ uint decimals= meta & 0xFF;
+ uint bin_size= my_decimal_get_binary_size(precision, decimals);
+ return bin_size;
+ }
+ case MYSQL_TYPE_FLOAT:
+ return 4;
+ case MYSQL_TYPE_DOUBLE:
+ return 8;
+ case MYSQL_TYPE_BIT:
+ {
+ /* Meta-data: bit_len, bytes_in_rec, 2 bytes */
+ uint nbits= ((meta >> 8) * 8) + (meta & 0xFF);
+ length= (nbits + 7) / 8;
+ return length;
+ }
+ case MYSQL_TYPE_TIMESTAMP2:
+ return my_timestamp_binary_length(meta);
+ case MYSQL_TYPE_DATETIME2:
+ return my_datetime_binary_length(meta);
+ case MYSQL_TYPE_TIME2:
+ return my_time_binary_length(meta);
+ case MYSQL_TYPE_ENUM:
+ switch (meta & 0xFF) {
+ case 1:
+ case 2:
+ return (meta & 0xFF);
+ default:
+ /* Unknown ENUM packlen=%d", meta & 0xFF */
+ return 0;
+ }
+ break;
+ case MYSQL_TYPE_SET:
+ return meta & 0xFF;
+ case MYSQL_TYPE_BLOB:
+ switch (meta) {
+ default:
+ return 0;
+ case 1:
+ return *ptr + 1;
+ case 2:
+ return uint2korr(ptr) + 2;
+ case 3:
+ return uint3korr(ptr) + 3;
+ case 4:
+ return uint4korr(ptr) + 4;
+ }
+ case MYSQL_TYPE_VARCHAR:
+ case MYSQL_TYPE_VAR_STRING:
+ length= meta;
+ /* fall through */
+ case MYSQL_TYPE_STRING:
+ if (length < 256)
+ return (uint) *ptr + 1;
+ return uint2korr(ptr) + 2;
+ case MYSQL_TYPE_DECIMAL:
+ break;
+ default:
+ break;
+ }
+ return 0;
+}
+
+
+size_t
+Rows_log_event::calc_row_event_length(table_def *td,
+ PRINT_EVENT_INFO *print_event_info,
+ MY_BITMAP *cols_bitmap,
+ const uchar *value)
+{
+ const uchar *value0= value;
+ const uchar *null_bits= value;
+ uint null_bit_index= 0;
+
+ /*
+ Skip metadata bytes which gives the information about nullabity of master
+ columns. Master writes one bit for each affected column.
+ */
+
+ value+= (bitmap_bits_set(cols_bitmap) + 7) / 8;
+
+ for (uint i= 0; i < (uint)td->size(); i ++)
+ {
+ int is_null;
+ is_null= (null_bits[null_bit_index / 8] >> (null_bit_index % 8)) & 0x01;
+
+ if (bitmap_is_set(cols_bitmap, i) == 0)
+ continue;
+
+ if (!is_null)
+ {
+ size_t size;
+ size_t fsize= td->calc_field_size((uint)i, (uchar*) value);
+ if (value + fsize > m_rows_end)
+ {
+ /* Corrupted replication event was detected, skipping entry */
+ return 0;
+ }
+ if (!(size= calc_field_event_length(value, td->type(i),
+ td->field_metadata(i))))
+ return 0;
+ value+= size;
+ }
+ null_bit_index++;
+ }
+ return value - value0;
+}
+
+
+/**
+ Calculate how many rows there are in the event
+
+ @param[in] file IO cache
+ @param[in] print_event_into Print parameters
+*/
+
+void Rows_log_event::count_row_events(PRINT_EVENT_INFO *print_event_info)
+{
+ Table_map_log_event *map;
+ table_def *td;
+ uint row_events;
+ Log_event_type general_type_code= get_general_type_code();
+
+ switch (general_type_code) {
+ case WRITE_ROWS_EVENT:
+ case DELETE_ROWS_EVENT:
+ row_events= 1;
+ break;
+ case UPDATE_ROWS_EVENT:
+ row_events= 2;
+ break;
+ default:
+ DBUG_ASSERT(0); /* Not possible */
+ return;
+ }
+
+ if (!(map= print_event_info->m_table_map.get_table(m_table_id)) ||
+ !(td= map->create_table_def()))
+ {
+ /* Row event for unknown table */
+ return;
+ }
+
+ for (const uchar *value= m_rows_buf; value < m_rows_end; )
+ {
+ size_t length;
+ print_event_info->row_events++;
+
+ /* Print the first image */
+ if (!(length= calc_row_event_length(td, print_event_info,
+ &m_cols, value)))
+ break;
+ value+= length;
+ DBUG_ASSERT(value <= m_rows_end);
+
+ /* Print the second image (for UPDATE only) */
+ if (row_events == 2)
+ {
+ if (!(length= calc_row_event_length(td, print_event_info,
+ &m_cols_ai, value)))
+ break;
+ value+= length;
+ DBUG_ASSERT(value <= m_rows_end);
+ }
+ }
+ delete td;
+}
+
+
+/**
+ Print a row event into IO cache in human readable form (in SQL format)
+
+ @param[in] file IO cache
+ @param[in] print_event_into Print parameters
+*/
+
+bool Rows_log_event::print_verbose(IO_CACHE *file,
+ PRINT_EVENT_INFO *print_event_info)
+{
+ Table_map_log_event *map;
+ table_def *td= 0;
+ const char *sql_command, *sql_clause1, *sql_clause2;
+ const char *sql_command_short __attribute__((unused));
+ Log_event_type general_type_code= get_general_type_code();
+#ifdef WHEN_FLASHBACK_REVIEW_READY
+ IO_CACHE *review_sql= &print_event_info->review_sql_cache;
+#endif
+
+ if (m_extra_row_data)
+ {
+ uint8 extra_data_len= m_extra_row_data[EXTRA_ROW_INFO_LEN_OFFSET];
+ uint8 extra_payload_len= extra_data_len - EXTRA_ROW_INFO_HDR_BYTES;
+ assert(extra_data_len >= EXTRA_ROW_INFO_HDR_BYTES);
+
+ if (my_b_printf(file, "### Extra row data format: %u, len: %u :",
+ m_extra_row_data[EXTRA_ROW_INFO_FORMAT_OFFSET],
+ extra_payload_len))
+ goto err;
+ if (extra_payload_len)
+ {
+ /*
+ Buffer for hex view of string, including '0x' prefix,
+ 2 hex chars / byte and trailing 0
+ */
+ const int buff_len= 2 + (256 * 2) + 1;
+ char buff[buff_len];
+ str_to_hex(buff, (const char*) &m_extra_row_data[EXTRA_ROW_INFO_HDR_BYTES],
+ extra_payload_len);
+ if (my_b_printf(file, "%s", buff))
+ goto err;
+ }
+ if (my_b_printf(file, "\n"))
+ goto err;
+ }
+
+ switch (general_type_code) {
+ case WRITE_ROWS_EVENT:
+ sql_command= "INSERT INTO";
+ sql_clause1= "### SET\n";
+ sql_clause2= NULL;
+ sql_command_short= "I";
+ break;
+ case DELETE_ROWS_EVENT:
+ sql_command= "DELETE FROM";
+ sql_clause1= "### WHERE\n";
+ sql_clause2= NULL;
+ sql_command_short= "D";
+ break;
+ case UPDATE_ROWS_EVENT:
+ sql_command= "UPDATE";
+ sql_clause1= "### WHERE\n";
+ sql_clause2= "### SET\n";
+ sql_command_short= "U";
+ break;
+ default:
+ sql_command= sql_clause1= sql_clause2= NULL;
+ sql_command_short= "";
+ DBUG_ASSERT(0); /* Not possible */
+ }
+
+ if (!(map= print_event_info->m_table_map.get_table(m_table_id)) ||
+ !(td= map->create_table_def()))
+ {
+ return (my_b_printf(file, "### Row event for unknown table #%lu",
+ (ulong) m_table_id));
+ }
+
+ /* If the write rows event contained no values for the AI */
+ if (((general_type_code == WRITE_ROWS_EVENT) && (m_rows_buf==m_rows_end)))
+ {
+ if (my_b_printf(file, "### INSERT INTO %`s.%`s VALUES ()\n",
+ map->get_db_name(), map->get_table_name()))
+ goto err;
+ goto end;
+ }
+
+ for (const uchar *value= m_rows_buf; value < m_rows_end; )
+ {
+ size_t length;
+ print_event_info->row_events++;
+
+ if (my_b_printf(file, "### %s %`s.%`s\n",
+ sql_command,
+ map->get_db_name(), map->get_table_name()))
+ goto err;
+#ifdef WHEN_FLASHBACK_REVIEW_READY
+ if (need_flashback_review)
+ if (my_b_printf(review_sql, "\nINSERT INTO `%s`.`%s` VALUES ('%s'",
+ map->get_review_dbname(), map->get_review_tablename(),
+ sql_command_short))
+ goto err;
+#endif
+
+ /* Print the first image */
+ if (!(length= print_verbose_one_row(file, td, print_event_info,
+ &m_cols, value,
+ (const uchar*) sql_clause1)))
+ goto err;
+ value+= length;
+
+ /* Print the second image (for UPDATE only) */
+ if (sql_clause2)
+ {
+ if (!(length= print_verbose_one_row(file, td, print_event_info,
+ &m_cols_ai, value,
+ (const uchar*) sql_clause2)))
+ goto err;
+ value+= length;
+ }
+#ifdef WHEN_FLASHBACK_REVIEW_READY
+ else
+ {
+ if (need_flashback_review)
+ for (size_t i= 0; i < td->size(); i ++)
+ if (my_b_printf(review_sql, ", NULL"))
+ goto err;
+ }
+
+ if (need_flashback_review)
+ if (my_b_printf(review_sql, ")%s\n", print_event_info->delimiter))
+ goto err;
+#endif
+ }
+
+end:
+ delete td;
+ return 0;
+err:
+ delete td;
+ return 1;
+}
+
+void free_table_map_log_event(Table_map_log_event *event)
+{
+ delete event;
+}
+
+/**
+ Encode the event, optionally per 'do_print_encoded' arg store the
+ result into the argument cache; optionally per event_info's
+ 'verbose' print into the cache a verbose representation of the event.
+ Note, no extra wrapping is done to the being io-cached data, like
+ to producing a BINLOG query. It's left for a routine that extracts from
+ the cache.
+
+ @param file pointer to IO_CACHE
+ @param print_event_info pointer to print_event_info specializing
+ what out of and how to print the event
+ @param do_print_encoded whether to store base64-encoded event
+ into @file.
+*/
+bool Log_event::print_base64(IO_CACHE* file,
+ PRINT_EVENT_INFO* print_event_info,
+ bool do_print_encoded)
+{
+ uchar *ptr= (uchar *)temp_buf;
+ uint32 size= uint4korr(ptr + EVENT_LEN_OFFSET);
+ DBUG_ENTER("Log_event::print_base64");
+
+ if (is_flashback)
+ {
+ uint tmp_size= size;
+ Rows_log_event *ev= NULL;
+ Log_event_type ev_type = (enum Log_event_type) ptr[EVENT_TYPE_OFFSET];
+ if (checksum_alg != BINLOG_CHECKSUM_ALG_UNDEF &&
+ checksum_alg != BINLOG_CHECKSUM_ALG_OFF)
+ tmp_size-= BINLOG_CHECKSUM_LEN; // checksum is displayed through the header
+ switch (ev_type) {
+ case WRITE_ROWS_EVENT:
+ ptr[EVENT_TYPE_OFFSET]= DELETE_ROWS_EVENT;
+ ev= new Delete_rows_log_event((const char*) ptr, tmp_size,
+ glob_description_event);
+ ev->change_to_flashback_event(print_event_info, ptr, ev_type);
+ break;
+ case WRITE_ROWS_EVENT_V1:
+ ptr[EVENT_TYPE_OFFSET]= DELETE_ROWS_EVENT_V1;
+ ev= new Delete_rows_log_event((const char*) ptr, tmp_size,
+ glob_description_event);
+ ev->change_to_flashback_event(print_event_info, ptr, ev_type);
+ break;
+ case DELETE_ROWS_EVENT:
+ ptr[EVENT_TYPE_OFFSET]= WRITE_ROWS_EVENT;
+ ev= new Write_rows_log_event((const char*) ptr, tmp_size,
+ glob_description_event);
+ ev->change_to_flashback_event(print_event_info, ptr, ev_type);
+ break;
+ case DELETE_ROWS_EVENT_V1:
+ ptr[EVENT_TYPE_OFFSET]= WRITE_ROWS_EVENT_V1;
+ ev= new Write_rows_log_event((const char*) ptr, tmp_size,
+ glob_description_event);
+ ev->change_to_flashback_event(print_event_info, ptr, ev_type);
+ break;
+ case UPDATE_ROWS_EVENT:
+ case UPDATE_ROWS_EVENT_V1:
+ ev= new Update_rows_log_event((const char*) ptr, tmp_size,
+ glob_description_event);
+ ev->change_to_flashback_event(print_event_info, ptr, ev_type);
+ break;
+ default:
+ break;
+ }
+ delete ev;
+ }
+
+ if (do_print_encoded)
+ {
+ size_t const tmp_str_sz= my_base64_needed_encoded_length((int) size);
+ char *tmp_str;
+ if (!(tmp_str= (char *) my_malloc(tmp_str_sz, MYF(MY_WME))))
+ goto err;
+
+ if (my_base64_encode(ptr, (size_t) size, tmp_str))
+ {
+ DBUG_ASSERT(0);
+ }
+
+ my_b_printf(file, "%s\n", tmp_str);
+ my_free(tmp_str);
+ }
+
+#ifdef WHEN_FLASHBACK_REVIEW_READY
+ if (print_event_info->verbose || print_event_info->print_row_count ||
+ need_flashback_review)
+#else
+ // Flashback need the table_map to parse the event
+ if (print_event_info->verbose || print_event_info->print_row_count ||
+ is_flashback)
+#endif
+ {
+ Rows_log_event *ev= NULL;
+ Log_event_type et= (Log_event_type) ptr[EVENT_TYPE_OFFSET];
+
+ if (checksum_alg != BINLOG_CHECKSUM_ALG_UNDEF &&
+ checksum_alg != BINLOG_CHECKSUM_ALG_OFF)
+ size-= BINLOG_CHECKSUM_LEN; // checksum is displayed through the header
+
+ switch (et)
+ {
+ case TABLE_MAP_EVENT:
+ {
+ Table_map_log_event *map;
+ map= new Table_map_log_event((const char*) ptr, size,
+ glob_description_event);
+#ifdef WHEN_FLASHBACK_REVIEW_READY
+ if (need_flashback_review)
+ {
+ map->set_review_dbname(m_review_dbname.ptr());
+ map->set_review_tablename(m_review_tablename.ptr());
+ }
+#endif
+ print_event_info->m_table_map.set_table(map->get_table_id(), map);
+ break;
+ }
+ case WRITE_ROWS_EVENT:
+ case WRITE_ROWS_EVENT_V1:
+ {
+ ev= new Write_rows_log_event((const char*) ptr, size,
+ glob_description_event);
+ break;
+ }
+ case DELETE_ROWS_EVENT:
+ case DELETE_ROWS_EVENT_V1:
+ {
+ ev= new Delete_rows_log_event((const char*) ptr, size,
+ glob_description_event);
+ break;
+ }
+ case UPDATE_ROWS_EVENT:
+ case UPDATE_ROWS_EVENT_V1:
+ {
+ ev= new Update_rows_log_event((const char*) ptr, size,
+ glob_description_event);
+ break;
+ }
+ case WRITE_ROWS_COMPRESSED_EVENT:
+ case WRITE_ROWS_COMPRESSED_EVENT_V1:
+ {
+ ev= new Write_rows_compressed_log_event((const char*) ptr, size,
+ glob_description_event);
+ break;
+ }
+ case UPDATE_ROWS_COMPRESSED_EVENT:
+ case UPDATE_ROWS_COMPRESSED_EVENT_V1:
+ {
+ ev= new Update_rows_compressed_log_event((const char*) ptr, size,
+ glob_description_event);
+ break;
+ }
+ case DELETE_ROWS_COMPRESSED_EVENT:
+ case DELETE_ROWS_COMPRESSED_EVENT_V1:
+ {
+ ev= new Delete_rows_compressed_log_event((const char*) ptr, size,
+ glob_description_event);
+ break;
+ }
+ default:
+ break;
+ }
+
+ if (ev)
+ {
+ bool error= 0;
+
+#ifdef WHEN_FLASHBACK_REVIEW_READY
+ ev->need_flashback_review= need_flashback_review;
+ if (print_event_info->verbose)
+ {
+ if (ev->print_verbose(file, print_event_info))
+ goto err;
+ }
+ else
+ {
+ IO_CACHE tmp_cache;
+
+ if (open_cached_file(&tmp_cache, NULL, NULL, 0,
+ MYF(MY_WME | MY_NABP)))
+ {
+ delete ev;
+ goto err;
+ }
+
+ error= ev->print_verbose(&tmp_cache, print_event_info);
+ close_cached_file(&tmp_cache);
+ if (unlikely(error))
+ {
+ delete ev;
+ goto err;
+ }
+ }
+#else
+ if (print_event_info->verbose)
+ {
+ /*
+ Verbose event printout can't start before encoded data
+ got enquoted. This is done at this point though multi-row
+ statement remain vulnerable.
+ TODO: fix MDEV-10362 to remove this workaround.
+ */
+ if (print_event_info->base64_output_mode !=
+ BASE64_OUTPUT_DECODE_ROWS)
+ my_b_printf(file, "'%s\n", print_event_info->delimiter);
+ error= ev->print_verbose(file, print_event_info);
+ }
+ else
+ {
+ ev->count_row_events(print_event_info);
+ }
+#endif
+ delete ev;
+ if (unlikely(error))
+ goto err;
+ }
+ }
+ DBUG_RETURN(0);
+
+err:
+ DBUG_RETURN(1);
+}
+
+
+/*
+ Log_event::print_timestamp()
+*/
+
+bool Log_event::print_timestamp(IO_CACHE* file, time_t* ts)
+{
+ struct tm *res;
+ time_t my_when= when;
+ DBUG_ENTER("Log_event::print_timestamp");
+ if (!ts)
+ ts = &my_when;
+ res=localtime(ts);
+
+ DBUG_RETURN(my_b_printf(file,"%02d%02d%02d %2d:%02d:%02d",
+ res->tm_year % 100,
+ res->tm_mon+1,
+ res->tm_mday,
+ res->tm_hour,
+ res->tm_min,
+ res->tm_sec));
+}
+
+
+/**
+ Query_log_event::print().
+
+ @todo
+ print the catalog ??
+*/
+bool Query_log_event::print_query_header(IO_CACHE* file,
+ PRINT_EVENT_INFO* print_event_info)
+{
+ // TODO: print the catalog ??
+ char buff[64], *end; // Enough for SET TIMESTAMP
+ bool different_db= 1;
+ uint32 tmp;
+
+ if (!print_event_info->short_form)
+ {
+ if (print_header(file, print_event_info, FALSE) ||
+ my_b_printf(file,
+ "\t%s\tthread_id=%lu\texec_time=%lu\terror_code=%d\n",
+ get_type_str(), (ulong) thread_id, (ulong) exec_time,
+ error_code))
+ goto err;
+ }
+
+ if ((flags & LOG_EVENT_SUPPRESS_USE_F))
+ {
+ if (!is_trans_keyword())
+ print_event_info->db[0]= '\0';
+ }
+ else if (db)
+ {
+ different_db= memcmp(print_event_info->db, db, db_len + 1);
+ if (different_db)
+ memcpy(print_event_info->db, db, db_len + 1);
+ if (db[0] && different_db)
+ if (my_b_printf(file, "use %`s%s\n", db, print_event_info->delimiter))
+ goto err;
+ }
+
+ end=int10_to_str((long) when, strmov(buff,"SET TIMESTAMP="),10);
+ if (when_sec_part && when_sec_part <= TIME_MAX_SECOND_PART)
+ {
+ *end++= '.';
+ end=int10_to_str(when_sec_part, end, 10);
+ }
+ end= strmov(end, print_event_info->delimiter);
+ *end++='\n';
+ if (my_b_write(file, (uchar*) buff, (uint) (end-buff)))
+ goto err;
+ if ((!print_event_info->thread_id_printed ||
+ ((flags & LOG_EVENT_THREAD_SPECIFIC_F) &&
+ thread_id != print_event_info->thread_id)))
+ {
+ // If --short-form, print deterministic value instead of pseudo_thread_id.
+ if (my_b_printf(file,"SET @@session.pseudo_thread_id=%lu%s\n",
+ short_form ? 999999999 : (ulong)thread_id,
+ print_event_info->delimiter))
+ goto err;
+ print_event_info->thread_id= thread_id;
+ print_event_info->thread_id_printed= 1;
+ }
+
+ /*
+ If flags2_inited==0, this is an event from 3.23 or 4.0; nothing to
+ print (remember we don't produce mixed relay logs so there cannot be
+ 5.0 events before that one so there is nothing to reset).
+ */
+ if (likely(flags2_inited)) /* likely as this will mainly read 5.0 logs */
+ {
+ /* tmp is a bitmask of bits which have changed. */
+ if (likely(print_event_info->flags2_inited))
+ /* All bits which have changed */
+ tmp= (print_event_info->flags2) ^ flags2;
+ else /* that's the first Query event we read */
+ {
+ print_event_info->flags2_inited= 1;
+ tmp= ~((uint32)0); /* all bits have changed */
+ }
+
+ if (unlikely(tmp)) /* some bits have changed */
+ {
+ bool need_comma= 0;
+ if (my_b_write_string(file, "SET ") ||
+ print_set_option(file, tmp, OPTION_NO_FOREIGN_KEY_CHECKS, ~flags2,
+ "@@session.foreign_key_checks", &need_comma)||
+ print_set_option(file, tmp, OPTION_AUTO_IS_NULL, flags2,
+ "@@session.sql_auto_is_null", &need_comma) ||
+ print_set_option(file, tmp, OPTION_RELAXED_UNIQUE_CHECKS, ~flags2,
+ "@@session.unique_checks", &need_comma) ||
+ print_set_option(file, tmp, OPTION_NOT_AUTOCOMMIT, ~flags2,
+ "@@session.autocommit", &need_comma) ||
+ print_set_option(file, tmp, OPTION_NO_CHECK_CONSTRAINT_CHECKS,
+ ~flags2,
+ "@@session.check_constraint_checks", &need_comma) ||
+ my_b_printf(file,"%s\n", print_event_info->delimiter))
+ goto err;
+ print_event_info->flags2= flags2;
+ }
+ }
+
+ /*
+ Now the session variables;
+ it's more efficient to pass SQL_MODE as a number instead of a
+ comma-separated list.
+ FOREIGN_KEY_CHECKS, SQL_AUTO_IS_NULL, UNIQUE_CHECKS are session-only
+ variables (they have no global version; they're not listed in
+ sql_class.h), The tests below work for pure binlogs or pure relay
+ logs. Won't work for mixed relay logs but we don't create mixed
+ relay logs (that is, there is no relay log with a format change
+ except within the 3 first events, which mysqlbinlog handles
+ gracefully). So this code should always be good.
+ */
+
+ if (likely(sql_mode_inited) &&
+ (unlikely(print_event_info->sql_mode != sql_mode ||
+ !print_event_info->sql_mode_inited)))
+ {
+ char llbuff[22];
+ if (my_b_printf(file,"SET @@session.sql_mode=%s%s\n",
+ ullstr(sql_mode, llbuff), print_event_info->delimiter))
+ goto err;
+ print_event_info->sql_mode= sql_mode;
+ print_event_info->sql_mode_inited= 1;
+ }
+ if (print_event_info->auto_increment_increment != auto_increment_increment ||
+ print_event_info->auto_increment_offset != auto_increment_offset)
+ {
+ if (my_b_printf(file,"SET @@session.auto_increment_increment=%lu, @@session.auto_increment_offset=%lu%s\n",
+ auto_increment_increment,auto_increment_offset,
+ print_event_info->delimiter))
+ goto err;
+ print_event_info->auto_increment_increment= auto_increment_increment;
+ print_event_info->auto_increment_offset= auto_increment_offset;
+ }
+
+ /* TODO: print the catalog when we feature SET CATALOG */
+
+ if (likely(charset_inited) &&
+ (unlikely(!print_event_info->charset_inited ||
+ memcmp(print_event_info->charset, charset, 6))))
+ {
+ CHARSET_INFO *cs_info= get_charset(uint2korr(charset), MYF(MY_WME));
+ if (cs_info)
+ {
+ /* for mysql client */
+ if (my_b_printf(file, "/*!\\C %s */%s\n",
+ cs_info->csname, print_event_info->delimiter))
+ goto err;
+ }
+ if (my_b_printf(file,"SET "
+ "@@session.character_set_client=%d,"
+ "@@session.collation_connection=%d,"
+ "@@session.collation_server=%d"
+ "%s\n",
+ uint2korr(charset),
+ uint2korr(charset+2),
+ uint2korr(charset+4),
+ print_event_info->delimiter))
+ goto err;
+ memcpy(print_event_info->charset, charset, 6);
+ print_event_info->charset_inited= 1;
+ }
+ if (time_zone_len)
+ {
+ if (memcmp(print_event_info->time_zone_str,
+ time_zone_str, time_zone_len+1))
+ {
+ if (my_b_printf(file,"SET @@session.time_zone='%s'%s\n",
+ time_zone_str, print_event_info->delimiter))
+ goto err;
+ memcpy(print_event_info->time_zone_str, time_zone_str, time_zone_len+1);
+ }
+ }
+ if (lc_time_names_number != print_event_info->lc_time_names_number)
+ {
+ if (my_b_printf(file, "SET @@session.lc_time_names=%d%s\n",
+ lc_time_names_number, print_event_info->delimiter))
+ goto err;
+ print_event_info->lc_time_names_number= lc_time_names_number;
+ }
+ if (charset_database_number != print_event_info->charset_database_number)
+ {
+ if (charset_database_number)
+ {
+ if (my_b_printf(file, "SET @@session.collation_database=%d%s\n",
+ charset_database_number, print_event_info->delimiter))
+ goto err;
+ }
+ else if (my_b_printf(file, "SET @@session.collation_database=DEFAULT%s\n",
+ print_event_info->delimiter))
+ goto err;
+ print_event_info->charset_database_number= charset_database_number;
+ }
+ return 0;
+
+err:
+ return 1;
+}
+
+
+bool Query_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
+{
+ Write_on_release_cache cache(&print_event_info->head_cache, file, 0, this);
+
+ /**
+ reduce the size of io cache so that the write function is called
+ for every call to my_b_write().
+ */
+ DBUG_EXECUTE_IF ("simulate_file_write_error",
+ {(&cache)->write_pos= (&cache)->write_end- 500;});
+ if (print_query_header(&cache, print_event_info))
+ goto err;
+ if (!is_flashback)
+ {
+ if (my_b_write(&cache, (uchar*) query, q_len) ||
+ my_b_printf(&cache, "\n%s\n", print_event_info->delimiter))
+ goto err;
+ }
+ else // is_flashback == 1
+ {
+ if (strcmp("BEGIN", query) == 0)
+ {
+ if (my_b_write(&cache, (uchar*) "COMMIT", 6) ||
+ my_b_printf(&cache, "\n%s\n", print_event_info->delimiter))
+ goto err;
+ }
+ else if (strcmp("COMMIT", query) == 0)
+ {
+ if (my_b_write(&cache, (uchar*) "BEGIN", 5) ||
+ my_b_printf(&cache, "\n%s\n", print_event_info->delimiter))
+ goto err;
+ }
+ }
+ return cache.flush_data();
+err:
+ return 1;
+}
+
+
+bool Start_log_event_v3::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
+{
+ DBUG_ENTER("Start_log_event_v3::print");
+
+ Write_on_release_cache cache(&print_event_info->head_cache, file,
+ Write_on_release_cache::FLUSH_F);
+
+ if (!print_event_info->short_form)
+ {
+ if (print_header(&cache, print_event_info, FALSE) ||
+ my_b_printf(&cache, "\tStart: binlog v %d, server v %s created ",
+ binlog_version, server_version) ||
+ print_timestamp(&cache))
+ goto err;
+ if (created)
+ if (my_b_printf(&cache," at startup"))
+ goto err;
+ if (my_b_printf(&cache, "\n"))
+ goto err;
+ if (flags & LOG_EVENT_BINLOG_IN_USE_F)
+ if (my_b_printf(&cache,
+ "# Warning: this binlog is either in use or was not "
+ "closed properly.\n"))
+ goto err;
+ }
+ if (!is_artificial_event() && created)
+ {
+#ifdef WHEN_WE_HAVE_THE_RESET_CONNECTION_SQL_COMMAND
+ /*
+ This is for mysqlbinlog: like in replication, we want to delete the stale
+ tmp files left by an unclean shutdown of mysqld (temporary tables)
+ and rollback unfinished transaction.
+ Probably this can be done with RESET CONNECTION (syntax to be defined).
+ */
+ if (my_b_printf(&cache,"RESET CONNECTION%s\n",
+ print_event_info->delimiter))
+ goto err;
+#else
+ if (my_b_printf(&cache,"ROLLBACK%s\n", print_event_info->delimiter))
+ goto err;
+#endif
+ }
+ if (temp_buf &&
+ print_event_info->base64_output_mode != BASE64_OUTPUT_NEVER &&
+ !print_event_info->short_form)
+ {
+ /* BINLOG is matched with the delimiter below on the same level */
+ bool do_print_encoded=
+ print_event_info->base64_output_mode != BASE64_OUTPUT_DECODE_ROWS;
+ if (do_print_encoded)
+ my_b_printf(&cache, "BINLOG '\n");
+
+ if (print_base64(&cache, print_event_info, do_print_encoded))
+ goto err;
+
+ if (do_print_encoded)
+ my_b_printf(&cache, "'%s\n", print_event_info->delimiter);
+
+ print_event_info->printed_fd_event= TRUE;
+ }
+ DBUG_RETURN(cache.flush_data());
+err:
+ DBUG_RETURN(1);
+}
+
+
+bool 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"));
+ if (my_b_write(&cache, (uchar*)buf.ptr(), buf.length()))
+ return 1;
+ return (cache.flush_data());
+}
+
+
+bool Load_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
+{
+ return print(file, print_event_info, 0);
+}
+
+
+bool Load_log_event::print(FILE* file_arg, PRINT_EVENT_INFO* print_event_info,
+ bool commented)
+{
+ Write_on_release_cache cache(&print_event_info->head_cache, file_arg);
+ bool different_db= 1;
+ DBUG_ENTER("Load_log_event::print");
+
+ if (!print_event_info->short_form)
+ {
+ if (print_header(&cache, print_event_info, FALSE) ||
+ my_b_printf(&cache, "\tQuery\tthread_id=%ld\texec_time=%ld\n",
+ thread_id, exec_time))
+ goto err;
+ }
+
+ if (db)
+ {
+ /*
+ If the database is different from the one of the previous statement, we
+ need to print the "use" command, and we update the last_db.
+ But if commented, the "use" is going to be commented so we should not
+ update the last_db.
+ */
+ if ((different_db= memcmp(print_event_info->db, db, db_len + 1)) &&
+ !commented)
+ memcpy(print_event_info->db, db, db_len + 1);
+ }
+
+ if (db && db[0] && different_db)
+ if (my_b_printf(&cache, "%suse %`s%s\n",
+ commented ? "# " : "",
+ db, print_event_info->delimiter))
+ goto err;
+
+ if (flags & LOG_EVENT_THREAD_SPECIFIC_F)
+ if (my_b_printf(&cache,"%sSET @@session.pseudo_thread_id=%lu%s\n",
+ commented ? "# " : "", (ulong)thread_id,
+ print_event_info->delimiter))
+ goto err;
+ if (my_b_printf(&cache, "%sLOAD DATA ",
+ commented ? "# " : ""))
+ goto err;
+ if (check_fname_outside_temp_buf())
+ if (my_b_write_string(&cache, "LOCAL "))
+ goto err;
+ if (my_b_printf(&cache, "INFILE '%-*s' ", fname_len, fname))
+ goto err;
+
+ if (sql_ex.opt_flags & REPLACE_FLAG)
+ {
+ if (my_b_write_string(&cache, "REPLACE "))
+ goto err;
+ }
+ else if (sql_ex.opt_flags & IGNORE_FLAG)
+ if (my_b_write_string(&cache, "IGNORE "))
+ goto err;
+
+ if (my_b_printf(&cache, "INTO TABLE `%s`", table_name) ||
+ my_b_write_string(&cache, " FIELDS TERMINATED BY ") ||
+ pretty_print_str(&cache, sql_ex.field_term, sql_ex.field_term_len))
+ goto err;
+
+ if (sql_ex.opt_flags & OPT_ENCLOSED_FLAG)
+ if (my_b_write_string(&cache, " OPTIONALLY "))
+ goto err;
+ if (my_b_write_string(&cache, " ENCLOSED BY ") ||
+ pretty_print_str(&cache, sql_ex.enclosed, sql_ex.enclosed_len) ||
+ my_b_write_string(&cache, " ESCAPED BY ") ||
+ pretty_print_str(&cache, sql_ex.escaped, sql_ex.escaped_len) ||
+ my_b_write_string(&cache, " LINES TERMINATED BY ") ||
+ pretty_print_str(&cache, sql_ex.line_term, sql_ex.line_term_len))
+ goto err;
+
+ if (sql_ex.line_start)
+ {
+ if (my_b_write_string(&cache," STARTING BY ") ||
+ pretty_print_str(&cache, sql_ex.line_start, sql_ex.line_start_len))
+ goto err;
+ }
+ if ((long) skip_lines > 0)
+ if (my_b_printf(&cache, " IGNORE %ld LINES", (long) skip_lines))
+ goto err;
+
+ if (num_fields)
+ {
+ uint i;
+ const char* field = fields;
+ if (my_b_write_string(&cache, " ("))
+ goto err;
+ for (i = 0; i < num_fields; i++)
+ {
+ if (i)
+ if (my_b_write_byte(&cache, ','))
+ goto err;
+ if (my_b_printf(&cache, "%`s", field))
+ goto err;
+ field += field_lens[i] + 1;
+ }
+ if (my_b_write_byte(&cache, ')'))
+ goto err;
+ }
+
+ if (my_b_printf(&cache, "%s\n", print_event_info->delimiter))
+ goto err;
+ DBUG_RETURN(cache.flush_data());
+err:
+ DBUG_RETURN(1);
+}
+
+
+bool Rotate_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
+{
+ if (print_event_info->short_form)
+ return 0;
+
+ char buf[22];
+ Write_on_release_cache cache(&print_event_info->head_cache, file,
+ Write_on_release_cache::FLUSH_F);
+ if (print_header(&cache, print_event_info, FALSE) ||
+ my_b_write_string(&cache, "\tRotate to "))
+ goto err;
+ if (new_log_ident)
+ if (my_b_write(&cache, (uchar*) new_log_ident, (uint)ident_len))
+ goto err;
+ if (my_b_printf(&cache, " pos: %s\n", llstr(pos, buf)))
+ goto err;
+ return cache.flush_data();
+err:
+ return 1;
+}
+
+
+bool Binlog_checkpoint_log_event::print(FILE *file,
+ PRINT_EVENT_INFO *print_event_info)
+{
+ if (print_event_info->short_form)
+ return 0;
+
+ Write_on_release_cache cache(&print_event_info->head_cache, file,
+ Write_on_release_cache::FLUSH_F);
+
+ if (print_header(&cache, print_event_info, FALSE) ||
+ my_b_write_string(&cache, "\tBinlog checkpoint ") ||
+ my_b_write(&cache, (uchar*)binlog_file_name, binlog_file_len) ||
+ my_b_write_byte(&cache, '\n'))
+ return 1;
+ return cache.flush_data();
+}
+
+
+bool
+Gtid_list_log_event::print(FILE *file, PRINT_EVENT_INFO *print_event_info)
+{
+ if (print_event_info->short_form)
+ return 0;
+
+ Write_on_release_cache cache(&print_event_info->head_cache, file,
+ Write_on_release_cache::FLUSH_F);
+ char buf[21];
+ uint32 i;
+
+ if (print_header(&cache, print_event_info, FALSE) ||
+ my_b_printf(&cache, "\tGtid list ["))
+ goto err;
+
+ for (i= 0; i < count; ++i)
+ {
+ longlong10_to_str(list[i].seq_no, buf, 10);
+ if (my_b_printf(&cache, "%u-%u-%s", list[i].domain_id,
+ list[i].server_id, buf))
+ goto err;
+ if (i < count-1)
+ if (my_b_printf(&cache, ",\n# "))
+ goto err;
+ }
+ if (my_b_printf(&cache, "]\n"))
+ goto err;
+
+ return cache.flush_data();
+err:
+ return 1;
+}
+
+
+bool Intvar_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
+{
+ char llbuff[22];
+ const char *UNINIT_VAR(msg);
+ Write_on_release_cache cache(&print_event_info->head_cache, file,
+ Write_on_release_cache::FLUSH_F);
+
+ if (!print_event_info->short_form)
+ {
+ if (print_header(&cache, print_event_info, FALSE) ||
+ my_b_write_string(&cache, "\tIntvar\n"))
+ goto err;
+ }
+
+ if (my_b_printf(&cache, "SET "))
+ goto err;
+ switch (type) {
+ case LAST_INSERT_ID_EVENT:
+ msg="LAST_INSERT_ID";
+ break;
+ case INSERT_ID_EVENT:
+ msg="INSERT_ID";
+ break;
+ case INVALID_INT_EVENT:
+ default: // cannot happen
+ msg="INVALID_INT";
+ break;
+ }
+ if (my_b_printf(&cache, "%s=%s%s\n",
+ msg, llstr(val,llbuff), print_event_info->delimiter))
+ goto err;
+
+ return cache.flush_data();
+err:
+ return 1;
+}
+
+
+bool Rand_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
+{
+ Write_on_release_cache cache(&print_event_info->head_cache, file,
+ Write_on_release_cache::FLUSH_F);
+
+ char llbuff[22],llbuff2[22];
+ if (!print_event_info->short_form)
+ {
+ if (print_header(&cache, print_event_info, FALSE) ||
+ my_b_write_string(&cache, "\tRand\n"))
+ goto err;
+ }
+ if (my_b_printf(&cache, "SET @@RAND_SEED1=%s, @@RAND_SEED2=%s%s\n",
+ llstr(seed1, llbuff),llstr(seed2, llbuff2),
+ print_event_info->delimiter))
+ goto err;
+
+ return cache.flush_data();
+err:
+ return 1;
+}
+
+
+bool Xid_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
+{
+ Write_on_release_cache cache(&print_event_info->head_cache, file,
+ Write_on_release_cache::FLUSH_F, this);
+
+ if (!print_event_info->short_form)
+ {
+ char buf[64];
+ longlong10_to_str(xid, buf, 10);
+
+ if (print_header(&cache, print_event_info, FALSE) ||
+ my_b_printf(&cache, "\tXid = %s\n", buf))
+ goto err;
+ }
+ if (my_b_printf(&cache, is_flashback ? "BEGIN%s\n" : "COMMIT%s\n",
+ print_event_info->delimiter))
+ goto err;
+
+ return cache.flush_data();
+err:
+ return 1;
+}
+
+
+bool User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
+{
+ Write_on_release_cache cache(&print_event_info->head_cache, file,
+ Write_on_release_cache::FLUSH_F);
+
+ if (!print_event_info->short_form)
+ {
+ if (print_header(&cache, print_event_info, FALSE) ||
+ my_b_write_string(&cache, "\tUser_var\n"))
+ goto err;
+ }
+
+ if (my_b_write_string(&cache, "SET @") ||
+ my_b_write_backtick_quote(&cache, name, name_len))
+ goto err;
+
+ if (is_null)
+ {
+ if (my_b_printf(&cache, ":=NULL%s\n", print_event_info->delimiter))
+ goto err;
+ }
+ else
+ {
+ switch (type) {
+ case REAL_RESULT:
+ double real_val;
+ char real_buf[FMT_G_BUFSIZE(14)];
+ float8get(real_val, val);
+ sprintf(real_buf, "%.14g", real_val);
+ if (my_b_printf(&cache, ":=%s%s\n", real_buf,
+ print_event_info->delimiter))
+ goto err;
+ break;
+ case INT_RESULT:
+ char int_buf[22];
+ longlong10_to_str(uint8korr(val), int_buf,
+ ((flags & User_var_log_event::UNSIGNED_F) ? 10 : -10));
+ if (my_b_printf(&cache, ":=%s%s\n", int_buf,
+ print_event_info->delimiter))
+ goto err;
+ break;
+ case DECIMAL_RESULT:
+ {
+ char str_buf[200];
+ int str_len= sizeof(str_buf) - 1;
+ int precision= (int)val[0];
+ int scale= (int)val[1];
+ decimal_digit_t dec_buf[10];
+ decimal_t dec;
+ dec.len= 10;
+ dec.buf= dec_buf;
+
+ bin2decimal((uchar*) val+2, &dec, precision, scale);
+ decimal2string(&dec, str_buf, &str_len, 0, 0, 0);
+ str_buf[str_len]= 0;
+ if (my_b_printf(&cache, ":=%s%s\n", str_buf,
+ print_event_info->delimiter))
+ goto err;
+ break;
+ }
+ case STRING_RESULT:
+ {
+ /*
+ Let's express the string in hex. That's the most robust way. If we
+ print it in character form instead, we need to escape it with
+ character_set_client which we don't know (we will know it in 5.0, but
+ in 4.1 we don't know it easily when we are printing
+ User_var_log_event). Explanation why we would need to bother with
+ character_set_client (quoting Bar):
+ > Note, the parser doesn't switch to another unescaping mode after
+ > it has met a character set introducer.
+ > For example, if an SJIS client says something like:
+ > SET @a= _ucs2 \0a\0b'
+ > the string constant is still unescaped according to SJIS, not
+ > according to UCS2.
+ */
+ char *hex_str;
+ CHARSET_INFO *cs;
+ bool error;
+
+ // 2 hex digits / byte
+ hex_str= (char *) my_malloc(2 * val_len + 1 + 3, MYF(MY_WME));
+ if (!hex_str)
+ goto err;
+ str_to_hex(hex_str, val, val_len);
+ /*
+ For proper behaviour when mysqlbinlog|mysql, we need to explicitly
+ specify the variable's collation. It will however cause problems when
+ people want to mysqlbinlog|mysql into another server not supporting the
+ character set. But there's not much to do about this and it's unlikely.
+ */
+ if (!(cs= get_charset(charset_number, MYF(0))))
+ { /*
+ Generate an unusable command (=> syntax error) is probably the best
+ thing we can do here.
+ */
+ error= my_b_printf(&cache, ":=???%s\n", print_event_info->delimiter);
+ }
+ else
+ error= my_b_printf(&cache, ":=_%s %s COLLATE `%s`%s\n",
+ cs->csname, hex_str, cs->name,
+ print_event_info->delimiter);
+ my_free(hex_str);
+ if (unlikely(error))
+ goto err;
+ break;
+ }
+ case ROW_RESULT:
+ default:
+ DBUG_ASSERT(0);
+ break;
+ }
+ }
+
+ return cache.flush_data();
+err:
+ return 1;
+}
+
+
+#ifdef HAVE_REPLICATION
+
+bool Unknown_log_event::print(FILE* file_arg, PRINT_EVENT_INFO* print_event_info)
+{
+ if (print_event_info->short_form)
+ return 0;
+
+ Write_on_release_cache cache(&print_event_info->head_cache, file_arg);
+
+ if (what != ENCRYPTED)
+ {
+ if (print_header(&cache, print_event_info, FALSE) ||
+ my_b_printf(&cache, "\n# Unknown event\n"))
+ goto err;
+ }
+ else if (my_b_printf(&cache, "# Encrypted event\n"))
+ goto err;
+
+ return cache.flush_data();
+err:
+ return 1;
+}
+
+
+bool Stop_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
+{
+ if (print_event_info->short_form)
+ return 0;
+
+ Write_on_release_cache cache(&print_event_info->head_cache, file,
+ Write_on_release_cache::FLUSH_F, this);
+
+ if (print_header(&cache, print_event_info, FALSE) ||
+ my_b_write_string(&cache, "\tStop\n"))
+ return 1;
+ return cache.flush_data();
+}
+
+#endif
+
+
+bool Create_file_log_event::print(FILE* file,
+ PRINT_EVENT_INFO* print_event_info,
+ bool enable_local)
+{
+ if (print_event_info->short_form)
+ {
+ if (enable_local && check_fname_outside_temp_buf())
+ return Load_log_event::print(file, print_event_info);
+ return 0;
+ }
+
+ Write_on_release_cache cache(&print_event_info->head_cache, file);
+
+ if (enable_local)
+ {
+ if (Load_log_event::print(file, print_event_info,
+ !check_fname_outside_temp_buf()))
+ goto err;
+
+ /**
+ reduce the size of io cache so that the write function is called
+ for every call to my_b_printf().
+ */
+ DBUG_EXECUTE_IF ("simulate_create_event_write_error",
+ {(&cache)->write_pos= (&cache)->write_end;
+ DBUG_SET("+d,simulate_file_write_error");});
+ /*
+ That one is for "file_id: etc" below: in mysqlbinlog we want the #, in
+ SHOW BINLOG EVENTS we don't.
+ */
+ if (my_b_write_byte(&cache, '#'))
+ goto err;
+ }
+
+ if (my_b_printf(&cache, " file_id: %d block_len: %d\n", file_id, block_len))
+ goto err;
+
+ return cache.flush_data();
+err:
+ return 1;
+
+}
+
+
+bool Create_file_log_event::print(FILE* file,
+ PRINT_EVENT_INFO* print_event_info)
+{
+ return print(file, print_event_info, 0);
+}
+
+
+/*
+ Append_block_log_event::print()
+*/
+
+bool Append_block_log_event::print(FILE* file,
+ PRINT_EVENT_INFO* print_event_info)
+{
+ if (print_event_info->short_form)
+ return 0;
+
+ Write_on_release_cache cache(&print_event_info->head_cache, file);
+
+ if (print_header(&cache, print_event_info, FALSE) ||
+ my_b_printf(&cache, "\n#%s: file_id: %d block_len: %d\n",
+ get_type_str(), file_id, block_len))
+ goto err;
+
+ return cache.flush_data();
+err:
+ return 1;
+}
+
+
+/*
+ Delete_file_log_event::print()
+*/
+
+bool Delete_file_log_event::print(FILE* file,
+ PRINT_EVENT_INFO* print_event_info)
+{
+ if (print_event_info->short_form)
+ return 0;
+
+ Write_on_release_cache cache(&print_event_info->head_cache, file);
+
+ if (print_header(&cache, print_event_info, FALSE) ||
+ my_b_printf(&cache, "\n#Delete_file: file_id=%u\n", file_id))
+ return 1;
+
+ return cache.flush_data();
+}
+
+/*
+ Execute_load_log_event::print()
+*/
+
+bool Execute_load_log_event::print(FILE* file,
+ PRINT_EVENT_INFO* print_event_info)
+{
+ if (print_event_info->short_form)
+ return 0;
+
+ Write_on_release_cache cache(&print_event_info->head_cache, file);
+
+ if (print_header(&cache, print_event_info, FALSE) ||
+ my_b_printf(&cache, "\n#Exec_load: file_id=%d\n",
+ file_id))
+ return 1;
+
+ return cache.flush_data();
+}
+
+bool Execute_load_query_log_event::print(FILE* file,
+ PRINT_EVENT_INFO* print_event_info)
+{
+ return print(file, print_event_info, 0);
+}
+
+/**
+ Prints the query as LOAD DATA LOCAL and with rewritten filename.
+*/
+bool Execute_load_query_log_event::print(FILE* file,
+ PRINT_EVENT_INFO* print_event_info,
+ const char *local_fname)
+{
+ Write_on_release_cache cache(&print_event_info->head_cache, file);
+
+ if (print_query_header(&cache, print_event_info))
+ goto err;
+
+ /**
+ reduce the size of io cache so that the write function is called
+ for every call to my_b_printf().
+ */
+ DBUG_EXECUTE_IF ("simulate_execute_event_write_error",
+ {(&cache)->write_pos= (&cache)->write_end;
+ DBUG_SET("+d,simulate_file_write_error");});
+
+ if (local_fname)
+ {
+ if (my_b_write(&cache, (uchar*) query, fn_pos_start) ||
+ my_b_write_string(&cache, " LOCAL INFILE ") ||
+ pretty_print_str(&cache, local_fname, (int)strlen(local_fname)))
+ goto err;
+
+ if (dup_handling == LOAD_DUP_REPLACE)
+ if (my_b_write_string(&cache, " REPLACE"))
+ goto err;
+
+ if (my_b_write_string(&cache, " INTO") ||
+ my_b_write(&cache, (uchar*) query + fn_pos_end, q_len-fn_pos_end) ||
+ my_b_printf(&cache, "\n%s\n", print_event_info->delimiter))
+ goto err;
+ }
+ else
+ {
+ if (my_b_write(&cache, (uchar*) query, q_len) ||
+ my_b_printf(&cache, "\n%s\n", print_event_info->delimiter))
+ goto err;
+ }
+
+ if (!print_event_info->short_form)
+ my_b_printf(&cache, "# file_id: %d \n", file_id);
+
+ return cache.flush_data();
+err:
+ return 1;
+}
+
+
+
+const char str_binlog[]= "\nBINLOG '\n";
+const char fmt_delim[]= "'%s\n";
+const char fmt_n_delim[]= "\n'%s";
+const char fmt_frag[]= "\nSET @binlog_fragment_%d ='\n";
+const char fmt_binlog2[]= "BINLOG @binlog_fragment_0, @binlog_fragment_1%s\n";
+
+/**
+ Print an event "body" cache to @c file possibly in two fragments.
+ Each fragement is optionally per @c do_wrap to produce an SQL statement.
+
+ @param file a file to print to
+ @param body the "body" IO_CACHE of event
+ @param do_wrap whether to wrap base64-encoded strings with
+ SQL cover.
+ @param delimiter delimiter string
+
+ @param is_verbose MDEV-10362 workraround parameter to pass
+ info on presence of verbose printout in cache encoded data
+
+ The function signals on any error through setting @c body->error to -1.
+*/
+bool copy_cache_to_file_wrapped(IO_CACHE *body,
+ FILE *file,
+ bool do_wrap,
+ const char *delimiter,
+ bool is_verbose)
+{
+ const my_off_t cache_size= my_b_tell(body);
+
+ if (reinit_io_cache(body, READ_CACHE, 0L, FALSE, FALSE))
+ goto err;
+
+ if (!do_wrap)
+ {
+ my_b_copy_to_file(body, file, SIZE_T_MAX);
+ }
+ else if (4 + sizeof(str_binlog) + cache_size + sizeof(fmt_delim) >
+ opt_binlog_rows_event_max_encoded_size)
+ {
+ /*
+ 2 fragments can always represent near 1GB row-based
+ base64-encoded event as two strings each of size less than
+ max(max_allowed_packet). Greater number of fragments does not
+ save from potential need to tweak (increase) @@max_allowed_packet
+ before to process the fragments. So 2 is safe and enough.
+
+ Split the big query when its packet size's estimation exceeds a
+ limit. The estimate includes the maximum packet header
+ contribution of non-compressed packet.
+ */
+ my_fprintf(file, fmt_frag, 0);
+ if (my_b_copy_to_file(body, file, (size_t) cache_size/2 + 1))
+ goto err;
+ my_fprintf(file, fmt_n_delim, delimiter);
+
+ my_fprintf(file, fmt_frag, 1);
+ if (my_b_copy_to_file(body, file, SIZE_T_MAX))
+ goto err;
+ if (!is_verbose)
+ my_fprintf(file, fmt_delim, delimiter);
+
+ my_fprintf(file, fmt_binlog2, delimiter);
+ }
+ else
+ {
+ my_fprintf(file, str_binlog);
+ if (my_b_copy_to_file(body, file, SIZE_T_MAX))
+ goto err;
+ if (!is_verbose)
+ my_fprintf(file, fmt_delim, delimiter);
+ }
+ reinit_io_cache(body, WRITE_CACHE, 0, FALSE, TRUE);
+
+ return false;
+
+err:
+ body->error = -1;
+ return true;
+}
+
+
+/**
+ Print an event "body" cache to @c file possibly in two fragments.
+ Each fragement is optionally per @c do_wrap to produce an SQL statement.
+
+ @param file a file to print to
+ @param body the "body" IO_CACHE of event
+ @param do_wrap whether to wrap base64-encoded strings with
+ SQL cover.
+ @param delimiter delimiter string
+
+ The function signals on any error through setting @c body->error to -1.
+*/
+bool copy_cache_to_string_wrapped(IO_CACHE *cache,
+ LEX_STRING *to,
+ bool do_wrap,
+ const char *delimiter,
+ bool is_verbose)
+{
+ const my_off_t cache_size= my_b_tell(cache);
+ // contribution to total size estimate of formating
+ const size_t fmt_size=
+ sizeof(str_binlog) + 2*(sizeof(fmt_frag) + 2 /* %d */) +
+ sizeof(fmt_delim) + sizeof(fmt_n_delim) +
+ sizeof(fmt_binlog2) +
+ 3*PRINT_EVENT_INFO::max_delimiter_size;
+
+ if (reinit_io_cache(cache, READ_CACHE, 0L, FALSE, FALSE))
+ goto err;
+
+ if (!(to->str= (char*) my_malloc((size_t)cache->end_of_file + fmt_size,
+ MYF(0))))
+ {
+ perror("Out of memory: can't allocate memory in "
+ "copy_cache_to_string_wrapped().");
+ goto err;
+ }
+
+ if (!do_wrap)
+ {
+ if (my_b_read(cache, (uchar*) to->str,
+ (to->length= (size_t)cache->end_of_file)))
+ goto err;
+ }
+ else if (4 + sizeof(str_binlog) + cache_size + sizeof(fmt_delim) >
+ opt_binlog_rows_event_max_encoded_size)
+ {
+ /*
+ 2 fragments can always represent near 1GB row-based
+ base64-encoded event as two strings each of size less than
+ max(max_allowed_packet). Greater number of fragments does not
+ save from potential need to tweak (increase) @@max_allowed_packet
+ before to process the fragments. So 2 is safe and enough.
+
+ Split the big query when its packet size's estimation exceeds a
+ limit. The estimate includes the maximum packet header
+ contribution of non-compressed packet.
+ */
+ char *str= to->str;
+ size_t add_to_len;
+
+ str += (to->length= sprintf(str, fmt_frag, 0));
+ if (my_b_read(cache, (uchar*) str, (uint32) (cache_size/2 + 1)))
+ goto err;
+ str += (add_to_len = (uint32) (cache_size/2 + 1));
+ to->length += add_to_len;
+ str += (add_to_len= sprintf(str, fmt_n_delim, delimiter));
+ to->length += add_to_len;
+
+ str += (add_to_len= sprintf(str, fmt_frag, 1));
+ to->length += add_to_len;
+ if (my_b_read(cache, (uchar*) str, uint32(cache->end_of_file - (cache_size/2 + 1))))
+ goto err;
+ str += (add_to_len= uint32(cache->end_of_file - (cache_size/2 + 1)));
+ to->length += add_to_len;
+ if (!is_verbose)
+ {
+ str += (add_to_len= sprintf(str , fmt_delim, delimiter));
+ to->length += add_to_len;
+ }
+ to->length += sprintf(str, fmt_binlog2, delimiter);
+ }
+ else
+ {
+ char *str= to->str;
+
+ str += (to->length= sprintf(str, str_binlog));
+ if (my_b_read(cache, (uchar*) str, (size_t)cache->end_of_file))
+ goto err;
+ str += cache->end_of_file;
+ to->length += (size_t)cache->end_of_file;
+ if (!is_verbose)
+ to->length += sprintf(str , fmt_delim, delimiter);
+ }
+
+ reinit_io_cache(cache, WRITE_CACHE, 0, FALSE, TRUE);
+
+ return false;
+
+err:
+ cache->error= -1;
+ return true;
+}
+
+/**
+ The function invokes base64 encoder to run on the current
+ event string and store the result into two caches.
+ When the event ends the current statement the caches are is copied into
+ the argument file.
+ Copying is also concerned how to wrap the event, specifically to produce
+ a valid SQL syntax.
+ When the encoded data size is within max(MAX_ALLOWED_PACKET)
+ a regular BINLOG query is composed. Otherwise it is build as fragmented
+
+ SET @binlog_fragment_0='...';
+ SET @binlog_fragment_1='...';
+ BINLOG @binlog_fragment_0, @binlog_fragment_1;
+
+ where fragments are represented by a pair of indexed user
+ "one shot" variables.
+
+ @note
+ If any changes made don't forget to duplicate them to
+ Old_rows_log_event as long as it's supported.
+
+ @param file pointer to IO_CACHE
+ @param print_event_info pointer to print_event_info specializing
+ what out of and how to print the event
+ @param name the name of a table that the event operates on
+
+ The function signals on any error of cache access through setting
+ that cache's @c error to -1.
+*/
+bool Rows_log_event::print_helper(FILE *file,
+ PRINT_EVENT_INFO *print_event_info,
+ char const *const name)
+{
+ IO_CACHE *const head= &print_event_info->head_cache;
+ IO_CACHE *const body= &print_event_info->body_cache;
+#ifdef WHEN_FLASHBACK_REVIEW_READY
+ IO_CACHE *const sql= &print_event_info->review_sql_cache;
+#endif
+ bool do_print_encoded=
+ print_event_info->base64_output_mode != BASE64_OUTPUT_NEVER &&
+ print_event_info->base64_output_mode != BASE64_OUTPUT_DECODE_ROWS &&
+ !print_event_info->short_form;
+ bool const last_stmt_event= get_flags(STMT_END_F);
+
+ if (!print_event_info->short_form)
+ {
+ char llbuff[22];
+
+ print_header(head, print_event_info, !last_stmt_event);
+ if (my_b_printf(head, "\t%s: table id %s%s\n",
+ name, ullstr(m_table_id, llbuff),
+ last_stmt_event ? " flags: STMT_END_F" : ""))
+ goto err;
+ }
+ if (!print_event_info->short_form || print_event_info->print_row_count)
+ if (print_base64(body, print_event_info, do_print_encoded))
+ goto err;
+
+ if (last_stmt_event)
+ {
+ if (!is_flashback)
+ {
+ if (copy_event_cache_to_file_and_reinit(head, file) ||
+ copy_cache_to_file_wrapped(body, file, do_print_encoded,
+ print_event_info->delimiter,
+ print_event_info->verbose))
+ goto err;
+ }
+ else
+ {
+ LEX_STRING tmp_str;
+
+ if (copy_event_cache_to_string_and_reinit(head, &tmp_str))
+ return 1;
+ output_buf.append(tmp_str.str, tmp_str.length); // Not \0 terminated);
+ my_free(tmp_str.str);
+
+ if (copy_cache_to_string_wrapped(body, &tmp_str, do_print_encoded,
+ print_event_info->delimiter,
+ print_event_info->verbose))
+ return 1;
+ output_buf.append(tmp_str.str, tmp_str.length);
+ my_free(tmp_str.str);
+#ifdef WHEN_FLASHBACK_REVIEW_READY
+ if (copy_event_cache_to_string_and_reinit(sql, &tmp_str))
+ return 1;
+ output_buf.append(tmp_str.str, tmp_str.length);
+ my_free(tmp_str.str);
+#endif
+ }
+ }
+
+ return 0;
+err:
+ return 1;
+}
+
+
+bool Annotate_rows_log_event::print(FILE *file, PRINT_EVENT_INFO *pinfo)
+{
+ char *pbeg; // beginning of the next line
+ char *pend; // end of the next line
+ uint cnt= 0; // characters counter
+
+ if (!pinfo->short_form)
+ {
+ if (print_header(&pinfo->head_cache, pinfo, TRUE) ||
+ my_b_printf(&pinfo->head_cache, "\tAnnotate_rows:\n"))
+ goto err;
+ }
+ else if (my_b_printf(&pinfo->head_cache, "# Annotate_rows:\n"))
+ goto err;
+
+ for (pbeg= m_query_txt; ; pbeg= pend)
+ {
+ // skip all \r's and \n's at the beginning of the next line
+ for (;; pbeg++)
+ {
+ if (++cnt > m_query_len)
+ return 0;
+
+ if (*pbeg != '\r' && *pbeg != '\n')
+ break;
+ }
+
+ // find end of the next line
+ for (pend= pbeg + 1;
+ ++cnt <= m_query_len && *pend != '\r' && *pend != '\n';
+ pend++)
+ ;
+
+ // print next line
+ if (my_b_write(&pinfo->head_cache, (const uchar*) "#Q> ", 4) ||
+ my_b_write(&pinfo->head_cache, (const uchar*) pbeg, pend - pbeg) ||
+ my_b_write(&pinfo->head_cache, (const uchar*) "\n", 1))
+ goto err;
+ }
+
+ return 0;
+err:
+ return 1;
+}
+
+
+/*
+ Rewrite database name for the event to name specified by new_db
+ SYNOPSIS
+ new_db Database name to change to
+ new_len Length
+ desc Event describing binlog that we're writing to.
+
+ DESCRIPTION
+ Reset db name. This function assumes that temp_buf member contains event
+ representation taken from a binary log. It resets m_dbnam and m_dblen and
+ rewrites temp_buf with new db name.
+
+ RETURN
+ 0 - Success
+ other - Error
+*/
+
+int Table_map_log_event::rewrite_db(const char* new_db, size_t new_len,
+ const Format_description_log_event* desc)
+{
+ DBUG_ENTER("Table_map_log_event::rewrite_db");
+ DBUG_ASSERT(temp_buf);
+
+ uint header_len= MY_MIN(desc->common_header_len,
+ LOG_EVENT_MINIMAL_HEADER_LEN) + TABLE_MAP_HEADER_LEN;
+ int len_diff;
+
+ if (!(len_diff= (int)(new_len - m_dblen)))
+ {
+ memcpy((void*) (temp_buf + header_len + 1), new_db, m_dblen + 1);
+ memcpy((void*) m_dbnam, new_db, m_dblen + 1);
+ DBUG_RETURN(0);
+ }
+
+ // Create new temp_buf
+ ulong event_cur_len= uint4korr(temp_buf + EVENT_LEN_OFFSET);
+ ulong event_new_len= event_cur_len + len_diff;
+ char* new_temp_buf= (char*) my_malloc(event_new_len, MYF(MY_WME));
+
+ if (!new_temp_buf)
+ {
+ sql_print_error("Table_map_log_event::rewrite_db: "
+ "failed to allocate new temp_buf (%d bytes required)",
+ event_new_len);
+ DBUG_RETURN(-1);
+ }
+
+ // Rewrite temp_buf
+ char* ptr= new_temp_buf;
+ size_t cnt= 0;
+
+ // Copy header and change event length
+ memcpy(ptr, temp_buf, header_len);
+ int4store(ptr + EVENT_LEN_OFFSET, event_new_len);
+ ptr += header_len;
+ cnt += header_len;
+
+ // Write new db name length and new name
+ DBUG_ASSERT(new_len < 0xff);
+ *ptr++ = (char)new_len;
+ memcpy(ptr, new_db, new_len + 1);
+ ptr += new_len + 1;
+ cnt += m_dblen + 2;
+
+ // Copy rest part
+ memcpy(ptr, temp_buf + cnt, event_cur_len - cnt);
+
+ // Reregister temp buf
+ free_temp_buf();
+ register_temp_buf(new_temp_buf, TRUE);
+
+ // Reset m_dbnam and m_dblen members
+ m_dblen= new_len;
+
+ // m_dbnam resides in m_memory together with m_tblnam and m_coltype
+ uchar* memory= m_memory;
+ char const* tblnam= m_tblnam;
+ uchar* coltype= m_coltype;
+
+ m_memory= (uchar*) my_multi_malloc(MYF(MY_WME),
+ &m_dbnam, (uint) m_dblen + 1,
+ &m_tblnam, (uint) m_tbllen + 1,
+ &m_coltype, (uint) m_colcnt,
+ NullS);
+
+ if (!m_memory)
+ {
+ sql_print_error("Table_map_log_event::rewrite_db: "
+ "failed to allocate new m_memory (%d + %d + %d bytes required)",
+ m_dblen + 1, m_tbllen + 1, m_colcnt);
+ DBUG_RETURN(-1);
+ }
+
+ memcpy((void*)m_dbnam, new_db, m_dblen + 1);
+ memcpy((void*)m_tblnam, tblnam, m_tbllen + 1);
+ memcpy(m_coltype, coltype, m_colcnt);
+
+ my_free(memory);
+ DBUG_RETURN(0);
+}
+
+
+bool Table_map_log_event::print(FILE *file, PRINT_EVENT_INFO *print_event_info)
+{
+ if (!print_event_info->short_form)
+ {
+ char llbuff[22];
+
+ print_header(&print_event_info->head_cache, print_event_info, TRUE);
+ if (my_b_printf(&print_event_info->head_cache,
+ "\tTable_map: %`s.%`s mapped to number %s%s\n",
+ m_dbnam, m_tblnam, ullstr(m_table_id, llbuff),
+ ((m_flags & TM_BIT_HAS_TRIGGERS_F) ?
+ " (has triggers)" : "")))
+ goto err;
+ }
+ if (!print_event_info->short_form || print_event_info->print_row_count)
+ {
+
+ if (print_event_info->print_table_metadata)
+ {
+ Optional_metadata_fields fields(m_optional_metadata,
+ m_optional_metadata_len);
+
+ print_columns(&print_event_info->head_cache, fields);
+ print_primary_key(&print_event_info->head_cache, fields);
+ }
+ bool do_print_encoded=
+ print_event_info->base64_output_mode != BASE64_OUTPUT_NEVER &&
+ print_event_info->base64_output_mode != BASE64_OUTPUT_DECODE_ROWS &&
+ !print_event_info->short_form;
+
+ if (print_base64(&print_event_info->body_cache, print_event_info,
+ do_print_encoded) ||
+ copy_event_cache_to_file_and_reinit(&print_event_info->head_cache,
+ file))
+ goto err;
+ }
+
+ return 0;
+err:
+ return 1;
+}
+
+/**
+ Interface for iterator over charset columns.
+*/
+class Table_map_log_event::Charset_iterator
+{
+ public:
+ typedef Table_map_log_event::Optional_metadata_fields::Default_charset
+ Default_charset;
+ virtual const CHARSET_INFO *next()= 0;
+ virtual ~Charset_iterator(){};
+ /**
+ Factory method to create an instance of the appropriate subclass.
+ */
+ static std::unique_ptr<Charset_iterator> create_charset_iterator(
+ const Default_charset &default_charset,
+ const std::vector<uint> &column_charset);
+};
+
+/**
+ Implementation of charset iterator for the DEFAULT_CHARSET type.
+*/
+class Table_map_log_event::Default_charset_iterator : public Charset_iterator
+{
+ public:
+ Default_charset_iterator(const Default_charset &default_charset)
+ : m_iterator(default_charset.charset_pairs.begin()),
+ m_end(default_charset.charset_pairs.end()),
+ m_column_index(0),
+ m_default_charset_info(
+ get_charset(default_charset.default_charset, 0)) {}
+
+ const CHARSET_INFO *next() override {
+ const CHARSET_INFO *ret;
+ if (m_iterator != m_end && m_iterator->first == m_column_index) {
+ ret = get_charset(m_iterator->second, 0);
+ m_iterator++;
+ } else
+ ret = m_default_charset_info;
+ m_column_index++;
+ return ret;
+ }
+ ~Default_charset_iterator(){};
+
+ private:
+ std::vector<Optional_metadata_fields::uint_pair>::const_iterator m_iterator,
+ m_end;
+ uint m_column_index;
+ const CHARSET_INFO *m_default_charset_info;
+};
+//Table_map_log_event::Default_charset_iterator::~Default_charset_iterator(){int a=8;a++; a--;};
+/**
+ Implementation of charset iterator for the COLUMNT_CHARSET type.
+*/
+class Table_map_log_event::Column_charset_iterator : public Charset_iterator
+{
+ public:
+ Column_charset_iterator(const std::vector<uint> &column_charset)
+ : m_iterator(column_charset.begin()), m_end(column_charset.end()) {}
+
+ const CHARSET_INFO *next() override {
+ const CHARSET_INFO *ret = nullptr;
+ if (m_iterator != m_end) {
+ ret = get_charset(*m_iterator, 0);
+ m_iterator++;
+ }
+ return ret;
+ }
+
+ ~Column_charset_iterator(){};
+ private:
+ std::vector<uint>::const_iterator m_iterator;
+ std::vector<uint>::const_iterator m_end;
+};
+//Table_map_log_event::Column_charset_iterator::~Column_charset_iterator(){int a=8;a++; a--;};
+
+std::unique_ptr<Table_map_log_event::Charset_iterator>
+Table_map_log_event::Charset_iterator::create_charset_iterator(
+ const Default_charset &default_charset,
+ const std::vector<uint> &column_charset)
+{
+ if (!default_charset.empty())
+ return std::unique_ptr<Charset_iterator>(
+ new Default_charset_iterator(default_charset));
+ else
+ return std::unique_ptr<Charset_iterator>(
+ new Column_charset_iterator(column_charset));
+}
+/**
+ return the string name of a type.
+
+ @param[in] type type of a column
+ @param[in|out] meta_ptr the meta_ptr of the column. If the type doesn't have
+ metadata, it will not change meta_ptr, otherwise
+ meta_ptr will be moved to the end of the column's
+ metadat.
+ @param[in] cs charset of the column if it is a character column.
+ @param[out] typestr buffer to storing the string name of the type
+ @param[in] typestr_length length of typestr
+ @param[in] geometry_type internal geometry_type
+ */
+static void get_type_name(uint type, unsigned char** meta_ptr,
+ const CHARSET_INFO *cs, char *typestr,
+ uint typestr_length, unsigned int geometry_type)
+{
+ switch (type) {
+ case MYSQL_TYPE_LONG:
+ my_snprintf(typestr, typestr_length, "%s", "INT");
+ break;
+ case MYSQL_TYPE_TINY:
+ my_snprintf(typestr, typestr_length, "TINYINT");
+ break;
+ case MYSQL_TYPE_SHORT:
+ my_snprintf(typestr, typestr_length, "SMALLINT");
+ break;
+ case MYSQL_TYPE_INT24:
+ my_snprintf(typestr, typestr_length, "MEDIUMINT");
+ break;
+ case MYSQL_TYPE_LONGLONG:
+ my_snprintf(typestr, typestr_length, "BIGINT");
+ break;
+ case MYSQL_TYPE_NEWDECIMAL:
+ my_snprintf(typestr, typestr_length, "DECIMAL(%d,%d)",
+ (*meta_ptr)[0], (*meta_ptr)[1]);
+ (*meta_ptr)+= 2;
+ break;
+ case MYSQL_TYPE_FLOAT:
+ my_snprintf(typestr, typestr_length, "FLOAT");
+ (*meta_ptr)++;
+ break;
+ case MYSQL_TYPE_DOUBLE:
+ my_snprintf(typestr, typestr_length, "DOUBLE");
+ (*meta_ptr)++;
+ break;
+ case MYSQL_TYPE_BIT:
+ my_snprintf(typestr, typestr_length, "BIT(%d)",
+ (((*meta_ptr)[0])) + (*meta_ptr)[1]*8);
+ (*meta_ptr)+= 2;
+ break;
+ case MYSQL_TYPE_TIMESTAMP2:
+ if (**meta_ptr != 0)
+ my_snprintf(typestr, typestr_length, "TIMESTAMP(%d)", **meta_ptr);
+ else
+ my_snprintf(typestr, typestr_length, "TIMESTAMP");
+ (*meta_ptr)++;
+ break;
+ case MYSQL_TYPE_DATETIME2:
+ if (**meta_ptr != 0)
+ my_snprintf(typestr, typestr_length, "DATETIME(%d)", **meta_ptr);
+ else
+ my_snprintf(typestr, typestr_length, "DATETIME");
+ (*meta_ptr)++;
+ break;
+ case MYSQL_TYPE_TIME2:
+ if (**meta_ptr != 0)
+ my_snprintf(typestr, typestr_length, "TIME(%d)", **meta_ptr);
+ else
+ my_snprintf(typestr, typestr_length, "TIME");
+ (*meta_ptr)++;
+ break;
+ case MYSQL_TYPE_NEWDATE:
+ case MYSQL_TYPE_DATE:
+ my_snprintf(typestr, typestr_length, "DATE");
+ break;
+ case MYSQL_TYPE_YEAR:
+ my_snprintf(typestr, typestr_length, "YEAR");
+ break;
+ case MYSQL_TYPE_ENUM:
+ my_snprintf(typestr, typestr_length, "ENUM");
+ (*meta_ptr)+= 2;
+ break;
+ case MYSQL_TYPE_SET:
+ my_snprintf(typestr, typestr_length, "SET");
+ (*meta_ptr)+= 2;
+ break;
+ case MYSQL_TYPE_BLOB:
+ {
+ bool is_text= (cs && cs->number != my_charset_bin.number);
+ const char *names[5][2] = {
+ {"INVALID_BLOB(%d)", "INVALID_TEXT(%d)"},
+ {"TINYBLOB", "TINYTEXT"},
+ {"BLOB", "TEXT"},
+ {"MEDIUMBLOB", "MEDIUMTEXT"},
+ {"LONGBLOB", "LONGTEXT"}
+ };
+ unsigned char size= **meta_ptr;
+
+ if (size == 0 || size > 4)
+ my_snprintf(typestr, typestr_length, names[0][is_text], size);
+ else
+ my_snprintf(typestr, typestr_length, names[**meta_ptr][is_text]);
+
+ (*meta_ptr)++;
+ }
+ break;
+ case MYSQL_TYPE_VARCHAR:
+ case MYSQL_TYPE_VAR_STRING:
+ if (cs && cs->number != my_charset_bin.number)
+ my_snprintf(typestr, typestr_length, "VARCHAR(%d)",
+ uint2korr(*meta_ptr)/cs->mbmaxlen);
+ else
+ my_snprintf(typestr, typestr_length, "VARBINARY(%d)",
+ uint2korr(*meta_ptr));
+
+ (*meta_ptr)+= 2;
+ break;
+ case MYSQL_TYPE_STRING:
+ {
+ uint byte0= (*meta_ptr)[0];
+ uint byte1= (*meta_ptr)[1];
+ uint len= (((byte0 & 0x30) ^ 0x30) << 4) | byte1;
+
+ if (cs && cs->number != my_charset_bin.number)
+ my_snprintf(typestr, typestr_length, "CHAR(%d)", len/cs->mbmaxlen);
+ else
+ my_snprintf(typestr, typestr_length, "BINARY(%d)", len);
+
+ (*meta_ptr)+= 2;
+ }
+ break;
+ case MYSQL_TYPE_GEOMETRY:
+ {
+ const char* names[8] = {
+ "GEOMETRY", "POINT", "LINESTRING", "POLYGON", "MULTIPOINT",
+ "MULTILINESTRING", "MULTIPOLYGON", "GEOMETRYCOLLECTION"
+ };
+ if (geometry_type < 8)
+ my_snprintf(typestr, typestr_length, names[geometry_type]);
+ else
+ my_snprintf(typestr, typestr_length, "INVALID_GEOMETRY_TYPE(%u)",
+ geometry_type);
+ (*meta_ptr)++;
+ }
+ break;
+ default:
+ *typestr= 0;
+ break;
+ }
+}
+
+void Table_map_log_event::print_columns(IO_CACHE *file,
+ const Optional_metadata_fields &fields)
+{
+ unsigned char* field_metadata_ptr= m_field_metadata;
+ std::vector<bool>::const_iterator signedness_it= fields.m_signedness.begin();
+
+ std::unique_ptr<Charset_iterator> charset_it =
+ Charset_iterator::create_charset_iterator(fields.m_default_charset,
+ fields.m_column_charset);
+ std::unique_ptr<Charset_iterator> enum_and_set_charset_it =
+ Charset_iterator::create_charset_iterator(
+ fields.m_enum_and_set_default_charset,
+ fields.m_enum_and_set_column_charset);
+ std::vector<std::string>::const_iterator col_names_it=
+ fields.m_column_name.begin();
+ std::vector<Optional_metadata_fields::str_vector>::const_iterator
+ set_str_values_it= fields.m_set_str_value.begin();
+ std::vector<Optional_metadata_fields::str_vector>::const_iterator
+ enum_str_values_it= fields.m_enum_str_value.begin();
+ std::vector<unsigned int>::const_iterator geometry_type_it=
+ fields.m_geometry_type.begin();
+
+ uint geometry_type= 0;
+
+ my_b_printf(file, "# Columns(");
+
+ for (unsigned long i= 0; i < m_colcnt; i++)
+ {
+ uint real_type = m_coltype[i];
+ if (real_type == MYSQL_TYPE_STRING &&
+ (*field_metadata_ptr == MYSQL_TYPE_ENUM ||
+ *field_metadata_ptr == MYSQL_TYPE_SET))
+ real_type= *field_metadata_ptr;
+
+ // Get current column's collation id if it is a character, enum,
+ // or set column
+ const CHARSET_INFO *cs = NULL;
+ if (is_character_type(real_type))
+ cs = charset_it->next();
+ else if (is_enum_or_set_type(real_type))
+ cs = enum_and_set_charset_it->next();
+
+ // Print column name
+ if (col_names_it != fields.m_column_name.end())
+ {
+ pretty_print_identifier(file, col_names_it->c_str(), col_names_it->size());
+ my_b_printf(file, " ");
+ col_names_it++;
+ }
+
+
+ // update geometry_type for geometry columns
+ if (real_type == MYSQL_TYPE_GEOMETRY)
+ {
+ geometry_type= (geometry_type_it != fields.m_geometry_type.end()) ?
+ *geometry_type_it++ : 0;
+ }
+
+ // print column type
+ const uint TYPE_NAME_LEN = 100;
+ char type_name[TYPE_NAME_LEN];
+ get_type_name(real_type, &field_metadata_ptr, cs, type_name,
+ TYPE_NAME_LEN, geometry_type);
+
+ if (type_name[0] == '\0')
+ {
+ my_b_printf(file, "INVALID_TYPE(%d)", real_type);
+ continue;
+ }
+ my_b_printf(file, "%s", type_name);
+
+ // Print UNSIGNED for numeric column
+ if (is_numeric_type(real_type) &&
+ signedness_it != fields.m_signedness.end())
+ {
+ if (*signedness_it == true)
+ my_b_printf(file, " UNSIGNED");
+ signedness_it++;
+ }
+
+ // if the column is not marked as 'null', print 'not null'
+ if (!(m_null_bits[(i / 8)] & (1 << (i % 8))))
+ my_b_printf(file, " NOT NULL");
+
+ // Print string values of SET and ENUM column
+ const Optional_metadata_fields::str_vector *str_values= NULL;
+ if (real_type == MYSQL_TYPE_ENUM &&
+ enum_str_values_it != fields.m_enum_str_value.end())
+ {
+ str_values= &(*enum_str_values_it);
+ enum_str_values_it++;
+ }
+ else if (real_type == MYSQL_TYPE_SET &&
+ set_str_values_it != fields.m_set_str_value.end())
+ {
+ str_values= &(*set_str_values_it);
+ set_str_values_it++;
+ }
+
+ if (str_values != NULL)
+ {
+ const char *separator= "(";
+ for (Optional_metadata_fields::str_vector::const_iterator it=
+ str_values->begin(); it != str_values->end(); it++)
+ {
+ my_b_printf(file, "%s", separator);
+ pretty_print_str(file, it->c_str(), it->size());
+ separator= ",";
+ }
+ my_b_printf(file, ")");
+ }
+ // Print column character set, except in text columns with binary collation
+ if (cs != NULL &&
+ (is_enum_or_set_type(real_type) || cs->number != my_charset_bin.number))
+ my_b_printf(file, " CHARSET %s COLLATE %s", cs->csname, cs->name);
+ if (i != m_colcnt - 1) my_b_printf(file, ",\n# ");
+ }
+ my_b_printf(file, ")");
+ my_b_printf(file, "\n");
+}
+
+void Table_map_log_event::print_primary_key
+ (IO_CACHE *file,const Optional_metadata_fields &fields)
+{
+ if (!fields.m_primary_key.empty())
+ {
+ my_b_printf(file, "# Primary Key(");
+
+ std::vector<Optional_metadata_fields::uint_pair>::const_iterator it=
+ fields.m_primary_key.begin();
+
+ for (; it != fields.m_primary_key.end(); it++)
+ {
+ if (it != fields.m_primary_key.begin())
+ my_b_printf(file, ", ");
+
+ // Print column name or column index
+ if (it->first >= fields.m_column_name.size())
+ my_b_printf(file, "%u", it->first);
+ else
+ my_b_printf(file, "%s", fields.m_column_name[it->first].c_str());
+
+ // Print prefix length
+ if (it->second != 0)
+ my_b_printf(file, "(%u)", it->second);
+ }
+
+ my_b_printf(file, ")\n");
+ }
+}
+
+
+bool Write_rows_log_event::print(FILE *file, PRINT_EVENT_INFO* print_event_info)
+{
+ DBUG_EXECUTE_IF("simulate_cache_read_error",
+ {DBUG_SET("+d,simulate_my_b_fill_error");});
+ return Rows_log_event::print_helper(file, print_event_info, is_flashback ? "Delete_rows" : "Write_rows");
+}
+
+bool Write_rows_compressed_log_event::print(FILE *file,
+ PRINT_EVENT_INFO* print_event_info)
+{
+ char *new_buf;
+ ulong len;
+ bool is_malloc = false;
+ if(!row_log_event_uncompress(glob_description_event,
+ checksum_alg == BINLOG_CHECKSUM_ALG_CRC32,
+ temp_buf, UINT_MAX32, NULL, 0, &is_malloc, &new_buf, &len))
+ {
+ free_temp_buf();
+ register_temp_buf(new_buf, true);
+ if (Rows_log_event::print_helper(file, print_event_info,
+ "Write_compressed_rows"))
+ goto err;
+ }
+ else
+ {
+ if (my_b_printf(&print_event_info->head_cache,
+ "ERROR: uncompress write_compressed_rows failed\n"))
+ goto err;
+ }
+
+ return 0;
+err:
+ return 1;
+}
+
+
+bool Delete_rows_log_event::print(FILE *file,
+ PRINT_EVENT_INFO* print_event_info)
+{
+ return Rows_log_event::print_helper(file, print_event_info, is_flashback ? "Write_rows" : "Delete_rows");
+}
+
+
+bool Delete_rows_compressed_log_event::print(FILE *file,
+ PRINT_EVENT_INFO* print_event_info)
+{
+ char *new_buf;
+ ulong len;
+ bool is_malloc = false;
+ if(!row_log_event_uncompress(glob_description_event,
+ checksum_alg == BINLOG_CHECKSUM_ALG_CRC32,
+ temp_buf, UINT_MAX32, NULL, 0, &is_malloc, &new_buf, &len))
+ {
+ free_temp_buf();
+ register_temp_buf(new_buf, true);
+ if (Rows_log_event::print_helper(file, print_event_info,
+ "Delete_compressed_rows"))
+ goto err;
+ }
+ else
+ {
+ if (my_b_printf(&print_event_info->head_cache,
+ "ERROR: uncompress delete_compressed_rows failed\n"))
+ goto err;
+ }
+
+ return 0;
+err:
+ return 1;
+}
+
+
+bool Update_rows_log_event::print(FILE *file,
+ PRINT_EVENT_INFO* print_event_info)
+{
+ return Rows_log_event::print_helper(file, print_event_info, "Update_rows");
+}
+
+bool
+Update_rows_compressed_log_event::print(FILE *file,
+ PRINT_EVENT_INFO *print_event_info)
+{
+ char *new_buf;
+ ulong len;
+ bool is_malloc= false;
+ if(!row_log_event_uncompress(glob_description_event,
+ checksum_alg == BINLOG_CHECKSUM_ALG_CRC32,
+ temp_buf, UINT_MAX32, NULL, 0, &is_malloc, &new_buf, &len))
+ {
+ free_temp_buf();
+ register_temp_buf(new_buf, true);
+ if (Rows_log_event::print_helper(file, print_event_info,
+ "Update_compressed_rows"))
+ goto err;
+ }
+ else
+ {
+ if (my_b_printf(&print_event_info->head_cache,
+ "ERROR: uncompress update_compressed_rows failed\n"))
+ goto err;
+ }
+
+ return 0;
+err:
+ return 1;
+}
+
+
+bool Incident_log_event::print(FILE *file,
+ PRINT_EVENT_INFO *print_event_info)
+{
+ if (print_event_info->short_form)
+ return 0;
+
+ Write_on_release_cache cache(&print_event_info->head_cache, file);
+
+ if (print_header(&cache, print_event_info, FALSE) ||
+ my_b_printf(&cache, "\n# Incident: %s\nRELOAD DATABASE; # Shall generate syntax error\n", description()))
+ return 1;
+ return cache.flush_data();
+}
+
+
+/* Print for its unrecognized ignorable event */
+bool Ignorable_log_event::print(FILE *file,
+ PRINT_EVENT_INFO *print_event_info)
+{
+ if (print_event_info->short_form)
+ return 0;
+
+ if (print_header(&print_event_info->head_cache, print_event_info, FALSE) ||
+ my_b_printf(&print_event_info->head_cache, "\tIgnorable\n") ||
+ my_b_printf(&print_event_info->head_cache,
+ "# Ignorable event type %d (%s)\n", number, description) ||
+ copy_event_cache_to_file_and_reinit(&print_event_info->head_cache,
+ file))
+ return 1;
+ return 0;
+}
+
+
+/**
+ The default values for these variables should be values that are
+ *incorrect*, i.e., values that cannot occur in an event. This way,
+ they will always be printed for the first event.
+*/
+st_print_event_info::st_print_event_info()
+{
+ myf const flags = MYF(MY_WME | MY_NABP);
+ /*
+ Currently we only use static PRINT_EVENT_INFO objects, so zeroed at
+ program's startup, but these explicit bzero() is for the day someone
+ creates dynamic instances.
+ */
+ bzero(db, sizeof(db));
+ bzero(charset, sizeof(charset));
+ bzero(time_zone_str, sizeof(time_zone_str));
+ delimiter[0]= ';';
+ delimiter[1]= 0;
+ flags2_inited= 0;
+ sql_mode_inited= 0;
+ row_events= 0;
+ sql_mode= 0;
+ auto_increment_increment= 0;
+ auto_increment_offset= 0;
+ charset_inited= 0;
+ lc_time_names_number= ~0;
+ charset_database_number= ILLEGAL_CHARSET_INFO_NUMBER;
+ thread_id= 0;
+ server_id= 0;
+ domain_id= 0;
+ thread_id_printed= false;
+ server_id_printed= false;
+ domain_id_printed= false;
+ allow_parallel= true;
+ allow_parallel_printed= false;
+ found_row_event= false;
+ print_row_count= false;
+ short_form= false;
+ skip_replication= 0;
+ printed_fd_event=FALSE;
+ file= 0;
+ base64_output_mode=BASE64_OUTPUT_UNSPEC;
+ open_cached_file(&head_cache, NULL, NULL, 0, flags);
+ open_cached_file(&body_cache, NULL, NULL, 0, flags);
+#ifdef WHEN_FLASHBACK_REVIEW_READY
+ open_cached_file(&review_sql_cache, NULL, NULL, 0, flags);
+#endif
+}
+
+
+bool copy_event_cache_to_string_and_reinit(IO_CACHE *cache, LEX_STRING *to)
+{
+ reinit_io_cache(cache, READ_CACHE, 0L, FALSE, FALSE);
+ if (cache->end_of_file > SIZE_T_MAX ||
+ !(to->str= (char*) my_malloc((to->length= (size_t)cache->end_of_file), MYF(0))))
+ {
+ perror("Out of memory: can't allocate memory in copy_event_cache_to_string_and_reinit().");
+ goto err;
+ }
+ if (my_b_read(cache, (uchar*) to->str, to->length))
+ {
+ my_free(to->str);
+ perror("Can't read data from IO_CACHE");
+ return true;
+ }
+ reinit_io_cache(cache, WRITE_CACHE, 0, FALSE, TRUE);
+ return false;
+
+err:
+ to->str= 0;
+ to->length= 0;
+ return true;
+}
+
+
+bool
+Gtid_log_event::print(FILE *file, PRINT_EVENT_INFO *print_event_info)
+{
+ Write_on_release_cache cache(&print_event_info->head_cache, file,
+ Write_on_release_cache::FLUSH_F, this);
+ char buf[21];
+ char buf2[21];
+
+ if (!print_event_info->short_form && !is_flashback)
+ {
+ print_header(&cache, print_event_info, FALSE);
+ longlong10_to_str(seq_no, buf, 10);
+ if (my_b_printf(&cache, "\tGTID %u-%u-%s", domain_id, server_id, buf))
+ goto err;
+ if (flags2 & FL_GROUP_COMMIT_ID)
+ {
+ longlong10_to_str(commit_id, buf2, 10);
+ if (my_b_printf(&cache, " cid=%s", buf2))
+ goto err;
+ }
+ if (flags2 & FL_DDL)
+ if (my_b_write_string(&cache, " ddl"))
+ goto err;
+ if (flags2 & FL_TRANSACTIONAL)
+ if (my_b_write_string(&cache, " trans"))
+ goto err;
+ if (flags2 & FL_WAITED)
+ if (my_b_write_string(&cache, " waited"))
+ goto err;
+ if (my_b_printf(&cache, "\n"))
+ goto err;
+
+ if (!print_event_info->allow_parallel_printed ||
+ print_event_info->allow_parallel != !!(flags2 & FL_ALLOW_PARALLEL))
+ {
+ if (my_b_printf(&cache,
+ "/*!100101 SET @@session.skip_parallel_replication=%u*/%s\n",
+ !(flags2 & FL_ALLOW_PARALLEL),
+ print_event_info->delimiter))
+ goto err;
+ print_event_info->allow_parallel= !!(flags2 & FL_ALLOW_PARALLEL);
+ print_event_info->allow_parallel_printed= true;
+ }
+
+ if (!print_event_info->domain_id_printed ||
+ print_event_info->domain_id != domain_id)
+ {
+ if (my_b_printf(&cache,
+ "/*!100001 SET @@session.gtid_domain_id=%u*/%s\n",
+ domain_id, print_event_info->delimiter))
+ goto err;
+ print_event_info->domain_id= domain_id;
+ print_event_info->domain_id_printed= true;
+ }
+
+ if (!print_event_info->server_id_printed ||
+ print_event_info->server_id != server_id)
+ {
+ if (my_b_printf(&cache, "/*!100001 SET @@session.server_id=%u*/%s\n",
+ server_id, print_event_info->delimiter))
+ goto err;
+ print_event_info->server_id= server_id;
+ print_event_info->server_id_printed= true;
+ }
+
+ if (!is_flashback)
+ if (my_b_printf(&cache, "/*!100001 SET @@session.gtid_seq_no=%s*/%s\n",
+ buf, print_event_info->delimiter))
+ goto err;
+ }
+ if (!(flags2 & FL_STANDALONE))
+ if (my_b_printf(&cache, is_flashback ? "COMMIT\n%s\n" : "BEGIN\n%s\n", print_event_info->delimiter))
+ goto err;
+
+ return cache.flush_data();
+err:
+ return 1;
+}
diff --git a/sql/log_event_server.cc b/sql/log_event_server.cc
new file mode 100644
index 00000000000..302610e2273
--- /dev/null
+++ b/sql/log_event_server.cc
@@ -0,0 +1,8311 @@
+/*
+ Copyright (c) 2000, 2019, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2019, 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
+
+
+#include "mariadb.h"
+#include "sql_priv.h"
+
+#ifdef MYSQL_CLIENT
+#error MYSQL_CLIENT must not be defined here
+#endif
+
+#ifndef MYSQL_SERVER
+#error MYSQL_SERVER must be defined here
+#endif
+
+#include "unireg.h"
+#include "log_event.h"
+#include "sql_base.h" // close_thread_tables
+#include "sql_cache.h" // QUERY_CACHE_FLAGS_SIZE
+#include "sql_locale.h" // MY_LOCALE, my_locale_by_number, my_locale_en_US
+#include "key.h" // key_copy
+#include "lock.h" // mysql_unlock_tables
+#include "sql_parse.h" // mysql_test_parse_for_slave
+#include "tztime.h" // struct Time_zone
+#include "sql_load.h" // mysql_load
+#include "sql_db.h" // load_db_opt_by_name
+#include "slave.h"
+#include "rpl_rli.h"
+#include "rpl_mi.h"
+#include "rpl_filter.h"
+#include "rpl_record.h"
+#include "transaction.h"
+#include <my_dir.h>
+#include "sql_show.h" // append_identifier
+#include "debug_sync.h" // debug_sync
+#include <mysql/psi/mysql_statement.h>
+#include <strfunc.h>
+#include "compat56.h"
+#include "wsrep_mysqld.h"
+#include "sql_insert.h"
+
+#include <my_bitmap.h>
+#include "rpl_utility.h"
+#include "rpl_constants.h"
+#include "sql_digest.h"
+#include "zlib.h"
+
+
+#define log_cs &my_charset_latin1
+
+
+#if defined(HAVE_REPLICATION)
+static int rows_event_stmt_cleanup(rpl_group_info *rgi, THD* thd);
+
+static const char *HA_ERR(int i)
+{
+ /*
+ This function should only be called in case of an error
+ was detected
+ */
+ DBUG_ASSERT(i != 0);
+ switch (i) {
+ case HA_ERR_KEY_NOT_FOUND: return "HA_ERR_KEY_NOT_FOUND";
+ case HA_ERR_FOUND_DUPP_KEY: return "HA_ERR_FOUND_DUPP_KEY";
+ case HA_ERR_RECORD_CHANGED: return "HA_ERR_RECORD_CHANGED";
+ case HA_ERR_WRONG_INDEX: return "HA_ERR_WRONG_INDEX";
+ case HA_ERR_CRASHED: return "HA_ERR_CRASHED";
+ case HA_ERR_WRONG_IN_RECORD: return "HA_ERR_WRONG_IN_RECORD";
+ case HA_ERR_OUT_OF_MEM: return "HA_ERR_OUT_OF_MEM";
+ case HA_ERR_NOT_A_TABLE: return "HA_ERR_NOT_A_TABLE";
+ case HA_ERR_WRONG_COMMAND: return "HA_ERR_WRONG_COMMAND";
+ case HA_ERR_OLD_FILE: return "HA_ERR_OLD_FILE";
+ case HA_ERR_NO_ACTIVE_RECORD: return "HA_ERR_NO_ACTIVE_RECORD";
+ case HA_ERR_RECORD_DELETED: return "HA_ERR_RECORD_DELETED";
+ case HA_ERR_RECORD_FILE_FULL: return "HA_ERR_RECORD_FILE_FULL";
+ case HA_ERR_INDEX_FILE_FULL: return "HA_ERR_INDEX_FILE_FULL";
+ case HA_ERR_END_OF_FILE: return "HA_ERR_END_OF_FILE";
+ case HA_ERR_UNSUPPORTED: return "HA_ERR_UNSUPPORTED";
+ case HA_ERR_TO_BIG_ROW: return "HA_ERR_TO_BIG_ROW";
+ case HA_WRONG_CREATE_OPTION: return "HA_WRONG_CREATE_OPTION";
+ case HA_ERR_FOUND_DUPP_UNIQUE: return "HA_ERR_FOUND_DUPP_UNIQUE";
+ case HA_ERR_UNKNOWN_CHARSET: return "HA_ERR_UNKNOWN_CHARSET";
+ case HA_ERR_WRONG_MRG_TABLE_DEF: return "HA_ERR_WRONG_MRG_TABLE_DEF";
+ case HA_ERR_CRASHED_ON_REPAIR: return "HA_ERR_CRASHED_ON_REPAIR";
+ case HA_ERR_CRASHED_ON_USAGE: return "HA_ERR_CRASHED_ON_USAGE";
+ case HA_ERR_LOCK_WAIT_TIMEOUT: return "HA_ERR_LOCK_WAIT_TIMEOUT";
+ case HA_ERR_LOCK_TABLE_FULL: return "HA_ERR_LOCK_TABLE_FULL";
+ case HA_ERR_READ_ONLY_TRANSACTION: return "HA_ERR_READ_ONLY_TRANSACTION";
+ case HA_ERR_LOCK_DEADLOCK: return "HA_ERR_LOCK_DEADLOCK";
+ case HA_ERR_CANNOT_ADD_FOREIGN: return "HA_ERR_CANNOT_ADD_FOREIGN";
+ case HA_ERR_NO_REFERENCED_ROW: return "HA_ERR_NO_REFERENCED_ROW";
+ case HA_ERR_ROW_IS_REFERENCED: return "HA_ERR_ROW_IS_REFERENCED";
+ case HA_ERR_NO_SAVEPOINT: return "HA_ERR_NO_SAVEPOINT";
+ case HA_ERR_NON_UNIQUE_BLOCK_SIZE: return "HA_ERR_NON_UNIQUE_BLOCK_SIZE";
+ case HA_ERR_NO_SUCH_TABLE: return "HA_ERR_NO_SUCH_TABLE";
+ case HA_ERR_TABLE_EXIST: return "HA_ERR_TABLE_EXIST";
+ case HA_ERR_NO_CONNECTION: return "HA_ERR_NO_CONNECTION";
+ case HA_ERR_NULL_IN_SPATIAL: return "HA_ERR_NULL_IN_SPATIAL";
+ case HA_ERR_TABLE_DEF_CHANGED: return "HA_ERR_TABLE_DEF_CHANGED";
+ case HA_ERR_NO_PARTITION_FOUND: return "HA_ERR_NO_PARTITION_FOUND";
+ case HA_ERR_RBR_LOGGING_FAILED: return "HA_ERR_RBR_LOGGING_FAILED";
+ case HA_ERR_DROP_INDEX_FK: return "HA_ERR_DROP_INDEX_FK";
+ case HA_ERR_FOREIGN_DUPLICATE_KEY: return "HA_ERR_FOREIGN_DUPLICATE_KEY";
+ case HA_ERR_TABLE_NEEDS_UPGRADE: return "HA_ERR_TABLE_NEEDS_UPGRADE";
+ case HA_ERR_TABLE_READONLY: return "HA_ERR_TABLE_READONLY";
+ case HA_ERR_AUTOINC_READ_FAILED: return "HA_ERR_AUTOINC_READ_FAILED";
+ case HA_ERR_AUTOINC_ERANGE: return "HA_ERR_AUTOINC_ERANGE";
+ case HA_ERR_GENERIC: return "HA_ERR_GENERIC";
+ case HA_ERR_RECORD_IS_THE_SAME: return "HA_ERR_RECORD_IS_THE_SAME";
+ case HA_ERR_LOGGING_IMPOSSIBLE: return "HA_ERR_LOGGING_IMPOSSIBLE";
+ case HA_ERR_CORRUPT_EVENT: return "HA_ERR_CORRUPT_EVENT";
+ case HA_ERR_ROWS_EVENT_APPLY : return "HA_ERR_ROWS_EVENT_APPLY";
+ }
+ return "No Error!";
+}
+
+
+/*
+ Return true if an error caught during event execution is a temporary error
+ that will cause automatic retry of the event group during parallel
+ replication, false otherwise.
+
+ In parallel replication, conflicting transactions can occasionally cause
+ deadlocks; such errors are handled automatically by rolling back re-trying
+ the transactions, so should not pollute the error log.
+*/
+static bool
+is_parallel_retry_error(rpl_group_info *rgi, int err)
+{
+ if (!rgi->is_parallel_exec)
+ return false;
+ if (rgi->speculation == rpl_group_info::SPECULATE_OPTIMISTIC)
+ return true;
+ if (rgi->killed_for_retry &&
+ (err == ER_QUERY_INTERRUPTED || err == ER_CONNECTION_KILLED))
+ return true;
+ return has_temporary_error(rgi->thd);
+}
+
+
+/**
+ Error reporting facility for Rows_log_event::do_apply_event
+
+ @param level error, warning or info
+ @param ha_error HA_ERR_ code
+ @param rli pointer to the active Relay_log_info instance
+ @param thd pointer to the slave thread's thd
+ @param table pointer to the event's table object
+ @param type the type of the event
+ @param log_name the master binlog file name
+ @param pos the master binlog file pos (the next after the event)
+
+*/
+static void inline slave_rows_error_report(enum loglevel level, int ha_error,
+ rpl_group_info *rgi, THD *thd,
+ TABLE *table, const char * type,
+ const char *log_name, my_off_t pos)
+{
+ const char *handler_error= (ha_error ? HA_ERR(ha_error) : NULL);
+ char buff[MAX_SLAVE_ERRMSG], *slider;
+ const char *buff_end= buff + sizeof(buff);
+ size_t len;
+ Diagnostics_area::Sql_condition_iterator it=
+ thd->get_stmt_da()->sql_conditions();
+ Relay_log_info const *rli= rgi->rli;
+ const Sql_condition *err;
+ buff[0]= 0;
+ int errcode= thd->is_error() ? thd->get_stmt_da()->sql_errno() : 0;
+
+ /*
+ In parallel replication, deadlocks or other temporary errors can happen
+ occasionally in normal operation, they will be handled correctly and
+ automatically by re-trying the transactions. So do not pollute the error
+ log with messages about them.
+ */
+ if (is_parallel_retry_error(rgi, errcode))
+ return;
+
+ for (err= it++, slider= buff; err && slider < buff_end - 1;
+ slider += len, err= it++)
+ {
+ len= my_snprintf(slider, buff_end - slider,
+ " %s, Error_code: %d;", err->get_message_text(),
+ err->get_sql_errno());
+ }
+
+ if (ha_error != 0)
+ rli->report(level, errcode, rgi->gtid_info(),
+ "Could not execute %s event on table %s.%s;"
+ "%s handler error %s; "
+ "the event's master log %s, end_log_pos %llu",
+ type, table->s->db.str, table->s->table_name.str,
+ buff, handler_error == NULL ? "<unknown>" : handler_error,
+ log_name, pos);
+ else
+ rli->report(level, errcode, rgi->gtid_info(),
+ "Could not execute %s event on table %s.%s;"
+ "%s the event's master log %s, end_log_pos %llu",
+ type, table->s->db.str, table->s->table_name.str,
+ buff, log_name, pos);
+}
+#endif
+
+#if defined(HAVE_REPLICATION)
+static void set_thd_db(THD *thd, Rpl_filter *rpl_filter,
+ const char *db, uint32 db_len)
+{
+ char lcase_db_buf[NAME_LEN +1];
+ LEX_CSTRING new_db;
+ new_db.length= db_len;
+ if (lower_case_table_names == 1)
+ {
+ strmov(lcase_db_buf, db);
+ my_casedn_str(system_charset_info, lcase_db_buf);
+ new_db.str= lcase_db_buf;
+ }
+ else
+ new_db.str= db;
+ /* TODO WARNING this makes rewrite_db respect lower_case_table_names values
+ * for more info look MDEV-17446 */
+ new_db.str= rpl_filter->get_rewrite_db(new_db.str, &new_db.length);
+ thd->set_db(&new_db);
+}
+#endif
+
+
+#if defined(HAVE_REPLICATION)
+
+inline int idempotent_error_code(int err_code)
+{
+ int ret= 0;
+
+ switch (err_code)
+ {
+ case 0:
+ ret= 1;
+ break;
+ /*
+ The following list of "idempotent" errors
+ means that an error from the list might happen
+ because of idempotent (more than once)
+ applying of a binlog file.
+ Notice, that binlog has a ddl operation its
+ second applying may cause
+
+ case HA_ERR_TABLE_DEF_CHANGED:
+ case HA_ERR_CANNOT_ADD_FOREIGN:
+
+ which are not included into to the list.
+
+ Note that HA_ERR_RECORD_DELETED is not in the list since
+ do_exec_row() should not return that error code.
+ */
+ case HA_ERR_RECORD_CHANGED:
+ case HA_ERR_KEY_NOT_FOUND:
+ case HA_ERR_END_OF_FILE:
+ case HA_ERR_FOUND_DUPP_KEY:
+ case HA_ERR_FOUND_DUPP_UNIQUE:
+ case HA_ERR_FOREIGN_DUPLICATE_KEY:
+ case HA_ERR_NO_REFERENCED_ROW:
+ case HA_ERR_ROW_IS_REFERENCED:
+ ret= 1;
+ break;
+ default:
+ ret= 0;
+ break;
+ }
+ return (ret);
+}
+
+/**
+ Ignore error code specified on command line.
+*/
+
+inline int ignored_error_code(int err_code)
+{
+ if (use_slave_mask && bitmap_is_set(&slave_error_mask, err_code))
+ {
+ statistic_increment(slave_skipped_errors, LOCK_status);
+ return 1;
+ }
+ return err_code == ER_SLAVE_IGNORED_TABLE;
+}
+
+/*
+ This function converts an engine's error to a server error.
+
+ If the thread does not have an error already reported, it tries to
+ define it by calling the engine's method print_error. However, if a
+ mapping is not found, it uses the ER_UNKNOWN_ERROR and prints out a
+ warning message.
+*/
+int convert_handler_error(int error, THD* thd, TABLE *table)
+{
+ uint actual_error= (thd->is_error() ? thd->get_stmt_da()->sql_errno() :
+ 0);
+
+ if (actual_error == 0)
+ {
+ table->file->print_error(error, MYF(0));
+ actual_error= (thd->is_error() ? thd->get_stmt_da()->sql_errno() :
+ ER_UNKNOWN_ERROR);
+ if (actual_error == ER_UNKNOWN_ERROR)
+ if (global_system_variables.log_warnings)
+ sql_print_warning("Unknown error detected %d in handler", error);
+ }
+
+ return (actual_error);
+}
+
+inline bool concurrency_error_code(int error)
+{
+ switch (error)
+ {
+ case ER_LOCK_WAIT_TIMEOUT:
+ case ER_LOCK_DEADLOCK:
+ case ER_XA_RBDEADLOCK:
+ return TRUE;
+ default:
+ return (FALSE);
+ }
+}
+
+inline bool unexpected_error_code(int unexpected_error)
+{
+ switch (unexpected_error)
+ {
+ case ER_NET_READ_ERROR:
+ case ER_NET_ERROR_ON_WRITE:
+ case ER_QUERY_INTERRUPTED:
+ case ER_STATEMENT_TIMEOUT:
+ case ER_CONNECTION_KILLED:
+ case ER_SERVER_SHUTDOWN:
+ case ER_NEW_ABORTING_CONNECTION:
+ return(TRUE);
+ default:
+ return(FALSE);
+ }
+}
+
+/*
+ pretty_print_str()
+*/
+
+static void
+pretty_print_str(String *packet, const char *str, int len)
+{
+ const char *end= str + len;
+ packet->append(STRING_WITH_LEN("'"));
+ while (str < end)
+ {
+ char c;
+ switch ((c=*str++)) {
+ case '\n': packet->append(STRING_WITH_LEN("\\n")); break;
+ case '\r': packet->append(STRING_WITH_LEN("\\r")); break;
+ case '\\': packet->append(STRING_WITH_LEN("\\\\")); break;
+ case '\b': packet->append(STRING_WITH_LEN("\\b")); break;
+ case '\t': packet->append(STRING_WITH_LEN("\\t")); break;
+ case '\'': packet->append(STRING_WITH_LEN("\\'")); break;
+ case 0 : packet->append(STRING_WITH_LEN("\\0")); break;
+ default:
+ packet->append(&c, 1);
+ break;
+ }
+ }
+ packet->append(STRING_WITH_LEN("'"));
+}
+#endif /* HAVE_REPLICATION */
+
+
+#if defined(HAVE_REPLICATION)
+
+/**
+ Create a prefix for the temporary files that is to be used for
+ load data file name for this master
+
+ @param name Store prefix of name here
+ @param connection_name Connection name
+
+ @return pointer to end of name
+
+ @description
+ We assume that FN_REFLEN is big enough to hold
+ MAX_CONNECTION_NAME * MAX_FILENAME_MBWIDTH characters + 2 numbers +
+ a short extension.
+
+ The resulting file name has the following parts, each separated with a '-'
+ - PREFIX_SQL_LOAD (SQL_LOAD-)
+ - If a connection name is given (multi-master setup):
+ - Add an extra '-' to mark that this is a multi-master file
+ - connection name in lower case, converted to safe file characters.
+ (see create_logfile_name_with_suffix()).
+ - server_id
+ - A last '-' (after server_id).
+*/
+
+static char *load_data_tmp_prefix(char *name,
+ LEX_CSTRING *connection_name)
+{
+ name= strmov(name, PREFIX_SQL_LOAD);
+ if (connection_name->length)
+ {
+ uint buf_length;
+ uint errors;
+ /* Add marker that this is a multi-master-file */
+ *name++='-';
+ /* Convert connection_name to a safe filename */
+ buf_length= strconvert(system_charset_info, connection_name->str, FN_REFLEN,
+ &my_charset_filename, name, FN_REFLEN, &errors);
+ name+= buf_length;
+ *name++= '-';
+ }
+ name= int10_to_str(global_system_variables.server_id, name, 10);
+ *name++ = '-';
+ *name= '\0'; // For testing prefixes
+ return name;
+}
+
+
+/**
+ Creates a temporary name for LOAD DATA INFILE
+
+ @param buf Store new filename here
+ @param file_id File_id (part of file name)
+ @param event_server_id Event_id (part of file name)
+ @param ext Extension for file name
+
+ @return
+ Pointer to start of extension
+*/
+
+static char *slave_load_file_stem(char *buf, uint file_id,
+ int event_server_id, const char *ext,
+ LEX_CSTRING *connection_name)
+{
+ char *res;
+ res= buf+ unpack_dirname(buf, slave_load_tmpdir);
+ to_unix_path(buf);
+ buf= load_data_tmp_prefix(res, connection_name);
+ buf= int10_to_str(event_server_id, buf, 10);
+ *buf++ = '-';
+ res= int10_to_str(file_id, buf, 10);
+ strmov(res, ext); // Add extension last
+ return res; // Pointer to extension
+}
+#endif
+
+
+#if defined(HAVE_REPLICATION)
+
+/**
+ Delete all temporary files used for SQL_LOAD.
+*/
+
+static void cleanup_load_tmpdir(LEX_CSTRING *connection_name)
+{
+ MY_DIR *dirp;
+ FILEINFO *file;
+ uint i;
+ char dir[FN_REFLEN], fname[FN_REFLEN];
+ char prefbuf[31 + MAX_CONNECTION_NAME* MAX_FILENAME_MBWIDTH + 1];
+ DBUG_ENTER("cleanup_load_tmpdir");
+
+ unpack_dirname(dir, slave_load_tmpdir);
+ if (!(dirp=my_dir(dir, MYF(MY_WME))))
+ return;
+
+ /*
+ When we are deleting temporary files, we should only remove
+ the files associated with the server id of our server.
+ We don't use event_server_id here because since we've disabled
+ direct binlogging of Create_file/Append_file/Exec_load events
+ we cannot meet Start_log event in the middle of events from one
+ LOAD DATA.
+ */
+
+ load_data_tmp_prefix(prefbuf, connection_name);
+ DBUG_PRINT("enter", ("dir: '%s' prefix: '%s'", dir, prefbuf));
+
+ for (i=0 ; i < (uint)dirp->number_of_files; i++)
+ {
+ file=dirp->dir_entry+i;
+ if (is_prefix(file->name, prefbuf))
+ {
+ fn_format(fname,file->name,slave_load_tmpdir,"",MY_UNPACK_FILENAME);
+ mysql_file_delete(key_file_misc, fname, MYF(0));
+ }
+ }
+
+ my_dirend(dirp);
+ DBUG_VOID_RETURN;
+}
+#endif
+
+
+/**
+ Append a version of the 'str' string suitable for use in a query to
+ the 'to' string. To generate a correct escaping, the character set
+ information in 'csinfo' is used.
+*/
+
+int append_query_string(CHARSET_INFO *csinfo, String *to,
+ const char *str, size_t len, bool no_backslash)
+{
+ char *beg, *ptr;
+ uint32 const orig_len= to->length();
+ if (to->reserve(orig_len + len * 2 + 4))
+ return 1;
+
+ beg= (char*) to->ptr() + to->length();
+ ptr= beg;
+ if (csinfo->escape_with_backslash_is_dangerous)
+ ptr= str_to_hex(ptr, str, len);
+ else
+ {
+ *ptr++= '\'';
+ if (!no_backslash)
+ {
+ ptr+= escape_string_for_mysql(csinfo, ptr, 0, str, len);
+ }
+ else
+ {
+ const char *frm_str= str;
+
+ for (; frm_str < (str + len); frm_str++)
+ {
+ /* Using '' way to represent "'" */
+ if (*frm_str == '\'')
+ *ptr++= *frm_str;
+
+ *ptr++= *frm_str;
+ }
+ }
+
+ *ptr++= '\'';
+ }
+ to->length((uint32)(orig_len + ptr - beg));
+ return 0;
+}
+
+
+/**************************************************************************
+ Log_event methods (= the parent class of all events)
+**************************************************************************/
+
+Log_event::Log_event(THD* thd_arg, uint16 flags_arg, bool using_trans)
+ :log_pos(0), temp_buf(0), exec_time(0), thd(thd_arg),
+ checksum_alg(BINLOG_CHECKSUM_ALG_UNDEF)
+{
+ server_id= thd->variables.server_id;
+ when= thd->start_time;
+ when_sec_part=thd->start_time_sec_part;
+
+ if (using_trans)
+ cache_type= Log_event::EVENT_TRANSACTIONAL_CACHE;
+ else
+ cache_type= Log_event::EVENT_STMT_CACHE;
+ flags= flags_arg |
+ (thd->variables.option_bits & OPTION_SKIP_REPLICATION ?
+ LOG_EVENT_SKIP_REPLICATION_F : 0);
+}
+
+/**
+ This minimal constructor is for when you are not even sure that there
+ is a valid THD. For example in the server when we are shutting down or
+ flushing logs after receiving a SIGHUP (then we must write a Rotate to
+ the binlog but we have no THD, so we need this minimal constructor).
+*/
+
+Log_event::Log_event()
+ :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;
+ /*
+ We can't call my_time() here as this would cause a call before
+ my_init() is called
+ */
+ when= 0;
+ when_sec_part=0;
+ log_pos= 0;
+}
+
+
+
+#ifdef HAVE_REPLICATION
+
+int Log_event::do_update_pos(rpl_group_info *rgi)
+{
+ Relay_log_info *rli= rgi->rli;
+ DBUG_ENTER("Log_event::do_update_pos");
+
+ DBUG_ASSERT(!rli->belongs_to_client());
+ /*
+ rli is null when (as far as I (Guilhem) know) the caller is
+ Load_log_event::do_apply_event *and* that one is called from
+ Execute_load_log_event::do_apply_event. In this case, we don't
+ do anything here ; Execute_load_log_event::do_apply_event will
+ call Log_event::do_apply_event again later with the proper rli.
+ Strictly speaking, if we were sure that rli is null only in the
+ case discussed above, 'if (rli)' is useless here. But as we are
+ not 100% sure, keep it for now.
+
+ Matz: I don't think we will need this check with this refactoring.
+ */
+ if (rli)
+ {
+ /*
+ In parallel execution, delay position update for the events that are
+ not part of event groups (format description, rotate, and such) until
+ the actual event execution reaches that point.
+ */
+ if (!rgi->is_parallel_exec || is_group_event(get_type_code()))
+ rli->stmt_done(log_pos, thd, rgi);
+ }
+ DBUG_RETURN(0); // Cannot fail currently
+}
+
+
+Log_event::enum_skip_reason
+Log_event::do_shall_skip(rpl_group_info *rgi)
+{
+ Relay_log_info *rli= rgi->rli;
+ DBUG_PRINT("info", ("ev->server_id: %lu, ::server_id: %lu,"
+ " rli->replicate_same_server_id: %d,"
+ " rli->slave_skip_counter: %llu",
+ (ulong) server_id,
+ (ulong) global_system_variables.server_id,
+ rli->replicate_same_server_id,
+ rli->slave_skip_counter));
+ if ((server_id == global_system_variables.server_id &&
+ !rli->replicate_same_server_id) ||
+ (rli->slave_skip_counter == 1 && rli->is_in_group()) ||
+ (flags & LOG_EVENT_SKIP_REPLICATION_F &&
+ opt_replicate_events_marked_for_skip != RPL_SKIP_REPLICATE))
+ return EVENT_SKIP_IGNORE;
+ if (rli->slave_skip_counter > 0)
+ return EVENT_SKIP_COUNT;
+ return EVENT_SKIP_NOT;
+}
+
+
+/*
+ Log_event::pack_info()
+*/
+
+void Log_event::pack_info(Protocol *protocol)
+{
+ protocol->store("", &my_charset_bin);
+}
+
+
+/**
+ Only called by SHOW BINLOG EVENTS
+*/
+int Log_event::net_send(Protocol *protocol, const char* log_name, my_off_t pos)
+{
+ const char *p= strrchr(log_name, FN_LIBCHAR);
+ const char *event_type;
+ if (p)
+ log_name = p + 1;
+
+ protocol->prepare_for_resend();
+ protocol->store(log_name, &my_charset_bin);
+ protocol->store((ulonglong) pos);
+ event_type = get_type_str();
+ protocol->store(event_type, strlen(event_type), &my_charset_bin);
+ protocol->store((uint32) server_id);
+ protocol->store((ulonglong) log_pos);
+ pack_info(protocol);
+ return protocol->write();
+}
+#endif /* HAVE_REPLICATION */
+
+
+/**
+ 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.
+*/
+
+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_INT64_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_INT64_NUM_DECIMAL_DIGITS,
+ MYSQL_TYPE_LONGLONG),
+ mem_root);
+ field_list->push_back(new (mem_root) Item_empty_string(thd, "Info", 20),
+ mem_root);
+}
+
+/**
+ A decider of whether to trigger checksum computation or not.
+ To be invoked in Log_event::write() stack.
+ The decision is positive
+
+ S,M) if it's been marked for checksumming with @c checksum_alg
+
+ M) otherwise, if @@global.binlog_checksum is not NONE and the event is
+ directly written to the binlog file.
+ The to-be-cached event decides at @c write_cache() time.
+
+ Otherwise the decision is negative.
+
+ @note A side effect of the method is altering Log_event::checksum_alg
+ it the latter was undefined at calling.
+
+ @return true (positive) or false (negative)
+*/
+my_bool Log_event::need_checksum()
+{
+ DBUG_ENTER("Log_event::need_checksum");
+ my_bool ret;
+ /*
+ few callers of Log_event::write
+ (incl FD::write, FD constructing code on the slave side, Rotate relay log
+ and Stop event)
+ provides their checksum alg preference through Log_event::checksum_alg.
+ */
+ 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
+ call (and therefore data_written is not zero) then `ret' must be
+ TRUE. It may not be null because FD is always checksummed.
+ */
+
+ DBUG_ASSERT(get_type_code() != FORMAT_DESCRIPTION_EVENT || ret ||
+ data_written == 0);
+
+ DBUG_ASSERT(!ret ||
+ ((checksum_alg == binlog_checksum_options ||
+ /*
+ Stop event closes the relay-log and its checksum alg
+ preference is set by the caller can be different
+ from the server's binlog_checksum_options.
+ */
+ get_type_code() == STOP_EVENT ||
+ /*
+ Rotate:s can be checksummed regardless of the server's
+ binlog_checksum_options. That applies to both
+ 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 ||
+ get_type_code() == START_ENCRYPTION_EVENT ||
+ /* FD is always checksummed */
+ get_type_code() == FORMAT_DESCRIPTION_EVENT) &&
+ checksum_alg != BINLOG_CHECKSUM_ALG_OFF));
+
+ DBUG_ASSERT(checksum_alg != BINLOG_CHECKSUM_ALG_UNDEF);
+
+ DBUG_ASSERT(((get_type_code() != ROTATE_EVENT &&
+ get_type_code() != STOP_EVENT) ||
+ get_type_code() != FORMAT_DESCRIPTION_EVENT) ||
+ cache_type == Log_event::EVENT_NO_CACHE);
+
+ DBUG_RETURN(ret);
+}
+
+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)
+{
+ uchar *dst= 0;
+ size_t dstsize= 0;
+
+ if (ctx)
+ {
+ dstsize= encryption_encrypted_length((uint)len, ENCRYPTION_KEY_SYSTEM_DATA,
+ crypto->key_version);
+ if (!(dst= (uchar*)my_safe_alloca(dstsize)))
+ return 1;
+
+ uint dstlen;
+ if (len == 0)
+ dstlen= 0;
+ else if (encryption_ctx_update(ctx, pos, (uint)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;
+}
+
+int Log_event_writer::write_header(uchar *pos, size_t len)
+{
+ DBUG_ENTER("Log_event_writer::write_header");
+ /*
+ 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 (checksum_len)
+ {
+ uchar save=pos[FLAGS_OFFSET];
+ pos[FLAGS_OFFSET]&= ~LOG_EVENT_BINLOG_IN_USE_F;
+ crc= my_checksum(0, pos, len);
+ pos[FLAGS_OFFSET]= save;
+ }
+
+ if (ctx)
+ {
+ uchar iv[BINLOG_IV_LENGTH];
+ crypto->set_iv(iv, (uint32)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_header()
+*/
+
+bool Log_event::write_header(size_t event_data_length)
+{
+ uchar header[LOG_EVENT_HEADER_LEN];
+ ulong now;
+ DBUG_ENTER("Log_event::write_header");
+ DBUG_PRINT("enter", ("filepos: %lld length: %zu type: %d",
+ (longlong) writer->pos(), event_data_length,
+ (int) get_type_code()));
+
+ writer->checksum_len= need_checksum() ? BINLOG_CHECKSUM_LEN : 0;
+
+ /* 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
+ change the position
+ */
+
+ if (is_artificial_event())
+ {
+ /*
+ Artificial events are automatically generated and do not exist
+ in master's binary log, so log_pos should be set to 0.
+ */
+ log_pos= 0;
+ }
+ else if (!log_pos)
+ {
+ /*
+ Calculate the position of where the next event will start
+ (end of this event, that is).
+ */
+
+ log_pos= writer->pos() + data_written;
+
+ DBUG_EXECUTE_IF("dbug_master_binlog_over_2GB", log_pos += (1ULL <<31););
+ }
+
+ now= get_time(); // Query start time
+
+ /*
+ Header will be of size LOG_EVENT_HEADER_LEN for all events, except for
+ FORMAT_DESCRIPTION_EVENT and ROTATE_EVENT, where it will be
+ LOG_EVENT_MINIMAL_HEADER_LEN (remember these 2 have a frozen header,
+ because we read them before knowing the format).
+ */
+
+ int4store(header, now); // timestamp
+ header[EVENT_TYPE_OFFSET]= get_type_code();
+ int4store(header+ SERVER_ID_OFFSET, server_id);
+ int4store(header+ EVENT_LEN_OFFSET, data_written);
+ int4store(header+ LOG_POS_OFFSET, log_pos);
+ int2store(header + FLAGS_OFFSET, flags);
+
+ bool ret= writer->write_header(header, sizeof(header));
+ DBUG_RETURN(ret);
+}
+
+
+
+#if defined(HAVE_REPLICATION)
+inline Log_event::enum_skip_reason
+Log_event::continue_group(rpl_group_info *rgi)
+{
+ if (rgi->rli->slave_skip_counter == 1)
+ return Log_event::EVENT_SKIP_IGNORE;
+ return Log_event::do_shall_skip(rgi);
+}
+#endif
+
+/**************************************************************************
+ Query_log_event methods
+**************************************************************************/
+
+#if defined(HAVE_REPLICATION)
+
+/**
+ This (which is used only for SHOW BINLOG EVENTS) could be updated to
+ print SET @@session_var=. But this is not urgent, as SHOW BINLOG EVENTS is
+ only an information, it does not produce suitable queries to replay (for
+ example it does not print LOAD DATA INFILE).
+ @todo
+ show the catalog ??
+*/
+
+void Query_log_event::pack_info(Protocol *protocol)
+{
+ // TODO: show the catalog ??
+ char buf_mem[1024];
+ String buf(buf_mem, sizeof(buf_mem), system_charset_info);
+ buf.real_alloc(9 + db_len + q_len);
+ if (!(flags & LOG_EVENT_SUPPRESS_USE_F)
+ && db && db_len)
+ {
+ buf.append(STRING_WITH_LEN("use "));
+ append_identifier(protocol->thd, &buf, db, db_len);
+ buf.append(STRING_WITH_LEN("; "));
+ }
+ if (query && q_len)
+ buf.append(query, q_len);
+ protocol->store(&buf);
+}
+#endif
+
+
+/**
+ Utility function for the next method (Query_log_event::write()) .
+*/
+static void store_str_with_code_and_len(uchar **dst, const char *src,
+ uint len, uint code)
+{
+ /*
+ only 1 byte to store the length of catalog, so it should not
+ surpass 255
+ */
+ DBUG_ASSERT(len <= 255);
+ DBUG_ASSERT(src);
+ *((*dst)++)= (uchar) code;
+ *((*dst)++)= (uchar) len;
+ bmove(*dst, src, len);
+ (*dst)+= len;
+}
+
+
+/**
+ Query_log_event::write().
+
+ @note
+ In this event we have to modify the header to have the correct
+ EVENT_LEN_OFFSET as we don't yet know how many status variables we
+ will print!
+*/
+
+bool Query_log_event::write()
+{
+ uchar buf[QUERY_HEADER_LEN + MAX_SIZE_LOG_EVENT_STATUS];
+ uchar *start, *start_of_status;
+ ulong event_length;
+
+ if (!query)
+ return 1; // Something wrong with event
+
+ /*
+ We want to store the thread id:
+ (- as an information for the user when he reads the binlog)
+ - if the query uses temporary table: for the slave SQL thread to know to
+ which master connection the temp table belongs.
+ Now imagine we (write()) are called by the slave SQL thread (we are
+ logging a query executed by this thread; the slave runs with
+ --log-slave-updates). Then this query will be logged with
+ thread_id=the_thread_id_of_the_SQL_thread. Imagine that 2 temp tables of
+ the same name were created simultaneously on the master (in the master
+ binlog you have
+ CREATE TEMPORARY TABLE t; (thread 1)
+ CREATE TEMPORARY TABLE t; (thread 2)
+ ...)
+ then in the slave's binlog there will be
+ CREATE TEMPORARY TABLE t; (thread_id_of_the_slave_SQL_thread)
+ CREATE TEMPORARY TABLE t; (thread_id_of_the_slave_SQL_thread)
+ which is bad (same thread id!).
+
+ To avoid this, we log the thread's thread id EXCEPT for the SQL
+ slave thread for which we log the original (master's) thread id.
+ Now this moves the bug: what happens if the thread id on the
+ master was 10 and when the slave replicates the query, a
+ connection number 10 is opened by a normal client on the slave,
+ and updates a temp table of the same name? We get a problem
+ again. To avoid this, in the handling of temp tables (sql_base.cc)
+ we use thread_id AND server_id. TODO when this is merged into
+ 4.1: in 4.1, slave_proxy_id has been renamed to pseudo_thread_id
+ and is a session variable: that's to make mysqlbinlog work with
+ temp tables. We probably need to introduce
+
+ SET PSEUDO_SERVER_ID
+ for mysqlbinlog in 4.1. mysqlbinlog would print:
+ SET PSEUDO_SERVER_ID=
+ SET PSEUDO_THREAD_ID=
+ for each query using temp tables.
+ */
+ int4store(buf + Q_THREAD_ID_OFFSET, slave_proxy_id);
+ int4store(buf + Q_EXEC_TIME_OFFSET, exec_time);
+ buf[Q_DB_LEN_OFFSET] = (char) db_len;
+ int2store(buf + Q_ERR_CODE_OFFSET, error_code);
+
+ /*
+ You MUST always write status vars in increasing order of code. This
+ guarantees that a slightly older slave will be able to parse those he
+ knows.
+ */
+ start_of_status= start= buf+QUERY_HEADER_LEN;
+ if (flags2_inited)
+ {
+ *start++= Q_FLAGS2_CODE;
+ int4store(start, flags2);
+ start+= 4;
+ }
+ if (sql_mode_inited)
+ {
+ *start++= Q_SQL_MODE_CODE;
+ int8store(start, (ulonglong)sql_mode);
+ start+= 8;
+ }
+ if (catalog_len) // i.e. this var is inited (false for 4.0 events)
+ {
+ 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
+ a waste of one byte so we don't do it in x>=4 masters. We change code to
+ Q_CATALOG_NZ_CODE, because re-using the old code would make x<4 slaves
+ of this x>=4 master segfault (expecting a zero when there is
+ none). Remaining compatibility problems are: the older slave will not
+ find the catalog; but it is will not crash, and it's not an issue
+ that it does not find the catalog as catalogs were not used in these
+ older MySQL versions (we store it in binlog and read it from relay log
+ but do nothing useful with it). What is an issue is that the older slave
+ will stop processing the Q_* blocks (and jumps to the db/query) as soon
+ as it sees unknown Q_CATALOG_NZ_CODE; so it will not be able to read
+ Q_AUTO_INCREMENT*, Q_CHARSET and so replication will fail silently in
+ various ways. Documented that you should not mix alpha/beta versions if
+ they are not exactly the same version, with example of 5.0.3->5.0.2 and
+ 5.0.4->5.0.3. If replication is from older to new, the new will
+ recognize Q_CATALOG_CODE and have no problem.
+ */
+ }
+ if (auto_increment_increment != 1 || auto_increment_offset != 1)
+ {
+ *start++= Q_AUTO_INCREMENT;
+ int2store(start, auto_increment_increment);
+ int2store(start+2, auto_increment_offset);
+ start+= 4;
+ }
+ if (charset_inited)
+ {
+ *start++= Q_CHARSET_CODE;
+ memcpy(start, charset, 6);
+ start+= 6;
+ }
+ if (time_zone_len)
+ {
+ /* 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);
+ store_str_with_code_and_len(&start,
+ time_zone_str, time_zone_len, Q_TIME_ZONE_CODE);
+ }
+ if (lc_time_names_number)
+ {
+ DBUG_ASSERT(lc_time_names_number <= 0xFFFF);
+ *start++= Q_LC_TIME_NAMES_CODE;
+ int2store(start, lc_time_names_number);
+ start+= 2;
+ }
+ if (charset_database_number)
+ {
+ DBUG_ASSERT(charset_database_number <= 0xFFFF);
+ *start++= Q_CHARSET_DATABASE_CODE;
+ int2store(start, charset_database_number);
+ start+= 2;
+ }
+ if (table_map_for_update)
+ {
+ *start++= Q_TABLE_MAP_FOR_UPDATE_CODE;
+ int8store(start, table_map_for_update);
+ start+= 8;
+ }
+ if (master_data_written != 0)
+ {
+ /*
+ Q_MASTER_DATA_WRITTEN_CODE only exists in relay logs where the master
+ has binlog_version<4 and the slave has binlog_version=4. See comment
+ for master_data_written in log_event.h for details.
+ */
+ *start++= Q_MASTER_DATA_WRITTEN_CODE;
+ int4store(start, master_data_written);
+ start+= 4;
+ }
+
+ if (thd && thd->need_binlog_invoker())
+ {
+ LEX_CSTRING user;
+ LEX_CSTRING host;
+ memset(&user, 0, sizeof(user));
+ memset(&host, 0, sizeof(host));
+
+ if (thd->slave_thread && thd->has_invoker())
+ {
+ /* user will be null, if master is older than this patch */
+ user= thd->get_invoker_user();
+ host= thd->get_invoker_host();
+ }
+ else
+ {
+ Security_context *ctx= thd->security_ctx;
+
+ if (thd->need_binlog_invoker() == THD::INVOKER_USER)
+ {
+ user.str= ctx->priv_user;
+ host.str= ctx->priv_host;
+ host.length= strlen(host.str);
+ }
+ else
+ {
+ user.str= ctx->priv_role;
+ host= empty_clex_str;
+ }
+ user.length= strlen(user.str);
+ }
+
+ if (user.length > 0)
+ {
+ *start++= Q_INVOKER;
+
+ /*
+ Store user length and user. The max length of use is 16, so 1 byte is
+ enough to store the user's length.
+ */
+ *start++= (uchar)user.length;
+ memcpy(start, user.str, user.length);
+ start+= user.length;
+
+ /*
+ Store host length and host. The max length of host is 60, so 1 byte is
+ enough to store the host's length.
+ */
+ *start++= (uchar)host.length;
+ memcpy(start, host.str, host.length);
+ start+= host.length;
+ }
+ }
+
+ if (thd && thd->query_start_sec_part_used)
+ {
+ *start++= Q_HRNOW;
+ get_time();
+ int3store(start, when_sec_part);
+ start+= 3;
+ }
+ /*
+ NOTE: When adding new status vars, please don't forget to update
+ the MAX_SIZE_LOG_EVENT_STATUS in log_event.h and update the function
+ code_name() in this file.
+
+ Here there could be code like
+ if (command-line-option-which-says-"log_this_variable" && inited)
+ {
+ *start++= Q_THIS_VARIABLE_CODE;
+ int4store(start, this_variable);
+ start+= 4;
+ }
+ */
+
+ /* Store length of status variables */
+ status_vars_len= (uint) (start-start_of_status);
+ DBUG_ASSERT(status_vars_len <= MAX_SIZE_LOG_EVENT_STATUS);
+ int2store(buf + Q_STATUS_VARS_LEN_OFFSET, status_vars_len);
+
+ /*
+ Calculate length of whole event
+ The "1" below is the \0 in the db's length
+ */
+ event_length= (uint) (start-buf) + get_post_header_size_for_derived() + db_len + 1 + q_len;
+
+ 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();
+}
+
+bool Query_compressed_log_event::write()
+{
+ const char *query_tmp = query;
+ uint32 q_len_tmp = q_len;
+ uint32 alloc_size;
+ bool ret = true;
+ q_len = alloc_size = binlog_get_compress_len(q_len);
+ query = (char *)my_safe_alloca(alloc_size);
+ if(query && !binlog_buf_compress(query_tmp, (char *)query, q_len_tmp, &q_len))
+ {
+ ret = Query_log_event::write();
+ }
+ my_safe_afree((void *)query, alloc_size);
+ query = query_tmp;
+ q_len = q_len_tmp;
+ return ret;
+}
+
+/**
+ The simplest constructor that could possibly work. This is used for
+ creating static objects that have a special meaning and are invisible
+ to the log.
+*/
+Query_log_event::Query_log_event()
+ :Log_event(), data_buf(0)
+{
+ memset(&user, 0, sizeof(user));
+ memset(&host, 0, sizeof(host));
+}
+
+
+/*
+ SYNOPSIS
+ Query_log_event::Query_log_event()
+ thd_arg - thread handle
+ 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
+
+ DESCRIPTION
+ Creates an event for binlogging
+ The value for `errcode' should be supplied by caller.
+*/
+Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg, size_t query_length, bool using_trans,
+ bool direct, bool suppress_use, int errcode)
+
+ :Log_event(thd_arg,
+ (thd_arg->thread_specific_used ? LOG_EVENT_THREAD_SPECIFIC_F :
+ 0) |
+ (suppress_use ? LOG_EVENT_SUPPRESS_USE_F : 0),
+ using_trans),
+ data_buf(0), query(query_arg), catalog(thd_arg->catalog),
+ db(thd_arg->db.str), q_len((uint32) query_length),
+ thread_id(thd_arg->thread_id),
+ /* save the original thread id; we already know the server id */
+ slave_proxy_id((ulong)thd_arg->variables.pseudo_thread_id),
+ flags2_inited(1), sql_mode_inited(1), charset_inited(1),
+ sql_mode(thd_arg->variables.sql_mode),
+ auto_increment_increment(thd_arg->variables.auto_increment_increment),
+ auto_increment_offset(thd_arg->variables.auto_increment_offset),
+ lc_time_names_number(thd_arg->variables.lc_time_names->number),
+ charset_database_number(0),
+ table_map_for_update((ulonglong)thd_arg->table_map_for_update),
+ master_data_written(0)
+{
+ time_t end_time;
+
+#ifdef WITH_WSREP
+ /*
+ If Query_log_event will contain non trans keyword (not BEGIN, COMMIT,
+ SAVEPOINT or ROLLBACK) we disable PA for this transaction.
+ */
+ if (WSREP_ON && !is_trans_keyword())
+ thd->wsrep_PA_safe= false;
+#endif /* WITH_WSREP */
+
+ memset(&user, 0, sizeof(user));
+ memset(&host, 0, sizeof(host));
+
+ error_code= errcode;
+
+ end_time= my_time(0);
+ exec_time = (ulong) (end_time - thd_arg->start_time);
+ /**
+ @todo this means that if we have no catalog, then it is replicated
+ as an existing catalog of length zero. is that safe? /sven
+ */
+ catalog_len = (catalog) ? (uint32) strlen(catalog) : 0;
+ /* status_vars_len is set just before writing the event */
+ db_len = (db) ? (uint32) strlen(db) : 0;
+ if (thd_arg->variables.collation_database != thd_arg->db_charset)
+ charset_database_number= thd_arg->variables.collation_database->number;
+
+ /*
+ We only replicate over the bits of flags2 that we need: the rest
+ are masked out by "& OPTIONS_WRITTEN_TO_BINLOG".
+
+ We also force AUTOCOMMIT=1. Rationale (cf. BUG#29288): After
+ fixing BUG#26395, we always write BEGIN and COMMIT around all
+ transactions (even single statements in autocommit mode). This is
+ so that replication from non-transactional to transactional table
+ and error recovery from XA to non-XA table should work as
+ expected. The BEGIN/COMMIT are added in log.cc. However, there is
+ one exception: MyISAM bypasses log.cc and writes directly to the
+ binlog. So if autocommit is off, master has MyISAM, and slave has
+ a transactional engine, then the slave will just see one long
+ never-ending transaction. The only way to bypass explicit
+ BEGIN/COMMIT in the binlog is by using a non-transactional table.
+ So setting AUTOCOMMIT=1 will make this work as expected.
+
+ Note: explicitly replicate AUTOCOMMIT=1 from master. We do not
+ assume AUTOCOMMIT=1 on slave; the slave still reads the state of
+ the autocommit flag as written by the master to the binlog. This
+ behavior may change after WL#4162 has been implemented.
+ */
+ flags2= (uint32) (thd_arg->variables.option_bits &
+ (OPTIONS_WRITTEN_TO_BIN_LOG & ~OPTION_NOT_AUTOCOMMIT));
+ DBUG_ASSERT(thd_arg->variables.character_set_client->number < 256*256);
+ DBUG_ASSERT(thd_arg->variables.collation_connection->number < 256*256);
+ DBUG_ASSERT(thd_arg->variables.collation_server->number < 256*256);
+ DBUG_ASSERT(thd_arg->variables.character_set_client->mbminlen == 1);
+ int2store(charset, thd_arg->variables.character_set_client->number);
+ int2store(charset+2, thd_arg->variables.collation_connection->number);
+ int2store(charset+4, thd_arg->variables.collation_server->number);
+ if (thd_arg->time_zone_used)
+ {
+ /*
+ Note that our event becomes dependent on the Time_zone object
+ representing the time zone. Fortunately such objects are never deleted
+ or changed during mysqld's lifetime.
+ */
+ time_zone_len= thd_arg->variables.time_zone->get_name()->length();
+ time_zone_str= thd_arg->variables.time_zone->get_name()->ptr();
+ }
+ else
+ time_zone_len= 0;
+
+ LEX *lex= thd->lex;
+ /*
+ Defines that the statement will be written directly to the binary log
+ without being wrapped by a BEGIN...COMMIT. Otherwise, the statement
+ will be written to either the trx-cache or stmt-cache.
+
+ Note that a cache will not be used if the parameter direct is TRUE.
+ */
+ bool use_cache= FALSE;
+ /*
+ TRUE defines that the trx-cache must be used and by consequence the
+ use_cache is TRUE.
+
+ Note that a cache will not be used if the parameter direct is TRUE.
+ */
+ bool trx_cache= FALSE;
+ cache_type= Log_event::EVENT_INVALID_CACHE;
+
+ if (!direct)
+ {
+ switch (lex->sql_command)
+ {
+ case SQLCOM_DROP_TABLE:
+ case SQLCOM_DROP_SEQUENCE:
+ use_cache= (lex->tmp_table() && thd->in_multi_stmt_transaction_mode());
+ break;
+
+ case SQLCOM_CREATE_TABLE:
+ case SQLCOM_CREATE_SEQUENCE:
+ /*
+ 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->first_select_lex()->item_list.elements &&
+ 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;
+ break;
+ case SQLCOM_SET_OPTION:
+ if (lex->autocommit)
+ use_cache= trx_cache= FALSE;
+ else
+ use_cache= TRUE;
+ break;
+ case SQLCOM_RELEASE_SAVEPOINT:
+ case SQLCOM_ROLLBACK_TO_SAVEPOINT:
+ case SQLCOM_SAVEPOINT:
+ use_cache= trx_cache= TRUE;
+ break;
+ default:
+ use_cache= sqlcom_can_generate_row_events(thd);
+ break;
+ }
+ }
+
+ if (!use_cache || direct)
+ {
+ cache_type= Log_event::EVENT_NO_CACHE;
+ }
+ else if (using_trans || trx_cache || stmt_has_updated_trans_table(thd) ||
+ thd->lex->is_mixed_stmt_unsafe(thd->in_multi_stmt_transaction_mode(),
+ thd->variables.binlog_direct_non_trans_update,
+ trans_has_updated_trans_table(thd),
+ thd->tx_isolation))
+ cache_type= Log_event::EVENT_TRANSACTIONAL_CACHE;
+ 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 cache_tye: %d",
+ (ulong) flags2, sql_mode, cache_type));
+}
+
+Query_compressed_log_event::Query_compressed_log_event(THD* thd_arg, const char* query_arg,
+ ulong query_length, bool using_trans,
+ bool direct, bool suppress_use, int errcode)
+ :Query_log_event(thd_arg, query_arg, query_length, using_trans, direct,
+ suppress_use, errcode),
+ query_buf(0)
+{
+
+}
+
+
+#if defined(HAVE_REPLICATION)
+
+int Query_log_event::do_apply_event(rpl_group_info *rgi)
+{
+ return do_apply_event(rgi, query, q_len);
+}
+
+/**
+ Compare if two errors should be regarded as equal.
+ This is to handle the case when you can get slightly different errors
+ on master and slave for the same thing.
+ @param
+ expected_error Error we got on master
+ actual_error Error we got on slave
+
+ @return
+ 1 Errors are equal
+ 0 Errors are different
+*/
+
+bool test_if_equal_repl_errors(int expected_error, int actual_error)
+{
+ if (expected_error == actual_error)
+ return 1;
+ switch (expected_error) {
+ case ER_DUP_ENTRY:
+ case ER_DUP_ENTRY_WITH_KEY_NAME:
+ case ER_DUP_KEY:
+ case ER_AUTOINC_READ_FAILED:
+ return (actual_error == ER_DUP_ENTRY ||
+ actual_error == ER_DUP_ENTRY_WITH_KEY_NAME ||
+ actual_error == ER_DUP_KEY ||
+ actual_error == ER_AUTOINC_READ_FAILED ||
+ actual_error == HA_ERR_AUTOINC_ERANGE);
+ case ER_UNKNOWN_TABLE:
+ return actual_error == ER_IT_IS_A_VIEW;
+ default:
+ break;
+ }
+ return 0;
+}
+
+
+/**
+ @todo
+ Compare the values of "affected rows" around here. Something
+ like:
+ @code
+ if ((uint32) affected_in_event != (uint32) affected_on_slave)
+ {
+ sql_print_error("Slave: did not get the expected number of affected \
+ rows running query from master - expected %d, got %d (this numbers \
+ should have matched modulo 4294967296).", 0, ...);
+ thd->query_error = 1;
+ }
+ @endcode
+ We may also want an option to tell the slave to ignore "affected"
+ mismatch. This mismatch could be implemented with a new ER_ code, and
+ to ignore it you would use --slave-skip-errors...
+*/
+int Query_log_event::do_apply_event(rpl_group_info *rgi,
+ const char *query_arg, uint32 q_len_arg)
+{
+ int expected_error,actual_error= 0;
+ Schema_specification_st db_options;
+ uint64 sub_id= 0;
+ void *hton= NULL;
+ rpl_gtid gtid;
+ Relay_log_info const *rli= rgi->rli;
+ Rpl_filter *rpl_filter= rli->mi->rpl_filter;
+ bool current_stmt_is_commit;
+ DBUG_ENTER("Query_log_event::do_apply_event");
+
+ /*
+ Colleagues: please never free(thd->catalog) in MySQL. This would
+ lead to bugs as here thd->catalog is a part of an alloced block,
+ not an entire alloced block (see
+ Query_log_event::do_apply_event()). Same for thd->db. Thank
+ you.
+ */
+ thd->catalog= catalog_len ? (char *) catalog : (char *)"";
+
+ size_t valid_len= Well_formed_prefix(system_charset_info,
+ db, db_len, NAME_LEN).length();
+
+ if (valid_len != db_len)
+ {
+ rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
+ ER_THD(thd, ER_SLAVE_FATAL_ERROR),
+ "Invalid database name in Query event.");
+ thd->is_slave_error= true;
+ goto end;
+ }
+
+ set_thd_db(thd, rpl_filter, db, db_len);
+
+ /*
+ Setting the character set and collation of the current database thd->db.
+ */
+ load_db_opt_by_name(thd, thd->db.str, &db_options);
+ if (db_options.default_table_charset)
+ thd->db_charset= db_options.default_table_charset;
+ thd->variables.auto_increment_increment= auto_increment_increment;
+ thd->variables.auto_increment_offset= auto_increment_offset;
+
+ DBUG_PRINT("info", ("log_pos: %lu", (ulong) log_pos));
+
+ thd->clear_error(1);
+ current_stmt_is_commit= is_commit();
+
+ DBUG_ASSERT(!current_stmt_is_commit || !rgi->tables_to_lock);
+ rgi->slave_close_thread_tables(thd);
+
+ /*
+ Note: We do not need to execute reset_one_shot_variables() if this
+ db_ok() test fails.
+ Reason: The db stored in binlog events is the same for SET and for
+ its companion query. If the SET is ignored because of
+ db_ok(), the companion query will also be ignored, and if
+ the companion query is ignored in the db_ok() test of
+ ::do_apply_event(), then the companion SET also have so
+ we don't need to reset_one_shot_variables().
+ */
+ if (is_trans_keyword() || rpl_filter->db_ok(thd->db.str))
+ {
+ thd->set_time(when, when_sec_part);
+ thd->set_query_and_id((char*)query_arg, q_len_arg,
+ thd->charset(), next_query_id());
+ thd->variables.pseudo_thread_id= thread_id; // for temp tables
+ DBUG_PRINT("query",("%s", thd->query()));
+
+ if (unlikely(!(expected_error= error_code)) ||
+ ignored_error_code(expected_error) ||
+ !unexpected_error_code(expected_error))
+ {
+ thd->slave_expected_error= expected_error;
+ if (flags2_inited)
+ /*
+ all bits of thd->variables.option_bits which are 1 in OPTIONS_WRITTEN_TO_BIN_LOG
+ must take their value from flags2.
+ */
+ thd->variables.option_bits= flags2|(thd->variables.option_bits & ~OPTIONS_WRITTEN_TO_BIN_LOG);
+ /*
+ else, we are in a 3.23/4.0 binlog; we previously received a
+ Rotate_log_event which reset thd->variables.option_bits and sql_mode etc, so
+ nothing to do.
+ */
+ /*
+ We do not replicate MODE_NO_DIR_IN_CREATE. That is, if the master is a
+ slave which runs with SQL_MODE=MODE_NO_DIR_IN_CREATE, this should not
+ force us to ignore the dir too. Imagine you are a ring of machines, and
+ one has a disk problem so that you temporarily need
+ MODE_NO_DIR_IN_CREATE on this machine; you don't want it to propagate
+ elsewhere (you don't want all slaves to start ignoring the dirs).
+ */
+ if (sql_mode_inited)
+ thd->variables.sql_mode=
+ (sql_mode_t) ((thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE) |
+ (sql_mode & ~(sql_mode_t) MODE_NO_DIR_IN_CREATE));
+ if (charset_inited)
+ {
+ rpl_sql_thread_info *sql_info= thd->system_thread_info.rpl_sql_info;
+ if (sql_info->cached_charset_compare(charset))
+ {
+ /* Verify that we support the charsets found in the event. */
+ if (!(thd->variables.character_set_client=
+ get_charset(uint2korr(charset), MYF(MY_WME))) ||
+ !(thd->variables.collation_connection=
+ get_charset(uint2korr(charset+2), MYF(MY_WME))) ||
+ !(thd->variables.collation_server=
+ get_charset(uint2korr(charset+4), MYF(MY_WME))))
+ {
+ /*
+ We updated the thd->variables with nonsensical values (0). Let's
+ set them to something safe (i.e. which avoids crash), and we'll
+ stop with EE_UNKNOWN_CHARSET in compare_errors (unless set to
+ ignore this error).
+ */
+ set_slave_thread_default_charset(thd, rgi);
+ goto compare_errors;
+ }
+ thd->update_charset(); // for the charset change to take effect
+ /*
+ Reset thd->query_string.cs to the newly set value.
+ Note, there is a small flaw here. For a very short time frame
+ if the new charset is different from the old charset and
+ if another thread executes "SHOW PROCESSLIST" after
+ the above thd->set_query_and_id() and before this thd->set_query(),
+ and if the current query has some non-ASCII characters,
+ the another thread may see some '?' marks in the PROCESSLIST
+ result. This should be acceptable now. This is a reminder
+ to fix this if any refactoring happens here sometime.
+ */
+ thd->set_query((char*) query_arg, q_len_arg, thd->charset());
+ }
+ }
+ if (time_zone_len)
+ {
+ String tmp(time_zone_str, time_zone_len, &my_charset_bin);
+ if (!(thd->variables.time_zone= my_tz_find(thd, &tmp)))
+ {
+ my_error(ER_UNKNOWN_TIME_ZONE, MYF(0), tmp.c_ptr());
+ thd->variables.time_zone= global_system_variables.time_zone;
+ goto compare_errors;
+ }
+ }
+ if (lc_time_names_number)
+ {
+ if (!(thd->variables.lc_time_names=
+ my_locale_by_number(lc_time_names_number)))
+ {
+ my_printf_error(ER_UNKNOWN_ERROR,
+ "Unknown locale: '%d'", MYF(0), lc_time_names_number);
+ thd->variables.lc_time_names= &my_locale_en_US;
+ goto compare_errors;
+ }
+ }
+ else
+ thd->variables.lc_time_names= &my_locale_en_US;
+ if (charset_database_number)
+ {
+ CHARSET_INFO *cs;
+ if (!(cs= get_charset(charset_database_number, MYF(0))))
+ {
+ char buf[20];
+ int10_to_str((int) charset_database_number, buf, -10);
+ my_error(ER_UNKNOWN_COLLATION, MYF(0), buf);
+ goto compare_errors;
+ }
+ thd->variables.collation_database= cs;
+ }
+ else
+ thd->variables.collation_database= thd->db_charset;
+
+ {
+ const CHARSET_INFO *cs= thd->charset();
+ /*
+ We cannot ask for parsing a statement using a character set
+ without state_maps (parser internal data).
+ */
+ if (!cs->state_map)
+ {
+ rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
+ ER_THD(thd, ER_SLAVE_FATAL_ERROR),
+ "character_set cannot be parsed");
+ thd->is_slave_error= true;
+ goto end;
+ }
+ }
+
+ /*
+ Record any GTID in the same transaction, so slave state is
+ transactionally consistent.
+ */
+ if (current_stmt_is_commit)
+ {
+ thd->variables.option_bits&= ~OPTION_GTID_BEGIN;
+ if (rgi->gtid_pending)
+ {
+ sub_id= rgi->gtid_sub_id;
+ rgi->gtid_pending= false;
+
+ gtid= rgi->current_gtid;
+ if (unlikely(rpl_global_gtid_slave_state->record_gtid(thd, &gtid,
+ sub_id,
+ true, false,
+ &hton)))
+ {
+ int errcode= thd->get_stmt_da()->sql_errno();
+ if (!is_parallel_retry_error(rgi, errcode))
+ rli->report(ERROR_LEVEL, ER_CANNOT_UPDATE_GTID_STATE,
+ rgi->gtid_info(),
+ "Error during COMMIT: failed to update GTID state in "
+ "%s.%s: %d: %s",
+ "mysql", rpl_gtid_slave_state_table_name.str,
+ errcode,
+ thd->get_stmt_da()->message());
+ sub_id= 0;
+ thd->is_slave_error= 1;
+ goto end;
+ }
+ }
+ }
+
+ thd->table_map_for_update= (table_map)table_map_for_update;
+ thd->set_invoker(&user, &host);
+ /*
+ Flag if we need to rollback the statement transaction on
+ slave if it by chance succeeds.
+ If we expected a non-zero error code and get nothing and,
+ it is a concurrency issue or ignorable issue, effects
+ of the statement should be rolled back.
+ */
+ if (unlikely(expected_error) &&
+ (ignored_error_code(expected_error) ||
+ concurrency_error_code(expected_error)))
+ {
+ thd->variables.option_bits|= OPTION_MASTER_SQL_ERROR;
+ thd->variables.option_bits&= ~OPTION_GTID_BEGIN;
+ }
+ /* Execute the query (note that we bypass dispatch_command()) */
+ Parser_state parser_state;
+ if (!parser_state.init(thd, thd->query(), thd->query_length()))
+ {
+ DBUG_ASSERT(thd->m_digest == NULL);
+ thd->m_digest= & thd->m_digest_state;
+ DBUG_ASSERT(thd->m_statement_psi == NULL);
+ thd->m_statement_psi= MYSQL_START_STATEMENT(&thd->m_statement_state,
+ stmt_info_rpl.m_key,
+ thd->db.str, thd->db.length,
+ thd->charset());
+ THD_STAGE_INFO(thd, stage_init);
+ MYSQL_SET_STATEMENT_TEXT(thd->m_statement_psi, thd->query(), thd->query_length());
+ if (thd->m_digest != NULL)
+ thd->m_digest->reset(thd->m_token_array, max_digest_length);
+
+ if (thd->slave_thread)
+ {
+ /*
+ To be compatible with previous releases, the slave thread uses the global
+ log_slow_disabled_statements value, wich can be changed dynamically, so we
+ have to set the sql_log_slow respectively.
+ */
+ thd->variables.sql_log_slow= !MY_TEST(global_system_variables.log_slow_disabled_statements & LOG_SLOW_DISABLE_SLAVE);
+ }
+
+ mysql_parse(thd, thd->query(), thd->query_length(), &parser_state,
+ FALSE, FALSE);
+ /* Finalize server status flags after executing a statement. */
+ thd->update_server_status();
+ log_slow_statement(thd);
+ thd->lex->restore_set_statement_var();
+ }
+
+ thd->variables.option_bits&= ~OPTION_MASTER_SQL_ERROR;
+ }
+ else
+ {
+ /*
+ The query got a really bad error on the master (thread killed etc),
+ which could be inconsistent. Parse it to test the table names: if the
+ replicate-*-do|ignore-table rules say "this query must be ignored" then
+ we exit gracefully; otherwise we warn about the bad error and tell DBA
+ to check/fix it.
+ */
+ if (mysql_test_parse_for_slave(thd, thd->query(), thd->query_length()))
+ thd->clear_error(1);
+ else
+ {
+ rli->report(ERROR_LEVEL, expected_error, rgi->gtid_info(),
+ "\
+Query partially completed on the master (error on master: %d) \
+and was aborted. There is a chance that your master is inconsistent at this \
+point. If you are sure that your master is ok, run this query manually on the \
+slave and then restart the slave with SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; \
+START SLAVE; . Query: '%s'", expected_error, thd->query());
+ thd->is_slave_error= 1;
+ }
+ goto end;
+ }
+
+ /* If the query was not ignored, it is printed to the general log */
+ if (likely(!thd->is_error()) ||
+ thd->get_stmt_da()->sql_errno() != ER_SLAVE_IGNORED_TABLE)
+ general_log_write(thd, COM_QUERY, thd->query(), thd->query_length());
+ else
+ {
+ /*
+ Bug#54201: If we skip an INSERT query that uses auto_increment, then we
+ should reset any @@INSERT_ID set by an Intvar_log_event associated with
+ the query; otherwise the @@INSERT_ID will linger until the next INSERT
+ that uses auto_increment and may affect extra triggers on the slave etc.
+
+ We reset INSERT_ID unconditionally; it is probably cheaper than
+ checking if it is necessary.
+ */
+ thd->auto_inc_intervals_forced.empty();
+ }
+
+compare_errors:
+ /*
+ In the slave thread, we may sometimes execute some DROP / * 40005
+ TEMPORARY * / TABLE that come from parts of binlogs (likely if we
+ use RESET SLAVE or CHANGE MASTER TO), while the temporary table
+ has already been dropped. To ignore such irrelevant "table does
+ not exist errors", we silently clear the error if TEMPORARY was used.
+ */
+ if ((thd->lex->sql_command == SQLCOM_DROP_TABLE ||
+ thd->lex->sql_command == SQLCOM_DROP_SEQUENCE) &&
+ thd->lex->tmp_table() &&
+ thd->is_error() && thd->get_stmt_da()->sql_errno() == ER_BAD_TABLE_ERROR &&
+ !expected_error)
+ thd->get_stmt_da()->reset_diagnostics_area();
+ /*
+ If we expected a non-zero error code, and we don't get the same error
+ code, and it should be ignored or is related to a concurrency issue.
+ */
+ actual_error= thd->is_error() ? thd->get_stmt_da()->sql_errno() : 0;
+ DBUG_PRINT("info",("expected_error: %d sql_errno: %d",
+ expected_error, actual_error));
+
+ if ((unlikely(expected_error) &&
+ !test_if_equal_repl_errors(expected_error, actual_error) &&
+ !concurrency_error_code(expected_error)) &&
+ !ignored_error_code(actual_error) &&
+ !ignored_error_code(expected_error))
+ {
+ 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_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;
+ }
+ /*
+ If we get the same error code as expected and it is not a concurrency
+ issue, or should be ignored.
+ */
+ else if ((test_if_equal_repl_errors(expected_error, actual_error) &&
+ !concurrency_error_code(expected_error)) ||
+ ignored_error_code(actual_error))
+ {
+ DBUG_PRINT("info",("error ignored"));
+ thd->clear_error(1);
+ if (actual_error == ER_QUERY_INTERRUPTED ||
+ actual_error == ER_CONNECTION_KILLED)
+ thd->reset_killed();
+ }
+ /*
+ Other cases: mostly we expected no error and get one.
+ */
+ else if (unlikely(thd->is_slave_error || thd->is_fatal_error))
+ {
+ if (!is_parallel_retry_error(rgi, actual_error))
+ rli->report(ERROR_LEVEL, actual_error, rgi->gtid_info(),
+ "Error '%s' on query. Default database: '%s'. Query: '%s'",
+ (actual_error ? thd->get_stmt_da()->message() :
+ "unexpected success or fatal error"),
+ thd->get_db(), query_arg);
+ thd->is_slave_error= 1;
+#ifdef WITH_WSREP
+ if (wsrep_thd_is_toi(thd) && wsrep_must_ignore_error(thd))
+ {
+ thd->clear_error(1);
+ thd->killed= NOT_KILLED;
+ thd->wsrep_has_ignored_error= true;
+ }
+#endif /* WITH_WSREP */
+ }
+
+ /*
+ TODO: compare the values of "affected rows" around here. Something
+ like:
+ if ((uint32) affected_in_event != (uint32) affected_on_slave)
+ {
+ sql_print_error("Slave: did not get the expected number of affected \
+ rows running query from master - expected %d, got %d (this numbers \
+ should have matched modulo 4294967296).", 0, ...);
+ thd->is_slave_error = 1;
+ }
+ We may also want an option to tell the slave to ignore "affected"
+ mismatch. This mismatch could be implemented with a new ER_ code, and
+ to ignore it you would use --slave-skip-errors...
+
+ To do the comparison we need to know the value of "affected" which the
+ above mysql_parse() computed. And we need to know the value of
+ "affected" in the master's binlog. Both will be implemented later. The
+ important thing is that we now have the format ready to log the values
+ of "affected" in the binlog. So we can release 5.0.0 before effectively
+ logging "affected" and effectively comparing it.
+ */
+ } /* End of if (db_ok(... */
+
+ {
+ /**
+ The following failure injecion works in cooperation with tests
+ setting @@global.debug= 'd,stop_slave_middle_group'.
+ The sql thread receives the killed status and will proceed
+ to shutdown trying to finish incomplete events group.
+ */
+ DBUG_EXECUTE_IF("stop_slave_middle_group",
+ if (!current_stmt_is_commit && is_begin() == 0)
+ {
+ if (thd->transaction.all.modified_non_trans_table)
+ const_cast<Relay_log_info*>(rli)->abort_slave= 1;
+ };);
+ }
+
+end:
+ if (unlikely(sub_id && !thd->is_slave_error))
+ rpl_global_gtid_slave_state->update_state_hash(sub_id, &gtid, hton, rgi);
+
+ /*
+ Probably we have set thd->query, thd->db, thd->catalog to point to places
+ in the data_buf of this event. Now the event is going to be deleted
+ probably, so data_buf will be freed, so the thd->... listed above will be
+ pointers to freed memory.
+ So we must set them to 0, so that those bad pointers values are not later
+ used. Note that "cleanup" queries like automatic DROP TEMPORARY TABLE
+ don't suffer from these assignments to 0 as DROP TEMPORARY
+ TABLE uses the db.table syntax.
+ */
+ thd->catalog= 0;
+ thd->set_db(&null_clex_str); /* will free the current database */
+ thd->reset_query();
+ DBUG_PRINT("info", ("end: query= 0"));
+
+ /* Mark the statement completed. */
+ MYSQL_END_STATEMENT(thd->m_statement_psi, thd->get_stmt_da());
+ thd->m_statement_psi= NULL;
+ thd->m_digest= NULL;
+
+ /*
+ As a disk space optimization, future masters will not log an event for
+ LAST_INSERT_ID() if that function returned 0 (and thus they will be able
+ to replace the THD::stmt_depends_on_first_successful_insert_id_in_prev_stmt
+ variable by (THD->first_successful_insert_id_in_prev_stmt > 0) ; with the
+ resetting below we are ready to support that.
+ */
+ thd->first_successful_insert_id_in_prev_stmt_for_binlog= 0;
+ thd->first_successful_insert_id_in_prev_stmt= 0;
+ thd->stmt_depends_on_first_successful_insert_id_in_prev_stmt= 0;
+ free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
+ DBUG_RETURN(thd->is_slave_error);
+}
+
+Log_event::enum_skip_reason
+Query_log_event::do_shall_skip(rpl_group_info *rgi)
+{
+ Relay_log_info *rli= rgi->rli;
+ DBUG_ENTER("Query_log_event::do_shall_skip");
+ DBUG_PRINT("debug", ("query: '%s' q_len: %d", query, q_len));
+ DBUG_ASSERT(query && q_len > 0);
+ DBUG_ASSERT(thd == rgi->thd);
+
+ /*
+ An event skipped due to @@skip_replication must not be counted towards the
+ number of events to be skipped due to @@sql_slave_skip_counter.
+ */
+ if (flags & LOG_EVENT_SKIP_REPLICATION_F &&
+ opt_replicate_events_marked_for_skip != RPL_SKIP_REPLICATE)
+ DBUG_RETURN(Log_event::EVENT_SKIP_IGNORE);
+
+ if (rli->slave_skip_counter > 0)
+ {
+ if (is_begin())
+ {
+ thd->variables.option_bits|= OPTION_BEGIN | OPTION_GTID_BEGIN;
+ DBUG_RETURN(Log_event::continue_group(rgi));
+ }
+
+ if (is_commit() || is_rollback())
+ {
+ thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_GTID_BEGIN);
+ DBUG_RETURN(Log_event::EVENT_SKIP_COUNT);
+ }
+ }
+#ifdef WITH_WSREP
+ else if (WSREP_ON && wsrep_mysql_replication_bundle && opt_slave_domain_parallel_threads == 0 &&
+ thd->wsrep_mysql_replicated > 0 &&
+ (is_begin() || is_commit()))
+ {
+ if (++thd->wsrep_mysql_replicated < (int)wsrep_mysql_replication_bundle)
+ {
+ WSREP_DEBUG("skipping wsrep commit %d", thd->wsrep_mysql_replicated);
+ DBUG_RETURN(Log_event::EVENT_SKIP_IGNORE);
+ }
+ else
+ {
+ thd->wsrep_mysql_replicated = 0;
+ }
+ }
+#endif
+ DBUG_RETURN(Log_event::do_shall_skip(rgi));
+}
+
+
+bool
+Query_log_event::peek_is_commit_rollback(const char *event_start,
+ size_t event_len,
+ enum enum_binlog_checksum_alg checksum_alg)
+{
+ if (checksum_alg == BINLOG_CHECKSUM_ALG_CRC32)
+ {
+ if (event_len > BINLOG_CHECKSUM_LEN)
+ event_len-= BINLOG_CHECKSUM_LEN;
+ else
+ event_len= 0;
+ }
+ else
+ DBUG_ASSERT(checksum_alg == BINLOG_CHECKSUM_ALG_UNDEF ||
+ checksum_alg == BINLOG_CHECKSUM_ALG_OFF);
+
+ if (event_len < LOG_EVENT_HEADER_LEN + QUERY_HEADER_LEN || event_len < 9)
+ return false;
+ return !memcmp(event_start + (event_len-7), "\0COMMIT", 7) ||
+ !memcmp(event_start + (event_len-9), "\0ROLLBACK", 9);
+}
+
+#endif
+
+
+/**************************************************************************
+ Start_log_event_v3 methods
+**************************************************************************/
+
+Start_log_event_v3::Start_log_event_v3()
+ :Log_event(), created(0), binlog_version(BINLOG_VERSION),
+ dont_set_created(0)
+{
+ memcpy(server_version, ::server_version, ST_SERVER_VER_LEN);
+}
+
+
+#if defined(HAVE_REPLICATION)
+void Start_log_event_v3::pack_info(Protocol *protocol)
+{
+ char buf[12 + ST_SERVER_VER_LEN + 14 + 22], *pos;
+ pos= strmov(buf, "Server ver: ");
+ pos= strmov(pos, server_version);
+ pos= strmov(pos, ", Binlog ver: ");
+ pos= int10_to_str(binlog_version, pos, 10);
+ protocol->store(buf, (uint) (pos-buf), &my_charset_bin);
+}
+#endif
+
+
+bool Start_log_event_v3::write()
+{
+ char buff[START_V3_HEADER_LEN];
+ int2store(buff + ST_BINLOG_VER_OFFSET,binlog_version);
+ memcpy(buff + ST_SERVER_VER_OFFSET,server_version,ST_SERVER_VER_LEN);
+ 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(sizeof(buff)) ||
+ write_data(buff, sizeof(buff)) ||
+ write_footer();
+}
+
+
+#if defined(HAVE_REPLICATION)
+
+/**
+ Start_log_event_v3::do_apply_event() .
+ The master started
+
+ IMPLEMENTATION
+ - To handle the case where the master died without having time to write
+ DROP TEMPORARY TABLE, DO RELEASE_LOCK (prepared statements' deletion is
+ TODO), we clean up all temporary tables that we got, if we are sure we
+ can (see below).
+
+ @todo
+ - Remove all active user locks.
+ Guilhem 2003-06: this is true but not urgent: the worst it can cause is
+ the use of a bit of memory for a user lock which will not be used
+ anymore. If the user lock is later used, the old one will be released. In
+ other words, no deadlock problem.
+*/
+
+int Start_log_event_v3::do_apply_event(rpl_group_info *rgi)
+{
+ DBUG_ENTER("Start_log_event_v3::do_apply_event");
+ int error= 0;
+ Relay_log_info *rli= rgi->rli;
+
+ switch (binlog_version)
+ {
+ case 3:
+ case 4:
+ /*
+ This can either be 4.x (then a Start_log_event_v3 is only at master
+ startup so we are sure the master has restarted and cleared his temp
+ tables; the event always has 'created'>0) or 5.0 (then we have to test
+ 'created').
+ */
+ if (created)
+ {
+ rli->close_temporary_tables();
+
+ /*
+ The following is only false if we get here with a BINLOG statement
+ */
+ if (rli->mi)
+ cleanup_load_tmpdir(&rli->mi->cmp_connection_name);
+ }
+ break;
+
+ /*
+ Now the older formats; in that case load_tmpdir is cleaned up by the I/O
+ thread.
+ */
+ case 1:
+ if (strncmp(rli->relay_log.description_event_for_exec->server_version,
+ "3.23.57",7) >= 0 && created)
+ {
+ /*
+ Can distinguish, based on the value of 'created': this event was
+ generated at master startup.
+ */
+ rli->close_temporary_tables();
+ }
+ /*
+ Otherwise, can't distinguish a Start_log_event generated at
+ master startup and one generated by master FLUSH LOGS, so cannot
+ be sure temp tables have to be dropped. So do nothing.
+ */
+ break;
+ default:
+ /*
+ This case is not expected. It can be either an event corruption or an
+ unsupported binary log version.
+ */
+ rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
+ ER_THD(thd, ER_SLAVE_FATAL_ERROR),
+ "Binlog version not supported");
+ DBUG_RETURN(1);
+ }
+ DBUG_RETURN(error);
+}
+#endif /* defined(HAVE_REPLICATION) */
+
+/***************************************************************************
+ Format_description_log_event methods
+****************************************************************************/
+
+bool Format_description_log_event::write()
+{
+ bool ret;
+ bool no_checksum;
+ /*
+ We don't call Start_log_event_v3::write() because this would make 2
+ my_b_safe_write().
+ */
+ uchar buff[START_V3_HEADER_LEN+1];
+ size_t rec_size= sizeof(buff) + BINLOG_CHECKSUM_ALG_DESC_LEN +
+ number_of_event_types;
+ int2store(buff + ST_BINLOG_VER_OFFSET,binlog_version);
+ memcpy((char*) buff + ST_SERVER_VER_OFFSET,server_version,ST_SERVER_VER_LEN);
+ if (!dont_set_created)
+ created= get_time();
+ int4store(buff + ST_CREATED_OFFSET,created);
+ buff[ST_COMMON_HEADER_LEN_OFFSET]= common_header_len;
+ /*
+ if checksum is requested
+ record the checksum-algorithm descriptor next to
+ post_header_len vector which will be followed by the checksum value.
+ Master is supposed to trigger checksum computing by binlog_checksum_options,
+ slave does it via marking the event according to
+ FD_queue checksum_alg value.
+ */
+ compile_time_assert(BINLOG_CHECKSUM_ALG_DESC_LEN == 1);
+#ifdef DBUG_ASSERT_EXISTS
+ data_written= 0; // to prepare for need_checksum assert
+#endif
+ 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.
+ Thereby a combination of (A) == 0, (V) != 0 means
+ it's the checksum-aware server's FD event that heads checksum-free binlog
+ file.
+ Here 0 stands for checksumming OFF to evaluate (V) as 0 is that case.
+ A combination of (A) != 0, (V) != 0 denotes FD of the checksum-aware server
+ heading the checksummed binlog.
+ (A), (V) presence in FD of the checksum-aware server makes the event
+ 1 + 4 bytes bigger comparing to the former FD.
+ */
+
+ if ((no_checksum= (checksum_alg == BINLOG_CHECKSUM_ALG_OFF)))
+ {
+ checksum_alg= BINLOG_CHECKSUM_ALG_CRC32; // Forcing (V) room to fill anyway
+ }
+ 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;
+}
+
+#if defined(HAVE_REPLICATION)
+int Format_description_log_event::do_apply_event(rpl_group_info *rgi)
+{
+ int ret= 0;
+ Relay_log_info *rli= rgi->rli;
+ DBUG_ENTER("Format_description_log_event::do_apply_event");
+
+ /*
+ As a transaction NEVER spans on 2 or more binlogs:
+ if we have an active transaction at this point, the master died
+ while writing the transaction to the binary log, i.e. while
+ flushing the binlog cache to the binlog. XA guarantees that master has
+ rolled back. So we roll back.
+ Note: this event could be sent by the master to inform us of the
+ format of its binlog; in other words maybe it is not at its
+ original place when it comes to us; we'll know this by checking
+ log_pos ("artificial" events have log_pos == 0).
+ */
+ if (!is_artificial_event() && created && thd->transaction.all.ha_list)
+ {
+ /* This is not an error (XA is safe), just an information */
+ rli->report(INFORMATION_LEVEL, 0, NULL,
+ "Rolling back unfinished transaction (no COMMIT "
+ "or ROLLBACK in relay log). A probable cause is that "
+ "the master died while writing the transaction to "
+ "its binary log, thus rolled back too.");
+ rgi->cleanup_context(thd, 1);
+ }
+
+ /*
+ If this event comes from ourselves, there is no cleaning task to
+ perform, we don't call Start_log_event_v3::do_apply_event()
+ (this was just to update the log's description event).
+ */
+ if (server_id != (uint32) global_system_variables.server_id)
+ {
+ /*
+ If the event was not requested by the slave i.e. the master sent
+ it while the slave asked for a position >4, the event will make
+ rli->group_master_log_pos advance. Say that the slave asked for
+ position 1000, and the Format_desc event's end is 96. Then in
+ the beginning of replication rli->group_master_log_pos will be
+ 0, then 96, then jump to first really asked event (which is
+ >96). So this is ok.
+ */
+ ret= Start_log_event_v3::do_apply_event(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;
+ rli->relay_log.description_event_for_exec= this;
+ }
+
+ DBUG_RETURN(ret);
+}
+
+int Format_description_log_event::do_update_pos(rpl_group_info *rgi)
+{
+ if (server_id == (uint32) global_system_variables.server_id)
+ {
+ /*
+ We only increase the relay log position if we are skipping
+ events and do not touch any group_* variables, nor flush the
+ relay log info. If there is a crash, we will have to re-skip
+ the events again, but that is a minor issue.
+
+ If we do not skip stepping the group log position (and the
+ server id was changed when restarting the server), it might well
+ be that we start executing at a position that is invalid, e.g.,
+ at a Rows_log_event or a Query_log_event preceeded by a
+ Intvar_log_event instead of starting at a Table_map_log_event or
+ the Intvar_log_event respectively.
+ */
+ rgi->inc_event_relay_log_pos();
+ return 0;
+ }
+ else
+ {
+ return Log_event::do_update_pos(rgi);
+ }
+}
+
+Log_event::enum_skip_reason
+Format_description_log_event::do_shall_skip(rpl_group_info *rgi)
+{
+ return Log_event::EVENT_SKIP_NOT;
+}
+
+#endif
+
+
+#if defined(HAVE_REPLICATION)
+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
+
+
+/**************************************************************************
+ Load_log_event methods
+**************************************************************************/
+
+#if defined(HAVE_REPLICATION)
+bool Load_log_event::print_query(THD *thd, bool need_db, const char *cs,
+ String *buf, my_off_t *fn_start,
+ my_off_t *fn_end, const char *qualify_db)
+{
+ if (need_db && db && db_len)
+ {
+ buf->append(STRING_WITH_LEN("use "));
+ append_identifier(thd, buf, db, db_len);
+ buf->append(STRING_WITH_LEN("; "));
+ }
+
+ buf->append(STRING_WITH_LEN("LOAD DATA "));
+
+ if (is_concurrent)
+ buf->append(STRING_WITH_LEN("CONCURRENT "));
+
+ if (fn_start)
+ *fn_start= buf->length();
+
+ if (check_fname_outside_temp_buf())
+ buf->append(STRING_WITH_LEN("LOCAL "));
+ buf->append(STRING_WITH_LEN("INFILE '"));
+ buf->append_for_single_quote(fname, fname_len);
+ buf->append(STRING_WITH_LEN("' "));
+
+ if (sql_ex.opt_flags & REPLACE_FLAG)
+ buf->append(STRING_WITH_LEN("REPLACE "));
+ else if (sql_ex.opt_flags & IGNORE_FLAG)
+ buf->append(STRING_WITH_LEN("IGNORE "));
+
+ buf->append(STRING_WITH_LEN("INTO"));
+
+ if (fn_end)
+ *fn_end= buf->length();
+
+ buf->append(STRING_WITH_LEN(" TABLE "));
+ if (qualify_db)
+ {
+ append_identifier(thd, buf, qualify_db, strlen(qualify_db));
+ buf->append(STRING_WITH_LEN("."));
+ }
+ append_identifier(thd, buf, table_name, table_name_len);
+
+ if (cs != NULL)
+ {
+ buf->append(STRING_WITH_LEN(" CHARACTER SET "));
+ buf->append(cs, strlen(cs));
+ }
+
+ /* We have to create all optional fields as the default is not empty */
+ buf->append(STRING_WITH_LEN(" FIELDS TERMINATED BY "));
+ pretty_print_str(buf, sql_ex.field_term, sql_ex.field_term_len);
+ if (sql_ex.opt_flags & OPT_ENCLOSED_FLAG)
+ buf->append(STRING_WITH_LEN(" OPTIONALLY "));
+ buf->append(STRING_WITH_LEN(" ENCLOSED BY "));
+ pretty_print_str(buf, sql_ex.enclosed, sql_ex.enclosed_len);
+
+ buf->append(STRING_WITH_LEN(" ESCAPED BY "));
+ pretty_print_str(buf, sql_ex.escaped, sql_ex.escaped_len);
+
+ buf->append(STRING_WITH_LEN(" LINES TERMINATED BY "));
+ pretty_print_str(buf, sql_ex.line_term, sql_ex.line_term_len);
+ if (sql_ex.line_start_len)
+ {
+ buf->append(STRING_WITH_LEN(" STARTING BY "));
+ pretty_print_str(buf, sql_ex.line_start, sql_ex.line_start_len);
+ }
+
+ if ((long) skip_lines > 0)
+ {
+ buf->append(STRING_WITH_LEN(" IGNORE "));
+ buf->append_ulonglong(skip_lines);
+ buf->append(STRING_WITH_LEN(" LINES "));
+ }
+
+ if (num_fields)
+ {
+ uint i;
+ const char *field= fields;
+ buf->append(STRING_WITH_LEN(" ("));
+ for (i = 0; i < num_fields; i++)
+ {
+ if (i)
+ {
+ /*
+ Yes, the space and comma is reversed here. But this is mostly dead
+ code, at most used when reading really old binlogs from old servers,
+ so better just leave it as is...
+ */
+ buf->append(STRING_WITH_LEN(" ,"));
+ }
+ append_identifier(thd, buf, field, field_lens[i]);
+ field+= field_lens[i] + 1;
+ }
+ buf->append(STRING_WITH_LEN(")"));
+ }
+ return 0;
+}
+
+
+void Load_log_event::pack_info(Protocol *protocol)
+{
+ char query_buffer[1024];
+ String query_str(query_buffer, sizeof(query_buffer), system_charset_info);
+
+ query_str.length(0);
+ print_query(protocol->thd, TRUE, NULL, &query_str, 0, 0, NULL);
+ protocol->store(query_str.ptr(), query_str.length(), &my_charset_bin);
+}
+#endif /* defined(HAVE_REPLICATION) */
+
+
+bool Load_log_event::write_data_header()
+{
+ char buf[LOAD_HEADER_LEN];
+ int4store(buf + L_THREAD_ID_OFFSET, slave_proxy_id);
+ int4store(buf + L_EXEC_TIME_OFFSET, exec_time);
+ int4store(buf + L_SKIP_LINES_OFFSET, skip_lines);
+ 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 write_data(buf, LOAD_HEADER_LEN) != 0;
+}
+
+
+bool Load_log_event::write_data_body()
+{
+ if (sql_ex.write_data(writer))
+ return 1;
+ if (num_fields && fields && field_lens)
+ {
+ if (write_data(field_lens, num_fields) ||
+ write_data(fields, field_block_len))
+ return 1;
+ }
+ return (write_data(table_name, table_name_len + 1) ||
+ write_data(db, db_len + 1) ||
+ write_data(fname, fname_len));
+}
+
+
+Load_log_event::Load_log_event(THD *thd_arg, const sql_exchange *ex,
+ const char *db_arg, const char *table_name_arg,
+ List<Item> &fields_arg,
+ bool is_concurrent_arg,
+ enum enum_duplicates handle_dup,
+ bool ignore, bool using_trans)
+ :Log_event(thd_arg,
+ thd_arg->thread_specific_used ? LOG_EVENT_THREAD_SPECIFIC_F : 0,
+ using_trans),
+ thread_id(thd_arg->thread_id),
+ slave_proxy_id((ulong)thd_arg->variables.pseudo_thread_id),
+ num_fields(0),fields(0),
+ field_lens(0),field_block_len(0),
+ table_name(table_name_arg ? table_name_arg : ""),
+ db(db_arg), fname(ex->file_name), local_fname(FALSE),
+ is_concurrent(is_concurrent_arg)
+{
+ time_t end_time;
+ time(&end_time);
+ exec_time = (ulong) (end_time - thd_arg->start_time);
+ /* db can never be a zero pointer in 4.0 */
+ db_len = (uint32) strlen(db);
+ table_name_len = (uint32) strlen(table_name);
+ fname_len = (fname) ? (uint) strlen(fname) : 0;
+ sql_ex.field_term = ex->field_term->ptr();
+ sql_ex.field_term_len = (uint8) ex->field_term->length();
+ sql_ex.enclosed = ex->enclosed->ptr();
+ sql_ex.enclosed_len = (uint8) ex->enclosed->length();
+ sql_ex.line_term = ex->line_term->ptr();
+ sql_ex.line_term_len = (uint8) ex->line_term->length();
+ sql_ex.line_start = ex->line_start->ptr();
+ sql_ex.line_start_len = (uint8) ex->line_start->length();
+ sql_ex.escaped = ex->escaped->ptr();
+ sql_ex.escaped_len = (uint8) ex->escaped->length();
+ sql_ex.opt_flags = 0;
+ sql_ex.cached_new_format = -1;
+
+ if (ex->dumpfile)
+ sql_ex.opt_flags|= DUMPFILE_FLAG;
+ if (ex->opt_enclosed)
+ sql_ex.opt_flags|= OPT_ENCLOSED_FLAG;
+
+ sql_ex.empty_flags= 0;
+
+ switch (handle_dup) {
+ case DUP_REPLACE:
+ sql_ex.opt_flags|= REPLACE_FLAG;
+ break;
+ case DUP_UPDATE: // Impossible here
+ case DUP_ERROR:
+ break;
+ }
+ if (ignore)
+ sql_ex.opt_flags|= IGNORE_FLAG;
+
+ if (!ex->field_term->length())
+ sql_ex.empty_flags |= FIELD_TERM_EMPTY;
+ if (!ex->enclosed->length())
+ sql_ex.empty_flags |= ENCLOSED_EMPTY;
+ if (!ex->line_term->length())
+ sql_ex.empty_flags |= LINE_TERM_EMPTY;
+ if (!ex->line_start->length())
+ sql_ex.empty_flags |= LINE_START_EMPTY;
+ if (!ex->escaped->length())
+ sql_ex.empty_flags |= ESCAPED_EMPTY;
+
+ skip_lines = ex->skip_lines;
+
+ List_iterator<Item> li(fields_arg);
+ field_lens_buf.length(0);
+ fields_buf.length(0);
+ Item* item;
+ while ((item = li++))
+ {
+ num_fields++;
+ uchar len= (uchar) item->name.length;
+ field_block_len += len + 1;
+ fields_buf.append(item->name.str, len + 1);
+ field_lens_buf.append((char*)&len, 1);
+ }
+
+ field_lens = (const uchar*)field_lens_buf.ptr();
+ fields = fields_buf.ptr();
+}
+
+
+/**
+ Load_log_event::set_fields()
+
+ @note
+ This function can not use the member variable
+ for the database, since LOAD DATA INFILE on the slave
+ can be for a different database than the current one.
+ This is the reason for the affected_db argument to this method.
+*/
+
+void Load_log_event::set_fields(const char* affected_db,
+ List<Item> &field_list,
+ Name_resolution_context *context)
+{
+ uint i;
+ const char* field = fields;
+ for (i= 0; i < num_fields; i++)
+ {
+ LEX_CSTRING field_name= {field, field_lens[i] };
+ field_list.push_back(new (thd->mem_root)
+ Item_field(thd, context,
+ Lex_cstring_strlen(affected_db),
+ Lex_cstring_strlen(table_name),
+ field_name),
+ thd->mem_root);
+ field+= field_lens[i] + 1;
+ }
+}
+
+
+#if defined(HAVE_REPLICATION)
+/**
+ Does the data loading job when executing a LOAD DATA on the slave.
+
+ @param net
+ @param rli
+ @param use_rli_only_for_errors If set to 1, rli is provided to
+ Load_log_event::exec_event only for this
+ function to have RPL_LOG_NAME and
+ rli->last_slave_error, both being used by
+ error reports. rli's position advancing
+ is skipped (done by the caller which is
+ Execute_load_log_event::exec_event).
+ If set to 0, rli is provided for full use,
+ i.e. for error reports and position
+ advancing.
+
+ @todo
+ fix this; this can be done by testing rules in
+ Create_file_log_event::exec_event() and then discarding Append_block and
+ al.
+ @todo
+ this is a bug - this needs to be moved to the I/O thread
+
+ @retval
+ 0 Success
+ @retval
+ 1 Failure
+*/
+
+int Load_log_event::do_apply_event(NET* net, rpl_group_info *rgi,
+ bool use_rli_only_for_errors)
+{
+ Relay_log_info const *rli= rgi->rli;
+ Rpl_filter *rpl_filter= rli->mi->rpl_filter;
+ DBUG_ENTER("Load_log_event::do_apply_event");
+
+ DBUG_ASSERT(thd->query() == 0);
+ set_thd_db(thd, rpl_filter, db, db_len);
+ thd->clear_error(1);
+
+ /* see Query_log_event::do_apply_event() and BUG#13360 */
+ DBUG_ASSERT(!rgi->m_table_map.count());
+ /*
+ Usually lex_start() is called by mysql_parse(), but we need it here
+ as the present method does not call mysql_parse().
+ */
+ lex_start(thd);
+ thd->lex->local_file= local_fname;
+ thd->reset_for_next_command(0); // Errors are cleared above
+
+ /*
+ We test replicate_*_db rules. Note that we have already prepared
+ the file to load, even if we are going to ignore and delete it
+ now. So it is possible that we did a lot of disk writes for
+ nothing. In other words, a big LOAD DATA INFILE on the master will
+ still consume a lot of space on the slave (space in the relay log
+ + space of temp files: twice the space of the file to load...)
+ even if it will finally be ignored. TODO: fix this; this can be
+ done by testing rules in Create_file_log_event::do_apply_event()
+ and then discarding Append_block and al. Another way is do the
+ filtering in the I/O thread (more efficient: no disk writes at
+ all).
+
+
+ Note: We do not need to execute reset_one_shot_variables() if this
+ db_ok() test fails.
+ Reason: The db stored in binlog events is the same for SET and for
+ its companion query. If the SET is ignored because of
+ db_ok(), the companion query will also be ignored, and if
+ the companion query is ignored in the db_ok() test of
+ ::do_apply_event(), then the companion SET also have so
+ we don't need to reset_one_shot_variables().
+ */
+ if (rpl_filter->db_ok(thd->db.str))
+ {
+ thd->set_time(when, when_sec_part);
+ thd->set_query_id(next_query_id());
+ thd->get_stmt_da()->opt_clear_warning_info(thd->query_id);
+
+ TABLE_LIST tables;
+ LEX_CSTRING db_name= { thd->strmake(thd->db.str, thd->db.length), thd->db.length };
+ if (lower_case_table_names)
+ my_casedn_str(system_charset_info, (char *)table_name);
+ LEX_CSTRING tbl_name= { table_name, strlen(table_name) };
+ tables.init_one_table(&db_name, &tbl_name, 0, TL_WRITE);
+ tables.updating= 1;
+
+ // the table will be opened in mysql_load
+ if (rpl_filter->is_on() && !rpl_filter->tables_ok(thd->db.str, &tables))
+ {
+ // TODO: this is a bug - this needs to be moved to the I/O thread
+ if (net)
+ skip_load_data_infile(net);
+ }
+ else
+ {
+ enum enum_duplicates handle_dup;
+ bool ignore= 0;
+ char query_buffer[1024];
+ String query_str(query_buffer, sizeof(query_buffer), system_charset_info);
+ char *load_data_query;
+
+ query_str.length(0);
+ /*
+ Forge LOAD DATA INFILE query which will be used in SHOW PROCESS LIST
+ and written to slave's binlog if binlogging is on.
+ */
+ print_query(thd, FALSE, NULL, &query_str, NULL, NULL, NULL);
+ if (!(load_data_query= (char *)thd->strmake(query_str.ptr(),
+ query_str.length())))
+ {
+ /*
+ This will set thd->fatal_error in case of OOM. So we surely will notice
+ that something is wrong.
+ */
+ goto error;
+ }
+
+ thd->set_query(load_data_query, (uint) (query_str.length()));
+
+ if (sql_ex.opt_flags & REPLACE_FLAG)
+ handle_dup= DUP_REPLACE;
+ else if (sql_ex.opt_flags & IGNORE_FLAG)
+ {
+ ignore= 1;
+ handle_dup= DUP_ERROR;
+ }
+ else
+ {
+ /*
+ When replication is running fine, if it was DUP_ERROR on the
+ master then we could choose IGNORE here, because if DUP_ERROR
+ suceeded on master, and data is identical on the master and slave,
+ then there should be no uniqueness errors on slave, so IGNORE is
+ the same as DUP_ERROR. But in the unlikely case of uniqueness errors
+ (because the data on the master and slave happen to be different
+ (user error or bug), we want LOAD DATA to print an error message on
+ the slave to discover the problem.
+
+ If reading from net (a 3.23 master), mysql_load() will change this
+ to IGNORE.
+ */
+ handle_dup= DUP_ERROR;
+ }
+ /*
+ We need to set thd->lex->sql_command and thd->lex->duplicates
+ since InnoDB tests these variables to decide if this is a LOAD
+ DATA ... REPLACE INTO ... statement even though mysql_parse()
+ is not called. This is not needed in 5.0 since there the LOAD
+ DATA ... statement is replicated using mysql_parse(), which
+ sets the thd->lex fields correctly.
+ */
+ thd->lex->sql_command= SQLCOM_LOAD;
+ thd->lex->duplicates= handle_dup;
+
+ sql_exchange ex((char*)fname, sql_ex.opt_flags & DUMPFILE_FLAG);
+ String field_term(sql_ex.field_term,sql_ex.field_term_len,log_cs);
+ String enclosed(sql_ex.enclosed,sql_ex.enclosed_len,log_cs);
+ String line_term(sql_ex.line_term,sql_ex.line_term_len,log_cs);
+ String line_start(sql_ex.line_start,sql_ex.line_start_len,log_cs);
+ String escaped(sql_ex.escaped,sql_ex.escaped_len, log_cs);
+ ex.field_term= &field_term;
+ ex.enclosed= &enclosed;
+ ex.line_term= &line_term;
+ ex.line_start= &line_start;
+ ex.escaped= &escaped;
+
+ ex.opt_enclosed = (sql_ex.opt_flags & OPT_ENCLOSED_FLAG);
+ if (sql_ex.empty_flags & FIELD_TERM_EMPTY)
+ ex.field_term->length(0);
+
+ ex.skip_lines = skip_lines;
+ List<Item> field_list;
+ thd->lex->first_select_lex()->context.resolve_in_table_list_only(&tables);
+ set_fields(tables.db.str,
+ field_list, &thd->lex->first_select_lex()->context);
+ thd->variables.pseudo_thread_id= thread_id;
+ if (net)
+ {
+ // mysql_load will use thd->net to read the file
+ thd->net.vio = net->vio;
+ // Make sure the client does not get confused about the packet sequence
+ thd->net.pkt_nr = net->pkt_nr;
+ }
+ /*
+ It is safe to use tmp_list twice because we are not going to
+ update it inside mysql_load().
+ */
+ List<Item> tmp_list;
+ if (thd->open_temporary_tables(&tables) ||
+ mysql_load(thd, &ex, &tables, field_list, tmp_list, tmp_list,
+ handle_dup, ignore, net != 0))
+ thd->is_slave_error= 1;
+ if (thd->cuted_fields)
+ {
+ /* 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 %llu in log '%s' produced %ld "
+ "warning(s). Default database: '%s'",
+ (char*) table_name, log_pos, RPL_LOG_NAME,
+ (ulong) thd->cuted_fields,
+ thd->get_db());
+ }
+ if (net)
+ net->pkt_nr= thd->net.pkt_nr;
+ }
+ }
+ else
+ {
+ /*
+ We will just ask the master to send us /dev/null if we do not
+ want to load the data.
+ TODO: this a bug - needs to be done in I/O thread
+ */
+ if (net)
+ skip_load_data_infile(net);
+ }
+
+error:
+ thd->net.vio = 0;
+ const char *remember_db= thd->get_db();
+ thd->catalog= 0;
+ thd->set_db(&null_clex_str); /* will free the current database */
+ thd->reset_query();
+ thd->get_stmt_da()->set_overwrite_status(true);
+ thd->is_error() ? trans_rollback_stmt(thd) : trans_commit_stmt(thd);
+ thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_GTID_BEGIN);
+ thd->get_stmt_da()->set_overwrite_status(false);
+ close_thread_tables(thd);
+ /*
+ - If transaction rollback was requested due to deadlock
+ perform it and release metadata locks.
+ - If inside a multi-statement transaction,
+ defer the release of metadata locks until the current
+ transaction is either committed or rolled back. This prevents
+ other statements from modifying the table for the entire
+ duration of this transaction. This provides commit ordering
+ and guarantees serializability across multiple transactions.
+ - If in autocommit mode, or outside a transactional context,
+ automatically release metadata locks of the current statement.
+ */
+ if (thd->transaction_rollback_request)
+ {
+ trans_rollback_implicit(thd);
+ thd->mdl_context.release_transactional_locks();
+ }
+ else if (! thd->in_multi_stmt_transaction_mode())
+ thd->mdl_context.release_transactional_locks();
+ else
+ thd->mdl_context.release_statement_locks();
+
+ DBUG_EXECUTE_IF("LOAD_DATA_INFILE_has_fatal_error",
+ thd->is_slave_error= 0; thd->is_fatal_error= 1;);
+
+ if (unlikely(thd->is_slave_error))
+ {
+ /* this err/sql_errno code is copy-paste from net_send_error() */
+ const char *err;
+ int sql_errno;
+ if (thd->is_error())
+ {
+ err= thd->get_stmt_da()->message();
+ sql_errno= thd->get_stmt_da()->sql_errno();
+ }
+ else
+ {
+ sql_errno=ER_UNKNOWN_ERROR;
+ 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'",
+ err, (char*)table_name, remember_db);
+ free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
+ DBUG_RETURN(1);
+ }
+ free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
+
+ if (unlikely(thd->is_fatal_error))
+ {
+ char buf[256];
+ my_snprintf(buf, sizeof(buf),
+ "Running LOAD DATA INFILE on table '%-.64s'."
+ " Default database: '%-.64s'",
+ (char*)table_name,
+ remember_db);
+
+ rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, rgi->gtid_info(),
+ ER_THD(thd, ER_SLAVE_FATAL_ERROR), buf);
+ DBUG_RETURN(1);
+ }
+
+ DBUG_RETURN( use_rli_only_for_errors ? 0 : Log_event::do_apply_event(rgi) );
+}
+#endif
+
+
+/**************************************************************************
+ Rotate_log_event methods
+**************************************************************************/
+
+#if defined(HAVE_REPLICATION)
+void Rotate_log_event::pack_info(Protocol *protocol)
+{
+ StringBuffer<256> tmp(log_cs);
+ tmp.length(0);
+ tmp.append(new_log_ident, ident_len);
+ tmp.append(STRING_WITH_LEN(";pos="));
+ tmp.append_ulonglong(pos);
+ protocol->store(tmp.ptr(), tmp.length(), &my_charset_bin);
+}
+#endif
+
+
+Rotate_log_event::Rotate_log_event(const char* new_log_ident_arg,
+ uint ident_len_arg, ulonglong pos_arg,
+ uint flags_arg)
+ :Log_event(), new_log_ident(new_log_ident_arg),
+ pos(pos_arg),ident_len(ident_len_arg ? ident_len_arg :
+ (uint) strlen(new_log_ident_arg)), flags(flags_arg)
+{
+ DBUG_ENTER("Rotate_log_event::Rotate_log_event(...,flags)");
+ 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));
+ if (flags & RELAY_LOG)
+ set_relay_log_event();
+ DBUG_VOID_RETURN;
+}
+
+
+bool Rotate_log_event::write()
+{
+ char buf[ROTATE_HEADER_LEN];
+ int8store(buf + R_POS_OFFSET, pos);
+ return (write_header(ROTATE_HEADER_LEN + ident_len) ||
+ write_data(buf, ROTATE_HEADER_LEN) ||
+ write_data(new_log_ident, (uint) ident_len) ||
+ write_footer());
+}
+
+
+#if defined(HAVE_REPLICATION)
+
+/*
+ Got a rotate log event from the master.
+
+ This is mainly used so that we can later figure out the logname and
+ position for the master.
+
+ We can't rotate the slave's BINlog as this will cause infinitive rotations
+ in a A -> B -> A setup.
+ The NOTES below is a wrong comment which will disappear when 4.1 is merged.
+
+ This must only be called from the Slave SQL thread, since it calls
+ Relay_log_info::flush().
+
+ @retval
+ 0 ok
+ 1 error
+*/
+int Rotate_log_event::do_update_pos(rpl_group_info *rgi)
+{
+ int error= 0;
+ Relay_log_info *rli= rgi->rli;
+ DBUG_ENTER("Rotate_log_event::do_update_pos");
+
+ 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: %llu", this->pos));
+
+ /*
+ If we are in a transaction or in a group: the only normal case is
+ when the I/O thread was copying a big transaction, then it was
+ stopped and restarted: we have this in the relay log:
+
+ BEGIN
+ ...
+ ROTATE (a fake one)
+ ...
+ COMMIT or ROLLBACK
+
+ In that case, we don't want to touch the coordinates which
+ correspond to the beginning of the transaction. Starting from
+ 5.0.0, there also are some rotates from the slave itself, in the
+ relay log, which shall not change the group positions.
+
+ In parallel replication, rotate event is executed out-of-band with normal
+ events, so we cannot update group_master_log_name or _pos here, it will
+ be updated with the next normal event instead.
+ */
+ if ((server_id != global_system_variables.server_id ||
+ rli->replicate_same_server_id) &&
+ !is_relay_log_event() &&
+ !rli->is_in_group() &&
+ !rgi->is_parallel_exec)
+ {
+ mysql_mutex_lock(&rli->data_lock);
+ DBUG_PRINT("info", ("old group_master_log_name: '%s' "
+ "old group_master_log_pos: %lu",
+ rli->group_master_log_name,
+ (ulong) rli->group_master_log_pos));
+ memcpy(rli->group_master_log_name, new_log_ident, ident_len+1);
+ rli->notify_group_master_log_name_update();
+ rli->inc_group_relay_log_pos(pos, rgi, TRUE /* skip_lock */);
+ DBUG_PRINT("info", ("new group_master_log_name: '%s' "
+ "new group_master_log_pos: %lu",
+ rli->group_master_log_name,
+ (ulong) rli->group_master_log_pos));
+ mysql_mutex_unlock(&rli->data_lock);
+ rpl_global_gtid_slave_state->record_and_update_gtid(thd, rgi);
+ error= rli->flush();
+
+ /*
+ Reset thd->variables.option_bits and sql_mode etc, because this could
+ be the signal of a master's downgrade from 5.0 to 4.0.
+ However, no need to reset description_event_for_exec: indeed, if the next
+ master is 5.0 (even 5.0.1) we will soon get a Format_desc; if the next
+ master is 4.0 then the events are in the slave's format (conversion).
+ */
+ set_slave_thread_options(thd);
+ set_slave_thread_default_charset(thd, rgi);
+ thd->variables.sql_mode= global_system_variables.sql_mode;
+ thd->variables.auto_increment_increment=
+ thd->variables.auto_increment_offset= 1;
+ }
+ else
+ rgi->inc_event_relay_log_pos();
+
+ DBUG_RETURN(error);
+}
+
+
+Log_event::enum_skip_reason
+Rotate_log_event::do_shall_skip(rpl_group_info *rgi)
+{
+ enum_skip_reason reason= Log_event::do_shall_skip(rgi);
+
+ switch (reason) {
+ case Log_event::EVENT_SKIP_NOT:
+ case Log_event::EVENT_SKIP_COUNT:
+ return Log_event::EVENT_SKIP_NOT;
+
+ case Log_event::EVENT_SKIP_IGNORE:
+ return Log_event::EVENT_SKIP_IGNORE;
+ }
+ DBUG_ASSERT(0);
+ return Log_event::EVENT_SKIP_NOT; // To keep compiler happy
+}
+
+#endif
+
+
+/**************************************************************************
+ Binlog_checkpoint_log_event methods
+**************************************************************************/
+
+#if defined(HAVE_REPLICATION)
+void Binlog_checkpoint_log_event::pack_info(Protocol *protocol)
+{
+ protocol->store(binlog_file_name, binlog_file_len, &my_charset_bin);
+}
+
+
+Log_event::enum_skip_reason
+Binlog_checkpoint_log_event::do_shall_skip(rpl_group_info *rgi)
+{
+ enum_skip_reason reason= Log_event::do_shall_skip(rgi);
+ if (reason == EVENT_SKIP_COUNT)
+ reason= EVENT_SKIP_NOT;
+ return reason;
+}
+#endif
+
+
+Binlog_checkpoint_log_event::Binlog_checkpoint_log_event(
+ const char *binlog_file_name_arg,
+ uint binlog_file_len_arg)
+ :Log_event(),
+ binlog_file_name(my_strndup(binlog_file_name_arg, binlog_file_len_arg,
+ MYF(MY_WME))),
+ binlog_file_len(binlog_file_len_arg)
+{
+ cache_type= EVENT_NO_CACHE;
+}
+
+
+bool Binlog_checkpoint_log_event::write()
+{
+ uchar buf[BINLOG_CHECKPOINT_HEADER_LEN];
+ int4store(buf, binlog_file_len);
+ 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();
+}
+
+
+/**************************************************************************
+ Global transaction ID stuff
+**************************************************************************/
+
+Gtid_log_event::Gtid_log_event(THD *thd_arg, uint64 seq_no_arg,
+ uint32 domain_id_arg, bool standalone,
+ uint16 flags_arg, bool is_transactional,
+ uint64 commit_id_arg)
+ : Log_event(thd_arg, flags_arg, is_transactional),
+ seq_no(seq_no_arg), commit_id(commit_id_arg), domain_id(domain_id_arg),
+ flags2((standalone ? FL_STANDALONE : 0) | (commit_id_arg ? FL_GROUP_COMMIT_ID : 0))
+{
+ cache_type= Log_event::EVENT_NO_CACHE;
+ bool is_tmp_table= thd_arg->lex->stmt_accessed_temp_table();
+ if (thd_arg->transaction.stmt.trans_did_wait() ||
+ thd_arg->transaction.all.trans_did_wait())
+ flags2|= FL_WAITED;
+ if (thd_arg->transaction.stmt.trans_did_ddl() ||
+ thd_arg->transaction.stmt.has_created_dropped_temp_table() ||
+ thd_arg->transaction.all.trans_did_ddl() ||
+ thd_arg->transaction.all.has_created_dropped_temp_table())
+ flags2|= FL_DDL;
+ else if (is_transactional && !is_tmp_table)
+ flags2|= FL_TRANSACTIONAL;
+ if (!(thd_arg->variables.option_bits & OPTION_RPL_SKIP_PARALLEL))
+ flags2|= FL_ALLOW_PARALLEL;
+ /* Preserve any DDL or WAITED flag in the slave's binlog. */
+ if (thd_arg->rgi_slave)
+ flags2|= (thd_arg->rgi_slave->gtid_ev_flags2 & (FL_DDL|FL_WAITED));
+}
+
+
+/*
+ Used to record GTID while sending binlog to slave, without having to
+ fully contruct every Gtid_log_event() needlessly.
+*/
+bool
+Gtid_log_event::peek(const char *event_start, size_t event_len,
+ enum enum_binlog_checksum_alg checksum_alg,
+ uint32 *domain_id, uint32 *server_id, uint64 *seq_no,
+ uchar *flags2, const Format_description_log_event *fdev)
+{
+ const char *p;
+
+ if (checksum_alg == BINLOG_CHECKSUM_ALG_CRC32)
+ {
+ if (event_len > BINLOG_CHECKSUM_LEN)
+ event_len-= BINLOG_CHECKSUM_LEN;
+ else
+ event_len= 0;
+ }
+ else
+ DBUG_ASSERT(checksum_alg == BINLOG_CHECKSUM_ALG_UNDEF ||
+ checksum_alg == BINLOG_CHECKSUM_ALG_OFF);
+
+ if (event_len < (uint32)fdev->common_header_len + GTID_HEADER_LEN)
+ return true;
+ *server_id= uint4korr(event_start + SERVER_ID_OFFSET);
+ p= event_start + fdev->common_header_len;
+ *seq_no= uint8korr(p);
+ p+= 8;
+ *domain_id= uint4korr(p);
+ p+= 4;
+ *flags2= (uchar)*p;
+ return false;
+}
+
+
+bool
+Gtid_log_event::write()
+{
+ uchar buf[GTID_HEADER_LEN+2];
+ size_t write_len;
+
+ int8store(buf, seq_no);
+ int4store(buf+8, domain_id);
+ buf[12]= flags2;
+ if (flags2 & FL_GROUP_COMMIT_ID)
+ {
+ int8store(buf+13, commit_id);
+ write_len= GTID_HEADER_LEN + 2;
+ }
+ else
+ {
+ bzero(buf+13, GTID_HEADER_LEN-13);
+ write_len= GTID_HEADER_LEN;
+ }
+ return write_header(write_len) ||
+ write_data(buf, write_len) ||
+ write_footer();
+}
+
+
+/*
+ Replace a GTID event with either a BEGIN event, dummy event, or nothing, as
+ appropriate to work with old slave that does not know global transaction id.
+
+ The need_dummy_event argument is an IN/OUT argument. It is passed as TRUE
+ if slave has capability lower than MARIA_SLAVE_CAPABILITY_TOLERATE_HOLES.
+ It is returned TRUE if we return a BEGIN (or dummy) event to be sent to the
+ slave, FALSE if event should be skipped completely.
+*/
+int
+Gtid_log_event::make_compatible_event(String *packet, bool *need_dummy_event,
+ ulong ev_offset,
+ enum enum_binlog_checksum_alg checksum_alg)
+{
+ uchar flags2;
+ if (packet->length() - ev_offset < LOG_EVENT_HEADER_LEN + GTID_HEADER_LEN)
+ return 1;
+ flags2= (*packet)[ev_offset + LOG_EVENT_HEADER_LEN + 12];
+ if (flags2 & FL_STANDALONE)
+ {
+ if (*need_dummy_event)
+ return Query_log_event::dummy_event(packet, ev_offset, checksum_alg);
+ return 0;
+ }
+
+ *need_dummy_event= true;
+ return Query_log_event::begin_event(packet, ev_offset, checksum_alg);
+}
+
+
+#ifdef HAVE_REPLICATION
+void
+Gtid_log_event::pack_info(Protocol *protocol)
+{
+ char buf[6+5+10+1+10+1+20+1+4+20+1];
+ char *p;
+ p = strmov(buf, (flags2 & FL_STANDALONE ? "GTID " : "BEGIN GTID "));
+ p= longlong10_to_str(domain_id, p, 10);
+ *p++= '-';
+ p= longlong10_to_str(server_id, p, 10);
+ *p++= '-';
+ p= longlong10_to_str(seq_no, p, 10);
+ if (flags2 & FL_GROUP_COMMIT_ID)
+ {
+ p= strmov(p, " cid=");
+ p= longlong10_to_str(commit_id, p, 10);
+ }
+
+ protocol->store(buf, p-buf, &my_charset_bin);
+}
+
+static char gtid_begin_string[] = "BEGIN";
+
+int
+Gtid_log_event::do_apply_event(rpl_group_info *rgi)
+{
+ ulonglong bits= thd->variables.option_bits;
+ thd->variables.server_id= this->server_id;
+ thd->variables.gtid_domain_id= this->domain_id;
+ thd->variables.gtid_seq_no= this->seq_no;
+ rgi->gtid_ev_flags2= flags2;
+ thd->reset_for_next_command();
+
+ if (opt_gtid_strict_mode && opt_bin_log && opt_log_slave_updates)
+ {
+ if (mysql_bin_log.check_strict_gtid_sequence(this->domain_id,
+ this->server_id, this->seq_no))
+ return 1;
+ }
+
+ DBUG_ASSERT((bits & OPTION_GTID_BEGIN) == 0);
+
+ Master_info *mi=rgi->rli->mi;
+ switch (flags2 & (FL_DDL | FL_TRANSACTIONAL))
+ {
+ case FL_TRANSACTIONAL:
+ mi->total_trans_groups++;
+ break;
+ case FL_DDL:
+ mi->total_ddl_groups++;
+ break;
+ default:
+ mi->total_non_trans_groups++;
+ }
+
+ if (flags2 & FL_STANDALONE)
+ return 0;
+
+ /* Execute this like a BEGIN query event. */
+ bits|= OPTION_GTID_BEGIN;
+ if (flags2 & FL_ALLOW_PARALLEL)
+ bits&= ~(ulonglong)OPTION_RPL_SKIP_PARALLEL;
+ else
+ bits|= (ulonglong)OPTION_RPL_SKIP_PARALLEL;
+ thd->variables.option_bits= bits;
+ DBUG_PRINT("info", ("Set OPTION_GTID_BEGIN"));
+ thd->set_query_and_id(gtid_begin_string, sizeof(gtid_begin_string)-1,
+ &my_charset_bin, next_query_id());
+ thd->lex->sql_command= SQLCOM_BEGIN;
+ thd->is_slave_error= 0;
+ status_var_increment(thd->status_var.com_stat[thd->lex->sql_command]);
+ if (trans_begin(thd, 0))
+ {
+ DBUG_PRINT("error", ("trans_begin() failed"));
+ thd->is_slave_error= 1;
+ }
+ thd->update_stats();
+
+ if (likely(!thd->is_slave_error))
+ general_log_write(thd, COM_QUERY, thd->query(), thd->query_length());
+
+ thd->reset_query();
+ free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
+ return thd->is_slave_error;
+}
+
+
+int
+Gtid_log_event::do_update_pos(rpl_group_info *rgi)
+{
+ rgi->inc_event_relay_log_pos();
+ return 0;
+}
+
+
+Log_event::enum_skip_reason
+Gtid_log_event::do_shall_skip(rpl_group_info *rgi)
+{
+ Relay_log_info *rli= rgi->rli;
+ /*
+ An event skipped due to @@skip_replication must not be counted towards the
+ number of events to be skipped due to @@sql_slave_skip_counter.
+ */
+ if (flags & LOG_EVENT_SKIP_REPLICATION_F &&
+ opt_replicate_events_marked_for_skip != RPL_SKIP_REPLICATE)
+ return Log_event::EVENT_SKIP_IGNORE;
+
+ if (rli->slave_skip_counter > 0)
+ {
+ if (!(flags2 & FL_STANDALONE))
+ {
+ thd->variables.option_bits|= OPTION_BEGIN;
+ DBUG_ASSERT(rgi->rli->get_flag(Relay_log_info::IN_TRANSACTION));
+ }
+ return Log_event::continue_group(rgi);
+ }
+ return Log_event::do_shall_skip(rgi);
+}
+
+
+#endif /* HAVE_REPLICATION */
+
+
+
+Gtid_list_log_event::Gtid_list_log_event(rpl_binlog_state *gtid_set,
+ uint32 gl_flags_)
+ : count(gtid_set->count()), gl_flags(gl_flags_), list(0), sub_id_list(0)
+{
+ cache_type= EVENT_NO_CACHE;
+ /* Failure to allocate memory will be caught by is_valid() returning false. */
+ if (count < (1<<28) &&
+ (list = (rpl_gtid *)my_malloc(count * sizeof(*list) + (count == 0),
+ MYF(MY_WME))))
+ gtid_set->get_gtid_list(list, count);
+}
+
+
+Gtid_list_log_event::Gtid_list_log_event(slave_connection_state *gtid_set,
+ uint32 gl_flags_)
+ : count(gtid_set->count()), gl_flags(gl_flags_), list(0), sub_id_list(0)
+{
+ cache_type= EVENT_NO_CACHE;
+ /* Failure to allocate memory will be caught by is_valid() returning false. */
+ if (count < (1<<28) &&
+ (list = (rpl_gtid *)my_malloc(count * sizeof(*list) + (count == 0),
+ MYF(MY_WME))))
+ {
+ gtid_set->get_gtid_list(list, count);
+#if defined(HAVE_REPLICATION)
+ if (gl_flags & FLAG_IGN_GTIDS)
+ {
+ uint32 i;
+
+ if (!(sub_id_list= (uint64 *)my_malloc(count * sizeof(uint64),
+ MYF(MY_WME))))
+ {
+ my_free(list);
+ list= NULL;
+ return;
+ }
+ for (i= 0; i < count; ++i)
+ {
+ if (!(sub_id_list[i]=
+ rpl_global_gtid_slave_state->next_sub_id(list[i].domain_id)))
+ {
+ my_free(list);
+ my_free(sub_id_list);
+ list= NULL;
+ sub_id_list= NULL;
+ return;
+ }
+ }
+ }
+#endif
+ }
+}
+
+
+#if defined(HAVE_REPLICATION)
+bool
+Gtid_list_log_event::to_packet(String *packet)
+{
+ uint32 i;
+ uchar *p;
+ uint32 needed_length;
+
+ DBUG_ASSERT(count < 1<<28);
+
+ needed_length= packet->length() + get_data_size();
+ if (packet->reserve(needed_length))
+ return true;
+ p= (uchar *)packet->ptr() + packet->length();;
+ packet->length(needed_length);
+ int4store(p, (count & ((1<<28)-1)) | gl_flags);
+ p += 4;
+ /* Initialise the padding for empty Gtid_list. */
+ if (count == 0)
+ int2store(p, 0);
+ for (i= 0; i < count; ++i)
+ {
+ int4store(p, list[i].domain_id);
+ int4store(p+4, list[i].server_id);
+ int8store(p+8, list[i].seq_no);
+ p += 16;
+ }
+
+ return false;
+}
+
+
+bool
+Gtid_list_log_event::write()
+{
+ char buf[128];
+ String packet(buf, sizeof(buf), system_charset_info);
+
+ packet.length(0);
+ if (to_packet(&packet))
+ return true;
+ return write_header(get_data_size()) ||
+ write_data(packet.ptr(), packet.length()) ||
+ write_footer();
+}
+
+
+int
+Gtid_list_log_event::do_apply_event(rpl_group_info *rgi)
+{
+ Relay_log_info *rli= const_cast<Relay_log_info*>(rgi->rli);
+ int ret;
+ if (gl_flags & FLAG_IGN_GTIDS)
+ {
+ void *hton= NULL;
+ uint32 i;
+
+ for (i= 0; i < count; ++i)
+ {
+ if ((ret= rpl_global_gtid_slave_state->record_gtid(thd, &list[i],
+ sub_id_list[i],
+ false, false, &hton)))
+ return ret;
+ rpl_global_gtid_slave_state->update_state_hash(sub_id_list[i], &list[i],
+ hton, NULL);
+ }
+ }
+ ret= Log_event::do_apply_event(rgi);
+ if (rli->until_condition == Relay_log_info::UNTIL_GTID &&
+ (gl_flags & FLAG_UNTIL_REACHED))
+ {
+ char str_buf[128];
+ String str(str_buf, sizeof(str_buf), system_charset_info);
+ rli->until_gtid_pos.to_string(&str);
+ sql_print_information("Slave SQL thread stops because it reached its"
+ " UNTIL master_gtid_pos %s", str.c_ptr_safe());
+ rli->abort_slave= true;
+ rli->stop_for_until= true;
+ }
+ free_root(thd->mem_root, MYF(MY_KEEP_PREALLOC));
+ return ret;
+}
+
+
+Log_event::enum_skip_reason
+Gtid_list_log_event::do_shall_skip(rpl_group_info *rgi)
+{
+ enum_skip_reason reason= Log_event::do_shall_skip(rgi);
+ if (reason == EVENT_SKIP_COUNT)
+ reason= EVENT_SKIP_NOT;
+ return reason;
+}
+
+
+void
+Gtid_list_log_event::pack_info(Protocol *protocol)
+{
+ char buf_mem[1024];
+ String buf(buf_mem, sizeof(buf_mem), system_charset_info);
+ uint32 i;
+ bool first;
+
+ buf.length(0);
+ buf.append(STRING_WITH_LEN("["));
+ first= true;
+ for (i= 0; i < count; ++i)
+ rpl_slave_state_tostring_helper(&buf, &list[i], &first);
+ buf.append(STRING_WITH_LEN("]"));
+
+ protocol->store(&buf);
+}
+#endif /* HAVE_REPLICATION */
+
+
+
+/**************************************************************************
+ Intvar_log_event methods
+**************************************************************************/
+
+#if defined(HAVE_REPLICATION)
+void Intvar_log_event::pack_info(Protocol *protocol)
+{
+ char buf[256], *pos;
+ pos= strmake(buf, get_var_type_name(), sizeof(buf)-23);
+ *pos++= '=';
+ pos= longlong10_to_str(val, pos, -10);
+ protocol->store(buf, (uint) (pos-buf), &my_charset_bin);
+}
+#endif
+
+
+bool Intvar_log_event::write()
+{
+ uchar buf[9];
+ buf[I_TYPE_OFFSET]= (uchar) type;
+ int8store(buf + I_VAL_OFFSET, val);
+ return write_header(sizeof(buf)) ||
+ write_data(buf, sizeof(buf)) ||
+ write_footer();
+}
+
+
+#if defined(HAVE_REPLICATION)
+
+/*
+ Intvar_log_event::do_apply_event()
+*/
+
+int Intvar_log_event::do_apply_event(rpl_group_info *rgi)
+{
+ DBUG_ENTER("Intvar_log_event::do_apply_event");
+ if (rgi->deferred_events_collecting)
+ {
+ DBUG_PRINT("info",("deferring event"));
+ DBUG_RETURN(rgi->deferred_events->add(this));
+ }
+
+ switch (type) {
+ case LAST_INSERT_ID_EVENT:
+ thd->first_successful_insert_id_in_prev_stmt= val;
+ DBUG_PRINT("info",("last_insert_id_event: %ld", (long) val));
+ break;
+ case INSERT_ID_EVENT:
+ thd->force_one_auto_inc_interval(val);
+ break;
+ }
+ DBUG_RETURN(0);
+}
+
+int Intvar_log_event::do_update_pos(rpl_group_info *rgi)
+{
+ rgi->inc_event_relay_log_pos();
+ return 0;
+}
+
+
+Log_event::enum_skip_reason
+Intvar_log_event::do_shall_skip(rpl_group_info *rgi)
+{
+ /*
+ It is a common error to set the slave skip counter to 1 instead of
+ 2 when recovering from an insert which used a auto increment,
+ rand, or user var. Therefore, if the slave skip counter is 1, we
+ just say that this event should be skipped by ignoring it, meaning
+ that we do not change the value of the slave skip counter since it
+ will be decreased by the following insert event.
+ */
+ return continue_group(rgi);
+}
+
+#endif
+
+
+/**************************************************************************
+ Rand_log_event methods
+**************************************************************************/
+
+#if defined(HAVE_REPLICATION)
+void Rand_log_event::pack_info(Protocol *protocol)
+{
+ char buf1[256], *pos;
+ pos= strmov(buf1,"rand_seed1=");
+ pos= int10_to_str((long) seed1, pos, 10);
+ pos= strmov(pos, ",rand_seed2=");
+ pos= int10_to_str((long) seed2, pos, 10);
+ protocol->store(buf1, (uint) (pos-buf1), &my_charset_bin);
+}
+#endif
+
+
+bool Rand_log_event::write()
+{
+ uchar buf[16];
+ int8store(buf + RAND_SEED1_OFFSET, seed1);
+ int8store(buf + RAND_SEED2_OFFSET, seed2);
+ return write_header(sizeof(buf)) ||
+ write_data(buf, sizeof(buf)) ||
+ write_footer();
+}
+
+
+#if defined(HAVE_REPLICATION)
+int Rand_log_event::do_apply_event(rpl_group_info *rgi)
+{
+ if (rgi->deferred_events_collecting)
+ return rgi->deferred_events->add(this);
+
+ thd->rand.seed1= (ulong) seed1;
+ thd->rand.seed2= (ulong) seed2;
+ return 0;
+}
+
+int Rand_log_event::do_update_pos(rpl_group_info *rgi)
+{
+ rgi->inc_event_relay_log_pos();
+ return 0;
+}
+
+
+Log_event::enum_skip_reason
+Rand_log_event::do_shall_skip(rpl_group_info *rgi)
+{
+ /*
+ It is a common error to set the slave skip counter to 1 instead of
+ 2 when recovering from an insert which used a auto increment,
+ rand, or user var. Therefore, if the slave skip counter is 1, we
+ just say that this event should be skipped by ignoring it, meaning
+ that we do not change the value of the slave skip counter since it
+ will be decreased by the following insert event.
+ */
+ return continue_group(rgi);
+}
+
+/**
+ Exec deferred Int-, Rand- and User- var events prefixing
+ a Query-log-event event.
+
+ @param thd THD handle
+
+ @return false on success, true if a failure in an event applying occurred.
+*/
+bool slave_execute_deferred_events(THD *thd)
+{
+ bool res= false;
+ rpl_group_info *rgi= thd->rgi_slave;
+
+ DBUG_ASSERT(rgi && (!rgi->deferred_events_collecting || rgi->deferred_events));
+
+ if (!rgi->deferred_events_collecting || rgi->deferred_events->is_empty())
+ return res;
+
+ res= rgi->deferred_events->execute(rgi);
+ rgi->deferred_events->rewind();
+
+ return res;
+}
+
+#endif /* HAVE_REPLICATION */
+
+
+/**************************************************************************
+ Xid_log_event methods
+**************************************************************************/
+
+#if defined(HAVE_REPLICATION)
+void Xid_log_event::pack_info(Protocol *protocol)
+{
+ char buf[128], *pos;
+ pos= strmov(buf, "COMMIT /* xid=");
+ pos= longlong10_to_str(xid, pos, 10);
+ pos= strmov(pos, " */");
+ protocol->store(buf, (uint) (pos-buf), &my_charset_bin);
+}
+#endif
+
+
+bool Xid_log_event::write()
+{
+ DBUG_EXECUTE_IF("do_not_write_xid", return 0;);
+ return write_header(sizeof(xid)) ||
+ write_data((uchar*)&xid, sizeof(xid)) ||
+ write_footer();
+}
+
+
+#if defined(HAVE_REPLICATION)
+int Xid_log_event::do_apply_event(rpl_group_info *rgi)
+{
+ bool res;
+ int err;
+ rpl_gtid gtid;
+ uint64 sub_id= 0;
+ Relay_log_info const *rli= rgi->rli;
+ void *hton= NULL;
+
+ /*
+ XID_EVENT works like a COMMIT statement. And it also updates the
+ mysql.gtid_slave_pos table with the GTID of the current transaction.
+
+ Therefore, it acts much like a normal SQL statement, so we need to do
+ THD::reset_for_next_command() as if starting a new statement.
+ */
+ thd->reset_for_next_command();
+ /*
+ Record any GTID in the same transaction, so slave state is transactionally
+ consistent.
+ */
+#ifdef WITH_WSREP
+ thd->wsrep_affected_rows= 0;
+#endif
+
+ if (rgi->gtid_pending)
+ {
+ sub_id= rgi->gtid_sub_id;
+ rgi->gtid_pending= false;
+
+ gtid= rgi->current_gtid;
+ err= rpl_global_gtid_slave_state->record_gtid(thd, &gtid, sub_id, true,
+ false, &hton);
+ if (unlikely(err))
+ {
+ int ec= thd->get_stmt_da()->sql_errno();
+ /*
+ Do not report an error if this is really a kill due to a deadlock.
+ In this case, the transaction will be re-tried instead.
+ */
+ if (!is_parallel_retry_error(rgi, ec))
+ rli->report(ERROR_LEVEL, ER_CANNOT_UPDATE_GTID_STATE, rgi->gtid_info(),
+ "Error during XID COMMIT: failed to update GTID state in "
+ "%s.%s: %d: %s",
+ "mysql", rpl_gtid_slave_state_table_name.str, ec,
+ thd->get_stmt_da()->message());
+ thd->is_slave_error= 1;
+ return err;
+ }
+
+ DBUG_EXECUTE_IF("gtid_fail_after_record_gtid",
+ { my_error(ER_ERROR_DURING_COMMIT, MYF(0), HA_ERR_WRONG_COMMAND);
+ thd->is_slave_error= 1;
+ return 1;
+ });
+ }
+
+ /* For a slave Xid_log_event is COMMIT */
+ general_log_print(thd, COM_QUERY,
+ "COMMIT /* implicit, from Xid_log_event */");
+ thd->variables.option_bits&= ~OPTION_GTID_BEGIN;
+ res= trans_commit(thd); /* Automatically rolls back on error. */
+ thd->mdl_context.release_transactional_locks();
+
+ if (likely(!res) && sub_id)
+ rpl_global_gtid_slave_state->update_state_hash(sub_id, &gtid, hton, rgi);
+
+ /*
+ Increment the global status commit count variable
+ */
+ status_var_increment(thd->status_var.com_stat[SQLCOM_COMMIT]);
+
+ return res;
+}
+
+Log_event::enum_skip_reason
+Xid_log_event::do_shall_skip(rpl_group_info *rgi)
+{
+ DBUG_ENTER("Xid_log_event::do_shall_skip");
+ if (rgi->rli->slave_skip_counter > 0)
+ {
+ DBUG_ASSERT(!rgi->rli->get_flag(Relay_log_info::IN_TRANSACTION));
+ thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_GTID_BEGIN);
+ DBUG_RETURN(Log_event::EVENT_SKIP_COUNT);
+ }
+#ifdef WITH_WSREP
+ else if (wsrep_mysql_replication_bundle && WSREP_ON &&
+ opt_slave_domain_parallel_threads == 0)
+ {
+ if (++thd->wsrep_mysql_replicated < (int)wsrep_mysql_replication_bundle)
+ {
+ WSREP_DEBUG("skipping wsrep commit %d", thd->wsrep_mysql_replicated);
+ DBUG_RETURN(Log_event::EVENT_SKIP_IGNORE);
+ }
+ else
+ {
+ thd->wsrep_mysql_replicated = 0;
+ }
+ }
+#endif
+ DBUG_RETURN(Log_event::do_shall_skip(rgi));
+}
+#endif // HAVE_REPLICATION
+
+
+/**************************************************************************
+ User_var_log_event methods
+**************************************************************************/
+
+#if defined(HAVE_REPLICATION)
+static bool
+user_var_append_name_part(THD *thd, String *buf,
+ const char *name, size_t name_len)
+{
+ return buf->append("@") ||
+ append_identifier(thd, buf, name, name_len) ||
+ buf->append("=");
+}
+
+void User_var_log_event::pack_info(Protocol* protocol)
+{
+ if (is_null)
+ {
+ char buf_mem[FN_REFLEN+7];
+ String buf(buf_mem, sizeof(buf_mem), system_charset_info);
+ buf.length(0);
+ if (user_var_append_name_part(protocol->thd, &buf, name, name_len) ||
+ buf.append("NULL"))
+ return;
+ protocol->store(buf.ptr(), buf.length(), &my_charset_bin);
+ }
+ else
+ {
+ switch (type) {
+ case REAL_RESULT:
+ {
+ double real_val;
+ char buf2[MY_GCVT_MAX_FIELD_WIDTH+1];
+ char buf_mem[FN_REFLEN + MY_GCVT_MAX_FIELD_WIDTH + 1];
+ String buf(buf_mem, sizeof(buf_mem), system_charset_info);
+ float8get(real_val, val);
+ buf.length(0);
+ if (user_var_append_name_part(protocol->thd, &buf, name, name_len) ||
+ buf.append(buf2, my_gcvt(real_val, MY_GCVT_ARG_DOUBLE,
+ MY_GCVT_MAX_FIELD_WIDTH, buf2, NULL)))
+ return;
+ protocol->store(buf.ptr(), buf.length(), &my_charset_bin);
+ break;
+ }
+ case INT_RESULT:
+ {
+ char buf2[22];
+ char buf_mem[FN_REFLEN + 22];
+ String buf(buf_mem, sizeof(buf_mem), system_charset_info);
+ buf.length(0);
+ if (user_var_append_name_part(protocol->thd, &buf, name, name_len) ||
+ buf.append(buf2,
+ longlong10_to_str(uint8korr(val), buf2,
+ ((flags & User_var_log_event::UNSIGNED_F) ? 10 : -10))-buf2))
+ return;
+ protocol->store(buf.ptr(), buf.length(), &my_charset_bin);
+ break;
+ }
+ case DECIMAL_RESULT:
+ {
+ char buf_mem[FN_REFLEN + DECIMAL_MAX_STR_LENGTH];
+ String buf(buf_mem, sizeof(buf_mem), system_charset_info);
+ char buf2[DECIMAL_MAX_STR_LENGTH+1];
+ String str(buf2, sizeof(buf2), &my_charset_bin);
+ buf.length(0);
+ my_decimal((const uchar *) (val + 2), val[0], val[1]).to_string(&str);
+ if (user_var_append_name_part(protocol->thd, &buf, name, name_len) ||
+ buf.append(buf2))
+ return;
+ protocol->store(buf.ptr(), buf.length(), &my_charset_bin);
+ break;
+ }
+ case STRING_RESULT:
+ {
+ /* 15 is for 'COLLATE' and other chars */
+ char buf_mem[FN_REFLEN + 512 + 1 + 2*MY_CS_NAME_SIZE+15];
+ String buf(buf_mem, sizeof(buf_mem), system_charset_info);
+ CHARSET_INFO *cs;
+ buf.length(0);
+ if (!(cs= get_charset(charset_number, MYF(0))))
+ {
+ if (buf.append("???"))
+ return;
+ }
+ else
+ {
+ size_t old_len;
+ char *beg, *end;
+ if (user_var_append_name_part(protocol->thd, &buf, name, name_len) ||
+ buf.append("_") ||
+ buf.append(cs->csname) ||
+ buf.append(" "))
+ return;
+ old_len= buf.length();
+ if (buf.reserve(old_len + val_len * 2 + 3 + sizeof(" COLLATE ") +
+ MY_CS_NAME_SIZE))
+ return;
+ beg= const_cast<char *>(buf.ptr()) + old_len;
+ end= str_to_hex(beg, val, val_len);
+ buf.length(old_len + (end - beg));
+ if (buf.append(" COLLATE ") ||
+ buf.append(cs->name))
+ return;
+ }
+ protocol->store(buf.ptr(), buf.length(), &my_charset_bin);
+ break;
+ }
+ case ROW_RESULT:
+ default:
+ DBUG_ASSERT(0);
+ return;
+ }
+ }
+}
+#endif // HAVE_REPLICATION
+
+
+bool User_var_log_event::write()
+{
+ char buf[UV_NAME_LEN_SIZE];
+ char buf1[UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE +
+ UV_CHARSET_NUMBER_SIZE + UV_VAL_LEN_SIZE];
+ uchar buf2[MY_MAX(8, DECIMAL_MAX_FIELD_SIZE + 2)], *pos= buf2;
+ uint unsigned_len= 0;
+ uint buf1_length;
+ size_t event_length;
+
+ int4store(buf, name_len);
+
+ if ((buf1[0]= is_null))
+ {
+ buf1_length= 1;
+ val_len= 0; // Length of 'pos'
+ }
+ else
+ {
+ buf1[1]= type;
+ int4store(buf1 + 2, charset_number);
+
+ switch (type) {
+ case REAL_RESULT:
+ float8store(buf2, *(double*) val);
+ break;
+ case INT_RESULT:
+ int8store(buf2, *(longlong*) val);
+ unsigned_len= 1;
+ break;
+ case DECIMAL_RESULT:
+ {
+ my_decimal *dec= (my_decimal *)val;
+ dec->fix_buffer_pointer();
+ buf2[0]= (char)(dec->intg + dec->frac);
+ buf2[1]= (char)dec->frac;
+ decimal2bin((decimal_t*)val, buf2+2, buf2[0], buf2[1]);
+ val_len= decimal_bin_size(buf2[0], buf2[1]) + 2;
+ break;
+ }
+ case STRING_RESULT:
+ pos= (uchar*) val;
+ break;
+ case ROW_RESULT:
+ default:
+ DBUG_ASSERT(0);
+ return 0;
+ }
+ int4store(buf1 + 2 + UV_CHARSET_NUMBER_SIZE, val_len);
+ buf1_length= 10;
+ }
+
+ /* Length of the whole event */
+ event_length= sizeof(buf)+ name_len + buf1_length + val_len + unsigned_len;
+
+ 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();
+}
+
+
+#if defined(HAVE_REPLICATION)
+int User_var_log_event::do_apply_event(rpl_group_info *rgi)
+{
+ Item *it= 0;
+ CHARSET_INFO *charset;
+ DBUG_ENTER("User_var_log_event::do_apply_event");
+ query_id_t sav_query_id= 0; /* memorize orig id when deferred applying */
+
+ if (rgi->deferred_events_collecting)
+ {
+ set_deferred(current_thd->query_id);
+ DBUG_RETURN(rgi->deferred_events->add(this));
+ }
+ else if (is_deferred())
+ {
+ sav_query_id= current_thd->query_id;
+ current_thd->query_id= query_id; /* recreating original time context */
+ }
+
+ if (!(charset= get_charset(charset_number, MYF(MY_WME))))
+ {
+ rgi->rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
+ ER_THD(thd, ER_SLAVE_FATAL_ERROR),
+ "Invalid character set for User var event");
+ DBUG_RETURN(1);
+ }
+ LEX_CSTRING user_var_name;
+ user_var_name.str= name;
+ user_var_name.length= name_len;
+ double real_val;
+ longlong int_val;
+
+ if (is_null)
+ {
+ it= new (thd->mem_root) Item_null(thd);
+ }
+ else
+ {
+ switch (type) {
+ case REAL_RESULT:
+ if (val_len != 8)
+ {
+ rgi->rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
+ ER_THD(thd, ER_SLAVE_FATAL_ERROR),
+ "Invalid variable length at User var event");
+ return 1;
+ }
+ float8get(real_val, val);
+ 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:
+ if (val_len != 8)
+ {
+ rgi->rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
+ ER_THD(thd, ER_SLAVE_FATAL_ERROR),
+ "Invalid variable length at User var event");
+ return 1;
+ }
+ int_val= (longlong) uint8korr(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:
+ {
+ if (val_len < 3)
+ {
+ rgi->rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
+ ER_THD(thd, ER_SLAVE_FATAL_ERROR),
+ "Invalid variable length at User var event");
+ return 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 (thd->mem_root) Item_string(thd, val, (uint)val_len, charset);
+ break;
+ case ROW_RESULT:
+ default:
+ DBUG_ASSERT(0);
+ DBUG_RETURN(0);
+ }
+ }
+
+ 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)
+
+ Fix_fields() can fail, in which case a call of update_hash() might
+ crash the server, so if fix fields fails, we just return with an
+ error.
+ */
+ if (e->fix_fields(thd, 0))
+ DBUG_RETURN(1);
+
+ /*
+ A variable can just be considered as a table with
+ a single record and with a single column. Thus, like
+ a column value, it could always have IMPLICIT derivation.
+ */
+ e->update_hash((void*) val, val_len, type, charset,
+ (flags & User_var_log_event::UNSIGNED_F));
+ if (!is_deferred())
+ free_root(thd->mem_root, 0);
+ else
+ current_thd->query_id= sav_query_id; /* restore current query's context */
+
+ DBUG_RETURN(0);
+}
+
+int User_var_log_event::do_update_pos(rpl_group_info *rgi)
+{
+ rgi->inc_event_relay_log_pos();
+ return 0;
+}
+
+Log_event::enum_skip_reason
+User_var_log_event::do_shall_skip(rpl_group_info *rgi)
+{
+ /*
+ It is a common error to set the slave skip counter to 1 instead
+ of 2 when recovering from an insert which used a auto increment,
+ rand, or user var. Therefore, if the slave skip counter is 1, we
+ just say that this event should be skipped by ignoring it, meaning
+ that we do not change the value of the slave skip counter since it
+ will be decreased by the following insert event.
+ */
+ return continue_group(rgi);
+}
+#endif // HAVE_REPLICATION
+
+
+#ifdef HAVE_REPLICATION
+
+/**************************************************************************
+ Stop_log_event methods
+**************************************************************************/
+
+/*
+ The master stopped. We used to clean up all temporary tables but
+ this is useless as, as the master has shut down properly, it has
+ written all DROP TEMPORARY TABLE (prepared statements' deletion is
+ TODO only when we binlog prep stmts). We used to clean up
+ slave_load_tmpdir, but this is useless as it has been cleared at the
+ end of LOAD DATA INFILE. So we have nothing to do here. The place
+ were we must do this cleaning is in
+ Start_log_event_v3::do_apply_event(), not here. Because if we come
+ here, the master was sane.
+
+ This must only be called from the Slave SQL thread, since it calls
+ Relay_log_info::flush().
+*/
+
+int Stop_log_event::do_update_pos(rpl_group_info *rgi)
+{
+ int error= 0;
+ Relay_log_info *rli= rgi->rli;
+ DBUG_ENTER("Stop_log_event::do_update_pos");
+ /*
+ We do not want to update master_log pos because we get a rotate event
+ before stop, so by now group_master_log_name is set to the next log.
+ If we updated it, we will have incorrect master coordinates and this
+ could give false triggers in MASTER_POS_WAIT() that we have reached
+ the target position when in fact we have not.
+ */
+ if (rli->get_flag(Relay_log_info::IN_TRANSACTION))
+ rgi->inc_event_relay_log_pos();
+ else if (!rgi->is_parallel_exec)
+ {
+ rpl_global_gtid_slave_state->record_and_update_gtid(thd, rgi);
+ rli->inc_group_relay_log_pos(0, rgi);
+ if (rli->flush())
+ error= 1;
+ }
+ DBUG_RETURN(error);
+}
+
+#endif /* HAVE_REPLICATION */
+
+
+/**************************************************************************
+ Create_file_log_event methods
+**************************************************************************/
+
+Create_file_log_event::
+Create_file_log_event(THD* thd_arg, sql_exchange* ex,
+ const char* db_arg, const char* table_name_arg,
+ List<Item>& fields_arg,
+ bool is_concurrent_arg,
+ enum enum_duplicates handle_dup,
+ bool ignore,
+ uchar* block_arg, uint block_len_arg, bool using_trans)
+ :Load_log_event(thd_arg, ex, db_arg, table_name_arg, fields_arg,
+ is_concurrent_arg,
+ handle_dup, ignore, using_trans),
+ fake_base(0), block(block_arg), event_buf(0), block_len(block_len_arg),
+ file_id(thd_arg->file_id = mysql_bin_log.next_file_id())
+{
+ DBUG_ENTER("Create_file_log_event");
+ sql_ex.force_new_format();
+ DBUG_VOID_RETURN;
+}
+
+
+/*
+ Create_file_log_event::write_data_body()
+*/
+
+bool Create_file_log_event::write_data_body()
+{
+ bool res;
+ if ((res= Load_log_event::write_data_body()) || fake_base)
+ return res;
+ return write_data("", 1) ||
+ write_data(block, block_len);
+}
+
+
+/*
+ Create_file_log_event::write_data_header()
+*/
+
+bool Create_file_log_event::write_data_header()
+{
+ bool res;
+ uchar buf[CREATE_FILE_HEADER_LEN];
+ if ((res= Load_log_event::write_data_header()) || fake_base)
+ return res;
+ int4store(buf + CF_FILE_ID_OFFSET, file_id);
+ return write_data(buf, CREATE_FILE_HEADER_LEN) != 0;
+}
+
+
+/*
+ Create_file_log_event::write_base()
+*/
+
+bool Create_file_log_event::write_base()
+{
+ bool res;
+ fake_base= 1; // pretend we are Load event
+ res= write();
+ fake_base= 0;
+ return res;
+}
+
+
+#if defined(HAVE_REPLICATION)
+void Create_file_log_event::pack_info(Protocol *protocol)
+{
+ char buf[SAFE_NAME_LEN*2 + 30 + 21*2], *pos;
+ pos= strmov(buf, "db=");
+ memcpy(pos, db, db_len);
+ pos= strmov(pos + db_len, ";table=");
+ memcpy(pos, table_name, table_name_len);
+ pos= strmov(pos + table_name_len, ";file_id=");
+ pos= int10_to_str((long) file_id, pos, 10);
+ pos= strmov(pos, ";block_len=");
+ pos= int10_to_str((long) block_len, pos, 10);
+ protocol->store(buf, (uint) (pos-buf), &my_charset_bin);
+}
+#endif /* defined(HAVE_REPLICATION) */
+
+
+/**
+ Create_file_log_event::do_apply_event()
+ Constructor for Create_file_log_event to intantiate an event
+ from the relay log on the slave.
+
+ @retval
+ 0 Success
+ @retval
+ 1 Failure
+*/
+
+#if defined(HAVE_REPLICATION)
+int Create_file_log_event::do_apply_event(rpl_group_info *rgi)
+{
+ char fname_buf[FN_REFLEN];
+ char *ext;
+ int fd = -1;
+ IO_CACHE file;
+ Log_event_writer lew(&file, 0);
+ int error = 1;
+ Relay_log_info const *rli= rgi->rli;
+
+ THD_STAGE_INFO(thd, stage_making_temp_file_create_before_load_data);
+ bzero((char*)&file, sizeof(file));
+ ext= slave_load_file_stem(fname_buf, file_id, server_id, ".info",
+ &rli->mi->connection_name);
+ /* old copy may exist already */
+ mysql_file_delete(key_file_log_event_info, fname_buf, MYF(0));
+ if ((fd= mysql_file_create(key_file_log_event_info,
+ fname_buf, CREATE_MODE,
+ O_WRONLY | O_BINARY | O_EXCL | O_NOFOLLOW,
+ MYF(MY_WME))) < 0 ||
+ init_io_cache(&file, fd, IO_SIZE, WRITE_CACHE, (my_off_t)0, 0,
+ MYF(MY_WME|MY_NABP)))
+ {
+ rli->report(ERROR_LEVEL, my_errno, rgi->gtid_info(),
+ "Error in Create_file event: could not open file '%s'",
+ fname_buf);
+ goto err;
+ }
+
+ // a trick to avoid allocating another buffer
+ fname= fname_buf;
+ fname_len= (uint) (strmov(ext, ".data") - fname);
+ 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(),
+ "Error in Create_file event: could not write to file '%s'",
+ fname_buf);
+ goto err;
+ }
+ end_io_cache(&file);
+ mysql_file_close(fd, MYF(0));
+
+ // fname_buf now already has .data, not .info, because we did our trick
+ /* old copy may exist already */
+ mysql_file_delete(key_file_log_event_data, fname_buf, MYF(0));
+ if ((fd= mysql_file_create(key_file_log_event_data,
+ fname_buf, CREATE_MODE,
+ O_WRONLY | O_BINARY | O_EXCL | O_NOFOLLOW,
+ MYF(MY_WME))) < 0)
+ {
+ rli->report(ERROR_LEVEL, my_errno, rgi->gtid_info(),
+ "Error in Create_file event: could not open file '%s'",
+ fname_buf);
+ goto err;
+ }
+ if (mysql_file_write(fd, (uchar*) block, block_len, MYF(MY_WME+MY_NABP)))
+ {
+ rli->report(ERROR_LEVEL, my_errno, rgi->gtid_info(),
+ "Error in Create_file event: write to '%s' failed",
+ fname_buf);
+ goto err;
+ }
+ error=0; // Everything is ok
+
+err:
+ if (unlikely(error))
+ end_io_cache(&file);
+ if (likely(fd >= 0))
+ mysql_file_close(fd, MYF(0));
+ return error != 0;
+}
+#endif /* defined(HAVE_REPLICATION) */
+
+
+/**************************************************************************
+ Append_block_log_event methods
+**************************************************************************/
+
+Append_block_log_event::Append_block_log_event(THD *thd_arg,
+ const char *db_arg,
+ uchar *block_arg,
+ uint block_len_arg,
+ bool using_trans)
+ :Log_event(thd_arg,0, using_trans), block(block_arg),
+ block_len(block_len_arg), file_id(thd_arg->file_id), db(db_arg)
+{
+}
+
+
+bool Append_block_log_event::write()
+{
+ uchar buf[APPEND_BLOCK_HEADER_LEN];
+ int4store(buf + AB_FILE_ID_OFFSET, file_id);
+ return write_header(APPEND_BLOCK_HEADER_LEN + block_len) ||
+ write_data(buf, APPEND_BLOCK_HEADER_LEN) ||
+ write_data(block, block_len) ||
+ write_footer();
+}
+
+
+#if defined(HAVE_REPLICATION)
+void Append_block_log_event::pack_info(Protocol *protocol)
+{
+ char buf[256];
+ uint length;
+ length= (uint) sprintf(buf, ";file_id=%u;block_len=%u", file_id, block_len);
+ protocol->store(buf, length, &my_charset_bin);
+}
+
+
+/*
+ Append_block_log_event::get_create_or_append()
+*/
+
+int Append_block_log_event::get_create_or_append() const
+{
+ return 0; /* append to the file, fail if not exists */
+}
+
+/*
+ Append_block_log_event::do_apply_event()
+*/
+
+int Append_block_log_event::do_apply_event(rpl_group_info *rgi)
+{
+ char fname[FN_REFLEN];
+ int fd;
+ int error = 1;
+ Relay_log_info const *rli= rgi->rli;
+ DBUG_ENTER("Append_block_log_event::do_apply_event");
+
+ THD_STAGE_INFO(thd, stage_making_temp_file_append_before_load_data);
+ slave_load_file_stem(fname, file_id, server_id, ".data",
+ &rli->mi->cmp_connection_name);
+ if (get_create_or_append())
+ {
+ /*
+ Usually lex_start() is called by mysql_parse(), but we need it here
+ as the present method does not call mysql_parse().
+ */
+ lex_start(thd);
+ thd->reset_for_next_command();
+ /* old copy may exist already */
+ mysql_file_delete(key_file_log_event_data, fname, MYF(0));
+ if ((fd= mysql_file_create(key_file_log_event_data,
+ fname, CREATE_MODE,
+ O_WRONLY | O_BINARY | O_EXCL | O_NOFOLLOW,
+ MYF(MY_WME))) < 0)
+ {
+ rli->report(ERROR_LEVEL, my_errno, rgi->gtid_info(),
+ "Error in %s event: could not create file '%s'",
+ get_type_str(), fname);
+ goto err;
+ }
+ }
+ else if ((fd= mysql_file_open(key_file_log_event_data,
+ fname,
+ O_WRONLY | O_APPEND | O_BINARY | O_NOFOLLOW,
+ MYF(MY_WME))) < 0)
+ {
+ rli->report(ERROR_LEVEL, my_errno, rgi->gtid_info(),
+ "Error in %s event: could not open file '%s'",
+ get_type_str(), fname);
+ goto err;
+ }
+
+ DBUG_EXECUTE_IF("remove_slave_load_file_before_write",
+ {
+ my_delete(fname, MYF(0));
+ });
+
+ if (mysql_file_write(fd, (uchar*) block, block_len, MYF(MY_WME+MY_NABP)))
+ {
+ rli->report(ERROR_LEVEL, my_errno, rgi->gtid_info(),
+ "Error in %s event: write to '%s' failed",
+ get_type_str(), fname);
+ goto err;
+ }
+ error=0;
+
+err:
+ if (fd >= 0)
+ mysql_file_close(fd, MYF(0));
+ DBUG_RETURN(error);
+}
+#endif // HAVE_REPLICATION
+
+
+/**************************************************************************
+ Delete_file_log_event methods
+**************************************************************************/
+
+Delete_file_log_event::Delete_file_log_event(THD *thd_arg, const char* db_arg,
+ bool using_trans)
+ :Log_event(thd_arg, 0, using_trans), file_id(thd_arg->file_id), db(db_arg)
+{
+}
+
+
+bool Delete_file_log_event::write()
+{
+ uchar buf[DELETE_FILE_HEADER_LEN];
+ int4store(buf + DF_FILE_ID_OFFSET, file_id);
+ return write_header(sizeof(buf)) ||
+ write_data(buf, sizeof(buf)) ||
+ write_footer();
+}
+
+
+#if defined(HAVE_REPLICATION)
+void Delete_file_log_event::pack_info(Protocol *protocol)
+{
+ char buf[64];
+ uint length;
+ length= (uint) sprintf(buf, ";file_id=%u", (uint) file_id);
+ protocol->store(buf, (int32) length, &my_charset_bin);
+}
+#endif
+
+
+#if defined(HAVE_REPLICATION)
+int Delete_file_log_event::do_apply_event(rpl_group_info *rgi)
+{
+ char fname[FN_REFLEN+10];
+ Relay_log_info const *rli= rgi->rli;
+ char *ext= slave_load_file_stem(fname, file_id, server_id, ".data",
+ &rli->mi->cmp_connection_name);
+ mysql_file_delete(key_file_log_event_data, fname, MYF(MY_WME));
+ strmov(ext, ".info");
+ mysql_file_delete(key_file_log_event_info, fname, MYF(MY_WME));
+ return 0;
+}
+#endif /* defined(HAVE_REPLICATION) */
+
+
+/**************************************************************************
+ Execute_load_log_event methods
+**************************************************************************/
+
+Execute_load_log_event::Execute_load_log_event(THD *thd_arg,
+ const char* db_arg,
+ bool using_trans)
+ :Log_event(thd_arg, 0, using_trans), file_id(thd_arg->file_id), db(db_arg)
+{
+}
+
+
+bool Execute_load_log_event::write()
+{
+ uchar buf[EXEC_LOAD_HEADER_LEN];
+ int4store(buf + EL_FILE_ID_OFFSET, file_id);
+ return write_header(sizeof(buf)) ||
+ write_data(buf, sizeof(buf)) ||
+ write_footer();
+}
+
+
+#if defined(HAVE_REPLICATION)
+void Execute_load_log_event::pack_info(Protocol *protocol)
+{
+ char buf[64];
+ uint length;
+ length= (uint) sprintf(buf, ";file_id=%u", (uint) file_id);
+ protocol->store(buf, (int32) length, &my_charset_bin);
+}
+
+
+/*
+ Execute_load_log_event::do_apply_event()
+*/
+
+int Execute_load_log_event::do_apply_event(rpl_group_info *rgi)
+{
+ char fname[FN_REFLEN+10];
+ char *ext;
+ int fd;
+ int error= 1;
+ IO_CACHE file;
+ Load_log_event *lev= 0;
+ Relay_log_info const *rli= rgi->rli;
+
+ ext= slave_load_file_stem(fname, file_id, server_id, ".info",
+ &rli->mi->cmp_connection_name);
+ if ((fd= mysql_file_open(key_file_log_event_info,
+ fname, O_RDONLY | O_BINARY | O_NOFOLLOW,
+ MYF(MY_WME))) < 0 ||
+ init_io_cache(&file, fd, IO_SIZE, READ_CACHE, (my_off_t)0, 0,
+ MYF(MY_WME|MY_NABP)))
+ {
+ rli->report(ERROR_LEVEL, my_errno, rgi->gtid_info(),
+ "Error in Exec_load event: could not open file '%s'",
+ fname);
+ goto err;
+ }
+ if (!(lev= (Load_log_event*)
+ Log_event::read_log_event(&file,
+ rli->relay_log.description_event_for_exec,
+ opt_slave_sql_verify_checksum)) ||
+ lev->get_type_code() != NEW_LOAD_EVENT)
+ {
+ rli->report(ERROR_LEVEL, 0, rgi->gtid_info(), "Error in Exec_load event: "
+ "file '%s' appears corrupted", fname);
+ goto err;
+ }
+ lev->thd = thd;
+ /*
+ lev->do_apply_event should use rli only for errors i.e. should
+ not advance rli's position.
+
+ lev->do_apply_event is the place where the table is loaded (it
+ calls mysql_load()).
+ */
+
+ if (lev->do_apply_event(0,rgi,1))
+ {
+ /*
+ We want to indicate the name of the file that could not be loaded
+ (SQL_LOADxxx).
+ But as we are here we are sure the error is in rli->last_slave_error and
+ rli->last_slave_errno (example of error: duplicate entry for key), so we
+ don't want to overwrite it with the filename.
+ What we want instead is add the filename to the current error message.
+ */
+ char *tmp= my_strdup(rli->last_error().message, MYF(MY_WME));
+ if (tmp)
+ {
+ rli->report(ERROR_LEVEL, rli->last_error().number, rgi->gtid_info(),
+ "%s. Failed executing load from '%s'", tmp, fname);
+ my_free(tmp);
+ }
+ goto err;
+ }
+ /*
+ We have an open file descriptor to the .info file; we need to close it
+ or Windows will refuse to delete the file in mysql_file_delete().
+ */
+ if (fd >= 0)
+ {
+ mysql_file_close(fd, MYF(0));
+ end_io_cache(&file);
+ fd= -1;
+ }
+ mysql_file_delete(key_file_log_event_info, fname, MYF(MY_WME));
+ memcpy(ext, ".data", 6);
+ mysql_file_delete(key_file_log_event_data, fname, MYF(MY_WME));
+ error = 0;
+
+err:
+ delete lev;
+ if (fd >= 0)
+ {
+ mysql_file_close(fd, MYF(0));
+ end_io_cache(&file);
+ }
+ return error;
+}
+
+#endif /* defined(HAVE_REPLICATION) */
+
+/**************************************************************************
+ Begin_load_query_log_event methods
+**************************************************************************/
+
+Begin_load_query_log_event::
+Begin_load_query_log_event(THD* thd_arg, const char* db_arg, uchar* block_arg,
+ uint block_len_arg, bool using_trans)
+ :Append_block_log_event(thd_arg, db_arg, block_arg, block_len_arg,
+ using_trans)
+{
+ file_id= thd_arg->file_id= mysql_bin_log.next_file_id();
+}
+
+
+#if defined( HAVE_REPLICATION)
+int Begin_load_query_log_event::get_create_or_append() const
+{
+ return 1; /* create the file */
+}
+
+
+Log_event::enum_skip_reason
+Begin_load_query_log_event::do_shall_skip(rpl_group_info *rgi)
+{
+ /*
+ If the slave skip counter is 1, then we should not start executing
+ on the next event.
+ */
+ return continue_group(rgi);
+}
+#endif /* defined( HAVE_REPLICATION) */
+
+
+/**************************************************************************
+ Execute_load_query_log_event methods
+**************************************************************************/
+
+Execute_load_query_log_event::
+Execute_load_query_log_event(THD *thd_arg, const char* query_arg,
+ ulong query_length_arg, uint fn_pos_start_arg,
+ uint fn_pos_end_arg,
+ enum_load_dup_handling dup_handling_arg,
+ bool using_trans, bool direct, bool suppress_use,
+ int errcode):
+ Query_log_event(thd_arg, query_arg, query_length_arg, using_trans, direct,
+ suppress_use, errcode),
+ file_id(thd_arg->file_id), fn_pos_start(fn_pos_start_arg),
+ fn_pos_end(fn_pos_end_arg), dup_handling(dup_handling_arg)
+{
+}
+
+
+bool
+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 write_data(buf, EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN);
+}
+
+
+#if defined(HAVE_REPLICATION)
+void Execute_load_query_log_event::pack_info(Protocol *protocol)
+{
+ char buf_mem[1024];
+ String buf(buf_mem, sizeof(buf_mem), system_charset_info);
+ buf.real_alloc(9 + db_len + q_len + 10 + 21);
+ if (db && db_len)
+ {
+ if (buf.append(STRING_WITH_LEN("use ")) ||
+ append_identifier(protocol->thd, &buf, db, db_len) ||
+ buf.append(STRING_WITH_LEN("; ")))
+ return;
+ }
+ if (query && q_len && buf.append(query, q_len))
+ return;
+ if (buf.append(" ;file_id=") ||
+ buf.append_ulonglong(file_id))
+ return;
+ protocol->store(buf.ptr(), buf.length(), &my_charset_bin);
+}
+
+
+int
+Execute_load_query_log_event::do_apply_event(rpl_group_info *rgi)
+{
+ char *p;
+ char *buf;
+ char *fname;
+ char *fname_end;
+ int error;
+ Relay_log_info const *rli= rgi->rli;
+
+ buf= (char*) my_malloc(q_len + 1 - (fn_pos_end - fn_pos_start) +
+ (FN_REFLEN + 10) + 10 + 8 + 5, MYF(MY_WME));
+
+ DBUG_EXECUTE_IF("LOAD_DATA_INFILE_has_fatal_error", my_free(buf); buf= NULL;);
+
+ /* Replace filename and LOCAL keyword in query before executing it */
+ if (buf == NULL)
+ {
+ rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, rgi->gtid_info(),
+ ER_THD(rgi->thd, ER_SLAVE_FATAL_ERROR), "Not enough memory");
+ return 1;
+ }
+
+ p= buf;
+ memcpy(p, query, fn_pos_start);
+ p+= fn_pos_start;
+ fname= (p= strmake(p, STRING_WITH_LEN(" INFILE \'")));
+ p= slave_load_file_stem(p, file_id, server_id, ".data",
+ &rli->mi->cmp_connection_name);
+ fname_end= p= strend(p); // Safer than p=p+5
+ *(p++)='\'';
+ switch (dup_handling) {
+ case LOAD_DUP_IGNORE:
+ p= strmake(p, STRING_WITH_LEN(" IGNORE"));
+ break;
+ case LOAD_DUP_REPLACE:
+ p= strmake(p, STRING_WITH_LEN(" REPLACE"));
+ break;
+ default:
+ /* Ordinary load data */
+ break;
+ }
+ p= strmake(p, STRING_WITH_LEN(" INTO "));
+ p= strmake(p, query+fn_pos_end, q_len-fn_pos_end);
+
+ error= Query_log_event::do_apply_event(rgi, buf, (uint32)(p-buf));
+
+ /* Forging file name for deletion in same buffer */
+ *fname_end= 0;
+
+ /*
+ If there was an error the slave is going to stop, leave the
+ file so that we can re-execute this event at START SLAVE.
+ */
+ if (unlikely(!error))
+ mysql_file_delete(key_file_log_event_data, fname, MYF(MY_WME));
+
+ my_free(buf);
+ return error;
+}
+#endif // HAVE_REPLICATION
+
+
+/**************************************************************************
+ sql_ex_info methods
+**************************************************************************/
+
+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));
+}
+
+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
+**************************************************************************/
+
+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)
+ : Log_event(thd_arg, 0, is_transactional),
+ m_row_count(0),
+ m_table(tbl_arg),
+ m_table_id(tid),
+ m_width(tbl_arg ? tbl_arg->s->fields : 1),
+ m_rows_buf(0), m_rows_cur(0), m_rows_end(0), m_flags(0),
+ m_type(event_type), m_extra_row_data(0)
+#ifdef HAVE_REPLICATION
+ , m_curr_row(NULL), m_curr_row_end(NULL),
+ m_key(NULL), m_key_info(NULL), m_key_nr(0),
+ master_had_triggers(0)
+#endif
+{
+ /*
+ We allow a special form of dummy event when the table, and cols
+ are null and the table id is ~0UL. This is a temporary
+ solution, to be able to terminate a started statement in the
+ binary log: the extraneous events will be removed in the future.
+ */
+ DBUG_ASSERT((tbl_arg && tbl_arg->s && tid != ~0UL) ||
+ (!tbl_arg && !cols && tid == ~0UL));
+
+ if (thd_arg->variables.option_bits & OPTION_NO_FOREIGN_KEY_CHECKS)
+ set_flags(NO_FOREIGN_KEY_CHECKS_F);
+ if (thd_arg->variables.option_bits & OPTION_RELAXED_UNIQUE_CHECKS)
+ set_flags(RELAXED_UNIQUE_CHECKS_F);
+ if (thd_arg->variables.option_bits & OPTION_NO_CHECK_CONSTRAINT_CHECKS)
+ set_flags(NO_CHECK_CONSTRAINT_CHECKS_F);
+ /* if my_bitmap_init fails, caught in is_valid() */
+ if (likely(!my_bitmap_init(&m_cols,
+ m_width <= sizeof(m_bitbuf)*8 ? m_bitbuf : NULL,
+ m_width,
+ false)))
+ {
+ /* Cols can be zero if this is a dummy binrows event */
+ if (likely(cols != NULL))
+ {
+ memcpy(m_cols.bitmap, cols->bitmap, no_bytes_in_map(cols));
+ create_last_word_mask(&m_cols);
+ }
+ }
+ else
+ {
+ // Needed because my_bitmap_init() does not set it to null on failure
+ m_cols.bitmap= 0;
+ }
+}
+
+
+int Rows_log_event::do_add_row_data(uchar *row_data, size_t length)
+{
+ /*
+ When the table has a primary key, we would probably want, by default, to
+ log only the primary key value instead of the entire "before image". This
+ would save binlog space. TODO
+ */
+ DBUG_ENTER("Rows_log_event::do_add_row_data");
+ DBUG_PRINT("enter", ("row_data:%p length: %lu", 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.
+ */
+#ifndef HAVE_valgrind
+ DBUG_DUMP("row_data", row_data, MY_MIN(length, 32));
+#endif
+
+ DBUG_ASSERT(m_rows_buf <= m_rows_cur);
+ DBUG_ASSERT(!m_rows_buf || (m_rows_end && m_rows_buf < m_rows_end));
+ DBUG_ASSERT(m_rows_cur <= m_rows_end);
+
+ /* The cast will always work since m_rows_cur <= m_rows_end */
+ if (static_cast<size_t>(m_rows_end - m_rows_cur) <= length)
+ {
+ size_t const block_size= 1024;
+ size_t cur_size= m_rows_cur - m_rows_buf;
+ DBUG_EXECUTE_IF("simulate_too_big_row_case1",
+ cur_size= UINT_MAX32 - (block_size * 10);
+ length= UINT_MAX32 - (block_size * 10););
+ DBUG_EXECUTE_IF("simulate_too_big_row_case2",
+ cur_size= UINT_MAX32 - (block_size * 10);
+ length= block_size * 10;);
+ DBUG_EXECUTE_IF("simulate_too_big_row_case3",
+ cur_size= block_size * 10;
+ length= UINT_MAX32 - (block_size * 10););
+ DBUG_EXECUTE_IF("simulate_too_big_row_case4",
+ cur_size= UINT_MAX32 - (block_size * 10);
+ length= (block_size * 10) - block_size + 1;);
+ size_t remaining_space= UINT_MAX32 - cur_size;
+ /* Check that the new data fits within remaining space and we can add
+ block_size without wrapping.
+ */
+ if (cur_size > UINT_MAX32 || length > remaining_space ||
+ ((length + block_size) > remaining_space))
+ {
+ sql_print_error("The row data is greater than 4GB, which is too big to "
+ "write to the binary log.");
+ DBUG_RETURN(ER_BINLOG_ROW_LOGGING_FAILED);
+ }
+ size_t const new_alloc=
+ block_size * ((cur_size + length + block_size - 1) / block_size);
+
+ uchar* const new_buf= (uchar*)my_realloc((uchar*)m_rows_buf, new_alloc,
+ MYF(MY_ALLOW_ZERO_PTR|MY_WME));
+ if (unlikely(!new_buf))
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+
+ /* If the memory moved, we need to move the pointers */
+ if (new_buf != m_rows_buf)
+ {
+ m_rows_buf= new_buf;
+ m_rows_cur= m_rows_buf + cur_size;
+ }
+
+ /*
+ The end pointer should always be changed to point to the end of
+ the allocated memory.
+ */
+ m_rows_end= m_rows_buf + new_alloc;
+ }
+
+ DBUG_ASSERT(m_rows_cur + length <= m_rows_end);
+ memcpy(m_rows_cur, row_data, length);
+ m_rows_cur+= length;
+ m_row_count++;
+ DBUG_RETURN(0);
+}
+
+
+#if defined(HAVE_REPLICATION)
+
+/**
+ Restores empty table list as it was before trigger processing.
+
+ @note We have a lot of ASSERTS that check the lists when we close tables.
+ There was the same problem with MERGE MYISAM tables and so here we try to
+ go the same way.
+*/
+static void restore_empty_query_table_list(LEX *lex)
+{
+ if (lex->first_not_own_table())
+ (*lex->first_not_own_table()->prev_global)= NULL;
+ lex->query_tables= NULL;
+ lex->query_tables_last= &lex->query_tables;
+}
+
+
+int Rows_log_event::do_apply_event(rpl_group_info *rgi)
+{
+ Relay_log_info const *rli= rgi->rli;
+ TABLE* table;
+ DBUG_ENTER("Rows_log_event::do_apply_event(Relay_log_info*)");
+ int error= 0;
+ /*
+ If m_table_id == ~0ULL, then we have a dummy event that does not
+ contain any data. In that case, we just remove all tables in the
+ tables_to_lock list, close the thread tables, and return with
+ success.
+ */
+ if (m_table_id == ~0ULL)
+ {
+ /*
+ This one is supposed to be set: just an extra check so that
+ nothing strange has happened.
+ */
+ DBUG_ASSERT(get_flags(STMT_END_F));
+
+ rgi->slave_close_thread_tables(thd);
+ thd->clear_error();
+ DBUG_RETURN(0);
+ }
+
+ /*
+ 'thd' has been set by exec_relay_log_event(), just before calling
+ do_apply_event(). We still check here to prevent future coding
+ errors.
+ */
+ DBUG_ASSERT(rgi->thd == thd);
+
+ /*
+ If there is no locks taken, this is the first binrow event seen
+ after the table map events. We should then lock all the tables
+ used in the transaction and proceed with execution of the actual
+ event.
+ */
+ if (!thd->lock)
+ {
+ /*
+ Lock_tables() reads the contents of thd->lex, so they must be
+ initialized.
+
+ We also call the THD::reset_for_next_command(), since this
+ is the logical start of the next "statement". Note that this
+ call might reset the value of current_stmt_binlog_format, so
+ we need to do any changes to that value after this function.
+ */
+ delete_explain_query(thd->lex);
+ lex_start(thd);
+ thd->reset_for_next_command();
+ /*
+ The current statement is just about to begin and
+ has not yet modified anything. Note, all.modified is reset
+ by THD::reset_for_next_command().
+ */
+ thd->transaction.stmt.modified_non_trans_table= FALSE;
+ thd->transaction.stmt.m_unsafe_rollback_flags&= ~THD_TRANS::DID_WAIT;
+ /*
+ This is a row injection, so we flag the "statement" as
+ such. Note that this code is called both when the slave does row
+ injections and when the BINLOG statement is used to do row
+ injections.
+ */
+ thd->lex->set_stmt_row_injection();
+
+ /*
+ There are a few flags that are replicated with each row event.
+ Make sure to set/clear them before executing the main body of
+ the event.
+ */
+ if (get_flags(NO_FOREIGN_KEY_CHECKS_F))
+ thd->variables.option_bits|= OPTION_NO_FOREIGN_KEY_CHECKS;
+ else
+ thd->variables.option_bits&= ~OPTION_NO_FOREIGN_KEY_CHECKS;
+
+ if (get_flags(RELAXED_UNIQUE_CHECKS_F))
+ thd->variables.option_bits|= OPTION_RELAXED_UNIQUE_CHECKS;
+ else
+ thd->variables.option_bits&= ~OPTION_RELAXED_UNIQUE_CHECKS;
+
+ if (get_flags(NO_CHECK_CONSTRAINT_CHECKS_F))
+ thd->variables.option_bits|= OPTION_NO_CHECK_CONSTRAINT_CHECKS;
+ else
+ thd->variables.option_bits&= ~OPTION_NO_CHECK_CONSTRAINT_CHECKS;
+
+ /* A small test to verify that objects have consistent types */
+ DBUG_ASSERT(sizeof(thd->variables.option_bits) == sizeof(OPTION_RELAXED_UNIQUE_CHECKS));
+
+ DBUG_EXECUTE_IF("rows_log_event_before_open_table",
+ {
+ const char action[] = "now SIGNAL before_open_table WAIT_FOR go_ahead_sql";
+ DBUG_ASSERT(!debug_sync_set_action(thd, STRING_WITH_LEN(action)));
+ };);
+
+ if (slave_run_triggers_for_rbr)
+ {
+ LEX *lex= thd->lex;
+ uint8 new_trg_event_map= get_trg_event_map();
+
+ /*
+ Trigger's procedures work with global table list. So we have to add
+ rgi->tables_to_lock content there to get trigger's in the list.
+
+ Then restore_empty_query_table_list() restore the list as it was
+ */
+ DBUG_ASSERT(lex->query_tables == NULL);
+ if ((lex->query_tables= rgi->tables_to_lock))
+ rgi->tables_to_lock->prev_global= &lex->query_tables;
+
+ for (TABLE_LIST *tables= rgi->tables_to_lock; tables;
+ tables= tables->next_global)
+ {
+ tables->trg_event_map= new_trg_event_map;
+ lex->query_tables_last= &tables->next_global;
+ }
+ }
+ if (unlikely(open_and_lock_tables(thd, rgi->tables_to_lock, FALSE, 0)))
+ {
+#ifdef WITH_WSREP
+ if (WSREP(thd))
+ {
+ WSREP_WARN("BF applier failed to open_and_lock_tables: %u, fatal: %d "
+ "wsrep = (exec_mode: %d conflict_state: %d seqno: %lld)",
+ thd->get_stmt_da()->sql_errno(),
+ thd->is_fatal_error,
+ thd->wsrep_cs().mode(),
+ thd->wsrep_trx().state(),
+ (long long) wsrep_thd_trx_seqno(thd));
+ }
+#endif /* WITH_WSREP */
+ if (thd->is_error() &&
+ !is_parallel_retry_error(rgi, error= thd->get_stmt_da()->sql_errno()))
+ {
+ /*
+ Error reporting borrowed from Query_log_event with many excessive
+ simplifications.
+ We should not honour --slave-skip-errors at this point as we are
+ having severe errors which should not be skipped.
+ */
+ rli->report(ERROR_LEVEL, error, rgi->gtid_info(),
+ "Error executing row event: '%s'",
+ (error ? thd->get_stmt_da()->message() :
+ "unexpected success or fatal error"));
+ thd->is_slave_error= 1;
+ }
+ /* remove trigger's tables */
+ goto err;
+ }
+
+ /*
+ When the open and locking succeeded, we check all tables to
+ ensure that they still have the correct type.
+ */
+
+ {
+ DBUG_PRINT("debug", ("Checking compability of tables to lock - tables_to_lock: %p",
+ rgi->tables_to_lock));
+
+ /**
+ When using RBR and MyISAM MERGE tables the base tables that make
+ up the MERGE table can be appended to the list of tables to lock.
+
+ Thus, we just check compatibility for those that tables that have
+ a correspondent table map event (ie, those that are actually going
+ to be accessed while applying the event). That's why the loop stops
+ at rli->tables_to_lock_count .
+
+ NOTE: The base tables are added here are removed when
+ close_thread_tables is called.
+ */
+ TABLE_LIST *table_list_ptr= rgi->tables_to_lock;
+ for (uint i=0 ; table_list_ptr && (i < rgi->tables_to_lock_count);
+ table_list_ptr= table_list_ptr->next_global, i++)
+ {
+ /*
+ Below if condition takes care of skipping base tables that
+ make up the MERGE table (which are added by open_tables()
+ call). They are added next to the merge table in the list.
+ For eg: If RPL_TABLE_LIST is t3->t1->t2 (where t1 and t2
+ are base tables for merge table 't3'), open_tables will modify
+ the list by adding t1 and t2 again immediately after t3 in the
+ list (*not at the end of the list*). New table_to_lock list will
+ look like t3->t1'->t2'->t1->t2 (where t1' and t2' are TABLE_LIST
+ objects added by open_tables() call). There is no flag(or logic) in
+ open_tables() that can skip adding these base tables to the list.
+ So the logic here should take care of skipping them.
+
+ tables_to_lock_count logic will take care of skipping base tables
+ that are added at the end of the list.
+ For eg: If RPL_TABLE_LIST is t1->t2->t3, open_tables will modify
+ the list into t1->t2->t3->t1'->t2'. t1' and t2' will be skipped
+ because tables_to_lock_count logic in this for loop.
+ */
+ if (table_list_ptr->parent_l)
+ continue;
+ /*
+ We can use a down cast here since we know that every table added
+ to the tables_to_lock is a RPL_TABLE_LIST (or child table which is
+ skipped above).
+ */
+ RPL_TABLE_LIST *ptr= static_cast<RPL_TABLE_LIST*>(table_list_ptr);
+ DBUG_ASSERT(ptr->m_tabledef_valid);
+ TABLE *conv_table;
+ if (!ptr->m_tabledef.compatible_with(thd, rgi, ptr->table, &conv_table))
+ {
+ DBUG_PRINT("debug", ("Table: %s.%s is not compatible with master",
+ ptr->table->s->db.str,
+ ptr->table->s->table_name.str));
+ /*
+ We should not honour --slave-skip-errors at this point as we are
+ having severe errors which should not be skiped.
+ */
+ thd->is_slave_error= 1;
+ /* remove trigger's tables */
+ error= ERR_BAD_TABLE_DEF;
+ goto err;
+ }
+ DBUG_PRINT("debug", ("Table: %s.%s is compatible with master"
+ " - conv_table: %p",
+ ptr->table->s->db.str,
+ ptr->table->s->table_name.str, conv_table));
+ ptr->m_conv_table= conv_table;
+ }
+ }
+
+ /*
+ ... and then we add all the tables to the table map and but keep
+ them in the tables to lock list.
+
+ We also invalidate the query cache for all the tables, since
+ they will now be changed.
+
+ TODO [/Matz]: Maybe the query cache should not be invalidated
+ here? It might be that a table is not changed, even though it
+ was locked for the statement. We do know that each
+ Rows_log_event contain at least one row, so after processing one
+ Rows_log_event, we can invalidate the query cache for the
+ associated table.
+ */
+ TABLE_LIST *ptr= rgi->tables_to_lock;
+ for (uint i=0 ; ptr && (i < rgi->tables_to_lock_count); ptr= ptr->next_global, i++)
+ {
+ /*
+ Please see comment in above 'for' loop to know the reason
+ for this if condition
+ */
+ if (ptr->parent_l)
+ continue;
+ rgi->m_table_map.set_table(ptr->table_id, ptr->table);
+ /*
+ Following is passing flag about triggers on the server. The problem was
+ to pass it between table map event and row event. I do it via extended
+ TABLE_LIST (RPL_TABLE_LIST) but row event uses only TABLE so I need to
+ find somehow the corresponding TABLE_LIST.
+ */
+ if (m_table_id == ptr->table_id)
+ {
+ ptr->table->master_had_triggers=
+ ((RPL_TABLE_LIST*)ptr)->master_had_triggers;
+ }
+ }
+
+#ifdef HAVE_QUERY_CACHE
+#ifdef WITH_WSREP
+ /*
+ Moved invalidation right before the call to rows_event_stmt_cleanup(),
+ to avoid query cache being polluted with stale entries,
+ */
+ if (! (WSREP(thd) && wsrep_thd_is_applying(thd)))
+ {
+#endif /* WITH_WSREP */
+ query_cache.invalidate_locked_for_write(thd, rgi->tables_to_lock);
+#ifdef WITH_WSREP
+ }
+#endif /* WITH_WSREP */
+#endif
+ }
+
+ table= m_table= rgi->m_table_map.get_table(m_table_id);
+
+ DBUG_PRINT("debug", ("m_table:%p, m_table_id: %llu%s",
+ m_table, m_table_id,
+ table && master_had_triggers ?
+ " (master had triggers)" : ""));
+ if (table)
+ {
+ master_had_triggers= table->master_had_triggers;
+ bool transactional_table= table->file->has_transactions();
+ /*
+ table == NULL means that this table should not be replicated
+ (this was set up by Table_map_log_event::do_apply_event()
+ which tested replicate-* rules).
+ */
+
+ /*
+ It's not needed to set_time() but
+ 1) it continues the property that "Time" in SHOW PROCESSLIST shows how
+ much slave is behind
+ 2) it will be needed when we allow replication from a table with no
+ TIMESTAMP column to a table with one.
+ So we call set_time(), like in SBR. Presently it changes nothing.
+ */
+ thd->set_time(when, when_sec_part);
+
+ if (m_width == table->s->fields && bitmap_is_set_all(&m_cols))
+ set_flags(COMPLETE_ROWS_F);
+
+ /*
+ Set tables write and read sets.
+
+ Read_set contains all slave columns (in case we are going to fetch
+ a complete record from slave)
+
+ Write_set equals the m_cols bitmap sent from master but it can be
+ longer if slave has extra columns.
+ */
+
+ 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);
+ table->rpl_write_set= table->write_set;
+
+ /* 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
+
+ // Do event specific preparations
+ error= do_before_row_operations(rli);
+
+ /*
+ Bug#56662 Assertion failed: next_insert_id == 0, file handler.cc
+ Don't allow generation of auto_increment value when processing
+ rows event by setting 'MODE_NO_AUTO_VALUE_ON_ZERO'. The exception
+ to this rule happens when the auto_inc column exists on some
+ extra columns on the slave. In that case, do not force
+ MODE_NO_AUTO_VALUE_ON_ZERO.
+ */
+ sql_mode_t saved_sql_mode= thd->variables.sql_mode;
+ if (!is_auto_inc_in_extra_columns())
+ thd->variables.sql_mode= MODE_NO_AUTO_VALUE_ON_ZERO;
+
+ // row processing loop
+
+ /*
+ set the initial time of this ROWS statement if it was not done
+ before in some other ROWS event.
+ */
+ rgi->set_row_stmt_start_timestamp();
+
+ THD_STAGE_INFO(thd, stage_executing);
+ do
+ {
+ /* in_use can have been set to NULL in close_tables_for_reopen */
+ THD* old_thd= table->in_use;
+ if (!table->in_use)
+ table->in_use= thd;
+
+ error= do_exec_row(rgi);
+
+ if (unlikely(error))
+ DBUG_PRINT("info", ("error: %s", HA_ERR(error)));
+ DBUG_ASSERT(error != HA_ERR_RECORD_DELETED);
+
+ table->in_use = old_thd;
+
+ if (unlikely(error))
+ {
+ int actual_error= convert_handler_error(error, thd, table);
+ bool idempotent_error= (idempotent_error_code(error) &&
+ (slave_exec_mode == SLAVE_EXEC_MODE_IDEMPOTENT));
+ bool ignored_error= (idempotent_error == 0 ?
+ ignored_error_code(actual_error) : 0);
+
+#ifdef WITH_WSREP
+ if (WSREP(thd) && wsrep_ignored_error_code(this, actual_error))
+ {
+ idempotent_error= true;
+ thd->wsrep_has_ignored_error= true;
+ }
+#endif /* WITH_WSREP */
+ if (idempotent_error || ignored_error)
+ {
+ if (global_system_variables.log_warnings)
+ slave_rows_error_report(WARNING_LEVEL, error, rgi, thd, table,
+ get_type_str(),
+ RPL_LOG_NAME, log_pos);
+ thd->clear_error(1);
+ error= 0;
+ if (idempotent_error == 0)
+ break;
+ }
+ }
+
+ /*
+ If m_curr_row_end was not set during event execution (e.g., because
+ of errors) we can't proceed to the next row. If the error is transient
+ (i.e., error==0 at this point) we must call unpack_current_row() to set
+ m_curr_row_end.
+ */
+
+ DBUG_PRINT("info", ("curr_row: %p; curr_row_end: %p; rows_end:%p",
+ m_curr_row, m_curr_row_end, m_rows_end));
+
+ if (!m_curr_row_end && likely(!error))
+ error= unpack_current_row(rgi);
+
+ m_curr_row= m_curr_row_end;
+
+ if (likely(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.
+ */
+ thd->variables.sql_mode= saved_sql_mode;
+
+ {/**
+ The following failure injecion works in cooperation with tests
+ setting @@global.debug= 'd,stop_slave_middle_group'.
+ The sql thread receives the killed status and will proceed
+ to shutdown trying to finish incomplete events group.
+ */
+ DBUG_EXECUTE_IF("stop_slave_middle_group",
+ if (thd->transaction.all.modified_non_trans_table)
+ const_cast<Relay_log_info*>(rli)->abort_slave= 1;);
+ }
+
+ if (unlikely(error= do_after_row_operations(rli, error)) &&
+ ignored_error_code(convert_handler_error(error, thd, table)))
+ {
+
+ if (global_system_variables.log_warnings)
+ slave_rows_error_report(WARNING_LEVEL, error, rgi, thd, table,
+ get_type_str(),
+ RPL_LOG_NAME, log_pos);
+ thd->clear_error(1);
+ error= 0;
+ }
+ } // if (table)
+
+
+ if (unlikely(error))
+ {
+ slave_rows_error_report(ERROR_LEVEL, error, rgi, thd, table,
+ get_type_str(),
+ RPL_LOG_NAME, log_pos);
+ /*
+ @todo We should probably not call
+ reset_current_stmt_binlog_format_row() from here.
+
+ Note: this applies to log_event_old.cc too.
+ /Sven
+ */
+ thd->reset_current_stmt_binlog_format_row();
+ thd->is_slave_error= 1;
+ /* remove trigger's tables */
+ goto err;
+ }
+
+ /* remove trigger's tables */
+ if (slave_run_triggers_for_rbr)
+ restore_empty_query_table_list(thd->lex);
+
+#if defined(WITH_WSREP) && defined(HAVE_QUERY_CACHE)
+ if (WSREP(thd) && wsrep_thd_is_applying(thd))
+ {
+ query_cache.invalidate_locked_for_write(thd, rgi->tables_to_lock);
+ }
+#endif /* WITH_WSREP && HAVE_QUERY_CACHE */
+
+ if (unlikely(get_flags(STMT_END_F) &&
+ (error= rows_event_stmt_cleanup(rgi, thd))))
+ slave_rows_error_report(ERROR_LEVEL,
+ thd->is_error() ? 0 : error,
+ rgi, thd, table,
+ get_type_str(),
+ RPL_LOG_NAME, log_pos);
+ DBUG_RETURN(error);
+
+err:
+ if (slave_run_triggers_for_rbr)
+ restore_empty_query_table_list(thd->lex);
+ rgi->slave_close_thread_tables(thd);
+ DBUG_RETURN(error);
+}
+
+Log_event::enum_skip_reason
+Rows_log_event::do_shall_skip(rpl_group_info *rgi)
+{
+ /*
+ If the slave skip counter is 1 and this event does not end a
+ statement, then we should not start executing on the next event.
+ Otherwise, we defer the decision to the normal skipping logic.
+ */
+ if (rgi->rli->slave_skip_counter == 1 && !get_flags(STMT_END_F))
+ return Log_event::EVENT_SKIP_IGNORE;
+ else
+ return Log_event::do_shall_skip(rgi);
+}
+
+/**
+ The function is called at Rows_log_event statement commit time,
+ normally from Rows_log_event::do_update_pos() and possibly from
+ Query_log_event::do_apply_event() of the COMMIT.
+ The function commits the last statement for engines, binlog and
+ releases resources have been allocated for the statement.
+
+ @retval 0 Ok.
+ @retval non-zero Error at the commit.
+ */
+
+static int rows_event_stmt_cleanup(rpl_group_info *rgi, THD * thd)
+{
+ int error;
+ DBUG_ENTER("rows_event_stmt_cleanup");
+
+ {
+ /*
+ This is the end of a statement or transaction, so close (and
+ unlock) the tables we opened when processing the
+ Table_map_log_event starting the statement.
+
+ OBSERVER. This will clear *all* mappings, not only those that
+ are open for the table. There is not good handle for on-close
+ actions for tables.
+
+ NOTE. Even if we have no table ('table' == 0) we still need to be
+ here, so that we increase the group relay log position. If we didn't, we
+ could have a group relay log position which lags behind "forever"
+ (assume the last master's transaction is ignored by the slave because of
+ replicate-ignore rules).
+ */
+ error= thd->binlog_flush_pending_rows_event(TRUE);
+
+ /*
+ If this event is not in a transaction, the call below will, if some
+ transactional storage engines are involved, commit the statement into
+ them and flush the pending event to binlog.
+ If this event is in a transaction, the call will do nothing, but a
+ Xid_log_event will come next which will, if some transactional engines
+ are involved, commit the transaction and flush the pending event to the
+ binlog.
+ If there was a deadlock the transaction should have been rolled back
+ already. So there should be no need to rollback the transaction.
+ */
+ DBUG_ASSERT(! thd->transaction_rollback_request);
+ error|= (int)(error ? trans_rollback_stmt(thd) : trans_commit_stmt(thd));
+
+ /*
+ Now what if this is not a transactional engine? we still need to
+ flush the pending event to the binlog; we did it with
+ thd->binlog_flush_pending_rows_event(). Note that we imitate
+ what is done for real queries: a call to
+ ha_autocommit_or_rollback() (sometimes only if involves a
+ transactional engine), and a call to be sure to have the pending
+ event flushed.
+ */
+
+ /*
+ @todo We should probably not call
+ reset_current_stmt_binlog_format_row() from here.
+
+ Note: this applies to log_event_old.cc too
+
+ Btw, the previous comment about transactional engines does not
+ seem related to anything that happens here.
+ /Sven
+ */
+ thd->reset_current_stmt_binlog_format_row();
+
+ /*
+ Reset modified_non_trans_table that we have set in
+ rows_log_event::do_apply_event()
+ */
+ if (!thd->in_multi_stmt_transaction_mode())
+ {
+ thd->transaction.all.modified_non_trans_table= 0;
+ thd->transaction.all.m_unsafe_rollback_flags&= ~THD_TRANS::DID_WAIT;
+ }
+
+ rgi->cleanup_context(thd, 0);
+ }
+ DBUG_RETURN(error);
+}
+
+/**
+ The method either increments the relay log position or
+ commits the current statement and increments the master group
+ possition if the event is STMT_END_F flagged and
+ the statement corresponds to the autocommit query (i.e replicated
+ without wrapping in BEGIN/COMMIT)
+
+ @retval 0 Success
+ @retval non-zero Error in the statement commit
+ */
+int
+Rows_log_event::do_update_pos(rpl_group_info *rgi)
+{
+ Relay_log_info *rli= rgi->rli;
+ int error= 0;
+ DBUG_ENTER("Rows_log_event::do_update_pos");
+
+ DBUG_PRINT("info", ("flags: %s",
+ get_flags(STMT_END_F) ? "STMT_END_F " : ""));
+
+ if (get_flags(STMT_END_F))
+ {
+ /*
+ Indicate that a statement is finished.
+ Step the group log position if we are not in a transaction,
+ otherwise increase the event log position.
+ */
+ error= rli->stmt_done(log_pos, thd, rgi);
+ /*
+ Clear any errors in thd->net.last_err*. It is not known if this is
+ needed or not. It is believed that any errors that may exist in
+ thd->net.last_err* are allowed. Examples of errors are "key not
+ found", which is produced in the test case rpl_row_conflicts.test
+ */
+ thd->clear_error();
+ }
+ else
+ {
+ rgi->inc_event_relay_log_pos();
+ }
+
+ DBUG_RETURN(error);
+}
+
+#endif /* defined(HAVE_REPLICATION) */
+
+
+bool Rows_log_event::write_data_header()
+{
+ uchar buf[ROWS_HEADER_LEN_V2]; // No need to init the buffer
+ DBUG_ASSERT(m_table_id != ~0ULL);
+ DBUG_EXECUTE_IF("old_row_based_repl_4_byte_map_id_master",
+ {
+ int4store(buf + 0, m_table_id);
+ int2store(buf + 4, m_flags);
+ return (write_data(buf, 6));
+ });
+ int6store(buf + RW_MAPID_OFFSET, m_table_id);
+ int2store(buf + RW_FLAGS_OFFSET, m_flags);
+ return write_data(buf, ROWS_HEADER_LEN);
+}
+
+bool Rows_log_event::write_data_body()
+{
+ /*
+ Note that this should be the number of *bits*, not the number of
+ bytes.
+ */
+ uchar sbuf[MAX_INT_WIDTH];
+ my_ptrdiff_t const data_size= m_rows_cur - m_rows_buf;
+ bool res= false;
+ uchar *const sbuf_end= net_store_length(sbuf, (size_t) m_width);
+ DBUG_ASSERT(static_cast<size_t>(sbuf_end - sbuf) <= sizeof(sbuf));
+
+ DBUG_DUMP("m_width", 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 || write_data((uchar*)m_cols.bitmap, no_bytes_in_map(&m_cols));
+ /*
+ TODO[refactor write]: Remove the "down cast" here (and elsewhere).
+ */
+ if (get_general_type_code() == UPDATE_ROWS_EVENT)
+ {
+ DBUG_DUMP("m_cols_ai", (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 || write_data(m_rows_buf, (size_t) data_size);
+
+ return res;
+
+}
+
+bool Rows_log_event::write_compressed()
+{
+ uchar *m_rows_buf_tmp = m_rows_buf;
+ uchar *m_rows_cur_tmp = m_rows_cur;
+ bool ret = true;
+ uint32 comlen, alloc_size;
+ comlen= alloc_size= binlog_get_compress_len((uint32)(m_rows_cur_tmp - m_rows_buf_tmp));
+ m_rows_buf = (uchar *)my_safe_alloca(alloc_size);
+ if(m_rows_buf &&
+ !binlog_buf_compress((const char *)m_rows_buf_tmp, (char *)m_rows_buf,
+ (uint32)(m_rows_cur_tmp - m_rows_buf_tmp), &comlen))
+ {
+ m_rows_cur= comlen + m_rows_buf;
+ ret= Log_event::write();
+ }
+ my_safe_afree(m_rows_buf, alloc_size);
+ m_rows_buf= m_rows_buf_tmp;
+ m_rows_cur= m_rows_cur_tmp;
+ return ret;
+}
+
+
+#if defined(HAVE_REPLICATION)
+void Rows_log_event::pack_info(Protocol *protocol)
+{
+ char buf[256];
+ char const *const flagstr=
+ get_flags(STMT_END_F) ? " flags: STMT_END_F" : "";
+ size_t bytes= my_snprintf(buf, sizeof(buf),
+ "table_id: %llu%s", m_table_id, flagstr);
+ protocol->store(buf, bytes, &my_charset_bin);
+}
+#endif
+
+
+/**************************************************************************
+ Annotate_rows_log_event member functions
+**************************************************************************/
+
+Annotate_rows_log_event::Annotate_rows_log_event(THD *thd,
+ bool using_trans,
+ bool direct)
+ : Log_event(thd, 0, using_trans),
+ m_save_thd_query_txt(0),
+ m_save_thd_query_len(0),
+ m_saved_thd_query(false),
+ m_used_query_txt(0)
+{
+ m_query_txt= thd->query();
+ m_query_len= thd->query_length();
+ if (direct)
+ cache_type= Log_event::EVENT_NO_CACHE;
+}
+
+
+bool Annotate_rows_log_event::write_data_header()
+{
+ return 0;
+}
+
+
+bool Annotate_rows_log_event::write_data_body()
+{
+ return write_data(m_query_txt, m_query_len);
+}
+
+
+#if defined(HAVE_REPLICATION)
+void Annotate_rows_log_event::pack_info(Protocol* protocol)
+{
+ if (m_query_txt && m_query_len)
+ protocol->store(m_query_txt, m_query_len, &my_charset_bin);
+}
+#endif
+
+
+#if defined(HAVE_REPLICATION)
+int Annotate_rows_log_event::do_apply_event(rpl_group_info *rgi)
+{
+ rgi->free_annotate_event();
+ m_save_thd_query_txt= thd->query();
+ m_save_thd_query_len= thd->query_length();
+ m_saved_thd_query= true;
+ m_used_query_txt= 1;
+ thd->set_query(m_query_txt, m_query_len);
+ return 0;
+}
+#endif
+
+
+#if defined(HAVE_REPLICATION)
+int Annotate_rows_log_event::do_update_pos(rpl_group_info *rgi)
+{
+ rgi->inc_event_relay_log_pos();
+ return 0;
+}
+#endif
+
+
+#if defined(HAVE_REPLICATION)
+Log_event::enum_skip_reason
+Annotate_rows_log_event::do_shall_skip(rpl_group_info *rgi)
+{
+ return continue_group(rgi);
+}
+#endif
+
+/**************************************************************************
+ Table_map_log_event member functions and support functions
+**************************************************************************/
+
+/**
+ Save the field metadata based on the real_type of the field.
+ The metadata saved depends on the type of the field. Some fields
+ store a single byte for pack_length() while others store two bytes
+ for field_length (max length).
+
+ @retval 0 Ok.
+
+ @todo
+ We may want to consider changing the encoding of the information.
+ Currently, the code attempts to minimize the number of bytes written to
+ the tablemap. There are at least two other alternatives; 1) using
+ net_store_length() to store the data allowing it to choose the number of
+ bytes that are appropriate thereby making the code much easier to
+ maintain (only 1 place to change the encoding), or 2) use a fixed number
+ of bytes for each field. The problem with option 1 is that net_store_length()
+ will use one byte if the value < 251, but 3 bytes if it is > 250. Thus,
+ for fields like CHAR which can be no larger than 255 characters, the method
+ will use 3 bytes when the value is > 250. Further, every value that is
+ encoded using 2 parts (e.g., pack_length, field_length) will be numerically
+ > 250 therefore will use 3 bytes for eah value. The problem with option 2
+ is less wasteful for space but does waste 1 byte for every field that does
+ not encode 2 parts.
+*/
+int Table_map_log_event::save_field_metadata()
+{
+ DBUG_ENTER("Table_map_log_event::save_field_metadata");
+ int index= 0;
+ Binlog_type_info *info;
+ for (unsigned int i= 0 ; i < m_table->s->fields ; i++)
+ {
+ DBUG_PRINT("debug", ("field_type: %d", m_coltype[i]));
+ //index+= m_table->s->field[i]->save_field_metadata(&m_field_metadata[index]);
+ info= binlog_type_info_array + i;
+ memcpy(&m_field_metadata[index], (uchar *)&info->m_metadata, info->m_metadata_size);
+ index+= info->m_metadata_size;
+ DBUG_EXECUTE_IF("inject_invalid_blob_size",
+ {
+ if (m_coltype[i] == MYSQL_TYPE_BLOB)
+ m_field_metadata[index-1] = 5;
+ });
+ }
+ DBUG_RETURN(index);
+}
+
+
+/*
+ Constructor used to build an event for writing to the binary log.
+ Mats says tbl->s lives longer than this event so it's ok to copy pointers
+ (tbl->s->db etc) and not pointer content.
+ */
+Table_map_log_event::Table_map_log_event(THD *thd, TABLE *tbl, ulong tid,
+ bool is_transactional)
+ : Log_event(thd, 0, is_transactional),
+ m_table(tbl),
+ m_dbnam(tbl->s->db.str),
+ m_dblen(m_dbnam ? tbl->s->db.length : 0),
+ m_tblnam(tbl->s->table_name.str),
+ m_tbllen(tbl->s->table_name.length),
+ m_colcnt(tbl->s->fields),
+ m_memory(NULL),
+ m_table_id(tid),
+ m_flags(TM_BIT_LEN_EXACT_F),
+ m_data_size(0),
+ m_field_metadata(0),
+ m_field_metadata_size(0),
+ m_null_bits(0),
+ m_meta_memory(NULL),
+ m_optional_metadata_len(0),
+ m_optional_metadata(NULL)
+{
+ uchar cbuf[MAX_INT_WIDTH];
+ uchar *cbuf_end;
+ DBUG_ENTER("Table_map_log_event::Table_map_log_event(TABLE)");
+ DBUG_ASSERT(m_table_id != ~0ULL);
+ /*
+ In TABLE_SHARE, "db" and "table_name" are 0-terminated (see this comment in
+ table.cc / alloc_table_share():
+ Use the fact the key is db/0/table_name/0
+ As we rely on this let's assert it.
+ */
+ DBUG_ASSERT((tbl->s->db.str == 0) ||
+ (tbl->s->db.str[tbl->s->db.length] == 0));
+ DBUG_ASSERT(tbl->s->table_name.str[tbl->s->table_name.length] == 0);
+
+#ifdef MYSQL_SERVER
+ binlog_type_info_array= (Binlog_type_info *)thd->alloc(m_table->s->fields *
+ sizeof(Binlog_type_info));
+ for (uint i= 0; i < m_table->s->fields; i++)
+ binlog_type_info_array[i]= m_table->field[i]->binlog_type_info();
+#endif
+
+
+ m_data_size= TABLE_MAP_HEADER_LEN;
+ DBUG_EXECUTE_IF("old_row_based_repl_4_byte_map_id_master", m_data_size= 6;);
+ m_data_size+= m_dblen + 2; // Include length and terminating \0
+ m_data_size+= m_tbllen + 2; // Include length and terminating \0
+ cbuf_end= net_store_length(cbuf, (size_t) m_colcnt);
+ DBUG_ASSERT(static_cast<size_t>(cbuf_end - cbuf) <= sizeof(cbuf));
+ m_data_size+= (cbuf_end - cbuf) + m_colcnt; // COLCNT and column types
+
+ if (tbl->triggers)
+ m_flags|= TM_BIT_HAS_TRIGGERS_F;
+
+ /* If malloc fails, caught in is_valid() */
+ if ((m_memory= (uchar*) my_malloc(m_colcnt, MYF(MY_WME))))
+ {
+ m_coltype= reinterpret_cast<uchar*>(m_memory);
+ for (unsigned int i= 0 ; i < m_table->s->fields ; ++i)
+ m_coltype[i]= binlog_type_info_array[i].m_type_code;
+ DBUG_EXECUTE_IF("inject_invalid_column_type", m_coltype[1]= 230;);
+ }
+
+ /*
+ Calculate a bitmap for the results of maybe_null() for all columns.
+ The bitmap is used to determine when there is a column from the master
+ that is not on the slave and is null and thus not in the row data during
+ replication.
+ */
+ uint num_null_bytes= (m_table->s->fields + 7) / 8;
+ m_data_size+= num_null_bytes;
+ m_meta_memory= (uchar *)my_multi_malloc(MYF(MY_WME),
+ &m_null_bits, num_null_bytes,
+ &m_field_metadata, (m_colcnt * 2),
+ NULL);
+
+ bzero(m_field_metadata, (m_colcnt * 2));
+
+ /*
+ Create an array for the field metadata and store it.
+ */
+ m_field_metadata_size= save_field_metadata();
+ DBUG_ASSERT(m_field_metadata_size <= (m_colcnt * 2));
+
+ /*
+ Now set the size of the data to the size of the field metadata array
+ plus one or three bytes (see pack.c:net_store_length) for number of
+ elements in the field metadata array.
+ */
+ if (m_field_metadata_size < 251)
+ m_data_size+= m_field_metadata_size + 1;
+ else
+ m_data_size+= m_field_metadata_size + 3;
+
+ bzero(m_null_bits, num_null_bytes);
+ for (unsigned int i= 0 ; i < m_table->s->fields ; ++i)
+ if (m_table->field[i]->maybe_null())
+ m_null_bits[(i / 8)]+= 1 << (i % 8);
+
+ init_metadata_fields();
+ m_data_size+= m_metadata_buf.length();
+
+ DBUG_VOID_RETURN;
+}
+
+
+/*
+ Return value is an error code, one of:
+
+ -1 Failure to open table [from open_tables()]
+ 0 Success
+ 1 No room for more tables [from set_table()]
+ 2 Out of memory [from set_table()]
+ 3 Wrong table definition
+ 4 Daisy-chaining RBR with SBR not possible
+ */
+
+#if defined(HAVE_REPLICATION)
+
+enum enum_tbl_map_status
+{
+ /* no duplicate identifier found */
+ OK_TO_PROCESS= 0,
+
+ /* this table map must be filtered out */
+ FILTERED_OUT= 1,
+
+ /* identifier mapping table with different properties */
+ SAME_ID_MAPPING_DIFFERENT_TABLE= 2,
+
+ /* a duplicate identifier was found mapping the same table */
+ SAME_ID_MAPPING_SAME_TABLE= 3
+};
+
+/*
+ Checks if this table map event should be processed or not. First
+ it checks the filtering rules, and then looks for duplicate identifiers
+ in the existing list of rli->tables_to_lock.
+
+ It checks that there hasn't been any corruption by verifying that there
+ are no duplicate entries with different properties.
+
+ In some cases, some binary logs could get corrupted, showing several
+ tables mapped to the same table_id, 0 (see: BUG#56226). Thus we do this
+ early sanity check for such cases and avoid that the server crashes
+ later.
+
+ In some corner cases, the master logs duplicate table map events, i.e.,
+ same id, same database name, same table name (see: BUG#37137). This is
+ different from the above as it's the same table that is mapped again
+ to the same identifier. Thus we cannot just check for same ids and
+ assume that the event is corrupted we need to check every property.
+
+ NOTE: in the event that BUG#37137 ever gets fixed, this extra check
+ will still be valid because we would need to support old binary
+ logs anyway.
+
+ @param rli The relay log info reference.
+ @param table_list A list element containing the table to check against.
+ @return OK_TO_PROCESS
+ if there was no identifier already in rli->tables_to_lock
+
+ FILTERED_OUT
+ if the event is filtered according to the filtering rules
+
+ SAME_ID_MAPPING_DIFFERENT_TABLE
+ if the same identifier already maps a different table in
+ rli->tables_to_lock
+
+ SAME_ID_MAPPING_SAME_TABLE
+ if the same identifier already maps the same table in
+ rli->tables_to_lock.
+*/
+static enum_tbl_map_status
+check_table_map(rpl_group_info *rgi, RPL_TABLE_LIST *table_list)
+{
+ DBUG_ENTER("check_table_map");
+ enum_tbl_map_status res= OK_TO_PROCESS;
+ Relay_log_info *rli= rgi->rli;
+ if ((rgi->thd->slave_thread /* filtering is for slave only */ ||
+ IF_WSREP((WSREP(rgi->thd) && rgi->thd->wsrep_applier), 0)) &&
+ (!rli->mi->rpl_filter->db_ok(table_list->db.str) ||
+ (rli->mi->rpl_filter->is_on() && !rli->mi->rpl_filter->tables_ok("", table_list))))
+ res= FILTERED_OUT;
+ else
+ {
+ RPL_TABLE_LIST *ptr= static_cast<RPL_TABLE_LIST*>(rgi->tables_to_lock);
+ for(uint i=0 ; ptr && (i< rgi->tables_to_lock_count);
+ ptr= static_cast<RPL_TABLE_LIST*>(ptr->next_local), i++)
+ {
+ if (ptr->table_id == table_list->table_id)
+ {
+
+ if (cmp(&ptr->db, &table_list->db) ||
+ cmp(&ptr->alias, &table_list->table_name) ||
+ ptr->lock_type != TL_WRITE) // the ::do_apply_event always sets TL_WRITE
+ res= SAME_ID_MAPPING_DIFFERENT_TABLE;
+ else
+ res= SAME_ID_MAPPING_SAME_TABLE;
+
+ break;
+ }
+ }
+ }
+
+ DBUG_PRINT("debug", ("check of table map ended up with: %u", res));
+
+ DBUG_RETURN(res);
+}
+
+int Table_map_log_event::do_apply_event(rpl_group_info *rgi)
+{
+ RPL_TABLE_LIST *table_list;
+ char *db_mem, *tname_mem, *ptr;
+ size_t dummy_len, db_mem_length, tname_mem_length;
+ void *memory;
+ Rpl_filter *filter;
+ Relay_log_info const *rli= rgi->rli;
+ DBUG_ENTER("Table_map_log_event::do_apply_event(Relay_log_info*)");
+
+ /* Step the query id to mark what columns that are actually used. */
+ thd->set_query_id(next_query_id());
+
+ if (!(memory= my_multi_malloc(MYF(MY_WME),
+ &table_list, (uint) sizeof(RPL_TABLE_LIST),
+ &db_mem, (uint) NAME_LEN + 1,
+ &tname_mem, (uint) NAME_LEN + 1,
+ NullS)))
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+
+ db_mem_length= strmov(db_mem, m_dbnam) - db_mem;
+ tname_mem_length= strmov(tname_mem, m_tblnam) - tname_mem;
+ if (lower_case_table_names)
+ {
+ my_casedn_str(files_charset_info, (char*)tname_mem);
+ my_casedn_str(files_charset_info, (char*)db_mem);
+ }
+
+ /* call from mysql_client_binlog_statement() will not set rli->mi */
+ filter= rgi->thd->slave_thread ? rli->mi->rpl_filter : global_rpl_filter;
+
+ /* rewrite rules changed the database */
+ if (((ptr= (char*) filter->get_rewrite_db(db_mem, &dummy_len)) != db_mem))
+ db_mem_length= strmov(db_mem, ptr) - db_mem;
+
+ LEX_CSTRING tmp_db_name= {db_mem, db_mem_length };
+ LEX_CSTRING tmp_tbl_name= {tname_mem, tname_mem_length };
+
+ table_list->init_one_table(&tmp_db_name, &tmp_tbl_name, 0, TL_WRITE);
+ table_list->table_id= DBUG_EVALUATE_IF("inject_tblmap_same_id_maps_diff_table", 0, m_table_id);
+ table_list->updating= 1;
+ table_list->required_type= TABLE_TYPE_NORMAL;
+
+ DBUG_PRINT("debug", ("table: %s is mapped to %llu",
+ table_list->table_name.str,
+ table_list->table_id));
+ table_list->master_had_triggers= ((m_flags & TM_BIT_HAS_TRIGGERS_F) ? 1 : 0);
+ DBUG_PRINT("debug", ("table->master_had_triggers=%d",
+ (int)table_list->master_had_triggers));
+
+ enum_tbl_map_status tblmap_status= check_table_map(rgi, table_list);
+ if (tblmap_status == OK_TO_PROCESS)
+ {
+ DBUG_ASSERT(thd->lex->query_tables != table_list);
+
+ /*
+ Use placement new to construct the table_def instance in the
+ memory allocated for it inside table_list.
+
+ The memory allocated by the table_def structure (i.e., not the
+ memory allocated *for* the table_def structure) is released
+ inside Relay_log_info::clear_tables_to_lock() by calling the
+ table_def destructor explicitly.
+ */
+ new (&table_list->m_tabledef)
+ table_def(m_coltype, m_colcnt,
+ m_field_metadata, m_field_metadata_size,
+ m_null_bits, m_flags);
+ table_list->m_tabledef_valid= TRUE;
+ table_list->m_conv_table= NULL;
+ table_list->open_type= OT_BASE_ONLY;
+
+ /*
+ We record in the slave's information that the table should be
+ locked by linking the table into the list of tables to lock.
+ */
+ table_list->next_global= table_list->next_local= rgi->tables_to_lock;
+ rgi->tables_to_lock= table_list;
+ rgi->tables_to_lock_count++;
+ /* 'memory' is freed in clear_tables_to_lock */
+ }
+ else // FILTERED_OUT, SAME_ID_MAPPING_*
+ {
+ /*
+ If mapped already but with different properties, we raise an
+ error.
+ If mapped already but with same properties we skip the event.
+ If filtered out we skip the event.
+
+ In all three cases, we need to free the memory previously
+ allocated.
+ */
+ if (tblmap_status == SAME_ID_MAPPING_DIFFERENT_TABLE)
+ {
+ /*
+ Something bad has happened. We need to stop the slave as strange things
+ could happen if we proceed: slave crash, wrong table being updated, ...
+ As a consequence we push an error in this case.
+ */
+
+ char buf[256];
+
+ my_snprintf(buf, sizeof(buf),
+ "Found table map event mapping table id %u which "
+ "was already mapped but with different settings.",
+ table_list->table_id);
+
+ if (thd->slave_thread)
+ rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, rgi->gtid_info(),
+ 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_error(ER_SLAVE_FATAL_ERROR, MYF(0), buf);
+ }
+
+ my_free(memory);
+ }
+
+ DBUG_RETURN(tblmap_status == SAME_ID_MAPPING_DIFFERENT_TABLE);
+}
+
+Log_event::enum_skip_reason
+Table_map_log_event::do_shall_skip(rpl_group_info *rgi)
+{
+ /*
+ If the slave skip counter is 1, then we should not start executing
+ on the next event.
+ */
+ return continue_group(rgi);
+}
+
+int Table_map_log_event::do_update_pos(rpl_group_info *rgi)
+{
+ rgi->inc_event_relay_log_pos();
+ return 0;
+}
+
+#endif /* defined(HAVE_REPLICATION) */
+
+bool Table_map_log_event::write_data_header()
+{
+ DBUG_ASSERT(m_table_id != ~0ULL);
+ uchar buf[TABLE_MAP_HEADER_LEN];
+ DBUG_EXECUTE_IF("old_row_based_repl_4_byte_map_id_master",
+ {
+ int4store(buf + 0, m_table_id);
+ int2store(buf + 4, m_flags);
+ return (write_data(buf, 6));
+ });
+ int6store(buf + TM_MAPID_OFFSET, m_table_id);
+ int2store(buf + TM_FLAGS_OFFSET, m_flags);
+ return write_data(buf, TABLE_MAP_HEADER_LEN);
+}
+
+bool Table_map_log_event::write_data_body()
+{
+ DBUG_ASSERT(m_dbnam != NULL);
+ DBUG_ASSERT(m_tblnam != NULL);
+ /* We use only one byte per length for storage in event: */
+ DBUG_ASSERT(m_dblen <= MY_MIN(NAME_LEN, 255));
+ DBUG_ASSERT(m_tbllen <= MY_MIN(NAME_LEN, 255));
+
+ uchar const dbuf[]= { (uchar) m_dblen };
+ uchar const tbuf[]= { (uchar) m_tbllen };
+
+ uchar cbuf[MAX_INT_WIDTH];
+ uchar *const cbuf_end= net_store_length(cbuf, (size_t) m_colcnt);
+ DBUG_ASSERT(static_cast<size_t>(cbuf_end - cbuf) <= sizeof(cbuf));
+
+ /*
+ Store the size of the field metadata.
+ */
+ uchar mbuf[MAX_INT_WIDTH];
+ uchar *const mbuf_end= net_store_length(mbuf, m_field_metadata_size);
+
+ 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) ||
+ write_data((const uchar*) m_metadata_buf.ptr(),
+ m_metadata_buf.length());
+ }
+
+/**
+ stores an integer into packed format.
+
+ @param[out] str_buf a buffer where the packed integer will be stored.
+ @param[in] length the integer will be packed.
+ */
+static inline
+void store_compressed_length(String &str_buf, ulonglong length)
+{
+ // Store Type and packed length
+ uchar buf[4];
+ uchar *buf_ptr = net_store_length(buf, length);
+
+ str_buf.append(reinterpret_cast<char *>(buf), buf_ptr-buf);
+}
+
+/**
+ Write data into str_buf with Type|Length|Value(TLV) format.
+
+ @param[out] str_buf a buffer where the field is stored.
+ @param[in] type type of the field
+ @param[in] length length of the field value
+ @param[in] value value of the field
+*/
+static inline
+bool write_tlv_field(String &str_buf,
+ enum Table_map_log_event::Optional_metadata_field_type
+ type, uint length, const uchar *value)
+{
+ /* type is stored in one byte, so it should never bigger than 255. */
+ DBUG_ASSERT(static_cast<int>(type) <= 255);
+ str_buf.append((char) type);
+ store_compressed_length(str_buf, length);
+ return str_buf.append(reinterpret_cast<const char *>(value), length);
+}
+
+/**
+ Write data into str_buf with Type|Length|Value(TLV) format.
+
+ @param[out] str_buf a buffer where the field is stored.
+ @param[in] type type of the field
+ @param[in] value value of the field
+*/
+static inline
+bool write_tlv_field(String &str_buf,
+ enum Table_map_log_event::Optional_metadata_field_type
+ type, const String &value)
+{
+ return write_tlv_field(str_buf, type, value.length(),
+ reinterpret_cast<const uchar *>(value.ptr()));
+}
+
+static inline bool is_character_field(Binlog_type_info *info_array, Field *field)
+{
+ Binlog_type_info *info= info_array + field->field_index;
+ if (!info->m_cs)
+ return 0;
+ if (info->m_set_typelib || info->m_enum_typelib)
+ return 0;
+ return 1;
+}
+
+static inline bool is_enum_or_set_field(Binlog_type_info *info_array, Field *field) {
+ Binlog_type_info *info= info_array + field->field_index;
+ if (info->m_set_typelib || info->m_enum_typelib)
+ return 1;
+ return 0;
+}
+
+
+void Table_map_log_event::init_metadata_fields()
+{
+ DBUG_ENTER("init_metadata_fields");
+ DBUG_EXECUTE_IF("simulate_no_optional_metadata", DBUG_VOID_RETURN;);
+
+ if (binlog_row_metadata == BINLOG_ROW_METADATA_NO_LOG)
+ DBUG_VOID_RETURN;
+ if (init_signedness_field() ||
+ init_charset_field(&is_character_field, DEFAULT_CHARSET,
+ COLUMN_CHARSET) ||
+ init_geometry_type_field())
+ {
+ m_metadata_buf.length(0);
+ DBUG_VOID_RETURN;
+ }
+
+ if (binlog_row_metadata == BINLOG_ROW_METADATA_FULL)
+ {
+ if (DBUG_EVALUATE_IF("dont_log_column_name", 0, init_column_name_field()) ||
+ init_charset_field(&is_enum_or_set_field, ENUM_AND_SET_DEFAULT_CHARSET,
+ ENUM_AND_SET_COLUMN_CHARSET) ||
+ init_set_str_value_field() ||
+ init_enum_str_value_field() ||
+ init_primary_key_field())
+ m_metadata_buf.length(0);
+ }
+ DBUG_VOID_RETURN;
+}
+
+bool Table_map_log_event::init_signedness_field()
+{
+ /* use it to store signed flags, each numeric column take a bit. */
+ StringBuffer<128> buf;
+ unsigned char flag= 0;
+ unsigned char mask= 0x80;
+ Binlog_type_info *info;
+
+ for (unsigned int i= 0 ; i < m_table->s->fields ; ++i)
+ {
+ info= binlog_type_info_array + i;
+ if (info->m_signedness != Binlog_type_info::SIGN_NOT_APPLICABLE)
+ {
+ if (info->m_signedness == Binlog_type_info::SIGN_UNSIGNED)
+ flag|= mask;
+ mask >>= 1;
+
+ // 8 fields are tested, store the result and clear the flag.
+ if (mask == 0)
+ {
+ buf.append(flag);
+ flag= 0;
+ mask= 0x80;
+ }
+ }
+ }
+
+ // Stores the signedness flags of last few columns
+ if (mask != 0x80)
+ buf.append(flag);
+
+ // The table has no numeric column, so don't log SIGNEDNESS field
+ if (buf.is_empty())
+ return false;
+
+ return write_tlv_field(m_metadata_buf, SIGNEDNESS, buf);
+}
+
+bool Table_map_log_event::init_charset_field(
+ bool (* include_type)(Binlog_type_info *, Field *),
+ Optional_metadata_field_type default_charset_type,
+ Optional_metadata_field_type column_charset_type)
+{
+ DBUG_EXECUTE_IF("simulate_init_charset_field_error", return true;);
+
+ std::map<uint, uint> collation_map;
+ // For counting characters columns
+ uint char_col_cnt= 0;
+
+ /* Find the collation number used by most fields */
+ for (unsigned int i= 0 ; i < m_table->s->fields ; ++i)
+ {
+ if ((*include_type)(binlog_type_info_array, m_table->field[i]))
+ {
+ collation_map[binlog_type_info_array[i].m_cs->number]++;
+ char_col_cnt++;
+ }
+ }
+
+ if (char_col_cnt == 0)
+ return false;
+
+ /* Find the most used collation */
+ uint most_used_collation= 0;
+ uint most_used_count= 0;
+ for (std::map<uint, uint>::iterator it= collation_map.begin();
+ it != collation_map.end(); it++)
+ {
+ if (it->second > most_used_count)
+ {
+ most_used_count= it->second;
+ most_used_collation= it->first;
+ }
+ }
+
+ /*
+ Comparing length of COLUMN_CHARSET field and COLUMN_CHARSET_WITH_DEFAULT
+ field to decide which field should be logged.
+
+ Length of COLUMN_CHARSET = character column count * collation id size.
+ Length of COLUMN_CHARSET_WITH_DEFAULT =
+ default collation_id size + count of columns not use default charset *
+ (column index size + collation id size)
+
+ Assume column index just uses 1 byte and collation number also uses 1 byte.
+ */
+ if (char_col_cnt * 1 < (1 + (char_col_cnt - most_used_count) * 2))
+ {
+ StringBuffer<512> buf;
+
+ /*
+ Stores character set information into COLUMN_CHARSET format,
+ character sets of all columns are stored one by one.
+ -----------------------------------------
+ | Charset number | .... |Charset number |
+ -----------------------------------------
+ */
+ for (unsigned int i= 0 ; i < m_table->s->fields ; ++i)
+ {
+ if (include_type(binlog_type_info_array, m_table->field[i]))
+ store_compressed_length(buf, binlog_type_info_array[i].m_cs->number);
+ }
+ return write_tlv_field(m_metadata_buf, column_charset_type, buf);
+ }
+ else
+ {
+ StringBuffer<512> buf;
+ uint char_column_index= 0;
+ uint default_collation= most_used_collation;
+
+ /*
+ Stores character set information into DEFAULT_CHARSET format,
+ First stores the default character set, and then stores the character
+ sets different to default character with their column index one by one.
+ --------------------------------------------------------
+ | Default Charset | Col Index | Charset number | ... |
+ --------------------------------------------------------
+ */
+
+ // Store the default collation number
+ store_compressed_length(buf, default_collation);
+
+ for (unsigned int i= 0 ; i < m_table->s->fields ; ++i)
+ {
+ if (include_type(binlog_type_info_array, m_table->field[i]))
+ {
+ Field_str *field= dynamic_cast<Field_str *>(m_table->field[i]);
+
+ if (field->charset()->number != default_collation)
+ {
+ store_compressed_length(buf, char_column_index);
+ store_compressed_length(buf, field->charset()->number);
+ }
+ char_column_index++;
+ }
+ }
+ return write_tlv_field(m_metadata_buf, default_charset_type, buf);
+ }
+}
+
+bool Table_map_log_event::init_column_name_field()
+{
+ StringBuffer<2048> buf;
+
+ for (unsigned int i= 0 ; i < m_table->s->fields ; ++i)
+ {
+ size_t len= m_table->field[i]->field_name.length;
+
+ store_compressed_length(buf, len);
+ buf.append(m_table->field[i]->field_name.str, len);
+ }
+ return write_tlv_field(m_metadata_buf, COLUMN_NAME, buf);
+}
+
+bool Table_map_log_event::init_set_str_value_field()
+{
+ StringBuffer<1024> buf;
+ TYPELIB *typelib;
+
+ /*
+ SET string values are stored in the same format:
+ ----------------------------------------------
+ | Value number | value1 len | value 1| .... | // first SET column
+ ----------------------------------------------
+ | Value number | value1 len | value 1| .... | // second SET column
+ ----------------------------------------------
+ */
+ for (unsigned int i= 0 ; i < m_table->s->fields ; ++i)
+ {
+ if ((typelib= binlog_type_info_array[i].m_set_typelib))
+ {
+ store_compressed_length(buf, typelib->count);
+ for (unsigned int i= 0; i < typelib->count; i++)
+ {
+ store_compressed_length(buf, typelib->type_lengths[i]);
+ buf.append(typelib->type_names[i], typelib->type_lengths[i]);
+ }
+ }
+ }
+ if (buf.length() > 0)
+ return write_tlv_field(m_metadata_buf, SET_STR_VALUE, buf);
+ return false;
+}
+
+bool Table_map_log_event::init_enum_str_value_field()
+{
+ StringBuffer<1024> buf;
+ TYPELIB *typelib;
+
+ /* ENUM is same to SET columns, see comment in init_set_str_value_field */
+ for (unsigned int i= 0 ; i < m_table->s->fields ; ++i)
+ {
+ if ((typelib= binlog_type_info_array[i].m_enum_typelib))
+ {
+ store_compressed_length(buf, typelib->count);
+ for (unsigned int i= 0; i < typelib->count; i++)
+ {
+ store_compressed_length(buf, typelib->type_lengths[i]);
+ buf.append(typelib->type_names[i], typelib->type_lengths[i]);
+ }
+ }
+ }
+
+ if (buf.length() > 0)
+ return write_tlv_field(m_metadata_buf, ENUM_STR_VALUE, buf);
+ return false;
+}
+
+bool Table_map_log_event::init_geometry_type_field()
+{
+ StringBuffer<256> buf;
+ uint geom_type;
+
+ /* Geometry type of geometry columns is stored one by one as packed length */
+ for (unsigned int i= 0 ; i < m_table->s->fields ; ++i)
+ {
+ if (binlog_type_info_array[i].m_type_code == MYSQL_TYPE_GEOMETRY)
+ {
+ geom_type= binlog_type_info_array[i].m_geom_type;
+ DBUG_EXECUTE_IF("inject_invalid_geometry_type", geom_type= 100;);
+ store_compressed_length(buf, geom_type);
+ }
+ }
+
+ if (buf.length() > 0)
+ return write_tlv_field(m_metadata_buf, GEOMETRY_TYPE, buf);
+ return false;
+}
+
+bool Table_map_log_event::init_primary_key_field()
+{
+ DBUG_EXECUTE_IF("simulate_init_primary_key_field_error", return true;);
+
+ if (unlikely(m_table->s->primary_key == MAX_KEY))
+ return false;
+
+ // If any key column uses prefix like KEY(c1(10)) */
+ bool has_prefix= false;
+ KEY *pk= m_table->key_info + m_table->s->primary_key;
+
+ DBUG_ASSERT(pk->user_defined_key_parts > 0);
+
+ /* Check if any key column uses prefix */
+ for (uint i= 0; i < pk->user_defined_key_parts; i++)
+ {
+ KEY_PART_INFO *key_part= pk->key_part+i;
+ if (key_part->length != m_table->field[key_part->fieldnr-1]->key_length())
+ {
+ has_prefix= true;
+ break;
+ }
+ }
+
+ StringBuffer<128> buf;
+
+ if (!has_prefix)
+ {
+ /* Index of PK columns are stored one by one. */
+ for (uint i= 0; i < pk->user_defined_key_parts; i++)
+ {
+ KEY_PART_INFO *key_part= pk->key_part+i;
+ store_compressed_length(buf, key_part->fieldnr-1);
+ }
+ return write_tlv_field(m_metadata_buf, SIMPLE_PRIMARY_KEY, buf);
+ }
+ else
+ {
+ /* Index of PK columns are stored with a prefix length one by one. */
+ for (uint i= 0; i < pk->user_defined_key_parts; i++)
+ {
+ KEY_PART_INFO *key_part= pk->key_part+i;
+ size_t prefix= 0;
+
+ store_compressed_length(buf, key_part->fieldnr-1);
+
+ // Store character length but not octet length
+ if (key_part->length != m_table->field[key_part->fieldnr-1]->key_length())
+ prefix= key_part->length / key_part->field->charset()->mbmaxlen;
+ store_compressed_length(buf, prefix);
+ }
+ return write_tlv_field(m_metadata_buf, PRIMARY_KEY_WITH_PREFIX, buf);
+ }
+}
+
+#if defined(HAVE_REPLICATION)
+/*
+ Print some useful information for the SHOW BINARY LOG information
+ field.
+ */
+
+void Table_map_log_event::pack_info(Protocol *protocol)
+{
+ char buf[256];
+ size_t bytes= my_snprintf(buf, sizeof(buf),
+ "table_id: %llu (%s.%s)",
+ m_table_id, m_dbnam, m_tblnam);
+ protocol->store(buf, bytes, &my_charset_bin);
+}
+#endif
+
+
+/**************************************************************************
+ Write_rows_log_event member functions
+**************************************************************************/
+
+/*
+ Constructor used to build an event for writing to the binary log.
+ */
+Write_rows_log_event::Write_rows_log_event(THD *thd_arg, TABLE *tbl_arg,
+ ulong tid_arg,
+ bool is_transactional)
+ :Rows_log_event(thd_arg, tbl_arg, tid_arg, tbl_arg->rpl_write_set,
+ is_transactional, WRITE_ROWS_EVENT_V1)
+{
+}
+
+Write_rows_compressed_log_event::Write_rows_compressed_log_event(
+ THD *thd_arg,
+ TABLE *tbl_arg,
+ ulong tid_arg,
+ bool is_transactional)
+ : Write_rows_log_event(thd_arg, tbl_arg, tid_arg, is_transactional)
+{
+ m_type = WRITE_ROWS_COMPRESSED_EVENT_V1;
+}
+
+bool Write_rows_compressed_log_event::write()
+{
+ return Rows_log_event::write_compressed();
+}
+
+
+#if defined(HAVE_REPLICATION)
+int
+Write_rows_log_event::do_before_row_operations(const Slave_reporting_capability *const)
+{
+ int error= 0;
+
+ /*
+ Increment the global status insert count variable
+ */
+ if (get_flags(STMT_END_F))
+ status_var_increment(thd->status_var.com_stat[SQLCOM_INSERT]);
+
+ /**
+ todo: to introduce a property for the event (handler?) which forces
+ applying the event in the replace (idempotent) fashion.
+ */
+ if (slave_exec_mode == SLAVE_EXEC_MODE_IDEMPOTENT)
+ {
+ /*
+ We are using REPLACE semantics and not INSERT IGNORE semantics
+ when writing rows, that is: new rows replace old rows. We need to
+ inform the storage engine that it should use this behaviour.
+ */
+
+ /* Tell the storage engine that we are using REPLACE semantics. */
+ thd->lex->duplicates= DUP_REPLACE;
+
+ /*
+ Pretend we're executing a REPLACE command: this is needed for
+ InnoDB since it is not (properly) checking the lex->duplicates flag.
+ */
+ thd->lex->sql_command= SQLCOM_REPLACE;
+ /*
+ Do not raise the error flag in case of hitting to an unique attribute
+ */
+ m_table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
+ /*
+ The following is needed in case if we have AFTER DELETE triggers.
+ */
+ m_table->file->extra(HA_EXTRA_WRITE_CAN_REPLACE);
+ m_table->file->extra(HA_EXTRA_IGNORE_NO_KEY);
+ }
+ if (slave_run_triggers_for_rbr && !master_had_triggers && m_table->triggers )
+ m_table->prepare_triggers_for_insert_stmt_or_event();
+
+ /* Honor next number column if present */
+ m_table->next_number_field= m_table->found_next_number_field;
+ /*
+ * Fixed Bug#45999, In RBR, Store engine of Slave auto-generates new
+ * sequence numbers for auto_increment fields if the values of them are 0.
+ * If generateing a sequence number is decided by the values of
+ * table->auto_increment_field_not_null and SQL_MODE(if includes
+ * MODE_NO_AUTO_VALUE_ON_ZERO) in update_auto_increment function.
+ * SQL_MODE of slave sql thread is always consistency with master's.
+ * In RBR, auto_increment fields never are NULL, except if the auto_inc
+ * column exists only on the slave side (i.e., in an extra column
+ * on the slave's table).
+ */
+ if (!is_auto_inc_in_extra_columns())
+ m_table->auto_increment_field_not_null= TRUE;
+ else
+ {
+ /*
+ Here we have checked that there is an extra field
+ on this server's table that has an auto_inc column.
+
+ Mark that the auto_increment field is null and mark
+ the read and write set bits.
+
+ (There can only be one AUTO_INC column, it is always
+ indexed and it cannot have a DEFAULT value).
+ */
+ m_table->auto_increment_field_not_null= FALSE;
+ m_table->mark_auto_increment_column();
+ }
+
+ return error;
+}
+
+int
+Write_rows_log_event::do_after_row_operations(const Slave_reporting_capability *const,
+ int error)
+{
+ int local_error= 0;
+
+ /**
+ Clear the write_set bit for auto_inc field that only
+ existed on the destination table as an extra column.
+ */
+ if (is_auto_inc_in_extra_columns())
+ {
+ bitmap_clear_bit(m_table->rpl_write_set,
+ m_table->next_number_field->field_index);
+ bitmap_clear_bit(m_table->read_set,
+ m_table->next_number_field->field_index);
+
+ if (get_flags(STMT_END_F))
+ m_table->file->ha_release_auto_increment();
+ }
+ m_table->next_number_field=0;
+ m_table->auto_increment_field_not_null= FALSE;
+ if (slave_exec_mode == SLAVE_EXEC_MODE_IDEMPOTENT)
+ {
+ m_table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
+ m_table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE);
+ /*
+ resetting the extra with
+ table->file->extra(HA_EXTRA_NO_IGNORE_NO_KEY);
+ fires bug#27077
+ explanation: file->reset() performs this duty
+ ultimately. Still todo: fix
+ */
+ }
+ if (unlikely((local_error= m_table->file->ha_end_bulk_insert())))
+ {
+ m_table->file->print_error(local_error, MYF(0));
+ }
+ return error? error : local_error;
+}
+
+bool Rows_log_event::process_triggers(trg_event_type event,
+ trg_action_time_type time_type,
+ bool old_row_is_record1)
+{
+ bool result;
+ DBUG_ENTER("Rows_log_event::process_triggers");
+ m_table->triggers->mark_fields_used(event);
+ if (slave_run_triggers_for_rbr == SLAVE_RUN_TRIGGERS_FOR_RBR_YES)
+ {
+ tmp_disable_binlog(thd); /* Do not replicate the low-level changes. */
+ result= m_table->triggers->process_triggers(thd, event,
+ time_type, old_row_is_record1);
+ reenable_binlog(thd);
+ }
+ else
+ result= m_table->triggers->process_triggers(thd, event,
+ time_type, old_row_is_record1);
+
+ DBUG_RETURN(result);
+}
+/*
+ Check if there are more UNIQUE keys after the given key.
+*/
+static int
+last_uniq_key(TABLE *table, uint keyno)
+{
+ while (++keyno < table->s->keys)
+ if (table->key_info[keyno].flags & HA_NOSAME)
+ return 0;
+ return 1;
+}
+
+/**
+ Check if an error is a duplicate key error.
+
+ This function is used to check if an error code is one of the
+ duplicate key error, i.e., and error code for which it is sensible
+ to do a <code>get_dup_key()</code> to retrieve the duplicate key.
+
+ @param errcode The error code to check.
+
+ @return <code>true</code> if the error code is such that
+ <code>get_dup_key()</code> will return true, <code>false</code>
+ otherwise.
+ */
+bool
+is_duplicate_key_error(int errcode)
+{
+ switch (errcode)
+ {
+ case HA_ERR_FOUND_DUPP_KEY:
+ case HA_ERR_FOUND_DUPP_UNIQUE:
+ return true;
+ }
+ return false;
+}
+
+/**
+ Write the current row into event's table.
+
+ The row is located in the row buffer, pointed by @c m_curr_row member.
+ Number of columns of the row is stored in @c m_width member (it can be
+ different from the number of columns in the table to which we insert).
+ Bitmap @c m_cols indicates which columns are present in the row. It is assumed
+ that event's table is already open and pointed by @c m_table.
+
+ If the same record already exists in the table it can be either overwritten
+ or an error is reported depending on the value of @c overwrite flag
+ (error reporting not yet implemented). Note that the matching record can be
+ different from the row we insert if we use primary keys to identify records in
+ the table.
+
+ The row to be inserted can contain values only for selected columns. The
+ missing columns are filled with default values using @c prepare_record()
+ function. If a matching record is found in the table and @c overwritte is
+ true, the missing columns are taken from it.
+
+ @param rli Relay log info (needed for row unpacking).
+ @param overwrite
+ Shall we overwrite if the row already exists or signal
+ error (currently ignored).
+
+ @returns Error code on failure, 0 on success.
+
+ This method, if successful, sets @c m_curr_row_end pointer to point at the
+ next row in the rows buffer. This is done when unpacking the row to be
+ inserted.
+
+ @note If a matching record is found, it is either updated using
+ @c ha_update_row() or first deleted and then new record written.
+*/
+
+int
+Rows_log_event::write_row(rpl_group_info *rgi,
+ const bool overwrite)
+{
+ DBUG_ENTER("write_row");
+ DBUG_ASSERT(m_table != NULL && thd != NULL);
+
+ TABLE *table= m_table; // pointer to event's table
+ int error;
+ int UNINIT_VAR(keynum);
+ const bool invoke_triggers=
+ slave_run_triggers_for_rbr && !master_had_triggers && table->triggers;
+ auto_afree_ptr<char> key(NULL);
+
+ prepare_record(table, m_width, true);
+
+ /* unpack row into table->record[0] */
+ if (unlikely((error= unpack_current_row(rgi))))
+ {
+ table->file->print_error(error, MYF(0));
+ DBUG_RETURN(error);
+ }
+
+ if (m_curr_row == m_rows_buf && !invoke_triggers)
+ {
+ /*
+ This table has no triggers so we can do bulk insert.
+
+ 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.
+ */
+ /* 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));
+ ha_rows 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);
+ }
+
+ /*
+ Explicitly set the auto_inc to null to make sure that
+ it gets an auto_generated value.
+ */
+ if (is_auto_inc_in_extra_columns())
+ m_table->next_number_field->set_null();
+
+ DBUG_DUMP("record[0]", table->record[0], table->s->reclength);
+ DBUG_PRINT_BITSET("debug", "rpl_write_set: %s", table->rpl_write_set);
+ DBUG_PRINT_BITSET("debug", "read_set: %s", table->read_set);
+
+ if (invoke_triggers &&
+ unlikely(process_triggers(TRG_EVENT_INSERT, TRG_ACTION_BEFORE, TRUE)))
+ {
+ DBUG_RETURN(HA_ERR_GENERIC); // in case if error is not set yet
+ }
+
+ // Handle INSERT.
+ if (table->versioned(VERS_TIMESTAMP))
+ {
+ ulong sec_part;
+ bitmap_set_bit(table->read_set, table->vers_start_field()->field_index);
+ table->file->column_bitmaps_signal();
+ // Check whether a row came from unversioned table and fix vers fields.
+ if (table->vers_start_field()->get_timestamp(&sec_part) == 0 && sec_part == 0)
+ table->vers_update_fields();
+ }
+
+ /*
+ Try to write record. If a corresponding record already exists in the table,
+ we try to change it using ha_update_row() if possible. Otherwise we delete
+ it and repeat the whole process again.
+
+ TODO: Add safety measures against infinite looping.
+ */
+
+ if (table->s->sequence)
+ error= update_sequence();
+ else while (unlikely(error= table->file->ha_write_row(table->record[0])))
+ {
+ if (error == HA_ERR_LOCK_DEADLOCK ||
+ error == HA_ERR_LOCK_WAIT_TIMEOUT ||
+ (keynum= table->file->get_dup_key(error)) < 0 ||
+ !overwrite)
+ {
+ DBUG_PRINT("info",("get_dup_key returns %d)", keynum));
+ /*
+ Deadlock, waiting for lock or just an error from the handler
+ such as HA_ERR_FOUND_DUPP_KEY when overwrite is false.
+ Retrieval of the duplicate key number may fail
+ - either because the error was not "duplicate key" error
+ - or because the information which key is not available
+ */
+ table->file->print_error(error, MYF(0));
+ DBUG_RETURN(error);
+ }
+ /*
+ We need to retrieve the old row into record[1] to be able to
+ either update or delete the offending record. We either:
+
+ - use rnd_pos() with a row-id (available as dupp_row) to the
+ offending row, if that is possible (MyISAM and Blackhole), or else
+
+ - use index_read_idx() with the key that is duplicated, to
+ retrieve the offending row.
+ */
+ if (table->file->ha_table_flags() & HA_DUPLICATE_POS)
+ {
+ DBUG_PRINT("info",("Locating offending record using rnd_pos()"));
+
+ if ((error= table->file->ha_rnd_init_with_error(0)))
+ {
+ DBUG_RETURN(error);
+ }
+
+ error= table->file->ha_rnd_pos(table->record[1], table->file->dup_ref);
+ if (unlikely(error))
+ {
+ DBUG_PRINT("info",("rnd_pos() returns error %d",error));
+ table->file->print_error(error, MYF(0));
+ DBUG_RETURN(error);
+ }
+ table->file->ha_rnd_end();
+ }
+ else
+ {
+ DBUG_PRINT("info",("Locating offending record using index_read_idx()"));
+
+ if (table->file->extra(HA_EXTRA_FLUSH_CACHE))
+ {
+ DBUG_PRINT("info",("Error when setting HA_EXTRA_FLUSH_CACHE"));
+ DBUG_RETURN(my_errno);
+ }
+
+ if (key.get() == NULL)
+ {
+ key.assign(static_cast<char*>(my_alloca(table->s->max_unique_length)));
+ if (key.get() == NULL)
+ {
+ DBUG_PRINT("info",("Can't allocate key buffer"));
+ DBUG_RETURN(ENOMEM);
+ }
+ }
+
+ key_copy((uchar*)key.get(), table->record[0], table->key_info + keynum,
+ 0);
+ error= table->file->ha_index_read_idx_map(table->record[1], keynum,
+ (const uchar*)key.get(),
+ HA_WHOLE_KEY,
+ HA_READ_KEY_EXACT);
+ if (unlikely(error))
+ {
+ DBUG_PRINT("info",("index_read_idx() returns %s", HA_ERR(error)));
+ table->file->print_error(error, MYF(0));
+ DBUG_RETURN(error);
+ }
+ }
+
+ /*
+ Now, record[1] should contain the offending row. That
+ will enable us to update it or, alternatively, delete it (so
+ that we can insert the new row afterwards).
+ */
+
+ /*
+ If row is incomplete we will use the record found to fill
+ missing columns.
+ */
+ if (!get_flags(COMPLETE_ROWS_F))
+ {
+ restore_record(table,record[1]);
+ error= unpack_current_row(rgi);
+ }
+
+ 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);
+
+ /*
+ REPLACE is defined as either INSERT or DELETE + INSERT. If
+ possible, we can replace it with an UPDATE, but that will not
+ work on InnoDB if FOREIGN KEY checks are necessary.
+
+ I (Matz) am not sure of the reason for the last_uniq_key()
+ check as, but I'm guessing that it's something along the
+ following lines.
+
+ Suppose that we got the duplicate key to be a key that is not
+ the last unique key for the table and we perform an update:
+ then there might be another key for which the unique check will
+ fail, so we're better off just deleting the row and inserting
+ the correct row.
+
+ Additionally we don't use UPDATE if rbr triggers should be invoked -
+ when triggers are used we want a simple and predictable execution path.
+ */
+ if (last_uniq_key(table, keynum) && !invoke_triggers &&
+ !table->file->referenced_by_foreign_key())
+ {
+ DBUG_PRINT("info",("Updating row using ha_update_row()"));
+ error= table->file->ha_update_row(table->record[1],
+ table->record[0]);
+ switch (error) {
+
+ case HA_ERR_RECORD_IS_THE_SAME:
+ DBUG_PRINT("info",("ignoring HA_ERR_RECORD_IS_THE_SAME error from"
+ " ha_update_row()"));
+ error= 0;
+
+ case 0:
+ break;
+
+ default:
+ DBUG_PRINT("info",("ha_update_row() returns error %d",error));
+ table->file->print_error(error, MYF(0));
+ }
+
+ DBUG_RETURN(error);
+ }
+ else
+ {
+ DBUG_PRINT("info",("Deleting offending row and trying to write new one again"));
+ if (invoke_triggers &&
+ unlikely(process_triggers(TRG_EVENT_DELETE, TRG_ACTION_BEFORE,
+ TRUE)))
+ error= HA_ERR_GENERIC; // in case if error is not set yet
+ else
+ {
+ if (unlikely((error= table->file->ha_delete_row(table->record[1]))))
+ {
+ DBUG_PRINT("info",("ha_delete_row() returns error %d",error));
+ table->file->print_error(error, MYF(0));
+ DBUG_RETURN(error);
+ }
+ if (invoke_triggers &&
+ unlikely(process_triggers(TRG_EVENT_DELETE, TRG_ACTION_AFTER,
+ TRUE)))
+ DBUG_RETURN(HA_ERR_GENERIC); // in case if error is not set yet
+ }
+ /* Will retry ha_write_row() with the offending row removed. */
+ }
+ }
+
+ if (invoke_triggers &&
+ unlikely(process_triggers(TRG_EVENT_INSERT, TRG_ACTION_AFTER, TRUE)))
+ error= HA_ERR_GENERIC; // in case if error is not set yet
+
+ DBUG_RETURN(error);
+}
+
+
+int Rows_log_event::update_sequence()
+{
+ TABLE *table= m_table; // pointer to event's table
+
+ if (!bitmap_is_set(table->rpl_write_set, MIN_VALUE_FIELD_NO))
+ {
+ /* This event come from a setval function executed on the master.
+ Update the sequence next_number and round, like we do with setval()
+ */
+ my_bitmap_map *old_map= dbug_tmp_use_all_columns(table,
+ table->read_set);
+ longlong nextval= table->field[NEXT_FIELD_NO]->val_int();
+ longlong round= table->field[ROUND_FIELD_NO]->val_int();
+ dbug_tmp_restore_column_map(table->read_set, old_map);
+
+ return table->s->sequence->set_value(table, nextval, round, 0) > 0;
+ }
+
+ /*
+ Update all fields in table and update the active sequence, like with
+ ALTER SEQUENCE
+ */
+ return table->file->ha_write_row(table->record[0]);
+}
+
+
+#endif
+
+
+#if defined(HAVE_REPLICATION)
+
+int
+Write_rows_log_event::do_exec_row(rpl_group_info *rgi)
+{
+ DBUG_ASSERT(m_table != NULL);
+ const char *tmp= thd->get_proc_info();
+ const char *message= "Write_rows_log_event::write_row()";
+ int error;
+
+#ifdef WSREP_PROC_INFO
+ my_snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1,
+ "Write_rows_log_event::write_row(%lld)",
+ (long long) wsrep_thd_trx_seqno(thd));
+ message= thd->wsrep_info;
+#endif /* WSREP_PROC_INFO */
+
+ thd_proc_info(thd, message);
+ error= write_row(rgi, slave_exec_mode == SLAVE_EXEC_MODE_IDEMPOTENT);
+ thd_proc_info(thd, tmp);
+
+ if (unlikely(error) && unlikely(!thd->is_error()))
+ {
+ DBUG_ASSERT(0);
+ my_error(ER_UNKNOWN_ERROR, MYF(0));
+ }
+
+ return error;
+}
+
+#endif /* defined(HAVE_REPLICATION) */
+
+
+#if defined(HAVE_REPLICATION)
+uint8 Write_rows_log_event::get_trg_event_map()
+{
+ return trg2bit(TRG_EVENT_INSERT) | trg2bit(TRG_EVENT_UPDATE) |
+ trg2bit(TRG_EVENT_DELETE);
+}
+#endif
+
+/**************************************************************************
+ Delete_rows_log_event member functions
+**************************************************************************/
+
+#if defined(HAVE_REPLICATION)
+/*
+ Compares table->record[0] and table->record[1]
+
+ Returns TRUE if different.
+*/
+static bool record_compare(TABLE *table)
+{
+ bool result= FALSE;
+ /**
+ Compare full record only if:
+ - there are no blob fields (otherwise we would also need
+ to compare blobs contents as well);
+ - there are no varchar fields (otherwise we would also need
+ to compare varchar contents as well);
+ - there are no null fields, otherwise NULLed fields
+ contents (i.e., the don't care bytes) may show arbitrary
+ values, depending on how each engine handles internally.
+ */
+ if ((table->s->blob_fields +
+ table->s->varchar_fields +
+ table->s->null_fields) == 0)
+ {
+ result= cmp_record(table,record[1]);
+ goto record_compare_exit;
+ }
+
+ /* Compare null bits */
+ if (memcmp(table->null_flags,
+ table->null_flags+table->s->rec_buff_length,
+ table->s->null_bytes))
+ {
+ result= TRUE; // Diff in NULL value
+ goto record_compare_exit;
+ }
+
+ /* Compare fields */
+ for (Field **ptr=table->field ; *ptr ; ptr++)
+ {
+ if (table->versioned() && (*ptr)->vers_sys_field())
+ {
+ continue;
+ }
+ /**
+ We only compare field contents that are not null.
+ NULL fields (i.e., their null bits) were compared
+ earlier.
+ */
+ if (!(*(ptr))->is_null())
+ {
+ if ((*ptr)->cmp_binary_offset(table->s->rec_buff_length))
+ {
+ result= TRUE;
+ goto record_compare_exit;
+ }
+ }
+ }
+
+record_compare_exit:
+ return result;
+}
+
+
+/**
+ Find the best key to use when locating the row in @c find_row().
+
+ A primary key is preferred if it exists; otherwise a unique index is
+ preferred. Else we pick the index with the smalles rec_per_key value.
+
+ If a suitable key is found, set @c m_key, @c m_key_nr and @c m_key_info
+ member fields appropriately.
+
+ @returns Error code on failure, 0 on success.
+*/
+int Rows_log_event::find_key()
+{
+ uint i, best_key_nr, last_part;
+ KEY *key, *UNINIT_VAR(best_key);
+ ulong UNINIT_VAR(best_rec_per_key), tmp;
+ DBUG_ENTER("Rows_log_event::find_key");
+ DBUG_ASSERT(m_table);
+
+ best_key_nr= MAX_KEY;
+
+ /*
+ Keys are sorted so that any primary key is first, followed by unique keys,
+ followed by any other. So we will automatically pick the primary key if
+ it exists.
+ */
+ for (i= 0, key= m_table->key_info; i < m_table->s->keys; i++, key++)
+ {
+ if (!m_table->s->keys_in_use.is_set(i))
+ continue;
+ /*
+ We cannot use a unique key with NULL-able columns to uniquely identify
+ a row (but we can still select it for range scan below if nothing better
+ is available).
+ */
+ if ((key->flags & (HA_NOSAME | HA_NULL_PART_KEY)) == HA_NOSAME)
+ {
+ best_key_nr= i;
+ best_key= key;
+ break;
+ }
+ /*
+ We can only use a non-unique key if it allows range scans (ie. skip
+ FULLTEXT indexes and such).
+ */
+ last_part= key->user_defined_key_parts - 1;
+ DBUG_PRINT("info", ("Index %s rec_per_key[%u]= %lu",
+ key->name.str, last_part, key->rec_per_key[last_part]));
+ if (!(m_table->file->index_flags(i, last_part, 1) & HA_READ_NEXT))
+ continue;
+
+ tmp= key->rec_per_key[last_part];
+ if (best_key_nr == MAX_KEY || (tmp > 0 && tmp < best_rec_per_key))
+ {
+ best_key_nr= i;
+ best_key= key;
+ best_rec_per_key= tmp;
+ }
+ }
+
+ if (best_key_nr == MAX_KEY)
+ {
+ m_key_info= NULL;
+ DBUG_RETURN(0);
+ }
+
+ // Allocate buffer for key searches
+ m_key= (uchar *) my_malloc(best_key->key_length, MYF(MY_WME));
+ if (m_key == NULL)
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ m_key_info= best_key;
+ m_key_nr= best_key_nr;
+
+ DBUG_RETURN(0);;
+}
+
+
+/*
+ Check if we are already spending too much time on this statement.
+ if we are, warn user that it might be because table does not have
+ a PK, but only if the warning was not printed before for this STMT.
+
+ @param type The event type code.
+ @param table_name The name of the table that the slave is
+ operating.
+ @param is_index_scan States whether the slave is doing an index scan
+ or not.
+ @param rli The relay metadata info.
+*/
+static inline
+void issue_long_find_row_warning(Log_event_type type,
+ const char *table_name,
+ bool is_index_scan,
+ rpl_group_info *rgi)
+{
+ if ((global_system_variables.log_warnings > 1 &&
+ !rgi->is_long_find_row_note_printed()))
+ {
+ ulonglong now= microsecond_interval_timer();
+ ulonglong stmt_ts= rgi->get_row_stmt_start_timestamp();
+
+ DBUG_EXECUTE_IF("inject_long_find_row_note",
+ stmt_ts-=(LONG_FIND_ROW_THRESHOLD*2*HRTIME_RESOLUTION););
+
+ longlong delta= (now - stmt_ts)/HRTIME_RESOLUTION;
+
+ if (delta > LONG_FIND_ROW_THRESHOLD)
+ {
+ rgi->set_long_find_row_note_printed();
+ const char* evt_type= LOG_EVENT_IS_DELETE_ROW(type) ? " DELETE" : "n UPDATE";
+ const char* scan_type= is_index_scan ? "scanning an index" : "scanning the table";
+
+ sql_print_information("The slave is applying a ROW event on behalf of a%s statement "
+ "on table %s and is currently taking a considerable amount "
+ "of time (%lld seconds). This is due to the fact that it is %s "
+ "while looking up records to be processed. Consider adding a "
+ "primary key (or unique key) to the table to improve "
+ "performance.",
+ evt_type, table_name, (long) delta, scan_type);
+ }
+ }
+}
+
+
+/*
+ HA_ERR_KEY_NOT_FOUND is a fatal error normally, but it's an expected
+ error in speculate optimistic mode, so use something non-fatal instead
+*/
+static int row_not_found_error(rpl_group_info *rgi)
+{
+ return rgi->speculation != rpl_group_info::SPECULATE_OPTIMISTIC
+ ? HA_ERR_KEY_NOT_FOUND : HA_ERR_RECORD_CHANGED;
+}
+
+/**
+ Locate the current row in event's table.
+
+ The current row is pointed by @c m_curr_row. Member @c m_width tells
+ how many columns are there in the row (this can be differnet from
+ the number of columns in the table). It is assumed that event's
+ table is already open and pointed by @c m_table.
+
+ If a corresponding record is found in the table it is stored in
+ @c m_table->record[0]. Note that when record is located based on a primary
+ key, it is possible that the record found differs from the row being located.
+
+ If no key is specified or table does not have keys, a table scan is used to
+ find the row. In that case the row should be complete and contain values for
+ all columns. However, it can still be shorter than the table, i.e. the table
+ can contain extra columns not present in the row. It is also possible that
+ the table has fewer columns than the row being located.
+
+ @returns Error code on failure, 0 on success.
+
+ @post In case of success @c m_table->record[0] contains the record found.
+ Also, the internal "cursor" of the table is positioned at the record found.
+
+ @note If the engine allows random access of the records, a combination of
+ @c position() and @c rnd_pos() will be used.
+
+ Note that one MUST call ha_index_or_rnd_end() after this function if
+ it returns 0 as we must leave the row position in the handler intact
+ for any following update/delete command.
+*/
+
+int Rows_log_event::find_row(rpl_group_info *rgi)
+{
+ DBUG_ENTER("Rows_log_event::find_row");
+
+ DBUG_ASSERT(m_table && m_table->in_use != NULL);
+
+ TABLE *table= m_table;
+ int error= 0;
+ bool is_table_scan= false, is_index_scan= false;
+
+ /*
+ rpl_row_tabledefs.test specifies that
+ if the extra field on the slave does not have a default value
+ and this is okay with Delete or Update events.
+ Todo: fix wl3228 hld that requires defauls for all types of events
+ */
+
+ prepare_record(table, m_width, FALSE);
+ error= unpack_current_row(rgi);
+
+ m_vers_from_plain= false;
+ if (table->versioned())
+ {
+ Field *row_end= table->vers_end_field();
+ DBUG_ASSERT(table->read_set);
+ bitmap_set_bit(table->read_set, row_end->field_index);
+ // check whether master table is unversioned
+ if (row_end->val_int() == 0)
+ {
+ bitmap_set_bit(table->write_set, row_end->field_index);
+ // Plain source table may have a PRIMARY KEY. And row_end is always
+ // a part of PRIMARY KEY. Set it to max value for engine to find it in
+ // index. Needed for an UPDATE/DELETE cases.
+ table->vers_end_field()->set_max();
+ m_vers_from_plain= true;
+ }
+ table->file->column_bitmaps_signal();
+ }
+
+ DBUG_PRINT("info",("looking for the following record"));
+ DBUG_DUMP("record[0]", table->record[0], table->s->reclength);
+
+ if ((table->file->ha_table_flags() & HA_PRIMARY_KEY_REQUIRED_FOR_POSITION) &&
+ table->s->primary_key < MAX_KEY)
+ {
+ /*
+ Use a more efficient method to fetch the record given by
+ table->record[0] if the engine allows it. We first compute a
+ row reference using the position() member function (it will be
+ stored in table->file->ref) and the use rnd_pos() to position
+ the "cursor" (i.e., record[0] in this case) at the correct row.
+
+ TODO: Add a check that the correct record has been fetched by
+ comparing with the original record. Take into account that the
+ record on the master and slave can be of different
+ length. Something along these lines should work:
+
+ ADD>>> store_record(table,record[1]);
+ int error= table->file->ha_rnd_pos(table->record[0],
+ table->file->ref);
+ ADD>>> DBUG_ASSERT(memcmp(table->record[1], table->record[0],
+ table->s->reclength) == 0);
+
+ */
+ int error;
+ DBUG_PRINT("info",("locating record using primary key (position)"));
+
+ error= table->file->ha_rnd_pos_by_record(table->record[0]);
+ if (unlikely(error))
+ {
+ DBUG_PRINT("info",("rnd_pos returns error %d",error));
+ if (error == HA_ERR_KEY_NOT_FOUND)
+ error= row_not_found_error(rgi);
+ table->file->print_error(error, MYF(0));
+ }
+ DBUG_RETURN(error);
+ }
+
+ // We can't use position() - try other methods.
+
+ /*
+ We need to retrieve all fields
+ TODO: Move this out from this function to main loop
+ */
+ table->use_all_columns();
+
+ /*
+ Save copy of the record in table->record[1]. It might be needed
+ later if linear search is used to find exact match.
+ */
+ store_record(table,record[1]);
+
+ if (m_key_info)
+ {
+ DBUG_PRINT("info",("locating record using key #%u [%s] (index_read)",
+ m_key_nr, m_key_info->name.str));
+ /* We use this to test that the correct key is used in test cases. */
+ DBUG_EXECUTE_IF("slave_crash_if_wrong_index",
+ if(0 != strcmp(m_key_info->name.str,"expected_key")) abort(););
+
+ /* The key is active: search the table using the index */
+ if (!table->file->inited &&
+ (error= table->file->ha_index_init(m_key_nr, FALSE)))
+ {
+ DBUG_PRINT("info",("ha_index_init returns error %d",error));
+ table->file->print_error(error, MYF(0));
+ goto end;
+ }
+
+ /* Fill key data for the row */
+
+ DBUG_ASSERT(m_key);
+ key_copy(m_key, table->record[0], m_key_info, 0);
+
+ /*
+ Don't print debug messages when running valgrind since they can
+ trigger false warnings.
+ */
+#ifndef HAVE_valgrind
+ DBUG_DUMP("key data", m_key, m_key_info->key_length);
+#endif
+
+ /*
+ We need to set the null bytes to ensure that the filler bit are
+ all set when returning. There are storage engines that just set
+ the necessary bits on the bytes and don't set the filler bits
+ correctly.
+ */
+ if (table->s->null_bytes > 0)
+ table->record[0][table->s->null_bytes - 1]|=
+ 256U - (1U << table->s->last_null_bit_pos);
+
+ if (unlikely((error= table->file->ha_index_read_map(table->record[0],
+ m_key,
+ HA_WHOLE_KEY,
+ HA_READ_KEY_EXACT))))
+ {
+ DBUG_PRINT("info",("no record matching the key found in the table"));
+ if (error == HA_ERR_KEY_NOT_FOUND)
+ error= row_not_found_error(rgi);
+ table->file->print_error(error, MYF(0));
+ table->file->ha_index_end();
+ goto end;
+ }
+
+ /*
+ Don't print debug messages when running valgrind since they can
+ trigger false warnings.
+ */
+#ifndef HAVE_valgrind
+ DBUG_PRINT("info",("found first matching record"));
+ DBUG_DUMP("record[0]", table->record[0], table->s->reclength);
+#endif
+ /*
+ Below is a minor "optimization". If the key (i.e., key number
+ 0) has the HA_NOSAME flag set, we know that we have found the
+ correct record (since there can be no duplicates); otherwise, we
+ have to compare the record with the one found to see if it is
+ the correct one.
+
+ CAVEAT! This behaviour is essential for the replication of,
+ e.g., the mysql.proc table since the correct record *shall* be
+ found using the primary key *only*. There shall be no
+ comparison of non-PK columns to decide if the correct record is
+ found. I can see no scenario where it would be incorrect to
+ chose the row to change only using a PK or an UNNI.
+ */
+ if (table->key_info->flags & HA_NOSAME)
+ {
+ /* Unique does not have non nullable part */
+ if (!(table->key_info->flags & (HA_NULL_PART_KEY)))
+ {
+ error= 0;
+ goto end;
+ }
+ else
+ {
+ KEY *keyinfo= table->key_info;
+ /*
+ Unique has nullable part. We need to check if there is any
+ field in the BI image that is null and part of UNNI.
+ */
+ bool null_found= FALSE;
+ for (uint i=0; i < keyinfo->user_defined_key_parts && !null_found; i++)
+ {
+ uint fieldnr= keyinfo->key_part[i].fieldnr - 1;
+ Field **f= table->field+fieldnr;
+ null_found= (*f)->is_null();
+ }
+
+ if (!null_found)
+ {
+ error= 0;
+ goto end;
+ }
+
+ /* else fall through to index scan */
+ }
+ }
+
+ is_index_scan=true;
+
+ /*
+ In case key is not unique, we still have to iterate over records found
+ and find the one which is identical to the row given. A copy of the
+ record we are looking for is stored in record[1].
+ */
+ DBUG_PRINT("info",("non-unique index, scanning it to find matching record"));
+ /* We use this to test that the correct key is used in test cases. */
+ DBUG_EXECUTE_IF("slave_crash_if_index_scan", abort(););
+
+ while (record_compare(table))
+ {
+ while ((error= table->file->ha_index_next(table->record[0])))
+ {
+ DBUG_PRINT("info",("no record matching the given row found"));
+ table->file->print_error(error, MYF(0));
+ table->file->ha_index_end();
+ goto end;
+ }
+ }
+ }
+ else
+ {
+ DBUG_PRINT("info",("locating record using table scan (rnd_next)"));
+ /* We use this to test that the correct key is used in test cases. */
+ DBUG_EXECUTE_IF("slave_crash_if_table_scan", abort(););
+
+ /* We don't have a key: search the table using rnd_next() */
+ if (unlikely((error= table->file->ha_rnd_init_with_error(1))))
+ {
+ DBUG_PRINT("info",("error initializing table scan"
+ " (ha_rnd_init returns %d)",error));
+ goto end;
+ }
+
+ is_table_scan= true;
+
+ /* Continue until we find the right record or have made a full loop */
+ do
+ {
+ error= table->file->ha_rnd_next(table->record[0]);
+
+ if (unlikely(error))
+ DBUG_PRINT("info", ("error: %s", HA_ERR(error)));
+ switch (error) {
+
+ case 0:
+ DBUG_DUMP("record found", table->record[0], table->s->reclength);
+ break;
+
+ case HA_ERR_END_OF_FILE:
+ DBUG_PRINT("info", ("Record not found"));
+ table->file->ha_rnd_end();
+ goto end;
+
+ default:
+ DBUG_PRINT("info", ("Failed to get next record"
+ " (rnd_next returns %d)",error));
+ table->file->print_error(error, MYF(0));
+ table->file->ha_rnd_end();
+ goto end;
+ }
+ }
+ while (record_compare(table));
+
+ /*
+ Note: above record_compare will take into accout all record fields
+ which might be incorrect in case a partial row was given in the event
+ */
+
+ DBUG_ASSERT(error == HA_ERR_END_OF_FILE || error == 0);
+ }
+
+end:
+ if (is_table_scan || is_index_scan)
+ issue_long_find_row_warning(get_general_type_code(), m_table->alias.c_ptr(),
+ is_index_scan, rgi);
+ table->default_column_bitmaps();
+ DBUG_RETURN(error);
+}
+
+#endif
+
+/*
+ Constructor used to build an event for writing to the binary log.
+ */
+
+Delete_rows_log_event::Delete_rows_log_event(THD *thd_arg, TABLE *tbl_arg,
+ ulong tid, bool is_transactional)
+ : Rows_log_event(thd_arg, tbl_arg, tid, tbl_arg->read_set, is_transactional,
+ DELETE_ROWS_EVENT_V1)
+{
+}
+
+Delete_rows_compressed_log_event::Delete_rows_compressed_log_event(
+ THD *thd_arg, TABLE *tbl_arg,
+ ulong tid_arg,
+ bool is_transactional)
+ : Delete_rows_log_event(thd_arg, tbl_arg, tid_arg, is_transactional)
+{
+ m_type= DELETE_ROWS_COMPRESSED_EVENT_V1;
+}
+
+bool Delete_rows_compressed_log_event::write()
+{
+ return Rows_log_event::write_compressed();
+}
+
+
+#if defined(HAVE_REPLICATION)
+
+int
+Delete_rows_log_event::do_before_row_operations(const Slave_reporting_capability *const)
+{
+ /*
+ Increment the global status delete count variable
+ */
+ if (get_flags(STMT_END_F))
+ status_var_increment(thd->status_var.com_stat[SQLCOM_DELETE]);
+
+ if ((m_table->file->ha_table_flags() & HA_PRIMARY_KEY_REQUIRED_FOR_POSITION) &&
+ m_table->s->primary_key < MAX_KEY)
+ {
+ /*
+ We don't need to allocate any memory for m_key since it is not used.
+ */
+ return 0;
+ }
+ if (slave_run_triggers_for_rbr && !master_had_triggers)
+ m_table->prepare_triggers_for_delete_stmt_or_event();
+
+ return find_key();
+}
+
+int
+Delete_rows_log_event::do_after_row_operations(const Slave_reporting_capability *const,
+ int error)
+{
+ m_table->file->ha_index_or_rnd_end();
+ my_free(m_key);
+ m_key= NULL;
+ m_key_info= NULL;
+
+ return error;
+}
+
+int Delete_rows_log_event::do_exec_row(rpl_group_info *rgi)
+{
+ int error;
+ const char *tmp= thd->get_proc_info();
+ const char *message= "Delete_rows_log_event::find_row()";
+ const bool invoke_triggers=
+ slave_run_triggers_for_rbr && !master_had_triggers && m_table->triggers;
+ DBUG_ASSERT(m_table != NULL);
+
+#ifdef WSREP_PROC_INFO
+ my_snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1,
+ "Delete_rows_log_event::find_row(%lld)",
+ (long long) wsrep_thd_trx_seqno(thd));
+ message= thd->wsrep_info;
+#endif /* WSREP_PROC_INFO */
+
+ thd_proc_info(thd, message);
+ if (likely(!(error= find_row(rgi))))
+ {
+ /*
+ Delete the record found, located in record[0]
+ */
+ message= "Delete_rows_log_event::ha_delete_row()";
+#ifdef WSREP_PROC_INFO
+ snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1,
+ "Delete_rows_log_event::ha_delete_row(%lld)",
+ (long long) wsrep_thd_trx_seqno(thd));
+ message= thd->wsrep_info;
+#endif
+ thd_proc_info(thd, message);
+
+ if (invoke_triggers &&
+ unlikely(process_triggers(TRG_EVENT_DELETE, TRG_ACTION_BEFORE, FALSE)))
+ error= HA_ERR_GENERIC; // in case if error is not set yet
+ if (likely(!error))
+ {
+ m_table->mark_columns_per_binlog_row_image();
+ if (m_vers_from_plain && m_table->versioned(VERS_TIMESTAMP))
+ {
+ Field *end= m_table->vers_end_field();
+ bitmap_set_bit(m_table->write_set, end->field_index);
+ store_record(m_table, record[1]);
+ end->set_time();
+ error= m_table->file->ha_update_row(m_table->record[1],
+ m_table->record[0]);
+ }
+ else
+ {
+ error= m_table->file->ha_delete_row(m_table->record[0]);
+ }
+ m_table->default_column_bitmaps();
+ }
+ if (invoke_triggers && likely(!error) &&
+ unlikely(process_triggers(TRG_EVENT_DELETE, TRG_ACTION_AFTER, FALSE)))
+ error= HA_ERR_GENERIC; // in case if error is not set yet
+ m_table->file->ha_index_or_rnd_end();
+ }
+ thd_proc_info(thd, tmp);
+ return error;
+}
+
+#endif /* defined(HAVE_REPLICATION) */
+
+#if defined(HAVE_REPLICATION)
+uint8 Delete_rows_log_event::get_trg_event_map()
+{
+ return trg2bit(TRG_EVENT_DELETE);
+}
+#endif
+
+/**************************************************************************
+ Update_rows_log_event member functions
+**************************************************************************/
+
+/*
+ Constructor used to build an event for writing to the binary log.
+ */
+Update_rows_log_event::Update_rows_log_event(THD *thd_arg, TABLE *tbl_arg,
+ ulong tid,
+ bool is_transactional)
+: Rows_log_event(thd_arg, tbl_arg, tid, tbl_arg->read_set, is_transactional,
+ UPDATE_ROWS_EVENT_V1)
+{
+ init(tbl_arg->rpl_write_set);
+}
+
+Update_rows_compressed_log_event::Update_rows_compressed_log_event(THD *thd_arg, TABLE *tbl_arg,
+ ulong tid,
+ bool is_transactional)
+: Update_rows_log_event(thd_arg, tbl_arg, tid, is_transactional)
+{
+ m_type = UPDATE_ROWS_COMPRESSED_EVENT_V1;
+}
+
+bool Update_rows_compressed_log_event::write()
+{
+ return Rows_log_event::write_compressed();
+}
+
+void Update_rows_log_event::init(MY_BITMAP const *cols)
+{
+ /* if my_bitmap_init fails, caught in is_valid() */
+ if (likely(!my_bitmap_init(&m_cols_ai,
+ m_width <= sizeof(m_bitbuf_ai)*8 ? m_bitbuf_ai : NULL,
+ m_width,
+ false)))
+ {
+ /* Cols can be zero if this is a dummy binrows event */
+ if (likely(cols != NULL))
+ {
+ memcpy(m_cols_ai.bitmap, cols->bitmap, no_bytes_in_map(cols));
+ create_last_word_mask(&m_cols_ai);
+ }
+ }
+}
+
+
+#if defined(HAVE_REPLICATION)
+
+int
+Update_rows_log_event::do_before_row_operations(const Slave_reporting_capability *const)
+{
+ /*
+ Increment the global status update count variable
+ */
+ if (get_flags(STMT_END_F))
+ status_var_increment(thd->status_var.com_stat[SQLCOM_UPDATE]);
+
+ int err;
+ if ((err= find_key()))
+ return err;
+
+ if (slave_run_triggers_for_rbr && !master_had_triggers)
+ m_table->prepare_triggers_for_update_stmt_or_event();
+
+ return 0;
+}
+
+int
+Update_rows_log_event::do_after_row_operations(const Slave_reporting_capability *const,
+ int error)
+{
+ /*error= ToDo:find out what this should really be, this triggers close_scan in nbd, returning error?*/
+ m_table->file->ha_index_or_rnd_end();
+ my_free(m_key); // Free for multi_malloc
+ m_key= NULL;
+ m_key_info= NULL;
+
+ return error;
+}
+
+int
+Update_rows_log_event::do_exec_row(rpl_group_info *rgi)
+{
+ const bool invoke_triggers=
+ slave_run_triggers_for_rbr && !master_had_triggers && m_table->triggers;
+ const char *tmp= thd->get_proc_info();
+ const char *message= "Update_rows_log_event::find_row()";
+ DBUG_ASSERT(m_table != NULL);
+
+#ifdef WSREP_PROC_INFO
+ my_snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1,
+ "Update_rows_log_event::find_row(%lld)",
+ (long long) wsrep_thd_trx_seqno(thd));
+ message= thd->wsrep_info;
+#endif /* WSREP_PROC_INFO */
+
+ thd_proc_info(thd, message);
+ int error= find_row(rgi);
+ if (unlikely(error))
+ {
+ /*
+ We need to read the second image in the event of error to be
+ able to skip to the next pair of updates
+ */
+ if ((m_curr_row= m_curr_row_end))
+ unpack_current_row(rgi, &m_cols_ai);
+ thd_proc_info(thd, tmp);
+ return error;
+ }
+
+ /*
+ This is the situation after locating BI:
+
+ ===|=== before image ====|=== after image ===|===
+ ^ ^
+ m_curr_row m_curr_row_end
+
+ BI found in the table is stored in record[0]. We copy it to record[1]
+ and unpack AI to record[0].
+ */
+
+ store_record(m_table,record[1]);
+
+ m_curr_row= m_curr_row_end;
+ message= "Update_rows_log_event::unpack_current_row()";
+#ifdef WSREP_PROC_INFO
+ my_snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1,
+ "Update_rows_log_event::unpack_current_row(%lld)",
+ (long long) wsrep_thd_trx_seqno(thd));
+ message= thd->wsrep_info;
+#endif /* WSREP_PROC_INFO */
+
+ /* this also updates m_curr_row_end */
+ thd_proc_info(thd, message);
+ if (unlikely((error= unpack_current_row(rgi, &m_cols_ai))))
+ goto err;
+
+ /*
+ Now we have the right row to update. The old row (the one we're
+ looking for) is in record[1] and the new row is in record[0].
+ */
+#ifndef HAVE_valgrind
+ /*
+ Don't print debug messages when running valgrind since they can
+ trigger false warnings.
+ */
+ DBUG_PRINT("info",("Updating row in table"));
+ DBUG_DUMP("old record", m_table->record[1], m_table->s->reclength);
+ DBUG_DUMP("new values", m_table->record[0], m_table->s->reclength);
+#endif
+
+ message= "Update_rows_log_event::ha_update_row()";
+#ifdef WSREP_PROC_INFO
+ my_snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1,
+ "Update_rows_log_event::ha_update_row(%lld)",
+ (long long) wsrep_thd_trx_seqno(thd));
+ message= thd->wsrep_info;
+#endif /* WSREP_PROC_INFO */
+
+ thd_proc_info(thd, message);
+ if (invoke_triggers &&
+ unlikely(process_triggers(TRG_EVENT_UPDATE, TRG_ACTION_BEFORE, TRUE)))
+ {
+ error= HA_ERR_GENERIC; // in case if error is not set yet
+ 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();
+ if (m_vers_from_plain && m_table->versioned(VERS_TIMESTAMP))
+ m_table->vers_update_fields();
+ error= m_table->file->ha_update_row(m_table->record[1], m_table->record[0]);
+ if (unlikely(error == HA_ERR_RECORD_IS_THE_SAME))
+ error= 0;
+ if (m_vers_from_plain && m_table->versioned(VERS_TIMESTAMP))
+ {
+ store_record(m_table, record[2]);
+ error= vers_insert_history_row(m_table);
+ restore_record(m_table, record[2]);
+ }
+ m_table->default_column_bitmaps();
+
+ if (invoke_triggers && likely(!error) &&
+ unlikely(process_triggers(TRG_EVENT_UPDATE, TRG_ACTION_AFTER, TRUE)))
+ error= HA_ERR_GENERIC; // in case if error is not set yet
+
+ thd_proc_info(thd, tmp);
+
+err:
+ m_table->file->ha_index_or_rnd_end();
+ return error;
+}
+
+#endif /* defined(HAVE_REPLICATION) */
+
+
+#if defined(HAVE_REPLICATION)
+uint8 Update_rows_log_event::get_trg_event_map()
+{
+ return trg2bit(TRG_EVENT_UPDATE);
+}
+#endif
+
+
+void Incident_log_event::pack_info(Protocol *protocol)
+{
+ char buf[256];
+ size_t bytes;
+ if (m_message.length > 0)
+ bytes= my_snprintf(buf, sizeof(buf), "#%d (%s)",
+ m_incident, description());
+ else
+ bytes= my_snprintf(buf, sizeof(buf), "#%d (%s): %s",
+ m_incident, description(), m_message.str);
+ protocol->store(buf, bytes, &my_charset_bin);
+}
+
+
+#if defined(WITH_WSREP)
+/*
+ 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
+ (*buf_len) will be changed to account just being read bytes of the 1st event.
+*/
+#define WSREP_MAX_ALLOWED_PACKET 1024*1024*1024 // current protocol max
+
+Log_event* wsrep_read_log_event(
+ char **arg_buf, size_t *arg_buf_len,
+ const Format_description_log_event *description_event)
+{
+ char *head= (*arg_buf);
+ uint data_len = uint4korr(head + EVENT_LEN_OFFSET);
+ char *buf= (*arg_buf);
+ const char *error= 0;
+ Log_event *res= 0;
+ DBUG_ENTER("wsrep_read_log_event");
+
+ if (data_len > WSREP_MAX_ALLOWED_PACKET)
+ {
+ error = "Event too big";
+ goto err;
+ }
+
+ res= Log_event::read_log_event(buf, data_len, &error, description_event, false);
+
+err:
+ if (!res)
+ {
+ DBUG_ASSERT(error != 0);
+ sql_print_error("Error in Log_event::read_log_event(): "
+ "'%s', data_len: %d, event_type: %d",
+ error,data_len,(uchar)head[EVENT_TYPE_OFFSET]);
+ }
+ (*arg_buf)+= data_len;
+ (*arg_buf_len)-= data_len;
+ DBUG_RETURN(res);
+}
+#endif
+
+
+#if defined(HAVE_REPLICATION)
+int
+Incident_log_event::do_apply_event(rpl_group_info *rgi)
+{
+ Relay_log_info const *rli= rgi->rli;
+ DBUG_ENTER("Incident_log_event::do_apply_event");
+
+ if (ignored_error_code(ER_SLAVE_INCIDENT))
+ {
+ DBUG_PRINT("info", ("Ignoring Incident"));
+ DBUG_RETURN(0);
+ }
+
+ rli->report(ERROR_LEVEL, ER_SLAVE_INCIDENT, NULL,
+ ER_THD(rgi->thd, ER_SLAVE_INCIDENT),
+ description(),
+ m_message.length > 0 ? m_message.str : "<none>");
+ DBUG_RETURN(1);
+}
+#endif
+
+
+bool
+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);
+ DBUG_RETURN(write_data(buf, sizeof(buf)));
+}
+
+bool
+Incident_log_event::write_data_body()
+{
+ uchar tmp[1];
+ DBUG_ENTER("Incident_log_event::write_data_body");
+ tmp[0]= (uchar) m_message.length;
+ DBUG_RETURN(write_data(tmp, sizeof(tmp)) ||
+ write_data(m_message.str, m_message.length));
+}
+
+
+/* Pack info for its unrecognized ignorable event */
+void Ignorable_log_event::pack_info(Protocol *protocol)
+{
+ char buf[256];
+ size_t bytes;
+ bytes= my_snprintf(buf, sizeof(buf), "# Ignorable event type %d (%s)",
+ number, description);
+ protocol->store(buf, bytes, &my_charset_bin);
+}
+
+
+#if defined(HAVE_REPLICATION)
+Heartbeat_log_event::Heartbeat_log_event(const char* buf, uint event_len,
+ const Format_description_log_event* description_event)
+ :Log_event(buf, description_event)
+{
+ uint8 header_size= description_event->common_header_len;
+ ident_len = event_len - header_size;
+ set_if_smaller(ident_len,FN_REFLEN-1);
+ log_ident= buf + header_size;
+}
+#endif
+
+
+/**
+ Check if we should write event to the relay log
+
+ This is used to skip events that is only supported by MySQL
+
+ Return:
+ 0 ok
+ 1 Don't write event
+*/
+
+bool event_that_should_be_ignored(const char *buf)
+{
+ uint event_type= (uchar)buf[EVENT_TYPE_OFFSET];
+ if (event_type == GTID_LOG_EVENT ||
+ event_type == ANONYMOUS_GTID_LOG_EVENT ||
+ event_type == PREVIOUS_GTIDS_LOG_EVENT ||
+ event_type == TRANSACTION_CONTEXT_EVENT ||
+ event_type == VIEW_CHANGE_EVENT ||
+ event_type == XA_PREPARE_LOG_EVENT ||
+ (uint2korr(buf + FLAGS_OFFSET) & LOG_EVENT_IGNORABLE_F))
+ return 1;
+ return 0;
+}
diff --git a/sql/mysql_install_db.cc b/sql/mysql_install_db.cc
index 85507a0abde..8a83f22751a 100644
--- a/sql/mysql_install_db.cc
+++ b/sql/mysql_install_db.cc
@@ -188,7 +188,7 @@ int main(int argc, char **argv)
die("--datadir option not provided, and default datadir not found");
my_print_help(my_long_options);
}
- strncat(default_datadir, "\\data", sizeof(default_datadir));
+ strncat_s(default_datadir, sizeof(default_datadir), "\\data", _TRUNCATE);
opt_datadir= default_datadir;
printf("Default data directory is %s\n",opt_datadir);
}
diff --git a/sql/mysql_upgrade_service.cc b/sql/mysql_upgrade_service.cc
index 6a15364c849..a9df9eaf13b 100644
--- a/sql/mysql_upgrade_service.cc
+++ b/sql/mysql_upgrade_service.cc
@@ -514,7 +514,7 @@ int main(int argc, char **argv)
}
char pipe_name[64];
snprintf(pipe_name, sizeof(pipe_name), "\\\\.\\pipe\\mysql_upgrade_service_%u",
- GetCurrentProcessId());
+ (uint)GetCurrentProcessId());
for (;;)
{
if (WaitForSingleObject(mysqld_process, 0) != WAIT_TIMEOUT)
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index bed82300099..d46505fa3c0 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -335,14 +335,12 @@ PSI_statement_info stmt_info_rpl;
/* the default log output is log tables */
static bool lower_case_table_names_used= 0;
-static bool max_long_data_size_used= false;
static bool volatile select_thread_in_use, signal_thread_in_use;
static my_bool opt_debugging= 0, opt_external_locking= 0, opt_console= 0;
static my_bool opt_short_log_format= 0, opt_silent_startup= 0;
bool my_disable_leak_check= false;
uint kill_cached_threads;
-static uint wake_thread;
ulong max_used_connections;
volatile ulong cached_thread_count= 0;
static char *mysqld_user, *mysqld_chroot;
@@ -446,6 +444,7 @@ my_bool opt_noacl;
my_bool sp_automatic_privileges= 1;
ulong opt_binlog_rows_event_max_size;
+ulong binlog_row_metadata;
my_bool opt_master_verify_checksum= 0;
my_bool opt_slave_sql_verify_checksum= 1;
const char *binlog_format_names[]= {"MIXED", "STATEMENT", "ROW", NullS};
@@ -507,12 +506,6 @@ long opt_secure_timestamp;
uint default_password_lifetime;
my_bool disconnect_on_expired_password;
-/*
- Maximum length of parameter value which can be set through
- mysql_send_long_data() call.
-*/
-ulong max_long_data_size;
-
bool max_user_connections_checking=0;
/**
Limit of the total number of prepared statements in the server.
@@ -699,7 +692,7 @@ mysql_mutex_t
LOCK_crypt,
LOCK_global_system_variables,
LOCK_user_conn,
- LOCK_connection_count, LOCK_error_messages, LOCK_slave_background;
+ LOCK_error_messages, LOCK_slave_background;
mysql_mutex_t LOCK_stats, LOCK_global_user_client_stats,
LOCK_global_table_stats, LOCK_global_index_stats;
@@ -857,7 +850,7 @@ PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_xid_list,
key_BINLOG_LOCK_binlog_background_thread,
key_LOCK_binlog_end_pos,
key_delayed_insert_mutex, key_hash_filo_lock, key_LOCK_active_mi,
- key_LOCK_connection_count, key_LOCK_crypt, key_LOCK_delayed_create,
+ key_LOCK_crypt, key_LOCK_delayed_create,
key_LOCK_delayed_insert, key_LOCK_delayed_status, key_LOCK_error_log,
key_LOCK_gdl, key_LOCK_global_system_variables,
key_LOCK_manager,
@@ -922,7 +915,6 @@ static PSI_mutex_info all_server_mutexes[]=
{ &key_delayed_insert_mutex, "Delayed_insert::mutex", 0},
{ &key_hash_filo_lock, "hash_filo::lock", 0},
{ &key_LOCK_active_mi, "LOCK_active_mi", PSI_FLAG_GLOBAL},
- { &key_LOCK_connection_count, "LOCK_connection_count", PSI_FLAG_GLOBAL},
{ &key_LOCK_thread_id, "LOCK_thread_id", PSI_FLAG_GLOBAL},
{ &key_LOCK_crypt, "LOCK_crypt", PSI_FLAG_GLOBAL},
{ &key_LOCK_delayed_create, "LOCK_delayed_create", PSI_FLAG_GLOBAL},
@@ -1465,10 +1457,10 @@ struct st_VioSSLFd *ssl_acceptor_fd;
#endif /* HAVE_OPENSSL */
/**
- Number of currently active user connections. The variable is protected by
- LOCK_connection_count.
+ Number of currently active user connections.
*/
-uint connection_count= 0, extra_connection_count= 0;
+Atomic_counter<uint> connection_count;
+static Atomic_counter<uint> extra_connection_count;
my_bool opt_gtid_strict_mode= FALSE;
@@ -2098,7 +2090,6 @@ static void clean_up_mutexes()
mysql_mutex_destroy(&LOCK_delayed_create);
mysql_mutex_destroy(&LOCK_crypt);
mysql_mutex_destroy(&LOCK_user_conn);
- mysql_mutex_destroy(&LOCK_connection_count);
mysql_mutex_destroy(&LOCK_thread_id);
mysql_mutex_destroy(&LOCK_stats);
mysql_mutex_destroy(&LOCK_global_user_client_stats);
@@ -2590,20 +2581,6 @@ extern "C" sig_handler end_mysqld_signal(int sig __attribute__((unused)))
}
#endif /* EMBEDDED_LIBRARY */
-/*
- Decrease number of connections
-
- SYNOPSIS
- dec_connection_count()
-*/
-
-void dec_connection_count(scheduler_functions *scheduler)
-{
- mysql_mutex_lock(&LOCK_connection_count);
- (*scheduler->connection_count)--;
- mysql_mutex_unlock(&LOCK_connection_count);
-}
-
/*
Unlink thd from global list of available connections
@@ -2629,7 +2606,7 @@ void unlink_thd(THD *thd)
*/
if (!thd->wsrep_applier)
#endif /* WITH_WSREP */
- dec_connection_count(thd->scheduler);
+ --*thd->scheduler->connection_count;
thd->free_connection();
@@ -2654,134 +2631,57 @@ void unlink_thd(THD *thd)
*/
-static bool cache_thread(THD *thd)
+CONNECT *cache_thread(THD *thd)
{
struct timespec abstime;
+ CONNECT *connect;
+ bool flushed= false;
DBUG_ENTER("cache_thread");
DBUG_ASSERT(thd);
+ set_timespec(abstime, THREAD_CACHE_TIMEOUT);
+
+ /*
+ Delete the instrumentation for the job that just completed,
+ before parking this pthread in the cache (blocked on COND_thread_cache).
+ */
+ PSI_CALL_delete_current_thread();
+
+#ifndef DBUG_OFF
+ while (_db_is_pushed_())
+ _db_pop_();
+#endif
mysql_mutex_lock(&LOCK_thread_cache);
- if (cached_thread_count < thread_cache_size &&
- ! abort_loop && !kill_cached_threads)
+ if ((connect= thread_cache.get()))
+ cached_thread_count++;
+ else if (cached_thread_count < thread_cache_size && !kill_cached_threads)
{
/* Don't kill the thread, just put it in cache for reuse */
DBUG_PRINT("info", ("Adding thread to cache"));
cached_thread_count++;
-
- /*
- Delete the instrumentation for the job that just completed,
- before parking this pthread in the cache (blocked on COND_thread_cache).
- */
- PSI_CALL_delete_current_thread();
-
-#ifndef DBUG_OFF
- while (_db_is_pushed_())
- _db_pop_();
-#endif
-
- set_timespec(abstime, THREAD_CACHE_TIMEOUT);
- while (!abort_loop && ! wake_thread && ! kill_cached_threads)
+ for (;;)
{
int error= mysql_cond_timedwait(&COND_thread_cache, &LOCK_thread_cache,
&abstime);
- if (error == ETIMEDOUT || error == ETIME)
+ flushed= kill_cached_threads;
+ if ((connect= thread_cache.get()))
+ break;
+ else if (flushed || error == ETIMEDOUT || error == ETIME)
{
/*
If timeout, end thread.
- If a new thread is requested (wake_thread is set), we will handle
+ If a new thread is requested, we will handle
the call, even if we got a timeout (as we are already awake and free)
*/
+ cached_thread_count--;
break;
}
}
- cached_thread_count--;
- if (kill_cached_threads)
- mysql_cond_signal(&COND_flush_thread_cache);
- if (wake_thread)
- {
- CONNECT *connect;
-
- wake_thread--;
- connect= thread_cache.get();
- mysql_mutex_unlock(&LOCK_thread_cache);
-
- if (!(connect->create_thd(thd)))
- {
- /* Out of resources. Free thread to get more resources */
- connect->close_and_delete();
- DBUG_RETURN(0);
- }
- delete connect;
-
- /*
- We have to call store_globals to update mysys_var->id and lock_info
- with the new thread_id
- */
- thd->store_globals();
-
- /*
- Create new instrumentation for the new THD job,
- and attach it to this running pthread.
- */
- PSI_CALL_set_thread(PSI_CALL_new_thread(key_thread_one_connection,
- thd, thd->thread_id));
-
- /* reset abort flag for the thread */
- thd->mysys_var->abort= 0;
- thd->thr_create_utime= microsecond_interval_timer();
- thd->start_utime= thd->thr_create_utime;
-
- server_threads.insert(thd);
- DBUG_RETURN(1);
- }
}
mysql_mutex_unlock(&LOCK_thread_cache);
- DBUG_RETURN(0);
-}
-
-
-/*
- End thread for the current connection
-
- SYNOPSIS
- one_thread_per_connection_end()
- thd Thread handler. This may be null if we run out of resources.
- put_in_cache Store thread in cache, if there is room in it
- Normally this is true in all cases except when we got
- out of resources initializing the current thread
-
- NOTES
- If thread is cached, we will wait until thread is scheduled to be
- reused and then we will return.
- If thread is not cached, we end the thread.
-
- RETURN
- 0 Signal to handle_one_connection to reuse connection
-*/
-
-bool one_thread_per_connection_end(THD *thd, bool put_in_cache)
-{
- DBUG_ENTER("one_thread_per_connection_end");
-
- if (thd)
- {
- const bool wsrep_applier= IF_WSREP(thd->wsrep_applier, false);
-
- unlink_thd(thd);
- if (!wsrep_applier && put_in_cache && cache_thread(thd))
- DBUG_RETURN(0); // Thread is reused
- delete thd;
- }
-
- DBUG_PRINT("info", ("killing thread"));
- DBUG_LEAVE; // Must match DBUG_ENTER()
-#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
- ERR_remove_state(0);
-#endif
- my_thread_end();
-
- pthread_exit(0);
- return 0; // Avoid compiler warnings
+ if (flushed)
+ mysql_cond_signal(&COND_flush_thread_cache);
+ DBUG_RETURN(connect);
}
@@ -2972,75 +2872,6 @@ extern "C" char *my_demangle(const char *mangled_name, int *status)
#endif
-/*
- pthread_attr_setstacksize() without so much platform-dependency
-
- Return: The actual stack size if possible.
-*/
-
-#ifndef EMBEDDED_LIBRARY
-static size_t my_setstacksize(pthread_attr_t *attr, size_t stacksize)
-{
- size_t guard_size __attribute__((unused))= 0;
-
-#if defined(__ia64__) || defined(__ia64)
- /*
- On IA64, half of the requested stack size is used for "normal stack"
- and half for "register stack". The space measured by check_stack_overrun
- is the "normal stack", so double the request to make sure we have the
- caller-expected amount of normal stack.
-
- NOTE: there is no guarantee that the register stack can't grow faster
- than normal stack, so it's very unclear that we won't dump core due to
- stack overrun despite check_stack_overrun's efforts. Experimentation
- shows that in the execution_constants test, the register stack grows
- less than half as fast as normal stack, but perhaps other scenarios are
- less forgiving. If it turns out that more space is needed for the
- register stack, that could be forced (rather inefficiently) by using a
- multiplier higher than 2 here.
- */
- stacksize *= 2;
-#endif
-
- /*
- On many machines, the "guard space" is subtracted from the requested
- stack size, and that space is quite large on some platforms. So add
- it to our request, if we can find out what it is.
- */
-#ifdef HAVE_PTHREAD_ATTR_GETGUARDSIZE
- if (pthread_attr_getguardsize(attr, &guard_size))
- guard_size = 0; /* if can't find it out, treat as 0 */
-#endif
-
- pthread_attr_setstacksize(attr, stacksize + guard_size);
-
- /* Retrieve actual stack size if possible */
-#ifdef HAVE_PTHREAD_ATTR_GETSTACKSIZE
- {
- size_t real_stack_size= 0;
- /* We must ignore real_stack_size = 0 as Solaris 2.9 can return 0 here */
- if (pthread_attr_getstacksize(attr, &real_stack_size) == 0 &&
- real_stack_size > guard_size)
- {
- real_stack_size -= guard_size;
- if (real_stack_size < stacksize)
- {
- if (global_system_variables.log_warnings)
- sql_print_warning("Asked for %zu thread stack, but got %zu",
- stacksize, real_stack_size);
- stacksize= real_stack_size;
- }
- }
- }
-#endif /* !EMBEDDED_LIBRARY */
-
-#if defined(__ia64__) || defined(__ia64)
- stacksize /= 2;
-#endif
- return stacksize;
-}
-#endif
-
#ifdef DBUG_ASSERT_AS_PRINTF
extern "C" void
mariadb_dbug_assert_failed(const char *assert_expr, const char *file,
@@ -3080,7 +2911,7 @@ void init_signals(void)
sigemptyset(&sa.sa_mask);
sigprocmask(SIG_SETMASK,&sa.sa_mask,NULL);
- my_init_stacktrace();
+ my_init_stacktrace(0);
#if defined(__amiga__)
sa.sa_handler=(void(*)())handle_fatal_signal;
#else
@@ -4519,8 +4350,6 @@ static int init_thread_environment()
&LOCK_error_messages, MY_MUTEX_INIT_FAST);
mysql_mutex_init(key_LOCK_uuid_short_generator,
&LOCK_short_uuid_generator, MY_MUTEX_INIT_FAST);
- mysql_mutex_init(key_LOCK_connection_count,
- &LOCK_connection_count, MY_MUTEX_INIT_FAST);
mysql_mutex_init(key_LOCK_thread_id,
&LOCK_thread_id, MY_MUTEX_INIT_FAST);
mysql_mutex_init(key_LOCK_stats, &LOCK_stats, MY_MUTEX_INIT_FAST);
@@ -5369,7 +5198,7 @@ static int init_server_components()
int error;
mysql_mutex_t *log_lock= mysql_bin_log.get_log_lock();
mysql_mutex_lock(log_lock);
- error= mysql_bin_log.open(opt_bin_logname, LOG_BIN, 0, 0,
+ error= mysql_bin_log.open(opt_bin_logname, 0, 0,
WRITE_CACHE, max_binlog_size, 0, TRUE);
mysql_mutex_unlock(log_lock);
if (unlikely(error))
@@ -5461,13 +5290,13 @@ static void test_lc_time_sz()
for (const char **month= (*loc)->month_names->type_names; *month; month++)
{
set_if_bigger(max_month_len,
- my_numchars_mb(&my_charset_utf8_general_ci,
+ my_numchars_mb(&my_charset_utf8mb3_general_ci,
*month, *month + strlen(*month)));
}
for (const char **day= (*loc)->day_names->type_names; *day; day++)
{
set_if_bigger(max_day_len,
- my_numchars_mb(&my_charset_utf8_general_ci,
+ my_numchars_mb(&my_charset_utf8mb3_general_ci,
*day, *day + strlen(*day)));
}
if ((*loc)->max_month_name_length != max_month_len ||
@@ -5528,7 +5357,7 @@ int mysqld_main(int argc, char **argv)
remaining_argv= argv;
/* Must be initialized early for comparison of options name */
- system_charset_info= &my_charset_utf8_general_ci;
+ system_charset_info= &my_charset_utf8mb3_general_ci;
sys_var_init();
@@ -5671,7 +5500,13 @@ int mysqld_main(int argc, char **argv)
new_thread_stack_size= my_setstacksize(&connection_attrib,
(size_t)my_thread_stack_size);
if (new_thread_stack_size != my_thread_stack_size)
+ {
+ if ((new_thread_stack_size < my_thread_stack_size) &&
+ global_system_variables.log_warnings)
+ sql_print_warning("Asked for %llu thread stack, but got %llu",
+ my_thread_stack_size, new_thread_stack_size);
SYSVAR_AUTOSIZE(my_thread_stack_size, new_thread_stack_size);
+ }
(void) thr_setconcurrency(concurrency); // 10 by default
@@ -6061,7 +5896,7 @@ int mysqld_main(int argc, char **argv)
"MySQLShutdown"), 10);
/* Must be initialized early for comparison of service name */
- system_charset_info= &my_charset_utf8_general_ci;
+ system_charset_info= &my_charset_utf8mb3_general_ci;
if (my_init())
{
@@ -6192,8 +6027,7 @@ void inc_thread_created(void)
void handle_connection_in_main_thread(CONNECT *connect)
{
- thread_cache_size= 0; // Safety
- do_handle_one_connection(connect);
+ do_handle_one_connection(connect, false);
}
@@ -6203,37 +6037,32 @@ void handle_connection_in_main_thread(CONNECT *connect)
void create_thread_to_handle_connection(CONNECT *connect)
{
- char error_message_buff[MYSQL_ERRMSG_SIZE];
- int error;
DBUG_ENTER("create_thread_to_handle_connection");
- /* Check if we can get thread from the cache */
- if (cached_thread_count > wake_thread)
+ mysql_mutex_lock(&LOCK_thread_cache);
+ if (cached_thread_count)
{
- mysql_mutex_lock(&LOCK_thread_cache);
- /* Recheck condition when we have the lock */
- if (cached_thread_count > wake_thread)
- {
- /* Get thread from cache */
- thread_cache.push_back(connect);
- wake_thread++;
- mysql_cond_signal(&COND_thread_cache);
- mysql_mutex_unlock(&LOCK_thread_cache);
- DBUG_PRINT("info",("Thread created"));
- DBUG_VOID_RETURN;
- }
+ /* Get thread from cache */
+ thread_cache.push_back(connect);
+ cached_thread_count--;
mysql_mutex_unlock(&LOCK_thread_cache);
+ mysql_cond_signal(&COND_thread_cache);
+ DBUG_PRINT("info",("Thread created"));
+ DBUG_VOID_RETURN;
}
+ mysql_mutex_unlock(&LOCK_thread_cache);
/* Create new thread to handle connection */
inc_thread_created();
DBUG_PRINT("info",(("creating thread %lu"), (ulong) connect->thread_id));
connect->prior_thr_create_utime= microsecond_interval_timer();
- if ((error= mysql_thread_create(key_thread_one_connection,
- &connect->real_id, &connection_attrib,
- handle_one_connection, (void*) connect)))
+ pthread_t tmp;
+ if (auto error= mysql_thread_create(key_thread_one_connection,
+ &tmp, &connection_attrib,
+ handle_one_connection, (void*) connect))
{
+ char error_message_buff[MYSQL_ERRMSG_SIZE];
/* purecov: begin inspected */
DBUG_PRINT("error", ("Can't create thread to handle request (error %d)",
error));
@@ -6270,29 +6099,17 @@ void create_new_thread(CONNECT *connect)
Don't allow too many connections. We roughly check here that we allow
only (max_connections + 1) connections.
*/
-
- mysql_mutex_lock(&LOCK_connection_count);
-
- if (*connect->scheduler->connection_count >=
- *connect->scheduler->max_connections + 1|| abort_loop)
+ if ((*connect->scheduler->connection_count)++ >=
+ *connect->scheduler->max_connections + 1)
{
DBUG_PRINT("error",("Too many connections"));
-
- mysql_mutex_unlock(&LOCK_connection_count);
- statistic_increment(denied_connections, &LOCK_status);
- statistic_increment(connection_errors_max_connection, &LOCK_status);
- connect->close_with_error(0, NullS, abort_loop ? ER_SERVER_SHUTDOWN : ER_CON_COUNT_ERROR);
+ connect->close_with_error(0, NullS, ER_CON_COUNT_ERROR);
DBUG_VOID_RETURN;
}
- ++*connect->scheduler->connection_count;
-
- if (connection_count + extra_connection_count > max_used_connections)
- max_used_connections= connection_count + extra_connection_count;
-
- mysql_mutex_unlock(&LOCK_connection_count);
-
- connect->thread_count_incremented= 1;
+ uint sum= connection_count + extra_connection_count;
+ if (sum > max_used_connections)
+ max_used_connections= sum;
/*
The initialization of thread_id is done in create_embedded_thd() for
@@ -6313,13 +6130,6 @@ void create_new_thread(CONNECT *connect)
void handle_accepted_socket(MYSQL_SOCKET new_sock, MYSQL_SOCKET sock)
{
- CONNECT *connect;
- bool is_unix_sock;
-
-#ifdef FD_CLOEXEC
- (void) fcntl(mysql_socket_getfd(new_sock), F_SETFD, FD_CLOEXEC);
-#endif
-
#ifdef HAVE_LIBWRAP
{
if (mysql_socket_getfd(sock) == mysql_socket_getfd(base_ip_sock) ||
@@ -6365,53 +6175,46 @@ void handle_accepted_socket(MYSQL_SOCKET new_sock, MYSQL_SOCKET sock)
DBUG_PRINT("info", ("Creating CONNECT for new connection"));
- if ((connect= new CONNECT()))
- {
- is_unix_sock= (mysql_socket_getfd(sock) ==
- mysql_socket_getfd(unix_sock));
-
- if (!(connect->vio=
- mysql_socket_vio_new(new_sock,
- is_unix_sock ? VIO_TYPE_SOCKET :
- VIO_TYPE_TCPIP,
- is_unix_sock ? VIO_LOCALHOST : 0)))
- {
- delete connect;
- connect= 0; // Error handling below
- }
- }
-
- if (!connect)
+ if (auto connect= new CONNECT(new_sock,
+ mysql_socket_getfd(sock) ==
+ mysql_socket_getfd(unix_sock) ?
+ VIO_TYPE_SOCKET : VIO_TYPE_TCPIP,
+ mysql_socket_getfd(sock) ==
+ mysql_socket_getfd(extra_ip_sock) ?
+ extra_thread_scheduler : thread_scheduler))
+ create_new_thread(connect);
+ else
{
/* Connect failure */
(void)mysql_socket_close(new_sock);
statistic_increment(aborted_connects, &LOCK_status);
statistic_increment(connection_errors_internal, &LOCK_status);
- return;
}
+}
- if (is_unix_sock)
- connect->host= my_localhost;
-
- if (mysql_socket_getfd(sock) == mysql_socket_getfd(extra_ip_sock))
+#ifndef _WIN32
+static void set_non_blocking_if_supported(MYSQL_SOCKET sock)
+{
+#if !defined(NO_FCNTL_NONBLOCK)
+ if (!(test_flags & TEST_BLOCKING))
{
- connect->extra_port= 1;
- connect->scheduler= extra_thread_scheduler;
+ int flags= fcntl(mysql_socket_getfd(sock), F_GETFL, 0);
+#if defined(O_NONBLOCK)
+ fcntl(mysql_socket_getfd(sock), F_SETFL, flags | O_NONBLOCK);
+#elif defined(O_NDELAY)
+ fcntl(mysql_socket_getfd(sock), F_SETFL, flags | O_NDELAY);
+#endif
}
- create_new_thread(connect);
+#endif
}
-#ifndef _WIN32
+
void handle_connections_sockets()
{
MYSQL_SOCKET sock= mysql_socket_invalid();
- MYSQL_SOCKET new_sock= mysql_socket_invalid();
uint error_count=0;
struct sockaddr_storage cAddr;
- int ip_flags __attribute__((unused))=0;
- int socket_flags __attribute__((unused))= 0;
- int extra_ip_flags __attribute__((unused))=0;
- int flags=0,retval;
+ int retval;
#ifdef HAVE_POLL
int socket_count= 0;
struct pollfd fds[3]; // for ip_sock, unix_sock and extra_ip_sock
@@ -6433,16 +6236,16 @@ void handle_connections_sockets()
if (mysql_socket_getfd(base_ip_sock) != INVALID_SOCKET)
{
setup_fds(base_ip_sock);
- ip_flags = fcntl(mysql_socket_getfd(base_ip_sock), F_GETFL, 0);
+ set_non_blocking_if_supported(base_ip_sock);
}
if (mysql_socket_getfd(extra_ip_sock) != INVALID_SOCKET)
{
setup_fds(extra_ip_sock);
- extra_ip_flags = fcntl(mysql_socket_getfd(extra_ip_sock), F_GETFL, 0);
+ set_non_blocking_if_supported(extra_ip_sock);
}
#ifdef HAVE_SYS_UN_H
setup_fds(unix_sock);
- socket_flags=fcntl(mysql_socket_getfd(unix_sock), F_GETFL, 0);
+ set_non_blocking_if_supported(unix_sock);
#endif
sd_notify(0, "READY=1\n"
@@ -6484,79 +6287,44 @@ void handle_connections_sockets()
if (fds[i].revents & POLLIN)
{
sock= pfs_fds[i];
- flags= fcntl(mysql_socket_getfd(sock), F_GETFL, 0);
break;
}
}
#else // HAVE_POLL
if (FD_ISSET(mysql_socket_getfd(base_ip_sock),&readFDs))
- {
sock= base_ip_sock;
- flags= ip_flags;
- }
else
if (FD_ISSET(mysql_socket_getfd(extra_ip_sock),&readFDs))
- {
sock= extra_ip_sock;
- flags= extra_ip_flags;
- }
else
- {
sock = unix_sock;
- flags= socket_flags;
- }
#endif // HAVE_POLL
-#if !defined(NO_FCNTL_NONBLOCK)
- if (!(test_flags & TEST_BLOCKING))
- {
-#if defined(O_NONBLOCK)
- fcntl(mysql_socket_getfd(sock), F_SETFL, flags | O_NONBLOCK);
-#elif defined(O_NDELAY)
- fcntl(mysql_socket_getfd(sock), F_SETFL, flags | O_NDELAY);
-#endif
- }
-#endif /* NO_FCNTL_NONBLOCK */
for (uint retry=0; retry < MAX_ACCEPT_RETRY; retry++)
{
size_socket length= sizeof(struct sockaddr_storage);
+ MYSQL_SOCKET new_sock;
+
new_sock= mysql_socket_accept(key_socket_client_connection, sock,
(struct sockaddr *)(&cAddr),
&length);
- if (mysql_socket_getfd(new_sock) != INVALID_SOCKET ||
- (socket_errno != SOCKET_EINTR && socket_errno != SOCKET_EAGAIN))
- break;
-#if !defined(NO_FCNTL_NONBLOCK)
- if (!(test_flags & TEST_BLOCKING))
+ if (mysql_socket_getfd(new_sock) != INVALID_SOCKET)
+ handle_accepted_socket(new_sock, sock);
+ else if (socket_errno != SOCKET_EINTR && socket_errno != SOCKET_EAGAIN)
{
- if (retry == MAX_ACCEPT_RETRY - 1)
- {
- // Try without O_NONBLOCK
- fcntl(mysql_socket_getfd(sock), F_SETFL, flags);
- }
+ /*
+ accept(2) failed on the listening port.
+ There is not much details to report about the client,
+ increment the server global status variable.
+ */
+ statistic_increment(connection_errors_accept, &LOCK_status);
+ if ((error_count++ & 255) == 0) // This can happen often
+ sql_perror("Error in accept");
+ if (socket_errno == SOCKET_ENFILE || socket_errno == SOCKET_EMFILE)
+ sleep(1); // Give other threads some time
+ break;
}
-#endif
}
-
- if (mysql_socket_getfd(new_sock) == INVALID_SOCKET)
- {
- /*
- accept(2) failed on the listening port, after many retries.
- There is not much details to report about the client,
- increment the server global status variable.
- */
- statistic_increment(connection_errors_accept, &LOCK_status);
- if ((error_count++ & 255) == 0) // This can happen often
- sql_perror("Error in accept");
- if (socket_errno == SOCKET_ENFILE || socket_errno == SOCKET_EMFILE)
- sleep(1); // Give other threads some time
- continue;
- }
-#if !defined(NO_FCNTL_NONBLOCK)
- if (!(test_flags & TEST_BLOCKING))
- fcntl(mysql_socket_getfd(sock), F_SETFL, flags);
-#endif
- handle_accepted_socket(new_sock, sock);
}
sd_notify(0, "STOPPING=1\n"
"STATUS=Shutdown in progress\n");
@@ -7606,7 +7374,7 @@ static int debug_status_func(THD *thd, SHOW_VAR *var, char *buff,
#endif
#ifdef HAVE_POOL_OF_THREADS
-int show_threadpool_idle_threads(THD *thd, SHOW_VAR *var, char *buff,
+static int show_threadpool_idle_threads(THD *thd, SHOW_VAR *var, char *buff,
enum enum_var_type scope)
{
var->type= SHOW_INT;
@@ -8030,7 +7798,7 @@ static int mysql_init_variables(void)
mqh_used= 0;
cleanup_done= 0;
test_flags= select_errors= dropping_tables= ha_open_options=0;
- thread_count= kill_cached_threads= wake_thread= 0;
+ thread_count= kill_cached_threads= 0;
slave_open_temp_tables= 0;
cached_thread_count= 0;
opt_endinfo= using_udf_functions= 0;
@@ -8059,9 +7827,9 @@ static int mysql_init_variables(void)
key_map_full.set_all();
/* Character sets */
- system_charset_info= &my_charset_utf8_general_ci;
- files_charset_info= &my_charset_utf8_general_ci;
- national_charset_info= &my_charset_utf8_general_ci;
+ system_charset_info= &my_charset_utf8mb3_general_ci;
+ files_charset_info= &my_charset_utf8mb3_general_ci;
+ national_charset_info= &my_charset_utf8mb3_general_ci;
table_alias_charset= &my_charset_bin;
character_set_filesystem= &my_charset_bin;
@@ -8553,9 +8321,6 @@ mysqld_get_one_option(int optid, const struct my_option *opt, char *argument)
case OPT_PLUGIN_LOAD_ADD:
opt_plugin_load_list_ptr->push_back(new i_string(argument));
break;
- case OPT_MAX_LONG_DATA_SIZE:
- max_long_data_size_used= true;
- break;
case OPT_PFS_INSTRUMENT:
{
#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
@@ -8971,14 +8736,6 @@ static int get_options(int *argc_ptr, char ***argv_ptr)
opt_readonly= read_only;
- /*
- If max_long_data_size is not specified explicitly use
- value of max_allowed_packet.
- */
- if (!max_long_data_size_used)
- SYSVAR_AUTOSIZE(max_long_data_size,
- global_system_variables.max_allowed_packet);
-
/* Remember if max_user_connections was 0 at startup */
max_user_connections_checking= global_system_variables.max_user_connections != 0;
diff --git a/sql/mysqld.h b/sql/mysqld.h
index ad19ce13db8..a518b6f34cd 100644
--- a/sql/mysqld.h
+++ b/sql/mysqld.h
@@ -80,11 +80,10 @@ void close_connection(THD *thd, uint sql_errno= 0);
void handle_connection_in_main_thread(CONNECT *thd);
void create_thread_to_handle_connection(CONNECT *connect);
void unlink_thd(THD *thd);
-bool one_thread_per_connection_end(THD *thd, bool put_in_cache);
+CONNECT *cache_thread(THD *thd);
void flush_thread_cache();
void refresh_status(THD *thd);
bool is_secure_file_path(char *path);
-void dec_connection_count(scheduler_functions *scheduler);
extern void init_net_server_extension(THD *thd);
extern void handle_accepted_socket(MYSQL_SOCKET new_sock, MYSQL_SOCKET sock);
extern void create_new_thread(CONNECT *connect);
@@ -120,7 +119,7 @@ extern bool opt_ignore_builtin_innodb;
extern my_bool opt_character_set_client_handshake;
extern my_bool debug_assert_on_not_freed_memory;
extern bool volatile abort_loop;
-extern uint connection_count;
+extern Atomic_counter<uint> connection_count;
extern my_bool opt_safe_user_create;
extern my_bool opt_safe_show_db, opt_local_infile, opt_myisam_use_mmap;
extern my_bool opt_slave_compressed_protocol, use_temp_pool;
@@ -158,7 +157,6 @@ extern plugin_ref *opt_gtid_pos_auto_plugins;
extern bool opt_endinfo, using_udf_functions;
extern my_bool locked_in_memory;
extern bool opt_using_transactions;
-extern ulong max_long_data_size;
extern ulong current_pid;
extern ulong expire_logs_days;
extern my_bool relay_log_recovery;
@@ -246,6 +244,7 @@ extern ulonglong max_binlog_cache_size, max_binlog_stmt_cache_size;
extern ulong max_binlog_size;
extern ulong slave_max_allowed_packet;
extern ulong opt_binlog_rows_event_max_size;
+extern ulong binlog_row_metadata;
extern ulong thread_cache_size;
extern ulong stored_program_cache_size;
extern ulong opt_slave_parallel_threads;
@@ -319,7 +318,7 @@ extern PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_xid_list,
key_BINLOG_LOCK_binlog_background_thread,
key_LOCK_binlog_end_pos,
key_delayed_insert_mutex, key_hash_filo_lock, key_LOCK_active_mi,
- key_LOCK_connection_count, key_LOCK_crypt, key_LOCK_delayed_create,
+ key_LOCK_crypt, key_LOCK_delayed_create,
key_LOCK_delayed_insert, key_LOCK_delayed_status, key_LOCK_error_log,
key_LOCK_gdl, key_LOCK_global_system_variables,
key_LOCK_logger, key_LOCK_manager,
@@ -615,7 +614,7 @@ extern mysql_mutex_t
LOCK_error_log, LOCK_delayed_insert, LOCK_short_uuid_generator,
LOCK_delayed_status, LOCK_delayed_create, LOCK_crypt, LOCK_timezone,
LOCK_active_mi, LOCK_manager, LOCK_user_conn,
- LOCK_prepared_stmt_count, LOCK_error_messages, LOCK_connection_count,
+ LOCK_prepared_stmt_count, LOCK_error_messages,
LOCK_slave_background;
extern MYSQL_PLUGIN_IMPORT mysql_mutex_t LOCK_global_system_variables;
extern mysql_rwlock_t LOCK_all_status_vars;
@@ -668,7 +667,6 @@ enum options_mysqld
OPT_LOG_BASENAME,
OPT_LOG_ERROR,
OPT_LOWER_CASE_TABLE_NAMES,
- OPT_MAX_LONG_DATA_SIZE,
OPT_PLUGIN_LOAD,
OPT_PLUGIN_LOAD_ADD,
OPT_PFS_INSTRUMENT,
@@ -810,7 +808,6 @@ inline int set_current_thd(THD *thd)
*/
extern handlerton *maria_hton;
-extern uint extra_connection_count;
extern uint64 global_gtid_counter;
extern my_bool opt_gtid_strict_mode;
extern my_bool opt_userstat_running, debug_assert_if_crashed_table;
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index c47da283e9c..0aa06532d0f 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -405,7 +405,7 @@ bool get_quick_keys(PARAM *param,QUICK_RANGE_SELECT *quick,KEY_PART *key,
uchar *max_key,uint max_key_flag);
static bool eq_tree(SEL_ARG* a,SEL_ARG *b);
-static SEL_ARG null_element(SEL_ARG::IMPOSSIBLE);
+SEL_ARG null_element(SEL_ARG::IMPOSSIBLE);
static bool null_part_in_key(KEY_PART *key_part, const uchar *key,
uint length);
static bool is_key_scan_ror(PARAM *param, uint keynr, uint8 nparts);
@@ -2645,6 +2645,7 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
{
uint idx;
double scan_time;
+ Item *notnull_cond= NULL;
DBUG_ENTER("SQL_SELECT::test_quick_select");
DBUG_PRINT("enter",("keys_to_use: %lu prev_tables: %lu const_tables: %lu",
(ulong) keys_to_use.to_ulonglong(), (ulong) prev_tables,
@@ -2659,6 +2660,7 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
if (keys_to_use.is_clear_all() || head->is_filled_at_execution())
DBUG_RETURN(0);
records= head->stat_records();
+ notnull_cond= head->notnull_cond;
if (!records)
records++; /* purecov: inspected */
@@ -2669,9 +2671,12 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
scan_time= (double) records / TIME_FOR_COMPARE + 1;
read_time= (double) head->file->scan_time() + scan_time + 1.1;
if (limit < records)
+ {
read_time= (double) records + scan_time + 1; // Force to use index
+ notnull_cond= NULL;
+ }
}
-
+
possible_keys.clear_all();
DBUG_PRINT("info",("Time to scan table: %g", read_time));
@@ -2693,6 +2698,7 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
uchar buff[STACK_BUFF_ALLOC];
MEM_ROOT alloc;
SEL_TREE *tree= NULL;
+ SEL_TREE *notnull_cond_tree= NULL;
KEY_PART *key_parts;
KEY *key_info;
PARAM param;
@@ -2829,6 +2835,9 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
TRP_GROUP_MIN_MAX *group_trp= NULL;
double best_read_time= read_time;
+ if (notnull_cond)
+ notnull_cond_tree= notnull_cond->get_mm_tree(&param, &notnull_cond);
+
if (cond)
{
{
@@ -2856,6 +2865,7 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
}
}
}
+ tree= tree_and(&param, tree, notnull_cond_tree);
/*
Try to construct a QUICK_GROUP_MIN_MAX_SELECT.
@@ -8132,16 +8142,6 @@ SEL_TREE *Item_bool_func::get_full_func_mm_tree(RANGE_OPT_PARAM *param,
table_map ref_tables= 0;
table_map param_comp= ~(param->prev_tables | param->read_tables |
param->current_table);
-#ifdef HAVE_SPATIAL
- Field::geometry_type sav_geom_type;
- const bool geometry= field_item->field->type() == MYSQL_TYPE_GEOMETRY;
- if (geometry)
- {
- sav_geom_type= ((Field_geom*) field_item->field)->geom_type;
- /* We have to be able to store all sorts of spatial features here */
- ((Field_geom*) field_item->field)->geom_type= Field::GEOM_GEOMETRY;
- }
-#endif /*HAVE_SPATIAL*/
for (uint i= 0; i < arg_count; i++)
{
@@ -8169,12 +8169,6 @@ SEL_TREE *Item_bool_func::get_full_func_mm_tree(RANGE_OPT_PARAM *param,
}
}
-#ifdef HAVE_SPATIAL
- if (geometry)
- {
- ((Field_geom*) field_item->field)->geom_type= sav_geom_type;
- }
-#endif /*HAVE_SPATIAL*/
DBUG_RETURN(ftree);
}
diff --git a/sql/opt_range.h b/sql/opt_range.h
index 73def7bde92..a504e35bf45 100644
--- a/sql/opt_range.h
+++ b/sql/opt_range.h
@@ -598,6 +598,7 @@ public:
SEL_ARG *clone_tree(RANGE_OPT_PARAM *param);
};
+extern MYSQL_PLUGIN_IMPORT SEL_ARG null_element;
class SEL_ARG_IMPOSSIBLE: public SEL_ARG
{
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index c51f5a1a6e2..44cb524d1b8 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -3935,6 +3935,39 @@ void fix_semijoin_strategies_for_picked_join_order(JOIN *join)
/*
+ Return the number of tables at the top-level of the JOIN
+
+ SYNOPSIS
+ get_number_of_tables_at_top_level()
+ join The join with the picked join order
+
+ DESCRIPTION
+ The number of tables in the JOIN currently include all the inner tables of the
+ mergeable semi-joins. The function would make sure that we only count the semi-join
+ nest and not the inner tables of teh semi-join nest.
+*/
+
+uint get_number_of_tables_at_top_level(JOIN *join)
+{
+ uint j= 0, tables= 0;
+ while(j < join->table_count)
+ {
+ POSITION *cur_pos= &join->best_positions[j];
+ tables++;
+ if (cur_pos->sj_strategy == SJ_OPT_MATERIALIZE ||
+ cur_pos->sj_strategy == SJ_OPT_MATERIALIZE_SCAN)
+ {
+ SJ_MATERIALIZATION_INFO *sjm= cur_pos->table->emb_sj_nest->sj_mat_info;
+ j= j + sjm->tables;
+ }
+ else
+ j++;
+ }
+ return tables;
+}
+
+
+/*
Setup semi-join materialization strategy for one semi-join nest
SYNOPSIS
@@ -4489,7 +4522,7 @@ SJ_TMP_TABLE::create_sj_weedout_tmp_table(THD *thd)
}
uint reclength= field->pack_length();
- if (using_unique_constraint)
+ if (using_unique_constraint || thd->variables.tmp_memory_table_size == 0)
{
share->db_plugin= ha_lock_engine(0, TMP_ENGINE_HTON);
table->file= get_new_handler(share, &table->mem_root,
@@ -4564,15 +4597,7 @@ SJ_TMP_TABLE::create_sj_weedout_tmp_table(THD *thd)
/* Make entry for create table */
recinfo->length=length;
- if (field->flags & BLOB_FLAG)
- recinfo->type= FIELD_BLOB;
- else if (use_packed_rows &&
- field->real_type() == MYSQL_TYPE_STRING &&
- length >= MIN_STRING_LENGTH_TO_PACK_ROWS)
- recinfo->type=FIELD_SKIP_ENDSPACE;
- else
- recinfo->type=FIELD_NORMAL;
-
+ recinfo->type= field->tmp_engine_column_type(use_packed_rows);
field->set_table_name(&table->alias);
}
@@ -4582,7 +4607,7 @@ SJ_TMP_TABLE::create_sj_weedout_tmp_table(THD *thd)
share->max_rows= (ha_rows) (((share->db_type() == heap_hton) ?
MY_MIN(thd->variables.tmp_memory_table_size,
thd->variables.max_heap_table_size) :
- thd->variables.tmp_memory_table_size) /
+ thd->variables.tmp_disk_table_size) /
share->reclength);
set_if_bigger(share->max_rows,1); // For dummy start options
@@ -6853,8 +6878,7 @@ get_corresponding_item_for_in_subq_having(THD *thd, Item *in_item,
Item_ref *ref=
new (thd->mem_root) Item_ref(thd,
&subq_pred->unit->first_select()->context,
- NullS, NullS,
- &new_item->name);
+ new_item->name);
if (!ref)
DBUG_ASSERT(0);
return ref;
diff --git a/sql/opt_subselect.h b/sql/opt_subselect.h
index d7978e9ef73..abd37f1e98e 100644
--- a/sql/opt_subselect.h
+++ b/sql/opt_subselect.h
@@ -324,6 +324,7 @@ void fix_semijoin_strategies_for_picked_join_order(JOIN *join);
bool setup_sj_materialization_part1(JOIN_TAB *sjm_tab);
bool setup_sj_materialization_part2(JOIN_TAB *sjm_tab);
+uint get_number_of_tables_at_top_level(JOIN *join);
/*
diff --git a/sql/opt_trace.cc b/sql/opt_trace.cc
index 7c82ba829bc..d95f0795542 100644
--- a/sql/opt_trace.cc
+++ b/sql/opt_trace.cc
@@ -17,7 +17,7 @@
#include "sql_class.h"
#include "sql_show.h"
#include "field.h"
-#include "table.h"
+#include "sql_i_s.h"
#include "opt_trace.h"
#include "sql_parse.h"
#include "set_var.h"
@@ -66,18 +66,21 @@ bool sets_var_optimizer_trace(enum enum_sql_command sql_command,
}
+namespace Show {
+
+
ST_FIELD_INFO optimizer_trace_info[]=
{
- /* name, length, type, value, maybe_null, old_name, open_method */
- {"QUERY", 65535, MYSQL_TYPE_STRING, 0, false, NULL, SKIP_OPEN_TABLE},
- {"TRACE", 65535, MYSQL_TYPE_STRING, 0, false, NULL, SKIP_OPEN_TABLE},
- {"MISSING_BYTES_BEYOND_MAX_MEM_SIZE", 20, MYSQL_TYPE_LONG, 0, false, NULL,
- SKIP_OPEN_TABLE},
- {"INSUFFICIENT_PRIVILEGES", 1, MYSQL_TYPE_TINY, 0, false, NULL,
- SKIP_OPEN_TABLE},
- {NULL, 0, MYSQL_TYPE_STRING, 0, true, NULL, 0}
+ Column("QUERY", Longtext(65535), NOT_NULL),
+ Column("TRACE", Longtext(65535), NOT_NULL),
+ Column("MISSING_BYTES_BEYOND_MAX_MEM_SIZE", SLong(20), NOT_NULL),
+ Column("INSUFFICIENT_PRIVILEGES", STiny(1), NOT_NULL),
+ CEnd()
};
+} // namespace Show
+
+
/*
TODO: one-line needs to be implemented seperately
*/
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index 66ec6a70b12..38e085b3be9 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -2140,7 +2140,6 @@ bool partition_info::fix_column_value_functions(THD *thd,
{
uchar *val_ptr;
uint len= field->pack_length();
- sql_mode_t save_sql_mode;
bool save_got_warning;
if (!(column_item= get_column_item(column_item, field)))
@@ -2148,20 +2147,17 @@ bool partition_info::fix_column_value_functions(THD *thd,
result= TRUE;
goto end;
}
- save_sql_mode= thd->variables.sql_mode;
- thd->variables.sql_mode= 0;
+ Sql_mode_instant_set sms(thd, 0);
save_got_warning= thd->got_warning;
thd->got_warning= 0;
if (column_item->save_in_field(field, TRUE) ||
thd->got_warning)
{
my_error(ER_WRONG_TYPE_COLUMN_VALUE_ERROR, MYF(0));
- thd->variables.sql_mode= save_sql_mode;
result= TRUE;
goto end;
}
thd->got_warning= save_got_warning;
- thd->variables.sql_mode= save_sql_mode;
if (!(val_ptr= (uchar*) thd->memdup(field->ptr, len)))
{
result= TRUE;
diff --git a/sql/procedure.h b/sql/procedure.h
index 15fd525ec65..b7e7b38a4d2 100644
--- a/sql/procedure.h
+++ b/sql/procedure.h
@@ -44,7 +44,7 @@ public:
this->name.length= strlen(name_par);
}
enum Type type() const { return Item::PROC_ITEM; }
- Field *create_tmp_field_ex(TABLE *table, Tmp_field_src *src,
+ Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src,
const Tmp_field_param *param)
{
/*
@@ -52,7 +52,7 @@ public:
DECLARE c CURSOR FOR SELECT * FROM t1 PROCEDURE analyse();
OPEN c;
*/
- return create_tmp_field_ex_simple(table, src, param);
+ return create_tmp_field_ex_simple(root, table, src, param);
}
virtual void set(double nr)=0;
virtual void set(const char *str,uint length,CHARSET_INFO *cs)=0;
@@ -107,7 +107,11 @@ class Item_proc_int :public Item_proc
public:
Item_proc_int(THD *thd, const char *name_par): Item_proc(thd, name_par)
{ max_length=11; }
- const Type_handler *type_handler() const { return &type_handler_longlong; }
+ const Type_handler *type_handler() const
+ {
+ return unsigned_flag ? &type_handler_ulonglong :
+ &type_handler_slonglong;
+ }
void set(double nr) { value=(longlong) nr; }
void set(longlong nr) { value=nr; }
void set(const char *str,uint length, CHARSET_INFO *cs)
diff --git a/sql/protocol.cc b/sql/protocol.cc
index 8c7eeaec90c..7e63fcf81a4 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -1001,7 +1001,7 @@ bool Protocol_text::store_field_metadata_for_list_fields(const THD *thd,
uint pos)
{
Send_field field= tl->view ?
- Send_field(fld, tl->view_db.str, tl->view_name.str) :
+ Send_field(fld, tl->view_db, tl->view_name) :
Send_field(fld);
return store_field_metadata(thd, field, fld->charset_for_protocol(), pos);
}
diff --git a/sql/protocol.h b/sql/protocol.h
index 3b2c905ed9e..c5e525cac8c 100644
--- a/sql/protocol.h
+++ b/sql/protocol.h
@@ -122,11 +122,6 @@ public:
virtual bool store(const char *from, size_t length, CHARSET_INFO *cs)=0;
virtual bool store(const char *from, size_t length,
CHARSET_INFO *fromcs, CHARSET_INFO *tocs)=0;
- bool store_str(const char *s, CHARSET_INFO *fromcs, CHARSET_INFO *tocs)
- {
- DBUG_ASSERT(s);
- return store(s, (uint) strlen(s), fromcs, tocs);
- }
bool store_str(const LEX_CSTRING &s, CHARSET_INFO *fromcs, CHARSET_INFO *tocs)
{
return store(s.str, (uint) s.length, fromcs, tocs);
diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc
index 18fc3d9431a..7905e112e2e 100644
--- a/sql/repl_failsafe.cc
+++ b/sql/repl_failsafe.cc
@@ -147,6 +147,9 @@ int THD::register_slave(uchar *packet, size_t packet_length)
if (!(si->master_id= uint4korr(p)))
si->master_id= global_system_variables.server_id;
+ if (!*si->host)
+ ::strmake(si->host, main_security_ctx.host_or_ip, sizeof(si->host));
+
unregister_slave();
mysql_mutex_lock(&LOCK_thd_data);
slave_info= si;
diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc
index 69c57b2959c..48bc2bb0210 100644
--- a/sql/rpl_rli.cc
+++ b/sql/rpl_rli.cc
@@ -237,7 +237,7 @@ a file name for --relay-log-index option", opt_relaylog_index_name);
*/
mysql_mutex_lock(log_lock);
if (relay_log.open_index_file(buf_relaylog_index_name, ln, TRUE) ||
- relay_log.open(ln, LOG_BIN, 0, 0, SEQ_READ_APPEND,
+ relay_log.open(ln, 0, 0, SEQ_READ_APPEND,
(ulong)max_relay_log_size, 1, TRUE))
{
mysql_mutex_unlock(log_lock);
@@ -1178,7 +1178,7 @@ int purge_relay_logs(Relay_log_info* rli, THD *thd, bool just_reset,
DBUG_RETURN(1);
}
mysql_mutex_lock(rli->relay_log.get_log_lock());
- if (rli->relay_log.open(ln, LOG_BIN, 0, 0, SEQ_READ_APPEND,
+ if (rli->relay_log.open(ln, 0, 0, SEQ_READ_APPEND,
(ulong)(rli->max_relay_log_size ? rli->max_relay_log_size :
max_binlog_size), 1, TRUE))
{
diff --git a/sql/rpl_utility.cc b/sql/rpl_utility.cc
index 437d58d772f..1e4b59844b8 100644
--- a/sql/rpl_utility.cc
+++ b/sql/rpl_utility.cc
@@ -19,185 +19,7 @@
#include "rpl_utility.h"
#include "log_event.h"
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
-#include "rpl_rli.h"
-#include "sql_select.h"
-/**
- Calculate display length for MySQL56 temporal data types from their metadata.
- It contains fractional precision in the low 16-bit word.
-*/
-static uint32
-max_display_length_for_temporal2_field(uint32 int_display_length,
- unsigned int metadata)
-{
- metadata&= 0x00ff;
- return int_display_length + metadata + (metadata ? 1 : 0);
-}
-
-
-/**
- Compute the maximum display length of a field.
-
- @param sql_type Type of the field
- @param metadata The metadata from the master for the field.
- @return Maximum length of the field in bytes.
-
- The precise values calculated by field->max_display_length() and
- calculated by max_display_length_for_field() can differ (by +1 or -1)
- for integer data types (TINYINT, SMALLINT, MEDIUMINT, INT, BIGINT).
- This slight difference is not important here, because we call
- this function only for two *different* integer data types.
- */
-static uint32
-max_display_length_for_field(enum_field_types sql_type, unsigned int metadata)
-{
- DBUG_PRINT("debug", ("sql_type: %d, metadata: 0x%x", sql_type, metadata));
- DBUG_ASSERT(metadata >> 16 == 0);
-
- switch (sql_type) {
- case MYSQL_TYPE_NEWDECIMAL:
- return metadata >> 8;
-
- case MYSQL_TYPE_FLOAT:
- return 12;
-
- case MYSQL_TYPE_DOUBLE:
- return 22;
-
- case MYSQL_TYPE_SET:
- case MYSQL_TYPE_ENUM:
- return metadata & 0x00ff;
-
- case MYSQL_TYPE_STRING:
- {
- uchar type= metadata >> 8;
- if (type == MYSQL_TYPE_SET || type == MYSQL_TYPE_ENUM)
- return metadata & 0xff;
- else
- /* This is taken from Field_string::unpack. */
- return (((metadata >> 4) & 0x300) ^ 0x300) + (metadata & 0x00ff);
- }
-
- case MYSQL_TYPE_YEAR:
- case MYSQL_TYPE_TINY:
- return 4;
-
- case MYSQL_TYPE_SHORT:
- return 6;
-
- case MYSQL_TYPE_INT24:
- return 9;
-
- case MYSQL_TYPE_LONG:
- return 11;
-
-#ifdef HAVE_LONG_LONG
- case MYSQL_TYPE_LONGLONG:
- return 20;
-
-#endif
- case MYSQL_TYPE_NULL:
- return 0;
-
- case MYSQL_TYPE_NEWDATE:
- return 3;
-
- case MYSQL_TYPE_DATE:
- return 3;
-
- case MYSQL_TYPE_TIME:
- return MIN_TIME_WIDTH;
-
- case MYSQL_TYPE_TIME2:
- return max_display_length_for_temporal2_field(MIN_TIME_WIDTH, metadata);
-
- case MYSQL_TYPE_TIMESTAMP:
- return MAX_DATETIME_WIDTH;
-
- case MYSQL_TYPE_TIMESTAMP2:
- return max_display_length_for_temporal2_field(MAX_DATETIME_WIDTH, metadata);
-
- case MYSQL_TYPE_DATETIME:
- return MAX_DATETIME_WIDTH;
-
- case MYSQL_TYPE_DATETIME2:
- return max_display_length_for_temporal2_field(MAX_DATETIME_WIDTH, metadata);
-
- case MYSQL_TYPE_BIT:
- /*
- Decode the size of the bit field from the master.
- */
- DBUG_ASSERT((metadata & 0xff) <= 7);
- return 8 * (metadata >> 8U) + (metadata & 0x00ff);
-
- case MYSQL_TYPE_VAR_STRING:
- case MYSQL_TYPE_VARCHAR:
- return metadata;
- case MYSQL_TYPE_VARCHAR_COMPRESSED:
- return metadata - 1;
-
- /*
- The actual length for these types does not really matter since
- they are used to calc_pack_length, which ignores the given
- length for these types.
-
- Since we want this to be accurate for other uses, we return the
- maximum size in bytes of these BLOBs.
- */
-
- case MYSQL_TYPE_TINY_BLOB:
- return (uint32)my_set_bits(1 * 8);
-
- case MYSQL_TYPE_MEDIUM_BLOB:
- return (uint32)my_set_bits(3 * 8);
-
- case MYSQL_TYPE_BLOB:
- case MYSQL_TYPE_BLOB_COMPRESSED:
- /*
- For the blob type, Field::real_type() lies and say that all
- blobs are of type MYSQL_TYPE_BLOB. In that case, we have to look
- at the length instead to decide what the max display size is.
- */
- return (uint32)my_set_bits(metadata * 8);
-
- case MYSQL_TYPE_LONG_BLOB:
- case MYSQL_TYPE_GEOMETRY:
- return (uint32)my_set_bits(4 * 8);
-
- default:
- return ~(uint32) 0;
- }
-}
-
-
-/*
- Compare the pack lengths of a source field (on the master) and a
- target field (on the slave).
-
- @param field Target field.
- @param type Source field type.
- @param metadata Source field metadata.
-
- @retval -1 The length of the source field is smaller than the target field.
- @retval 0 The length of the source and target fields are the same.
- @retval 1 The length of the source field is greater than the target field.
- */
-int compare_lengths(Field *field, enum_field_types source_type, uint16 metadata)
-{
- DBUG_ENTER("compare_lengths");
- size_t const source_length=
- max_display_length_for_field(source_type, metadata);
- size_t const target_length= field->max_display_length();
- DBUG_PRINT("debug", ("source_length: %lu, source_type: %u,"
- " target_length: %lu, target_type: %u",
- (unsigned long) source_length, source_type,
- (unsigned long) target_length, field->real_type()));
- int result= source_length < target_length ? -1 : source_length > target_length;
- DBUG_PRINT("result", ("%d", result));
- DBUG_RETURN(result);
-}
-#endif //MYSQL_CLIENT
/*********************************************************************
* table_def member definitions *
*********************************************************************/
@@ -349,750 +171,6 @@ uint32 table_def::calc_field_size(uint col, uchar *master_data) const
return length;
}
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
-/**
- */
-void show_sql_type(enum_field_types type, uint16 metadata, String *str,
- bool char_with_octets)
-{
- DBUG_ENTER("show_sql_type");
- DBUG_PRINT("enter", ("type: %d, metadata: 0x%x", type, metadata));
-
- switch (type)
- {
- case MYSQL_TYPE_TINY:
- str->set_ascii(STRING_WITH_LEN("tinyint"));
- break;
-
- case MYSQL_TYPE_SHORT:
- str->set_ascii(STRING_WITH_LEN("smallint"));
- break;
-
- case MYSQL_TYPE_LONG:
- str->set_ascii(STRING_WITH_LEN("int"));
- break;
-
- case MYSQL_TYPE_FLOAT:
- str->set_ascii(STRING_WITH_LEN("float"));
- break;
-
- case MYSQL_TYPE_DOUBLE:
- str->set_ascii(STRING_WITH_LEN("double"));
- break;
-
- case MYSQL_TYPE_NULL:
- str->set_ascii(STRING_WITH_LEN("null"));
- break;
-
- case MYSQL_TYPE_TIMESTAMP:
- case MYSQL_TYPE_TIMESTAMP2:
- str->set_ascii(STRING_WITH_LEN("timestamp"));
- break;
-
- case MYSQL_TYPE_LONGLONG:
- str->set_ascii(STRING_WITH_LEN("bigint"));
- break;
-
- case MYSQL_TYPE_INT24:
- str->set_ascii(STRING_WITH_LEN("mediumint"));
- break;
-
- case MYSQL_TYPE_NEWDATE:
- case MYSQL_TYPE_DATE:
- str->set_ascii(STRING_WITH_LEN("date"));
- break;
-
- case MYSQL_TYPE_TIME:
- case MYSQL_TYPE_TIME2:
- str->set_ascii(STRING_WITH_LEN("time"));
- break;
-
- case MYSQL_TYPE_DATETIME:
- case MYSQL_TYPE_DATETIME2:
- str->set_ascii(STRING_WITH_LEN("datetime"));
- break;
-
- case MYSQL_TYPE_YEAR:
- str->set_ascii(STRING_WITH_LEN("year"));
- break;
-
- case MYSQL_TYPE_VAR_STRING:
- case MYSQL_TYPE_VARCHAR:
- case MYSQL_TYPE_VARCHAR_COMPRESSED:
- {
- CHARSET_INFO *cs= str->charset();
- size_t length=0;
- if (char_with_octets)
- length= cs->cset->snprintf(cs, (char*) str->ptr(), str->alloced_length(),
- "varchar(%u octets)", metadata);
- else
- length= cs->cset->snprintf(cs, (char*) str->ptr(), str->alloced_length(),
- "varbinary(%u)", metadata);
- str->length(length);
- }
- break;
-
- case MYSQL_TYPE_BIT:
- {
- CHARSET_INFO *cs= str->charset();
- int bit_length= 8 * (metadata >> 8) + (metadata & 0xFF);
- size_t length=
- cs->cset->snprintf(cs, (char*) str->ptr(), str->alloced_length(),
- "bit(%d)", bit_length);
- str->length(length);
- }
- break;
-
- case MYSQL_TYPE_DECIMAL:
- {
- CHARSET_INFO *cs= str->charset();
- size_t length=
- cs->cset->snprintf(cs, (char*) str->ptr(), str->alloced_length(),
- "decimal(%d,?)/*old*/", metadata);
- str->length(length);
- }
- break;
-
- case MYSQL_TYPE_NEWDECIMAL:
- {
- CHARSET_INFO *cs= str->charset();
- size_t length=
- cs->cset->snprintf(cs, (char*) str->ptr(), str->alloced_length(),
- "decimal(%d,%d)", metadata >> 8, metadata & 0xff);
- str->length(length);
- }
- break;
-
- case MYSQL_TYPE_ENUM:
- str->set_ascii(STRING_WITH_LEN("enum"));
- break;
-
- case MYSQL_TYPE_SET:
- str->set_ascii(STRING_WITH_LEN("set"));
- break;
-
- case MYSQL_TYPE_BLOB:
- case MYSQL_TYPE_BLOB_COMPRESSED:
- /*
- Field::real_type() lies regarding the actual type of a BLOB, so
- it is necessary to check the pack length to figure out what kind
- of blob it really is.
- */
- switch (metadata)
- {
- case 1:
- str->set_ascii(STRING_WITH_LEN("tinyblob"));
- break;
-
- case 2:
- str->set_ascii(STRING_WITH_LEN("blob"));
- break;
-
- case 3:
- str->set_ascii(STRING_WITH_LEN("mediumblob"));
- break;
-
- case 4:
- str->set_ascii(STRING_WITH_LEN("longblob"));
- break;
-
- default:
- DBUG_ASSERT(0);
- break;
- }
-
- if (type == MYSQL_TYPE_BLOB_COMPRESSED)
- str->append(STRING_WITH_LEN(" compressed"));
- break;
-
- case MYSQL_TYPE_STRING:
- {
- /*
- This is taken from Field_string::unpack.
- */
- CHARSET_INFO *cs= str->charset();
- uint bytes= (((metadata >> 4) & 0x300) ^ 0x300) + (metadata & 0x00ff);
- size_t length=0;
- if (char_with_octets)
- length= cs->cset->snprintf(cs, (char*) str->ptr(), str->alloced_length(),
- "char(%u octets)", bytes);
- else
- length= cs->cset->snprintf(cs, (char*) str->ptr(), str->alloced_length(),
- "binary(%u)", bytes);
- str->length(length);
- }
- break;
-
- case MYSQL_TYPE_GEOMETRY:
- str->set_ascii(STRING_WITH_LEN("geometry"));
- break;
-
- default:
- str->set_ascii(STRING_WITH_LEN("<unknown type>"));
- }
- DBUG_VOID_RETURN;
-}
-
-
-/**
- Check the order variable and print errors if the order is not
- acceptable according to the current settings.
-
- @param order The computed order of the conversion needed.
- @param rli The relay log info data structure: for error reporting.
- */
-bool is_conversion_ok(int order, Relay_log_info *rli)
-{
- DBUG_ENTER("is_conversion_ok");
- bool allow_non_lossy, allow_lossy;
-
- allow_non_lossy = slave_type_conversions_options &
- (1ULL << SLAVE_TYPE_CONVERSIONS_ALL_NON_LOSSY);
- allow_lossy= slave_type_conversions_options &
- (1ULL << SLAVE_TYPE_CONVERSIONS_ALL_LOSSY);
-
- DBUG_PRINT("enter", ("order: %d, flags:%s%s", order,
- allow_non_lossy ? " ALL_NON_LOSSY" : "",
- allow_lossy ? " ALL_LOSSY" : ""));
- if (order < 0 && !allow_non_lossy)
- {
- /* !!! Add error message saying that non-lossy conversions need to be allowed. */
- DBUG_RETURN(false);
- }
-
- if (order > 0 && !allow_lossy)
- {
- /* !!! Add error message saying that lossy conversions need to be allowed. */
- DBUG_RETURN(false);
- }
-
- DBUG_RETURN(true);
-}
-
-
-/**
- Can a type potentially be converted to another type?
-
- This function check if the types are convertible and what
- conversion is required.
-
- If conversion is not possible, and error is printed.
-
- If conversion is possible:
-
- - *order will be set to -1 if source type is smaller than target
- type and a non-lossy conversion can be required. This includes
- the case where the field types are different but types could
- actually be converted in either direction.
-
- - *order will be set to 0 if no conversion is required.
-
- - *order will be set to 1 if the source type is strictly larger
- than the target type and that conversion is potentially lossy.
-
- @param[in] field Target field
- @param[in] type Source field type
- @param[in] metadata Source field metadata
- @param[in] rli Relay log info (for error reporting)
- @param[in] mflags Flags from the table map event
- @param[out] order Order between source field and target field
-
- @return @c true if conversion is possible according to the current
- settings, @c false if conversion is not possible according to the
- current setting.
- */
-static bool
-can_convert_field_to(Field *field,
- enum_field_types source_type, uint16 metadata,
- Relay_log_info *rli, uint16 mflags,
- int *order_var)
-{
- DBUG_ENTER("can_convert_field_to");
- bool same_type;
-#ifndef DBUG_OFF
- char field_type_buf[MAX_FIELD_WIDTH];
- String field_type(field_type_buf, sizeof(field_type_buf), &my_charset_latin1);
- field->sql_type(field_type);
- DBUG_PRINT("enter", ("field_type: %s, target_type: %d, source_type: %d, source_metadata: 0x%x",
- field_type.c_ptr_safe(), field->real_type(), source_type, metadata));
-#endif
- /**
- @todo
- Implement Field_varstring_cmopressed::real_type() and
- Field_blob_compressed::real_type() properly. All occurencies
- of Field::real_type() have to be inspected and adjusted if needed.
-
- Until it is not ready we have to compare source_type against
- binlog_type() when replicating from or to compressed data types.
-
- @sa Comment for Field::binlog_type()
- */
- if (source_type == MYSQL_TYPE_VARCHAR_COMPRESSED ||
- source_type == MYSQL_TYPE_BLOB_COMPRESSED ||
- field->binlog_type() == MYSQL_TYPE_VARCHAR_COMPRESSED ||
- field->binlog_type() == MYSQL_TYPE_BLOB_COMPRESSED)
- same_type= field->binlog_type() == source_type;
- else
- same_type= field->real_type() == source_type;
-
- /*
- If the real type is the same, we need to check the metadata to
- decide if conversions are allowed.
- */
- if (same_type)
- {
- if (metadata == 0) // Metadata can only be zero if no metadata was provided
- {
- /*
- If there is no metadata, we either have an old event where no
- metadata were supplied, or a type that does not require any
- metadata. In either case, conversion can be done but no
- conversion table is necessary.
- */
- DBUG_PRINT("debug", ("Base types are identical, but there is no metadata"));
- *order_var= 0;
- DBUG_RETURN(true);
- }
-
- DBUG_PRINT("debug", ("Base types are identical, doing field size comparison"));
- if (field->compatible_field_size(metadata, rli, mflags, order_var))
- DBUG_RETURN(is_conversion_ok(*order_var, rli));
- else
- DBUG_RETURN(false);
- }
- else if (
- /*
- Conversion from MariaDB TIMESTAMP(0), TIME(0), DATETIME(0)
- to the corresponding MySQL56 types is non-lossy.
- */
- (metadata == 0 &&
- ((field->real_type() == MYSQL_TYPE_TIMESTAMP2 &&
- source_type == MYSQL_TYPE_TIMESTAMP) ||
- (field->real_type() == MYSQL_TYPE_TIME2 &&
- source_type == MYSQL_TYPE_TIME) ||
- (field->real_type() == MYSQL_TYPE_DATETIME2 &&
- source_type == MYSQL_TYPE_DATETIME))) ||
- /*
- Conversion from MySQL56 TIMESTAMP(N), TIME(N), DATETIME(N)
- to the corresponding MariaDB or MySQL55 types is non-lossy.
- */
- (metadata == field->decimals() &&
- ((field->real_type() == MYSQL_TYPE_TIMESTAMP &&
- source_type == MYSQL_TYPE_TIMESTAMP2) ||
- (field->real_type() == MYSQL_TYPE_TIME &&
- source_type == MYSQL_TYPE_TIME2) ||
- (field->real_type() == MYSQL_TYPE_DATETIME &&
- source_type == MYSQL_TYPE_DATETIME2))))
- {
- /*
- TS-TODO: conversion from FSP1>FSP2.
- */
- *order_var= -1;
- DBUG_RETURN(true);
- }
- else if (!slave_type_conversions_options)
- DBUG_RETURN(false);
-
- /*
- Here, from and to will always be different. Since the types are
- different, we cannot use the compatible_field_size() function, but
- have to rely on hard-coded max-sizes for fields.
- */
-
- DBUG_PRINT("debug", ("Base types are different, checking conversion"));
- switch (source_type) // Source type (on master)
- {
- case MYSQL_TYPE_DECIMAL:
- case MYSQL_TYPE_NEWDECIMAL:
- case MYSQL_TYPE_FLOAT:
- case MYSQL_TYPE_DOUBLE:
- switch (field->real_type())
- {
- case MYSQL_TYPE_NEWDECIMAL:
- /*
- Then the other type is either FLOAT, DOUBLE, or old style
- DECIMAL, so we require lossy conversion.
- */
- *order_var= 1;
- DBUG_RETURN(is_conversion_ok(*order_var, rli));
-
- case MYSQL_TYPE_DECIMAL:
- case MYSQL_TYPE_FLOAT:
- case MYSQL_TYPE_DOUBLE:
- {
- if (source_type == MYSQL_TYPE_NEWDECIMAL ||
- source_type == MYSQL_TYPE_DECIMAL)
- *order_var = 1; // Always require lossy conversions
- else
- *order_var= compare_lengths(field, source_type, metadata);
- DBUG_ASSERT(*order_var != 0);
- DBUG_RETURN(is_conversion_ok(*order_var, rli));
- }
-
- default:
- DBUG_RETURN(false);
- }
- break;
-
- /*
- The length comparison check will do the correct job of comparing
- the field lengths (in bytes) of two integer types.
- */
- case MYSQL_TYPE_TINY:
- case MYSQL_TYPE_SHORT:
- case MYSQL_TYPE_INT24:
- case MYSQL_TYPE_LONG:
- case MYSQL_TYPE_LONGLONG:
- switch (field->real_type())
- {
- case MYSQL_TYPE_TINY:
- case MYSQL_TYPE_SHORT:
- case MYSQL_TYPE_INT24:
- case MYSQL_TYPE_LONG:
- case MYSQL_TYPE_LONGLONG:
- /*
- max_display_length_for_field() is not fully precise for the integer
- data types. So its result cannot be compared to the result of
- field->max_dispay_length() when the table field and the binlog field
- are of the same type.
- This code should eventually be rewritten not to use
- compare_lengths(), to detect subtype/supetype relations
- just using the type codes.
- */
- DBUG_ASSERT(source_type != field->real_type());
- *order_var= compare_lengths(field, source_type, metadata);
- DBUG_ASSERT(*order_var != 0);
- DBUG_RETURN(is_conversion_ok(*order_var, rli));
-
- default:
- DBUG_RETURN(false);
- }
- break;
-
- /*
- Since source and target type is different, and it is not possible
- to convert bit types to anything else, this will return false.
- */
- case MYSQL_TYPE_BIT:
- DBUG_RETURN(false);
-
- /*
- If all conversions are disabled, it is not allowed to convert
- between these types. Since the TEXT vs. BINARY is distinguished by
- the charset, and the charset is not replicated, we cannot
- currently distinguish between , e.g., TEXT and BLOB.
- */
- case MYSQL_TYPE_TINY_BLOB:
- case MYSQL_TYPE_MEDIUM_BLOB:
- case MYSQL_TYPE_LONG_BLOB:
- case MYSQL_TYPE_BLOB:
- case MYSQL_TYPE_BLOB_COMPRESSED:
- case MYSQL_TYPE_STRING:
- case MYSQL_TYPE_VAR_STRING:
- case MYSQL_TYPE_VARCHAR:
- case MYSQL_TYPE_VARCHAR_COMPRESSED:
- switch (field->real_type())
- {
- case MYSQL_TYPE_TINY_BLOB:
- case MYSQL_TYPE_MEDIUM_BLOB:
- case MYSQL_TYPE_LONG_BLOB:
- case MYSQL_TYPE_BLOB:
- case MYSQL_TYPE_BLOB_COMPRESSED:
- case MYSQL_TYPE_STRING:
- case MYSQL_TYPE_VAR_STRING:
- case MYSQL_TYPE_VARCHAR:
- case MYSQL_TYPE_VARCHAR_COMPRESSED:
- *order_var= compare_lengths(field, source_type, metadata);
- /*
- Here we know that the types are different, so if the order
- gives that they do not require any conversion, we still need
- to have non-lossy conversion enabled to allow conversion
- between different (string) types of the same length.
- */
- if (*order_var == 0)
- *order_var= -1;
- DBUG_RETURN(is_conversion_ok(*order_var, rli));
-
- default:
- DBUG_RETURN(false);
- }
- break;
-
- case MYSQL_TYPE_GEOMETRY:
- case MYSQL_TYPE_TIMESTAMP:
- case MYSQL_TYPE_DATE:
- case MYSQL_TYPE_TIME:
- case MYSQL_TYPE_DATETIME:
- case MYSQL_TYPE_YEAR:
- case MYSQL_TYPE_NULL:
- case MYSQL_TYPE_ENUM:
- case MYSQL_TYPE_SET:
- case MYSQL_TYPE_TIMESTAMP2:
- case MYSQL_TYPE_TIME2:
- DBUG_RETURN(false);
- case MYSQL_TYPE_NEWDATE:
- {
- if (field->real_type() == MYSQL_TYPE_DATETIME2 ||
- field->real_type() == MYSQL_TYPE_DATETIME)
- {
- *order_var= -1;
- DBUG_RETURN(is_conversion_ok(*order_var, rli));
- }
- else
- {
- DBUG_RETURN(false);
- }
- }
- break;
-
- //case MYSQL_TYPE_DATETIME: TODO: fix MDEV-17394 and uncomment.
- //
- //The "old" type does not specify the fraction part size which is required
- //for correct conversion.
- case MYSQL_TYPE_DATETIME2:
- {
- if (field->real_type() == MYSQL_TYPE_NEWDATE)
- {
- *order_var= 1;
- DBUG_RETURN(is_conversion_ok(*order_var, rli));
- }
- else
- {
- DBUG_RETURN(false);
- }
- }
- break;
- }
- DBUG_RETURN(false); // To keep GCC happy
-}
-
-
-/**
- Is the definition compatible with a table?
-
- This function will compare the master table with an existing table
- on the slave and see if they are compatible with respect to the
- current settings of @c SLAVE_TYPE_CONVERSIONS.
-
- If the tables are compatible and conversions are required, @c
- *tmp_table_var will be set to a virtual temporary table with field
- pointers for the fields that require conversions. This allow simple
- checking of whether a conversion are to be applied or not.
-
- If tables are compatible, but no conversions are necessary, @c
- *tmp_table_var will be set to NULL.
-
- @param rli_arg[in]
- Relay log info, for error reporting.
-
- @param table[in]
- Table to compare with
-
- @param tmp_table_var[out]
- Virtual temporary table for performing conversions, if necessary.
-
- @retval true Master table is compatible with slave table.
- @retval false Master table is not compatible with slave table.
-*/
-bool
-table_def::compatible_with(THD *thd, rpl_group_info *rgi,
- TABLE *table, TABLE **conv_table_var)
- const
-{
- /*
- We only check the initial columns for the tables.
- */
- uint const cols_to_check= MY_MIN(table->s->fields, size());
- Relay_log_info *rli= rgi->rli;
- TABLE *tmp_table= NULL;
-
- for (uint col= 0 ; col < cols_to_check ; ++col)
- {
- Field *const field= table->field[col];
- int order;
- if (can_convert_field_to(field, type(col), field_metadata(col), rli, m_flags, &order))
- {
- DBUG_PRINT("debug", ("Checking column %d -"
- " field '%s' can be converted - order: %d",
- col, field->field_name.str, order));
- DBUG_ASSERT(order >= -1 && order <= 1);
-
- /*
- If order is not 0, a conversion is required, so we need to set
- up the conversion table.
- */
- if (order != 0 && tmp_table == NULL)
- {
- /*
- This will create the full table with all fields. This is
- necessary to ge the correct field lengths for the record.
- */
- tmp_table= create_conversion_table(thd, rgi, table);
- if (tmp_table == NULL)
- return false;
- /*
- Clear all fields up to, but not including, this column.
- */
- for (unsigned int i= 0; i < col; ++i)
- tmp_table->field[i]= NULL;
- }
-
- if (order == 0 && tmp_table != NULL)
- tmp_table->field[col]= NULL;
- }
- else
- {
- DBUG_PRINT("debug", ("Checking column %d -"
- " field '%s' can not be converted",
- col, field->field_name.str));
- 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;
- bool char_with_octets= field->cmp_type() == STRING_RESULT ?
- field->has_charset() : true;
-
- show_sql_type(type(col), field_metadata(col), &source_type,
- char_with_octets);
- field->sql_rpl_type(&target_type);
-
- rli->report(ERROR_LEVEL, ER_SLAVE_CONVERSION_FAILED, rgi->gtid_info(),
- ER_THD(thd, ER_SLAVE_CONVERSION_FAILED),
- col, db_name, tbl_name,
- source_type.c_ptr_safe(), target_type.c_ptr_safe());
- return false;
- }
- }
-
-#ifndef DBUG_OFF
- if (tmp_table)
- {
- for (unsigned int col= 0; col < tmp_table->s->fields; ++col)
- if (tmp_table->field[col])
- {
- 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);
- tmp_table->field[col]->sql_type(source_type);
- table->field[col]->sql_type(target_type);
- DBUG_PRINT("debug", ("Field %s - conversion required."
- " Source type: '%s', Target type: '%s'",
- tmp_table->field[col]->field_name.str,
- source_type.c_ptr_safe(), target_type.c_ptr_safe()));
- }
- }
-#endif
-
- *conv_table_var= tmp_table;
- return true;
-}
-
-
-/**
- A wrapper to Virtual_tmp_table, to get access to its constructor,
- which is protected for safety purposes (against illegal use on stack).
-*/
-class Virtual_conversion_table: public Virtual_tmp_table
-{
-public:
- Virtual_conversion_table(THD *thd) :Virtual_tmp_table(thd) { }
- /**
- Add a new field into the virtual table.
- @param sql_type - The real_type of the field.
- @param metadata - The RBR binary log metadata for this field.
- @param target_field - The field from the target table, to get extra
- attributes from (e.g. typelib in case of ENUM).
- */
- bool add(enum_field_types sql_type,
- uint16 metadata, const Field *target_field)
- {
- const Type_handler *handler= Type_handler::get_handler_by_real_type(sql_type);
- if (!handler)
- {
- sql_print_error("In RBR mode, Slave received unknown field type field %d "
- " for column Name: %s.%s.%s.",
- (int) sql_type,
- target_field->table->s->db.str,
- target_field->table->s->table_name.str,
- target_field->field_name.str);
- return true;
- }
- Field *tmp= handler->make_conversion_table_field(this, metadata,
- target_field);
- if (!tmp)
- return true;
- Virtual_tmp_table::add(tmp);
- DBUG_PRINT("debug", ("sql_type: %d, target_field: '%s', max_length: %d, decimals: %d,"
- " maybe_null: %d, unsigned_flag: %d, pack_length: %u",
- sql_type, target_field->field_name.str,
- tmp->field_length, tmp->decimals(), TRUE,
- tmp->flags, tmp->pack_length()));
- return false;
- }
-};
-
-
-/**
- Create a conversion table.
-
- If the function is unable to create the conversion table, an error
- will be printed and NULL will be returned.
-
- @return Pointer to conversion table, or NULL if unable to create
- conversion table.
- */
-
-TABLE *table_def::create_conversion_table(THD *thd, rpl_group_info *rgi,
- TABLE *target_table) const
-{
- DBUG_ENTER("table_def::create_conversion_table");
-
- Virtual_conversion_table *conv_table;
- Relay_log_info *rli= rgi->rli;
- /*
- At slave, columns may differ. So we should create
- MY_MIN(columns@master, columns@slave) columns in the
- conversion table.
- */
- uint const cols_to_create= MY_MIN(target_table->s->fields, size());
- if (!(conv_table= new(thd) Virtual_conversion_table(thd)) ||
- conv_table->init(cols_to_create))
- goto err;
- for (uint col= 0 ; col < cols_to_create; ++col)
- {
- if (conv_table->add(type(col), field_metadata(col),
- target_table->field[col]))
- {
- DBUG_PRINT("debug", ("binlog_type: %d, metadata: %04X, target_field: '%s'"
- " make_conversion_table_field() failed",
- binlog_type(col), field_metadata(col),
- target_table->field[col]->field_name.str));
- goto err;
- }
- }
-
- if (conv_table->open())
- goto err; // Could not allocate record buffer?
-
- DBUG_RETURN(conv_table);
-
-err:
- if (conv_table)
- delete conv_table;
- rli->report(ERROR_LEVEL, ER_SLAVE_CANT_CREATE_CONVERSION, rgi->gtid_info(),
- ER_THD(thd, ER_SLAVE_CANT_CREATE_CONVERSION),
- target_table->s->db.str,
- target_table->s->table_name.str);
- DBUG_RETURN(NULL);
-}
-#endif /* MYSQL_CLIENT */
table_def::table_def(unsigned char *types, ulong size,
uchar *field_metadata, int metadata_size,
@@ -1256,67 +334,3 @@ bool event_checksum_test(uchar *event_buf, ulong event_len, enum enum_binlog_che
}
return res;
}
-
-#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
-
-Deferred_log_events::Deferred_log_events(Relay_log_info *rli) : last_added(NULL)
-{
- my_init_dynamic_array(&array, sizeof(Log_event *), 32, 16, MYF(0));
-}
-
-Deferred_log_events::~Deferred_log_events()
-{
- delete_dynamic(&array);
-}
-
-int Deferred_log_events::add(Log_event *ev)
-{
- last_added= ev;
- insert_dynamic(&array, (uchar*) &ev);
- return 0;
-}
-
-bool Deferred_log_events::is_empty()
-{
- return array.elements == 0;
-}
-
-bool Deferred_log_events::execute(rpl_group_info *rgi)
-{
- bool res= false;
- DBUG_ENTER("Deferred_log_events::execute");
- DBUG_ASSERT(rgi->deferred_events_collecting);
-
- rgi->deferred_events_collecting= false;
- for (uint i= 0; !res && i < array.elements; i++)
- {
- Log_event *ev= (* (Log_event **)
- dynamic_array_ptr(&array, i));
- res= ev->apply_event(rgi);
- }
- rgi->deferred_events_collecting= true;
- DBUG_RETURN(res);
-}
-
-void Deferred_log_events::rewind()
-{
- /*
- Reset preceding Query log event events which execution was
- deferred because of slave side filtering.
- */
- if (!is_empty())
- {
- for (uint i= 0; i < array.elements; i++)
- {
- Log_event *ev= *(Log_event **) dynamic_array_ptr(&array, i);
- delete ev;
- }
- last_added= NULL;
- if (array.elements > array.max_element)
- freeze_size(&array);
- reset_dynamic(&array);
- }
- last_added= NULL;
-}
-
-#endif
diff --git a/sql/rpl_utility.h b/sql/rpl_utility.h
index b42b11231e0..c28e8aa10eb 100644
--- a/sql/rpl_utility.h
+++ b/sql/rpl_utility.h
@@ -118,7 +118,9 @@ public:
return source_type;
}
-
+#ifdef MYSQL_SERVER
+ const Type_handler *field_type_handler(uint index) const;
+#endif
/*
This function allows callers to get the extra field data from the
diff --git a/sql/rpl_utility_server.cc b/sql/rpl_utility_server.cc
new file mode 100644
index 00000000000..e58c9cf018e
--- /dev/null
+++ b/sql/rpl_utility_server.cc
@@ -0,0 +1,1185 @@
+/* Copyright (c) 2006, 2013, Oracle and/or its affiliates.
+ Copyright (c) 2011, 2013, 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
+
+#include "mariadb.h"
+#include <my_bit.h>
+#include "rpl_utility.h"
+#include "log_event.h"
+
+#if defined(MYSQL_CLIENT)
+#error MYSQL_CLIENT must not be defined here
+#endif
+
+#if !defined(MYSQL_SERVER)
+#error MYSQL_SERVER must be defined here
+#endif
+
+#if defined(HAVE_REPLICATION)
+#include "rpl_rli.h"
+#include "sql_select.h"
+#endif
+
+
+/**
+ Compute the maximum display length of a field.
+
+ @param sql_type Type of the field
+ @param metadata The metadata from the master for the field.
+ @return Maximum length of the field in bytes.
+
+ The precise values calculated by field->max_display_length() and
+ calculated by max_display_length_for_field() can differ (by +1 or -1)
+ for integer data types (TINYINT, SMALLINT, MEDIUMINT, INT, BIGINT).
+ This slight difference is not important here, because we call
+ this function only for two *different* integer data types.
+ */
+static uint32
+max_display_length_for_field(const Conv_source &source)
+{
+ DBUG_PRINT("debug", ("sql_type: %s, metadata: 0x%x",
+ source.type_handler()->name().ptr(), source.metadata()));
+ return source.type_handler()->max_display_length_for_field(source);
+}
+
+
+/*
+ Compare the pack lengths of a source field (on the master) and a
+ target field (on the slave).
+
+ @param sh Source type handler
+ @param source_length Source length
+ @param th Target type hander
+ @param target_length Target length
+
+ @retval CONV_TYPE_SUBSET_TO_SUPERSET The length of the source field is
+ smaller than the target field.
+ @retval CONV_TYPE_PRECISE The length of the source and
+ the target fields are equal.
+ @retval CONV_TYPE_SUPERSET_TO_SUBSET The length of the source field is
+ greater than the target field.
+ */
+static enum_conv_type
+compare_lengths(const Type_handler *sh, uint32 source_length,
+ const Type_handler *th, uint32 target_length)
+{
+ DBUG_ENTER("compare_lengths");
+ DBUG_PRINT("debug", ("source_length: %lu, source_type: %s,"
+ " target_length: %lu, target_type: %s",
+ (unsigned long) source_length, sh->name().ptr(),
+ (unsigned long) target_length, th->name().ptr()));
+ enum_conv_type result=
+ source_length < target_length ? CONV_TYPE_SUBSET_TO_SUPERSET :
+ source_length > target_length ? CONV_TYPE_SUPERSET_TO_SUBSET :
+ CONV_TYPE_PRECISE;
+ DBUG_PRINT("result", ("%d", result));
+ DBUG_RETURN(result);
+}
+
+
+/**
+ Calculate display length for MySQL56 temporal data types from their metadata.
+ It contains fractional precision in the low 16-bit word.
+*/
+static uint32
+max_display_length_for_temporal2_field(uint32 int_display_length,
+ unsigned int metadata)
+{
+ metadata&= 0x00ff;
+ return int_display_length + metadata + (metadata ? 1 : 0);
+}
+
+
+uint32
+Type_handler_newdecimal::max_display_length_for_field(const Conv_source &src)
+ const
+{
+ return src.metadata() >> 8;
+}
+
+
+uint32
+Type_handler_typelib::max_display_length_for_field(const Conv_source &src)
+ const
+{
+ /*
+ Field_enum::rpl_conv_type_from() does not use compare_lengths().
+ So we should not come here.
+ */
+ DBUG_ASSERT(0);
+ return src.metadata() & 0x00ff;
+}
+
+
+uint32
+Type_handler_string::max_display_length_for_field(const Conv_source &src)
+ const
+{
+ /*
+ ENUM and SET are transferred using as STRING,
+ with the exact type code in metadata.
+ Make sure that we previously detected ENUM/SET and
+ translated them into a proper type handler.
+ See table_def::field_type_handler() for details.
+ */
+ DBUG_ASSERT((src.metadata() >> 8) != MYSQL_TYPE_SET);
+ DBUG_ASSERT((src.metadata() >> 8) != MYSQL_TYPE_ENUM);
+ /* This is taken from Field_string::unpack. */
+ return (((src.metadata() >> 4) & 0x300) ^ 0x300) + (src.metadata() & 0x00ff);
+}
+
+
+uint32
+Type_handler_time2::max_display_length_for_field(const Conv_source &src)
+ const
+{
+ return max_display_length_for_temporal2_field(MIN_TIME_WIDTH,
+ src.metadata());
+}
+
+
+uint32
+Type_handler_timestamp2::max_display_length_for_field(const Conv_source &src)
+ const
+{
+ return max_display_length_for_temporal2_field(MAX_DATETIME_WIDTH,
+ src.metadata());
+}
+
+
+uint32
+Type_handler_datetime2::max_display_length_for_field(const Conv_source &src)
+ const
+{
+ return max_display_length_for_temporal2_field(MAX_DATETIME_WIDTH,
+ src.metadata());
+}
+
+
+uint32
+Type_handler_bit::max_display_length_for_field(const Conv_source &src)
+ const
+{
+ /*
+ Decode the size of the bit field from the master.
+ */
+ DBUG_ASSERT((src.metadata() & 0xff) <= 7);
+ return 8 * (src.metadata() >> 8U) + (src.metadata() & 0x00ff);
+}
+
+
+uint32
+Type_handler_var_string::max_display_length_for_field(const Conv_source &src)
+ const
+{
+ return src.metadata();
+}
+
+
+uint32
+Type_handler_varchar::max_display_length_for_field(const Conv_source &src)
+ const
+{
+ return src.metadata();
+}
+
+
+uint32
+Type_handler_varchar_compressed::
+ max_display_length_for_field(const Conv_source &src) const
+{
+ DBUG_ASSERT(src.metadata() > 0);
+ return src.metadata() - 1;
+}
+
+
+/*
+ The actual length for these types does not really matter since
+ they are used to calc_pack_length, which ignores the given
+ length for these types.
+
+ Since we want this to be accurate for other uses, we return the
+ maximum size in bytes of these BLOBs.
+*/
+uint32
+Type_handler_tiny_blob::max_display_length_for_field(const Conv_source &src)
+ const
+{
+ return (uint32) my_set_bits(1 * 8);
+}
+
+
+uint32
+Type_handler_medium_blob::max_display_length_for_field(const Conv_source &src)
+ const
+{
+ return (uint32) my_set_bits(3 * 8);
+}
+
+
+uint32
+Type_handler_blob::max_display_length_for_field(const Conv_source &src)
+ const
+{
+ /*
+ For the blob type, Field::real_type() lies and say that all
+ blobs are of type MYSQL_TYPE_BLOB. In that case, we have to look
+ at the length instead to decide what the max display size is.
+ */
+ return (uint32) my_set_bits(src.metadata() * 8);
+}
+
+
+uint32
+Type_handler_blob_compressed::max_display_length_for_field(const Conv_source &src)
+ const
+{
+ return (uint32) my_set_bits(src.metadata() * 8);
+}
+
+
+uint32
+Type_handler_long_blob::max_display_length_for_field(const Conv_source &src)
+ const
+{
+ return (uint32) my_set_bits(4 * 8);
+}
+
+
+uint32
+Type_handler_olddecimal::max_display_length_for_field(const Conv_source &src)
+ const
+{
+ return ~(uint32) 0;
+}
+
+
+void Type_handler::show_binlog_type(const Conv_source &src, const Field &,
+ String *str) const
+{
+ str->set_ascii(name().ptr(), name().length());
+}
+
+
+void Type_handler_var_string::show_binlog_type(const Conv_source &src,
+ const Field &dst,
+ String *str) const
+{
+ CHARSET_INFO *cs= str->charset();
+ const char* fmt= dst.cmp_type() != STRING_RESULT || dst.has_charset()
+ ? "char(%u octets)" : "binary(%u)";
+ size_t length= cs->cset->snprintf(cs, (char*) str->ptr(),
+ str->alloced_length(),
+ fmt, src.metadata());
+ str->length(length);
+}
+
+
+void Type_handler_varchar::show_binlog_type(const Conv_source &src,
+ const Field &dst,
+ String *str) const
+{
+ CHARSET_INFO *cs= str->charset();
+ const char* fmt= dst.cmp_type() != STRING_RESULT || dst.has_charset()
+ ? "varchar(%u octets)" : "varbinary(%u)";
+ size_t length= cs->cset->snprintf(cs, (char*) str->ptr(),
+ str->alloced_length(),
+ fmt, src.metadata());
+ str->length(length);
+}
+
+
+void Type_handler_varchar_compressed::show_binlog_type(const Conv_source &src,
+ const Field &dst,
+ String *str) const
+{
+ CHARSET_INFO *cs= str->charset();
+ const char* fmt= dst.cmp_type() != STRING_RESULT || dst.has_charset()
+ ? "varchar(%u octets) compressed" : "varbinary(%u) compressed";
+ size_t length= cs->cset->snprintf(cs, (char*) str->ptr(),
+ str->alloced_length(),
+ fmt, src.metadata());
+ str->length(length);
+}
+
+void Type_handler_bit::show_binlog_type(const Conv_source &src, const Field &,
+ String *str) const
+{
+ CHARSET_INFO *cs= str->charset();
+ int bit_length= 8 * (src.metadata() >> 8) + (src.metadata() & 0xFF);
+ size_t length=
+ cs->cset->snprintf(cs, (char*) str->ptr(), str->alloced_length(),
+ "bit(%d)", bit_length);
+ str->length(length);
+}
+
+
+void Type_handler_olddecimal::show_binlog_type(const Conv_source &src,
+ const Field &,
+ String *str) const
+{
+ CHARSET_INFO *cs= str->charset();
+ size_t length=
+ cs->cset->snprintf(cs, (char*) str->ptr(), str->alloced_length(),
+ "decimal(%d,?)/*old*/", src.metadata());
+ str->length(length);
+
+}
+
+
+void Type_handler_newdecimal::show_binlog_type(const Conv_source &src,
+ const Field &,
+ String *str) const
+{
+ CHARSET_INFO *cs= str->charset();
+ size_t length=
+ cs->cset->snprintf(cs, (char*) str->ptr(), str->alloced_length(),
+ "decimal(%d,%d)",
+ src.metadata() >> 8, src.metadata() & 0xff);
+ str->length(length);
+}
+
+
+void Type_handler_blob_compressed::show_binlog_type(const Conv_source &src,
+ const Field &,
+ String *str) const
+{
+ /*
+ Field::real_type() lies regarding the actual type of a BLOB, so
+ it is necessary to check the pack length to figure out what kind
+ of blob it really is.
+ */
+ switch (src.metadata()) {
+ case 1:
+ str->set_ascii(STRING_WITH_LEN("tinyblob compressed"));
+ break;
+ case 2:
+ str->set_ascii(STRING_WITH_LEN("blob compressed"));
+ break;
+ case 3:
+ str->set_ascii(STRING_WITH_LEN("mediumblob compressed"));
+ break;
+ default:
+ DBUG_ASSERT(0);
+ // Fall through
+ case 4:
+ str->set_ascii(STRING_WITH_LEN("longblob compressed"));
+ }
+}
+
+
+void Type_handler_string::show_binlog_type(const Conv_source &src,
+ const Field &dst,
+ String *str) const
+{
+ /*
+ This is taken from Field_string::unpack.
+ */
+ CHARSET_INFO *cs= str->charset();
+ uint bytes= (((src.metadata() >> 4) & 0x300) ^ 0x300) +
+ (src.metadata() & 0x00ff);
+ const char* fmt= dst.cmp_type() != STRING_RESULT || dst.has_charset()
+ ? "char(%u octets)" : "binary(%u)";
+ size_t length= cs->cset->snprintf(cs, (char*) str->ptr(),
+ str->alloced_length(),
+ fmt, bytes);
+ str->length(length);
+}
+
+
+enum_conv_type
+Field::rpl_conv_type_from_same_data_type(uint16 metadata,
+ const Relay_log_info *rli,
+ const Conv_param &param) const
+{
+ if (metadata == 0) // Metadata can only be zero if no metadata was provided
+ {
+ /*
+ If there is no metadata, we either have an old event where no
+ metadata were supplied, or a type that does not require any
+ metadata. In either case, conversion can be done but no
+ conversion table is necessary.
+ */
+ DBUG_PRINT("debug", ("Base types are identical, but there is no metadata"));
+ return CONV_TYPE_PRECISE;
+ }
+
+ DBUG_PRINT("debug", ("Base types are identical, doing field size comparison"));
+ int order= 0;
+ if (!compatible_field_size(metadata, rli, param.table_def_flags(), &order))
+ return CONV_TYPE_IMPOSSIBLE;
+ return order == 0 ? CONV_TYPE_PRECISE :
+ order < 0 ? CONV_TYPE_SUBSET_TO_SUPERSET :
+ CONV_TYPE_SUPERSET_TO_SUBSET;
+}
+
+
+enum_conv_type
+Field_new_decimal::rpl_conv_type_from(const Conv_source &source,
+ const Relay_log_info *rli,
+ const Conv_param &param) const
+{
+ if (binlog_type() == source.real_field_type())
+ return rpl_conv_type_from_same_data_type(source.metadata(), rli, param);
+ if (source.type_handler() == &type_handler_olddecimal ||
+ source.type_handler() == &type_handler_newdecimal ||
+ source.type_handler() == &type_handler_float ||
+ source.type_handler() == &type_handler_double)
+ {
+ /*
+ Then the other type is either FLOAT, DOUBLE, or old style
+ DECIMAL, so we require lossy conversion.
+ */
+ return CONV_TYPE_SUPERSET_TO_SUBSET;
+ }
+ return CONV_TYPE_IMPOSSIBLE;
+}
+
+
+/*
+ This covers FLOAT, DOUBLE and old DECIMAL
+*/
+enum_conv_type
+Field_real::rpl_conv_type_from(const Conv_source &source,
+ const Relay_log_info *rli,
+ const Conv_param &param) const
+{
+ if (binlog_type() == source.real_field_type())
+ return rpl_conv_type_from_same_data_type(source.metadata(), rli, param);
+ if (source.type_handler() == &type_handler_olddecimal ||
+ source.type_handler() == &type_handler_newdecimal)
+ return CONV_TYPE_SUPERSET_TO_SUBSET; // Always require lossy conversions
+ if (source.type_handler() == &type_handler_float ||
+ source.type_handler() == &type_handler_double)
+ {
+ enum_conv_type order= compare_lengths(source.type_handler(),
+ max_display_length_for_field(source),
+ type_handler(), max_display_length());
+ DBUG_ASSERT(order != CONV_TYPE_PRECISE);
+ return order;
+ }
+ return CONV_TYPE_IMPOSSIBLE;
+}
+
+
+enum_conv_type
+Field_int::rpl_conv_type_from(const Conv_source &source,
+ const Relay_log_info *rli,
+ const Conv_param &param) const
+{
+ if (binlog_type() == source.real_field_type())
+ return rpl_conv_type_from_same_data_type(source.metadata(), rli, param);
+ /*
+ The length comparison check will do the correct job of comparing
+ the field lengths (in bytes) of two integer types.
+ */
+ if (source.type_handler() == &type_handler_stiny ||
+ source.type_handler() == &type_handler_sshort ||
+ source.type_handler() == &type_handler_sint24 ||
+ source.type_handler() == &type_handler_slong ||
+ source.type_handler() == &type_handler_slonglong)
+ {
+ /*
+ max_display_length_for_field() is not fully precise for the integer
+ data types. So its result cannot be compared to the result of
+ max_dispay_length() when the table field and the binlog field
+ are of the same type.
+ This code should eventually be rewritten not to use
+ compare_lengths(), to detect subtype/supetype relations
+ just using the type codes.
+ */
+ DBUG_ASSERT(source.real_field_type() != real_type());
+ enum_conv_type order= compare_lengths(source.type_handler(),
+ max_display_length_for_field(source),
+ type_handler(), max_display_length());
+ DBUG_ASSERT(order != CONV_TYPE_PRECISE);
+ return order;
+ }
+ return CONV_TYPE_IMPOSSIBLE;
+}
+
+
+enum_conv_type
+Field_enum::rpl_conv_type_from(const Conv_source &source,
+ const Relay_log_info *rli,
+ const Conv_param &param) const
+{
+ /*
+ For some reasons Field_enum and Field_set store MYSQL_TYPE_STRING
+ as a type code in the binary log and encode the real type in metadata.
+ So we need to test real_type() here instread of binlog_type().
+ */
+ return real_type() == source.real_field_type() ?
+ rpl_conv_type_from_same_data_type(source.metadata(), rli, param) :
+ CONV_TYPE_IMPOSSIBLE;
+}
+
+
+enum_conv_type
+Field_longstr::rpl_conv_type_from(const Conv_source &source,
+ const Relay_log_info *rli,
+ const Conv_param &param) const
+{
+ /**
+ @todo
+ Implement Field_varstring_compressed::real_type() and
+ Field_blob_compressed::real_type() properly. All occurencies
+ of Field::real_type() have to be inspected and adjusted if needed.
+
+ Until it is not ready we have to compare source_type against
+ binlog_type() when replicating from or to compressed data types.
+
+ @sa Comment for Field::binlog_type()
+ */
+ bool same_type;
+ if (source.real_field_type() == MYSQL_TYPE_VARCHAR_COMPRESSED ||
+ source.real_field_type() == MYSQL_TYPE_BLOB_COMPRESSED ||
+ binlog_type() == MYSQL_TYPE_VARCHAR_COMPRESSED ||
+ binlog_type() == MYSQL_TYPE_BLOB_COMPRESSED)
+ same_type= binlog_type() == source.real_field_type();
+ else
+ same_type= type_handler() == source.type_handler();
+
+ if (same_type)
+ return rpl_conv_type_from_same_data_type(source.metadata(), rli, param);
+
+ if (source.type_handler() == &type_handler_tiny_blob ||
+ source.type_handler() == &type_handler_medium_blob ||
+ source.type_handler() == &type_handler_long_blob ||
+ source.type_handler() == &type_handler_blob ||
+ source.type_handler() == &type_handler_blob_compressed ||
+ source.type_handler() == &type_handler_string ||
+ source.type_handler() == &type_handler_var_string ||
+ source.type_handler() == &type_handler_varchar ||
+ source.type_handler() == &type_handler_varchar_compressed)
+ {
+ enum_conv_type order= compare_lengths(source.type_handler(),
+ max_display_length_for_field(source),
+ type_handler(), max_display_length());
+ /*
+ Here we know that the types are different, so if the order
+ gives that they do not require any conversion, we still need
+ to have non-lossy conversion enabled to allow conversion
+ between different (string) types of the same length.
+
+ Also, if all conversions are disabled, it is not allowed to convert
+ between these types. Since the TEXT vs. BINARY is distinguished by
+ the charset, and the charset is not replicated, we cannot
+ currently distinguish between , e.g., TEXT and BLOB.
+ */
+ if (order == CONV_TYPE_PRECISE)
+ order= CONV_TYPE_SUBSET_TO_SUPERSET;
+ return order;
+ }
+ return CONV_TYPE_IMPOSSIBLE;
+}
+
+
+enum_conv_type
+Field_newdate::rpl_conv_type_from(const Conv_source &source,
+ const Relay_log_info *rli,
+ const Conv_param &param) const
+{
+ if (real_type() == source.real_field_type())
+ return rpl_conv_type_from_same_data_type(source.metadata(), rli, param);
+ if (source.type_handler() == &type_handler_datetime2)
+ return CONV_TYPE_SUPERSET_TO_SUBSET;
+ return CONV_TYPE_IMPOSSIBLE;
+}
+
+
+enum_conv_type
+Field_time::rpl_conv_type_from(const Conv_source &source,
+ const Relay_log_info *rli,
+ const Conv_param &param) const
+{
+ if (binlog_type() == source.real_field_type())
+ return rpl_conv_type_from_same_data_type(source.metadata(), rli, param);
+ // 'MySQL56 TIME(N)' -> 'MariaDB-5.3 TIME(N)' is non-lossy
+ if (decimals() == source.metadata() &&
+ source.type_handler() == &type_handler_time2)
+ return CONV_TYPE_VARIANT; // TODO: conversion from FSP1>FSP2
+ return CONV_TYPE_IMPOSSIBLE;
+}
+
+
+enum_conv_type
+Field_timef::rpl_conv_type_from(const Conv_source &source,
+ const Relay_log_info *rli,
+ const Conv_param &param) const
+{
+ if (binlog_type() == source.real_field_type())
+ return rpl_conv_type_from_same_data_type(source.metadata(), rli, param);
+ /*
+ See comment in Field_datetimef::rpl_conv_type_from()
+ 'MariaDB-5.3 TIME(0)' to 'MySQL56 TIME(0)' is non-lossy
+ */
+ if (source.metadata() == 0 && source.type_handler() == &type_handler_time)
+ return CONV_TYPE_VARIANT;
+ return CONV_TYPE_IMPOSSIBLE;
+}
+
+
+enum_conv_type
+Field_timestamp::rpl_conv_type_from(const Conv_source &source,
+ const Relay_log_info *rli,
+ const Conv_param &param) const
+{
+ if (binlog_type() == source.real_field_type())
+ return rpl_conv_type_from_same_data_type(source.metadata(), rli, param);
+ // 'MySQL56 TIMESTAMP(N)' -> MariaDB-5.3 TIMESTAMP(N)' is non-lossy
+ if (source.metadata() == decimals() &&
+ source.type_handler() == &type_handler_timestamp2)
+ return CONV_TYPE_VARIANT; // TODO: conversion from FSP1>FSP2
+ return CONV_TYPE_IMPOSSIBLE;
+}
+
+
+enum_conv_type
+Field_timestampf::rpl_conv_type_from(const Conv_source &source,
+ const Relay_log_info *rli,
+ const Conv_param &param) const
+{
+ if (binlog_type() == source.real_field_type())
+ return rpl_conv_type_from_same_data_type(source.metadata(), rli, param);
+ /*
+ See comment in Field_datetimef::rpl_conv_type_from()
+ 'MariaDB-5.3 TIMESTAMP(0)' to 'MySQL56 TIMESTAMP(0)' is non-lossy
+ */
+ if (source.metadata() == 0 &&
+ source.type_handler() == &type_handler_timestamp)
+ return CONV_TYPE_VARIANT;
+ return CONV_TYPE_IMPOSSIBLE;
+}
+
+
+enum_conv_type
+Field_datetime::rpl_conv_type_from(const Conv_source &source,
+ const Relay_log_info *rli,
+ const Conv_param &param) const
+{
+ if (binlog_type() == source.real_field_type())
+ return rpl_conv_type_from_same_data_type(source.metadata(), rli, param);
+ // 'MySQL56 DATETIME(N)' -> MariaDB-5.3 DATETIME(N) is non-lossy
+ if (source.metadata() == decimals() &&
+ source.type_handler() == &type_handler_datetime2)
+ return CONV_TYPE_VARIANT; // TODO: conversion from FSP1>FSP2
+ if (source.type_handler() == &type_handler_newdate)
+ return CONV_TYPE_SUBSET_TO_SUPERSET;
+ return CONV_TYPE_IMPOSSIBLE;
+}
+
+
+enum_conv_type
+Field_datetimef::rpl_conv_type_from(const Conv_source &source,
+ const Relay_log_info *rli,
+ const Conv_param &param) const
+{
+ if (binlog_type() == source.real_field_type())
+ return rpl_conv_type_from_same_data_type(source.metadata(), rli, param);
+ /*
+ 'MariaDB-5.3 DATETIME(N)' does not provide information about fractional
+ precision in metadata. So we assume the precision on the master is equal
+ to the precision on the slave.
+ TODO: See MDEV-17394 what happend in case precisions are in case different
+ 'MariaDB-5.3 DATETIME(0)' to 'MySQL56 DATETIME(0)' is non-lossy
+ */
+ if (source.metadata() == 0 &&
+ source.type_handler() == &type_handler_datetime)
+ return CONV_TYPE_VARIANT;
+ if (source.type_handler() == &type_handler_newdate)
+ return CONV_TYPE_SUBSET_TO_SUPERSET;
+ return CONV_TYPE_IMPOSSIBLE;
+}
+
+
+enum_conv_type
+Field_date::rpl_conv_type_from(const Conv_source &source,
+ const Relay_log_info *rli,
+ const Conv_param &param) const
+{
+ // old DATE
+ return binlog_type() == source.real_field_type() ?
+ rpl_conv_type_from_same_data_type(source.metadata(), rli, param) :
+ CONV_TYPE_IMPOSSIBLE;
+}
+
+
+enum_conv_type
+Field_bit::rpl_conv_type_from(const Conv_source &source,
+ const Relay_log_info *rli,
+ const Conv_param &param) const
+{
+ return binlog_type() == source.real_field_type() ?
+ rpl_conv_type_from_same_data_type(source.metadata(), rli, param) :
+ CONV_TYPE_IMPOSSIBLE;
+}
+
+
+enum_conv_type
+Field_year::rpl_conv_type_from(const Conv_source &source,
+ const Relay_log_info *rli,
+ const Conv_param &param) const
+{
+ return binlog_type() == source.real_field_type() ?
+ rpl_conv_type_from_same_data_type(source.metadata(), rli, param) :
+ CONV_TYPE_IMPOSSIBLE;
+}
+
+
+enum_conv_type
+Field_null::rpl_conv_type_from(const Conv_source &source,
+ const Relay_log_info *rli,
+ const Conv_param &param) const
+{
+ DBUG_ASSERT(0);
+ return CONV_TYPE_IMPOSSIBLE;
+}
+
+
+/**********************************************************************/
+
+
+#if defined(HAVE_REPLICATION)
+
+/**
+ */
+static void show_sql_type(const Conv_source &src, const Field &dst,
+ String *str)
+{
+ DBUG_ENTER("show_sql_type");
+ DBUG_ASSERT(src.type_handler() != NULL);
+ DBUG_PRINT("enter", ("type: %s, metadata: 0x%x",
+ src.type_handler()->name().ptr(), src.metadata()));
+ src.type_handler()->show_binlog_type(src, dst, str);
+ DBUG_VOID_RETURN;
+}
+
+
+/**
+ Check the order variable and print errors if the order is not
+ acceptable according to the current settings.
+
+ @param order The computed order of the conversion needed.
+ @param rli The relay log info data structure: for error reporting.
+ */
+static bool is_conversion_ok(enum_conv_type type, const Relay_log_info *rli,
+ ulonglong type_conversion_options)
+{
+ DBUG_ENTER("is_conversion_ok");
+ bool allow_non_lossy, allow_lossy;
+
+ allow_non_lossy= type_conversion_options &
+ (1ULL << SLAVE_TYPE_CONVERSIONS_ALL_NON_LOSSY);
+ allow_lossy= type_conversion_options &
+ (1ULL << SLAVE_TYPE_CONVERSIONS_ALL_LOSSY);
+
+ DBUG_PRINT("enter", ("order: %d, flags:%s%s", (int) type,
+ allow_non_lossy ? " ALL_NON_LOSSY" : "",
+ allow_lossy ? " ALL_LOSSY" : ""));
+ switch (type) {
+ case CONV_TYPE_PRECISE:
+ case CONV_TYPE_VARIANT:
+ DBUG_RETURN(true);
+ case CONV_TYPE_SUBSET_TO_SUPERSET:
+ /* !!! Add error message saying that non-lossy conversions need to be allowed. */
+ DBUG_RETURN(allow_non_lossy);
+ case CONV_TYPE_SUPERSET_TO_SUBSET:
+ /* !!! Add error message saying that lossy conversions need to be allowed. */
+ DBUG_RETURN(allow_lossy);
+ case CONV_TYPE_IMPOSSIBLE:
+ DBUG_RETURN(false);
+ }
+
+ DBUG_RETURN(false);
+}
+
+
+/**
+ Can a type potentially be converted to another type?
+
+ This function check if the types are convertible and what
+ conversion is required.
+
+ If conversion is not possible, and error is printed.
+
+ If conversion is possible:
+
+ - *order will be set to -1 if source type is smaller than target
+ type and a non-lossy conversion can be required. This includes
+ the case where the field types are different but types could
+ actually be converted in either direction.
+
+ - *order will be set to 0 if no conversion is required.
+
+ - *order will be set to 1 if the source type is strictly larger
+ than the target type and that conversion is potentially lossy.
+
+ @param[in] field Target field
+ @param[in] type Source field type
+ @param[in] metadata Source field metadata
+ @param[in] rli Relay log info (for error reporting)
+ @param[in] mflags Flags from the table map event
+ @param[out] order Order between source field and target field
+
+ @return @c true if conversion is possible according to the current
+ settings, @c false if conversion is not possible according to the
+ current setting.
+ */
+static enum_conv_type
+can_convert_field_to(Field *field, const Conv_source &source,
+ const Relay_log_info *rli,
+ const Conv_param &param)
+{
+ DBUG_ENTER("can_convert_field_to");
+#ifndef DBUG_OFF
+ char field_type_buf[MAX_FIELD_WIDTH];
+ String field_type(field_type_buf, sizeof(field_type_buf), &my_charset_latin1);
+ field->sql_type(field_type);
+ DBUG_PRINT("enter", ("field_type: %s, target_type: %d, source_type: %d, source_metadata: 0x%x",
+ field_type.c_ptr_safe(), field->real_type(),
+ source.real_field_type(), source.metadata()));
+#endif
+ DBUG_RETURN(field->rpl_conv_type_from(source, rli, param));
+}
+
+
+const Type_handler *table_def::field_type_handler(uint col) const
+{
+ enum_field_types typecode= binlog_type(col);
+ uint16 metadata= field_metadata(col);
+ DBUG_ASSERT(typecode != MYSQL_TYPE_ENUM);
+ DBUG_ASSERT(typecode != MYSQL_TYPE_SET);
+
+ if (typecode == MYSQL_TYPE_BLOB)
+ {
+ switch (metadata & 0xff) {
+ case 1: return &type_handler_tiny_blob;
+ case 2: return &type_handler_blob;
+ case 3: return &type_handler_medium_blob;
+ case 4: return &type_handler_long_blob;
+ default: return NULL;
+ }
+ }
+ if (typecode == MYSQL_TYPE_STRING)
+ {
+ uchar typecode2= metadata >> 8;
+ if (typecode2 == MYSQL_TYPE_SET)
+ return &type_handler_set;
+ if (typecode2 == MYSQL_TYPE_ENUM)
+ return &type_handler_enum;
+ return &type_handler_string;
+ }
+ /*
+ This type has not been used since before row-based replication,
+ so we can safely assume that it really is MYSQL_TYPE_NEWDATE.
+ */
+ if (typecode == MYSQL_TYPE_DATE)
+ return &type_handler_newdate;
+ return Type_handler::get_handler_by_real_type(typecode);
+}
+
+
+/**
+ Is the definition compatible with a table?
+
+ This function will compare the master table with an existing table
+ on the slave and see if they are compatible with respect to the
+ current settings of @c SLAVE_TYPE_CONVERSIONS.
+
+ If the tables are compatible and conversions are required, @c
+ *tmp_table_var will be set to a virtual temporary table with field
+ pointers for the fields that require conversions. This allow simple
+ checking of whether a conversion are to be applied or not.
+
+ If tables are compatible, but no conversions are necessary, @c
+ *tmp_table_var will be set to NULL.
+
+ @param rli_arg[in]
+ Relay log info, for error reporting.
+
+ @param table[in]
+ Table to compare with
+
+ @param tmp_table_var[out]
+ Virtual temporary table for performing conversions, if necessary.
+
+ @retval true Master table is compatible with slave table.
+ @retval false Master table is not compatible with slave table.
+*/
+bool
+table_def::compatible_with(THD *thd, rpl_group_info *rgi,
+ TABLE *table, TABLE **conv_table_var)
+ const
+{
+ /*
+ We only check the initial columns for the tables.
+ */
+ uint const cols_to_check= MY_MIN(table->s->fields, size());
+ Relay_log_info *rli= rgi->rli;
+ TABLE *tmp_table= NULL;
+
+ for (uint col= 0 ; col < cols_to_check ; ++col)
+ {
+ Field *const field= table->field[col];
+ const Type_handler *h= field_type_handler(col);
+ if (!h)
+ {
+ sql_print_error("In RBR mode, Slave received unknown field type field %d "
+ " for column Name: %s.%s.%s.",
+ binlog_type(col),
+ field->table->s->db.str,
+ field->table->s->table_name.str,
+ field->field_name.str);
+ return false;
+ }
+
+ if (!h)
+ return false; // An unknown data type found in the binary log
+ Conv_source source(h, field_metadata(col), field->charset());
+ enum_conv_type convtype= can_convert_field_to(field, source, rli,
+ Conv_param(m_flags));
+ if (is_conversion_ok(convtype, rli, slave_type_conversions_options))
+ {
+ DBUG_PRINT("debug", ("Checking column %d -"
+ " field '%s' can be converted - order: %d",
+ col, field->field_name.str, convtype));
+ /*
+ If conversion type is not CONV_TYPE_RECISE, a conversion is required,
+ so we need to set up the conversion table.
+ */
+ if (convtype != CONV_TYPE_PRECISE && tmp_table == NULL)
+ {
+ /*
+ This will create the full table with all fields. This is
+ necessary to ge the correct field lengths for the record.
+ */
+ tmp_table= create_conversion_table(thd, rgi, table);
+ if (tmp_table == NULL)
+ return false;
+ /*
+ Clear all fields up to, but not including, this column.
+ */
+ for (unsigned int i= 0; i < col; ++i)
+ tmp_table->field[i]= NULL;
+ }
+
+ if (convtype == CONV_TYPE_PRECISE && tmp_table != NULL)
+ tmp_table->field[col]= NULL;
+ }
+ else
+ {
+ DBUG_PRINT("debug", ("Checking column %d -"
+ " field '%s' can not be converted",
+ col, field->field_name.str));
+ 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;
+ StringBuffer<MAX_FIELD_WIDTH> source_type(&my_charset_latin1);
+ StringBuffer<MAX_FIELD_WIDTH> target_type(&my_charset_latin1);
+ THD *thd= table->in_use;
+
+ show_sql_type(source, *field, &source_type);
+ field->sql_rpl_type(&target_type);
+ DBUG_ASSERT(source_type.length() > 0);
+ DBUG_ASSERT(target_type.length() > 0);
+ rli->report(ERROR_LEVEL, ER_SLAVE_CONVERSION_FAILED, rgi->gtid_info(),
+ ER_THD(thd, ER_SLAVE_CONVERSION_FAILED),
+ col, db_name, tbl_name,
+ source_type.c_ptr_safe(), target_type.c_ptr_safe());
+ return false;
+ }
+ }
+
+#ifndef DBUG_OFF
+ if (tmp_table)
+ {
+ for (unsigned int col= 0; col < tmp_table->s->fields; ++col)
+ if (tmp_table->field[col])
+ {
+ 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);
+ tmp_table->field[col]->sql_type(source_type);
+ table->field[col]->sql_type(target_type);
+ DBUG_PRINT("debug", ("Field %s - conversion required."
+ " Source type: '%s', Target type: '%s'",
+ tmp_table->field[col]->field_name.str,
+ source_type.c_ptr_safe(), target_type.c_ptr_safe()));
+ }
+ }
+#endif
+
+ *conv_table_var= tmp_table;
+ return true;
+}
+
+
+/**
+ A wrapper to Virtual_tmp_table, to get access to its constructor,
+ which is protected for safety purposes (against illegal use on stack).
+*/
+class Virtual_conversion_table: public Virtual_tmp_table
+{
+public:
+ Virtual_conversion_table(THD *thd) :Virtual_tmp_table(thd) { }
+ /**
+ Add a new field into the virtual table.
+ @param handler - The type handler of the field.
+ @param metadata - The RBR binary log metadata for this field.
+ @param target_field - The field from the target table, to get extra
+ attributes from (e.g. typelib in case of ENUM).
+ */
+ bool add(const Type_handler *handler,
+ uint16 metadata, const Field *target_field)
+ {
+ Field *tmp= handler->make_conversion_table_field(in_use->mem_root,
+ this, metadata,
+ target_field);
+ if (!tmp)
+ return true;
+ Virtual_tmp_table::add(tmp);
+ DBUG_PRINT("debug", ("sql_type: %s, target_field: '%s', max_length: %d, decimals: %d,"
+ " maybe_null: %d, unsigned_flag: %d, pack_length: %u",
+ handler->name().ptr(), target_field->field_name.str,
+ tmp->field_length, tmp->decimals(), TRUE,
+ tmp->flags, tmp->pack_length()));
+ return false;
+ }
+};
+
+
+/**
+ Create a conversion table.
+
+ If the function is unable to create the conversion table, an error
+ will be printed and NULL will be returned.
+
+ @return Pointer to conversion table, or NULL if unable to create
+ conversion table.
+ */
+
+TABLE *table_def::create_conversion_table(THD *thd, rpl_group_info *rgi,
+ TABLE *target_table) const
+{
+ DBUG_ENTER("table_def::create_conversion_table");
+
+ Virtual_conversion_table *conv_table;
+ Relay_log_info *rli= rgi->rli;
+ /*
+ At slave, columns may differ. So we should create
+ MY_MIN(columns@master, columns@slave) columns in the
+ conversion table.
+ */
+ uint const cols_to_create= MY_MIN(target_table->s->fields, size());
+ if (!(conv_table= new(thd) Virtual_conversion_table(thd)) ||
+ conv_table->init(cols_to_create))
+ goto err;
+ for (uint col= 0 ; col < cols_to_create; ++col)
+ {
+ const Type_handler *ha= field_type_handler(col);
+ DBUG_ASSERT(ha); // Checked at compatible_with() time
+ if (conv_table->add(ha, field_metadata(col), target_table->field[col]))
+ {
+ DBUG_PRINT("debug", ("binlog_type: %d, metadata: %04X, target_field: '%s'"
+ " make_conversion_table_field() failed",
+ binlog_type(col), field_metadata(col),
+ target_table->field[col]->field_name.str));
+ goto err;
+ }
+ }
+
+ if (conv_table->open())
+ goto err; // Could not allocate record buffer?
+
+ DBUG_RETURN(conv_table);
+
+err:
+ if (conv_table)
+ delete conv_table;
+ rli->report(ERROR_LEVEL, ER_SLAVE_CANT_CREATE_CONVERSION, rgi->gtid_info(),
+ ER_THD(thd, ER_SLAVE_CANT_CREATE_CONVERSION),
+ target_table->s->db.str,
+ target_table->s->table_name.str);
+ DBUG_RETURN(NULL);
+}
+
+
+
+Deferred_log_events::Deferred_log_events(Relay_log_info *rli) : last_added(NULL)
+{
+ my_init_dynamic_array(&array, sizeof(Log_event *), 32, 16, MYF(0));
+}
+
+Deferred_log_events::~Deferred_log_events()
+{
+ delete_dynamic(&array);
+}
+
+int Deferred_log_events::add(Log_event *ev)
+{
+ last_added= ev;
+ insert_dynamic(&array, (uchar*) &ev);
+ return 0;
+}
+
+bool Deferred_log_events::is_empty()
+{
+ return array.elements == 0;
+}
+
+bool Deferred_log_events::execute(rpl_group_info *rgi)
+{
+ bool res= false;
+ DBUG_ENTER("Deferred_log_events::execute");
+ DBUG_ASSERT(rgi->deferred_events_collecting);
+
+ rgi->deferred_events_collecting= false;
+ for (uint i= 0; !res && i < array.elements; i++)
+ {
+ Log_event *ev= (* (Log_event **)
+ dynamic_array_ptr(&array, i));
+ res= ev->apply_event(rgi);
+ }
+ rgi->deferred_events_collecting= true;
+ DBUG_RETURN(res);
+}
+
+void Deferred_log_events::rewind()
+{
+ /*
+ Reset preceding Query log event events which execution was
+ deferred because of slave side filtering.
+ */
+ if (!is_empty())
+ {
+ for (uint i= 0; i < array.elements; i++)
+ {
+ Log_event *ev= *(Log_event **) dynamic_array_ptr(&array, i);
+ delete ev;
+ }
+ last_added= NULL;
+ if (array.elements > array.max_element)
+ freeze_size(&array);
+ reset_dynamic(&array);
+ }
+ last_added= NULL;
+}
+
+#endif // defined(HAVE_REPLICATION)
+
diff --git a/sql/scheduler.cc b/sql/scheduler.cc
index 5a20566c89e..7380b134f13 100644
--- a/sql/scheduler.cc
+++ b/sql/scheduler.cc
@@ -24,26 +24,11 @@
#include "mariadb.h"
#include "mysqld.h"
-#include "sql_connect.h" // init_new_connection_handler_thread
#include "scheduler.h"
#include "sql_class.h"
#include "sql_callback.h"
#include <violite.h>
-/*
- End connection, in case when we are using 'no-threads'
-*/
-
-static bool no_threads_end(THD *thd, bool put_in_cache)
-{
- if (thd)
- {
- unlink_thd(thd);
- delete thd;
- }
- return 1; // Abort handle_one_connection
-}
-
/** @internal
Helper functions to allow mysys to call the thread scheduler when
waiting for locks.
@@ -127,22 +112,16 @@ void post_kill_notification(THD *thd)
void one_thread_per_connection_scheduler(scheduler_functions *func,
ulong *arg_max_connections,
- uint *arg_connection_count)
+ Atomic_counter<uint> *arg_connection_count)
{
scheduler_init();
func->max_threads= *arg_max_connections + 1;
func->max_connections= arg_max_connections;
func->connection_count= arg_connection_count;
- func->init_new_connection_thread= init_new_connection_handler_thread;
func->add_connection= create_thread_to_handle_connection;
- func->end_thread= one_thread_per_connection_end;
func->post_kill_notification= post_kill_notification;
}
#else
-bool init_new_connection_handler_thread()
-{
- return 0;
-}
void handle_connection_in_main_thread(CONNECT *connect)
{
}
@@ -158,7 +137,5 @@ void one_thread_scheduler(scheduler_functions *func)
func->max_threads= 1;
func->max_connections= &max_connections;
func->connection_count= &connection_count;
- func->init_new_connection_thread= init_new_connection_handler_thread;
func->add_connection= handle_connection_in_main_thread;
- func->end_thread= no_threads_end;
}
diff --git a/sql/scheduler.h b/sql/scheduler.h
index 42895134c83..676262f6454 100644
--- a/sql/scheduler.h
+++ b/sql/scheduler.h
@@ -31,15 +31,14 @@ class THD;
struct scheduler_functions
{
- uint max_threads, *connection_count;
+ uint max_threads;
+ Atomic_counter<uint> *connection_count;
ulong *max_connections;
bool (*init)(void);
- bool (*init_new_connection_thread)(void);
void (*add_connection)(CONNECT *connect);
void (*thd_wait_begin)(THD *thd, int wait_type);
void (*thd_wait_end)(THD *thd);
void (*post_kill_notification)(THD *thd);
- bool (*end_thread)(THD *thd, bool cache_thread);
void (*end)(void);
};
@@ -72,7 +71,7 @@ enum scheduler_types
};
void one_thread_per_connection_scheduler(scheduler_functions *func,
- ulong *arg_max_connections, uint *arg_connection_count);
+ ulong *arg_max_connections, Atomic_counter<uint> *arg_connection_count);
void one_thread_scheduler(scheduler_functions *func);
extern void scheduler_init();
@@ -100,7 +99,7 @@ public:
#ifdef HAVE_POOL_OF_THREADS
void pool_of_threads_scheduler(scheduler_functions* func,
ulong *arg_max_connections,
- uint *arg_connection_count);
+ Atomic_counter<uint> *arg_connection_count);
#else
#define pool_of_threads_scheduler(A,B,C) \
one_thread_per_connection_scheduler(A, B, C)
diff --git a/sql/service_wsrep.cc b/sql/service_wsrep.cc
index 43944366665..b365b393e0b 100644
--- a/sql/service_wsrep.cc
+++ b/sql/service_wsrep.cc
@@ -272,3 +272,13 @@ extern "C" void wsrep_commit_ordered(THD *thd)
thd->wsrep_cs().ordered_commit();
}
}
+
+extern "C" my_bool wsrep_thd_has_ignored_error(const THD *thd)
+{
+ return thd->wsrep_has_ignored_error;
+}
+
+extern "C" void wsrep_thd_set_ignored_error(THD *thd, my_bool val)
+{
+ thd->wsrep_has_ignored_error= val;
+}
diff --git a/sql/session_tracker.cc b/sql/session_tracker.cc
index 5ba0c73e042..dc22d6dc9a3 100644
--- a/sql/session_tracker.cc
+++ b/sql/session_tracker.cc
@@ -16,7 +16,6 @@
#include "sql_plugin.h"
-#include "hash.h"
#include "table.h"
#include "rpl_gtid.h"
#include "sql_class.h"
@@ -24,7 +23,7 @@
#include "sql_plugin.h"
#include "set_var.h"
-void State_tracker::mark_as_changed(THD *thd, LEX_CSTRING *tracked_item_name)
+void State_tracker::set_changed(THD *thd)
{
m_changed= true;
thd->lex->safe_to_cache_query= 0;
@@ -506,11 +505,12 @@ bool Session_sysvars_tracker::store(THD *thd, String *buf)
@param [IN] pointer on a variable
*/
-void Session_sysvars_tracker::mark_as_changed(THD *thd,
- LEX_CSTRING *var)
+void Session_sysvars_tracker::mark_as_changed(THD *thd, const sys_var *var)
{
sysvar_node_st *node;
- sys_var *svar= (sys_var *)var;
+
+ if (!is_enabled())
+ return;
if (!m_parsed)
{
@@ -529,10 +529,10 @@ void Session_sysvars_tracker::mark_as_changed(THD *thd,
Check if the specified system variable is being tracked, if so
mark it as changed and also set the class's m_changed flag.
*/
- if (orig_list.is_enabled() && (node= orig_list.insert_or_search(svar)))
+ if (orig_list.is_enabled() && (node= orig_list.insert_or_search(var)))
{
node->m_changed= true;
- State_tracker::mark_as_changed(thd, var);
+ set_changed(thd);
}
}
@@ -679,7 +679,7 @@ bool Transaction_state_tracker::update(THD *thd, set_var *)
}
if (thd->variables.session_track_transaction_info == TX_TRACK_CHISTICS)
tx_changed |= TX_CHG_CHISTICS;
- mark_as_changed(thd, NULL);
+ set_changed(thd);
}
else
m_enabled= false;
@@ -1112,7 +1112,7 @@ void Transaction_state_tracker::set_read_flags(THD *thd,
{
tx_read_flags = flags;
tx_changed |= TX_CHG_CHISTICS;
- mark_as_changed(thd, NULL);
+ set_changed(thd);
}
}
@@ -1131,7 +1131,7 @@ void Transaction_state_tracker::set_isol_level(THD *thd,
{
tx_isol_level = level;
tx_changed |= TX_CHG_CHISTICS;
- mark_as_changed(thd, NULL);
+ set_changed(thd);
}
}
@@ -1181,6 +1181,38 @@ bool Session_state_change_tracker::store(THD *thd, String *buf)
return false;
}
+
+bool User_variables_tracker::update(THD *thd, set_var *)
+{
+ m_enabled= thd->variables.session_track_user_variables;
+ return false;
+}
+
+
+bool User_variables_tracker::store(THD *thd, String *buf)
+{
+ for (ulong i= 0; i < m_changed_user_variables.size(); i++)
+ {
+ auto var= m_changed_user_variables.at(i);
+ String value_str;
+ bool null_value;
+
+ var->val_str(&null_value, &value_str, DECIMAL_MAX_SCALE);
+ buf->q_append(static_cast<char>(SESSION_TRACK_USER_VARIABLES));
+ ulonglong length= net_length_size(var->name.length) + var->name.length;
+ if (!null_value)
+ length+= net_length_size(value_str.length()) + value_str.length();
+ buf->q_net_store_length(length);
+ buf->q_net_store_data(reinterpret_cast<const uchar*>(var->name.str),
+ var->name.length);
+ if (!null_value)
+ buf->q_net_store_data(reinterpret_cast<const uchar*>(value_str.ptr()),
+ value_str.length());
+ }
+ m_changed_user_variables.clear();
+ return false;
+}
+
///////////////////////////////////////////////////////////////////////////////
/**
diff --git a/sql/session_tracker.h b/sql/session_tracker.h
index 226b026d590..b91e588a34e 100644
--- a/sql/session_tracker.h
+++ b/sql/session_tracker.h
@@ -19,12 +19,14 @@
#include "m_string.h"
#include "thr_lock.h"
+#include "sql_hset.h"
#ifndef EMBEDDED_LIBRARY
/* forward declarations */
class THD;
class set_var;
class String;
+class user_var_entry;
enum enum_session_tracker
@@ -33,6 +35,7 @@ enum enum_session_tracker
CURRENT_SCHEMA_TRACKER, /* Current schema */
SESSION_STATE_CHANGE_TRACKER,
TRANSACTION_INFO_TRACKER, /* Transaction state */
+ USER_VARIABLES_TRACKER,
SESSION_TRACKER_END /* must be the last */
};
@@ -66,6 +69,8 @@ protected:
*/
bool m_enabled;
+ void set_changed(THD *thd);
+
private:
/** Has the session state type changed ? */
bool m_changed;
@@ -102,7 +107,7 @@ public:
virtual bool store(THD *thd, String *buf)= 0;
/** Mark the entity as changed. */
- virtual void mark_as_changed(THD *thd, LEX_CSTRING *name);
+ void mark_as_changed(THD *thd) { if (is_enabled()) set_changed(thd); }
};
@@ -207,7 +212,7 @@ public:
bool enable(THD *thd);
bool update(THD *thd, set_var *var);
bool store(THD *thd, String *buf);
- void mark_as_changed(THD *thd, LEX_CSTRING *tracked_item_name);
+ void mark_as_changed(THD *thd, const sys_var *var);
void deinit() { orig_list.deinit(); }
/* callback */
static uchar *sysvars_get_key(const char *entry, size_t *length,
@@ -376,15 +381,42 @@ private:
tx_changed &= uint(~TX_CHG_STATE);
tx_changed |= (tx_curr_state != tx_reported_state) ? TX_CHG_STATE : 0;
if (tx_changed != TX_CHG_NONE)
- mark_as_changed(thd, NULL);
+ set_changed(thd);
}
};
#define TRANSACT_TRACKER(X) \
do { if (thd->variables.session_track_transaction_info > TX_TRACK_NONE) \
thd->session_tracker.transaction_info.X; } while(0)
-#define SESSION_TRACKER_CHANGED(A,B,C) \
- thd->session_tracker.mark_as_changed(A,B,C)
+
+
+/**
+ User_variables_tracker
+
+ This is a tracker class that enables & manages the tracking of user variables.
+*/
+
+class User_variables_tracker: public State_tracker
+{
+ Hash_set<const user_var_entry> m_changed_user_variables;
+public:
+ User_variables_tracker():
+ m_changed_user_variables(&my_charset_bin, 0, 0,
+ sizeof(const user_var_entry*), 0, 0,
+ HASH_UNIQUE | (mysqld_server_initialized ?
+ HASH_THREAD_SPECIFIC : 0)) {}
+ bool update(THD *thd, set_var *var);
+ bool store(THD *thd, String *buf);
+ void mark_as_changed(THD *thd, const user_var_entry *var)
+ {
+ if (is_enabled())
+ {
+ m_changed_user_variables.insert(var);
+ set_changed(thd);
+ }
+ }
+ void deinit() { m_changed_user_variables.~Hash_set(); }
+};
/**
@@ -415,6 +447,7 @@ public:
Session_state_change_tracker state_change;
Transaction_state_tracker transaction_info;
Session_sysvars_tracker sysvars;
+ User_variables_tracker user_variables;
Session_tracker()
{
@@ -422,6 +455,7 @@ public:
m_trackers[CURRENT_SCHEMA_TRACKER]= &current_schema;
m_trackers[SESSION_STATE_CHANGE_TRACKER]= &state_change;
m_trackers[TRANSACTION_INFO_TRACKER]= &transaction_info;
+ m_trackers[USER_VARIABLES_TRACKER]= &user_variables;
}
void enable(THD *thd)
@@ -430,14 +464,6 @@ public:
m_trackers[i]->enable(thd);
}
- inline void mark_as_changed(THD *thd, enum enum_session_tracker tracker,
- LEX_CSTRING *data)
- {
- if (m_trackers[tracker]->is_enabled())
- m_trackers[tracker]->mark_as_changed(thd, data);
- }
-
-
void store(THD *thd, String *main_buf);
};
@@ -446,7 +472,20 @@ int session_tracker_init();
#else
#define TRANSACT_TRACKER(X) do{}while(0)
-#define SESSION_TRACKER_CHANGED(A,B,C) do{}while(0)
+
+class Session_tracker
+{
+ class Dummy_tracker
+ {
+ public:
+ void mark_as_changed(THD *thd) {}
+ void mark_as_changed(THD *thd, const sys_var *var) {}
+ };
+public:
+ Dummy_tracker current_schema;
+ Dummy_tracker state_change;
+ Dummy_tracker sysvars;
+};
#endif //EMBEDDED_LIBRARY
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 812f25949eb..84431d1f7a8 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -35,7 +35,7 @@
#include "tztime.h" // my_tz_find, my_tz_SYSTEM, struct Time_zone
#include "sql_acl.h" // SUPER_ACL
#include "sql_select.h" // free_underlaid_joins
-#include "sql_show.h"
+#include "sql_i_s.h"
#include "sql_view.h" // updatable_views_with_limit_typelib
#include "lock.h" // lock_global_read_lock,
// make_global_read_lock_block_commit,
@@ -220,13 +220,12 @@ bool sys_var::update(THD *thd, set_var *var)
*/
if ((var->type == OPT_SESSION) && (!ret))
{
- SESSION_TRACKER_CHANGED(thd, SESSION_SYSVARS_TRACKER,
- (LEX_CSTRING*)var->var);
+ thd->session_tracker.sysvars.mark_as_changed(thd, var->var);
/*
Here MySQL sends variable name to avoid reporting change of
the tracker itself, but we decided that it is not needed
*/
- SESSION_TRACKER_CHANGED(thd, SESSION_STATE_CHANGE_TRACKER, NULL);
+ thd->session_tracker.state_change.mark_as_changed(thd);
}
return ret;
@@ -907,7 +906,7 @@ int set_var_user::update(THD *thd)
return -1;
}
- SESSION_TRACKER_CHANGED(thd, SESSION_STATE_CHANGE_TRACKER, NULL);
+ thd->session_tracker.state_change.mark_as_changed(thd);
return 0;
}
@@ -957,8 +956,7 @@ int set_var_role::update(THD *thd)
#ifndef NO_EMBEDDED_ACCESS_CHECKS
int res= acl_setrole(thd, role.str, access);
if (!res)
- thd->session_tracker.mark_as_changed(thd, SESSION_STATE_CHANGE_TRACKER,
- NULL);
+ thd->session_tracker.state_change.mark_as_changed(thd);
return res;
#else
return 0;
@@ -1015,18 +1013,13 @@ int set_var_collation_client::update(THD *thd)
character_set_results);
/* Mark client collation variables as changed */
-#ifndef EMBEDDED_LIBRARY
- if (thd->session_tracker.sysvars.is_enabled())
- {
- thd->session_tracker.sysvars.
- mark_as_changed(thd, (LEX_CSTRING*)Sys_character_set_client_ptr);
- thd->session_tracker.sysvars.
- mark_as_changed(thd, (LEX_CSTRING*)Sys_character_set_results_ptr);
- thd->session_tracker.sysvars.
- mark_as_changed(thd, (LEX_CSTRING*)Sys_character_set_connection_ptr);
- }
- thd->session_tracker.mark_as_changed(thd, SESSION_STATE_CHANGE_TRACKER, NULL);
-#endif //EMBEDDED_LIBRARY
+ thd->session_tracker.sysvars.mark_as_changed(thd,
+ Sys_character_set_client_ptr);
+ thd->session_tracker.sysvars.mark_as_changed(thd,
+ Sys_character_set_results_ptr);
+ thd->session_tracker.sysvars.mark_as_changed(thd,
+ Sys_character_set_connection_ptr);
+ thd->session_tracker.state_change.mark_as_changed(thd);
thd->protocol_text.init(thd);
thd->protocol_binary.init(thd);
diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt
index 03bd72c41b0..dfbacccc169 100644
--- a/sql/share/errmsg-utf8.txt
+++ b/sql/share/errmsg-utf8.txt
@@ -7933,3 +7933,9 @@ ER_PERIOD_CONSTRAINT_DROP
eng "Can't DROP CONSTRAINT `%s`. Use DROP PERIOD `%s` for this"
ER_TOO_LONG_KEYPART 42000 S1009
eng "Specified key part was too long; max key part length is %u bytes"
+ER_TOO_LONG_DATABASE_COMMENT
+ eng "Comment for database '%-.64s' is too long (max = %u)"
+ER_UNKNOWN_DATA_TYPE
+ eng "Unknown data type: '%-.64s'"
+ER_UNKNOWN_OPERATOR
+ eng "Operator does not exists: '%-.128s'"
diff --git a/sql/slave.cc b/sql/slave.cc
index 1ed701c75a2..da87ab44b67 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -1646,6 +1646,40 @@ const char *print_slave_db_safe(const char* db)
#endif /* HAVE_REPLICATION */
+bool Sql_cmd_show_slave_status::execute(THD *thd)
+{
+#ifndef HAVE_REPLICATION
+ my_ok(thd);
+ return false;
+#else
+ DBUG_ENTER("Sql_cmd_show_slave_status::execute");
+ bool res= true;
+
+ /* Accept one of two privileges */
+ if (check_global_access(thd, SUPER_ACL | REPL_CLIENT_ACL))
+ goto error;
+ if (is_show_all_slaves_stat())
+ {
+ mysql_mutex_lock(&LOCK_active_mi);
+ res= show_all_master_info(thd);
+ mysql_mutex_unlock(&LOCK_active_mi);
+ }
+ else
+ {
+ LEX_MASTER_INFO *lex_mi= &thd->lex->mi;
+ Master_info *mi;
+ if ((mi= get_master_info(&lex_mi->connection_name,
+ Sql_condition::WARN_LEVEL_ERROR)))
+ {
+ res= show_master_info(thd, mi, 0);
+ mi->release();
+ }
+ }
+error:
+ DBUG_RETURN(res);
+#endif
+}
+
int init_strvar_from_file(char *var, int max_size, IO_CACHE *f,
const char *default_val)
{
diff --git a/sql/sp.cc b/sql/sp.cc
index 8568bc16c00..c9d1e2e3c4a 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -683,7 +683,7 @@ Sp_handler::db_find_routine(THD *thd,
longlong modified;
Sp_chistics chistics;
bool saved_time_zone_used= thd->time_zone_used;
- sql_mode_t sql_mode, saved_mode= thd->variables.sql_mode;
+ sql_mode_t sql_mode;
Open_tables_backup open_tables_state_backup;
Stored_program_creation_ctx *creation_ctx;
AUTHID definer;
@@ -698,7 +698,7 @@ Sp_handler::db_find_routine(THD *thd,
DBUG_RETURN(SP_OPEN_TABLE_FAILED);
/* Reset sql_mode during data dictionary operations. */
- thd->variables.sql_mode= 0;
+ Sql_mode_instant_set sms(thd, 0);
if ((ret= db_find_routine_aux(thd, name, table)) != SP_OK)
goto done;
@@ -755,7 +755,6 @@ Sp_handler::db_find_routine(THD *thd,
thd->time_zone_used= saved_time_zone_used;
if (table)
close_system_tables(thd, &open_tables_state_backup);
- thd->variables.sql_mode= saved_mode;
DBUG_RETURN(ret);
}
@@ -1524,8 +1523,7 @@ Sp_handler_package::show_create_sp(THD *thd, String *buf,
const DDL_options_st ddl_options,
sql_mode_t sql_mode) const
{
- sql_mode_t old_sql_mode= thd->variables.sql_mode;
- thd->variables.sql_mode= sql_mode;
+ Sql_mode_instant_set sms(thd, sql_mode);
bool rc=
buf->append(STRING_WITH_LEN("CREATE ")) ||
(ddl_options.or_replace() &&
@@ -1542,7 +1540,6 @@ Sp_handler_package::show_create_sp(THD *thd, String *buf,
append_package_chistics(buf, chistics) ||
buf->append(" ", 1) ||
buf->append(body.str, body.length);
- thd->variables.sql_mode= old_sql_mode;
return rc;
}
@@ -2914,7 +2911,6 @@ Sp_handler::show_create_sp(THD *thd, String *buf,
const DDL_options_st ddl_options,
sql_mode_t sql_mode) const
{
- sql_mode_t old_sql_mode= thd->variables.sql_mode;
size_t agglen= (chistics.agg_type == GROUP_AGGREGATE)? 10 : 0;
LEX_CSTRING tmp;
@@ -2925,7 +2921,7 @@ Sp_handler::show_create_sp(THD *thd, String *buf,
agglen + USER_HOST_BUFF_SIZE))
return true;
- thd->variables.sql_mode= sql_mode;
+ Sql_mode_instant_set sms(thd, sql_mode);
buf->append(STRING_WITH_LEN("CREATE "));
if (ddl_options.or_replace())
buf->append(STRING_WITH_LEN("OR REPLACE "));
@@ -2976,7 +2972,6 @@ Sp_handler::show_create_sp(THD *thd, String *buf,
append_suid(buf, chistics.suid);
append_comment(buf, chistics.comment);
buf->append(body.str, body.length); // Not \0 terminated
- thd->variables.sql_mode= old_sql_mode;
return false;
}
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 87664e16004..1968ba83101 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -2396,11 +2396,10 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
break;
}
- Send_field *out_param_info= new (thd->mem_root) Send_field();
- nctx->get_parameter(i)->make_send_field(thd, out_param_info);
- out_param_info->db_name= m_db.str;
- out_param_info->table_name= m_name.str;
- out_param_info->org_table_name= m_name.str;
+ Send_field *out_param_info= new (thd->mem_root) Send_field(thd, nctx->get_parameter(i));
+ out_param_info->db_name= m_db;
+ out_param_info->table_name= m_name;
+ out_param_info->org_table_name= m_name;
out_param_info->col_name= spvar->name;
out_param_info->org_col_name= spvar->name;
@@ -3840,10 +3839,8 @@ sp_instr_set_trigger_field::execute(THD *thd, uint *nextp)
int
sp_instr_set_trigger_field::exec_core(THD *thd, uint *nextp)
{
- bool sav_abort_on_warning= thd->abort_on_warning;
- thd->abort_on_warning= thd->is_strict_mode() && !thd->lex->ignore;
+ Abort_on_warning_instant_set aws(thd, thd->is_strict_mode() && !thd->lex->ignore);
const int res= (trigger_field->set_value(thd, &value) ? -1 : 0);
- thd->abort_on_warning= sav_abort_on_warning;
*nextp = m_ip+1;
return res;
}
diff --git a/sql/spatial.cc b/sql/spatial.cc
index bba9ae45f58..ebec280a5eb 100644
--- a/sql/spatial.cc
+++ b/sql/spatial.cc
@@ -185,6 +185,33 @@ Geometry *Geometry::construct(Geometry_buffer *buffer,
}
+uint Geometry::get_key_image_itMBR(LEX_CSTRING &src, uchar *buff, uint length)
+{
+ const char *dummy;
+ MBR mbr;
+ Geometry_buffer buffer;
+ Geometry *gobj;
+ const uint image_length= SIZEOF_STORED_DOUBLE*4;
+
+ if (src.length < SRID_SIZE)
+ {
+ bzero(buff, image_length);
+ return image_length;
+ }
+ gobj= Geometry::construct(&buffer, (char*) src.str, (uint32) src.length);
+ if (!gobj || gobj->get_mbr(&mbr, &dummy))
+ bzero(buff, image_length);
+ else
+ {
+ float8store(buff, mbr.xmin);
+ float8store(buff+8, mbr.xmax);
+ float8store(buff+16, mbr.ymin);
+ float8store(buff+24, mbr.ymax);
+ }
+ return image_length;
+}
+
+
Geometry *Geometry::create_from_wkt(Geometry_buffer *buffer,
Gis_read_stream *trs, String *wkt,
bool init_stream)
diff --git a/sql/spatial.h b/sql/spatial.h
index fa4e40b5aa5..7817fd041cd 100644
--- a/sql/spatial.h
+++ b/sql/spatial.h
@@ -322,6 +322,7 @@ public:
bool er_on_3D, String *res);
static Geometry *create_from_opresult(Geometry_buffer *g_buf,
String *res, Gcalc_result_receiver &rr);
+ static uint get_key_image_itMBR(LEX_CSTRING &src, uchar *buff, uint length);
int as_wkt(String *wkt, const char **end);
int as_json(String *wkt, uint max_dec_digits, const char **end);
int bbox_as_json(String *wkt);
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 847d2bd777b..6537f5ad1bc 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -2244,7 +2244,7 @@ bool acl_init(bool dont_read_acl_tables)
acl_cache= new Hash_filo<acl_entry>(ACL_CACHE_SIZE, 0, 0,
(my_hash_get_key) acl_entry_get_key,
(my_hash_free_key) free,
- &my_charset_utf8_bin);
+ &my_charset_utf8mb3_bin);
/*
cache built-in native authentication plugins,
@@ -2681,10 +2681,10 @@ bool acl_reload(THD *thd)
my_init_dynamic_array(&acl_users, sizeof(ACL_USER), 50, 100, MYF(0));
acl_dbs.init(50, 100);
my_init_dynamic_array(&acl_proxy_users, sizeof(ACL_PROXY_USER), 50, 100, MYF(0));
- my_hash_init2(&acl_roles,50, &my_charset_utf8_bin,
+ my_hash_init2(&acl_roles,50, &my_charset_utf8mb3_bin,
0, 0, 0, (my_hash_get_key) acl_role_get_key, 0,
(void (*)(void *))free_acl_role, 0);
- my_hash_init2(&acl_roles_mappings, 50, &my_charset_utf8_bin, 0, 0, 0,
+ my_hash_init2(&acl_roles_mappings, 50, &my_charset_utf8mb3_bin, 0, 0, 0,
(my_hash_get_key) acl_role_map_get_key, 0, 0, 0);
old_mem= acl_memroot;
delete_dynamic(&acl_wild_hosts);
@@ -7568,21 +7568,20 @@ static bool grant_load(THD *thd,
TABLE *t_table, *c_table, *p_table;
bool check_no_resolve= specialflag & SPECIAL_NO_RESOLVE;
MEM_ROOT *save_mem_root= thd->mem_root;
- sql_mode_t old_sql_mode= thd->variables.sql_mode;
DBUG_ENTER("grant_load");
- thd->variables.sql_mode&= ~MODE_PAD_CHAR_TO_FULL_LENGTH;
+ Sql_mode_instant_remove sms(thd, MODE_PAD_CHAR_TO_FULL_LENGTH);
- (void) my_hash_init(&column_priv_hash, &my_charset_utf8_bin,
+ (void) my_hash_init(&column_priv_hash, &my_charset_utf8mb3_bin,
0,0,0, (my_hash_get_key) get_grant_table,
(my_hash_free_key) free_grant_table,0);
- (void) my_hash_init(&proc_priv_hash, &my_charset_utf8_bin,
+ (void) my_hash_init(&proc_priv_hash, &my_charset_utf8mb3_bin,
0,0,0, (my_hash_get_key) get_grant_table, 0,0);
- (void) my_hash_init(&func_priv_hash, &my_charset_utf8_bin,
+ (void) my_hash_init(&func_priv_hash, &my_charset_utf8mb3_bin,
0,0,0, (my_hash_get_key) get_grant_table, 0,0);
- (void) my_hash_init(&package_spec_priv_hash, &my_charset_utf8_bin,
+ (void) my_hash_init(&package_spec_priv_hash, &my_charset_utf8mb3_bin,
0,0,0, (my_hash_get_key) get_grant_table, 0,0);
- (void) my_hash_init(&package_body_priv_hash, &my_charset_utf8_bin,
+ (void) my_hash_init(&package_body_priv_hash, &my_charset_utf8mb3_bin,
0,0,0, (my_hash_get_key) get_grant_table, 0,0);
init_sql_alloc(&grant_memroot, "GRANT", ACL_ALLOC_BLOCK_SIZE, 0, MYF(0));
@@ -7696,7 +7695,6 @@ end_unlock:
t_table->file->ha_index_end();
thd->mem_root= save_mem_root;
end_index_init:
- thd->variables.sql_mode= old_sql_mode;
DBUG_RETURN(return_val);
}
@@ -10683,7 +10681,6 @@ bool mysql_drop_user(THD *thd, List <LEX_USER> &list, bool handle_as_role)
LEX_USER *user_name, *tmp_user_name;
List_iterator <LEX_USER> user_list(list);
bool binlog= false;
- sql_mode_t old_sql_mode= thd->variables.sql_mode;
DBUG_ENTER("mysql_drop_user");
DBUG_PRINT("entry", ("Handle as %s", handle_as_role ? "role" : "user"));
@@ -10695,7 +10692,7 @@ bool mysql_drop_user(THD *thd, List <LEX_USER> &list, bool handle_as_role)
if ((result= tables.open_and_lock(thd, tables_to_open, TL_WRITE)))
DBUG_RETURN(result != 1);
- thd->variables.sql_mode&= ~MODE_PAD_CHAR_TO_FULL_LENGTH;
+ Sql_mode_instant_remove sms(thd, MODE_PAD_CHAR_TO_FULL_LENGTH);
mysql_rwlock_wrlock(&LOCK_grant);
mysql_mutex_lock(&acl_cache->lock);
@@ -10770,7 +10767,6 @@ bool mysql_drop_user(THD *thd, List <LEX_USER> &list, bool handle_as_role)
result |= write_bin_log(thd, FALSE, thd->query(), thd->query_length());
mysql_rwlock_unlock(&LOCK_grant);
- thd->variables.sql_mode= old_sql_mode;
DBUG_RETURN(result);
}
@@ -11309,7 +11305,7 @@ bool sp_revoke_privileges(THD *thd, const char *sp_db, const char *sp_name,
for (counter= 0, revoked= 0 ; counter < hash->records ; )
{
GRANT_NAME *grant_proc= (GRANT_NAME*) my_hash_element(hash, counter);
- if (!my_strcasecmp(&my_charset_utf8_bin, grant_proc->db, sp_db) &&
+ if (!my_strcasecmp(&my_charset_utf8mb3_bin, grant_proc->db, sp_db) &&
!my_strcasecmp(system_charset_info, grant_proc->tname, sp_name))
{
LEX_USER lex_user;
@@ -13920,11 +13916,7 @@ bool acl_authenticate(THD *thd, uint com_change_user_pkt_len)
if (command == COM_CONNECT &&
!(thd->main_security_ctx.master_access & SUPER_ACL))
{
- mysql_mutex_lock(&LOCK_connection_count);
- bool count_ok= (*thd->scheduler->connection_count <=
- *thd->scheduler->max_connections);
- mysql_mutex_unlock(&LOCK_connection_count);
- if (!count_ok)
+ if (*thd->scheduler->connection_count > *thd->scheduler->max_connections)
{ // too many connections
my_error(ER_CON_COUNT_ERROR, MYF(0));
DBUG_RETURN(1);
diff --git a/sql/sql_alter.cc b/sql/sql_alter.cc
index 0230ee1df12..75d792523c7 100644
--- a/sql/sql_alter.cc
+++ b/sql/sql_alter.cc
@@ -239,7 +239,8 @@ bool Alter_info::vers_prohibited(THD *thd) const
Alter_table_ctx::Alter_table_ctx()
- : datetime_field(NULL), error_if_not_empty(false),
+ : implicit_default_value_error_field(NULL),
+ error_if_not_empty(false),
tables_opened(0),
db(null_clex_str), table_name(null_clex_str), alias(null_clex_str),
new_db(null_clex_str), new_name(null_clex_str), new_alias(null_clex_str),
@@ -260,7 +261,7 @@ Alter_table_ctx::Alter_table_ctx(THD *thd, TABLE_LIST *table_list,
uint tables_opened_arg,
const LEX_CSTRING *new_db_arg,
const LEX_CSTRING *new_name_arg)
- : datetime_field(NULL), error_if_not_empty(false),
+ : implicit_default_value_error_field(NULL), error_if_not_empty(false),
tables_opened(tables_opened_arg),
new_db(*new_db_arg), new_name(*new_name_arg),
fk_error_if_delete_row(false), fk_error_id(NULL),
@@ -352,6 +353,19 @@ Alter_table_ctx::Alter_table_ctx(THD *thd, TABLE_LIST *table_list,
}
+void Alter_table_ctx::report_implicit_default_value_error(THD *thd,
+ const TABLE_SHARE *s)
+ const
+{
+ Create_field *error_field= implicit_default_value_error_field;
+ const Type_handler *h= error_field->type_handler();
+ thd->push_warning_truncated_value_for_field(Sql_condition::WARN_LEVEL_WARN,
+ h->name().ptr(),
+ h->default_value().ptr(),
+ s, error_field->field_name.str);
+}
+
+
bool Sql_cmd_alter_table::execute(THD *thd)
{
LEX *lex= thd->lex;
diff --git a/sql/sql_alter.h b/sql/sql_alter.h
index 10aafe1ab37..41408a91836 100644
--- a/sql/sql_alter.h
+++ b/sql/sql_alter.h
@@ -287,8 +287,9 @@ public:
fk_error_table= fk->foreign_table->str;
}
+ void report_implicit_default_value_error(THD *thd, const TABLE_SHARE *) const;
public:
- Create_field *datetime_field;
+ Create_field *implicit_default_value_error_field;
bool error_if_not_empty;
uint tables_opened;
LEX_CSTRING db;
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 4c67b14e8f5..57038c1a64a 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -56,7 +56,6 @@
#include "rpl_filter.h"
#include "sql_table.h" // build_table_filename
#include "datadict.h" // dd_frm_is_view()
-#include "sql_hset.h" // Hash_set
#include "rpl_rli.h" // rpl_group_info
#ifdef __WIN__
#include <io.h>
@@ -5771,8 +5770,7 @@ find_field_in_view(THD *thd, TABLE_LIST *table_list,
the replacing item.
*/
if (*ref && !(*ref)->is_autogenerated_name)
- item->set_name(thd, (*ref)->name.str, (*ref)->name.length,
- system_charset_info);
+ item->set_name(thd, (*ref)->name);
if (register_tree_change)
thd->change_item_tree(ref, item);
else
@@ -5863,8 +5861,7 @@ find_field_in_natural_join(THD *thd, TABLE_LIST *table_ref, const char *name, si
the replacing item.
*/
if (*ref && !(*ref)->is_autogenerated_name)
- item->set_name(thd, (*ref)->name.str, (*ref)->name.length,
- system_charset_info);
+ item->set_name(thd, (*ref)->name);
if (register_tree_change && arena)
thd->restore_active_arena(arena, &backup);
@@ -6280,8 +6277,8 @@ find_field_in_tables(THD *thd, Item_ident *item,
bool check_privileges, bool register_tree_change)
{
Field *found=0;
- const char *db= item->db_name;
- const char *table_name= item->table_name;
+ const char *db= item->db_name.str;
+ const char *table_name= item->table_name.str;
const char *name= item->field_name.str;
size_t length= item->field_name.length;
char name_buff[SAFE_NAME_LEN+1];
@@ -6557,8 +6554,8 @@ find_item_in_list(Item *find, List<Item> &items, uint *counter,
if (is_ref_by_name)
{
field_name= &((Item_ident*) find)->field_name;
- table_name= ((Item_ident*) find)->table_name;
- db_name= ((Item_ident*) find)->db_name;
+ table_name= ((Item_ident*) find)->table_name.str;
+ db_name= ((Item_ident*) find)->db_name.str;
}
for (uint i= 0; i < n_items; i++)
@@ -6598,13 +6595,13 @@ find_item_in_list(Item *find, List<Item> &items, uint *counter,
item_field->field_name and item_field->table_name can be 0x0 if
item is not fix_field()'ed yet.
*/
- if (item_field->field_name.str && item_field->table_name &&
+ if (item_field->field_name.str && item_field->table_name.str &&
!lex_string_cmp(system_charset_info, &item_field->field_name,
field_name) &&
- !my_strcasecmp(table_alias_charset, item_field->table_name,
+ !my_strcasecmp(table_alias_charset, item_field->table_name.str,
table_name) &&
- (!db_name || (item_field->db_name &&
- !strcmp(item_field->db_name, db_name))))
+ (!db_name || (item_field->db_name.str &&
+ !strcmp(item_field->db_name.str, db_name))))
{
if (found_unaliased)
{
@@ -7501,8 +7498,8 @@ int setup_wild(THD *thd, TABLE_LIST *tables, List<Item> &fields,
MY_INT64_NUM_DECIMAL_DIGITS));
}
else if (insert_fields(thd, ((Item_field*) item)->context,
- ((Item_field*) item)->db_name,
- ((Item_field*) item)->table_name, &it,
+ ((Item_field*) item)->db_name.str,
+ ((Item_field*) item)->table_name.str, &it,
any_privileges, hidden_bit_fields))
{
if (arena)
diff --git a/sql/sql_basic_types.h b/sql/sql_basic_types.h
index 170e93741ef..3200228618f 100644
--- a/sql/sql_basic_types.h
+++ b/sql/sql_basic_types.h
@@ -23,6 +23,8 @@
typedef ulonglong sql_mode_t;
typedef int64 query_id_t;
+enum enum_nullability { NOT_NULL, NULLABLE };
+
/*
"fuzzydate" with strict data type control.
diff --git a/sql/sql_bitmap.h b/sql/sql_bitmap.h
index cce80ce2bc8..02dc8198c7c 100644
--- a/sql/sql_bitmap.h
+++ b/sql/sql_bitmap.h
@@ -28,9 +28,26 @@
#include <my_bit.h>
-template <uint width> class Bitmap
+/* An iterator to quickly walk over bits in ulonglong bitmap. */
+class Table_map_iterator
{
+ ulonglong bmp;
+public:
+ Table_map_iterator(ulonglong t): bmp(t){}
+ uint next_bit()
+ {
+ if (!bmp)
+ return BITMAP_END;
+ uint bit= my_find_first_bit(bmp);
+ bmp &= ~(1ULL << bit);
+ return bit;
+ }
+ int operator++(int) { return next_bit(); }
+ enum { BITMAP_END= 64 };
+};
+template <uint width> class Bitmap
+{
/*
Workaround GCC optimizer bug (generating SSE instuctions on unaligned data)
*/
@@ -43,12 +60,38 @@ template <uint width> class Bitmap
#pragma GCC target ("no-sse")
#endif
- uint32 buffer[(width + 31) / 32];
-public:
- Bitmap()
+private:
+ static const int BITS_PER_ELEMENT= sizeof(ulonglong) * 8;
+ static const int ARRAY_ELEMENTS= (width + BITS_PER_ELEMENT - 1) / BITS_PER_ELEMENT;
+ static const ulonglong ALL_BITS_SET= ULLONG_MAX;
+
+ ulonglong buffer[ARRAY_ELEMENTS];
+
+ uint bit_index(uint n) const
+ {
+ DBUG_ASSERT(n < width);
+ return ARRAY_ELEMENTS == 1 ? 0 : n / BITS_PER_ELEMENT;
+ }
+ ulonglong bit_mask(uint n) const
{
- clear_all();
+ DBUG_ASSERT(n < width);
+ return ARRAY_ELEMENTS == 1 ? 1ULL << n : 1ULL << (n % BITS_PER_ELEMENT);
+ }
+ ulonglong last_element_mask(int n) const
+ {
+ DBUG_ASSERT(n % BITS_PER_ELEMENT != 0);
+ return bit_mask(n) - 1;
}
+
+public:
+ /*
+ The default constructor does nothing.
+ The caller is supposed to either zero the memory
+ or to call set_all()/clear_all()/set_prefix()
+ to initialize bitmap.
+ */
+ Bitmap() { }
+
explicit Bitmap(uint prefix)
{
set_prefix(prefix);
@@ -57,50 +100,76 @@ public:
{
set_prefix(prefix);
}
-
uint length() const
{
return width;
}
void set_bit(uint n)
{
- DBUG_ASSERT(n < width);
- ((uchar*)buffer)[n / 8] |= (1 << (n & 7));
+ buffer[bit_index(n)] |= bit_mask(n);
}
void clear_bit(uint n)
{
- DBUG_ASSERT(n < width);
- ((uchar*)buffer)[n / 8] &= ~(1 << (n & 7));
+ buffer[bit_index(n)] &= ~bit_mask(n);
+ }
+ bool is_set(uint n) const
+ {
+ return buffer[bit_index(n)] & bit_mask(n);
}
void set_prefix(uint prefix_size)
{
set_if_smaller(prefix_size, width);
- uint prefix_bytes, prefix_bits, d;
- uchar* m = (uchar*)buffer;
- if ((prefix_bytes = prefix_size / 8))
- memset(m, 0xff, prefix_bytes);
- m += prefix_bytes;
- if ((prefix_bits = prefix_size & 7))
- {
- *(m++) = (1 << prefix_bits) - 1;
- // As the prefix bits are set, lets count this byte too as a prefix byte.
- prefix_bytes++;
- }
- if ((d = (width + 7) / 8 - prefix_bytes))
- memset(m, 0, d);
+ size_t idx= prefix_size / BITS_PER_ELEMENT;
+
+ for (size_t i= 0; i < idx; i++)
+ buffer[i]= ALL_BITS_SET;
+
+ if (prefix_size % BITS_PER_ELEMENT)
+ buffer[idx++]= last_element_mask(prefix_size);
+
+ for (size_t i= idx; i < ARRAY_ELEMENTS; i++)
+ buffer[i]= 0;
+ }
+ bool is_prefix(uint prefix_size) const
+ {
+ DBUG_ASSERT(prefix_size <= width);
+
+ size_t idx= prefix_size / BITS_PER_ELEMENT;
+
+ for (size_t i= 0; i < idx; i++)
+ if (buffer[i] != ALL_BITS_SET)
+ return false;
+
+ if (prefix_size % BITS_PER_ELEMENT)
+ if (buffer[idx++] != last_element_mask(prefix_size))
+ return false;
+
+ for (size_t i= idx; i < ARRAY_ELEMENTS; i++)
+ if (buffer[i] != 0)
+ return false;
+
+ return true;
}
void set_all()
{
- set_prefix(width);
+ if (width % BITS_PER_ELEMENT)
+ set_prefix(width);
+ else if (ARRAY_ELEMENTS > 1)
+ memset(buffer, 0xff, sizeof(buffer));
+ else
+ buffer[0] = ALL_BITS_SET;
}
void clear_all()
{
- memset(buffer, 0x00, sizeof(buffer));
+ if (ARRAY_ELEMENTS > 1)
+ memset(buffer, 0, sizeof(buffer));
+ else
+ buffer[0]= 0;
}
- void intersect(Bitmap & map2)
+ void intersect(const Bitmap& map2)
{
- for (uint i = 0; i < array_elements(buffer); i++)
+ for (size_t i= 0; i < ARRAY_ELEMENTS; i++)
buffer[i] &= map2.buffer[i];
}
@@ -112,27 +181,13 @@ private:
*/
void intersect_and_pad(ulonglong map2buff, bool pad_with_ones)
{
- compile_time_assert(sizeof(ulonglong) == 8);
- uint32 tmp[2];
- int8store(tmp, map2buff);
+ buffer[0] &= map2buff;
- buffer[0] &= tmp[0];
- if (array_elements(buffer) > 1)
- buffer[1] &= tmp[1];
-
- if (array_elements(buffer) <= 2)
- return;
- if (pad_with_ones)
- {
- memset((char*)buffer + 8, 0xff , sizeof(buffer) - 8);
- if (width != sizeof(buffer) * 8)
- {
- ((uchar*)buffer)[sizeof(buffer)-1] = last_byte_mask(width);
- }
- }
- else
- memset((char*)buffer + 8, 0 , sizeof(buffer) - 8);
+ for (size_t i= 1; i < ARRAY_ELEMENTS; i++)
+ buffer[i]= pad_with_ones ? ALL_BITS_SET : 0;
+ if (ARRAY_ELEMENTS > 1 && (width % BITS_PER_ELEMENT) && pad_with_ones)
+ buffer[ARRAY_ELEMENTS - 1]= last_element_mask(width);
}
public:
@@ -140,141 +195,110 @@ public:
{
intersect_and_pad(map2buff, 0);
}
- /* Use highest bit for all bits above sizeof(ulonglong)*8. */
+ /* Use highest bit for all bits above first element. */
void intersect_extended(ulonglong map2buff)
{
intersect_and_pad(map2buff, (map2buff & (1ULL << 63)));
}
- void subtract(Bitmap & map2)
+ void subtract(const Bitmap& map2)
{
- for (size_t i = 0; i < array_elements(buffer); i++)
+ for (size_t i= 0; i < ARRAY_ELEMENTS; i++)
buffer[i] &= ~(map2.buffer[i]);
}
- void merge(Bitmap & map2)
+ void merge(const Bitmap& map2)
{
- for (size_t i = 0; i < array_elements(buffer); i++)
+ for (size_t i= 0; i < ARRAY_ELEMENTS; i++)
buffer[i] |= map2.buffer[i];
}
- bool is_set(uint n) const
- {
- DBUG_ASSERT(n < width);
- return ((uchar*)buffer)[n / 8] & (1 << (n & 7));
- }
- bool is_prefix(uint prefix_size) const
- {
- uint prefix_mask = last_byte_mask(prefix_size);
- uchar* m = (uchar*)buffer;
- uchar* end_prefix = m + (prefix_size - 1) / 8;
- uchar* end;
- DBUG_ASSERT(prefix_size <= width);
-
- /* Empty prefix is always true */
- if (!prefix_size)
- return true;
-
- while (m < end_prefix)
- if (*m++ != 0xff)
- return false;
-
- end = ((uchar*)buffer) + (width + 7) / 8 - 1;
- if (m == end)
- return ((*m & last_byte_mask(width)) == prefix_mask);
-
- if (*m != prefix_mask)
- return false;
-
- while (++m < end)
- if (*m != 0)
- return false;
- return ((*m & last_byte_mask(width)) == 0);
- }
bool is_clear_all() const
{
- for (size_t i= 0; i < array_elements(buffer); i++)
+ for (size_t i= 0; i < ARRAY_ELEMENTS; i++)
if (buffer[i])
return false;
return true;
}
- bool is_set_all() const
- {
- if (width == sizeof(buffer) * 8)
- {
- for (size_t i = 0; i < array_elements(buffer); i++)
- if (buffer[i] != 0xFFFFFFFFU)
- return false;
- return true;
- }
- else
- return is_prefix(width);
- }
-
- bool is_subset(const Bitmap & map2) const
+ bool is_subset(const Bitmap& map2) const
{
- for (size_t i= 0; i < array_elements(buffer); i++)
+ for (size_t i= 0; i < ARRAY_ELEMENTS; i++)
if (buffer[i] & ~(map2.buffer[i]))
return false;
return true;
}
- bool is_overlapping(const Bitmap & map2) const
+ bool is_overlapping(const Bitmap& map2) const
{
- for (size_t i = 0; i < array_elements(buffer); i++)
+ for (size_t i= 0; i < ARRAY_ELEMENTS; i++)
if (buffer[i] & map2.buffer[i])
return true;
return false;
}
- bool operator==(const Bitmap & map2) const
+ bool operator==(const Bitmap& map2) const
{
- return memcmp(buffer, map2.buffer, sizeof(buffer)) == 0;
+ if (ARRAY_ELEMENTS > 1)
+ return !memcmp(buffer,map2.buffer,sizeof(buffer));
+ return buffer[0] == map2.buffer[0];
}
- bool operator!=(const Bitmap & map2) const
+ bool operator!=(const Bitmap& map2) const
{
return !(*this == map2);
}
+ /*
+ Print hexadecimal representation of bitmap.
+ Truncate trailing zeros.
+ */
char *print(char *buf) const
{
- char *s=buf;
- const uchar *e=(uchar *)buffer, *b=e+sizeof(buffer)-1;
- while (!*b && b>e)
- b--;
- if ((*s=_dig_vec_upper[*b >> 4]) != '0')
- s++;
- *s++=_dig_vec_upper[*b & 15];
- while (--b>=e)
+ size_t last; /*index of the last non-zero element, or 0. */
+
+ for (last= ARRAY_ELEMENTS - 1; last && !buffer[last]; last--){}
+
+ const int HEX_DIGITS_PER_ELEMENT= BITS_PER_ELEMENT / 4;
+ for (size_t i= 0; i < last; i++)
{
- *s++=_dig_vec_upper[*b >> 4];
- *s++=_dig_vec_upper[*b & 15];
+ ulonglong num = buffer[i];
+ uint shift = BITS_PER_ELEMENT - 4;
+ size_t pos= i * HEX_DIGITS_PER_ELEMENT;
+ for (size_t j= 0; j < HEX_DIGITS_PER_ELEMENT; j++)
+ {
+ buf[pos + j]= _dig_vec_upper[(num >> shift) & 0xf];
+ shift += 4;
+ }
}
- *s=0;
+ longlong2str(buffer[last], buf, 16);
return buf;
}
ulonglong to_ulonglong() const
{
- DBUG_ASSERT(sizeof(buffer) >= 4);
- uchar *b=(uchar *)buffer;
- if (sizeof(buffer) >= 8)
- return uint8korr(b);
- return (ulonglong) uint4korr(b);
+ return buffer[0];
}
uint bits_set()
{
- uint res = 0;
- for (size_t i = 0; i < array_elements(buffer); i++)
- res += my_count_bits_uint32(buffer[i]);
+ uint res= 0;
+ for (size_t i= 0; i < ARRAY_ELEMENTS; i++)
+ res += my_count_bits(buffer[i]);
return res;
}
class Iterator
{
- Bitmap &map;
- uint no;
+ const Bitmap& map;
+ uint offset;
+ Table_map_iterator tmi;
public:
- Iterator(Bitmap<width> &map2): map(map2), no(0) {}
- int operator++(int) {
- if (no == width) return BITMAP_END;
- while (!map.is_set(no))
+ Iterator(const Bitmap<width>& map2) : map(map2), offset(0), tmi(map2.buffer[0]) {}
+ int operator++(int)
+ {
+ for (;;)
{
- if ((++no) == width) return BITMAP_END;
+ int nextbit= tmi++;
+
+ if (nextbit != Table_map_iterator::BITMAP_END)
+ return offset + nextbit;
+
+ if (offset + BITS_PER_ELEMENT >= map.length())
+ return BITMAP_END;
+
+ offset += BITS_PER_ELEMENT;
+ tmi= Table_map_iterator(map.buffer[offset / BITS_PER_ELEMENT]);
}
- return no++;
}
enum { BITMAP_END = width };
};
@@ -283,98 +307,8 @@ public:
#pragma GCC pop_options
#undef NEED_GCC_NO_SSE_WORKAROUND
#endif
-
};
-
-/* An iterator to quickly walk over bits in ulonglong bitmap. */
-class Table_map_iterator
-{
- ulonglong bmp;
- uint no;
-public:
- Table_map_iterator(ulonglong t) : bmp(t), no(0) {}
- uint next_bit()
- {
- static const uchar last_bit[16]= {32, 0, 1, 0,
- 2, 0, 1, 0,
- 3, 0, 1, 0,
- 2, 0, 1, 0};
- uint bit;
- while ((bit= last_bit[bmp & 0xF]) == 32)
- {
- no += 4;
- bmp= bmp >> 4;
- if (!bmp)
- return BITMAP_END;
- }
- bmp &= ~(1ULL << bit);
- return no + bit;
- }
- uint operator++(int) { return next_bit(); }
- enum { BITMAP_END= 64 };
-};
-
-template <> class Bitmap<64>
-{
- ulonglong map;
-public:
- Bitmap<64>() { }
- explicit Bitmap<64>(uint prefix_to_set) { set_prefix(prefix_to_set); }
- void init(uint prefix_to_set) { set_prefix(prefix_to_set); }
- uint length() const { return 64; }
- void set_bit(uint n) { map|= ((ulonglong)1) << n; }
- void clear_bit(uint n) { map&= ~(((ulonglong)1) << n); }
- void set_prefix(uint n)
- {
- if (n >= length())
- set_all();
- else
- map= (((ulonglong)1) << n)-1;
- }
- void set_all() { map=~(ulonglong)0; }
- void clear_all() { map=(ulonglong)0; }
- void intersect(Bitmap<64>& map2) { map&= map2.map; }
- void intersect(ulonglong map2) { map&= map2; }
- void intersect_extended(ulonglong map2) { map&= map2; }
- void subtract(Bitmap<64>& map2) { map&= ~map2.map; }
- void merge(Bitmap<64>& map2) { map|= map2.map; }
- bool is_set(uint n) const { return MY_TEST(map & (((ulonglong) 1) << n)); }
- bool is_prefix(uint n) const { return map == (((ulonglong)1) << n)-1; }
- bool is_clear_all() const { return map == (ulonglong)0; }
- bool is_set_all() const { return map == ~(ulonglong)0; }
- bool is_subset(const Bitmap<64>& map2) const { return !(map & ~map2.map); }
- bool is_overlapping(const Bitmap<64>& map2) const { return (map & map2.map)!= 0; }
- bool operator==(const Bitmap<64>& map2) const { return map == map2.map; }
- char *print(char *buf) const {
- longlong2str(longlong(map), buf, 16);
- return buf;
- }
- ulonglong to_ulonglong() const { return map; }
- class Iterator : public Table_map_iterator
- {
- public:
- Iterator(Bitmap<64> &map2) : Table_map_iterator(map2.map) {}
- };
- uint bits_set()
- {
- //TODO: use my_count_bits()
- uint res= 0, i= 0;
- for (; i < 64 ; i++)
- {
- if (map & ((ulonglong)1<<i))
- res++;
- }
- return res;
- }
-};
-
-#if MAX_INDEXES <= 64
-typedef Bitmap<64> key_map; /* Used for finding keys */
-#elif MAX_INDEXES > 128
-#error "MAX_INDEXES values greater than 128 is not supported."
-#else
-typedef Bitmap<((MAX_INDEXES+7)/8*8)> key_map; /* Used for finding keys */
-#endif
+typedef Bitmap<MAX_INDEXES> key_map; /* Used for finding keys */
#endif /* SQL_BITMAP_INCLUDED */
diff --git a/sql/sql_builtin.cc.in b/sql/sql_builtin.cc.in
index 5ac044afd5d..810f98a876c 100644
--- a/sql/sql_builtin.cc.in
+++ b/sql/sql_builtin.cc.in
@@ -32,9 +32,6 @@ extern
builtin_maria_plugin
@mysql_mandatory_plugins@ @mysql_optional_plugins@
builtin_maria_binlog_plugin,
-#ifdef WITH_WSREP
- builtin_maria_wsrep_plugin,
-#endif /* WITH_WSREP */
builtin_maria_mysql_password_plugin;
struct st_maria_plugin *mysql_optional_plugins[]=
@@ -45,8 +42,5 @@ struct st_maria_plugin *mysql_optional_plugins[]=
struct st_maria_plugin *mysql_mandatory_plugins[]=
{
builtin_maria_binlog_plugin, builtin_maria_mysql_password_plugin,
-#ifdef WITH_WSREP
- builtin_maria_wsrep_plugin,
-#endif /* WITH_WSREP */
@mysql_mandatory_plugins@ 0
};
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 1ffb7fe258e..7c1d186fce1 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -129,6 +129,39 @@ bool Key_part_spec::operator==(const Key_part_spec& other) const
&other.field_name);
}
+
+bool Key_part_spec::check_key_for_blob(const handler *file) const
+{
+ if (!(file->ha_table_flags() & HA_CAN_INDEX_BLOBS))
+ {
+ my_error(ER_BLOB_USED_AS_KEY, MYF(0), field_name.str, file->table_type());
+ return true;
+ }
+ return false;
+}
+
+
+bool Key_part_spec::check_key_length_for_blob() const
+{
+ if (!length)
+ {
+ my_error(ER_BLOB_KEY_WITHOUT_LENGTH, MYF(0), field_name.str);
+ return true;
+ }
+ return false;
+}
+
+
+bool Key_part_spec::init_multiple_key_for_blob(const handler *file)
+{
+ if (check_key_for_blob(file))
+ return true;
+ if (!length)
+ length= file->max_key_length() + 1;
+ return false;
+}
+
+
/**
Construct an (almost) deep copy of this key. Only those
elements that are known to never change are not copied.
@@ -420,12 +453,6 @@ void thd_exit_cond(MYSQL_THD thd, const PSI_stage_info *stage,
}
extern "C"
-void **thd_ha_data(const THD *thd, const struct handlerton *hton)
-{
- return (void **) &thd->ha_data[hton->slot].ha_ptr;
-}
-
-extern "C"
void thd_storage_lock_wait(THD *thd, long long value)
{
thd->utime_after_lock+= value;
@@ -437,7 +464,7 @@ void thd_storage_lock_wait(THD *thd, long long value)
extern "C"
void *thd_get_ha_data(const THD *thd, const struct handlerton *hton)
{
- return *thd_ha_data(thd, hton);
+ return thd->ha_data[hton->slot].ha_ptr;
}
@@ -450,6 +477,7 @@ void thd_set_ha_data(THD *thd, const struct handlerton *hton,
const void *ha_data)
{
plugin_ref *lock= &thd->ha_data[hton->slot].lock;
+ thd->ha_data[hton->slot].ha_ptr= const_cast<void*>(ha_data);
if (ha_data && !*lock)
*lock= ha_lock_engine(NULL, (handlerton*) hton);
else if (!ha_data && *lock)
@@ -457,7 +485,6 @@ void thd_set_ha_data(THD *thd, const struct handlerton *hton,
plugin_unlock(NULL, *lock);
*lock= NULL;
}
- *thd_ha_data(thd, hton)= (void*) ha_data;
}
@@ -728,7 +755,6 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
event_scheduler.data= 0;
event_scheduler.m_psi= 0;
skip_wait_timeout= false;
- extra_port= 0;
catalog= (char*)"std"; // the only catalog we have for now
main_security_ctx.init();
security_ctx= &main_security_ctx;
@@ -1723,6 +1749,7 @@ THD::~THD()
/* trick to make happy memory accounting system */
#ifndef EMBEDDED_LIBRARY
session_tracker.sysvars.deinit();
+ session_tracker.user_variables.deinit();
#endif //EMBEDDED_LIBRARY
if (status_var.local_memory_used != 0)
@@ -2523,8 +2550,7 @@ THD::make_string_literal_charset(const Lex_string_with_metadata_st &str,
{
if (!str.length && (variables.sql_mode & MODE_EMPTY_STRING_IS_NULL))
return new (mem_root) Item_null(this, 0, cs);
- return new (mem_root) Item_string_with_introducer(this,
- str.str, (uint)str.length, cs);
+ return new (mem_root) Item_string_with_introducer(this, str, cs);
}
@@ -7190,11 +7216,10 @@ void THD::set_last_commit_gtid(rpl_gtid &gtid)
#endif
m_last_commit_gtid= gtid;
#ifndef EMBEDDED_LIBRARY
- if (changed_gtid && session_tracker.sysvars.is_enabled())
+ if (changed_gtid)
{
DBUG_ASSERT(current_thd == this);
- session_tracker.sysvars.
- mark_as_changed(this, (LEX_CSTRING*)Sys_last_gtid_ptr);
+ session_tracker.sysvars.mark_as_changed(this, Sys_last_gtid_ptr);
}
#endif
}
diff --git a/sql/sql_class.h b/sql/sql_class.h
index c98c0e4621c..8ca74457273 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -289,6 +289,17 @@ public:
*/
Key_part_spec *clone(MEM_ROOT *mem_root) const
{ return new (mem_root) Key_part_spec(*this); }
+ bool check_key_for_blob(const class handler *file) const;
+ bool check_key_length_for_blob() const;
+ bool check_primary_key_for_blob(const class handler *file) const
+ {
+ return check_key_for_blob(file) || check_key_length_for_blob();
+ }
+ bool check_foreign_key_for_blob(const class handler *file) const
+ {
+ return check_key_for_blob(file) || check_key_length_for_blob();
+ }
+ bool init_multiple_key_for_blob(const class handler *file);
};
@@ -755,6 +766,7 @@ typedef struct system_variables
ulong session_track_transaction_info;
my_bool session_track_schema;
my_bool session_track_state_change;
+ my_bool session_track_user_variables;
my_bool tcp_nodelay;
ulong threadpool_priority;
@@ -3057,7 +3069,6 @@ public:
uint8 password; /* 0, 1 or 2 */
uint8 failed_com_change_user;
bool slave_thread;
- bool extra_port; /* If extra connection */
bool no_errors;
/**
@@ -3626,6 +3637,18 @@ public:
return alloc_root(&transaction.mem_root,size);
}
+ LEX_CSTRING strmake_lex_cstring(const char *str, size_t length)
+ {
+ const char *tmp= strmake_root(mem_root, str, length);
+ if (!tmp)
+ return {0,0};
+ return {tmp, length};
+ }
+ LEX_CSTRING strmake_lex_cstring(const LEX_CSTRING &from)
+ {
+ return strmake_lex_cstring(from.str, from.length);
+ }
+
LEX_STRING *make_lex_string(LEX_STRING *lex_str, const char* str, size_t length)
{
if (!(lex_str->str= strmake_root(mem_root, str, length)))
@@ -4660,9 +4683,7 @@ private:
AUTHID invoker;
public:
-#ifndef EMBEDDED_LIBRARY
Session_tracker session_tracker;
-#endif //EMBEDDED_LIBRARY
/*
Flag, mutex and condition for a thread to wait for a signal from another
thread.
@@ -5684,17 +5705,18 @@ public:
class select_unit :public select_result_interceptor
{
+protected:
uint curr_step, prev_step, curr_sel;
enum sub_select_type step;
public:
- Item_int *intersect_mark;
TMP_TABLE_PARAM tmp_table_param;
+ /* Number of additional (hidden) field of the used temporary table */
+ int addon_cnt;
int write_err; /* Error code from the last send_data->ha_write_row call. */
TABLE *table;
select_unit(THD *thd_arg):
- select_result_interceptor(thd_arg),
- intersect_mark(0), table(0)
+ select_result_interceptor(thd_arg), addon_cnt(0), table(0)
{
init();
tmp_table_param.init();
@@ -5711,6 +5733,9 @@ public:
virtual bool postponed_prepare(List<Item> &types)
{ return false; }
int send_data(List<Item> &items);
+ int write_record();
+ int update_counter(Field *counter, longlong value);
+ int delete_record();
bool send_eof();
virtual bool flush();
void cleanup();
@@ -5729,7 +5754,148 @@ public:
step= UNION_TYPE;
write_err= 0;
}
+ virtual void change_select();
+ virtual bool force_enable_index_if_needed() { return false; }
+};
+
+
+/**
+ @class select_unit_ext
+
+ The class used when processing rows produced by operands of query expressions
+ containing INTERSECT ALL and/or EXCEPT all operations. One or two extra fields
+ of the temporary to store the rows of the partial and final result can be employed.
+ Both of them contain counters. The second additional field is used only when
+ the processed query expression contains INTERSECT ALL.
+
+ Consider how these extra fields are used.
+
+ Let
+ table t1 (f char(8))
+ table t2 (f char(8))
+ table t3 (f char(8))
+ contain the following sets:
+ ("b"),("a"),("d"),("c"),("b"),("a"),("c"),("a")
+ ("c"),("b"),("c"),("c"),("a"),("b"),("g")
+ ("c"),("a"),("b"),("d"),("b"),("e")
+
+ - Let's demonstrate how the the set operation INTERSECT ALL is proceesed
+ for the query
+ SELECT f FROM t1 INTERSECT ALL SELECT f FROM t2
+
+ When send_data() is called for the rows of the first operand we put
+ the processed record into the temporary table if there was no such record
+ setting dup_cnt field to 1 and add_cnt field to 0 and increment the
+ counter in the dup_cnt field by one otherwise. We get
+
+ |add_cnt|dup_cnt| f |
+ |0 |2 |b |
+ |0 |3 |a |
+ |0 |1 |d |
+ |0 |2 |c |
+
+ The call of send_eof() for the first operand swaps the values stored in
+ dup_cnt and add_cnt. After this, we'll see the following rows in the
+ temporary table
+
+ |add_cnt|dup_cnt| f |
+ |2 |0 |b |
+ |3 |0 |a |
+ |1 |0 |d |
+ |2 |0 |c |
+
+ When send_data() is called for the rows of the second operand we increment
+ the counter in dup_cnt if the processed row is found in the table and do
+ nothing otherwise. As a result we get
+
+ |add_cnt|dup_cnt| f |
+ |2 |2 |b |
+ |3 |1 |a |
+ |1 |0 |d |
+ |2 |3 |c |
+
+ At the call of send_eof() for the second operand first we disable index.
+ Then for each record, the minimum of counters from dup_cnt and add_cnt m is
+ taken. If m == 0 then the record is deleted. Otherwise record is replaced
+ with m copies of it. Yet the counter in this copies are set to 1 for
+ dup_cnt and to 0 for add_cnt
+
+ |add_cnt|dup_cnt| f |
+ |0 |1 |b |
+ |0 |1 |b |
+ |0 |1 |a |
+ |0 |1 |c |
+ |0 |1 |c |
+
+ - Let's demonstrate how the the set operation EXCEPT ALL is proceesed
+ for the query
+ SELECT f FROM t1 EXCEPT ALL SELECT f FROM t3
+
+ Only one additional counter field dup_cnt is used for EXCEPT ALL.
+ After the first operand has been processed we have in the temporary table
+
+ |dup_cnt| f |
+ |2 |b |
+ |3 |a |
+ |1 |d |
+ |2 |c |
+
+ When send_data() is called for the rows of the second operand we decrement
+ the counter in dup_cnt if the processed row is found in the table and do
+ nothing otherwise. If the counter becomes 0 we delete the record
+
+ |dup_cnt| f |
+ |2 |a |
+ |1 |c |
+
+ Finally at the call of send_eof() for the second operand we disable index
+ unfold rows adding duplicates
+
+ |dup_cnt| f |
+ |1 |a |
+ |1 |a |
+ |1 |c |
+ */
+
+class select_unit_ext :public select_unit
+{
+public:
+ select_unit_ext(THD *thd_arg):
+ select_unit(thd_arg), increment(0), is_index_enabled(TRUE),
+ curr_op_type(UNSPECIFIED)
+ {
+ };
+ int send_data(List<Item> &items);
void change_select();
+ int unfold_record(ha_rows cnt);
+ bool send_eof();
+ bool force_enable_index_if_needed()
+ {
+ is_index_enabled= true;
+ return true;
+ }
+ bool disable_index_if_needed(SELECT_LEX *curr_sl);
+
+ /*
+ How to change increment/decrement the counter in duplicate_cnt field
+ when processing a record produced by the current operand in send_data().
+ The value can be 1 or -1
+ */
+ int increment;
+ /* TRUE <=> the index of the result temporary table is enabled */
+ bool is_index_enabled;
+ /* The type of the set operation currently executed */
+ enum set_op_type curr_op_type;
+ /*
+ Points to the extra field of the temporary table where
+ duplicate counters are stored
+ */
+ Field *duplicate_cnt;
+ /*
+ Points to the extra field of the temporary table where additional
+ counters used only for INTERSECT ALL operations are stored
+ */
+ Field *additional_cnt;
};
class select_union_recursive :public select_unit
@@ -6151,7 +6317,7 @@ class user_var_entry
double val_real(bool *null_value);
longlong val_int(bool *null_value) const;
- String *val_str(bool *null_value, String *str, uint decimals);
+ String *val_str(bool *null_value, String *str, uint decimals) const;
my_decimal *val_decimal(bool *null_value, my_decimal *result);
CHARSET_INFO *charset() const { return m_charset; }
void set_charset(CHARSET_INFO *cs) { m_charset= cs; }
@@ -6679,6 +6845,62 @@ class Sql_mode_save
};
+class Sql_mode_instant_set: public Sql_mode_save
+{
+public:
+ Sql_mode_instant_set(THD *thd, sql_mode_t temporary_value)
+ :Sql_mode_save(thd)
+ {
+ thd->variables.sql_mode= temporary_value;
+ }
+};
+
+
+class Sql_mode_instant_remove: public Sql_mode_save
+{
+public:
+ Sql_mode_instant_remove(THD *thd, sql_mode_t temporary_remove_flags)
+ :Sql_mode_save(thd)
+ {
+ thd->variables.sql_mode&= ~temporary_remove_flags;
+ }
+};
+
+
+class Abort_on_warning_instant_set
+{
+ THD *m_thd;
+ bool m_save_abort_on_warning;
+public:
+ Abort_on_warning_instant_set(THD *thd, bool temporary_value)
+ :m_thd(thd), m_save_abort_on_warning(thd->abort_on_warning)
+ {
+ thd->abort_on_warning= temporary_value;
+ }
+ ~Abort_on_warning_instant_set()
+ {
+ m_thd->abort_on_warning= m_save_abort_on_warning;
+ }
+};
+
+
+class Check_level_instant_set
+{
+ THD *m_thd;
+ enum_check_fields m_check_level;
+public:
+ Check_level_instant_set(THD *thd, enum_check_fields temporary_value)
+ :m_thd(thd), m_check_level(thd->count_cuted_fields)
+ {
+ thd->count_cuted_fields= temporary_value;
+ }
+ ~Check_level_instant_set()
+ {
+ m_thd->count_cuted_fields= m_check_level;
+ }
+};
+
+
/**
This class resembles the SQL Standard schema qualified object name:
<schema qualified name> ::= [ <schema name> <period> ] <qualified identifier>
@@ -6706,8 +6928,8 @@ public:
bool eq(const Database_qualified_name *other) const
{
CHARSET_INFO *cs= lower_case_table_names ?
- &my_charset_utf8_general_ci :
- &my_charset_utf8_bin;
+ &my_charset_utf8mb3_general_ci :
+ &my_charset_utf8mb3_bin;
return
m_db.length == other->m_db.length &&
m_name.length == other->m_name.length &&
@@ -6792,10 +7014,9 @@ public:
class Type_holder: public Sql_alloc,
public Item_args,
public Type_handler_hybrid_field_type,
- public Type_all_attributes,
- public Type_geometry_attributes
+ public Type_all_attributes
{
- TYPELIB *m_typelib;
+ const TYPELIB *m_typelib;
bool m_maybe_null;
public:
Type_holder()
@@ -6818,19 +7039,11 @@ public:
DBUG_ASSERT(0);
return 0;
}
- void set_geometry_type(uint type)
- {
- Type_geometry_attributes::set_geometry_type(type);
- }
- uint uint_geometry_type() const
- {
- return Type_geometry_attributes::get_geometry_type();
- }
- void set_typelib(TYPELIB *typelib)
+ void set_typelib(const TYPELIB *typelib)
{
m_typelib= typelib;
}
- TYPELIB *get_typelib() const
+ const TYPELIB *get_typelib() const
{
return m_typelib;
}
diff --git a/sql/sql_cmd.h b/sql/sql_cmd.h
index 7f1fd06aa46..1f8f2dcabc9 100644
--- a/sql/sql_cmd.h
+++ b/sql/sql_cmd.h
@@ -208,6 +208,26 @@ protected:
}
};
+class Sql_cmd_show_slave_status: public Sql_cmd
+{
+protected:
+ bool show_all_slaves_status;
+public:
+ Sql_cmd_show_slave_status()
+ :show_all_slaves_status(false)
+ {}
+
+ Sql_cmd_show_slave_status(bool status_all)
+ :show_all_slaves_status(status_all)
+ {}
+
+ enum_sql_command sql_command_code() const { return SQLCOM_SHOW_SLAVE_STAT; }
+
+ bool execute(THD *thd);
+ bool is_show_all_slaves_stat() { return show_all_slaves_status; }
+};
+
+
class Sql_cmd_create_table_like: public Sql_cmd,
public Storage_engine_name
{
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc
index 6bf43d3df5e..0add71b7b11 100644
--- a/sql/sql_connect.cc
+++ b/sql/sql_connect.cc
@@ -43,6 +43,7 @@
#include "wsrep_mysqld.h"
#endif /* WITH_WSREP */
#include "proxy_protocol.h"
+#include <ssl_compat.h>
HASH global_user_stats, global_client_stats, global_table_stats;
HASH global_index_stats;
@@ -1112,7 +1113,6 @@ bool setup_connection_thread_globals(THD *thd)
close_connection(thd, ER_OUT_OF_RESOURCES);
statistic_increment(aborted_connects,&LOCK_status);
statistic_increment(connection_errors_internal, &LOCK_status);
- thd->scheduler->end_thread(thd, 0);
return 1; // Error
}
return 0;
@@ -1313,7 +1313,16 @@ pthread_handler_t handle_one_connection(void *arg)
mysql_thread_set_psi_id(connect->thread_id);
- do_handle_one_connection(connect);
+ if (init_new_connection_handler_thread())
+ connect->close_with_error(0, 0, ER_OUT_OF_RESOURCES);
+ else
+ do_handle_one_connection(connect, true);
+
+ DBUG_PRINT("info", ("killing thread"));
+#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
+ ERR_remove_state(0);
+#endif
+ my_thread_end();
return 0;
}
@@ -1347,16 +1356,13 @@ bool thd_is_connection_alive(THD *thd)
}
-void do_handle_one_connection(CONNECT *connect)
+void do_handle_one_connection(CONNECT *connect, bool put_in_cache)
{
ulonglong thr_create_utime= microsecond_interval_timer();
THD *thd;
- if (connect->scheduler->init_new_connection_thread() ||
- !(thd= connect->create_thd(NULL)))
+ if (!(thd= connect->create_thd(NULL)))
{
- scheduler_functions *scheduler= connect->scheduler;
- connect->close_with_error(0, 0, ER_OUT_OF_RESOURCES);
- scheduler->end_thread(0, 0);
+ connect->close_and_delete();
return;
}
@@ -1392,7 +1398,11 @@ void do_handle_one_connection(CONNECT *connect)
*/
thd->thread_stack= (char*) &thd;
if (setup_connection_thread_globals(thd))
+ {
+ unlink_thd(thd);
+ delete thd;
return;
+ }
for (;;)
{
@@ -1420,16 +1430,40 @@ end_thread:
if (thd->userstat_running)
update_global_user_stats(thd, create_user, time(NULL));
- if (thd->scheduler->end_thread(thd, 1))
- return; // Probably no-threads
+ unlink_thd(thd);
+ if (IF_WSREP(thd->wsrep_applier, false) || !put_in_cache ||
+ !(connect= cache_thread(thd)))
+ break;
+
+ if (!(connect->create_thd(thd)))
+ {
+ /* Out of resources. Free thread to get more resources */
+ connect->close_and_delete();
+ break;
+ }
+ delete connect;
+
+ /*
+ We have to call store_globals to update mysys_var->id and lock_info
+ with the new thread_id
+ */
+ thd->store_globals();
/*
- If end_thread() returns, this thread has been schedule to
- handle the next connection.
+ Create new instrumentation for the new THD job,
+ and attach it to this running pthread.
*/
- thd= current_thd;
- thd->thread_stack= (char*) &thd;
+ PSI_CALL_set_thread(PSI_CALL_new_thread(key_thread_one_connection,
+ thd, thd->thread_id));
+
+ /* reset abort flag for the thread */
+ thd->mysys_var->abort= 0;
+ thd->thr_create_utime= microsecond_interval_timer();
+ thd->start_utime= thd->thr_create_utime;
+
+ server_threads.insert(thd);
}
+ delete thd;
}
#endif /* EMBEDDED_LIBRARY */
@@ -1446,10 +1480,16 @@ void CONNECT::close_and_delete()
{
DBUG_ENTER("close_and_delete");
- if (vio)
- vio_close(vio);
- if (thread_count_incremented)
- dec_connection_count(scheduler);
+#if _WIN32
+ if (vio_type == VIO_TYPE_NAMEDPIPE)
+ CloseHandle(pipe);
+ else
+#endif
+ if (vio_type != VIO_CLOSED)
+ mysql_socket_close(sock);
+ vio_type= VIO_CLOSED;
+
+ --*scheduler->connection_count;
statistic_increment(connection_errors_internal, &LOCK_status);
statistic_increment(aborted_connects,&LOCK_status);
@@ -1478,18 +1518,12 @@ void CONNECT::close_with_error(uint sql_errno,
}
-CONNECT::~CONNECT()
-{
- if (vio)
- vio_delete(vio);
-}
-
-
/* Reuse or create a THD based on a CONNECT object */
THD *CONNECT::create_thd(THD *thd)
{
bool res, thd_reused= thd != 0;
+ Vio *vio;
DBUG_ENTER("create_thd");
DBUG_EXECUTE_IF("simulate_failed_connection_2", DBUG_RETURN(0); );
@@ -1508,9 +1542,23 @@ THD *CONNECT::create_thd(THD *thd)
else if (!(thd= new THD(thread_id)))
DBUG_RETURN(0);
+#if _WIN32
+ if (vio_type == VIO_TYPE_NAMEDPIPE)
+ vio= vio_new_win32pipe(pipe);
+ else
+#endif
+ vio= mysql_socket_vio_new(sock, vio_type, vio_type == VIO_TYPE_SOCKET ?
+ VIO_LOCALHOST : 0);
+ if (!vio)
+ {
+ if (!thd_reused)
+ delete thd;
+ DBUG_RETURN(0);
+ }
+
set_current_thd(thd);
res= my_net_init(&thd->net, vio, thd, MYF(MY_THREAD_SPECIFIC));
- vio= 0; // Vio now handled by thd
+ vio_type= VIO_CLOSED; // Vio now handled by thd
if (unlikely(res || thd->is_error()))
{
@@ -1522,9 +1570,11 @@ THD *CONNECT::create_thd(THD *thd)
init_net_server_extension(thd);
- thd->security_ctx->host= host;
- thd->extra_port= extra_port;
+ thd->security_ctx->host= thd->net.vio->type == VIO_TYPE_NAMEDPIPE ||
+ thd->net.vio->type == VIO_TYPE_SOCKET ?
+ my_localhost : 0;
+
thd->scheduler= scheduler;
- thd->real_id= real_id;
+ thd->real_id= pthread_self(); /* Duplicates THD::store_globals() setting. */
DBUG_RETURN(thd);
}
diff --git a/sql/sql_connect.h b/sql/sql_connect.h
index 82ab4423b37..4d62834a6f9 100644
--- a/sql/sql_connect.h
+++ b/sql/sql_connect.h
@@ -21,6 +21,7 @@
#include "structs.h"
#include <mysql/psi/mysql_socket.h>
#include <hash.h>
+#include "violite.h"
/*
Object to hold connect information to be given to the newly created thread
@@ -30,25 +31,24 @@ struct scheduler_functions;
class CONNECT : public ilink {
public:
- /* To be copied to THD */
- Vio *vio; /* Copied to THD with my_net_init() */
- const char *host;
+ MYSQL_SOCKET sock;
+#ifdef _WIN32
+ HANDLE pipe;
+ CONNECT(HANDLE pipe_arg): pipe(pipe_arg), vio_type(VIO_TYPE_NAMEDPIPE),
+ scheduler(thread_scheduler), thread_id(0), prior_thr_create_utime(0) {}
+#endif
+ enum enum_vio_type vio_type;
scheduler_functions *scheduler;
my_thread_id thread_id;
- pthread_t real_id;
- bool extra_port;
/* Own variables */
- bool thread_count_incremented;
ulonglong prior_thr_create_utime;
- CONNECT()
- :vio(0), host(0), scheduler(thread_scheduler), thread_id(0), real_id(0),
- extra_port(0),
- thread_count_incremented(0), prior_thr_create_utime(0)
- {
- };
- ~CONNECT();
+ CONNECT(MYSQL_SOCKET sock_arg, enum enum_vio_type vio_type_arg,
+ scheduler_functions *scheduler_arg): sock(sock_arg),
+ vio_type(vio_type_arg), scheduler(scheduler_arg), thread_id(0),
+ prior_thr_create_utime(0) {}
+ ~CONNECT() { DBUG_ASSERT(vio_type == VIO_CLOSED); }
void close_and_delete();
void close_with_error(uint sql_errno,
const char *message, uint close_error);
@@ -71,7 +71,7 @@ void free_global_index_stats(void);
void free_global_client_stats(void);
pthread_handler_t handle_one_connection(void *arg);
-void do_handle_one_connection(CONNECT *connect);
+void do_handle_one_connection(CONNECT *connect, bool put_in_cache);
bool init_new_connection_handler_thread();
void reset_mqh(LEX_USER *lu, bool get_them);
bool check_mqh(THD *thd, uint check_command);
diff --git a/sql/sql_cte.cc b/sql/sql_cte.cc
index e452196a271..5b3d3108da5 100644
--- a/sql/sql_cte.cc
+++ b/sql/sql_cte.cc
@@ -972,7 +972,7 @@ With_element::rename_columns_of_derived_unit(THD *thd,
/* Rename the columns of the first select in the unit */
while ((item= it++, name= nm++))
{
- item->set_name(thd, name->str, (uint) name->length, system_charset_info);
+ item->set_name(thd, *name);
item->is_autogenerated_name= false;
}
diff --git a/sql/sql_cursor.cc b/sql/sql_cursor.cc
index 8f41fe7c70d..b995a841a74 100644
--- a/sql/sql_cursor.cc
+++ b/sql/sql_cursor.cc
@@ -284,12 +284,11 @@ int Materialized_cursor::send_result_set_metadata(
*/
while ((item_dst= it_dst++, item_org= it_org++))
{
- Send_field send_field;
Item_ident *ident= static_cast<Item_ident *>(item_dst);
- item_org->make_send_field(thd, &send_field);
+ Send_field send_field(thd, item_org);
- ident->db_name= thd->strdup(send_field.db_name);
- ident->table_name= thd->strdup(send_field.table_name);
+ ident->db_name= thd->strmake_lex_cstring(send_field.db_name);
+ ident->table_name= thd->strmake_lex_cstring(send_field.table_name);
}
/*
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index ddc5234fa01..62fbd4b8880 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -26,6 +26,7 @@
#include "lock.h" // lock_schema_name
#include "sql_table.h" // build_table_filename,
// filename_to_tablename
+ // validate_comment_length
#include "sql_rename.h" // mysql_rename_tables
#include "sql_acl.h" // SELECT_ACL, DB_ACLS,
// acl_get, check_grant_db
@@ -77,6 +78,7 @@ typedef struct my_dbopt_st
char *name; /* Database name */
uint name_length; /* Database length name */
CHARSET_INFO *charset; /* Database default character set */
+ LEX_STRING comment; /* Database comment */
} my_dbopt_t;
@@ -235,7 +237,8 @@ void my_dbopt_cleanup(void)
1 on error.
*/
-static my_bool get_dbopt(const char *dbname, Schema_specification_st *create)
+static my_bool get_dbopt(THD *thd, const char *dbname,
+ Schema_specification_st *create)
{
my_dbopt_t *opt;
uint length;
@@ -247,6 +250,11 @@ static my_bool get_dbopt(const char *dbname, Schema_specification_st *create)
if ((opt= (my_dbopt_t*) my_hash_search(&dboptions, (uchar*) dbname, length)))
{
create->default_table_charset= opt->charset;
+ if (opt->comment.length)
+ {
+ create->schema_comment= thd->make_clex_string(opt->comment.str,
+ opt->comment.length);
+ }
error= 0;
}
mysql_rwlock_unlock(&LOCK_dboptions);
@@ -274,15 +282,17 @@ static my_bool put_dbopt(const char *dbname, Schema_specification_st *create)
DBUG_ENTER("put_dbopt");
length= (uint) strlen(dbname);
-
+
mysql_rwlock_wrlock(&LOCK_dboptions);
if (!(opt= (my_dbopt_t*) my_hash_search(&dboptions, (uchar*) dbname,
length)))
{
/* Options are not in the hash, insert them */
char *tmp_name;
+ char *tmp_comment= NULL;
if (!my_multi_malloc(MYF(MY_WME | MY_ZEROFILL),
&opt, (uint) sizeof(*opt), &tmp_name, (uint) length+1,
+ &tmp_comment, (uint) DATABASE_COMMENT_MAXLEN+1,
NullS))
{
error= 1;
@@ -292,7 +302,7 @@ static my_bool put_dbopt(const char *dbname, Schema_specification_st *create)
opt->name= tmp_name;
strmov(opt->name, dbname);
opt->name_length= length;
-
+ opt->comment.str= tmp_comment;
if (unlikely((error= my_hash_insert(&dboptions, (uchar*) opt))))
{
my_free(opt);
@@ -303,6 +313,12 @@ static my_bool put_dbopt(const char *dbname, Schema_specification_st *create)
/* Update / write options in hash */
opt->charset= create->default_table_charset;
+ if (create->schema_comment)
+ {
+ strmov(opt->comment.str, create->schema_comment->str);
+ opt->comment.length= create->schema_comment->length;
+ }
+
end:
mysql_rwlock_unlock(&LOCK_dboptions);
DBUG_RETURN(error);
@@ -328,7 +344,8 @@ static void del_dbopt(const char *path)
Create database options file:
DESCRIPTION
- Currently database default charset is only stored there.
+ Currently database default charset, default collation
+ and comment are stored there.
RETURN VALUES
0 ok
@@ -339,9 +356,34 @@ static bool write_db_opt(THD *thd, const char *path,
Schema_specification_st *create)
{
File file;
- char buf[256]; // Should be enough for one option
+ char buf[256+DATABASE_COMMENT_MAXLEN];
bool error=1;
+ if (create->schema_comment)
+ {
+ if (validate_comment_length(thd, create->schema_comment,
+ DATABASE_COMMENT_MAXLEN,
+ ER_TOO_LONG_DATABASE_COMMENT,
+ thd->lex->name.str))
+ return error;
+ }
+
+ if (thd->lex->sql_command == SQLCOM_ALTER_DB &&
+ (!create->schema_comment || !create->default_table_charset))
+ {
+ /* Use existing values of schema_comment and charset for
+ ALTER DATABASE queries */
+ Schema_specification_st tmp;
+ tmp.init();
+ load_db_opt(thd, path, &tmp);
+
+ if (!create->schema_comment)
+ create->schema_comment= tmp.schema_comment;
+
+ if (!create->default_table_charset)
+ create->default_table_charset= tmp.default_table_charset;
+ }
+
if (!create->default_table_charset)
create->default_table_charset= thd->variables.collation_server;
@@ -358,6 +400,11 @@ static bool write_db_opt(THD *thd, const char *path,
create->default_table_charset->name,
"\n", NullS) - buf);
+ if (create->schema_comment)
+ length= (ulong) (strxnmov(buf+length, sizeof(buf)-1-length,
+ "comment=", create->schema_comment->str,
+ "\n", NullS) - buf);
+
/* Error is written by mysql_file_write */
if (!mysql_file_write(file, (uchar*) buf, length, MYF(MY_NABP+MY_WME)))
error=0;
@@ -385,7 +432,7 @@ static bool write_db_opt(THD *thd, const char *path,
bool load_db_opt(THD *thd, const char *path, Schema_specification_st *create)
{
File file;
- char buf[256];
+ char buf[256+DATABASE_COMMENT_MAXLEN];
DBUG_ENTER("load_db_opt");
bool error=1;
size_t nbytes;
@@ -394,7 +441,7 @@ bool load_db_opt(THD *thd, const char *path, Schema_specification_st *create)
create->default_table_charset= thd->variables.collation_server;
/* Check if options for this database are already in the hash */
- if (!get_dbopt(path, create))
+ if (!get_dbopt(thd, path, create))
DBUG_RETURN(0);
/* Otherwise, load options from the .opt file */
@@ -444,6 +491,8 @@ bool load_db_opt(THD *thd, const char *path, Schema_specification_st *create)
create->default_table_charset= default_charset_info;
}
}
+ else if (!strncmp(buf, "comment", (pos-buf)))
+ create->schema_comment= thd->make_clex_string(pos+1, strlen(pos+1));
}
}
/*
@@ -544,7 +593,7 @@ CHARSET_INFO *get_default_db_collation(THD *thd, const char *db_name)
Create a database
SYNOPSIS
- mysql_create_db_iternal()
+ mysql_create_db_internal()
thd Thread handler
db Name of database to create
Function assumes that this is already validated.
@@ -1040,7 +1089,7 @@ exit:
if (unlikely(thd->db.str && cmp_db_names(&thd->db, db) && !error))
{
mysql_change_db_impl(thd, NULL, 0, thd->variables.collation_server);
- SESSION_TRACKER_CHANGED(thd, CURRENT_SCHEMA_TRACKER, NULL);
+ thd->session_tracker.current_schema.mark_as_changed(thd);
}
my_dirend(dirp);
DBUG_RETURN(error);
@@ -1601,8 +1650,8 @@ uint mysql_change_db(THD *thd, const LEX_CSTRING *new_db_name,
mysql_change_db_impl(thd, &new_db_file_name, db_access, db_default_cl);
done:
- SESSION_TRACKER_CHANGED(thd, CURRENT_SCHEMA_TRACKER, NULL);
- SESSION_TRACKER_CHANGED(thd, SESSION_STATE_CHANGE_TRACKER, NULL);
+ thd->session_tracker.current_schema.mark_as_changed(thd);
+ thd->session_tracker.state_change.mark_as_changed(thd);
DBUG_RETURN(0);
}
diff --git a/sql/sql_digest.cc b/sql/sql_digest.cc
index 10a9547d80f..5ca855c9608 100644
--- a/sql/sql_digest.cc
+++ b/sql/sql_digest.cc
@@ -188,7 +188,7 @@ void compute_digest_text(const sql_digest_storage* digest_storage,
/* Convert text to utf8 */
const CHARSET_INFO *from_cs= get_charset(digest_storage->m_charset_number, MYF(0));
- const CHARSET_INFO *to_cs= &my_charset_utf8_bin;
+ const CHARSET_INFO *to_cs= &my_charset_utf8mb3_bin;
if (from_cs == NULL)
{
diff --git a/sql/sql_error.cc b/sql/sql_error.cc
index a11a0f454a2..e6dcfed0412 100644
--- a/sql/sql_error.cc
+++ b/sql/sql_error.cc
@@ -744,7 +744,7 @@ void push_warning_printf(THD *thd, Sql_condition::enum_warning_level level,
DBUG_ASSERT(format != NULL);
va_start(args,format);
- my_vsnprintf_ex(&my_charset_utf8_general_ci, warning,
+ my_vsnprintf_ex(&my_charset_utf8mb3_general_ci, warning,
sizeof(warning), format, args);
va_end(args);
push_warning(thd, level, code, warning);
@@ -1009,3 +1009,13 @@ bool is_sqlstate_valid(const LEX_CSTRING *sqlstate)
return true;
}
+
+
+void convert_error_to_warning(THD *thd)
+{
+ DBUG_ASSERT(thd->is_error());
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
+ thd->get_stmt_da()->sql_errno(),
+ thd->get_stmt_da()->message());
+ thd->clear_error();
+}
diff --git a/sql/sql_error.h b/sql/sql_error.h
index bb83d8af800..a0497af78cb 100644
--- a/sql/sql_error.h
+++ b/sql/sql_error.h
@@ -307,16 +307,16 @@ protected:
String m_cursor_name;
Sql_condition_items()
- :m_class_origin((const char*) NULL, 0, & my_charset_utf8_bin),
- m_subclass_origin((const char*) NULL, 0, & my_charset_utf8_bin),
- m_constraint_catalog((const char*) NULL, 0, & my_charset_utf8_bin),
- m_constraint_schema((const char*) NULL, 0, & my_charset_utf8_bin),
- m_constraint_name((const char*) NULL, 0, & my_charset_utf8_bin),
- m_catalog_name((const char*) NULL, 0, & my_charset_utf8_bin),
- m_schema_name((const char*) NULL, 0, & my_charset_utf8_bin),
- m_table_name((const char*) NULL, 0, & my_charset_utf8_bin),
- m_column_name((const char*) NULL, 0, & my_charset_utf8_bin),
- m_cursor_name((const char*) NULL, 0, & my_charset_utf8_bin)
+ :m_class_origin((const char*) NULL, 0, & my_charset_utf8mb3_bin),
+ m_subclass_origin((const char*) NULL, 0, & my_charset_utf8mb3_bin),
+ m_constraint_catalog((const char*) NULL, 0, & my_charset_utf8mb3_bin),
+ m_constraint_schema((const char*) NULL, 0, & my_charset_utf8mb3_bin),
+ m_constraint_name((const char*) NULL, 0, & my_charset_utf8mb3_bin),
+ m_catalog_name((const char*) NULL, 0, & my_charset_utf8mb3_bin),
+ m_schema_name((const char*) NULL, 0, & my_charset_utf8mb3_bin),
+ m_table_name((const char*) NULL, 0, & my_charset_utf8mb3_bin),
+ m_column_name((const char*) NULL, 0, & my_charset_utf8mb3_bin),
+ m_cursor_name((const char*) NULL, 0, & my_charset_utf8mb3_bin)
{ }
void clear()
@@ -1260,6 +1260,7 @@ private:
///////////////////////////////////////////////////////////////////////////
+void convert_error_to_warning(THD *thd);
void push_warning(THD *thd, Sql_condition::enum_warning_level level,
uint code, const char *msg);
diff --git a/sql/sql_get_diagnostics.cc b/sql/sql_get_diagnostics.cc
index b3ae423b914..197bf5e7a00 100644
--- a/sql/sql_get_diagnostics.cc
+++ b/sql/sql_get_diagnostics.cc
@@ -266,8 +266,8 @@ Condition_information::aggregate(THD *thd, const Diagnostics_area *da)
Item *
Condition_information_item::make_utf8_string_item(THD *thd, const String *str)
{
- /* Default is utf8 character set and utf8_general_ci collation. */
- CHARSET_INFO *to_cs= &my_charset_utf8_general_ci;
+ /* Default is utf8 character set and utf8mb3_general_ci collation. */
+ CHARSET_INFO *to_cs= &my_charset_utf8mb3_general_ci;
/* If a charset was not set, assume that no conversion is needed. */
CHARSET_INFO *from_cs= str->charset() ? str->charset() : to_cs;
String tmp(str->ptr(), str->length(), from_cs);
diff --git a/sql/sql_help.cc b/sql/sql_help.cc
index e5f1e958d99..c9307b578fc 100644
--- a/sql/sql_help.cc
+++ b/sql/sql_help.cc
@@ -92,14 +92,12 @@ static bool init_fields(THD *thd, TABLE_LIST *tables,
context->resolve_in_table_list_only(tables);
for (; count-- ; find_fields++)
{
- LEX_CSTRING field_name= {find_fields->field_name,
- strlen(find_fields->field_name) };
/* We have to use 'new' here as field will be re_linked on free */
Item_field *field= (new (thd->mem_root)
Item_field(thd, context,
- "mysql",
- find_fields->table_name,
- &field_name));
+ {STRING_WITH_LEN("mysql")},
+ Lex_cstring_strlen(find_fields->table_name),
+ Lex_cstring_strlen(find_fields->field_name)));
if (!(find_fields->field= find_field_in_tables(thd, field, tables, NULL,
0, REPORT_ALL_ERRORS, 1,
TRUE)))
@@ -858,9 +856,7 @@ error2:
bool mysqld_help(THD *thd, const char *mask)
{
- sql_mode_t sql_mode_backup= thd->variables.sql_mode;
- thd->variables.sql_mode&= ~MODE_PAD_CHAR_TO_FULL_LENGTH;
+ Sql_mode_instant_remove sms(thd, MODE_PAD_CHAR_TO_FULL_LENGTH);
bool rc= mysqld_help_internal(thd, mask);
- thd->variables.sql_mode= sql_mode_backup;
return rc;
}
diff --git a/sql/sql_hset.h b/sql/sql_hset.h
index 7834349a2f7..aaecef9f0d4 100644
--- a/sql/sql_hset.h
+++ b/sql/sql_hset.h
@@ -38,6 +38,13 @@ public:
m_hash.get_key= (my_hash_get_key)K;
m_hash.charset= cs;
}
+ Hash_set(CHARSET_INFO *charset, ulong default_array_elements,
+ size_t key_offset, size_t key_length, my_hash_get_key get_key,
+ void (*free_element)(void*), uint flags)
+ {
+ my_hash_init(&m_hash, charset, default_array_elements, key_offset,
+ key_length, get_key, free_element, flags);
+ }
/**
Destroy the hash by freeing the buckets table. Does
not call destructors for the elements.
@@ -58,13 +65,8 @@ public:
bool insert(T *value)
{
my_hash_init_opt(&m_hash, m_hash.charset, START_SIZE, 0, 0,
- m_hash.get_key, 0, MYF(0));
- size_t key_len;
- uchar *v= reinterpret_cast<uchar *>(value);
- const uchar *key= m_hash.get_key(v, &key_len, FALSE);
- if (find(key, key_len) == NULL)
- return my_hash_insert(&m_hash, v);
- return FALSE;
+ m_hash.get_key, 0, HASH_UNIQUE);
+ return my_hash_insert(&m_hash, reinterpret_cast<const uchar*>(value));
}
bool remove(T *value)
{
@@ -78,6 +80,8 @@ public:
bool is_empty() const { return m_hash.records == 0; }
/** Returns the number of unique elements. */
size_t size() const { return static_cast<size_t>(m_hash.records); }
+ /** Erases all elements from the container */
+ void clear() { my_hash_reset(&m_hash); }
const T* at(size_t i) const
{
return reinterpret_cast<T*>(my_hash_element(const_cast<HASH*>(&m_hash), i));
diff --git a/sql/sql_i_s.h b/sql/sql_i_s.h
new file mode 100644
index 00000000000..4ca669a5610
--- /dev/null
+++ b/sql/sql_i_s.h
@@ -0,0 +1,327 @@
+#ifndef SQL_I_S_INCLUDED
+#define SQL_I_S_INCLUDED
+/* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2019, 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
+
+#include "sql_const.h" // MAX_FIELD_VARCHARLENGTH
+#include "sql_basic_types.h" // enum_nullability
+#include "sql_string.h" // strlen, MY_CS_NAME_SIZE
+#include "lex_string.h" // LEX_CSTRING
+#include "mysql_com.h" // enum_field_types
+#include "my_time.h" // TIME_SECOND_PART_DIGITS
+#include "sql_type.h" // Type_handler_xxx
+
+struct TABLE_LIST;
+struct TABLE;
+typedef class Item COND;
+
+#ifdef MYSQL_CLIENT
+#error MYSQL_CLIENT must not be defined
+#endif // MYSQL_CLIENT
+
+
+bool schema_table_store_record(THD *thd, TABLE *table);
+COND *make_cond_for_info_schema(THD *thd, COND *cond, TABLE_LIST *table);
+
+
+enum enum_show_open_table
+{
+ SKIP_OPEN_TABLE= 0U, // do not open table
+ OPEN_FRM_ONLY= 1U, // open FRM file only
+ OPEN_FULL_TABLE= 2U // open FRM,MYD, MYI files
+};
+
+
+namespace Show {
+class Type
+{
+ /**
+ This denotes data type for the column. For the most part, there seems to
+ be one entry in the enum for each SQL data type, although there seem to
+ be a number of additional entries in the enum.
+ */
+ const Type_handler *m_type_handler;
+ /**
+ For string-type columns, this is the maximum number of
+ characters. Otherwise, it is the 'display-length' for the column.
+ */
+ uint m_char_length;
+ uint m_unsigned_flag;
+ const Typelib *m_typelib;
+public:
+ Type(const Type_handler *th, uint length, uint unsigned_flag,
+ const Typelib *typelib= NULL)
+ :m_type_handler(th), m_char_length(length), m_unsigned_flag(unsigned_flag),
+ m_typelib(typelib)
+ { }
+ const Type_handler *type_handler() const { return m_type_handler; }
+ uint char_length() const { return m_char_length; }
+ uint decimal_precision() const { return (m_char_length / 100) % 100; }
+ uint decimal_scale() const { return m_char_length % 10; }
+ uint fsp() const
+ {
+ DBUG_ASSERT(m_char_length <= TIME_SECOND_PART_DIGITS);
+ return m_char_length;
+ }
+ uint unsigned_flag() const { return m_unsigned_flag; }
+ const Typelib *typelib() const { return m_typelib; }
+};
+} // namespace Show
+
+
+
+class ST_FIELD_INFO: public Show::Type
+{
+protected:
+ LEX_CSTRING m_name; // I_S column name
+ enum_nullability m_nullability; // NULLABLE or NOT NULL
+ LEX_CSTRING m_old_name; // SHOW column name
+ enum_show_open_table m_open_method;
+public:
+ ST_FIELD_INFO(const LEX_CSTRING &name, const Type &type,
+ enum_nullability nullability,
+ LEX_CSTRING &old_name,
+ enum_show_open_table open_method)
+ :Type(type), m_name(name), m_nullability(nullability), m_old_name(old_name),
+ m_open_method(open_method)
+ { }
+ ST_FIELD_INFO(const char *name, const Type &type,
+ enum_nullability nullability,
+ const char *old_name,
+ enum_show_open_table open_method)
+ :Type(type), m_nullability(nullability), m_open_method(open_method)
+ {
+ m_name.str= name;
+ m_name.length= safe_strlen(name);
+ m_old_name.str= old_name;
+ m_old_name.length= safe_strlen(old_name);
+ }
+ const LEX_CSTRING &name() const { return m_name; }
+ bool nullable() const { return m_nullability == NULLABLE; }
+ const LEX_CSTRING &old_name() const { return m_old_name; }
+ enum_show_open_table open_method() const { return m_open_method; }
+ bool end_marker() const { return m_name.str == NULL; }
+};
+
+
+namespace Show
+{
+
+
+class Enum: public Type
+{
+public:
+ Enum(const Typelib *typelib) :Type(&type_handler_enum, 0, false, typelib) { }
+};
+
+
+class Blob: public Type
+{
+public:
+ Blob(uint length) :Type(&type_handler_blob, length, false) { }
+};
+
+
+class Varchar: public Type
+{
+public:
+ Varchar(uint length) :Type(&type_handler_varchar, length, false)
+ {
+ DBUG_ASSERT(length * 3 <= MAX_FIELD_VARCHARLENGTH);
+ }
+};
+
+
+class Longtext: public Type
+{
+public:
+ Longtext(uint length) :Type(&type_handler_varchar, length, false) { }
+};
+
+
+class Yesno: public Varchar
+{
+public:
+ Yesno(): Varchar(3) { }
+};
+
+
+class Catalog: public Varchar
+{
+public:
+ Catalog(): Varchar(FN_REFLEN) { }
+};
+
+
+class Name: public Varchar
+{
+public:
+ Name(): Varchar(NAME_CHAR_LEN) { }
+};
+
+
+class Definer: public Varchar
+{
+public:
+ Definer(): Varchar(DEFINER_CHAR_LENGTH) { }
+};
+
+
+class Userhost: public Varchar
+{
+public:
+ Userhost(): Varchar(USERNAME_CHAR_LENGTH + HOSTNAME_LENGTH + 2) { }
+};
+
+
+class CSName: public Varchar
+{
+public:
+ CSName(): Varchar(MY_CS_NAME_SIZE) { }
+};
+
+
+class SQLMode: public Varchar
+{
+public:
+ SQLMode(): Varchar(32*256) { }
+};
+
+
+class Datetime: public Type
+{
+public:
+ Datetime(uint dec) :Type(&type_handler_datetime2, dec, false) { }
+};
+
+
+class Decimal: public Type
+{
+public:
+ Decimal(uint length) :Type(&type_handler_newdecimal, length, false) { }
+};
+
+
+class ULonglong: public Type
+{
+public:
+ ULonglong(uint length) :Type(&type_handler_ulonglong, length, true) { }
+ ULonglong() :ULonglong(MY_INT64_NUM_DECIMAL_DIGITS) { }
+};
+
+
+class ULong: public Type
+{
+public:
+ ULong(uint length) :Type(&type_handler_ulong, length, true) { }
+ ULong() :ULong(MY_INT32_NUM_DECIMAL_DIGITS) { }
+};
+
+
+class SLonglong: public Type
+{
+public:
+ SLonglong(uint length) :Type(&type_handler_slonglong, length, false) { }
+ SLonglong() :SLonglong(MY_INT64_NUM_DECIMAL_DIGITS) { }
+};
+
+
+class SLong: public Type
+{
+public:
+ SLong(uint length) :Type(&type_handler_slong, length, false) { }
+ SLong() :SLong(MY_INT32_NUM_DECIMAL_DIGITS) { }
+};
+
+
+class SShort: public Type
+{
+public:
+ SShort(uint length) :Type(&type_handler_sshort, length, false) { }
+};
+
+
+class STiny: public Type
+{
+public:
+ STiny(uint length) :Type(&type_handler_stiny, length, false) { }
+};
+
+
+class Double: public Type
+{
+public:
+ Double(uint length) :Type(&type_handler_double, length, false) { }
+};
+
+
+class Float: public Type
+{
+public:
+ Float(uint length) :Type(&type_handler_float, length, false) { }
+};
+
+
+
+class Column: public ST_FIELD_INFO
+{
+public:
+ Column(const char *name, const Type &type, enum_nullability nullability,
+ const char *old_name,
+ enum_show_open_table open_method= SKIP_OPEN_TABLE)
+ :ST_FIELD_INFO(name, type, nullability, old_name, open_method)
+ { }
+ Column(const char *name, const Type &type, enum_nullability nullability,
+ enum_show_open_table open_method= SKIP_OPEN_TABLE)
+ :Column(name, type, nullability, NullS, open_method)
+ { }
+};
+
+
+// End marker
+class CEnd: public Column
+{
+public:
+ CEnd() :Column(NullS, Varchar(0), NOT_NULL, NullS, SKIP_OPEN_TABLE) { }
+};
+
+
+} // namespace Show
+
+
+struct TABLE_LIST;
+typedef class Item COND;
+
+typedef struct st_schema_table
+{
+ const char *table_name;
+ ST_FIELD_INFO *fields_info;
+ /* for FLUSH table_name */
+ int (*reset_table) ();
+ /* Fill table with data */
+ int (*fill_table) (THD *thd, TABLE_LIST *tables, COND *cond);
+ /* Handle fileds for old SHOW */
+ int (*old_format) (THD *thd, struct st_schema_table *schema_table);
+ int (*process_table) (THD *thd, TABLE_LIST *tables, TABLE *table,
+ bool res, const LEX_CSTRING *db_name,
+ const LEX_CSTRING *table_name);
+ int idx_field1, idx_field2;
+ bool hidden;
+ uint i_s_requested_object; /* the object we need to open(TABLE | VIEW) */
+} ST_SCHEMA_TABLE;
+
+
+#endif // SQL_I_S_INCLUDED
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 7528239ca7b..211ab7e4f4f 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -3658,10 +3658,8 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
if (!res && fields->elements)
{
- bool saved_abort_on_warning= thd->abort_on_warning;
- thd->abort_on_warning= !info.ignore && thd->is_strict_mode();
+ Abort_on_warning_instant_set aws(thd, !info.ignore && thd->is_strict_mode());
res= check_that_all_fields_are_given_values(thd, table_list->table, table_list);
- thd->abort_on_warning= saved_abort_on_warning;
}
if (info.handle_duplicates == DUP_UPDATE && !res)
@@ -4133,11 +4131,11 @@ void select_insert::abort_result_set() {
CREATE TABLE (SELECT) ...
***************************************************************************/
-Field *Item::create_field_for_create_select(TABLE *table)
+Field *Item::create_field_for_create_select(MEM_ROOT *root, TABLE *table)
{
static Tmp_field_param param(false, false, false, false);
Tmp_field_src src;
- return create_tmp_field_ex(table, &src, &param);
+ return create_tmp_field_ex(root, table, &src, &param);
}
@@ -4208,7 +4206,8 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items,
while ((item=it++))
{
- Field *tmp_field= item->create_field_for_create_select(&tmp_table);
+ Field *tmp_field= item->create_field_for_create_select(thd->mem_root,
+ &tmp_table);
if (!tmp_field)
DBUG_RETURN(NULL);
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 6f9f2200a00..1245242d7aa 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -349,7 +349,7 @@ size_t Lex_input_stream::get_body_utf8_maximum_length(THD *thd)
"2" should be a reasonable multiplier that safely covers escaping needs.
*/
return (m_buf_length / thd->variables.character_set_client->mbminlen) *
- my_charset_utf8_bin.mbmaxlen * 2/*for escaping*/;
+ my_charset_utf8mb3_bin.mbmaxlen * 2/*for escaping*/;
}
@@ -454,14 +454,14 @@ extern "C" {
@param end - the end of the destination string
@returns - a code according to the wc_mb() convension.
*/
-int my_wc_mb_utf8_with_escape(CHARSET_INFO *cs, my_wc_t escape, my_wc_t wc,
- uchar *str, uchar *end)
+int my_wc_mb_utf8mb3_with_escape(CHARSET_INFO *cs, my_wc_t escape, my_wc_t wc,
+ uchar *str, uchar *end)
{
DBUG_ASSERT(escape > 0);
if (str + 1 >= end)
return MY_CS_TOOSMALL2; // Not enough space, need at least two bytes.
*str= (uchar)escape;
- int cnvres= my_charset_utf8_handler.wc_mb(cs, wc, str + 1, end);
+ int cnvres= my_charset_utf8mb3_handler.wc_mb(cs, wc, str + 1, end);
if (cnvres > 0)
return cnvres + 1; // The character was normally put
if (cnvres == MY_CS_ILUNI)
@@ -483,12 +483,12 @@ int my_wc_mb_utf8_with_escape(CHARSET_INFO *cs, my_wc_t escape, my_wc_t wc,
@param end - the end of the destination string
@returns - a code according to the wc_mb() conversion.
*/
-int my_wc_mb_utf8_opt_escape(CHARSET_INFO *cs,
- my_wc_t wc, my_wc_t escape, my_wc_t ewc,
- uchar *str, uchar *end)
+int my_wc_mb_utf8mb3_opt_escape(CHARSET_INFO *cs,
+ my_wc_t wc, my_wc_t escape, my_wc_t ewc,
+ uchar *str, uchar *end)
{
- return escape ? my_wc_mb_utf8_with_escape(cs, escape, ewc, str, end) :
- my_charset_utf8_handler.wc_mb(cs, wc, str, end);
+ return escape ? my_wc_mb_utf8mb3_with_escape(cs, escape, ewc, str, end) :
+ my_charset_utf8mb3_handler.wc_mb(cs, wc, str, end);
}
/**
@@ -507,54 +507,55 @@ int my_wc_mb_utf8_opt_escape(CHARSET_INFO *cs,
@param escape - the escape character (backslash, or 0)
@returns - a code according to the wc_mb() convension.
*/
-int my_wc_mb_utf8_escape(CHARSET_INFO *cs, my_wc_t wc, uchar *str, uchar *end,
- my_wc_t sep, my_wc_t escape)
+int my_wc_mb_utf8mb3_escape(CHARSET_INFO *cs, my_wc_t wc,
+ uchar *str, uchar *end,
+ my_wc_t sep, my_wc_t escape)
{
DBUG_ASSERT(escape == 0 || escape == '\\');
DBUG_ASSERT(sep == '"' || sep == '\'');
switch (wc) {
- case 0: return my_wc_mb_utf8_opt_escape(cs, wc, escape, '0', str, end);
- case '\t': return my_wc_mb_utf8_opt_escape(cs, wc, escape, 't', str, end);
- case '\r': return my_wc_mb_utf8_opt_escape(cs, wc, escape, 'r', str, end);
- case '\n': return my_wc_mb_utf8_opt_escape(cs, wc, escape, 'n', str, end);
- case '\032': return my_wc_mb_utf8_opt_escape(cs, wc, escape, 'Z', str, end);
+ case 0: return my_wc_mb_utf8mb3_opt_escape(cs, wc, escape, '0', str, end);
+ case '\t': return my_wc_mb_utf8mb3_opt_escape(cs, wc, escape, 't', str, end);
+ case '\r': return my_wc_mb_utf8mb3_opt_escape(cs, wc, escape, 'r', str, end);
+ case '\n': return my_wc_mb_utf8mb3_opt_escape(cs, wc, escape, 'n', str, end);
+ case '\032': return my_wc_mb_utf8mb3_opt_escape(cs, wc, escape, 'Z', str, end);
case '\'':
case '\"':
if (wc == sep)
- return my_wc_mb_utf8_with_escape(cs, wc, wc, str, end);
+ return my_wc_mb_utf8mb3_with_escape(cs, wc, wc, str, end);
}
- return my_charset_utf8_handler.wc_mb(cs, wc, str, end); // No escaping needed
+ return my_charset_utf8mb3_handler.wc_mb(cs, wc, str, end); // No escaping needed
}
/** wc_mb() compatible routines for all sql_mode and delimiter combinations */
-int my_wc_mb_utf8_escape_single_quote_and_backslash(CHARSET_INFO *cs,
+int my_wc_mb_utf8mb3_escape_single_quote_and_backslash(CHARSET_INFO *cs,
my_wc_t wc,
uchar *str, uchar *end)
{
- return my_wc_mb_utf8_escape(cs, wc, str, end, '\'', '\\');
+ return my_wc_mb_utf8mb3_escape(cs, wc, str, end, '\'', '\\');
}
-int my_wc_mb_utf8_escape_double_quote_and_backslash(CHARSET_INFO *cs,
+int my_wc_mb_utf8mb3_escape_double_quote_and_backslash(CHARSET_INFO *cs,
my_wc_t wc,
uchar *str, uchar *end)
{
- return my_wc_mb_utf8_escape(cs, wc, str, end, '"', '\\');
+ return my_wc_mb_utf8mb3_escape(cs, wc, str, end, '"', '\\');
}
-int my_wc_mb_utf8_escape_single_quote(CHARSET_INFO *cs, my_wc_t wc,
+int my_wc_mb_utf8mb3_escape_single_quote(CHARSET_INFO *cs, my_wc_t wc,
uchar *str, uchar *end)
{
- return my_wc_mb_utf8_escape(cs, wc, str, end, '\'', 0);
+ return my_wc_mb_utf8mb3_escape(cs, wc, str, end, '\'', 0);
}
-int my_wc_mb_utf8_escape_double_quote(CHARSET_INFO *cs, my_wc_t wc,
+int my_wc_mb_utf8mb3_escape_double_quote(CHARSET_INFO *cs, my_wc_t wc,
uchar *str, uchar *end)
{
- return my_wc_mb_utf8_escape(cs, wc, str, end, '"', 0);
+ return my_wc_mb_utf8mb3_escape(cs, wc, str, end, '"', 0);
}
}; // End of extern "C"
@@ -568,10 +569,10 @@ my_charset_conv_wc_mb
Lex_input_stream::get_escape_func(THD *thd, my_wc_t sep) const
{
return thd->backslash_escapes() ?
- (sep == '"' ? my_wc_mb_utf8_escape_double_quote_and_backslash:
- my_wc_mb_utf8_escape_single_quote_and_backslash) :
- (sep == '"' ? my_wc_mb_utf8_escape_double_quote:
- my_wc_mb_utf8_escape_single_quote);
+ (sep == '"' ? my_wc_mb_utf8mb3_escape_double_quote_and_backslash:
+ my_wc_mb_utf8mb3_escape_single_quote_and_backslash) :
+ (sep == '"' ? my_wc_mb_utf8mb3_escape_double_quote:
+ my_wc_mb_utf8mb3_escape_single_quote);
}
@@ -611,7 +612,7 @@ void Lex_input_stream::body_utf8_append_escape(THD *thd,
DBUG_ASSERT(m_body_utf8 + get_body_utf8_maximum_length(thd) >=
m_body_utf8_ptr + txt->length * 2);
uint32 cnv_length= my_convert_using_func(m_body_utf8_ptr, txt->length * 2,
- &my_charset_utf8_general_ci,
+ &my_charset_utf8mb3_general_ci,
get_escape_func(thd, sep),
txt->str, txt->length,
cs, cs->cset->mb_wc,
@@ -944,6 +945,9 @@ bool is_native_function(THD *thd, const LEX_CSTRING *name)
if (is_lex_native_function(name))
return true;
+ if (Type_handler::handler_by_name(thd, *name))
+ return true;
+
return false;
}
@@ -2024,7 +2028,7 @@ int Lex_input_stream::lex_one_token(YYSTYPE *yylval, THD *thd)
next_state= MY_LEX_HOSTNAME;
break;
}
- yylval->lex_str.str= (char*) get_ptr();
+ yylval->lex_str.str= (char*) get_ptr() - 1;
yylval->lex_str.length= 1;
return((int) '@');
case MY_LEX_HOSTNAME: // end '@' of user@hostname
@@ -2350,6 +2354,7 @@ void st_select_lex_unit::init_query()
offset_limit_cnt= 0;
union_distinct= 0;
prepared= optimized= optimized_2= executed= 0;
+ bag_set_op_optimized= 0;
optimize_started= 0;
item= 0;
union_result= 0;
@@ -2365,8 +2370,8 @@ void st_select_lex_unit::init_query()
with_clause= 0;
with_element= 0;
columns_are_renamed= false;
- intersect_mark= NULL;
with_wrapped_tvc= false;
+ have_except_all_or_intersect_all= false;
}
void st_select_lex::init_query()
@@ -2464,6 +2469,7 @@ void st_select_lex::init_select()
curr_tvc_name= 0;
in_tvc= false;
versioned_tables= 0;
+ nest_flags= 0;
}
/*
@@ -2982,7 +2988,6 @@ bool st_select_lex::setup_ref_array(THD *thd, uint order_group_num)
void st_select_lex_unit::print(String *str, enum_query_type query_type)
{
- bool union_all= !union_distinct;
if (with_clause)
with_clause->print(str, query_type);
for (SELECT_LEX *sl= first_select(); sl; sl= sl->next_select())
@@ -2996,8 +3001,6 @@ void st_select_lex_unit::print(String *str, enum_query_type query_type)
/* fall through */
case UNION_TYPE:
str->append(STRING_WITH_LEN(" union "));
- if (union_all)
- str->append(STRING_WITH_LEN("all "));
break;
case INTERSECT_TYPE:
str->append(STRING_WITH_LEN(" intersect "));
@@ -3006,8 +3009,8 @@ void st_select_lex_unit::print(String *str, enum_query_type query_type)
str->append(STRING_WITH_LEN(" except "));
break;
}
- if (sl == union_distinct)
- union_all= TRUE;
+ if (!sl->distinct)
+ str->append(STRING_WITH_LEN("all "));
}
if (sl->braces)
str->append('(');
@@ -3520,6 +3523,8 @@ bool st_select_lex_unit::union_needs_tmp_table()
with_wrapped_tvc= true;
break;
}
+ if (sl != first_select() && sl->linkage != UNION_TYPE)
+ return true;
}
}
if (with_wrapped_tvc)
@@ -5390,7 +5395,7 @@ LEX::wrap_unit_into_derived(SELECT_LEX_UNIT *unit)
Name_resolution_context *context= &wrapping_sel->context;
context->init();
wrapping_sel->automatic_brackets= FALSE;
-
+ wrapping_sel->mark_as_unit_nest();
wrapping_sel->register_unit(unit, context);
/* stuff dummy SELECT * FROM (...) */
@@ -5400,8 +5405,7 @@ LEX::wrap_unit_into_derived(SELECT_LEX_UNIT *unit)
/* add SELECT list*/
{
- Item *item= new (thd->mem_root)
- Item_field(thd, context, NULL, NULL, &star_clex_str);
+ Item *item= new (thd->mem_root) Item_field(thd, context, star_clex_str);
if (item == NULL)
goto err;
if (add_item_to_list(thd, item))
@@ -5463,8 +5467,7 @@ SELECT_LEX *LEX::wrap_select_chain_into_derived(SELECT_LEX *sel)
/* add SELECT list*/
{
- Item *item= new (thd->mem_root)
- Item_field(thd, context, NULL, NULL, &star_clex_str);
+ Item *item= new (thd->mem_root) Item_field(thd, context, star_clex_str);
if (item == NULL)
goto err;
if (add_item_to_list(thd, item))
@@ -5597,6 +5600,7 @@ void LEX::set_stmt_init()
mysql_init_select(this);
option_type= OPT_SESSION;
autocommit= 0;
+ var_list.empty();
};
@@ -5976,9 +5980,9 @@ sp_variable *LEX::sp_add_for_loop_variable(THD *thd, const LEX_CSTRING *name,
sp_variable *spvar= spcont->add_variable(thd, name);
spcont->declare_var_boundary(1);
spvar->field_def.field_name= spvar->name;
- spvar->field_def.set_handler(&type_handler_longlong);
- type_handler_longlong.Column_definition_prepare_stage2(&spvar->field_def,
- NULL, HA_CAN_GEOMETRY);
+ spvar->field_def.set_handler(&type_handler_slonglong);
+ type_handler_slonglong.Column_definition_prepare_stage2(&spvar->field_def,
+ NULL, HA_CAN_GEOMETRY);
if (!value && unlikely(!(value= new (thd->mem_root) Item_null(thd))))
return NULL;
@@ -6021,7 +6025,7 @@ bool LEX::sp_for_loop_implicit_cursor_statement(THD *thd,
SELECT rec.a, rec.b;
END FOR;
*/
- if (!(item= new (thd->mem_root) Item_field(thd, NULL, NullS, NullS, &name)))
+ if (!(item= new (thd->mem_root) Item_field(thd, NULL, name)))
return true;
bounds->m_index->set_item_and_free_list(item, NULL);
if (thd->lex->sphead->restore_lex(thd))
@@ -6174,7 +6178,7 @@ bool LEX::sp_for_loop_cursor_declarations(THD *thd,
name= item_splocal->m_name;
else if ((item_field= item->type() == Item::FIELD_ITEM ?
static_cast<Item_field *>(item) : NULL) &&
- item_field->table_name == NULL)
+ item_field->table_name.str == NULL)
name= item_field->field_name;
else if (item->type() == Item::FUNC_ITEM &&
static_cast<Item_func*>(item)->functype() == Item_func::FUNC_SP &&
@@ -7030,7 +7034,7 @@ Item *LEX::create_and_link_Item_trigger_field(THD *thd,
new_row ?
Item_trigger_field::NEW_ROW:
Item_trigger_field::OLD_ROW,
- name, SELECT_ACL, tmp_read_only);
+ *name, SELECT_ACL, tmp_read_only);
/*
Let us add this item to list of all Item_trigger_field objects
in trigger.
@@ -7179,7 +7183,7 @@ Item *LEX::create_item_for_loop_bound(THD *thd,
Pass NULL as the name resolution context.
This is OK, fix_fields() won't be called for this Item_field.
*/
- return new (thd->mem_root) Item_field(thd, NULL, a->str, b->str, c);
+ return new (thd->mem_root) Item_field(thd, NULL, *a, *b, *c);
}
@@ -7217,7 +7221,7 @@ Item *LEX::create_item_ident_nospvar(THD *thd,
if (current_select->parsing_place == FOR_LOOP_BOUND)
return create_item_for_loop_bound(thd, &null_clex_str, a, b);
- return create_item_ident_field(thd, NullS, a->str, b);
+ return create_item_ident_field(thd, Lex_ident_sys(), *a, *b);
}
@@ -7409,9 +7413,8 @@ Item *LEX::create_item_ident(THD *thd,
const Lex_ident_sys_st *b,
const Lex_ident_sys_st *c)
{
- const char *schema= (thd->client_capabilities & CLIENT_NO_SCHEMA ?
- NullS : a->str);
-
+ Lex_ident_sys_st schema= thd->client_capabilities & CLIENT_NO_SCHEMA ?
+ Lex_ident_sys() : *a;
if ((thd->variables.sql_mode & MODE_ORACLE) && c->length == 7)
{
if (!my_strnncoll(system_charset_info,
@@ -7433,7 +7436,7 @@ Item *LEX::create_item_ident(THD *thd,
if (current_select->parsing_place == FOR_LOOP_BOUND)
return create_item_for_loop_bound(thd, &null_clex_str, b, c);
- return create_item_ident_field(thd, schema, b->str, c);
+ return create_item_ident_field(thd, schema, *b, *c);
}
@@ -7519,11 +7522,12 @@ bool LEX::set_user_variable(THD *thd, const LEX_CSTRING *name, Item *val)
}
-Item *LEX::create_item_ident_field(THD *thd, const char *db,
- const char *table,
- const Lex_ident_sys_st *name)
+Item *LEX::create_item_ident_field(THD *thd,
+ const Lex_ident_sys_st &db,
+ const Lex_ident_sys_st &table,
+ const Lex_ident_sys_st &name)
{
- if (check_expr_allows_fields_or_error(thd, name->str))
+ if (check_expr_allows_fields_or_error(thd, name.str))
return NULL;
if (current_select->parsing_place != IN_HAVING ||
@@ -7592,7 +7596,7 @@ Item *LEX::create_item_ident_sp(THD *thd, Lex_ident_sys_st *name,
-bool LEX::set_variable(const LEX_CSTRING *name, Item *item)
+bool LEX::set_variable(const Lex_ident_sys_st *name, Item *item)
{
sp_pcontext *ctx;
const Sp_rcontext_handler *rh;
@@ -7606,8 +7610,8 @@ bool LEX::set_variable(const LEX_CSTRING *name, Item *item)
Generate instructions for:
SET x.y= expr;
*/
-bool LEX::set_variable(const LEX_CSTRING *name1,
- const LEX_CSTRING *name2,
+bool LEX::set_variable(const Lex_ident_sys_st *name1,
+ const Lex_ident_sys_st *name2,
Item *item)
{
const Sp_rcontext_handler *rh;
@@ -7637,10 +7641,10 @@ bool LEX::set_variable(const LEX_CSTRING *name1,
bool LEX::set_default_system_variable(enum_var_type var_type,
- const LEX_CSTRING *name,
+ const Lex_ident_sys_st *name,
Item *val)
{
- static LEX_CSTRING default_base_name= {STRING_WITH_LEN("default")};
+ static Lex_ident_sys default_base_name= {STRING_WITH_LEN("default")};
sys_var *var= find_sys_var(thd, name->str, name->length);
if (!var)
return true;
@@ -7654,18 +7658,19 @@ bool LEX::set_default_system_variable(enum_var_type var_type,
bool LEX::set_system_variable(enum_var_type var_type,
- const LEX_CSTRING *name,
+ const Lex_ident_sys_st *name,
Item *val)
{
sys_var *var= find_sys_var(thd, name->str, name->length);
DBUG_ASSERT(thd->is_error() || var != NULL);
- return likely(var) ? set_system_variable(var_type, var, &null_clex_str, val) : true;
+ static Lex_ident_sys null_str;
+ return likely(var) ? set_system_variable(var_type, var, &null_str, val) : true;
}
bool LEX::set_system_variable(THD *thd, enum_var_type var_type,
- const LEX_CSTRING *name1,
- const LEX_CSTRING *name2,
+ const Lex_ident_sys_st *name1,
+ const Lex_ident_sys_st *name2,
Item *val)
{
sys_var *tmp;
@@ -8347,15 +8352,15 @@ bool LEX::call_statement_start(THD *thd, sp_name *name)
}
-bool LEX::call_statement_start(THD *thd, const LEX_CSTRING *name)
+bool LEX::call_statement_start(THD *thd, const Lex_ident_sys_st *name)
{
sp_name *spname= make_sp_name(thd, name);
return unlikely(!spname) || call_statement_start(thd, spname);
}
-bool LEX::call_statement_start(THD *thd, const LEX_CSTRING *name1,
- const LEX_CSTRING *name2)
+bool LEX::call_statement_start(THD *thd, const Lex_ident_sys_st *name1,
+ const Lex_ident_sys_st *name2)
{
sp_name *spname= make_sp_name(thd, name1, name2);
return unlikely(!spname) || call_statement_start(thd, spname);
@@ -8504,9 +8509,9 @@ bool SELECT_LEX::vers_push_field(THD *thd, TABLE_LIST *table,
{
DBUG_ASSERT(field_name.str);
Item_field *fld= new (thd->mem_root) Item_field(thd, &context,
- table->db.str,
- table->alias.str,
- &field_name);
+ table->db,
+ table->alias,
+ field_name);
if (unlikely(!fld) || unlikely(item_list.push_back(fld)))
return true;
@@ -8619,13 +8624,27 @@ Item *LEX::make_item_func_call_generic(THD *thd, Lex_ident_cli_st *cdb,
}
+Item *LEX::make_item_func_call_native_or_parse_error(THD *thd,
+ Lex_ident_cli_st &name,
+ List<Item> *args)
+{
+ Create_func *builder= find_native_function_builder(thd, &name);
+ DBUG_EXECUTE_IF("make_item_func_call_native_simulate_not_found",
+ builder= NULL;);
+ if (builder)
+ return builder->create_func(thd, &name, args);
+ thd->parse_error(ER_SYNTAX_ERROR, name.end());
+ return NULL;
+}
+
+
Item *LEX::create_item_qualified_asterisk(THD *thd,
const Lex_ident_sys_st *name)
{
Item *item;
if (!(item= new (thd->mem_root) Item_field(thd, current_context(),
- NullS, name->str,
- &star_clex_str)))
+ null_clex_str, *name,
+ star_clex_str)))
return NULL;
current_select->with_wild++;
return item;
@@ -8637,11 +8656,10 @@ Item *LEX::create_item_qualified_asterisk(THD *thd,
const Lex_ident_sys_st *b)
{
Item *item;
- const char* schema= thd->client_capabilities & CLIENT_NO_SCHEMA ?
- NullS : a->str;
+ Lex_ident_sys_st schema= thd->client_capabilities & CLIENT_NO_SCHEMA ?
+ Lex_ident_sys() : *a;
if (!(item= new (thd->mem_root) Item_field(thd, current_context(),
- schema, b->str,
- &star_clex_str)))
+ schema, *b, star_clex_str)))
return NULL;
current_select->with_wild++;
return item;
@@ -10385,3 +10403,58 @@ Spvar_definition *LEX::row_field_name(THD *thd, const Lex_ident_sys_st &name)
init_last_field(res, &name, thd->variables.collation_database);
return res;
}
+
+
+Item *
+Lex_cast_type_st::create_typecast_item_or_error(THD *thd, Item *item,
+ CHARSET_INFO *cs) const
+{
+ Item *tmp= create_typecast_item(thd, item, cs);
+ if (!tmp)
+ {
+ Name name= m_type_handler->name();
+ char buf[128];
+ size_t length= my_snprintf(buf, sizeof(buf), "CAST(expr AS %.*s)",
+ (int) name.length(), name.ptr());
+ my_error(ER_UNKNOWN_OPERATOR, MYF(0),
+ ErrConvString(buf, length, system_charset_info).ptr());
+ }
+ return tmp;
+}
+
+
+void Lex_field_type_st::set_handler_length_flags(const Type_handler *handler,
+ const char *length,
+ uint32 flags)
+{
+ DBUG_ASSERT(!handler->is_unsigned());
+ if (flags & UNSIGNED_FLAG)
+ handler= handler->type_handler_unsigned();
+ set(handler, length, NULL);
+}
+
+
+bool LEX::set_field_type_udt(Lex_field_type_st *type,
+ const LEX_CSTRING &name,
+ const Lex_length_and_dec_st &attr)
+{
+ const Type_handler *h;
+ if (!(h= Type_handler::handler_by_name_or_error(thd, name)))
+ return true;
+ type->set(h, attr);
+ charset= &my_charset_bin;
+ return false;
+}
+
+
+bool LEX::set_cast_type_udt(Lex_cast_type_st *type,
+ const LEX_CSTRING &name)
+{
+ const Type_handler *h;
+ if (!(h= Type_handler::handler_by_name_or_error(thd, name)))
+ return true;
+ type->set(h);
+ charset= NULL;
+ return false;
+}
+
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 8d09407606a..98bec985a64 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -207,6 +207,14 @@ enum sub_select_type
GLOBAL_OPTIONS_TYPE, DERIVED_TABLE_TYPE, OLAP_TYPE
};
+enum set_op_type
+{
+ UNSPECIFIED,
+ UNION_DISTINCT, UNION_ALL,
+ EXCEPT_DISTINCT, EXCEPT_ALL,
+ INTERSECT_DISTINCT, INTERSECT_ALL
+};
+
inline int cmp_unit_op(enum sub_select_type op1, enum sub_select_type op2)
{
DBUG_ASSERT(op1 >= UNION_TYPE && op1 <= EXCEPT_TYPE);
@@ -841,8 +849,8 @@ public:
// Ensures that at least all members used during cleanup() are initialized.
st_select_lex_unit()
: union_result(NULL), table(NULL), result(NULL),
- cleaned(false),
- fake_select_lex(NULL)
+ cleaned(false), bag_set_op_optimized(false),
+ have_except_all_or_intersect_all(false), fake_select_lex(NULL)
{
}
@@ -853,9 +861,11 @@ public:
optimized, // optimize phase already performed for UNION (unit)
optimized_2,
executed, // already executed
- cleaned;
+ cleaned,
+ bag_set_op_optimized;
bool optimize_started;
+ bool have_except_all_or_intersect_all;
// list of fields which points to temporary table for union
List<Item> item_list;
@@ -868,11 +878,6 @@ public:
*/
List<Item> types;
/**
- There is INTERSECT and it is item used in creating temporary
- table for it
- */
- Item_int *intersect_mark;
- /**
TRUE if the unit contained TVC at the top level that has been wrapped
into SELECT:
VALUES (v1) ... (vn) => SELECT * FROM (VALUES (v1) ... (vn)) as tvc
@@ -928,8 +933,9 @@ public:
fake_select_lex is used.
*/
st_select_lex *saved_fake_select_lex;
-
- st_select_lex *union_distinct; /* pointer to the last UNION DISTINCT */
+
+ /* pointer to the last node before last subsequence of UNION ALL */
+ st_select_lex *union_distinct;
bool describe; /* union exec() called for EXPLAIN */
Procedure *last_procedure; /* Pointer to procedure, if such exists */
@@ -955,6 +961,7 @@ public:
bool prepare(TABLE_LIST *derived_arg, select_result *sel_result,
ulong additional_options);
bool optimize();
+ void optimize_bag_operation(bool is_outer_distinct);
bool exec();
bool exec_recursive();
bool cleanup();
@@ -1025,7 +1032,7 @@ Field_pair *find_matching_field_pair(Item *item, List<Field_pair> pair_list);
#define TOUCHED_SEL_COND 1/* WHERE/HAVING/ON should be reinited before use */
#define TOUCHED_SEL_DERIVED (1<<1)/* derived should be reinited before use */
-
+#define UNIT_NEST_FL 1
/*
SELECT_LEX - store information of parsed SELECT statment
*/
@@ -1048,7 +1055,7 @@ public:
select1->first_nested points to select1.
*/
st_select_lex *first_nested;
-
+ uint8 nest_flags;
Name_resolution_context context;
LEX_CSTRING db;
Item *where, *having; /* WHERE & HAVING clauses */
@@ -1524,6 +1531,13 @@ public:
select_handler *find_select_handler(THD *thd);
+ bool is_set_op()
+ {
+ return linkage == UNION_TYPE ||
+ linkage == EXCEPT_TYPE ||
+ linkage == INTERSECT_TYPE;
+ }
+
private:
bool m_non_agg_field_used;
bool m_agg_func_used;
@@ -1570,6 +1584,8 @@ public:
void add_statistics(SELECT_LEX_UNIT *unit);
bool make_unique_derived_name(THD *thd, LEX_CSTRING *alias);
void lex_start(LEX *plex);
+ bool is_unit_nest() { return (nest_flags & UNIT_NEST_FL); }
+ void mark_as_unit_nest() { nest_flags= UNIT_NEST_FL; }
};
typedef class st_select_lex SELECT_LEX;
@@ -3728,15 +3744,15 @@ public:
bool set_trigger_field(const LEX_CSTRING *name1, const LEX_CSTRING *name2,
Item *val);
bool set_system_variable(enum_var_type var_type, sys_var *var,
- const LEX_CSTRING *base_name, Item *val);
- bool set_system_variable(enum_var_type var_type, const LEX_CSTRING *name,
- Item *val);
+ const Lex_ident_sys_st *base_name, Item *val);
+ bool set_system_variable(enum_var_type var_type,
+ const Lex_ident_sys_st *name, Item *val);
bool set_system_variable(THD *thd, enum_var_type var_type,
- const LEX_CSTRING *name1,
- const LEX_CSTRING *name2,
+ const Lex_ident_sys_st *name1,
+ const Lex_ident_sys_st *name2,
Item *val);
bool set_default_system_variable(enum_var_type var_type,
- const LEX_CSTRING *name,
+ const Lex_ident_sys_st *name,
Item *val);
bool set_user_variable(THD *thd, const LEX_CSTRING *name, Item *val);
void set_stmt_init();
@@ -3766,9 +3782,9 @@ public:
const char *body_start,
const char *body_end);
bool call_statement_start(THD *thd, sp_name *name);
- bool call_statement_start(THD *thd, const LEX_CSTRING *name);
- bool call_statement_start(THD *thd, const LEX_CSTRING *name1,
- const LEX_CSTRING *name2);
+ bool call_statement_start(THD *thd, const Lex_ident_sys_st *name);
+ bool call_statement_start(THD *thd, const Lex_ident_sys_st *name1,
+ const Lex_ident_sys_st *name2);
sp_variable *find_variable(const LEX_CSTRING *name,
sp_pcontext **ctx,
const Sp_rcontext_handler **rh) const;
@@ -3778,9 +3794,9 @@ public:
sp_pcontext *not_used_ctx;
return find_variable(name, &not_used_ctx, rh);
}
- bool set_variable(const LEX_CSTRING *name, Item *item);
- bool set_variable(const LEX_CSTRING *name1, const LEX_CSTRING *name2,
- Item *item);
+ bool set_variable(const Lex_ident_sys_st *name, Item *item);
+ bool set_variable(const Lex_ident_sys_st *name1,
+ const Lex_ident_sys_st *name2, Item *item);
void sp_variable_declarations_init(THD *thd, int nvars);
bool sp_variable_declarations_finalize(THD *thd, int nvars,
const Column_definition *cdef,
@@ -3845,11 +3861,13 @@ public:
return create_item_qualified_asterisk(thd, &a, &b);
}
- Item *create_item_ident_field(THD *thd, const char *db, const char *table,
- const Lex_ident_sys_st *name);
+ Item *create_item_ident_field(THD *thd,
+ const Lex_ident_sys_st &db,
+ const Lex_ident_sys_st &table,
+ const Lex_ident_sys_st &name);
Item *create_item_ident_nosp(THD *thd, Lex_ident_sys_st *name)
{
- return create_item_ident_field(thd, NullS, NullS, name);
+ return create_item_ident_field(thd, Lex_ident_sys(), Lex_ident_sys(), *name);
}
Item *create_item_ident_sp(THD *thd, Lex_ident_sys_st *name,
const char *start, const char *end);
@@ -3995,6 +4013,9 @@ public:
Item *make_item_func_substr(THD *thd, Item *a, Item *b);
Item *make_item_func_call_generic(THD *thd, Lex_ident_cli_st *db,
Lex_ident_cli_st *name, List<Item> *args);
+ Item *make_item_func_call_native_or_parse_error(THD *thd,
+ Lex_ident_cli_st &name,
+ List<Item> *args);
my_var *create_outvar(THD *thd, const LEX_CSTRING *name);
/*
@@ -4419,6 +4440,12 @@ public:
SELECT_LEX_UNIT *create_unit(SELECT_LEX*);
SELECT_LEX *wrap_unit_into_derived(SELECT_LEX_UNIT *unit);
SELECT_LEX *wrap_select_chain_into_derived(SELECT_LEX *sel);
+ void init_select()
+ {
+ current_select->init_select();
+ wild= 0;
+ exchange= 0;
+ }
bool main_select_push();
bool insert_select_hack(SELECT_LEX *sel);
SELECT_LEX *create_priority_nest(SELECT_LEX *first_in_nest);
@@ -4531,6 +4558,12 @@ public:
Item_result return_type,
const LEX_CSTRING &soname);
Spvar_definition *row_field_name(THD *thd, const Lex_ident_sys_st &name);
+
+ bool set_field_type_udt(Lex_field_type_st *type,
+ const LEX_CSTRING &name,
+ const Lex_length_and_dec_st &attr);
+ bool set_cast_type_udt(Lex_cast_type_st *type,
+ const LEX_CSTRING &name);
};
@@ -4739,6 +4772,22 @@ public:
};
+class sp_lex_set_var: public sp_lex_local
+{
+public:
+ sp_lex_set_var(THD *thd, const LEX *oldlex)
+ :sp_lex_local(thd, oldlex)
+ {
+ // Set new LEX as if we at start of set rule
+ init_select();
+ sql_command= SQLCOM_SET_OPTION;
+ var_list.empty();
+ autocommit= 0;
+ option_type= oldlex->option_type; // Inherit from the outer lex
+ }
+};
+
+
/**
An assignment specific LEX, which additionally has an Item (an expression)
and an associated with the Item free_list, which is usually freed
@@ -4818,8 +4867,9 @@ Virtual_column_info *add_virtual_expression(THD *thd, Item *expr);
Item* handle_sql2003_note184_exception(THD *thd, Item* left, bool equal,
Item *expr);
-void sp_create_assignment_lex(THD *thd, bool no_lookahead);
-bool sp_create_assignment_instr(THD *thd, bool no_lookahead);
+bool sp_create_assignment_lex(THD *thd, const char *pos);
+bool sp_create_assignment_instr(THD *thd, bool no_lookahead,
+ bool need_set_keyword= true);
void mark_or_conds_to_avoid_pushdown(Item *cond);
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index c0b78ead6d6..45b539c97d9 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -133,6 +133,10 @@ 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 check_rename_table(THD *, TABLE_LIST *, TABLE_LIST *);
+static bool generate_incident_event(THD *thd);
+static int show_create_db(THD *thd, LEX *lex);
+static bool alter_routine(THD *thd, LEX *lex);
+static bool drop_routine(THD *thd, LEX *lex);
const char *any_db="*any*"; // Special symbol for check_access
@@ -2868,7 +2872,8 @@ bool sp_process_definer(THD *thd)
@return FALSE in case of success, TRUE in case of error.
*/
-static bool lock_tables_open_and_lock_tables(THD *thd, TABLE_LIST *tables)
+static bool __attribute__ ((noinline))
+lock_tables_open_and_lock_tables(THD *thd, TABLE_LIST *tables)
{
Lock_tables_prelocking_strategy lock_tables_prelocking_strategy;
MDL_deadlock_and_lock_abort_error_handler deadlock_handler;
@@ -3029,7 +3034,8 @@ static bool do_execute_sp(THD *thd, sp_head *sp)
}
-static int mysql_create_routine(THD *thd, LEX *lex)
+static int __attribute__ ((noinline))
+mysql_create_routine(THD *thd, LEX *lex)
{
DBUG_ASSERT(lex->sphead != 0);
DBUG_ASSERT(lex->sphead->m_db.str); /* Must be initialized in the parser */
@@ -4091,31 +4097,7 @@ mysql_execute_command(THD *thd)
mysql_mutex_unlock(&LOCK_active_mi);
break;
}
- case SQLCOM_SHOW_SLAVE_STAT:
- {
- /* Accept one of two privileges */
- if (check_global_access(thd, SUPER_ACL | REPL_CLIENT_ACL))
- goto error;
- if (lex->verbose)
- {
- mysql_mutex_lock(&LOCK_active_mi);
- res= show_all_master_info(thd);
- mysql_mutex_unlock(&LOCK_active_mi);
- }
- else
- {
- LEX_MASTER_INFO *lex_mi= &thd->lex->mi;
- Master_info *mi;
- if ((mi= get_master_info(&lex_mi->connection_name,
- Sql_condition::WARN_LEVEL_ERROR)))
- {
- res= show_master_info(thd, mi, 0);
- mi->release();
- }
- }
- break;
- }
case SQLCOM_SHOW_MASTER_STAT:
{
/* Accept one of two privileges */
@@ -4463,40 +4445,8 @@ mysql_execute_command(THD *thd)
break;
}
case SQLCOM_REPLACE:
-#ifndef DBUG_OFF
- if (mysql_bin_log.is_open())
- {
- /*
- Generate an incident log event before writing the real event
- to the binary log. We put this event is before the statement
- since that makes it simpler to check that the statement was
- not executed on the slave (since incidents usually stop the
- slave).
-
- Observe that any row events that are generated will be
- generated before.
-
- This is only for testing purposes and will not be present in a
- release build.
- */
-
- Incident incident= INCIDENT_NONE;
- DBUG_PRINT("debug", ("Just before generate_incident()"));
- DBUG_EXECUTE_IF("incident_database_resync_on_replace",
- incident= INCIDENT_LOST_EVENTS;);
- if (incident)
- {
- Incident_log_event ev(thd, incident);
- (void) mysql_bin_log.write(&ev); /* error is ignored */
- if (mysql_bin_log.rotate_and_purge(true))
- {
- res= 1;
- break;
- }
- }
- DBUG_PRINT("debug", ("Just after generate_incident()"));
- }
-#endif
+ if ((res= generate_incident_event(thd)))
+ break;
/* fall through */
case SQLCOM_INSERT:
{
@@ -4864,7 +4814,7 @@ mysql_execute_command(THD *thd)
*/
if(!res && (lex->create_info.options & HA_LEX_CREATE_TMP_TABLE))
{
- SESSION_TRACKER_CHANGED(thd, SESSION_STATE_CHANGE_TRACKER, NULL);
+ thd->session_tracker.state_change.mark_as_changed(thd);
}
break;
}
@@ -5110,26 +5060,9 @@ mysql_execute_command(THD *thd)
break;
}
case SQLCOM_SHOW_CREATE_DB:
- {
- char db_name_buff[NAME_LEN+1];
- LEX_CSTRING db_name;
- DBUG_EXECUTE_IF("4x_server_emul",
- my_error(ER_UNKNOWN_ERROR, MYF(0)); goto error;);
-
- db_name.str= db_name_buff;
- db_name.length= lex->name.length;
- strmov(db_name_buff, lex->name.str);
-
WSREP_SYNC_WAIT(thd, WSREP_SYNC_WAIT_BEFORE_SHOW);
-
- if (check_db_name((LEX_STRING*) &db_name))
- {
- my_error(ER_WRONG_DB_NAME, MYF(0), db_name.str);
- break;
- }
- res= mysqld_show_create_db(thd, &db_name, &lex->name, lex->create_info);
+ res= show_create_db(thd, lex);
break;
- }
case SQLCOM_CREATE_EVENT:
case SQLCOM_ALTER_EVENT:
#ifdef HAVE_EVENT_SCHEDULER
@@ -5709,153 +5642,16 @@ mysql_execute_command(THD *thd)
case SQLCOM_ALTER_PROCEDURE:
case SQLCOM_ALTER_FUNCTION:
- {
- int sp_result;
- const Sp_handler *sph= Sp_handler::handler(lex->sql_command);
- if (check_routine_access(thd, ALTER_PROC_ACL, &lex->spname->m_db,
- &lex->spname->m_name, sph, 0))
- goto error;
-
- /*
- Note that if you implement the capability of ALTER FUNCTION to
- alter the body of the function, this command should be made to
- follow the restrictions that log-bin-trust-function-creators=0
- already puts on CREATE FUNCTION.
- */
- /* Conditionally writes to binlog */
- sp_result= sph->sp_update_routine(thd, lex->spname, &lex->sp_chistics);
- switch (sp_result)
- {
- case SP_OK:
- my_ok(thd);
- break;
- case SP_KEY_NOT_FOUND:
- my_error(ER_SP_DOES_NOT_EXIST, MYF(0),
- sph->type_str(), ErrConvDQName(lex->spname).ptr());
- goto error;
- default:
- my_error(ER_SP_CANT_ALTER, MYF(0),
- sph->type_str(), ErrConvDQName(lex->spname).ptr());
- goto error;
- }
- break;
- }
+ if (alter_routine(thd, lex))
+ goto error;
+ break;
case SQLCOM_DROP_PROCEDURE:
case SQLCOM_DROP_FUNCTION:
case SQLCOM_DROP_PACKAGE:
case SQLCOM_DROP_PACKAGE_BODY:
- {
-#ifdef HAVE_DLOPEN
- if (lex->sql_command == SQLCOM_DROP_FUNCTION &&
- ! lex->spname->m_explicit_name)
- {
- /* DROP FUNCTION <non qualified name> */
- udf_func *udf = find_udf(lex->spname->m_name.str,
- lex->spname->m_name.length);
- if (udf)
- {
- if (check_access(thd, DELETE_ACL, "mysql", NULL, NULL, 1, 0))
- goto error;
-
- if (!(res = mysql_drop_function(thd, &lex->spname->m_name)))
- {
- my_ok(thd);
- break;
- }
- my_error(ER_SP_DROP_FAILED, MYF(0),
- "FUNCTION (UDF)", lex->spname->m_name.str);
- goto error;
- }
-
- if (lex->spname->m_db.str == NULL)
- {
- if (lex->if_exists())
- {
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
- 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);
- break;
- }
- my_error(ER_SP_DOES_NOT_EXIST, MYF(0),
- "FUNCTION (UDF)", lex->spname->m_name.str);
- goto error;
- }
- /* Fall thought to test for a stored function */
- }
-#endif
-
- int sp_result;
- const Sp_handler *sph= Sp_handler::handler(lex->sql_command);
-
- if (check_routine_access(thd, ALTER_PROC_ACL, &lex->spname->m_db, &lex->spname->m_name,
- Sp_handler::handler(lex->sql_command), 0))
- goto error;
- WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL);
-
- /* Conditionally writes to binlog */
- sp_result= sph->sp_drop_routine(thd, lex->spname);
-
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
- /*
- We're going to issue an implicit REVOKE statement so we close all
- open tables. We have to keep metadata locks as this ensures that
- this statement is atomic against concurent FLUSH TABLES WITH READ
- LOCK. Deadlocks which can arise due to fact that this implicit
- statement takes metadata locks should be detected by a deadlock
- detector in MDL subsystem and reported as errors.
-
- No need to commit/rollback statement transaction, it's not started.
-
- TODO: Long-term we should either ensure that implicit REVOKE statement
- is written into binary log as a separate statement or make both
- dropping of routine and implicit REVOKE parts of one fully atomic
- statement.
- */
- DBUG_ASSERT(thd->transaction.stmt.is_empty());
- close_thread_tables(thd);
-
- if (sp_result != SP_KEY_NOT_FOUND &&
- sp_automatic_privileges && !opt_noacl &&
- sp_revoke_privileges(thd, lex->spname->m_db.str, lex->spname->m_name.str,
- Sp_handler::handler(lex->sql_command)))
- {
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
- ER_PROC_AUTO_REVOKE_FAIL,
- ER_THD(thd, ER_PROC_AUTO_REVOKE_FAIL));
- /* If this happens, an error should have been reported. */
- goto error;
- }
-#endif
-
- res= sp_result;
- switch (sp_result) {
- case SP_OK:
- my_ok(thd);
- break;
- case SP_KEY_NOT_FOUND:
- if (lex->if_exists())
- {
- 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_THD(thd, ER_SP_DOES_NOT_EXIST),
- sph->type_str(),
- ErrConvDQName(lex->spname).ptr());
- if (!res)
- my_ok(thd);
- break;
- }
- my_error(ER_SP_DOES_NOT_EXIST, MYF(0),
- sph->type_str(), ErrConvDQName(lex->spname).ptr());
- goto error;
- default:
- my_error(ER_SP_DROP_FAILED, MYF(0),
- sph->type_str(), ErrConvDQName(lex->spname).ptr());
- goto error;
- }
- break;
- }
+ if (drop_routine(thd, lex))
+ goto error;
+ break;
case SQLCOM_SHOW_CREATE_PROC:
case SQLCOM_SHOW_CREATE_FUNC:
case SQLCOM_SHOW_CREATE_PACKAGE:
@@ -6086,12 +5882,15 @@ mysql_execute_command(THD *thd)
DBUG_ASSERT(first_table == all_tables && first_table != 0);
/* fall through */
case SQLCOM_ALTER_SEQUENCE:
+ case SQLCOM_SHOW_SLAVE_STAT:
case SQLCOM_SIGNAL:
case SQLCOM_RESIGNAL:
case SQLCOM_GET_DIAGNOSTICS:
case SQLCOM_CALL:
DBUG_ASSERT(lex->m_sql_cmd != NULL);
res= lex->m_sql_cmd->execute(thd);
+ DBUG_PRINT("result", ("res: %d killed: %d is_error: %d",
+ res, thd->killed, thd->is_error()));
break;
default:
@@ -6375,7 +6174,15 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables)
}
-static bool execute_show_status(THD *thd, TABLE_LIST *all_tables)
+/**
+ SHOW STATUS
+
+ Notes: This is noinline as we don't want to have system_status_var (> 3K)
+ to be on the stack of mysql_execute_command()
+*/
+
+static bool __attribute__ ((noinline))
+execute_show_status(THD *thd, TABLE_LIST *all_tables)
{
bool res;
system_status_var old_status_var= thd->status_var;
@@ -6460,8 +6267,9 @@ static TABLE *find_temporary_table_for_rename(THD *thd,
}
-static bool check_rename_table(THD *thd, TABLE_LIST *first_table,
- TABLE_LIST *all_tables)
+static bool __attribute__ ((noinline))
+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;
@@ -6500,6 +6308,227 @@ static bool check_rename_table(THD *thd, TABLE_LIST *first_table,
return 0;
}
+/*
+ Generate an incident log event before writing the real event
+ to the binary log. We put this event is before the statement
+ since that makes it simpler to check that the statement was
+ not executed on the slave (since incidents usually stop the
+ slave).
+
+ Observe that any row events that are generated will be generated before.
+
+ This is only for testing purposes and will not be present in a release build.
+*/
+
+#ifndef DBUG_OFF
+static bool __attribute__ ((noinline)) generate_incident_event(THD *thd)
+{
+ if (mysql_bin_log.is_open())
+ {
+
+ Incident incident= INCIDENT_NONE;
+ DBUG_PRINT("debug", ("Just before generate_incident()"));
+ DBUG_EXECUTE_IF("incident_database_resync_on_replace",
+ incident= INCIDENT_LOST_EVENTS;);
+ if (incident)
+ {
+ Incident_log_event ev(thd, incident);
+ (void) mysql_bin_log.write(&ev); /* error is ignored */
+ if (mysql_bin_log.rotate_and_purge(true))
+ return 1;
+ }
+ DBUG_PRINT("debug", ("Just after generate_incident()"));
+ }
+ return 0;
+}
+#else
+static bool generate_incident_event(THD *thd)
+{
+ return 0;
+}
+#endif
+
+
+static int __attribute__ ((noinline))
+show_create_db(THD *thd, LEX *lex)
+{
+ char db_name_buff[NAME_LEN+1];
+ LEX_CSTRING db_name;
+ DBUG_EXECUTE_IF("4x_server_emul",
+ my_error(ER_UNKNOWN_ERROR, MYF(0)); return 1;);
+
+ db_name.str= db_name_buff;
+ db_name.length= lex->name.length;
+ strmov(db_name_buff, lex->name.str);
+
+ if (check_db_name((LEX_STRING*) &db_name))
+ {
+ my_error(ER_WRONG_DB_NAME, MYF(0), db_name.str);
+ return 1;
+ }
+ return mysqld_show_create_db(thd, &db_name, &lex->name, lex->create_info);
+}
+
+
+/**
+ Called on SQLCOM_ALTER_PROCEDURE and SQLCOM_ALTER_FUNCTION
+*/
+
+static bool __attribute__ ((noinline))
+alter_routine(THD *thd, LEX *lex)
+{
+ int sp_result;
+ const Sp_handler *sph= Sp_handler::handler(lex->sql_command);
+ if (check_routine_access(thd, ALTER_PROC_ACL, &lex->spname->m_db,
+ &lex->spname->m_name, sph, 0))
+ return 1;
+ /*
+ Note that if you implement the capability of ALTER FUNCTION to
+ alter the body of the function, this command should be made to
+ follow the restrictions that log-bin-trust-function-creators=0
+ already puts on CREATE FUNCTION.
+ */
+ /* Conditionally writes to binlog */
+ sp_result= sph->sp_update_routine(thd, lex->spname, &lex->sp_chistics);
+ switch (sp_result) {
+ case SP_OK:
+ my_ok(thd);
+ return 0;
+ case SP_KEY_NOT_FOUND:
+ my_error(ER_SP_DOES_NOT_EXIST, MYF(0),
+ sph->type_str(), ErrConvDQName(lex->spname).ptr());
+ return 1;
+ default:
+ my_error(ER_SP_CANT_ALTER, MYF(0),
+ sph->type_str(), ErrConvDQName(lex->spname).ptr());
+ return 1;
+ }
+ return 0; /* purecov: deadcode */
+}
+
+
+static bool __attribute__ ((noinline))
+drop_routine(THD *thd, LEX *lex)
+{
+ int sp_result;
+#ifdef HAVE_DLOPEN
+ if (lex->sql_command == SQLCOM_DROP_FUNCTION &&
+ ! lex->spname->m_explicit_name)
+ {
+ /* DROP FUNCTION <non qualified name> */
+ udf_func *udf = find_udf(lex->spname->m_name.str,
+ lex->spname->m_name.length);
+ if (udf)
+ {
+ if (check_access(thd, DELETE_ACL, "mysql", NULL, NULL, 1, 0))
+ return 1;
+
+ if (!mysql_drop_function(thd, &lex->spname->m_name))
+ {
+ my_ok(thd);
+ return 0;
+ }
+ my_error(ER_SP_DROP_FAILED, MYF(0),
+ "FUNCTION (UDF)", lex->spname->m_name.str);
+ return 1;
+ }
+
+ if (lex->spname->m_db.str == NULL)
+ {
+ if (lex->if_exists())
+ {
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
+ ER_SP_DOES_NOT_EXIST,
+ ER_THD(thd, ER_SP_DOES_NOT_EXIST),
+ "FUNCTION (UDF)", lex->spname->m_name.str);
+ my_ok(thd);
+ return 0;
+ }
+ my_error(ER_SP_DOES_NOT_EXIST, MYF(0),
+ "FUNCTION (UDF)", lex->spname->m_name.str);
+ return 1;
+ }
+ /* Fall trough to test for a stored function */
+ }
+#endif /* HAVE_DLOPEN */
+
+ const Sp_handler *sph= Sp_handler::handler(lex->sql_command);
+
+ if (check_routine_access(thd, ALTER_PROC_ACL, &lex->spname->m_db,
+ &lex->spname->m_name,
+ Sp_handler::handler(lex->sql_command), 0))
+ return 1;
+
+ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL);
+
+ /* Conditionally writes to binlog */
+ sp_result= sph->sp_drop_routine(thd, lex->spname);
+
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ /*
+ We're going to issue an implicit REVOKE statement so we close all
+ open tables. We have to keep metadata locks as this ensures that
+ this statement is atomic against concurent FLUSH TABLES WITH READ
+ LOCK. Deadlocks which can arise due to fact that this implicit
+ statement takes metadata locks should be detected by a deadlock
+ detector in MDL subsystem and reported as errors.
+
+ No need to commit/rollback statement transaction, it's not started.
+
+ TODO: Long-term we should either ensure that implicit REVOKE statement
+ is written into binary log as a separate statement or make both
+ dropping of routine and implicit REVOKE parts of one fully atomic
+ statement.
+ */
+ DBUG_ASSERT(thd->transaction.stmt.is_empty());
+ close_thread_tables(thd);
+
+ if (sp_result != SP_KEY_NOT_FOUND &&
+ sp_automatic_privileges && !opt_noacl &&
+ sp_revoke_privileges(thd, lex->spname->m_db.str, lex->spname->m_name.str,
+ Sp_handler::handler(lex->sql_command)))
+ {
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_PROC_AUTO_REVOKE_FAIL,
+ ER_THD(thd, ER_PROC_AUTO_REVOKE_FAIL));
+ /* If this happens, an error should have been reported. */
+ return 1;
+ }
+#endif /* NO_EMBEDDED_ACCESS_CHECKS */
+
+ switch (sp_result) {
+ case SP_OK:
+ my_ok(thd);
+ return 0;
+ case SP_KEY_NOT_FOUND:
+ int res;
+ if (lex->if_exists())
+ {
+ 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_THD(thd, ER_SP_DOES_NOT_EXIST),
+ sph->type_str(),
+ ErrConvDQName(lex->spname).ptr());
+ if (res)
+ return 1;
+ my_ok(thd);
+ return 0;
+ }
+ my_error(ER_SP_DOES_NOT_EXIST, MYF(0),
+ sph->type_str(), ErrConvDQName(lex->spname).ptr());
+ return 1;
+ default:
+ my_error(ER_SP_DROP_FAILED, MYF(0),
+ sph->type_str(), ErrConvDQName(lex->spname).ptr());
+ return 1;
+ }
+
+#ifdef WITH_WSREP
+wsrep_error_label:
+ return 1;
+#endif
+}
/**
@brief Compare requested privileges with the privileges acquired from the
@@ -7498,10 +7527,7 @@ void THD::reset_for_next_command(bool do_clear_error)
void
mysql_init_select(LEX *lex)
{
- SELECT_LEX *select_lex= lex->current_select;
- select_lex->init_select();
- lex->wild= 0;
- lex->exchange= 0;
+ lex->init_select();
}
@@ -9223,8 +9249,8 @@ 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 void __attribute__ ((noinline))
+sql_kill_user(THD *thd, LEX_USER *user, killed_state state)
{
uint error;
ha_rows rows;
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index 65d79ac2d25..802e62585d4 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -2587,11 +2587,9 @@ char *generate_partition_syntax_for_frm(THD *thd, partition_info *part_info,
HA_CREATE_INFO *create_info,
Alter_info *alter_info)
{
- sql_mode_t old_mode= thd->variables.sql_mode;
- thd->variables.sql_mode &= ~MODE_ANSI_QUOTES;
+ Sql_mode_instant_remove sms(thd, MODE_ANSI_QUOTES);
char *res= generate_partition_syntax(thd, part_info, buf_length,
true, create_info, alter_info);
- thd->variables.sql_mode= old_mode;
return res;
}
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index 5fd3d0f0f6b..7e56e0c3a67 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -38,6 +38,8 @@
#include <mysql/plugin_auth.h>
#include <mysql/plugin_password_validation.h>
#include <mysql/plugin_encryption.h>
+#include <mysql/plugin_data_type.h>
+#include <mysql/plugin_function_collection.h>
#include "sql_plugin_compat.h"
#ifdef HAVE_LINK_H
@@ -90,7 +92,9 @@ const LEX_CSTRING plugin_type_names[MYSQL_MAX_PLUGIN_TYPE_NUM]=
{ STRING_WITH_LEN("REPLICATION") },
{ STRING_WITH_LEN("AUTHENTICATION") },
{ STRING_WITH_LEN("PASSWORD VALIDATION") },
- { STRING_WITH_LEN("ENCRYPTION") }
+ { STRING_WITH_LEN("ENCRYPTION") },
+ { STRING_WITH_LEN("DATA TYPE") },
+ { STRING_WITH_LEN("FUNCTION COLLECTION") }
};
extern int initialize_schema_table(st_plugin_int *plugin);
@@ -110,13 +114,15 @@ extern int finalize_encryption_plugin(st_plugin_int *plugin);
plugin_type_init plugin_type_initialize[MYSQL_MAX_PLUGIN_TYPE_NUM]=
{
0, ha_initialize_handlerton, 0, 0,initialize_schema_table,
- initialize_audit_plugin, 0, 0, 0, initialize_encryption_plugin
+ initialize_audit_plugin, 0, 0, 0, initialize_encryption_plugin, 0,
+ Plugin_function_collection::init_plugin
};
plugin_type_init plugin_type_deinitialize[MYSQL_MAX_PLUGIN_TYPE_NUM]=
{
0, ha_finalize_handlerton, 0, 0, finalize_schema_table,
- finalize_audit_plugin, 0, 0, 0, finalize_encryption_plugin
+ finalize_audit_plugin, 0, 0, 0, finalize_encryption_plugin, 0,
+ Plugin_function_collection::deinit_plugin
};
/*
@@ -128,6 +134,8 @@ static int plugin_type_initialization_order[MYSQL_MAX_PLUGIN_TYPE_NUM]=
{
MYSQL_DAEMON_PLUGIN,
MariaDB_ENCRYPTION_PLUGIN,
+ MariaDB_DATA_TYPE_PLUGIN,
+ MariaDB_FUNCTION_COLLECTION_PLUGIN,
MYSQL_STORAGE_ENGINE_PLUGIN,
MYSQL_INFORMATION_SCHEMA_PLUGIN,
MYSQL_FTPARSER_PLUGIN,
@@ -169,7 +177,9 @@ static int min_plugin_info_interface_version[MYSQL_MAX_PLUGIN_TYPE_NUM]=
MYSQL_REPLICATION_INTERFACE_VERSION,
MIN_AUTHENTICATION_INTERFACE_VERSION,
MariaDB_PASSWORD_VALIDATION_INTERFACE_VERSION,
- MariaDB_ENCRYPTION_INTERFACE_VERSION
+ MariaDB_ENCRYPTION_INTERFACE_VERSION,
+ MariaDB_DATA_TYPE_INTERFACE_VERSION,
+ MariaDB_FUNCTION_COLLECTION_INTERFACE_VERSION
};
static int cur_plugin_info_interface_version[MYSQL_MAX_PLUGIN_TYPE_NUM]=
{
@@ -182,7 +192,9 @@ static int cur_plugin_info_interface_version[MYSQL_MAX_PLUGIN_TYPE_NUM]=
MYSQL_REPLICATION_INTERFACE_VERSION,
MYSQL_AUTHENTICATION_INTERFACE_VERSION,
MariaDB_PASSWORD_VALIDATION_INTERFACE_VERSION,
- MariaDB_ENCRYPTION_INTERFACE_VERSION
+ MariaDB_ENCRYPTION_INTERFACE_VERSION,
+ MariaDB_DATA_TYPE_INTERFACE_VERSION,
+ MariaDB_FUNCTION_COLLECTION_INTERFACE_VERSION
};
static struct
diff --git a/sql/sql_plugin_services.ic b/sql/sql_plugin_services.ic
index c7ecfcd482e..c3b0088c9bd 100644
--- a/sql/sql_plugin_services.ic
+++ b/sql/sql_plugin_services.ic
@@ -173,7 +173,9 @@ static struct wsrep_service_st wsrep_handler = {
wsrep_get_sr_table_name,
wsrep_get_debug,
wsrep_commit_ordered,
- wsrep_thd_is_applying
+ wsrep_thd_is_applying,
+ wsrep_thd_has_ignored_error,
+ wsrep_thd_set_ignored_error
};
static struct thd_specifics_service_st thd_specifics_handler=
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 8088b6923f2..9a3013e5d47 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -739,6 +739,8 @@ void Item_param::setup_conversion(THD *thd, uchar param_type)
*/
if (!h)
h= &type_handler_string;
+ else if (unsigned_flag)
+ h= h->type_handler_unsigned();
set_handler(h);
h->Item_param_setup_conversion(thd, this);
}
@@ -1933,14 +1935,15 @@ static int mysql_test_show_grants(Prepared_statement *stmt)
TRUE error, error message is set in THD
*/
-static int mysql_test_show_slave_status(Prepared_statement *stmt)
+static int mysql_test_show_slave_status(Prepared_statement *stmt,
+ bool show_all_slaves_stat)
{
DBUG_ENTER("mysql_test_show_slave_status");
THD *thd= stmt->thd;
List<Item> fields;
- show_master_info_get_fields(thd, &fields, thd->lex->verbose, 0);
-
+ show_master_info_get_fields(thd, &fields, show_all_slaves_stat, 0);
+
DBUG_RETURN(send_stmt_metadata(thd, stmt, &fields));
}
@@ -2393,12 +2396,20 @@ static bool check_prepared_statement(Prepared_statement *stmt)
#endif /* NO_EMBEDDED_ACCESS_CHECKS */
#ifndef EMBEDDED_LIBRARY
case SQLCOM_SHOW_SLAVE_STAT:
- if ((res= mysql_test_show_slave_status(stmt)) == 2)
{
- /* Statement and field info has already been sent */
- DBUG_RETURN(FALSE);
+ DBUG_ASSERT(thd->lex->m_sql_cmd);
+ Sql_cmd_show_slave_status *cmd;
+ cmd= dynamic_cast<Sql_cmd_show_slave_status*>(thd->lex->m_sql_cmd);
+ DBUG_ASSERT(cmd);
+ if ((res= mysql_test_show_slave_status(stmt,
+ cmd->is_show_all_slaves_stat()))
+ == 2)
+ {
+ /* Statement and field info has already been sent */
+ DBUG_RETURN(FALSE);
+ }
+ break;
}
- break;
case SQLCOM_SHOW_MASTER_STAT:
if ((res= mysql_test_show_master_status(stmt)) == 2)
{
@@ -2863,7 +2874,7 @@ void mysql_sql_stmt_prepare(THD *thd)
}
else
{
- SESSION_TRACKER_CHANGED(thd, SESSION_STATE_CHANGE_TRACKER, NULL);
+ thd->session_tracker.state_change.mark_as_changed(thd);
my_ok(thd, 0L, 0L, "Statement prepared");
}
change_list_savepoint.rollback(thd);
@@ -3543,7 +3554,7 @@ void mysql_sql_stmt_close(THD *thd)
else
{
stmt->deallocate();
- SESSION_TRACKER_CHANGED(thd, SESSION_STATE_CHANGE_TRACKER, NULL);
+ thd->session_tracker.state_change.mark_as_changed(thd);
my_ok(thd);
}
}
@@ -4499,12 +4510,11 @@ Prepared_statement::reprepare()
TRUE, &cur_db_changed)))
return TRUE;
- sql_mode_t save_sql_mode= thd->variables.sql_mode;
- thd->variables.sql_mode= m_sql_mode;
+ Sql_mode_instant_set sms(thd, m_sql_mode);
+
error= ((name.str && copy.set_name(&name)) ||
copy.prepare(query(), query_length()) ||
validate_metadata(&copy));
- thd->variables.sql_mode= save_sql_mode;
if (cur_db_changed)
mysql_change_db(thd, (LEX_CSTRING*) &saved_cur_db_name, TRUE);
diff --git a/sql/sql_priv.h b/sql/sql_priv.h
index 0d1c9881c17..7aca1d2b699 100644
--- a/sql/sql_priv.h
+++ b/sql/sql_priv.h
@@ -229,6 +229,7 @@
#define OPTIMIZER_SWITCH_COND_PUSHDOWN_FOR_SUBQUERY (1ULL << 32)
#define OPTIMIZER_SWITCH_USE_ROWID_FILTER (1ULL << 33)
#define OPTIMIZER_SWITCH_COND_PUSHDOWN_FROM_HAVING (1ULL << 34)
+#define OPTIMIZER_SWITCH_NOT_NULL_RANGE_SCAN (1ULL << 35)
#define OPTIMIZER_SWITCH_DEFAULT (OPTIMIZER_SWITCH_INDEX_MERGE | \
OPTIMIZER_SWITCH_INDEX_MERGE_UNION | \
diff --git a/sql/sql_profile.cc b/sql/sql_profile.cc
index f36805012b2..5949287ea8d 100644
--- a/sql/sql_profile.cc
+++ b/sql/sql_profile.cc
@@ -32,7 +32,7 @@
#include "mariadb.h"
#include "sql_priv.h"
#include "sql_profile.h"
-#include "sql_show.h" // schema_table_store_record
+#include "sql_i_s.h" // schema_table_store_record
#include "sql_class.h" // THD
#ifdef _WIN32
@@ -60,30 +60,32 @@ int fill_query_profile_statistics_info(THD *thd, TABLE_LIST *tables,
#endif
}
+namespace Show {
+
ST_FIELD_INFO query_profile_statistics_info[]=
{
- /* name, length, type, value, maybe_null, old_name, open_method */
- {"QUERY_ID", 20, MYSQL_TYPE_LONG, 0, false, "Query_id", SKIP_OPEN_TABLE},
- {"SEQ", 20, MYSQL_TYPE_LONG, 0, false, "Seq", SKIP_OPEN_TABLE},
- {"STATE", 30, MYSQL_TYPE_STRING, 0, false, "Status", SKIP_OPEN_TABLE},
- {"DURATION", TIME_I_S_DECIMAL_SIZE, MYSQL_TYPE_DECIMAL, 0, false, "Duration", SKIP_OPEN_TABLE},
- {"CPU_USER", TIME_I_S_DECIMAL_SIZE, MYSQL_TYPE_DECIMAL, 0, true, "CPU_user", SKIP_OPEN_TABLE},
- {"CPU_SYSTEM", TIME_I_S_DECIMAL_SIZE, MYSQL_TYPE_DECIMAL, 0, true, "CPU_system", SKIP_OPEN_TABLE},
- {"CONTEXT_VOLUNTARY", 20, MYSQL_TYPE_LONG, 0, true, "Context_voluntary", SKIP_OPEN_TABLE},
- {"CONTEXT_INVOLUNTARY", 20, MYSQL_TYPE_LONG, 0, true, "Context_involuntary", SKIP_OPEN_TABLE},
- {"BLOCK_OPS_IN", 20, MYSQL_TYPE_LONG, 0, true, "Block_ops_in", SKIP_OPEN_TABLE},
- {"BLOCK_OPS_OUT", 20, MYSQL_TYPE_LONG, 0, true, "Block_ops_out", SKIP_OPEN_TABLE},
- {"MESSAGES_SENT", 20, MYSQL_TYPE_LONG, 0, true, "Messages_sent", SKIP_OPEN_TABLE},
- {"MESSAGES_RECEIVED", 20, MYSQL_TYPE_LONG, 0, true, "Messages_received", SKIP_OPEN_TABLE},
- {"PAGE_FAULTS_MAJOR", 20, MYSQL_TYPE_LONG, 0, true, "Page_faults_major", SKIP_OPEN_TABLE},
- {"PAGE_FAULTS_MINOR", 20, MYSQL_TYPE_LONG, 0, true, "Page_faults_minor", SKIP_OPEN_TABLE},
- {"SWAPS", 20, MYSQL_TYPE_LONG, 0, true, "Swaps", SKIP_OPEN_TABLE},
- {"SOURCE_FUNCTION", 30, MYSQL_TYPE_STRING, 0, true, "Source_function", SKIP_OPEN_TABLE},
- {"SOURCE_FILE", 20, MYSQL_TYPE_STRING, 0, true, "Source_file", SKIP_OPEN_TABLE},
- {"SOURCE_LINE", 20, MYSQL_TYPE_LONG, 0, true, "Source_line", SKIP_OPEN_TABLE},
- {NULL, 0, MYSQL_TYPE_STRING, 0, true, NULL, 0}
+ Column("QUERY_ID", SLong(20), NOT_NULL, "Query_id"),
+ Column("SEQ", SLong(20), NOT_NULL, "Seq"),
+ Column("STATE", Varchar(30), NOT_NULL, "Status"),
+ Column("DURATION", Decimal(TIME_I_S_DECIMAL_SIZE), NOT_NULL, "Duration"),
+ Column("CPU_USER", Decimal(TIME_I_S_DECIMAL_SIZE), NULLABLE, "CPU_user"),
+ Column("CPU_SYSTEM", Decimal(TIME_I_S_DECIMAL_SIZE), NULLABLE, "CPU_system"),
+ Column("CONTEXT_VOLUNTARY", SLong(20), NULLABLE, "Context_voluntary"),
+ Column("CONTEXT_INVOLUNTARY", SLong(20), NULLABLE, "Context_involuntary"),
+ Column("BLOCK_OPS_IN", SLong(20), NULLABLE, "Block_ops_in"),
+ Column("BLOCK_OPS_OUT", SLong(20), NULLABLE, "Block_ops_out"),
+ Column("MESSAGES_SENT", SLong(20), NULLABLE, "Messages_sent"),
+ Column("MESSAGES_RECEIVED", SLong(20), NULLABLE, "Messages_received"),
+ Column("PAGE_FAULTS_MAJOR", SLong(20), NULLABLE, "Page_faults_major"),
+ Column("PAGE_FAULTS_MINOR", SLong(20), NULLABLE, "Page_faults_minor"),
+ Column("SWAPS", SLong(20), NULLABLE, "Swaps"),
+ Column("SOURCE_FUNCTION", Varchar(30), NULLABLE, "Source_function"),
+ Column("SOURCE_FILE", Varchar(20), NULLABLE, "Source_file"),
+ Column("SOURCE_LINE", SLong(20), NULLABLE, "Source_line"),
+ CEnd()
};
+} // namespace Show
int make_profile_table_for_show(THD *thd, ST_SCHEMA_TABLE *schema_table)
{
@@ -113,21 +115,17 @@ int make_profile_table_for_show(THD *thd, ST_SCHEMA_TABLE *schema_table)
Name_resolution_context *context= &thd->lex->first_select_lex()->context;
int i;
- for (i= 0; schema_table->fields_info[i].field_name != NULL; i++)
+ for (i= 0; !schema_table->fields_info[i].end_marker(); i++)
{
if (! fields_include_condition_truth_values[i])
continue;
field_info= &schema_table->fields_info[i];
- LEX_CSTRING field_name= {field_info->field_name,
- strlen(field_info->field_name) };
Item_field *field= new (thd->mem_root) Item_field(thd, context,
- NullS, NullS, &field_name);
+ field_info->name());
if (field)
{
- field->set_name(thd, field_info->old_name,
- (uint) strlen(field_info->old_name),
- system_charset_info);
+ field->set_name(thd, field_info->old_name());
if (add_item_to_list(thd, field))
return 1;
}
diff --git a/sql/sql_profile.h b/sql/sql_profile.h
index 5b03acf59c0..b0b1642ee02 100644
--- a/sql/sql_profile.h
+++ b/sql/sql_profile.h
@@ -19,10 +19,13 @@
class Item;
struct TABLE_LIST;
class THD;
-typedef struct st_field_info ST_FIELD_INFO;
+class ST_FIELD_INFO;
typedef struct st_schema_table ST_SCHEMA_TABLE;
+namespace Show {
extern ST_FIELD_INFO query_profile_statistics_info[];
+} // namespace Show
+
int fill_query_profile_statistics_info(THD *thd, TABLE_LIST *tables, Item *cond);
int make_profile_table_for_show(THD *thd, ST_SCHEMA_TABLE *schema_table);
diff --git a/sql/sql_reload.cc b/sql/sql_reload.cc
index 0e166b169aa..5562de8d8d5 100644
--- a/sql/sql_reload.cc
+++ b/sql/sql_reload.cc
@@ -133,7 +133,7 @@ bool reload_acl_and_cache(THD *thd, unsigned long long options,
logger.flush_general_log();
if (options & REFRESH_ENGINE_LOG)
- if (ha_flush_logs(NULL))
+ if (ha_flush_logs())
result= 1;
if (options & REFRESH_BINARY_LOG)
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 31d05220f64..7039c70db05 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -300,6 +300,14 @@ void set_postjoin_aggr_write_func(JOIN_TAB *tab);
static Item **get_sargable_cond(JOIN *join, TABLE *table);
+static
+bool build_notnull_conds_for_range_scans(JOIN *join, COND *cond,
+ table_map allowed);
+static
+void build_notnull_conds_for_inner_nest_of_outer_join(JOIN *join,
+ TABLE_LIST *nest_tbl);
+
+
#ifndef DBUG_OFF
/*
@@ -561,9 +569,9 @@ fix_inner_refs(THD *thd, List<Item> &all_fields, SELECT_LEX *select,
new_ref= direct_ref ?
new (thd->mem_root) Item_direct_ref(thd, ref->context, item_ref, ref->table_name,
- &ref->field_name, ref->alias_name_used) :
+ ref->field_name, ref->alias_name_used) :
new (thd->mem_root) Item_ref(thd, ref->context, item_ref, ref->table_name,
- &ref->field_name, ref->alias_name_used);
+ ref->field_name, ref->alias_name_used);
if (!new_ref)
return TRUE;
ref->outer_ref= new_ref;
@@ -769,11 +777,11 @@ Item* period_get_condition(THD *thd, TABLE_LIST *table, SELECT_LEX *select,
const LEX_CSTRING &fend= period->end_field(share)->field_name;
conds->field_start= newx Item_field(thd, &select->context,
- table->db.str, table->alias.str,
- thd->make_clex_string(fstart));
+ table->db, table->alias,
+ thd->strmake_lex_cstring(fstart));
conds->field_end= newx Item_field(thd, &select->context,
- table->db.str, table->alias.str,
- thd->make_clex_string(fend));
+ table->db, table->alias,
+ thd->strmake_lex_cstring(fend));
Item *cond1= NULL, *cond2= NULL, *cond3= NULL, *curr= NULL;
if (timestamp)
@@ -1015,7 +1023,7 @@ int SELECT_LEX::vers_setup_conds(THD *thd, TABLE_LIST *tables)
storing vers_conditions as Item and make some magic related to
vers_system_time_t/VERS_TRX_ID at stage of fix_fields()
(this is large refactoring). */
- if (vers_conditions.resolve_units(thd))
+ if (vers_conditions.check_units(thd))
DBUG_RETURN(-1);
if (timestamps_only && (vers_conditions.start.unit == VERS_TRX_ID ||
vers_conditions.end.unit == VERS_TRX_ID))
@@ -3592,7 +3600,7 @@ bool JOIN::make_aggr_tables_info()
unit->select_limit_cnt == 1 (we only need one row in the result set)
*/
sort_tab->filesort->limit=
- (has_group_by || (join_tab + table_count > curr_tab + 1)) ?
+ (has_group_by || (join_tab + top_join_tab_count > curr_tab + 1)) ?
select_limit : unit->select_limit_cnt;
}
if (!only_const_tables() &&
@@ -5276,6 +5284,9 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
}
}
+ join->join_tab= stat;
+ join->make_notnull_conds_for_range_scans();
+
/* Calc how many (possible) matched records in each table */
/*
@@ -6891,7 +6902,6 @@ void optimize_keyuse(JOIN *join, DYNAMIC_ARRAY *keyuse_array)
}
}
-
/**
Check for the presence of AGGFN(DISTINCT a) queries that may be subject
to loose index scan.
@@ -6929,7 +6939,6 @@ is_indexed_agg_distinct(JOIN *join, List<Item_field> *out_args)
{
Item_sum **sum_item_ptr;
bool result= false;
- Field_map first_aggdistinct_fields;
if (join->table_count != 1 || /* reference more than 1 table */
join->select_distinct || /* or a DISTINCT */
@@ -6939,10 +6948,11 @@ is_indexed_agg_distinct(JOIN *join, List<Item_field> *out_args)
if (join->make_sum_func_list(join->all_fields, join->fields_list, true))
return false;
+ Bitmap<MAX_FIELDS> first_aggdistinct_fields;
+ bool first_aggdistinct_fields_initialized= false;
for (sum_item_ptr= join->sum_funcs; *sum_item_ptr; sum_item_ptr++)
{
Item_sum *sum_item= *sum_item_ptr;
- Field_map cur_aggdistinct_fields;
Item *expr;
/* aggregate is not AGGFN(DISTINCT) or more than 1 argument to it */
switch (sum_item->sum_func())
@@ -6965,6 +6975,8 @@ is_indexed_agg_distinct(JOIN *join, List<Item_field> *out_args)
We don't worry about duplicates as these will be sorted out later in
get_best_group_min_max
*/
+ Bitmap<MAX_FIELDS> cur_aggdistinct_fields;
+ cur_aggdistinct_fields.clear_all();
for (uint i= 0; i < sum_item->get_arg_count(); i++)
{
expr= sum_item->get_arg(i);
@@ -6983,8 +6995,11 @@ is_indexed_agg_distinct(JOIN *join, List<Item_field> *out_args)
If there are multiple aggregate functions, make sure that they all
refer to exactly the same set of columns.
*/
- if (first_aggdistinct_fields.is_clear_all())
- first_aggdistinct_fields.merge(cur_aggdistinct_fields);
+ if (!first_aggdistinct_fields_initialized)
+ {
+ first_aggdistinct_fields= cur_aggdistinct_fields;
+ first_aggdistinct_fields_initialized=true;
+ }
else if (first_aggdistinct_fields != cur_aggdistinct_fields)
return false;
}
@@ -10189,14 +10204,16 @@ bool JOIN::get_best_combination()
if (aggr_tables > 2)
aggr_tables= 2;
- if (!(join_tab= (JOIN_TAB*) thd->alloc(sizeof(JOIN_TAB)*
- (top_join_tab_count + aggr_tables))))
- DBUG_RETURN(TRUE);
full_join=0;
hash_join= FALSE;
fix_semijoin_strategies_for_picked_join_order(this);
+ top_join_tab_count= get_number_of_tables_at_top_level(this);
+
+ if (!(join_tab= (JOIN_TAB*) thd->alloc(sizeof(JOIN_TAB)*
+ (top_join_tab_count + aggr_tables))))
+ DBUG_RETURN(TRUE);
JOIN_TAB_RANGE *root_range;
if (!(root_range= new (thd->mem_root) JOIN_TAB_RANGE))
@@ -13908,7 +13925,7 @@ remove_const(JOIN *join,ORDER *first_order, COND *cond,
ORDER BY and GROUP BY
*/
for (JOIN_TAB *tab= join->join_tab + join->const_tables;
- tab < join->join_tab + join->table_count;
+ tab < join->join_tab + join->top_join_tab_count;
tab++)
tab->cached_eq_ref_table= FALSE;
@@ -17544,16 +17561,20 @@ const_expression_in_where(COND *cond, Item *comp_item, Field *comp_field,
Create internal temporary table
****************************************************************************/
-Field *Item::create_tmp_field_int(TABLE *table, uint convert_int_length)
+Field *Item::create_tmp_field_int(MEM_ROOT *root, TABLE *table,
+ uint convert_int_length)
{
- const Type_handler *h= &type_handler_long;
+ const Type_handler *h= &type_handler_slong;
if (max_char_length() > convert_int_length)
- h= &type_handler_longlong;
- return h->make_and_init_table_field(&name, Record_addr(maybe_null),
+ h= &type_handler_slonglong;
+ if (unsigned_flag)
+ h= h->type_handler_unsigned();
+ return h->make_and_init_table_field(root, &name, Record_addr(maybe_null),
*this, table);
}
-Field *Item::tmp_table_field_from_field_type_maybe_null(TABLE *table,
+Field *Item::tmp_table_field_from_field_type_maybe_null(MEM_ROOT *root,
+ TABLE *table,
Tmp_field_src *src,
const Tmp_field_param *param,
bool is_explicit_null)
@@ -17565,7 +17586,7 @@ Field *Item::tmp_table_field_from_field_type_maybe_null(TABLE *table,
DBUG_ASSERT(!param->make_copy_field() || type() == CONST_ITEM);
DBUG_ASSERT(!is_result_field());
Field *result;
- if ((result= tmp_table_field_from_field_type(table)))
+ if ((result= tmp_table_field_from_field_type(root, table)))
{
if (result && is_explicit_null)
result->is_created_from_null_item= true;
@@ -17574,15 +17595,14 @@ Field *Item::tmp_table_field_from_field_type_maybe_null(TABLE *table,
}
-Field *Item_sum::create_tmp_field(bool group, TABLE *table)
+Field *Item_sum::create_tmp_field(MEM_ROOT *root, bool group, TABLE *table)
{
Field *UNINIT_VAR(new_field);
- MEM_ROOT *mem_root= table->in_use->mem_root;
switch (cmp_type()) {
case REAL_RESULT:
{
- new_field= new (mem_root)
+ new_field= new (root)
Field_double(max_char_length(), maybe_null, &name, decimals, TRUE);
break;
}
@@ -17590,7 +17610,7 @@ Field *Item_sum::create_tmp_field(bool group, TABLE *table)
case TIME_RESULT:
case DECIMAL_RESULT:
case STRING_RESULT:
- new_field= tmp_table_field_from_field_type(table);
+ new_field= tmp_table_field_from_field_type(root, table);
break;
case ROW_RESULT:
// This case should never be choosen
@@ -17605,47 +17625,11 @@ Field *Item_sum::create_tmp_field(bool group, TABLE *table)
/**
- Create field for information schema table.
-
- @param thd Thread handler
- @param table Temporary table
- @param item Item to create a field for
-
- @retval
- 0 on error
- @retval
- new_created field
-*/
-
-Field *Item::create_field_for_schema(THD *thd, TABLE *table)
-{
- if (field_type() == MYSQL_TYPE_VARCHAR)
- {
- Field *field;
- if (max_length > MAX_FIELD_VARCHARLENGTH)
- field= new (thd->mem_root) Field_blob(max_length, maybe_null, &name,
- collation.collation);
- else if (max_length > 0)
- field= new (thd->mem_root) Field_varstring(max_length, maybe_null, &name,
- table->s,
- collation.collation);
- else
- field= new Field_null((uchar*) 0, 0, Field::NONE, &name,
- collation.collation);
- if (field)
- field->init(table);
- return field;
- }
- return tmp_table_field_from_field_type(table);
-}
-
-
-/**
Create a temporary field for Item_field (or its descendant),
either direct or referenced by an Item_ref.
*/
Field *
-Item_field::create_tmp_field_from_item_field(TABLE *new_table,
+Item_field::create_tmp_field_from_item_field(MEM_ROOT *root, TABLE *new_table,
Item_ref *orig_item,
const Tmp_field_param *param)
{
@@ -17669,14 +17653,16 @@ Item_field::create_tmp_field_from_item_field(TABLE *new_table,
Record_addr rec(orig_item ? orig_item->maybe_null : maybe_null);
const Type_handler *handler= type_handler()->
type_handler_for_tmp_table(this);
- result= handler->make_and_init_table_field(orig_item ? &orig_item->name : &name,
+ result= handler->make_and_init_table_field(root,
+ orig_item ? &orig_item->name : &name,
rec, *this, new_table);
}
else if (param->table_cant_handle_bit_fields() &&
field->type() == MYSQL_TYPE_BIT)
{
- const Type_handler *handler= type_handler_long_or_longlong();
- result= handler->make_and_init_table_field(&name,
+ const Type_handler *handler=
+ Type_handler::type_handler_long_or_longlong(max_char_length(), true);
+ result= handler->make_and_init_table_field(root, &name,
Record_addr(maybe_null),
*this, new_table);
}
@@ -17685,8 +17671,7 @@ Item_field::create_tmp_field_from_item_field(TABLE *new_table,
LEX_CSTRING *tmp= orig_item ? &orig_item->name : &name;
bool tmp_maybe_null= param->modify_item() ? maybe_null :
field->maybe_null();
- result= field->create_tmp_field(new_table->in_use->mem_root, new_table,
- tmp_maybe_null);
+ result= field->create_tmp_field(root, new_table, tmp_maybe_null);
if (result)
result->field_name= *tmp;
}
@@ -17696,14 +17681,14 @@ Item_field::create_tmp_field_from_item_field(TABLE *new_table,
}
-Field *Item_field::create_tmp_field_ex(TABLE *table,
+Field *Item_field::create_tmp_field_ex(MEM_ROOT *root, TABLE *table,
Tmp_field_src *src,
const Tmp_field_param *param)
{
DBUG_ASSERT(!is_result_field());
Field *result;
src->set_field(field);
- if (!(result= create_tmp_field_from_item_field(table, NULL, param)))
+ if (!(result= create_tmp_field_from_item_field(root, table, NULL, param)))
return NULL;
/*
Fields that are used as arguments to the DEFAULT() function already have
@@ -17716,7 +17701,7 @@ Field *Item_field::create_tmp_field_ex(TABLE *table,
}
-Field *Item_ref::create_tmp_field_ex(TABLE *table,
+Field *Item_ref::create_tmp_field_ex(MEM_ROOT *root, TABLE *table,
Tmp_field_src *src,
const Tmp_field_param *param)
{
@@ -17729,13 +17714,14 @@ Field *Item_ref::create_tmp_field_ex(TABLE *table,
Tmp_field_param prm2(*param);
prm2.set_modify_item(false);
src->set_field(field->field);
- if (!(result= field->create_tmp_field_from_item_field(table, this, &prm2)))
+ if (!(result= field->create_tmp_field_from_item_field(root, table,
+ this, &prm2)))
return NULL;
if (param->modify_item())
result_field= result;
return result;
}
- return Item_result_field::create_tmp_field_ex(table, src, param);
+ return Item_result_field::create_tmp_field_ex(root, table, src, param);
}
@@ -17754,9 +17740,13 @@ void Item_result_field::get_tmp_field_src(Tmp_field_src *src,
}
-Field *Item_result_field::create_tmp_field_ex(TABLE *table,
- Tmp_field_src *src,
- const Tmp_field_param *param)
+Field *
+Item_result_field::create_tmp_field_ex_from_handler(
+ MEM_ROOT *root,
+ TABLE *table,
+ Tmp_field_src *src,
+ const Tmp_field_param *param,
+ const Type_handler *h)
{
/*
Possible Item types:
@@ -17764,38 +17754,27 @@ Field *Item_result_field::create_tmp_field_ex(TABLE *table,
- Item_func
- Item_subselect
*/
+ DBUG_ASSERT(fixed);
DBUG_ASSERT(is_result_field());
DBUG_ASSERT(type() != NULL_ITEM);
get_tmp_field_src(src, param);
Field *result;
- if ((result= tmp_table_field_from_field_type(table)) && param->modify_item())
+ if ((result= h->make_and_init_table_field(root, &name,
+ Record_addr(maybe_null),
+ *this, table)) &&
+ param->modify_item())
result_field= result;
return result;
}
-Field *Item_func_user_var::create_tmp_field_ex(TABLE *table,
- Tmp_field_src *src,
- const Tmp_field_param *param)
-{
- DBUG_ASSERT(is_result_field());
- DBUG_ASSERT(type() != NULL_ITEM);
- get_tmp_field_src(src, param);
- Field *result;
- if ((result= create_table_field_from_handler(table)) && param->modify_item())
- result_field= result;
- return result;
-}
-
-
-Field *Item_func_sp::create_tmp_field_ex(TABLE *table,
+Field *Item_func_sp::create_tmp_field_ex(MEM_ROOT *root, TABLE *table,
Tmp_field_src *src,
const Tmp_field_param *param)
{
Field *result;
get_tmp_field_src(src, param);
- if ((result= sp_result_field->create_tmp_field(table->in_use->mem_root,
- table)))
+ if ((result= sp_result_field->create_tmp_field(root, table)))
{
result->field_name= name;
if (param->modify_item())
@@ -17841,7 +17820,8 @@ Field *create_tmp_field(TABLE *table, Item *item,
Tmp_field_src src;
Tmp_field_param prm(group, modify_item, table_cant_handle_bit_fields,
make_copy_field);
- Field *result= item->create_tmp_field_ex(table, &src, &prm);
+ Field *result= item->create_tmp_field_ex(table->in_use->mem_root,
+ table, &src, &prm);
*from_field= src.field();
*default_field= src.default_field();
if (src.item_result_field())
@@ -17893,6 +17873,91 @@ setup_tmp_table_column_bitmaps(TABLE *table, uchar *bitmaps)
}
+class Create_tmp_table: public Data_type_statistics
+{
+ // The following members are initialized only in start()
+ Field **m_from_field, **m_default_field;
+ KEY_PART_INFO *m_key_part_info;
+ uchar *m_group_buff, *m_bitmaps;
+ // The following members are initialized in ctor
+ uint m_alloced_field_count;
+ bool m_using_unique_constraint;
+ uint m_temp_pool_slot;
+ ORDER *m_group;
+ bool m_distinct;
+ bool m_save_sum_fields;
+ ulonglong m_select_options;
+ ha_rows m_rows_limit;
+ uint m_hidden_field_count; // Remove this eventually
+ uint m_group_null_items;
+ uint m_null_count;
+ uint m_hidden_uneven_bit_length;
+ uint m_hidden_null_count;
+public:
+ Create_tmp_table(const TMP_TABLE_PARAM *param,
+ ORDER *group, bool distinct, bool save_sum_fields,
+ ulonglong select_options, ha_rows rows_limit)
+ :m_alloced_field_count(0),
+ m_using_unique_constraint(false),
+ m_temp_pool_slot(MY_BIT_NONE),
+ m_group(group),
+ m_distinct(distinct),
+ m_save_sum_fields(save_sum_fields),
+ m_select_options(select_options),
+ m_rows_limit(rows_limit),
+ m_hidden_field_count(param->hidden_field_count),
+ m_group_null_items(0),
+ m_null_count(0),
+ m_hidden_uneven_bit_length(0),
+ m_hidden_null_count(0)
+ { }
+
+ void add_field(TABLE *table, Field *field, uint fieldnr, bool force_not_null_cols);
+
+ TABLE *start(THD *thd,
+ TMP_TABLE_PARAM *param,
+ const LEX_CSTRING *table_alias);
+
+ bool add_fields(THD *thd, TABLE *table,
+ TMP_TABLE_PARAM *param, List<Item> &fields);
+
+ bool add_schema_fields(THD *thd, TABLE *table,
+ TMP_TABLE_PARAM *param,
+ const ST_SCHEMA_TABLE &schema_table,
+ const MY_BITMAP &bitmap);
+
+ bool finalize(THD *thd, TABLE *table, TMP_TABLE_PARAM *param,
+ bool do_not_open, bool keep_row_order);
+ void cleanup_on_failure(THD *thd, TABLE *table);
+};
+
+
+void Create_tmp_table::add_field(TABLE *table, Field *field, uint fieldnr, bool force_not_null_cols)
+{
+ DBUG_ASSERT(!field->field_name.str || strlen(field->field_name.str) == field->field_name.length);
+
+ if (force_not_null_cols)
+ {
+ field->flags|= NOT_NULL_FLAG;
+ field->null_ptr= NULL;
+ }
+
+ if (!(field->flags & NOT_NULL_FLAG))
+ m_null_count++;
+
+ table->s->reclength+= field->pack_length();
+
+ // Assign it here, before update_data_type_statistics() changes m_blob_count
+ if (field->flags & BLOB_FLAG)
+ table->s->blob_field[m_blob_count]= fieldnr;
+
+ table->field[fieldnr]= field;
+ field->field_index= fieldnr;
+
+ field->update_data_type_statistics(this);
+}
+
+
/**
Create a temp table according to a field list.
@@ -17927,61 +17992,36 @@ setup_tmp_table_column_bitmaps(TABLE *table, uchar *bitmaps)
inserted, the engine should preserve this order
*/
-TABLE *
-create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
- ORDER *group, bool distinct, bool save_sum_fields,
- ulonglong select_options, ha_rows rows_limit,
- const LEX_CSTRING *table_alias, bool do_not_open,
- bool keep_row_order)
+TABLE *Create_tmp_table::start(THD *thd,
+ TMP_TABLE_PARAM *param,
+ const LEX_CSTRING *table_alias)
{
MEM_ROOT *mem_root_save, own_root;
TABLE *table;
TABLE_SHARE *share;
- uint i,field_count,null_count,null_pack_length;
uint copy_func_count= param->func_count;
- uint hidden_null_count, hidden_null_pack_length, hidden_field_count;
- uint blob_count,group_null_items, string_count;
- uint temp_pool_slot=MY_BIT_NONE;
- uint fieldnr= 0;
- ulong reclength, string_total_length;
- bool using_unique_constraint= false;
- bool use_packed_rows= false;
- bool not_all_columns= !(select_options & TMP_TABLE_ALL_COLUMNS);
char *tmpname,path[FN_REFLEN];
- uchar *pos, *group_buff, *bitmaps;
- uchar *null_flags;
- Field **reg_field, **from_field, **default_field;
+ Field **reg_field;
uint *blob_field;
- Copy_field *copy=0;
- KEY *keyinfo;
- KEY_PART_INFO *key_part_info;
- Item **copy_func;
- TMP_ENGINE_COLUMNDEF *recinfo;
- /*
- total_uneven_bit_length is uneven bit length for visible fields
- hidden_uneven_bit_length is uneven bit length for hidden fields
- */
- uint total_uneven_bit_length= 0, hidden_uneven_bit_length= 0;
- bool force_copy_fields= param->force_copy_fields;
/* Treat sum functions as normal ones when loose index scan is used. */
- save_sum_fields|= param->precomputed_group_by;
- DBUG_ENTER("create_tmp_table");
+ m_save_sum_fields|= param->precomputed_group_by;
+ DBUG_ENTER("Create_tmp_table::start");
DBUG_PRINT("enter",
("table_alias: '%s' distinct: %d save_sum_fields: %d "
"rows_limit: %lu group: %d", table_alias->str,
- (int) distinct, (int) save_sum_fields,
- (ulong) rows_limit, MY_TEST(group)));
+ (int) m_distinct, (int) m_save_sum_fields,
+ (ulong) m_rows_limit, MY_TEST(m_group)));
if (use_temp_pool && !(test_flags & TEST_KEEP_TMP_TABLES))
- temp_pool_slot = bitmap_lock_set_next(&temp_pool);
+ m_temp_pool_slot = bitmap_lock_set_next(&temp_pool);
- if (temp_pool_slot != MY_BIT_NONE) // we got a slot
- sprintf(path, "%s_%lx_%i", tmp_file_prefix,
- current_pid, temp_pool_slot);
+ if (m_temp_pool_slot != MY_BIT_NONE) // we got a slot
+ sprintf(path, "%s-%lx-%i", tmp_file_prefix,
+ current_pid, m_temp_pool_slot);
else
{
/* if we run out of slots or we are not using tempool */
- sprintf(path, "%s%lx_%lx_%x", tmp_file_prefix,current_pid,
+ sprintf(path, "%s-%lx-%lx-%x", tmp_file_prefix,current_pid,
(ulong) thd->thread_id, thd->tmp_table++);
}
@@ -17992,12 +18032,12 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
fn_format(path, path, mysql_tmpdir, "",
MY_REPLACE_EXT|MY_UNPACK_FILENAME);
- if (group)
+ if (m_group)
{
- ORDER **prev= &group;
+ ORDER **prev= &m_group;
if (!param->quick_group)
- group=0; // Can't use group key
- else for (ORDER *tmp=group ; tmp ; tmp=tmp->next)
+ m_group= 0; // Can't use group key
+ else for (ORDER *tmp= m_group ; tmp ; tmp= tmp->next)
{
/* Exclude found constant from the list */
if ((*tmp->item)->const_item())
@@ -18016,16 +18056,17 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
*/
(*tmp->item)->marker=4; // Store null in key
if ((*tmp->item)->too_big_for_varchar())
- using_unique_constraint= true;
+ m_using_unique_constraint= true;
}
if (param->group_length >= MAX_BLOB_WIDTH)
- using_unique_constraint= true;
- if (group)
- distinct=0; // Can't use distinct
+ m_using_unique_constraint= true;
+ if (m_group)
+ m_distinct= 0; // Can't use distinct
}
- field_count=param->field_count+param->func_count+param->sum_func_count;
- hidden_field_count=param->hidden_field_count;
+ m_alloced_field_count= param->field_count+param->func_count+param->sum_func_count;
+ DBUG_ASSERT(m_alloced_field_count);
+ const uint field_count= m_alloced_field_count;
/*
When loose index scan is employed as access method, it already
@@ -18044,41 +18085,37 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
&table, sizeof(*table),
&share, sizeof(*share),
&reg_field, sizeof(Field*) * (field_count+1),
- &default_field, sizeof(Field*) * (field_count),
+ &m_default_field, sizeof(Field*) * (field_count),
&blob_field, sizeof(uint)*(field_count+1),
- &from_field, sizeof(Field*)*field_count,
- &copy_func, sizeof(*copy_func)*(copy_func_count+1),
+ &m_from_field, sizeof(Field*)*field_count,
+ &param->items_to_copy,
+ sizeof(param->items_to_copy[0])*(copy_func_count+1),
&param->keyinfo, sizeof(*param->keyinfo),
- &key_part_info,
- sizeof(*key_part_info)*(param->group_parts+1),
+ &m_key_part_info,
+ sizeof(*m_key_part_info)*(param->group_parts+1),
&param->start_recinfo,
sizeof(*param->recinfo)*(field_count*2+4),
&tmpname, (uint) strlen(path)+1,
- &group_buff, (group && ! using_unique_constraint ?
+ &m_group_buff, (m_group && ! m_using_unique_constraint ?
param->group_length : 0),
- &bitmaps, bitmap_buffer_size(field_count)*6,
+ &m_bitmaps, bitmap_buffer_size(field_count)*6,
NullS))
{
- if (temp_pool_slot != MY_BIT_NONE)
- bitmap_lock_clear_bit(&temp_pool, temp_pool_slot);
DBUG_RETURN(NULL); /* purecov: inspected */
}
/* Copy_field belongs to TMP_TABLE_PARAM, allocate it in THD mem_root */
- if (!(param->copy_field= copy= new (thd->mem_root) Copy_field[field_count]))
+ if (!(param->copy_field= new (thd->mem_root) Copy_field[field_count]))
{
- if (temp_pool_slot != MY_BIT_NONE)
- bitmap_lock_clear_bit(&temp_pool, temp_pool_slot);
free_root(&own_root, MYF(0)); /* purecov: inspected */
DBUG_RETURN(NULL); /* purecov: inspected */
}
- param->items_to_copy= copy_func;
strmov(tmpname, path);
/* make table according to fields */
bzero((char*) table,sizeof(*table));
- bzero((char*) reg_field,sizeof(Field*)*(field_count+1));
- bzero((char*) default_field, sizeof(Field*) * (field_count));
- bzero((char*) from_field,sizeof(Field*)*field_count);
+ bzero((char*) reg_field, sizeof(Field*) * (field_count+1));
+ bzero((char*) m_default_field, sizeof(Field*) * (field_count));
+ bzero((char*) m_from_field, sizeof(Field*) * field_count);
table->mem_root= own_root;
mem_root_save= thd->mem_root;
@@ -18089,7 +18126,7 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
table->reginfo.lock_type=TL_WRITE; /* Will be updated */
table->map=1;
- table->temp_pool_slot = temp_pool_slot;
+ table->temp_pool_slot= m_temp_pool_slot;
table->copy_blobs= 1;
table->in_use= thd;
table->no_rows_with_nulls= param->force_not_null_cols;
@@ -18104,15 +18141,36 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
if (param->schema_table)
share->db= INFORMATION_SCHEMA_NAME;
- /* Calculate which type of fields we will store in the temporary table */
-
- reclength= string_total_length= 0;
- blob_count= string_count= null_count= hidden_null_count= group_null_items= 0;
param->using_outer_summary_function= 0;
+ thd->mem_root= mem_root_save;
+ DBUG_RETURN(table);
+}
+
+
+bool Create_tmp_table::add_fields(THD *thd,
+ TABLE *table,
+ TMP_TABLE_PARAM *param,
+ List<Item> &fields)
+{
+ DBUG_ENTER("Create_tmp_table::add_fields");
+ DBUG_ASSERT(table);
+ DBUG_ASSERT(table->field);
+ DBUG_ASSERT(table->s->blob_field);
+ DBUG_ASSERT(table->s->reclength == 0);
+ DBUG_ASSERT(table->s->fields == 0);
+ DBUG_ASSERT(table->s->blob_fields == 0);
+
+ const bool not_all_columns= !(m_select_options & TMP_TABLE_ALL_COLUMNS);
+ uint fieldnr= 0;
+ TABLE_SHARE *share= table->s;
+ Item **copy_func= param->items_to_copy;
+
+ MEM_ROOT *mem_root_save= thd->mem_root;
+ thd->mem_root= &table->mem_root;
List_iterator_fast<Item> li(fields);
Item *item;
- Field **tmp_from_field=from_field;
+ Field **tmp_from_field= m_from_field;
while ((item=li++))
{
Item::Type type= item->type();
@@ -18139,14 +18197,14 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
continue;
}
}
- if (item->const_item() && (int) hidden_field_count <= 0)
+ if (item->const_item() && (int) m_hidden_field_count <= 0)
continue; // We don't have to store this
}
- if (type == Item::SUM_FUNC_ITEM && !group && !save_sum_fields)
+ if (type == Item::SUM_FUNC_ITEM && !m_group && !m_save_sum_fields)
{ /* Can't calc group yet */
Item_sum *sum_item= (Item_sum *) item;
sum_item->result_field=0;
- for (i=0 ; i < sum_item->get_arg_count() ; i++)
+ for (uint i= 0 ; i < sum_item->get_arg_count() ; i++)
{
Item *arg= sum_item->get_arg(i);
if (!arg->const_item())
@@ -18154,49 +18212,30 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
Item *tmp_item;
Field *new_field=
create_tmp_field(table, arg, &copy_func,
- tmp_from_field, &default_field[fieldnr],
- group != 0,not_all_columns,
- distinct, false);
+ tmp_from_field, &m_default_field[fieldnr],
+ m_group != 0, not_all_columns,
+ m_distinct, false);
if (!new_field)
goto err; // Should be OOM
- DBUG_ASSERT(!new_field->field_name.str || strlen(new_field->field_name.str) == new_field->field_name.length);
tmp_from_field++;
- reclength+=new_field->pack_length();
- if (new_field->flags & BLOB_FLAG)
- {
- *blob_field++= fieldnr;
- blob_count++;
- }
- if (new_field->type() == MYSQL_TYPE_BIT)
- total_uneven_bit_length+= new_field->field_length & 7;
- *(reg_field++)= new_field;
- if (new_field->real_type() == MYSQL_TYPE_STRING ||
- new_field->real_type() == MYSQL_TYPE_VARCHAR)
- {
- string_count++;
- string_total_length+= new_field->pack_length();
- }
+
thd->mem_root= mem_root_save;
if (!(tmp_item= new (thd->mem_root)
Item_temptable_field(thd, new_field)))
goto err;
arg= sum_item->set_arg(i, thd, tmp_item);
thd->mem_root= &table->mem_root;
- if (param->force_not_null_cols)
- {
- new_field->flags|= NOT_NULL_FLAG;
- new_field->null_ptr= NULL;
- }
+
+ add_field(table, new_field, fieldnr++, param->force_not_null_cols);
+
if (!(new_field->flags & NOT_NULL_FLAG))
{
- null_count++;
/*
new_field->maybe_null() is still false, it will be
changed below. But we have to setup Item_field correctly
*/
arg->maybe_null=1;
}
- new_field->field_index= fieldnr++;
}
}
}
@@ -18215,13 +18254,13 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
The test for item->marker == 4 is ensure we don't create a group-by
key over a bit field as heap tables can't handle that.
*/
- Field *new_field= (param->schema_table) ?
- item->create_field_for_schema(thd, table) :
+ DBUG_ASSERT(!param->schema_table);
+ Field *new_field=
create_tmp_field(table, item, &copy_func,
- tmp_from_field, &default_field[fieldnr],
- group != 0,
- !force_copy_fields &&
- (not_all_columns || group !=0),
+ tmp_from_field, &m_default_field[fieldnr],
+ m_group != 0,
+ !param->force_copy_fields &&
+ (not_all_columns || m_group !=0),
/*
If item->marker == 4 then we force create_tmp_field
to create a 64-bit longs for BIT fields because HEAP
@@ -18230,14 +18269,13 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
to be usable in this case too.
*/
item->marker == 4 || param->bit_fields_as_long,
- force_copy_fields);
+ param->force_copy_fields);
if (!new_field)
{
if (unlikely(thd->is_fatal_error))
goto err; // Got OOM
continue; // Some kind of const item
}
- DBUG_ASSERT(!new_field->field_name.str || strlen(new_field->field_name.str) == new_field->field_name.length);
if (type == Item::SUM_FUNC_ITEM)
{
Item_sum *agg_item= (Item_sum *) item;
@@ -18264,82 +18302,92 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
agg_item->result_field= new_field;
}
tmp_from_field++;
- if (param->force_not_null_cols)
- {
- new_field->flags|= NOT_NULL_FLAG;
- new_field->null_ptr= NULL;
- }
- reclength+=new_field->pack_length();
- if (!(new_field->flags & NOT_NULL_FLAG))
- null_count++;
- if (new_field->type() == MYSQL_TYPE_BIT)
- total_uneven_bit_length+= new_field->field_length & 7;
- if (new_field->flags & BLOB_FLAG)
- {
- *blob_field++= fieldnr;
- blob_count++;
- }
- if (new_field->real_type() == MYSQL_TYPE_STRING ||
- new_field->real_type() == MYSQL_TYPE_VARCHAR)
- {
- string_count++;
- string_total_length+= new_field->pack_length();
- }
+ add_field(table, new_field, fieldnr++, param->force_not_null_cols);
if (item->marker == 4 && item->maybe_null)
{
- group_null_items++;
+ m_group_null_items++;
new_field->flags|= GROUP_FLAG;
}
- new_field->field_index= fieldnr++;
- *(reg_field++)= new_field;
}
- if (!--hidden_field_count)
+ if (!--m_hidden_field_count)
{
/*
This was the last hidden field; Remember how many hidden fields could
have null
*/
- hidden_null_count=null_count;
+ m_hidden_null_count= m_null_count;
/*
We need to update hidden_field_count as we may have stored group
functions with constant arguments
*/
param->hidden_field_count= fieldnr;
- null_count= 0;
+ m_null_count= 0;
/*
On last hidden field we store uneven bit length in
- hidden_uneven_bit_length and proceed calculation of
- uneven bits for visible fields into
- total_uneven_bit_length variable.
+ m_hidden_uneven_bit_length and proceed calculation of
+ uneven bits for visible fields into m_uneven_bit_length.
*/
- hidden_uneven_bit_length= total_uneven_bit_length;
- total_uneven_bit_length= 0;
+ m_hidden_uneven_bit_length= m_uneven_bit_length;
+ m_uneven_bit_length= 0;
}
}
- DBUG_ASSERT(fieldnr == (uint) (reg_field - table->field));
- DBUG_ASSERT(field_count >= (uint) (reg_field - table->field));
- field_count= fieldnr;
- *reg_field= 0;
- *blob_field= 0; // End marker
- share->fields= field_count;
+ share->fields= fieldnr;
+ share->blob_fields= m_blob_count;
+ table->field[fieldnr]= 0; // End marker
+ share->blob_field[m_blob_count]= 0; // End marker
+ copy_func[0]= 0; // End marker
+ param->func_count= (uint) (copy_func - param->items_to_copy);
share->column_bitmap_size= bitmap_buffer_size(share->fields);
+ thd->mem_root= mem_root_save;
+ DBUG_RETURN(false);
+
+err:
+ thd->mem_root= mem_root_save;
+ DBUG_RETURN(true);
+}
+
+
+bool Create_tmp_table::finalize(THD *thd,
+ TABLE *table,
+ TMP_TABLE_PARAM *param,
+ bool do_not_open, bool keep_row_order)
+{
+ DBUG_ENTER("Create_tmp_table::finalize");
+ DBUG_ASSERT(table);
+
+ uint hidden_null_pack_length;
+ uint null_pack_length;
+ bool use_packed_rows= false;
+ uchar *pos;
+ uchar *null_flags;
+ KEY *keyinfo;
+ TMP_ENGINE_COLUMNDEF *recinfo;
+ TABLE_SHARE *share= table->s;
+ Copy_field *copy= param->copy_field;
+
+ MEM_ROOT *mem_root_save= thd->mem_root;
+ thd->mem_root= &table->mem_root;
+
+ DBUG_ASSERT(m_alloced_field_count >= share->fields);
+ DBUG_ASSERT(m_alloced_field_count >= share->blob_fields);
+
/* If result table is small; use a heap */
/* future: storage engine selection can be made dynamic? */
- if (blob_count || using_unique_constraint
- || (thd->variables.big_tables && !(select_options & SELECT_SMALL_RESULT))
- || (select_options & TMP_TABLE_FORCE_MYISAM)
+ if (share->blob_fields || m_using_unique_constraint
+ || (thd->variables.big_tables && !(m_select_options & SELECT_SMALL_RESULT))
+ || (m_select_options & TMP_TABLE_FORCE_MYISAM)
|| thd->variables.tmp_memory_table_size == 0)
{
share->db_plugin= ha_lock_engine(0, TMP_ENGINE_HTON);
table->file= get_new_handler(share, &table->mem_root,
share->db_type());
- if (group &&
+ if (m_group &&
(param->group_parts > table->file->max_key_parts() ||
param->group_length > table->file->max_key_length()))
- using_unique_constraint= true;
+ m_using_unique_constraint= true;
}
else
{
@@ -18356,35 +18404,33 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
goto err;
}
- if (!using_unique_constraint)
- reclength+= group_null_items; // null flag is stored separately
+ if (!m_using_unique_constraint)
+ share->reclength+= m_group_null_items; // null flag is stored separately
- share->blob_fields= blob_count;
- if (blob_count == 0)
+ if (share->blob_fields == 0)
{
/* We need to ensure that first byte is not 0 for the delete link */
if (param->hidden_field_count)
- hidden_null_count++;
+ m_hidden_null_count++;
else
- null_count++;
+ m_null_count++;
}
- hidden_null_pack_length= (hidden_null_count + 7 +
- hidden_uneven_bit_length) / 8;
+ hidden_null_pack_length= (m_hidden_null_count + 7 +
+ m_hidden_uneven_bit_length) / 8;
null_pack_length= (hidden_null_pack_length +
- (null_count + total_uneven_bit_length + 7) / 8);
- reclength+=null_pack_length;
- if (!reclength)
- reclength=1; // Dummy select
+ (m_null_count + m_uneven_bit_length + 7) / 8);
+ share->reclength+= null_pack_length;
+ if (!share->reclength)
+ share->reclength= 1; // Dummy select
/* Use packed rows if there is blobs or a lot of space to gain */
- if (blob_count ||
- (string_total_length >= STRING_TOTAL_LENGTH_TO_PACK_ROWS &&
- (reclength / string_total_length <= RATIO_TO_PACK_ROWS ||
- string_total_length / string_count >= AVG_STRING_LENGTH_TO_PACK_ROWS)))
+ if (share->blob_fields ||
+ (string_total_length() >= STRING_TOTAL_LENGTH_TO_PACK_ROWS &&
+ (share->reclength / string_total_length() <= RATIO_TO_PACK_ROWS ||
+ string_total_length() / string_count() >= AVG_STRING_LENGTH_TO_PACK_ROWS)))
use_packed_rows= 1;
- share->reclength= reclength;
{
- uint alloc_length=ALIGN_SIZE(reclength+MI_UNIQUE_HASH_LENGTH+1);
+ uint alloc_length= ALIGN_SIZE(share->reclength + MI_UNIQUE_HASH_LENGTH+1);
share->rec_buff_length= alloc_length;
if (!(table->record[0]= (uchar*)
alloc_root(&table->mem_root, alloc_length*3)))
@@ -18392,10 +18438,8 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
table->record[1]= table->record[0]+alloc_length;
share->default_values= table->record[1]+alloc_length;
}
- copy_func[0]=0; // End marker
- param->func_count= (uint)(copy_func - param->items_to_copy);
- setup_tmp_table_column_bitmaps(table, bitmaps);
+ setup_tmp_table_column_bitmaps(table, m_bitmaps);
recinfo=param->start_recinfo;
null_flags=(uchar*) table->record[0];
@@ -18409,33 +18453,33 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
bfill(null_flags,null_pack_length,255); // Set null fields
table->null_flags= (uchar*) table->record[0];
- share->null_fields= null_count+ hidden_null_count;
+ share->null_fields= m_null_count + m_hidden_null_count;
share->null_bytes= share->null_bytes_for_compare= null_pack_length;
}
- null_count= (blob_count == 0) ? 1 : 0;
- hidden_field_count=param->hidden_field_count;
- for (i=0,reg_field=table->field; i < field_count; i++,reg_field++,recinfo++)
+ m_null_count= (share->blob_fields == 0) ? 1 : 0;
+ m_hidden_field_count= param->hidden_field_count;
+ for (uint i= 0; i < share->fields; i++, recinfo++)
{
- Field *field= *reg_field;
+ Field *field= table->field[i];
uint length;
bzero((uchar*) recinfo,sizeof(*recinfo));
if (!(field->flags & NOT_NULL_FLAG))
{
- recinfo->null_bit= (uint8)1 << (null_count & 7);
- recinfo->null_pos= null_count/8;
- field->move_field(pos,null_flags+null_count/8,
- (uint8)1 << (null_count & 7));
- null_count++;
+ recinfo->null_bit= (uint8)1 << (m_null_count & 7);
+ recinfo->null_pos= m_null_count/8;
+ field->move_field(pos, null_flags + m_null_count/8,
+ (uint8)1 << (m_null_count & 7));
+ m_null_count++;
}
else
field->move_field(pos,(uchar*) 0,0);
if (field->type() == MYSQL_TYPE_BIT)
{
/* We have to reserve place for extra bits among null bits */
- ((Field_bit*) field)->set_bit_ptr(null_flags + null_count / 8,
- null_count & 7);
- null_count+= (field->field_length & 7);
+ ((Field_bit*) field)->set_bit_ptr(null_flags + m_null_count / 8,
+ m_null_count & 7);
+ m_null_count+= (field->field_length & 7);
}
field->reset();
@@ -18443,14 +18487,14 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
Test if there is a default field value. The test for ->ptr is to skip
'offset' fields generated by initalize_tables
*/
- if (default_field[i] && default_field[i]->ptr)
+ if (m_default_field[i] && m_default_field[i]->ptr)
{
/*
default_field[i] is set only in the cases when 'field' can
inherit the default value that is defined for the field referred
by the Item_field object from which 'field' has been created.
*/
- const Field *orig_field= default_field[i];
+ const Field *orig_field= m_default_field[i];
/* Get the value from default_values */
if (orig_field->is_null_in_record(orig_field->table->s->default_values))
field->set_null();
@@ -18463,9 +18507,9 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
}
}
- if (from_field[i])
+ if (m_from_field[i])
{ /* Not a table Item */
- copy->set(field,from_field[i],save_sum_fields);
+ copy->set(field, m_from_field[i], m_save_sum_fields);
copy++;
}
length=field->pack_length();
@@ -18473,25 +18517,15 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
/* Make entry for create table */
recinfo->length=length;
- if (field->flags & BLOB_FLAG)
- recinfo->type= FIELD_BLOB;
- else if (use_packed_rows &&
- field->real_type() == MYSQL_TYPE_STRING &&
- length >= MIN_STRING_LENGTH_TO_PACK_ROWS)
- recinfo->type= FIELD_SKIP_ENDSPACE;
- else if (field->real_type() == MYSQL_TYPE_VARCHAR)
- recinfo->type= FIELD_VARCHAR;
- else
- recinfo->type= FIELD_NORMAL;
-
- if (!--hidden_field_count)
- null_count=(null_count+7) & ~7; // move to next byte
+ recinfo->type= field->tmp_engine_column_type(use_packed_rows);
+ if (!--m_hidden_field_count)
+ m_null_count= (m_null_count + 7) & ~7; // move to next byte
// fix table name in field entry
field->set_table_name(&table->alias);
}
- param->copy_field_end=copy;
+ param->copy_field_end= copy;
param->recinfo= recinfo; // Pointer to after last field
store_record(table,s->default_values); // Make empty default record
@@ -18501,29 +18535,29 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
share->max_rows= (ha_rows) (((share->db_type() == heap_hton) ?
MY_MIN(thd->variables.tmp_memory_table_size,
thd->variables.max_heap_table_size) :
- thd->variables.tmp_memory_table_size) /
+ thd->variables.tmp_disk_table_size) /
share->reclength);
set_if_bigger(share->max_rows,1); // For dummy start options
/*
Push the LIMIT clause to the temporary table creation, so that we
materialize only up to 'rows_limit' records instead of all result records.
*/
- set_if_smaller(share->max_rows, rows_limit);
- param->end_write_records= rows_limit;
+ set_if_smaller(share->max_rows, m_rows_limit);
+ param->end_write_records= m_rows_limit;
keyinfo= param->keyinfo;
- if (group)
+ if (m_group)
{
DBUG_PRINT("info",("Creating group key in temporary table"));
- table->group=group; /* Table is grouped by key */
- param->group_buff=group_buff;
+ table->group= m_group; /* Table is grouped by key */
+ param->group_buff= m_group_buff;
share->keys=1;
- share->uniques= MY_TEST(using_unique_constraint);
+ share->uniques= MY_TEST(m_using_unique_constraint);
table->key_info= table->s->key_info= keyinfo;
table->keys_in_use_for_query.set_bit(0);
share->keys_in_use.set_bit(0);
- keyinfo->key_part=key_part_info;
+ keyinfo->key_part= m_key_part_info;
keyinfo->flags=HA_NOSAME | HA_BINARY_PACK_KEY | HA_PACK_KEY;
keyinfo->ext_key_flags= keyinfo->flags;
keyinfo->usable_key_parts=keyinfo->user_defined_key_parts= param->group_parts;
@@ -18535,29 +18569,29 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
keyinfo->algorithm= HA_KEY_ALG_UNDEF;
keyinfo->is_statistics_from_stat_tables= FALSE;
keyinfo->name= group_key;
- ORDER *cur_group= group;
- for (; cur_group ; cur_group= cur_group->next, key_part_info++)
+ ORDER *cur_group= m_group;
+ for (; cur_group ; cur_group= cur_group->next, m_key_part_info++)
{
Field *field=(*cur_group->item)->get_tmp_table_field();
DBUG_ASSERT(field->table == table);
bool maybe_null=(*cur_group->item)->maybe_null;
- key_part_info->null_bit=0;
- key_part_info->field= field;
- key_part_info->fieldnr= field->field_index + 1;
- if (cur_group == group)
+ m_key_part_info->null_bit=0;
+ m_key_part_info->field= field;
+ m_key_part_info->fieldnr= field->field_index + 1;
+ if (cur_group == m_group)
field->key_start.set_bit(0);
- key_part_info->offset= field->offset(table->record[0]);
- key_part_info->length= (uint16) field->key_length();
- key_part_info->type= (uint8) field->key_type();
- key_part_info->key_type =
- ((ha_base_keytype) key_part_info->type == HA_KEYTYPE_TEXT ||
- (ha_base_keytype) key_part_info->type == HA_KEYTYPE_VARTEXT1 ||
- (ha_base_keytype) key_part_info->type == HA_KEYTYPE_VARTEXT2) ?
+ m_key_part_info->offset= field->offset(table->record[0]);
+ m_key_part_info->length= (uint16) field->key_length();
+ m_key_part_info->type= (uint8) field->key_type();
+ m_key_part_info->key_type =
+ ((ha_base_keytype) m_key_part_info->type == HA_KEYTYPE_TEXT ||
+ (ha_base_keytype) m_key_part_info->type == HA_KEYTYPE_VARTEXT1 ||
+ (ha_base_keytype) m_key_part_info->type == HA_KEYTYPE_VARTEXT2) ?
0 : FIELDFLAG_BINARY;
- key_part_info->key_part_flag= 0;
- if (!using_unique_constraint)
+ m_key_part_info->key_part_flag= 0;
+ if (!m_using_unique_constraint)
{
- cur_group->buff=(char*) group_buff;
+ cur_group->buff=(char*) m_group_buff;
if (maybe_null && !field->null_bit)
{
@@ -18572,9 +18606,9 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
}
if (!(cur_group->field= field->new_key_field(thd->mem_root,table,
- group_buff +
+ m_group_buff +
MY_TEST(maybe_null),
- key_part_info->length,
+ m_key_part_info->length,
field->null_ptr,
field->null_bit)))
goto err; /* purecov: inspected */
@@ -18588,26 +18622,28 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
The NULL flag is updated in 'end_update()' and 'end_write()'
*/
keyinfo->flags|= HA_NULL_ARE_EQUAL; // def. that NULL == NULL
- key_part_info->null_bit=field->null_bit;
- key_part_info->null_offset= (uint) (field->null_ptr -
+ m_key_part_info->null_bit=field->null_bit;
+ m_key_part_info->null_offset= (uint) (field->null_ptr -
(uchar*) table->record[0]);
cur_group->buff++; // Pointer to field data
- group_buff++; // Skipp null flag
+ m_group_buff++; // Skipp null flag
}
- group_buff+= cur_group->field->pack_length();
+ m_group_buff+= cur_group->field->pack_length();
}
- keyinfo->key_length+= key_part_info->length;
+ keyinfo->key_length+= m_key_part_info->length;
}
/*
Ensure we didn't overrun the group buffer. The < is only true when
some maybe_null fields was changed to be not null fields.
*/
- DBUG_ASSERT(using_unique_constraint ||
- group_buff <= param->group_buff + param->group_length);
+ DBUG_ASSERT(m_using_unique_constraint ||
+ m_group_buff <= param->group_buff + param->group_length);
}
- if (distinct && field_count != param->hidden_field_count)
+ if (m_distinct && share->fields != param->hidden_field_count)
{
+ uint i;
+ Field **reg_field;
/*
Create an unique key or an unique constraint over all columns
that should be in the result. In the temporary table, there are
@@ -18616,7 +18652,7 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
*/
DBUG_PRINT("info",("hidden_field_count: %d", param->hidden_field_count));
- if (blob_count)
+ if (share->blob_fields)
{
/*
Special mode for index creation in MyISAM used to support unique
@@ -18627,21 +18663,21 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
}
null_pack_length-=hidden_null_pack_length;
keyinfo->user_defined_key_parts=
- ((field_count-param->hidden_field_count)+
+ ((share->fields - param->hidden_field_count)+
(share->uniques ? MY_TEST(null_pack_length) : 0));
keyinfo->ext_key_parts= keyinfo->user_defined_key_parts;
keyinfo->usable_key_parts= keyinfo->user_defined_key_parts;
table->distinct= 1;
share->keys= 1;
- if (!(key_part_info= (KEY_PART_INFO*)
+ if (!(m_key_part_info= (KEY_PART_INFO*)
alloc_root(&table->mem_root,
keyinfo->user_defined_key_parts * sizeof(KEY_PART_INFO))))
goto err;
- bzero((void*) key_part_info, keyinfo->user_defined_key_parts * sizeof(KEY_PART_INFO));
+ bzero((void*) m_key_part_info, keyinfo->user_defined_key_parts * sizeof(KEY_PART_INFO));
table->keys_in_use_for_query.set_bit(0);
share->keys_in_use.set_bit(0);
table->key_info= table->s->key_info= keyinfo;
- keyinfo->key_part=key_part_info;
+ keyinfo->key_part= m_key_part_info;
keyinfo->flags=HA_NOSAME | HA_NULL_ARE_EQUAL | HA_BINARY_PACK_KEY | HA_PACK_KEY;
keyinfo->ext_key_flags= keyinfo->flags;
keyinfo->key_length= 0; // Will compute the sum of the parts below.
@@ -18673,39 +18709,39 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
*/
if (null_pack_length && share->uniques)
{
- key_part_info->null_bit=0;
- key_part_info->offset=hidden_null_pack_length;
- key_part_info->length=null_pack_length;
- key_part_info->field= new Field_string(table->record[0],
- (uint32) key_part_info->length,
+ m_key_part_info->null_bit=0;
+ m_key_part_info->offset=hidden_null_pack_length;
+ m_key_part_info->length=null_pack_length;
+ m_key_part_info->field= new Field_string(table->record[0],
+ (uint32) m_key_part_info->length,
(uchar*) 0,
(uint) 0,
Field::NONE,
&null_clex_str, &my_charset_bin);
- if (!key_part_info->field)
+ if (!m_key_part_info->field)
goto err;
- key_part_info->field->init(table);
- key_part_info->key_type=FIELDFLAG_BINARY;
- key_part_info->type= HA_KEYTYPE_BINARY;
- key_part_info->fieldnr= key_part_info->field->field_index + 1;
- key_part_info++;
+ m_key_part_info->field->init(table);
+ m_key_part_info->key_type=FIELDFLAG_BINARY;
+ m_key_part_info->type= HA_KEYTYPE_BINARY;
+ m_key_part_info->fieldnr= m_key_part_info->field->field_index + 1;
+ m_key_part_info++;
}
/* Create a distinct key over the columns we are going to return */
- for (i=param->hidden_field_count, reg_field=table->field + i ;
- i < field_count;
- i++, reg_field++, key_part_info++)
+ for (i= param->hidden_field_count, reg_field= table->field + i ;
+ i < share->fields;
+ i++, reg_field++, m_key_part_info++)
{
- key_part_info->field= *reg_field;
+ m_key_part_info->field= *reg_field;
(*reg_field)->flags |= PART_KEY_FLAG;
- if (key_part_info == keyinfo->key_part)
+ if (m_key_part_info == keyinfo->key_part)
(*reg_field)->key_start.set_bit(0);
- key_part_info->null_bit= (*reg_field)->null_bit;
- key_part_info->null_offset= (uint) ((*reg_field)->null_ptr -
+ m_key_part_info->null_bit= (*reg_field)->null_bit;
+ m_key_part_info->null_offset= (uint) ((*reg_field)->null_ptr -
(uchar*) table->record[0]);
- key_part_info->offset= (*reg_field)->offset(table->record[0]);
- key_part_info->length= (uint16) (*reg_field)->pack_length();
- key_part_info->fieldnr= (*reg_field)->field_index + 1;
+ m_key_part_info->offset= (*reg_field)->offset(table->record[0]);
+ m_key_part_info->length= (uint16) (*reg_field)->pack_length();
+ m_key_part_info->fieldnr= (*reg_field)->field_index + 1;
/* TODO:
The below method of computing the key format length of the
key part is a copy/paste from opt_range.cc, and table.cc.
@@ -18714,33 +18750,22 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
methods is supposed to compute the same length. If so, it
might be reused.
*/
- key_part_info->store_length= key_part_info->length;
+ m_key_part_info->store_length= m_key_part_info->length;
if ((*reg_field)->real_maybe_null())
{
- key_part_info->store_length+= HA_KEY_NULL_LENGTH;
- key_part_info->key_part_flag |= HA_NULL_PART;
+ m_key_part_info->store_length+= HA_KEY_NULL_LENGTH;
+ m_key_part_info->key_part_flag |= HA_NULL_PART;
}
- if ((*reg_field)->type() == MYSQL_TYPE_BLOB ||
- (*reg_field)->real_type() == MYSQL_TYPE_VARCHAR ||
- (*reg_field)->type() == MYSQL_TYPE_GEOMETRY)
- {
- if ((*reg_field)->type() == MYSQL_TYPE_BLOB ||
- (*reg_field)->type() == MYSQL_TYPE_GEOMETRY)
- key_part_info->key_part_flag|= HA_BLOB_PART;
- else
- key_part_info->key_part_flag|= HA_VAR_LENGTH_PART;
+ m_key_part_info->key_part_flag|= (*reg_field)->key_part_flag();
+ m_key_part_info->store_length+= (*reg_field)->key_part_length_bytes();
+ keyinfo->key_length+= m_key_part_info->store_length;
- key_part_info->store_length+=HA_KEY_BLOB_LENGTH;
- }
-
- keyinfo->key_length+= key_part_info->store_length;
-
- key_part_info->type= (uint8) (*reg_field)->key_type();
- key_part_info->key_type =
- ((ha_base_keytype) key_part_info->type == HA_KEYTYPE_TEXT ||
- (ha_base_keytype) key_part_info->type == HA_KEYTYPE_VARTEXT1 ||
- (ha_base_keytype) key_part_info->type == HA_KEYTYPE_VARTEXT2) ?
+ m_key_part_info->type= (uint8) (*reg_field)->key_type();
+ m_key_part_info->key_type =
+ ((ha_base_keytype) m_key_part_info->type == HA_KEYTYPE_TEXT ||
+ (ha_base_keytype) m_key_part_info->type == HA_KEYTYPE_VARTEXT1 ||
+ (ha_base_keytype) m_key_part_info->type == HA_KEYTYPE_VARTEXT2) ?
0 : FIELDFLAG_BINARY;
}
}
@@ -18755,7 +18780,7 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
if (!do_not_open)
{
if (instantiate_tmp_table(table, param->keyinfo, param->start_recinfo,
- &param->recinfo, select_options))
+ &param->recinfo, m_select_options))
goto err;
}
@@ -18764,14 +18789,109 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
thd->mem_root= mem_root_save;
- DBUG_RETURN(table);
+ DBUG_RETURN(false);
err:
thd->mem_root= mem_root_save;
- free_tmp_table(thd,table); /* purecov: inspected */
- if (temp_pool_slot != MY_BIT_NONE)
- bitmap_lock_clear_bit(&temp_pool, temp_pool_slot);
- DBUG_RETURN(NULL); /* purecov: inspected */
+ DBUG_RETURN(true); /* purecov: inspected */
+}
+
+
+bool Create_tmp_table::add_schema_fields(THD *thd, TABLE *table,
+ TMP_TABLE_PARAM *param,
+ const ST_SCHEMA_TABLE &schema_table,
+ const MY_BITMAP &bitmap)
+{
+ DBUG_ENTER("Create_tmp_table::add_schema_fields");
+ DBUG_ASSERT(table);
+ DBUG_ASSERT(table->field);
+ DBUG_ASSERT(table->s->blob_field);
+ DBUG_ASSERT(table->s->reclength == 0);
+ DBUG_ASSERT(table->s->fields == 0);
+ DBUG_ASSERT(table->s->blob_fields == 0);
+
+ TABLE_SHARE *share= table->s;
+ ST_FIELD_INFO *defs= schema_table.fields_info;
+ uint fieldnr;
+ MEM_ROOT *mem_root_save= thd->mem_root;
+ thd->mem_root= &table->mem_root;
+
+ for (fieldnr= 0; !defs[fieldnr].end_marker(); fieldnr++)
+ {
+ const ST_FIELD_INFO &def= defs[fieldnr];
+ bool visible= bitmap_is_set(&bitmap, fieldnr);
+ Record_addr addr(def.nullable());
+ const Type_handler *h= def.type_handler();
+ Field *field= h->make_schema_field(&table->mem_root, table,
+ addr, def, visible);
+ if (!field)
+ {
+ thd->mem_root= mem_root_save;
+ DBUG_RETURN(true); // EOM
+ }
+ field->init(table);
+ add_field(table, field, fieldnr, param->force_not_null_cols);
+ }
+
+ share->fields= fieldnr;
+ share->blob_fields= m_blob_count;
+ table->field[fieldnr]= 0; // End marker
+ share->blob_field[m_blob_count]= 0; // End marker
+ param->func_count= 0;
+ share->column_bitmap_size= bitmap_buffer_size(share->fields);
+
+ thd->mem_root= mem_root_save;
+ DBUG_RETURN(false);
+}
+
+
+void Create_tmp_table::cleanup_on_failure(THD *thd, TABLE *table)
+{
+ if (table)
+ free_tmp_table(thd, table);
+ if (m_temp_pool_slot != MY_BIT_NONE)
+ bitmap_lock_clear_bit(&temp_pool, m_temp_pool_slot);
+}
+
+
+TABLE *create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
+ ORDER *group, bool distinct, bool save_sum_fields,
+ ulonglong select_options, ha_rows rows_limit,
+ const LEX_CSTRING *table_alias, bool do_not_open,
+ bool keep_row_order)
+{
+ TABLE *table;
+ Create_tmp_table maker(param, group,
+ distinct, save_sum_fields, select_options, rows_limit);
+ if (!(table= maker.start(thd, param, table_alias)) ||
+ maker.add_fields(thd, table, param, fields) ||
+ maker.finalize(thd, table, param, do_not_open, keep_row_order))
+ {
+ maker.cleanup_on_failure(thd, table);
+ return NULL;
+ }
+ return table;
+}
+
+
+TABLE *create_tmp_table_for_schema(THD *thd, TMP_TABLE_PARAM *param,
+ const ST_SCHEMA_TABLE &schema_table,
+ const MY_BITMAP &bitmap,
+ longlong select_options,
+ const LEX_CSTRING &table_alias,
+ bool keep_row_order)
+{
+ TABLE *table;
+ Create_tmp_table maker(param, (ORDER *) NULL, false, false,
+ select_options, HA_POS_ERROR);
+ if (!(table= maker.start(thd, param, &table_alias)) ||
+ maker.add_schema_fields(thd, table, param, schema_table, bitmap) ||
+ maker.finalize(thd, table, param, false, keep_row_order))
+ {
+ maker.cleanup_on_failure(thd, table);
+ return NULL;
+ }
+ return table;
}
@@ -19646,8 +19766,7 @@ do_select(JOIN *join, Procedure *procedure)
if (join->pushdown_query->store_data_in_temp_table)
{
- JOIN_TAB *last_tab= join->join_tab + join->table_count -
- join->exec_join_tab_cnt();
+ JOIN_TAB *last_tab= join->join_tab + join->exec_join_tab_cnt();
last_tab->next_select= end_send;
enum_nested_loop_state state= last_tab->aggr->end_send();
@@ -25399,8 +25518,9 @@ static bool change_group_ref(THD *thd, Item_func *expr, ORDER *group_list,
{
Item *new_item;
if (!(new_item= new (thd->mem_root) Item_ref(thd, context,
- group_tmp->item, 0,
- &item->name)))
+ group_tmp->item,
+ null_clex_str,
+ item->name)))
return 1; // fatal_error is set
thd->change_item_tree(arg, new_item);
arg_changed= TRUE;
@@ -26139,16 +26259,14 @@ bool JOIN_TAB::save_explain_data(Explain_table_access *eta,
table_list->schema_table->i_s_requested_object & OPTIMIZE_I_S_TABLE)
{
IS_table_read_plan *is_table_read_plan= table_list->is_table_read_plan;
- const char *tmp_buff;
- int f_idx;
StringBuffer<64> key_name_buf;
if (is_table_read_plan->trivial_show_command ||
is_table_read_plan->has_db_lookup_value())
{
/* The "key" has the name of the column referring to the database */
- f_idx= table_list->schema_table->idx_field1;
- tmp_buff= table_list->schema_table->fields_info[f_idx].field_name;
- key_name_buf.append(tmp_buff, strlen(tmp_buff), cs);
+ int f_idx= table_list->schema_table->idx_field1;
+ LEX_CSTRING tmp= table_list->schema_table->fields_info[f_idx].name();
+ key_name_buf.append(tmp, cs);
}
if (is_table_read_plan->trivial_show_command ||
is_table_read_plan->has_table_lookup_value())
@@ -26157,9 +26275,9 @@ bool JOIN_TAB::save_explain_data(Explain_table_access *eta,
is_table_read_plan->has_db_lookup_value())
key_name_buf.append(',');
- f_idx= table_list->schema_table->idx_field2;
- tmp_buff= table_list->schema_table->fields_info[f_idx].field_name;
- key_name_buf.append(tmp_buff, strlen(tmp_buff), cs);
+ int f_idx= table_list->schema_table->idx_field2;
+ LEX_CSTRING tmp= table_list->schema_table->fields_info[f_idx].name();
+ key_name_buf.append(tmp, cs);
}
if (key_name_buf.length())
@@ -28583,5 +28701,278 @@ select_handler *SELECT_LEX::find_select_handler(THD *thd)
/**
+ @brief
+ Construct not null conditions for provingly not nullable fields
+
+ @details
+ For each non-constant joined table the function creates a conjunction
+ of IS NOT NULL predicates containing a predicate for each field used
+ in the WHERE clause or an OR expression such that
+ - is declared as nullable
+ - for which it can proved be that it is null-rejected
+ - is a part of some index.
+ This conjunction could be anded with either the WHERE condition or with
+ an ON expression and the modified join query would produce the same
+ result set as the original one.
+ If a conjunction of IS NOT NULL predicates is constructed for an inner
+ table of an outer join OJ that is not an inner table of embedded outer
+ joins then it is to be anded with the ON expression of OJ.
+ The constructed conjunctions of IS NOT NULL predicates are attached
+ to the corresponding tables. They used for range analysis complementary
+ to other sargable range conditions.
+
+ @note
+ Let f be a field of the joined table t. In the context of the upper
+ paragraph field f is called null-rejected if any the following holds:
+
+ - t is a table of a top inner join and a conjunctive formula that rejects
+ rows with null values for f can be extracted from the WHERE condition
+
+ - t is an outer table of a top outer join operation and a conjunctive
+ formula over the outer tables of the outer join that rejects rows with
+ null values for can be extracted from the WHERE condition
+
+ - t is an outer table of a non-top outer join operation and a conjunctive
+ formula over the outer tables of the outer join that rejects rows with
+ null values for f can be extracted from the ON expression of the
+ embedding outer join
+
+ - the joined table is an inner table of a outer join operation and
+ a conjunctive formula over inner tables of the outer join that rejects
+ rows with null values for f can be extracted from the ON expression of
+ the outer join operation.
+
+ It is assumed above that all inner join nests have been eliminated and
+ that all possible conversions of outer joins into inner joins have been
+ already done.
+*/
+
+void JOIN::make_notnull_conds_for_range_scans()
+{
+ DBUG_ENTER("JOIN::make_notnull_conds_for_range_scans");
+
+
+ if (impossible_where ||
+ !optimizer_flag(thd, OPTIMIZER_SWITCH_NOT_NULL_RANGE_SCAN))
+ {
+ /* Complementary range analysis is not needed */
+ DBUG_VOID_RETURN;
+ }
+
+ if (conds && build_notnull_conds_for_range_scans(this, conds,
+ conds->used_tables()))
+ {
+ Item *false_cond= new (thd->mem_root) Item_int(thd, (longlong) 0, 1);
+ if (false_cond)
+ {
+ /*
+ Found a IS NULL conjunctive predicate for a null-rejected field
+ in the WHERE clause
+ */
+ conds= false_cond;
+ cond_equal= 0;
+ impossible_where= true;
+ }
+ DBUG_VOID_RETURN;
+ }
+
+ List_iterator<TABLE_LIST> li(*join_list);
+ TABLE_LIST *tbl;
+ while ((tbl= li++))
+ {
+ if (tbl->on_expr)
+ {
+ if (tbl->nested_join)
+ {
+ build_notnull_conds_for_inner_nest_of_outer_join(this, tbl);
+ }
+ else if (build_notnull_conds_for_range_scans(this, tbl->on_expr,
+ tbl->table->map))
+ {
+ /*
+ Found a IS NULL conjunctive predicate for a null-rejected field
+ of the inner table of an outer join with ON expression tbl->on_expr
+ */
+ Item *false_cond= new (thd->mem_root) Item_int(thd, (longlong) 0, 1);
+ if (false_cond)
+ tbl->on_expr= false_cond;
+ }
+ }
+ }
+ DBUG_VOID_RETURN;
+}
+
+
+/**
+ @brief
+ Build not null conditions for range scans of given join tables
+
+ @param join the join for whose tables not null conditions are to be built
+ @param cond the condition from which not null predicates are to be inferred
+ @param allowed the bit map of join tables to be taken into account
+
+ @details
+ For each join table t from the 'allowed' set of tables the function finds
+ all fields whose null-rejectedness can be inferred from null-rejectedness
+ of the condition cond. For each found field f from table t such that it
+ participates at least in one index on table t a NOT NULL predicate is
+ constructed and a conjunction of all such predicates is attached to t.
+ If when looking for null-rejecting fields of t it is discovered one of its
+ fields has to be null-rejected and there is IS NULL conjunctive top level
+ predicate for this field then the function immediately returns true.
+ The function uses the bitmap TABLE::tmp_set to mark found null-rejected
+ fields of table t.
+
+ @note
+ Currently only top level conjuncts without disjunctive sub-formulas are
+ are taken into account when looking for null-rejected fields.
+
+ @retval
+ true if a contradiction is inferred
+ false otherwise
+*/
+
+static
+bool build_notnull_conds_for_range_scans(JOIN *join, Item *cond,
+ table_map allowed)
+{
+ THD *thd= join->thd;
+
+ DBUG_ENTER("build_notnull_conds_for_range_scans");
+
+ for (JOIN_TAB *s= join->join_tab + join->const_tables ;
+ s < join->join_tab + join->table_count ; s++)
+ {
+ /* Clear all needed bitmaps to mark found fields */
+ if (allowed & s->table->map)
+ bitmap_clear_all(&s->table->tmp_set);
+ }
+
+ /*
+ Find all null-rejected fields assuming that cond is null-rejected and
+ only formulas over tables from 'allowed' are to be taken into account
+ */
+ if (cond->find_not_null_fields(allowed))
+ DBUG_RETURN(true);
+
+ /*
+ For each table t from 'allowed' build a conjunction of NOT NULL predicates
+ constructed for all found fields if they are included in some indexes.
+ If the construction of the conjunction succeeds attach the formula to
+ t->table->notnull_cond. The condition will be used to look for complementary
+ range scans.
+ */
+ for (JOIN_TAB *s= join->join_tab + join->const_tables ;
+ s < join->join_tab + join->table_count ; s++)
+ {
+ TABLE *tab= s->table;
+ List<Item> notnull_list;
+ Item *notnull_cond= 0;
+
+ if (!(allowed & tab->map))
+ continue;
+
+ for (Field** field_ptr= tab->field; *field_ptr; field_ptr++)
+ {
+ Field *field= *field_ptr;
+ if (field->part_of_key.is_clear_all())
+ continue;
+ if (!bitmap_is_set(&tab->tmp_set, field->field_index))
+ continue;
+ Item_field *field_item= new (thd->mem_root) Item_field(thd, field);
+ if (!field_item)
+ continue;
+ Item *isnotnull_item=
+ new (thd->mem_root) Item_func_isnotnull(thd, field_item);
+ if (!isnotnull_item)
+ continue;
+ if (notnull_list.push_back(isnotnull_item, thd->mem_root))
+ continue;
+ s->const_keys.merge(field->part_of_key);
+ }
+
+ switch (notnull_list.elements) {
+ case 0:
+ break;
+ case 1:
+ notnull_cond= notnull_list.head();
+ break;
+ default:
+ notnull_cond=
+ new (thd->mem_root) Item_cond_and(thd, notnull_list);
+ }
+ if (notnull_cond && !notnull_cond->fix_fields(thd, 0))
+ {
+ tab->notnull_cond= notnull_cond;
+ }
+ }
+ DBUG_RETURN(false);
+}
+
+
+/**
+ @brief
+ Build not null conditions for inner nest tables of an outer join
+
+ @param join the join for whose table nest not null conditions are to be built
+ @param nest_tbl the nest of the inner tables of an outer join
+
+ @details
+ The function assumes that nest_tbl is the nest of the inner tables of an
+ outer join and so an ON expression for this outer join is attached to
+ nest_tbl.
+ The function selects the tables of the nest_tbl that are not inner tables of
+ embedded outer joins and then it calls build_notnull_conds_for_range_scans()
+ for nest_tbl->on_expr and the bitmap for the selected tables. This call
+ finds all fields belonging to the selected tables whose null-rejectedness
+ can be inferred from the null-rejectedness of nest_tbl->on_expr. After this
+ the function recursively finds all null_rejected fields for the remaining
+ tables from the nest of nest_tbl.
+*/
+
+static
+void build_notnull_conds_for_inner_nest_of_outer_join(JOIN *join,
+ TABLE_LIST *nest_tbl)
+{
+ TABLE_LIST *tbl;
+ table_map used_tables= 0;
+ THD *thd= join->thd;
+ List_iterator<TABLE_LIST> li(nest_tbl->nested_join->join_list);
+
+ while ((tbl= li++))
+ {
+ if (!tbl->on_expr)
+ used_tables|= tbl->table->map;
+ }
+ if (used_tables &&
+ build_notnull_conds_for_range_scans(join, nest_tbl->on_expr, used_tables))
+ {
+ Item *false_cond= new (thd->mem_root) Item_int(thd, (longlong) 0, 1);
+ if (false_cond)
+ nest_tbl->on_expr= false_cond;
+ }
+
+ li.rewind();
+ while ((tbl= li++))
+ {
+ if (tbl->on_expr)
+ {
+ if (tbl->nested_join)
+ {
+ build_notnull_conds_for_inner_nest_of_outer_join(join, tbl);
+ }
+ else if (build_notnull_conds_for_range_scans(join, tbl->on_expr,
+ tbl->table->map))
+ {
+ Item *false_cond= new (thd->mem_root) Item_int(thd, (longlong) 0, 1);
+ if (false_cond)
+ tbl->on_expr= false_cond;
+ }
+ }
+ }
+}
+
+
+/**
@} (end of group Query_Optimizer)
*/
diff --git a/sql/sql_select.h b/sql/sql_select.h
index dcb8326ed8c..4f7bf49f635 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -1782,6 +1782,7 @@ public:
void add_keyuses_for_splitting();
bool inject_best_splitting_cond(table_map remaining_tables);
bool fix_all_splittings_in_plan();
+ void make_notnull_conds_for_range_scans();
bool transform_in_predicates_into_in_subq(THD *thd);
private:
@@ -2425,6 +2426,13 @@ TABLE *create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
ulonglong select_options, ha_rows rows_limit,
const LEX_CSTRING *alias, bool do_not_open=FALSE,
bool keep_row_order= FALSE);
+TABLE *create_tmp_table_for_schema(THD *thd, TMP_TABLE_PARAM *param,
+ const ST_SCHEMA_TABLE &schema_table,
+ const MY_BITMAP &bitmap,
+ longlong select_options,
+ const LEX_CSTRING &alias,
+ bool keep_row_order);
+
void free_tmp_table(THD *thd, TABLE *entry);
bool create_internal_tmp_table_from_heap(THD *thd, TABLE *table,
TMP_ENGINE_COLUMNDEF *start_recinfo,
diff --git a/sql/sql_sequence.cc b/sql/sql_sequence.cc
index 4e8624d6360..544c9b7f436 100644
--- a/sql/sql_sequence.cc
+++ b/sql/sql_sequence.cc
@@ -48,20 +48,20 @@ struct Field_definition
static Field_definition sequence_structure[]=
{
- {"next_not_cached_value", 21, &type_handler_longlong,
+ {"next_not_cached_value", 21, &type_handler_slonglong,
{STRING_WITH_LEN("")}, FL},
- {"minimum_value", 21, &type_handler_longlong, {STRING_WITH_LEN("")}, FL},
- {"maximum_value", 21, &type_handler_longlong, {STRING_WITH_LEN("")}, FL},
- {"start_value", 21, &type_handler_longlong, {STRING_WITH_LEN("start value when sequences is created or value if RESTART is used")}, FL},
- {"increment", 21, &type_handler_longlong,
+ {"minimum_value", 21, &type_handler_slonglong, {STRING_WITH_LEN("")}, FL},
+ {"maximum_value", 21, &type_handler_slonglong, {STRING_WITH_LEN("")}, FL},
+ {"start_value", 21, &type_handler_slonglong, {STRING_WITH_LEN("start value when sequences is created or value if RESTART is used")}, FL},
+ {"increment", 21, &type_handler_slonglong,
{STRING_WITH_LEN("increment value")}, FL},
- {"cache_size", 21, &type_handler_longlong, {STRING_WITH_LEN("")},
+ {"cache_size", 21, &type_handler_ulonglong, {STRING_WITH_LEN("")},
FL | UNSIGNED_FLAG},
- {"cycle_option", 1, &type_handler_tiny, {STRING_WITH_LEN("0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed")},
+ {"cycle_option", 1, &type_handler_utiny, {STRING_WITH_LEN("0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed")},
FL | UNSIGNED_FLAG },
- {"cycle_count", 21, &type_handler_longlong,
+ {"cycle_count", 21, &type_handler_slonglong,
{STRING_WITH_LEN("How many cycles have been done")}, FL},
- {NULL, 0, &type_handler_longlong, {STRING_WITH_LEN("")}, 0}
+ {NULL, 0, &type_handler_slonglong, {STRING_WITH_LEN("")}, 0}
};
#undef FL
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 2d38af625d1..cc04410abdd 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -93,7 +93,6 @@ enum enum_i_s_events_fields
ISE_DB_CL
};
-#define USERNAME_WITH_HOST_CHAR_LENGTH (USERNAME_CHAR_LENGTH + HOSTNAME_LENGTH + 2)
static const LEX_CSTRING trg_action_time_type_names[]=
{
@@ -377,124 +376,6 @@ int fill_all_plugins(THD *thd, TABLE_LIST *tables, COND *cond)
}
-#ifdef HAVE_SPATIAL
-static int fill_spatial_ref_sys(THD *thd, TABLE_LIST *tables, COND *cond)
-{
- DBUG_ENTER("fill_spatial_ref_sys");
- TABLE *table= tables->table;
- CHARSET_INFO *cs= system_charset_info;
- int result= 1;
-
- restore_record(table, s->default_values);
-
- table->field[0]->store(-1, FALSE); /*SRID*/
- table->field[1]->store(STRING_WITH_LEN("Not defined"), cs); /*AUTH_NAME*/
- table->field[2]->store(-1, FALSE); /*AUTH_SRID*/
- table->field[3]->store(STRING_WITH_LEN(
- "LOCAL_CS[\"Spatial reference wasn't specified\","
- "LOCAL_DATUM[\"Unknown\",0]," "UNIT[\"m\",1.0]," "AXIS[\"x\",EAST],"
- "AXIS[\"y\",NORTH]]"), cs);/*SRTEXT*/
- if (schema_table_store_record(thd, table))
- goto exit;
-
- table->field[0]->store(0, TRUE); /*SRID*/
- table->field[1]->store(STRING_WITH_LEN("EPSG"), cs); /*AUTH_NAME*/
- table->field[2]->store(404000, TRUE); /*AUTH_SRID*/
- table->field[3]->store(STRING_WITH_LEN(
- "LOCAL_CS[\"Wildcard 2D cartesian plane in metric unit\","
- "LOCAL_DATUM[\"Unknown\",0]," "UNIT[\"m\",1.0],"
- "AXIS[\"x\",EAST]," "AXIS[\"y\",NORTH],"
- "AUTHORITY[\"EPSG\",\"404000\"]]"), cs);/*SRTEXT*/
- if (schema_table_store_record(thd, table))
- goto exit;
-
- result= 0;
-
-exit:
- DBUG_RETURN(result);
-}
-
-
-static int get_geometry_column_record(THD *thd, TABLE_LIST *tables,
- TABLE *table, bool res,
- const LEX_CSTRING *db_name,
- const LEX_CSTRING *table_name)
-{
- CHARSET_INFO *cs= system_charset_info;
- TABLE *show_table;
- Field **ptr, *field;
- DBUG_ENTER("get_geometry_column_record");
-
- if (res)
- {
- if (thd->lex->sql_command != SQLCOM_SHOW_FIELDS)
- {
- /*
- I.e. we are in SELECT FROM INFORMATION_SCHEMA.COLUMS
- rather than in SHOW COLUMNS
- */
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
- thd->get_stmt_da()->sql_errno(),
- thd->get_stmt_da()->message());
- thd->clear_error();
- res= 0;
- }
- DBUG_RETURN(res);
- }
-
- if (tables->schema_table)
- goto exit;
- show_table= tables->table;
- ptr= show_table->field;
- show_table->use_all_columns(); // Required for default
- restore_record(show_table, s->default_values);
-
- for (; (field= *ptr) ; ptr++)
- if (field->type() == MYSQL_TYPE_GEOMETRY)
- {
- Field_geom *fg= (Field_geom *) field;
-
- DEBUG_SYNC(thd, "get_schema_column");
-
- /* Get default row, with all NULL fields set to NULL */
- restore_record(table, s->default_values);
-
- /*F_TABLE_CATALOG*/
- table->field[0]->store(STRING_WITH_LEN("def"), cs);
- /*F_TABLE_SCHEMA*/
- table->field[1]->store(db_name->str, db_name->length, cs);
- /*F_TABLE_NAME*/
- table->field[2]->store(table_name->str, table_name->length, cs);
- /*G_TABLE_CATALOG*/
- table->field[4]->store(STRING_WITH_LEN("def"), cs);
- /*G_TABLE_SCHEMA*/
- table->field[5]->store(db_name->str, db_name->length, cs);
- /*G_TABLE_NAME*/
- table->field[6]->store(table_name->str, table_name->length, cs);
- /*G_GEOMETRY_COLUMN*/
- table->field[7]->store(field->field_name.str, field->field_name.length,
- cs);
- /*STORAGE_TYPE*/
- table->field[8]->store(1LL, TRUE); /*Always 1 (binary implementation)*/
- /*GEOMETRY_TYPE*/
- table->field[9]->store((longlong) (fg->get_geometry_type()), TRUE);
- /*COORD_DIMENSION*/
- table->field[10]->store(2LL, TRUE);
- /*MAX_PPR*/
- table->field[11]->set_null();
- /*SRID*/
- table->field[12]->store((longlong) (fg->get_srid()), TRUE);
-
- if (schema_table_store_record(thd, table))
- DBUG_RETURN(1);
- }
-
-exit:
- DBUG_RETURN(0);
-}
-#endif /*HAVE_SPATIAL*/
-
-
/***************************************************************************
** List all Authors.
** If you can update it, you get to be in it :)
@@ -1470,7 +1351,7 @@ bool mysqld_show_create_db(THD *thd, LEX_CSTRING *dbname,
LEX_CSTRING *orig_dbname,
const DDL_options_st &options)
{
- char buff[2048];
+ char buff[2048+DATABASE_COMMENT_MAXLEN];
String buffer(buff, sizeof(buff), system_charset_info);
#ifndef NO_EMBEDDED_ACCESS_CHECKS
Security_context *sctx= thd->security_ctx;
@@ -1506,6 +1387,7 @@ bool mysqld_show_create_db(THD *thd, LEX_CSTRING *dbname,
{
*dbname= INFORMATION_SCHEMA_NAME;
create.default_table_charset= system_charset_info;
+ create.schema_comment= NULL;
}
else
{
@@ -1545,6 +1427,13 @@ bool mysqld_show_create_db(THD *thd, LEX_CSTRING *dbname,
}
buffer.append(STRING_WITH_LEN(" */"));
}
+
+ if (create.schema_comment)
+ {
+ buffer.append(STRING_WITH_LEN(" COMMENT "));
+ append_unescaped(&buffer, create.schema_comment->str,
+ create.schema_comment->length);
+ }
protocol->store(buffer.ptr(), buffer.length(), buffer.charset());
if (protocol->write())
@@ -3624,12 +3513,18 @@ const char* get_one_variable(THD *thd,
/* fall through */
case SHOW_ULONG:
case SHOW_LONG_NOFLUSH: // the difference lies in refresh_status()
+#ifndef _WIN64
+ case SHOW_SIZE_T:
+#endif
end= int10_to_str(*(long*) value, buff, 10);
break;
case SHOW_LONGLONG_STATUS:
value= ((char *) status_var + (intptr) value);
/* fall through */
case SHOW_ULONGLONG:
+#ifdef _WIN64
+ case SHOW_SIZE_T:
+#endif
end= longlong10_to_str(*(longlong*) value, buff, 10);
break;
case SHOW_HA_ROWS:
@@ -3958,9 +3853,9 @@ bool get_lookup_value(THD *thd, Item_func *item_func,
ST_SCHEMA_TABLE *schema_table= table->schema_table;
ST_FIELD_INFO *field_info= schema_table->fields_info;
const char *field_name1= schema_table->idx_field1 >= 0 ?
- field_info[schema_table->idx_field1].field_name : "";
+ field_info[schema_table->idx_field1].name().str : "";
const char *field_name2= schema_table->idx_field2 >= 0 ?
- field_info[schema_table->idx_field2].field_name : "";
+ field_info[schema_table->idx_field2].name().str : "";
if (item_func->functype() == Item_func::EQ_FUNC ||
item_func->functype() == Item_func::EQUAL_FUNC)
@@ -4096,9 +3991,9 @@ bool uses_only_table_name_fields(Item *item, TABLE_LIST *table)
ST_SCHEMA_TABLE *schema_table= table->schema_table;
ST_FIELD_INFO *field_info= schema_table->fields_info;
const char *field_name1= schema_table->idx_field1 >= 0 ?
- field_info[schema_table->idx_field1].field_name : "";
+ field_info[schema_table->idx_field1].name().str : "";
const char *field_name2= schema_table->idx_field2 >= 0 ?
- field_info[schema_table->idx_field2].field_name : "";
+ field_info[schema_table->idx_field2].name().str : "";
if (table->table != item_field->field->table ||
(cs->coll->strnncollsp(cs, (uchar *) field_name1, strlen(field_name1),
(uchar *) item_field->field_name.str,
@@ -4801,18 +4696,18 @@ uint get_table_open_method(TABLE_LIST *tables,
if (schema_table->i_s_requested_object & OPTIMIZE_I_S_TABLE)
{
Field **ptr, *field;
- int table_open_method= 0, field_indx= 0;
+ uint table_open_method= 0, field_indx= 0;
uint star_table_open_method= OPEN_FULL_TABLE;
bool used_star= true; // true if '*' is used in select
for (ptr=tables->table->field; (field= *ptr) ; ptr++)
{
+ const ST_FIELD_INFO &def= schema_table->fields_info[field_indx];
star_table_open_method=
- MY_MIN(star_table_open_method,
- schema_table->fields_info[field_indx].open_method);
+ MY_MIN(star_table_open_method, (uint) def.open_method());
if (bitmap_is_set(tables->table->read_set, field->field_index))
{
used_star= false;
- table_open_method|= schema_table->fields_info[field_indx].open_method;
+ table_open_method|= (uint) def.open_method();
}
field_indx++;
}
@@ -5308,14 +5203,17 @@ err:
}
-bool store_schema_shemata(THD* thd, TABLE *table, LEX_CSTRING *db_name,
- CHARSET_INFO *cs)
+bool store_schema_schemata(THD* thd, TABLE *table, LEX_CSTRING *db_name,
+ CHARSET_INFO *cs, LEX_CSTRING *schema_comment= NULL)
{
restore_record(table, s->default_values);
table->field[0]->store(STRING_WITH_LEN("def"), system_charset_info);
table->field[1]->store(db_name->str, db_name->length, system_charset_info);
table->field[2]->store(cs->csname, strlen(cs->csname), system_charset_info);
table->field[3]->store(cs->name, strlen(cs->name), system_charset_info);
+ if (schema_comment)
+ table->field[5]->store(schema_comment->str, schema_comment->length,
+ system_charset_info);
return schema_table_store_record(thd, table);
}
@@ -5368,8 +5266,8 @@ int fill_schema_schemata(THD *thd, TABLE_LIST *tables, COND *cond)
DBUG_ASSERT(db_name->length <= NAME_LEN);
if (db_name == &INFORMATION_SCHEMA_NAME)
{
- if (store_schema_shemata(thd, table, db_name,
- system_charset_info))
+ if (store_schema_schemata(thd, table, db_name,
+ system_charset_info))
DBUG_RETURN(1);
continue;
}
@@ -5382,8 +5280,9 @@ int fill_schema_schemata(THD *thd, TABLE_LIST *tables, COND *cond)
#endif
{
load_db_opt_by_name(thd, db_name->str, &create);
- if (store_schema_shemata(thd, table, db_name,
- create.default_table_charset))
+ if (store_schema_schemata(thd, table, db_name,
+ create.default_table_charset,
+ create.schema_comment))
DBUG_RETURN(1);
}
}
@@ -5941,10 +5840,7 @@ static int get_schema_column_record(THD *thd, TABLE_LIST *tables,
I.e. we are in SELECT FROM INFORMATION_SCHEMA.COLUMS
rather than in SHOW COLUMNS
*/
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
- thd->get_stmt_da()->sql_errno(),
- thd->get_stmt_da()->message());
- thd->clear_error();
+ convert_error_to_warning(thd);
res= 0;
}
DBUG_RETURN(res);
@@ -6146,12 +6042,11 @@ static my_bool iter_schema_engines(THD *thd, plugin_ref plugin,
LEX_CSTRING yesno[2]= {{ STRING_WITH_LEN("NO") },
{ STRING_WITH_LEN("YES") }};
LEX_CSTRING *tmp;
- const char *option_name= show_comp_option_name[(int) hton->state];
+ const char *option_name= default_type != hton ? yesno[1].str
+ : "DEFAULT";
restore_record(table, s->default_values);
table->field[0]->store(name->str, name->length, scs);
- if (hton->state == SHOW_OPTION_YES && default_type == hton)
- option_name= "DEFAULT";
table->field[1]->store(option_name, strlen(option_name), scs);
table->field[2]->store(plugin_decl(plugin)->descr,
strlen(plugin_decl(plugin)->descr), scs);
@@ -8131,9 +8026,9 @@ mark_all_fields_used_in_query(THD *thd,
bitmap_set_all(bitmap);
break;
}
- for (count=0; fields->field_name; fields++, count++)
+ for (count=0; !fields->end_marker(); fields++, count++)
{
- if (!my_strcasecmp(system_charset_info, fields->field_name,
+ if (!my_strcasecmp(system_charset_info, fields->name().str,
item_field->field_name.str))
{
bitmap_set_bit(bitmap, count);
@@ -8169,19 +8064,16 @@ mark_all_fields_used_in_query(THD *thd,
TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
{
uint field_count;
- Item *item, *all_items;
+ Item *all_items;
TABLE *table;
- List<Item> field_list;
ST_SCHEMA_TABLE *schema_table= table_list->schema_table;
ST_FIELD_INFO *fields_info= schema_table->fields_info;
ST_FIELD_INFO *fields;
- CHARSET_INFO *cs= system_charset_info;
- MEM_ROOT *mem_root= thd->mem_root;
MY_BITMAP bitmap;
my_bitmap_map *buf;
DBUG_ENTER("create_schema_table");
- for (field_count= 0, fields= fields_info; fields->field_name; fields++)
+ for (field_count= 0, fields= fields_info; !fields->end_marker(); fields++)
field_count++;
if (!(buf= (my_bitmap_map*) thd->alloc(bitmap_buffer_size(field_count))))
DBUG_RETURN(NULL);
@@ -8195,138 +8087,21 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
mark_all_fields_used_in_query(thd, fields_info, &bitmap, all_items);
- for (field_count=0; fields_info->field_name; fields_info++)
- {
- size_t field_name_length= strlen(fields_info->field_name);
- switch (fields_info->field_type) {
- case MYSQL_TYPE_TINY:
- case MYSQL_TYPE_LONG:
- case MYSQL_TYPE_SHORT:
- case MYSQL_TYPE_LONGLONG:
- case MYSQL_TYPE_INT24:
- 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 (mem_root)
- Item_return_date_time(thd, fields_info->field_name,
- (uint)field_name_length,
- fields_info->field_type)))
- DBUG_RETURN(0);
- break;
- case MYSQL_TYPE_TIME:
- if (!(item=new (mem_root)
- Item_return_date_time(thd, fields_info->field_name,
- (uint)field_name_length,
- fields_info->field_type)))
- DBUG_RETURN(0);
- break;
- case MYSQL_TYPE_TIMESTAMP:
- case MYSQL_TYPE_DATETIME:
- if (!(item=new (mem_root)
- Item_return_date_time(thd, fields_info->field_name,
- (uint)field_name_length,
- fields_info->field_type,
- fields_info->field_length)))
- DBUG_RETURN(0);
- item->decimals= fields_info->field_length;
- break;
- case MYSQL_TYPE_FLOAT:
- case MYSQL_TYPE_DOUBLE:
- 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 (mem_root)
- Item_decimal(thd, (longlong) fields_info->value, false)))
- {
- DBUG_RETURN(0);
- }
- /*
- 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 (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;
- item->max_length= (fields_info->field_length/100)%100;
- if (item->unsigned_flag == 0)
- item->max_length+= 1;
- if (item->decimals > 0)
- item->max_length+= 1;
- item->set_name(thd, fields_info->field_name, field_name_length, cs);
- break;
- case MYSQL_TYPE_TINY_BLOB:
- case MYSQL_TYPE_MEDIUM_BLOB:
- case MYSQL_TYPE_LONG_BLOB:
- case MYSQL_TYPE_BLOB:
- if (bitmap_is_set(&bitmap, field_count))
- {
- if (!(item= new (mem_root)
- Item_blob(thd, fields_info->field_name,
- fields_info->field_length)))
- {
- DBUG_RETURN(0);
- }
- }
- else
- {
- if (!(item= new (mem_root)
- Item_empty_string(thd, "", 0, cs)))
- {
- DBUG_RETURN(0);
- }
- item->set_name(thd, fields_info->field_name,
- field_name_length, cs);
- }
- break;
- default:
- {
- bool show_field;
- /* Don't let unimplemented types pass through. Could be a grave error. */
- DBUG_ASSERT(fields_info->field_type == MYSQL_TYPE_STRING);
-
- show_field= bitmap_is_set(&bitmap, field_count);
- if (!(item= new (mem_root)
- Item_empty_string(thd, "",
- show_field ? fields_info->field_length : 0, cs)))
- {
- DBUG_RETURN(0);
- }
- item->set_name(thd, fields_info->field_name,
- field_name_length, cs);
- break;
- }
- }
- field_list.push_back(item, thd->mem_root);
- item->maybe_null= (fields_info->field_flags & MY_I_S_MAYBE_NULL);
- field_count++;
- }
TMP_TABLE_PARAM *tmp_table_param =
(TMP_TABLE_PARAM*) (thd->alloc(sizeof(TMP_TABLE_PARAM)));
tmp_table_param->init();
- tmp_table_param->table_charset= cs;
+ tmp_table_param->table_charset= system_charset_info;
tmp_table_param->field_count= field_count;
tmp_table_param->schema_table= 1;
SELECT_LEX *select_lex= table_list->select_lex;
bool keep_row_order= is_show_command(thd);
- if (!(table= create_tmp_table(thd, tmp_table_param,
- field_list, (ORDER*) 0, 0, 0,
- (select_lex->options | thd->variables.option_bits |
- TMP_TABLE_ALL_COLUMNS), HA_POS_ERROR,
- &table_list->alias, false, keep_row_order)))
+ if (!(table= create_tmp_table_for_schema(thd, tmp_table_param,
+ *schema_table, bitmap,
+ (select_lex->options |
+ thd->variables.option_bits |
+ TMP_TABLE_ALL_COLUMNS),
+ table_list->alias,
+ keep_row_order)))
DBUG_RETURN(0);
my_bitmap_map* bitmaps=
(my_bitmap_map*) thd->alloc(bitmap_buffer_size(field_count));
@@ -8358,19 +8133,16 @@ static int make_old_format(THD *thd, ST_SCHEMA_TABLE *schema_table)
{
ST_FIELD_INFO *field_info= schema_table->fields_info;
Name_resolution_context *context= &thd->lex->first_select_lex()->context;
- for (; field_info->field_name; field_info++)
+ for (; !field_info->end_marker(); field_info++)
{
- if (field_info->old_name)
+ if (field_info->old_name().str)
{
- LEX_CSTRING field_name= {field_info->field_name,
- strlen(field_info->field_name)};
+ LEX_CSTRING field_name= field_info->name();
Item_field *field= new (thd->mem_root)
- Item_field(thd, context, NullS, NullS, &field_name);
+ Item_field(thd, context, field_name);
if (field)
{
- field->set_name(thd, field_info->old_name,
- strlen(field_info->old_name),
- system_charset_info);
+ field->set_name(thd, field_info->old_name());
if (add_item_to_list(thd, field))
return 1;
}
@@ -8391,22 +8163,19 @@ 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);
- LEX_CSTRING field_name= {field_info->field_name,
- strlen(field_info->field_name) };
-
Item_field *field= new (thd->mem_root) Item_field(thd, context,
- NullS, NullS, &field_name);
+ field_info->name());
if (!field || add_item_to_list(thd, field))
return 1;
buffer.length(0);
- buffer.append(field_info->old_name);
+ buffer.append(field_info->old_name());
if (lex->wild && lex->wild->ptr())
{
buffer.append(STRING_WITH_LEN(" ("));
buffer.append(lex->wild->ptr());
buffer.append(')');
}
- field->set_name(thd, buffer.ptr(), buffer.length(), system_charset_info);
+ field->set_name(thd, buffer.lex_cstring());
}
return 0;
}
@@ -8419,11 +8188,10 @@ int make_table_names_old_format(THD *thd, ST_SCHEMA_TABLE *schema_table)
LEX *lex= thd->lex;
Name_resolution_context *context= &lex->first_select_lex()->context;
ST_FIELD_INFO *field_info= &schema_table->fields_info[2];
- LEX_CSTRING field_name= {field_info->field_name,
- strlen(field_info->field_name) };
+ LEX_CSTRING field_name= field_info->name();
buffer.length(0);
- buffer.append(field_info->old_name);
+ buffer.append(field_info->old_name());
buffer.append(&lex->first_select_lex()->db);
if (lex->wild && lex->wild->ptr())
{
@@ -8431,22 +8199,17 @@ int make_table_names_old_format(THD *thd, ST_SCHEMA_TABLE *schema_table)
buffer.append(lex->wild->ptr());
buffer.append(')');
}
- Item_field *field= new (thd->mem_root) Item_field(thd, context,
- NullS, NullS, &field_name);
+ Item_field *field= new (thd->mem_root) Item_field(thd, context, field_name);
if (add_item_to_list(thd, field))
return 1;
- field->set_name(thd, buffer.ptr(), buffer.length(), system_charset_info);
+ field->set_name(thd, buffer.lex_cstring());
if (thd->lex->verbose)
{
field_info= &schema_table->fields_info[3];
- LEX_CSTRING field_name2= {field_info->field_name,
- strlen(field_info->field_name) };
- field= new (thd->mem_root) Item_field(thd, context, NullS, NullS,
- &field_name2);
+ field= new (thd->mem_root) Item_field(thd, context, field_info->name());
if (add_item_to_list(thd, field))
return 1;
- field->set_name(thd, field_info->old_name, strlen(field_info->old_name),
- system_charset_info);
+ field->set_name(thd, field_info->old_name());
}
return 0;
}
@@ -8462,19 +8225,15 @@ int make_columns_old_format(THD *thd, ST_SCHEMA_TABLE *schema_table)
for (; *field_num >= 0; field_num++)
{
field_info= &schema_table->fields_info[*field_num];
- LEX_CSTRING field_name= {field_info->field_name,
- strlen(field_info->field_name)};
if (!thd->lex->verbose && (*field_num == 14 ||
*field_num == 18 ||
*field_num == 19))
continue;
Item_field *field= new (thd->mem_root) Item_field(thd, context,
- NullS, NullS, &field_name);
+ field_info->name());
if (field)
{
- field->set_name(thd, field_info->old_name,
- strlen(field_info->old_name),
- system_charset_info);
+ field->set_name(thd, field_info->old_name());
if (add_item_to_list(thd, field))
return 1;
}
@@ -8493,15 +8252,11 @@ 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];
- LEX_CSTRING field_name= {field_info->field_name,
- strlen(field_info->field_name)};
Item_field *field= new (thd->mem_root) Item_field(thd, context,
- NullS, NullS, &field_name);
+ field_info->name());
if (field)
{
- field->set_name(thd, field_info->old_name,
- strlen(field_info->old_name),
- system_charset_info);
+ field->set_name(thd, field_info->old_name());
if (add_item_to_list(thd, field))
return 1;
}
@@ -8520,15 +8275,11 @@ 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];
- LEX_CSTRING field_name= {field_info->field_name,
- strlen(field_info->field_name)};
Item_field *field= new (thd->mem_root) Item_field(thd, context,
- NullS, NullS, &field_name);
+ field_info->name());
if (field)
{
- field->set_name(thd, field_info->old_name,
- strlen(field_info->old_name),
- system_charset_info);
+ field->set_name(thd, field_info->old_name());
if (add_item_to_list(thd, field))
return 1;
}
@@ -8944,7 +8695,7 @@ static my_bool run_hton_fill_schema_table(THD *thd, plugin_ref plugin,
struct run_hton_fill_schema_table_args *args=
(run_hton_fill_schema_table_args *) arg;
handlerton *hton= plugin_hton(plugin);
- if (hton->fill_is_table && hton->state == SHOW_OPTION_YES)
+ if (hton->fill_is_table)
hton->fill_is_table(hton, thd, args->tables, args->cond,
get_schema_table_idx(args->tables->schema_table));
return false;
@@ -9050,809 +8801,653 @@ int fill_key_cache_tables(THD *thd, TABLE_LIST *tables, COND *cond)
}
+namespace Show {
+
ST_FIELD_INFO schema_fields_info[]=
{
- {"CATALOG_NAME", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"SCHEMA_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Database",
- SKIP_OPEN_TABLE},
- {"DEFAULT_CHARACTER_SET_NAME", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, 0,
- SKIP_OPEN_TABLE},
- {"DEFAULT_COLLATION_NAME", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, 0,
- SKIP_OPEN_TABLE},
- {"SQL_PATH", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN_TABLE},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
+ Column("CATALOG_NAME", Catalog(), NOT_NULL),
+ Column("SCHEMA_NAME", Name(), NOT_NULL, "Database"),
+ Column("DEFAULT_CHARACTER_SET_NAME", CSName(), NOT_NULL),
+ Column("DEFAULT_COLLATION_NAME", CSName(), NOT_NULL),
+ Column("SQL_PATH", Varchar(FN_REFLEN), NULLABLE),
+ Column("SCHEMA_COMMENT", Varchar(DATABASE_COMMENT_MAXLEN), NOT_NULL),
+ CEnd()
};
ST_FIELD_INFO tables_fields_info[]=
{
- {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"TABLE_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Name",
- SKIP_OPEN_TABLE},
- {"TABLE_TYPE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
- {"ENGINE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, "Engine", OPEN_FRM_ONLY},
- {"VERSION", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0,
- (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Version", OPEN_FRM_ONLY},
- {"ROW_FORMAT", 10, MYSQL_TYPE_STRING, 0, 1, "Row_format", OPEN_FULL_TABLE},
- {"TABLE_ROWS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0,
- (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Rows", OPEN_FULL_TABLE},
- {"AVG_ROW_LENGTH", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0,
- (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Avg_row_length", OPEN_FULL_TABLE},
- {"DATA_LENGTH", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0,
- (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Data_length", OPEN_FULL_TABLE},
- {"MAX_DATA_LENGTH", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0,
- (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Max_data_length", OPEN_FULL_TABLE},
- {"INDEX_LENGTH", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0,
- (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Index_length", OPEN_FULL_TABLE},
- {"DATA_FREE", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0,
- (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Data_free", OPEN_FULL_TABLE},
- {"AUTO_INCREMENT", MY_INT64_NUM_DECIMAL_DIGITS , MYSQL_TYPE_LONGLONG, 0,
- (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Auto_increment", OPEN_FULL_TABLE},
- {"CREATE_TIME", 0, MYSQL_TYPE_DATETIME, 0, 1, "Create_time", OPEN_FULL_TABLE},
- {"UPDATE_TIME", 0, MYSQL_TYPE_DATETIME, 0, 1, "Update_time", OPEN_FULL_TABLE},
- {"CHECK_TIME", 0, MYSQL_TYPE_DATETIME, 0, 1, "Check_time", OPEN_FULL_TABLE},
- {"TABLE_COLLATION", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 1, "Collation",
- OPEN_FRM_ONLY},
- {"CHECKSUM", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0,
- (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Checksum", OPEN_FULL_TABLE},
- {"CREATE_OPTIONS", 2048, MYSQL_TYPE_STRING, 0, 1, "Create_options",
- OPEN_FULL_TABLE},
- {"TABLE_COMMENT", TABLE_COMMENT_MAXLEN, MYSQL_TYPE_STRING, 0, 0,
- "Comment", OPEN_FRM_ONLY},
- {"MAX_INDEX_LENGTH", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0,
- (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Max_index_length", OPEN_FULL_TABLE},
- {"TEMPORARY", 1, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, "Temporary", OPEN_FRM_ONLY},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
+ Column("TABLE_CATALOG", Catalog(), NOT_NULL),
+ Column("TABLE_SCHEMA", Name(), NOT_NULL),
+ Column("TABLE_NAME", Name(), NOT_NULL, "Name"),
+ Column("TABLE_TYPE", Name(), NOT_NULL, OPEN_FRM_ONLY),
+ Column("ENGINE", Name(), NULLABLE, "Engine", OPEN_FRM_ONLY),
+ Column("VERSION", ULonglong(), NULLABLE, "Version", OPEN_FRM_ONLY),
+ Column("ROW_FORMAT", Varchar(10), NULLABLE, "Row_format", OPEN_FULL_TABLE),
+ Column("TABLE_ROWS", ULonglong(), NULLABLE, "Rows", OPEN_FULL_TABLE),
+ Column("AVG_ROW_LENGTH", ULonglong(), NULLABLE, "Avg_row_length",
+ OPEN_FULL_TABLE),
+ Column("DATA_LENGTH", ULonglong(), NULLABLE, "Data_length",OPEN_FULL_TABLE),
+ Column("MAX_DATA_LENGTH", ULonglong(), NULLABLE, "Max_data_length",
+ OPEN_FULL_TABLE),
+ Column("INDEX_LENGTH", ULonglong(), NULLABLE, "Index_length",OPEN_FULL_TABLE),
+ Column("DATA_FREE", ULonglong(), NULLABLE, "Data_free", OPEN_FULL_TABLE),
+ Column("AUTO_INCREMENT", ULonglong(), NULLABLE, "Auto_increment",
+ OPEN_FULL_TABLE),
+ Column("CREATE_TIME", Datetime(0), NULLABLE, "Create_time",OPEN_FULL_TABLE),
+ Column("UPDATE_TIME", Datetime(0), NULLABLE, "Update_time",OPEN_FULL_TABLE),
+ Column("CHECK_TIME", Datetime(0), NULLABLE, "Check_time", OPEN_FULL_TABLE),
+ Column("TABLE_COLLATION", CSName(), NULLABLE, "Collation", OPEN_FRM_ONLY),
+ Column("CHECKSUM", ULonglong(), NULLABLE, "Checksum", OPEN_FULL_TABLE),
+ Column("CREATE_OPTIONS", Varchar(2048),NULLABLE, "Create_options",
+ OPEN_FULL_TABLE),
+ Column("TABLE_COMMENT", Varchar(TABLE_COMMENT_MAXLEN),
+ NOT_NULL, "Comment", OPEN_FRM_ONLY),
+ Column("MAX_INDEX_LENGTH",ULonglong(), NULLABLE, "Max_index_length",
+ OPEN_FULL_TABLE),
+ Column("TEMPORARY", Varchar(1), NULLABLE, "Temporary", OPEN_FRM_ONLY),
+ CEnd()
};
ST_FIELD_INFO columns_fields_info[]=
{
- {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
- {"TABLE_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
- {"TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
- {"COLUMN_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Field",
- OPEN_FRM_ONLY},
- {"ORDINAL_POSITION", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0,
- MY_I_S_UNSIGNED, 0, OPEN_FRM_ONLY},
- {"COLUMN_DEFAULT", MAX_FIELD_VARCHARLENGTH, MYSQL_TYPE_STRING, 0,
- 1, "Default", OPEN_FRM_ONLY},
- {"IS_NULLABLE", 3, MYSQL_TYPE_STRING, 0, 0, "Null", OPEN_FRM_ONLY},
- {"DATA_TYPE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
- {"CHARACTER_MAXIMUM_LENGTH", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG,
- 0, (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), 0, OPEN_FRM_ONLY},
- {"CHARACTER_OCTET_LENGTH", MY_INT64_NUM_DECIMAL_DIGITS , MYSQL_TYPE_LONGLONG,
- 0, (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), 0, OPEN_FRM_ONLY},
- {"NUMERIC_PRECISION", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG,
- 0, (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), 0, OPEN_FRM_ONLY},
- {"NUMERIC_SCALE", MY_INT64_NUM_DECIMAL_DIGITS , MYSQL_TYPE_LONGLONG,
- 0, (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), 0, OPEN_FRM_ONLY},
- {"DATETIME_PRECISION", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG,
- 0, (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), 0, OPEN_FRM_ONLY},
- {"CHARACTER_SET_NAME", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 1, 0,
- OPEN_FRM_ONLY},
- {"COLLATION_NAME", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 1, "Collation",
- OPEN_FRM_ONLY},
- {"COLUMN_TYPE", 65535, MYSQL_TYPE_STRING, 0, 0, "Type", OPEN_FRM_ONLY},
- {"COLUMN_KEY", 3, MYSQL_TYPE_STRING, 0, 0, "Key", OPEN_FRM_ONLY},
- {"EXTRA", 30, MYSQL_TYPE_STRING, 0, 0, "Extra", OPEN_FRM_ONLY},
- {"PRIVILEGES", 80, MYSQL_TYPE_STRING, 0, 0, "Privileges", OPEN_FRM_ONLY},
- {"COLUMN_COMMENT", COLUMN_COMMENT_MAXLEN, MYSQL_TYPE_STRING, 0, 0,
- "Comment", OPEN_FRM_ONLY},
- {"IS_GENERATED", 6, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
- {"GENERATION_EXPRESSION", MAX_FIELD_VARCHARLENGTH, MYSQL_TYPE_STRING, 0, 1,
- 0, OPEN_FRM_ONLY},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
+ Column("TABLE_CATALOG", Catalog(), NOT_NULL, OPEN_FRM_ONLY),
+ Column("TABLE_SCHEMA", Name(), NOT_NULL, OPEN_FRM_ONLY),
+ Column("TABLE_NAME", Name(), NOT_NULL, OPEN_FRM_ONLY),
+ Column("COLUMN_NAME", Name(), NOT_NULL, "Field", OPEN_FRM_ONLY),
+ Column("ORDINAL_POSITION", ULonglong(), NOT_NULL, OPEN_FRM_ONLY),
+ Column("COLUMN_DEFAULT", Longtext(MAX_FIELD_VARCHARLENGTH),
+ NULLABLE, "Default",OPEN_FRM_ONLY),
+ Column("IS_NULLABLE", Yesno(), NOT_NULL, "Null", OPEN_FRM_ONLY),
+ Column("DATA_TYPE", Name(), NOT_NULL, OPEN_FRM_ONLY),
+ Column("CHARACTER_MAXIMUM_LENGTH",ULonglong(), NULLABLE, OPEN_FRM_ONLY),
+ Column("CHARACTER_OCTET_LENGTH", ULonglong(), NULLABLE, OPEN_FRM_ONLY),
+ Column("NUMERIC_PRECISION", ULonglong(), NULLABLE, OPEN_FRM_ONLY),
+ Column("NUMERIC_SCALE", ULonglong(), NULLABLE, OPEN_FRM_ONLY),
+ Column("DATETIME_PRECISION", ULonglong(), NULLABLE, OPEN_FRM_ONLY),
+ Column("CHARACTER_SET_NAME", CSName(), NULLABLE, OPEN_FRM_ONLY),
+ Column("COLLATION_NAME", CSName(), NULLABLE, "Collation", OPEN_FRM_ONLY),
+ Column("COLUMN_TYPE", Longtext(65535), NOT_NULL, "Type", OPEN_FRM_ONLY),
+ Column("COLUMN_KEY", Varchar(3), NOT_NULL, "Key", OPEN_FRM_ONLY),
+ Column("EXTRA", Varchar(30), NOT_NULL, "Extra", OPEN_FRM_ONLY),
+ Column("PRIVILEGES", Varchar(80), NOT_NULL, "Privileges", OPEN_FRM_ONLY),
+ Column("COLUMN_COMMENT", Varchar(COLUMN_COMMENT_MAXLEN), NOT_NULL, "Comment",
+ OPEN_FRM_ONLY),
+ Column("IS_GENERATED", Varchar(6), NOT_NULL, OPEN_FRM_ONLY),
+ Column("GENERATION_EXPRESSION", Longtext(MAX_FIELD_VARCHARLENGTH),
+ NULLABLE, OPEN_FRM_ONLY),
+ CEnd()
};
ST_FIELD_INFO charsets_fields_info[]=
{
- {"CHARACTER_SET_NAME", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, "Charset",
- SKIP_OPEN_TABLE},
- {"DEFAULT_COLLATE_NAME", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0,
- "Default collation", SKIP_OPEN_TABLE},
- {"DESCRIPTION", 60, MYSQL_TYPE_STRING, 0, 0, "Description",
- SKIP_OPEN_TABLE},
- {"MAXLEN", 3, MYSQL_TYPE_LONGLONG, 0, 0, "Maxlen", SKIP_OPEN_TABLE},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
+ Column("CHARACTER_SET_NAME", CSName(), NOT_NULL, "Charset"),
+ Column("DEFAULT_COLLATE_NAME", CSName(), NOT_NULL, "Default collation"),
+ Column("DESCRIPTION", Varchar(60), NOT_NULL, "Description"),
+ Column("MAXLEN", SLonglong(3), NOT_NULL, "Maxlen"),
+ CEnd()
};
ST_FIELD_INFO collation_fields_info[]=
{
- {"COLLATION_NAME", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, "Collation",
- SKIP_OPEN_TABLE},
- {"CHARACTER_SET_NAME", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, "Charset",
- SKIP_OPEN_TABLE},
- {"ID", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Id",
- SKIP_OPEN_TABLE},
- {"IS_DEFAULT", 3, MYSQL_TYPE_STRING, 0, 0, "Default", SKIP_OPEN_TABLE},
- {"IS_COMPILED", 3, MYSQL_TYPE_STRING, 0, 0, "Compiled", SKIP_OPEN_TABLE},
- {"SORTLEN", 3, MYSQL_TYPE_LONGLONG, 0, 0, "Sortlen", SKIP_OPEN_TABLE},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
+ Column("COLLATION_NAME", CSName(), NOT_NULL, "Collation"),
+ Column("CHARACTER_SET_NAME", CSName(), NOT_NULL, "Charset"),
+ Column("ID", SLonglong(MY_INT32_NUM_DECIMAL_DIGITS), NOT_NULL, "Id"),
+ Column("IS_DEFAULT", Yesno(), NOT_NULL, "Default"),
+ Column("IS_COMPILED", Yesno(), NOT_NULL, "Compiled"),
+ Column("SORTLEN", SLonglong(3), NOT_NULL, "Sortlen"),
+ CEnd()
};
ST_FIELD_INFO applicable_roles_fields_info[]=
{
- {"GRANTEE", USERNAME_WITH_HOST_CHAR_LENGTH, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"ROLE_NAME", USERNAME_CHAR_LENGTH, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"IS_GRANTABLE", 3, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"IS_DEFAULT", 3, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, 0, SKIP_OPEN_TABLE},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
+ Column("GRANTEE", Userhost(), NOT_NULL),
+ Column("ROLE_NAME", Varchar(USERNAME_CHAR_LENGTH), NOT_NULL),
+ Column("IS_GRANTABLE", Yesno(), NOT_NULL),
+ Column("IS_DEFAULT", Yesno(), NULLABLE),
+ CEnd()
};
ST_FIELD_INFO enabled_roles_fields_info[]=
{
- {"ROLE_NAME", USERNAME_CHAR_LENGTH, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, 0, SKIP_OPEN_TABLE},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
+ Column("ROLE_NAME", Varchar(USERNAME_CHAR_LENGTH), NULLABLE),
+ CEnd()
};
ST_FIELD_INFO engines_fields_info[]=
{
- {"ENGINE", 64, MYSQL_TYPE_STRING, 0, 0, "Engine", SKIP_OPEN_TABLE},
- {"SUPPORT", 8, MYSQL_TYPE_STRING, 0, 0, "Support", SKIP_OPEN_TABLE},
- {"COMMENT", 160, MYSQL_TYPE_STRING, 0, 0, "Comment", SKIP_OPEN_TABLE},
- {"TRANSACTIONS", 3, MYSQL_TYPE_STRING, 0, 1, "Transactions", SKIP_OPEN_TABLE},
- {"XA", 3, MYSQL_TYPE_STRING, 0, 1, "XA", SKIP_OPEN_TABLE},
- {"SAVEPOINTS", 3 ,MYSQL_TYPE_STRING, 0, 1, "Savepoints", SKIP_OPEN_TABLE},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
+ Column("ENGINE", Varchar(64), NOT_NULL, "Engine"),
+ Column("SUPPORT", Varchar(8), NOT_NULL, "Support"),
+ Column("COMMENT", Varchar(160), NOT_NULL, "Comment"),
+ Column("TRANSACTIONS", Varchar(3), NULLABLE, "Transactions"),
+ Column("XA", Varchar(3), NULLABLE, "XA"),
+ Column("SAVEPOINTS", Varchar(3), NULLABLE, "Savepoints"),
+ CEnd()
};
ST_FIELD_INFO events_fields_info[]=
{
- {"EVENT_CATALOG", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"EVENT_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Db",
- SKIP_OPEN_TABLE},
- {"EVENT_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Name",
- SKIP_OPEN_TABLE},
- {"DEFINER", DEFINER_CHAR_LENGTH, MYSQL_TYPE_STRING, 0, 0, "Definer", SKIP_OPEN_TABLE},
- {"TIME_ZONE", 64, MYSQL_TYPE_STRING, 0, 0, "Time zone", SKIP_OPEN_TABLE},
- {"EVENT_BODY", 8, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"EVENT_DEFINITION", 65535, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"EVENT_TYPE", 9, MYSQL_TYPE_STRING, 0, 0, "Type", SKIP_OPEN_TABLE},
- {"EXECUTE_AT", 0, MYSQL_TYPE_DATETIME, 0, 1, "Execute at", SKIP_OPEN_TABLE},
- {"INTERVAL_VALUE", 256, MYSQL_TYPE_STRING, 0, 1, "Interval value",
- SKIP_OPEN_TABLE},
- {"INTERVAL_FIELD", 18, MYSQL_TYPE_STRING, 0, 1, "Interval field",
- SKIP_OPEN_TABLE},
- {"SQL_MODE", 32*256, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"STARTS", 0, MYSQL_TYPE_DATETIME, 0, 1, "Starts", SKIP_OPEN_TABLE},
- {"ENDS", 0, MYSQL_TYPE_DATETIME, 0, 1, "Ends", SKIP_OPEN_TABLE},
- {"STATUS", 18, MYSQL_TYPE_STRING, 0, 0, "Status", SKIP_OPEN_TABLE},
- {"ON_COMPLETION", 12, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"CREATED", 0, MYSQL_TYPE_DATETIME, 0, 0, 0, SKIP_OPEN_TABLE},
- {"LAST_ALTERED", 0, MYSQL_TYPE_DATETIME, 0, 0, 0, SKIP_OPEN_TABLE},
- {"LAST_EXECUTED", 0, MYSQL_TYPE_DATETIME, 0, 1, 0, SKIP_OPEN_TABLE},
- {"EVENT_COMMENT", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"ORIGINATOR", 10, MYSQL_TYPE_LONGLONG, 0, 0, "Originator", SKIP_OPEN_TABLE},
- {"CHARACTER_SET_CLIENT", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0,
- "character_set_client", SKIP_OPEN_TABLE},
- {"COLLATION_CONNECTION", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0,
- "collation_connection", SKIP_OPEN_TABLE},
- {"DATABASE_COLLATION", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0,
- "Database Collation", SKIP_OPEN_TABLE},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
+ // QQ: shouldn't EVENT_CATALOG be Catalog() like in all other places?
+ Column("EVENT_CATALOG", Name(), NOT_NULL),
+ Column("EVENT_SCHEMA", Name(), NOT_NULL, "Db"),
+ Column("EVENT_NAME", Name(), NOT_NULL, "Name"),
+ Column("DEFINER", Definer(), NOT_NULL, "Definer"),
+ Column("TIME_ZONE", Varchar(64), NOT_NULL, "Time zone"),
+ Column("EVENT_BODY", Varchar(8), NOT_NULL),
+ Column("EVENT_DEFINITION", Longtext(65535), NOT_NULL),
+ Column("EVENT_TYPE", Varchar(9), NOT_NULL, "Type"),
+ Column("EXECUTE_AT", Datetime(0), NULLABLE, "Execute at"),
+ Column("INTERVAL_VALUE", Varchar(256),NULLABLE, "Interval value"),
+ Column("INTERVAL_FIELD", Varchar(18), NULLABLE, "Interval field"),
+ Column("SQL_MODE", SQLMode(), NOT_NULL),
+ Column("STARTS", Datetime(0), NULLABLE, "Starts"),
+ Column("ENDS", Datetime(0), NULLABLE, "Ends"),
+ Column("STATUS", Varchar(18), NOT_NULL, "Status"),
+ Column("ON_COMPLETION", Varchar(12), NOT_NULL),
+ Column("CREATED", Datetime(0), NOT_NULL),
+ Column("LAST_ALTERED", Datetime(0), NOT_NULL),
+ Column("LAST_EXECUTED", Datetime(0), NULLABLE),
+ Column("EVENT_COMMENT", Name(), NOT_NULL),
+ Column("ORIGINATOR", SLonglong(10),NOT_NULL,"Originator"),
+ Column("CHARACTER_SET_CLIENT", CSName(), NOT_NULL, "character_set_client"),
+ Column("COLLATION_CONNECTION", CSName(), NOT_NULL, "collation_connection"),
+ Column("DATABASE_COLLATION", CSName(), NOT_NULL, "Database Collation"),
+ CEnd()
};
ST_FIELD_INFO coll_charset_app_fields_info[]=
{
- {"COLLATION_NAME", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, 0,
- SKIP_OPEN_TABLE},
- {"CHARACTER_SET_NAME", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, 0,
- SKIP_OPEN_TABLE},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
+ Column("COLLATION_NAME", CSName(), NOT_NULL),
+ Column("CHARACTER_SET_NAME", CSName(), NOT_NULL),
+ CEnd()
};
ST_FIELD_INFO proc_fields_info[]=
{
- {"SPECIFIC_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"ROUTINE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"ROUTINE_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Db",
- SKIP_OPEN_TABLE},
- {"ROUTINE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Name",
- SKIP_OPEN_TABLE},
- {"ROUTINE_TYPE", 13, MYSQL_TYPE_STRING, 0, 0, "Type", SKIP_OPEN_TABLE},
- {"DATA_TYPE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"CHARACTER_MAXIMUM_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 1, 0, SKIP_OPEN_TABLE},
- {"CHARACTER_OCTET_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 1, 0, SKIP_OPEN_TABLE},
- {"NUMERIC_PRECISION", 21 , MYSQL_TYPE_LONG, 0, 1, 0, SKIP_OPEN_TABLE},
- {"NUMERIC_SCALE", 21 , MYSQL_TYPE_LONG, 0, 1, 0, SKIP_OPEN_TABLE},
- {"DATETIME_PRECISION", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG,
- 0, (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), 0, OPEN_FRM_ONLY},
- {"CHARACTER_SET_NAME", 64, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN_TABLE},
- {"COLLATION_NAME", 64, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN_TABLE},
- {"DTD_IDENTIFIER", 65535, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN_TABLE},
- {"ROUTINE_BODY", 8, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"ROUTINE_DEFINITION", 65535, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN_TABLE},
- {"EXTERNAL_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN_TABLE},
- {"EXTERNAL_LANGUAGE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, 0,
- SKIP_OPEN_TABLE},
- {"PARAMETER_STYLE", 8, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"IS_DETERMINISTIC", 3, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"SQL_DATA_ACCESS", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0,
- SKIP_OPEN_TABLE},
- {"SQL_PATH", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN_TABLE},
- {"SECURITY_TYPE", 7, MYSQL_TYPE_STRING, 0, 0, "Security_type",
- SKIP_OPEN_TABLE},
- {"CREATED", 0, MYSQL_TYPE_DATETIME, 0, 0, "Created", SKIP_OPEN_TABLE},
- {"LAST_ALTERED", 0, MYSQL_TYPE_DATETIME, 0, 0, "Modified", SKIP_OPEN_TABLE},
- {"SQL_MODE", 32*256, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"ROUTINE_COMMENT", 65535, MYSQL_TYPE_STRING, 0, 0, "Comment",
- SKIP_OPEN_TABLE},
- {"DEFINER", DEFINER_CHAR_LENGTH, MYSQL_TYPE_STRING, 0, 0, "Definer", SKIP_OPEN_TABLE},
- {"CHARACTER_SET_CLIENT", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0,
- "character_set_client", SKIP_OPEN_TABLE},
- {"COLLATION_CONNECTION", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0,
- "collation_connection", SKIP_OPEN_TABLE},
- {"DATABASE_COLLATION", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0,
- "Database Collation", SKIP_OPEN_TABLE},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
+ Column("SPECIFIC_NAME", Name(), NOT_NULL),
+ Column("ROUTINE_CATALOG", Catalog(), NOT_NULL),
+ Column("ROUTINE_SCHEMA", Name(), NOT_NULL, "Db"),
+ Column("ROUTINE_NAME", Name(), NOT_NULL, "Name"),
+ Column("ROUTINE_TYPE", Varchar(13),NOT_NULL, "Type"),
+ Column("DATA_TYPE", Name(), NOT_NULL),
+ Column("CHARACTER_MAXIMUM_LENGTH",SLong(21), NULLABLE),
+ Column("CHARACTER_OCTET_LENGTH", SLong(21), NULLABLE),
+ Column("NUMERIC_PRECISION", SLong(21), NULLABLE),
+ Column("NUMERIC_SCALE", SLong(21), NULLABLE),
+ Column("DATETIME_PRECISION", ULonglong(), NULLABLE, OPEN_FRM_ONLY),
+ Column("CHARACTER_SET_NAME", Varchar(64),NULLABLE),
+ Column("COLLATION_NAME", Varchar(64),NULLABLE),
+ Column("DTD_IDENTIFIER", Longtext(65535), NULLABLE),
+ Column("ROUTINE_BODY", Varchar(8), NOT_NULL),
+ Column("ROUTINE_DEFINITION", Longtext(65535), NULLABLE),
+ Column("EXTERNAL_NAME", Name(), NULLABLE),
+ Column("EXTERNAL_LANGUAGE", Name(), NULLABLE),
+ Column("PARAMETER_STYLE", Varchar(8), NOT_NULL),
+ Column("IS_DETERMINISTIC", Varchar(3), NOT_NULL),
+ Column("SQL_DATA_ACCESS", Name(), NOT_NULL),
+ Column("SQL_PATH", Name(), NULLABLE),
+ Column("SECURITY_TYPE", Varchar(7), NOT_NULL, "Security_type"),
+ Column("CREATED", Datetime(0), NOT_NULL, "Created"),
+ Column("LAST_ALTERED", Datetime(0), NOT_NULL, "Modified"),
+ Column("SQL_MODE", SQLMode(), NOT_NULL),
+ Column("ROUTINE_COMMENT", Longtext(65535), NOT_NULL, "Comment"),
+ Column("DEFINER", Definer(), NOT_NULL, "Definer"),
+ Column("CHARACTER_SET_CLIENT", CSName(), NOT_NULL, "character_set_client"),
+ Column("COLLATION_CONNECTION", CSName(), NOT_NULL, "collation_connection"),
+ Column("DATABASE_COLLATION", CSName(), NOT_NULL, "Database Collation"),
+ CEnd()
};
ST_FIELD_INFO stat_fields_info[]=
{
- {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
- {"TABLE_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
- {"TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Table", OPEN_FRM_ONLY},
- {"NON_UNIQUE", 1, MYSQL_TYPE_LONGLONG, 0, 0, "Non_unique", OPEN_FRM_ONLY},
- {"INDEX_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
- {"INDEX_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Key_name",
- OPEN_FRM_ONLY},
- {"SEQ_IN_INDEX", 2, MYSQL_TYPE_LONGLONG, 0, 0, "Seq_in_index", OPEN_FRM_ONLY},
- {"COLUMN_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Column_name",
- OPEN_FRM_ONLY},
- {"COLLATION", 1, MYSQL_TYPE_STRING, 0, 1, "Collation", OPEN_FRM_ONLY},
- {"CARDINALITY", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 1,
- "Cardinality", OPEN_FULL_TABLE},
- {"SUB_PART", 3, MYSQL_TYPE_LONGLONG, 0, 1, "Sub_part", OPEN_FRM_ONLY},
- {"PACKED", 10, MYSQL_TYPE_STRING, 0, 1, "Packed", OPEN_FRM_ONLY},
- {"NULLABLE", 3, MYSQL_TYPE_STRING, 0, 0, "Null", OPEN_FRM_ONLY},
- {"INDEX_TYPE", 16, MYSQL_TYPE_STRING, 0, 0, "Index_type", OPEN_FULL_TABLE},
- {"COMMENT", 16, MYSQL_TYPE_STRING, 0, 1, "Comment", OPEN_FRM_ONLY},
- {"INDEX_COMMENT", INDEX_COMMENT_MAXLEN, MYSQL_TYPE_STRING, 0, 0,
- "Index_comment", OPEN_FRM_ONLY},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
+ Column("TABLE_CATALOG", Catalog(), NOT_NULL, OPEN_FRM_ONLY),
+ Column("TABLE_SCHEMA", Name(), NOT_NULL, OPEN_FRM_ONLY),
+ Column("TABLE_NAME", Name(), NOT_NULL, "Table", OPEN_FRM_ONLY),
+ Column("NON_UNIQUE", SLonglong(1),NOT_NULL, "Non_unique", OPEN_FRM_ONLY),
+ Column("INDEX_SCHEMA", Name(), NOT_NULL, OPEN_FRM_ONLY),
+ Column("INDEX_NAME", Name(), NOT_NULL, "Key_name", OPEN_FRM_ONLY),
+ Column("SEQ_IN_INDEX", SLonglong(2),NOT_NULL, "Seq_in_index",OPEN_FRM_ONLY),
+ Column("COLUMN_NAME", Name(), NOT_NULL, "Column_name", OPEN_FRM_ONLY),
+ Column("COLLATION", Varchar(1), NULLABLE, "Collation", OPEN_FRM_ONLY),
+ Column("CARDINALITY", SLonglong(), NULLABLE, "Cardinality", OPEN_FULL_TABLE),
+ Column("SUB_PART", SLonglong(3),NULLABLE, "Sub_part", OPEN_FRM_ONLY),
+ Column("PACKED", Varchar(10), NULLABLE, "Packed", OPEN_FRM_ONLY),
+ Column("NULLABLE", Varchar(3), NOT_NULL, "Null", OPEN_FRM_ONLY),
+ Column("INDEX_TYPE", Varchar(16), NOT_NULL, "Index_type", OPEN_FULL_TABLE),
+ Column("COMMENT", Varchar(16), NULLABLE, "Comment", OPEN_FRM_ONLY),
+ Column("INDEX_COMMENT", Varchar(INDEX_COMMENT_MAXLEN),
+ NOT_NULL, "Index_comment",OPEN_FRM_ONLY),
+ CEnd()
};
ST_FIELD_INFO view_fields_info[]=
{
- {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
- {"TABLE_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
- {"TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
- {"VIEW_DEFINITION", 65535, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
- {"CHECK_OPTION", 8, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
- {"IS_UPDATABLE", 3, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
- {"DEFINER", DEFINER_CHAR_LENGTH, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
- {"SECURITY_TYPE", 7, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
- {"CHARACTER_SET_CLIENT", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, 0,
- OPEN_FRM_ONLY},
- {"COLLATION_CONNECTION", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, 0,
- OPEN_FRM_ONLY},
- {"ALGORITHM", 10, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
+ Column("TABLE_CATALOG", Catalog(), NOT_NULL, OPEN_FRM_ONLY),
+ Column("TABLE_SCHEMA", Name(), NOT_NULL, OPEN_FRM_ONLY),
+ Column("TABLE_NAME", Name(), NOT_NULL, OPEN_FRM_ONLY),
+ Column("VIEW_DEFINITION", Longtext(65535), NOT_NULL, OPEN_FRM_ONLY),
+ Column("CHECK_OPTION", Varchar(8), NOT_NULL, OPEN_FRM_ONLY),
+ Column("IS_UPDATABLE", Yesno(), NOT_NULL, OPEN_FULL_TABLE),
+ Column("DEFINER", Definer(), NOT_NULL, OPEN_FRM_ONLY),
+ Column("SECURITY_TYPE", Varchar(7), NOT_NULL, OPEN_FRM_ONLY),
+ Column("CHARACTER_SET_CLIENT", CSName(), NOT_NULL, OPEN_FRM_ONLY),
+ Column("COLLATION_CONNECTION", CSName(), NOT_NULL, OPEN_FRM_ONLY),
+ Column("ALGORITHM", Varchar(10),NOT_NULL, OPEN_FRM_ONLY),
+ CEnd()
};
ST_FIELD_INFO user_privileges_fields_info[]=
{
- {"GRANTEE", USERNAME_WITH_HOST_CHAR_LENGTH, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"PRIVILEGE_TYPE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"IS_GRANTABLE", 3, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
+ Column("GRANTEE", Userhost(), NOT_NULL),
+ Column("TABLE_CATALOG", Catalog(), NOT_NULL),
+ Column("PRIVILEGE_TYPE", Name(), NOT_NULL),
+ Column("IS_GRANTABLE", Yesno(), NOT_NULL),
+ CEnd()
};
ST_FIELD_INFO schema_privileges_fields_info[]=
{
- {"GRANTEE", USERNAME_WITH_HOST_CHAR_LENGTH, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"TABLE_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"PRIVILEGE_TYPE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"IS_GRANTABLE", 3, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
+ Column("GRANTEE", Userhost(), NOT_NULL),
+ Column("TABLE_CATALOG", Catalog(), NOT_NULL),
+ Column("TABLE_SCHEMA", Name(), NOT_NULL),
+ Column("PRIVILEGE_TYPE", Name(), NOT_NULL),
+ Column("IS_GRANTABLE", Yesno(), NOT_NULL),
+ CEnd()
};
ST_FIELD_INFO table_privileges_fields_info[]=
{
- {"GRANTEE", USERNAME_WITH_HOST_CHAR_LENGTH, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"TABLE_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"PRIVILEGE_TYPE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"IS_GRANTABLE", 3, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
+ Column("GRANTEE", Userhost(), NOT_NULL),
+ Column("TABLE_CATALOG", Catalog(), NOT_NULL),
+ Column("TABLE_SCHEMA", Name(), NOT_NULL),
+ Column("TABLE_NAME", Name(), NOT_NULL),
+ Column("PRIVILEGE_TYPE", Name(), NOT_NULL),
+ Column("IS_GRANTABLE", Yesno(), NOT_NULL),
+ CEnd()
};
ST_FIELD_INFO column_privileges_fields_info[]=
{
- {"GRANTEE", USERNAME_WITH_HOST_CHAR_LENGTH, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"TABLE_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"COLUMN_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"PRIVILEGE_TYPE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"IS_GRANTABLE", 3, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
+ Column("GRANTEE", Userhost(), NOT_NULL),
+ Column("TABLE_CATALOG", Catalog(), NOT_NULL),
+ Column("TABLE_SCHEMA", Name(), NOT_NULL),
+ Column("TABLE_NAME", Name(), NOT_NULL),
+ Column("COLUMN_NAME", Name(), NOT_NULL),
+ Column("PRIVILEGE_TYPE", Name(), NOT_NULL),
+ Column("IS_GRANTABLE", Yesno(), NOT_NULL),
+ CEnd()
};
ST_FIELD_INFO table_constraints_fields_info[]=
{
- {"CONSTRAINT_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
- {"CONSTRAINT_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0,
- OPEN_FULL_TABLE},
- {"CONSTRAINT_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0,
- OPEN_FULL_TABLE},
- {"TABLE_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
- {"TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
- {"CONSTRAINT_TYPE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0,
- OPEN_FULL_TABLE},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
+ Column("CONSTRAINT_CATALOG", Catalog(), NOT_NULL, OPEN_FULL_TABLE),
+ Column("CONSTRAINT_SCHEMA", Name(), NOT_NULL, OPEN_FULL_TABLE),
+ Column("CONSTRAINT_NAME", Name(), NOT_NULL, OPEN_FULL_TABLE),
+ Column("TABLE_SCHEMA", Name(), NOT_NULL, OPEN_FULL_TABLE),
+ Column("TABLE_NAME", Name(), NOT_NULL, OPEN_FULL_TABLE),
+ Column("CONSTRAINT_TYPE", Name(), NOT_NULL, OPEN_FULL_TABLE),
+ CEnd()
};
ST_FIELD_INFO key_column_usage_fields_info[]=
{
- {"CONSTRAINT_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
- {"CONSTRAINT_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0,
- OPEN_FULL_TABLE},
- {"CONSTRAINT_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0,
- OPEN_FULL_TABLE},
- {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
- {"TABLE_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
- {"TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
- {"COLUMN_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
- {"ORDINAL_POSITION", 10 ,MYSQL_TYPE_LONGLONG, 0, 0, 0, OPEN_FULL_TABLE},
- {"POSITION_IN_UNIQUE_CONSTRAINT", 10 ,MYSQL_TYPE_LONGLONG, 0, 1, 0,
- OPEN_FULL_TABLE},
- {"REFERENCED_TABLE_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, 0,
- OPEN_FULL_TABLE},
- {"REFERENCED_TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, 0,
- OPEN_FULL_TABLE},
- {"REFERENCED_COLUMN_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, 0,
- OPEN_FULL_TABLE},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
+ Column("CONSTRAINT_CATALOG", Catalog(), NOT_NULL, OPEN_FULL_TABLE),
+ Column("CONSTRAINT_SCHEMA", Name(), NOT_NULL, OPEN_FULL_TABLE),
+ Column("CONSTRAINT_NAME", Name(), NOT_NULL, OPEN_FULL_TABLE),
+ Column("TABLE_CATALOG", Catalog(), NOT_NULL, OPEN_FULL_TABLE),
+ Column("TABLE_SCHEMA", Name(), NOT_NULL, OPEN_FULL_TABLE),
+ Column("TABLE_NAME", Name(), NOT_NULL, OPEN_FULL_TABLE),
+ Column("COLUMN_NAME", Name(), NOT_NULL, OPEN_FULL_TABLE),
+ Column("ORDINAL_POSITION", SLonglong(10), NOT_NULL, OPEN_FULL_TABLE),
+ Column("POSITION_IN_UNIQUE_CONSTRAINT", SLonglong(10), NULLABLE, OPEN_FULL_TABLE),
+ Column("REFERENCED_TABLE_SCHEMA", Name(), NULLABLE, OPEN_FULL_TABLE),
+ Column("REFERENCED_TABLE_NAME", Name(), NULLABLE, OPEN_FULL_TABLE),
+ Column("REFERENCED_COLUMN_NAME", Name(), NULLABLE, OPEN_FULL_TABLE),
+ CEnd()
};
ST_FIELD_INFO table_names_fields_info[]=
{
- {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"TABLE_SCHEMA",NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"TABLE_NAME", NAME_CHAR_LEN + MYSQL50_TABLE_NAME_PREFIX_LENGTH,
- MYSQL_TYPE_STRING, 0, 0, "Tables_in_", SKIP_OPEN_TABLE},
- {"TABLE_TYPE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Table_type",
- OPEN_FRM_ONLY},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
+ Column("TABLE_CATALOG", Catalog(), NOT_NULL),
+ Column("TABLE_SCHEMA", Name(), NOT_NULL),
+ Column("TABLE_NAME", Varchar(NAME_CHAR_LEN + MYSQL50_TABLE_NAME_PREFIX_LENGTH),
+ NOT_NULL, "Tables_in_"),
+ Column("TABLE_TYPE", Name(), NOT_NULL, "Table_type", OPEN_FRM_ONLY),
+ CEnd()
};
ST_FIELD_INFO open_tables_fields_info[]=
{
- {"Database", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Database",
- SKIP_OPEN_TABLE},
- {"Table",NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Table", SKIP_OPEN_TABLE},
- {"In_use", 1, MYSQL_TYPE_LONGLONG, 0, 0, "In_use", SKIP_OPEN_TABLE},
- {"Name_locked", 4, MYSQL_TYPE_LONGLONG, 0, 0, "Name_locked", SKIP_OPEN_TABLE},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
+ Column("Database", Name(), NOT_NULL, "Database"),
+ Column("Table", Name(), NOT_NULL, "Table"),
+ Column("In_use", SLonglong(1), NOT_NULL, "In_use"),
+ Column("Name_locked", SLonglong(4), NOT_NULL, "Name_locked"),
+ CEnd()
};
ST_FIELD_INFO triggers_fields_info[]=
{
- {"TRIGGER_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
- {"TRIGGER_SCHEMA",NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
- {"TRIGGER_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Trigger",
- OPEN_FRM_ONLY},
- {"EVENT_MANIPULATION", 6, MYSQL_TYPE_STRING, 0, 0, "Event", OPEN_FRM_ONLY},
- {"EVENT_OBJECT_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0,
- OPEN_FRM_ONLY},
- {"EVENT_OBJECT_SCHEMA",NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0,
- OPEN_FRM_ONLY},
- {"EVENT_OBJECT_TABLE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Table",
- OPEN_FRM_ONLY},
- {"ACTION_ORDER", 4, MYSQL_TYPE_LONGLONG, 0, 0, 0, OPEN_FRM_ONLY},
- {"ACTION_CONDITION", 65535, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FRM_ONLY},
- {"ACTION_STATEMENT", 65535, MYSQL_TYPE_STRING, 0, 0, "Statement",
- OPEN_FRM_ONLY},
- {"ACTION_ORIENTATION", 9, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
- {"ACTION_TIMING", 6, MYSQL_TYPE_STRING, 0, 0, "Timing", OPEN_FRM_ONLY},
- {"ACTION_REFERENCE_OLD_TABLE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, 0,
- OPEN_FRM_ONLY},
- {"ACTION_REFERENCE_NEW_TABLE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, 0,
- OPEN_FRM_ONLY},
- {"ACTION_REFERENCE_OLD_ROW", 3, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
- {"ACTION_REFERENCE_NEW_ROW", 3, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
+ Column("TRIGGER_CATALOG", Catalog(), NOT_NULL, OPEN_FRM_ONLY),
+ Column("TRIGGER_SCHEMA", Name(), NOT_NULL, OPEN_FRM_ONLY),
+ Column("TRIGGER_NAME", Name(), NOT_NULL, "Trigger", OPEN_FRM_ONLY),
+ Column("EVENT_MANIPULATION", Varchar(6), NOT_NULL, "Event", OPEN_FRM_ONLY),
+ Column("EVENT_OBJECT_CATALOG", Catalog(), NOT_NULL, OPEN_FRM_ONLY),
+ Column("EVENT_OBJECT_SCHEMA", Name(), NOT_NULL, OPEN_FRM_ONLY),
+ Column("EVENT_OBJECT_TABLE", Name(), NOT_NULL, "Table", OPEN_FRM_ONLY),
+ Column("ACTION_ORDER", SLonglong(4), NOT_NULL, OPEN_FRM_ONLY),
+ Column("ACTION_CONDITION", Longtext(65535), NULLABLE, OPEN_FRM_ONLY),
+ Column("ACTION_STATEMENT", Longtext(65535), NOT_NULL, "Statement",OPEN_FRM_ONLY),
+ Column("ACTION_ORIENTATION", Varchar(9), NOT_NULL, OPEN_FRM_ONLY),
+ Column("ACTION_TIMING", Varchar(6), NOT_NULL, "Timing", OPEN_FRM_ONLY),
+ Column("ACTION_REFERENCE_OLD_TABLE",Name(), NULLABLE, OPEN_FRM_ONLY),
+ Column("ACTION_REFERENCE_NEW_TABLE",Name(), NULLABLE, OPEN_FRM_ONLY),
+ Column("ACTION_REFERENCE_OLD_ROW",Varchar(3),NOT_NULL, OPEN_FRM_ONLY),
+ Column("ACTION_REFERENCE_NEW_ROW",Varchar(3),NOT_NULL, OPEN_FRM_ONLY),
/* 2 here indicates 2 decimals */
- {"CREATED", 2, MYSQL_TYPE_DATETIME, 0, 1, "Created", OPEN_FRM_ONLY},
- {"SQL_MODE", 32*256, MYSQL_TYPE_STRING, 0, 0, "sql_mode", OPEN_FRM_ONLY},
- {"DEFINER", DEFINER_CHAR_LENGTH, MYSQL_TYPE_STRING, 0, 0, "Definer", OPEN_FRM_ONLY},
- {"CHARACTER_SET_CLIENT", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0,
- "character_set_client", OPEN_FRM_ONLY},
- {"COLLATION_CONNECTION", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0,
- "collation_connection", OPEN_FRM_ONLY},
- {"DATABASE_COLLATION", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0,
- "Database Collation", OPEN_FRM_ONLY},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
+ Column("CREATED", Datetime(2), NULLABLE, "Created", OPEN_FRM_ONLY),
+ Column("SQL_MODE", SQLMode(), NOT_NULL, "sql_mode", OPEN_FRM_ONLY),
+ Column("DEFINER", Definer(), NOT_NULL, "Definer", OPEN_FRM_ONLY),
+ Column("CHARACTER_SET_CLIENT", CSName(), NOT_NULL, "character_set_client",
+ OPEN_FRM_ONLY),
+ Column("COLLATION_CONNECTION", CSName(), NOT_NULL, "collation_connection",
+ OPEN_FRM_ONLY),
+ Column("DATABASE_COLLATION", CSName(), NOT_NULL, "Database Collation",
+ OPEN_FRM_ONLY),
+ CEnd()
};
ST_FIELD_INFO partitions_fields_info[]=
{
- {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
- {"TABLE_SCHEMA",NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
- {"TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
- {"PARTITION_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FULL_TABLE},
- {"SUBPARTITION_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, 0,
- OPEN_FULL_TABLE},
- {"PARTITION_ORDINAL_POSITION", 21 , MYSQL_TYPE_LONGLONG, 0,
- (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), 0, OPEN_FULL_TABLE},
- {"SUBPARTITION_ORDINAL_POSITION", 21 , MYSQL_TYPE_LONGLONG, 0,
- (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), 0, OPEN_FULL_TABLE},
- {"PARTITION_METHOD", 18, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FULL_TABLE},
- {"SUBPARTITION_METHOD", 12, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FULL_TABLE},
- {"PARTITION_EXPRESSION", 65535, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FULL_TABLE},
- {"SUBPARTITION_EXPRESSION", 65535, MYSQL_TYPE_STRING, 0, 1, 0,
- OPEN_FULL_TABLE},
- {"PARTITION_DESCRIPTION", 65535, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FULL_TABLE},
- {"TABLE_ROWS", 21 , MYSQL_TYPE_LONGLONG, 0, MY_I_S_UNSIGNED, 0,
- OPEN_FULL_TABLE},
- {"AVG_ROW_LENGTH", 21 , MYSQL_TYPE_LONGLONG, 0, MY_I_S_UNSIGNED, 0,
- OPEN_FULL_TABLE},
- {"DATA_LENGTH", 21 , MYSQL_TYPE_LONGLONG, 0, MY_I_S_UNSIGNED, 0,
- OPEN_FULL_TABLE},
- {"MAX_DATA_LENGTH", 21 , MYSQL_TYPE_LONGLONG, 0,
- (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), 0, OPEN_FULL_TABLE},
- {"INDEX_LENGTH", 21 , MYSQL_TYPE_LONGLONG, 0, MY_I_S_UNSIGNED, 0,
- OPEN_FULL_TABLE},
- {"DATA_FREE", 21 , MYSQL_TYPE_LONGLONG, 0, MY_I_S_UNSIGNED, 0,
- OPEN_FULL_TABLE},
- {"CREATE_TIME", 0, MYSQL_TYPE_DATETIME, 0, 1, 0, OPEN_FULL_TABLE},
- {"UPDATE_TIME", 0, MYSQL_TYPE_DATETIME, 0, 1, 0, OPEN_FULL_TABLE},
- {"CHECK_TIME", 0, MYSQL_TYPE_DATETIME, 0, 1, 0, OPEN_FULL_TABLE},
- {"CHECKSUM", 21 , MYSQL_TYPE_LONGLONG, 0,
- (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), 0, OPEN_FULL_TABLE},
- {"PARTITION_COMMENT", 80, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
- {"NODEGROUP", 12 , MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
- {"TABLESPACE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, 0,
- OPEN_FULL_TABLE},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
+ Column("TABLE_CATALOG", Catalog(), NOT_NULL, OPEN_FULL_TABLE),
+ Column("TABLE_SCHEMA", Name(), NOT_NULL, OPEN_FULL_TABLE),
+ Column("TABLE_NAME", Name(), NOT_NULL, OPEN_FULL_TABLE),
+ Column("PARTITION_NAME", Name(), NULLABLE, OPEN_FULL_TABLE),
+ Column("SUBPARTITION_NAME", Name(), NULLABLE, OPEN_FULL_TABLE),
+ Column("PARTITION_ORDINAL_POSITION", ULonglong(), NULLABLE, OPEN_FULL_TABLE),
+ Column("SUBPARTITION_ORDINAL_POSITION",ULonglong(),NULLABLE, OPEN_FULL_TABLE),
+ Column("PARTITION_METHOD", Varchar(18), NULLABLE, OPEN_FULL_TABLE),
+ Column("SUBPARTITION_METHOD", Varchar(12), NULLABLE, OPEN_FULL_TABLE),
+ Column("PARTITION_EXPRESSION", Longtext(65535), NULLABLE, OPEN_FULL_TABLE),
+ Column("SUBPARTITION_EXPRESSION", Longtext(65535), NULLABLE, OPEN_FULL_TABLE),
+ Column("PARTITION_DESCRIPTION", Longtext(65535), NULLABLE, OPEN_FULL_TABLE),
+ Column("TABLE_ROWS", ULonglong(), NOT_NULL, OPEN_FULL_TABLE),
+ Column("AVG_ROW_LENGTH", ULonglong(), NOT_NULL, OPEN_FULL_TABLE),
+ Column("DATA_LENGTH", ULonglong(), NOT_NULL, OPEN_FULL_TABLE),
+ Column("MAX_DATA_LENGTH", ULonglong(), NULLABLE, OPEN_FULL_TABLE),
+ Column("INDEX_LENGTH", ULonglong(), NOT_NULL, OPEN_FULL_TABLE),
+ Column("DATA_FREE", ULonglong(), NOT_NULL, OPEN_FULL_TABLE),
+ Column("CREATE_TIME", Datetime(0), NULLABLE, OPEN_FULL_TABLE),
+ Column("UPDATE_TIME", Datetime(0), NULLABLE, OPEN_FULL_TABLE),
+ Column("CHECK_TIME", Datetime(0), NULLABLE, OPEN_FULL_TABLE),
+ Column("CHECKSUM", ULonglong(), NULLABLE, OPEN_FULL_TABLE),
+ Column("PARTITION_COMMENT", Varchar(80), NOT_NULL, OPEN_FULL_TABLE),
+ Column("NODEGROUP", Varchar(12), NOT_NULL, OPEN_FULL_TABLE),
+ Column("TABLESPACE_NAME", Name(), NULLABLE, OPEN_FULL_TABLE),
+ CEnd()
};
ST_FIELD_INFO variables_fields_info[]=
{
- {"VARIABLE_NAME", 64, MYSQL_TYPE_STRING, 0, 0, "Variable_name",
- 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}
+ Column("VARIABLE_NAME", Varchar(64), NOT_NULL, "Variable_name"),
+ Column("VARIABLE_VALUE", Varchar(2048), NOT_NULL, "Value"),
+ CEnd()
};
ST_FIELD_INFO sysvars_fields_info[]=
{
- {"VARIABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 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", 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},
- {"NUMERIC_MIN_VALUE", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, 0, 0},
- {"NUMERIC_MAX_VALUE", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, 0, 0},
- {"NUMERIC_BLOCK_SIZE", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, 0, 0},
- {"ENUM_VALUE_LIST", 65535, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, 0, 0},
- {"READ_ONLY", 3, MYSQL_TYPE_STRING, 0, 0, 0, 0},
- {"COMMAND_LINE_ARGUMENT", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, 0, 0},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, 0}
+ Column("VARIABLE_NAME", Name(), NOT_NULL),
+ Column("SESSION_VALUE", Varchar(2048), NULLABLE),
+ Column("GLOBAL_VALUE", Varchar(2048), NULLABLE),
+ Column("GLOBAL_VALUE_ORIGIN", Name(), NOT_NULL),
+ Column("DEFAULT_VALUE", Varchar(2048), NULLABLE),
+ Column("VARIABLE_SCOPE", Name(), NOT_NULL),
+ Column("VARIABLE_TYPE", Name(), NOT_NULL),
+ Column("VARIABLE_COMMENT", Varchar(TABLE_COMMENT_MAXLEN), NOT_NULL),
+ Column("NUMERIC_MIN_VALUE", Varchar(MY_INT64_NUM_DECIMAL_DIGITS), NULLABLE),
+ Column("NUMERIC_MAX_VALUE", Varchar(MY_INT64_NUM_DECIMAL_DIGITS), NULLABLE),
+ Column("NUMERIC_BLOCK_SIZE", Varchar(MY_INT64_NUM_DECIMAL_DIGITS), NULLABLE),
+ Column("ENUM_VALUE_LIST", Longtext(65535), NULLABLE),
+ Column("READ_ONLY", Yesno(), NOT_NULL),
+ Column("COMMAND_LINE_ARGUMENT",Name(), NULLABLE),
+ CEnd()
};
ST_FIELD_INFO processlist_fields_info[]=
{
- {"ID", 4, MYSQL_TYPE_LONGLONG, 0, 0, "Id", SKIP_OPEN_TABLE},
- {"USER", USERNAME_CHAR_LENGTH, MYSQL_TYPE_STRING, 0, 0, "User",
- SKIP_OPEN_TABLE},
- {"HOST", LIST_PROCESS_HOST_LEN, MYSQL_TYPE_STRING, 0, 0, "Host",
- SKIP_OPEN_TABLE},
- {"DB", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, "Db", SKIP_OPEN_TABLE},
- {"COMMAND", 16, MYSQL_TYPE_STRING, 0, 0, "Command", SKIP_OPEN_TABLE},
- {"TIME", 7, MYSQL_TYPE_LONG, 0, 0, "Time", SKIP_OPEN_TABLE},
- {"STATE", 64, MYSQL_TYPE_STRING, 0, 1, "State", SKIP_OPEN_TABLE},
- {"INFO", PROCESS_LIST_INFO_WIDTH, MYSQL_TYPE_STRING, 0, 1, "Info",
- SKIP_OPEN_TABLE},
- {"TIME_MS", 100 * (MY_INT64_NUM_DECIMAL_DIGITS + 1) + 3, MYSQL_TYPE_DECIMAL,
- 0, 0, "Time_ms", SKIP_OPEN_TABLE},
- {"STAGE", 2, MYSQL_TYPE_TINY, 0, 0, "Stage", SKIP_OPEN_TABLE},
- {"MAX_STAGE", 2, MYSQL_TYPE_TINY, 0, 0, "Max_stage", SKIP_OPEN_TABLE},
- {"PROGRESS", 703, MYSQL_TYPE_DECIMAL, 0, 0, "Progress",
- SKIP_OPEN_TABLE},
- {"MEMORY_USED", 7, MYSQL_TYPE_LONGLONG, 0, 0, "Memory_used", SKIP_OPEN_TABLE},
- {"MAX_MEMORY_USED", 7, MYSQL_TYPE_LONGLONG, 0, 0, "Max_memory_used", SKIP_OPEN_TABLE},
- {"EXAMINED_ROWS", 7, MYSQL_TYPE_LONG, 0, 0, "Examined_rows", SKIP_OPEN_TABLE},
- {"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}
+ Column("ID", SLonglong(4), NOT_NULL, "Id"),
+ Column("USER", Varchar(USERNAME_CHAR_LENGTH), NOT_NULL, "User"),
+ Column("HOST", Varchar(LIST_PROCESS_HOST_LEN),NOT_NULL, "Host"),
+ Column("DB", Name(), NULLABLE, "Db"),
+ Column("COMMAND", Varchar(16), NOT_NULL, "Command"),
+ Column("TIME", SLong(7), NOT_NULL, "Time"),
+ Column("STATE", Varchar(64), NULLABLE, "State"),
+ Column("INFO", Longtext(PROCESS_LIST_INFO_WIDTH),
+ NULLABLE, "Info"),
+ Column("TIME_MS", Decimal(100 * (MY_INT64_NUM_DECIMAL_DIGITS + 1) + 3),
+ NOT_NULL, "Time_ms"),
+ Column("STAGE", STiny(2), NOT_NULL, "Stage"),
+ Column("MAX_STAGE", STiny(2), NOT_NULL, "Max_stage"),
+ Column("PROGRESS", Decimal(703), NOT_NULL, "Progress"),
+ Column("MEMORY_USED", SLonglong(7), NOT_NULL, "Memory_used"),
+ Column("MAX_MEMORY_USED",SLonglong(7), NOT_NULL, "Max_memory_used"),
+ Column("EXAMINED_ROWS", SLong(7), NOT_NULL, "Examined_rows"),
+ Column("QUERY_ID", SLonglong(4), NOT_NULL),
+ Column("INFO_BINARY",Blob(PROCESS_LIST_INFO_WIDTH),NULLABLE, "Info_binary"),
+ Column("TID", SLonglong(4), NOT_NULL, "Tid"),
+ CEnd()
};
ST_FIELD_INFO plugin_fields_info[]=
{
- {"PLUGIN_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Name",
- SKIP_OPEN_TABLE},
- {"PLUGIN_VERSION", 20, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"PLUGIN_STATUS", 16, MYSQL_TYPE_STRING, 0, 0, "Status", SKIP_OPEN_TABLE},
- {"PLUGIN_TYPE", 80, MYSQL_TYPE_STRING, 0, 0, "Type", SKIP_OPEN_TABLE},
- {"PLUGIN_TYPE_VERSION", 20, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"PLUGIN_LIBRARY", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, "Library",
- SKIP_OPEN_TABLE},
- {"PLUGIN_LIBRARY_VERSION", 20, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN_TABLE},
- {"PLUGIN_AUTHOR", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN_TABLE},
- {"PLUGIN_DESCRIPTION", 65535, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN_TABLE},
- {"PLUGIN_LICENSE", 80, MYSQL_TYPE_STRING, 0, 0, "License", SKIP_OPEN_TABLE},
- {"LOAD_OPTION", 64, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"PLUGIN_MATURITY", 12, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"PLUGIN_AUTH_VERSION", 80, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN_TABLE},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
+ Column("PLUGIN_NAME", Name(), NOT_NULL, "Name"),
+ Column("PLUGIN_VERSION", Varchar(20), NOT_NULL),
+ Column("PLUGIN_STATUS", Varchar(16), NOT_NULL, "Status"),
+ Column("PLUGIN_TYPE", Varchar(80), NOT_NULL, "Type"),
+ Column("PLUGIN_TYPE_VERSION", Varchar(20), NOT_NULL),
+ Column("PLUGIN_LIBRARY", Name(), NULLABLE, "Library"),
+ Column("PLUGIN_LIBRARY_VERSION", Varchar(20), NULLABLE),
+ Column("PLUGIN_AUTHOR", Name(), NULLABLE),
+ Column("PLUGIN_DESCRIPTION", Longtext(65535), NULLABLE),
+ Column("PLUGIN_LICENSE", Varchar(80), NOT_NULL, "License"),
+ Column("LOAD_OPTION", Varchar(64), NOT_NULL),
+ Column("PLUGIN_MATURITY", Varchar(12), NOT_NULL),
+ Column("PLUGIN_AUTH_VERSION", Varchar(80), NULLABLE),
+ CEnd()
};
ST_FIELD_INFO files_fields_info[]=
{
- {"FILE_ID", 4, MYSQL_TYPE_LONGLONG, 0, 0, 0, SKIP_OPEN_TABLE},
- {"FILE_NAME", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN_TABLE},
- {"FILE_TYPE", 20, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"TABLESPACE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, 0,
- SKIP_OPEN_TABLE},
- {"TABLE_CATALOG", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"TABLE_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN_TABLE},
- {"TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN_TABLE},
- {"LOGFILE_GROUP_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, 0,
- SKIP_OPEN_TABLE},
- {"LOGFILE_GROUP_NUMBER", 4, MYSQL_TYPE_LONGLONG, 0, 1, 0, SKIP_OPEN_TABLE},
- {"ENGINE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"FULLTEXT_KEYS", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN_TABLE},
- {"DELETED_ROWS", 4, MYSQL_TYPE_LONGLONG, 0, 1, 0, SKIP_OPEN_TABLE},
- {"UPDATE_COUNT", 4, MYSQL_TYPE_LONGLONG, 0, 1, 0, SKIP_OPEN_TABLE},
- {"FREE_EXTENTS", 4, MYSQL_TYPE_LONGLONG, 0, 1, 0, SKIP_OPEN_TABLE},
- {"TOTAL_EXTENTS", 4, MYSQL_TYPE_LONGLONG, 0, 1, 0, SKIP_OPEN_TABLE},
- {"EXTENT_SIZE", 4, MYSQL_TYPE_LONGLONG, 0, 0, 0, SKIP_OPEN_TABLE},
- {"INITIAL_SIZE", 21, MYSQL_TYPE_LONGLONG, 0,
- (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), 0, SKIP_OPEN_TABLE},
- {"MAXIMUM_SIZE", 21, MYSQL_TYPE_LONGLONG, 0,
- (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), 0, SKIP_OPEN_TABLE},
- {"AUTOEXTEND_SIZE", 21, MYSQL_TYPE_LONGLONG, 0,
- (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), 0, SKIP_OPEN_TABLE},
- {"CREATION_TIME", 0, MYSQL_TYPE_DATETIME, 0, 1, 0, SKIP_OPEN_TABLE},
- {"LAST_UPDATE_TIME", 0, MYSQL_TYPE_DATETIME, 0, 1, 0, SKIP_OPEN_TABLE},
- {"LAST_ACCESS_TIME", 0, MYSQL_TYPE_DATETIME, 0, 1, 0, SKIP_OPEN_TABLE},
- {"RECOVER_TIME", 4, MYSQL_TYPE_LONGLONG, 0, 1, 0, SKIP_OPEN_TABLE},
- {"TRANSACTION_COUNTER", 4, MYSQL_TYPE_LONGLONG, 0, 1, 0, SKIP_OPEN_TABLE},
- {"VERSION", 21 , MYSQL_TYPE_LONGLONG, 0,
- (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Version", SKIP_OPEN_TABLE},
- {"ROW_FORMAT", 10, MYSQL_TYPE_STRING, 0, 1, "Row_format", SKIP_OPEN_TABLE},
- {"TABLE_ROWS", 21 , MYSQL_TYPE_LONGLONG, 0,
- (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Rows", SKIP_OPEN_TABLE},
- {"AVG_ROW_LENGTH", 21 , MYSQL_TYPE_LONGLONG, 0,
- (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Avg_row_length", SKIP_OPEN_TABLE},
- {"DATA_LENGTH", 21 , MYSQL_TYPE_LONGLONG, 0,
- (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Data_length", SKIP_OPEN_TABLE},
- {"MAX_DATA_LENGTH", 21 , MYSQL_TYPE_LONGLONG, 0,
- (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Max_data_length", SKIP_OPEN_TABLE},
- {"INDEX_LENGTH", 21 , MYSQL_TYPE_LONGLONG, 0,
- (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Index_length", SKIP_OPEN_TABLE},
- {"DATA_FREE", 21 , MYSQL_TYPE_LONGLONG, 0,
- (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Data_free", SKIP_OPEN_TABLE},
- {"CREATE_TIME", 0, MYSQL_TYPE_DATETIME, 0, 1, "Create_time", SKIP_OPEN_TABLE},
- {"UPDATE_TIME", 0, MYSQL_TYPE_DATETIME, 0, 1, "Update_time", SKIP_OPEN_TABLE},
- {"CHECK_TIME", 0, MYSQL_TYPE_DATETIME, 0, 1, "Check_time", SKIP_OPEN_TABLE},
- {"CHECKSUM", 21 , MYSQL_TYPE_LONGLONG, 0,
- (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Checksum", SKIP_OPEN_TABLE},
- {"STATUS", 20, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"EXTRA", 255, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN_TABLE},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
+ Column("FILE_ID", SLonglong(4), NOT_NULL),
+ Column("FILE_NAME", Varchar(FN_REFLEN),NULLABLE),
+ Column("FILE_TYPE", Varchar(20), NOT_NULL),
+ Column("TABLESPACE_NAME", Name(), NULLABLE),
+ Column("TABLE_CATALOG", Name(), NOT_NULL),
+ Column("TABLE_SCHEMA", Name(), NULLABLE),
+ Column("TABLE_NAME", Name(), NULLABLE),
+ Column("LOGFILE_GROUP_NAME", Name(), NULLABLE),
+ Column("LOGFILE_GROUP_NUMBER",SLonglong(4), NULLABLE),
+ Column("ENGINE", Name(), NOT_NULL),
+ Column("FULLTEXT_KEYS", Name(), NULLABLE),
+ Column("DELETED_ROWS", SLonglong(4), NULLABLE),
+ Column("UPDATE_COUNT", SLonglong(4), NULLABLE),
+ Column("FREE_EXTENTS", SLonglong(4), NULLABLE),
+ Column("TOTAL_EXTENTS", SLonglong(4), NULLABLE),
+ Column("EXTENT_SIZE", SLonglong(4), NOT_NULL),
+ Column("INITIAL_SIZE", ULonglong(), NULLABLE),
+ Column("MAXIMUM_SIZE", ULonglong(), NULLABLE),
+ Column("AUTOEXTEND_SIZE", ULonglong(), NULLABLE),
+ Column("CREATION_TIME", Datetime(0), NULLABLE),
+ Column("LAST_UPDATE_TIME", Datetime(0), NULLABLE),
+ Column("LAST_ACCESS_TIME", Datetime(0), NULLABLE),
+ Column("RECOVER_TIME", SLonglong(4), NULLABLE),
+ Column("TRANSACTION_COUNTER", SLonglong(4), NULLABLE),
+ Column("VERSION", ULonglong(), NULLABLE, "Version"),
+ Column("ROW_FORMAT", Varchar(10), NULLABLE, "Row_format"),
+ Column("TABLE_ROWS", ULonglong(), NULLABLE, "Rows"),
+ Column("AVG_ROW_LENGTH", ULonglong(), NULLABLE, "Avg_row_length"),
+ Column("DATA_LENGTH", ULonglong(), NULLABLE, "Data_length"),
+ Column("MAX_DATA_LENGTH", ULonglong(), NULLABLE, "Max_data_length"),
+ Column("INDEX_LENGTH", ULonglong(), NULLABLE, "Index_length"),
+ Column("DATA_FREE", ULonglong(), NULLABLE, "Data_free"),
+ Column("CREATE_TIME", Datetime(0), NULLABLE, "Create_time"),
+ Column("UPDATE_TIME", Datetime(0), NULLABLE, "Update_time"),
+ Column("CHECK_TIME", Datetime(0), NULLABLE, "Check_time"),
+ Column("CHECKSUM", ULonglong(), NULLABLE, "Checksum"),
+ Column("STATUS", Varchar(20), NOT_NULL),
+ Column("EXTRA", Varchar(255), NULLABLE),
+ CEnd()
};
+}; // namespace Show
+
+
void init_fill_schema_files_row(TABLE* table)
{
int i;
- for(i=0; files_fields_info[i].field_name!=NULL; i++)
+ for(i=0; !Show::files_fields_info[i].end_marker(); i++)
table->field[i]->set_null();
table->field[IS_FILES_STATUS]->set_notnull();
table->field[IS_FILES_STATUS]->store("NORMAL", 6, system_charset_info);
}
+
+namespace Show {
+
ST_FIELD_INFO referential_constraints_fields_info[]=
{
- {"CONSTRAINT_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
- {"CONSTRAINT_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0,
- OPEN_FULL_TABLE},
- {"CONSTRAINT_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0,
- OPEN_FULL_TABLE},
- {"UNIQUE_CONSTRAINT_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0,
- OPEN_FULL_TABLE},
- {"UNIQUE_CONSTRAINT_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0,
- OPEN_FULL_TABLE},
- {"UNIQUE_CONSTRAINT_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0,
- MY_I_S_MAYBE_NULL, 0, OPEN_FULL_TABLE},
- {"MATCH_OPTION", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
- {"UPDATE_RULE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
- {"DELETE_RULE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
- {"TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
- {"REFERENCED_TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0,
- OPEN_FULL_TABLE},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
+ Column("CONSTRAINT_CATALOG", Catalog(), NOT_NULL, OPEN_FULL_TABLE),
+ Column("CONSTRAINT_SCHEMA", Name(), NOT_NULL, OPEN_FULL_TABLE),
+ Column("CONSTRAINT_NAME", Name(), NOT_NULL, OPEN_FULL_TABLE),
+ Column("UNIQUE_CONSTRAINT_CATALOG", Catalog(), NOT_NULL, OPEN_FULL_TABLE),
+ Column("UNIQUE_CONSTRAINT_SCHEMA", Name(), NOT_NULL, OPEN_FULL_TABLE),
+ Column("UNIQUE_CONSTRAINT_NAME", Name(), NULLABLE, OPEN_FULL_TABLE),
+ Column("MATCH_OPTION", Name(), NOT_NULL, OPEN_FULL_TABLE),
+ Column("UPDATE_RULE", Name(), NOT_NULL, OPEN_FULL_TABLE),
+ Column("DELETE_RULE", Name(), NOT_NULL, OPEN_FULL_TABLE),
+ Column("TABLE_NAME", Name(), NOT_NULL, OPEN_FULL_TABLE),
+ Column("REFERENCED_TABLE_NAME", Name(), NOT_NULL, OPEN_FULL_TABLE),
+ CEnd()
};
ST_FIELD_INFO parameters_fields_info[]=
{
- {"SPECIFIC_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
- {"SPECIFIC_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0,
- OPEN_FULL_TABLE},
- {"SPECIFIC_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
- {"ORDINAL_POSITION", 21 , MYSQL_TYPE_LONG, 0, 0, 0, OPEN_FULL_TABLE},
- {"PARAMETER_MODE", 5, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FULL_TABLE},
- {"PARAMETER_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FULL_TABLE},
- {"DATA_TYPE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
- {"CHARACTER_MAXIMUM_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 1, 0, OPEN_FULL_TABLE},
- {"CHARACTER_OCTET_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 1, 0, OPEN_FULL_TABLE},
- {"NUMERIC_PRECISION", 21 , MYSQL_TYPE_LONG, 0, 1, 0, OPEN_FULL_TABLE},
- {"NUMERIC_SCALE", 21 , MYSQL_TYPE_LONG, 0, 1, 0, OPEN_FULL_TABLE},
- {"DATETIME_PRECISION", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG,
- 0, (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), 0, OPEN_FRM_ONLY},
- {"CHARACTER_SET_NAME", 64, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FULL_TABLE},
- {"COLLATION_NAME", 64, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FULL_TABLE},
- {"DTD_IDENTIFIER", 65535, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
- {"ROUTINE_TYPE", 9, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE}
+ Column("SPECIFIC_CATALOG", Catalog(), NOT_NULL, OPEN_FULL_TABLE),
+ Column("SPECIFIC_SCHEMA", Name(), NOT_NULL, OPEN_FULL_TABLE),
+ Column("SPECIFIC_NAME", Name(), NOT_NULL, OPEN_FULL_TABLE),
+ Column("ORDINAL_POSITION", SLong(21), NOT_NULL, OPEN_FULL_TABLE),
+ Column("PARAMETER_MODE", Varchar(5), NULLABLE, OPEN_FULL_TABLE),
+ Column("PARAMETER_NAME", Name(), NULLABLE, OPEN_FULL_TABLE),
+ Column("DATA_TYPE", Name(), NOT_NULL, OPEN_FULL_TABLE),
+ Column("CHARACTER_MAXIMUM_LENGTH",SLong(21), NULLABLE, OPEN_FULL_TABLE),
+ Column("CHARACTER_OCTET_LENGTH", SLong(21), NULLABLE, OPEN_FULL_TABLE),
+ Column("NUMERIC_PRECISION", SLong(21), NULLABLE, OPEN_FULL_TABLE),
+ Column("NUMERIC_SCALE", SLong(21), NULLABLE, OPEN_FULL_TABLE),
+ Column("DATETIME_PRECISION", ULonglong(), NULLABLE, OPEN_FRM_ONLY),
+ Column("CHARACTER_SET_NAME", Varchar(64), NULLABLE, OPEN_FULL_TABLE),
+ Column("COLLATION_NAME", Varchar(64), NULLABLE, OPEN_FULL_TABLE),
+ Column("DTD_IDENTIFIER", Longtext(65535), NOT_NULL, OPEN_FULL_TABLE),
+ Column("ROUTINE_TYPE", Varchar(9), NOT_NULL, OPEN_FULL_TABLE),
+ CEnd()
};
ST_FIELD_INFO tablespaces_fields_info[]=
{
- {"TABLESPACE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0,
- SKIP_OPEN_TABLE},
- {"ENGINE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"TABLESPACE_TYPE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL,
- 0, SKIP_OPEN_TABLE},
- {"LOGFILE_GROUP_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL,
- 0, SKIP_OPEN_TABLE},
- {"EXTENT_SIZE", 21, MYSQL_TYPE_LONGLONG, 0,
- MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED, 0, SKIP_OPEN_TABLE},
- {"AUTOEXTEND_SIZE", 21, MYSQL_TYPE_LONGLONG, 0,
- MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED, 0, SKIP_OPEN_TABLE},
- {"MAXIMUM_SIZE", 21, MYSQL_TYPE_LONGLONG, 0,
- MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED, 0, SKIP_OPEN_TABLE},
- {"NODEGROUP_ID", 21, MYSQL_TYPE_LONGLONG, 0,
- MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED, 0, SKIP_OPEN_TABLE},
- {"TABLESPACE_COMMENT", 2048, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, 0,
- SKIP_OPEN_TABLE},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
+ Column("TABLESPACE_NAME", Name(), NOT_NULL),
+ Column("ENGINE", Name(), NOT_NULL),
+ Column("TABLESPACE_TYPE", Name(), NULLABLE),
+ Column("LOGFILE_GROUP_NAME", Name(), NULLABLE),
+ Column("EXTENT_SIZE", ULonglong(), NULLABLE),
+ Column("AUTOEXTEND_SIZE", ULonglong(), NULLABLE),
+ Column("MAXIMUM_SIZE", ULonglong(), NULLABLE),
+ Column("NODEGROUP_ID", ULonglong(), NULLABLE),
+ Column("TABLESPACE_COMMENT", Varchar(2048), NULLABLE),
+ CEnd()
};
ST_FIELD_INFO keycache_fields_info[]=
{
- {"KEY_CACHE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"SEGMENTS", 3, MYSQL_TYPE_LONG, 0,
- (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED) , 0, SKIP_OPEN_TABLE},
- {"SEGMENT_NUMBER", 3, MYSQL_TYPE_LONG, 0,
- (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), 0, SKIP_OPEN_TABLE},
- {"FULL_SIZE", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0,
- (MY_I_S_UNSIGNED), 0, SKIP_OPEN_TABLE},
- {"BLOCK_SIZE", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0,
- (MY_I_S_UNSIGNED), 0, SKIP_OPEN_TABLE },
- {"USED_BLOCKS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0,
- (MY_I_S_UNSIGNED), "Key_blocks_used", SKIP_OPEN_TABLE},
- {"UNUSED_BLOCKS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0,
- (MY_I_S_UNSIGNED), "Key_blocks_unused", SKIP_OPEN_TABLE},
- {"DIRTY_BLOCKS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0,
- (MY_I_S_UNSIGNED), "Key_blocks_not_flushed", SKIP_OPEN_TABLE},
- {"READ_REQUESTS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0,
- (MY_I_S_UNSIGNED), "Key_read_requests", SKIP_OPEN_TABLE},
- {"READS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0,
- (MY_I_S_UNSIGNED), "Key_reads", SKIP_OPEN_TABLE},
- {"WRITE_REQUESTS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0,
- (MY_I_S_UNSIGNED), "Key_write_requests", SKIP_OPEN_TABLE},
- {"WRITES", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0,
- (MY_I_S_UNSIGNED), "Key_writes", SKIP_OPEN_TABLE},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
+ Column("KEY_CACHE_NAME",Varchar(NAME_LEN),NOT_NULL),
+ Column("SEGMENTS", ULong(3), NULLABLE),
+ Column("SEGMENT_NUMBER", ULong(3), NULLABLE),
+ Column("FULL_SIZE", ULonglong(), NOT_NULL),
+ Column("BLOCK_SIZE", ULonglong(), NOT_NULL),
+ Column("USED_BLOCKS", ULonglong(), NOT_NULL, "Key_blocks_used"),
+ Column("UNUSED_BLOCKS", ULonglong(), NOT_NULL, "Key_blocks_unused"),
+ Column("DIRTY_BLOCKS", ULonglong(), NOT_NULL, "Key_blocks_not_flushed"),
+ Column("READ_REQUESTS", ULonglong(), NOT_NULL, "Key_read_requests"),
+ Column("READS", ULonglong(), NOT_NULL, "Key_reads"),
+ Column("WRITE_REQUESTS", ULonglong(), NOT_NULL, "Key_write_requests"),
+ Column("WRITES", ULonglong(), NOT_NULL, "Key_writes"),
+ CEnd()
};
ST_FIELD_INFO show_explain_fields_info[]=
{
- /* field_name, length, type, value, field_flags, old_name*/
- {"id", 3, MYSQL_TYPE_LONGLONG, 0 /*value*/, MY_I_S_MAYBE_NULL, "id",
- SKIP_OPEN_TABLE},
- {"select_type", 19, MYSQL_TYPE_STRING, 0 /*value*/, 0, "select_type",
- SKIP_OPEN_TABLE},
- {"table", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0 /*value*/, MY_I_S_MAYBE_NULL,
- "table", SKIP_OPEN_TABLE},
- {"type", 15, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, "type", SKIP_OPEN_TABLE},
- {"possible_keys", NAME_CHAR_LEN*MAX_KEY, MYSQL_TYPE_STRING, 0/*value*/,
- MY_I_S_MAYBE_NULL, "possible_keys", SKIP_OPEN_TABLE},
- {"key", NAME_CHAR_LEN*MAX_KEY, MYSQL_TYPE_STRING, 0/*value*/,
- MY_I_S_MAYBE_NULL, "key", SKIP_OPEN_TABLE},
- {"key_len", NAME_CHAR_LEN*MAX_KEY, MYSQL_TYPE_STRING, 0/*value*/,
- MY_I_S_MAYBE_NULL, "key_len", SKIP_OPEN_TABLE},
- {"ref", NAME_CHAR_LEN*MAX_REF_PARTS, MYSQL_TYPE_STRING, 0/*value*/,
- MY_I_S_MAYBE_NULL, "ref", SKIP_OPEN_TABLE},
- {"rows", 10, MYSQL_TYPE_LONGLONG, 0/*value*/, MY_I_S_MAYBE_NULL, "rows",
- SKIP_OPEN_TABLE},
- {"Extra", 255, MYSQL_TYPE_STRING, 0/*value*/, 0 /*flags*/, "Extra",
- SKIP_OPEN_TABLE},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
-};
-
-
-#ifdef HAVE_SPATIAL
-ST_FIELD_INFO geometry_columns_fields_info[]=
-{
- {"F_TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
- {"F_TABLE_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
- {"F_TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
- {"F_GEOMETRY_COLUMN", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Field",
- OPEN_FRM_ONLY},
- {"G_TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
- {"G_TABLE_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
- {"G_TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
- {"G_GEOMETRY_COLUMN", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Field",
- OPEN_FRM_ONLY},
- {"STORAGE_TYPE", 2, MYSQL_TYPE_TINY, 0, 0, 0, OPEN_FRM_ONLY},
- {"GEOMETRY_TYPE", 7, MYSQL_TYPE_LONG, 0, 0, 0, OPEN_FRM_ONLY},
- {"COORD_DIMENSION", 2, MYSQL_TYPE_TINY, 0, 0, 0, OPEN_FRM_ONLY},
- {"MAX_PPR", 2, MYSQL_TYPE_TINY, 0, 0, 0, OPEN_FRM_ONLY},
- {"SRID", 5, MYSQL_TYPE_SHORT, 0, 0, 0, OPEN_FRM_ONLY},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, 0}
+ Column("id", SLonglong(3), NULLABLE, "id"),
+ Column("select_type", Varchar(19), NOT_NULL, "select_type"),
+ Column("table", Name(), NULLABLE, "table"),
+ Column("type", Varchar(15), NULLABLE, "type"),
+ Column("possible_keys",Varchar(NAME_CHAR_LEN*MAX_KEY), NULLABLE, "possible_keys"),
+ Column("key", Varchar(NAME_CHAR_LEN*MAX_KEY), NULLABLE, "key"),
+ Column("key_len", Varchar(NAME_CHAR_LEN*MAX_KEY), NULLABLE, "key_len"),
+ Column("ref", Varchar(NAME_CHAR_LEN*MAX_REF_PARTS),NULLABLE, "ref"),
+ Column("rows", SLonglong(10), NULLABLE, "rows"),
+ Column("Extra", Varchar(255), NOT_NULL, "Extra"),
+ CEnd()
};
-ST_FIELD_INFO spatial_ref_sys_fields_info[]=
+ST_FIELD_INFO check_constraints_fields_info[]=
{
- {"SRID", 5, MYSQL_TYPE_SHORT, 0, 0, 0, SKIP_OPEN_TABLE},
- {"AUTH_NAME", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"AUTH_SRID", 5, MYSQL_TYPE_LONG, 0, 0, 0, SKIP_OPEN_TABLE},
- {"SRTEXT", 2048, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, 0}
+ Column("CONSTRAINT_CATALOG", Catalog(), NOT_NULL, OPEN_FULL_TABLE),
+ Column("CONSTRAINT_SCHEMA", Name(), NOT_NULL, OPEN_FULL_TABLE),
+ Column("CONSTRAINT_NAME", Name(), NOT_NULL, OPEN_FULL_TABLE),
+ Column("TABLE_NAME", Name(), NOT_NULL, OPEN_FULL_TABLE),
+ Column("CHECK_CLAUSE", Name(), NOT_NULL, OPEN_FULL_TABLE),
+ CEnd()
};
-#endif /*HAVE_SPATIAL*/
+}; // namespace Show
-ST_FIELD_INFO check_constraints_fields_info[]=
-{
- {"CONSTRAINT_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
- {"CONSTRAINT_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0,
- OPEN_FULL_TABLE},
- {"CONSTRAINT_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0,
- OPEN_FULL_TABLE},
- {"TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
- {"CHECK_CLAUSE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0,
- OPEN_FULL_TABLE},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
-};
+
+namespace Show {
/** For creating fields of information_schema.OPTIMIZER_TRACE */
extern ST_FIELD_INFO optimizer_trace_info[];
+} //namespace Show
+
/*
Description of ST_FIELD_INFO in table.h
@@ -9862,108 +9457,101 @@ extern ST_FIELD_INFO optimizer_trace_info[];
ST_SCHEMA_TABLE schema_tables[]=
{
- {"ALL_PLUGINS", plugin_fields_info, 0,
+ {"ALL_PLUGINS", Show::plugin_fields_info, 0,
fill_all_plugins, make_old_format, 0, 5, -1, 0, 0},
- {"APPLICABLE_ROLES", applicable_roles_fields_info, 0,
+ {"APPLICABLE_ROLES", Show::applicable_roles_fields_info, 0,
fill_schema_applicable_roles, 0, 0, -1, -1, 0, 0},
- {"CHARACTER_SETS", charsets_fields_info, 0,
+ {"CHARACTER_SETS", Show::charsets_fields_info, 0,
fill_schema_charsets, make_character_sets_old_format, 0, -1, -1, 0, 0},
- {"CHECK_CONSTRAINTS", check_constraints_fields_info, 0,
+ {"CHECK_CONSTRAINTS", Show::check_constraints_fields_info, 0,
get_all_tables, 0, get_check_constraints_record, 1, 2, 0, OPTIMIZE_I_S_TABLE|OPEN_TABLE_ONLY},
- {"COLLATIONS", collation_fields_info, 0,
+ {"COLLATIONS", Show::collation_fields_info, 0,
fill_schema_collation, make_old_format, 0, -1, -1, 0, 0},
- {"COLLATION_CHARACTER_SET_APPLICABILITY", coll_charset_app_fields_info,
+ {"COLLATION_CHARACTER_SET_APPLICABILITY", Show::coll_charset_app_fields_info,
0, fill_schema_coll_charset_app, 0, 0, -1, -1, 0, 0},
- {"COLUMNS", columns_fields_info, 0,
+ {"COLUMNS", Show::columns_fields_info, 0,
get_all_tables, make_columns_old_format, get_schema_column_record, 1, 2, 0,
OPTIMIZE_I_S_TABLE|OPEN_VIEW_FULL},
- {"COLUMN_PRIVILEGES", column_privileges_fields_info, 0,
+ {"COLUMN_PRIVILEGES", Show::column_privileges_fields_info, 0,
fill_schema_column_privileges, 0, 0, -1, -1, 0, 0},
- {"ENABLED_ROLES", enabled_roles_fields_info, 0,
+ {"ENABLED_ROLES", Show::enabled_roles_fields_info, 0,
fill_schema_enabled_roles, 0, 0, -1, -1, 0, 0},
- {"ENGINES", engines_fields_info, 0,
+ {"ENGINES", Show::engines_fields_info, 0,
fill_schema_engines, make_old_format, 0, -1, -1, 0, 0},
#ifdef HAVE_EVENT_SCHEDULER
- {"EVENTS", events_fields_info, 0,
+ {"EVENTS", Show::events_fields_info, 0,
Events::fill_schema_events, make_old_format, 0, -1, -1, 0, 0},
#else
- {"EVENTS", events_fields_info, 0,
+ {"EVENTS", Show::events_fields_info, 0,
0, make_old_format, 0, -1, -1, 0, 0},
#endif
- {"EXPLAIN", show_explain_fields_info, 0, fill_show_explain,
+ {"EXPLAIN", Show::show_explain_fields_info, 0, fill_show_explain,
make_old_format, 0, -1, -1, TRUE /*hidden*/ , 0},
- {"FILES", files_fields_info, 0,
+ {"FILES", Show::files_fields_info, 0,
hton_fill_schema_table, 0, 0, -1, -1, 0, 0},
- {"GLOBAL_STATUS", variables_fields_info, 0,
+ {"GLOBAL_STATUS", Show::variables_fields_info, 0,
fill_status, make_old_format, 0, 0, -1, 0, 0},
- {"GLOBAL_VARIABLES", variables_fields_info, 0,
+ {"GLOBAL_VARIABLES", Show::variables_fields_info, 0,
fill_variables, make_old_format, 0, 0, -1, 0, 0},
- {"KEY_CACHES", keycache_fields_info, 0,
+ {"KEY_CACHES", Show::keycache_fields_info, 0,
fill_key_cache_tables, 0, 0, -1,-1, 0, 0},
- {"KEY_COLUMN_USAGE", key_column_usage_fields_info, 0,
+ {"KEY_COLUMN_USAGE", Show::key_column_usage_fields_info, 0,
get_all_tables, 0, get_schema_key_column_usage_record, 4, 5, 0,
OPTIMIZE_I_S_TABLE|OPEN_TABLE_ONLY},
- {"OPEN_TABLES", open_tables_fields_info, 0,
+ {"OPEN_TABLES", Show::open_tables_fields_info, 0,
fill_open_tables, make_old_format, 0, -1, -1, 1, 0},
- {"OPTIMIZER_TRACE", optimizer_trace_info, 0,
+ {"OPTIMIZER_TRACE", Show::optimizer_trace_info, 0,
fill_optimizer_trace_info, NULL, NULL, -1, -1, false, 0},
- {"PARAMETERS", parameters_fields_info, 0,
+ {"PARAMETERS", Show::parameters_fields_info, 0,
fill_schema_proc, 0, 0, -1, -1, 0, 0},
- {"PARTITIONS", partitions_fields_info, 0,
+ {"PARTITIONS", Show::partitions_fields_info, 0,
get_all_tables, 0, get_schema_partitions_record, 1, 2, 0,
OPTIMIZE_I_S_TABLE|OPEN_TABLE_ONLY},
- {"PLUGINS", plugin_fields_info, 0,
+ {"PLUGINS", Show::plugin_fields_info, 0,
fill_plugins, make_old_format, 0, -1, -1, 0, 0},
- {"PROCESSLIST", processlist_fields_info, 0,
+ {"PROCESSLIST", Show::processlist_fields_info, 0,
fill_schema_processlist, make_old_format, 0, -1, -1, 0, 0},
- {"PROFILING", query_profile_statistics_info, 0,
+ {"PROFILING", Show::query_profile_statistics_info, 0,
fill_query_profile_statistics_info, make_profile_table_for_show,
NULL, -1, -1, false, 0},
- {"REFERENTIAL_CONSTRAINTS", referential_constraints_fields_info,
+ {"REFERENTIAL_CONSTRAINTS", Show::referential_constraints_fields_info,
0, get_all_tables, 0, get_referential_constraints_record,
1, 9, 0, OPTIMIZE_I_S_TABLE|OPEN_TABLE_ONLY},
- {"ROUTINES", proc_fields_info, 0,
+ {"ROUTINES", Show::proc_fields_info, 0,
fill_schema_proc, make_proc_old_format, 0, -1, -1, 0, 0},
- {"SCHEMATA", schema_fields_info, 0,
+ {"SCHEMATA", Show::schema_fields_info, 0,
fill_schema_schemata, make_schemata_old_format, 0, 1, -1, 0, 0},
- {"SCHEMA_PRIVILEGES", schema_privileges_fields_info, 0,
+ {"SCHEMA_PRIVILEGES", Show::schema_privileges_fields_info, 0,
fill_schema_schema_privileges, 0, 0, -1, -1, 0, 0},
- {"SESSION_STATUS", variables_fields_info, 0,
+ {"SESSION_STATUS", Show::variables_fields_info, 0,
fill_status, make_old_format, 0, 0, -1, 0, 0},
- {"SESSION_VARIABLES", variables_fields_info, 0,
+ {"SESSION_VARIABLES", Show::variables_fields_info, 0,
fill_variables, make_old_format, 0, 0, -1, 0, 0},
- {"STATISTICS", stat_fields_info, 0,
+ {"STATISTICS", Show::stat_fields_info, 0,
get_all_tables, make_old_format, get_schema_stat_record, 1, 2, 0,
OPEN_TABLE_ONLY|OPTIMIZE_I_S_TABLE},
- {"SYSTEM_VARIABLES", sysvars_fields_info, 0,
+ {"SYSTEM_VARIABLES", Show::sysvars_fields_info, 0,
fill_sysvars, make_old_format, 0, 0, -1, 0, 0},
- {"TABLES", tables_fields_info, 0,
+ {"TABLES", Show::tables_fields_info, 0,
get_all_tables, make_old_format, get_schema_tables_record, 1, 2, 0,
OPTIMIZE_I_S_TABLE},
- {"TABLESPACES", tablespaces_fields_info, 0,
+ {"TABLESPACES", Show::tablespaces_fields_info, 0,
hton_fill_schema_table, 0, 0, -1, -1, 0, 0},
- {"TABLE_CONSTRAINTS", table_constraints_fields_info, 0,
+ {"TABLE_CONSTRAINTS", Show::table_constraints_fields_info, 0,
get_all_tables, 0, get_schema_constraints_record, 3, 4, 0,
OPTIMIZE_I_S_TABLE|OPEN_TABLE_ONLY},
- {"TABLE_NAMES", table_names_fields_info, 0,
+ {"TABLE_NAMES", Show::table_names_fields_info, 0,
get_all_tables, make_table_names_old_format, 0, 1, 2, 1, OPTIMIZE_I_S_TABLE},
- {"TABLE_PRIVILEGES", table_privileges_fields_info, 0,
+ {"TABLE_PRIVILEGES", Show::table_privileges_fields_info, 0,
fill_schema_table_privileges, 0, 0, -1, -1, 0, 0},
- {"TRIGGERS", triggers_fields_info, 0,
+ {"TRIGGERS", Show::triggers_fields_info, 0,
get_all_tables, make_old_format, get_schema_triggers_record, 5, 6, 0,
OPEN_TRIGGER_ONLY|OPTIMIZE_I_S_TABLE},
- {"USER_PRIVILEGES", user_privileges_fields_info, 0,
+ {"USER_PRIVILEGES", Show::user_privileges_fields_info, 0,
fill_schema_user_privileges, 0, 0, -1, -1, 0, 0},
- {"VIEWS", view_fields_info, 0,
+ {"VIEWS", Show::view_fields_info, 0,
get_all_tables, 0, get_schema_views_record, 1, 2, 0,
OPEN_VIEW_ONLY|OPTIMIZE_I_S_TABLE},
-#ifdef HAVE_SPATIAL
- {"GEOMETRY_COLUMNS", geometry_columns_fields_info, 0,
- get_all_tables, make_columns_old_format, get_geometry_column_record,
- 1, 2, 0, OPTIMIZE_I_S_TABLE|OPEN_VIEW_FULL},
- {"SPATIAL_REF_SYS", spatial_ref_sys_fields_info, 0,
- fill_spatial_ref_sys, make_old_format, 0, -1, -1, 0, 0},
-#endif /*HAVE_SPATIAL*/
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
};
@@ -9996,8 +9584,8 @@ int initialize_schema_table(st_plugin_int *plugin)
}
if (!schema_table->old_format)
- for (ST_FIELD_INFO *f= schema_table->fields_info; f->field_name; f++)
- if (f->old_name && f->old_name[0])
+ for (ST_FIELD_INFO *f= schema_table->fields_info; !f->end_marker(); f++)
+ if (f->old_name().str && f->old_name().str[0])
{
schema_table->old_format= make_old_format;
break;
@@ -10121,7 +9709,7 @@ static bool show_create_trigger_impl(THD *thd, Trigger *trigger)
Item_datetime_literal *tmp= (new (mem_root)
Item_datetime_literal(thd, &zero_time, 2));
- tmp->set_name(thd, STRING_WITH_LEN("Created"), system_charset_info);
+ tmp->set_name(thd, Lex_cstring(STRING_WITH_LEN("Created")));
fields.push_back(tmp, mem_root);
if (p->send_result_set_metadata(&fields,
diff --git a/sql/sql_show.h b/sql/sql_show.h
index 39cbc35230a..a98ba451088 100644
--- a/sql/sql_show.h
+++ b/sql/sql_show.h
@@ -76,6 +76,9 @@ typedef struct system_status_var STATUS_VAR;
#define IS_FILES_EXTRA 37
typedef enum { WITHOUT_DB_NAME, WITH_DB_NAME } enum_with_db_name;
+
+int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond);
+
int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet,
Table_specification_st *create_info_arg,
enum_with_db_name with_db_name);
@@ -117,9 +120,7 @@ bool show_create_trigger(THD *thd, const sp_name *trg_name);
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(THD *thd, COND *cond, TABLE_LIST *table);
ST_SCHEMA_TABLE *find_schema_table(THD *thd, const LEX_CSTRING *table_name,
bool *in_plugin);
diff --git a/sql/sql_signal.cc b/sql/sql_signal.cc
index 320a954711a..1b1d2fe0f31 100644
--- a/sql/sql_signal.cc
+++ b/sql/sql_signal.cc
@@ -151,7 +151,7 @@ static int assign_condition_item(MEM_ROOT *mem_root, const char* name, THD *thd,
Item *set, String *ci)
{
char str_buff[(64+1)*4]; /* Room for a null terminated UTF8 String 64 */
- String str_value(str_buff, sizeof(str_buff), & my_charset_utf8_bin);
+ String str_value(str_buff, sizeof(str_buff), & my_charset_utf8mb3_bin);
String *str;
bool truncated;
@@ -164,7 +164,7 @@ static int assign_condition_item(MEM_ROOT *mem_root, const char* name, THD *thd,
}
str= set->val_str(& str_value);
- truncated= assign_fixed_string(mem_root, & my_charset_utf8_bin, 64, ci, str);
+ truncated= assign_fixed_string(mem_root, & my_charset_utf8mb3_bin, 64, ci, str);
if (truncated)
{
if (thd->is_strict_mode())
@@ -260,7 +260,7 @@ int Sql_cmd_common_signal::eval_signal_informations(THD *thd, Sql_condition *con
bool truncated;
String utf8_text;
str= set->val_str(& str_value);
- truncated= assign_fixed_string(thd->mem_root, & my_charset_utf8_bin,
+ truncated= assign_fixed_string(thd->mem_root, & my_charset_utf8mb3_bin,
MYSQL_ERRMSG_SIZE,
& utf8_text, str);
if (truncated)
diff --git a/sql/sql_string.h b/sql/sql_string.h
index 605480461f1..deff81f3333 100644
--- a/sql/sql_string.h
+++ b/sql/sql_string.h
@@ -139,6 +139,11 @@ public:
CHARSET_INFO *charset() const { return m_charset; }
uint mbminlen() const { return m_charset->mbminlen; }
uint mbmaxlen() const { return m_charset->mbmaxlen; }
+ bool is_good_for_ft() const
+ {
+ // Binary and UCS2/UTF16/UTF32 are not supported
+ return m_charset != &my_charset_bin && m_charset->mbminlen == 1;
+ }
size_t numchars(const char *str, const char *end) const
{
@@ -527,6 +532,10 @@ public:
q_append(s, size);
return false;
}
+ bool append(const LEX_CSTRING &s)
+ {
+ return append(s.str, s.length);
+ }
bool append(const Binary_string &s)
{
return append(s.ptr(), s.length());
@@ -904,6 +913,10 @@ public:
// Append with optional character set conversion from cs to charset()
bool append(const char *s, size_t arg_length, CHARSET_INFO *cs);
+ bool append(const LEX_CSTRING &s, CHARSET_INFO *cs)
+ {
+ return append(s.str, s.length, cs);
+ }
void strip_sp();
friend int sortcmp(const String *a,const String *b, CHARSET_INFO *cs);
@@ -1000,6 +1013,15 @@ public:
};
+template<size_t buff_sz>
+class BinaryStringBuffer : public Binary_string
+{
+ char buff[buff_sz];
+public:
+ BinaryStringBuffer() : Binary_string(buff, buff_sz) { length(0); }
+};
+
+
class String_space: public String
{
public:
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index bb6caef0ebb..f824abbcabc 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -28,7 +28,7 @@
#include "sql_base.h" // lock_table_names
#include "lock.h" // mysql_unlock_tables
#include "strfunc.h" // find_type2, find_set
-#include "sql_truncate.h" // regenerate_locked_table
+#include "sql_truncate.h" // regenerate_locked_table
#include "sql_partition.h" // mem_alloc_error,
// partition_info
// NOT_A_PARTITION_ID
@@ -2735,7 +2735,8 @@ bool log_drop_table(THD *thd, const LEX_CSTRING *db_name,
*/
bool quick_rm_table(THD *thd, handlerton *base, const LEX_CSTRING *db,
- const LEX_CSTRING *table_name, uint flags, const char *table_path)
+ const LEX_CSTRING *table_name, uint flags,
+ const char *table_path)
{
char path[FN_REFLEN + 1];
int error= 0;
@@ -2743,11 +2744,13 @@ bool quick_rm_table(THD *thd, handlerton *base, const LEX_CSTRING *db,
size_t path_length= table_path ?
(strxnmov(path, sizeof(path) - 1, table_path, reg_ext, NullS) - path) :
- build_table_filename(path, sizeof(path)-1, db->str, table_name->str, reg_ext, flags);
- if (mysql_file_delete(key_file_frm, path, MYF(0)))
- error= 1; /* purecov: inspected */
+ build_table_filename(path, sizeof(path)-1, db->str, table_name->str,
+ reg_ext, flags);
+ if (!(flags & NO_FRM_RENAME))
+ if (mysql_file_delete(key_file_frm, path, MYF(0)))
+ error= 1; /* purecov: inspected */
path[path_length - reg_ext_length]= '\0'; // Remove reg_ext
- if (flags & NO_HA_TABLE)
+ if ((flags & (NO_HA_TABLE | NO_PAR_TABLE)) == NO_HA_TABLE)
{
handler *file= get_new_handler((TABLE_SHARE*) 0, thd->mem_root, base);
if (!file)
@@ -2853,7 +2856,7 @@ static int sort_keys(KEY *a, KEY *b)
*/
bool check_duplicates_in_interval(const char *set_or_name,
- const char *name, TYPELIB *typelib,
+ const char *name, const TYPELIB *typelib,
CHARSET_INFO *cs, unsigned int *dup_val_count)
{
TYPELIB tmp= *typelib;
@@ -2917,12 +2920,11 @@ bool Column_definition::prepare_stage2_typelib(const char *type_name,
}
-uint Column_definition::pack_flag_numeric(uint dec) const
+uint Column_definition::pack_flag_numeric() const
{
return (FIELDFLAG_NUMBER |
(flags & UNSIGNED_FLAG ? 0 : FIELDFLAG_DECIMAL) |
- (flags & ZEROFILL_FLAG ? FIELDFLAG_ZEROFILL : 0) |
- (dec << FIELDFLAG_DEC_SHIFT));
+ (flags & ZEROFILL_FLAG ? FIELDFLAG_ZEROFILL : 0));
}
@@ -3350,7 +3352,7 @@ static Create_field * add_hash_field(THD * thd, List<Create_field> *create_list,
}
}
cf->field_name= field_name;
- cf->set_handler(&type_handler_longlong);
+ cf->set_handler(&type_handler_slonglong);
key_info->algorithm= HA_KEY_ALG_LONG_HASH;
create_list->push_back(cf,thd->mem_root);
return cf;
@@ -3368,6 +3370,63 @@ mysql_add_invisible_index(THD *thd, List<Key> *key_list,
key_list->push_back(key, thd->mem_root);
return key;
}
+
+
+bool Type_handler_string::Key_part_spec_init_ft(Key_part_spec *part,
+ const Column_definition &def)
+ const
+{
+ /*
+ Set length to 0. It's set to the real column width later for CHAR.
+ It has to be the correct col width for CHAR, as its data are not
+ prefixed with length (unlike blobs).
+ */
+ part->length= 0;
+ return !Charset(def.charset).is_good_for_ft();
+}
+
+
+bool Type_handler_varchar::Key_part_spec_init_ft(Key_part_spec *part,
+ const Column_definition &def)
+ const
+{
+ part->length= 0;
+ return !Charset(def.charset).is_good_for_ft();
+}
+
+
+bool
+Type_handler_blob_common::Key_part_spec_init_ft(Key_part_spec *part,
+ const Column_definition &def)
+ const
+{
+ /*
+ Set keyseg length to 1 for blobs.
+ It's ignored in ft code: the data length is taken from the length prefix.
+ */
+ part->length= 1;
+ return !Charset(def.charset).is_good_for_ft();
+}
+
+
+static bool
+key_add_part_check_null(const handler *file, KEY *key_info,
+ const Column_definition *sql_field,
+ const Key_part_spec *column)
+{
+ if (!(sql_field->flags & NOT_NULL_FLAG))
+ {
+ key_info->flags|= HA_NULL_PART_KEY;
+ if (!(file->ha_table_flags() & HA_NULL_IN_KEY))
+ {
+ my_error(ER_NULL_COLUMN_IN_INDEX, MYF(0), column->field_name.str);
+ return true;
+ }
+ }
+ return false;
+}
+
+
/*
Preparation for table creation
@@ -3418,12 +3477,12 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
DBUG_EXECUTE_IF("test_pseudo_invisible",{
mysql_add_invisible_field(thd, &alter_info->create_list,
- "invisible", &type_handler_long, INVISIBLE_SYSTEM,
+ "invisible", &type_handler_slong, INVISIBLE_SYSTEM,
new (thd->mem_root)Item_int(thd, 9));
});
DBUG_EXECUTE_IF("test_completely_invisible",{
mysql_add_invisible_field(thd, &alter_info->create_list,
- "invisible", &type_handler_long, INVISIBLE_FULL,
+ "invisible", &type_handler_slong, INVISIBLE_FULL,
new (thd->mem_root)Item_int(thd, 9));
});
DBUG_EXECUTE_IF("test_invisible_index",{
@@ -3910,136 +3969,92 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
}
cols2.rewind();
- if (key->type == Key::FULLTEXT)
- {
- if ((sql_field->real_field_type() != MYSQL_TYPE_STRING &&
- sql_field->real_field_type() != MYSQL_TYPE_VARCHAR &&
- !f_is_blob(sql_field->pack_flag)) ||
- sql_field->charset == &my_charset_bin ||
- sql_field->charset->mbminlen > 1 || // ucs2 doesn't work yet
- (ft_key_charset && sql_field->charset != ft_key_charset))
- {
- my_error(ER_BAD_FT_COLUMN, MYF(0), column->field_name.str);
- DBUG_RETURN(-1);
- }
- ft_key_charset=sql_field->charset;
- /*
- for fulltext keys keyseg length is 1 for blobs (it's ignored in ft
- code anyway, and 0 (set to column width later) for char's. it has
- to be correct col width for char's, as char data are not prefixed
- with length (unlike blobs, where ft code takes data length from a
- data prefix, ignoring column->length).
- */
- column->length= MY_TEST(f_is_blob(sql_field->pack_flag));
- }
- else
- {
- column->length*= sql_field->charset->mbmaxlen;
+ switch(key->type) {
- if (key->type == Key::SPATIAL)
+ case Key::FULLTEXT:
+ if (sql_field->type_handler()->Key_part_spec_init_ft(column,
+ *sql_field) ||
+ (ft_key_charset && sql_field->charset != ft_key_charset))
{
- if (column->length)
- {
- my_error(ER_WRONG_SUB_KEY, MYF(0));
- DBUG_RETURN(TRUE);
- }
- if (!f_is_geom(sql_field->pack_flag))
- {
- my_error(ER_WRONG_ARGUMENTS, MYF(0), "SPATIAL INDEX");
- DBUG_RETURN(TRUE);
- }
+ my_error(ER_BAD_FT_COLUMN, MYF(0), column->field_name.str);
+ DBUG_RETURN(-1);
}
+ ft_key_charset= sql_field->charset;
+ break;
- if (f_is_blob(sql_field->pack_flag) ||
- (f_is_geom(sql_field->pack_flag) && key->type != Key::SPATIAL))
+ case Key::SPATIAL:
+ if (sql_field->type_handler()->Key_part_spec_init_spatial(column,
+ *sql_field) ||
+ sql_field->check_vcol_for_key(thd))
+ DBUG_RETURN(TRUE);
+ if (!(sql_field->flags & NOT_NULL_FLAG))
{
- if (!(file->ha_table_flags() & HA_CAN_INDEX_BLOBS))
- {
- my_error(ER_BLOB_USED_AS_KEY, MYF(0), column->field_name.str,
- file->table_type());
- DBUG_RETURN(TRUE);
- }
- if (f_is_geom(sql_field->pack_flag) && sql_field->geom_type ==
- Field::GEOM_POINT)
- column->length= MAX_LEN_GEOM_POINT_FIELD;
- if (!column->length)
- {
- if (key->type == Key::UNIQUE)
- is_hash_field_needed= true;
- else if (key->type == Key::MULTIPLE)
- column->length= file->max_key_length() + 1;
- else
- {
- my_error(ER_BLOB_KEY_WITHOUT_LENGTH, MYF(0), column->field_name.str);
- DBUG_RETURN(TRUE);
- }
- }
+ my_message(ER_SPATIAL_CANT_HAVE_NULL,
+ ER_THD(thd, ER_SPATIAL_CANT_HAVE_NULL), MYF(0));
+ DBUG_RETURN(TRUE);
}
-#ifdef HAVE_SPATIAL
- if (key->type == Key::SPATIAL)
- {
- if (!column->length)
- {
- /*
- 4 is: (Xmin,Xmax,Ymin,Ymax), this is for 2D case
- Lately we'll extend this code to support more dimensions
- */
- column->length= 4*sizeof(double);
- }
- }
-#endif
+ break;
+
+ case Key::PRIMARY:
if (sql_field->vcol_info)
{
- if (key->type == Key::PRIMARY)
- {
- my_error(ER_PRIMARY_KEY_BASED_ON_GENERATED_COLUMN, MYF(0));
- DBUG_RETURN(TRUE);
- }
- if (sql_field->vcol_info->flags & VCOL_NOT_STRICTLY_DETERMINISTIC)
- {
- /* use check_expression() to report an error */
- check_expression(sql_field->vcol_info, &sql_field->field_name,
- VCOL_GENERATED_STORED);
- DBUG_ASSERT(thd->is_error());
- DBUG_RETURN(TRUE);
- }
+ my_error(ER_PRIMARY_KEY_BASED_ON_GENERATED_COLUMN, MYF(0));
+ DBUG_RETURN(TRUE);
}
- if (!(sql_field->flags & NOT_NULL_FLAG))
- {
- if (key->type == Key::PRIMARY)
- {
- /* Implicitly set primary key fields to NOT NULL for ISO conf. */
- sql_field->flags|= NOT_NULL_FLAG;
- sql_field->pack_flag&= ~FIELDFLAG_MAYBE_NULL;
- null_fields--;
- }
- else
- {
- key_info->flags|= HA_NULL_PART_KEY;
- if (!(file->ha_table_flags() & HA_NULL_IN_KEY))
- {
- my_error(ER_NULL_COLUMN_IN_INDEX, MYF(0), column->field_name.str);
- DBUG_RETURN(TRUE);
- }
- if (key->type == Key::SPATIAL)
- {
- my_message(ER_SPATIAL_CANT_HAVE_NULL,
- ER_THD(thd, ER_SPATIAL_CANT_HAVE_NULL), MYF(0));
- DBUG_RETURN(TRUE);
- }
- }
- }
- if (MTYP_TYPENR(sql_field->unireg_check) == Field::NEXT_NUMBER)
- {
- if (column_nr == 0 || (file->ha_table_flags() & HA_AUTO_PART_KEY))
- auto_increment--; // Field is used
- }
+ if (sql_field->type_handler()->Key_part_spec_init_primary(column,
+ *sql_field,
+ file))
+ DBUG_RETURN(TRUE);
+ if (!(sql_field->flags & NOT_NULL_FLAG))
+ {
+ /* Implicitly set primary key fields to NOT NULL for ISO conf. */
+ sql_field->flags|= NOT_NULL_FLAG;
+ sql_field->pack_flag&= ~FIELDFLAG_MAYBE_NULL;
+ null_fields--;
+ }
+ break;
+
+ case Key::MULTIPLE:
+ if (sql_field->type_handler()->Key_part_spec_init_multiple(column,
+ *sql_field,
+ file) ||
+ sql_field->check_vcol_for_key(thd) ||
+ key_add_part_check_null(file, key_info, sql_field, column))
+ DBUG_RETURN(TRUE);
+ break;
+
+ case Key::FOREIGN_KEY:
+ if (sql_field->type_handler()->Key_part_spec_init_foreign(column,
+ *sql_field,
+ file) ||
+ sql_field->check_vcol_for_key(thd) ||
+ key_add_part_check_null(file, key_info, sql_field, column))
+ DBUG_RETURN(TRUE);
+ break;
+
+ case Key::UNIQUE:
+ if (sql_field->type_handler()->Key_part_spec_init_unique(column,
+ *sql_field, file,
+ &is_hash_field_needed) ||
+ sql_field->check_vcol_for_key(thd) ||
+ key_add_part_check_null(file, key_info, sql_field, column))
+ DBUG_RETURN(TRUE);
+ break;
+ }
+
+ if (MTYP_TYPENR(sql_field->unireg_check) == Field::NEXT_NUMBER)
+ {
+ DBUG_ASSERT(key->type != Key::FULLTEXT);
+ DBUG_ASSERT(key->type != Key::SPATIAL);
+ if (column_nr == 0 || (file->ha_table_flags() & HA_AUTO_PART_KEY))
+ auto_increment--; // Field is used
}
key_part_info->fieldnr= field;
key_part_info->offset= (uint16) sql_field->offset;
key_part_info->key_type=sql_field->pack_flag;
- uint key_part_length= sql_field->key_length;
+ uint key_part_length= sql_field->type_handler()->
+ calc_key_length(*sql_field);
if (column->length)
{
@@ -4132,19 +4147,14 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
/* Use packed keys for long strings on the first column */
if (!((*db_options) & HA_OPTION_NO_PACK_KEYS) &&
!((create_info->table_options & HA_OPTION_NO_PACK_KEYS)) &&
- (key_part_length >= KEY_DEFAULT_PACK_LENGTH &&
- (sql_field->real_field_type() == MYSQL_TYPE_STRING ||
- sql_field->real_field_type() == MYSQL_TYPE_VARCHAR ||
- f_is_blob(sql_field->pack_flag))) && !is_hash_field_needed)
- {
- if ((column_nr == 0 && f_is_blob(sql_field->pack_flag)) ||
- sql_field->real_field_type() == MYSQL_TYPE_VARCHAR)
- key_info->flags|= HA_BINARY_PACK_KEY | HA_VAR_LENGTH_KEY;
- else
- key_info->flags|= HA_PACK_KEY;
+ (key_part_length >= KEY_DEFAULT_PACK_LENGTH) &&
+ !is_hash_field_needed)
+ {
+ key_info->flags|= sql_field->type_handler()->KEY_pack_flags(column_nr);
}
/* Check if the key segment is partial, set the key flag accordingly */
- if (key_part_length != sql_field->key_length &&
+ if (key_part_length != sql_field->type_handler()->
+ calc_key_length(*sql_field) &&
key_part_length != sql_field->type_handler()->max_octet_length())
key_info->flags|= HA_KEY_HAS_PART_KEY_SEG;
@@ -4485,7 +4495,7 @@ bool Column_definition::prepare_blob_field(THD *thd)
set_handler(Type_handler::blob_type_handler((uint) length));
pack_length= type_handler()->calc_pack_length(0);
}
- length= key_length= 0;
+ length= 0;
}
DBUG_RETURN(0);
}
@@ -5528,7 +5538,8 @@ mysql_rename_table(handlerton *base, const LEX_CSTRING *old_db,
{
if (rename_file_ext(from,to,reg_ext))
error= my_errno;
- (void) file->ha_create_partitioning_metadata(to, from, CHF_RENAME_FLAG);
+ if (!(flags & NO_PAR_TABLE))
+ (void) file->ha_create_partitioning_metadata(to, from, CHF_RENAME_FLAG);
}
else if (!file || likely(!(error=file->ha_rename_table(from_base, to_base))))
{
@@ -5552,7 +5563,6 @@ mysql_rename_table(handlerton *base, const LEX_CSTRING *old_db,
my_error(ER_BAD_DB_ERROR, MYF(0), new_db->str);
else if (error)
my_error(ER_ERROR_ON_RENAME, MYF(0), from, to, error);
-
else if (!(flags & FN_IS_TMP))
mysql_audit_rename_table(thd, old_db, old_name, new_db, new_name);
@@ -5830,8 +5840,8 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
goto err;
/*
- As the reference table is temporary and may not exist on slave, we must
- force the ENGINE to be present into CREATE TABLE.
+ As the reference table is temporary and may not exist on slave, we
+ must force the ENGINE to be present into CREATE TABLE.
*/
create_info->used_fields|= HA_CREATE_USED_ENGINE;
@@ -7560,11 +7570,10 @@ static bool mysql_inplace_alter_table(THD *thd,
{
Open_table_context ot_ctx(thd, MYSQL_OPEN_REOPEN | MYSQL_OPEN_IGNORE_KILLED);
handlerton *db_type= table->s->db_type();
- MDL_ticket *mdl_ticket= table->mdl_ticket;
Alter_info *alter_info= ha_alter_info->alter_info;
bool reopen_tables= false;
bool res;
-
+ handlerton *hton;
DBUG_ENTER("mysql_inplace_alter_table");
/* Downgrade DDL lock while we are waiting for exclusive lock below */
@@ -7771,6 +7780,28 @@ static bool mysql_inplace_alter_table(THD *thd,
}
}
+ /* Notify the engine that the table definition has changed */
+
+ hton= table->file->ht;
+ if (hton->notify_tabledef_changed)
+ {
+ char db_buff[FN_REFLEN], table_buff[FN_REFLEN];
+ LEX_CSTRING tmp_db, tmp_table;
+ tmp_db.str= db_buff;
+ tmp_table.str= table_buff;
+ tmp_db.length= tablename_to_filename(table_list->db.str,
+ db_buff, sizeof(db_buff));
+ tmp_table.length= tablename_to_filename(table_list->table_name.str,
+ table_buff, sizeof(table_buff));
+ if ((hton->notify_tabledef_changed)(hton, &tmp_db, &tmp_table,
+ table->s->frm_image,
+ &table->s->tabledef_version))
+ {
+ my_error(HA_ERR_INCOMPATIBLE_DEFINITION, MYF(0));
+ DBUG_RETURN(true);
+ }
+ }
+
close_all_tables_for_name(thd, table->s,
alter_ctx->is_table_renamed() ?
HA_EXTRA_PREPARE_FOR_RENAME :
@@ -7795,24 +7826,6 @@ static bool mysql_inplace_alter_table(THD *thd,
DBUG_RETURN(true);
}
- table_list->mdl_request.ticket= mdl_ticket;
- if (open_table(thd, table_list, &ot_ctx))
- DBUG_RETURN(true);
-
- /*
- Tell the handler that the changed frm is on disk and table
- has been re-opened
- */
- table_list->table->file->ha_notify_table_changed();
-
- /*
- We might be going to reopen table down on the road, so we have to
- restore state of the TABLE object which we used for obtaining of
- handler object to make it usable for later reopening.
- */
- close_thread_table(thd, &thd->open_tables);
- table_list->table= NULL;
-
// Rename altered table if requested.
if (alter_ctx->is_table_renamed())
{
@@ -8263,15 +8276,11 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
If the '0000-00-00' value isn't allowed then raise the error_if_not_empty
flag to allow ALTER TABLE only if the table to be altered is empty.
*/
- if ((def->real_field_type() == MYSQL_TYPE_DATE ||
- def->real_field_type() == MYSQL_TYPE_NEWDATE ||
- def->real_field_type() == MYSQL_TYPE_DATETIME ||
- def->real_field_type() == MYSQL_TYPE_DATETIME2) &&
- !alter_ctx->datetime_field &&
- !(~def->flags & (NO_DEFAULT_VALUE_FLAG | NOT_NULL_FLAG)) &&
- thd->variables.sql_mode & MODE_NO_ZERO_DATE)
- {
- alter_ctx->datetime_field= def;
+ if (!alter_ctx->implicit_default_value_error_field &&
+ !(~def->flags & (NO_DEFAULT_VALUE_FLAG | NOT_NULL_FLAG)) &&
+ def->type_handler()->validate_implicit_default_value(thd, *def))
+ {
+ alter_ctx->implicit_default_value_error_field= def;
alter_ctx->error_if_not_empty= TRUE;
}
if (!def->after.str)
@@ -9355,6 +9364,7 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db,
Alter_info *alter_info,
uint order_num, ORDER *order, bool ignore)
{
+ bool engine_changed;
DBUG_ENTER("mysql_alter_table");
/*
@@ -10159,7 +10169,7 @@ do_continue:;
if (table->s->tmp_table != NO_TMP_TABLE)
{
/* in case of alter temp table send the tracker in OK packet */
- SESSION_TRACKER_CHANGED(thd, SESSION_STATE_CHANGE_TRACKER, NULL);
+ thd->session_tracker.state_change.mark_as_changed(thd);
}
/*
@@ -10242,6 +10252,23 @@ do_continue:;
}
/*
+ Check if file names for the engine are unique. If we change engine
+ and file names are unique then we don't need to rename the original
+ table to a temporary name during the rename phase
+
+ File names are unique if engine changed and
+ - Either new or old engine does not store the table in files
+ - Neither old or new engine uses files from another engine
+ The above is mainly true for the sequence and the partition engine.
+ */
+ engine_changed= ((new_table->file->ht != table->file->ht) &&
+ (((!(new_table->file->ha_table_flags() & HA_FILE_BASED) ||
+ !(table->file->ha_table_flags() & HA_FILE_BASED))) ||
+ (!(table->file->ha_table_flags() & HA_REUSES_FILE_NAMES) &&
+ !(new_table->file->ha_table_flags() &
+ HA_REUSES_FILE_NAMES))));
+
+ /*
Close the intermediate table that will be the new table, but do
not delete it! Even though MERGE tables do not have their children
attached here it is safe to call THD::drop_temporary_table().
@@ -10284,23 +10311,39 @@ do_continue:;
/*
Rename the old table to temporary name to have a backup in case
anything goes wrong while renaming the new table.
+ We only have to do this if name of the table is not changed.
+ If we are changing to use another table handler, we don't
+ have to do the rename as the table names will not interfer.
*/
char backup_name_buff[FN_LEN];
LEX_CSTRING backup_name;
backup_name.str= backup_name_buff;
- backup_name.length= my_snprintf(backup_name_buff, sizeof(backup_name_buff),
- "%s2-%lx-%lx", tmp_file_prefix,
+ DBUG_PRINT("info", ("is_table_renamed: %d engine_changed: %d",
+ alter_ctx.is_table_renamed(), engine_changed));
+
+ if (!alter_ctx.is_table_renamed())
+ {
+ backup_name.length= my_snprintf(backup_name_buff, sizeof(backup_name_buff),
+ "%s2-%lx-%lx", tmp_file_prefix,
current_pid, (long) thd->thread_id);
- if (lower_case_table_names)
- my_casedn_str(files_charset_info, backup_name_buff);
- if (mysql_rename_table(old_db_type, &alter_ctx.db, &alter_ctx.table_name,
- &alter_ctx.db, &backup_name, FN_TO_IS_TMP))
+ if (lower_case_table_names)
+ my_casedn_str(files_charset_info, backup_name_buff);
+ if (mysql_rename_table(old_db_type, &alter_ctx.db, &alter_ctx.table_name,
+ &alter_ctx.db, &backup_name,
+ FN_TO_IS_TMP |
+ (engine_changed ? NO_HA_TABLE | NO_PAR_TABLE : 0)))
+ {
+ // Rename to temporary name failed, delete the new table, abort ALTER.
+ (void) quick_rm_table(thd, new_db_type, &alter_ctx.new_db,
+ &alter_ctx.tmp_name, FN_IS_TMP);
+ goto err_with_mdl;
+ }
+ }
+ else
{
- // Rename to temporary name failed, delete the new table, abort ALTER.
- (void) quick_rm_table(thd, new_db_type, &alter_ctx.new_db,
- &alter_ctx.tmp_name, FN_IS_TMP);
- goto err_with_mdl;
+ /* The original table is the backup */
+ backup_name= alter_ctx.table_name;
}
// Rename the new table to the correct name.
@@ -10312,10 +10355,15 @@ do_continue:;
(void) quick_rm_table(thd, new_db_type, &alter_ctx.new_db,
&alter_ctx.tmp_name, FN_IS_TMP);
- // Restore the backup of the original table to the old name.
- (void) mysql_rename_table(old_db_type, &alter_ctx.db, &backup_name,
- &alter_ctx.db, &alter_ctx.alias,
- FN_FROM_IS_TMP | NO_FK_CHECKS);
+ if (!alter_ctx.is_table_renamed())
+ {
+ // Restore the backup of the original table to the old name.
+ (void) mysql_rename_table(old_db_type, &alter_ctx.db, &backup_name,
+ &alter_ctx.db, &alter_ctx.alias,
+ FN_FROM_IS_TMP | NO_FK_CHECKS |
+ (engine_changed ? NO_HA_TABLE | NO_PAR_TABLE :
+ 0));
+ }
goto err_with_mdl;
}
@@ -10335,7 +10383,9 @@ do_continue:;
// Restore the backup of the original table to the old name.
(void) mysql_rename_table(old_db_type, &alter_ctx.db, &backup_name,
&alter_ctx.db, &alter_ctx.alias,
- FN_FROM_IS_TMP | NO_FK_CHECKS);
+ FN_FROM_IS_TMP | NO_FK_CHECKS |
+ (engine_changed ? NO_HA_TABLE | NO_PAR_TABLE :
+ 0));
goto err_with_mdl;
}
rename_table_in_stat_tables(thd, &alter_ctx.db, &alter_ctx.alias,
@@ -10343,7 +10393,19 @@ do_continue:;
}
// ALTER TABLE succeeded, delete the backup of the old table.
- if (quick_rm_table(thd, old_db_type, &alter_ctx.db, &backup_name, FN_IS_TMP))
+ error= quick_rm_table(thd, old_db_type, &alter_ctx.db, &backup_name,
+ FN_IS_TMP |
+ (engine_changed ? NO_HA_TABLE | NO_PAR_TABLE: 0));
+ if (engine_changed)
+ {
+ /* the .frm file was removed but not the original table */
+ error|= quick_rm_table(thd, old_db_type, &alter_ctx.db,
+ &alter_ctx.table_name,
+ NO_FRM_RENAME |
+ (engine_changed ? 0 : FN_IS_TMP));
+ }
+
+ if (error)
{
/*
The fact that deletion of the backup failed is not critical
@@ -10390,6 +10452,7 @@ end_temporary:
DBUG_RETURN(false);
err_new_table_cleanup:
+ DBUG_PRINT("error", ("err_new_table_cleanup"));
my_free(const_cast<uchar*>(frm.str));
/*
No default value was provided for a DATE/DATETIME field, the
@@ -10400,30 +10463,8 @@ err_new_table_cleanup:
if (unlikely(alter_ctx.error_if_not_empty &&
thd->get_stmt_da()->current_row_for_warning()))
{
- const char *f_val= "0000-00-00";
- const char *f_type= "date";
- switch (alter_ctx.datetime_field->real_field_type())
- {
- case MYSQL_TYPE_DATE:
- case MYSQL_TYPE_NEWDATE:
- break;
- case MYSQL_TYPE_DATETIME:
- case MYSQL_TYPE_DATETIME2:
- f_val= "0000-00-00 00:00:00";
- f_type= "datetime";
- break;
- default:
- /* Shouldn't get here. */
- DBUG_ASSERT(0);
- }
- bool save_abort_on_warning= thd->abort_on_warning;
- thd->abort_on_warning= true;
- thd->push_warning_truncated_value_for_field(Sql_condition::WARN_LEVEL_WARN,
- f_type, f_val,
- new_table->s,
- alter_ctx.datetime_field->
- field_name.str);
- thd->abort_on_warning= save_abort_on_warning;
+ Abort_on_warning_instant_set aws(thd, true);
+ alter_ctx.report_implicit_default_value_error(thd, new_table->s);
}
if (new_table)
@@ -10439,11 +10480,16 @@ err_new_table_cleanup:
DBUG_RETURN(true);
err_with_mdl_after_alter:
+ DBUG_PRINT("error", ("err_with_mdl_after_alter"));
/* the table was altered. binlog the operation */
DBUG_ASSERT(!(mysql_bin_log.is_open() &&
thd->is_current_stmt_binlog_format_row() &&
(create_info->tmp_table())));
- write_bin_log(thd, true, thd->query(), thd->query_length());
+ /*
+ We can't reset error as we will return 'true' below and the server
+ expects that error is set
+ */
+ write_bin_log(thd, FALSE, thd->query(), thd->query_length());
err_with_mdl:
/*
@@ -10626,14 +10672,12 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
to->file->ha_table_flags() & HA_TABLE_SCAN_ON_INDEX)
{
char warn_buff[MYSQL_ERRMSG_SIZE];
- bool save_abort_on_warning= thd->abort_on_warning;
- thd->abort_on_warning= false;
+ Abort_on_warning_instant_set aws(thd, false);
my_snprintf(warn_buff, sizeof(warn_buff),
"ORDER BY ignored as there is a user-defined clustered index"
" in the table '%-.192s'", from->s->table_name.str);
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
warn_buff);
- thd->abort_on_warning= save_abort_on_warning;
}
else
{
@@ -11427,7 +11471,7 @@ bool Sql_cmd_create_table_like::execute(THD *thd)
ON then send session state notification in OK packet */
if (create_info.options & HA_LEX_CREATE_TMP_TABLE)
{
- SESSION_TRACKER_CHANGED(thd, SESSION_STATE_CHANGE_TRACKER, NULL);
+ thd->session_tracker.state_change.mark_as_changed(thd);
}
my_ok(thd);
}
diff --git a/sql/sql_table.h b/sql/sql_table.h
index 35bff0873ea..ae05fe05c5d 100644
--- a/sql/sql_table.h
+++ b/sql/sql_table.h
@@ -118,8 +118,6 @@ enum enum_explain_filename_mode
EXPLAIN_PARTITIONS_AS_COMMENT
};
-/* Maximum length of GEOM_POINT Field */
-#define MAX_LEN_GEOM_POINT_FIELD 25
/* depends on errmsg.txt Database `db`, Table `t` ... */
#define EXPLAIN_FILENAME_MAX_EXTRA_LENGTH 63
@@ -140,6 +138,8 @@ static const uint NO_HA_TABLE= 1 << 4;
static const uint SKIP_SYMDIR_ACCESS= 1 << 5;
/** Don't check foreign key constraints while renaming table */
static const uint NO_FK_CHECKS= 1 << 6;
+/* Don't delete .par table in quick_rm_table() */
+static const uint NO_PAR_TABLE= 1 << 7;
uint filename_to_tablename(const char *from, char *to, size_t to_length,
bool stay_quiet = false);
diff --git a/sql/sql_tablespace.cc b/sql/sql_tablespace.cc
index d912fabe8c8..bfbaf185243 100644
--- a/sql/sql_tablespace.cc
+++ b/sql/sql_tablespace.cc
@@ -32,7 +32,7 @@ int mysql_alter_tablespace(THD *thd, st_alter_tablespace *ts_info)
If the user haven't defined an engine, this will fallback to using the
default storage engine.
*/
- if (hton == NULL || hton->state != SHOW_OPTION_YES)
+ if (hton == NULL)
{
hton= ha_default_handlerton(thd);
if (ts_info->storage_engine != 0)
diff --git a/sql/sql_tvc.cc b/sql/sql_tvc.cc
index e7379a77049..eea14d7dfc2 100644
--- a/sql/sql_tvc.cc
+++ b/sql/sql_tvc.cc
@@ -647,7 +647,7 @@ st_select_lex *wrap_tvc(THD *thd, st_select_lex *tvc_sl,
wrapper_sl->set_linkage(tvc_sl->get_linkage());
wrapper_sl->parsing_place= SELECT_LIST;
item= new (thd->mem_root) Item_field(thd, &wrapper_sl->context,
- NULL, NULL, &star_clex_str);
+ star_clex_str);
if (item == NULL || add_item_to_list(thd, item))
goto err;
(wrapper_sl->with_wild)++;
@@ -751,6 +751,7 @@ st_select_lex *wrap_tvc_with_tail(THD *thd, st_select_lex *tvc_sl)
{
wrapper_sl->master_unit()->union_distinct= wrapper_sl;
}
+ wrapper_sl->distinct= tvc_sl->distinct;
thd->lex->current_select= wrapper_sl;
return wrapper_sl;
}
@@ -861,7 +862,7 @@ Item *Item_func_in::in_predicate_to_in_subs_transformer(THD *thd,
sq_select= lex->current_select;
sq_select->parsing_place= SELECT_LIST;
item= new (thd->mem_root) Item_field(thd, &sq_select->context,
- NULL, NULL, &star_clex_str);
+ star_clex_str);
if (item == NULL || add_item_to_list(thd, item))
goto err;
(sq_select->with_wild)++;
diff --git a/sql/sql_type.cc b/sql/sql_type.cc
index 8b382773f7a..390a1df9ea7 100644
--- a/sql/sql_type.cc
+++ b/sql/sql_type.cc
@@ -16,24 +16,38 @@
#include "mariadb.h"
#include "sql_type.h"
+#include "sql_type_geom.h"
#include "sql_const.h"
#include "sql_class.h"
#include "sql_time.h"
#include "item.h"
#include "log.h"
#include "tztime.h"
+#include <mysql/plugin_data_type.h>
+
+
+const DTCollation &DTCollation_numeric::singleton()
+{
+ static const DTCollation_numeric tmp;
+ return tmp;
+}
+
Type_handler_row type_handler_row;
Type_handler_null type_handler_null;
Type_handler_bool type_handler_bool;
-Type_handler_tiny type_handler_tiny;
-Type_handler_short type_handler_short;
-Type_handler_long type_handler_long;
-Type_handler_int24 type_handler_int24;
-Type_handler_longlong type_handler_longlong;
-Type_handler_longlong type_handler_ulonglong; // Only used for CAST() for now
+Type_handler_tiny type_handler_stiny;
+Type_handler_short type_handler_sshort;
+Type_handler_long type_handler_slong;
+Type_handler_int24 type_handler_sint24;
+Type_handler_longlong type_handler_slonglong;
+Type_handler_utiny type_handler_utiny;
+Type_handler_ushort type_handler_ushort;
+Type_handler_ulong type_handler_ulong;
+Type_handler_uint24 type_handler_uint24;
+Type_handler_ulonglong type_handler_ulonglong;
Type_handler_vers_trx_id type_handler_vers_trx_id;
Type_handler_float type_handler_float;
Type_handler_double type_handler_double;
@@ -60,74 +74,171 @@ Type_handler_string type_handler_string;
Type_handler_var_string type_handler_var_string;
Type_handler_varchar type_handler_varchar;
Type_handler_hex_hybrid type_handler_hex_hybrid;
-static Type_handler_varchar_compressed type_handler_varchar_compressed;
+Type_handler_varchar_compressed type_handler_varchar_compressed;
Type_handler_tiny_blob type_handler_tiny_blob;
Type_handler_medium_blob type_handler_medium_blob;
Type_handler_long_blob type_handler_long_blob;
Type_handler_blob type_handler_blob;
-static Type_handler_blob_compressed type_handler_blob_compressed;
+Type_handler_blob_compressed type_handler_blob_compressed;
Type_handler_interval_DDhhmmssff type_handler_interval_DDhhmmssff;
+Vers_type_timestamp vers_type_timestamp;
+Vers_type_trx vers_type_trx;
+
+
+
+class Type_collection_std: public Type_collection
+{
+public:
+ const Type_handler *handler_by_name(const LEX_CSTRING &name) const override
+ {
+ return NULL;
+ }
+ const Type_handler *aggregate_for_result(const Type_handler *a,
+ const Type_handler *b)
+ const override
+ {
+ return Type_handler::aggregate_for_result_traditional(a, b);
+ }
+ const Type_handler *aggregate_for_comparison(const Type_handler *a,
+ const Type_handler *b)
+ const override;
+ const Type_handler *aggregate_for_min_max(const Type_handler *a,
+ const Type_handler *b)
+ const override;
+ const Type_handler *aggregate_for_num_op(const Type_handler *a,
+ const Type_handler *b)
+ const override;
+};
+
+
+static Type_collection_std type_collection_std;
+
+const Type_collection *Type_handler::type_collection() const
+{
+ return &type_collection_std;
+}
+
+
+bool Type_handler::is_traditional_scalar_type() const
+{
+ return type_collection() == &type_collection_std;
+}
+
+
+class Type_collection_row: public Type_collection
+{
+public:
+ bool init(Type_handler_data *data) override
+ {
+ return false;
+ }
+ const Type_handler *handler_by_name(const LEX_CSTRING &name) const override
+ {
+ return NULL;
+ }
+ const Type_handler *aggregate_for_result(const Type_handler *a,
+ const Type_handler *b)
+ const override
+ {
+ return NULL;
+ }
+ const Type_handler *aggregate_for_comparison(const Type_handler *a,
+ const Type_handler *b)
+ const override
+ {
+ DBUG_ASSERT(a == &type_handler_row);
+ DBUG_ASSERT(b == &type_handler_row);
+ return &type_handler_row;
+ }
+ const Type_handler *aggregate_for_min_max(const Type_handler *a,
+ const Type_handler *b)
+ const override
+ {
+ return NULL;
+ }
+ const Type_handler *aggregate_for_num_op(const Type_handler *a,
+ const Type_handler *b)
+ const override
+ {
+ return NULL;
+ }
+};
+
+
+static Type_collection_row type_collection_row;
+
+const Type_collection *Type_handler_row::type_collection() const
+{
+ return &type_collection_row;
+}
+
+
+bool Type_handler_data::init()
+{
#ifdef HAVE_SPATIAL
-Type_handler_geometry type_handler_geometry;
+ return type_collection_geometry.init(this);
#endif
+ return false;
+}
-bool Type_handler_data::init()
+const Type_handler *
+Type_handler::handler_by_name(THD *thd, const LEX_CSTRING &name)
{
+ plugin_ref plugin;
+ if ((plugin= my_plugin_lock_by_name(thd, &name, MariaDB_DATA_TYPE_PLUGIN)))
+ {
+ /*
+ Data type plugins do not maintain ref_count yet.
+ For now we have only mandatory built-in plugins
+ and dynamic plugins for test purposes.
+ It should be safe to unlock the plugin immediately.
+ */
+ const Type_handler *ph= reinterpret_cast<st_mariadb_data_type*>
+ (plugin_decl(plugin)->info)->type_handler;
+ plugin_unlock(thd, plugin);
+ return ph;
+ }
+
#ifdef HAVE_SPATIAL
+ const Type_handler *ha= type_collection_geometry.handler_by_name(name);
+ if (ha)
+ return ha;
+#endif
+ return NULL;
+}
+
#ifndef DBUG_OFF
- if (m_type_aggregator_non_commutative_test.add(&type_handler_geometry,
- &type_handler_geometry,
- &type_handler_geometry) ||
- m_type_aggregator_non_commutative_test.add(&type_handler_geometry,
- &type_handler_varchar,
- &type_handler_long_blob))
- return true;
+static const Type_handler *frm_data_type_info_emulate(const LEX_CSTRING &name)
+{
+ if (Name(STRING_WITH_LEN("xchar")).eq(name))
+ return &type_handler_string;
+ if (Name(STRING_WITH_LEN("xblob")).eq(name))
+ return &type_handler_blob;
+ return NULL;
+}
#endif
- return
- m_type_aggregator_for_result.add(&type_handler_geometry,
- &type_handler_null,
- &type_handler_geometry) ||
- m_type_aggregator_for_result.add(&type_handler_geometry,
- &type_handler_geometry,
- &type_handler_geometry) ||
- m_type_aggregator_for_result.add(&type_handler_geometry,
- &type_handler_hex_hybrid,
- &type_handler_long_blob) ||
- m_type_aggregator_for_result.add(&type_handler_geometry,
- &type_handler_tiny_blob,
- &type_handler_long_blob) ||
- m_type_aggregator_for_result.add(&type_handler_geometry,
- &type_handler_blob,
- &type_handler_long_blob) ||
- m_type_aggregator_for_result.add(&type_handler_geometry,
- &type_handler_medium_blob,
- &type_handler_long_blob) ||
- m_type_aggregator_for_result.add(&type_handler_geometry,
- &type_handler_long_blob,
- &type_handler_long_blob) ||
- m_type_aggregator_for_result.add(&type_handler_geometry,
- &type_handler_varchar,
- &type_handler_long_blob) ||
- m_type_aggregator_for_result.add(&type_handler_geometry,
- &type_handler_string,
- &type_handler_long_blob) ||
- m_type_aggregator_for_comparison.add(&type_handler_geometry,
- &type_handler_geometry,
- &type_handler_geometry) ||
- m_type_aggregator_for_comparison.add(&type_handler_geometry,
- &type_handler_null,
- &type_handler_geometry) ||
- m_type_aggregator_for_comparison.add(&type_handler_geometry,
- &type_handler_long_blob,
- &type_handler_long_blob);
-#endif
- return false;
+
+const Type_handler *
+Type_handler::handler_by_name_or_error(THD *thd, const LEX_CSTRING &name)
+{
+ const Type_handler *h= handler_by_name(thd, name);
+ DBUG_EXECUTE_IF("emulate_handler_by_name_or_error_failure", h= NULL;);
+ if (!h)
+ {
+ DBUG_EXECUTE_IF("frm_data_type_info_emulate",
+ if ((h= frm_data_type_info_emulate(name)))
+ return h;
+ );
+ my_error(ER_UNKNOWN_DATA_TYPE, MYF(0),
+ ErrConvString(name.str, name.length, system_charset_info).ptr());
+ }
+ return h;
}
@@ -1017,7 +1128,7 @@ Datetime_truncation_not_needed::Datetime_truncation_not_needed(THD *thd, Item *i
/********************************************************************/
-uint Type_std_attributes::count_max_decimals(Item **item, uint nitems)
+uint Type_numeric_attributes::find_max_decimals(Item **item, uint nitems)
{
uint res= 0;
for (uint i= 0; i < nitems; i++)
@@ -1026,55 +1137,61 @@ uint Type_std_attributes::count_max_decimals(Item **item, uint nitems)
}
-/**
- Set max_length/decimals of function if function is fixed point and
- result length/precision depends on argument ones.
-*/
-
-void Type_std_attributes::count_decimal_length(Item **item, uint nitems)
+uint Type_numeric_attributes::count_unsigned(Item **item, uint nitems)
{
- int max_int_part= 0;
- decimals= 0;
- unsigned_flag= 1;
- for (uint i=0 ; i < nitems ; i++)
+ uint res= 0;
+ for (uint i= 0 ; i < nitems ; i++)
{
- set_if_bigger(decimals, item[i]->decimals);
- set_if_bigger(max_int_part, item[i]->decimal_int_part());
- set_if_smaller(unsigned_flag, item[i]->unsigned_flag);
+ if (item[i]->unsigned_flag)
+ res++;
}
- int precision= MY_MIN(max_int_part + decimals, DECIMAL_MAX_PRECISION);
- fix_char_length(my_decimal_precision_to_length_no_truncation(precision,
- (uint8) decimals,
- unsigned_flag));
+ return res;
}
-/**
- Set max_length of if it is maximum length of its arguments.
-*/
-
-void Type_std_attributes::count_only_length(Item **item, uint nitems)
+uint32 Type_numeric_attributes::find_max_char_length(Item **item, uint nitems)
{
uint32 char_length= 0;
- unsigned_flag= 0;
for (uint i= 0; i < nitems ; i++)
- {
set_if_bigger(char_length, item[i]->max_char_length());
- set_if_bigger(unsigned_flag, item[i]->unsigned_flag);
- }
- fix_char_length(char_length);
+ return char_length;
}
-void Type_std_attributes::count_octet_length(Item **item, uint nitems)
+uint32 Type_numeric_attributes::find_max_octet_length(Item **item, uint nitems)
{
- max_length= 0;
- unsigned_flag= 0;
+ uint32 octet_length= 0;
for (uint i= 0; i < nitems ; i++)
- {
- set_if_bigger(max_length, item[i]->max_length);
- set_if_bigger(unsigned_flag, item[i]->unsigned_flag);
- }
+ set_if_bigger(octet_length, item[i]->max_length);
+ return octet_length;
+}
+
+
+int Type_numeric_attributes::find_max_decimal_int_part(Item **item, uint nitems)
+{
+ int max_int_part= 0;
+ for (uint i=0 ; i < nitems ; i++)
+ set_if_bigger(max_int_part, item[i]->decimal_int_part());
+ return max_int_part;
+}
+
+
+/**
+ Set max_length/decimals of function if function is fixed point and
+ result length/precision depends on argument ones.
+*/
+
+void
+Type_numeric_attributes::aggregate_numeric_attributes_decimal(Item **item,
+ uint nitems,
+ bool unsigned_arg)
+{
+ int max_int_part= find_max_decimal_int_part(item, nitems);
+ decimals= find_max_decimals(item, nitems);
+ int precision= MY_MIN(max_int_part + decimals, DECIMAL_MAX_PRECISION);
+ max_length= my_decimal_precision_to_length_no_truncation(precision,
+ (uint8) decimals,
+ unsigned_flag);
}
@@ -1083,7 +1200,9 @@ void Type_std_attributes::count_octet_length(Item **item, uint nitems)
result length/precision depends on argument ones.
*/
-void Type_std_attributes::count_real_length(Item **items, uint nitems)
+void
+Type_numeric_attributes::aggregate_numeric_attributes_real(Item **items,
+ uint nitems)
{
uint32 length= 0;
decimals= 0;
@@ -1122,16 +1241,17 @@ void Type_std_attributes::count_real_length(Item **items, uint nitems)
@retval False on success, true on error.
*/
-bool Type_std_attributes::count_string_length(const char *func_name,
- Item **items, uint nitems)
+bool Type_std_attributes::aggregate_attributes_string(const char *func_name,
+ Item **items, uint nitems)
{
if (agg_arg_charsets_for_string_result(collation, func_name,
items, nitems, 1))
return true;
if (collation.collation == &my_charset_bin)
- count_octet_length(items, nitems);
+ max_length= find_max_octet_length(items, nitems);
else
- count_only_length(items, nitems);
+ fix_char_length(find_max_char_length(items, nitems));
+ unsigned_flag= false;
decimals= max_length ? NOT_FIXED_DEC : 0;
return false;
}
@@ -1278,7 +1398,7 @@ Type_handler::get_handler_by_cmp_type(Item_result type)
{
switch (type) {
case REAL_RESULT: return &type_handler_double;
- case INT_RESULT: return &type_handler_longlong;
+ case INT_RESULT: return &type_handler_slonglong;
case DECIMAL_RESULT: return &type_handler_newdecimal;
case STRING_RESULT: return &type_handler_long_blob;
case TIME_RESULT: return &type_handler_datetime;
@@ -1289,6 +1409,37 @@ Type_handler::get_handler_by_cmp_type(Item_result type)
}
+/*
+ If we have a mixture of:
+ - a MariaDB standard (built-in permanent) data type, and
+ - a non-standard (optionally compiled or pluggable) data type,
+ then we ask the type collection of the non-standard type to aggregate
+ the mixture.
+ The standard type collection type_collection_std knows nothing
+ about non-standard types, while non-standard type collections
+ know everything about standard data types.
+*/
+const Type_collection *
+Type_handler::type_collection_for_aggregation(const Type_handler *h0,
+ const Type_handler *h1)
+{
+ const Type_collection *c0= h0->type_collection();
+ const Type_collection *c1= h1->type_collection();
+ if (c0 == c1)
+ return c0;
+ if (c0 == &type_collection_std)
+ return c1;
+ if (c1 == &type_collection_std)
+ return c0;
+ /*
+ A mixture of two non-standard collections.
+ The caller code will continue to aggregate through
+ the type aggregators in Type_handler_data.
+ */
+ return NULL;
+}
+
+
Type_handler_hybrid_field_type::Type_handler_hybrid_field_type()
:m_type_handler(&type_handler_double)
{
@@ -1310,69 +1461,356 @@ uint Type_handler_time::m_hires_bytes[MAX_DATETIME_PRECISION + 1]=
{ 3, 4, 4, 5, 5, 5, 6 };
/***************************************************************************/
-const Name Type_handler_row::m_name_row(STRING_WITH_LEN("row"));
-
-const Name Type_handler_null::m_name_null(STRING_WITH_LEN("null"));
-
-const Name
- Type_handler_string::m_name_char(STRING_WITH_LEN("char")),
- Type_handler_var_string::m_name_var_string(STRING_WITH_LEN("varchar")),
- Type_handler_varchar::m_name_varchar(STRING_WITH_LEN("varchar")),
- Type_handler_hex_hybrid::m_name_hex_hybrid(STRING_WITH_LEN("hex_hybrid")),
- Type_handler_tiny_blob::m_name_tinyblob(STRING_WITH_LEN("tinyblob")),
- Type_handler_medium_blob::m_name_mediumblob(STRING_WITH_LEN("mediumblob")),
- Type_handler_long_blob::m_name_longblob(STRING_WITH_LEN("longblob")),
- Type_handler_blob::m_name_blob(STRING_WITH_LEN("blob"));
-
-const Name
- Type_handler_enum::m_name_enum(STRING_WITH_LEN("enum")),
- Type_handler_set::m_name_set(STRING_WITH_LEN("set"));
-
-const Name
- Type_handler_bool::m_name_bool(STRING_WITH_LEN("boolean")),
- Type_handler_tiny::m_name_tiny(STRING_WITH_LEN("tinyint")),
- Type_handler_short::m_name_short(STRING_WITH_LEN("smallint")),
- Type_handler_long::m_name_int(STRING_WITH_LEN("int")),
- Type_handler_longlong::m_name_longlong(STRING_WITH_LEN("bigint")),
- Type_handler_int24::m_name_mediumint(STRING_WITH_LEN("mediumint")),
- Type_handler_year::m_name_year(STRING_WITH_LEN("year")),
- Type_handler_bit::m_name_bit(STRING_WITH_LEN("bit"));
-
-const Name
- Type_handler_float::m_name_float(STRING_WITH_LEN("float")),
- Type_handler_double::m_name_double(STRING_WITH_LEN("double"));
-
-const Name
- Type_handler_olddecimal::m_name_decimal(STRING_WITH_LEN("decimal")),
- Type_handler_newdecimal::m_name_decimal(STRING_WITH_LEN("decimal"));
-
-const Name
- Type_handler_time_common::m_name_time(STRING_WITH_LEN("time")),
- Type_handler_date_common::m_name_date(STRING_WITH_LEN("date")),
- Type_handler_datetime_common::m_name_datetime(STRING_WITH_LEN("datetime")),
- Type_handler_timestamp_common::m_name_timestamp(STRING_WITH_LEN("timestamp"));
-
-const Name
- Type_handler::m_version_default(STRING_WITH_LEN("")),
- Type_handler::m_version_mariadb53(STRING_WITH_LEN("mariadb-5.3")),
- Type_handler::m_version_mysql56(STRING_WITH_LEN("mysql-5.6"));
-
-
-const Type_limits_int
- Type_handler_tiny::m_limits_sint8= Type_limits_sint8(),
- Type_handler_tiny::m_limits_uint8= Type_limits_uint8(),
- Type_handler_short::m_limits_sint16= Type_limits_sint16(),
- Type_handler_short::m_limits_uint16= Type_limits_uint16(),
- Type_handler_int24::m_limits_sint24= Type_limits_sint24(),
- Type_handler_int24::m_limits_uint24= Type_limits_uint24(),
- Type_handler_long::m_limits_sint32= Type_limits_sint32(),
- Type_handler_long::m_limits_uint32= Type_limits_uint32(),
- Type_handler_longlong::m_limits_sint64= Type_limits_sint64(),
- Type_handler_longlong::m_limits_uint64= Type_limits_uint64();
+const Name Type_handler_row::name() const
+{
+ static Name tmp(STRING_WITH_LEN("row"));
+ return tmp;
+}
+
+const Name Type_handler_null::name() const
+{
+ static Name tmp(STRING_WITH_LEN("null"));
+ return tmp;
+}
+
+const Name Type_handler_string::name() const
+{
+ static Name tmp(STRING_WITH_LEN("char"));
+ return tmp;
+}
+
+const Name Type_handler_var_string::name() const
+{
+ static Name tmp(STRING_WITH_LEN("varchar"));
+ return tmp;
+}
+
+const Name Type_handler_varchar::name() const
+{
+ static Name tmp(STRING_WITH_LEN("varchar"));
+ return tmp;
+}
+
+const Name Type_handler_hex_hybrid::name() const
+{
+ static Name tmp(STRING_WITH_LEN("hex_hybrid"));
+ return tmp;
+}
+
+const Name Type_handler_tiny_blob::name() const
+{
+ static Name tmp(STRING_WITH_LEN("tinyblob"));
+ return tmp;
+}
+
+const Name Type_handler_medium_blob::name() const
+{
+ static Name tmp(STRING_WITH_LEN("mediumblob"));
+ return tmp;
+}
+
+const Name Type_handler_long_blob::name() const
+{
+ static Name tmp(STRING_WITH_LEN("longblob"));
+ return tmp;
+}
+
+const Name Type_handler_blob::name() const
+{
+ static Name tmp(STRING_WITH_LEN("blob"));
+ return tmp;
+}
+
+const Name Type_handler_enum::name() const
+{
+ static Name tmp(STRING_WITH_LEN("enum"));
+ return tmp;
+}
+
+const Name Type_handler_set::name() const
+{
+ static Name tmp(STRING_WITH_LEN("set"));
+ return tmp;
+}
+
+const Name Type_handler_bool::name() const
+{
+ static Name tmp(STRING_WITH_LEN("boolean"));
+ return tmp;
+}
+
+const Name Type_handler_tiny::name() const
+{
+ static Name tmp(STRING_WITH_LEN("tinyint"));
+ return tmp;
+}
+
+const Name Type_handler_short::name() const
+{
+ static Name tmp(STRING_WITH_LEN("smallint"));
+ return tmp;
+}
+
+const Name Type_handler_long::name() const
+{
+ static Name tmp(STRING_WITH_LEN("int"));
+ return tmp;
+}
+
+const Name Type_handler_longlong::name() const
+{
+ static Name tmp(STRING_WITH_LEN("bigint"));
+ return tmp;
+}
+
+const Name Type_handler_int24::name() const
+{
+ static Name tmp(STRING_WITH_LEN("mediumint"));
+ return tmp;
+}
+
+const Name Type_handler_year::name() const
+{
+ static Name tmp(STRING_WITH_LEN("year"));
+ return tmp;
+}
+
+const Name Type_handler_bit::name() const
+{
+ static Name tmp(STRING_WITH_LEN("bit"));
+ return tmp;
+}
+
+const Name Type_handler_float::name() const
+{
+ static Name tmp(STRING_WITH_LEN("float"));
+ return tmp;
+}
+
+const Name Type_handler_double::name() const
+{
+ static Name tmp(STRING_WITH_LEN("double"));
+ return tmp;
+}
+
+const Name Type_handler_olddecimal::name() const
+{
+ static Name tmp(STRING_WITH_LEN("decimal"));
+ return tmp;
+}
+
+const Name Type_handler_newdecimal::name() const
+{
+ static Name tmp(STRING_WITH_LEN("decimal"));
+ return tmp;
+}
+
+const Name Type_handler_time_common::name() const
+{
+ static Name tmp(STRING_WITH_LEN("time"));
+ return tmp;
+}
+
+const Name Type_handler_date_common::name() const
+{
+ static Name tmp(STRING_WITH_LEN("date"));
+ return tmp;
+}
+
+const Name Type_handler_datetime_common::name() const
+{
+ static Name tmp(STRING_WITH_LEN("datetime"));
+ return tmp;
+}
+
+const Name Type_handler_timestamp_common::name() const
+{
+ static Name tmp(STRING_WITH_LEN("timestamp"));
+ return tmp;
+}
+
+const Name Type_handler_utiny::name() const
+{
+ static Name tmp(STRING_WITH_LEN("tiny unsigned"));
+ return tmp;
+}
+
+
+const Name Type_handler_ushort::name() const
+{
+ static Name tmp(STRING_WITH_LEN("smallint unsigned"));
+ return tmp;
+}
+
+
+const Name Type_handler_uint24::name() const
+{
+ static Name tmp(STRING_WITH_LEN("mediumint unsigned"));
+ return tmp;
+}
+
+
+const Name Type_handler_ulong::name() const
+{
+ static Name tmp(STRING_WITH_LEN("int unsigned"));
+ return tmp;
+}
+
+
+const Name Type_handler_ulonglong::name() const
+{
+ static Name tmp(STRING_WITH_LEN("bigint unsigned"));
+ return tmp;
+}
/***************************************************************************/
+const Name Type_handler::version() const
+{
+ static const Name ver(STRING_WITH_LEN(""));
+ return ver;
+}
+
+const Name Type_handler::version_mariadb53() const
+{
+ static const Name ver(STRING_WITH_LEN("mariadb-5.3"));
+ return ver;
+}
+
+const Name Type_handler::version_mysql56() const
+{
+ static const Name ver(STRING_WITH_LEN("mysql-5.6"));
+ return ver;
+}
+
+
+/***************************************************************************/
+
+const Type_limits_int *Type_handler_tiny::type_limits_int() const
+{
+ static const Type_limits_sint8 limits_sint8;
+ return &limits_sint8;
+}
+
+const Type_limits_int *Type_handler_utiny::type_limits_int() const
+{
+ static const Type_limits_uint8 limits_uint8;
+ return &limits_uint8;
+}
+
+const Type_limits_int *Type_handler_short::type_limits_int() const
+{
+ static const Type_limits_sint16 limits_sint16;
+ return &limits_sint16;
+}
+
+const Type_limits_int *Type_handler_ushort::type_limits_int() const
+{
+ static const Type_limits_uint16 limits_uint16;
+ return &limits_uint16;
+}
+
+const Type_limits_int *Type_handler_int24::type_limits_int() const
+{
+ static const Type_limits_sint24 limits_sint24;
+ return &limits_sint24;
+}
+
+const Type_limits_int *Type_handler_uint24::type_limits_int() const
+{
+ static const Type_limits_uint24 limits_uint24;
+ return &limits_uint24;
+}
+
+const Type_limits_int *Type_handler_long::type_limits_int() const
+{
+ static const Type_limits_sint32 limits_sint32;
+ return &limits_sint32;
+}
+
+const Type_limits_int *Type_handler_ulong::type_limits_int() const
+{
+ static const Type_limits_uint32 limits_uint32;
+ return &limits_uint32;
+}
+
+const Type_limits_int *Type_handler_longlong::type_limits_int() const
+{
+ static const Type_limits_sint64 limits_sint64;
+ return &limits_sint64;
+}
+
+const Type_limits_int *Type_handler_ulonglong::type_limits_int() const
+{
+ static const Type_limits_uint64 limits_uint64;
+ return &limits_uint64;
+}
+
+
+/***************************************************************************/
+const Type_handler *Type_handler_bool::type_handler_signed() const
+{
+ return &type_handler_bool;
+}
+
+const Type_handler *Type_handler_bool::type_handler_unsigned() const
+{
+ return &type_handler_bool;
+}
+
+const Type_handler *Type_handler_tiny::type_handler_signed() const
+{
+ return &type_handler_stiny;
+}
+
+const Type_handler *Type_handler_tiny::type_handler_unsigned() const
+{
+ return &type_handler_utiny;
+}
+
+const Type_handler *Type_handler_short::type_handler_signed() const
+{
+ return &type_handler_sshort;
+}
+
+const Type_handler *Type_handler_short::type_handler_unsigned() const
+{
+ return &type_handler_ushort;
+}
+
+const Type_handler *Type_handler_int24::type_handler_signed() const
+{
+ return &type_handler_sint24;
+}
+
+const Type_handler *Type_handler_int24::type_handler_unsigned() const
+{
+ return &type_handler_uint24;
+}
+
+const Type_handler *Type_handler_long::type_handler_signed() const
+{
+ return &type_handler_slong;
+}
+
+const Type_handler *Type_handler_long::type_handler_unsigned() const
+{
+ return &type_handler_ulong;
+}
+
+const Type_handler *Type_handler_longlong::type_handler_signed() const
+{
+ return &type_handler_slonglong;
+}
+
+const Type_handler *Type_handler_longlong::type_handler_unsigned() const
+{
+ return &type_handler_ulonglong;
+}
+
+/***************************************************************************/
+
const Type_handler *Type_handler_null::type_handler_for_comparison() const
{
return &type_handler_null;
@@ -1381,7 +1819,7 @@ const Type_handler *Type_handler_null::type_handler_for_comparison() const
const Type_handler *Type_handler_int_result::type_handler_for_comparison() const
{
- return &type_handler_longlong;
+ return &type_handler_slonglong;
}
@@ -1450,7 +1888,7 @@ const Type_handler *Type_handler_typelib::type_handler_for_item_field() const
const Type_handler *Type_handler_typelib::cast_to_int_type_handler() const
{
- return &type_handler_longlong;
+ return &type_handler_slonglong;
}
@@ -1459,29 +1897,35 @@ const Type_handler *Type_handler_typelib::cast_to_int_type_handler() const
bool
Type_handler_hybrid_field_type::aggregate_for_result(const Type_handler *other)
{
- if (m_type_handler->is_traditional_type() && other->is_traditional_type())
- {
- m_type_handler=
- Type_handler::aggregate_for_result_traditional(m_type_handler, other);
- return false;
- }
- other= type_handler_data->
- m_type_aggregator_for_result.find_handler(m_type_handler, other);
- if (!other)
+ const Type_handler *hres;
+ const Type_collection *c;
+ if (!(c= Type_handler::type_collection_for_aggregation(m_type_handler, other)) ||
+ !(hres= c->aggregate_for_result(m_type_handler, other)))
+ hres= type_handler_data->
+ m_type_aggregator_for_result.find_handler(m_type_handler, other);
+ if (!hres)
return true;
- m_type_handler= other;
+ m_type_handler= hres;
return false;
}
const Type_handler *
-Type_handler::type_handler_long_or_longlong(uint max_char_length)
+Type_handler::type_handler_long_or_longlong(uint max_char_length,
+ bool unsigned_flag)
{
+ if (unsigned_flag)
+ {
+ if (max_char_length <= MY_INT32_NUM_DECIMAL_DIGITS - 2)
+ return &type_handler_ulong;
+ return &type_handler_ulonglong;
+ }
if (max_char_length <= MY_INT32_NUM_DECIMAL_DIGITS - 2)
- return &type_handler_long;
- return &type_handler_longlong;
+ return &type_handler_slong;
+ return &type_handler_slonglong;
}
+
/*
This method is called for CASE (and its abbreviations) and LEAST/GREATEST
when data type aggregation returned LONGLONG and there were some BIT
@@ -1492,8 +1936,8 @@ const Type_handler *
Type_handler::bit_and_int_mixture_handler(uint max_char_length)
{
if (max_char_length <= MY_INT32_NUM_DECIMAL_DIGITS)
- return &type_handler_long;
- return &type_handler_longlong;
+ return &type_handler_slong;
+ return &type_handler_slonglong;
}
@@ -1555,9 +1999,9 @@ Type_handler_hybrid_field_type::aggregate_for_result(const char *funcname,
{
bit_and_non_bit_mixture_found= true;
if (type_handler() == &type_handler_bit)
- set_handler(&type_handler_longlong); // BIT + non-BIT
+ set_handler(&type_handler_slonglong); // BIT + non-BIT
else
- cur= &type_handler_longlong; // non-BIT + BIT
+ cur= &type_handler_slonglong; // non-BIT + BIT
}
if (aggregate_for_result(cur))
{
@@ -1566,7 +2010,7 @@ Type_handler_hybrid_field_type::aggregate_for_result(const char *funcname,
return true;
}
}
- if (bit_and_non_bit_mixture_found && type_handler() == &type_handler_longlong)
+ if (bit_and_non_bit_mixture_found && type_handler() == &type_handler_slonglong)
set_handler(Type_handler::bit_and_int_mixture_handler(max_display_length));
return false;
}
@@ -1585,37 +2029,42 @@ Type_handler_hybrid_field_type::aggregate_for_comparison(const Type_handler *h)
{
DBUG_ASSERT(m_type_handler == m_type_handler->type_handler_for_comparison());
DBUG_ASSERT(h == h->type_handler_for_comparison());
+ const Type_handler *hres;
+ const Type_collection *c;
+ if (!(c= Type_handler::type_collection_for_aggregation(m_type_handler, h)) ||
+ !(hres= c->aggregate_for_comparison(m_type_handler, h)))
+ hres= type_handler_data->
+ m_type_aggregator_for_comparison.find_handler(m_type_handler, h);
+ if (!hres)
+ return true;
+ m_type_handler= hres;
+ DBUG_ASSERT(m_type_handler == m_type_handler->type_handler_for_comparison());
+ return false;
+}
- if (!m_type_handler->is_traditional_type() ||
- !h->is_traditional_type())
- {
- h= type_handler_data->
- m_type_aggregator_for_comparison.find_handler(m_type_handler, h);
- if (!h)
- return true;
- m_type_handler= h;
- DBUG_ASSERT(m_type_handler == m_type_handler->type_handler_for_comparison());
- return false;
- }
- Item_result a= cmp_type();
- Item_result b= h->cmp_type();
+const Type_handler *
+Type_collection_std::aggregate_for_comparison(const Type_handler *ha,
+ const Type_handler *hb) const
+{
+ Item_result a= ha->cmp_type();
+ Item_result b= hb->cmp_type();
if (a == STRING_RESULT && b == STRING_RESULT)
- m_type_handler= &type_handler_long_blob;
- else if (a == INT_RESULT && b == INT_RESULT)
- m_type_handler= &type_handler_longlong;
- else if (a == ROW_RESULT || b == ROW_RESULT)
- m_type_handler= &type_handler_row;
- else if (a == TIME_RESULT || b == TIME_RESULT)
+ return &type_handler_long_blob;
+ if (a == INT_RESULT && b == INT_RESULT)
+ return &type_handler_slonglong;
+ if (a == ROW_RESULT || b == ROW_RESULT)
+ return &type_handler_row;
+ if (a == TIME_RESULT || b == TIME_RESULT)
{
if ((a == TIME_RESULT) + (b == TIME_RESULT) == 1)
{
/*
We're here if there's only one temporal data type:
either m_type_handler or h.
+ Temporal types bit non-temporal types.
*/
- if (b == TIME_RESULT)
- m_type_handler= h; // Temporal types bit non-temporal types
+ const Type_handler *res= b == TIME_RESULT ? hb : ha;
/*
Compare TIMESTAMP to a non-temporal type as DATETIME.
This is needed to make queries with fuzzy dates work:
@@ -1623,9 +2072,9 @@ Type_handler_hybrid_field_type::aggregate_for_comparison(const Type_handler *h)
WHERE
ts BETWEEN '0000-00-00' AND '2010-00-01 00:00:00';
*/
- if (m_type_handler->type_handler_for_native_format() ==
- &type_handler_timestamp2)
- m_type_handler= &type_handler_datetime;
+ if (res->type_handler_for_native_format() == &type_handler_timestamp2)
+ return &type_handler_datetime;
+ return res;
}
else
{
@@ -1637,19 +2086,15 @@ Type_handler_hybrid_field_type::aggregate_for_comparison(const Type_handler *h)
to print DATE constants using proper format:
'YYYY-MM-DD' rather than 'YYYY-MM-DD 00:00:00'.
*/
- if (m_type_handler->field_type() != h->field_type())
- m_type_handler= &type_handler_datetime;
+ if (ha->field_type() != hb->field_type())
+ return &type_handler_datetime;
+ return ha;
}
}
- else if ((a == INT_RESULT || a == DECIMAL_RESULT) &&
- (b == INT_RESULT || b == DECIMAL_RESULT))
- {
- m_type_handler= &type_handler_newdecimal;
- }
- else
- m_type_handler= &type_handler_double;
- DBUG_ASSERT(m_type_handler == m_type_handler->type_handler_for_comparison());
- return false;
+ if ((a == INT_RESULT || a == DECIMAL_RESULT) &&
+ (b == INT_RESULT || b == DECIMAL_RESULT))
+ return &type_handler_newdecimal;
+ return &type_handler_double;
}
@@ -1665,12 +2110,12 @@ Type_handler_hybrid_field_type::aggregate_for_comparison(const Type_handler *h)
bool
Type_handler_hybrid_field_type::aggregate_for_min_max(const Type_handler *h)
{
- if (!m_type_handler->is_traditional_type() ||
- !h->is_traditional_type())
+ const Type_handler *hres;
+ const Type_collection *c;
+ if (!(c= Type_handler::type_collection_for_aggregation(m_type_handler, h))||
+ !(hres= c->aggregate_for_min_max(m_type_handler, h)))
{
/*
- If at least one data type is non-traditional,
- do aggregation for result immediately.
For now we suppose that these two expressions:
- LEAST(type1, type2)
- COALESCE(type1, type2)
@@ -1678,79 +2123,74 @@ Type_handler_hybrid_field_type::aggregate_for_min_max(const Type_handler *h)
if type1 and/or type2 are non-traditional.
This may change in the future.
*/
- h= type_handler_data->
- m_type_aggregator_for_result.find_handler(m_type_handler, h);
- if (!h)
- return true;
- m_type_handler= h;
- return false;
+ hres= type_handler_data->
+ m_type_aggregator_for_result.find_handler(m_type_handler, h);
}
+ if (!hres)
+ return true;
+ m_type_handler= hres;
+ return false;
+}
+
- Item_result a= cmp_type();
- Item_result b= h->cmp_type();
+const Type_handler *
+Type_collection_std::aggregate_for_min_max(const Type_handler *ha,
+ const Type_handler *hb) const
+{
+ Item_result a= ha->cmp_type();
+ Item_result b= hb->cmp_type();
DBUG_ASSERT(a != ROW_RESULT); // Disallowed by check_cols() in fix_fields()
DBUG_ASSERT(b != ROW_RESULT); // Disallowed by check_cols() in fix_fields()
if (a == STRING_RESULT && b == STRING_RESULT)
- m_type_handler=
- Type_handler::aggregate_for_result_traditional(m_type_handler, h);
- else if (a == INT_RESULT && b == INT_RESULT)
+ return Type_collection_std::aggregate_for_result(ha, hb);
+ if (a == INT_RESULT && b == INT_RESULT)
{
// BIT aggregates with non-BIT as BIGINT
- if (m_type_handler != h)
+ if (ha != hb)
{
- if (m_type_handler == &type_handler_bit)
- m_type_handler= &type_handler_longlong;
- else if (h == &type_handler_bit)
- h= &type_handler_longlong;
+ if (ha == &type_handler_bit)
+ ha= &type_handler_slonglong;
+ else if (hb == &type_handler_bit)
+ hb= &type_handler_slonglong;
}
- m_type_handler=
- Type_handler::aggregate_for_result_traditional(m_type_handler, h);
+ return Type_collection_std::aggregate_for_result(ha, hb);
}
- else if (a == TIME_RESULT || b == TIME_RESULT)
+ if (a == TIME_RESULT || b == TIME_RESULT)
{
- if ((m_type_handler->type_handler_for_native_format() ==
- &type_handler_timestamp2) +
- (h->type_handler_for_native_format() ==
- &type_handler_timestamp2) == 1)
+ if ((ha->type_handler_for_native_format() == &type_handler_timestamp2) +
+ (hb->type_handler_for_native_format() == &type_handler_timestamp2) == 1)
{
/*
Handle LEAST(TIMESTAMP, non-TIMESTAMP) as DATETIME,
to make sure fuzzy dates work in this context:
LEAST('2001-00-00', timestamp_field)
*/
- m_type_handler= &type_handler_datetime2;
+ return &type_handler_datetime2;
}
- else if ((a == TIME_RESULT) + (b == TIME_RESULT) == 1)
+ if ((a == TIME_RESULT) + (b == TIME_RESULT) == 1)
{
/*
We're here if there's only one temporal data type:
either m_type_handler or h.
+ Temporal types bit non-temporal types.
*/
- if (b == TIME_RESULT)
- m_type_handler= h; // Temporal types bit non-temporal types
+ return (b == TIME_RESULT) ? hb : ha;
}
- else
- {
- /*
- We're here if both m_type_handler and h are temporal data types.
- */
- m_type_handler=
- Type_handler::aggregate_for_result_traditional(m_type_handler, h);
- }
- }
- else if ((a == INT_RESULT || a == DECIMAL_RESULT) &&
- (b == INT_RESULT || b == DECIMAL_RESULT))
- {
- m_type_handler= &type_handler_newdecimal;
+ /*
+ We're here if both m_type_handler and h are temporal data types.
+ */
+ return Type_collection_std::aggregate_for_result(ha, hb);
}
- else
+ if ((a == INT_RESULT || a == DECIMAL_RESULT) &&
+ (b == INT_RESULT || b == DECIMAL_RESULT))
{
- // Preserve FLOAT if two FLOATs, set to DOUBLE otherwise.
- if (m_type_handler != &type_handler_float || h != &type_handler_float)
- m_type_handler= &type_handler_double;
+ return &type_handler_newdecimal;
}
- return false;
+ // Preserve FLOAT if two FLOATs, set to DOUBLE otherwise.
+ if (ha == &type_handler_float && hb == &type_handler_float)
+ return &type_handler_float;
+ return &type_handler_double;
}
@@ -1759,15 +2199,12 @@ Type_handler_hybrid_field_type::aggregate_for_min_max(const char *funcname,
Item **items, uint nitems)
{
bool bit_and_non_bit_mixture_found= false;
- uint32 max_display_length;
// LEAST/GREATEST require at least two arguments
DBUG_ASSERT(nitems > 1);
set_handler(items[0]->type_handler());
- max_display_length= items[0]->max_display_length();
for (uint i= 1; i < nitems; i++)
{
const Type_handler *cur= items[i]->type_handler();
- set_if_bigger(max_display_length, items[i]->max_display_length());
// Check if BIT + non-BIT, or non-BIT + BIT
bit_and_non_bit_mixture_found|= (m_type_handler == &type_handler_bit) !=
(cur == &type_handler_bit);
@@ -1778,15 +2215,20 @@ Type_handler_hybrid_field_type::aggregate_for_min_max(const char *funcname,
return true;
}
}
- if (bit_and_non_bit_mixture_found && type_handler() == &type_handler_longlong)
+ if (bit_and_non_bit_mixture_found && type_handler() == &type_handler_slonglong)
+ {
+ uint32 max_display_length= items[0]->max_display_length();
+ for (uint i= 1; i < nitems; i++)
+ set_if_bigger(max_display_length, items[i]->max_display_length());
set_handler(Type_handler::bit_and_int_mixture_handler(max_display_length));
+ }
return false;
}
const Type_handler *
-Type_handler::aggregate_for_num_op_traditional(const Type_handler *h0,
- const Type_handler *h1)
+Type_collection_std::aggregate_for_num_op(const Type_handler *h0,
+ const Type_handler *h1) const
{
Item_result r0= h0->cmp_type();
Item_result r1= h1->cmp_type();
@@ -1802,7 +2244,7 @@ Type_handler::aggregate_for_num_op_traditional(const Type_handler *h0,
return &type_handler_newdecimal;
DBUG_ASSERT(r0 == INT_RESULT && r1 == INT_RESULT);
- return &type_handler_longlong;
+ return &type_handler_slonglong;
}
@@ -1827,17 +2269,14 @@ Type_handler_hybrid_field_type::aggregate_for_num_op(const Type_aggregator *agg,
const Type_handler *h1)
{
const Type_handler *hres;
- if (h0->is_traditional_type() && h1->is_traditional_type())
- {
- set_handler(Type_handler::aggregate_for_num_op_traditional(h0, h1));
- return false;
- }
- if ((hres= agg->find_handler(h0, h1)))
- {
- set_handler(hres);
- return false;
- }
- return true;
+ const Type_collection *c;
+ if (!(c= Type_handler::type_collection_for_aggregation(h0, h1)) ||
+ !(hres= c->aggregate_for_num_op(h0, h1)))
+ hres= agg->find_handler(h0, h1);
+ if (!hres)
+ return true;
+ m_type_handler= hres;
+ return false;
}
@@ -1849,11 +2288,11 @@ Type_handler::get_handler_by_field_type(enum_field_types type)
switch (type) {
case MYSQL_TYPE_DECIMAL: return &type_handler_olddecimal;
case MYSQL_TYPE_NEWDECIMAL: return &type_handler_newdecimal;
- case MYSQL_TYPE_TINY: return &type_handler_tiny;
- case MYSQL_TYPE_SHORT: return &type_handler_short;
- case MYSQL_TYPE_LONG: return &type_handler_long;
- case MYSQL_TYPE_LONGLONG: return &type_handler_longlong;
- case MYSQL_TYPE_INT24: return &type_handler_int24;
+ case MYSQL_TYPE_TINY: return &type_handler_stiny;
+ case MYSQL_TYPE_SHORT: return &type_handler_sshort;
+ case MYSQL_TYPE_LONG: return &type_handler_slong;
+ case MYSQL_TYPE_LONGLONG: return &type_handler_slonglong;
+ case MYSQL_TYPE_INT24: return &type_handler_sint24;
case MYSQL_TYPE_YEAR: return &type_handler_year;
case MYSQL_TYPE_BIT: return &type_handler_bit;
case MYSQL_TYPE_FLOAT: return &type_handler_float;
@@ -1904,11 +2343,11 @@ Type_handler::get_handler_by_real_type(enum_field_types type)
switch (type) {
case MYSQL_TYPE_DECIMAL: return &type_handler_olddecimal;
case MYSQL_TYPE_NEWDECIMAL: return &type_handler_newdecimal;
- case MYSQL_TYPE_TINY: return &type_handler_tiny;
- case MYSQL_TYPE_SHORT: return &type_handler_short;
- case MYSQL_TYPE_LONG: return &type_handler_long;
- case MYSQL_TYPE_LONGLONG: return &type_handler_longlong;
- case MYSQL_TYPE_INT24: return &type_handler_int24;
+ case MYSQL_TYPE_TINY: return &type_handler_stiny;
+ case MYSQL_TYPE_SHORT: return &type_handler_sshort;
+ case MYSQL_TYPE_LONG: return &type_handler_slong;
+ case MYSQL_TYPE_LONGLONG: return &type_handler_slonglong;
+ case MYSQL_TYPE_INT24: return &type_handler_sint24;
case MYSQL_TYPE_YEAR: return &type_handler_year;
case MYSQL_TYPE_BIT: return &type_handler_bit;
case MYSQL_TYPE_FLOAT: return &type_handler_float;
@@ -1921,13 +2360,7 @@ Type_handler::get_handler_by_real_type(enum_field_types type)
case MYSQL_TYPE_LONG_BLOB: return &type_handler_long_blob;
case MYSQL_TYPE_BLOB: return &type_handler_blob;
case MYSQL_TYPE_BLOB_COMPRESSED: return &type_handler_blob_compressed;
- case MYSQL_TYPE_VAR_STRING:
- /*
- VAR_STRING is actually a field_type(), not a real_type(),
- but it's used around the code in real_type() context.
- We should clean up the code and add DBUG_ASSERT(0) here.
- */
- return &type_handler_string;
+ case MYSQL_TYPE_VAR_STRING: return &type_handler_var_string;
case MYSQL_TYPE_STRING: return &type_handler_string;
case MYSQL_TYPE_ENUM: return &type_handler_enum;
case MYSQL_TYPE_SET: return &type_handler_set;
@@ -1946,8 +2379,7 @@ Type_handler::get_handler_by_real_type(enum_field_types type)
case MYSQL_TYPE_DATETIME2: return &type_handler_datetime2;
case MYSQL_TYPE_NEWDATE: return &type_handler_newdate;
};
- DBUG_ASSERT(0);
- return &type_handler_string;
+ return NULL;
}
@@ -2016,7 +2448,8 @@ Type_handler_int_result::make_num_distinct_aggregator_field(MEM_ROOT *mem_root,
/***********************************************************************/
-Field *Type_handler_tiny::make_conversion_table_field(TABLE *table,
+Field *Type_handler_tiny::make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table,
uint metadata,
const Field *target)
const
@@ -2027,84 +2460,91 @@ Field *Type_handler_tiny::make_conversion_table_field(TABLE *table,
using conversions so it should be true also when using conversions.
*/
bool unsigned_flag= ((Field_num*) target)->unsigned_flag;
- return new (table->in_use->mem_root)
+ return new (root)
Field_tiny(NULL, 4 /*max_length*/, (uchar *) "", 1, Field::NONE,
&empty_clex_str, 0/*zerofill*/, unsigned_flag);
}
-Field *Type_handler_short::make_conversion_table_field(TABLE *table,
+Field *Type_handler_short::make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table,
uint metadata,
const Field *target)
const
{
bool unsigned_flag= ((Field_num*) target)->unsigned_flag;
- return new (table->in_use->mem_root)
+ return new (root)
Field_short(NULL, 6 /*max_length*/, (uchar *) "", 1, Field::NONE,
&empty_clex_str, 0/*zerofill*/, unsigned_flag);
}
-Field *Type_handler_int24::make_conversion_table_field(TABLE *table,
+Field *Type_handler_int24::make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table,
uint metadata,
const Field *target)
const
{
bool unsigned_flag= ((Field_num*) target)->unsigned_flag;
- return new (table->in_use->mem_root)
+ return new (root)
Field_medium(NULL, 9 /*max_length*/, (uchar *) "", 1, Field::NONE,
&empty_clex_str, 0/*zerofill*/, unsigned_flag);
}
-Field *Type_handler_long::make_conversion_table_field(TABLE *table,
+Field *Type_handler_long::make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table,
uint metadata,
const Field *target)
const
{
bool unsigned_flag= ((Field_num*) target)->unsigned_flag;
- return new (table->in_use->mem_root)
+ return new (root)
Field_long(NULL, 11 /*max_length*/, (uchar *) "", 1, Field::NONE,
&empty_clex_str, 0/*zerofill*/, unsigned_flag);
}
-Field *Type_handler_longlong::make_conversion_table_field(TABLE *table,
+Field *Type_handler_longlong::make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table,
uint metadata,
const Field *target)
const
{
bool unsigned_flag= ((Field_num*) target)->unsigned_flag;
- return new (table->in_use->mem_root)
+ return new (root)
Field_longlong(NULL, 20 /*max_length*/,(uchar *) "", 1, Field::NONE,
&empty_clex_str, 0/*zerofill*/, unsigned_flag);
}
-Field *Type_handler_float::make_conversion_table_field(TABLE *table,
+Field *Type_handler_float::make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table,
uint metadata,
const Field *target)
const
{
- return new (table->in_use->mem_root)
+ return new (root)
Field_float(NULL, 12 /*max_length*/, (uchar *) "", 1, Field::NONE,
&empty_clex_str, 0/*dec*/, 0/*zerofill*/, 0/*unsigned_flag*/);
}
-Field *Type_handler_double::make_conversion_table_field(TABLE *table,
+Field *Type_handler_double::make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table,
uint metadata,
const Field *target)
const
{
- return new (table->in_use->mem_root)
+ return new (root)
Field_double(NULL, 22 /*max_length*/, (uchar *) "", 1, Field::NONE,
&empty_clex_str, 0/*dec*/, 0/*zerofill*/, 0/*unsigned_flag*/);
}
-Field *Type_handler_newdecimal::make_conversion_table_field(TABLE *table,
+Field *Type_handler_newdecimal::make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table,
uint metadata,
const Field *target)
const
@@ -2113,13 +2553,14 @@ Field *Type_handler_newdecimal::make_conversion_table_field(TABLE *table,
uint8 decimals= metadata & 0x00ff;
uint32 max_length= my_decimal_precision_to_length(precision, decimals, false);
DBUG_ASSERT(decimals <= DECIMAL_MAX_SCALE);
- return new (table->in_use->mem_root)
+ return new (root)
Field_new_decimal(NULL, max_length, (uchar *) "", 1, Field::NONE,
&empty_clex_str, decimals, 0/*zerofill*/, 0/*unsigned*/);
}
-Field *Type_handler_olddecimal::make_conversion_table_field(TABLE *table,
+Field *Type_handler_olddecimal::make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table,
uint metadata,
const Field *target)
const
@@ -2136,153 +2577,169 @@ Field *Type_handler_olddecimal::make_conversion_table_field(TABLE *table,
}
-Field *Type_handler_year::make_conversion_table_field(TABLE *table,
+Field *Type_handler_year::make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table,
uint metadata,
const Field *target)
const
{
- return new(table->in_use->mem_root)
+ return new(root)
Field_year(NULL, 4, (uchar *) "", 1, Field::NONE, &empty_clex_str);
}
-Field *Type_handler_null::make_conversion_table_field(TABLE *table,
+Field *Type_handler_null::make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table,
uint metadata,
const Field *target)
const
{
- return new(table->in_use->mem_root)
+ return new(root)
Field_null(NULL, 0, Field::NONE, &empty_clex_str, target->charset());
}
-Field *Type_handler_timestamp::make_conversion_table_field(TABLE *table,
+Field *Type_handler_timestamp::make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table,
uint metadata,
const Field *target)
const
{
- return new_Field_timestamp(table->in_use->mem_root, NULL, (uchar *) "", 1,
- Field::NONE, &empty_clex_str, table->s, target->decimals());
+ return new_Field_timestamp(root, NULL, (uchar *) "", 1,
+ Field::NONE, &empty_clex_str,
+ table->s, target->decimals());
}
-Field *Type_handler_timestamp2::make_conversion_table_field(TABLE *table,
+Field *Type_handler_timestamp2::make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table,
uint metadata,
const Field *target)
const
{
- return new(table->in_use->mem_root)
+ return new(root)
Field_timestampf(NULL, (uchar *) "", 1, Field::NONE,
&empty_clex_str, table->s, metadata);
}
-Field *Type_handler_newdate::make_conversion_table_field(TABLE *table,
+Field *Type_handler_newdate::make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table,
uint metadata,
const Field *target)
const
{
- return new(table->in_use->mem_root)
+ return new(root)
Field_newdate(NULL, (uchar *) "", 1, Field::NONE, &empty_clex_str);
}
-Field *Type_handler_date::make_conversion_table_field(TABLE *table,
+Field *Type_handler_date::make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table,
uint metadata,
const Field *target)
const
{
- return new(table->in_use->mem_root)
+ return new(root)
Field_date(NULL, (uchar *) "", 1, Field::NONE, &empty_clex_str);
}
-Field *Type_handler_time::make_conversion_table_field(TABLE *table,
+Field *Type_handler_time::make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table,
uint metadata,
const Field *target)
const
{
- return new_Field_time(table->in_use->mem_root, NULL, (uchar *) "", 1,
+ return new_Field_time(root, NULL, (uchar *) "", 1,
Field::NONE, &empty_clex_str, target->decimals());
}
-Field *Type_handler_time2::make_conversion_table_field(TABLE *table,
+Field *Type_handler_time2::make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table,
uint metadata,
const Field *target)
const
{
- return new(table->in_use->mem_root)
+ return new(root)
Field_timef(NULL, (uchar *) "", 1, Field::NONE, &empty_clex_str, metadata);
}
-Field *Type_handler_datetime::make_conversion_table_field(TABLE *table,
+Field *Type_handler_datetime::make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table,
uint metadata,
const Field *target)
const
{
- return new_Field_datetime(table->in_use->mem_root, NULL, (uchar *) "", 1,
+ return new_Field_datetime(root, NULL, (uchar *) "", 1,
Field::NONE, &empty_clex_str, target->decimals());
}
-Field *Type_handler_datetime2::make_conversion_table_field(TABLE *table,
+Field *Type_handler_datetime2::make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table,
uint metadata,
const Field *target)
const
{
- return new(table->in_use->mem_root)
+ return new(root)
Field_datetimef(NULL, (uchar *) "", 1,
Field::NONE, &empty_clex_str, metadata);
}
-Field *Type_handler_bit::make_conversion_table_field(TABLE *table,
+Field *Type_handler_bit::make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table,
uint metadata,
const Field *target)
const
{
DBUG_ASSERT((metadata & 0xff) <= 7);
uint32 max_length= 8 * (metadata >> 8U) + (metadata & 0x00ff);
- return new(table->in_use->mem_root)
+ return new(root)
Field_bit_as_char(NULL, max_length, (uchar *) "", 1,
Field::NONE, &empty_clex_str);
}
-Field *Type_handler_string::make_conversion_table_field(TABLE *table,
+Field *Type_handler_string::make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table,
uint metadata,
const Field *target)
const
{
/* This is taken from Field_string::unpack. */
uint32 max_length= (((metadata >> 4) & 0x300) ^ 0x300) + (metadata & 0x00ff);
- return new(table->in_use->mem_root)
+ return new(root)
Field_string(NULL, max_length, (uchar *) "", 1,
Field::NONE, &empty_clex_str, target->charset());
}
-Field *Type_handler_varchar::make_conversion_table_field(TABLE *table,
+Field *Type_handler_varchar::make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table,
uint metadata,
const Field *target)
const
{
DBUG_ASSERT(HA_VARCHAR_PACKLENGTH(metadata) <= MAX_FIELD_VARCHARLENGTH);
- return new(table->in_use->mem_root)
+ return new(root)
Field_varstring(NULL, metadata, HA_VARCHAR_PACKLENGTH(metadata),
(uchar *) "", 1, Field::NONE, &empty_clex_str,
table->s, target->charset());
}
-Field *Type_handler_varchar_compressed::make_conversion_table_field(TABLE *table,
+Field *Type_handler_varchar_compressed::make_conversion_table_field(
+ MEM_ROOT *root,
+ TABLE *table,
uint metadata,
const Field *target)
const
{
- return new(table->in_use->mem_root)
+ return new(root)
Field_varstring_compressed(NULL, metadata,
HA_VARCHAR_PACKLENGTH(metadata),
(uchar *) "", 1, Field::NONE,
@@ -2293,7 +2750,9 @@ Field *Type_handler_varchar_compressed::make_conversion_table_field(TABLE *table
-Field *Type_handler_blob_compressed::make_conversion_table_field(TABLE *table,
+Field *Type_handler_blob_compressed::make_conversion_table_field(
+ MEM_ROOT *root,
+ TABLE *table,
uint metadata,
const Field *target)
const
@@ -2301,7 +2760,7 @@ Field *Type_handler_blob_compressed::make_conversion_table_field(TABLE *table,
uint pack_length= metadata & 0x00ff;
if (pack_length < 1 || pack_length > 4)
return NULL; // Broken binary log?
- return new(table->in_use->mem_root)
+ return new(root)
Field_blob_compressed(NULL, (uchar *) "", 1, Field::NONE,
&empty_clex_str,
table->s, pack_length, target->charset(),
@@ -2309,43 +2768,15 @@ Field *Type_handler_blob_compressed::make_conversion_table_field(TABLE *table,
}
-#ifdef HAVE_SPATIAL
-const Name Type_handler_geometry::m_name_geometry(STRING_WITH_LEN("geometry"));
-
-
-const Type_handler *Type_handler_geometry::type_handler_for_comparison() const
-{
- return &type_handler_geometry;
-}
-
-
-Field *Type_handler_geometry::make_conversion_table_field(TABLE *table,
- uint metadata,
- const Field *target)
- const
-{
- DBUG_ASSERT(target->type() == MYSQL_TYPE_GEOMETRY);
- /*
- We do not do not update feature_gis statistics here:
- status_var_increment(target->table->in_use->status_var.feature_gis);
- as this is only a temporary field.
- The statistics was already incremented when "target" was created.
- */
- return new(table->in_use->mem_root)
- Field_geom(NULL, (uchar *) "", 1, Field::NONE, &empty_clex_str, table->s, 4,
- ((const Field_geom*) target)->geom_type,
- ((const Field_geom*) target)->srid);
-}
-#endif
-
-Field *Type_handler_enum::make_conversion_table_field(TABLE *table,
+Field *Type_handler_enum::make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table,
uint metadata,
const Field *target)
const
{
DBUG_ASSERT(target->type() == MYSQL_TYPE_STRING);
DBUG_ASSERT(target->real_type() == MYSQL_TYPE_ENUM);
- return new(table->in_use->mem_root)
+ return new(root)
Field_enum(NULL, target->field_length,
(uchar *) "", 1, Field::NONE, &empty_clex_str,
metadata & 0x00ff/*pack_length()*/,
@@ -2353,14 +2784,15 @@ Field *Type_handler_enum::make_conversion_table_field(TABLE *table,
}
-Field *Type_handler_set::make_conversion_table_field(TABLE *table,
+Field *Type_handler_set::make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table,
uint metadata,
const Field *target)
const
{
DBUG_ASSERT(target->type() == MYSQL_TYPE_STRING);
DBUG_ASSERT(target->real_type() == MYSQL_TYPE_SET);
- return new(table->in_use->mem_root)
+ return new(root)
Field_set(NULL, target->field_length,
(uchar *) "", 1, Field::NONE, &empty_clex_str,
metadata & 0x00ff/*pack_length()*/,
@@ -2368,6 +2800,28 @@ Field *Type_handler_set::make_conversion_table_field(TABLE *table,
}
+Field *Type_handler_enum::make_schema_field(MEM_ROOT *root, TABLE *table,
+ const Record_addr &addr,
+ const ST_FIELD_INFO &def,
+ bool show_field) const
+{
+ LEX_CSTRING name= def.name();
+ const Typelib *typelib= def.typelib();
+ DBUG_ASSERT(typelib);
+ /*
+ Assume I_S columns don't have non-ASCII characters in names.
+ If we eventually want to, Typelib::max_char_length() must be implemented.
+ */
+ return new (root)
+ Field_enum(addr.ptr(), (uint32) typelib->max_octet_length(),
+ addr.null_ptr(), addr.null_bit(),
+ Field::NONE, &name,
+ get_enum_pack_length(typelib->count),
+ typelib, system_charset_info);
+
+}
+
+
/*************************************************************************/
bool Type_handler::
@@ -2458,14 +2912,6 @@ bool Type_handler_blob_common::
return def->check_length(ER_TOO_BIG_DISPLAYWIDTH, MAX_FIELD_BLOBLENGTH);
}
-#ifdef HAVE_SPATIAL
-bool Type_handler_geometry::
- Column_definition_fix_attributes(Column_definition *def) const
-{
- def->flags|= BLOB_FLAG;
- return false;
-}
-#endif
bool Type_handler_year::
Column_definition_fix_attributes(Column_definition *def) const
@@ -2539,15 +2985,6 @@ bool Type_handler_bit::
/*************************************************************************/
-void Type_handler_blob_common::
- Column_definition_reuse_fix_attributes(THD *thd,
- Column_definition *def,
- const Field *field) const
-{
- DBUG_ASSERT(def->key_length == 0);
-}
-
-
void Type_handler_typelib::
Column_definition_reuse_fix_attributes(THD *thd,
Column_definition *def,
@@ -2558,18 +2995,6 @@ void Type_handler_typelib::
}
-#ifdef HAVE_SPATIAL
-void Type_handler_geometry::
- Column_definition_reuse_fix_attributes(THD *thd,
- Column_definition *def,
- const Field *field) const
-{
- def->geom_type= ((Field_geom*) field)->geom_type;
- def->srid= ((Field_geom*) field)->srid;
-}
-#endif
-
-
void Type_handler_year::
Column_definition_reuse_fix_attributes(THD *thd,
Column_definition *def,
@@ -2679,20 +3104,6 @@ bool Type_handler_string_result::
}
-#ifdef HAVE_SPATIAL
-bool Type_handler_geometry::
- Column_definition_prepare_stage1(THD *thd,
- MEM_ROOT *mem_root,
- Column_definition *def,
- handler *file,
- ulonglong table_flags) const
-{
- def->create_length_to_internal_length_string();
- return def->prepare_blob_field(thd);
-}
-#endif
-
-
/*************************************************************************/
bool Type_handler::
@@ -2795,8 +3206,7 @@ bool Type_handler::
Column_definition_prepare_stage2_legacy_num(Column_definition *def,
enum_field_types type) const
{
- def->pack_flag= def->pack_flag_numeric(def->decimals) |
- f_settype((uint) type);
+ def->pack_flag= def->pack_flag_numeric() | f_settype((uint) type);
return false;
}
@@ -2812,7 +3222,8 @@ bool Type_handler::
*/
if (dec >= FLOATING_POINT_DECIMALS)
dec= FLOATING_POINT_DECIMALS;
- def->pack_flag= def->pack_flag_numeric(dec) | f_settype((uint) type);
+ def->decimals= dec;
+ def->pack_flag= def->pack_flag_numeric() | f_settype((uint) type);
return false;
}
@@ -2821,7 +3232,7 @@ bool Type_handler_newdecimal::
handler *file,
ulonglong table_flags) const
{
- def->pack_flag= def->pack_flag_numeric(def->decimals);
+ def->pack_flag= def->pack_flag_numeric();
return false;
}
@@ -2833,21 +3244,6 @@ bool Type_handler_blob_common::
return def->prepare_stage2_blob(file, table_flags, FIELDFLAG_BLOB);
}
-#ifdef HAVE_SPATIAL
-bool Type_handler_geometry::
- Column_definition_prepare_stage2(Column_definition *def,
- handler *file,
- ulonglong table_flags) const
-{
- if (!(table_flags & HA_CAN_GEOMETRY))
- {
- my_error(ER_CHECK_NOT_IMPLEMENTED, MYF(0), "GEOMETRY");
- return true;
- }
- return def->prepare_stage2_blob(file, table_flags, FIELDFLAG_GEOM);
-}
-#endif
-
bool Type_handler_varchar::
Column_definition_prepare_stage2(Column_definition *def,
handler *file,
@@ -2903,6 +3299,93 @@ bool Type_handler_bit::
return false;
}
+
+/*************************************************************************/
+bool Type_handler::Key_part_spec_init_primary(Key_part_spec *part,
+ const Column_definition &def,
+ const handler *file) const
+{
+ part->length*= def.charset->mbmaxlen;
+ return false;
+}
+
+
+bool Type_handler::Key_part_spec_init_unique(Key_part_spec *part,
+ const Column_definition &def,
+ const handler *file,
+ bool *has_field_needed) const
+{
+ part->length*= def.charset->mbmaxlen;
+ return false;
+}
+
+
+bool Type_handler::Key_part_spec_init_multiple(Key_part_spec *part,
+ const Column_definition &def,
+ const handler *file) const
+{
+ part->length*= def.charset->mbmaxlen;
+ return false;
+}
+
+
+bool Type_handler::Key_part_spec_init_foreign(Key_part_spec *part,
+ const Column_definition &def,
+ const handler *file) const
+{
+ part->length*= def.charset->mbmaxlen;
+ return false;
+}
+
+
+bool Type_handler::Key_part_spec_init_spatial(Key_part_spec *part,
+ const Column_definition &def)
+ const
+{
+ my_error(ER_WRONG_ARGUMENTS, MYF(0), "SPATIAL INDEX");
+ return true;
+}
+
+
+bool Type_handler_blob_common::Key_part_spec_init_primary(Key_part_spec *part,
+ const Column_definition &def,
+ const handler *file) const
+{
+ part->length*= def.charset->mbmaxlen;
+ return part->check_primary_key_for_blob(file);
+}
+
+
+bool Type_handler_blob_common::Key_part_spec_init_unique(Key_part_spec *part,
+ const Column_definition &def,
+ const handler *file,
+ bool *hash_field_needed) const
+{
+ if (!(part->length*= def.charset->mbmaxlen))
+ *hash_field_needed= true;
+ return part->check_key_for_blob(file);
+}
+
+
+bool Type_handler_blob_common::Key_part_spec_init_multiple(Key_part_spec *part,
+ const Column_definition &def,
+ const handler *file) const
+{
+ part->length*= def.charset->mbmaxlen;
+ return part->init_multiple_key_for_blob(file);
+}
+
+
+bool Type_handler_blob_common::Key_part_spec_init_foreign(Key_part_spec *part,
+ const Column_definition &def,
+ const handler *file) const
+{
+ part->length*= def.charset->mbmaxlen;
+ return part->check_foreign_key_for_blob(file);
+}
+
+
+
/*************************************************************************/
uint32 Type_handler_time::calc_pack_length(uint32 length) const
@@ -2961,13 +3444,6 @@ uint32 Type_handler_long_blob::calc_pack_length(uint32 length) const
return 4 + portable_sizeof_char_ptr;
}
-#ifdef HAVE_SPATIAL
-uint32 Type_handler_geometry::calc_pack_length(uint32 length) const
-{
- return 4 + portable_sizeof_char_ptr;
-}
-#endif
-
uint32 Type_handler_newdecimal::calc_pack_length(uint32 length) const
{
abort(); // This shouldn't happen
@@ -2988,87 +3464,83 @@ uint32 Type_handler_enum::calc_pack_length(uint32 length) const
/*************************************************************************/
-Field *Type_handler::make_and_init_table_field(const LEX_CSTRING *name,
- const Record_addr &addr,
- const Type_all_attributes &attr,
- TABLE *table) const
+uint Type_handler::calc_key_length(const Column_definition &def) const
{
- Field *field= make_table_field(name, addr, attr, table);
- if (field)
- field->init(table);
- return field;
+ DBUG_ASSERT(def.pack_length == calc_pack_length((uint32) def.length));
+ return def.pack_length;
}
-
-Field *Type_handler_tiny::make_table_field(const LEX_CSTRING *name,
- const Record_addr &addr,
- const Type_all_attributes &attr,
- TABLE *table) const
+uint Type_handler_bit::calc_key_length(const Column_definition &def) const
{
- return new (table->in_use->mem_root)
- Field_tiny(addr.ptr(), attr.max_char_length(),
- addr.null_ptr(), addr.null_bit(),
- Field::NONE, name, 0/*zerofill*/, attr.unsigned_flag);
+ if (f_bit_as_char(def.pack_flag))
+ return def.pack_length;
+ /* We need one extra byte to store the bits we save among the null bits */
+ return def.pack_length + MY_TEST(def.length & 7);
}
-
-Field *Type_handler_short::make_table_field(const LEX_CSTRING *name,
- const Record_addr &addr,
- const Type_all_attributes &attr,
- TABLE *table) const
-
+uint Type_handler_newdecimal::calc_key_length(const Column_definition &def) const
{
- return new (table->in_use->mem_root)
- Field_short(addr.ptr(), attr.max_char_length(),
- addr.null_ptr(), addr.null_bit(),
- Field::NONE, name, 0/*zerofill*/, attr.unsigned_flag);
+ return def.pack_length;
}
-
-Field *Type_handler_int24::make_table_field(const LEX_CSTRING *name,
- const Record_addr &addr,
- const Type_all_attributes &attr,
- TABLE *table) const
+uint
+Type_handler_string_result::calc_key_length(const Column_definition &def) const
{
- return new (table->in_use->mem_root)
- Field_medium(addr.ptr(), attr.max_char_length(),
- addr.null_ptr(), addr.null_bit(),
- Field::NONE, name,
- 0/*zerofill*/, attr.unsigned_flag);
+ return (uint) def.length;
}
+uint Type_handler_enum::calc_key_length(const Column_definition &def) const
+{
+ DBUG_ASSERT(def.interval);
+ return get_enum_pack_length(def.interval->count);
+}
-Field *Type_handler_long::make_table_field(const LEX_CSTRING *name,
- const Record_addr &addr,
- const Type_all_attributes &attr,
- TABLE *table) const
+uint Type_handler_set::calc_key_length(const Column_definition &def) const
{
- return new (table->in_use->mem_root)
- Field_long(addr.ptr(), attr.max_char_length(),
- addr.null_ptr(), addr.null_bit(),
- Field::NONE, name, 0/*zerofill*/, attr.unsigned_flag);
+ DBUG_ASSERT(def.interval);
+ return get_set_pack_length(def.interval->count);
}
+uint Type_handler_blob_common::calc_key_length(const Column_definition &def) const
+{
+ return 0;
+}
-Field *Type_handler_longlong::make_table_field(const LEX_CSTRING *name,
+/*************************************************************************/
+Field *Type_handler::make_and_init_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
TABLE *table) const
{
- return new (table->in_use->mem_root)
- Field_longlong(addr.ptr(), attr.max_char_length(),
- addr.null_ptr(), addr.null_bit(),
- Field::NONE, name,
- 0/*zerofill*/, attr.unsigned_flag);
+ Field *field= make_table_field(root, name, addr, attr, table->s);
+ if (field)
+ field->init(table);
+ return field;
}
-Field *Type_handler_vers_trx_id::make_table_field(const LEX_CSTRING *name,
+Field *Type_handler_int_result::make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
+ const Record_addr &addr,
+ const Type_all_attributes &attr,
+ TABLE_SHARE *share) const
+{
+ DBUG_ASSERT(is_unsigned() == attr.unsigned_flag);
+ Column_definition_attributes dattr(attr);
+ return make_table_field_from_def(share, root, name, addr,
+ Bit_addr(), &dattr, 0);
+}
+
+
+Field *Type_handler_vers_trx_id::make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const
+ TABLE_SHARE *share) const
{
- return new (table->in_use->mem_root)
+ DBUG_ASSERT(is_unsigned() == attr.unsigned_flag);
+ return new (root)
Field_vers_trx_id(addr.ptr(), attr.max_char_length(),
addr.null_ptr(), addr.null_bit(),
Field::NONE, name,
@@ -3076,37 +3548,25 @@ Field *Type_handler_vers_trx_id::make_table_field(const LEX_CSTRING *name,
}
-Field *Type_handler_float::make_table_field(const LEX_CSTRING *name,
- const Record_addr &addr,
- const Type_all_attributes &attr,
- TABLE *table) const
-{
- return new (table->in_use->mem_root)
- Field_float(addr.ptr(), attr.max_char_length(),
- addr.null_ptr(), addr.null_bit(),
- Field::NONE, name,
- (uint8) attr.decimals, 0/*zerofill*/, attr.unsigned_flag);
-}
-
-
-Field *Type_handler_double::make_table_field(const LEX_CSTRING *name,
- const Record_addr &addr,
- const Type_all_attributes &attr,
- TABLE *table) const
+Field *
+Type_handler_real_result::make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
+ const Record_addr &addr,
+ const Type_all_attributes &attr,
+ TABLE_SHARE *share) const
{
- return new (table->in_use->mem_root)
- Field_double(addr.ptr(), attr.max_char_length(),
- addr.null_ptr(), addr.null_bit(),
- Field::NONE, name,
- (uint8) attr.decimals, 0/*zerofill*/, attr.unsigned_flag);
+ Column_definition_attributes dattr(attr);
+ return make_table_field_from_def(share, root, name, addr,
+ Bit_addr(), &dattr, 0);
}
Field *
-Type_handler_olddecimal::make_table_field(const LEX_CSTRING *name,
+Type_handler_olddecimal::make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const
+ TABLE_SHARE *share) const
{
/*
Currently make_table_field() is used for Item purpose only.
@@ -3116,19 +3576,18 @@ Type_handler_olddecimal::make_table_field(const LEX_CSTRING *name,
in make_field() in field.cc, to open old tables with old decimal.
*/
DBUG_ASSERT(0);
- return new (table->in_use->mem_root)
- Field_decimal(addr.ptr(), attr.max_length,
- addr.null_ptr(), addr.null_bit(),
- Field::NONE, name, (uint8) attr.decimals,
- 0/*zerofill*/,attr.unsigned_flag);
+ Column_definition_attributes dattr(attr);
+ return make_table_field_from_def(share, root, name, addr,
+ Bit_addr(), &dattr, 0);
}
Field *
-Type_handler_newdecimal::make_table_field(const LEX_CSTRING *name,
+Type_handler_newdecimal::make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const
+ TABLE_SHARE *share) const
{
uint8 dec= (uint8) attr.decimals;
uint8 intg= (uint8) (attr.decimal_precision() - dec);
@@ -3164,81 +3623,74 @@ Type_handler_newdecimal::make_table_field(const LEX_CSTRING *name,
/* Corrected value fits. */
len= required_length;
}
- return new (table->in_use->mem_root)
+ return new (root)
Field_new_decimal(addr.ptr(), len, addr.null_ptr(), addr.null_bit(),
Field::NONE, name,
dec, 0/*zerofill*/, attr.unsigned_flag);
}
-Field *Type_handler_year::make_table_field(const LEX_CSTRING *name,
+Field *Type_handler_null::make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const
-{
- return new (table->in_use->mem_root)
- Field_year(addr.ptr(), attr.max_length,
- addr.null_ptr(), addr.null_bit(),
- Field::NONE, name);
-}
-
-
-Field *Type_handler_null::make_table_field(const LEX_CSTRING *name,
- const Record_addr &addr,
- const Type_all_attributes &attr,
- TABLE *table) const
+ TABLE_SHARE *share) const
{
- return new (table->in_use->mem_root)
+ return new (root)
Field_null(addr.ptr(), attr.max_length,
Field::NONE, name, attr.collation.collation);
}
-Field *Type_handler_timestamp::make_table_field(const LEX_CSTRING *name,
+Field *Type_handler_timestamp::make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const
+ TABLE_SHARE *share) const
{
- return new_Field_timestamp(table->in_use->mem_root,
+ return new_Field_timestamp(root,
addr.ptr(), addr.null_ptr(), addr.null_bit(),
- Field::NONE, name, table->s, attr.decimals);
+ Field::NONE, name, share, attr.decimals);
}
-Field *Type_handler_timestamp2::make_table_field(const LEX_CSTRING *name,
+Field *Type_handler_timestamp2::make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const
+ TABLE_SHARE *share) const
{
/*
Will be changed to "new Field_timestampf" when we reuse
make_table_field() for make_field() purposes in field.cc.
*/
- return new_Field_timestamp(table->in_use->mem_root,
+ return new_Field_timestamp(root,
addr.ptr(), addr.null_ptr(), addr.null_bit(),
- Field::NONE, name, table->s, attr.decimals);
+ Field::NONE, name, share, attr.decimals);
}
-Field *Type_handler_newdate::make_table_field(const LEX_CSTRING *name,
+Field *Type_handler_newdate::make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const
+ TABLE_SHARE *share) const
{
- return new (table->in_use->mem_root)
+ return new (root)
Field_newdate(addr.ptr(), addr.null_ptr(), addr.null_bit(),
Field::NONE, name);
}
-Field *Type_handler_date::make_table_field(const LEX_CSTRING *name,
+Field *Type_handler_date::make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const
+ TABLE_SHARE *share) const
{
/*
@@ -3246,28 +3698,30 @@ Field *Type_handler_date::make_table_field(const LEX_CSTRING *name,
for make_field() in field.cc
*/
DBUG_ASSERT(0);
- return new (table->in_use->mem_root)
+ return new (root)
Field_date(addr.ptr(), addr.null_ptr(), addr.null_bit(),
Field::NONE, name);
}
-Field *Type_handler_time::make_table_field(const LEX_CSTRING *name,
+Field *Type_handler_time::make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const
+ TABLE_SHARE *share) const
{
- return new_Field_time(table->in_use->mem_root,
+ return new_Field_time(root,
addr.ptr(), addr.null_ptr(), addr.null_bit(),
Field::NONE, name, attr.decimals);
}
-Field *Type_handler_time2::make_table_field(const LEX_CSTRING *name,
+Field *Type_handler_time2::make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const
+ TABLE_SHARE *share) const
{
@@ -3275,159 +3729,153 @@ Field *Type_handler_time2::make_table_field(const LEX_CSTRING *name,
Will be changed to "new Field_timef" when we reuse
make_table_field() for make_field() purposes in field.cc.
*/
- return new_Field_time(table->in_use->mem_root,
+ return new_Field_time(root,
addr.ptr(), addr.null_ptr(), addr.null_bit(),
Field::NONE, name, attr.decimals);
}
-Field *Type_handler_datetime::make_table_field(const LEX_CSTRING *name,
+Field *Type_handler_datetime::make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const
+ TABLE_SHARE *share) const
{
- return new_Field_datetime(table->in_use->mem_root,
+ return new_Field_datetime(root,
addr.ptr(), addr.null_ptr(), addr.null_bit(),
Field::NONE, name, attr.decimals);
}
-Field *Type_handler_datetime2::make_table_field(const LEX_CSTRING *name,
+Field *Type_handler_datetime2::make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const
+ TABLE_SHARE *share) const
{
/*
Will be changed to "new Field_datetimef" when we reuse
make_table_field() for make_field() purposes in field.cc.
*/
- return new_Field_datetime(table->in_use->mem_root,
+ return new_Field_datetime(root,
addr.ptr(), addr.null_ptr(), addr.null_bit(),
Field::NONE, name, attr.decimals);
}
-Field *Type_handler_bit::make_table_field(const LEX_CSTRING *name,
+Field *Type_handler_bit::make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const
+ TABLE_SHARE *share) const
{
- return new (table->in_use->mem_root)
+ return new (root)
Field_bit_as_char(addr.ptr(), attr.max_length,
addr.null_ptr(), addr.null_bit(),
Field::NONE, name);
}
-Field *Type_handler_string::make_table_field(const LEX_CSTRING *name,
+Field *Type_handler_string::make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const
+ TABLE_SHARE *share) const
{
- return new (table->in_use->mem_root)
+ return new (root)
Field_string(addr.ptr(), attr.max_length,
addr.null_ptr(), addr.null_bit(),
Field::NONE, name, attr.collation);
}
-Field *Type_handler_varchar::make_table_field(const LEX_CSTRING *name,
+Field *Type_handler_varchar::make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const
+ TABLE_SHARE *share) const
{
DBUG_ASSERT(HA_VARCHAR_PACKLENGTH(attr.max_length) <=
MAX_FIELD_VARCHARLENGTH);
- return new (table->in_use->mem_root)
+ return new (root)
Field_varstring(addr.ptr(), attr.max_length,
HA_VARCHAR_PACKLENGTH(attr.max_length),
addr.null_ptr(), addr.null_bit(),
Field::NONE, name,
- table->s, attr.collation);
+ share, attr.collation);
}
-Field *Type_handler_tiny_blob::make_table_field(const LEX_CSTRING *name,
+Field *Type_handler_tiny_blob::make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const
+ TABLE_SHARE *share) const
{
- return new (table->in_use->mem_root)
+ return new (root)
Field_blob(addr.ptr(), addr.null_ptr(), addr.null_bit(),
- Field::NONE, name, table->s,
+ Field::NONE, name, share,
1, attr.collation);
}
-Field *Type_handler_blob::make_table_field(const LEX_CSTRING *name,
+Field *Type_handler_blob::make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const
+ TABLE_SHARE *share) const
{
- return new (table->in_use->mem_root)
+ return new (root)
Field_blob(addr.ptr(), addr.null_ptr(), addr.null_bit(),
- Field::NONE, name, table->s,
+ Field::NONE, name, share,
2, attr.collation);
}
Field *
-Type_handler_medium_blob::make_table_field(const LEX_CSTRING *name,
+Type_handler_medium_blob::make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const
+ TABLE_SHARE *share) const
{
- return new (table->in_use->mem_root)
+ return new (root)
Field_blob(addr.ptr(), addr.null_ptr(), addr.null_bit(),
- Field::NONE, name, table->s,
+ Field::NONE, name, share,
3, attr.collation);
}
-Field *Type_handler_long_blob::make_table_field(const LEX_CSTRING *name,
+Field *Type_handler_long_blob::make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const
+ TABLE_SHARE *share) const
{
- return new (table->in_use->mem_root)
+ return new (root)
Field_blob(addr.ptr(), addr.null_ptr(), addr.null_bit(),
- Field::NONE, name, table->s,
+ Field::NONE, name, share,
4, attr.collation);
}
-
-#ifdef HAVE_SPATIAL
-Field *Type_handler_geometry::make_table_field(const LEX_CSTRING *name,
- const Record_addr &addr,
- const Type_all_attributes &attr,
- TABLE *table) const
-{
- return new (table->in_use->mem_root)
- Field_geom(addr.ptr(), addr.null_ptr(), addr.null_bit(),
- Field::NONE, name, table->s, 4,
- (Field::geometry_type) attr.uint_geometry_type(),
- 0);
-}
-#endif
-
-
-Field *Type_handler_enum::make_table_field(const LEX_CSTRING *name,
+Field *Type_handler_enum::make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const
+ TABLE_SHARE *share) const
{
- TYPELIB *typelib= attr.get_typelib();
+ const TYPELIB *typelib= attr.get_typelib();
DBUG_ASSERT(typelib);
- return new (table->in_use->mem_root)
+ return new (root)
Field_enum(addr.ptr(), attr.max_length,
addr.null_ptr(), addr.null_bit(),
Field::NONE, name,
@@ -3436,15 +3884,16 @@ Field *Type_handler_enum::make_table_field(const LEX_CSTRING *name,
}
-Field *Type_handler_set::make_table_field(const LEX_CSTRING *name,
+Field *Type_handler_set::make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const
+ TABLE_SHARE *share) const
{
- TYPELIB *typelib= attr.get_typelib();
+ const TYPELIB *typelib= attr.get_typelib();
DBUG_ASSERT(typelib);
- return new (table->in_use->mem_root)
+ return new (root)
Field_set(addr.ptr(), attr.max_length,
addr.null_ptr(), addr.null_bit(),
Field::NONE, name,
@@ -3452,6 +3901,198 @@ Field *Type_handler_set::make_table_field(const LEX_CSTRING *name,
attr.collation);
}
+
+/*************************************************************************/
+
+Field *Type_handler_float::make_schema_field(MEM_ROOT *root, TABLE *table,
+ const Record_addr &addr,
+ const ST_FIELD_INFO &def,
+ bool show_field) const
+{
+ LEX_CSTRING name= def.name();
+ return new (root)
+ Field_float(addr.ptr(), def.char_length(),
+ addr.null_ptr(), addr.null_bit(),
+ Field::NONE, &name,
+ (uint8) NOT_FIXED_DEC,
+ 0/*zerofill*/, def.unsigned_flag());
+}
+
+
+Field *Type_handler_double::make_schema_field(MEM_ROOT *root, TABLE *table,
+ const Record_addr &addr,
+ const ST_FIELD_INFO &def,
+ bool show_field) const
+{
+ LEX_CSTRING name= def.name();
+ return new (root)
+ Field_double(addr.ptr(), def.char_length(),
+ addr.null_ptr(), addr.null_bit(),
+ Field::NONE, &name,
+ (uint8) NOT_FIXED_DEC,
+ 0/*zerofill*/, def.unsigned_flag());
+}
+
+
+Field *Type_handler_decimal_result::make_schema_field(MEM_ROOT *root,
+ TABLE *table,
+ const Record_addr &addr,
+ const ST_FIELD_INFO &def,
+ bool show_field) const
+{
+ LEX_CSTRING name= def.name();
+ uint dec= def.decimal_scale();
+ uint prec= def.decimal_precision();
+ DBUG_ASSERT(dec <= DECIMAL_MAX_SCALE);
+ uint32 len= my_decimal_precision_to_length(prec, dec, def.unsigned_flag());
+ return new (root)
+ Field_new_decimal(addr.ptr(), len, addr.null_ptr(), addr.null_bit(),
+ Field::NONE, &name,
+ (uint8) dec, 0/*zerofill*/, def.unsigned_flag());
+}
+
+
+Field *Type_handler_blob_common::make_schema_field(MEM_ROOT *root, TABLE *table,
+ const Record_addr &addr,
+ const ST_FIELD_INFO &def,
+ bool show_field) const
+{
+ LEX_CSTRING name= def.name();
+ if (show_field)
+ {
+ return new (root)
+ Field_blob(addr.ptr(), addr.null_ptr(), addr.null_bit(),
+ Field::NONE, &name, table->s,
+ length_bytes(),
+ &my_charset_bin);
+ }
+ else
+ return new (root)
+ Field_null(addr.ptr(), 0, Field::NONE, &name, &my_charset_bin);
+}
+
+
+Field *Type_handler_varchar::make_schema_field(MEM_ROOT *root, TABLE *table,
+ const Record_addr &addr,
+ const ST_FIELD_INFO &def,
+ bool show_field) const
+{
+ DBUG_ASSERT(def.char_length());
+ LEX_CSTRING name= def.name();
+ uint32 octet_length= (uint32) def.char_length() * 3;
+ if (octet_length > MAX_FIELD_VARCHARLENGTH)
+ {
+ Field *field= new (root)
+ Field_blob(addr.ptr(), addr.null_ptr(), addr.null_bit(), Field::NONE,
+ &name, table->s, 4, system_charset_info);
+ if (field)
+ field->field_length= octet_length;
+ return field;
+ }
+ else if (show_field)
+ {
+ return new (root)
+ Field_varstring(addr.ptr(), octet_length,
+ HA_VARCHAR_PACKLENGTH(octet_length),
+ addr.null_ptr(), addr.null_bit(),
+ Field::NONE, &name,
+ table->s, system_charset_info);
+ }
+ else
+ return new (root)
+ Field_null(addr.ptr(), 0, Field::NONE, &name, system_charset_info);
+}
+
+
+Field *Type_handler_tiny::make_schema_field(MEM_ROOT *root, TABLE *table,
+ const Record_addr &addr,
+ const ST_FIELD_INFO &def,
+ bool show_field) const
+{
+ LEX_CSTRING name= def.name();
+ return new (root)
+ Field_tiny(addr.ptr(), def.char_length(),
+ addr.null_ptr(), addr.null_bit(), Field::NONE, &name,
+ 0/*zerofill*/, def.unsigned_flag());
+}
+
+
+Field *Type_handler_short::make_schema_field(MEM_ROOT *root, TABLE *table,
+ const Record_addr &addr,
+ const ST_FIELD_INFO &def,
+ bool show_field) const
+{
+ LEX_CSTRING name= def.name();
+ return new (root)
+ Field_short(addr.ptr(), def.char_length(),
+ addr.null_ptr(), addr.null_bit(), Field::NONE, &name,
+ 0/*zerofill*/, def.unsigned_flag());
+}
+
+
+Field *Type_handler_long::make_schema_field(MEM_ROOT *root, TABLE *table,
+ const Record_addr &addr,
+ const ST_FIELD_INFO &def,
+ bool show_field) const
+{
+ LEX_CSTRING name= def.name();
+ return new (root)
+ Field_long(addr.ptr(), def.char_length(),
+ addr.null_ptr(), addr.null_bit(), Field::NONE, &name,
+ 0/*zerofill*/, def.unsigned_flag());
+}
+
+
+Field *Type_handler_longlong::make_schema_field(MEM_ROOT *root, TABLE *table,
+ const Record_addr &addr,
+ const ST_FIELD_INFO &def,
+ bool show_field) const
+{
+ LEX_CSTRING name= def.name();
+ return new (root)
+ Field_longlong(addr.ptr(), def.char_length(),
+ addr.null_ptr(), addr.null_bit(), Field::NONE, &name,
+ 0/*zerofill*/, def.unsigned_flag());
+}
+
+
+Field *Type_handler_date_common::make_schema_field(MEM_ROOT *root, TABLE *table,
+ const Record_addr &addr,
+ const ST_FIELD_INFO &def,
+ bool show_field) const
+{
+ LEX_CSTRING name= def.name();
+ return new (root)
+ Field_newdate(addr.ptr(), addr.null_ptr(), addr.null_bit(),
+ Field::NONE, &name);
+}
+
+
+Field *Type_handler_time_common::make_schema_field(MEM_ROOT *root, TABLE *table,
+ const Record_addr &addr,
+ const ST_FIELD_INFO &def,
+ bool show_field) const
+{
+ LEX_CSTRING name= def.name();
+ return new_Field_time(root,
+ addr.ptr(), addr.null_ptr(), addr.null_bit(),
+ Field::NONE, &name, def.fsp());
+}
+
+
+Field *Type_handler_datetime_common::make_schema_field(MEM_ROOT *root,
+ TABLE *table,
+ const Record_addr &addr,
+ const ST_FIELD_INFO &def,
+ bool show_field) const
+{
+ LEX_CSTRING name= def.name();
+ return new_Field_datetime(root,
+ addr.ptr(), addr.null_ptr(), addr.null_bit(),
+ Field::NONE, &name, def.fsp());
+}
+
+
/*************************************************************************/
/*
@@ -3509,13 +4150,6 @@ uint32 Type_handler_bit::max_display_length(const Item *item) const
}
-uint32 Type_handler_general_purpose_int::max_display_length(const Item *item)
- const
-{
- return type_limits_int_by_unsigned_flag(item->unsigned_flag)->char_length();
-}
-
-
/*************************************************************************/
void Type_handler_row::Item_update_null_value(Item *item) const
@@ -3727,7 +4361,7 @@ bool Type_handler_string_result::
the query should return only the row with 'oe'.
It should not return 'o-umlaut', because 'o-umlaut' does not match
the right part of the condition: a='oe'
- ('o-umlaut' is not equal to 'oe' in utf8_general_ci,
+ ('o-umlaut' is not equal to 'oe' in utf8mb3_general_ci,
which is the collation of the field "a").
If we change the right part from:
@@ -3868,11 +4502,14 @@ bool Type_handler_int_result::
{
// Convert a mixture of signed and unsigned int to decimal
handler->set_handler(&type_handler_newdecimal);
- func->aggregate_attributes_decimal(items, nitems);
+ func->aggregate_attributes_decimal(items, nitems, false);
return false;
}
}
func->aggregate_attributes_int(items, nitems);
+ handler->set_handler(func->unsigned_flag ?
+ handler->type_handler()->type_handler_unsigned() :
+ handler->type_handler()->type_handler_signed());
return false;
}
@@ -3896,7 +4533,8 @@ bool Type_handler_decimal_result::
Type_all_attributes *func,
Item **items, uint nitems) const
{
- func->aggregate_attributes_decimal(items, nitems);
+ uint unsigned_count= func->count_unsigned(items, nitems);
+ func->aggregate_attributes_decimal(items, nitems, unsigned_count == nitems);
return false;
}
@@ -3924,10 +4562,10 @@ bool Type_handler_typelib::
Type_all_attributes *func,
Item **items, uint nitems) const
{
- TYPELIB *typelib= NULL;
+ const TYPELIB *typelib= NULL;
for (uint i= 0; i < nitems; i++)
{
- TYPELIB *typelib2;
+ const TYPELIB *typelib2;
if ((typelib2= items[i]->get_typelib()))
{
if (typelib)
@@ -4010,29 +4648,6 @@ bool Type_handler_timestamp_common::
return false;
}
-#ifdef HAVE_SPATIAL
-bool Type_handler_geometry::
- Item_hybrid_func_fix_attributes(THD *thd,
- const char *func_name,
- Type_handler_hybrid_field_type *handler,
- Type_all_attributes *func,
- Item **items, uint nitems) const
-{
- DBUG_ASSERT(nitems > 0);
- Type_geometry_attributes gattr(items[0]->type_handler(), items[0]);
- for (uint i= 1; i < nitems; i++)
- gattr.join(items[i]);
- func->set_geometry_type(gattr.get_geometry_type());
- func->collation.set(&my_charset_bin);
- func->unsigned_flag= false;
- func->decimals= 0;
- func->max_length= (uint32) UINT_MAX32;
- func->set_maybe_null(true);
- return false;
-}
-#endif
-
-
/*************************************************************************/
bool Type_handler::
@@ -4167,7 +4782,15 @@ bool Type_handler_real_result::
bool Type_handler_int_result::
Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *func) const
{
- return func->fix_length_and_dec_numeric(&type_handler_longlong);
+ /*
+ "this" is equal func->args[0]->type_handler() here, e.g. for MIN()/MAX().
+ func->unsigned_flag is not reliably set yet.
+ It will be set by the call below (copied from args[0]).
+ */
+ const Type_handler *h= is_unsigned() ?
+ &type_handler_ulonglong :
+ &type_handler_slonglong;
+ return func->fix_length_and_dec_numeric(h);
}
@@ -4250,13 +4873,6 @@ bool Type_handler_string_result::
}
-#ifdef HAVE_SPATIAL
-bool Type_handler_geometry::
- Item_sum_sum_fix_length_and_dec(Item_sum_sum *item) const
-{
- return Item_func_or_sum_illegal_param("sum");
-}
-#endif
/*************************************************************************/
@@ -4301,13 +4917,6 @@ bool Type_handler_string_result::
}
-#ifdef HAVE_SPATIAL
-bool Type_handler_geometry::
- Item_sum_avg_fix_length_and_dec(Item_sum_avg *item) const
-{
- return Item_func_or_sum_illegal_param("avg");
-}
-#endif
/*************************************************************************/
@@ -4352,15 +4961,6 @@ bool Type_handler_string_result::
}
-#ifdef HAVE_SPATIAL
-bool Type_handler_geometry::
- Item_sum_variance_fix_length_and_dec(Item_sum_variance *item) const
-{
- return Item_func_or_sum_illegal_param(item);
-}
-#endif
-
-
/*************************************************************************/
bool Type_handler_real_result::Item_val_bool(Item *item) const
@@ -5663,14 +6263,6 @@ bool Type_handler_string_result::
}
-#ifdef HAVE_SPATIAL
-bool Type_handler_geometry::
- Item_func_round_fix_length_and_dec(Item_func_round *item) const
-{
- return Item_func_or_sum_illegal_param(item);
-}
-#endif
-
/***************************************************************************/
bool Type_handler_row::
@@ -5721,14 +6313,6 @@ bool Type_handler_string_result::
}
-#ifdef HAVE_SPATIAL
-bool Type_handler_geometry::
- Item_func_int_val_fix_length_and_dec(Item_func_int_val *item) const
-{
- return Item_func_or_sum_illegal_param(item);
-}
-#endif
-
/***************************************************************************/
bool Type_handler_row::
@@ -5779,14 +6363,6 @@ bool Type_handler_string_result::
}
-#ifdef HAVE_SPATIAL
-bool Type_handler_geometry::
- Item_func_abs_fix_length_and_dec(Item_func_abs *item) const
-{
- return Item_func_or_sum_illegal_param(item);
-}
-#endif
-
/***************************************************************************/
bool Type_handler_row::
@@ -5837,15 +6413,6 @@ bool Type_handler_string_result::
}
-#ifdef HAVE_SPATIAL
-bool Type_handler_geometry::
- Item_func_neg_fix_length_and_dec(Item_func_neg *item) const
-{
- return Item_func_or_sum_illegal_param(item);
-}
-#endif
-
-
/***************************************************************************/
bool Type_handler::
@@ -5995,78 +6562,6 @@ bool Type_handler::
}
-#ifdef HAVE_SPATIAL
-
-bool Type_handler_geometry::
- Item_func_signed_fix_length_and_dec(Item_func_signed *item) const
-{
- return Item_func_or_sum_illegal_param(item);
-}
-
-
-bool Type_handler_geometry::
- Item_func_unsigned_fix_length_and_dec(Item_func_unsigned *item) const
-{
- return Item_func_or_sum_illegal_param(item);
-}
-
-
-bool Type_handler_geometry::
- Item_double_typecast_fix_length_and_dec(Item_double_typecast *item) const
-{
- return Item_func_or_sum_illegal_param(item);
-}
-
-
-bool Type_handler_geometry::
- Item_float_typecast_fix_length_and_dec(Item_float_typecast *item) const
-{
- return Item_func_or_sum_illegal_param(item);
-}
-
-
-bool Type_handler_geometry::
- Item_decimal_typecast_fix_length_and_dec(Item_decimal_typecast *item) const
-{
- return Item_func_or_sum_illegal_param(item);
-}
-
-
-bool Type_handler_geometry::
- Item_char_typecast_fix_length_and_dec(Item_char_typecast *item) const
-{
- if (item->cast_charset() != &my_charset_bin)
- return Item_func_or_sum_illegal_param(item); // CAST(geom AS CHAR)
- item->fix_length_and_dec_str();
- return false; // CAST(geom AS BINARY)
-}
-
-
-bool Type_handler_geometry::
- Item_time_typecast_fix_length_and_dec(Item_time_typecast *item) const
-{
- return Item_func_or_sum_illegal_param(item);
-}
-
-
-
-bool Type_handler_geometry::
- Item_date_typecast_fix_length_and_dec(Item_date_typecast *item) const
-{
- return Item_func_or_sum_illegal_param(item);
-}
-
-
-bool Type_handler_geometry::
- Item_datetime_typecast_fix_length_and_dec(Item_datetime_typecast *item)
- const
-{
- return Item_func_or_sum_illegal_param(item);
-
-}
-
-#endif /* HAVE_SPATIAL */
-
/***************************************************************************/
bool Type_handler_row::
@@ -6685,21 +7180,6 @@ bool Type_handler_temporal_result::
}
-#ifdef HAVE_SPATIAL
-bool Type_handler_geometry::
- Item_param_set_from_value(THD *thd,
- Item_param *param,
- const Type_all_attributes *attr,
- const st_value *val) const
-{
- param->unsigned_flag= false;
- param->setup_conversion_blob(thd);
- param->set_geometry_type(attr->uint_geometry_type());
- return param->set_str(val->m_string.ptr(), val->m_string.length(),
- &my_charset_bin, &my_charset_bin);
-}
-#endif
-
/***************************************************************************/
bool Type_handler_null::
@@ -6867,10 +7347,10 @@ Item *Type_handler_string_result::
String *result= item->val_str(&tmp);
if (item->null_value)
return new (thd->mem_root) Item_null(thd, item->name.str);
- uint length= result->length();
- char *tmp_str= thd->strmake(result->ptr(), length);
- return new (thd->mem_root) Item_string(thd, item->name.str,
- tmp_str, length, result->charset());
+ LEX_CSTRING value;
+ thd->make_lex_string(&value, result->ptr(), result->length());
+ return new (thd->mem_root) Item_string(thd, item->name, value,
+ result->charset());
}
@@ -7220,7 +7700,8 @@ void Type_handler_datetime_common::Item_param_set_param_func(Item_param *param,
param->set_param_datetime(pos, len);
}
-Field *Type_handler_blob_common::make_conversion_table_field(TABLE *table,
+Field *Type_handler_blob_common::make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table,
uint metadata,
const Field *target)
const
@@ -7228,7 +7709,7 @@ Field *Type_handler_blob_common::make_conversion_table_field(TABLE *table,
uint pack_length= metadata & 0x00ff;
if (pack_length < 1 || pack_length > 4)
return NULL; // Broken binary log?
- return new(table->in_use->mem_root)
+ return new(root)
Field_blob(NULL, (uchar *) "", 1, Field::NONE, &empty_clex_str,
table->s, pack_length, target->charset());
}
@@ -7258,15 +7739,6 @@ void Type_handler_typelib::Item_param_set_param_func(Item_param *param,
}
-#ifdef HAVE_SPATIAL
-void Type_handler_geometry::Item_param_set_param_func(Item_param *param,
- uchar **pos,
- ulong len) const
-{
- param->set_null(); // Not possible type code in the client-server protocol
-}
-#endif
-
/***************************************************************************/
Field *Type_handler_row::
@@ -7289,11 +7761,12 @@ Field *Type_handler_olddecimal::
const Column_definition_attributes *attr,
uint32 flags) const
{
+ DBUG_ASSERT(f_decimals(attr->pack_flag) == 0);
return new (mem_root)
Field_decimal(rec.ptr(), (uint32) attr->length,
rec.null_ptr(), rec.null_bit(),
attr->unireg_check, name,
- f_decimals(attr->pack_flag),
+ (uint8) attr->decimals,
f_is_zerofill(attr->pack_flag) != 0,
f_is_dec(attr->pack_flag) == 0);
}
@@ -7306,11 +7779,12 @@ Field *Type_handler_newdecimal::
const Column_definition_attributes *attr,
uint32 flags) const
{
+ DBUG_ASSERT(f_decimals(attr->pack_flag) == 0);
return new (mem_root)
Field_new_decimal(rec.ptr(), (uint32) attr->length,
rec.null_ptr(), rec.null_bit(),
attr->unireg_check, name,
- f_decimals(attr->pack_flag),
+ (uint8) attr->decimals,
f_is_zerofill(attr->pack_flag) != 0,
f_is_dec(attr->pack_flag) == 0);
}
@@ -7323,7 +7797,8 @@ Field *Type_handler_float::
const Column_definition_attributes *attr,
uint32 flags) const
{
- int decimals= f_decimals(attr->pack_flag);
+ DBUG_ASSERT(f_decimals(attr->pack_flag) == 0);
+ uint decimals= attr->decimals;
if (decimals == FLOATING_POINT_DECIMALS)
decimals= NOT_FIXED_DEC;
return new (mem_root)
@@ -7342,7 +7817,8 @@ Field *Type_handler_double::
const Column_definition_attributes *attr,
uint32 flags) const
{
- int decimals= f_decimals(attr->pack_flag);
+ DBUG_ASSERT(f_decimals(attr->pack_flag) == 0);
+ uint decimals= attr->decimals;
if (decimals == FLOATING_POINT_DECIMALS)
decimals= NOT_FIXED_DEC;
return new (mem_root)
@@ -7446,6 +7922,7 @@ Field *Type_handler_timestamp::
const Column_definition_attributes *attr,
uint32 flags) const
{
+ DBUG_ASSERT(attr->decimals == attr->temporal_dec(MAX_DATETIME_WIDTH));
return new_Field_timestamp(mem_root,
rec.ptr(), rec.null_ptr(), rec.null_bit(),
attr->unireg_check, name, share,
@@ -7460,6 +7937,7 @@ Field *Type_handler_timestamp2::
const Column_definition_attributes *attr,
uint32 flags) const
{
+ DBUG_ASSERT(attr->decimals == attr->temporal_dec(MAX_DATETIME_WIDTH));
return new (mem_root)
Field_timestampf(rec.ptr(), rec.null_ptr(), rec.null_bit(),
attr->unireg_check,
@@ -7513,6 +7991,7 @@ Field *Type_handler_time::
const Column_definition_attributes *attr,
uint32 flags) const
{
+ DBUG_ASSERT(attr->decimals == attr->temporal_dec(MIN_TIME_WIDTH));
return new_Field_time(mem_root, rec.ptr(), rec.null_ptr(), rec.null_bit(),
attr->unireg_check, name,
attr->temporal_dec(MIN_TIME_WIDTH));
@@ -7526,6 +8005,7 @@ Field *Type_handler_time2::
const Column_definition_attributes *attr,
uint32 flags) const
{
+ DBUG_ASSERT(attr->decimals == attr->temporal_dec(MIN_TIME_WIDTH));
return new (mem_root)
Field_timef(rec.ptr(), rec.null_ptr(), rec.null_bit(),
attr->unireg_check, name,
@@ -7540,6 +8020,7 @@ Field *Type_handler_datetime::
const Column_definition_attributes *attr,
uint32 flags) const
{
+ DBUG_ASSERT(attr->decimals == attr->temporal_dec(MAX_DATETIME_WIDTH));
return new_Field_datetime(mem_root, rec.ptr(), rec.null_ptr(), rec.null_bit(),
attr->unireg_check, name,
attr->temporal_dec(MAX_DATETIME_WIDTH));
@@ -7553,6 +8034,7 @@ Field *Type_handler_datetime2::
const Column_definition_attributes *attr,
uint32 flags) const
{
+ DBUG_ASSERT(attr->decimals == attr->temporal_dec(MAX_DATETIME_WIDTH));
return new (mem_root)
Field_datetimef(rec.ptr(), rec.null_ptr(), rec.null_bit(),
attr->unireg_check, name,
@@ -7590,21 +8072,6 @@ Field *Type_handler_bit::
}
-#ifdef HAVE_SPATIAL
-Field *Type_handler_geometry::
- make_table_field_from_def(TABLE_SHARE *share, MEM_ROOT *mem_root,
- const LEX_CSTRING *name,
- const Record_addr &rec, const Bit_addr &bit,
- const Column_definition_attributes *attr,
- uint32 flags) const
-{
- status_var_increment(current_thd->status_var.feature_gis);
- return new (mem_root)
- Field_geom(rec.ptr(), rec.null_ptr(), rec.null_bit(),
- attr->unireg_check, name, share,
- attr->pack_flag_to_pack_length(), attr->geom_type, attr->srid);
-}
-#endif
Field *Type_handler_string::
@@ -7702,16 +8169,110 @@ void Type_handler::
}
-#ifdef HAVE_SPATIAL
-void Type_handler_geometry::
+void Type_handler_real_result::
Column_definition_attributes_frm_pack(const Column_definition_attributes *def,
uchar *buff) const
{
- def->frm_pack_basic(buff);
- buff[11]= 0;
- buff[14]= (uchar) def->geom_type;
+ def->frm_pack_numeric_with_dec(buff);
+}
+
+
+void Type_handler_decimal_result::
+ Column_definition_attributes_frm_pack(const Column_definition_attributes *def,
+ uchar *buff) const
+{
+ def->frm_pack_numeric_with_dec(buff);
+}
+
+
+void Type_handler_int_result::
+ Column_definition_attributes_frm_pack(const Column_definition_attributes *def,
+ uchar *buff) const
+{
+ DBUG_ASSERT(f_decimals(def->pack_flag) == 0);
+ DBUG_ASSERT(def->decimals == 0);
+ Type_handler::Column_definition_attributes_frm_pack(def, buff);
+}
+
+
+void Type_handler_date_common::
+ Column_definition_attributes_frm_pack(const Column_definition_attributes *def,
+ uchar *buff) const
+{
+ DBUG_ASSERT(f_decimals(def->pack_flag) == 0);
+ DBUG_ASSERT(def->decimals == 0);
+ Type_handler::Column_definition_attributes_frm_pack(def, buff);
+}
+
+
+void Type_handler_bit::
+ Column_definition_attributes_frm_pack(const Column_definition_attributes *def,
+ uchar *buff) const
+{
+ DBUG_ASSERT(f_decimals(def->pack_flag & ~FIELDFLAG_TREAT_BIT_AS_CHAR) == 0);
+ DBUG_ASSERT(def->decimals == 0);
+ Type_handler::Column_definition_attributes_frm_pack(def, buff);
+}
+
+
+void Type_handler_blob_common::
+ Column_definition_attributes_frm_pack(const Column_definition_attributes *def,
+ uchar *buff) const
+{
+ DBUG_ASSERT(f_decimals(def->pack_flag & ~FIELDFLAG_BLOB) == 0);
+ DBUG_ASSERT(def->decimals == 0 ||
+ def->decimals == NOT_FIXED_DEC);
+ Type_handler::Column_definition_attributes_frm_pack(def, buff);
+}
+
+
+void Type_handler_null::
+ Column_definition_attributes_frm_pack(const Column_definition_attributes *def,
+ uchar *buff) const
+{
+ DBUG_ASSERT(f_decimals(def->pack_flag) == 0);
+ DBUG_ASSERT(def->decimals == NOT_FIXED_DEC);
+ Type_handler::Column_definition_attributes_frm_pack(def, buff);
+}
+
+
+void Type_handler_string_result::
+ Column_definition_attributes_frm_pack(const Column_definition_attributes *def,
+ uchar *buff) const
+{
+ DBUG_ASSERT(f_decimals(def->pack_flag) == 0);
+ DBUG_ASSERT(def->decimals == 0 || def->decimals == NOT_FIXED_DEC);
+ Type_handler::Column_definition_attributes_frm_pack(def, buff);
+}
+
+
+void Type_handler_enum::
+ Column_definition_attributes_frm_pack(const Column_definition_attributes *def,
+ uchar *buff) const
+{
+ DBUG_ASSERT(f_decimals(def->pack_flag & ~FIELDFLAG_INTERVAL) == 0);
+ DBUG_ASSERT(def->decimals == 0);
+ Type_handler::Column_definition_attributes_frm_pack(def, buff);
+}
+
+
+void Type_handler_set::
+ Column_definition_attributes_frm_pack(const Column_definition_attributes *def,
+ uchar *buff) const
+{
+ DBUG_ASSERT(f_decimals(def->pack_flag & ~FIELDFLAG_BITFIELD) == 0);
+ DBUG_ASSERT(def->decimals == 0);
+ Type_handler::Column_definition_attributes_frm_pack(def, buff);
+}
+
+
+void Type_handler_temporal_result::
+ Column_definition_attributes_frm_pack(const Column_definition_attributes *def,
+ uchar *buff) const
+{
+ DBUG_ASSERT(f_decimals(def->pack_flag) == 0);
+ Type_handler::Column_definition_attributes_frm_pack(def, buff);
}
-#endif
/***************************************************************************/
@@ -7728,89 +8289,60 @@ bool Type_handler::
}
-#ifdef HAVE_SPATIAL
-bool Type_handler_geometry::
+bool Type_handler_real_result::
Column_definition_attributes_frm_unpack(Column_definition_attributes *attr,
TABLE_SHARE *share,
const uchar *buffer,
LEX_CUSTRING *gis_options)
const
{
- uint gis_opt_read, gis_length, gis_decimals;
- Field_geom::storage_type st_type;
- attr->frm_unpack_basic(buffer);
- // charset and geometry_type share the same byte in frm
- attr->geom_type= (Field::geometry_type) buffer[14];
- gis_opt_read= gis_field_options_read(gis_options->str,
- gis_options->length,
- &st_type, &gis_length,
- &gis_decimals, &attr->srid);
- gis_options->str+= gis_opt_read;
- gis_options->length-= gis_opt_read;
- return false;
-}
-#endif
-
-/***************************************************************************/
-
-bool Type_handler::Vers_history_point_resolve_unit(THD *thd,
- Vers_history_point *point)
- const
-{
- /*
- Disallow using non-relevant data types in history points.
- Even expressions with explicit TRANSACTION or TIMESTAMP units.
- */
- point->bad_expression_data_type_error(name().ptr());
- return true;
-}
-
-
-bool Type_handler_typelib::
- Vers_history_point_resolve_unit(THD *thd,
- Vers_history_point *point) const
-{
- /*
- ENUM/SET have dual type properties (string and numeric).
- Require explicit CAST to avoid ambiguity.
- */
- point->bad_expression_data_type_error(name().ptr());
- return true;
+ return attr->frm_unpack_numeric_with_dec(share, buffer);
}
-bool Type_handler_general_purpose_int::
- Vers_history_point_resolve_unit(THD *thd,
- Vers_history_point *point) const
+bool Type_handler_decimal_result::
+ Column_definition_attributes_frm_unpack(Column_definition_attributes *attr,
+ TABLE_SHARE *share,
+ const uchar *buffer,
+ LEX_CUSTRING *gis_options)
+ const
{
- return point->resolve_unit_trx_id(thd);
+ return attr->frm_unpack_numeric_with_dec(share, buffer);
}
-bool Type_handler_bit::
- Vers_history_point_resolve_unit(THD *thd,
- Vers_history_point *point) const
+bool Type_handler_time_common::
+ Column_definition_attributes_frm_unpack(Column_definition_attributes *attr,
+ TABLE_SHARE *share,
+ const uchar *buffer,
+ LEX_CUSTRING *gis_options)
+ const
{
- return point->resolve_unit_trx_id(thd);
+ return attr->frm_unpack_temporal_with_dec(share, MIN_TIME_WIDTH, buffer);
}
-bool Type_handler_temporal_result::
- Vers_history_point_resolve_unit(THD *thd,
- Vers_history_point *point) const
+bool Type_handler_datetime_common::
+ Column_definition_attributes_frm_unpack(Column_definition_attributes *attr,
+ TABLE_SHARE *share,
+ const uchar *buffer,
+ LEX_CUSTRING *gis_options)
+ const
{
- return point->resolve_unit_timestamp(thd);
+ return attr->frm_unpack_temporal_with_dec(share, MAX_DATETIME_WIDTH, buffer);
}
-bool Type_handler_general_purpose_string::
- Vers_history_point_resolve_unit(THD *thd,
- Vers_history_point *point) const
+bool Type_handler_timestamp_common::
+ Column_definition_attributes_frm_unpack(Column_definition_attributes *attr,
+ TABLE_SHARE *share,
+ const uchar *buffer,
+ LEX_CUSTRING *gis_options)
+ const
{
- return point->resolve_unit_timestamp(thd);
+ return attr->frm_unpack_temporal_with_dec(share, MAX_DATETIME_WIDTH, buffer);
}
-/***************************************************************************/
bool Type_handler_null::Item_const_eq(const Item_const *a,
const Item_const *b,
@@ -7889,14 +8421,7 @@ Type_handler_temporal_result::Item_const_eq(const Item_const *a,
const Type_handler *
Type_handler_hex_hybrid::cast_to_int_type_handler() const
{
- return &type_handler_longlong;
-}
-
-
-const Type_handler *
-Type_handler_hex_hybrid::type_handler_for_system_time() const
-{
- return &type_handler_longlong;
+ return &type_handler_ulonglong;
}
@@ -8303,6 +8828,94 @@ Type_handler_timestamp_common::Item_param_val_native(THD *thd,
}
+/***************************************************************************/
+
+bool Type_handler::validate_implicit_default_value(THD *thd,
+ const Column_definition &def) const
+{
+ DBUG_EXECUTE_IF("validate_implicit_default_value_error", return true;);
+ return false;
+}
+
+
+bool Type_handler_date_common::validate_implicit_default_value(THD *thd,
+ const Column_definition &def) const
+{
+ return thd->variables.sql_mode & MODE_NO_ZERO_DATE;
+}
+
+
+bool Type_handler_datetime_common::validate_implicit_default_value(THD *thd,
+ const Column_definition &def) const
+{
+ return thd->variables.sql_mode & MODE_NO_ZERO_DATE;
+}
+
+
+/***************************************************************************/
+
+const Name & Type_handler_row::default_value() const
+{
+ DBUG_ASSERT(0);
+ static Name def(STRING_WITH_LEN(""));
+ return def;
+}
+
+const Name & Type_handler_numeric::default_value() const
+{
+ static Name def(STRING_WITH_LEN("0"));
+ return def;
+}
+
+const Name & Type_handler_string_result::default_value() const
+{
+ static Name def(STRING_WITH_LEN(""));
+ return def;
+}
+
+const Name & Type_handler_time_common::default_value() const
+{
+ static Name def(STRING_WITH_LEN("00:00:00"));
+ return def;
+}
+
+const Name & Type_handler_date_common::default_value() const
+{
+ static Name def(STRING_WITH_LEN("0000-00-00"));
+ return def;
+}
+
+const Name & Type_handler_datetime_common::default_value() const
+{
+ static Name def(STRING_WITH_LEN("0000-00-00 00:00:00"));
+ return def;
+}
+
+const Name & Type_handler_timestamp_common::default_value() const
+{
+ static Name def(STRING_WITH_LEN("0000-00-00 00:00:00"));
+ return def;
+}
+
+/***************************************************************************/
+
+bool Type_handler::Column_definition_data_type_info_image(Binary_string *to,
+ const Column_definition &def)
+ const
+{
+ // Have *some* columns write type info (let's use string fields as an example)
+ DBUG_EXECUTE_IF("frm_data_type_info_emulate",
+ if (cmp_type() == STRING_RESULT)
+ return to->append("x", 1) ||
+ to->append(name().lex_cstring()););
+ if (type_collection() != &type_collection_std)
+ return to->append(name().lex_cstring());
+ return false;
+}
+
+
+/***************************************************************************/
+
LEX_CSTRING Charset::collation_specific_name() const
{
/*
diff --git a/sql/sql_type.h b/sql/sql_type.h
index 0d6f7901480..54356c09b09 100644
--- a/sql/sql_type.h
+++ b/sql/sql_type.h
@@ -27,10 +27,14 @@
#include "sql_time.h"
#include "sql_type_real.h"
#include "compat56.h"
+C_MODE_START
+#include <ma_dyncol.h>
+C_MODE_END
class Field;
class Column_definition;
class Column_definition_attributes;
+class Key_part_spec;
class Item;
class Item_const;
class Item_literal;
@@ -69,6 +73,7 @@ class Item_func_div;
class Item_func_mod;
class cmp_item;
class in_vector;
+class Type_handler_data;
class Type_handler_hybrid_field_type;
class Sort_param;
class Arg_comparator;
@@ -81,6 +86,10 @@ struct TABLE;
struct SORT_FIELD_ATTR;
class Vers_history_point;
class Virtual_column_info;
+class Conv_source;
+class ST_FIELD_INFO;
+class Type_collection;
+class Create_func;
#define my_charset_numeric my_charset_latin1
@@ -110,6 +119,82 @@ enum scalar_comparison_op
};
+class Data_type_statistics
+{
+public:
+ uint m_uneven_bit_length;
+ uint m_fixed_string_total_length;
+ uint m_fixed_string_count;
+ uint m_variable_string_total_length;
+ uint m_variable_string_count;
+ uint m_blob_count;
+ Data_type_statistics()
+ :m_uneven_bit_length(0),
+ m_fixed_string_total_length(0),
+ m_fixed_string_count(0),
+ m_variable_string_total_length(0),
+ m_variable_string_count(0),
+ m_blob_count(0)
+ { }
+ uint string_count() const
+ {
+ return m_fixed_string_count + m_variable_string_count;
+ }
+ uint string_total_length() const
+ {
+ return m_fixed_string_total_length + m_variable_string_total_length;
+ }
+};
+
+
+class Typelib: public TYPELIB
+{
+public:
+ Typelib(uint count, const char **type_names, unsigned int *type_lengths)
+ {
+ TYPELIB::count= count;
+ TYPELIB::name= "";
+ TYPELIB::type_names= type_names;
+ TYPELIB::type_lengths= type_lengths;
+ }
+ uint max_octet_length() const
+ {
+ uint max_length= 0;
+ for (uint i= 0; i < TYPELIB::count; i++)
+ {
+ const uint length= TYPELIB::type_lengths[i];
+ set_if_bigger(max_length, length);
+ }
+ return max_length;
+ }
+};
+
+
+template<uint sz>
+class TypelibBuffer: public Typelib
+{
+ const char *m_type_names[sz + 1];
+ uint m_type_lengths[sz + 1];
+public:
+ TypelibBuffer(uint count, const LEX_CSTRING *values)
+ :Typelib(count, m_type_names, m_type_lengths)
+ {
+ DBUG_ASSERT(sz >= count);
+ for (uint i= 0; i < count; i++)
+ {
+ DBUG_ASSERT(values[i].str != NULL);
+ m_type_names[i]= values[i].str;
+ m_type_lengths[i]= (uint) values[i].length;
+ }
+ m_type_names[sz]= NullS; // End marker
+ m_type_lengths[sz]= 0; // End marker
+ }
+ TypelibBuffer(const LEX_CSTRING *values)
+ :TypelibBuffer(sz, values)
+ { }
+};
+
+
class Native: public Binary_string
{
public:
@@ -2622,9 +2707,7 @@ public:
{ }
void set(const DTCollation &dt)
{
- collation= dt.collation;
- derivation= dt.derivation;
- repertoire= dt.repertoire;
+ *this= dt;
}
void set(CHARSET_INFO *collation_arg, Derivation derivation_arg)
{
@@ -2640,12 +2723,6 @@ public:
derivation= derivation_arg;
repertoire= repertoire_arg;
}
- void set_numeric()
- {
- collation= &my_charset_numeric;
- derivation= DERIVATION_NUMERIC;
- repertoire= MY_REPERTOIRE_NUMERIC;
- }
void set(CHARSET_INFO *collation_arg)
{
collation= collation_arg;
@@ -2679,6 +2756,17 @@ public:
};
+class DTCollation_numeric: public DTCollation
+{
+public:
+ DTCollation_numeric()
+ :DTCollation(charset_info(), DERIVATION_NUMERIC, MY_REPERTOIRE_NUMERIC)
+ { }
+ static const CHARSET_INFO *charset_info() { return &my_charset_numeric; }
+ static const DTCollation & singleton();
+};
+
+
static inline uint32
char_to_byte_length_safe(size_t char_length_arg, uint32 mbmaxlen_arg)
{
@@ -2686,38 +2774,87 @@ char_to_byte_length_safe(size_t char_length_arg, uint32 mbmaxlen_arg)
return tmp > UINT_MAX32 ? (uint32) UINT_MAX32 : static_cast<uint32>(tmp);
}
-/**
- A class to store type attributes for the standard data types.
- Does not include attributes for the extended data types
- such as ENUM, SET, GEOMETRY.
-*/
-class Type_std_attributes
+
+class Type_numeric_attributes
{
public:
- DTCollation collation;
- uint decimals;
+ static uint count_unsigned(Item **item, uint nitems);
+ static uint32 find_max_char_length(Item **item, uint nitems);
+ static uint32 find_max_octet_length(Item **item, uint nitems);
+ static int find_max_decimal_int_part(Item **item, uint nitems);
+ static uint find_max_decimals(Item **item, uint nitems);
+public:
/*
The maximum value length in characters multiplied by collation->mbmaxlen.
Almost always it's the maximum value length in bytes.
*/
uint32 max_length;
+ uint decimals;
bool unsigned_flag;
- Type_std_attributes()
- :collation(&my_charset_bin, DERIVATION_COERCIBLE),
- decimals(0), max_length(0), unsigned_flag(false)
+public:
+ Type_numeric_attributes()
+ :max_length(0), decimals(0), unsigned_flag(false)
+ { }
+ Type_numeric_attributes(uint32 max_length_arg, uint decimals_arg,
+ bool unsigned_flag_arg)
+ :max_length(max_length_arg),
+ decimals(decimals_arg),
+ unsigned_flag(unsigned_flag_arg)
{ }
- Type_std_attributes(const Type_std_attributes *other)
- :collation(other->collation),
- decimals(other->decimals),
- max_length(other->max_length),
- unsigned_flag(other->unsigned_flag)
+protected:
+ void aggregate_numeric_attributes_real(Item **item, uint nitems);
+ void aggregate_numeric_attributes_decimal(Item **item, uint nitems,
+ bool unsigned_arg);
+};
+
+
+
+class Type_temporal_attributes: public Type_numeric_attributes
+{
+public:
+ Type_temporal_attributes(uint int_part_length, uint dec, bool unsigned_arg)
+ :Type_numeric_attributes(int_part_length + (dec ? 1 : 0),
+ MY_MIN(dec, TIME_SECOND_PART_DIGITS),
+ unsigned_arg)
+ {
+ max_length+= decimals;
+ }
+};
+
+
+class Type_temporal_attributes_not_fixed_dec: public Type_numeric_attributes
+{
+public:
+ Type_temporal_attributes_not_fixed_dec(uint32 int_part_length, uint dec,
+ bool unsigned_flag)
+ :Type_numeric_attributes(int_part_length, dec, unsigned_flag)
+ {
+ if (decimals == NOT_FIXED_DEC)
+ max_length+= TIME_SECOND_PART_DIGITS + 1;
+ else if (decimals)
+ {
+ set_if_smaller(decimals, TIME_SECOND_PART_DIGITS);
+ max_length+= decimals + 1;
+ }
+ }
+};
+
+
+/**
+ A class to store type attributes for the standard data types.
+ Does not include attributes for the extended data types
+ such as ENUM, SET, GEOMETRY.
+*/
+class Type_std_attributes: public Type_numeric_attributes
+{
+public:
+ DTCollation collation;
+ Type_std_attributes()
+ :collation(&my_charset_bin, DERIVATION_COERCIBLE)
{ }
- Type_std_attributes(uint32 max_length_arg, uint decimals_arg,
- bool unsigned_flag_arg, const DTCollation &dtc)
- :collation(dtc),
- decimals(decimals_arg),
- max_length(max_length_arg),
- unsigned_flag(unsigned_flag_arg)
+ Type_std_attributes(const Type_numeric_attributes &nattr,
+ const DTCollation &dtc)
+ :Type_numeric_attributes(nattr), collation(dtc)
{ }
void set(const Type_std_attributes *other)
{
@@ -2727,6 +2864,10 @@ public:
{
*this= other;
}
+ void set(const Type_numeric_attributes &nattr, const DTCollation &dtc)
+ {
+ *this= Type_std_attributes(nattr, dtc);
+ }
uint32 max_char_length() const
{ return max_length / collation.collation->mbmaxlen; }
void fix_length_and_charset(uint32 max_char_length_arg, CHARSET_INFO *cs)
@@ -2739,41 +2880,11 @@ public:
max_length= char_to_byte_length_safe(max_char_length_arg,
collation.collation->mbmaxlen);
}
- void fix_char_length_temporal_not_fixed_dec(uint int_part_length, uint dec)
- {
- uint char_length= int_part_length;
- if ((decimals= dec))
- {
- if (decimals == NOT_FIXED_DEC)
- char_length+= TIME_SECOND_PART_DIGITS + 1;
- else
- {
- set_if_smaller(decimals, TIME_SECOND_PART_DIGITS);
- char_length+= decimals + 1;
- }
- }
- fix_char_length(char_length);
- }
- void fix_attributes_temporal_not_fixed_dec(uint int_part_length, uint dec)
- {
- collation.set_numeric();
- unsigned_flag= 0;
- fix_char_length_temporal_not_fixed_dec(int_part_length, dec);
- }
- void fix_attributes_time_not_fixed_dec(uint dec)
- {
- fix_attributes_temporal_not_fixed_dec(MIN_TIME_WIDTH, dec);
- }
- void fix_attributes_datetime_not_fixed_dec(uint dec)
+ void fix_attributes_temporal(uint32 int_part_length, uint dec)
{
- fix_attributes_temporal_not_fixed_dec(MAX_DATETIME_WIDTH, dec);
- }
- void fix_attributes_temporal(uint int_part_length, uint dec)
- {
- collation.set_numeric();
- unsigned_flag= 0;
- decimals= MY_MIN(dec, TIME_SECOND_PART_DIGITS);
- max_length= decimals + int_part_length + (dec ? 1 : 0);
+ *this= Type_std_attributes(
+ Type_temporal_attributes(int_part_length, dec, false),
+ DTCollation_numeric());
}
void fix_attributes_date()
{
@@ -2788,38 +2899,31 @@ public:
fix_attributes_temporal(MAX_DATETIME_WIDTH, dec);
}
- void count_only_length(Item **item, uint nitems);
- void count_octet_length(Item **item, uint nitems);
- void count_real_length(Item **item, uint nitems);
- void count_decimal_length(Item **item, uint nitems);
- bool count_string_length(const char *func_name, Item **item, uint nitems);
- uint count_max_decimals(Item **item, uint nitems);
-
void aggregate_attributes_int(Item **items, uint nitems)
{
- collation.set_numeric();
- count_only_length(items, nitems);
+ collation= DTCollation_numeric();
+ fix_char_length(find_max_char_length(items, nitems));
+ unsigned_flag= count_unsigned(items, nitems) > 0;
decimals= 0;
}
void aggregate_attributes_real(Item **items, uint nitems)
{
- collation.set_numeric();
- count_real_length(items, nitems);
+ collation= DTCollation_numeric();
+ aggregate_numeric_attributes_real(items, nitems);
}
- void aggregate_attributes_decimal(Item **items, uint nitems)
+ void aggregate_attributes_decimal(Item **items, uint nitems,
+ bool unsigned_arg)
{
- collation.set_numeric();
- count_decimal_length(items, nitems);
+ collation= DTCollation_numeric();
+ aggregate_numeric_attributes_decimal(items, nitems,
+ (unsigned_flag= unsigned_arg));
}
bool aggregate_attributes_string(const char *func_name,
- Item **item, uint nitems)
- {
- return count_string_length(func_name, item, nitems);
- }
+ Item **item, uint nitems);
void aggregate_attributes_temporal(uint int_part_length,
Item **item, uint nitems)
{
- fix_attributes_temporal(int_part_length, count_max_decimals(item, nitems));
+ fix_attributes_temporal(int_part_length, find_max_decimals(item, nitems));
}
bool agg_item_collations(DTCollation &c, const char *name,
@@ -2923,23 +3027,15 @@ public:
Type_all_attributes()
:Type_std_attributes()
{ }
- Type_all_attributes(const Type_all_attributes *other)
+ Type_all_attributes(const Type_all_attributes &other)
:Type_std_attributes(other)
{ }
virtual ~Type_all_attributes() {}
virtual void set_maybe_null(bool maybe_null_arg)= 0;
// Returns total number of decimal digits
virtual uint decimal_precision() const= 0;
- /*
- Field::geometry_type is not visible here.
- Let's use an "uint" wrapper for now. Later when we move Field_geom
- into a plugin, this method will be replaced to some generic
- datatype indepented method.
- */
- virtual uint uint_geometry_type() const= 0;
- virtual void set_geometry_type(uint type)= 0;
- virtual TYPELIB *get_typelib() const= 0;
- virtual void set_typelib(TYPELIB *typelib)= 0;
+ virtual const TYPELIB *get_typelib() const= 0;
+ virtual void set_typelib(const TYPELIB *typelib)= 0;
};
@@ -3000,6 +3096,13 @@ public:
}
const char *ptr() const { return LEX_CSTRING::str; }
uint length() const { return (uint) LEX_CSTRING::length; }
+ const LEX_CSTRING &lex_cstring() const { return *this; }
+ bool eq(const LEX_CSTRING &other) const
+ {
+ return !my_strnncoll(system_charset_info,
+ (const uchar *) LEX_CSTRING::str, LEX_CSTRING::length,
+ (const uchar *) other.str, other.length);
+ }
};
@@ -3135,12 +3238,64 @@ public:
};
+enum vers_kind_t
+{
+ VERS_UNDEFINED= 0,
+ VERS_TIMESTAMP,
+ VERS_TRX_ID
+};
+
+
+class Vers_type_handler
+{
+protected:
+ Vers_type_handler() {}
+public:
+ virtual ~Vers_type_handler() {}
+ virtual vers_kind_t kind() const
+ {
+ DBUG_ASSERT(0);
+ return VERS_UNDEFINED;
+ }
+ virtual bool check_sys_fields(const LEX_CSTRING &table_name,
+ const Column_definition *row_start,
+ const Column_definition *row_end) const= 0;
+};
+
+
+class Vers_type_timestamp: public Vers_type_handler
+{
+public:
+ virtual vers_kind_t kind() const
+ {
+ return VERS_TIMESTAMP;
+ }
+ bool check_sys_fields(const LEX_CSTRING &table_name,
+ const Column_definition *row_start,
+ const Column_definition *row_end) const;
+};
+extern MYSQL_PLUGIN_IMPORT Vers_type_timestamp vers_type_timestamp;
+
+
+class Vers_type_trx: public Vers_type_handler
+{
+public:
+ virtual vers_kind_t kind() const
+ {
+ return VERS_TRX_ID;
+ }
+ bool check_sys_fields(const LEX_CSTRING &table_name,
+ const Column_definition *row_start,
+ const Column_definition *row_end) const;
+};
+extern MYSQL_PLUGIN_IMPORT Vers_type_trx vers_type_trx;
+
+
class Type_handler
{
protected:
- static const Name m_version_default;
- static const Name m_version_mysql56;
- static const Name m_version_mariadb53;
+ const Name version_mysql56() const;
+ const Name version_mariadb53() const;
String *print_item_value_csstr(THD *thd, Item *item, String *str) const;
String *print_item_value_temporal(THD *thd, Item *item, String *str,
const Name &type_name, String *buf) const;
@@ -3174,11 +3329,15 @@ protected:
enum_field_types type)
const;
public:
+ static const Type_handler *handler_by_name(THD *thd, const LEX_CSTRING &name);
+ static const Type_handler *handler_by_name_or_error(THD *thd,
+ const LEX_CSTRING &name);
static const Type_handler *odbc_literal_type_handler(const LEX_CSTRING *str);
static const Type_handler *blob_type_handler(uint max_octet_length);
static const Type_handler *string_type_handler(uint max_octet_length);
static const Type_handler *bit_and_int_mixture_handler(uint max_char_len);
- static const Type_handler *type_handler_long_or_longlong(uint max_char_len);
+ static const Type_handler *type_handler_long_or_longlong(uint max_char_len,
+ bool unsigned_flag);
/**
Return a string type handler for Item
If too_big_for_varchar() returns a BLOB variant, according to length.
@@ -3191,24 +3350,20 @@ public:
static const Type_handler *get_handler_by_field_type(enum_field_types type);
static const Type_handler *get_handler_by_real_type(enum_field_types type);
static const Type_handler *get_handler_by_cmp_type(Item_result type);
- static const Type_handler *get_handler_by_result_type(Item_result type)
- {
- /*
- As result_type() returns STRING_RESULT for temporal Items,
- type should never be equal to TIME_RESULT here.
- */
- DBUG_ASSERT(type != TIME_RESULT);
- return get_handler_by_cmp_type(type);
- }
+ static const Type_collection *
+ type_collection_for_aggregation(const Type_handler *h1,
+ const Type_handler *h2);
+ virtual const Type_collection *type_collection() const;
static const
Type_handler *aggregate_for_result_traditional(const Type_handler *h1,
const Type_handler *h2);
- static const
- Type_handler *aggregate_for_num_op_traditional(const Type_handler *h1,
- const Type_handler *h2);
virtual const Name name() const= 0;
- virtual const Name version() const { return m_version_default; }
+ virtual const Name version() const;
+ virtual const Name &default_value() const= 0;
+ virtual uint32 flags() const { return 0; }
+ virtual ulong KEY_pack_flags(uint column_nr) const { return 0; }
+ bool is_unsigned() const { return flags() & UNSIGNED_FLAG; }
virtual enum_field_types field_type() const= 0;
virtual enum_field_types real_field_type() const { return field_type(); }
/**
@@ -3230,7 +3385,7 @@ public:
*/
virtual enum_field_types traditional_merge_field_type() const
{
- DBUG_ASSERT(is_traditional_type());
+ DBUG_ASSERT(is_traditional_scalar_type());
return field_type();
}
virtual enum_field_types type_code_for_protocol() const
@@ -3240,6 +3395,8 @@ public:
virtual protocol_send_type_t protocol_send_type() const= 0;
virtual Item_result result_type() const= 0;
virtual Item_result cmp_type() const= 0;
+ virtual enum_dynamic_column_type
+ dyncol_type(const Type_all_attributes *attr) const= 0;
virtual enum_mysql_timestamp_type mysql_timestamp_type() const
{
return MYSQL_TIMESTAMP_ERROR;
@@ -3254,6 +3411,16 @@ public:
{
return false;
}
+ /*
+ If operations such as:
+ UPDATE t1 SET binary_string_field=this_type_field;
+ should store this_type_field->val_native() rather than
+ this_type_field->val_str().
+ */
+ virtual bool convert_to_binary_using_val_native() const
+ {
+ return false;
+ }
virtual bool is_timestamp_type() const
{
return false;
@@ -3320,7 +3487,11 @@ public:
{
return this;
}
- virtual const Type_handler *type_handler_for_system_time() const
+ virtual const Type_handler *type_handler_unsigned() const
+ {
+ return this;
+ }
+ virtual const Type_handler *type_handler_signed() const
{
return this;
}
@@ -3337,13 +3508,10 @@ public:
}
virtual ~Type_handler() {}
/**
- Determines MariaDB traditional data types that always present
+ Determines MariaDB traditional scalar data types that always present
in the server.
*/
- virtual bool is_traditional_type() const
- {
- return true;
- }
+ bool is_traditional_scalar_type() const;
virtual bool is_scalar_type() const { return true; }
virtual bool can_return_int() const { return true; }
virtual bool can_return_decimal() const { return true; }
@@ -3396,9 +3564,13 @@ public:
This information is not available in the binary log, so
we assume that these fields are the same on the master and on the slave.
*/
- virtual Field *make_conversion_table_field(TABLE *TABLE,
+ virtual Field *make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table,
uint metadata,
const Field *target) const= 0;
+ virtual void show_binlog_type(const Conv_source &src, const Field &dst,
+ String *str) const;
+ virtual uint32 max_display_length_for_field(const Conv_source &src) const= 0;
/*
Performs the final data type validation for a UNION element,
after the regular "aggregation for result" was done.
@@ -3407,6 +3579,19 @@ public:
{
return false;
}
+ virtual uint Column_definition_gis_options_image(uchar *buff,
+ const Column_definition &def)
+ const
+ {
+ return 0;
+ }
+ virtual bool Column_definition_data_type_info_image(Binary_string *to,
+ const Column_definition &def)
+ const;
+ // Check if the implicit default value is Ok in the current sql_mode
+ virtual bool validate_implicit_default_value(THD *thd,
+ const Column_definition &def)
+ const;
// Automatic upgrade, e.g. for ALTER TABLE t1 FORCE
virtual void Column_definition_implicit_upgrade(Column_definition *c) const
{ }
@@ -3455,14 +3640,45 @@ public:
virtual bool Column_definition_prepare_stage2(Column_definition *c,
handler *file,
ulonglong table_flags) const= 0;
- virtual Field *make_table_field(const LEX_CSTRING *name,
+ virtual bool Key_part_spec_init_primary(Key_part_spec *part,
+ const Column_definition &def,
+ const handler *file) const;
+ virtual bool Key_part_spec_init_unique(Key_part_spec *part,
+ const Column_definition &def,
+ const handler *file,
+ bool *has_key_needed) const;
+ virtual bool Key_part_spec_init_multiple(Key_part_spec *part,
+ const Column_definition &def,
+ const handler *file) const;
+ virtual bool Key_part_spec_init_foreign(Key_part_spec *part,
+ const Column_definition &def,
+ const handler *file) const;
+ virtual bool Key_part_spec_init_spatial(Key_part_spec *part,
+ const Column_definition &def) const;
+ virtual bool Key_part_spec_init_ft(Key_part_spec *part,
+ const Column_definition &def) const
+ {
+ return true; // Error
+ }
+ virtual Field *make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const= 0;
- Field *make_and_init_table_field(const LEX_CSTRING *name,
+ TABLE_SHARE *share) const= 0;
+ Field *make_and_init_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
TABLE *table) const;
+ virtual Field *make_schema_field(MEM_ROOT *root,
+ TABLE *table,
+ const Record_addr &addr,
+ const ST_FIELD_INFO &def,
+ bool show_field) const
+ {
+ DBUG_ASSERT(0);
+ return NULL;
+ }
virtual Field *
make_table_field_from_def(TABLE_SHARE *share,
MEM_ROOT *mem_root,
@@ -3474,6 +3690,10 @@ public:
virtual void
Column_definition_attributes_frm_pack(const Column_definition_attributes *at,
uchar *buff) const;
+ virtual const Type_handler *type_handler_frm_unpack(const uchar *buffer) const
+ {
+ return this;
+ }
virtual bool
Column_definition_attributes_frm_unpack(Column_definition_attributes *attr,
TABLE_SHARE *share,
@@ -3489,6 +3709,7 @@ public:
virtual uint32 max_display_length(const Item *item) const= 0;
virtual uint32 calc_pack_length(uint32 length) const= 0;
+ virtual uint calc_key_length(const Column_definition &def) const;
virtual void Item_update_null_value(Item *item) const= 0;
virtual bool Item_save_in_value(THD *thd, Item *item, st_value *value) const= 0;
virtual void Item_param_setup_conversion(THD *thd, Item_param *) const {}
@@ -3571,6 +3792,10 @@ public:
Item *src,
const Item *cmp) const= 0;
virtual Item_cache *Item_get_cache(THD *thd, const Item *item) const= 0;
+ virtual Item *make_constructor_item(THD *thd, List<Item> *args) const
+ {
+ return NULL;
+ }
/**
A builder for literals with data type name prefix, e.g.:
TIME'00:00:00', DATE'2001-01-01', TIMESTAMP'2001-01-01 00:00:00'.
@@ -3600,7 +3825,6 @@ public:
virtual Item *create_typecast_item(THD *thd, Item *item,
const Type_cast_attributes &attr) const
{
- DBUG_ASSERT(0);
return NULL;
}
virtual Item_copy *create_item_copy(THD *thd, Item *item) const;
@@ -3748,8 +3972,7 @@ public:
virtual bool
Item_func_mod_fix_length_and_dec(Item_func_mod *func) const= 0;
- virtual bool
- Vers_history_point_resolve_unit(THD *thd, Vers_history_point *point) const;
+ virtual const Vers_type_handler *vers() const { return NULL; }
};
@@ -3758,67 +3981,83 @@ public:
*/
class Type_handler_row: public Type_handler
{
- static const Name m_name_row;
public:
virtual ~Type_handler_row() {}
- const Name name() const { return m_name_row; }
- bool is_scalar_type() const { return false; }
- bool can_return_int() const { return false; }
- bool can_return_decimal() const { return false; }
- bool can_return_real() const { return false; }
- bool can_return_str() const { return false; }
- bool can_return_text() const { return false; }
- bool can_return_date() const { return false; }
- bool can_return_time() const { return false; }
- enum_field_types field_type() const
+ const Name name() const override;
+ const Name &default_value() const override;
+ bool validate_implicit_default_value(THD *thd,
+ const Column_definition &def) const
+ override
+ {
+ DBUG_ASSERT(0);
+ return true;
+ }
+ const Type_collection *type_collection() const override;
+ bool is_scalar_type() const override { return false; }
+ bool can_return_int() const override { return false; }
+ bool can_return_decimal() const override { return false; }
+ bool can_return_real() const override { return false; }
+ bool can_return_str() const override { return false; }
+ bool can_return_text() const override { return false; }
+ bool can_return_date() const override { return false; }
+ bool can_return_time() const override { return false; }
+ enum_field_types field_type() const override
{
DBUG_ASSERT(0);
return MYSQL_TYPE_NULL;
};
- protocol_send_type_t protocol_send_type() const
+ protocol_send_type_t protocol_send_type() const override
{
DBUG_ASSERT(0);
return PROTOCOL_SEND_STRING;
}
- Item_result result_type() const
+ Item_result result_type() const override
{
return ROW_RESULT;
}
- Item_result cmp_type() const
+ Item_result cmp_type() const override
{
return ROW_RESULT;
}
- const Type_handler *type_handler_for_comparison() const;
- int stored_field_cmp_to_item(THD *thd, Field *field, Item *item) const
+ enum_dynamic_column_type dyncol_type(const Type_all_attributes *attr)
+ const override
+ {
+ DBUG_ASSERT(0);
+ return DYN_COL_NULL;
+ }
+ const Type_handler *type_handler_for_comparison() const override;
+ int stored_field_cmp_to_item(THD *thd, Field *field, Item *item) const override
{
DBUG_ASSERT(0);
return 0;
}
bool subquery_type_allows_materialization(const Item *inner,
- const Item *outer) const
+ const Item *outer) const override
{
DBUG_ASSERT(0);
return false;
}
- Field *make_num_distinct_aggregator_field(MEM_ROOT *, const Item *) const
+ Field *make_num_distinct_aggregator_field(MEM_ROOT *, const Item *) const override
{
DBUG_ASSERT(0);
return NULL;
}
- Field *make_conversion_table_field(TABLE *TABLE,
+ Field *make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table,
uint metadata,
- const Field *target) const
+ const Field *target) const override
{
DBUG_ASSERT(0);
return NULL;
}
- bool Column_definition_fix_attributes(Column_definition *c) const
+ bool Column_definition_fix_attributes(Column_definition *c) const override
{
return false;
}
void Column_definition_reuse_fix_attributes(THD *thd,
Column_definition *c,
- const Field *field) const
+ const Field *field)
+ const override
{
DBUG_ASSERT(0);
}
@@ -3826,26 +4065,27 @@ public:
MEM_ROOT *mem_root,
Column_definition *c,
handler *file,
- ulonglong table_flags) const;
+ ulonglong table_flags) const override;
bool Column_definition_redefine_stage1(Column_definition *def,
const Column_definition *dup,
const handler *file,
const Schema_specification_st *schema)
- const
+ const override
{
DBUG_ASSERT(0);
return true;
}
bool Column_definition_prepare_stage2(Column_definition *c,
handler *file,
- ulonglong table_flags) const
+ ulonglong table_flags) const override
{
return false;
}
- Field *make_table_field(const LEX_CSTRING *name,
+ Field *make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const
+ TABLE_SHARE *share) const override
{
DBUG_ASSERT(0);
return NULL;
@@ -3856,145 +4096,155 @@ public:
const Record_addr &addr,
const Bit_addr &bit,
const Column_definition_attributes *attr,
- uint32 flags) const;
+ uint32 flags) const override;
void make_sort_key(uchar *to, Item *item,
const SORT_FIELD_ATTR *sort_field,
- Sort_param *param) const
+ Sort_param *param) const override
{
DBUG_ASSERT(0);
}
void sortlength(THD *thd, const Type_std_attributes *item,
- SORT_FIELD_ATTR *attr) const
+ SORT_FIELD_ATTR *attr) const override
{
DBUG_ASSERT(0);
}
- uint32 max_display_length(const Item *item) const
+ uint32 max_display_length(const Item *item) const override
{
DBUG_ASSERT(0);
return 0;
}
- uint32 calc_pack_length(uint32 length) const
+ uint32 max_display_length_for_field(const Conv_source &src) const override
+ {
+ DBUG_ASSERT(0);
+ return 0;
+ }
+ uint32 calc_pack_length(uint32 length) const override
{
DBUG_ASSERT(0);
return 0;
}
bool Item_eq_value(THD *thd, const Type_cmp_attributes *attr,
- Item *a, Item *b) const;
- uint Item_decimal_precision(const Item *item) const
+ Item *a, Item *b) const override;
+ uint Item_decimal_precision(const Item *item) const override
{
DBUG_ASSERT(0);
return DECIMAL_MAX_PRECISION;
}
- bool Item_save_in_value(THD *thd, Item *item, st_value *value) const;
+ bool Item_save_in_value(THD *thd, Item *item, st_value *value) const override;
bool Item_param_set_from_value(THD *thd,
Item_param *param,
const Type_all_attributes *attr,
- const st_value *value) const;
- bool Item_send(Item *item, Protocol *protocol, st_value *buf) const
+ const st_value *value) const override;
+ bool Item_send(Item *item, Protocol *protocol, st_value *buf) const override
{
DBUG_ASSERT(0);
return true;
}
- void Item_update_null_value(Item *item) const;
- int Item_save_in_field(Item *item, Field *field, bool no_conversions) const
+ void Item_update_null_value(Item *item) const override;
+ int Item_save_in_field(Item *item, Field *field, bool no_conversions)
+ const override
{
DBUG_ASSERT(0);
return 1;
}
- String *print_item_value(THD *thd, Item *item, String *str) const;
+ String *print_item_value(THD *thd, Item *item, String *str) const override;
bool can_change_cond_ref_to_const(Item_bool_func2 *target,
Item *target_expr, Item *target_value,
Item_bool_func2 *source,
- Item *source_expr, Item *source_const) const
+ Item *source_expr, Item *source_const)
+ const override
{
DBUG_ASSERT(0);
return false;
}
- Item *make_const_item_for_comparison(THD *, Item *src, const Item *cmp) const;
- Item_cache *Item_get_cache(THD *thd, const Item *item) const;
- Item_copy *create_item_copy(THD *thd, Item *item) const
+ Item *make_const_item_for_comparison(THD *, Item *src, const Item *cmp)
+ const override;
+ Item_cache *Item_get_cache(THD *thd, const Item *item) const override;
+ Item_copy *create_item_copy(THD *thd, Item *item) const override
{
DBUG_ASSERT(0);
return NULL;
}
- bool set_comparator_func(Arg_comparator *cmp) const;
+ bool set_comparator_func(Arg_comparator *cmp) const override;
bool Item_hybrid_func_fix_attributes(THD *thd,
const char *name,
Type_handler_hybrid_field_type *,
Type_all_attributes *atrr,
- Item **items, uint nitems) const
+ Item **items, uint nitems)
+ const override
{
DBUG_ASSERT(0);
return true;
}
- bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *func) const
+ bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *func) const override
{
DBUG_ASSERT(0);
return true;
}
- bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const
+ bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const override
{
DBUG_ASSERT(0);
return true;
}
- bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const
+ bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const override
{
DBUG_ASSERT(0);
return true;
}
- bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *) const
+ bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *) const override
{
DBUG_ASSERT(0);
return true;
}
- bool Item_val_bool(Item *item) const
+ bool Item_val_bool(Item *item) const override
{
DBUG_ASSERT(0);
return false;
}
void Item_get_date(THD *thd, Item *item,
Temporal::Warn *warn, MYSQL_TIME *ltime,
- date_mode_t fuzzydate) const
+ date_mode_t fuzzydate) const override
{
DBUG_ASSERT(0);
set_zero_time(ltime, MYSQL_TIMESTAMP_NONE);
}
- longlong Item_val_int_signed_typecast(Item *item) const
+ longlong Item_val_int_signed_typecast(Item *item) const override
{
DBUG_ASSERT(0);
return 0;
}
- longlong Item_val_int_unsigned_typecast(Item *item) const
+ longlong Item_val_int_unsigned_typecast(Item *item) const override
{
DBUG_ASSERT(0);
return 0;
}
- String *Item_func_hex_val_str_ascii(Item_func_hex *item, String *str) const
+ String *Item_func_hex_val_str_ascii(Item_func_hex *item, String *str)
+ const override
{
DBUG_ASSERT(0);
return NULL;
}
String *Item_func_hybrid_field_type_val_str(Item_func_hybrid_field_type *,
- String *) const
+ String *) const override
{
DBUG_ASSERT(0);
return NULL;
}
double Item_func_hybrid_field_type_val_real(Item_func_hybrid_field_type *)
- const
+ const override
{
DBUG_ASSERT(0);
return 0.0;
}
longlong Item_func_hybrid_field_type_val_int(Item_func_hybrid_field_type *)
- const
+ const override
{
DBUG_ASSERT(0);
return 0;
}
my_decimal *Item_func_hybrid_field_type_val_decimal(
Item_func_hybrid_field_type *,
- my_decimal *) const
+ my_decimal *) const override
{
DBUG_ASSERT(0);
return NULL;
@@ -4003,105 +4253,116 @@ public:
Item_func_hybrid_field_type *,
Temporal::Warn *,
MYSQL_TIME *ltime,
- date_mode_t fuzzydate) const
+ date_mode_t fuzzydate)
+ const override
{
DBUG_ASSERT(0);
set_zero_time(ltime, MYSQL_TIMESTAMP_NONE);
}
- String *Item_func_min_max_val_str(Item_func_min_max *, String *) const
+ String *Item_func_min_max_val_str(Item_func_min_max *, String *) const override
{
DBUG_ASSERT(0);
return NULL;
}
- double Item_func_min_max_val_real(Item_func_min_max *) const
+ double Item_func_min_max_val_real(Item_func_min_max *) const override
{
DBUG_ASSERT(0);
return 0;
}
- longlong Item_func_min_max_val_int(Item_func_min_max *) const
+ longlong Item_func_min_max_val_int(Item_func_min_max *) const override
{
DBUG_ASSERT(0);
return 0;
}
my_decimal *Item_func_min_max_val_decimal(Item_func_min_max *,
- my_decimal *) const
+ my_decimal *) const override
{
DBUG_ASSERT(0);
return NULL;
}
bool Item_func_min_max_get_date(THD *thd, Item_func_min_max*,
- MYSQL_TIME *, date_mode_t fuzzydate) const
+ MYSQL_TIME *, date_mode_t fuzzydate)
+ const override
{
DBUG_ASSERT(0);
return true;
}
- bool Item_func_between_fix_length_and_dec(Item_func_between *func) const
+ bool Item_func_between_fix_length_and_dec(Item_func_between *func)
+ const override
{
DBUG_ASSERT(0);
return true;
}
- longlong Item_func_between_val_int(Item_func_between *func) const;
- cmp_item *make_cmp_item(THD *thd, CHARSET_INFO *cs) const;
- in_vector *make_in_vector(THD *thd, const Item_func_in *f, uint nargs) const;
- bool Item_func_in_fix_comparator_compatible_types(THD *thd,
- Item_func_in *) const;
- bool Item_func_round_fix_length_and_dec(Item_func_round *) const;
- bool Item_func_int_val_fix_length_and_dec(Item_func_int_val *) const;
- bool Item_func_abs_fix_length_and_dec(Item_func_abs *) const;
- bool Item_func_neg_fix_length_and_dec(Item_func_neg *) const;
+ longlong Item_func_between_val_int(Item_func_between *func) const override;
+ cmp_item *make_cmp_item(THD *thd, CHARSET_INFO *cs) const override;
+ in_vector *make_in_vector(THD *thd, const Item_func_in *f, uint nargs)
+ const override;
+ bool Item_func_in_fix_comparator_compatible_types(THD *thd, Item_func_in *)
+ const override;
+ bool Item_func_round_fix_length_and_dec(Item_func_round *) const override;
+ bool Item_func_int_val_fix_length_and_dec(Item_func_int_val *) const override;
+ bool Item_func_abs_fix_length_and_dec(Item_func_abs *) const override;
+ bool Item_func_neg_fix_length_and_dec(Item_func_neg *) const override;
- bool Item_func_signed_fix_length_and_dec(Item_func_signed *) const
+ bool Item_func_signed_fix_length_and_dec(Item_func_signed *) const override
{
DBUG_ASSERT(0);
return true;
}
- bool Item_func_unsigned_fix_length_and_dec(Item_func_unsigned *) const
+ bool Item_func_unsigned_fix_length_and_dec(Item_func_unsigned *) const override
{
DBUG_ASSERT(0);
return true;
}
- bool Item_double_typecast_fix_length_and_dec(Item_double_typecast *) const
+ bool Item_double_typecast_fix_length_and_dec(Item_double_typecast *)
+ const override
{
DBUG_ASSERT(0);
return true;
}
- bool Item_float_typecast_fix_length_and_dec(Item_float_typecast *) const
+ bool Item_float_typecast_fix_length_and_dec(Item_float_typecast *)
+ const override
{
DBUG_ASSERT(0);
return true;
}
- bool Item_decimal_typecast_fix_length_and_dec(Item_decimal_typecast *) const
+ bool Item_decimal_typecast_fix_length_and_dec(Item_decimal_typecast *)
+ const override
{
DBUG_ASSERT(0);
return true;
}
- bool Item_char_typecast_fix_length_and_dec(Item_char_typecast *) const
+ bool Item_char_typecast_fix_length_and_dec(Item_char_typecast *)
+ const override
{
DBUG_ASSERT(0);
return true;
}
- bool Item_time_typecast_fix_length_and_dec(Item_time_typecast *) const
+ bool Item_time_typecast_fix_length_and_dec(Item_time_typecast *)
+ const override
{
DBUG_ASSERT(0);
return true;
}
- bool Item_date_typecast_fix_length_and_dec(Item_date_typecast *) const
+ bool Item_date_typecast_fix_length_and_dec(Item_date_typecast *)
+ const override
{
DBUG_ASSERT(0);
return true;
}
- bool Item_datetime_typecast_fix_length_and_dec(Item_datetime_typecast *) const
+ bool Item_datetime_typecast_fix_length_and_dec(Item_datetime_typecast *)
+ const override
{
DBUG_ASSERT(0);
return true;
}
- bool Item_func_plus_fix_length_and_dec(Item_func_plus *) const;
- bool Item_func_minus_fix_length_and_dec(Item_func_minus *) const;
- bool Item_func_mul_fix_length_and_dec(Item_func_mul *) const;
- bool Item_func_div_fix_length_and_dec(Item_func_div *) const;
- bool Item_func_mod_fix_length_and_dec(Item_func_mod *) const;
+ bool Item_func_plus_fix_length_and_dec(Item_func_plus *) const override;
+ bool Item_func_minus_fix_length_and_dec(Item_func_minus *) const override;
+ bool Item_func_mul_fix_length_and_dec(Item_func_mul *) const override;
+ bool Item_func_div_fix_length_and_dec(Item_func_div *) const override;
+ bool Item_func_mod_fix_length_and_dec(Item_func_mod *) const override;
};
@@ -4111,20 +4372,23 @@ public:
class Type_handler_numeric: public Type_handler
{
public:
- String *print_item_value(THD *thd, Item *item, String *str) const;
- double Item_func_min_max_val_real(Item_func_min_max *) const;
- longlong Item_func_min_max_val_int(Item_func_min_max *) const;
+ const Name &default_value() const override;
+ String *print_item_value(THD *thd, Item *item, String *str) const override;
+ double Item_func_min_max_val_real(Item_func_min_max *) const override;
+ longlong Item_func_min_max_val_int(Item_func_min_max *) const override;
my_decimal *Item_func_min_max_val_decimal(Item_func_min_max *,
- my_decimal *) const;
+ my_decimal *) const override;
bool Item_func_min_max_get_date(THD *thd, Item_func_min_max*,
- MYSQL_TIME *, date_mode_t fuzzydate) const;
+ MYSQL_TIME *, date_mode_t fuzzydate)
+ const override;
virtual ~Type_handler_numeric() { }
bool can_change_cond_ref_to_const(Item_bool_func2 *target,
Item *target_expr, Item *target_value,
Item_bool_func2 *source,
- Item *source_expr, Item *source_const) const;
- bool Item_func_between_fix_length_and_dec(Item_func_between *func) const;
- bool Item_char_typecast_fix_length_and_dec(Item_char_typecast *) const;
+ Item *source_expr, Item *source_const)
+ const override;
+ bool Item_func_between_fix_length_and_dec(Item_func_between *func) const override;
+ bool Item_char_typecast_fix_length_and_dec(Item_char_typecast *) const override;
};
@@ -4133,186 +4397,244 @@ public:
class Type_handler_real_result: public Type_handler_numeric
{
public:
- Item_result result_type() const { return REAL_RESULT; }
- Item_result cmp_type() const { return REAL_RESULT; }
+ Item_result result_type() const override{ return REAL_RESULT; }
+ Item_result cmp_type() const override { return REAL_RESULT; }
+ enum_dynamic_column_type dyncol_type(const Type_all_attributes *attr)
+ const override
+ {
+ return DYN_COL_DOUBLE;
+ }
virtual ~Type_handler_real_result() {}
- const Type_handler *type_handler_for_comparison() const;
+ const Type_handler *type_handler_for_comparison() const override;
+ Field *make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
+ const Record_addr &addr,
+ const Type_all_attributes &attr,
+ TABLE_SHARE *share) const override;
void Column_definition_reuse_fix_attributes(THD *thd,
Column_definition *c,
- const Field *field) const;
- int stored_field_cmp_to_item(THD *thd, Field *field, Item *item) const;
+ const Field *field)
+ const override;
+ void
+ Column_definition_attributes_frm_pack(const Column_definition_attributes *at,
+ uchar *buff) const override;
+ bool
+ Column_definition_attributes_frm_unpack(Column_definition_attributes *attr,
+ TABLE_SHARE *share,
+ const uchar *buffer,
+ LEX_CUSTRING *gis_options)
+ const override;
+ int stored_field_cmp_to_item(THD *thd, Field *field, Item *item)
+ const override;
bool subquery_type_allows_materialization(const Item *inner,
- const Item *outer) const;
+ const Item *outer)
+ const override;
void make_sort_key(uchar *to, Item *item, const SORT_FIELD_ATTR *sort_field,
- Sort_param *param) const;
+ Sort_param *param) const override;
void sortlength(THD *thd,
const Type_std_attributes *item,
- SORT_FIELD_ATTR *attr) const;
+ SORT_FIELD_ATTR *attr) const override;
bool Item_const_eq(const Item_const *a, const Item_const *b,
- bool binary_cmp) const;
+ bool binary_cmp) const override;
bool Item_eq_value(THD *thd, const Type_cmp_attributes *attr,
- Item *a, Item *b) const;
- uint Item_decimal_precision(const Item *item) const;
- bool Item_save_in_value(THD *thd, Item *item, st_value *value) const;
+ Item *a, Item *b) const override;
+ uint Item_decimal_precision(const Item *item) const override;
+ bool Item_save_in_value(THD *thd, Item *item, st_value *value) const override;
bool Item_param_set_from_value(THD *thd,
Item_param *param,
const Type_all_attributes *attr,
- const st_value *value) const;
- void Item_update_null_value(Item *item) const;
- int Item_save_in_field(Item *item, Field *field, bool no_conversions) const;
- Item *make_const_item_for_comparison(THD *, Item *src, const Item *cmp) const;
- bool set_comparator_func(Arg_comparator *cmp) const;
+ const st_value *value) const override;
+ void Item_update_null_value(Item *item) const override;
+ int Item_save_in_field(Item *item, Field *field, bool no_conversions)
+ const override;
+ Item *make_const_item_for_comparison(THD *, Item *src, const Item *cmp)
+ const override;
+ bool set_comparator_func(Arg_comparator *cmp) const override;
bool Item_hybrid_func_fix_attributes(THD *thd,
const char *name,
Type_handler_hybrid_field_type *,
Type_all_attributes *atrr,
- Item **items, uint nitems) const;
+ Item **items, uint nitems)
+ const override;
bool Item_func_min_max_fix_attributes(THD *thd, Item_func_min_max *func,
- Item **items, uint nitems) const;
- bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *func) const;
- bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const;
- bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const;
- bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *) const;
- bool Item_func_signed_fix_length_and_dec(Item_func_signed *item) const;
- bool Item_func_unsigned_fix_length_and_dec(Item_func_unsigned *item) const;
- bool Item_val_bool(Item *item) const;
+ Item **items, uint nitems)
+ const override;
+ bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *func) const override;
+ bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const override;
+ bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const override;
+ bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *) const override;
+ bool Item_func_signed_fix_length_and_dec(Item_func_signed *item)
+ const override;
+ bool Item_func_unsigned_fix_length_and_dec(Item_func_unsigned *item)
+ const override;
+ bool Item_val_bool(Item *item) const override;
void Item_get_date(THD *thd, Item *item, Temporal::Warn *warn,
- MYSQL_TIME *ltime, date_mode_t fuzzydate) const;
- longlong Item_val_int_signed_typecast(Item *item) const;
- longlong Item_val_int_unsigned_typecast(Item *item) const;
- String *Item_func_hex_val_str_ascii(Item_func_hex *item, String *str) const;
+ MYSQL_TIME *ltime, date_mode_t fuzzydate) const override;
+ longlong Item_val_int_signed_typecast(Item *item) const override;
+ longlong Item_val_int_unsigned_typecast(Item *item) const override;
+ String *Item_func_hex_val_str_ascii(Item_func_hex *item, String *str)
+ const override;
double Item_func_hybrid_field_type_val_real(Item_func_hybrid_field_type *)
- const;
+ const override;
longlong Item_func_hybrid_field_type_val_int(Item_func_hybrid_field_type *)
- const;
+ const override;
my_decimal *Item_func_hybrid_field_type_val_decimal(
Item_func_hybrid_field_type *,
- my_decimal *) const;
+ my_decimal *) const override;
void Item_func_hybrid_field_type_get_date(THD *,
Item_func_hybrid_field_type *,
Temporal::Warn *,
MYSQL_TIME *,
- date_mode_t fuzzydate) const;
- longlong Item_func_between_val_int(Item_func_between *func) const;
- cmp_item *make_cmp_item(THD *thd, CHARSET_INFO *cs) const;
- in_vector *make_in_vector(THD *, const Item_func_in *, uint nargs) const;
- bool Item_func_in_fix_comparator_compatible_types(THD *thd,
- Item_func_in *) const;
-
- bool Item_func_round_fix_length_and_dec(Item_func_round *) const;
- bool Item_func_int_val_fix_length_and_dec(Item_func_int_val *) const;
- bool Item_func_abs_fix_length_and_dec(Item_func_abs *) const;
- bool Item_func_neg_fix_length_and_dec(Item_func_neg *) const;
- bool Item_func_plus_fix_length_and_dec(Item_func_plus *) const;
- bool Item_func_minus_fix_length_and_dec(Item_func_minus *) const;
- bool Item_func_mul_fix_length_and_dec(Item_func_mul *) const;
- bool Item_func_div_fix_length_and_dec(Item_func_div *) const;
- bool Item_func_mod_fix_length_and_dec(Item_func_mod *) const;
+ date_mode_t fuzzydate)
+ const override;
+ longlong Item_func_between_val_int(Item_func_between *func) const override;
+ cmp_item *make_cmp_item(THD *thd, CHARSET_INFO *cs) const override;
+ in_vector *make_in_vector(THD *, const Item_func_in *, uint nargs)
+ const override;
+ bool Item_func_in_fix_comparator_compatible_types(THD *thd, Item_func_in *)
+ const override;
+
+ bool Item_func_round_fix_length_and_dec(Item_func_round *) const override;
+ bool Item_func_int_val_fix_length_and_dec(Item_func_int_val *) const override;
+ bool Item_func_abs_fix_length_and_dec(Item_func_abs *) const override;
+ bool Item_func_neg_fix_length_and_dec(Item_func_neg *) const override;
+ bool Item_func_plus_fix_length_and_dec(Item_func_plus *) const override;
+ bool Item_func_minus_fix_length_and_dec(Item_func_minus *) const override;
+ bool Item_func_mul_fix_length_and_dec(Item_func_mul *) const override;
+ bool Item_func_div_fix_length_and_dec(Item_func_div *) const override;
+ bool Item_func_mod_fix_length_and_dec(Item_func_mod *) const override;
};
class Type_handler_decimal_result: public Type_handler_numeric
{
public:
- protocol_send_type_t protocol_send_type() const
+ protocol_send_type_t protocol_send_type() const override
{
return PROTOCOL_SEND_STRING;
}
- Item_result result_type() const { return DECIMAL_RESULT; }
- Item_result cmp_type() const { return DECIMAL_RESULT; }
+ Item_result result_type() const override { return DECIMAL_RESULT; }
+ Item_result cmp_type() const override { return DECIMAL_RESULT; }
+ enum_dynamic_column_type dyncol_type(const Type_all_attributes *) const
+ override
+ {
+ return DYN_COL_DECIMAL;
+ }
virtual ~Type_handler_decimal_result() {};
- const Type_handler *type_handler_for_comparison() const;
- int stored_field_cmp_to_item(THD *thd, Field *field, Item *item) const
+ const Type_handler *type_handler_for_comparison() const override;
+ int stored_field_cmp_to_item(THD *, Field *field, Item *item) const override
{
VDec item_val(item);
return item_val.is_null() ? 0 : my_decimal(field).cmp(item_val.ptr());
}
bool subquery_type_allows_materialization(const Item *inner,
- const Item *outer) const;
- Field *make_num_distinct_aggregator_field(MEM_ROOT *, const Item *) const;
+ const Item *outer) const override;
+ Field *make_schema_field(MEM_ROOT *root,
+ TABLE *table,
+ const Record_addr &addr,
+ const ST_FIELD_INFO &def,
+ bool show_field) const override;
+ Field *make_num_distinct_aggregator_field(MEM_ROOT *, const Item *)
+ const override;
void make_sort_key(uchar *to, Item *item, const SORT_FIELD_ATTR *sort_field,
- Sort_param *param) const;
+ Sort_param *param) const override;
+ void
+ Column_definition_attributes_frm_pack(const Column_definition_attributes *at,
+ uchar *buff) const override;
+ bool
+ Column_definition_attributes_frm_unpack(Column_definition_attributes *attr,
+ TABLE_SHARE *share,
+ const uchar *buffer,
+ LEX_CUSTRING *gis_options)
+ const override;
void sortlength(THD *thd,
const Type_std_attributes *item,
- SORT_FIELD_ATTR *attr) const;
- uint32 max_display_length(const Item *item) const;
+ SORT_FIELD_ATTR *attr) const override;
+ uint32 max_display_length(const Item *item) const override;
Item *create_typecast_item(THD *thd, Item *item,
- const Type_cast_attributes &attr) const;
+ const Type_cast_attributes &attr) const override;
bool Item_const_eq(const Item_const *a, const Item_const *b,
- bool binary_cmp) const;
+ bool binary_cmp) const override;
bool Item_eq_value(THD *thd, const Type_cmp_attributes *attr,
- Item *a, Item *b) const
+ Item *a, Item *b) const override
{
VDec va(a), vb(b);
return va.ptr() && vb.ptr() && !va.cmp(vb);
}
- uint Item_decimal_precision(const Item *item) const;
- bool Item_save_in_value(THD *thd, Item *item, st_value *value) const;
+ uint Item_decimal_precision(const Item *item) const override;
+ bool Item_save_in_value(THD *thd, Item *item, st_value *value) const override;
void Item_param_set_param_func(Item_param *param,
- uchar **pos, ulong len) const;
+ uchar **pos, ulong len) const override;
bool Item_param_set_from_value(THD *thd,
Item_param *param,
const Type_all_attributes *attr,
- const st_value *value) const;
- bool Item_send(Item *item, Protocol *protocol, st_value *buf) const
+ const st_value *value) const override;
+ bool Item_send(Item *item, Protocol *protocol, st_value *buf) const override
{
return Item_send_str(item, protocol, buf);
}
- void Item_update_null_value(Item *item) const;
- int Item_save_in_field(Item *item, Field *field, bool no_conversions) const;
- Item *make_const_item_for_comparison(THD *, Item *src, const Item *cmp) const;
- Item_cache *Item_get_cache(THD *thd, const Item *item) const;
- bool set_comparator_func(Arg_comparator *cmp) const;
+ void Item_update_null_value(Item *item) const override;
+ int Item_save_in_field(Item *item, Field *field, bool no_conversions) const
+ override;
+ Item *make_const_item_for_comparison(THD *, Item *src, const Item *cmp) const
+ override;
+ Item_cache *Item_get_cache(THD *thd, const Item *item) const override;
+ bool set_comparator_func(Arg_comparator *cmp) const override;
bool Item_hybrid_func_fix_attributes(THD *thd,
const char *name,
Type_handler_hybrid_field_type *,
Type_all_attributes *atrr,
- Item **items, uint nitems) const;
- bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *func) const;
- bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const;
- bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const;
- bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *) const;
- bool Item_val_bool(Item *item) const
+ Item **items, uint nitems)
+ const override;
+ bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *) const override;
+ bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const override;
+ bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const override;
+ bool Item_sum_variance_fix_length_and_dec(Item_sum_variance*) const override;
+ bool Item_val_bool(Item *item) const override
{
return VDec(item).to_bool();
}
void Item_get_date(THD *thd, Item *item, Temporal::Warn *warn,
- MYSQL_TIME *ltime, date_mode_t fuzzydate) const;
- longlong Item_val_int_signed_typecast(Item *item) const;
- longlong Item_val_int_unsigned_typecast(Item *item) const
+ MYSQL_TIME *ltime, date_mode_t fuzzydate) const override;
+ longlong Item_val_int_signed_typecast(Item *item) const override;
+ longlong Item_val_int_unsigned_typecast(Item *item) const override
{
return VDec(item).to_longlong(true);
}
- String *Item_func_hex_val_str_ascii(Item_func_hex *item, String *str) const;
+ String *Item_func_hex_val_str_ascii(Item_func_hex *item, String *str)
+ const override;
String *Item_func_hybrid_field_type_val_str(Item_func_hybrid_field_type *,
- String *) const;
+ String *) const override;
double Item_func_hybrid_field_type_val_real(Item_func_hybrid_field_type *)
- const;
+ const override;
longlong Item_func_hybrid_field_type_val_int(Item_func_hybrid_field_type *)
- const;
+ const override;
my_decimal *Item_func_hybrid_field_type_val_decimal(
Item_func_hybrid_field_type *,
- my_decimal *) const;
+ my_decimal *) const override;
void Item_func_hybrid_field_type_get_date(THD *,
Item_func_hybrid_field_type *,
Temporal::Warn *,
MYSQL_TIME *,
- date_mode_t fuzzydate) const;
- String *Item_func_min_max_val_str(Item_func_min_max *, String *) const;
- longlong Item_func_between_val_int(Item_func_between *func) const;
- cmp_item *make_cmp_item(THD *thd, CHARSET_INFO *cs) const;
- in_vector *make_in_vector(THD *, const Item_func_in *, uint nargs) const;
- bool Item_func_in_fix_comparator_compatible_types(THD *thd,
- Item_func_in *) const;
- bool Item_func_round_fix_length_and_dec(Item_func_round *) const;
- bool Item_func_int_val_fix_length_and_dec(Item_func_int_val *) const;
- bool Item_func_abs_fix_length_and_dec(Item_func_abs *) const;
- bool Item_func_neg_fix_length_and_dec(Item_func_neg *) const;
- bool Item_func_plus_fix_length_and_dec(Item_func_plus *) const;
- bool Item_func_minus_fix_length_and_dec(Item_func_minus *) const;
- bool Item_func_mul_fix_length_and_dec(Item_func_mul *) const;
- bool Item_func_div_fix_length_and_dec(Item_func_div *) const;
- bool Item_func_mod_fix_length_and_dec(Item_func_mod *) const;
+ date_mode_t fuzzydate)
+ const override;
+ String *Item_func_min_max_val_str(Item_func_min_max *, String *)
+ const override;
+ longlong Item_func_between_val_int(Item_func_between *func) const override;
+ cmp_item *make_cmp_item(THD *thd, CHARSET_INFO *cs) const override;
+ in_vector *make_in_vector(THD *, const Item_func_in *, uint nargs)
+ const override;
+ bool Item_func_in_fix_comparator_compatible_types(THD *thd, Item_func_in *)
+ const override;
+ bool Item_func_round_fix_length_and_dec(Item_func_round *) const override;
+ bool Item_func_int_val_fix_length_and_dec(Item_func_int_val*) const override;
+ bool Item_func_abs_fix_length_and_dec(Item_func_abs *) const override;
+ bool Item_func_neg_fix_length_and_dec(Item_func_neg *) const override;
+ bool Item_func_plus_fix_length_and_dec(Item_func_plus *) const override;
+ bool Item_func_minus_fix_length_and_dec(Item_func_minus *) const override;
+ bool Item_func_mul_fix_length_and_dec(Item_func_mul *) const override;
+ bool Item_func_div_fix_length_and_dec(Item_func_div *) const override;
+ bool Item_func_mod_fix_length_and_dec(Item_func_mod *) const override;
};
@@ -4444,92 +4766,106 @@ public:
class Type_handler_int_result: public Type_handler_numeric
{
public:
- Item_result result_type() const { return INT_RESULT; }
- Item_result cmp_type() const { return INT_RESULT; }
- bool is_order_clause_position_type() const { return true; }
- bool is_limit_clause_valid_type() const { return true; }
+ Item_result result_type() const override { return INT_RESULT; }
+ Item_result cmp_type() const override { return INT_RESULT; }
+ enum_dynamic_column_type dyncol_type(const Type_all_attributes *attr) const override
+ {
+ return attr->unsigned_flag ? DYN_COL_UINT : DYN_COL_INT;
+ }
+ bool is_order_clause_position_type() const override { return true; }
+ bool is_limit_clause_valid_type() const override { return true; }
virtual ~Type_handler_int_result() {}
- const Type_handler *type_handler_for_comparison() const;
- int stored_field_cmp_to_item(THD *thd, Field *field, Item *item) const;
+ const Type_handler *type_handler_for_comparison() const override;
+ int stored_field_cmp_to_item(THD *thd, Field *field, Item *item) const override;
bool subquery_type_allows_materialization(const Item *inner,
- const Item *outer) const;
- Field *make_num_distinct_aggregator_field(MEM_ROOT *, const Item *) const;
+ const Item *outer) const override;
+ Field *make_num_distinct_aggregator_field(MEM_ROOT *, const Item *) const override;
+ Field *make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
+ const Record_addr &addr,
+ const Type_all_attributes &attr,
+ TABLE_SHARE *share) const override;
void make_sort_key(uchar *to, Item *item, const SORT_FIELD_ATTR *sort_field,
- Sort_param *param) const;
+ Sort_param *param) const override;
+ void
+ Column_definition_attributes_frm_pack(const Column_definition_attributes *at,
+ uchar *buff) const override;
void sortlength(THD *thd,
const Type_std_attributes *item,
- SORT_FIELD_ATTR *attr) const;
+ SORT_FIELD_ATTR *attr) const override;
bool Item_const_eq(const Item_const *a, const Item_const *b,
- bool binary_cmp) const;
+ bool binary_cmp) const override;
bool Item_eq_value(THD *thd, const Type_cmp_attributes *attr,
- Item *a, Item *b) const;
- uint Item_decimal_precision(const Item *item) const;
- bool Item_save_in_value(THD *thd, Item *item, st_value *value) const;
+ Item *a, Item *b) const override;
+ uint Item_decimal_precision(const Item *item) const override;
+ bool Item_save_in_value(THD *thd, Item *item, st_value *value) const override;
bool Item_param_set_from_value(THD *thd,
Item_param *param,
const Type_all_attributes *attr,
- const st_value *value) const;
- void Item_update_null_value(Item *item) const;
- int Item_save_in_field(Item *item, Field *field, bool no_conversions) const;
- Item *make_const_item_for_comparison(THD *, Item *src, const Item *cmp) const;
- Item_cache *Item_get_cache(THD *thd, const Item *item) const;
- bool set_comparator_func(Arg_comparator *cmp) const;
+ const st_value *value) const override;
+ void Item_update_null_value(Item *item) const override;
+ int Item_save_in_field(Item *item, Field *field, bool no_conversions) const override;
+ Item *make_const_item_for_comparison(THD *, Item *src, const Item *cmp) const override;
+ Item_cache *Item_get_cache(THD *thd, const Item *item) const override;
+ bool set_comparator_func(Arg_comparator *cmp) const override;
bool Item_hybrid_func_fix_attributes(THD *thd,
const char *name,
Type_handler_hybrid_field_type *,
Type_all_attributes *atrr,
- Item **items, uint nitems) const;
- bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *func) const;
- bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const;
- bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const;
- bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *) const;
- bool Item_val_bool(Item *item) const;
+ Item **items, uint nitems) const override;
+ bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *func) const override;
+ bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const override;
+ bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const override;
+ bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *) const override;
+ bool Item_val_bool(Item *item) const override;
void Item_get_date(THD *thd, Item *item, Temporal::Warn *warn,
- MYSQL_TIME *ltime, date_mode_t fuzzydate) const;
- longlong Item_val_int_signed_typecast(Item *item) const;
- longlong Item_val_int_unsigned_typecast(Item *item) const;
- String *Item_func_hex_val_str_ascii(Item_func_hex *item, String *str) const;
+ MYSQL_TIME *ltime, date_mode_t fuzzydate) const override;
+ longlong Item_val_int_signed_typecast(Item *item) const override;
+ longlong Item_val_int_unsigned_typecast(Item *item) const override;
+ String *Item_func_hex_val_str_ascii(Item_func_hex *item, String *str) const override;
String *Item_func_hybrid_field_type_val_str(Item_func_hybrid_field_type *,
- String *) const;
+ String *) const override;
double Item_func_hybrid_field_type_val_real(Item_func_hybrid_field_type *)
- const;
+ const override;
longlong Item_func_hybrid_field_type_val_int(Item_func_hybrid_field_type *)
- const;
+ const override;
my_decimal *Item_func_hybrid_field_type_val_decimal(
Item_func_hybrid_field_type *,
- my_decimal *) const;
+ my_decimal *) const override;
void Item_func_hybrid_field_type_get_date(THD *,
Item_func_hybrid_field_type *,
Temporal::Warn *,
MYSQL_TIME *,
- date_mode_t fuzzydate) const;
- String *Item_func_min_max_val_str(Item_func_min_max *, String *) const;
- longlong Item_func_between_val_int(Item_func_between *func) const;
- cmp_item *make_cmp_item(THD *thd, CHARSET_INFO *cs) const;
- in_vector *make_in_vector(THD *, const Item_func_in *, uint nargs) const;
+ date_mode_t fuzzydate) const override;
+ String *Item_func_min_max_val_str(Item_func_min_max *, String *) const override;
+ longlong Item_func_between_val_int(Item_func_between *func) const override;
+ cmp_item *make_cmp_item(THD *thd, CHARSET_INFO *cs) const override;
+ in_vector *make_in_vector(THD *, const Item_func_in *, uint nargs) const override;
bool Item_func_in_fix_comparator_compatible_types(THD *thd,
- Item_func_in *) const;
- bool Item_func_round_fix_length_and_dec(Item_func_round *) const;
- bool Item_func_int_val_fix_length_and_dec(Item_func_int_val *) const;
- bool Item_func_abs_fix_length_and_dec(Item_func_abs *) const;
- bool Item_func_neg_fix_length_and_dec(Item_func_neg *) const;
- bool Item_func_plus_fix_length_and_dec(Item_func_plus *) const;
- bool Item_func_minus_fix_length_and_dec(Item_func_minus *) const;
- bool Item_func_mul_fix_length_and_dec(Item_func_mul *) const;
- bool Item_func_div_fix_length_and_dec(Item_func_div *) const;
- bool Item_func_mod_fix_length_and_dec(Item_func_mod *) const;
-
+ Item_func_in *) const override;
+ bool Item_func_round_fix_length_and_dec(Item_func_round *) const override;
+ bool Item_func_int_val_fix_length_and_dec(Item_func_int_val *) const override;
+ bool Item_func_abs_fix_length_and_dec(Item_func_abs *) const override;
+ bool Item_func_neg_fix_length_and_dec(Item_func_neg *) const override;
+ bool Item_func_plus_fix_length_and_dec(Item_func_plus *) const override;
+ bool Item_func_minus_fix_length_and_dec(Item_func_minus *) const override;
+ bool Item_func_mul_fix_length_and_dec(Item_func_mul *) const override;
+ bool Item_func_div_fix_length_and_dec(Item_func_div *) const override;
+ bool Item_func_mod_fix_length_and_dec(Item_func_mod *) const override;
+ const Vers_type_handler *vers() const override { return &vers_type_trx; }
};
class Type_handler_general_purpose_int: public Type_handler_int_result
{
public:
- bool type_can_have_auto_increment_attribute() const { return true; }
- virtual const Type_limits_int *
- type_limits_int_by_unsigned_flag(bool unsigned_flag) const= 0;
- uint32 max_display_length(const Item *item) const;
- bool Vers_history_point_resolve_unit(THD *thd, Vers_history_point *p) const;
+ bool type_can_have_auto_increment_attribute() const override { return true; }
+ virtual const Type_limits_int *type_limits_int() const= 0;
+ uint32 max_display_length(const Item *item) const override
+ {
+ return type_limits_int()->char_length();
+ }
+ const Vers_type_handler *vers() const override { return &vers_type_trx; }
};
@@ -4539,68 +4875,73 @@ protected:
uint Item_decimal_scale_with_seconds(const Item *item) const;
uint Item_divisor_precision_increment_with_seconds(const Item *) const;
public:
- Item_result result_type() const { return STRING_RESULT; }
- Item_result cmp_type() const { return TIME_RESULT; }
+ Item_result result_type() const override { return STRING_RESULT; }
+ Item_result cmp_type() const override { return TIME_RESULT; }
virtual ~Type_handler_temporal_result() {}
+ void
+ Column_definition_attributes_frm_pack(const Column_definition_attributes *at,
+ uchar *buff) const override;
void make_sort_key(uchar *to, Item *item, const SORT_FIELD_ATTR *sort_field,
- Sort_param *param) const;
+ Sort_param *param) const override;
void sortlength(THD *thd,
const Type_std_attributes *item,
- SORT_FIELD_ATTR *attr) const;
+ SORT_FIELD_ATTR *attr) const override;
bool Item_const_eq(const Item_const *a, const Item_const *b,
- bool binary_cmp) const;
+ bool binary_cmp) const override;
bool Item_param_set_from_value(THD *thd,
Item_param *param,
const Type_all_attributes *attr,
- const st_value *value) const;
- uint32 max_display_length(const Item *item) const;
+ const st_value *value) const override;
+ uint32 max_display_length(const Item *item) const override;
bool can_change_cond_ref_to_const(Item_bool_func2 *target,
Item *target_expr, Item *target_value,
Item_bool_func2 *source,
- Item *source_expr, Item *source_const) const;
+ Item *source_expr, Item *source_const)
+ const override;
bool subquery_type_allows_materialization(const Item *inner,
- const Item *outer) const;
+ const Item *outer) const override;
bool Item_func_min_max_fix_attributes(THD *thd, Item_func_min_max *func,
- Item **items, uint nitems) const;
- bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *func) const;
- bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const;
- bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const;
- bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *) const;
- bool Item_val_bool(Item *item) const;
+ Item **items, uint nitems)
+ const override;
+ bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *) const override;
+ bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const override;
+ bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const override;
+ bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *)const override;
+ bool Item_val_bool(Item *item) const override;
void Item_get_date(THD *thd, Item *item, Temporal::Warn *warn,
- MYSQL_TIME *ltime, date_mode_t fuzzydate) const;
- longlong Item_val_int_signed_typecast(Item *item) const;
- longlong Item_val_int_unsigned_typecast(Item *item) const;
- String *Item_func_hex_val_str_ascii(Item_func_hex *item, String *str) const;
+ MYSQL_TIME *ltime, date_mode_t fuzzydate) const override;
+ longlong Item_val_int_signed_typecast(Item *item) const override;
+ longlong Item_val_int_unsigned_typecast(Item *item) const override;
+ String *Item_func_hex_val_str_ascii(Item_func_hex *, String *)const override;
String *Item_func_hybrid_field_type_val_str(Item_func_hybrid_field_type *,
- String *) const;
+ String *) const override;
double Item_func_hybrid_field_type_val_real(Item_func_hybrid_field_type *)
- const;
+ const override;
longlong Item_func_hybrid_field_type_val_int(Item_func_hybrid_field_type *)
- const;
+ const override;
my_decimal *Item_func_hybrid_field_type_val_decimal(
Item_func_hybrid_field_type *,
- my_decimal *) const;
+ my_decimal *) const override;
void Item_func_hybrid_field_type_get_date(THD *,
Item_func_hybrid_field_type *,
Temporal::Warn *,
MYSQL_TIME *,
- date_mode_t fuzzydate) const;
+ date_mode_t) const override;
bool Item_func_min_max_get_date(THD *thd, Item_func_min_max*,
- MYSQL_TIME *, date_mode_t fuzzydate) const;
- bool Item_func_between_fix_length_and_dec(Item_func_between *func) const;
- bool Item_func_in_fix_comparator_compatible_types(THD *thd,
- Item_func_in *) const;
- bool Item_func_round_fix_length_and_dec(Item_func_round *) const;
- bool Item_func_int_val_fix_length_and_dec(Item_func_int_val *) const;
- bool Item_func_abs_fix_length_and_dec(Item_func_abs *) const;
- bool Item_func_neg_fix_length_and_dec(Item_func_neg *) const;
- bool Item_func_plus_fix_length_and_dec(Item_func_plus *) const;
- bool Item_func_minus_fix_length_and_dec(Item_func_minus *) const;
- bool Item_func_mul_fix_length_and_dec(Item_func_mul *) const;
- bool Item_func_div_fix_length_and_dec(Item_func_div *) const;
- bool Item_func_mod_fix_length_and_dec(Item_func_mod *) const;
- bool Vers_history_point_resolve_unit(THD *thd, Vers_history_point *p) const;
+ MYSQL_TIME *, date_mode_t) const override;
+ bool Item_func_between_fix_length_and_dec(Item_func_between *)const override;
+ bool Item_func_in_fix_comparator_compatible_types(THD *, Item_func_in *)
+ const override;
+ bool Item_func_round_fix_length_and_dec(Item_func_round *) const override;
+ bool Item_func_int_val_fix_length_and_dec(Item_func_int_val *)const override;
+ bool Item_func_abs_fix_length_and_dec(Item_func_abs *) const override;
+ bool Item_func_neg_fix_length_and_dec(Item_func_neg *) const override;
+ bool Item_func_plus_fix_length_and_dec(Item_func_plus *) const override;
+ bool Item_func_minus_fix_length_and_dec(Item_func_minus *) const override;
+ bool Item_func_mul_fix_length_and_dec(Item_func_mul *) const override;
+ bool Item_func_div_fix_length_and_dec(Item_func_div *) const override;
+ bool Item_func_mod_fix_length_and_dec(Item_func_mod *) const override;
+ const Vers_type_handler *vers() const override { return &vers_type_timestamp; }
};
@@ -4608,138 +4949,162 @@ class Type_handler_string_result: public Type_handler
{
uint Item_temporal_precision(THD *thd, Item *item, bool is_time) const;
public:
- protocol_send_type_t protocol_send_type() const
+ const Name &default_value() const override;
+ protocol_send_type_t protocol_send_type() const override
{
return PROTOCOL_SEND_STRING;
}
- Item_result result_type() const { return STRING_RESULT; }
- Item_result cmp_type() const { return STRING_RESULT; }
- CHARSET_INFO *charset_for_protocol(const Item *item) const;
+ Item_result result_type() const override { return STRING_RESULT; }
+ Item_result cmp_type() const override { return STRING_RESULT; }
+ enum_dynamic_column_type dyncol_type(const Type_all_attributes *) const
+ override
+ {
+ return DYN_COL_STRING;
+ }
+ CHARSET_INFO *charset_for_protocol(const Item *item) const override;
virtual ~Type_handler_string_result() {}
- const Type_handler *type_handler_for_comparison() const;
- int stored_field_cmp_to_item(THD *thd, Field *field, Item *item) const;
+ const Type_handler *type_handler_for_comparison() const override;
+ int stored_field_cmp_to_item(THD *thd, Field *field, Item *item) const
+ override;
const Type_handler *
type_handler_adjusted_to_max_octet_length(uint max_octet_length,
- CHARSET_INFO *cs) const;
+ CHARSET_INFO *cs) const override;
void make_sort_key(uchar *to, Item *item, const SORT_FIELD_ATTR *sort_field,
- Sort_param *param) const;
+ Sort_param *param) const override;
void sortlength(THD *thd,
const Type_std_attributes *item,
- SORT_FIELD_ATTR *attr) const;
- bool union_element_finalize(const Item * item) const;
+ SORT_FIELD_ATTR *attr) const override;
+ bool union_element_finalize(const Item * item) const override;
+ uint calc_key_length(const Column_definition &def) const override;
bool Column_definition_prepare_stage1(THD *thd,
MEM_ROOT *mem_root,
Column_definition *c,
handler *file,
- ulonglong table_flags) const;
+ ulonglong table_flags) const override;
bool Column_definition_redefine_stage1(Column_definition *def,
const Column_definition *dup,
const handler *file,
const Schema_specification_st *schema)
- const;
- uint32 max_display_length(const Item *item) const;
+ const override;
+ void
+ Column_definition_attributes_frm_pack(const Column_definition_attributes *at,
+ uchar *buff) const override;
+ uint32 max_display_length(const Item *item) const override;
bool Item_const_eq(const Item_const *a, const Item_const *b,
- bool binary_cmp) const;
+ bool binary_cmp) const override;
bool Item_eq_value(THD *thd, const Type_cmp_attributes *attr,
- Item *a, Item *b) const;
- uint Item_time_precision(THD *thd, Item *item) const
+ Item *a, Item *b) const override;
+ uint Item_time_precision(THD *thd, Item *item) const override
{
return Item_temporal_precision(thd, item, true);
}
- uint Item_datetime_precision(THD *thd, Item *item) const
+ uint Item_datetime_precision(THD *thd, Item *item) const override
{
return Item_temporal_precision(thd, item, false);
}
- uint Item_decimal_precision(const Item *item) const;
- void Item_update_null_value(Item *item) const;
- bool Item_save_in_value(THD *thd, Item *item, st_value *value) const;
- void Item_param_setup_conversion(THD *thd, Item_param *) const;
+ uint Item_decimal_precision(const Item *item) const override;
+ void Item_update_null_value(Item *item) const override;
+ bool Item_save_in_value(THD *thd, Item *item, st_value *value) const override;
+ void Item_param_setup_conversion(THD *thd, Item_param *) const override;
void Item_param_set_param_func(Item_param *param,
- uchar **pos, ulong len) const;
+ uchar **pos, ulong len) const override;
bool Item_param_set_from_value(THD *thd,
Item_param *param,
const Type_all_attributes *attr,
- const st_value *value) const;
- bool Item_send(Item *item, Protocol *protocol, st_value *buf) const
+ const st_value *value) const override;
+ bool Item_send(Item *item, Protocol *protocol, st_value *buf) const override
{
return Item_send_str(item, protocol, buf);
}
- int Item_save_in_field(Item *item, Field *field, bool no_conversions) const;
- String *print_item_value(THD *thd, Item *item, String *str) const
+ int Item_save_in_field(Item *item, Field *field, bool no_conversions) const
+ override;
+ String *print_item_value(THD *thd, Item *item, String *str) const override
{
return print_item_value_csstr(thd, item, str);
}
bool can_change_cond_ref_to_const(Item_bool_func2 *target,
Item *target_expr, Item *target_value,
Item_bool_func2 *source,
- Item *source_expr, Item *source_const) const;
+ Item *source_expr, Item *source_const) const
+ override;
bool subquery_type_allows_materialization(const Item *inner,
- const Item *outer) const;
- Item *make_const_item_for_comparison(THD *, Item *src, const Item *cmp) const;
- Item_cache *Item_get_cache(THD *thd, const Item *item) const;
- bool set_comparator_func(Arg_comparator *cmp) const;
+ const Item *outer) const override;
+ Item *make_const_item_for_comparison(THD *, Item *src, const Item *cmp) const
+ override;
+ Item_cache *Item_get_cache(THD *thd, const Item *item) const override;
+ bool set_comparator_func(Arg_comparator *cmp) const override;
bool Item_hybrid_func_fix_attributes(THD *thd,
const char *name,
Type_handler_hybrid_field_type *,
Type_all_attributes *atrr,
- Item **items, uint nitems) const;
- bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *func) const;
- bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const;
- bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const;
- bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *) const;
- bool Item_func_signed_fix_length_and_dec(Item_func_signed *item) const;
- bool Item_func_unsigned_fix_length_and_dec(Item_func_unsigned *item) const;
- bool Item_val_bool(Item *item) const;
+ Item **items, uint nitems) const
+ override;
+ bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *func) const override;
+ bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const override;
+ bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const override;
+ bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *) const override;
+ bool Item_func_signed_fix_length_and_dec(Item_func_signed *item) const
+ override;
+ bool Item_func_unsigned_fix_length_and_dec(Item_func_unsigned *item) const
+ override;
+ bool Item_val_bool(Item *item) const override;
void Item_get_date(THD *thd, Item *item, Temporal::Warn *warn,
- MYSQL_TIME *ltime, date_mode_t fuzzydate) const;
- longlong Item_val_int_signed_typecast(Item *item) const;
- longlong Item_val_int_unsigned_typecast(Item *item) const;
- String *Item_func_hex_val_str_ascii(Item_func_hex *item, String *str) const;
+ MYSQL_TIME *ltime, date_mode_t fuzzydate) const override;
+ longlong Item_val_int_signed_typecast(Item *item) const override;
+ longlong Item_val_int_unsigned_typecast(Item *item) const override;
+ String *Item_func_hex_val_str_ascii(Item_func_hex *item, String *str) const
+ override;
String *Item_func_hybrid_field_type_val_str(Item_func_hybrid_field_type *,
- String *) const;
+ String *) const override;
double Item_func_hybrid_field_type_val_real(Item_func_hybrid_field_type *)
- const;
+ const override;
longlong Item_func_hybrid_field_type_val_int(Item_func_hybrid_field_type *)
- const;
+ const override;
my_decimal *Item_func_hybrid_field_type_val_decimal(
Item_func_hybrid_field_type *,
- my_decimal *) const;
+ my_decimal *) const override;
void Item_func_hybrid_field_type_get_date(THD *,
Item_func_hybrid_field_type *,
Temporal::Warn *,
MYSQL_TIME *,
- date_mode_t fuzzydate) const;
- String *Item_func_min_max_val_str(Item_func_min_max *, String *) const;
- double Item_func_min_max_val_real(Item_func_min_max *) const;
- longlong Item_func_min_max_val_int(Item_func_min_max *) const;
+ date_mode_t fuzzydate)
+ const override;
+ String *Item_func_min_max_val_str(Item_func_min_max *, String *) const
+ override;
+ double Item_func_min_max_val_real(Item_func_min_max *) const override;
+ longlong Item_func_min_max_val_int(Item_func_min_max *) const override;
my_decimal *Item_func_min_max_val_decimal(Item_func_min_max *,
- my_decimal *) const;
+ my_decimal *) const override;
bool Item_func_min_max_get_date(THD *thd, Item_func_min_max*,
- MYSQL_TIME *, date_mode_t fuzzydate) const;
- bool Item_func_between_fix_length_and_dec(Item_func_between *func) const;
- longlong Item_func_between_val_int(Item_func_between *func) const;
- bool Item_char_typecast_fix_length_and_dec(Item_char_typecast *) const;
- cmp_item *make_cmp_item(THD *thd, CHARSET_INFO *cs) const;
- in_vector *make_in_vector(THD *, const Item_func_in *, uint nargs) const;
- bool Item_func_in_fix_comparator_compatible_types(THD *thd,
- Item_func_in *) const;
- bool Item_func_round_fix_length_and_dec(Item_func_round *) const;
- bool Item_func_int_val_fix_length_and_dec(Item_func_int_val *) const;
- bool Item_func_abs_fix_length_and_dec(Item_func_abs *) const;
- bool Item_func_neg_fix_length_and_dec(Item_func_neg *) const;
- bool Item_func_plus_fix_length_and_dec(Item_func_plus *) const;
- bool Item_func_minus_fix_length_and_dec(Item_func_minus *) const;
- bool Item_func_mul_fix_length_and_dec(Item_func_mul *) const;
- bool Item_func_div_fix_length_and_dec(Item_func_div *) const;
- bool Item_func_mod_fix_length_and_dec(Item_func_mod *) const;
+ MYSQL_TIME *, date_mode_t fuzzydate) const
+ override;
+ bool Item_func_between_fix_length_and_dec(Item_func_between *func) const
+ override;
+ longlong Item_func_between_val_int(Item_func_between *func) const override;
+ bool Item_char_typecast_fix_length_and_dec(Item_char_typecast *) const
+ override;
+ cmp_item *make_cmp_item(THD *thd, CHARSET_INFO *cs) const override;
+ in_vector *make_in_vector(THD *, const Item_func_in *, uint nargs) const
+ override;
+ bool Item_func_in_fix_comparator_compatible_types(THD *thd, Item_func_in *)
+ const override;
+ bool Item_func_round_fix_length_and_dec(Item_func_round *) const override;
+ bool Item_func_int_val_fix_length_and_dec(Item_func_int_val *) const override;
+ bool Item_func_abs_fix_length_and_dec(Item_func_abs *) const override;
+ bool Item_func_neg_fix_length_and_dec(Item_func_neg *) const override;
+ bool Item_func_plus_fix_length_and_dec(Item_func_plus *) const override;
+ bool Item_func_minus_fix_length_and_dec(Item_func_minus *) const override;
+ bool Item_func_mul_fix_length_and_dec(Item_func_mul *) const override;
+ bool Item_func_div_fix_length_and_dec(Item_func_div *) const override;
+ bool Item_func_mod_fix_length_and_dec(Item_func_mod *) const override;
+ const Vers_type_handler *vers() const override { return &vers_type_timestamp; }
};
class Type_handler_general_purpose_string: public Type_handler_string_result
{
public:
- bool is_general_purpose_string_type() const { return true; }
- bool Vers_history_point_resolve_unit(THD *thd, Vers_history_point *p) const;
+ bool is_general_purpose_string_type() const override { return true; }
};
@@ -4765,529 +5130,618 @@ public:
class Type_handler_tiny: public Type_handler_general_purpose_int
{
- static const Name m_name_tiny;
- static const Type_limits_int m_limits_sint8;
- static const Type_limits_int m_limits_uint8;
public:
virtual ~Type_handler_tiny() {}
- const Name name() const { return m_name_tiny; }
- enum_field_types field_type() const { return MYSQL_TYPE_TINY; }
- protocol_send_type_t protocol_send_type() const
+ const Name name() const override;
+ enum_field_types field_type() const override { return MYSQL_TYPE_TINY; }
+ const Type_handler *type_handler_unsigned() const override;
+ const Type_handler *type_handler_signed() const override;
+ protocol_send_type_t protocol_send_type() const override
{
return PROTOCOL_SEND_TINY;
}
- const Type_limits_int *type_limits_int_by_unsigned_flag(bool unsigned_fl) const
- {
- return unsigned_fl ? &m_limits_uint8 : &m_limits_sint8;
- }
- uint32 calc_pack_length(uint32 length) const { return 1; }
- bool Item_send(Item *item, Protocol *protocol, st_value *buf) const
+ const Type_limits_int *type_limits_int() const override;
+ uint32 calc_pack_length(uint32 length) const override { return 1; }
+ uint32 max_display_length_for_field(const Conv_source &src) const override
+ { return 4; }
+ bool Item_send(Item *item, Protocol *protocol, st_value *buf) const override
{
return Item_send_tiny(item, protocol, buf);
}
- Field *make_conversion_table_field(TABLE *TABLE, uint metadata,
- const Field *target) const;
- bool Column_definition_fix_attributes(Column_definition *c) const;
+ Field *make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table, uint metadata,
+ const Field *target) const override;
+ bool Column_definition_fix_attributes(Column_definition *c) const override;
bool Column_definition_prepare_stage2(Column_definition *c,
handler *file,
- ulonglong table_flags) const
+ ulonglong table_flags) const override
{ return Column_definition_prepare_stage2_legacy_num(c, MYSQL_TYPE_TINY); }
- Field *make_table_field(const LEX_CSTRING *name,
- const Record_addr &addr,
- const Type_all_attributes &attr,
- TABLE *table) const;
+ Field *make_schema_field(MEM_ROOT *root,
+ TABLE *table,
+ const Record_addr &addr,
+ const ST_FIELD_INFO &def,
+ bool show_field) const override;
Field *make_table_field_from_def(TABLE_SHARE *share,
MEM_ROOT *mem_root,
const LEX_CSTRING *name,
const Record_addr &addr,
const Bit_addr &bit,
const Column_definition_attributes *attr,
- uint32 flags) const;
+ uint32 flags) const override;
void Item_param_set_param_func(Item_param *param,
- uchar **pos, ulong len) const;
+ uchar **pos, ulong len) const override;
+};
+
+
+class Type_handler_utiny: public Type_handler_tiny
+{
+public:
+ const Name name() const override;
+ uint flags() const override { return UNSIGNED_FLAG; }
+ const Type_limits_int *type_limits_int() const override;
};
class Type_handler_short: public Type_handler_general_purpose_int
{
- static const Name m_name_short;
- static const Type_limits_int m_limits_sint16;
- static const Type_limits_int m_limits_uint16;
public:
virtual ~Type_handler_short() {}
- const Name name() const { return m_name_short; }
- enum_field_types field_type() const { return MYSQL_TYPE_SHORT; }
- protocol_send_type_t protocol_send_type() const
+ const Name name() const override;
+ enum_field_types field_type() const override { return MYSQL_TYPE_SHORT; }
+ const Type_handler *type_handler_unsigned() const override;
+ const Type_handler *type_handler_signed() const override;
+ protocol_send_type_t protocol_send_type() const override
{
return PROTOCOL_SEND_SHORT;
}
- bool Item_send(Item *item, Protocol *protocol, st_value *buf) const
+ bool Item_send(Item *item, Protocol *protocol, st_value *buf) const override
{
return Item_send_short(item, protocol, buf);
}
- const Type_limits_int *type_limits_int_by_unsigned_flag(bool unsigned_fl) const
- {
- return unsigned_fl ? &m_limits_uint16 : &m_limits_sint16;
- }
- uint32 calc_pack_length(uint32 length) const { return 2; }
- Field *make_conversion_table_field(TABLE *TABLE, uint metadata,
- const Field *target) const;
- bool Column_definition_fix_attributes(Column_definition *c) const;
+ const Type_limits_int *type_limits_int() const override;
+ uint32 max_display_length_for_field(const Conv_source &src) const override
+ { return 6; }
+ uint32 calc_pack_length(uint32 length) const override{ return 2; }
+ Field *make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table, uint metadata,
+ const Field *target) const override;
+ bool Column_definition_fix_attributes(Column_definition *c) const override;
bool Column_definition_prepare_stage2(Column_definition *c,
handler *file,
- ulonglong table_flags) const
+ ulonglong table_flags) const override
{ return Column_definition_prepare_stage2_legacy_num(c, MYSQL_TYPE_SHORT); }
- Field *make_table_field(const LEX_CSTRING *name,
- const Record_addr &addr,
- const Type_all_attributes &attr,
- TABLE *table) const;
+ Field *make_schema_field(MEM_ROOT *root,
+ TABLE *table,
+ const Record_addr &addr,
+ const ST_FIELD_INFO &def,
+ bool show_field) const override;
Field *make_table_field_from_def(TABLE_SHARE *share,
MEM_ROOT *mem_root,
const LEX_CSTRING *name,
const Record_addr &addr,
const Bit_addr &bit,
const Column_definition_attributes *attr,
- uint32 flags) const;
+ uint32 flags) const override;
void Item_param_set_param_func(Item_param *param,
- uchar **pos, ulong len) const;
+ uchar **pos, ulong len) const override;
+};
+
+
+class Type_handler_ushort: public Type_handler_short
+{
+public:
+ const Name name() const override;
+ uint flags() const override { return UNSIGNED_FLAG; }
+ const Type_limits_int *type_limits_int() const override;
};
class Type_handler_long: public Type_handler_general_purpose_int
{
- static const Name m_name_int;
- static const Type_limits_int m_limits_sint32;
- static const Type_limits_int m_limits_uint32;
public:
virtual ~Type_handler_long() {}
- const Name name() const { return m_name_int; }
- enum_field_types field_type() const { return MYSQL_TYPE_LONG; }
- protocol_send_type_t protocol_send_type() const
+ const Name name() const override;
+ enum_field_types field_type() const override { return MYSQL_TYPE_LONG; }
+ const Type_handler *type_handler_unsigned() const override;
+ const Type_handler *type_handler_signed() const override;
+ protocol_send_type_t protocol_send_type() const override
{
return PROTOCOL_SEND_LONG;
}
- const Type_limits_int *type_limits_int_by_unsigned_flag(bool unsigned_fl) const
- {
- return unsigned_fl ? &m_limits_uint32 : &m_limits_sint32;
- }
- uint32 calc_pack_length(uint32 length) const { return 4; }
- bool Item_send(Item *item, Protocol *protocol, st_value *buf) const
+ const Type_limits_int *type_limits_int() const override;
+ uint32 max_display_length_for_field(const Conv_source &src) const override
+ { return 11; }
+ uint32 calc_pack_length(uint32 length) const override { return 4; }
+ bool Item_send(Item *item, Protocol *protocol, st_value *buf) const override
{
return Item_send_long(item, protocol, buf);
}
- Field *make_conversion_table_field(TABLE *TABLE, uint metadata,
- const Field *target) const;
- bool Column_definition_fix_attributes(Column_definition *c) const;
+ Field *make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table, uint metadata,
+ const Field *target) const override;
+ bool Column_definition_fix_attributes(Column_definition *c) const override;
bool Column_definition_prepare_stage2(Column_definition *c,
handler *file,
- ulonglong table_flags) const
+ ulonglong table_flags) const override
{ return Column_definition_prepare_stage2_legacy_num(c, MYSQL_TYPE_LONG); }
- Field *make_table_field(const LEX_CSTRING *name,
- const Record_addr &addr,
- const Type_all_attributes &attr,
- TABLE *table) const;
+ Field *make_schema_field(MEM_ROOT *root,
+ TABLE *table,
+ const Record_addr &addr,
+ const ST_FIELD_INFO &def,
+ bool show_field) const override;
Field *make_table_field_from_def(TABLE_SHARE *share,
MEM_ROOT *mem_root,
const LEX_CSTRING *name,
const Record_addr &addr,
const Bit_addr &bit,
const Column_definition_attributes *attr,
- uint32 flags) const;
+ uint32 flags) const override;
void Item_param_set_param_func(Item_param *param,
- uchar **pos, ulong len) const;
+ uchar **pos, ulong len) const override;
+};
+
+
+class Type_handler_ulong: public Type_handler_long
+{
+public:
+ const Name name() const override;
+ uint flags() const override { return UNSIGNED_FLAG; }
+ const Type_limits_int *type_limits_int() const override;
};
class Type_handler_bool: public Type_handler_long
{
- static const Name m_name_bool;
public:
- const Name name() const { return m_name_bool; }
- bool is_bool_type() const { return true; }
- void Item_update_null_value(Item *item) const;
- bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *) const;
+ const Name name() const override;
+ bool is_bool_type() const override { return true; }
+ const Type_handler *type_handler_unsigned() const override;
+ const Type_handler *type_handler_signed() const override;
+ void Item_update_null_value(Item *item) const override;
+ bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *) const override;
};
class Type_handler_longlong: public Type_handler_general_purpose_int
{
- static const Name m_name_longlong;
- static const Type_limits_int m_limits_sint64;
- static const Type_limits_int m_limits_uint64;
public:
virtual ~Type_handler_longlong() {}
- const Name name() const { return m_name_longlong; }
- enum_field_types field_type() const { return MYSQL_TYPE_LONGLONG; }
- protocol_send_type_t protocol_send_type() const
+ const Name name() const override;
+ enum_field_types field_type() const override{ return MYSQL_TYPE_LONGLONG; }
+ const Type_handler *type_handler_unsigned() const override;
+ const Type_handler *type_handler_signed() const override;
+ protocol_send_type_t protocol_send_type() const override
{
return PROTOCOL_SEND_LONGLONG;
}
- const Type_limits_int *type_limits_int_by_unsigned_flag(bool unsigned_fl) const
- {
- return unsigned_fl ? &m_limits_uint64 : &m_limits_sint64;
- }
- uint32 calc_pack_length(uint32 length) const { return 8; }
+ const Type_limits_int *type_limits_int() const override;
+ uint32 max_display_length_for_field(const Conv_source &src) const override
+ { return 20; }
+ uint32 calc_pack_length(uint32 length) const override { return 8; }
Item *create_typecast_item(THD *thd, Item *item,
- const Type_cast_attributes &attr) const;
- bool Item_send(Item *item, Protocol *protocol, st_value *buf) const
+ const Type_cast_attributes &attr) const override;
+ bool Item_send(Item *item, Protocol *protocol, st_value *buf) const override
{
return Item_send_longlong(item, protocol, buf);
}
- Field *make_conversion_table_field(TABLE *TABLE, uint metadata,
- const Field *target) const;
- bool Column_definition_fix_attributes(Column_definition *c) const;
+ Field *make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table, uint metadata,
+ const Field *target) const override;
+ bool Column_definition_fix_attributes(Column_definition *c) const override;
bool Column_definition_prepare_stage2(Column_definition *c,
handler *file,
- ulonglong table_flags) const
+ ulonglong table_flags) const override
{
return Column_definition_prepare_stage2_legacy_num(c, MYSQL_TYPE_LONGLONG);
}
- Field *make_table_field(const LEX_CSTRING *name,
- const Record_addr &addr,
- const Type_all_attributes &attr,
- TABLE *table) const;
+ Field *make_schema_field(MEM_ROOT *root,
+ TABLE *table,
+ const Record_addr &addr,
+ const ST_FIELD_INFO &def,
+ bool show_field) const override;
Field *make_table_field_from_def(TABLE_SHARE *share,
MEM_ROOT *mem_root,
const LEX_CSTRING *name,
const Record_addr &addr,
const Bit_addr &bit,
const Column_definition_attributes *attr,
- uint32 flags) const;
+ uint32 flags) const override;
void Item_param_set_param_func(Item_param *param,
- uchar **pos, ulong len) const;
+ uchar **pos, ulong len) const override;
+};
+
+
+class Type_handler_ulonglong: public Type_handler_longlong
+{
+public:
+ const Name name() const override;
+ uint flags() const override { return UNSIGNED_FLAG; }
+ const Type_limits_int *type_limits_int() const override;
};
-class Type_handler_vers_trx_id: public Type_handler_longlong
+class Type_handler_vers_trx_id: public Type_handler_ulonglong
{
public:
virtual ~Type_handler_vers_trx_id() {}
- Field *make_table_field(const LEX_CSTRING *name,
+ Field *make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const;
+ TABLE_SHARE *share) const override;
};
class Type_handler_int24: public Type_handler_general_purpose_int
{
- static const Name m_name_mediumint;
- static const Type_limits_int m_limits_sint24;
- static const Type_limits_int m_limits_uint24;
public:
virtual ~Type_handler_int24() {}
- const Name name() const { return m_name_mediumint; }
- enum_field_types field_type() const { return MYSQL_TYPE_INT24; }
- protocol_send_type_t protocol_send_type() const
+ const Name name() const override;
+ enum_field_types field_type() const override { return MYSQL_TYPE_INT24; }
+ const Type_handler *type_handler_unsigned() const override;
+ const Type_handler *type_handler_signed() const override;
+ protocol_send_type_t protocol_send_type() const override
{
return PROTOCOL_SEND_LONG;
}
- bool Item_send(Item *item, Protocol *protocol, st_value *buf) const
+ bool Item_send(Item *item, Protocol *protocol, st_value *buf) const override
{
return Item_send_long(item, protocol, buf);
}
- const Type_limits_int *type_limits_int_by_unsigned_flag(bool unsigned_fl) const
- {
- return unsigned_fl ? &m_limits_uint24 : &m_limits_sint24;
- }
- uint32 calc_pack_length(uint32 length) const { return 3; }
- Field *make_conversion_table_field(TABLE *, uint metadata,
- const Field *target) const;
- bool Column_definition_fix_attributes(Column_definition *c) const;
+ const Type_limits_int *type_limits_int() const override;
+ uint32 max_display_length_for_field(const Conv_source &src) const override
+ { return 9; }
+ uint32 calc_pack_length(uint32 length) const override { return 3; }
+ Field *make_conversion_table_field(MEM_ROOT *mem_root,
+ TABLE *table, uint metadata,
+ const Field *target) const override;
+ bool Column_definition_fix_attributes(Column_definition *c) const override;
bool Column_definition_prepare_stage2(Column_definition *c,
handler *file,
- ulonglong table_flags) const
+ ulonglong table_flags) const override
{ return Column_definition_prepare_stage2_legacy_num(c, MYSQL_TYPE_INT24); }
- Field *make_table_field(const LEX_CSTRING *name,
- const Record_addr &addr,
- const Type_all_attributes &attr,
- TABLE *table) const;
Field *make_table_field_from_def(TABLE_SHARE *share,
MEM_ROOT *mem_root,
const LEX_CSTRING *name,
const Record_addr &addr,
const Bit_addr &bit,
const Column_definition_attributes *attr,
- uint32 flags) const;
+ uint32 flags) const override;
+};
+
+
+class Type_handler_uint24: public Type_handler_int24
+{
+public:
+ const Name name() const override;
+ uint flags() const override { return UNSIGNED_FLAG; }
+ const Type_limits_int *type_limits_int() const override;
};
class Type_handler_year: public Type_handler_int_result
{
- static const Name m_name_year;
public:
virtual ~Type_handler_year() {}
- const Name name() const { return m_name_year; }
- enum_field_types field_type() const { return MYSQL_TYPE_YEAR; }
- protocol_send_type_t protocol_send_type() const
+ const Name name() const override;
+ enum_field_types field_type() const override { return MYSQL_TYPE_YEAR; }
+ uint flags() const override { return UNSIGNED_FLAG; }
+ protocol_send_type_t protocol_send_type() const override
{
return PROTOCOL_SEND_SHORT;
}
- uint32 max_display_length(const Item *item) const;
- uint32 calc_pack_length(uint32 length) const { return 1; }
- bool Item_send(Item *item, Protocol *protocol, st_value *buf) const
+ uint32 max_display_length(const Item *item) const override;
+ uint32 max_display_length_for_field(const Conv_source &src) const override
+ { return 4; }
+ uint32 calc_pack_length(uint32 length) const override { return 1; }
+ bool Item_send(Item *item, Protocol *protocol, st_value *buf) const override
{
return Item_send_short(item, protocol, buf);
}
- Field *make_conversion_table_field(TABLE *, uint metadata,
- const Field *target) const;
- bool Column_definition_fix_attributes(Column_definition *c) const;
+ Field *make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table, uint metadata,
+ const Field *target) const override;
+ bool Column_definition_fix_attributes(Column_definition *c) const override;
void Column_definition_reuse_fix_attributes(THD *thd,
Column_definition *c,
- const Field *field) const;
+ const Field *field)
+ const override;
bool Column_definition_prepare_stage2(Column_definition *c,
handler *file,
- ulonglong table_flags) const
+ ulonglong table_flags) const override
{ return Column_definition_prepare_stage2_legacy_num(c, MYSQL_TYPE_YEAR); }
- Field *make_table_field(const LEX_CSTRING *name,
- const Record_addr &addr,
- const Type_all_attributes &attr,
- TABLE *table) const;
Field *make_table_field_from_def(TABLE_SHARE *share,
MEM_ROOT *mem_root,
const LEX_CSTRING *name,
const Record_addr &addr,
const Bit_addr &bit,
const Column_definition_attributes *attr,
- uint32 flags) const;
- Item_cache *Item_get_cache(THD *thd, const Item *item) const;
+ uint32 flags) const override;
+ Item_cache *Item_get_cache(THD *thd, const Item *item) const override;
void Item_get_date(THD *thd, Item *item, Temporal::Warn *warn,
- MYSQL_TIME *ltime, date_mode_t fuzzydate) const;
+ MYSQL_TIME *ltime, date_mode_t fuzzydate) const override;
void Item_func_hybrid_field_type_get_date(THD *,
Item_func_hybrid_field_type *item,
Temporal::Warn *,
MYSQL_TIME *to,
- date_mode_t fuzzydate) const;
+ date_mode_t fuzzydate)
+ const override;
+ const Vers_type_handler *vers() const override { return NULL; }
};
class Type_handler_bit: public Type_handler_int_result
{
- static const Name m_name_bit;
public:
virtual ~Type_handler_bit() {}
- const Name name() const { return m_name_bit; }
- enum_field_types field_type() const { return MYSQL_TYPE_BIT; }
- protocol_send_type_t protocol_send_type() const
+ const Name name() const override;
+ enum_field_types field_type() const override { return MYSQL_TYPE_BIT; }
+ uint flags() const override { return UNSIGNED_FLAG; }
+ protocol_send_type_t protocol_send_type() const override
{
return PROTOCOL_SEND_STRING;
}
- uint32 max_display_length(const Item *item) const;
- uint32 calc_pack_length(uint32 length) const { return length / 8; }
- bool Item_send(Item *item, Protocol *protocol, st_value *buf) const
+ uint32 max_display_length(const Item *item) const override;
+ uint32 max_display_length_for_field(const Conv_source &src) const override;
+ uint32 calc_pack_length(uint32 length) const override { return length / 8; }
+ uint calc_key_length(const Column_definition &def) const override;
+ void
+ Column_definition_attributes_frm_pack(const Column_definition_attributes *at,
+ uchar *buff) const override;
+ bool Item_send(Item *item, Protocol *protocol, st_value *buf) const override
{
return Item_send_str(item, protocol, buf);
}
- String *print_item_value(THD *thd, Item *item, String *str) const
+ String *print_item_value(THD *thd, Item *item, String *str) const override
{
return print_item_value_csstr(thd, item, str);
}
- Field *make_conversion_table_field(TABLE *, uint metadata,
- const Field *target) const;
- bool Column_definition_fix_attributes(Column_definition *c) const;
+ void show_binlog_type(const Conv_source &src, const Field &, String *str)
+ const override;
+ Field *make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table, uint metadata,
+ const Field *target) const override;
+ bool Column_definition_fix_attributes(Column_definition *c) const override;
bool Column_definition_prepare_stage1(THD *thd,
MEM_ROOT *mem_root,
Column_definition *c,
handler *file,
- ulonglong table_flags) const;
+ ulonglong table_flags) const override;
bool Column_definition_redefine_stage1(Column_definition *def,
const Column_definition *dup,
const handler *file,
const Schema_specification_st *schema)
- const;
+ const override;
bool Column_definition_prepare_stage2(Column_definition *c,
handler *file,
- ulonglong table_flags) const;
- Field *make_table_field(const LEX_CSTRING *name,
+ ulonglong table_flags) const override;
+ Field *make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const;
+ TABLE_SHARE *share) const override;
Field *make_table_field_from_def(TABLE_SHARE *share,
MEM_ROOT *mem_root,
const LEX_CSTRING *name,
const Record_addr &addr,
const Bit_addr &bit,
const Column_definition_attributes *attr,
- uint32 flags) const;
- bool Vers_history_point_resolve_unit(THD *thd, Vers_history_point *p) const;
+ uint32 flags) const override;
};
class Type_handler_float: public Type_handler_real_result
{
- static const Name m_name_float;
public:
virtual ~Type_handler_float() {}
- const Name name() const { return m_name_float; }
- enum_field_types field_type() const { return MYSQL_TYPE_FLOAT; }
- protocol_send_type_t protocol_send_type() const
+ const Name name() const override;
+ enum_field_types field_type() const override { return MYSQL_TYPE_FLOAT; }
+ protocol_send_type_t protocol_send_type() const override
{
return PROTOCOL_SEND_FLOAT;
}
- bool type_can_have_auto_increment_attribute() const { return true; }
- uint32 max_display_length(const Item *item) const { return 25; }
- uint32 calc_pack_length(uint32 length) const { return sizeof(float); }
+ bool type_can_have_auto_increment_attribute() const override { return true; }
+ uint32 max_display_length(const Item *item) const override { return 25; }
+ uint32 max_display_length_for_field(const Conv_source &src) const override
+ { return 12; }
+ uint32 calc_pack_length(uint32 length) const override { return sizeof(float); }
Item *create_typecast_item(THD *thd, Item *item,
- const Type_cast_attributes &attr) const;
- bool Item_send(Item *item, Protocol *protocol, st_value *buf) const
+ const Type_cast_attributes &attr) const override;
+ bool Item_send(Item *item, Protocol *protocol, st_value *buf) const override
{
return Item_send_float(item, protocol, buf);
}
- Field *make_num_distinct_aggregator_field(MEM_ROOT *, const Item *) const;
- Field *make_conversion_table_field(TABLE *, uint metadata,
- const Field *target) const;
- bool Column_definition_fix_attributes(Column_definition *c) const;
+ Field *make_num_distinct_aggregator_field(MEM_ROOT *, const Item *)
+ const override;
+ Field *make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table, uint metadata,
+ const Field *target) const override;
+ bool Column_definition_fix_attributes(Column_definition *c) const override;
bool Column_definition_prepare_stage2(Column_definition *c,
handler *file,
- ulonglong table_flags) const
+ ulonglong table_flags) const override
{ return Column_definition_prepare_stage2_legacy_real(c, MYSQL_TYPE_FLOAT); }
- Field *make_table_field(const LEX_CSTRING *name,
- const Record_addr &addr,
- const Type_all_attributes &attr,
- TABLE *table) const;
+ Field *make_schema_field(MEM_ROOT *root,
+ TABLE *table,
+ const Record_addr &addr,
+ const ST_FIELD_INFO &def,
+ bool show_field) const override;
Field *make_table_field_from_def(TABLE_SHARE *share,
MEM_ROOT *mem_root,
const LEX_CSTRING *name,
const Record_addr &addr,
const Bit_addr &bit,
const Column_definition_attributes *attr,
- uint32 flags) const;
+ uint32 flags) const override;
void Item_param_set_param_func(Item_param *param,
- uchar **pos, ulong len) const;
+ uchar **pos, ulong len) const override;
- Item_cache *Item_get_cache(THD *thd, const Item *item) const;
+ Item_cache *Item_get_cache(THD *thd, const Item *item) const override;
String *Item_func_hybrid_field_type_val_str(Item_func_hybrid_field_type *,
- String *) const;
- String *Item_func_min_max_val_str(Item_func_min_max *, String *) const;
+ String *) const override;
+ String *Item_func_min_max_val_str(Item_func_min_max *, String *)
+ const override;
};
class Type_handler_double: public Type_handler_real_result
{
- static const Name m_name_double;
public:
virtual ~Type_handler_double() {}
- const Name name() const { return m_name_double; }
- enum_field_types field_type() const { return MYSQL_TYPE_DOUBLE; }
- protocol_send_type_t protocol_send_type() const
+ const Name name() const override;
+ enum_field_types field_type() const override { return MYSQL_TYPE_DOUBLE; }
+ protocol_send_type_t protocol_send_type() const override
{
return PROTOCOL_SEND_DOUBLE;
}
- bool type_can_have_auto_increment_attribute() const { return true; }
- uint32 max_display_length(const Item *item) const { return 53; }
- uint32 calc_pack_length(uint32 length) const { return sizeof(double); }
+ bool type_can_have_auto_increment_attribute() const override { return true; }
+ uint32 max_display_length(const Item *item) const override { return 53; }
+ uint32 max_display_length_for_field(const Conv_source &src) const override
+ { return 22; }
+ uint32 calc_pack_length(uint32 length) const override
+ {
+ return sizeof(double);
+ }
Item *create_typecast_item(THD *thd, Item *item,
- const Type_cast_attributes &attr) const;
- bool Item_send(Item *item, Protocol *protocol, st_value *buf) const
+ const Type_cast_attributes &attr) const override;
+ bool Item_send(Item *item, Protocol *protocol, st_value *buf) const override
{
return Item_send_double(item, protocol, buf);
}
- Field *make_conversion_table_field(TABLE *, uint metadata,
- const Field *target) const;
- bool Column_definition_fix_attributes(Column_definition *c) const;
+ Field *make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table, uint metadata,
+ const Field *target) const override;
+ bool Column_definition_fix_attributes(Column_definition *c) const override;
bool Column_definition_prepare_stage2(Column_definition *c,
handler *file,
- ulonglong table_flags) const
+ ulonglong table_flags) const override
{ return Column_definition_prepare_stage2_legacy_real(c, MYSQL_TYPE_DOUBLE); }
- Field *make_table_field(const LEX_CSTRING *name,
- const Record_addr &addr,
- const Type_all_attributes &attr,
- TABLE *table) const;
+ Field *make_schema_field(MEM_ROOT *root,
+ TABLE *table,
+ const Record_addr &addr,
+ const ST_FIELD_INFO &def,
+ bool show_field) const override;
Field *make_table_field_from_def(TABLE_SHARE *share,
MEM_ROOT *mem_root,
const LEX_CSTRING *name,
const Record_addr &addr,
const Bit_addr &bit,
const Column_definition_attributes *attr,
- uint32 flags) const;
+ uint32 flags) const override;
void Item_param_set_param_func(Item_param *param,
- uchar **pos, ulong len) const;
+ uchar **pos, ulong len) const override;
- Item_cache *Item_get_cache(THD *thd, const Item *item) const;
+ Item_cache *Item_get_cache(THD *thd, const Item *item) const override;
String *Item_func_hybrid_field_type_val_str(Item_func_hybrid_field_type *,
- String *) const;
- String *Item_func_min_max_val_str(Item_func_min_max *, String *) const;
+ String *) const override;
+ String *Item_func_min_max_val_str(Item_func_min_max *, String *)
+ const override;
};
class Type_handler_time_common: public Type_handler_temporal_result
{
- static const Name m_name_time;
public:
virtual ~Type_handler_time_common() { }
- const Name name() const { return m_name_time; }
- enum_field_types field_type() const { return MYSQL_TYPE_TIME; }
- protocol_send_type_t protocol_send_type() const
+ const Name name() const override;
+ const Name &default_value() const override;
+ enum_field_types field_type() const override { return MYSQL_TYPE_TIME; }
+ enum_dynamic_column_type dyncol_type(const Type_all_attributes *attr)
+ const override
+ {
+ return DYN_COL_TIME;
+ }
+ protocol_send_type_t protocol_send_type() const override
{
return PROTOCOL_SEND_TIME;
}
- enum_mysql_timestamp_type mysql_timestamp_type() const
+ enum_mysql_timestamp_type mysql_timestamp_type() const override
{
return MYSQL_TIMESTAMP_TIME;
}
+ Field *make_schema_field(MEM_ROOT *root,
+ TABLE *table,
+ const Record_addr &addr,
+ const ST_FIELD_INFO &def,
+ bool show_field) const override;
Item_literal *create_literal_item(THD *thd, const char *str, size_t length,
- CHARSET_INFO *cs, bool send_error) const;
+ CHARSET_INFO *cs, bool send_error)
+ const override;
Item *create_typecast_item(THD *thd, Item *item,
- const Type_cast_attributes &attr) const;
+ const Type_cast_attributes &attr)
+ const override;
bool Item_eq_value(THD *thd, const Type_cmp_attributes *attr,
- Item *a, Item *b) const;
- uint Item_decimal_scale(const Item *item) const
+ Item *a, Item *b) const override;
+ uint Item_decimal_scale(const Item *item) const override
{
return Item_decimal_scale_with_seconds(item);
}
- uint Item_decimal_precision(const Item *item) const;
- uint Item_divisor_precision_increment(const Item *item) const
+ uint Item_decimal_precision(const Item *item) const override;
+ uint Item_divisor_precision_increment(const Item *item) const override
{
return Item_divisor_precision_increment_with_seconds(item);
}
- const Type_handler *type_handler_for_comparison() const;
- int stored_field_cmp_to_item(THD *thd, Field *field, Item *item) const;
- void Column_definition_implicit_upgrade(Column_definition *c) const;
- bool Column_definition_fix_attributes(Column_definition *c) const;
- bool Item_save_in_value(THD *thd, Item *item, st_value *value) const;
- bool Item_send(Item *item, Protocol *protocol, st_value *buf) const
+ const Type_handler *type_handler_for_comparison() const override;
+ int stored_field_cmp_to_item(THD *thd, Field *field, Item *item)
+ const override;
+ void Column_definition_implicit_upgrade(Column_definition *c) const override;
+ bool Column_definition_fix_attributes(Column_definition *c) const override;
+ bool
+ Column_definition_attributes_frm_unpack(Column_definition_attributes *attr,
+ TABLE_SHARE *share,
+ const uchar *buffer,
+ LEX_CUSTRING *gis_options)
+ const override;
+ bool Item_save_in_value(THD *thd, Item *item, st_value *value) const override;
+ bool Item_send(Item *item, Protocol *protocol, st_value *buf) const override
{
return Item_send_time(item, protocol, buf);
}
- void Item_update_null_value(Item *item) const;
- int Item_save_in_field(Item *item, Field *field, bool no_conversions) const;
- String *print_item_value(THD *thd, Item *item, String *str) const;
- Item_cache *Item_get_cache(THD *thd, const Item *item) const;
- longlong Item_val_int_unsigned_typecast(Item *item) const;
+ void Item_update_null_value(Item *item) const override;
+ int Item_save_in_field(Item *item, Field *field, bool no_conversions)
+ const override;
+ String *print_item_value(THD *thd, Item *item, String *str) const override;
+ Item_cache *Item_get_cache(THD *thd, const Item *item) const override;
+ longlong Item_val_int_unsigned_typecast(Item *item) const override;
bool Item_hybrid_func_fix_attributes(THD *thd,
const char *name,
Type_handler_hybrid_field_type *,
Type_all_attributes *atrr,
- Item **items, uint nitems) const;
+ Item **items, uint nitems)
+ const override;
String *Item_func_hybrid_field_type_val_str(Item_func_hybrid_field_type *,
- String *) const;
+ String *) const override;
double Item_func_hybrid_field_type_val_real(Item_func_hybrid_field_type *)
- const;
+ const override;
longlong Item_func_hybrid_field_type_val_int(Item_func_hybrid_field_type *)
- const;
+ const override;
my_decimal *Item_func_hybrid_field_type_val_decimal(
Item_func_hybrid_field_type *,
- my_decimal *) const;
+ my_decimal *) const override;
void Item_func_hybrid_field_type_get_date(THD *,
Item_func_hybrid_field_type *,
Temporal::Warn *,
MYSQL_TIME *,
- date_mode_t fuzzydate) const;
- String *Item_func_min_max_val_str(Item_func_min_max *, String *) const;
- double Item_func_min_max_val_real(Item_func_min_max *) const;
- longlong Item_func_min_max_val_int(Item_func_min_max *) const;
+ date_mode_t fuzzydate)
+ const override;
+ String *Item_func_min_max_val_str(Item_func_min_max *, String *) const override;
+ double Item_func_min_max_val_real(Item_func_min_max *) const override;
+ longlong Item_func_min_max_val_int(Item_func_min_max *) const override;
my_decimal *Item_func_min_max_val_decimal(Item_func_min_max *,
- my_decimal *) const;
+ my_decimal *) const override;
bool Item_func_min_max_get_date(THD *thd, Item_func_min_max*,
- MYSQL_TIME *, date_mode_t fuzzydate) const;
- longlong Item_func_between_val_int(Item_func_between *func) const;
- bool Item_func_round_fix_length_and_dec(Item_func_round *) const;
- Item *make_const_item_for_comparison(THD *, Item *src, const Item *cmp) const;
- bool set_comparator_func(Arg_comparator *cmp) const;
- cmp_item *make_cmp_item(THD *thd, CHARSET_INFO *cs) const;
- in_vector *make_in_vector(THD *, const Item_func_in *, uint nargs) const;
- void Item_param_set_param_func(Item_param *param,
- uchar **pos, ulong len) const;
+ MYSQL_TIME *, date_mode_t fuzzydate)
+ const override;
+ longlong Item_func_between_val_int(Item_func_between *func) const override;
+ bool Item_func_round_fix_length_and_dec(Item_func_round *) const override;
+ Item *make_const_item_for_comparison(THD *, Item *src, const Item *cmp)
+ const override;
+ bool set_comparator_func(Arg_comparator *cmp) const override;
+ cmp_item *make_cmp_item(THD *thd, CHARSET_INFO *cs) const override;
+ in_vector *make_in_vector(THD *, const Item_func_in *, uint nargs)
+ const override;
+ void Item_param_set_param_func(Item_param *param, uchar **pos, ulong len)
+ const override;
};
@@ -5298,25 +5752,29 @@ class Type_handler_time: public Type_handler_time_common
public:
static uint hires_bytes(uint dec) { return m_hires_bytes[dec]; }
virtual ~Type_handler_time() {}
- const Name version() const { return m_version_mariadb53; }
- uint32 calc_pack_length(uint32 length) const;
- Field *make_conversion_table_field(TABLE *, uint metadata,
- const Field *target) const;
+ const Name version() const override { return version_mariadb53(); }
+ uint32 max_display_length_for_field(const Conv_source &src) const override
+ { return MIN_TIME_WIDTH; }
+ uint32 calc_pack_length(uint32 length) const override;
+ Field *make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table, uint metadata,
+ const Field *target) const override;
bool Column_definition_prepare_stage2(Column_definition *c,
handler *file,
- ulonglong table_flags) const
+ ulonglong table_flags) const override
{ return Column_definition_prepare_stage2_legacy(c, MYSQL_TYPE_TIME); }
- Field *make_table_field(const LEX_CSTRING *name,
+ Field *make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const;
+ TABLE_SHARE *share) const override;
Field *make_table_field_from_def(TABLE_SHARE *share,
MEM_ROOT *mem_root,
const LEX_CSTRING *name,
const Record_addr &addr,
const Bit_addr &bit,
const Column_definition_attributes *attr,
- uint32 flags) const;
+ uint32 flags) const override;
};
@@ -5324,26 +5782,29 @@ class Type_handler_time2: public Type_handler_time_common
{
public:
virtual ~Type_handler_time2() {}
- const Name version() const { return m_version_mysql56; }
- enum_field_types real_field_type() const { return MYSQL_TYPE_TIME2; }
- uint32 calc_pack_length(uint32 length) const;
- Field *make_conversion_table_field(TABLE *, uint metadata,
- const Field *target) const;
+ const Name version() const override { return version_mysql56(); }
+ enum_field_types real_field_type() const override { return MYSQL_TYPE_TIME2; }
+ uint32 max_display_length_for_field(const Conv_source &src) const override;
+ uint32 calc_pack_length(uint32 length) const override;
+ Field *make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table, uint metadata,
+ const Field *target) const override;
bool Column_definition_prepare_stage2(Column_definition *c,
handler *file,
- ulonglong table_flags) const
+ ulonglong table_flags) const override
{ return Column_definition_prepare_stage2_legacy(c, MYSQL_TYPE_TIME2); }
- Field *make_table_field(const LEX_CSTRING *name,
+ Field *make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const;
+ TABLE_SHARE *share) const override;
Field *make_table_field_from_def(TABLE_SHARE *share,
MEM_ROOT *mem_root,
const LEX_CSTRING *name,
const Record_addr &addr,
const Bit_addr &bit,
const Column_definition_attributes *attr,
- uint32 flags) const;
+ uint32 flags) const override;
};
@@ -5352,89 +5813,118 @@ class Type_handler_temporal_with_date: public Type_handler_temporal_result
public:
virtual ~Type_handler_temporal_with_date() {}
Item_literal *create_literal_item(THD *thd, const char *str, size_t length,
- CHARSET_INFO *cs, bool send_error) const;
+ CHARSET_INFO *cs, bool send_error)
+ const override;
bool Item_eq_value(THD *thd, const Type_cmp_attributes *attr,
- Item *a, Item *b) const;
- int stored_field_cmp_to_item(THD *thd, Field *field, Item *item) const;
- bool Item_save_in_value(THD *thd, Item *item, st_value *value) const;
- bool Item_send(Item *item, Protocol *protocol, st_value *buf) const
+ Item *a, Item *b) const override;
+ int stored_field_cmp_to_item(THD *thd, Field *field, Item *item)
+ const override;
+ bool Item_save_in_value(THD *thd, Item *item, st_value *value)
+ const override;
+ bool Item_send(Item *item, Protocol *protocol, st_value *buf) const override
{
return Item_send_date(item, protocol, buf);
}
- void Item_update_null_value(Item *item) const;
- int Item_save_in_field(Item *item, Field *field, bool no_conversions) const;
- Item *make_const_item_for_comparison(THD *, Item *src, const Item *cmp) const;
- bool set_comparator_func(Arg_comparator *cmp) const;
- cmp_item *make_cmp_item(THD *thd, CHARSET_INFO *cs) const;
- in_vector *make_in_vector(THD *, const Item_func_in *, uint nargs) const;
- longlong Item_func_between_val_int(Item_func_between *func) const;
+ void Item_update_null_value(Item *item) const override;
+ int Item_save_in_field(Item *item, Field *field, bool no_conversions)
+ const override;
+ Item *make_const_item_for_comparison(THD *, Item *src, const Item *cmp)
+ const override;
+ bool set_comparator_func(Arg_comparator *cmp) const override;
+ cmp_item *make_cmp_item(THD *thd, CHARSET_INFO *cs) const override;
+ in_vector *make_in_vector(THD *, const Item_func_in *, uint nargs)
+ const override;
+ longlong Item_func_between_val_int(Item_func_between *func) const override;
};
class Type_handler_date_common: public Type_handler_temporal_with_date
{
- static const Name m_name_date;
public:
virtual ~Type_handler_date_common() {}
- const Name name() const { return m_name_date; }
- const Type_handler *type_handler_for_comparison() const;
- enum_field_types field_type() const { return MYSQL_TYPE_DATE; }
- protocol_send_type_t protocol_send_type() const
+ const Name name() const override;
+ const Name &default_value() const override;
+ const Type_handler *type_handler_for_comparison() const override;
+ enum_field_types field_type() const override { return MYSQL_TYPE_DATE; }
+ uint32 max_display_length_for_field(const Conv_source &src) const override
+ { return 3; }
+ enum_dynamic_column_type dyncol_type(const Type_all_attributes *attr)
+ const override
+ {
+ return DYN_COL_DATE;
+ }
+ protocol_send_type_t protocol_send_type() const override
{
return PROTOCOL_SEND_DATE;
}
- enum_mysql_timestamp_type mysql_timestamp_type() const
+ enum_mysql_timestamp_type mysql_timestamp_type() const override
{
return MYSQL_TIMESTAMP_DATE;
}
- bool cond_notnull_field_isnull_to_field_eq_zero() const
+ bool cond_notnull_field_isnull_to_field_eq_zero() const override
{
return true;
}
+ Field *make_schema_field(MEM_ROOT *root,
+ TABLE *table,
+ const Record_addr &addr,
+ const ST_FIELD_INFO &def,
+ bool show_field) const override;
Item_literal *create_literal_item(THD *thd, const char *str, size_t length,
- CHARSET_INFO *cs, bool send_error) const;
+ CHARSET_INFO *cs, bool send_error)
+ const override;
Item *create_typecast_item(THD *thd, Item *item,
- const Type_cast_attributes &attr) const;
- bool Column_definition_fix_attributes(Column_definition *c) const;
- uint Item_decimal_precision(const Item *item) const;
- String *print_item_value(THD *thd, Item *item, String *str) const;
- Item_cache *Item_get_cache(THD *thd, const Item *item) const;
- String *Item_func_min_max_val_str(Item_func_min_max *, String *) const;
- double Item_func_min_max_val_real(Item_func_min_max *) const;
- longlong Item_func_min_max_val_int(Item_func_min_max *) const;
+ const Type_cast_attributes &attr)
+ const override;
+ bool validate_implicit_default_value(THD *thd,
+ const Column_definition &def)
+ const override;
+ bool Column_definition_fix_attributes(Column_definition *c) const override;
+ void
+ Column_definition_attributes_frm_pack(const Column_definition_attributes *at,
+ uchar *buff) const override;
+ uint Item_decimal_precision(const Item *item) const override;
+ String *print_item_value(THD *thd, Item *item, String *str) const override;
+ Item_cache *Item_get_cache(THD *thd, const Item *item) const override;
+ String *Item_func_min_max_val_str(Item_func_min_max *, String *) const override;
+ double Item_func_min_max_val_real(Item_func_min_max *) const override;
+ longlong Item_func_min_max_val_int(Item_func_min_max *) const override;
my_decimal *Item_func_min_max_val_decimal(Item_func_min_max *,
- my_decimal *) const;
+ my_decimal *) const override;
bool Item_hybrid_func_fix_attributes(THD *thd,
const char *name,
Type_handler_hybrid_field_type *,
Type_all_attributes *atrr,
- Item **items, uint nitems) const;
+ Item **items, uint nitems)
+ const override;
void Item_param_set_param_func(Item_param *param,
- uchar **pos, ulong len) const;
+ uchar **pos, ulong len) const override;
};
class Type_handler_date: public Type_handler_date_common
{
public:
virtual ~Type_handler_date() {}
- uint32 calc_pack_length(uint32 length) const { return 4; }
- Field *make_conversion_table_field(TABLE *, uint metadata,
- const Field *target) const;
+ uint32 calc_pack_length(uint32 length) const override { return 4; }
+ Field *make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table, uint metadata,
+ const Field *target) const override;
bool Column_definition_prepare_stage2(Column_definition *c,
handler *file,
- ulonglong table_flags) const
+ ulonglong table_flags) const override
{ return Column_definition_prepare_stage2_legacy(c, MYSQL_TYPE_DATE); }
- Field *make_table_field(const LEX_CSTRING *name,
+ Field *make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const;
+ TABLE_SHARE *share) const override;
Field *make_table_field_from_def(TABLE_SHARE *share,
MEM_ROOT *mem_root,
const LEX_CSTRING *name,
const Record_addr &addr,
const Bit_addr &bit,
const Column_definition_attributes *attr,
- uint32 flags) const;
+ uint32 flags) const override;
};
@@ -5442,80 +5932,107 @@ class Type_handler_newdate: public Type_handler_date_common
{
public:
virtual ~Type_handler_newdate() {}
- enum_field_types real_field_type() const { return MYSQL_TYPE_NEWDATE; }
- uint32 calc_pack_length(uint32 length) const { return 3; }
- Field *make_conversion_table_field(TABLE *, uint metadata,
- const Field *target) const;
+ enum_field_types real_field_type() const override
+ {
+ return MYSQL_TYPE_NEWDATE;
+ }
+ uint32 calc_pack_length(uint32 length) const override { return 3; }
+ Field *make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table, uint metadata,
+ const Field *target) const override;
bool Column_definition_prepare_stage2(Column_definition *c,
handler *file,
- ulonglong table_flags) const
+ ulonglong table_flags) const override
{ return Column_definition_prepare_stage2_legacy(c, MYSQL_TYPE_NEWDATE); }
- Field *make_table_field(const LEX_CSTRING *name,
+ Field *make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const;
+ TABLE_SHARE *share) const override;
Field *make_table_field_from_def(TABLE_SHARE *share,
MEM_ROOT *mem_root,
const LEX_CSTRING *name,
const Record_addr &addr,
const Bit_addr &bit,
const Column_definition_attributes *attr,
- uint32 flags) const;
+ uint32 flags) const override;
};
class Type_handler_datetime_common: public Type_handler_temporal_with_date
{
- static const Name m_name_datetime;
public:
virtual ~Type_handler_datetime_common() {}
- const Name name() const { return m_name_datetime; }
- const Type_handler *type_handler_for_comparison() const;
- enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; }
- protocol_send_type_t protocol_send_type() const
+ const Name name() const override;
+ const Name &default_value() const override;
+ const Type_handler *type_handler_for_comparison() const override;
+ enum_field_types field_type() const override
+ {
+ return MYSQL_TYPE_DATETIME;
+ }
+ enum_dynamic_column_type dyncol_type(const Type_all_attributes *attr)
+ const override
+ {
+ return DYN_COL_DATETIME;
+ }
+ protocol_send_type_t protocol_send_type() const override
{
return PROTOCOL_SEND_DATETIME;
}
- enum_mysql_timestamp_type mysql_timestamp_type() const
+ enum_mysql_timestamp_type mysql_timestamp_type() const override
{
return MYSQL_TIMESTAMP_DATETIME;
}
- bool cond_notnull_field_isnull_to_field_eq_zero() const
+ bool cond_notnull_field_isnull_to_field_eq_zero() const override
{
return true;
}
+ Field *make_schema_field(MEM_ROOT *root,
+ TABLE *table,
+ const Record_addr &addr,
+ const ST_FIELD_INFO &def,
+ bool show_field) const override;
Item *create_typecast_item(THD *thd, Item *item,
- const Type_cast_attributes &attr) const;
- void Column_definition_implicit_upgrade(Column_definition *c) const;
- bool Column_definition_fix_attributes(Column_definition *c) const;
- uint Item_decimal_scale(const Item *item) const
+ const Type_cast_attributes &attr) const override;
+ bool validate_implicit_default_value(THD *thd, const Column_definition &def)
+ const override;
+ void Column_definition_implicit_upgrade(Column_definition *c) const override;
+ bool Column_definition_fix_attributes(Column_definition *c) const override;
+ bool
+ Column_definition_attributes_frm_unpack(Column_definition_attributes *attr,
+ TABLE_SHARE *share,
+ const uchar *buffer,
+ LEX_CUSTRING *gis_options)
+ const override;
+ uint Item_decimal_scale(const Item *item) const override
{
return Item_decimal_scale_with_seconds(item);
}
- uint Item_decimal_precision(const Item *item) const;
- uint Item_divisor_precision_increment(const Item *item) const
+ uint Item_decimal_precision(const Item *item) const override;
+ uint Item_divisor_precision_increment(const Item *item) const override
{
return Item_divisor_precision_increment_with_seconds(item);
}
- bool Item_send(Item *item, Protocol *protocol, st_value *buf) const
+ bool Item_send(Item *item, Protocol *protocol, st_value *buf) const override
{
return Item_send_datetime(item, protocol, buf);
}
- String *print_item_value(THD *thd, Item *item, String *str) const;
- Item_cache *Item_get_cache(THD *thd, const Item *item) const;
- String *Item_func_min_max_val_str(Item_func_min_max *, String *) const;
- double Item_func_min_max_val_real(Item_func_min_max *) const;
- longlong Item_func_min_max_val_int(Item_func_min_max *) const;
- my_decimal *Item_func_min_max_val_decimal(Item_func_min_max *,
- my_decimal *) const;
- bool Item_func_round_fix_length_and_dec(Item_func_round *) const;
+ String *print_item_value(THD *thd, Item *item, String *str) const override;
+ Item_cache *Item_get_cache(THD *thd, const Item *item) const override;
+ String *Item_func_min_max_val_str(Item_func_min_max *, String *) const override;
+ double Item_func_min_max_val_real(Item_func_min_max *) const override;
+ longlong Item_func_min_max_val_int(Item_func_min_max *) const override;
+ my_decimal *Item_func_min_max_val_decimal(Item_func_min_max *, my_decimal *)
+ const override;
+ bool Item_func_round_fix_length_and_dec(Item_func_round *) const override;
bool Item_hybrid_func_fix_attributes(THD *thd,
const char *name,
Type_handler_hybrid_field_type *,
Type_all_attributes *atrr,
- Item **items, uint nitems) const;
- void Item_param_set_param_func(Item_param *param,
- uchar **pos, ulong len) const;
+ Item **items, uint nitems)
+ const override;
+ void Item_param_set_param_func(Item_param *param, uchar **pos, ulong len)
+ const override;
};
@@ -5526,25 +6043,29 @@ class Type_handler_datetime: public Type_handler_datetime_common
public:
static uint hires_bytes(uint dec) { return m_hires_bytes[dec]; }
virtual ~Type_handler_datetime() {}
- const Name version() const { return m_version_mariadb53; }
- uint32 calc_pack_length(uint32 length) const;
- Field *make_conversion_table_field(TABLE *, uint metadata,
- const Field *target) const;
+ const Name version() const override { return version_mariadb53(); }
+ uint32 max_display_length_for_field(const Conv_source &src) const override
+ { return MAX_DATETIME_WIDTH; }
+ uint32 calc_pack_length(uint32 length) const override;
+ Field *make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table, uint metadata,
+ const Field *target) const override;
bool Column_definition_prepare_stage2(Column_definition *c,
handler *file,
- ulonglong table_flags) const
+ ulonglong table_flags) const override
{ return Column_definition_prepare_stage2_legacy(c, MYSQL_TYPE_DATETIME); }
- Field *make_table_field(const LEX_CSTRING *name,
+ Field *make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const;
+ TABLE_SHARE *share) const override;
Field *make_table_field_from_def(TABLE_SHARE *share,
MEM_ROOT *mem_root,
const LEX_CSTRING *name,
const Record_addr &addr,
const Bit_addr &bit,
const Column_definition_attributes *attr,
- uint32 flags) const;
+ uint32 flags) const override;
};
@@ -5552,105 +6073,129 @@ class Type_handler_datetime2: public Type_handler_datetime_common
{
public:
virtual ~Type_handler_datetime2() {}
- const Name version() const { return m_version_mysql56; }
- enum_field_types real_field_type() const { return MYSQL_TYPE_DATETIME2; }
- uint32 calc_pack_length(uint32 length) const;
- Field *make_conversion_table_field(TABLE *, uint metadata,
- const Field *target) const;
+ const Name version() const override { return version_mysql56(); }
+ enum_field_types real_field_type() const override
+ {
+ return MYSQL_TYPE_DATETIME2;
+ }
+ uint32 max_display_length_for_field(const Conv_source &src) const override;
+ uint32 calc_pack_length(uint32 length) const override;
+ Field *make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table, uint metadata,
+ const Field *target) const override;
bool Column_definition_prepare_stage2(Column_definition *c,
handler *file,
- ulonglong table_flags) const
+ ulonglong table_flags) const override
{ return Column_definition_prepare_stage2_legacy(c, MYSQL_TYPE_DATETIME2); }
- Field *make_table_field(const LEX_CSTRING *name,
+ Field *make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const;
+ TABLE_SHARE *share) const override;
Field *make_table_field_from_def(TABLE_SHARE *share,
MEM_ROOT *mem_root,
const LEX_CSTRING *name,
const Record_addr &addr,
const Bit_addr &bit,
const Column_definition_attributes *attr,
- uint32 flags) const;
+ uint32 flags) const override;
};
class Type_handler_timestamp_common: public Type_handler_temporal_with_date
{
- static const Name m_name_timestamp;
protected:
bool TIME_to_native(THD *, const MYSQL_TIME *from, Native *to, uint dec) const;
public:
virtual ~Type_handler_timestamp_common() {}
- const Name name() const { return m_name_timestamp; }
- const Type_handler *type_handler_for_comparison() const;
- const Type_handler *type_handler_for_native_format() const;
- enum_field_types field_type() const { return MYSQL_TYPE_TIMESTAMP; }
- protocol_send_type_t protocol_send_type() const
+ const Name name() const override;
+ const Name &default_value() const override;
+ const Type_handler *type_handler_for_comparison() const override;
+ const Type_handler *type_handler_for_native_format() const override;
+ enum_field_types field_type() const override { return MYSQL_TYPE_TIMESTAMP; }
+ enum_dynamic_column_type dyncol_type(const Type_all_attributes *attr)
+ const override
+ {
+ return DYN_COL_DATETIME;
+ }
+ protocol_send_type_t protocol_send_type() const override
{
return PROTOCOL_SEND_DATETIME;
}
- enum_mysql_timestamp_type mysql_timestamp_type() const
+ enum_mysql_timestamp_type mysql_timestamp_type() const override
{
return MYSQL_TIMESTAMP_DATETIME;
}
- bool is_val_native_ready() const
+ bool is_val_native_ready() const override
{
return true;
}
- bool is_timestamp_type() const
+ bool is_timestamp_type() const override
{
return true;
}
- void Column_definition_implicit_upgrade(Column_definition *c) const;
+ void Column_definition_implicit_upgrade(Column_definition *c) const override;
+ bool
+ Column_definition_attributes_frm_unpack(Column_definition_attributes *attr,
+ TABLE_SHARE *share,
+ const uchar *buffer,
+ LEX_CUSTRING *gis_options)
+ const override;
bool Item_eq_value(THD *thd, const Type_cmp_attributes *attr,
- Item *a, Item *b) const;
- bool Item_val_native_with_conversion(THD *thd, Item *, Native *to) const;
- bool Item_val_native_with_conversion_result(THD *thd, Item *, Native *to) const;
- bool Item_param_val_native(THD *thd, Item_param *item, Native *to) const;
- int cmp_native(const Native &a, const Native &b) const;
- longlong Item_func_between_val_int(Item_func_between *func) const;
- bool Item_func_round_fix_length_and_dec(Item_func_round *) const;
- cmp_item *make_cmp_item(THD *thd, CHARSET_INFO *cs) const;
- in_vector *make_in_vector(THD *thd, const Item_func_in *f, uint nargs) const;
+ Item *a, Item *b) const override;
+ bool Item_val_native_with_conversion(THD *thd, Item *, Native *to)
+ const override;
+ bool Item_val_native_with_conversion_result(THD *thd, Item *, Native *to)
+ const override;
+ bool Item_param_val_native(THD *thd, Item_param *item, Native *to)
+ const override;
+ int cmp_native(const Native &a, const Native &b) const override;
+ longlong Item_func_between_val_int(Item_func_between *func) const override;
+ bool Item_func_round_fix_length_and_dec(Item_func_round *) const override;
+ cmp_item *make_cmp_item(THD *thd, CHARSET_INFO *cs) const override;
+ in_vector *make_in_vector(THD *thd, const Item_func_in *f, uint nargs)
+ const override;
void make_sort_key(uchar *to, Item *item, const SORT_FIELD_ATTR *sort_field,
- Sort_param *param) const;
+ Sort_param *param) const override;
void sortlength(THD *thd,
const Type_std_attributes *item,
- SORT_FIELD_ATTR *attr) const;
- bool Column_definition_fix_attributes(Column_definition *c) const;
- uint Item_decimal_scale(const Item *item) const
+ SORT_FIELD_ATTR *attr) const override;
+ bool Column_definition_fix_attributes(Column_definition *c) const override;
+ uint Item_decimal_scale(const Item *item) const override
{
return Item_decimal_scale_with_seconds(item);
}
- uint Item_decimal_precision(const Item *item) const;
- uint Item_divisor_precision_increment(const Item *item) const
+ uint Item_decimal_precision(const Item *item) const override;
+ uint Item_divisor_precision_increment(const Item *item) const override
{
return Item_divisor_precision_increment_with_seconds(item);
}
- bool Item_send(Item *item, Protocol *protocol, st_value *buf) const
+ bool Item_send(Item *item, Protocol *protocol, st_value *buf) const override
{
return Item_send_timestamp(item, protocol, buf);
}
- int Item_save_in_field(Item *item, Field *field, bool no_conversions) const;
- String *print_item_value(THD *thd, Item *item, String *str) const;
- Item_cache *Item_get_cache(THD *thd, const Item *item) const;
- Item_copy *create_item_copy(THD *thd, Item *item) const;
- String *Item_func_min_max_val_str(Item_func_min_max *, String *) const;
- double Item_func_min_max_val_real(Item_func_min_max *) const;
- longlong Item_func_min_max_val_int(Item_func_min_max *) const;
+ int Item_save_in_field(Item *item, Field *field, bool no_conversions)
+ const override;
+ String *print_item_value(THD *thd, Item *item, String *str) const override;
+ Item_cache *Item_get_cache(THD *thd, const Item *item) const override;
+ Item_copy *create_item_copy(THD *thd, Item *item) const override;
+ String *Item_func_min_max_val_str(Item_func_min_max *, String *) const override;
+ double Item_func_min_max_val_real(Item_func_min_max *) const override;
+ longlong Item_func_min_max_val_int(Item_func_min_max *) const override;
my_decimal *Item_func_min_max_val_decimal(Item_func_min_max *,
- my_decimal *) const;
- bool set_comparator_func(Arg_comparator *cmp) const;
+ my_decimal *) const override;
+ bool set_comparator_func(Arg_comparator *cmp) const override;
bool Item_hybrid_func_fix_attributes(THD *thd,
const char *name,
Type_handler_hybrid_field_type *,
Type_all_attributes *atrr,
- Item **items, uint nitems) const;
+ Item **items, uint nitems)
+ const override;
void Item_param_set_param_func(Item_param *param,
- uchar **pos, ulong len) const;
+ uchar **pos, ulong len) const override;
bool Item_func_min_max_get_date(THD *thd, Item_func_min_max*,
- MYSQL_TIME *, date_mode_t fuzzydate) const;
+ MYSQL_TIME *, date_mode_t fuzzydate)
+ const override;
};
@@ -5661,25 +6206,29 @@ class Type_handler_timestamp: public Type_handler_timestamp_common
public:
static uint sec_part_bytes(uint dec) { return m_sec_part_bytes[dec]; }
virtual ~Type_handler_timestamp() {}
- const Name version() const { return m_version_mariadb53; }
- uint32 calc_pack_length(uint32 length) const;
- Field *make_conversion_table_field(TABLE *, uint metadata,
- const Field *target) const;
+ const Name version() const override { return version_mariadb53(); }
+ uint32 max_display_length_for_field(const Conv_source &src) const override
+ { return MAX_DATETIME_WIDTH; }
+ uint32 calc_pack_length(uint32 length) const override;
+ Field *make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table, uint metadata,
+ const Field *target) const override;
bool Column_definition_prepare_stage2(Column_definition *c,
handler *file,
- ulonglong table_flags) const
+ ulonglong table_flags) const override
{ return Column_definition_prepare_stage2_legacy_num(c, MYSQL_TYPE_TIMESTAMP); }
- Field *make_table_field(const LEX_CSTRING *name,
+ Field *make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const;
+ TABLE_SHARE *share) const override;
Field *make_table_field_from_def(TABLE_SHARE *share,
MEM_ROOT *mem_root,
const LEX_CSTRING *name,
const Record_addr &addr,
const Bit_addr &bit,
const Column_definition_attributes *attr,
- uint32 flags) const;
+ uint32 flags) const override;
};
@@ -5687,151 +6236,179 @@ class Type_handler_timestamp2: public Type_handler_timestamp_common
{
public:
virtual ~Type_handler_timestamp2() {}
- const Name version() const { return m_version_mysql56; }
- enum_field_types real_field_type() const { return MYSQL_TYPE_TIMESTAMP2; }
- uint32 calc_pack_length(uint32 length) const;
- Field *make_conversion_table_field(TABLE *, uint metadata,
- const Field *target) const;
+ const Name version() const override { return version_mysql56(); }
+ enum_field_types real_field_type() const override
+ {
+ return MYSQL_TYPE_TIMESTAMP2;
+ }
+ uint32 max_display_length_for_field(const Conv_source &src) const override;
+ uint32 calc_pack_length(uint32 length) const override;
+ Field *make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table, uint metadata,
+ const Field *target) const override;
bool Column_definition_prepare_stage2(Column_definition *c,
handler *file,
- ulonglong table_flags) const
+ ulonglong table_flags) const override
{
return Column_definition_prepare_stage2_legacy_num(c, MYSQL_TYPE_TIMESTAMP2);
}
- Field *make_table_field(const LEX_CSTRING *name,
+ Field *make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const;
+ TABLE_SHARE *share) const override;
Field *make_table_field_from_def(TABLE_SHARE *share,
MEM_ROOT *mem_root,
const LEX_CSTRING *name,
const Record_addr &addr,
const Bit_addr &bit,
const Column_definition_attributes *attr,
- uint32 flags) const;
+ uint32 flags) const override;
};
class Type_handler_olddecimal: public Type_handler_decimal_result
{
- static const Name m_name_decimal;
public:
virtual ~Type_handler_olddecimal() {}
- const Name name() const { return m_name_decimal; }
- enum_field_types field_type() const { return MYSQL_TYPE_DECIMAL; }
- uint32 calc_pack_length(uint32 length) const { return length; }
- const Type_handler *type_handler_for_tmp_table(const Item *item) const;
- const Type_handler *type_handler_for_union(const Item *item) const;
- Field *make_conversion_table_field(TABLE *, uint metadata,
- const Field *target) const;
- bool Column_definition_fix_attributes(Column_definition *c) const;
+ const Name name() const override;
+ enum_field_types field_type() const override { return MYSQL_TYPE_DECIMAL; }
+ uint32 max_display_length_for_field(const Conv_source &src) const override;
+ uint32 calc_pack_length(uint32 length) const override { return length; }
+ const Type_handler *type_handler_for_tmp_table(const Item *item) const override;
+ const Type_handler *type_handler_for_union(const Item *item) const override;
+ void show_binlog_type(const Conv_source &src, const Field &, String *str)
+ const override;
+ Field *make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table, uint metadata,
+ const Field *target) const override;
+ bool Column_definition_fix_attributes(Column_definition *c) const override;
bool Column_definition_prepare_stage2(Column_definition *c,
handler *file,
- ulonglong table_flags) const
+ ulonglong table_flags) const override
{ return Column_definition_prepare_stage2_legacy_num(c, MYSQL_TYPE_DECIMAL); }
- Field *make_table_field(const LEX_CSTRING *name,
+ Field *make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const;
+ TABLE_SHARE *share) const override;
Field *make_table_field_from_def(TABLE_SHARE *share,
MEM_ROOT *mem_root,
const LEX_CSTRING *name,
const Record_addr &addr,
const Bit_addr &bit,
const Column_definition_attributes *attr,
- uint32 flags) const;
+ uint32 flags) const override;
};
class Type_handler_newdecimal: public Type_handler_decimal_result
{
- static const Name m_name_decimal;
public:
virtual ~Type_handler_newdecimal() {}
- const Name name() const { return m_name_decimal; }
- enum_field_types field_type() const { return MYSQL_TYPE_NEWDECIMAL; }
- uint32 calc_pack_length(uint32 length) const;
- Field *make_conversion_table_field(TABLE *, uint metadata,
- const Field *target) const;
- bool Column_definition_fix_attributes(Column_definition *c) const;
+ const Name name() const override;
+ enum_field_types field_type() const override { return MYSQL_TYPE_NEWDECIMAL; }
+ uint32 max_display_length_for_field(const Conv_source &src) const override;
+ uint32 calc_pack_length(uint32 length) const override;
+ uint calc_key_length(const Column_definition &def) const override;
+ void show_binlog_type(const Conv_source &src, const Field &, String *str)
+ const override;
+ Field *make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table, uint metadata,
+ const Field *target) const override;
+ bool Column_definition_fix_attributes(Column_definition *c) const override;
bool Column_definition_prepare_stage1(THD *thd,
MEM_ROOT *mem_root,
Column_definition *c,
handler *file,
- ulonglong table_flags) const;
+ ulonglong table_flags) const override;
bool Column_definition_redefine_stage1(Column_definition *def,
const Column_definition *dup,
const handler *file,
const Schema_specification_st *schema)
- const;
+ const override;
bool Column_definition_prepare_stage2(Column_definition *c,
handler *file,
- ulonglong table_flags) const;
- Field *make_table_field(const LEX_CSTRING *name,
+ ulonglong table_flags) const override;
+ Field *make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const;
+ TABLE_SHARE *share) const override;
Field *make_table_field_from_def(TABLE_SHARE *share,
MEM_ROOT *mem_root,
const LEX_CSTRING *name,
const Record_addr &addr,
const Bit_addr &bit,
const Column_definition_attributes *attr,
- uint32 flags) const;
+ uint32 flags) const override;
};
class Type_handler_null: public Type_handler_general_purpose_string
{
- static const Name m_name_null;
public:
virtual ~Type_handler_null() {}
- const Name name() const { return m_name_null; }
- enum_field_types field_type() const { return MYSQL_TYPE_NULL; }
- const Type_handler *type_handler_for_comparison() const;
- const Type_handler *type_handler_for_tmp_table(const Item *item) const;
- const Type_handler *type_handler_for_union(const Item *) const;
- uint32 max_display_length(const Item *item) const { return 0; }
- uint32 calc_pack_length(uint32 length) const { return 0; }
+ const Name name() const override;
+ enum_field_types field_type() const override { return MYSQL_TYPE_NULL; }
+ enum_dynamic_column_type dyncol_type(const Type_all_attributes *attr)
+ const override
+ {
+ return DYN_COL_NULL;
+ }
+ const Type_handler *type_handler_for_comparison() const override;
+ const Type_handler *type_handler_for_tmp_table(const Item *item) const override;
+ const Type_handler *type_handler_for_union(const Item *) const override;
+ uint32 max_display_length(const Item *item) const override { return 0; }
+ uint32 max_display_length_for_field(const Conv_source &src) const override
+ {
+ return 0;
+ }
+ uint32 calc_pack_length(uint32 length) const override { return 0; }
bool Item_const_eq(const Item_const *a, const Item_const *b,
- bool binary_cmp) const;
- bool Item_save_in_value(THD *thd, Item *item, st_value *value) const;
- bool Item_send(Item *item, Protocol *protocol, st_value *buf) const;
- Field *make_conversion_table_field(TABLE *, uint metadata,
- const Field *target) const;
- bool Column_definition_fix_attributes(Column_definition *c) const;
+ bool binary_cmp) const override;
+ bool Item_save_in_value(THD *thd, Item *item, st_value *value) const override;
+ bool Item_send(Item *item, Protocol *protocol, st_value *buf) const override;
+ Field *make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table, uint metadata,
+ const Field *target) const override;
+ bool Column_definition_fix_attributes(Column_definition *c) const override;
bool Column_definition_prepare_stage1(THD *thd,
MEM_ROOT *mem_root,
Column_definition *c,
handler *file,
- ulonglong table_flags) const;
+ ulonglong table_flags) const override;
bool Column_definition_redefine_stage1(Column_definition *def,
const Column_definition *dup,
const handler *file,
const Schema_specification_st *schema)
- const;
+ const override;
bool Column_definition_prepare_stage2(Column_definition *c,
handler *file,
- ulonglong table_flags) const
+ ulonglong table_flags) const override
{ return Column_definition_prepare_stage2_legacy(c, MYSQL_TYPE_NULL); }
- Field *make_table_field(const LEX_CSTRING *name,
+ void
+ Column_definition_attributes_frm_pack(const Column_definition_attributes *at,
+ uchar *buff) const override;
+ Field *make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const;
+ TABLE_SHARE *share) const override;
Field *make_table_field_from_def(TABLE_SHARE *share,
MEM_ROOT *mem_root,
const LEX_CSTRING *name,
const Record_addr &addr,
const Bit_addr &bit,
const Column_definition_attributes *attr,
- uint32 flags) const;
+ uint32 flags) const override;
};
class Type_handler_longstr: public Type_handler_general_purpose_string
{
public:
- bool type_can_have_key_part() const
+ bool type_can_have_key_part() const override
{
return true;
}
@@ -5840,61 +6417,73 @@ public:
class Type_handler_string: public Type_handler_longstr
{
- static const Name m_name_char;
public:
virtual ~Type_handler_string() {}
- const Name name() const { return m_name_char; }
- enum_field_types field_type() const { return MYSQL_TYPE_STRING; }
- bool is_param_long_data_type() const { return true; }
- uint32 calc_pack_length(uint32 length) const { return length; }
- const Type_handler *type_handler_for_tmp_table(const Item *item) const
+ const Name name() const override;
+ enum_field_types field_type() const override { return MYSQL_TYPE_STRING; }
+ ulong KEY_pack_flags(uint column_nr) const override
+ {
+ return HA_PACK_KEY;
+ }
+ bool is_param_long_data_type() const override { return true; }
+ uint32 max_display_length_for_field(const Conv_source &src) const override;
+ uint32 calc_pack_length(uint32 length) const override { return length; }
+ const Type_handler *type_handler_for_tmp_table(const Item *item) const override
{
return varstring_type_handler(item);
}
- Field *make_conversion_table_field(TABLE *, uint metadata,
- const Field *target) const;
- bool Column_definition_fix_attributes(Column_definition *c) const;
+ void show_binlog_type(const Conv_source &src, const Field &dst, String *str)
+ const override;
+ Field *make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table, uint metadata,
+ const Field *target) const override;
+ bool Column_definition_fix_attributes(Column_definition *c) const override;
bool Column_definition_prepare_stage2(Column_definition *c,
handler *file,
- ulonglong table_flags) const;
- Field *make_table_field(const LEX_CSTRING *name,
+ ulonglong table_flags) const override;
+ bool Key_part_spec_init_ft(Key_part_spec *part,
+ const Column_definition &def) const override;
+ Field *make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const;
+ TABLE_SHARE *share) const override;
Field *make_table_field_from_def(TABLE_SHARE *share,
MEM_ROOT *mem_root,
const LEX_CSTRING *name,
const Record_addr &addr,
const Bit_addr &bit,
const Column_definition_attributes *attr,
- uint32 flags) const;
+ uint32 flags) const override;
};
/* Old varchar */
class Type_handler_var_string: public Type_handler_string
{
- static const Name m_name_var_string;
public:
virtual ~Type_handler_var_string() {}
- const Name name() const { return m_name_var_string; }
- enum_field_types field_type() const { return MYSQL_TYPE_VAR_STRING; }
- enum_field_types real_field_type() const { return MYSQL_TYPE_STRING; }
- enum_field_types traditional_merge_field_type() const
+ const Name name() const override;
+ enum_field_types field_type() const override { return MYSQL_TYPE_VAR_STRING; }
+ enum_field_types real_field_type() const override { return MYSQL_TYPE_STRING; }
+ enum_field_types traditional_merge_field_type() const override
{
return MYSQL_TYPE_VARCHAR;
}
- const Type_handler *type_handler_for_tmp_table(const Item *item) const
+ const Type_handler *type_handler_for_tmp_table(const Item *item) const override
{
return varstring_type_handler(item);
}
- void Column_definition_implicit_upgrade(Column_definition *c) const;
- bool Column_definition_fix_attributes(Column_definition *c) const;
+ uint32 max_display_length_for_field(const Conv_source &src) const override;
+ void show_binlog_type(const Conv_source &src, const Field &dst, String *str)
+ const override;
+ void Column_definition_implicit_upgrade(Column_definition *c) const override;
+ bool Column_definition_fix_attributes(Column_definition *c) const override;
bool Column_definition_prepare_stage2(Column_definition *c,
handler *file,
- ulonglong table_flags) const
+ ulonglong table_flags) const override
{ return Column_definition_prepare_stage2_legacy_num(c, MYSQL_TYPE_STRING); }
- const Type_handler *type_handler_for_union(const Item *item) const
+ const Type_handler *type_handler_for_union(const Item *item) const override
{
return varstring_type_handler(item);
}
@@ -5903,65 +6492,99 @@ public:
class Type_handler_varchar: public Type_handler_longstr
{
- static const Name m_name_varchar;
public:
virtual ~Type_handler_varchar() {}
- const Name name() const { return m_name_varchar; }
- enum_field_types field_type() const { return MYSQL_TYPE_VARCHAR; }
- enum_field_types type_code_for_protocol() const
+ const Name name() const override;
+ enum_field_types field_type() const override { return MYSQL_TYPE_VARCHAR; }
+ ulong KEY_pack_flags(uint column_nr) const override
+ {
+ if (column_nr == 0)
+ return HA_BINARY_PACK_KEY | HA_VAR_LENGTH_KEY;
+ return HA_PACK_KEY;
+ }
+ enum_field_types type_code_for_protocol() const override
{
return MYSQL_TYPE_VAR_STRING; // Keep things compatible for old clients
}
- uint32 calc_pack_length(uint32 length) const
+ uint32 max_display_length_for_field(const Conv_source &src) const override;
+ uint32 calc_pack_length(uint32 length) const override
{
return (length + (length < 256 ? 1: 2));
}
- const Type_handler *type_handler_for_tmp_table(const Item *item) const
+ const Type_handler *type_handler_for_tmp_table(const Item *item) const override
{
return varstring_type_handler(item);
}
- const Type_handler *type_handler_for_union(const Item *item) const
+ const Type_handler *type_handler_for_union(const Item *item) const override
{
return varstring_type_handler(item);
}
- bool is_param_long_data_type() const { return true; }
- Field *make_conversion_table_field(TABLE *, uint metadata,
- const Field *target) const;
- bool Column_definition_fix_attributes(Column_definition *c) const;
+ bool is_param_long_data_type() const override { return true; }
+ void show_binlog_type(const Conv_source &src, const Field &dst, String *str)
+ const override;
+ Field *make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table, uint metadata,
+ const Field *target) const override;
+ bool Column_definition_fix_attributes(Column_definition *c) const override;
bool Column_definition_prepare_stage2(Column_definition *c,
handler *file,
- ulonglong table_flags) const;
- Field *make_table_field(const LEX_CSTRING *name,
+ ulonglong table_flags) const override;
+ bool Key_part_spec_init_ft(Key_part_spec *part,
+ const Column_definition &def) const override;
+ Field *make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const;
+ TABLE_SHARE *share) const override;
+ Field *make_schema_field(MEM_ROOT *root,
+ TABLE *table,
+ const Record_addr &addr,
+ const ST_FIELD_INFO &def,
+ bool show_field) const override;
Field *make_table_field_from_def(TABLE_SHARE *share,
MEM_ROOT *mem_root,
const LEX_CSTRING *name,
const Record_addr &addr,
const Bit_addr &bit,
const Column_definition_attributes *attr,
- uint32 flags) const;
- bool adjust_spparam_type(Spvar_definition *def, Item *from) const;
+ uint32 flags) const override;
+ bool adjust_spparam_type(Spvar_definition *def, Item *from) const override;
};
class Type_handler_hex_hybrid: public Type_handler_varchar
{
- static const Name m_name_hex_hybrid;
public:
virtual ~Type_handler_hex_hybrid() {}
- const Name name() const { return m_name_hex_hybrid; }
- const Type_handler *cast_to_int_type_handler() const;
- const Type_handler *type_handler_for_system_time() const;
+ const Name name() const override;
+ const Type_handler *cast_to_int_type_handler() const override;
};
class Type_handler_varchar_compressed: public Type_handler_varchar
{
public:
- Field *make_conversion_table_field(TABLE *, uint metadata,
- const Field *target) const;
+ enum_field_types real_field_type() const override
+ {
+ return MYSQL_TYPE_VARCHAR_COMPRESSED;
+ }
+ ulong KEY_pack_flags(uint column_nr) const override
+ {
+ DBUG_ASSERT(0);
+ return 0;
+ }
+ uint32 max_display_length_for_field(const Conv_source &src) const override;
+ void show_binlog_type(const Conv_source &src, const Field &dst, String *str)
+ const override;
+ Field *make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table, uint metadata,
+ const Field *target) const override;
+ enum_dynamic_column_type dyncol_type(const Type_all_attributes *attr)
+ const override
+ {
+ DBUG_ASSERT(0);
+ return DYN_COL_STRING;
+ }
};
@@ -5969,311 +6592,292 @@ class Type_handler_blob_common: public Type_handler_longstr
{
public:
virtual ~Type_handler_blob_common() { }
- Field *make_conversion_table_field(TABLE *, uint metadata,
- const Field *target) const;
+ virtual uint length_bytes() const= 0;
+ ulong KEY_pack_flags(uint column_nr) const override
+ {
+ if (column_nr == 0)
+ return HA_BINARY_PACK_KEY | HA_VAR_LENGTH_KEY;
+ return HA_PACK_KEY;
+ }
+ Field *make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table, uint metadata,
+ const Field *target) const override;
const Type_handler *type_handler_for_tmp_table(const Item *item) const
+ override
{
return blob_type_handler(item);
}
- const Type_handler *type_handler_for_union(const Item *item) const
+ const Type_handler *type_handler_for_union(const Item *item) const override
{
return blob_type_handler(item);
}
bool subquery_type_allows_materialization(const Item *inner,
- const Item *outer) const
+ const Item *outer) const override
{
return false; // Materialization does not work with BLOB columns
}
- bool is_param_long_data_type() const { return true; }
- bool Column_definition_fix_attributes(Column_definition *c) const;
- void Column_definition_reuse_fix_attributes(THD *thd,
- Column_definition *c,
- const Field *field) const;
+ bool is_param_long_data_type() const override { return true; }
+ uint calc_key_length(const Column_definition &def) const override;
+ bool Column_definition_fix_attributes(Column_definition *c) const override;
bool Column_definition_prepare_stage2(Column_definition *c,
handler *file,
- ulonglong table_flags) const;
+ ulonglong table_flags) const override;
+ void
+ Column_definition_attributes_frm_pack(const Column_definition_attributes *at,
+ uchar *buff) const override;
+ bool Key_part_spec_init_ft(Key_part_spec *part,
+ const Column_definition &def) const override;
+ bool Key_part_spec_init_primary(Key_part_spec *part,
+ const Column_definition &def,
+ const handler *file) const override;
+ bool Key_part_spec_init_unique(Key_part_spec *part,
+ const Column_definition &def,
+ const handler *file,
+ bool *has_key_needed) const override;
+ bool Key_part_spec_init_multiple(Key_part_spec *part,
+ const Column_definition &def,
+ const handler *file) const override;
+ bool Key_part_spec_init_foreign(Key_part_spec *part,
+ const Column_definition &def,
+ const handler *file) const override;
bool Item_hybrid_func_fix_attributes(THD *thd,
const char *name,
Type_handler_hybrid_field_type *,
Type_all_attributes *atrr,
- Item **items, uint nitems) const;
- void Item_param_setup_conversion(THD *thd, Item_param *) const;
-
+ Item **items, uint nitems) const
+ override;
+ void Item_param_setup_conversion(THD *thd, Item_param *) const override;
+
+ Field *make_schema_field(MEM_ROOT *root,
+ TABLE *table,
+ const Record_addr &addr,
+ const ST_FIELD_INFO &def,
+ bool show_field) const override;
Field *make_table_field_from_def(TABLE_SHARE *share,
MEM_ROOT *mem_root,
const LEX_CSTRING *name,
const Record_addr &addr,
const Bit_addr &bit,
const Column_definition_attributes *attr,
- uint32 flags) const;
+ uint32 flags) const override;
+ const Vers_type_handler *vers() const override { return &vers_type_timestamp; }
};
class Type_handler_tiny_blob: public Type_handler_blob_common
{
- static const Name m_name_tinyblob;
public:
virtual ~Type_handler_tiny_blob() {}
- const Name name() const { return m_name_tinyblob; }
- enum_field_types field_type() const { return MYSQL_TYPE_TINY_BLOB; }
- uint32 calc_pack_length(uint32 length) const;
- Field *make_table_field(const LEX_CSTRING *name,
+ uint length_bytes() const override { return 1; }
+ const Name name() const override;
+ enum_field_types field_type() const override { return MYSQL_TYPE_TINY_BLOB; }
+ uint32 max_display_length_for_field(const Conv_source &src) const override;
+ uint32 calc_pack_length(uint32 length) const override;
+ Field *make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const;
- uint max_octet_length() const { return UINT_MAX8; }
+ TABLE_SHARE *share) const override;
+ uint max_octet_length() const override { return UINT_MAX8; }
};
class Type_handler_medium_blob: public Type_handler_blob_common
{
- static const Name m_name_mediumblob;
public:
virtual ~Type_handler_medium_blob() {}
- const Name name() const { return m_name_mediumblob; }
- enum_field_types field_type() const { return MYSQL_TYPE_MEDIUM_BLOB; }
- uint32 calc_pack_length(uint32 length) const;
- Field *make_table_field(const LEX_CSTRING *name,
+ uint length_bytes() const override { return 3; }
+ const Name name() const override;
+ enum_field_types field_type() const override { return MYSQL_TYPE_MEDIUM_BLOB; }
+ uint32 max_display_length_for_field(const Conv_source &src) const override;
+ uint32 calc_pack_length(uint32 length) const override;
+ Field *make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const;
- uint max_octet_length() const { return UINT_MAX24; }
+ TABLE_SHARE *share) const override;
+ uint max_octet_length() const override { return UINT_MAX24; }
};
class Type_handler_long_blob: public Type_handler_blob_common
{
- static const Name m_name_longblob;
public:
virtual ~Type_handler_long_blob() {}
- const Name name() const { return m_name_longblob; }
- enum_field_types field_type() const { return MYSQL_TYPE_LONG_BLOB; }
- uint32 calc_pack_length(uint32 length) const;
+ uint length_bytes() const override { return 4; }
+ const Name name() const override;
+ enum_field_types field_type() const override { return MYSQL_TYPE_LONG_BLOB; }
+ uint32 max_display_length_for_field(const Conv_source &src) const override;
+ uint32 calc_pack_length(uint32 length) const override;
Item *create_typecast_item(THD *thd, Item *item,
- const Type_cast_attributes &attr) const;
- Field *make_table_field(const LEX_CSTRING *name,
+ const Type_cast_attributes &attr) const override;
+ Field *make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const;
- uint max_octet_length() const { return UINT_MAX32; }
+ TABLE_SHARE *share) const override;
+ uint max_octet_length() const override { return UINT_MAX32; }
};
class Type_handler_blob: public Type_handler_blob_common
{
- static const Name m_name_blob;
public:
virtual ~Type_handler_blob() {}
- const Name name() const { return m_name_blob; }
- enum_field_types field_type() const { return MYSQL_TYPE_BLOB; }
- uint32 calc_pack_length(uint32 length) const;
- Field *make_table_field(const LEX_CSTRING *name,
+ uint length_bytes() const override { return 2; }
+ const Name name() const override;
+ enum_field_types field_type() const override { return MYSQL_TYPE_BLOB; }
+ uint32 max_display_length_for_field(const Conv_source &src) const override;
+ uint32 calc_pack_length(uint32 length) const override;
+ Field *make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const;
- uint max_octet_length() const { return UINT_MAX16; }
+ TABLE_SHARE *share) const override;
+ uint max_octet_length() const override { return UINT_MAX16; }
};
class Type_handler_blob_compressed: public Type_handler_blob
{
public:
- Field *make_conversion_table_field(TABLE *, uint metadata,
- const Field *target) const;
-};
-
-
-#ifdef HAVE_SPATIAL
-class Type_handler_geometry: public Type_handler_string_result
-{
- static const Name m_name_geometry;
-public:
- virtual ~Type_handler_geometry() {}
- const Name name() const { return m_name_geometry; }
- enum_field_types field_type() const { return MYSQL_TYPE_GEOMETRY; }
- bool is_param_long_data_type() const { return true; }
- uint32 calc_pack_length(uint32 length) const;
- const Type_handler *type_handler_for_comparison() const;
- bool type_can_have_key_part() const
+ enum_field_types real_field_type() const override
{
- return true;
+ return MYSQL_TYPE_BLOB_COMPRESSED;
}
- bool subquery_type_allows_materialization(const Item *inner,
- const Item *outer) const
+ ulong KEY_pack_flags(uint column_nr) const override
{
- return false; // Materialization does not work with GEOMETRY columns
+ DBUG_ASSERT(0);
+ return 0;
}
- void Item_param_set_param_func(Item_param *param,
- uchar **pos, ulong len) const;
- bool Item_param_set_from_value(THD *thd,
- Item_param *param,
- const Type_all_attributes *attr,
- const st_value *value) const;
- Field *make_conversion_table_field(TABLE *, uint metadata,
- const Field *target) const;
- void
- Column_definition_attributes_frm_pack(const Column_definition_attributes *at,
- uchar *buff) const;
- bool
- Column_definition_attributes_frm_unpack(Column_definition_attributes *attr,
- TABLE_SHARE *share,
- const uchar *buffer,
- LEX_CUSTRING *gis_options) const;
- bool Column_definition_fix_attributes(Column_definition *c) const;
- void Column_definition_reuse_fix_attributes(THD *thd,
- Column_definition *c,
- const Field *field) const;
- bool Column_definition_prepare_stage1(THD *thd,
- MEM_ROOT *mem_root,
- Column_definition *c,
- handler *file,
- ulonglong table_flags) const;
- bool Column_definition_prepare_stage2(Column_definition *c,
- handler *file,
- ulonglong table_flags) const;
- Field *make_table_field(const LEX_CSTRING *name,
- const Record_addr &addr,
- const Type_all_attributes &attr,
- TABLE *table) const;
-
- Field *make_table_field_from_def(TABLE_SHARE *share,
- MEM_ROOT *mem_root,
- const LEX_CSTRING *name,
- const Record_addr &addr,
- const Bit_addr &bit,
- const Column_definition_attributes *attr,
- uint32 flags) const;
-
- bool can_return_int() const { return false; }
- bool can_return_decimal() const { return false; }
- bool can_return_real() const { return false; }
- bool can_return_text() const { return false; }
- bool can_return_date() const { return false; }
- bool can_return_time() const { return false; }
- bool is_traditional_type() const
+ uint32 max_display_length_for_field(const Conv_source &src) const override;
+ void show_binlog_type(const Conv_source &src, const Field &, String *str)
+ const override;
+ Field *make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table, uint metadata,
+ const Field *target) const override;
+ enum_dynamic_column_type dyncol_type(const Type_all_attributes *attr)
+ const override
{
- return false;
+ DBUG_ASSERT(0);
+ return DYN_COL_STRING;
}
- bool Item_func_round_fix_length_and_dec(Item_func_round *) const;
- bool Item_func_int_val_fix_length_and_dec(Item_func_int_val *) const;
- bool Item_func_abs_fix_length_and_dec(Item_func_abs *) const;
- bool Item_func_neg_fix_length_and_dec(Item_func_neg *) const;
- bool Item_hybrid_func_fix_attributes(THD *thd,
- const char *name,
- Type_handler_hybrid_field_type *h,
- Type_all_attributes *attr,
- Item **items, uint nitems) const;
- bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const;
- bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const;
- bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *) const;
-
- bool Item_func_signed_fix_length_and_dec(Item_func_signed *) const;
- bool Item_func_unsigned_fix_length_and_dec(Item_func_unsigned *) const;
- bool Item_double_typecast_fix_length_and_dec(Item_double_typecast *) const;
- bool Item_float_typecast_fix_length_and_dec(Item_float_typecast *) const;
- bool Item_decimal_typecast_fix_length_and_dec(Item_decimal_typecast *) const;
- bool Item_char_typecast_fix_length_and_dec(Item_char_typecast *) const;
- bool Item_time_typecast_fix_length_and_dec(Item_time_typecast *) const;
- bool Item_date_typecast_fix_length_and_dec(Item_date_typecast *) const;
- bool Item_datetime_typecast_fix_length_and_dec(Item_datetime_typecast *) const;
-};
-
-extern MYSQL_PLUGIN_IMPORT Type_handler_geometry type_handler_geometry;
-#endif
+};
class Type_handler_typelib: public Type_handler_general_purpose_string
{
public:
virtual ~Type_handler_typelib() { }
- enum_field_types field_type() const { return MYSQL_TYPE_STRING; }
- const Type_handler *type_handler_for_item_field() const;
- const Type_handler *cast_to_int_type_handler() const;
+ enum_field_types field_type() const override { return MYSQL_TYPE_STRING; }
+ const Type_handler *type_handler_for_item_field() const override;
+ const Type_handler *cast_to_int_type_handler() const override;
+ uint32 max_display_length_for_field(const Conv_source &src) const override;
bool Item_hybrid_func_fix_attributes(THD *thd,
const char *name,
Type_handler_hybrid_field_type *,
Type_all_attributes *atrr,
- Item **items, uint nitems) const;
+ Item **items, uint nitems)
+ const override;
void Column_definition_reuse_fix_attributes(THD *thd,
Column_definition *c,
- const Field *field) const;
+ const Field *field)
+ const override;
bool Column_definition_prepare_stage1(THD *thd,
MEM_ROOT *mem_root,
Column_definition *c,
handler *file,
- ulonglong table_flags) const;
+ ulonglong table_flags)
+ const override;
bool Column_definition_redefine_stage1(Column_definition *def,
const Column_definition *dup,
const handler *file,
const Schema_specification_st *schema)
- const;
+ const override;
void Item_param_set_param_func(Item_param *param,
- uchar **pos, ulong len) const;
- bool Vers_history_point_resolve_unit(THD *thd, Vers_history_point *p) const;
+ uchar **pos, ulong len) const override;
+ const Vers_type_handler *vers() const override { return NULL; }
};
class Type_handler_enum: public Type_handler_typelib
{
- static const Name m_name_enum;
public:
virtual ~Type_handler_enum() {}
- const Name name() const { return m_name_enum; }
- enum_field_types real_field_type() const { return MYSQL_TYPE_ENUM; }
- enum_field_types traditional_merge_field_type() const
+ const Name name() const override;
+ enum_field_types real_field_type() const override { return MYSQL_TYPE_ENUM; }
+ enum_field_types traditional_merge_field_type() const override
{
return MYSQL_TYPE_ENUM;
}
- uint32 calc_pack_length(uint32 length) const;
- Field *make_conversion_table_field(TABLE *, uint metadata,
- const Field *target) const;
- bool Column_definition_fix_attributes(Column_definition *c) const;
+ uint32 calc_pack_length(uint32 length) const override;
+ uint calc_key_length(const Column_definition &def) const override;
+ void
+ Column_definition_attributes_frm_pack(const Column_definition_attributes *at,
+ uchar *buff) const override;
+ Field *make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table, uint metadata,
+ const Field *target)
+ const override;
+ bool Column_definition_fix_attributes(Column_definition *c) const override;
bool Column_definition_prepare_stage2(Column_definition *c,
handler *file,
- ulonglong table_flags) const;
- Field *make_table_field(const LEX_CSTRING *name,
+ ulonglong table_flags) const override;
+ Field *make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const;
+ TABLE_SHARE *share) const override;
Field *make_table_field_from_def(TABLE_SHARE *share,
MEM_ROOT *mem_root,
const LEX_CSTRING *name,
const Record_addr &addr,
const Bit_addr &bit,
const Column_definition_attributes *attr,
- uint32 flags) const;
+ uint32 flags) const override;
+ Field *make_schema_field(MEM_ROOT *root,
+ TABLE *table,
+ const Record_addr &addr,
+ const ST_FIELD_INFO &def,
+ bool show_field) const override;
};
class Type_handler_set: public Type_handler_typelib
{
- static const Name m_name_set;
public:
virtual ~Type_handler_set() {}
- const Name name() const { return m_name_set; }
- enum_field_types real_field_type() const { return MYSQL_TYPE_SET; }
- enum_field_types traditional_merge_field_type() const
+ const Name name() const override;
+ enum_field_types real_field_type() const override { return MYSQL_TYPE_SET; }
+ enum_field_types traditional_merge_field_type() const override
{
return MYSQL_TYPE_SET;
}
- uint32 calc_pack_length(uint32 length) const;
- Field *make_conversion_table_field(TABLE *, uint metadata,
- const Field *target) const;
- bool Column_definition_fix_attributes(Column_definition *c) const;
+ uint32 calc_pack_length(uint32 length) const override;
+ uint calc_key_length(const Column_definition &def) const override;
+ void
+ Column_definition_attributes_frm_pack(const Column_definition_attributes *at,
+ uchar *buff) const override;
+ Field *make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table, uint metadata,
+ const Field *target)
+ const override;
+ bool Column_definition_fix_attributes(Column_definition *c) const override;
bool Column_definition_prepare_stage2(Column_definition *c,
handler *file,
- ulonglong table_flags) const;
- Field *make_table_field(const LEX_CSTRING *name,
+ ulonglong table_flags) const override;
+ Field *make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
- TABLE *table) const;
+ TABLE_SHARE *share) const override;
Field *make_table_field_from_def(TABLE_SHARE *share,
MEM_ROOT *mem_root,
const LEX_CSTRING *name,
const Record_addr &addr,
const Bit_addr &bit,
const Column_definition_attributes *attr,
- uint32 flags) const;
+ uint32 flags) const override;
};
@@ -6282,10 +6886,45 @@ class Type_handler_interval_DDhhmmssff: public Type_handler_long_blob
{
public:
Item *create_typecast_item(THD *thd, Item *item,
- const Type_cast_attributes &attr) const;
+ const Type_cast_attributes &attr) const override;
+};
+
+
+class Function_collection
+{
+public:
+ virtual ~Function_collection() {}
+ virtual bool init()= 0;
+ virtual void cleanup()= 0;
+ virtual Create_func *find_native_function_builder(THD *thd,
+ const LEX_CSTRING &name)
+ const= 0;
};
+class Type_collection
+{
+public:
+ virtual ~Type_collection() {}
+ virtual bool init(Type_handler_data *data)
+ {
+ return false;
+ }
+ virtual const Type_handler *handler_by_name(const LEX_CSTRING &name) const= 0;
+ virtual const Type_handler *aggregate_for_result(const Type_handler *h1,
+ const Type_handler *h2)
+ const= 0;
+ virtual const Type_handler *aggregate_for_comparison(const Type_handler *h1,
+ const Type_handler *h2)
+ const= 0;
+ virtual const Type_handler *aggregate_for_min_max(const Type_handler *h1,
+ const Type_handler *h2)
+ const= 0;
+ virtual const Type_handler *aggregate_for_num_op(const Type_handler *h1,
+ const Type_handler *h2)
+ const= 0;
+};
+
/**
A handler for hybrid type functions, e.g.
@@ -6331,19 +6970,6 @@ public:
{
m_type_handler= other;
}
- const Type_handler *set_handler_by_result_type(Item_result type)
- {
- return (m_type_handler= Type_handler::get_handler_by_result_type(type));
- }
- const Type_handler *set_handler_by_result_type(Item_result type,
- uint max_octet_length,
- CHARSET_INFO *cs)
- {
- m_type_handler= Type_handler::get_handler_by_result_type(type);
- return m_type_handler=
- m_type_handler->type_handler_adjusted_to_max_octet_length(max_octet_length,
- cs);
- }
const Type_handler *set_handler_by_field_type(enum_field_types type)
{
return (m_type_handler= Type_handler::get_handler_by_field_type(type));
@@ -6380,20 +7006,29 @@ extern MYSQL_PLUGIN_IMPORT Type_handler_set type_handler_set;
extern MYSQL_PLUGIN_IMPORT Type_handler_string type_handler_string;
extern MYSQL_PLUGIN_IMPORT Type_handler_var_string type_handler_var_string;
extern MYSQL_PLUGIN_IMPORT Type_handler_varchar type_handler_varchar;
+extern MYSQL_PLUGIN_IMPORT Type_handler_varchar_compressed
+ type_handler_varchar_compressed;
extern MYSQL_PLUGIN_IMPORT Type_handler_hex_hybrid type_handler_hex_hybrid;
extern MYSQL_PLUGIN_IMPORT Type_handler_tiny_blob type_handler_tiny_blob;
extern MYSQL_PLUGIN_IMPORT Type_handler_medium_blob type_handler_medium_blob;
extern MYSQL_PLUGIN_IMPORT Type_handler_long_blob type_handler_long_blob;
extern MYSQL_PLUGIN_IMPORT Type_handler_blob type_handler_blob;
+extern MYSQL_PLUGIN_IMPORT Type_handler_blob_compressed
+ type_handler_blob_compressed;
extern MYSQL_PLUGIN_IMPORT Type_handler_bool type_handler_bool;
-extern MYSQL_PLUGIN_IMPORT Type_handler_tiny type_handler_tiny;
-extern MYSQL_PLUGIN_IMPORT Type_handler_short type_handler_short;
-extern MYSQL_PLUGIN_IMPORT Type_handler_int24 type_handler_int24;
-extern MYSQL_PLUGIN_IMPORT Type_handler_long type_handler_long;
-extern MYSQL_PLUGIN_IMPORT Type_handler_longlong type_handler_longlong;
-extern MYSQL_PLUGIN_IMPORT Type_handler_longlong type_handler_ulonglong;
+extern MYSQL_PLUGIN_IMPORT Type_handler_tiny type_handler_stiny;
+extern MYSQL_PLUGIN_IMPORT Type_handler_short type_handler_sshort;
+extern MYSQL_PLUGIN_IMPORT Type_handler_int24 type_handler_sint24;
+extern MYSQL_PLUGIN_IMPORT Type_handler_long type_handler_slong;
+extern MYSQL_PLUGIN_IMPORT Type_handler_longlong type_handler_slonglong;
+
+extern MYSQL_PLUGIN_IMPORT Type_handler_utiny type_handler_utiny;
+extern MYSQL_PLUGIN_IMPORT Type_handler_ushort type_handler_ushort;
+extern MYSQL_PLUGIN_IMPORT Type_handler_uint24 type_handler_uint24;
+extern MYSQL_PLUGIN_IMPORT Type_handler_ulong type_handler_ulong;
+extern MYSQL_PLUGIN_IMPORT Type_handler_ulonglong type_handler_ulonglong;
extern MYSQL_PLUGIN_IMPORT Type_handler_vers_trx_id type_handler_vers_trx_id;
extern MYSQL_PLUGIN_IMPORT Type_handler_newdecimal type_handler_newdecimal;
@@ -6416,6 +7051,7 @@ extern MYSQL_PLUGIN_IMPORT Type_handler_interval_DDhhmmssff
class Type_aggregator
{
bool m_is_commutative;
+public:
class Pair
{
public:
@@ -6433,6 +7069,23 @@ class Type_aggregator
return m_handler1 == handler1 && m_handler2 == handler2;
}
};
+ static const Type_handler *
+ find_handler_in_array(const Type_aggregator::Pair *pairs,
+ const Type_handler *h1,
+ const Type_handler *h2,
+ bool commutative)
+ {
+ for (const Type_aggregator::Pair *p= pairs; p->m_result; p++)
+ {
+ if (p->eq(h1, h2))
+ return p->m_result;
+ if (commutative && p->eq(h2, h1))
+ return p->m_result;
+ }
+ return NULL;
+ }
+
+private:
Dynamic_array<Pair> m_array;
const Pair* find_pair(const Type_handler *handler1,
const Type_handler *handler2) const;
diff --git a/sql/sql_type_geom.cc b/sql/sql_type_geom.cc
new file mode 100644
index 00000000000..adc8163038a
--- /dev/null
+++ b/sql/sql_type_geom.cc
@@ -0,0 +1,1000 @@
+/*
+ Copyright (c) 2015 MariaDB Foundation
+ Copyright (c) 2019 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
+
+#include "mariadb.h"
+
+#ifdef HAVE_SPATIAL
+
+#include "sql_class.h"
+#include "sql_type_geom.h"
+#include "item_geofunc.h"
+
+const Name Type_handler_geometry::name() const
+{
+ static const Name tmp(STRING_WITH_LEN("geometry"));
+ return tmp;
+}
+
+const Name Type_handler_point::name() const
+{
+ static const Name tmp(STRING_WITH_LEN("point"));
+ return tmp;
+}
+
+const Name Type_handler_linestring::name() const
+{
+ static const Name tmp(STRING_WITH_LEN("linestring"));
+ return tmp;
+}
+
+const Name Type_handler_polygon::name() const
+{
+ static const Name tmp(STRING_WITH_LEN("polygon"));
+ return tmp;
+}
+
+const Name Type_handler_multipoint::name() const
+{
+ static const Name tmp(STRING_WITH_LEN("multipoint"));
+ return tmp;
+}
+
+const Name Type_handler_multilinestring::name() const
+{
+ static const Name tmp(STRING_WITH_LEN("multilinestring"));
+ return tmp;
+}
+
+const Name Type_handler_multipolygon::name() const
+{
+ static const Name tmp(STRING_WITH_LEN("multipolygon"));
+ return tmp;
+}
+
+const Name Type_handler_geometrycollection::name() const
+{
+ static const Name tmp(STRING_WITH_LEN("geometrycollection"));
+ return tmp;
+}
+
+
+Type_handler_geometry type_handler_geometry;
+Type_handler_point type_handler_point;
+Type_handler_linestring type_handler_linestring;
+Type_handler_polygon type_handler_polygon;
+Type_handler_multipoint type_handler_multipoint;
+Type_handler_multilinestring type_handler_multilinestring;
+Type_handler_multipolygon type_handler_multipolygon;
+Type_handler_geometrycollection type_handler_geometrycollection;
+
+
+Type_collection_geometry type_collection_geometry;
+
+
+const Type_handler_geometry *
+Type_handler_geometry::type_handler_geom_by_type(uint type)
+{
+ switch (type) {
+ case Type_handler_geometry::GEOM_POINT:
+ return &type_handler_point;
+ case Type_handler_geometry::GEOM_LINESTRING:
+ return &type_handler_linestring;
+ case Type_handler_geometry::GEOM_POLYGON:
+ return &type_handler_polygon;
+ case Type_handler_geometry::GEOM_MULTIPOINT:
+ return &type_handler_multipoint;
+ case Type_handler_geometry::GEOM_MULTILINESTRING:
+ return &type_handler_multilinestring;
+ case Type_handler_geometry::GEOM_MULTIPOLYGON:
+ return &type_handler_multipolygon;
+ case Type_handler_geometry::GEOM_GEOMETRYCOLLECTION:
+ return &type_handler_geometrycollection;
+ case Type_handler_geometry::GEOM_GEOMETRY:
+ break;
+ }
+ return &type_handler_geometry;
+}
+
+
+const Type_handler *
+Type_collection_geometry::handler_by_name(const LEX_CSTRING &name) const
+{
+ if (type_handler_point.name().eq(name))
+ return &type_handler_point;
+ if (type_handler_linestring.name().eq(name))
+ return &type_handler_linestring;
+ if (type_handler_polygon.name().eq(name))
+ return &type_handler_polygon;
+ if (type_handler_multipoint.name().eq(name))
+ return &type_handler_multipoint;
+ if (type_handler_multilinestring.name().eq(name))
+ return &type_handler_multilinestring;
+ if (type_handler_multipolygon.name().eq(name))
+ return &type_handler_multipolygon;
+ if (type_handler_geometry.name().eq(name))
+ return &type_handler_geometry;
+ if (type_handler_geometrycollection.name().eq(name))
+ return &type_handler_geometrycollection;
+ return NULL;
+}
+
+
+const Type_collection *Type_handler_geometry::type_collection() const
+{
+ return &type_collection_geometry;
+}
+
+
+const Type_handler *
+Type_handler_geometry::type_handler_frm_unpack(const uchar *buffer) const
+{
+ // charset and geometry_type share the same byte in frm
+ return type_handler_geom_by_type((uint) buffer[14]);
+}
+
+
+const Type_handler *
+Type_collection_geometry::aggregate_for_comparison(const Type_handler *a,
+ const Type_handler *b)
+ const
+{
+ const Type_handler *h;
+ if ((h= aggregate_common(a, b)) ||
+ (h= aggregate_if_null(a, b)) ||
+ (h= aggregate_if_long_blob(a, b)))
+ return h;
+ return NULL;
+}
+
+
+const Type_handler *
+Type_collection_geometry::aggregate_for_result(const Type_handler *a,
+ const Type_handler *b)
+ const
+{
+ const Type_handler *h;
+ if ((h= aggregate_common(a, b)) ||
+ (h= aggregate_if_null(a, b)) ||
+ (h= aggregate_if_long_blob(a, b)) ||
+ (h= aggregate_if_string(a, b)))
+ return h;
+ return NULL;
+}
+
+
+const Type_handler *
+Type_collection_geometry::aggregate_for_min_max(const Type_handler *a,
+ const Type_handler *b)
+ const
+{
+ const Type_handler *h;
+ if ((h= aggregate_common(a, b)) ||
+ (h= aggregate_if_null(a, b)) ||
+ (h= aggregate_if_long_blob(a, b)) ||
+ (h= aggregate_if_string(a, b)))
+ return h;
+ return NULL;
+}
+
+
+const Type_handler *
+Type_collection_geometry::aggregate_if_string(const Type_handler *a,
+ const Type_handler *b) const
+{
+ if (a->type_collection() == this)
+ {
+ DBUG_ASSERT(b->type_collection() != this);
+ swap_variables(const Type_handler *, a, b);
+ }
+ if (a == &type_handler_hex_hybrid ||
+ a == &type_handler_tiny_blob ||
+ a == &type_handler_blob ||
+ a == &type_handler_medium_blob ||
+ a == &type_handler_varchar ||
+ a == &type_handler_string)
+ return &type_handler_long_blob;
+ return NULL;
+}
+
+
+#ifndef DBUG_OFF
+bool Type_collection_geometry::init_aggregators(Type_handler_data *data,
+ const Type_handler *geom) const
+{
+ Type_aggregator *r= &data->m_type_aggregator_for_result;
+ return
+ r->add(geom, &type_handler_hex_hybrid, &type_handler_long_blob) ||
+ r->add(geom, &type_handler_tiny_blob, &type_handler_long_blob) ||
+ r->add(geom, &type_handler_blob, &type_handler_long_blob) ||
+ r->add(geom, &type_handler_medium_blob, &type_handler_long_blob) ||
+ r->add(geom, &type_handler_varchar, &type_handler_long_blob) ||
+ r->add(geom, &type_handler_string, &type_handler_long_blob);
+}
+#endif
+
+
+bool Type_collection_geometry::init(Type_handler_data *data)
+{
+#ifndef DBUG_OFF
+ Type_aggregator *nct= &data->m_type_aggregator_non_commutative_test;
+ if (nct->add(&type_handler_point,
+ &type_handler_varchar,
+ &type_handler_long_blob))
+ return true;
+ return
+ init_aggregators(data, &type_handler_geometry) ||
+ init_aggregators(data, &type_handler_geometrycollection) ||
+ init_aggregators(data, &type_handler_point) ||
+ init_aggregators(data, &type_handler_linestring) ||
+ init_aggregators(data, &type_handler_polygon) ||
+ init_aggregators(data, &type_handler_multipoint) ||
+ init_aggregators(data, &type_handler_multilinestring) ||
+ init_aggregators(data, &type_handler_multipolygon);
+#endif // DBUG_OFF
+ return false;
+}
+
+
+bool Type_handler_geometry::check_type_geom_or_binary(const char *opname,
+ const Item *item)
+{
+ const Type_handler *handler= item->type_handler();
+ if (handler->type_handler_for_comparison() == &type_handler_geometry ||
+ (handler->is_general_purpose_string_type() &&
+ item->collation.collation == &my_charset_bin))
+ return false;
+ my_error(ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION, MYF(0),
+ handler->name().ptr(), opname);
+ return true;
+}
+
+
+bool Type_handler_geometry::check_types_geom_or_binary(const char *opname,
+ Item* const *args,
+ uint start, uint end)
+{
+ for (uint i= start; i < end ; i++)
+ {
+ if (check_type_geom_or_binary(opname, args[i]))
+ return true;
+ }
+ return false;
+}
+
+
+const Type_handler *Type_handler_geometry::type_handler_for_comparison() const
+{
+ return &type_handler_geometry;
+}
+
+
+Field *Type_handler_geometry::make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table,
+ uint metadata,
+ const Field *target)
+ const
+{
+ DBUG_ASSERT(target->type() == MYSQL_TYPE_GEOMETRY);
+ /*
+ We do not do not update feature_gis statistics here:
+ status_var_increment(target->table->in_use->status_var.feature_gis);
+ as this is only a temporary field.
+ The statistics was already incremented when "target" was created.
+ */
+ const Field_geom *fg= static_cast<const Field_geom*>(target);
+ return new (root)
+ Field_geom(NULL, (uchar *) "", 1, Field::NONE, &empty_clex_str,
+ table->s, 4, fg->type_handler_geom(), fg->srid);
+}
+
+
+bool Type_handler_geometry::
+ Column_definition_fix_attributes(Column_definition *def) const
+{
+ def->flags|= BLOB_FLAG;
+ return false;
+}
+
+void Type_handler_geometry::
+ Column_definition_reuse_fix_attributes(THD *thd,
+ Column_definition *def,
+ const Field *field) const
+{
+ def->srid= ((Field_geom*) field)->srid;
+}
+
+
+bool Type_handler_geometry::
+ Column_definition_prepare_stage1(THD *thd,
+ MEM_ROOT *mem_root,
+ Column_definition *def,
+ handler *file,
+ ulonglong table_flags) const
+{
+ def->create_length_to_internal_length_string();
+ return def->prepare_blob_field(thd);
+}
+
+
+bool Type_handler_geometry::
+ Column_definition_prepare_stage2(Column_definition *def,
+ handler *file,
+ ulonglong table_flags) const
+{
+ if (!(table_flags & HA_CAN_GEOMETRY))
+ {
+ my_error(ER_CHECK_NOT_IMPLEMENTED, MYF(0), "GEOMETRY");
+ return true;
+ }
+ return def->prepare_stage2_blob(file, table_flags, FIELDFLAG_GEOM);
+}
+
+bool Type_handler_geometry::Key_part_spec_init_primary(Key_part_spec *part,
+ const Column_definition &def,
+ const handler *file) const
+{
+ return part->check_primary_key_for_blob(file);
+}
+
+
+bool Type_handler_geometry::Key_part_spec_init_unique(Key_part_spec *part,
+ const Column_definition &def,
+ const handler *file,
+ bool *hash_field_needed) const
+{
+ if (!part->length)
+ *hash_field_needed= true;
+ return part->check_key_for_blob(file);
+}
+
+
+bool Type_handler_geometry::Key_part_spec_init_multiple(Key_part_spec *part,
+ const Column_definition &def,
+ const handler *file) const
+{
+ return part->init_multiple_key_for_blob(file);
+}
+
+
+bool Type_handler_geometry::Key_part_spec_init_foreign(Key_part_spec *part,
+ const Column_definition &def,
+ const handler *file) const
+{
+ return part->check_foreign_key_for_blob(file);
+}
+
+
+bool Type_handler_geometry::Key_part_spec_init_spatial(Key_part_spec *part,
+ const Column_definition &def)
+ const
+{
+ if (part->length)
+ {
+ my_error(ER_WRONG_SUB_KEY, MYF(0));
+ return true;
+ }
+ /*
+ 4 is: (Xmin,Xmax,Ymin,Ymax), this is for 2D case
+ Lately we'll extend this code to support more dimensions
+ */
+ part->length= 4 * sizeof(double);
+ return false;
+}
+
+
+Item *
+Type_handler_geometry::create_typecast_item(THD *thd, Item *item,
+ const Type_cast_attributes &attr)
+ const
+{
+ DBUG_EXECUTE_IF("emulate_geometry_create_typecast_item",
+ return new (thd->mem_root) Item_func_geometry_from_text(thd, item);
+ );
+
+ return NULL;
+}
+
+bool Type_handler_point::Key_part_spec_init_primary(Key_part_spec *part,
+ const Column_definition &def,
+ const handler *file) const
+{
+ /*
+ QQ:
+ The below assignment (here and in all other Key_part_spec_init_xxx methods)
+ overrides the explicitly given key part length, so in this query:
+ CREATE OR REPLACE TABLE t1 (a POINT, KEY(a(10)));
+ the key becomes KEY(a(25)).
+ This might be a bug.
+ */
+ part->length= octet_length();
+ return part->check_key_for_blob(file);
+}
+
+
+bool Type_handler_point::Key_part_spec_init_unique(Key_part_spec *part,
+ const Column_definition &def,
+ const handler *file,
+ bool *hash_field_needed) const
+{
+ part->length= octet_length();
+ return part->check_key_for_blob(file);
+}
+
+
+bool Type_handler_point::Key_part_spec_init_multiple(Key_part_spec *part,
+ const Column_definition &def,
+ const handler *file) const
+{
+ part->length= octet_length();
+ return part->check_key_for_blob(file);
+}
+
+
+bool Type_handler_point::Key_part_spec_init_foreign(Key_part_spec *part,
+ const Column_definition &def,
+ const handler *file) const
+{
+ part->length= octet_length();
+ return part->check_key_for_blob(file);
+}
+
+
+Item *
+Type_handler_point::make_constructor_item(THD *thd, List<Item> *args) const
+{
+ if (!args || args->elements != 2)
+ return NULL;
+ Item_args tmp(thd, *args);
+ return new (thd->mem_root) Item_func_point(thd,
+ tmp.arguments()[0],
+ tmp.arguments()[1]);
+}
+
+
+Item *
+Type_handler_linestring::make_constructor_item(THD *thd, List<Item> *args) const
+{
+ return args ? new (thd->mem_root) Item_func_linestring(thd, *args) : NULL;
+}
+
+
+Item *
+Type_handler_polygon::make_constructor_item(THD *thd, List<Item> *args) const
+{
+ return args ? new (thd->mem_root) Item_func_polygon(thd, *args) : NULL;
+}
+
+
+Item *
+Type_handler_multipoint::make_constructor_item(THD *thd, List<Item> *args) const
+{
+ return args ? new (thd->mem_root) Item_func_multipoint(thd, *args) : NULL;
+}
+
+
+Item *
+Type_handler_multilinestring::make_constructor_item(THD *thd,
+ List<Item> *args) const
+{
+ return args ? new (thd->mem_root) Item_func_multilinestring(thd, *args) :
+ NULL;
+}
+
+
+Item *
+Type_handler_multipolygon::make_constructor_item(THD *thd,
+ List<Item> *args) const
+{
+ return args ? new (thd->mem_root) Item_func_multipolygon(thd, *args) : NULL;
+}
+
+
+Item *
+Type_handler_geometrycollection::make_constructor_item(THD *thd,
+ List<Item> *args) const
+{
+ return args ? new (thd->mem_root) Item_func_geometrycollection(thd, *args) :
+ NULL;
+}
+
+
+uint32 Type_handler_geometry::calc_pack_length(uint32 length) const
+{
+ return 4 + portable_sizeof_char_ptr;
+}
+
+
+Field *Type_handler_geometry::make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
+ const Record_addr &addr,
+ const Type_all_attributes &attr,
+ TABLE_SHARE *share) const
+{
+ return new (root)
+ Field_geom(addr.ptr(), addr.null_ptr(), addr.null_bit(),
+ Field::NONE, name, share, 4, this, 0);
+}
+
+
+bool Type_handler_geometry::
+ Item_hybrid_func_fix_attributes(THD *thd,
+ const char *func_name,
+ Type_handler_hybrid_field_type *handler,
+ Type_all_attributes *func,
+ Item **items, uint nitems) const
+{
+ DBUG_ASSERT(nitems > 0);
+ func->collation.set(&my_charset_bin);
+ func->unsigned_flag= false;
+ func->decimals= 0;
+ func->max_length= (uint32) UINT_MAX32;
+ func->set_maybe_null(true);
+ return false;
+}
+
+
+bool Type_handler_geometry::
+ Item_sum_sum_fix_length_and_dec(Item_sum_sum *item) const
+{
+ return Item_func_or_sum_illegal_param("sum");
+}
+
+
+bool Type_handler_geometry::
+ Item_sum_avg_fix_length_and_dec(Item_sum_avg *item) const
+{
+ return Item_func_or_sum_illegal_param("avg");
+}
+
+
+bool Type_handler_geometry::
+ Item_sum_variance_fix_length_and_dec(Item_sum_variance *item) const
+{
+ return Item_func_or_sum_illegal_param(item);
+}
+
+
+bool Type_handler_geometry::
+ Item_func_round_fix_length_and_dec(Item_func_round *item) const
+{
+ return Item_func_or_sum_illegal_param(item);
+}
+
+
+bool Type_handler_geometry::
+ Item_func_int_val_fix_length_and_dec(Item_func_int_val *item) const
+{
+ return Item_func_or_sum_illegal_param(item);
+}
+
+
+bool Type_handler_geometry::
+ Item_func_abs_fix_length_and_dec(Item_func_abs *item) const
+{
+ return Item_func_or_sum_illegal_param(item);
+}
+
+
+bool Type_handler_geometry::
+ Item_func_neg_fix_length_and_dec(Item_func_neg *item) const
+{
+ return Item_func_or_sum_illegal_param(item);
+}
+
+
+
+bool Type_handler_geometry::
+ Item_func_signed_fix_length_and_dec(Item_func_signed *item) const
+{
+ return Item_func_or_sum_illegal_param(item);
+}
+
+
+bool Type_handler_geometry::
+ Item_func_unsigned_fix_length_and_dec(Item_func_unsigned *item) const
+{
+ return Item_func_or_sum_illegal_param(item);
+}
+
+
+bool Type_handler_geometry::
+ Item_double_typecast_fix_length_and_dec(Item_double_typecast *item) const
+{
+ return Item_func_or_sum_illegal_param(item);
+}
+
+
+bool Type_handler_geometry::
+ Item_float_typecast_fix_length_and_dec(Item_float_typecast *item) const
+{
+ return Item_func_or_sum_illegal_param(item);
+}
+
+
+bool Type_handler_geometry::
+ Item_decimal_typecast_fix_length_and_dec(Item_decimal_typecast *item) const
+{
+ return Item_func_or_sum_illegal_param(item);
+}
+
+
+bool Type_handler_geometry::
+ Item_char_typecast_fix_length_and_dec(Item_char_typecast *item) const
+{
+ if (item->cast_charset() != &my_charset_bin)
+ return Item_func_or_sum_illegal_param(item); // CAST(geom AS CHAR)
+ item->fix_length_and_dec_str();
+ return false; // CAST(geom AS BINARY)
+}
+
+
+bool Type_handler_geometry::
+ Item_time_typecast_fix_length_and_dec(Item_time_typecast *item) const
+{
+ return Item_func_or_sum_illegal_param(item);
+}
+
+
+
+bool Type_handler_geometry::
+ Item_date_typecast_fix_length_and_dec(Item_date_typecast *item) const
+{
+ return Item_func_or_sum_illegal_param(item);
+}
+
+
+bool Type_handler_geometry::
+ Item_datetime_typecast_fix_length_and_dec(Item_datetime_typecast *item)
+ const
+{
+ return Item_func_or_sum_illegal_param(item);
+
+}
+
+
+bool Type_handler_geometry::
+ Item_param_set_from_value(THD *thd,
+ Item_param *param,
+ const Type_all_attributes *attr,
+ const st_value *val) const
+{
+ param->unsigned_flag= false;
+ param->setup_conversion_blob(thd);
+ return param->set_str(val->m_string.ptr(), val->m_string.length(),
+ &my_charset_bin, &my_charset_bin);
+}
+
+
+void Type_handler_geometry::Item_param_set_param_func(Item_param *param,
+ uchar **pos,
+ ulong len) const
+{
+ param->set_null(); // Not possible type code in the client-server protocol
+}
+
+
+Field *Type_handler_geometry::
+ make_table_field_from_def(TABLE_SHARE *share, MEM_ROOT *root,
+ const LEX_CSTRING *name,
+ const Record_addr &rec, const Bit_addr &bit,
+ const Column_definition_attributes *attr,
+ uint32 flags) const
+{
+ status_var_increment(current_thd->status_var.feature_gis);
+ return new (root)
+ Field_geom(rec.ptr(), rec.null_ptr(), rec.null_bit(),
+ attr->unireg_check, name, share,
+ attr->pack_flag_to_pack_length(), this, attr->srid);
+}
+
+
+void Type_handler_geometry::
+ Column_definition_attributes_frm_pack(const Column_definition_attributes *def,
+ uchar *buff) const
+{
+ DBUG_ASSERT(f_decimals(def->pack_flag & ~FIELDFLAG_GEOM) == 0);
+ def->frm_pack_basic(buff);
+ buff[11]= 0;
+ buff[14]= (uchar) geometry_type();
+}
+
+
+
+/* Values 1-40 reserved for 1-byte options,
+ 41-80 for 2-byte options,
+ 81-120 for 4-byte options,
+ 121-160 for 8-byte options,
+ other - varied length in next 1-3 bytes.
+*/
+enum extra2_gis_field_options {
+ FIELDGEOM_END=0,
+ FIELDGEOM_STORAGE_MODEL=1,
+ FIELDGEOM_PRECISION=2,
+ FIELDGEOM_SCALE=3,
+ FIELDGEOM_SRID=81,
+};
+
+
+uint
+Type_handler_geometry::
+ Column_definition_gis_options_image(uchar *cbuf,
+ const Column_definition &def) const
+{
+ if (cbuf)
+ {
+ cbuf[0]= FIELDGEOM_STORAGE_MODEL;
+ cbuf[1]= (uchar) Field_geom::GEOM_STORAGE_WKB;
+
+ cbuf[2]= FIELDGEOM_PRECISION;
+ cbuf[3]= (uchar) def.length;
+
+ cbuf[4]= FIELDGEOM_SCALE;
+ cbuf[5]= (uchar) def.decimals;
+
+ cbuf[6]= FIELDGEOM_SRID;
+ int4store(cbuf + 7, ((uint32) def.srid));
+
+ cbuf[11]= FIELDGEOM_END;
+ }
+ return 12;
+}
+
+
+static uint gis_field_options_read(const uchar *buf, size_t buf_len,
+ Field_geom::storage_type *st_type,
+ uint *precision, uint *scale, uint *srid)
+{
+ const uchar *buf_end= buf + buf_len;
+ const uchar *cbuf= buf;
+ int option_id;
+
+ *precision= *scale= *srid= 0;
+ *st_type= Field_geom::GEOM_STORAGE_WKB;
+
+ if (!buf) /* can only happen with the old FRM file */
+ goto end_of_record;
+
+ while (cbuf < buf_end)
+ {
+ switch ((option_id= *(cbuf++)))
+ {
+ case FIELDGEOM_STORAGE_MODEL:
+ *st_type= (Field_geom::storage_type) cbuf[0];
+ break;
+ case FIELDGEOM_PRECISION:
+ *precision= cbuf[0];
+ break;
+ case FIELDGEOM_SCALE:
+ *scale= cbuf[0];
+ break;
+ case FIELDGEOM_SRID:
+ *srid= uint4korr(cbuf);
+ break;
+ case FIELDGEOM_END:
+ goto end_of_record;
+ }
+ if (option_id > 0 && option_id <= 40)
+ cbuf+= 1;
+ else if (option_id > 40 && option_id <= 80)
+ cbuf+= 2;
+ else if (option_id > 80 && option_id <= 120)
+ cbuf+= 4;
+ else if (option_id > 120 && option_id <= 160)
+ cbuf+= 8;
+ else /* > 160 and <=255 */
+ cbuf+= cbuf[0] ? 1 + cbuf[0] : 3 + uint2korr(cbuf+1);
+ }
+
+end_of_record:
+ return (uint)(cbuf - buf);
+}
+
+
+bool Type_handler_geometry::
+ Column_definition_attributes_frm_unpack(Column_definition_attributes *attr,
+ TABLE_SHARE *share,
+ const uchar *buffer,
+ LEX_CUSTRING *gis_options)
+ const
+{
+ uint gis_opt_read, gis_length, gis_decimals;
+ Field_geom::storage_type st_type;
+ attr->frm_unpack_basic(buffer);
+ gis_opt_read= gis_field_options_read(gis_options->str,
+ gis_options->length,
+ &st_type, &gis_length,
+ &gis_decimals, &attr->srid);
+ gis_options->str+= gis_opt_read;
+ gis_options->length-= gis_opt_read;
+ return false;
+}
+
+
+uint32
+Type_handler_geometry::max_display_length_for_field(const Conv_source &src)
+ const
+{
+ return (uint32) my_set_bits(4 * 8);
+}
+
+
+enum_conv_type
+Field_geom::rpl_conv_type_from(const Conv_source &source,
+ const Relay_log_info *rli,
+ const Conv_param &param) const
+{
+ return binlog_type() == source.real_field_type() ?
+ rpl_conv_type_from_same_data_type(source.metadata(), rli, param) :
+ CONV_TYPE_IMPOSSIBLE;
+}
+
+
+/*****************************************************************/
+void Field_geom::sql_type(String &res) const
+{
+ CHARSET_INFO *cs= &my_charset_latin1;
+ const Name tmp= m_type_handler->name();
+ res.set(tmp.ptr(), tmp.length(), cs);
+}
+
+
+int Field_geom::store(double nr)
+{
+ my_message(ER_CANT_CREATE_GEOMETRY_OBJECT,
+ ER_THD(get_thd(), ER_CANT_CREATE_GEOMETRY_OBJECT), MYF(0));
+ return -1;
+}
+
+
+int Field_geom::store(longlong nr, bool unsigned_val)
+{
+ my_message(ER_CANT_CREATE_GEOMETRY_OBJECT,
+ ER_THD(get_thd(), ER_CANT_CREATE_GEOMETRY_OBJECT), MYF(0));
+ return -1;
+}
+
+
+int Field_geom::store_decimal(const my_decimal *)
+{
+ my_message(ER_CANT_CREATE_GEOMETRY_OBJECT,
+ ER_THD(get_thd(), ER_CANT_CREATE_GEOMETRY_OBJECT), MYF(0));
+ return -1;
+}
+
+
+int Field_geom::store(const char *from, size_t length, CHARSET_INFO *cs)
+{
+ if (!length)
+ bzero(ptr, Field_blob::pack_length());
+ else
+ {
+ if (from == Geometry::bad_geometry_data.ptr())
+ goto err;
+ // Check given WKB
+ uint32 wkb_type;
+ if (length < SRID_SIZE + WKB_HEADER_SIZE + 4)
+ goto err;
+ wkb_type= uint4korr(from + SRID_SIZE + 1);
+ if (wkb_type < (uint32) Geometry::wkb_point ||
+ wkb_type > (uint32) Geometry::wkb_last)
+ goto err;
+
+ if (m_type_handler->geometry_type() != Type_handler_geometry::GEOM_GEOMETRY &&
+ m_type_handler->geometry_type() != Type_handler_geometry::GEOM_GEOMETRYCOLLECTION &&
+ (uint32) m_type_handler->geometry_type() != wkb_type)
+ {
+ const char *db= table->s->db.str;
+ const char *tab_name= table->s->table_name.str;
+
+ if (!db)
+ db= "";
+ if (!tab_name)
+ tab_name= "";
+
+ my_error(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, MYF(0),
+ Geometry::ci_collection[m_type_handler->geometry_type()]->m_name.str,
+ Geometry::ci_collection[wkb_type]->m_name.str,
+ db, tab_name, field_name.str,
+ (ulong) table->in_use->get_stmt_da()->
+ current_row_for_warning());
+ goto err_exit;
+ }
+
+ Field_blob::store_length(length);
+ if ((table->copy_blobs || length <= MAX_FIELD_WIDTH) &&
+ from != value.ptr())
+ { // Must make a copy
+ value.copy(from, length, cs);
+ from= value.ptr();
+ }
+ bmove(ptr + packlength, &from, sizeof(char*));
+ }
+ return 0;
+
+err:
+ my_message(ER_CANT_CREATE_GEOMETRY_OBJECT,
+ ER_THD(get_thd(), ER_CANT_CREATE_GEOMETRY_OBJECT), MYF(0));
+err_exit:
+ bzero(ptr, Field_blob::pack_length());
+ return -1;
+}
+
+
+bool Field_geom::is_equal(const Column_definition &new_field) const
+{
+ /*
+ - Allow ALTER..INPLACE to supertype (GEOMETRY),
+ e.g. POINT to GEOMETRY or POLYGON to GEOMETRY.
+ - Allow ALTER..INPLACE to the same geometry type: POINT -> POINT
+ */
+ if (new_field.type_handler() == m_type_handler)
+ return true;
+ const Type_handler_geometry *gth=
+ dynamic_cast<const Type_handler_geometry*>(new_field.type_handler());
+ return gth && gth->is_binary_compatible_geom_super_type_for(m_type_handler);
+}
+
+
+bool Field_geom::can_optimize_range(const Item_bool_func *cond,
+ const Item *item,
+ bool is_eq_func) const
+{
+ return item->cmp_type() == STRING_RESULT;
+}
+
+
+bool Field_geom::load_data_set_no_data(THD *thd, bool fixed_format)
+{
+ return Field_geom::load_data_set_null(thd);
+}
+
+
+bool Field_geom::load_data_set_null(THD *thd)
+{
+ Field_blob::reset();
+ if (!maybe_null())
+ {
+ my_error(ER_WARN_NULL_TO_NOTNULL, MYF(0), field_name.str,
+ thd->get_stmt_da()->current_row_for_warning());
+ return true;
+ }
+ set_null();
+ set_has_explicit_value(); // Do not auto-update this field
+ return false;
+}
+
+
+uint Field_geom::get_key_image(uchar *buff,uint length, imagetype type_arg)
+{
+ if (type_arg == itMBR)
+ {
+ LEX_CSTRING tmp;
+ tmp.str= (const char *) get_ptr();
+ tmp.length= get_length(ptr);
+ return Geometry::get_key_image_itMBR(tmp, buff, length);
+ }
+ return Field_blob::get_key_image_itRAW(buff, length);
+}
+
+Binlog_type_info Field_geom::binlog_type_info() const
+{
+ DBUG_ASSERT(Field_geom::type() == binlog_type());
+ return Binlog_type_info(Field_geom::type(), pack_length_no_ptr(), 1,
+ field_charset(), type_handler_geom()->geometry_type());
+}
+
+#endif // HAVE_SPATIAL
diff --git a/sql/sql_type_geom.h b/sql/sql_type_geom.h
new file mode 100644
index 00000000000..16c57af81c6
--- /dev/null
+++ b/sql/sql_type_geom.h
@@ -0,0 +1,437 @@
+#ifndef SQL_TYPE_GEOM_H_INCLUDED
+#define SQL_TYPE_GEOM_H_INCLUDED
+/*
+ Copyright (c) 2015 MariaDB Foundation
+ Copyright (c) 2019 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
+
+#ifdef USE_PRAGMA_IMPLEMENTATION
+#pragma implementation // gcc: Class implementation
+#endif
+
+#include "mariadb.h"
+#include "sql_type.h"
+
+#ifdef HAVE_SPATIAL
+class Type_handler_geometry: public Type_handler_string_result
+{
+public:
+ enum geometry_types
+ {
+ GEOM_GEOMETRY = 0, GEOM_POINT = 1, GEOM_LINESTRING = 2, GEOM_POLYGON = 3,
+ GEOM_MULTIPOINT = 4, GEOM_MULTILINESTRING = 5, GEOM_MULTIPOLYGON = 6,
+ GEOM_GEOMETRYCOLLECTION = 7
+ };
+ static bool check_type_geom_or_binary(const char *opname, const Item *item);
+ static bool check_types_geom_or_binary(const char *opname,
+ Item * const *args,
+ uint start, uint end);
+ static const Type_handler_geometry *type_handler_geom_by_type(uint type);
+public:
+ virtual ~Type_handler_geometry() {}
+ const Name name() const override;
+ enum_field_types field_type() const override { return MYSQL_TYPE_GEOMETRY; }
+ bool is_param_long_data_type() const override { return true; }
+ uint32 max_display_length_for_field(const Conv_source &src) const override;
+ uint32 calc_pack_length(uint32 length) const override;
+ const Type_collection *type_collection() const override;
+ const Type_handler *type_handler_for_comparison() const override;
+ virtual geometry_types geometry_type() const { return GEOM_GEOMETRY; }
+ virtual Item *create_typecast_item(THD *thd, Item *item,
+ const Type_cast_attributes &attr)
+ const override;
+ const Type_handler *type_handler_frm_unpack(const uchar *buffer)
+ const override;
+ bool is_binary_compatible_geom_super_type_for(const Type_handler_geometry *th)
+ const
+ {
+ return geometry_type() == GEOM_GEOMETRY ||
+ geometry_type() == th->geometry_type();
+ }
+ bool type_can_have_key_part() const override { return true; }
+ bool subquery_type_allows_materialization(const Item *inner,
+ const Item *outer) const override
+ {
+ return false; // Materialization does not work with GEOMETRY columns
+ }
+ void Item_param_set_param_func(Item_param *param,
+ uchar **pos, ulong len) const override;
+ bool Item_param_set_from_value(THD *thd,
+ Item_param *param,
+ const Type_all_attributes *attr,
+ const st_value *value) const override;
+ Field *make_conversion_table_field(MEM_ROOT *root,
+ TABLE *table, uint metadata,
+ const Field *target) const override;
+ uint Column_definition_gis_options_image(uchar *buff,
+ const Column_definition &def)
+ const override;
+ bool Column_definition_data_type_info_image(Binary_string *to,
+ const Column_definition &def)
+ const override
+ {
+ return false;
+ }
+ void
+ Column_definition_attributes_frm_pack(const Column_definition_attributes *at,
+ uchar *buff) const override;
+ bool
+ Column_definition_attributes_frm_unpack(Column_definition_attributes *attr,
+ TABLE_SHARE *share,
+ const uchar *buffer,
+ LEX_CUSTRING *gis_options) const
+ override;
+ bool Column_definition_fix_attributes(Column_definition *c) const override;
+ void Column_definition_reuse_fix_attributes(THD *thd,
+ Column_definition *c,
+ const Field *field) const
+ override;
+ bool Column_definition_prepare_stage1(THD *thd,
+ MEM_ROOT *mem_root,
+ Column_definition *c,
+ handler *file,
+ ulonglong table_flags) const override;
+ bool Column_definition_prepare_stage2(Column_definition *c,
+ handler *file,
+ ulonglong table_flags) const override;
+ bool Key_part_spec_init_primary(Key_part_spec *part,
+ const Column_definition &def,
+ const handler *file) const override;
+ bool Key_part_spec_init_unique(Key_part_spec *part,
+ const Column_definition &def,
+ const handler *file,
+ bool *has_key_needed) const override;
+ bool Key_part_spec_init_multiple(Key_part_spec *part,
+ const Column_definition &def,
+ const handler *file) const override;
+ bool Key_part_spec_init_foreign(Key_part_spec *part,
+ const Column_definition &def,
+ const handler *file) const override;
+ bool Key_part_spec_init_spatial(Key_part_spec *part,
+ const Column_definition &def) const override;
+ Field *make_table_field(MEM_ROOT *root,
+ const LEX_CSTRING *name,
+ const Record_addr &addr,
+ const Type_all_attributes &attr,
+ TABLE_SHARE *share) const override;
+
+ Field *make_table_field_from_def(TABLE_SHARE *share,
+ MEM_ROOT *mem_root,
+ const LEX_CSTRING *name,
+ const Record_addr &addr,
+ const Bit_addr &bit,
+ const Column_definition_attributes *attr,
+ uint32 flags) const override;
+
+ bool can_return_int() const override { return false; }
+ bool can_return_decimal() const override { return false; }
+ bool can_return_real() const override { return false; }
+ bool can_return_text() const override { return false; }
+ bool can_return_date() const override { return false; }
+ bool can_return_time() const override { return false; }
+ bool Item_func_round_fix_length_and_dec(Item_func_round *) const override;
+ bool Item_func_int_val_fix_length_and_dec(Item_func_int_val *) const override;
+ bool Item_func_abs_fix_length_and_dec(Item_func_abs *) const override;
+ bool Item_func_neg_fix_length_and_dec(Item_func_neg *) const override;
+ bool Item_hybrid_func_fix_attributes(THD *thd,
+ const char *name,
+ Type_handler_hybrid_field_type *h,
+ Type_all_attributes *attr,
+ Item **items, uint nitems) const
+ override;
+ bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const override;
+ bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const override;
+ bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *) const override;
+
+ bool Item_func_signed_fix_length_and_dec(Item_func_signed *) const override;
+ bool Item_func_unsigned_fix_length_and_dec(Item_func_unsigned *) const
+ override;
+ bool Item_double_typecast_fix_length_and_dec(Item_double_typecast *) const
+ override;
+ bool Item_float_typecast_fix_length_and_dec(Item_float_typecast *) const
+ override;
+ bool Item_decimal_typecast_fix_length_and_dec(Item_decimal_typecast *) const
+ override;
+ bool Item_char_typecast_fix_length_and_dec(Item_char_typecast *) const
+ override;
+ bool Item_time_typecast_fix_length_and_dec(Item_time_typecast *) const
+ override;
+ bool Item_date_typecast_fix_length_and_dec(Item_date_typecast *) const
+ override;
+ bool Item_datetime_typecast_fix_length_and_dec(Item_datetime_typecast *) const
+ override;
+};
+
+
+class Type_handler_point: public Type_handler_geometry
+{
+ // Binary length of a POINT value: 4 byte SRID + 21 byte WKB POINT
+ static uint octet_length() { return 25; }
+public:
+ geometry_types geometry_type() const override { return GEOM_POINT; }
+ const Name name() const override;
+ Item *make_constructor_item(THD *thd, List<Item> *args) const override;
+ bool Key_part_spec_init_primary(Key_part_spec *part,
+ const Column_definition &def,
+ const handler *file) const override;
+ bool Key_part_spec_init_unique(Key_part_spec *part,
+ const Column_definition &def,
+ const handler *file,
+ bool *has_key_needed) const override;
+ bool Key_part_spec_init_multiple(Key_part_spec *part,
+ const Column_definition &def,
+ const handler *file) const override;
+ bool Key_part_spec_init_foreign(Key_part_spec *part,
+ const Column_definition &def,
+ const handler *file) const override;
+};
+
+
+class Type_handler_linestring: public Type_handler_geometry
+{
+public:
+ geometry_types geometry_type() const override { return GEOM_LINESTRING; }
+ const Name name() const override;
+ Item *make_constructor_item(THD *thd, List<Item> *args) const override;
+};
+
+
+class Type_handler_polygon: public Type_handler_geometry
+{
+public:
+ geometry_types geometry_type() const override { return GEOM_POLYGON; }
+ const Name name() const override;
+ Item *make_constructor_item(THD *thd, List<Item> *args) const override;
+};
+
+
+class Type_handler_multipoint: public Type_handler_geometry
+{
+public:
+ geometry_types geometry_type() const override { return GEOM_MULTIPOINT; }
+ const Name name() const override;
+ Item *make_constructor_item(THD *thd, List<Item> *args) const override;
+};
+
+
+class Type_handler_multilinestring: public Type_handler_geometry
+{
+public:
+ geometry_types geometry_type() const override { return GEOM_MULTILINESTRING; }
+ const Name name() const override;
+ Item *make_constructor_item(THD *thd, List<Item> *args) const override;
+};
+
+
+class Type_handler_multipolygon: public Type_handler_geometry
+{
+public:
+ geometry_types geometry_type() const override { return GEOM_MULTIPOLYGON; }
+ const Name name() const override;
+ Item *make_constructor_item(THD *thd, List<Item> *args) const override;
+};
+
+
+class Type_handler_geometrycollection: public Type_handler_geometry
+{
+public:
+ geometry_types geometry_type() const override { return GEOM_GEOMETRYCOLLECTION; }
+ const Name name() const override;
+ Item *make_constructor_item(THD *thd, List<Item> *args) const override;
+};
+
+
+extern MYSQL_PLUGIN_IMPORT Type_handler_geometry type_handler_geometry;
+extern MYSQL_PLUGIN_IMPORT Type_handler_point type_handler_point;
+extern MYSQL_PLUGIN_IMPORT Type_handler_linestring type_handler_linestring;
+extern MYSQL_PLUGIN_IMPORT Type_handler_polygon type_handler_polygon;
+extern MYSQL_PLUGIN_IMPORT Type_handler_multipoint type_handler_multipoint;
+extern MYSQL_PLUGIN_IMPORT Type_handler_multilinestring type_handler_multilinestring;
+extern MYSQL_PLUGIN_IMPORT Type_handler_multipolygon type_handler_multipolygon;
+extern MYSQL_PLUGIN_IMPORT Type_handler_geometrycollection type_handler_geometrycollection;
+
+
+class Type_collection_geometry: public Type_collection
+{
+ const Type_handler *aggregate_common(const Type_handler *a,
+ const Type_handler *b) const
+ {
+ if (a == b)
+ return a;
+ if (dynamic_cast<const Type_handler_geometry*>(a) &&
+ dynamic_cast<const Type_handler_geometry*>(b))
+ return &type_handler_geometry;
+ return NULL;
+ }
+ const Type_handler *aggregate_if_null(const Type_handler *a,
+ const Type_handler *b) const
+ {
+ return a == &type_handler_null ? b :
+ b == &type_handler_null ? a :
+ NULL;
+ }
+ const Type_handler *aggregate_if_long_blob(const Type_handler *a,
+ const Type_handler *b) const
+ {
+ return a == &type_handler_long_blob ? &type_handler_long_blob :
+ b == &type_handler_long_blob ? &type_handler_long_blob :
+ NULL;
+ }
+ const Type_handler *aggregate_if_string(const Type_handler *a,
+ const Type_handler *b) const;
+#ifndef DBUG_OFF
+ bool init_aggregators(Type_handler_data *data, const Type_handler *geom) const;
+#endif
+public:
+ bool init(Type_handler_data *data) override;
+ const Type_handler *handler_by_name(const LEX_CSTRING &name) const override;
+ const Type_handler *aggregate_for_result(const Type_handler *a,
+ const Type_handler *b)
+ const override;
+ const Type_handler *aggregate_for_comparison(const Type_handler *a,
+ const Type_handler *b)
+ const override;
+ const Type_handler *aggregate_for_min_max(const Type_handler *a,
+ const Type_handler *b)
+ const override;
+ const Type_handler *aggregate_for_num_op(const Type_handler *a,
+ const Type_handler *b)
+ const override
+ {
+ return NULL;
+ }
+};
+
+
+extern MYSQL_PLUGIN_IMPORT Type_collection_geometry type_collection_geometry;
+
+
+#include "field.h"
+
+class Field_geom :public Field_blob
+{
+ const Type_handler_geometry *m_type_handler;
+public:
+ uint srid;
+ uint precision;
+ enum storage_type { GEOM_STORAGE_WKB= 0, GEOM_STORAGE_BINARY= 1};
+ enum storage_type storage;
+
+ Field_geom(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
+ enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg,
+ TABLE_SHARE *share, uint blob_pack_length,
+ const Type_handler_geometry *gth,
+ uint field_srid)
+ :Field_blob(ptr_arg, null_ptr_arg, null_bit_arg, unireg_check_arg,
+ field_name_arg, share, blob_pack_length, &my_charset_bin),
+ m_type_handler(gth)
+ { srid= field_srid; }
+ enum_conv_type rpl_conv_type_from(const Conv_source &source,
+ const Relay_log_info *rli,
+ const Conv_param &param) const override;
+ enum ha_base_keytype key_type() const override
+ {
+ return HA_KEYTYPE_VARBINARY2;
+ }
+ const Type_handler *type_handler() const override
+ {
+ return m_type_handler;
+ }
+ const Type_handler_geometry *type_handler_geom() const
+ {
+ return m_type_handler;
+ }
+ void set_type_handler(const Type_handler_geometry *th)
+ {
+ m_type_handler= th;
+ }
+ enum_field_types type() const override
+ {
+ return MYSQL_TYPE_GEOMETRY;
+ }
+ enum_field_types real_type() const override
+ {
+ return MYSQL_TYPE_GEOMETRY;
+ }
+ Information_schema_character_attributes
+ information_schema_character_attributes() const override
+ {
+ return Information_schema_character_attributes();
+ }
+ void make_send_field(Send_field *to) override
+ {
+ Field_longstr::make_send_field(to);
+ }
+ bool can_optimize_range(const Item_bool_func *cond,
+ const Item *item,
+ bool is_eq_func) const override;
+ void sql_type(String &str) const override;
+ Copy_func *get_copy_func(const Field *from) const override
+ {
+ const Type_handler_geometry *fth=
+ dynamic_cast<const Type_handler_geometry*>(from->type_handler());
+ if (fth && m_type_handler->is_binary_compatible_geom_super_type_for(fth))
+ return get_identical_copy_func();
+ return do_conv_blob;
+ }
+ bool memcpy_field_possible(const Field *from) const override
+ {
+ const Type_handler_geometry *fth=
+ dynamic_cast<const Type_handler_geometry*>(from->type_handler());
+ return fth &&
+ m_type_handler->is_binary_compatible_geom_super_type_for(fth) &&
+ !table->copy_blobs;
+ }
+ bool is_equal(const Column_definition &new_field) const override;
+ bool can_be_converted_by_engine(const Column_definition &new_type)
+ const override
+ {
+ return false; // Override the Field_blob behavior
+ }
+
+ int store(const char *to, size_t length, CHARSET_INFO *charset) override;
+ int store(double nr) override;
+ int store(longlong nr, bool unsigned_val) override;
+ int store_decimal(const my_decimal *) override;
+ uint size_of() const override{ return sizeof(*this); }
+ /**
+ Key length is provided only to support hash joins. (compared byte for byte)
+ Ex: SELECT .. FROM t1,t2 WHERE t1.field_geom1=t2.field_geom2.
+
+ The comparison is not very relevant, as identical geometry might be
+ represented differently, but we need to support it either way.
+ */
+ uint32 key_length() const override{ return packlength; }
+ uint get_key_image(uchar *buff,uint length, imagetype type_arg) override;
+
+ /**
+ Non-nullable GEOMETRY types cannot have defaults,
+ but the underlying blob must still be reset.
+ */
+ int reset(void) override{ return Field_blob::reset() || !maybe_null(); }
+ bool load_data_set_null(THD *thd) override;
+ bool load_data_set_no_data(THD *thd, bool fixed_format) override;
+
+ uint get_srid() const { return srid; }
+ void print_key_value(String *out, uint32 length) override
+ {
+ out->append(STRING_WITH_LEN("unprintable_geometry_value"));
+ }
+ Binlog_type_info binlog_type_info() const override;
+};
+
+#endif // HAVE_SPATIAL
+
+#endif // SQL_TYPE_GEOM_H_INCLUDED
diff --git a/sql/sql_type_json.cc b/sql/sql_type_json.cc
index f53a247d816..a804366ec03 100644
--- a/sql/sql_type_json.cc
+++ b/sql/sql_type_json.cc
@@ -35,8 +35,10 @@ Type_handler_json_longtext::make_json_valid_expr(THD *thd,
Lex_ident_sys_st str;
Item *field, *expr;
str.set_valid_utf8(field_name);
- if (unlikely(!(field= thd->lex->create_item_ident_field(thd, NullS, NullS,
- &str))))
+ if (unlikely(!(field= thd->lex->create_item_ident_field(thd,
+ Lex_ident_sys(),
+ Lex_ident_sys(),
+ str))))
return 0;
if (unlikely(!(expr= new (thd->mem_root) Item_func_json_valid(thd, field))))
return 0;
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index da25fa774d0..e3c5508e947 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -72,7 +72,7 @@ void select_unit::change_select()
switch (step)
{
case INTERSECT_TYPE:
- intersect_mark->value= prev_step= curr_step;
+ prev_step= curr_step;
curr_step= current_select_number;
break;
case EXCEPT_TYPE:
@@ -83,6 +83,7 @@ void select_unit::change_select()
}
DBUG_VOID_RETURN;
}
+
/**
Fill temporary tables for UNION/EXCEPT/INTERSECT
@@ -93,7 +94,7 @@ UNION:
EXCEPT:
looks for the record in the table (with 'counter' field first if
INTERSECT present in the sequence) and delete it if found
-INTESECT:
+INTERSECT:
looks for the same record with 'counter' field of previous operation,
put as a 'counter' number of the current SELECT.
We scan the table and remove all records which marked with not last
@@ -108,7 +109,7 @@ INTESECT:
*/
int select_unit::send_data(List<Item> &values)
{
- int rc;
+ int rc= 0;
int not_reported_error= 0;
if (unit->offset_limit_cnt)
{ // using limit offset,count
@@ -119,17 +120,24 @@ int select_unit::send_data(List<Item> &values)
return 0;
if (table->no_rows_with_nulls)
table->null_catch_flags= CHECK_ROW_FOR_NULLS_TO_REJECT;
- if (intersect_mark)
+
+ fill_record(thd, table, table->field + addon_cnt, values, true, false);
+ /* set up initial values for records to be written */
+ if (addon_cnt && step == UNION_TYPE)
{
- fill_record(thd, table, table->field + 1, values, TRUE, FALSE);
- table->field[0]->store((ulonglong) curr_step, 1);
+ DBUG_ASSERT(addon_cnt == 1);
+ table->field[0]->store((longlong) curr_step, 1);
}
- else
- fill_record(thd, table, table->field, values, TRUE, FALSE);
+
if (unlikely(thd->is_error()))
{
rc= 1;
- goto end;
+ if (unlikely(not_reported_error))
+ {
+ DBUG_ASSERT(rc);
+ table->file->print_error(not_reported_error, MYF(0));
+ }
+ return rc;
}
if (table->no_rows_with_nulls)
{
@@ -137,105 +145,58 @@ int select_unit::send_data(List<Item> &values)
if (table->null_catch_flags)
{
rc= 0;
- goto end;
+ if (unlikely(not_reported_error))
+ {
+ DBUG_ASSERT(rc);
+ table->file->print_error(not_reported_error, MYF(0));
+ }
+ return rc;
}
}
- // select_unit::change_select() change step & Co correctly for each SELECT
+ /* select_unit::change_select() change step & Co correctly for each SELECT */
+ int find_res;
switch (step)
{
- case UNION_TYPE:
- {
- if (unlikely((write_err=
- table->file->ha_write_tmp_row(table->record[0]))))
- {
- if (write_err == HA_ERR_FOUND_DUPP_KEY)
- {
- /*
- Inform upper level that we found a duplicate key, that should not
- be counted as part of limit
- */
- rc= -1;
- goto end;
- }
- bool is_duplicate= FALSE;
- /* create_internal_tmp_table_from_heap will generate error if needed */
- if (table->file->is_fatal_error(write_err, HA_CHECK_DUP) &&
- create_internal_tmp_table_from_heap(thd, table,
- tmp_table_param.start_recinfo,
- &tmp_table_param.recinfo,
- write_err, 1, &is_duplicate))
- {
- rc= 1;
- goto end;
- }
+ case UNION_TYPE:
+ rc= write_record();
+ /* no reaction with conversion */
+ if (rc == -2)
+ rc= 0;
+ break;
- if (is_duplicate)
- {
- rc= -1;
- goto end;
- }
- }
- break;
- }
- case EXCEPT_TYPE:
- {
- int find_res;
- /*
- The temporary table uses very first index or constrain for
- checking unique constrain.
- */
- if (!(find_res= table->file->find_unique_row(table->record[0], 0)))
- {
- DBUG_ASSERT(!table->triggers);
- table->status|= STATUS_DELETED;
- not_reported_error= table->file->ha_delete_tmp_row(table->record[0]);
- rc= MY_TEST(not_reported_error);
- goto end;
- }
- else
- {
- if ((rc= not_reported_error= (find_res != 1)))
- goto end;
- }
- break;
- }
- case INTERSECT_TYPE:
+ case EXCEPT_TYPE:
+ /*
+ The temporary table uses very first index or constrain for
+ checking unique constrain.
+ */
+ if (!(find_res= table->file->find_unique_row(table->record[0], 0)))
+ rc= delete_record();
+ else
+ rc= not_reported_error= (find_res != 1);
+ break;
+ case INTERSECT_TYPE:
+ /*
+ The temporary table uses very first index or constrain for
+ checking unique constrain.
+ */
+ if (!(find_res= table->file->find_unique_row(table->record[0], 0)))
{
- int find_res;
- /*
- The temporary table uses very first index or constrain for
- checking unique constrain.
- */
- if (!(find_res= table->file->find_unique_row(table->record[0], 0)))
+ DBUG_ASSERT(!table->triggers);
+ if (table->field[0]->val_int() == prev_step)
{
- DBUG_ASSERT(!table->triggers);
- if (table->field[0]->val_int() != prev_step)
- {
- rc= 0;
- goto end;
- }
- store_record(table, record[1]);
- table->field[0]->store(curr_step, 0);
- not_reported_error= table->file->ha_update_tmp_row(table->record[1],
- table->record[0]);
+ not_reported_error= update_counter(table->field[0], curr_step);
rc= MY_TEST(not_reported_error);
DBUG_ASSERT(rc != HA_ERR_RECORD_IS_THE_SAME);
- goto end;
- }
- else
- {
- if ((rc= not_reported_error= (find_res != 1)))
- goto end;
}
- break;
}
- default:
- DBUG_ASSERT(0);
+ else
+ rc= not_reported_error= (find_res != 1);
+ break;
+ default:
+ DBUG_ASSERT(0);
}
- rc= 0;
-end:
if (unlikely(not_reported_error))
{
DBUG_ASSERT(rc);
@@ -251,7 +212,7 @@ bool select_unit::send_eof()
thd->lex->current_select->next_select()->get_linkage() == INTERSECT_TYPE))
{
/*
- it is not INTESECT or next SELECT in the sequence is INTERSECT so no
+ it is not INTERSECT or next SELECT in the sequence is INTERSECT so no
need filtering (the last INTERSECT in this sequence of intersects will
filter).
*/
@@ -265,15 +226,14 @@ bool select_unit::send_eof()
TODO: as optimization for simple case this could be moved to
'fake_select' WHERE condition
*/
- handler *file= table->file;
int error;
- if (unlikely(file->ha_rnd_init_with_error(1)))
+ if (table->file->ha_rnd_init_with_error(1))
return 1;
-
do
{
- if (unlikely(error= file->ha_rnd_next(table->record[0])))
+ error= table->file->ha_rnd_next(table->record[0]);
+ if (unlikely(error))
{
if (error == HA_ERR_END_OF_FILE)
{
@@ -283,9 +243,9 @@ bool select_unit::send_eof()
break;
}
if (table->field[0]->val_int() != curr_step)
- error= file->ha_delete_tmp_row(table->record[0]);
- } while (likely(!error));
- file->ha_rnd_end();
+ error= delete_record();
+ } while (!error);
+ table->file->ha_rnd_end();
if (unlikely(error))
table->file->print_error(error, MYF(0));
@@ -345,6 +305,7 @@ bool select_unit::flush()
create_table whether to physically create result table
keep_row_order keep rows in order as they were inserted
hidden number of hidden fields (for INTERSECT)
+ plus one for `ALL`
DESCRIPTION
Create a temporary table that is used to store the result of a UNION,
@@ -433,6 +394,143 @@ select_union_recursive::create_result_table(THD *thd_arg,
}
+/*
+ @brief
+ Write a record
+
+ @retval
+ -2 conversion happened
+ -1 found a duplicate key
+ 0 no error
+ 1 if an error is reported
+*/
+
+int select_unit::write_record()
+{
+ if (unlikely((write_err= table->file->ha_write_tmp_row(table->record[0]))))
+ {
+ if (write_err == HA_ERR_FOUND_DUPP_KEY)
+ {
+ /*
+ Inform upper level that we found a duplicate key, that should not
+ be counted as part of limit
+ */
+ return -1;
+ }
+ bool is_duplicate= false;
+ /* create_internal_tmp_table_from_heap will generate error if needed */
+ if (table->file->is_fatal_error(write_err, HA_CHECK_DUP))
+ {
+ if (!create_internal_tmp_table_from_heap(thd, table,
+ tmp_table_param.start_recinfo,
+ &tmp_table_param.recinfo,
+ write_err, 1, &is_duplicate))
+ {
+ return -2;
+ }
+ else
+ {
+ return 1;
+ }
+ }
+ if (is_duplicate)
+ {
+ return -1;
+ }
+ }
+ return 0;
+}
+
+
+/*
+ @brief
+ Update counter for a record
+
+ @retval
+ 0 no error
+ -1 error occurred
+*/
+
+int select_unit::update_counter(Field* counter, longlong value)
+{
+ store_record(table, record[1]);
+ counter->store(value, 0);
+ int error= table->file->ha_update_tmp_row(table->record[1],
+ table->record[0]);
+ return error;
+}
+
+
+/*
+ @brief
+ Try to disable index
+
+ @retval
+ true index is disabled this time
+ false this time did not disable the index
+*/
+
+bool select_unit_ext::disable_index_if_needed(SELECT_LEX *curr_sl)
+{
+ if (is_index_enabled &&
+ (curr_sl == curr_sl->master_unit()->union_distinct ||
+ !curr_sl->next_select()) )
+ {
+ is_index_enabled= false;
+ if (table->file->ha_disable_indexes(HA_KEY_SWITCH_ALL))
+ return false;
+ table->no_keyread=1;
+ return true;
+ }
+ return false;
+}
+
+/*
+ @brief
+ Unfold a record
+
+ @retval
+ 0 no error
+ -1 conversion happened
+*/
+
+int select_unit_ext::unfold_record(ha_rows cnt)
+{
+
+ DBUG_ASSERT(cnt > 0);
+ int error= 0;
+ bool is_convertion_happened= false;
+ while (--cnt)
+ {
+ error= write_record();
+ if (error == -2)
+ {
+ is_convertion_happened= true;
+ error= -1;
+ }
+ }
+ if (is_convertion_happened)
+ return -1;
+ return error;
+}
+
+/*
+ @brief
+ Delete a record
+
+ @retval
+ 0 no error
+ 1 if an error is reported
+*/
+
+int select_unit::delete_record()
+{
+ DBUG_ASSERT(!table->triggers);
+ table->status|= STATUS_DELETED;
+ int not_reported_error= table->file->ha_delete_tmp_row(table->record[0]);
+ return MY_TEST(not_reported_error);
+}
+
/**
Reset and empty the temporary table that stores the materialized query
result.
@@ -448,6 +546,357 @@ void select_unit::cleanup()
}
+/*
+ @brief
+ Set up value needed by send_data() and send_eof()
+
+ @detail
+ - For EXCEPT we will decrease the counter by one
+ and INTERSECT / UNION we increase the counter.
+
+ - For INTERSECT we will modify the second extra field (intersect counter)
+ and for EXCEPT / UNION we modify the first (duplicate counter)
+*/
+
+void select_unit_ext::change_select()
+{
+ select_unit::change_select();
+ switch(step){
+ case UNION_TYPE:
+ increment= 1;
+ curr_op_type= UNION_DISTINCT;
+ break;
+ case EXCEPT_TYPE:
+ increment= -1;
+ curr_op_type= EXCEPT_DISTINCT;
+ break;
+ case INTERSECT_TYPE:
+ increment= 1;
+ curr_op_type= INTERSECT_DISTINCT;
+ break;
+ default: DBUG_ASSERT(0);
+ }
+ if (!thd->lex->current_select->distinct)
+ /* change type from DISTINCT to ALL */
+ curr_op_type= (set_op_type)(curr_op_type + 1);
+
+ duplicate_cnt= table->field[addon_cnt - 1];
+ if (addon_cnt == 2)
+ additional_cnt= table->field[addon_cnt - 2];
+ else
+ additional_cnt= NULL;
+}
+
+
+/*
+ @brief
+ Fill temporary tables for operations need extra fields
+
+ @detail
+ - If this operation is not distinct, we try to find it and increase the
+ counter by "increment" setted in select_unit_ext::change_select().
+
+ - If it is distinct, for UNION we write this record; for INTERSECT we
+ try to find it and increase the intersect counter if found; for EXCEPT
+ we try to find it and delete that record if found.
+
+*/
+
+int select_unit_ext::send_data(List<Item> &values)
+{
+ int rc= 0;
+ int not_reported_error= 0;
+ int find_res;
+ if (unit->offset_limit_cnt)
+ {
+ /* using limit offset,count */
+ unit->offset_limit_cnt--;
+ return 0;
+ }
+ if (thd->killed == ABORT_QUERY)
+ return 0;
+ if (table->no_rows_with_nulls)
+ table->null_catch_flags= CHECK_ROW_FOR_NULLS_TO_REJECT;
+
+ fill_record(thd, table, table->field + addon_cnt, values, true, false);
+ /* set up initial values for records to be written */
+ if ( step == UNION_TYPE )
+ {
+ /* set duplicate counter to 1 */
+ duplicate_cnt->store((longlong) 1, 1);
+ /* set the other counter to 0 */
+ if (curr_op_type == INTERSECT_ALL)
+ additional_cnt->store((longlong) 0, 1);
+ }
+
+ if (unlikely(thd->is_error()))
+ {
+ rc= 1;
+ if (unlikely(not_reported_error))
+ {
+ DBUG_ASSERT(rc);
+ table->file->print_error(not_reported_error, MYF(0));
+ }
+ return rc;
+ }
+ if (table->no_rows_with_nulls)
+ {
+ table->null_catch_flags&= ~CHECK_ROW_FOR_NULLS_TO_REJECT;
+ if (table->null_catch_flags)
+ {
+ if (unlikely(not_reported_error))
+ {
+ DBUG_ASSERT(rc);
+ table->file->print_error(not_reported_error, MYF(0));
+ }
+ return rc;
+ }
+ }
+
+ switch(curr_op_type)
+ {
+ case UNION_ALL:
+ if (!is_index_enabled ||
+ (find_res= table->file->find_unique_row(table->record[0], 0)))
+ {
+ rc= write_record();
+ /* no reaction with conversion */
+ if (rc == -2)
+ rc= 0;
+ }
+ else
+ {
+ longlong cnt= duplicate_cnt->val_int() + increment;
+ not_reported_error= update_counter(duplicate_cnt, cnt);
+ DBUG_ASSERT(!table->triggers);
+ rc= MY_TEST(not_reported_error);
+ }
+ break;
+
+ case EXCEPT_ALL:
+ if (!(find_res= table->file->find_unique_row(table->record[0], 0)))
+ {
+ longlong cnt= duplicate_cnt->val_int() + increment;
+ if (cnt == 0)
+ rc= delete_record();
+ else
+ {
+ not_reported_error= update_counter(duplicate_cnt, cnt);
+ DBUG_ASSERT(!table->triggers);
+ rc= MY_TEST(not_reported_error);
+ }
+ }
+ break;
+
+ case INTERSECT_ALL:
+ if (!(find_res= table->file->find_unique_row(table->record[0], 0)))
+ {
+ longlong cnt= duplicate_cnt->val_int() + increment;
+ if (cnt <= additional_cnt->val_int())
+ {
+ not_reported_error= update_counter(duplicate_cnt, cnt);
+ DBUG_ASSERT(!table->triggers);
+ rc= MY_TEST(not_reported_error);
+ }
+ }
+ break;
+
+ case UNION_DISTINCT:
+ rc= write_record();
+ /* no reaction with conversion */
+ if (rc == -2)
+ rc= 0;
+ break;
+
+ case EXCEPT_DISTINCT:
+ if (!(find_res= table->file->find_unique_row(table->record[0], 0)))
+ rc= delete_record();
+ else
+ rc= not_reported_error= (find_res != 1);
+ break;
+
+ case INTERSECT_DISTINCT:
+ if (!(find_res= table->file->find_unique_row(table->record[0], 0)))
+ {
+ if (additional_cnt->val_int() == prev_step)
+ {
+ not_reported_error= update_counter(additional_cnt, curr_step);
+ rc= MY_TEST(not_reported_error);
+ DBUG_ASSERT(rc != HA_ERR_RECORD_IS_THE_SAME);
+ }
+ else if (additional_cnt->val_int() != curr_step)
+ rc= delete_record();
+ }
+ else
+ rc= not_reported_error= (find_res != 1);
+ break;
+
+ default:
+ DBUG_ASSERT(0);
+ }
+
+ if (unlikely(not_reported_error))
+ {
+ DBUG_ASSERT(rc);
+ table->file->print_error(not_reported_error, MYF(0));
+ }
+ return rc;
+}
+
+
+/*
+ @brief
+ Do post-operation after a operator
+
+ @detail
+ We need to scan in these cases:
+ - If this operation is DISTINCT and next is ALL,
+ duplicate counter needs to be set to 1.
+ - If this operation is INTERSECT ALL and counter needs to be updated.
+ - If next operation is INTERSECT ALL,
+ set up the second extra field (called "intersect_counter") to 0.
+ this extra field counts records in the second operand.
+
+ If this operation is equal to "union_distinct" or is the last operation,
+ we'll disable index. Then if this operation is ALL we'll unfold records.
+*/
+
+bool select_unit_ext::send_eof()
+{
+ int error= 0;
+ SELECT_LEX *curr_sl= thd->lex->current_select;
+ SELECT_LEX *next_sl= curr_sl->next_select();
+ bool is_next_distinct= next_sl && next_sl->distinct;
+ bool is_next_intersect_all=
+ next_sl &&
+ next_sl->get_linkage() == INTERSECT_TYPE &&
+ !next_sl->distinct;
+ bool need_unfold= (disable_index_if_needed(curr_sl) &&
+ !curr_sl->distinct);
+
+ if (((curr_sl->distinct && !is_next_distinct) ||
+ curr_op_type == INTERSECT_ALL ||
+ is_next_intersect_all) &&
+ !need_unfold)
+ {
+ if (!next_sl)
+ DBUG_ASSERT(curr_op_type != INTERSECT_ALL);
+ bool need_update_row;
+ if (unlikely(table->file->ha_rnd_init_with_error(1)))
+ return 1;
+ do
+ {
+ need_update_row= false;
+ if (unlikely(error= table->file->ha_rnd_next(table->record[0])))
+ {
+ if (error == HA_ERR_END_OF_FILE)
+ {
+ error= 0;
+ break;
+ }
+ break;
+ }
+ store_record(table, record[1]);
+
+ if (curr_sl->distinct && !is_next_distinct)
+ {
+ /* set duplicate counter to 1 if next operation is ALL */
+ duplicate_cnt->store(1, 0);
+ need_update_row= true;
+ }
+
+ if (is_next_intersect_all)
+ {
+ longlong d_cnt_val= duplicate_cnt->val_int();
+ if (d_cnt_val == 0)
+ error= delete_record();
+ else
+ {
+ if (curr_op_type == INTERSECT_ALL)
+ {
+ longlong a_cnt_val= additional_cnt->val_int();
+ if (a_cnt_val < d_cnt_val)
+ d_cnt_val= a_cnt_val;
+ }
+ additional_cnt->store(d_cnt_val, 0);
+ duplicate_cnt->store((longlong)0, 0);
+ need_update_row= true;
+ }
+ }
+
+ if (need_update_row)
+ error= table->file->ha_update_tmp_row(table->record[1],
+ table->record[0]);
+ } while (likely(!error));
+ table->file->ha_rnd_end();
+ }
+
+ /* unfold */
+ else if (need_unfold)
+ {
+ /* unfold if is ALL operation */
+ ha_rows dup_cnt;
+ if (unlikely(table->file->ha_rnd_init_with_error(1)))
+ return 1;
+ do
+ {
+ if (unlikely(error= table->file->ha_rnd_next(table->record[0])))
+ {
+ if (error == HA_ERR_END_OF_FILE)
+ {
+ error= 0;
+ break;
+ }
+ break;
+ }
+ dup_cnt= (ha_rows)duplicate_cnt->val_int();
+ /* delete record if not exist in the second operand */
+ if (dup_cnt == 0)
+ {
+ error= delete_record();
+ continue;
+ }
+ if (curr_op_type == INTERSECT_ALL)
+ {
+ ha_rows add_cnt= (ha_rows)additional_cnt->val_int();
+ if (dup_cnt > add_cnt && add_cnt > 0)
+ dup_cnt= (ha_rows)add_cnt;
+ }
+
+ if (dup_cnt == 1)
+ continue;
+
+ duplicate_cnt->store((longlong)1, 0);
+ if (additional_cnt)
+ additional_cnt->store((longlong)0, 0);
+ error= table->file->ha_update_tmp_row(table->record[1],
+ table->record[0]);
+ if (unlikely(error))
+ break;
+
+ if (unfold_record(dup_cnt) == -1)
+ {
+ /* restart the scan */
+ if (unlikely(table->file->ha_rnd_init_with_error(1)))
+ return 1;
+
+ duplicate_cnt= table->field[addon_cnt - 1];
+ if (addon_cnt == 2)
+ additional_cnt= table->field[addon_cnt - 2];
+ else
+ additional_cnt= NULL;
+ continue;
+ }
+ } while (likely(!error));
+ table->file->ha_rnd_end();
+ }
+
+ if (unlikely(error))
+ table->file->print_error(error, MYF(0));
+
+ return (MY_TEST(error));
+}
+
void select_union_recursive::cleanup()
{
if (table)
@@ -818,6 +1267,29 @@ bool st_select_lex_unit::join_union_item_types(THD *thd_arg,
}
+bool init_item_int(THD* thd, Item_int* &item)
+{
+ if (!item)
+ {
+ Query_arena *arena, backup_arena;
+ arena= thd->activate_stmt_arena_if_needed(&backup_arena);
+
+ item= new (thd->mem_root) Item_int(thd, 0);
+
+ if (arena)
+ thd->restore_active_arena(arena, &backup_arena);
+
+ if (!item)
+ return false;
+ }
+ else
+ {
+ item->value= 0;
+ }
+ return true;
+}
+
+
bool st_select_lex_unit::prepare(TABLE_LIST *derived_arg,
select_result *sel_result,
ulong additional_options)
@@ -829,7 +1301,8 @@ bool st_select_lex_unit::prepare(TABLE_LIST *derived_arg,
uint union_part_count= 0;
select_result *tmp_result;
bool is_union_select;
- bool have_except= FALSE, have_intersect= FALSE;
+ bool have_except= false, have_intersect= false,
+ have_except_all_or_intersect_all= false;
bool instantiate_tmp_table= false;
bool single_tvc= !first_sl->next_select() && first_sl->tvc;
bool single_tvc_wo_order= single_tvc && !first_sl->order_list.elements;
@@ -867,7 +1340,7 @@ bool st_select_lex_unit::prepare(TABLE_LIST *derived_arg,
max/min subquery (ALL/ANY optimization)
*/
result= sel_result;
-
+
if (prepared)
{
if (describe)
@@ -906,15 +1379,27 @@ bool st_select_lex_unit::prepare(TABLE_LIST *derived_arg,
found_rows_for_union= first_sl->options & OPTION_FOUND_ROWS;
is_union_select= is_unit_op() || fake_select_lex || single_tvc;
+ /* will only optimize once */
+ if (!bag_set_op_optimized && !is_recursive)
+ {
+ optimize_bag_operation(false);
+ }
+
for (SELECT_LEX *s= first_sl; s; s= s->next_select())
{
switch (s->linkage)
{
case INTERSECT_TYPE:
have_intersect= TRUE;
+ if (!s->distinct){
+ have_except_all_or_intersect_all= true;
+ }
break;
case EXCEPT_TYPE:
have_except= TRUE;
+ if (!s->distinct){
+ have_except_all_or_intersect_all= TRUE;
+ }
break;
default:
break;
@@ -941,7 +1426,21 @@ bool st_select_lex_unit::prepare(TABLE_LIST *derived_arg,
else
{
if (!is_recursive)
- union_result= new (thd->mem_root) select_unit(thd);
+ {
+ /*
+ class "select_unit_ext" handles query contains EXCEPT ALL and / or
+ INTERSECT ALL. Others are handled by class "select_unit"
+ If have EXCEPT ALL or INTERSECT ALL in the query. First operand
+ should be UNION ALL
+ */
+ if (have_except_all_or_intersect_all)
+ {
+ union_result= new (thd->mem_root) select_unit_ext(thd);
+ first_sl->distinct= false;
+ }
+ else
+ union_result= new (thd->mem_root) select_unit(thd);
+ }
else
{
with_element->rec_result=
@@ -1104,6 +1603,10 @@ bool st_select_lex_unit::prepare(TABLE_LIST *derived_arg,
instantiate_tmp_table, false,
0))
goto err;
+ if (have_except_all_or_intersect_all)
+ {
+ union_result->init();
+ }
if (!derived_arg->table)
{
derived_arg->table= with_element->rec_result->rec_tables.head();
@@ -1115,6 +1618,7 @@ bool st_select_lex_unit::prepare(TABLE_LIST *derived_arg,
}
}
}
+
// In case of a non-recursive UNION, join data types for all UNION parts.
if (!is_recursive && join_union_item_types(thd, types, union_part_count))
goto err;
@@ -1190,48 +1694,42 @@ cont:
if (global_parameters()->ftfunc_list->elements)
create_options= create_options | TMP_TABLE_FORCE_MYISAM;
+ /* extra field counter */
+ uint hidden= 0;
+ Item_int *addon_fields[2]= {0};
if (!is_recursive)
{
- uint hidden= 0;
- if (have_intersect)
+ if (have_except_all_or_intersect_all)
{
- hidden= 1;
- if (!intersect_mark)
- {
- /*
- For intersect we add a hidden column first that contains
- the current select number of the time when the row was
- added to the temporary table
- */
-
- Query_arena *arena, backup_arena;
- arena= thd->activate_stmt_arena_if_needed(&backup_arena);
-
- intersect_mark= new (thd->mem_root) Item_int(thd, 0);
-
- if (arena)
- thd->restore_active_arena(arena, &backup_arena);
+ /* add duplicate_count */
+ ++hidden;
+ }
+ /* add intersect_count */
+ if (have_intersect)
+ ++hidden;
- if (!intersect_mark)
- goto err;
- }
- else
- intersect_mark->value= 0; //reset
- types.push_front(union_result->intersect_mark= intersect_mark);
- union_result->intersect_mark->name.str= "___";
- union_result->intersect_mark->name.length= 3;
+ for(uint i= 0; i< hidden; i++)
+ {
+ init_item_int(thd, addon_fields[i]);
+ types.push_front(addon_fields[i]);
+ addon_fields[i]->name.str= i ? "__CNT_1" : "__CNT_2";
+ addon_fields[i]->name.length= 7;
}
bool error=
union_result->create_result_table(thd, &types,
- MY_TEST(union_distinct),
+ MY_TEST(union_distinct) ||
+ have_except_all_or_intersect_all ||
+ have_intersect,
create_options, &empty_clex_str, false,
instantiate_tmp_table, false,
hidden);
- if (intersect_mark)
+ union_result->addon_cnt= hidden;
+ for (uint i= 0; i < hidden; i++)
types.pop();
if (unlikely(error))
goto err;
}
+
if (fake_select_lex && !fake_select_lex->first_cond_optimization)
{
save_tablenr= result_table_list.tablenr_exec;
@@ -1259,9 +1757,8 @@ cont:
arena= thd->activate_stmt_arena_if_needed(&backup_arena);
saved_error= table->fill_item_list(&item_list);
- // Item_list is inherited from 'types', so there could be the counter
- if (intersect_mark)
- item_list.pop(); // remove intersect counter
+ for (uint i= 0; i < hidden; i++)
+ item_list.pop();
if (arena)
thd->restore_active_arena(arena, &backup_arena);
@@ -1306,7 +1803,7 @@ cont:
We're in execution of a prepared statement or stored procedure:
reset field items to point at fields from the created temporary table.
*/
- table->reset_item_list(&item_list, intersect_mark ? 1 : 0);
+ table->reset_item_list(&item_list, hidden);
}
if (fake_select_lex != NULL &&
(thd->stmt_arena->is_stmt_prepare() ||
@@ -1340,9 +1837,170 @@ err:
/**
+ @brief
+ Optimize a sequence of set operations
+
+ @param first_sl first select of the level now under processing
+
+ @details
+ The method optimizes with the following rules:
+ - (1)If a subsequence of INTERSECT contains at least one INTERSECT DISTINCT
+ or this subsequence is followed by UNION/EXCEPT DISTINCT then all
+ elements in the subsequence can changed for INTERSECT DISTINCT
+ - (2)If previous set operation is DISTINCT then EXCEPT ALL can be replaced
+ for EXCEPT DISTINCT
+ - (3)If UNION DISTINCT / EXCEPT DISTINCT follows a subsequence of UNION ALL
+ then all set operations of this subsequence can be replaced for
+ UNION DISTINCT
+
+ For derived table it will look up outer select, and do optimize based on
+ outer select.
+
+ Variable "union_distinct" will be updated in the end.
+ Not compatible with Oracle Mode.
+*/
+
+void st_select_lex_unit::optimize_bag_operation(bool is_outer_distinct)
+{
+ /*
+ skip run optimize for:
+ ORACLE MODE
+ CREATE VIEW
+ PREPARE ... FROM
+ recursive
+ */
+ if ((thd->variables.sql_mode & MODE_ORACLE) ||
+ (thd->lex->context_analysis_only & CONTEXT_ANALYSIS_ONLY_VIEW) ||
+ (fake_select_lex != NULL && thd->stmt_arena->is_stmt_prepare()) ||
+ (with_element && with_element->is_recursive ))
+ return;
+ DBUG_ASSERT(!bag_set_op_optimized);
+
+ SELECT_LEX *sl;
+ /* INTERSECT subsequence can occur only at the very beginning */
+ /* The first select with linkage == INTERSECT_TYPE */
+ SELECT_LEX *intersect_start= NULL;
+ /* The first select after the INTERSECT subsequence */
+ SELECT_LEX *intersect_end= NULL;
+ /*
+ Will point to the last node before UNION ALL subsequence.
+ Index can be disable there.
+ */
+ SELECT_LEX *disable_index= NULL;
+ /*
+ True if there is a select with:
+ linkage == INTERSECT_TYPE && distinct==true
+ */
+ bool any_intersect_distinct= false;
+ SELECT_LEX *prev_sl= first_select();
+
+ /* process INTERSECT subsequence in the begining */
+ for (sl= prev_sl->next_select(); sl; prev_sl= sl, sl= sl->next_select())
+ {
+ if (sl->linkage != INTERSECT_TYPE)
+ {
+ intersect_end= sl;
+ break;
+ }
+ else
+ {
+ if (!intersect_start)
+ intersect_start= sl;
+ if (sl->distinct)
+ {
+ any_intersect_distinct= true;
+ disable_index= sl;
+ }
+ }
+ }
+
+ /* if subquery only contains INTERSECT and outer is UNION DISTINCT*/
+ if (!sl && is_outer_distinct)
+ any_intersect_distinct= true;
+
+ /* The first select of the current UNION ALL subsequence */
+ SELECT_LEX *union_all_start= NULL;
+ for ( ; sl; prev_sl= sl, sl= sl->next_select())
+ {
+ DBUG_ASSERT (sl->linkage != INTERSECT_TYPE);
+ if (!sl->distinct)
+ {
+ if (sl->linkage == UNION_TYPE)
+ {
+ if (!union_all_start)
+ {
+ union_all_start= sl;
+ }
+ }
+ else
+ {
+ DBUG_ASSERT (sl->linkage == EXCEPT_TYPE);
+ union_all_start= NULL;
+ if (prev_sl->distinct && prev_sl->is_set_op())
+ {
+ sl->distinct= true;
+ disable_index= sl;
+ }
+ }
+ }
+ else
+ { /* sl->distinct == true */
+ for (SELECT_LEX *si= union_all_start; si && si != sl; si= si->next_select())
+ {
+ si->distinct= true;
+ }
+ union_all_start= NULL;
+ disable_index= sl;
+ }
+ }
+
+ if (is_outer_distinct)
+ {
+ for (SELECT_LEX *si= union_all_start; si && si != sl; si= si->next_select())
+ {
+ si->distinct= true;
+ }
+ union_all_start= NULL;
+ }
+
+ if (any_intersect_distinct ||
+ (intersect_end != NULL && intersect_end->distinct))
+ {
+ for (sl= intersect_start; sl && sl != intersect_end; sl= sl->next_select())
+ {
+ sl->distinct= true;
+ if (disable_index && disable_index->linkage == INTERSECT_TYPE)
+ disable_index= sl;
+ }
+ }
+ /*
+ if disable_index points to a INTERSECT, based on rule 1 we can set it
+ to the last INTERSECT node.
+ */
+ if (disable_index && disable_index->linkage == INTERSECT_TYPE &&
+ intersect_end && intersect_end->distinct)
+ disable_index= intersect_end;
+ /* union_distinct controls when to disable index */
+ union_distinct= disable_index;
+
+ /* recursive call this function for whole lex tree */
+ for(sl= first_select(); sl; sl= sl->next_select())
+ {
+ if (sl->is_unit_nest() &&
+ sl->first_inner_unit() &&
+ !sl->first_inner_unit()->bag_set_op_optimized)
+ sl->first_inner_unit()->optimize_bag_operation(sl->distinct);
+ }
+
+ /* mark as optimized */
+ bag_set_op_optimized= true;
+}
+
+
+/**
Run optimization phase.
- @return FALSE unit successfully passed optimization phase.
+ @return false unit successfully passed optimization phase.
@return TRUE an error occur.
*/
bool st_select_lex_unit::optimize()
@@ -1352,10 +2010,10 @@ bool st_select_lex_unit::optimize()
DBUG_ENTER("st_select_lex_unit::optimize");
if (optimized && !uncacheable && !describe)
- DBUG_RETURN(FALSE);
+ DBUG_RETURN(false);
if (with_element && with_element->is_recursive && optimize_started)
- DBUG_RETURN(FALSE);
+ DBUG_RETURN(false);
optimize_started= true;
if (uncacheable || !item || !item->assigned() || describe)
@@ -1375,9 +2033,12 @@ bool st_select_lex_unit::optimize()
table->file->info(HA_STATUS_VARIABLE);
}
/* re-enabling indexes for next subselect iteration */
- if (union_distinct && table->file->ha_enable_indexes(HA_KEY_SWITCH_ALL))
+ if ((union_result->force_enable_index_if_needed() || union_distinct))
{
- DBUG_ASSERT(0);
+ if(table->file->ha_enable_indexes(HA_KEY_SWITCH_ALL))
+ DBUG_ASSERT(0);
+ else
+ table->no_keyread= 0;
}
}
for (SELECT_LEX *sl= select_cursor; sl; sl= sl->next_select())
@@ -1523,7 +2184,7 @@ bool st_select_lex_unit::exec()
}
else
{
- sl->join->select_options=
+ sl->join->select_options=
(select_limit_cnt == HA_POS_ERROR || sl->braces) ?
sl->options & ~OPTION_FOUND_ROWS : sl->options | found_rows_for_union;
saved_error= sl->join->optimize();
@@ -1536,7 +2197,8 @@ bool st_select_lex_unit::exec()
sl->tvc->exec(sl);
else
sl->join->exec();
- if (sl == union_distinct && !(with_element && with_element->is_recursive))
+ if (sl == union_distinct && !have_except_all_or_intersect_all &&
+ !(with_element && with_element->is_recursive))
{
// This is UNION DISTINCT, so there should be a fake_select_lex
DBUG_ASSERT(fake_select_lex != NULL);
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 258aa470b7b..6e2fec83d26 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -2335,7 +2335,7 @@ loop_end:
tmp_param->field_count= temp_fields.elements;
tmp_param->func_count= temp_fields.elements - 1;
calc_group_buffer(tmp_param, &group);
- /* small table, ignore SQL_BIG_TABLES */
+ /* small table, ignore @@big_tables */
my_bool save_big_tables= thd->variables.big_tables;
thd->variables.big_tables= FALSE;
tmp_tables[cnt]=create_tmp_table(thd, tmp_param, temp_fields,
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index b130fbc099b..ca66da1fd0d 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -556,7 +556,7 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
}
while ((item= it++, name= nm++))
{
- item->set_name(thd, name->str, (uint) name->length, system_charset_info);
+ item->set_name(thd, *name);
item->is_autogenerated_name= FALSE;
}
}
@@ -926,16 +926,13 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
view_query.length(0);
is_query.length(0);
{
- sql_mode_t sql_mode= thd->variables.sql_mode & MODE_ANSI_QUOTES;
- thd->variables.sql_mode&= ~MODE_ANSI_QUOTES;
+ Sql_mode_instant_remove sms(thd, MODE_ANSI_QUOTES);
lex->unit.print(&view_query, enum_query_type(QT_VIEW_INTERNAL |
QT_ITEM_ORIGINAL_FUNC_NULLIF));
lex->unit.print(&is_query, enum_query_type(QT_TO_SYSTEM_CHARSET |
QT_WITHOUT_INTRODUCERS |
QT_ITEM_ORIGINAL_FUNC_NULLIF));
-
- thd->variables.sql_mode|= sql_mode;
}
DBUG_PRINT("info", ("View: %.*s", view_query.length(), view_query.ptr()));
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 3e8e478e28f..d31af5ab3bb 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -289,7 +289,7 @@ int LEX::case_stmt_action_then()
bool
LEX::set_system_variable(enum enum_var_type var_type,
- sys_var *sysvar, const LEX_CSTRING *base_name,
+ sys_var *sysvar, const Lex_ident_sys_st *base_name,
Item *val)
{
set_var *setvar;
@@ -299,7 +299,7 @@ LEX::set_system_variable(enum enum_var_type var_type,
sphead->m_flags|= sp_head::HAS_SET_AUTOCOMMIT_STMT;
if (val && val->type() == Item::FIELD_ITEM &&
- ((Item_field*)val)->table_name)
+ ((Item_field*)val)->table_name.str)
{
my_error(ER_WRONG_TYPE_FOR_VAR, MYF(0), sysvar->name.str);
return TRUE;
@@ -339,7 +339,7 @@ bool LEX::set_trigger_new_row(const LEX_CSTRING *name, Item *val)
trg_fld= new (thd->mem_root)
Item_trigger_field(thd, current_context(),
Item_trigger_field::NEW_ROW,
- name, UPDATE_ACL, FALSE);
+ *name, UPDATE_ACL, FALSE);
if (unlikely(trg_fld == NULL))
return TRUE;
@@ -506,34 +506,22 @@ Item* handle_sql2003_note184_exception(THD *thd, Item* left, bool equal,
@see sp_create_assignment_instr
@param thd Thread context
- @param no_lookahead True if the parser has no lookahead
+ @param pos The position in the raw SQL buffer
*/
-void sp_create_assignment_lex(THD *thd, bool no_lookahead)
-{
- LEX *lex= thd->lex;
- if (lex->sphead)
+bool sp_create_assignment_lex(THD *thd, const char *pos)
+{
+ if (thd->lex->sphead)
{
- Lex_input_stream *lip= &thd->m_parser_state->m_lip;
- LEX *old_lex= lex;
- lex->sphead->reset_lex(thd);
- lex= thd->lex;
-
- /* Set new LEX as if we at start of set rule. */
- lex->sql_command= SQLCOM_SET_OPTION;
- mysql_init_select(lex);
- lex->var_list.empty();
- lex->autocommit= 0;
- /* get_ptr() is only correct with no lookahead. */
- if (no_lookahead)
- lex->sphead->m_tmp_query= lip->get_ptr();
- else
- lex->sphead->m_tmp_query= lip->get_tok_end();
- /* Inherit from outer lex. */
- lex->option_type= old_lex->option_type;
- lex->main_select_push();
+ sp_lex_local *new_lex;
+ if (!(new_lex= new (thd->mem_root) sp_lex_set_var(thd, thd->lex)) ||
+ new_lex->main_select_push())
+ return true;
+ new_lex->sphead->m_tmp_query= pos;
+ return thd->lex->sphead->reset_lex(thd, new_lex);
}
+ return false;
}
@@ -542,13 +530,15 @@ void sp_create_assignment_lex(THD *thd, bool no_lookahead)
@see sp_create_assignment_lex
- @param thd Thread context
- @param no_lookahead True if the parser has no lookahead
-
+ @param thd - Thread context
+ @param no_lookahead - True if the parser has no lookahead
+ @param need_set_keyword - if a SET statement "SET a=10",
+ or a direct assignment overwise "a:=10"
@return false if success, true otherwise.
*/
-bool sp_create_assignment_instr(THD *thd, bool no_lookahead)
+bool sp_create_assignment_instr(THD *thd, bool no_lookahead,
+ bool need_set_keyword)
{
LEX *lex= thd->lex;
@@ -557,6 +547,24 @@ bool sp_create_assignment_instr(THD *thd, bool no_lookahead)
if (!lex->var_list.is_empty())
{
/*
+ - Every variable assignment from the same SET command, e.g.:
+ SET @var1=expr1, @var2=expr2;
+ produce each own sp_create_assignment_instr() call
+ lex->var_list.elements is 1 in this case.
+ - This query:
+ SET TRANSACTION READ ONLY, ISOLATION LEVEL SERIALIZABLE;
+ in translated to:
+ SET tx_read_only=1, tx_isolation=ISO_SERIALIZABLE;
+ but produces a single sp_create_assignment_instr() call
+ which includes the query fragment covering both options.
+ */
+ DBUG_ASSERT(lex->var_list.elements >= 1 && lex->var_list.elements <= 2);
+ /*
+ sql_mode=ORACLE's direct assignment of a global variable
+ is not possible by the grammar.
+ */
+ DBUG_ASSERT(Lex->option_type != OPT_GLOBAL || need_set_keyword);
+ /*
We have assignment to user or system variable or
option setting, so we should construct sp_instr_stmt
for it.
@@ -568,10 +576,15 @@ bool sp_create_assignment_instr(THD *thd, bool no_lookahead)
end is either lip->ptr, if there was no lookahead,
lip->tok_end otherwise.
*/
- static const LEX_CSTRING setsp= { STRING_WITH_LEN("SET ") };
+ static const LEX_CSTRING setlc= { STRING_WITH_LEN("SET ") };
+ static const LEX_CSTRING setgl= { STRING_WITH_LEN("SET GLOBAL ") };
const char *qend= no_lookahead ? lip->get_ptr() : lip->get_tok_end();
Lex_cstring qbuf(lex->sphead->m_tmp_query, qend);
- if (lex->new_sp_instr_stmt(thd, setsp, qbuf))
+ if (lex->new_sp_instr_stmt(thd,
+ Lex->option_type == OPT_GLOBAL ? setgl :
+ need_set_keyword ? setlc :
+ null_clex_str,
+ qbuf))
return true;
}
lex->pop_select();
@@ -779,7 +792,6 @@ Virtual_column_info *add_virtual_expression(THD *thd, Item *expr)
enum Condition_information_item::Name cond_info_item_name;
enum enum_diag_condition_item_name diag_condition_item_name;
enum Diagnostics_information::Which_area diag_area;
- enum Field::geometry_type geom_type;
enum enum_fk_option m_fk_option;
enum Item_udftype udf_type;
enum Key::Keytype key_type;
@@ -802,7 +814,7 @@ Virtual_column_info *add_virtual_expression(THD *thd, Item *expr)
enum Window_frame::Frame_exclusion frame_exclusion;
enum trigger_order_type trigger_action_order_type;
DDL_options_st object_ddl_options;
- enum vers_sys_type_t vers_range_unit;
+ enum vers_kind_t vers_range_unit;
enum Column_definition::enum_column_versioning vers_column_versioning;
enum plsql_cursor_attr_t plsql_cursor_attr;
}
@@ -817,10 +829,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%parse-param { THD *thd }
%lex-param { THD *thd }
/*
- Currently there are 38 shift/reduce conflicts.
+ Currently there are 37 shift/reduce conflicts.
We should not introduce new conflicts any more.
*/
-%expect 38
+%expect 37
/*
Comments for TOKENS.
@@ -842,316 +854,339 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
*/
+%token <lex_str> '@'
+
+/*
+ Special purpose tokens
+*/
+%token <NONE> ABORT_SYM /* INTERNAL (used in lex) */
+%token <NONE> IMPOSSIBLE_ACTION /* To avoid warning for yyerrlab1 */
+%token <NONE> END_OF_INPUT /* INTERNAL */
+%token <kwd> COLON_ORACLE_SYM /* INTERNAL */
+%token <kwd> PARAM_MARKER /* INTERNAL */
+%token <NONE> FOR_SYSTEM_TIME_SYM /* INTERNAL */
+%token <NONE> LEFT_PAREN_ALT /* INTERNAL */
+%token <NONE> LEFT_PAREN_WITH /* INTERNAL */
+%token <NONE> LEFT_PAREN_LIKE /* INTERNAL */
+%token <NONE> ORACLE_CONCAT_SYM /* INTERNAL */
+%token <NONE> PERCENT_ORACLE_SYM /* INTERNAL */
+%token <NONE> WITH_CUBE_SYM /* INTERNAL */
+%token <NONE> WITH_ROLLUP_SYM /* INTERNAL */
+%token <NONE> WITH_SYSTEM_SYM /* INTERNAL */
+
+
/*
- Reserved keywords and operators
+ Identifiers
*/
-%token ABORT_SYM /* INTERNAL (used in lex) */
-%token ACCESSIBLE_SYM
-%token ADD /* SQL-2003-R */
-%token ALL /* SQL-2003-R */
-%token ALTER /* SQL-2003-R */
-%token ANALYZE_SYM
-%token AND_AND_SYM /* OPERATOR */
-%token AND_SYM /* SQL-2003-R */
-%token AS /* SQL-2003-R */
-%token ASC /* SQL-2003-N */
-%token ASENSITIVE_SYM /* FUTURE-USE */
-%token BEFORE_SYM /* SQL-2003-N */
-%token BETWEEN_SYM /* SQL-2003-R */
-%token BIGINT /* SQL-2003-R */
-%token BINARY /* SQL-2003-R */
-%token BIN_NUM
-%token BIT_AND /* MYSQL-FUNC */
-%token BIT_OR /* MYSQL-FUNC */
-%token BIT_XOR /* MYSQL-FUNC */
-%token BLOB_MARIADB_SYM /* SQL-2003-R */
-%token BLOB_ORACLE_SYM /* Oracle-R */
-%token BODY_ORACLE_SYM /* Oracle-R */
-%token BOTH /* SQL-2003-R */
-%token BY /* SQL-2003-R */
-%token CALL_SYM /* SQL-2003-R */
-%token CASCADE /* SQL-2003-N */
-%token CASE_SYM /* SQL-2003-R */
-%token CAST_SYM /* SQL-2003-R */
-%token CHANGE
-%token CHAR_SYM /* SQL-2003-R */
-%token CHECK_SYM /* SQL-2003-R */
-%token COLLATE_SYM /* SQL-2003-R */
-%token CONDITION_SYM /* SQL-2003-R, SQL-2008-R */
-%token CONSTRAINT /* SQL-2003-R */
-%token CONTINUE_MARIADB_SYM /* SQL-2003-R, Oracle-R */
-%token CONTINUE_ORACLE_SYM /* SQL-2003-R, Oracle-R */
-%token CONVERT_SYM /* SQL-2003-N */
-%token COUNT_SYM /* SQL-2003-N */
-%token CREATE /* SQL-2003-R */
-%token CROSS /* SQL-2003-R */
-%token CUME_DIST_SYM
-%token CURDATE /* MYSQL-FUNC */
-%token CURRENT_USER /* SQL-2003-R */
-%token CURRENT_ROLE /* SQL-2003-R */
-%token CURSOR_SYM /* SQL-2003-R */
-%token CURTIME /* MYSQL-FUNC */
-%token DATABASE
-%token DATABASES
-%token DATE_ADD_INTERVAL /* MYSQL-FUNC */
-%token DATE_SUB_INTERVAL /* MYSQL-FUNC */
-%token DAY_HOUR_SYM
-%token DAY_MICROSECOND_SYM
-%token DAY_MINUTE_SYM
-%token DAY_SECOND_SYM
-%token DECIMAL_NUM
-%token DECIMAL_SYM /* SQL-2003-R */
-%token DECLARE_MARIADB_SYM /* SQL-2003-R */
-%token DECLARE_ORACLE_SYM /* Oracle-R */
-%token DEFAULT /* SQL-2003-R */
-%token DELETE_DOMAIN_ID_SYM
-%token DELETE_SYM /* SQL-2003-R */
-%token DENSE_RANK_SYM
-%token DESC /* SQL-2003-N */
-%token DESCRIBE /* SQL-2003-R */
-%token DETERMINISTIC_SYM /* SQL-2003-R */
-%token DISTINCT /* SQL-2003-R */
-%token DIV_SYM
-%token DOUBLE_SYM /* SQL-2003-R */
-%token DO_DOMAIN_IDS_SYM
-%token DOT_DOT_SYM
-%token DROP /* SQL-2003-R */
-%token DUAL_SYM
-%token EACH_SYM /* SQL-2003-R */
-%token ELSE /* SQL-2003-R */
-%token ELSEIF_MARIADB_SYM
-%token ELSIF_ORACLE_SYM /* PLSQL-R */
-%token ENCLOSED
-%token END_OF_INPUT /* INTERNAL */
-%token EQUAL_SYM /* OPERATOR */
-%token ESCAPED
-%token EXCEPT_SYM /* SQL-2003-R */
-%token EXISTS /* SQL-2003-R */
-%token EXTRACT_SYM /* SQL-2003-N */
-%token FALSE_SYM /* SQL-2003-R */
-%token FETCH_SYM /* SQL-2003-R */
-%token FIRST_VALUE_SYM /* SQL-2011 */
-%token FLOAT_NUM
-%token FLOAT_SYM /* SQL-2003-R */
-%token FOREIGN /* SQL-2003-R */
-%token FOR_SYM /* SQL-2003-R */
-%token FOR_SYSTEM_TIME_SYM /* INTERNAL */
-%token FROM
-%token FULLTEXT_SYM
-%token GE
-%token GOTO_ORACLE_SYM /* Oracle-R */
-%token GRANT /* SQL-2003-R */
-%token GROUP_SYM /* SQL-2003-R */
-%token GROUP_CONCAT_SYM
-%token LAG_SYM /* SQL-2011 */
-%token LEAD_SYM /* SQL-2011 */
-%token HAVING /* SQL-2003-R */
-%token HEX_NUM
-%token HEX_STRING
-%token HOUR_MICROSECOND_SYM
-%token HOUR_MINUTE_SYM
-%token HOUR_SECOND_SYM
%token IDENT
%token IDENT_QUOTED
-%token IF_SYM
-%token IGNORE_DOMAIN_IDS_SYM
-%token IGNORE_SYM
-%token INDEX_SYM
-%token INFILE
-%token INNER_SYM /* SQL-2003-R */
-%token INOUT_SYM /* SQL-2003-R */
-%token INSENSITIVE_SYM /* SQL-2003-R */
-%token INSERT /* SQL-2003-R */
-%token INTERSECT_SYM /* SQL-2003-R */
-%token INTERVAL_SYM /* SQL-2003-R */
-%token INTO /* SQL-2003-R */
-%token INT_SYM /* SQL-2003-R */
-%token IN_SYM /* SQL-2003-R */
-%token IS /* SQL-2003-R */
-%token ITERATE_SYM
-%token JOIN_SYM /* SQL-2003-R */
-%token KEYS
-%token KEY_SYM /* SQL-2003-N */
-%token KILL_SYM
-%token LE /* OPERATOR */
-%token LEADING /* SQL-2003-R */
-%token LEAVE_SYM
-%token LEFT /* SQL-2003-R */
-%token LEFT_PAREN_ALT /* INTERNAL */
-%token LEFT_PAREN_WITH /* INTERNAL */
-%token LEFT_PAREN_LIKE /* INTERNAL */
%token LEX_HOSTNAME
-%token LIKE /* SQL-2003-R */
-%token LIMIT
-%token LINEAR_SYM
-%token LINES
-%token LOAD
-%token LOCATOR_SYM /* SQL-2003-N */
-%token LOCK_SYM
-%token LONGBLOB
-%token LONGTEXT
-%token LONG_NUM
-%token LONG_SYM
-%token LOOP_SYM
-%token LOW_PRIORITY
-%token MASTER_SSL_VERIFY_SERVER_CERT_SYM
-%token MATCH /* SQL-2003-R */
-%token MAX_SYM /* SQL-2003-N */
-%token MAXVALUE_SYM /* SQL-2003-N */
-%token MEDIAN_SYM
-%token MEDIUMBLOB
-%token MEDIUMINT
-%token MEDIUMTEXT
-%token MINUTE_MICROSECOND_SYM
-%token MINUTE_SECOND_SYM
-%token MIN_SYM /* SQL-2003-N */
-%token MODIFIES_SYM /* SQL-2003-R */
-%token MOD_SYM /* SQL-2003-N */
-%token MYSQL_CONCAT_SYM /* OPERATOR */
-%token NATURAL /* SQL-2003-R */
-%token NCHAR_STRING
-%token NE /* OPERATOR */
-%token NEG
-%token NOT2_SYM
-%token NOT_SYM /* SQL-2003-R */
-%token NOW_SYM
-%token NO_WRITE_TO_BINLOG
-%token NTILE_SYM
-%token NULL_SYM /* SQL-2003-R */
-%token NUM
-%token NUMERIC_SYM /* SQL-2003-R */
-%token NTH_VALUE_SYM /* SQL-2011 */
-%token ON /* SQL-2003-R */
-%token OPTIMIZE
-%token OPTIONALLY
-%token ORACLE_CONCAT_SYM /* INTERNAL */
-%token OR2_SYM
-%token ORDER_SYM /* SQL-2003-R */
-%token OR_SYM /* SQL-2003-R */
-%token OTHERS_ORACLE_SYM /* SQL-2011-N, PLSQL-R */
-%token OUTER
-%token OUTFILE
-%token OUT_SYM /* SQL-2003-R */
-%token OVER_SYM
-%token PACKAGE_ORACLE_SYM /* Oracle-R */
-%token PAGE_CHECKSUM_SYM
-%token PARAM_MARKER
-%token PARSE_VCOL_EXPR_SYM
-%token PARTITION_SYM /* SQL-2003-R */
-%token PERCENT_ORACLE_SYM /* INTERNAL */
-%token PERCENT_RANK_SYM
-%token PERCENTILE_CONT_SYM
-%token PERCENTILE_DISC_SYM
-%token PORTION_SYM /* SQL-2016-R */
-%token POSITION_SYM /* SQL-2003-N */
-%token PRECISION /* SQL-2003-R */
-%token PRIMARY_SYM /* SQL-2003-R */
-%token PROCEDURE_SYM /* SQL-2003-R */
-%token PURGE
-%token RAISE_ORACLE_SYM /* PLSQL-R */
-%token RANGE_SYM /* SQL-2003-R */
-%token RANK_SYM
-%token READS_SYM /* SQL-2003-R */
-%token READ_SYM /* SQL-2003-N */
-%token READ_WRITE_SYM
-%token REAL /* SQL-2003-R */
-%token RECURSIVE_SYM
-%token REF_SYSTEM_ID_SYM
-%token REFERENCES /* SQL-2003-R */
-%token REGEXP
-%token RELEASE_SYM /* SQL-2003-R */
-%token RENAME
-%token REPEAT_SYM /* MYSQL-FUNC */
-%token REPLACE /* MYSQL-FUNC */
-%token REQUIRE_SYM
-%token RESIGNAL_SYM /* SQL-2003-R */
-%token RESTRICT
-%token RETURNING_SYM
-%token RETURN_MARIADB_SYM /* SQL-2003-R, PLSQL-R */
-%token RETURN_ORACLE_SYM /* SQL-2003-R, PLSQL-R */
-%token REVOKE /* SQL-2003-R */
-%token RIGHT /* SQL-2003-R */
-%token ROWS_SYM /* SQL-2003-R */
-%token ROWTYPE_ORACLE_SYM /* PLSQL-R */
-%token ROW_NUMBER_SYM
-%token SECOND_MICROSECOND_SYM
-%token SELECT_SYM /* SQL-2003-R */
-%token SENSITIVE_SYM /* FUTURE-USE */
-%token SEPARATOR_SYM
-%token SERVER_OPTIONS
-%token SET /* SQL-2003-R */
-%token SET_VAR
-%token SHIFT_LEFT /* OPERATOR */
-%token SHIFT_RIGHT /* OPERATOR */
-%token SHOW
-%token SIGNAL_SYM /* SQL-2003-R */
-%token SMALLINT /* SQL-2003-R */
-%token SPATIAL_SYM
-%token SPECIFIC_SYM /* SQL-2003-R */
-%token SQLEXCEPTION_SYM /* SQL-2003-R */
-%token SQLSTATE_SYM /* SQL-2003-R */
-%token SQLWARNING_SYM /* SQL-2003-R */
-%token SQL_BIG_RESULT
-%token SQL_SMALL_RESULT
-%token SQL_SYM /* SQL-2003-R */
-%token SSL_SYM
-%token STARTING
-%token STATS_AUTO_RECALC_SYM
-%token STATS_PERSISTENT_SYM
-%token STATS_SAMPLE_PAGES_SYM
-%token STDDEV_SAMP_SYM /* SQL-2003-N */
-%token STD_SYM
-%token STRAIGHT_JOIN
-%token SUBSTRING /* SQL-2003-N */
-%token SUM_SYM /* SQL-2003-N */
-%token SYSDATE
-%token TABLE_REF_PRIORITY
-%token TABLE_SYM /* SQL-2003-R */
-%token TERMINATED
-%token TEXT_STRING
-%token THEN_SYM /* SQL-2003-R */
-%token TINYBLOB
-%token TINYINT
-%token TINYTEXT
-%token TO_SYM /* SQL-2003-R */
-%token TRAILING /* SQL-2003-R */
-%token TRIGGER_SYM /* SQL-2003-R */
-%token TRIM /* SQL-2003-N */
-%token TRUE_SYM /* SQL-2003-R */
-%token ULONGLONG_NUM
-%token UNDERSCORE_CHARSET
-%token UNDO_SYM /* FUTURE-USE */
-%token UNION_SYM /* SQL-2003-R */
-%token UNIQUE_SYM
-%token UNLOCK_SYM
-%token UNSIGNED
-%token UPDATE_SYM /* SQL-2003-R */
-%token USAGE /* SQL-2003-N */
-%token USE_SYM
-%token USING /* SQL-2003-R */
-%token UTC_DATE_SYM
-%token UTC_TIMESTAMP_SYM
-%token UTC_TIME_SYM
-%token VALUES /* SQL-2003-R */
-%token VALUES_IN_SYM
-%token VALUES_LESS_SYM
-%token VARBINARY
-%token VARCHAR /* SQL-2003-R */
-%token VARIANCE_SYM
-%token VARYING /* SQL-2003-R */
-%token VAR_SAMP_SYM
-%token WHEN_SYM /* SQL-2003-R */
-%token WHERE /* SQL-2003-R */
-%token WHILE_SYM
-%token WITH /* SQL-2003-R */
-%token WITH_CUBE_SYM /* INTERNAL */
-%token WITH_ROLLUP_SYM /* INTERNAL */
-%token WITH_SYSTEM_SYM /* INTERNAL */
-%token XOR
-%token YEAR_MONTH_SYM
-%token ZEROFILL
-
-%token IMPOSSIBLE_ACTION /* To avoid warning for yyerrlab1 */
+%token UNDERSCORE_CHARSET /* _latin1 */
+
+
+/*
+ Literals
+*/
+%token BIN_NUM /* LITERAL */
+%token DECIMAL_NUM /* LITERAL */
+%token FLOAT_NUM /* LITERAL */
+%token HEX_NUM /* LITERAL */
+%token HEX_STRING /* LITERAL */
+%token LONG_NUM /* LITERAL */
+%token NCHAR_STRING /* LITERAL */
+%token NUM /* LITERAL */
+%token TEXT_STRING /* LITERAL */
+%token ULONGLONG_NUM /* LITERAL */
+
+
+/*
+ Operators
+*/
+%token <NONE> AND_AND_SYM /* OPERATOR */
+%token <NONE> DOT_DOT_SYM /* OPERATOR */
+%token <NONE> EQUAL_SYM /* OPERATOR */
+%token <NONE> GE /* OPERATOR */
+%token <NONE> LE /* OPERATOR */
+%token <NONE> MYSQL_CONCAT_SYM /* OPERATOR */
+%token <NONE> NE /* OPERATOR */
+%token <NONE> NOT2_SYM /* OPERATOR */
+%token <NONE> OR2_SYM /* OPERATOR */
+%token <NONE> SET_VAR /* OPERATOR */
+%token <NONE> SHIFT_LEFT /* OPERATOR */
+%token <NONE> SHIFT_RIGHT /* OPERATOR */
+
+
+/*
+ Reserved keywords
+*/
+%token <kwd> ACCESSIBLE_SYM
+%token <kwd> ADD /* SQL-2003-R */
+%token <kwd> ALL /* SQL-2003-R */
+%token <kwd> ALTER /* SQL-2003-R */
+%token <kwd> ANALYZE_SYM
+%token <kwd> AND_SYM /* SQL-2003-R */
+%token <kwd> ASC /* SQL-2003-N */
+%token <kwd> ASENSITIVE_SYM /* FUTURE-USE */
+%token <kwd> AS /* SQL-2003-R */
+%token <kwd> BEFORE_SYM /* SQL-2003-N */
+%token <kwd> BETWEEN_SYM /* SQL-2003-R */
+%token <kwd> BIGINT /* SQL-2003-R */
+%token <kwd> BINARY /* SQL-2003-R */
+%token <kwd> BIT_AND /* MYSQL-FUNC */
+%token <kwd> BIT_OR /* MYSQL-FUNC */
+%token <kwd> BIT_XOR /* MYSQL-FUNC */
+%token <kwd> BLOB_MARIADB_SYM /* SQL-2003-R */
+%token <kwd> BLOB_ORACLE_SYM /* Oracle-R */
+%token <kwd> BODY_ORACLE_SYM /* Oracle-R */
+%token <kwd> BOTH /* SQL-2003-R */
+%token <kwd> BY /* SQL-2003-R */
+%token <kwd> CALL_SYM /* SQL-2003-R */
+%token <kwd> CASCADE /* SQL-2003-N */
+%token <kwd> CASE_SYM /* SQL-2003-R */
+%token <kwd> CAST_SYM /* SQL-2003-R */
+%token <kwd> CHANGE
+%token <kwd> CHAR_SYM /* SQL-2003-R */
+%token <kwd> CHECK_SYM /* SQL-2003-R */
+%token <kwd> COLLATE_SYM /* SQL-2003-R */
+%token <kwd> CONDITION_SYM /* SQL-2003-R, SQL-2008-R */
+%token <kwd> CONSTRAINT /* SQL-2003-R */
+%token <kwd> CONTINUE_MARIADB_SYM /* SQL-2003-R, Oracle-R */
+%token <kwd> CONTINUE_ORACLE_SYM /* SQL-2003-R, Oracle-R */
+%token <kwd> CONVERT_SYM /* SQL-2003-N */
+%token <kwd> COUNT_SYM /* SQL-2003-N */
+%token <kwd> CREATE /* SQL-2003-R */
+%token <kwd> CROSS /* SQL-2003-R */
+%token <kwd> CUME_DIST_SYM
+%token <kwd> CURDATE /* MYSQL-FUNC */
+%token <kwd> CURRENT_ROLE /* SQL-2003-R */
+%token <kwd> CURRENT_USER /* SQL-2003-R */
+%token <kwd> CURSOR_SYM /* SQL-2003-R */
+%token <kwd> CURTIME /* MYSQL-FUNC */
+%token <kwd> DATABASE
+%token <kwd> DATABASES
+%token <kwd> DATE_ADD_INTERVAL /* MYSQL-FUNC */
+%token <kwd> DATE_SUB_INTERVAL /* MYSQL-FUNC */
+%token <kwd> DAY_HOUR_SYM
+%token <kwd> DAY_MICROSECOND_SYM
+%token <kwd> DAY_MINUTE_SYM
+%token <kwd> DAY_SECOND_SYM
+%token <kwd> DECIMAL_SYM /* SQL-2003-R */
+%token <kwd> DECLARE_MARIADB_SYM /* SQL-2003-R */
+%token <kwd> DECLARE_ORACLE_SYM /* Oracle-R */
+%token <kwd> DEFAULT /* SQL-2003-R */
+%token <kwd> DELETE_DOMAIN_ID_SYM
+%token <kwd> DELETE_SYM /* SQL-2003-R */
+%token <kwd> DENSE_RANK_SYM
+%token <kwd> DESCRIBE /* SQL-2003-R */
+%token <kwd> DESC /* SQL-2003-N */
+%token <kwd> DETERMINISTIC_SYM /* SQL-2003-R */
+%token <kwd> DISTINCT /* SQL-2003-R */
+%token <kwd> DIV_SYM
+%token <kwd> DO_DOMAIN_IDS_SYM
+%token <kwd> DOUBLE_SYM /* SQL-2003-R */
+%token <kwd> DROP /* SQL-2003-R */
+%token <kwd> DUAL_SYM
+%token <kwd> EACH_SYM /* SQL-2003-R */
+%token <kwd> ELSEIF_MARIADB_SYM
+%token <kwd> ELSE /* SQL-2003-R */
+%token <kwd> ELSIF_ORACLE_SYM /* PLSQL-R */
+%token <kwd> ENCLOSED
+%token <kwd> ESCAPED
+%token <kwd> EXCEPT_SYM /* SQL-2003-R */
+%token <kwd> EXISTS /* SQL-2003-R */
+%token <kwd> EXTRACT_SYM /* SQL-2003-N */
+%token <kwd> FALSE_SYM /* SQL-2003-R */
+%token <kwd> FETCH_SYM /* SQL-2003-R */
+%token <kwd> FIRST_VALUE_SYM /* SQL-2011 */
+%token <kwd> FLOAT_SYM /* SQL-2003-R */
+%token <kwd> FOREIGN /* SQL-2003-R */
+%token <kwd> FOR_SYM /* SQL-2003-R */
+%token <kwd> FROM
+%token <kwd> FULLTEXT_SYM
+%token <kwd> GOTO_ORACLE_SYM /* Oracle-R */
+%token <kwd> GRANT /* SQL-2003-R */
+%token <kwd> GROUP_CONCAT_SYM
+%token <rwd> JSON_ARRAYAGG_SYM
+%token <kwd> GROUP_SYM /* SQL-2003-R */
+%token <kwd> HAVING /* SQL-2003-R */
+%token <kwd> HOUR_MICROSECOND_SYM
+%token <kwd> HOUR_MINUTE_SYM
+%token <kwd> HOUR_SECOND_SYM
+%token <kwd> IF_SYM
+%token <kwd> IGNORE_DOMAIN_IDS_SYM
+%token <kwd> IGNORE_SYM
+%token <kwd> INDEX_SYM
+%token <kwd> INFILE
+%token <kwd> INNER_SYM /* SQL-2003-R */
+%token <kwd> INOUT_SYM /* SQL-2003-R */
+%token <kwd> INSENSITIVE_SYM /* SQL-2003-R */
+%token <kwd> INSERT /* SQL-2003-R */
+%token <kwd> IN_SYM /* SQL-2003-R */
+%token <kwd> INTERSECT_SYM /* SQL-2003-R */
+%token <kwd> INTERVAL_SYM /* SQL-2003-R */
+%token <kwd> INTO /* SQL-2003-R */
+%token <kwd> INT_SYM /* SQL-2003-R */
+%token <kwd> IS /* SQL-2003-R */
+%token <kwd> ITERATE_SYM
+%token <kwd> JOIN_SYM /* SQL-2003-R */
+%token <kwd> KEYS
+%token <kwd> KEY_SYM /* SQL-2003-N */
+%token <kwd> KILL_SYM
+%token <kwd> LAG_SYM /* SQL-2011 */
+%token <kwd> LEADING /* SQL-2003-R */
+%token <kwd> LEAD_SYM /* SQL-2011 */
+%token <kwd> LEAVE_SYM
+%token <kwd> LEFT /* SQL-2003-R */
+%token <kwd> LIKE /* SQL-2003-R */
+%token <kwd> LIMIT
+%token <kwd> LINEAR_SYM
+%token <kwd> LINES
+%token <kwd> LOAD
+%token <kwd> LOCATOR_SYM /* SQL-2003-N */
+%token <kwd> LOCK_SYM
+%token <kwd> LONGBLOB
+%token <kwd> LONG_SYM
+%token <kwd> LONGTEXT
+%token <kwd> LOOP_SYM
+%token <kwd> LOW_PRIORITY
+%token <kwd> MASTER_SSL_VERIFY_SERVER_CERT_SYM
+%token <kwd> MATCH /* SQL-2003-R */
+%token <kwd> MAX_SYM /* SQL-2003-N */
+%token <kwd> MAXVALUE_SYM /* SQL-2003-N */
+%token <kwd> MEDIAN_SYM
+%token <kwd> MEDIUMBLOB
+%token <kwd> MEDIUMINT
+%token <kwd> MEDIUMTEXT
+%token <kwd> MIN_SYM /* SQL-2003-N */
+%token <kwd> MINUTE_MICROSECOND_SYM
+%token <kwd> MINUTE_SECOND_SYM
+%token <kwd> MODIFIES_SYM /* SQL-2003-R */
+%token <kwd> MOD_SYM /* SQL-2003-N */
+%token <kwd> NATURAL /* SQL-2003-R */
+%token <kwd> NEG
+%token <kwd> NOT_SYM /* SQL-2003-R */
+%token <kwd> NO_WRITE_TO_BINLOG
+%token <kwd> NOW_SYM
+%token <kwd> NTH_VALUE_SYM /* SQL-2011 */
+%token <kwd> NTILE_SYM
+%token <kwd> NULL_SYM /* SQL-2003-R */
+%token <kwd> NUMERIC_SYM /* SQL-2003-R */
+%token <kwd> ON /* SQL-2003-R */
+%token <kwd> OPTIMIZE
+%token <kwd> OPTIONALLY
+%token <kwd> ORDER_SYM /* SQL-2003-R */
+%token <kwd> OR_SYM /* SQL-2003-R */
+%token <kwd> OTHERS_ORACLE_SYM /* SQL-2011-N, PLSQL-R */
+%token <kwd> OUTER
+%token <kwd> OUTFILE
+%token <kwd> OUT_SYM /* SQL-2003-R */
+%token <kwd> OVER_SYM
+%token <kwd> PACKAGE_ORACLE_SYM /* Oracle-R */
+%token <kwd> PAGE_CHECKSUM_SYM
+%token <kwd> PARSE_VCOL_EXPR_SYM
+%token <kwd> PARTITION_SYM /* SQL-2003-R */
+%token <kwd> PERCENTILE_CONT_SYM
+%token <kwd> PERCENTILE_DISC_SYM
+%token <kwd> PERCENT_RANK_SYM
+%token <kwd> PORTION_SYM /* SQL-2016-R */
+%token <kwd> POSITION_SYM /* SQL-2003-N */
+%token <kwd> PRECISION /* SQL-2003-R */
+%token <kwd> PRIMARY_SYM /* SQL-2003-R */
+%token <kwd> PROCEDURE_SYM /* SQL-2003-R */
+%token <kwd> PURGE
+%token <kwd> RAISE_ORACLE_SYM /* PLSQL-R */
+%token <kwd> RANGE_SYM /* SQL-2003-R */
+%token <kwd> RANK_SYM
+%token <kwd> READS_SYM /* SQL-2003-R */
+%token <kwd> READ_SYM /* SQL-2003-N */
+%token <kwd> READ_WRITE_SYM
+%token <kwd> REAL /* SQL-2003-R */
+%token <kwd> RECURSIVE_SYM
+%token <kwd> REFERENCES /* SQL-2003-R */
+%token <kwd> REF_SYSTEM_ID_SYM
+%token <kwd> REGEXP
+%token <kwd> RELEASE_SYM /* SQL-2003-R */
+%token <kwd> RENAME
+%token <kwd> REPEAT_SYM /* MYSQL-FUNC */
+%token <kwd> REPLACE /* MYSQL-FUNC */
+%token <kwd> REQUIRE_SYM
+%token <kwd> RESIGNAL_SYM /* SQL-2003-R */
+%token <kwd> RESTRICT
+%token <kwd> RETURNING_SYM
+%token <kwd> RETURN_MARIADB_SYM /* SQL-2003-R, PLSQL-R */
+%token <kwd> RETURN_ORACLE_SYM /* SQL-2003-R, PLSQL-R */
+%token <kwd> REVOKE /* SQL-2003-R */
+%token <kwd> RIGHT /* SQL-2003-R */
+%token <kwd> ROW_NUMBER_SYM
+%token <kwd> ROWS_SYM /* SQL-2003-R */
+%token <kwd> ROWTYPE_ORACLE_SYM /* PLSQL-R */
+%token <kwd> SECOND_MICROSECOND_SYM
+%token <kwd> SELECT_SYM /* SQL-2003-R */
+%token <kwd> SENSITIVE_SYM /* FUTURE-USE */
+%token <kwd> SEPARATOR_SYM
+%token <kwd> SERVER_OPTIONS
+%token <kwd> SET /* SQL-2003-R */
+%token <kwd> SHOW
+%token <kwd> SIGNAL_SYM /* SQL-2003-R */
+%token <kwd> SMALLINT /* SQL-2003-R */
+%token <kwd> SPATIAL_SYM
+%token <kwd> SPECIFIC_SYM /* SQL-2003-R */
+%token <kwd> SQL_BIG_RESULT
+%token <kwd> SQLEXCEPTION_SYM /* SQL-2003-R */
+%token <kwd> SQL_SMALL_RESULT
+%token <kwd> SQLSTATE_SYM /* SQL-2003-R */
+%token <kwd> SQL_SYM /* SQL-2003-R */
+%token <kwd> SQLWARNING_SYM /* SQL-2003-R */
+%token <kwd> SSL_SYM
+%token <kwd> STARTING
+%token <kwd> STATS_AUTO_RECALC_SYM
+%token <kwd> STATS_PERSISTENT_SYM
+%token <kwd> STATS_SAMPLE_PAGES_SYM
+%token <kwd> STDDEV_SAMP_SYM /* SQL-2003-N */
+%token <kwd> STD_SYM
+%token <kwd> STRAIGHT_JOIN
+%token <kwd> SUBSTRING /* SQL-2003-N */
+%token <kwd> SUM_SYM /* SQL-2003-N */
+%token <kwd> SYSDATE
+%token <kwd> TABLE_REF_PRIORITY
+%token <kwd> TABLE_SYM /* SQL-2003-R */
+%token <kwd> TERMINATED
+%token <kwd> THEN_SYM /* SQL-2003-R */
+%token <kwd> TINYBLOB
+%token <kwd> TINYINT
+%token <kwd> TINYTEXT
+%token <kwd> TO_SYM /* SQL-2003-R */
+%token <kwd> TRAILING /* SQL-2003-R */
+%token <kwd> TRIGGER_SYM /* SQL-2003-R */
+%token <kwd> TRIM /* SQL-2003-N */
+%token <kwd> TRUE_SYM /* SQL-2003-R */
+%token <kwd> UNDO_SYM /* FUTURE-USE */
+%token <kwd> UNION_SYM /* SQL-2003-R */
+%token <kwd> UNIQUE_SYM
+%token <kwd> UNLOCK_SYM
+%token <kwd> UNSIGNED
+%token <kwd> UPDATE_SYM /* SQL-2003-R */
+%token <kwd> USAGE /* SQL-2003-N */
+%token <kwd> USE_SYM
+%token <kwd> USING /* SQL-2003-R */
+%token <kwd> UTC_DATE_SYM
+%token <kwd> UTC_TIMESTAMP_SYM
+%token <kwd> UTC_TIME_SYM
+%token <kwd> VALUES_IN_SYM
+%token <kwd> VALUES_LESS_SYM
+%token <kwd> VALUES /* SQL-2003-R */
+%token <kwd> VARBINARY
+%token <kwd> VARCHAR /* SQL-2003-R */
+%token <kwd> VARIANCE_SYM
+%token <kwd> VAR_SAMP_SYM
+%token <kwd> VARYING /* SQL-2003-R */
+%token <kwd> WHEN_SYM /* SQL-2003-R */
+%token <kwd> WHERE /* SQL-2003-R */
+%token <kwd> WHILE_SYM
+%token <kwd> WITH /* SQL-2003-R */
+%token <kwd> XOR
+%token <kwd> YEAR_MONTH_SYM
+%token <kwd> ZEROFILL
/*
@@ -1217,7 +1252,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> COALESCE /* SQL-2003-N */
%token <kwd> CODE_SYM
%token <kwd> COLLATION_SYM /* SQL-2003-N */
-%token <kwd> COLON_ORACLE_SYM /* INTERNAL */
%token <kwd> COLUMNS
%token <kwd> COLUMN_ADD_SYM
%token <kwd> COLUMN_CHECK_SYM
@@ -1308,8 +1342,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> FUNCTION_SYM /* SQL-2003-R, Oracle-R */
%token <kwd> GENERAL
%token <kwd> GENERATED_SYM
-%token <kwd> GEOMETRYCOLLECTION
-%token <kwd> GEOMETRY_SYM
%token <kwd> GET_FORMAT /* MYSQL-FUNC */
%token <kwd> GET_SYM /* SQL-2003-R */
%token <kwd> GLOBAL_SYM /* SQL-2003-R */
@@ -1349,7 +1381,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> LEAVES
%token <kwd> LESS_SYM
%token <kwd> LEVEL_SYM
-%token <kwd> LINESTRING
%token <kwd> LIST_SYM
%token <kwd> LOCAL_SYM /* SQL-2003-R */
%token <kwd> LOCKS_SYM
@@ -1395,9 +1426,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> MODE_SYM
%token <kwd> MODIFY_SYM
%token <kwd> MONTH_SYM /* SQL-2003-R */
-%token <kwd> MULTILINESTRING
-%token <kwd> MULTIPOINT
-%token <kwd> MULTIPOLYGON
%token <kwd> MUTEX_SYM
%token <kwd> MYSQL_SYM
%token <kwd> MYSQL_ERRNO_SYM
@@ -1444,8 +1472,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> PHASE_SYM
%token <kwd> PLUGINS_SYM
%token <kwd> PLUGIN_SYM
-%token <kwd> POINT_SYM
-%token <kwd> POLYGON
%token <kwd> PORT_SYM
%token <kwd> PRECEDES_SYM /* MYSQL */
%token <kwd> PRECEDING_SYM /* SQL-2011-N */
@@ -1703,7 +1729,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
and until NEXT_SYM / PREVIOUS_SYM.
*/
%left PREC_BELOW_IDENTIFIER_OPT_SPECIAL_CASE
-%left TRANSACTION_SYM TIMESTAMP PERIOD_SYM SYSTEM USER
+%left TRANSACTION_SYM TIMESTAMP PERIOD_SYM SYSTEM USER COMMENT_SYM
/*
@@ -1751,7 +1777,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
ident
label_ident
sp_decl_ident
- ident_set_usual_case
ident_or_empty
ident_table_alias
ident_sysvar_name
@@ -1769,9 +1794,11 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
IDENT_QUOTED
IDENT_cli
ident_cli
+ ident_cli_set_usual_case
%type <kwd>
keyword_data_type
+ keyword_cast_type
keyword_ident
keyword_label
keyword_set_special_case
@@ -1785,6 +1812,9 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
keyword_sysvar_type
keyword_table_alias
keyword_verb_clause
+ charset
+ reserved_keyword_udt
+ non_reserved_keyword_udt
%type <table>
table_ident table_ident_nodb references xid
@@ -1819,8 +1849,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%type <create_field> field_spec column_def
-%type <geom_type> spatial_type
-
%type <num>
order_dir lock_option
udf_type opt_local opt_no_write_to_binlog
@@ -1862,6 +1890,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
ws_level_flag_desc ws_level_flag_reverse ws_level_flags
opt_ws_levels ws_level_list ws_level_list_item ws_level_number
ws_level_range ws_level_list_or_range bool
+ field_options last_field_options
%type <ulonglong_number>
ulonglong_num real_ulonglong_num size_number
@@ -1883,7 +1912,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
primary_expr string_factor_expr mysql_concatenation_expr
select_sublist_qualified_asterisk
expr_or_default set_expr_or_default
- geometry_function signed_literal expr_or_literal
+ signed_literal expr_or_literal
opt_escape
sp_opt_default
simple_ident_nospvar
@@ -2061,7 +2090,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
procedure_list procedure_list2 procedure_item
field_def handler opt_generated_always
opt_ignore opt_column opt_restrict
- grant revoke set lock unlock string_list field_options
+ grant revoke set lock unlock string_list
opt_binary table_lock_list table_lock
ref_list opt_match_clause opt_on_update_delete use
opt_delete_options opt_delete_option varchar nchar nvarchar
@@ -2080,7 +2109,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
table_to_table_list table_to_table opt_table_list opt_as
handler_rkey_function handler_read_or_scan
single_multi table_wild_list table_wild_one opt_wild
- opt_and charset
+ opt_and
select_var_list select_var_list_init help
opt_extended_describe shutdown
opt_format_json
@@ -2109,7 +2138,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
opt_delete_gtid_domain
asrow_attribute
opt_constraint_no_id
-END_OF_INPUT
%type <NONE> call sp_proc_stmts sp_proc_stmts1 sp_proc_stmt
%type <NONE> sp_proc_stmt_statement sp_proc_stmt_return
@@ -2180,11 +2208,6 @@ END_OF_INPUT
'-' '+' '*' '/' '%' '(' ')'
',' '!' '{' '}' '&' '|'
-%type <NONE>
- AND_SYM OR_SYM BETWEEN_SYM CASE_SYM
- THEN_SYM WHEN_SYM DIV_SYM MOD_SYM OR2_SYM AND_AND_SYM DELETE_SYM
- MYSQL_CONCAT_SYM ORACLE_CONCAT_SYM
-
%type <with_clause> with_clause
%type <lex_str_ptr> query_name
@@ -2805,6 +2828,7 @@ create:
| create_or_replace DATABASE opt_if_not_exists ident
{
Lex->create_info.default_table_charset= NULL;
+ Lex->create_info.schema_comment= NULL;
Lex->create_info.used_fields= 0;
if (Lex->main_select_push())
MYSQL_YYABORT;
@@ -6039,6 +6063,11 @@ create_database_options:
create_database_option:
default_collation {}
| default_charset {}
+ | COMMENT_SYM opt_equal TEXT_STRING_sys
+ {
+ Lex->create_info.schema_comment= thd->make_clex_string($3);
+ Lex->create_info.used_fields|= HA_CREATE_USED_COMMENT;
+ }
;
opt_if_not_exists_table_element:
@@ -6653,7 +6682,7 @@ field_type_or_serial:
field_def
| SERIAL_SYM
{
- Lex->last_field->set_handler(&type_handler_longlong);
+ Lex->last_field->set_handler(&type_handler_ulonglong);
Lex->last_field->flags|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG
| UNSIGNED_FLAG | UNIQUE_KEY_FLAG;
}
@@ -6828,12 +6857,30 @@ field_type:
| field_type_string
| field_type_lob
| field_type_misc
+ | IDENT_sys float_options srid_option
+ {
+ if (Lex->set_field_type_udt(&$$, $1, $2))
+ MYSQL_YYABORT;
+ }
+ | reserved_keyword_udt float_options srid_option
+ {
+ if (Lex->set_field_type_udt(&$$, $1, $2))
+ MYSQL_YYABORT;
+ }
+ | non_reserved_keyword_udt float_options srid_option
+ {
+ if (Lex->set_field_type_udt(&$$, $1, $2))
+ MYSQL_YYABORT;
+ }
;
field_type_numeric:
- int_type opt_field_length field_options { $$.set($1, $2); }
- | real_type opt_precision field_options { $$.set($1, $2); }
- | FLOAT_SYM float_options field_options
+ int_type opt_field_length last_field_options
+ {
+ $$.set_handler_length_flags($1, $2, (uint32) $3);
+ }
+ | real_type opt_precision last_field_options { $$.set($1, $2); }
+ | FLOAT_SYM float_options last_field_options
{
$$.set(&type_handler_float, $2);
if ($2.length() && !$2.dec())
@@ -6855,24 +6902,24 @@ field_type_numeric:
}
| BOOL_SYM
{
- $$.set(&type_handler_tiny, "1");
+ $$.set(&type_handler_stiny, "1");
}
| BOOLEAN_SYM
{
- $$.set(&type_handler_tiny, "1");
+ $$.set(&type_handler_stiny, "1");
}
- | DECIMAL_SYM float_options field_options
+ | DECIMAL_SYM float_options last_field_options
{ $$.set(&type_handler_newdecimal, $2);}
- | NUMBER_ORACLE_SYM float_options field_options
+ | NUMBER_ORACLE_SYM float_options last_field_options
{
if ($2.length() != 0)
$$.set(&type_handler_newdecimal, $2);
else
$$.set(&type_handler_double);
}
- | NUMERIC_SYM float_options field_options
+ | NUMERIC_SYM float_options last_field_options
{ $$.set(&type_handler_newdecimal, $2);}
- | FIXED_SYM float_options field_options
+ | FIXED_SYM float_options last_field_options
{ $$.set(&type_handler_newdecimal, $2);}
;
@@ -6925,7 +6972,7 @@ field_type_string:
;
field_type_temporal:
- YEAR_SYM opt_field_length field_options
+ YEAR_SYM opt_field_length last_field_options
{
if ($2)
{
@@ -7003,17 +7050,6 @@ field_type_lob:
Lex->charset=&my_charset_bin;
$$.set(&type_handler_long_blob);
}
- | spatial_type float_options srid_option
- {
-#ifdef HAVE_SPATIAL
- Lex->charset=&my_charset_bin;
- Lex->last_field->geom_type= $1;
- $$.set(&type_handler_geometry, $2);
-#else
- my_yyabort_error((ER_FEATURE_DISABLED, MYF(0), sym_group_geom.name,
- sym_group_geom.needed_define));
-#endif
- }
| MEDIUMBLOB opt_compressed
{
Lex->charset=&my_charset_bin;
@@ -7057,17 +7093,6 @@ field_type_misc:
{ $$.set(&type_handler_set); }
;
-spatial_type:
- GEOMETRY_SYM { $$= Field::GEOM_GEOMETRY; }
- | GEOMETRYCOLLECTION { $$= Field::GEOM_GEOMETRYCOLLECTION; }
- | POINT_SYM { $$= Field::GEOM_POINT; }
- | MULTIPOINT { $$= Field::GEOM_MULTIPOINT; }
- | LINESTRING { $$= Field::GEOM_LINESTRING; }
- | MULTILINESTRING { $$= Field::GEOM_MULTILINESTRING; }
- | POLYGON { $$= Field::GEOM_POLYGON; }
- | MULTIPOLYGON { $$= Field::GEOM_MULTIPOLYGON; }
- ;
-
char:
CHAR_SYM {}
;
@@ -7091,11 +7116,11 @@ nvarchar:
;
int_type:
- INT_SYM { $$= &type_handler_long; }
- | TINYINT { $$= &type_handler_tiny; }
- | SMALLINT { $$= &type_handler_short; }
- | MEDIUMINT { $$= &type_handler_int24; }
- | BIGINT { $$= &type_handler_longlong; }
+ INT_SYM { $$= &type_handler_slong; }
+ | TINYINT { $$= &type_handler_stiny; }
+ | SMALLINT { $$= &type_handler_sshort; }
+ | MEDIUMINT { $$= &type_handler_sint24; }
+ | BIGINT { $$= &type_handler_slonglong; }
;
real_type:
@@ -7130,12 +7155,16 @@ precision:
;
field_options:
- /* empty */ {}
- | SIGNED_SYM {}
- | UNSIGNED { Lex->last_field->flags|= UNSIGNED_FLAG;}
- | ZEROFILL { Lex->last_field->flags|= UNSIGNED_FLAG | ZEROFILL_FLAG; }
- | UNSIGNED ZEROFILL { Lex->last_field->flags|= UNSIGNED_FLAG | ZEROFILL_FLAG; }
- | ZEROFILL UNSIGNED { Lex->last_field->flags|= UNSIGNED_FLAG | ZEROFILL_FLAG; }
+ /* empty */ { $$= 0; }
+ | SIGNED_SYM { $$= 0; }
+ | UNSIGNED { $$= UNSIGNED_FLAG; }
+ | ZEROFILL { $$= UNSIGNED_FLAG | ZEROFILL_FLAG; }
+ | UNSIGNED ZEROFILL { $$= UNSIGNED_FLAG | ZEROFILL_FLAG; }
+ | ZEROFILL UNSIGNED { $$= UNSIGNED_FLAG | ZEROFILL_FLAG; }
+ ;
+
+last_field_options:
+ field_options { Lex->last_field->flags|= ($$= $1); }
;
field_length:
@@ -7317,8 +7346,8 @@ type_with_opt_collate:
;
charset:
- CHAR_SYM SET {}
- | CHARSET {}
+ CHAR_SYM SET { $$= $1; }
+ | CHARSET { $$= $1; }
;
charset_name:
@@ -7810,6 +7839,7 @@ alter:
| ALTER DATABASE ident_or_empty
{
Lex->create_info.default_table_charset= NULL;
+ Lex->create_info.schema_comment= NULL;
Lex->create_info.used_fields= 0;
if (Lex->main_select_push())
MYSQL_YYABORT;
@@ -7824,6 +7854,22 @@ alter:
MYSQL_YYABORT;
Lex->pop_select(); //main select
}
+ | ALTER DATABASE COMMENT_SYM opt_equal TEXT_STRING_sys
+ {
+ Lex->create_info.default_table_charset= NULL;
+ Lex->create_info.used_fields= 0;
+ Lex->create_info.schema_comment= thd->make_clex_string($5);
+ Lex->create_info.used_fields|= HA_CREATE_USED_COMMENT;
+ }
+ opt_create_database_options
+ {
+ LEX *lex=Lex;
+ lex->sql_command=SQLCOM_ALTER_DB;
+ lex->name= Lex_ident_sys();
+ if (lex->name.str == NULL &&
+ unlikely(lex->copy_db_to(&lex->name)))
+ MYSQL_YYABORT;
+ }
| ALTER DATABASE ident UPGRADE_SYM DATA_SYM DIRECTORY_SYM NAME_SYM
{
LEX *lex= Lex;
@@ -8068,7 +8114,8 @@ opt_ev_sql_stmt:
;
ident_or_empty:
- /* empty */ { $$= Lex_ident_sys(); }
+ /* empty */
+ %prec PREC_BELOW_IDENTIFIER_OPT_SPECIAL_CASE { $$= Lex_ident_sys(); }
| ident
;
@@ -9562,7 +9609,7 @@ select_options:
opt_history_unit:
/* empty*/ %prec PREC_BELOW_IDENTIFIER_OPT_SPECIAL_CASE
{
- $$= VERS_UNDEFINED;
+ $$= VERS_TIMESTAMP;
}
| TRANSACTION_SYM
{
@@ -9731,7 +9778,7 @@ select_item_list:
{
Item *item= new (thd->mem_root)
Item_field(thd, &thd->lex->current_select->context,
- NULL, NULL, &star_clex_str);
+ star_clex_str);
if (unlikely(item == NULL))
MYSQL_YYABORT;
if (unlikely(add_item_to_list(thd, item)))
@@ -9758,7 +9805,7 @@ select_item:
check_column_name($4.str)))
my_yyabort_error((ER_WRONG_COLUMN_NAME, MYF(0), $4.str));
$2->is_autogenerated_name= FALSE;
- $2->set_name(thd, $4.str, $4.length, system_charset_info);
+ $2->set_name(thd, $4);
}
else if (!$2->name.str || $2->name.str == item_empty_name)
{
@@ -10436,7 +10483,8 @@ column_default_non_parenthesized_expr:
}
| CAST_SYM '(' expr AS cast_type ')'
{
- if (unlikely(!($$= $5.create_typecast_item(thd, $3, Lex->charset))))
+ if (unlikely(!($$= $5.create_typecast_item_or_error(thd, $3,
+ Lex->charset))))
MYSQL_YYABORT;
}
| CASE_SYM when_list_opt_else END
@@ -10452,7 +10500,8 @@ column_default_non_parenthesized_expr:
}
| CONVERT_SYM '(' expr ',' cast_type ')'
{
- if (unlikely(!($$= $5.create_typecast_item(thd, $3, Lex->charset))))
+ if (unlikely(!($$= $5.create_typecast_item_or_error(thd, $3,
+ Lex->charset))))
MYSQL_YYABORT;
}
| CONVERT_SYM '(' expr USING charset_name ')'
@@ -11165,78 +11214,6 @@ function_call_conflict:
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
- | geometry_function
- {
-#ifdef HAVE_SPATIAL
- $$= $1;
- /* $1 may be NULL, GEOM_NEW not tested for out of memory */
- if (unlikely($$ == NULL))
- MYSQL_YYABORT;
-#else
- my_yyabort_error((ER_FEATURE_DISABLED, MYF(0), sym_group_geom.name,
- sym_group_geom.needed_define));
-#endif
- }
- ;
-
-geometry_function:
- CONTAINS_SYM '(' expr ',' expr ')'
- {
- $$= GEOM_NEW(thd,
- Item_func_spatial_precise_rel(thd, $3, $5,
- Item_func::SP_CONTAINS_FUNC));
- }
- | GEOMETRYCOLLECTION '(' expr_list ')'
- {
- $$= GEOM_NEW(thd,
- Item_func_spatial_collection(thd, *$3,
- Geometry::wkb_geometrycollection,
- Geometry::wkb_point));
- }
- | LINESTRING '(' expr_list ')'
- {
- $$= GEOM_NEW(thd,
- Item_func_spatial_collection(thd, *$3,
- Geometry::wkb_linestring,
- Geometry::wkb_point));
- }
- | MULTILINESTRING '(' expr_list ')'
- {
- $$= GEOM_NEW(thd,
- Item_func_spatial_collection(thd, *$3,
- Geometry::wkb_multilinestring,
- Geometry::wkb_linestring));
- }
- | MULTIPOINT '(' expr_list ')'
- {
- $$= GEOM_NEW(thd,
- Item_func_spatial_collection(thd, *$3,
- Geometry::wkb_multipoint,
- Geometry::wkb_point));
- }
- | MULTIPOLYGON '(' expr_list ')'
- {
- $$= GEOM_NEW(thd,
- Item_func_spatial_collection(thd, *$3,
- Geometry::wkb_multipolygon,
- Geometry::wkb_polygon));
- }
- | POINT_SYM '(' expr ',' expr ')'
- {
- $$= GEOM_NEW(thd, Item_func_point(thd, $3, $5));
- }
- | POLYGON '(' expr_list ')'
- {
- $$= GEOM_NEW(thd,
- Item_func_spatial_collection(thd, *$3,
- Geometry::wkb_polygon,
- Geometry::wkb_linestring));
- }
- | WITHIN '(' expr ',' expr ')'
- {
- $$= GEOM_NEW(thd, Item_func_spatial_precise_rel(thd, $3, $5,
- Item_func::SP_WITHIN_FUNC));
- }
;
/*
@@ -11270,6 +11247,7 @@ function_call_generic:
}
opt_udf_expr_list ')'
{
+ const Type_handler *h;
Create_func *builder;
Item *item= NULL;
@@ -11285,8 +11263,12 @@ function_call_generic:
This will be revised with WL#2128 (SQL PATH)
*/
- builder= find_native_function_builder(thd, &$1);
- if (builder)
+ if ((h= Type_handler::handler_by_name(thd, $1)) &&
+ (item= h->make_constructor_item(thd, $4)))
+ {
+ // Found a constructor with a proper argument count
+ }
+ else if ((builder= find_native_function_builder(thd, &$1)))
{
item= builder->create_func(thd, &$1, $4);
}
@@ -11317,6 +11299,18 @@ function_call_generic:
if (unlikely(! ($$= item)))
MYSQL_YYABORT;
}
+ | CONTAINS_SYM '(' opt_expr_list ')'
+ {
+ if (!($$= Lex->make_item_func_call_native_or_parse_error(thd,
+ $1, $3)))
+ MYSQL_YYABORT;
+ }
+ | WITHIN '(' opt_expr_list ')'
+ {
+ if (!($$= Lex->make_item_func_call_native_or_parse_error(thd,
+ $1, $3)))
+ MYSQL_YYABORT;
+ }
| ident_cli '.' ident_cli '(' opt_expr_list ')'
{
if (unlikely(!($$= Lex->make_item_func_call_generic(thd, &$1, &$3, $5))))
@@ -11373,7 +11367,7 @@ udf_expr:
if ($4.str)
{
$2->is_autogenerated_name= FALSE;
- $2->set_name(thd, $4.str, $4.length, system_charset_info);
+ $2->set_name(thd, $4);
}
/*
A field has to have its proper name in order for name
@@ -11531,6 +11525,31 @@ sum_expr:
$5->empty();
sel->gorder_list.empty();
}
+ | JSON_ARRAYAGG_SYM '(' opt_distinct
+ { Select->in_sum_expr++; }
+ expr_list opt_glimit_clause
+ ')'
+ {
+ SELECT_LEX *sel= Select;
+ sel->in_sum_expr--;
+ String* s= new (thd->mem_root) String(",", 1, &my_charset_latin1);
+ if (unlikely(s == NULL))
+ MYSQL_YYABORT;
+
+ $$= new (thd->mem_root)
+ Item_func_json_arrayagg(thd, Lex->current_context(),
+ $3, $5,
+ sel->gorder_list, s, $6,
+ sel->select_limit,
+ sel->offset_limit);
+ if (unlikely($$ == NULL))
+ MYSQL_YYABORT;
+ sel->select_limit= NULL;
+ sel->offset_limit= NULL;
+ sel->explicit_limit= 0;
+ $5->empty();
+ sel->gorder_list.empty();
+ }
;
window_func_expr:
@@ -11919,12 +11938,27 @@ cast_type:
}
| cast_type_numeric { $$= $1; Lex->charset= NULL; }
| cast_type_temporal { $$= $1; Lex->charset= NULL; }
+ | IDENT_sys
+ {
+ if (Lex->set_cast_type_udt(&$$, $1))
+ MYSQL_YYABORT;
+ }
+ | reserved_keyword_udt
+ {
+ if (Lex->set_cast_type_udt(&$$, $1))
+ MYSQL_YYABORT;
+ }
+ | non_reserved_keyword_udt
+ {
+ if (Lex->set_cast_type_udt(&$$, $1))
+ MYSQL_YYABORT;
+ }
;
cast_type_numeric:
- INT_SYM { $$.set(&type_handler_longlong); }
- | SIGNED_SYM { $$.set(&type_handler_longlong); }
- | SIGNED_SYM INT_SYM { $$.set(&type_handler_longlong); }
+ INT_SYM { $$.set(&type_handler_slonglong); }
+ | SIGNED_SYM { $$.set(&type_handler_slonglong); }
+ | SIGNED_SYM INT_SYM { $$.set(&type_handler_slonglong); }
| UNSIGNED { $$.set(&type_handler_ulonglong); }
| UNSIGNED INT_SYM { $$.set(&type_handler_ulonglong); }
| DECIMAL_SYM float_options { $$.set(&type_handler_newdecimal, $2); }
@@ -13089,7 +13123,7 @@ procedure_clause:
lex->proc_list.next= &lex->proc_list.first;
Item_field *item= new (thd->mem_root)
Item_field(thd, &lex->current_select->context,
- NULL, NULL, &$2);
+ $2);
if (unlikely(item == NULL))
MYSQL_YYABORT;
if (unlikely(add_proc_to_list(thd, item)))
@@ -13840,6 +13874,7 @@ delete:
lex->first_select_lex()->order_list.empty();
}
delete_part2
+ { }
;
opt_delete_system_time:
@@ -14327,20 +14362,26 @@ show_param:
}
| ALL SLAVES STATUS_SYM
{
+ if (!(Lex->m_sql_cmd= new (thd->mem_root)
+ Sql_cmd_show_slave_status(true)))
+ MYSQL_YYABORT;
Lex->sql_command = SQLCOM_SHOW_SLAVE_STAT;
- Lex->verbose= 1;
}
| SLAVE STATUS_SYM
{
LEX *lex= thd->lex;
lex->mi.connection_name= null_clex_str;
+ if (!(lex->m_sql_cmd= new (thd->mem_root)
+ Sql_cmd_show_slave_status()))
+ MYSQL_YYABORT;
lex->sql_command = SQLCOM_SHOW_SLAVE_STAT;
- lex->verbose= 0;
}
| SLAVE connection_name STATUS_SYM
{
+ if (!(Lex->m_sql_cmd= new (thd->mem_root)
+ Sql_cmd_show_slave_status()))
+ MYSQL_YYABORT;
Lex->sql_command = SQLCOM_SHOW_SLAVE_STAT;
- Lex->verbose= 0;
}
| CREATE PROCEDURE_SYM sp_name
{
@@ -15297,8 +15338,8 @@ literal:
will include the introducer and the original hex/bin notation.
*/
item_str= new (thd->mem_root)
- Item_string_with_introducer(thd, NULL, $2->ptr(), $2->length(),
- $1);
+ Item_string_with_introducer(thd, null_clex_str,
+ $2->lex_cstring(), $1);
if (unlikely(!item_str ||
!item_str->check_well_formed_result(true)))
MYSQL_YYABORT;
@@ -15688,13 +15729,9 @@ ident_table_alias:
}
;
-ident_set_usual_case:
- IDENT_sys
- | keyword_set_usual_case
- {
- if (unlikely($$.copy_keyword(thd, &$1)))
- MYSQL_YYABORT;
- }
+ident_cli_set_usual_case:
+ IDENT_cli { $$= $1; }
+ | keyword_set_usual_case { $$= $1; }
;
ident_sysvar_name:
@@ -15799,6 +15836,7 @@ user: user_maybe_role
/* Keywords which we allow as table aliases. */
keyword_table_alias:
keyword_data_type
+ | keyword_cast_type
| keyword_set_special_case
| keyword_sp_block_section
| keyword_sp_head
@@ -15806,11 +15844,13 @@ keyword_table_alias:
| keyword_sp_var_not_label
| keyword_sysvar_type
| keyword_verb_clause
+ | EXCEPTION_ORACLE_SYM
;
/* Keyword that we allow for identifiers (except SP labels) */
keyword_ident:
keyword_data_type
+ | keyword_cast_type
| keyword_set_special_case
| keyword_sp_block_section
| keyword_sp_head
@@ -15819,6 +15859,7 @@ keyword_ident:
| keyword_sysvar_type
| keyword_verb_clause
| WINDOW_SYM
+ | EXCEPTION_ORACLE_SYM
;
/*
@@ -15830,10 +15871,12 @@ keyword_label:
| keyword_set_special_case
| keyword_sp_var_and_label
| keyword_sysvar_type
+ | EXCEPTION_ORACLE_SYM
;
keyword_sysvar_name:
keyword_data_type
+ | keyword_cast_type
| keyword_set_special_case
| keyword_sp_block_section
| keyword_sp_head
@@ -15841,10 +15884,12 @@ keyword_sysvar_name:
| keyword_sp_var_not_label
| keyword_verb_clause
| WINDOW_SYM
+ | EXCEPTION_ORACLE_SYM
;
keyword_sp_decl:
keyword_data_type
+ | keyword_cast_type
| keyword_set_special_case
| keyword_sp_block_section
| keyword_sp_head
@@ -15857,6 +15902,7 @@ keyword_sp_decl:
keyword_set_usual_case:
keyword_data_type
+ | keyword_cast_type
| keyword_sp_block_section
| keyword_sp_head
| keyword_sp_var_and_label
@@ -15864,6 +15910,17 @@ keyword_set_usual_case:
| keyword_sysvar_type
| keyword_verb_clause
| WINDOW_SYM
+ | EXCEPTION_ORACLE_SYM
+ ;
+
+non_reserved_keyword_udt:
+ keyword_sp_var_not_label
+ | keyword_sp_head
+ | keyword_verb_clause
+ | keyword_set_special_case
+ | keyword_sp_block_section
+ | keyword_sysvar_type
+ | keyword_sp_var_and_label
;
/*
@@ -15915,7 +15972,6 @@ keyword_sp_var_not_label:
| RESTORE_SYM
| SECURITY_SYM
| SERVER_SYM
- | SIGNED_SYM
| SOCKET_SYM
| SLAVE
| SLAVES
@@ -16010,7 +16066,6 @@ keyword_set_special_case:
*/
keyword_sp_block_section:
BEGIN_MARIADB_SYM
- | EXCEPTION_ORACLE_SYM
| END
;
@@ -16035,21 +16090,13 @@ keyword_data_type:
| DATETIME
| ENUM
| FIXED_SYM
- | GEOMETRYCOLLECTION
- | GEOMETRY_SYM
| JSON_SYM
- | LINESTRING
| MEDIUM_SYM
- | MULTILINESTRING
- | MULTIPOINT
- | MULTIPOLYGON
| NATIONAL_SYM
| NCHAR_SYM
| NUMBER_MARIADB_SYM
| NUMBER_ORACLE_SYM
| NVARCHAR_SYM
- | POINT_SYM
- | POLYGON
| RAW_MARIADB_SYM
| RAW_ORACLE_SYM
| ROW_SYM
@@ -16063,6 +16110,11 @@ keyword_data_type:
;
+keyword_cast_type:
+ SIGNED_SYM
+ ;
+
+
/*
These keywords are fine for both SP variable names and SP labels.
*/
@@ -16390,6 +16442,249 @@ keyword_sp_var_and_label:
| VIA_SYM
;
+
+reserved_keyword_udt:
+ ACCESSIBLE_SYM
+ | ADD
+ | ALL
+ | ALTER
+ | ANALYZE_SYM
+ | AND_SYM
+ | AS
+ | ASC
+ | ASENSITIVE_SYM
+ | BEFORE_SYM
+ | BETWEEN_SYM
+ | BIT_AND
+ | BIT_OR
+ | BIT_XOR
+ | BODY_ORACLE_SYM
+ | BOTH
+ | BY
+ | CALL_SYM
+ | CASCADE
+ | CASE_SYM
+ | CAST_SYM
+ | CHANGE
+ | CHECK_SYM
+ | COLLATE_SYM
+ | CONSTRAINT
+ | CONTINUE_MARIADB_SYM
+ | CONTINUE_ORACLE_SYM
+ | CONVERT_SYM
+ | COUNT_SYM
+ | CREATE
+ | CROSS
+ | CUME_DIST_SYM
+ | CURDATE
+ | CURRENT_USER
+ | CURRENT_ROLE
+ | CURTIME
+ | DATABASE
+ | DATABASES
+ | DATE_ADD_INTERVAL
+ | DATE_SUB_INTERVAL
+ | DAY_HOUR_SYM
+ | DAY_MICROSECOND_SYM
+ | DAY_MINUTE_SYM
+ | DAY_SECOND_SYM
+ | DECLARE_MARIADB_SYM
+ | DECLARE_ORACLE_SYM
+ | DEFAULT
+ | DELETE_DOMAIN_ID_SYM
+ | DELETE_SYM
+ | DENSE_RANK_SYM
+ | DESC
+ | DESCRIBE
+ | DETERMINISTIC_SYM
+ | DISTINCT
+ | DIV_SYM
+ | DO_DOMAIN_IDS_SYM
+ | DROP
+ | DUAL_SYM
+ | EACH_SYM
+ | ELSE
+ | ELSEIF_MARIADB_SYM
+ | ELSIF_ORACLE_SYM
+ | ENCLOSED
+ | ESCAPED
+ | EXCEPT_SYM
+ | EXISTS
+ | EXTRACT_SYM
+ | FALSE_SYM
+ | FETCH_SYM
+ | FIRST_VALUE_SYM
+ | FOREIGN
+ | FROM
+ | FULLTEXT_SYM
+ | GOTO_ORACLE_SYM
+ | GRANT
+ | GROUP_SYM
+ | GROUP_CONCAT_SYM
+ | LAG_SYM
+ | LEAD_SYM
+ | HAVING
+ | HOUR_MICROSECOND_SYM
+ | HOUR_MINUTE_SYM
+ | HOUR_SECOND_SYM
+ | IF_SYM
+ | IGNORE_DOMAIN_IDS_SYM
+ | IGNORE_SYM
+ | INDEX_SYM
+ | INFILE
+ | INNER_SYM
+ | INOUT_SYM
+ | INSENSITIVE_SYM
+ | INSERT
+ | INTERSECT_SYM
+ | INTERVAL_SYM
+ | INTO
+ | IN_SYM
+ | IS
+ | ITERATE_SYM
+ | JOIN_SYM
+ | KEYS
+ | KEY_SYM
+ | KILL_SYM
+ | LEADING
+ | LEAVE_SYM
+ | LEFT
+ | LIKE
+ | LIMIT
+ | LINEAR_SYM
+ | LINES
+ | LOAD
+ | LOCATOR_SYM
+ | LOCK_SYM
+ | LOOP_SYM
+ | LOW_PRIORITY
+ | MASTER_SSL_VERIFY_SERVER_CERT_SYM
+ | MATCH
+ | MAX_SYM
+ | MAXVALUE_SYM
+ | MEDIAN_SYM
+ | MINUTE_MICROSECOND_SYM
+ | MINUTE_SECOND_SYM
+ | MIN_SYM
+ | MODIFIES_SYM
+ | MOD_SYM
+ | NATURAL
+ | NEG
+ | NOT_SYM
+ | NOW_SYM
+ | NO_WRITE_TO_BINLOG
+ | NTILE_SYM
+ | NULL_SYM
+ | NTH_VALUE_SYM
+ | ON
+ | OPTIMIZE
+ | OPTIONALLY
+ | ORDER_SYM
+ | OR_SYM
+ | OTHERS_ORACLE_SYM
+ | OUTER
+ | OUTFILE
+ | OUT_SYM
+ | OVER_SYM
+ | PACKAGE_ORACLE_SYM
+ | PAGE_CHECKSUM_SYM
+ | PARSE_VCOL_EXPR_SYM
+ | PARTITION_SYM
+ | PERCENT_RANK_SYM
+ | PERCENTILE_CONT_SYM
+ | PERCENTILE_DISC_SYM
+ | PORTION_SYM
+ | POSITION_SYM
+ | PRECISION
+ | PRIMARY_SYM
+ | PROCEDURE_SYM
+ | PURGE
+ | RAISE_ORACLE_SYM
+ | RANGE_SYM
+ | RANK_SYM
+ | READS_SYM
+ | READ_SYM
+ | READ_WRITE_SYM
+ | RECURSIVE_SYM
+ | REF_SYSTEM_ID_SYM
+ | REFERENCES
+ | REGEXP
+ | RELEASE_SYM
+ | RENAME
+ | REPEAT_SYM
+ | REPLACE
+ | REQUIRE_SYM
+ | RESIGNAL_SYM
+ | RESTRICT
+ | RETURNING_SYM
+ | RETURN_MARIADB_SYM
+ | RETURN_ORACLE_SYM
+ | REVOKE
+ | RIGHT
+ | ROWS_SYM
+ | ROWTYPE_ORACLE_SYM
+ | ROW_NUMBER_SYM
+ | SECOND_MICROSECOND_SYM
+ | SELECT_SYM
+ | SENSITIVE_SYM
+ | SEPARATOR_SYM
+ | SERVER_OPTIONS
+ | SHOW
+ | SIGNAL_SYM
+ | SPATIAL_SYM
+ | SPECIFIC_SYM
+ | SQLEXCEPTION_SYM
+ | SQLSTATE_SYM
+ | SQLWARNING_SYM
+ | SQL_BIG_RESULT
+ | SQL_SMALL_RESULT
+ | SQL_SYM
+ | SSL_SYM
+ | STARTING
+ | STATS_AUTO_RECALC_SYM
+ | STATS_PERSISTENT_SYM
+ | STATS_SAMPLE_PAGES_SYM
+ | STDDEV_SAMP_SYM
+ | STD_SYM
+ | STRAIGHT_JOIN
+ | SUBSTRING
+ | SUM_SYM
+ | SYSDATE
+ | TABLE_REF_PRIORITY
+ | TABLE_SYM
+ | TERMINATED
+ | THEN_SYM
+ | TO_SYM
+ | TRAILING
+ | TRIGGER_SYM
+ | TRIM
+ | TRUE_SYM
+ | UNDO_SYM
+ | UNION_SYM
+ | UNIQUE_SYM
+ | UNLOCK_SYM
+ | UPDATE_SYM
+ | USAGE
+ | USE_SYM
+ | USING
+ | UTC_DATE_SYM
+ | UTC_TIMESTAMP_SYM
+ | UTC_TIME_SYM
+ | VALUES
+ | VALUES_IN_SYM
+ | VALUES_LESS_SYM
+ | VARIANCE_SYM
+ | VARYING
+ | VAR_SAMP_SYM
+ | WHEN_SYM
+ | WHERE
+ | WHILE_SYM
+ | WITH
+ | XOR
+ | YEAR_MONTH_SYM
+ | ZEROFILL
+ ;
+
/*
SQLCOM_SET_OPTION statement.
@@ -16404,111 +16699,78 @@ set:
if (lex->main_select_push())
MYSQL_YYABORT;
lex->set_stmt_init();
- lex->var_list.empty();
- sp_create_assignment_lex(thd, yychar == YYEMPTY);
}
- start_option_value_list
+ set_param
{
Lex->pop_select(); //main select
if (Lex->check_main_unit_semantics())
MYSQL_YYABORT;
}
- | SET STATEMENT_SYM
+ ;
+
+set_param:
+ option_value_no_option_type
+ | option_value_no_option_type ',' option_value_list
+ | TRANSACTION_SYM
{
- if (Lex->main_select_push())
+ Lex->option_type= OPT_DEFAULT;
+ if (sp_create_assignment_lex(thd, $1.pos()))
+ MYSQL_YYABORT;
+ }
+ transaction_characteristics
+ {
+ if (unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
MYSQL_YYABORT;
- Lex->set_stmt_init();
}
- set_stmt_option_value_following_option_type_list
+ | option_type
+ {
+ Lex->option_type= $1;
+ }
+ start_option_value_list_following_option_type
+ | STATEMENT_SYM
+ set_stmt_option_list
{
LEX *lex= Lex;
if (unlikely(lex->table_or_sp_used()))
my_yyabort_error((ER_SUBQUERIES_NOT_SUPPORTED, MYF(0), "SET STATEMENT"));
lex->stmt_var_list= lex->var_list;
lex->var_list.empty();
- Lex->pop_select(); //main select
if (Lex->check_main_unit_semantics())
MYSQL_YYABORT;
}
FOR_SYM verb_clause
- {}
;
-set_stmt_option_value_following_option_type_list:
+set_stmt_option_list:
/*
Only system variables can be used here. If this condition is changed
please check careful code under lex->option_type == OPT_STATEMENT
condition on wrong type casts.
*/
- option_value_following_option_type
- | set_stmt_option_value_following_option_type_list ',' option_value_following_option_type
- ;
-
-/* Start of option value list */
-start_option_value_list:
- option_value_no_option_type
- {
- if (unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
- MYSQL_YYABORT;
- }
- option_value_list_continued
- | TRANSACTION_SYM
- {
- Lex->option_type= OPT_DEFAULT;
- }
- transaction_characteristics
- {
- if (unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
- MYSQL_YYABORT;
- }
- | option_type
- {
- Lex->option_type= $1;
- }
- start_option_value_list_following_option_type
+ set_stmt_option
+ | set_stmt_option_list ',' set_stmt_option
;
-
/* Start of option value list, option_type was given */
start_option_value_list_following_option_type:
option_value_following_option_type
+ | option_value_following_option_type ',' option_value_list
+ | TRANSACTION_SYM
{
- if (unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
+ if (sp_create_assignment_lex(thd, $1.pos()))
MYSQL_YYABORT;
}
- option_value_list_continued
- | TRANSACTION_SYM transaction_characteristics
+ transaction_characteristics
{
if (unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
MYSQL_YYABORT;
}
;
-/* Remainder of the option value list after first option value. */
-option_value_list_continued:
- /* empty */
- | ',' option_value_list
- ;
-
/* Repeating list of option values after first option value. */
option_value_list:
- {
- sp_create_assignment_lex(thd, yychar == YYEMPTY);
- }
- option_value
- {
- if (unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
- MYSQL_YYABORT;
- }
- | option_value_list ','
- {
- sp_create_assignment_lex(thd, yychar == YYEMPTY);
- }
option_value
- {
- if (unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
- MYSQL_YYABORT;
- }
+ | option_value_list ',' option_value
;
/* Wrapper around option values following the first option value in the stmt. */
@@ -16541,16 +16803,21 @@ opt_var_ident_type:
| SESSION_SYM '.' { $$=OPT_SESSION; }
;
-/* Option values with preceding option_type. */
-option_value_following_option_type:
- ident equal set_expr_or_default
+/*
+ SET STATEMENT options do not need their own LEX or Query_arena.
+ Let's put them to the main ones.
+*/
+set_stmt_option:
+ ident_cli equal set_expr_or_default
{
- if (unlikely(Lex->set_system_variable(Lex->option_type, &$1, $3)))
+ Lex_ident_sys tmp(thd, &$1);
+ if (unlikely(Lex->set_system_variable(Lex->option_type, &tmp, $3)))
MYSQL_YYABORT;
}
- | ident '.' ident equal set_expr_or_default
+ | ident_cli '.' ident equal set_expr_or_default
{
- if (unlikely(Lex->set_system_variable(thd, Lex->option_type, &$1, &$3, $5)))
+ Lex_ident_sys tmp(thd, &$1);
+ if (unlikely(Lex->set_system_variable(thd, Lex->option_type, &tmp, &$3, $5)))
MYSQL_YYABORT;
}
| DEFAULT '.' ident equal set_expr_or_default
@@ -16560,45 +16827,132 @@ option_value_following_option_type:
}
;
+
+/* Option values with preceding option_type. */
+option_value_following_option_type:
+ ident_cli equal
+ {
+ if (sp_create_assignment_lex(thd, $1.pos()))
+ MYSQL_YYABORT;
+ }
+ set_expr_or_default
+ {
+ Lex_ident_sys tmp(thd, &$1);
+ if (unlikely(Lex->set_system_variable(Lex->option_type, &tmp, $4)) ||
+ unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
+ MYSQL_YYABORT;
+ }
+ | ident_cli '.' ident equal
+ {
+ if (sp_create_assignment_lex(thd, $1.pos()))
+ MYSQL_YYABORT;
+ }
+ set_expr_or_default
+ {
+ Lex_ident_sys tmp(thd, &$1);
+ if (unlikely(Lex->set_system_variable(thd, Lex->option_type, &tmp, &$3, $6)) ||
+ unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
+ MYSQL_YYABORT;
+ }
+ | DEFAULT '.' ident equal
+ {
+ if (sp_create_assignment_lex(thd, $1.pos()))
+ MYSQL_YYABORT;
+ }
+ set_expr_or_default
+ {
+ if (unlikely(Lex->set_default_system_variable(Lex->option_type, &$3, $6)) ||
+ unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
+ MYSQL_YYABORT;
+ }
+ ;
+
/* Option values without preceding option_type. */
option_value_no_option_type:
- ident_set_usual_case equal set_expr_or_default
+ ident_cli_set_usual_case equal
{
- if (unlikely(Lex->set_variable(&$1, $3)))
+ if (sp_create_assignment_lex(thd, $1.pos()))
MYSQL_YYABORT;
}
- | ident '.' ident equal set_expr_or_default
+ set_expr_or_default
{
- if (unlikely(Lex->set_variable(&$1, &$3, $5)))
+ Lex_ident_sys tmp(thd, &$1);
+ if (unlikely(Lex->set_variable(&tmp, $4)) ||
+ unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
MYSQL_YYABORT;
}
- | DEFAULT '.' ident equal set_expr_or_default
+ | ident_cli_set_usual_case '.' ident equal
{
- if (unlikely(Lex->set_default_system_variable(Lex->option_type, &$3, $5)))
+ if (sp_create_assignment_lex(thd, $1.pos()))
+ MYSQL_YYABORT;
+ }
+ set_expr_or_default
+ {
+ Lex_ident_sys tmp(thd, &$1);
+ if (unlikely(Lex->set_variable(&tmp, &$3, $6)) ||
+ unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
MYSQL_YYABORT;
}
- | '@' ident_or_text equal expr
+ | DEFAULT '.' ident equal
{
- if (unlikely(Lex->set_user_variable(thd, &$2, $4)))
+ if (sp_create_assignment_lex(thd, $1.pos()))
MYSQL_YYABORT;
}
- | '@' '@' opt_var_ident_type ident_sysvar_name equal set_expr_or_default
+ set_expr_or_default
{
- if (unlikely(Lex->set_system_variable($3, &$4, $6)))
+ if (unlikely(Lex->set_default_system_variable(Lex->option_type, &$3, $6)))
+ MYSQL_YYABORT;
+ if (unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
+ MYSQL_YYABORT;
+ }
+ | '@' ident_or_text equal
+ {
+ if (sp_create_assignment_lex(thd, $1.str))
+ MYSQL_YYABORT;
+ }
+ expr
+ {
+ if (unlikely(Lex->set_user_variable(thd, &$2, $5)) ||
+ unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
+ MYSQL_YYABORT;
+ }
+ | '@' '@' opt_var_ident_type ident_sysvar_name equal
+ {
+ if (sp_create_assignment_lex(thd, $1.str))
+ MYSQL_YYABORT;
+ }
+ set_expr_or_default
+ {
+ if (unlikely(Lex->set_system_variable($3, &$4, $7)) ||
+ unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
+ MYSQL_YYABORT;
+ }
+ | '@' '@' opt_var_ident_type ident_sysvar_name '.' ident equal
+ {
+ if (sp_create_assignment_lex(thd, $1.str))
+ MYSQL_YYABORT;
+ }
+ set_expr_or_default
+ {
+ if (unlikely(Lex->set_system_variable(thd, $3, &$4, &$6, $9)) ||
+ unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
MYSQL_YYABORT;
}
- | '@' '@' opt_var_ident_type ident_sysvar_name '.' ident equal set_expr_or_default
+ | '@' '@' opt_var_ident_type DEFAULT '.' ident equal
{
- if (unlikely(Lex->set_system_variable(thd, $3, &$4, &$6, $8)))
+ if (sp_create_assignment_lex(thd, $1.str))
MYSQL_YYABORT;
}
- | '@' '@' opt_var_ident_type DEFAULT '.' ident equal set_expr_or_default
+ set_expr_or_default
{
- if (unlikely(Lex->set_default_system_variable($3, &$6, $8)))
+ if (unlikely(Lex->set_default_system_variable($3, &$6, $9)) ||
+ unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
MYSQL_YYABORT;
}
| charset old_or_new_charset_name_or_default
{
+ if (sp_create_assignment_lex(thd, $1.pos()))
+ MYSQL_YYABORT;
LEX *lex= thd->lex;
CHARSET_INFO *cs2;
cs2= $2 ? $2: global_system_variables.character_set_client;
@@ -16610,6 +16964,8 @@ option_value_no_option_type:
if (unlikely(var == NULL))
MYSQL_YYABORT;
lex->var_list.push_back(var, thd->mem_root);
+ if (unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
+ MYSQL_YYABORT;
}
| NAMES_SYM equal expr
{
@@ -16624,6 +16980,8 @@ option_value_no_option_type:
}
| NAMES_SYM charset_name_or_default opt_collate
{
+ if (sp_create_assignment_lex(thd, $1.pos()))
+ MYSQL_YYABORT;
LEX *lex= Lex;
CHARSET_INFO *cs2;
CHARSET_INFO *cs3;
@@ -16638,11 +16996,14 @@ option_value_no_option_type:
set_var_collation_client *var;
var= new (thd->mem_root) set_var_collation_client(cs3, cs3, cs3);
if (unlikely(var == NULL) ||
- unlikely(lex->var_list.push_back(var, thd->mem_root)))
+ unlikely(lex->var_list.push_back(var, thd->mem_root)) ||
+ unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
MYSQL_YYABORT;
}
| DEFAULT ROLE_SYM grant_role
{
+ if (sp_create_assignment_lex(thd, $1.pos()))
+ MYSQL_YYABORT;
LEX *lex = Lex;
LEX_USER *user;
if (unlikely(!(user=(LEX_USER *) thd->calloc(sizeof(LEX_USER)))))
@@ -16658,9 +17019,13 @@ option_value_no_option_type:
thd->lex->autocommit= TRUE;
if (lex->sphead)
lex->sphead->m_flags|= sp_head::HAS_SET_AUTOCOMMIT_STMT;
+ if (unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
+ MYSQL_YYABORT;
}
| DEFAULT ROLE_SYM grant_role FOR_SYM user
{
+ if (sp_create_assignment_lex(thd, $1.pos()))
+ MYSQL_YYABORT;
LEX *lex = Lex;
set_var_default_role *var= (new (thd->mem_root)
set_var_default_role($5, $3->user));
@@ -16670,22 +17035,36 @@ option_value_no_option_type:
thd->lex->autocommit= TRUE;
if (lex->sphead)
lex->sphead->m_flags|= sp_head::HAS_SET_AUTOCOMMIT_STMT;
+ if (unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
+ MYSQL_YYABORT;
}
| ROLE_SYM ident_or_text
{
+ if (sp_create_assignment_lex(thd, $1.pos()))
+ MYSQL_YYABORT;
LEX *lex = Lex;
set_var_role *var= new (thd->mem_root) set_var_role($2);
if (unlikely(var == NULL) ||
- unlikely(lex->var_list.push_back(var, thd->mem_root)))
+ unlikely(lex->var_list.push_back(var, thd->mem_root)) ||
+ unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
+ MYSQL_YYABORT;
+ }
+ | ROLE_SYM equal
+ {
+ if (sp_create_assignment_lex(thd, $1.pos()))
MYSQL_YYABORT;
}
- | ROLE_SYM equal set_expr_or_default
+ set_expr_or_default
{
- if (unlikely(Lex->set_variable(&$1, $3)))
+ Lex_ident_sys tmp(thd, &$1);
+ if (unlikely(Lex->set_variable(&tmp, $4)) ||
+ unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
MYSQL_YYABORT;
}
| PASSWORD_SYM opt_for_user text_or_password
{
+ if (sp_create_assignment_lex(thd, $1.pos()))
+ MYSQL_YYABORT;
LEX *lex = Lex;
set_var_password *var= (new (thd->mem_root)
set_var_password(lex->definer));
@@ -16695,6 +17074,8 @@ option_value_no_option_type:
lex->autocommit= TRUE;
if (lex->sphead)
lex->sphead->m_flags|= sp_head::HAS_SET_AUTOCOMMIT_STMT;
+ if (unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
+ MYSQL_YYABORT;
}
;
@@ -17668,10 +18049,10 @@ release:
unit_type_decl:
UNION_SYM union_option
{ $$.unit_type= UNION_TYPE; $$.distinct= $2; }
- | INTERSECT_SYM
- { $$.unit_type= INTERSECT_TYPE; $$.distinct= 1; }
- | EXCEPT_SYM
- { $$.unit_type= EXCEPT_TYPE; $$.distinct= 1; }
+ | INTERSECT_SYM union_option
+ { $$.unit_type= INTERSECT_TYPE; $$.distinct= $2; }
+ | EXCEPT_SYM union_option
+ { $$.unit_type= EXCEPT_TYPE; $$.distinct= $2; }
;
/*
diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy
index 812f2032c18..d475157f7ca 100644
--- a/sql/sql_yacc_ora.yy
+++ b/sql/sql_yacc_ora.yy
@@ -259,7 +259,6 @@ void ORAerror(THD *thd, const char *s)
enum Condition_information_item::Name cond_info_item_name;
enum enum_diag_condition_item_name diag_condition_item_name;
enum Diagnostics_information::Which_area diag_area;
- enum Field::geometry_type geom_type;
enum enum_fk_option m_fk_option;
enum Item_udftype udf_type;
enum Key::Keytype key_type;
@@ -282,7 +281,7 @@ void ORAerror(THD *thd, const char *s)
enum Window_frame::Frame_exclusion frame_exclusion;
enum trigger_order_type trigger_action_order_type;
DDL_options_st object_ddl_options;
- enum vers_sys_type_t vers_range_unit;
+ enum vers_kind_t vers_range_unit;
enum Column_definition::enum_column_versioning vers_column_versioning;
enum plsql_cursor_attr_t plsql_cursor_attr;
}
@@ -295,10 +294,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%parse-param { THD *thd }
%lex-param { THD *thd }
/*
- Currently there are 41 shift/reduce conflicts.
+ Currently there are 40 shift/reduce conflicts.
We should not introduce new conflicts any more.
*/
-%expect 41
+%expect 40
/*
Comments for TOKENS.
@@ -320,316 +319,339 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
*/
+%token <lex_str> '@'
+
+/*
+ Special purpose tokens
+*/
+%token <NONE> ABORT_SYM /* INTERNAL (used in lex) */
+%token <NONE> IMPOSSIBLE_ACTION /* To avoid warning for yyerrlab1 */
+%token <NONE> END_OF_INPUT /* INTERNAL */
+%token <kwd> COLON_ORACLE_SYM /* INTERNAL */
+%token <kwd> PARAM_MARKER /* INTERNAL */
+%token <NONE> FOR_SYSTEM_TIME_SYM /* INTERNAL */
+%token <NONE> LEFT_PAREN_ALT /* INTERNAL */
+%token <NONE> LEFT_PAREN_WITH /* INTERNAL */
+%token <NONE> LEFT_PAREN_LIKE /* INTERNAL */
+%token <NONE> ORACLE_CONCAT_SYM /* INTERNAL */
+%token <NONE> PERCENT_ORACLE_SYM /* INTERNAL */
+%token <NONE> WITH_CUBE_SYM /* INTERNAL */
+%token <NONE> WITH_ROLLUP_SYM /* INTERNAL */
+%token <NONE> WITH_SYSTEM_SYM /* INTERNAL */
+
+
/*
- Reserved keywords and operators
+ Identifiers
*/
-%token ABORT_SYM /* INTERNAL (used in lex) */
-%token ACCESSIBLE_SYM
-%token ADD /* SQL-2003-R */
-%token ALL /* SQL-2003-R */
-%token ALTER /* SQL-2003-R */
-%token ANALYZE_SYM
-%token AND_AND_SYM /* OPERATOR */
-%token AND_SYM /* SQL-2003-R */
-%token AS /* SQL-2003-R */
-%token ASC /* SQL-2003-N */
-%token ASENSITIVE_SYM /* FUTURE-USE */
-%token BEFORE_SYM /* SQL-2003-N */
-%token BETWEEN_SYM /* SQL-2003-R */
-%token BIGINT /* SQL-2003-R */
-%token BINARY /* SQL-2003-R */
-%token BIN_NUM
-%token BIT_AND /* MYSQL-FUNC */
-%token BIT_OR /* MYSQL-FUNC */
-%token BIT_XOR /* MYSQL-FUNC */
-%token BLOB_MARIADB_SYM /* SQL-2003-R */
-%token BLOB_ORACLE_SYM /* Oracle-R */
-%token BODY_ORACLE_SYM /* Oracle-R */
-%token BOTH /* SQL-2003-R */
-%token BY /* SQL-2003-R */
-%token CALL_SYM /* SQL-2003-R */
-%token CASCADE /* SQL-2003-N */
-%token CASE_SYM /* SQL-2003-R */
-%token CAST_SYM /* SQL-2003-R */
-%token CHANGE
-%token CHAR_SYM /* SQL-2003-R */
-%token CHECK_SYM /* SQL-2003-R */
-%token COLLATE_SYM /* SQL-2003-R */
-%token CONDITION_SYM /* SQL-2003-R, SQL-2008-R */
-%token CONSTRAINT /* SQL-2003-R */
-%token CONTINUE_MARIADB_SYM /* SQL-2003-R, Oracle-R */
-%token CONTINUE_ORACLE_SYM /* SQL-2003-R, Oracle-R */
-%token CONVERT_SYM /* SQL-2003-N */
-%token COUNT_SYM /* SQL-2003-N */
-%token CREATE /* SQL-2003-R */
-%token CROSS /* SQL-2003-R */
-%token CUME_DIST_SYM
-%token CURDATE /* MYSQL-FUNC */
-%token CURRENT_USER /* SQL-2003-R */
-%token CURRENT_ROLE /* SQL-2003-R */
-%token CURSOR_SYM /* SQL-2003-R */
-%token CURTIME /* MYSQL-FUNC */
-%token DATABASE
-%token DATABASES
-%token DATE_ADD_INTERVAL /* MYSQL-FUNC */
-%token DATE_SUB_INTERVAL /* MYSQL-FUNC */
-%token DAY_HOUR_SYM
-%token DAY_MICROSECOND_SYM
-%token DAY_MINUTE_SYM
-%token DAY_SECOND_SYM
-%token DECIMAL_NUM
-%token DECIMAL_SYM /* SQL-2003-R */
-%token DECLARE_MARIADB_SYM /* SQL-2003-R */
-%token DECLARE_ORACLE_SYM /* Oracle-R */
-%token DEFAULT /* SQL-2003-R */
-%token DELETE_DOMAIN_ID_SYM
-%token DELETE_SYM /* SQL-2003-R */
-%token DENSE_RANK_SYM
-%token DESC /* SQL-2003-N */
-%token DESCRIBE /* SQL-2003-R */
-%token DETERMINISTIC_SYM /* SQL-2003-R */
-%token DISTINCT /* SQL-2003-R */
-%token DIV_SYM
-%token DOUBLE_SYM /* SQL-2003-R */
-%token DO_DOMAIN_IDS_SYM
-%token DOT_DOT_SYM
-%token DROP /* SQL-2003-R */
-%token DUAL_SYM
-%token EACH_SYM /* SQL-2003-R */
-%token ELSE /* SQL-2003-R */
-%token ELSEIF_MARIADB_SYM
-%token ELSIF_ORACLE_SYM /* PLSQL-R */
-%token ENCLOSED
-%token END_OF_INPUT /* INTERNAL */
-%token EQUAL_SYM /* OPERATOR */
-%token ESCAPED
-%token EXCEPT_SYM /* SQL-2003-R */
-%token EXISTS /* SQL-2003-R */
-%token EXTRACT_SYM /* SQL-2003-N */
-%token FALSE_SYM /* SQL-2003-R */
-%token FETCH_SYM /* SQL-2003-R */
-%token FIRST_VALUE_SYM /* SQL-2011 */
-%token FLOAT_NUM
-%token FLOAT_SYM /* SQL-2003-R */
-%token FOREIGN /* SQL-2003-R */
-%token FOR_SYM /* SQL-2003-R */
-%token FOR_SYSTEM_TIME_SYM /* INTERNAL */
-%token FROM
-%token FULLTEXT_SYM
-%token GE
-%token GOTO_ORACLE_SYM /* Oracle-R */
-%token GRANT /* SQL-2003-R */
-%token GROUP_SYM /* SQL-2003-R */
-%token GROUP_CONCAT_SYM
-%token LAG_SYM /* SQL-2011 */
-%token LEAD_SYM /* SQL-2011 */
-%token HAVING /* SQL-2003-R */
-%token HEX_NUM
-%token HEX_STRING
-%token HOUR_MICROSECOND_SYM
-%token HOUR_MINUTE_SYM
-%token HOUR_SECOND_SYM
%token IDENT
%token IDENT_QUOTED
-%token IF_SYM
-%token IGNORE_DOMAIN_IDS_SYM
-%token IGNORE_SYM
-%token INDEX_SYM
-%token INFILE
-%token INNER_SYM /* SQL-2003-R */
-%token INOUT_SYM /* SQL-2003-R */
-%token INSENSITIVE_SYM /* SQL-2003-R */
-%token INSERT /* SQL-2003-R */
-%token INTERSECT_SYM /* SQL-2003-R */
-%token INTERVAL_SYM /* SQL-2003-R */
-%token INTO /* SQL-2003-R */
-%token INT_SYM /* SQL-2003-R */
-%token IN_SYM /* SQL-2003-R */
-%token IS /* SQL-2003-R */
-%token ITERATE_SYM
-%token JOIN_SYM /* SQL-2003-R */
-%token KEYS
-%token KEY_SYM /* SQL-2003-N */
-%token KILL_SYM
-%token LE /* OPERATOR */
-%token LEADING /* SQL-2003-R */
-%token LEAVE_SYM
-%token LEFT /* SQL-2003-R */
-%token LEFT_PAREN_ALT /* INTERNAL */
-%token LEFT_PAREN_WITH /* INTERNAL */
-%token LEFT_PAREN_LIKE /* INTERNAL */
%token LEX_HOSTNAME
-%token LIKE /* SQL-2003-R */
-%token LIMIT
-%token LINEAR_SYM
-%token LINES
-%token LOAD
-%token LOCATOR_SYM /* SQL-2003-N */
-%token LOCK_SYM
-%token LONGBLOB
-%token LONGTEXT
-%token LONG_NUM
-%token LONG_SYM
-%token LOOP_SYM
-%token LOW_PRIORITY
-%token MASTER_SSL_VERIFY_SERVER_CERT_SYM
-%token MATCH /* SQL-2003-R */
-%token MAX_SYM /* SQL-2003-N */
-%token MAXVALUE_SYM /* SQL-2003-N */
-%token MEDIAN_SYM
-%token MEDIUMBLOB
-%token MEDIUMINT
-%token MEDIUMTEXT
-%token MINUTE_MICROSECOND_SYM
-%token MINUTE_SECOND_SYM
-%token MIN_SYM /* SQL-2003-N */
-%token MODIFIES_SYM /* SQL-2003-R */
-%token MOD_SYM /* SQL-2003-N */
-%token MYSQL_CONCAT_SYM /* OPERATOR */
-%token NATURAL /* SQL-2003-R */
-%token NCHAR_STRING
-%token NE /* OPERATOR */
-%token NEG
-%token NOT2_SYM
-%token NOT_SYM /* SQL-2003-R */
-%token NOW_SYM
-%token NO_WRITE_TO_BINLOG
-%token NTILE_SYM
-%token NULL_SYM /* SQL-2003-R */
-%token NUM
-%token NUMERIC_SYM /* SQL-2003-R */
-%token NTH_VALUE_SYM /* SQL-2011 */
-%token ON /* SQL-2003-R */
-%token OPTIMIZE
-%token OPTIONALLY
-%token ORACLE_CONCAT_SYM /* INTERNAL */
-%token OR2_SYM
-%token ORDER_SYM /* SQL-2003-R */
-%token OR_SYM /* SQL-2003-R */
-%token OTHERS_ORACLE_SYM /* SQL-2011-N, PLSQL-R */
-%token OUTER
-%token OUTFILE
-%token OUT_SYM /* SQL-2003-R */
-%token OVER_SYM
-%token PACKAGE_ORACLE_SYM /* Oracle-R */
-%token PAGE_CHECKSUM_SYM
-%token PARAM_MARKER
-%token PARSE_VCOL_EXPR_SYM
-%token PARTITION_SYM /* SQL-2003-R */
-%token PERCENT_ORACLE_SYM /* INTERNAL */
-%token PERCENT_RANK_SYM
-%token PERCENTILE_CONT_SYM
-%token PERCENTILE_DISC_SYM
-%token PORTION_SYM /* SQL-2016-R */
-%token POSITION_SYM /* SQL-2003-N */
-%token PRECISION /* SQL-2003-R */
-%token PRIMARY_SYM /* SQL-2003-R */
-%token PROCEDURE_SYM /* SQL-2003-R */
-%token PURGE
-%token RAISE_ORACLE_SYM /* PLSQL-R */
-%token RANGE_SYM /* SQL-2003-R */
-%token RANK_SYM
-%token READS_SYM /* SQL-2003-R */
-%token READ_SYM /* SQL-2003-N */
-%token READ_WRITE_SYM
-%token REAL /* SQL-2003-R */
-%token RECURSIVE_SYM
-%token REF_SYSTEM_ID_SYM
-%token REFERENCES /* SQL-2003-R */
-%token REGEXP
-%token RELEASE_SYM /* SQL-2003-R */
-%token RENAME
-%token REPEAT_SYM /* MYSQL-FUNC */
-%token REPLACE /* MYSQL-FUNC */
-%token REQUIRE_SYM
-%token RESIGNAL_SYM /* SQL-2003-R */
-%token RESTRICT
-%token RETURNING_SYM
-%token RETURN_MARIADB_SYM /* SQL-2003-R, PLSQL-R */
-%token RETURN_ORACLE_SYM /* SQL-2003-R, PLSQL-R */
-%token REVOKE /* SQL-2003-R */
-%token RIGHT /* SQL-2003-R */
-%token ROWS_SYM /* SQL-2003-R */
-%token ROWTYPE_ORACLE_SYM /* PLSQL-R */
-%token ROW_NUMBER_SYM
-%token SECOND_MICROSECOND_SYM
-%token SELECT_SYM /* SQL-2003-R */
-%token SENSITIVE_SYM /* FUTURE-USE */
-%token SEPARATOR_SYM
-%token SERVER_OPTIONS
-%token SET /* SQL-2003-R */
-%token SET_VAR
-%token SHIFT_LEFT /* OPERATOR */
-%token SHIFT_RIGHT /* OPERATOR */
-%token SHOW
-%token SIGNAL_SYM /* SQL-2003-R */
-%token SMALLINT /* SQL-2003-R */
-%token SPATIAL_SYM
-%token SPECIFIC_SYM /* SQL-2003-R */
-%token SQLEXCEPTION_SYM /* SQL-2003-R */
-%token SQLSTATE_SYM /* SQL-2003-R */
-%token SQLWARNING_SYM /* SQL-2003-R */
-%token SQL_BIG_RESULT
-%token SQL_SMALL_RESULT
-%token SQL_SYM /* SQL-2003-R */
-%token SSL_SYM
-%token STARTING
-%token STATS_AUTO_RECALC_SYM
-%token STATS_PERSISTENT_SYM
-%token STATS_SAMPLE_PAGES_SYM
-%token STDDEV_SAMP_SYM /* SQL-2003-N */
-%token STD_SYM
-%token STRAIGHT_JOIN
-%token SUBSTRING /* SQL-2003-N */
-%token SUM_SYM /* SQL-2003-N */
-%token SYSDATE
-%token TABLE_REF_PRIORITY
-%token TABLE_SYM /* SQL-2003-R */
-%token TERMINATED
-%token TEXT_STRING
-%token THEN_SYM /* SQL-2003-R */
-%token TINYBLOB
-%token TINYINT
-%token TINYTEXT
-%token TO_SYM /* SQL-2003-R */
-%token TRAILING /* SQL-2003-R */
-%token TRIGGER_SYM /* SQL-2003-R */
-%token TRIM /* SQL-2003-N */
-%token TRUE_SYM /* SQL-2003-R */
-%token ULONGLONG_NUM
-%token UNDERSCORE_CHARSET
-%token UNDO_SYM /* FUTURE-USE */
-%token UNION_SYM /* SQL-2003-R */
-%token UNIQUE_SYM
-%token UNLOCK_SYM
-%token UNSIGNED
-%token UPDATE_SYM /* SQL-2003-R */
-%token USAGE /* SQL-2003-N */
-%token USE_SYM
-%token USING /* SQL-2003-R */
-%token UTC_DATE_SYM
-%token UTC_TIMESTAMP_SYM
-%token UTC_TIME_SYM
-%token VALUES /* SQL-2003-R */
-%token VALUES_IN_SYM
-%token VALUES_LESS_SYM
-%token VARBINARY
-%token VARCHAR /* SQL-2003-R */
-%token VARIANCE_SYM
-%token VARYING /* SQL-2003-R */
-%token VAR_SAMP_SYM
-%token WHEN_SYM /* SQL-2003-R */
-%token WHERE /* SQL-2003-R */
-%token WHILE_SYM
-%token WITH /* SQL-2003-R */
-%token WITH_CUBE_SYM /* INTERNAL */
-%token WITH_ROLLUP_SYM /* INTERNAL */
-%token WITH_SYSTEM_SYM /* INTERNAL */
-%token XOR
-%token YEAR_MONTH_SYM
-%token ZEROFILL
-
-%token IMPOSSIBLE_ACTION /* To avoid warning for yyerrlab1 */
+%token UNDERSCORE_CHARSET /* _latin1 */
+
+
+/*
+ Literals
+*/
+%token BIN_NUM /* LITERAL */
+%token DECIMAL_NUM /* LITERAL */
+%token FLOAT_NUM /* LITERAL */
+%token HEX_NUM /* LITERAL */
+%token HEX_STRING /* LITERAL */
+%token LONG_NUM /* LITERAL */
+%token NCHAR_STRING /* LITERAL */
+%token NUM /* LITERAL */
+%token TEXT_STRING /* LITERAL */
+%token ULONGLONG_NUM /* LITERAL */
+
+
+/*
+ Operators
+*/
+%token <NONE> AND_AND_SYM /* OPERATOR */
+%token <NONE> DOT_DOT_SYM /* OPERATOR */
+%token <NONE> EQUAL_SYM /* OPERATOR */
+%token <NONE> GE /* OPERATOR */
+%token <NONE> LE /* OPERATOR */
+%token <NONE> MYSQL_CONCAT_SYM /* OPERATOR */
+%token <NONE> NE /* OPERATOR */
+%token <NONE> NOT2_SYM /* OPERATOR */
+%token <NONE> OR2_SYM /* OPERATOR */
+%token <NONE> SET_VAR /* OPERATOR */
+%token <NONE> SHIFT_LEFT /* OPERATOR */
+%token <NONE> SHIFT_RIGHT /* OPERATOR */
+
+
+/*
+ Reserved keywords
+*/
+%token <kwd> ACCESSIBLE_SYM
+%token <kwd> ADD /* SQL-2003-R */
+%token <kwd> ALL /* SQL-2003-R */
+%token <kwd> ALTER /* SQL-2003-R */
+%token <kwd> ANALYZE_SYM
+%token <kwd> AND_SYM /* SQL-2003-R */
+%token <kwd> ASC /* SQL-2003-N */
+%token <kwd> ASENSITIVE_SYM /* FUTURE-USE */
+%token <kwd> AS /* SQL-2003-R */
+%token <kwd> BEFORE_SYM /* SQL-2003-N */
+%token <kwd> BETWEEN_SYM /* SQL-2003-R */
+%token <kwd> BIGINT /* SQL-2003-R */
+%token <kwd> BINARY /* SQL-2003-R */
+%token <kwd> BIT_AND /* MYSQL-FUNC */
+%token <kwd> BIT_OR /* MYSQL-FUNC */
+%token <kwd> BIT_XOR /* MYSQL-FUNC */
+%token <kwd> BLOB_MARIADB_SYM /* SQL-2003-R */
+%token <kwd> BLOB_ORACLE_SYM /* Oracle-R */
+%token <kwd> BODY_ORACLE_SYM /* Oracle-R */
+%token <kwd> BOTH /* SQL-2003-R */
+%token <kwd> BY /* SQL-2003-R */
+%token <kwd> CALL_SYM /* SQL-2003-R */
+%token <kwd> CASCADE /* SQL-2003-N */
+%token <kwd> CASE_SYM /* SQL-2003-R */
+%token <kwd> CAST_SYM /* SQL-2003-R */
+%token <kwd> CHANGE
+%token <kwd> CHAR_SYM /* SQL-2003-R */
+%token <kwd> CHECK_SYM /* SQL-2003-R */
+%token <kwd> COLLATE_SYM /* SQL-2003-R */
+%token <kwd> CONDITION_SYM /* SQL-2003-R, SQL-2008-R */
+%token <kwd> CONSTRAINT /* SQL-2003-R */
+%token <kwd> CONTINUE_MARIADB_SYM /* SQL-2003-R, Oracle-R */
+%token <kwd> CONTINUE_ORACLE_SYM /* SQL-2003-R, Oracle-R */
+%token <kwd> CONVERT_SYM /* SQL-2003-N */
+%token <kwd> COUNT_SYM /* SQL-2003-N */
+%token <kwd> CREATE /* SQL-2003-R */
+%token <kwd> CROSS /* SQL-2003-R */
+%token <kwd> CUME_DIST_SYM
+%token <kwd> CURDATE /* MYSQL-FUNC */
+%token <kwd> CURRENT_ROLE /* SQL-2003-R */
+%token <kwd> CURRENT_USER /* SQL-2003-R */
+%token <kwd> CURSOR_SYM /* SQL-2003-R */
+%token <kwd> CURTIME /* MYSQL-FUNC */
+%token <kwd> DATABASE
+%token <kwd> DATABASES
+%token <kwd> DATE_ADD_INTERVAL /* MYSQL-FUNC */
+%token <kwd> DATE_SUB_INTERVAL /* MYSQL-FUNC */
+%token <kwd> DAY_HOUR_SYM
+%token <kwd> DAY_MICROSECOND_SYM
+%token <kwd> DAY_MINUTE_SYM
+%token <kwd> DAY_SECOND_SYM
+%token <kwd> DECIMAL_SYM /* SQL-2003-R */
+%token <kwd> DECLARE_MARIADB_SYM /* SQL-2003-R */
+%token <kwd> DECLARE_ORACLE_SYM /* Oracle-R */
+%token <kwd> DEFAULT /* SQL-2003-R */
+%token <kwd> DELETE_DOMAIN_ID_SYM
+%token <kwd> DELETE_SYM /* SQL-2003-R */
+%token <kwd> DENSE_RANK_SYM
+%token <kwd> DESCRIBE /* SQL-2003-R */
+%token <kwd> DESC /* SQL-2003-N */
+%token <kwd> DETERMINISTIC_SYM /* SQL-2003-R */
+%token <kwd> DISTINCT /* SQL-2003-R */
+%token <kwd> DIV_SYM
+%token <kwd> DO_DOMAIN_IDS_SYM
+%token <kwd> DOUBLE_SYM /* SQL-2003-R */
+%token <kwd> DROP /* SQL-2003-R */
+%token <kwd> DUAL_SYM
+%token <kwd> EACH_SYM /* SQL-2003-R */
+%token <kwd> ELSEIF_MARIADB_SYM
+%token <kwd> ELSE /* SQL-2003-R */
+%token <kwd> ELSIF_ORACLE_SYM /* PLSQL-R */
+%token <kwd> ENCLOSED
+%token <kwd> ESCAPED
+%token <kwd> EXCEPT_SYM /* SQL-2003-R */
+%token <kwd> EXISTS /* SQL-2003-R */
+%token <kwd> EXTRACT_SYM /* SQL-2003-N */
+%token <kwd> FALSE_SYM /* SQL-2003-R */
+%token <kwd> FETCH_SYM /* SQL-2003-R */
+%token <kwd> FIRST_VALUE_SYM /* SQL-2011 */
+%token <kwd> FLOAT_SYM /* SQL-2003-R */
+%token <kwd> FOREIGN /* SQL-2003-R */
+%token <kwd> FOR_SYM /* SQL-2003-R */
+%token <kwd> FROM
+%token <kwd> FULLTEXT_SYM
+%token <kwd> GOTO_ORACLE_SYM /* Oracle-R */
+%token <kwd> GRANT /* SQL-2003-R */
+%token <kwd> GROUP_CONCAT_SYM
+%token <rwd> JSON_ARRAYAGG_SYM
+%token <kwd> GROUP_SYM /* SQL-2003-R */
+%token <kwd> HAVING /* SQL-2003-R */
+%token <kwd> HOUR_MICROSECOND_SYM
+%token <kwd> HOUR_MINUTE_SYM
+%token <kwd> HOUR_SECOND_SYM
+%token <kwd> IF_SYM
+%token <kwd> IGNORE_DOMAIN_IDS_SYM
+%token <kwd> IGNORE_SYM
+%token <kwd> INDEX_SYM
+%token <kwd> INFILE
+%token <kwd> INNER_SYM /* SQL-2003-R */
+%token <kwd> INOUT_SYM /* SQL-2003-R */
+%token <kwd> INSENSITIVE_SYM /* SQL-2003-R */
+%token <kwd> INSERT /* SQL-2003-R */
+%token <kwd> IN_SYM /* SQL-2003-R */
+%token <kwd> INTERSECT_SYM /* SQL-2003-R */
+%token <kwd> INTERVAL_SYM /* SQL-2003-R */
+%token <kwd> INTO /* SQL-2003-R */
+%token <kwd> INT_SYM /* SQL-2003-R */
+%token <kwd> IS /* SQL-2003-R */
+%token <kwd> ITERATE_SYM
+%token <kwd> JOIN_SYM /* SQL-2003-R */
+%token <kwd> KEYS
+%token <kwd> KEY_SYM /* SQL-2003-N */
+%token <kwd> KILL_SYM
+%token <kwd> LAG_SYM /* SQL-2011 */
+%token <kwd> LEADING /* SQL-2003-R */
+%token <kwd> LEAD_SYM /* SQL-2011 */
+%token <kwd> LEAVE_SYM
+%token <kwd> LEFT /* SQL-2003-R */
+%token <kwd> LIKE /* SQL-2003-R */
+%token <kwd> LIMIT
+%token <kwd> LINEAR_SYM
+%token <kwd> LINES
+%token <kwd> LOAD
+%token <kwd> LOCATOR_SYM /* SQL-2003-N */
+%token <kwd> LOCK_SYM
+%token <kwd> LONGBLOB
+%token <kwd> LONG_SYM
+%token <kwd> LONGTEXT
+%token <kwd> LOOP_SYM
+%token <kwd> LOW_PRIORITY
+%token <kwd> MASTER_SSL_VERIFY_SERVER_CERT_SYM
+%token <kwd> MATCH /* SQL-2003-R */
+%token <kwd> MAX_SYM /* SQL-2003-N */
+%token <kwd> MAXVALUE_SYM /* SQL-2003-N */
+%token <kwd> MEDIAN_SYM
+%token <kwd> MEDIUMBLOB
+%token <kwd> MEDIUMINT
+%token <kwd> MEDIUMTEXT
+%token <kwd> MIN_SYM /* SQL-2003-N */
+%token <kwd> MINUTE_MICROSECOND_SYM
+%token <kwd> MINUTE_SECOND_SYM
+%token <kwd> MODIFIES_SYM /* SQL-2003-R */
+%token <kwd> MOD_SYM /* SQL-2003-N */
+%token <kwd> NATURAL /* SQL-2003-R */
+%token <kwd> NEG
+%token <kwd> NOT_SYM /* SQL-2003-R */
+%token <kwd> NO_WRITE_TO_BINLOG
+%token <kwd> NOW_SYM
+%token <kwd> NTH_VALUE_SYM /* SQL-2011 */
+%token <kwd> NTILE_SYM
+%token <kwd> NULL_SYM /* SQL-2003-R */
+%token <kwd> NUMERIC_SYM /* SQL-2003-R */
+%token <kwd> ON /* SQL-2003-R */
+%token <kwd> OPTIMIZE
+%token <kwd> OPTIONALLY
+%token <kwd> ORDER_SYM /* SQL-2003-R */
+%token <kwd> OR_SYM /* SQL-2003-R */
+%token <kwd> OTHERS_ORACLE_SYM /* SQL-2011-N, PLSQL-R */
+%token <kwd> OUTER
+%token <kwd> OUTFILE
+%token <kwd> OUT_SYM /* SQL-2003-R */
+%token <kwd> OVER_SYM
+%token <kwd> PACKAGE_ORACLE_SYM /* Oracle-R */
+%token <kwd> PAGE_CHECKSUM_SYM
+%token <kwd> PARSE_VCOL_EXPR_SYM
+%token <kwd> PARTITION_SYM /* SQL-2003-R */
+%token <kwd> PERCENTILE_CONT_SYM
+%token <kwd> PERCENTILE_DISC_SYM
+%token <kwd> PERCENT_RANK_SYM
+%token <kwd> PORTION_SYM /* SQL-2016-R */
+%token <kwd> POSITION_SYM /* SQL-2003-N */
+%token <kwd> PRECISION /* SQL-2003-R */
+%token <kwd> PRIMARY_SYM /* SQL-2003-R */
+%token <kwd> PROCEDURE_SYM /* SQL-2003-R */
+%token <kwd> PURGE
+%token <kwd> RAISE_ORACLE_SYM /* PLSQL-R */
+%token <kwd> RANGE_SYM /* SQL-2003-R */
+%token <kwd> RANK_SYM
+%token <kwd> READS_SYM /* SQL-2003-R */
+%token <kwd> READ_SYM /* SQL-2003-N */
+%token <kwd> READ_WRITE_SYM
+%token <kwd> REAL /* SQL-2003-R */
+%token <kwd> RECURSIVE_SYM
+%token <kwd> REFERENCES /* SQL-2003-R */
+%token <kwd> REF_SYSTEM_ID_SYM
+%token <kwd> REGEXP
+%token <kwd> RELEASE_SYM /* SQL-2003-R */
+%token <kwd> RENAME
+%token <kwd> REPEAT_SYM /* MYSQL-FUNC */
+%token <kwd> REPLACE /* MYSQL-FUNC */
+%token <kwd> REQUIRE_SYM
+%token <kwd> RESIGNAL_SYM /* SQL-2003-R */
+%token <kwd> RESTRICT
+%token <kwd> RETURNING_SYM
+%token <kwd> RETURN_MARIADB_SYM /* SQL-2003-R, PLSQL-R */
+%token <kwd> RETURN_ORACLE_SYM /* SQL-2003-R, PLSQL-R */
+%token <kwd> REVOKE /* SQL-2003-R */
+%token <kwd> RIGHT /* SQL-2003-R */
+%token <kwd> ROW_NUMBER_SYM
+%token <kwd> ROWS_SYM /* SQL-2003-R */
+%token <kwd> ROWTYPE_ORACLE_SYM /* PLSQL-R */
+%token <kwd> SECOND_MICROSECOND_SYM
+%token <kwd> SELECT_SYM /* SQL-2003-R */
+%token <kwd> SENSITIVE_SYM /* FUTURE-USE */
+%token <kwd> SEPARATOR_SYM
+%token <kwd> SERVER_OPTIONS
+%token <kwd> SET /* SQL-2003-R */
+%token <kwd> SHOW
+%token <kwd> SIGNAL_SYM /* SQL-2003-R */
+%token <kwd> SMALLINT /* SQL-2003-R */
+%token <kwd> SPATIAL_SYM
+%token <kwd> SPECIFIC_SYM /* SQL-2003-R */
+%token <kwd> SQL_BIG_RESULT
+%token <kwd> SQLEXCEPTION_SYM /* SQL-2003-R */
+%token <kwd> SQL_SMALL_RESULT
+%token <kwd> SQLSTATE_SYM /* SQL-2003-R */
+%token <kwd> SQL_SYM /* SQL-2003-R */
+%token <kwd> SQLWARNING_SYM /* SQL-2003-R */
+%token <kwd> SSL_SYM
+%token <kwd> STARTING
+%token <kwd> STATS_AUTO_RECALC_SYM
+%token <kwd> STATS_PERSISTENT_SYM
+%token <kwd> STATS_SAMPLE_PAGES_SYM
+%token <kwd> STDDEV_SAMP_SYM /* SQL-2003-N */
+%token <kwd> STD_SYM
+%token <kwd> STRAIGHT_JOIN
+%token <kwd> SUBSTRING /* SQL-2003-N */
+%token <kwd> SUM_SYM /* SQL-2003-N */
+%token <kwd> SYSDATE
+%token <kwd> TABLE_REF_PRIORITY
+%token <kwd> TABLE_SYM /* SQL-2003-R */
+%token <kwd> TERMINATED
+%token <kwd> THEN_SYM /* SQL-2003-R */
+%token <kwd> TINYBLOB
+%token <kwd> TINYINT
+%token <kwd> TINYTEXT
+%token <kwd> TO_SYM /* SQL-2003-R */
+%token <kwd> TRAILING /* SQL-2003-R */
+%token <kwd> TRIGGER_SYM /* SQL-2003-R */
+%token <kwd> TRIM /* SQL-2003-N */
+%token <kwd> TRUE_SYM /* SQL-2003-R */
+%token <kwd> UNDO_SYM /* FUTURE-USE */
+%token <kwd> UNION_SYM /* SQL-2003-R */
+%token <kwd> UNIQUE_SYM
+%token <kwd> UNLOCK_SYM
+%token <kwd> UNSIGNED
+%token <kwd> UPDATE_SYM /* SQL-2003-R */
+%token <kwd> USAGE /* SQL-2003-N */
+%token <kwd> USE_SYM
+%token <kwd> USING /* SQL-2003-R */
+%token <kwd> UTC_DATE_SYM
+%token <kwd> UTC_TIMESTAMP_SYM
+%token <kwd> UTC_TIME_SYM
+%token <kwd> VALUES_IN_SYM
+%token <kwd> VALUES_LESS_SYM
+%token <kwd> VALUES /* SQL-2003-R */
+%token <kwd> VARBINARY
+%token <kwd> VARCHAR /* SQL-2003-R */
+%token <kwd> VARIANCE_SYM
+%token <kwd> VAR_SAMP_SYM
+%token <kwd> VARYING /* SQL-2003-R */
+%token <kwd> WHEN_SYM /* SQL-2003-R */
+%token <kwd> WHERE /* SQL-2003-R */
+%token <kwd> WHILE_SYM
+%token <kwd> WITH /* SQL-2003-R */
+%token <kwd> XOR
+%token <kwd> YEAR_MONTH_SYM
+%token <kwd> ZEROFILL
/*
@@ -695,7 +717,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> COALESCE /* SQL-2003-N */
%token <kwd> CODE_SYM
%token <kwd> COLLATION_SYM /* SQL-2003-N */
-%token <kwd> COLON_ORACLE_SYM /* INTERNAL */
%token <kwd> COLUMNS
%token <kwd> COLUMN_ADD_SYM
%token <kwd> COLUMN_CHECK_SYM
@@ -786,8 +807,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> FUNCTION_SYM /* SQL-2003-R, Oracle-R */
%token <kwd> GENERAL
%token <kwd> GENERATED_SYM
-%token <kwd> GEOMETRYCOLLECTION
-%token <kwd> GEOMETRY_SYM
%token <kwd> GET_FORMAT /* MYSQL-FUNC */
%token <kwd> GET_SYM /* SQL-2003-R */
%token <kwd> GLOBAL_SYM /* SQL-2003-R */
@@ -827,7 +846,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> LEAVES
%token <kwd> LESS_SYM
%token <kwd> LEVEL_SYM
-%token <kwd> LINESTRING
%token <kwd> LIST_SYM
%token <kwd> LOCAL_SYM /* SQL-2003-R */
%token <kwd> LOCKS_SYM
@@ -873,9 +891,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> MODE_SYM
%token <kwd> MODIFY_SYM
%token <kwd> MONTH_SYM /* SQL-2003-R */
-%token <kwd> MULTILINESTRING
-%token <kwd> MULTIPOINT
-%token <kwd> MULTIPOLYGON
%token <kwd> MUTEX_SYM
%token <kwd> MYSQL_SYM
%token <kwd> MYSQL_ERRNO_SYM
@@ -922,8 +937,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> PHASE_SYM
%token <kwd> PLUGINS_SYM
%token <kwd> PLUGIN_SYM
-%token <kwd> POINT_SYM
-%token <kwd> POLYGON
%token <kwd> PORT_SYM
%token <kwd> PRECEDES_SYM /* MYSQL */
%token <kwd> PRECEDING_SYM /* SQL-2011-N */
@@ -1181,7 +1194,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
and until NEXT_SYM / PREVIOUS_SYM.
*/
%left PREC_BELOW_IDENTIFIER_OPT_SPECIAL_CASE
-%left TRANSACTION_SYM TIMESTAMP PERIOD_SYM SYSTEM USER
+%left TRANSACTION_SYM TIMESTAMP PERIOD_SYM SYSTEM USER COMMENT_SYM
/*
@@ -1231,7 +1244,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
ident
label_ident
sp_decl_ident
- ident_set_usual_case
ident_or_empty
ident_table_alias
ident_sysvar_name
@@ -1250,9 +1262,12 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
IDENT_QUOTED
IDENT_cli
ident_cli
+ ident_cli_set_usual_case
+ ident_cli_directly_assignable
%type <kwd>
keyword_data_type
+ keyword_cast_type
keyword_ident
keyword_label
keyword_set_special_case
@@ -1267,6 +1282,9 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
keyword_table_alias
keyword_verb_clause
keyword_directly_assignable
+ charset
+ reserved_keyword_udt
+ non_reserved_keyword_udt
%type <table>
table_ident table_ident_nodb references xid
@@ -1304,8 +1322,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%type <create_field> field_spec column_def
-%type <geom_type> spatial_type
-
%type <num>
order_dir lock_option
udf_type opt_local opt_no_write_to_binlog
@@ -1347,6 +1363,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
ws_level_flag_desc ws_level_flag_reverse ws_level_flags
opt_ws_levels ws_level_list ws_level_list_item ws_level_number
ws_level_range ws_level_list_or_range bool
+ field_options last_field_options
%type <ulonglong_number>
ulonglong_num real_ulonglong_num size_number
@@ -1368,7 +1385,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
primary_expr string_factor_expr mysql_concatenation_expr
select_sublist_qualified_asterisk
expr_or_default set_expr_or_default
- geometry_function signed_literal expr_or_literal
+ signed_literal expr_or_literal
opt_escape
sp_opt_default
simple_ident_nospvar
@@ -1548,7 +1565,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
procedure_list procedure_list2 procedure_item
field_def handler opt_generated_always
opt_ignore opt_column opt_restrict
- grant revoke set lock unlock string_list field_options
+ grant revoke set lock unlock string_list
opt_binary table_lock_list table_lock
ref_list opt_match_clause opt_on_update_delete use
opt_delete_options opt_delete_option varchar nchar nvarchar
@@ -1567,7 +1584,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
table_to_table_list table_to_table opt_table_list opt_as
handler_rkey_function handler_read_or_scan
single_multi table_wild_list table_wild_one opt_wild
- opt_and charset
+ opt_and
select_var_list select_var_list_init help
opt_extended_describe shutdown
opt_format_json
@@ -1598,7 +1615,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
set_assign
sp_tail_standalone
opt_constraint_no_id
-END_OF_INPUT
%type <NONE> call sp_proc_stmts sp_proc_stmts1 sp_proc_stmt
%type <NONE> sp_proc_stmt_statement sp_proc_stmt_return
@@ -1683,11 +1699,6 @@ END_OF_INPUT
'-' '+' '*' '/' '%' '(' ')'
',' '!' '{' '}' '&' '|'
-%type <NONE>
- AND_SYM OR_SYM BETWEEN_SYM CASE_SYM
- THEN_SYM WHEN_SYM DIV_SYM MOD_SYM OR2_SYM AND_AND_SYM DELETE_SYM
- MYSQL_CONCAT_SYM ORACLE_CONCAT_SYM
-
%type <with_clause> with_clause
%type <lex_str_ptr> query_name
@@ -2309,6 +2320,7 @@ create:
| create_or_replace DATABASE opt_if_not_exists ident
{
Lex->create_info.default_table_charset= NULL;
+ Lex->create_info.schema_comment= NULL;
Lex->create_info.used_fields= 0;
if (Lex->main_select_push())
MYSQL_YYABORT;
@@ -4039,16 +4051,18 @@ sp_proc_stmt_if:
sp_statement:
statement
- | ident_directly_assignable
+ | ident_cli_directly_assignable
{
// Direct procedure call (without the CALL keyword)
- if (unlikely(Lex->call_statement_start(thd, &$1)))
+ Lex_ident_sys tmp(thd, &$1);
+ if (unlikely(Lex->call_statement_start(thd, &tmp)))
MYSQL_YYABORT;
}
opt_sp_cparam_list
- | ident_directly_assignable '.' ident
+ | ident_cli_directly_assignable '.' ident
{
- if (unlikely(Lex->call_statement_start(thd, &$1, &$3)))
+ Lex_ident_sys tmp(thd, &$1);
+ if (unlikely(Lex->call_statement_start(thd, &tmp, &$3)))
MYSQL_YYABORT;
}
opt_sp_cparam_list
@@ -6048,6 +6062,11 @@ create_database_options:
create_database_option:
default_collation {}
| default_charset {}
+ | COMMENT_SYM opt_equal TEXT_STRING_sys
+ {
+ Lex->create_info.schema_comment= thd->make_clex_string($3);
+ Lex->create_info.used_fields|= HA_CREATE_USED_COMMENT;
+ }
;
opt_if_not_exists_table_element:
@@ -6662,7 +6681,7 @@ field_type_or_serial:
field_def
| SERIAL_SYM
{
- Lex->last_field->set_handler(&type_handler_longlong);
+ Lex->last_field->set_handler(&type_handler_ulonglong);
Lex->last_field->flags|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG
| UNSIGNED_FLAG | UNIQUE_KEY_FLAG;
}
@@ -6837,6 +6856,21 @@ field_type:
| field_type_string
| field_type_lob
| field_type_misc
+ | IDENT_sys float_options srid_option
+ {
+ if (Lex->set_field_type_udt(&$$, $1, $2))
+ MYSQL_YYABORT;
+ }
+ | reserved_keyword_udt float_options srid_option
+ {
+ if (Lex->set_field_type_udt(&$$, $1, $2))
+ MYSQL_YYABORT;
+ }
+ | non_reserved_keyword_udt float_options srid_option
+ {
+ if (Lex->set_field_type_udt(&$$, $1, $2))
+ MYSQL_YYABORT;
+ }
;
@@ -6850,9 +6884,12 @@ sp_param_field_type:
field_type_numeric:
- int_type opt_field_length field_options { $$.set($1, $2); }
- | real_type opt_precision field_options { $$.set($1, $2); }
- | FLOAT_SYM float_options field_options
+ int_type opt_field_length last_field_options
+ {
+ $$.set_handler_length_flags($1, $2, (uint32) $3);
+ }
+ | real_type opt_precision last_field_options { $$.set($1, $2); }
+ | FLOAT_SYM float_options last_field_options
{
$$.set(&type_handler_float, $2);
if ($2.length() && !$2.dec())
@@ -6874,24 +6911,24 @@ field_type_numeric:
}
| BOOL_SYM
{
- $$.set(&type_handler_tiny, "1");
+ $$.set(&type_handler_stiny, "1");
}
| BOOLEAN_SYM
{
- $$.set(&type_handler_tiny, "1");
+ $$.set(&type_handler_stiny, "1");
}
- | DECIMAL_SYM float_options field_options
+ | DECIMAL_SYM float_options last_field_options
{ $$.set(&type_handler_newdecimal, $2);}
- | NUMBER_ORACLE_SYM float_options field_options
+ | NUMBER_ORACLE_SYM float_options last_field_options
{
if ($2.length() != 0)
$$.set(&type_handler_newdecimal, $2);
else
$$.set(&type_handler_double);
}
- | NUMERIC_SYM float_options field_options
+ | NUMERIC_SYM float_options last_field_options
{ $$.set(&type_handler_newdecimal, $2);}
- | FIXED_SYM float_options field_options
+ | FIXED_SYM float_options last_field_options
{ $$.set(&type_handler_newdecimal, $2);}
;
@@ -6986,7 +7023,7 @@ sp_param_field_type_string:
field_type_temporal:
- YEAR_SYM opt_field_length field_options
+ YEAR_SYM opt_field_length last_field_options
{
if ($2)
{
@@ -7064,17 +7101,6 @@ field_type_lob:
Lex->charset=&my_charset_bin;
$$.set(&type_handler_long_blob);
}
- | spatial_type float_options srid_option
- {
-#ifdef HAVE_SPATIAL
- Lex->charset=&my_charset_bin;
- Lex->last_field->geom_type= $1;
- $$.set(&type_handler_geometry, $2);
-#else
- my_yyabort_error((ER_FEATURE_DISABLED, MYF(0), sym_group_geom.name,
- sym_group_geom.needed_define));
-#endif
- }
| MEDIUMBLOB opt_compressed
{
Lex->charset=&my_charset_bin;
@@ -7118,17 +7144,6 @@ field_type_misc:
{ $$.set(&type_handler_set); }
;
-spatial_type:
- GEOMETRY_SYM { $$= Field::GEOM_GEOMETRY; }
- | GEOMETRYCOLLECTION { $$= Field::GEOM_GEOMETRYCOLLECTION; }
- | POINT_SYM { $$= Field::GEOM_POINT; }
- | MULTIPOINT { $$= Field::GEOM_MULTIPOINT; }
- | LINESTRING { $$= Field::GEOM_LINESTRING; }
- | MULTILINESTRING { $$= Field::GEOM_MULTILINESTRING; }
- | POLYGON { $$= Field::GEOM_POLYGON; }
- | MULTIPOLYGON { $$= Field::GEOM_MULTIPOLYGON; }
- ;
-
char:
CHAR_SYM {}
;
@@ -7152,11 +7167,11 @@ nvarchar:
;
int_type:
- INT_SYM { $$= &type_handler_long; }
- | TINYINT { $$= &type_handler_tiny; }
- | SMALLINT { $$= &type_handler_short; }
- | MEDIUMINT { $$= &type_handler_int24; }
- | BIGINT { $$= &type_handler_longlong; }
+ INT_SYM { $$= &type_handler_slong; }
+ | TINYINT { $$= &type_handler_stiny; }
+ | SMALLINT { $$= &type_handler_sshort; }
+ | MEDIUMINT { $$= &type_handler_sint24; }
+ | BIGINT { $$= &type_handler_slonglong; }
;
real_type:
@@ -7191,12 +7206,16 @@ precision:
;
field_options:
- /* empty */ {}
- | SIGNED_SYM {}
- | UNSIGNED { Lex->last_field->flags|= UNSIGNED_FLAG;}
- | ZEROFILL { Lex->last_field->flags|= UNSIGNED_FLAG | ZEROFILL_FLAG; }
- | UNSIGNED ZEROFILL { Lex->last_field->flags|= UNSIGNED_FLAG | ZEROFILL_FLAG; }
- | ZEROFILL UNSIGNED { Lex->last_field->flags|= UNSIGNED_FLAG | ZEROFILL_FLAG; }
+ /* empty */ { $$= 0; }
+ | SIGNED_SYM { $$= 0; }
+ | UNSIGNED { $$= UNSIGNED_FLAG; }
+ | ZEROFILL { $$= UNSIGNED_FLAG | ZEROFILL_FLAG; }
+ | UNSIGNED ZEROFILL { $$= UNSIGNED_FLAG | ZEROFILL_FLAG; }
+ | ZEROFILL UNSIGNED { $$= UNSIGNED_FLAG | ZEROFILL_FLAG; }
+ ;
+
+last_field_options:
+ field_options { Lex->last_field->flags|= ($$= $1); }
;
field_length:
@@ -7418,8 +7437,8 @@ sp_param_type_with_opt_collate:
;
charset:
- CHAR_SYM SET {}
- | CHARSET {}
+ CHAR_SYM SET { $$= $1; }
+ | CHARSET { $$= $1; }
;
charset_name:
@@ -7911,6 +7930,7 @@ alter:
| ALTER DATABASE ident_or_empty
{
Lex->create_info.default_table_charset= NULL;
+ Lex->create_info.schema_comment= NULL;
Lex->create_info.used_fields= 0;
if (Lex->main_select_push())
MYSQL_YYABORT;
@@ -7925,6 +7945,22 @@ alter:
MYSQL_YYABORT;
Lex->pop_select(); //main select
}
+ | ALTER DATABASE COMMENT_SYM opt_equal TEXT_STRING_sys
+ {
+ Lex->create_info.default_table_charset= NULL;
+ Lex->create_info.used_fields= 0;
+ Lex->create_info.schema_comment= thd->make_clex_string($5);
+ Lex->create_info.used_fields|= HA_CREATE_USED_COMMENT;
+ }
+ opt_create_database_options
+ {
+ LEX *lex=Lex;
+ lex->sql_command=SQLCOM_ALTER_DB;
+ lex->name= Lex_ident_sys();
+ if (lex->name.str == NULL &&
+ unlikely(lex->copy_db_to(&lex->name)))
+ MYSQL_YYABORT;
+ }
| ALTER DATABASE ident UPGRADE_SYM DATA_SYM DIRECTORY_SYM NAME_SYM
{
LEX *lex= Lex;
@@ -8169,7 +8205,8 @@ opt_ev_sql_stmt:
;
ident_or_empty:
- /* empty */ { $$= Lex_ident_sys(); }
+ /* empty */
+ %prec PREC_BELOW_IDENTIFIER_OPT_SPECIAL_CASE { $$= Lex_ident_sys(); }
| ident
;
@@ -9831,7 +9868,7 @@ select_item_list:
{
Item *item= new (thd->mem_root)
Item_field(thd, &thd->lex->current_select->context,
- NULL, NULL, &star_clex_str);
+ star_clex_str);
if (unlikely(item == NULL))
MYSQL_YYABORT;
if (unlikely(add_item_to_list(thd, item)))
@@ -9858,7 +9895,7 @@ select_item:
check_column_name($4.str)))
my_yyabort_error((ER_WRONG_COLUMN_NAME, MYF(0), $4.str));
$2->is_autogenerated_name= FALSE;
- $2->set_name(thd, $4.str, $4.length, system_charset_info);
+ $2->set_name(thd, $4);
}
else if (!$2->name.str || $2->name.str == item_empty_name)
{
@@ -10545,7 +10582,8 @@ column_default_non_parenthesized_expr:
}
| CAST_SYM '(' expr AS cast_type ')'
{
- if (unlikely(!($$= $5.create_typecast_item(thd, $3, Lex->charset))))
+ if (unlikely(!($$= $5.create_typecast_item_or_error(thd, $3,
+ Lex->charset))))
MYSQL_YYABORT;
}
| CASE_SYM when_list_opt_else END
@@ -10561,7 +10599,8 @@ column_default_non_parenthesized_expr:
}
| CONVERT_SYM '(' expr ',' cast_type ')'
{
- if (unlikely(!($$= $5.create_typecast_item(thd, $3, Lex->charset))))
+ if (unlikely(!($$= $5.create_typecast_item_or_error(thd, $3,
+ Lex->charset))))
MYSQL_YYABORT;
}
| CONVERT_SYM '(' expr USING charset_name ')'
@@ -11274,78 +11313,6 @@ function_call_conflict:
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
- | geometry_function
- {
-#ifdef HAVE_SPATIAL
- $$= $1;
- /* $1 may be NULL, GEOM_NEW not tested for out of memory */
- if (unlikely($$ == NULL))
- MYSQL_YYABORT;
-#else
- my_yyabort_error((ER_FEATURE_DISABLED, MYF(0), sym_group_geom.name,
- sym_group_geom.needed_define));
-#endif
- }
- ;
-
-geometry_function:
- CONTAINS_SYM '(' expr ',' expr ')'
- {
- $$= GEOM_NEW(thd,
- Item_func_spatial_precise_rel(thd, $3, $5,
- Item_func::SP_CONTAINS_FUNC));
- }
- | GEOMETRYCOLLECTION '(' expr_list ')'
- {
- $$= GEOM_NEW(thd,
- Item_func_spatial_collection(thd, *$3,
- Geometry::wkb_geometrycollection,
- Geometry::wkb_point));
- }
- | LINESTRING '(' expr_list ')'
- {
- $$= GEOM_NEW(thd,
- Item_func_spatial_collection(thd, *$3,
- Geometry::wkb_linestring,
- Geometry::wkb_point));
- }
- | MULTILINESTRING '(' expr_list ')'
- {
- $$= GEOM_NEW(thd,
- Item_func_spatial_collection(thd, *$3,
- Geometry::wkb_multilinestring,
- Geometry::wkb_linestring));
- }
- | MULTIPOINT '(' expr_list ')'
- {
- $$= GEOM_NEW(thd,
- Item_func_spatial_collection(thd, *$3,
- Geometry::wkb_multipoint,
- Geometry::wkb_point));
- }
- | MULTIPOLYGON '(' expr_list ')'
- {
- $$= GEOM_NEW(thd,
- Item_func_spatial_collection(thd, *$3,
- Geometry::wkb_multipolygon,
- Geometry::wkb_polygon));
- }
- | POINT_SYM '(' expr ',' expr ')'
- {
- $$= GEOM_NEW(thd, Item_func_point(thd, $3, $5));
- }
- | POLYGON '(' expr_list ')'
- {
- $$= GEOM_NEW(thd,
- Item_func_spatial_collection(thd, *$3,
- Geometry::wkb_polygon,
- Geometry::wkb_linestring));
- }
- | WITHIN '(' expr ',' expr ')'
- {
- $$= GEOM_NEW(thd, Item_func_spatial_precise_rel(thd, $3, $5,
- Item_func::SP_WITHIN_FUNC));
- }
;
/*
@@ -11379,6 +11346,7 @@ function_call_generic:
}
opt_udf_expr_list ')'
{
+ const Type_handler *h;
Create_func *builder;
Item *item= NULL;
@@ -11394,8 +11362,12 @@ function_call_generic:
This will be revised with WL#2128 (SQL PATH)
*/
- builder= find_native_function_builder(thd, &$1);
- if (builder)
+ if ((h= Type_handler::handler_by_name(thd, $1)) &&
+ (item= h->make_constructor_item(thd, $4)))
+ {
+ // Found a constructor with a proper argument count
+ }
+ else if ((builder= find_native_function_builder(thd, &$1)))
{
item= builder->create_func(thd, &$1, $4);
}
@@ -11426,6 +11398,18 @@ function_call_generic:
if (unlikely(! ($$= item)))
MYSQL_YYABORT;
}
+ | CONTAINS_SYM '(' opt_expr_list ')'
+ {
+ if (!($$= Lex->make_item_func_call_native_or_parse_error(thd,
+ $1, $3)))
+ MYSQL_YYABORT;
+ }
+ | WITHIN '(' opt_expr_list ')'
+ {
+ if (!($$= Lex->make_item_func_call_native_or_parse_error(thd,
+ $1, $3)))
+ MYSQL_YYABORT;
+ }
| ident_cli '.' ident_cli '(' opt_expr_list ')'
{
if (unlikely(!($$= Lex->make_item_func_call_generic(thd, &$1, &$3, $5))))
@@ -11482,7 +11466,7 @@ udf_expr:
if ($4.str)
{
$2->is_autogenerated_name= FALSE;
- $2->set_name(thd, $4.str, $4.length, system_charset_info);
+ $2->set_name(thd, $4);
}
/*
A field has to have its proper name in order for name
@@ -11640,6 +11624,31 @@ sum_expr:
$5->empty();
sel->gorder_list.empty();
}
+ | JSON_ARRAYAGG_SYM '(' opt_distinct
+ { Select->in_sum_expr++; }
+ expr_list opt_glimit_clause
+ ')'
+ {
+ SELECT_LEX *sel= Select;
+ sel->in_sum_expr--;
+ String* s= new (thd->mem_root) String(",", 1, &my_charset_latin1);
+ if (unlikely(s == NULL))
+ MYSQL_YYABORT;
+
+ $$= new (thd->mem_root)
+ Item_func_json_arrayagg(thd, Lex->current_context(),
+ $3, $5,
+ sel->gorder_list, s, $6,
+ sel->select_limit,
+ sel->offset_limit);
+ if (unlikely($$ == NULL))
+ MYSQL_YYABORT;
+ sel->select_limit= NULL;
+ sel->offset_limit= NULL;
+ sel->explicit_limit= 0;
+ $5->empty();
+ sel->gorder_list.empty();
+ }
;
window_func_expr:
@@ -12028,12 +12037,27 @@ cast_type:
}
| cast_type_numeric { $$= $1; Lex->charset= NULL; }
| cast_type_temporal { $$= $1; Lex->charset= NULL; }
+ | IDENT_sys
+ {
+ if (Lex->set_cast_type_udt(&$$, $1))
+ MYSQL_YYABORT;
+ }
+ | reserved_keyword_udt
+ {
+ if (Lex->set_cast_type_udt(&$$, $1))
+ MYSQL_YYABORT;
+ }
+ | non_reserved_keyword_udt
+ {
+ if (Lex->set_cast_type_udt(&$$, $1))
+ MYSQL_YYABORT;
+ }
;
cast_type_numeric:
- INT_SYM { $$.set(&type_handler_longlong); }
- | SIGNED_SYM { $$.set(&type_handler_longlong); }
- | SIGNED_SYM INT_SYM { $$.set(&type_handler_longlong); }
+ INT_SYM { $$.set(&type_handler_slonglong); }
+ | SIGNED_SYM { $$.set(&type_handler_slonglong); }
+ | SIGNED_SYM INT_SYM { $$.set(&type_handler_slonglong); }
| UNSIGNED { $$.set(&type_handler_ulonglong); }
| UNSIGNED INT_SYM { $$.set(&type_handler_ulonglong); }
| DECIMAL_SYM float_options { $$.set(&type_handler_newdecimal, $2); }
@@ -13199,7 +13223,7 @@ procedure_clause:
lex->proc_list.next= &lex->proc_list.first;
Item_field *item= new (thd->mem_root)
Item_field(thd, &lex->current_select->context,
- NULL, NULL, &$2);
+ $2);
if (unlikely(item == NULL))
MYSQL_YYABORT;
if (unlikely(add_proc_to_list(thd, item)))
@@ -13966,6 +13990,7 @@ delete:
lex->first_select_lex()->order_list.empty();
}
delete_part2
+ { }
;
opt_delete_system_time:
@@ -14461,19 +14486,25 @@ show_param:
| ALL SLAVES STATUS_SYM
{
Lex->sql_command = SQLCOM_SHOW_SLAVE_STAT;
- Lex->verbose= 1;
+ if (!(Lex->m_sql_cmd= new (thd->mem_root)
+ Sql_cmd_show_slave_status(true)))
+ MYSQL_YYABORT;
}
| SLAVE STATUS_SYM
{
LEX *lex= thd->lex;
lex->mi.connection_name= null_clex_str;
lex->sql_command = SQLCOM_SHOW_SLAVE_STAT;
- lex->verbose= 0;
+ if (!(lex->m_sql_cmd= new (thd->mem_root)
+ Sql_cmd_show_slave_status()))
+ MYSQL_YYABORT;
}
| SLAVE connection_name STATUS_SYM
{
Lex->sql_command = SQLCOM_SHOW_SLAVE_STAT;
- Lex->verbose= 0;
+ if (!(Lex->m_sql_cmd= new (thd->mem_root)
+ Sql_cmd_show_slave_status()))
+ MYSQL_YYABORT;
}
| CREATE PROCEDURE_SYM sp_name
{
@@ -15429,8 +15460,8 @@ literal:
will include the introducer and the original hex/bin notation.
*/
item_str= new (thd->mem_root)
- Item_string_with_introducer(thd, NULL, $2->ptr(), $2->length(),
- $1);
+ Item_string_with_introducer(thd, null_clex_str,
+ $2->lex_cstring(), $1);
if (unlikely(!item_str ||
!item_str->check_well_formed_result(true)))
MYSQL_YYABORT;
@@ -15820,13 +15851,9 @@ ident_table_alias:
}
;
-ident_set_usual_case:
- IDENT_sys
- | keyword_set_usual_case
- {
- if (unlikely($$.copy_keyword(thd, &$1)))
- MYSQL_YYABORT;
- }
+ident_cli_set_usual_case:
+ IDENT_cli { $$= $1; }
+ | keyword_set_usual_case { $$= $1; }
;
ident_sysvar_name:
@@ -15863,6 +15890,12 @@ ident_directly_assignable:
;
+ident_cli_directly_assignable:
+ IDENT_cli
+ | keyword_directly_assignable { $$= $1; }
+ ;
+
+
label_ident:
IDENT_sys
| keyword_label
@@ -15955,6 +15988,7 @@ user: user_maybe_role
/* Keywords which we allow as table aliases. */
keyword_table_alias:
keyword_data_type
+ | keyword_cast_type
| keyword_set_special_case
| keyword_sp_block_section
| keyword_sp_head
@@ -15963,11 +15997,13 @@ keyword_table_alias:
| keyword_sysvar_type
| keyword_verb_clause
| FUNCTION_SYM
+ | EXCEPTION_ORACLE_SYM
;
/* Keyword that we allow for identifiers (except SP labels) */
keyword_ident:
keyword_data_type
+ | keyword_cast_type
| keyword_set_special_case
| keyword_sp_block_section
| keyword_sp_head
@@ -15977,6 +16013,7 @@ keyword_ident:
| keyword_verb_clause
| FUNCTION_SYM
| WINDOW_SYM
+ | EXCEPTION_ORACLE_SYM
;
/*
@@ -15990,10 +16027,12 @@ keyword_label:
| keyword_sysvar_type
| FUNCTION_SYM
| COMPRESSED_SYM
+ | EXCEPTION_ORACLE_SYM
;
keyword_sysvar_name:
keyword_data_type
+ | keyword_cast_type
| keyword_set_special_case
| keyword_sp_block_section
| keyword_sp_head
@@ -16002,6 +16041,7 @@ keyword_sysvar_name:
| keyword_verb_clause
| FUNCTION_SYM
| WINDOW_SYM
+ | EXCEPTION_ORACLE_SYM
;
keyword_sp_decl:
@@ -16016,6 +16056,7 @@ keyword_sp_decl:
keyword_set_usual_case:
keyword_data_type
+ | keyword_cast_type
| keyword_sp_block_section
| keyword_sp_head
| keyword_sp_var_and_label
@@ -16024,10 +16065,12 @@ keyword_set_usual_case:
| keyword_verb_clause
| FUNCTION_SYM
| WINDOW_SYM
+ | EXCEPTION_ORACLE_SYM
;
keyword_directly_assignable:
keyword_data_type
+ | keyword_cast_type
| keyword_set_special_case
| keyword_sp_var_and_label
| keyword_sp_var_not_label
@@ -16036,6 +16079,16 @@ keyword_directly_assignable:
| WINDOW_SYM
;
+non_reserved_keyword_udt:
+ keyword_sp_var_not_label
+ | keyword_sp_head
+ | keyword_verb_clause
+ | keyword_set_special_case
+ | keyword_sp_block_section
+ | keyword_sysvar_type
+ | keyword_sp_var_and_label
+ ;
+
/*
Keywords that we allow in Oracle-style direct assignments:
xxx := 10;
@@ -16085,7 +16138,6 @@ keyword_sp_var_not_label:
| RESTORE_SYM
| SECURITY_SYM
| SERVER_SYM
- | SIGNED_SYM
| SOCKET_SYM
| SLAVE
| SLAVES
@@ -16180,7 +16232,6 @@ keyword_set_special_case:
*/
keyword_sp_block_section:
BEGIN_ORACLE_SYM
- | EXCEPTION_ORACLE_SYM
| END
;
@@ -16205,21 +16256,13 @@ keyword_data_type:
| DATETIME
| ENUM
| FIXED_SYM
- | GEOMETRYCOLLECTION
- | GEOMETRY_SYM
| JSON_SYM
- | LINESTRING
| MEDIUM_SYM
- | MULTILINESTRING
- | MULTIPOINT
- | MULTIPOLYGON
| NATIONAL_SYM
| NCHAR_SYM
| NUMBER_MARIADB_SYM
| NUMBER_ORACLE_SYM
| NVARCHAR_SYM
- | POINT_SYM
- | POLYGON
| RAW_MARIADB_SYM
| RAW_ORACLE_SYM
| ROW_SYM
@@ -16233,6 +16276,11 @@ keyword_data_type:
;
+keyword_cast_type:
+ SIGNED_SYM
+ ;
+
+
/*
These keywords are fine for both SP variable names and SP labels.
*/
@@ -16559,6 +16607,249 @@ keyword_sp_var_and_label:
| VIA_SYM
;
+
+reserved_keyword_udt:
+ ACCESSIBLE_SYM
+ | ADD
+ | ALL
+ | ALTER
+ | ANALYZE_SYM
+ | AND_SYM
+ | AS
+ | ASC
+ | ASENSITIVE_SYM
+ | BEFORE_SYM
+ | BETWEEN_SYM
+ | BIT_AND
+ | BIT_OR
+ | BIT_XOR
+ | BODY_ORACLE_SYM
+ | BOTH
+ | BY
+ | CALL_SYM
+ | CASCADE
+ | CASE_SYM
+ | CAST_SYM
+ | CHANGE
+ | CHECK_SYM
+ | COLLATE_SYM
+ | CONSTRAINT
+ | CONTINUE_MARIADB_SYM
+ | CONTINUE_ORACLE_SYM
+ | CONVERT_SYM
+ | COUNT_SYM
+ | CREATE
+ | CROSS
+ | CUME_DIST_SYM
+ | CURDATE
+ | CURRENT_USER
+ | CURRENT_ROLE
+ | CURTIME
+ | DATABASE
+ | DATABASES
+ | DATE_ADD_INTERVAL
+ | DATE_SUB_INTERVAL
+ | DAY_HOUR_SYM
+ | DAY_MICROSECOND_SYM
+ | DAY_MINUTE_SYM
+ | DAY_SECOND_SYM
+ | DECLARE_MARIADB_SYM
+ | DECLARE_ORACLE_SYM
+ | DEFAULT
+ | DELETE_DOMAIN_ID_SYM
+ | DELETE_SYM
+ | DENSE_RANK_SYM
+ | DESC
+ | DESCRIBE
+ | DETERMINISTIC_SYM
+ | DISTINCT
+ | DIV_SYM
+ | DO_DOMAIN_IDS_SYM
+ | DROP
+ | DUAL_SYM
+ | EACH_SYM
+ | ELSE
+ | ELSEIF_MARIADB_SYM
+ | ELSIF_ORACLE_SYM
+ | ENCLOSED
+ | ESCAPED
+ | EXCEPT_SYM
+ | EXISTS
+ | EXTRACT_SYM
+ | FALSE_SYM
+ | FETCH_SYM
+ | FIRST_VALUE_SYM
+ | FOREIGN
+ | FROM
+ | FULLTEXT_SYM
+ | GOTO_ORACLE_SYM
+ | GRANT
+ | GROUP_SYM
+ | GROUP_CONCAT_SYM
+ | LAG_SYM
+ | LEAD_SYM
+ | HAVING
+ | HOUR_MICROSECOND_SYM
+ | HOUR_MINUTE_SYM
+ | HOUR_SECOND_SYM
+ | IF_SYM
+ | IGNORE_DOMAIN_IDS_SYM
+ | IGNORE_SYM
+ | INDEX_SYM
+ | INFILE
+ | INNER_SYM
+ | INOUT_SYM
+ | INSENSITIVE_SYM
+ | INSERT
+ | INTERSECT_SYM
+ | INTERVAL_SYM
+ | INTO
+ | IN_SYM
+ | IS
+ | ITERATE_SYM
+ | JOIN_SYM
+ | KEYS
+ | KEY_SYM
+ | KILL_SYM
+ | LEADING
+ | LEAVE_SYM
+ | LEFT
+ | LIKE
+ | LIMIT
+ | LINEAR_SYM
+ | LINES
+ | LOAD
+ | LOCATOR_SYM
+ | LOCK_SYM
+ | LOOP_SYM
+ | LOW_PRIORITY
+ | MASTER_SSL_VERIFY_SERVER_CERT_SYM
+ | MATCH
+ | MAX_SYM
+ | MAXVALUE_SYM
+ | MEDIAN_SYM
+ | MINUTE_MICROSECOND_SYM
+ | MINUTE_SECOND_SYM
+ | MIN_SYM
+ | MODIFIES_SYM
+ | MOD_SYM
+ | NATURAL
+ | NEG
+ | NOT_SYM
+ | NOW_SYM
+ | NO_WRITE_TO_BINLOG
+ | NTILE_SYM
+ | NULL_SYM
+ | NTH_VALUE_SYM
+ | ON
+ | OPTIMIZE
+ | OPTIONALLY
+ | ORDER_SYM
+ | OR_SYM
+ | OTHERS_ORACLE_SYM
+ | OUTER
+ | OUTFILE
+ | OUT_SYM
+ | OVER_SYM
+ | PACKAGE_ORACLE_SYM
+ | PAGE_CHECKSUM_SYM
+ | PARSE_VCOL_EXPR_SYM
+ | PARTITION_SYM
+ | PERCENT_RANK_SYM
+ | PERCENTILE_CONT_SYM
+ | PERCENTILE_DISC_SYM
+ | PORTION_SYM
+ | POSITION_SYM
+ | PRECISION
+ | PRIMARY_SYM
+ | PROCEDURE_SYM
+ | PURGE
+ | RAISE_ORACLE_SYM
+ | RANGE_SYM
+ | RANK_SYM
+ | READS_SYM
+ | READ_SYM
+ | READ_WRITE_SYM
+ | RECURSIVE_SYM
+ | REF_SYSTEM_ID_SYM
+ | REFERENCES
+ | REGEXP
+ | RELEASE_SYM
+ | RENAME
+ | REPEAT_SYM
+ | REPLACE
+ | REQUIRE_SYM
+ | RESIGNAL_SYM
+ | RESTRICT
+ | RETURNING_SYM
+ | RETURN_MARIADB_SYM
+ | RETURN_ORACLE_SYM
+ | REVOKE
+ | RIGHT
+ | ROWS_SYM
+ | ROWTYPE_ORACLE_SYM
+ | ROW_NUMBER_SYM
+ | SECOND_MICROSECOND_SYM
+ | SELECT_SYM
+ | SENSITIVE_SYM
+ | SEPARATOR_SYM
+ | SERVER_OPTIONS
+ | SHOW
+ | SIGNAL_SYM
+ | SPATIAL_SYM
+ | SPECIFIC_SYM
+ | SQLEXCEPTION_SYM
+ | SQLSTATE_SYM
+ | SQLWARNING_SYM
+ | SQL_BIG_RESULT
+ | SQL_SMALL_RESULT
+ | SQL_SYM
+ | SSL_SYM
+ | STARTING
+ | STATS_AUTO_RECALC_SYM
+ | STATS_PERSISTENT_SYM
+ | STATS_SAMPLE_PAGES_SYM
+ | STDDEV_SAMP_SYM
+ | STD_SYM
+ | STRAIGHT_JOIN
+ | SUBSTRING
+ | SUM_SYM
+ | SYSDATE
+ | TABLE_REF_PRIORITY
+ | TABLE_SYM
+ | TERMINATED
+ | THEN_SYM
+ | TO_SYM
+ | TRAILING
+ | TRIGGER_SYM
+ | TRIM
+ | TRUE_SYM
+ | UNDO_SYM
+ | UNION_SYM
+ | UNIQUE_SYM
+ | UNLOCK_SYM
+ | UPDATE_SYM
+ | USAGE
+ | USE_SYM
+ | USING
+ | UTC_DATE_SYM
+ | UTC_TIMESTAMP_SYM
+ | UTC_TIME_SYM
+ | VALUES
+ | VALUES_IN_SYM
+ | VALUES_LESS_SYM
+ | VARIANCE_SYM
+ | VARYING
+ | VAR_SAMP_SYM
+ | WHEN_SYM
+ | WHERE
+ | WHILE_SYM
+ | WITH
+ | XOR
+ | YEAR_MONTH_SYM
+ | ZEROFILL
+ ;
+
/*
SQLCOM_SET_OPTION statement.
@@ -16573,63 +16864,79 @@ set:
if (lex->main_select_push())
MYSQL_YYABORT;
lex->set_stmt_init();
- lex->var_list.empty();
- sp_create_assignment_lex(thd, yychar == YYEMPTY);
}
- start_option_value_list
+ set_param
{
Lex->pop_select(); //main select
if (Lex->check_main_unit_semantics())
MYSQL_YYABORT;
}
- | SET STATEMENT_SYM
+ ;
+
+set_param:
+ option_value_no_option_type
+ | option_value_no_option_type ',' option_value_list
+ | TRANSACTION_SYM
{
- if (Lex->main_select_push())
+ Lex->option_type= OPT_DEFAULT;
+ if (sp_create_assignment_lex(thd, $1.pos()))
MYSQL_YYABORT;
- Lex->set_stmt_init();
}
- set_stmt_option_value_following_option_type_list
+ transaction_characteristics
+ {
+ if (unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
+ MYSQL_YYABORT;
+ }
+ | option_type
+ {
+ Lex->option_type= $1;
+ }
+ start_option_value_list_following_option_type
+ | STATEMENT_SYM
+ set_stmt_option_list
{
LEX *lex= Lex;
if (unlikely(lex->table_or_sp_used()))
my_yyabort_error((ER_SUBQUERIES_NOT_SUPPORTED, MYF(0), "SET STATEMENT"));
lex->stmt_var_list= lex->var_list;
lex->var_list.empty();
- Lex->pop_select(); //main select
if (Lex->check_main_unit_semantics())
MYSQL_YYABORT;
}
FOR_SYM verb_clause
- {}
;
set_assign:
- ident_directly_assignable SET_VAR
+ ident_cli_directly_assignable SET_VAR
{
LEX *lex=Lex;
lex->set_stmt_init();
- lex->var_list.empty();
- sp_create_assignment_lex(thd, yychar == YYEMPTY);
+ if (sp_create_assignment_lex(thd, $1.pos()))
+ MYSQL_YYABORT;
}
set_expr_or_default
{
- if (unlikely(Lex->set_variable(&$1, $4)) ||
- unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
+ Lex_ident_sys tmp(thd, &$1);
+ if (unlikely(Lex->set_variable(&tmp, $4)) ||
+ unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY,
+ false)))
MYSQL_YYABORT;
}
- | ident_directly_assignable '.' ident SET_VAR
+ | ident_cli_directly_assignable '.' ident SET_VAR
{
LEX *lex=Lex;
lex->set_stmt_init();
- lex->var_list.empty();
- sp_create_assignment_lex(thd, yychar == YYEMPTY);
+ if (sp_create_assignment_lex(thd, $1.pos()))
+ MYSQL_YYABORT;
}
set_expr_or_default
{
LEX *lex= Lex;
DBUG_ASSERT(lex->var_list.is_empty());
- if (unlikely(lex->set_variable(&$1, &$3, $6)) ||
- unlikely(lex->sphead->restore_lex(thd)))
+ Lex_ident_sys tmp(thd, &$1);
+ if (unlikely(lex->set_variable(&tmp, &$3, $6)) ||
+ unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY,
+ false)))
MYSQL_YYABORT;
}
| COLON_ORACLE_SYM ident '.' ident SET_VAR
@@ -16641,93 +16948,49 @@ set_assign:
MYSQL_YYABORT;
}
lex->set_stmt_init();
- lex->var_list.empty();
- sp_create_assignment_lex(thd, yychar == YYEMPTY);
+ if (sp_create_assignment_lex(thd, $1.pos()))
+ MYSQL_YYABORT;
}
set_expr_or_default
{
LEX_CSTRING tmp= { $2.str, $2.length };
if (unlikely(Lex->set_trigger_field(&tmp, &$4, $7)) ||
- unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
+ unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY,
+ false)))
MYSQL_YYABORT;
}
;
-set_stmt_option_value_following_option_type_list:
+set_stmt_option_list:
/*
Only system variables can be used here. If this condition is changed
please check careful code under lex->option_type == OPT_STATEMENT
condition on wrong type casts.
*/
- option_value_following_option_type
- | set_stmt_option_value_following_option_type_list ',' option_value_following_option_type
+ set_stmt_option
+ | set_stmt_option_list ',' set_stmt_option
;
-/* Start of option value list */
-start_option_value_list:
- option_value_no_option_type
- {
- if (unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
- MYSQL_YYABORT;
- }
- option_value_list_continued
- | TRANSACTION_SYM
- {
- Lex->option_type= OPT_DEFAULT;
- }
- transaction_characteristics
- {
- if (unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
- MYSQL_YYABORT;
- }
- | option_type
- {
- Lex->option_type= $1;
- }
- start_option_value_list_following_option_type
- ;
-
-
/* Start of option value list, option_type was given */
start_option_value_list_following_option_type:
option_value_following_option_type
+ | option_value_following_option_type ',' option_value_list
+ | TRANSACTION_SYM
{
- if (unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
+ if (sp_create_assignment_lex(thd, $1.pos()))
MYSQL_YYABORT;
}
- option_value_list_continued
- | TRANSACTION_SYM transaction_characteristics
+ transaction_characteristics
{
if (unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
MYSQL_YYABORT;
}
;
-/* Remainder of the option value list after first option value. */
-option_value_list_continued:
- /* empty */
- | ',' option_value_list
- ;
-
/* Repeating list of option values after first option value. */
option_value_list:
- {
- sp_create_assignment_lex(thd, yychar == YYEMPTY);
- }
- option_value
- {
- if (unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
- MYSQL_YYABORT;
- }
- | option_value_list ','
- {
- sp_create_assignment_lex(thd, yychar == YYEMPTY);
- }
option_value
- {
- if (unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
- MYSQL_YYABORT;
- }
+ | option_value_list ',' option_value
;
/* Wrapper around option values following the first option value in the stmt. */
@@ -16760,16 +17023,21 @@ opt_var_ident_type:
| SESSION_SYM '.' { $$=OPT_SESSION; }
;
-/* Option values with preceding option_type. */
-option_value_following_option_type:
- ident equal set_expr_or_default
+/*
+ SET STATEMENT options do not need their own LEX or Query_arena.
+ Let's put them to the main ones.
+*/
+set_stmt_option:
+ ident_cli equal set_expr_or_default
{
- if (unlikely(Lex->set_system_variable(Lex->option_type, &$1, $3)))
+ Lex_ident_sys tmp(thd, &$1);
+ if (unlikely(Lex->set_system_variable(Lex->option_type, &tmp, $3)))
MYSQL_YYABORT;
}
- | ident '.' ident equal set_expr_or_default
+ | ident_cli '.' ident equal set_expr_or_default
{
- if (unlikely(Lex->set_system_variable(thd, Lex->option_type, &$1, &$3, $5)))
+ Lex_ident_sys tmp(thd, &$1);
+ if (unlikely(Lex->set_system_variable(thd, Lex->option_type, &tmp, &$3, $5)))
MYSQL_YYABORT;
}
| DEFAULT '.' ident equal set_expr_or_default
@@ -16779,45 +17047,132 @@ option_value_following_option_type:
}
;
+
+/* Option values with preceding option_type. */
+option_value_following_option_type:
+ ident_cli equal
+ {
+ if (sp_create_assignment_lex(thd, $1.pos()))
+ MYSQL_YYABORT;
+ }
+ set_expr_or_default
+ {
+ Lex_ident_sys tmp(thd, &$1);
+ if (unlikely(Lex->set_system_variable(Lex->option_type, &tmp, $4)) ||
+ unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
+ MYSQL_YYABORT;
+ }
+ | ident_cli '.' ident equal
+ {
+ if (sp_create_assignment_lex(thd, $1.pos()))
+ MYSQL_YYABORT;
+ }
+ set_expr_or_default
+ {
+ Lex_ident_sys tmp(thd, &$1);
+ if (unlikely(Lex->set_system_variable(thd, Lex->option_type, &tmp, &$3, $6)) ||
+ unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
+ MYSQL_YYABORT;
+ }
+ | DEFAULT '.' ident equal
+ {
+ if (sp_create_assignment_lex(thd, $1.pos()))
+ MYSQL_YYABORT;
+ }
+ set_expr_or_default
+ {
+ if (unlikely(Lex->set_default_system_variable(Lex->option_type, &$3, $6)) ||
+ unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
+ MYSQL_YYABORT;
+ }
+ ;
+
/* Option values without preceding option_type. */
option_value_no_option_type:
- ident_set_usual_case equal set_expr_or_default
+ ident_cli_set_usual_case equal
{
- if (unlikely(Lex->set_variable(&$1, $3)))
+ if (sp_create_assignment_lex(thd, $1.pos()))
MYSQL_YYABORT;
}
- | ident '.' ident equal set_expr_or_default
+ set_expr_or_default
{
- if (unlikely(Lex->set_variable(&$1, &$3, $5)))
+ Lex_ident_sys tmp(thd, &$1);
+ if (unlikely(Lex->set_variable(&tmp, $4)) ||
+ unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
MYSQL_YYABORT;
}
- | DEFAULT '.' ident equal set_expr_or_default
+ | ident_cli_set_usual_case '.' ident equal
{
- if (unlikely(Lex->set_default_system_variable(Lex->option_type, &$3, $5)))
+ if (sp_create_assignment_lex(thd, $1.pos()))
+ MYSQL_YYABORT;
+ }
+ set_expr_or_default
+ {
+ Lex_ident_sys tmp(thd, &$1);
+ if (unlikely(Lex->set_variable(&tmp, &$3, $6)) ||
+ unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
+ MYSQL_YYABORT;
+ }
+ | DEFAULT '.' ident equal
+ {
+ if (sp_create_assignment_lex(thd, $1.pos()))
+ MYSQL_YYABORT;
+ }
+ set_expr_or_default
+ {
+ if (unlikely(Lex->set_default_system_variable(Lex->option_type, &$3, $6)))
+ MYSQL_YYABORT;
+ if (unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
+ MYSQL_YYABORT;
+ }
+ | '@' ident_or_text equal
+ {
+ if (sp_create_assignment_lex(thd, $1.str))
+ MYSQL_YYABORT;
+ }
+ expr
+ {
+ if (unlikely(Lex->set_user_variable(thd, &$2, $5)) ||
+ unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
+ MYSQL_YYABORT;
+ }
+ | '@' '@' opt_var_ident_type ident_sysvar_name equal
+ {
+ if (sp_create_assignment_lex(thd, $1.str))
MYSQL_YYABORT;
}
- | '@' ident_or_text equal expr
+ set_expr_or_default
{
- if (unlikely(Lex->set_user_variable(thd, &$2, $4)))
+ if (unlikely(Lex->set_system_variable($3, &$4, $7)) ||
+ unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
MYSQL_YYABORT;
}
- | '@' '@' opt_var_ident_type ident_sysvar_name equal set_expr_or_default
+ | '@' '@' opt_var_ident_type ident_sysvar_name '.' ident equal
{
- if (unlikely(Lex->set_system_variable($3, &$4, $6)))
+ if (sp_create_assignment_lex(thd, $1.str))
MYSQL_YYABORT;
}
- | '@' '@' opt_var_ident_type ident_sysvar_name '.' ident equal set_expr_or_default
+ set_expr_or_default
{
- if (unlikely(Lex->set_system_variable(thd, $3, &$4, &$6, $8)))
+ if (unlikely(Lex->set_system_variable(thd, $3, &$4, &$6, $9)) ||
+ unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
MYSQL_YYABORT;
}
- | '@' '@' opt_var_ident_type DEFAULT '.' ident equal set_expr_or_default
+ | '@' '@' opt_var_ident_type DEFAULT '.' ident equal
{
- if (unlikely(Lex->set_default_system_variable($3, &$6, $8)))
+ if (sp_create_assignment_lex(thd, $1.str))
+ MYSQL_YYABORT;
+ }
+ set_expr_or_default
+ {
+ if (unlikely(Lex->set_default_system_variable($3, &$6, $9)) ||
+ unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
MYSQL_YYABORT;
}
| charset old_or_new_charset_name_or_default
{
+ if (sp_create_assignment_lex(thd, $1.pos()))
+ MYSQL_YYABORT;
LEX *lex= thd->lex;
CHARSET_INFO *cs2;
cs2= $2 ? $2: global_system_variables.character_set_client;
@@ -16829,6 +17184,8 @@ option_value_no_option_type:
if (unlikely(var == NULL))
MYSQL_YYABORT;
lex->var_list.push_back(var, thd->mem_root);
+ if (unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
+ MYSQL_YYABORT;
}
| NAMES_SYM equal expr
{
@@ -16843,6 +17200,8 @@ option_value_no_option_type:
}
| NAMES_SYM charset_name_or_default opt_collate
{
+ if (sp_create_assignment_lex(thd, $1.pos()))
+ MYSQL_YYABORT;
LEX *lex= Lex;
CHARSET_INFO *cs2;
CHARSET_INFO *cs3;
@@ -16857,11 +17216,14 @@ option_value_no_option_type:
set_var_collation_client *var;
var= new (thd->mem_root) set_var_collation_client(cs3, cs3, cs3);
if (unlikely(var == NULL) ||
- unlikely(lex->var_list.push_back(var, thd->mem_root)))
+ unlikely(lex->var_list.push_back(var, thd->mem_root)) ||
+ unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
MYSQL_YYABORT;
}
| DEFAULT ROLE_SYM grant_role
{
+ if (sp_create_assignment_lex(thd, $1.pos()))
+ MYSQL_YYABORT;
LEX *lex = Lex;
LEX_USER *user;
if (unlikely(!(user=(LEX_USER *) thd->calloc(sizeof(LEX_USER)))))
@@ -16877,9 +17239,13 @@ option_value_no_option_type:
thd->lex->autocommit= TRUE;
if (lex->sphead)
lex->sphead->m_flags|= sp_head::HAS_SET_AUTOCOMMIT_STMT;
+ if (unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
+ MYSQL_YYABORT;
}
| DEFAULT ROLE_SYM grant_role FOR_SYM user
{
+ if (sp_create_assignment_lex(thd, $1.pos()))
+ MYSQL_YYABORT;
LEX *lex = Lex;
set_var_default_role *var= (new (thd->mem_root)
set_var_default_role($5, $3->user));
@@ -16889,22 +17255,36 @@ option_value_no_option_type:
thd->lex->autocommit= TRUE;
if (lex->sphead)
lex->sphead->m_flags|= sp_head::HAS_SET_AUTOCOMMIT_STMT;
+ if (unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
+ MYSQL_YYABORT;
}
| ROLE_SYM ident_or_text
{
+ if (sp_create_assignment_lex(thd, $1.pos()))
+ MYSQL_YYABORT;
LEX *lex = Lex;
set_var_role *var= new (thd->mem_root) set_var_role($2);
if (unlikely(var == NULL) ||
- unlikely(lex->var_list.push_back(var, thd->mem_root)))
+ unlikely(lex->var_list.push_back(var, thd->mem_root)) ||
+ unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
MYSQL_YYABORT;
}
- | ROLE_SYM equal set_expr_or_default
+ | ROLE_SYM equal
{
- if (unlikely(Lex->set_variable(&$1, $3)))
+ if (sp_create_assignment_lex(thd, $1.pos()))
+ MYSQL_YYABORT;
+ }
+ set_expr_or_default
+ {
+ Lex_ident_sys tmp(thd, &$1);
+ if (unlikely(Lex->set_variable(&tmp, $4)) ||
+ unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
MYSQL_YYABORT;
}
| PASSWORD_SYM opt_for_user text_or_password
{
+ if (sp_create_assignment_lex(thd, $1.pos()))
+ MYSQL_YYABORT;
LEX *lex = Lex;
set_var_password *var= (new (thd->mem_root)
set_var_password(lex->definer));
@@ -16914,6 +17294,8 @@ option_value_no_option_type:
lex->autocommit= TRUE;
if (lex->sphead)
lex->sphead->m_flags|= sp_head::HAS_SET_AUTOCOMMIT_STMT;
+ if (unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
+ MYSQL_YYABORT;
}
;
diff --git a/sql/strfunc.cc b/sql/strfunc.cc
index 99ff9c50588..61f6078c875 100644
--- a/sql/strfunc.cc
+++ b/sql/strfunc.cc
@@ -45,7 +45,8 @@
static const char field_separator=',';
-ulonglong find_set(TYPELIB *lib, const char *str, size_t length, CHARSET_INFO *cs,
+ulonglong find_set(const TYPELIB *lib,
+ const char *str, size_t length, CHARSET_INFO *cs,
char **err_pos, uint *err_len, bool *set_warning)
{
CHARSET_INFO *strip= cs ? cs : &my_charset_latin1;
diff --git a/sql/strfunc.h b/sql/strfunc.h
index d66d4c63444..b2b293e153f 100644
--- a/sql/strfunc.h
+++ b/sql/strfunc.h
@@ -18,7 +18,8 @@
typedef struct st_typelib TYPELIB;
-ulonglong find_set(TYPELIB *lib, const char *x, size_t length, CHARSET_INFO *cs,
+ulonglong find_set(const TYPELIB *lib,
+ const char *x, size_t length, CHARSET_INFO *cs,
char **err_pos, uint *err_len, bool *set_warning);
ulonglong find_set_from_flags(TYPELIB *lib, uint default_name,
ulonglong cur_set, ulonglong default_set,
diff --git a/sql/structs.h b/sql/structs.h
index 0c00aeec33a..f6d63051dfe 100644
--- a/sql/structs.h
+++ b/sql/structs.h
@@ -618,6 +618,8 @@ public:
m_handler= handler;
Lex_length_and_dec_st::operator=(length_and_dec);
}
+ void set_handler_length_flags(const Type_handler *handler, const char *length,
+ uint32 flags);
void set(const Type_handler *handler, const char *length)
{
set(handler, length, 0);
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index f01757f6163..ff92b042ccc 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -2320,18 +2320,6 @@ static Sys_var_ulong Sys_max_length_for_sort_data(
SESSION_VAR(max_length_for_sort_data), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(4, 8192*1024L), DEFAULT(1024), BLOCK_SIZE(1));
-static Sys_var_ulong Sys_max_long_data_size(
- "max_long_data_size",
- "The maximum BLOB length to send to server from "
- "mysql_send_long_data API. Deprecated option; "
- "use max_allowed_packet instead.",
- READ_ONLY GLOBAL_VAR(max_long_data_size),
- CMD_LINE(REQUIRED_ARG, OPT_MAX_LONG_DATA_SIZE),
- VALID_RANGE(1024, UINT_MAX32), DEFAULT(1024*1024),
- BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG,
- ON_CHECK(0), ON_UPDATE(0),
- DEPRECATED("'@@max_allowed_packet'"));
-
static PolyLock_mutex PLock_prepared_stmt_count(&LOCK_prepared_stmt_count);
static Sys_var_uint Sys_max_prepared_stmt_count(
"max_prepared_stmt_count",
@@ -2598,6 +2586,7 @@ export const char *optimizer_switch_names[]=
"condition_pushdown_for_subquery",
"rowid_filter",
"condition_pushdown_from_having",
+ "not_null_range_scan",
"default",
NullS
};
@@ -3764,7 +3753,7 @@ static Sys_var_uint Sys_threadpool_stall_limit(
"If a worker thread is stalled, additional worker thread "
"may be created to handle remaining clients.",
GLOBAL_VAR(threadpool_stall_limit), CMD_LINE(REQUIRED_ARG),
- VALID_RANGE(10, UINT_MAX), DEFAULT(500), BLOCK_SIZE(1),
+ VALID_RANGE(1, UINT_MAX), DEFAULT(DEFAULT_THREADPOOL_STALL_LIMIT), BLOCK_SIZE(1),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_threadpool_stall_limit)
);
@@ -3784,6 +3773,20 @@ static Sys_var_uint Sys_threadpool_threadpool_prio_kickup_timer(
GLOBAL_VAR(threadpool_prio_kickup_timer), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, UINT_MAX), DEFAULT(1000), BLOCK_SIZE(1)
);
+
+static Sys_var_mybool Sys_threadpool_exact_stats(
+ "thread_pool_exact_stats",
+ "If set to 1, provides better statistics in information_schema threadpool tables",
+ GLOBAL_VAR(threadpool_exact_stats), CMD_LINE(OPT_ARG), DEFAULT(FALSE),
+ NO_MUTEX_GUARD, NOT_IN_BINLOG
+);
+
+static Sys_var_mybool Sys_threadpool_dedicated_listener(
+ "thread_pool_dedicated_listener",
+ "If set to 1,listener thread will not pick up queries",
+ GLOBAL_VAR(threadpool_dedicated_listener), CMD_LINE(OPT_ARG), DEFAULT(FALSE),
+ NO_MUTEX_GUARD, NOT_IN_BINLOG
+);
#endif /* HAVE_POOL_OF_THREADS */
/**
@@ -3866,7 +3869,7 @@ static Sys_var_ulonglong Sys_tmp_table_size(
"If an internal in-memory temporary table exceeds this size, MariaDB "
"will automatically convert it to an on-disk MyISAM or Aria table.",
SESSION_VAR(tmp_memory_table_size), CMD_LINE(REQUIRED_ARG),
- VALID_RANGE(1024, (ulonglong)~(intptr)0), DEFAULT(16*1024*1024),
+ VALID_RANGE(0, (ulonglong)~(intptr)0), DEFAULT(16*1024*1024),
BLOCK_SIZE(1));
static Sys_var_ulonglong Sys_tmp_memory_table_size(
@@ -3875,7 +3878,7 @@ static Sys_var_ulonglong Sys_tmp_memory_table_size(
"will automatically convert it to an on-disk MyISAM or Aria table. "
"Same as tmp_table_size.",
SESSION_VAR(tmp_memory_table_size), CMD_LINE(REQUIRED_ARG),
- VALID_RANGE(1024, (ulonglong)~(intptr)0), DEFAULT(16*1024*1024),
+ VALID_RANGE(0, (ulonglong)~(intptr)0), DEFAULT(16*1024*1024),
BLOCK_SIZE(1));
static Sys_var_ulonglong Sys_tmp_disk_table_size(
@@ -4157,9 +4160,10 @@ export sys_var *Sys_autocommit_ptr= &Sys_autocommit; // for sql_yacc.yy
static Sys_var_mybool Sys_big_tables(
"big_tables", "Old variable, which if set to 1, allows large result sets "
"by saving all temporary sets to disk, avoiding 'table full' errors. No "
- "longer needed, as the server now handles this automatically. "
- "sql_big_tables is a synonym.",
- SESSION_VAR(big_tables), CMD_LINE(OPT_ARG), DEFAULT(FALSE));
+ "longer needed, as the server now handles this automatically.",
+ SESSION_VAR(big_tables), CMD_LINE(OPT_ARG), DEFAULT(FALSE),
+ NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(0),
+ DEPRECATED(""));
static Sys_var_bit Sys_big_selects(
"sql_big_selects", "If set to 0, MariaDB will not perform large SELECTs."
@@ -4817,6 +4821,16 @@ static Sys_var_have Sys_have_symlink(
"--skip-symbolic-links option.",
READ_ONLY GLOBAL_VAR(have_symlink), NO_CMD_LINE);
+#ifdef __SANITIZE_ADDRESS__
+static char *have_sanitizer;
+static Sys_var_charptr Sys_have_santitizer(
+ "have_sanitizer",
+ "If the server is compiled with ASan (Address sanitizer) this will be "
+ "set to ASAN",
+ READ_ONLY GLOBAL_VAR(have_sanitizer), NO_CMD_LINE,
+ IN_FS_CHARSET, DEFAULT("ASAN"));
+#endif
+
static bool fix_log_state(sys_var *self, THD *thd, enum_var_type type);
static Sys_var_mybool Sys_general_log(
@@ -6184,6 +6198,19 @@ static Sys_var_enum Sys_binlog_row_image(
SESSION_VAR(binlog_row_image), CMD_LINE(REQUIRED_ARG),
binlog_row_image_names, DEFAULT(BINLOG_ROW_IMAGE_FULL));
+static const char *binlog_row_metadata_names[]= {"NO_LOG", "MINIMAL", "FULL", NullS};
+static Sys_var_enum Sys_binlog_row_metadata(
+ "binlog_row_metadata",
+ "Controls whether metadata is logged using FULL , MINIMAL format and NO_LOG."
+ "FULL causes all metadata to be logged; MINIMAL means that only "
+ "metadata actually required by slave is logged; NO_LOG NO metadata will be logged."
+ "Default: NO_LOG.",
+ GLOBAL_VAR(binlog_row_metadata), CMD_LINE(REQUIRED_ARG),
+ binlog_row_metadata_names, DEFAULT(Table_map_log_event::BINLOG_ROW_METADATA_NO_LOG),
+ 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)
{
longlong previous_val= thd->variables.pseudo_slave_mode;
@@ -6340,6 +6367,22 @@ static Sys_var_mybool Sys_session_track_state_change(
ON_CHECK(0),
ON_UPDATE(update_session_track_state_change));
+
+static bool update_session_track_user_variables(sys_var *self, THD *thd,
+ enum_var_type type)
+{
+ return thd->session_tracker.user_variables.update(thd, 0);
+}
+
+static Sys_var_mybool Sys_session_track_user_variables(
+ "session_track_user_variables",
+ "Track changes to user variables.",
+ SESSION_VAR(session_track_user_variables),
+ CMD_LINE(OPT_ARG), DEFAULT(FALSE),
+ NO_MUTEX_GUARD, NOT_IN_BINLOG,
+ ON_CHECK(0),
+ ON_UPDATE(update_session_track_user_variables));
+
#endif //EMBEDDED_LIBRARY
static Sys_var_uint Sys_in_subquery_conversion_threshold(
diff --git a/sql/table.cc b/sql/table.cc
index 663a65d321a..8dc4cc5e9a0 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -59,6 +59,7 @@ struct extra2_fields
LEX_CUSTRING field_flags;
LEX_CUSTRING system_period;
LEX_CUSTRING application_period;
+ LEX_CUSTRING field_data_type_info;
void reset()
{ bzero((void*)this, sizeof(*this)); }
};
@@ -966,6 +967,38 @@ void Column_definition_attributes::frm_unpack_basic(const uchar *buff)
}
+void Column_definition_attributes::frm_pack_numeric_with_dec(uchar *buff) const
+{
+ DBUG_ASSERT(f_decimals(pack_flag) == 0);
+ uint tmp_pack_flag= pack_flag | (decimals << FIELDFLAG_DEC_SHIFT);
+ int2store(buff + 3, length);
+ int2store(buff + 8, tmp_pack_flag);
+ buff[10]= (uchar) unireg_check;
+}
+
+
+bool
+Column_definition_attributes::frm_unpack_numeric_with_dec(TABLE_SHARE *share,
+ const uchar *buff)
+{
+ frm_unpack_basic(buff);
+ decimals= f_decimals(pack_flag);
+ pack_flag&= ~FIELDFLAG_DEC_MASK;
+ return frm_unpack_charset(share, buff);
+}
+
+
+bool
+Column_definition_attributes::frm_unpack_temporal_with_dec(TABLE_SHARE *share,
+ uint intlen,
+ const uchar *buff)
+{
+ frm_unpack_basic(buff);
+ decimals= temporal_dec(intlen);
+ return frm_unpack_charset(share, buff);
+}
+
+
void Column_definition_attributes::frm_pack_charset(uchar *buff) const
{
buff[11]= (uchar) (charset->number >> 8);
@@ -1079,7 +1112,6 @@ bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table,
Field **vfield_ptr= table->vfield;
Field **dfield_ptr= table->default_field;
Virtual_column_info **check_constraint_ptr= table->check_constraints;
- sql_mode_t saved_mode= thd->variables.sql_mode;
Query_arena backup_arena;
Virtual_column_info *vcol= 0;
StringBuffer<MAX_FIELD_WIDTH> expr_str;
@@ -1105,7 +1137,7 @@ bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table,
thd->stmt_arena= table->expr_arena;
thd->update_charset(&my_charset_utf8mb4_general_ci, table->s->table_charset);
expr_str.append(&parse_vcol_keyword);
- thd->variables.sql_mode &= ~MODE_NO_BACKSLASH_ESCAPES;
+ Sql_mode_instant_remove sms(thd, MODE_NO_BACKSLASH_ESCAPES);
while (pos < end)
{
@@ -1288,7 +1320,6 @@ end:
thd->stmt_arena= backup_stmt_arena_ptr;
if (save_character_set_client)
thd->update_charset(save_character_set_client, save_collation);
- thd->variables.sql_mode= saved_mode;
DBUG_RETURN(res);
}
@@ -1527,6 +1558,12 @@ bool read_extra2(const uchar *frm_image, size_t len, extra2_fields *fields)
fields->application_period.str= extra2;
fields->application_period.length= length;
break;
+ case EXTRA2_FIELD_DATA_TYPE_INFO:
+ if (fields->field_data_type_info.str)
+ DBUG_RETURN(true);
+ fields->field_data_type_info.str= extra2;
+ fields->field_data_type_info.length= length;
+ break;
default:
/* abort frm parsing if it's an unknown but important extra2 value */
if (type >= EXTRA2_ENGINE_IMPORTANT)
@@ -1541,6 +1578,86 @@ bool read_extra2(const uchar *frm_image, size_t len, extra2_fields *fields)
}
+class Field_data_type_info_array
+{
+public:
+ class Elem
+ {
+ LEX_CSTRING m_type_info;
+ public:
+ void set(const LEX_CSTRING &type_info)
+ {
+ m_type_info= type_info;
+ }
+ const LEX_CSTRING &type_info() const
+ {
+ return m_type_info;
+ }
+ };
+private:
+ Elem *m_array;
+ uint m_count;
+ bool alloc(MEM_ROOT *root, uint count)
+ {
+ DBUG_ASSERT(!m_array);
+ DBUG_ASSERT(!m_count);
+ size_t nbytes= sizeof(Elem) * count;
+ if (!(m_array= (Elem*) alloc_root(root, nbytes)))
+ return true;
+ m_count= count;
+ bzero((void*) m_array, nbytes);
+ return false;
+ }
+ static uint32 read_length(uchar **pos, const uchar *end)
+ {
+ ulonglong num= safe_net_field_length_ll(pos, end - *pos);
+ if (num > UINT_MAX32)
+ return 0;
+ return (uint32) num;
+ }
+ static bool read_string(LEX_CSTRING *to, uchar **pos, const uchar *end)
+ {
+ to->length= read_length(pos, end);
+ if (*pos + to->length > end)
+ return true; // Not enough data
+ to->str= (const char *) *pos;
+ *pos+= to->length;
+ return false;
+ }
+public:
+ Field_data_type_info_array()
+ :m_array(NULL), m_count(0)
+ { }
+ uint count() const
+ {
+ return m_count;
+ }
+ const Elem& element(uint i) const
+ {
+ DBUG_ASSERT(i < m_count);
+ return m_array[i];
+ }
+ bool parse(MEM_ROOT *root, uint count, LEX_CUSTRING &image)
+ {
+ const uchar *pos= image.str;
+ const uchar *end= pos + image.length;
+ if (alloc(root, count))
+ return true;
+ for (uint i= 0; i < count && pos < end; i++)
+ {
+ LEX_CSTRING type_info;
+ uint fieldnr= read_length((uchar**) &pos, end);
+ if ((fieldnr == 0 && i > 0) || fieldnr >= count)
+ return true; // Bad data
+ if (read_string(&type_info, (uchar**) &pos, end) || type_info.length == 0)
+ return true; // Bad data
+ m_array[fieldnr].set(type_info);
+ }
+ return pos < end; // Error if some data is still left
+ }
+};
+
+
/**
Read data from a binary .frm file image into a TABLE_SHARE
@@ -1591,6 +1708,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
uint ext_key_parts= 0;
plugin_ref se_plugin= 0;
bool vers_can_native= false;
+ Field_data_type_info_array field_data_type_info_array;
MEM_ROOT *old_root= thd->mem_root;
Virtual_column_info **table_check_constraints;
@@ -1786,7 +1904,8 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
name.length= str_db_type_length;
plugin_ref tmp_plugin= ha_resolve_by_name(thd, &name, false);
- if (tmp_plugin != NULL && !plugin_equals(tmp_plugin, se_plugin))
+ if (tmp_plugin != NULL && !plugin_equals(tmp_plugin, se_plugin) &&
+ legacy_db_type != DB_TYPE_S3)
{
if (se_plugin)
{
@@ -2129,6 +2248,11 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
status_var_increment(thd->status_var.feature_application_time_periods);
}
+ if (extra2.field_data_type_info.length &&
+ field_data_type_info_array.parse(old_root, share->fields,
+ extra2.field_data_type_info))
+ goto err;
+
for (i=0 ; i < share->fields; i++, strpos+=field_pack_length, field_ptr++)
{
uint interval_nr= 0, recpos;
@@ -2208,10 +2332,41 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
enum_field_types field_type= (enum_field_types) strpos[13];
if (!(handler= Type_handler::get_handler_by_real_type(field_type)))
goto err; // Not supported field type
+ handler= handler->type_handler_frm_unpack(strpos);
if (handler->Column_definition_attributes_frm_unpack(&attr, share,
strpos,
&extra2.gis))
goto err;
+
+ if (field_data_type_info_array.count())
+ {
+ const LEX_CSTRING &info= field_data_type_info_array.
+ element(i).type_info();
+ DBUG_EXECUTE_IF("frm_data_type_info",
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
+ ER_UNKNOWN_ERROR, "DBUG: [%u] name='%s' type_info='%.*s'",
+ i, share->fieldnames.type_names[i],
+ (uint) info.length, info.str););
+
+ if (info.length)
+ {
+ const Type_handler *h= Type_handler::handler_by_name_or_error(thd,
+ info);
+ /*
+ This code will eventually be extended here:
+ - If the handler was not found by name, we could
+ still open the table using the fallback type handler "handler",
+ at least for a limited set of commands.
+ - If the handler was found by name, we could check
+ that "h" and "handler" have the same type code
+ (and maybe some other properties) to make sure
+ that the FRM data is consistent.
+ */
+ if (!h)
+ goto err;
+ handler= h;
+ }
+ }
}
if (((uint) strpos[10]) & MYSQL57_GENERATED_FIELD)
@@ -2243,6 +2398,11 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
attr.length= (uint) strpos[3];
recpos= uint2korr(strpos+4),
attr.pack_flag= uint2korr(strpos+6);
+ if (f_is_num(attr.pack_flag))
+ {
+ attr.decimals= f_decimals(attr.pack_flag);
+ attr.pack_flag&= ~FIELDFLAG_DEC_MASK;
+ }
attr.pack_flag&= ~FIELDFLAG_NO_DEFAULT; // Safety for old files
attr.unireg_check= (Field::utype) MTYP_TYPENR((uint) strpos[8]);
interval_nr= (uint) strpos[10];
@@ -2571,7 +2731,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
KEY_PART_INFO *new_key_part= (keyinfo-1)->key_part +
(keyinfo-1)->ext_key_parts;
uint add_keyparts_for_this_key= add_first_key_parts;
- uint length_bytes= 0, len_null_byte= 0, ext_key_length= 0;
+ uint len_null_byte= 0, ext_key_length= 0;
Field *field;
if ((keyinfo-1)->algorithm == HA_KEY_ALG_LONG_HASH)
@@ -2583,19 +2743,15 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
*/
for (i= 0; i < keyinfo->user_defined_key_parts; i++)
{
+ uint length_bytes= 0;
uint fieldnr= keyinfo->key_part[i].fieldnr;
field= share->field[fieldnr-1];
if (field->null_ptr)
len_null_byte= HA_KEY_NULL_LENGTH;
- if ((field->type() == MYSQL_TYPE_BLOB ||
- field->real_type() == MYSQL_TYPE_VARCHAR ||
- field->type() == MYSQL_TYPE_GEOMETRY) &&
- keyinfo->algorithm != HA_KEY_ALG_LONG_HASH )
- {
- length_bytes= HA_KEY_BLOB_LENGTH;
- }
+ if (keyinfo->algorithm != HA_KEY_ALG_LONG_HASH)
+ length_bytes= field->key_part_length_bytes();
ext_key_length+= keyinfo->key_part[i].length + len_null_byte
+ length_bytes;
@@ -2684,20 +2840,11 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
keyinfo->flags|=HA_NULL_PART_KEY;
keyinfo->key_length+= HA_KEY_NULL_LENGTH;
}
- if (field->type() == MYSQL_TYPE_BLOB ||
- field->real_type() == MYSQL_TYPE_VARCHAR ||
- field->type() == MYSQL_TYPE_GEOMETRY)
- {
- if (field->type() == MYSQL_TYPE_BLOB ||
- field->type() == MYSQL_TYPE_GEOMETRY)
- key_part->key_part_flag|= HA_BLOB_PART;
- else
- key_part->key_part_flag|= HA_VAR_LENGTH_PART;
- key_part->store_length+=HA_KEY_BLOB_LENGTH;
- keyinfo->key_length+= HA_KEY_BLOB_LENGTH;
- }
- if (field->type() == MYSQL_TYPE_BIT)
- key_part->key_part_flag|= HA_BIT_PART;
+
+ key_part->key_part_flag|= field->key_part_flag();
+ uint16 key_part_length_bytes= field->key_part_length_bytes();
+ key_part->store_length+= key_part_length_bytes;
+ keyinfo->key_length+= key_part_length_bytes;
if (i == 0 && key != primary_key)
field->flags |= (((keyinfo->flags & HA_NOSAME ||
@@ -3092,7 +3239,6 @@ static bool sql_unusable_for_discovery(THD *thd, handlerton *engine,
int TABLE_SHARE::init_from_sql_statement_string(THD *thd, bool write,
const char *sql, size_t sql_length)
{
- sql_mode_t saved_mode= thd->variables.sql_mode;
CHARSET_INFO *old_cs= thd->variables.character_set_client;
Parser_state parser_state;
bool error;
@@ -3120,7 +3266,7 @@ int TABLE_SHARE::init_from_sql_statement_string(THD *thd, bool write,
if (parser_state.init(thd, sql_copy, sql_length))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- thd->variables.sql_mode= MODE_NO_ENGINE_SUBSTITUTION | MODE_NO_DIR_IN_CREATE;
+ Sql_mode_instant_set sms(thd, MODE_NO_ENGINE_SUBSTITUTION | MODE_NO_DIR_IN_CREATE);
thd->variables.character_set_client= system_charset_info;
tmp_disable_binlog(thd);
old_lex= thd->lex;
@@ -3169,7 +3315,6 @@ ret:
if (arena)
thd->restore_active_arena(arena, &backup);
reenable_binlog(thd);
- thd->variables.sql_mode= saved_mode;
thd->variables.character_set_client= old_cs;
if (unlikely(thd->is_error() || error))
{
@@ -3787,7 +3932,6 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share,
outparam->check_constraints= check_constraint_ptr;
vcol_init_mode mode= VCOL_INIT_DEPENDENCY_FAILURE_IS_WARNING;
-#if MYSQL_VERSION_ID > 100500
switch (thd->lex->sql_command)
{
case SQLCOM_CREATE_TABLE:
@@ -3802,7 +3946,6 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share,
default:
break;
}
-#endif
if (parse_vcol_defs(thd, &outparam->mem_root, outparam,
&error_reported, mode))
@@ -4437,21 +4580,17 @@ bool get_field(MEM_ROOT *mem, Field *field, String *res)
StringBuffer<MAX_FIELD_WIDTH> str;
bool rc;
THD *thd= field->get_thd();
- sql_mode_t sql_mode_backup= thd->variables.sql_mode;
- thd->variables.sql_mode&= ~MODE_PAD_CHAR_TO_FULL_LENGTH;
+ Sql_mode_instant_remove sms(thd, MODE_PAD_CHAR_TO_FULL_LENGTH);
field->val_str(&str);
if ((rc= !str.length() ||
!(to= strmake_root(mem, str.ptr(), str.length()))))
{
res->length(0);
- goto ex;
+ return rc;
}
res->set(to, str.length(), field->charset());
-
-ex:
- thd->variables.sql_mode= sql_mode_backup;
- return rc;
+ return false;
}
@@ -5118,6 +5257,8 @@ void TABLE::init(THD *thd, TABLE_LIST *tl)
(*f_ptr)->cond_selectivity= 1.0;
}
+ notnull_cond= 0;
+
DBUG_ASSERT(!file->keyread_enabled());
restore_record(this, s->default_values);
@@ -6436,8 +6577,8 @@ Item *create_view_field(THD *thd, TABLE_LIST *view, Item **field_ref,
&view->view->first_select_lex()->context:
&thd->lex->first_select_lex()->context);
Item *item= (new (thd->mem_root)
- Item_direct_view_ref(thd, context, field_ref, view->alias.str,
- name, view));
+ Item_direct_view_ref(thd, context, field_ref, view->alias,
+ *name, view));
if (!item)
return NULL;
/*
@@ -7542,14 +7683,9 @@ void TABLE::create_key_part_by_field(KEY_PART_INFO *key_part_info,
{
key_part_info->store_length+= HA_KEY_NULL_LENGTH;
}
- if (field->type() == MYSQL_TYPE_BLOB ||
- field->type() == MYSQL_TYPE_GEOMETRY ||
- field->real_type() == MYSQL_TYPE_VARCHAR)
- {
- key_part_info->store_length+= HA_KEY_BLOB_LENGTH;
- key_part_info->key_part_flag|=
- field->type() == MYSQL_TYPE_BLOB ? HA_BLOB_PART: HA_VAR_LENGTH_PART;
- }
+
+ key_part_info->key_part_flag|= field->key_part_flag();
+ key_part_info->store_length+= field->key_part_length_bytes();
key_part_info->type= (uint8) field->key_type();
key_part_info->key_type =
@@ -9456,7 +9592,7 @@ bool TR_table::check(bool error)
}
Field_enum *iso_level= static_cast<Field_enum *>(table->field[FLD_ISO_LEVEL]);
- st_typelib *typelib= iso_level->typelib;
+ const st_typelib *typelib= iso_level->typelib;
if (typelib->count != 4)
goto wrong_enum;
@@ -9482,12 +9618,12 @@ bool TR_table::check(bool error)
return false;
}
-bool vers_select_conds_t::resolve_units(THD *thd)
+bool vers_select_conds_t::check_units(THD *thd)
{
DBUG_ASSERT(type != SYSTEM_TIME_UNSPECIFIED);
DBUG_ASSERT(start.item);
- return start.resolve_unit(thd) ||
- end.resolve_unit(thd);
+ return start.check_unit(thd) ||
+ end.check_unit(thd);
}
bool vers_select_conds_t::eq(const vers_select_conds_t &conds) const
@@ -9511,22 +9647,21 @@ bool vers_select_conds_t::eq(const vers_select_conds_t &conds) const
}
-bool Vers_history_point::resolve_unit(THD *thd)
+bool Vers_history_point::check_unit(THD *thd)
{
if (!item)
return false;
if (item->fix_fields_if_needed(thd, &item))
return true;
- return item->this_item()->real_type_handler()->
- type_handler_for_system_time()->
- Vers_history_point_resolve_unit(thd, this);
-}
-
-
-void Vers_history_point::bad_expression_data_type_error(const char *type) const
-{
- my_error(ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION, MYF(0),
- type, "FOR SYSTEM_TIME");
+ const Type_handler *t= item->this_item()->real_type_handler();
+ DBUG_ASSERT(t);
+ if (!t->vers())
+ {
+ my_error(ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION, MYF(0),
+ t->name().ptr(), "FOR SYSTEM_TIME");
+ return true;
+ }
+ return false;
}
diff --git a/sql/table.h b/sql/table.h
index 1c721624d5d..898c31c4aff 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -31,6 +31,8 @@
#include "thr_lock.h" /* thr_lock_type */
#include "filesort_utils.h"
#include "parse_file.h"
+#include "sql_i_s.h"
+#include "sql_type.h" /* vers_kind_t */
/* Structs that defines the TABLE */
@@ -807,7 +809,7 @@ struct TABLE_SHARE
}
};
- vers_sys_type_t versioned;
+ vers_kind_t versioned;
period_info_t vers;
period_info_t period;
@@ -1108,9 +1110,6 @@ struct st_cond_statistic;
#define CHECK_ROW_FOR_NULLS_TO_REJECT (1 << 0)
#define REJECT_ROW_DUE_TO_NULL_FIELDS (1 << 1)
-/* Bitmap of table's fields */
-typedef Bitmap<MAX_FIELDS> Field_map;
-
class SplM_opt_info;
struct vers_select_conds_t;
@@ -1411,6 +1410,13 @@ public:
SplM_opt_info *spl_opt_info;
key_map keys_usable_for_splitting;
+ /*
+ Conjunction of the predicates of the form IS NOT NULL(f) where f refers to
+ a column of this TABLE such that they can be inferred from the condition
+ of the WHERE clause or from some ON expression of the processed select
+ and can be useful for range optimizer.
+ */
+ Item *notnull_cond;
inline void reset() { bzero((void*)this, sizeof(*this)); }
void init(THD *thd, TABLE_LIST *tl);
@@ -1576,14 +1582,14 @@ public:
return s->versioned;
}
- bool versioned(vers_sys_type_t type) const
+ bool versioned(vers_kind_t type) const
{
DBUG_ASSERT(s);
DBUG_ASSERT(type);
return s->versioned == type;
}
- bool versioned_write(vers_sys_type_t type= VERS_UNDEFINED) const
+ bool versioned_write(vers_kind_t type= VERS_UNDEFINED) const
{
DBUG_ASSERT(versioned() || !vers_write);
return versioned(type) ? vers_write : false;
@@ -1678,71 +1684,6 @@ typedef struct st_foreign_key_info
LEX_CSTRING *fk_option_name(enum_fk_option opt);
bool fk_modifies_child(enum_fk_option opt);
-#define MY_I_S_MAYBE_NULL 1U
-#define MY_I_S_UNSIGNED 2U
-
-
-#define SKIP_OPEN_TABLE 0U // do not open table
-#define OPEN_FRM_ONLY 1U // open FRM file only
-#define OPEN_FULL_TABLE 2U // open FRM,MYD, MYI files
-
-typedef struct st_field_info
-{
- /**
- This is used as column name.
- */
- const char* field_name;
- /**
- For string-type columns, this is the maximum number of
- characters. Otherwise, it is the 'display-length' for the column.
- */
- uint field_length;
- /**
- This denotes data type for the column. For the most part, there seems to
- be one entry in the enum for each SQL data type, although there seem to
- be a number of additional entries in the enum.
- */
- enum enum_field_types field_type;
- int value;
- /**
- This is used to set column attributes. By default, columns are @c NOT
- @c NULL and @c SIGNED, and you can deviate from the default
- by setting the appopriate flags. You can use either one of the flags
- @c MY_I_S_MAYBE_NULL and @cMY_I_S_UNSIGNED or
- combine them using the bitwise or operator @c |. Both flags are
- defined in table.h.
- */
- uint field_flags; // Field atributes(maybe_null, signed, unsigned etc.)
- const char* old_name;
- /**
- This should be one of @c SKIP_OPEN_TABLE,
- @c OPEN_FRM_ONLY or @c OPEN_FULL_TABLE.
- */
- uint open_method;
-} ST_FIELD_INFO;
-
-
-struct TABLE_LIST;
-typedef class Item COND;
-
-typedef struct st_schema_table
-{
- const char *table_name;
- ST_FIELD_INFO *fields_info;
- /* for FLUSH table_name */
- int (*reset_table) ();
- /* Fill table with data */
- int (*fill_table) (THD *thd, TABLE_LIST *tables, COND *cond);
- /* Handle fileds for old SHOW */
- int (*old_format) (THD *thd, struct st_schema_table *schema_table);
- int (*process_table) (THD *thd, TABLE_LIST *tables, TABLE *table,
- bool res, const LEX_CSTRING *db_name,
- const LEX_CSTRING *table_name);
- int idx_field1, idx_field2;
- bool hidden;
- uint i_s_requested_object; /* the object we need to open(TABLE | VIEW) */
-} ST_SCHEMA_TABLE;
-
class IS_table_read_plan;
/*
@@ -1879,7 +1820,7 @@ class Item_in_subselect;
/* trivial class, for %union in sql_yacc.yy */
struct vers_history_point_t
{
- vers_sys_type_t unit;
+ vers_kind_t unit;
Item *item;
};
@@ -1889,7 +1830,7 @@ class Vers_history_point : public vers_history_point_t
public:
Vers_history_point() { empty(); }
- Vers_history_point(vers_sys_type_t unit_arg, Item *item_arg)
+ Vers_history_point(vers_kind_t unit_arg, Item *item_arg)
{
unit= unit_arg;
item= item_arg;
@@ -1901,21 +1842,9 @@ public:
item= p.item;
fix_item();
}
- void empty() { unit= VERS_UNDEFINED; item= NULL; }
+ void empty() { unit= VERS_TIMESTAMP; item= NULL; }
void print(String *str, enum_query_type, const char *prefix, size_t plen) const;
- bool resolve_unit(THD *thd);
- bool resolve_unit_trx_id(THD *thd)
- {
- if (unit == VERS_UNDEFINED)
- unit= VERS_TRX_ID;
- return false;
- }
- bool resolve_unit_timestamp(THD *thd)
- {
- if (unit == VERS_UNDEFINED)
- unit= VERS_TIMESTAMP;
- return false;
- }
+ bool check_unit(THD *thd);
void bad_expression_data_type_error(const char *type) const;
bool eq(const vers_history_point_t &point) const;
};
@@ -1961,7 +1890,7 @@ struct vers_select_conds_t
{
return type != SYSTEM_TIME_UNSPECIFIED;
}
- bool resolve_units(THD *thd);
+ bool check_units(THD *thd);
bool eq(const vers_select_conds_t &conds) const;
};
diff --git a/sql/thread_pool_info.cc b/sql/thread_pool_info.cc
new file mode 100644
index 00000000000..99ac3cd148c
--- /dev/null
+++ b/sql/thread_pool_info.cc
@@ -0,0 +1,357 @@
+/* Copyright(C) 2019 MariaDB
+
+This program is free software; you can redistribute itand /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 02111 - 1301 USA*/
+
+#include <mysql_version.h>
+#include <mysql/plugin.h>
+
+#include <my_global.h>
+#include <sql_class.h>
+#include <sql_i_s.h>
+#include <mysql/plugin.h>
+#include <sql_show.h>
+#include <threadpool_generic.h>
+
+namespace Show {
+
+static ST_FIELD_INFO groups_fields_info[] =
+{
+ Column("GROUP_ID", SLong(6), NOT_NULL),
+ Column("CONNECTIONS", SLong(6), NOT_NULL),
+ Column("THREADS", SLong(6), NOT_NULL),
+ Column("ACTIVE_THREADS", SLong(6), NOT_NULL),
+ Column("STANDBY_THREADS", SLong(6), NOT_NULL),
+ Column("QUEUE_LENGTH", SLong(6), NOT_NULL),
+ Column("HAS_LISTENER", STiny(1), NOT_NULL),
+ Column("IS_STALLED", STiny(1), NOT_NULL),
+ CEnd()
+};
+
+} // namespace Show
+
+
+static int groups_fill_table(THD* thd, TABLE_LIST* tables, COND*)
+{
+ if (!all_groups)
+ return 0;
+
+ TABLE* table = tables->table;
+ for (uint i = 0; i < threadpool_max_size && all_groups[i].pollfd != INVALID_HANDLE_VALUE; i++)
+ {
+ thread_group_t* group = &all_groups[i];
+ /* ID */
+ table->field[0]->store(i, true);
+ /* CONNECTION_COUNT */
+ table->field[1]->store(group->connection_count, true);
+ /* THREAD_COUNT */
+ table->field[2]->store(group->thread_count, true);
+ /* ACTIVE_THREAD_COUNT */
+ table->field[3]->store(group->active_thread_count, true);
+ /* STANDBY_THREAD_COUNT */
+ table->field[4]->store(group->waiting_threads.elements(), true);
+ /* QUEUE LENGTH */
+ uint queue_len = group->queues[TP_PRIORITY_LOW].elements()
+ + group->queues[TP_PRIORITY_HIGH].elements();
+ table->field[5]->store(queue_len, true);
+ /* HAS_LISTENER */
+ table->field[6]->store((longlong)(group->listener != 0), true);
+ /* IS_STALLED */
+ table->field[7]->store(group->stalled, true);
+
+ if (schema_table_store_record(thd, table))
+ return 1;
+ }
+ return 0;
+}
+
+
+static int groups_init(void* p)
+{
+ ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*)p;
+ schema->fields_info = Show::groups_fields_info;
+ schema->fill_table = groups_fill_table;
+ return 0;
+}
+
+
+namespace Show {
+
+static ST_FIELD_INFO queues_field_info[] =
+{
+ Column("GROUP_ID", SLong(6), NOT_NULL),
+ Column("POSITION", SLong(6), NOT_NULL),
+ Column("PRIORITY", SLong(1), NOT_NULL),
+ Column("CONNECTION_ID", ULonglong(19), NOT_NULL),
+ Column("QUEUEING_TIME_MICROSECONDS", SLonglong(19), NOT_NULL),
+ CEnd()
+};
+
+} // namespace Show
+
+typedef connection_queue_t::Iterator connection_queue_iterator;
+
+static int queues_fill_table(THD* thd, TABLE_LIST* tables, COND*)
+{
+ if (!all_groups)
+ return 0;
+
+ TABLE* table = tables->table;
+ for (uint group_id = 0;
+ group_id < threadpool_max_size && all_groups[group_id].pollfd != INVALID_HANDLE_VALUE;
+ group_id++)
+ {
+ thread_group_t* group = &all_groups[group_id];
+
+ mysql_mutex_lock(&group->mutex);
+ bool err = false;
+ int pos = 0;
+ ulonglong now = microsecond_interval_timer();
+ for (uint prio = 0; prio < NQUEUES && !err; prio++)
+ {
+ connection_queue_iterator it(group->queues[prio]);
+ TP_connection_generic* c;
+ while ((c = it++) != 0)
+ {
+ /* GROUP_ID */
+ table->field[0]->store(group_id, true);
+ /* POSITION */
+ table->field[1]->store(pos++, true);
+ /* PRIORITY */
+ table->field[2]->store(prio, true);
+ /* CONNECTION_ID */
+ table->field[3]->store(c->thd->thread_id, true);
+ /* QUEUEING_TIME */
+ table->field[4]->store(now - c->enqueue_time, true);
+
+ err = schema_table_store_record(thd, table);
+ if (err)
+ break;
+ }
+ }
+ mysql_mutex_unlock(&group->mutex);
+ if (err)
+ return 1;
+ }
+ return 0;
+}
+
+static int queues_init(void* p)
+{
+ ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*)p;
+ schema->fields_info = Show::queues_field_info;
+ schema->fill_table = queues_fill_table;
+ return 0;
+}
+
+namespace Show {
+
+static ST_FIELD_INFO stats_fields_info[] =
+{
+ Column("GROUP_ID", SLong(6), NOT_NULL),
+ Column("THREAD_CREATIONS", SLonglong(19), NOT_NULL),
+ Column("THREAD_CREATIONS_DUE_TO_STALL", SLonglong(19), NOT_NULL),
+ Column("WAKES", SLonglong(19), NOT_NULL),
+ Column("WAKES_DUE_TO_STALL", SLonglong(19), NOT_NULL),
+ Column("THROTTLES", SLonglong(19), NOT_NULL),
+ Column("STALLS", SLonglong(19), NOT_NULL),
+ Column("POLLS_BY_LISTENER", SLonglong(19), NOT_NULL),
+ Column("POLLS_BY_WORKER", SLonglong(19), NOT_NULL),
+ Column("DEQUEUES_BY_LISTENER", SLonglong(19), NOT_NULL),
+ Column("DEQUEUES_BY_WORKER", SLonglong(19), NOT_NULL),
+ CEnd()
+};
+
+} // namespace Show
+
+
+static int stats_fill_table(THD* thd, TABLE_LIST* tables, COND*)
+{
+ if (!all_groups)
+ return 0;
+
+ TABLE* table = tables->table;
+ for (uint i = 0; i < threadpool_max_size && all_groups[i].pollfd != INVALID_HANDLE_VALUE; i++)
+ {
+ table->field[0]->store(i, true);
+ thread_group_t* group = &all_groups[i];
+
+ mysql_mutex_lock(&group->mutex);
+ thread_group_counters_t* counters = &group->counters;
+ table->field[1]->store(counters->thread_creations, true);
+ table->field[2]->store(counters->thread_creations_due_to_stall, true);
+ table->field[3]->store(counters->wakes, true);
+ table->field[4]->store(counters->wakes_due_to_stall, true);
+ table->field[5]->store(counters->throttles, true);
+ table->field[6]->store(counters->stalls, true);
+ table->field[7]->store(counters->polls_by_listener, true);
+ table->field[8]->store(counters->polls_by_worker, true);
+ table->field[9]->store(counters->dequeues_by_listener, true);
+ table->field[10]->store(counters->dequeues_by_worker, true);
+ mysql_mutex_unlock(&group->mutex);
+ if (schema_table_store_record(thd, table))
+ return 1;
+ }
+ return 0;
+}
+
+static int stats_reset_table()
+{
+ for (uint i = 0; i < threadpool_max_size && all_groups[i].pollfd != INVALID_HANDLE_VALUE; i++)
+ {
+ thread_group_t* group = &all_groups[i];
+ mysql_mutex_lock(&group->mutex);
+ memset(&group->counters, 0, sizeof(group->counters));
+ mysql_mutex_unlock(&group->mutex);
+ }
+ return 0;
+}
+
+static int stats_init(void* p)
+{
+ ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*)p;
+ schema->fields_info = Show::stats_fields_info;
+ schema->fill_table = stats_fill_table;
+ schema->reset_table = stats_reset_table;
+ return 0;
+}
+
+
+namespace Show {
+
+static ST_FIELD_INFO waits_fields_info[] =
+{
+ Column("REASON", Varchar(16), NOT_NULL),
+ Column("COUNT", SLonglong(19), NOT_NULL),
+ CEnd()
+};
+
+} // namespace Show
+
+/* See thd_wait_type enum for explanation*/
+static const LEX_CSTRING wait_reasons[THD_WAIT_LAST] =
+{
+ {STRING_WITH_LEN("UNKNOWN")},
+ {STRING_WITH_LEN("SLEEP")},
+ {STRING_WITH_LEN("DISKIO")},
+ {STRING_WITH_LEN("ROW_LOCK")},
+ {STRING_WITH_LEN("GLOBAL_LOCK")},
+ {STRING_WITH_LEN("META_DATA_LOCK")},
+ {STRING_WITH_LEN("TABLE_LOCK")},
+ {STRING_WITH_LEN("USER_LOCK")},
+ {STRING_WITH_LEN("BINLOG")},
+ {STRING_WITH_LEN("GROUP_COMMIT")},
+ {STRING_WITH_LEN("SYNC")},
+ {STRING_WITH_LEN("NET")}
+};
+
+extern Atomic_counter<unsigned long long> tp_waits[THD_WAIT_LAST];
+
+static int waits_fill_table(THD* thd, TABLE_LIST* tables, COND*)
+{
+ if (!all_groups)
+ return 0;
+
+ TABLE* table = tables->table;
+ for (auto i = 0; i < THD_WAIT_LAST; i++)
+ {
+ table->field[0]->store(wait_reasons[i].str, wait_reasons[i].length, system_charset_info);
+ table->field[1]->store(tp_waits[i], true);
+ if (schema_table_store_record(thd, table))
+ return 1;
+ }
+ return 0;
+}
+
+static int waits_reset_table()
+{
+ for (auto i = 0; i < THD_WAIT_LAST; i++)
+ tp_waits[i] = 0;
+
+ return 0;
+}
+
+static int waits_init(void* p)
+{
+ ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*)p;
+ schema->fields_info = Show::waits_fields_info;
+ schema->fill_table = waits_fill_table;
+ schema->reset_table = waits_reset_table;
+ return 0;
+}
+
+static struct st_mysql_information_schema plugin_descriptor =
+{ MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION };
+
+maria_declare_plugin(thread_pool_info)
+{
+ MYSQL_INFORMATION_SCHEMA_PLUGIN,
+ &plugin_descriptor,
+ "THREAD_POOL_GROUPS",
+ "Vladislav Vaintroub",
+ "Provides information about threadpool groups.",
+ PLUGIN_LICENSE_GPL,
+ groups_init,
+ 0,
+ 0x0100,
+ NULL,
+ NULL,
+ "1.0",
+ MariaDB_PLUGIN_MATURITY_STABLE
+},
+{
+ MYSQL_INFORMATION_SCHEMA_PLUGIN,
+ &plugin_descriptor,
+ "THREAD_POOL_QUEUES",
+ "Vladislav Vaintroub",
+ "Provides information about threadpool queues.",
+ PLUGIN_LICENSE_GPL,
+ queues_init,
+ 0,
+ 0x0100,
+ NULL,
+ NULL,
+ "1.0",
+ MariaDB_PLUGIN_MATURITY_STABLE
+},
+{
+ MYSQL_INFORMATION_SCHEMA_PLUGIN,
+ &plugin_descriptor,
+ "THREAD_POOL_STATS",
+ "Vladislav Vaintroub",
+ "Provides performance counter information for threadpool.",
+ PLUGIN_LICENSE_GPL,
+ stats_init,
+ 0,
+ 0x0100,
+ NULL,
+ NULL,
+ "1.0",
+ MariaDB_PLUGIN_MATURITY_STABLE
+},
+{
+ MYSQL_INFORMATION_SCHEMA_PLUGIN,
+ &plugin_descriptor,
+ "THREAD_POOL_WAITS",
+ "Vladislav Vaintroub",
+ "Provides wait counters for threadpool.",
+ PLUGIN_LICENSE_GPL,
+ waits_init,
+ 0,
+ 0x0100,
+ NULL,
+ NULL,
+ "1.0",
+ MariaDB_PLUGIN_MATURITY_STABLE
+}
+maria_declare_plugin_end;
diff --git a/sql/threadpool.h b/sql/threadpool.h
index 6299510d002..fe77100a82a 100644
--- a/sql/threadpool.h
+++ b/sql/threadpool.h
@@ -24,16 +24,19 @@ extern uint threadpool_min_threads; /* Minimum threads in pool */
extern uint threadpool_idle_timeout; /* Shutdown idle worker threads after this timeout */
extern uint threadpool_size; /* Number of parallel executing threads */
extern uint threadpool_max_size;
-extern uint threadpool_stall_limit; /* time interval in 10 ms units for stall checks*/
+extern uint threadpool_stall_limit; /* time interval in milliseconds for stall checks*/
extern uint threadpool_max_threads; /* Maximum threads in pool */
extern uint threadpool_oversubscribe; /* Maximum active threads in group */
extern uint threadpool_prio_kickup_timer; /* Time before low prio item gets prio boost */
+extern my_bool threadpool_exact_stats; /* Better queueing time stats for information_schema, at small performance cost */
+extern my_bool threadpool_dedicated_listener; /* Listener thread does not pick up work items. */
#ifdef _WIN32
extern uint threadpool_mode; /* Thread pool implementation , windows or generic */
#define TP_MODE_WINDOWS 0
#define TP_MODE_GENERIC 1
#endif
+#define DEFAULT_THREADPOOL_STALL_LIMIT 500U
struct TP_connection;
extern void tp_callback(TP_connection *c);
@@ -64,8 +67,6 @@ extern int tp_get_thread_count();
/* Activate threadpool scheduler */
extern void tp_scheduler(void);
-extern int show_threadpool_idle_threads(THD *thd, SHOW_VAR *var, char *buff,
- enum enum_var_type scope);
enum TP_PRIORITY {
TP_PRIORITY_HIGH,
@@ -88,6 +89,8 @@ enum TP_STATE
inside threadpool_win.cc and threadpool_unix.cc
*/
+class CONNECT;
+
struct TP_connection
{
THD* thd;
diff --git a/sql/threadpool_common.cc b/sql/threadpool_common.cc
index 6577472e20b..6ed80c8de76 100644
--- a/sql/threadpool_common.cc
+++ b/sql/threadpool_common.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012 Monty Program Ab
+/* Copyright (C) 2012, 2019, 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
@@ -23,6 +23,8 @@
#include <sql_audit.h>
#include <debug_sync.h>
#include <threadpool.h>
+#include <my_counter.h>
+
#ifdef WITH_WSREP
#include "wsrep_trans_observer.h"
#endif /* WITH_WSREP */
@@ -38,6 +40,8 @@ uint threadpool_max_threads;
uint threadpool_oversubscribe;
uint threadpool_mode;
uint threadpool_prio_kickup_timer;
+my_bool threadpool_exact_stats;
+my_bool threadpool_dedicated_listener;
/* Stats */
TP_STATISTICS tp_stats;
@@ -160,9 +164,8 @@ static TP_PRIORITY get_priority(TP_connection *c)
DBUG_ASSERT(c->thd == current_thd);
TP_PRIORITY prio= (TP_PRIORITY)c->thd->variables.threadpool_priority;
if (prio == TP_PRIORITY_AUTO)
- {
- return c->thd->transaction.is_active() ? TP_PRIORITY_HIGH : TP_PRIORITY_LOW;
- }
+ prio= c->thd->transaction.is_active() ? TP_PRIORITY_HIGH : TP_PRIORITY_LOW;
+
return prio;
}
@@ -388,19 +391,6 @@ end:
}
-
-/* Dummy functions, do nothing */
-
-static bool tp_init_new_connection_thread()
-{
- return 0;
-}
-
-static bool tp_end_thread(THD *, bool)
-{
- return 0;
-}
-
static TP_pool *pool;
static bool tp_init()
@@ -484,12 +474,17 @@ void tp_timeout_handler(TP_connection *c)
mysql_mutex_unlock(&thd->LOCK_thd_kill);
}
+MY_ALIGNED(CPU_LEVEL1_DCACHE_LINESIZE) Atomic_counter<unsigned long long> tp_waits[THD_WAIT_LAST];
static void tp_wait_begin(THD *thd, int type)
{
TP_connection *c = get_TP_connection(thd);
if (c)
+ {
+ DBUG_ASSERT(type > 0 && type < THD_WAIT_LAST);
+ tp_waits[type]++;
c->wait_begin(type);
+ }
}
@@ -520,18 +515,16 @@ static scheduler_functions tp_scheduler_functions=
NULL,
NULL,
tp_init, // init
- tp_init_new_connection_thread, // init_new_connection_thread
tp_add_connection, // add_connection
tp_wait_begin, // thd_wait_begin
tp_wait_end, // thd_wait_end
tp_post_kill_notification, // post kill notification
- tp_end_thread, // Dummy function
tp_end // end
};
void pool_of_threads_scheduler(struct scheduler_functions *func,
ulong *arg_max_connections,
- uint *arg_connection_count)
+ Atomic_counter<uint> *arg_connection_count)
{
*func = tp_scheduler_functions;
func->max_threads= threadpool_max_threads;
diff --git a/sql/threadpool_generic.cc b/sql/threadpool_generic.cc
index eb92846ed07..768dbab4e6b 100644
--- a/sql/threadpool_generic.cc
+++ b/sql/threadpool_generic.cc
@@ -13,56 +13,28 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
+#if (defined HAVE_POOL_OF_THREADS) && !defined(EMBEDDED_LIBRARY)
+
+#include "threadpool_generic.h"
#include "mariadb.h"
#include <violite.h>
#include <sql_priv.h>
#include <sql_class.h>
#include <my_pthread.h>
#include <scheduler.h>
-
-#ifdef HAVE_POOL_OF_THREADS
-
-#ifdef _WIN32
-/* AIX may define this, too ?*/
-#define HAVE_IOCP
-#endif
-
-#ifdef HAVE_IOCP
-#define OPTIONAL_IO_POLL_READ_PARAM this
-#else
-#define OPTIONAL_IO_POLL_READ_PARAM 0
-#endif
-
-#ifdef _WIN32
-typedef HANDLE TP_file_handle;
-#else
-typedef int TP_file_handle;
-#define INVALID_HANDLE_VALUE -1
-#endif
-
-
#include <sql_connect.h>
#include <mysqld.h>
#include <debug_sync.h>
#include <time.h>
#include <sql_plist.h>
#include <threadpool.h>
-#include <time.h>
-#ifdef __linux__
-#include <sys/epoll.h>
-typedef struct epoll_event native_event;
-#elif defined(HAVE_KQUEUE)
-#include <sys/event.h>
-typedef struct kevent native_event;
-#elif defined (__sun)
-#include <port.h>
-typedef port_event_t native_event;
-#elif defined (HAVE_IOCP)
-typedef OVERLAPPED_ENTRY native_event;
-#else
-#error threadpool is not available on this platform
-#endif
+#include <algorithm>
+#ifdef HAVE_IOCP
+#define OPTIONAL_IO_POLL_READ_PARAM this
+#else
+#define OPTIONAL_IO_POLL_READ_PARAM 0
+#endif
static void io_poll_close(TP_file_handle fd)
{
@@ -119,86 +91,7 @@ static PSI_thread_info thread_list[] =
#define PSI_register(X) /* no-op */
#endif
-
-struct thread_group_t;
-
-/* Per-thread structure for workers */
-struct worker_thread_t
-{
- ulonglong event_count; /* number of request handled by this thread */
- thread_group_t* thread_group;
- worker_thread_t *next_in_list;
- worker_thread_t **prev_in_list;
-
- mysql_cond_t cond;
- bool woken;
-};
-
-typedef I_P_List<worker_thread_t, I_P_List_adapter<worker_thread_t,
- &worker_thread_t::next_in_list,
- &worker_thread_t::prev_in_list>
- >
-worker_list_t;
-
-struct TP_connection_generic:public TP_connection
-{
- TP_connection_generic(CONNECT *c);
- ~TP_connection_generic();
-
- virtual int init(){ return 0; };
- virtual void set_io_timeout(int sec);
- virtual int start_io();
- virtual void wait_begin(int type);
- virtual void wait_end();
-
- thread_group_t *thread_group;
- TP_connection_generic *next_in_queue;
- TP_connection_generic **prev_in_queue;
- ulonglong abs_wait_timeout;
- ulonglong dequeue_time;
- TP_file_handle fd;
- bool bound_to_poll_descriptor;
- int waiting;
-#ifdef HAVE_IOCP
- OVERLAPPED overlapped;
-#endif
-#ifdef _WIN32
- enum_vio_type vio_type;
-#endif
-};
-
-
-typedef I_P_List<TP_connection_generic,
- I_P_List_adapter<TP_connection_generic,
- &TP_connection_generic::next_in_queue,
- &TP_connection_generic::prev_in_queue>,
- I_P_List_null_counter,
- I_P_List_fast_push_back<TP_connection_generic> >
-connection_queue_t;
-
-const int NQUEUES=2; /* We have high and low priority queues*/
-
-struct MY_ALIGNED(CPU_LEVEL1_DCACHE_LINESIZE) thread_group_t
-{
- mysql_mutex_t mutex;
- connection_queue_t queues[NQUEUES];
- worker_list_t waiting_threads;
- worker_thread_t *listener;
- pthread_attr_t *pthread_attr;
- TP_file_handle pollfd;
- int thread_count;
- int active_thread_count;
- int connection_count;
- /* Stats for the deadlock detection timer routine.*/
- int io_event_count;
- int queue_event_count;
- ulonglong last_thread_creation_time;
- int shutdown_pipe[2];
- bool shutdown;
- bool stalled;
-};
-
-static thread_group_t *all_groups;
+thread_group_t *all_groups;
static uint group_count;
static int32 shutdown_group_count;
@@ -224,9 +117,9 @@ static pool_timer_t pool_timer;
static void queue_put(thread_group_t *thread_group, TP_connection_generic *connection);
static void queue_put(thread_group_t *thread_group, native_event *ev, int cnt);
-static int wake_thread(thread_group_t *thread_group);
-static int wake_or_create_thread(thread_group_t *thread_group);
-static int create_worker(thread_group_t *thread_group);
+static int wake_thread(thread_group_t *thread_group,bool due_to_stall);
+static int wake_or_create_thread(thread_group_t *thread_group, bool due_to_stall=false);
+static int create_worker(thread_group_t *thread_group, bool due_to_stall);
static void *worker_main(void *param);
static void check_stall(thread_group_t *thread_group);
static void set_next_timeout_check(ulonglong abstime);
@@ -563,11 +456,11 @@ static void queue_init(thread_group_t *thread_group)
static void queue_put(thread_group_t *thread_group, native_event *ev, int cnt)
{
- ulonglong now= pool_timer.current_microtime;
+ ulonglong now= threadpool_exact_stats?microsecond_interval_timer():pool_timer.current_microtime;
for(int i=0; i < cnt; i++)
{
TP_connection_generic *c = (TP_connection_generic *)native_event_get_userdata(&ev[i]);
- c->dequeue_time= now;
+ c->enqueue_time= now;
thread_group->queues[c->priority].push_back(c);
}
}
@@ -681,7 +574,7 @@ void check_stall(thread_group_t *thread_group)
for (;;)
{
c= thread_group->queues[TP_PRIORITY_LOW].front();
- if (c && pool_timer.current_microtime - c->dequeue_time > 1000ULL * threadpool_prio_kickup_timer)
+ if (c && pool_timer.current_microtime - c->enqueue_time > 1000ULL * threadpool_prio_kickup_timer)
{
thread_group->queues[TP_PRIORITY_LOW].remove(c);
thread_group->queues[TP_PRIORITY_HIGH].push_back(c);
@@ -698,7 +591,7 @@ void check_stall(thread_group_t *thread_group)
*/
if (!thread_group->listener && !thread_group->io_event_count)
{
- wake_or_create_thread(thread_group);
+ wake_or_create_thread(thread_group, true);
mysql_mutex_unlock(&thread_group->mutex);
return;
}
@@ -735,7 +628,8 @@ void check_stall(thread_group_t *thread_group)
if (!is_queue_empty(thread_group) && !thread_group->queue_event_count)
{
thread_group->stalled= true;
- wake_or_create_thread(thread_group);
+ TP_INCREMENT_GROUP_COUNTER(thread_group,stalls);
+ wake_or_create_thread(thread_group,true);
}
/* Reset queue event count */
@@ -790,13 +684,13 @@ static TP_connection_generic * listener(worker_thread_t *current_thread,
break;
cnt = io_poll_wait(thread_group->pollfd, ev, MAX_EVENTS, -1);
-
+ TP_INCREMENT_GROUP_COUNTER(thread_group, polls_by_listener);
if (cnt <=0)
{
DBUG_ASSERT(thread_group->shutdown);
break;
}
-
+
mysql_mutex_lock(&thread_group->mutex);
if (thread_group->shutdown)
@@ -851,7 +745,7 @@ static TP_connection_generic * listener(worker_thread_t *current_thread,
more workers.
*/
- bool listener_picks_event=is_queue_empty(thread_group);
+ bool listener_picks_event=is_queue_empty(thread_group) && !threadpool_dedicated_listener;
queue_put(thread_group, ev, cnt);
if (listener_picks_event)
{
@@ -864,7 +758,7 @@ static TP_connection_generic * listener(worker_thread_t *current_thread,
if(thread_group->active_thread_count==0)
{
/* We added some work items to queue, now wake a worker. */
- if(wake_thread(thread_group))
+ if(wake_thread(thread_group, false))
{
/*
Wake failed, hence groups has no idle threads. Now check if there are
@@ -882,7 +776,7 @@ static TP_connection_generic * listener(worker_thread_t *current_thread,
create thread, but waiting for timer would be an inefficient and
pointless delay.
*/
- create_worker(thread_group);
+ create_worker(thread_group, false);
}
}
}
@@ -919,7 +813,7 @@ static void add_thread_count(thread_group_t *thread_group, int32 count)
per group to prevent deadlocks (one listener + one worker)
*/
-static int create_worker(thread_group_t *thread_group)
+static int create_worker(thread_group_t *thread_group, bool due_to_stall)
{
pthread_t thread_id;
bool max_threads_reached= false;
@@ -942,6 +836,11 @@ static int create_worker(thread_group_t *thread_group)
thread_group->last_thread_creation_time=microsecond_interval_timer();
statistic_increment(thread_created,&LOCK_status);
add_thread_count(thread_group, 1);
+ TP_INCREMENT_GROUP_COUNTER(thread_group,thread_creations);
+ if(due_to_stall)
+ {
+ TP_INCREMENT_GROUP_COUNTER(thread_group, thread_creations_due_to_stall);
+ }
}
else
{
@@ -967,23 +866,24 @@ end:
The actual values were not calculated using any scientific methods.
They just look right, and behave well in practice.
-
- TODO: Should throttling depend on thread_pool_stall_limit?
*/
+
+#define THROTTLING_FACTOR (threadpool_stall_limit/std::max(DEFAULT_THREADPOOL_STALL_LIMIT,threadpool_stall_limit))
+
static ulonglong microsecond_throttling_interval(thread_group_t *thread_group)
{
int count= thread_group->thread_count;
- if (count < 4)
+ if (count < 1+ (int)threadpool_oversubscribe)
return 0;
-
+
if (count < 8)
- return 50*1000;
-
+ return 50*1000*THROTTLING_FACTOR;
+
if(count < 16)
- return 100*1000;
-
- return 200*1000;
+ return 100*1000*THROTTLING_FACTOR;
+
+ return 200*100*THROTTLING_FACTOR;
}
@@ -993,15 +893,17 @@ static ulonglong microsecond_throttling_interval(thread_group_t *thread_group)
Worker creation is throttled, so we avoid too many threads
to be created during the short time.
*/
-static int wake_or_create_thread(thread_group_t *thread_group)
+static int wake_or_create_thread(thread_group_t *thread_group, bool due_to_stall)
{
DBUG_ENTER("wake_or_create_thread");
if (thread_group->shutdown)
DBUG_RETURN(0);
- if (wake_thread(thread_group) == 0)
+ if (wake_thread(thread_group, due_to_stall) == 0)
+ {
DBUG_RETURN(0);
+ }
if (thread_group->thread_count > thread_group->connection_count)
DBUG_RETURN(-1);
@@ -1015,7 +917,7 @@ static int wake_or_create_thread(thread_group_t *thread_group)
idle thread to wakeup. Smells like a potential deadlock or very slowly
executing requests, e.g sleeps or user locks.
*/
- DBUG_RETURN(create_worker(thread_group));
+ DBUG_RETURN(create_worker(thread_group, due_to_stall));
}
ulonglong now = microsecond_interval_timer();
@@ -1026,9 +928,10 @@ static int wake_or_create_thread(thread_group_t *thread_group)
if (time_since_last_thread_created >
microsecond_throttling_interval(thread_group))
{
- DBUG_RETURN(create_worker(thread_group));
+ DBUG_RETURN(create_worker(thread_group, due_to_stall));
}
-
+
+ TP_INCREMENT_GROUP_COUNTER(thread_group,throttles);
DBUG_RETURN(-1);
}
@@ -1074,7 +977,7 @@ void thread_group_destroy(thread_group_t *thread_group)
Wake sleeping thread from waiting list
*/
-static int wake_thread(thread_group_t *thread_group)
+static int wake_thread(thread_group_t *thread_group,bool due_to_stall)
{
DBUG_ENTER("wake_thread");
worker_thread_t *thread = thread_group->waiting_threads.front();
@@ -1083,6 +986,11 @@ static int wake_thread(thread_group_t *thread_group)
thread->woken= true;
thread_group->waiting_threads.remove(thread);
mysql_cond_signal(&thread->cond);
+ TP_INCREMENT_GROUP_COUNTER(thread_group, wakes);
+ if (due_to_stall)
+ {
+ TP_INCREMENT_GROUP_COUNTER(thread_group, wakes_due_to_stall);
+ }
DBUG_RETURN(0);
}
DBUG_RETURN(1); /* no thread in waiter list => missed wakeup */
@@ -1140,7 +1048,7 @@ static void thread_group_close(thread_group_t *thread_group)
wake_listener(thread_group);
/* Wake all workers. */
- while(wake_thread(thread_group) == 0)
+ while(wake_thread(thread_group, false) == 0)
{
}
@@ -1162,7 +1070,7 @@ static void queue_put(thread_group_t *thread_group, TP_connection_generic *conne
{
DBUG_ENTER("queue_put");
- connection->dequeue_time= pool_timer.current_microtime;
+ connection->enqueue_time= threadpool_exact_stats?microsecond_interval_timer():pool_timer.current_microtime;
thread_group->queues[connection->priority].push_back(connection);
if (thread_group->active_thread_count == 0)
@@ -1224,7 +1132,10 @@ TP_connection_generic *get_event(worker_thread_t *current_thread,
{
connection = queue_get(thread_group);
if(connection)
+ {
+ TP_INCREMENT_GROUP_COUNTER(thread_group,dequeues_by_worker);
break;
+ }
}
/* If there is currently no listener in the group, become one. */
@@ -1235,7 +1146,10 @@ TP_connection_generic *get_event(worker_thread_t *current_thread,
mysql_mutex_unlock(&thread_group->mutex);
connection = listener(current_thread, thread_group);
-
+ if (connection)
+ {
+ TP_INCREMENT_GROUP_COUNTER(thread_group, dequeues_by_listener);
+ }
mysql_mutex_lock(&thread_group->mutex);
thread_group->active_thread_count++;
/* There is no listener anymore, it just returned. */
@@ -1251,9 +1165,9 @@ TP_connection_generic *get_event(worker_thread_t *current_thread,
*/
if (!oversubscribed)
{
-
native_event ev[MAX_EVENTS];
int cnt = io_poll_wait(thread_group->pollfd, ev, MAX_EVENTS, 0);
+ TP_INCREMENT_GROUP_COUNTER(thread_group, polls_by_worker);
if (cnt > 0)
{
queue_put(thread_group, ev, cnt);
@@ -1300,6 +1214,7 @@ TP_connection_generic *get_event(worker_thread_t *current_thread,
}
thread_group->stalled= false;
+
mysql_mutex_unlock(&thread_group->mutex);
DBUG_RETURN(connection);
@@ -1433,14 +1348,13 @@ TP_connection_generic::TP_connection_generic(CONNECT *c):
, overlapped()
#endif
{
- DBUG_ASSERT(c->vio);
+ DBUG_ASSERT(c->vio_type != VIO_CLOSED);
#ifdef _WIN32
- vio_type= c->vio->type;
- fd= (vio_type == VIO_TYPE_NAMEDPIPE) ?
- c->vio->hPipe: (TP_file_handle)mysql_socket_getfd(c->vio->mysql_socket);
+ fd= (c->vio_type == VIO_TYPE_NAMEDPIPE) ?
+ c->pipe: (TP_file_handle) mysql_socket_getfd(c->sock);
#else
- fd= mysql_socket_getfd(c->vio->mysql_socket);
+ fd= mysql_socket_getfd(c->sock);
#endif
/* Assign connection to a group. */
@@ -1516,7 +1430,7 @@ static int change_group(TP_connection_generic *c,
new_group->connection_count++;
/* Ensure that there is a listener in the new group. */
if (!new_group->thread_count)
- ret= create_worker(new_group);
+ ret= create_worker(new_group, false);
mysql_mutex_unlock(&new_group->mutex);
return ret;
}
@@ -1776,4 +1690,6 @@ static void print_pool_blocked_message(bool max_threads_reached)
}
}
+
+
#endif /* HAVE_POOL_OF_THREADS */
diff --git a/sql/threadpool_generic.h b/sql/threadpool_generic.h
new file mode 100644
index 00000000000..4b83e1d796f
--- /dev/null
+++ b/sql/threadpool_generic.h
@@ -0,0 +1,150 @@
+/* Copyright(C) 2019 MariaDB
+ *
+ * This program is free software; you can redistribute itand /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 02111 - 1301 USA*/
+
+#if defined (HAVE_POOL_OF_THREADS)
+#include <my_global.h>
+#include <sql_plist.h>
+#include <my_pthread.h>
+#include <threadpool.h>
+#include <mysqld.h>
+#include <violite.h>
+
+#ifdef _WIN32
+#include <windows.h>
+/* AIX may define this, too ?*/
+#define HAVE_IOCP
+#endif
+
+
+#ifdef _WIN32
+typedef HANDLE TP_file_handle;
+#else
+typedef int TP_file_handle;
+#define INVALID_HANDLE_VALUE -1
+#endif
+
+#ifdef __linux__
+#include <sys/epoll.h>
+typedef struct epoll_event native_event;
+#elif defined(HAVE_KQUEUE)
+#include <sys/event.h>
+typedef struct kevent native_event;
+#elif defined (__sun)
+#include <port.h>
+typedef port_event_t native_event;
+#elif defined (HAVE_IOCP)
+typedef OVERLAPPED_ENTRY native_event;
+#else
+#error threadpool is not available on this platform
+#endif
+
+struct thread_group_t;
+
+/* Per-thread structure for workers */
+struct worker_thread_t
+{
+ ulonglong event_count; /* number of request handled by this thread */
+ thread_group_t* thread_group;
+ worker_thread_t* next_in_list;
+ worker_thread_t** prev_in_list;
+ mysql_cond_t cond;
+ bool woken;
+};
+
+typedef I_P_List<worker_thread_t, I_P_List_adapter<worker_thread_t,
+ & worker_thread_t::next_in_list,
+ & worker_thread_t::prev_in_list>,
+ I_P_List_counter
+>
+worker_list_t;
+
+struct TP_connection_generic :public TP_connection
+{
+ TP_connection_generic(CONNECT* c);
+ ~TP_connection_generic();
+
+ virtual int init() { return 0; };
+ virtual void set_io_timeout(int sec);
+ virtual int start_io();
+ virtual void wait_begin(int type);
+ virtual void wait_end();
+
+ thread_group_t* thread_group;
+ TP_connection_generic* next_in_queue;
+ TP_connection_generic** prev_in_queue;
+ ulonglong abs_wait_timeout;
+ ulonglong enqueue_time;
+ TP_file_handle fd;
+ bool bound_to_poll_descriptor;
+ int waiting;
+#ifdef HAVE_IOCP
+ OVERLAPPED overlapped;
+#endif
+#ifdef _WIN32
+ enum_vio_type vio_type;
+#endif
+};
+
+
+typedef I_P_List<TP_connection_generic,
+ I_P_List_adapter<TP_connection_generic,
+ & TP_connection_generic::next_in_queue,
+ & TP_connection_generic::prev_in_queue>,
+ I_P_List_counter,
+ I_P_List_fast_push_back<TP_connection_generic> >
+ connection_queue_t;
+
+const int NQUEUES = 2; /* We have high and low priority queues*/
+
+struct thread_group_counters_t
+{
+ ulonglong thread_creations;
+ ulonglong thread_creations_due_to_stall;
+ ulonglong wakes;
+ ulonglong wakes_due_to_stall;
+ ulonglong throttles;
+ ulonglong stalls;
+ ulonglong dequeues_by_worker;
+ ulonglong dequeues_by_listener;
+ ulonglong polls_by_listener;
+ ulonglong polls_by_worker;
+};
+
+struct MY_ALIGNED(CPU_LEVEL1_DCACHE_LINESIZE) thread_group_t
+{
+ mysql_mutex_t mutex;
+ connection_queue_t queues[NQUEUES];
+ worker_list_t waiting_threads;
+ worker_thread_t* listener;
+ pthread_attr_t* pthread_attr;
+ TP_file_handle pollfd;
+ int thread_count;
+ int active_thread_count;
+ int connection_count;
+ /* Stats for the deadlock detection timer routine.*/
+ int io_event_count;
+ int queue_event_count;
+ ulonglong last_thread_creation_time;
+ int shutdown_pipe[2];
+ bool shutdown;
+ bool stalled;
+ thread_group_counters_t counters;
+};
+
+#define TP_INCREMENT_GROUP_COUNTER(group,var) group->counters.var++;
+
+extern thread_group_t* all_groups;
+#endif
+
diff --git a/sql/threadpool_win.cc b/sql/threadpool_win.cc
index 6e96fa8e11c..c9968d48c06 100644
--- a/sql/threadpool_win.cc
+++ b/sql/threadpool_win.cc
@@ -31,31 +31,6 @@
#include <threadpool.h>
#include <windows.h>
-
-
-/*
- WEAK_SYMBOL(return_type, function_name, argument_type1,..,argument_typeN)
-
- Declare and load function pointer from kernel32. The name of the static
- variable that holds the function pointer is my_<original function name>
- This should be combined with
- #define <original function name> my_<original function name>
- so that one could use Widows APIs transparently, without worrying whether
- they are present in a particular version or not.
-
- Of course, prior to use of any function there should be a check for correct
- Windows version, or check whether function pointer is not NULL.
-*/
-#define WEAK_SYMBOL(return_type, function, ...) \
- typedef return_type (WINAPI *pFN_##function)(__VA_ARGS__); \
- static pFN_##function my_##function = (pFN_##function) \
- (GetProcAddress(GetModuleHandle("kernel32"),#function))
-
-
-WEAK_SYMBOL(BOOL, SetThreadpoolStackInformation, PTP_POOL,
- PTP_POOL_STACK_INFORMATION);
-#define SetThreadpoolStackInformation my_SetThreadpoolStackInformation
-
/* Log a warning */
static void tp_log_warning(const char *msg, const char *fct)
{
@@ -167,15 +142,14 @@ int TP_connection_win::init()
{
memset(&overlapped, 0, sizeof(OVERLAPPED));
- Vio *vio = connect->vio;
- switch ((vio_type = vio->type))
+ switch ((vio_type = connect->vio_type))
{
case VIO_TYPE_SSL:
case VIO_TYPE_TCPIP:
- handle= (HANDLE)mysql_socket_getfd(vio->mysql_socket);
+ handle= (HANDLE) mysql_socket_getfd(connect->sock);
break;
case VIO_TYPE_NAMEDPIPE:
- handle= (HANDLE)vio->hPipe;
+ handle= connect->pipe;
break;
default:
abort();
@@ -452,19 +426,13 @@ int TP_pool_win::init()
}
}
- /*
- Control stack size (OS must be Win7 or later)
- */
- if (SetThreadpoolStackInformation)
+ TP_POOL_STACK_INFORMATION stackinfo;
+ stackinfo.StackCommit = 0;
+ stackinfo.StackReserve = (SIZE_T)my_thread_stack_size;
+ if (!SetThreadpoolStackInformation(pool, &stackinfo))
{
- TP_POOL_STACK_INFORMATION stackinfo;
- stackinfo.StackCommit = 0;
- stackinfo.StackReserve = (SIZE_T)my_thread_stack_size;
- if (!SetThreadpoolStackInformation(pool, &stackinfo))
- {
- tp_log_warning("Can't set threadpool stack size",
- "SetThreadpoolStackInformation");
- }
+ tp_log_warning("Can't set threadpool stack size",
+ "SetThreadpoolStackInformation");
}
return 0;
}
diff --git a/sql/unireg.cc b/sql/unireg.cc
index d019b5f8a75..7130b3e5d8a 100644
--- a/sql/unireg.cc
+++ b/sql/unireg.cc
@@ -152,6 +152,80 @@ static size_t extra2_str_size(size_t len)
return (len > 255 ? 3 : 1) + len;
}
+
+static uint gis_field_options_image(uchar *buff,
+ List<Create_field> &create_fields)
+{
+ uint image_size= 0;
+ List_iterator<Create_field> it(create_fields);
+ Create_field *field;
+ while ((field= it++))
+ {
+ if (field->real_field_type() != MYSQL_TYPE_GEOMETRY)
+ continue;
+ uchar *cbuf= buff ? buff + image_size : NULL;
+ image_size+= field->type_handler()->
+ Column_definition_gis_options_image(cbuf, *field);
+ }
+ return image_size;
+}
+
+
+class Field_data_type_info_image: public BinaryStringBuffer<512>
+{
+ static uchar *store_length(uchar *pos, ulonglong length)
+ {
+ return net_store_length(pos, length);
+ }
+ static uchar *store_string(uchar *pos, const LEX_CSTRING &str)
+ {
+ pos= store_length(pos, str.length);
+ memcpy(pos, str.str, str.length);
+ return pos + str.length;
+ }
+ static uint store_length_required_length(ulonglong length)
+ {
+ return net_length_size(length);
+ }
+public:
+ Field_data_type_info_image() { }
+ bool append(uint fieldnr, const Column_definition &def)
+ {
+ BinaryStringBuffer<64> type_info;
+ if (def.type_handler()->
+ Column_definition_data_type_info_image(&type_info, def) ||
+ type_info.length() > 0xFFFF/*Some reasonable limit*/)
+ return true; // Error
+ if (!type_info.length())
+ return false;
+ size_t need_length= store_length_required_length(fieldnr) +
+ store_length_required_length(type_info.length()) +
+ type_info.length();
+ if (reserve(need_length))
+ return true; // Error
+ uchar *pos= (uchar *) end();
+ pos= store_length(pos, fieldnr);
+ pos= store_string(pos, type_info.lex_cstring());
+ size_t new_length= (const char *) pos - ptr();
+ DBUG_ASSERT(new_length < alloced_length());
+ length((uint32) new_length);
+ return false;
+ }
+ bool append(List<Create_field> &fields)
+ {
+ uint fieldnr= 0;
+ Create_field *field;
+ List_iterator<Create_field> it(fields);
+ for (field= it++; field; field= it++, fieldnr++)
+ {
+ if (append(fieldnr, *field))
+ return true; // Error
+ }
+ return false;
+ }
+};
+
+
/**
Create a frm (table definition) file
@@ -191,6 +265,7 @@ LEX_CUSTRING build_frm_image(THD *thd, const LEX_CSTRING &table,
uchar *frm_ptr, *pos;
LEX_CUSTRING frm= {0,0};
StringBuffer<MAX_FIELD_WIDTH> vcols;
+ Field_data_type_info_image field_data_type_info_image;
DBUG_ENTER("build_frm_image");
/* If fixed row records, we need one bit to check for deleted rows */
@@ -241,11 +316,25 @@ LEX_CUSTRING build_frm_image(THD *thd, const LEX_CSTRING &table,
options_len= engine_table_options_frm_length(create_info->option_list,
create_fields,
keys, key_info);
-#ifdef HAVE_SPATIAL
gis_extra2_len= gis_field_options_image(NULL, create_fields);
-#endif /*HAVE_SPATIAL*/
DBUG_PRINT("info", ("Options length: %u", options_len));
+ if (field_data_type_info_image.append(create_fields))
+ {
+ my_printf_error(ER_CANT_CREATE_TABLE,
+ "Cannot create table %`s: "
+ "Building the field data type info image failed.",
+ MYF(0), table.str);
+ DBUG_RETURN(frm);
+ }
+ DBUG_PRINT("info", ("Field data type info length: %u",
+ (uint) field_data_type_info_image.length()));
+ DBUG_EXECUTE_IF("frm_data_type_info",
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
+ ER_UNKNOWN_ERROR,
+ "build_frm_image: Field data type info length: %u",
+ (uint) field_data_type_info_image.length()););
+
if (validate_comment_length(thd, &create_info->comment, TABLE_COMMENT_MAXLEN,
ER_TOO_LONG_TABLE_COMMENT, table.str))
DBUG_RETURN(frm);
@@ -291,6 +380,9 @@ LEX_CUSTRING build_frm_image(THD *thd, const LEX_CSTRING &table,
if (gis_extra2_len)
extra2_size+= 1 + extra2_str_size(gis_extra2_len);
+ if (field_data_type_info_image.length())
+ extra2_size+= 1 + extra2_str_size(field_data_type_info_image.length());
+
if (create_info->versioned())
{
extra2_size+= 1 + extra2_str_size(2 * frm_fieldno_size);
@@ -356,14 +448,28 @@ LEX_CUSTRING build_frm_image(THD *thd, const LEX_CSTRING &table,
create_fields, keys, key_info);
}
-#ifdef HAVE_SPATIAL
if (gis_extra2_len)
{
*pos= EXTRA2_GIS;
pos= extra2_write_len(pos+1, gis_extra2_len);
pos+= gis_field_options_image(pos, create_fields);
}
-#endif /*HAVE_SPATIAL*/
+
+ if (field_data_type_info_image.length())
+ {
+ if (field_data_type_info_image.length() > 0xFFFF)
+ {
+ my_printf_error(ER_CANT_CREATE_TABLE,
+ "Cannot create table %`s: "
+ "field data type info image is too large. "
+ "Decrease the number of columns with "
+ "extended data types.",
+ MYF(0), table.str);
+ goto err;
+ }
+ *pos= EXTRA2_FIELD_DATA_TYPE_INFO;
+ pos= extra2_write_str(pos + 1, field_data_type_info_image.lex_cstring());
+ }
// PERIOD
if (create_info->period_info.is_set())
@@ -722,6 +828,7 @@ static bool pack_header(THD *thd, uchar *forminfo,
if (field->charset->mbminlen > 1)
{
+ TYPELIB *tmpint;
/*
Escape UCS2 intervals using HEX notation to avoid
problems with delimiters between enum elements.
@@ -730,16 +837,17 @@ static bool pack_header(THD *thd, uchar *forminfo,
filled with default values it is saved in save_interval
The HEX representation is created from this copy.
*/
+ uint count= field->interval->count;
field->save_interval= field->interval;
- field->interval= (TYPELIB*) thd->alloc(sizeof(TYPELIB));
- *field->interval= *field->save_interval;
- field->interval->type_names=
- (const char **) thd->alloc(sizeof(char*) *
- (field->interval->count+1));
- field->interval->type_names[field->interval->count]= 0;
- field->interval->type_lengths=
- (uint *) thd->alloc(sizeof(uint) * field->interval->count);
-
+ field->interval= tmpint= (TYPELIB*) thd->alloc(sizeof(TYPELIB));
+ *tmpint= *field->save_interval;
+ tmpint->type_names=
+ (const char **) thd->alloc(sizeof(char*) *
+ (count + 1));
+ tmpint->type_lengths= (uint *) thd->alloc(sizeof(uint) * (count + 1));
+ tmpint->type_names[count]= 0;
+ tmpint->type_lengths[count]= 0;
+
for (uint pos= 0; pos < field->interval->count; pos++)
{
char *dst;
@@ -747,9 +855,8 @@ static bool pack_header(THD *thd, uchar *forminfo,
size_t hex_length;
length= field->save_interval->type_lengths[pos];
hex_length= length * 2;
- field->interval->type_lengths[pos]= (uint)hex_length;
- field->interval->type_names[pos]= dst=
- (char*) thd->alloc(hex_length + 1);
+ tmpint->type_lengths[pos]= (uint) hex_length;
+ tmpint->type_names[pos]= dst= (char*) thd->alloc(hex_length + 1);
octet2hex(dst, src, length);
}
}
@@ -813,7 +920,7 @@ static uint get_interval_id(uint *int_count,List<Create_field> &create_fields,
{
List_iterator<Create_field> it(create_fields);
Create_field *field;
- TYPELIB *interval=last_field->interval;
+ const TYPELIB *interval= last_field->interval;
while ((field=it++) != last_field)
{
diff --git a/sql/unireg.h b/sql/unireg.h
index 8e9fa27ea6a..419fbc4bd80 100644
--- a/sql/unireg.h
+++ b/sql/unireg.h
@@ -176,7 +176,8 @@ enum extra2_frm_value_type {
#define EXTRA2_ENGINE_IMPORTANT 128
EXTRA2_ENGINE_TABLEOPTS=128,
- EXTRA2_FIELD_FLAGS=129
+ EXTRA2_FIELD_FLAGS=129,
+ EXTRA2_FIELD_DATA_TYPE_INFO=130
};
enum extra2_field_flags {
diff --git a/sql/upgrade_conf_file.cc b/sql/upgrade_conf_file.cc
index 4e167f0263f..7219f948745 100644
--- a/sql/upgrade_conf_file.cc
+++ b/sql/upgrade_conf_file.cc
@@ -115,6 +115,7 @@ static const char *removed_variables[] =
"innodb_use_trim",
"log",
"log_slow_queries",
+"max_long_data_size",
"rpl_recovery_rank",
"sql_big_tables",
"sql_low_priority_updates",
diff --git a/sql/vers_string.h b/sql/vers_string.h
index 2349cc0cac1..bde3f0dffed 100644
--- a/sql/vers_string.h
+++ b/sql/vers_string.h
@@ -17,6 +17,8 @@
#ifndef VERS_STRING_INCLUDED
#define VERS_STRING_INCLUDED
+#include "lex_string.h"
+
/*
LEX_CSTRING with comparison semantics.
*/
@@ -45,31 +47,6 @@ struct Compare_identifiers
}
};
-class Lex_cstring : public LEX_CSTRING
-{
- public:
- Lex_cstring()
- {
- str= NULL;
- length= 0;
- }
- Lex_cstring(const char *_str, size_t _len)
- {
- str= _str;
- length= _len;
- }
- Lex_cstring(const char *start, const char *end)
- {
- DBUG_ASSERT(start <= end);
- str= start;
- length= end - start;
- }
- void set(const char *_str, size_t _len)
- {
- str= _str;
- length= _len;
- }
-};
template <class Compare>
struct Lex_cstring_with_compare : public Lex_cstring
diff --git a/sql/wsrep_applier.cc b/sql/wsrep_applier.cc
index fd51dbf9439..1ab65df1ca3 100644
--- a/sql/wsrep_applier.cc
+++ b/sql/wsrep_applier.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013-2015 Codership Oy <info@codership.com>
+/* Copyright (C) 2013-2019 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
@@ -24,7 +24,6 @@
#include "wsrep_trans_observer.h"
#include "slave.h" // opt_log_slave_updates
-#include "log_event.h" // class THD, EVENT_LEN_OFFSET, etc.
#include "debug_sync.h"
/*
@@ -60,7 +59,6 @@ static Log_event* wsrep_read_log_event(
}
#include "transaction.h" // trans_commit(), trans_rollback()
-#include "rpl_rli.h" // class Relay_log_info;
void wsrep_set_apply_format(THD* thd, Format_description_log_event* ev)
{
@@ -84,7 +82,7 @@ wsrep_get_apply_format(THD* thd)
return thd->wsrep_rgi->rli->relay_log.description_event_for_exec;
}
-void wsrep_apply_error::store(const THD* const thd)
+void wsrep_store_error(const THD* const thd, wsrep::mutable_buffer& dst)
{
Diagnostics_area::Sql_condition_iterator it=
thd->get_stmt_da()->sql_conditions();
@@ -92,27 +90,10 @@ void wsrep_apply_error::store(const THD* const thd)
static size_t const max_len= 2*MAX_SLAVE_ERRMSG; // 2x so that we have enough
- if (NULL == str_)
- {
- // this must be freeable by standard free()
- str_= static_cast<char*>(malloc(max_len));
- if (NULL == str_)
- {
- WSREP_ERROR("Failed to allocate %zu bytes for error buffer.", max_len);
- len_= 0;
- return;
- }
- }
- else
- {
- /* This is possible when we invoke rollback after failed applying.
- * In this situation DA should not be reset yet and should contain
- * all previous errors from applying and new ones from rollbacking,
- * so we just overwrite is from scratch */
- }
+ dst.resize(max_len);
- char* slider= str_;
- const char* const buf_end= str_ + max_len - 1; // -1: leave space for \0
+ char* slider= dst.data();
+ const char* const buf_end= slider + max_len - 1; // -1: leave space for \0
for (cond= it++; cond && slider < buf_end; cond= it++)
{
@@ -123,12 +104,17 @@ void wsrep_apply_error::store(const THD* const thd)
err_str, err_code);
}
- *slider= '\0';
- len_= slider - str_ + 1; // +1: add \0
+ if (slider != dst.data())
+ {
+ *slider= '\0';
+ slider++;
+ }
+
+ dst.resize(slider - dst.data());
- WSREP_DEBUG("Error buffer for thd %llu seqno %lld, %zu bytes: %s",
+ WSREP_DEBUG("Error buffer for thd %llu seqno %lld, %zu bytes: '%s'",
thd->thread_id, (long long)wsrep_thd_trx_seqno(thd),
- len_, str_ ? str_ : "(null)");
+ dst.size(), dst.size() ? dst.data() : "(null)");
}
int wsrep_apply_events(THD* thd,
diff --git a/sql/wsrep_applier.h b/sql/wsrep_applier.h
index 70361987cc7..fefca306a70 100644
--- a/sql/wsrep_applier.h
+++ b/sql/wsrep_applier.h
@@ -1,4 +1,4 @@
-/* Copyright 2013-2015 Codership Oy <http://www.codership.com>
+/* Copyright 2013-2019 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
@@ -16,16 +16,15 @@
#ifndef WSREP_APPLIER_H
#define WSREP_APPLIER_H
-#include <my_config.h>
-
#include "sql_class.h" // THD class
+#include "rpl_rli.h" // Relay_log_info
+#include "log_event.h" // Format_description_log_event
int wsrep_apply_events(THD* thd,
Relay_log_info* rli,
const void* events_buf,
size_t buf_len);
-
/* Applier error codes, when nothing better is available. */
#define WSREP_RET_SUCCESS 0 // Success
#define WSREP_ERR_GENERIC 1 // When in doubt (MySQL default error code)
@@ -36,38 +35,10 @@ int wsrep_apply_events(THD* thd,
#define WSREP_ERR_FAILED 6 // Operation failed for some internal reason
#define WSREP_ERR_ABORTED 7 // Operation was aborted externally
-class wsrep_apply_error
-{
-public:
- wsrep_apply_error() : str_(NULL), len_(0) {};
- ~wsrep_apply_error() { ::free(str_); }
- /* stores the current THD error info from the diagnostic area. Works only
- * once, subsequent invocations are ignored in order to preserve the original
- * condition. */
- void store(const THD* thd);
- const char* c_str() const { return str_; }
- size_t length() const { return len_; }
- bool is_null() const { return (c_str() == NULL && length() == 0); }
- wsrep_buf_t get_buf() const
- {
- wsrep_buf_t ret= { c_str(), length() };
- return ret;
- }
-private:
- char* str_;
- size_t len_;
-};
+void wsrep_store_error(const THD* thd, wsrep::mutable_buffer& buf);
class Format_description_log_event;
void wsrep_set_apply_format(THD*, Format_description_log_event*);
Format_description_log_event* wsrep_get_apply_format(THD* thd);
-int wsrep_apply(void* ctx,
- uint32_t flags,
- const wsrep_buf_t* buf,
- const wsrep_trx_meta_t* meta,
- wsrep_apply_error& err);
-
-wsrep_cb_status_t wsrep_unordered_cb(void* ctx,
- const wsrep_buf_t* data);
#endif /* WSREP_APPLIER_H */
diff --git a/sql/wsrep_binlog.cc b/sql/wsrep_binlog.cc
index ecab4664d7b..cfa709b1055 100644
--- a/sql/wsrep_binlog.cc
+++ b/sql/wsrep_binlog.cc
@@ -417,7 +417,9 @@ void wsrep_register_for_group_commit(THD *thd)
void wsrep_unregister_from_group_commit(THD *thd)
{
- DBUG_ASSERT(thd->wsrep_trx().state() == wsrep::transaction::s_ordered_commit);
+ DBUG_ASSERT(thd->wsrep_trx().state() == wsrep::transaction::s_ordered_commit||
+ // ordered_commit() failure results in s_aborting state
+ thd->wsrep_trx().state() == wsrep::transaction::s_aborting);
wait_for_commit *wfc= thd->wait_for_commit_ptr;
if (wfc)
diff --git a/sql/wsrep_client_service.cc b/sql/wsrep_client_service.cc
index 5f73f9f714f..8d58f62bd03 100644
--- a/sql/wsrep_client_service.cc
+++ b/sql/wsrep_client_service.cc
@@ -15,7 +15,6 @@
#include "wsrep_client_service.h"
#include "wsrep_high_priority_service.h"
-#include "wsrep_applier.h" /* wsrep_apply_events() */
#include "wsrep_binlog.h" /* wsrep_dump_rbr_buf() */
#include "wsrep_schema.h" /* remove_fragments() */
#include "wsrep_thd.h"
diff --git a/sql/wsrep_dummy.cc b/sql/wsrep_dummy.cc
index 75ee9b04cdf..2ea434c092b 100644
--- a/sql/wsrep_dummy.cc
+++ b/sql/wsrep_dummy.cc
@@ -138,3 +138,9 @@ void wsrep_commit_ordered(THD* )
my_bool wsrep_thd_is_applying(const THD*)
{ return 0;}
+
+my_bool wsrep_thd_has_ignored_error(const THD*)
+{ return 0;}
+
+void wsrep_thd_set_ignored_error(THD*, my_bool)
+{ }
diff --git a/sql/wsrep_high_priority_service.cc b/sql/wsrep_high_priority_service.cc
index 3077985250d..84c89ccb705 100644
--- a/sql/wsrep_high_priority_service.cc
+++ b/sql/wsrep_high_priority_service.cc
@@ -119,6 +119,23 @@ static void wsrep_setup_uk_and_fk_checks(THD* thd)
thd->variables.option_bits&= ~OPTION_NO_FOREIGN_KEY_CHECKS;
}
+static int apply_events(THD* thd,
+ Relay_log_info* rli,
+ const wsrep::const_buffer& data,
+ wsrep::mutable_buffer& err)
+{
+ int const ret= wsrep_apply_events(thd, rli, data.data(), data.size());
+ if (ret || wsrep_thd_has_ignored_error(thd))
+ {
+ if (ret)
+ {
+ wsrep_store_error(thd, err);
+ }
+ wsrep_dump_rbr_buf_with_header(thd, data.data(), data.size());
+ }
+ return ret;
+}
+
/****************************************************************************
High priority service
*****************************************************************************/
@@ -247,8 +264,8 @@ int Wsrep_high_priority_service::append_fragment_and_commit(
common utility function to deal with commit.
*/
const bool do_binlog_commit= (opt_log_slave_updates &&
- wsrep_gtid_mode &&
- m_thd->variables.gtid_seq_no);
+ wsrep_gtid_mode &&
+ m_thd->variables.gtid_seq_no);
/*
Write skip event into binlog if gtid_mode is on. This is to
maintain gtid continuity.
@@ -265,8 +282,7 @@ int Wsrep_high_priority_service::append_fragment_and_commit(
}
ret= ret || trans_commit(m_thd);
-
- m_thd->wsrep_cs().after_applying();
+ ret= ret || (m_thd->wsrep_cs().after_applying(), 0);
m_thd->mdl_context.release_transactional_locks();
thd_proc_info(m_thd, "wsrep applier committed");
@@ -335,7 +351,15 @@ int Wsrep_high_priority_service::rollback(const wsrep::ws_handle& ws_handle,
const wsrep::ws_meta& ws_meta)
{
DBUG_ENTER("Wsrep_high_priority_service::rollback");
- m_thd->wsrep_cs().prepare_for_ordering(ws_handle, ws_meta, false);
+ if (ws_meta.ordered())
+ {
+ m_thd->wsrep_cs().prepare_for_ordering(ws_handle, ws_meta, false);
+ }
+ else
+ {
+ assert(ws_meta == wsrep::ws_meta());
+ assert(ws_handle == wsrep::ws_handle());
+ }
int ret= (trans_rollback_stmt(m_thd) || trans_rollback(m_thd));
m_thd->mdl_context.release_transactional_locks();
m_thd->mdl_context.release_explicit_locks();
@@ -344,7 +368,7 @@ int Wsrep_high_priority_service::rollback(const wsrep::ws_handle& ws_handle,
int Wsrep_high_priority_service::apply_toi(const wsrep::ws_meta& ws_meta,
const wsrep::const_buffer& data,
- wsrep::mutable_buffer&)
+ wsrep::mutable_buffer& err)
{
DBUG_ENTER("Wsrep_high_priority_service::apply_toi");
THD* thd= m_thd;
@@ -358,13 +382,8 @@ int Wsrep_high_priority_service::apply_toi(const wsrep::ws_meta& ws_meta,
WSREP_DEBUG("Wsrep_high_priority_service::apply_toi: %lld",
client_state.toi_meta().seqno().get());
- int ret= wsrep_apply_events(thd, m_rli, data.data(), data.size());
- if (ret != 0 || thd->wsrep_has_ignored_error)
- {
- wsrep_dump_rbr_buf_with_header(thd, data.data(), data.size());
- thd->wsrep_has_ignored_error= false;
- /* todo: error voting */
- }
+ int ret= apply_events(thd, m_rli, data, err);
+ wsrep_thd_set_ignored_error(thd, false);
trans_commit(thd);
thd->close_temporary_tables();
@@ -428,6 +447,11 @@ int Wsrep_high_priority_service::log_dummy_write_set(const wsrep::ws_handle& ws_
DBUG_RETURN(ret);
}
+void Wsrep_high_priority_service::adopt_apply_error(wsrep::mutable_buffer& err)
+{
+ m_thd->wsrep_cs().adopt_apply_error(err);
+}
+
void Wsrep_high_priority_service::debug_crash(const char* crash_point)
{
DBUG_ASSERT(m_thd == current_thd);
@@ -459,7 +483,7 @@ Wsrep_applier_service::~Wsrep_applier_service()
int Wsrep_applier_service::apply_write_set(const wsrep::ws_meta& ws_meta,
const wsrep::const_buffer& data,
- wsrep::mutable_buffer&)
+ wsrep::mutable_buffer& err)
{
DBUG_ENTER("Wsrep_applier_service::apply_write_set");
THD* thd= m_thd;
@@ -485,13 +509,7 @@ int Wsrep_applier_service::apply_write_set(const wsrep::ws_meta& ws_meta,
};);
wsrep_setup_uk_and_fk_checks(thd);
-
- int ret= wsrep_apply_events(thd, m_rli, data.data(), data.size());
-
- if (ret || thd->wsrep_has_ignored_error)
- {
- wsrep_dump_rbr_buf_with_header(thd, data.data(), data.size());
- }
+ int ret= apply_events(thd, m_rli, data, err);
thd->close_temporary_tables();
if (!ret && !(ws_meta.flags() & wsrep::provider::flag::commit))
@@ -617,7 +635,7 @@ Wsrep_replayer_service::~Wsrep_replayer_service()
int Wsrep_replayer_service::apply_write_set(const wsrep::ws_meta& ws_meta,
const wsrep::const_buffer& data,
- wsrep::mutable_buffer&)
+ wsrep::mutable_buffer& err)
{
DBUG_ENTER("Wsrep_replayer_service::apply_write_set");
THD* thd= m_thd;
@@ -636,14 +654,7 @@ int Wsrep_replayer_service::apply_write_set(const wsrep::ws_meta& ws_meta,
ws_meta,
thd->wsrep_sr().fragments());
}
-
- ret= ret || wsrep_apply_events(thd, m_rli, data.data(), data.size());
-
- if (ret || thd->wsrep_has_ignored_error)
- {
- wsrep_dump_rbr_buf_with_header(thd, data.data(), data.size());
- }
-
+ ret= ret || apply_events(thd, m_rli, data, err);
thd->close_temporary_tables();
if (!ret && !(ws_meta.flags() & wsrep::provider::flag::commit))
{
diff --git a/sql/wsrep_high_priority_service.h b/sql/wsrep_high_priority_service.h
index c8c5eb87f44..5657a2e82fc 100644
--- a/sql/wsrep_high_priority_service.h
+++ b/sql/wsrep_high_priority_service.h
@@ -17,7 +17,6 @@
#define WSREP_HIGH_PRIORITY_SERVICE_H
#include "wsrep/high_priority_service.hpp"
-#include "wsrep/client_state.hpp"
#include "my_global.h"
#include "sql_error.h" /* Diagnostics area */
#include "sql_class.h" /* rpl_group_info */
@@ -53,7 +52,7 @@ public:
int log_dummy_write_set(const wsrep::ws_handle&,
const wsrep::ws_meta&,
wsrep::mutable_buffer&);
- void adopt_apply_error(wsrep::mutable_buffer& err) {}
+ void adopt_apply_error(wsrep::mutable_buffer&);
virtual bool check_exit_status() const = 0;
void debug_crash(const char*);
@@ -74,7 +73,7 @@ protected:
my_hrtime_t user_time;
longlong row_count_func;
bool wsrep_applier;
-} m_shadow;
+ } m_shadow;
};
class Wsrep_applier_service : public Wsrep_high_priority_service
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc
index 2ccb94e9528..a6f9d3a6b17 100644
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@ -280,7 +280,7 @@ static void wsrep_log_cb(wsrep::log::level level, const char *msg)
sql_print_warning("WSREP: %s", msg);
break;
case wsrep::log::error:
- sql_print_error("WSREP: %s", msg);
+ sql_print_error("WSREP: %s", msg);
break;
case wsrep::log::debug:
if (wsrep_debug) sql_print_information ("[Debug] WSREP: %s", msg);
@@ -1806,13 +1806,16 @@ static void wsrep_TOI_begin_failed(THD* thd, const wsrep_buf_t* /* const err */)
if (wsrep_emulate_bin_log) wsrep_thd_binlog_trx_reset(thd);
if (wsrep_write_dummy_event(thd, "TOI begin failed")) { goto fail; }
wsrep::client_state& cs(thd->wsrep_cs());
- int const ret= cs.leave_toi_local(wsrep::mutable_buffer());
+ std::string const err(wsrep::to_c_string(cs.current_error()));
+ wsrep::mutable_buffer err_buf;
+ err_buf.push_back(err);
+ int const ret= cs.leave_toi_local(err_buf);
if (ret)
{
WSREP_ERROR("Leaving critical section for failed TOI failed: thd: %lld, "
"schema: %s, SQL: %s, rcode: %d wsrep_error: %s",
(long long)thd->real_id, thd->db.str,
- thd->query(), ret, wsrep::to_c_string(cs.current_error()));
+ thd->query(), ret, err.c_str());
goto fail;
}
}
@@ -1933,7 +1936,12 @@ static void wsrep_TOI_end(THD *thd) {
if (wsrep_thd_is_local_toi(thd))
{
wsrep_set_SE_checkpoint(client_state.toi_meta().gtid());
- int ret= client_state.leave_toi_local(wsrep::mutable_buffer());
+ wsrep::mutable_buffer err;
+ if (thd->is_error() && !wsrep_must_ignore_error(thd))
+ {
+ wsrep_store_error(thd, err);
+ }
+ int const ret= client_state.leave_toi_local(err);
if (!ret)
{
WSREP_DEBUG("TO END: %lld", client_state.toi_meta().seqno().get());
@@ -2426,7 +2434,7 @@ int wsrep_must_ignore_error(THD* thd)
const uint flags= sql_command_flags[thd->lex->sql_command];
DBUG_ASSERT(error);
- DBUG_ASSERT(wsrep_thd_is_toi(thd) || wsrep_thd_is_applying(thd));
+ DBUG_ASSERT(wsrep_thd_is_toi(thd));
if ((wsrep_ignore_apply_errors & WSREP_IGNORE_ERRORS_ON_DDL))
goto ignore_error;
@@ -2644,13 +2652,6 @@ void* start_wsrep_THD(void *arg)
mysql_thread_set_psi_id(thd->thread_id);
thd->thr_create_utime= microsecond_interval_timer();
- if (MYSQL_CALLBACK_ELSE(thread_scheduler, init_new_connection_thread, (), 0))
- {
- close_connection(thd, ER_OUT_OF_RESOURCES);
- statistic_increment(aborted_connects,&LOCK_status);
- MYSQL_CALLBACK(thread_scheduler, end_thread, (thd, 0));
- goto error;
- }
// </5.1.17>
/*
@@ -2671,7 +2672,7 @@ void* start_wsrep_THD(void *arg)
{
close_connection(thd, ER_OUT_OF_RESOURCES);
statistic_increment(aborted_connects,&LOCK_status);
- MYSQL_CALLBACK(thread_scheduler, end_thread, (thd, 0));
+ unlink_thd(thd);
delete thd;
delete thd_args;
goto error;
@@ -2747,7 +2748,7 @@ void* start_wsrep_THD(void *arg)
if (plugins_are_initialized)
{
net_end(&thd->net);
- MYSQL_CALLBACK(thread_scheduler, end_thread, (thd, 1));
+ unlink_thd(thd);
}
else
{
@@ -2756,9 +2757,9 @@ void* start_wsrep_THD(void *arg)
'Error in my_thread_global_end(): 2 threads didn't exit'
at server shutdown
*/
+ server_threads.erase(thd);
}
- server_threads.erase(thd);
delete thd;
my_thread_end();
return(NULL);
@@ -2797,3 +2798,54 @@ bool wsrep_consistency_check(THD *thd)
{
return thd->wsrep_consistency_check == CONSISTENCY_CHECK_RUNNING;
}
+
+
+/*
+ Commit an empty transaction.
+
+ If the transaction is real and the wsrep transaction is still active,
+ the transaction did not generate any rows or keys and is committed
+ as empty. Here the wsrep transaction is rolled back and after statement
+ step is performed to leave the wsrep transaction in the state as it
+ never existed.
+
+ This should not be an inline functions as it requires a lot of stack space
+ because of WSREP_DBUG() usage. It's also not a function that is
+ frequently called.
+*/
+
+void wsrep_commit_empty(THD* thd, bool all)
+{
+ DBUG_ENTER("wsrep_commit_empty");
+ WSREP_DEBUG("wsrep_commit_empty(%llu)", thd->thread_id);
+ if (wsrep_is_real(thd, all) &&
+ wsrep_thd_is_local(thd) &&
+ thd->wsrep_trx().active() &&
+ thd->wsrep_trx().state() != wsrep::transaction::s_committed)
+ {
+ /* @todo CTAS with STATEMENT binlog format and empty result set
+ seems to be committing empty. Figure out why and try to fix
+ elsewhere. */
+ DBUG_ASSERT(!wsrep_has_changes(thd) ||
+ (thd->lex->sql_command == SQLCOM_CREATE_TABLE &&
+ !thd->is_current_stmt_binlog_format_row()));
+ bool have_error= wsrep_current_error(thd);
+ int ret= wsrep_before_rollback(thd, all) ||
+ wsrep_after_rollback(thd, all) ||
+ wsrep_after_statement(thd);
+ /* The committing transaction was empty but it held some locks and
+ got BF aborted. As there were no certified changes in the
+ data, we ignore the deadlock error and rely on error reporting
+ by storage engine/server. */
+ if (!ret && !have_error && wsrep_current_error(thd))
+ {
+ DBUG_ASSERT(wsrep_current_error(thd) == wsrep::e_deadlock_error);
+ thd->wsrep_cs().reset_error();
+ }
+ if (ret)
+ {
+ WSREP_DEBUG("wsrep_commit_empty failed: %d", wsrep_current_error(thd));
+ }
+ }
+ DBUG_VOID_RETURN;
+}
diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h
index d71d4afea11..497e5f7a086 100644
--- a/sql/wsrep_mysqld.h
+++ b/sql/wsrep_mysqld.h
@@ -251,14 +251,14 @@ extern wsrep_seqno_t wsrep_locked_seqno;
} while(0)
#define WSREP_DEBUG(...) \
- if (wsrep_debug) WSREP_LOG(sql_print_information, ##__VA_ARGS__)
-#define WSREP_INFO(...) WSREP_LOG(sql_print_information, ##__VA_ARGS__)
-#define WSREP_WARN(...) WSREP_LOG(sql_print_warning, ##__VA_ARGS__)
-#define WSREP_ERROR(...) WSREP_LOG(sql_print_error, ##__VA_ARGS__)
+ if (wsrep_debug) sql_print_information( "WSREP: " __VA_ARGS__)
+#define WSREP_INFO(...) sql_print_information( "WSREP: " __VA_ARGS__)
+#define WSREP_WARN(...) sql_print_warning( "WSREP: " __VA_ARGS__)
+#define WSREP_ERROR(...) sql_print_error( "WSREP: " __VA_ARGS__)
#define WSREP_LOG_CONFLICT_THD(thd, role) \
- WSREP_LOG(sql_print_information, \
- "%s: \n " \
+ sql_print_information( \
+ "WSREP: %s: \n " \
" THD: %lu, mode: %s, state: %s, conflict: %s, seqno: %lld\n " \
" SQL: %s", \
role, \
@@ -273,12 +273,12 @@ extern wsrep_seqno_t wsrep_locked_seqno;
#define WSREP_LOG_CONFLICT(bf_thd, victim_thd, bf_abort) \
if (wsrep_debug || wsrep_log_conflicts) \
{ \
- WSREP_LOG(sql_print_information, "cluster conflict due to %s for threads:", \
+ sql_print_information( "WSREP: cluster conflict due to %s for threads:", \
(bf_abort) ? "high priority abort" : "certification failure" \
); \
if (bf_thd) WSREP_LOG_CONFLICT_THD(bf_thd, "Winning thread"); \
if (victim_thd) WSREP_LOG_CONFLICT_THD(victim_thd, "Victim thread"); \
- WSREP_LOG(sql_print_information, "context: %s:%d", __FILE__, __LINE__); \
+ sql_print_information("WSREP: context: %s:%d", __FILE__, __LINE__); \
}
#define WSREP_PROVIDER_EXISTS \
diff --git a/sql/wsrep_schema.cc b/sql/wsrep_schema.cc
index 066ea124fb7..c7ea378d4fb 100644
--- a/sql/wsrep_schema.cc
+++ b/sql/wsrep_schema.cc
@@ -1295,7 +1295,7 @@ int Wsrep_schema::recover_sr_transactions(THD *orig_thd)
goto out;
}
- while (true)
+ while (0 == error)
{
if ((error= Wsrep_schema_impl::next_record(frag_table)) == 0)
{
@@ -1345,19 +1345,23 @@ int Wsrep_schema::recover_sr_transactions(THD *orig_thd)
}
applier->store_globals();
wsrep::mutable_buffer unused;
- applier->apply_write_set(ws_meta, data, unused);
- applier->after_apply();
+ if ((ret= applier->apply_write_set(ws_meta, data, unused)) != 0)
+ {
+ WSREP_ERROR("SR trx recovery applying returned %d", ret);
+ }
+ else
+ {
+ applier->after_apply();
+ }
storage_service.store_globals();
}
else if (error == HA_ERR_END_OF_FILE)
{
ret= 0;
- break;
}
else
{
WSREP_ERROR("SR table scan returned error %d", error);
- break;
}
}
Wsrep_schema_impl::end_scan(frag_table);
diff --git a/sql/wsrep_trans_observer.h b/sql/wsrep_trans_observer.h
index 6bb26c40064..b8ce7eb42d0 100644
--- a/sql/wsrep_trans_observer.h
+++ b/sql/wsrep_trans_observer.h
@@ -26,6 +26,8 @@
class THD;
+void wsrep_commit_empty(THD* thd, bool all);
+
/*
Return true if THD has active wsrep transaction.
*/
@@ -290,9 +292,7 @@ static inline int wsrep_before_commit(THD* thd, bool all)
Return zero on succes, non-zero on failure.
*/
-static inline int wsrep_ordered_commit(THD* thd,
- bool all,
- const wsrep_apply_error&)
+static inline int wsrep_ordered_commit(THD* thd, bool all)
{
DBUG_ENTER("wsrep_ordered_commit");
WSREP_DEBUG("wsrep_ordered_commit: %d", wsrep_is_real(thd, all));
@@ -477,50 +477,4 @@ wsrep_current_error_status(THD* thd)
return thd->wsrep_cs().current_error_status();
}
-
-/*
- Commit an empty transaction.
-
- If the transaction is real and the wsrep transaction is still active,
- the transaction did not generate any rows or keys and is committed
- as empty. Here the wsrep transaction is rolled back and after statement
- step is performed to leave the wsrep transaction in the state as it
- never existed.
-*/
-static inline void wsrep_commit_empty(THD* thd, bool all)
-{
- DBUG_ENTER("wsrep_commit_empty");
- WSREP_DEBUG("wsrep_commit_empty(%llu)", thd->thread_id);
- if (wsrep_is_real(thd, all) &&
- wsrep_thd_is_local(thd) &&
- thd->wsrep_trx().active() &&
- thd->wsrep_trx().state() != wsrep::transaction::s_committed)
- {
- /* @todo CTAS with STATEMENT binlog format and empty result set
- seems to be committing empty. Figure out why and try to fix
- elsewhere. */
- DBUG_ASSERT(!wsrep_has_changes(thd) ||
- (thd->lex->sql_command == SQLCOM_CREATE_TABLE &&
- !thd->is_current_stmt_binlog_format_row()));
- bool have_error= wsrep_current_error(thd);
- int ret= wsrep_before_rollback(thd, all) ||
- wsrep_after_rollback(thd, all) ||
- wsrep_after_statement(thd);
- /* The committing transaction was empty but it held some locks and
- got BF aborted. As there were no certified changes in the
- data, we ignore the deadlock error and rely on error reporting
- by storage engine/server. */
- if (!ret && !have_error && wsrep_current_error(thd))
- {
- DBUG_ASSERT(wsrep_current_error(thd) == wsrep::e_deadlock_error);
- thd->wsrep_cs().reset_error();
- }
- if (ret)
- {
- WSREP_DEBUG("wsrep_commit_empty failed: %d", wsrep_current_error(thd));
- }
- }
- DBUG_VOID_RETURN;
-}
-
#endif /* WSREP_TRANS_OBSERVER */
diff --git a/sql/xa.cc b/sql/xa.cc
index 9ee1cefbaf9..3ead73fe1e1 100644
--- a/sql/xa.cc
+++ b/sql/xa.cc
@@ -814,7 +814,7 @@ static my_bool xa_recover_callback_verbose(XID_cache_element *xs,
char buf[SQL_XIDSIZE];
uint len= get_sql_xid(&xs->xid, buf);
return xa_recover_callback(xs, protocol, buf, len,
- &my_charset_utf8_general_ci);
+ &my_charset_utf8mb3_general_ci);
}
@@ -842,7 +842,7 @@ bool mysql_xa_recover(THD *thd)
if (thd->lex->verbose)
{
len= SQL_XIDSIZE;
- cs= &my_charset_utf8_general_ci;
+ cs= &my_charset_utf8mb3_general_ci;
action= (my_hash_walk_action) xa_recover_callback_verbose;
}
else
diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc
index fa49b081ad1..0b352589fe3 100644
--- a/storage/archive/ha_archive.cc
+++ b/storage/archive/ha_archive.cc
@@ -215,7 +215,6 @@ int archive_db_init(void *p)
#endif
archive_hton= (handlerton *)p;
- archive_hton->state= SHOW_OPTION_YES;
archive_hton->db_type= DB_TYPE_ARCHIVE_DB;
archive_hton->create= archive_create_handler;
archive_hton->flags= HTON_NO_FLAGS;
diff --git a/storage/blackhole/ha_blackhole.cc b/storage/blackhole/ha_blackhole.cc
index 1b64db142e0..c7803003398 100644
--- a/storage/blackhole/ha_blackhole.cc
+++ b/storage/blackhole/ha_blackhole.cc
@@ -398,7 +398,6 @@ static int blackhole_init(void *p)
#endif
blackhole_hton= (handlerton *)p;
- blackhole_hton->state= SHOW_OPTION_YES;
blackhole_hton->db_type= DB_TYPE_BLACKHOLE_DB;
blackhole_hton->create= blackhole_create_handler;
blackhole_hton->flags= HTON_CAN_RECREATE;
diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc
index f081dca71c3..410150b088f 100644
--- a/storage/cassandra/ha_cassandra.cc
+++ b/storage/cassandra/ha_cassandra.cc
@@ -245,7 +245,6 @@ static int cassandra_init_func(void *p)
(void) my_hash_init(&cassandra_open_tables,system_charset_info,32,0,0,
(my_hash_get_key) cassandra_get_key,0,0);
- cassandra_hton->state= SHOW_OPTION_YES;
cassandra_hton->create= cassandra_create_handler;
/*
Don't specify HTON_CAN_RECREATE in flags. re-create is used by TRUNCATE
@@ -1105,7 +1104,7 @@ bool cassandra_to_dyncol_strUTF8(const char *cass_data,
MEM_ROOT *mem_root __attribute__((unused)))
{
return cassandra_to_dyncol_strStr(cass_data, cass_data_len, value,
- &my_charset_utf8_unicode_ci);
+ &my_charset_utf8mb3_unicode_ci);
}
bool dyncol_to_cassandraUTF8(DYNAMIC_COLUMN_VALUE *value,
@@ -1113,7 +1112,7 @@ bool dyncol_to_cassandraUTF8(DYNAMIC_COLUMN_VALUE *value,
void* buff, void **freemem)
{
return dyncol_to_cassandraStr(value, cass_data, cass_data_len,
- buff, freemem, &my_charset_utf8_unicode_ci);
+ buff, freemem, &my_charset_utf8mb3_unicode_ci);
}
bool cassandra_to_dyncol_strUUID(const char *cass_data,
diff --git a/storage/connect/CMakeLists.txt b/storage/connect/CMakeLists.txt
index 133892b5755..b44258836c8 100644
--- a/storage/connect/CMakeLists.txt
+++ b/storage/connect/CMakeLists.txt
@@ -126,10 +126,6 @@ ENDIF(CONNECT_WITH_LIBXML2)
IF(WIN32)
- # /MP option of the Microsoft compiler does not work well with COM #import
- string(REPLACE "/MP" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
- string(REPLACE "/MP" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
-
OPTION(CONNECT_WITH_MSXML "Compile CONNECT storage engine with MSXML support" ON)
IF(CONNECT_WITH_MSXML)
add_definitions(-DMSX6 -DDOMDOC_SUPPORT)
@@ -360,6 +356,19 @@ IF(NOT TARGET connect)
RETURN()
ENDIF()
+IF(MSVC AND (CMAKE_CXX_FLAGS MATCHES "/MP"))
+ # domdoc.cpp uses compiler directive #import which is not compatible
+ # with the /MP option, resulting in compiler error C2813.
+ # Remove /MP for this file.
+ SET(src_list ${CONNECT_SOURCES})
+ LIST(FIND src_list domdoc.cpp idx)
+ IF(idx GREATER -1)
+ STRING(REPLACE "/MP" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+ LIST(REMOVE_AT src_list ${idx})
+ SET_SOURCE_FILES_PROPERTIES(${src_list} PROPERTIES COMPILE_FLAGS "/MP")
+ ENDIF()
+ENDIF()
+
IF(WIN32)
IF (libmongoc-1.0_FOUND)
SET_TARGET_PROPERTIES(connect PROPERTIES LINK_FLAGS
@@ -376,6 +385,7 @@ IF(MSVC)
# Temporarily disable "conversion from size_t .."
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267")
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4267")
ENDIF()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4996")
string(REPLACE "/permissive-" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
diff --git a/storage/connect/colblk.cpp b/storage/connect/colblk.cpp
index a9cf43f3d96..44383d584a8 100644
--- a/storage/connect/colblk.cpp
+++ b/storage/connect/colblk.cpp
@@ -79,15 +79,15 @@ COLBLK::COLBLK(PCOL col1, PTDB tdbp)
if (trace(2))
htrc(" copying COLBLK %s from %p to %p\n", Name, col1, this);
- if (tdbp)
+ if (tdbp) {
// Attach the new column to the table block
- if (!tdbp->GetColumns())
+ if (!tdbp->GetColumns()) {
tdbp->SetColumns(this);
- else {
+ } else {
for (colp = tdbp->GetColumns(); colp->Next; colp = colp->Next) ;
-
colp->Next = this;
- } // endelse
+ } // endelse
+ }
} // end of COLBLK copy constructor
diff --git a/storage/connect/connect.cc b/storage/connect/connect.cc
index b1078de8eaa..f1227248240 100644
--- a/storage/connect/connect.cc
+++ b/storage/connect/connect.cc
@@ -642,7 +642,7 @@ int CntIndexInit(PGLOBAL g, PTDB ptdb, int id, bool sorted)
// This is a pseudo indexed sorted block optimized column
// return 0;
- if (tdbp->To_Kindex)
+ if (tdbp->To_Kindex) {
if (((XXBASE*)tdbp->To_Kindex)->GetID() == id) {
tdbp->To_Kindex->Reset(); // Same index
return (tdbp->To_Kindex->IsMul()) ? 2 : 1;
@@ -650,6 +650,7 @@ int CntIndexInit(PGLOBAL g, PTDB ptdb, int id, bool sorted)
tdbp->To_Kindex->Close();
tdbp->To_Kindex= NULL;
} // endif colp
+ }
for (xdp= dfp->To_Indx; xdp; xdp= xdp->GetNext())
if (xdp->GetID() == id)
diff --git a/storage/connect/filamdbf.cpp b/storage/connect/filamdbf.cpp
index c8bab2b53a4..253ed96a044 100644
--- a/storage/connect/filamdbf.cpp
+++ b/storage/connect/filamdbf.cpp
@@ -253,7 +253,7 @@ PQRYRES DBFColumns(PGLOBAL g, PCSZ dp, PCSZ fn, bool info)
mainhead.Encryptflag, mainhead.Mdxflag, mainhead.Language);
htrc("%hd records, last changed %02d/%02d/%d\n",
mainhead.Records(), mainhead.Filedate[1], mainhead.Filedate[2],
- mainhead.Filedate[0] + (mainhead.Filedate[0] <= 30) ? 2000 : 1900);
+ mainhead.Filedate[0] + ((mainhead.Filedate[0] <= 30) ? 2000 : 1900));
htrc("Field Type Offset Len Dec Set Mdx\n");
} // endif trace
@@ -840,7 +840,7 @@ int DBFFAM::DeleteRecords(PGLOBAL g, int irc)
{
if (irc == RC_OK) {
// T_Stream is the temporary stream or the table file stream itself
- if (!T_Stream)
+ if (!T_Stream) {
if (UseTemp) {
if (OpenTempFile(g))
return RC_FX;
@@ -850,10 +850,11 @@ int DBFFAM::DeleteRecords(PGLOBAL g, int irc)
} else
T_Stream = Stream;
+ }
*Tdbp->GetLine() = '*';
Modif++; // Modified line in Delete mode
- } // endif irc
+ } // endif irc
return RC_OK;
} // end of DeleteRecords
diff --git a/storage/connect/filamfix.cpp b/storage/connect/filamfix.cpp
index 0a98ec5b54a..d27551bb97d 100644
--- a/storage/connect/filamfix.cpp
+++ b/storage/connect/filamfix.cpp
@@ -135,8 +135,6 @@ bool FIXFAM::AllocateBuffer(PGLOBAL g)
// The buffer must be prepared depending on column types
int n = 0;
bool b = false;
- PDOSDEF defp = (PDOSDEF)Tdbp->GetDef();
-// PCOLDEF cdp;
PBINCOL colp;
// Prepare the first line of the buffer
diff --git a/storage/connect/filamgz.cpp b/storage/connect/filamgz.cpp
index 880db54c91d..f7517b53b8f 100644
--- a/storage/connect/filamgz.cpp
+++ b/storage/connect/filamgz.cpp
@@ -647,7 +647,7 @@ int ZBKFAM::WriteBuffer(PGLOBAL g)
int ZBKFAM::DeleteRecords(PGLOBAL g, int irc)
{
if (irc == RC_EF) {
- LPCSTR name = Tdbp->GetName();
+ (void) Tdbp->GetName(); // XXX Should be removed ?
PDOSDEF defp = (PDOSDEF)Tdbp->GetDef();
defp->SetBlock(0);
@@ -673,7 +673,7 @@ void ZBKFAM::CloseTableFile(PGLOBAL g, bool)
int rc = RC_OK;
if (Tdbp->GetMode() == MODE_INSERT) {
- LPCSTR name = Tdbp->GetName();
+ (void) Tdbp->GetName(); // XXX Should be removed?
PDOSDEF defp = (PDOSDEF)Tdbp->GetDef();
if (CurNum && !Closing) {
@@ -1355,7 +1355,7 @@ void ZLBFAM::CloseTableFile(PGLOBAL g, bool)
int rc = RC_OK;
if (Tdbp->GetMode() == MODE_INSERT) {
- LPCSTR name = Tdbp->GetName();
+ (void) Tdbp->GetName(); // XXX Should be removed?
PDOSDEF defp = (PDOSDEF)Tdbp->GetDef();
// Closing is True if last Write was in error
diff --git a/storage/connect/filamtxt.cpp b/storage/connect/filamtxt.cpp
index ca48fc765a1..67ab120c499 100644
--- a/storage/connect/filamtxt.cpp
+++ b/storage/connect/filamtxt.cpp
@@ -1547,13 +1547,14 @@ int BLKFAM::WriteBuffer(PGLOBAL g)
// T_Stream is the temporary stream or the table file stream itself
if (!T_Stream)
+ {
if (UseTemp /*&& Tdbp->GetMode() == MODE_UPDATE*/) {
if (OpenTempFile(g))
return RC_FX;
} else
T_Stream = Stream;
-
+ }
if (UseTemp) {
/*****************************************************************/
/* We are using a temporary file. Before writing the updated */
diff --git a/storage/connect/filamvct.cpp b/storage/connect/filamvct.cpp
index 6d0779b150a..f8ae5930a60 100644
--- a/storage/connect/filamvct.cpp
+++ b/storage/connect/filamvct.cpp
@@ -301,7 +301,7 @@ int VCTFAM::Cardinality(PGLOBAL g)
if (!g)
return 1;
- if (Block < 0)
+ if (Block < 0) {
if (Split) {
// Separate column files and no pre setting of Block and Last
// This allows to see a table modified externally, but Block
@@ -347,6 +347,7 @@ int VCTFAM::Cardinality(PGLOBAL g)
return -1; // Error
} // endif split
+ }
return (Block) ? ((Block - 1) * Nrec + Last) : 0;
} // end of Cardinality
@@ -1163,7 +1164,6 @@ bool VCTFAM::ResetTableSize(PGLOBAL g, int block, int last)
if (!Header) {
// Update catalog values for Block and Last
PVCTDEF defp = (PVCTDEF)Tdbp->GetDef();
- LPCSTR name = Tdbp->GetName();
defp->SetBlock(Block);
defp->SetLast(Last);
diff --git a/storage/connect/filamzip.cpp b/storage/connect/filamzip.cpp
index e76dc496246..b778c4971e9 100644
--- a/storage/connect/filamzip.cpp
+++ b/storage/connect/filamzip.cpp
@@ -91,8 +91,6 @@ static bool ZipFile(PGLOBAL g, ZIPUTIL *zutp, PCSZ fn, PCSZ entry, char *buf)
static bool ZipFiles(PGLOBAL g, ZIPUTIL *zutp, PCSZ pat, char *buf)
{
char filename[_MAX_PATH];
- int rc;
-
/*********************************************************************/
/* pat is a multiple file name with wildcard characters */
/*********************************************************************/
@@ -100,6 +98,7 @@ static bool ZipFiles(PGLOBAL g, ZIPUTIL *zutp, PCSZ pat, char *buf)
#if defined(__WIN__)
char drive[_MAX_DRIVE], direc[_MAX_DIR];
+ int rc;
WIN32_FIND_DATA FileData;
HANDLE hSearch;
diff --git a/storage/connect/filter.cpp b/storage/connect/filter.cpp
index 7082b082c67..5bd9fc08ac4 100644
--- a/storage/connect/filter.cpp
+++ b/storage/connect/filter.cpp
@@ -1223,12 +1223,16 @@ bool FILTER::Eval(PGLOBAL g)
PDBUSER dup = PlgGetUser(g);
if (Opc <= OP_XX)
+ {
for (i = 0; i < 2; i++)
+ {
// Evaluate the object and eventually convert it.
if (Arg(i)->Eval(g))
return TRUE;
else if (Test[i].Conv)
Val(i)->SetValue_pval(Arg(i)->GetValue());
+ }
+ }
if (trace(1))
htrc(" Filter: op=%d type=%d %d B_T=%d %d val=%p %p\n",
diff --git a/storage/connect/fmdlex.c b/storage/connect/fmdlex.c
index 729b1b883c1..2a1bd53f51b 100644
--- a/storage/connect/fmdlex.c
+++ b/storage/connect/fmdlex.c
@@ -243,9 +243,6 @@ void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
static int yy_start_stack_ptr = 0;
static int yy_start_stack_depth = 0;
static int *yy_start_stack = 0;
-static void yy_push_state YY_PROTO(( int new_state ));
-static void yy_pop_state YY_PROTO(( void ));
-static int yy_top_state YY_PROTO(( void ));
static void *yy_flex_alloc YY_PROTO(( unsigned int ));
static void *yy_flex_realloc YY_PROTO(( void *, unsigned int ));
@@ -1266,6 +1263,7 @@ FILE *file;
}
+#ifdef NOT_USED
#ifdef YY_USE_PROTOS
static void yy_push_state( int new_state )
#else
@@ -1297,7 +1295,6 @@ int new_state;
BEGIN(new_state);
}
-
static void yy_pop_state()
{
if ( --yy_start_stack_ptr < 0 )
@@ -1311,6 +1308,7 @@ static int yy_top_state()
{
return yy_start_stack[yy_start_stack_ptr - 1];
}
+#endif /* NOT_USED */
#ifdef YY_USE_PROTOS
diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc
index 33f4c2c3540..6939e6948f9 100644
--- a/storage/connect/ha_connect.cc
+++ b/storage/connect/ha_connect.cc
@@ -765,7 +765,6 @@ static int connect_init_func(void *p)
init_connect_psi_keys();
connect_hton= (handlerton *)p;
- connect_hton->state= SHOW_OPTION_YES;
connect_hton->create= connect_create_handler;
connect_hton->flags= HTON_TEMPORARY_NOT_SUPPORTED;
connect_hton->table_options= connect_table_option_list;
@@ -790,7 +789,7 @@ static int connect_init_func(void *p)
@brief
Plugin clean up
*/
-static int connect_done_func(void *)
+int connect_done_func(void *)
{
int error= 0;
PCONNECT pc, pn;
@@ -5320,7 +5319,7 @@ static char *encode(PGLOBAL g, const char *cnm)
char *buf= (char*)PlugSubAlloc(g, NULL, strlen(cnm) * 3);
uint dummy_errors;
uint32 len= copy_and_convert(buf, strlen(cnm) * 3,
- &my_charset_utf8_general_ci,
+ &my_charset_utf8mb3_general_ci,
cnm, strlen(cnm),
&my_charset_latin1,
&dummy_errors);
@@ -6381,7 +6380,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
} // endif charset
- if (type == TAB_XML && data_charset != &my_charset_utf8_general_ci) {
+ if (type == TAB_XML && data_charset != &my_charset_utf8mb3_general_ci) {
my_printf_error(ER_UNKNOWN_ERROR,
"DATA_CHARSET='%s' is not supported for TABLE_TYPE=XML",
MYF(0), options->data_charset);
diff --git a/storage/connect/inihandl.cpp b/storage/connect/inihandl.cpp
index dacab3c485c..c39c94fb30d 100644
--- a/storage/connect/inihandl.cpp
+++ b/storage/connect/inihandl.cpp
@@ -112,8 +112,6 @@ static PROFILE *MRUProfile[N_CACHED_PROFILES] = {NULL};
//static CRITICAL_SECTION PROFILE_CritSect = CRITICAL_SECTION_INIT("PROFILE_CritSect");
-static const char hex[17] = "0123456789ABCDEF";
-
BOOL WritePrivateProfileString(LPCSTR section, LPCSTR entry,
LPCSTR string, LPCSTR filename);
@@ -1340,6 +1338,7 @@ BOOL WritePrivateProfileSection(LPCSTR section,
* Note that when the buffer is big enough then the return value may be any
* value between 1 and len-1 (or len in Win95), including len-2.
*/
+#ifdef TEST_MODULE
static DWORD
GetPrivateProfileSectionNames(LPSTR buffer, DWORD size, LPCSTR filename)
{
@@ -1361,7 +1360,6 @@ GetPrivateProfileSectionNames(LPSTR buffer, DWORD size, LPCSTR filename)
/************************************************************************
* Program to test the above
************************************************************************/
-#ifdef TEST_MODULE
int main(int argc, char**argv) {
char buff[128];
char *p, *inifile = "D:\\Plug\\Data\\contact.ini";
diff --git a/storage/connect/javaconn.cpp b/storage/connect/javaconn.cpp
index f919344f20b..5a4fe433121 100644
--- a/storage/connect/javaconn.cpp
+++ b/storage/connect/javaconn.cpp
@@ -347,7 +347,7 @@ bool JAVAConn::GetJVM(PGLOBAL g)
/***********************************************************************/
bool JAVAConn::Open(PGLOBAL g)
{
- bool brc = true, err = false;
+ bool brc = true;
jboolean jt = (trace(1));
// Link or check whether jvm library was linked
diff --git a/storage/connect/jdbconn.cpp b/storage/connect/jdbconn.cpp
index e0aca3333e6..b718f7f108f 100644
--- a/storage/connect/jdbconn.cpp
+++ b/storage/connect/jdbconn.cpp
@@ -769,7 +769,6 @@ bool JDBConn::Connect(PJPARM sop)
int irc = RC_FX;
bool err = false;
jint rc;
- jboolean jt = (trace(1));
PGLOBAL& g = m_G;
/*******************************************************************/
@@ -939,7 +938,7 @@ int JDBConn::Rewind(PCSZ sql)
if (gmID(m_G, fetchid, "Fetch", "(I)Z"))
return -1;
- jboolean b = env->CallBooleanMethod(job, fetchid, 0);
+ (void) env->CallBooleanMethod(job, fetchid, 0);
rbuf = m_Rows;
} else if (ExecuteCommand(sql) != RC_FX)
@@ -1191,7 +1190,7 @@ int JDBConn::ExecuteUpdate(PCSZ sql)
/***********************************************************************/
int JDBConn::GetResultSize(PCSZ sql, PCOL colp)
{
- int rc, n = 0;
+ int rc;
if ((rc = ExecuteQuery(sql)) != RC_OK)
return -1;
@@ -1493,7 +1492,6 @@ bool JDBConn::SetParam(JDBCCOL *colp)
PCSZ fnc = "Unknown";
uint n;
short len, tp;
- int crow = 0;
PQRYRES qrp = cap->Qrp;
PCOLRES crp;
jboolean rc = false;
diff --git a/storage/connect/jsonudf.cpp b/storage/connect/jsonudf.cpp
index d5bd1215e77..b1e32394de0 100644
--- a/storage/connect/jsonudf.cpp
+++ b/storage/connect/jsonudf.cpp
@@ -247,7 +247,7 @@ my_bool JSNX::ParseJpath(PGLOBAL g)
{
char *p, *p1 = NULL, *p2 = NULL, *pbuf = NULL;
int i;
- my_bool a, mul = false;
+ my_bool a;
if (Parsed)
return false; // Already done
@@ -424,7 +424,6 @@ PVAL JSNX::GetColumnValue(PGLOBAL g, PJSON row, int i)
/*********************************************************************************/
PJVAL JSNX::GetRowValue(PGLOBAL g, PJSON row, int i, my_bool b)
{
- my_bool expd = false;
PJAR arp;
PJVAL val = NULL;
@@ -763,7 +762,7 @@ my_bool JSNX::WriteValue(PGLOBAL g, PJVAL jvalp)
PSZ JSNX::Locate(PGLOBAL g, PJSON jsp, PJVAL jvp, int k)
{
PSZ str = NULL;
- my_bool b = false, err = true;
+ my_bool err = true;
g->Message[0] = 0;
@@ -885,7 +884,7 @@ my_bool JSNX::LocateValue(PJVAL jvp)
PSZ JSNX::LocateAll(PGLOBAL g, PJSON jsp, PJVAL jvp, int mx)
{
PSZ str = NULL;
- my_bool b = false, err = true;
+ my_bool err = true;
PJPN jnp;
if (!jsp) {
@@ -1352,7 +1351,7 @@ static PBSON MakeBinResult(PGLOBAL g, UDF_ARGS *args, PJSON top, ulong len, int
bsnp->Pretty = pretty;
- if (bsnp->Filename = (char*)args->args[0]) {
+ if ((bsnp->Filename = (char*)args->args[0])) {
bsnp->Filename = MakePSZ(g, args, 0);
strncpy(bsnp->Msg, bsnp->Filename, BMX);
} else
@@ -3755,11 +3754,13 @@ my_bool jsonlocate_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
strcpy(message, "Third argument is not an integer (rank)");
return true;
} else if (args->arg_count > 3)
+ {
if (args->arg_type[3] != INT_RESULT) {
strcpy(message, "Fourth argument is not an integer (memory)");
return true;
} else
more += (ulong)*(longlong*)args->args[2];
+ }
CalcLen(args, false, reslen, memlen);
@@ -5178,7 +5179,7 @@ char *jbin_object_delete(UDF_INIT *initid, UDF_ARGS *args, char *result,
PCSZ key;
PJOB jobp;
PJVAL jvp = MakeValue(g, args, 0, &top);
- PJSON jsp = jvp->GetJson();
+ (void) jvp->GetJson(); // XXX Should be removed?
if (CheckPath(g, args, top, jvp, 2))
PUSH_WARNING(g->Message);
@@ -5889,7 +5890,7 @@ long long countin(UDF_INIT *initid, UDF_ARGS *args, char *result,
memcpy(str2, args->args[1], lg);
str2[lg] = 0;
- while (s = strstr(s, str2)) {
+ while ((s = strstr(s, str2))) {
n++;
s += lg;
} // endwhile
diff --git a/storage/connect/libdoc.cpp b/storage/connect/libdoc.cpp
index 58b0267bd6d..c1eaa6766cc 100644
--- a/storage/connect/libdoc.cpp
+++ b/storage/connect/libdoc.cpp
@@ -378,7 +378,7 @@ bool LIBXMLDOC::Initialize(PGLOBAL g, PCSZ entry, bool zipped)
if (zipped && InitZip(g, entry))
return true;
- int n = xmlKeepBlanksDefault(1);
+ xmlKeepBlanksDefault(1);
return MakeNSlist(g);
} // end of Initialize
@@ -765,8 +765,8 @@ int LIBXMLDOC::Decode(xmlChar *cnt, char *buf, int n)
{
const char *txt = (const char *)cnt;
uint dummy_errors;
- uint32 len= copy_and_convert(buf, n, &my_charset_utf8_general_ci, txt,
- strlen(txt), &my_charset_utf8_general_ci,
+ uint32 len= copy_and_convert(buf, n, &my_charset_utf8mb3_general_ci, txt,
+ strlen(txt), &my_charset_utf8mb3_general_ci,
&dummy_errors);
buf[len]= '\0';
return 0;
@@ -777,8 +777,8 @@ int LIBXMLDOC::Decode(xmlChar *cnt, char *buf, int n)
/******************************************************************/
xmlChar *LIBXMLDOC::Encode(PGLOBAL g, char *txt)
{
- const CHARSET_INFO *ics= &my_charset_utf8_general_ci;
- const CHARSET_INFO *ocs= &my_charset_utf8_general_ci;
+ const CHARSET_INFO *ics= &my_charset_utf8mb3_general_ci;
+ const CHARSET_INFO *ocs= &my_charset_utf8mb3_general_ci;
size_t i = strlen(txt);
size_t o = i * ocs->mbmaxlen / ics->mbmaxlen + 1;
char *buf;
diff --git a/storage/connect/maputil.cpp b/storage/connect/maputil.cpp
index 87263b3adf6..71290511f8e 100644
--- a/storage/connect/maputil.cpp
+++ b/storage/connect/maputil.cpp
@@ -190,7 +190,7 @@ bool CloseMemMap(void *memory, size_t dwSize)
{
if (memory) {
// All this must be redesigned
- int rc = msync((char*)memory, dwSize, MS_SYNC);
+ msync((char*)memory, dwSize, MS_SYNC);
return (munmap((char*)memory, dwSize) < 0) ? true : false;
} else
return false;
diff --git a/storage/connect/myconn.cpp b/storage/connect/myconn.cpp
index 6de5a73875c..448ee7dc782 100644
--- a/storage/connect/myconn.cpp
+++ b/storage/connect/myconn.cpp
@@ -140,7 +140,7 @@ PQRYRES MyColumns(PGLOBAL g, THD *thd, const char *host, const char *db,
PCSZ fmt;
char *fld, *colname, *chset, v, buf[128], uns[16], zero[16];
int i, n, nf = 0, ncol = sizeof(buftyp) / sizeof(int);
- int len, type, prec, rc, k = 0;
+ int len, type, prec, rc;
bool b;
PQRYRES qrp;
PCOLRES crp;
diff --git a/storage/connect/odbconn.cpp b/storage/connect/odbconn.cpp
index d08c6d1b7a5..18d64677773 100644
--- a/storage/connect/odbconn.cpp
+++ b/storage/connect/odbconn.cpp
@@ -1290,9 +1290,7 @@ bool ODBConn::DriverConnect(DWORD Options)
HWND hWnd = (HWND)1;
#endif // !__WIN__
PGLOBAL& g = m_G;
- PDBUSER dup = PlgGetUser(g);
-//if (Options & noOdbcDialog || dup->Remote)
wConnectOption = SQL_DRIVER_NOPROMPT;
//else if (Options & forceOdbcDialog)
// wConnectOption = SQL_DRIVER_PROMPT;
@@ -1686,7 +1684,7 @@ int ODBConn::PrepareSQL(char *sql)
b = false;
if (m_hstmt) {
- RETCODE rc = SQLFreeStmt(m_hstmt, SQL_CLOSE);
+ SQLFreeStmt(m_hstmt, SQL_CLOSE);
hstmt = m_hstmt;
m_hstmt = NULL;
@@ -1694,7 +1692,7 @@ int ODBConn::PrepareSQL(char *sql)
if (m_Tdb->GetAmType() != TYPE_AM_XDBC)
ThrowDBX(MSG(SEQUENCE_ERROR));
- } // endif m_hstmt
+ } // endif m_hstmt
rc = SQLAllocStmt(m_hdbc, &hstmt);
diff --git a/storage/connect/plgdbutl.cpp b/storage/connect/plgdbutl.cpp
index e296553d8e2..54808aa682f 100644
--- a/storage/connect/plgdbutl.cpp
+++ b/storage/connect/plgdbutl.cpp
@@ -425,6 +425,8 @@ char *ExtractFromPath(PGLOBAL g, char *pBuff, char *FileName, OPVAL op)
return pBuff;
} // end of PlgExtractFromPath
+
+#ifdef NOT_USED
/***********************************************************************/
/* Check the occurence and matching of a pattern against a string. */
/* Because this function is only used for catalog name checking, */
@@ -443,6 +445,7 @@ static bool PlugCheckPattern(PGLOBAL g, LPCSTR string, LPCSTR pat)
return true;
} // end of PlugCheckPattern
+#endif /* NOT_USED */
/***********************************************************************/
/* PlugEvalLike: evaluates a LIKE clause. */
diff --git a/storage/connect/tabdos.cpp b/storage/connect/tabdos.cpp
index 4f6e2c81744..b3cb510b5b9 100644
--- a/storage/connect/tabdos.cpp
+++ b/storage/connect/tabdos.cpp
@@ -562,8 +562,6 @@ int TDBDOS::ResetTableOpt(PGLOBAL g, bool dop, bool dox)
MaxSize = -1; // Size must be recalculated
Cardinal = -1; // as well as Cardinality
- PTXF xp = Txfp;
-
To_Filter = NULL; // Disable filtering
//To_BlkIdx = NULL; // and index filtering
To_BlkFil = NULL; // and block filtering
@@ -635,8 +633,9 @@ int TDBDOS::MakeBlockValues(PGLOBAL g)
PDOSDEF defp = (PDOSDEF)To_Def;
PDOSCOL colp = NULL;
PDBUSER dup = PlgGetUser(g);
- PCATLG cat = defp->GetCat();
//void *memp = cat->GetDescp();
+ (void) defp->GetCat(); // XXX Should be removed?
+
if ((nrec = defp->GetElemt()) < 2) {
if (!To_Def->Partitioned()) {
@@ -998,15 +997,17 @@ bool TDBDOS::GetBlockValues(PGLOBAL g)
{
char filename[_MAX_PATH];
int i, lg, n[NZ];
- int nrec, block = 0, last = 0, allocblk = 0;
+ int nrec, block = 0, last = 0;
int len;
bool newblk = false;
size_t ndv, nbm, nbk, blk;
FILE *opfile;
PCOLDEF cdp;
PDOSDEF defp = (PDOSDEF)To_Def;
- PCATLG cat = defp->GetCat();
- PDBUSER dup = PlgGetUser(g);
+ PDBUSER dup = PlgGetUser(g);
+
+ (void) defp->GetCat(); // XXX Should be removed?
+
#if 0
if (Mode == MODE_INSERT && Txfp->GetAmType() == TYPE_AM_DOS)
@@ -1287,7 +1288,7 @@ PBF TDBDOS::InitBlockFilter(PGLOBAL g, PFIL filp)
} // endif blk
- int i, op = filp->GetOpc(), opm = filp->GetOpm(), n = 0;
+ int i, op = filp->GetOpc(), opm = filp->GetOpm();
bool cnv[2];
PCOL colp;
PXOB arg[2] = {NULL,NULL};
@@ -1330,13 +1331,14 @@ PBF TDBDOS::InitBlockFilter(PGLOBAL g, PFIL filp)
bfp = new(g) BLKSPCIN(g, this, op, opm, arg, Txfp->Nrec);
} else if (blk && Txfp->Nrec > 1 && colp->IsClustered())
+ {
// Clustered column and constant array
if (colp->GetClustered() == 2)
bfp = new(g) BLKFILIN2(g, this, op, opm, arg);
else
bfp = new(g) BLKFILIN(g, this, op, opm, arg);
-
- } // endif this
+ }
+ } // endif this
#if 0
} else if (filp->GetArgType(0) == TYPE_SCALF &&
@@ -1412,12 +1414,12 @@ PBF TDBDOS::CheckBlockFilari(PGLOBAL g, PXOB *arg, int op, bool *cnv)
//bool conv = false, xdb2 = false, ok = false, b[2];
//PXOB *xarg1, *xarg2 = NULL, xp[2];
int i, n = 0, type[2] = {0,0};
- bool conv = false, xdb2 = false, ok = false;
- PXOB *xarg2 = NULL, xp[2];
+ bool conv = false, xdb2 = false;
+ PXOB xp[2];
PCOL colp;
//LSTVAL *vlp = NULL;
//SFROW *sfr[2];
- PBF *fp = NULL, bfp = NULL;
+ PBF bfp = NULL;
for (i = 0; i < 2; i++) {
switch (arg[i]->GetType()) {
@@ -1648,7 +1650,7 @@ int TDBDOS::TestBlock(PGLOBAL g)
int TDBDOS::MakeIndex(PGLOBAL g, PIXDEF pxdf, bool add)
{
int k, n, rc = RC_OK;
- bool fixed, doit, sep, b = (pxdf != NULL);
+ bool fixed, doit, sep;
PCOL *keycols, colp;
PIXDEF xdp, sxp = NULL;
PKPDEF kdp;
@@ -2822,6 +2824,7 @@ bool DOSCOL::SetBitMap(PGLOBAL g)
bool DOSCOL::CheckSorted(PGLOBAL g)
{
if (Sorted)
+ {
if (OldVal) {
// Verify whether this column is sorted all right
if (OldVal->CompareValue(Value) > 0) {
@@ -2834,7 +2837,7 @@ bool DOSCOL::CheckSorted(PGLOBAL g)
} else
OldVal = AllocateValue(g, Value);
-
+ }
return false;
} // end of CheckSorted
diff --git a/storage/connect/tabext.cpp b/storage/connect/tabext.cpp
index aaf14f123c6..5f803aa1269 100644
--- a/storage/connect/tabext.cpp
+++ b/storage/connect/tabext.cpp
@@ -278,7 +278,7 @@ int TDBEXT::Decode(PCSZ txt, char *buf, size_t n)
uint dummy_errors;
uint32 len = copy_and_convert(buf, n, &my_charset_latin1,
txt, strlen(txt),
- &my_charset_utf8_general_ci,
+ &my_charset_utf8mb3_general_ci,
&dummy_errors);
buf[len] = '\0';
return 0;
diff --git a/storage/connect/tabfix.cpp b/storage/connect/tabfix.cpp
index 1969fd4465f..14afe511640 100644
--- a/storage/connect/tabfix.cpp
+++ b/storage/connect/tabfix.cpp
@@ -53,7 +53,6 @@
/***********************************************************************/
extern int num_read, num_there, num_eq[2]; // Statistics
static const longlong M2G = 0x80000000;
-static const longlong M4G = (longlong)2 * M2G;
char BINCOL::Endian = 'H';
/***********************************************************************/
diff --git a/storage/connect/tabfmt.cpp b/storage/connect/tabfmt.cpp
index 746382178fb..847fd515860 100644
--- a/storage/connect/tabfmt.cpp
+++ b/storage/connect/tabfmt.cpp
@@ -312,12 +312,13 @@ PQRYRES CSVColumns(PGLOBAL g, PCSZ dp, PTOS topt, bool info)
} else if (*p == q) {
if (phase == 0) {
if (blank)
+ {
if (++nerr > mxr) {
sprintf(g->Message, MSG(MISPLACED_QUOTE), num_read);
goto err;
} else
goto skip;
-
+ }
n = 0;
phase = digit = 1;
} else if (phase == 1) {
@@ -342,11 +343,13 @@ PQRYRES CSVColumns(PGLOBAL g, PCSZ dp, PTOS topt, bool info)
} else {
if (phase == 2)
+ {
if (++nerr > mxr) {
sprintf(g->Message, MSG(MISPLACED_QUOTE), num_read);
goto err;
} else
goto skip;
+ }
// isdigit cannot be used here because of debug assert
if (!strchr("0123456789", *p)) {
@@ -363,11 +366,13 @@ PQRYRES CSVColumns(PGLOBAL g, PCSZ dp, PTOS topt, bool info)
} // endif's *p
if (phase == 1)
+ {
if (++nerr > mxr) {
sprintf(g->Message, MSG(UNBALANCE_QUOTE), num_read);
goto err;
} else
goto skip;
+ }
if (n) {
len[i] = MY_MAX(len[i], n);
@@ -741,6 +746,7 @@ bool TDBCSV::OpenDB(PGLOBAL g)
PCSVCOL colp;
if (!Fields) // May have been set in TABFMT::OpenDB
+ {
if (Mode != MODE_UPDATE && Mode != MODE_INSERT) {
for (colp = (PCSVCOL)Columns; colp; colp = (PCSVCOL)colp->Next)
if (!colp->IsSpecial() && !colp->IsVirtual())
@@ -753,6 +759,7 @@ bool TDBCSV::OpenDB(PGLOBAL g)
for (cdp = tdp->GetCols(); cdp; cdp = cdp->GetNext())
if (!cdp->IsSpecial() && !cdp->IsVirtual())
Fields++;
+ }
Offset = (int*)PlugSubAlloc(g, NULL, sizeof(int) * Fields);
Fldlen = (int*)PlugSubAlloc(g, NULL, sizeof(int) * Fields);
@@ -774,6 +781,7 @@ bool TDBCSV::OpenDB(PGLOBAL g)
} // endfor i
if (Field)
+ {
// Prepare writing fields
if (Mode != MODE_UPDATE) {
for (colp = (PCSVCOL)Columns; colp; colp = (PCSVCOL)colp->Next)
@@ -796,8 +804,8 @@ bool TDBCSV::OpenDB(PGLOBAL g)
Fldlen[i] = len;
Fldtyp[i] = IsTypeNum(cdp->GetType());
} // endif cdp
-
- } // endif Use
+ }
+ } // endif Use
if (Header) {
// Check that the Lrecl is at least equal to the header line length
@@ -1046,6 +1054,7 @@ bool TDBCSV::PrepareWriting(PGLOBAL g)
strcat(To_Line, sep);
if (Field[i])
+ {
if (!strlen(Field[i])) {
// Generally null fields are not quoted
if (Quoted > 2)
@@ -1074,8 +1083,8 @@ bool TDBCSV::PrepareWriting(PGLOBAL g)
else
strcat(To_Line, Field[i]);
-
- } // endfor i
+ }
+ } // endfor i
#if defined(_DEBUG)
assert ((unsigned)nlen == strlen(To_Line));
@@ -1129,11 +1138,13 @@ int TDBCSV::CheckWrite(PGLOBAL g)
// Check whether record is too int
for (int i = 0; i < Fields; i++)
+ {
if (Field[i]) {
if (!(n = strlen(Field[i])))
n += (Quoted > 2 ? 2 : 0);
else if (strchr(Field[i], Sep) || (Qot && *Field[i] == Qot)
|| Quoted > 1 || (Quoted == 1 && !Fldtyp[i]))
+ {
if (!Qot) {
sprintf(g->Message, MSG(SEP_IN_FIELD), i + 1);
return -1;
@@ -1146,14 +1157,14 @@ int TDBCSV::CheckWrite(PGLOBAL g)
n += 2; // Outside quotes
} // endif
-
+ }
if ((nlen += n) > maxlen) {
strcpy(g->Message, MSG(LINE_TOO_LONG));
return -1;
} // endif nlen
} // endif Field
-
+ }
return nlen;
} // end of CheckWrite
diff --git a/storage/connect/tabjdbc.cpp b/storage/connect/tabjdbc.cpp
index 06b6b3a9730..4d834bcf9e0 100644
--- a/storage/connect/tabjdbc.cpp
+++ b/storage/connect/tabjdbc.cpp
@@ -378,7 +378,7 @@ bool TDBJDBC::MakeInsert(PGLOBAL g)
int len = 0;
uint pos;
bool b = false;
- PTABLE tablep = To_Table;
+ // PTABLE tablep = To_Table;
PCOL colp;
for (colp = Columns; colp; colp = colp->GetNext())
@@ -582,11 +582,13 @@ bool TDBJDBC::OpenDB(PGLOBAL g)
if (Memory < 3) {
// Method will depend on cursor type
if ((Rbuf = Query ? Jcp->Rewind(Query->GetStr()) : 0) < 0)
+ {
if (Mode != MODE_READX) {
Jcp->Close();
return true;
} else
Rbuf = 0;
+ }
} else
Rbuf = Qrp->Nblin;
@@ -1019,7 +1021,7 @@ JDBCCOL::JDBCCOL(JDBCCOL *col1, PTDB tdbp) : EXTCOL(col1, tdbp)
void JDBCCOL::ReadColumn(PGLOBAL g)
{
PTDBJDBC tdbp = (PTDBJDBC)To_Tdb;
- int i = tdbp->Fpos - 1, n = tdbp->CurNum;
+ int i = tdbp->Fpos - 1;
if (tdbp->Memory == 3) {
// Get the value from the stored memory
@@ -1139,8 +1141,6 @@ int TDBXJDC::GetMaxSize(PGLOBAL g)
/***********************************************************************/
bool TDBXJDC::OpenDB(PGLOBAL g)
{
- bool rc = false;
-
if (trace(1))
htrc("JDBC OpenDB: tdbp=%p tdb=R%d use=%d mode=%d\n",
this, Tdb_No, Use, Mode);
diff --git a/storage/connect/tabjson.cpp b/storage/connect/tabjson.cpp
index 0b282345c8a..a96b7fe46d5 100644
--- a/storage/connect/tabjson.cpp
+++ b/storage/connect/tabjson.cpp
@@ -255,11 +255,13 @@ int JSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt)
jsp = (tjsp->GetDoc()) ? tjsp->GetDoc()->GetValue(0) : NULL;
} else {
if (!(tdp->Lrecl = GetIntegerTableOption(g, topt, "Lrecl", 0)))
+ {
if (!mgo) {
sprintf(g->Message, "LRECL must be specified for pretty=%d", tdp->Pretty);
return 0;
} else
tdp->Lrecl = 8192; // Should be enough
+ }
tdp->Ending = GetIntegerTableOption(g, topt, "Ending", CRLF);
@@ -1318,7 +1320,7 @@ bool JSONCOL::ParseJpath(PGLOBAL g)
{
char *p, *p1 = NULL, *p2 = NULL, *pbuf = NULL;
int i;
- bool a, mul = false;
+ bool a;
if (Parsed)
return false; // Already done
@@ -1548,7 +1550,6 @@ void JSONCOL::ReadColumn(PGLOBAL g)
PVAL JSONCOL::GetColumnValue(PGLOBAL g, PJSON row, int i)
{
int n = Nod - 1;
- bool expd = false;
PJAR arp;
PJVAL val = NULL;
@@ -2109,12 +2110,14 @@ int TDBJSON::Cardinality(PGLOBAL g)
if (!g)
return (Xcol || Multiple) ? 0 : 1;
else if (Cardinal < 0)
+ {
if (!Multiple) {
if (MakeDocument(g) == RC_OK)
Cardinal = Doc->size();
} else
return 10;
+ }
return Cardinal;
} // end of Cardinality
diff --git a/storage/connect/tabmul.cpp b/storage/connect/tabmul.cpp
index 649fc6706c6..3da72dcc29c 100644
--- a/storage/connect/tabmul.cpp
+++ b/storage/connect/tabmul.cpp
@@ -671,8 +671,8 @@ TDBDIR::TDBDIR(PSZ fpat) : TDBASE((PTABDEF)NULL)
/***********************************************************************/
char* TDBDIR::Path(PGLOBAL g)
{
- PCATLG cat = PlgGetCatalog(g);
- PTABDEF defp = (PTABDEF)To_Def;
+ (void) PlgGetCatalog(g); // XXX Should be removed?
+ PTABDEF defp = (PTABDEF)To_Def;
#if defined(__WIN__)
if (!*Drive) {
@@ -708,9 +708,9 @@ PCOL TDBDIR::MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n)
int TDBDIR::GetMaxSize(PGLOBAL g)
{
if (MaxSize < 0) {
- int rc, n = -1;
+ int n = -1;
#if defined(__WIN__)
-
+ int rc;
// Start searching files in the target directory.
hSearch = FindFirstFile(Path(g), &FileData);
@@ -1041,11 +1041,12 @@ int TDBSDR::GetMaxSize(PGLOBAL g)
/***********************************************************************/
int TDBSDR::FindInDir(PGLOBAL g)
{
- int rc, n = 0;
+ int n = 0;
size_t m = strlen(Direc);
// Start searching files in the target directory.
#if defined(__WIN__)
+ int rc;
HANDLE h;
#if defined(PATHMATCHSPEC)
@@ -1174,7 +1175,7 @@ int TDBSDR::FindInDir(PGLOBAL g)
// Look in the name sub-directory
strcat(strcat(Direc, Entry->d_name), "/");
- if ((k = FindInDir(g)) < 0)
+ if ((k= FindInDir(g)) < 0)
return k;
else
n += k;
diff --git a/storage/connect/tabmysql.cpp b/storage/connect/tabmysql.cpp
index 83c20b26701..9d60319a83f 100644
--- a/storage/connect/tabmysql.cpp
+++ b/storage/connect/tabmysql.cpp
@@ -246,7 +246,7 @@ bool MYSQLDEF::ParseURL(PGLOBAL g, char *url, bool b)
// Found that if the string is:
// user:@hostname:port/db/table
// Then password is a null string, so set to NULL
- if ((pwd[0] == 0))
+ if (pwd[0] == 0)
Password = NULL;
else
Password = pwd;
diff --git a/storage/connect/taboccur.cpp b/storage/connect/taboccur.cpp
index 07272d1b298..4bec25eeebc 100644
--- a/storage/connect/taboccur.cpp
+++ b/storage/connect/taboccur.cpp
@@ -202,7 +202,7 @@ bool OcrSrcCols(PGLOBAL g, PQRYRES qrp, const char *col,
/**********************************************************************/
/* Replace the columns of the colist by the rank and occur columns. */
/**********************************************************************/
- for (i = 0, pcrp = &qrp->Colresp; crp = *pcrp; ) {
+ for (i = 0, pcrp = &qrp->Colresp; (crp = *pcrp); ) {
for (k = 0, pn = colist; k < m; k++, pn += (strlen(pn) + 1))
if (!stricmp(pn, crp->Name))
break;
@@ -450,8 +450,9 @@ bool TDBOCCUR::OpenDB(PGLOBAL g)
N = M = 0;
RowFlag = 0;
- if (Xcolp)
+ if (Xcolp) {
Xcolp->Xreset();
+ }
return Tdbp->OpenDB(g);
} // endif use
diff --git a/storage/connect/tabodbc.cpp b/storage/connect/tabodbc.cpp
index 0fa117c3d2f..b713e290684 100644
--- a/storage/connect/tabodbc.cpp
+++ b/storage/connect/tabodbc.cpp
@@ -301,7 +301,6 @@ bool TDBODBC::MakeInsert(PGLOBAL g)
char *catp = NULL, buf[NAM_LEN * 3];
int len = 0;
bool oom, b = false;
- PTABLE tablep = To_Table;
PCOL colp;
for (colp = Columns; colp; colp = colp->GetNext())
@@ -322,9 +321,6 @@ bool TDBODBC::MakeInsert(PGLOBAL g)
if (catp)
len += strlen(catp) + 1;
- //if (tablep->GetSchema())
- // schmp = (char*)tablep->GetSchema();
- //else
if (Schema && *Schema)
schmp = Schema;
@@ -557,15 +553,17 @@ bool TDBODBC::OpenDB(PGLOBAL g)
if (Memory < 3) {
// Method will depend on cursor type
- if ((Rbuf = Ocp->Rewind(Query->GetStr(), (PODBCCOL)Columns)) < 0)
- if (Mode != MODE_READX) {
- Ocp->Close();
- return true;
- } else
- Rbuf = 0;
-
- } else
+ if ((Rbuf = Ocp->Rewind(Query->GetStr(), (PODBCCOL)Columns)) < 0) {
+ if (Mode != MODE_READX) {
+ Ocp->Close();
+ return true;
+ } else {
+ Rbuf = 0;
+ }
+ }
+ } else {
Rbuf = Qrp->Nblin;
+ }
CurNum = 0;
Fpos = 0;
@@ -1213,8 +1211,6 @@ int TDBXDBC::GetMaxSize(PGLOBAL g)
/***********************************************************************/
bool TDBXDBC::OpenDB(PGLOBAL g)
{
- bool rc = false;
-
if (trace(1))
htrc("ODBC OpenDB: tdbp=%p tdb=R%d use=%dmode=%d\n",
this, Tdb_No, Use, Mode);
diff --git a/storage/connect/tabpivot.cpp b/storage/connect/tabpivot.cpp
index 9121a0453e5..8aee9fbb10d 100644
--- a/storage/connect/tabpivot.cpp
+++ b/storage/connect/tabpivot.cpp
@@ -187,7 +187,7 @@ PQRYRES PIVAID::MakePivotColumns(PGLOBAL g)
} // endif picol
// Prepare the column list
- for (pcrp = &Qryp->Colresp; crp = *pcrp; )
+ for (pcrp = &Qryp->Colresp; (crp = *pcrp); ) {
if (SkipColumn(crp, skc)) {
// Ignore this column
*pcrp = crp->Next;
@@ -204,7 +204,7 @@ PQRYRES PIVAID::MakePivotColumns(PGLOBAL g)
*pcrp = crp->Next;
} else
pcrp = &crp->Next;
-
+ }
if (!Rblkp) {
strcpy(g->Message, MSG(NO_DEF_PIVOTCOL));
goto err;
@@ -340,7 +340,6 @@ int PIVAID::Qcompare(int *i1, int *i2)
bool PIVOTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
{
char *p1, *p2;
- PHC hc = ((MYCAT*)Cat)->GetHandler();
if (PRXDEF::DefineAM(g, am, poff))
return TRUE;
@@ -748,7 +747,7 @@ int TDBPIVOT::ReadDB(PGLOBAL g)
colp->ReadColumn(g);
for (colp = Columns; colp; colp = colp->GetNext())
- if (colp->GetAmType() == TYPE_AM_SRC)
+ if (colp->GetAmType() == TYPE_AM_SRC) {
if (FileStatus) {
if (((PSRCCOL)colp)->CompareLast()) {
newrow = (RowFlag) ? TRUE : FALSE;
@@ -757,6 +756,7 @@ int TDBPIVOT::ReadDB(PGLOBAL g)
} else
((PSRCCOL)colp)->SetColumn();
+ }
FileStatus = 1;
} // endif RowFlag
diff --git a/storage/connect/tabutil.cpp b/storage/connect/tabutil.cpp
index 325f36b1e19..b82e98204dd 100644
--- a/storage/connect/tabutil.cpp
+++ b/storage/connect/tabutil.cpp
@@ -674,7 +674,7 @@ char *PRXCOL::Decode(PGLOBAL g, const char *cnm)
uint32 len= copy_and_convert(buf, strlen(cnm) + 1,
&my_charset_latin1,
cnm, strlen(cnm),
- &my_charset_utf8_general_ci,
+ &my_charset_utf8mb3_general_ci,
&dummy_errors);
buf[len]= '\0';
return buf;
diff --git a/storage/connect/tabxml.cpp b/storage/connect/tabxml.cpp
index 19490d350e8..489fcae303b 100644
--- a/storage/connect/tabxml.cpp
+++ b/storage/connect/tabxml.cpp
@@ -218,8 +218,8 @@ PQRYRES XMLColumns(PGLOBAL g, char *db, char *tab, PTOS topt, bool info)
while (true) {
if (!vp->atp &&
- !(node = (vp->nl) ? vp->nl->GetItem(g, vp->k++, tdp->Usedom ? node : NULL)
- : NULL))
+ !(node = (vp->nl) ? vp->nl->GetItem(g, vp->k++, tdp->Usedom ? node : NULL)
+ : NULL)) {
if (j) {
vp = lvlp[--j];
@@ -234,6 +234,7 @@ PQRYRES XMLColumns(PGLOBAL g, char *db, char *tab, PTOS topt, bool info)
continue;
} else
break;
+ }
xcol->Name[vp->n] = 0;
fmt[vp->m] = 0;
@@ -694,7 +695,7 @@ PTDB TDBXML::Clone(PTABS t)
/***********************************************************************/
const CHARSET_INFO *TDBXML::data_charset()
{
- return &my_charset_utf8_general_ci;
+ return &my_charset_utf8mb3_general_ci;
} // end of data_charset
/***********************************************************************/
@@ -1268,7 +1269,7 @@ int TDBXML::ReadDB(PGLOBAL g)
/***********************************************************************/
bool TDBXML::CheckRow(PGLOBAL g, bool b)
{
- if (NewRow && Mode == MODE_INSERT)
+ if (NewRow && Mode == MODE_INSERT) {
if (Rowname) {
TabNode->AddText(g, "\n\t");
RowNode = TabNode->AddChildNode(g, Rowname, RowNode);
@@ -1276,6 +1277,7 @@ bool TDBXML::CheckRow(PGLOBAL g, bool b)
strcpy(g->Message, MSG(NO_ROW_NODE));
return true;
} // endif Rowname
+ }
if (Colname && (NewRow || b))
Clist = RowNode->SelectNodes(g, Colname, Clist);
@@ -1522,12 +1524,13 @@ bool XMLCOL::ParseXpath(PGLOBAL g, bool mode)
// Analyze the Xpath for this column
for (i = 0, p = pbuf; (p2 = strchr(p, '/')); i++, p = p2 + 1) {
- if (Tdbp->Mulnode && !strncmp(p, Tdbp->Mulnode, p2 - p))
+ if (Tdbp->Mulnode && !strncmp(p, Tdbp->Mulnode, p2 - p)) {
if (!Tdbp->Xpand && mode) {
strcpy(g->Message, MSG(CONCAT_SUBNODE));
return true;
} else
Inod = i; // Index of multiple node
+ }
if (mode) {
// For Update or Insert the Xpath must be explicit
@@ -1773,11 +1776,12 @@ void XMLCOL::WriteColumn(PGLOBAL g)
else
break;
- if (ColNode)
+ if (ColNode) {
if (Type)
ValNode = ColNode->SelectSingleNode(g, Xname, Vxnp);
else
AttNode = ColNode->GetAttribute(g, Xname, Vxap);
+ }
if (TopNode || ValNode || AttNode)
break; // We found the good column
@@ -1790,7 +1794,7 @@ void XMLCOL::WriteColumn(PGLOBAL g)
/* Create missing nodes. */
/*********************************************************************/
if (ColNode == NULL) {
- if (TopNode == NULL)
+ if (TopNode == NULL) {
if (Tdbp->Clist) {
Tdbp->RowNode->AddText(g, "\n\t\t");
ColNode = Tdbp->RowNode->AddChildNode(g, Tdbp->Colname);
@@ -1798,7 +1802,7 @@ void XMLCOL::WriteColumn(PGLOBAL g)
TopNode = ColNode;
} else
TopNode = Tdbp->RowNode;
-
+ }
for (; k < Nod && TopNode; k++) {
if (!done) {
TopNode->AddText(g, "\n\t\t");
@@ -2012,7 +2016,7 @@ void XMULCOL::WriteColumn(PGLOBAL g)
TopNode = ColNode;
} // endfor k
- if (ColNode)
+ if (ColNode) {
if (Inod == Nod) {
/***************************************************************/
/* The node value can be multiple. */
@@ -2034,7 +2038,7 @@ void XMULCOL::WriteColumn(PGLOBAL g)
ValNode = ColNode->SelectSingleNode(g, Xname, Vxnp);
else
AttNode = ColNode->GetAttribute(g, Xname, Vxap);
-
+ }
if (TopNode || ValNode || AttNode)
break; // We found the good column
else if (Tdbp->Clist)
@@ -2046,7 +2050,7 @@ void XMULCOL::WriteColumn(PGLOBAL g)
/* Create missing nodes. */
/*********************************************************************/
if (ColNode == NULL) {
- if (TopNode == NULL)
+ if (TopNode == NULL) {
if (Tdbp->Clist) {
Tdbp->RowNode->AddText(g, "\n\t\t");
ColNode = Tdbp->RowNode->AddChildNode(g, Tdbp->Colname);
@@ -2054,7 +2058,7 @@ void XMULCOL::WriteColumn(PGLOBAL g)
TopNode = ColNode;
} else
TopNode = Tdbp->RowNode;
-
+ }
for (; k < Nod && TopNode; k++) {
if (!done) {
TopNode->AddText(g, "\n\t\t");
diff --git a/storage/connect/user_connect.cc b/storage/connect/user_connect.cc
index c25443ef7ef..8abd33079d6 100644
--- a/storage/connect/user_connect.cc
+++ b/storage/connect/user_connect.cc
@@ -112,7 +112,7 @@ bool user_connect::user_init()
if (g)
printf("%s\n", g->Message);
- int rc= PlugExit(g);
+ (void) PlugExit(g);
g= NULL;
if (dup)
diff --git a/storage/connect/user_connect.h b/storage/connect/user_connect.h
index 2670c5bcebc..53064e620f2 100644
--- a/storage/connect/user_connect.h
+++ b/storage/connect/user_connect.h
@@ -35,7 +35,7 @@
//typedef struct _global *PGLOBAL;
typedef class user_connect *PCONNECT;
typedef class ha_connect *PHC;
-static int connect_done_func(void *);
+int connect_done_func(void *);
/*****************************************************************************/
/* The CONNECT users. There should be one by connected users. */
diff --git a/storage/connect/xindex.cpp b/storage/connect/xindex.cpp
index db4d6cbb00d..137e29ab9dd 100644
--- a/storage/connect/xindex.cpp
+++ b/storage/connect/xindex.cpp
@@ -558,13 +558,14 @@ bool XINDEX::Make(PGLOBAL g, PIXDEF sxp)
Nk, n, Num_K, Ndif, addcolp, Tdbp->To_BlkFil, X);
// Check whether the unique index is unique indeed
- if (!Mul)
+ if (!Mul) {
if (Ndif < Num_K) {
strcpy(g->Message, MSG(INDEX_NOT_UNIQ));
brc = true;
goto err;
} else
PlgDBfree(Offset); // Not used anymore
+ }
// Restore kcp list
To_LastCol->Next = addcolp;
@@ -1207,7 +1208,6 @@ bool XINDEX::MapInit(PGLOBAL g)
PCOL colp;
PXCOL prev = NULL, kcp = NULL;
PDOSDEF defp = (PDOSDEF)Tdbp->To_Def;
- PDBUSER dup = PlgGetUser(g);
/*********************************************************************/
/* Get the estimated table size. */
@@ -2038,12 +2038,12 @@ int XINDXS::Range(PGLOBAL g, int limit, bool incl)
kp->Valp->SetValue_pval(xp->GetValue(), !kp->Prefix);
k = FastFind();
- if (k < Num_K || Op != OP_EQ)
+ if (k < Num_K || Op != OP_EQ) {
if (limit)
n = (Mul) ? k : kp->Val_K;
else
n = (Mul) ? Pof[kp->Val_K + 1] - k : 1;
-
+ }
} else {
strcpy(g->Message, MSG(RANGE_NO_JOIN));
n = -1; // Logical error
diff --git a/storage/connect/zip.c b/storage/connect/zip.c
index 4bbe31ab7dd..18614576ef4 100644
--- a/storage/connect/zip.c
+++ b/storage/connect/zip.c
@@ -518,16 +518,16 @@ local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f
if (ZREAD64(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize)
break;
- for (i=(int)uReadSize-3; (i--)>0;)
+ for (i=(int)uReadSize-3; (i--)>0;) {
if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
{
uPosFound = uReadPos+i;
break;
}
-
- if (uPosFound!=0)
- break;
+ }
+ if (uPosFound!=0)
+ break;
}
TRYFREE(buf);
return uPosFound;
@@ -1066,11 +1066,10 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename,
uInt i;
int err = ZIP_OK;
-# ifdef NOCRYPT
- (crcForCrypting);
+#ifdef NOCRYPT
if (password != NULL)
return ZIP_PARAMERROR;
-# endif
+#endif
if (file == NULL)
return ZIP_PARAMERROR;
diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc
index badb515c2b2..ac5a0eeb850 100644
--- a/storage/csv/ha_tina.cc
+++ b/storage/csv/ha_tina.cc
@@ -168,7 +168,6 @@ static int tina_init_func(void *p)
mysql_mutex_init(csv_key_mutex_tina, &tina_mutex, MY_MUTEX_INIT_FAST);
(void) my_hash_init(&tina_open_tables,system_charset_info,32,0,0,
(my_hash_get_key) tina_get_key,0,0);
- tina_hton->state= SHOW_OPTION_YES;
tina_hton->db_type= DB_TYPE_CSV_DB;
tina_hton->create= tina_create_handler;
tina_hton->flags= (HTON_CAN_RECREATE | HTON_SUPPORT_LOG_TABLES |
@@ -829,8 +828,8 @@ int ha_tina::find_current_row(uchar *buf)
Thus, for enums we silence the warning, as it doesn't really mean
an invalid value.
*/
- if ((*field)->store(buffer.ptr(), buffer.length(), buffer.charset(),
- is_enum ? CHECK_FIELD_IGNORE : CHECK_FIELD_WARN))
+ if ((*field)->store_text(buffer.ptr(), buffer.length(), buffer.charset(),
+ is_enum ? CHECK_FIELD_IGNORE : CHECK_FIELD_WARN))
{
if (!is_enum)
goto err;
diff --git a/storage/example/ha_example.cc b/storage/example/ha_example.cc
index d5d7594791e..818081518f5 100644
--- a/storage/example/ha_example.cc
+++ b/storage/example/ha_example.cc
@@ -257,7 +257,6 @@ static int example_init_func(void *p)
#endif
example_hton= (handlerton *)p;
- example_hton->state= SHOW_OPTION_YES;
example_hton->create= example_create_handler;
example_hton->flags= HTON_CAN_RECREATE;
example_hton->table_options= example_table_option_list;
diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc
index ec34cf16858..6f231ef2c36 100644
--- a/storage/federated/ha_federated.cc
+++ b/storage/federated/ha_federated.cc
@@ -480,7 +480,6 @@ int federated_db_init(void *p)
#endif /* HAVE_PSI_INTERFACE */
handlerton *federated_hton= (handlerton *)p;
- federated_hton->state= SHOW_OPTION_YES;
federated_hton->db_type= DB_TYPE_FEDERATED_DB;
federated_hton->commit= federated_commit;
federated_hton->rollback= federated_rollback;
@@ -960,7 +959,7 @@ uint ha_federated::convert_row_to_internal_format(uchar *record,
if (bitmap_is_set(table->read_set, (*field)->field_index))
{
(*field)->set_notnull();
- (*field)->store(*row, *lengths, &my_charset_bin);
+ (*field)->store_text(*row, *lengths, &my_charset_bin);
}
}
(*field)->move_field_offset(-old_ptr);
diff --git a/storage/federatedx/ha_federatedx.cc b/storage/federatedx/ha_federatedx.cc
index bea7f2cfb87..7db6fe9d541 100644
--- a/storage/federatedx/ha_federatedx.cc
+++ b/storage/federatedx/ha_federatedx.cc
@@ -426,7 +426,6 @@ int federatedx_db_init(void *p)
DBUG_ENTER("federatedx_db_init");
init_federated_psi_keys();
federatedx_hton= (handlerton *)p;
- federatedx_hton->state= SHOW_OPTION_YES;
/* Needed to work with old .frm files */
federatedx_hton->db_type= DB_TYPE_FEDERATED_DB;
federatedx_hton->savepoint_offset= sizeof(ulong);
@@ -894,7 +893,8 @@ uint ha_federatedx::convert_row_to_internal_format(uchar *record,
if (bitmap_is_set(table->read_set, (*field)->field_index))
{
(*field)->set_notnull();
- (*field)->store(io->get_column_data(row, column), lengths[column], &my_charset_bin);
+ (*field)->store_text(io->get_column_data(row, column), lengths[column],
+ &my_charset_bin);
}
}
(*field)->move_field_offset(-old_ptr);
@@ -1746,10 +1746,13 @@ ha_rows ha_federatedx::records_in_range(uint inx, key_range *start_key,
federatedx_txn *ha_federatedx::get_txn(THD *thd, bool no_create)
{
- federatedx_txn **txnp= (federatedx_txn **) ha_data(thd);
- if (!*txnp && !no_create)
- *txnp= new federatedx_txn();
- return *txnp;
+ federatedx_txn *txn= (federatedx_txn *) thd_get_ha_data(thd, federatedx_hton);
+ if (!txn && !no_create)
+ {
+ txn= new federatedx_txn();
+ thd_set_ha_data(thd, federatedx_hton, txn);
+ }
+ return txn;
}
@@ -1757,7 +1760,6 @@ int ha_federatedx::disconnect(handlerton *hton, MYSQL_THD thd)
{
federatedx_txn *txn= (federatedx_txn *) thd_get_ha_data(thd, hton);
delete txn;
- *((federatedx_txn **) thd_ha_data(thd, hton))= 0;
return 0;
}
diff --git a/storage/heap/ha_heap.cc b/storage/heap/ha_heap.cc
index acc835cf300..b03c9dfd002 100644
--- a/storage/heap/ha_heap.cc
+++ b/storage/heap/ha_heap.cc
@@ -49,7 +49,6 @@ int heap_init(void *p)
#endif
heap_hton= (handlerton *)p;
- heap_hton->state= SHOW_OPTION_YES;
heap_hton->db_type= DB_TYPE_HEAP;
heap_hton->create= heap_create_handler;
heap_hton->panic= heap_panic;
diff --git a/storage/heap/hp_write.c b/storage/heap/hp_write.c
index 877c1bcecb6..670f628a2d5 100644
--- a/storage/heap/hp_write.c
+++ b/storage/heap/hp_write.c
@@ -145,21 +145,21 @@ static uchar *next_free_record_pos(HP_SHARE *info)
DBUG_PRINT("exit",("Used old position: %p", pos));
DBUG_RETURN(pos);
}
+ if ((info->records > info->max_records && info->max_records) ||
+ (info->data_length + info->index_length >= info->max_table_size))
+ {
+ DBUG_PRINT("error",
+ ("record file full. records: %lu max_records: %lu "
+ "data_length: %llu index_length: %llu "
+ "max_table_size: %llu",
+ info->records, info->max_records,
+ info->data_length, info->index_length,
+ info->max_table_size));
+ my_errno=HA_ERR_RECORD_FILE_FULL;
+ DBUG_RETURN(NULL);
+ }
if (!(block_pos=(info->records % info->block.records_in_block)))
{
- if ((info->records > info->max_records && info->max_records) ||
- (info->data_length + info->index_length >= info->max_table_size))
- {
- DBUG_PRINT("error",
- ("record file full. records: %lu max_records: %lu "
- "data_length: %llu index_length: %llu "
- "max_table_size: %llu",
- info->records, info->max_records,
- info->data_length, info->index_length,
- info->max_table_size));
- my_errno=HA_ERR_RECORD_FILE_FULL;
- DBUG_RETURN(NULL);
- }
if (hp_get_new_block(info, &info->block,&length))
DBUG_RETURN(NULL);
info->data_length+=length;
diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc
index ac794cc8d10..d9253809642 100644
--- a/storage/innobase/btr/btr0btr.cc
+++ b/storage/innobase/btr/btr0btr.cc
@@ -215,7 +215,7 @@ buf_block_t*
btr_root_block_get(
/*===============*/
const dict_index_t* index, /*!< in: index tree */
- ulint mode, /*!< in: either RW_S_LATCH
+ rw_lock_type_t mode, /*!< in: either RW_S_LATCH
or RW_X_LATCH */
mtr_t* mtr) /*!< in: mtr */
{
@@ -223,10 +223,8 @@ btr_root_block_get(
return NULL;
}
- buf_block_t* block = btr_block_get(
- page_id_t(index->table->space_id, index->page),
- index->table->space->zip_size(), mode,
- index, mtr);
+ buf_block_t* block = btr_block_get(*index, index->page, mode, false,
+ mtr);
if (!block) {
index->table->file_unreadable = true;
@@ -354,11 +352,8 @@ btr_root_adjust_on_import(
dberr_t err;
mtr_t mtr;
page_t* page;
- buf_block_t* block;
page_zip_des_t* page_zip;
dict_table_t* table = index->table;
- const page_id_t page_id(table->space_id, index->page);
- const ulint zip_size = table->space->zip_size();
DBUG_EXECUTE_IF("ib_import_trigger_corruption_3",
return(DB_CORRUPTION););
@@ -367,7 +362,17 @@ btr_root_adjust_on_import(
mtr_set_log_mode(&mtr, MTR_LOG_NO_REDO);
- block = btr_block_get(page_id, zip_size, RW_X_LATCH, index, &mtr);
+ buf_block_t* block = buf_page_get_gen(
+ page_id_t(table->space->id, index->page),
+ table->space->zip_size(), RW_X_LATCH, NULL, BUF_GET,
+ __FILE__, __LINE__,
+ &mtr, &err);
+ if (!block) {
+ ut_ad(err != DB_SUCCESS);
+ goto func_exit;
+ }
+
+ buf_block_dbg_add_level(block, SYNC_TREE_NODE);
page = buf_block_get_frame(block);
page_zip = buf_block_get_page_zip(block);
@@ -418,6 +423,7 @@ btr_root_adjust_on_import(
err = DB_CORRUPTION;
}
+func_exit:
mtr_commit(&mtr);
return(err);
@@ -827,10 +833,9 @@ btr_node_ptr_get_child(
== page_get_space_id(page_align(node_ptr)));
return btr_block_get(
- page_id_t(index->table->space_id,
- btr_node_ptr_get_child_page_no(node_ptr, offsets)),
- index->table->space->zip_size(),
- RW_SX_LATCH, index, mtr);
+ *index, btr_node_ptr_get_child_page_no(node_ptr, offsets),
+ RW_SX_LATCH, btr_page_get_level(page_align(node_ptr)) == 1,
+ mtr);
}
/************************************************************//**
@@ -1507,7 +1512,7 @@ btr_page_reorganize_low(
}
if (page_zip
- && !page_zip_compress(page_zip, page, index, z_level, mtr)) {
+ && !page_zip_compress(block, index, z_level, mtr)) {
/* Restore the old page and exit. */
#if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG
@@ -1951,7 +1956,7 @@ btr_root_raise_and_insert(
ut_a(new_page_zip);
/* Copy the page byte for byte. */
- page_zip_copy_recs(new_page_zip, new_page,
+ page_zip_copy_recs(new_block,
root_page_zip, root, index, mtr);
/* Update the lock table and possible hash index. */
@@ -2495,7 +2500,6 @@ btr_attach_half_pages(
{
ulint prev_page_no;
ulint next_page_no;
- ulint level;
page_t* page = buf_block_get_frame(block);
page_t* lower_page;
page_t* upper_page;
@@ -2548,28 +2552,24 @@ btr_attach_half_pages(
upper_page_zip = buf_block_get_page_zip(new_block);
}
+ /* Get the level of the split pages */
+ const ulint level = btr_page_get_level(buf_block_get_frame(block));
+ ut_ad(level == btr_page_get_level(buf_block_get_frame(new_block)));
+
/* Get the previous and next pages of page */
prev_page_no = btr_page_get_prev(page, mtr);
next_page_no = btr_page_get_next(page, mtr);
- const ulint space = block->page.id.space();
-
/* for consistency, both blocks should be locked, before change */
if (prev_page_no != FIL_NULL && direction == FSP_DOWN) {
- prev_block = btr_block_get(
- page_id_t(space, prev_page_no), block->zip_size(),
- RW_X_LATCH, index, mtr);
+ prev_block = btr_block_get(*index, prev_page_no, RW_X_LATCH,
+ !level, mtr);
}
if (next_page_no != FIL_NULL && direction != FSP_DOWN) {
- next_block = btr_block_get(
- page_id_t(space, next_page_no), block->zip_size(),
- RW_X_LATCH, index, mtr);
+ next_block = btr_block_get(*index, next_page_no, RW_X_LATCH,
+ !level, mtr);
}
- /* Get the level of the split pages */
- level = btr_page_get_level(buf_block_get_frame(block));
- ut_ad(level == btr_page_get_level(buf_block_get_frame(new_block)));
-
/* Build the node pointer (= node key and page address) for the upper
half */
@@ -2709,11 +2709,11 @@ btr_insert_into_right_sibling(
rec_t* rec = NULL;
ulint max_size;
- const ulint space = block->page.id.space();
-
- next_block = btr_block_get(
- page_id_t(space, next_page_no), block->zip_size(),
- RW_X_LATCH, cursor->index, mtr);
+ next_block = btr_block_get(*cursor->index, next_page_no, RW_X_LATCH,
+ page_is_leaf(page), mtr);
+ if (UNIV_UNLIKELY(!next_block)) {
+ return NULL;
+ }
next_page = buf_block_get_frame(next_block);
bool is_leaf = page_is_leaf(next_page);
@@ -3026,7 +3026,7 @@ insert_empty:
as appropriate. Deleting will always succeed. */
ut_a(new_page_zip);
- page_zip_copy_recs(new_page_zip, new_page,
+ page_zip_copy_recs(new_block,
page_zip, page, cursor->index, mtr);
page_delete_rec_list_end(move_limit - page + new_page,
new_block, cursor->index,
@@ -3069,7 +3069,7 @@ insert_empty:
as appropriate. Deleting will always succeed. */
ut_a(new_page_zip);
- page_zip_copy_recs(new_page_zip, new_page,
+ page_zip_copy_recs(new_block,
page_zip, page, cursor->index, mtr);
page_delete_rec_list_start(move_limit - page
+ new_page, new_block,
@@ -3200,35 +3200,27 @@ func_exit:
}
/** Remove a page from the level list of pages.
-@param[in] space space where removed
-@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0
-@param[in,out] page page to remove
+@param[in] block page to remove
@param[in] index index tree
@param[in,out] mtr mini-transaction */
-void
-btr_level_list_remove_func(
- ulint space,
- ulint zip_size,
- page_t* page,
- dict_index_t* index,
- mtr_t* mtr)
+void btr_level_list_remove(const buf_block_t& block, const dict_index_t& index,
+ mtr_t* mtr)
{
- ut_ad(page != NULL);
- ut_ad(mtr != NULL);
- ut_ad(mtr_memo_contains_page(mtr, page, MTR_MEMO_PAGE_X_FIX));
- ut_ad(space == page_get_space_id(page));
+ ut_ad(mtr_memo_contains(mtr, &block, MTR_MEMO_PAGE_X_FIX));
+ ut_ad(block.zip_size() == index.table->space->zip_size());
+ ut_ad(index.table->space->id == block.page.id.space());
/* Get the previous and next page numbers of page */
+ const page_t* page = block.frame;
const ulint prev_page_no = btr_page_get_prev(page, mtr);
const ulint next_page_no = btr_page_get_next(page, mtr);
/* Update page links of the level */
if (prev_page_no != FIL_NULL) {
- buf_block_t* prev_block
- = btr_block_get(page_id_t(space, prev_page_no),
- zip_size, RW_X_LATCH, index, mtr);
-
+ buf_block_t* prev_block = btr_block_get(
+ index, prev_page_no, RW_X_LATCH, page_is_leaf(page),
+ mtr);
page_t* prev_page
= buf_block_get_frame(prev_block);
#ifdef UNIV_BTR_DEBUG
@@ -3243,11 +3235,9 @@ btr_level_list_remove_func(
}
if (next_page_no != FIL_NULL) {
- buf_block_t* next_block
- = btr_block_get(
- page_id_t(space, next_page_no), zip_size,
- RW_X_LATCH, index, mtr);
-
+ buf_block_t* next_block = btr_block_get(
+ index, next_page_no, RW_X_LATCH, page_is_leaf(page),
+ mtr);
page_t* next_page
= buf_block_get_frame(next_block);
#ifdef UNIV_BTR_DEBUG
@@ -3349,7 +3339,6 @@ btr_lift_page_up(
mtr_t* mtr) /*!< in: mtr */
{
buf_block_t* father_block;
- page_t* father_page;
ulint page_level;
page_zip_des_t* father_page_zip;
page_t* page = buf_block_get_frame(block);
@@ -3386,7 +3375,6 @@ btr_lift_page_up(
}
father_block = btr_cur_get_block(&cursor);
father_page_zip = buf_block_get_page_zip(father_block);
- father_page = buf_block_get_frame(father_block);
n_blocks = 0;
@@ -3434,7 +3422,6 @@ btr_lift_page_up(
father_block = blocks[0];
father_page_zip = buf_block_get_page_zip(father_block);
- father_page = buf_block_get_frame(father_block);
}
mem_heap_free(heap);
@@ -3469,7 +3456,7 @@ btr_lift_page_up(
ut_a(page_zip);
/* Copy the page byte for byte. */
- page_zip_copy_recs(father_page_zip, father_page,
+ page_zip_copy_recs(father_block,
page_zip, page, index, mtr);
/* Update the lock table and possible hash index. */
@@ -3522,7 +3509,7 @@ btr_lift_page_up(
&& !index->table->is_temporary()) {
ibuf_reset_free_bits(father_block);
}
- ut_ad(page_validate(father_page, index));
+ ut_ad(page_validate(father_block->frame, index));
ut_ad(btr_check_node_ptr(index, father_block, mtr));
return(lift_father_up ? block_orig : father_block);
@@ -3587,8 +3574,6 @@ btr_compress(
ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
- const ulint zip_size = index->table->space->zip_size();
-
MONITOR_INC(MONITOR_INDEX_MERGE_ATTEMPTS);
left_page_no = btr_page_get_prev(page, mtr);
@@ -3744,8 +3729,7 @@ retry:
btr_search_drop_page_hash_index(block);
/* Remove the page from the level list */
- btr_level_list_remove(index->table->space_id,
- zip_size, page, index, mtr);
+ btr_level_list_remove(*block, *index, mtr);
if (dict_index_is_spatial(index)) {
rec_t* my_rec = father_cursor.page_cur.rec;
@@ -3874,8 +3858,7 @@ retry:
#endif /* UNIV_BTR_DEBUG */
/* Remove the page from the level list */
- btr_level_list_remove(index->table->space_id,
- zip_size, page, index, mtr);
+ btr_level_list_remove(*block, *index, mtr);
ut_ad(btr_node_ptr_get_child_page_no(
btr_cur_get_rec(&father_cursor), offsets)
@@ -3983,7 +3966,7 @@ retry:
committed mini-transaction, because in crash recovery,
the free bits could momentarily be set too high. */
- if (zip_size) {
+ if (merge_block->zip_size()) {
/* Because the free bits may be incremented
and we cannot update the insert buffer bitmap
in the same mini-transaction, the only safe
@@ -4043,9 +4026,8 @@ func_exit:
err_exit:
/* We play it safe and reset the free bits. */
- if (zip_size
- && merge_page
- && page_is_leaf(merge_page)
+ if (merge_block && merge_block->zip_size()
+ && page_is_leaf(merge_block->frame)
&& !dict_index_is_clust(index)) {
ibuf_reset_free_bits(merge_block);
@@ -4217,13 +4199,10 @@ btr_discard_page(
left_page_no = btr_page_get_prev(buf_block_get_frame(block), mtr);
right_page_no = btr_page_get_next(buf_block_get_frame(block), mtr);
- const ulint zip_size = index->table->space->zip_size();
ut_d(bool parent_is_different = false);
if (left_page_no != FIL_NULL) {
- merge_block = btr_block_get(
- page_id_t(index->table->space_id, left_page_no),
- zip_size, RW_X_LATCH, index, mtr);
-
+ merge_block = btr_block_get(*index, left_page_no, RW_X_LATCH,
+ true, mtr);
merge_page = buf_block_get_frame(merge_block);
#ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_next(merge_page, mtr)
@@ -4236,10 +4215,8 @@ btr_discard_page(
&parent_cursor)))
== btr_cur_get_rec(&parent_cursor)));
} else if (right_page_no != FIL_NULL) {
- merge_block = btr_block_get(
- page_id_t(index->table->space_id, right_page_no),
- zip_size, RW_X_LATCH, index, mtr);
-
+ merge_block = btr_block_get(*index, right_page_no, RW_X_LATCH,
+ true, mtr);
merge_page = buf_block_get_frame(merge_block);
#ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_prev(merge_page, mtr)
@@ -4280,8 +4257,7 @@ btr_discard_page(
}
/* Remove the page from the level list */
- btr_level_list_remove(index->table->space_id, zip_size,
- page, index, mtr);
+ btr_level_list_remove(*block, *index, mtr);
#ifdef UNIV_ZIP_DEBUG
{
@@ -4843,7 +4819,6 @@ btr_validate_level(
page = buf_block_get_frame(block);
fil_space_t* space = index->table->space;
- const ulint zip_size = space->zip_size();
while (level != btr_page_get_level(page)) {
const rec_t* node_ptr;
@@ -4893,11 +4868,9 @@ btr_validate_level(
&mtr, savepoint2, block);
savepoint2 = mtr_set_savepoint(&mtr);
- block = btr_block_get(
- page_id_t(index->table->space_id,
- left_page_no),
- zip_size,
- RW_SX_LATCH, index, &mtr);
+ block = btr_block_get(*index, left_page_no,
+ RW_SX_LATCH, false,
+ &mtr);
page = buf_block_get_frame(block);
left_page_no = btr_page_get_prev(page, &mtr);
}
@@ -4965,11 +4938,8 @@ loop:
const rec_t* right_rec;
savepoint = mtr_set_savepoint(&mtr);
- right_block = btr_block_get(
- page_id_t(index->table->space_id, right_page_no),
- zip_size,
- RW_SX_LATCH, index, &mtr);
-
+ right_block = btr_block_get(*index, right_page_no, RW_SX_LATCH,
+ !level, &mtr);
right_page = buf_block_get_frame(right_block);
if (btr_page_get_prev(right_page, &mtr)
@@ -5142,17 +5112,12 @@ loop:
mtr_release_block_at_savepoint(
&mtr, savepoint, right_block);
- btr_block_get(
- page_id_t(index->table->space_id,
- parent_right_page_no),
- zip_size,
- RW_SX_LATCH, index, &mtr);
-
- right_block = btr_block_get(
- page_id_t(index->table->space_id,
- right_page_no),
- zip_size,
- RW_SX_LATCH, index, &mtr);
+ btr_block_get(*index, parent_right_page_no,
+ RW_SX_LATCH, false, &mtr);
+ right_block = btr_block_get(*index,
+ right_page_no,
+ RW_SX_LATCH,
+ !level, &mtr);
}
btr_cur_position(
@@ -5225,27 +5190,19 @@ node_ptr_fails:
if (!lockout) {
if (rightmost_child) {
if (parent_right_page_no != FIL_NULL) {
- btr_block_get(
- page_id_t(
- index->table->space_id,
- parent_right_page_no),
- zip_size,
- RW_SX_LATCH, index, &mtr);
+ btr_block_get(*index,
+ parent_right_page_no,
+ RW_SX_LATCH, false,
+ &mtr);
}
} else if (parent_page_no != FIL_NULL) {
- btr_block_get(
- page_id_t(index->table->space_id,
- parent_page_no),
- zip_size,
- RW_SX_LATCH, index, &mtr);
+ btr_block_get(*index, parent_page_no,
+ RW_SX_LATCH, false, &mtr);
}
}
- block = btr_block_get(
- page_id_t(index->table->space_id, right_page_no),
- zip_size,
- RW_SX_LATCH, index, &mtr);
-
+ block = btr_block_get(*index, right_page_no, RW_SX_LATCH,
+ !level, &mtr);
page = buf_block_get_frame(block);
goto loop;
@@ -5348,10 +5305,8 @@ btr_can_merge_with_page(
index = btr_cur_get_index(cursor);
page = btr_cur_get_page(cursor);
- const page_id_t page_id(index->table->space_id, page_no);
- const ulint zip_size = index->table->space->zip_size();
-
- mblock = btr_block_get(page_id, zip_size, RW_X_LATCH, index, mtr);
+ mblock = btr_block_get(*index, page_no, RW_X_LATCH, page_is_leaf(page),
+ mtr);
mpage = buf_block_get_frame(mblock);
n_recs = page_get_n_recs(page);
@@ -5367,7 +5322,7 @@ btr_can_merge_with_page(
/* If compression padding tells us that merging will result in
too packed up page i.e.: which is likely to cause compression
failure then don't merge the pages. */
- if (zip_size && page_is_leaf(mpage)
+ if (mblock->page.zip.data && page_is_leaf(mpage)
&& (page_get_data_size(mpage) + data_size
>= dict_index_zip_pad_optimal_page_size(index))) {
diff --git a/storage/innobase/btr/btr0bulk.cc b/storage/innobase/btr/btr0bulk.cc
index 6123fafcbac..f2ad31f3a5d 100644
--- a/storage/innobase/btr/btr0bulk.cc
+++ b/storage/innobase/btr/btr0bulk.cc
@@ -119,10 +119,8 @@ PageBulk::init()
m_index->id, &m_mtr);
}
} else {
- new_block = btr_block_get(
- page_id_t(m_index->table->space_id, m_page_no),
- m_index->table->space->zip_size(),
- RW_X_LATCH, m_index, &m_mtr);
+ new_block = btr_block_get(*m_index, m_page_no, RW_X_LATCH,
+ false, &m_mtr);
new_page = buf_block_get_frame(new_block);
new_page_zip = buf_block_get_page_zip(new_block);
@@ -373,8 +371,7 @@ PageBulk::compress()
{
ut_ad(m_page_zip != NULL);
- return(page_zip_compress(m_page_zip, m_page, m_index,
- page_zip_level, &m_mtr));
+ return page_zip_compress(m_block, m_index, page_zip_level, &m_mtr);
}
/** Get node pointer
@@ -1016,10 +1013,8 @@ BtrBulk::finish(dberr_t err)
mtr_x_lock(&m_index->lock, &mtr);
ut_ad(last_page_no != FIL_NULL);
- last_block = btr_block_get(
- page_id_t(m_index->table->space_id, last_page_no),
- m_index->table->space->zip_size(),
- RW_X_LATCH, m_index, &mtr);
+ last_block = btr_block_get(*m_index, last_page_no, RW_X_LATCH,
+ false, &mtr);
first_rec = page_rec_get_next(
page_get_infimum_rec(last_block->frame));
ut_ad(page_rec_is_user_rec(first_rec));
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc
index d3c830256f6..0d24e3ffb94 100644
--- a/storage/innobase/btr/btr0cur.cc
+++ b/storage/innobase/btr/btr0cur.cc
@@ -209,8 +209,6 @@ btr_rec_free_externally_stored_fields(
/** Latches the leaf page or pages requested.
@param[in] block leaf page where the search converged
-@param[in] page_id page id of the leaf
-@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0
@param[in] latch_mode BTR_SEARCH_LEAF, ...
@param[in] cursor cursor
@param[in] mtr mini-transaction
@@ -218,13 +216,11 @@ btr_rec_free_externally_stored_fields(
btr_latch_leaves_t
btr_cur_latch_leaves(
buf_block_t* block,
- const page_id_t page_id,
- ulint zip_size,
ulint latch_mode,
btr_cur_t* cursor,
mtr_t* mtr)
{
- ulint mode;
+ rw_lock_type_t mode;
ulint left_page_no;
ulint right_page_no;
buf_block_t* get_block;
@@ -235,6 +231,7 @@ btr_cur_latch_leaves(
compile_time_assert(int(MTR_MEMO_PAGE_S_FIX) == int(RW_S_LATCH));
compile_time_assert(int(MTR_MEMO_PAGE_X_FIX) == int(RW_X_LATCH));
compile_time_assert(int(MTR_MEMO_PAGE_SX_FIX) == int(RW_SX_LATCH));
+ ut_ad(block->page.id.space() == cursor->index->table->space->id);
spatial = dict_index_is_spatial(cursor->index) && cursor->rtr_info;
ut_ad(buf_page_in_file(&block->page));
@@ -250,8 +247,9 @@ btr_cur_latch_leaves(
mode = latch_mode == BTR_MODIFY_LEAF ? RW_X_LATCH : RW_S_LATCH;
latch_leaves.savepoints[1] = mtr_set_savepoint(mtr);
- get_block = btr_block_get(page_id, zip_size, mode,
- cursor->index, mtr);
+ get_block = btr_block_get(*cursor->index,
+ block->page.id.page_no(), mode,
+ true, mtr);
latch_leaves.blocks[1] = get_block;
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(get_block->frame) == page_is_comp(page));
@@ -271,7 +269,6 @@ btr_cur_latch_leaves(
MTR_MEMO_X_LOCK | MTR_MEMO_SX_LOCK));
/* x-latch also siblings from left to right */
left_page_no = btr_page_get_prev(page, mtr);
- mode = latch_mode;
if (left_page_no != FIL_NULL) {
@@ -282,8 +279,8 @@ btr_cur_latch_leaves(
latch_leaves.savepoints[0] = mtr_set_savepoint(mtr);
get_block = btr_block_get(
- page_id_t(page_id.space(), left_page_no),
- zip_size, RW_X_LATCH, cursor->index, mtr);
+ *cursor->index, left_page_no, RW_X_LATCH,
+ true, mtr);
latch_leaves.blocks[0] = get_block;
if (spatial) {
@@ -299,7 +296,8 @@ btr_cur_latch_leaves(
latch_leaves.savepoints[1] = mtr_set_savepoint(mtr);
get_block = btr_block_get(
- page_id, zip_size, RW_X_LATCH, cursor->index, mtr);
+ *cursor->index, block->page.id.page_no(),
+ RW_X_LATCH, true, mtr);
latch_leaves.blocks[1] = get_block;
#ifdef UNIV_BTR_DEBUG
@@ -328,9 +326,9 @@ btr_cur_latch_leaves(
mtr);
}
latch_leaves.savepoints[2] = mtr_set_savepoint(mtr);
- get_block = btr_block_get(
- page_id_t(page_id.space(), right_page_no),
- zip_size, RW_X_LATCH, cursor->index, mtr);
+ get_block = btr_block_get(*cursor->index,
+ right_page_no, RW_X_LATCH,
+ true, mtr);
latch_leaves.blocks[2] = get_block;
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(get_block->frame)
@@ -357,8 +355,8 @@ btr_cur_latch_leaves(
if (left_page_no != FIL_NULL) {
latch_leaves.savepoints[0] = mtr_set_savepoint(mtr);
get_block = btr_block_get(
- page_id_t(page_id.space(), left_page_no),
- zip_size, mode, cursor->index, mtr);
+ *cursor->index, left_page_no, mode,
+ true, mtr);
latch_leaves.blocks[0] = get_block;
cursor->left_block = get_block;
#ifdef UNIV_BTR_DEBUG
@@ -370,8 +368,9 @@ btr_cur_latch_leaves(
}
latch_leaves.savepoints[1] = mtr_set_savepoint(mtr);
- get_block = btr_block_get(page_id, zip_size, mode,
- cursor->index, mtr);
+ get_block = btr_block_get(*cursor->index,
+ block->page.id.page_no(), mode,
+ true, mtr);
latch_leaves.blocks[1] = get_block;
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(get_block->frame) == page_is_comp(page));
@@ -729,7 +728,7 @@ btr_cur_optimistic_latch_leaves(
unsigned line,
mtr_t* mtr)
{
- ulint mode;
+ rw_lock_type_t mode;
ulint left_page_no;
switch (*latch_mode) {
@@ -757,23 +756,17 @@ btr_cur_optimistic_latch_leaves(
goto unpin_failed;
}
- left_page_no = btr_page_get_prev(
- buf_block_get_frame(block), mtr);
+ left_page_no = btr_page_get_prev(block->frame, mtr);
rw_lock_s_unlock(&block->lock);
- if (left_page_no != FIL_NULL) {
- cursor->left_block = btr_block_get(
- page_id_t(cursor->index->table->space_id,
- left_page_no),
- cursor->index->table->space->zip_size(),
- mode, cursor->index, mtr);
- } else {
- cursor->left_block = NULL;
- }
+ cursor->left_block = left_page_no != FIL_NULL
+ ? btr_block_get(*cursor->index, left_page_no, mode,
+ page_is_leaf(block->frame), mtr)
+ : NULL;
if (buf_page_optimistic_get(mode, block, modify_clock,
file, line, mtr)) {
- if (btr_page_get_prev(buf_block_get_frame(block), mtr)
+ if (btr_page_get_prev(block->frame, mtr)
== left_page_no) {
buf_block_buf_fix_dec(block);
*latch_mode = mode;
@@ -1195,7 +1188,6 @@ btr_cur_search_to_nth_level_func(
ulint up_bytes;
ulint low_match;
ulint low_bytes;
- ulint savepoint;
ulint rw_latch;
page_cur_mode_t page_mode;
page_cur_mode_t search_mode = PAGE_CUR_UNSUPP;
@@ -1207,7 +1199,6 @@ btr_cur_search_to_nth_level_func(
ulint root_height = 0; /* remove warning */
dberr_t err = DB_SUCCESS;
- ulint upper_rw_latch, root_leaf_rw_latch;
btr_intention_t lock_intention;
bool modify_external;
buf_block_t* tree_blocks[BTR_MAX_LEVELS];
@@ -1397,7 +1388,9 @@ btr_cur_search_to_nth_level_func(
/* Store the position of the tree latch we push to mtr so that we
know how to release it when we have latched leaf node(s) */
- savepoint = mtr_set_savepoint(mtr);
+ ulint savepoint = mtr_set_savepoint(mtr);
+
+ rw_lock_type_t upper_rw_latch;
switch (latch_mode) {
case BTR_MODIFY_TREE:
@@ -1458,7 +1451,8 @@ btr_cur_search_to_nth_level_func(
upper_rw_latch = RW_NO_LATCH;
}
}
- root_leaf_rw_latch = btr_cur_latch_for_root_leaf(latch_mode);
+ const rw_lock_type_t root_leaf_rw_latch = btr_cur_latch_for_root_leaf(
+ latch_mode);
page_cursor = btr_cur_get_page_cur(cursor);
@@ -1546,7 +1540,8 @@ retry_page_get:
ut_ad(n_blocks < BTR_MAX_LEVELS);
tree_savepoints[n_blocks] = mtr_set_savepoint(mtr);
block = buf_page_get_gen(page_id, zip_size, rw_latch, guess,
- buf_mode, file, line, mtr, &err);
+ buf_mode, file, line, mtr, &err,
+ height == 0 && !index->is_clust());
tree_blocks[n_blocks] = block;
/* Note that block==NULL signifies either an error or change
@@ -1691,8 +1686,9 @@ retry_page_get:
tree_blocks[n_blocks]);
tree_savepoints[n_blocks] = mtr_set_savepoint(mtr);
- block = buf_page_get_gen(page_id, zip_size, rw_latch, NULL,
- buf_mode, file, line, mtr, &err);
+ block = buf_page_get_gen(page_id, zip_size,
+ rw_latch, NULL, buf_mode,
+ file, line, mtr, &err);
tree_blocks[n_blocks] = block;
if (err != DB_SUCCESS) {
@@ -1787,10 +1783,8 @@ retry_page_get:
if (height == 0) {
if (rw_latch == RW_NO_LATCH) {
-
latch_leaves = btr_cur_latch_leaves(
- block, page_id, zip_size, latch_mode,
- cursor, mtr);
+ block, latch_mode, cursor, mtr);
}
switch (latch_mode) {
@@ -2346,20 +2340,12 @@ need_opposite_intention:
ut_ad(!autoinc);
if (upper_rw_latch == RW_NO_LATCH) {
- /* latch the page */
- buf_block_t* child_block;
-
- if (latch_mode == BTR_CONT_MODIFY_TREE) {
- child_block = btr_block_get(
- page_id, zip_size, RW_X_LATCH,
- index, mtr);
- } else {
- ut_ad(latch_mode == BTR_CONT_SEARCH_TREE);
- child_block = btr_block_get(
- page_id, zip_size, RW_SX_LATCH,
- index, mtr);
- }
-
+ ut_ad(latch_mode == BTR_CONT_MODIFY_TREE
+ || latch_mode == BTR_CONT_SEARCH_TREE);
+ buf_block_t* child_block = btr_block_get(
+ *index, page_id.page_no(),
+ latch_mode == BTR_CONT_MODIFY_TREE
+ ? RW_X_LATCH : RW_SX_LATCH, false, mtr);
btr_assert_not_corrupted(child_block, index);
} else {
ut_ad(mtr_memo_contains(mtr, block, upper_rw_latch));
@@ -2491,8 +2477,6 @@ btr_cur_open_at_index_side_func(
ulint root_height = 0; /* remove warning */
rec_t* node_ptr;
ulint estimate;
- ulint savepoint;
- ulint upper_rw_latch, root_leaf_rw_latch;
btr_intention_t lock_intention;
buf_block_t* tree_blocks[BTR_MAX_LEVELS];
ulint tree_savepoints[BTR_MAX_LEVELS];
@@ -2529,7 +2513,9 @@ btr_cur_open_at_index_side_func(
/* Store the position of the tree latch we push to mtr so that we
know how to release it when we have latched the leaf node */
- savepoint = mtr_set_savepoint(mtr);
+ ulint savepoint = mtr_set_savepoint(mtr);
+
+ rw_lock_type_t upper_rw_latch;
switch (latch_mode) {
case BTR_CONT_MODIFY_TREE:
@@ -2568,7 +2554,9 @@ btr_cur_open_at_index_side_func(
upper_rw_latch = RW_NO_LATCH;
}
}
- root_leaf_rw_latch = btr_cur_latch_for_root_leaf(latch_mode);
+
+ const rw_lock_type_t root_leaf_rw_latch = btr_cur_latch_for_root_leaf(
+ latch_mode);
page_cursor = btr_cur_get_page_cur(cursor);
cursor->index = index;
@@ -2583,22 +2571,17 @@ btr_cur_open_at_index_side_func(
height = ULINT_UNDEFINED;
for (;;) {
- buf_block_t* block;
- ulint rw_latch;
-
ut_ad(n_blocks < BTR_MAX_LEVELS);
-
- if (height != 0
- && (latch_mode != BTR_MODIFY_TREE
- || height == level)) {
- rw_latch = upper_rw_latch;
- } else {
- rw_latch = RW_NO_LATCH;
- }
-
tree_savepoints[n_blocks] = mtr_set_savepoint(mtr);
- block = buf_page_get_gen(page_id, zip_size, rw_latch, NULL,
- BUF_GET, file, line, mtr, &err);
+
+ const ulint rw_latch = height
+ && (latch_mode != BTR_MODIFY_TREE || height == level)
+ ? upper_rw_latch : RW_NO_LATCH;
+ buf_block_t* block = buf_page_get_gen(page_id, zip_size,
+ rw_latch, NULL, BUF_GET,
+ file, line, mtr, &err,
+ height == 0
+ && !index->is_clust());
ut_ad((block != NULL) == (err == DB_SUCCESS));
tree_blocks[n_blocks] = block;
@@ -2650,77 +2633,62 @@ btr_cur_open_at_index_side_func(
ut_ad(height == btr_page_get_level(page));
}
- if (height == level) {
- if (srv_read_only_mode) {
- btr_cur_latch_leaves(
- block, page_id, zip_size,
- latch_mode, cursor, mtr);
- } else if (height == 0) {
- if (rw_latch == RW_NO_LATCH) {
- btr_cur_latch_leaves(
- block, page_id, zip_size,
- latch_mode, cursor, mtr);
- }
- /* In versions <= 3.23.52 we had
- forgotten to release the tree latch
- here. If in an index scan we had to
- scan far to find a record visible to
- the current transaction, that could
- starve others waiting for the tree
- latch. */
-
- switch (latch_mode) {
- case BTR_MODIFY_TREE:
- case BTR_CONT_MODIFY_TREE:
- case BTR_CONT_SEARCH_TREE:
+ if (height == 0) {
+ if (rw_latch == RW_NO_LATCH) {
+ btr_cur_latch_leaves(block, latch_mode,
+ cursor, mtr);
+ }
+
+ /* In versions <= 3.23.52 we had forgotten to
+ release the tree latch here. If in an index
+ scan we had to scan far to find a record
+ visible to the current transaction, that could
+ starve others waiting for the tree latch. */
+
+ switch (latch_mode) {
+ case BTR_MODIFY_TREE:
+ case BTR_CONT_MODIFY_TREE:
+ case BTR_CONT_SEARCH_TREE:
+ break;
+ default:
+ if (UNIV_UNLIKELY(srv_read_only_mode)) {
break;
- default:
- if (!s_latch_by_caller) {
- /* Release the tree s-latch */
- mtr_release_s_latch_at_savepoint(
- mtr, savepoint,
- dict_index_get_lock(
- index));
- }
+ }
+ if (!s_latch_by_caller) {
+ /* Release the tree s-latch */
+ mtr_release_s_latch_at_savepoint(
+ mtr, savepoint, &index->lock);
+ }
- /* release upper blocks */
- for (; n_releases < n_blocks;
- n_releases++) {
- mtr_release_block_at_savepoint(
- mtr,
- tree_savepoints[
- n_releases],
- tree_blocks[
- n_releases]);
- }
+ /* release upper blocks */
+ for (; n_releases < n_blocks; n_releases++) {
+ mtr_release_block_at_savepoint(
+ mtr,
+ tree_savepoints[n_releases],
+ tree_blocks[n_releases]);
}
- } else { /* height != 0 */
- /* We already have the block latched. */
- ut_ad(latch_mode == BTR_SEARCH_TREE);
- ut_ad(s_latch_by_caller);
- ut_ad(upper_rw_latch == RW_S_LATCH);
+ }
+ } else if (height == level /* height != 0 */
+ && UNIV_LIKELY(!srv_read_only_mode)) {
+ /* We already have the block latched. */
+ ut_ad(latch_mode == BTR_SEARCH_TREE);
+ ut_ad(s_latch_by_caller);
+ ut_ad(upper_rw_latch == RW_S_LATCH);
- ut_ad(mtr_memo_contains(mtr, block,
- upper_rw_latch));
+ ut_ad(mtr_memo_contains(mtr, block, upper_rw_latch));
- if (s_latch_by_caller) {
- /* to exclude modifying tree operations
- should sx-latch the index. */
- ut_ad(mtr_memo_contains(
+ if (s_latch_by_caller) {
+ /* to exclude modifying tree operations
+ should sx-latch the index. */
+ ut_ad(mtr_memo_contains(mtr, &index->lock,
+ MTR_MEMO_SX_LOCK));
+ /* because has sx-latch of index,
+ can release upper blocks. */
+ for (; n_releases < n_blocks; n_releases++) {
+ mtr_release_block_at_savepoint(
mtr,
- dict_index_get_lock(index),
- MTR_MEMO_SX_LOCK));
- /* because has sx-latch of index,
- can release upper blocks. */
- for (; n_releases < n_blocks;
- n_releases++) {
- mtr_release_block_at_savepoint(
- mtr,
- tree_savepoints[
- n_releases],
- tree_blocks[
- n_releases]);
- }
+ tree_savepoints[n_releases],
+ tree_blocks[n_releases]);
}
}
}
@@ -2860,8 +2828,6 @@ btr_cur_open_at_rnd_pos_func(
ulint node_ptr_max_size = srv_page_size / 2;
ulint height;
rec_t* node_ptr;
- ulint savepoint;
- ulint upper_rw_latch, root_leaf_rw_latch;
btr_intention_t lock_intention;
buf_block_t* tree_blocks[BTR_MAX_LEVELS];
ulint tree_savepoints[BTR_MAX_LEVELS];
@@ -2878,7 +2844,9 @@ btr_cur_open_at_rnd_pos_func(
ut_ad(!(latch_mode & BTR_MODIFY_EXTERNAL));
- savepoint = mtr_set_savepoint(mtr);
+ ulint savepoint = mtr_set_savepoint(mtr);
+
+ rw_lock_type_t upper_rw_latch;
switch (latch_mode) {
case BTR_MODIFY_TREE:
@@ -2925,7 +2893,8 @@ btr_cur_open_at_rnd_pos_func(
return(false);
}
- root_leaf_rw_latch = btr_cur_latch_for_root_leaf(latch_mode);
+ const rw_lock_type_t root_leaf_rw_latch = btr_cur_latch_for_root_leaf(
+ latch_mode);
page_cursor = btr_cur_get_page_cur(cursor);
cursor->index = index;
@@ -2941,22 +2910,19 @@ btr_cur_open_at_rnd_pos_func(
height = ULINT_UNDEFINED;
for (;;) {
- buf_block_t* block;
page_t* page;
- ulint rw_latch;
ut_ad(n_blocks < BTR_MAX_LEVELS);
-
- if (height != 0
- && latch_mode != BTR_MODIFY_TREE) {
- rw_latch = upper_rw_latch;
- } else {
- rw_latch = RW_NO_LATCH;
- }
-
tree_savepoints[n_blocks] = mtr_set_savepoint(mtr);
- block = buf_page_get_gen(page_id, zip_size, rw_latch, NULL,
- BUF_GET, file, line, mtr, &err);
+
+ const rw_lock_type_t rw_latch = height
+ && latch_mode != BTR_MODIFY_TREE
+ ? upper_rw_latch : RW_NO_LATCH;
+ buf_block_t* block = buf_page_get_gen(page_id, zip_size,
+ rw_latch, NULL, BUF_GET,
+ file, line, mtr, &err,
+ height == 0
+ && !index->is_clust());
tree_blocks[n_blocks] = block;
ut_ad((block != NULL) == (err == DB_SUCCESS));
@@ -3007,9 +2973,8 @@ btr_cur_open_at_rnd_pos_func(
if (height == 0) {
if (rw_latch == RW_NO_LATCH
|| srv_read_only_mode) {
- btr_cur_latch_leaves(
- block, page_id, zip_size,
- latch_mode, cursor, mtr);
+ btr_cur_latch_leaves(block, latch_mode, cursor,
+ mtr);
}
/* btr_cur_open_at_index_side_func() and
@@ -7476,9 +7441,7 @@ struct btr_blob_log_check_t {
if (m_op == BTR_STORE_INSERT_BULK) {
mtr_x_lock(dict_index_get_lock(index), m_mtr);
m_pcur->btr_cur.page_cur.block = btr_block_get(
- page_id_t(index->table->space_id, page_no),
- index->table->space->zip_size(),
- RW_X_LATCH, index, m_mtr);
+ *index, page_no, RW_X_LATCH, false, m_mtr);
m_pcur->btr_cur.page_cur.rec
= m_pcur->btr_cur.page_cur.block->frame
+ offs;
diff --git a/storage/innobase/btr/btr0defragment.cc b/storage/innobase/btr/btr0defragment.cc
index 6a1d23fb472..631527d2f1f 100644
--- a/storage/innobase/btr/btr0defragment.cc
+++ b/storage/innobase/btr/btr0defragment.cc
@@ -162,11 +162,7 @@ btr_defragment_add_index(
*err = DB_SUCCESS;
mtr_start(&mtr);
- // Load index rood page.
- buf_block_t* block = btr_block_get(
- page_id_t(index->table->space_id, index->page),
- index->table->space->zip_size(),
- RW_NO_LATCH, index, &mtr);
+ buf_block_t* block = btr_root_block_get(index, RW_NO_LATCH, &mtr);
page_t* page = NULL;
if (block) {
@@ -369,7 +365,7 @@ btr_defragment_calc_n_recs_for_size(
Merge as many records from the from_block to the to_block. Delete
the from_block if all records are successfully merged to to_block.
@return the to_block to target for next merge operation. */
-UNIV_INTERN
+static
buf_block_t*
btr_defragment_merge_pages(
dict_index_t* index, /*!< in: index tree */
@@ -487,9 +483,7 @@ btr_defragment_merge_pages(
lock_update_merge_left(to_block, orig_pred,
from_block);
btr_search_drop_page_hash_index(from_block);
- btr_level_list_remove(
- index->table->space_id,
- zip_size, from_page, index, mtr);
+ btr_level_list_remove(*from_block, *index, mtr);
btr_page_get_father(index, from_block, mtr, &parent);
btr_cur_node_ptr_delete(&parent, mtr);
/* btr_blob_dbg_remove(from_page, index,
@@ -591,9 +585,8 @@ btr_defragment_n_pages(
break;
}
- blocks[i] = btr_block_get(page_id_t(index->table->space_id,
- page_no), zip_size,
- RW_X_LATCH, index, mtr);
+ blocks[i] = btr_block_get(*index, page_no, RW_X_LATCH, true,
+ mtr);
}
if (n_pages == 1) {
diff --git a/storage/innobase/btr/btr0pcur.cc b/storage/innobase/btr/btr0pcur.cc
index a66fcc15187..943ae996f20 100644
--- a/storage/innobase/btr/btr0pcur.cc
+++ b/storage/innobase/btr/btr0pcur.cc
@@ -439,29 +439,23 @@ btr_pcur_move_to_next_page(
last record of the current page */
mtr_t* mtr) /*!< in: mtr */
{
- ulint next_page_no;
- page_t* page;
- buf_block_t* next_block;
- page_t* next_page;
- ulint mode;
-
ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED);
ut_ad(cursor->latch_mode != BTR_NO_LATCHES);
ut_ad(btr_pcur_is_after_last_on_page(cursor));
cursor->old_stored = false;
- page = btr_pcur_get_page(cursor);
+ const page_t* page = btr_pcur_get_page(cursor);
if (UNIV_UNLIKELY(!page)) {
return;
}
- next_page_no = btr_page_get_next(page, mtr);
+ const ulint next_page_no = mach_read_from_4(page + FIL_PAGE_NEXT);
ut_ad(next_page_no != FIL_NULL);
- mode = cursor->latch_mode;
+ ulint mode = cursor->latch_mode;
switch (mode) {
case BTR_SEARCH_TREE:
mode = BTR_SEARCH_LEAF;
@@ -470,18 +464,15 @@ btr_pcur_move_to_next_page(
mode = BTR_MODIFY_LEAF;
}
- buf_block_t* block = btr_pcur_get_block(cursor);
-
- next_block = btr_block_get(
- page_id_t(block->page.id.space(), next_page_no),
- block->zip_size(), mode,
- btr_pcur_get_btr_cur(cursor)->index, mtr);
+ buf_block_t* next_block = btr_block_get(
+ *btr_pcur_get_btr_cur(cursor)->index, next_page_no, mode,
+ page_is_leaf(page), mtr);
if (UNIV_UNLIKELY(!next_block)) {
return;
}
- next_page = buf_block_get_frame(next_block);
+ const page_t* next_page = buf_block_get_frame(next_block);
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(next_page) == page_is_comp(page));
ut_a(btr_page_get_prev(next_page, mtr)
diff --git a/storage/innobase/btr/btr0scrub.cc b/storage/innobase/btr/btr0scrub.cc
index 3c367fb2784..b8d3e2e50fa 100644
--- a/storage/innobase/btr/btr0scrub.cc
+++ b/storage/innobase/btr/btr0scrub.cc
@@ -431,10 +431,9 @@ btr_pessimistic_scrub(
}
/* read block variables */
- const ulint page_no = mach_read_from_4(page + FIL_PAGE_OFFSET);
+ const ulint page_no = block->page.id.page_no();
const ulint left_page_no = mach_read_from_4(page + FIL_PAGE_PREV);
const ulint right_page_no = mach_read_from_4(page + FIL_PAGE_NEXT);
- const ulint zip_size = index->table->space->zip_size();
/**
* When splitting page, we need X-latches on left/right brothers
@@ -449,16 +448,14 @@ btr_pessimistic_scrub(
*/
mtr->release_block_at_savepoint(scrub_data->savepoint, block);
- btr_block_get(
- page_id_t(index->table->space_id, left_page_no),
- zip_size, RW_X_LATCH, index, mtr);
+ btr_block_get(*index, left_page_no, RW_X_LATCH,
+ page_is_leaf(page), mtr);
/**
* Refetch block and re-initialize page
*/
- block = btr_block_get(
- page_id_t(index->table->space_id, page_no),
- zip_size, RW_X_LATCH, index, mtr);
+ block = btr_block_get(*index, page_no, RW_X_LATCH,
+ page_is_leaf(page), mtr);
page = buf_block_get_frame(block);
@@ -470,9 +467,8 @@ btr_pessimistic_scrub(
}
if (right_page_no != FIL_NULL) {
- btr_block_get(
- page_id_t(index->table->space_id, right_page_no),
- zip_size, RW_X_LATCH, index, mtr);
+ btr_block_get(*index, right_page_no, RW_X_LATCH,
+ page_is_leaf(page), mtr);
}
/* arguments to btr_page_split_and_insert */
diff --git a/storage/innobase/btr/btr0sea.cc b/storage/innobase/btr/btr0sea.cc
index a220acd185c..3cc7c6b825b 100644
--- a/storage/innobase/btr/btr0sea.cc
+++ b/storage/innobase/btr/btr0sea.cc
@@ -882,10 +882,8 @@ btr_search_guess_on_hash(
const rec_t* rec;
ulint fold;
index_id_t index_id;
-#ifdef notdefined
- btr_cur_t cursor2;
- btr_pcur_t pcur;
-#endif
+
+ ut_ad(mtr->is_active());
ut_ad(!ahi_latch || rw_lock_own_flagged(
ahi_latch, RW_LOCK_FLAG_X | RW_LOCK_FLAG_S));
@@ -893,11 +891,12 @@ btr_search_guess_on_hash(
return(FALSE);
}
- ut_ad(index && info && tuple && cursor && mtr);
- ut_ad(!dict_index_is_ibuf(index));
+ ut_ad(!index->is_ibuf());
ut_ad(!ahi_latch || ahi_latch == btr_get_search_latch(index));
ut_ad((latch_mode == BTR_SEARCH_LEAF)
|| (latch_mode == BTR_MODIFY_LEAF));
+ compile_time_assert(ulint{BTR_SEARCH_LEAF} == ulint{RW_S_LATCH});
+ compile_time_assert(ulint{BTR_MODIFY_LEAF} == ulint{RW_X_LATCH});
/* Not supported for spatial index */
ut_ad(!dict_index_is_spatial(index));
@@ -955,16 +954,47 @@ fail:
return(FALSE);
}
- buf_block_t* block = buf_block_from_ahi(rec);
+ buf_block_t* block = buf_block_from_ahi(rec);
+ buf_pool_t* buf_pool = buf_pool_from_block(block);
if (use_latch) {
+ mutex_enter(&block->mutex);
- if (!buf_page_get_known_nowait(
- latch_mode, block, BUF_MAKE_YOUNG,
- __FILE__, __LINE__, mtr)) {
+ if (buf_block_get_state(block) == BUF_BLOCK_REMOVE_HASH) {
+ /* Another thread is just freeing the block
+ from the LRU list of the buffer pool: do not
+ try to access this page. */
+ mutex_exit(&block->mutex);
goto fail;
}
+ ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
+ ut_ad(!block->page.file_page_was_freed);
+ buf_page_set_accessed(&block->page);
+ buf_block_buf_fix_inc(block, __FILE__, __LINE__);
+ mutex_exit(&block->mutex);
+
+ buf_page_make_young_if_needed(buf_pool, &block->page);
+ mtr_memo_type_t fix_type;
+ if (latch_mode == BTR_SEARCH_LEAF) {
+ if (!rw_lock_s_lock_nowait(&block->lock,
+ __FILE__, __LINE__)) {
+got_no_latch:
+ buf_block_buf_fix_dec(block);
+ goto fail;
+ }
+ fix_type = MTR_MEMO_PAGE_S_FIX;
+ } else {
+ if (!rw_lock_x_lock_func_nowait_inline(
+ &block->lock, __FILE__, __LINE__)) {
+ goto got_no_latch;
+ }
+ fix_type = MTR_MEMO_PAGE_X_FIX;
+ }
+ mtr->memo_push(block, fix_type);
+
+ buf_pool->stat.n_page_gets++;
+
rw_lock_s_unlock(use_latch);
buf_block_dbg_add_level(block, SYNC_TREE_NODE_FROM_HASH);
@@ -1052,20 +1082,15 @@ fail:
#ifdef UNIV_SEARCH_PERF_STAT
btr_search_n_succ++;
#endif
- if (!ahi_latch && buf_page_peek_if_too_old(&block->page)) {
-
- buf_page_make_young(&block->page);
- }
-
/* Increment the page get statistics though we did not really
fix the page: for user info only */
- {
- buf_pool_t* buf_pool = buf_pool_from_bpage(&block->page);
+ ++buf_pool->stat.n_page_gets;
- ++buf_pool->stat.n_page_gets;
+ if (!ahi_latch) {
+ buf_page_make_young_if_needed(buf_pool, &block->page);
}
- return(TRUE);
+ return true;
}
/** Drop any adaptive hash index entries that point to an index page.
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc
index 7f00b27df0e..41d242a9360 100644
--- a/storage/innobase/buf/buf0buf.cc
+++ b/storage/innobase/buf/buf0buf.cc
@@ -1572,6 +1572,7 @@ buf_block_init(
block->page.buf_fix_count = 0;
block->page.io_fix = BUF_IO_NONE;
block->page.flush_observer = NULL;
+ block->page.init_on_flush = false;
block->page.real_size = 0;
block->page.write_size = 0;
block->modify_clock = 0;
@@ -3148,7 +3149,7 @@ calc_buf_pool_size:
" dictionary.";
}
- /* normalize ibuf->max_size */
+ /* normalize ibuf.max_size */
ibuf_max_size_update(srv_change_buffer_max_size);
if (srv_buf_pool_old_size != srv_buf_pool_size) {
@@ -3707,28 +3708,6 @@ buf_page_make_young(
buf_pool_mutex_exit(buf_pool);
}
-/********************************************************************//**
-Moves a page to the start of the buffer pool LRU list if it is too old.
-This high-level function can be used to prevent an important page from
-slipping out of the buffer pool. */
-static
-void
-buf_page_make_young_if_needed(
-/*==========================*/
- buf_page_t* bpage) /*!< in/out: buffer block of a
- file page */
-{
-#ifdef UNIV_DEBUG
- buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
- ut_ad(!buf_pool_mutex_own(buf_pool));
-#endif /* UNIV_DEBUG */
- ut_a(buf_page_in_file(bpage));
-
- if (buf_page_peek_if_too_old(bpage)) {
- buf_page_make_young(bpage);
- }
-}
-
#ifdef UNIV_DEBUG
/** Sets file_page_was_freed TRUE if the page is found in the buffer pool.
@@ -3912,7 +3891,7 @@ got_block:
mutex_exit(block_mutex);
- buf_page_make_young_if_needed(bpage);
+ buf_page_make_young_if_needed(buf_pool, bpage);
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
ut_a(++buf_dbg_counter % 5771 || buf_validate());
@@ -4192,14 +4171,6 @@ buf_debug_execute_is_force_flush()
/*==============================*/
{
DBUG_EXECUTE_IF("ib_buf_force_flush", return(true); );
-
- /* This is used during queisce testing, we want to ensure maximum
- buffering by the change buffer. */
-
- if (srv_ibuf_disable_background_merge) {
- return(true);
- }
-
return(false);
}
#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
@@ -4246,16 +4217,20 @@ buf_wait_for_read(
}
/** This is the general function used to get access to a database page.
-@param[in] page_id page id
-@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0
-@param[in] rw_latch RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH
-@param[in] guess guessed block or NULL
-@param[in] mode BUF_GET, BUF_GET_IF_IN_POOL,
+@param[in] page_id page id
+@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0
+@param[in] rw_latch RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH
+@param[in] guess guessed block or NULL
+@param[in] mode BUF_GET, BUF_GET_IF_IN_POOL,
BUF_PEEK_IF_IN_POOL, BUF_GET_NO_LATCH, or BUF_GET_IF_IN_POOL_OR_WATCH
-@param[in] file file name
-@param[in] line line where called
-@param[in] mtr mini-transaction
-@param[out] err DB_SUCCESS or error code
+@param[in] file file name
+@param[in] line line where called
+@param[in] mtr mini-transaction
+@param[out] err DB_SUCCESS or error code
+@param[in] allow_ibuf_merge Allow change buffer merge to happen
+while reading the page from file
+then it makes sure that it does merging of change buffer changes while
+reading the page from file.
@return pointer to the block or NULL */
buf_block_t*
buf_page_get_gen(
@@ -4267,7 +4242,8 @@ buf_page_get_gen(
const char* file,
unsigned line,
mtr_t* mtr,
- dberr_t* err)
+ dberr_t* err,
+ bool allow_ibuf_merge)
{
buf_block_t* block;
unsigned access_time;
@@ -4282,6 +4258,10 @@ buf_page_get_gen(
|| (rw_latch == RW_X_LATCH)
|| (rw_latch == RW_SX_LATCH)
|| (rw_latch == RW_NO_LATCH));
+ ut_ad(!allow_ibuf_merge
+ || mode == BUF_GET
+ || mode == BUF_GET_IF_IN_POOL
+ || mode == BUF_GET_IF_IN_POOL_OR_WATCH);
if (err) {
*err = DB_SUCCESS;
@@ -4498,11 +4478,11 @@ loop:
if (fsp_is_system_temporary(page_id.space())) {
/* For temporary tablespace, the mutex is being used
- for synchronization between user thread and flush
- thread, instead of block->lock. See buf_flush_page()
- for the flush thread counterpart. */
+ for synchorization between user thread and flush thread,
+ instead of block->lock. See buf_flush_page() for the flush
+ thread counterpart. */
BPageMutex* fix_mutex = buf_page_get_mutex(
- &fix_block->page);
+ &fix_block->page);
mutex_enter(fix_mutex);
fix_block->fix();
mutex_exit(fix_mutex);
@@ -4538,13 +4518,11 @@ got_block:
}
}
- switch (buf_block_get_state(fix_block)) {
- buf_page_t* bpage;
-
+ switch (UNIV_EXPECT(buf_block_get_state(fix_block),
+ BUF_BLOCK_FILE_PAGE)) {
case BUF_BLOCK_FILE_PAGE:
- bpage = &block->page;
if (fsp_is_system_temporary(page_id.space())
- && buf_page_get_io_fix(bpage) != BUF_IO_NONE) {
+ && buf_block_get_io_fix(block) != BUF_IO_NONE) {
/* This suggests that the page is being flushed.
Avoid returning reference to this page.
Instead wait for the flush action to complete. */
@@ -4567,9 +4545,16 @@ evict_from_pool:
return(NULL);
}
break;
+ default:
+ ut_error;
+ break;
case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_ZIP_DIRTY:
+ if (UNIV_UNLIKELY(mode == BUF_EVICT_IF_IN_POOL)) {
+ goto evict_from_pool;
+ }
+
if (mode == BUF_PEEK_IF_IN_POOL) {
/* This mode is only used for dropping an
adaptive hash index. There cannot be an
@@ -4580,7 +4565,7 @@ evict_from_pool:
return(NULL);
}
- bpage = &block->page;
+ buf_page_t* bpage = &block->page;
/* Note: We have already buffer fixed this block. */
if (bpage->buf_fix_count > 1
@@ -4598,10 +4583,6 @@ evict_from_pool:
goto loop;
}
- if (UNIV_UNLIKELY(mode == BUF_EVICT_IF_IN_POOL)) {
- goto evict_from_pool;
- }
-
/* Buffer-fix the block so that it cannot be evicted
or relocated while we are attempting to allocate an
uncompressed page. */
@@ -4695,35 +4676,31 @@ evict_from_pool:
buf_page_mutex_exit(block);
+ if (!access_time && !recv_no_ibuf_operations
+ && ibuf_page_exists(block->page)) {
+ block->page.ibuf_exist = true;
+ }
+
buf_page_free_descriptor(bpage);
/* Decompress the page while not holding
buf_pool->mutex or block->mutex. */
- {
- bool success = buf_zip_decompress(block, TRUE);
-
- if (!success) {
- buf_pool_mutex_enter(buf_pool);
- buf_page_mutex_enter(fix_block);
- buf_block_set_io_fix(fix_block, BUF_IO_NONE);
- buf_page_mutex_exit(fix_block);
+ if (!buf_zip_decompress(block, TRUE)) {
+ buf_pool_mutex_enter(buf_pool);
+ buf_page_mutex_enter(fix_block);
+ buf_block_set_io_fix(fix_block, BUF_IO_NONE);
+ buf_page_mutex_exit(fix_block);
- --buf_pool->n_pend_unzip;
- fix_block->unfix();
- buf_pool_mutex_exit(buf_pool);
- rw_lock_x_unlock(&fix_block->lock);
+ --buf_pool->n_pend_unzip;
+ fix_block->unfix();
+ buf_pool_mutex_exit(buf_pool);
+ rw_lock_x_unlock(&fix_block->lock);
- if (err) {
- *err = DB_PAGE_CORRUPTED;
- }
- return NULL;
+ if (err) {
+ *err = DB_PAGE_CORRUPTED;
}
- }
-
- if (!access_time && !recv_no_ibuf_operations) {
- ibuf_merge_or_delete_for_page(
- block, block->page.id, zip_size, true);
+ return NULL;
}
buf_pool_mutex_enter(buf_pool);
@@ -4741,14 +4718,6 @@ evict_from_pool:
rw_lock_x_unlock(&block->lock);
break;
-
- case BUF_BLOCK_POOL_WATCH:
- case BUF_BLOCK_NOT_USED:
- case BUF_BLOCK_READY_FOR_USE:
- case BUF_BLOCK_MEMORY:
- case BUF_BLOCK_REMOVE_HASH:
- ut_error;
- break;
}
ut_ad(block == fix_block);
@@ -4875,7 +4844,7 @@ evict_from_pool:
}
if (mode != BUF_PEEK_IF_IN_POOL) {
- buf_page_make_young_if_needed(&fix_block->page);
+ buf_page_make_young_if_needed(buf_pool, &fix_block->page);
}
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
@@ -4904,36 +4873,50 @@ evict_from_pool:
return NULL;
}
- mtr_memo_type_t fix_type;
-
- switch (rw_latch) {
- case RW_NO_LATCH:
-
- fix_type = MTR_MEMO_BUF_FIX;
- break;
-
- case RW_S_LATCH:
- rw_lock_s_lock_inline(&fix_block->lock, 0, file, line);
-
- fix_type = MTR_MEMO_PAGE_S_FIX;
- break;
+ if (allow_ibuf_merge
+ && mach_read_from_2(fix_block->frame + FIL_PAGE_TYPE)
+ == FIL_PAGE_INDEX
+ && page_is_leaf(fix_block->frame)) {
+ rw_lock_x_lock_inline(&fix_block->lock, 0, file, line);
- case RW_SX_LATCH:
- rw_lock_sx_lock_inline(&fix_block->lock, 0, file, line);
+ if (fix_block->page.ibuf_exist) {
+ fix_block->page.ibuf_exist = false;
+ ibuf_merge_or_delete_for_page(fix_block, page_id,
+ zip_size, true);
+ }
- fix_type = MTR_MEMO_PAGE_SX_FIX;
- break;
+ if (rw_latch == RW_X_LATCH) {
+ mtr->memo_push(fix_block, MTR_MEMO_PAGE_X_FIX);
+ } else {
+ rw_lock_x_unlock(&fix_block->lock);
+ goto get_latch;
+ }
+ } else {
+get_latch:
+ mtr_memo_type_t fix_type;
- default:
- ut_ad(rw_latch == RW_X_LATCH);
- rw_lock_x_lock_inline(&fix_block->lock, 0, file, line);
+ switch (rw_latch) {
+ case RW_NO_LATCH:
+ fix_type = MTR_MEMO_BUF_FIX;
+ break;
+ case RW_S_LATCH:
+ rw_lock_s_lock_inline(&fix_block->lock, 0, file, line);
+ fix_type = MTR_MEMO_PAGE_S_FIX;
+ break;
+ case RW_SX_LATCH:
+ rw_lock_sx_lock_inline(&fix_block->lock, 0, file, line);
+ fix_type = MTR_MEMO_PAGE_SX_FIX;
+ break;
+ default:
+ ut_ad(rw_latch == RW_X_LATCH);
+ rw_lock_x_lock_inline(&fix_block->lock, 0, file, line);
+ fix_type = MTR_MEMO_PAGE_X_FIX;
+ break;
+ }
- fix_type = MTR_MEMO_PAGE_X_FIX;
- break;
+ mtr->memo_push(block, fix_type);
}
- mtr_memo_push(mtr, fix_block, fix_type);
-
if (mode != BUF_PEEK_IF_IN_POOL && !access_time) {
/* In the case of a first access, try to apply linear
read-ahead */
@@ -4961,7 +4944,6 @@ buf_page_optimistic_get(
unsigned line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mini-transaction */
{
- buf_pool_t* buf_pool;
unsigned access_time;
ibool success;
@@ -4987,7 +4969,8 @@ buf_page_optimistic_get(
buf_page_mutex_exit(block);
- buf_page_make_young_if_needed(&block->page);
+ buf_pool_t* buf_pool = buf_pool_from_block(block);
+ buf_page_make_young_if_needed(buf_pool, &block->page);
ut_ad(!ibuf_inside(mtr)
|| ibuf_page(block->page.id, block->zip_size(), NULL));
@@ -5048,109 +5031,6 @@ buf_page_optimistic_get(
ibuf_inside(mtr));
}
- buf_pool = buf_pool_from_block(block);
- buf_pool->stat.n_page_gets++;
-
- return(TRUE);
-}
-
-/********************************************************************//**
-This is used to get access to a known database page, when no waiting can be
-done. For example, if a search in an adaptive hash index leads us to this
-frame.
-@return TRUE if success */
-ibool
-buf_page_get_known_nowait(
-/*======================*/
- ulint rw_latch,/*!< in: RW_S_LATCH, RW_X_LATCH */
- buf_block_t* block, /*!< in: the known page */
- ulint mode, /*!< in: BUF_MAKE_YOUNG or BUF_KEEP_OLD */
- const char* file, /*!< in: file name */
- unsigned line, /*!< in: line where called */
- mtr_t* mtr) /*!< in: mini-transaction */
-{
- buf_pool_t* buf_pool;
- ibool success;
-
- ut_ad(mtr->is_active());
- ut_ad((rw_latch == RW_S_LATCH) || (rw_latch == RW_X_LATCH));
-
- buf_page_mutex_enter(block);
-
- if (buf_block_get_state(block) == BUF_BLOCK_REMOVE_HASH) {
- /* Another thread is just freeing the block from the LRU list
- of the buffer pool: do not try to access this page; this
- attempt to access the page can only come through the hash
- index because when the buffer block state is ..._REMOVE_HASH,
- we have already removed it from the page address hash table
- of the buffer pool. */
-
- buf_page_mutex_exit(block);
-
- return(FALSE);
- }
-
- ut_a(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
-
- buf_block_buf_fix_inc(block, file, line);
-
- buf_page_set_accessed(&block->page);
-
- buf_page_mutex_exit(block);
-
- buf_pool = buf_pool_from_block(block);
-
- if (mode == BUF_MAKE_YOUNG) {
- buf_page_make_young_if_needed(&block->page);
- }
-
- ut_ad(!ibuf_inside(mtr) || mode == BUF_KEEP_OLD);
-
- mtr_memo_type_t fix_type;
-
- switch (rw_latch) {
- case RW_S_LATCH:
- success = rw_lock_s_lock_nowait(&block->lock, file, line);
- fix_type = MTR_MEMO_PAGE_S_FIX;
- break;
- case RW_X_LATCH:
- success = rw_lock_x_lock_func_nowait_inline(
- &block->lock, file, line);
-
- fix_type = MTR_MEMO_PAGE_X_FIX;
- break;
- default:
- ut_error; /* RW_SX_LATCH is not implemented yet */
- }
-
- if (!success) {
- buf_block_buf_fix_dec(block);
- return(FALSE);
- }
-
- mtr_memo_push(mtr, block, fix_type);
-
-#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
- ut_a(++buf_dbg_counter % 5771 || buf_validate());
- ut_a(block->page.buf_fix_count > 0);
- ut_a(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
-#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
-
-#ifdef UNIV_DEBUG
- if (mode != BUF_KEEP_OLD) {
- /* If mode == BUF_KEEP_OLD, we are executing an I/O
- completion routine. Avoid a bogus assertion failure
- when ibuf_merge_or_delete_for_page() is processing a
- page that was just freed due to DROP INDEX, or
- deleting a record from SYS_INDEXES. This check will be
- skipped in recv_recover_page() as well. */
-
- buf_page_mutex_enter(block);
- ut_a(!block->page.file_page_was_freed);
- buf_page_mutex_exit(block);
- }
-#endif /* UNIV_DEBUG */
-
buf_pool->stat.n_page_gets++;
return(TRUE);
@@ -5257,6 +5137,7 @@ buf_page_init_low(
bpage->write_size = 0;
bpage->real_size = 0;
bpage->slot = NULL;
+ bpage->ibuf_exist = false;
HASH_INVALIDATE(bpage, hash);
@@ -5535,6 +5416,7 @@ buf_page_init_for_read(
bpage->state = BUF_BLOCK_ZIP_PAGE;
bpage->id = page_id;
bpage->flush_observer = NULL;
+ bpage->init_on_flush = false;
ut_d(bpage->in_page_hash = FALSE);
ut_d(bpage->in_zip_hash = FALSE);
@@ -6002,9 +5884,9 @@ static dberr_t buf_page_check_corrupt(buf_page_t* bpage, fil_space_t* space)
}
/** Complete a read or write request of a file page to or from the buffer pool.
-@param[in,out] bpage page to complete
-@param[in] dblwr whether the doublewrite buffer was used (on write)
-@param[in] evict whether or not to evict the page from LRU list
+@param[in,out] bpage page to complete
+@param[in] dblwr whether the doublewrite buffer was used (on write)
+@param[in] evict whether or not to evict the page from LRU list
@return whether the operation succeeded
@retval DB_SUCCESS always when writing, or if a read page was OK
@retval DB_TABLESPACE_DELETED if the tablespace does not exist
@@ -6199,10 +6081,9 @@ release_page:
&& (bpage->id.space() == 0
|| !is_predefined_tablespace(bpage->id.space()))
&& fil_page_get_type(frame) == FIL_PAGE_INDEX
- && page_is_leaf(frame)) {
- ibuf_merge_or_delete_for_page(
- reinterpret_cast<buf_block_t*>(bpage),
- bpage->id, bpage->zip_size(), true);
+ && page_is_leaf(frame)
+ && ibuf_page_exists(*bpage)) {
+ bpage->ibuf_exist = true;
}
space->release_for_io();
@@ -6976,7 +6857,7 @@ void
buf_stats_get_pool_info(
/*====================*/
buf_pool_t* buf_pool, /*!< in: buffer pool */
- ulint pool_id, /*!< in: buffer pool ID */
+ uint pool_id, /*!< in: buffer pool ID */
buf_pool_info_t* all_pool_info) /*!< in/out: buffer pool info
to fill */
{
@@ -7205,7 +7086,6 @@ buf_print_io(
/*=========*/
FILE* file) /*!< in/out: buffer where to print */
{
- ulint i;
buf_pool_info_t* pool_info;
buf_pool_info_t* pool_info_total;
@@ -7225,7 +7105,7 @@ buf_print_io(
ut_zalloc_nokey(sizeof *pool_info));
}
- for (i = 0; i < srv_buf_pool_instances; i++) {
+ for (uint i = 0; i < srv_buf_pool_instances; i++) {
buf_pool_t* buf_pool;
buf_pool = buf_pool_from_array(i);
@@ -7252,8 +7132,8 @@ buf_print_io(
"INDIVIDUAL BUFFER POOL INFO\n"
"----------------------\n", file);
- for (i = 0; i < srv_buf_pool_instances; i++) {
- fprintf(file, "---BUFFER POOL " ULINTPF "\n", i);
+ for (uint i = 0; i < srv_buf_pool_instances; i++) {
+ fprintf(file, "---BUFFER POOL %u\n", i);
buf_print_io_instance(&pool_info[i], file);
}
}
diff --git a/storage/innobase/buf/buf0checksum.cc b/storage/innobase/buf/buf0checksum.cc
index 2b2a74dd736..e98dc18452e 100644
--- a/storage/innobase/buf/buf0checksum.cc
+++ b/storage/innobase/buf/buf0checksum.cc
@@ -33,11 +33,8 @@ Created Aug 11, 2011 Vasil Dimov
#include "srv0srv.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:
-ha_innodb.cc:12251: error: cannot convert 'srv_checksum_algorithm_t*' to
- 'long unsigned int*' in initialization */
-ulong srv_checksum_algorithm = SRV_CHECKSUM_ALGORITHM_INNODB;
+/** the value of innodb_checksum_algorithm */
+ulong srv_checksum_algorithm;
/** Calculate the CRC32 checksum of a page. The value is stored to the page
when it is written to a file and also checked for a match when reading from
diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc
index ee6431da7e0..5a589936e5f 100644
--- a/storage/innobase/buf/buf0flu.cc
+++ b/storage/innobase/buf/buf0flu.cc
@@ -63,7 +63,7 @@ static const ulint buf_flush_wait_flushed_sleep_time = 10000;
#include <my_service_manager.h>
/** Number of pages flushed through non flush_list flushes. */
-static ulint buf_lru_flush_page_count = 0;
+ulint buf_lru_flush_page_count;
/** Flag indicating if the page_cleaner is in active state. This flag
is set to TRUE by the page_cleaner thread when it is spawned and is set
@@ -1042,7 +1042,10 @@ buf_flush_write_block_low(
ut_ad(space->purpose == FIL_TYPE_TABLESPACE
|| space->atomic_write_supported);
- if (!space->use_doublewrite()) {
+ const bool use_doublewrite = !bpage->init_on_flush
+ && space->use_doublewrite();
+
+ if (!use_doublewrite) {
ulint type = IORequest::WRITE | IORequest::DO_NOT_WAKE;
IORequest request(type, bpage);
@@ -1083,7 +1086,7 @@ buf_flush_write_block_low(
#endif
/* true means we want to evict this page from the
LRU list as well. */
- buf_page_io_complete(bpage, space->use_doublewrite(), true);
+ buf_page_io_complete(bpage, use_doublewrite, true);
ut_ad(err == DB_SUCCESS);
}
diff --git a/storage/innobase/buf/buf0rea.cc b/storage/innobase/buf/buf0rea.cc
index 0f67584fe4d..f147bb807ce 100644
--- a/storage/innobase/buf/buf0rea.cc
+++ b/storage/innobase/buf/buf0rea.cc
@@ -312,7 +312,7 @@ buf_read_ahead_random(const page_id_t page_id, ulint zip_size, bool ibuf)
if (bpage != NULL
&& buf_page_is_accessed(bpage)
- && buf_page_peek_if_young(bpage)) {
+ && buf_page_peek_if_young(buf_pool, bpage)) {
recent_blocks++;
@@ -703,12 +703,6 @@ buf_read_ahead_linear(const page_id_t page_id, ulint zip_size, bool ibuf)
ulint ibuf_mode = ibuf ? BUF_READ_IBUF_PAGES_ONLY : BUF_READ_ANY_PAGE;
- /* Since Windows XP seems to schedule the i/o handler thread
- very eagerly, and consequently it does not wait for the
- full read batch to be posted, we use special heuristics here */
-
- os_aio_simulated_put_read_threads_to_sleep();
-
for (i = low; i < high; i++) {
/* It is only sensible to do read-ahead in the non-sync
aio mode: hence FALSE as the first parameter */
@@ -760,89 +754,6 @@ buf_read_ahead_linear(const page_id_t page_id, ulint zip_size, bool ibuf)
return(count);
}
-/********************************************************************//**
-Issues read requests for pages which the ibuf module wants to read in, in
-order to contract the insert buffer tree. Technically, this function is like
-a read-ahead function. */
-void
-buf_read_ibuf_merge_pages(
-/*======================*/
- bool sync, /*!< in: true if the caller
- wants this function to wait
- for the highest address page
- to get read in, before this
- function returns */
- const ulint* space_ids, /*!< in: array of space ids */
- const ulint* page_nos, /*!< in: array of page numbers
- to read, with the highest page
- number the last in the
- array */
- ulint n_stored) /*!< in: number of elements
- in the arrays */
-{
-#ifdef UNIV_IBUF_DEBUG
- ut_a(n_stored < srv_page_size);
-#endif
-
- for (ulint i = 0; i < n_stored; i++) {
- fil_space_t* s = fil_space_acquire_for_io(space_ids[i]);
- if (!s) {
-tablespace_deleted:
- /* The tablespace was not found: remove all
- entries for it */
- ibuf_delete_for_discarded_space(space_ids[i]);
- while (i + 1 < n_stored
- && space_ids[i + 1] == space_ids[i]) {
- i++;
- }
- continue;
- }
-
- const ulint zip_size = s->zip_size();
- s->release_for_io();
-
- const page_id_t page_id(space_ids[i], page_nos[i]);
-
- buf_pool_t* buf_pool = buf_pool_get(page_id);
-
- while (buf_pool->n_pend_reads
- > buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) {
- os_thread_sleep(500000);
- }
-
- dberr_t err;
-
- buf_read_page_low(&err,
- sync && (i + 1 == n_stored),
- 0,
- BUF_READ_ANY_PAGE, page_id, zip_size,
- true, true /* ignore_missing_space */);
-
- switch(err) {
- case DB_SUCCESS:
- case DB_ERROR:
- break;
- case DB_TABLESPACE_DELETED:
- goto tablespace_deleted;
- case DB_PAGE_CORRUPTED:
- case DB_DECRYPTION_FAILED:
- ib::error() << "Failed to read or decrypt " << page_id
- << " for change buffer merge";
- break;
- default:
- ut_error;
- }
- }
-
- os_aio_simulated_wake_handler_threads();
-
- if (n_stored) {
- DBUG_PRINT("ib_buf",
- ("ibuf merge read-ahead %u pages, space %u",
- unsigned(n_stored), unsigned(space_ids[0])));
- }
-}
-
/** Issues read requests for pages which recovery wants to read in.
@param[in] sync true if the caller wants this function to wait
for the highest address page to get read in, before this function returns
diff --git a/storage/innobase/dict/dict0boot.cc b/storage/innobase/dict/dict0boot.cc
index c8538543b3e..95bd9a48edd 100644
--- a/storage/innobase/dict/dict0boot.cc
+++ b/storage/innobase/dict/dict0boot.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2016, 2018, MariaDB Corporation.
+Copyright (c) 2016, 2019, 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
@@ -450,36 +450,15 @@ dict_boot(void)
/* Initialize the insert buffer table and index for each tablespace */
- dberr_t err = DB_SUCCESS;
-
- err = ibuf_init_at_db_start();
+ dberr_t err = ibuf_init_at_db_start();
if (err == DB_SUCCESS) {
- if (srv_read_only_mode
- && srv_force_recovery != SRV_FORCE_NO_LOG_REDO
- && !ibuf_is_empty()) {
-
- if (srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE) {
- ib::error() << "Change buffer must be empty when"
- " --innodb-read-only is set!"
- "You can try to recover the database with innodb_force_recovery=5";
-
- err = DB_ERROR;
- } else {
- ib::warn() << "Change buffer not empty when --innodb-read-only "
- "is set! but srv_force_recovery = " << srv_force_recovery
- << " , ignoring.";
- }
- }
+ /* Load definitions of other indexes on system tables */
- if (err == DB_SUCCESS) {
- /* Load definitions of other indexes on system tables */
-
- dict_load_sys_table(dict_sys.sys_tables);
- dict_load_sys_table(dict_sys.sys_columns);
- dict_load_sys_table(dict_sys.sys_indexes);
- dict_load_sys_table(dict_sys.sys_fields);
- }
+ dict_load_sys_table(dict_sys.sys_tables);
+ dict_load_sys_table(dict_sys.sys_columns);
+ dict_load_sys_table(dict_sys.sys_indexes);
+ dict_load_sys_table(dict_sys.sys_fields);
}
mutex_exit(&dict_sys.mutex);
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index a6b55600ebd..210139b4626 100644
--- a/storage/innobase/dict/dict0dict.cc
+++ b/storage/innobase/dict/dict0dict.cc
@@ -6108,7 +6108,7 @@ void dict_sys_t::close()
if (dict_foreign_err_file)
{
- fclose(dict_foreign_err_file);
+ my_fclose(dict_foreign_err_file, MYF(MY_WME));
dict_foreign_err_file = NULL;
}
@@ -6424,25 +6424,6 @@ dict_tf_to_row_format_string(
return(0);
}
-/** Calculate the used memory occupied by the data dictionary
-table and index objects.
-@return number of bytes occupied. */
-UNIV_INTERN
-ulint
-dict_sys_get_size()
-{
- /* No mutex; this is a very crude approximation anyway */
- ulint size = UT_LIST_GET_LEN(dict_sys.table_LRU)
- + UT_LIST_GET_LEN(dict_sys.table_non_LRU);
- size *= sizeof(dict_table_t)
- + sizeof(dict_index_t) * 2
- + (sizeof(dict_col_t) + sizeof(dict_field_t)) * 10
- + sizeof(dict_field_t) * 5 /* total number of key fields */
- + 200; /* arbitrary, covering names and overhead */
-
- return size;
-}
-
/** Look for any dictionary objects that are found in the given tablespace.
@param[in] space_id Tablespace ID to search for.
@return true if tablespace is empty. */
diff --git a/storage/innobase/dict/dict0load.cc b/storage/innobase/dict/dict0load.cc
index 6007252a308..42478e18f84 100644
--- a/storage/innobase/dict/dict0load.cc
+++ b/storage/innobase/dict/dict0load.cc
@@ -673,18 +673,13 @@ dict_process_sys_tablespaces(
/*=========================*/
mem_heap_t* heap, /*!< in/out: heap memory */
const rec_t* rec, /*!< in: current SYS_TABLESPACES rec */
- ulint* space, /*!< out: space id */
+ uint32_t* space, /*!< out: tablespace identifier */
const char** name, /*!< out: tablespace name */
ulint* flags) /*!< out: tablespace flags */
{
ulint len;
const byte* field;
- /* Initialize the output values */
- *space = ULINT_UNDEFINED;
- *name = NULL;
- *flags = ULINT_UNDEFINED;
-
if (rec_get_deleted_flag(rec, 0)) {
return("delete-marked record in SYS_TABLESPACES");
}
@@ -739,7 +734,7 @@ dict_process_sys_datafiles(
/*=======================*/
mem_heap_t* heap, /*!< in/out: heap memory */
const rec_t* rec, /*!< in: current SYS_DATAFILES rec */
- ulint* space, /*!< out: space id */
+ uint32_t* space, /*!< out: space id */
const char** path) /*!< out: datafile paths */
{
ulint len;
diff --git a/storage/innobase/dict/dict0stats.cc b/storage/innobase/dict/dict0stats.cc
index bd4bb261320..ad2698a1be9 100644
--- a/storage/innobase/dict/dict0stats.cc
+++ b/storage/innobase/dict/dict0stats.cc
@@ -1493,6 +1493,7 @@ dict_stats_analyze_index_below_cur(
rec_offs_set_n_alloc(offsets2, size);
rec = btr_cur_get_rec(cur);
+ page = page_align(rec);
ut_ad(!page_rec_is_leaf(rec));
offsets_rec = rec_get_offsets(rec, index, offsets1, false,
@@ -1514,9 +1515,11 @@ dict_stats_analyze_index_below_cur(
dberr_t err = DB_SUCCESS;
- block = buf_page_get_gen(page_id, zip_size, RW_S_LATCH,
- NULL /* no guessed block */,
- BUF_GET, __FILE__, __LINE__, &mtr, &err);
+ block = buf_page_get_gen(page_id, zip_size,
+ RW_S_LATCH, NULL, BUF_GET,
+ __FILE__, __LINE__, &mtr, &err,
+ !index->is_clust()
+ && 1 == btr_page_get_level(page));
page = buf_block_get_frame(block);
@@ -3143,7 +3146,7 @@ dict_stats_update(
if (!table->is_readable()) {
return (dict_stats_report_error(table));
- } else if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) {
+ } else if (srv_force_recovery > SRV_FORCE_NO_IBUF_MERGE) {
/* If we have set a high innodb_force_recovery level, do
not calculate statistics, as a badly corrupted index can
cause a crash in it. */
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index b13e1397522..4c512335112 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -4370,7 +4370,7 @@ fil_aio_wait(
fil_node_complete_io(node, type);
const fil_type_t purpose = node->space->purpose;
const ulint space_id= node->space->id;
- const bool dblwr = node->space->use_doublewrite();
+ bool dblwr = node->space->use_doublewrite();
mutex_exit(&fil_system.mutex);
@@ -4419,6 +4419,10 @@ fil_aio_wait(
}
ulint offset = bpage->id.page_no();
+ if (dblwr && bpage->init_on_flush) {
+ bpage->init_on_flush = false;
+ dblwr = false;
+ }
dberr_t err = buf_page_io_complete(bpage, dblwr);
if (err == DB_SUCCESS) {
return;
@@ -4779,15 +4783,7 @@ fil_space_validate_for_mtr_commit(
/* We are serving mtr_commit(). While there is an active
mini-transaction, we should have !space->stop_new_ops. This is
guaranteed by meta-data locks or transactional locks, or
- dict_sys.latch (X-lock in DROP, S-lock in purge).
-
- However, a file I/O thread can invoke change buffer merge
- while fil_check_pending_operations() is waiting for operations
- to quiesce. This is not a problem, because
- ibuf_merge_or_delete_for_page() would call
- fil_space_acquire() before mtr_start() and
- fil_space_t::release() after mtr_commit(). This is why
- n_pending_ops should not be zero if stop_new_ops is set. */
+ dict_sys.latch (X-lock in DROP, S-lock in purge). */
ut_ad(!space->stop_new_ops
|| space->is_being_truncated /* fil_truncate_prepare() */
|| space->referenced());
diff --git a/storage/innobase/fts/fts0blex.cc b/storage/innobase/fts/fts0blex.cc
index 2f66e9740aa..6a2b42025a0 100644
--- a/storage/innobase/fts/fts0blex.cc
+++ b/storage/innobase/fts/fts0blex.cc
@@ -478,7 +478,7 @@ struct yy_buffer_state
*/
#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
- : NULL)
+ : 0)
/* Same as previous macro, but useful when we know that the buffer stack is not
* NULL or when we need an lvalue. For internal use only.
*/
diff --git a/storage/innobase/gis/gis0rtree.cc b/storage/innobase/gis/gis0rtree.cc
index 44facb59f4b..cf78a61e9c5 100644
--- a/storage/innobase/gis/gis0rtree.cc
+++ b/storage/innobase/gis/gis0rtree.cc
@@ -648,7 +648,6 @@ rtr_adjust_upper_level(
dtuple_t* node_ptr_upper;
ulint prev_page_no;
ulint next_page_no;
- ulint space;
page_cur_t* page_cursor;
lock_prdt_t prdt;
lock_prdt_t new_prdt;
@@ -752,16 +751,12 @@ rtr_adjust_upper_level(
/* Get the previous and next pages of page */
prev_page_no = btr_page_get_prev(page, mtr);
next_page_no = btr_page_get_next(page, mtr);
- space = block->page.id.space();
ut_ad(block->zip_size() == index->table->space->zip_size());
/* Update page links of the level */
if (prev_page_no != FIL_NULL) {
- page_id_t prev_page_id(space, prev_page_no);
-
buf_block_t* prev_block = btr_block_get(
- prev_page_id, block->zip_size(), RW_X_LATCH,
- index, mtr);
+ *index, prev_page_no, RW_X_LATCH, false, mtr);
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(prev_block->frame) == page_is_comp(page));
ut_a(btr_page_get_next(prev_block->frame, mtr)
@@ -774,11 +769,8 @@ rtr_adjust_upper_level(
}
if (next_page_no != FIL_NULL) {
- page_id_t next_page_id(space, next_page_no);
-
buf_block_t* next_block = btr_block_get(
- next_page_id, block->zip_size(), RW_X_LATCH,
- index, mtr);
+ *index, next_page_no, RW_X_LATCH, false, mtr);
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(next_block->frame) == page_is_comp(page));
ut_a(btr_page_get_prev(next_block->frame, mtr)
@@ -922,7 +914,7 @@ rtr_split_page_move_rec_list(
if (new_page_zip) {
mtr_set_log_mode(mtr, log_mode);
- if (!page_zip_compress(new_page_zip, new_page, index,
+ if (!page_zip_compress(new_block, index,
page_zip_level, mtr)) {
ulint ret_pos;
@@ -1130,7 +1122,7 @@ func_start:
as appropriate. Deleting will always succeed. */
ut_a(new_page_zip);
- page_zip_copy_recs(new_page_zip, new_page,
+ page_zip_copy_recs(new_block,
page_zip, page, cursor->index, mtr);
page_cursor = btr_cur_get_page_cur(cursor);
@@ -1243,7 +1235,7 @@ func_start:
For compressed pages, page_cur_tuple_insert() will have
attempted this already. */
if (rec == NULL) {
- if (!page_cur_get_page_zip(page_cursor)
+ if (!is_page_cur_get_page_zip(page_cursor)
&& btr_page_reorganize(page_cursor, cursor->index, mtr)) {
rec = page_cur_tuple_insert(page_cursor, tuple,
cursor->index, offsets,
@@ -1879,16 +1871,17 @@ rtr_estimate_n_rows_in_range(
index->set_modified(mtr);
mtr_s_lock(&index->lock, &mtr);
- buf_block_t* block = btr_block_get(
- page_id_t(index->table->space_id, index->page),
- index->table->space->zip_size(),
- RW_S_LATCH, index, &mtr);
+ buf_block_t* block = btr_root_block_get(index, RW_S_LATCH, &mtr);
+ if (!block) {
+err_exit:
+ mtr.commit();
+ return HA_POS_ERROR;
+ }
const page_t* page = buf_block_get_frame(block);
const unsigned n_recs = page_header_get_field(page, PAGE_N_RECS);
if (n_recs == 0) {
- mtr.commit();
- return(HA_POS_ERROR);
+ goto err_exit;
}
/* Scan records in root page and calculate area. */
diff --git a/storage/innobase/gis/gis0sea.cc b/storage/innobase/gis/gis0sea.cc
index 888cbe3e81f..0ec21c813b3 100644
--- a/storage/innobase/gis/gis0sea.cc
+++ b/storage/innobase/gis/gis0sea.cc
@@ -422,9 +422,7 @@ rtr_pcur_getnext_from_path(
btr_cur_latch_leaves(
block,
- page_id_t(index->table->space_id,
- block->page.id.page_no()),
- zip_size, BTR_MODIFY_TREE,
+ BTR_MODIFY_TREE,
btr_cur, mtr);
}
@@ -1694,7 +1692,7 @@ rtr_cur_search_with_match(
and the table is a compressed table, try to avoid
first page as much as possible, as there will be problem
when update MIN_REC rec in compress table */
- if (buf_block_get_page_zip(block)
+ if (is_buf_block_get_page_zip(block)
&& !page_has_prev(page)
&& page_get_n_recs(page) >= 2) {
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 55d94140404..617cc72d0f9 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -202,8 +202,6 @@ static char* innobase_server_stopword_table;
values */
static my_bool innobase_use_atomic_writes;
-static my_bool innobase_use_checksums;
-static my_bool innobase_locks_unsafe_for_binlog;
static my_bool innobase_rollback_on_timeout;
static my_bool innobase_create_status_file;
my_bool innobase_stats_on_metadata;
@@ -863,7 +861,7 @@ innodb_tmpdir_validate(
Maps a MySQL trx isolation level code to the InnoDB isolation level code
@return InnoDB isolation level */
static inline
-ulint
+uint
innobase_map_isolation_level(
/*=========================*/
enum_tx_isolation iso); /*!< in: MySQL isolation level code */
@@ -945,6 +943,14 @@ static MYSQL_THDVAR_STR(tmpdir,
innodb_tmpdir_validate, NULL, NULL);
static SHOW_VAR innodb_status_variables[]= {
+#ifdef BTR_CUR_HASH_ADAPT
+ {"adaptive_hash_hash_searches", &btr_cur_n_sea, SHOW_SIZE_T},
+ {"adaptive_hash_non_hash_searches", &btr_cur_n_non_sea, SHOW_SIZE_T},
+#endif
+ {"background_log_sync", &srv_log_writes_and_flush, SHOW_SIZE_T},
+#if defined(LINUX_NATIVE_AIO)
+ {"buffered_aio_submitted", &srv_stats.buffered_aio_submitted, SHOW_SIZE_T},
+#endif
{"buffer_pool_dump_status",
(char*) &export_vars.innodb_buffer_pool_dump_status, SHOW_CHAR},
{"buffer_pool_load_status",
@@ -954,236 +960,212 @@ static SHOW_VAR innodb_status_variables[]= {
{"buffer_pool_load_incomplete",
&export_vars.innodb_buffer_pool_load_incomplete, SHOW_BOOL},
{"buffer_pool_pages_data",
- (char*) &export_vars.innodb_buffer_pool_pages_data, SHOW_LONG},
+ &export_vars.innodb_buffer_pool_pages_data, SHOW_SIZE_T},
{"buffer_pool_bytes_data",
- (char*) &export_vars.innodb_buffer_pool_bytes_data, SHOW_LONG},
+ &export_vars.innodb_buffer_pool_bytes_data, SHOW_SIZE_T},
{"buffer_pool_pages_dirty",
- (char*) &export_vars.innodb_buffer_pool_pages_dirty, SHOW_LONG},
+ &export_vars.innodb_buffer_pool_pages_dirty, SHOW_SIZE_T},
{"buffer_pool_bytes_dirty",
- (char*) &export_vars.innodb_buffer_pool_bytes_dirty, SHOW_LONG},
+ &export_vars.innodb_buffer_pool_bytes_dirty, SHOW_SIZE_T},
{"buffer_pool_pages_flushed",
- (char*) &export_vars.innodb_buffer_pool_pages_flushed, SHOW_LONG},
+ &export_vars.innodb_buffer_pool_pages_flushed, SHOW_SIZE_T},
{"buffer_pool_pages_free",
- (char*) &export_vars.innodb_buffer_pool_pages_free, SHOW_LONG},
+ &export_vars.innodb_buffer_pool_pages_free, SHOW_SIZE_T},
#ifdef UNIV_DEBUG
{"buffer_pool_pages_latched",
- (char*) &export_vars.innodb_buffer_pool_pages_latched, SHOW_LONG},
+ &export_vars.innodb_buffer_pool_pages_latched, SHOW_SIZE_T},
#endif /* UNIV_DEBUG */
+ {"buffer_pool_pages_made_not_young",
+ &export_vars.innodb_buffer_pool_pages_made_not_young, SHOW_SIZE_T},
+ {"buffer_pool_pages_made_young",
+ &export_vars.innodb_buffer_pool_pages_made_young, SHOW_SIZE_T},
{"buffer_pool_pages_misc",
- (char*) &export_vars.innodb_buffer_pool_pages_misc, SHOW_LONG},
+ &export_vars.innodb_buffer_pool_pages_misc, SHOW_SIZE_T},
+ {"buffer_pool_pages_old",
+ &export_vars.innodb_buffer_pool_pages_old, SHOW_SIZE_T},
{"buffer_pool_pages_total",
- (char*) &export_vars.innodb_buffer_pool_pages_total, SHOW_LONG},
+ &export_vars.innodb_buffer_pool_pages_total, SHOW_SIZE_T},
+ {"buffer_pool_pages_LRU_flushed", &buf_lru_flush_page_count, SHOW_SIZE_T},
{"buffer_pool_read_ahead_rnd",
- (char*) &export_vars.innodb_buffer_pool_read_ahead_rnd, SHOW_LONG},
+ &export_vars.innodb_buffer_pool_read_ahead_rnd, SHOW_SIZE_T},
{"buffer_pool_read_ahead",
- (char*) &export_vars.innodb_buffer_pool_read_ahead, SHOW_LONG},
+ &export_vars.innodb_buffer_pool_read_ahead, SHOW_SIZE_T},
{"buffer_pool_read_ahead_evicted",
- (char*) &export_vars.innodb_buffer_pool_read_ahead_evicted, SHOW_LONG},
+ &export_vars.innodb_buffer_pool_read_ahead_evicted, SHOW_SIZE_T},
{"buffer_pool_read_requests",
- (char*) &export_vars.innodb_buffer_pool_read_requests, SHOW_LONG},
+ &export_vars.innodb_buffer_pool_read_requests, SHOW_SIZE_T},
{"buffer_pool_reads",
- (char*) &export_vars.innodb_buffer_pool_reads, SHOW_LONG},
+ &export_vars.innodb_buffer_pool_reads, SHOW_SIZE_T},
{"buffer_pool_wait_free",
- (char*) &export_vars.innodb_buffer_pool_wait_free, SHOW_LONG},
+ &export_vars.innodb_buffer_pool_wait_free, SHOW_SIZE_T},
{"buffer_pool_write_requests",
- (char*) &export_vars.innodb_buffer_pool_write_requests, SHOW_LONG},
- {"data_fsyncs",
- (char*) &export_vars.innodb_data_fsyncs, SHOW_LONG},
- {"data_pending_fsyncs",
- (char*) &export_vars.innodb_data_pending_fsyncs, SHOW_LONG},
- {"data_pending_reads",
- (char*) &export_vars.innodb_data_pending_reads, SHOW_LONG},
- {"data_pending_writes",
- (char*) &export_vars.innodb_data_pending_writes, SHOW_LONG},
- {"data_read",
- (char*) &export_vars.innodb_data_read, SHOW_LONG},
- {"data_reads",
- (char*) &export_vars.innodb_data_reads, SHOW_LONG},
- {"data_writes",
- (char*) &export_vars.innodb_data_writes, SHOW_LONG},
- {"data_written",
- (char*) &export_vars.innodb_data_written, SHOW_LONG},
- {"dblwr_pages_written",
- (char*) &export_vars.innodb_dblwr_pages_written, SHOW_LONG},
- {"dblwr_writes",
- (char*) &export_vars.innodb_dblwr_writes, SHOW_LONG},
- {"log_waits",
- (char*) &export_vars.innodb_log_waits, SHOW_LONG},
- {"log_write_requests",
- (char*) &export_vars.innodb_log_write_requests, SHOW_LONG},
- {"log_writes",
- (char*) &export_vars.innodb_log_writes, SHOW_LONG},
- {"os_log_fsyncs",
- (char*) &export_vars.innodb_os_log_fsyncs, SHOW_LONG},
- {"os_log_pending_fsyncs",
- (char*) &export_vars.innodb_os_log_pending_fsyncs, SHOW_LONG},
- {"os_log_pending_writes",
- (char*) &export_vars.innodb_os_log_pending_writes, SHOW_LONG},
- {"os_log_written",
- (char*) &export_vars.innodb_os_log_written, SHOW_LONGLONG},
- {"page_size",
- (char*) &export_vars.innodb_page_size, SHOW_LONG},
- {"pages_created",
- (char*) &export_vars.innodb_pages_created, SHOW_LONG},
- {"pages_read",
- (char*) &export_vars.innodb_pages_read, SHOW_LONG},
- {"pages_written",
- (char*) &export_vars.innodb_pages_written, SHOW_LONG},
- {"row_lock_current_waits",
- (char*) &export_vars.innodb_row_lock_current_waits, SHOW_LONG},
- {"row_lock_time",
- (char*) &export_vars.innodb_row_lock_time, SHOW_LONGLONG},
- {"row_lock_time_avg",
- (char*) &export_vars.innodb_row_lock_time_avg, SHOW_LONG},
- {"row_lock_time_max",
- (char*) &export_vars.innodb_row_lock_time_max, SHOW_LONG},
- {"row_lock_waits",
- (char*) &export_vars.innodb_row_lock_waits, SHOW_LONG},
- {"rows_deleted",
- (char*) &export_vars.innodb_rows_deleted, SHOW_LONG},
- {"rows_inserted",
- (char*) &export_vars.innodb_rows_inserted, SHOW_LONG},
- {"rows_read",
- (char*) &export_vars.innodb_rows_read, SHOW_LONG},
- {"rows_updated",
- (char*) &export_vars.innodb_rows_updated, SHOW_LONG},
- {"system_rows_deleted",
- (char*) &export_vars.innodb_system_rows_deleted, SHOW_LONG},
- {"system_rows_inserted",
- (char*) &export_vars.innodb_system_rows_inserted, SHOW_LONG},
- {"system_rows_read",
- (char*) &export_vars.innodb_system_rows_read, SHOW_LONG},
- {"system_rows_updated",
- (char*) &export_vars.innodb_system_rows_updated, SHOW_LONG},
- {"num_open_files",
- (char*) &export_vars.innodb_num_open_files, SHOW_LONG},
- {"truncated_status_writes",
- (char*) &export_vars.innodb_truncated_status_writes, SHOW_LONG},
- {"available_undo_logs",
- (char*) &export_vars.innodb_available_undo_logs, SHOW_LONG},
- {"undo_truncations",
- (char*) &export_vars.innodb_undo_truncations, SHOW_LONG},
+ &export_vars.innodb_buffer_pool_write_requests, SHOW_SIZE_T},
+ {"checkpoint_age", &export_vars.innodb_checkpoint_age, SHOW_SIZE_T},
+ {"checkpoint_max_age", &export_vars.innodb_checkpoint_max_age, SHOW_SIZE_T},
+ {"data_fsyncs", &export_vars.innodb_data_fsyncs, SHOW_SIZE_T},
+ {"data_pending_fsyncs", &export_vars.innodb_data_pending_fsyncs,SHOW_SIZE_T},
+ {"data_pending_reads", &export_vars.innodb_data_pending_reads, SHOW_SIZE_T},
+ {"data_pending_writes", &export_vars.innodb_data_pending_writes,SHOW_SIZE_T},
+ {"data_read", &export_vars.innodb_data_read, SHOW_SIZE_T},
+ {"data_reads", &export_vars.innodb_data_reads, SHOW_SIZE_T},
+ {"data_writes", &export_vars.innodb_data_writes, SHOW_SIZE_T},
+ {"data_written", &export_vars.innodb_data_written, SHOW_SIZE_T},
+ {"dblwr_pages_written", &export_vars.innodb_dblwr_pages_written,SHOW_SIZE_T},
+ {"dblwr_writes", &export_vars.innodb_dblwr_writes, SHOW_SIZE_T},
+ {"deadlocks", &srv_stats.lock_deadlock_count, SHOW_SIZE_T},
+ {"history_list_length", &export_vars.innodb_history_list_length,SHOW_SIZE_T},
+ {"ibuf_discarded_delete_marks", &ibuf.n_discarded_ops[IBUF_OP_DELETE_MARK],
+ SHOW_SIZE_T},
+ {"ibuf_discarded_deletes", &ibuf.n_discarded_ops[IBUF_OP_DELETE],
+ SHOW_SIZE_T},
+ {"ibuf_discarded_inserts", &ibuf.n_discarded_ops[IBUF_OP_INSERT],
+ SHOW_SIZE_T},
+ {"ibuf_free_list", &ibuf.free_list_len, SHOW_SIZE_T},
+ {"ibuf_merged_delete_marks", &ibuf.n_merged_ops[IBUF_OP_DELETE_MARK],
+ SHOW_SIZE_T},
+ {"ibuf_merged_deletes", &ibuf.n_merged_ops[IBUF_OP_DELETE], SHOW_SIZE_T},
+ {"ibuf_merged_inserts", &ibuf.n_merged_ops[IBUF_OP_INSERT], SHOW_SIZE_T},
+ {"ibuf_merges", &ibuf.n_merges, SHOW_SIZE_T},
+ {"ibuf_segment_size", &ibuf.seg_size, SHOW_SIZE_T},
+ {"ibuf_size", &ibuf.size, SHOW_SIZE_T},
+ {"log_waits", &export_vars.innodb_log_waits, SHOW_SIZE_T},
+ {"log_write_requests", &export_vars.innodb_log_write_requests, SHOW_SIZE_T},
+ {"log_writes", &export_vars.innodb_log_writes, SHOW_SIZE_T},
+ {"lsn_current", &export_vars.innodb_lsn_current, SHOW_ULONGLONG},
+ {"lsn_flushed", &export_vars.innodb_lsn_flushed, SHOW_ULONGLONG},
+ {"lsn_last_checkpoint", &export_vars.innodb_lsn_last_checkpoint,
+ SHOW_ULONGLONG},
+ {"master_thread_active_loops", &srv_main_active_loops, SHOW_SIZE_T},
+ {"master_thread_idle_loops", &srv_main_idle_loops, SHOW_SIZE_T},
+ {"max_trx_id", &export_vars.innodb_max_trx_id, SHOW_ULONGLONG},
+#ifdef BTR_CUR_HASH_ADAPT
+ {"mem_adaptive_hash", &export_vars.innodb_mem_adaptive_hash, SHOW_SIZE_T},
+#endif
+ {"mem_dictionary", &export_vars.innodb_mem_dictionary, SHOW_SIZE_T},
+ {"os_log_fsyncs", &export_vars.innodb_os_log_fsyncs, SHOW_SIZE_T},
+ {"os_log_pending_fsyncs", &export_vars.innodb_os_log_pending_fsyncs,
+ SHOW_SIZE_T},
+ {"os_log_pending_writes", &export_vars.innodb_os_log_pending_writes,
+ SHOW_SIZE_T},
+ {"os_log_written", &export_vars.innodb_os_log_written, SHOW_SIZE_T},
+ {"page_size", &srv_page_size, SHOW_ULONG},
+ {"pages_created", &export_vars.innodb_pages_created, SHOW_SIZE_T},
+ {"pages_read", &export_vars.innodb_pages_read, SHOW_SIZE_T},
+ {"pages_written", &export_vars.innodb_pages_written, SHOW_SIZE_T},
+ {"row_lock_current_waits", &export_vars.innodb_row_lock_current_waits,
+ SHOW_SIZE_T},
+ {"row_lock_time", &export_vars.innodb_row_lock_time, SHOW_LONGLONG},
+ {"row_lock_time_avg", &export_vars.innodb_row_lock_time_avg, SHOW_SIZE_T},
+ {"row_lock_time_max", &export_vars.innodb_row_lock_time_max, SHOW_SIZE_T},
+ {"row_lock_waits", &export_vars.innodb_row_lock_waits, SHOW_SIZE_T},
+ {"rows_deleted", &export_vars.innodb_rows_deleted, SHOW_SIZE_T},
+ {"rows_inserted", &export_vars.innodb_rows_inserted, SHOW_SIZE_T},
+ {"rows_read", &export_vars.innodb_rows_read, SHOW_SIZE_T},
+ {"rows_updated", &export_vars.innodb_rows_updated, SHOW_SIZE_T},
+ {"system_rows_deleted", &export_vars.innodb_system_rows_deleted,SHOW_SIZE_T},
+ {"system_rows_inserted", &export_vars.innodb_system_rows_inserted,
+ SHOW_SIZE_T},
+ {"system_rows_read", &export_vars.innodb_system_rows_read, SHOW_SIZE_T},
+ {"system_rows_updated", &export_vars.innodb_system_rows_updated,
+ SHOW_SIZE_T},
+ {"num_open_files", &export_vars.innodb_num_open_files, SHOW_SIZE_T},
+ {"truncated_status_writes", &export_vars.innodb_truncated_status_writes,
+ SHOW_SIZE_T},
+ {"available_undo_logs", &srv_available_undo_logs, SHOW_ULONG},
+ {"undo_truncations", &export_vars.innodb_undo_truncations, SHOW_ULONG},
/* Status variables for page compression */
{"page_compression_saved",
- (char*) &export_vars.innodb_page_compression_saved, SHOW_LONGLONG},
+ &export_vars.innodb_page_compression_saved, SHOW_LONGLONG},
{"num_index_pages_written",
- (char*) &export_vars.innodb_index_pages_written, SHOW_LONGLONG},
+ &export_vars.innodb_index_pages_written, SHOW_LONGLONG},
{"num_non_index_pages_written",
- (char*) &export_vars.innodb_non_index_pages_written, SHOW_LONGLONG},
+ &export_vars.innodb_non_index_pages_written, SHOW_LONGLONG},
{"num_pages_page_compressed",
- (char*) &export_vars.innodb_pages_page_compressed, SHOW_LONGLONG},
+ &export_vars.innodb_pages_page_compressed, SHOW_LONGLONG},
{"num_page_compressed_trim_op",
- (char*) &export_vars.innodb_page_compressed_trim_op, SHOW_LONGLONG},
+ &export_vars.innodb_page_compressed_trim_op, SHOW_LONGLONG},
{"num_pages_page_decompressed",
- (char*) &export_vars.innodb_pages_page_decompressed, SHOW_LONGLONG},
+ &export_vars.innodb_pages_page_decompressed, SHOW_LONGLONG},
{"num_pages_page_compression_error",
- (char*) &export_vars.innodb_pages_page_compression_error, SHOW_LONGLONG},
+ &export_vars.innodb_pages_page_compression_error, SHOW_LONGLONG},
{"num_pages_encrypted",
- (char*) &export_vars.innodb_pages_encrypted, SHOW_LONGLONG},
+ &export_vars.innodb_pages_encrypted, SHOW_LONGLONG},
{"num_pages_decrypted",
- (char*) &export_vars.innodb_pages_decrypted, SHOW_LONGLONG},
- {"have_lz4",
- (char*) &innodb_have_lz4, SHOW_BOOL},
- {"have_lzo",
- (char*) &innodb_have_lzo, SHOW_BOOL},
- {"have_lzma",
- (char*) &innodb_have_lzma, SHOW_BOOL},
- {"have_bzip2",
- (char*) &innodb_have_bzip2, SHOW_BOOL},
- {"have_snappy",
- (char*) &innodb_have_snappy, SHOW_BOOL},
- {"have_punch_hole",
- (char*) &innodb_have_punch_hole, SHOW_BOOL},
+ &export_vars.innodb_pages_decrypted, SHOW_LONGLONG},
+ {"have_lz4", &innodb_have_lz4, SHOW_BOOL},
+ {"have_lzo", &innodb_have_lzo, SHOW_BOOL},
+ {"have_lzma", &innodb_have_lzma, SHOW_BOOL},
+ {"have_bzip2", &innodb_have_bzip2, SHOW_BOOL},
+ {"have_snappy", &innodb_have_snappy, SHOW_BOOL},
+ {"have_punch_hole", &innodb_have_punch_hole, SHOW_BOOL},
/* Defragmentation */
{"defragment_compression_failures",
- (char*) &export_vars.innodb_defragment_compression_failures, SHOW_LONG},
- {"defragment_failures",
- (char*) &export_vars.innodb_defragment_failures, SHOW_LONG},
- {"defragment_count",
- (char*) &export_vars.innodb_defragment_count, SHOW_LONG},
+ &export_vars.innodb_defragment_compression_failures, SHOW_SIZE_T},
+ {"defragment_failures", &export_vars.innodb_defragment_failures,SHOW_SIZE_T},
+ {"defragment_count", &export_vars.innodb_defragment_count, SHOW_SIZE_T},
{"instant_alter_column",
- (char*) &export_vars.innodb_instant_alter_column, SHOW_LONG},
+ &export_vars.innodb_instant_alter_column, SHOW_ULONG},
/* Online alter table status variables */
{"onlineddl_rowlog_rows",
- (char*) &export_vars.innodb_onlineddl_rowlog_rows, SHOW_LONG},
+ &export_vars.innodb_onlineddl_rowlog_rows, SHOW_SIZE_T},
{"onlineddl_rowlog_pct_used",
- (char*) &export_vars.innodb_onlineddl_rowlog_pct_used, SHOW_LONG},
+ &export_vars.innodb_onlineddl_rowlog_pct_used, SHOW_SIZE_T},
{"onlineddl_pct_progress",
- (char*) &export_vars.innodb_onlineddl_pct_progress, SHOW_LONG},
+ &export_vars.innodb_onlineddl_pct_progress, SHOW_SIZE_T},
/* Times secondary index lookup triggered cluster lookup and
times prefix optimization avoided triggering cluster lookup */
{"secondary_index_triggered_cluster_reads",
- (char*) &export_vars.innodb_sec_rec_cluster_reads, SHOW_LONG},
+ &export_vars.innodb_sec_rec_cluster_reads, SHOW_SIZE_T},
{"secondary_index_triggered_cluster_reads_avoided",
- (char*) &export_vars.innodb_sec_rec_cluster_reads_avoided, SHOW_LONG},
+ &export_vars.innodb_sec_rec_cluster_reads_avoided, SHOW_SIZE_T},
/* Encryption */
{"encryption_rotation_pages_read_from_cache",
- (char*) &export_vars.innodb_encryption_rotation_pages_read_from_cache,
- SHOW_LONG},
+ &export_vars.innodb_encryption_rotation_pages_read_from_cache, SHOW_SIZE_T},
{"encryption_rotation_pages_read_from_disk",
- (char*) &export_vars.innodb_encryption_rotation_pages_read_from_disk,
- SHOW_LONG},
+ &export_vars.innodb_encryption_rotation_pages_read_from_disk, SHOW_SIZE_T},
{"encryption_rotation_pages_modified",
- (char*) &export_vars.innodb_encryption_rotation_pages_modified,
- SHOW_LONG},
+ &export_vars.innodb_encryption_rotation_pages_modified, SHOW_SIZE_T},
{"encryption_rotation_pages_flushed",
- (char*) &export_vars.innodb_encryption_rotation_pages_flushed,
- SHOW_LONG},
+ &export_vars.innodb_encryption_rotation_pages_flushed, SHOW_SIZE_T},
{"encryption_rotation_estimated_iops",
- (char*) &export_vars.innodb_encryption_rotation_estimated_iops,
- SHOW_LONG},
+ &export_vars.innodb_encryption_rotation_estimated_iops, SHOW_SIZE_T},
{"encryption_key_rotation_list_length",
- (char*)&export_vars.innodb_key_rotation_list_length,
- SHOW_LONGLONG},
+ &export_vars.innodb_key_rotation_list_length, SHOW_LONGLONG},
{"encryption_n_merge_blocks_encrypted",
- (char*)&export_vars.innodb_n_merge_blocks_encrypted,
- SHOW_LONGLONG},
+ &export_vars.innodb_n_merge_blocks_encrypted, SHOW_LONGLONG},
{"encryption_n_merge_blocks_decrypted",
- (char*)&export_vars.innodb_n_merge_blocks_decrypted,
- SHOW_LONGLONG},
+ &export_vars.innodb_n_merge_blocks_decrypted, SHOW_LONGLONG},
{"encryption_n_rowlog_blocks_encrypted",
- (char*)&export_vars.innodb_n_rowlog_blocks_encrypted,
- SHOW_LONGLONG},
+ &export_vars.innodb_n_rowlog_blocks_encrypted, SHOW_LONGLONG},
{"encryption_n_rowlog_blocks_decrypted",
- (char*)&export_vars.innodb_n_rowlog_blocks_decrypted,
- SHOW_LONGLONG},
+ &export_vars.innodb_n_rowlog_blocks_decrypted, SHOW_LONGLONG},
{"encryption_n_temp_blocks_encrypted",
- (char*)&export_vars.innodb_n_temp_blocks_encrypted,
- SHOW_LONGLONG},
+ &export_vars.innodb_n_temp_blocks_encrypted, SHOW_LONGLONG},
{"encryption_n_temp_blocks_decrypted",
- (char*)&export_vars.innodb_n_temp_blocks_decrypted,
- SHOW_LONGLONG},
+ &export_vars.innodb_n_temp_blocks_decrypted, SHOW_LONGLONG},
/* scrubing */
{"scrub_background_page_reorganizations",
- (char*) &export_vars.innodb_scrub_page_reorganizations,
- SHOW_LONG},
- {"scrub_background_page_splits",
- (char*) &export_vars.innodb_scrub_page_splits,
- SHOW_LONG},
+ &export_vars.innodb_scrub_page_reorganizations, SHOW_SIZE_T},
+ {"scrub_background_page_splits", &export_vars.innodb_scrub_page_splits,
+ SHOW_SIZE_T},
{"scrub_background_page_split_failures_underflow",
- (char*) &export_vars.innodb_scrub_page_split_failures_underflow,
- SHOW_LONG},
+ &export_vars.innodb_scrub_page_split_failures_underflow, SHOW_SIZE_T},
{"scrub_background_page_split_failures_out_of_filespace",
- (char*) &export_vars.innodb_scrub_page_split_failures_out_of_filespace,
- SHOW_LONG},
+ &export_vars.innodb_scrub_page_split_failures_out_of_filespace,SHOW_SIZE_T},
{"scrub_background_page_split_failures_missing_index",
- (char*) &export_vars.innodb_scrub_page_split_failures_missing_index,
- SHOW_LONG},
+ &export_vars.innodb_scrub_page_split_failures_missing_index, SHOW_SIZE_T},
{"scrub_background_page_split_failures_unknown",
- (char*) &export_vars.innodb_scrub_page_split_failures_unknown,
- SHOW_LONG},
- {"scrub_log",
- (char*) &export_vars.innodb_scrub_log,
+ &export_vars.innodb_scrub_page_split_failures_unknown, SHOW_SIZE_T},
+ {"scrub_log", &export_vars.innodb_scrub_log, SHOW_LONGLONG},
+ {"encryption_num_key_requests", &export_vars.innodb_encryption_key_requests,
SHOW_LONGLONG},
- {"encryption_num_key_requests",
- (char*) &export_vars.innodb_encryption_key_requests, SHOW_LONGLONG},
{NullS, NullS, SHOW_LONG}
};
@@ -2346,96 +2328,6 @@ static bool is_mysql_datadir_path(const char *path)
TRUE));
}
-static int mysql_tmpfile_path(const char *path, const char *prefix)
-{
- DBUG_ASSERT(path != NULL);
- DBUG_ASSERT((strlen(path) + strlen(prefix)) <= FN_REFLEN);
-
- char filename[FN_REFLEN];
- File fd = create_temp_file(filename, path, prefix, O_BINARY | O_SEQUENTIAL,
- MYF(MY_WME | MY_TEMPORARY));
- return fd;
-}
-
-/** Creates a temporary file in the location specified by the parameter
-path. If the path is NULL, then it will be created in tmpdir.
-@param[in] path location for creating temporary file
-@return temporary file descriptor, or < 0 on error */
-os_file_t
-innobase_mysql_tmpfile(
- const char* path)
-{
-#ifdef WITH_INNODB_DISALLOW_WRITES
- os_event_wait(srv_allow_writes_event);
-#endif /* WITH_INNODB_DISALLOW_WRITES */
- File fd;
-
- DBUG_EXECUTE_IF(
- "innobase_tmpfile_creation_failure",
- return(OS_FILE_CLOSED);
- );
-
- if (path == NULL) {
- fd = mysql_tmpfile("ib");
- } else {
- fd = mysql_tmpfile_path(path, "ib");
- }
-
- if (fd < 0)
- return OS_FILE_CLOSED;
-
- /* Copy the file descriptor, so that the additional resources
- allocated by create_temp_file() can be freed by invoking
- my_close().
-
- Because the file descriptor returned by this function
- will be passed to fdopen(), it will be closed by invoking
- fclose(), which in turn will invoke close() instead of
- my_close(). */
-
-#ifdef _WIN32
- /* Note that on Windows, the integer returned by mysql_tmpfile
- has no relation to C runtime file descriptor. Here, we need
- to call my_get_osfhandle to get the HANDLE and then convert it
- to C runtime filedescriptor. */
-
- HANDLE hFile = my_get_osfhandle(fd);
- HANDLE hDup;
- BOOL bOK = DuplicateHandle(
- GetCurrentProcess(),
- hFile, GetCurrentProcess(),
- &hDup, 0, FALSE, DUPLICATE_SAME_ACCESS);
- my_close(fd, MYF(MY_WME));
-
- if (!bOK) {
- my_osmaperr(GetLastError());
- goto error;
- }
- return hDup;
-#else
-#ifdef F_DUPFD_CLOEXEC
- int fd2 = fcntl(fd, F_DUPFD_CLOEXEC, 0);
-#else
- int fd2 = dup(fd);
-#endif
- my_close(fd, MYF(MY_WME));
- if (fd2 < 0) {
- set_my_errno(errno);
- goto error;
- }
- return fd2;
-#endif
-
-error:
- char errbuf[MYSYS_STRERROR_SIZE];
-
- my_error(EE_OUT_OF_FILERESOURCES,
- MYF(0),
- "ib*", errno,
- my_strerror(errbuf, sizeof(errbuf), errno));
- return (OS_FILE_CLOSED);
-}
-
/*********************************************************************//**
Wrapper around MySQL's copy_and_convert function.
@return number of bytes copied to 'to' */
@@ -3553,46 +3445,6 @@ static int innodb_init_abort()
DBUG_RETURN(1);
}
-/** Update log_checksum_algorithm_ptr with a pointer to the function
-corresponding to whether checksums are enabled.
-@param[in,out] thd client session, or NULL if at startup
-@param[in] check whether redo log block checksums are enabled
-@return whether redo log block checksums are enabled */
-static inline
-bool
-innodb_log_checksums_func_update(THD* thd, bool check)
-{
- static const char msg[] = "innodb_encrypt_log implies"
- " innodb_log_checksums";
-
- ut_ad(!thd == !srv_was_started);
-
- if (!check) {
- check = srv_encrypt_log;
- if (!check) {
- } else if (thd) {
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- HA_ERR_UNSUPPORTED, msg);
- } else {
- sql_print_warning(msg);
- }
- }
-
- if (thd) {
- log_mutex_enter();
- log_checksum_algorithm_ptr = check
- ? log_block_calc_checksum_crc32
- : log_block_calc_checksum_none;
- log_mutex_exit();
- } else {
- log_checksum_algorithm_ptr = check
- ? log_block_calc_checksum_crc32
- : log_block_calc_checksum_none;
- }
-
- return(check);
-}
-
/****************************************************************//**
Gives the file extension of an InnoDB single-table tablespace. */
static const char* ha_innobase_exts[] = {
@@ -3690,6 +3542,17 @@ static void innodb_buffer_pool_size_init()
innobase_buffer_pool_size = srv_buf_pool_size;
}
+/** Deprecated parameter with no effect */
+static my_bool innodb_log_checksums;
+/** Deprecation message for innodb_log_checksums */
+static const char* innodb_log_checksums_deprecated
+= "The parameter innodb_log_checksums is deprecated and has no effect.";
+/** Deprecated parameter with no effect */
+static ulong innodb_undo_logs;
+/** Deprecation message for innodb_undo_logs */
+static const char* innodb_undo_logs_deprecated
+= "The parameter innodb_undo_logs is deprecated and has no effect.";
+
/** Initialize, validate and normalize the InnoDB startup parameters.
@return failure code
@retval 0 on success
@@ -3997,26 +3860,18 @@ static int innodb_init_params()
srv_buf_pool_size = ulint(innobase_buffer_pool_size);
- if (!innobase_use_checksums) {
- ib::warn() << "Setting innodb_checksums to OFF is DEPRECATED."
- " This option may be removed in future releases. You"
- " should set innodb_checksum_algorithm=NONE instead.";
- srv_checksum_algorithm = SRV_CHECKSUM_ALGORITHM_NONE;
+ if (UNIV_UNLIKELY(!innodb_log_checksums)) {
+ sql_print_warning(innodb_log_checksums_deprecated);
+ innodb_log_checksums = TRUE;
}
- innodb_log_checksums = innodb_log_checksums_func_update(
- NULL, innodb_log_checksums);
+ if (UNIV_UNLIKELY(innodb_undo_logs != TRX_SYS_N_RSEGS)) {
+ sql_print_warning(innodb_undo_logs_deprecated);
+ innodb_undo_logs = TRX_SYS_N_RSEGS;
+ }
row_rollback_on_timeout = (ibool) innobase_rollback_on_timeout;
- srv_locks_unsafe_for_binlog = (ibool) innobase_locks_unsafe_for_binlog;
- if (innobase_locks_unsafe_for_binlog) {
- ib::warn() << "Using innodb_locks_unsafe_for_binlog is"
- " DEPRECATED. This option may be removed in future"
- " releases. Please use READ COMMITTED transaction"
- " isolation level instead; " << SET_TRANSACTION_MSG;
- }
-
if (innobase_open_files < 10) {
innobase_open_files = 300;
if (srv_file_per_table && tc_size > 300 && tc_size < open_files_limit) {
@@ -4135,7 +3990,6 @@ static int innodb_init(void* p)
handlerton* innobase_hton= static_cast<handlerton*>(p);
innodb_hton_ptr = innobase_hton;
- innobase_hton->state = SHOW_OPTION_YES;
innobase_hton->db_type = DB_TYPE_INNODB;
innobase_hton->savepoint_offset = sizeof(trx_named_savept_t);
innobase_hton->close_connection = innobase_close_connection;
@@ -6047,7 +5901,7 @@ initialize_auto_increment(dict_table_t* table, const Field* field)
table->persistent_autoinc without
autoinc_mutex protection, and there might be multiple
ha_innobase::open() executing concurrently. */
- } else if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) {
+ } else if (srv_force_recovery > SRV_FORCE_NO_IBUF_MERGE) {
/* If the recovery level is set so high that writes
are disabled we force the AUTOINC counter to 0
value effectively disabling writes to the table.
@@ -6877,7 +6731,7 @@ get_innobase_type_from_mysql_type(
}
case MYSQL_TYPE_BIT:
case MYSQL_TYPE_STRING:
- if (field->binary()) {
+ if (field->binary() || field->key_type() == HA_KEYTYPE_BINARY) {
return(DATA_FIXBINARY);
} else if (field->charset() == &my_charset_latin1) {
return(DATA_CHAR);
@@ -9010,7 +8864,7 @@ ha_innobase::delete_all_rows()
/**********************************************************************//**
Removes a new lock set on a row, if it was not read optimistically. This can
be called after a row has been read in the processing of an UPDATE or a DELETE
-query, if the option innodb_locks_unsafe_for_binlog is set. */
+query. */
void
ha_innobase::unlock_row(void)
@@ -9026,11 +8880,8 @@ ha_innobase::unlock_row(void)
switch (m_prebuilt->row_read_type) {
case ROW_READ_WITH_LOCKS:
- if (!srv_locks_unsafe_for_binlog
- && m_prebuilt->trx->isolation_level
- > TRX_ISO_READ_COMMITTED) {
+ if (m_prebuilt->trx->isolation_level > TRX_ISO_READ_COMMITTED)
break;
- }
/* fall through */
case ROW_READ_TRY_SEMI_CONSISTENT:
row_unlock_for_mysql(m_prebuilt, FALSE);
@@ -9053,28 +8904,16 @@ ha_innobase::was_semi_consistent_read(void)
}
/* See handler.h and row0mysql.h for docs on this function. */
-
-void
-ha_innobase::try_semi_consistent_read(bool yes)
-/*===========================================*/
+void ha_innobase::try_semi_consistent_read(bool yes)
{
- ut_a(m_prebuilt->trx == thd_to_trx(ha_thd()));
-
+ ut_ad(m_prebuilt->trx == thd_to_trx(ha_thd()));
/* Row read type is set to semi consistent read if this was
- requested by the MySQL and either innodb_locks_unsafe_for_binlog
- option is used or this session is using READ COMMITTED isolation
- level. */
-
- if (yes
- && (srv_locks_unsafe_for_binlog
- || m_prebuilt->trx->isolation_level
- <= TRX_ISO_READ_COMMITTED)) {
-
- m_prebuilt->row_read_type = ROW_READ_TRY_SEMI_CONSISTENT;
-
- } else {
- m_prebuilt->row_read_type = ROW_READ_WITH_LOCKS;
- }
+ requested by the SQL layer and the transaction isolation level is
+ READ UNCOMMITTED or READ COMMITTED. */
+ m_prebuilt->row_read_type = yes
+ && m_prebuilt->trx->isolation_level <= TRX_ISO_READ_COMMITTED
+ ? ROW_READ_TRY_SEMI_CONSISTENT
+ : ROW_READ_WITH_LOCKS;
}
/******************************************************************//**
@@ -9880,7 +9719,7 @@ ha_innobase::ft_init_ext(
buf_tmp_used = innobase_convert_string(
buf_tmp, sizeof(buf_tmp) - 1,
- &my_charset_utf8_general_ci,
+ &my_charset_utf8mb3_general_ci,
query, query_len, (CHARSET_INFO*) char_set,
&num_errors);
@@ -14198,7 +14037,7 @@ ha_innobase::info_low(
}
}
- if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) {
+ if (srv_force_recovery > SRV_FORCE_NO_IBUF_MERGE) {
goto func_exit;
@@ -14447,7 +14286,6 @@ ha_innobase::check(
ulint n_rows;
ulint n_rows_in_table = ULINT_UNDEFINED;
bool is_ok = true;
- ulint old_isolation_level;
dberr_t ret;
DBUG_ENTER("ha_innobase::check");
@@ -14510,7 +14348,7 @@ ha_innobase::check(
DBUG_RETURN(HA_ADMIN_CORRUPT);
}
- old_isolation_level = m_prebuilt->trx->isolation_level;
+ uint old_isolation_level = m_prebuilt->trx->isolation_level;
/* We must run the index record counts at an isolation level
>= READ COMMITTED, because a dirty read can see a wrong number
@@ -15306,7 +15144,7 @@ ha_innobase::start_stmt(
Maps a MySQL trx isolation level code to the InnoDB isolation level code
@return InnoDB isolation level */
static inline
-ulint
+uint
innobase_map_isolation_level(
/*=========================*/
enum_tx_isolation iso) /*!< in: MySQL isolation level code */
@@ -16217,9 +16055,7 @@ ha_innobase::store_lock(
if (sql_command == SQLCOM_CHECKSUM
|| sql_command == SQLCOM_CREATE_SEQUENCE
|| (sql_command == SQLCOM_ANALYZE && lock_type == TL_READ)
- || ((srv_locks_unsafe_for_binlog
- || trx->isolation_level <= TRX_ISO_READ_COMMITTED)
- && trx->isolation_level != TRX_ISO_SERIALIZABLE
+ || (trx->isolation_level <= TRX_ISO_READ_COMMITTED
&& (lock_type == TL_READ
|| lock_type == TL_READ_NO_INSERT)
&& (sql_command == SQLCOM_INSERT_SELECT
@@ -16228,10 +16064,8 @@ ha_innobase::store_lock(
|| sql_command == SQLCOM_CREATE_SEQUENCE
|| sql_command == SQLCOM_CREATE_TABLE))) {
- /* If we either have innobase_locks_unsafe_for_binlog
- option set or this session is using READ COMMITTED
- isolation level and isolation level of the transaction
- is not set to serializable and MySQL is doing
+ /* If the transaction isolation level is
+ READ UNCOMMITTED or READ COMMITTED and we are executing
INSERT INTO...SELECT or REPLACE INTO...SELECT
or UPDATE ... = (SELECT ...) or CREATE ...
SELECT... without FOR UPDATE or IN SHARE
@@ -16849,6 +16683,9 @@ innobase_commit_by_xid(
{
DBUG_ASSERT(hton == innodb_hton_ptr);
+ DBUG_EXECUTE_IF("innobase_xa_fail",
+ return XAER_RMFAIL;);
+
if (high_level_read_only) {
return(XAER_RMFAIL);
}
@@ -16881,6 +16718,9 @@ innobase_rollback_by_xid(
{
DBUG_ASSERT(hton == innodb_hton_ptr);
+ DBUG_EXECUTE_IF("innobase_xa_fail",
+ return XAER_RMFAIL;);
+
if (high_level_read_only) {
return(XAER_RMFAIL);
}
@@ -17326,32 +17166,6 @@ func_exit:
goto func_exit;
}
#endif // UNIV_DEBUG
-/*************************************************************//**
-Just emit a warning that the usage of the variable is deprecated.
-@return 0 */
-static
-void
-innodb_stats_sample_pages_update(
-/*=============================*/
- THD* thd, /*!< in: thread handle */
- st_mysql_sys_var*, void*,
- const void* save) /*!< in: immediate result
- from check function */
-{
-
- const char* STATS_SAMPLE_PAGES_DEPRECATED_MSG =
- "Using innodb_stats_sample_pages is deprecated and"
- " the variable may be removed in future releases."
- " Please use innodb_stats_transient_sample_pages instead.";
-
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
- HA_ERR_WRONG_COMMAND, STATS_SAMPLE_PAGES_DEPRECATED_MSG);
-
- ib::warn() << STATS_SAMPLE_PAGES_DEPRECATED_MSG;
-
- srv_stats_transient_sample_pages =
- *static_cast<const unsigned long long*>(save);
-}
/****************************************************************//**
Update the monitor counter according to the "set_option", turn
@@ -18407,17 +18221,24 @@ innodb_encrypt_tables_update(THD*, st_mysql_sys_var*, void*, const void* save)
mysql_mutex_lock(&LOCK_global_system_variables);
}
-/** Update the innodb_log_checksums parameter.
-@param[in,out] thd client connection
-@param[out] var_ptr current value
-@param[in] save immediate result from check function */
-static
-void
-innodb_log_checksums_update(THD* thd, st_mysql_sys_var*, void* var_ptr,
- const void* save)
+/** Issue a deprecation warning for SET GLOBAL innodb_log_checksums.
+@param[in,out] thd client connection */
+static void
+innodb_log_checksums_warn(THD* thd, st_mysql_sys_var*, void*, const void*)
{
- *static_cast<my_bool*>(var_ptr) = innodb_log_checksums_func_update(
- thd, *static_cast<const my_bool*>(save));
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ HA_ERR_UNSUPPORTED,
+ innodb_log_checksums_deprecated);
+}
+
+/** Issue a deprecation warning for SET GLOBAL innodb_undo_logs.
+@param[in,out] thd client connection */
+static void
+innodb_undo_logs_warn(THD* thd, st_mysql_sys_var*, void*, const void*)
+{
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ HA_ERR_UNSUPPORTED,
+ innodb_undo_logs_deprecated);
}
#ifdef UNIV_DEBUG
@@ -18638,21 +18459,16 @@ static MYSQL_SYSVAR_ENUM(checksum_algorithm, srv_checksum_algorithm,
" Files updated when this option is set to crc32 or strict_crc32 will"
" not be readable by MariaDB versions older than 10.0.4;"
" new files created with full_crc32 are readable by MariaDB 10.4.3+",
- NULL, NULL, SRV_CHECKSUM_ALGORITHM_CRC32,
+ NULL, NULL, SRV_CHECKSUM_ALGORITHM_FULL_CRC32,
&innodb_checksum_algorithm_typelib);
+/** Description of deprecated and ignored parameters */
+static const char* innodb_deprecated_ignored
+= "Deprecated parameter with no effect.";
+
static MYSQL_SYSVAR_BOOL(log_checksums, innodb_log_checksums,
PLUGIN_VAR_RQCMDARG,
- "Whether to compute and require checksums for InnoDB redo log blocks",
- NULL, innodb_log_checksums_update, TRUE);
-
-static MYSQL_SYSVAR_BOOL(checksums, innobase_use_checksums,
- PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
- "DEPRECATED. Use innodb_checksum_algorithm=NONE instead of setting"
- " this to OFF."
- " Enable InnoDB checksums validation (enabled by default)."
- " Disable with --skip-innodb-checksums.",
- NULL, NULL, TRUE);
+ innodb_deprecated_ignored, NULL, innodb_log_checksums_warn, TRUE);
static MYSQL_SYSVAR_STR(data_home_dir, innobase_data_home_dir,
PLUGIN_VAR_READONLY,
@@ -18796,23 +18612,16 @@ static MYSQL_SYSVAR_ENUM(flush_method, innodb_flush_method,
static MYSQL_SYSVAR_STR(file_format, innodb_file_format,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
- "Deprecated parameter with no effect.", NULL, NULL, NULL);
+ innodb_deprecated_ignored, NULL, NULL, NULL);
static MYSQL_SYSVAR_STR(large_prefix, innodb_large_prefix,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
- "Deprecated parameter with no effect.", NULL, NULL, NULL);
+ innodb_deprecated_ignored, NULL, NULL, NULL);
static MYSQL_SYSVAR_BOOL(force_load_corrupted, srv_load_corrupted,
PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
"Force InnoDB to load metadata of corrupted table.",
NULL, NULL, FALSE);
-static MYSQL_SYSVAR_BOOL(locks_unsafe_for_binlog, innobase_locks_unsafe_for_binlog,
- PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
- "DEPRECATED. This option may be removed in future releases."
- " Please use READ COMMITTED transaction isolation level instead."
- " Force InnoDB to not use next-key locking, to use only row-level locking.",
- NULL, NULL, FALSE);
-
static MYSQL_SYSVAR_STR(log_group_home_dir, srv_log_group_home_dir,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Path to InnoDB log files.", NULL, NULL, NULL);
@@ -18894,11 +18703,6 @@ static MYSQL_SYSVAR_BOOL(stats_on_metadata, innobase_stats_on_metadata,
" SHOW TABLE STATUS for tables that use transient statistics (off by default)",
NULL, NULL, FALSE);
-static MYSQL_SYSVAR_ULONGLONG(stats_sample_pages, srv_stats_transient_sample_pages,
- PLUGIN_VAR_RQCMDARG,
- "Deprecated, use innodb_stats_transient_sample_pages instead",
- NULL, innodb_stats_sample_pages_update, 8, 1, ~0ULL, 0);
-
static MYSQL_SYSVAR_ULONGLONG(stats_transient_sample_pages,
srv_stats_transient_sample_pages,
PLUGIN_VAR_RQCMDARG,
@@ -19269,7 +19073,7 @@ static MYSQL_SYSVAR_ULONG(write_io_threads, srv_n_write_io_threads,
static MYSQL_SYSVAR_ULONG(force_recovery, srv_force_recovery,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
- "Helps to save your data in case the disk image of the database becomes corrupt.",
+ "Helps to save your data in case the disk image of the database becomes corrupt. Value 5 can return bogus data, and 6 can permanently corrupt data.",
NULL, NULL, 0, 0, 6, 0);
static MYSQL_SYSVAR_ULONG(page_size, srv_page_size,
@@ -19381,13 +19185,10 @@ static MYSQL_SYSVAR_ULONG(undo_tablespaces, srv_undo_tablespaces,
0L, /* Minimum value */
TRX_SYS_MAX_UNDO_SPACES, 0); /* Maximum value */
-static MYSQL_SYSVAR_ULONG(undo_logs, srv_undo_logs,
+static MYSQL_SYSVAR_ULONG(undo_logs, innodb_undo_logs,
PLUGIN_VAR_OPCMDARG,
- "Number of undo logs to use.",
- NULL, NULL,
- TRX_SYS_N_RSEGS, /* Default setting */
- 1, /* Minimum value */
- TRX_SYS_N_RSEGS, 0); /* Maximum value */
+ innodb_deprecated_ignored, NULL, innodb_undo_logs_warn,
+ TRX_SYS_N_RSEGS, 0, TRX_SYS_N_RSEGS, 0);
static MYSQL_SYSVAR_ULONGLONG(max_undo_log_size, srv_max_undo_log_size,
PLUGIN_VAR_OPCMDARG,
@@ -19408,15 +19209,6 @@ static MYSQL_SYSVAR_BOOL(undo_log_truncate, srv_undo_log_truncate,
"Enable or Disable Truncate of UNDO tablespace.",
NULL, NULL, FALSE);
-/* Alias for innodb_undo_logs, this config variable is deprecated. */
-static MYSQL_SYSVAR_ULONG(rollback_segments, srv_undo_logs,
- PLUGIN_VAR_OPCMDARG,
- "Number of undo logs to use (deprecated).",
- NULL, NULL,
- TRX_SYS_N_RSEGS, /* Default setting */
- 1, /* Minimum value */
- TRX_SYS_N_RSEGS, 0); /* Maximum value */
-
static MYSQL_SYSVAR_LONG(autoinc_lock_mode, innobase_autoinc_lock_mode,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"The AUTOINC lock modes supported by InnoDB:"
@@ -19469,12 +19261,6 @@ static MYSQL_SYSVAR_UINT(change_buffering_debug, ibuf_debug,
PLUGIN_VAR_RQCMDARG,
"Debug flags for InnoDB change buffering (0=none, 1=try to buffer)",
NULL, NULL, 0, 0, 1, 0);
-
-static MYSQL_SYSVAR_BOOL(disable_background_merge,
- srv_ibuf_disable_background_merge,
- PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_RQCMDARG,
- "Disable change buffering merges by the master thread",
- NULL, NULL, FALSE);
#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
static MYSQL_SYSVAR_ULONG(buf_dump_status_frequency, srv_buf_dump_status_frequency,
@@ -19853,7 +19639,6 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(flush_neighbors),
MYSQL_SYSVAR(checksum_algorithm),
MYSQL_SYSVAR(log_checksums),
- MYSQL_SYSVAR(checksums),
MYSQL_SYSVAR(commit_concurrency),
MYSQL_SYSVAR(concurrency_tickets),
MYSQL_SYSVAR(compression_level),
@@ -19884,7 +19669,6 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(large_prefix), /* deprecated in MariaDB 10.2; no effect */
MYSQL_SYSVAR(force_load_corrupted),
MYSQL_SYSVAR(lock_schedule_algorithm),
- MYSQL_SYSVAR(locks_unsafe_for_binlog),
MYSQL_SYSVAR(lock_wait_timeout),
MYSQL_SYSVAR(deadlock_detect),
MYSQL_SYSVAR(page_size),
@@ -19914,7 +19698,6 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(ft_user_stopword_table),
MYSQL_SYSVAR(disable_sort_file_cache),
MYSQL_SYSVAR(stats_on_metadata),
- MYSQL_SYSVAR(stats_sample_pages),
MYSQL_SYSVAR(stats_transient_sample_pages),
MYSQL_SYSVAR(stats_persistent),
MYSQL_SYSVAR(stats_persistent_sample_pages),
@@ -19949,7 +19732,6 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(change_buffer_max_size),
#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
MYSQL_SYSVAR(change_buffering_debug),
- MYSQL_SYSVAR(disable_background_merge),
#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
#ifdef WITH_INNODB_DISALLOW_WRITES
MYSQL_SYSVAR(disallow_writes),
@@ -19985,7 +19767,6 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(max_undo_log_size),
MYSQL_SYSVAR(purge_rseg_truncate_frequency),
MYSQL_SYSVAR(undo_log_truncate),
- MYSQL_SYSVAR(rollback_segments),
MYSQL_SYSVAR(undo_directory),
MYSQL_SYSVAR(undo_tablespaces),
MYSQL_SYSVAR(sync_array_size),
diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
index 5698346b279..0b7e117e04b 100644
--- a/storage/innobase/handler/i_s.cc
+++ b/storage/innobase/handler/i_s.cc
@@ -265,241 +265,101 @@ field_store_string(
return field->store(str, uint(strlen(str)), system_charset_info);
}
-/*******************************************************************//**
-Auxiliary function to store ulint value in MYSQL_TYPE_LONGLONG field.
-If the value is ULINT_UNDEFINED then the field is set to NULL.
-@return 0 on success */
-int
-field_store_ulint(
-/*==============*/
- Field* field, /*!< in/out: target field for storage */
- ulint n) /*!< in: value to store */
-{
- int ret;
-
- if (n != ULINT_UNDEFINED) {
-
- ret = field->store(longlong(n), true);
- field->set_notnull();
- } else {
-
- ret = 0; /* success */
- field->set_null();
- }
-
- return(ret);
-}
-
#ifdef BTR_CUR_HASH_ADAPT
# define I_S_AHI 1 /* Include the IS_HASHED column */
#else
# define I_S_AHI 0 /* Omit the IS_HASHED column */
#endif
+static const LEX_CSTRING isolation_level_values[] =
+{
+ { STRING_WITH_LEN("READ UNCOMMITTED") },
+ { STRING_WITH_LEN("READ COMMITTED") },
+ { STRING_WITH_LEN("REPEATABLE READ") },
+ { STRING_WITH_LEN("SERIALIZABLE") }
+};
+
+static TypelibBuffer<4> isolation_level_values_typelib(isolation_level_values);
+
+namespace Show {
+
/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_trx */
static ST_FIELD_INFO innodb_trx_fields_info[] =
{
#define IDX_TRX_ID 0
- {STRUCT_FLD(field_name, "trx_id"),
- STRUCT_FLD(field_length, TRX_ID_MAX_LEN + 1),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("trx_id", ULonglong(), NOT_NULL),
#define IDX_TRX_STATE 1
- {STRUCT_FLD(field_name, "trx_state"),
- STRUCT_FLD(field_length, TRX_QUE_STATE_STR_MAX_LEN + 1),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("trx_state", Varchar(TRX_QUE_STATE_STR_MAX_LEN + 1), NOT_NULL),
#define IDX_TRX_STARTED 2
- {STRUCT_FLD(field_name, "trx_started"),
- STRUCT_FLD(field_length, 0),
- STRUCT_FLD(field_type, MYSQL_TYPE_DATETIME),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("trx_started", Datetime(0), NOT_NULL),
#define IDX_TRX_REQUESTED_LOCK_ID 3
- {STRUCT_FLD(field_name, "trx_requested_lock_id"),
- STRUCT_FLD(field_length, TRX_I_S_LOCK_ID_MAX_LEN + 1),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("trx_requested_lock_id",
+ Varchar(TRX_I_S_LOCK_ID_MAX_LEN + 1), NULLABLE),
#define IDX_TRX_WAIT_STARTED 4
- {STRUCT_FLD(field_name, "trx_wait_started"),
- STRUCT_FLD(field_length, 0),
- STRUCT_FLD(field_type, MYSQL_TYPE_DATETIME),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("trx_wait_started", Datetime(0), NULLABLE),
#define IDX_TRX_WEIGHT 5
- {STRUCT_FLD(field_name, "trx_weight"),
- 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)},
+ Column("trx_weight", ULonglong(), NOT_NULL),
#define IDX_TRX_MYSQL_THREAD_ID 6
- {STRUCT_FLD(field_name, "trx_mysql_thread_id"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("trx_mysql_thread_id", ULonglong(), NOT_NULL),
#define IDX_TRX_QUERY 7
- {STRUCT_FLD(field_name, "trx_query"),
- STRUCT_FLD(field_length, TRX_I_S_TRX_QUERY_MAX_LEN),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("trx_query", Varchar(TRX_I_S_TRX_QUERY_MAX_LEN), NULLABLE),
#define IDX_TRX_OPERATION_STATE 8
- {STRUCT_FLD(field_name, "trx_operation_state"),
- STRUCT_FLD(field_length, TRX_I_S_TRX_OP_STATE_MAX_LEN),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("trx_operation_state", Varchar(64), NULLABLE),
#define IDX_TRX_TABLES_IN_USE 9
- {STRUCT_FLD(field_name, "trx_tables_in_use"),
- 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)},
+ Column("trx_tables_in_use", ULonglong(), NOT_NULL),
#define IDX_TRX_TABLES_LOCKED 10
- {STRUCT_FLD(field_name, "trx_tables_locked"),
- 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)},
+ Column("trx_tables_locked", ULonglong(), NOT_NULL),
#define IDX_TRX_LOCK_STRUCTS 11
- {STRUCT_FLD(field_name, "trx_lock_structs"),
- 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)},
+ Column("trx_lock_structs", ULonglong(), NOT_NULL),
#define IDX_TRX_LOCK_MEMORY_BYTES 12
- {STRUCT_FLD(field_name, "trx_lock_memory_bytes"),
- 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)},
+ Column("trx_lock_memory_bytes", ULonglong(), NOT_NULL),
#define IDX_TRX_ROWS_LOCKED 13
- {STRUCT_FLD(field_name, "trx_rows_locked"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
-#define IDX_TRX_ROWS_MODIFIED 14
- {STRUCT_FLD(field_name, "trx_rows_modified"),
- 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)},
+ Column("trx_rows_locked", ULonglong(), NOT_NULL),
+
+#define IDX_TRX_ROWS_MODIFIED 14
+ Column("trx_rows_modified", ULonglong(), NOT_NULL),
#define IDX_TRX_CONNCURRENCY_TICKETS 15
- {STRUCT_FLD(field_name, "trx_concurrency_tickets"),
- 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)},
+ Column("trx_concurrency_tickets", ULonglong(), NOT_NULL),
#define IDX_TRX_ISOLATION_LEVEL 16
- {STRUCT_FLD(field_name, "trx_isolation_level"),
- STRUCT_FLD(field_length, TRX_I_S_TRX_ISOLATION_LEVEL_MAX_LEN),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("trx_isolation_level",
+ Enum(&isolation_level_values_typelib), NOT_NULL),
#define IDX_TRX_UNIQUE_CHECKS 17
- {STRUCT_FLD(field_name, "trx_unique_checks"),
- STRUCT_FLD(field_length, 1),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 1),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("trx_unique_checks", SLong(1), NOT_NULL),
#define IDX_TRX_FOREIGN_KEY_CHECKS 18
- {STRUCT_FLD(field_name, "trx_foreign_key_checks"),
- STRUCT_FLD(field_length, 1),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 1),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("trx_foreign_key_checks", SLong(1), NOT_NULL),
#define IDX_TRX_LAST_FOREIGN_KEY_ERROR 19
- {STRUCT_FLD(field_name, "trx_last_foreign_key_error"),
- STRUCT_FLD(field_length, TRX_I_S_TRX_FK_ERROR_MAX_LEN),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("trx_last_foreign_key_error",
+ Varchar(TRX_I_S_TRX_FK_ERROR_MAX_LEN),NULLABLE),
#define IDX_TRX_READ_ONLY 20
- {STRUCT_FLD(field_name, "trx_is_read_only"),
- STRUCT_FLD(field_length, 1),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("trx_is_read_only", SLong(1), NOT_NULL),
#define IDX_TRX_AUTOCOMMIT_NON_LOCKING 21
- {STRUCT_FLD(field_name, "trx_autocommit_non_locking"),
- STRUCT_FLD(field_length, 1),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
- END_OF_ST_FIELD_INFO
+ Column("trx_autocommit_non_locking", SLong(1), NOT_NULL),
+
+ CEnd()
};
+} // namespace Show
+
/*******************************************************************//**
Read data from cache buffer and fill the INFORMATION_SCHEMA.innodb_trx
table with it.
@@ -528,15 +388,13 @@ fill_innodb_trx_from_cache(
for (i = 0; i < rows_num; i++) {
i_s_trx_row_t* row;
- char trx_id[TRX_ID_MAX_LEN + 1];
row = (i_s_trx_row_t*)
trx_i_s_cache_get_nth_row(
cache, I_S_INNODB_TRX, i);
/* trx_id */
- snprintf(trx_id, sizeof(trx_id), TRX_ID_FMT, row->trx_id);
- OK(field_store_string(fields[IDX_TRX_ID], trx_id));
+ OK(fields[IDX_TRX_ID]->store(row->trx_id, true));
/* trx_state */
OK(field_store_string(fields[IDX_TRX_STATE],
@@ -620,8 +478,8 @@ fill_innodb_trx_from_cache(
row->trx_concurrency_tickets, true));
/* trx_isolation_level */
- OK(field_store_string(fields[IDX_TRX_ISOLATION_LEVEL],
- row->trx_isolation_level));
+ OK(fields[IDX_TRX_ISOLATION_LEVEL]->store(
+ 1 + row->trx_isolation_level, true));
/* trx_unique_checks */
OK(fields[IDX_TRX_UNIQUE_CHECKS]->store(
@@ -641,8 +499,7 @@ fill_innodb_trx_from_cache(
/* trx_is_autocommit_non_locking */
OK(fields[IDX_TRX_AUTOCOMMIT_NON_LOCKING]->store(
- (longlong) row->trx_is_autocommit_non_locking,
- true));
+ row->trx_is_autocommit_non_locking, true));
OK(schema_table_store_record(thd, table));
}
@@ -665,7 +522,7 @@ innodb_trx_init(
schema = (ST_SCHEMA_TABLE*) p;
- schema->fields_info = innodb_trx_fields_info;
+ schema->fields_info = Show::innodb_trx_fields_info;
schema->fill_table = trx_i_s_common_fill_table;
DBUG_RETURN(0);
@@ -725,102 +582,65 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_trx =
STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE),
};
+static const LEX_CSTRING lock_mode_values[] =
+{
+ { STRING_WITH_LEN("S") },
+ { STRING_WITH_LEN("S,GAP") },
+ { STRING_WITH_LEN("X") },
+ { STRING_WITH_LEN("X,GAP") },
+ { STRING_WITH_LEN("IS") },
+ { STRING_WITH_LEN("IS,GAP") },
+ { STRING_WITH_LEN("IX") },
+ { STRING_WITH_LEN("IX,GAP") },
+ { STRING_WITH_LEN("AUTO_INC") }
+};
+
+static TypelibBuffer<9> lock_mode_values_typelib(lock_mode_values);
+
+static const LEX_CSTRING lock_type_values[] =
+{
+ { STRING_WITH_LEN("RECORD") },
+ { STRING_WITH_LEN("TABLE") }
+};
+
+static TypelibBuffer<2> lock_type_values_typelib(lock_type_values);
+
+namespace Show {
/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_locks */
static ST_FIELD_INFO innodb_locks_fields_info[] =
{
#define IDX_LOCK_ID 0
- {STRUCT_FLD(field_name, "lock_id"),
- STRUCT_FLD(field_length, TRX_I_S_LOCK_ID_MAX_LEN + 1),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("lock_id", Varchar(TRX_I_S_LOCK_ID_MAX_LEN + 1), NOT_NULL),
#define IDX_LOCK_TRX_ID 1
- {STRUCT_FLD(field_name, "lock_trx_id"),
- STRUCT_FLD(field_length, TRX_ID_MAX_LEN + 1),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("lock_trx_id", ULonglong(), NOT_NULL),
#define IDX_LOCK_MODE 2
- {STRUCT_FLD(field_name, "lock_mode"),
- /* S[,GAP] X[,GAP] IS[,GAP] IX[,GAP] AUTO_INC UNKNOWN */
- STRUCT_FLD(field_length, 32),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("lock_mode", Enum(&lock_mode_values_typelib), NOT_NULL),
#define IDX_LOCK_TYPE 3
- {STRUCT_FLD(field_name, "lock_type"),
- STRUCT_FLD(field_length, 32 /* RECORD|TABLE|UNKNOWN */),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("lock_type", Enum(&lock_type_values_typelib), NOT_NULL),
#define IDX_LOCK_TABLE 4
- {STRUCT_FLD(field_name, "lock_table"),
- STRUCT_FLD(field_length, 1024),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("lock_table", Varchar(1024), NOT_NULL),
#define IDX_LOCK_INDEX 5
- {STRUCT_FLD(field_name, "lock_index"),
- STRUCT_FLD(field_length, 1024),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("lock_index", Varchar(1024), NULLABLE),
#define IDX_LOCK_SPACE 6
- {STRUCT_FLD(field_name, "lock_space"),
- 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 | MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("lock_space", ULong(), NULLABLE),
#define IDX_LOCK_PAGE 7
- {STRUCT_FLD(field_name, "lock_page"),
- 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 | MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("lock_page", ULong(), NULLABLE),
#define IDX_LOCK_REC 8
- {STRUCT_FLD(field_name, "lock_rec"),
- 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 | MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("lock_rec", ULong(), NULLABLE),
#define IDX_LOCK_DATA 9
- {STRUCT_FLD(field_name, "lock_data"),
- STRUCT_FLD(field_length, TRX_I_S_LOCK_DATA_MAX_LEN),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
- END_OF_ST_FIELD_INFO
+ Column("lock_data", Varchar(TRX_I_S_LOCK_DATA_MAX_LEN), NULLABLE),
+ CEnd()
};
+} // namespace Show
/*******************************************************************//**
Read data from cache buffer and fill the INFORMATION_SCHEMA.innodb_locks
@@ -852,8 +672,6 @@ fill_innodb_locks_from_cache(
char buf[MAX_FULL_NAME_LEN + 1];
const char* bufend;
- char lock_trx_id[TRX_ID_MAX_LEN + 1];
-
row = (i_s_locks_row_t*)
trx_i_s_cache_get_nth_row(
cache, I_S_INNODB_LOCKS, i);
@@ -864,17 +682,14 @@ fill_innodb_locks_from_cache(
lock_id));
/* lock_trx_id */
- snprintf(lock_trx_id, sizeof(lock_trx_id),
- TRX_ID_FMT, row->lock_trx_id);
- OK(field_store_string(fields[IDX_LOCK_TRX_ID], lock_trx_id));
+ OK(fields[IDX_LOCK_TRX_ID]->store(row->lock_trx_id, true));
/* lock_mode */
- OK(field_store_string(fields[IDX_LOCK_MODE],
- row->lock_mode));
+ OK(fields[IDX_LOCK_MODE]->store(row->lock_mode, true));
/* lock_type */
- OK(field_store_string(fields[IDX_LOCK_TYPE],
- row->lock_type));
+ OK(fields[IDX_LOCK_TYPE]->store(
+ row->lock_index ? 1 : 2, true));
/* lock_table */
bufend = innobase_convert_name(buf, sizeof(buf),
@@ -884,25 +699,27 @@ fill_innodb_locks_from_cache(
OK(fields[IDX_LOCK_TABLE]->store(
buf, uint(bufend - buf), system_charset_info));
- /* lock_index */
- OK(field_store_string(fields[IDX_LOCK_INDEX],
- row->lock_index));
-
- /* lock_space */
- OK(field_store_ulint(fields[IDX_LOCK_SPACE],
- row->lock_space));
-
- /* lock_page */
- OK(field_store_ulint(fields[IDX_LOCK_PAGE],
- row->lock_page));
-
- /* lock_rec */
- OK(field_store_ulint(fields[IDX_LOCK_REC],
- row->lock_rec));
-
- /* lock_data */
- OK(field_store_string(fields[IDX_LOCK_DATA],
- row->lock_data));
+ if (row->lock_index) {
+ /* record lock */
+ OK(field_store_string(fields[IDX_LOCK_INDEX],
+ row->lock_index));
+ OK(fields[IDX_LOCK_SPACE]->store(
+ row->lock_space, true));
+ fields[IDX_LOCK_SPACE]->set_notnull();
+ OK(fields[IDX_LOCK_PAGE]->store(
+ row->lock_page, true));
+ fields[IDX_LOCK_PAGE]->set_notnull();
+ OK(fields[IDX_LOCK_REC]->store(
+ row->lock_rec, true));
+ fields[IDX_LOCK_REC]->set_notnull();
+ OK(field_store_string(fields[IDX_LOCK_DATA],
+ row->lock_data));
+ } else {
+ fields[IDX_LOCK_INDEX]->set_null();
+ fields[IDX_LOCK_SPACE]->set_null();
+ fields[IDX_LOCK_REC]->set_null();
+ fields[IDX_LOCK_DATA]->set_null();
+ }
OK(schema_table_store_record(thd, table));
}
@@ -925,7 +742,7 @@ innodb_locks_init(
schema = (ST_SCHEMA_TABLE*) p;
- schema->fields_info = innodb_locks_fields_info;
+ schema->fields_info = Show::innodb_locks_fields_info;
schema->fill_table = trx_i_s_common_fill_table;
DBUG_RETURN(0);
@@ -980,47 +797,25 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_locks =
STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE),
};
+
+namespace Show {
/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_lock_waits */
static ST_FIELD_INFO innodb_lock_waits_fields_info[] =
{
#define IDX_REQUESTING_TRX_ID 0
- {STRUCT_FLD(field_name, "requesting_trx_id"),
- STRUCT_FLD(field_length, TRX_ID_MAX_LEN + 1),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("requesting_trx_id", ULonglong(), NOT_NULL),
#define IDX_REQUESTED_LOCK_ID 1
- {STRUCT_FLD(field_name, "requested_lock_id"),
- STRUCT_FLD(field_length, TRX_I_S_LOCK_ID_MAX_LEN + 1),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("requested_lock_id", Varchar(TRX_I_S_LOCK_ID_MAX_LEN + 1), NOT_NULL),
#define IDX_BLOCKING_TRX_ID 2
- {STRUCT_FLD(field_name, "blocking_trx_id"),
- STRUCT_FLD(field_length, TRX_ID_MAX_LEN + 1),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("blocking_trx_id", ULonglong(), NOT_NULL),
#define IDX_BLOCKING_LOCK_ID 3
- {STRUCT_FLD(field_name, "blocking_lock_id"),
- STRUCT_FLD(field_length, TRX_I_S_LOCK_ID_MAX_LEN + 1),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
- END_OF_ST_FIELD_INFO
+ Column("blocking_lock_id", Varchar(TRX_I_S_LOCK_ID_MAX_LEN + 1), NOT_NULL),
+ CEnd()
};
+} // namespace Show
/*******************************************************************//**
Read data from cache buffer and fill the
@@ -1052,18 +847,13 @@ fill_innodb_lock_waits_from_cache(
i_s_lock_waits_row_t* row;
- char requesting_trx_id[TRX_ID_MAX_LEN + 1];
- char blocking_trx_id[TRX_ID_MAX_LEN + 1];
-
row = (i_s_lock_waits_row_t*)
trx_i_s_cache_get_nth_row(
cache, I_S_INNODB_LOCK_WAITS, i);
/* requesting_trx_id */
- snprintf(requesting_trx_id, sizeof(requesting_trx_id),
- TRX_ID_FMT, row->requested_lock_row->lock_trx_id);
- OK(field_store_string(fields[IDX_REQUESTING_TRX_ID],
- requesting_trx_id));
+ OK(fields[IDX_REQUESTING_TRX_ID]->store(
+ row->requested_lock_row->lock_trx_id, true));
/* requested_lock_id */
OK(field_store_string(
@@ -1074,10 +864,8 @@ fill_innodb_lock_waits_from_cache(
sizeof(requested_lock_id))));
/* blocking_trx_id */
- snprintf(blocking_trx_id, sizeof(blocking_trx_id),
- TRX_ID_FMT, row->blocking_lock_row->lock_trx_id);
- OK(field_store_string(fields[IDX_BLOCKING_TRX_ID],
- blocking_trx_id));
+ OK(fields[IDX_BLOCKING_TRX_ID]->store(
+ row->blocking_lock_row->lock_trx_id, true));
/* blocking_lock_id */
OK(field_store_string(
@@ -1108,7 +896,7 @@ innodb_lock_waits_init(
schema = (ST_SCHEMA_TABLE*) p;
- schema->fields_info = innodb_lock_waits_fields_info;
+ schema->fields_info = Show::innodb_lock_waits_fields_info;
schema->fill_table = trx_i_s_common_fill_table;
DBUG_RETURN(0);
@@ -1262,62 +1050,22 @@ trx_i_s_common_fill_table(
#endif
}
+namespace Show {
/* Fields of the dynamic table information_schema.innodb_cmp. */
static ST_FIELD_INFO i_s_cmp_fields_info[] =
{
- {STRUCT_FLD(field_name, "page_size"),
- STRUCT_FLD(field_length, 5),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, "Compressed Page Size"),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
- {STRUCT_FLD(field_name, "compress_ops"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, "Total Number of Compressions"),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
- {STRUCT_FLD(field_name, "compress_ops_ok"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, "Total Number of"
- " Successful Compressions"),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
- {STRUCT_FLD(field_name, "compress_time"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, "Total Duration of Compressions,"
- " in Seconds"),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
- {STRUCT_FLD(field_name, "uncompress_ops"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, "Total Number of Decompressions"),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
- {STRUCT_FLD(field_name, "uncompress_time"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, "Total Duration of Decompressions,"
- " in Seconds"),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
- END_OF_ST_FIELD_INFO
+ Column("page_size", SLong(5),NOT_NULL, "Compressed Page Size"),
+ Column("compress_ops", SLong(), NOT_NULL, "Total Number of Compressions"),
+ Column("compress_ops_ok",SLong(), NOT_NULL, "Total Number of "
+ "Successful Compressions"),
+ Column("compress_time", SLong(), NOT_NULL, "Total Duration of "
+ "Compressions, in Seconds"),
+ Column("uncompress_ops", SLong(), NOT_NULL, "Total Number of Decompressions"),
+ Column("uncompress_time",SLong(), NOT_NULL, "Total Duration of "
+ "Decompressions, in Seconds"),
+ CEnd(),
};
+} // namespace Show
/*******************************************************************//**
@@ -1418,7 +1166,7 @@ i_s_cmp_init(
DBUG_ENTER("i_s_cmp_init");
ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
- schema->fields_info = i_s_cmp_fields_info;
+ schema->fields_info = Show::i_s_cmp_fields_info;
schema->fill_table = i_s_cmp_fill;
DBUG_RETURN(0);
@@ -1436,7 +1184,7 @@ i_s_cmp_reset_init(
DBUG_ENTER("i_s_cmp_reset_init");
ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
- schema->fields_info = i_s_cmp_fields_info;
+ schema->fields_info = Show::i_s_cmp_fields_info;
schema->fill_table = i_s_cmp_reset_fill;
DBUG_RETURN(0);
@@ -1541,86 +1289,42 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_cmp_reset =
STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE),
};
+
+namespace Show {
/* Fields of the dynamic tables
information_schema.innodb_cmp_per_index and
information_schema.innodb_cmp_per_index_reset. */
static ST_FIELD_INFO i_s_cmp_per_index_fields_info[] =
{
#define IDX_DATABASE_NAME 0
- {STRUCT_FLD(field_name, "database_name"),
- STRUCT_FLD(field_length, 192),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
-#define IDX_TABLE_NAME 1
- {STRUCT_FLD(field_name, "table_name"),
- STRUCT_FLD(field_length, 192),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("database_name", Varchar(NAME_CHAR_LEN), NOT_NULL),
+
+#define IDX_TABLE_NAME 1 /* FIXME: this is in my_charset_filename! */
+ Column("table_name", Varchar(NAME_CHAR_LEN), NOT_NULL),
#define IDX_INDEX_NAME 2
- {STRUCT_FLD(field_name, "index_name"),
- STRUCT_FLD(field_length, 192),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("index_name", Varchar(NAME_CHAR_LEN), NOT_NULL),
#define IDX_COMPRESS_OPS 3
- {STRUCT_FLD(field_name, "compress_ops"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("compress_ops", SLong(), NOT_NULL),
#define IDX_COMPRESS_OPS_OK 4
- {STRUCT_FLD(field_name, "compress_ops_ok"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("compress_ops_ok", SLong(), NOT_NULL),
#define IDX_COMPRESS_TIME 5
- {STRUCT_FLD(field_name, "compress_time"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("compress_time", SLong(), NOT_NULL),
#define IDX_UNCOMPRESS_OPS 6
- {STRUCT_FLD(field_name, "uncompress_ops"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("uncompress_ops", SLong(), NOT_NULL),
#define IDX_UNCOMPRESS_TIME 7
- {STRUCT_FLD(field_name, "uncompress_time"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
- END_OF_ST_FIELD_INFO
+ Column("uncompress_time", SLong(), NOT_NULL),
+
+ CEnd()
};
+} // namespace Show
+
/*******************************************************************//**
Fill the dynamic table
information_schema.innodb_cmp_per_index or
@@ -1768,7 +1472,7 @@ i_s_cmp_per_index_init(
DBUG_ENTER("i_s_cmp_init");
ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
- schema->fields_info = i_s_cmp_per_index_fields_info;
+ schema->fields_info = Show::i_s_cmp_per_index_fields_info;
schema->fill_table = i_s_cmp_per_index_fill;
DBUG_RETURN(0);
@@ -1786,7 +1490,7 @@ i_s_cmp_per_index_reset_init(
DBUG_ENTER("i_s_cmp_reset_init");
ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
- schema->fields_info = i_s_cmp_per_index_fields_info;
+ schema->fields_info = Show::i_s_cmp_per_index_fields_info;
schema->fill_table = i_s_cmp_per_index_reset_fill;
DBUG_RETURN(0);
@@ -1891,60 +1595,21 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_cmp_per_index_reset =
STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE),
};
+
+namespace Show {
/* Fields of the dynamic table information_schema.innodb_cmpmem. */
static ST_FIELD_INFO i_s_cmpmem_fields_info[] =
{
- {STRUCT_FLD(field_name, "page_size"),
- STRUCT_FLD(field_length, 5),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, "Buddy Block Size"),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
- {STRUCT_FLD(field_name, "buffer_pool_instance"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, "Buffer Pool Id"),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
- {STRUCT_FLD(field_name, "pages_used"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, "Currently in Use"),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
- {STRUCT_FLD(field_name, "pages_free"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, "Currently Available"),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
- {STRUCT_FLD(field_name, "relocation_ops"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, "Total Number of Relocations"),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
- {STRUCT_FLD(field_name, "relocation_time"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, "Total Duration of Relocations,"
- " in Seconds"),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
- END_OF_ST_FIELD_INFO
+ Column("page_size", SLong(5), NOT_NULL, "Buddy Block Size"),
+ Column("buffer_pool_instance", SLong(), NOT_NULL, "Buffer Pool Id"),
+ Column("pages_used", SLong(), NOT_NULL, "Currently in Use"),
+ Column("pages_free", SLong(), NOT_NULL, "Currently Available"),
+ Column("relocation_ops", SLonglong(), NOT_NULL, "Total Number of Relocations"),
+ Column("relocation_time", SLong(), NOT_NULL, "Total Duration of Relocations,"
+ " in Seconds"),
+ CEnd()
};
+} // namespace Show
/*******************************************************************//**
Fill the dynamic table information_schema.innodb_cmpmem or
@@ -2065,7 +1730,7 @@ i_s_cmpmem_init(
DBUG_ENTER("i_s_cmpmem_init");
ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
- schema->fields_info = i_s_cmpmem_fields_info;
+ schema->fields_info = Show::i_s_cmpmem_fields_info;
schema->fill_table = i_s_cmpmem_fill;
DBUG_RETURN(0);
@@ -2083,7 +1748,7 @@ i_s_cmpmem_reset_init(
DBUG_ENTER("i_s_cmpmem_reset_init");
ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
- schema->fields_info = i_s_cmpmem_fields_info;
+ schema->fields_info = Show::i_s_cmpmem_fields_info;
schema->fill_table = i_s_cmpmem_reset_fill;
DBUG_RETURN(0);
@@ -2188,164 +1853,75 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_cmpmem_reset =
STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE),
};
+
+static const LEX_CSTRING metric_type_values[] =
+{
+ { STRING_WITH_LEN("value") },
+ { STRING_WITH_LEN("status_counter") },
+ { STRING_WITH_LEN("set_owner") },
+ { STRING_WITH_LEN("set_member") },
+ { STRING_WITH_LEN("counter") }
+};
+
+static TypelibBuffer<5> metric_type_values_typelib(metric_type_values);
+
+namespace Show {
/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_metrics */
static ST_FIELD_INFO innodb_metrics_fields_info[] =
{
#define METRIC_NAME 0
- {STRUCT_FLD(field_name, "NAME"),
- STRUCT_FLD(field_length, NAME_LEN + 1),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("NAME", Varchar(NAME_LEN + 1), NOT_NULL),
#define METRIC_SUBSYS 1
- {STRUCT_FLD(field_name, "SUBSYSTEM"),
- STRUCT_FLD(field_length, NAME_LEN + 1),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("SUBSYSTEM", Varchar(NAME_LEN + 1), NOT_NULL),
#define METRIC_VALUE_START 2
- {STRUCT_FLD(field_name, "COUNT"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("COUNT", SLonglong(), NOT_NULL),
#define METRIC_MAX_VALUE_START 3
- {STRUCT_FLD(field_name, "MAX_COUNT"),
- 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_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("MAX_COUNT", SLonglong(), NULLABLE),
#define METRIC_MIN_VALUE_START 4
- {STRUCT_FLD(field_name, "MIN_COUNT"),
- 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_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("MIN_COUNT", SLonglong(), NULLABLE),
#define METRIC_AVG_VALUE_START 5
- {STRUCT_FLD(field_name, "AVG_COUNT"),
- STRUCT_FLD(field_length, MAX_FLOAT_STR_LENGTH),
- STRUCT_FLD(field_type, MYSQL_TYPE_FLOAT),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("AVG_COUNT", Float(MAX_FLOAT_STR_LENGTH), NULLABLE),
#define METRIC_VALUE_RESET 6
- {STRUCT_FLD(field_name, "COUNT_RESET"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("COUNT_RESET", SLonglong(), NOT_NULL),
#define METRIC_MAX_VALUE_RESET 7
- {STRUCT_FLD(field_name, "MAX_COUNT_RESET"),
- 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_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("MAX_COUNT_RESET", SLonglong(), NULLABLE),
#define METRIC_MIN_VALUE_RESET 8
- {STRUCT_FLD(field_name, "MIN_COUNT_RESET"),
- 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_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("MIN_COUNT_RESET", SLonglong(), NULLABLE),
#define METRIC_AVG_VALUE_RESET 9
- {STRUCT_FLD(field_name, "AVG_COUNT_RESET"),
- STRUCT_FLD(field_length, MAX_FLOAT_STR_LENGTH),
- STRUCT_FLD(field_type, MYSQL_TYPE_FLOAT),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("AVG_COUNT_RESET", Float(MAX_FLOAT_STR_LENGTH), NULLABLE),
#define METRIC_START_TIME 10
- {STRUCT_FLD(field_name, "TIME_ENABLED"),
- STRUCT_FLD(field_length, 0),
- STRUCT_FLD(field_type, MYSQL_TYPE_DATETIME),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("TIME_ENABLED", Datetime(0), NULLABLE),
#define METRIC_STOP_TIME 11
- {STRUCT_FLD(field_name, "TIME_DISABLED"),
- STRUCT_FLD(field_length, 0),
- STRUCT_FLD(field_type, MYSQL_TYPE_DATETIME),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("TIME_DISABLED", Datetime(0), NULLABLE),
#define METRIC_TIME_ELAPSED 12
- {STRUCT_FLD(field_name, "TIME_ELAPSED"),
- 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_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("TIME_ELAPSED", SLonglong(), NULLABLE),
#define METRIC_RESET_TIME 13
- {STRUCT_FLD(field_name, "TIME_RESET"),
- STRUCT_FLD(field_length, 0),
- STRUCT_FLD(field_type, MYSQL_TYPE_DATETIME),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("TIME_RESET", Datetime(0), NULLABLE),
#define METRIC_STATUS 14
- {STRUCT_FLD(field_name, "STATUS"),
- STRUCT_FLD(field_length, NAME_LEN + 1),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("ENABLED", SLong(1), NOT_NULL),
#define METRIC_TYPE 15
- {STRUCT_FLD(field_name, "TYPE"),
- STRUCT_FLD(field_length, NAME_LEN + 1),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("TYPE", Enum(&metric_type_values_typelib), NOT_NULL),
#define METRIC_DESC 16
- {STRUCT_FLD(field_name, "COMMENT"),
- STRUCT_FLD(field_length, NAME_LEN + 1),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
- END_OF_ST_FIELD_INFO
+ Column("COMMENT", Varchar(NAME_LEN + 1), NOT_NULL),
+ CEnd()
};
+} // namespace Show
/**********************************************************************//**
Fill the information schema metrics table.
@@ -2562,7 +2138,6 @@ i_s_metrics_fill(
fields[METRIC_AVG_VALUE_RESET]->set_null();
}
-
if (MONITOR_IS_ON(count)) {
/* If monitor is on, the stop time will set to NULL */
fields[METRIC_STOP_TIME]->set_null();
@@ -2579,9 +2154,7 @@ i_s_metrics_fill(
fields[METRIC_RESET_TIME]->set_null();
}
- /* Display the monitor status as "enabled" */
- OK(field_store_string(fields[METRIC_STATUS],
- "enabled"));
+ OK(fields[METRIC_STATUS]->store(1, true));
} else {
if (MONITOR_FIELD(count, mon_stop_time)) {
OK(field_store_time_t(fields[METRIC_STOP_TIME],
@@ -2593,27 +2166,25 @@ i_s_metrics_fill(
fields[METRIC_RESET_TIME]->set_null();
- OK(field_store_string(fields[METRIC_STATUS],
- "disabled"));
+ OK(fields[METRIC_STATUS]->store(0, true));
}
+ uint metric_type;
+
if (monitor_info->monitor_type & MONITOR_DISPLAY_CURRENT) {
- OK(field_store_string(fields[METRIC_TYPE],
- "value"));
+ metric_type = 1; /* "value" */
} else if (monitor_info->monitor_type & MONITOR_EXISTING) {
- OK(field_store_string(fields[METRIC_TYPE],
- "status_counter"));
+ metric_type = 2; /* "status_counter" */
} else if (monitor_info->monitor_type & MONITOR_SET_OWNER) {
- OK(field_store_string(fields[METRIC_TYPE],
- "set_owner"));
- } else if ( monitor_info->monitor_type & MONITOR_SET_MEMBER) {
- OK(field_store_string(fields[METRIC_TYPE],
- "set_member"));
+ metric_type = 3; /* "set_owner" */
+ } else if (monitor_info->monitor_type & MONITOR_SET_MEMBER) {
+ metric_type = 4; /* "set_member" */
} else {
- OK(field_store_string(fields[METRIC_TYPE],
- "counter"));
+ metric_type = 5; /* "counter" */
}
+ OK(fields[METRIC_TYPE]->store(metric_type, true));
+
OK(schema_table_store_record(thd, table_to_fill));
}
@@ -2657,7 +2228,7 @@ innodb_metrics_init(
schema = (ST_SCHEMA_TABLE*) p;
- schema->fields_info = innodb_metrics_fields_info;
+ schema->fields_info = Show::innodb_metrics_fields_info;
schema->fill_table = i_s_metrics_fill_table;
DBUG_RETURN(0);
@@ -2711,20 +2282,16 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_metrics =
STRUCT_FLD(version_info, INNODB_VERSION_STR),
STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE),
};
+
+namespace Show {
/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_ft_default_stopword */
static ST_FIELD_INFO i_s_stopword_fields_info[] =
{
#define STOPWORD_VALUE 0
- {STRUCT_FLD(field_name, "value"),
- STRUCT_FLD(field_length, TRX_ID_MAX_LEN + 1),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
- END_OF_ST_FIELD_INFO
+ Column("value", Varchar(TRX_ID_MAX_LEN + 1), NOT_NULL),
+ CEnd()
};
+} // namespace Show
/*******************************************************************//**
Fill the dynamic table information_schema.innodb_ft_default_stopword.
@@ -2770,7 +2337,7 @@ i_s_stopword_init(
DBUG_ENTER("i_s_stopword_init");
ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
- schema->fields_info = i_s_stopword_fields_info;
+ schema->fields_info = Show::i_s_stopword_fields_info;
schema->fill_table = i_s_stopword_fill;
DBUG_RETURN(0);
@@ -2825,21 +2392,16 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_ft_default_stopword =
STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE),
};
+namespace Show {
/* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_FT_DELETED
INFORMATION_SCHEMA.INNODB_FT_BEING_DELETED */
static ST_FIELD_INFO i_s_fts_doc_fields_info[] =
{
#define I_S_FTS_DOC_ID 0
- {STRUCT_FLD(field_name, "DOC_ID"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
- END_OF_ST_FIELD_INFO
+ Column("DOC_ID", ULonglong(), NOT_NULL),
+ CEnd()
};
+} // namespace Show
/*******************************************************************//**
Fill the dynamic table INFORMATION_SCHEMA.INNODB_FT_DELETED or
@@ -2949,7 +2511,7 @@ i_s_fts_deleted_init(
DBUG_ENTER("i_s_fts_deleted_init");
ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
- schema->fields_info = i_s_fts_doc_fields_info;
+ schema->fields_info = Show::i_s_fts_doc_fields_info;
schema->fill_table = i_s_fts_deleted_fill;
DBUG_RETURN(0);
@@ -3032,7 +2594,7 @@ i_s_fts_being_deleted_init(
DBUG_ENTER("i_s_fts_deleted_init");
ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
- schema->fields_info = i_s_fts_doc_fields_info;
+ schema->fields_info = Show::i_s_fts_doc_fields_info;
schema->fill_table = i_s_fts_being_deleted_fill;
DBUG_RETURN(0);
@@ -3087,66 +2649,32 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_ft_being_deleted =
STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE),
};
+
+namespace Show {
/* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHED and
INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE */
static ST_FIELD_INFO i_s_fts_index_fields_info[] =
{
#define I_S_FTS_WORD 0
- {STRUCT_FLD(field_name, "WORD"),
- STRUCT_FLD(field_length, FTS_MAX_WORD_LEN + 1),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("WORD", Varchar(FTS_MAX_WORD_LEN + 1), NOT_NULL),
#define I_S_FTS_FIRST_DOC_ID 1
- {STRUCT_FLD(field_name, "FIRST_DOC_ID"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("FIRST_DOC_ID", ULonglong(), NOT_NULL),
#define I_S_FTS_LAST_DOC_ID 2
- {STRUCT_FLD(field_name, "LAST_DOC_ID"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("LAST_DOC_ID", ULonglong(), NOT_NULL),
#define I_S_FTS_DOC_COUNT 3
- {STRUCT_FLD(field_name, "DOC_COUNT"),
- 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)},
+ Column("DOC_COUNT", ULonglong(), NOT_NULL),
#define I_S_FTS_ILIST_DOC_ID 4
- {STRUCT_FLD(field_name, "DOC_ID"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("DOC_ID", ULonglong(), NOT_NULL),
#define I_S_FTS_ILIST_DOC_POS 5
- {STRUCT_FLD(field_name, "POSITION"),
- 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
+ Column("POSITION", ULonglong(), NOT_NULL),
+ CEnd()
};
+} // namespace Show
/*******************************************************************//**
Go through the Doc Node and its ilist, fill the dynamic table
@@ -3333,7 +2861,7 @@ i_s_fts_index_cache_init(
DBUG_ENTER("i_s_fts_index_cache_init");
ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
- schema->fields_info = i_s_fts_index_fields_info;
+ schema->fields_info = Show::i_s_fts_index_fields_info;
schema->fill_table = i_s_fts_index_cache_fill;
DBUG_RETURN(0);
@@ -3773,7 +3301,7 @@ i_s_fts_index_table_init(
DBUG_ENTER("i_s_fts_index_table_init");
ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
- schema->fields_info = i_s_fts_index_fields_info;
+ schema->fields_info = Show::i_s_fts_index_fields_info;
schema->fill_table = i_s_fts_index_table_fill;
DBUG_RETURN(0);
@@ -3828,29 +3356,20 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_ft_index_table =
STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE),
};
+
+namespace Show {
/* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_FT_CONFIG */
static ST_FIELD_INFO i_s_fts_config_fields_info[] =
{
#define FTS_CONFIG_KEY 0
- {STRUCT_FLD(field_name, "KEY"),
- STRUCT_FLD(field_length, NAME_LEN + 1),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("KEY", Varchar(NAME_LEN + 1), NOT_NULL),
#define FTS_CONFIG_VALUE 1
- {STRUCT_FLD(field_name, "VALUE"),
- STRUCT_FLD(field_length, NAME_LEN + 1),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
- END_OF_ST_FIELD_INFO
+ Column("VALUE", Varchar(NAME_LEN + 1), NOT_NULL),
+
+ CEnd()
};
+} // namespace Show
static const char* fts_config_key[] = {
FTS_OPTIMIZE_LIMIT_IN_SECS,
@@ -3981,7 +3500,7 @@ i_s_fts_config_init(
DBUG_ENTER("i_s_fts_config_init");
ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
- schema->fields_info = i_s_fts_config_fields_info;
+ schema->fields_info = Show::i_s_fts_config_fields_info;
schema->fill_table = i_s_fts_config_fill;
DBUG_RETURN(0);
@@ -4036,299 +3555,109 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_ft_config =
STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE),
};
+namespace Show {
/* Fields of the dynamic table INNODB_BUFFER_POOL_STATS. */
static ST_FIELD_INFO i_s_innodb_buffer_stats_fields_info[] =
{
#define IDX_BUF_STATS_POOL_ID 0
- {STRUCT_FLD(field_name, "POOL_ID"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("POOL_ID", ULong(), NOT_NULL),
#define IDX_BUF_STATS_POOL_SIZE 1
- {STRUCT_FLD(field_name, "POOL_SIZE"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("POOL_SIZE", ULonglong(), NOT_NULL),
#define IDX_BUF_STATS_FREE_BUFFERS 2
- {STRUCT_FLD(field_name, "FREE_BUFFERS"),
- 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)},
+ Column("FREE_BUFFERS", ULonglong(), NOT_NULL),
#define IDX_BUF_STATS_LRU_LEN 3
- {STRUCT_FLD(field_name, "DATABASE_PAGES"),
- 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)},
+ Column("DATABASE_PAGES", ULonglong(), NOT_NULL),
#define IDX_BUF_STATS_OLD_LRU_LEN 4
- {STRUCT_FLD(field_name, "OLD_DATABASE_PAGES"),
- 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)},
+ Column("OLD_DATABASE_PAGES", ULonglong(), NOT_NULL),
#define IDX_BUF_STATS_FLUSH_LIST_LEN 5
- {STRUCT_FLD(field_name, "MODIFIED_DATABASE_PAGES"),
- 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)},
+ Column("MODIFIED_DATABASE_PAGES", ULonglong(), NOT_NULL),
#define IDX_BUF_STATS_PENDING_ZIP 6
- {STRUCT_FLD(field_name, "PENDING_DECOMPRESS"),
- 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)},
+ Column("PENDING_DECOMPRESS", ULonglong(), NOT_NULL),
#define IDX_BUF_STATS_PENDING_READ 7
- {STRUCT_FLD(field_name, "PENDING_READS"),
- 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)},
+ Column("PENDING_READS",ULonglong(), NOT_NULL),
#define IDX_BUF_STATS_FLUSH_LRU 8
- {STRUCT_FLD(field_name, "PENDING_FLUSH_LRU"),
- 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)},
+ Column("PENDING_FLUSH_LRU",ULonglong(), NOT_NULL),
#define IDX_BUF_STATS_FLUSH_LIST 9
- {STRUCT_FLD(field_name, "PENDING_FLUSH_LIST"),
- 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)},
+ Column("PENDING_FLUSH_LIST", ULonglong(), NOT_NULL),
#define IDX_BUF_STATS_PAGE_YOUNG 10
- {STRUCT_FLD(field_name, "PAGES_MADE_YOUNG"),
- 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)},
+ Column("PAGES_MADE_YOUNG",ULonglong(), NOT_NULL),
#define IDX_BUF_STATS_PAGE_NOT_YOUNG 11
- {STRUCT_FLD(field_name, "PAGES_NOT_MADE_YOUNG"),
- 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)},
+ Column("PAGES_NOT_MADE_YOUNG",ULonglong(), NOT_NULL),
#define IDX_BUF_STATS_PAGE_YOUNG_RATE 12
- {STRUCT_FLD(field_name, "PAGES_MADE_YOUNG_RATE"),
- STRUCT_FLD(field_length, MAX_FLOAT_STR_LENGTH),
- STRUCT_FLD(field_type, MYSQL_TYPE_FLOAT),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("PAGES_MADE_YOUNG_RATE", Float(MAX_FLOAT_STR_LENGTH), NOT_NULL),
#define IDX_BUF_STATS_PAGE_NOT_YOUNG_RATE 13
- {STRUCT_FLD(field_name, "PAGES_MADE_NOT_YOUNG_RATE"),
- STRUCT_FLD(field_length, MAX_FLOAT_STR_LENGTH),
- STRUCT_FLD(field_type, MYSQL_TYPE_FLOAT),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("PAGES_MADE_NOT_YOUNG_RATE", Float(MAX_FLOAT_STR_LENGTH), NOT_NULL),
#define IDX_BUF_STATS_PAGE_READ 14
- {STRUCT_FLD(field_name, "NUMBER_PAGES_READ"),
- 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)},
+ Column("NUMBER_PAGES_READ",ULonglong(), NOT_NULL),
#define IDX_BUF_STATS_PAGE_CREATED 15
- {STRUCT_FLD(field_name, "NUMBER_PAGES_CREATED"),
- 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)},
+ Column("NUMBER_PAGES_CREATED",ULonglong(), NOT_NULL),
#define IDX_BUF_STATS_PAGE_WRITTEN 16
- {STRUCT_FLD(field_name, "NUMBER_PAGES_WRITTEN"),
- 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)},
+ Column("NUMBER_PAGES_WRITTEN",ULonglong(), NOT_NULL),
#define IDX_BUF_STATS_PAGE_READ_RATE 17
- {STRUCT_FLD(field_name, "PAGES_READ_RATE"),
- STRUCT_FLD(field_length, MAX_FLOAT_STR_LENGTH),
- STRUCT_FLD(field_type, MYSQL_TYPE_FLOAT),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("PAGES_READ_RATE", Float(MAX_FLOAT_STR_LENGTH), NOT_NULL),
#define IDX_BUF_STATS_PAGE_CREATE_RATE 18
- {STRUCT_FLD(field_name, "PAGES_CREATE_RATE"),
- STRUCT_FLD(field_length, MAX_FLOAT_STR_LENGTH),
- STRUCT_FLD(field_type, MYSQL_TYPE_FLOAT),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("PAGES_CREATE_RATE", Float(MAX_FLOAT_STR_LENGTH), NOT_NULL),
#define IDX_BUF_STATS_PAGE_WRITTEN_RATE 19
- {STRUCT_FLD(field_name, "PAGES_WRITTEN_RATE"),
- STRUCT_FLD(field_length, MAX_FLOAT_STR_LENGTH),
- STRUCT_FLD(field_type, MYSQL_TYPE_FLOAT),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("PAGES_WRITTEN_RATE",Float(MAX_FLOAT_STR_LENGTH), NOT_NULL),
#define IDX_BUF_STATS_GET 20
- {STRUCT_FLD(field_name, "NUMBER_PAGES_GET"),
- 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)},
+ Column("NUMBER_PAGES_GET", ULonglong(), NOT_NULL),
#define IDX_BUF_STATS_HIT_RATE 21
- {STRUCT_FLD(field_name, "HIT_RATE"),
- 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)},
+ Column("HIT_RATE", ULonglong(), NOT_NULL),
#define IDX_BUF_STATS_MADE_YOUNG_PCT 22
- {STRUCT_FLD(field_name, "YOUNG_MAKE_PER_THOUSAND_GETS"),
- 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)},
+ Column("YOUNG_MAKE_PER_THOUSAND_GETS", ULonglong(), NOT_NULL),
#define IDX_BUF_STATS_NOT_MADE_YOUNG_PCT 23
- {STRUCT_FLD(field_name, "NOT_YOUNG_MAKE_PER_THOUSAND_GETS"),
- 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)},
+ Column("NOT_YOUNG_MAKE_PER_THOUSAND_GETS", ULonglong(), NOT_NULL),
#define IDX_BUF_STATS_READ_AHREAD 24
- {STRUCT_FLD(field_name, "NUMBER_PAGES_READ_AHEAD"),
- 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)},
+ Column("NUMBER_PAGES_READ_AHEAD", ULonglong(), NOT_NULL),
#define IDX_BUF_STATS_READ_AHEAD_EVICTED 25
- {STRUCT_FLD(field_name, "NUMBER_READ_AHEAD_EVICTED"),
- 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)},
+ Column("NUMBER_READ_AHEAD_EVICTED", ULonglong(), NOT_NULL),
#define IDX_BUF_STATS_READ_AHEAD_RATE 26
- {STRUCT_FLD(field_name, "READ_AHEAD_RATE"),
- STRUCT_FLD(field_length, MAX_FLOAT_STR_LENGTH),
- STRUCT_FLD(field_type, MYSQL_TYPE_FLOAT),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("READ_AHEAD_RATE", Float(MAX_FLOAT_STR_LENGTH), NOT_NULL),
#define IDX_BUF_STATS_READ_AHEAD_EVICT_RATE 27
- {STRUCT_FLD(field_name, "READ_AHEAD_EVICTED_RATE"),
- STRUCT_FLD(field_length, MAX_FLOAT_STR_LENGTH),
- STRUCT_FLD(field_type, MYSQL_TYPE_FLOAT),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("READ_AHEAD_EVICTED_RATE",Float(MAX_FLOAT_STR_LENGTH), NOT_NULL),
#define IDX_BUF_STATS_LRU_IO_SUM 28
- {STRUCT_FLD(field_name, "LRU_IO_TOTAL"),
- 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)},
+ Column("LRU_IO_TOTAL", ULonglong(), NOT_NULL),
#define IDX_BUF_STATS_LRU_IO_CUR 29
- {STRUCT_FLD(field_name, "LRU_IO_CURRENT"),
- 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)},
+ Column("LRU_IO_CURRENT", ULonglong(), NOT_NULL),
#define IDX_BUF_STATS_UNZIP_SUM 30
- {STRUCT_FLD(field_name, "UNCOMPRESS_TOTAL"),
- 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)},
+ Column("UNCOMPRESS_TOTAL",ULonglong(), NOT_NULL),
#define IDX_BUF_STATS_UNZIP_CUR 31
- {STRUCT_FLD(field_name, "UNCOMPRESS_CURRENT"),
- 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
+ Column("UNCOMPRESS_CURRENT", ULonglong(), NOT_NULL),
+
+ CEnd()
};
+} // namespace Show
/*******************************************************************//**
Fill Information Schema table INNODB_BUFFER_POOL_STATS for a particular
@@ -4492,7 +3821,7 @@ i_s_innodb_buffer_stats_fill_table(
srv_buf_pool_instances * sizeof *pool_info);
/* Walk through each buffer pool */
- for (ulint i = 0; i < srv_buf_pool_instances; i++) {
+ for (uint i = 0; i < srv_buf_pool_instances; i++) {
buf_pool_t* buf_pool;
buf_pool = buf_pool_from_array(i);
@@ -4528,7 +3857,7 @@ i_s_innodb_buffer_pool_stats_init(
schema = reinterpret_cast<ST_SCHEMA_TABLE*>(p);
- schema->fields_info = i_s_innodb_buffer_stats_fields_info;
+ schema->fields_info = Show::i_s_innodb_buffer_stats_fields_info;
schema->fill_table = i_s_innodb_buffer_stats_fill_table;
DBUG_RETURN(0);
@@ -4583,193 +3912,98 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_buffer_stats =
STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE),
};
+/** These must correspond to the last values of buf_page_state */
+static const LEX_CSTRING page_state_values[] =
+{
+ { STRING_WITH_LEN("NOT_USED") },
+ { STRING_WITH_LEN("READY_FOR_USE") },
+ { STRING_WITH_LEN("FILE_PAGE") },
+ { STRING_WITH_LEN("MEMORY") },
+ { STRING_WITH_LEN("REMOVE_HASH") }
+};
+
+static const TypelibBuffer<5> page_state_values_typelib(page_state_values);
+
+static const LEX_CSTRING io_values[] =
+{
+ { STRING_WITH_LEN("IO_NONE") },
+ { STRING_WITH_LEN("IO_READ") },
+ { STRING_WITH_LEN("IO_WRITE") },
+ { STRING_WITH_LEN("IO_PIN") }
+};
+
+
+static TypelibBuffer<4> io_values_typelib(io_values);
+
+namespace Show {
/* Fields of the dynamic table INNODB_BUFFER_POOL_PAGE. */
static ST_FIELD_INFO i_s_innodb_buffer_page_fields_info[] =
{
#define IDX_BUFFER_POOL_ID 0
- {STRUCT_FLD(field_name, "POOL_ID"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("POOL_ID", ULong(), NOT_NULL),
#define IDX_BUFFER_BLOCK_ID 1
- {STRUCT_FLD(field_name, "BLOCK_ID"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("BLOCK_ID", ULonglong(), NOT_NULL),
#define IDX_BUFFER_PAGE_SPACE 2
- {STRUCT_FLD(field_name, "SPACE"),
- 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)},
+ Column("SPACE", ULong(), NOT_NULL),
#define IDX_BUFFER_PAGE_NUM 3
- {STRUCT_FLD(field_name, "PAGE_NUMBER"),
- 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)},
+ Column("PAGE_NUMBER", ULong(), NOT_NULL),
#define IDX_BUFFER_PAGE_TYPE 4
- {STRUCT_FLD(field_name, "PAGE_TYPE"),
- STRUCT_FLD(field_length, 64),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("PAGE_TYPE", Varchar(64), NULLABLE),
#define IDX_BUFFER_PAGE_FLUSH_TYPE 5
- {STRUCT_FLD(field_name, "FLUSH_TYPE"),
- 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)},
+ Column("FLUSH_TYPE", ULong(), NOT_NULL),
#define IDX_BUFFER_PAGE_FIX_COUNT 6
- {STRUCT_FLD(field_name, "FIX_COUNT"),
- 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)},
+ Column("FIX_COUNT", ULong(), NOT_NULL),
#ifdef BTR_CUR_HASH_ADAPT
#define IDX_BUFFER_PAGE_HASHED 7
- {STRUCT_FLD(field_name, "IS_HASHED"),
- STRUCT_FLD(field_length, 3),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("IS_HASHED", SLong(1), NOT_NULL),
#endif /* BTR_CUR_HASH_ADAPT */
#define IDX_BUFFER_PAGE_NEWEST_MOD 7 + I_S_AHI
- {STRUCT_FLD(field_name, "NEWEST_MODIFICATION"),
- 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)},
+ Column("NEWEST_MODIFICATION", ULonglong(), NOT_NULL),
#define IDX_BUFFER_PAGE_OLDEST_MOD 8 + I_S_AHI
- {STRUCT_FLD(field_name, "OLDEST_MODIFICATION"),
- 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)},
+ Column("OLDEST_MODIFICATION", ULonglong(), NOT_NULL),
#define IDX_BUFFER_PAGE_ACCESS_TIME 9 + I_S_AHI
- {STRUCT_FLD(field_name, "ACCESS_TIME"),
- 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)},
+ Column("ACCESS_TIME", ULonglong(), NOT_NULL),
#define IDX_BUFFER_PAGE_TABLE_NAME 10 + I_S_AHI
- {STRUCT_FLD(field_name, "TABLE_NAME"),
- STRUCT_FLD(field_length, 1024),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("TABLE_NAME", Varchar(1024), NULLABLE),
#define IDX_BUFFER_PAGE_INDEX_NAME 11 + I_S_AHI
- {STRUCT_FLD(field_name, "INDEX_NAME"),
- STRUCT_FLD(field_length, 1024),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("INDEX_NAME", Varchar(NAME_CHAR_LEN), NULLABLE),
#define IDX_BUFFER_PAGE_NUM_RECS 12 + I_S_AHI
- {STRUCT_FLD(field_name, "NUMBER_RECORDS"),
- 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)},
+ Column("NUMBER_RECORDS", ULonglong(), NOT_NULL),
#define IDX_BUFFER_PAGE_DATA_SIZE 13 + I_S_AHI
- {STRUCT_FLD(field_name, "DATA_SIZE"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("DATA_SIZE", ULonglong(), NOT_NULL),
#define IDX_BUFFER_PAGE_ZIP_SIZE 14 + I_S_AHI
- {STRUCT_FLD(field_name, "COMPRESSED_SIZE"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("COMPRESSED_SIZE", ULonglong(), NOT_NULL),
#define IDX_BUFFER_PAGE_STATE 15 + I_S_AHI
- {STRUCT_FLD(field_name, "PAGE_STATE"),
- STRUCT_FLD(field_length, 64),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("PAGE_STATE", Enum(&page_state_values_typelib), NOT_NULL),
#define IDX_BUFFER_PAGE_IO_FIX 16 + I_S_AHI
- {STRUCT_FLD(field_name, "IO_FIX"),
- STRUCT_FLD(field_length, 64),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("IO_FIX", Enum(&io_values_typelib), NOT_NULL),
#define IDX_BUFFER_PAGE_IS_OLD 17 + I_S_AHI
- {STRUCT_FLD(field_name, "IS_OLD"),
- STRUCT_FLD(field_length, 3),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("IS_OLD", SLong(1), NOT_NULL),
#define IDX_BUFFER_PAGE_FREE_CLOCK 18 + I_S_AHI
- {STRUCT_FLD(field_name, "FREE_PAGE_CLOCK"),
- 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
+ Column("FREE_PAGE_CLOCK", ULonglong(), NOT_NULL),
+
+ CEnd()
};
+} // namespace Show
/*******************************************************************//**
Fill Information Schema table INNODB_BUFFER_PAGE with information
@@ -4802,13 +4036,9 @@ i_s_innodb_buffer_page_fill(
const buf_page_info_t* page_info;
char table_name[MAX_FULL_NAME_LEN + 1];
const char* table_name_end = NULL;
- const char* state_str;
- enum buf_page_state state;
page_info = info_array + i;
- state_str = NULL;
-
OK(fields[IDX_BUFFER_POOL_ID]->store(
page_info->pool_id, true));
@@ -4832,8 +4062,8 @@ i_s_innodb_buffer_page_fill(
page_info->fix_count, true));
#ifdef BTR_CUR_HASH_ADAPT
- OK(field_store_string(fields[IDX_BUFFER_PAGE_HASHED],
- page_info->hashed ? "YES" : "NO"));
+ OK(fields[IDX_BUFFER_PAGE_HASHED]->store(
+ page_info->hashed, true));
#endif /* BTR_CUR_HASH_ADAPT */
OK(fields[IDX_BUFFER_PAGE_NEWEST_MOD]->store(
@@ -4902,57 +4132,20 @@ i_s_innodb_buffer_page_fill(
? (UNIV_ZIP_SIZE_MIN >> 1) << page_info->zip_ssize
: 0, true));
compile_time_assert(BUF_PAGE_STATE_BITS == 3);
- state = static_cast<enum buf_page_state>(page_info->page_state);
- switch (state) {
/* First three states are for compression pages and
are not states we would get as we scan pages through
buffer blocks */
- case BUF_BLOCK_POOL_WATCH:
- case BUF_BLOCK_ZIP_PAGE:
- case BUF_BLOCK_ZIP_DIRTY:
- state_str = NULL;
- break;
- case BUF_BLOCK_NOT_USED:
- state_str = "NOT_USED";
- break;
- case BUF_BLOCK_READY_FOR_USE:
- state_str = "READY_FOR_USE";
- break;
- case BUF_BLOCK_FILE_PAGE:
- state_str = "FILE_PAGE";
- break;
- case BUF_BLOCK_MEMORY:
- state_str = "MEMORY";
- break;
- case BUF_BLOCK_REMOVE_HASH:
- state_str = "REMOVE_HASH";
- break;
- };
-
- OK(field_store_string(fields[IDX_BUFFER_PAGE_STATE],
- state_str));
-
- switch (page_info->io_fix) {
- case BUF_IO_NONE:
- state_str = "IO_NONE";
- break;
- case BUF_IO_READ:
- state_str = "IO_READ";
- break;
- case BUF_IO_WRITE:
- state_str = "IO_WRITE";
- break;
- case BUF_IO_PIN:
- state_str = "IO_PIN";
- break;
- }
+ OK(fields[IDX_BUFFER_PAGE_STATE]->store(
+ page_info->page_state >= BUF_BLOCK_NOT_USED
+ ? page_info->page_state - (BUF_BLOCK_NOT_USED - 1)
+ : 0, true));
- OK(field_store_string(fields[IDX_BUFFER_PAGE_IO_FIX],
- state_str));
+ OK(fields[IDX_BUFFER_PAGE_IO_FIX]->store(
+ 1 + page_info->io_fix, true));
- OK(field_store_string(fields[IDX_BUFFER_PAGE_IS_OLD],
- (page_info->is_old) ? "YES" : "NO"));
+ OK(fields[IDX_BUFFER_PAGE_IS_OLD]->store(
+ page_info->is_old, true));
OK(fields[IDX_BUFFER_PAGE_FREE_CLOCK]->store(
page_info->freed_page_clock, true));
@@ -5258,7 +4451,7 @@ i_s_innodb_buffer_page_init(
schema = reinterpret_cast<ST_SCHEMA_TABLE*>(p);
- schema->fields_info = i_s_innodb_buffer_page_fields_info;
+ schema->fields_info = Show::i_s_innodb_buffer_page_fields_info;
schema->fill_table = i_s_innodb_buffer_page_fill_table;
DBUG_RETURN(0);
@@ -5313,192 +4506,74 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_buffer_page =
STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE),
};
+namespace Show {
static ST_FIELD_INFO i_s_innodb_buf_page_lru_fields_info[] =
{
#define IDX_BUF_LRU_POOL_ID 0
- {STRUCT_FLD(field_name, "POOL_ID"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("POOL_ID", ULong(), NOT_NULL),
#define IDX_BUF_LRU_POS 1
- {STRUCT_FLD(field_name, "LRU_POSITION"),
- 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)},
+ Column("LRU_POSITION", ULonglong(), NOT_NULL),
#define IDX_BUF_LRU_PAGE_SPACE 2
- {STRUCT_FLD(field_name, "SPACE"),
- 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)},
+ Column("SPACE", ULong(), NOT_NULL),
#define IDX_BUF_LRU_PAGE_NUM 3
- {STRUCT_FLD(field_name, "PAGE_NUMBER"),
- 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)},
+ Column("PAGE_NUMBER", ULong(), NOT_NULL),
#define IDX_BUF_LRU_PAGE_TYPE 4
- {STRUCT_FLD(field_name, "PAGE_TYPE"),
- STRUCT_FLD(field_length, 64),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("PAGE_TYPE", Varchar(64), NULLABLE),
#define IDX_BUF_LRU_PAGE_FLUSH_TYPE 5
- {STRUCT_FLD(field_name, "FLUSH_TYPE"),
- 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)},
+ Column("FLUSH_TYPE", ULonglong(), NOT_NULL),
#define IDX_BUF_LRU_PAGE_FIX_COUNT 6
- {STRUCT_FLD(field_name, "FIX_COUNT"),
- 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)},
+ Column("FIX_COUNT", ULong(), NOT_NULL),
#ifdef BTR_CUR_HASH_ADAPT
#define IDX_BUF_LRU_PAGE_HASHED 7
- {STRUCT_FLD(field_name, "IS_HASHED"),
- STRUCT_FLD(field_length, 3),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("IS_HASHED", SLong(1), NOT_NULL),
#endif /* BTR_CUR_HASH_ADAPT */
#define IDX_BUF_LRU_PAGE_NEWEST_MOD 7 + I_S_AHI
- {STRUCT_FLD(field_name, "NEWEST_MODIFICATION"),
- 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)},
+ Column("NEWEST_MODIFICATION",ULonglong(), NOT_NULL),
#define IDX_BUF_LRU_PAGE_OLDEST_MOD 8 + I_S_AHI
- {STRUCT_FLD(field_name, "OLDEST_MODIFICATION"),
- 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)},
+ Column("OLDEST_MODIFICATION",ULonglong(), NOT_NULL),
#define IDX_BUF_LRU_PAGE_ACCESS_TIME 9 + I_S_AHI
- {STRUCT_FLD(field_name, "ACCESS_TIME"),
- 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)},
+ Column("ACCESS_TIME",ULonglong(), NOT_NULL),
#define IDX_BUF_LRU_PAGE_TABLE_NAME 10 + I_S_AHI
- {STRUCT_FLD(field_name, "TABLE_NAME"),
- STRUCT_FLD(field_length, 1024),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("TABLE_NAME", Varchar(1024), NULLABLE),
#define IDX_BUF_LRU_PAGE_INDEX_NAME 11 + I_S_AHI
- {STRUCT_FLD(field_name, "INDEX_NAME"),
- STRUCT_FLD(field_length, 1024),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("INDEX_NAME", Varchar(NAME_CHAR_LEN), NULLABLE),
#define IDX_BUF_LRU_PAGE_NUM_RECS 12 + I_S_AHI
- {STRUCT_FLD(field_name, "NUMBER_RECORDS"),
- 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)},
+ Column("NUMBER_RECORDS", ULonglong(), NOT_NULL),
#define IDX_BUF_LRU_PAGE_DATA_SIZE 13 + I_S_AHI
- {STRUCT_FLD(field_name, "DATA_SIZE"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("DATA_SIZE", ULonglong(), NOT_NULL),
#define IDX_BUF_LRU_PAGE_ZIP_SIZE 14 + I_S_AHI
- {STRUCT_FLD(field_name, "COMPRESSED_SIZE"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("COMPRESSED_SIZE",ULonglong(), NOT_NULL),
#define IDX_BUF_LRU_PAGE_STATE 15 + I_S_AHI
- {STRUCT_FLD(field_name, "COMPRESSED"),
- STRUCT_FLD(field_length, 3),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("COMPRESSED", SLong(1), NOT_NULL),
#define IDX_BUF_LRU_PAGE_IO_FIX 16 + I_S_AHI
- {STRUCT_FLD(field_name, "IO_FIX"),
- STRUCT_FLD(field_length, 64),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("IO_FIX", Enum(&io_values_typelib), NOT_NULL),
#define IDX_BUF_LRU_PAGE_IS_OLD 17 + I_S_AHI
- {STRUCT_FLD(field_name, "IS_OLD"),
- STRUCT_FLD(field_length, 3),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("IS_OLD", SLong(1), NULLABLE),
#define IDX_BUF_LRU_PAGE_FREE_CLOCK 18 + I_S_AHI
- {STRUCT_FLD(field_name, "FREE_PAGE_CLOCK"),
- 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
+ Column("FREE_PAGE_CLOCK", ULonglong(), NOT_NULL),
+
+ CEnd()
};
+} // namespace Show
/*******************************************************************//**
Fill Information Schema table INNODB_BUFFER_PAGE_LRU with information
@@ -5525,10 +4600,6 @@ i_s_innodb_buf_page_lru_fill(
const buf_page_info_t* page_info;
char table_name[MAX_FULL_NAME_LEN + 1];
const char* table_name_end = NULL;
- const char* state_str;
- enum buf_page_state state;
-
- state_str = NULL;
page_info = info_array + i;
@@ -5555,8 +4626,8 @@ i_s_innodb_buf_page_lru_fill(
page_info->fix_count, true));
#ifdef BTR_CUR_HASH_ADAPT
- OK(field_store_string(fields[IDX_BUF_LRU_PAGE_HASHED],
- page_info->hashed ? "YES" : "NO"));
+ OK(fields[IDX_BUF_LRU_PAGE_HASHED]->store(
+ page_info->hashed, true));
#endif /* BTR_CUR_HASH_ADAPT */
OK(fields[IDX_BUF_LRU_PAGE_NEWEST_MOD]->store(
@@ -5624,51 +4695,16 @@ i_s_innodb_buf_page_lru_fill(
page_info->zip_ssize
? 512 << page_info->zip_ssize : 0, true));
- state = static_cast<enum buf_page_state>(page_info->page_state);
-
- switch (state) {
- /* Compressed page */
- case BUF_BLOCK_ZIP_PAGE:
- case BUF_BLOCK_ZIP_DIRTY:
- state_str = "YES";
- break;
- /* Uncompressed page */
- case BUF_BLOCK_FILE_PAGE:
- state_str = "NO";
- break;
- /* We should not see following states */
- case BUF_BLOCK_POOL_WATCH:
- case BUF_BLOCK_READY_FOR_USE:
- case BUF_BLOCK_NOT_USED:
- case BUF_BLOCK_MEMORY:
- case BUF_BLOCK_REMOVE_HASH:
- state_str = NULL;
- break;
- };
-
- OK(field_store_string(fields[IDX_BUF_LRU_PAGE_STATE],
- state_str));
-
- switch (page_info->io_fix) {
- case BUF_IO_NONE:
- state_str = "IO_NONE";
- break;
- case BUF_IO_READ:
- state_str = "IO_READ";
- break;
- case BUF_IO_WRITE:
- state_str = "IO_WRITE";
- break;
- case BUF_IO_PIN:
- state_str = "IO_PIN";
- break;
- }
+ OK(fields[IDX_BUF_LRU_PAGE_STATE]->store(
+ page_info->page_state == BUF_BLOCK_ZIP_PAGE
+ || page_info->page_state == BUF_BLOCK_ZIP_DIRTY,
+ true));
- OK(field_store_string(fields[IDX_BUF_LRU_PAGE_IO_FIX],
- state_str));
+ OK(fields[IDX_BUF_LRU_PAGE_IO_FIX]->store(
+ 1 + page_info->io_fix, true));
- OK(field_store_string(fields[IDX_BUF_LRU_PAGE_IS_OLD],
- page_info->is_old ? "YES" : "NO"));
+ OK(fields[IDX_BUF_LRU_PAGE_IS_OLD]->store(
+ page_info->is_old, true));
OK(fields[IDX_BUF_LRU_PAGE_FREE_CLOCK]->store(
page_info->freed_page_clock, true));
@@ -5809,7 +4845,7 @@ i_s_innodb_buffer_page_lru_init(
schema = reinterpret_cast<ST_SCHEMA_TABLE*>(p);
- schema->fields_info = i_s_innodb_buf_page_lru_fields_info;
+ schema->fields_info = Show::i_s_innodb_buf_page_lru_fields_info;
schema->fill_table = i_s_innodb_buf_page_lru_fill_table;
DBUG_RETURN(0);
@@ -5876,84 +4912,56 @@ static int i_s_common_deinit(void*)
DBUG_RETURN(0);
}
+static const LEX_CSTRING row_format_values[] =
+{
+ { STRING_WITH_LEN("Redundant") },
+ { STRING_WITH_LEN("Compact") },
+ { STRING_WITH_LEN("Compressed") },
+ { STRING_WITH_LEN("Dynamic") }
+};
+
+static TypelibBuffer<4> row_format_values_typelib(row_format_values);
+
+static const LEX_CSTRING space_type_values[] =
+{
+ { STRING_WITH_LEN("Single") },
+ { STRING_WITH_LEN("System") }
+};
+
+static TypelibBuffer<2> space_type_values_typelib(space_type_values);
+
+namespace Show {
/** SYS_TABLES ***************************************************/
/* Fields of the dynamic table INFORMATION_SCHEMA.SYS_TABLES */
static ST_FIELD_INFO innodb_sys_tables_fields_info[] =
{
#define SYS_TABLES_ID 0
- {STRUCT_FLD(field_name, "TABLE_ID"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("TABLE_ID", ULonglong(), NOT_NULL),
#define SYS_TABLES_NAME 1
- {STRUCT_FLD(field_name, "NAME"),
- STRUCT_FLD(field_length, MAX_FULL_NAME_LEN + 1),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("NAME", Varchar(MAX_FULL_NAME_LEN + 1), NOT_NULL),
#define SYS_TABLES_FLAG 2
- {STRUCT_FLD(field_name, "FLAG"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("FLAG", SLong(), NOT_NULL),
#define SYS_TABLES_NUM_COLUMN 3
- {STRUCT_FLD(field_name, "N_COLS"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("N_COLS", ULong(), NOT_NULL),
#define SYS_TABLES_SPACE 4
- {STRUCT_FLD(field_name, "SPACE"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("SPACE", ULong(), NOT_NULL),
#define SYS_TABLES_ROW_FORMAT 5
- {STRUCT_FLD(field_name, "ROW_FORMAT"),
- STRUCT_FLD(field_length, 12),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("ROW_FORMAT", Enum(&row_format_values_typelib), NULLABLE),
#define SYS_TABLES_ZIP_PAGE_SIZE 6
- {STRUCT_FLD(field_name, "ZIP_PAGE_SIZE"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("ZIP_PAGE_SIZE", ULong(), NOT_NULL),
#define SYS_TABLES_SPACE_TYPE 7
- {STRUCT_FLD(field_name, "SPACE_TYPE"),
- STRUCT_FLD(field_length, 10),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
- END_OF_ST_FIELD_INFO
+ Column("SPACE_TYPE", Enum(&space_type_values_typelib), NULLABLE),
+
+ CEnd()
};
+} // namespace Show
/**********************************************************************//**
Populate information_schema.innodb_sys_tables table with information
@@ -6094,7 +5102,7 @@ innodb_sys_tables_init(
schema = (ST_SCHEMA_TABLE*) p;
- schema->fields_info = innodb_sys_tables_fields_info;
+ schema->fields_info = Show::innodb_sys_tables_fields_info;
schema->fill_table = i_s_sys_tables_fill_table;
DBUG_RETURN(0);
@@ -6149,93 +5157,41 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_tables =
STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE),
};
+namespace Show {
/** SYS_TABLESTATS ***********************************************/
/* Fields of the dynamic table INFORMATION_SCHEMA.SYS_TABLESTATS */
static ST_FIELD_INFO innodb_sys_tablestats_fields_info[] =
{
#define SYS_TABLESTATS_ID 0
- {STRUCT_FLD(field_name, "TABLE_ID"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("TABLE_ID", ULonglong(), NOT_NULL),
#define SYS_TABLESTATS_NAME 1
- {STRUCT_FLD(field_name, "NAME"),
- STRUCT_FLD(field_length, NAME_LEN + 1),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("NAME", Varchar(NAME_CHAR_LEN), NOT_NULL),
#define SYS_TABLESTATS_INIT 2
- {STRUCT_FLD(field_name, "STATS_INITIALIZED"),
- STRUCT_FLD(field_length, NAME_LEN + 1),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("STATS_INITIALIZED", SLong(1), NOT_NULL),
#define SYS_TABLESTATS_NROW 3
- {STRUCT_FLD(field_name, "NUM_ROWS"),
- 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)},
+ Column("NUM_ROWS", ULonglong(), NOT_NULL),
#define SYS_TABLESTATS_CLUST_SIZE 4
- {STRUCT_FLD(field_name, "CLUST_INDEX_SIZE"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("CLUST_INDEX_SIZE", ULonglong(), NOT_NULL),
#define SYS_TABLESTATS_INDEX_SIZE 5
- {STRUCT_FLD(field_name, "OTHER_INDEX_SIZE"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("OTHER_INDEX_SIZE", ULonglong(), NOT_NULL),
#define SYS_TABLESTATS_MODIFIED 6
- {STRUCT_FLD(field_name, "MODIFIED_COUNTER"),
- 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)},
+ Column("MODIFIED_COUNTER", ULonglong(), NOT_NULL),
#define SYS_TABLESTATS_AUTONINC 7
- {STRUCT_FLD(field_name, "AUTOINC"),
- 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)},
+ Column("AUTOINC", ULonglong(), NOT_NULL),
#define SYS_TABLESTATS_TABLE_REF_COUNT 8
- {STRUCT_FLD(field_name, "REF_COUNT"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
- END_OF_ST_FIELD_INFO
+ Column("REF_COUNT", SLong(), NOT_NULL),
+
+ CEnd()
};
+} // namespace Show
/** Populate information_schema.innodb_sys_tablestats table with information
from SYS_TABLES.
@@ -6265,10 +5221,9 @@ i_s_dict_fill_sys_tablestats(
rw_lock_s_lock(&table->stats_latch);
- if (table->stat_initialized) {
- OK(field_store_string(fields[SYS_TABLESTATS_INIT],
- "Initialized"));
+ OK(fields[SYS_TABLESTATS_INIT]->store(table->stat_initialized, true));
+ if (table->stat_initialized) {
OK(fields[SYS_TABLESTATS_NROW]->store(table->stat_n_rows,
true));
@@ -6281,9 +5236,6 @@ i_s_dict_fill_sys_tablestats(
OK(fields[SYS_TABLESTATS_MODIFIED]->store(
table->stat_modified_counter, true));
} else {
- OK(field_store_string(fields[SYS_TABLESTATS_INIT],
- "Uninitialized"));
-
OK(fields[SYS_TABLESTATS_NROW]->store(0, true));
OK(fields[SYS_TABLESTATS_CLUST_SIZE]->store(0, true));
@@ -6399,7 +5351,7 @@ innodb_sys_tablestats_init(
schema = (ST_SCHEMA_TABLE*) p;
- schema->fields_info = innodb_sys_tablestats_fields_info;
+ schema->fields_info = Show::innodb_sys_tablestats_fields_info;
schema->fill_table = i_s_sys_tables_fill_table_stats;
DBUG_RETURN(0);
@@ -6454,84 +5406,38 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_tablestats =
STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE),
};
+namespace Show {
/** SYS_INDEXES **************************************************/
/* Fields of the dynamic table INFORMATION_SCHEMA.SYS_INDEXES */
static ST_FIELD_INFO innodb_sysindex_fields_info[] =
{
#define SYS_INDEX_ID 0
- {STRUCT_FLD(field_name, "INDEX_ID"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("INDEX_ID", ULonglong(), NOT_NULL),
#define SYS_INDEX_NAME 1
- {STRUCT_FLD(field_name, "NAME"),
- STRUCT_FLD(field_length, NAME_LEN + 1),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("NAME", Varchar(NAME_CHAR_LEN), NOT_NULL),
#define SYS_INDEX_TABLE_ID 2
- {STRUCT_FLD(field_name, "TABLE_ID"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("TABLE_ID", ULonglong(), NOT_NULL),
#define SYS_INDEX_TYPE 3
- {STRUCT_FLD(field_name, "TYPE"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("TYPE", SLong(), NOT_NULL),
#define SYS_INDEX_NUM_FIELDS 4
- {STRUCT_FLD(field_name, "N_FIELDS"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("N_FIELDS", SLong(), NOT_NULL),
#define SYS_INDEX_PAGE_NO 5
- {STRUCT_FLD(field_name, "PAGE_NO"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("PAGE_NO", SLong(), NOT_NULL),
#define SYS_INDEX_SPACE 6
- {STRUCT_FLD(field_name, "SPACE"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("SPACE", SLong(), NOT_NULL),
#define SYS_INDEX_MERGE_THRESHOLD 7
- {STRUCT_FLD(field_name, "MERGE_THRESHOLD"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
- END_OF_ST_FIELD_INFO
+ Column("MERGE_THRESHOLD", SLong(), NOT_NULL),
+
+ CEnd()
};
+} // namespace Show
/**********************************************************************//**
Function to populate the information_schema.innodb_sys_indexes table with
@@ -6684,7 +5590,7 @@ innodb_sys_indexes_init(
schema = (ST_SCHEMA_TABLE*) p;
- schema->fields_info = innodb_sysindex_fields_info;
+ schema->fields_info = Show::innodb_sysindex_fields_info;
schema->fill_table = i_s_sys_indexes_fill_table;
DBUG_RETURN(0);
@@ -6739,66 +5645,32 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_indexes =
STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE),
};
+namespace Show {
/** SYS_COLUMNS **************************************************/
/* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_SYS_COLUMNS */
static ST_FIELD_INFO innodb_sys_columns_fields_info[] =
{
#define SYS_COLUMN_TABLE_ID 0
- {STRUCT_FLD(field_name, "TABLE_ID"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("TABLE_ID", ULonglong(), NOT_NULL),
#define SYS_COLUMN_NAME 1
- {STRUCT_FLD(field_name, "NAME"),
- STRUCT_FLD(field_length, NAME_LEN + 1),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("NAME", Varchar(NAME_CHAR_LEN), NOT_NULL),
#define SYS_COLUMN_POSITION 2
- {STRUCT_FLD(field_name, "POS"),
- 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)},
+ Column("POS", ULonglong(), NOT_NULL),
#define SYS_COLUMN_MTYPE 3
- {STRUCT_FLD(field_name, "MTYPE"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("MTYPE", SLong(), NOT_NULL),
#define SYS_COLUMN__PRTYPE 4
- {STRUCT_FLD(field_name, "PRTYPE"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("PRTYPE", SLong(), NOT_NULL),
#define SYS_COLUMN_COLUMN_LEN 5
- {STRUCT_FLD(field_name, "LEN"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
- END_OF_ST_FIELD_INFO
+ Column("LEN", SLong(), NOT_NULL),
+
+ CEnd()
};
+} // namespace Show
/**********************************************************************//**
Function to populate the information_schema.innodb_sys_columns with
@@ -6930,7 +5802,7 @@ innodb_sys_columns_init(
schema = (ST_SCHEMA_TABLE*) p;
- schema->fields_info = innodb_sys_columns_fields_info;
+ schema->fields_info = Show::innodb_sys_columns_fields_info;
schema->fill_table = i_s_sys_columns_fill_table;
DBUG_RETURN(0);
@@ -6985,39 +5857,23 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_columns =
STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE),
};
+namespace Show {
/** SYS_VIRTUAL **************************************************/
/** Fields of the dynamic table INFORMATION_SCHEMA.INNODB_SYS_VIRTUAL */
static ST_FIELD_INFO innodb_sys_virtual_fields_info[] =
{
#define SYS_VIRTUAL_TABLE_ID 0
- {STRUCT_FLD(field_name, "TABLE_ID"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("TABLE_ID", ULonglong(), NOT_NULL),
#define SYS_VIRTUAL_POS 1
- {STRUCT_FLD(field_name, "POS"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("POS", ULong(), NOT_NULL),
#define SYS_VIRTUAL_BASE_POS 2
- {STRUCT_FLD(field_name, "BASE_POS"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- 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
+ Column("BASE_POS", ULong(), NOT_NULL),
+
+ CEnd()
};
+} // namespace Show
/** Function to populate the information_schema.innodb_sys_virtual with
related information
@@ -7133,7 +5989,7 @@ innodb_sys_virtual_init(
schema = (ST_SCHEMA_TABLE*) p;
- schema->fields_info = innodb_sys_virtual_fields_info;
+ schema->fields_info = Show::innodb_sys_virtual_fields_info;
schema->fill_table = i_s_sys_virtual_fill_table;
DBUG_RETURN(0);
@@ -7187,39 +6043,25 @@ struct st_maria_plugin i_s_innodb_sys_virtual =
STRUCT_FLD(version_info, INNODB_VERSION_STR),
STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE),
};
+
+
+namespace Show {
/** SYS_FIELDS ***************************************************/
/* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_SYS_FIELDS */
static ST_FIELD_INFO innodb_sys_fields_fields_info[] =
{
#define SYS_FIELD_INDEX_ID 0
- {STRUCT_FLD(field_name, "INDEX_ID"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("INDEX_ID", ULonglong(), NOT_NULL),
#define SYS_FIELD_NAME 1
- {STRUCT_FLD(field_name, "NAME"),
- STRUCT_FLD(field_length, NAME_LEN + 1),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("NAME", Varchar(NAME_CHAR_LEN), NOT_NULL),
#define SYS_FIELD_POS 2
- {STRUCT_FLD(field_name, "POS"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- 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
+ Column("POS", ULong(), NOT_NULL),
+
+ CEnd()
};
+} // namespace Show
/**********************************************************************//**
Function to fill information_schema.innodb_sys_fields with information
@@ -7342,7 +6184,7 @@ innodb_sys_fields_init(
schema = (ST_SCHEMA_TABLE*) p;
- schema->fields_info = innodb_sys_fields_fields_info;
+ schema->fields_info = Show::innodb_sys_fields_fields_info;
schema->fill_table = i_s_sys_fields_fill_table;
DBUG_RETURN(0);
@@ -7397,57 +6239,29 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_fields =
STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE),
};
+namespace Show {
/** SYS_FOREIGN ********************************************/
/* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_SYS_FOREIGN */
static ST_FIELD_INFO innodb_sys_foreign_fields_info[] =
{
#define SYS_FOREIGN_ID 0
- {STRUCT_FLD(field_name, "ID"),
- STRUCT_FLD(field_length, NAME_LEN + 1),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("ID", Varchar(NAME_LEN + 1), NOT_NULL),
#define SYS_FOREIGN_FOR_NAME 1
- {STRUCT_FLD(field_name, "FOR_NAME"),
- STRUCT_FLD(field_length, NAME_LEN + 1),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("FOR_NAME", Varchar(NAME_LEN + 1), NOT_NULL),
#define SYS_FOREIGN_REF_NAME 2
- {STRUCT_FLD(field_name, "REF_NAME"),
- STRUCT_FLD(field_length, NAME_LEN + 1),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("REF_NAME", Varchar(NAME_LEN + 1), NOT_NULL),
#define SYS_FOREIGN_NUM_COL 3
- {STRUCT_FLD(field_name, "N_COLS"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("N_COLS", ULong(), NOT_NULL),
#define SYS_FOREIGN_TYPE 4
- {STRUCT_FLD(field_name, "TYPE"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- 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
+ Column("TYPE", ULong(), NOT_NULL),
+
+ CEnd()
};
+} // namespace Show
/**********************************************************************//**
Function to fill information_schema.innodb_sys_foreign with information
@@ -7567,7 +6381,7 @@ innodb_sys_foreign_init(
schema = (ST_SCHEMA_TABLE*) p;
- schema->fields_info = innodb_sys_foreign_fields_info;
+ schema->fields_info = Show::innodb_sys_foreign_fields_info;
schema->fill_table = i_s_sys_foreign_fill_table;
DBUG_RETURN(0);
@@ -7622,48 +6436,26 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_foreign =
STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE),
};
+namespace Show {
/** SYS_FOREIGN_COLS ********************************************/
/* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS */
static ST_FIELD_INFO innodb_sys_foreign_cols_fields_info[] =
{
#define SYS_FOREIGN_COL_ID 0
- {STRUCT_FLD(field_name, "ID"),
- STRUCT_FLD(field_length, NAME_LEN + 1),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("ID", Varchar(NAME_LEN + 1), NOT_NULL),
#define SYS_FOREIGN_COL_FOR_NAME 1
- {STRUCT_FLD(field_name, "FOR_COL_NAME"),
- STRUCT_FLD(field_length, NAME_LEN + 1),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("FOR_COL_NAME", Varchar(NAME_CHAR_LEN), NOT_NULL),
#define SYS_FOREIGN_COL_REF_NAME 2
- {STRUCT_FLD(field_name, "REF_COL_NAME"),
- STRUCT_FLD(field_length, NAME_LEN + 1),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("REF_COL_NAME", Varchar(NAME_CHAR_LEN), NOT_NULL),
#define SYS_FOREIGN_COL_POS 3
- {STRUCT_FLD(field_name, "POS"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- 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
+ Column("POS", ULong(), NOT_NULL),
+
+ CEnd()
};
+} // namespace Show
/**********************************************************************//**
Function to fill information_schema.innodb_sys_foreign_cols with information
@@ -7784,7 +6576,7 @@ innodb_sys_foreign_cols_init(
schema = (ST_SCHEMA_TABLE*) p;
- schema->fields_info = innodb_sys_foreign_cols_fields_info;
+ schema->fields_info = Show::innodb_sys_foreign_cols_fields_info;
schema->fill_table = i_s_sys_foreign_cols_fill_table;
DBUG_RETURN(0);
@@ -7839,103 +6631,41 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_foreign_cols =
STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE),
};
+namespace Show {
/** SYS_TABLESPACES ********************************************/
/* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES */
static ST_FIELD_INFO innodb_sys_tablespaces_fields_info[] =
{
#define SYS_TABLESPACES_SPACE 0
- {STRUCT_FLD(field_name, "SPACE"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("SPACE", ULong(), NOT_NULL),
#define SYS_TABLESPACES_NAME 1
- {STRUCT_FLD(field_name, "NAME"),
- STRUCT_FLD(field_length, MAX_FULL_NAME_LEN + 1),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("NAME", Varchar(MAX_FULL_NAME_LEN + 1), NOT_NULL),
#define SYS_TABLESPACES_FLAGS 2
- {STRUCT_FLD(field_name, "FLAG"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("FLAG", ULong(), NOT_NULL),
#define SYS_TABLESPACES_ROW_FORMAT 3
- {STRUCT_FLD(field_name, "ROW_FORMAT"),
- STRUCT_FLD(field_length, 22),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("ROW_FORMAT", Varchar(22), NULLABLE),
#define SYS_TABLESPACES_PAGE_SIZE 4
- {STRUCT_FLD(field_name, "PAGE_SIZE"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("PAGE_SIZE", ULong(), NOT_NULL),
#define SYS_TABLESPACES_ZIP_PAGE_SIZE 5
- {STRUCT_FLD(field_name, "ZIP_PAGE_SIZE"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
-#define SYS_TABLESPACES_SPACE_TYPE 6
- {STRUCT_FLD(field_name, "SPACE_TYPE"),
- STRUCT_FLD(field_length, 10),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
-#define SYS_TABLESPACES_FS_BLOCK_SIZE 7
- {STRUCT_FLD(field_name, "FS_BLOCK_SIZE"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
-#define SYS_TABLESPACES_FILE_SIZE 8
- {STRUCT_FLD(field_name, "FILE_SIZE"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
-#define SYS_TABLESPACES_ALLOC_SIZE 9
- {STRUCT_FLD(field_name, "ALLOCATED_SIZE"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
- END_OF_ST_FIELD_INFO
+ Column("ZIP_PAGE_SIZE", ULong(), NOT_NULL),
+#define SYS_TABLESPACES_FS_BLOCK_SIZE 6
+ Column("FS_BLOCK_SIZE", ULong(),NOT_NULL),
+
+#define SYS_TABLESPACES_FILE_SIZE 7
+ Column("FILE_SIZE", ULonglong(), NOT_NULL),
+
+#define SYS_TABLESPACES_ALLOC_SIZE 8
+ Column("ALLOCATED_SIZE", ULonglong(), NOT_NULL),
+
+ CEnd()
};
+} // namespace Show
/**********************************************************************//**
Function to fill INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES with information
@@ -7946,7 +6676,7 @@ int
i_s_dict_fill_sys_tablespaces(
/*==========================*/
THD* thd, /*!< in: thread */
- ulint space, /*!< in: space ID */
+ uint32_t space, /*!< in: space ID */
const char* name, /*!< in: tablespace name */
ulint flags, /*!< in: tablespace flags */
TABLE* table_to_fill) /*!< in/out: fill this table */
@@ -7979,10 +6709,6 @@ i_s_dict_fill_sys_tablespaces(
OK(field_store_string(fields[SYS_TABLESPACES_ROW_FORMAT], row_format));
- OK(field_store_string(fields[SYS_TABLESPACES_SPACE_TYPE],
- is_system_tablespace(space)
- ? "System" : "Single"));
-
ulint cflags = fil_space_t::is_valid_flags(flags, space)
? flags : fsp_flags_convert_from_101(flags);
if (cflags == ULINT_UNDEFINED) {
@@ -8098,7 +6824,7 @@ i_s_sys_tablespaces_fill_table(
rec = dict_getnext_system(&pcur, &mtr)) {
const char* err_msg;
- ulint space;
+ uint32_t space;
const char* name;
ulint flags;
@@ -8147,7 +6873,7 @@ innodb_sys_tablespaces_init(
schema = (ST_SCHEMA_TABLE*) p;
- schema->fields_info = innodb_sys_tablespaces_fields_info;
+ schema->fields_info = Show::innodb_sys_tablespaces_fields_info;
schema->fill_table = i_s_sys_tablespaces_fill_table;
DBUG_RETURN(0);
@@ -8202,30 +6928,20 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_tablespaces =
STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE),
};
+namespace Show {
/** SYS_DATAFILES ************************************************/
/* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_SYS_DATAFILES */
static ST_FIELD_INFO innodb_sys_datafiles_fields_info[] =
{
#define SYS_DATAFILES_SPACE 0
- {STRUCT_FLD(field_name, "SPACE"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("SPACE", ULong(), NOT_NULL),
#define SYS_DATAFILES_PATH 1
- {STRUCT_FLD(field_name, "PATH"),
- STRUCT_FLD(field_length, OS_FILE_MAX_PATH),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
- END_OF_ST_FIELD_INFO
+ Column("PATH", Varchar(OS_FILE_MAX_PATH), NOT_NULL),
+
+ CEnd()
};
+} // namespace Show
/**********************************************************************//**
Function to fill INFORMATION_SCHEMA.INNODB_SYS_DATAFILES with information
@@ -8236,7 +6952,7 @@ int
i_s_dict_fill_sys_datafiles(
/*========================*/
THD* thd, /*!< in: thread */
- ulint space, /*!< in: space ID */
+ uint32_t space, /*!< in: space ID */
const char* path, /*!< in: absolute path */
TABLE* table_to_fill) /*!< in/out: fill this table */
{
@@ -8246,7 +6962,7 @@ i_s_dict_fill_sys_datafiles(
fields = table_to_fill->field;
- OK(field_store_ulint(fields[SYS_DATAFILES_SPACE], space));
+ OK(fields[SYS_DATAFILES_SPACE]->store(space, true));
OK(field_store_string(fields[SYS_DATAFILES_PATH], path));
@@ -8288,7 +7004,7 @@ i_s_sys_datafiles_fill_table(
while (rec) {
const char* err_msg;
- ulint space;
+ uint32_t space;
const char* path;
/* Extract necessary information from a SYS_DATAFILES row */
@@ -8336,7 +7052,7 @@ innodb_sys_datafiles_init(
schema = (ST_SCHEMA_TABLE*) p;
- schema->fields_info = innodb_sys_datafiles_fields_info;
+ schema->fields_info = Show::innodb_sys_datafiles_fields_info;
schema->fill_table = i_s_sys_datafiles_fill_table;
DBUG_RETURN(0);
@@ -8391,102 +7107,44 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_datafiles =
STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE),
};
+namespace Show {
/** TABLESPACES_ENCRYPTION ********************************************/
/* Fields of the table INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION */
static ST_FIELD_INFO innodb_tablespaces_encryption_fields_info[] =
{
#define TABLESPACES_ENCRYPTION_SPACE 0
- {STRUCT_FLD(field_name, "SPACE"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("SPACE", ULong(), NOT_NULL),
#define TABLESPACES_ENCRYPTION_NAME 1
- {STRUCT_FLD(field_name, "NAME"),
- STRUCT_FLD(field_length, MAX_FULL_NAME_LEN + 1),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("NAME", Varchar(MAX_FULL_NAME_LEN + 1), NULLABLE),
#define TABLESPACES_ENCRYPTION_ENCRYPTION_SCHEME 2
- {STRUCT_FLD(field_name, "ENCRYPTION_SCHEME"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("ENCRYPTION_SCHEME", ULong(), NOT_NULL),
#define TABLESPACES_ENCRYPTION_KEYSERVER_REQUESTS 3
- {STRUCT_FLD(field_name, "KEYSERVER_REQUESTS"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("KEYSERVER_REQUESTS", ULong(), NOT_NULL),
#define TABLESPACES_ENCRYPTION_MIN_KEY_VERSION 4
- {STRUCT_FLD(field_name, "MIN_KEY_VERSION"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("MIN_KEY_VERSION", ULong(), NOT_NULL),
#define TABLESPACES_ENCRYPTION_CURRENT_KEY_VERSION 5
- {STRUCT_FLD(field_name, "CURRENT_KEY_VERSION"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("CURRENT_KEY_VERSION", ULong(), NOT_NULL),
#define TABLESPACES_ENCRYPTION_KEY_ROTATION_PAGE_NUMBER 6
- {STRUCT_FLD(field_name, "KEY_ROTATION_PAGE_NUMBER"),
- 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 | MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("KEY_ROTATION_PAGE_NUMBER", ULonglong(), NULLABLE),
#define TABLESPACES_ENCRYPTION_KEY_ROTATION_MAX_PAGE_NUMBER 7
- {STRUCT_FLD(field_name, "KEY_ROTATION_MAX_PAGE_NUMBER"),
- 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 | MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("KEY_ROTATION_MAX_PAGE_NUMBER", ULonglong(), NULLABLE),
#define TABLESPACES_ENCRYPTION_CURRENT_KEY_ID 8
- {STRUCT_FLD(field_name, "CURRENT_KEY_ID"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("CURRENT_KEY_ID", ULong(), NOT_NULL),
#define TABLESPACES_ENCRYPTION_ROTATING_OR_FLUSHING 9
- {STRUCT_FLD(field_name, "ROTATING_OR_FLUSHING"),
- STRUCT_FLD(field_length, 1),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- 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
+ Column("ROTATING_OR_FLUSHING", SLong(1), NOT_NULL),
+
+ CEnd()
};
+} // namespace Show
/**********************************************************************//**
Function to fill INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION
@@ -8533,7 +7191,7 @@ i_s_dict_fill_tablespaces_encryption(
OK(fields[TABLESPACES_ENCRYPTION_CURRENT_KEY_ID]->store(
status.key_id, true));
OK(fields[TABLESPACES_ENCRYPTION_ROTATING_OR_FLUSHING]->store(
- status.rotating || status.flushing, true));
+ status.rotating || status.flushing, true));
if (status.rotating) {
fields[TABLESPACES_ENCRYPTION_KEY_ROTATION_PAGE_NUMBER]->set_notnull();
@@ -8611,7 +7269,7 @@ innodb_tablespaces_encryption_init(
schema = (ST_SCHEMA_TABLE*) p;
- schema->fields_info = innodb_tablespaces_encryption_fields_info;
+ schema->fields_info = Show::innodb_tablespaces_encryption_fields_info;
schema->fill_table = i_s_tablespaces_encryption_fill_table;
DBUG_RETURN(0);
@@ -8666,93 +7324,41 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_tablespaces_encryption =
STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE)
};
+namespace Show {
/** TABLESPACES_SCRUBBING ********************************************/
/* Fields of the table INFORMATION_SCHEMA.INNODB_TABLESPACES_SCRUBBING */
static ST_FIELD_INFO innodb_tablespaces_scrubbing_fields_info[] =
{
#define TABLESPACES_SCRUBBING_SPACE 0
- {STRUCT_FLD(field_name, "SPACE"),
- 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)},
+ Column("SPACE", ULonglong(), NOT_NULL),
#define TABLESPACES_SCRUBBING_NAME 1
- {STRUCT_FLD(field_name, "NAME"),
- STRUCT_FLD(field_length, MAX_FULL_NAME_LEN + 1),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("NAME", Varchar(MAX_FULL_NAME_LEN + 1), NULLABLE),
#define TABLESPACES_SCRUBBING_COMPRESSED 2
- {STRUCT_FLD(field_name, "COMPRESSED"),
- STRUCT_FLD(field_length, 1),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("COMPRESSED", ULong(1), NOT_NULL),
#define TABLESPACES_SCRUBBING_LAST_SCRUB_COMPLETED 3
- {STRUCT_FLD(field_name, "LAST_SCRUB_COMPLETED"),
- STRUCT_FLD(field_length, 0),
- STRUCT_FLD(field_type, MYSQL_TYPE_DATETIME),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("LAST_SCRUB_COMPLETED", Datetime(0), NULLABLE),
#define TABLESPACES_SCRUBBING_CURRENT_SCRUB_STARTED 4
- {STRUCT_FLD(field_name, "CURRENT_SCRUB_STARTED"),
- STRUCT_FLD(field_length, 0),
- STRUCT_FLD(field_type, MYSQL_TYPE_DATETIME),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("CURRENT_SCRUB_STARTED", Datetime(0), NULLABLE),
#define TABLESPACES_SCRUBBING_CURRENT_SCRUB_ACTIVE_THREADS 5
- {STRUCT_FLD(field_name, "CURRENT_SCRUB_ACTIVE_THREADS"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("CURRENT_SCRUB_ACTIVE_THREADS", ULong(), NULLABLE),
#define TABLESPACES_SCRUBBING_CURRENT_SCRUB_PAGE_NUMBER 6
- {STRUCT_FLD(field_name, "CURRENT_SCRUB_PAGE_NUMBER"),
- 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)},
+ Column("CURRENT_SCRUB_PAGE_NUMBER", ULonglong(),NOT_NULL),
#define TABLESPACES_SCRUBBING_CURRENT_SCRUB_MAX_PAGE_NUMBER 7
- {STRUCT_FLD(field_name, "CURRENT_SCRUB_MAX_PAGE_NUMBER"),
- 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)},
+ Column("CURRENT_SCRUB_MAX_PAGE_NUMBER", ULonglong(), NOT_NULL),
#define TABLESPACES_SCRUBBING_ON_SSD 8
- {STRUCT_FLD(field_name, "ON_SSD"),
- STRUCT_FLD(field_length, 1),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- 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
+ Column("ON_SSD", ULong(1), NOT_NULL),
+
+ CEnd()
};
+} // namespace Show
/**********************************************************************//**
Function to fill INFORMATION_SCHEMA.INNODB_TABLESPACES_SCRUBBING
@@ -8885,7 +7491,7 @@ innodb_tablespaces_scrubbing_init(
schema = (ST_SCHEMA_TABLE*) p;
- schema->fields_info = innodb_tablespaces_scrubbing_fields_info;
+ schema->fields_info = Show::innodb_tablespaces_scrubbing_fields_info;
schema->fill_table = i_s_tablespaces_scrubbing_fill_table;
DBUG_RETURN(0);
@@ -8940,45 +7546,26 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_tablespaces_scrubbing =
STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE)
};
+namespace Show {
/** INNODB_MUTEXES *********************************************/
/* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_MUTEXES */
static ST_FIELD_INFO innodb_mutexes_fields_info[] =
{
#define MUTEXES_NAME 0
- {STRUCT_FLD(field_name, "NAME"),
- STRUCT_FLD(field_length, OS_FILE_MAX_PATH),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("NAME", Varchar(OS_FILE_MAX_PATH), NOT_NULL),
+
#define MUTEXES_CREATE_FILE 1
- {STRUCT_FLD(field_name, "CREATE_FILE"),
- STRUCT_FLD(field_length, OS_FILE_MAX_PATH),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("CREATE_FILE", Varchar(OS_FILE_MAX_PATH), NOT_NULL),
+
#define MUTEXES_CREATE_LINE 2
- {STRUCT_FLD(field_name, "CREATE_LINE"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("CREATE_LINE", ULong(), NOT_NULL),
+
#define MUTEXES_OS_WAITS 3
- {STRUCT_FLD(field_name, "OS_WAITS"),
- 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
+ Column("OS_WAITS", ULonglong(), NOT_NULL),
+
+ CEnd()
};
+} // namespace Show
/*******************************************************************//**
Function to populate INFORMATION_SCHEMA.INNODB_MUTEXES table.
@@ -9044,7 +7631,7 @@ i_s_innodb_mutexes_fill_table(
OK(field_store_string(fields[MUTEXES_CREATE_FILE], buf1));
OK(fields[MUTEXES_CREATE_LINE]->store(block_mutex->cline, true));
fields[MUTEXES_CREATE_LINE]->set_notnull();
- OK(field_store_ulint(fields[MUTEXES_OS_WAITS], (longlong)block_mutex_oswait_count));
+ OK(fields[MUTEXES_OS_WAITS]->store((longlong)block_mutex_oswait_count), true);
OK(schema_table_store_record(thd, tables->table));
}
@@ -9122,7 +7709,7 @@ innodb_mutexes_init(
schema = (ST_SCHEMA_TABLE*) p;
- schema->fields_info = innodb_mutexes_fields_info;
+ schema->fields_info = Show::innodb_mutexes_fields_info;
schema->fill_table = i_s_innodb_mutexes_fill_table;
DBUG_RETURN(0);
@@ -9177,192 +7764,73 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_mutexes =
STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE),
};
-/** SYS_SEMAPHORE_WAITS ************************************************/
+namespace Show {
/* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_SYS_SEMAPHORE_WAITS */
static ST_FIELD_INFO innodb_sys_semaphore_waits_fields_info[] =
{
// SYS_SEMAPHORE_WAITS_THREAD_ID 0
- {STRUCT_FLD(field_name, "THREAD_ID"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("THREAD_ID", ULonglong(), NOT_NULL),
// SYS_SEMAPHORE_WAITS_OBJECT_NAME 1
- {STRUCT_FLD(field_name, "OBJECT_NAME"),
- STRUCT_FLD(field_length, OS_FILE_MAX_PATH),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("OBJECT_NAME", Varchar(OS_FILE_MAX_PATH), NULLABLE),
// SYS_SEMAPHORE_WAITS_FILE 2
- {STRUCT_FLD(field_name, "FILE"),
- STRUCT_FLD(field_length, OS_FILE_MAX_PATH),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("FILE", Varchar(OS_FILE_MAX_PATH), NULLABLE),
// SYS_SEMAPHORE_WAITS_LINE 3
- {STRUCT_FLD(field_name, "LINE"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("LINE", ULong(), NOT_NULL),
// SYS_SEMAPHORE_WAITS_WAIT_TIME 4
- {STRUCT_FLD(field_name, "WAIT_TIME"),
- 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)},
+ Column("WAIT_TIME", ULonglong(), NOT_NULL),
// SYS_SEMAPHORE_WAITS_WAIT_OBJECT 5
- {STRUCT_FLD(field_name, "WAIT_OBJECT"),
- 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)},
+ Column("WAIT_OBJECT", ULonglong(), NOT_NULL),
// SYS_SEMAPHORE_WAITS_WAIT_TYPE 6
- {STRUCT_FLD(field_name, "WAIT_TYPE"),
- STRUCT_FLD(field_length, 16),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("WAIT_TYPE", Varchar(16), NULLABLE),
// SYS_SEMAPHORE_WAITS_HOLDER_THREAD_ID 7
- {STRUCT_FLD(field_name, "HOLDER_THREAD_ID"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("HOLDER_THREAD_ID", ULonglong(), NOT_NULL),
// SYS_SEMAPHORE_WAITS_HOLDER_FILE 8
- {STRUCT_FLD(field_name, "HOLDER_FILE"),
- STRUCT_FLD(field_length, OS_FILE_MAX_PATH),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("HOLDER_FILE", Varchar(OS_FILE_MAX_PATH), NULLABLE),
// SYS_SEMAPHORE_WAITS_HOLDER_LINE 9
- {STRUCT_FLD(field_name, "HOLDER_LINE"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("HOLDER_LINE", ULong(), NOT_NULL),
// SYS_SEMAPHORE_WAITS_CREATED_FILE 10
- {STRUCT_FLD(field_name, "CREATED_FILE"),
- STRUCT_FLD(field_length, OS_FILE_MAX_PATH),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("CREATED_FILE", Varchar(OS_FILE_MAX_PATH), NULLABLE),
// SYS_SEMAPHORE_WAITS_CREATED_LINE 11
- {STRUCT_FLD(field_name, "CREATED_LINE"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("CREATED_LINE", ULong(), NOT_NULL),
// SYS_SEMAPHORE_WAITS_WRITER_THREAD 12
- {STRUCT_FLD(field_name, "WRITER_THREAD"),
- 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)},
+ Column("WRITER_THREAD", ULonglong(), NOT_NULL),
// SYS_SEMAPHORE_WAITS_RESERVATION_MODE 13
- {STRUCT_FLD(field_name, "RESERVATION_MODE"),
- STRUCT_FLD(field_length, 16),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("RESERVATION_MODE", Varchar(16), NULLABLE),
// SYS_SEMAPHORE_WAITS_READERS 14
- {STRUCT_FLD(field_name, "READERS"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("READERS", ULong(), NOT_NULL),
// SYS_SEMAPHORE_WAITS_WAITERS_FLAG 15
- {STRUCT_FLD(field_name, "WAITERS_FLAG"),
- 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)},
+ Column("WAITERS_FLAG", ULonglong(), NOT_NULL),
// SYS_SEMAPHORE_WAITS_LOCK_WORD 16
- {STRUCT_FLD(field_name, "LOCK_WORD"),
- 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)},
+ Column("LOCK_WORD", ULonglong(), NOT_NULL),
// SYS_SEMAPHORE_WAITS_LAST_WRITER_FILE 17
- {STRUCT_FLD(field_name, "LAST_WRITER_FILE"),
- STRUCT_FLD(field_length, OS_FILE_MAX_PATH),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("LAST_WRITER_FILE", Varchar(OS_FILE_MAX_PATH), NULLABLE),
// SYS_SEMAPHORE_WAITS_LAST_WRITER_LINE 18
- {STRUCT_FLD(field_name, "LAST_WRITER_LINE"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ Column("LAST_WRITER_LINE", ULong(), NOT_NULL),
// SYS_SEMAPHORE_WAITS_OS_WAIT_COUNT 19
- {STRUCT_FLD(field_name, "OS_WAIT_COUNT"),
- STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
- 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
+ Column("OS_WAIT_COUNT", ULong(), NOT_NULL),
+
+ CEnd()
};
+} // namespace Show
@@ -9381,7 +7849,7 @@ innodb_sys_semaphore_waits_init(
schema = (ST_SCHEMA_TABLE*) p;
- schema->fields_info = innodb_sys_semaphore_waits_fields_info;
+ schema->fields_info = Show::innodb_sys_semaphore_waits_fields_info;
schema->fill_table = sync_arr_fill_sys_semphore_waits_table;
DBUG_RETURN(0);
diff --git a/storage/innobase/handler/i_s.h b/storage/innobase/handler/i_s.h
index 66404dc32b4..781041bdfd4 100644
--- a/storage/innobase/handler/i_s.h
+++ b/storage/innobase/handler/i_s.h
@@ -136,16 +136,6 @@ HPUX aCC: HP ANSI C++ B3910B A.03.65) can't handle it. */
#define SYS_SEMAPHORE_WAITS_OS_WAIT_COUNT 19
/*******************************************************************//**
-Auxiliary function to store ulint value in MYSQL_TYPE_LONGLONG field.
-If the value is ULINT_UNDEFINED then the field it set to NULL.
-@return 0 on success */
-int
-field_store_ulint(
-/*==============*/
- Field* field, /*!< in/out: target field for storage */
- ulint n); /*!< in: value to store */
-
-/*******************************************************************//**
Auxiliary function to store char* value in MYSQL_TYPE_STRING field.
@return 0 on success */
int
diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc
index 6e307f0c23a..460359a96b4 100644
--- a/storage/innobase/ibuf/ibuf0ibuf.cc
+++ b/storage/innobase/ibuf/ibuf0ibuf.cc
@@ -28,10 +28,6 @@ Created 7/19/1997 Heikki Tuuri
#include "sync0sync.h"
#include "btr0sea.h"
-#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
-my_bool srv_ibuf_disable_background_merge;
-#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
-
/** Number of bits describing a single page */
#define IBUF_BITS_PER_PAGE 4
/** The start address for an insert buffer bitmap page bitmap */
@@ -190,7 +186,7 @@ uint ibuf_debug;
#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
/** The insert buffer control structure */
-ibuf_t* ibuf = NULL;
+ibuf_t ibuf;
/** @name Offsets to the per-page bits in the insert buffer bitmap */
/* @{ */
@@ -257,17 +253,7 @@ const ulint IBUF_MERGE_THRESHOLD = 4;
batch, in order to merge the entries for them in the insert buffer */
const ulint IBUF_MAX_N_PAGES_MERGED = IBUF_MERGE_AREA;
-/** If the combined size of the ibuf trees exceeds ibuf->max_size by this
-many pages, we start to contract it in connection to inserts there, using
-non-synchronous contract */
-const ulint IBUF_CONTRACT_ON_INSERT_NON_SYNC = 0;
-
-/** If the combined size of the ibuf trees exceeds ibuf->max_size by this
-many pages, we start to contract it in connection to inserts there, using
-synchronous contract */
-const ulint IBUF_CONTRACT_ON_INSERT_SYNC = 5;
-
-/** If the combined size of the ibuf trees exceeds ibuf->max_size by
+/** If the combined size of the ibuf trees exceeds ibuf.max_size by
this many pages, we start to contract it synchronous contract, but do
not insert */
const ulint IBUF_CONTRACT_DO_NOT_INSERT = 10;
@@ -359,7 +345,7 @@ ibuf_tree_root_get(
ut_ad(ibuf_inside(mtr));
ut_ad(mutex_own(&ibuf_mutex));
- mtr_sx_lock(dict_index_get_lock(ibuf->index), mtr);
+ mtr_sx_lock(dict_index_get_lock(ibuf.index), mtr);
/* only segment list access is exclusive each other */
block = buf_page_get(
@@ -372,7 +358,7 @@ ibuf_tree_root_get(
ut_ad(page_get_space_id(root) == IBUF_SPACE_ID);
ut_ad(page_get_page_no(root) == FSP_IBUF_TREE_ROOT_PAGE_NO);
- ut_ad(ibuf->empty == page_is_empty(root));
+ ut_ad(ibuf.empty == page_is_empty(root));
return(root);
}
@@ -383,7 +369,7 @@ void
ibuf_close(void)
/*============*/
{
- if (ibuf == NULL) {
+ if (!ibuf.index) {
return;
}
@@ -393,13 +379,11 @@ ibuf_close(void)
mutex_free(&ibuf_bitmap_mutex);
- dict_table_t* ibuf_table = ibuf->index->table;
- rw_lock_free(&ibuf->index->lock);
- dict_mem_index_free(ibuf->index);
+ dict_table_t* ibuf_table = ibuf.index->table;
+ rw_lock_free(&ibuf.index->lock);
+ dict_mem_index_free(ibuf.index);
dict_mem_table_free(ibuf_table);
-
- ut_free(ibuf);
- ibuf = NULL;
+ ibuf.index = NULL;
}
/******************************************************************//**
@@ -413,13 +397,13 @@ ibuf_size_update(
{
ut_ad(mutex_own(&ibuf_mutex));
- ibuf->free_list_len = flst_get_len(root + PAGE_HEADER
+ ibuf.free_list_len = flst_get_len(root + PAGE_HEADER
+ PAGE_BTR_IBUF_FREE_LIST);
- ibuf->height = 1 + btr_page_get_level(root);
+ ibuf.height = 1 + btr_page_get_level(root);
/* the '1 +' is the ibuf header page */
- ibuf->size = ibuf->seg_size - (1 + ibuf->free_list_len);
+ ibuf.size = ibuf.seg_size - (1 + ibuf.free_list_len);
}
/******************************************************************//**
@@ -431,19 +415,28 @@ ibuf_init_at_db_start(void)
/*=======================*/
{
page_t* root;
- mtr_t mtr;
ulint n_used;
page_t* header_page;
- dberr_t error= DB_SUCCESS;
- ibuf = static_cast<ibuf_t*>(ut_zalloc_nokey(sizeof(ibuf_t)));
+ ut_ad(!ibuf.index);
+ mtr_t mtr;
+ mtr.start();
+ compile_time_assert(IBUF_SPACE_ID == TRX_SYS_SPACE);
+ compile_time_assert(IBUF_SPACE_ID == 0);
+ mtr_x_lock(&fil_system.sys_space->latch, &mtr);
+ header_page = ibuf_header_page_get(&mtr);
+
+ if (!header_page) {
+ mtr.commit();
+ return DB_DECRYPTION_FAILED;
+ }
/* At startup we intialize ibuf to have a maximum of
CHANGE_BUFFER_DEFAULT_SIZE in terms of percentage of the
buffer pool size. Once ibuf struct is initialized this
value is updated with the user supplied size by calling
ibuf_max_size_update(). */
- ibuf->max_size = ((buf_pool_get_curr_size() >> srv_page_size_shift)
+ ibuf.max_size = ((buf_pool_get_curr_size() >> srv_page_size_shift)
* CHANGE_BUFFER_DEFAULT_SIZE) / 100;
mutex_create(LATCH_ID_IBUF, &ibuf_mutex);
@@ -453,26 +446,14 @@ ibuf_init_at_db_start(void)
mutex_create(LATCH_ID_IBUF_PESSIMISTIC_INSERT,
&ibuf_pessimistic_insert_mutex);
- mtr_start(&mtr);
-
- compile_time_assert(IBUF_SPACE_ID == TRX_SYS_SPACE);
- compile_time_assert(IBUF_SPACE_ID == 0);
- mtr_x_lock(&fil_system.sys_space->latch, &mtr);
-
mutex_enter(&ibuf_mutex);
- header_page = ibuf_header_page_get(&mtr);
-
- if (!header_page) {
- return (DB_DECRYPTION_FAILED);
- }
-
fseg_n_reserved_pages(header_page + IBUF_HEADER + IBUF_TREE_SEG_HEADER,
&n_used, &mtr);
ut_ad(n_used >= 2);
- ibuf->seg_size = n_used;
+ ibuf.seg_size = n_used;
{
buf_block_t* block;
@@ -489,24 +470,24 @@ ibuf_init_at_db_start(void)
ibuf_size_update(root);
mutex_exit(&ibuf_mutex);
- ibuf->empty = page_is_empty(root);
+ ibuf.empty = page_is_empty(root);
mtr.commit();
- ibuf->index = dict_mem_index_create(
+ ibuf.index = dict_mem_index_create(
dict_mem_table_create("innodb_change_buffer",
fil_system.sys_space, 1, 0, 0, 0),
"CLUST_IND",
DICT_CLUSTERED | DICT_IBUF, 1);
- ibuf->index->id = DICT_IBUF_ID_MIN + IBUF_SPACE_ID;
- ibuf->index->n_uniq = REC_MAX_N_FIELDS;
- rw_lock_create(index_tree_rw_lock_key, &ibuf->index->lock,
+ ibuf.index->id = DICT_IBUF_ID_MIN + IBUF_SPACE_ID;
+ ibuf.index->n_uniq = REC_MAX_N_FIELDS;
+ rw_lock_create(index_tree_rw_lock_key, &ibuf.index->lock,
SYNC_IBUF_INDEX_TREE);
#ifdef BTR_CUR_ADAPT
- ibuf->index->search_info = btr_search_info_create(ibuf->index->heap);
+ ibuf.index->search_info = btr_search_info_create(ibuf.index->heap);
#endif /* BTR_CUR_ADAPT */
- ibuf->index->page = FSP_IBUF_TREE_ROOT_PAGE_NO;
- ut_d(ibuf->index->cached = TRUE);
- return (error);
+ ibuf.index->page = FSP_IBUF_TREE_ROOT_PAGE_NO;
+ ut_d(ibuf.index->cached = TRUE);
+ return DB_SUCCESS;
}
/*********************************************************************//**
@@ -520,7 +501,7 @@ ibuf_max_size_update(
ulint new_size = ((buf_pool_get_curr_size() >> srv_page_size_shift)
* new_val) / 100;
mutex_enter(&ibuf_mutex);
- ibuf->max_size = new_size;
+ ibuf.max_size = new_size;
mutex_exit(&ibuf_mutex);
}
@@ -706,9 +687,9 @@ ibuf_bitmap_get_map_page_func(
buf_block_t* block = NULL;
dberr_t err = DB_SUCCESS;
- block = buf_page_get_gen(ibuf_bitmap_page_no_calc(page_id, zip_size),
- zip_size, RW_X_LATCH, NULL, BUF_GET,
- file, line, mtr, &err);
+ block = buf_page_get_gen(
+ ibuf_bitmap_page_no_calc(page_id, zip_size),
+ zip_size, RW_X_LATCH, NULL, BUF_GET, file, line, mtr, &err);
if (err != DB_SUCCESS) {
return NULL;
@@ -896,7 +877,7 @@ ibuf_update_free_bits_low(
ulint before;
ulint after;
- ut_a(!buf_block_get_page_zip(block));
+ ut_a(!is_buf_block_get_page_zip(block));
ut_ad(mtr->is_named_space(block->page.id.space()));
before = ibuf_index_page_calc_free_bits(srv_page_size,
@@ -1872,7 +1853,7 @@ static inline bool ibuf_data_enough_free_for_insert()
inserts buffered for pages that we read to the buffer pool, without
any risk of running out of free space in the insert buffer. */
- return(ibuf->free_list_len >= (ibuf->size / 2) + 3 * ibuf->height);
+ return(ibuf.free_list_len >= (ibuf.size / 2) + 3 * ibuf.height);
}
/*********************************************************************//**
@@ -1886,7 +1867,7 @@ ibuf_data_too_much_free(void)
{
ut_ad(mutex_own(&ibuf_mutex));
- return(ibuf->free_list_len >= 3 + (ibuf->size / 2) + 3 * ibuf->height);
+ return(ibuf.free_list_len >= 3 + (ibuf.size / 2) + 3 * ibuf.height);
}
/*********************************************************************//**
@@ -1947,8 +1928,8 @@ ibuf_add_free_page(void)
flst_add_last(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST,
page + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE, &mtr);
- ibuf->seg_size++;
- ibuf->free_list_len++;
+ ibuf.seg_size++;
+ ibuf.free_list_len++;
/* Set the bit indicating that this page is now an ibuf tree page
(level 2 page) */
@@ -2061,8 +2042,8 @@ ibuf_remove_free_page(void)
mutex_exit(&ibuf_pessimistic_insert_mutex);
- ibuf->seg_size--;
- ibuf->free_list_len--;
+ ibuf.seg_size--;
+ ibuf.free_list_len--;
/* Set the bit indicating that this page is no more an ibuf tree page
(level 2 page) */
@@ -2088,10 +2069,6 @@ void
ibuf_free_excess_pages(void)
/*========================*/
{
- if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) {
- return;
- }
-
/* Free at most a few pages at a time, so that we do not delay the
requested service too much */
@@ -2374,6 +2351,40 @@ ibuf_get_merge_pages(
return(volume);
}
+/** Merge the change buffer to some pages. */
+static void ibuf_read_merge_pages(const ulint* space_ids,
+ const ulint* page_nos, ulint n_stored)
+{
+ for (ulint i = 0; i < n_stored; i++) {
+ const ulint space_id = space_ids[i];
+ fil_space_t* s = fil_space_acquire_for_io(space_id);
+ if (!s) {
+tablespace_deleted:
+ /* The tablespace was not found: remove all
+ entries for it */
+ ibuf_delete_for_discarded_space(space_id);
+ while (i + 1 < n_stored
+ && space_ids[i + 1] == space_id) {
+ i++;
+ }
+ continue;
+ }
+
+ const ulint zip_size = s->zip_size();
+ s->release_for_io();
+ mtr_t mtr;
+ mtr.start();
+ dberr_t err;
+ buf_page_get_gen(page_id_t(space_id, page_nos[i]),
+ zip_size, RW_X_LATCH, NULL, BUF_GET,
+ __FILE__, __LINE__, &mtr, &err, true);
+ mtr.commit();
+ if (err == DB_TABLESPACE_DELETED) {
+ goto tablespace_deleted;
+ }
+ }
+}
+
/*********************************************************************//**
Contracts insert buffer trees by reading pages to the buffer pool.
@return a lower limit for the combined size in bytes of entries which
@@ -2383,10 +2394,7 @@ static
ulint
ibuf_merge_pages(
/*=============*/
- ulint* n_pages, /*!< out: number of pages to which merged */
- bool sync) /*!< in: true if the caller wants to wait for
- the issued read with the highest tablespace
- address to complete */
+ ulint* n_pages) /*!< out: number of pages to which merged */
{
mtr_t mtr;
btr_pcur_t pcur;
@@ -2402,18 +2410,18 @@ ibuf_merge_pages(
position within the leaf */
bool available;
- available = btr_pcur_open_at_rnd_pos(ibuf->index, BTR_SEARCH_LEAF,
+ available = btr_pcur_open_at_rnd_pos(ibuf.index, BTR_SEARCH_LEAF,
&pcur, &mtr);
/* No one should make this index unavailable when server is running */
ut_a(available);
- ut_ad(page_validate(btr_pcur_get_page(&pcur), ibuf->index));
+ ut_ad(page_validate(btr_pcur_get_page(&pcur), ibuf.index));
if (page_is_empty(btr_pcur_get_page(&pcur))) {
/* If a B-tree page is empty, it must be the root page
and the whole B-tree must be empty. InnoDB does not
allow empty B-tree pages other than the root. */
- ut_ad(ibuf->empty);
+ ut_ad(ibuf.empty);
ut_ad(page_get_space_id(btr_pcur_get_page(&pcur))
== IBUF_SPACE_ID);
ut_ad(page_get_page_no(btr_pcur_get_page(&pcur))
@@ -2429,15 +2437,10 @@ ibuf_merge_pages(
btr_pcur_get_rec(&pcur), &mtr,
space_ids,
page_nos, n_pages);
-#if 0 /* defined UNIV_IBUF_DEBUG */
- fprintf(stderr, "Ibuf contract sync %lu pages %lu volume %lu\n",
- sync, *n_pages, sum_sizes);
-#endif
ibuf_mtr_commit(&mtr);
btr_pcur_close(&pcur);
- buf_read_ibuf_merge_pages(
- sync, space_ids, page_nos, *n_pages);
+ ibuf_read_merge_pages(space_ids, page_nos, *n_pages);
return(sum_sizes + 1);
}
@@ -2464,12 +2467,12 @@ ibuf_merge_space(
/* Position the cursor on the first matching record. */
btr_pcur_open(
- ibuf->index, tuple, PAGE_CUR_GE, BTR_SEARCH_LEAF, &pcur,
+ ibuf.index, tuple, PAGE_CUR_GE, BTR_SEARCH_LEAF, &pcur,
&mtr);
mem_heap_free(heap);
- ut_ad(page_validate(btr_pcur_get_page(&pcur), ibuf->index));
+ ut_ad(page_validate(btr_pcur_get_page(&pcur), ibuf.index));
ulint sum_sizes = 0;
ulint pages[IBUF_MAX_N_PAGES_MERGED];
@@ -2479,7 +2482,7 @@ ibuf_merge_space(
/* If a B-tree page is empty, it must be the root page
and the whole B-tree must be empty. InnoDB does not
allow empty B-tree pages other than the root. */
- ut_ad(ibuf->empty);
+ ut_ad(ibuf.empty);
ut_ad(page_get_space_id(btr_pcur_get_page(&pcur))
== IBUF_SPACE_ID);
ut_ad(page_get_page_no(btr_pcur_get_page(&pcur))
@@ -2507,8 +2510,7 @@ ibuf_merge_space(
}
#endif /* UNIV_DEBUG */
- buf_read_ibuf_merge_pages(
- true, spaces, pages, n_pages);
+ ibuf_read_merge_pages(spaces, pages, n_pages);
}
return(n_pages);
@@ -2521,108 +2523,63 @@ the issued reads to complete
@return a lower limit for the combined size in bytes of entries which
will be merged from ibuf trees to the pages read, 0 if ibuf is
empty */
-static MY_ATTRIBUTE((warn_unused_result))
-ulint
-ibuf_merge(
- ulint* n_pages,
- bool sync)
+MY_ATTRIBUTE((warn_unused_result))
+static ulint ibuf_merge(ulint* n_pages)
{
*n_pages = 0;
- /* We perform a dirty read of ibuf->empty, without latching
+ /* We perform a dirty read of ibuf.empty, without latching
the insert buffer root page. We trust this dirty read except
when a slow shutdown is being executed. During a slow
shutdown, the insert buffer merge must be completed. */
- if (ibuf->empty && !srv_shutdown_state) {
+ if (ibuf.empty && !srv_shutdown_state) {
return(0);
#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
} else if (ibuf_debug) {
return(0);
#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
} else {
- return(ibuf_merge_pages(n_pages, sync));
+ return ibuf_merge_pages(n_pages);
}
}
/** Contract the change buffer by reading pages to the buffer pool.
-@param[in] sync whether the caller waits for
-the issued reads to complete
@return a lower limit for the combined size in bytes of entries which
will be merged from ibuf trees to the pages read, 0 if ibuf is empty */
-static
-ulint
-ibuf_contract(
- bool sync)
+static ulint ibuf_contract()
{
- ulint n_pages;
-
- return(ibuf_merge_pages(&n_pages, sync));
+ ulint n_pages;
+ return ibuf_merge_pages(&n_pages);
}
/** Contract the change buffer by reading pages to the buffer pool.
-@param[in] full If true, do a full contraction based
-on PCT_IO(100). If false, the size of contract batch is determined
-based on the current size of the change buffer.
@return a lower limit for the combined size in bytes of entries which
will be merged from ibuf trees to the pages read, 0 if ibuf is
empty */
-ulint
-ibuf_merge_in_background(
- bool full)
+ulint ibuf_merge_all()
{
- ulint sum_bytes = 0;
- ulint sum_pages = 0;
- ulint n_pag2;
- ulint n_pages;
-
-#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
- if (srv_ibuf_disable_background_merge) {
- return(0);
- }
-#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
-
- if (full) {
- /* Caller has requested a full batch */
- n_pages = PCT_IO(100);
- } else {
- /* By default we do a batch of 5% of the io_capacity */
- n_pages = PCT_IO(5);
-
- mutex_enter(&ibuf_mutex);
-
- /* If the ibuf->size is more than half the max_size
- then we make more agreesive contraction.
- +1 is to avoid division by zero. */
- if (ibuf->size > ibuf->max_size / 2) {
- ulint diff = ibuf->size - ibuf->max_size / 2;
- n_pages += PCT_IO((diff * 100)
- / (ibuf->max_size + 1));
- }
-
- mutex_exit(&ibuf_mutex);
- }
-
#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
if (ibuf_debug) {
return(0);
}
#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
- while (sum_pages < n_pages) {
- ulint n_bytes;
+ ulint sum_bytes = 0;
+ ulint n_pages = PCT_IO(100);
- n_bytes = ibuf_merge(&n_pag2, false);
+ for (ulint sum_pages = 0; sum_pages < n_pages; ) {
+ ulint n_pag2;
+ ulint n_bytes = ibuf_merge(&n_pag2);
if (n_bytes == 0) {
- return(sum_bytes);
+ break;
}
sum_bytes += n_bytes;
- sum_pages += n_pag2;
}
- return(sum_bytes);
+ return sum_bytes;
}
/*********************************************************************//**
@@ -2634,34 +2591,23 @@ ibuf_contract_after_insert(
ulint entry_size) /*!< in: size of a record which was inserted
into an ibuf tree */
{
- ibool sync;
- ulint sum_sizes;
- ulint size;
- ulint max_size;
-
- /* Perform dirty reads of ibuf->size and ibuf->max_size, to
- reduce ibuf_mutex contention. ibuf->max_size remains constant
- after ibuf_init_at_db_start(), but ibuf->size should be
- protected by ibuf_mutex. Given that ibuf->size fits in a
+ /* Perform dirty reads of ibuf.size and ibuf.max_size, to
+ reduce ibuf_mutex contention. ibuf.max_size remains constant
+ after ibuf_init_at_db_start(), but ibuf.size should be
+ protected by ibuf_mutex. Given that ibuf.size fits in a
machine word, this should be OK; at worst we are doing some
excessive ibuf_contract() or occasionally skipping a
ibuf_contract(). */
- size = ibuf->size;
- max_size = ibuf->max_size;
-
- if (size < max_size + IBUF_CONTRACT_ON_INSERT_NON_SYNC) {
+ if (ibuf.size < ibuf.max_size) {
return;
}
- sync = (size >= max_size + IBUF_CONTRACT_ON_INSERT_SYNC);
-
/* Contract at least entry_size many bytes */
- sum_sizes = 0;
- size = 1;
+ ulint sum_sizes = 0;
+ ulint size;
do {
-
- size = ibuf_contract(sync);
+ size = ibuf_contract();
sum_sizes += size;
} while (size > 0 && sum_sizes < entry_size);
}
@@ -2888,7 +2834,7 @@ ibuf_get_volume_buffered(
rec = btr_pcur_get_rec(pcur);
page = page_align(rec);
- ut_ad(page_validate(page, ibuf->index));
+ ut_ad(page_validate(page, ibuf.index));
if (page_rec_is_supremum(rec)) {
rec = page_rec_get_prev_const(rec);
@@ -2928,7 +2874,7 @@ ibuf_get_volume_buffered(
buf_block_dbg_add_level(block, SYNC_IBUF_TREE_NODE);
prev_page = buf_block_get_frame(block);
- ut_ad(page_validate(prev_page, ibuf->index));
+ ut_ad(page_validate(prev_page, ibuf.index));
}
#ifdef UNIV_BTR_DEBUG
@@ -3000,7 +2946,7 @@ count_later:
buf_block_dbg_add_level(block, SYNC_IBUF_TREE_NODE);
next_page = buf_block_get_frame(block);
- ut_ad(page_validate(next_page, ibuf->index));
+ ut_ad(page_validate(next_page, ibuf.index));
}
#ifdef UNIV_BTR_DEBUG
@@ -3046,14 +2992,14 @@ ibuf_update_max_tablespace_id(void)
btr_pcur_t pcur;
mtr_t mtr;
- ut_a(!dict_table_is_comp(ibuf->index->table));
+ ut_a(!dict_table_is_comp(ibuf.index->table));
ibuf_mtr_start(&mtr);
btr_pcur_open_at_index_side(
- false, ibuf->index, BTR_SEARCH_LEAF, &pcur, true, 0, &mtr);
+ false, ibuf.index, BTR_SEARCH_LEAF, &pcur, true, 0, &mtr);
- ut_ad(page_validate(btr_pcur_get_page(&pcur), ibuf->index));
+ ut_ad(page_validate(btr_pcur_get_page(&pcur), ibuf.index));
btr_pcur_move_to_prev(&pcur, &mtr);
@@ -3184,7 +3130,7 @@ ibuf_get_entry_counter_func(
{
ut_ad(ibuf_inside(mtr));
ut_ad(mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_X_FIX));
- ut_ad(page_validate(page_align(rec), ibuf->index));
+ ut_ad(page_validate(page_align(rec), ibuf.index));
if (page_rec_is_supremum(rec)) {
/* This is just for safety. The record should be a
@@ -3284,16 +3230,16 @@ ibuf_insert_low(
do_merge = FALSE;
- /* Perform dirty reads of ibuf->size and ibuf->max_size, to
- reduce ibuf_mutex contention. Given that ibuf->max_size and
- ibuf->size fit in a machine word, this should be OK; at worst
+ /* Perform dirty reads of ibuf.size and ibuf.max_size, to
+ reduce ibuf_mutex contention. Given that ibuf.max_size and
+ ibuf.size fit in a machine word, this should be OK; at worst
we are doing some excessive ibuf_contract() or occasionally
skipping an ibuf_contract(). */
- if (ibuf->max_size == 0) {
+ if (ibuf.max_size == 0) {
return(DB_STRONG_FAIL);
}
- if (ibuf->size >= ibuf->max_size + IBUF_CONTRACT_DO_NOT_INSERT) {
+ if (ibuf.size >= ibuf.max_size + IBUF_CONTRACT_DO_NOT_INSERT) {
/* Insert buffer is now too big, contract it but do not try
to insert */
@@ -3301,7 +3247,7 @@ ibuf_insert_low(
#ifdef UNIV_IBUF_DEBUG
fputs("Ibuf too big\n", stderr);
#endif
- ibuf_contract(true);
+ ibuf_contract();
return(DB_STRONG_FAIL);
}
@@ -3347,8 +3293,8 @@ ibuf_insert_low(
ibuf_mtr_start(&mtr);
- btr_pcur_open(ibuf->index, ibuf_entry, PAGE_CUR_LE, mode, &pcur, &mtr);
- ut_ad(page_validate(btr_pcur_get_page(&pcur), ibuf->index));
+ btr_pcur_open(ibuf.index, ibuf_entry, PAGE_CUR_LE, mode, &pcur, &mtr);
+ ut_ad(page_validate(btr_pcur_get_page(&pcur), ibuf.index));
/* Find out the volume of already buffered inserts for the same index
page */
@@ -3487,7 +3433,7 @@ fail_exit:
block = btr_cur_get_block(cursor);
ut_ad(block->page.id.space() == IBUF_SPACE_ID);
- /* If this is the root page, update ibuf->empty. */
+ /* If this is the root page, update ibuf.empty. */
if (block->page.id.page_no() == FSP_IBUF_TREE_ROOT_PAGE_NO) {
const page_t* root = buf_block_get_frame(block);
@@ -3495,7 +3441,7 @@ fail_exit:
ut_ad(page_get_page_no(root)
== FSP_IBUF_TREE_ROOT_PAGE_NO);
- ibuf->empty = page_is_empty(root);
+ ibuf.empty = page_is_empty(root);
}
} else {
ut_ad(BTR_LATCH_MODE_WITHOUT_INTENTION(mode)
@@ -3525,7 +3471,7 @@ fail_exit:
mutex_exit(&ibuf_pessimistic_insert_mutex);
ibuf_size_update(root);
mutex_exit(&ibuf_mutex);
- ibuf->empty = page_is_empty(root);
+ ibuf.empty = page_is_empty(root);
block = btr_cur_get_block(cursor);
ut_ad(block->page.id.space() == IBUF_SPACE_ID);
@@ -3556,8 +3502,7 @@ func_exit:
#ifdef UNIV_IBUF_DEBUG
ut_a(n_stored <= IBUF_MAX_N_PAGES_MERGED);
#endif
- buf_read_ibuf_merge_pages(false, space_ids,
- page_nos, n_stored);
+ ibuf_read_merge_pages(space_ids, page_nos, n_stored);
}
return(err);
@@ -3735,7 +3680,7 @@ ibuf_insert_to_index_page_low(
been attempted by page_cur_tuple_insert(). Besides, per
ibuf_index_page_calc_free_zip() the page should not have been
recompressed or reorganized. */
- ut_ad(!buf_block_get_page_zip(block));
+ ut_ad(!is_buf_block_get_page_zip(block));
/* If the record did not fit, reorganize */
@@ -4202,10 +4147,10 @@ ibuf_delete_rec(
ut_ad(page_get_page_no(root)
== FSP_IBUF_TREE_ROOT_PAGE_NO);
- /* ibuf->empty is protected by the root page latch.
+ /* ibuf.empty is protected by the root page latch.
Before the deletion, it had to be FALSE. */
- ut_ad(!ibuf->empty);
- ibuf->empty = true;
+ ut_ad(!ibuf.empty);
+ ibuf.empty = true;
}
return(FALSE);
@@ -4246,7 +4191,7 @@ ibuf_delete_rec(
ibuf_size_update(root);
mutex_exit(&ibuf_mutex);
- ibuf->empty = page_is_empty(root);
+ ibuf.empty = page_is_empty(root);
ibuf_btr_pcur_commit_specify_mtr(pcur, mtr);
func_exit:
@@ -4256,6 +4201,42 @@ func_exit:
return(TRUE);
}
+/** Check whether buffered changes exist for a page.
+@param[in,out] block page
+@return whether buffered changes exist */
+bool ibuf_page_exists(const buf_page_t& bpage)
+{
+ ut_ad(buf_page_get_io_fix(&bpage) == BUF_IO_READ
+ || recv_recovery_is_on());
+ ut_ad(!fsp_is_system_temporary(bpage.id.space()));
+ ut_ad(buf_page_in_file(&bpage));
+ ut_ad(buf_page_get_state(&bpage) != BUF_BLOCK_FILE_PAGE
+ || bpage.io_fix == BUF_IO_READ
+ || rw_lock_own(&const_cast<buf_block_t&>
+ (reinterpret_cast<const buf_block_t&>
+ (bpage)).lock, RW_LOCK_X));
+
+ const ulint physical_size = bpage.physical_size();
+
+ if (ibuf_fixed_addr_page(bpage.id, physical_size)
+ || fsp_descr_page(bpage.id, physical_size)) {
+ return false;
+ }
+
+ mtr_t mtr;
+ bool bitmap_bits = false;
+
+ ibuf_mtr_start(&mtr);
+ if (const page_t* bitmap_page = ibuf_bitmap_get_map_page(
+ bpage.id, bpage.zip_size(), &mtr)) {
+ bitmap_bits = ibuf_bitmap_page_get_bits(
+ bitmap_page, bpage.id, bpage.zip_size(),
+ IBUF_BITMAP_BUFFERED, &mtr) != 0;
+ }
+ ibuf_mtr_commit(&mtr);
+ return bitmap_bits;
+}
+
/** When an index page is read from a disk to the buffer pool, this function
applies any buffered operations to the page and deletes the entries from the
insert buffer. If the page is not read, but created in the buffer pool, this
@@ -4291,11 +4272,9 @@ ibuf_merge_or_delete_for_page(
ulint dops[IBUF_OP_COUNT];
ut_ad(block == NULL || page_id == block->page.id);
- ut_ad(block == NULL || buf_block_get_io_fix(block) == BUF_IO_READ
- || recv_recovery_is_on());
+ ut_ad(!block || buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
- if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE
- || trx_sys_hdr_page(page_id)
+ if (trx_sys_hdr_page(page_id)
|| fsp_is_system_temporary(page_id.space())) {
return;
}
@@ -4392,20 +4371,16 @@ loop:
/* Position pcur in the insert buffer at the first entry for this
index page */
btr_pcur_open_on_user_rec(
- ibuf->index, search_tuple, PAGE_CUR_GE, BTR_MODIFY_LEAF,
+ ibuf.index, search_tuple, PAGE_CUR_GE, BTR_MODIFY_LEAF,
&pcur, &mtr);
if (block != NULL) {
- ibool success;
+ ut_ad(rw_lock_own(&block->lock, RW_LOCK_X));
+ buf_block_buf_fix_inc(block, __FILE__, __LINE__);
+ rw_lock_x_lock(&block->lock);
mtr.set_named_space(space);
-
- success = buf_page_get_known_nowait(
- RW_X_LATCH, block,
- BUF_KEEP_OLD, __FILE__, __LINE__, &mtr);
-
- ut_a(success);
-
+ mtr.memo_push(block, MTR_MEMO_PAGE_X_FIX);
/* This is a user page (secondary index leaf page),
but we pretend that it is a change buffer page in
order to obey the latching order. This should be OK,
@@ -4460,7 +4435,7 @@ loop:
page_update_max_trx_id(block, page_zip, max_trx_id,
&mtr);
- ut_ad(page_validate(page_align(rec), ibuf->index));
+ ut_ad(page_validate(page_align(rec), ibuf.index));
entry = ibuf_build_entry_from_ibuf_rec(
&mtr, rec, heap, &dummy_index);
@@ -4471,7 +4446,6 @@ loop:
ut_ad(page_validate(block->frame, dummy_index));
switch (op) {
- ibool success;
case IBUF_OP_INSERT:
#ifdef UNIV_IBUF_DEBUG
volume += rec_get_converted_size(
@@ -4520,11 +4494,11 @@ loop:
ibuf_mtr_start(&mtr);
mtr.set_named_space(space);
- success = buf_page_get_known_nowait(
- RW_X_LATCH, block,
- BUF_KEEP_OLD,
- __FILE__, __LINE__, &mtr);
- ut_a(success);
+ ut_ad(rw_lock_own(&block->lock, RW_LOCK_X));
+ buf_block_buf_fix_inc(block,
+ __FILE__, __LINE__);
+ rw_lock_x_lock(&block->lock);
+ mtr.memo_push(block, MTR_MEMO_PAGE_X_FIX);
/* This is a user page (secondary
index leaf page), but it should be OK
@@ -4608,9 +4582,9 @@ reset_bit:
btr_pcur_close(&pcur);
mem_heap_free(heap);
- ibuf->n_merges++;
- ibuf_add_ops(ibuf->n_merged_ops, mops);
- ibuf_add_ops(ibuf->n_discarded_ops, dops);
+ ibuf.n_merges++;
+ ibuf_add_ops(ibuf.n_merged_ops, mops);
+ ibuf_add_ops(ibuf.n_discarded_ops, dops);
}
/** Delete all change buffer entries for a tablespace,
@@ -4642,7 +4616,7 @@ loop:
/* Position pcur in the insert buffer at the first entry for the
space */
btr_pcur_open_on_user_rec(
- ibuf->index, search_tuple, PAGE_CUR_GE, BTR_MODIFY_LEAF,
+ ibuf.index, search_tuple, PAGE_CUR_GE, BTR_MODIFY_LEAF,
&pcur, &mtr);
if (!btr_pcur_is_on_user_rec(&pcur)) {
@@ -4687,7 +4661,7 @@ leave_loop:
ibuf_mtr_commit(&mtr);
btr_pcur_close(&pcur);
- ibuf_add_ops(ibuf->n_discarded_ops, dops);
+ ibuf_add_ops(ibuf.n_discarded_ops, dops);
mem_heap_free(heap);
}
@@ -4710,7 +4684,7 @@ ibuf_is_empty(void)
mutex_exit(&ibuf_mutex);
is_empty = page_is_empty(root);
- ut_a(is_empty == ibuf->empty);
+ ut_a(is_empty == ibuf.empty);
ibuf_mtr_commit(&mtr);
return(is_empty);
@@ -4728,16 +4702,16 @@ ibuf_print(
fprintf(file,
"Ibuf: size " ULINTPF ", free list len " ULINTPF ","
" seg size " ULINTPF ", " ULINTPF " merges\n",
- ibuf->size,
- ibuf->free_list_len,
- ibuf->seg_size,
- ulint{ibuf->n_merges});
+ ibuf.size,
+ ibuf.free_list_len,
+ ibuf.seg_size,
+ ulint{ibuf.n_merges});
fputs("merged operations:\n ", file);
- ibuf_print_ops(ibuf->n_merged_ops, file);
+ ibuf_print_ops(ibuf.n_merged_ops, file);
fputs("discarded operations:\n ", file);
- ibuf_print_ops(ibuf->n_discarded_ops, file);
+ ibuf_print_ops(ibuf.n_discarded_ops, file);
mutex_exit(&ibuf_mutex);
}
diff --git a/storage/innobase/include/btr0btr.h b/storage/innobase/include/btr0btr.h
index 283c2e0298a..d00130dbd3d 100644
--- a/storage/innobase/include/btr0btr.h
+++ b/storage/innobase/include/btr0btr.h
@@ -217,37 +217,55 @@ btr_height_get(
mtr_t* mtr) /*!< in/out: mini-transaction */
MY_ATTRIBUTE((warn_unused_result));
-/** Gets a buffer page and declares its latching order level.
-@param[in] page_id page id
-@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0
+/** Get an index page and declare its latching order level.
+@param[in] index index tree
+@param[in] page page number
@param[in] mode latch mode
+@param[in] merge whether change buffer merge should be attempted
@param[in] file file name
@param[in] line line where called
-@param[in] index index tree, may be NULL if it is not an insert buffer
-tree
@param[in,out] mtr mini-transaction
@return block */
-UNIV_INLINE
-buf_block_t*
-btr_block_get_func(
- const page_id_t page_id,
- ulint zip_size,
- ulint mode,
- const char* file,
- unsigned line,
- dict_index_t* index,
- mtr_t* mtr);
+inline buf_block_t* btr_block_get_func(const dict_index_t& index, ulint page,
+ ulint mode, bool merge,
+ const char* file, unsigned line,
+ mtr_t* mtr)
+{
+ dberr_t err;
+
+ if (buf_block_t* block = buf_page_get_gen(
+ page_id_t(index.table->space->id, page),
+ index.table->space->zip_size(), mode, NULL, BUF_GET,
+ file, line, mtr, &err, merge && !index.is_clust())) {
+ ut_ad(err == DB_SUCCESS);
+ if (mode != RW_NO_LATCH) {
+ buf_block_dbg_add_level(block, index.is_ibuf()
+ ? SYNC_IBUF_TREE_NODE
+ : SYNC_TREE_NODE);
+ }
+ return block;
+ } else {
+ ut_ad(err != DB_SUCCESS);
+
+ if (err == DB_DECRYPTION_FAILED) {
+ if (index.table) {
+ index.table->file_unreadable = true;
+ }
+ }
+
+ return NULL;
+ }
+}
/** Gets a buffer page and declares its latching order level.
-@param page_id tablespace/page identifier
-@param zip_size ROW_FORMAT=COMPRESSED page size, or 0
+@param index index tree
+@param page page number
@param mode latch mode
-@param index index tree, may be NULL if not the insert buffer tree
+@param merge whether change buffer merge should be attempted
@param mtr mini-transaction handle
@return the block descriptor */
-# define btr_block_get(page_id, zip_size, mode, index, mtr) \
- btr_block_get_func(page_id, zip_size, mode, \
- __FILE__, __LINE__, (dict_index_t*)index, mtr)
+# define btr_block_get(index, page, mode, merge, mtr) \
+ btr_block_get_func(index, page, mode, merge, __FILE__, __LINE__, mtr)
/**************************************************************//**
Gets the index id field of a page.
@return index id */
@@ -678,7 +696,7 @@ buf_block_t*
btr_root_block_get(
/*===============*/
const dict_index_t* index, /*!< in: index tree */
- ulint mode, /*!< in: either RW_S_LATCH
+ rw_lock_type_t mode, /*!< in: either RW_S_LATCH
or RW_X_LATCH */
mtr_t* mtr); /*!< in: mtr */
@@ -751,28 +769,11 @@ btr_validate_index(
MY_ATTRIBUTE((warn_unused_result));
/** Remove a page from the level list of pages.
-@param[in] space space where removed
-@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0
-@param[in,out] page page to remove
+@param[in] block page to remove
@param[in] index index tree
@param[in,out] mtr mini-transaction */
-void
-btr_level_list_remove_func(
- ulint space,
- ulint zip_size,
- page_t* page,
- dict_index_t* index,
- mtr_t* mtr);
-
-/*************************************************************//**
-Removes a page from the level list of pages.
-@param space in: space where removed
-@param zip_size in: compressed page size in bytes, or 0 for uncompressed
-@param page in/out: page to remove
-@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,index,mtr)
+void btr_level_list_remove(const buf_block_t& block, const dict_index_t& index,
+ mtr_t* mtr);
/*************************************************************//**
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 247e25492a2..93f27e0f4e7 100644
--- a/storage/innobase/include/btr0btr.ic
+++ b/storage/innobase/include/btr0btr.ic
@@ -29,51 +29,6 @@ Created 6/2/1994 Heikki Tuuri
#include "mtr0log.h"
#include "page0zip.h"
-/** Gets a buffer page and declares its latching order level.
-@param[in] page_id page id
-@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0
-@param[in] mode latch mode
-@param[in] file file name
-@param[in] line line where called
-@param[in] index index tree, may be NULL if it is not an insert buffer
-tree
-@param[in,out] mtr mini-transaction
-@return block */
-UNIV_INLINE
-buf_block_t*
-btr_block_get_func(
- const page_id_t page_id,
- ulint zip_size,
- ulint mode,
- const char* file,
- unsigned line,
- dict_index_t* index,
- mtr_t* mtr)
-{
- buf_block_t* block;
- dberr_t err=DB_SUCCESS;
-
- block = buf_page_get_gen(
- page_id, zip_size, mode, NULL, BUF_GET, file, line, mtr, &err);
-
- if (err == DB_DECRYPTION_FAILED) {
- if (index && index->table) {
- index->table->file_unreadable = 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);
- }
- }
-
- return(block);
-}
-
/**************************************************************//**
Sets the index id field of a page. */
UNIV_INLINE
diff --git a/storage/innobase/include/btr0bulk.h b/storage/innobase/include/btr0bulk.h
index 0fcf4a36d6b..d1a8af22d68 100644
--- a/storage/innobase/include/btr0bulk.h
+++ b/storage/innobase/include/btr0bulk.h
@@ -34,8 +34,6 @@ Created 03/11/2014 Shaohua Wang
/** Innodb B-tree index fill factor for bulk load. */
extern uint innobase_fill_factor;
-/** whether to reduce redo logging during ALTER TABLE */
-extern my_bool innodb_log_optimize_ddl;
/*
The proper function call sequence of PageBulk is as below:
diff --git a/storage/innobase/include/btr0cur.h b/storage/innobase/include/btr0cur.h
index b28fc48405d..9d25e7e583b 100644
--- a/storage/innobase/include/btr0cur.h
+++ b/storage/innobase/include/btr0cur.h
@@ -821,8 +821,6 @@ btr_rec_set_deleted_flag(
/** Latches the leaf page or pages requested.
@param[in] block leaf page where the search converged
-@param[in] page_id page id of the leaf
-@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0
@param[in] latch_mode BTR_SEARCH_LEAF, ...
@param[in] cursor cursor
@param[in] mtr mini-transaction
@@ -830,8 +828,6 @@ btr_rec_set_deleted_flag(
btr_latch_leaves_t
btr_cur_latch_leaves(
buf_block_t* block,
- const page_id_t page_id,
- ulint zip_size,
ulint latch_mode,
btr_cur_t* cursor,
mtr_t* mtr);
diff --git a/storage/innobase/include/btr0pcur.h b/storage/innobase/include/btr0pcur.h
index 20f4730f48f..1ffc2eb4d76 100644
--- a/storage/innobase/include/btr0pcur.h
+++ b/storage/innobase/include/btr0pcur.h
@@ -526,7 +526,8 @@ struct btr_pcur_t{
ulint buf_size;
btr_pcur_t() :
- btr_cur(), latch_mode(0), old_stored(false), old_rec(NULL),
+ btr_cur(), latch_mode(RW_NO_LATCH),
+ old_stored(false), old_rec(NULL),
old_n_fields(0), rel_pos(btr_pcur_pos_t(0)),
block_when_stored(NULL),
modify_clock(0), withdraw_clock(0),
diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
index 93a27028ec4..332b6d93aeb 100644
--- a/storage/innobase/include/buf0buf.h
+++ b/storage/innobase/include/buf0buf.h
@@ -67,16 +67,6 @@ struct fil_addr_t;
if the file page has been freed. */
#define BUF_EVICT_IF_IN_POOL 20 /*!< evict a clean block if found */
/* @} */
-/** @name Modes for buf_page_get_known_nowait */
-/* @{ */
-#define BUF_MAKE_YOUNG 51 /*!< Move the block to the
- start of the LRU list if there
- is a danger that the block
- would drift out of the buffer
- pool*/
-#define BUF_KEEP_OLD 52 /*!< Preserve the current LRU
- position of the block. */
-/* @} */
#define MAX_BUFFER_POOLS_BITS 6 /*!< Number of bits to representing
a buffer pool ID */
@@ -132,12 +122,11 @@ enum buf_page_state {
before putting to the free list */
};
-
/** This structure defines information we will fetch from each buffer pool. It
will be used to print table IO stats */
struct buf_pool_info_t{
/* General buffer pool info */
- ulint pool_unique_id; /*!< Buffer Pool ID */
+ uint pool_unique_id; /*!< Buffer Pool ID */
ulint pool_size; /*!< Buffer Pool size in pages */
ulint lru_len; /*!< Length of buf_pool->LRU */
ulint old_lru_len; /*!< buf_pool->LRU_old_len */
@@ -357,7 +346,8 @@ NOTE! The following macros should be used instead of buf_page_get_gen,
to improve debugging. Only values RW_S_LATCH and RW_X_LATCH are allowed
in LA! */
#define buf_page_get(ID, SIZE, LA, MTR) \
- buf_page_get_gen(ID, SIZE, LA, NULL, BUF_GET, __FILE__, __LINE__, MTR, NULL)
+ buf_page_get_gen(ID, SIZE, LA, NULL, BUF_GET, __FILE__, __LINE__, MTR)
+
/**************************************************************//**
Use these macros to bufferfix a page with no latching. Remember not to
read the contents of the page unless you know it is safe. Do not modify
@@ -366,7 +356,7 @@ error-prone programming not to set a latch, and it should be used
with care. */
#define buf_page_get_with_no_latch(ID, SIZE, MTR) \
buf_page_get_gen(ID, SIZE, RW_NO_LATCH, NULL, BUF_GET_NO_LATCH, \
- __FILE__, __LINE__, MTR, NULL)
+ __FILE__, __LINE__, MTR)
/********************************************************************//**
This is the general function used to get optimistic access to a database
page.
@@ -380,19 +370,6 @@ buf_page_optimistic_get(
const char* file, /*!< in: file name */
unsigned line, /*!< in: line where called */
mtr_t* mtr); /*!< in: mini-transaction */
-/********************************************************************//**
-This is used to get access to a known database page, when no waiting can be
-done.
-@return TRUE if success */
-ibool
-buf_page_get_known_nowait(
-/*======================*/
- ulint rw_latch,/*!< in: RW_S_LATCH, RW_X_LATCH */
- buf_block_t* block, /*!< in: the known page */
- ulint mode, /*!< in: BUF_MAKE_YOUNG or BUF_KEEP_OLD */
- const char* file, /*!< in: file name */
- unsigned line, /*!< in: line where called */
- mtr_t* mtr); /*!< in: mini-transaction */
/** Given a tablespace id and page number tries to get that page. If the
page is not in the buffer pool it is not loaded and NULL is returned.
@@ -431,16 +408,18 @@ the same set of mutexes or latches.
buf_page_t* buf_page_get_zip(const page_id_t page_id, ulint zip_size);
/** This is the general function used to get access to a database page.
-@param[in] page_id page id
-@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0
-@param[in] rw_latch RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH
-@param[in] guess guessed block or NULL
-@param[in] mode BUF_GET, BUF_GET_IF_IN_POOL,
+@param[in] page_id page id
+@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0
+@param[in] rw_latch RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH
+@param[in] guess guessed block or NULL
+@param[in] mode BUF_GET, BUF_GET_IF_IN_POOL,
BUF_PEEK_IF_IN_POOL, BUF_GET_NO_LATCH, or BUF_GET_IF_IN_POOL_OR_WATCH
-@param[in] file file name
-@param[in] line line where called
-@param[in] mtr mini-transaction
-@param[out] err DB_SUCCESS or error code
+@param[in] file file name
+@param[in] line line where called
+@param[in] mtr mini-transaction
+@param[out] err DB_SUCCESS or error code
+@param[in] allow_ibuf_merge Allow change buffer merge while
+reading the pages from file.
@return pointer to the block or NULL */
buf_block_t*
buf_page_get_gen(
@@ -452,7 +431,8 @@ buf_page_get_gen(
const char* file,
unsigned line,
mtr_t* mtr,
- dberr_t* err);
+ dberr_t* err = NULL,
+ bool allow_ibuf_merge = false);
/** Initialize a page in the buffer pool. The page is usually not read
from a file even if it cannot be found in the buffer buf_pool. This is one
@@ -538,28 +518,36 @@ buf_block_get_freed_page_clock(
const buf_block_t* block) /*!< in: block */
MY_ATTRIBUTE((warn_unused_result));
-/********************************************************************//**
-Tells if a block is still close enough to the MRU end of the LRU list
+/** Determine if a block is still close enough to the MRU end of the LRU list
meaning that it is not in danger of getting evicted and also implying
that it has been accessed recently.
Note that this is for heuristics only and does not reserve buffer pool
mutex.
-@return TRUE if block is close to MRU end of LRU */
-UNIV_INLINE
-ibool
-buf_page_peek_if_young(
-/*===================*/
- const buf_page_t* bpage); /*!< in: block */
-/********************************************************************//**
-Recommends a move of a block to the start of the LRU list if there is danger
-of dropping from the buffer pool. NOTE: does not reserve the buffer pool
-mutex.
-@return TRUE if should be made younger */
-UNIV_INLINE
-ibool
-buf_page_peek_if_too_old(
-/*=====================*/
- const buf_page_t* bpage); /*!< in: block to make younger */
+@param[in] buf_pool buffer pool
+@param[in] bpage buffer pool page
+@return whether bpage is close to MRU end of LRU */
+inline bool buf_page_peek_if_young(const buf_pool_t* buf_pool,
+ const buf_page_t* bpage);
+
+/** Determine if a block should be moved to the start of the LRU list if
+there is danger of dropping from the buffer pool.
+@param[in,out] buf_pool buffer pool
+@param[in] bpage buffer pool page
+@return true if bpage should be made younger */
+inline bool buf_page_peek_if_too_old(buf_pool_t* buf_pool,
+ const buf_page_t* bpage);
+
+/** Move a page to the start of the buffer pool LRU list if it is too old.
+@param[in,out] buf_pool buffer pool
+@param[in,out] bpage buffer pool page */
+inline void buf_page_make_young_if_needed(buf_pool_t* buf_pool,
+ buf_page_t* bpage)
+{
+ if (UNIV_UNLIKELY(buf_page_peek_if_too_old(buf_pool, bpage))) {
+ buf_page_make_young(bpage);
+ }
+}
+
/********************************************************************//**
Gets the youngest modification log sequence number for a frame.
Returns zero if not file page or no modification occurred yet.
@@ -828,7 +816,7 @@ void
buf_stats_get_pool_info(
/*====================*/
buf_pool_t* buf_pool, /*!< in: buffer pool */
- ulint pool_id, /*!< in: buffer pool ID */
+ uint pool_id, /*!< in: buffer pool ID */
buf_pool_info_t* all_pool_info); /*!< in/out: buffer pool info
to fill */
/** Return the ratio in percents of modified pages in the buffer pool /
@@ -1107,6 +1095,8 @@ Gets the compressed page descriptor corresponding to an uncompressed page
if applicable. */
#define buf_block_get_page_zip(block) \
((block)->page.zip.data ? &(block)->page.zip : NULL)
+#define is_buf_block_get_page_zip(block) \
+ ((block)->page.zip.data != 0)
#ifdef BTR_CUR_HASH_ADAPT
/** Get a buffer block from an adaptive hash index pointer.
@@ -1173,7 +1163,10 @@ buf_page_init_for_read(
not match */
UNIV_INTERN
dberr_t
-buf_page_io_complete(buf_page_t* bpage, bool dblwr = false, bool evict = false)
+buf_page_io_complete(
+ buf_page_t* bpage,
+ bool dblwr = false,
+ bool evict = false)
MY_ATTRIBUTE((nonnull));
/********************************************************************//**
@@ -1491,6 +1484,13 @@ public:
if written again we check is TRIM
operation needed. */
+ /** whether the page will be (re)initialized at the time it will
+ be written to the file, that is, whether the doublewrite buffer
+ can be safely skipped. Protected under similar conditions as
+ buf_block_t::frame. Can be set while holding buf_block_t::lock
+ X-latch and reset during page flush, while io_fix is in effect. */
+ bool init_on_flush;
+
ulint real_size; /*!< Real size of the page
Normal pages == srv_page_size
page compressed pages, payload
@@ -1610,6 +1610,9 @@ public:
protected by buf_pool->zip_mutex
or buf_block_t::mutex. */
# endif /* UNIV_DEBUG */
+ /** Change buffer entries for the page exist.
+ Protected by io_fix==BUF_IO_READ or by buf_block_t::lock. */
+ bool ibuf_exist;
void fix() { buf_fix_count++; }
uint32_t unfix()
diff --git a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0buf.ic
index 970119edd6e..699b3ee8407 100644
--- a/storage/innobase/include/buf0buf.ic
+++ b/storage/innobase/include/buf0buf.ic
@@ -141,21 +141,17 @@ buf_block_get_freed_page_clock(
return(buf_page_get_freed_page_clock(&block->page));
}
-/********************************************************************//**
-Tells if a block is still close enough to the MRU end of the LRU list
+/** Determine if a block is still close enough to the MRU end of the LRU list
meaning that it is not in danger of getting evicted and also implying
that it has been accessed recently.
Note that this is for heuristics only and does not reserve buffer pool
mutex.
-@return TRUE if block is close to MRU end of LRU */
-UNIV_INLINE
-ibool
-buf_page_peek_if_young(
-/*===================*/
- const buf_page_t* bpage) /*!< in: block */
+@param[in] buf_pool buffer pool
+@param[in] bpage buffer pool page
+@return whether bpage is close to MRU end of LRU */
+inline bool buf_page_peek_if_young(const buf_pool_t* buf_pool,
+ const buf_page_t* bpage)
{
- buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
-
/* FIXME: bpage->freed_page_clock is 31 bits */
return((buf_pool->freed_page_clock & ((1UL << 31) - 1))
< (bpage->freed_page_clock
@@ -164,18 +160,16 @@ buf_page_peek_if_young(
/ (BUF_LRU_OLD_RATIO_DIV * 4))));
}
-/********************************************************************//**
-Recommends a move of a block to the start of the LRU list if there is danger
-of dropping from the buffer pool. NOTE: does not reserve the buffer pool
-mutex.
-@return TRUE if should be made younger */
-UNIV_INLINE
-ibool
-buf_page_peek_if_too_old(
-/*=====================*/
- const buf_page_t* bpage) /*!< in: block to make younger */
+/** Determine if a block should be moved to the start of the LRU list if
+there is danger of dropping from the buffer pool.
+@param[in,out] buf_pool buffer pool
+@param[in] bpage buffer pool page
+@return true if bpage should be made younger */
+inline bool buf_page_peek_if_too_old(buf_pool_t* buf_pool,
+ const buf_page_t* bpage)
{
- buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
+ ut_ad(!buf_pool_mutex_own(buf_pool));
+ ut_ad(buf_page_in_file(bpage));
if (buf_pool->freed_page_clock == 0) {
/* If eviction has not started yet, do not update the
@@ -198,9 +192,9 @@ buf_page_peek_if_too_old(
}
buf_pool->stat.n_pages_not_made_young++;
- return(FALSE);
+ return false;
} else {
- return(!buf_page_peek_if_young(bpage));
+ return !buf_page_peek_if_young(buf_pool, bpage);
}
}
diff --git a/storage/innobase/include/buf0flu.h b/storage/innobase/include/buf0flu.h
index e022dd55215..3753cb05651 100644
--- a/storage/innobase/include/buf0flu.h
+++ b/storage/innobase/include/buf0flu.h
@@ -31,6 +31,9 @@ Created 11/5/1995 Heikki Tuuri
#include "log0log.h"
#include "buf0types.h"
+/** Number of pages flushed through non flush_list flushes. */
+extern ulint buf_lru_flush_page_count;
+
/** Flag indicating if the page_cleaner is in active state. */
extern bool buf_page_cleaner_is_active;
diff --git a/storage/innobase/include/buf0rea.h b/storage/innobase/include/buf0rea.h
index ff0ba474bb3..7653bdbe55f 100644
--- a/storage/innobase/include/buf0rea.h
+++ b/storage/innobase/include/buf0rea.h
@@ -100,26 +100,6 @@ which could result in a deadlock if the OS does not support asynchronous io.
ulint
buf_read_ahead_linear(const page_id_t page_id, ulint zip_size, bool ibuf);
-/********************************************************************//**
-Issues read requests for pages which the ibuf module wants to read in, in
-order to contract the insert buffer tree. Technically, this function is like
-a read-ahead function. */
-void
-buf_read_ibuf_merge_pages(
-/*======================*/
- bool sync, /*!< in: true if the caller
- wants this function to wait
- for the highest address page
- to get read in, before this
- function returns */
- const ulint* space_ids, /*!< in: array of space ids */
- const ulint* page_nos, /*!< in: array of page numbers
- to read, with the highest page
- number the last in the
- array */
- ulint n_stored); /*!< in: number of elements
- in the arrays */
-
/** Issues read requests for pages which recovery wants to read in.
@param[in] sync true if the caller wants this function to wait
for the highest address page to get read in, before this function returns
diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h
index 901a9ad415a..feb757a4666 100644
--- a/storage/innobase/include/dict0dict.h
+++ b/storage/innobase/include/dict0dict.h
@@ -1573,6 +1573,23 @@ public:
mutex_exit(&mutex);
rw_lock_x_unlock(&latch);
}
+
+ /** Estimate the used memory occupied by the data dictionary
+ table and index objects.
+ @return number of bytes occupied */
+ ulint rough_size() const
+ {
+ /* No mutex; this is a very crude approximation anyway */
+ ulint size = UT_LIST_GET_LEN(table_LRU) + UT_LIST_GET_LEN(table_non_LRU);
+ size *= sizeof(dict_table_t)
+ + sizeof(dict_index_t) * 2
+ + (sizeof(dict_col_t) + sizeof(dict_field_t)) * 10
+ + sizeof(dict_field_t) * 5 /* total number of key fields */
+ + 200; /* arbitrary, covering names and overhead */
+ size += (table_hash->n_cells + table_id_hash->n_cells
+ + temp_id_hash->n_cells) * sizeof(hash_cell_t);
+ return size;
+ }
};
/** the data dictionary cache */
@@ -1794,13 +1811,6 @@ dict_table_decode_n_col(
ulint* n_col,
ulint* n_v_col);
-/** Calculate the used memory occupied by the data dictionary
-table and index objects.
-@return number of bytes occupied. */
-UNIV_INTERN
-ulint
-dict_sys_get_size();
-
/** Look for any dictionary objects that are found in the given tablespace.
@param[in] space_id Tablespace ID to search for.
@return true if tablespace is empty. */
diff --git a/storage/innobase/include/dict0load.h b/storage/innobase/include/dict0load.h
index df345e741ba..69379e44b78 100644
--- a/storage/innobase/include/dict0load.h
+++ b/storage/innobase/include/dict0load.h
@@ -276,7 +276,7 @@ dict_process_sys_tablespaces(
/*=========================*/
mem_heap_t* heap, /*!< in/out: heap memory */
const rec_t* rec, /*!< in: current SYS_TABLESPACES rec */
- ulint* space, /*!< out: pace id */
+ uint32_t* space, /*!< out: tablespace identifier */
const char** name, /*!< out: tablespace name */
ulint* flags); /*!< out: tablespace flags */
/********************************************************************//**
@@ -288,7 +288,7 @@ dict_process_sys_datafiles(
/*=======================*/
mem_heap_t* heap, /*!< in/out: heap memory */
const rec_t* rec, /*!< in: current SYS_DATAFILES rec */
- ulint* space, /*!< out: pace id */
+ uint32_t* space, /*!< out: tablespace identifier */
const char** path); /*!< out: datafile path */
/** Update the record for space_id in SYS_TABLESPACES to this filepath.
diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h
index a1efd28f7ed..c5ae91b0ae1 100644
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
@@ -31,12 +31,15 @@ Created 10/25/1995 Heikki Tuuri
#ifndef UNIV_INNOCHECKSUM
+#include "hash0hash.h"
#include "log0recv.h"
#include "dict0types.h"
#ifdef UNIV_LINUX
# include <set>
#endif
+/** whether to reduce redo logging during ALTER TABLE */
+extern my_bool innodb_log_optimize_ddl;
// Forward declaration
extern my_bool srv_use_doublewrite_buf;
extern struct buf_dblwr_t* buf_dblwr;
diff --git a/storage/innobase/include/fsp0fsp.h b/storage/innobase/include/fsp0fsp.h
index 75c448c956d..26da55bb2ad 100644
--- a/storage/innobase/include/fsp0fsp.h
+++ b/storage/innobase/include/fsp0fsp.h
@@ -625,7 +625,17 @@ inline void fsp_init_file_page(
ut_d(space->modify_check(*mtr));
ut_ad(space->id == block->page.id.space());
fsp_apply_init_file_page(block);
- mlog_write_initial_log_record(block->frame, MLOG_INIT_FILE_PAGE2, mtr);
+
+ if (byte* log_ptr = mlog_open(mtr, 11)) {
+ log_ptr = mlog_write_initial_log_record_low(
+ MLOG_INIT_FILE_PAGE2,
+ block->page.id.space(), block->page.id.page_no(),
+ log_ptr, mtr);
+ mlog_close(mtr, log_ptr);
+ if (!innodb_log_optimize_ddl) {
+ block->page.init_on_flush = true;
+ }
+ }
}
#ifndef UNIV_DEBUG
diff --git a/storage/innobase/include/ibuf0ibuf.h b/storage/innobase/include/ibuf0ibuf.h
index 4fbf5b6f70d..356e120a7bc 100644
--- a/storage/innobase/include/ibuf0ibuf.h
+++ b/storage/innobase/include/ibuf0ibuf.h
@@ -62,7 +62,7 @@ enum ibuf_use_t {
extern ulong innodb_change_buffering;
/** The insert buffer control structure */
-extern ibuf_t* ibuf;
+extern ibuf_t ibuf;
/* The purpose of the insert buffer is to reduce random disk access.
When we wish to insert a record into a non-unique secondary index and
@@ -317,6 +317,11 @@ ibuf_insert(
ulint zip_size,
que_thr_t* thr);
+/** Check whether buffered changes exist for a page.
+@param[in,out] bpage buffer page
+@return whether buffered changes exist */
+bool ibuf_page_exists(const buf_page_t& bpage);
+
/** When an index page is read from a disk to the buffer pool, this function
applies any buffered operations to the page and deletes the entries from the
insert buffer. If the page is not read, but created in the buffer pool, this
@@ -343,15 +348,10 @@ in DISCARD TABLESPACE, IMPORT TABLESPACE, or crash recovery.
void ibuf_delete_for_discarded_space(ulint space);
/** Contract the change buffer by reading pages to the buffer pool.
-@param[in] full If true, do a full contraction based
-on PCT_IO(100). If false, the size of contract batch is determined
-based on the current size of the change buffer.
@return a lower limit for the combined size in bytes of entries which
will be merged from ibuf trees to the pages read, 0 if ibuf is
empty */
-ulint
-ibuf_merge_in_background(
- bool full);
+ulint ibuf_merge_all();
/** Contracts insert buffer trees by reading pages referring to space_id
to the buffer pool.
diff --git a/storage/innobase/include/ibuf0ibuf.ic b/storage/innobase/include/ibuf0ibuf.ic
index db8c122c0f7..ba772359630 100644
--- a/storage/innobase/include/ibuf0ibuf.ic
+++ b/storage/innobase/include/ibuf0ibuf.ic
@@ -44,6 +44,11 @@ ibuf_mtr_start(
{
mtr_start(mtr);
mtr->enter_ibuf();
+
+ if (high_level_read_only || srv_read_only_mode) {
+ mtr_set_log_mode(mtr, MTR_LOG_NONE);
+ }
+
}
/***************************************************************//**
Commits an insert buffer mini-transaction. */
@@ -126,12 +131,11 @@ ibuf_should_try(
decide */
{
return(innodb_change_buffering
- && ibuf->max_size != 0
+ && ibuf.max_size != 0
&& !dict_index_is_clust(index)
&& !dict_index_is_spatial(index)
&& index->table->quiesce == QUIESCE_NONE
- && (ignore_sec_unique || !dict_index_is_unique(index))
- && srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE);
+ && (ignore_sec_unique || !dict_index_is_unique(index)));
}
/******************************************************************//**
diff --git a/storage/innobase/include/lock0lock.h b/storage/innobase/include/lock0lock.h
index 8ae0b062729..6300706a2b9 100644
--- a/storage/innobase/include/lock0lock.h
+++ b/storage/innobase/include/lock0lock.h
@@ -605,42 +605,6 @@ lock_get_type(
const lock_t* lock); /*!< in: lock */
/*******************************************************************//**
-Gets the trx of the lock. Non-inline version for using outside of the
-lock module.
-@return trx_t* */
-UNIV_INTERN
-trx_t*
-lock_get_trx(
-/*=========*/
- const lock_t* lock); /*!< in: lock */
-
-/*******************************************************************//**
-Gets the id of the transaction owning a lock.
-@return transaction id */
-trx_id_t
-lock_get_trx_id(
-/*============*/
- const lock_t* lock); /*!< in: lock */
-
-/*******************************************************************//**
-Gets the mode of a lock in a human readable string.
-The string should not be free()'d or modified.
-@return lock mode */
-const char*
-lock_get_mode_str(
-/*==============*/
- const lock_t* lock); /*!< in: lock */
-
-/*******************************************************************//**
-Gets the type of a lock in a human readable string.
-The string should not be free()'d or modified.
-@return lock type */
-const char*
-lock_get_type_str(
-/*==============*/
- const lock_t* lock); /*!< in: lock */
-
-/*******************************************************************//**
Gets the id of the table on which the lock is.
@return id of the table */
table_id_t
@@ -673,21 +637,6 @@ lock_rec_get_index_name(
const lock_t* lock); /*!< in: lock */
/*******************************************************************//**
-For a record lock, gets the tablespace number on which the lock is.
-@return tablespace number */
-ulint
-lock_rec_get_space_id(
-/*==================*/
- const lock_t* lock); /*!< in: lock */
-
-/*******************************************************************//**
-For a record lock, gets the page number on which the lock is.
-@return page number */
-ulint
-lock_rec_get_page_no(
-/*=================*/
- const lock_t* lock); /*!< in: lock */
-/*******************************************************************//**
Check if there are any locks (table or rec) against table.
@return TRUE if locks exist */
bool
diff --git a/storage/innobase/include/log0log.h b/storage/innobase/include/log0log.h
index 4ab766d7bf0..8769d7066fe 100644
--- a/storage/innobase/include/log0log.h
+++ b/storage/innobase/include/log0log.h
@@ -58,10 +58,6 @@ step which modifies the database, is started */
typedef ulint (*log_checksum_func_t)(const byte* log_block);
-/** Pointer to the log checksum calculation function. Protected with
-log_sys.mutex. */
-extern log_checksum_func_t log_checksum_algorithm_ptr;
-
/** Append a string to the log.
@param[in] str string
@param[in] len string length
@@ -263,28 +259,10 @@ log_block_set_data_len(
/*===================*/
byte* log_block, /*!< in/out: log block */
ulint len); /*!< in: data length */
-/************************************************************//**
-Calculates the checksum for a log block.
-@return checksum */
-UNIV_INLINE
-ulint
-log_block_calc_checksum(
-/*====================*/
- const byte* block); /*!< in: log block */
-
-/** Calculates the checksum for a log block using the CRC32 algorithm.
+/** Calculate the CRC-32C checksum of a log block.
@param[in] block log block
@return checksum */
-UNIV_INLINE
-ulint
-log_block_calc_checksum_crc32(
- const byte* block);
-
-/** Calculates the checksum for a log block using the "no-op" algorithm.
-@return the calculated checksum value */
-UNIV_INLINE
-ulint
-log_block_calc_checksum_none(const byte*);
+inline ulint log_block_calc_checksum_crc32(const byte* block);
/************************************************************//**
Gets a log block checksum field value.
@@ -362,9 +340,6 @@ void
log_refresh_stats(void);
/*===================*/
-/** Whether to generate and require checksums on the redo log pages */
-extern my_bool innodb_log_checksums;
-
/* Values used as flags */
#define LOG_FLUSH 7652559
#define LOG_CHECKPOINT 78656949
diff --git a/storage/innobase/include/log0log.ic b/storage/innobase/include/log0log.ic
index 7dfa7c0db68..7ea34d6268e 100644
--- a/storage/innobase/include/log0log.ic
+++ b/storage/innobase/include/log0log.ic
@@ -190,18 +190,6 @@ log_block_convert_lsn_to_no(
0xFUL, 0x3FFFFFFFUL)) + 1);
}
-/************************************************************//**
-Calculates the checksum for a log block.
-@return checksum */
-UNIV_INLINE
-ulint
-log_block_calc_checksum(
-/*====================*/
- const byte* block) /*!< in: log block */
-{
- return(log_checksum_algorithm_ptr(block));
-}
-
/** Calculate the checksum for a log block using the pre-5.7.9 algorithm.
@param[in] block log block
@return checksum */
@@ -231,26 +219,14 @@ log_block_calc_checksum_format_0(
return(sum);
}
-/** Calculate the checksum for a log block using the MySQL 5.7 algorithm.
+/** Calculate the CRC-32C checksum of a log block.
@param[in] block log block
@return checksum */
-UNIV_INLINE
-ulint
-log_block_calc_checksum_crc32(
- const byte* block)
+inline ulint log_block_calc_checksum_crc32(const byte* block)
{
return ut_crc32(block, OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_CHECKSUM);
}
-/** Calculates the checksum for a log block using the "no-op" algorithm.
-@return checksum */
-UNIV_INLINE
-ulint
-log_block_calc_checksum_none(const byte*)
-{
- return(LOG_NO_CHECKSUM_MAGIC);
-}
-
/************************************************************//**
Gets a log block checksum field value.
@return checksum */
diff --git a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0recv.h
index 5a687b5df08..7cd05b2f755 100644
--- a/storage/innobase/include/log0recv.h
+++ b/storage/innobase/include/log0recv.h
@@ -29,7 +29,6 @@ Created 9/20/1997 Heikki Tuuri
#include "ut0byte.h"
#include "buf0types.h"
-#include "hash0hash.h"
#include "log0log.h"
#include "mtr0types.h"
@@ -48,10 +47,10 @@ dberr_t
recv_find_max_checkpoint(ulint* max_field)
MY_ATTRIBUTE((nonnull, warn_unused_result));
-/** Reduces recv_sys.n_addrs for the corrupted page.
+/** Remove records for a corrupted page.
This function should called when srv_force_recovery > 0.
@param[in] page_id page id of the corrupted page */
-void recv_recover_corrupt_page(page_id_t page_id);
+ATTRIBUTE_COLD void recv_recover_corrupt_page(page_id_t page_id);
/** Apply any buffered redo log to a page that was just read from a data file.
@param[in,out] bpage buffer pool page */
@@ -80,13 +79,13 @@ void
recv_sys_var_init(void);
/*===================*/
-/** Apply the hash table of stored log records to persistent data pages.
+/** Apply recv_sys.pages to persistent data pages.
@param[in] last_batch whether the change buffer merge will be
performed as part of the operation */
void
recv_apply_hashed_log_recs(bool last_batch);
-/** Whether to store redo log records to the hash table */
+/** Whether to store redo log records in recv_sys.pages */
enum store_t {
/** Do not store redo log records. */
STORE_NO,
@@ -105,8 +104,8 @@ recv_sys.parse_start_lsn is non-zero.
@return true if more data added */
bool recv_sys_add_to_parsing_buf(const byte* log_block, lsn_t scanned_lsn);
-/** Parse log records from a buffer and optionally store them to a
-hash table to wait merging to file pages.
+/** Parse log records from a buffer and optionally store them in recv_sys.pages
+to wait merging to file pages.
@param[in] checkpoint_lsn the LSN of the latest checkpoint
@param[in] store whether to store page operations
@param[in] apply whether to apply the records
@@ -144,8 +143,12 @@ struct recv_data_t{
/** Stored log record struct */
struct recv_t{
- mlog_id_t type; /*!< log record type */
- ulint len; /*!< log record body length in bytes */
+ /** next record */
+ recv_t* next;
+ /** log record body length in bytes */
+ uint32_t len;
+ /** log record type */
+ mlog_id_t type;
recv_data_t* data; /*!< chain of blocks containing the log record
body */
lsn_t start_lsn;/*!< start lsn of the log segment written by
@@ -156,8 +159,6 @@ struct recv_t{
the mtr which generated this log record: NOTE
that this is not necessarily the end lsn of
this log record */
- UT_LIST_NODE_T(recv_t)
- rec_list;/*!< list of log records for this page */
};
struct recv_dblwr_t {
@@ -205,7 +206,7 @@ struct recv_sys_t{
lsn_t parse_start_lsn;
/*!< this is the lsn from which we were able to
start parsing log records and adding them to
- the hash table; zero if a suitable
+ pages; zero if a suitable
start point not found yet */
lsn_t scanned_lsn;
/*!< the log data has been scanned up to this
@@ -234,9 +235,38 @@ struct recv_sys_t{
time_t progress_time;
mem_heap_t* heap; /*!< memory heap of log records and file
addresses*/
- hash_table_t* addr_hash;/*!< hash table of file addresses of pages */
- ulint n_addrs;/*!< number of not processed hashed file
- addresses in the hash table */
+
+ /** buffered records waiting to be applied to a page */
+ struct recs_t
+ {
+ /** Recovery state */
+ enum {
+ /** not yet processed */
+ RECV_NOT_PROCESSED,
+ /** not processed; the page will be reinitialized */
+ RECV_WILL_NOT_READ,
+ /** page is being read */
+ RECV_BEING_READ,
+ /** log records are being applied on the page */
+ RECV_BEING_PROCESSED
+ } state;
+ /** First log record */
+ recv_t* log;
+ /** Last log record */
+ recv_t* last;
+ };
+
+ using map = std::map<const page_id_t, recs_t,
+ std::less<const page_id_t>,
+ ut_allocator<std::pair<const page_id_t,recs_t>>>;
+ /** buffered records waiting to be applied to pages */
+ map pages;
+
+ /** Process a record that indicates that a tablespace is
+ being shrunk in size.
+ @param page_id first page identifier that is not in the file
+ @param lsn log sequence number of the shrink operation */
+ inline void trim(const page_id_t page_id, lsn_t lsn);
/** Undo tablespaces for which truncate has been logged
(indexed by id - srv_undo_space_id_start) */
@@ -249,7 +279,7 @@ struct recv_sys_t{
recv_dblwr_t dblwr;
- /** Lastly added LSN to the hash table of log records. */
+ /** Last added LSN to pages. */
lsn_t last_stored_lsn;
/** Initialize the redo log recovery subsystem. */
@@ -265,13 +295,12 @@ struct recv_sys_t{
/** Store a redo log record for applying.
@param type record type
- @param space tablespace identifier
- @param page_no page number
+ @param page_id page identifier
@param body record body
@param rec_end end of record
@param lsn start LSN of the mini-transaction
@param end_lsn end LSN of the mini-transaction */
- inline void add(mlog_id_t type, ulint space, ulint page_no,
+ inline void add(mlog_id_t type, const page_id_t page_id,
byte* body, byte* rec_end, lsn_t lsn,
lsn_t end_lsn);
@@ -301,8 +330,8 @@ otherwise. Note that this is FALSE while a background thread is
rolling back incomplete transactions. */
extern volatile bool recv_recovery_on;
/** If the following is TRUE, the buffer pool file pages must be invalidated
-after recovery and no ibuf operations are allowed; this becomes TRUE if
-the log record hash table becomes too full, and log records must be merged
+after recovery and no ibuf operations are allowed; this will be set if
+recv_sys.pages becomes too full, and log records must be merged
to file pages already before the recovery is finished: in this case no
ibuf operations are allowed, as they could modify the pages read in the
buffer pool before the pages have been recovered to the up-to-date state.
diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h
index a87ce5ec07b..324c6f7447d 100644
--- a/storage/innobase/include/os0file.h
+++ b/storage/innobase/include/os0file.h
@@ -1442,17 +1442,6 @@ os_aio_wait_until_no_pending_writes();
void
os_aio_simulated_wake_handler_threads();
-#ifdef _WIN32
-/** This function can be called if one wants to post a batch of reads and
-prefers an i/o-handler thread to handle them all at once later. You must
-call os_aio_simulated_wake_handler_threads later to ensure the threads
-are not left sleeping! */
-void
-os_aio_simulated_put_read_threads_to_sleep();
-#else /* _WIN32 */
-# define os_aio_simulated_put_read_threads_to_sleep()
-#endif /* _WIN32 */
-
/** This is the generic AIO handler interface function.
Waits for an aio operation to complete. This function is used to wait the
for completed requests. The AIO array of pending requests is divided
@@ -1518,15 +1507,6 @@ os_file_get_status(
bool check_rw_perm,
bool read_only);
-/** Creates a temporary file in the location specified by the parameter
-path. If the path is NULL then it will be created on --tmpdir location.
-This function is defined in ha_innodb.cc.
-@param[in] path location for creating temporary file
-@return temporary file descriptor, or < 0 on error */
-os_file_t
-innobase_mysql_tmpfile(
- const char* path);
-
/** Set the file create umask
@param[in] umask The umask to use for file creation. */
void
diff --git a/storage/innobase/include/page0cur.h b/storage/innobase/include/page0cur.h
index f21506d0475..d9c4261f367 100644
--- a/storage/innobase/include/page0cur.h
+++ b/storage/innobase/include/page0cur.h
@@ -73,6 +73,7 @@ page_cur_get_rec(
# define page_cur_get_page_zip(cur) buf_block_get_page_zip((cur)->block)
# define page_cur_get_rec(cur) (cur)->rec
#endif /* UNIV_DEBUG */
+# define is_page_cur_get_page_zip(cur) is_buf_block_get_page_zip((cur)->block)
/*********************************************************//**
Sets the cursor object to point before the first user record
on the page. */
diff --git a/storage/innobase/include/page0cur.ic b/storage/innobase/include/page0cur.ic
index 531d6b6f777..c94b1791954 100644
--- a/storage/innobase/include/page0cur.ic
+++ b/storage/innobase/include/page0cur.ic
@@ -277,7 +277,7 @@ page_cur_tuple_insert(
ULINT_UNDEFINED, heap);
ut_ad(size == rec_offs_size(*offsets));
- if (buf_block_get_page_zip(cursor->block)) {
+ if (is_buf_block_get_page_zip(cursor->block)) {
rec = page_cur_insert_rec_zip(
cursor, index, rec, *offsets, mtr);
} else {
@@ -311,7 +311,7 @@ page_cur_rec_insert(
ulint* offsets,/*!< in/out: rec_get_offsets(rec, index) */
mtr_t* mtr) /*!< in: mini-transaction handle, or NULL */
{
- if (buf_block_get_page_zip(cursor->block)) {
+ if (is_buf_block_get_page_zip(cursor->block)) {
return(page_cur_insert_rec_zip(
cursor, index, rec, offsets, mtr));
} else {
diff --git a/storage/innobase/include/page0page.h b/storage/innobase/include/page0page.h
index 0fc397cd288..0af12d4b112 100644
--- a/storage/innobase/include/page0page.h
+++ b/storage/innobase/include/page0page.h
@@ -679,8 +679,8 @@ UNIV_INLINE
void
page_dir_slot_set_rec(
/*==================*/
- page_dir_slot_t* slot, /*!< in: directory slot */
- rec_t* rec); /*!< in: record on the page */
+ page_dir_slot_t*slot, /*!< in: directory slot */
+ const rec_t* rec); /*!< in: record on the page */
/***************************************************************//**
Gets the number of records owned by a directory slot.
@return number of records */
@@ -943,34 +943,6 @@ page_mem_alloc_free(
rec_t* next_rec,/*!< in: pointer to the new head of the
free record list */
ulint need); /*!< in: number of bytes allocated */
-/************************************************************//**
-Allocates a block of memory from the heap of an index page.
-@return pointer to start of allocated buffer, or NULL if allocation fails */
-byte*
-page_mem_alloc_heap(
-/*================*/
- page_t* page, /*!< in/out: index page */
- page_zip_des_t* page_zip,/*!< in/out: compressed page with enough
- space available for inserting the record,
- or NULL */
- ulint need, /*!< in: total number of bytes needed */
- ulint* heap_no);/*!< out: this contains the heap number
- of the allocated record
- if allocation succeeds */
-/************************************************************//**
-Puts a record to free list. */
-UNIV_INLINE
-void
-page_mem_free(
-/*==========*/
- page_t* page, /*!< in/out: index page */
- page_zip_des_t* page_zip,/*!< in/out: compressed page,
- or NULL */
- rec_t* rec, /*!< in: pointer to the (origin of)
- record */
- const dict_index_t* index, /*!< in: index of rec */
- const ulint* offsets);/*!< in: array returned by
- rec_get_offsets() */
/** Read the PAGE_DIRECTION field from a byte.
@param[in] ptr pointer to PAGE_DIRECTION_B
@@ -1162,28 +1134,6 @@ page_move_rec_list_start(
dict_index_t* index, /*!< in: record descriptor */
mtr_t* mtr) /*!< in: mtr */
MY_ATTRIBUTE((nonnull(1, 2, 4, 5)));
-/****************************************************************//**
-Splits a directory slot which owns too many records. */
-void
-page_dir_split_slot(
-/*================*/
- page_t* page, /*!< in: index page */
- page_zip_des_t* page_zip,/*!< in/out: compressed page whose
- uncompressed part will be written, or NULL */
- ulint slot_no)/*!< in: the directory slot */
- MY_ATTRIBUTE((nonnull(1)));
-/*************************************************************//**
-Tries to balance the given directory slot with too few records
-with the upper neighbor, so that there are at least the minimum number
-of records owned by the slot; this may result in the merging of
-two slots. */
-void
-page_dir_balance_slot(
-/*==================*/
- page_t* page, /*!< in/out: index page */
- page_zip_des_t* page_zip,/*!< in/out: compressed page, or NULL */
- ulint slot_no)/*!< in: the directory slot */
- MY_ATTRIBUTE((nonnull(1)));
/**********************************************************//**
Parses a log record of a record list end or start deletion.
@return end of log record or NULL */
diff --git a/storage/innobase/include/page0page.ic b/storage/innobase/include/page0page.ic
index 3507ea8830c..bfe568c23a0 100644
--- a/storage/innobase/include/page0page.ic
+++ b/storage/innobase/include/page0page.ic
@@ -559,8 +559,8 @@ UNIV_INLINE
void
page_dir_slot_set_rec(
/*==================*/
- page_dir_slot_t* slot, /*!< in: directory slot */
- rec_t* rec) /*!< in: record on the page */
+ page_dir_slot_t*slot, /*!< in: directory slot */
+ const rec_t* rec) /*!< in: record on the page */
{
ut_ad(page_rec_check(rec));
@@ -1005,48 +1005,6 @@ page_get_max_insert_size_after_reorganize(
return(free_space - occupied);
}
-/************************************************************//**
-Puts a record to free list. */
-UNIV_INLINE
-void
-page_mem_free(
-/*==========*/
- page_t* page, /*!< in/out: index page */
- page_zip_des_t* page_zip, /*!< in/out: compressed page,
- or NULL */
- rec_t* rec, /*!< in: pointer to the
- (origin of) record */
- const dict_index_t* index, /*!< in: index of rec */
- const ulint* offsets) /*!< in: array returned by
- rec_get_offsets() */
-{
- rec_t* free;
- ulint garbage;
-
- ut_ad(rec_offs_validate(rec, index, offsets));
- free = page_header_get_ptr(page, PAGE_FREE);
-
- if (srv_immediate_scrub_data_uncompressed) {
- /* scrub record */
- memset(rec, 0, rec_offs_data_size(offsets));
- }
-
- page_rec_set_next(rec, free);
- page_header_set_ptr(page, page_zip, PAGE_FREE, rec);
-
- garbage = page_header_get_field(page, PAGE_GARBAGE);
-
- page_header_set_field(page, page_zip, PAGE_GARBAGE,
- garbage + rec_offs_size(offsets));
-
- if (page_zip) {
- page_zip_dir_delete(page_zip, rec, index, offsets, free);
- } else {
- page_header_set_field(page, page_zip, PAGE_N_RECS,
- ulint(page_get_n_recs(page)) - 1);
- }
-}
-
/** Read the PAGE_DIRECTION field from a byte.
@param[in] ptr pointer to PAGE_DIRECTION_B
@return the value of the PAGE_DIRECTION field */
diff --git a/storage/innobase/include/page0zip.h b/storage/innobase/include/page0zip.h
index 6b9c0c3d5ba..3055c039820 100644
--- a/storage/innobase/include/page0zip.h
+++ b/storage/innobase/include/page0zip.h
@@ -128,17 +128,12 @@ page_zip_set_alloc(
void* stream, /*!< in/out: zlib stream */
mem_heap_t* heap); /*!< in: memory heap to use */
-/**********************************************************************//**
-Compress a page.
-@return TRUE on success, FALSE on failure; page_zip will be left
-intact on failure. */
-ibool
+/** Attempt to compress a ROW_FORMAT=COMPRESSED page.
+@retval true on success
+@retval false on failure; block->page.zip will be left intact. */
+bool
page_zip_compress(
-/*==============*/
- page_zip_des_t* page_zip, /*!< in: size; out: data,
- n_blobs, m_start, m_end,
- m_nonempty */
- const page_t* page, /*!< in: uncompressed page */
+ buf_block_t* block, /*!< in/out: buffer block */
dict_index_t* index, /*!< in: index of the B-tree
node */
ulint level, /*!< in: commpression level */
@@ -461,11 +456,7 @@ related to the storage of records. Also copy PAGE_MAX_TRX_ID.
NOTE: The caller must update the lock table and the adaptive hash index. */
void
page_zip_copy_recs(
-/*===============*/
- page_zip_des_t* page_zip, /*!< out: copy of src_zip
- (n_blobs, m_start, m_end,
- m_nonempty, data[0..size-1]) */
- page_t* page, /*!< out: copy of src */
+ buf_block_t* block, /*!< in/out: buffer block */
const page_zip_des_t* src_zip, /*!< in: compressed page */
const page_t* src, /*!< in: page */
dict_index_t* index, /*!< in: index of the B-tree */
@@ -511,19 +502,6 @@ page_zip_compress_write_log_no_data(
const page_t* page, /*!< in: page that is compressed */
dict_index_t* index, /*!< in: index */
mtr_t* mtr); /*!< in: mtr */
-/**********************************************************************//**
-Parses a log record of compressing an index page without the data.
-@return end of log record or NULL */
-UNIV_INLINE
-byte*
-page_zip_parse_compress_no_data(
-/*============================*/
- byte* ptr, /*!< in: buffer */
- byte* end_ptr, /*!< in: buffer end */
- page_t* page, /*!< in: uncompressed page */
- page_zip_des_t* page_zip, /*!< out: compressed page */
- dict_index_t* index) /*!< in: index */
- MY_ATTRIBUTE((nonnull(1,2)));
/**********************************************************************//**
Reset the counters used for filling
diff --git a/storage/innobase/include/page0zip.ic b/storage/innobase/include/page0zip.ic
index 5e3a1797b2a..8df7078594e 100644
--- a/storage/innobase/include/page0zip.ic
+++ b/storage/innobase/include/page0zip.ic
@@ -380,38 +380,6 @@ page_zip_compress_write_log_no_data(
}
/**********************************************************************//**
-Parses a log record of compressing an index page without the data.
-@return end of log record or NULL */
-UNIV_INLINE
-byte*
-page_zip_parse_compress_no_data(
-/*============================*/
- byte* ptr, /*!< in: buffer */
- byte* end_ptr, /*!< in: buffer end */
- page_t* page, /*!< in: uncompressed page */
- page_zip_des_t* page_zip, /*!< out: compressed page */
- dict_index_t* index) /*!< in: index */
-{
- ulint level;
- if (end_ptr == ptr) {
- return(NULL);
- }
-
- level = mach_read_from_1(ptr);
-
- /* If page compression fails then there must be something wrong
- because a compress log record is logged only if the compression
- was successful. Crash in this case. */
-
- if (page
- && !page_zip_compress(page_zip, page, index, level, NULL)) {
- ut_error;
- }
-
- return(ptr + 1);
-}
-
-/**********************************************************************//**
Reset the counters used for filling
INFORMATION_SCHEMA.innodb_cmp_per_index. */
UNIV_INLINE
diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h
index e5798f1f673..3f4bbcff455 100644
--- a/storage/innobase/include/row0mysql.h
+++ b/storage/innobase/include/row0mysql.h
@@ -271,8 +271,8 @@ row_update_for_mysql(
row_prebuilt_t* prebuilt)
MY_ATTRIBUTE((warn_unused_result));
-/** This can only be used when srv_locks_unsafe_for_binlog is TRUE or this
-session is using a READ COMMITTED or READ UNCOMMITTED isolation level.
+/** This can only be used when the current transaction is at
+READ COMMITTED or READ UNCOMMITTED isolation level.
Before calling this function row_search_for_mysql() must have
initialized prebuilt->new_rec_locks to store the information which new
record locks really were set. This function removes a newly set
@@ -694,8 +694,9 @@ struct row_prebuilt_t {
ulint row_read_type; /*!< ROW_READ_WITH_LOCKS if row locks
should be the obtained for records
under an UPDATE or DELETE cursor.
- If innodb_locks_unsafe_for_binlog
- is TRUE, this can be set to
+ At READ UNCOMMITTED or
+ READ COMMITTED isolation level,
+ this can be set to
ROW_READ_TRY_SEMI_CONSISTENT, so that
if the row under an UPDATE or DELETE
cursor was locked by another
@@ -717,8 +718,7 @@ struct row_prebuilt_t {
cases; note that this breaks
serializability. */
ulint new_rec_locks; /*!< normally 0; if
- srv_locks_unsafe_for_binlog is
- TRUE or session is using READ
+ the session is using READ
COMMITTED or READ UNCOMMITTED
isolation level, set in
row_search_for_mysql() if we set a new
diff --git a/storage/innobase/include/srv0mon.h b/storage/innobase/include/srv0mon.h
index 5a4d424981e..60a7211c166 100644
--- a/storage/innobase/include/srv0mon.h
+++ b/storage/innobase/include/srv0mon.h
@@ -397,7 +397,6 @@ enum monitor_id_t {
MONITOR_MASTER_ACTIVE_LOOPS,
MONITOR_MASTER_IDLE_LOOPS,
MONITOR_SRV_BACKGROUND_DROP_TABLE_MICROSECOND,
- MONITOR_SRV_IBUF_MERGE_MICROSECOND,
MONITOR_SRV_LOG_FLUSH_MICROSECOND,
MONITOR_SRV_MEM_VALIDATE_MICROSECOND,
MONITOR_SRV_PURGE_MICROSECOND,
diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
index 36d50c4a773..673c5c1091e 100644
--- a/storage/innobase/include/srv0srv.h
+++ b/storage/innobase/include/srv0srv.h
@@ -90,6 +90,10 @@ struct srv_stats_t
doublewrite buffer */
ulint_ctr_1_t dblwr_pages_written;
+#if defined(LINUX_NATIVE_AIO)
+ ulint_ctr_1_t buffered_aio_submitted;
+#endif
+
/** Store the number of write requests issued */
ulint_ctr_1_t buf_pool_write_requests;
@@ -190,6 +194,9 @@ struct srv_stats_t
/** Number of temporary tablespace blocks decrypted */
ulint_ctr_64_t n_temp_blocks_decrypted;
+
+ /** Number of lock deadlocks */
+ ulint_ctr_1_t lock_deadlock_count;
};
extern const char* srv_main_thread_op_info;
@@ -250,7 +257,7 @@ recovery and open all tables in RO mode instead of RW mode. We don't
sync the max trx id to disk either. */
extern my_bool srv_read_only_mode;
/** Set if InnoDB operates in read-only mode or innodb-force-recovery
-is greater than SRV_FORCE_NO_TRX_UNDO. */
+is greater than SRV_FORCE_NO_IBUF_MERGE. */
extern my_bool high_level_read_only;
/** store to its own file each table created by an user; data
dictionary tables are in the system tablespace 0 */
@@ -260,10 +267,6 @@ extern ulong srv_thread_sleep_delay;
/** Maximum sleep delay (in micro-seconds), value of 0 disables it.*/
extern ulong srv_adaptive_max_sleep_delay;
-/** Place locks to records only i.e. do not use next-key locking except
-on duplicate key checking and foreign key checking */
-extern ibool srv_locks_unsafe_for_binlog;
-
/** Sort buffer size in index creation */
extern ulong srv_sort_buf_size;
/** Maximum modification log file size for online index creation */
@@ -315,9 +318,6 @@ srv_is_undo_tablespace(ulint space_id)
+ srv_undo_tablespaces_open);
}
-/** The number of undo segments to use */
-extern ulong srv_undo_logs;
-
/** Maximum size of undo tablespace. */
extern unsigned long long srv_max_undo_log_size;
@@ -527,10 +527,12 @@ extern uint srv_spin_wait_delay;
extern ulint srv_truncated_status_writes;
/** Number of initialized rollback segments for persistent undo log */
extern ulong srv_available_undo_logs;
-
-#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
-extern my_bool srv_ibuf_disable_background_merge;
-#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
+/** Iterations of the loop bounded by 'srv_active' label. */
+extern ulint srv_main_active_loops;
+/** Iterations of the loop bounded by the 'srv_idle' label. */
+extern ulint srv_main_idle_loops;
+/** Log writes involving flush. */
+extern ulint srv_log_writes_and_flush;
#ifdef UNIV_DEBUG
extern my_bool innodb_evict_tables_on_commit_debug;
@@ -919,14 +921,6 @@ srv_master_thread_disabled_debug_update(THD*, st_mysql_sys_var*, void*,
/** Status variables to be passed to MySQL */
struct export_var_t{
- ulint innodb_data_pending_reads; /*!< Pending reads */
- ulint innodb_data_pending_writes; /*!< Pending writes */
- ulint innodb_data_pending_fsyncs; /*!< Pending fsyncs */
- ulint innodb_data_fsyncs; /*!< Number of fsyncs so far */
- ulint innodb_data_read; /*!< Data bytes read */
- ulint innodb_data_writes; /*!< I/O write requests */
- ulint innodb_data_written; /*!< Data bytes written */
- ulint innodb_data_reads; /*!< I/O read requests */
char innodb_buffer_pool_dump_status[OS_FILE_MAX_PATH + 128];/*!< Buf pool dump status */
char innodb_buffer_pool_load_status[OS_FILE_MAX_PATH + 128];/*!< Buf pool load status */
char innodb_buffer_pool_resize_status[512];/*!< Buf pool resize status */
@@ -941,6 +935,9 @@ struct export_var_t{
#ifdef UNIV_DEBUG
ulint innodb_buffer_pool_pages_latched; /*!< Latched pages */
#endif /* UNIV_DEBUG */
+ ulint innodb_buffer_pool_pages_made_not_young;
+ ulint innodb_buffer_pool_pages_made_young;
+ ulint innodb_buffer_pool_pages_old;
ulint innodb_buffer_pool_read_requests; /*!< buf_pool->stat.n_page_gets */
ulint innodb_buffer_pool_reads; /*!< srv_buf_pool_reads */
ulint innodb_buffer_pool_wait_free; /*!< srv_buf_pool_wait_free */
@@ -949,17 +946,35 @@ struct export_var_t{
ulint innodb_buffer_pool_read_ahead_rnd;/*!< srv_read_ahead_rnd */
ulint innodb_buffer_pool_read_ahead; /*!< srv_read_ahead */
ulint innodb_buffer_pool_read_ahead_evicted;/*!< srv_read_ahead evicted*/
+ ulint innodb_checkpoint_age;
+ ulint innodb_checkpoint_max_age;
+ ulint innodb_data_pending_reads; /*!< Pending reads */
+ ulint innodb_data_pending_writes; /*!< Pending writes */
+ ulint innodb_data_pending_fsyncs; /*!< Pending fsyncs */
+ ulint innodb_data_fsyncs; /*!< Number of fsyncs so far */
+ ulint innodb_data_read; /*!< Data bytes read */
+ ulint innodb_data_writes; /*!< I/O write requests */
+ ulint innodb_data_written; /*!< Data bytes written */
+ ulint innodb_data_reads; /*!< I/O read requests */
ulint innodb_dblwr_pages_written; /*!< srv_dblwr_pages_written */
ulint innodb_dblwr_writes; /*!< srv_dblwr_writes */
- ibool innodb_have_atomic_builtins; /*!< HAVE_ATOMIC_BUILTINS */
+ ulint innodb_deadlocks;
+ ulint innodb_history_list_length;
ulint innodb_log_waits; /*!< srv_log_waits */
ulint innodb_log_write_requests; /*!< srv_log_write_requests */
ulint innodb_log_writes; /*!< srv_log_writes */
+ lsn_t innodb_lsn_current;
+ lsn_t innodb_lsn_flushed;
+ lsn_t innodb_lsn_last_checkpoint;
+ trx_id_t innodb_max_trx_id;
+#ifdef BTR_CUR_HASH_ADAPT
+ ulint innodb_mem_adaptive_hash;
+#endif
+ ulint innodb_mem_dictionary;
lsn_t innodb_os_log_written; /*!< srv_os_log_written */
ulint innodb_os_log_fsyncs; /*!< fil_n_log_flushes */
ulint innodb_os_log_pending_writes; /*!< srv_os_log_pending_writes */
ulint innodb_os_log_pending_fsyncs; /*!< fil_n_pending_log_flushes */
- ulint innodb_page_size; /*!< srv_page_size */
ulint innodb_pages_created; /*!< buf_pool->stat.n_pages_created */
ulint innodb_pages_read; /*!< buf_pool->stat.n_pages_read*/
ulint innodb_pages_written; /*!< buf_pool->stat.n_pages_written */
@@ -982,8 +997,7 @@ struct export_var_t{
ulint innodb_system_rows_deleted; /*!< srv_n_system_rows_deleted*/
ulint innodb_num_open_files; /*!< fil_system_t::n_open */
ulint innodb_truncated_status_writes; /*!< srv_truncated_status_writes */
- ulint innodb_available_undo_logs; /*!< srv_available_undo_logs
- */
+
/** Number of undo tablespace truncation operations */
ulong innodb_undo_truncations;
ulint innodb_defragment_compression_failures; /*!< Number of
diff --git a/storage/innobase/include/trx0i_s.h b/storage/innobase/include/trx0i_s.h
index 65c7d321597..4eab97c0b02 100644
--- a/storage/innobase/include/trx0i_s.h
+++ b/storage/innobase/include/trx0i_s.h
@@ -45,17 +45,9 @@ i_s_trx_row_t::trx_query */
#define TRX_I_S_TRX_QUERY_MAX_LEN 1024
/** The maximum length of a string that can be stored in
-i_s_trx_row_t::trx_operation_state */
-#define TRX_I_S_TRX_OP_STATE_MAX_LEN 64
-
-/** The maximum length of a string that can be stored in
i_s_trx_row_t::trx_foreign_key_error */
#define TRX_I_S_TRX_FK_ERROR_MAX_LEN 256
-/** The maximum length of a string that can be stored in
-i_s_trx_row_t::trx_isolation_level */
-#define TRX_I_S_TRX_ISOLATION_LEVEL_MAX_LEN 16
-
/** Safely copy strings in to the INNODB_TRX table's
string based columns */
#define TRX_I_S_STRING_COPY(data, field, constraint, tcache) \
@@ -94,23 +86,21 @@ struct i_s_hash_chain_t {
/** This structure represents INFORMATION_SCHEMA.innodb_locks row */
struct i_s_locks_row_t {
trx_id_t lock_trx_id; /*!< transaction identifier */
- const char* lock_mode; /*!< lock mode from
- lock_get_mode_str() */
- const char* lock_type; /*!< lock type from
- lock_get_type_str() */
const char* lock_table; /*!< table name from
lock_get_table_name() */
- const char* lock_index; /*!< index name from
- lock_rec_get_index_name() */
- /** Information for record locks. All these are
- ULINT_UNDEFINED for table locks. */
- /* @{ */
- ulint lock_space; /*!< tablespace identifier */
- ulint lock_page; /*!< page number within the_space */
- ulint lock_rec; /*!< heap number of the record
- on the page */
- const char* lock_data; /*!< (some) content of the record */
- /* @} */
+ /** index name of a record lock; NULL for table locks */
+ const char* lock_index;
+ /** tablespace identifier of the record; 0 if !lock_index */
+ uint32_t lock_space;
+ /** page number of the record; 0 if !lock_index */
+ uint32_t lock_page;
+ /** heap number of the record; 0 if !lock_index */
+ uint16_t lock_rec;
+ /** lock mode corresponding to lock_mode_values_typelib */
+ uint8_t lock_mode;
+ /** (some) content of the record, if available in the buffer pool;
+ NULL if !lock_index */
+ const char* lock_data;
/** The following are auxiliary and not included in the table */
/* @{ */
@@ -154,17 +144,17 @@ struct i_s_trx_row_t {
ulint trx_concurrency_tickets;
/*!< n_tickets_to_enter_innodb in
trx_t */
- const char* trx_isolation_level;
- /*!< isolation_level in trx_t */
- ibool trx_unique_checks;
+ uint trx_isolation_level;
+ /*!< trx_t::isolation_level */
+ bool trx_unique_checks;
/*!< check_unique_secondary in trx_t*/
- ibool trx_foreign_key_checks;
+ bool trx_foreign_key_checks;
/*!< check_foreigns in trx_t */
const char* trx_foreign_key_error;
/*!< detailed_error in trx_t */
- ulint trx_is_read_only;
+ bool trx_is_read_only;
/*!< trx_t::read_only */
- ulint trx_is_autocommit_non_locking;
+ bool trx_is_autocommit_non_locking;
/*!< trx_is_autocommit_non_locking(trx)
*/
};
diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h
index 350615eee64..2245168b169 100644
--- a/storage/innobase/include/trx0trx.h
+++ b/storage/innobase/include/trx0trx.h
@@ -868,7 +868,7 @@ public:
const char* op_info; /*!< English text describing the
current operation, or an empty
string */
- ulint isolation_level;/*!< TRX_ISO_REPEATABLE_READ, ... */
+ uint isolation_level;/*!< TRX_ISO_REPEATABLE_READ, ... */
bool check_foreigns; /*!< normally TRUE, but if the user
wants to suppress foreign key checks,
(in table imports, for example) we
diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i
index 644a9484af4..28e4decf6f3 100644
--- a/storage/innobase/include/univ.i
+++ b/storage/innobase/include/univ.i
@@ -445,8 +445,6 @@ typedef ib_uint64_t lsn_t;
/** The 'undefined' value for a ulint */
#define ULINT_UNDEFINED ((ulint)(-1))
-#define ULONG_UNDEFINED ((ulong)(-1))
-
/** The 'undefined' value for a ib_uint64_t */
#define UINT64_UNDEFINED ((ib_uint64_t)(-1))
diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc
index 23b3b9f4d14..d01fd73892e 100644
--- a/storage/innobase/lock/lock0lock.cc
+++ b/storage/innobase/lock/lock0lock.cc
@@ -552,7 +552,7 @@ void lock_sys_t::close()
if (!m_initialised) return;
if (lock_latest_err_file != NULL) {
- fclose(lock_latest_err_file);
+ my_fclose(lock_latest_err_file, MYF(MY_WME));
lock_latest_err_file = NULL;
}
@@ -2427,8 +2427,8 @@ lock_rec_inherit_to_gap(
ut_ad(lock_mutex_own());
- /* If srv_locks_unsafe_for_binlog is TRUE or session is using
- READ COMMITTED isolation level, we do not want locks set
+ /* At READ UNCOMMITTED or READ COMMITTED isolation level,
+ we do not want locks set
by an UPDATE or a DELETE to be inherited as gap type locks. But we
DO want S-locks/X-locks(taken for replace) set by a consistency
constraint to be inherited also then. */
@@ -2438,11 +2438,9 @@ lock_rec_inherit_to_gap(
lock = lock_rec_get_next(heap_no, lock)) {
if (!lock_rec_get_insert_intention(lock)
- && !((srv_locks_unsafe_for_binlog
- || lock->trx->isolation_level
- <= TRX_ISO_READ_COMMITTED)
- && lock_get_mode(lock) ==
- (lock->trx->duplicates ? LOCK_S : LOCK_X))) {
+ && (lock->trx->isolation_level > TRX_ISO_READ_COMMITTED
+ || lock_get_mode(lock) !=
+ (lock->trx->duplicates ? LOCK_S : LOCK_X))) {
lock_rec_add_to_queue(
LOCK_REC | LOCK_GAP
| ulint(lock_get_mode(lock)),
@@ -5987,71 +5985,6 @@ lock_get_trx_id(
}
/*******************************************************************//**
-Gets the mode of a lock in a human readable string.
-The string should not be free()'d or modified.
-@return lock mode */
-const char*
-lock_get_mode_str(
-/*==============*/
- const lock_t* lock) /*!< in: lock */
-{
- ibool is_gap_lock;
-
- is_gap_lock = lock_get_type_low(lock) == LOCK_REC
- && lock_rec_get_gap(lock);
-
- switch (lock_get_mode(lock)) {
- case LOCK_S:
- if (is_gap_lock) {
- return("S,GAP");
- } else {
- return("S");
- }
- case LOCK_X:
- if (is_gap_lock) {
- return("X,GAP");
- } else {
- return("X");
- }
- case LOCK_IS:
- if (is_gap_lock) {
- return("IS,GAP");
- } else {
- return("IS");
- }
- case LOCK_IX:
- if (is_gap_lock) {
- return("IX,GAP");
- } else {
- return("IX");
- }
- case LOCK_AUTO_INC:
- return("AUTO_INC");
- default:
- return("UNKNOWN");
- }
-}
-
-/*******************************************************************//**
-Gets the type of a lock in a human readable string.
-The string should not be free()'d or modified.
-@return lock type */
-const char*
-lock_get_type_str(
-/*==============*/
- const lock_t* lock) /*!< in: lock */
-{
- switch (lock_get_type_low(lock)) {
- case LOCK_REC:
- return("RECORD");
- case LOCK_TABLE:
- return("TABLE");
- default:
- return("UNKNOWN");
- }
-}
-
-/*******************************************************************//**
Gets the table on which the lock is.
@return table */
UNIV_INLINE
@@ -6127,32 +6060,6 @@ lock_rec_get_index_name(
return(lock->index->name);
}
-/*******************************************************************//**
-For a record lock, gets the tablespace number on which the lock is.
-@return tablespace number */
-ulint
-lock_rec_get_space_id(
-/*==================*/
- const lock_t* lock) /*!< in: lock */
-{
- ut_a(lock_get_type_low(lock) == LOCK_REC);
-
- return(lock->un_member.rec_lock.space);
-}
-
-/*******************************************************************//**
-For a record lock, gets the page number on which the lock is.
-@return page number */
-ulint
-lock_rec_get_page_no(
-/*=================*/
- const lock_t* lock) /*!< in: lock */
-{
- ut_a(lock_get_type_low(lock) == LOCK_REC);
-
- return(lock->un_member.rec_lock.page_no);
-}
-
/*********************************************************************//**
Cancels a waiting lock request and releases possible other transactions
waiting behind it. */
@@ -6938,6 +6845,7 @@ DeadlockChecker::check_and_resolve(const lock_t* lock, trx_t* trx)
rollback_print(victim_trx, lock);
MONITOR_INC(MONITOR_DEADLOCK);
+ srv_stats.lock_deadlock_count.inc();
break;
@@ -6950,6 +6858,7 @@ DeadlockChecker::check_and_resolve(const lock_t* lock, trx_t* trx)
lock_deadlock_found = true;
MONITOR_INC(MONITOR_DEADLOCK);
+ srv_stats.lock_deadlock_count.inc();
}
} while (victim_trx != NULL && victim_trx != trx);
diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc
index f3052bc9e2e..2643c96065c 100644
--- a/storage/innobase/log/log0log.cc
+++ b/storage/innobase/log/log0log.cc
@@ -83,12 +83,6 @@ reduce the size of the log.
/** Redo log system */
log_t log_sys;
-/** Whether to generate and require checksums on the redo log pages */
-my_bool innodb_log_checksums;
-
-/** Pointer to the log checksum calculation function */
-log_checksum_func_t log_checksum_algorithm_ptr;
-
/* Next log block number to do dummy record filling if no log records written
for a while */
static ulint next_lbn_to_pad = 0;
@@ -609,6 +603,12 @@ void log_t::files::create(ulint n_files)
lsn_offset= LOG_FILE_HDR_SIZE;
}
+/** Update the log block checksum. */
+inline void log_block_store_checksum(byte* block)
+{
+ log_block_set_checksum(block, log_block_calc_checksum_crc32(block));
+}
+
/******************************************************//**
Writes a log file header to a log file space. */
static
@@ -638,7 +638,7 @@ log_file_header_flush(
LOG_HEADER_CREATOR_CURRENT);
ut_ad(LOG_HEADER_CREATOR_END - LOG_HEADER_CREATOR
>= sizeof LOG_HEADER_CREATOR_CURRENT);
- log_block_set_checksum(buf, log_block_calc_checksum_crc32(buf));
+ log_block_store_checksum(buf);
dest_offset = nth_file * log_sys.log.file_size;
@@ -662,19 +662,6 @@ log_file_header_flush(
}
/******************************************************//**
-Stores a 4-byte checksum to the trailer checksum field of a log block
-before writing it to a log file. This checksum is used in recovery to
-check the consistency of a log block. */
-static
-void
-log_block_store_checksum(
-/*=====================*/
- byte* block) /*!< in/out: pointer to a log block */
-{
- log_block_set_checksum(block, log_block_calc_checksum(block));
-}
-
-/******************************************************//**
Writes a buffer to a log file. */
static
void
@@ -1252,7 +1239,7 @@ log_group_checkpoint(lsn_t end_lsn)
srv_log_buffer_size);
mach_write_to_8(buf + LOG_CHECKPOINT_END_LSN, end_lsn);
- log_block_set_checksum(buf, log_block_calc_checksum_crc32(buf));
+ log_block_store_checksum(buf);
MONITOR_INC(MONITOR_PENDING_CHECKPOINT_WRITE);
diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc
index 9e886aca902..47c9adeeb78 100644
--- a/storage/innobase/log/log0recv.cc
+++ b/storage/innobase/log/log0recv.cc
@@ -55,15 +55,13 @@ Created 9/20/1997 Heikki Tuuri
#include "buf0rea.h"
#include "srv0srv.h"
#include "srv0start.h"
-#include "trx0roll.h"
-#include "row0merge.h"
/** Log records are stored in the hash table in chunks at most of this size;
this must be less than srv_page_size as it is stored in the buffer pool */
#define RECV_DATA_BLOCK_SIZE (MEM_MAX_ALLOC_IN_BUF - sizeof(recv_data_t) - REDZONE_SIZE)
/** Read-ahead area in applying log records to file pages */
-#define RECV_READ_AHEAD_AREA 32
+#define RECV_READ_AHEAD_AREA 32U
/** The recovery system */
recv_sys_t recv_sys;
@@ -117,7 +115,6 @@ the recovery failed and the database may be corrupt. */
static lsn_t recv_max_page_lsn;
#ifdef UNIV_PFS_THREAD
-mysql_pfs_key_t trx_rollback_clean_thread_key;
mysql_pfs_key_t recv_writer_thread_key;
#endif /* UNIV_PFS_THREAD */
@@ -181,37 +178,6 @@ typedef std::map<
static recv_spaces_t recv_spaces;
-/** States of recv_addr_t */
-enum recv_addr_state {
- /** not yet processed */
- RECV_NOT_PROCESSED,
- /** not processed; the page will be reinitialized */
- RECV_WILL_NOT_READ,
- /** page is being read */
- RECV_BEING_READ,
- /** log records are being applied on the page */
- RECV_BEING_PROCESSED,
- /** log records have been applied on the page */
- RECV_PROCESSED,
- /** log records have been discarded because the tablespace
- does not exist */
- RECV_DISCARDED
-};
-
-/** Hashed page file address struct */
-struct recv_addr_t{
- /** recovery state of the page */
- recv_addr_state state;
- /** tablespace identifier */
- unsigned space:32;
- /** page number */
- unsigned page_no:32;
- /** list of log records for this page */
- UT_LIST_BASE_NODE_T(recv_t) rec_list;
- /** hash node in the hash bucket chain */
- hash_node_t addr_hash;
-};
-
/** Report optimized DDL operation (without redo log),
corresponding to MLOG_INDEX_LOAD.
@param[in] space_id tablespace identifier
@@ -253,19 +219,18 @@ private:
ut_allocator<std::pair<const page_id_t, init> > >
map;
/** Map of page initialization operations.
- FIXME: Merge this to recv_sys.addr_hash! */
+ FIXME: Merge this to recv_sys.pages! */
map inits;
public:
/** Record that a page will be initialized by the redo log.
- @param[in] space tablespace identifier
- @param[in] page_no page number
+ @param[in] page_id page identifier
@param[in] lsn log sequence number */
- void add(ulint space, ulint page_no, lsn_t lsn)
+ void add(const page_id_t page_id, lsn_t lsn)
{
ut_ad(mutex_own(&recv_sys.mutex));
const init init = { lsn, false };
std::pair<map::iterator, bool> p = inits.insert(
- map::value_type(page_id_t(space, page_no), init));
+ map::value_type(page_id, init));
ut_ad(!p.first->second.created);
if (!p.second && p.first->second.lsn < init.lsn) {
p.first->second = init;
@@ -289,42 +254,37 @@ public:
{
ut_ad(mutex_own(&recv_sys.mutex));
ut_ad(recv_no_ibuf_operations);
- for (map::iterator i= inits.begin(); i != inits.end(); i++) {
- i->second.created = false;
+ for (auto &i : inits) {
+ i.second.created = false;
}
}
- /** On the last recovery batch, merge buffered changes to those
- pages that were initialized by buf_page_create() and still reside
- in the buffer pool. Stale pages are not allowed in the buffer pool.
+ /** On the last recovery batch, mark whether the page contains
+ change buffered changes for the list of pages that were initialized
+ by buf_page_create() and still reside in the buffer pool.
Note: When MDEV-14481 implements redo log apply in the
background, we will have to ensure that buf_page_get_gen()
will not deliver stale pages to users (pages on which the
- change buffer was not merged yet). Normally, the change
- buffer merge is performed on I/O completion. Maybe, add a
- flag to buf_page_t and perform the change buffer merge on
- the first actual access?
+ change buffer was not merged yet).
@param[in,out] mtr dummy mini-transaction */
- void ibuf_merge(mtr_t& mtr)
+ void mark_ibuf_exist(mtr_t& mtr)
{
ut_ad(mutex_own(&recv_sys.mutex));
ut_ad(!recv_no_ibuf_operations);
mtr.start();
- for (map::const_iterator i= inits.begin(); i != inits.end();
- i++) {
- if (!i->second.created) {
+ for (const auto& i : inits) {
+ if (!i.second.created) {
continue;
}
if (buf_block_t* block = buf_page_get_gen(
- i->first, 0, RW_X_LATCH, NULL,
+ i.first, 0, RW_X_LATCH, NULL,
BUF_GET_IF_IN_POOL, __FILE__, __LINE__,
- &mtr, NULL)) {
+ &mtr)) {
mutex_exit(&recv_sys.mutex);
- ibuf_merge_or_delete_for_page(
- block, i->first,
- block->zip_size(), true);
+ block->page.ibuf_exist = ibuf_page_exists(
+ block->page);
mtr.commit();
mtr.start();
mutex_enter(&recv_sys.mutex);
@@ -340,54 +300,43 @@ public:
static mlog_init_t mlog_init;
-/** Process a MLOG_CREATE2 record that indicates that a tablespace
-is being shrunk in size.
-@param[in] space_id tablespace identifier
-@param[in] pages trimmed size of the file, in pages
-@param[in] lsn log sequence number of the operation */
-static void recv_addr_trim(ulint space_id, unsigned pages, lsn_t lsn)
+/** Process a record that indicates that a tablespace is
+being shrunk in size.
+@param page_id first page identifier that is not in the file
+@param lsn log sequence number of the shrink operation */
+inline void recv_sys_t::trim(const page_id_t page_id, lsn_t lsn)
{
- DBUG_ENTER("recv_addr_trim");
+ DBUG_ENTER("recv_sys_t::trim");
DBUG_LOG("ib_log",
"discarding log beyond end of tablespace "
- << page_id_t(space_id, pages) << " before LSN " << lsn);
- ut_ad(mutex_own(&recv_sys.mutex));
- for (ulint i = recv_sys.addr_hash->n_cells; i--; ) {
- hash_cell_t* const cell = hash_get_nth_cell(
- recv_sys.addr_hash, i);
- for (recv_addr_t* addr = static_cast<recv_addr_t*>(cell->node),
- *next;
- addr; addr = next) {
- next = static_cast<recv_addr_t*>(addr->addr_hash);
-
- if (addr->space != space_id || addr->page_no < pages) {
- continue;
+ << page_id << " before LSN " << lsn);
+ ut_ad(mutex_own(&mutex));
+ for (recv_sys_t::map::iterator p = pages.lower_bound(page_id);
+ p != pages.end() && p->first.space() == page_id.space();) {
+ for (recv_t** prev = &p->second.log;;) {
+ if (!*prev || (*prev)->start_lsn >= lsn) {
+ break;
}
+ DBUG_LOG("ib_log", "Discarding "
+ << get_mlog_string((*prev)->type)
+ << " for " << p->first << " at "
+ << (*prev)->start_lsn);
+ *prev = (*prev)->next;
+ }
- for (recv_t* recv = UT_LIST_GET_FIRST(addr->rec_list);
- recv; ) {
- recv_t* n = UT_LIST_GET_NEXT(rec_list, recv);
- if (recv->start_lsn < lsn) {
- DBUG_PRINT("ib_log",
- ("Discarding %s for"
- " page %u:%u at " LSN_PF,
- get_mlog_string(
- recv->type),
- addr->space, addr->page_no,
- recv->start_lsn));
- UT_LIST_REMOVE(addr->rec_list, recv);
- }
- recv = n;
- }
+ recv_sys_t::map::iterator r = p++;
+
+ if (!r->second.log) {
+ pages.erase(r);
}
}
- if (fil_space_t* space = fil_space_get(space_id)) {
+ if (fil_space_t* space = fil_space_get(page_id.space())) {
ut_ad(UT_LIST_GET_LEN(space->chain) == 1);
fil_node_t* file = UT_LIST_GET_FIRST(space->chain);
ut_ad(file->is_open());
os_file_truncate(file->name, file->handle,
- os_offset_t(pages) << srv_page_size_shift,
- true);
+ os_offset_t{page_id.page_no()}
+ << srv_page_size_shift, true);
}
DBUG_VOID_RETURN;
}
@@ -714,11 +663,7 @@ void recv_sys_t::close()
if (is_initialised()) {
dblwr.pages.clear();
-
- if (addr_hash) {
- hash_table_free(addr_hash);
- addr_hash = NULL;
- }
+ pages.clear();
if (heap) {
mem_heap_free(heap);
@@ -862,8 +807,6 @@ void recv_sys_t::create()
found_corrupt_fs = false;
mlog_checkpoint_lsn = 0;
- addr_hash = hash_create(size / 512);
- n_addrs = 0;
progress_time = time(NULL);
recv_max_page_lsn = 0;
@@ -875,12 +818,8 @@ void recv_sys_t::create()
inline void recv_sys_t::empty()
{
ut_ad(mutex_own(&mutex));
- ut_a(n_addrs == 0);
-
- hash_table_free(addr_hash);
+ pages.clear();
mem_heap_empty(heap);
-
- addr_hash = hash_create(buf_pool_get_curr_size() / 512);
}
/** Free most recovery data structures. */
@@ -890,13 +829,12 @@ void recv_sys_t::debug_free()
ut_ad(is_initialised());
mutex_enter(&mutex);
- hash_table_free(addr_hash);
+ pages.clear();
mem_heap_free(heap);
ut_free_dodump(buf, buf_size);
buf = NULL;
heap = NULL;
- addr_hash = NULL;
/* wake page cleaner up to progress */
if (!srv_read_only_mode) {
@@ -968,33 +906,31 @@ fail:
break;
}
- if (innodb_log_checksums || is_encrypted()) {
- ulint crc = log_block_calc_checksum_crc32(buf);
- ulint cksum = log_block_get_checksum(buf);
-
- DBUG_EXECUTE_IF("log_intermittent_checksum_mismatch", {
- static int block_counter;
- if (block_counter++ == 0) {
- cksum = crc + 1;
- }
- });
-
- if (crc != cksum) {
- ib::error() << "Invalid log block checksum."
- << " block: " << block_number
- << " checkpoint no: "
- << log_block_get_checkpoint_no(buf)
- << " expected: " << crc
- << " found: " << cksum;
- goto fail;
- }
+ ulint crc = log_block_calc_checksum_crc32(buf);
+ ulint cksum = log_block_get_checksum(buf);
- if (is_encrypted()
- && !log_crypt(buf, *start_lsn,
- OS_FILE_LOG_BLOCK_SIZE,
- LOG_DECRYPT)) {
- goto fail;
- }
+ DBUG_EXECUTE_IF("log_intermittent_checksum_mismatch", {
+ static int block_counter;
+ if (block_counter++ == 0) {
+ cksum = crc + 1;
+ }
+ });
+
+ if (crc != cksum) {
+ ib::error() << "Invalid log block checksum."
+ << " block: " << block_number
+ << " checkpoint no: "
+ << log_block_get_checkpoint_no(buf)
+ << " expected: " << crc
+ << " found: " << cksum;
+ goto fail;
+ }
+
+ if (is_encrypted()
+ && !log_crypt(buf, *start_lsn,
+ OS_FILE_LOG_BLOCK_SIZE,
+ LOG_DECRYPT)) {
+ goto fail;
}
ulint dl = log_block_get_data_len(buf);
@@ -1721,8 +1657,15 @@ parse_log:
ut_a(!page || ((ibool)!!page_is_comp(page)
== dict_table_is_comp(index->table)));
- ptr = page_zip_parse_compress_no_data(
- ptr, end_ptr, page, page_zip, index);
+ if (end_ptr == ptr) {
+ ptr = NULL;
+ break;
+ }
+ if (page &&
+ !page_zip_compress(block, index, *ptr, NULL)) {
+ ut_error;
+ }
+ ptr++;
}
break;
case MLOG_ZIP_WRITE_TRX_ID:
@@ -1757,74 +1700,14 @@ parse_log:
return(ptr);
}
-/*********************************************************************//**
-Calculates the fold value of a page file address: used in inserting or
-searching for a log record in the hash table.
-@return folded value */
-UNIV_INLINE
-ulint
-recv_fold(
-/*======*/
- ulint space, /*!< in: space */
- ulint page_no)/*!< in: page number */
-{
- return(ut_fold_ulint_pair(space, page_no));
-}
-
-/*********************************************************************//**
-Calculates the hash value of a page file address: used in inserting or
-searching for a log record in the hash table.
-@return folded value */
-UNIV_INLINE
-ulint
-recv_hash(
-/*======*/
- ulint space, /*!< in: space */
- ulint page_no)/*!< in: page number */
-{
- return(hash_calc_hash(recv_fold(space, page_no), recv_sys.addr_hash));
-}
-
-/*********************************************************************//**
-Gets the hashed file address struct for a page.
-@return file address struct, NULL if not found from the hash table */
-static
-recv_addr_t*
-recv_get_fil_addr_struct(
-/*=====================*/
- ulint space, /*!< in: space id */
- ulint page_no)/*!< in: page number */
-{
- ut_ad(mutex_own(&recv_sys.mutex));
-
- recv_addr_t* recv_addr;
-
- for (recv_addr = static_cast<recv_addr_t*>(
- HASH_GET_FIRST(recv_sys.addr_hash,
- recv_hash(space, page_no)));
- recv_addr != 0;
- recv_addr = static_cast<recv_addr_t*>(
- HASH_GET_NEXT(addr_hash, recv_addr))) {
-
- if (recv_addr->space == space
- && recv_addr->page_no == page_no) {
-
- return(recv_addr);
- }
- }
-
- return(NULL);
-}
-
/** Store a redo log record for applying.
@param type record type
-@param space tablespace identifier
-@param page_no page number
+@param page_id page identifier
@param body record body
@param rec_end end of record
@param lsn start LSN of the mini-transaction
@param end_lsn end LSN of the mini-transaction */
-inline void recv_sys_t::add(mlog_id_t type, ulint space, ulint page_no,
+inline void recv_sys_t::add(mlog_id_t type, const page_id_t page_id,
byte* body, byte* rec_end, lsn_t lsn,
lsn_t end_lsn)
{
@@ -1837,46 +1720,33 @@ inline void recv_sys_t::add(mlog_id_t type, ulint space, ulint page_no,
ut_ad(type != MLOG_INDEX_LOAD);
ut_ad(type != MLOG_TRUNCATE);
- recv_t* recv= static_cast<recv_t*>(mem_heap_alloc(heap, sizeof *recv));
-
- recv->type = type;
- recv->len = ulint(rec_end - body);
- recv->start_lsn = lsn;
- recv->end_lsn = end_lsn;
-
- recv_addr_t* recv_addr = recv_get_fil_addr_struct(space, page_no);
-
- if (recv_addr == NULL) {
- recv_addr = static_cast<recv_addr_t*>(
- mem_heap_alloc(heap, sizeof(recv_addr_t)));
-
- recv_addr->space = space;
- recv_addr->page_no = page_no;
- recv_addr->state = RECV_NOT_PROCESSED;
-
- UT_LIST_INIT(recv_addr->rec_list, &recv_t::rec_list);
-
- HASH_INSERT(recv_addr_t, addr_hash, addr_hash,
- recv_fold(space, page_no), recv_addr);
- n_addrs++;
- }
+ std::pair<map::iterator, bool> p = pages.insert(
+ map::value_type(page_id, recs_t{recs_t::RECV_NOT_PROCESSED,
+ NULL, NULL}));
+ recv_sys_t::recs_t& recs = p.first->second;
+ ut_ad(p.second == !recs.log);
+ ut_ad(p.second == !recs.last);
+ recv_data_t** prev_field;
switch (type) {
case MLOG_INIT_FILE_PAGE2:
case MLOG_ZIP_PAGE_COMPRESS:
case MLOG_INIT_FREE_PAGE:
/* Ignore any earlier redo log records for this page. */
- ut_ad(recv_addr->state == RECV_NOT_PROCESSED
- || recv_addr->state == RECV_WILL_NOT_READ);
- recv_addr->state = RECV_WILL_NOT_READ;
- mlog_init.add(space, page_no, lsn);
+ ut_ad(recs.state == recs_t::RECV_NOT_PROCESSED
+ || recs.state == recs_t::RECV_WILL_NOT_READ);
+ recs.state = recs_t::RECV_WILL_NOT_READ;
+ mlog_init.add(page_id, lsn);
+ recs.last = NULL;
+ /* fall through */
default:
- break;
- }
+ recv_t** prev = recs.last ? &recs.last->next : &recs.log;
- UT_LIST_ADD_LAST(recv_addr->rec_list, recv);
-
- recv_data_t** prev_field = &recv->data;
+ *prev = recs.last = new (mem_heap_alloc(heap, sizeof(recv_t)))
+ recv_t{NULL, uint32_t(rec_end - body), type, NULL,
+ lsn, end_lsn};
+ prev_field = &(*prev)->data;
+ }
/* Store the log record body in chunks of less than srv_page_size:
heap grows into the buffer pool, and bigger chunks could not
@@ -1911,39 +1781,31 @@ void
recv_data_copy_to_buf(
/*==================*/
byte* buf, /*!< in: buffer of length at least recv->len */
- recv_t* recv) /*!< in: log record */
+ const recv_t& recv) /*!< in: log record */
{
- recv_data_t* recv_data;
- ulint part_len;
- ulint len;
-
- len = recv->len;
- recv_data = recv->data;
-
- while (len > 0) {
- if (len > RECV_DATA_BLOCK_SIZE) {
- part_len = RECV_DATA_BLOCK_SIZE;
- } else {
- part_len = len;
- }
+ const recv_data_t* recv_data = recv.data;
+ ulint len = recv.len;
- ut_memcpy(buf, ((byte*) recv_data) + sizeof(recv_data_t),
- part_len);
+ do {
+ const ulint part_len = std::min<ulint>(len,
+ RECV_DATA_BLOCK_SIZE);
+ memcpy(buf, &reinterpret_cast<const byte*>(recv_data)[
+ sizeof(recv_data_t)],
+ part_len);
+ recv_data = recv_data->next;
buf += part_len;
len -= part_len;
-
- recv_data = recv_data->next;
- }
+ } while (len);
}
/** Apply the hashed log records to the page, if the page lsn is less than the
lsn of a log record.
@param[in,out] block buffer pool page
@param[in,out] mtr mini-transaction
-@param[in,out] recv_addr recovery address
+@param[in,out] p recovery address
@param[in,out] init page initialization operation, or NULL */
static void recv_recover_page(buf_block_t* block, mtr_t& mtr,
- recv_addr_t* recv_addr,
+ const recv_sys_t::map::iterator& p,
mlog_init_t::init* init = NULL)
{
page_t* page;
@@ -1952,19 +1814,18 @@ static void recv_recover_page(buf_block_t* block, mtr_t& mtr,
ut_ad(mutex_own(&recv_sys.mutex));
ut_ad(recv_sys.apply_log_recs);
ut_ad(recv_needed_recovery);
- ut_ad(recv_addr->state != RECV_BEING_PROCESSED);
- ut_ad(recv_addr->state != RECV_PROCESSED);
ut_ad(!init || init->created);
ut_ad(!init || init->lsn);
+ ut_ad(block->page.id == p->first);
+ ut_ad(p->second.state != recv_sys_t::recs_t::RECV_BEING_PROCESSED);
if (UNIV_UNLIKELY(srv_print_verbose_log == 2)) {
- fprintf(stderr, "Applying log to page %u:%u\n",
- recv_addr->space, recv_addr->page_no);
+ ib::info() << "Applying log to page " << block->page.id;
}
DBUG_LOG("ib_log", "Applying log to page " << block->page.id);
- recv_addr->state = RECV_BEING_PROCESSED;
+ p->second.state = recv_sys_t::recs_t::RECV_BEING_PROCESSED;
mutex_exit(&recv_sys.mutex);
page = block->frame;
@@ -1979,11 +1840,15 @@ static void recv_recover_page(buf_block_t* block, mtr_t& mtr,
bool free_page = false;
lsn_t start_lsn = 0, end_lsn = 0;
+ ut_d(lsn_t recv_start_lsn = 0);
const lsn_t init_lsn = init ? init->lsn : 0;
- for (recv_t* recv = UT_LIST_GET_FIRST(recv_addr->rec_list);
- recv; recv = UT_LIST_GET_NEXT(rec_list, recv)) {
+ for (const recv_t* recv = p->second.log; recv; recv = recv->next) {
ut_ad(recv->start_lsn);
+ ut_ad(recv->end_lsn);
+ ut_ad(recv_start_lsn < recv->start_lsn);
+ ut_d(recv_start_lsn = recv->start_lsn);
+ ut_ad(end_lsn <= recv->end_lsn);
end_lsn = recv->end_lsn;
ut_ad(end_lsn <= log_sys.log.scanned_lsn);
@@ -2008,10 +1873,10 @@ static void recv_recover_page(buf_block_t* block, mtr_t& mtr,
}
if (UNIV_UNLIKELY(srv_print_verbose_log == 2)) {
- fprintf(stderr, "apply " LSN_PF ":"
- " %d len " ULINTPF " page %u:%u\n",
- recv->start_lsn, recv->type, recv->len,
- recv_addr->space, recv_addr->page_no);
+ ib::info() << "apply " << recv->start_lsn
+ << ":" << recv->type
+ << " len " << recv->len
+ << " page " << block->page.id;
}
DBUG_LOG("ib_log", "apply " << recv->start_lsn << ": "
@@ -2026,7 +1891,7 @@ static void recv_recover_page(buf_block_t* block, mtr_t& mtr,
a separate buffer */
buf = static_cast<byte*>
(ut_malloc_nokey(recv->len));
- recv_data_copy_to_buf(buf, recv);
+ recv_data_copy_to_buf(buf, *recv);
} else {
buf = reinterpret_cast<byte*>(recv->data)
+ sizeof *recv->data;
@@ -2087,44 +1952,25 @@ static void recv_recover_page(buf_block_t* block, mtr_t& mtr,
recv_max_page_lsn = page_lsn;
}
- ut_ad(recv_addr->state == RECV_BEING_PROCESSED);
- recv_addr->state = RECV_PROCESSED;
+ ut_ad(p->second.state == recv_sys_t::recs_t::RECV_BEING_PROCESSED);
+ ut_ad(!recv_sys.pages.empty());
+ recv_sys.pages.erase(p);
- ut_a(recv_sys.n_addrs > 0);
- if (ulint n = --recv_sys.n_addrs) {
- if (recv_sys.report(now)) {
- ib::info() << "To recover: " << n << " pages from log";
- service_manager_extend_timeout(
- INNODB_EXTEND_TIMEOUT_INTERVAL, "To recover: " ULINTPF " pages from log", n);
- }
+ if (recv_sys.report(now)) {
+ const ulint n = recv_sys.pages.size();
+ ib::info() << "To recover: " << n << " pages from log";
+ service_manager_extend_timeout(
+ INNODB_EXTEND_TIMEOUT_INTERVAL, "To recover: " ULINTPF " pages from log", n);
}
}
-/** Reduces recv_sys.n_addrs for the corrupted page.
+/** Remove records for a corrupted page.
This function should called when srv_force_recovery > 0.
@param[in] page_id page id of the corrupted page */
void recv_recover_corrupt_page(page_id_t page_id)
{
- ut_ad(srv_force_recovery);
mutex_enter(&recv_sys.mutex);
-
- if (!recv_sys.apply_log_recs) {
- } else if (recv_addr_t* recv_addr = recv_get_fil_addr_struct(
- page_id.space(), page_id.page_no())) {
- switch (recv_addr->state) {
- case RECV_WILL_NOT_READ:
- ut_ad(!"wrong state");
- break;
- case RECV_BEING_PROCESSED:
- case RECV_PROCESSED:
- break;
- default:
- recv_addr->state = RECV_PROCESSED;
- ut_ad(recv_sys.n_addrs);
- recv_sys.n_addrs--;
- }
- }
-
+ recv_sys.pages.erase(page_id);
mutex_exit(&recv_sys.mutex);
}
@@ -2144,22 +1990,17 @@ void recv_recover_page(buf_page_t* bpage)
x-latch on it. This is needed for the operations to
the page to pass the debug checks. */
rw_lock_x_lock_move_ownership(&block->lock);
- buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
- ibool success = buf_page_get_known_nowait(
- RW_X_LATCH, block, BUF_KEEP_OLD,
- __FILE__, __LINE__, &mtr);
- ut_a(success);
+ buf_block_buf_fix_inc(block, __FILE__, __LINE__);
+ rw_lock_x_lock(&block->lock);
+ mtr.memo_push(block, MTR_MEMO_PAGE_X_FIX);
mutex_enter(&recv_sys.mutex);
- if (!recv_sys.apply_log_recs) {
- } else if (recv_addr_t* recv_addr = recv_get_fil_addr_struct(
- bpage->id.space(), bpage->id.page_no())) {
- switch (recv_addr->state) {
- case RECV_BEING_PROCESSED:
- case RECV_PROCESSED:
- break;
- default:
- recv_recover_page(block, mtr, recv_addr);
+ if (recv_sys.apply_log_recs) {
+ recv_sys_t::map::iterator p = recv_sys.pages.find(bpage->id);
+ if (p != recv_sys.pages.end()
+ && p->second.state
+ != recv_sys_t::recs_t::RECV_BEING_PROCESSED) {
+ recv_recover_page(block, mtr, p);
goto func_exit;
}
}
@@ -2173,32 +2014,35 @@ func_exit:
/** Reads in pages which have hashed log records, from an area around a given
page number.
@param[in] page_id page id */
-static void recv_read_in_area(const page_id_t page_id)
+static void recv_read_in_area(page_id_t page_id)
{
ulint page_nos[RECV_READ_AHEAD_AREA];
- ulint page_no = page_id.page_no()
- - (page_id.page_no() % RECV_READ_AHEAD_AREA);
+ compile_time_assert(ut_is_2pow(RECV_READ_AHEAD_AREA));
+ page_id.set_page_no(ut_2pow_round(page_id.page_no(),
+ RECV_READ_AHEAD_AREA));
+ const ulint up_limit = page_id.page_no() + RECV_READ_AHEAD_AREA;
ulint* p = page_nos;
- for (const ulint up_limit = page_no + RECV_READ_AHEAD_AREA;
- page_no < up_limit; page_no++) {
- recv_addr_t* recv_addr = recv_get_fil_addr_struct(
- page_id.space(), page_no);
- if (recv_addr
- && recv_addr->state == RECV_NOT_PROCESSED
- && !buf_page_peek(page_id_t(page_id.space(), page_no))) {
- recv_addr->state = RECV_BEING_READ;
- *p++ = page_no;
+ for (recv_sys_t::map::iterator i= recv_sys.pages.lower_bound(page_id);
+ i != recv_sys.pages.end()
+ && i->first.space() == page_id.space()
+ && i->first.page_no() < up_limit; i++) {
+ if (i->second.state == recv_sys_t::recs_t::RECV_NOT_PROCESSED
+ && !buf_page_peek(i->first)) {
+ i->second.state = recv_sys_t::recs_t::RECV_BEING_READ;
+ *p++ = i->first.page_no();
}
}
- mutex_exit(&recv_sys.mutex);
- buf_read_recv_pages(FALSE, page_id.space(), page_nos,
- ulint(p - page_nos));
- mutex_enter(&recv_sys.mutex);
+ if (p != page_nos) {
+ mutex_exit(&recv_sys.mutex);
+ buf_read_recv_pages(FALSE, page_id.space(), page_nos,
+ ulint(p - page_nos));
+ mutex_enter(&recv_sys.mutex);
+ }
}
-/** Apply the hash table of stored log records to persistent data pages.
+/** Apply recv_sys.pages to persistent data pages.
@param[in] last_batch whether the change buffer merge will be
performed as part of the operation */
void recv_apply_hashed_log_recs(bool last_batch)
@@ -2229,163 +2073,152 @@ void recv_apply_hashed_log_recs(bool last_batch)
ut_d(recv_no_log_write = recv_no_ibuf_operations);
- if (ulint n = recv_sys.n_addrs) {
- if (!log_sys.log.subformat && !srv_force_recovery
- && srv_undo_tablespaces_open) {
- ib::error() << "Recovery of separately logged"
- " TRUNCATE operations is no longer supported."
- " Set innodb_force_recovery=1"
- " if no *trunc.log files exist";
- recv_sys.found_corrupt_log = true;
- mutex_exit(&recv_sys.mutex);
- return;
- }
+ mtr_t mtr;
+ if (recv_sys.pages.empty()) {
+ goto done;
+ }
+
+ if (!log_sys.log.subformat && !srv_force_recovery
+ && srv_undo_tablespaces_open) {
+ ib::error() << "Recovery of separately logged"
+ " TRUNCATE operations is no longer supported."
+ " Set innodb_force_recovery=1"
+ " if no *trunc.log files exist";
+ recv_sys.found_corrupt_log = true;
+ mutex_exit(&recv_sys.mutex);
+ return;
+ } else {
const char* msg = last_batch
? "Starting final batch to recover "
: "Starting a batch to recover ";
+ const ulint n = recv_sys.pages.size();
ib::info() << msg << n << " pages from redo log.";
sd_notifyf(0, "STATUS=%s" ULINTPF " pages from redo log",
msg, n);
}
+
recv_sys.apply_log_recs = true;
recv_sys.apply_batch_on = true;
- for (ulint id = srv_undo_tablespaces_open; id--; ) {
- recv_sys_t::trunc& t = recv_sys.truncated_undo_spaces[id];
+ for (ulint id = srv_undo_tablespaces_open; id--;) {
+ const recv_sys_t::trunc& t= recv_sys.truncated_undo_spaces[id];
if (t.lsn) {
- recv_addr_trim(id + srv_undo_space_id_start, t.pages,
- t.lsn);
+ recv_sys.trim(page_id_t(id + srv_undo_space_id_start,
+ t.pages), t.lsn);
}
}
- mtr_t mtr;
+ for (recv_sys_t::map::iterator p = recv_sys.pages.begin();
+ p != recv_sys.pages.end();) {
+ const page_id_t page_id = p->first;
+ recv_sys_t::recs_t& recs = p->second;
+ ut_ad(recs.log);
- for (ulint i = 0; i < hash_get_n_cells(recv_sys.addr_hash); i++) {
- for (recv_addr_t* recv_addr = static_cast<recv_addr_t*>(
- HASH_GET_FIRST(recv_sys.addr_hash, i));
- recv_addr;
- recv_addr = static_cast<recv_addr_t*>(
- HASH_GET_NEXT(addr_hash, recv_addr))) {
- if (!UT_LIST_GET_LEN(recv_addr->rec_list)) {
+ switch (recs.state) {
+ case recv_sys_t::recs_t::RECV_BEING_READ:
+ case recv_sys_t::recs_t::RECV_BEING_PROCESSED:
+ p++;
+ continue;
+ case recv_sys_t::recs_t::RECV_NOT_PROCESSED:
+ apply:
+ mtr.start();
+ mtr.set_log_mode(MTR_LOG_NONE);
+ if (buf_block_t* block = buf_page_get_gen(
+ page_id, 0, RW_X_LATCH, NULL,
+ BUF_GET_IF_IN_POOL,
+ __FILE__, __LINE__, &mtr, NULL)) {
+ buf_block_dbg_add_level(
+ block, SYNC_NO_ORDER_CHECK);
+ recv_recover_page(block, mtr, p);
+ ut_ad(mtr.has_committed());
+ } else {
+ mtr.commit();
+ recv_read_in_area(page_id);
+ }
+ break;
+ case recv_sys_t::recs_t::RECV_WILL_NOT_READ:
+ mlog_init_t::init& i = mlog_init.last(page_id);
+ const lsn_t end_lsn = recs.last->end_lsn;
+ if (end_lsn < i.lsn) {
+ DBUG_LOG("ib_log", "skip log for page "
+ << page_id
+ << " LSN " << end_lsn
+ << " < " << i.lsn);
ignore:
- ut_a(recv_sys.n_addrs);
- recv_sys.n_addrs--;
+ recv_sys_t::map::iterator r = p++;
+ recv_sys.pages.erase(r);
continue;
}
- switch (recv_addr->state) {
- case RECV_BEING_READ:
- case RECV_BEING_PROCESSED:
- case RECV_PROCESSED:
- continue;
- case RECV_DISCARDED:
+ fil_space_t* space = fil_space_acquire_for_io(
+ page_id.space());
+ if (!space) {
goto ignore;
- case RECV_NOT_PROCESSED:
- case RECV_WILL_NOT_READ:
- break;
}
- const page_id_t page_id(recv_addr->space,
- recv_addr->page_no);
-
- if (recv_addr->state == RECV_NOT_PROCESSED) {
-apply:
- mtr.start();
- mtr.set_log_mode(MTR_LOG_NONE);
- if (buf_block_t* block = buf_page_get_gen(
- page_id, 0, RW_X_LATCH, NULL,
- BUF_GET_IF_IN_POOL,
- __FILE__, __LINE__, &mtr, NULL)) {
- buf_block_dbg_add_level(
- block, SYNC_NO_ORDER_CHECK);
- recv_recover_page(block, mtr,
- recv_addr);
- ut_ad(mtr.has_committed());
- } else {
- mtr.commit();
- recv_read_in_area(page_id);
- }
- } else {
- mlog_init_t::init& i = mlog_init.last(page_id);
- const lsn_t end_lsn = UT_LIST_GET_LAST(
- recv_addr->rec_list)->end_lsn;
-
- if (end_lsn < i.lsn) {
- DBUG_LOG("ib_log", "skip log for page "
- << page_id
- << " LSN " << end_lsn
- << " < " << i.lsn);
-skip:
- recv_addr->state = RECV_PROCESSED;
- goto ignore;
- }
-
- fil_space_t* space = fil_space_acquire_for_io(
- recv_addr->space);
- if (!space) {
- goto skip;
- }
-
- if (space->enable_lsn) {
+ if (space->enable_lsn) {
do_read:
- space->release_for_io();
- recv_addr->state = RECV_NOT_PROCESSED;
- goto apply;
- }
-
- /* Determine if a tablespace could be
- for an internal table for FULLTEXT INDEX.
- For those tables, no MLOG_INDEX_LOAD record
- used to be written when redo logging was
- disabled. Hence, we cannot optimize
- away page reads when crash-upgrading
- from MariaDB versions before 10.4,
- because all the redo log records for
- initializing and modifying the page in
- the past could be older than the page
- in the data file.
-
- The check is too broad, causing all
- tables whose names start with FTS_ to
- skip the optimization. */
- if ((log_sys.log.format
- & ~LOG_HEADER_FORMAT_ENCRYPTED)
- != LOG_HEADER_FORMAT_10_4
- && strstr(space->name, "/FTS_")) {
- goto do_read;
- }
+ space->release_for_io();
+ recs.state = recv_sys_t::recs_t::
+ RECV_NOT_PROCESSED;
+ goto apply;
+ }
- mtr.start();
- mtr.set_log_mode(MTR_LOG_NONE);
- buf_block_t* block = buf_page_create(
- page_id, space->zip_size(), &mtr);
- if (recv_addr->state == RECV_PROCESSED) {
- /* The page happened to exist
- in the buffer pool, or it was
- just being read in. Before
- buf_page_get_with_no_latch()
- returned, all changes must have
- been applied to the page already. */
- mtr.commit();
- } else {
- i.created = true;
- buf_block_dbg_add_level(
- block, SYNC_NO_ORDER_CHECK);
- mtr.x_latch_at_savepoint(0, block);
- recv_recover_page(block, mtr,
- recv_addr, &i);
- ut_ad(mtr.has_committed());
- }
+ /* Determine if a tablespace could be
+ for an internal table for FULLTEXT INDEX.
+ For those tables, no MLOG_INDEX_LOAD record
+ used to be written when redo logging was
+ disabled. Hence, we cannot optimize
+ away page reads when crash-upgrading
+ from MariaDB versions before 10.4,
+ because all the redo log records for
+ initializing and modifying the page in
+ the past could be older than the page
+ in the data file.
+
+ The check is too broad, causing all
+ tables whose names start with FTS_ to
+ skip the optimization. */
+ if ((log_sys.log.format
+ & ~LOG_HEADER_FORMAT_ENCRYPTED)
+ != LOG_HEADER_FORMAT_10_4
+ && strstr(space->name, "/FTS_")) {
+ goto do_read;
+ }
- space->release_for_io();
+ mtr.start();
+ mtr.set_log_mode(MTR_LOG_NONE);
+ buf_block_t* block = buf_page_create(
+ page_id, space->zip_size(), &mtr);
+ p = recv_sys.pages.find(page_id);
+ if (p == recv_sys.pages.end()) {
+ /* The page happened to exist
+ in the buffer pool, or it was
+ just being read in. Before
+ buf_page_get_with_no_latch()
+ returned, all changes must have
+ been applied to the page already. */
+ mtr.commit();
+ } else {
+ ut_ad(&recs == &p->second);
+ i.created = true;
+ buf_block_dbg_add_level(
+ block, SYNC_NO_ORDER_CHECK);
+ mtr.x_latch_at_savepoint(0, block);
+ recv_recover_page(block, mtr, p, &i);
+ ut_ad(mtr.has_committed());
}
+
+ space->release_for_io();
}
+
+ p = recv_sys.pages.lower_bound(page_id);
}
/* Wait until all the pages have been processed */
- while (recv_sys.n_addrs != 0) {
+ while (!recv_sys.pages.empty()) {
const bool abort = recv_sys.found_corrupt_log
|| recv_sys.found_corrupt_fs;
@@ -2405,6 +2238,7 @@ do_read:
mutex_enter(&(recv_sys.mutex));
}
+done:
if (!last_batch) {
/* Flush all the file pages to disk and invalidate them in
the buffer pool */
@@ -2434,7 +2268,7 @@ do_read:
mlog_init.reset();
} else if (!recv_no_ibuf_operations) {
/* We skipped this in buf_page_create(). */
- mlog_init.ibuf_merge(mtr);
+ mlog_init.mark_ibuf_exist(mtr);
}
recv_sys.apply_log_recs = false;
@@ -2791,7 +2625,7 @@ loop:
/* fall through */
case STORE_YES:
recv_sys.add(
- type, space, page_no, body,
+ type, page_id_t(space, page_no), body,
ptr + len, old_lsn,
recv_sys.recovered_lsn);
}
@@ -2975,7 +2809,8 @@ corrupted_log:
/* fall through */
case STORE_YES:
recv_sys.add(
- type, space, page_no,
+ type,
+ page_id_t(space, page_no),
body, ptr + len,
old_lsn,
new_recovered_lsn);
@@ -3285,7 +3120,6 @@ recv_group_scan_log_recs(
mutex_enter(&recv_sys.mutex);
recv_sys.len = 0;
recv_sys.recovered_offset = 0;
- recv_sys.n_addrs = 0;
recv_sys.empty();
srv_start_lsn = *contiguous_lsn;
recv_sys.parse_start_lsn = *contiguous_lsn;
@@ -3393,35 +3227,32 @@ recv_validate_tablespace(bool rescan, bool& missing_tablespace)
{
dberr_t err = DB_SUCCESS;
- for (ulint h = 0; h < hash_get_n_cells(recv_sys.addr_hash); h++) {
- for (recv_addr_t* recv_addr = static_cast<recv_addr_t*>(
- HASH_GET_FIRST(recv_sys.addr_hash, h));
- recv_addr != 0;
- recv_addr = static_cast<recv_addr_t*>(
- HASH_GET_NEXT(addr_hash, recv_addr))) {
-
- const ulint space = recv_addr->space;
-
- if (is_predefined_tablespace(space)) {
- continue;
- }
+ for (recv_sys_t::map::iterator p = recv_sys.pages.begin();
+ p != recv_sys.pages.end();) {
+ ut_ad(p->second.log);
+ const ulint space = p->first.space();
+ if (is_predefined_tablespace(space)) {
+next:
+ p++;
+ continue;
+ }
- recv_spaces_t::iterator i = recv_spaces.find(space);
- ut_ad(i != recv_spaces.end());
+ recv_spaces_t::iterator i = recv_spaces.find(space);
+ ut_ad(i != recv_spaces.end());
- switch (i->second.status) {
- case file_name_t::MISSING:
- err = recv_init_missing_space(err, i);
- i->second.status = file_name_t::DELETED;
- /* fall through */
- case file_name_t::DELETED:
- recv_addr->state = RECV_DISCARDED;
- /* fall through */
- case file_name_t::NORMAL:
- continue;
- }
- ut_ad(0);
+ switch (i->second.status) {
+ case file_name_t::NORMAL:
+ goto next;
+ case file_name_t::MISSING:
+ err = recv_init_missing_space(err, i);
+ i->second.status = file_name_t::DELETED;
+ /* fall through */
+ case file_name_t::DELETED:
+ recv_sys_t::map::iterator r = p++;
+ recv_sys.pages.erase(r);
+ continue;
}
+ ut_ad(0);
}
if (err != DB_SUCCESS) {
@@ -3574,7 +3405,7 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn)
const lsn_t end_lsn = mach_read_from_8(
buf + LOG_CHECKPOINT_END_LSN);
- ut_ad(recv_sys.n_addrs == 0);
+ ut_ad(recv_sys.pages.empty());
contiguous_lsn = checkpoint_lsn;
switch (log_sys.log.format) {
case 0:
@@ -3597,7 +3428,7 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn)
/* Look for MLOG_CHECKPOINT. */
recv_group_scan_log_recs(checkpoint_lsn, &contiguous_lsn, false);
/* The first scan should not have stored or applied any records. */
- ut_ad(recv_sys.n_addrs == 0);
+ ut_ad(recv_sys.pages.empty());
ut_ad(!recv_sys.found_corrupt_fs);
if (srv_read_only_mode && recv_needed_recovery) {
@@ -3747,7 +3578,7 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn)
}
}
} else {
- ut_ad(!rescan || recv_sys.n_addrs == 0);
+ ut_ad(!rescan || recv_sys.pages.empty());
}
if (log_sys.log.scanned_lsn < checkpoint_lsn
@@ -3852,43 +3683,8 @@ recv_recovery_from_checkpoint_finish(void)
/* Free up the flush_rbt. */
buf_flush_free_flush_rbt();
-}
-
-/********************************************************//**
-Initiates the rollback of active transactions. */
-void
-recv_recovery_rollback_active(void)
-/*===============================*/
-{
- ut_ad(!recv_writer_thread_active);
-
- /* Switch latching order checks on in sync0debug.cc, if
- --innodb-sync-debug=true (default) */
+ /* Enable innodb_sync_debug checks */
ut_d(sync_check_enable());
-
- /* We can't start any (DDL) transactions if UNDO logging
- has been disabled, additionally disable ROLLBACK of recovered
- user transactions. */
- if (srv_force_recovery < SRV_FORCE_NO_TRX_UNDO
- && !srv_read_only_mode) {
-
- /* Drop partially created indexes. */
- row_merge_drop_temp_indexes();
- /* Drop garbage tables. */
- row_mysql_drop_garbage_tables();
-
- /* Drop any auxiliary tables that were not dropped when the
- parent table was dropped. This can happen if the parent table
- was dropped but the server crashed before the auxiliary tables
- were dropped. */
- fts_drop_orphaned_tables();
-
- /* Rollback the uncommitted transactions which have no user
- session */
-
- trx_rollback_is_active = true;
- os_thread_create(trx_rollback_all_recovered, 0, 0);
- }
}
/** Find a doublewrite copy of a page.
diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
index ceb6c69aec8..2d04a7cddc9 100644
--- a/storage/innobase/os/os0file.cc
+++ b/storage/innobase/os/os0file.cc
@@ -1131,23 +1131,14 @@ os_file_create_tmpfile()
{
FILE* file = NULL;
WAIT_ALLOW_WRITES();
- os_file_t fd = innobase_mysql_tmpfile(NULL);
+ File fd = mysql_tmpfile("ib");
- if (fd != OS_FILE_CLOSED) {
-#ifdef _WIN32
- int crt_fd = _open_osfhandle((intptr_t)HANDLE(fd), 0);
- if (crt_fd != -1) {
- file = fdopen(crt_fd, "w+b");
- if (!file) {
- close(crt_fd);
- }
- }
-#else
- file = fdopen(fd, "w+b");
+ if (fd >= 0) {
+ file = my_fdopen(fd, 0, O_RDWR|O_TRUNC|O_CREAT|FILE_BINARY,
+ MYF(MY_WME));
if (!file) {
- close(fd);
+ my_close(fd, MYF(MY_WME));
}
-#endif
}
if (file == NULL) {
@@ -1677,6 +1668,7 @@ LinuxAIOHandler::resubmit(Slot* slot)
/* Resubmit an I/O request */
int ret = io_submit(m_array->io_ctx(m_segment), 1, &iocb);
+ srv_stats.buffered_aio_submitted.inc();
if (ret < -1) {
errno = -ret;
@@ -2041,6 +2033,7 @@ AIO::linux_dispatch(Slot* slot)
io_ctx_index = (slot->pos * m_n_segments) / m_slots.size();
int ret = io_submit(m_aio_ctx[io_ctx_index], 1, &iocb);
+ srv_stats.buffered_aio_submitted.inc();
/* io_submit() returns number of successfully queued requests
or -errno. */
@@ -2145,7 +2138,7 @@ and native aio.
bool
AIO::is_linux_native_aio_supported()
{
- int fd;
+ File fd;
io_context_t io_ctx;
char name[1000];
@@ -2158,7 +2151,7 @@ AIO::is_linux_native_aio_supported()
} else if (!srv_read_only_mode) {
/* Now check if tmpdir supports native aio ops. */
- fd = innobase_mysql_tmpfile(NULL);
+ fd = mysql_tmpfile("ib");
if (fd < 0) {
ib::warn()
@@ -2185,7 +2178,7 @@ AIO::is_linux_native_aio_supported()
strcpy(name + dirnamelen, "ib_logfile0");
- fd = open(name, O_RDONLY | O_CLOEXEC);
+ fd = my_open(name, O_RDONLY | O_CLOEXEC, MYF(0));
if (fd == -1) {
@@ -2223,6 +2216,7 @@ AIO::is_linux_native_aio_supported()
}
int err = io_submit(io_ctx, 1, &p_iocb);
+ srv_stats.buffered_aio_submitted.inc();
if (err >= 1) {
/* Now collect the submitted IO request. */
@@ -2230,7 +2224,7 @@ AIO::is_linux_native_aio_supported()
}
ut_free(buf);
- close(fd);
+ my_close(fd, MYF(MY_WME));
switch (err) {
case 1:
@@ -4699,48 +4693,6 @@ os_file_set_eof(
return(SetEndOfFile(h));
}
-/** This function can be called if one wants to post a batch of reads and
-prefers an i/o-handler thread to handle them all at once later. You must
-call os_aio_simulated_wake_handler_threads later to ensure the threads
-are not left sleeping! */
-void
-os_aio_simulated_put_read_threads_to_sleep()
-{
- AIO::simulated_put_read_threads_to_sleep();
-}
-
-/** This function can be called if one wants to post a batch of reads and
-prefers an i/o-handler thread to handle them all at once later. You must
-call os_aio_simulated_wake_handler_threads later to ensure the threads
-are not left sleeping! */
-void
-AIO::simulated_put_read_threads_to_sleep()
-{
- /* The idea of putting background IO threads to sleep is only for
- Windows when using simulated AIO. Windows XP seems to schedule
- background threads too eagerly to allow for coalescing during
- readahead requests. */
-
- if (srv_use_native_aio) {
- /* We do not use simulated AIO: do nothing */
-
- return;
- }
-
- os_aio_recommend_sleep_for_read_threads = true;
-
- for (ulint i = 0; i < os_aio_n_segments; i++) {
- AIO* array;
-
- get_array_and_local_segment(&array, i);
-
- if (array == s_reads) {
-
- os_event_reset(os_aio_segment_wait_events[i]);
- }
- }
-}
-
#endif /* !_WIN32*/
/** Does a syncronous read or write depending upon the type specified
@@ -5594,6 +5546,9 @@ AIO::AIO(
ulint n,
ulint segments)
:
+#ifdef WIN_ASYNC_IO
+ m_completion_port(new_completion_port()),
+#endif
m_slots(n),
m_n_segments(segments),
m_n_reserved()
@@ -5601,9 +5556,6 @@ AIO::AIO(
,m_aio_ctx(),
m_events(m_slots.size())
# endif /* LINUX_NATIVE_AIO */
-#ifdef WIN_ASYNC_IO
- ,m_completion_port(new_completion_port())
-#endif
{
ut_a(n > 0);
ut_a(m_n_segments > 0);
diff --git a/storage/innobase/page/page0cur.cc b/storage/innobase/page/page0cur.cc
index f777e7b8378..2c69b87cea4 100644
--- a/storage/innobase/page/page0cur.cc
+++ b/storage/innobase/page/page0cur.cc
@@ -1243,6 +1243,139 @@ page_direction_increment(
1U + page_header_get_field(page, PAGE_N_DIRECTION));
}
+/** Split a directory slot which owns too many records.
+@param[in,out] page index page
+@param[in,out] page_zip ROW_FORMAT=COMPRESSED page, or NULL
+@param[in] s the slot that needs to be split */
+static void page_dir_split_slot(page_t* page, page_zip_des_t* page_zip,
+ ulint s)
+{
+ ut_ad(!page_zip || page_is_comp(page));
+ ut_ad(s);
+
+ page_dir_slot_t* slot = page_dir_get_nth_slot(page, s);
+ const ulint n_owned = PAGE_DIR_SLOT_MAX_N_OWNED + 1;
+
+ ut_ad(page_dir_slot_get_n_owned(slot) == n_owned);
+ compile_time_assert((PAGE_DIR_SLOT_MAX_N_OWNED + 1) / 2
+ >= PAGE_DIR_SLOT_MIN_N_OWNED);
+
+ /* 1. We loop to find a record approximately in the middle of the
+ records owned by the slot. */
+
+ const rec_t* rec = page_dir_slot_get_rec(slot + PAGE_DIR_SLOT_SIZE);
+
+ for (ulint i = n_owned / 2; i--; ) {
+ rec = page_rec_get_next_const(rec);
+ }
+
+ /* 2. Add a directory slot immediately below this one. */
+ const ulint n_slots = page_dir_get_n_slots(page);
+ page_dir_set_n_slots(page, page_zip, n_slots + 1);
+ page_dir_slot_t* last_slot = page_dir_get_nth_slot(page, n_slots);
+ memmove(last_slot, last_slot + PAGE_DIR_SLOT_SIZE, slot - last_slot);
+
+ /* 3. We store the appropriate values to the new slot. */
+
+ page_dir_slot_set_rec(slot, rec);
+ page_dir_slot_set_n_owned(slot, page_zip, n_owned / 2);
+
+ /* 4. Finally, we update the number of records field of the
+ original slot */
+
+ page_dir_slot_set_n_owned(slot - PAGE_DIR_SLOT_SIZE,
+ page_zip, n_owned - (n_owned / 2));
+}
+
+/** Try to balance an underfilled directory slot with an adjacent one,
+so that there are at least the minimum number of records owned by the slot;
+this may result in merging the two slots.
+@param[in,out] page index page
+@param[in,out] page_zip ROW_FORMAT=COMPRESSED page, or NULL
+@param[in] s the slot to be balanced */
+static void page_dir_balance_slot(page_t* page, page_zip_des_t* page_zip,
+ ulint s)
+{
+ ut_ad(!page_zip || page_is_comp(page));
+ ut_ad(s > 0);
+
+ const ulint n_slots = page_dir_get_n_slots(page);
+
+ if (UNIV_UNLIKELY(s + 1 == n_slots)) {
+ /* The last directory slot cannot be balanced. */
+ return;
+ }
+
+ ut_ad(s < n_slots);
+
+ page_dir_slot_t* slot = page_dir_get_nth_slot(page, s);
+ page_dir_slot_t* up_slot = slot - PAGE_DIR_SLOT_SIZE;
+ const ulint up_n_owned = page_dir_slot_get_n_owned(up_slot);
+
+ ut_ad(page_dir_slot_get_n_owned(slot)
+ == PAGE_DIR_SLOT_MIN_N_OWNED - 1);
+
+ if (up_n_owned <= PAGE_DIR_SLOT_MIN_N_OWNED) {
+ compile_time_assert(2 * PAGE_DIR_SLOT_MIN_N_OWNED - 1
+ <= PAGE_DIR_SLOT_MAX_N_OWNED);
+ /* Merge the slots. */
+ ulint n_owned = page_dir_slot_get_n_owned(slot);
+ page_dir_slot_set_n_owned(slot, page_zip, 0);
+ page_dir_slot_set_n_owned(up_slot, page_zip,
+ n_owned
+ + page_dir_slot_get_n_owned(up_slot));
+ /* Shift the slots */
+ page_dir_slot_t* last_slot = page_dir_get_nth_slot(
+ page, n_slots - 1);
+ memmove(last_slot + PAGE_DIR_SLOT_SIZE, last_slot,
+ slot - last_slot);
+ mach_write_to_2(last_slot, 0);
+ page_dir_set_n_slots(page, page_zip, n_slots - 1);
+ return;
+ }
+
+ /* Transfer one record to the underfilled slot */
+ rec_t* old_rec = const_cast<rec_t*>(page_dir_slot_get_rec(slot));
+ rec_t* new_rec;
+
+ if (page_is_comp(page)) {
+ new_rec = rec_get_next_ptr(old_rec, TRUE);
+
+ rec_set_n_owned_new(old_rec, page_zip, 0);
+ rec_set_n_owned_new(new_rec, page_zip,
+ PAGE_DIR_SLOT_MIN_N_OWNED);
+ } else {
+ new_rec = rec_get_next_ptr(old_rec, FALSE);
+
+ rec_set_n_owned_old(old_rec, 0);
+ rec_set_n_owned_old(new_rec, PAGE_DIR_SLOT_MIN_N_OWNED);
+ }
+
+ page_dir_slot_set_rec(slot, new_rec);
+ page_dir_slot_set_n_owned(up_slot, page_zip, up_n_owned - 1);
+}
+
+/** Allocate space for inserting an index record.
+@param[in,out] page index page
+@param[in,out] page_zip ROW_FORMAT=COMPRESSED page, or NULL
+@param[in] need number of bytes needed
+@param[out] heap_no record heap number
+@return pointer to the start of the allocated buffer
+@retval NULL if allocation fails */
+static byte* page_mem_alloc_heap(page_t* page, page_zip_des_t* page_zip,
+ ulint need, ulint* heap_no)
+{
+ if (need > page_get_max_insert_size(page, 1)) {
+ return NULL;
+ }
+
+ byte* top = page_header_get_ptr(page, PAGE_HEAP_TOP);
+ page_header_set_ptr(page, page_zip, PAGE_HEAP_TOP, top + need);
+ *heap_no = page_dir_get_n_heap(page);
+ page_dir_set_n_heap(page, page_zip, 1 + *heap_no);
+ return top;
+}
+
/***********************************************************//**
Inserts a record next to page cursor on an uncompressed page.
Returns pointer to inserted record if succeed, i.e., enough
@@ -1636,8 +1769,8 @@ page_cur_insert_rec_zip(
if (!log_compressed) {
if (page_zip_compress(
- page_zip, page, index,
- level, NULL)) {
+ page_cur_get_block(cursor),
+ index, level, NULL)) {
page_cur_insert_rec_write_log(
insert_rec, rec_size,
cursor->rec, index, mtr);
@@ -2280,6 +2413,36 @@ page_cur_parse_delete_rec(
return(ptr);
}
+/** Prepend a record to the PAGE_FREE list.
+@param[in,out] page index page
+@param[in,out] page_zip ROW_FORMAT=COMPRESSED page, or NULL
+@param[in,out] rec record being deleted
+@param[in] index the index that the page belongs to
+@param[in] offsets rec_get_offsets(rec, index) */
+static void page_mem_free(page_t* page, page_zip_des_t* page_zip, rec_t* rec,
+ const dict_index_t* index, const ulint* offsets)
+{
+ ut_ad(rec_offs_validate(rec, index, offsets));
+ const rec_t* free = page_header_get_ptr(page, PAGE_FREE);
+
+ if (srv_immediate_scrub_data_uncompressed) {
+ /* scrub record */
+ memset(rec, 0, rec_offs_data_size(offsets));
+ }
+
+ page_rec_set_next(rec, free);
+ page_header_set_ptr(page, page_zip, PAGE_FREE, rec);
+ page_header_set_field(page, page_zip, PAGE_GARBAGE,
+ rec_offs_size(offsets)
+ + page_header_get_field(page, PAGE_GARBAGE));
+ if (page_zip) {
+ page_zip_dir_delete(page_zip, rec, index, offsets, free);
+ } else {
+ page_header_set_field(page, page_zip, PAGE_N_RECS,
+ ulint(page_get_n_recs(page)) - 1);
+ }
+}
+
/***********************************************************//**
Deletes a record at the page cursor. The cursor is moved to the next
record after the deleted one. */
@@ -2352,11 +2515,6 @@ page_cur_delete_rec(
cur_dir_slot = page_dir_get_nth_slot(page, cur_slot_no);
cur_n_owned = page_dir_slot_get_n_owned(cur_dir_slot);
- /* 0. Write the log record */
- if (mtr != 0) {
- page_cur_delete_rec_write_log(current_rec, index, mtr);
- }
-
/* 1. Reset the last insert info in the page header and increment
the modify clock for the frame */
@@ -2369,6 +2527,7 @@ page_cur_delete_rec(
if (mtr != 0) {
buf_block_modify_clock_inc(page_cur_get_block(cursor));
+ page_cur_delete_rec_write_log(current_rec, index, mtr);
}
/* 2. Find the next and the previous record. Note that the cursor is
diff --git a/storage/innobase/page/page0page.cc b/storage/innobase/page/page0page.cc
index 36dfabb7c49..3b12ebe2224 100644
--- a/storage/innobase/page/page0page.cc
+++ b/storage/innobase/page/page0page.cc
@@ -250,43 +250,6 @@ page_set_autoinc(
}
}
-/************************************************************//**
-Allocates a block of memory from the heap of an index page.
-@return pointer to start of allocated buffer, or NULL if allocation fails */
-byte*
-page_mem_alloc_heap(
-/*================*/
- page_t* page, /*!< in/out: index page */
- page_zip_des_t* page_zip,/*!< in/out: compressed page with enough
- space available for inserting the record,
- or NULL */
- ulint need, /*!< in: total number of bytes needed */
- ulint* heap_no)/*!< out: this contains the heap number
- of the allocated record
- if allocation succeeds */
-{
- byte* block;
- ulint avl_space;
-
- ut_ad(page && heap_no);
-
- avl_space = page_get_max_insert_size(page, 1);
-
- if (avl_space >= need) {
- block = page_header_get_ptr(page, PAGE_HEAP_TOP);
-
- page_header_set_ptr(page, page_zip, PAGE_HEAP_TOP,
- block + need);
- *heap_no = page_dir_get_n_heap(page);
-
- page_dir_set_n_heap(page, page_zip, 1 + *heap_no);
-
- return(block);
- }
-
- return(NULL);
-}
-
/**********************************************************//**
Writes a log record of page creation. */
UNIV_INLINE
@@ -456,10 +419,9 @@ page_create_zip(
handle */
{
page_t* page;
- page_zip_des_t* page_zip = buf_block_get_page_zip(block);
ut_ad(block);
- ut_ad(page_zip);
+ ut_ad(buf_block_get_page_zip(block));
ut_ad(dict_table_is_comp(index->table));
/* PAGE_MAX_TRX_ID or PAGE_ROOT_AUTO_INC are always 0 for
@@ -482,7 +444,7 @@ page_create_zip(
mach_write_to_2(PAGE_HEADER + PAGE_LEVEL + page, level);
mach_write_to_8(PAGE_HEADER + PAGE_MAX_TRX_ID + page, max_trx_id);
- if (!page_zip_compress(page_zip, page, index, page_zip_level, mtr)) {
+ if (!page_zip_compress(block, index, page_zip_level, mtr)) {
/* The compression of a newly created
page should always succeed. */
ut_error;
@@ -703,7 +665,7 @@ page_copy_rec_list_end(
if (new_page_zip) {
mtr_set_log_mode(mtr, log_mode);
- if (!page_zip_compress(new_page_zip, new_page, index,
+ if (!page_zip_compress(new_block, index,
page_zip_level, mtr)) {
/* Before trying to reorganize the page,
store the number of preceding records on the page. */
@@ -868,7 +830,7 @@ page_copy_rec_list_start(
DBUG_EXECUTE_IF("page_copy_rec_list_start_compress_fail",
goto zip_reorganize;);
- if (!page_zip_compress(new_page_zip, new_page, index,
+ if (!page_zip_compress(new_block, index,
page_zip_level, mtr)) {
ulint ret_pos;
#ifndef DBUG_OFF
@@ -1389,212 +1351,6 @@ page_move_rec_list_start(
return(TRUE);
}
-/**************************************************************//**
-Used to delete n slots from the directory. This function updates
-also n_owned fields in the records, so that the first slot after
-the deleted ones inherits the records of the deleted slots. */
-UNIV_INLINE
-void
-page_dir_delete_slot(
-/*=================*/
- page_t* page, /*!< in/out: the index page */
- page_zip_des_t* page_zip,/*!< in/out: compressed page, or NULL */
- ulint slot_no)/*!< in: slot to be deleted */
-{
- page_dir_slot_t* slot;
- ulint n_owned;
- ulint i;
- ulint n_slots;
-
- ut_ad(!page_zip || page_is_comp(page));
- ut_ad(slot_no > 0);
- ut_ad(slot_no + 1 < page_dir_get_n_slots(page));
-
- n_slots = page_dir_get_n_slots(page);
-
- /* 1. Reset the n_owned fields of the slots to be
- deleted */
- slot = page_dir_get_nth_slot(page, slot_no);
- n_owned = page_dir_slot_get_n_owned(slot);
- page_dir_slot_set_n_owned(slot, page_zip, 0);
-
- /* 2. Update the n_owned value of the first non-deleted slot */
-
- slot = page_dir_get_nth_slot(page, slot_no + 1);
- page_dir_slot_set_n_owned(slot, page_zip,
- n_owned + page_dir_slot_get_n_owned(slot));
-
- /* 3. Destroy the slot by copying slots */
- for (i = slot_no + 1; i < n_slots; i++) {
- rec_t* rec = (rec_t*)
- page_dir_slot_get_rec(page_dir_get_nth_slot(page, i));
- page_dir_slot_set_rec(page_dir_get_nth_slot(page, i - 1), rec);
- }
-
- /* 4. Zero out the last slot, which will be removed */
- mach_write_to_2(page_dir_get_nth_slot(page, n_slots - 1), 0);
-
- /* 5. Update the page header */
- page_header_set_field(page, page_zip, PAGE_N_DIR_SLOTS, n_slots - 1);
-}
-
-/**************************************************************//**
-Used to add n slots to the directory. Does not set the record pointers
-in the added slots or update n_owned values: this is the responsibility
-of the caller. */
-UNIV_INLINE
-void
-page_dir_add_slot(
-/*==============*/
- page_t* page, /*!< in/out: the index page */
- page_zip_des_t* page_zip,/*!< in/out: comprssed page, or NULL */
- ulint start) /*!< in: the slot above which the new slots
- are added */
-{
- page_dir_slot_t* slot;
- ulint n_slots;
-
- n_slots = page_dir_get_n_slots(page);
-
- ut_ad(start < n_slots - 1);
-
- /* Update the page header */
- page_dir_set_n_slots(page, page_zip, n_slots + 1);
-
- /* Move slots up */
- slot = page_dir_get_nth_slot(page, n_slots);
- memmove(slot, slot + PAGE_DIR_SLOT_SIZE,
- (n_slots - 1 - start) * PAGE_DIR_SLOT_SIZE);
-}
-
-/****************************************************************//**
-Splits a directory slot which owns too many records. */
-void
-page_dir_split_slot(
-/*================*/
- page_t* page, /*!< in/out: index page */
- page_zip_des_t* page_zip,/*!< in/out: compressed page whose
- uncompressed part will be written, or NULL */
- ulint slot_no)/*!< in: the directory slot */
-{
- rec_t* rec;
- page_dir_slot_t* new_slot;
- page_dir_slot_t* prev_slot;
- page_dir_slot_t* slot;
- ulint i;
- ulint n_owned;
-
- ut_ad(!page_zip || page_is_comp(page));
- ut_ad(slot_no > 0);
-
- slot = page_dir_get_nth_slot(page, slot_no);
-
- n_owned = page_dir_slot_get_n_owned(slot);
- ut_ad(n_owned == PAGE_DIR_SLOT_MAX_N_OWNED + 1);
-
- /* 1. We loop to find a record approximately in the middle of the
- records owned by the slot. */
-
- prev_slot = page_dir_get_nth_slot(page, slot_no - 1);
- rec = (rec_t*) page_dir_slot_get_rec(prev_slot);
-
- for (i = 0; i < n_owned / 2; i++) {
- rec = page_rec_get_next(rec);
- }
-
- ut_ad(n_owned / 2 >= PAGE_DIR_SLOT_MIN_N_OWNED);
-
- /* 2. We add one directory slot immediately below the slot to be
- split. */
-
- page_dir_add_slot(page, page_zip, slot_no - 1);
-
- /* The added slot is now number slot_no, and the old slot is
- now number slot_no + 1 */
-
- new_slot = page_dir_get_nth_slot(page, slot_no);
- slot = page_dir_get_nth_slot(page, slot_no + 1);
-
- /* 3. We store the appropriate values to the new slot. */
-
- page_dir_slot_set_rec(new_slot, rec);
- page_dir_slot_set_n_owned(new_slot, page_zip, n_owned / 2);
-
- /* 4. Finally, we update the number of records field of the
- original slot */
-
- page_dir_slot_set_n_owned(slot, page_zip, n_owned - (n_owned / 2));
-}
-
-/*************************************************************//**
-Tries to balance the given directory slot with too few records with the upper
-neighbor, so that there are at least the minimum number of records owned by
-the slot; this may result in the merging of two slots. */
-void
-page_dir_balance_slot(
-/*==================*/
- page_t* page, /*!< in/out: index page */
- page_zip_des_t* page_zip,/*!< in/out: compressed page, or NULL */
- ulint slot_no)/*!< in: the directory slot */
-{
- page_dir_slot_t* slot;
- page_dir_slot_t* up_slot;
- ulint n_owned;
- ulint up_n_owned;
- rec_t* old_rec;
- rec_t* new_rec;
-
- ut_ad(!page_zip || page_is_comp(page));
- ut_ad(slot_no > 0);
-
- slot = page_dir_get_nth_slot(page, slot_no);
-
- /* The last directory slot cannot be balanced with the upper
- neighbor, as there is none. */
-
- if (UNIV_UNLIKELY(slot_no + 1 == page_dir_get_n_slots(page))) {
-
- return;
- }
-
- up_slot = page_dir_get_nth_slot(page, slot_no + 1);
-
- n_owned = page_dir_slot_get_n_owned(slot);
- up_n_owned = page_dir_slot_get_n_owned(up_slot);
-
- ut_ad(n_owned == PAGE_DIR_SLOT_MIN_N_OWNED - 1);
-
- /* If the upper slot has the minimum value of n_owned, we will merge
- the two slots, therefore we assert: */
- ut_ad(2 * PAGE_DIR_SLOT_MIN_N_OWNED - 1 <= PAGE_DIR_SLOT_MAX_N_OWNED);
-
- if (up_n_owned > PAGE_DIR_SLOT_MIN_N_OWNED) {
-
- /* In this case we can just transfer one record owned
- by the upper slot to the property of the lower slot */
- old_rec = (rec_t*) page_dir_slot_get_rec(slot);
-
- if (page_is_comp(page)) {
- new_rec = rec_get_next_ptr(old_rec, TRUE);
-
- rec_set_n_owned_new(old_rec, page_zip, 0);
- rec_set_n_owned_new(new_rec, page_zip, n_owned + 1);
- } else {
- new_rec = rec_get_next_ptr(old_rec, FALSE);
-
- rec_set_n_owned_old(old_rec, 0);
- rec_set_n_owned_old(new_rec, n_owned + 1);
- }
-
- page_dir_slot_set_rec(slot, new_rec);
-
- page_dir_slot_set_n_owned(up_slot, page_zip, up_n_owned -1);
- } else {
- /* In this case we may merge the two slots */
- page_dir_delete_slot(page, page_zip, slot_no);
- }
-}
-
/************************************************************//**
Returns the nth record of the record list.
This is the inverse function of page_rec_get_n_recs_before().
diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc
index d0318b51f4a..27f58727a4c 100644
--- a/storage/innobase/page/page0zip.cc
+++ b/storage/innobase/page/page0zip.cc
@@ -365,16 +365,12 @@ page_zip_dir_get(
- PAGE_ZIP_DIR_SLOT_SIZE * (slot + 1)));
}
-/**********************************************************************//**
-Write a log record of compressing an index page. */
-static
-void
-page_zip_compress_write_log(
-/*========================*/
- const page_zip_des_t* page_zip,/*!< in: compressed page */
- const page_t* page, /*!< in: uncompressed page */
- dict_index_t* index, /*!< in: index of the B-tree node */
- mtr_t* mtr) /*!< in: mini-transaction */
+/** Write a MLOG_ZIP_PAGE_COMPRESS record of compressing an index page.
+@param[in,out] block ROW_FORMAT=COMPRESSED index page
+@param[in] index the index that the block belongs to
+@param[in,out] mtr mini-transaction */
+static void page_zip_compress_write_log(buf_block_t* block,
+ dict_index_t* index, mtr_t* mtr)
{
byte* log_ptr;
ulint trailer_size;
@@ -388,6 +384,8 @@ page_zip_compress_write_log(
return;
}
+ const page_t* page = block->frame;
+ const page_zip_des_t* page_zip = &block->page.zip;
/* Read the number of user records. */
trailer_size = ulint(page_dir_get_n_heap(page_zip->data))
- PAGE_HEAP_NO_USER_LOW;
@@ -406,9 +404,10 @@ page_zip_compress_write_log(
compile_time_assert(FIL_PAGE_DATA <= PAGE_DATA);
ut_a(page_zip->m_end + trailer_size <= page_zip_get_size(page_zip));
- log_ptr = mlog_write_initial_log_record_fast((page_t*) page,
- MLOG_ZIP_PAGE_COMPRESS,
- log_ptr, mtr);
+ log_ptr = mlog_write_initial_log_record_low(MLOG_ZIP_PAGE_COMPRESS,
+ block->page.id.space(),
+ block->page.id.page_no(),
+ log_ptr, mtr);
mach_write_to_2(log_ptr, ulint(page_zip->m_end - FIL_PAGE_TYPE));
log_ptr += 2;
mach_write_to_2(log_ptr, trailer_size);
@@ -425,6 +424,9 @@ page_zip_compress_write_log(
/* Write the uncompressed trailer of the compressed page. */
mlog_catenate_string(mtr, page_zip->data + page_zip_get_size(page_zip)
- trailer_size, trailer_size);
+ if (!innodb_log_optimize_ddl) {
+ block->page.init_on_flush = true;
+ }
}
/******************************************************//**
@@ -1225,17 +1227,12 @@ page_zip_compress_clust(
func_exit:
return(err);}
-/**********************************************************************//**
-Compress a page.
-@return TRUE on success, FALSE on failure; page_zip will be left
-intact on failure. */
-ibool
+/** Attempt to compress a ROW_FORMAT=COMPRESSED page.
+@retval true on success
+@retval false on failure; block->page.zip will be left intact. */
+bool
page_zip_compress(
-/*==============*/
- page_zip_des_t* page_zip, /*!< in: size; out: data,
- n_blobs, m_start, m_end,
- m_nonempty */
- const page_t* page, /*!< in: uncompressed page */
+ buf_block_t* block, /*!< in/out: buffer block */
dict_index_t* index, /*!< in: index of the B-tree
node */
ulint level, /*!< in: commpression level */
@@ -1268,6 +1265,9 @@ page_zip_compress(
my_bool cmp_per_index_enabled;
cmp_per_index_enabled = srv_cmp_per_index_enabled;
+ page_t* page = block->frame;
+ page_zip_des_t* page_zip = &block->page.zip;
+
ut_a(page_is_comp(page));
ut_a(fil_page_index_page_check(page));
ut_ad(page_simple_validate_new((page_t*) page));
@@ -1518,7 +1518,7 @@ err_exit:
+= time_diff;
mutex_exit(&page_zip_stat_per_index_mutex);
}
- return(FALSE);
+ return false;
}
err = deflateEnd(&c_stream);
@@ -1558,7 +1558,7 @@ err_exit:
#endif /* UNIV_ZIP_DEBUG */
if (mtr) {
- page_zip_compress_write_log(page_zip, page, index, mtr);
+ page_zip_compress_write_log(block, index, mtr);
}
UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
@@ -1589,7 +1589,7 @@ err_exit:
dict_index_zip_success(index);
}
- return(TRUE);
+ return true;
}
/**********************************************************************//**
@@ -4700,7 +4700,6 @@ page_zip_reorganize(
mtr_t* mtr) /*!< in: mini-transaction */
{
buf_pool_t* buf_pool = buf_pool_from_block(block);
- page_zip_des_t* page_zip = buf_block_get_page_zip(block);
page_t* page = buf_block_get_frame(block);
buf_block_t* temp_block;
page_t* temp_page;
@@ -4711,7 +4710,8 @@ page_zip_reorganize(
ut_ad(!index->table->is_temporary());
/* Note that page_zip_validate(page_zip, page, index) may fail here. */
UNIV_MEM_ASSERT_RW(page, srv_page_size);
- UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
+ UNIV_MEM_ASSERT_RW(buf_block_get_page_zip(block)->data,
+ page_zip_get_size(buf_block_get_page_zip(block)));
/* Disable logging */
mtr_log_t log_mode = mtr_set_log_mode(mtr, MTR_LOG_NONE);
@@ -4751,7 +4751,7 @@ page_zip_reorganize(
/* Restore logging. */
mtr_set_log_mode(mtr, log_mode);
- if (!page_zip_compress(page_zip, page, index, page_zip_level, mtr)) {
+ if (!page_zip_compress(block, index, page_zip_level, mtr)) {
buf_block_free(temp_block);
return(FALSE);
}
@@ -4769,16 +4769,15 @@ related to the storage of records. Also copy PAGE_MAX_TRX_ID.
NOTE: The caller must update the lock table and the adaptive hash index. */
void
page_zip_copy_recs(
-/*===============*/
- page_zip_des_t* page_zip, /*!< out: copy of src_zip
- (n_blobs, m_start, m_end,
- m_nonempty, data[0..size-1]) */
- page_t* page, /*!< out: copy of src */
+ buf_block_t* block, /*!< in/out: buffer block */
const page_zip_des_t* src_zip, /*!< in: compressed page */
const page_t* src, /*!< in: page */
dict_index_t* index, /*!< in: index of the B-tree */
mtr_t* mtr) /*!< in: mini-transaction */
{
+ page_t* page = block->frame;
+ page_zip_des_t* page_zip = &block->page.zip;
+
ut_ad(mtr_memo_contains_page(mtr, page, MTR_MEMO_PAGE_X_FIX));
ut_ad(mtr_memo_contains_page(mtr, src, MTR_MEMO_PAGE_X_FIX));
ut_ad(!dict_index_is_ibuf(index));
@@ -4854,7 +4853,7 @@ page_zip_copy_recs(
#ifdef UNIV_ZIP_DEBUG
ut_a(page_zip_validate(page_zip, page, index));
#endif /* UNIV_ZIP_DEBUG */
- page_zip_compress_write_log(page_zip, page, index, mtr);
+ page_zip_compress_write_log(block, index, mtr);
}
/** Parse and optionally apply MLOG_ZIP_PAGE_COMPRESS.
diff --git a/storage/innobase/pars/lexyy.cc b/storage/innobase/pars/lexyy.cc
index e7f3981e0fe..16e7e47069e 100644
--- a/storage/innobase/pars/lexyy.cc
+++ b/storage/innobase/pars/lexyy.cc
@@ -260,7 +260,7 @@ static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */
*/
#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
? (yy_buffer_stack)[(yy_buffer_stack_top)] \
- : NULL)
+ : 0)
/* Same as previous macro, but useful when we know that the buffer stack is not
* NULL or when we need an lvalue. For internal use only.
*/
diff --git a/storage/innobase/row/row0ftsort.cc b/storage/innobase/row/row0ftsort.cc
index e9076bfae50..45a5fee59ec 100644
--- a/storage/innobase/row/row0ftsort.cc
+++ b/storage/innobase/row/row0ftsort.cc
@@ -1032,12 +1032,12 @@ exit:
crypt_block[i], table->space_id);
if (error != DB_SUCCESS) {
- os_file_close(tmpfd[i]);
+ row_merge_file_destroy_low(tmpfd[i]);
goto func_exit;
}
total_rec += merge_file[i]->n_rec;
- os_file_close(tmpfd[i]);
+ row_merge_file_destroy_low(tmpfd[i]);
}
func_exit:
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index 3edd39f23b1..180577ecdae 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -2028,11 +2028,8 @@ end_of_index:
block = page_cur_get_block(cur);
block = btr_block_get(
- page_id_t(block->page.id.space(),
- next_page_no),
- block->zip_size(),
- BTR_SEARCH_LEAF,
- clust_index, &mtr);
+ *clust_index, next_page_no,
+ RW_S_LATCH, false, &mtr);
btr_leaf_page_release(page_cur_get_block(cur),
BTR_SEARCH_LEAF, &mtr);
@@ -4084,6 +4081,9 @@ pfs_os_file_t
row_merge_file_create_low(
const char* path)
{
+#ifdef WITH_INNODB_DISALLOW_WRITES
+ os_event_wait(srv_allow_writes_event);
+#endif /* WITH_INNODB_DISALLOW_WRITES */
#ifdef UNIV_PFS_IO
/* This temp file open does not go through normal
file APIs, add instrumentation to register with
@@ -4104,7 +4104,13 @@ row_merge_file_create_low(
PSI_FILE_CREATE, path ? name : label, __FILE__, __LINE__);
#endif
- pfs_os_file_t fd = innobase_mysql_tmpfile(path);
+ DBUG_ASSERT(strlen(path) + 2 <= FN_REFLEN);
+ char filename[FN_REFLEN];
+ File f = create_temp_file(filename, path, "ib",
+ O_BINARY | O_SEQUENTIAL,
+ MYF(MY_WME | MY_TEMPORARY));
+ pfs_os_file_t fd = IF_WIN(my_get_osfhandle(f), f);
+
#ifdef UNIV_PFS_IO
register_pfs_file_open_end(locker, fd,
(fd == OS_FILE_CLOSED)?NULL:&fd);
@@ -4149,7 +4155,9 @@ row_merge_file_destroy_low(
const pfs_os_file_t& fd) /*!< in: merge file descriptor */
{
if (fd != OS_FILE_CLOSED) {
- os_file_close(fd);
+ int res = mysql_file_close(IF_WIN(my_win_handle2File(fd), fd),
+ MYF(MY_WME));
+ ut_a(res != -1);
}
}
/*********************************************************************//**
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index 63e59956989..15daeec2e6c 100644
--- a/storage/innobase/row/row0mysql.cc
+++ b/storage/innobase/row/row0mysql.cc
@@ -1978,8 +1978,8 @@ error:
DBUG_RETURN(err);
}
-/** This can only be used when srv_locks_unsafe_for_binlog is TRUE or this
-session is using a READ COMMITTED or READ UNCOMMITTED isolation level.
+/** This can only be used when the current transaction is at
+READ COMMITTED or READ UNCOMMITTED isolation level.
Before calling this function row_search_for_mysql() must have
initialized prebuilt->new_rec_locks to store the information which new
record locks really were set. This function removes a newly set
@@ -2002,17 +2002,8 @@ row_unlock_for_mysql(
ut_ad(prebuilt != NULL);
ut_ad(trx != NULL);
+ ut_ad(trx->isolation_level <= TRX_ISO_READ_COMMITTED);
- if (UNIV_UNLIKELY
- (!srv_locks_unsafe_for_binlog
- && trx->isolation_level > TRX_ISO_READ_COMMITTED)) {
-
- ib::error() << "Calling row_unlock_for_mysql though"
- " innodb_locks_unsafe_for_binlog is FALSE and this"
- " session is not using READ COMMITTED isolation"
- " level.";
- return;
- }
if (dict_index_is_spatial(prebuilt->index)) {
return;
}
diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc
index 6c7a54ece7d..f0f1206ea82 100644
--- a/storage/innobase/row/row0sel.cc
+++ b/storage/innobase/row/row0sel.cc
@@ -963,12 +963,10 @@ row_sel_get_clust_rec(
trx = thr_get_trx(thr);
- /* If innodb_locks_unsafe_for_binlog option is used
- or this session is using READ COMMITTED or lower isolation level
+ /* At READ UNCOMMITTED or READ COMMITTED isolation level
we lock only the record, i.e., next-key locking is
not used. */
- if (srv_locks_unsafe_for_binlog
- || trx->isolation_level <= TRX_ISO_READ_COMMITTED) {
+ if (trx->isolation_level <= TRX_ISO_READ_COMMITTED) {
lock_type = LOCK_REC_NOT_GAP;
} else {
lock_type = LOCK_ORDINARY;
@@ -1738,16 +1736,11 @@ rec_loop:
true,
ULINT_UNDEFINED, &heap);
- /* If innodb_locks_unsafe_for_binlog option is used
- or this session is using READ COMMITTED or lower isolation
- level, we lock only the record, i.e., next-key
- locking is not used. */
- if (srv_locks_unsafe_for_binlog
- || trx->isolation_level
- <= TRX_ISO_READ_COMMITTED) {
-
+ /* At READ UNCOMMITTED or READ COMMITTED
+ isolation level, we lock only the record,
+ i.e., next-key locking is not used. */
+ if (trx->isolation_level <= TRX_ISO_READ_COMMITTED) {
if (page_rec_is_supremum(next_rec)) {
-
goto skip_lock;
}
@@ -1805,12 +1798,10 @@ skip_lock:
trx = thr_get_trx(thr);
- /* If innodb_locks_unsafe_for_binlog option is used
- or this session is using READ COMMITTED or lower isolation level,
+ /* At READ UNCOMMITTED or READ COMMITTED isolation level,
we lock only the record, i.e., next-key locking is
not used. */
- if (srv_locks_unsafe_for_binlog
- || trx->isolation_level <= TRX_ISO_READ_COMMITTED
+ if (trx->isolation_level <= TRX_ISO_READ_COMMITTED
|| dict_index_is_spatial(index)) {
if (page_rec_is_supremum(rec)) {
@@ -4197,29 +4188,18 @@ row_search_mvcc(
const rec_t* result_rec = NULL;
const rec_t* clust_rec;
Row_sel_get_clust_rec_for_mysql row_sel_get_clust_rec_for_mysql;
- dberr_t err = DB_SUCCESS;
ibool unique_search = FALSE;
ibool mtr_has_extra_clust_latch = FALSE;
ibool moves_up = FALSE;
- ibool set_also_gap_locks = TRUE;
- /* if the query is a plain locking SELECT, and the isolation level
- is <= TRX_ISO_READ_COMMITTED, then this is set to FALSE */
- ibool did_semi_consistent_read = FALSE;
/* if the returned record was locked and we did a semi-consistent
read (fetch the newest committed version), then this is set to
TRUE */
ulint next_offs;
ibool same_user_rec;
- mtr_t mtr;
- mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
ibool table_lock_waited = FALSE;
byte* next_buf = 0;
bool spatial_search = false;
- rec_offs_init(offsets_);
-
ut_ad(index && pcur && search_tuple);
ut_a(prebuilt->magic_n == ROW_PREBUILT_ALLOCATED);
ut_a(prebuilt->magic_n2 == ROW_PREBUILT_ALLOCATED);
@@ -4253,8 +4233,8 @@ row_search_mvcc(
&& (prebuilt->read_just_key
|| prebuilt->m_read_virtual_key);
- /* Reset the new record lock info if srv_locks_unsafe_for_binlog
- is set or session is using a READ COMMITED isolation level. Then
+ /* Reset the new record lock info if READ UNCOMMITTED or
+ READ COMMITED isolation level is used. Then
we are able to remove the record locks set here on an individual
row. */
prebuilt->new_rec_locks = 0;
@@ -4297,20 +4277,18 @@ row_search_mvcc(
row_sel_dequeue_cached_row_for_mysql(buf, prebuilt);
prebuilt->n_rows_fetched++;
-
- err = DB_SUCCESS;
- goto func_exit;
+ trx->op_info = "";
+ DBUG_RETURN(DB_SUCCESS);
}
if (prebuilt->fetch_cache_first > 0
&& prebuilt->fetch_cache_first < MYSQL_FETCH_CACHE_SIZE) {
-
+early_not_found:
/* The previous returned row was popped from the fetch
cache, but the cache was not full at the time of the
popping: no more rows can exist in the result set */
-
- err = DB_RECORD_NOT_FOUND;
- goto func_exit;
+ trx->op_info = "";
+ DBUG_RETURN(DB_RECORD_NOT_FOUND);
}
prebuilt->n_rows_fetched++;
@@ -4354,22 +4332,28 @@ row_search_mvcc(
if (UNIV_UNLIKELY(direction != 0
&& !prebuilt->used_in_HANDLER)) {
-
- err = DB_RECORD_NOT_FOUND;
- goto func_exit;
+ goto early_not_found;
}
}
/* We don't support sequencial scan for Rtree index, because it
is no meaning to do so. */
- if (dict_index_is_spatial(index)
- && !RTREE_SEARCH_MODE(mode)) {
- err = DB_END_OF_INDEX;
- goto func_exit;
+ if (dict_index_is_spatial(index) && !RTREE_SEARCH_MODE(mode)) {
+ trx->op_info = "";
+ DBUG_RETURN(DB_END_OF_INDEX);
}
+ /* if the query is a plain locking SELECT, and the isolation level
+ is <= TRX_ISO_READ_COMMITTED, then this is set to FALSE */
+ bool did_semi_consistent_read = false;
+ mtr_t mtr;
mtr.start();
+ mem_heap_t* heap = NULL;
+ ulint offsets_[REC_OFFS_NORMAL_SIZE];
+ ulint* offsets = offsets_;
+ rec_offs_init(offsets_);
+
#ifdef BTR_CUR_HASH_ADAPT
/*-------------------------------------------------------------*/
/* PHASE 2: Try fast adaptive hash index search if possible */
@@ -4399,6 +4383,7 @@ row_search_mvcc(
let us try a search shortcut through the hash
index. */
+ dberr_t err = DB_SUCCESS;
switch (row_sel_try_search_shortcut_for_mysql(
&rec, prebuilt, &offsets, &heap,
&mtr)) {
@@ -4418,9 +4403,10 @@ row_search_mvcc(
case ICP_OUT_OF_RANGE:
case ICP_ABORTED_BY_USER:
case ICP_ERROR:
- goto shortcut_mismatch;
+ err = DB_RECORD_NOT_FOUND;
+ goto shortcut_done;
case ICP_MATCH:
- goto shortcut_match;
+ goto shortcut_done;
}
}
@@ -4443,21 +4429,19 @@ row_search_mvcc(
break;
}
- shortcut_match:
- mtr.commit();
-
- /* NOTE that we do NOT store the cursor
- position */
- err = DB_SUCCESS;
- goto func_exit;
+ goto shortcut_done;
case SEL_EXHAUSTED:
- shortcut_mismatch:
+ err = DB_RECORD_NOT_FOUND;
+ shortcut_done:
mtr.commit();
+
/* NOTE that we do NOT store the cursor
position */
- err = DB_RECORD_NOT_FOUND;
- goto func_exit;
+ trx->op_info = "";
+ ut_ad(!sync_check_iterate(sync_check()));
+ ut_ad(!did_semi_consistent_read);
+ DBUG_RETURN(err);
case SEL_RETRY:
break;
@@ -4495,22 +4479,16 @@ row_search_mvcc(
|| prebuilt->table->no_rollback()
|| srv_read_only_mode);
- if (trx->isolation_level <= TRX_ISO_READ_COMMITTED
- && prebuilt->select_lock_type != LOCK_NONE
- && trx->mysql_thd != NULL
- && thd_is_select(trx->mysql_thd)) {
- /* It is a plain locking SELECT and the isolation
- level is low: do not lock gaps */
-
- set_also_gap_locks = FALSE;
- }
+ /* Do not lock gaps for plain SELECT
+ at READ UNCOMMITTED or READ COMMITTED isolation level */
+ const bool set_also_gap_locks =
+ prebuilt->select_lock_type != LOCK_NONE
+ && (trx->isolation_level > TRX_ISO_READ_COMMITTED
+ || !thd_is_select(trx->mysql_thd))
#ifdef WITH_WSREP
- else if (wsrep_thd_skip_locking(trx->mysql_thd)) {
- ut_ad(!strcmp(wsrep_get_sr_table_name(),
- prebuilt->table->name.m_name));
- set_also_gap_locks = FALSE;
- }
+ && !wsrep_thd_skip_locking(trx->mysql_thd)
#endif /* WITH_WSREP */
+ ;
/* Note that if the search mode was GE or G, then the cursor
naturally moves upward (in fetch next) in alphabetical order,
@@ -4531,6 +4509,8 @@ row_search_mvcc(
clust_index = dict_table_get_first_index(prebuilt->table);
+ dberr_t err = DB_SUCCESS;
+
/* Do some start-of-statement preparations */
if (prebuilt->table->no_rollback()) {
@@ -4599,18 +4579,9 @@ wait_table_again:
pcur->btr_cur.thr = thr;
if (dict_index_is_spatial(index)) {
- bool need_pred_lock;
-
- need_pred_lock = (set_also_gap_locks
- && !(srv_locks_unsafe_for_binlog
- || trx->isolation_level
- <= TRX_ISO_READ_COMMITTED)
- && prebuilt->select_lock_type
- != LOCK_NONE);
-
if (!prebuilt->rtr_info) {
prebuilt->rtr_info = rtr_create_rtr_info(
- need_pred_lock, true,
+ set_also_gap_locks, true,
btr_pcur_get_btr_cur(pcur), index);
prebuilt->rtr_info->search_tuple = search_tuple;
prebuilt->rtr_info->search_mode = mode;
@@ -4619,7 +4590,7 @@ wait_table_again:
} else {
rtr_info_reinit_in_cursor(
btr_pcur_get_btr_cur(pcur),
- index, need_pred_lock);
+ index, set_also_gap_locks);
prebuilt->rtr_info->search_tuple = search_tuple;
prebuilt->rtr_info->search_mode = mode;
}
@@ -4640,11 +4611,8 @@ wait_table_again:
ut_ad(page_rec_is_leaf(rec));
if (!moves_up
- && !page_rec_is_supremum(rec)
&& set_also_gap_locks
- && !(srv_locks_unsafe_for_binlog
- || trx->isolation_level <= TRX_ISO_READ_COMMITTED)
- && prebuilt->select_lock_type != LOCK_NONE
+ && !page_rec_is_supremum(rec)
&& !dict_index_is_spatial(index)) {
/* Try to place a gap lock on the next index record
@@ -4724,16 +4692,14 @@ rec_loop:
if (page_rec_is_supremum(rec)) {
if (set_also_gap_locks
- && !(srv_locks_unsafe_for_binlog
- || trx->isolation_level <= TRX_ISO_READ_COMMITTED)
- && prebuilt->select_lock_type != LOCK_NONE
+ && trx->isolation_level > TRX_ISO_READ_COMMITTED
&& !dict_index_is_spatial(index)) {
/* Try to place a lock on the index record */
- /* If innodb_locks_unsafe_for_binlog option is used
- or this session is using a READ COMMITTED or lower isolation
- level we do not lock gaps. Supremum record is really
+ /* If the transaction isolation level is
+ READ UNCOMMITTED or READ COMMITTED,
+ we do not lock gaps. Supremum record is really
a gap and therefore we do not set locks there. */
offsets = rec_get_offsets(rec, index, offsets, true,
@@ -4872,17 +4838,7 @@ wrong_offs:
if (0 != cmp_dtuple_rec(search_tuple, rec, offsets)) {
if (set_also_gap_locks
- && !(srv_locks_unsafe_for_binlog
- || trx->isolation_level
- <= TRX_ISO_READ_COMMITTED)
- && prebuilt->select_lock_type != LOCK_NONE
&& !dict_index_is_spatial(index)) {
-
- /* Try to place a gap lock on the index
- record only if innodb_locks_unsafe_for_binlog
- option is not set or this session is not
- using a READ COMMITTED or lower isolation level. */
-
err = sel_set_rec_lock(
pcur,
rec, index, offsets,
@@ -4917,17 +4873,7 @@ wrong_offs:
if (!cmp_dtuple_is_prefix_of_rec(search_tuple, rec, offsets)) {
if (set_also_gap_locks
- && !(srv_locks_unsafe_for_binlog
- || trx->isolation_level
- <= TRX_ISO_READ_COMMITTED)
- && prebuilt->select_lock_type != LOCK_NONE
&& !dict_index_is_spatial(index)) {
-
- /* Try to place a gap lock on the index
- record only if innodb_locks_unsafe_for_binlog
- option is not set or this session is not
- using a READ COMMITTED or lower isolation level. */
-
err = sel_set_rec_lock(
pcur,
rec, index, offsets,
@@ -4967,15 +4913,9 @@ wrong_offs:
is a non-delete marked record, then it is enough to lock its
existence with LOCK_REC_NOT_GAP. */
- /* If innodb_locks_unsafe_for_binlog option is used
- or this session is using a READ COMMITED isolation
- level we lock only the record, i.e., next-key locking is
- not used. */
-
ulint lock_type;
- if (srv_locks_unsafe_for_binlog
- || trx->isolation_level <= TRX_ISO_READ_COMMITTED) {
+ if (trx->isolation_level <= TRX_ISO_READ_COMMITTED) {
/* At READ COMMITTED or READ UNCOMMITTED
isolation levels, do not lock committed
delete-marked records. */
@@ -5056,9 +4996,7 @@ no_gap_lock:
switch (err) {
const rec_t* old_vers;
case DB_SUCCESS_LOCKED_REC:
- if (srv_locks_unsafe_for_binlog
- || trx->isolation_level
- <= TRX_ISO_READ_COMMITTED) {
+ if (trx->isolation_level <= TRX_ISO_READ_COMMITTED) {
/* Note that a record of
prebuilt->index was locked. */
prebuilt->new_rec_locks = 1;
@@ -5121,7 +5059,7 @@ no_gap_lock:
goto next_rec;
}
- did_semi_consistent_read = TRUE;
+ did_semi_consistent_read = true;
rec = old_vers;
break;
case DB_RECORD_NOT_FOUND:
@@ -5308,9 +5246,7 @@ requires_clust_rec:
break;
case DB_SUCCESS_LOCKED_REC:
ut_a(clust_rec != NULL);
- if (srv_locks_unsafe_for_binlog
- || trx->isolation_level
- <= TRX_ISO_READ_COMMITTED) {
+ if (trx->isolation_level <= TRX_ISO_READ_COMMITTED) {
/* Note that the clustered index record
was locked. */
prebuilt->new_rec_locks = 2;
@@ -5326,8 +5262,7 @@ requires_clust_rec:
/* The record is delete marked: we can skip it */
- if ((srv_locks_unsafe_for_binlog
- || trx->isolation_level <= TRX_ISO_READ_COMMITTED)
+ if (trx->isolation_level <= TRX_ISO_READ_COMMITTED
&& prebuilt->select_lock_type != LOCK_NONE) {
/* No need to keep a lock on a delete-marked
@@ -5551,7 +5486,7 @@ next_rec:
== ROW_READ_DID_SEMI_CONSISTENT)) {
prebuilt->row_read_type = ROW_READ_TRY_SEMI_CONSISTENT;
}
- did_semi_consistent_read = FALSE;
+ did_semi_consistent_read = false;
prebuilt->new_rec_locks = 0;
vrow = NULL;
@@ -5650,7 +5585,7 @@ page_read_error:
== ROW_READ_DID_SEMI_CONSISTENT)) {
prebuilt->row_read_type = ROW_READ_TRY_SEMI_CONSISTENT;
}
- did_semi_consistent_read = FALSE;
+ did_semi_consistent_read = false;
lock_table_wait:
mtr.commit();
@@ -5686,8 +5621,7 @@ lock_table_wait:
moves_up, &mtr);
}
- if ((srv_locks_unsafe_for_binlog
- || trx->isolation_level <= TRX_ISO_READ_COMMITTED)
+ if (trx->isolation_level <= TRX_ISO_READ_COMMITTED
&& !same_user_rec) {
/* Since we were not able to restore the cursor
diff --git a/storage/innobase/srv/srv0mon.cc b/storage/innobase/srv/srv0mon.cc
index 80beddd7f5e..6624c569533 100644
--- a/storage/innobase/srv/srv0mon.cc
+++ b/storage/innobase/srv/srv0mon.cc
@@ -1188,11 +1188,6 @@ static monitor_info_t innodb_counter_info[] =
MONITOR_NONE,
MONITOR_DEFAULT_START, MONITOR_SRV_BACKGROUND_DROP_TABLE_MICROSECOND},
- {"innodb_ibuf_merge_usec", "server",
- "Time (in microseconds) spent to process change buffer merge",
- MONITOR_NONE,
- MONITOR_DEFAULT_START, MONITOR_SRV_IBUF_MERGE_MICROSECOND},
-
{"innodb_log_flush_usec", "server",
"Time (in microseconds) spent to flush log records",
MONITOR_NONE,
@@ -1951,35 +1946,35 @@ srv_mon_process_existing_counter(
break;
case MONITOR_OVLD_IBUF_MERGE_INSERT:
- value = ibuf->n_merged_ops[IBUF_OP_INSERT];
+ value = ibuf.n_merged_ops[IBUF_OP_INSERT];
break;
case MONITOR_OVLD_IBUF_MERGE_DELETE:
- value = ibuf->n_merged_ops[IBUF_OP_DELETE_MARK];
+ value = ibuf.n_merged_ops[IBUF_OP_DELETE_MARK];
break;
case MONITOR_OVLD_IBUF_MERGE_PURGE:
- value = ibuf->n_merged_ops[IBUF_OP_DELETE];
+ value = ibuf.n_merged_ops[IBUF_OP_DELETE];
break;
case MONITOR_OVLD_IBUF_MERGE_DISCARD_INSERT:
- value = ibuf->n_discarded_ops[IBUF_OP_INSERT];
+ value = ibuf.n_discarded_ops[IBUF_OP_INSERT];
break;
case MONITOR_OVLD_IBUF_MERGE_DISCARD_DELETE:
- value = ibuf->n_discarded_ops[IBUF_OP_DELETE_MARK];
+ value = ibuf.n_discarded_ops[IBUF_OP_DELETE_MARK];
break;
case MONITOR_OVLD_IBUF_MERGE_DISCARD_PURGE:
- value = ibuf->n_discarded_ops[IBUF_OP_DELETE];
+ value = ibuf.n_discarded_ops[IBUF_OP_DELETE];
break;
case MONITOR_OVLD_IBUF_MERGES:
- value = ibuf->n_merges;
+ value = ibuf.n_merges;
break;
case MONITOR_OVLD_IBUF_SIZE:
- value = ibuf->size;
+ value = ibuf.size;
break;
case MONITOR_OVLD_SERVER_ACTIVITY:
diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc
index 1852bc5deb6..5da83f51b29 100644
--- a/storage/innobase/srv/srv0srv.cc
+++ b/storage/innobase/srv/srv0srv.cc
@@ -117,9 +117,6 @@ segment). It is quite possible that some of the tablespaces doesn't host
any of the rollback-segment based on configuration used. */
ulint srv_undo_tablespaces_active;
-/* The number of rollback segments to use */
-ulong srv_undo_logs;
-
/** Rate at which UNDO records should be purged. */
ulong srv_purge_rseg_truncate_frequency;
@@ -148,9 +145,6 @@ my_bool srv_file_per_table;
is greater than SRV_FORCE_NO_TRX_UNDO. */
my_bool high_level_read_only;
-/** Place locks to records only i.e. do not use next-key locking except
-on duplicate key checking and foreign key checking */
-ibool srv_locks_unsafe_for_binlog;
/** Sort buffer size in index creation */
ulong srv_sort_buf_size;
/** Maximum modification log file size for online index creation */
@@ -457,13 +451,13 @@ static ulint srv_main_thread_id;
/* The following counts are used by the srv_master_thread. */
/** Iterations of the loop bounded by 'srv_active' label. */
-static ulint srv_main_active_loops;
+ulint srv_main_active_loops;
/** Iterations of the loop bounded by the 'srv_idle' label. */
-static ulint srv_main_idle_loops;
+ulint srv_main_idle_loops;
/** Iterations of the loop bounded by the 'srv_shutdown' label. */
static ulint srv_main_shutdown_loops;
/** Log writes involving flush. */
-static ulint srv_log_writes_and_flush;
+ulint srv_log_writes_and_flush;
/* This is only ever touched by the master thread. It records the
time when the last flush of log file has happened. The master
@@ -1326,7 +1320,7 @@ srv_printf_innodb_monitor(
"Total large memory allocated " ULINTPF "\n"
"Dictionary memory allocated " ULINTPF "\n",
ulint{os_total_large_mem_allocated},
- dict_sys_get_size());
+ dict_sys.rough_size());
buf_print_io(file);
@@ -1435,6 +1429,27 @@ srv_export_innodb_status(void)
btr_scrub_total_stat(&scrub_stat);
}
+#ifdef BTR_CUR_HASH_ADAPT
+ ulint mem_adaptive_hash = 0;
+ ut_ad(btr_search_sys->hash_tables);
+ for (ulong i = 0; i < btr_ahi_parts; i++) {
+ hash_table_t* ht = btr_search_sys->hash_tables[i];
+
+ ut_ad(ht);
+ ut_ad(ht->heap);
+ /* Multiple mutexes/heaps are currently never used for adaptive
+ hash index tables. */
+ ut_ad(!ht->n_sync_obj);
+ ut_ad(!ht->heaps);
+
+ mem_adaptive_hash += mem_heap_get_size(ht->heap)
+ + ht->n_cells * sizeof(hash_cell_t);
+ }
+ export_vars.innodb_mem_adaptive_hash = mem_adaptive_hash;
+#endif
+
+ export_vars.innodb_mem_dictionary = dict_sys.rough_size();
+
mutex_enter(&srv_innodb_monitor_mutex);
export_vars.innodb_data_pending_reads =
@@ -1487,6 +1502,18 @@ srv_export_innodb_status(void)
export_vars.innodb_buffer_pool_pages_dirty = flush_list_len;
+ export_vars.innodb_buffer_pool_pages_made_young
+ = stat.n_pages_made_young;
+ export_vars.innodb_buffer_pool_pages_made_not_young
+ = stat.n_pages_not_made_young;
+
+ export_vars.innodb_buffer_pool_pages_old = 0;
+
+ for (ulong i = 0; i < srv_buf_pool_instances; i++) {
+ export_vars.innodb_buffer_pool_pages_old +=
+ buf_pool_from_array(i)->LRU_old_len;
+ }
+
export_vars.innodb_buffer_pool_bytes_dirty =
buf_pools_list_size.flush_list_bytes;
@@ -1501,13 +1528,8 @@ srv_export_innodb_status(void)
export_vars.innodb_buffer_pool_pages_misc =
buf_pool_get_n_pages() - LRU_len - free_len;
-#ifdef HAVE_ATOMIC_BUILTINS
- export_vars.innodb_have_atomic_builtins = 1;
-#else
- export_vars.innodb_have_atomic_builtins = 0;
-#endif
-
- export_vars.innodb_page_size = srv_page_size;
+ export_vars.innodb_max_trx_id = trx_sys.get_max_trx_id();
+ export_vars.innodb_history_list_length = trx_sys.rseg_history_len;
export_vars.innodb_log_waits = srv_stats.log_waits;
@@ -1579,7 +1601,6 @@ srv_export_innodb_status(void)
export_vars.innodb_truncated_status_writes =
srv_truncated_status_writes;
- export_vars.innodb_available_undo_logs = srv_available_undo_logs;
export_vars.innodb_page_compression_saved = srv_stats.page_compression_saved;
export_vars.innodb_index_pages_written = srv_stats.index_pages_written;
export_vars.innodb_non_index_pages_written = srv_stats.non_index_pages_written;
@@ -1615,37 +1636,49 @@ srv_export_innodb_status(void)
srv_stats.n_sec_rec_cluster_reads_avoided;
if (!srv_read_only_mode) {
- export_vars.innodb_encryption_rotation_pages_read_from_cache =
- crypt_stat.pages_read_from_cache;
- export_vars.innodb_encryption_rotation_pages_read_from_disk =
- crypt_stat.pages_read_from_disk;
- export_vars.innodb_encryption_rotation_pages_modified =
- crypt_stat.pages_modified;
- export_vars.innodb_encryption_rotation_pages_flushed =
- crypt_stat.pages_flushed;
- export_vars.innodb_encryption_rotation_estimated_iops =
- crypt_stat.estimated_iops;
- export_vars.innodb_encryption_key_requests =
- srv_stats.n_key_requests;
- export_vars.innodb_key_rotation_list_length =
- srv_stats.key_rotation_list_length;
-
- export_vars.innodb_scrub_page_reorganizations =
- scrub_stat.page_reorganizations;
- export_vars.innodb_scrub_page_splits =
- scrub_stat.page_splits;
- export_vars.innodb_scrub_page_split_failures_underflow =
- scrub_stat.page_split_failures_underflow;
- export_vars.innodb_scrub_page_split_failures_out_of_filespace =
- scrub_stat.page_split_failures_out_of_filespace;
- export_vars.innodb_scrub_page_split_failures_missing_index =
- scrub_stat.page_split_failures_missing_index;
- export_vars.innodb_scrub_page_split_failures_unknown =
- scrub_stat.page_split_failures_unknown;
- export_vars.innodb_scrub_log = srv_stats.n_log_scrubs;
+ export_vars.innodb_encryption_rotation_pages_read_from_cache =
+ crypt_stat.pages_read_from_cache;
+ export_vars.innodb_encryption_rotation_pages_read_from_disk =
+ crypt_stat.pages_read_from_disk;
+ export_vars.innodb_encryption_rotation_pages_modified =
+ crypt_stat.pages_modified;
+ export_vars.innodb_encryption_rotation_pages_flushed =
+ crypt_stat.pages_flushed;
+ export_vars.innodb_encryption_rotation_estimated_iops =
+ crypt_stat.estimated_iops;
+ export_vars.innodb_encryption_key_requests =
+ srv_stats.n_key_requests;
+ export_vars.innodb_key_rotation_list_length =
+ srv_stats.key_rotation_list_length;
+
+ export_vars.innodb_scrub_page_reorganizations =
+ scrub_stat.page_reorganizations;
+ export_vars.innodb_scrub_page_splits =
+ scrub_stat.page_splits;
+ export_vars.innodb_scrub_page_split_failures_underflow =
+ scrub_stat.page_split_failures_underflow;
+ export_vars.innodb_scrub_page_split_failures_out_of_filespace =
+ scrub_stat.page_split_failures_out_of_filespace;
+ export_vars.innodb_scrub_page_split_failures_missing_index =
+ scrub_stat.page_split_failures_missing_index;
+ export_vars.innodb_scrub_page_split_failures_unknown =
+ scrub_stat.page_split_failures_unknown;
+ export_vars.innodb_scrub_log = srv_stats.n_log_scrubs;
}
mutex_exit(&srv_innodb_monitor_mutex);
+
+ log_mutex_enter();
+
+ export_vars.innodb_lsn_current = log_sys.lsn;
+ export_vars.innodb_lsn_flushed = log_sys.flushed_to_disk_lsn;
+ export_vars.innodb_lsn_last_checkpoint = log_sys.last_checkpoint_lsn;
+ export_vars.innodb_checkpoint_age = static_cast<ulint>(
+ log_sys.lsn - log_sys.last_checkpoint_lsn);
+ export_vars.innodb_checkpoint_max_age = static_cast<ulint>(
+ log_sys.max_checkpoint_age);
+
+ log_mutex_exit();
}
/*********************************************************************//**
@@ -2144,13 +2177,6 @@ srv_master_do_active_tasks(void)
srv_main_thread_op_info = "checking free log space";
log_free_check();
- /* Do an ibuf merge */
- srv_main_thread_op_info = "doing insert buffer merge";
- counter_time = microsecond_interval_timer();
- ibuf_merge_in_background(false);
- MONITOR_INC_TIME_IN_MICRO_SECS(
- MONITOR_SRV_IBUF_MERGE_MICROSECOND, counter_time);
-
/* Flush logs if needed */
srv_main_thread_op_info = "flushing log";
srv_sync_log_buffer_in_background();
@@ -2237,13 +2263,6 @@ srv_master_do_idle_tasks(void)
srv_main_thread_op_info = "checking free log space";
log_free_check();
- /* Do an ibuf merge */
- counter_time = microsecond_interval_timer();
- srv_main_thread_op_info = "doing insert buffer merge";
- ibuf_merge_in_background(true);
- MONITOR_INC_TIME_IN_MICRO_SECS(
- MONITOR_SRV_IBUF_MERGE_MICROSECOND, counter_time);
-
if (srv_shutdown_state != SRV_SHUTDOWN_NONE) {
return;
}
@@ -2307,7 +2326,7 @@ srv_shutdown(bool ibuf_merge)
srv_main_thread_op_info = "checking free log space";
log_free_check();
srv_main_thread_op_info = "doing insert buffer merge";
- n_bytes_merged = ibuf_merge_in_background(true);
+ n_bytes_merged = ibuf_merge_all();
/* Flush logs if needed */
srv_sync_log_buffer_in_background();
diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc
index 29707e783af..46435bb0055 100644
--- a/storage/innobase/srv/srv0start.cc
+++ b/storage/innobase/srv/srv0start.cc
@@ -1306,13 +1306,12 @@ dberr_t srv_start(bool create_new_db)
|| srv_operation == SRV_OPERATION_RESTORE
|| srv_operation == SRV_OPERATION_RESTORE_EXPORT);
-
if (srv_force_recovery == SRV_FORCE_NO_LOG_REDO) {
srv_read_only_mode = true;
}
high_level_read_only = srv_read_only_mode
- || srv_force_recovery > SRV_FORCE_NO_TRX_UNDO
+ || srv_force_recovery > SRV_FORCE_NO_IBUF_MERGE
|| srv_sys_space.created_new_raw();
/* Reset the start state. */
@@ -1422,7 +1421,9 @@ dberr_t srv_start(bool create_new_db)
fil_path_to_mysql_datadir,
os_proc_get_number());
- srv_monitor_file = fopen(srv_monitor_file_name, "w+");
+ srv_monitor_file = my_fopen(srv_monitor_file_name,
+ O_RDWR|O_TRUNC|O_CREAT,
+ MYF(MY_WME));
if (!srv_monitor_file) {
ib::error() << "Unable to create "
@@ -2102,10 +2103,39 @@ files_checked:
return(srv_init_abort(err));
}
}
+ }
+
+ ut_ad(err == DB_SUCCESS);
+ ut_a(sum_of_new_sizes != ULINT_UNDEFINED);
+
+ /* Create the doublewrite buffer to a new tablespace */
+ if (!srv_read_only_mode && srv_force_recovery < SRV_FORCE_NO_TRX_UNDO
+ && !buf_dblwr_create()) {
+ return(srv_init_abort(DB_ERROR));
+ }
+ /* Here the double write buffer has already been created and so
+ any new rollback segments will be allocated after the double
+ write buffer. The default segment should already exist.
+ We create the new segments only if it's a new database or
+ the database was shutdown cleanly. */
+
+ /* Note: When creating the extra rollback segments during an upgrade
+ we violate the latching order, even if the change buffer is empty.
+ We make an exception in sync0sync.cc and check srv_is_being_started
+ for that violation. It cannot create a deadlock because we are still
+ running in single threaded mode essentially. Only the IO threads
+ should be running at this stage. */
+
+ if (!trx_sys_create_rsegs()) {
+ return(srv_init_abort(DB_ERROR));
+ }
+
+ if (!create_new_db) {
/* Validate a few system page types that were left
- uninitialized by older versions of MySQL. */
+ uninitialized before MySQL or MariaDB 5.5. */
if (!high_level_read_only) {
+ ut_ad(srv_force_recovery <= SRV_FORCE_NO_IBUF_MERGE);
buf_block_t* block;
mtr.start();
/* Bitmap page types will be reset in
@@ -2133,26 +2163,34 @@ files_checked:
0, RW_X_LATCH, &mtr);
fil_block_check_type(*block, FIL_PAGE_TYPE_SYS, &mtr);
mtr.commit();
- }
- /* Roll back any recovered data dictionary transactions, so
- that the data dictionary tables will be free of any locks.
- The data dictionary latch should guarantee that there is at
- most one data dictionary transaction active at a time. */
- if (srv_force_recovery < SRV_FORCE_NO_TRX_UNDO) {
- /* If the following call is ever removed, the
- first-time ha_innobase::open() must hold (or
- acquire and release) a table lock that
- conflicts with trx_resurrect_table_locks(), to
- ensure that any recovered incomplete ALTER TABLE
- will have been rolled back. Otherwise,
- dict_table_t::instant could be cleared by rollback
- invoking dict_index_t::clear_instant_alter() while
- open table handles exist in client connections. */
- trx_rollback_recovered(false);
+ /* Roll back any recovered data dictionary
+ transactions, so that the data dictionary
+ tables will be free of any locks. The data
+ dictionary latch should guarantee that there
+ is at most one data dictionary transaction
+ active at a time. */
+ if (srv_force_recovery < SRV_FORCE_NO_TRX_UNDO) {
+ /* If the following call is ever
+ removed, the first-time
+ ha_innobase::open() must hold (or
+ acquire and release) a table lock that
+ conflicts with
+ trx_resurrect_table_locks(), to ensure
+ that any recovered incomplete ALTER
+ TABLE will have been rolled
+ back. Otherwise, dict_table_t::instant
+ could be cleared by rollback invoking
+ dict_index_t::clear_instant_alter()
+ while open table handles exist in
+ client connections. */
+ trx_rollback_recovered(false);
+ }
}
- if (srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE) {
+ /* FIXME: Skip the following if srv_read_only_mode,
+ while avoiding "Allocated tablespace ID" warnings. */
+ if (srv_force_recovery <= SRV_FORCE_NO_IBUF_MERGE) {
/* Open or Create SYS_TABLESPACES and SYS_DATAFILES
so that tablespace names and other metadata can be
found. */
@@ -2178,41 +2216,24 @@ files_checked:
dict_check_tablespaces_and_store_max_id();
}
- if (err != DB_SUCCESS) {
- return(srv_init_abort(err));
+ if (srv_force_recovery < SRV_FORCE_NO_TRX_UNDO
+ && !srv_read_only_mode) {
+ /* Drop partially created indexes. */
+ row_merge_drop_temp_indexes();
+ /* Drop garbage tables. */
+ row_mysql_drop_garbage_tables();
+
+ /* Drop any auxiliary tables that were not
+ dropped when the parent table was
+ dropped. This can happen if the parent table
+ was dropped but the server crashed before the
+ auxiliary tables were dropped. */
+ fts_drop_orphaned_tables();
+
+ /* Rollback incomplete non-DDL transactions */
+ trx_rollback_is_active = true;
+ os_thread_create(trx_rollback_all_recovered, 0, 0);
}
-
- recv_recovery_rollback_active();
- srv_startup_is_before_trx_rollback_phase = FALSE;
- }
-
- ut_ad(err == DB_SUCCESS);
- ut_a(sum_of_new_sizes != ULINT_UNDEFINED);
-
- /* Create the doublewrite buffer to a new tablespace */
- if (!srv_read_only_mode && srv_force_recovery < SRV_FORCE_NO_TRX_UNDO
- && !buf_dblwr_create()) {
- return(srv_init_abort(DB_ERROR));
- }
-
- /* Here the double write buffer has already been created and so
- any new rollback segments will be allocated after the double
- write buffer. The default segment should already exist.
- We create the new segments only if it's a new database or
- the database was shutdown cleanly. */
-
- /* Note: When creating the extra rollback segments during an upgrade
- we violate the latching order, even if the change buffer is empty.
- We make an exception in sync0sync.cc and check srv_is_being_started
- for that violation. It cannot create a deadlock because we are still
- running in single threaded mode essentially. Only the IO threads
- should be running at this stage. */
-
- ut_a(srv_undo_logs > 0);
- ut_a(srv_undo_logs <= TRX_SYS_N_RSEGS);
-
- if (!trx_sys_create_rsegs()) {
- return(srv_init_abort(DB_ERROR));
}
srv_startup_is_before_trx_rollback_phase = false;
@@ -2455,7 +2476,7 @@ void innodb_shutdown()
srv_shutdown_all_bg_threads();
if (srv_monitor_file) {
- fclose(srv_monitor_file);
+ my_fclose(srv_monitor_file, MYF(MY_WME));
srv_monitor_file = 0;
if (srv_monitor_file_name) {
unlink(srv_monitor_file_name);
@@ -2464,7 +2485,7 @@ void innodb_shutdown()
}
if (srv_misc_tmpfile) {
- fclose(srv_misc_tmpfile);
+ my_fclose(srv_misc_tmpfile, MYF(MY_WME));
srv_misc_tmpfile = 0;
}
@@ -2478,7 +2499,7 @@ void innodb_shutdown()
#ifdef BTR_CUR_HASH_ADAPT
ut_ad(btr_search_sys || !srv_was_started);
#endif /* BTR_CUR_HASH_ADAPT */
- ut_ad(ibuf || !srv_was_started);
+ ut_ad(ibuf.index || !srv_was_started);
if (dict_stats_event) {
dict_stats_thread_deinit();
@@ -2502,9 +2523,7 @@ void innodb_shutdown()
btr_search_disable(true);
}
#endif /* BTR_CUR_HASH_ADAPT */
- if (ibuf) {
- ibuf_close();
- }
+ ibuf_close();
log_sys.close();
purge_sys.close();
trx_sys.close();
diff --git a/storage/innobase/sync/sync0arr.cc b/storage/innobase/sync/sync0arr.cc
index 6e858254ad4..b9578289504 100644
--- a/storage/innobase/sync/sync0arr.cc
+++ b/storage/innobase/sync/sync0arr.cc
@@ -1310,13 +1310,15 @@ sync_arr_fill_sys_semphore_waits_table(
WaitMutex* mutex;
type = cell->request_type;
/* JAN: FIXME
- OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_THREAD_ID],
- (longlong)os_thread_pf(cell->thread)));
+ OK(fields[SYS_SEMAPHORE_WAITS_THREAD_ID]->store(,
+ (longlong)os_thread_pf(cell->thread), true));
*/
OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_FILE], innobase_basename(cell->file)));
OK(fields[SYS_SEMAPHORE_WAITS_LINE]->store(cell->line, true));
fields[SYS_SEMAPHORE_WAITS_LINE]->set_notnull();
- OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_WAIT_TIME], (ulint)difftime(time(NULL), cell->reservation_time)));
+ OK(fields[SYS_SEMAPHORE_WAITS_WAIT_TIME]->store(
+ difftime(time(NULL),
+ cell->reservation_time)));
if (type == SYNC_MUTEX) {
mutex = static_cast<WaitMutex*>(cell->latch.mutex);
@@ -1324,21 +1326,21 @@ sync_arr_fill_sys_semphore_waits_table(
if (mutex) {
// JAN: FIXME
// OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_OBJECT_NAME], mutex->cmutex_name));
- OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_WAIT_OBJECT], (longlong)mutex));
+ OK(fields[SYS_SEMAPHORE_WAITS_WAIT_OBJECT]->store((longlong)mutex, true));
OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_WAIT_TYPE], "MUTEX"));
- //OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_HOLDER_THREAD_ID], (longlong)mutex->thread_id));
+ //OK(fields[SYS_SEMAPHORE_WAITS_HOLDER_THREAD_ID]->store(mutex->thread_id, true));
//OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_HOLDER_FILE], innobase_basename(mutex->file_name)));
//OK(fields[SYS_SEMAPHORE_WAITS_HOLDER_LINE]->store(mutex->line, true));
//fields[SYS_SEMAPHORE_WAITS_HOLDER_LINE]->set_notnull();
//OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_CREATED_FILE], innobase_basename(mutex->cfile_name)));
//OK(fields[SYS_SEMAPHORE_WAITS_CREATED_LINE]->store(mutex->cline, true));
//fields[SYS_SEMAPHORE_WAITS_CREATED_LINE]->set_notnull();
- //OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_WAITERS_FLAG], (longlong)mutex->waiters));
- //OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_LOCK_WORD], (longlong)mutex->lock_word));
+ //OK(fields[SYS_SEMAPHORE_WAITS_WAITERS_FLAG]->store(mutex->waiters, true));
+ //OK(fields[SYS_SEMAPHORE_WAITS_LOCK_WORD]->store(mutex->lock_word, true));
//OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_LAST_WRITER_FILE], innobase_basename(mutex->file_name)));
//OK(fields[SYS_SEMAPHORE_WAITS_LAST_WRITER_LINE]->store(mutex->line, true));
//fields[SYS_SEMAPHORE_WAITS_LAST_WRITER_LINE]->set_notnull();
- //OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_OS_WAIT_COUNT], mutex->count_os_wait));
+ //OK(fields[SYS_SEMAPHORE_WAITS_OS_WAIT_COUNT]->store(mutex->count_os_wait, true));
}
} else if (type == RW_LOCK_X_WAIT
|| type == RW_LOCK_X
@@ -1351,7 +1353,7 @@ sync_arr_fill_sys_semphore_waits_table(
if (rwlock) {
ulint writer = rw_lock_get_writer(rwlock);
- OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_WAIT_OBJECT], (longlong)rwlock));
+ OK(fields[SYS_SEMAPHORE_WAITS_WAIT_OBJECT]->store((longlong)rwlock, true));
if (type == RW_LOCK_X) {
OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_WAIT_TYPE], "RW_LOCK_X"));
} else if (type == RW_LOCK_X_WAIT) {
@@ -1365,7 +1367,7 @@ sync_arr_fill_sys_semphore_waits_table(
if (writer != RW_LOCK_NOT_LOCKED) {
// JAN: FIXME
// OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_OBJECT_NAME], rwlock->lock_name));
- OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_WRITER_THREAD], (longlong)os_thread_pf(rwlock->writer_thread)));
+ OK(fields[SYS_SEMAPHORE_WAITS_WRITER_THREAD]->store(os_thread_pf(rwlock->writer_thread), true));
if (writer == RW_LOCK_X) {
OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_RESERVATION_MODE], "RW_LOCK_X"));
@@ -1375,19 +1377,21 @@ sync_arr_fill_sys_semphore_waits_table(
OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_RESERVATION_MODE], "RW_LOCK_SX"));
}
- //OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_HOLDER_THREAD_ID], (longlong)rwlock->thread_id));
+ //OK(fields[SYS_SEMAPHORE_WAITS_HOLDER_THREAD_ID]->store(rwlock->thread_id, true));
//OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_HOLDER_FILE], innobase_basename(rwlock->file_name)));
//OK(fields[SYS_SEMAPHORE_WAITS_HOLDER_LINE]->store(rwlock->line, true));
//fields[SYS_SEMAPHORE_WAITS_HOLDER_LINE]->set_notnull();
- OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_READERS], rw_lock_get_reader_count(rwlock)));
- OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_WAITERS_FLAG],
- rwlock->waiters.load(std::memory_order_relaxed)));
- OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_LOCK_WORD],
- rwlock->lock_word.load(std::memory_order_relaxed)));
+ OK(fields[SYS_SEMAPHORE_WAITS_READERS]->store(rw_lock_get_reader_count(rwlock), true));
+ OK(fields[SYS_SEMAPHORE_WAITS_WAITERS_FLAG]->store(
+ rwlock->waiters.load(std::memory_order_relaxed),
+ true));
+ OK(fields[SYS_SEMAPHORE_WAITS_LOCK_WORD]->store(
+ rwlock->lock_word.load(std::memory_order_relaxed),
+ true));
OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_LAST_WRITER_FILE], innobase_basename(rwlock->last_x_file_name)));
OK(fields[SYS_SEMAPHORE_WAITS_LAST_WRITER_LINE]->store(rwlock->last_x_line, true));
fields[SYS_SEMAPHORE_WAITS_LAST_WRITER_LINE]->set_notnull();
- OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_OS_WAIT_COUNT], rwlock->count_os_wait));
+ OK(fields[SYS_SEMAPHORE_WAITS_OS_WAIT_COUNT]->store(rwlock->count_os_wait, true));
}
}
}
diff --git a/storage/innobase/trx/trx0i_s.cc b/storage/innobase/trx/trx0i_s.cc
index a39fb5d2e95..ed348357556 100644
--- a/storage/innobase/trx/trx0i_s.cc
+++ b/storage/innobase/trx/trx0i_s.cc
@@ -178,31 +178,13 @@ INFORMATION SCHEMA tables is fetched and later retrieved by the C++
code in handler/i_s.cc. */
trx_i_s_cache_t* trx_i_s_cache = &trx_i_s_cache_static;
-/*******************************************************************//**
-For a record lock that is in waiting state retrieves the only bit that
-is set, for a table lock returns ULINT_UNDEFINED.
-@return record number within the heap */
-static
-ulint
-wait_lock_get_heap_no(
-/*==================*/
- const lock_t* lock) /*!< in: lock */
+/** @return the heap number of a record lock
+@retval 0 for table locks */
+static uint16_t wait_lock_get_heap_no(const lock_t* lock)
{
- ulint ret;
-
- switch (lock_get_type(lock)) {
- case LOCK_REC:
- ret = lock_rec_find_set_bit(lock);
- ut_a(ret != ULINT_UNDEFINED);
- break;
- case LOCK_TABLE:
- ret = ULINT_UNDEFINED;
- break;
- default:
- ut_error;
- }
-
- return(ret);
+ return lock_get_type(lock) == LOCK_REC
+ ? static_cast<uint16_t>(lock_rec_find_set_bit(lock))
+ : 0;
}
/*******************************************************************//**
@@ -404,25 +386,20 @@ i_s_locks_row_validate(
/*===================*/
const i_s_locks_row_t* row) /*!< in: row to validate */
{
- ut_ad(row->lock_mode != NULL);
- ut_ad(row->lock_type != NULL);
+ ut_ad(row->lock_mode);
ut_ad(row->lock_table != NULL);
ut_ad(row->lock_table_id != 0);
- if (row->lock_space == ULINT_UNDEFINED) {
+ if (!row->lock_index) {
/* table lock */
- ut_ad(!strcmp("TABLE", row->lock_type));
- ut_ad(row->lock_index == NULL);
- ut_ad(row->lock_data == NULL);
- ut_ad(row->lock_page == ULINT_UNDEFINED);
- ut_ad(row->lock_rec == ULINT_UNDEFINED);
+ ut_ad(!row->lock_data);
+ ut_ad(!row->lock_space);
+ ut_ad(!row->lock_page);
+ ut_ad(!row->lock_rec);
} else {
/* record lock */
- ut_ad(!strcmp("RECORD", row->lock_type));
- ut_ad(row->lock_index != NULL);
/* row->lock_data == NULL if buf_page_try_get() == NULL */
- ut_ad(row->lock_page != ULINT_UNDEFINED);
- ut_ad(row->lock_rec != ULINT_UNDEFINED);
+ ut_ad(row->lock_page);
}
return(TRUE);
@@ -506,21 +483,7 @@ fill_trx_row(
}
thd_done:
- s = trx->op_info;
-
- if (s != NULL && s[0] != '\0') {
-
- TRX_I_S_STRING_COPY(s, row->trx_operation_state,
- TRX_I_S_TRX_OP_STATE_MAX_LEN, cache);
-
- if (row->trx_operation_state == NULL) {
-
- return(FALSE);
- }
- } else {
-
- row->trx_operation_state = NULL;
- }
+ row->trx_operation_state = trx->op_info;
row->trx_tables_in_use = trx->n_mysql_tables_in_use;
@@ -540,23 +503,7 @@ thd_done:
row->trx_concurrency_tickets = trx->n_tickets_to_enter_innodb;
- switch (trx->isolation_level) {
- case TRX_ISO_READ_UNCOMMITTED:
- row->trx_isolation_level = "READ UNCOMMITTED";
- break;
- case TRX_ISO_READ_COMMITTED:
- row->trx_isolation_level = "READ COMMITTED";
- break;
- case TRX_ISO_REPEATABLE_READ:
- row->trx_isolation_level = "REPEATABLE READ";
- break;
- case TRX_ISO_SERIALIZABLE:
- row->trx_isolation_level = "SERIALIZABLE";
- break;
- /* Should not happen as TRX_ISO_READ_COMMITTED is default */
- default:
- row->trx_isolation_level = "UNKNOWN";
- }
+ row->trx_isolation_level = trx->isolation_level;
row->trx_unique_checks = (ibool) trx->check_unique_secondary;
@@ -688,8 +635,8 @@ fill_lock_data(
mtr_start(&mtr);
- block = buf_page_try_get(page_id_t(lock_rec_get_space_id(lock),
- lock_rec_get_page_no(lock)),
+ block = buf_page_try_get(page_id_t(lock->un_member.rec_lock.space,
+ lock->un_member.rec_lock.page_no),
&mtr);
if (block == NULL) {
@@ -753,22 +700,42 @@ fill_lock_data(
/*******************************************************************//**
Fills i_s_locks_row_t object. Returns its first argument.
If memory can not be allocated then FALSE is returned.
-@return FALSE if allocation fails */
-static
-ibool
-fill_locks_row(
-/*===========*/
+@return false if allocation fails */
+static bool fill_locks_row(
i_s_locks_row_t* row, /*!< out: result object that's filled */
const lock_t* lock, /*!< in: lock to get data from */
- ulint heap_no,/*!< in: lock's record number
- or ULINT_UNDEFINED if the lock
+ uint16_t heap_no,/*!< in: lock's record number
+ or 0 if the lock
is a table lock */
trx_i_s_cache_t* cache) /*!< in/out: cache into which to copy
volatile strings */
{
- row->lock_trx_id = lock_get_trx_id(lock);
- row->lock_mode = lock_get_mode_str(lock);
- row->lock_type = lock_get_type_str(lock);
+ row->lock_trx_id = lock->trx->id;
+ const auto lock_type = lock_get_type(lock);
+ ut_ad(lock_type == LOCK_REC || lock_type == LOCK_TABLE);
+
+ const bool is_gap_lock = lock_type == LOCK_REC
+ && (lock->type_mode & LOCK_GAP);
+ switch (lock->type_mode & LOCK_MODE_MASK) {
+ case LOCK_S:
+ row->lock_mode = 1 + is_gap_lock;
+ break;
+ case LOCK_X:
+ row->lock_mode = 3 + is_gap_lock;
+ break;
+ case LOCK_IS:
+ row->lock_mode = 5 + is_gap_lock;
+ break;
+ case LOCK_IX:
+ row->lock_mode = 7 + is_gap_lock;
+ break;
+ case LOCK_AUTO_INC:
+ row->lock_mode = 9;
+ break;
+ default:
+ ut_ad(!"unknown lock mode");
+ row->lock_mode = 0;
+ }
row->lock_table = ha_storage_put_str_memlim(
cache->storage, lock_get_table_name(lock).m_name,
@@ -777,11 +744,10 @@ fill_locks_row(
/* memory could not be allocated */
if (row->lock_table == NULL) {
- return(FALSE);
+ return false;
}
- switch (lock_get_type(lock)) {
- case LOCK_REC:
+ if (lock_type == LOCK_REC) {
row->lock_index = ha_storage_put_str_memlim(
cache->storage, lock_rec_get_index_name(lock),
MAX_ALLOWED_FOR_STORAGE(cache));
@@ -789,32 +755,26 @@ fill_locks_row(
/* memory could not be allocated */
if (row->lock_index == NULL) {
- return(FALSE);
+ return false;
}
- row->lock_space = lock_rec_get_space_id(lock);
- row->lock_page = lock_rec_get_page_no(lock);
+ row->lock_space = lock->un_member.rec_lock.space;
+ row->lock_page = lock->un_member.rec_lock.page_no;
row->lock_rec = heap_no;
if (!fill_lock_data(&row->lock_data, lock, heap_no, cache)) {
/* memory could not be allocated */
- return(FALSE);
+ return false;
}
-
- break;
- case LOCK_TABLE:
+ } else {
row->lock_index = NULL;
- row->lock_space = ULINT_UNDEFINED;
- row->lock_page = ULINT_UNDEFINED;
- row->lock_rec = ULINT_UNDEFINED;
+ row->lock_space = 0;
+ row->lock_page = 0;
+ row->lock_rec = 0;
row->lock_data = NULL;
-
- break;
- default:
- ut_error;
}
row->lock_table_id = lock_get_table_id(lock);
@@ -822,7 +782,7 @@ fill_locks_row(
row->hash_chain.value = row;
ut_ad(i_s_locks_row_validate(row));
- return(TRUE);
+ return true;
}
/*******************************************************************//**
@@ -876,11 +836,11 @@ fold_lock(
case LOCK_REC:
ut_a(heap_no != ULINT_UNDEFINED);
- ret = ut_fold_ulint_pair((ulint) lock_get_trx_id(lock),
- lock_rec_get_space_id(lock));
+ ret = ut_fold_ulint_pair((ulint) lock->trx->id,
+ lock->un_member.rec_lock.space);
ret = ut_fold_ulint_pair(ret,
- lock_rec_get_page_no(lock));
+ lock->un_member.rec_lock.page_no);
ret = ut_fold_ulint_pair(ret, heap_no);
@@ -923,9 +883,9 @@ locks_row_eq_lock(
case LOCK_REC:
ut_a(heap_no != ULINT_UNDEFINED);
- return(row->lock_trx_id == lock_get_trx_id(lock)
- && row->lock_space == lock_rec_get_space_id(lock)
- && row->lock_page == lock_rec_get_page_no(lock)
+ return(row->lock_trx_id == lock->trx->id
+ && row->lock_space == lock->un_member.rec_lock.space
+ && row->lock_page == lock->un_member.rec_lock.page_no
&& row->lock_rec == heap_no);
case LOCK_TABLE:
@@ -934,7 +894,7 @@ locks_row_eq_lock(
it fails. */
ut_a(heap_no == ULINT_UNDEFINED);
- return(row->lock_trx_id == lock_get_trx_id(lock)
+ return(row->lock_trx_id == lock->trx->id
&& row->lock_table_id == lock_get_table_id(lock));
default:
@@ -955,7 +915,7 @@ search_innodb_locks(
/*================*/
trx_i_s_cache_t* cache, /*!< in: cache */
const lock_t* lock, /*!< in: lock to search for */
- ulint heap_no)/*!< in: lock's record number
+ uint16_t heap_no)/*!< in: lock's record number
or ULINT_UNDEFINED if the lock
is a table lock */
{
@@ -998,8 +958,8 @@ add_lock_to_cache(
/*==============*/
trx_i_s_cache_t* cache, /*!< in/out: cache */
const lock_t* lock, /*!< in: the element to add */
- ulint heap_no)/*!< in: lock's record number
- or ULINT_UNDEFINED if the lock
+ uint16_t heap_no)/*!< in: lock's record number
+ or 0 if the lock
is a table lock */
{
i_s_locks_row_t* dst_row;
@@ -1113,13 +1073,12 @@ add_trx_relevant_locks_to_cache(
if (trx->lock.que_state == TRX_QUE_LOCK_WAIT) {
const lock_t* curr_lock;
- ulint wait_lock_heap_no;
i_s_locks_row_t* blocking_lock_row;
lock_queue_iterator_t iter;
ut_a(trx->lock.wait_lock != NULL);
- wait_lock_heap_no
+ uint16_t wait_lock_heap_no
= wait_lock_get_heap_no(trx->lock.wait_lock);
/* add the requested lock */
@@ -1523,11 +1482,11 @@ trx_i_s_create_lock_id(
/* please adjust TRX_I_S_LOCK_ID_MAX_LEN if you change this */
- if (row->lock_space != ULINT_UNDEFINED) {
+ if (row->lock_index) {
/* record lock */
res_len = snprintf(lock_id, lock_id_size,
TRX_ID_FMT
- ":" ULINTPF ":" ULINTPF ":" ULINTPF,
+ ":%u:%u:%u",
row->lock_trx_id, row->lock_space,
row->lock_page, row->lock_rec);
} else {
diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc
index f1abf4061d8..8dd17ce4509 100644
--- a/storage/innobase/trx/trx0purge.cc
+++ b/storage/innobase/trx/trx0purge.cc
@@ -569,7 +569,7 @@ static void trx_purge_truncate_history()
return;
}
- while (srv_undo_log_truncate && srv_undo_logs >= 3) {
+ while (srv_undo_log_truncate) {
if (!purge_sys.truncate.current) {
const ulint threshold = ulint(srv_max_undo_log_size
>> srv_page_size_shift);
diff --git a/storage/innobase/trx/trx0roll.cc b/storage/innobase/trx/trx0roll.cc
index b81b1ab3dee..9afc0071e17 100644
--- a/storage/innobase/trx/trx0roll.cc
+++ b/storage/innobase/trx/trx0roll.cc
@@ -44,6 +44,10 @@ Created 3/26/1996 Heikki Tuuri
#include "trx0trx.h"
#include "trx0undo.h"
+#ifdef UNIV_PFS_THREAD
+mysql_pfs_key_t trx_rollback_clean_thread_key;
+#endif
+
/** true if trx_rollback_all_recovered() thread is active */
bool trx_rollback_is_active;
@@ -850,7 +854,6 @@ discard:
}
}
-
/*******************************************************************//**
Rollback or clean up any incomplete transactions which were
encountered in crash recovery. If the transaction already was
diff --git a/storage/innobase/trx/trx0sys.cc b/storage/innobase/trx/trx0sys.cc
index bb645186b75..f41bf942b2b 100644
--- a/storage/innobase/trx/trx0sys.cc
+++ b/storage/innobase/trx/trx0sys.cc
@@ -238,16 +238,11 @@ trx_sys_create_rsegs()
{
/* srv_available_undo_logs reflects the number of persistent
rollback segments that have been initialized in the
- transaction system header page.
-
- srv_undo_logs determines how many of the
- srv_available_undo_logs rollback segments may be used for
- logging new transactions. */
+ transaction system header page. */
ut_ad(srv_undo_tablespaces <= TRX_SYS_MAX_UNDO_SPACES);
- ut_ad(srv_undo_logs <= TRX_SYS_N_RSEGS);
- if (srv_read_only_mode) {
- srv_undo_logs = srv_available_undo_logs = ULONG_UNDEFINED;
+ if (high_level_read_only) {
+ srv_available_undo_logs = 0;
return(true);
}
@@ -262,43 +257,35 @@ trx_sys_create_rsegs()
in the system tablespace. */
ut_a(srv_available_undo_logs > 0);
- if (srv_force_recovery) {
- /* Do not create additional rollback segments if
- innodb_force_recovery has been set. */
- if (srv_undo_logs > srv_available_undo_logs) {
- srv_undo_logs = srv_available_undo_logs;
+ for (ulint i = 0; srv_available_undo_logs < TRX_SYS_N_RSEGS;
+ i++, srv_available_undo_logs++) {
+ /* Tablespace 0 is the system tablespace.
+ Dedicated undo log tablespaces start from 1. */
+ ulint space = srv_undo_tablespaces > 0
+ ? (i % srv_undo_tablespaces)
+ + srv_undo_space_id_start
+ : TRX_SYS_SPACE;
+
+ if (!trx_rseg_create(space)) {
+ ib::error() << "Unable to allocate the"
+ " requested innodb_undo_logs";
+ return(false);
}
- } else {
- for (ulint i = 0; srv_available_undo_logs < srv_undo_logs;
- i++, srv_available_undo_logs++) {
- /* Tablespace 0 is the system tablespace.
- Dedicated undo log tablespaces start from 1. */
- ulint space = srv_undo_tablespaces > 0
- ? (i % srv_undo_tablespaces)
- + srv_undo_space_id_start
- : TRX_SYS_SPACE;
-
- if (!trx_rseg_create(space)) {
- ib::error() << "Unable to allocate the"
- " requested innodb_undo_logs";
- return(false);
- }
-
- /* Increase the number of active undo
- tablespace in case new rollback segment
- assigned to new undo tablespace. */
- if (space > srv_undo_tablespaces_active) {
- srv_undo_tablespaces_active++;
-
- ut_ad(srv_undo_tablespaces_active == space);
- }
+
+ /* Increase the number of active undo
+ tablespace in case new rollback segment
+ assigned to new undo tablespace. */
+ if (space > srv_undo_tablespaces_active) {
+ srv_undo_tablespaces_active++;
+
+ ut_ad(srv_undo_tablespaces_active == space);
}
}
- ut_ad(srv_undo_logs <= srv_available_undo_logs);
+ ut_ad(srv_available_undo_logs == TRX_SYS_N_RSEGS);
ib::info info;
- info << srv_undo_logs << " out of " << srv_available_undo_logs;
+ info << srv_available_undo_logs;
if (srv_undo_tablespaces_active) {
info << " rollback segments in " << srv_undo_tablespaces_active
<< " undo tablespaces are active.";
diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc
index 6ecb64183d8..5d42650953b 100644
--- a/storage/innobase/trx/trx0trx.cc
+++ b/storage/innobase/trx/trx0trx.cc
@@ -817,11 +817,13 @@ evenly distributed between 0 and innodb_undo_logs-1
@retval NULL if innodb_read_only */
static trx_rseg_t* trx_assign_rseg_low()
{
- if (srv_read_only_mode) {
- ut_ad(srv_undo_logs == ULONG_UNDEFINED);
+ if (high_level_read_only) {
+ ut_ad(!srv_available_undo_logs);
return(NULL);
}
+ ut_ad(srv_available_undo_logs == TRX_SYS_N_RSEGS);
+
/* The first slot is always assigned to the system tablespace. */
ut_ad(trx_sys.rseg_array[0]->space == fil_system.sys_space);
@@ -834,7 +836,8 @@ static trx_rseg_t* trx_assign_rseg_low()
that start modifications concurrently will write their undo
log to the same rollback segment. */
static ulong rseg_slot;
- ulint slot = rseg_slot++ % srv_undo_logs;
+ ulint slot = rseg_slot++ % TRX_SYS_N_RSEGS;
+ ut_d(if (trx_rseg_n_slots_debug) slot = 0);
trx_rseg_t* rseg;
#ifdef UNIV_DEBUG
@@ -857,7 +860,8 @@ static trx_rseg_t* trx_assign_rseg_low()
look_for_rollover = true;
#endif /* UNIV_DEBUG */
- slot = (slot + 1) % srv_undo_logs;
+ ut_d(if (!trx_rseg_n_slots_debug))
+ slot = (slot + 1) % TRX_SYS_N_RSEGS;
if (rseg == NULL) {
continue;
diff --git a/storage/innobase/ut/ut0crc32.cc b/storage/innobase/ut/ut0crc32.cc
index 5ccd15dd5ca..4a6447c1dcf 100644
--- a/storage/innobase/ut/ut0crc32.cc
+++ b/storage/innobase/ut/ut0crc32.cc
@@ -131,6 +131,28 @@ ut_crc32_func_t ut_crc32 = ut_crc32_sw;
const char* ut_crc32_implementation = "Using generic crc32 instructions";
#endif
+#ifdef HAVE_ARMV8_CRC
+extern "C" {
+uint32_t crc32c_aarch64(uint32_t crc, const unsigned char *buffer, uint64_t len);
+};
+static inline
+uint32_t
+ut_crc32_armv8(
+ const byte* buf,
+ ulint len)
+{
+ return crc32c_aarch64(0, buf, len);
+}
+#endif
+
+/* For runtime check */
+#if defined(__GNUC__) && defined(__linux__) && defined(HAVE_ARMV8_CRC)
+extern "C" {
+unsigned int crc32c_aarch64_available(void);
+};
+#endif
+
+
#if (defined(__GNUC__) && defined(__x86_64__)) || defined(_MSC_VER)
/********************************************************************//**
Fetches CPU info */
@@ -544,4 +566,14 @@ ut_crc32_init()
ut_crc32_implementation = "Using SSE2 crc32 instructions";
}
#endif
+
+
+#if defined(__GNUC__) && defined(__linux__) && defined(HAVE_ARMV8_CRC)
+ if (crc32c_aarch64_available()) {
+ ut_crc32 = ut_crc32_armv8;
+ ut_crc32_implementation = "Using Armv8 crc32 instructions";
+
+ }
+#endif
+
}
diff --git a/storage/maria/CMakeLists.txt b/storage/maria/CMakeLists.txt
index 248f7cbe177..66cf6824a3a 100644
--- a/storage/maria/CMakeLists.txt
+++ b/storage/maria/CMakeLists.txt
@@ -13,14 +13,10 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
-INCLUDE(CMakeDependentOption)
-
-INCLUDE_DIRECTORIES(
-${SSL_INCLUDE_DIRS}
-)
+INCLUDE_DIRECTORIES(${SSL_INCLUDE_DIRS})
IF(SSL_DEFINES)
-SET_SOURCE_FILES_PROPERTIES(ma_crypt.c PROPERTIES COMPILE_FLAGS ${SSL_DEFINES})
+ SET_SOURCE_FILES_PROPERTIES(ma_crypt.c PROPERTIES COMPILE_FLAGS ${SSL_DEFINES})
ENDIF()
SET(ARIA_SOURCES ma_init.c ma_open.c ma_extra.c ma_info.c ma_rkey.c
@@ -30,14 +26,14 @@ SET(ARIA_SOURCES ma_init.c ma_open.c ma_extra.c ma_info.c ma_rkey.c
ma_rrnd.c ma_scan.c ma_cache.c
ma_statrec.c ma_packrec.c ma_dynrec.c
ma_blockrec.c ma_bitmap.c
- ma_update.c ma_write.c ma_unique.c
+ ma_update.c ma_write.c ma_unique.c
ma_delete.c
ma_rprev.c ma_rfirst.c ma_rlast.c ma_rsame.c
ma_rsamepos.c ma_panic.c ma_close.c ma_create.c
ma_range.c ma_dbug.c ma_checksum.c
ma_changed.c ma_static.c ma_delete_all.c
ma_delete_table.c ma_rename.c ma_check.c
- ma_keycache.c ma_preload.c ma_ft_parser.c
+ ma_keycache.c ma_preload.c ma_ft_parser.c
ma_ft_update.c ma_ft_boolean_search.c
ma_ft_nlq_search.c ft_maria.c ma_sort.c
ha_maria.cc trnman.c lockman.c
@@ -55,17 +51,9 @@ IF(APPLE)
ADD_DEFINITIONS(-fno-common)
ENDIF()
-MYSQL_ADD_PLUGIN(aria ${ARIA_SOURCES}
- STORAGE_ENGINE
- MANDATORY
- RECOMPILE_FOR_EMBEDDED)
-
-IF(NOT WITH_ARIA_STORAGE_ENGINE)
- RETURN()
-ENDIF()
-
-TARGET_LINK_LIBRARIES(aria myisam
- mysys mysys_ssl)
+MYSQL_ADD_PLUGIN(aria ${ARIA_SOURCES} STORAGE_ENGINE MANDATORY
+ LINK_LIBRARIES myisam mysys mysys_ssl
+ RECOMPILE_FOR_EMBEDDED)
MYSQL_ADD_EXECUTABLE(aria_ftdump maria_ftdump.c COMPONENT Server)
TARGET_LINK_LIBRARIES(aria_ftdump aria)
@@ -110,6 +98,35 @@ IF (MSVC)
SET_TARGET_PROPERTIES(aria_chk aria_pack PROPERTIES LINK_FLAGS "setargv.obj")
ENDIF()
-CMAKE_DEPENDENT_OPTION(USE_ARIA_FOR_TMP_TABLES "Use Aria for temporary tables" ON
- "WITH_ARIA_STORAGE_ENGINE" OFF)
+OPTION(USE_ARIA_FOR_TMP_TABLES "Use Aria for temporary tables" ON)
+
+#
+# S3
+#
+INCLUDE (CheckIncludeFiles)
+
+SET(S3_SOURCES ha_s3.cc s3_func.c
+ libmarias3/src/debug.c libmarias3/src/error.c libmarias3/src/marias3.c
+ libmarias3/src/request.c libmarias3/src/response.c libmarias3/src/sha256.c
+ libmarias3/src/sha256-internal.c)
+
+IF(NOT PLUGIN_S3 STREQUAL NO)
+ FIND_PACKAGE(LibXml2)
+ FIND_PACKAGE(CURL)
+ENDIF()
+
+IF (LIBXML2_FOUND AND CURL_FOUND)
+ MYSQL_ADD_PLUGIN(s3 ${S3_SOURCES} STORAGE_ENGINE STATIC_ONLY
+ LINK_LIBRARIES aria myisam mysys mysys_ssl xml2 curl
+ RECOMPILE_FOR_EMBEDDED)
+ENDIF()
+IF(TARGET s3)
+ MYSQL_ADD_EXECUTABLE(aria_s3_copy aria_s3_copy.cc COMPONENT Server)
+ TARGET_LINK_LIBRARIES(aria_s3_copy s3)
+
+ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/libmarias3 ${LIBXML2_INCLUDE_DIR})
+ ADD_DEFINITIONS(-DWITH_S3_STORAGE_ENGINE)
+
+ TARGET_LINK_LIBRARIES(aria s3)
+ENDIF()
diff --git a/storage/maria/aria_s3_copy.cc b/storage/maria/aria_s3_copy.cc
new file mode 100644
index 00000000000..ad2032d3fe2
--- /dev/null
+++ b/storage/maria/aria_s3_copy.cc
@@ -0,0 +1,332 @@
+/* Copyright (C) 2019 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 Street, Fifth Floor, Boston, MA 02111-1301 USA */
+
+/*
+ Allow copying of Aria tables to and from S3 and also delete them from S3
+*/
+
+#include "maria_def.h"
+#include <aria_backup.h>
+#include <my_getopt.h>
+#include <my_check_opt.h>
+#include <mysys_err.h>
+#include <mysqld_error.h>
+#include <zlib.h>
+#include <libmarias3/marias3.h>
+#include "s3_func.h"
+
+static const char *op_types[]= {"to_s3", "from_s3", "delete_from_s3", NullS};
+static TYPELIB op_typelib= {array_elements(op_types)-1,"", op_types, NULL};
+#define OP_IMPOSSIBLE array_elements(op_types)
+
+static const char *load_default_groups[]= { "aria_s3_copy", 0 };
+static const char *opt_s3_access_key, *opt_s3_secret_key;
+static const char *opt_s3_region="eu-north-1";
+static const char *opt_s3_host_name= DEFAULT_AWS_HOST_NAME;
+static const char *opt_database;
+static const char *opt_s3_bucket="MariaDB";
+static my_bool opt_compression, opt_verbose, opt_force, opt_s3_debug;
+static ulong opt_operation= OP_IMPOSSIBLE, opt_protocol_version= 1;
+static ulong opt_block_size;
+static char **default_argv=0;
+static ms3_st *global_s3_client= 0;
+
+
+static struct my_option my_long_options[] =
+{
+ {"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0,
+ 0, 0, 0, 0, 0},
+ {"s3_access_key", 'k', "AWS access key ID",
+ (char**) &opt_s3_access_key, (char**) &opt_s3_access_key, 0,
+ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"s3_region", 'r', "AWS region",
+ (char**) &opt_s3_region, (char**) &opt_s3_region, 0,
+ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"s3_secret_key", 'K', "AWS secret access key ID",
+ (char**) &opt_s3_secret_key, (char**) &opt_s3_secret_key, 0,
+ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"s3_bucket", 'b', "AWS prefix for tables",
+ (char**) &opt_s3_bucket, (char**) &opt_s3_bucket, 0,
+ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"s3_host_name", 'h', "Host name to S3 provider",
+ (char**) &opt_s3_host_name, (char**) &opt_s3_host_name, 0,
+ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"compress", 'c', "Use compression", &opt_compression, &opt_compression,
+ 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"op", 'o', "Operation to excecute. One of 'from_s3', 'to_s3' or "
+ "'delete_from_s3'",
+ &opt_operation, &opt_operation, &op_typelib,
+ GET_ENUM, REQUIRED_ARG, OP_IMPOSSIBLE, 0, 0, 0, 0, 0},
+ {"database", 'd',
+ "Database for copied table (second prefix). "
+ "If not given, the directory of the table file is used",
+ &opt_database, &opt_database, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"s3_block_size", 'B', "Block size for data/index blocks in s3",
+ &opt_block_size, &opt_block_size, 0, GET_ULONG, REQUIRED_ARG,
+ 4*1024*1024, 64*1024, 16*1024*1024, MALLOC_OVERHEAD, 1024, 0 },
+ {"s3_protocol_version", 'L',
+ "Protocol used to communication with S3. One of \"Auto\", \"Amazon\" or \"Original\".",
+ &opt_protocol_version, &opt_protocol_version, &s3_protocol_typelib,
+ GET_ENUM, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"force", 'f', "Force copy even if target exists",
+ &opt_force, &opt_force, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"verbose", 'v', "Write more information", &opt_verbose, &opt_verbose,
+ 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"version", 'V', "Print version and exit.",
+ 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+#ifndef DBUG_OFF
+ {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
+ 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+#endif
+ {"s3_debug",0, "Output debug log from marias3 to stdout",
+ &opt_s3_debug, &opt_s3_debug, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+};
+
+
+static bool get_database_from_path(char *to, size_t to_length, const char *path);
+
+
+static void print_version(void)
+{
+ printf("%s Ver 1.0 for %s on %s\n", my_progname, SYSTEM_TYPE,
+ MACHINE_TYPE);
+}
+
+static void usage(void)
+{
+ print_version();
+ puts("\nThis software comes with NO WARRANTY: "
+ " see the PUBLIC for details.\n");
+ puts("Copy an Aria table to and from s3");
+ printf("Usage: %s --aws-access-key=# --aws-secret-access-key=# --aws-region # "
+ "--op=(from_s3 | to_s3 | delete_from_s3) [OPTIONS] tables[.MAI]\n",
+ my_progname_short);
+ print_defaults("my", load_default_groups);
+ puts("");
+ my_print_help(my_long_options);
+ my_print_variables(my_long_options);
+}
+
+
+ATTRIBUTE_NORETURN static void my_exit(int exit_code)
+{
+ if (global_s3_client)
+ {
+ ms3_deinit(global_s3_client);
+ global_s3_client= 0;
+ }
+ free_defaults(default_argv);
+ s3_deinit_library();
+ my_end(MY_CHECK_ERROR);
+ exit(exit_code);
+}
+
+
+static my_bool get_one_option(int optid,
+ const struct my_option *opt
+ __attribute__((unused)),
+ char *argument)
+{
+ switch (optid) {
+ case 'V':
+ print_version();
+ my_exit(0);
+ case '?':
+ usage();
+ my_exit(0);
+ case '#':
+ DBUG_SET_INITIAL(argument ? argument : "d:t:o,/tmp/aria_s3_copy.trace");
+ break;
+ }
+ return 0;
+}
+
+
+static void get_options(register int *argc,register char ***argv)
+{
+ int ho_error;
+
+ load_defaults_or_exit("my", load_default_groups, argc, argv);
+ default_argv= *argv;
+
+ if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
+ my_exit(ho_error);
+
+ if (*argc == 0)
+ {
+ usage();
+ my_exit(-1);
+ }
+
+ if (!opt_s3_access_key)
+ {
+ fprintf(stderr, "--aws-access-key was not given\n");
+ my_exit(-1);
+ }
+ if (!opt_s3_secret_key)
+ {
+ fprintf(stderr, "--aws-secret-access-key was not given\n");
+ my_exit(-1);
+ }
+ if (opt_operation == OP_IMPOSSIBLE)
+ {
+ fprintf(stderr, "You must specify an operation with --op=[from_s3|to_s3|delete_from_s3]\n");
+ my_exit(-1);
+ }
+ if (opt_s3_debug)
+ ms3_debug();
+
+} /* get_options */
+
+
+int main(int argc, char** argv)
+{
+ MY_INIT(argv[0]);
+ get_options(&argc,(char***) &argv);
+
+ s3_init_library();
+ if (!(global_s3_client= ms3_init(opt_s3_access_key,
+ opt_s3_secret_key,
+ opt_s3_region, opt_s3_host_name)))
+ {
+ fprintf(stderr, "Can't open connection to S3, error: %d %s", errno,
+ ms3_error(errno));
+ my_exit(1);
+ }
+
+ {
+ size_t block_size= opt_block_size;
+ uint8_t protocol_version= (uint8_t) opt_protocol_version;
+ ms3_set_option(global_s3_client, MS3_OPT_BUFFER_CHUNK_SIZE, &block_size);
+
+ if (protocol_version)
+ ms3_set_option(global_s3_client, MS3_OPT_FORCE_PROTOCOL_VERSION,
+ &protocol_version);
+ }
+
+ for (; *argv ; argv++)
+ {
+ char database[FN_REFLEN], table_name[FN_REFLEN], *path;
+ const char *db;
+
+ path= *argv;
+
+ fn_format(table_name, path, "", "", MY_REPLACE_DIR | MY_REPLACE_EXT);
+
+ /* Get database from option, path or current directory */
+ if (!(db= opt_database))
+ {
+ if (get_database_from_path(database, sizeof(database), path))
+ {
+ fprintf(stderr, "Aborting copying of %s\n", path);
+ my_exit(-1);
+ }
+ db= database;
+ }
+
+ switch (opt_operation) {
+ case 0:
+ /* Don't copy .frm file for partioned table */
+ if (aria_copy_to_s3(global_s3_client, opt_s3_bucket, path,
+ db, table_name, opt_block_size, opt_compression,
+ opt_force, opt_verbose, !strstr(table_name, "#P#")))
+ {
+ fprintf(stderr, "Aborting copying of %s\n", path);
+ my_exit(-1);
+ }
+ break;
+ case 1:
+ if (aria_copy_from_s3(global_s3_client, opt_s3_bucket, path,
+ db, opt_compression, opt_force, opt_verbose))
+ {
+ fprintf(stderr, "Aborting copying of %s\n", path);
+ my_exit(-1);
+ }
+ break;
+ case 2:
+ if (aria_delete_from_s3(global_s3_client, opt_s3_bucket, db,
+ table_name, opt_verbose))
+ {
+ fprintf(stderr, "Aborting copying of %s\n", path);
+ my_exit(-1);
+ }
+ break;
+ }
+ }
+ my_exit(0);
+ return 0;
+}
+
+
+/**
+ Calculate database name base on path of Aria file
+
+ @return 0 ok
+ @return 1 error
+*/
+
+static bool get_database_from_path(char *to, size_t to_length,
+ const char *path)
+{
+ S3_INFO s3;
+ if (!set_database_and_table_from_path(&s3, path))
+ {
+ strmake(to, s3.database.str, MY_MIN(s3.database.length, to_length-1));
+ return 0;
+ }
+
+ if (my_getwd(to, to_length-1, MYF(MY_WME)))
+ return 1;
+ return get_database_from_path(to, to_length, to);
+}
+
+
+#include "ma_check_standalone.h"
+
+/*
+ Declare all symbols from libmyisam.a, to ensure that we don't have
+ to include the library as it pulls in ha_myisam.cc
+*/
+
+const char *ft_boolean_syntax= 0;
+ulong ft_min_word_len=0, ft_max_word_len=0;
+const HA_KEYSEG ft_keysegs[FT_SEGS]= {
+{
+ 0, /* charset */
+ HA_FT_WLEN, /* start */
+ 0, /* null_pos */
+ 0, /* Bit pos */
+ HA_VAR_LENGTH_PART | HA_PACK_KEY, /* flag */
+ HA_FT_MAXBYTELEN, /* length */
+ 63, /* language (will be overwritten
+) */
+ HA_KEYTYPE_VARTEXT2, /* type */
+ 0, /* null_bit */
+ 2, 0 /* bit_start, bit_length */
+},
+{
+ 0, 0, 0, 0, HA_NO_SORT, HA_FT_WLEN, 63, HA_FT_WTYPE, 0, 0, 0
+}
+};
+
+struct st_mysql_ftparser ft_default_parser=
+{
+ MYSQL_FTPARSER_INTERFACE_VERSION, 0, 0, 0
+};
+
+C_MODE_START
+int is_stopword(const char *word, size_t len) { return 0; }
+C_MODE_END
diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc
index d0924ff0bc2..52ae6dd8e2b 100644
--- a/storage/maria/ha_maria.cc
+++ b/storage/maria/ha_maria.cc
@@ -56,7 +56,7 @@ C_MODE_END
#else
#define CANNOT_ROLLBACK_FLAG 0
#endif
-#define THD_TRN (*(TRN **)thd_ha_data(thd, maria_hton))
+#define THD_TRN (TRN*) thd_get_ha_data(thd, maria_hton)
ulong pagecache_division_limit, pagecache_age_threshold, pagecache_file_hash_size;
ulonglong pagecache_buffer_size;
@@ -287,7 +287,7 @@ static MYSQL_SYSVAR_ENUM(sync_log_dir, sync_log_dir, PLUGIN_VAR_RQCMDARG,
#endif
my_bool use_maria_for_temp_tables= USE_ARIA_FOR_TMP_TABLES_VAL;
-static MYSQL_SYSVAR_BOOL(used_for_temp_tables,
+static MYSQL_SYSVAR_BOOL(used_for_temp_tables,
use_maria_for_temp_tables, PLUGIN_VAR_READONLY | PLUGIN_VAR_NOCMDOPT,
"Whether temporary tables should be MyISAM or Aria", 0, 0,
1);
@@ -957,7 +957,7 @@ static int maria_create_trn_for_mysql(MARIA_HA *info)
trn= trnman_new_trn(& thd->transaction.wt);
if (unlikely(!trn))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- THD_TRN= trn;
+ thd_set_ha_data(thd, maria_hton, trn);
if (thd->variables.option_bits & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
trans_register_ha(thd, TRUE, maria_hton);
}
@@ -982,7 +982,7 @@ static int maria_create_trn_for_mysql(MARIA_HA *info)
DBUG_PRINT("info", ("lock_type: %d trnman_flags: %u",
info->lock_type, trnman_get_flags(trn)));
}
-
+
#endif
DBUG_RETURN(0);
}
@@ -1064,7 +1064,7 @@ ulong ha_maria::index_flags(uint inx, uint part, bool all_parts) const
ulong flags;
if (table_share->key_info[inx].algorithm == HA_KEY_ALG_FULLTEXT)
flags= 0;
- else
+ else
if ((table_share->key_info[inx].flags & HA_SPATIAL ||
table_share->key_info[inx].algorithm == HA_KEY_ALG_RTREE))
{
@@ -1072,7 +1072,7 @@ ulong ha_maria::index_flags(uint inx, uint part, bool all_parts) const
flags= HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE |
HA_READ_ORDER | HA_KEYREAD_ONLY | HA_KEY_SCAN_NOT_ROR;
}
- else
+ else
{
flags= HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE |
HA_READ_ORDER | HA_KEYREAD_ONLY | HA_DO_INDEX_COND_PUSHDOWN;
@@ -1093,11 +1093,8 @@ double ha_maria::scan_time()
splitting algorithms depends on this. (With only one key on a page
we also can't use any compression, which may make the index file much
larger)
- We use HA_MAX_KEY_LENGTH as this is a stack restriction imposed by the
- handler interface. If we want to increase this, we have also to
- increase HA_MARIA_KEY_BUFF and MARIA_MAX_KEY_BUFF as the buffer needs
- to take be able to store the extra lenght bytes that is part of the stored
- key.
+ We use MARIA_MAX_KEY_LENGTH to limit the key size as we don't want to use
+ too much stack when searching in the b_tree.
We also need to reserve place for a record pointer (8) and 3 bytes
per key segment to store the length of the segment + possible null bytes.
@@ -1142,7 +1139,8 @@ int ha_maria::open(const char *name, int mode, uint test_if_locked)
test_if_locked|= HA_OPEN_ABORT_IF_CRASHED;
}
- if (!(file= maria_open(name, mode, test_if_locked | HA_OPEN_FROM_SQL_LAYER)))
+ if (!(file= maria_open(name, mode, test_if_locked | HA_OPEN_FROM_SQL_LAYER,
+ s3_open_args())))
{
if (my_errno == HA_ERR_OLD_FILE)
{
@@ -1172,7 +1170,7 @@ int ha_maria::open(const char *name, int mode, uint test_if_locked)
stand up to "when client gets ok the data is safe on disk": the record
may not even be inserted). In the future, we could enable it back (as a
client doing INSERT DELAYED knows the specificities; but we then should
- make sure to regularly commit in the delayed_insert thread).
+ make sure to regularly commit in the delayed_insert thread).
*/
int_table_flags|= HA_CAN_INSERT_DELAYED;
}
@@ -1194,7 +1192,7 @@ int ha_maria::open(const char *name, int mode, uint test_if_locked)
that all bytes in the row is properly reset.
*/
if (file->s->data_file_type == STATIC_RECORD &&
- (file->s->has_varchar_fields | file->s->has_null_fields))
+ (file->s->has_varchar_fields || file->s->has_null_fields))
int_table_flags|= HA_RECORD_MUST_BE_CLEAN_ON_WRITE;
for (i= 0; i < table->s->keys; i++)
@@ -1645,11 +1643,11 @@ int ha_maria::repair(THD *thd, HA_CHECK *param, bool do_optimize)
error= maria_repair_by_sort(param, file, fixed_name,
MY_TEST(param->testflag & T_QUICK));
}
- if (error && file->create_unique_index_by_sort &&
+ if (error && file->create_unique_index_by_sort &&
share->state.dupp_key != MAX_KEY)
{
my_errno= HA_ERR_FOUND_DUPP_KEY;
- print_keydup_error(table, &table->key_info[share->state.dupp_key],
+ print_keydup_error(table, &table->key_info[share->state.dupp_key],
MYF(0));
}
}
@@ -2327,6 +2325,7 @@ int ha_maria::index_read_map(uchar * buf, const uchar * key,
enum ha_rkey_function find_flag)
{
DBUG_ASSERT(inited == INDEX);
+ register_handler(file);
int error= maria_rkey(file, buf, active_index, key, keypart_map, find_flag);
return error;
}
@@ -2337,13 +2336,15 @@ int ha_maria::index_read_idx_map(uchar * buf, uint index, const uchar * key,
enum ha_rkey_function find_flag)
{
int error;
+ register_handler(file);
+
/* Use the pushed index condition if it matches the index we're scanning */
end_range= NULL;
if (index == pushed_idx_cond_keyno)
ma_set_index_cond_func(file, handler_index_cond_check, this);
-
+
error= maria_rkey(file, buf, index, key, keypart_map, find_flag);
-
+
ma_set_index_cond_func(file, NULL, 0);
return error;
}
@@ -2354,6 +2355,7 @@ int ha_maria::index_read_last_map(uchar * buf, const uchar * key,
{
DBUG_ENTER("ha_maria::index_read_last_map");
DBUG_ASSERT(inited == INDEX);
+ register_handler(file);
int error= maria_rkey(file, buf, active_index, key, keypart_map,
HA_READ_PREFIX_LAST);
DBUG_RETURN(error);
@@ -2363,6 +2365,7 @@ int ha_maria::index_read_last_map(uchar * buf, const uchar * key,
int ha_maria::index_next(uchar * buf)
{
DBUG_ASSERT(inited == INDEX);
+ register_handler(file);
int error= maria_rnext(file, buf, active_index);
return error;
}
@@ -2371,6 +2374,7 @@ int ha_maria::index_next(uchar * buf)
int ha_maria::index_prev(uchar * buf)
{
DBUG_ASSERT(inited == INDEX);
+ register_handler(file);
int error= maria_rprev(file, buf, active_index);
return error;
}
@@ -2379,6 +2383,7 @@ int ha_maria::index_prev(uchar * buf)
int ha_maria::index_first(uchar * buf)
{
DBUG_ASSERT(inited == INDEX);
+ register_handler(file);
int error= maria_rfirst(file, buf, active_index);
return error;
}
@@ -2387,6 +2392,7 @@ int ha_maria::index_first(uchar * buf)
int ha_maria::index_last(uchar * buf)
{
DBUG_ASSERT(inited == INDEX);
+ register_handler(file);
int error= maria_rlast(file, buf, active_index);
return error;
}
@@ -2398,6 +2404,7 @@ int ha_maria::index_next_same(uchar * buf,
{
int error;
DBUG_ASSERT(inited == INDEX);
+ register_handler(file);
/*
TODO: Delete this loop in Maria 1.5 as versioning will ensure this never
happens
@@ -2411,11 +2418,11 @@ int ha_maria::index_next_same(uchar * buf,
int ha_maria::index_init(uint idx, bool sorted)
-{
+{
active_index=idx;
if (pushed_idx_cond_keyno == idx)
ma_set_index_cond_func(file, handler_index_cond_check, this);
- return 0;
+ return 0;
}
@@ -2425,7 +2432,7 @@ int ha_maria::index_end()
ma_set_index_cond_func(file, NULL, 0);
in_range_check_pushed_down= FALSE;
ds_mrr.dsmrr_close();
- return 0;
+ return 0;
}
@@ -2448,13 +2455,14 @@ int ha_maria::rnd_end()
int ha_maria::rnd_next(uchar *buf)
{
- int error= maria_scan(file, buf);
- return error;
+ register_handler(file);
+ return maria_scan(file, buf);
}
int ha_maria::remember_rnd_pos()
{
+ register_handler(file);
return (*file->s->scan_remember_pos)(file, &remember_pos);
}
@@ -2462,6 +2470,7 @@ int ha_maria::remember_rnd_pos()
int ha_maria::restart_rnd_next(uchar *buf)
{
int error;
+ register_handler(file);
if ((error= (*file->s->scan_restore_pos)(file, remember_pos)))
return error;
return rnd_next(buf);
@@ -2470,6 +2479,7 @@ int ha_maria::restart_rnd_next(uchar *buf)
int ha_maria::rnd_pos(uchar *buf, uchar *pos)
{
+ register_handler(file);
int error= maria_rrnd(file, buf, my_get_ptr(pos, ref_length));
return error;
}
@@ -2530,11 +2540,13 @@ int ha_maria::info(uint flag)
data_file_name= index_file_name= 0;
fn_format(name_buff, file->s->open_file_name.str, "", MARIA_NAME_DEXT,
MY_APPEND_EXT | MY_UNPACK_FILENAME);
- if (strcmp(name_buff, maria_info.data_file_name))
- data_file_name =maria_info.data_file_name;
+ if (strcmp(name_buff, maria_info.data_file_name) &&
+ maria_info.data_file_name[0])
+ data_file_name= maria_info.data_file_name;
fn_format(name_buff, file->s->open_file_name.str, "", MARIA_NAME_IEXT,
MY_APPEND_EXT | MY_UNPACK_FILENAME);
- if (strcmp(name_buff, maria_info.index_file_name))
+ if (strcmp(name_buff, maria_info.index_file_name) &&
+ maria_info.index_file_name[0])
index_file_name=maria_info.index_file_name;
}
if (flag & HA_STATUS_ERRKEY)
@@ -2771,13 +2783,13 @@ int ha_maria::external_lock(THD *thd, int lock_type)
#ifdef MARIA_CANNOT_ROLLBACK
if (ma_commit(trn))
DBUG_RETURN(1);
- THD_TRN= 0;
+ thd_set_ha_data(thd, maria_hton, 0);
#else
if (!(thd->variables.option_bits & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))
{
trnman_rollback_trn(trn);
DBUG_PRINT("info", ("THD_TRN set to 0x0"));
- THD_TRN= 0;
+ thd_set_ha_data(thd, maria_hton, 0);
}
#endif
}
@@ -2790,6 +2802,9 @@ int ha_maria::external_lock(THD *thd, int lock_type)
F_UNLCK : F_EXTRA_LCK));
if (!file->s->base.born_transactional)
file->state= &file->s->state.state; // Restore state if clone
+
+ /* Remember stack end for this thread */
+ file->stack_end_ptr= &ha_thd()->mysys_var->stack_ends_here;
DBUG_RETURN(result);
}
@@ -2837,7 +2852,7 @@ int ha_maria::start_stmt(THD *thd, thr_lock_type lock_type)
static void reset_thd_trn(THD *thd, MARIA_HA *first_table)
{
DBUG_ENTER("reset_thd_trn");
- THD_TRN= NULL;
+ thd_set_ha_data(thd, maria_hton, 0);
MARIA_HA *next;
for (MARIA_HA *table= first_table; table ; table= next)
{
@@ -2921,7 +2936,7 @@ int ha_maria::implicit_commit(THD *thd, bool new_trn)
statement assuming they have a trn (see ha_maria::start_stmt()).
*/
trn= trnman_new_trn(& thd->transaction.wt);
- THD_TRN= trn;
+ thd_set_ha_data(thd, maria_hton, trn);
if (unlikely(trn == NULL))
{
reset_thd_trn(thd, used_tables);
@@ -3075,6 +3090,7 @@ int ha_maria::create(const char *name, TABLE *table_arg,
MARIA_CREATE_INFO create_info;
TABLE_SHARE *share= table_arg->s;
uint options= share->db_options_in_use;
+ ha_table_option_struct *table_options= table_arg->s->option_struct;
enum data_file_type row_type;
THD *thd= current_thd;
DBUG_ENTER("ha_maria::create");
@@ -3119,6 +3135,12 @@ int ha_maria::create(const char *name, TABLE *table_arg,
create_info.data_file_name= ha_create_info->data_file_name;
create_info.index_file_name= ha_create_info->index_file_name;
create_info.language= share->table_charset->number;
+ if (ht != maria_hton)
+ {
+ /* S3 engine */
+ create_info.s3_block_size= (ulong) table_options->s3_block_size;
+ create_info.compression_algorithm= table_options->compression_algorithm;
+ }
/*
Table is transactional:
@@ -3154,6 +3176,7 @@ int ha_maria::create(const char *name, TABLE *table_arg,
(void) translog_log_debug_info(0, LOGREC_DEBUG_INFO_QUERY,
(uchar*) thd->query(), thd->query_length());
+ create_info.encrypted= maria_encrypt_tables && ht == maria_hton;
/* TODO: Check that the following fn_format is really needed */
error=
maria_create(fn_format(buff, name, "", "",
@@ -3253,6 +3276,7 @@ void ha_maria::get_auto_increment(ulonglong offset, ulonglong increment,
ha_rows ha_maria::records_in_range(uint inx, key_range *min_key,
key_range *max_key)
{
+ register_handler(file);
return (ha_rows) maria_records_in_range(file, (int) inx, min_key, max_key);
}
@@ -3264,6 +3288,8 @@ int ha_maria::ft_read(uchar * buf)
if (!ft_handler)
return -1;
+ register_handler(file);
+
thread_safe_increment(table->in_use->status_var.ha_read_next_count,
&LOCK_status); // why ?
@@ -3587,7 +3613,6 @@ static int ha_maria_init(void *p)
#endif
maria_hton= (handlerton *)p;
- maria_hton->state= SHOW_OPTION_YES;
maria_hton->db_type= DB_TYPE_ARIA;
maria_hton->create= maria_create_handler;
maria_hton->panic= maria_hton_panic;
@@ -3714,7 +3739,7 @@ my_bool ha_maria::register_query_cache_table(THD *thd, const char *table_name,
}
#endif
-struct st_mysql_sys_var* system_variables[]= {
+static struct st_mysql_sys_var *system_variables[]= {
MYSQL_SYSVAR(block_size),
MYSQL_SYSVAR(checkpoint_interval),
MYSQL_SYSVAR(checkpoint_log_activity),
@@ -3854,7 +3879,7 @@ static void update_log_file_size(MYSQL_THD thd,
}
-SHOW_VAR status_variables[]= {
+static SHOW_VAR status_variables[]= {
{"pagecache_blocks_not_flushed", (char*) &maria_pagecache_var.global_blocks_changed, SHOW_LONG},
{"pagecache_blocks_unused", (char*) &maria_pagecache_var.blocks_unused, SHOW_LONG},
{"pagecache_blocks_used", (char*) &maria_pagecache_var.blocks_used, SHOW_LONG},
@@ -3871,7 +3896,7 @@ SHOW_VAR status_variables[]= {
***************************************************************************/
int ha_maria::multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param,
- uint n_ranges, uint mode,
+ uint n_ranges, uint mode,
HANDLER_BUFFER *buf)
{
return ds_mrr.dsmrr_init(this, seq, seq_init_param, n_ranges, mode, buf);
@@ -3883,7 +3908,7 @@ int ha_maria::multi_range_read_next(range_id_t *range_info)
}
ha_rows ha_maria::multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq,
- void *seq_init_param,
+ void *seq_init_param,
uint n_ranges, uint *bufsz,
uint *flags, Cost_estimate *cost)
{
@@ -3898,14 +3923,14 @@ ha_rows ha_maria::multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq,
}
ha_rows ha_maria::multi_range_read_info(uint keyno, uint n_ranges, uint keys,
- uint key_parts, uint *bufsz,
+ uint key_parts, uint *bufsz,
uint *flags, Cost_estimate *cost)
{
ds_mrr.init(this, table);
return ds_mrr.dsmrr_info(keyno, n_ranges, keys, key_parts, bufsz, flags, cost);
}
-int ha_maria::multi_range_read_explain_info(uint mrr_mode, char *str,
+int ha_maria::multi_range_read_explain_info(uint mrr_mode, char *str,
size_t size)
{
return ds_mrr.dsmrr_explain_info(mrr_mode, str, size);
@@ -3962,6 +3987,7 @@ Item *ha_maria::idx_cond_push(uint keyno_arg, Item* idx_cond_arg)
int ha_maria::find_unique_row(uchar *record, uint constrain_no)
{
int rc;
+ register_handler(file);
if (file->s->state.header.uniques)
{
DBUG_ASSERT(file->s->state.header.uniques > constrain_no);
diff --git a/storage/maria/ha_maria.h b/storage/maria/ha_maria.h
index ef0ceb1cd32..691d1c9747b 100644
--- a/storage/maria/ha_maria.h
+++ b/storage/maria/ha_maria.h
@@ -48,7 +48,7 @@ class ha_maria :public handler
bool can_enable_indexes;
/**
If a transactional table is doing bulk insert with a single
- UNDO_BULK_INSERT with/without repair.
+ UNDO_BULK_INSERT with/without repair.
*/
uint8 bulk_insert_single_undo;
int repair(THD * thd, HA_CHECK *param, bool optimize);
@@ -173,22 +173,28 @@ public:
uint n_ranges, uint mode, HANDLER_BUFFER *buf);
int multi_range_read_next(range_id_t *range_info);
ha_rows multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq,
- void *seq_init_param,
+ void *seq_init_param,
uint n_ranges, uint *bufsz,
uint *flags, Cost_estimate *cost);
ha_rows multi_range_read_info(uint keyno, uint n_ranges, uint keys,
- uint key_parts, uint *bufsz,
+ uint key_parts, uint *bufsz,
uint *flags, Cost_estimate *cost);
int multi_range_read_explain_info(uint mrr_mode, char *str, size_t size);
-
+
/* Index condition pushdown implementation */
Item *idx_cond_push(uint keyno, Item* idx_cond);
int find_unique_row(uchar *record, uint unique_idx);
+
+ /* Following functions are needed by the S3 handler */
+ virtual S3_INFO *s3_open_args() { return 0; }
+ virtual void register_handler(MARIA_HA *file) {}
+
private:
DsMrr_impl ds_mrr;
friend ICP_RESULT index_cond_func_maria(void *arg);
friend void reset_thd_trn(THD *thd);
+ friend class ha_s3;
};
#endif /* HA_MARIA_INCLUDED */
diff --git a/storage/maria/ha_s3.cc b/storage/maria/ha_s3.cc
new file mode 100644
index 00000000000..4b757cdcbfd
--- /dev/null
+++ b/storage/maria/ha_s3.cc
@@ -0,0 +1,774 @@
+/* Copyright (C) 2019 MariaDB Corppration 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.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
+*/
+
+/*
+ Implementation of S3 storage engine.
+
+ Storage format:
+
+ The S3 engine is read only storage engine. The data is stored in
+ same format as a non transactional Aria table in BLOCK_RECORD format.
+ This makes it easy to cache both index and rows in the page cache.
+ Data and index file are split into blocks of 's3_block_size', default
+ 4M.
+
+ The table and it's associated files are stored in S3 into the following
+ locations:
+
+ frm file (for discovery):
+ aws_bucket/database/table/frm
+
+ First index block (contains description if the Aria file):
+ aws_bucket/database/table/aria
+
+ Rest of the index file:
+ aws_bucket/database/table/index/block_number
+
+ Data file:
+ aws_bucket/database/table/data/block_number
+
+ block_number is 6 digits decimal number, prefixed with 0
+ (Can be larger than 6 numbers, the prefix is just for nice output)
+
+ frm and base blocks are small (just the needed data).
+ index and blocks are of size 's3_block_size'
+
+ If compression is used, then original block size is s3_block_size
+ but the stored block will be the size of the compressed block.
+
+ Implementation:
+ The s3 engine inherits from the ha_maria handler
+
+ s3 will use it's own page cache to not interfere with normal Aria
+ usage but also to ensure that the S3 page cache is large enough
+ (with a 4M s3_block_size the engine will need a large cache to work,
+ at least s3_block_size * 32. The default cache is 512M.
+*/
+
+#define MYSQL_SERVER 1
+#include "maria_def.h"
+#include "sql_class.h"
+#include <mysys_err.h>
+#include <libmarias3/marias3.h>
+#include <discover.h>
+#include "ha_s3.h"
+#include "s3_func.h"
+#include "aria_backup.h"
+
+#define DEFAULT_AWS_HOST_NAME "s3.amazonaws.com"
+
+static PAGECACHE s3_pagecache;
+static ulong s3_block_size, s3_protocol_version;
+static ulong s3_pagecache_division_limit, s3_pagecache_age_threshold;
+static ulong s3_pagecache_file_hash_size;
+static ulonglong s3_pagecache_buffer_size;
+static char *s3_bucket, *s3_access_key=0, *s3_secret_key=0, *s3_region;
+static char *s3_host_name;
+static char *s3_tmp_access_key=0, *s3_tmp_secret_key=0;
+static my_bool s3_debug= 0;
+handlerton *s3_hton= 0;
+
+/* Don't show access or secret keys to users if they exists */
+
+static void update_access_key(MYSQL_THD thd,
+ struct st_mysql_sys_var *var,
+ void *var_ptr, const void *save)
+{
+ my_free(s3_access_key);
+ s3_access_key= 0;
+ /* Don't show real key to user in SHOW VARIABLES */
+ if (s3_tmp_access_key[0])
+ {
+ s3_access_key= s3_tmp_access_key;
+ s3_tmp_access_key= my_strdup("*****", MYF(MY_WME));
+ }
+}
+
+static void update_secret_key(MYSQL_THD thd,
+ struct st_mysql_sys_var *var,
+ void *var_ptr, const void *save)
+{
+ my_free(s3_secret_key);
+ s3_secret_key= 0;
+ /* Don't show real key to user in SHOW VARIABLES */
+ if (s3_tmp_secret_key[0])
+ {
+ s3_secret_key= s3_tmp_secret_key;
+ s3_tmp_secret_key= my_strdup("*****", MYF(MY_WME));
+ }
+}
+
+/* Define system variables for S3 */
+
+static MYSQL_SYSVAR_ULONG(block_size, s3_block_size,
+ PLUGIN_VAR_RQCMDARG,
+ "Block size for S3", 0, 0,
+ 4*1024*1024, 65536, 16*1024*1024, 8192);
+
+static MYSQL_SYSVAR_BOOL(debug, s3_debug,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
+ "Generates trace file from libmarias3 on stderr for debugging",
+ 0, 0, 0);
+
+static MYSQL_SYSVAR_ENUM(protocol_version, s3_protocol_version,
+ PLUGIN_VAR_RQCMDARG,
+ "Protocol used to communication with S3. One of "
+ "\"Auto\", \"Amazon\" or \"Original\".",
+ NULL, NULL, 0, &s3_protocol_typelib);
+
+static MYSQL_SYSVAR_ULONG(pagecache_age_threshold,
+ s3_pagecache_age_threshold, PLUGIN_VAR_RQCMDARG,
+ "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 the page cache.", 0, 0,
+ 300, 100, ~ (ulong) 0L, 100);
+
+static MYSQL_SYSVAR_ULONGLONG(pagecache_buffer_size, s3_pagecache_buffer_size,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
+ "The size of the buffer used for index blocks for S3 tables. "
+ "Increase this to get better index handling (for all reads and "
+ "multiple writes) to as much as you can afford.", 0, 0,
+ 128*1024*1024, 1024*1024*32, ~(ulonglong) 0, 8192);
+
+static MYSQL_SYSVAR_ULONG(pagecache_division_limit,
+ s3_pagecache_division_limit,
+ PLUGIN_VAR_RQCMDARG,
+ "The minimum percentage of warm blocks in key cache", 0, 0,
+ 100, 1, 100, 1);
+
+static MYSQL_SYSVAR_ULONG(pagecache_file_hash_size,
+ s3_pagecache_file_hash_size,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
+ "Number of hash buckets for open files. If you have a lot "
+ "of S3 files open you should increase this for faster flush of "
+ "changes. A good value is probably 1/10 of number of possible open "
+ "S3 files.", 0,0, 512, 32, 16384, 1);
+
+static MYSQL_SYSVAR_STR(bucket, s3_bucket,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
+ "AWS bucket",
+ 0, 0, "MariaDB");
+static MYSQL_SYSVAR_STR(host_name, s3_host_name,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
+ "AWS bucket",
+ 0, 0, DEFAULT_AWS_HOST_NAME);
+static MYSQL_SYSVAR_STR(access_key, s3_tmp_access_key,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY | PLUGIN_VAR_MEMALLOC,
+ "AWS access key",
+ 0, update_access_key, "");
+static MYSQL_SYSVAR_STR(secret_key, s3_tmp_secret_key,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY | PLUGIN_VAR_MEMALLOC,
+ "AWS secret key",
+ 0, update_secret_key, "");
+static MYSQL_SYSVAR_STR(region, s3_region,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
+ "AWS region",
+ 0, 0, "");
+
+ha_create_table_option s3_table_option_list[]=
+{
+ /*
+ one numeric option, with the default of UINT_MAX32, valid
+ range of values 0..UINT_MAX32, and a "block size" of 10
+ (any value must be divisible by 10).
+ */
+ HA_TOPTION_SYSVAR("s3_block_size", s3_block_size, block_size),
+ HA_TOPTION_ENUM("compression_algorithm", compression_algorithm, "none,zlib",
+ 0),
+ HA_TOPTION_END
+};
+
+
+/*****************************************************************************
+ S3 handler code
+******************************************************************************/
+
+/**
+ Create S3 handler
+*/
+
+
+ha_s3::ha_s3(handlerton *hton, TABLE_SHARE *table_arg)
+ :ha_maria(hton, table_arg), in_alter_table(0)
+{
+ /* Remove things that S3 doesn't support */
+ int_table_flags&= ~(HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE |
+ HA_CAN_EXPORT);
+ can_enable_indexes= 0;
+}
+
+
+/**
+ Remember the handler to use for s3_block_read()
+
+ @note
+ In the future the ms3_st objects could be stored in
+ a list in share. In this case we would however need a mutex
+ to access the next free one. By using st_my_thread_var we
+ can avoid the mutex with the small cost of having to call
+ register handler in all handler functions that will access
+ the page cache
+*/
+
+void ha_s3::register_handler(MARIA_HA *file)
+{
+ struct st_my_thread_var *thread= my_thread_var;
+ thread->keycache_file= (void*) file;
+}
+
+
+/**
+ Write a row
+
+ When generating the table as part of ALTER TABLE, writes are allowed.
+ When table is moved to S3, writes are not allowed.
+*/
+
+int ha_s3::write_row(const uchar *buf)
+{
+ if (in_alter_table)
+ return ha_maria::write_row(buf);
+ return HA_ERR_WRONG_COMMAND;
+}
+
+/* Return true if S3 can be used */
+
+static my_bool s3_usable()
+{
+ return (s3_access_key != 0 && s3_secret_key != 0 && s3_region != 0 &&
+ s3_bucket != 0);
+}
+
+
+static my_bool s3_info_init(S3_INFO *info)
+{
+ if (!s3_usable())
+ return 1;
+ info->protocol_version= (uint8_t) s3_protocol_version;
+ lex_string_set(&info->host_name, s3_host_name);
+ lex_string_set(&info->access_key, s3_access_key);
+ lex_string_set(&info->secret_key, s3_secret_key);
+ lex_string_set(&info->region, s3_region);
+ lex_string_set(&info->bucket, s3_bucket);
+ return 0;
+}
+
+/**
+ Fill information in S3_INFO including paths to table and database
+
+ Notes:
+ Database and table name are set even if s3 variables are not
+ initialized. This is needed by s3::drop_table
+*/
+
+static my_bool s3_info_init(S3_INFO *s3_info, const char *path,
+ char *database_buff, size_t database_length)
+{
+ set_database_and_table_from_path(s3_info, path);
+ /* Fix database as it's not \0 terminated */
+ strmake(database_buff, s3_info->database.str,
+ MY_MIN(database_length, s3_info->database.length));
+ s3_info->database.str= database_buff;
+ return s3_info_init(s3_info);
+}
+
+
+/**
+ Drop S3 table
+*/
+
+int ha_s3::delete_table(const char *name)
+{
+ ms3_st *s3_client;
+ S3_INFO s3_info;
+ int error;
+ char database[NAME_LEN+1];
+ DBUG_ENTER("ha_s3::delete_table");
+
+ error= s3_info_init(&s3_info, name, database, sizeof(database)-1);
+
+ /* If internal on disk temporary table, let Aria take care of it */
+ if (!strncmp(s3_info.table.str, "#sql-", 5))
+ DBUG_RETURN(ha_maria::delete_table(name));
+
+ if (error)
+ DBUG_RETURN(HA_ERR_UNSUPPORTED);
+
+ if (!(s3_client= s3_open_connection(&s3_info)))
+ DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
+ error= aria_delete_from_s3(s3_client, s3_info.bucket.str,
+ s3_info.database.str,
+ s3_info.table.str,0);
+ ms3_deinit(s3_client);
+ DBUG_RETURN(error);
+}
+
+/**
+ Copy an Aria table to S3 or rename a table in S3
+
+ The copy happens as part of the rename in ALTER TABLE when all data
+ is in an Aria table and we now have to copy it to S3.
+
+ If the table is an old table already in S3, we should just rename it.
+*/
+
+int ha_s3::rename_table(const char *from, const char *to)
+{
+ S3_INFO to_s3_info, from_s3_info;
+ char to_name[FN_REFLEN], from_name[FN_REFLEN], frm_name[FN_REFLEN];
+ ms3_st *s3_client;
+ MY_STAT stat_info;
+ int error;
+ bool is_partition= (strstr(from, "#P#") != NULL) ||
+ (strstr(to, "#P#") != NULL);
+ DBUG_ENTER("ha_s3::rename_table");
+
+ if (s3_info_init(&to_s3_info, to, to_name, NAME_LEN))
+ DBUG_RETURN(HA_ERR_UNSUPPORTED);
+ if (!(s3_client= s3_open_connection(&to_s3_info)))
+ DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
+
+ /*
+ Check if this is a on disk table created by ALTER TABLE that should be
+ copied to S3. We know this is the case if the table is a temporary table
+ and the .MAI file for the table is on disk
+ */
+ fn_format(frm_name, from, "", reg_ext, MYF(0));
+ if (!strncmp(from + dirname_length(from), "#sql-", 5) &&
+ (is_partition || my_stat(frm_name, &stat_info, MYF(0))))
+ {
+ /*
+ The table is a temporary table as part of ALTER TABLE.
+ Copy the on disk temporary Aria table to S3.
+ */
+ error= aria_copy_to_s3(s3_client, to_s3_info.bucket.str, from,
+ to_s3_info.database.str,
+ to_s3_info.table.str,
+ 0, 0, 0, 0, !is_partition);
+ if (!error)
+ {
+ /* Remove original files table files, keep .frm */
+ fn_format(from_name, from, "", MARIA_NAME_DEXT,
+ MY_APPEND_EXT|MY_UNPACK_FILENAME);
+ my_delete(from_name, MYF(MY_WME | ME_WARNING));
+ fn_format(from_name, from, "", MARIA_NAME_IEXT,
+ MY_APPEND_EXT|MY_UNPACK_FILENAME);
+ my_delete(from_name, MYF(MY_WME | ME_WARNING));
+ }
+ }
+ else
+ {
+ /* The table is an internal S3 table. Do the renames */
+ s3_info_init(&from_s3_info, from, from_name, NAME_LEN);
+
+ error= aria_rename_s3(s3_client, to_s3_info.bucket.str,
+ from_s3_info.database.str,
+ from_s3_info.table.str,
+ to_s3_info.database.str,
+ to_s3_info.table.str,
+ !is_partition &&
+ !current_thd->lex->alter_info.partition_flags);
+ }
+ ms3_deinit(s3_client);
+ DBUG_RETURN(error);
+}
+
+
+/**
+ Create a s3 table.
+
+ @notes
+ One can only create an s3 table as part of ALTER TABLE
+ The table is created as a non transactional Aria table with
+ BLOCK_RECORD format
+*/
+
+int ha_s3::create(const char *name, TABLE *table_arg,
+ HA_CREATE_INFO *ha_create_info)
+{
+ uchar *frm_ptr;
+ size_t frm_len;
+ int error;
+ TABLE_SHARE *share= table_arg->s;
+ DBUG_ENTER("ha_s3::create");
+
+ if (!(ha_create_info->options & HA_CREATE_TMP_ALTER) ||
+ ha_create_info->tmp_table())
+ DBUG_RETURN(HA_ERR_WRONG_COMMAND);
+
+ if (share->table_type == TABLE_TYPE_SEQUENCE)
+ DBUG_RETURN(HA_ERR_UNSUPPORTED);
+
+ if (ha_create_info->tmp_table())
+ DBUG_RETURN(HA_ERR_UNSUPPORTED);
+
+ if (!s3_usable())
+ DBUG_RETURN(HA_ERR_UNSUPPORTED);
+
+ /* Force the table to a format suitable for S3 */
+ ha_create_info->row_type= ROW_TYPE_PAGE;
+ ha_create_info->transactional= HA_CHOICE_NO;
+ error= ha_maria::create(name, table_arg, ha_create_info);
+ if (error)
+ DBUG_RETURN(error);
+
+ /* Create the .frm file. Needed for ha_s3::rename_table() later */
+ if (!table_arg->s->read_frm_image((const uchar**) &frm_ptr, &frm_len))
+ {
+ table_arg->s->write_frm_image(frm_ptr, frm_len);
+ table_arg->s->free_frm_image(frm_ptr);
+ }
+
+ DBUG_RETURN(0);
+}
+
+/**
+ Open table
+
+
+ @notes
+ Table is read only, except if opened by ALTER as in this case we
+ are creating the S3 table.
+*/
+
+int ha_s3::open(const char *name, int mode, uint open_flags)
+{
+ int res;
+ S3_INFO s3_info;
+ DBUG_ENTER("ha_s3:open");
+
+ if (!s3_usable())
+ DBUG_RETURN(HA_ERR_UNSUPPORTED);
+
+ if (mode != O_RDONLY && !(open_flags & HA_OPEN_FOR_CREATE))
+ DBUG_RETURN(EACCES);
+
+ open_args= 0;
+ if (!(open_flags & HA_OPEN_FOR_CREATE))
+ {
+ (void) s3_info_init(&s3_info);
+ s3_info.tabledef_version= table->s->tabledef_version;
+
+ /* Pass the above arguments to maria_open() */
+ open_args= &s3_info;
+ }
+
+ if (!(res= ha_maria::open(name, mode, open_flags)))
+ {
+ if ((open_flags & HA_OPEN_FOR_CREATE))
+ in_alter_table= 1;
+ else
+ {
+ /*
+ We have to modify the pagecache callbacks for the data file,
+ index file and for bitmap handling
+ */
+ file->s->pagecache= &s3_pagecache;
+ file->dfile.big_block_size= file->s->kfile.big_block_size=
+ file->s->bitmap.file.big_block_size= file->s->base.s3_block_size;
+ file->s->kfile.head_blocks= file->s->base.keystart / file->s->block_size;
+ }
+ }
+ open_args= 0;
+ DBUG_RETURN(res);
+}
+
+
+/******************************************************************************
+ Storage engine handler definitions
+******************************************************************************/
+
+/**
+ Free all resources for s3
+*/
+
+static handler *s3_create_handler(handlerton *hton,
+ TABLE_SHARE * table,
+ MEM_ROOT *mem_root)
+{
+ return new (mem_root) ha_s3(hton, table);
+}
+
+
+static int s3_hton_panic(handlerton *hton, ha_panic_function flag)
+{
+ if (flag == HA_PANIC_CLOSE && s3_hton)
+ {
+ end_pagecache(&s3_pagecache, TRUE);
+ s3_deinit_library();
+ my_free(s3_access_key);
+ my_free(s3_secret_key);
+ s3_access_key= s3_secret_key= 0;
+ s3_hton= 0;
+ }
+ return 0;
+}
+
+
+/**
+ Check if a table is in S3 as part of discovery
+*/
+
+static int s3_discover_table(handlerton *hton, THD* thd, TABLE_SHARE *share)
+{
+ S3_INFO s3_info;
+ S3_BLOCK block;
+ ms3_st *s3_client;
+ int error;
+ DBUG_ENTER("s3_discover_table");
+
+ if (s3_info_init(&s3_info))
+ DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
+ if (!(s3_client= s3_open_connection(&s3_info)))
+ DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
+
+ s3_info.database= share->db;
+ s3_info.table= share->table_name;
+
+ if (s3_get_frm(s3_client, &s3_info, &block))
+ {
+ s3_free(&block);
+ ms3_deinit(s3_client);
+ DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
+ }
+ error= share->init_from_binary_frm_image(thd, 1,
+ block.str, block.length);
+ s3_free(&block);
+ ms3_deinit(s3_client);
+ DBUG_RETURN((my_errno= error));
+}
+
+
+/**
+ Check if a table exists
+
+ @return 0 frm doesn't exists
+ @return 1 frm exists
+*/
+
+static int s3_discover_table_existance(handlerton *hton, const char *db,
+ const char *table_name)
+{
+ S3_INFO s3_info;
+ ms3_st *s3_client;
+ int res;
+ DBUG_ENTER("s3_discover_table_existance");
+
+ /* Ignore names in "mysql" database to speed up boot */
+ if (!strcmp(db, MYSQL_SCHEMA_NAME.str))
+ DBUG_RETURN(0);
+
+ if (s3_info_init(&s3_info))
+ DBUG_RETURN(0);
+ if (!(s3_client= s3_open_connection(&s3_info)))
+ DBUG_RETURN(0);
+
+ s3_info.database.str= db;
+ s3_info.database.length= strlen(db);
+ s3_info.table.str= table_name;
+ s3_info.table.length= strlen(table_name);
+
+ res= s3_frm_exists(s3_client, &s3_info);
+ ms3_deinit(s3_client);
+ DBUG_RETURN(res == 0); // Return 1 if exists
+}
+
+
+/**
+ Return a list of all S3 tables in a database
+*/
+
+static int s3_discover_table_names(handlerton *hton __attribute__((unused)),
+ LEX_CSTRING *db,
+ MY_DIR *dir __attribute__((unused)),
+ handlerton::discovered_list *result)
+{
+ char aws_path[AWS_PATH_LENGTH];
+ S3_INFO s3_info;
+ ms3_st *s3_client;
+ ms3_list_st *list, *org_list= 0;
+ int error;
+ DBUG_ENTER("s3_discover_table_names");
+
+ /* Ignore names in "mysql" database to speed up boot */
+ if (!strcmp(db->str, MYSQL_SCHEMA_NAME.str))
+ DBUG_RETURN(0);
+
+ if (s3_info_init(&s3_info))
+ DBUG_RETURN(0);
+ if (!(s3_client= s3_open_connection(&s3_info)))
+ DBUG_RETURN(0);
+
+ strxnmov(aws_path, sizeof(aws_path)-1, db->str, "/", NullS);
+
+ if ((error= ms3_list_dir(s3_client, s3_info.bucket.str, aws_path, &org_list)))
+ goto end;
+
+ for (list= org_list ; list ; list= list->next)
+ {
+ const char *name= list->key + db->length + 1; // Skip database and /
+ size_t name_length= strlen(name)-1; // Remove end /
+ result->add_table(name, name_length);
+ }
+ if (org_list)
+ ms3_list_free(org_list);
+end:
+ ms3_deinit(s3_client);
+ DBUG_RETURN(0);
+}
+
+/**
+ Update the .frm file in S3
+*/
+
+static int s3_notify_tabledef_changed(handlerton *hton __attribute__((unused)),
+ LEX_CSTRING *db, LEX_CSTRING *table,
+ LEX_CUSTRING *frm,
+ LEX_CUSTRING *org_tabledef_version)
+{
+ char aws_path[AWS_PATH_LENGTH];
+ S3_INFO s3_info;
+ ms3_st *s3_client;
+ int error= 0;
+ DBUG_ENTER("s3_notify_tabledef_changed");
+
+ if (s3_info_init(&s3_info))
+ DBUG_RETURN(0);
+ if (!(s3_client= s3_open_connection(&s3_info)))
+ DBUG_RETURN(0);
+
+ s3_info.database= *db;
+ s3_info.table= *table;
+ s3_info.tabledef_version= *org_tabledef_version;
+ if (s3_check_frm_version(s3_client, &s3_info))
+ {
+ error= 1;
+ goto err;
+ }
+
+ strxnmov(aws_path, sizeof(aws_path)-1, db->str, "/", table->str, "/frm",
+ NullS);
+
+ if (s3_put_object(s3_client, s3_info.bucket.str, aws_path, (uchar*) frm->str,
+ frm->length, 0))
+ error= 2;
+
+err:
+ ms3_deinit(s3_client);
+ DBUG_RETURN(error);
+}
+
+
+static int ha_s3_init(void *p)
+{
+ bool res;
+ static const char *no_exts[]= { 0 };
+ DBUG_ASSERT(maria_hton);
+
+ s3_hton= (handlerton *)p;
+
+ /* Use Aria engine as a base */
+ memcpy(s3_hton, maria_hton, sizeof(*s3_hton));
+ s3_hton->db_type= DB_TYPE_S3;
+ s3_hton->create= s3_create_handler;
+ s3_hton->panic= s3_hton_panic;
+ s3_hton->table_options= s3_table_option_list;
+ s3_hton->discover_table= s3_discover_table;
+ s3_hton->discover_table_names= s3_discover_table_names;
+ s3_hton->discover_table_existence= s3_discover_table_existance;
+ s3_hton->notify_tabledef_changed= s3_notify_tabledef_changed;
+ s3_hton->tablefile_extensions= no_exts;
+ s3_hton->commit= 0;
+ s3_hton->rollback= 0;
+ s3_hton->checkpoint_state= 0;
+ s3_hton->flush_logs= 0;
+ s3_hton->show_status= 0;
+ s3_hton->prepare_for_backup= 0;
+ s3_hton->end_backup= 0;
+ s3_hton->flags= 0;
+ /* Copy global arguments to s3_access_key and s3_secret_key */
+ update_access_key(0,0,0,0);
+ update_secret_key(0,0,0,0);
+
+ if ((res= !init_pagecache(&s3_pagecache,
+ (size_t) s3_pagecache_buffer_size,
+ s3_pagecache_division_limit,
+ s3_pagecache_age_threshold, maria_block_size,
+ s3_pagecache_file_hash_size, 0)))
+ s3_hton= 0;
+ s3_pagecache.big_block_read= s3_block_read;
+ s3_pagecache.big_block_free= s3_free;
+ s3_init_library();
+ if (s3_debug)
+ ms3_debug();
+ return res ? HA_ERR_INITIALIZATION : 0;
+}
+
+static SHOW_VAR status_variables[]= {
+ {"pagecache_blocks_not_flushed",
+ (char*) &s3_pagecache.global_blocks_changed, SHOW_LONG},
+ {"pagecache_blocks_unused",
+ (char*) &s3_pagecache.blocks_unused, SHOW_LONG},
+ {"pagecache_blocks_used",
+ (char*) &s3_pagecache.blocks_used, SHOW_LONG},
+ {"pagecache_read_requests",
+ (char*) &s3_pagecache.global_cache_r_requests, SHOW_LONGLONG},
+ {"pagecache_reads",
+ (char*) &s3_pagecache.global_cache_read, SHOW_LONGLONG},
+ {NullS, NullS, SHOW_LONG}
+};
+
+
+static struct st_mysql_sys_var* system_variables[]= {
+ MYSQL_SYSVAR(block_size),
+ MYSQL_SYSVAR(debug),
+ MYSQL_SYSVAR(protocol_version),
+ MYSQL_SYSVAR(pagecache_age_threshold),
+ MYSQL_SYSVAR(pagecache_buffer_size),
+ MYSQL_SYSVAR(pagecache_division_limit),
+ MYSQL_SYSVAR(pagecache_file_hash_size),
+ MYSQL_SYSVAR(host_name),
+ MYSQL_SYSVAR(bucket),
+ MYSQL_SYSVAR(access_key),
+ MYSQL_SYSVAR(secret_key),
+ MYSQL_SYSVAR(region),
+
+ NULL
+};
+
+struct st_mysql_storage_engine s3_storage_engine=
+{ MYSQL_HANDLERTON_INTERFACE_VERSION };
+
+maria_declare_plugin(s3)
+{
+ MYSQL_STORAGE_ENGINE_PLUGIN,
+ &s3_storage_engine,
+ "S3",
+ "MariaDB Corporation Ab",
+ "Read only table stored in S3. Created by running "
+ "ALTER TABLE table_name ENGINE=s3",
+ PLUGIN_LICENSE_GPL,
+ ha_s3_init, /* Plugin Init */
+ NULL, /* Plugin Deinit */
+ 0x0100, /* 1.0 */
+ status_variables, /* status variables */
+ system_variables, /* system variables */
+ "1.0", /* string version */
+ MariaDB_PLUGIN_MATURITY_ALPHA /* maturity */
+}
+maria_declare_plugin_end;
diff --git a/storage/maria/ha_s3.h b/storage/maria/ha_s3.h
new file mode 100644
index 00000000000..e3884e8b834
--- /dev/null
+++ b/storage/maria/ha_s3.h
@@ -0,0 +1,70 @@
+#ifndef HA_S3_INCLUDED
+#define HA_S3_INCLUDED
+/* Copyright (C) 2019 MariaDB Corppration 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.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
+*/
+
+#include "ha_maria.h"
+
+class ha_s3 :public ha_maria
+{
+ bool in_alter_table;
+ S3_INFO *open_args;
+
+public:
+ ha_s3(handlerton *hton, TABLE_SHARE * table_arg);
+ ~ha_s3() {}
+
+ int create(const char *name, TABLE *table_arg, HA_CREATE_INFO *ha_create_info);
+ int open(const char *name, int mode, uint open_flags);
+ int write_row(const uchar *buf);
+ int update_row(const uchar * old_data, const uchar * new_data)
+ {
+ return HA_ERR_WRONG_COMMAND;
+ }
+ int delete_row(const uchar * buf)
+ {
+ return HA_ERR_WRONG_COMMAND;
+ }
+ int check(THD * thd, HA_CHECK_OPT * check_opt)
+ {
+ return HA_ERR_WRONG_COMMAND;
+ }
+ int analyze(THD * thd, HA_CHECK_OPT * check_opt)
+ {
+ return HA_ERR_WRONG_COMMAND;
+ }
+ int repair(THD * thd, HA_CHECK_OPT * check_opt)
+ {
+ return HA_ERR_WRONG_COMMAND;
+ }
+ int preload_keys(THD * thd, HA_CHECK_OPT * check_opt)
+ {
+ return HA_ERR_WRONG_COMMAND;
+ }
+ /*
+ drop_table() is only used for internal temporary tables,
+ not applicable for s3
+ */
+ void drop_table(const char *name)
+ {
+ }
+ int delete_table(const char *name);
+ int rename_table(const char *from, const char *to);
+ S3_INFO *s3_open_args() { return open_args; }
+ void register_handler(MARIA_HA *file);
+};
+#endif /* HA_S3_INCLUDED */
diff --git a/storage/maria/libmarias3 b/storage/maria/libmarias3
new file mode 160000
+Subproject a5e32426728aedcbee42f7909cdc11b4d6cc853
diff --git a/storage/maria/ma_backup.c b/storage/maria/ma_backup.c
index 8f20209c48a..79270425b38 100644
--- a/storage/maria/ma_backup.c
+++ b/storage/maria/ma_backup.c
@@ -77,6 +77,11 @@ int aria_get_capabilities(File kfile, ARIA_TABLE_CAPABILITIES *cap)
0) + KEYPAGE_KEYID_SIZE + KEYPAGE_FLAG_SIZE +
KEYPAGE_USED_SIZE);
cap->block_size= share.base.block_size;
+ cap->data_file_type= share.state.header.data_file_type;
+ cap->s3_block_size= share.base.s3_block_size;
+ cap->compression= share.base.compression_algorithm;
+ cap->encrypted= MY_TEST(share.base.extra_options &
+ MA_EXTRA_OPTIONS_ENCRYPTED);
if (share.state.header.data_file_type == BLOCK_RECORD)
{
@@ -110,7 +115,6 @@ err:
because maria_backup uses maria_get_capabilities()
*/
-
static uchar *_ma_base_info_read(uchar *ptr, MARIA_BASE_INFO *base)
{
bmove(base->uuid, ptr, MY_UUID_SIZE); ptr+= MY_UUID_SIZE;
@@ -142,14 +146,15 @@ static uchar *_ma_base_info_read(uchar *ptr, MARIA_BASE_INFO *base)
base->keys= *ptr++;
base->auto_key= *ptr++;
base->born_transactional= *ptr++;
- ptr++;
+ base->compression_algorithm= *ptr++;
base->pack_bytes= mi_uint2korr(ptr); ptr+= 2;
base->blobs= mi_uint2korr(ptr); ptr+= 2;
base->max_key_block_length= mi_uint2korr(ptr); ptr+= 2;
base->max_key_length= mi_uint2korr(ptr); ptr+= 2;
base->extra_alloc_bytes= mi_uint2korr(ptr); ptr+= 2;
base->extra_alloc_procent= *ptr++;
- ptr+= 16;
+ base->s3_block_size= mi_uint3korr(ptr); ptr+= 3;
+ ptr+= 13;
return ptr;
}
diff --git a/storage/maria/ma_blockrec.c b/storage/maria/ma_blockrec.c
index ba29fc6bba3..406de66bc9f 100644
--- a/storage/maria/ma_blockrec.c
+++ b/storage/maria/ma_blockrec.c
@@ -455,11 +455,14 @@ my_bool _ma_once_end_block_record(MARIA_SHARE *share)
File must be synced as it is going out of the maria_open_list and so
becoming unknown to Checkpoint.
*/
- if (share->now_transactional &&
- mysql_file_sync(share->bitmap.file.file, MYF(MY_WME)))
- res= 1;
- if (mysql_file_close(share->bitmap.file.file, MYF(MY_WME)))
- res= 1;
+ if (!share->s3_path)
+ {
+ if (share->now_transactional &&
+ mysql_file_sync(share->bitmap.file.file, MYF(MY_WME)))
+ res= 1;
+ if (mysql_file_close(share->bitmap.file.file, MYF(MY_WME)))
+ res= 1;
+ }
/*
Trivial assignment to guard against multiple invocations
(May happen if file are closed but we want to keep the maria object
@@ -2455,11 +2458,12 @@ static my_bool free_full_pages(MARIA_HA *info, MARIA_ROW *row)
/* Compact events by removing filler and tail events */
uchar *new_block= 0;
uchar *end, *to, *compact_extent_info;
- my_bool res;
+ my_bool res, buff_alloced;
uint extents_count;
- if (!(compact_extent_info= my_alloca(row->extents_count *
- ROW_EXTENT_SIZE)))
+ alloc_on_stack(*info->stack_end_ptr, compact_extent_info, buff_alloced,
+ row->extents_count * ROW_EXTENT_SIZE);
+ if (!compact_extent_info)
DBUG_RETURN(1);
to= compact_extent_info;
@@ -2498,7 +2502,7 @@ static my_bool free_full_pages(MARIA_HA *info, MARIA_ROW *row)
No ranges. This happens in the rear case when we have a allocated
place for a blob on a tail page but it did fit into the main page.
*/
- my_afree(compact_extent_info);
+ stack_alloc_free(compact_extent_info, buff_alloced);
DBUG_RETURN(0);
}
extents_count= (uint) (extents_length / ROW_EXTENT_SIZE);
@@ -2513,7 +2517,7 @@ static my_bool free_full_pages(MARIA_HA *info, MARIA_ROW *row)
extents_length),
TRANSLOG_INTERNAL_PARTS + 2, log_array,
log_data, NULL);
- my_afree(compact_extent_info);
+ stack_alloc_free(compact_extent_info, buff_alloced);
if (res)
DBUG_RETURN(1);
}
@@ -5189,13 +5193,12 @@ my_bool _ma_cmp_block_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def,
uchar *org_rec_buff, *old_record;
size_t org_rec_buff_size;
int error;
+ my_bool buff_alloced;
DBUG_ENTER("_ma_cmp_block_unique");
- /*
- 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)))
+ alloc_on_stack(*info->stack_end_ptr, old_record, buff_alloced,
+ info->s->base.reclength);
+ if (!old_record)
DBUG_RETURN(1);
/* Don't let the compare destroy blobs that may be in use */
@@ -5217,7 +5220,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);
+ stack_alloc_free(old_record, buff_alloced);
DBUG_RETURN(error != 0);
}
diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c
index e89f306b8cf..dd4163f11eb 100644
--- a/storage/maria/ma_check.c
+++ b/storage/maria/ma_check.c
@@ -46,8 +46,7 @@
#include "trnman.h"
#include "ma_key_recover.h"
#include <my_check_opt.h>
-
-#include <stdarg.h>
+#include <my_stack_alloc.h>
#include <my_getopt.h>
#ifdef HAVE_SYS_VADVISE_H
#include <sys/vadvise.h>
@@ -75,11 +74,11 @@ static int sort_maria_ft_key_write(MARIA_SORT_PARAM *sort_param,
static int sort_key_write(MARIA_SORT_PARAM *sort_param, const uchar *a);
static my_off_t get_record_for_key(MARIA_KEYDEF *keyinfo, const uchar *key);
static int sort_insert_key(MARIA_SORT_PARAM *sort_param,
- reg1 SORT_KEY_BLOCKS *key_block,
+ reg1 MA_SORT_KEY_BLOCKS *key_block,
const uchar *key, my_off_t prev_block);
static int sort_delete_record(MARIA_SORT_PARAM *sort_param);
/*static int _ma_flush_pending_blocks(HA_CHECK *param);*/
-static SORT_KEY_BLOCKS *alloc_key_blocks(HA_CHECK *param, uint blocks,
+static MA_SORT_KEY_BLOCKS *alloc_key_blocks(HA_CHECK *param, uint blocks,
uint buffer_length);
static ha_checksum maria_byte_checksum(const uchar *buf, uint length);
static void set_data_file_type(MARIA_SORT_INFO *sort_info, MARIA_SHARE *share);
@@ -124,6 +123,7 @@ void maria_chk_init(HA_CHECK *param)
param->pagecache_block_size= KEY_CACHE_BLOCK_SIZE;
param->stats_method= MI_STATS_METHOD_NULLS_NOT_EQUAL;
param->max_stage= 1;
+ param->stack_end_ptr= &my_thread_var->stack_ends_here;
}
@@ -860,7 +860,8 @@ static int chk_index(HA_CHECK *param, MARIA_HA *info, MARIA_KEYDEF *keyinfo,
MARIA_SHARE *share= info->s;
char llbuff[22];
uint diff_pos[2];
- uchar tmp_key_buff[MARIA_MAX_KEY_BUFF];
+ uchar *tmp_key_buff;
+ my_bool temp_buff_alloced;
MARIA_KEY tmp_key;
DBUG_ENTER("chk_index");
DBUG_DUMP("buff", anc_page->buff, anc_page->size);
@@ -869,11 +870,14 @@ static int chk_index(HA_CHECK *param, MARIA_HA *info, MARIA_KEYDEF *keyinfo,
if (keyinfo->flag & (HA_SPATIAL | HA_RTREE_INDEX))
DBUG_RETURN(0);
- if (!(temp_buff=(uchar*) my_alloca((uint) keyinfo->block_length)))
+ alloc_on_stack(*param->stack_end_ptr, temp_buff, temp_buff_alloced,
+ (keyinfo->block_length + keyinfo->max_store_length));
+ if (!temp_buff)
{
_ma_check_print_error(param,"Not enough memory for keyblock");
DBUG_RETURN(-1);
}
+ tmp_key_buff= temp_buff+ keyinfo->block_length;
if (keyinfo->flag & HA_NOSAME)
{
@@ -1065,10 +1069,10 @@ static int chk_index(HA_CHECK *param, MARIA_HA *info, MARIA_KEYDEF *keyinfo,
(uint) (keypos - anc_page->buff));
goto err;
}
- my_afree(temp_buff);
+ stack_alloc_free(temp_buff, temp_buff_alloced);
DBUG_RETURN(0);
err:
- my_afree(temp_buff);
+ stack_alloc_free(temp_buff, temp_buff_alloced);
DBUG_RETURN(1);
} /* chk_index */
@@ -3224,6 +3228,7 @@ static int sort_one_index(HA_CHECK *param, MARIA_HA *info,
MARIA_SHARE *share= info->s;
MARIA_KEY key;
MARIA_PAGE page;
+ my_bool buff_alloced;
DBUG_ENTER("sort_one_index");
/* cannot walk over R-tree indices */
@@ -3232,11 +3237,11 @@ static int sort_one_index(HA_CHECK *param, MARIA_HA *info,
param->new_file_pos+=keyinfo->block_length;
key.keyinfo= keyinfo;
- if (!(buff= (uchar*) my_alloca((uint) keyinfo->block_length +
- keyinfo->maxlength +
- MARIA_INDEX_OVERHEAD_SIZE)))
+ alloc_on_stack(*param->stack_end_ptr, buff, buff_alloced,
+ keyinfo->block_length + keyinfo->max_store_length);
+ if (!buff)
{
- _ma_check_print_error(param,"Not enough memory for key block");
+ _ma_check_print_error(param,"Not enough memory for keyblock");
DBUG_RETURN(-1);
}
key.data= buff + keyinfo->block_length;
@@ -3303,10 +3308,10 @@ static int sort_one_index(HA_CHECK *param, MARIA_HA *info,
_ma_check_print_error(param,"Can't write indexblock, error: %d",my_errno);
goto err;
}
- my_afree(buff);
+ stack_alloc_free(buff, buff_alloced);
DBUG_RETURN(0);
err:
- my_afree(buff);
+ stack_alloc_free(buff, buff_alloced);
DBUG_RETURN(1);
} /* sort_one_index */
@@ -4469,6 +4474,7 @@ int maria_repair_parallel(HA_CHECK *param, register MARIA_HA *info,
(void) pthread_attr_init(&thr_attr);
(void) pthread_attr_setdetachstate(&thr_attr,PTHREAD_CREATE_DETACHED);
+ (void) my_setstacksize(&thr_attr, (size_t)my_thread_stack_size);
for (i=0 ; i < sort_info.total_keys ; i++)
{
@@ -5578,11 +5584,11 @@ static int sort_key_write(MARIA_SORT_PARAM *sort_param, const uchar *a)
int _ma_sort_ft_buf_flush(MARIA_SORT_PARAM *sort_param)
{
MARIA_SORT_INFO *sort_info=sort_param->sort_info;
- SORT_KEY_BLOCKS *key_block=sort_info->key_block;
+ MA_SORT_KEY_BLOCKS *key_block=sort_info->key_block;
MARIA_SHARE *share=sort_info->info->s;
uint val_off, val_len;
int error;
- SORT_FT_BUF *maria_ft_buf=sort_info->ft_buf;
+ MA_SORT_FT_BUF *maria_ft_buf=sort_info->ft_buf;
uchar *from, *to;
val_len=share->ft2_keyinfo.keylength;
@@ -5626,8 +5632,8 @@ static int sort_maria_ft_key_write(MARIA_SORT_PARAM *sort_param,
{
uint a_len, val_off, val_len, error;
MARIA_SORT_INFO *sort_info= sort_param->sort_info;
- SORT_FT_BUF *ft_buf= sort_info->ft_buf;
- SORT_KEY_BLOCKS *key_block= sort_info->key_block;
+ MA_SORT_FT_BUF *ft_buf= sort_info->ft_buf;
+ MA_SORT_KEY_BLOCKS *key_block= sort_info->key_block;
MARIA_SHARE *share= sort_info->info->s;
val_len=HA_FT_WLEN+share->rec_reflength;
@@ -5643,8 +5649,8 @@ static int sort_maria_ft_key_write(MARIA_SORT_PARAM *sort_param,
share->rec_reflength) &&
(share->options &
(HA_OPTION_PACK_RECORD | HA_OPTION_COMPRESS_RECORD)))
- ft_buf= (SORT_FT_BUF *)my_malloc(sort_param->keyinfo->block_length +
- sizeof(SORT_FT_BUF), MYF(MY_WME));
+ ft_buf= (MA_SORT_FT_BUF *)my_malloc(sort_param->keyinfo->block_length +
+ sizeof(MA_SORT_FT_BUF), MYF(MY_WME));
if (!ft_buf)
{
@@ -5728,7 +5734,7 @@ static my_off_t get_record_for_key(MARIA_KEYDEF *keyinfo,
/* Insert a key in sort-key-blocks */
static int sort_insert_key(MARIA_SORT_PARAM *sort_param,
- register SORT_KEY_BLOCKS *key_block,
+ register MA_SORT_KEY_BLOCKS *key_block,
const uchar *key,
my_off_t prev_block)
{
@@ -5910,7 +5916,7 @@ int _ma_flush_pending_blocks(MARIA_SORT_PARAM *sort_param)
{
uint nod_flag,length;
my_off_t filepos;
- SORT_KEY_BLOCKS *key_block;
+ MA_SORT_KEY_BLOCKS *key_block;
MARIA_SORT_INFO *sort_info= sort_param->sort_info;
myf myf_rw=sort_info->param->myf_rw;
MARIA_HA *info=sort_info->info;
@@ -5962,14 +5968,14 @@ err:
/* alloc space and pointers for key_blocks */
-static SORT_KEY_BLOCKS *alloc_key_blocks(HA_CHECK *param, uint blocks,
+static MA_SORT_KEY_BLOCKS *alloc_key_blocks(HA_CHECK *param, uint blocks,
uint buffer_length)
{
reg1 uint i;
- SORT_KEY_BLOCKS *block;
+ MA_SORT_KEY_BLOCKS *block;
DBUG_ENTER("alloc_key_blocks");
- if (!(block= (SORT_KEY_BLOCKS*) my_malloc((sizeof(SORT_KEY_BLOCKS)+
+ if (!(block= (MA_SORT_KEY_BLOCKS*) my_malloc((sizeof(MA_SORT_KEY_BLOCKS)+
buffer_length+IO_SIZE)*blocks,
MYF(0))))
{
@@ -6153,7 +6159,7 @@ int maria_recreate_table(HA_CHECK *param, MARIA_HA **org_info, char *filename)
HA_OPEN_WAIT_IF_LOCKED :
(param->testflag & T_DESCRIPT) ?
HA_OPEN_IGNORE_IF_LOCKED :
- HA_OPEN_ABORT_IF_LOCKED)));
+ HA_OPEN_ABORT_IF_LOCKED)), 0);
if (!*org_info)
{
_ma_check_print_error(param,
@@ -6534,7 +6540,7 @@ static my_bool create_new_data_handle(MARIA_SORT_PARAM *param, File new_file)
if (!(sort_info->new_info= maria_open(info->s->open_file_name.str, O_RDWR,
HA_OPEN_COPY | HA_OPEN_FOR_REPAIR |
- HA_OPEN_INTERNAL_TABLE)))
+ HA_OPEN_INTERNAL_TABLE, 0)))
DBUG_RETURN(1);
new_info= sort_info->new_info;
diff --git a/storage/maria/ma_check.h b/storage/maria/ma_check.h
new file mode 100644
index 00000000000..1c2a971098d
--- /dev/null
+++ b/storage/maria/ma_check.h
@@ -0,0 +1,36 @@
+/* Copyright (C) 2019 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
+ 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-1335 USA
+*/
+
+/*
+ Types that are different in Aria from those used by MyISAM check tables
+ in myisamchk.h
+*/
+
+typedef struct st_sort_key_blocks /* Used when sorting */
+{
+ uchar *buff, *end_pos;
+ uchar lastkey[MARIA_MAX_POSSIBLE_KEY_BUFF];
+ uint last_length;
+ int inited;
+} MA_SORT_KEY_BLOCKS;
+
+typedef struct st_sort_ftbuf
+{
+ uchar *buf, *end;
+ int count;
+ uchar lastkey[MARIA_MAX_KEY_BUFF];
+} MA_SORT_FT_BUF;
diff --git a/storage/maria/ma_close.c b/storage/maria/ma_close.c
index 44f65230c5d..54186613ba9 100644
--- a/storage/maria/ma_close.c
+++ b/storage/maria/ma_close.c
@@ -22,6 +22,9 @@
#include "maria_def.h"
#include "ma_crypt.h"
+#ifdef WITH_S3_STORAGE_ENGINE
+#include "s3_func.h"
+#endif /* WITH_S3_STORAGE_ENGINE */
int maria_close(register MARIA_HA *info)
{
@@ -153,9 +156,10 @@ int maria_close(register MARIA_HA *info)
File must be synced as it is going out of the maria_open_list and so
becoming unknown to future Checkpoints.
*/
- if (share->now_transactional && mysql_file_sync(share->kfile.file, MYF(MY_WME)))
+ if (share->now_transactional &&
+ mysql_file_sync(share->kfile.file, MYF(MY_WME)))
error= my_errno;
- if (mysql_file_close(share->kfile.file, MYF(0)))
+ if (!share->s3_path && mysql_file_close(share->kfile.file, MYF(0)))
error= my_errno;
}
thr_lock_delete(&share->lock);
@@ -232,6 +236,7 @@ int maria_close(register MARIA_HA *info)
if (share_can_be_freed)
{
ma_crypt_free(share);
+ my_free(share->s3_path);
(void) mysql_mutex_destroy(&share->intern_lock);
(void) mysql_mutex_destroy(&share->close_lock);
(void) mysql_cond_destroy(&share->key_del_cond);
@@ -243,7 +248,7 @@ int maria_close(register MARIA_HA *info)
*/
}
my_free(info->ftparser_param);
- if (info->dfile.file >= 0)
+ if (info->dfile.file >= 0 && ! info->s3)
{
/*
This is outside of mutex so would confuse a concurrent
@@ -254,6 +259,10 @@ int maria_close(register MARIA_HA *info)
}
delete_dynamic(&info->pinned_pages);
+#ifdef WITH_S3_STORAGE_ENGINE
+ if (info->s3)
+ ms3_deinit(info->s3);
+#endif /* WITH_S3_STORAGE_ENGINE */
my_free(info);
if (error)
diff --git a/storage/maria/ma_create.c b/storage/maria/ma_create.c
index 93d65bf3a7d..06139ed564d 100644
--- a/storage/maria/ma_create.c
+++ b/storage/maria/ma_create.c
@@ -75,7 +75,7 @@ int maria_create(const char *name, enum data_file_type datafile_type,
uint max_field_lengths, extra_header_size, column_nr;
uint internal_table= flags & HA_CREATE_INTERNAL_TABLE;
ulong reclength, real_reclength,min_pack_length;
- char kfilename[FN_REFLEN], klinkname[FN_REFLEN], *klinkname_ptr;
+ char kfilename[FN_REFLEN], klinkname[FN_REFLEN], *klinkname_ptr= 0;
char dfilename[FN_REFLEN], dlinkname[FN_REFLEN], *dlinkname_ptr= 0;
ulong pack_reclength;
ulonglong tot_length,max_rows, tmp;
@@ -95,7 +95,7 @@ int maria_create(const char *name, enum data_file_type datafile_type,
my_bool forced_packed;
myf sync_dir= 0;
uchar *log_data= NULL;
- my_bool encrypted= maria_encrypt_tables && datafile_type == BLOCK_RECORD;
+ my_bool encrypted= ci->encrypted && datafile_type == BLOCK_RECORD;
my_bool insert_order= MY_TEST(flags & HA_PRESERVE_INSERT_ORDER);
uint crypt_page_header_space= 0;
DBUG_ENTER("maria_create");
@@ -328,6 +328,8 @@ int maria_create(const char *name, enum data_file_type datafile_type,
share.base.born_transactional= ci->transactional;
share.base.max_field_lengths= max_field_lengths;
share.base.field_offsets= 0; /* for future */
+ share.base.compression_algorithm= ci->compression_algorithm;
+ share.base.s3_block_size= ci->s3_block_size;
if (flags & HA_CREATE_CHECKSUM || (options & HA_OPTION_CHECKSUM))
{
diff --git a/storage/maria/ma_delete.c b/storage/maria/ma_delete.c
index 7377f3bf5ad..cbba9d975dc 100644
--- a/storage/maria/ma_delete.c
+++ b/storage/maria/ma_delete.c
@@ -158,14 +158,20 @@ my_bool _ma_ck_delete(MARIA_HA *info, MARIA_KEY *key)
{
MARIA_SHARE *share= info->s;
int res;
+ my_bool buff_alloced;
LSN lsn= LSN_IMPOSSIBLE;
my_off_t new_root= share->state.key_root[key->keyinfo->key_nr];
- uchar key_buff[MARIA_MAX_KEY_BUFF], *save_key_data;
+ uchar *key_buff, *save_key_data;
MARIA_KEY org_key;
DBUG_ENTER("_ma_ck_delete");
LINT_INIT_STRUCT(org_key);
+ alloc_on_stack(*info->stack_end_ptr, key_buff, buff_alloced,
+ key->keyinfo->max_store_length);
+ if (!key_buff)
+ DBUG_RETURN(1);
+
save_key_data= key->data;
if (share->now_transactional)
{
@@ -190,6 +196,8 @@ my_bool _ma_ck_delete(MARIA_HA *info, MARIA_KEY *key)
_ma_fast_unlock_key_del(info);
}
_ma_unpin_all_pages_and_finalize_row(info, lsn);
+
+ stack_alloc_free(key_buff, buff_alloced);
DBUG_RETURN(res != 0);
} /* _ma_ck_delete */
@@ -198,7 +206,7 @@ my_bool _ma_ck_real_delete(register MARIA_HA *info, MARIA_KEY *key,
my_off_t *root)
{
int error;
- my_bool result= 0;
+ my_bool result= 0, buff_alloced;
my_off_t old_root;
uchar *root_buff;
MARIA_KEYDEF *keyinfo= key->keyinfo;
@@ -210,13 +218,12 @@ my_bool _ma_ck_real_delete(register MARIA_HA *info, MARIA_KEY *key,
_ma_set_fatal_error(info->s, HA_ERR_CRASHED);
DBUG_RETURN(1);
}
- if (!(root_buff= (uchar*) my_alloca((uint) keyinfo->block_length+
- MARIA_MAX_KEY_BUFF*2)))
- {
- DBUG_PRINT("error",("Couldn't allocate memory"));
- my_errno=ENOMEM;
+
+ alloc_on_stack(*info->stack_end_ptr, root_buff, buff_alloced,
+ (keyinfo->block_length + keyinfo->max_store_length*2));
+ if (!root_buff)
DBUG_RETURN(1);
- }
+
DBUG_PRINT("info",("root_page: %lu",
(ulong) (old_root / keyinfo->block_length)));
if (_ma_fetch_keypage(&page, info, keyinfo, old_root,
@@ -261,7 +268,7 @@ my_bool _ma_ck_real_delete(register MARIA_HA *info, MARIA_KEY *key,
}
}
err:
- my_afree(root_buff);
+ stack_alloc_free(root_buff, buff_alloced);
DBUG_PRINT("exit",("Return: %d",result));
DBUG_RETURN(result);
} /* _ma_ck_real_delete */
@@ -284,9 +291,8 @@ static int d_search(MARIA_HA *info, MARIA_KEY *key, uint32 comp_flag,
{
int flag,ret_value,save_flag;
uint nod_flag, page_flag;
- my_bool last_key;
- uchar *leaf_buff,*keypos;
- uchar lastkey[MARIA_MAX_KEY_BUFF];
+ my_bool last_key, buff_alloced= 0, lastkey_alloced;
+ uchar *leaf_buff=0, *keypos, *lastkey;
MARIA_KEY_PARAM s_temp;
MARIA_SHARE *share= info->s;
MARIA_KEYDEF *keyinfo= key->keyinfo;
@@ -294,12 +300,17 @@ static int d_search(MARIA_HA *info, MARIA_KEY *key, uint32 comp_flag,
DBUG_ENTER("d_search");
DBUG_DUMP("page", anc_page->buff, anc_page->size);
+ alloc_on_stack(*info->stack_end_ptr, lastkey, lastkey_alloced,
+ keyinfo->max_store_length);
+ if (!lastkey)
+ DBUG_RETURN(1);
+
flag=(*keyinfo->bin_search)(key, anc_page, comp_flag, &keypos, lastkey,
&last_key);
if (flag == MARIA_FOUND_WRONG_KEY)
{
DBUG_PRINT("error",("Found wrong key"));
- DBUG_RETURN(-1);
+ goto err;
}
page_flag= anc_page->flag;
nod_flag= anc_page->node;
@@ -344,14 +355,14 @@ static int d_search(MARIA_HA *info, MARIA_KEY *key, uint32 comp_flag,
&kpos)))
{
_ma_set_fatal_error(share, HA_ERR_CRASHED);
- DBUG_RETURN(-1);
+ goto err;
}
root= _ma_row_pos_from_key(&tmp_key);
if (subkeys == -1)
{
/* the last entry in sub-tree */
if (_ma_dispose(info, root, 1))
- DBUG_RETURN(-1);
+ goto err;
/* fall through to normal delete */
}
else
@@ -378,23 +389,20 @@ static int d_search(MARIA_HA *info, MARIA_KEY *key, uint32 comp_flag,
PAGECACHE_LOCK_LEFT_WRITELOCKED,
DFLT_INIT_HITS);
}
- DBUG_PRINT("exit",("Return: %d",ret_value));
- DBUG_RETURN(ret_value);
+ goto end;
}
}
}
- leaf_buff=0;
if (nod_flag)
{
/* Read left child page */
leaf_page.pos= _ma_kpos(nod_flag,keypos);
- if (!(leaf_buff= (uchar*) my_alloca((uint) keyinfo->block_length+
- MARIA_MAX_KEY_BUFF*2)))
- {
- DBUG_PRINT("error", ("Couldn't allocate memory"));
- my_errno=ENOMEM;
- DBUG_RETURN(-1);
- }
+
+ alloc_on_stack(*info->stack_end_ptr, leaf_buff, buff_alloced,
+ (keyinfo->block_length + keyinfo->max_store_length*2));
+ if (!leaf_buff)
+ goto err;
+
if (_ma_fetch_keypage(&leaf_page, info,keyinfo, leaf_page.pos,
PAGECACHE_LOCK_WRITE, DFLT_INIT_HITS, leaf_buff,
0))
@@ -439,7 +447,7 @@ static int d_search(MARIA_HA *info, MARIA_KEY *key, uint32 comp_flag,
_ma_log_delete(anc_page, s_temp.key_pos,
s_temp.changed_length, s_temp.move_length,
0, KEY_OP_DEBUG_LOG_DEL_CHANGE_1))
- DBUG_RETURN(-1);
+ goto err;
if (!nod_flag)
{ /* On leaf page */
@@ -448,12 +456,15 @@ static int d_search(MARIA_HA *info, MARIA_KEY *key, uint32 comp_flag,
(uint) keyinfo->underflow_block_length))
{
/* Page will be written by caller if we return 1 */
- DBUG_RETURN(1);
+ ret_value= 1;
+ goto end;
}
if (_ma_write_keypage(anc_page,
PAGECACHE_LOCK_LEFT_WRITELOCKED, DFLT_INIT_HITS))
- DBUG_RETURN(-1);
- DBUG_RETURN(0);
+ goto err;
+
+ ret_value= 0; /* Return ok */
+ goto end;
}
save_flag=1; /* Mark that anc_buff is changed */
ret_value= del(info, key, anc_page, &leaf_page,
@@ -506,12 +517,16 @@ static int d_search(MARIA_HA *info, MARIA_KEY *key, uint32 comp_flag,
{
DBUG_DUMP("page", anc_page->buff, anc_page->size);
}
- my_afree(leaf_buff);
+
+end:
+ stack_alloc_free(leaf_buff, buff_alloced);
+ stack_alloc_free(lastkey, lastkey_alloced);
DBUG_PRINT("exit",("Return: %d",ret_value));
DBUG_RETURN(ret_value);
err:
- my_afree(leaf_buff);
+ stack_alloc_free(leaf_buff, buff_alloced);
+ stack_alloc_free(lastkey, lastkey_alloced);
DBUG_PRINT("exit",("Error: %d",my_errno));
DBUG_RETURN (-1);
} /* d_search */
@@ -550,8 +565,9 @@ static int del(MARIA_HA *info, MARIA_KEY *key,
{
int ret_value,length;
uint a_length, page_flag, nod_flag, leaf_length, new_leaf_length;
- uchar keybuff[MARIA_MAX_KEY_BUFF],*endpos,*next_buff,*key_start, *prev_key;
+ uchar *keybuff,*endpos,*next_buff,*key_start, *prev_key;
uchar *anc_buff;
+ my_bool buff_alloced= 0, keybuff_alloced;
MARIA_KEY_PARAM s_temp;
MARIA_KEY tmp_key;
MARIA_SHARE *share= info->s;
@@ -564,6 +580,11 @@ static int del(MARIA_HA *info, MARIA_KEY *key,
keypos));
DBUG_DUMP("leaf_buff", leaf_page->buff, leaf_page->size);
+ alloc_on_stack(*info->stack_end_ptr, keybuff, keybuff_alloced,
+ keyinfo->max_store_length);
+ if (!keybuff)
+ DBUG_RETURN(1);
+
page_flag= leaf_page->flag;
leaf_length= leaf_page->size;
nod_flag= leaf_page->node;
@@ -574,14 +595,17 @@ static int del(MARIA_HA *info, MARIA_KEY *key,
next_buff= 0;
if (!(key_start= _ma_get_last_key(&tmp_key, leaf_page, endpos)))
- DBUG_RETURN(-1);
+ goto err;
if (nod_flag)
{
next_page.pos= _ma_kpos(nod_flag,endpos);
- if (!(next_buff= (uchar*) my_alloca((uint) keyinfo->block_length+
- MARIA_MAX_KEY_BUFF*2)))
- DBUG_RETURN(-1);
+
+ alloc_on_stack(*info->stack_end_ptr, next_buff, buff_alloced,
+ (keyinfo->block_length + keyinfo->max_store_length*2));
+ if (!next_buff)
+ goto err;
+
if (_ma_fetch_keypage(&next_page, info, keyinfo, next_page.pos,
PAGECACHE_LOCK_WRITE, DFLT_INIT_HITS, next_buff, 0))
ret_value= -1;
@@ -634,7 +658,8 @@ static int del(MARIA_HA *info, MARIA_KEY *key,
DFLT_INIT_HITS))
goto err;
}
- my_afree(next_buff);
+ stack_alloc_free(next_buff, buff_alloced);
+ stack_alloc_free(keybuff, keybuff_alloced);
DBUG_ASSERT(leaf_page->size <= share->max_index_block_size);
DBUG_RETURN(ret_value);
}
@@ -712,13 +737,15 @@ static int del(MARIA_HA *info, MARIA_KEY *key,
goto err;
DBUG_ASSERT(leaf_page->size <= share->max_index_block_size);
+ stack_alloc_free(next_buff, buff_alloced);
+ stack_alloc_free(keybuff, keybuff_alloced);
DBUG_RETURN(new_leaf_length <=
(info->quick_mode ? MARIA_MIN_KEYBLOCK_LENGTH :
(uint) keyinfo->underflow_block_length));
-err:
- if (next_buff)
- my_afree(next_buff);
+err:
+ stack_alloc_free(next_buff, buff_alloced);
+ stack_alloc_free(keybuff, keybuff_alloced);
DBUG_RETURN(-1);
} /* del */
@@ -761,13 +788,13 @@ static int underflow(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
uint next_buff_length, new_buff_length, key_reflength;
uint unchanged_leaf_length, new_leaf_length, new_anc_length;
uint anc_page_flag, page_flag;
- uchar anc_key_buff[MARIA_MAX_KEY_BUFF], leaf_key_buff[MARIA_MAX_KEY_BUFF];
+ uchar *anc_key_buff, *leaf_key_buff;
uchar *endpos, *next_keypos, *anc_pos, *half_pos, *prev_key;
uchar *anc_buff, *leaf_buff;
uchar *after_key, *anc_end_pos;
MARIA_KEY_PARAM key_deleted, key_inserted;
MARIA_SHARE *share= info->s;
- my_bool first_key;
+ my_bool first_key, buff_alloced;
MARIA_KEY tmp_key, anc_key, leaf_key;
MARIA_PAGE next_page;
DBUG_ENTER("underflow");
@@ -777,6 +804,13 @@ static int underflow(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
DBUG_DUMP("anc_buff", anc_page->buff, anc_page->size);
DBUG_DUMP("leaf_buff", leaf_page->buff, leaf_page->size);
+ alloc_on_stack(*info->stack_end_ptr, anc_key_buff, buff_alloced,
+ keyinfo->max_store_length*2);
+ if (!anc_key_buff)
+ DBUG_RETURN(1);
+
+ leaf_key_buff= anc_key_buff+ keyinfo->max_store_length;
+
anc_page_flag= anc_page->flag;
anc_buff= anc_page->buff;
leaf_buff= leaf_page->buff;
@@ -1035,6 +1069,7 @@ static int underflow(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
if (_ma_write_keypage(leaf_page,
PAGECACHE_LOCK_LEFT_WRITELOCKED, DFLT_INIT_HITS))
goto err;
+ stack_alloc_free(anc_key_buff, buff_alloced);
DBUG_RETURN(new_anc_length <=
((info->quick_mode ? MARIA_MIN_KEYBLOCK_LENGTH :
(uint) keyinfo->underflow_block_length)));
@@ -1264,11 +1299,13 @@ static int underflow(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
PAGECACHE_LOCK_LEFT_WRITELOCKED, DFLT_INIT_HITS))
goto err;
+ stack_alloc_free(anc_key_buff, buff_alloced);
DBUG_RETURN(new_anc_length <=
((info->quick_mode ? MARIA_MIN_KEYBLOCK_LENGTH :
(uint) keyinfo->underflow_block_length)));
err:
+ stack_alloc_free(anc_key_buff, buff_alloced);
DBUG_RETURN(-1);
} /* underflow */
diff --git a/storage/maria/ma_delete_table.c b/storage/maria/ma_delete_table.c
index fee001df1e1..01d9c4c4ec2 100644
--- a/storage/maria/ma_delete_table.c
+++ b/storage/maria/ma_delete_table.c
@@ -41,7 +41,7 @@ int maria_delete_table(const char *name)
Unfortunately it is necessary to open the table just to check this. We use
'open_for_repair' to be able to open even a crashed table.
*/
- if (!(info= maria_open(name, O_RDONLY, HA_OPEN_FOR_REPAIR)))
+ if (!(info= maria_open(name, O_RDONLY, HA_OPEN_FOR_REPAIR, 0)))
{
sync_dir= 0;
}
diff --git a/storage/maria/ma_dynrec.c b/storage/maria/ma_dynrec.c
index ae6fc57c114..a6dee74e57b 100644
--- a/storage/maria/ma_dynrec.c
+++ b/storage/maria/ma_dynrec.c
@@ -249,16 +249,20 @@ my_bool _ma_write_blob_record(MARIA_HA *info, const uchar *record)
uchar *rec_buff;
int error;
ulong reclength,reclength2,extra;
+ my_bool buff_alloced;
extra= (ALIGN_SIZE(MARIA_MAX_DYN_BLOCK_HEADER)+MARIA_SPLIT_LENGTH+
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)))
+
+ alloc_on_stack(*info->stack_end_ptr, rec_buff, buff_alloced, reclength);
+ if (!rec_buff)
{
my_errno= HA_ERR_OUT_OF_MEM; /* purecov: inspected */
return(1);
}
+
reclength2= _ma_rec_pack(info,
rec_buff+ALIGN_SIZE(MARIA_MAX_DYN_BLOCK_HEADER),
record);
@@ -275,7 +279,7 @@ my_bool _ma_write_blob_record(MARIA_HA *info, const uchar *record)
rec_buff+ALIGN_SIZE(MARIA_MAX_DYN_BLOCK_HEADER),
reclength2);
err:
- my_safe_afree(rec_buff, reclength);
+ stack_alloc_free(rec_buff, buff_alloced);
return(error != 0);
}
@@ -287,6 +291,7 @@ my_bool _ma_update_blob_record(MARIA_HA *info, MARIA_RECORD_POS pos,
uchar *rec_buff;
int error;
ulong reclength,reclength2,extra;
+ my_bool buff_alloced;
extra= (ALIGN_SIZE(MARIA_MAX_DYN_BLOCK_HEADER)+MARIA_SPLIT_LENGTH+
MARIA_DYN_DELETE_BLOCK_HEADER);
@@ -299,11 +304,14 @@ my_bool _ma_update_blob_record(MARIA_HA *info, MARIA_RECORD_POS pos,
return 1;
}
#endif
- if (!(rec_buff=(uchar*) my_safe_alloca(reclength)))
+
+ alloc_on_stack(*info->stack_end_ptr, rec_buff, buff_alloced, reclength);
+ if (!rec_buff)
{
my_errno= HA_ERR_OUT_OF_MEM; /* purecov: inspected */
return(1);
}
+
reclength2= _ma_rec_pack(info, rec_buff+
ALIGN_SIZE(MARIA_MAX_DYN_BLOCK_HEADER),
record);
@@ -317,7 +325,7 @@ my_bool _ma_update_blob_record(MARIA_HA *info, MARIA_RECORD_POS pos,
rec_buff+ALIGN_SIZE(MARIA_MAX_DYN_BLOCK_HEADER),
reclength2);
err:
- my_safe_afree(rec_buff, reclength);
+ stack_alloc_free(rec_buff, buff_alloced);
return(error != 0);
}
@@ -1579,10 +1587,12 @@ my_bool _ma_cmp_dynamic_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def,
{
uchar *old_rec_buff,*old_record;
size_t old_rec_buff_size;
- my_bool error;
+ my_bool error, buff_alloced;
DBUG_ENTER("_ma_cmp_dynamic_unique");
- if (!(old_record= my_safe_alloca(info->s->base.reclength)))
+ alloc_on_stack(*info->stack_end_ptr, old_record, buff_alloced,
+ info->s->base.reclength);
+ if (!old_record)
DBUG_RETURN(1);
/* Don't let the compare destroy blobs that may be in use */
@@ -1603,7 +1613,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);
+ stack_alloc_free(old_record, buff_alloced);
DBUG_RETURN(error);
}
@@ -1617,7 +1627,7 @@ my_bool _ma_cmp_dynamic_record(register MARIA_HA *info,
my_off_t filepos;
uchar *buffer;
MARIA_BLOCK_INFO block_info;
- my_bool error= 1;
+ my_bool error= 1, buff_alloced= 0;
size_t UNINIT_VAR(buffer_length);
DBUG_ENTER("_ma_cmp_dynamic_record");
@@ -1638,8 +1648,10 @@ 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)))
- DBUG_RETURN(1);
+
+ alloc_on_stack(*info->stack_end_ptr, buffer, buff_alloced, buffer_length);
+ if (!buffer)
+ DBUG_RETURN(1);
}
if (!(reclength= _ma_rec_pack(info,buffer,record)))
goto err;
@@ -1691,8 +1703,7 @@ my_bool _ma_cmp_dynamic_record(register MARIA_HA *info,
my_errno=0;
error= 0;
err:
- if (buffer != info->rec_buff)
- my_safe_afree(buffer, buffer_length);
+ stack_alloc_free(buffer, buff_alloced);
DBUG_PRINT("exit", ("result: %d", error));
DBUG_RETURN(error);
}
diff --git a/storage/maria/ma_ft_test1.h b/storage/maria/ma_ft_test1.h
index 0f4997a7142..df86eeceb66 100644
--- a/storage/maria/ma_ft_test1.h
+++ b/storage/maria/ma_ft_test1.h
@@ -311,7 +311,7 @@ struct { const char *f0, *f2; } data[NDATAS] = {
{"18.4.49", "Problems linking with the C API"},
{"18.4.50", "How to make a thread-safe client"},
{"18.5", "MySQL Perl API's"},
- {"18.5.1", "DBI with DBD::mysql"},
+ {"18.5.1", "DBI with DBD::MariaDB"},
{"18.5.1.1", "The DBI interface"},
{"18.5.1.2", "More DBI/DBD information"},
{"18.6", "MySQL Java connectivity (JDBC)"},
diff --git a/storage/maria/ma_info.c b/storage/maria/ma_info.c
index 6d40f804880..f0b04e020c2 100644
--- a/storage/maria/ma_info.c
+++ b/storage/maria/ma_info.c
@@ -31,7 +31,7 @@ MARIA_RECORD_POS maria_position(MARIA_HA *info)
uint maria_max_key_length()
{
uint tmp= (_ma_max_key_length() - 8 - HA_MAX_KEY_SEG*3);
- return MY_MIN(HA_MAX_KEY_LENGTH, tmp);
+ return MY_MIN(MARIA_MAX_KEY_LENGTH, tmp);
}
/* Get information about the table */
diff --git a/storage/maria/ma_open.c b/storage/maria/ma_open.c
index 05aca8f37e1..c7080daa265 100644
--- a/storage/maria/ma_open.c
+++ b/storage/maria/ma_open.c
@@ -24,6 +24,7 @@
#include "ma_trnman.h"
#include <m_ctype.h>
#include "ma_crypt.h"
+#include "s3_func.h"
#if defined(MSDOS) || defined(__WIN__)
#ifdef __WIN__
@@ -92,7 +93,8 @@ MARIA_HA *_ma_test_if_reopen(const char *filename)
static MARIA_HA *maria_clone_internal(MARIA_SHARE *share,
int mode, File data_file,
- uint internal_table)
+ uint internal_table,
+ struct ms3_st *s3)
{
int save_errno;
uint errpos;
@@ -130,6 +132,7 @@ static MARIA_HA *maria_clone_internal(MARIA_SHARE *share,
goto err;
errpos= 6;
+ info.s3= s3;
memcpy(info.blobs,share->blobs,sizeof(MARIA_BLOB)*share->base.blobs);
info.lastkey_buff2= info.lastkey_buff + share->base.max_key_length;
info.last_key.data= info.lastkey_buff;
@@ -238,6 +241,7 @@ err:
case 6:
(*share->end)(&info);
delete_dynamic(&info.pinned_pages);
+ my_free(m_info->s3);
my_free(m_info);
/* fall through */
case 5:
@@ -259,9 +263,10 @@ err:
have an open count of 0.
******************************************************************************/
-MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
+MARIA_HA *maria_open(const char *name, int mode, uint open_flags,
+ S3_INFO *s3)
{
- int kfile,open_mode,save_errno;
+ int open_mode= 0,save_errno;
uint i,j,len,errpos,head_length,base_pos,keys, realpath_err,
key_parts,base_key_parts,unique_key_parts,fulltext_keys,uniques;
uint internal_table= MY_TEST(open_flags & HA_OPEN_INTERNAL_TABLE);
@@ -277,28 +282,49 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
my_off_t key_root[HA_MAX_POSSIBLE_KEY];
ulonglong max_key_file_length, max_data_file_length;
my_bool versioning= 1;
- File data_file= -1;
+ File data_file= -1, kfile= -1;
+ struct ms3_st *s3_client= 0;
+ S3_INFO *share_s3= 0;
+ S3_BLOCK index_header;
DBUG_ENTER("maria_open");
- kfile= -1;
errpos= 0;
head_length=sizeof(share_buff.state.header);
bzero((uchar*) &info,sizeof(info));
+ bzero((uchar*) &index_header, sizeof(index_header));
- realpath_err= my_realpath(name_buff, fn_format(org_name, name, "",
- MARIA_NAME_IEXT,
- MY_UNPACK_FILENAME),MYF(0));
- if (realpath_err > 0) /* File not found, no point in looking further. */
+#ifndef WITH_S3_STORAGE_ENGINE
+ DBUG_ASSERT(!s3);
+#endif /* WITH_S3_STORAGE_ENGINE */
+
+ if (!s3)
{
- DBUG_RETURN(NULL);
- }
+ realpath_err= my_realpath(name_buff, fn_format(org_name, name, "",
+ MARIA_NAME_IEXT,
+ MY_UNPACK_FILENAME),MYF(0));
+ if (realpath_err > 0) /* File not found, no point in looking further. */
+ {
+ DBUG_RETURN(NULL);
+ }
- if (my_is_symlink(org_name) &&
- (realpath_err || mysys_test_invalid_symlink(name_buff)))
+ if (my_is_symlink(org_name) &&
+ (realpath_err || mysys_test_invalid_symlink(name_buff)))
+ {
+ my_errno= HA_WRONG_CREATE_OPTION;
+ DBUG_RETURN(0);
+ }
+ }
+#ifdef WITH_S3_STORAGE_ENGINE
+ else
{
- my_errno= HA_WRONG_CREATE_OPTION;
- DBUG_RETURN(0);
+ strmake(name_buff, name, sizeof(name_buff)-1); /* test_if_reopen() */
+ if (!(s3_client= s3_open_connection(s3)))
+ {
+ internal_table= 1; /* Avoid unlock on error */
+ goto err;
+ }
}
+#endif /* WITH_S3_STORAGE_ENGINE */
old_info= 0;
if (!internal_table)
@@ -313,32 +339,70 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
(uint) strlen(name_buff),
maria_pagecache);
- DBUG_EXECUTE_IF("maria_pretend_crashed_table_on_open",
- if (strstr(name, "/t1"))
- {
- my_errno= HA_ERR_CRASHED;
- goto err;
- });
- DEBUG_SYNC_C("mi_open_kfile");
- if ((kfile=mysql_file_open(key_file_kfile, name_buff,
- (open_mode=O_RDWR) | O_SHARE | O_NOFOLLOW | O_CLOEXEC,
- MYF(MY_NOSYMLINKS))) < 0)
+ if (!s3)
{
- if ((errno != EROFS && errno != EACCES) ||
- mode != O_RDONLY ||
- (kfile=mysql_file_open(key_file_kfile, name_buff,
- (open_mode=O_RDONLY) | O_SHARE | O_NOFOLLOW | O_CLOEXEC,
+ DBUG_EXECUTE_IF("maria_pretend_crashed_table_on_open",
+ if (strstr(name, "/t1"))
+ {
+ my_errno= HA_ERR_CRASHED;
+ goto err;
+ });
+ DEBUG_SYNC_C("mi_open_kfile");
+ if ((kfile=mysql_file_open(key_file_kfile, name_buff,
+ (open_mode=O_RDWR) | O_SHARE | O_NOFOLLOW | O_CLOEXEC,
MYF(MY_NOSYMLINKS))) < 0)
- goto err;
+ {
+ if ((errno != EROFS && errno != EACCES) ||
+ mode != O_RDONLY ||
+ (kfile=mysql_file_open(key_file_kfile, name_buff,
+ (open_mode=O_RDONLY) | O_SHARE | O_NOFOLLOW | O_CLOEXEC,
+ MYF(MY_NOSYMLINKS))) < 0)
+ goto err;
+ }
+ errpos= 1;
+ if (mysql_file_pread(kfile,share->state.header.file_version, head_length,
+ 0, MYF(MY_NABP)))
+ {
+ my_errno= HA_ERR_NOT_A_TABLE;
+ goto err;
+ }
}
- share->mode=open_mode;
- errpos= 1;
- if (mysql_file_pread(kfile,share->state.header.file_version, head_length,
- 0, MYF(MY_NABP)))
+#ifdef WITH_S3_STORAGE_ENGINE
+ else
{
- my_errno= HA_ERR_NOT_A_TABLE;
- goto err;
+ errpos= 1;
+ if (set_database_and_table_from_path(s3, name_buff))
+ {
+ my_printf_error(HA_ERR_NO_SUCH_TABLE,
+ "Can't find database and path from %s", MYF(0),
+ name_buff);
+ my_errno= HA_ERR_NO_SUCH_TABLE;
+ goto err;
+ }
+ if (!(share_s3= share->s3_path= s3_info_copy(s3)))
+ goto err; /* EiOM */
+
+ /* Check if table has changed in S3 */
+ if (s3_check_frm_version(s3_client, share_s3) == 1)
+ {
+ my_errno= HA_ERR_TABLE_DEF_CHANGED;
+ goto err;
+ }
+
+ if (read_index_header(s3_client, share_s3, &index_header))
+ goto err;
+ if (index_header.length < head_length)
+ {
+ my_errno=HA_ERR_NOT_A_TABLE;
+ goto err;
+ }
+ memcpy(share->state.header.file_version, index_header.str,
+ head_length);
+ kfile= s3_unique_file_number();
}
+#endif /* WITH_S3_STORAGE_ENGINE */
+
+ share->mode=open_mode;
if (memcmp(share->state.header.file_version, maria_file_magic, 4))
{
DBUG_PRINT("error",("Wrong header in %s",name_buff));
@@ -367,23 +431,31 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
my_errno= HA_ERR_UNSUPPORTED;
goto err;
}
- /* Don't call realpath() if the name can't be a link */
- if (!strcmp(name_buff, org_name) ||
- my_readlink(index_name, org_name, MYF(0)) == -1)
- (void) strmov(index_name, org_name);
- *strrchr(org_name, FN_EXTCHAR)= '\0';
- (void) fn_format(data_name,org_name,"",MARIA_NAME_DEXT,
- MY_APPEND_EXT|MY_UNPACK_FILENAME);
- if (my_is_symlink(data_name))
+ if (!s3)
{
- if (my_realpath(data_name, data_name, MYF(0)))
- goto err;
- if (mysys_test_invalid_symlink(data_name))
+ /* Don't call realpath() if the name can't be a link */
+ if (!strcmp(name_buff, org_name) ||
+ my_readlink(index_name, org_name, MYF(0)) == -1)
+ (void) strmov(index_name, org_name);
+ *strrchr(org_name, FN_EXTCHAR)= '\0';
+ (void) fn_format(data_name,org_name,"",MARIA_NAME_DEXT,
+ MY_APPEND_EXT|MY_UNPACK_FILENAME);
+ if (my_is_symlink(data_name))
{
- my_errno= HA_WRONG_CREATE_OPTION;
- goto err;
+ if (my_realpath(data_name, data_name, MYF(0)))
+ goto err;
+ if (mysys_test_invalid_symlink(data_name))
+ {
+ my_errno= HA_WRONG_CREATE_OPTION;
+ goto err;
+ }
+ share->mode|= O_NOFOLLOW; /* all symlinks are resolved by realpath() */
}
- share->mode|= O_NOFOLLOW; /* all symlinks are resolved by realpath() */
+ }
+ else
+ {
+ /* Don't show DIRECTORY in show create table */
+ index_name[0]= data_name[0]= 0;
}
info_length=mi_uint2korr(share->state.header.header_length);
@@ -401,11 +473,26 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
end_pos=disk_cache+info_length;
errpos= 3;
- if (mysql_file_pread(kfile, disk_cache, info_length, 0L, MYF(MY_NABP)))
+ if (!s3)
{
- _ma_set_fatal_error(share, HA_ERR_CRASHED);
- goto err;
+ if (mysql_file_pread(kfile, disk_cache, info_length, 0L, MYF(MY_NABP)))
+ {
+ _ma_set_fatal_error(share, HA_ERR_CRASHED);
+ goto err;
+ }
+ }
+#ifdef WITH_S3_STORAGE_ENGINE
+ else
+ {
+ if (index_header.length < info_length)
+ {
+ my_errno=HA_ERR_NOT_A_TABLE;
+ goto err;
+ }
+ memcpy(disk_cache, index_header.str, info_length);
}
+#endif /* WITH_S3_STORAGE_ENGINE */
+
len=mi_uint2korr(share->state.header.state_info_length);
keys= (uint) share->state.header.keys;
uniques= (uint) share->state.header.uniques;
@@ -436,7 +523,7 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
file_version= (share->state.header.not_used == 0);
if (file_version == 0)
share->base.language= share->state.header.not_used;
-
+
share->state.state_length=base_pos;
/* For newly opened tables we reset the error-has-been-printed flag */
share->state.changed&= ~STATE_CRASHED_PRINTED;
@@ -463,7 +550,7 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
- share->state.create_trid > trnman_get_max_trid()
- Critical as trid as stored releative to create_trid.
- uuid is different
-
+
STATE_NOT_MOVABLE is reset when a table is zerofilled
(has no LSN's and no trids)
@@ -527,7 +614,7 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
my_errno=HA_ERR_UNSUPPORTED;
my_printf_error(my_errno, "Wrong block size %u; Expected %u",
MYF(0),
- (uint) share->base.block_size,
+ (uint) share->base.block_size,
(uint) maria_block_size);
goto err;
}
@@ -629,6 +716,12 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
disk_pos=_ma_keydef_read(disk_pos, keyinfo);
keyinfo->key_nr= i;
+ /* Calculate length to store a key + nod flag and transaction info */
+ keyinfo->max_store_length= (keyinfo->maxlength +
+ share->base.key_reflength);
+ if (share->base.born_transactional)
+ keyinfo->max_store_length+= MARIA_INDEX_OVERHEAD_SIZE;
+
/* See ma_delete.cc::underflow() */
if (!(keyinfo->flag & (HA_BINARY_PACK_KEY | HA_PACK_KEY)))
keyinfo->underflow_block_length= keyinfo->block_length/3;
@@ -871,9 +964,16 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
if ((share->data_file_type == BLOCK_RECORD ||
share->data_file_type == COMPRESSED_RECORD))
{
- if (_ma_open_datafile(&info, share))
- goto err;
- data_file= info.dfile.file;
+ if (!s3)
+ {
+ if (_ma_open_datafile(&info, share))
+ goto err;
+ data_file= info.dfile.file;
+ }
+#ifdef WITH_S3_STORAGE_ENGINE
+ else
+ data_file= info.dfile.file= s3_unique_file_number();
+#endif /* WITH_S3_STORAGE_ENGINE */
}
errpos= 5;
@@ -915,6 +1015,7 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
max_data_file_length= share->base.max_data_file_length;
if ((*share->once_init)(share, info.dfile.file))
goto err;
+ errpos= 6;
if (internal_table)
set_if_smaller(share->base.max_data_file_length,
max_data_file_length);
@@ -1043,6 +1144,13 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
info.s= share;
maria_extra(&info, HA_EXTRA_MMAP, 0);
}
+#ifdef WITH_S3_STORAGE_ENGINE
+ if (s3_client)
+ {
+ size_t block_size= share->base.s3_block_size;
+ ms3_set_option(s3_client, MS3_OPT_BUFFER_CHUNK_SIZE, &block_size);
+ }
+#endif /* WITH_S3_STORAGE_ENGINE */
}
else
{
@@ -1051,8 +1159,13 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
data_file= share->bitmap.file.file; /* Only opened once */
}
+#ifdef WITH_S3_STORAGE_ENGINE
+ if (index_header.alloc_ptr)
+ s3_free(&index_header);
+#endif /* WITH_S3_STORAGE_ENGINE */
+
if (!(m_info= maria_clone_internal(share, mode, data_file,
- internal_table)))
+ internal_table, s3_client)))
goto err;
if (maria_is_crashed(m_info))
@@ -1063,6 +1176,7 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
mysql_mutex_unlock(&THR_LOCK_maria);
m_info->open_flags= open_flags;
+ m_info->stack_end_ptr= &my_thread_var->stack_ends_here;
DBUG_PRINT("exit", ("table: %p name: %s",m_info, name));
DBUG_RETURN(m_info);
@@ -1079,12 +1193,16 @@ err:
_ma_report_error(save_errno, &tmp_name);
}
switch (errpos) {
+ case 6:
+ /* Avoid mutex test in _ma_bitmap_end() */
+ share->internal_table= 1;
+ (*share->once_end)(share);
+ /* fall through */
case 5:
- if (data_file >= 0)
+ if (data_file >= 0 && !s3_client)
mysql_file_close(data_file, MYF(0));
if (old_info)
break; /* Don't remove open table */
- (*share->once_end)(share);
/* fall through */
case 4:
ma_crypt_free(share);
@@ -1095,12 +1213,20 @@ err:
my_free(share_buff.state.rec_per_key_part);
/* fall through */
case 1:
- mysql_file_close(kfile,MYF(0));
+ if (!s3)
+ mysql_file_close(kfile,MYF(0));
+ my_free(share_s3);
/* fall through */
case 0:
default:
break;
}
+#ifdef WITH_S3_STORAGE_ENGINE
+ if (s3_client)
+ ms3_deinit(s3_client);
+ if (index_header.alloc_ptr)
+ s3_free(&index_header);
+#endif /* WITH_S3_STORAGE_ENGINE */
if (!internal_table)
mysql_mutex_unlock(&THR_LOCK_maria);
my_errno= save_errno;
@@ -1634,14 +1760,15 @@ uint _ma_base_info_write(File file, MARIA_BASE_INFO *base)
*ptr++= base->keys;
*ptr++= base->auto_key;
*ptr++= base->born_transactional;
- *ptr++= 0; /* Reserved */
+ *ptr++= base->compression_algorithm;
mi_int2store(ptr,base->pack_bytes); ptr+= 2;
mi_int2store(ptr,base->blobs); ptr+= 2;
mi_int2store(ptr,base->max_key_block_length); ptr+= 2;
mi_int2store(ptr,base->max_key_length); ptr+= 2;
mi_int2store(ptr,base->extra_alloc_bytes); ptr+= 2;
*ptr++= base->extra_alloc_procent;
- bzero(ptr,16); ptr+= 16; /* extra */
+ mi_int3store(ptr, base->s3_block_size); ptr+= 3;
+ bzero(ptr,13); ptr+= 13; /* extra */
DBUG_ASSERT((ptr - buff) == MARIA_BASE_INFO_SIZE);
return mysql_file_write(file, buff, (size_t) (ptr-buff), MYF(MY_NABP)) != 0;
}
@@ -1678,14 +1805,15 @@ static uchar *_ma_base_info_read(uchar *ptr, MARIA_BASE_INFO *base)
base->keys= *ptr++;
base->auto_key= *ptr++;
base->born_transactional= *ptr++;
- ptr++;
+ base->compression_algorithm= *ptr++;
base->pack_bytes= mi_uint2korr(ptr); ptr+= 2;
base->blobs= mi_uint2korr(ptr); ptr+= 2;
base->max_key_block_length= mi_uint2korr(ptr); ptr+= 2;
base->max_key_length= mi_uint2korr(ptr); ptr+= 2;
base->extra_alloc_bytes= mi_uint2korr(ptr); ptr+= 2;
base->extra_alloc_procent= *ptr++;
- ptr+= 16;
+ base->s3_block_size= mi_uint3korr(ptr); ptr+= 3;
+ ptr+= 13;
return ptr;
}
@@ -1836,7 +1964,7 @@ uchar *_ma_columndef_read(uchar *ptr, MARIA_COLUMNDEF *columndef)
columndef->empty_pos= mi_uint2korr(ptr); ptr+= 2;
columndef->null_bit= (uint8) *ptr++;
columndef->empty_bit= (uint8) *ptr++;
- high_offset= mi_uint2korr(ptr); ptr+= 2;
+ high_offset= mi_uint2korr(ptr); ptr+= 2;
columndef->offset|= ((ulong) high_offset << 16);
ptr+= 2;
return ptr;
diff --git a/storage/maria/ma_pagecache.c b/storage/maria/ma_pagecache.c
index f486d8c704f..13a2f18cc94 100644
--- a/storage/maria/ma_pagecache.c
+++ b/storage/maria/ma_pagecache.c
@@ -85,6 +85,9 @@
#define PAGECACHE_DEBUG
#define PAGECACHE_DEBUG_LOG "my_pagecache_debug.log"
*/
+#undef PAGECACHE_DEBUG
+#define PAGECACHE_DEBUG_LOG "my_pagecache_debug.log"
+#define _VARARGS(X) X
/*
In key cache we have external raw locking here we use
@@ -127,7 +130,8 @@ my_bool my_disable_flush_pagecache_blocks= 0;
#define COND_FOR_REQUESTED 0 /* queue of thread waiting for read operation */
#define COND_FOR_SAVED 1 /* queue of thread waiting for flush */
#define COND_FOR_WRLOCK 2 /* queue of write lock */
-#define COND_SIZE 3 /* number of COND_* queues */
+#define COND_FOR_BIG_BLOCK 3 /* queue of waiting fo big block read */
+#define COND_SIZE 4 /* number of COND_* queues */
typedef mysql_cond_t KEYCACHE_CONDVAR;
@@ -146,7 +150,7 @@ struct st_pagecache_hash_link
struct st_pagecache_block_link
*block; /* reference to the block for the page: */
PAGECACHE_FILE file; /* from such a file */
- pgcache_page_no_t pageno; /* this page */
+ pgcache_page_no_t pageno; /* this page */
uint requests; /* number of requests for the page */
};
@@ -174,6 +178,7 @@ struct st_pagecache_hash_link
#define PCBLOCK_CHANGED 32 /* block buffer contains a dirty page */
#define PCBLOCK_DIRECT_W 64 /* possible direct write to the block */
#define PCBLOCK_DEL_WRITE 128 /* should be written on delete */
+#define PCBLOCK_BIG_READ 256 /* the first block of the big read in progress */
/* page status, returned by find_block */
#define PAGE_READ 0
@@ -507,37 +512,45 @@ static void test_key_cache(PAGECACHE *pagecache,
#define DEFAULT_PAGECACHE_DEBUG_LOG "pagecache_debug.log"
-#if defined(PAGECACHE_DEBUG) && ! defined(PAGECACHE_DEBUG_LOG)
-#define PAGECACHE_DEBUG_LOG DEFAULT_PAGECACHE_DEBUG_LOG
-#endif
-
-#if defined(PAGECACHE_DEBUG_LOG)
+#if defined(PAGECACHE_DEBUG)
static FILE *pagecache_debug_log= NULL;
static void pagecache_debug_print _VARARGS((const char *fmt, ...));
-#define PAGECACHE_DEBUG_OPEN \
- if (!pagecache_debug_log) \
- { \
- pagecache_debug_log= fopen(PAGECACHE_DEBUG_LOG, "w"); \
- (void) setvbuf(pagecache_debug_log, NULL, _IOLBF, BUFSIZ); \
+#define PAGECACHE_DEBUG_OPEN \
+ if (!pagecache_debug_log) \
+ { \
+ if ((pagecache_debug_log= fopen(PAGECACHE_DEBUG_LOG, "w"))) \
+ (void) setvbuf(pagecache_debug_log, NULL, _IOLBF, BUFSIZ); \
}
-#define PAGECACHE_DEBUG_CLOSE \
- if (pagecache_debug_log) \
- { \
- fclose(pagecache_debug_log); \
- pagecache_debug_log= 0; \
+#define PAGECACHE_DEBUG_CLOSE \
+ if (pagecache_debug_log) \
+ { \
+ fclose(pagecache_debug_log); \
+ pagecache_debug_log= 0; \
}
#else
#define PAGECACHE_DEBUG_OPEN
#define PAGECACHE_DEBUG_CLOSE
#endif /* defined(PAGECACHE_DEBUG_LOG) */
-#if defined(PAGECACHE_DEBUG_LOG) && defined(PAGECACHE_DEBUG)
+#if defined(PAGECACHE_DEBUG)
#define KEYCACHE_PRINT(l, m) KEYCACHE_DBUG_PRINT(l,m)
+
+#ifdef PAGECACHE_DEBUG_DLOG
+#define KEYCACHE_DBUG_PRINT(l, m) \
+ { if (pagecache_debug_log) \
+ { \
+ fprintf(pagecache_debug_log, "%s: ", l); \
+ DBUG_PRINT("PCDEBUG", ("%s: ", l)); \
+ } \
+ pagecache_debug_print m; }
+#else
#define KEYCACHE_DBUG_PRINT(l, m) \
{ if (pagecache_debug_log) \
fprintf(pagecache_debug_log, "%s: ", l); \
pagecache_debug_print m; }
+#endif
+
#define KEYCACHE_DBUG_ASSERT(a) \
{ if (! (a) && pagecache_debug_log) \
@@ -547,20 +560,21 @@ static void pagecache_debug_print _VARARGS((const char *fmt, ...));
#define KEYCACHE_PRINT(l, m)
#define KEYCACHE_DBUG_PRINT(l, m) DBUG_PRINT(l, m)
#define KEYCACHE_DBUG_ASSERT(a) DBUG_ASSERT(a)
-#endif /* defined(PAGECACHE_DEBUG_LOG) && defined(PAGECACHE_DEBUG) */
+#endif /* defined(PAGECACHE_DEBUG) */
#if defined(PAGECACHE_DEBUG) || !defined(DBUG_OFF)
-static long pagecache_thread_id;
+static my_thread_id pagecache_thread_id;
#define KEYCACHE_THREAD_TRACE(l) \
- KEYCACHE_DBUG_PRINT(l,("|thread %ld",pagecache_thread_id))
+ KEYCACHE_DBUG_PRINT(l,("|thread %lld",pagecache_thread_id))
#define KEYCACHE_THREAD_TRACE_BEGIN(l) \
{ struct st_my_thread_var *thread_var= my_thread_var; \
pagecache_thread_id= thread_var->id; \
- KEYCACHE_DBUG_PRINT(l,("[thread %ld",pagecache_thread_id)) }
+ KEYCACHE_DBUG_PRINT(l,("[thread %lld",pagecache_thread_id)); \
+ }
#define KEYCACHE_THREAD_TRACE_END(l) \
- KEYCACHE_DBUG_PRINT(l,("]thread %ld",pagecache_thread_id))
+ KEYCACHE_DBUG_PRINT(l,("]thread %lld",pagecache_thread_id))
#else
#define KEYCACHE_PRINT(l,m)
#define KEYCACHE_THREAD_TRACE_BEGIN(l)
@@ -586,13 +600,13 @@ static int ___pagecache_pthread_mutex_lock(mysql_mutex_t *mutex);
static void ___pagecache_pthread_mutex_unlock(mysql_mutex_t *mutex);
static int ___pagecache_pthread_cond_signal(mysql_cond_t *cond);
#define pagecache_pthread_mutex_lock(M) \
-{ DBUG_PRINT("lock", ("mutex lock 0x%lx %u", (ulong)(M), __LINE__)); \
+{ DBUG_PRINT("lock", ("mutex lock %p %u", (M), __LINE__)); \
___pagecache_pthread_mutex_lock(M);}
#define pagecache_pthread_mutex_unlock(M) \
-{ DBUG_PRINT("lock", ("mutex unlock 0x%lx %u", (ulong)(M), __LINE__)); \
+{ DBUG_PRINT("lock", ("mutex unlock %p %u", (M), __LINE__)); \
___pagecache_pthread_mutex_unlock(M);}
#define pagecache_pthread_cond_signal(M) \
-{ DBUG_PRINT("lock", ("signal 0x%lx %u", (ulong)(M), __LINE__)); \
+{ DBUG_PRINT("lock", ("signal %p %u", (M), __LINE__)); \
___pagecache_pthread_cond_signal(M);}
#else
#define pagecache_pthread_mutex_lock mysql_mutex_lock
@@ -748,7 +762,8 @@ static inline uint next_power(uint value)
size_t init_pagecache(PAGECACHE *pagecache, size_t use_mem,
uint division_limit, uint age_threshold,
- uint block_size, uint changed_blocks_hash_size,
+ uint block_size,
+ uint changed_blocks_hash_size,
myf my_readwrite_flags)
{
size_t blocks, hash_links, length;
@@ -756,6 +771,10 @@ size_t init_pagecache(PAGECACHE *pagecache, size_t use_mem,
DBUG_ENTER("init_pagecache");
DBUG_ASSERT(block_size >= 512);
+ // By default we init usual cache (variables will be assigned to switch to s3)
+ pagecache->big_block_read= NULL;
+ pagecache->big_block_free= NULL;
+
PAGECACHE_DEBUG_OPEN;
if (pagecache->inited && pagecache->disk_blocks > 0)
{
@@ -1350,6 +1369,8 @@ static void link_block(PAGECACHE *pagecache, PAGECACHE_BLOCK_LINK *block,
}
}
while (thread != last_thread);
+ DBUG_PRINT("XXX", ("hash_link (link block): %p, hash_link: %p -> %p",
+ hash_link, hash_link->block, block));
hash_link->block= block;
/* Ensure that no other thread tries to use this block */
block->status|= PCBLOCK_REASSIGNED;
@@ -1646,6 +1667,9 @@ static void unlink_hash(PAGECACHE *pagecache, PAGECACHE_HASH_LINK *hash_link)
if ((*hash_link->prev= hash_link->next))
hash_link->next->prev= hash_link->prev;
+
+ DBUG_PRINT("XXX", ("hash_link (unlink): %p, hash_link: %p -> NULL",
+ hash_link, hash_link->block));
hash_link->block= NULL;
if (pagecache->waiting_for_hash_link.last_thread)
{
@@ -1893,6 +1917,7 @@ static PAGECACHE_BLOCK_LINK *find_block(PAGECACHE *pagecache,
my_bool wrmode,
my_bool block_is_copied,
my_bool reg_req,
+ my_bool fast,
int *page_st)
{
PAGECACHE_HASH_LINK *hash_link;
@@ -1909,6 +1934,7 @@ static PAGECACHE_BLOCK_LINK *find_block(PAGECACHE *pagecache,
DBUG_EXECUTE("check_pagecache",
test_key_cache(pagecache, "start of find_block", 0););
#endif
+ DBUG_ASSERT(!fast || !wrmode);
restart:
/* Find the hash link for the requested page (file, pageno) */
@@ -2018,9 +2044,11 @@ restart:
/* This is a request for a new page or for a page not to be removed */
if (! block)
{
+ DBUG_PRINT("XXX", ("request for a new page"));
/* No block is assigned for the page yet */
if (pagecache->blocks_unused)
{
+ DBUG_PRINT("XXX", ("there is never used blocks"));
if (pagecache->free_block_list)
{
/* There is a block in the free list. */
@@ -2054,7 +2082,11 @@ restart:
block->last_hit_time= 0;
block->rec_lsn= LSN_MAX;
link_to_file_list(pagecache, block, file, 0);
+ DBUG_PRINT("XXX", ("block (no block assigned): %p, hash_link: %p -> %p",
+ block, block->hash_link, hash_link));
block->hash_link= hash_link;
+ DBUG_PRINT("XXX", ("hash_link (no block assignment): %p, hash_link: %p -> %p",
+ hash_link, hash_link->block, block));
hash_link->block= block;
page_status= PAGE_TO_BE_READ;
DBUG_PRINT("info", ("page to be read set for page %p (%u)",
@@ -2065,6 +2097,7 @@ restart:
}
else
{
+ DBUG_PRINT("XXX", ("there is NOT never used blocks"));
/* There are no never used blocks, use a block from the LRU chain */
/*
@@ -2076,6 +2109,8 @@ restart:
if (! pagecache->used_last)
{
+ struct st_my_thread_var *thread;
+ DBUG_PRINT("XXX", ("there is NOT UNUSED blocks"));
/*
Wait until a new block is added to the LRU chain;
several threads might wait here for the same page,
@@ -2084,8 +2119,18 @@ restart:
The block is given to us by the next thread executing
link_block().
*/
+ if (fast)
+ {
+ DBUG_ASSERT(hash_link->requests == 0);
+ unlink_hash(pagecache, hash_link);
+ DBUG_PRINT("info", ("fast and no blocks in LRU"));
- struct st_my_thread_var *thread= my_thread_var;
+ KEYCACHE_DBUG_PRINT("find_block",
+ ("fast and no blocks in LRU"));
+ DBUG_RETURN(0);
+ }
+
+ thread= my_thread_var;
thread->keycache_link= (void *) hash_link;
wqueue_link_into_queue(&pagecache->waiting_for_block, thread);
do
@@ -2104,13 +2149,30 @@ restart:
}
else
{
+ DBUG_PRINT("XXX", ("take a block from LRU"));
/*
Take the first block from the LRU chain
unlinking it from the chain
*/
block= pagecache->used_last->next_used;
+ if (fast &&
+ ((block->status & (PCBLOCK_IN_FLUSH | PCBLOCK_CHANGED)) ||
+ (block->hash_link && block->hash_link != hash_link &&
+ block->hash_link->requests)))
+ {
+ DBUG_ASSERT(hash_link->requests == 0);
+ unlink_hash(pagecache, hash_link);
+ DBUG_PRINT("info", ("fast and LRU block is in switch or has "
+ "readers"));
+ KEYCACHE_DBUG_PRINT("find_block",
+ ("fast and LRU block is in switch or has "
+ "readers"));
+ DBUG_RETURN (0);
+ }
if (reg_req)
reg_requests(pagecache, block, 1);
+ DBUG_PRINT("XXX", ("hash_link (LRU): %p, hash_link: %p -> %p",
+ hash_link, hash_link->block, block));
hash_link->block= block;
DBUG_ASSERT(block->requests == 1);
}
@@ -2181,6 +2243,8 @@ restart:
link_to_file_list(pagecache, block, file,
(my_bool)(block->hash_link ? 1 : 0));
+ DBUG_PRINT("XXX", ("block (LRU): %p, hash_link: %p -> %p",
+ block, block->hash_link, hash_link));
block->hash_link= hash_link;
PCBLOCK_INFO(block);
block->hits_left= init_hits_left;
@@ -2665,8 +2729,226 @@ retry:
DBUG_ASSERT(block->hash_link->requests > 0);
block->hash_link->requests--;
DBUG_RETURN(1);
+}
+
+
+/**
+ @brief Reading of a big block in the S3 storage engine.
+
+ @param pagecache Page cache
+ @param block Block to read
+
+ @note
+
+ Page cache is segmented in logical blocks of size 'block_size'. All
+ read request are for blocks of 'block_size'.
+
+ When using a file with 'big blocks', the file is split into a
+ header, header size (for index information) and then blocks of
+ big_block_size. he last block may be smaller than big_block_size.
+ All 'big blocks' are a multiple of block_size.
+ The header is never read into the page cache. It's used to store
+ the table definition and status and is only read by open().
+
+ When wanting to read a block, we register a read request for that
+ block and for the first block that is part of the big block read. We
+ also put a special flag on the first block so that if another thread
+ would want to do a big block read, it will wait on signal, and then
+ check if the block it requested is now in the page cache. If it's
+ not in the cache it will retry.
+
+ After the big block is read, we will put all read block that was not in the
+ page cache. Blocks that where already in page cache will not be touched
+ and will not be added first in the FIFO.
+
+ The block for which we had a read request is added first in FIFO and
+ returned.
+*/
+
+#ifdef WITH_S3_STORAGE_ENGINE
+static my_bool read_big_block(PAGECACHE *pagecache,
+ PAGECACHE_BLOCK_LINK *block)
+{
+ int page_st;
+ size_t big_block_size_in_pages;
+ size_t offset;
+ pgcache_page_no_t page, our_page;
+ pgcache_page_no_t page_to_read;
+ PAGECACHE_BLOCK_LINK *block_to_read= NULL;
+ PAGECACHE_IO_HOOK_ARGS args;
+ S3_BLOCK data;
+ DBUG_ENTER("read_big_block");
+ DBUG_PRINT("enter", ("read BIG block: %p", block));
+ bzero((void*) &data, sizeof(data));
+
+ DBUG_ASSERT(block->hash_link->file.big_block_size %
+ pagecache->block_size == 0);
+ big_block_size_in_pages=
+ block->hash_link->file.big_block_size / pagecache->block_size;
+
+ our_page= block->hash_link->pageno;
+
+ /* find first page of the big block (page_to_read) */
+ page_to_read= ((block->hash_link->pageno -
+ block->hash_link->file.head_blocks) /
+ big_block_size_in_pages);
+ page_to_read= (page_to_read * big_block_size_in_pages +
+ block->hash_link->file.head_blocks);
+ if (page_to_read != our_page)
+ {
+ block_to_read= find_block(pagecache, &block->hash_link->file,
+ page_to_read, 1,
+ FALSE, TRUE /* copy under protection (?)*/,
+ TRUE /*register*/, FALSE, &page_st);
+ DBUG_ASSERT(block_to_read == block_to_read->hash_link->block);
+
+ if (block_to_read->status & PCBLOCK_ERROR)
+ {
+ /* We get first block with an error so all operation failed */
+ block->status|= PCBLOCK_ERROR;
+ block->error= block_to_read->error;
+ DBUG_RETURN(FALSE); // no retry
+ }
+ // only primary request here, PAGE_WAIT_TO_BE_READ is impossible
+ DBUG_ASSERT(page_st != PAGE_WAIT_TO_BE_READ);
+ if (block_to_read->status & PCBLOCK_BIG_READ)
+ {
+ struct st_my_thread_var *thread;
+ DBUG_ASSERT(page_st != PAGE_TO_BE_READ);
+ /*
+ Block read failed because somebody else is reading the first block
+ (and all other blocks part of this one).
+ Wait until block is available.
+ */
+ unreg_request(pagecache, block, 1);
+ thread= my_thread_var;
+ /* Put the request into a queue and wait until it can be processed */
+ wqueue_add_to_queue(&block->wqueue[COND_FOR_BIG_BLOCK], thread);
+ do
+ {
+ DBUG_PRINT("wait",
+ ("suspend thread %s %ld", thread->name,
+ (ulong) thread->id));
+ pagecache_pthread_cond_wait(&thread->suspend,
+ &pagecache->cache_lock);
+ }
+ while (thread->next);
+ DBUG_RETURN(TRUE);
+ }
+ }
+ else
+ {
+ block_to_read= block;
+ page_st= PAGE_TO_BE_READ;
+ }
+
+ DBUG_ASSERT(!(block_to_read->status & PCBLOCK_BIG_READ));
+ // Mark the first page of a big block
+ block_to_read->status|= PCBLOCK_BIG_READ;
+
+ // Don't keep cache locked during the possible slow read from s3
+ pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+
+ // perform read of big block
+ args.page= NULL;
+ args.pageno= page_to_read;
+ args.data= block->hash_link->file.callback_data;
+ if (pagecache->big_block_read(pagecache, &args, &block->hash_link->file,
+ &data))
+ {
+ pagecache_pthread_mutex_lock(&pagecache->cache_lock);
+ block_to_read->status|= PCBLOCK_ERROR;
+ block->status|= PCBLOCK_ERROR;
+ block_to_read->error= block->error= (int16) my_errno;
+ pagecache->big_block_free(&data);
+ if (block_to_read != block)
+ {
+ remove_reader(block_to_read);
+ unreg_request(pagecache, block_to_read, 1);
+ }
+ /* Signal that all pending requests for this page now can be processed */
+ if (block->wqueue[COND_FOR_REQUESTED].last_thread)
+ wqueue_release_queue(&block->wqueue[COND_FOR_REQUESTED]);
+ DBUG_RETURN(FALSE); // no retry
+ }
+
+ /*
+ We need to keep the mutex locked while filling pages.
+ As there is no changed blocks to flush, this operation should
+ be reasonable fast
+ */
+ pagecache_pthread_mutex_lock(&pagecache->cache_lock);
+
+ /* Copy the first page to the cache */
+ if (page_st != PAGE_READ)
+ {
+ DBUG_ASSERT(page_st != PAGE_WAIT_TO_BE_READ);
+ memcpy(block_to_read->buffer, data.str, pagecache->block_size);
+ block_to_read->status|= PCBLOCK_READ;
+ }
+ else
+ DBUG_ASSERT(block_to_read->status & PCBLOCK_READ);
+
+ /* Copy the rest of the pages */
+ for (offset= pagecache->block_size, page= page_to_read + 1;
+ offset < data.length;
+ offset+= pagecache->block_size, page++)
+ {
+ DBUG_ASSERT(offset + pagecache->block_size <= data.length);
+ if (page == our_page)
+ {
+ DBUG_ASSERT(!(block->status & PCBLOCK_READ));
+ memcpy(block->buffer, data.str + offset, pagecache->block_size);
+ block->status|= PCBLOCK_READ;
+ }
+ else
+ {
+ PAGECACHE_BLOCK_LINK *bl;
+ bl= find_block(pagecache, &block->hash_link->file, page, 1,
+ FALSE, TRUE /* copy under protection (?)*/,
+ TRUE /*register*/, TRUE /*fast*/, &page_st);
+ if (!bl)
+ {
+ // we run out of easy avaliable pages in the cache
+ break;
+ }
+ DBUG_ASSERT(bl == bl->hash_link->block);
+ if ((bl->status & PCBLOCK_ERROR) == 0 &&
+ page_st == PAGE_TO_BE_READ)
+ {
+ memcpy(bl->buffer, data.str + offset, pagecache->block_size);
+ bl->status|= PCBLOCK_READ;
+ }
+ remove_reader(bl);
+ unreg_request(pagecache, bl, 1);
+ }
+ }
+ if (page < our_page)
+ {
+ /* we break earlier, but still have to fill page what was requested */
+ DBUG_ASSERT(!(block->status & PCBLOCK_READ));
+ memcpy(block->buffer,
+ data.str + ((our_page - page_to_read) * pagecache->block_size),
+ pagecache->block_size);
+ block->status|= PCBLOCK_READ;
+ }
+ pagecache->big_block_free(&data);
+
+ block_to_read->status&= ~PCBLOCK_BIG_READ;
+ if (block_to_read != block)
+ {
+ remove_reader(block_to_read);
+ unreg_request(pagecache, block_to_read, 1);
+ }
+ if (block->wqueue[COND_FOR_BIG_BLOCK].last_thread)
+ wqueue_release_queue(&block->wqueue[COND_FOR_BIG_BLOCK]);
+ if (block->wqueue[COND_FOR_REQUESTED].last_thread)
+ wqueue_release_queue(&block->wqueue[COND_FOR_REQUESTED]);
+
+ DBUG_RETURN(FALSE);
}
+#endif /* WITH_S3_STORAGE_ENGINE */
/*
@@ -2861,7 +3143,7 @@ void pagecache_unlock(PAGECACHE *pagecache,
inc_counter_for_resize_op(pagecache);
/* See NOTE for pagecache_unlock about registering requests */
block= find_block(pagecache, file, pageno, 0, 0, 0,
- pin == PAGECACHE_PIN_LEFT_UNPINNED, &page_st);
+ pin == PAGECACHE_PIN_LEFT_UNPINNED, FALSE, &page_st);
PCBLOCK_INFO(block);
DBUG_ASSERT(block != 0 && page_st == PAGE_READ);
if (first_REDO_LSN_for_page)
@@ -2948,7 +3230,7 @@ void pagecache_unpin(PAGECACHE *pagecache,
inc_counter_for_resize_op(pagecache);
/* See NOTE for pagecache_unlock about registering requests */
- block= find_block(pagecache, file, pageno, 0, 0, 0, 0, &page_st);
+ block= find_block(pagecache, file, pageno, 0, 0, 0, 0, FALSE, &page_st);
DBUG_ASSERT(block != 0);
DBUG_ASSERT(page_st == PAGE_READ);
/* we can't unpin such page without unlock */
@@ -3349,7 +3631,7 @@ uchar *pagecache_read(PAGECACHE *pagecache,
char llbuf[22];
DBUG_ENTER("pagecache_read");
DBUG_PRINT("enter", ("fd: %u page: %s buffer: %p level: %u "
- "t:%s (%d)%s->%s %s->%s",
+ "t:%s (%d)%s->%s %s->%s big block: %d",
(uint) file->file, ullstr(pageno, llbuf),
buff, level,
page_cache_page_type_str[type],
@@ -3357,7 +3639,8 @@ uchar *pagecache_read(PAGECACHE *pagecache,
page_cache_page_lock_str[lock_to_read[lock].new_lock],
page_cache_page_lock_str[lock_to_read[lock].unlock_lock],
page_cache_page_pin_str[new_pin],
- page_cache_page_pin_str[unlock_pin]));
+ page_cache_page_pin_str[unlock_pin],
+ MY_TEST(pagecache->big_block_read)));
DBUG_ASSERT(buff != 0 || (buff == 0 && (unlock_pin == PAGECACHE_PIN ||
unlock_pin == PAGECACHE_PIN_LEFT_PINNED)));
DBUG_ASSERT(pageno < ((1ULL) << 40));
@@ -3369,6 +3652,14 @@ uchar *pagecache_read(PAGECACHE *pagecache,
restart:
+ /*
+ If we use big block than the big block is multiple of blocks and we
+ have enouch blocks in cache
+ */
+ DBUG_ASSERT(!pagecache->big_block_read ||
+ (file->big_block_size != 0 &&
+ file->big_block_size % pagecache->block_size == 0));
+
if (pagecache->can_be_used)
{
/* Key cache is used */
@@ -3387,19 +3678,45 @@ restart:
pagecache->global_cache_r_requests++;
/* See NOTE for pagecache_unlock about registering requests. */
reg_request= ((new_pin == PAGECACHE_PIN_LEFT_UNPINNED) ||
- (new_pin == PAGECACHE_PIN));
+ (new_pin == PAGECACHE_PIN) ||
+ pagecache->big_block_read);
block= find_block(pagecache, file, pageno, level,
lock == PAGECACHE_LOCK_WRITE, buff != 0,
- reg_request, &page_st);
+ reg_request, FALSE, &page_st);
DBUG_PRINT("info", ("Block type: %s current type %s",
page_cache_page_type_str[block->type],
page_cache_page_type_str[type]));
if (((block->status & PCBLOCK_ERROR) == 0) && (page_st != PAGE_READ))
{
- /* The requested page is to be read into the block buffer */
- read_block(pagecache, block,
- (my_bool)(page_st == PAGE_TO_BE_READ));
- DBUG_PRINT("info", ("read is done"));
+#ifdef WITH_S3_STORAGE_ENGINE
+ if (!pagecache->big_block_read || page_st == PAGE_WAIT_TO_BE_READ)
+#endif /* WITH_S3_STORAGE_ENGINE */
+ {
+ /* The requested page is to be read into the block buffer */
+ read_block(pagecache, block, page_st == PAGE_TO_BE_READ);
+ DBUG_PRINT("info", ("read is done"));
+ }
+#ifdef WITH_S3_STORAGE_ENGINE
+ else
+ {
+ /* It is big read and this thread should read */
+ DBUG_ASSERT(page_st == PAGE_TO_BE_READ);
+
+ if (read_big_block(pagecache, block))
+ {
+ /* block is unregistered in read_big_block */
+ pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+ DBUG_PRINT("restart", ("big block fail, restarting..."));
+ goto restart;
+ }
+ if (!((new_pin == PAGECACHE_PIN_LEFT_UNPINNED) ||
+ (new_pin == PAGECACHE_PIN)))
+ {
+ /* we registered request only for big_block_read */
+ unreg_request(pagecache, block, 1);
+ }
+ }
+#endif /* WITH_S3_STORAGE_ENGINE */
}
/*
Assert after block is read. Imagine two concurrent SELECTs on same
@@ -3989,6 +4306,7 @@ my_bool pagecache_write_part(PAGECACHE *pagecache,
DBUG_ASSERT(lock != PAGECACHE_LOCK_READ_UNLOCK);
DBUG_ASSERT(offset + size <= pagecache->block_size);
DBUG_ASSERT(pageno < ((1ULL) << 40));
+ DBUG_ASSERT(pagecache->big_block_read == 0);
#endif
if (!page_link)
@@ -4025,7 +4343,7 @@ restart:
(pin == PAGECACHE_PIN));
block= find_block(pagecache, file, pageno, level,
TRUE, FALSE,
- reg_request, &page_st);
+ reg_request, FALSE, &page_st);
if (!block)
{
DBUG_ASSERT(write_mode != PAGECACHE_WRITE_DONE);
@@ -4277,6 +4595,8 @@ static my_bool free_block(PAGECACHE *pagecache, PAGECACHE_BLOCK_LINK *block,
block->type= PAGECACHE_EMPTY_PAGE;
#endif
block->rec_lsn= LSN_MAX;
+ DBUG_PRINT("XXX", ("block (Free): %p, hash_link: %p -> NULL",
+ block, block->hash_link));
block->hash_link= NULL;
if (block->temperature == PCBLOCK_WARM)
pagecache->warm_blocks--;
@@ -5229,6 +5549,7 @@ static int pagecache_pthread_cond_wait(mysql_cond_t *cond,
#endif
#endif /* defined(PAGECACHE_TIMEOUT) && !defined(__WIN__) */
+
#if defined(PAGECACHE_DEBUG)
static int ___pagecache_pthread_mutex_lock(mysql_mutex_t *mutex)
{
@@ -5255,32 +5576,26 @@ static int ___pagecache_pthread_cond_signal(mysql_cond_t *cond)
}
-#if defined(PAGECACHE_DEBUG_LOG)
-
-
static void pagecache_debug_print(const char * fmt, ...)
{
va_list args;
va_start(args,fmt);
if (pagecache_debug_log)
{
- VOID(vfprintf(pagecache_debug_log, fmt, args));
- VOID(fputc('\n',pagecache_debug_log));
+ vfprintf(pagecache_debug_log, fmt, args);
+ fputc('\n',pagecache_debug_log);
+#ifdef PAGECACHE_DEBUG_DLOG
+ _db_doprnt_(fmt, args);
+#endif
}
va_end(args);
}
-#endif /* defined(PAGECACHE_DEBUG_LOG) */
-
-#if defined(PAGECACHE_DEBUG_LOG)
-
void pagecache_debug_log_close(void)
{
if (pagecache_debug_log)
fclose(pagecache_debug_log);
}
-#endif /* defined(PAGECACHE_DEBUG_LOG) */
-
#endif /* defined(PAGECACHE_DEBUG) */
/**
@@ -5306,8 +5621,7 @@ static void null_post_write_hook(int res __attribute__((unused)),
return;
}
-void
-pagecache_file_set_null_hooks(PAGECACHE_FILE *file)
+void pagecache_file_set_null_hooks(PAGECACHE_FILE *file)
{
file->pre_read_hook= null_pre_hook;
file->post_read_hook= null_post_read_hook;
@@ -5315,4 +5629,5 @@ pagecache_file_set_null_hooks(PAGECACHE_FILE *file)
file->post_write_hook= null_post_write_hook;
file->flush_log_callback= null_pre_hook;
file->callback_data= NULL;
+ file->head_blocks= file->big_block_size= 0;
}
diff --git a/storage/maria/ma_pagecache.h b/storage/maria/ma_pagecache.h
index 1fb677995fb..1096444aa33 100644
--- a/storage/maria/ma_pagecache.h
+++ b/storage/maria/ma_pagecache.h
@@ -86,9 +86,25 @@ typedef struct st_pagecache_io_hook_args
uchar *crypt_buf; /* when using encryption */
} PAGECACHE_IO_HOOK_ARGS;
+struct st_pagecache;
+
+/* Structure to store things from get_object */
+
+typedef struct st_S3_BLOCK
+{
+ uchar *str, *alloc_ptr;
+ size_t length;
+} S3_BLOCK;
+
+
/* file descriptor for Maria */
typedef struct st_pagecache_file
{
+ /* Number of pages in the header which are not read with big blocks */
+ size_t head_blocks;
+ /* size of a big block for S3 or 0 */
+ size_t big_block_size;
+ /* File number */
File file;
/** Cannot be NULL */
@@ -99,9 +115,9 @@ typedef struct st_pagecache_file
my_bool (*pre_write_hook)(PAGECACHE_IO_HOOK_ARGS *args);
void (*post_write_hook)(int error, PAGECACHE_IO_HOOK_ARGS *args);
- /** Cannot be NULL */
my_bool (*flush_log_callback)(PAGECACHE_IO_HOOK_ARGS *args);
+ /** Cannot be NULL */
uchar *callback_data;
} PAGECACHE_FILE;
@@ -164,6 +180,17 @@ typedef struct st_pagecache
/* hash for other file bl.*/
PAGECACHE_BLOCK_LINK **file_blocks;
+ /**
+ Function for reading file in big hunks from S3
+ Data will be filled with pointer and length to data read
+ start_page will be contain first page read.
+ */
+ my_bool (*big_block_read)(struct st_pagecache *pagecache,
+ PAGECACHE_IO_HOOK_ARGS *args,
+ struct st_pagecache_file *file, S3_BLOCK *data);
+ void (*big_block_free)(S3_BLOCK *data);
+
+
/*
The following variables are and variables used to hold parameters for
initializing the key cache.
diff --git a/storage/maria/ma_recovery.c b/storage/maria/ma_recovery.c
index 59e5ae47519..ae86de4b731 100644
--- a/storage/maria/ma_recovery.c
+++ b/storage/maria/ma_recovery.c
@@ -813,7 +813,7 @@ prototype_redo_exec_hook(REDO_CREATE_TABLE)
goto end;
}
/* we try hard to get create_rename_lsn, to avoid mistakes if possible */
- info= maria_open(name, O_RDONLY, HA_OPEN_FOR_REPAIR);
+ info= maria_open(name, O_RDONLY, HA_OPEN_FOR_REPAIR, 0);
if (info)
{
MARIA_SHARE *share= info->s;
@@ -934,7 +934,7 @@ prototype_redo_exec_hook(REDO_CREATE_TABLE)
correctly filled. So we just open the table (fortunately, an empty
data file does not preclude this).
*/
- if (((info= maria_open(name, O_RDONLY, 0)) == NULL) ||
+ if (((info= maria_open(name, O_RDONLY, 0, 0)) == NULL) ||
_ma_initialize_data_file(info->s, info->dfile.file))
{
eprint(tracef, "Failed to open new table or write to data file");
@@ -1004,7 +1004,7 @@ prototype_redo_exec_hook(REDO_RENAME_TABLE)
log insertions of records into the temporary table, so replaying may
fail (grep for INCOMPLETE_LOG in files).
*/
- info= maria_open(old_name, O_RDONLY, HA_OPEN_FOR_REPAIR);
+ info= maria_open(old_name, O_RDONLY, HA_OPEN_FOR_REPAIR, 0);
if (info)
{
MARIA_SHARE *share= info->s;
@@ -1053,7 +1053,7 @@ prototype_redo_exec_hook(REDO_RENAME_TABLE)
t, renames it to u (if not testing create_rename_lsn) thus overwriting
old-named v, drops u, and we are stuck, we have lost data.
*/
- info= maria_open(new_name, O_RDONLY, HA_OPEN_FOR_REPAIR);
+ info= maria_open(new_name, O_RDONLY, HA_OPEN_FOR_REPAIR, 0);
if (info)
{
MARIA_SHARE *share= info->s;
@@ -1109,7 +1109,7 @@ prototype_redo_exec_hook(REDO_RENAME_TABLE)
eprint(tracef, "Failed to rename table");
goto end;
}
- info= maria_open(new_name, O_RDONLY, 0);
+ info= maria_open(new_name, O_RDONLY, 0, 0);
if (info == NULL)
{
eprint(tracef, "Failed to open renamed table");
@@ -1236,7 +1236,7 @@ prototype_redo_exec_hook(REDO_DROP_TABLE)
}
name= (char *)log_record_buffer.str;
tprint(tracef, "Table '%s'", name);
- info= maria_open(name, O_RDONLY, HA_OPEN_FOR_REPAIR);
+ info= maria_open(name, O_RDONLY, HA_OPEN_FOR_REPAIR, 0);
if (info)
{
MARIA_SHARE *share= info->s;
@@ -1378,7 +1378,7 @@ static int new_table(uint16 sid, const char *name, LSN lsn_of_file_id)
goto end;
}
tprint(tracef, "Table '%s', id %u", name, sid);
- info= maria_open(name, O_RDWR, HA_OPEN_FOR_REPAIR);
+ info= maria_open(name, O_RDWR, HA_OPEN_FOR_REPAIR, 0);
if (info == NULL)
{
tprint(tracef, ", is absent (must have been dropped later?)"
diff --git a/storage/maria/ma_rename.c b/storage/maria/ma_rename.c
index db5a718dbdd..a4388596f6b 100644
--- a/storage/maria/ma_rename.c
+++ b/storage/maria/ma_rename.c
@@ -48,7 +48,7 @@ int maria_rename(const char *old_name, const char *new_name)
_ma_check_table_is_closed(new_name,"rename new table2");
#endif
/** @todo LOCK take X-lock on table */
- if (!(info= maria_open(old_name, O_RDWR, HA_OPEN_FOR_REPAIR)))
+ if (!(info= maria_open(old_name, O_RDWR, HA_OPEN_FOR_REPAIR, 0)))
DBUG_RETURN(my_errno);
share= info->s;
#ifdef USE_RAID
diff --git a/storage/maria/ma_rt_index.c b/storage/maria/ma_rt_index.c
index a90efc4ca38..b2efe298daa 100644
--- a/storage/maria/ma_rt_index.c
+++ b/storage/maria/ma_rt_index.c
@@ -66,12 +66,16 @@ static int maria_rtree_find_req(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
int key_data_length;
uint *saved_key= (uint*) (info->maria_rtree_recursion_state) + level;
MARIA_PAGE page;
+ my_bool buff_alloced;
- if (!(page_buf= (uchar*) my_alloca((uint) keyinfo->block_length)))
+ alloc_on_stack(*info->stack_end_ptr, page_buf, buff_alloced,
+ keyinfo->block_length);
+ if (!page_buf)
{
my_errno= HA_ERR_OUT_OF_MEM;
- return -1;
+ return(-1);
}
+
if (_ma_fetch_keypage(&page, info, keyinfo, page_pos,
PAGECACHE_LOCK_LEFT_UNLOCKED,
DFLT_INIT_HITS, page_buf, 0))
@@ -165,11 +169,11 @@ static int maria_rtree_find_req(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
res= 1;
ok:
- my_afree(page_buf);
+ stack_alloc_free(page_buf, buff_alloced);
return res;
err:
- my_afree(page_buf);
+ stack_alloc_free(page_buf, buff_alloced);
info->cur_row.lastpos= HA_OFFSET_ERROR;
return -1;
}
@@ -329,10 +333,17 @@ static int maria_rtree_get_req(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
uint nod_flag, key_data_length;
int res;
uint *saved_key= (uint*) (info->maria_rtree_recursion_state) + level;
+ my_bool buff_alloced;
MARIA_PAGE page;
- if (!(page_buf= (uchar*) my_alloca((uint) keyinfo->block_length)))
- return -1;
+ alloc_on_stack(*info->stack_end_ptr, page_buf, buff_alloced,
+ keyinfo->block_length);
+ if (!page_buf)
+ {
+ my_errno= HA_ERR_OUT_OF_MEM;
+ return(-1);
+ }
+
if (_ma_fetch_keypage(&page, info, keyinfo, page_pos,
PAGECACHE_LOCK_LEFT_UNLOCKED,
DFLT_INIT_HITS, page_buf, 0))
@@ -422,11 +433,11 @@ static int maria_rtree_get_req(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
res= 1;
ok:
- my_afree(page_buf);
+ stack_alloc_free(page_buf, buff_alloced);
return res;
err:
- my_afree(page_buf);
+ stack_alloc_free(page_buf, buff_alloced);
info->cur_row.lastpos= HA_OFFSET_ERROR;
return -1;
}
@@ -603,18 +614,21 @@ static int maria_rtree_insert_req(MARIA_HA *info, MARIA_KEY *key,
uint nod_flag;
uint key_length= key->data_length;
int res;
+ my_bool buff_alloced;
uchar *page_buf, *k;
MARIA_SHARE *share= info->s;
MARIA_KEYDEF *keyinfo= key->keyinfo;
MARIA_PAGE page;
DBUG_ENTER("maria_rtree_insert_req");
- if (!(page_buf= (uchar*) my_alloca((uint) keyinfo->block_length +
- MARIA_MAX_KEY_BUFF)))
+ alloc_on_stack(*info->stack_end_ptr, page_buf, buff_alloced,
+ keyinfo->block_length + keyinfo->max_store_length);
+ if (!page_buf)
{
my_errno= HA_ERR_OUT_OF_MEM;
DBUG_RETURN(-1); /* purecov: inspected */
}
+
if (_ma_fetch_keypage(&page, info, keyinfo, page_pos, PAGECACHE_LOCK_WRITE,
DFLT_INIT_HITS, page_buf, 0))
goto err;
@@ -695,7 +709,7 @@ static int maria_rtree_insert_req(MARIA_HA *info, MARIA_KEY *key,
}
ok:
- my_afree(page_buf);
+ stack_alloc_free(page_buf, buff_alloced);
DBUG_RETURN(res);
err:
@@ -765,6 +779,7 @@ int maria_rtree_insert_level(MARIA_HA *info, MARIA_KEY *key, int ins_level,
case 1: /* root was split, grow a new root; very rare */
{
uchar *new_root_buf, *new_key_buff;
+ my_bool new_root_buf_alloced;
my_off_t new_root;
uint nod_flag= share->base.key_reflength;
MARIA_PINNED_PAGE tmp_page_link, *page_link;
@@ -773,14 +788,16 @@ int maria_rtree_insert_level(MARIA_HA *info, MARIA_KEY *key, int ins_level,
page_link= &tmp_page_link;
DBUG_PRINT("rtree", ("root was split, grow a new root"));
- if (!(new_root_buf= (uchar*) my_alloca((uint) keyinfo->block_length +
- MARIA_MAX_KEY_BUFF)))
+
+ alloc_on_stack(*info->stack_end_ptr, new_root_buf, new_root_buf_alloced,
+ keyinfo->block_length + keyinfo->max_store_length);
+ if (!new_root_buf)
{
my_errno= HA_ERR_OUT_OF_MEM;
DBUG_RETURN(-1); /* purecov: inspected */
}
- bzero(new_root_buf, share->block_size);
+ bzero(new_root_buf, keyinfo->block_length);
_ma_store_keypage_flag(share, new_root_buf, KEYPAGE_FLAG_ISNOD);
_ma_store_keynr(share, new_root_buf, keyinfo->key_nr);
_ma_store_page_used(share, new_root_buf, share->keypage_header);
@@ -805,14 +822,12 @@ int maria_rtree_insert_level(MARIA_HA *info, MARIA_KEY *key, int ins_level,
_ma_kpointer(info, new_key_buff - nod_flag, old_root);
if (maria_rtree_set_key_mbr(info, &new_key, old_root))
goto err;
- if (maria_rtree_add_key(&new_key, &page, NULL)
- == -1)
+ if (maria_rtree_add_key(&new_key, &page, NULL) == -1)
goto err;
_ma_kpointer(info, new_key_buff - nod_flag, new_page);
if (maria_rtree_set_key_mbr(info, &new_key, new_page))
goto err;
- if (maria_rtree_add_key(&new_key, &page, NULL)
- == -1)
+ if (maria_rtree_add_key(&new_key, &page, NULL) == -1)
goto err;
if (_ma_write_keypage(&page, write_lock, DFLT_INIT_HITS))
goto err;
@@ -820,10 +835,10 @@ int maria_rtree_insert_level(MARIA_HA *info, MARIA_KEY *key, int ins_level,
DBUG_PRINT("rtree", ("new root page: %lu level: %d nod_flag: %u",
(ulong) new_root, 0, page.node));
- my_afree(new_root_buf);
+ stack_alloc_free(new_root_buf, new_root_buf_alloced);
break;
err:
- my_afree(new_root_buf);
+ stack_alloc_free(new_root_buf, new_root_buf_alloced);
DBUG_RETURN(-1); /* purecov: inspected */
}
default:
@@ -922,17 +937,21 @@ static int maria_rtree_delete_req(MARIA_HA *info, const MARIA_KEY *key,
ulong i;
uint nod_flag;
int res;
+ my_bool buff_alloced;
uchar *page_buf, *last, *k;
MARIA_SHARE *share= info->s;
MARIA_KEYDEF *keyinfo= key->keyinfo;
MARIA_PAGE page;
DBUG_ENTER("maria_rtree_delete_req");
- if (!(page_buf= (uchar*) my_alloca((uint) keyinfo->block_length)))
+ alloc_on_stack(*info->stack_end_ptr, page_buf, buff_alloced,
+ keyinfo->block_length);
+ if (!page_buf)
{
my_errno= HA_ERR_OUT_OF_MEM;
- DBUG_RETURN(-1); /* purecov: inspected */
+ DBUG_RETURN(-1);
}
+
if (_ma_fetch_keypage(&page, info, keyinfo, page_pos, PAGECACHE_LOCK_WRITE,
DFLT_INIT_HITS, page_buf, 0))
goto err;
@@ -1072,11 +1091,11 @@ static int maria_rtree_delete_req(MARIA_HA *info, const MARIA_KEY *key,
res= 1;
ok:
- my_afree(page_buf);
+ stack_alloc_free(page_buf, buff_alloced);
DBUG_RETURN(res);
err:
- my_afree(page_buf);
+ stack_alloc_free(page_buf, buff_alloced);
DBUG_RETURN(-1); /* purecov: inspected */
}
@@ -1121,6 +1140,8 @@ my_bool maria_rtree_real_delete(MARIA_HA *info, MARIA_KEY *key,
MARIA_SHARE *share= info->s;
MARIA_KEYDEF *keyinfo= key->keyinfo;
uint key_data_length= key->data_length;
+ my_bool buff_alloced= 0;
+ uchar *page_buf= 0;
DBUG_ENTER("maria_rtree_real_delete");
if ((old_root= share->state.key_root[keyinfo->key_nr]) ==
@@ -1147,9 +1168,9 @@ my_bool maria_rtree_real_delete(MARIA_HA *info, MARIA_KEY *key,
{
uint nod_flag;
ulong i;
- uchar *page_buf;
MARIA_PAGE page;
MARIA_KEY tmp_key;
+
tmp_key.keyinfo= key->keyinfo;
tmp_key.data_length= key->data_length;
tmp_key.ref_length= key->ref_length;
@@ -1157,7 +1178,9 @@ my_bool maria_rtree_real_delete(MARIA_HA *info, MARIA_KEY *key,
if (ReinsertList.n_pages)
{
- if (!(page_buf= (uchar*) my_alloca((uint) keyinfo->block_length)))
+ alloc_on_stack(*info->stack_end_ptr, page_buf, buff_alloced,
+ keyinfo->block_length);
+ if (!page_buf)
{
my_errno= HA_ERR_OUT_OF_MEM;
goto err;
@@ -1186,10 +1209,7 @@ my_bool maria_rtree_real_delete(MARIA_HA *info, MARIA_KEY *key,
if ((res= maria_rtree_insert_level(info, &tmp_key,
ReinsertList.pages[i].level,
root)) == -1)
- {
- my_afree(page_buf);
goto err;
- }
if (res)
{
uint j;
@@ -1205,13 +1225,8 @@ my_bool maria_rtree_real_delete(MARIA_HA *info, MARIA_KEY *key,
}
page_mark_changed(info, &page);
if (_ma_dispose(info, page.pos, 0))
- {
- my_afree(page_buf);
goto err;
- }
}
- my_afree(page_buf);
- my_free(ReinsertList.pages);
}
/* check for redundant root (not leaf, 1 child) and eliminate */
@@ -1243,9 +1258,13 @@ my_bool maria_rtree_real_delete(MARIA_HA *info, MARIA_KEY *key,
default:
goto err; /* purecov: inspected */
}
+ my_free(ReinsertList.pages);
+ stack_alloc_free(page_buf, buff_alloced);
DBUG_RETURN(0);
err:
+ my_free(ReinsertList.pages);
+ stack_alloc_free(page_buf, buff_alloced);
DBUG_RETURN(1);
}
@@ -1268,14 +1287,19 @@ ha_rows maria_rtree_estimate(MARIA_HA *info, MARIA_KEY *key, uint32 flag)
MARIA_SHARE *share= info->s;
MARIA_KEYDEF *keyinfo= key->keyinfo;
MARIA_PAGE page;
+ my_bool buff_alloced;
if (flag & MBR_DISJOINT)
return HA_POS_ERROR;
if ((root= share->state.key_root[key->keyinfo->key_nr]) == HA_OFFSET_ERROR)
return HA_POS_ERROR;
- if (!(page_buf= (uchar*) my_alloca((uint) keyinfo->block_length)))
- return HA_POS_ERROR;
+
+ alloc_on_stack(*info->stack_end_ptr, page_buf, buff_alloced,
+ keyinfo->block_length);
+ if (!page_buf)
+ return(HA_POS_ERROR);
+
if (_ma_fetch_keypage(&page, info, keyinfo, root,
PAGECACHE_LOCK_LEFT_UNLOCKED, DFLT_INIT_HITS, page_buf,
0))
@@ -1343,11 +1367,11 @@ ha_rows maria_rtree_estimate(MARIA_HA *info, MARIA_KEY *key, uint32 flag)
res= HA_POS_ERROR;
}
- my_afree(page_buf);
+ stack_alloc_free(page_buf, buff_alloced);
return res;
err:
- my_afree(page_buf);
+ stack_alloc_free(page_buf, buff_alloced);
return HA_POS_ERROR;
}
diff --git a/storage/maria/ma_rt_split.c b/storage/maria/ma_rt_split.c
index 1eb0ffb5b89..a0acb9ce34d 100644
--- a/storage/maria/ma_rt_split.c
+++ b/storage/maria/ma_rt_split.c
@@ -378,7 +378,7 @@ int maria_rtree_split_page(const MARIA_KEY *key, MARIA_PAGE *page,
double *next_coord;
int n_dim;
uchar *source_cur, *cur1, *cur2;
- uchar *new_page_buff, *log_internal_copy, *log_internal_copy_ptr,
+ uchar *new_page_buff= 0, *log_internal_copy, *log_internal_copy_ptr,
*log_key_copy= NULL;
int err_code= 0;
uint new_page_length;
@@ -390,15 +390,17 @@ int maria_rtree_split_page(const MARIA_KEY *key, MARIA_PAGE *page,
int max_keys= ((org_length - share->keypage_header) / (full_length));
MARIA_PINNED_PAGE tmp_page_link, *page_link= &tmp_page_link;
MARIA_KEYDEF *keyinfo= key->keyinfo;
+ my_bool new_page_buff_alloced= 0, coord_buf_alloced= 0;
DBUG_ENTER("maria_rtree_split_page");
DBUG_PRINT("rtree", ("splitting block"));
n_dim= keyinfo->keysegs / 2;
- if (!(coord_buf= (double*) my_alloca(n_dim * 2 * sizeof(double) *
- (max_keys + 1 + 4) +
- sizeof(SplitStruct) * (max_keys + 1))))
- DBUG_RETURN(-1); /* purecov: inspected */
+ alloc_on_stack(*info->stack_end_ptr, coord_buf, coord_buf_alloced,
+ (n_dim * 2 * sizeof(double) * (max_keys + 1 + 4) +
+ sizeof(SplitStruct) * (max_keys + 1)));
+ if (!coord_buf)
+ DBUG_RETURN(-1);
task= (SplitStruct *)(coord_buf + n_dim * 2 * (max_keys + 1 + 4));
@@ -433,14 +435,15 @@ int maria_rtree_split_page(const MARIA_KEY *key, MARIA_PAGE *page,
}
/* Allocate buffer for new page and piece of log record */
- if (!(new_page_buff= (uchar*) my_alloca((uint)keyinfo->block_length +
- (transactional ?
- (max_keys * (2 + 2) +
- 1 + 2 + 1 + 2) : 0))))
+ alloc_on_stack(*info->stack_end_ptr, new_page_buff, new_page_buff_alloced,
+ (keyinfo->block_length +
+ (transactional ? max_keys * (2 + 2) + 1 + 2 + 1 + 2 : 0)));
+ if (!new_page_buff)
{
err_code= -1;
goto split_err;
}
+
log_internal_copy= log_internal_copy_ptr= new_page_buff +
keyinfo->block_length;
bzero(new_page_buff, share->block_size);
@@ -538,9 +541,9 @@ int maria_rtree_split_page(const MARIA_KEY *key, MARIA_PAGE *page,
}
DBUG_PRINT("rtree", ("split new block: %lu", (ulong) *new_page_offs));
- my_afree(new_page_buff);
split_err:
- my_afree(coord_buf);
+ stack_alloc_free(new_page_buff, new_page_buff_alloced);
+ stack_alloc_free(coord_buf, coord_buf_alloced);
DBUG_RETURN(err_code);
}
diff --git a/storage/maria/ma_rt_test.c b/storage/maria/ma_rt_test.c
index 5af941b78c8..ea82de9c488 100644
--- a/storage/maria/ma_rt_test.c
+++ b/storage/maria/ma_rt_test.c
@@ -199,7 +199,7 @@ static int run_test(const char *filename)
if (!silent)
printf("- Open isam-file\n");
- if (!(file=maria_open(filename,2,HA_OPEN_ABORT_IF_LOCKED)))
+ if (!(file=maria_open(filename,2,HA_OPEN_ABORT_IF_LOCKED,0)))
goto err;
maria_begin(file);
if (opt_versioning)
diff --git a/storage/maria/ma_search.c b/storage/maria/ma_search.c
index 63035925653..a57db7d2a2d 100644
--- a/storage/maria/ma_search.c
+++ b/storage/maria/ma_search.c
@@ -114,11 +114,11 @@ static int _ma_search_no_save(register MARIA_HA *info, MARIA_KEY *key,
MARIA_PINNED_PAGE **res_page_link,
uchar **res_page_buff)
{
- my_bool last_key_not_used;
+ my_bool last_key_not_used, buff_alloced;
int error,flag;
uint page_flag, nod_flag, used_length;
uchar *keypos,*maxpos;
- uchar lastkey[MARIA_MAX_KEY_BUFF];
+ uchar *lastkey;
MARIA_KEYDEF *keyinfo= key->keyinfo;
MARIA_PAGE page;
MARIA_PINNED_PAGE *page_link;
@@ -138,6 +138,11 @@ static int _ma_search_no_save(register MARIA_HA *info, MARIA_KEY *key,
DBUG_RETURN(1); /* Search at upper levels */
}
+ alloc_on_stack(*info->stack_end_ptr, lastkey, buff_alloced,
+ keyinfo->max_store_length);
+ if (!lastkey)
+ DBUG_RETURN(1);
+
if (_ma_fetch_keypage(&page, info, keyinfo, pos,
PAGECACHE_LOCK_READ, DFLT_INIT_HITS, 0, 0))
goto err;
@@ -164,16 +169,17 @@ static int _ma_search_no_save(register MARIA_HA *info, MARIA_KEY *key,
if ((error= _ma_search_no_save(info, key, nextflag,
_ma_kpos(nod_flag,keypos),
res_page_link, res_page_buff)) <= 0)
- DBUG_RETURN(error);
+ goto ret_error;
+ error= 1; /* Default return value */
if (flag >0)
{
if (nextflag & (SEARCH_SMALLER | SEARCH_LAST) &&
keypos == page.buff + info->s->keypage_header + nod_flag)
- DBUG_RETURN(1); /* Bigger than key */
+ goto ret_error; /* Bigger than key */
}
else if (nextflag & SEARCH_BIGGER && keypos >= maxpos)
- DBUG_RETURN(1); /* Smaller than key */
+ goto ret_error; /* Smaller than key */
}
else
{
@@ -188,7 +194,7 @@ static int _ma_search_no_save(register MARIA_HA *info, MARIA_KEY *key,
_ma_kpos(nod_flag,keypos),
res_page_link, res_page_buff)) >= 0 ||
my_errno != HA_ERR_KEY_NOT_FOUND)
- DBUG_RETURN(error);
+ goto ret_error;
}
}
@@ -233,6 +239,7 @@ static int _ma_search_no_save(register MARIA_HA *info, MARIA_KEY *key,
*res_page_link= page_link;
*res_page_buff= page.buff;
+ stack_alloc_free(lastkey, buff_alloced);
DBUG_PRINT("exit",("found key at %lu",(ulong) info->cur_row.lastpos));
DBUG_RETURN(0);
@@ -240,7 +247,11 @@ err:
DBUG_PRINT("exit",("Error: %d",my_errno));
info->cur_row.lastpos= HA_OFFSET_ERROR;
info->page_changed=1;
- DBUG_RETURN (-1);
+ error= -1;
+
+ret_error:
+ stack_alloc_free(lastkey, buff_alloced);
+ DBUG_RETURN(error);
}
diff --git a/storage/maria/ma_sp_test.c b/storage/maria/ma_sp_test.c
index 702b1b04d43..21adb33968e 100644
--- a/storage/maria/ma_sp_test.c
+++ b/storage/maria/ma_sp_test.c
@@ -119,7 +119,7 @@ int run_test(const char *filename)
if (!silent)
printf("- Open isam-file\n");
- if (!(file=maria_open(filename,2,HA_OPEN_ABORT_IF_LOCKED)))
+ if (!(file=maria_open(filename,2,HA_OPEN_ABORT_IF_LOCKED, 0)))
goto err;
if (!silent)
diff --git a/storage/maria/ma_test1.c b/storage/maria/ma_test1.c
index 9d739580470..091ac7e9278 100644
--- a/storage/maria/ma_test1.c
+++ b/storage/maria/ma_test1.c
@@ -209,7 +209,7 @@ static int run_test(const char *filename)
uniques, &uniquedef, &create_info,
create_flag))
goto err;
- if (!(file=maria_open(filename,2,HA_OPEN_ABORT_IF_LOCKED)))
+ if (!(file=maria_open(filename,2,HA_OPEN_ABORT_IF_LOCKED, 0)))
goto err;
if (!silent)
printf("- Writing key:s\n");
@@ -348,7 +348,7 @@ static int run_test(const char *filename)
goto err;
if (maria_close(file))
goto err;
- if (!(file=maria_open(filename,2,HA_OPEN_ABORT_IF_LOCKED)))
+ if (!(file=maria_open(filename,2,HA_OPEN_ABORT_IF_LOCKED, 0)))
goto err;
if (maria_begin(file))
goto err;
@@ -870,7 +870,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
record_type= DYNAMIC_RECORD;
break;
case 'k':
- if (key_length < 4 || key_length > HA_MAX_KEY_LENGTH)
+ if (key_length < 4 || key_length > MARIA_MAX_KEY_LENGTH)
{
fprintf(stderr,"Wrong key length\n");
exit(1);
diff --git a/storage/maria/ma_test2.c b/storage/maria/ma_test2.c
index 6a25ac8a363..7b7b31a7738 100644
--- a/storage/maria/ma_test2.c
+++ b/storage/maria/ma_test2.c
@@ -235,7 +235,7 @@ int main(int argc, char *argv[])
0,(MARIA_UNIQUEDEF*) 0,
&create_info,create_flag))
goto err;
- if (!(file=maria_open(filename,2,HA_OPEN_ABORT_IF_LOCKED)))
+ if (!(file=maria_open(filename,2,HA_OPEN_ABORT_IF_LOCKED, 0)))
goto err;
maria_begin(file);
if (opt_versioning)
diff --git a/storage/maria/ma_test3.c b/storage/maria/ma_test3.c
index bd80a0e8ab4..400016829e2 100644
--- a/storage/maria/ma_test3.c
+++ b/storage/maria/ma_test3.c
@@ -171,8 +171,8 @@ void start_test(int id)
MARIA_INFO isam_info;
MARIA_HA *file,*file1,*file2=0,*lock;
- if (!(file1=maria_open(filename,O_RDWR,HA_OPEN_WAIT_IF_LOCKED)) ||
- !(file2=maria_open(filename,O_RDWR,HA_OPEN_WAIT_IF_LOCKED)))
+ if (!(file1=maria_open(filename,O_RDWR,HA_OPEN_WAIT_IF_LOCKED,0)) ||
+ !(file2=maria_open(filename,O_RDWR,HA_OPEN_WAIT_IF_LOCKED,0)))
{
fprintf(stderr,"Can't open isam-file: %s\n",filename);
exit(1);
diff --git a/storage/maria/ma_write.c b/storage/maria/ma_write.c
index 07be8333794..92d90d5c426 100644
--- a/storage/maria/ma_write.c
+++ b/storage/maria/ma_write.c
@@ -620,9 +620,8 @@ static int w_search(register MARIA_HA *info, uint32 comp_flag, MARIA_KEY *key,
my_bool insert_last)
{
int error,flag;
- uchar *temp_buff,*keypos;
- uchar keybuff[MARIA_MAX_KEY_BUFF];
- my_bool was_last_key;
+ uchar *temp_buff,*keypos,*keybuff;
+ my_bool was_last_key, buff_alloced;
my_off_t next_page, dup_key_pos;
MARIA_SHARE *share= info->s;
MARIA_KEYDEF *keyinfo= key->keyinfo;
@@ -630,9 +629,13 @@ static int w_search(register MARIA_HA *info, uint32 comp_flag, MARIA_KEY *key,
DBUG_ENTER("w_search");
DBUG_PRINT("enter", ("page: %lu", (ulong) (page_pos/keyinfo->block_length)));
- if (!(temp_buff= (uchar*) my_alloca((uint) keyinfo->block_length+
- MARIA_MAX_KEY_BUFF*2)))
- DBUG_RETURN(-1);
+ alloc_on_stack(*info->stack_end_ptr, temp_buff, buff_alloced,
+ (keyinfo->block_length + keyinfo->max_store_length*3));
+ if (!temp_buff)
+ DBUG_RETURN(1);
+
+ keybuff= temp_buff + (keyinfo->block_length + keyinfo->max_store_length*2);
+
if (_ma_fetch_keypage(&page, info, keyinfo, page_pos, PAGECACHE_LOCK_WRITE,
DFLT_INIT_HITS, temp_buff, 0))
goto err;
@@ -692,7 +695,7 @@ static int w_search(register MARIA_HA *info, uint32 comp_flag, MARIA_KEY *key,
DFLT_INIT_HITS))
goto err;
}
- my_afree(temp_buff);
+ stack_alloc_free(temp_buff, buff_alloced);
DBUG_RETURN(error);
}
}
@@ -742,10 +745,10 @@ static int w_search(register MARIA_HA *info, uint32 comp_flag, MARIA_KEY *key,
DFLT_INIT_HITS))
goto err;
}
- my_afree(temp_buff);
+ stack_alloc_free(temp_buff, buff_alloced);
DBUG_RETURN(error);
err:
- my_afree(temp_buff);
+ stack_alloc_free(temp_buff, buff_alloced);
DBUG_PRINT("exit",("Error: %d",my_errno));
DBUG_RETURN(-1);
} /* w_search */
@@ -1243,15 +1246,20 @@ static int _ma_balance_page(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
{
MARIA_PINNED_PAGE tmp_page_link, *new_page_link= &tmp_page_link;
MARIA_SHARE *share= info->s;
- my_bool right;
+ my_bool right, buff_alloced;
uint k_length,father_length,father_keylength,nod_flag,curr_keylength;
uint right_length,left_length,new_right_length,new_left_length,extra_length;
uint keys, tmp_length, extra_buff_length;
uchar *pos, *extra_buff, *parting_key;
- uchar tmp_part_key[MARIA_MAX_KEY_BUFF];
+ uchar *tmp_part_key;
MARIA_PAGE next_page, extra_page, *left_page, *right_page;
DBUG_ENTER("_ma_balance_page");
+ alloc_on_stack(*info->stack_end_ptr, tmp_part_key, buff_alloced,
+ keyinfo->max_store_length);
+ if (!tmp_part_key)
+ DBUG_RETURN(-1);
+
k_length= keyinfo->keylength;
father_length= father_page->size;
father_keylength= k_length + share->base.key_reflength;
@@ -1463,6 +1471,7 @@ static int _ma_balance_page(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
_ma_write_keypage(father_page,
PAGECACHE_LOCK_LEFT_WRITELOCKED, DFLT_INIT_HITS))
goto err;
+ stack_alloc_free(tmp_part_key, buff_alloced);
DBUG_RETURN(0);
}
@@ -1633,9 +1642,11 @@ static int _ma_balance_page(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
DFLT_INIT_HITS))
goto err;
+ stack_alloc_free(tmp_part_key, buff_alloced);
DBUG_RETURN(1); /* Middle key up */
err:
+ stack_alloc_free(tmp_part_key, buff_alloced);
DBUG_RETURN(-1);
} /* _ma_balance_page */
diff --git a/storage/maria/maria_chk.c b/storage/maria/maria_chk.c
index 2f130de1c7a..f5b9029d6ff 100644
--- a/storage/maria/maria_chk.c
+++ b/storage/maria/maria_chk.c
@@ -19,10 +19,12 @@
#include <myisamchk.h>
#include <my_bit.h>
#include <m_ctype.h>
-#include <stdarg.h>
#include <my_getopt.h>
#include <my_check_opt.h>
#include <my_handler_errors.h>
+/* Remove next line if you want aria_chk to produce a stack trace */
+#undef HAVE_BACKTRACE
+#include <my_stacktrace.h>
static uint decode_bits;
static char **default_argv;
@@ -117,15 +119,15 @@ static void my_exit(int exit_code)
MY_CHECK_ERROR | MY_GIVE_INFO : MY_CHECK_ERROR);
exit(exit_code);
}
-
- /* Main program */
+/* Main program */
int main(int argc, char **argv)
{
int error;
MY_INIT(argv[0]);
+ my_init_stacktrace(1);
default_log_dir= opt_log_dir= maria_data_root= (char *)".";
maria_chk_init(&check_param);
check_param.opt_lock_memory= 1; /* Lock memory if possible */
@@ -1023,7 +1025,8 @@ static int maria_chk(HA_CHECK *param, char *filename)
((param->testflag & T_WAIT_FOREVER) ?
HA_OPEN_WAIT_IF_LOCKED :
(param->testflag & T_DESCRIPT) ?
- HA_OPEN_IGNORE_IF_LOCKED : HA_OPEN_ABORT_IF_LOCKED))))
+ HA_OPEN_IGNORE_IF_LOCKED : HA_OPEN_ABORT_IF_LOCKED),
+ 0)))
{
/* Avoid twice printing of isam file name */
param->error_printed=1;
@@ -1091,6 +1094,15 @@ static int maria_chk(HA_CHECK *param, char *filename)
param->testflag|= T_REP_BY_SORT;
}
}
+ if ((share->base.extra_options & MA_EXTRA_OPTIONS_ENCRYPTED) &&
+ !(param->testflag & T_DESCRIPT))
+ {
+ _ma_check_print_warning(param,
+ "Table %s is encrypted. Only --description (-d) "
+ "option is supported", filename);
+ param->warning_printed= 0;
+ goto end2;
+ }
/*
Skip the checking of the file if:
@@ -1543,6 +1555,8 @@ static void descript(HA_CHECK *param, register MARIA_HA *info, char *name)
if (param->testflag & T_VERBOSE)
{
+ if (share->base.extra_options & MA_EXTRA_OPTIONS_ENCRYPTED)
+ printf("Encrypted: yes\n");
printf("File-version: %d\n",
(int) share->state.header.file_version[3]);
if (share->state.create_time)
@@ -2005,9 +2019,10 @@ static int sort_record_index(MARIA_SORT_PARAM *sort_param,
MARIA_HA *info= ma_page->info;
MARIA_SHARE *share= info->s;
uint page_flag, nod_flag,used_length;
+ my_bool buff_alloced;
uchar *temp_buff,*keypos,*endpos;
my_off_t next_page,rec_pos;
- uchar lastkey[MARIA_MAX_KEY_BUFF];
+ uchar *lastkey;
char llbuff[22];
MARIA_SORT_INFO *sort_info= sort_param->sort_info;
HA_CHECK *param=sort_info->param;
@@ -2016,20 +2031,24 @@ static int sort_record_index(MARIA_SORT_PARAM *sort_param,
const MARIA_KEYDEF *keyinfo= ma_page->keyinfo;
DBUG_ENTER("sort_record_index");
+ temp_buff=0;
page_flag= ma_page->flag;
nod_flag= ma_page->node;
- temp_buff=0;
tmp_key.keyinfo= (MARIA_KEYDEF*) keyinfo;
- tmp_key.data= lastkey;
- if (nod_flag)
+ alloc_on_stack(*info->stack_end_ptr, lastkey, buff_alloced,
+ (nod_flag ? keyinfo->block_length : 0) +
+ ALIGN_SIZE(keyinfo->max_store_length));
+ if (!lastkey)
{
- if (!(temp_buff= (uchar*) my_alloca(tmp_key.keyinfo->block_length)))
- {
- _ma_check_print_error(param,"Not Enough memory");
- DBUG_RETURN(-1);
- }
+ _ma_check_print_error(param,"Not Enough memory");
+ DBUG_RETURN(-1);
}
+ if (nod_flag)
+ temp_buff= lastkey + ALIGN_SIZE(keyinfo->max_store_length);
+
+ tmp_key.data= lastkey;
+
used_length= ma_page->size;
keypos= ma_page->buff + share->keypage_header + nod_flag;
endpos= ma_page->buff + used_length;
@@ -2084,12 +2103,11 @@ static int sort_record_index(MARIA_SORT_PARAM *sort_param,
_ma_check_print_error(param,"%d when updating keyblock",my_errno);
goto err;
}
- if (temp_buff)
- my_afree(temp_buff);
+ stack_alloc_free(lastkey, buff_alloced);
DBUG_RETURN(0);
+
err:
- if (temp_buff)
- my_afree(temp_buff);
+ stack_alloc_free(lastkey, buff_alloced);
DBUG_RETURN(1);
} /* sort_record_index */
@@ -2100,7 +2118,7 @@ static my_bool write_log_record(HA_CHECK *param)
Now that all operations including O_NEW_DATA|INDEX are successfully
done, we can write a log record.
*/
- MARIA_HA *info= maria_open(param->isam_file_name, O_RDWR, 0);
+ MARIA_HA *info= maria_open(param->isam_file_name, O_RDWR, 0, 0);
if (info == NULL)
_ma_check_print_error(param, default_open_errmsg, my_errno,
param->isam_file_name);
diff --git a/storage/maria/maria_def.h b/storage/maria/maria_def.h
index dae6aa2cac3..13ae2a6150a 100644
--- a/storage/maria/maria_def.h
+++ b/storage/maria/maria_def.h
@@ -48,6 +48,9 @@
/* maria_open() flag, specific for maria_pack */
#define HA_OPEN_IGNORE_MOVED_STATE (1U << 30)
+typedef struct st_sort_key_blocks MA_SORT_KEY_BLOCKS;
+typedef struct st_sort_ftbuf MA_SORT_FT_BUF;
+
extern PAGECACHE maria_pagecache_var, *maria_pagecache;
int maria_assign_to_pagecache(MARIA_HA *info, ulonglong key_map,
PAGECACHE *key_cache);
@@ -62,8 +65,8 @@ typedef struct st_maria_sort_info
MARIA_HA *info, *new_info;
HA_CHECK *param;
char *buff;
- SORT_KEY_BLOCKS *key_block, *key_block_end;
- SORT_FT_BUF *ft_buf;
+ MA_SORT_KEY_BLOCKS *key_block, *key_block_end;
+ MA_SORT_FT_BUF *ft_buf;
my_off_t filelength, dupp, buff_length;
pgcache_page_no_t page;
ha_rows max_records;
@@ -221,6 +224,10 @@ typedef struct st_maria_state_info
#define MARIA_FILE_CREATE_RENAME_LSN_OFFSET 4
#define MARIA_FILE_CREATE_TRID_OFFSET (4 + LSN_STORE_SIZE*3 + 11*8)
+#define MARIA_MAX_KEY_LENGTH 2000
+#define MARIA_MAX_KEY_BUFF (MARIA_MAX_KEY_LENGTH+HA_MAX_KEY_SEG*6+8+8 + \
+ MARIA_MAX_PACK_TRANSID_SIZE)
+#define MARIA_MAX_POSSIBLE_KEY_BUFF (MARIA_MAX_KEY_LENGTH + 24+ 6+6)
#define MARIA_STATE_KEY_SIZE (8 + 4)
#define MARIA_STATE_KEYBLOCK_SIZE 8
#define MARIA_STATE_KEYSEG_SIZE 12
@@ -228,7 +235,6 @@ typedef struct st_maria_state_info
#define MARIA_KEYDEF_SIZE (2+ 5*2)
#define MARIA_UNIQUEDEF_SIZE (2+1+1)
#define HA_KEYSEG_SIZE (6+ 2*2 + 4*2)
-#define MARIA_MAX_KEY_BUFF (HA_MAX_KEY_BUFF + MARIA_MAX_PACK_TRANSID_SIZE)
#define MARIA_COLUMNDEF_SIZE (2*7+1+1+4)
#define MARIA_BASE_INFO_SIZE (MY_UUID_SIZE + 5*8 + 6*4 + 11*2 + 6 + 5*2 + 1 + 16)
#define MARIA_INDEX_BLOCK_MARGIN 16 /* Safety margin for .MYI tables */
@@ -245,6 +251,8 @@ typedef struct st_maria_state_info
#define MA_EXTRA_OPTIONS_ENCRYPTED (1 << 0)
#define MA_EXTRA_OPTIONS_INSERT_ORDER (1 << 1)
+#include "ma_check.h"
+
/*
Basic information of the Maria table. This is stored on disk
and not changed (unless we do DLL changes).
@@ -263,6 +271,7 @@ typedef struct st_ma_base_info
ulong min_pack_length;
ulong max_pack_length; /* Max possibly length of packed rec */
ulong min_block_length;
+ ulong s3_block_size; /* Block length for S3 files */
uint fields; /* fields in table */
uint fixed_not_null_fields;
uint fixed_not_null_fields_length;
@@ -298,6 +307,8 @@ typedef struct st_ma_base_info
uint extra_options;
/* default language, not really used but displayed by maria_chk */
uint language;
+ /* Compression library used. 0 for no compression */
+ uint compression_algorithm;
/* The following are from the header */
uint key_parts, all_key_parts;
@@ -362,6 +373,7 @@ typedef struct st_maria_file_bitmap
#define MARIA_CHECKPOINT_SEEN_IN_LOOP 4
typedef struct st_maria_crypt_data MARIA_CRYPT_DATA;
+struct ms3_st;
typedef struct st_maria_share
{ /* Shared between opens */
@@ -456,6 +468,7 @@ typedef struct st_maria_share
uint32 ftkeys; /* Number of distinct full-text keys
+ 1 */
PAGECACHE_FILE kfile; /* Shared keyfile */
+ S3_INFO *s3_path; /* Connection and path in s3 */
File data_file; /* Shared data file */
int mode; /* mode of file on open */
uint reopen; /* How many times opened */
@@ -609,6 +622,8 @@ struct st_maria_handler
MARIA_STATUS_INFO *state, state_save;
MARIA_STATUS_INFO *state_start; /* State at start of transaction */
MARIA_USED_TABLES *used_tables;
+ struct ms3_st *s3;
+ void **stack_end_ptr;
MARIA_ROW cur_row; /* The active row that we just read */
MARIA_ROW new_row; /* Storage for a row during update */
MARIA_KEY last_key; /* Last found key */
@@ -715,6 +730,14 @@ struct st_maria_handler
void *index_cond_func_arg; /* parameter for the func */
};
+/* Table options for the Aria and S3 storage engine */
+
+struct ha_table_option_struct
+{
+ ulonglong s3_block_size;
+ uint compression_algorithm;
+};
+
/* Some defines used by maria-functions */
#define USE_WHOLE_KEY 65535 /* Use whole key in _search() */
diff --git a/storage/maria/maria_ftdump.c b/storage/maria/maria_ftdump.c
index 75ff9bd2642..01dcbd90837 100644
--- a/storage/maria/maria_ftdump.c
+++ b/storage/maria/maria_ftdump.c
@@ -88,7 +88,7 @@ int main(int argc,char *argv[])
MARIA_KEY_BLOCK_LENGTH, 0, MY_WME);
if (!(info=maria_open(argv[0], O_RDONLY,
- HA_OPEN_ABORT_IF_LOCKED|HA_OPEN_FROM_SQL_LAYER)))
+ HA_OPEN_ABORT_IF_LOCKED|HA_OPEN_FROM_SQL_LAYER, 0)))
{
error=my_errno;
goto err;
diff --git a/storage/maria/maria_pack.c b/storage/maria/maria_pack.c
index 9ae982a6bd7..fd67dd8bb39 100644
--- a/storage/maria/maria_pack.c
+++ b/storage/maria/maria_pack.c
@@ -404,7 +404,7 @@ static MARIA_HA *open_maria_file(char *name,int mode)
if (!(isam_file=maria_open(name, mode, HA_OPEN_IGNORE_MOVED_STATE |
(opt_wait ? HA_OPEN_WAIT_IF_LOCKED :
- HA_OPEN_ABORT_IF_LOCKED))))
+ HA_OPEN_ABORT_IF_LOCKED), 0)))
{
fprintf(stderr, "%s gave error %d on open\n", name, my_errno);
DBUG_RETURN(0);
diff --git a/storage/maria/s3_func.c b/storage/maria/s3_func.c
new file mode 100644
index 00000000000..b0d23c8b6ac
--- /dev/null
+++ b/storage/maria/s3_func.c
@@ -0,0 +1,1453 @@
+/* Copyright (C) 2019 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
+ 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 02111-1301 USA */
+
+/*
+ Interface function used by S3 storage engine and aria_copy_for_s3
+*/
+
+#include "maria_def.h"
+#include "s3_func.h"
+#include <aria_backup.h>
+#include <mysqld_error.h>
+#include <sql_const.h>
+#include <mysys_err.h>
+#include <mysql_com.h>
+#include <zlib.h>
+
+/* number of '.' to print during a copy in verbose mode */
+#define DISPLAY_WITH 79
+
+static void convert_index_to_s3_format(uchar *header, ulong block_size,
+ int compression);
+static void convert_index_to_disk_format(uchar *header);
+static void convert_frm_to_s3_format(uchar *header);
+static void convert_frm_to_disk_format(uchar *header);
+static int s3_read_frm_from_disk(const char *filename, uchar **to,
+ size_t *to_size);
+
+/* Used by ha_s3.cc and tools to define different protocol options */
+
+static const char *protocol_types[]= {"Auto", "Original", "Amazon", NullS};
+TYPELIB s3_protocol_typelib= {array_elements(protocol_types)-1,"",
+ protocol_types, NULL};
+
+/******************************************************************************
+ Allocations handler for libmarias3
+ To be removed when we do the init allocation in mysqld.cc
+******************************************************************************/
+
+static void *s3_wrap_malloc(size_t size)
+{
+ return my_malloc(size, MYF(MY_WME));
+}
+
+static void *s3_wrap_calloc(size_t nmemb, size_t size)
+{
+ return my_malloc(nmemb * size, MYF(MY_WME | MY_ZEROFILL));
+}
+
+static void *s3_wrap_realloc(void *ptr, size_t size)
+{
+ return my_realloc(ptr, size, MYF(MY_WME | MY_ALLOW_ZERO_PTR));
+}
+
+static char *s3_wrap_strdup(const char *str)
+{
+ return my_strdup(str, MYF(MY_WME));
+}
+
+static void s3_wrap_free(void *ptr)
+{
+ my_free(ptr);
+}
+
+void s3_init_library()
+{
+ ms3_library_init_malloc(s3_wrap_malloc, s3_wrap_free, s3_wrap_realloc,
+ s3_wrap_strdup, s3_wrap_calloc);
+}
+
+void s3_deinit_library()
+{
+ ms3_library_deinit();
+}
+
+/******************************************************************************
+ Functions on S3_INFO and S3_BLOCK
+******************************************************************************/
+
+/*
+ Free memory allocated by s3_get_object
+*/
+
+void s3_free(S3_BLOCK *data)
+{
+ my_free(data->alloc_ptr);
+ data->alloc_ptr= 0;
+}
+
+
+/*
+ Copy a S3_INFO structure
+*/
+
+S3_INFO *s3_info_copy(S3_INFO *old)
+{
+ S3_INFO *to, tmp;
+
+ /* Copy lengths */
+ memcpy(&tmp, old, sizeof(tmp));
+ /* Allocate new buffers */
+ if (!my_multi_malloc(MY_WME, &to, sizeof(S3_INFO),
+ &tmp.access_key.str, old->access_key.length+1,
+ &tmp.secret_key.str, old->secret_key.length+1,
+ &tmp.region.str, old->region.length+1,
+ &tmp.bucket.str, old->bucket.length+1,
+ &tmp.database.str, old->database.length+1,
+ &tmp.table.str, old->table.length+1,
+ NullS))
+ return 0;
+ /* Copy lengths and new pointers to to */
+ memcpy(to, &tmp, sizeof(tmp));
+ /* Copy data */
+ strmov((char*) to->access_key.str, old->access_key.str);
+ strmov((char*) to->secret_key.str, old->secret_key.str);
+ strmov((char*) to->region.str, old->region.str);
+ strmov((char*) to->bucket.str, old->bucket.str);
+ /* Database may not be null terminated */
+ strmake((char*) to->database.str, old->database.str, old->database.length);
+ strmov((char*) to->table.str, old->table.str);
+ return to;
+}
+
+/**
+ Open a connection to s3
+*/
+
+ms3_st *s3_open_connection(S3_INFO *s3)
+{
+ ms3_st *s3_client;
+ if (!(s3_client= ms3_init(s3->access_key.str,
+ s3->secret_key.str,
+ s3->region.str,
+ s3->host_name.str)))
+ {
+ my_printf_error(HA_ERR_NO_SUCH_TABLE,
+ "Can't open connection to S3, error: %d %s", MYF(0),
+ errno, ms3_error(errno));
+ my_errno= HA_ERR_NO_SUCH_TABLE;
+ }
+ if (s3->protocol_version)
+ ms3_set_option(s3_client, MS3_OPT_FORCE_PROTOCOL_VERSION,
+ &s3->protocol_version);
+ return s3_client;
+}
+
+
+/******************************************************************************
+ High level functions to copy tables to and from S3
+******************************************************************************/
+
+/**
+ Create suffix for object name
+ @param to_end end of suffix (from previous call or 000000 at start)
+
+ The suffix is a 6 length '0' prefixed number. If the number
+ gets longer than 6, then it's extended to 7 and more digits.
+*/
+
+static void fix_suffix(char *to_end, ulong nr)
+{
+ char buff[11];
+ uint length= (uint) (int10_to_str(nr, buff, 10) - buff);
+ set_if_smaller(length, 6);
+ strmov(to_end - length, buff);
+}
+
+/**
+ Copy file to 'aws_path' in blocks of block_size
+
+ @return 0 ok
+ @return 1 error. Error message is printed to stderr
+
+ Notes:
+ file is always closed before return
+*/
+
+static my_bool copy_from_file(ms3_st *s3_client, const char *aws_bucket,
+ const char *aws_path,
+ File file, my_off_t start, my_off_t file_end,
+ uchar *block, size_t block_size,
+ my_bool compression, my_bool display)
+{
+ my_off_t pos;
+ char *path_end= strend(aws_path);
+ ulong bnr;
+ my_bool print_done= 0;
+ size_t length;
+
+ for (pos= start, bnr=1 ; pos < file_end ; pos+= length, bnr++)
+ {
+ if ((length= my_pread(file, block, block_size, pos, MYF(MY_WME))) ==
+ MY_FILE_ERROR)
+ goto err;
+ if (length == 0)
+ {
+ my_error(EE_EOFERR, MYF(0), my_filename(file), my_errno);
+ goto err;
+ }
+
+ fix_suffix(path_end, bnr);
+ if (s3_put_object(s3_client, aws_bucket, aws_path, block, length,
+ compression))
+ goto err;
+
+ /* Write up to DISPLAY_WITH number of '.' during copy */
+ if (display &&
+ ((pos + block_size) * DISPLAY_WITH / file_end) >
+ (pos * DISPLAY_WITH/file_end))
+ {
+ fputc('.', stdout); fflush(stdout);
+ print_done= 1;
+ }
+ }
+ if (print_done)
+ {
+ fputc('\n', stdout); fflush(stdout);
+ }
+ my_close(file, MYF(MY_WME));
+ return 0;
+
+err:
+ my_close(file, MYF(MY_WME));
+ if (print_done)
+ {
+ fputc('\n', stdout); fflush(stdout);
+ }
+ return 1;
+}
+
+
+/**
+ Copy an Aria table to S3
+ @param s3_client connection to S3
+ @param aws_bucket Aws bucket
+ @param path Path for Aria table (can be temp table)
+ @param database database name
+ @param table_name table name
+ @param block_size Block size in s3. If 0 then use block size
+ and compression as specified in the .MAI file as
+ specified as part of open.
+ @param compression Compression algorithm (0 = none, 1 = zip)
+ If block size is 0 then use .MAI file.
+ @return 0 ok
+ @return 1 error
+
+ The table will be copied in S3 into the following locations:
+
+ frm file (for discovery):
+ aws_bucket/database/table/frm
+
+ First index block (contains description if the Aria file):
+ aws_bucket/database/table/aria
+
+ Rest of the index file:
+ aws_bucket/database/table/index/block_number
+
+ Data file:
+ aws_bucket/database/table/data/block_number
+
+ block_number is 6 digits decimal number, prefixed with 0
+ (Can be larger than 6 numbers, the prefix is just for nice output)
+
+ frm and base blocks are small (just the needed data).
+ index and blocks are of size 's3_block_size'
+
+ If compression is used, then original block size is s3_block_size
+ but the stored block will be the size of the compressed block.
+*/
+
+int aria_copy_to_s3(ms3_st *s3_client, const char *aws_bucket,
+ const char *path,
+ const char *database, const char *table_name,
+ ulong block_size, my_bool compression,
+ my_bool force, my_bool display, my_bool copy_frm)
+{
+ ARIA_TABLE_CAPABILITIES cap;
+ char aws_path[FN_REFLEN+100];
+ char filename[FN_REFLEN];
+ char *aws_path_end, *end;
+ uchar *alloc_block= 0, *block;
+ ms3_status_st status;
+ File file= -1;
+ my_off_t file_size;
+ size_t frm_length;
+ int error;
+ my_bool frm_created= 0;
+ DBUG_ENTER("aria_copy_to_s3");
+
+ aws_path_end= strxmov(aws_path, database, "/", table_name, NullS);
+ strmov(aws_path_end, "/aria");
+
+ if (!ms3_status(s3_client, aws_bucket, aws_path, &status))
+ {
+ if (!force)
+ {
+ my_printf_error(EE_CANTCREATEFILE, "File %s exists in s3", MYF(0),
+ aws_path);
+ DBUG_RETURN(EE_CANTCREATEFILE);
+ }
+ if ((error= aria_delete_from_s3(s3_client, aws_bucket, database,
+ table_name, display)))
+ DBUG_RETURN(error);
+ }
+
+ if (copy_frm)
+ {
+ /*
+ Copy frm file if it exists
+ We do this first to ensure that .frm always exists. This is needed to
+ ensure that discovery of the table will work.
+ */
+ fn_format(filename, path, "", ".frm", MY_REPLACE_EXT);
+ if (!s3_read_frm_from_disk(filename, &alloc_block, &frm_length))
+ {
+ if (display)
+ printf("Copying frm file %s\n", filename);
+
+ end= strmov(aws_path_end,"/frm");
+ convert_frm_to_s3_format(alloc_block);
+
+ /* Note that frm is not compressed! */
+ if (s3_put_object(s3_client, aws_bucket, aws_path, alloc_block, frm_length,
+ 0))
+ goto err;
+
+ frm_created= 1;
+ my_free(alloc_block);
+ alloc_block= 0;
+ }
+ }
+
+ if (display)
+ printf("Copying aria table: %s.%s to s3\n", database, table_name);
+
+ /* Index file name */
+ fn_format(filename, path, "", ".MAI", MY_REPLACE_EXT);
+ if ((file= my_open(filename,
+ O_RDONLY | O_SHARE | O_NOFOLLOW | O_CLOEXEC,
+ MYF(MY_WME))) < 0)
+ DBUG_RETURN(1);
+ if ((error= aria_get_capabilities(file, &cap)))
+ {
+ fprintf(stderr, "Got error %d when reading Aria header from %s\n",
+ error, path);
+ goto err;
+ }
+ if (cap.transactional || cap.data_file_type != BLOCK_RECORD ||
+ cap.encrypted)
+ {
+ fprintf(stderr,
+ "Aria table %s doesn't match criteria to be copied to S3.\n"
+ "It should be non-transactional and should have row_format page\n",
+ path);
+ goto err;
+ }
+ /*
+ If block size is not specified, use the values specified as part of
+ create
+ */
+ if (block_size == 0)
+ {
+ block_size= cap.s3_block_size;
+ compression= cap.compression;
+ }
+
+ /* Align S3_BLOCK size with table block size */
+ block_size= (block_size/cap.block_size)*cap.block_size;
+
+ /* Allocate block for data + flag for compress header */
+ if (!(alloc_block= (uchar*) my_malloc(block_size+ALIGN_SIZE(1),
+ MYF(MY_WME))))
+ goto err;
+ /* Read/write data here, but with prefix space for compression flag */
+ block= alloc_block+ ALIGN_SIZE(1);
+
+ if (my_pread(file, block, cap.header_size, 0, MYF(MY_WME | MY_FNABP)))
+ goto err;
+
+ strmov(aws_path_end, "/aria");
+
+ if (display)
+ printf("Creating aria table information %s\n", aws_path);
+
+ convert_index_to_s3_format(block, block_size, compression);
+
+ /*
+ The first page is not compressed as we need it to know if the rest is
+ compressed
+ */
+ if (s3_put_object(s3_client, aws_bucket, aws_path, block, cap.header_size,
+ 0 /* no compression */ ))
+ goto err;
+
+ file_size= my_seek(file, 0L, MY_SEEK_END, MYF(0));
+
+ end= strmov(aws_path_end,"/index");
+
+ if (display)
+ printf("Copying index information %s\n", aws_path);
+
+ /* The 000000 will be update with block number by fix_suffix() */
+ end= strmov(end, "/000000");
+
+ error= copy_from_file(s3_client, aws_bucket, aws_path, file, cap.header_size,
+ file_size, block, block_size, compression, display);
+ file= -1;
+ if (error)
+ goto err;
+
+ /* Copy data file */
+ fn_format(filename, path, "", ".MAD", MY_REPLACE_EXT);
+ if ((file= my_open(filename,
+ O_RDONLY | O_SHARE | O_NOFOLLOW | O_CLOEXEC,
+ MYF(MY_WME))) < 0)
+ DBUG_RETURN(1);
+
+ file_size= my_seek(file, 0L, MY_SEEK_END, MYF(0));
+
+ end= strmov(aws_path_end, "/data");
+
+ if (display)
+ printf("Copying data information %s\n", aws_path);
+
+ /* The 000000 will be update with block number by fix_suffix() */
+ end= strmov(end, "/000000");
+
+ error= copy_from_file(s3_client, aws_bucket, aws_path, file, 0, file_size,
+ block, block_size, compression, display);
+ file= -1;
+ if (error)
+ goto err;
+
+ my_free(alloc_block);
+ DBUG_RETURN(0);
+
+err:
+ if (frm_created)
+ {
+ end= strmov(aws_path_end,"/frm");
+ (void) s3_delete_object(s3_client, aws_bucket, aws_path, 0);
+ }
+ if (file >= 0)
+ my_close(file, MYF(0));
+ my_free(alloc_block);
+ DBUG_RETURN(1);
+}
+
+
+/**
+ Copy file to 'aws_path' in blocks of block_size
+
+ @return 0 ok
+ @return 1 error. Error message is printed to stderr
+
+ Notes:
+ file is always closed before return
+*/
+
+static my_bool copy_to_file(ms3_st *s3_client, const char *aws_bucket,
+ char *aws_path, File file, my_off_t start,
+ my_off_t file_end, my_bool compression,
+ my_bool display)
+{
+ my_off_t pos;
+ char *path_end= strend(aws_path);
+ size_t error;
+ ulong bnr;
+ my_bool print_done= 0;
+ S3_BLOCK block;
+ DBUG_ENTER("copy_to_file");
+ DBUG_PRINT("enter", ("path: %s start: %llu end: %llu",
+ aws_path, (ulonglong) start, (ulonglong) file_end));
+
+ for (pos= start, bnr=1 ; pos < file_end ; pos+= block.length, bnr++)
+ {
+ fix_suffix(path_end, bnr);
+ if (s3_get_object(s3_client, aws_bucket, aws_path, &block, compression, 1))
+ goto err;
+
+ error= my_write(file, block.str, block.length, MYF(MY_WME | MY_WME));
+ s3_free(&block);
+ if (error == MY_FILE_ERROR)
+ goto err;
+
+ /* Write up to DISPLAY_WITH number of '.' during copy */
+ if (display &&
+ ((pos + block.length) * DISPLAY_WITH /file_end) >
+ (pos * DISPLAY_WITH/file_end))
+ {
+ fputc('.', stdout); fflush(stdout);
+ print_done= 1;
+ }
+ }
+ if (print_done)
+ {
+ fputc('\n', stdout); fflush(stdout);
+ }
+ my_close(file, MYF(MY_WME));
+ DBUG_RETURN(0);
+
+err:
+ my_close(file, MYF(MY_WME));
+ if (print_done)
+ {
+ fputc('\n', stdout); fflush(stdout);
+ }
+ DBUG_RETURN(1);
+}
+
+
+/**
+ Copy a table from S3 to current directory
+*/
+
+int aria_copy_from_s3(ms3_st *s3_client, const char *aws_bucket,
+ const char *path, const char *database,
+ my_bool compression, my_bool force, my_bool display)
+
+{
+ MARIA_STATE_INFO state;
+ MY_STAT stat_info;
+ char table_name[FN_REFLEN], aws_path[FN_REFLEN+100];
+ char filename[FN_REFLEN];
+ char *aws_path_end, *end;
+ File file= -1;
+ S3_BLOCK block;
+ my_off_t index_file_size, data_file_size;
+ uint offset;
+ int error;
+ DBUG_ENTER("aria_copy_from_s3");
+
+ /* Check if index file exists */
+ fn_format(filename, path, "", ".MAI", MY_REPLACE_EXT);
+ if (!force && my_stat(filename, &stat_info, MYF(0)))
+ {
+ my_printf_error(EE_CANTCREATEFILE, "Table %s already exists on disk",
+ MYF(0), filename);
+ DBUG_RETURN(EE_CANTCREATEFILE);
+ }
+
+ fn_format(table_name, path, "", "", MY_REPLACE_DIR | MY_REPLACE_EXT);
+ block.str= 0;
+
+ aws_path_end= strxmov(aws_path, database, "/", table_name, NullS);
+ strmov(aws_path_end, "/aria");
+
+ if (s3_get_object(s3_client, aws_bucket, aws_path, &block, 0, 0))
+ {
+ my_printf_error(EE_FILENOTFOUND, "Table %s doesn't exist in s3", MYF(0),
+ filename);
+ goto err;
+ }
+ if (block.length < MARIA_STATE_INFO_SIZE)
+ {
+ fprintf(stderr, "Wrong block length for first block: %lu\n",
+ (ulong) block.length);
+ goto err_with_free;
+ }
+
+ if (display)
+ printf("Copying aria table: %s.%s from s3\n", database, table_name);
+
+ /* For offset positions, check _ma_state_info_readlength() */
+ offset= sizeof(state.header) + 4+ LSN_STORE_SIZE*3 + 8*5;
+ index_file_size= mi_sizekorr(block.str + offset);
+ data_file_size= mi_sizekorr(block.str + offset+8);
+
+ if ((file= my_create(filename, 0,
+ O_WRONLY | O_TRUNC | O_NOFOLLOW, MYF(MY_WME))) < 0)
+ goto err_with_free;
+
+ convert_index_to_disk_format(block.str);
+
+ if (my_write(file, block.str, block.length, MYF(MY_WME | MY_FNABP)))
+ goto err_with_free;
+
+ if (display)
+ printf("Copying index information %s\n", aws_path);
+
+ end= strmov(aws_path_end,"/index/000000");
+
+ error= copy_to_file(s3_client, aws_bucket, aws_path, file, block.length,
+ index_file_size, compression, display);
+ file= -1;
+ if (error)
+ goto err_with_free;
+
+ /* Copy data file */
+ fn_format(filename, path, "", ".MAD", MY_REPLACE_EXT);
+ if ((file= my_create(filename, 0,
+ O_WRONLY | O_TRUNC | O_NOFOLLOW, MYF(MY_WME))) < 0)
+ DBUG_RETURN(1);
+
+ end= strmov(aws_path_end, "/data");
+
+ if (display)
+ printf("Copying data information %s\n", aws_path);
+
+ /* The 000000 will be update with block number by fix_suffix() */
+ strmov(end, "/000000");
+
+ error= copy_to_file(s3_client, aws_bucket, aws_path, file, 0, data_file_size,
+ compression, display);
+ file= -1;
+ s3_free(&block);
+ block.str= 0;
+ if (error)
+ goto err;
+
+ /* Copy frm file if it exists */
+ strmov(aws_path_end, "/frm");
+ if (!s3_get_object(s3_client, aws_bucket, aws_path, &block, 0, 0))
+ {
+ fn_format(filename, path, "", ".frm", MY_REPLACE_EXT);
+ if ((file= my_create(filename, 0,
+ O_WRONLY | O_SHARE | O_NOFOLLOW | O_CLOEXEC,
+ MYF(0))) >= 0)
+ {
+ if (display)
+ printf("Copying frm file %s\n", filename);
+
+ convert_frm_to_disk_format(block.str);
+
+ if (my_write(file, block.str, block.length, MYF(MY_WME | MY_FNABP)))
+ goto err_with_free;
+ }
+ s3_free(&block);
+ my_close(file, MYF(MY_WME));
+ file= -1;
+ }
+
+ DBUG_RETURN(0);
+
+err_with_free:
+ s3_free(&block);
+err:
+ if (file >= 0)
+ my_close(file, MYF(0));
+ DBUG_RETURN(1);
+}
+
+
+/**
+ Drop all files related to a table from S3
+*/
+
+int aria_delete_from_s3(ms3_st *s3_client, const char *aws_bucket,
+ const char *database, const char *table,
+ my_bool display)
+{
+ ms3_status_st status;
+ char aws_path[FN_REFLEN+100];
+ char *aws_path_end;
+ int error;
+ DBUG_ENTER("aria_delete_from_s3");
+
+ aws_path_end= strxmov(aws_path, database, "/", table, NullS);
+ strmov(aws_path_end, "/aria");
+
+ /* Check if either /aria or /frm exists */
+
+ if (ms3_status(s3_client, aws_bucket, aws_path, &status))
+ {
+ strmov(aws_path_end, "/frm");
+ if (ms3_status(s3_client, aws_bucket, aws_path, &status))
+ {
+ my_printf_error(HA_ERR_NO_SUCH_TABLE,
+ "Table %s.%s doesn't exist in s3", MYF(0),
+ database, table);
+ my_errno= HA_ERR_NO_SUCH_TABLE;
+ DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
+ }
+ }
+
+ if (display)
+ printf("Delete of aria table: %s.%s\n", database, table);
+
+ strmov(aws_path_end,"/index");
+
+ if (display)
+ printf("Delete of index information %s\n", aws_path);
+
+ error= s3_delete_directory(s3_client, aws_bucket, aws_path);
+
+ strmov(aws_path_end,"/data");
+ if (display)
+ printf("Delete of data information %s\n", aws_path);
+
+ error|= s3_delete_directory(s3_client, aws_bucket, aws_path);
+
+ if (display)
+ printf("Delete of base information and frm\n");
+
+ strmov(aws_path_end,"/aria");
+ if (s3_delete_object(s3_client, aws_bucket, aws_path, 1))
+ error= 1;
+
+ /*
+ Delete .frm last as this is used by discovery to check if a s3 table
+ exists
+ */
+ strmov(aws_path_end,"/frm");
+ /* Ignore error if .frm file doesn't exist */
+ s3_delete_object(s3_client, aws_bucket, aws_path, 0);
+
+ DBUG_RETURN(error);
+}
+
+
+/**
+ Rename a table in s3
+*/
+
+
+int aria_rename_s3(ms3_st *s3_client, const char *aws_bucket,
+ const char *from_database, const char *from_table,
+ const char *to_database, const char *to_table,
+ my_bool rename_frm)
+{
+ ms3_status_st status;
+ char to_aws_path[FN_REFLEN+100], from_aws_path[FN_REFLEN+100];
+ char *to_aws_path_end, *from_aws_path_end;
+ int error;
+ DBUG_ENTER("aria_rename_s3");
+
+ from_aws_path_end= strxmov(from_aws_path, from_database, "/", from_table,
+ NullS);
+ to_aws_path_end= strxmov(to_aws_path, to_database, "/", to_table, NullS);
+ strmov(from_aws_path_end, "/aria");
+
+ if (ms3_status(s3_client, aws_bucket, from_aws_path, &status))
+ {
+ my_printf_error(HA_ERR_NO_SUCH_TABLE,
+ "Table %s.%s doesn't exist in s3", MYF(0), from_database,
+ from_table);
+ my_errno= HA_ERR_NO_SUCH_TABLE;
+ DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
+ }
+
+ strmov(from_aws_path_end,"/index");
+ strmov(to_aws_path_end,"/index");
+
+ error= s3_rename_directory(s3_client, aws_bucket, from_aws_path, to_aws_path,
+ 1);
+
+ strmov(from_aws_path_end,"/data");
+ strmov(to_aws_path_end,"/data");
+
+ error|= s3_rename_directory(s3_client, aws_bucket, from_aws_path,
+ to_aws_path, 1);
+
+ if (rename_frm) {
+ strmov(from_aws_path_end, "/frm");
+ strmov(to_aws_path_end, "/frm");
+
+ s3_rename_object(s3_client, aws_bucket, from_aws_path, to_aws_path, 1);
+ }
+
+ strmov(from_aws_path_end,"/aria");
+ strmov(to_aws_path_end,"/aria");
+ if (s3_rename_object(s3_client, aws_bucket, from_aws_path, to_aws_path, 1))
+ error= 1;
+ DBUG_RETURN(error);
+}
+
+
+/******************************************************************************
+ Low level functions interfacing with libmarias3
+******************************************************************************/
+
+/**
+ Create an object for index or data information
+
+ Note that if compression is used, the data may be overwritten and
+ there must be COMPRESS_HEADER length of free space before the data!
+
+*/
+
+my_bool s3_put_object(ms3_st *s3_client, const char *aws_bucket,
+ const char *name, uchar *data, size_t length,
+ my_bool compression)
+{
+ uint8_t error;
+ const char *errmsg;
+ DBUG_ENTER("s3_put_object");
+ DBUG_PRINT("enter", ("name: %s", name));
+
+ if (compression)
+ {
+ size_t comp_len;
+
+ data[-COMPRESS_HEADER]= 0; // No compression
+ if (!my_compress(data, &length, &comp_len))
+ data[-COMPRESS_HEADER]= 1; // Compressed package
+ data-= COMPRESS_HEADER;
+ length+= COMPRESS_HEADER;
+ int3store(data+1, comp_len); // Original length or 0
+ }
+
+ if (likely(!(error= ms3_put(s3_client, aws_bucket, name, data, length))))
+ DBUG_RETURN(FALSE);
+
+ if (!(errmsg= ms3_server_error(s3_client)))
+ errmsg= ms3_error(error);
+
+ my_printf_error(EE_WRITE, "Got error from put_object(%s): %d %s", MYF(0),
+ name, error, errmsg);
+ DBUG_RETURN(TRUE);
+}
+
+
+/**
+ Read an object for index or data information
+*/
+
+my_bool s3_get_object(ms3_st *s3_client, const char *aws_bucket,
+ const char *name, S3_BLOCK *block,
+ my_bool compression, my_bool print_error)
+{
+ uint8_t error;
+ uchar *data;
+ DBUG_ENTER("s3_get_object");
+ DBUG_PRINT("enter", ("name: %s compression: %d", name, compression));
+
+ block->str= block->alloc_ptr= 0;
+ if (likely(!(error= ms3_get(s3_client, aws_bucket, name,
+ (uint8_t**) &block->alloc_ptr,
+ &block->length))))
+ {
+ block->str= block->alloc_ptr;
+ if (compression)
+ {
+ size_t length;
+
+ /* If not compressed */
+ if (!block->str[0])
+ {
+ block->length-= COMPRESS_HEADER;
+ block->str+= COMPRESS_HEADER;
+
+ /* Simple check to ensure that it's a correct block */
+ if (block->length % 1024)
+ {
+ s3_free(block);
+ my_printf_error(HA_ERR_NOT_A_TABLE,
+ "Block '%s' is not compressed", MYF(0), name);
+ DBUG_RETURN(TRUE);
+ }
+ DBUG_RETURN(FALSE);
+ }
+
+ if (((uchar*)block->str)[0] > 1)
+ {
+ s3_free(block);
+ my_printf_error(HA_ERR_NOT_A_TABLE,
+ "Block '%s' is not compressed", MYF(0), name);
+ DBUG_RETURN(TRUE);
+ }
+
+ length= uint3korr(block->str+1);
+
+ if (!(data= (uchar*) my_malloc(length, MYF(MY_WME | MY_THREAD_SPECIFIC))))
+ {
+ s3_free(block);
+ DBUG_RETURN(TRUE);
+ }
+ if (uncompress(data, &length, block->str + COMPRESS_HEADER,
+ block->length - COMPRESS_HEADER))
+ {
+ my_printf_error(ER_NET_UNCOMPRESS_ERROR,
+ "Got error uncompressing s3 packet", MYF(0));
+ s3_free(block);
+ my_free(data);
+ DBUG_RETURN(TRUE);
+ }
+ s3_free(block);
+ block->str= block->alloc_ptr= data;
+ block->length= length;
+ }
+ DBUG_RETURN(FALSE);
+ }
+ if (print_error)
+ {
+ if (error == 9)
+ {
+ my_printf_error(EE_FILENOTFOUND, "Expected object '%s' didn't exist",
+ MYF(0), name);
+ my_errno= EE_FILENOTFOUND;
+ }
+ else
+ {
+ const char *errmsg;
+ if (!(errmsg= ms3_server_error(s3_client)))
+ errmsg= ms3_error(error);
+
+ my_printf_error(EE_READ, "Got error from get_object(%s): %d %s", MYF(0),
+ name, error, errmsg);
+ my_errno= EE_READ;
+ }
+ }
+ s3_free(block);
+ DBUG_RETURN(TRUE);
+}
+
+
+my_bool s3_delete_object(ms3_st *s3_client, const char *aws_bucket,
+ const char *name, my_bool print_error)
+{
+ uint8_t error;
+ DBUG_ENTER("s3_delete_object");
+ DBUG_PRINT("enter", ("name: %s", name));
+
+ if (likely(!(error= ms3_delete(s3_client, aws_bucket, name))))
+ DBUG_RETURN(FALSE);
+
+ if (print_error)
+ {
+ if (error == 9)
+ my_printf_error(EE_FILENOTFOUND, "Expected object '%s' didn't exist",
+ MYF(0), name);
+ else
+ {
+ const char *errmsg;
+ if (!(errmsg= ms3_server_error(s3_client)))
+ errmsg= ms3_error(error);
+
+ my_printf_error(EE_READ, "Got error from delete_object(%s): %d %s",
+ MYF(0), name, error, errmsg);
+ }
+ }
+ DBUG_RETURN(TRUE);
+}
+
+
+/*
+ Drop all files in a 'directory' in s3
+*/
+
+int s3_delete_directory(ms3_st *s3_client, const char *aws_bucket,
+ const char *path)
+{
+ ms3_list_st *list, *org_list= 0;
+ my_bool error;
+ DBUG_ENTER("delete_directory");
+ DBUG_PRINT("enter", ("path: %s", path));
+
+ if ((error= ms3_list(s3_client, aws_bucket, path, &org_list)))
+ {
+ const char *errmsg;
+ if (!(errmsg= ms3_server_error(s3_client)))
+ errmsg= ms3_error(error);
+
+ my_printf_error(EE_FILENOTFOUND,
+ "Can't get list of files from %s. Error: %d %s", MYF(0),
+ path, error, errmsg);
+ DBUG_RETURN(EE_FILENOTFOUND);
+ }
+
+ for (list= org_list ; list ; list= list->next)
+ if (s3_delete_object(s3_client, aws_bucket, list->key, 1))
+ error= 1;
+ if (org_list)
+ ms3_list_free(org_list);
+ DBUG_RETURN(error);
+}
+
+
+my_bool s3_rename_object(ms3_st *s3_client, const char *aws_bucket,
+ const char *from_name, const char *to_name,
+ my_bool print_error)
+{
+ uint8_t error;
+ DBUG_ENTER("s3_rename_object");
+ DBUG_PRINT("enter", ("from: %s to: %s", from_name, to_name));
+
+ if (likely(!(error= ms3_move(s3_client,
+ aws_bucket, from_name,
+ aws_bucket, to_name))))
+ DBUG_RETURN(FALSE);
+
+ if (print_error)
+ {
+ if (error == 9)
+ {
+ my_printf_error(EE_FILENOTFOUND, "Expected object '%s' didn't exist",
+ MYF(0), from_name);
+ }
+ else
+ {
+ const char *errmsg;
+ if (!(errmsg= ms3_server_error(s3_client)))
+ errmsg= ms3_error(error);
+
+ my_printf_error(EE_READ, "Got error from move_object(%s -> %s): %d %",
+ MYF(0),
+ from_name, to_name, error, errmsg);
+ }
+ }
+ DBUG_RETURN(TRUE);
+}
+
+
+int s3_rename_directory(ms3_st *s3_client, const char *aws_bucket,
+ const char *from_name, const char *to_name,
+ my_bool print_error)
+{
+ ms3_list_st *list, *org_list= 0;
+ my_bool error= 0;
+ char name[AWS_PATH_LENGTH], *end;
+ DBUG_ENTER("s3_delete_directory");
+
+ if ((error= ms3_list(s3_client, aws_bucket, from_name, &org_list)))
+ {
+ const char *errmsg;
+ if (!(errmsg= ms3_server_error(s3_client)))
+ errmsg= ms3_error(error);
+
+ my_printf_error(EE_FILENOTFOUND,
+ "Can't get list of files from %s. Error: %d %s", MYF(0),
+ from_name, error, errmsg);
+ DBUG_RETURN(EE_FILENOTFOUND);
+ }
+
+ end= strmov(name, to_name);
+ for (list= org_list ; list ; list= list->next)
+ {
+ const char *sep= strrchr(list->key, '/');
+ if (sep) /* Safety */
+ {
+ strmake(end, sep, (sizeof(name) - (end-name) - 1));
+ if (s3_rename_object(s3_client, aws_bucket, list->key, name,
+ print_error))
+ error= 1;
+ }
+ }
+ if (org_list)
+ ms3_list_free(org_list);
+ DBUG_RETURN(error);
+}
+
+
+/******************************************************************************
+ Converting index and frm files to from S3 storage engine
+******************************************************************************/
+
+/**
+ Change index information to be of type s3
+
+ @param header Copy of header in index file
+ @param block_size S3 block size
+ @param compression Compression algorithm to use
+
+ The position are from _ma_base_info_write()
+*/
+
+static void convert_index_to_s3_format(uchar *header, ulong block_size,
+ int compression)
+{
+ MARIA_STATE_INFO state;
+ uchar *base_pos;
+ uint base_offset;
+
+ memcpy(state.header.file_version, header, sizeof(state.header));
+ base_offset= mi_uint2korr(state.header.base_pos);
+ base_pos= header + base_offset;
+
+ base_pos[107]= (uchar) compression;
+ mi_int3store(base_pos+119, block_size);
+}
+
+
+/**
+ Change index information to be a normal disk based table
+*/
+
+static void convert_index_to_disk_format(uchar *header)
+{
+ MARIA_STATE_INFO state;
+ uchar *base_pos;
+ uint base_offset;
+
+ memcpy(state.header.file_version, header, sizeof(state.header));
+ base_offset= mi_uint2korr(state.header.base_pos);
+ base_pos= header + base_offset;
+
+ base_pos[107]= 0;
+ mi_int3store(base_pos+119, 0);
+}
+
+/**
+ Change storage engine in the .frm file from Aria to s3
+
+ For information about engine types, see legacy_db_type
+*/
+
+static void convert_frm_to_s3_format(uchar *header)
+{
+ DBUG_ASSERT(header[3] == 42 || header[3] == 41); /* Aria or S3 */
+ header[3]= 41; /* S3 */
+}
+
+/**
+ Change storage engine in the .frm file from S3 to Aria
+
+ For information about engine types, see legacy_db_type
+*/
+
+static void convert_frm_to_disk_format(uchar *header)
+{
+ DBUG_ASSERT(header[3] == 41); /* S3 */
+ header[3]= 42; /* Aria */
+}
+
+
+/******************************************************************************
+ Helper functions
+******************************************************************************/
+
+/**
+ Set database and table name from path
+
+ s3->database and s3->table_name will be pointed into path
+ Note that s3->database will not be null terminated!
+*/
+
+my_bool set_database_and_table_from_path(S3_INFO *s3, const char *path)
+{
+ size_t org_length= dirname_length(path);
+ size_t length= 0;
+
+ if (!org_length)
+ return 1;
+
+ s3->table.str= path+org_length;
+ s3->table.length= strlen(s3->table.str);
+ for (length= --org_length; length > 0 ; length --)
+ {
+ if (path[length-1] == FN_LIBCHAR || path[length-1] == '/')
+ break;
+#ifdef FN_DEVCHAR
+ if (path[length-1] == FN_DECVHAR)
+ break;
+#endif
+ }
+ if (length &&
+ (path[length] != FN_CURLIB || org_length - length != 1))
+ {
+ s3->database.str= path + length;
+ s3->database.length= org_length - length;
+ return 0;
+ }
+ return 1; /* Can't find database */
+}
+
+
+/**
+ Read frm from the disk
+*/
+
+static int s3_read_frm_from_disk(const char *filename, uchar **to,
+ size_t *to_size)
+{
+ File file;
+ uchar *alloc_block;
+ size_t file_size;
+
+ *to= 0;
+ if ((file= my_open(filename,
+ O_RDONLY | O_SHARE | O_NOFOLLOW | O_CLOEXEC,
+ MYF(MY_WME))) < 0)
+ return(1);
+
+ file_size= (size_t) my_seek(file, 0L, MY_SEEK_END, MYF(0));
+ if (!(alloc_block= my_malloc(file_size, MYF(MY_WME))))
+ goto err;
+
+ if (my_pread(file, alloc_block, file_size, 0, MYF(MY_WME | MY_FNABP)))
+ goto err;
+
+ *to= alloc_block;
+ *to_size= file_size;
+ my_close(file, MYF(0));
+ return 0;
+
+err:
+ my_free(alloc_block);
+ my_close(file, MYF(0));
+ return 1;
+}
+
+
+/**
+ Get .frm from S3
+
+ @return 0 ok
+ @return 1 error
+*/
+
+my_bool s3_get_frm(ms3_st *s3_client, S3_INFO *s3_info, S3_BLOCK *block)
+{
+ char aws_path[AWS_PATH_LENGTH];
+
+ strxnmov(aws_path, sizeof(aws_path)-1, s3_info->database.str, "/",
+ s3_info->table.str, "/frm", NullS);
+
+ return s3_get_object(s3_client, s3_info->bucket.str, aws_path, block,
+ 0, 0);
+}
+
+/**
+ Check if .frm exits in S3
+
+ @return 0 frm exists
+ @return 1 error
+*/
+
+my_bool s3_frm_exists(ms3_st *s3_client, S3_INFO *s3_info)
+{
+ char aws_path[AWS_PATH_LENGTH];
+ ms3_status_st status;
+
+ strxnmov(aws_path, sizeof(aws_path)-1, s3_info->database.str, "/",
+ s3_info->table.str, "/frm", NullS);
+
+ return ms3_status(s3_client, s3_info->bucket.str, aws_path, &status);
+}
+
+
+/**
+ Get version from frm file
+
+ @param out Store the table_version_here. It's of size MY_UUID_SIZE
+ @param frm_image Frm image
+ @param frm_length size of image
+
+ @return 0 Was able to read table version
+ @return 1 Wrong information in frm file
+*/
+
+#define FRM_HEADER_SIZE 64
+#define EXTRA2_TABLEDEF_VERSION 0
+
+static inline my_bool is_binary_frm_header(const uchar *head)
+{
+ return head[0] == 254
+ && head[1] == 1
+ && head[2] >= FRM_VER
+ && head[2] <= FRM_VER_CURRENT;
+}
+
+static my_bool get_tabledef_version_from_frm(char *out, const uchar *frm_image,
+ size_t frm_length)
+{
+ uint segment_len;
+ const uchar *extra, *extra_end;
+ if (!is_binary_frm_header(frm_image) || frm_length <= FRM_HEADER_SIZE)
+ return 1;
+
+ /* Length of the MariaDB extra2 segment in the form file. */
+ segment_len= uint2korr(frm_image + 4);
+ if (frm_length < FRM_HEADER_SIZE + segment_len)
+ return 1;
+
+ extra= frm_image + FRM_HEADER_SIZE;
+ if (*extra == '/') // old frm had '/' there
+ return 1;
+
+ extra_end= extra + segment_len;
+ while (extra + 4 < extra_end)
+ {
+ uchar type= *extra++;
+ size_t length= *extra++;
+ if (!length)
+ {
+ length= uint2korr(extra);
+ extra+= 2;
+ if (length < 256)
+ return 1; /* Something is wrong */
+ }
+ if (extra + length > extra_end)
+ return 1;
+ if (type == EXTRA2_TABLEDEF_VERSION)
+ {
+ if (length != MY_UUID_SIZE)
+ return 1;
+ memcpy(out, extra, length);
+ return 0; /* Found it */
+ }
+ extra+= length;
+ }
+ return 1;
+}
+
+
+/**
+ Check if version in frm file matches what the server expects
+
+ @return 0 table definitions matches
+ @return 1 table definitions doesn't match
+ @return 2 Can't find the frm version
+ @return 3 Can't read the frm version
+*/
+
+int s3_check_frm_version(ms3_st *s3_client, S3_INFO *s3_info)
+{
+ my_bool res= 0;
+ char aws_path[AWS_PATH_LENGTH];
+ char uuid[MY_UUID_SIZE];
+ S3_BLOCK block;
+
+ strxnmov(aws_path, sizeof(aws_path)-1, s3_info->database.str, "/",
+ s3_info->table.str, "/frm", NullS);
+
+ if (s3_get_object(s3_client, s3_info->bucket.str, aws_path, &block, 0, 0))
+ return 2; /* Ignore check, use old frm */
+
+ if (get_tabledef_version_from_frm(uuid, (uchar*) block.str, block.length) ||
+ s3_info->tabledef_version.length != MY_UUID_SIZE)
+ {
+ s3_free(&block);
+ return 3; /* Wrong definition */
+ }
+ /* res is set to 1 if versions numbers doesn't match */
+ res= bcmp(s3_info->tabledef_version.str, uuid, MY_UUID_SIZE) != 0;
+ s3_free(&block);
+ return res;
+}
+
+
+/******************************************************************************
+ Reading blocks from index or data from S3
+******************************************************************************/
+
+/*
+ Read the index header (first page) from the index file
+
+ In case of error, my_error() is called
+*/
+
+my_bool read_index_header(ms3_st *client, S3_INFO *s3, S3_BLOCK *block)
+{
+ char aws_path[AWS_PATH_LENGTH];
+ DBUG_ENTER("read_index_header");
+ strxnmov(aws_path, sizeof(aws_path)-1, s3->database.str, "/", s3->table.str,
+ "/aria", NullS);
+ DBUG_RETURN(s3_get_object(client, s3->bucket.str, aws_path, block, 0, 1));
+}
+
+
+#ifdef FOR_FUTURE_IF_NEEDED_FOR_DEBUGGING_WITHOUT_S3
+/**
+ Read a big block from disk
+*/
+
+my_bool s3_block_read(struct st_pagecache *pagecache,
+ PAGECACHE_IO_HOOK_ARGS *args,
+ struct st_pagecache_file *file,
+ LEX_STRING *data)
+{
+ MARIA_SHARE *share= (MARIA_SHARE*) file->callback_data;
+ my_bool datafile= file != &share->kfile;
+
+ DBUG_ASSERT(file->big_block_size > 0);
+ DBUG_ASSERT(((((my_off_t) args->pageno - file->head_blocks) <<
+ pagecache->shift) %
+ file->big_block_size) == 0);
+
+ if (!(data->str= (char *) my_malloc(file->big_block_size, MYF(MY_WME))))
+ return TRUE;
+
+ data->length= mysql_file_pread(file->file,
+ (unsigned char *)data->str,
+ file->big_block_size,
+ ((my_off_t) args->pageno << pagecache->shift),
+ MYF(MY_WME));
+ if (data->length == 0 || data->length == MY_FILE_ERROR)
+ {
+ if (data->length == 0)
+ {
+ LEX_STRING *file_name= (datafile ?
+ &share->data_file_name :
+ &share->index_file_name);
+ my_error(EE_EOFERR, MYF(0), file_name->str, my_errno);
+ }
+ my_free(data->str);
+ data->length= 0;
+ data->str= 0;
+ return TRUE;
+ }
+ return FALSE;
+}
+#endif
+
+
+/**
+ Read a block from S3 to page cache
+*/
+
+my_bool s3_block_read(struct st_pagecache *pagecache,
+ PAGECACHE_IO_HOOK_ARGS *args,
+ struct st_pagecache_file *file,
+ S3_BLOCK *block)
+{
+ char aws_path[AWS_PATH_LENGTH];
+ MARIA_SHARE *share= (MARIA_SHARE*) file->callback_data;
+ my_bool datafile= file->file != share->kfile.file;
+ MARIA_HA *info= (MARIA_HA*) my_thread_var->keycache_file;
+ ms3_st *client= info->s3;
+ const char *path_suffix= datafile ? "/data/" : "/index/";
+ char *end;
+ S3_INFO *s3= share->s3_path;
+ ulong block_number;
+ DBUG_ENTER("s3_block_read");
+
+ DBUG_ASSERT(file->big_block_size > 0);
+ DBUG_ASSERT(((((my_off_t) args->pageno - file->head_blocks) <<
+ pagecache->shift) %
+ file->big_block_size) == 0);
+
+ block_number= (((args->pageno - file->head_blocks) << pagecache->shift) /
+ file->big_block_size) + 1;
+
+ end= strxnmov(aws_path, sizeof(aws_path)-12, s3->database.str, "/",
+ s3->table.str, path_suffix, "000000", NullS);
+ fix_suffix(end, block_number);
+
+ DBUG_RETURN(s3_get_object(client, s3->bucket.str, aws_path, block,
+ share->base.compression_algorithm, 1));
+}
+
+/*
+ Start file numbers from 1000 to more easily find bugs when the file number
+ could be mistaken for a real file
+*/
+static volatile int32 unique_file_number= 1000;
+
+int32 s3_unique_file_number()
+{
+ return my_atomic_add32_explicit(&unique_file_number, 1,
+ MY_MEMORY_ORDER_RELAXED);
+}
diff --git a/storage/maria/s3_func.h b/storage/maria/s3_func.h
new file mode 100644
index 00000000000..6f01d9ee56d
--- /dev/null
+++ b/storage/maria/s3_func.h
@@ -0,0 +1,118 @@
+#ifndef S3_FUNC_INCLUDED
+#define S3_FUNC_INCLUDED
+/* Copyright (C) 2019 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
+ 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 02111-1301 USA */
+
+/*
+ Interface function used by S3 storage engine and aria_copy_for_s3
+*/
+
+#ifdef WITH_S3_STORAGE_ENGINE
+C_MODE_START
+#include <libmarias3/marias3.h>
+
+#define DEFAULT_AWS_HOST_NAME "s3.amazonaws.com"
+
+extern TYPELIB s3_protocol_typelib;
+
+/* Store information about a s3 connection */
+
+typedef struct s3_info
+{
+ LEX_CSTRING access_key, secret_key, region, bucket, host_name;
+
+ /* The following will be filled in by maria_open() */
+ LEX_CSTRING database, table;
+
+ /* Sent to open to verify version */
+ LEX_CUSTRING tabledef_version;
+
+ /* Protocol for the list bucket API call. 1 for Amazon, 2 for some others */
+ uint8_t protocol_version;
+} S3_INFO;
+
+
+/* flag + length is stored in this header */
+#define COMPRESS_HEADER 4
+
+/* Max length of an AWS PATH */
+#define AWS_PATH_LENGTH ((NAME_LEN)*3+3+10+6+11)
+
+void s3_init_library(void);
+void s3_deinit_library(void);
+int aria_copy_to_s3(ms3_st *s3_client, const char *aws_bucket,
+ const char *path,
+ const char *database, const char *table_name,
+ ulong block_size, my_bool compression,
+ my_bool force, my_bool display, my_bool copy_frm);
+int aria_copy_from_s3(ms3_st *s3_client, const char *aws_bucket,
+ const char *path,const char *database,
+ my_bool compression, my_bool force, my_bool display);
+int aria_delete_from_s3(ms3_st *s3_client, const char *aws_bucket,
+ const char *database, const char *table,
+ my_bool display);
+int aria_rename_s3(ms3_st *s3_client, const char *aws_bucket,
+ const char *from_database, const char *from_table,
+ const char *to_database, const char *to_table,
+ my_bool rename_frm);
+ms3_st *s3_open_connection(S3_INFO *s3);
+my_bool s3_put_object(ms3_st *s3_client, const char *aws_bucket,
+ const char *name, uchar *data, size_t length,
+ my_bool compression);
+my_bool s3_get_object(ms3_st *s3_client, const char *aws_bucket,
+ const char *name, S3_BLOCK *block, my_bool compression,
+ my_bool print_error);
+my_bool s3_delete_object(ms3_st *s3_client, const char *aws_bucket,
+ const char *name, my_bool print_error);
+my_bool s3_rename_object(ms3_st *s3_client, const char *aws_bucket,
+ const char *from_name, const char *to_name,
+ my_bool print_error);
+void s3_free(S3_BLOCK *data);
+my_bool s3_copy_from_file(ms3_st *s3_client, const char *aws_bucket,
+ char *aws_path, File file, my_off_t start,
+ my_off_t file_end, uchar *block, size_t block_size,
+ my_bool compression, my_bool display);
+my_bool s3_copy_to_file(ms3_st *s3_client, const char *aws_bucket,
+ char *aws_path, File file, my_off_t start,
+ my_off_t file_end, my_bool compression,
+ my_bool display);
+int s3_delete_directory(ms3_st *s3_client, const char *aws_bucket,
+ const char *path);
+int s3_rename_directory(ms3_st *s3_client, const char *aws_bucket,
+ const char *from_name, const char *to_name,
+ my_bool print_error);
+
+S3_INFO *s3_info_copy(S3_INFO *old);
+my_bool set_database_and_table_from_path(S3_INFO *s3, const char *path);
+my_bool s3_get_frm(ms3_st *s3_client, S3_INFO *S3_info, S3_BLOCK *block);
+my_bool s3_frm_exists(ms3_st *s3_client, S3_INFO *s3_info);
+int s3_check_frm_version(ms3_st *s3_client, S3_INFO *s3_info);
+my_bool read_index_header(ms3_st *client, S3_INFO *s3, S3_BLOCK *block);
+int32 s3_unique_file_number(void);
+my_bool s3_block_read(struct st_pagecache *pagecache,
+ PAGECACHE_IO_HOOK_ARGS *args,
+ struct st_pagecache_file *file,
+ S3_BLOCK *block);
+C_MODE_END
+#else
+
+C_MODE_START
+/* Dummy structures and interfaces to be used when compiling without S3 */
+struct s3_info;
+typedef struct s3_info S3_INFO;
+struct ms3_st;
+C_MODE_END
+#endif /* WITH_S3_STORAGE_ENGINE */
+#endif /* HA_S3_FUNC_INCLUDED */
diff --git a/storage/maria/test_aria_s3_copy.sh b/storage/maria/test_aria_s3_copy.sh
new file mode 100755
index 00000000000..ad39df69de2
--- /dev/null
+++ b/storage/maria/test_aria_s3_copy.sh
@@ -0,0 +1,56 @@
+#!/bin/bash
+
+#
+# Note that this test expact that there are tables test1 and test2 in
+# the current directory where test2 has also a .frm file
+#
+
+TMPDIR=tmpdir
+LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib64/
+
+my_cmp()
+{
+ if ! cmp $1 $TMPDIR/$1
+ then
+ echo "aborting"
+ exit 1;
+ fi
+}
+
+run_test()
+{
+ OPT=$1;
+ echo "******* Running test with options '$OPT' **********"
+ rm -rf $TMPDIR
+ mkdir $TMPDIR
+ cp test?.* $TMPDIR
+ if ! ./aria_s3_copy --op=to --force $OPT test1 test2
+ then
+ echo Got error $?
+ exit 1;
+ fi
+ rm test?.*
+ if ! ./aria_s3_copy --op=from $OPT test1 test2
+ then
+ echo Got error $?
+ exit 1;
+ fi
+ if ! ./aria_s3_copy --op=delete $OPT test1 test2
+ then
+ echo Got error $?
+ exit 1;
+ fi
+ my_cmp test1.MAI
+ my_cmp test1.MAD
+ my_cmp test2.MAI
+ my_cmp test2.MAD
+ my_cmp test2.frm
+ rm test?.*
+ cp $TMPDIR/* .
+ rm -r $TMPDIR
+}
+
+run_test ""
+run_test "--s3_block_size=64K --compress"
+run_test "--s3_block_size=4M"
+echo "ok"
diff --git a/storage/maria/test_ma_backup.c b/storage/maria/test_ma_backup.c
index 2a9a6704ecb..4d0599dfc46 100644
--- a/storage/maria/test_ma_backup.c
+++ b/storage/maria/test_ma_backup.c
@@ -315,7 +315,7 @@ static int create_test_table(const char *table_name, int type_of_table)
uniques, &uniquedef, &create_info,
create_flag))
goto err;
- if (!(file=maria_open(table_name,2,HA_OPEN_ABORT_IF_LOCKED)))
+ if (!(file=maria_open(table_name,2,HA_OPEN_ABORT_IF_LOCKED, 0)))
goto err;
if (!silent)
printf("- Writing key:s\n");
diff --git a/storage/mroonga/ha_mroonga.cpp b/storage/mroonga/ha_mroonga.cpp
index 8638399717e..aeb2770c6af 100644
--- a/storage/mroonga/ha_mroonga.cpp
+++ b/storage/mroonga/ha_mroonga.cpp
@@ -1271,37 +1271,15 @@ static struct st_mysql_information_schema i_s_info =
MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION
};
+namespace Show {
static ST_FIELD_INFO i_s_mrn_stats_fields_info[] =
{
- {
- "VERSION",
- 40,
- MYSQL_TYPE_STRING,
- 0,
- 0,
- "",
- SKIP_OPEN_TABLE
- },
- {
- "rows_written",
- MY_INT32_NUM_DECIMAL_DIGITS,
- MYSQL_TYPE_LONG,
- 0,
- 0,
- "Rows written to Groonga",
- SKIP_OPEN_TABLE
- },
- {
- "rows_read",
- MY_INT32_NUM_DECIMAL_DIGITS,
- MYSQL_TYPE_LONG,
- 0,
- 0,
- "Rows read from Groonga",
- SKIP_OPEN_TABLE
- },
- { 0, 0, MYSQL_TYPE_NULL, 0, 0, 0, 0}
+ Column("VERSION", Varchar(40), NOT_NULL),
+ Column("rows_written", SLong(), NOT_NULL, "Rows written to Groonga"),
+ Column("rows_read", SLong(), NOT_NULL, "Rows read from Groonga"),
+ CEnd()
};
+} // namespace Show
static int i_s_mrn_stats_deinit(void* p)
{
@@ -1330,7 +1308,7 @@ static int i_s_mrn_stats_init(void* p)
{
MRN_DBUG_ENTER_FUNCTION();
ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
- schema->fields_info = i_s_mrn_stats_fields_info;
+ schema->fields_info = Show::i_s_mrn_stats_fields_info;
schema->fill_table = i_s_mrn_stats_fill;
DBUG_RETURN(0);
}
@@ -1377,11 +1355,10 @@ static void mrn_drop_database(handlerton *hton, char *path)
static int mrn_close_connection(handlerton *hton, THD *thd)
{
MRN_DBUG_ENTER_FUNCTION();
- void *p = *thd_ha_data(thd, mrn_hton_ptr);
+ void *p = thd_get_ha_data(thd, mrn_hton_ptr);
if (p) {
mrn_clear_slot_data(thd);
free(p);
- *thd_ha_data(thd, mrn_hton_ptr) = (void *) NULL;
{
mrn::Lock lock(&mrn_allocated_thds_mutex);
my_hash_delete(&mrn_allocated_thds, (uchar*) thd);
@@ -1807,7 +1784,6 @@ static int mrn_init(void *p)
// init handlerton
grn_ctx *ctx = NULL;
handlerton *hton = static_cast<handlerton *>(p);
- hton->state = SHOW_OPTION_YES;
hton->create = mrn_handler_create;
hton->flags = HTON_NO_FLAGS;
#ifndef MRN_SUPPORT_PARTITION
@@ -2040,7 +2016,7 @@ static int mrn_deinit(void *p)
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;
+ thd_set_ha_data(tmp_thd, mrn_hton_ptr, 0);
my_hash_delete(&mrn_allocated_thds, (uchar *) tmp_thd);
}
}
@@ -6113,7 +6089,7 @@ int ha_mroonga::storage_write_row(const uchar *buf)
#ifdef MRN_HAVE_SPATIAL
bool is_null_geometry_value =
field->real_type() == MYSQL_TYPE_GEOMETRY &&
- static_cast<Field_geom *>(field)->get_length() == 0;
+ static_cast<Field_blob *>(field)->get_length() == 0;
if (is_null_geometry_value) {
continue;
}
@@ -10756,7 +10732,7 @@ int ha_mroonga::generic_store_bulk_geometry(Field *field, grn_obj *buf)
int error = 0;
#ifdef MRN_HAVE_SPATIAL
String buffer;
- Field_geom *geometry = (Field_geom *)field;
+ Field_blob *geometry = (Field_blob *)field;
String *value = geometry->val_str(0, &buffer);
const char *wkb = value->ptr();
int len = value->length();
@@ -11226,7 +11202,7 @@ void ha_mroonga::storage_store_field_geometry(Field *field,
String *geometry_buffer = &blob_buffers[field->field_index];
geometry_buffer->length(0);
uint wkb_length = sizeof(wkb) / sizeof(*wkb);
- Field_geom *geometry = (Field_geom *)field;
+ Field_blob *geometry= (Field_blob *)field;
geometry_buffer->reserve(wkb_length);
geometry_buffer->q_append((const char *) wkb, wkb_length);
geometry->set_ptr((uint32) wkb_length, (uchar *) geometry_buffer->ptr());
@@ -15518,34 +15494,6 @@ bool ha_mroonga::commit_inplace_alter_table(
}
DBUG_RETURN(result);
}
-
-void ha_mroonga::wrapper_notify_table_changed()
-{
- MRN_DBUG_ENTER_METHOD();
- MRN_SET_WRAP_SHARE_KEY(share, table->s);
- MRN_SET_WRAP_TABLE_KEY(this, table);
- wrap_handler->ha_notify_table_changed();
- MRN_SET_BASE_SHARE_KEY(share, table->s);
- MRN_SET_BASE_TABLE_KEY(this, table);
- DBUG_VOID_RETURN;
-}
-
-void ha_mroonga::storage_notify_table_changed()
-{
- MRN_DBUG_ENTER_METHOD();
- DBUG_VOID_RETURN;
-}
-
-void ha_mroonga::notify_table_changed()
-{
- MRN_DBUG_ENTER_METHOD();
- if (share->wrapper_mode) {
- wrapper_notify_table_changed();
- } else {
- storage_notify_table_changed();
- }
- DBUG_VOID_RETURN;
-}
#else
alter_table_operations ha_mroonga::wrapper_alter_table_flags(alter_table_operations flags)
{
diff --git a/storage/mroonga/ha_mroonga.hpp b/storage/mroonga/ha_mroonga.hpp
index 20626742bb7..4e3f4bec17c 100644
--- a/storage/mroonga/ha_mroonga.hpp
+++ b/storage/mroonga/ha_mroonga.hpp
@@ -646,7 +646,6 @@ protected:
bool commit_inplace_alter_table(TABLE *altered_table,
Alter_inplace_info *ha_alter_info,
bool commit) mrn_override;
- void notify_table_changed() mrn_override;
#endif
private:
@@ -1206,8 +1205,6 @@ private:
bool storage_commit_inplace_alter_table(TABLE *altered_table,
Alter_inplace_info *ha_alter_info,
bool commit);
- void wrapper_notify_table_changed();
- void storage_notify_table_changed();
#else
alter_table_operations wrapper_alter_table_flags(alter_table_operations flags);
alter_table_operations storage_alter_table_flags(alter_table_operations flags);
diff --git a/storage/mroonga/mrn_table.cpp b/storage/mroonga/mrn_table.cpp
index 09bac98c153..b10668cfcce 100644
--- a/storage/mroonga/mrn_table.cpp
+++ b/storage/mroonga/mrn_table.cpp
@@ -1140,7 +1140,7 @@ st_mrn_slot_data *mrn_get_slot_data(THD *thd, bool can_create)
{
MRN_DBUG_ENTER_FUNCTION();
st_mrn_slot_data *slot_data =
- (st_mrn_slot_data*) *thd_ha_data(thd, mrn_hton_ptr);
+ (st_mrn_slot_data*) thd_get_ha_data(thd, mrn_hton_ptr);
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;
@@ -1149,7 +1149,7 @@ st_mrn_slot_data *mrn_get_slot_data(THD *thd, bool can_create)
slot_data->disable_keys_create_info = NULL;
slot_data->alter_connect_string = NULL;
slot_data->alter_comment = NULL;
- *thd_ha_data(thd, mrn_hton_ptr) = (void *) slot_data;
+ thd_set_ha_data(thd, mrn_hton_ptr, slot_data);
{
mrn::Lock lock(&mrn_allocated_thds_mutex);
if (my_hash_insert(&mrn_allocated_thds, (uchar*) thd))
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/i_s.result b/storage/mroonga/mysql-test/mroonga/storage/r/i_s.result
new file mode 100644
index 00000000000..b403eccf1ab
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/i_s.result
@@ -0,0 +1,7 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.MROONGA_STATS;
+Table Create Table
+Mroonga_stats CREATE TEMPORARY TABLE `Mroonga_stats` (
+ `VERSION` varchar(40) NOT NULL DEFAULT '',
+ `rows_written` int(11) NOT NULL DEFAULT 0,
+ `rows_read` int(11) NOT NULL DEFAULT 0
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/i_s.test b/storage/mroonga/mysql-test/mroonga/storage/t/i_s.test
new file mode 100644
index 00000000000..fdb8e205b38
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/i_s.test
@@ -0,0 +1,23 @@
+# Copyright (c) 2019, MariaDB
+# Copyright(C) 2014 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
+
+--source include/not_embedded.inc
+--source ../../include/mroonga/have_mroonga.inc
+
+SHOW CREATE TABLE INFORMATION_SCHEMA.MROONGA_STATS;
+
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
index bde9c99288f..78c5e58de76 100644
--- a/storage/myisam/ha_myisam.cc
+++ b/storage/myisam/ha_myisam.cc
@@ -886,8 +886,9 @@ int ha_myisam::open(const char *name, int mode, uint test_if_locked)
the full row to ensure we don't get any errors from valgrind and
that all bytes in the row is properly reset.
*/
- if ((file->s->options & HA_OPTION_PACK_RECORD) &&
- (file->s->has_varchar_fields | file->s->has_null_fields))
+ if (!(file->s->options &
+ (HA_OPTION_PACK_RECORD | HA_OPTION_COMPRESS_RECORD)) &&
+ (file->s->has_varchar_fields || file->s->has_null_fields))
int_table_flags|= HA_RECORD_MUST_BE_CLEAN_ON_WRITE;
for (i= 0; i < table->s->keys; i++)
@@ -2493,7 +2494,6 @@ static int myisam_init(void *p)
myisam_block_size=(uint) 1 << my_bit_log2(opt_myisam_block_size);
hton= (handlerton *)p;
- hton->state= SHOW_OPTION_YES;
hton->db_type= DB_TYPE_MYISAM;
hton->create= myisam_create_handler;
hton->panic= myisam_panic;
diff --git a/storage/myisam/mi_create.c b/storage/myisam/mi_create.c
index fd230698acc..c91c1af5f60 100644
--- a/storage/myisam/mi_create.c
+++ b/storage/myisam/mi_create.c
@@ -46,7 +46,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
uint aligned_key_start, block_length, res;
uint internal_table= flags & HA_CREATE_INTERNAL_TABLE;
ulong reclength, real_reclength,min_pack_length;
- char kfilename[FN_REFLEN],klinkname[FN_REFLEN], *klinkname_ptr;
+ char kfilename[FN_REFLEN],klinkname[FN_REFLEN], *klinkname_ptr= 0;
char dfilename[FN_REFLEN],dlinkname[FN_REFLEN], *dlinkname_ptr= 0;
ulong pack_reclength;
ulonglong tot_length,max_rows, tmp;
diff --git a/storage/myisam/myisamdef.h b/storage/myisam/myisamdef.h
index c6fa777774a..3b036b5f4a4 100644
--- a/storage/myisam/myisamdef.h
+++ b/storage/myisam/myisamdef.h
@@ -612,7 +612,24 @@ typedef struct st_mi_block_info /* Parameter to _mi_get_block_info */
uint offset;
} MI_BLOCK_INFO;
- /* bits in return from _mi_get_block_info */
+
+typedef struct st_sort_key_blocks /* Used when sorting */
+{
+ uchar *buff, *end_pos;
+ uchar lastkey[HA_MAX_POSSIBLE_KEY_BUFF];
+ uint last_length;
+ int inited;
+} SORT_KEY_BLOCKS;
+
+
+typedef struct st_sort_ftbuf
+{
+ uchar *buf, *end;
+ int count;
+ uchar lastkey[HA_MAX_KEY_BUFF];
+} SORT_FT_BUF;
+
+/* bits in return from _mi_get_block_info */
#define BLOCK_FIRST 1U
#define BLOCK_LAST 2U
diff --git a/storage/oqgraph/ha_oqgraph.cc b/storage/oqgraph/ha_oqgraph.cc
index fd715c57a1f..20ebd49bd5d 100644
--- a/storage/oqgraph/ha_oqgraph.cc
+++ b/storage/oqgraph/ha_oqgraph.cc
@@ -179,7 +179,6 @@ static int oqgraph_init(void *p)
handlerton *hton= (handlerton *)p;
DBUG_PRINT( "oq-debug", ("oqgraph_init"));
- hton->state= SHOW_OPTION_YES;
hton->db_type= DB_TYPE_AUTOASSIGN;
hton->create= oqgraph_create_handler;
hton->flags= HTON_ALTER_NOT_SUPPORTED;
diff --git a/storage/perfschema/ha_perfschema.cc b/storage/perfschema/ha_perfschema.cc
index 50d7a3aa468..51047561748 100644
--- a/storage/perfschema/ha_perfschema.cc
+++ b/storage/perfschema/ha_perfschema.cc
@@ -83,7 +83,6 @@ static int pfs_init_func(void *p)
pfs_hton= reinterpret_cast<handlerton *> (p);
- pfs_hton->state= SHOW_OPTION_YES;
pfs_hton->create= pfs_create_handler;
pfs_hton->show_status= pfs_show_status;
pfs_hton->flags= HTON_ALTER_NOT_SUPPORTED |
diff --git a/storage/perfschema/pfs_defaults.cc b/storage/perfschema/pfs_defaults.cc
index 4171786ea68..194877e0e38 100644
--- a/storage/perfschema/pfs_defaults.cc
+++ b/storage/perfschema/pfs_defaults.cc
@@ -42,17 +42,17 @@ void install_default_setup(PSI_bootstrap *boot)
/* LF_HASH needs a thread, for PINS */
psi->set_thread(psi_thread);
- String percent("%", 1, &my_charset_utf8_bin);
+ String percent("%", 1, &my_charset_utf8mb3_bin);
/* Enable all users on all hosts by default */
insert_setup_actor(&percent, &percent, &percent);
/* Disable system tables by default */
- String mysql_db("mysql", 5, &my_charset_utf8_bin);
+ String mysql_db("mysql", 5, &my_charset_utf8mb3_bin);
insert_setup_object(OBJECT_TYPE_TABLE, &mysql_db, &percent, false, false);
/* Disable performance/information schema tables. */
- String PS_db("performance_schema", 18, &my_charset_utf8_bin);
- String IS_db("information_schema", 18, &my_charset_utf8_bin);
+ String PS_db("performance_schema", 18, &my_charset_utf8mb3_bin);
+ String IS_db("information_schema", 18, &my_charset_utf8mb3_bin);
insert_setup_object(OBJECT_TYPE_TABLE, &PS_db, &percent, false, false);
insert_setup_object(OBJECT_TYPE_TABLE, &IS_db, &percent, false, false);
diff --git a/storage/perfschema/pfs_engine_table.cc b/storage/perfschema/pfs_engine_table.cc
index 380818cf025..ed378de5b06 100644
--- a/storage/perfschema/pfs_engine_table.cc
+++ b/storage/perfschema/pfs_engine_table.cc
@@ -368,7 +368,7 @@ void PFS_engine_table::set_field_char_utf8(Field *f, const char* str,
{
DBUG_ASSERT(f->real_type() == MYSQL_TYPE_STRING);
Field_string *f2= (Field_string*) f;
- f2->store(str, len, &my_charset_utf8_bin);
+ f2->store(str, len, &my_charset_utf8mb3_bin);
}
void PFS_engine_table::set_field_varchar_utf8(Field *f, const char* str,
@@ -376,7 +376,7 @@ void PFS_engine_table::set_field_varchar_utf8(Field *f, const char* str,
{
DBUG_ASSERT(f->real_type() == MYSQL_TYPE_VARCHAR);
Field_varstring *f2= (Field_varstring*) f;
- f2->store(str, len, &my_charset_utf8_bin);
+ f2->store(str, len, &my_charset_utf8mb3_bin);
}
void PFS_engine_table::set_field_longtext_utf8(Field *f, const char* str,
@@ -384,7 +384,7 @@ void PFS_engine_table::set_field_longtext_utf8(Field *f, const char* str,
{
DBUG_ASSERT(f->real_type() == MYSQL_TYPE_BLOB);
Field_blob *f2= (Field_blob*) f;
- f2->store(str, len, &my_charset_utf8_bin);
+ f2->store(str, len, &my_charset_utf8mb3_bin);
}
void PFS_engine_table::set_field_enum(Field *f, ulonglong value)
diff --git a/storage/perfschema/table_session_connect.cc b/storage/perfschema/table_session_connect.cc
index 74b953b034e..b296726ef79 100644
--- a/storage/perfschema/table_session_connect.cc
+++ b/storage/perfschema/table_session_connect.cc
@@ -73,7 +73,7 @@ bool parse_length_encoded_string(const char **ptr,
if (*ptr - start_ptr + data_length > input_length)
return true;
- copy_length= copier.well_formed_copy(&my_charset_utf8_bin, dest, dest_size,
+ copy_length= copier.well_formed_copy(&my_charset_utf8mb3_bin, dest, dest_size,
from_cs, *ptr, data_length, nchars_max);
*copied_len= copy_length;
(*ptr)+= data_length;
diff --git a/storage/perfschema/table_setup_actors.cc b/storage/perfschema/table_setup_actors.cc
index 1ff1ac8c412..ada69942651 100644
--- a/storage/perfschema/table_setup_actors.cc
+++ b/storage/perfschema/table_setup_actors.cc
@@ -56,9 +56,9 @@ int table_setup_actors::write_row(TABLE *table, const unsigned char *buf,
Field **fields)
{
Field *f;
- String user_data("%", 1, &my_charset_utf8_bin);
- String host_data("%", 1, &my_charset_utf8_bin);
- String role_data("%", 1, &my_charset_utf8_bin);
+ String user_data("%", 1, &my_charset_utf8mb3_bin);
+ String host_data("%", 1, &my_charset_utf8mb3_bin);
+ String role_data("%", 1, &my_charset_utf8mb3_bin);
String *user= &user_data;
String *host= &host_data;
String *role= &role_data;
@@ -248,7 +248,7 @@ int table_setup_actors::delete_row_values(TABLE *table,
{
DBUG_ASSERT(m_row_exists);
- CHARSET_INFO *cs= &my_charset_utf8_bin;
+ CHARSET_INFO *cs= &my_charset_utf8mb3_bin;
String user(m_row.m_username, m_row.m_username_length, cs);
String role(m_row.m_rolename, m_row.m_rolename_length, cs);
String host(m_row.m_hostname, m_row.m_hostname_length, cs);
diff --git a/storage/perfschema/table_setup_objects.cc b/storage/perfschema/table_setup_objects.cc
index c3f3e01f933..60ea72d5724 100644
--- a/storage/perfschema/table_setup_objects.cc
+++ b/storage/perfschema/table_setup_objects.cc
@@ -72,8 +72,8 @@ int table_setup_objects::write_row(TABLE *table, const unsigned char *buf,
int result;
Field *f;
enum_object_type object_type= OBJECT_TYPE_TABLE;
- String object_schema_data("%", 1, &my_charset_utf8_bin);
- String object_name_data("%", 1, &my_charset_utf8_bin);
+ String object_schema_data("%", 1, &my_charset_utf8mb3_bin);
+ String object_name_data("%", 1, &my_charset_utf8mb3_bin);
String *object_schema= &object_schema_data;
String *object_name= &object_name_data;
enum_yes_no enabled_value= ENUM_YES;
@@ -312,7 +312,7 @@ int table_setup_objects::delete_row_values(TABLE *table,
{
DBUG_ASSERT(m_row_exists);
- CHARSET_INFO *cs= &my_charset_utf8_bin;
+ CHARSET_INFO *cs= &my_charset_utf8mb3_bin;
enum_object_type object_type= OBJECT_TYPE_TABLE;
String object_schema(m_row.m_schema_name, m_row.m_schema_name_length, cs);
String object_name(m_row.m_object_name, m_row.m_object_name_length, cs);
diff --git a/storage/perfschema/unittest/pfs_connect_attr-t.cc b/storage/perfschema/unittest/pfs_connect_attr-t.cc
index 3dd62ca5662..c0adabc18bc 100644
--- a/storage/perfschema/unittest/pfs_connect_attr-t.cc
+++ b/storage/perfschema/unittest/pfs_connect_attr-t.cc
@@ -40,7 +40,7 @@ void test_blob_parser()
unsigned char packet[10000], *ptr;
uint name_len, value_len, idx, packet_length;
bool result;
- const CHARSET_INFO *cs= &my_charset_utf8_bin;
+ const CHARSET_INFO *cs= &my_charset_utf8mb3_bin;
diag("test_blob_parser");
@@ -157,7 +157,7 @@ void test_multibyte_lengths()
char name[100], value[4096];
uint name_len, value_len;
bool result;
- const CHARSET_INFO *cs= &my_charset_utf8_bin;
+ const CHARSET_INFO *cs= &my_charset_utf8mb3_bin;
unsigned char var_len_packet[] = {
252, 2, 0, 'k', '1',
@@ -190,7 +190,7 @@ void test_utf8_parser()
char name[33 * 6], value[1024 * 6], packet[1500 * 6], *ptr;
uint name_len, value_len;
bool result;
- const CHARSET_INFO *cs= &my_charset_utf8_bin;
+ const CHARSET_INFO *cs= &my_charset_utf8mb3_bin;
/* note : this is encoded in utf-8 */
const char *attr1= "Георги";
@@ -242,7 +242,7 @@ void test_utf8_parser_bad_encoding()
char name[33 * 3], value[1024 * 3], packet[1500 * 3], *ptr;
uint name_len, value_len;
bool result;
- const CHARSET_INFO *cs= &my_charset_utf8_bin;
+ const CHARSET_INFO *cs= &my_charset_utf8mb3_bin;
/* note : this is encoded in utf-8 */
const char *attr= "Георги";
diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc
index a95e22be7ce..60d28481669 100644
--- a/storage/rocksdb/ha_rocksdb.cc
+++ b/storage/rocksdb/ha_rocksdb.cc
@@ -5268,7 +5268,6 @@ static int rocksdb_init_func(void *const p) {
&rdb_block_cache_resize_mutex, MY_MUTEX_INIT_FAST);
Rdb_transaction::init_mutex();
- rocksdb_hton->state = SHOW_OPTION_YES;
rocksdb_hton->create = rocksdb_create_handler;
rocksdb_hton->close_connection = rocksdb_close_connection;
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/i_s.result b/storage/rocksdb/mysql-test/rocksdb/r/i_s.result
new file mode 100644
index 00000000000..84671b765b6
--- /dev/null
+++ b/storage/rocksdb/mysql-test/rocksdb/r/i_s.result
@@ -0,0 +1,159 @@
+SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
+WHERE TABLE_SCHEMA='INFORMATION_SCHEMA'
+ AND TABLE_NAME LIKE 'ROCKSDB%'
+ ORDER BY TABLE_NAME;
+TABLE_NAME
+ROCKSDB_CFSTATS
+ROCKSDB_CF_OPTIONS
+ROCKSDB_COMPACTION_STATS
+ROCKSDB_DBSTATS
+ROCKSDB_DDL
+ROCKSDB_DEADLOCK
+ROCKSDB_GLOBAL_INFO
+ROCKSDB_INDEX_FILE_MAP
+ROCKSDB_LOCKS
+ROCKSDB_PERF_CONTEXT
+ROCKSDB_PERF_CONTEXT_GLOBAL
+ROCKSDB_SST_PROPS
+ROCKSDB_TRX
+SHOW CREATE TABLE INFORMATION_SCHEMA.ROCKSDB_CF_OPTIONS;
+Table Create Table
+ROCKSDB_CF_OPTIONS CREATE TEMPORARY TABLE `ROCKSDB_CF_OPTIONS` (
+ `CF_NAME` varchar(193) NOT NULL DEFAULT '',
+ `OPTION_TYPE` varchar(193) NOT NULL DEFAULT '',
+ `VALUE` varchar(193) NOT NULL DEFAULT ''
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
+SHOW CREATE TABLE INFORMATION_SCHEMA.ROCKSDB_CFSTATS;
+Table Create Table
+ROCKSDB_CFSTATS CREATE TEMPORARY TABLE `ROCKSDB_CFSTATS` (
+ `CF_NAME` varchar(193) NOT NULL DEFAULT '',
+ `STAT_TYPE` varchar(193) NOT NULL DEFAULT '',
+ `VALUE` bigint(21) NOT NULL DEFAULT 0
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
+SHOW CREATE TABLE INFORMATION_SCHEMA.ROCKSDB_COMPACTION_STATS;
+Table Create Table
+ROCKSDB_COMPACTION_STATS CREATE TEMPORARY TABLE `ROCKSDB_COMPACTION_STATS` (
+ `CF_NAME` varchar(193) NOT NULL DEFAULT '',
+ `LEVEL` varchar(513) NOT NULL DEFAULT '',
+ `TYPE` varchar(513) NOT NULL DEFAULT '',
+ `VALUE` double NOT NULL DEFAULT 0
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
+SHOW CREATE TABLE INFORMATION_SCHEMA.ROCKSDB_DBSTATS;
+Table Create Table
+ROCKSDB_DBSTATS CREATE TEMPORARY TABLE `ROCKSDB_DBSTATS` (
+ `STAT_TYPE` varchar(193) NOT NULL DEFAULT '',
+ `VALUE` bigint(21) NOT NULL DEFAULT 0
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
+SHOW CREATE TABLE INFORMATION_SCHEMA.ROCKSDB_DDL;
+Table Create Table
+ROCKSDB_DDL CREATE TEMPORARY TABLE `ROCKSDB_DDL` (
+ `TABLE_SCHEMA` varchar(193) NOT NULL DEFAULT '',
+ `TABLE_NAME` varchar(193) NOT NULL DEFAULT '',
+ `PARTITION_NAME` varchar(193) DEFAULT NULL,
+ `INDEX_NAME` varchar(193) NOT NULL DEFAULT '',
+ `COLUMN_FAMILY` int(11) NOT NULL DEFAULT 0,
+ `INDEX_NUMBER` int(11) NOT NULL DEFAULT 0,
+ `INDEX_TYPE` smallint(6) NOT NULL DEFAULT 0,
+ `KV_FORMAT_VERSION` smallint(6) NOT NULL DEFAULT 0,
+ `TTL_DURATION` bigint(21) NOT NULL DEFAULT 0,
+ `INDEX_FLAGS` bigint(21) NOT NULL DEFAULT 0,
+ `CF` varchar(193) NOT NULL DEFAULT '',
+ `AUTO_INCREMENT` bigint(21) unsigned DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
+SHOW CREATE TABLE INFORMATION_SCHEMA.ROCKSDB_DEADLOCK;
+Table Create Table
+ROCKSDB_DEADLOCK CREATE TEMPORARY TABLE `ROCKSDB_DEADLOCK` (
+ `DEADLOCK_ID` bigint(21) NOT NULL DEFAULT 0,
+ `TIMESTAMP` bigint(21) NOT NULL DEFAULT 0,
+ `TRANSACTION_ID` bigint(21) NOT NULL DEFAULT 0,
+ `CF_NAME` varchar(193) NOT NULL DEFAULT '',
+ `WAITING_KEY` varchar(513) NOT NULL DEFAULT '',
+ `LOCK_TYPE` varchar(193) NOT NULL DEFAULT '',
+ `INDEX_NAME` varchar(193) NOT NULL DEFAULT '',
+ `TABLE_NAME` varchar(193) NOT NULL DEFAULT '',
+ `ROLLED_BACK` bigint(21) NOT NULL DEFAULT 0
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
+SHOW CREATE TABLE INFORMATION_SCHEMA.ROCKSDB_GLOBAL_INFO;
+Table Create Table
+ROCKSDB_GLOBAL_INFO CREATE TEMPORARY TABLE `ROCKSDB_GLOBAL_INFO` (
+ `TYPE` varchar(513) NOT NULL DEFAULT '',
+ `NAME` varchar(513) NOT NULL DEFAULT '',
+ `VALUE` varchar(513) NOT NULL DEFAULT ''
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
+SHOW CREATE TABLE INFORMATION_SCHEMA.ROCKSDB_INDEX_FILE_MAP;
+Table Create Table
+ROCKSDB_INDEX_FILE_MAP CREATE TEMPORARY TABLE `ROCKSDB_INDEX_FILE_MAP` (
+ `COLUMN_FAMILY` int(11) NOT NULL DEFAULT 0,
+ `INDEX_NUMBER` int(11) NOT NULL DEFAULT 0,
+ `SST_NAME` varchar(193) NOT NULL DEFAULT '',
+ `NUM_ROWS` bigint(21) NOT NULL DEFAULT 0,
+ `DATA_SIZE` bigint(21) NOT NULL DEFAULT 0,
+ `ENTRY_DELETES` bigint(21) NOT NULL DEFAULT 0,
+ `ENTRY_SINGLEDELETES` bigint(21) NOT NULL DEFAULT 0,
+ `ENTRY_MERGES` bigint(21) NOT NULL DEFAULT 0,
+ `ENTRY_OTHERS` bigint(21) NOT NULL DEFAULT 0,
+ `DISTINCT_KEYS_PREFIX` varchar(800) NOT NULL DEFAULT ''
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
+SHOW CREATE TABLE INFORMATION_SCHEMA.ROCKSDB_LOCKS;
+Table Create Table
+ROCKSDB_LOCKS CREATE TEMPORARY TABLE `ROCKSDB_LOCKS` (
+ `COLUMN_FAMILY_ID` int(11) NOT NULL DEFAULT 0,
+ `TRANSACTION_ID` int(11) NOT NULL DEFAULT 0,
+ `KEY` varchar(513) NOT NULL DEFAULT '',
+ `MODE` varchar(32) NOT NULL DEFAULT ''
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
+SHOW CREATE TABLE INFORMATION_SCHEMA.ROCKSDB_PERF_CONTEXT;
+Table Create Table
+ROCKSDB_PERF_CONTEXT CREATE TEMPORARY TABLE `ROCKSDB_PERF_CONTEXT` (
+ `TABLE_SCHEMA` varchar(193) NOT NULL DEFAULT '',
+ `TABLE_NAME` varchar(193) NOT NULL DEFAULT '',
+ `PARTITION_NAME` varchar(193) DEFAULT NULL,
+ `STAT_TYPE` varchar(193) NOT NULL DEFAULT '',
+ `VALUE` bigint(21) NOT NULL DEFAULT 0
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
+SHOW CREATE TABLE INFORMATION_SCHEMA.ROCKSDB_PERF_CONTEXT_GLOBAL;
+Table Create Table
+ROCKSDB_PERF_CONTEXT_GLOBAL CREATE TEMPORARY TABLE `ROCKSDB_PERF_CONTEXT_GLOBAL` (
+ `STAT_TYPE` varchar(193) NOT NULL DEFAULT '',
+ `VALUE` bigint(21) NOT NULL DEFAULT 0
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
+SHOW CREATE TABLE INFORMATION_SCHEMA.ROCKSDB_SST_PROPS;
+Table Create Table
+ROCKSDB_SST_PROPS CREATE TEMPORARY TABLE `ROCKSDB_SST_PROPS` (
+ `SST_NAME` varchar(193) NOT NULL DEFAULT '',
+ `COLUMN_FAMILY` int(11) NOT NULL DEFAULT 0,
+ `DATA_BLOCKS` bigint(21) NOT NULL DEFAULT 0,
+ `ENTRIES` bigint(21) NOT NULL DEFAULT 0,
+ `RAW_KEY_SIZE` bigint(21) NOT NULL DEFAULT 0,
+ `RAW_VALUE_SIZE` bigint(21) NOT NULL DEFAULT 0,
+ `DATA_BLOCK_SIZE` bigint(21) NOT NULL DEFAULT 0,
+ `INDEX_BLOCK_SIZE` bigint(21) NOT NULL DEFAULT 0,
+ `INDEX_PARTITIONS` int(11) NOT NULL DEFAULT 0,
+ `TOP_LEVEL_INDEX_SIZE` bigint(21) NOT NULL DEFAULT 0,
+ `FILTER_BLOCK_SIZE` bigint(21) NOT NULL DEFAULT 0,
+ `COMPRESSION_ALGO` varchar(193) NOT NULL DEFAULT '',
+ `CREATION_TIME` bigint(21) NOT NULL DEFAULT 0,
+ `FILE_CREATION_TIME` bigint(21) NOT NULL DEFAULT 0,
+ `OLDEST_KEY_TIME` bigint(21) NOT NULL DEFAULT 0,
+ `FILTER_POLICY` varchar(193) NOT NULL DEFAULT '',
+ `COMPRESSION_OPTIONS` varchar(193) NOT NULL DEFAULT ''
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
+SHOW CREATE TABLE INFORMATION_SCHEMA.ROCKSDB_TRX;
+Table Create Table
+ROCKSDB_TRX CREATE TEMPORARY TABLE `ROCKSDB_TRX` (
+ `TRANSACTION_ID` bigint(21) NOT NULL DEFAULT 0,
+ `STATE` varchar(193) NOT NULL DEFAULT '',
+ `NAME` varchar(193) NOT NULL DEFAULT '',
+ `WRITE_COUNT` bigint(21) NOT NULL DEFAULT 0,
+ `LOCK_COUNT` bigint(21) NOT NULL DEFAULT 0,
+ `TIMEOUT_SEC` int(11) NOT NULL DEFAULT 0,
+ `WAITING_KEY` varchar(513) NOT NULL DEFAULT '',
+ `WAITING_COLUMN_FAMILY_ID` int(11) NOT NULL DEFAULT 0,
+ `IS_REPLICATION` int(11) NOT NULL DEFAULT 0,
+ `SKIP_TRX_API` int(11) NOT NULL DEFAULT 0,
+ `READ_ONLY` int(11) NOT NULL DEFAULT 0,
+ `HAS_DEADLOCK_DETECTION` int(11) NOT NULL DEFAULT 0,
+ `NUM_ONGOING_BULKLOAD` int(11) NOT NULL DEFAULT 0,
+ `THREAD_ID` int(11) NOT NULL DEFAULT 0,
+ `QUERY` varchar(193) NOT NULL DEFAULT ''
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/i_s_deadlock.result b/storage/rocksdb/mysql-test/rocksdb/r/i_s_deadlock.result
index 3ec9294e3a1..0419c0f3ec6 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/i_s_deadlock.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/i_s_deadlock.result
@@ -13,15 +13,15 @@ connection default;
show create table information_schema.rocksdb_deadlock;
Table Create Table
ROCKSDB_DEADLOCK CREATE TEMPORARY TABLE `ROCKSDB_DEADLOCK` (
- `DEADLOCK_ID` bigint(8) NOT NULL DEFAULT 0,
- `TIMESTAMP` bigint(8) NOT NULL DEFAULT 0,
- `TRANSACTION_ID` bigint(8) NOT NULL DEFAULT 0,
+ `DEADLOCK_ID` bigint(21) NOT NULL DEFAULT 0,
+ `TIMESTAMP` bigint(21) NOT NULL DEFAULT 0,
+ `TRANSACTION_ID` bigint(21) NOT NULL DEFAULT 0,
`CF_NAME` varchar(193) NOT NULL DEFAULT '',
`WAITING_KEY` varchar(513) NOT NULL DEFAULT '',
`LOCK_TYPE` varchar(193) NOT NULL DEFAULT '',
`INDEX_NAME` varchar(193) NOT NULL DEFAULT '',
`TABLE_NAME` varchar(193) NOT NULL DEFAULT '',
- `ROLLED_BACK` bigint(8) NOT NULL DEFAULT 0
+ `ROLLED_BACK` bigint(21) NOT NULL DEFAULT 0
) ENGINE=MEMORY DEFAULT CHARSET=utf8
create table t (i int primary key) engine=rocksdb;
insert into t values (1), (2), (3);
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/innodb_i_s_tables_disabled.result b/storage/rocksdb/mysql-test/rocksdb/r/innodb_i_s_tables_disabled.result
index cb31847cdd8..9bf35793159 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/innodb_i_s_tables_disabled.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/innodb_i_s_tables_disabled.result
@@ -17,257 +17,256 @@ page_size buffer_pool_instance pages_used pages_free relocation_ops relocation_t
SELECT * FROM INFORMATION_SCHEMA.INNODB_CMPMEM_RESET;
page_size buffer_pool_instance pages_used pages_free relocation_ops relocation_time
SELECT * FROM INFORMATION_SCHEMA.INNODB_METRICS;
-NAME SUBSYSTEM COUNT MAX_COUNT MIN_COUNT AVG_COUNT COUNT_RESET MAX_COUNT_RESET MIN_COUNT_RESET AVG_COUNT_RESET TIME_ENABLED TIME_DISABLED TIME_ELAPSED TIME_RESET STATUS TYPE COMMENT
-metadata_table_handles_opened metadata 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of table handles opened
-metadata_table_handles_closed metadata 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of table handles closed
-metadata_table_reference_count metadata 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Table reference counter
-lock_deadlocks lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of deadlocks
-lock_timeouts lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of lock timeouts
-lock_rec_lock_waits lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times enqueued into record lock wait queue
-lock_table_lock_waits lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times enqueued into table lock wait queue
-lock_rec_lock_requests lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of record locks requested
-lock_rec_lock_created lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of record locks created
-lock_rec_lock_removed lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of record locks removed from the lock queue
-lock_rec_locks lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Current number of record locks on tables
-lock_table_lock_created lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of table locks created
-lock_table_lock_removed lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of table locks removed from the lock queue
-lock_table_locks lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Current number of table locks on tables
-lock_row_lock_current_waits lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of row locks currently being waited for (innodb_row_lock_current_waits)
-lock_row_lock_time lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Time spent in acquiring row locks, in milliseconds (innodb_row_lock_time)
-lock_row_lock_time_max lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value The maximum time to acquire a row lock, in milliseconds (innodb_row_lock_time_max)
-lock_row_lock_waits lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of times a row lock had to be waited for (innodb_row_lock_waits)
-lock_row_lock_time_avg lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value The average time to acquire a row lock, in milliseconds (innodb_row_lock_time_avg)
-buffer_pool_size server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Server buffer pool size (all buffer pools) in bytes
-buffer_pool_reads buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of reads directly from disk (innodb_buffer_pool_reads)
-buffer_pool_read_requests buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of logical read requests (innodb_buffer_pool_read_requests)
-buffer_pool_write_requests buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of write requests (innodb_buffer_pool_write_requests)
-buffer_pool_wait_free buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of times waited for free buffer (innodb_buffer_pool_wait_free)
-buffer_pool_read_ahead buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of pages read as read ahead (innodb_buffer_pool_read_ahead)
-buffer_pool_read_ahead_evicted buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Read-ahead pages evicted without being accessed (innodb_buffer_pool_read_ahead_evicted)
-buffer_pool_pages_total buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Total buffer pool size in pages (innodb_buffer_pool_pages_total)
-buffer_pool_pages_misc buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Buffer pages for misc use such as row locks or the adaptive hash index (innodb_buffer_pool_pages_misc)
-buffer_pool_pages_data buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Buffer pages containing data (innodb_buffer_pool_pages_data)
-buffer_pool_bytes_data buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Buffer bytes containing data (innodb_buffer_pool_bytes_data)
-buffer_pool_pages_dirty buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Buffer pages currently dirty (innodb_buffer_pool_pages_dirty)
-buffer_pool_bytes_dirty buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Buffer bytes currently dirty (innodb_buffer_pool_bytes_dirty)
-buffer_pool_pages_free buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Buffer pages currently free (innodb_buffer_pool_pages_free)
-buffer_pages_created buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of pages created (innodb_pages_created)
-buffer_pages_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of pages written (innodb_pages_written)
-buffer_index_pages_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of index pages written (innodb_index_pages_written)
-buffer_non_index_pages_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of non index pages written (innodb_non_index_pages_written)
-buffer_pages_read buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of pages read (innodb_pages_read)
-buffer_index_sec_rec_cluster_reads buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of secondary record reads triggered cluster read
-buffer_index_sec_rec_cluster_reads_avoided buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of secondary record reads avoided triggering cluster read
-buffer_data_reads buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Amount of data read in bytes (innodb_data_reads)
-buffer_data_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Amount of data written in bytes (innodb_data_written)
-buffer_flush_batch_scanned buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages scanned as part of flush batch
-buffer_flush_batch_num_scan buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of times buffer flush list flush is called
-buffer_flush_batch_scanned_per_call buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Pages scanned per flush batch scan
-buffer_flush_batch_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages flushed as part of flush batch
-buffer_flush_batches buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of flush batches
-buffer_flush_batch_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Pages queued as a flush batch
-buffer_flush_neighbor_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total neighbors flushed as part of neighbor flush
-buffer_flush_neighbor buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of times neighbors flushing is invoked
-buffer_flush_neighbor_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Pages queued as a neighbor batch
-buffer_flush_n_to_flush_requested buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of pages requested for flushing.
-buffer_flush_n_to_flush_by_age buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of pages target by LSN Age for flushing.
-buffer_flush_adaptive_avg_time_slot buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Avg time (ms) spent for adaptive flushing recently per slot.
-buffer_LRU_batch_flush_avg_time_slot buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Avg time (ms) spent for LRU batch flushing recently per slot.
-buffer_flush_adaptive_avg_time_thread buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Avg time (ms) spent for adaptive flushing recently per thread.
-buffer_LRU_batch_flush_avg_time_thread buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Avg time (ms) spent for LRU batch flushing recently per thread.
-buffer_flush_adaptive_avg_time_est buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Estimated time (ms) spent for adaptive flushing recently.
-buffer_LRU_batch_flush_avg_time_est buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Estimated time (ms) spent for LRU batch flushing recently.
-buffer_flush_avg_time buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Avg time (ms) spent for flushing recently.
-buffer_flush_adaptive_avg_pass buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Numner of adaptive flushes passed during the recent Avg period.
-buffer_LRU_batch_flush_avg_pass buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of LRU batch flushes passed during the recent Avg period.
-buffer_flush_avg_pass buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of flushes passed during the recent Avg period.
-buffer_LRU_get_free_loops buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Total loops in LRU get free.
-buffer_LRU_get_free_waits buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Total sleep waits in LRU get free.
-buffer_flush_avg_page_rate buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Average number of pages at which flushing is happening
-buffer_flush_lsn_avg_rate buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Average redo generation rate
-buffer_flush_pct_for_dirty buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Percent of IO capacity used to avoid max dirty page limit
-buffer_flush_pct_for_lsn buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Percent of IO capacity used to avoid reusable redo space limit
-buffer_flush_sync_waits buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times a wait happens due to sync flushing
-buffer_flush_adaptive_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages flushed as part of adaptive flushing
-buffer_flush_adaptive buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of adaptive batches
-buffer_flush_adaptive_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Pages queued as an adaptive batch
-buffer_flush_sync_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages flushed as part of sync batches
-buffer_flush_sync buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of sync batches
-buffer_flush_sync_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Pages queued as a sync batch
-buffer_flush_background_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages flushed as part of background batches
-buffer_flush_background buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of background batches
-buffer_flush_background_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Pages queued as a background batch
-buffer_LRU_batch_scanned buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages scanned as part of LRU batch
-buffer_LRU_batch_num_scan buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of times LRU batch is called
-buffer_LRU_batch_scanned_per_call buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Pages scanned per LRU batch call
-buffer_LRU_batch_flush_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages flushed as part of LRU batches
-buffer_LRU_batches_flush buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of LRU batches
-buffer_LRU_batch_flush_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Pages queued as an LRU batch
-buffer_LRU_batch_evict_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages evicted as part of LRU batches
-buffer_LRU_batches_evict buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of LRU batches
-buffer_LRU_batch_evict_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Pages queued as an LRU batch
-buffer_LRU_single_flush_scanned buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages scanned as part of single page LRU flush
-buffer_LRU_single_flush_num_scan buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of times single page LRU flush is called
-buffer_LRU_single_flush_scanned_per_call buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Page scanned per single LRU flush
-buffer_LRU_single_flush_failure_count Buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times attempt to flush a single page from LRU failed
-buffer_LRU_get_free_search Buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of searches performed for a clean page
-buffer_LRU_search_scanned buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages scanned as part of LRU search
-buffer_LRU_search_num_scan buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of times LRU search is performed
-buffer_LRU_search_scanned_per_call buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Page scanned per single LRU search
-buffer_LRU_unzip_search_scanned buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages scanned as part of LRU unzip search
-buffer_LRU_unzip_search_num_scan buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of times LRU unzip search is performed
-buffer_LRU_unzip_search_scanned_per_call buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Page scanned per single LRU unzip search
-buffer_page_read_index_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Index Leaf Pages read
-buffer_page_read_index_non_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Index Non-leaf Pages read
-buffer_page_read_index_ibuf_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Insert Buffer Index Leaf Pages read
-buffer_page_read_index_ibuf_non_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Insert Buffer Index Non-Leaf Pages read
-buffer_page_read_undo_log buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Undo Log Pages read
-buffer_page_read_index_inode buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Index Inode Pages read
-buffer_page_read_ibuf_free_list buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Insert Buffer Free List Pages read
-buffer_page_read_ibuf_bitmap buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Insert Buffer Bitmap Pages read
-buffer_page_read_system_page buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of System Pages read
-buffer_page_read_trx_system buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Transaction System Pages read
-buffer_page_read_fsp_hdr buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of File Space Header Pages read
-buffer_page_read_xdes buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Extent Descriptor Pages read
-buffer_page_read_blob buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Uncompressed BLOB Pages read
-buffer_page_read_zblob buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of First Compressed BLOB Pages read
-buffer_page_read_zblob2 buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Subsequent Compressed BLOB Pages read
-buffer_page_read_other buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of other/unknown (old version of InnoDB) Pages read
-buffer_page_written_index_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Index Leaf Pages written
-buffer_page_written_index_non_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Index Non-leaf Pages written
-buffer_page_written_index_ibuf_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Insert Buffer Index Leaf Pages written
-buffer_page_written_index_ibuf_non_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Insert Buffer Index Non-Leaf Pages written
-buffer_page_written_undo_log buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Undo Log Pages written
-buffer_page_written_index_inode buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Index Inode Pages written
-buffer_page_written_ibuf_free_list buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Insert Buffer Free List Pages written
-buffer_page_written_ibuf_bitmap buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Insert Buffer Bitmap Pages written
-buffer_page_written_system_page buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of System Pages written
-buffer_page_written_trx_system buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Transaction System Pages written
-buffer_page_written_fsp_hdr buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of File Space Header Pages written
-buffer_page_written_xdes buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Extent Descriptor Pages written
-buffer_page_written_blob buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Uncompressed BLOB Pages written
-buffer_page_written_zblob buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of First Compressed BLOB Pages written
-buffer_page_written_zblob2 buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Subsequent Compressed BLOB Pages written
-buffer_page_written_other buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of other/unknown (old version InnoDB) Pages written
-os_data_reads os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of reads initiated (innodb_data_reads)
-os_data_writes os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of writes initiated (innodb_data_writes)
-os_data_fsyncs os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of fsync() calls (innodb_data_fsyncs)
-os_pending_reads os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of reads pending
-os_pending_writes os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of writes pending
-os_log_bytes_written os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Bytes of log written (innodb_os_log_written)
-os_log_fsyncs os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of fsync log writes (innodb_os_log_fsyncs)
-os_log_pending_fsyncs os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of pending fsync write (innodb_os_log_pending_fsyncs)
-os_log_pending_writes os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of pending log file writes (innodb_os_log_pending_writes)
-trx_rw_commits transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of read-write transactions committed
-trx_ro_commits transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of read-only transactions committed
-trx_nl_ro_commits transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of non-locking auto-commit read-only transactions committed
-trx_commits_insert_update transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of transactions committed with inserts and updates
-trx_rollbacks transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of transactions rolled back
-trx_rollbacks_savepoint transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of transactions rolled back to savepoint
-trx_active_transactions transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of active transactions
-trx_rseg_history_len transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Length of the TRX_RSEG_HISTORY list
-trx_undo_slots_used transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of undo slots used
-trx_undo_slots_cached transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of undo slots cached
-trx_rseg_current_size transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Current rollback segment size in pages
-purge_del_mark_records purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of delete-marked rows purged
-purge_upd_exist_or_extern_records purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of purges on updates of existing records and updates on delete marked record with externally stored field
-purge_invoked purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times purge was invoked
-purge_undo_log_pages purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of undo log pages handled by the purge
-purge_dml_delay_usec purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Microseconds DML to be delayed due to purge lagging
-purge_stop_count purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Number of times purge was stopped
-purge_resume_count purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Number of times purge was resumed
-log_checkpoints recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of checkpoints
-log_lsn_last_flush recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value LSN of Last flush
-log_lsn_last_checkpoint recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value LSN at last checkpoint
-log_lsn_current recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Current LSN value
-log_lsn_checkpoint_age recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Current LSN value minus LSN at last checkpoint
-log_lsn_buf_pool_oldest recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value The oldest modified block LSN in the buffer pool
-log_max_modified_age_async recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Maximum LSN difference; when exceeded, start asynchronous preflush
-log_max_modified_age_sync recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Maximum LSN difference; when exceeded, start synchronous preflush
-log_pending_log_flushes recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Pending log flushes
-log_pending_checkpoint_writes recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Pending checkpoints
-log_num_log_io recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Number of log I/Os
-log_waits recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of log waits due to small log buffer (innodb_log_waits)
-log_write_requests recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of log write requests (innodb_log_write_requests)
-log_writes recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of log writes (innodb_log_writes)
-log_padded recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Bytes of log padded for log write ahead
-compress_pages_compressed compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of pages compressed
-compress_pages_decompressed compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of pages decompressed
-compression_pad_increments compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times padding is incremented to avoid compression failures
-compression_pad_decrements compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times padding is decremented due to good compressibility
-compress_saved compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of bytes saved by page compression
-compress_pages_page_compressed compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of pages compressed by page compression
-compress_page_compressed_trim_op compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of TRIM operation performed by page compression
-compress_pages_page_decompressed compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of pages decompressed by page compression
-compress_pages_page_compression_error compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of page compression errors
-compress_pages_encrypted compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of pages encrypted
-compress_pages_decrypted compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of pages decrypted
-index_page_splits index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of index page splits
-index_page_merge_attempts index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of index page merge attempts
-index_page_merge_successful index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of successful index page merges
-index_page_reorg_attempts index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of index page reorganization attempts
-index_page_reorg_successful index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of successful index page reorganizations
-index_page_discards index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of index pages discarded
-adaptive_hash_searches adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of successful searches using Adaptive Hash Index
-adaptive_hash_searches_btree adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of searches using B-tree on an index search
-adaptive_hash_pages_added adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of index pages on which the Adaptive Hash Index is built
-adaptive_hash_pages_removed adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of index pages whose corresponding Adaptive Hash Index entries were removed
-adaptive_hash_rows_added adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Adaptive Hash Index rows added
-adaptive_hash_rows_removed adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Adaptive Hash Index rows removed
-adaptive_hash_rows_deleted_no_hash_entry adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of rows deleted that did not have corresponding Adaptive Hash Index entries
-adaptive_hash_rows_updated adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Adaptive Hash Index rows updated
-file_num_open_files file_system 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Number of files currently open (innodb_num_open_files)
-ibuf_merges_insert change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of inserted records merged by change buffering
-ibuf_merges_delete_mark change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of deleted records merged by change buffering
-ibuf_merges_delete change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of purge records merged by change buffering
-ibuf_merges_discard_insert change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of insert merged operations discarded
-ibuf_merges_discard_delete_mark change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of deleted merged operations discarded
-ibuf_merges_discard_delete change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of purge merged operations discarded
-ibuf_merges change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of change buffer merges
-ibuf_size change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Change buffer size in pages
-innodb_master_thread_sleeps server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times (seconds) master thread sleeps
-innodb_activity_count server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Current server activity count
-innodb_master_active_loops server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times master thread performs its tasks when server is active
-innodb_master_idle_loops server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times master thread performs its tasks when server is idle
-innodb_background_drop_table_usec server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Time (in microseconds) spent to process drop table list
-innodb_ibuf_merge_usec server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Time (in microseconds) spent to process change buffer merge
-innodb_log_flush_usec server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Time (in microseconds) spent to flush log records
-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)
-innodb_page_size server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value InnoDB page size in bytes (innodb_page_size)
-innodb_rwlock_s_spin_waits server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of rwlock spin waits due to shared latch request
-innodb_rwlock_x_spin_waits server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of rwlock spin waits due to exclusive latch request
-innodb_rwlock_sx_spin_waits server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of rwlock spin waits due to sx latch request
-innodb_rwlock_s_spin_rounds server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of rwlock spin loop rounds due to shared latch request
-innodb_rwlock_x_spin_rounds server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of rwlock spin loop rounds due to exclusive latch request
-innodb_rwlock_sx_spin_rounds server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of rwlock spin loop rounds due to sx latch request
-innodb_rwlock_s_os_waits server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of OS waits due to shared latch request
-innodb_rwlock_x_os_waits server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of OS waits due to exclusive latch request
-innodb_rwlock_sx_os_waits server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of OS waits due to sx latch request
-dml_reads dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of rows read
-dml_inserts dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of rows inserted
-dml_deletes dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of rows deleted
-dml_updates dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of rows updated
-dml_system_reads dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of system rows read
-dml_system_inserts dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of system rows inserted
-dml_system_deletes dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of system rows deleted
-dml_system_updates dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of system rows updated
-ddl_background_drop_indexes ddl 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of indexes waiting to be dropped after failed index creation
-ddl_background_drop_tables ddl 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of tables in background drop table list
-ddl_online_create_index ddl 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of indexes being created online
-ddl_pending_alter_table ddl 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of ALTER TABLE, CREATE INDEX, DROP INDEX in progress
-ddl_sort_file_alter_table ddl 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of sort files created during alter table
-ddl_log_file_alter_table ddl 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of log files created during alter table
-icp_attempts icp 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of attempts for index push-down condition checks
-icp_no_match icp 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Index push-down condition does not match
-icp_out_of_range icp 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Index push-down condition out of range
-icp_match icp 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Index push-down condition matches
+NAME SUBSYSTEM COUNT MAX_COUNT MIN_COUNT AVG_COUNT COUNT_RESET MAX_COUNT_RESET MIN_COUNT_RESET AVG_COUNT_RESET TIME_ENABLED TIME_DISABLED TIME_ELAPSED TIME_RESET ENABLED TYPE COMMENT
+metadata_table_handles_opened metadata 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of table handles opened
+metadata_table_handles_closed metadata 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of table handles closed
+metadata_table_reference_count metadata 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Table reference counter
+lock_deadlocks lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of deadlocks
+lock_timeouts lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of lock timeouts
+lock_rec_lock_waits lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of times enqueued into record lock wait queue
+lock_table_lock_waits lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of times enqueued into table lock wait queue
+lock_rec_lock_requests lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of record locks requested
+lock_rec_lock_created lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of record locks created
+lock_rec_lock_removed lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of record locks removed from the lock queue
+lock_rec_locks lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Current number of record locks on tables
+lock_table_lock_created lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of table locks created
+lock_table_lock_removed lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of table locks removed from the lock queue
+lock_table_locks lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Current number of table locks on tables
+lock_row_lock_current_waits lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of row locks currently being waited for (innodb_row_lock_current_waits)
+lock_row_lock_time lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Time spent in acquiring row locks, in milliseconds (innodb_row_lock_time)
+lock_row_lock_time_max lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value The maximum time to acquire a row lock, in milliseconds (innodb_row_lock_time_max)
+lock_row_lock_waits lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of times a row lock had to be waited for (innodb_row_lock_waits)
+lock_row_lock_time_avg lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value The average time to acquire a row lock, in milliseconds (innodb_row_lock_time_avg)
+buffer_pool_size server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Server buffer pool size (all buffer pools) in bytes
+buffer_pool_reads buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of reads directly from disk (innodb_buffer_pool_reads)
+buffer_pool_read_requests buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of logical read requests (innodb_buffer_pool_read_requests)
+buffer_pool_write_requests buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of write requests (innodb_buffer_pool_write_requests)
+buffer_pool_wait_free buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of times waited for free buffer (innodb_buffer_pool_wait_free)
+buffer_pool_read_ahead buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of pages read as read ahead (innodb_buffer_pool_read_ahead)
+buffer_pool_read_ahead_evicted buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Read-ahead pages evicted without being accessed (innodb_buffer_pool_read_ahead_evicted)
+buffer_pool_pages_total buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Total buffer pool size in pages (innodb_buffer_pool_pages_total)
+buffer_pool_pages_misc buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Buffer pages for misc use such as row locks or the adaptive hash index (innodb_buffer_pool_pages_misc)
+buffer_pool_pages_data buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Buffer pages containing data (innodb_buffer_pool_pages_data)
+buffer_pool_bytes_data buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Buffer bytes containing data (innodb_buffer_pool_bytes_data)
+buffer_pool_pages_dirty buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Buffer pages currently dirty (innodb_buffer_pool_pages_dirty)
+buffer_pool_bytes_dirty buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Buffer bytes currently dirty (innodb_buffer_pool_bytes_dirty)
+buffer_pool_pages_free buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Buffer pages currently free (innodb_buffer_pool_pages_free)
+buffer_pages_created buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of pages created (innodb_pages_created)
+buffer_pages_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of pages written (innodb_pages_written)
+buffer_index_pages_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of index pages written (innodb_index_pages_written)
+buffer_non_index_pages_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of non index pages written (innodb_non_index_pages_written)
+buffer_pages_read buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of pages read (innodb_pages_read)
+buffer_index_sec_rec_cluster_reads buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of secondary record reads triggered cluster read
+buffer_index_sec_rec_cluster_reads_avoided buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of secondary record reads avoided triggering cluster read
+buffer_data_reads buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Amount of data read in bytes (innodb_data_reads)
+buffer_data_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Amount of data written in bytes (innodb_data_written)
+buffer_flush_batch_scanned buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_owner Total pages scanned as part of flush batch
+buffer_flush_batch_num_scan buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Number of times buffer flush list flush is called
+buffer_flush_batch_scanned_per_call buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Pages scanned per flush batch scan
+buffer_flush_batch_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_owner Total pages flushed as part of flush batch
+buffer_flush_batches buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Number of flush batches
+buffer_flush_batch_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Pages queued as a flush batch
+buffer_flush_neighbor_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_owner Total neighbors flushed as part of neighbor flush
+buffer_flush_neighbor buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Number of times neighbors flushing is invoked
+buffer_flush_neighbor_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Pages queued as a neighbor batch
+buffer_flush_n_to_flush_requested buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of pages requested for flushing.
+buffer_flush_n_to_flush_by_age buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of pages target by LSN Age for flushing.
+buffer_flush_adaptive_avg_time_slot buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Avg time (ms) spent for adaptive flushing recently per slot.
+buffer_LRU_batch_flush_avg_time_slot buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Avg time (ms) spent for LRU batch flushing recently per slot.
+buffer_flush_adaptive_avg_time_thread buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Avg time (ms) spent for adaptive flushing recently per thread.
+buffer_LRU_batch_flush_avg_time_thread buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Avg time (ms) spent for LRU batch flushing recently per thread.
+buffer_flush_adaptive_avg_time_est buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Estimated time (ms) spent for adaptive flushing recently.
+buffer_LRU_batch_flush_avg_time_est buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Estimated time (ms) spent for LRU batch flushing recently.
+buffer_flush_avg_time buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Avg time (ms) spent for flushing recently.
+buffer_flush_adaptive_avg_pass buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Numner of adaptive flushes passed during the recent Avg period.
+buffer_LRU_batch_flush_avg_pass buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of LRU batch flushes passed during the recent Avg period.
+buffer_flush_avg_pass buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of flushes passed during the recent Avg period.
+buffer_LRU_get_free_loops buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Total loops in LRU get free.
+buffer_LRU_get_free_waits buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Total sleep waits in LRU get free.
+buffer_flush_avg_page_rate buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Average number of pages at which flushing is happening
+buffer_flush_lsn_avg_rate buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Average redo generation rate
+buffer_flush_pct_for_dirty buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Percent of IO capacity used to avoid max dirty page limit
+buffer_flush_pct_for_lsn buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Percent of IO capacity used to avoid reusable redo space limit
+buffer_flush_sync_waits buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of times a wait happens due to sync flushing
+buffer_flush_adaptive_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_owner Total pages flushed as part of adaptive flushing
+buffer_flush_adaptive buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Number of adaptive batches
+buffer_flush_adaptive_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Pages queued as an adaptive batch
+buffer_flush_sync_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_owner Total pages flushed as part of sync batches
+buffer_flush_sync buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Number of sync batches
+buffer_flush_sync_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Pages queued as a sync batch
+buffer_flush_background_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_owner Total pages flushed as part of background batches
+buffer_flush_background buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Number of background batches
+buffer_flush_background_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Pages queued as a background batch
+buffer_LRU_batch_scanned buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_owner Total pages scanned as part of LRU batch
+buffer_LRU_batch_num_scan buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Number of times LRU batch is called
+buffer_LRU_batch_scanned_per_call buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Pages scanned per LRU batch call
+buffer_LRU_batch_flush_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_owner Total pages flushed as part of LRU batches
+buffer_LRU_batches_flush buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Number of LRU batches
+buffer_LRU_batch_flush_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Pages queued as an LRU batch
+buffer_LRU_batch_evict_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_owner Total pages evicted as part of LRU batches
+buffer_LRU_batches_evict buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Number of LRU batches
+buffer_LRU_batch_evict_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Pages queued as an LRU batch
+buffer_LRU_single_flush_scanned buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_owner Total pages scanned as part of single page LRU flush
+buffer_LRU_single_flush_num_scan buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Number of times single page LRU flush is called
+buffer_LRU_single_flush_scanned_per_call buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Page scanned per single LRU flush
+buffer_LRU_single_flush_failure_count Buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of times attempt to flush a single page from LRU failed
+buffer_LRU_get_free_search Buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of searches performed for a clean page
+buffer_LRU_search_scanned buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_owner Total pages scanned as part of LRU search
+buffer_LRU_search_num_scan buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Number of times LRU search is performed
+buffer_LRU_search_scanned_per_call buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Page scanned per single LRU search
+buffer_LRU_unzip_search_scanned buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_owner Total pages scanned as part of LRU unzip search
+buffer_LRU_unzip_search_num_scan buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Number of times LRU unzip search is performed
+buffer_LRU_unzip_search_scanned_per_call buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Page scanned per single LRU unzip search
+buffer_page_read_index_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Index Leaf Pages read
+buffer_page_read_index_non_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Index Non-leaf Pages read
+buffer_page_read_index_ibuf_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Insert Buffer Index Leaf Pages read
+buffer_page_read_index_ibuf_non_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Insert Buffer Index Non-Leaf Pages read
+buffer_page_read_undo_log buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Undo Log Pages read
+buffer_page_read_index_inode buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Index Inode Pages read
+buffer_page_read_ibuf_free_list buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Insert Buffer Free List Pages read
+buffer_page_read_ibuf_bitmap buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Insert Buffer Bitmap Pages read
+buffer_page_read_system_page buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of System Pages read
+buffer_page_read_trx_system buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Transaction System Pages read
+buffer_page_read_fsp_hdr buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of File Space Header Pages read
+buffer_page_read_xdes buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Extent Descriptor Pages read
+buffer_page_read_blob buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Uncompressed BLOB Pages read
+buffer_page_read_zblob buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of First Compressed BLOB Pages read
+buffer_page_read_zblob2 buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Subsequent Compressed BLOB Pages read
+buffer_page_read_other buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of other/unknown (old version of InnoDB) Pages read
+buffer_page_written_index_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Index Leaf Pages written
+buffer_page_written_index_non_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Index Non-leaf Pages written
+buffer_page_written_index_ibuf_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Insert Buffer Index Leaf Pages written
+buffer_page_written_index_ibuf_non_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Insert Buffer Index Non-Leaf Pages written
+buffer_page_written_undo_log buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Undo Log Pages written
+buffer_page_written_index_inode buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Index Inode Pages written
+buffer_page_written_ibuf_free_list buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Insert Buffer Free List Pages written
+buffer_page_written_ibuf_bitmap buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Insert Buffer Bitmap Pages written
+buffer_page_written_system_page buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of System Pages written
+buffer_page_written_trx_system buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Transaction System Pages written
+buffer_page_written_fsp_hdr buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of File Space Header Pages written
+buffer_page_written_xdes buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Extent Descriptor Pages written
+buffer_page_written_blob buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Uncompressed BLOB Pages written
+buffer_page_written_zblob buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of First Compressed BLOB Pages written
+buffer_page_written_zblob2 buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Subsequent Compressed BLOB Pages written
+buffer_page_written_other buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of other/unknown (old version InnoDB) Pages written
+os_data_reads os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of reads initiated (innodb_data_reads)
+os_data_writes os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of writes initiated (innodb_data_writes)
+os_data_fsyncs os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of fsync() calls (innodb_data_fsyncs)
+os_pending_reads os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of reads pending
+os_pending_writes os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of writes pending
+os_log_bytes_written os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Bytes of log written (innodb_os_log_written)
+os_log_fsyncs os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of fsync log writes (innodb_os_log_fsyncs)
+os_log_pending_fsyncs os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of pending fsync write (innodb_os_log_pending_fsyncs)
+os_log_pending_writes os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of pending log file writes (innodb_os_log_pending_writes)
+trx_rw_commits transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of read-write transactions committed
+trx_ro_commits transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of read-only transactions committed
+trx_nl_ro_commits transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of non-locking auto-commit read-only transactions committed
+trx_commits_insert_update transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of transactions committed with inserts and updates
+trx_rollbacks transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of transactions rolled back
+trx_rollbacks_savepoint transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of transactions rolled back to savepoint
+trx_active_transactions transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of active transactions
+trx_rseg_history_len transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Length of the TRX_RSEG_HISTORY list
+trx_undo_slots_used transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of undo slots used
+trx_undo_slots_cached transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of undo slots cached
+trx_rseg_current_size transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Current rollback segment size in pages
+purge_del_mark_records purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of delete-marked rows purged
+purge_upd_exist_or_extern_records purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of purges on updates of existing records and updates on delete marked record with externally stored field
+purge_invoked purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of times purge was invoked
+purge_undo_log_pages purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of undo log pages handled by the purge
+purge_dml_delay_usec purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Microseconds DML to be delayed due to purge lagging
+purge_stop_count purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Number of times purge was stopped
+purge_resume_count purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Number of times purge was resumed
+log_checkpoints recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of checkpoints
+log_lsn_last_flush recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value LSN of Last flush
+log_lsn_last_checkpoint recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value LSN at last checkpoint
+log_lsn_current recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Current LSN value
+log_lsn_checkpoint_age recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Current LSN value minus LSN at last checkpoint
+log_lsn_buf_pool_oldest recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value The oldest modified block LSN in the buffer pool
+log_max_modified_age_async recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Maximum LSN difference; when exceeded, start asynchronous preflush
+log_max_modified_age_sync recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Maximum LSN difference; when exceeded, start synchronous preflush
+log_pending_log_flushes recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Pending log flushes
+log_pending_checkpoint_writes recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Pending checkpoints
+log_num_log_io recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Number of log I/Os
+log_waits recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of log waits due to small log buffer (innodb_log_waits)
+log_write_requests recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of log write requests (innodb_log_write_requests)
+log_writes recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of log writes (innodb_log_writes)
+log_padded recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Bytes of log padded for log write ahead
+compress_pages_compressed compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of pages compressed
+compress_pages_decompressed compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of pages decompressed
+compression_pad_increments compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of times padding is incremented to avoid compression failures
+compression_pad_decrements compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of times padding is decremented due to good compressibility
+compress_saved compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of bytes saved by page compression
+compress_pages_page_compressed compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of pages compressed by page compression
+compress_page_compressed_trim_op compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of TRIM operation performed by page compression
+compress_pages_page_decompressed compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of pages decompressed by page compression
+compress_pages_page_compression_error compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of page compression errors
+compress_pages_encrypted compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of pages encrypted
+compress_pages_decrypted compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of pages decrypted
+index_page_splits index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of index page splits
+index_page_merge_attempts index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of index page merge attempts
+index_page_merge_successful index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of successful index page merges
+index_page_reorg_attempts index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of index page reorganization attempts
+index_page_reorg_successful index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of successful index page reorganizations
+index_page_discards index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of index pages discarded
+adaptive_hash_searches adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of successful searches using Adaptive Hash Index
+adaptive_hash_searches_btree adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of searches using B-tree on an index search
+adaptive_hash_pages_added adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of index pages on which the Adaptive Hash Index is built
+adaptive_hash_pages_removed adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of index pages whose corresponding Adaptive Hash Index entries were removed
+adaptive_hash_rows_added adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Adaptive Hash Index rows added
+adaptive_hash_rows_removed adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Adaptive Hash Index rows removed
+adaptive_hash_rows_deleted_no_hash_entry adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of rows deleted that did not have corresponding Adaptive Hash Index entries
+adaptive_hash_rows_updated adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Adaptive Hash Index rows updated
+file_num_open_files file_system 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Number of files currently open (innodb_num_open_files)
+ibuf_merges_insert change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of inserted records merged by change buffering
+ibuf_merges_delete_mark change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of deleted records merged by change buffering
+ibuf_merges_delete change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of purge records merged by change buffering
+ibuf_merges_discard_insert change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of insert merged operations discarded
+ibuf_merges_discard_delete_mark change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of deleted merged operations discarded
+ibuf_merges_discard_delete change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of purge merged operations discarded
+ibuf_merges change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of change buffer merges
+ibuf_size change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Change buffer size in pages
+innodb_master_thread_sleeps server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of times (seconds) master thread sleeps
+innodb_activity_count server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Current server activity count
+innodb_master_active_loops server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of times master thread performs its tasks when server is active
+innodb_master_idle_loops server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of times master thread performs its tasks when server is idle
+innodb_background_drop_table_usec server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Time (in microseconds) spent to process drop table list
+innodb_log_flush_usec server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Time (in microseconds) spent to flush log records
+innodb_mem_validate_usec server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 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 0 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 0 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 0 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 0 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 0 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 0 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 0 status_counter Number of pages that have been written for doublewrite operations (innodb_dblwr_pages_written)
+innodb_page_size server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value InnoDB page size in bytes (innodb_page_size)
+innodb_rwlock_s_spin_waits server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of rwlock spin waits due to shared latch request
+innodb_rwlock_x_spin_waits server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of rwlock spin waits due to exclusive latch request
+innodb_rwlock_sx_spin_waits server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of rwlock spin waits due to sx latch request
+innodb_rwlock_s_spin_rounds server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of rwlock spin loop rounds due to shared latch request
+innodb_rwlock_x_spin_rounds server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of rwlock spin loop rounds due to exclusive latch request
+innodb_rwlock_sx_spin_rounds server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of rwlock spin loop rounds due to sx latch request
+innodb_rwlock_s_os_waits server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of OS waits due to shared latch request
+innodb_rwlock_x_os_waits server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of OS waits due to exclusive latch request
+innodb_rwlock_sx_os_waits server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of OS waits due to sx latch request
+dml_reads dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of rows read
+dml_inserts dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of rows inserted
+dml_deletes dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of rows deleted
+dml_updates dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of rows updated
+dml_system_reads dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of system rows read
+dml_system_inserts dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of system rows inserted
+dml_system_deletes dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of system rows deleted
+dml_system_updates dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of system rows updated
+ddl_background_drop_indexes ddl 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of indexes waiting to be dropped after failed index creation
+ddl_background_drop_tables ddl 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of tables in background drop table list
+ddl_online_create_index ddl 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of indexes being created online
+ddl_pending_alter_table ddl 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of ALTER TABLE, CREATE INDEX, DROP INDEX in progress
+ddl_sort_file_alter_table ddl 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of sort files created during alter table
+ddl_log_file_alter_table ddl 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of log files created during alter table
+icp_attempts icp 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of attempts for index push-down condition checks
+icp_no_match icp 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Index push-down condition does not match
+icp_out_of_range icp 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Index push-down condition out of range
+icp_match icp 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Index push-down condition matches
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DEFAULT_STOPWORD;
value
a
@@ -337,6 +336,6 @@ ID FOR_NAME REF_NAME N_COLS TYPE
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
ID FOR_COL_NAME REF_COL_NAME POS
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES;
-SPACE NAME FLAG ROW_FORMAT PAGE_SIZE ZIP_PAGE_SIZE SPACE_TYPE FS_BLOCK_SIZE FILE_SIZE ALLOCATED_SIZE
+SPACE NAME FLAG ROW_FORMAT PAGE_SIZE ZIP_PAGE_SIZE FS_BLOCK_SIZE FILE_SIZE ALLOCATED_SIZE
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_DATAFILES;
SPACE PATH
diff --git a/storage/rocksdb/mysql-test/rocksdb/t/disabled.def b/storage/rocksdb/mysql-test/rocksdb/t/disabled.def
index 11c9c08c36e..627d7da4171 100644
--- a/storage/rocksdb/mysql-test/rocksdb/t/disabled.def
+++ b/storage/rocksdb/mysql-test/rocksdb/t/disabled.def
@@ -95,3 +95,4 @@ mysqlbinlog_gtid_skip_empty_trans_rocksdb : MariaRocks: requires GTIDs
drop_table: Hangs on shutdown
add_index_inplace: not stable result
rocksdb_range2 : result difference, update after MDEV-16746 is fixed
+add_index_inplace: FORCE INDEX gives wrong count
diff --git a/storage/rocksdb/mysql-test/rocksdb/t/i_s.test b/storage/rocksdb/mysql-test/rocksdb/t/i_s.test
new file mode 100644
index 00000000000..c9dc98c9253
--- /dev/null
+++ b/storage/rocksdb/mysql-test/rocksdb/t/i_s.test
@@ -0,0 +1,21 @@
+--source include/have_rocksdb.inc
+--source include/have_partition.inc
+
+SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
+ WHERE TABLE_SCHEMA='INFORMATION_SCHEMA'
+ AND TABLE_NAME LIKE 'ROCKSDB%'
+ ORDER BY TABLE_NAME;
+
+SHOW CREATE TABLE INFORMATION_SCHEMA.ROCKSDB_CF_OPTIONS;
+SHOW CREATE TABLE INFORMATION_SCHEMA.ROCKSDB_CFSTATS;
+SHOW CREATE TABLE INFORMATION_SCHEMA.ROCKSDB_COMPACTION_STATS;
+SHOW CREATE TABLE INFORMATION_SCHEMA.ROCKSDB_DBSTATS;
+SHOW CREATE TABLE INFORMATION_SCHEMA.ROCKSDB_DDL;
+SHOW CREATE TABLE INFORMATION_SCHEMA.ROCKSDB_DEADLOCK;
+SHOW CREATE TABLE INFORMATION_SCHEMA.ROCKSDB_GLOBAL_INFO;
+SHOW CREATE TABLE INFORMATION_SCHEMA.ROCKSDB_INDEX_FILE_MAP;
+SHOW CREATE TABLE INFORMATION_SCHEMA.ROCKSDB_LOCKS;
+SHOW CREATE TABLE INFORMATION_SCHEMA.ROCKSDB_PERF_CONTEXT;
+SHOW CREATE TABLE INFORMATION_SCHEMA.ROCKSDB_PERF_CONTEXT_GLOBAL;
+SHOW CREATE TABLE INFORMATION_SCHEMA.ROCKSDB_SST_PROPS;
+SHOW CREATE TABLE INFORMATION_SCHEMA.ROCKSDB_TRX;
diff --git a/storage/rocksdb/mysql-test/rocksdb/t/rqg.inc b/storage/rocksdb/mysql-test/rocksdb/t/rqg.inc
index 40154d9eaa7..0f3246de06f 100644
--- a/storage/rocksdb/mysql-test/rocksdb/t/rqg.inc
+++ b/storage/rocksdb/mysql-test/rocksdb/t/rqg.inc
@@ -25,8 +25,8 @@ foreach $grammar_file (split(/ /, $ENV{'GRAMMAR_FILES'})) {
# Errors from the gentest.pl file will be captured in the results file
my $cmd = "perl $ENV{'RQG_BASE'}/gentest.pl " .
- "--dsn=dbi:mysql:host=:port=:user=root:database=$ENV{'TESTDB'}" .
- ":mysql_socket=$ENV{'MYSQL_SOCKET'} " .
+ "--dsn=DBI:MariaDB:host=:port=:user=root:database=$ENV{'TESTDB'}" .
+ ":mariadb_socket=$ENV{'MYSQL_SOCKET'} " .
"--gendata=$ENV{'RQG_BASE'}/conf/$ENV{'TESTDIR'}/$ENV{'DATA_FILE'} " .
"--grammar=$ENV{'RQG_BASE'}/conf/$ENV{'TESTDIR'}/$grammar_file " .
"--threads=5 --queries=10000 --duration=60 --sqltrace 2>&1 >> " .
diff --git a/storage/rocksdb/rdb_i_s.cc b/storage/rocksdb/rdb_i_s.cc
index 01a2066ae26..5350ec3bce9 100644
--- a/storage/rocksdb/rdb_i_s.cc
+++ b/storage/rocksdb/rdb_i_s.cc
@@ -65,11 +65,14 @@ namespace RDB_CFSTATS_FIELD {
enum { CF_NAME = 0, STAT_TYPE, VALUE };
} // namespace RDB_CFSTATS_FIELD
+using namespace Show;
+
static ST_FIELD_INFO rdb_i_s_cfstats_fields_info[] = {
- ROCKSDB_FIELD_INFO("CF_NAME", NAME_LEN + 1, MYSQL_TYPE_STRING, 0),
- ROCKSDB_FIELD_INFO("STAT_TYPE", NAME_LEN + 1, MYSQL_TYPE_STRING, 0),
- ROCKSDB_FIELD_INFO("VALUE", sizeof(uint64_t), MYSQL_TYPE_LONGLONG, 0),
- ROCKSDB_FIELD_INFO_END};
+ Column("CF_NAME", Varchar(NAME_LEN + 1), NOT_NULL),
+ Column("STAT_TYPE", Varchar(NAME_LEN + 1), NOT_NULL),
+ Column("VALUE", SLonglong(), NOT_NULL),
+ CEnd()
+};
static int rdb_i_s_cfstats_fill_table(
my_core::THD *const thd, my_core::TABLE_LIST *const tables,
@@ -165,9 +168,9 @@ enum { STAT_TYPE = 0, VALUE };
} // namespace RDB_DBSTATS_FIELD
static ST_FIELD_INFO rdb_i_s_dbstats_fields_info[] = {
- ROCKSDB_FIELD_INFO("STAT_TYPE", NAME_LEN + 1, MYSQL_TYPE_STRING, 0),
- ROCKSDB_FIELD_INFO("VALUE", sizeof(uint64_t), MYSQL_TYPE_LONGLONG, 0),
- ROCKSDB_FIELD_INFO_END};
+ Column("STAT_TYPE", Varchar(NAME_LEN + 1), NOT_NULL),
+ Column("VALUE", SLonglong(), NOT_NULL),
+ CEnd()};
static int rdb_i_s_dbstats_fill_table(
my_core::THD *const thd, my_core::TABLE_LIST *const tables,
@@ -261,13 +264,12 @@ enum { TABLE_SCHEMA = 0, TABLE_NAME, PARTITION_NAME, STAT_TYPE, VALUE };
} // namespace RDB_PERF_CONTEXT_FIELD
static ST_FIELD_INFO rdb_i_s_perf_context_fields_info[] = {
- ROCKSDB_FIELD_INFO("TABLE_SCHEMA", NAME_LEN + 1, MYSQL_TYPE_STRING, 0),
- ROCKSDB_FIELD_INFO("TABLE_NAME", NAME_LEN + 1, MYSQL_TYPE_STRING, 0),
- ROCKSDB_FIELD_INFO("PARTITION_NAME", NAME_LEN + 1, MYSQL_TYPE_STRING,
- MY_I_S_MAYBE_NULL),
- ROCKSDB_FIELD_INFO("STAT_TYPE", NAME_LEN + 1, MYSQL_TYPE_STRING, 0),
- ROCKSDB_FIELD_INFO("VALUE", sizeof(uint64_t), MYSQL_TYPE_LONGLONG, 0),
- ROCKSDB_FIELD_INFO_END};
+ Column("TABLE_SCHEMA", Varchar(NAME_LEN + 1), NOT_NULL),
+ Column("TABLE_NAME", Varchar(NAME_LEN + 1), NOT_NULL),
+ Column("PARTITION_NAME", Varchar(NAME_LEN + 1), NULLABLE),
+ Column("STAT_TYPE", Varchar(NAME_LEN + 1), NOT_NULL),
+ Column("VALUE", SLonglong(), NOT_NULL),
+ CEnd()};
static int rdb_i_s_perf_context_fill_table(
my_core::THD *const thd, my_core::TABLE_LIST *const tables,
@@ -364,9 +366,9 @@ enum { STAT_TYPE = 0, VALUE };
} // namespace RDB_PERF_CONTEXT_GLOBAL_FIELD
static ST_FIELD_INFO rdb_i_s_perf_context_global_fields_info[] = {
- ROCKSDB_FIELD_INFO("STAT_TYPE", NAME_LEN + 1, MYSQL_TYPE_STRING, 0),
- ROCKSDB_FIELD_INFO("VALUE", sizeof(uint64_t), MYSQL_TYPE_LONGLONG, 0),
- ROCKSDB_FIELD_INFO_END};
+ Column("STAT_TYPE", Varchar(NAME_LEN + 1), NOT_NULL),
+ Column("VALUE", SLonglong(), NOT_NULL),
+ CEnd()};
static int rdb_i_s_perf_context_global_fill_table(
my_core::THD *const thd, my_core::TABLE_LIST *const tables,
@@ -434,10 +436,10 @@ enum { CF_NAME = 0, OPTION_TYPE, VALUE };
} // namespace RDB_CFOPTIONS_FIELD
static ST_FIELD_INFO rdb_i_s_cfoptions_fields_info[] = {
- ROCKSDB_FIELD_INFO("CF_NAME", NAME_LEN + 1, MYSQL_TYPE_STRING, 0),
- ROCKSDB_FIELD_INFO("OPTION_TYPE", NAME_LEN + 1, MYSQL_TYPE_STRING, 0),
- ROCKSDB_FIELD_INFO("VALUE", NAME_LEN + 1, MYSQL_TYPE_STRING, 0),
- ROCKSDB_FIELD_INFO_END};
+ Column("CF_NAME", Varchar(NAME_LEN + 1), NOT_NULL),
+ Column("OPTION_TYPE", Varchar(NAME_LEN + 1), NOT_NULL),
+ Column("VALUE", Varchar(NAME_LEN + 1), NOT_NULL),
+ CEnd()};
static int rdb_i_s_cfoptions_fill_table(
my_core::THD *const thd, my_core::TABLE_LIST *const tables,
@@ -696,10 +698,10 @@ enum { TYPE = 0, NAME, VALUE };
}
static ST_FIELD_INFO rdb_i_s_global_info_fields_info[] = {
- ROCKSDB_FIELD_INFO("TYPE", FN_REFLEN + 1, MYSQL_TYPE_STRING, 0),
- ROCKSDB_FIELD_INFO("NAME", FN_REFLEN + 1, MYSQL_TYPE_STRING, 0),
- ROCKSDB_FIELD_INFO("VALUE", FN_REFLEN + 1, MYSQL_TYPE_STRING, 0),
- ROCKSDB_FIELD_INFO_END};
+ Column("TYPE", Varchar(FN_REFLEN + 1), NOT_NULL),
+ Column("NAME", Varchar(FN_REFLEN + 1), NOT_NULL),
+ Column("VALUE", Varchar(FN_REFLEN + 1), NOT_NULL),
+ CEnd()};
/*
* helper function for rdb_i_s_global_info_fill_table
@@ -900,11 +902,11 @@ static int rdb_i_s_compact_stats_fill_table(
}
static ST_FIELD_INFO rdb_i_s_compact_stats_fields_info[] = {
- ROCKSDB_FIELD_INFO("CF_NAME", NAME_LEN + 1, MYSQL_TYPE_STRING, 0),
- ROCKSDB_FIELD_INFO("LEVEL", FN_REFLEN + 1, MYSQL_TYPE_STRING, 0),
- ROCKSDB_FIELD_INFO("TYPE", FN_REFLEN + 1, MYSQL_TYPE_STRING, 0),
- ROCKSDB_FIELD_INFO("VALUE", sizeof(double), MYSQL_TYPE_DOUBLE, 0),
- ROCKSDB_FIELD_INFO_END};
+ Column("CF_NAME", Varchar(NAME_LEN + 1), NOT_NULL),
+ Column("LEVEL", Varchar(FN_REFLEN + 1), NOT_NULL),
+ Column("TYPE", Varchar(FN_REFLEN + 1), NOT_NULL),
+ Column("VALUE", Double(MY_INT64_NUM_DECIMAL_DIGITS), NOT_NULL),
+ CEnd()};
namespace // anonymous namespace = not visible outside this source file
{
@@ -937,22 +939,19 @@ enum {
} // namespace RDB_DDL_FIELD
static ST_FIELD_INFO rdb_i_s_ddl_fields_info[] = {
- ROCKSDB_FIELD_INFO("TABLE_SCHEMA", NAME_LEN + 1, MYSQL_TYPE_STRING, 0),
- ROCKSDB_FIELD_INFO("TABLE_NAME", NAME_LEN + 1, MYSQL_TYPE_STRING, 0),
- ROCKSDB_FIELD_INFO("PARTITION_NAME", NAME_LEN + 1, MYSQL_TYPE_STRING,
- MY_I_S_MAYBE_NULL),
- ROCKSDB_FIELD_INFO("INDEX_NAME", NAME_LEN + 1, MYSQL_TYPE_STRING, 0),
- ROCKSDB_FIELD_INFO("COLUMN_FAMILY", sizeof(uint32_t), MYSQL_TYPE_LONG, 0),
- ROCKSDB_FIELD_INFO("INDEX_NUMBER", sizeof(uint32_t), MYSQL_TYPE_LONG, 0),
- ROCKSDB_FIELD_INFO("INDEX_TYPE", sizeof(uint16_t), MYSQL_TYPE_SHORT, 0),
- ROCKSDB_FIELD_INFO("KV_FORMAT_VERSION", sizeof(uint16_t), MYSQL_TYPE_SHORT,
- 0),
- ROCKSDB_FIELD_INFO("TTL_DURATION", sizeof(uint64), MYSQL_TYPE_LONGLONG, 0),
- ROCKSDB_FIELD_INFO("INDEX_FLAGS", sizeof(uint64), MYSQL_TYPE_LONGLONG, 0),
- ROCKSDB_FIELD_INFO("CF", NAME_LEN + 1, MYSQL_TYPE_STRING, 0),
- ROCKSDB_FIELD_INFO("AUTO_INCREMENT", sizeof(uint64_t), MYSQL_TYPE_LONGLONG,
- MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED),
- ROCKSDB_FIELD_INFO_END};
+ Column("TABLE_SCHEMA", Varchar(NAME_LEN + 1), NOT_NULL),
+ Column("TABLE_NAME", Varchar(NAME_LEN + 1), NOT_NULL),
+ Column("PARTITION_NAME", Varchar(NAME_LEN + 1), NULLABLE),
+ Column("INDEX_NAME", Varchar(NAME_LEN + 1), NOT_NULL),
+ Column("COLUMN_FAMILY", SLong(), NOT_NULL),
+ Column("INDEX_NUMBER", SLong(), NOT_NULL),
+ Column("INDEX_TYPE", SShort(6), NOT_NULL),
+ Column("KV_FORMAT_VERSION", SShort(6), NOT_NULL),
+ Column("TTL_DURATION", SLonglong(), NOT_NULL),
+ Column("INDEX_FLAGS", SLonglong(), NOT_NULL),
+ Column("CF", Varchar(NAME_LEN + 1), NOT_NULL),
+ Column("AUTO_INCREMENT", ULonglong(), NULLABLE),
+ CEnd()};
int Rdb_ddl_scanner::add_table(Rdb_tbl_def *tdef) {
DBUG_ASSERT(tdef != nullptr);
@@ -1155,34 +1154,24 @@ enum {
} // namespace RDB_SST_PROPS_FIELD
static ST_FIELD_INFO rdb_i_s_sst_props_fields_info[] = {
- ROCKSDB_FIELD_INFO("SST_NAME", NAME_LEN + 1, MYSQL_TYPE_STRING, 0),
- ROCKSDB_FIELD_INFO("COLUMN_FAMILY", sizeof(uint32_t), MYSQL_TYPE_LONG, 0),
- ROCKSDB_FIELD_INFO("DATA_BLOCKS", sizeof(int64_t), MYSQL_TYPE_LONGLONG, 0),
- ROCKSDB_FIELD_INFO("ENTRIES", sizeof(int64_t), MYSQL_TYPE_LONGLONG, 0),
- ROCKSDB_FIELD_INFO("RAW_KEY_SIZE", sizeof(int64_t), MYSQL_TYPE_LONGLONG, 0),
- ROCKSDB_FIELD_INFO("RAW_VALUE_SIZE", sizeof(int64_t), MYSQL_TYPE_LONGLONG,
- 0),
- ROCKSDB_FIELD_INFO("DATA_BLOCK_SIZE", sizeof(int64_t), MYSQL_TYPE_LONGLONG,
- 0),
- ROCKSDB_FIELD_INFO("INDEX_BLOCK_SIZE", sizeof(int64_t), MYSQL_TYPE_LONGLONG,
- 0),
- ROCKSDB_FIELD_INFO("INDEX_PARTITIONS", sizeof(uint32_t), MYSQL_TYPE_LONG,
- 0),
- ROCKSDB_FIELD_INFO("TOP_LEVEL_INDEX_SIZE", sizeof(int64_t),
- MYSQL_TYPE_LONGLONG, 0),
- ROCKSDB_FIELD_INFO("FILTER_BLOCK_SIZE", sizeof(int64_t),
- MYSQL_TYPE_LONGLONG, 0),
- ROCKSDB_FIELD_INFO("COMPRESSION_ALGO", NAME_LEN + 1, MYSQL_TYPE_STRING, 0),
- ROCKSDB_FIELD_INFO("CREATION_TIME", sizeof(int64_t), MYSQL_TYPE_LONGLONG,
- 0),
- ROCKSDB_FIELD_INFO("FILE_CREATION_TIME", sizeof(int64_t),
- MYSQL_TYPE_LONGLONG, 0),
- ROCKSDB_FIELD_INFO("OLDEST_KEY_TIME", sizeof(int64_t), MYSQL_TYPE_LONGLONG,
- 0),
- ROCKSDB_FIELD_INFO("FILTER_POLICY", NAME_LEN + 1, MYSQL_TYPE_STRING, 0),
- ROCKSDB_FIELD_INFO("COMPRESSION_OPTIONS", NAME_LEN + 1, MYSQL_TYPE_STRING,
- 0),
- ROCKSDB_FIELD_INFO_END};
+ Column("SST_NAME", Varchar(NAME_LEN + 1), NOT_NULL),
+ Column("COLUMN_FAMILY", SLong(), NOT_NULL),
+ Column("DATA_BLOCKS", SLonglong(), NOT_NULL),
+ Column("ENTRIES", SLonglong(), NOT_NULL),
+ Column("RAW_KEY_SIZE", SLonglong(), NOT_NULL),
+ Column("RAW_VALUE_SIZE", SLonglong(), NOT_NULL),
+ Column("DATA_BLOCK_SIZE", SLonglong(), NOT_NULL),
+ Column("INDEX_BLOCK_SIZE", SLonglong(), NOT_NULL),
+ Column("INDEX_PARTITIONS", SLong(), NOT_NULL),
+ Column("TOP_LEVEL_INDEX_SIZE", SLonglong(), NOT_NULL),
+ Column("FILTER_BLOCK_SIZE", SLonglong(), NOT_NULL),
+ Column("COMPRESSION_ALGO", Varchar(NAME_LEN + 1), NOT_NULL),
+ Column("CREATION_TIME", SLonglong(), NOT_NULL),
+ Column("FILE_CREATION_TIME", SLonglong(), NOT_NULL),
+ Column("OLDEST_KEY_TIME", SLonglong(), NOT_NULL),
+ Column("FILTER_POLICY", Varchar(NAME_LEN + 1), NOT_NULL),
+ Column("COMPRESSION_OPTIONS", Varchar(NAME_LEN + 1), NOT_NULL),
+ CEnd()};
static int rdb_i_s_sst_props_fill_table(
my_core::THD *const thd, my_core::TABLE_LIST *const tables,
@@ -1328,20 +1317,17 @@ static ST_FIELD_INFO rdb_i_s_index_file_map_fields_info[] = {
* SST_NAME => the name of the SST file containing some indexes
* NUM_ROWS => the number of entries of this index id in this SST file
* DATA_SIZE => the data size stored in this SST file for this index id */
- ROCKSDB_FIELD_INFO("COLUMN_FAMILY", sizeof(uint32_t), MYSQL_TYPE_LONG, 0),
- ROCKSDB_FIELD_INFO("INDEX_NUMBER", sizeof(uint32_t), MYSQL_TYPE_LONG, 0),
- ROCKSDB_FIELD_INFO("SST_NAME", NAME_LEN + 1, MYSQL_TYPE_STRING, 0),
- ROCKSDB_FIELD_INFO("NUM_ROWS", sizeof(int64_t), MYSQL_TYPE_LONGLONG, 0),
- ROCKSDB_FIELD_INFO("DATA_SIZE", sizeof(int64_t), MYSQL_TYPE_LONGLONG, 0),
- ROCKSDB_FIELD_INFO("ENTRY_DELETES", sizeof(int64_t), MYSQL_TYPE_LONGLONG,
- 0),
- ROCKSDB_FIELD_INFO("ENTRY_SINGLEDELETES", sizeof(int64_t),
- MYSQL_TYPE_LONGLONG, 0),
- ROCKSDB_FIELD_INFO("ENTRY_MERGES", sizeof(int64_t), MYSQL_TYPE_LONGLONG, 0),
- ROCKSDB_FIELD_INFO("ENTRY_OTHERS", sizeof(int64_t), MYSQL_TYPE_LONGLONG, 0),
- ROCKSDB_FIELD_INFO("DISTINCT_KEYS_PREFIX", MAX_REF_PARTS * 25,
- MYSQL_TYPE_STRING, 0),
- ROCKSDB_FIELD_INFO_END};
+ Column("COLUMN_FAMILY", SLong(), NOT_NULL),
+ Column("INDEX_NUMBER", SLong(), NOT_NULL),
+ Column("SST_NAME", Varchar(NAME_LEN + 1), NOT_NULL),
+ Column("NUM_ROWS", SLonglong(), NOT_NULL),
+ Column("DATA_SIZE", SLonglong(), NOT_NULL),
+ Column("ENTRY_DELETES", SLonglong(), NOT_NULL),
+ Column("ENTRY_SINGLEDELETES", SLonglong(), NOT_NULL),
+ Column("ENTRY_MERGES", SLonglong(), NOT_NULL),
+ Column("ENTRY_OTHERS", SLonglong(), NOT_NULL),
+ Column("DISTINCT_KEYS_PREFIX",Varchar(MAX_REF_PARTS * 25), NOT_NULL),
+ CEnd()};
/* Fill the information_schema.rocksdb_index_file_map virtual table */
static int rdb_i_s_index_file_map_fill_table(
@@ -1475,12 +1461,11 @@ enum { COLUMN_FAMILY_ID = 0, TRANSACTION_ID, KEY, MODE };
} // namespace RDB_LOCKS_FIELD
static ST_FIELD_INFO rdb_i_s_lock_info_fields_info[] = {
- ROCKSDB_FIELD_INFO("COLUMN_FAMILY_ID", sizeof(uint32_t), MYSQL_TYPE_LONG,
- 0),
- ROCKSDB_FIELD_INFO("TRANSACTION_ID", sizeof(uint32_t), MYSQL_TYPE_LONG, 0),
- ROCKSDB_FIELD_INFO("KEY", FN_REFLEN + 1, MYSQL_TYPE_STRING, 0),
- ROCKSDB_FIELD_INFO("MODE", 32, MYSQL_TYPE_STRING, 0),
- ROCKSDB_FIELD_INFO_END};
+ Column("COLUMN_FAMILY_ID", SLong(), NOT_NULL),
+ Column("TRANSACTION_ID", SLong(), NOT_NULL),
+ Column("KEY", Varchar(FN_REFLEN + 1), NOT_NULL),
+ Column("MODE", Varchar(32), NOT_NULL),
+ CEnd()};
/* Fill the information_schema.rocksdb_locks virtual table */
static int rdb_i_s_lock_info_fill_table(
@@ -1577,27 +1562,22 @@ enum {
} // namespace RDB_TRX_FIELD
static ST_FIELD_INFO rdb_i_s_trx_info_fields_info[] = {
- ROCKSDB_FIELD_INFO("TRANSACTION_ID", sizeof(ulonglong), MYSQL_TYPE_LONGLONG,
- 0),
- ROCKSDB_FIELD_INFO("STATE", NAME_LEN + 1, MYSQL_TYPE_STRING, 0),
- ROCKSDB_FIELD_INFO("NAME", NAME_LEN + 1, MYSQL_TYPE_STRING, 0),
- ROCKSDB_FIELD_INFO("WRITE_COUNT", sizeof(ulonglong), MYSQL_TYPE_LONGLONG,
- 0),
- ROCKSDB_FIELD_INFO("LOCK_COUNT", sizeof(ulonglong), MYSQL_TYPE_LONGLONG, 0),
- ROCKSDB_FIELD_INFO("TIMEOUT_SEC", sizeof(uint32_t), MYSQL_TYPE_LONG, 0),
- ROCKSDB_FIELD_INFO("WAITING_KEY", FN_REFLEN + 1, MYSQL_TYPE_STRING, 0),
- ROCKSDB_FIELD_INFO("WAITING_COLUMN_FAMILY_ID", sizeof(uint32_t),
- MYSQL_TYPE_LONG, 0),
- ROCKSDB_FIELD_INFO("IS_REPLICATION", sizeof(uint32_t), MYSQL_TYPE_LONG, 0),
- ROCKSDB_FIELD_INFO("SKIP_TRX_API", sizeof(uint32_t), MYSQL_TYPE_LONG, 0),
- ROCKSDB_FIELD_INFO("READ_ONLY", sizeof(uint32_t), MYSQL_TYPE_LONG, 0),
- ROCKSDB_FIELD_INFO("HAS_DEADLOCK_DETECTION", sizeof(uint32_t),
- MYSQL_TYPE_LONG, 0),
- ROCKSDB_FIELD_INFO("NUM_ONGOING_BULKLOAD", sizeof(uint32_t),
- MYSQL_TYPE_LONG, 0),
- ROCKSDB_FIELD_INFO("THREAD_ID", sizeof(ulong), MYSQL_TYPE_LONG, 0),
- ROCKSDB_FIELD_INFO("QUERY", NAME_LEN + 1, MYSQL_TYPE_STRING, 0),
- ROCKSDB_FIELD_INFO_END};
+ Column("TRANSACTION_ID", SLonglong(), NOT_NULL),
+ Column("STATE", Varchar(NAME_LEN + 1), NOT_NULL),
+ Column("NAME", Varchar(NAME_LEN + 1), NOT_NULL),
+ Column("WRITE_COUNT", SLonglong(), NOT_NULL),
+ Column("LOCK_COUNT", SLonglong(), NOT_NULL),
+ Column("TIMEOUT_SEC", SLong(), NOT_NULL),
+ Column("WAITING_KEY", Varchar(FN_REFLEN + 1), NOT_NULL),
+ Column("WAITING_COLUMN_FAMILY_ID",SLong(), NOT_NULL),
+ Column("IS_REPLICATION", SLong(), NOT_NULL),
+ Column("SKIP_TRX_API", SLong(), NOT_NULL),
+ Column("READ_ONLY", SLong(), NOT_NULL),
+ Column("HAS_DEADLOCK_DETECTION", SLong(), NOT_NULL),
+ Column("NUM_ONGOING_BULKLOAD", SLong(), NOT_NULL),
+ Column("THREAD_ID", SLong(), NOT_NULL),
+ Column("QUERY", Varchar(NAME_LEN + 1), NOT_NULL),
+ CEnd()};
/* Fill the information_schema.rocksdb_trx virtual table */
static int rdb_i_s_trx_info_fill_table(
@@ -1704,19 +1684,16 @@ enum {
} // namespace RDB_DEADLOCK_FIELD
static ST_FIELD_INFO rdb_i_s_deadlock_info_fields_info[] = {
- ROCKSDB_FIELD_INFO("DEADLOCK_ID", sizeof(ulonglong), MYSQL_TYPE_LONGLONG,
- 0),
- ROCKSDB_FIELD_INFO("TIMESTAMP", sizeof(ulonglong), MYSQL_TYPE_LONGLONG, 0),
- ROCKSDB_FIELD_INFO("TRANSACTION_ID", sizeof(ulonglong), MYSQL_TYPE_LONGLONG,
- 0),
- ROCKSDB_FIELD_INFO("CF_NAME", NAME_LEN + 1, MYSQL_TYPE_STRING, 0),
- ROCKSDB_FIELD_INFO("WAITING_KEY", FN_REFLEN + 1, MYSQL_TYPE_STRING, 0),
- ROCKSDB_FIELD_INFO("LOCK_TYPE", NAME_LEN + 1, MYSQL_TYPE_STRING, 0),
- ROCKSDB_FIELD_INFO("INDEX_NAME", NAME_LEN + 1, MYSQL_TYPE_STRING, 0),
- ROCKSDB_FIELD_INFO("TABLE_NAME", NAME_LEN + 1, MYSQL_TYPE_STRING, 0),
- ROCKSDB_FIELD_INFO("ROLLED_BACK", sizeof(ulonglong), MYSQL_TYPE_LONGLONG,
- 0),
- ROCKSDB_FIELD_INFO_END};
+ Column("DEADLOCK_ID", SLonglong(), NOT_NULL),
+ Column("TIMESTAMP", SLonglong(), NOT_NULL),
+ Column("TRANSACTION_ID", SLonglong(), NOT_NULL),
+ Column("CF_NAME", Varchar(NAME_LEN + 1), NOT_NULL),
+ Column("WAITING_KEY", Varchar(FN_REFLEN + 1), NOT_NULL),
+ Column("LOCK_TYPE", Varchar(NAME_LEN + 1), NOT_NULL),
+ Column("INDEX_NAME", Varchar(NAME_LEN + 1), NOT_NULL),
+ Column("TABLE_NAME", Varchar(NAME_LEN + 1), NOT_NULL),
+ Column("ROLLED_BACK", SLonglong(), NOT_NULL),
+ CEnd()};
/* Fill the information_schema.rocksdb_trx virtual table */
static int rdb_i_s_deadlock_info_fill_table(
diff --git a/storage/sphinx/ha_sphinx.cc b/storage/sphinx/ha_sphinx.cc
index 5cb9230b707..55b39b00c54 100644
--- a/storage/sphinx/ha_sphinx.cc
+++ b/storage/sphinx/ha_sphinx.cc
@@ -742,7 +742,6 @@ static int sphinx_init_func ( void * p )
#if MYSQL_VERSION_ID > 50100
handlerton * hton = (handlerton*) p;
- hton->state = SHOW_OPTION_YES;
hton->db_type = DB_TYPE_AUTOASSIGN;
hton->create = sphinx_create_handler;
hton->close_connection = sphinx_close_connection;
@@ -769,10 +768,8 @@ static int sphinx_close_connection ( handlerton * hton, THD * thd )
{
// deallocate common handler data
SPH_ENTER_FUNC();
- void ** tmp = thd_ha_data ( thd, hton );
- CSphTLS * pTls = (CSphTLS *) (*tmp);
+ CSphTLS * pTls = (CSphTLS *) thd_get_ha_data ( thd, hton );
SafeDelete ( pTls );
- *tmp = NULL;
SPH_RET(0);
}
@@ -844,7 +841,7 @@ bool sphinx_show_status ( THD * thd )
#if MYSQL_VERSION_ID>50100
// 5.1.x style stats
- CSphTLS * pTls = (CSphTLS*) ( *thd_ha_data ( thd, hton ) );
+ CSphTLS * pTls = (CSphTLS*) ( thd_get_ha_data ( thd, hton ) );
#define LOC_STATS(_key,_keylen,_val,_vallen) \
stat_print ( thd, sphinx_hton_name, strlen(sphinx_hton_name), _key, _keylen, _val, _vallen );
@@ -2118,11 +2115,7 @@ int ha_sphinx::open ( const char * name, int, uint )
thr_lock_data_init ( &m_pShare->m_tLock, &m_tLock, NULL );
- #if MYSQL_VERSION_ID>50100
- *thd_ha_data ( table->in_use, ht ) = NULL;
- #else
- table->in_use->ha_data [ sphinx_hton.slot ] = NULL;
- #endif
+ thd_set_ha_data ( table->in_use, ht, 0 );
SPH_RET(0);
}
@@ -2805,23 +2798,16 @@ CSphSEThreadTable * ha_sphinx::GetTls()
{
SPH_ENTER_METHOD()
// where do we store that pointer in today's version?
- CSphTLS ** ppTls;
-#if MYSQL_VERSION_ID>50100
- ppTls = (CSphTLS**) thd_ha_data ( table->in_use, ht );
-#else
- ppTls = (CSphTLS**) &current_thd->ha_data[sphinx_hton.slot];
-#endif // >50100
+ CSphTLS * pTls = (CSphTLS*) thd_get_ha_data ( table->in_use, ht );
CSphSEThreadTable * pTable = NULL;
// allocate if needed
- if ( !*ppTls )
- {
- *ppTls = new CSphTLS ( this );
- pTable = (*ppTls)->m_pHeadTable;
- } else
+ if ( !pTls )
{
- pTable = (*ppTls)->m_pHeadTable;
+ pTls = new CSphTLS ( this );
+ thd_set_ha_data(table->in_use, ht, pTls);
}
+ pTable = pTls->m_pHeadTable;
while ( pTable && pTable->m_pHandler!=this )
pTable = pTable->m_pTableNext;
@@ -2829,8 +2815,8 @@ CSphSEThreadTable * ha_sphinx::GetTls()
if ( !pTable )
{
pTable = new CSphSEThreadTable ( this );
- pTable->m_pTableNext = (*ppTls)->m_pHeadTable;
- (*ppTls)->m_pHeadTable = pTable;
+ pTable->m_pTableNext = pTls->m_pHeadTable;
+ pTls->m_pHeadTable = pTable;
}
// errors will be handled by caller
@@ -3532,7 +3518,7 @@ CSphSEStats * sphinx_get_stats ( THD * thd, SHOW_VAR * out )
#if MYSQL_VERSION_ID>50100
if ( sphinx_hton_ptr )
{
- CSphTLS * pTls = (CSphTLS *) *thd_ha_data ( thd, sphinx_hton_ptr );
+ CSphTLS * pTls = (CSphTLS *) thd_get_ha_data ( thd, sphinx_hton_ptr );
if ( pTls && pTls->m_pHeadTable && pTls->m_pHeadTable->m_bStats )
return &pTls->m_pHeadTable->m_tStats;
@@ -3597,7 +3583,7 @@ int sphinx_showfunc_words ( THD * thd, SHOW_VAR * out, char * sBuffer )
#if MYSQL_VERSION_ID>50100
if ( sphinx_hton_ptr )
{
- CSphTLS * pTls = (CSphTLS *) *thd_ha_data ( thd, sphinx_hton_ptr );
+ CSphTLS * pTls = (CSphTLS *) thd_get_ha_data ( thd, sphinx_hton_ptr );
#else
{
CSphTLS * pTls = (CSphTLS *) thd->ha_data[sphinx_hton.slot];
diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc
index 5457bc0ba50..5920f802c9e 100644
--- a/storage/spider/ha_spider.cc
+++ b/storage/spider/ha_spider.cc
@@ -395,15 +395,24 @@ int ha_spider::open(
{
if (!(searched_bitmap = (uchar *)
spider_bulk_malloc(spider_current_trx, 15, MYF(MY_WME),
- &searched_bitmap, sizeof(uchar) * no_bytes_in_map(table->read_set),
- &ft_discard_bitmap, sizeof(uchar) * no_bytes_in_map(table->read_set),
- &position_bitmap, sizeof(uchar) * no_bytes_in_map(table->read_set),
- &partition_handler_share, sizeof(SPIDER_PARTITION_HANDLER_SHARE),
- &idx_read_bitmap, sizeof(uchar) * no_bytes_in_map(table->read_set),
- &idx_write_bitmap, sizeof(uchar) * no_bytes_in_map(table->read_set),
- &rnd_read_bitmap, sizeof(uchar) * no_bytes_in_map(table->read_set),
- &rnd_write_bitmap, sizeof(uchar) * no_bytes_in_map(table->read_set),
- &pt_handler_share_handlers, sizeof(ha_spider *) * part_num,
+ &searched_bitmap,
+ (uint) sizeof(uchar) * no_bytes_in_map(table->read_set),
+ &ft_discard_bitmap,
+ (uint) sizeof(uchar) * no_bytes_in_map(table->read_set),
+ &position_bitmap,
+ (uint) sizeof(uchar) * no_bytes_in_map(table->read_set),
+ &partition_handler_share,
+ (uint) sizeof(SPIDER_PARTITION_HANDLER_SHARE),
+ &idx_read_bitmap,
+ (uint) sizeof(uchar) * no_bytes_in_map(table->read_set),
+ &idx_write_bitmap,
+ (uint) sizeof(uchar) * no_bytes_in_map(table->read_set),
+ &rnd_read_bitmap,
+ (uint) sizeof(uchar) * no_bytes_in_map(table->read_set),
+ &rnd_write_bitmap,
+ (uint) sizeof(uchar) * no_bytes_in_map(table->read_set),
+ &pt_handler_share_handlers,
+ (uint) sizeof(ha_spider *) * part_num,
NullS))
) {
error_num = HA_ERR_OUT_OF_MEM;
@@ -11389,7 +11398,7 @@ int ha_spider::create(
if (!(tmp_share.static_key_cardinality = (longlong *)
spider_bulk_malloc(spider_current_trx, 246, MYF(MY_WME),
&tmp_share.static_key_cardinality,
- sizeof(*tmp_share.static_key_cardinality) * form->s->keys,
+ (uint) (sizeof(*tmp_share.static_key_cardinality) * form->s->keys),
NullS))
) {
error_num = HA_ERR_OUT_OF_MEM;
@@ -12198,7 +12207,8 @@ int ha_spider::info_push(
spider_free(spider_current_trx, hs_pushed_ret_fields, MYF(0));
if (!(hs_pushed_ret_fields = (uint32 *)
spider_bulk_malloc(spider_current_trx, 17, MYF(MY_WME),
- &hs_pushed_ret_fields, sizeof(uint32) * hs_pushed_ret_fields_num,
+ &hs_pushed_ret_fields,
+ (uint) (sizeof(uint32) * hs_pushed_ret_fields_num),
NullS))
) {
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
@@ -13762,8 +13772,8 @@ SPIDER_BULK_ACCESS_LINK *ha_spider::create_bulk_access_link()
*/
if (!(bulk_access_link = (SPIDER_BULK_ACCESS_LINK *)
spider_bulk_malloc(spider_current_trx, 168, MYF(MY_WME),
- &bulk_access_link, sizeof(SPIDER_BULK_ACCESS_LINK),
- &ref, ALIGN_SIZE(ref_length) * 2,
+ &bulk_access_link, (uint) (sizeof(SPIDER_BULK_ACCESS_LINK)),
+ &ref, (uint) (ALIGN_SIZE(ref_length) * 2),
NullS))
) {
goto error_bulk_malloc;
diff --git a/storage/spider/spd_conn.cc b/storage/spider/spd_conn.cc
index cf1c5733e71..17631b3c658 100644
--- a/storage/spider/spd_conn.cc
+++ b/storage/spider/spd_conn.cc
@@ -476,30 +476,30 @@ SPIDER_CONN *spider_create_conn(
#endif
if (!(conn = (SPIDER_CONN *)
spider_bulk_malloc(spider_current_trx, 18, MYF(MY_WME | MY_ZEROFILL),
- &conn, sizeof(*conn),
- &tmp_name, share->conn_keys_lengths[link_idx] + 1,
- &tmp_host, share->tgt_hosts_lengths[link_idx] + 1,
+ &conn, (uint) (sizeof(*conn)),
+ &tmp_name, (uint) (share->conn_keys_lengths[link_idx] + 1),
+ &tmp_host, (uint) (share->tgt_hosts_lengths[link_idx] + 1),
&tmp_username,
- share->tgt_usernames_lengths[link_idx] + 1,
+ (uint) (share->tgt_usernames_lengths[link_idx] + 1),
&tmp_password,
- share->tgt_passwords_lengths[link_idx] + 1,
- &tmp_socket, share->tgt_sockets_lengths[link_idx] + 1,
+ (uint) (share->tgt_passwords_lengths[link_idx] + 1),
+ &tmp_socket, (uint) (share->tgt_sockets_lengths[link_idx] + 1),
&tmp_wrapper,
- share->tgt_wrappers_lengths[link_idx] + 1,
- &tmp_ssl_ca, share->tgt_ssl_cas_lengths[link_idx] + 1,
+ (uint) (share->tgt_wrappers_lengths[link_idx] + 1),
+ &tmp_ssl_ca, (uint) (share->tgt_ssl_cas_lengths[link_idx] + 1),
&tmp_ssl_capath,
- share->tgt_ssl_capaths_lengths[link_idx] + 1,
+ (uint) (share->tgt_ssl_capaths_lengths[link_idx] + 1),
&tmp_ssl_cert,
- share->tgt_ssl_certs_lengths[link_idx] + 1,
+ (uint) (share->tgt_ssl_certs_lengths[link_idx] + 1),
&tmp_ssl_cipher,
- share->tgt_ssl_ciphers_lengths[link_idx] + 1,
+ (uint) (share->tgt_ssl_ciphers_lengths[link_idx] + 1),
&tmp_ssl_key,
- share->tgt_ssl_keys_lengths[link_idx] + 1,
+ (uint) (share->tgt_ssl_keys_lengths[link_idx] + 1),
&tmp_default_file,
- share->tgt_default_files_lengths[link_idx] + 1,
+ (uint) (share->tgt_default_files_lengths[link_idx] + 1),
&tmp_default_group,
- share->tgt_default_groups_lengths[link_idx] + 1,
- &need_mon, sizeof(int),
+ (uint) (share->tgt_default_groups_lengths[link_idx] + 1),
+ &need_mon, (uint) (sizeof(int)),
NullS))
) {
*error_num = HA_ERR_OUT_OF_MEM;
@@ -598,13 +598,13 @@ SPIDER_CONN *spider_create_conn(
} else if (conn_kind == SPIDER_CONN_KIND_HS_READ) {
if (!(conn = (SPIDER_CONN *)
spider_bulk_malloc(spider_current_trx, 19, MYF(MY_WME | MY_ZEROFILL),
- &conn, sizeof(*conn),
- &tmp_name, share->hs_read_conn_keys_lengths[link_idx] + 1,
- &tmp_host, share->tgt_hosts_lengths[link_idx] + 1,
- &tmp_socket, share->hs_read_socks_lengths[link_idx] + 1,
+ &conn, (uint) (sizeof(*conn)),
+ &tmp_name, (uint) (share->hs_read_conn_keys_lengths[link_idx] + 1),
+ &tmp_host, (uint) (share->tgt_hosts_lengths[link_idx] + 1),
+ &tmp_socket, (uint) (share->hs_read_socks_lengths[link_idx] + 1),
&tmp_wrapper,
- share->tgt_wrappers_lengths[link_idx] + 1,
- &need_mon, sizeof(int),
+ (uint) (share->tgt_wrappers_lengths[link_idx] + 1),
+ &need_mon, (uint) (sizeof(int)),
NullS))
) {
*error_num = HA_ERR_OUT_OF_MEM;
@@ -640,13 +640,13 @@ SPIDER_CONN *spider_create_conn(
} else {
if (!(conn = (SPIDER_CONN *)
spider_bulk_malloc(spider_current_trx, 20, MYF(MY_WME | MY_ZEROFILL),
- &conn, sizeof(*conn),
- &tmp_name, share->hs_write_conn_keys_lengths[link_idx] + 1,
- &tmp_host, share->tgt_hosts_lengths[link_idx] + 1,
- &tmp_socket, share->hs_write_socks_lengths[link_idx] + 1,
+ &conn, (uint) (sizeof(*conn)),
+ &tmp_name, (uint) (share->hs_write_conn_keys_lengths[link_idx] + 1),
+ &tmp_host, (uint) (share->tgt_hosts_lengths[link_idx] + 1),
+ &tmp_socket, (uint) (share->hs_write_socks_lengths[link_idx] + 1),
&tmp_wrapper,
- share->tgt_wrappers_lengths[link_idx] + 1,
- &need_mon, sizeof(int),
+ (uint) (share->tgt_wrappers_lengths[link_idx] + 1),
+ &need_mon, (uint) (sizeof(int)),
NullS))
) {
*error_num = HA_ERR_OUT_OF_MEM;
@@ -3665,13 +3665,16 @@ int spider_create_mon_threads(
}
if (!(share->bg_mon_thds = (THD **)
spider_bulk_malloc(spider_current_trx, 23, MYF(MY_WME | MY_ZEROFILL),
- &share->bg_mon_thds, sizeof(THD *) * share->all_link_count,
- &share->bg_mon_threads, sizeof(pthread_t) * share->all_link_count,
- &share->bg_mon_mutexes, sizeof(pthread_mutex_t) *
- share->all_link_count,
- &share->bg_mon_conds, sizeof(pthread_cond_t) * share->all_link_count,
+ &share->bg_mon_thds,
+ (uint) (sizeof(THD *) * share->all_link_count),
+ &share->bg_mon_threads,
+ (uint) (sizeof(pthread_t) * share->all_link_count),
+ &share->bg_mon_mutexes,
+ (uint) (sizeof(pthread_mutex_t) * share->all_link_count),
+ &share->bg_mon_conds,
+ (uint) (sizeof(pthread_cond_t) * share->all_link_count),
&share->bg_mon_sleep_conds,
- sizeof(pthread_cond_t) * share->all_link_count,
+ (uint) (sizeof(pthread_cond_t) * share->all_link_count),
NullS))
) {
error_num = HA_ERR_OUT_OF_MEM;
diff --git a/storage/spider/spd_copy_tables.cc b/storage/spider/spd_copy_tables.cc
index 13c53220b16..1a472e2c12b 100644
--- a/storage/spider/spd_copy_tables.cc
+++ b/storage/spider/spd_copy_tables.cc
@@ -390,12 +390,15 @@ int spider_udf_get_copy_tgt_tables(
do {
if (!(table_conn = (SPIDER_COPY_TABLE_CONN *)
spider_bulk_malloc(spider_current_trx, 25, MYF(MY_WME | MY_ZEROFILL),
- &table_conn, sizeof(SPIDER_COPY_TABLE_CONN),
- &tmp_share, sizeof(SPIDER_SHARE),
- &tmp_connect_info, sizeof(char *) * SPIDER_TMP_SHARE_CHAR_PTR_COUNT,
- &tmp_connect_info_length, sizeof(uint) * SPIDER_TMP_SHARE_UINT_COUNT,
- &tmp_long, sizeof(long) * SPIDER_TMP_SHARE_LONG_COUNT,
- &tmp_longlong, sizeof(longlong) * SPIDER_TMP_SHARE_LONGLONG_COUNT,
+ &table_conn, (uint) (sizeof(SPIDER_COPY_TABLE_CONN)),
+ &tmp_share, (uint) (sizeof(SPIDER_SHARE)),
+ &tmp_connect_info,
+ (uint) (sizeof(char *) * SPIDER_TMP_SHARE_CHAR_PTR_COUNT),
+ &tmp_connect_info_length,
+ (uint) (sizeof(uint) * SPIDER_TMP_SHARE_UINT_COUNT),
+ &tmp_long, (uint) (sizeof(long) * SPIDER_TMP_SHARE_LONG_COUNT),
+ &tmp_longlong,
+ (uint) (sizeof(longlong) * SPIDER_TMP_SHARE_LONGLONG_COUNT),
NullS))
) {
spider_sys_index_end(table_tables);
@@ -706,12 +709,12 @@ int spider_udf_copy_tables_create_table_list(
if (!(copy_tables->link_idxs[0] = (int *)
spider_bulk_malloc(spider_current_trx, 26, MYF(MY_WME | MY_ZEROFILL),
&copy_tables->link_idxs[0],
- sizeof(int) * copy_tables->link_idx_count[0],
+ (uint) (sizeof(int) * copy_tables->link_idx_count[0]),
&copy_tables->link_idxs[1],
- sizeof(int) * copy_tables->link_idx_count[1],
- &tmp_name_ptr, sizeof(char) * (
+ (uint) (sizeof(int) * copy_tables->link_idx_count[1]),
+ &tmp_name_ptr, (uint) (sizeof(char) * (
spider_table_name_length * 2 + copy_tables->database_length + 3
- ),
+ )),
NullS))
) {
my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM);
@@ -906,7 +909,7 @@ long long spider_copy_tables_body(
if (!(copy_tables = (SPIDER_COPY_TABLES *)
spider_bulk_malloc(spider_current_trx, 27, MYF(MY_WME | MY_ZEROFILL),
- &copy_tables, sizeof(SPIDER_COPY_TABLES),
+ &copy_tables, (uint) (sizeof(SPIDER_COPY_TABLES)),
NullS))
) {
my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM);
diff --git a/storage/spider/spd_db_conn.cc b/storage/spider/spd_db_conn.cc
index 6be75dad17f..aa82f0b0fb1 100644
--- a/storage/spider/spd_db_conn.cc
+++ b/storage/spider/spd_db_conn.cc
@@ -2718,7 +2718,8 @@ int spider_db_fetch_for_item_sum_func(
if (!spider->direct_aggregate_item_first)
{
if (!spider_bulk_malloc(spider_current_trx, 240, MYF(MY_WME),
- &spider->direct_aggregate_item_first, sizeof(SPIDER_ITEM_HLD),
+ &spider->direct_aggregate_item_first,
+ (uint) (sizeof(SPIDER_ITEM_HLD)),
NullS)
) {
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
@@ -2737,7 +2738,7 @@ int spider_db_fetch_for_item_sum_func(
{
if (!spider_bulk_malloc(spider_current_trx, 241, MYF(MY_WME),
&spider->direct_aggregate_item_current->next,
- sizeof(SPIDER_ITEM_HLD), NullS)
+ (uint) (sizeof(SPIDER_ITEM_HLD)), NullS)
) {
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
}
@@ -4109,8 +4110,8 @@ int spider_db_store_result(
current->field_count = field_count;
if (!(position = (SPIDER_POSITION *)
spider_bulk_malloc(spider_current_trx, 7, MYF(MY_WME | MY_ZEROFILL),
- &position, sizeof(SPIDER_POSITION) * page_size,
- &tmp_row, sizeof(char*) * field_count,
+ &position, (uint) (sizeof(SPIDER_POSITION) * page_size),
+ &tmp_row, (uint) (sizeof(SPIDER_DB_ROW) * field_count),
NullS))
)
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
@@ -5744,6 +5745,7 @@ int spider_db_simple_action(
#endif
default:
DBUG_ASSERT(0);
+ error_num = 0;
break;
}
DBUG_RETURN(error_num);
@@ -9208,7 +9210,7 @@ int spider_db_open_item_ref(
if (
(*(item_ref->ref))->type() != Item::CACHE_ITEM &&
item_ref->ref_type() != Item_ref::VIEW_REF &&
- !item_ref->table_name &&
+ !item_ref->table_name.str &&
item_ref->name.str &&
item_ref->alias_name_used
)
@@ -10984,8 +10986,8 @@ int spider_db_udf_copy_tables(
DBUG_ENTER("spider_db_udf_copy_tables");
if (!(last_row_pos = (ulong *)
spider_bulk_malloc(spider_current_trx, 30, MYF(MY_WME),
- &last_row_pos, sizeof(ulong) * table->s->fields,
- &last_lengths, sizeof(ulong) * table->s->fields,
+ &last_row_pos, (uint) (sizeof(ulong) * table->s->fields),
+ &last_lengths, (uint) (sizeof(ulong) * table->s->fields),
NullS))
) {
my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM);
diff --git a/storage/spider/spd_db_handlersocket.cc b/storage/spider/spd_db_handlersocket.cc
index d4872e6ae81..091f48a2460 100644
--- a/storage/spider/spd_db_handlersocket.cc
+++ b/storage/spider/spd_db_handlersocket.cc
@@ -505,8 +505,8 @@ SPIDER_DB_ROW *spider_db_handlersocket_row::clone()
DBUG_RETURN(NULL);
}
if (!spider_bulk_malloc(spider_current_trx, 169, MYF(MY_WME),
- &clone_row->hs_row, sizeof(SPIDER_HS_STRING_REF) * field_count,
- &tmp_char, row_size,
+ &clone_row->hs_row, (uint) (sizeof(SPIDER_HS_STRING_REF) * field_count),
+ &tmp_char, (uint) (row_size),
NullS)
) {
delete clone_row;
diff --git a/storage/spider/spd_db_include.h b/storage/spider/spd_db_include.h
index 2f401fa8ff8..56a88a2b7bc 100644
--- a/storage/spider/spd_db_include.h
+++ b/storage/spider/spd_db_include.h
@@ -20,6 +20,10 @@
#define SPIDER_DBTON_SIZE 15
+#ifndef SIZEOF_STORED_DOUBLE
+#define SIZEOF_STORED_DOUBLE 8
+#endif
+
#define SPIDER_DB_WRAPPER_MYSQL "mysql"
#define SPIDER_DB_WRAPPER_MARIADB "mariadb"
diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc
index c4d6f08c394..6b551804c87 100644
--- a/storage/spider/spd_db_mysql.cc
+++ b/storage/spider/spd_db_mysql.cc
@@ -47,7 +47,7 @@
#include "spd_sys_table.h"
#include "spd_table.h"
-extern struct charset_info_st *spd_charset_utf8_bin;
+extern struct charset_info_st *spd_charset_utf8mb3_bin;
extern bool volatile *spd_abort_loop;
extern handlerton *spider_hton_ptr;
@@ -540,9 +540,9 @@ SPIDER_DB_ROW *spider_db_mbase_row::clone()
row_size = record_size + field_count;
}
if (!spider_bulk_malloc(spider_current_trx, 29, MYF(MY_WME),
- &clone_row->row, sizeof(char*) * field_count,
- &tmp_char, row_size,
- &clone_row->lengths, sizeof(ulong) * field_count,
+ &clone_row->row, (uint) (sizeof(char*) * field_count),
+ &tmp_char, (uint) (row_size),
+ &clone_row->lengths, (uint) (sizeof(ulong) * field_count),
NullS)
) {
delete clone_row;
@@ -1860,7 +1860,7 @@ int spider_db_mbase::init()
DBUG_ENTER("spider_db_mbase::init");
DBUG_PRINT("info",("spider this=%p", this));
if (
- my_hash_init(&lock_table_hash, spd_charset_utf8_bin, 32, 0, 0,
+ my_hash_init(&lock_table_hash, spd_charset_utf8mb3_bin, 32, 0, 0,
(my_hash_get_key) spider_link_get_key, 0, 0)
) {
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
@@ -14993,7 +14993,7 @@ int spider_mbase_handler::init_union_table_name_pos()
if (!union_table_name_pos_first)
{
if (!spider_bulk_malloc(spider_current_trx, 236, MYF(MY_WME),
- &union_table_name_pos_first, sizeof(SPIDER_INT_HLD),
+ &union_table_name_pos_first, (uint) (sizeof(SPIDER_INT_HLD)),
NullS)
) {
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
@@ -15014,7 +15014,7 @@ int spider_mbase_handler::set_union_table_name_pos()
if (!union_table_name_pos_current->next)
{
if (!spider_bulk_malloc(spider_current_trx, 237, MYF(MY_WME),
- &union_table_name_pos_current->next, sizeof(SPIDER_INT_HLD),
+ &union_table_name_pos_current->next, (uint) (sizeof(SPIDER_INT_HLD)),
NullS)
) {
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
diff --git a/storage/spider/spd_db_oracle.cc b/storage/spider/spd_db_oracle.cc
index 097130169c7..e56cb31a32c 100644
--- a/storage/spider/spd_db_oracle.cc
+++ b/storage/spider/spd_db_oracle.cc
@@ -48,7 +48,7 @@
#include "spd_sys_table.h"
#include "spd_table.h"
-extern struct charset_info_st *spd_charset_utf8_bin;
+extern struct charset_info_st *spd_charset_utf8mb3_bin;
extern handlerton *spider_hton_ptr;
extern pthread_mutex_t spider_open_conn_mutex;
@@ -588,16 +588,16 @@ int spider_db_oracle_row::init()
if (
!(ind = (sb2 *)
spider_bulk_malloc(spider_current_trx, 161, MYF(MY_WME | MY_ZEROFILL),
- &ind, sizeof(sb2) * field_count,
- &rlen, sizeof(ub2) * field_count,
- &coltp, sizeof(ub2) * field_count,
- &colsz, sizeof(ub2) * field_count,
- &row_size, sizeof(ulong) * field_count,
- &val, sizeof(char *) * field_count,
- &tmp_val, MAX_FIELD_WIDTH * field_count,
- &defnp, sizeof(OCIDefine *) * field_count,
- &lobhp, sizeof(OCILobLocator *) * field_count,
- &colhp, sizeof(OCIParam *) * field_count,
+ &ind, (uint) (sizeof(sb2) * field_count),
+ &rlen, (uint) (sizeof(ub2) * field_count),
+ &coltp, (uint) (sizeof(ub2) * field_count),
+ &colsz, (uint) (sizeof(ub2) * field_count),
+ &row_size, (uint) (sizeof(ulong) * field_count),
+ &val, (uint) (sizeof(char *) * field_count),
+ &tmp_val, (uint) (MAX_FIELD_WIDTH * field_count),
+ &defnp, (uint) (sizeof(OCIDefine *) * field_count),
+ &lobhp, (uint) (sizeof(OCILobLocator *) * field_count),
+ &colhp, (uint) (sizeof(OCIParam *) * field_count),
NullS)
) ||
!(val_str = new spider_string[field_count])
@@ -1148,7 +1148,7 @@ int spider_db_oracle::init()
DBUG_ENTER("spider_db_oracle::init");
DBUG_PRINT("info",("spider this=%p", this));
if (
- my_hash_init(&lock_table_hash, spd_charset_utf8_bin, 32, 0, 0,
+ my_hash_init(&lock_table_hash, spd_charset_utf8mb3_bin, 32, 0, 0,
(my_hash_get_key) spider_link_get_key, 0, 0)
) {
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
@@ -12597,7 +12597,7 @@ int spider_oracle_handler::init_union_table_name_pos()
if (!union_table_name_pos_first)
{
if (!spider_bulk_malloc(spider_current_trx, 238, MYF(MY_WME),
- &union_table_name_pos_first, sizeof(SPIDER_INT_HLD),
+ &union_table_name_pos_first, (uint) (sizeof(SPIDER_INT_HLD)),
NullS)
) {
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
@@ -12618,7 +12618,7 @@ int spider_oracle_handler::set_union_table_name_pos()
if (!union_table_name_pos_current->next)
{
if (!spider_bulk_malloc(spider_current_trx, 239, MYF(MY_WME),
- &union_table_name_pos_current->next, sizeof(SPIDER_INT_HLD),
+ &union_table_name_pos_current->next, (uint) (sizeof(SPIDER_INT_HLD)),
NullS)
) {
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
diff --git a/storage/spider/spd_direct_sql.cc b/storage/spider/spd_direct_sql.cc
index 7237d0877a7..7bf0b91a4a7 100644
--- a/storage/spider/spd_direct_sql.cc
+++ b/storage/spider/spd_direct_sql.cc
@@ -1,4 +1,5 @@
-/* Copyright (C) 2009-2018 Kentoku Shiba
+/* Copyright (C) 2009-2019 Kentoku Shiba
+ Copyright (C) 2019 MariaDB corp
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
@@ -117,31 +118,32 @@ int spider_udf_direct_sql_create_table_list(
#if MYSQL_VERSION_ID < 50500
if (!(direct_sql->db_names = (char**)
spider_bulk_malloc(spider_current_trx, 31, MYF(MY_WME | MY_ZEROFILL),
- &direct_sql->db_names, sizeof(char*) * table_count,
- &direct_sql->table_names, sizeof(char*) * table_count,
- &direct_sql->tables, sizeof(TABLE*) * table_count,
- &tmp_name_ptr, sizeof(char) * (
+ &direct_sql->db_names, (uint) (sizeof(char*) * table_count),
+ &direct_sql->table_names, (uint) (sizeof(char*) * table_count),
+ &direct_sql->tables, (uint) (sizeof(TABLE*) * table_count),
+ &tmp_name_ptr, (uint) (sizeof(char) * (
table_name_list_length +
thd->db_length * table_count +
2 * table_count
- ),
- &direct_sql->iop, sizeof(int) * table_count,
+ )),
+ &direct_sql->iop, (uint) (sizeof(int) * table_count),
NullS))
)
#else
if (!(direct_sql->db_names = (char**)
spider_bulk_malloc(spider_current_trx, 31, MYF(MY_WME | MY_ZEROFILL),
- &direct_sql->db_names, sizeof(char*) * table_count,
- &direct_sql->table_names, sizeof(char*) * table_count,
- &direct_sql->tables, sizeof(TABLE*) * table_count,
- &tmp_name_ptr, sizeof(char) * (
+ &direct_sql->db_names, (uint) (sizeof(char*) * table_count),
+ &direct_sql->table_names, (uint) (sizeof(char*) * table_count),
+ &direct_sql->tables, (uint) (sizeof(TABLE*) * table_count),
+ &tmp_name_ptr, (uint) (sizeof(char) * (
table_name_list_length +
SPIDER_THD_db_length(thd) * table_count +
2 * table_count
- ),
- &direct_sql->iop, sizeof(int) * table_count,
- &direct_sql->table_list, sizeof(TABLE_LIST) * table_count,
- &direct_sql->real_table_bitmap, sizeof(uchar) * ((table_count + 7) / 8),
+ )),
+ &direct_sql->iop, (uint) (sizeof(int) * table_count),
+ &direct_sql->table_list, (uint) (sizeof(TABLE_LIST) * table_count),
+ &direct_sql->real_table_bitmap,
+ (uint) (sizeof(uchar) * ((table_count + 7) / 8)),
NullS))
)
#endif
@@ -412,23 +414,23 @@ SPIDER_CONN *spider_udf_direct_sql_create_conn(
#endif
if (!(conn = (SPIDER_CONN *)
spider_bulk_malloc(spider_current_trx, 32, MYF(MY_WME | MY_ZEROFILL),
- &conn, sizeof(*conn),
- &tmp_name, direct_sql->conn_key_length + 1,
- &tmp_host, direct_sql->tgt_host_length + 1,
- &tmp_username, direct_sql->tgt_username_length + 1,
- &tmp_password, direct_sql->tgt_password_length + 1,
- &tmp_socket, direct_sql->tgt_socket_length + 1,
- &tmp_wrapper, direct_sql->tgt_wrapper_length + 1,
- &tmp_ssl_ca, direct_sql->tgt_ssl_ca_length + 1,
- &tmp_ssl_capath, direct_sql->tgt_ssl_capath_length + 1,
- &tmp_ssl_cert, direct_sql->tgt_ssl_cert_length + 1,
- &tmp_ssl_cipher, direct_sql->tgt_ssl_cipher_length + 1,
- &tmp_ssl_key, direct_sql->tgt_ssl_key_length + 1,
+ &conn, (uint) (sizeof(*conn)),
+ &tmp_name, (uint) (direct_sql->conn_key_length + 1),
+ &tmp_host, (uint) (direct_sql->tgt_host_length + 1),
+ &tmp_username, (uint) (direct_sql->tgt_username_length + 1),
+ &tmp_password, (uint) (direct_sql->tgt_password_length + 1),
+ &tmp_socket, (uint) (direct_sql->tgt_socket_length + 1),
+ &tmp_wrapper, (uint) (direct_sql->tgt_wrapper_length + 1),
+ &tmp_ssl_ca, (uint) (direct_sql->tgt_ssl_ca_length + 1),
+ &tmp_ssl_capath, (uint) (direct_sql->tgt_ssl_capath_length + 1),
+ &tmp_ssl_cert, (uint) (direct_sql->tgt_ssl_cert_length + 1),
+ &tmp_ssl_cipher, (uint) (direct_sql->tgt_ssl_cipher_length + 1),
+ &tmp_ssl_key, (uint) (direct_sql->tgt_ssl_key_length + 1),
&tmp_default_file,
- direct_sql->tgt_default_file_length + 1,
+ (uint) (direct_sql->tgt_default_file_length + 1),
&tmp_default_group,
- direct_sql->tgt_default_group_length + 1,
- &need_mon, sizeof(int),
+ (uint) (direct_sql->tgt_default_group_length + 1),
+ &need_mon, (uint) (sizeof(int)),
NullS))
) {
*error_num = HA_ERR_OUT_OF_MEM;
@@ -439,12 +441,12 @@ SPIDER_CONN *spider_udf_direct_sql_create_conn(
} else {
if (!(conn = (SPIDER_CONN *)
spider_bulk_malloc(spider_current_trx, 33, MYF(MY_WME | MY_ZEROFILL),
- &conn, sizeof(*conn),
- &tmp_name, direct_sql->conn_key_length + 1,
- &tmp_host, direct_sql->tgt_host_length + 1,
- &tmp_socket, direct_sql->tgt_socket_length + 1,
- &tmp_wrapper, direct_sql->tgt_wrapper_length + 1,
- &need_mon, sizeof(int),
+ &conn, (uint) (sizeof(*conn)),
+ &tmp_name, (uint) (direct_sql->conn_key_length + 1),
+ &tmp_host, (uint) (direct_sql->tgt_host_length + 1),
+ &tmp_socket, (uint) (direct_sql->tgt_socket_length + 1),
+ &tmp_wrapper, (uint) (direct_sql->tgt_wrapper_length + 1),
+ &need_mon, (uint) (sizeof(int)),
NullS))
) {
*error_num = HA_ERR_OUT_OF_MEM;
@@ -1602,8 +1604,8 @@ long long spider_direct_sql_body(
SPIDER_BACKUP_DASTATUS;
if (!(direct_sql = (SPIDER_DIRECT_SQL *)
spider_bulk_malloc(spider_current_trx, 34, MYF(MY_WME | MY_ZEROFILL),
- &direct_sql, sizeof(SPIDER_DIRECT_SQL),
- &sql, sizeof(char) * args->lengths[0],
+ &direct_sql, (uint) (sizeof(SPIDER_DIRECT_SQL)),
+ &sql, (uint) (sizeof(char) * args->lengths[0]),
NullS))
) {
error_num = HA_ERR_OUT_OF_MEM;
diff --git a/storage/spider/spd_group_by_handler.cc b/storage/spider/spd_group_by_handler.cc
index 314ecd018a5..1fddad34630 100644
--- a/storage/spider/spd_group_by_handler.cc
+++ b/storage/spider/spd_group_by_handler.cc
@@ -1,4 +1,5 @@
-/* Copyright (C) 2008-2018 Kentoku Shiba
+/* Copyright (C) 2008-2019 Kentoku Shiba
+ Copyright (C) 2019 MariaDB corp
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
@@ -637,9 +638,9 @@ SPIDER_CONN_HOLDER *spider_fields::create_conn_holder(
DBUG_PRINT("info",("spider this=%p", this));
return_conn_holder = (SPIDER_CONN_HOLDER *)
spider_bulk_malloc(spider_current_trx, 252, MYF(MY_WME | MY_ZEROFILL),
- &return_conn_holder, sizeof(SPIDER_CONN_HOLDER),
+ &return_conn_holder, (uint) (sizeof(SPIDER_CONN_HOLDER)),
&table_link_idx_holder,
- table_count * sizeof(SPIDER_TABLE_LINK_IDX_HOLDER),
+ (uint) (table_count * sizeof(SPIDER_TABLE_LINK_IDX_HOLDER)),
NullS
);
if (!return_conn_holder)
diff --git a/storage/spider/spd_i_s.cc b/storage/spider/spd_i_s.cc
index c43c666601f..014da9fc2cd 100644
--- a/storage/spider/spd_i_s.cc
+++ b/storage/spider/spd_i_s.cc
@@ -44,25 +44,21 @@ extern ulonglong spider_free_mem_count[SPIDER_MEM_CALC_LIST_NUM];
static struct st_mysql_storage_engine spider_i_s_info =
{ MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION };
+namespace Show {
+
static ST_FIELD_INFO spider_i_s_alloc_mem_fields_info[] =
{
- {"ID", 10, MYSQL_TYPE_LONG, 0, MY_I_S_UNSIGNED, "id", SKIP_OPEN_TABLE},
- {"FUNC_NAME", 64, MYSQL_TYPE_STRING, 0,
- MY_I_S_MAYBE_NULL, "func_name", SKIP_OPEN_TABLE},
- {"FILE_NAME", 64, MYSQL_TYPE_STRING, 0,
- MY_I_S_MAYBE_NULL, "file_name", SKIP_OPEN_TABLE},
- {"LINE_NO", 10, MYSQL_TYPE_LONG, 0,
- MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL, "line_no", SKIP_OPEN_TABLE},
- {"TOTAL_ALLOC_MEM", 20, MYSQL_TYPE_LONGLONG, 0,
- MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL, "total_alloc_mem", SKIP_OPEN_TABLE},
- {"CURRENT_ALLOC_MEM", 20, MYSQL_TYPE_LONGLONG, 0,
- MY_I_S_MAYBE_NULL, "current_alloc_mem", SKIP_OPEN_TABLE},
- {"ALLOC_MEM_COUNT", 20, MYSQL_TYPE_LONGLONG, 0,
- MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL, "alloc_mem_count", SKIP_OPEN_TABLE},
- {"FREE_MEM_COUNT", 20, MYSQL_TYPE_LONGLONG, 0,
- MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL, "free_mem_count", SKIP_OPEN_TABLE},
- {NULL, 0, MYSQL_TYPE_STRING, 0, 0, NULL, 0}
+ Column("ID", ULong(10), NOT_NULL, "id"),
+ Column("FUNC_NAME", Varchar(64), NULLABLE, "func_name"),
+ Column("FILE_NAME", Varchar(64), NULLABLE, "file_name"),
+ Column("LINE_NO", ULong(10), NULLABLE, "line_no"),
+ Column("TOTAL_ALLOC_MEM", ULonglong(20), NULLABLE, "total_alloc_mem"),
+ Column("CURRENT_ALLOC_MEM", SLonglong(20), NULLABLE, "current_alloc_mem"),
+ Column("ALLOC_MEM_COUNT", ULonglong(20), NULLABLE, "alloc_mem_count"),
+ Column("FREE_MEM_COUNT", ULonglong(20), NULLABLE, "free_mem_count"),
+ CEnd()
};
+} // namespace Show
static int spider_i_s_alloc_mem_fill_table(
THD *thd,
@@ -117,7 +113,7 @@ static int spider_i_s_alloc_mem_init(
) {
ST_SCHEMA_TABLE *schema = (ST_SCHEMA_TABLE *) p;
DBUG_ENTER("spider_i_s_alloc_mem_init");
- schema->fields_info = spider_i_s_alloc_mem_fields_info;
+ schema->fields_info = Show::spider_i_s_alloc_mem_fields_info;
schema->fill_table = spider_i_s_alloc_mem_fill_table;
schema->idx_field1 = 0;
DBUG_RETURN(0);
diff --git a/storage/spider/spd_ping_table.cc b/storage/spider/spd_ping_table.cc
index 431d46063c3..60e36fc24fb 100644
--- a/storage/spider/spd_ping_table.cc
+++ b/storage/spider/spd_ping_table.cc
@@ -1,4 +1,5 @@
-/* Copyright (C) 2009-2018 Kentoku Shiba
+/* Copyright (C) 2009-2019 Kentoku Shiba
+ Copyright (C) 2019 MariaDB corp
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
@@ -367,12 +368,15 @@ create_table_mon:
do {
if (!(table_mon = (SPIDER_TABLE_MON *)
spider_bulk_malloc(spider_current_trx, 35, MYF(MY_WME | MY_ZEROFILL),
- &table_mon, sizeof(SPIDER_TABLE_MON),
- &tmp_share, sizeof(SPIDER_SHARE),
- &tmp_connect_info, sizeof(char *) * SPIDER_TMP_SHARE_CHAR_PTR_COUNT,
- &tmp_connect_info_length, sizeof(uint) * SPIDER_TMP_SHARE_UINT_COUNT,
- &tmp_long, sizeof(long) * SPIDER_TMP_SHARE_LONG_COUNT,
- &tmp_longlong, sizeof(longlong) * SPIDER_TMP_SHARE_LONGLONG_COUNT,
+ &table_mon, (uint) (sizeof(SPIDER_TABLE_MON)),
+ &tmp_share, (uint) (sizeof(SPIDER_SHARE)),
+ &tmp_connect_info,
+ (uint) (sizeof(char *) * SPIDER_TMP_SHARE_CHAR_PTR_COUNT),
+ &tmp_connect_info_length,
+ (uint) (sizeof(uint) * SPIDER_TMP_SHARE_UINT_COUNT),
+ &tmp_long, (uint) (sizeof(long) * SPIDER_TMP_SHARE_LONG_COUNT),
+ &tmp_longlong,
+ (uint) (sizeof(longlong) * SPIDER_TMP_SHARE_LONGLONG_COUNT),
NullS))
) {
spider_sys_index_end(table_link_mon);
@@ -491,13 +495,17 @@ SPIDER_TABLE_MON_LIST *spider_get_ping_table_tgt(
SPD_INIT_ALLOC_ROOT(&mem_root, 4096, 0, MYF(MY_WME));
if (!(table_mon_list = (SPIDER_TABLE_MON_LIST *)
spider_bulk_malloc(spider_current_trx, 36, MYF(MY_WME | MY_ZEROFILL),
- &table_mon_list, sizeof(SPIDER_TABLE_MON_LIST),
- &tmp_share, sizeof(SPIDER_SHARE),
- &tmp_connect_info, sizeof(char *) * SPIDER_TMP_SHARE_CHAR_PTR_COUNT,
- &tmp_connect_info_length, sizeof(uint) * SPIDER_TMP_SHARE_UINT_COUNT,
- &tmp_long, sizeof(long) * SPIDER_TMP_SHARE_LONG_COUNT,
- &tmp_longlong, sizeof(longlong) * SPIDER_TMP_SHARE_LONGLONG_COUNT,
- &key_str, str->length() + 1,
+ &table_mon_list, (uint) (sizeof(SPIDER_TABLE_MON_LIST)),
+ &tmp_share, (uint) (sizeof(SPIDER_SHARE)),
+ &tmp_connect_info,
+ (uint) (sizeof(char *) * SPIDER_TMP_SHARE_CHAR_PTR_COUNT),
+ &tmp_connect_info_length,
+ (uint) (sizeof(uint) * SPIDER_TMP_SHARE_UINT_COUNT),
+ &tmp_long,
+ (uint) (sizeof(long) * SPIDER_TMP_SHARE_LONG_COUNT),
+ &tmp_longlong,
+ (uint) (sizeof(longlong) * SPIDER_TMP_SHARE_LONGLONG_COUNT),
+ &key_str, (uint) (str->length() + 1),
NullS))
) {
my_error(HA_ERR_OUT_OF_MEM, MYF(0));
diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc
index ec7549a38c7..ee41d39df0f 100644
--- a/storage/spider/spd_table.cc
+++ b/storage/spider/spd_table.cc
@@ -122,7 +122,7 @@ uint *spd_db_att_xid_cache_split_num;
pthread_mutex_t *spd_db_att_LOCK_xid_cache;
HASH *spd_db_att_xid_cache;
#endif
-struct charset_info_st *spd_charset_utf8_bin;
+struct charset_info_st *spd_charset_utf8mb3_bin;
const char **spd_defaults_extra_file;
const char **spd_defaults_file;
const char **spd_mysqld_unix_port;
@@ -1217,8 +1217,8 @@ int spider_create_string_list(
if (!(*string_list = (char**)
spider_bulk_malloc(spider_current_trx, 37, MYF(MY_WME | MY_ZEROFILL),
- string_list, sizeof(char*) * (*list_length),
- string_length_list, sizeof(int) * (*list_length),
+ string_list, (uint) (sizeof(char*) * (*list_length)),
+ string_length_list, (uint) (sizeof(int) * (*list_length)),
NullS))
) {
my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM);
@@ -1336,7 +1336,7 @@ int spider_create_long_list(
if (!(*long_list = (long*)
spider_bulk_malloc(spider_current_trx, 38, MYF(MY_WME | MY_ZEROFILL),
- long_list, sizeof(long) * (*list_length),
+ long_list, (uint) (sizeof(long) * (*list_length)),
NullS))
) {
my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM);
@@ -1420,7 +1420,7 @@ int spider_create_longlong_list(
if (!(*longlong_list = (longlong *)
spider_bulk_malloc(spider_current_trx, 39, MYF(MY_WME | MY_ZEROFILL),
- longlong_list, sizeof(longlong) * (*list_length),
+ longlong_list, (uint) (sizeof(longlong) * (*list_length)),
NullS))
) {
my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM);
@@ -1491,8 +1491,8 @@ int spider_increase_string_list(
if (!(tmp_str_list = (char**)
spider_bulk_malloc(spider_current_trx, 40, MYF(MY_WME | MY_ZEROFILL),
- &tmp_str_list, sizeof(char*) * link_count,
- &tmp_length_list, sizeof(uint) * link_count,
+ &tmp_str_list, (uint) (sizeof(char*) * link_count),
+ &tmp_length_list, (uint) (sizeof(uint) * link_count),
NullS))
) {
my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM);
@@ -1554,8 +1554,8 @@ int spider_increase_null_string_list(
if (!(tmp_str_list = (char**)
spider_bulk_malloc(spider_current_trx, 247, MYF(MY_WME | MY_ZEROFILL),
- &tmp_str_list, sizeof(char*) * link_count,
- &tmp_length_list, sizeof(uint) * link_count,
+ &tmp_str_list, (uint) (sizeof(char*) * link_count),
+ &tmp_length_list, (uint) (sizeof(uint) * link_count),
NullS))
) {
my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM);
@@ -1612,7 +1612,7 @@ int spider_increase_long_list(
if (!(tmp_long_list = (long*)
spider_bulk_malloc(spider_current_trx, 41, MYF(MY_WME | MY_ZEROFILL),
- &tmp_long_list, sizeof(long) * link_count,
+ &tmp_long_list, (uint) (sizeof(long) * link_count),
NullS))
) {
my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM);
@@ -1657,7 +1657,7 @@ int spider_increase_longlong_list(
if (!(tmp_longlong_list = (longlong*)
spider_bulk_malloc(spider_current_trx, 42, MYF(MY_WME | MY_ZEROFILL),
- &tmp_longlong_list, sizeof(longlong) * link_count,
+ &tmp_longlong_list, (uint) (sizeof(longlong) * link_count),
NullS))
) {
my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM);
@@ -2980,17 +2980,17 @@ int spider_parse_connect_info(
if (!(share_alter->tmp_server_names = (char **)
spider_bulk_malloc(spider_current_trx, 43, MYF(MY_WME | MY_ZEROFILL),
&share_alter->tmp_server_names,
- sizeof(char *) * 16 * share->all_link_count,
+ (uint) (sizeof(char *) * 16 * share->all_link_count),
&share_alter->tmp_server_names_lengths,
- sizeof(uint *) * 16 * share->all_link_count,
+ (uint) (sizeof(uint *) * 16 * share->all_link_count),
&share_alter->tmp_tgt_ports,
- sizeof(long) * share->all_link_count,
+ (uint) (sizeof(long) * share->all_link_count),
&share_alter->tmp_tgt_ssl_vscs,
- sizeof(long) * share->all_link_count,
+ (uint) (sizeof(long) * share->all_link_count),
&share_alter->tmp_monitoring_binlog_pos_at_failing,
- sizeof(long) * share->all_link_count,
+ (uint) (sizeof(long) * share->all_link_count),
&share_alter->tmp_link_statuses,
- sizeof(long) * share->all_link_count,
+ (uint) (sizeof(long) * share->all_link_count),
NullS))
) {
error_num = HA_ERR_OUT_OF_MEM;
@@ -4394,13 +4394,17 @@ SPIDER_SHARE *spider_create_share(
bitmap_size = spider_bitmap_size(table_share->fields);
if (!(share = (SPIDER_SHARE *)
spider_bulk_malloc(spider_current_trx, 46, MYF(MY_WME | MY_ZEROFILL),
- &share, sizeof(*share),
- &tmp_name, length + 1,
- &tmp_static_key_cardinality, sizeof(*tmp_static_key_cardinality) * table_share->keys,
- &tmp_cardinality, sizeof(*tmp_cardinality) * table_share->fields,
- &tmp_cardinality_upd, sizeof(*tmp_cardinality_upd) * bitmap_size,
- &tmp_table_mon_mutex_bitmap, sizeof(*tmp_table_mon_mutex_bitmap) *
- ((spider_param_udf_table_mon_mutex_count() + 7) / 8),
+ &share, (uint) (sizeof(*share)),
+ &tmp_name, (uint) (length + 1),
+ &tmp_static_key_cardinality,
+ (uint) (sizeof(*tmp_static_key_cardinality) * table_share->keys),
+ &tmp_cardinality,
+ (uint) (sizeof(*tmp_cardinality) * table_share->fields),
+ &tmp_cardinality_upd,
+ (uint) (sizeof(*tmp_cardinality_upd) * bitmap_size),
+ &tmp_table_mon_mutex_bitmap,
+ (uint) (sizeof(*tmp_table_mon_mutex_bitmap) *
+ ((spider_param_udf_table_mon_mutex_count() + 7) / 8)),
NullS))
) {
*error_num = HA_ERR_OUT_OF_MEM;
@@ -5966,8 +5970,8 @@ SPIDER_LGTM_TBLHND_SHARE *spider_get_lgtm_tblhnd_share(
DBUG_PRINT("info",("spider create new lgtm tblhnd share"));
if (!(lgtm_tblhnd_share = (SPIDER_LGTM_TBLHND_SHARE *)
spider_bulk_malloc(spider_current_trx, 244, MYF(MY_WME | MY_ZEROFILL),
- &lgtm_tblhnd_share, sizeof(*lgtm_tblhnd_share),
- &tmp_name, table_name_length + 1,
+ &lgtm_tblhnd_share, (uint) (sizeof(*lgtm_tblhnd_share)),
+ &tmp_name, (uint) (table_name_length + 1),
NullS))
) {
*error_num = HA_ERR_OUT_OF_MEM;
@@ -6076,9 +6080,10 @@ SPIDER_PARTITION_SHARE *spider_get_pt_share(
DBUG_PRINT("info",("spider create new pt share"));
if (!(partition_share = (SPIDER_PARTITION_SHARE *)
spider_bulk_malloc(spider_current_trx, 51, MYF(MY_WME | MY_ZEROFILL),
- &partition_share, sizeof(*partition_share),
- &tmp_name, table_share->path.length + 1,
- &tmp_cardinality, sizeof(*tmp_cardinality) * table_share->fields,
+ &partition_share, (uint) (sizeof(*partition_share)),
+ &tmp_name, (uint) (table_share->path.length + 1),
+ &tmp_cardinality,
+ (uint) (sizeof(*tmp_cardinality) * table_share->fields),
NullS))
) {
*error_num = HA_ERR_OUT_OF_MEM;
@@ -6133,7 +6138,7 @@ SPIDER_PARTITION_SHARE *spider_get_pt_share(
}
if(
- my_hash_init(&partition_share->pt_handler_hash, spd_charset_utf8_bin,
+ my_hash_init(&partition_share->pt_handler_hash, spd_charset_utf8mb3_bin,
32, 0, 0, (my_hash_get_key) spider_pt_handler_share_get_key, 0, 0)
) {
*error_num = HA_ERR_OUT_OF_MEM;
@@ -6424,15 +6429,18 @@ int spider_open_all_tables(
if (!(share = (SPIDER_SHARE *)
spider_bulk_malloc(spider_current_trx, 52, MYF(MY_WME | MY_ZEROFILL),
- &share, sizeof(*share),
- &connect_info, sizeof(char *) * SPIDER_TMP_SHARE_CHAR_PTR_COUNT,
- &connect_info_length, sizeof(uint) * SPIDER_TMP_SHARE_UINT_COUNT,
- &long_info, sizeof(long) * SPIDER_TMP_SHARE_LONG_COUNT,
- &longlong_info, sizeof(longlong) * SPIDER_TMP_SHARE_LONGLONG_COUNT,
- &conns, sizeof(SPIDER_CONN *),
- &need_mon, sizeof(int),
- &spider->conn_link_idx, sizeof(uint),
- &spider->conn_can_fo, sizeof(uchar),
+ &share, (uint) (sizeof(*share)),
+ &connect_info,
+ (uint) (sizeof(char *) * SPIDER_TMP_SHARE_CHAR_PTR_COUNT),
+ &connect_info_length,
+ (uint) (sizeof(uint) * SPIDER_TMP_SHARE_UINT_COUNT),
+ &long_info, (uint) (sizeof(long) * SPIDER_TMP_SHARE_LONG_COUNT),
+ &longlong_info,
+ (uint) (sizeof(longlong) * SPIDER_TMP_SHARE_LONGLONG_COUNT),
+ &conns, (uint) (sizeof(SPIDER_CONN *)),
+ &need_mon, (uint) (sizeof(int)),
+ &spider->conn_link_idx, (uint) (sizeof(uint)),
+ &spider->conn_can_fo, (uint) (sizeof(uchar)),
NullS))
) {
delete spider;
@@ -6629,7 +6637,7 @@ int spider_close_connection(
}
spider_rollback(spider_hton_ptr, thd, TRUE);
- spider_free_trx(trx, TRUE);
+ spider_free_trx(trx, TRUE, false);
DBUG_RETURN(0);
}
@@ -6923,7 +6931,6 @@ int spider_db_init(
DBUG_ENTER("spider_db_init");
spider_hton_ptr = spider_hton;
- spider_hton->state = SHOW_OPTION_YES;
spider_hton->flags = HTON_NO_FLAGS;
#ifdef HTON_CAN_READ_CONNECT_STRING_IN_PARTITION
spider_hton->flags |= HTON_CAN_READ_CONNECT_STRING_IN_PARTITION;
@@ -6999,8 +7006,8 @@ int spider_db_init(
GetProcAddress(current_module, "?xid_cache@@3Ust_hash@@A");
#endif
#endif
- spd_charset_utf8_bin = (struct charset_info_st *)
- GetProcAddress(current_module, "my_charset_utf8_bin");
+ spd_charset_utf8mb3_bin = (struct charset_info_st *)
+ GetProcAddress(current_module, "my_charset_utf8mb3_bin");
spd_defaults_extra_file = (const char **)
GetProcAddress(current_module, "my_defaults_extra_file");
spd_defaults_file = (const char **)
@@ -7039,7 +7046,7 @@ int spider_db_init(
spd_db_att_xid_cache = &xid_cache;
#endif
#endif
- spd_charset_utf8_bin = &my_charset_utf8_bin;
+ spd_charset_utf8mb3_bin = &my_charset_utf8mb3_bin;
spd_defaults_extra_file = &my_defaults_extra_file;
spd_defaults_file = &my_defaults_file;
spd_mysqld_unix_port = (const char **) &mysqld_unix_port;
@@ -7177,7 +7184,7 @@ int spider_db_init(
#endif
goto error_mem_calc_mutex_init;
- if (my_hash_init(&spider_open_tables, spd_charset_utf8_bin, 32, 0, 0,
+ if (my_hash_init(&spider_open_tables, spd_charset_utf8mb3_bin, 32, 0, 0,
(my_hash_get_key) spider_tbl_get_key, 0, 0))
goto error_open_tables_hash_init;
@@ -7186,7 +7193,7 @@ int spider_db_init(
spider_open_tables,
spider_open_tables.array.max_element *
spider_open_tables.array.size_of_element);
- if (my_hash_init(&spider_init_error_tables, spd_charset_utf8_bin, 32, 0, 0,
+ if (my_hash_init(&spider_init_error_tables, spd_charset_utf8mb3_bin, 32, 0, 0,
(my_hash_get_key) spider_tbl_get_key, 0, 0))
goto error_init_error_tables_hash_init;
@@ -7196,7 +7203,7 @@ int spider_db_init(
spider_init_error_tables.array.max_element *
spider_init_error_tables.array.size_of_element);
#ifdef WITH_PARTITION_STORAGE_ENGINE
- if (my_hash_init(&spider_open_pt_share, spd_charset_utf8_bin, 32, 0, 0,
+ if (my_hash_init(&spider_open_pt_share, spd_charset_utf8mb3_bin, 32, 0, 0,
(my_hash_get_key) spider_pt_share_get_key, 0, 0))
goto error_open_pt_share_hash_init;
@@ -7206,7 +7213,7 @@ int spider_db_init(
spider_open_pt_share.array.max_element *
spider_open_pt_share.array.size_of_element);
#endif
- if (my_hash_init(&spider_lgtm_tblhnd_share_hash, spd_charset_utf8_bin,
+ if (my_hash_init(&spider_lgtm_tblhnd_share_hash, spd_charset_utf8mb3_bin,
32, 0, 0,
(my_hash_get_key) spider_lgtm_tblhnd_share_hash_get_key,
0, 0))
@@ -7217,11 +7224,11 @@ int spider_db_init(
spider_lgtm_tblhnd_share_hash,
spider_lgtm_tblhnd_share_hash.array.max_element *
spider_lgtm_tblhnd_share_hash.array.size_of_element);
- if (my_hash_init(&spider_open_connections, spd_charset_utf8_bin, 32, 0, 0,
+ if (my_hash_init(&spider_open_connections, spd_charset_utf8mb3_bin, 32, 0, 0,
(my_hash_get_key) spider_conn_get_key, 0, 0))
goto error_open_connections_hash_init;
- if (my_hash_init(&spider_ipport_conns, spd_charset_utf8_bin, 32, 0, 0,
+ if (my_hash_init(&spider_ipport_conns, spd_charset_utf8mb3_bin, 32, 0, 0,
(my_hash_get_key) spider_ipport_conn_get_key,
spider_free_ipport_conn, 0))
goto error_ipport_conn__hash_init;
@@ -7232,7 +7239,7 @@ int spider_db_init(
spider_open_connections.array.max_element *
spider_open_connections.array.size_of_element);
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
- if (my_hash_init(&spider_hs_r_conn_hash, spd_charset_utf8_bin, 32, 0, 0,
+ if (my_hash_init(&spider_hs_r_conn_hash, spd_charset_utf8mb3_bin, 32, 0, 0,
(my_hash_get_key) spider_conn_get_key, 0, 0))
goto error_hs_r_conn_hash_init;
@@ -7241,7 +7248,7 @@ int spider_db_init(
spider_hs_r_conn_hash,
spider_hs_r_conn_hash.array.max_element *
spider_hs_r_conn_hash.array.size_of_element);
- if (my_hash_init(&spider_hs_w_conn_hash, spd_charset_utf8_bin, 32, 0, 0,
+ if (my_hash_init(&spider_hs_w_conn_hash, spd_charset_utf8mb3_bin, 32, 0, 0,
(my_hash_get_key) spider_conn_get_key, 0, 0))
goto error_hs_w_conn_hash_init;
@@ -7251,7 +7258,7 @@ int spider_db_init(
spider_hs_w_conn_hash.array.max_element *
spider_hs_w_conn_hash.array.size_of_element);
#endif
- if (my_hash_init(&spider_allocated_thds, spd_charset_utf8_bin, 32, 0, 0,
+ if (my_hash_init(&spider_allocated_thds, spd_charset_utf8mb3_bin, 32, 0, 0,
(my_hash_get_key) spider_allocated_thds_get_key, 0, 0))
goto error_allocated_thds_hash_init;
@@ -7273,12 +7280,12 @@ int spider_db_init(
if (!(spider_udf_table_mon_mutexes = (pthread_mutex_t *)
spider_bulk_malloc(NULL, 53, MYF(MY_WME | MY_ZEROFILL),
- &spider_udf_table_mon_mutexes, sizeof(pthread_mutex_t) *
- spider_param_udf_table_mon_mutex_count(),
- &spider_udf_table_mon_conds, sizeof(pthread_cond_t) *
- spider_param_udf_table_mon_mutex_count(),
- &spider_udf_table_mon_list_hash, sizeof(HASH) *
- spider_param_udf_table_mon_mutex_count(),
+ &spider_udf_table_mon_mutexes, (uint) (sizeof(pthread_mutex_t) *
+ spider_param_udf_table_mon_mutex_count()),
+ &spider_udf_table_mon_conds, (uint) (sizeof(pthread_cond_t) *
+ spider_param_udf_table_mon_mutex_count()),
+ &spider_udf_table_mon_list_hash, (uint) (sizeof(HASH) *
+ spider_param_udf_table_mon_mutex_count()),
NullS))
)
goto error_alloc_mon_mutxes;
@@ -7313,7 +7320,7 @@ int spider_db_init(
roop_count++)
{
if (my_hash_init(&spider_udf_table_mon_list_hash[roop_count],
- spd_charset_utf8_bin, 32, 0, 0,
+ spd_charset_utf8mb3_bin, 32, 0, 0,
(my_hash_get_key) spider_udf_tbl_mon_list_key, 0, 0))
goto error_init_udf_table_mon_list_hash;
@@ -7327,10 +7334,10 @@ int spider_db_init(
#ifndef WITHOUT_SPIDER_BG_SEARCH
if (!(spider_table_sts_threads = (SPIDER_THREAD *)
spider_bulk_malloc(NULL, 256, MYF(MY_WME | MY_ZEROFILL),
- &spider_table_sts_threads, sizeof(SPIDER_THREAD) *
- spider_param_table_sts_thread_count(),
- &spider_table_crd_threads, sizeof(SPIDER_THREAD) *
- spider_param_table_crd_thread_count(),
+ &spider_table_sts_threads, (uint) (sizeof(SPIDER_THREAD) *
+ spider_param_table_sts_thread_count()),
+ &spider_table_crd_threads, (uint) (sizeof(SPIDER_THREAD) *
+ spider_param_table_crd_thread_count()),
NullS))
)
goto error_alloc_mon_mutxes;
@@ -8026,8 +8033,8 @@ SPIDER_INIT_ERROR_TABLE *spider_get_init_error_table(
}
if (!(spider_init_error_table = (SPIDER_INIT_ERROR_TABLE *)
spider_bulk_malloc(spider_current_trx, 54, MYF(MY_WME | MY_ZEROFILL),
- &spider_init_error_table, sizeof(*spider_init_error_table),
- &tmp_name, share->table_name_length + 1,
+ &spider_init_error_table, (uint) (sizeof(*spider_init_error_table)),
+ &tmp_name, (uint) (share->table_name_length + 1),
NullS))
) {
pthread_mutex_unlock(&spider_init_error_tbl_mutex);
@@ -9703,25 +9710,25 @@ int spider_create_spider_object_for_share(
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
if (!(need_mons = (int *)
spider_bulk_malloc(spider_current_trx, 255, MYF(MY_WME | MY_ZEROFILL),
- &need_mons, (sizeof(int) * share->link_count),
- &conns, (sizeof(SPIDER_CONN *) * share->link_count),
- &conn_link_idx, (sizeof(uint) * share->link_count),
- &conn_can_fo, (sizeof(uchar) * share->link_bitmap_size),
- &conn_keys, (sizeof(char *) * share->link_count),
- &hs_r_conn_keys, (sizeof(char *) * share->link_count),
- &hs_w_conn_keys, (sizeof(char *) * share->link_count),
- &dbton_hdl, (sizeof(spider_db_handler *) * SPIDER_DBTON_SIZE),
+ &need_mons, (uint) (sizeof(int) * share->link_count),
+ &conns, (uint) (sizeof(SPIDER_CONN *) * share->link_count),
+ &conn_link_idx, (uint) (sizeof(uint) * share->link_count),
+ &conn_can_fo, (uint) (sizeof(uchar) * share->link_bitmap_size),
+ &conn_keys, (uint) (sizeof(char *) * share->link_count),
+ &hs_r_conn_keys, (uint) (sizeof(char *) * share->link_count),
+ &hs_w_conn_keys, (uint) (sizeof(char *) * share->link_count),
+ &dbton_hdl, (uint) (sizeof(spider_db_handler *) * SPIDER_DBTON_SIZE),
NullS))
)
#else
if (!(need_mons = (int *)
spider_bulk_malloc(spider_current_trx, 255, MYF(MY_WME | MY_ZEROFILL),
- &need_mons, (sizeof(int) * share->link_count),
- &conns, (sizeof(SPIDER_CONN *) * share->link_count),
- &conn_link_idx, (sizeof(uint) * share->link_count),
- &conn_can_fo, (sizeof(uchar) * share->link_bitmap_size),
- &conn_keys, (sizeof(char *) * share->link_count),
- &dbton_hdl, (sizeof(spider_db_handler *) * SPIDER_DBTON_SIZE),
+ &need_mons, (uint) (sizeof(int) * share->link_count),
+ &conns, (uint) (sizeof(SPIDER_CONN *) * share->link_count),
+ &conn_link_idx, (uint) (sizeof(uint) * share->link_count),
+ &conn_can_fo, (uint) (sizeof(uchar) * share->link_bitmap_size),
+ &conn_keys, (uint) (sizeof(char *) * share->link_count),
+ &dbton_hdl, (uint) (sizeof(spider_db_handler *) * SPIDER_DBTON_SIZE),
NullS))
)
#endif
diff --git a/storage/spider/spd_trx.cc b/storage/spider/spd_trx.cc
index b47b75a93cf..ad2a35aac15 100644
--- a/storage/spider/spd_trx.cc
+++ b/storage/spider/spd_trx.cc
@@ -49,7 +49,7 @@ extern uint *spd_db_att_xid_cache_split_num;
extern pthread_mutex_t *spd_db_att_LOCK_xid_cache;
extern HASH *spd_db_att_xid_cache;
#endif
-extern struct charset_info_st *spd_charset_utf8_bin;
+extern struct charset_info_st *spd_charset_utf8mb3_bin;
extern handlerton *spider_hton_ptr;
extern SPIDER_DBTON spider_dbton[SPIDER_DBTON_SIZE];
@@ -549,81 +549,90 @@ int spider_create_trx_alter_table(
if (!(alter_table = (SPIDER_ALTER_TABLE *)
spider_bulk_malloc(spider_current_trx, 55, MYF(MY_WME | MY_ZEROFILL),
- &alter_table, sizeof(*alter_table),
- &tmp_name, sizeof(char) * (share->table_name_length + 1),
-
- &tmp_server_names, sizeof(char *) * share->all_link_count,
- &tmp_tgt_table_names, sizeof(char *) * share->all_link_count,
- &tmp_tgt_dbs, sizeof(char *) * share->all_link_count,
- &tmp_tgt_hosts, sizeof(char *) * share->all_link_count,
- &tmp_tgt_usernames, sizeof(char *) * share->all_link_count,
- &tmp_tgt_passwords, sizeof(char *) * share->all_link_count,
- &tmp_tgt_sockets, sizeof(char *) * share->all_link_count,
- &tmp_tgt_wrappers, sizeof(char *) * share->all_link_count,
- &tmp_tgt_ssl_cas, sizeof(char *) * share->all_link_count,
- &tmp_tgt_ssl_capaths, sizeof(char *) * share->all_link_count,
- &tmp_tgt_ssl_certs, sizeof(char *) * share->all_link_count,
- &tmp_tgt_ssl_ciphers, sizeof(char *) * share->all_link_count,
- &tmp_tgt_ssl_keys, sizeof(char *) * share->all_link_count,
- &tmp_tgt_default_files, sizeof(char *) * share->all_link_count,
- &tmp_tgt_default_groups, sizeof(char *) * share->all_link_count,
- &tmp_static_link_ids, sizeof(char *) * share->all_link_count,
-
- &tmp_server_names_lengths, sizeof(uint) * share->all_link_count,
- &tmp_tgt_table_names_lengths, sizeof(uint) * share->all_link_count,
- &tmp_tgt_dbs_lengths, sizeof(uint) * share->all_link_count,
- &tmp_tgt_hosts_lengths, sizeof(uint) * share->all_link_count,
- &tmp_tgt_usernames_lengths, sizeof(uint) * share->all_link_count,
- &tmp_tgt_passwords_lengths, sizeof(uint) * share->all_link_count,
- &tmp_tgt_sockets_lengths, sizeof(uint) * share->all_link_count,
- &tmp_tgt_wrappers_lengths, sizeof(uint) * share->all_link_count,
- &tmp_tgt_ssl_cas_lengths, sizeof(uint) * share->all_link_count,
- &tmp_tgt_ssl_capaths_lengths, sizeof(uint) * share->all_link_count,
- &tmp_tgt_ssl_certs_lengths, sizeof(uint) * share->all_link_count,
- &tmp_tgt_ssl_ciphers_lengths, sizeof(uint) * share->all_link_count,
- &tmp_tgt_ssl_keys_lengths, sizeof(uint) * share->all_link_count,
- &tmp_tgt_default_files_lengths, sizeof(uint) * share->all_link_count,
- &tmp_tgt_default_groups_lengths, sizeof(uint) * share->all_link_count,
- &tmp_static_link_ids_lengths, sizeof(uint) * share->all_link_count,
-
- &tmp_tgt_ports, sizeof(long) * share->all_link_count,
- &tmp_tgt_ssl_vscs, sizeof(long) * share->all_link_count,
+ &alter_table, (uint) (sizeof(*alter_table)),
+ &tmp_name, (uint) (sizeof(char) * (share->table_name_length + 1)),
+
+ &tmp_server_names, (uint) (sizeof(char *) * share->all_link_count),
+ &tmp_tgt_table_names, (uint) (sizeof(char *) * share->all_link_count),
+ &tmp_tgt_dbs, (uint) (sizeof(char *) * share->all_link_count),
+ &tmp_tgt_hosts, (uint) (sizeof(char *) * share->all_link_count),
+ &tmp_tgt_usernames, (uint) (sizeof(char *) * share->all_link_count),
+ &tmp_tgt_passwords, (uint) (sizeof(char *) * share->all_link_count),
+ &tmp_tgt_sockets, (uint) (sizeof(char *) * share->all_link_count),
+ &tmp_tgt_wrappers, (uint) (sizeof(char *) * share->all_link_count),
+ &tmp_tgt_ssl_cas, (uint) (sizeof(char *) * share->all_link_count),
+ &tmp_tgt_ssl_capaths, (uint) (sizeof(char *) * share->all_link_count),
+ &tmp_tgt_ssl_certs, (uint) (sizeof(char *) * share->all_link_count),
+ &tmp_tgt_ssl_ciphers, (uint) (sizeof(char *) * share->all_link_count),
+ &tmp_tgt_ssl_keys, (uint) (sizeof(char *) * share->all_link_count),
+ &tmp_tgt_default_files, (uint) (sizeof(char *) * share->all_link_count),
+ &tmp_tgt_default_groups, (uint) (sizeof(char *) * share->all_link_count),
+ &tmp_static_link_ids, (uint) (sizeof(char *) * share->all_link_count),
+
+ &tmp_server_names_lengths, (uint) (sizeof(uint) * share->all_link_count),
+ &tmp_tgt_table_names_lengths,
+ (uint) (sizeof(uint) * share->all_link_count),
+ &tmp_tgt_dbs_lengths, (uint) (sizeof(uint) * share->all_link_count),
+ &tmp_tgt_hosts_lengths, (uint) (sizeof(uint) * share->all_link_count),
+ &tmp_tgt_usernames_lengths,
+ (uint) (sizeof(uint) * share->all_link_count),
+ &tmp_tgt_passwords_lengths,
+ (uint) (sizeof(uint) * share->all_link_count),
+ &tmp_tgt_sockets_lengths, (uint) (sizeof(uint) * share->all_link_count),
+ &tmp_tgt_wrappers_lengths, (uint) (sizeof(uint) * share->all_link_count),
+ &tmp_tgt_ssl_cas_lengths, (uint) (sizeof(uint) * share->all_link_count),
+ &tmp_tgt_ssl_capaths_lengths,
+ (uint) (sizeof(uint) * share->all_link_count),
+ &tmp_tgt_ssl_certs_lengths,
+ (uint) (sizeof(uint) * share->all_link_count),
+ &tmp_tgt_ssl_ciphers_lengths,
+ (uint) (sizeof(uint) * share->all_link_count),
+ &tmp_tgt_ssl_keys_lengths, (uint) (sizeof(uint) * share->all_link_count),
+ &tmp_tgt_default_files_lengths,
+ (uint) (sizeof(uint) * share->all_link_count),
+ &tmp_tgt_default_groups_lengths,
+ (uint) (sizeof(uint) * share->all_link_count),
+ &tmp_static_link_ids_lengths,
+ (uint) (sizeof(uint) * share->all_link_count),
+
+ &tmp_tgt_ports, (uint) (sizeof(long) * share->all_link_count),
+ &tmp_tgt_ssl_vscs, (uint) (sizeof(long) * share->all_link_count),
&tmp_monitoring_binlog_pos_at_failing,
- sizeof(long) * share->all_link_count,
- &tmp_link_statuses, sizeof(long) * share->all_link_count,
-
- &tmp_server_names_char, sizeof(char) *
- (share_alter->tmp_server_names_charlen + 1),
- &tmp_tgt_table_names_char, sizeof(char) *
- (share_alter->tmp_tgt_table_names_charlen + 1),
- &tmp_tgt_dbs_char, sizeof(char) *
- (share_alter->tmp_tgt_dbs_charlen + 1),
- &tmp_tgt_hosts_char, sizeof(char) *
- (share_alter->tmp_tgt_hosts_charlen + 1),
- &tmp_tgt_usernames_char, sizeof(char) *
- (share_alter->tmp_tgt_usernames_charlen + 1),
- &tmp_tgt_passwords_char, sizeof(char) *
- (share_alter->tmp_tgt_passwords_charlen + 1),
- &tmp_tgt_sockets_char, sizeof(char) *
- (share_alter->tmp_tgt_sockets_charlen + 1),
- &tmp_tgt_wrappers_char, sizeof(char) *
- (share_alter->tmp_tgt_wrappers_charlen + 1),
- &tmp_tgt_ssl_cas_char, sizeof(char) *
- (share_alter->tmp_tgt_ssl_cas_charlen + 1),
- &tmp_tgt_ssl_capaths_char, sizeof(char) *
- (share_alter->tmp_tgt_ssl_capaths_charlen + 1),
- &tmp_tgt_ssl_certs_char, sizeof(char) *
- (share_alter->tmp_tgt_ssl_certs_charlen + 1),
- &tmp_tgt_ssl_ciphers_char, sizeof(char) *
- (share_alter->tmp_tgt_ssl_ciphers_charlen + 1),
- &tmp_tgt_ssl_keys_char, sizeof(char) *
- (share_alter->tmp_tgt_ssl_keys_charlen + 1),
- &tmp_tgt_default_files_char, sizeof(char) *
- (share_alter->tmp_tgt_default_files_charlen + 1),
- &tmp_tgt_default_groups_char, sizeof(char) *
- (share_alter->tmp_tgt_default_groups_charlen + 1),
- &tmp_static_link_ids_char, sizeof(char) *
- (share_alter->tmp_static_link_ids_charlen + 1),
+ (uint) (sizeof(long) * share->all_link_count),
+ &tmp_link_statuses, (uint) (sizeof(long) * share->all_link_count),
+
+ &tmp_server_names_char, (uint) (sizeof(char) *
+ (share_alter->tmp_server_names_charlen + 1)),
+ &tmp_tgt_table_names_char, (uint) (sizeof(char) *
+ (share_alter->tmp_tgt_table_names_charlen + 1)),
+ &tmp_tgt_dbs_char, (uint) (sizeof(char) *
+ (share_alter->tmp_tgt_dbs_charlen + 1)),
+ &tmp_tgt_hosts_char, (uint) (sizeof(char) *
+ (share_alter->tmp_tgt_hosts_charlen + 1)),
+ &tmp_tgt_usernames_char, (uint) (sizeof(char) *
+ (share_alter->tmp_tgt_usernames_charlen + 1)),
+ &tmp_tgt_passwords_char, (uint) (sizeof(char) *
+ (share_alter->tmp_tgt_passwords_charlen + 1)),
+ &tmp_tgt_sockets_char, (uint) (sizeof(char) *
+ (share_alter->tmp_tgt_sockets_charlen + 1)),
+ &tmp_tgt_wrappers_char, (uint) (sizeof(char) *
+ (share_alter->tmp_tgt_wrappers_charlen + 1)),
+ &tmp_tgt_ssl_cas_char, (uint) (sizeof(char) *
+ (share_alter->tmp_tgt_ssl_cas_charlen + 1)),
+ &tmp_tgt_ssl_capaths_char, (uint) (sizeof(char) *
+ (share_alter->tmp_tgt_ssl_capaths_charlen + 1)),
+ &tmp_tgt_ssl_certs_char, (uint) (sizeof(char) *
+ (share_alter->tmp_tgt_ssl_certs_charlen + 1)),
+ &tmp_tgt_ssl_ciphers_char, (uint) (sizeof(char) *
+ (share_alter->tmp_tgt_ssl_ciphers_charlen + 1)),
+ &tmp_tgt_ssl_keys_char, (uint) (sizeof(char) *
+ (share_alter->tmp_tgt_ssl_keys_charlen + 1)),
+ &tmp_tgt_default_files_char, (uint) (sizeof(char) *
+ (share_alter->tmp_tgt_default_files_charlen + 1)),
+ &tmp_tgt_default_groups_char, (uint) (sizeof(char) *
+ (share_alter->tmp_tgt_default_groups_charlen + 1)),
+ &tmp_static_link_ids_char, (uint) (sizeof(char) *
+ (share_alter->tmp_static_link_ids_charlen + 1)),
NullS))
) {
error_num = HA_ERR_OUT_OF_MEM;
@@ -1201,10 +1210,10 @@ SPIDER_TRX *spider_get_trx(
DBUG_PRINT("info",("spider create new trx"));
if (!(trx = (SPIDER_TRX *)
spider_bulk_malloc(NULL, 56, MYF(MY_WME | MY_ZEROFILL),
- &trx, sizeof(*trx),
- &tmp_share, sizeof(SPIDER_SHARE),
- &udf_table_mutexes, sizeof(pthread_mutex_t) *
- spider_param_udf_table_lock_mutex_count(),
+ &trx, (uint) (sizeof(*trx)),
+ &tmp_share, (uint) (sizeof(SPIDER_SHARE)),
+ &udf_table_mutexes, (uint) (sizeof(pthread_mutex_t) *
+ spider_param_udf_table_lock_mutex_count()),
NullS))
)
goto error_alloc_trx;
@@ -1228,7 +1237,7 @@ SPIDER_TRX *spider_get_trx(
}
if (
- my_hash_init(&trx->trx_conn_hash, spd_charset_utf8_bin, 32, 0, 0,
+ my_hash_init(&trx->trx_conn_hash, spd_charset_utf8mb3_bin, 32, 0, 0,
(my_hash_get_key) spider_conn_get_key, 0, 0)
)
goto error_init_hash;
@@ -1240,7 +1249,7 @@ SPIDER_TRX *spider_get_trx(
trx->trx_conn_hash.array.size_of_element);
if (
- my_hash_init(&trx->trx_another_conn_hash, spd_charset_utf8_bin, 32, 0, 0,
+ my_hash_init(&trx->trx_another_conn_hash, spd_charset_utf8mb3_bin, 32, 0, 0,
(my_hash_get_key) spider_conn_get_key, 0, 0)
)
goto error_init_another_hash;
@@ -1253,7 +1262,7 @@ SPIDER_TRX *spider_get_trx(
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
if (
- my_hash_init(&trx->trx_hs_r_conn_hash, spd_charset_utf8_bin, 32, 0, 0,
+ my_hash_init(&trx->trx_hs_r_conn_hash, spd_charset_utf8mb3_bin, 32, 0, 0,
(my_hash_get_key) spider_conn_get_key, 0, 0)
)
goto error_hs_r_init_hash;
@@ -1265,7 +1274,7 @@ SPIDER_TRX *spider_get_trx(
trx->trx_hs_r_conn_hash.array.size_of_element);
if (
- my_hash_init(&trx->trx_hs_w_conn_hash, spd_charset_utf8_bin, 32, 0, 0,
+ my_hash_init(&trx->trx_hs_w_conn_hash, spd_charset_utf8mb3_bin, 32, 0, 0,
(my_hash_get_key) spider_conn_get_key, 0, 0)
)
goto error_hs_w_init_hash;
@@ -1279,7 +1288,7 @@ SPIDER_TRX *spider_get_trx(
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
if (
- my_hash_init(&trx->trx_direct_hs_r_conn_hash, spd_charset_utf8_bin, 32,
+ my_hash_init(&trx->trx_direct_hs_r_conn_hash, spd_charset_utf8mb3_bin, 32,
0, 0, (my_hash_get_key) spider_conn_get_key, 0, 0)
)
goto error_direct_hs_r_init_hash;
@@ -1291,7 +1300,7 @@ SPIDER_TRX *spider_get_trx(
trx->trx_direct_hs_r_conn_hash.array.size_of_element);
if (
- my_hash_init(&trx->trx_direct_hs_w_conn_hash, spd_charset_utf8_bin, 32,
+ my_hash_init(&trx->trx_direct_hs_w_conn_hash, spd_charset_utf8mb3_bin, 32,
0, 0, (my_hash_get_key) spider_conn_get_key, 0, 0)
)
goto error_direct_hs_w_init_hash;
@@ -1304,7 +1313,7 @@ SPIDER_TRX *spider_get_trx(
#endif
if (
- my_hash_init(&trx->trx_alter_table_hash, spd_charset_utf8_bin, 32, 0, 0,
+ my_hash_init(&trx->trx_alter_table_hash, spd_charset_utf8mb3_bin, 32, 0, 0,
(my_hash_get_key) spider_alter_tbl_get_key, 0, 0)
)
goto error_init_alter_hash;
@@ -1316,7 +1325,7 @@ SPIDER_TRX *spider_get_trx(
trx->trx_alter_table_hash.array.size_of_element);
if (
- my_hash_init(&trx->trx_ha_hash, spd_charset_utf8_bin, 32, 0, 0,
+ my_hash_init(&trx->trx_ha_hash, spd_charset_utf8mb3_bin, 32, 0, 0,
(my_hash_get_key) spider_trx_ha_get_key, 0, 0)
)
goto error_init_trx_ha_hash;
@@ -1557,7 +1566,8 @@ error_alloc_trx:
int spider_free_trx(
SPIDER_TRX *trx,
- bool need_lock
+ bool need_lock,
+ bool reset_ha_data
) {
DBUG_ENTER("spider_free_trx");
if (trx->thd)
@@ -1575,7 +1585,8 @@ int spider_free_trx(
if (need_lock)
pthread_mutex_unlock(&spider_allocated_thds_mutex);
}
- thd_set_ha_data(trx->thd, spider_hton_ptr, NULL);
+ if (reset_ha_data)
+ thd_set_ha_data(trx->thd, spider_hton_ptr, NULL);
}
spider_free_trx_alloc(trx);
spider_merge_mem_calc(trx, TRUE);
@@ -4216,10 +4227,10 @@ int spider_create_trx_ha(
{
if (!(trx_ha = (SPIDER_TRX_HA *)
spider_bulk_malloc(spider_current_trx, 58, MYF(MY_WME),
- &trx_ha, sizeof(SPIDER_TRX_HA),
- &tmp_name, sizeof(char *) * (share->table_name_length + 1),
- &conn_link_idx, sizeof(uint) * share->link_count,
- &conn_can_fo, sizeof(uchar) * share->link_bitmap_size,
+ &trx_ha, (uint) (sizeof(SPIDER_TRX_HA)),
+ &tmp_name, (uint) (sizeof(char *) * (share->table_name_length + 1)),
+ &conn_link_idx, (uint) (sizeof(uint) * share->link_count),
+ &conn_can_fo, (uint) (sizeof(uchar) * share->link_bitmap_size),
NullS))
) {
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
diff --git a/storage/spider/spd_trx.h b/storage/spider/spd_trx.h
index 3883ec49723..ca46bae20cc 100644
--- a/storage/spider/spd_trx.h
+++ b/storage/spider/spd_trx.h
@@ -80,7 +80,8 @@ SPIDER_TRX *spider_get_trx(
int spider_free_trx(
SPIDER_TRX *trx,
- bool need_lock
+ bool need_lock,
+ bool reset_ha_data= true
);
int spider_check_and_set_trx_isolation(
diff --git a/storage/test_sql_discovery/mysql-test/sql_discovery/simple.result b/storage/test_sql_discovery/mysql-test/sql_discovery/simple.result
index 23b7804638f..d63ec136225 100644
--- a/storage/test_sql_discovery/mysql-test/sql_discovery/simple.result
+++ b/storage/test_sql_discovery/mysql-test/sql_discovery/simple.result
@@ -82,7 +82,7 @@ select * from t1;
ERROR HY000: Engine TEST_SQL_DISCOVERY failed to discover table `test`.`t1` with 'create table t1 (a uint)'
show warnings;
Level Code Message
-Error 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'uint)' at line 1
+Error 4161 Unknown data type: 'uint'
Error 1939 Engine TEST_SQL_DISCOVERY failed to discover table `test`.`t1` with 'create table t1 (a uint)'
set @@test_sql_discovery_statement='t1:create table t1 (a int)';
select * from t1;
diff --git a/storage/tokudb/CMakeLists.txt b/storage/tokudb/CMakeLists.txt
index 3b4e4fb967e..c4f50e967cb 100644
--- a/storage/tokudb/CMakeLists.txt
+++ b/storage/tokudb/CMakeLists.txt
@@ -38,6 +38,7 @@ SET(TOKUDB_SOURCES
tokudb_thread.cc
tokudb_dir_cmd.cc)
MYSQL_ADD_PLUGIN(tokudb ${TOKUDB_SOURCES} STORAGE_ENGINE MODULE_ONLY
+ DISABLED
COMPONENT tokudb-engine CONFIG ${CMAKE_CURRENT_BINARY_DIR}/tokudb.cnf)
IF(NOT TARGET tokudb)
diff --git a/storage/tokudb/hatoku_hton.cc b/storage/tokudb/hatoku_hton.cc
index 81355ea20ff..a52f64dc807 100644
--- a/storage/tokudb/hatoku_hton.cc
+++ b/storage/tokudb/hatoku_hton.cc
@@ -348,7 +348,6 @@ static int tokudb_init_func(void *p) {
TOKUDB_SHARE::static_init();
tokudb::background::initialize();
- tokudb_hton->state = SHOW_OPTION_YES;
// tokudb_hton->flags= HTON_CAN_RECREATE; // QQQ this came from skeleton
tokudb_hton->flags = HTON_CLOSE_CURSORS_AT_COMMIT | HTON_SUPPORTS_EXTENDED_KEYS;
diff --git a/storage/tokudb/mysql-test/tokudb/t/bf_delete.test b/storage/tokudb/mysql-test/tokudb/t/bf_delete.test
index a55d78784cc..cdfb5dbc1a6 100644
--- a/storage/tokudb/mysql-test/tokudb/t/bf_delete.test
+++ b/storage/tokudb/mysql-test/tokudb/t/bf_delete.test
@@ -2,6 +2,8 @@
source include/have_tokudb.inc;
source include/big_test.inc;
+# ASan causes test to timeout
+source include/not_asan.inc;
set default_storage_engine='tokudb';
disable_warnings;
drop table if exists t;
diff --git a/storage/tokudb/mysql-test/tokudb_i_s/r/tokudb_background_job_status.result b/storage/tokudb/mysql-test/tokudb_i_s/r/tokudb_background_job_status.result
new file mode 100644
index 00000000000..a4e42a10b57
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_i_s/r/tokudb_background_job_status.result
@@ -0,0 +1,13 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.TOKUDB_BACKGROUND_JOB_STATUS;
+Table Create Table
+TokuDB_background_job_status CREATE TEMPORARY TABLE `TokuDB_background_job_status` (
+ `id` bigint(0) NOT NULL DEFAULT 0,
+ `database_name` varchar(256) NOT NULL DEFAULT '',
+ `table_name` varchar(256) NOT NULL DEFAULT '',
+ `job_type` varchar(256) NOT NULL DEFAULT '',
+ `job_params` varchar(256) NOT NULL DEFAULT '',
+ `scheduler` varchar(32) NOT NULL DEFAULT '',
+ `scheduled_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `started_time` datetime DEFAULT NULL,
+ `status` varchar(1024) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/storage/tokudb/mysql-test/tokudb_i_s/r/tokudb_file_map.result b/storage/tokudb/mysql-test/tokudb_i_s/r/tokudb_file_map.result
new file mode 100644
index 00000000000..1d82039ebf3
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_i_s/r/tokudb_file_map.result
@@ -0,0 +1,9 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.TOKUDB_FILE_MAP;
+Table Create Table
+TokuDB_file_map CREATE TEMPORARY TABLE `TokuDB_file_map` (
+ `dictionary_name` varchar(256) NOT NULL DEFAULT '',
+ `internal_file_name` varchar(256) NOT NULL DEFAULT '',
+ `table_schema` varchar(256) NOT NULL DEFAULT '',
+ `table_name` varchar(256) NOT NULL DEFAULT '',
+ `table_dictionary_name` varchar(256) NOT NULL DEFAULT ''
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/storage/tokudb/mysql-test/tokudb_i_s/r/tokudb_fractal_tree_block_map.result b/storage/tokudb/mysql-test/tokudb_i_s/r/tokudb_fractal_tree_block_map.result
new file mode 100644
index 00000000000..a90db7a5b96
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_i_s/r/tokudb_fractal_tree_block_map.result
@@ -0,0 +1,13 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.TOKUDB_FRACTAL_TREE_BLOCK_MAP;
+Table Create Table
+TokuDB_fractal_tree_block_map CREATE TEMPORARY TABLE `TokuDB_fractal_tree_block_map` (
+ `dictionary_name` varchar(256) NOT NULL DEFAULT '',
+ `internal_file_name` varchar(256) NOT NULL DEFAULT '',
+ `checkpoint_count` bigint(0) NOT NULL DEFAULT 0,
+ `blocknum` bigint(0) NOT NULL DEFAULT 0,
+ `offset` bigint(0) DEFAULT NULL,
+ `size` bigint(0) DEFAULT NULL,
+ `table_schema` varchar(256) NOT NULL DEFAULT '',
+ `table_name` varchar(256) NOT NULL DEFAULT '',
+ `table_dictionary_name` varchar(256) NOT NULL DEFAULT ''
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/storage/tokudb/mysql-test/tokudb_i_s/r/tokudb_fractal_tree_info.result b/storage/tokudb/mysql-test/tokudb_i_s/r/tokudb_fractal_tree_info.result
new file mode 100644
index 00000000000..6b071d35b46
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_i_s/r/tokudb_fractal_tree_info.result
@@ -0,0 +1,13 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.TOKUDB_FRACTAL_TREE_INFO;
+Table Create Table
+TokuDB_fractal_tree_info CREATE TEMPORARY TABLE `TokuDB_fractal_tree_info` (
+ `dictionary_name` varchar(256) NOT NULL DEFAULT '',
+ `internal_file_name` varchar(256) NOT NULL DEFAULT '',
+ `bt_num_blocks_allocated` bigint(0) NOT NULL DEFAULT 0,
+ `bt_num_blocks_in_use` bigint(0) NOT NULL DEFAULT 0,
+ `bt_size_allocated` bigint(0) NOT NULL DEFAULT 0,
+ `bt_size_in_use` bigint(0) NOT NULL DEFAULT 0,
+ `table_schema` varchar(256) NOT NULL DEFAULT '',
+ `table_name` varchar(256) NOT NULL DEFAULT '',
+ `table_dictionary_name` varchar(256) NOT NULL DEFAULT ''
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/storage/tokudb/mysql-test/tokudb_i_s/r/tokudb_lock_waits.result b/storage/tokudb/mysql-test/tokudb_i_s/r/tokudb_lock_waits.result
new file mode 100644
index 00000000000..b90db36691c
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_i_s/r/tokudb_lock_waits.result
@@ -0,0 +1,13 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.TOKUDB_LOCK_WAITS;
+Table Create Table
+TokuDB_lock_waits CREATE TEMPORARY TABLE `TokuDB_lock_waits` (
+ `requesting_trx_id` bigint(0) NOT NULL DEFAULT 0,
+ `blocking_trx_id` bigint(0) NOT NULL DEFAULT 0,
+ `lock_waits_dname` varchar(256) NOT NULL DEFAULT '',
+ `lock_waits_key_left` varchar(256) NOT NULL DEFAULT '',
+ `lock_waits_key_right` varchar(256) NOT NULL DEFAULT '',
+ `lock_waits_start_time` bigint(0) NOT NULL DEFAULT 0,
+ `lock_waits_table_schema` varchar(256) NOT NULL DEFAULT '',
+ `lock_waits_table_name` varchar(256) NOT NULL DEFAULT '',
+ `lock_waits_table_dictionary_name` varchar(256) NOT NULL DEFAULT ''
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/storage/tokudb/mysql-test/tokudb_i_s/r/tokudb_locks.result b/storage/tokudb/mysql-test/tokudb_i_s/r/tokudb_locks.result
new file mode 100644
index 00000000000..2c1084643d8
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_i_s/r/tokudb_locks.result
@@ -0,0 +1,12 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.TOKUDB_LOCKS;
+Table Create Table
+TokuDB_locks CREATE TEMPORARY TABLE `TokuDB_locks` (
+ `locks_trx_id` bigint(0) NOT NULL DEFAULT 0,
+ `locks_mysql_thread_id` bigint(0) NOT NULL DEFAULT 0,
+ `locks_dname` varchar(256) NOT NULL DEFAULT '',
+ `locks_key_left` varchar(256) NOT NULL DEFAULT '',
+ `locks_key_right` varchar(256) NOT NULL DEFAULT '',
+ `locks_table_schema` varchar(256) NOT NULL DEFAULT '',
+ `locks_table_name` varchar(256) NOT NULL DEFAULT '',
+ `locks_table_dictionary_name` varchar(256) NOT NULL DEFAULT ''
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/storage/tokudb/mysql-test/tokudb_i_s/r/tokudb_trx.result b/storage/tokudb/mysql-test/tokudb_i_s/r/tokudb_trx.result
new file mode 100644
index 00000000000..94c1b0c7642
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_i_s/r/tokudb_trx.result
@@ -0,0 +1,7 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.TOKUDB_TRX;
+Table Create Table
+TokuDB_trx CREATE TEMPORARY TABLE `TokuDB_trx` (
+ `trx_id` bigint(0) NOT NULL DEFAULT 0,
+ `trx_mysql_thread_id` bigint(0) NOT NULL DEFAULT 0,
+ `trx_time` bigint(0) NOT NULL DEFAULT 0
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/storage/tokudb/mysql-test/tokudb_i_s/suite.opt b/storage/tokudb/mysql-test/tokudb_i_s/suite.opt
new file mode 100644
index 00000000000..ea8042b7740
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_i_s/suite.opt
@@ -0,0 +1 @@
+--tokudb --plugin-load-add=$HA_TOKUDB_SO --loose-tokudb-check-jemalloc=0
diff --git a/storage/tokudb/mysql-test/tokudb_i_s/suite.pm b/storage/tokudb/mysql-test/tokudb_i_s/suite.pm
new file mode 100644
index 00000000000..a6e01cd6dd4
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_i_s/suite.pm
@@ -0,0 +1,14 @@
+package My::Suite::TokuDB_bugs;
+use File::Basename;
+@ISA = qw(My::Suite);
+
+# Ensure we can run the TokuDB tests even if hugepages are enabled
+$ENV{TOKU_HUGE_PAGES_OK}=1;
+
+#return "Not run for embedded server" if $::opt_embedded_server;
+return "No TokuDB engine" unless $ENV{HA_TOKUDB_SO} or $::mysqld_variables{tokudb};
+
+sub is_default { not $::opt_embedded_server }
+
+bless { };
+
diff --git a/storage/tokudb/mysql-test/tokudb_i_s/t/tokudb_background_job_status.test b/storage/tokudb/mysql-test/tokudb_i_s/t/tokudb_background_job_status.test
new file mode 100644
index 00000000000..7d52e902b03
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_i_s/t/tokudb_background_job_status.test
@@ -0,0 +1 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.TOKUDB_BACKGROUND_JOB_STATUS;
diff --git a/storage/tokudb/mysql-test/tokudb_i_s/t/tokudb_file_map.test b/storage/tokudb/mysql-test/tokudb_i_s/t/tokudb_file_map.test
new file mode 100644
index 00000000000..ef45fa58651
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_i_s/t/tokudb_file_map.test
@@ -0,0 +1 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.TOKUDB_FILE_MAP;
diff --git a/storage/tokudb/mysql-test/tokudb_i_s/t/tokudb_fractal_tree_block_map.test b/storage/tokudb/mysql-test/tokudb_i_s/t/tokudb_fractal_tree_block_map.test
new file mode 100644
index 00000000000..655714c31d4
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_i_s/t/tokudb_fractal_tree_block_map.test
@@ -0,0 +1 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.TOKUDB_FRACTAL_TREE_BLOCK_MAP;
diff --git a/storage/tokudb/mysql-test/tokudb_i_s/t/tokudb_fractal_tree_info.test b/storage/tokudb/mysql-test/tokudb_i_s/t/tokudb_fractal_tree_info.test
new file mode 100644
index 00000000000..d05d20a58f3
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_i_s/t/tokudb_fractal_tree_info.test
@@ -0,0 +1 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.TOKUDB_FRACTAL_TREE_INFO;
diff --git a/storage/tokudb/mysql-test/tokudb_i_s/t/tokudb_lock_waits.test b/storage/tokudb/mysql-test/tokudb_i_s/t/tokudb_lock_waits.test
new file mode 100644
index 00000000000..5a43ec908ef
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_i_s/t/tokudb_lock_waits.test
@@ -0,0 +1 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.TOKUDB_LOCK_WAITS;
diff --git a/storage/tokudb/mysql-test/tokudb_i_s/t/tokudb_locks.test b/storage/tokudb/mysql-test/tokudb_i_s/t/tokudb_locks.test
new file mode 100644
index 00000000000..7975c2f9e6c
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_i_s/t/tokudb_locks.test
@@ -0,0 +1 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.TOKUDB_LOCKS;
diff --git a/storage/tokudb/mysql-test/tokudb_i_s/t/tokudb_trx.test b/storage/tokudb/mysql-test/tokudb_i_s/t/tokudb_trx.test
new file mode 100644
index 00000000000..adb4b631809
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_i_s/t/tokudb_trx.test
@@ -0,0 +1 @@
+SHOW CREATE TABLE INFORMATION_SCHEMA.TOKUDB_TRX;
diff --git a/storage/tokudb/mysql-test/tokudb_parts/t/partition_alter4_tokudb.test b/storage/tokudb/mysql-test/tokudb_parts/t/partition_alter4_tokudb.test
index 93a3a0cbdce..e450574634b 100644
--- a/storage/tokudb/mysql-test/tokudb_parts/t/partition_alter4_tokudb.test
+++ b/storage/tokudb/mysql-test/tokudb_parts/t/partition_alter4_tokudb.test
@@ -49,6 +49,8 @@ let $more_pk_ui_tests= 0;
--source include/big_test.inc
# Skiping this test from Valgrind execution as per Bug-14627884
--source include/not_valgrind.inc
+# Don't run with asan as it causes timeouts
+--source include/not_asan.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
diff --git a/storage/tokudb/tokudb_information_schema.cc b/storage/tokudb/tokudb_information_schema.cc
index 0b9882060cd..fef72557b18 100644
--- a/storage/tokudb/tokudb_information_schema.cc
+++ b/storage/tokudb/tokudb_information_schema.cc
@@ -56,11 +56,17 @@ st_mysql_information_schema trx_information_schema = {
MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION
};
+using ::Show::Column;
+using ::Show::SLonglong;
+using ::Show::CEnd;
+using ::Show::Varchar;
+using ::Show::Datetime;
+
ST_FIELD_INFO 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}
+ Column("trx_id", SLonglong(0), NOT_NULL),
+ Column("trx_mysql_thread_id", SLonglong(0), NOT_NULL),
+ Column("trx_time", SLonglong(0), NOT_NULL),
+ CEnd()
};
struct trx_extra_t {
@@ -152,16 +158,16 @@ st_mysql_information_schema lock_waits_information_schema = {
};
ST_FIELD_INFO lock_waits_field_info[] = {
- {"requesting_trx_id", 0, MYSQL_TYPE_LONGLONG, 0, 0, NULL, SKIP_OPEN_TABLE },
- {"blocking_trx_id", 0, MYSQL_TYPE_LONGLONG, 0, 0, NULL, SKIP_OPEN_TABLE },
- {"lock_waits_dname", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
- {"lock_waits_key_left", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
- {"lock_waits_key_right", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
- {"lock_waits_start_time", 0, MYSQL_TYPE_LONGLONG, 0, 0, NULL, SKIP_OPEN_TABLE },
- {"lock_waits_table_schema", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
- {"lock_waits_table_name", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
- {"lock_waits_table_dictionary_name", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
- {NULL, 0, MYSQL_TYPE_NULL, 0, 0, NULL, SKIP_OPEN_TABLE}
+ Column("requesting_trx_id", SLonglong(0), NOT_NULL),
+ Column("blocking_trx_id", SLonglong(0), NOT_NULL),
+ Column("lock_waits_dname", Varchar(256), NOT_NULL),
+ Column("lock_waits_key_left", Varchar(256), NOT_NULL),
+ Column("lock_waits_key_right", Varchar(256), NOT_NULL),
+ Column("lock_waits_start_time", SLonglong(0), NOT_NULL),
+ Column("lock_waits_table_schema", Varchar(256), NOT_NULL),
+ Column("lock_waits_table_name", Varchar(256), NOT_NULL),
+ Column("lock_waits_table_dictionary_name", Varchar(256), NOT_NULL),
+ CEnd()
};
struct lock_waits_extra_t {
@@ -293,16 +299,16 @@ st_mysql_information_schema locks_information_schema = {
MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION
};
- ST_FIELD_INFO locks_field_info[] = {
- {"locks_trx_id", 0, MYSQL_TYPE_LONGLONG, 0, 0, NULL, SKIP_OPEN_TABLE },
- {"locks_mysql_thread_id", 0, MYSQL_TYPE_LONGLONG, 0, 0, NULL, SKIP_OPEN_TABLE },
- {"locks_dname", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
- {"locks_key_left", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
- {"locks_key_right", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
- {"locks_table_schema", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
- {"locks_table_name", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
- {"locks_table_dictionary_name", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
- {NULL, 0, MYSQL_TYPE_NULL, 0, 0, NULL, SKIP_OPEN_TABLE}
+ST_FIELD_INFO locks_field_info[] = {
+ Column("locks_trx_id", SLonglong(0), NOT_NULL),
+ Column("locks_mysql_thread_id", SLonglong(0), NOT_NULL),
+ Column("locks_dname", Varchar(256), NOT_NULL),
+ Column("locks_key_left", Varchar(256), NOT_NULL),
+ Column("locks_key_right", Varchar(256), NOT_NULL),
+ Column("locks_table_schema", Varchar(256), NOT_NULL),
+ Column("locks_table_name", Varchar(256), NOT_NULL),
+ Column("locks_table_dictionary_name", Varchar(256), NOT_NULL),
+ CEnd()
};
struct locks_extra_t {
@@ -434,12 +440,12 @@ st_mysql_information_schema file_map_information_schema = {
};
ST_FIELD_INFO file_map_field_info[] = {
- {"dictionary_name", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
- {"internal_file_name", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
- {"table_schema", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
- {"table_name", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
- {"table_dictionary_name", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
- {NULL, 0, MYSQL_TYPE_NULL, 0, 0, NULL, SKIP_OPEN_TABLE}
+ Column("dictionary_name", Varchar(256), NOT_NULL),
+ Column("internal_file_name", Varchar(256), NOT_NULL),
+ Column("table_schema", Varchar(256), NOT_NULL),
+ Column("table_name", Varchar(256), NOT_NULL),
+ Column("table_dictionary_name", Varchar(256), NOT_NULL),
+ CEnd()
};
int report_file_map(TABLE* table, THD* thd) {
@@ -581,16 +587,16 @@ st_mysql_information_schema fractal_tree_info_information_schema = {
};
ST_FIELD_INFO fractal_tree_info_field_info[] = {
- {"dictionary_name", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
- {"internal_file_name", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
- {"bt_num_blocks_allocated", 0, MYSQL_TYPE_LONGLONG, 0, 0, NULL, SKIP_OPEN_TABLE },
- {"bt_num_blocks_in_use", 0, MYSQL_TYPE_LONGLONG, 0, 0, NULL, SKIP_OPEN_TABLE },
- {"bt_size_allocated", 0, MYSQL_TYPE_LONGLONG, 0, 0, NULL, SKIP_OPEN_TABLE },
- {"bt_size_in_use", 0, MYSQL_TYPE_LONGLONG, 0, 0, NULL, SKIP_OPEN_TABLE },
- {"table_schema", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
- {"table_name", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
- {"table_dictionary_name", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
- {NULL, 0, MYSQL_TYPE_NULL, 0, 0, NULL, SKIP_OPEN_TABLE}
+ Column("dictionary_name", Varchar(256), NOT_NULL),
+ Column("internal_file_name", Varchar(256), NOT_NULL),
+ Column("bt_num_blocks_allocated", SLonglong(0), NOT_NULL),
+ Column("bt_num_blocks_in_use", SLonglong(0), NOT_NULL),
+ Column("bt_size_allocated", SLonglong(0), NOT_NULL),
+ Column("bt_size_in_use", SLonglong(0), NOT_NULL),
+ Column("table_schema", Varchar(256), NOT_NULL),
+ Column("table_name", Varchar(256), NOT_NULL),
+ Column("table_dictionary_name", Varchar(256), NOT_NULL),
+ CEnd()
};
int report_fractal_tree_info_for_db(
@@ -793,16 +799,16 @@ st_mysql_information_schema fractal_tree_block_map_information_schema = {
};
ST_FIELD_INFO fractal_tree_block_map_field_info[] = {
- {"dictionary_name", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
- {"internal_file_name", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
- {"checkpoint_count", 0, MYSQL_TYPE_LONGLONG, 0, 0, NULL, SKIP_OPEN_TABLE },
- {"blocknum", 0, MYSQL_TYPE_LONGLONG, 0, 0, NULL, SKIP_OPEN_TABLE },
- {"offset", 0, MYSQL_TYPE_LONGLONG, 0, MY_I_S_MAYBE_NULL, NULL, SKIP_OPEN_TABLE },
- {"size", 0, MYSQL_TYPE_LONGLONG, 0, MY_I_S_MAYBE_NULL, NULL, SKIP_OPEN_TABLE },
- {"table_schema", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
- {"table_name", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
- {"table_dictionary_name", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
- {NULL, 0, MYSQL_TYPE_NULL, 0, 0, NULL, SKIP_OPEN_TABLE}
+ Column("dictionary_name", Varchar(256), NOT_NULL),
+ Column("internal_file_name", Varchar(256), NOT_NULL),
+ Column("checkpoint_count", SLonglong(0), NOT_NULL),
+ Column("blocknum", SLonglong(0), NOT_NULL),
+ Column("offset", SLonglong(0), NULLABLE),
+ Column("size", SLonglong(0), NULLABLE),
+ Column("table_schema", Varchar(256), NOT_NULL),
+ Column("table_name", Varchar(256), NOT_NULL),
+ Column("table_dictionary_name", Varchar(256), NOT_NULL),
+ CEnd()
};
struct report_fractal_tree_block_map_iterator_extra_t {
@@ -1089,16 +1095,16 @@ st_mysql_information_schema background_job_status_information_schema = {
};
ST_FIELD_INFO background_job_status_field_info[] = {
- {"id", 0, MYSQL_TYPE_LONGLONG, 0, 0, NULL, SKIP_OPEN_TABLE },
- {"database_name", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
- {"table_name", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
- {"job_type", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
- {"job_params", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
- {"scheduler", 32, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
- {"scheduled_time", 0, MYSQL_TYPE_DATETIME, 0, 0, NULL, SKIP_OPEN_TABLE },
- {"started_time", 0, MYSQL_TYPE_DATETIME, 0, MY_I_S_MAYBE_NULL, NULL, SKIP_OPEN_TABLE },
- {"status", 1024, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, NULL, SKIP_OPEN_TABLE },
- {NULL, 0, MYSQL_TYPE_NULL, 0, 0, NULL, SKIP_OPEN_TABLE}
+ Column("id", SLonglong(0), NOT_NULL),
+ Column("database_name", Varchar(256), NOT_NULL),
+ Column("table_name", Varchar(256), NOT_NULL),
+ Column("job_type", Varchar(256), NOT_NULL),
+ Column("job_params", Varchar(256), NOT_NULL),
+ Column("scheduler", Varchar(32), NOT_NULL),
+ Column("scheduled_time", Datetime(0), NOT_NULL),
+ Column("started_time", Datetime(0), NULLABLE),
+ Column("status", Varchar(1024), NULLABLE),
+ CEnd()
};
struct background_job_status_extra {
diff --git a/strings/CHARSET_INFO.txt b/strings/CHARSET_INFO.txt
index 6f0a810be37..922a372495b 100644
--- a/strings/CHARSET_INFO.txt
+++ b/strings/CHARSET_INFO.txt
@@ -129,7 +129,7 @@ In all Asian charsets these arrays are set up as follows:
In Unicode character sets we have full support of UPPER/LOWER mapping,
for sorting order, and for character type detection.
-"utf8_general_ci" still has the "old-fashioned" arrays
+"utf8mb3_general_ci" still has the "old-fashioned" arrays
like to_upper, to_lower, sort_order and ctype, but they are
not really used (maybe only in some rare legacy functions).
diff --git a/strings/ctype-mb.ic b/strings/ctype-mb.ic
index 336c482d24f..6cde31a34ad 100644
--- a/strings/ctype-mb.ic
+++ b/strings/ctype-mb.ic
@@ -167,7 +167,7 @@ MY_FUNCTION_NAME(well_formed_char_length)(CHARSET_INFO *cs __attribute__((unused
/**
Returns well formed length of a string
measured in characters (rather than in bytes).
- Version for character sets that define CHARLEN(), e.g. utf8.
+ Version for character sets that define CHARLEN(), e.g. utf8mb3.
CHARLEN(cs,b,e) must use the same return code convension that mb_wc() does:
- a positive number in the range [1-mbmaxlen] if a valid
single-byte or multi-byte character was found
diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c
index 312b903ea64..99a0d0f46ae 100644
--- a/strings/ctype-uca.c
+++ b/strings/ctype-uca.c
@@ -32312,7 +32312,7 @@ static my_coll_lexem_num my_coll_lexem_next(MY_COLL_LEXEM *lexem)
/* Escaped character, e.g. \u1234 */
if ((*beg == '\\') && (beg + 2 < lexem->end) &&
- (beg[1] == 'u') && my_isxdigit(&my_charset_utf8_general_ci, beg[2]))
+ (beg[1] == 'u') && my_isxdigit(&my_charset_utf8mb3_general_ci, beg[2]))
{
int ch;
@@ -32341,7 +32341,7 @@ static my_coll_lexem_num my_coll_lexem_next(MY_COLL_LEXEM *lexem)
if (((uchar) *beg) > 0x7F) /* Unescaped multibyte character */
{
- CHARSET_INFO *cs= &my_charset_utf8_general_ci;
+ CHARSET_INFO *cs= &my_charset_utf8mb3_general_ci;
my_wc_t wc;
int nbytes= cs->cset->mb_wc(cs, &wc,
(uchar *) beg, (uchar *) lexem->end);
@@ -33720,7 +33720,7 @@ static my_bool
my_coll_init_uca(struct charset_info_st *cs, MY_CHARSET_LOADER *loader)
{
cs->pad_char= ' ';
- cs->ctype= my_charset_utf8_unicode_ci.ctype;
+ cs->ctype= my_charset_utf8mb3_unicode_ci.ctype;
if (!cs->caseinfo)
cs->caseinfo= &my_unicase_default;
return create_tailoring(cs, loader);
@@ -33894,7 +33894,7 @@ struct charset_info_st my_charset_ucs2_unicode_ci=
{
128,0,0, /* number */
MY_CS_UCS2_UCA_FLAGS,/* state */
- "ucs2", /* cs name */
+ "ucs2", /* cs name */
"ucs2_unicode_ci", /* name */
"", /* comment */
"", /* tailoring */
@@ -33926,7 +33926,7 @@ struct charset_info_st my_charset_ucs2_icelandic_uca_ci=
{
129,0,0, /* number */
MY_CS_UCS2_UCA_FLAGS,/* state */
- "ucs2", /* cs name */
+ "ucs2", /* cs name */
"ucs2_icelandic_ci",/* name */
"", /* comment */
icelandic, /* tailoring */
@@ -33958,7 +33958,7 @@ struct charset_info_st my_charset_ucs2_latvian_uca_ci=
{
130,0,0, /* number */
MY_CS_UCS2_UCA_FLAGS,/* state */
- "ucs2", /* cs name */
+ "ucs2", /* cs name */
"ucs2_latvian_ci", /* name */
"", /* comment */
latvian, /* tailoring */
@@ -33990,7 +33990,7 @@ struct charset_info_st my_charset_ucs2_romanian_uca_ci=
{
131,0,0, /* number */
MY_CS_UCS2_UCA_FLAGS,/* state */
- "ucs2", /* cs name */
+ "ucs2", /* cs name */
"ucs2_romanian_ci", /* name */
"", /* comment */
romanian, /* tailoring */
@@ -34022,7 +34022,7 @@ struct charset_info_st my_charset_ucs2_slovenian_uca_ci=
{
132,0,0, /* number */
MY_CS_UCS2_UCA_FLAGS,/* state */
- "ucs2", /* cs name */
+ "ucs2", /* cs name */
"ucs2_slovenian_ci",/* name */
"", /* comment */
slovenian, /* tailoring */
@@ -34054,7 +34054,7 @@ struct charset_info_st my_charset_ucs2_polish_uca_ci=
{
133,0,0, /* number */
MY_CS_UCS2_UCA_FLAGS,/* state */
- "ucs2", /* cs name */
+ "ucs2", /* cs name */
"ucs2_polish_ci", /* name */
"", /* comment */
polish, /* tailoring */
@@ -34086,7 +34086,7 @@ struct charset_info_st my_charset_ucs2_estonian_uca_ci=
{
134,0,0, /* number */
MY_CS_UCS2_UCA_FLAGS,/* state */
- "ucs2", /* cs name */
+ "ucs2", /* cs name */
"ucs2_estonian_ci", /* name */
"", /* comment */
estonian, /* tailoring */
@@ -34118,7 +34118,7 @@ struct charset_info_st my_charset_ucs2_spanish_uca_ci=
{
135,0,0, /* number */
MY_CS_UCS2_UCA_FLAGS,/* state */
- "ucs2", /* cs name */
+ "ucs2", /* cs name */
"ucs2_spanish_ci", /* name */
"", /* comment */
spanish, /* tailoring */
@@ -34150,7 +34150,7 @@ struct charset_info_st my_charset_ucs2_swedish_uca_ci=
{
136,0,0, /* number */
MY_CS_UCS2_UCA_FLAGS,/* state */
- "ucs2", /* cs name */
+ "ucs2", /* cs name */
"ucs2_swedish_ci", /* name */
"", /* comment */
swedish, /* tailoring */
@@ -34182,7 +34182,7 @@ struct charset_info_st my_charset_ucs2_turkish_uca_ci=
{
137,0,0, /* number */
MY_CS_UCS2_UCA_FLAGS,/* state */
- "ucs2", /* cs name */
+ "ucs2", /* cs name */
"ucs2_turkish_ci", /* name */
"", /* comment */
turkish, /* tailoring */
@@ -34214,7 +34214,7 @@ struct charset_info_st my_charset_ucs2_czech_uca_ci=
{
138,0,0, /* number */
MY_CS_UCS2_UCA_FLAGS,/* state */
- "ucs2", /* cs name */
+ "ucs2", /* cs name */
"ucs2_czech_ci", /* name */
"", /* comment */
czech, /* tailoring */
@@ -34247,7 +34247,7 @@ struct charset_info_st my_charset_ucs2_danish_uca_ci=
{
139,0,0, /* number */
MY_CS_UCS2_UCA_FLAGS,/* state */
- "ucs2", /* cs name */
+ "ucs2", /* cs name */
"ucs2_danish_ci", /* name */
"", /* comment */
danish, /* tailoring */
@@ -34279,8 +34279,8 @@ struct charset_info_st my_charset_ucs2_lithuanian_uca_ci=
{
140,0,0, /* number */
MY_CS_UCS2_UCA_FLAGS,/* state */
- "ucs2", /* cs name */
- "ucs2_lithuanian_ci",/* name */
+ "ucs2", /* cs name */
+ "ucs2_lithuanian_ci",/* name */
"", /* comment */
lithuanian, /* tailoring */
NULL, /* ctype */
@@ -34311,7 +34311,7 @@ struct charset_info_st my_charset_ucs2_slovak_uca_ci=
{
141,0,0, /* number */
MY_CS_UCS2_UCA_FLAGS,/* state */
- "ucs2", /* cs name */
+ "ucs2", /* cs name */
"ucs2_slovak_ci", /* name */
"", /* comment */
slovak, /* tailoring */
@@ -34343,7 +34343,7 @@ struct charset_info_st my_charset_ucs2_spanish2_uca_ci=
{
142,0,0, /* number */
MY_CS_UCS2_UCA_FLAGS,/* state */
- "ucs2", /* cs name */
+ "ucs2", /* cs name */
"ucs2_spanish2_ci", /* name */
"", /* comment */
spanish2, /* tailoring */
@@ -34376,7 +34376,7 @@ struct charset_info_st my_charset_ucs2_roman_uca_ci=
{
143,0,0, /* number */
MY_CS_UCS2_UCA_FLAGS,/* state */
- "ucs2", /* cs name */
+ "ucs2", /* cs name */
"ucs2_roman_ci", /* name */
"", /* comment */
roman, /* tailoring */
@@ -34409,7 +34409,7 @@ struct charset_info_st my_charset_ucs2_persian_uca_ci=
{
144,0,0, /* number */
MY_CS_UCS2_UCA_FLAGS,/* state */
- "ucs2", /* cs name */
+ "ucs2", /* cs name */
"ucs2_persian_ci", /* name */
"", /* comment */
persian, /* tailoring */
@@ -34442,7 +34442,7 @@ struct charset_info_st my_charset_ucs2_esperanto_uca_ci=
{
145,0,0, /* number */
MY_CS_UCS2_UCA_FLAGS,/* state */
- "ucs2", /* cs name */
+ "ucs2", /* cs name */
"ucs2_esperanto_ci",/* name */
"", /* comment */
esperanto, /* tailoring */
@@ -34475,7 +34475,7 @@ struct charset_info_st my_charset_ucs2_hungarian_uca_ci=
{
146,0,0, /* number */
MY_CS_UCS2_UCA_FLAGS,/* state */
- "ucs2", /* cs name */
+ "ucs2", /* cs name */
"ucs2_hungarian_ci",/* name */
"", /* comment */
hungarian, /* tailoring */
@@ -34506,8 +34506,8 @@ 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_UCS2_UCA_FLAGS,/* state */
- "ucs2", /* csname */
+ MY_CS_UCS2_UCA_FLAGS,/* state */
+ "ucs2", /* csname */
"ucs2_sinhala_ci", /* name */
"", /* comment */
sinhala, /* tailoring */
@@ -34540,8 +34540,8 @@ 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_UCS2_UCA_FLAGS,/* state */
- "ucs2", /* csname */
+ MY_CS_UCS2_UCA_FLAGS,/* state */
+ "ucs2", /* csname */
"ucs2_german2_ci", /* name */
"", /* comment */
german2, /* tailoring */
@@ -34572,9 +34572,9 @@ 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_UCS2_UCA_FLAGS,/* state */
- "ucs2", /* cs name */
- "ucs2_croatian_mysql561_ci", /* name */
+ MY_CS_UCS2_UCA_FLAGS,/* state */
+ "ucs2", /* cs name */
+ "ucs2_croatian_mysql561_ci",/* name */
"", /* comment */
croatian_mysql561, /* tailoring */
NULL, /* ctype */
@@ -34605,9 +34605,9 @@ 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_UCS2_UCA_FLAGS,/* state */
- "ucs2", /* cs name */
- "ucs2_croatian_ci", /* name */
+ MY_CS_UCS2_UCA_FLAGS,/* state */
+ "ucs2", /* cs name */
+ "ucs2_croatian_ci", /* name */
"", /* comment */
croatian_mariadb, /* tailoring */
NULL, /* ctype */
@@ -34638,9 +34638,9 @@ 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_UCS2_UCA_FLAGS,/* state */
- "ucs2", /* cs name */
- "ucs2_myanmar_ci", /* name */
+ MY_CS_UCS2_UCA_FLAGS,/* state */
+ "ucs2", /* cs name */
+ "ucs2_myanmar_ci", /* name */
"", /* comment */
myanmar, /* tailoring */
NULL, /* ctype */
@@ -34736,7 +34736,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_UCS2_UCA_FLAGS,/* state */
+ MY_CS_UCS2_UCA_FLAGS,/* state */
"ucs2", /* csname */
"ucs2_vietnamese_ci",/* name */
"", /* comment */
@@ -34835,7 +34835,7 @@ struct charset_info_st my_charset_ucs2_unicode_520_nopad_ci=
#endif
-#ifdef HAVE_CHARSET_utf8
+#ifdef HAVE_CHARSET_utf8mb3
static my_bool
my_uca_coll_init_utf8mb3(struct charset_info_st *cs, MY_CHARSET_LOADER *loader);
@@ -34876,7 +34876,7 @@ my_uca_coll_init_utf8mb3(struct charset_info_st *cs, MY_CHARSET_LOADER *loader)
expressions. Note, there is no need to mark byte 255 as a
letter, it is illegal byte in UTF8.
*/
-static uchar ctype_utf8[] = {
+static uchar ctype_utf8mb3[] = {
0,
32, 32, 32, 32, 32, 32, 32, 32, 32, 40, 40, 40, 40, 40, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
@@ -34896,20 +34896,20 @@ static uchar ctype_utf8[] = {
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0
};
-extern MY_CHARSET_HANDLER my_charset_utf8_handler;
+extern MY_CHARSET_HANDLER my_charset_utf8mb3_handler;
#define MY_CS_UTF8MB3_UCA_FLAGS MY_CS_COMMON_UCA_FLAGS
#define MY_CS_UTF8MB3_UCA_NOPAD_FLAGS (MY_CS_UTF8MB3_UCA_FLAGS|MY_CS_NOPAD)
-struct charset_info_st my_charset_utf8_unicode_ci=
+struct charset_info_st my_charset_utf8mb3_unicode_ci=
{
192,0,0, /* number */
MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
- "utf8", /* cs name */
- "utf8_unicode_ci", /* name */
+ MY_UTF8MB3, /* cs name */
+ MY_UTF8MB3 "_unicode_ci", /* name */
"", /* comment */
"", /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -34929,20 +34929,20 @@ struct charset_info_st my_charset_utf8_unicode_ci=
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
- &my_charset_utf8_handler,
+ &my_charset_utf8mb3_handler,
&my_uca_collation_handler_utf8mb3
};
-struct charset_info_st my_charset_utf8_icelandic_uca_ci=
+struct charset_info_st my_charset_utf8mb3_icelandic_uca_ci=
{
193,0,0, /* number */
MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
- "utf8", /* cs name */
- "utf8_icelandic_ci",/* name */
+ MY_UTF8MB3, /* cs name */
+ MY_UTF8MB3 "_icelandic_ci",/* name */
"", /* comment */
icelandic, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -34962,19 +34962,19 @@ struct charset_info_st my_charset_utf8_icelandic_uca_ci=
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
- &my_charset_utf8_handler,
+ &my_charset_utf8mb3_handler,
&my_uca_collation_handler_utf8mb3
};
-struct charset_info_st my_charset_utf8_latvian_uca_ci=
+struct charset_info_st my_charset_utf8mb3_latvian_uca_ci=
{
194,0,0, /* number */
MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
- "utf8", /* cs name */
- "utf8_latvian_ci", /* name */
+ MY_UTF8MB3, /* cs name */
+ MY_UTF8MB3 "_latvian_ci",/* name */
"", /* comment */
latvian, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -34994,19 +34994,19 @@ struct charset_info_st my_charset_utf8_latvian_uca_ci=
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
- &my_charset_utf8_handler,
+ &my_charset_utf8mb3_handler,
&my_uca_collation_handler_utf8mb3
};
-struct charset_info_st my_charset_utf8_romanian_uca_ci=
+struct charset_info_st my_charset_utf8mb3_romanian_uca_ci=
{
195,0,0, /* number */
MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
- "utf8", /* cs name */
- "utf8_romanian_ci", /* name */
+ MY_UTF8MB3, /* cs name */
+ MY_UTF8MB3 "_romanian_ci", /* name */
"", /* comment */
romanian, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -35026,19 +35026,19 @@ struct charset_info_st my_charset_utf8_romanian_uca_ci=
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
- &my_charset_utf8_handler,
+ &my_charset_utf8mb3_handler,
&my_uca_collation_handler_utf8mb3
};
-struct charset_info_st my_charset_utf8_slovenian_uca_ci=
+struct charset_info_st my_charset_utf8mb3_slovenian_uca_ci=
{
196,0,0, /* number */
MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
- "utf8", /* cs name */
- "utf8_slovenian_ci",/* name */
+ MY_UTF8MB3, /* cs name */
+ MY_UTF8MB3 "_slovenian_ci",/* name */
"", /* comment */
slovenian, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -35058,19 +35058,19 @@ struct charset_info_st my_charset_utf8_slovenian_uca_ci=
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
- &my_charset_utf8_handler,
+ &my_charset_utf8mb3_handler,
&my_uca_collation_handler_utf8mb3
};
-struct charset_info_st my_charset_utf8_polish_uca_ci=
+struct charset_info_st my_charset_utf8mb3_polish_uca_ci=
{
197,0,0, /* number */
MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
- "utf8", /* cs name */
- "utf8_polish_ci", /* name */
+ MY_UTF8MB3, /* cs name */
+ MY_UTF8MB3 "_polish_ci",/* name */
"", /* comment */
polish, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -35090,19 +35090,19 @@ struct charset_info_st my_charset_utf8_polish_uca_ci=
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
- &my_charset_utf8_handler,
+ &my_charset_utf8mb3_handler,
&my_uca_collation_handler_utf8mb3
};
-struct charset_info_st my_charset_utf8_estonian_uca_ci=
+struct charset_info_st my_charset_utf8mb3_estonian_uca_ci=
{
198,0,0, /* number */
MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
- "utf8", /* cs name */
- "utf8_estonian_ci", /* name */
+ MY_UTF8MB3, /* cs name */
+ MY_UTF8MB3 "_estonian_ci",/* name */
"", /* comment */
estonian, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -35122,19 +35122,19 @@ struct charset_info_st my_charset_utf8_estonian_uca_ci=
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
- &my_charset_utf8_handler,
+ &my_charset_utf8mb3_handler,
&my_uca_collation_handler_utf8mb3
};
-struct charset_info_st my_charset_utf8_spanish_uca_ci=
+struct charset_info_st my_charset_utf8mb3_spanish_uca_ci=
{
199,0,0, /* number */
MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
- "utf8", /* cs name */
- "utf8_spanish_ci", /* name */
+ MY_UTF8MB3, /* cs name */
+ MY_UTF8MB3 "_spanish_ci", /* name */
"", /* comment */
spanish, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -35154,19 +35154,19 @@ struct charset_info_st my_charset_utf8_spanish_uca_ci=
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
- &my_charset_utf8_handler,
+ &my_charset_utf8mb3_handler,
&my_uca_collation_handler_utf8mb3
};
-struct charset_info_st my_charset_utf8_swedish_uca_ci=
+struct charset_info_st my_charset_utf8mb3_swedish_uca_ci=
{
200,0,0, /* number */
MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
- "utf8", /* cs name */
- "utf8_swedish_ci", /* name */
+ MY_UTF8MB3, /* cs name */
+ MY_UTF8MB3 "_swedish_ci", /* name */
"", /* comment */
swedish, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -35186,19 +35186,19 @@ struct charset_info_st my_charset_utf8_swedish_uca_ci=
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
- &my_charset_utf8_handler,
+ &my_charset_utf8mb3_handler,
&my_uca_collation_handler_utf8mb3
};
-struct charset_info_st my_charset_utf8_turkish_uca_ci=
+struct charset_info_st my_charset_utf8mb3_turkish_uca_ci=
{
201,0,0, /* number */
MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
- "utf8", /* cs name */
- "utf8_turkish_ci", /* name */
+ MY_UTF8MB3, /* cs name */
+ MY_UTF8MB3 "_turkish_ci", /* name */
"", /* comment */
turkish, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -35218,19 +35218,19 @@ struct charset_info_st my_charset_utf8_turkish_uca_ci=
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
- &my_charset_utf8_handler,
+ &my_charset_utf8mb3_handler,
&my_uca_collation_handler_utf8mb3
};
-struct charset_info_st my_charset_utf8_czech_uca_ci=
+struct charset_info_st my_charset_utf8mb3_czech_uca_ci=
{
202,0,0, /* number */
MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
- "utf8", /* cs name */
- "utf8_czech_ci", /* name */
+ MY_UTF8MB3, /* cs name */
+ MY_UTF8MB3 "_czech_ci", /* name */
"", /* comment */
czech, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -35250,20 +35250,20 @@ struct charset_info_st my_charset_utf8_czech_uca_ci=
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
- &my_charset_utf8_handler,
+ &my_charset_utf8mb3_handler,
&my_uca_collation_handler_utf8mb3
};
-struct charset_info_st my_charset_utf8_danish_uca_ci=
+struct charset_info_st my_charset_utf8mb3_danish_uca_ci=
{
203,0,0, /* number */
MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
- "utf8", /* cs name */
- "utf8_danish_ci", /* name */
+ MY_UTF8MB3, /* cs name */
+ MY_UTF8MB3 "_danish_ci", /* name */
"", /* comment */
danish, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -35283,19 +35283,19 @@ struct charset_info_st my_charset_utf8_danish_uca_ci=
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
- &my_charset_utf8_handler,
+ &my_charset_utf8mb3_handler,
&my_uca_collation_handler_utf8mb3
};
-struct charset_info_st my_charset_utf8_lithuanian_uca_ci=
+struct charset_info_st my_charset_utf8mb3_lithuanian_uca_ci=
{
204,0,0, /* number */
MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
- "utf8", /* cs name */
- "utf8_lithuanian_ci",/* name */
+ MY_UTF8MB3, /* cs name */
+ MY_UTF8MB3 "_lithuanian_ci",/* name */
"", /* comment */
lithuanian, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -35315,19 +35315,19 @@ struct charset_info_st my_charset_utf8_lithuanian_uca_ci=
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
- &my_charset_utf8_handler,
+ &my_charset_utf8mb3_handler,
&my_uca_collation_handler_utf8mb3
};
-struct charset_info_st my_charset_utf8_slovak_uca_ci=
+struct charset_info_st my_charset_utf8mb3_slovak_uca_ci=
{
205,0,0, /* number */
MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
- "utf8", /* cs name */
- "utf8_slovak_ci", /* name */
+ MY_UTF8MB3, /* cs name */
+ MY_UTF8MB3 "_slovak_ci",/* name */
"", /* comment */
slovak, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -35347,19 +35347,19 @@ struct charset_info_st my_charset_utf8_slovak_uca_ci=
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
- &my_charset_utf8_handler,
+ &my_charset_utf8mb3_handler,
&my_uca_collation_handler_utf8mb3
};
-struct charset_info_st my_charset_utf8_spanish2_uca_ci=
+struct charset_info_st my_charset_utf8mb3_spanish2_uca_ci=
{
206,0,0, /* number */
MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
- "utf8", /* cs name */
- "utf8_spanish2_ci", /* name */
+ MY_UTF8MB3, /* cs name */
+ MY_UTF8MB3 "_spanish2_ci",/* name */
"", /* comment */
spanish2, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -35379,19 +35379,19 @@ struct charset_info_st my_charset_utf8_spanish2_uca_ci=
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
- &my_charset_utf8_handler,
+ &my_charset_utf8mb3_handler,
&my_uca_collation_handler_utf8mb3
};
-struct charset_info_st my_charset_utf8_roman_uca_ci=
+struct charset_info_st my_charset_utf8mb3_roman_uca_ci=
{
207,0,0, /* number */
MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
- "utf8", /* cs name */
- "utf8_roman_ci", /* name */
+ MY_UTF8MB3, /* cs name */
+ MY_UTF8MB3 "_roman_ci",/* name */
"", /* comment */
roman, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -35411,19 +35411,19 @@ struct charset_info_st my_charset_utf8_roman_uca_ci=
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
- &my_charset_utf8_handler,
+ &my_charset_utf8mb3_handler,
&my_uca_collation_handler_utf8mb3
};
-struct charset_info_st my_charset_utf8_persian_uca_ci=
+struct charset_info_st my_charset_utf8mb3_persian_uca_ci=
{
208,0,0, /* number */
MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
- "utf8", /* cs name */
- "utf8_persian_ci", /* name */
+ MY_UTF8MB3, /* cs name */
+ MY_UTF8MB3 "_persian_ci",/* name */
"", /* comment */
persian, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -35443,19 +35443,19 @@ struct charset_info_st my_charset_utf8_persian_uca_ci=
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
- &my_charset_utf8_handler,
+ &my_charset_utf8mb3_handler,
&my_uca_collation_handler_utf8mb3
};
-struct charset_info_st my_charset_utf8_esperanto_uca_ci=
+struct charset_info_st my_charset_utf8mb3_esperanto_uca_ci=
{
209,0,0, /* number */
MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
- "utf8", /* cs name */
- "utf8_esperanto_ci",/* name */
+ MY_UTF8MB3, /* cs name */
+ MY_UTF8MB3 "_esperanto_ci",/* name */
"", /* comment */
esperanto, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -35475,19 +35475,19 @@ struct charset_info_st my_charset_utf8_esperanto_uca_ci=
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
- &my_charset_utf8_handler,
+ &my_charset_utf8mb3_handler,
&my_uca_collation_handler_utf8mb3
};
-struct charset_info_st my_charset_utf8_hungarian_uca_ci=
+struct charset_info_st my_charset_utf8mb3_hungarian_uca_ci=
{
210,0,0, /* number */
MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
- "utf8", /* cs name */
- "utf8_hungarian_ci",/* name */
+ MY_UTF8MB3, /* cs name */
+ MY_UTF8MB3 "_hungarian_ci",/* name */
"", /* comment */
hungarian, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -35507,19 +35507,19 @@ struct charset_info_st my_charset_utf8_hungarian_uca_ci=
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
- &my_charset_utf8_handler,
+ &my_charset_utf8mb3_handler,
&my_uca_collation_handler_utf8mb3
};
-struct charset_info_st my_charset_utf8_sinhala_uca_ci=
+struct charset_info_st my_charset_utf8mb3_sinhala_uca_ci=
{
211,0,0, /* number */
- MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
- "utf8", /* cs name */
- "utf8_sinhala_ci", /* name */
+ MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
+ MY_UTF8MB3, /* cs name */
+ MY_UTF8MB3 "_sinhala_ci", /* name */
"", /* comment */
sinhala, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -35539,20 +35539,20 @@ struct charset_info_st my_charset_utf8_sinhala_uca_ci=
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
- &my_charset_utf8_handler,
+ &my_charset_utf8mb3_handler,
&my_uca_collation_handler_utf8mb3
};
-struct charset_info_st my_charset_utf8_german2_uca_ci=
+struct charset_info_st my_charset_utf8mb3_german2_uca_ci=
{
212,0,0, /* number */
- MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
+ MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
MY_UTF8MB3, /* cs name */
- MY_UTF8MB3 "_german2_ci",/* name */
+ MY_UTF8MB3 "_german2_ci",/* name */
"", /* comment */
german2, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -35572,19 +35572,19 @@ struct charset_info_st my_charset_utf8_german2_uca_ci=
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
- &my_charset_utf8_handler,
+ &my_charset_utf8mb3_handler,
&my_uca_collation_handler_utf8mb3
};
-struct charset_info_st my_charset_utf8_croatian_mysql561_uca_ci=
+struct charset_info_st my_charset_utf8mb3_croatian_mysql561_uca_ci=
{
213,0,0, /* number */
- MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
+ MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
MY_UTF8MB3, /* cs name */
MY_UTF8MB3 "_croatian_mysql561_ci",/* name */
"", /* comment */
croatian_mysql561, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -35604,20 +35604,20 @@ struct charset_info_st my_charset_utf8_croatian_mysql561_uca_ci=
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
- &my_charset_utf8_handler,
+ &my_charset_utf8mb3_handler,
&my_uca_collation_handler_utf8mb3
};
-struct charset_info_st my_charset_utf8_croatian_uca_ci=
+struct charset_info_st my_charset_utf8mb3_croatian_uca_ci=
{
MY_PAGE2_COLLATION_ID_UTF8,0,0, /* number */
- MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
+ MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
MY_UTF8MB3, /* cs name */
MY_UTF8MB3 "_croatian_ci",/* name */
"", /* comment */
croatian_mariadb, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -35637,20 +35637,20 @@ struct charset_info_st my_charset_utf8_croatian_uca_ci=
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
- &my_charset_utf8_handler,
+ &my_charset_utf8mb3_handler,
&my_uca_collation_handler_utf8mb3
};
-struct charset_info_st my_charset_utf8_myanmar_uca_ci=
+struct charset_info_st my_charset_utf8mb3_myanmar_uca_ci=
{
MY_PAGE2_COLLATION_ID_UTF8+1,0,0, /* number */
- MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
+ MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
MY_UTF8MB3, /* cs name */
- MY_UTF8MB3 "_myanmar_ci",/* name */
+ MY_UTF8MB3 "_myanmar_ci",/* name */
"", /* comment */
myanmar, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -35670,12 +35670,12 @@ struct charset_info_st my_charset_utf8_myanmar_uca_ci=
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
- &my_charset_utf8_handler,
+ &my_charset_utf8mb3_handler,
&my_uca_collation_handler_utf8mb3
};
-struct charset_info_st my_charset_utf8_unicode_520_ci=
+struct charset_info_st my_charset_utf8mb3_unicode_520_ci=
{
214,0,0, /* number */
MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
@@ -35683,7 +35683,7 @@ struct charset_info_st my_charset_utf8_unicode_520_ci=
MY_UTF8MB3 "_unicode_520_ci",/* name */
"", /* comment */
"", /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -35703,11 +35703,11 @@ struct charset_info_st my_charset_utf8_unicode_520_ci=
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
- &my_charset_utf8_handler,
+ &my_charset_utf8mb3_handler,
&my_uca_collation_handler_utf8mb3
};
-struct charset_info_st my_charset_utf8_thai_520_w2=
+struct charset_info_st my_charset_utf8mb3_thai_520_w2=
{
MY_PAGE2_COLLATION_ID_UTF8+2,0,0, /* number */
MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
@@ -35715,7 +35715,7 @@ struct charset_info_st my_charset_utf8_thai_520_w2=
MY_UTF8MB3 "_thai_520_w2",/* name */
"", /* comment */
"[strength 2]", /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -35735,11 +35735,11 @@ struct charset_info_st my_charset_utf8_thai_520_w2=
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
2, /* levels_for_order */
- &my_charset_utf8_handler,
+ &my_charset_utf8mb3_handler,
&my_uca_collation_handler_multilevel_utf8mb3
};
-struct charset_info_st my_charset_utf8_vietnamese_ci=
+struct charset_info_st my_charset_utf8mb3_vietnamese_ci=
{
215,0,0, /* number */
MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
@@ -35747,7 +35747,7 @@ struct charset_info_st my_charset_utf8_vietnamese_ci=
MY_UTF8MB3 "_vietnamese_ci",/* name */
"", /* comment */
vietnamese, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -35767,12 +35767,12 @@ struct charset_info_st my_charset_utf8_vietnamese_ci=
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
- &my_charset_utf8_handler,
+ &my_charset_utf8mb3_handler,
&my_uca_collation_handler_utf8mb3
};
-struct charset_info_st my_charset_utf8_unicode_nopad_ci=
+struct charset_info_st my_charset_utf8mb3_unicode_nopad_ci=
{
MY_NOPAD_ID(192),0,0, /* number */
MY_CS_UTF8MB3_UCA_NOPAD_FLAGS, /* flags */
@@ -35780,7 +35780,7 @@ struct charset_info_st my_charset_utf8_unicode_nopad_ci=
MY_UTF8MB3 "_unicode_nopad_ci",/* name */
"", /* comment */
"", /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -35800,12 +35800,12 @@ struct charset_info_st my_charset_utf8_unicode_nopad_ci=
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
- &my_charset_utf8_handler,
+ &my_charset_utf8mb3_handler,
&my_uca_collation_handler_nopad_utf8mb3
};
-struct charset_info_st my_charset_utf8_unicode_520_nopad_ci=
+struct charset_info_st my_charset_utf8mb3_unicode_520_nopad_ci=
{
MY_NOPAD_ID(214),0,0, /* number */
MY_CS_UTF8MB3_UCA_NOPAD_FLAGS, /* flags */
@@ -35813,7 +35813,7 @@ struct charset_info_st my_charset_utf8_unicode_520_nopad_ci=
MY_UTF8MB3 "_unicode_520_nopad_ci", /* name */
"", /* comment */
"", /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -35833,11 +35833,11 @@ struct charset_info_st my_charset_utf8_unicode_520_nopad_ci=
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
- &my_charset_utf8_handler,
+ &my_charset_utf8mb3_handler,
&my_uca_collation_handler_nopad_utf8mb3
};
-#endif /* HAVE_CHARSET_utf8 */
+#endif /* HAVE_CHARSET_utf8mb3 */
#ifdef HAVE_CHARSET_utf8mb4
@@ -35883,12 +35883,12 @@ extern MY_CHARSET_HANDLER my_charset_utf8mb4_handler;
struct charset_info_st my_charset_utf8mb4_unicode_ci=
{
224,0,0, /* number */
- MY_CS_UTF8MB4_UCA_FLAGS,/* state */
- MY_UTF8MB4, /* csname */
- MY_UTF8MB4 "_unicode_ci",/* name */
+ MY_CS_UTF8MB4_UCA_FLAGS,/* state */
+ MY_UTF8MB4, /* csname */
+ MY_UTF8MB4 "_unicode_ci",/* name */
"", /* comment */
"", /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -35916,12 +35916,12 @@ struct charset_info_st my_charset_utf8mb4_unicode_ci=
struct charset_info_st my_charset_utf8mb4_icelandic_uca_ci=
{
225,0,0, /* number */
- MY_CS_UTF8MB4_UCA_FLAGS,/* state */
- MY_UTF8MB4, /* csname */
- MY_UTF8MB4 "_icelandic_ci",/* name */
+ MY_CS_UTF8MB4_UCA_FLAGS,/* state */
+ MY_UTF8MB4, /* csname */
+ MY_UTF8MB4 "_icelandic_ci",/* name */
"", /* comment */
icelandic, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -35953,7 +35953,7 @@ struct charset_info_st my_charset_utf8mb4_latvian_uca_ci=
MY_UTF8MB4 "_latvian_ci", /* name */
"", /* comment */
latvian, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -35980,12 +35980,12 @@ struct charset_info_st my_charset_utf8mb4_latvian_uca_ci=
struct charset_info_st my_charset_utf8mb4_romanian_uca_ci=
{
227,0,0, /* number */
- MY_CS_UTF8MB4_UCA_FLAGS,/* state */
- MY_UTF8MB4, /* csname */
- MY_UTF8MB4 "_romanian_ci", /* name */
+ MY_CS_UTF8MB4_UCA_FLAGS,/* state */
+ MY_UTF8MB4, /* csname */
+ MY_UTF8MB4 "_romanian_ci", /* name */
"", /* comment */
romanian, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -36012,12 +36012,12 @@ struct charset_info_st my_charset_utf8mb4_romanian_uca_ci=
struct charset_info_st my_charset_utf8mb4_slovenian_uca_ci=
{
228,0,0, /* number */
- MY_CS_UTF8MB4_UCA_FLAGS,/* state */
- MY_UTF8MB4, /* csname */
- MY_UTF8MB4 "_slovenian_ci",/* name */
+ MY_CS_UTF8MB4_UCA_FLAGS,/* state */
+ MY_UTF8MB4, /* csname */
+ MY_UTF8MB4 "_slovenian_ci",/* name */
"", /* comment */
slovenian, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -36044,12 +36044,12 @@ struct charset_info_st my_charset_utf8mb4_slovenian_uca_ci=
struct charset_info_st my_charset_utf8mb4_polish_uca_ci=
{
229,0,0, /* number */
- MY_CS_UTF8MB4_UCA_FLAGS,/* state */
- MY_UTF8MB4, /* csname */
- MY_UTF8MB4 "_polish_ci", /* name */
+ MY_CS_UTF8MB4_UCA_FLAGS,/* state */
+ MY_UTF8MB4, /* csname */
+ MY_UTF8MB4 "_polish_ci", /* name */
"", /* comment */
polish, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -36081,7 +36081,7 @@ struct charset_info_st my_charset_utf8mb4_estonian_uca_ci=
MY_UTF8MB4 "_estonian_ci", /* name */
"", /* comment */
estonian, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -36108,12 +36108,12 @@ struct charset_info_st my_charset_utf8mb4_estonian_uca_ci=
struct charset_info_st my_charset_utf8mb4_spanish_uca_ci=
{
231,0,0, /* number */
- MY_CS_UTF8MB4_UCA_FLAGS,/* state */
- MY_UTF8MB4, /* csname */
- MY_UTF8MB4 "_spanish_ci", /* name */
+ MY_CS_UTF8MB4_UCA_FLAGS,/* state */
+ MY_UTF8MB4, /* csname */
+ MY_UTF8MB4 "_spanish_ci", /* name */
"", /* comment */
spanish, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -36140,12 +36140,12 @@ struct charset_info_st my_charset_utf8mb4_spanish_uca_ci=
struct charset_info_st my_charset_utf8mb4_swedish_uca_ci=
{
232,0,0, /* number */
- MY_CS_UTF8MB4_UCA_FLAGS,/* state */
- MY_UTF8MB4, /* csname */
- MY_UTF8MB4 "_swedish_ci", /* name */
+ MY_CS_UTF8MB4_UCA_FLAGS,/* state */
+ MY_UTF8MB4, /* csname */
+ MY_UTF8MB4 "_swedish_ci", /* name */
"", /* comment */
swedish, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -36172,12 +36172,12 @@ struct charset_info_st my_charset_utf8mb4_swedish_uca_ci=
struct charset_info_st my_charset_utf8mb4_turkish_uca_ci=
{
233,0,0, /* number */
- MY_CS_UTF8MB4_UCA_FLAGS,/* state */
- MY_UTF8MB4, /* csname */
- MY_UTF8MB4 "_turkish_ci", /* name */
+ MY_CS_UTF8MB4_UCA_FLAGS,/* state */
+ MY_UTF8MB4, /* csname */
+ MY_UTF8MB4 "_turkish_ci", /* name */
"", /* comment */
turkish, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -36204,12 +36204,12 @@ struct charset_info_st my_charset_utf8mb4_turkish_uca_ci=
struct charset_info_st my_charset_utf8mb4_czech_uca_ci=
{
234,0,0, /* number */
- MY_CS_UTF8MB4_UCA_FLAGS,/* state */
- MY_UTF8MB4, /* csname */
- MY_UTF8MB4 "_czech_ci", /* name */
+ MY_CS_UTF8MB4_UCA_FLAGS,/* state */
+ MY_UTF8MB4, /* csname */
+ MY_UTF8MB4 "_czech_ci", /* name */
"", /* comment */
czech, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -36237,12 +36237,12 @@ struct charset_info_st my_charset_utf8mb4_czech_uca_ci=
struct charset_info_st my_charset_utf8mb4_danish_uca_ci=
{
235,0,0, /* number */
- MY_CS_UTF8MB4_UCA_FLAGS,/* state */
- MY_UTF8MB4, /* csname */
- MY_UTF8MB4 "_danish_ci", /* name */
+ MY_CS_UTF8MB4_UCA_FLAGS,/* state */
+ MY_UTF8MB4, /* csname */
+ MY_UTF8MB4 "_danish_ci", /* name */
"", /* comment */
danish, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -36269,12 +36269,12 @@ struct charset_info_st my_charset_utf8mb4_danish_uca_ci=
struct charset_info_st my_charset_utf8mb4_lithuanian_uca_ci=
{
236,0,0, /* number */
- MY_CS_UTF8MB4_UCA_FLAGS,/* state */
- MY_UTF8MB4, /* csname */
- MY_UTF8MB4 "_lithuanian_ci",/* name */
+ MY_CS_UTF8MB4_UCA_FLAGS,/* state */
+ MY_UTF8MB4, /* csname */
+ MY_UTF8MB4 "_lithuanian_ci",/* name */
"", /* comment */
lithuanian, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -36301,12 +36301,12 @@ struct charset_info_st my_charset_utf8mb4_lithuanian_uca_ci=
struct charset_info_st my_charset_utf8mb4_slovak_uca_ci=
{
237,0,0, /* number */
- MY_CS_UTF8MB4_UCA_FLAGS,/* state */
- MY_UTF8MB4, /* csname */
- MY_UTF8MB4 "_slovak_ci", /* name */
+ MY_CS_UTF8MB4_UCA_FLAGS,/* state */
+ MY_UTF8MB4, /* csname */
+ MY_UTF8MB4 "_slovak_ci", /* name */
"", /* comment */
slovak, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -36333,12 +36333,12 @@ struct charset_info_st my_charset_utf8mb4_slovak_uca_ci=
struct charset_info_st my_charset_utf8mb4_spanish2_uca_ci=
{
238,0,0, /* number */
- MY_CS_UTF8MB4_UCA_FLAGS,/* state */
- MY_UTF8MB4, /* csname */
- MY_UTF8MB4 "_spanish2_ci", /* name */
+ MY_CS_UTF8MB4_UCA_FLAGS,/* state */
+ MY_UTF8MB4, /* csname */
+ MY_UTF8MB4 "_spanish2_ci", /* name */
"", /* comment */
spanish2, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -36365,12 +36365,12 @@ struct charset_info_st my_charset_utf8mb4_spanish2_uca_ci=
struct charset_info_st my_charset_utf8mb4_roman_uca_ci=
{
239,0,0, /* number */
- MY_CS_UTF8MB4_UCA_FLAGS,/* state */
- MY_UTF8MB4, /* csname */
- MY_UTF8MB4 "_roman_ci", /* name */
+ MY_CS_UTF8MB4_UCA_FLAGS,/* state */
+ MY_UTF8MB4, /* csname */
+ MY_UTF8MB4 "_roman_ci", /* name */
"", /* comment */
roman, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -36397,12 +36397,12 @@ struct charset_info_st my_charset_utf8mb4_roman_uca_ci=
struct charset_info_st my_charset_utf8mb4_persian_uca_ci=
{
240,0,0, /* number */
- MY_CS_UTF8MB4_UCA_FLAGS,/* state */
- MY_UTF8MB4, /* csname */
- MY_UTF8MB4 "_persian_ci", /* name */
+ MY_CS_UTF8MB4_UCA_FLAGS,/* state */
+ MY_UTF8MB4, /* csname */
+ MY_UTF8MB4 "_persian_ci", /* name */
"", /* comment */
persian, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -36429,12 +36429,12 @@ struct charset_info_st my_charset_utf8mb4_persian_uca_ci=
struct charset_info_st my_charset_utf8mb4_esperanto_uca_ci=
{
241,0,0, /* number */
- MY_CS_UTF8MB4_UCA_FLAGS,/* state */
- MY_UTF8MB4, /* csname */
- MY_UTF8MB4 "_esperanto_ci",/* name */
+ MY_CS_UTF8MB4_UCA_FLAGS,/* state */
+ MY_UTF8MB4, /* csname */
+ MY_UTF8MB4 "_esperanto_ci",/* name */
"", /* comment */
esperanto, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -36461,12 +36461,12 @@ struct charset_info_st my_charset_utf8mb4_esperanto_uca_ci=
struct charset_info_st my_charset_utf8mb4_hungarian_uca_ci=
{
242,0,0, /* number */
- MY_CS_UTF8MB4_UCA_FLAGS,/* state */
- MY_UTF8MB4, /* csname */
- MY_UTF8MB4 "_hungarian_ci",/* name */
+ MY_CS_UTF8MB4_UCA_FLAGS,/* state */
+ MY_UTF8MB4, /* csname */
+ MY_UTF8MB4 "_hungarian_ci",/* name */
"", /* comment */
hungarian, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -36494,11 +36494,11 @@ struct charset_info_st my_charset_utf8mb4_sinhala_uca_ci=
{
243,0,0, /* number */
MY_CS_UTF8MB4_UCA_FLAGS,/* state */
- MY_UTF8MB4, /* csname */
- MY_UTF8MB4 "_sinhala_ci",/* name */
+ MY_UTF8MB4, /* csname */
+ MY_UTF8MB4 "_sinhala_ci",/* name */
"", /* comment */
sinhala, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -36526,11 +36526,11 @@ struct charset_info_st my_charset_utf8mb4_german2_uca_ci=
{
244,0,0, /* number */
MY_CS_UTF8MB4_UCA_FLAGS,/* state */
- MY_UTF8MB4, /* csname */
- MY_UTF8MB4 "_german2_ci",/* name */
+ MY_UTF8MB4, /* csname */
+ MY_UTF8MB4 "_german2_ci",/* name */
"", /* comment */
german2, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -36562,7 +36562,7 @@ struct charset_info_st my_charset_utf8mb4_croatian_mysql561_uca_ci=
MY_UTF8MB4 "_croatian_mysql561_ci",/* name */
"", /* comment */
croatian_mysql561, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -36591,11 +36591,11 @@ struct charset_info_st my_charset_utf8mb4_croatian_uca_ci=
{
MY_PAGE2_COLLATION_ID_UTF8MB4,0,0, /* number */
MY_CS_UTF8MB4_UCA_FLAGS,/* state */
- MY_UTF8MB4, /* csname */
+ MY_UTF8MB4, /* csname */
MY_UTF8MB4 "_croatian_ci",/* name */
"", /* comment */
croatian_mariadb, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -36624,11 +36624,11 @@ struct charset_info_st my_charset_utf8mb4_myanmar_uca_ci=
{
MY_PAGE2_COLLATION_ID_UTF8MB4+1,0,0, /* number */
MY_CS_UTF8MB4_UCA_FLAGS,/* state */
- MY_UTF8MB4, /* csname */
- MY_UTF8MB4 "_myanmar_ci",/* name */
+ MY_UTF8MB4, /* csname */
+ MY_UTF8MB4 "_myanmar_ci",/* name */
"", /* comment */
myanmar, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -36660,7 +36660,7 @@ struct charset_info_st my_charset_utf8mb4_thai_520_w2=
MY_UTF8MB4 "_thai_520_w2", /* name */
"", /* comment */
"[strength 2]", /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -36692,7 +36692,7 @@ struct charset_info_st my_charset_utf8mb4_unicode_520_ci=
MY_UTF8MB4 "_unicode_520_ci",/* name */
"", /* comment */
"", /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -36725,7 +36725,7 @@ struct charset_info_st my_charset_utf8mb4_vietnamese_ci=
MY_UTF8MB4 "_vietnamese_ci",/* name */
"", /* comment */
vietnamese, /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -36758,7 +36758,7 @@ struct charset_info_st my_charset_utf8mb4_unicode_nopad_ci=
MY_UTF8MB4 "_unicode_nopad_ci", /* name */
"", /* comment */
"", /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -36791,7 +36791,7 @@ struct charset_info_st my_charset_utf8mb4_unicode_520_nopad_ci=
MY_UTF8MB4 "_unicode_520_nopad_ci", /* name */
"", /* comment */
"", /* tailoring */
- ctype_utf8, /* ctype */
+ ctype_utf8mb3, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
@@ -37482,7 +37482,7 @@ struct charset_info_st my_charset_utf32_german2_uca_ci=
{
180,0,0, /* number */
MY_CS_UTF32_UCA_FLAGS,/* state */
- "utf32", /* csname */
+ "utf32", /* csname */
"utf32_german2_ci", /* name */
"", /* comment */
german2, /* tailoring */
diff --git a/strings/ctype-uca.ic b/strings/ctype-uca.ic
index 70c10199e3e..b7108eb7f9d 100644
--- a/strings/ctype-uca.ic
+++ b/strings/ctype-uca.ic
@@ -432,7 +432,7 @@ MY_FUNCTION_NAME(strnncollsp_nopad_multilevel)(CHARSET_INFO *cs,
This functions is used for one-level and for multi-level collations.
We intentionally use only primary level in multi-level collations.
This helps to have PARTITION BY KEY put primarily equal records
- into the same partition. E.g. in utf8_thai_520_ci records that differ
+ into the same partition. E.g. in utf8mb3_thai_520_ci records that differ
only in tone marks go into the same partition.
RETURN
diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c
index 01c549a7eaa..bef6d198e22 100644
--- a/strings/ctype-utf8.c
+++ b/strings/ctype-utf8.c
@@ -49,11 +49,11 @@
-#ifndef HAVE_CHARSET_utf8
-#define HAVE_CHARSET_utf8
+#ifndef HAVE_CHARSET_utf8mb3
+#define HAVE_CHARSET_utf8mb3
#endif
-#ifdef HAVE_CHARSET_utf8
+#ifdef HAVE_CHARSET_utf8mb3
#define HAVE_UNIDATA
#endif
@@ -70,7 +70,7 @@
#endif
-#if defined(HAVE_CHARSET_utf8) || defined(HAVE_CHARSET_utf8mb4)
+#if defined(HAVE_CHARSET_utf8mb3) || defined(HAVE_CHARSET_utf8mb4)
static inline
int my_valid_mbcharlen_utf8mb3(const uchar *s, const uchar *e)
@@ -106,7 +106,7 @@ int my_valid_mbcharlen_utf8mb3(const uchar *s, const uchar *e)
return 3;
}
-#endif /*HAVE_CHARSET_utf8 || HAVE_CHARSET_utf8mb4*/
+#endif /*HAVE_CHARSET_utf8mb3 || HAVE_CHARSET_utf8mb4*/
#ifdef HAVE_UNIDATA
@@ -1737,7 +1737,7 @@ MY_UNICASE_INFO my_unicase_default=
/*
- Reproduce old utf8_general_ci behaviour before we fixed Bug#27877.
+ Reproduce old utf8mb3_general_ci behaviour before we fixed Bug#27877.
*/
MY_UNICASE_CHARACTER *my_unicase_pages_mysql500[256]={
plane00_mysql500,
@@ -4750,7 +4750,7 @@ my_strnxfrmlen_unicode_full_bin(CHARSET_INFO *cs, size_t len)
#endif /* HAVE_UNIDATA */
-#ifdef HAVE_CHARSET_utf8
+#ifdef HAVE_CHARSET_utf8mb3
/*
We consider bytes with code more than 127 as a letter.
@@ -4758,7 +4758,7 @@ my_strnxfrmlen_unicode_full_bin(CHARSET_INFO *cs, size_t len)
expressions. Note, there is no need to mark byte 255 as a
letter, it is illegal byte in UTF8.
*/
-static const uchar ctype_utf8[] = {
+static const uchar ctype_utf8mb3[] = {
0,
32, 32, 32, 32, 32, 32, 32, 32, 32, 40, 40, 40, 40, 40, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
@@ -4780,7 +4780,7 @@ static const uchar ctype_utf8[] = {
/* The below are taken from usa7 implementation */
-static const uchar to_lower_utf8[] = {
+static const uchar to_lower_utf8mb3[] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
@@ -4799,7 +4799,7 @@ static const uchar to_lower_utf8[] = {
240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255
};
-static const uchar to_upper_utf8[] = {
+static const uchar to_upper_utf8mb3[] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
@@ -4818,8 +4818,8 @@ static const uchar to_upper_utf8[] = {
240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255
};
-static int my_utf8_uni(CHARSET_INFO *cs __attribute__((unused)),
- my_wc_t * pwc, const uchar *s, const uchar *e)
+static int my_utf8mb3_uni(CHARSET_INFO *cs __attribute__((unused)),
+ my_wc_t * pwc, const uchar *s, const uchar *e)
{
return my_mb_wc_utf8mb3_quick(pwc, s, e);
}
@@ -4829,8 +4829,8 @@ static int my_utf8_uni(CHARSET_INFO *cs __attribute__((unused)),
The same as above, but without range check
for example, for a null-terminated string
*/
-static int my_utf8_uni_no_range(CHARSET_INFO *cs __attribute__((unused)),
- my_wc_t * pwc, const uchar *s)
+static int my_utf8mb3_uni_no_range(CHARSET_INFO *cs __attribute__((unused)),
+ my_wc_t * pwc, const uchar *s)
{
uchar c;
@@ -4865,8 +4865,8 @@ static int my_utf8_uni_no_range(CHARSET_INFO *cs __attribute__((unused)),
}
-static int my_uni_utf8 (CHARSET_INFO *cs __attribute__((unused)),
- my_wc_t wc, uchar *r, uchar *e)
+static int my_uni_utf8mb3(CHARSET_INFO *cs __attribute__((unused)),
+ my_wc_t wc, uchar *r, uchar *e)
{
if (wc < 0x80)
{
@@ -4901,8 +4901,8 @@ static int my_uni_utf8 (CHARSET_INFO *cs __attribute__((unused)),
/*
The same as above, but without range check.
*/
-static int my_uni_utf8_no_range(CHARSET_INFO *cs __attribute__((unused)),
- my_wc_t wc, uchar *r)
+static int my_uni_utf8mb3_no_range(CHARSET_INFO *cs __attribute__((unused)),
+ my_wc_t wc, uchar *r)
{
int count;
@@ -4945,8 +4945,9 @@ my_toupper_utf8mb3(MY_UNICASE_INFO *uni_plane, my_wc_t *wc)
}
-static size_t my_caseup_utf8(CHARSET_INFO *cs, const char *src, size_t srclen,
- char *dst, size_t dstlen)
+static size_t my_caseup_utf8mb3(CHARSET_INFO *cs,
+ const char *src, size_t srclen,
+ char *dst, size_t dstlen)
{
my_wc_t wc;
int srcres, dstres;
@@ -4956,10 +4957,10 @@ static size_t my_caseup_utf8(CHARSET_INFO *cs, const char *src, size_t srclen,
DBUG_ASSERT(src != dst || cs->caseup_multiply == 1);
while ((src < srcend) &&
- (srcres= my_utf8_uni(cs, &wc, (uchar *) src, (uchar*) srcend)) > 0)
+ (srcres= my_utf8mb3_uni(cs, &wc, (uchar *) src, (uchar*) srcend)) > 0)
{
my_toupper_utf8mb3(uni_plane, &wc);
- if ((dstres= my_uni_utf8(cs, wc, (uchar*) dst, (uchar*) dstend)) <= 0)
+ if ((dstres= my_uni_utf8mb3(cs, wc, (uchar*) dst, (uchar*) dstend)) <= 0)
break;
src+= srcres;
dst+= dstres;
@@ -4968,8 +4969,8 @@ static size_t my_caseup_utf8(CHARSET_INFO *cs, const char *src, size_t srclen,
}
-static void my_hash_sort_utf8_nopad(CHARSET_INFO *cs, const uchar *s, size_t slen,
- ulong *nr1, ulong *nr2)
+static void my_hash_sort_utf8mb3_nopad(CHARSET_INFO *cs, const uchar *s, size_t slen,
+ ulong *nr1, ulong *nr2)
{
my_wc_t wc;
int res;
@@ -4977,7 +4978,7 @@ static void my_hash_sort_utf8_nopad(CHARSET_INFO *cs, const uchar *s, size_t sle
MY_UNICASE_INFO *uni_plane= cs->caseinfo;
register ulong m1= *nr1, m2= *nr2;
- while ((s < e) && (res=my_utf8_uni(cs,&wc, (uchar *)s, (uchar*)e))>0 )
+ while ((s < e) && (res=my_utf8mb3_uni(cs,&wc, (uchar *)s, (uchar*)e))>0 )
{
my_tosort_unicode(uni_plane, &wc, cs->state);
MY_HASH_ADD_16(m1, m2, wc);
@@ -4988,8 +4989,8 @@ static void my_hash_sort_utf8_nopad(CHARSET_INFO *cs, const uchar *s, size_t sle
}
-static void my_hash_sort_utf8(CHARSET_INFO *cs, const uchar *s, size_t slen,
- ulong *nr1, ulong *nr2)
+static void my_hash_sort_utf8mb3(CHARSET_INFO *cs, const uchar *s, size_t slen,
+ ulong *nr1, ulong *nr2)
{
const uchar *e= s+slen;
/*
@@ -4998,11 +4999,11 @@ static void my_hash_sort_utf8(CHARSET_INFO *cs, const uchar *s, size_t slen,
*/
while (e > s && e[-1] == ' ')
e--;
- my_hash_sort_utf8_nopad(cs, s, e - s, nr1, nr2);
+ my_hash_sort_utf8mb3_nopad(cs, s, e - s, nr1, nr2);
}
-static size_t my_caseup_str_utf8(CHARSET_INFO *cs, char *src)
+static size_t my_caseup_str_utf8mb3(CHARSET_INFO *cs, char *src)
{
my_wc_t wc;
int srcres, dstres;
@@ -5011,10 +5012,10 @@ static size_t my_caseup_str_utf8(CHARSET_INFO *cs, char *src)
DBUG_ASSERT(cs->caseup_multiply == 1);
while (*src &&
- (srcres= my_utf8_uni_no_range(cs, &wc, (uchar *) src)) > 0)
+ (srcres= my_utf8mb3_uni_no_range(cs, &wc, (uchar *) src)) > 0)
{
my_toupper_utf8mb3(uni_plane, &wc);
- if ((dstres= my_uni_utf8_no_range(cs, wc, (uchar*) dst)) <= 0)
+ if ((dstres= my_uni_utf8mb3_no_range(cs, wc, (uchar*) dst)) <= 0)
break;
src+= srcres;
dst+= dstres;
@@ -5024,8 +5025,9 @@ static size_t my_caseup_str_utf8(CHARSET_INFO *cs, char *src)
}
-static size_t my_casedn_utf8(CHARSET_INFO *cs, const char *src, size_t srclen,
- char *dst, size_t dstlen)
+static size_t my_casedn_utf8mb3(CHARSET_INFO *cs,
+ const char *src, size_t srclen,
+ char *dst, size_t dstlen)
{
my_wc_t wc;
int srcres, dstres;
@@ -5035,10 +5037,10 @@ static size_t my_casedn_utf8(CHARSET_INFO *cs, const char *src, size_t srclen,
DBUG_ASSERT(src != dst || cs->casedn_multiply == 1);
while ((src < srcend) &&
- (srcres= my_utf8_uni(cs, &wc, (uchar*) src, (uchar*)srcend)) > 0)
+ (srcres= my_utf8mb3_uni(cs, &wc, (uchar*) src, (uchar*)srcend)) > 0)
{
my_tolower_utf8mb3(uni_plane, &wc);
- if ((dstres= my_uni_utf8(cs, wc, (uchar*) dst, (uchar*) dstend)) <= 0)
+ if ((dstres= my_uni_utf8mb3(cs, wc, (uchar*) dst, (uchar*) dstend)) <= 0)
break;
src+= srcres;
dst+= dstres;
@@ -5047,7 +5049,7 @@ static size_t my_casedn_utf8(CHARSET_INFO *cs, const char *src, size_t srclen,
}
-static size_t my_casedn_str_utf8(CHARSET_INFO *cs, char *src)
+static size_t my_casedn_str_utf8mb3(CHARSET_INFO *cs, char *src)
{
my_wc_t wc;
int srcres, dstres;
@@ -5056,10 +5058,10 @@ static size_t my_casedn_str_utf8(CHARSET_INFO *cs, char *src)
DBUG_ASSERT(cs->casedn_multiply == 1);
while (*src &&
- (srcres= my_utf8_uni_no_range(cs, &wc, (uchar *) src)) > 0)
+ (srcres= my_utf8mb3_uni_no_range(cs, &wc, (uchar *) src)) > 0)
{
my_tolower_utf8mb3(uni_plane, &wc);
- if ((dstres= my_uni_utf8_no_range(cs, wc, (uchar*) dst)) <= 0)
+ if ((dstres= my_uni_utf8mb3_no_range(cs, wc, (uchar*) dst)) <= 0)
break;
src+= srcres;
dst+= dstres;
@@ -5070,12 +5072,12 @@ static size_t my_casedn_str_utf8(CHARSET_INFO *cs, char *src)
the original string, for example:
"U+0130 LATIN CAPITAL LETTER I WITH DOT ABOVE"
- (which is 0xC4B0 in utf8, i.e. two bytes)
+ (which is 0xC4B0 in utf8mb3, i.e. two bytes)
is converted into
"U+0069 LATIN SMALL LETTER I"
- (which is 0x69 in utf8, i.e. one byte)
+ (which is 0x69 in utf8mb3, i.e. one byte)
So, we need to put '\0' terminator after converting.
*/
@@ -5089,7 +5091,7 @@ static size_t my_casedn_str_utf8(CHARSET_INFO *cs, char *src)
Compare 0-terminated UTF8 strings.
SYNOPSIS
- my_strcasecmp_utf8()
+ my_strcasecmp_utf8mb3()
cs character set handler
s First 0-terminated string to compare
t Second 0-terminated string to compare
@@ -5103,7 +5105,7 @@ static size_t my_casedn_str_utf8(CHARSET_INFO *cs, char *src)
*/
static
-int my_strcasecmp_utf8(CHARSET_INFO *cs, const char *s, const char *t)
+int my_strcasecmp_utf8mb3(CHARSET_INFO *cs, const char *s, const char *t)
{
MY_UNICASE_INFO *uni_plane= cs->caseinfo;
while (s[0] && t[0])
@@ -5127,19 +5129,19 @@ int my_strcasecmp_utf8(CHARSET_INFO *cs, const char *s, const char *t)
/*
Scan a multibyte character.
- In the future it is worth to write a special version of my_utf8_uni()
+ In the future it is worth to write a special version of my_utf8mb3_uni()
for 0-terminated strings which will not take in account length. Now
- we call the regular version of my_utf8_uni() with s+3 in the
+ we call the regular version of my_utf8mb3_uni() with s+3 in the
last argument. s+3 is enough to scan any multibyte sequence.
- Calling the regular version of my_utf8_uni is safe for 0-terminated
+ Calling the regular version of my_utf8mb3_uni is safe for 0-terminated
strings: we will never lose the end of the string:
If we have 0 character in the middle of a multibyte sequence,
- then my_utf8_uni will always return a negative number, so the
+ then my_utf8mb3_uni will always return a negative number, so the
loop with finish.
*/
- res= my_utf8_uni(cs,&s_wc, (const uchar*)s, (const uchar*) s + 3);
+ res= my_utf8mb3_uni(cs,&s_wc, (const uchar*)s, (const uchar*) s + 3);
/*
In the case of wrong multibyte sequence we will
@@ -5164,7 +5166,7 @@ int my_strcasecmp_utf8(CHARSET_INFO *cs, const char *s, const char *t)
}
else
{
- int res=my_utf8_uni(cs,&t_wc, (const uchar*)t, (const uchar*) t + 3);
+ int res=my_utf8mb3_uni(cs,&t_wc, (const uchar*)t, (const uchar*) t + 3);
if (res <= 0)
return strcmp(s, t);
t+= res;
@@ -5182,10 +5184,10 @@ int my_strcasecmp_utf8(CHARSET_INFO *cs, const char *s, const char *t)
static
-int my_wildcmp_utf8(CHARSET_INFO *cs,
- const char *str,const char *str_end,
- const char *wildstr,const char *wildend,
- int escape, int w_one, int w_many)
+int my_wildcmp_utf8mb3(CHARSET_INFO *cs,
+ const char *str,const char *str_end,
+ const char *wildstr,const char *wildend,
+ int escape, int w_one, int w_many)
{
MY_UNICASE_INFO *uni_plane= cs->caseinfo;
return my_wildcmp_unicode(cs,str,str_end,wildstr,wildend,
@@ -5194,8 +5196,8 @@ int my_wildcmp_utf8(CHARSET_INFO *cs,
static
-int my_charlen_utf8(CHARSET_INFO *cs __attribute__((unused)),
- const uchar *s, const uchar *e)
+int my_charlen_utf8mb3(CHARSET_INFO *cs __attribute__((unused)),
+ const uchar *s, const uchar *e)
{
uchar c;
@@ -5210,23 +5212,23 @@ int my_charlen_utf8(CHARSET_INFO *cs __attribute__((unused)),
}
-#define MY_FUNCTION_NAME(x) my_ ## x ## _utf8
-#define CHARLEN(cs,str,end) my_charlen_utf8(cs,str,end)
+#define MY_FUNCTION_NAME(x) my_ ## x ## _utf8mb3
+#define CHARLEN(cs,str,end) my_charlen_utf8mb3(cs,str,end)
#define DEFINE_WELL_FORMED_CHAR_LENGTH_USING_CHARLEN
#include "ctype-mb.ic"
#undef MY_FUNCTION_NAME
#undef CHARLEN
#undef DEFINE_WELL_FORMED_CHAR_LENGTH_USING_CHARLEN
-/* my_well_formed_char_length_utf8 */
+/* my_well_formed_char_length_utf8mb3 */
-static inline int my_weight_mb1_utf8_general_ci(uchar b)
+static inline int my_weight_mb1_utf8mb3_general_ci(uchar b)
{
return (int) my_unicase_default_page00[b & 0xFF].sort;
}
-static inline int my_weight_mb2_utf8_general_ci(uchar b0, uchar b1)
+static inline int my_weight_mb2_utf8mb3_general_ci(uchar b0, uchar b1)
{
my_wc_t wc= UTF8MB2_CODE(b0, b1);
MY_UNICASE_CHARACTER *page= my_unicase_default_pages[wc >> 8];
@@ -5234,7 +5236,7 @@ static inline int my_weight_mb2_utf8_general_ci(uchar b0, uchar b1)
}
-static inline int my_weight_mb3_utf8_general_ci(uchar b0, uchar b1, uchar b2)
+static inline int my_weight_mb3_utf8mb3_general_ci(uchar b0, uchar b1, uchar b2)
{
my_wc_t wc= UTF8MB3_CODE(b0, b1, b2);
MY_UNICASE_CHARACTER *page= my_unicase_default_pages[wc >> 8];
@@ -5242,7 +5244,7 @@ static inline int my_weight_mb3_utf8_general_ci(uchar b0, uchar b1, uchar b2)
}
-#define MY_FUNCTION_NAME(x) my_ ## x ## _utf8_general_ci
+#define MY_FUNCTION_NAME(x) my_ ## x ## _utf8mb3_general_ci
#define DEFINE_STRNXFRM_UNICODE
#define DEFINE_STRNXFRM_UNICODE_NOPAD
#define MY_MB_WC(cs, pwc, s, e) my_mb_wc_utf8mb3_quick(pwc, s, e)
@@ -5251,28 +5253,28 @@ static inline int my_weight_mb3_utf8_general_ci(uchar b0, uchar b1, uchar b2)
#define UNICASE_PAGE0 my_unicase_default_page00
#define UNICASE_PAGES my_unicase_default_pages
#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)
+#define WEIGHT_MB1(x) my_weight_mb1_utf8mb3_general_ci(x)
+#define WEIGHT_MB2(x,y) my_weight_mb2_utf8mb3_general_ci(x,y)
+#define WEIGHT_MB3(x,y,z) my_weight_mb3_utf8mb3_general_ci(x,y,z)
#include "strcoll.ic"
#define DEFINE_STRNNCOLLSP_NOPAD
-#define MY_FUNCTION_NAME(x) my_ ## x ## _utf8_general_nopad_ci
+#define MY_FUNCTION_NAME(x) my_ ## x ## _utf8mb3_general_nopad_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)
+#define WEIGHT_MB1(x) my_weight_mb1_utf8mb3_general_ci(x)
+#define WEIGHT_MB2(x,y) my_weight_mb2_utf8mb3_general_ci(x,y)
+#define WEIGHT_MB3(x,y,z) my_weight_mb3_utf8mb3_general_ci(x,y,z)
#include "strcoll.ic"
-static inline int my_weight_mb1_utf8_general_mysql500_ci(uchar b)
+static inline int my_weight_mb1_utf8mb3_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)
+static inline int my_weight_mb2_utf8mb3_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];
@@ -5281,7 +5283,7 @@ static inline int my_weight_mb2_utf8_general_mysql500_ci(uchar b0, uchar b1)
static inline int
-my_weight_mb3_utf8_general_mysql500_ci(uchar b0, uchar b1, uchar b2)
+my_weight_mb3_utf8mb3_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];
@@ -5289,7 +5291,7 @@ my_weight_mb3_utf8_general_mysql500_ci(uchar b0, uchar b1, uchar b2)
}
-#define MY_FUNCTION_NAME(x) my_ ## x ## _utf8_general_mysql500_ci
+#define MY_FUNCTION_NAME(x) my_ ## x ## _utf8mb3_general_mysql500_ci
#define DEFINE_STRNXFRM_UNICODE
#define MY_MB_WC(cs, pwc, s, e) my_mb_wc_utf8mb3_quick(pwc, s, e)
#define OPTIMIZE_ASCII 1
@@ -5297,13 +5299,13 @@ my_weight_mb3_utf8_general_mysql500_ci(uchar b0, uchar b1, uchar b2)
#define UNICASE_PAGE0 plane00_mysql500
#define UNICASE_PAGES my_unicase_pages_mysql500
#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)
+#define WEIGHT_MB1(x) my_weight_mb1_utf8mb3_general_mysql500_ci(x)
+#define WEIGHT_MB2(x,y) my_weight_mb2_utf8mb3_general_mysql500_ci(x,y)
+#define WEIGHT_MB3(x,y,z) my_weight_mb3_utf8mb3_general_mysql500_ci(x,y,z)
#include "strcoll.ic"
-#define MY_FUNCTION_NAME(x) my_ ## x ## _utf8_bin
+#define MY_FUNCTION_NAME(x) my_ ## x ## _utf8mb3_bin
#define DEFINE_STRNXFRM_UNICODE_BIN2
#define MY_MB_WC(cs, pwc, s, e) my_mb_wc_utf8mb3_quick(pwc, s, e)
#define OPTIMIZE_ASCII 1
@@ -5315,7 +5317,7 @@ my_weight_mb3_utf8_general_mysql500_ci(uchar b0, uchar b1, uchar b2)
#define DEFINE_STRNNCOLLSP_NOPAD
-#define MY_FUNCTION_NAME(x) my_ ## x ## _utf8_nopad_bin
+#define MY_FUNCTION_NAME(x) my_ ## x ## _utf8mb3_nopad_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))
@@ -5326,7 +5328,7 @@ my_weight_mb3_utf8_general_mysql500_ci(uchar b0, uchar b1, uchar b2)
TODO-10.2: join this with pad_max_char() in ctype-mb.c
*/
static void
-my_fill_utf8_mb(CHARSET_INFO *cs, char *str, size_t length, int fill)
+my_fill_utf8mb3_mb(CHARSET_INFO *cs, char *str, size_t length, int fill)
{
char *end= str + length;
char buf[10];
@@ -5345,53 +5347,53 @@ my_fill_utf8_mb(CHARSET_INFO *cs, char *str, size_t length, int fill)
static void
-my_fill_utf8(CHARSET_INFO *cs, char *str, size_t length, int fill)
+my_fill_utf8mb3(CHARSET_INFO *cs, char *str, size_t length, int fill)
{
if (fill < 0x80)
my_fill_8bit(cs, str, length, fill);
else
- my_fill_utf8_mb(cs, str, length, fill);
+ my_fill_utf8mb3_mb(cs, str, length, fill);
}
-static MY_COLLATION_HANDLER my_collation_utf8_general_ci_handler =
+static MY_COLLATION_HANDLER my_collation_utf8mb3_general_ci_handler =
{
NULL, /* init */
- my_strnncoll_utf8_general_ci,
- my_strnncollsp_utf8_general_ci,
- my_strnxfrm_utf8_general_ci,
+ my_strnncoll_utf8mb3_general_ci,
+ my_strnncollsp_utf8mb3_general_ci,
+ my_strnxfrm_utf8mb3_general_ci,
my_strnxfrmlen_unicode,
my_like_range_mb,
- my_wildcmp_utf8,
- my_strcasecmp_utf8,
+ my_wildcmp_utf8mb3,
+ my_strcasecmp_utf8mb3,
my_instr_mb,
- my_hash_sort_utf8,
+ my_hash_sort_utf8mb3,
my_propagate_complex
};
-static MY_COLLATION_HANDLER my_collation_utf8_general_mysql500_ci_handler =
+static MY_COLLATION_HANDLER my_collation_utf8mb3_general_mysql500_ci_handler =
{
NULL, /* init */
- my_strnncoll_utf8_general_mysql500_ci,
- my_strnncollsp_utf8_general_mysql500_ci,
- my_strnxfrm_utf8_general_mysql500_ci,
+ my_strnncoll_utf8mb3_general_mysql500_ci,
+ my_strnncollsp_utf8mb3_general_mysql500_ci,
+ my_strnxfrm_utf8mb3_general_mysql500_ci,
my_strnxfrmlen_unicode,
my_like_range_mb,
- my_wildcmp_utf8,
- my_strcasecmp_utf8,
+ my_wildcmp_utf8mb3,
+ my_strcasecmp_utf8mb3,
my_instr_mb,
- my_hash_sort_utf8,
+ my_hash_sort_utf8mb3,
my_propagate_complex
};
-static MY_COLLATION_HANDLER my_collation_utf8_bin_handler =
+static MY_COLLATION_HANDLER my_collation_utf8mb3_bin_handler =
{
NULL, /* init */
- my_strnncoll_utf8_bin,
- my_strnncollsp_utf8_bin,
- my_strnxfrm_utf8_bin,
+ my_strnncoll_utf8mb3_bin,
+ my_strnncollsp_utf8mb3_bin,
+ my_strnxfrm_utf8mb3_bin,
my_strnxfrmlen_unicode,
my_like_range_mb,
my_wildcmp_mb_bin,
@@ -5402,28 +5404,28 @@ static MY_COLLATION_HANDLER my_collation_utf8_bin_handler =
};
-static MY_COLLATION_HANDLER my_collation_utf8_general_nopad_ci_handler =
+static MY_COLLATION_HANDLER my_collation_utf8mb3_general_nopad_ci_handler =
{
NULL, /* init */
- my_strnncoll_utf8_general_ci,
- my_strnncollsp_utf8_general_nopad_ci,
- my_strnxfrm_nopad_utf8_general_ci,
+ my_strnncoll_utf8mb3_general_ci,
+ my_strnncollsp_utf8mb3_general_nopad_ci,
+ my_strnxfrm_nopad_utf8mb3_general_ci,
my_strnxfrmlen_unicode,
my_like_range_mb,
- my_wildcmp_utf8,
- my_strcasecmp_utf8,
+ my_wildcmp_utf8mb3,
+ my_strcasecmp_utf8mb3,
my_instr_mb,
- my_hash_sort_utf8_nopad,
+ my_hash_sort_utf8mb3_nopad,
my_propagate_complex
};
-static MY_COLLATION_HANDLER my_collation_utf8_nopad_bin_handler =
+static MY_COLLATION_HANDLER my_collation_utf8mb3_nopad_bin_handler =
{
NULL, /* init */
- my_strnncoll_utf8_bin,
- my_strnncollsp_utf8_nopad_bin,
- my_strnxfrm_nopad_utf8_bin,
+ my_strnncoll_utf8mb3_bin,
+ my_strnncollsp_utf8mb3_nopad_bin,
+ my_strnxfrm_nopad_utf8mb3_bin,
my_strnxfrmlen_unicode,
my_like_range_mb,
my_wildcmp_mb_bin,
@@ -5434,24 +5436,24 @@ static MY_COLLATION_HANDLER my_collation_utf8_nopad_bin_handler =
};
-MY_CHARSET_HANDLER my_charset_utf8_handler=
+MY_CHARSET_HANDLER my_charset_utf8mb3_handler=
{
NULL, /* init */
my_numchars_mb,
my_charpos_mb,
my_lengthsp_8bit,
my_numcells_mb,
- my_utf8_uni,
- my_uni_utf8,
+ my_utf8mb3_uni,
+ my_uni_utf8mb3,
my_mb_ctype_mb,
- my_caseup_str_utf8,
- my_casedn_str_utf8,
- my_caseup_utf8,
- my_casedn_utf8,
+ my_caseup_str_utf8mb3,
+ my_casedn_str_utf8mb3,
+ my_caseup_utf8mb3,
+ my_casedn_utf8mb3,
my_snprintf_8bit,
my_long10_to_str_8bit,
my_longlong10_to_str_8bit,
- my_fill_utf8,
+ my_fill_utf8mb3,
my_strntol_8bit,
my_strntoul_8bit,
my_strntoll_8bit,
@@ -5460,26 +5462,26 @@ MY_CHARSET_HANDLER my_charset_utf8_handler=
my_strtoll10_8bit,
my_strntoull10rnd_8bit,
my_scan_8bit,
- my_charlen_utf8,
- my_well_formed_char_length_utf8,
+ my_charlen_utf8mb3,
+ my_well_formed_char_length_utf8mb3,
my_copy_fix_mb,
- my_uni_utf8,
+ my_uni_utf8mb3,
};
-struct charset_info_st my_charset_utf8_general_ci=
+struct charset_info_st my_charset_utf8mb3_general_ci=
{
33,0,0, /* number */
MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM|MY_CS_UNICODE, /* state */
- "utf8", /* cs name */
- "utf8_general_ci", /* name */
+ MY_UTF8MB3, /* cs name */
+ MY_UTF8MB3 "_general_ci", /* name */
"", /* comment */
NULL, /* tailoring */
- ctype_utf8, /* ctype */
- to_lower_utf8, /* to_lower */
- to_upper_utf8, /* to_upper */
- to_upper_utf8, /* sort_order */
+ ctype_utf8mb3, /* ctype */
+ to_lower_utf8mb3, /* to_lower */
+ to_upper_utf8mb3, /* to_upper */
+ to_upper_utf8mb3, /* sort_order */
NULL, /* uca */
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
@@ -5496,23 +5498,23 @@ struct charset_info_st my_charset_utf8_general_ci=
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
- &my_charset_utf8_handler,
- &my_collation_utf8_general_ci_handler
+ &my_charset_utf8mb3_handler,
+ &my_collation_utf8mb3_general_ci_handler
};
-struct charset_info_st my_charset_utf8_general_mysql500_ci=
+struct charset_info_st my_charset_utf8mb3_general_mysql500_ci=
{
223,0,0, /* number */
MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, /* state */
- "utf8", /* cs name */
- "utf8_general_mysql500_ci", /* name */
+ MY_UTF8MB3, /* cs name */
+ MY_UTF8MB3 "_general_mysql500_ci", /* name */
"", /* comment */
NULL, /* tailoring */
- ctype_utf8, /* ctype */
- to_lower_utf8, /* to_lower */
- to_upper_utf8, /* to_upper */
- to_upper_utf8, /* sort_order */
+ ctype_utf8mb3, /* ctype */
+ to_lower_utf8mb3, /* to_lower */
+ to_upper_utf8mb3, /* to_upper */
+ to_upper_utf8mb3, /* sort_order */
NULL, /* uca */
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
@@ -5529,22 +5531,22 @@ struct charset_info_st my_charset_utf8_general_mysql500_ci=
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
- &my_charset_utf8_handler,
- &my_collation_utf8_general_mysql500_ci_handler
+ &my_charset_utf8mb3_handler,
+ &my_collation_utf8mb3_general_mysql500_ci_handler
};
-struct charset_info_st my_charset_utf8_bin=
+struct charset_info_st my_charset_utf8mb3_bin=
{
83,0,0, /* number */
MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_BINSORT|MY_CS_UNICODE, /* state */
- "utf8", /* cs name */
- "utf8_bin", /* name */
+ MY_UTF8MB3, /* cs name */
+ MY_UTF8MB3 "_bin", /* name */
"", /* comment */
NULL, /* tailoring */
- ctype_utf8, /* ctype */
- to_lower_utf8, /* to_lower */
- to_upper_utf8, /* to_upper */
+ ctype_utf8mb3, /* ctype */
+ to_lower_utf8mb3, /* to_lower */
+ to_upper_utf8mb3, /* to_upper */
NULL, /* sort_order */
NULL, /* uca */
NULL, /* tab_to_uni */
@@ -5562,23 +5564,23 @@ struct charset_info_st my_charset_utf8_bin=
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
- &my_charset_utf8_handler,
- &my_collation_utf8_bin_handler
+ &my_charset_utf8mb3_handler,
+ &my_collation_utf8mb3_bin_handler
};
-struct charset_info_st my_charset_utf8_general_nopad_ci=
+struct charset_info_st my_charset_utf8mb3_general_nopad_ci=
{
MY_NOPAD_ID(33),0,0, /* number */
MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NOPAD, /* state */
- "utf8", /* cs name */
- "utf8_general_nopad_ci", /* name */
+ MY_UTF8MB3, /* cs name */
+ MY_UTF8MB3 "_general_nopad_ci", /* name */
"", /* comment */
NULL, /* tailoring */
- ctype_utf8, /* ctype */
- to_lower_utf8, /* to_lower */
- to_upper_utf8, /* to_upper */
- to_upper_utf8, /* sort_order */
+ ctype_utf8mb3, /* ctype */
+ to_lower_utf8mb3, /* to_lower */
+ to_upper_utf8mb3, /* to_upper */
+ to_upper_utf8mb3, /* sort_order */
NULL, /* uca */
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
@@ -5595,22 +5597,22 @@ struct charset_info_st my_charset_utf8_general_nopad_ci=
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
- &my_charset_utf8_handler,
- &my_collation_utf8_general_nopad_ci_handler
+ &my_charset_utf8mb3_handler,
+ &my_collation_utf8mb3_general_nopad_ci_handler
};
-struct charset_info_st my_charset_utf8_nopad_bin=
+struct charset_info_st my_charset_utf8mb3_nopad_bin=
{
MY_NOPAD_ID(83),0,0,/* number */
MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_BINSORT|MY_CS_UNICODE|MY_CS_NOPAD,
- "utf8", /* cs name */
- "utf8_nopad_bin", /* name */
+ MY_UTF8MB3, /* cs name */
+ MY_UTF8MB3 "_nopad_bin", /* name */
"", /* comment */
NULL, /* tailoring */
- ctype_utf8, /* ctype */
- to_lower_utf8, /* to_lower */
- to_upper_utf8, /* to_upper */
+ ctype_utf8mb3, /* ctype */
+ to_lower_utf8mb3, /* to_lower */
+ to_upper_utf8mb3, /* to_upper */
NULL, /* sort_order */
NULL, /* uca */
NULL, /* tab_to_uni */
@@ -5628,8 +5630,8 @@ struct charset_info_st my_charset_utf8_nopad_bin=
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
- &my_charset_utf8_handler,
- &my_collation_utf8_nopad_bin_handler
+ &my_charset_utf8mb3_handler,
+ &my_collation_utf8mb3_nopad_bin_handler
};
@@ -5642,7 +5644,7 @@ struct charset_info_st my_charset_utf8_nopad_bin=
* variable to what they actually do.
*/
-static int my_strnncoll_utf8_cs(CHARSET_INFO *cs,
+static int my_strnncoll_utf8mb3_cs(CHARSET_INFO *cs,
const uchar *s, size_t slen,
const uchar *t, size_t tlen,
my_bool t_is_prefix)
@@ -5657,8 +5659,8 @@ static int my_strnncoll_utf8_cs(CHARSET_INFO *cs,
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);
+ s_res=my_utf8mb3_uni(cs,&s_wc, s, se);
+ t_res=my_utf8mb3_uni(cs,&t_wc, t, te);
if ( s_res <= 0 || t_res <= 0 )
@@ -5687,7 +5689,7 @@ static int my_strnncoll_utf8_cs(CHARSET_INFO *cs,
return t_is_prefix ? t-te : ((diff == 0) ? save_diff : diff);
}
-static int my_strnncollsp_utf8_cs(CHARSET_INFO *cs,
+static int my_strnncollsp_utf8mb3_cs(CHARSET_INFO *cs,
const uchar *s, size_t slen,
const uchar *t, size_t tlen)
{
@@ -5700,8 +5702,8 @@ static int my_strnncollsp_utf8_cs(CHARSET_INFO *cs,
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);
+ s_res=my_utf8mb3_uni(cs,&s_wc, s, se);
+ t_res=my_utf8mb3_uni(cs,&t_wc, t, te);
if ( s_res <= 0 || t_res <= 0 )
{
@@ -5750,30 +5752,30 @@ static int my_strnncollsp_utf8_cs(CHARSET_INFO *cs,
static MY_COLLATION_HANDLER my_collation_cs_handler =
{
NULL, /* init */
- my_strnncoll_utf8_cs,
- my_strnncollsp_utf8_cs,
- my_strnxfrm_utf8_general_ci,
+ my_strnncoll_utf8mb3_cs,
+ my_strnncollsp_utf8mb3_cs,
+ my_strnxfrm_utf8mb3_general_ci,
my_strnxfrmlen_unicode,
my_like_range_simple,
my_wildcmp_mb,
- my_strcasecmp_utf8,
+ my_strcasecmp_utf8mb3,
my_instr_mb,
- my_hash_sort_utf8,
+ my_hash_sort_utf8mb3,
my_propagate_simple
};
-struct charset_info_st my_charset_utf8_general_cs=
+struct charset_info_st my_charset_utf8mb3_general_cs=
{
254,0,0, /* number */
- MY_CS_COMPILED|MY_CS_UNICODE, /* state */
- "utf8", /* cs name */
- "utf8_general_cs", /* name */
+ MY_CS_COMPILED|MY_CS_UNICODE, /* state */
+ MY_UTF8MB3, /* cs name */
+ MY_UTF8MB3 "_general_cs", /* name */
"", /* comment */
NULL, /* tailoring */
- ctype_utf8, /* ctype */
- to_lower_utf8, /* to_lower */
- to_upper_utf8, /* to_upper */
- to_upper_utf8, /* sort_order */
+ ctype_utf8mb3, /* ctype */
+ to_lower_utf8mb3, /* to_lower */
+ to_upper_utf8mb3, /* to_upper */
+ to_upper_utf8mb3, /* sort_order */
NULL, /* uca */
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
@@ -5790,7 +5792,7 @@ struct charset_info_st my_charset_utf8_general_cs=
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
1, /* levels_for_order */
- &my_charset_utf8_handler,
+ &my_charset_utf8mb3_handler,
&my_collation_cs_handler
};
#endif /* Cybozu Hack */
@@ -7048,9 +7050,9 @@ my_charlen_filename(CHARSET_INFO *cs, const uchar *str, const uchar *end)
/*
#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)
+#define WEIGHT_MB1(x) my_weight_mb1_utf8mb3_general_ci(x)
+#define WEIGHT_MB2(x,y) my_weight_mb2_utf8mb3_general_ci(x,y)
+#define WEIGHT_MB3(x,y,z) my_weight_mb3_utf8mb3_general_ci(x,y,z)
*/
#include "strcoll.ic"
@@ -7063,10 +7065,10 @@ static MY_COLLATION_HANDLER my_collation_filename_handler =
my_strnxfrm_filename,
my_strnxfrmlen_unicode,
my_like_range_mb,
- my_wildcmp_utf8,
- my_strcasecmp_utf8,
+ my_wildcmp_utf8mb3,
+ my_strcasecmp_utf8mb3,
my_instr_mb,
- my_hash_sort_utf8,
+ my_hash_sort_utf8mb3,
my_propagate_complex
};
@@ -7080,10 +7082,10 @@ static MY_CHARSET_HANDLER my_charset_filename_handler=
my_mb_wc_filename,
my_wc_mb_filename,
my_mb_ctype_mb,
- my_caseup_str_utf8,
- my_casedn_str_utf8,
- my_caseup_utf8,
- my_casedn_utf8,
+ my_caseup_str_utf8mb3,
+ my_casedn_str_utf8mb3,
+ my_caseup_utf8mb3,
+ my_casedn_utf8mb3,
my_snprintf_8bit,
my_long10_to_str_8bit,
my_longlong10_to_str_8bit,
@@ -7112,10 +7114,10 @@ struct charset_info_st my_charset_filename=
"filename", /* name */
"", /* comment */
NULL, /* tailoring */
- ctype_utf8, /* ctype */
- to_lower_utf8, /* to_lower */
- to_upper_utf8, /* to_upper */
- to_upper_utf8, /* sort_order */
+ ctype_utf8mb3, /* ctype */
+ to_lower_utf8mb3, /* to_lower */
+ to_upper_utf8mb3, /* to_upper */
+ to_upper_utf8mb3, /* sort_order */
NULL, /* uca */
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
@@ -7506,12 +7508,12 @@ my_casedn_str_utf8mb4(CHARSET_INFO *cs, char *src)
the original string, for example:
"U+0130 LATIN CAPITAL LETTER I WITH DOT ABOVE"
- (which is 0xC4B0 in utf8, i.e. two bytes)
+ (which is 0xC4B0 in utf8mb3, i.e. two bytes)
is converted into
"U+0069 LATIN SMALL LETTER I"
- (which is 0x69 in utf8, i.e. one byte)
+ (which is 0x69 in utf8mb3, i.e. one byte)
So, we need to put '\0' terminator after converting.
*/
@@ -7653,9 +7655,9 @@ my_charlen_utf8mb4(CHARSET_INFO *cs __attribute__((unused)),
#define UNICASE_PAGES my_unicase_default_pages
#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)
+#define WEIGHT_MB1(b0) my_weight_mb1_utf8mb3_general_ci(b0)
+#define WEIGHT_MB2(b0,b1) my_weight_mb2_utf8mb3_general_ci(b0,b1)
+#define WEIGHT_MB3(b0,b1,b2) my_weight_mb3_utf8mb3_general_ci(b0,b1,b2)
/*
All non-BMP characters have the same weight.
*/
@@ -7676,9 +7678,9 @@ my_charlen_utf8mb4(CHARSET_INFO *cs __attribute__((unused)),
#define MY_FUNCTION_NAME(x) my_ ## x ## _utf8mb4_general_nopad_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)
+#define WEIGHT_MB1(b0) my_weight_mb1_utf8mb3_general_ci(b0)
+#define WEIGHT_MB2(b0,b1) my_weight_mb2_utf8mb3_general_ci(b0,b1)
+#define WEIGHT_MB3(b0,b1,b2) my_weight_mb3_utf8mb3_general_ci(b0,b1,b2)
/*
All non-BMP characters have the same weight.
*/
@@ -7777,7 +7779,7 @@ MY_CHARSET_HANDLER my_charset_utf8mb4_handler=
my_snprintf_8bit,
my_long10_to_str_8bit,
my_longlong10_to_str_8bit,
- my_fill_utf8,
+ my_fill_utf8mb3,
my_strntol_8bit,
my_strntoul_8bit,
my_strntoll_8bit,
diff --git a/strings/ctype.c b/strings/ctype.c
index 32c41e6e9e7..9a89c6fe41d 100644
--- a/strings/ctype.c
+++ b/strings/ctype.c
@@ -413,7 +413,7 @@ tailoring_append2(MY_XML_PARSER *st,
static size_t
scan_one_character(const char *s, const char *e, my_wc_t *wc)
{
- CHARSET_INFO *cs= &my_charset_utf8_general_ci;
+ CHARSET_INFO *cs= &my_charset_utf8mb3_general_ci;
if (s >= e)
return 0;
diff --git a/strings/json_lib.c b/strings/json_lib.c
index bb8c15ee0c1..be2aa168e35 100644
--- a/strings/json_lib.c
+++ b/strings/json_lib.c
@@ -1872,7 +1872,7 @@ static enum json_types smart_read_value(json_engine_t *je,
*value_len= (int) ((char *) je->s.c_str - *value);
}
- return je->value_type;
+ return (enum json_types)je->value_type;
err_return:
return JSV_BAD_JSON;
diff --git a/strings/strcoll.ic b/strings/strcoll.ic
index 50278135dd4..e7d614ebdf5 100644
--- a/strings/strcoll.ic
+++ b/strings/strcoll.ic
@@ -105,7 +105,7 @@ MY_FUNCTION_NAME(scan_weight)(int *weight, const uchar *str, const uchar *end)
#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
+ E.g. [0x80..0xC1] in utf8mb(3|4). This allows using simplified conditions
in IS_MB2_CHAR(), IS_MB3_CHAR(), etc.
*/
if (IS_MB1_MBHEAD_UNUSED_GAP(*str))
@@ -158,7 +158,7 @@ bad:
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
+ my_charset_utf8mb3_general_ci_no_pad and have only one comparison function
in MY_COLLATION_HANDLER.
@param cs - the character set and collation
@@ -339,7 +339,7 @@ MY_FUNCTION_NAME(strnxfrm)(CHARSET_INFO *cs,
Store sorting weights using 2 bytes per character.
This function is shared between
- - utf8mb3_general_ci, utf8_bin, ucs2_general_ci, ucs2_bin
+ - utf8mb3_general_ci, utf8mb3_bin, ucs2_general_ci, ucs2_bin
which support BMP only (U+0000..U+FFFF).
- utf8mb4_general_ci, utf16_general_ci, utf32_general_ci,
which map all supplementary characters to weight 0xFFFD.
@@ -473,7 +473,7 @@ MY_FUNCTION_NAME(strnxfrm_nopad)(CHARSET_INFO *cs,
Store sorting weights using 2 bytes per character.
These functions are shared between
- - utf8mb3_general_ci, utf8_bin, ucs2_general_ci, ucs2_bin
+ - utf8mb3_general_ci, utf8mb3_bin, ucs2_general_ci, ucs2_bin
which support BMP only (U+0000..U+FFFF).
- utf8mb4_general_ci, utf16_general_ci, utf32_general_ci,
which map all supplementary characters to weight 0xFFFD.
diff --git a/support-files/rpm/server.cnf b/support-files/rpm/server.cnf
index a9fe564939e..c401ea98812 100644
--- a/support-files/rpm/server.cnf
+++ b/support-files/rpm/server.cnf
@@ -39,8 +39,8 @@
# you can put MariaDB-only options here
[mariadb]
-# This group is only read by MariaDB-10.4 servers.
+# This group is only read by MariaDB-10.5 servers.
# If you use the same .cnf file for MariaDB of different versions,
# use this group for options that older servers don't understand
-[mariadb-10.4]
+[mariadb-10.5]
diff --git a/tests/big_record.pl b/tests/big_record.pl
index cb1f8998468..b2aeee27658 100755
--- a/tests/big_record.pl
+++ b/tests/big_record.pl
@@ -37,9 +37,9 @@ GetOptions("host=s","db=s","user=s", "password=s", "table=s", "rows=i",
print "Connection to database $test_db\n";
$extra_options="";
-$extra_options.=":mysql_compression=1" if ($opt_compress);
+$extra_options.=":mariadb_compression=1" if ($opt_compress);
-$dbh = DBI->connect("DBI:mysql:$opt_db:$host$extra_options",$opt_user,$opt_password) || die "Can't connect: $DBI::errstr\n";
+$dbh = DBI->connect("DBI:MariaDB:$opt_db:$host$extra_options",$opt_user,$opt_password) || die "Can't connect: $DBI::errstr\n";
$dbh->do("drop table if exists $opt_table");
@@ -65,7 +65,7 @@ for ($i=0 ; $i < $opt_rows ; $i++)
print "\nReading records\n";
-$sth=$dbh->prepare("select * from $opt_table", { "mysql_use_result" => 1}) or die $dbh->errstr;
+$sth=$dbh->prepare("select * from $opt_table", { "mariadb_use_result" => 1}) or die $dbh->errstr;
$sth->execute() or die $sth->errstr;
diff --git a/tests/check_async_queries.pl b/tests/check_async_queries.pl
index b599bc334d3..0039dd90eb9 100644
--- a/tests/check_async_queries.pl
+++ b/tests/check_async_queries.pl
@@ -13,7 +13,7 @@ my $D= [];
die "Usage: $0 <host> <user> <password> <database>\n"
unless @ARGV == 4;
-my $dbh= DBI->connect("DBI:mysql:database=$ARGV[3];host=$ARGV[0]",
+my $dbh= DBI->connect("DBI:MariaDB:database=$ARGV[3];host=$ARGV[0]",
$ARGV[1], $ARGV[2],
{ RaiseError => 1, PrintError => 0 });
diff --git a/tests/consistent_snapshot.pl b/tests/consistent_snapshot.pl
index 9e53eaea6a1..5c006b0092d 100755
--- a/tests/consistent_snapshot.pl
+++ b/tests/consistent_snapshot.pl
@@ -17,7 +17,7 @@ my $DURATION= 20;
my $stop_time= time() + $DURATION;
sub my_connect {
- my $dbh= DBI->connect("dbi:mysql:mysql_socket=/tmp/mysql.sock;database=test",
+ my $dbh= DBI->connect("DBI:MariaDB:mariadb_socket=/tmp/mysql.sock;database=test",
"root", undef, { RaiseError=>1, PrintError=>0, AutoCommit=>0});
$dbh->do("SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ");
$dbh->do("SET SESSION autocommit = 0");
diff --git a/tests/drop_test.pl b/tests/drop_test.pl
index 329f65eb65d..15a75f4908c 100755
--- a/tests/drop_test.pl
+++ b/tests/drop_test.pl
@@ -50,7 +50,7 @@ $firsttable = "bench_f1";
$start_time=new Benchmark;
if (!$opt_skip_create)
{
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
$dbh->do("drop table if exists $firsttable, ${firsttable}_1, ${firsttable}_2");
@@ -81,7 +81,7 @@ while (($pid=wait()) != -1)
if (!$opt_skip_delete && !$errors)
{
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
$dbh->do("drop table $firsttable");
@@ -103,7 +103,7 @@ sub test_insert
{
my ($dbh,$i);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
for ($i=0 ; $i < $opt_loop_count; $i++)
@@ -124,7 +124,7 @@ sub test_drop
my ($id) = @_;
my ($dbh,$i,$sth,$error_counter,$sleep_time);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
$error_counter=0;
@@ -169,7 +169,7 @@ sub test_select
{
my ($dbh,$i,$sth,@row,$error_counter,$sleep_time);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
@@ -206,7 +206,7 @@ sub test_flush
{
my ($dbh,$i,$sth,@row,$error_counter,$sleep_time);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
diff --git a/tests/fork_big.pl b/tests/fork_big.pl
index 623377ab5cd..2f803b7fdd3 100755
--- a/tests/fork_big.pl
+++ b/tests/fork_big.pl
@@ -65,7 +65,7 @@ srand 100; # Make random numbers repeatable
####
$start_time=new Benchmark;
-$dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+$dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
if (!$opt_skip_create)
@@ -155,7 +155,7 @@ while (($pid=wait()) != -1)
if (!$opt_skip_delete && !$errors)
{
my $table_def;
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
@@ -189,7 +189,7 @@ sub test_insert
$from_table=0; $to_table=$numtables-1;
}
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
@@ -218,7 +218,7 @@ sub test_select
{
my ($dbh, $i, $j, $count, $loop, $count_query, $row_counts);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
@@ -255,7 +255,7 @@ sub test_select_count
{
my ($dbh, $i, $j, $count, $loop);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
@@ -285,7 +285,7 @@ sub test_join
{
my ($dbh, $i, $j, $count, $loop, $count_query, $row_counts);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
@@ -326,7 +326,7 @@ sub test_delete
$table_count=2;
$count=0;
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
@@ -360,7 +360,7 @@ sub test_delete
sub test_update
{
my ($dbh, $i, $j, $row_counts, $count_query, $count, $loop);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
@@ -403,7 +403,7 @@ sub test_update
sub test_check
{
my ($dbh, $sth, $row, $i, $j, $type, $table);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
@@ -440,7 +440,7 @@ sub test_check
sub test_repair
{
my ($dbh, $sth, $row, $i, $type, $table);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
@@ -474,7 +474,7 @@ sub test_flush
{
my ($dbh,$count,$tables);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
@@ -502,7 +502,7 @@ sub test_database
{
my ($database) = @_;
my ($dbh, $sth, $row, $i, $type, $tables);
- $dbh = DBI->connect("DBI:mysql:$database:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$database:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
@@ -535,7 +535,7 @@ sub test_database
sub test_alter
{
my ($dbh, $sth, $row, $i, $type, $table);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
@@ -559,7 +559,7 @@ sub test_alter
sub signal_abort
{
my ($dbh);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
diff --git a/tests/fork_big2.pl b/tests/fork_big2.pl
index c844d290834..a2b465734dc 100644
--- a/tests/fork_big2.pl
+++ b/tests/fork_big2.pl
@@ -81,7 +81,7 @@ if ($opt_time == 0 && $opt_insert == 0)
}
$start_time=new Benchmark;
-$dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+$dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
if (!$opt_skip_create)
@@ -212,7 +212,7 @@ while (($pid=wait()) != -1)
if (!$opt_skip_drop && !$errors)
{
my $table_def;
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
@@ -257,7 +257,7 @@ sub test_insert
$from_table=0; $to_table=$numtables-1;
}
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
@@ -286,7 +286,7 @@ sub test_select
{
my ($dbh, $i, $j, $count, $loop);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
@@ -323,7 +323,7 @@ sub test_select_count
{
my ($dbh, $i, $j, $count, $loop);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
@@ -353,7 +353,7 @@ sub test_join
{
my ($dbh, $i, $j, $count, $loop);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
@@ -391,7 +391,7 @@ sub test_join_count
{
my ($dbh, $i, $j, $count, $loop);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
@@ -446,7 +446,7 @@ sub test_delete
$table_count=2;
$count=0;
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
@@ -480,7 +480,7 @@ sub test_delete
sub test_update
{
my ($dbh, $i, $j, $row_counts, $count_query, $count, $loop);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
@@ -523,7 +523,7 @@ sub test_update
sub test_check
{
my ($dbh, $row, $i, $j, $type, $table);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
@@ -560,7 +560,7 @@ sub test_check
sub test_repair
{
my ($dbh, $row, $i, $type, $table);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
@@ -594,7 +594,7 @@ sub test_flush
{
my ($dbh,$count,$tables);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
@@ -621,7 +621,7 @@ sub test_resize
{
my ($dbh, $key_buffer_size);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
@@ -648,7 +648,7 @@ sub test_database
{
my ($database) = @_;
my ($dbh, $row, $i, $type, $tables);
- $dbh = DBI->connect("DBI:mysql:$database:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$database:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
@@ -681,7 +681,7 @@ sub test_database
sub test_alter
{
my ($dbh, $row, $i, $type, $table);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
@@ -705,7 +705,7 @@ sub test_alter
sub signal_abort
{
my ($dbh);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
diff --git a/tests/grant.pl b/tests/grant.pl
index cd651643316..f8cdc1af4d5 100755
--- a/tests/grant.pl
+++ b/tests/grant.pl
@@ -60,7 +60,7 @@ unlink($tmp_table);
# clear grant tables
#
-$dbh = DBI->connect("DBI:mysql:mysql:$opt_host",
+$dbh = DBI->connect("DBI:MariaDB:mysql:$opt_host",
$opt_root_user,$opt_password,
{ PrintError => 0}) || die "Can't connect to mysql server with user '$opt_root_user': $DBI::errstr\n";
@@ -653,7 +653,7 @@ sub user_connect
print "Connecting $opt_user\n" if ($opt_verbose);
$user_dbh->disconnect if (defined($user_dbh));
- $user_dbh=DBI->connect("DBI:mysql:$opt_database:$opt_host",$opt_user,
+ $user_dbh=DBI->connect("DBI:MariaDB:$opt_database:$opt_host",$opt_user,
$password, { PrintError => 0});
if (!$user_dbh)
{
diff --git a/tests/index_corrupt.pl b/tests/index_corrupt.pl
index 6b04ce8a59c..6f31b85bd61 100755
--- a/tests/index_corrupt.pl
+++ b/tests/index_corrupt.pl
@@ -51,7 +51,7 @@ $kill_file= "/tmp/mysqltest_index_corrupt.$$";
$start_time=new Benchmark;
if (!$opt_skip_create)
{
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
$dbh->do("drop table if exists $firsttable, $secondtable");
@@ -111,7 +111,7 @@ while (($pid=wait()) != -1)
if (!$opt_skip_delete && !$errors)
{
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
$dbh->do("drop table $firsttable, $secondtable");
@@ -134,7 +134,7 @@ sub insert_in_bench
{
my ($dbh,$rows,$found,$i);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
for ($rows= 1; $rows <= $opt_loop_count ; $rows++)
@@ -179,7 +179,7 @@ sub select_from_bench
{
my ($dbh,$rows,$cursor);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
for ($rows= 1; $rows < $opt_loop_count ; $rows++)
@@ -206,7 +206,7 @@ sub delete_from_bench
{
my ($dbh,$row, $t_value, $t2_value, $statement, $cursor);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
diff --git a/tests/insert_and_repair.pl b/tests/insert_and_repair.pl
index 18091c92718..dfa490456cb 100755
--- a/tests/insert_and_repair.pl
+++ b/tests/insert_and_repair.pl
@@ -49,7 +49,7 @@ $secondtable = "bench_f2";
$start_time=new Benchmark;
if (!$opt_skip_create)
{
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
$dbh->do("drop table if exists $firsttable, $secondtable");
@@ -79,7 +79,7 @@ while (($pid=wait()) != -1)
if (!$opt_skip_delete && !$errors)
{
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
$dbh->do("drop table $firsttable,$secondtable");
@@ -100,7 +100,7 @@ sub insert_in_bench1
{
my ($dbh,$rows,$found,$i);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
$rows=$found=0;
@@ -123,7 +123,7 @@ sub insert_in_bench2
{
my ($dbh,$rows,$found,$i);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
$rows=$found=0;
@@ -149,7 +149,7 @@ sub repair_and_check
$table);
$found1=$found2=0; $last_found1=$last_found2= -1;
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
diff --git a/tests/mail_to_db.pl b/tests/mail_to_db.pl
index e50415d96f3..94f3955b2c3 100755
--- a/tests/mail_to_db.pl
+++ b/tests/mail_to_db.pl
@@ -110,12 +110,12 @@ sub main
die "FATAL: Can't find inbox file: $ARGV[$i]\n" if (! -f $ARGV[$i]);
}
- $connect_arg = "DBI:mysql:";
+ $connect_arg = "DBI:MariaDB:";
push @args, "database=$opt_db" if defined($opt_db);
push @args, "host=$opt_host" if defined($opt_host);
push @args, "port=$opt_port" if defined($opt_port);
- push @args, "mysql_socket=$opt_socket" if defined($opt_socket);
- push @args, "mysql_read_default_group=mail_to_db";
+ push @args, "mariadb_socket=$opt_socket" if defined($opt_socket);
+ push @args, "mariadb_read_default_group=mail_to_db";
$connect_arg .= join ';', @args;
$dbh = DBI->connect("$connect_arg", $opt_user, $opt_password,
{ PrintError => 0})
diff --git a/tests/pmail.pl b/tests/pmail.pl
index 359256c25b3..de469923c7d 100755
--- a/tests/pmail.pl
+++ b/tests/pmail.pl
@@ -60,7 +60,7 @@ if ($opt_help || !$ARGV[0])
#### Connect and parsing the query to MySQL
####
-$dbh= DBI->connect("DBI:mysql:$opt_db:$opt_host:port=$opt_port:mysql_socket=$opt_socket", $opt_user,$opt_password, { PrintError => 0})
+$dbh= DBI->connect("DBI:MariaDB:$opt_db:$opt_host:port=$opt_port:mariadb_socket=$opt_socket", $opt_user,$opt_password, { PrintError => 0})
|| die $DBI::errstr;
main();
diff --git a/tests/rename_test.pl b/tests/rename_test.pl
index d7097df1e4e..ff1b73434e5 100755
--- a/tests/rename_test.pl
+++ b/tests/rename_test.pl
@@ -48,7 +48,7 @@ $firsttable = "bench_f1";
$start_time=new Benchmark;
if (!$opt_skip_create)
{
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
$dbh->do("drop table if exists $firsttable, ${firsttable}_1, ${firsttable}_2");
@@ -81,7 +81,7 @@ while (($pid=wait()) != -1)
if (!$opt_skip_delete && !$errors)
{
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
$dbh->do("drop table $firsttable");
@@ -103,7 +103,7 @@ sub test_insert
{
my ($dbh,$i,$error);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
for ($i=0 ; $i < $opt_loop_count; $i++)
@@ -128,7 +128,7 @@ sub test_rename
my ($id) = @_;
my ($dbh,$i,$error_counter,$sleep_time);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
$error_counter=0;
@@ -158,7 +158,7 @@ sub test_select
{
my ($dbh,$i,$sth,@row,$sleep_time);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
@@ -192,7 +192,7 @@ sub test_flush
{
my ($dbh,$i,$sth,@row,$error_counter,$sleep_time);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
diff --git a/tests/test_delayed_insert.pl b/tests/test_delayed_insert.pl
index cb5b86a228d..2ebb42e08d1 100755
--- a/tests/test_delayed_insert.pl
+++ b/tests/test_delayed_insert.pl
@@ -50,7 +50,7 @@ $secondtable = "bench_f2";
$start_time=new Benchmark;
if (!$opt_skip_create)
{
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host") || die $DBI::errstr;
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host") || die $DBI::errstr;
$Mysql::QUIET = 1;
$dbh->do("drop table if exists $firsttable,$secondtable");
$Mysql::QUIET = 0;
@@ -87,7 +87,7 @@ while (($pid=wait()) != -1)
if (!$opt_skip_delete && !$errors)
{
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host") || die $DBI::errstr;
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host") || die $DBI::errstr;
$dbh->do("drop table $firsttable");
$dbh->do("drop table $secondtable");
}
@@ -107,7 +107,7 @@ sub test_1
{
my ($dbh,$tmpvar,$rows,$found,$i);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host") || die $DBI::errstr;
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host") || die $DBI::errstr;
$tmpvar=1;
$rows=$found=0;
for ($i=0 ; $i < $opt_loop_count; $i++)
@@ -131,7 +131,7 @@ sub test_delayed_1
{
my ($dbh,$tmpvar,$rows,$found,$i,$id);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host") || die $DBI::errstr;
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host") || die $DBI::errstr;
$tmpvar=1;
$rows=$found=0;
for ($i=0 ; $i < $opt_loop_count; $i++)
@@ -162,7 +162,7 @@ sub test_delayed_2
{
my ($dbh,$tmpvar,$rows,$found,$i,$id);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host") || die $DBI::errstr;
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host") || die $DBI::errstr;
$tmpvar=1;
$rows=$found=0;
for ($i=0 ; $i < $opt_loop_count; $i++)
@@ -196,7 +196,7 @@ sub test_2
{
my ($dbh,$id,$tmpvar,$rows,$found,$i,$max_id,$tmp,$sth,$count);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host") || die $DBI::errstr;
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host") || die $DBI::errstr;
$tmpvar=111111;
$rows=$found=$max_id=$id=0;
for ($i=0 ; $i < $opt_loop_count ; $i++)
@@ -245,7 +245,7 @@ sub test_2
sub test_3
{
my ($dbh,$id,$tmpvar,$rows,$i,$count);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host") || die $DBI::errstr;
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host") || die $DBI::errstr;
$tmpvar=222222;
$rows=0;
for ($i=0 ; $i < $opt_loop_count ; $i++)
@@ -269,7 +269,7 @@ sub test_3
sub test_4
{
my ($dbh,$id,$tmpvar,$rows,$i,$count);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host") || die $DBI::errstr;
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host") || die $DBI::errstr;
$tmpvar=333333;
$rows=0;
for ($i=0 ; $i < $opt_loop_count; $i++)
@@ -288,7 +288,7 @@ sub test_4
sub test_5
{
my ($dbh,$id,$tmpvar,$rows,$i,$max_id,$count,$sth);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host") || die $DBI::errstr;
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host") || die $DBI::errstr;
$tmpvar=444444;
$rows=$max_id=0;
for ($i=0 ; $i < $opt_loop_count ; $i++)
@@ -328,7 +328,7 @@ sub test_5
sub test_del
{
my ($dbh,$min_id,$i,$sth,$rows);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host") || die $DBI::errstr;
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host") || die $DBI::errstr;
$rows=0;
for ($i=0 ; $i < $opt_loop_count/3; $i++)
{
@@ -357,7 +357,7 @@ sub test_flush
my ($dbh,$sth,$found1,$last_found1,$i,@row);
$found1=0; $last_found1=-1;
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
diff --git a/tests/truncate.pl b/tests/truncate.pl
index 98791a15b2c..85a7888bc4a 100755
--- a/tests/truncate.pl
+++ b/tests/truncate.pl
@@ -47,7 +47,7 @@ print "Testing truncate from $opt_threads multiple connections $opt_loop_count t
####
$start_time=new Benchmark;
-$dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+$dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
if (!$opt_skip_create)
@@ -100,7 +100,7 @@ while (($pid=wait()) != -1)
if (!$opt_skip_delete && !$errors)
{
my $table_def;
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
@@ -127,7 +127,7 @@ sub test_truncate
{
my ($dbh,$i,$j,$count,$table_def,$table);
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $dbh = DBI->connect("DBI:MariaDB:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
diff --git a/unittest/json_lib/json_lib-t.c b/unittest/json_lib/json_lib-t.c
index 11f02b204f8..378ebe201f5 100644
--- a/unittest/json_lib/json_lib-t.c
+++ b/unittest/json_lib/json_lib-t.c
@@ -173,7 +173,7 @@ test_search()
int main()
{
- ci= &my_charset_utf8_general_ci;
+ ci= &my_charset_utf8mb3_general_ci;
plan(6);
diag("Testing json_lib functions.");
diff --git a/unittest/mysys/ma_dyncol-t.c b/unittest/mysys/ma_dyncol-t.c
index 124f16e15be..d76f1b49f8f 100644
--- a/unittest/mysys/ma_dyncol-t.c
+++ b/unittest/mysys/ma_dyncol-t.c
@@ -197,12 +197,12 @@ static CHARSET_INFO *charset_list[]=
&my_charset_ujis_japanese_ci,
&my_charset_ujis_bin,
#endif
-#ifdef HAVE_CHARSET_utf8
- &my_charset_utf8_general_ci,
+#ifdef HAVE_CHARSET_utf8mb3
+ &my_charset_utf8mb3_general_ci,
#ifdef HAVE_UCA_COLLATIONS
- &my_charset_utf8_unicode_ci,
+ &my_charset_utf8mb3_unicode_ci,
#endif
- &my_charset_utf8_bin,
+ &my_charset_utf8mb3_bin,
#endif
};
diff --git a/unittest/sql/CMakeLists.txt b/unittest/sql/CMakeLists.txt
index a4ba1019e49..987e78433a4 100644
--- a/unittest/sql/CMakeLists.txt
+++ b/unittest/sql/CMakeLists.txt
@@ -21,10 +21,12 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/sql
${CMAKE_SOURCE_DIR}/extra/yassl/include)
IF(WIN32)
- ADD_EXECUTABLE(explain_filename-t explain_filename-t.cc
- ../../sql/nt_servc.cc)
+ ADD_EXECUTABLE(explain_filename-t
+ explain_filename-t.cc
+ dummy_builtins.cc
+ ../../sql/nt_servc.cc)
ELSE()
- ADD_EXECUTABLE(explain_filename-t explain_filename-t.cc)
+ ADD_EXECUTABLE(explain_filename-t explain_filename-t.cc dummy_builtins.cc)
ENDIF()
TARGET_LINK_LIBRARIES(explain_filename-t sql mytap)
diff --git a/unittest/sql/dummy_builtins.cc b/unittest/sql/dummy_builtins.cc
new file mode 100644
index 00000000000..31d043d19ec
--- /dev/null
+++ b/unittest/sql/dummy_builtins.cc
@@ -0,0 +1,26 @@
+/* 2018 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
+
+#include <my_global.h>
+#include <mysql/plugin.h>
+struct st_maria_plugin *mysql_optional_plugins[]=
+{
+ 0
+};
+
+struct st_maria_plugin *mysql_mandatory_plugins[]=
+{
+ 0
+};
diff --git a/unittest/sql/explain_filename-t.cc b/unittest/sql/explain_filename-t.cc
index 859cb0cdaa4..32291d5e621 100644
--- a/unittest/sql/explain_filename-t.cc
+++ b/unittest/sql/explain_filename-t.cc
@@ -31,7 +31,7 @@ static const char **error_messages[1]= { error_messages_txt };
int setup()
{
- system_charset_info = &my_charset_utf8_bin;
+ system_charset_info = &my_charset_utf8mb3_bin;
my_default_lc_messages = &my_locale_en_US;
/* Populate the necessary error messages */
diff --git a/unittest/strings/strings-t.c b/unittest/strings/strings-t.c
index 00d49971595..fb526477234 100644
--- a/unittest/strings/strings-t.c
+++ b/unittest/strings/strings-t.c
@@ -85,12 +85,12 @@ static CHARSET_INFO *charset_list[]=
&my_charset_ujis_japanese_ci,
&my_charset_ujis_bin,
#endif
-#ifdef HAVE_CHARSET_utf8
- &my_charset_utf8_general_ci,
+#ifdef HAVE_CHARSET_utf8mb3
+ &my_charset_utf8mb3_general_ci,
#ifdef HAVE_UCA_COLLATIONS
- &my_charset_utf8_unicode_ci,
+ &my_charset_utf8mb3_unicode_ci,
#endif
- &my_charset_utf8_bin,
+ &my_charset_utf8mb3_bin,
#endif
};
@@ -743,9 +743,9 @@ test_strcollsp()
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);
+ failed+= strcollsp(&my_charset_utf8mb3_general_ci, strcoll_utf8mb3_common);
+ failed+= strcollsp(&my_charset_utf8mb3_general_mysql500_ci, strcoll_utf8mb3_common);
+ failed+= strcollsp(&my_charset_utf8mb3_bin, strcoll_utf8mb3_common);
#endif
#ifdef HAVE_CHARSET_utf8mb4
failed+= strcollsp(&my_charset_utf8mb4_general_ci, strcoll_utf8mb3_common);
diff --git a/vio/viosslfactories.c b/vio/viosslfactories.c
index 4a31ebd1798..edd40c2d60c 100644
--- a/vio/viosslfactories.c
+++ b/vio/viosslfactories.c
@@ -436,7 +436,9 @@ new_VioSSLAcceptorFd(const char *key_file, const char *cert_file,
void free_vio_ssl_acceptor_fd(struct st_VioSSLFd *fd)
{
+ DBUG_ENTER("free_vio_ssl_acceptor_fd");
SSL_CTX_free(fd->ssl_context);
my_free(fd);
+ DBUG_VOID_RETURN;
}
#endif /* HAVE_OPENSSL */
diff --git a/win/packaging/CMakeLists.txt b/win/packaging/CMakeLists.txt
index 9e06638a991..835980710cc 100644
--- a/win/packaging/CMakeLists.txt
+++ b/win/packaging/CMakeLists.txt
@@ -178,39 +178,6 @@ IF(CMAKE_GENERATOR MATCHES "Visual Studio")
SET(CONFIG_PARAM "-DCMAKE_INSTALL_CONFIG_NAME=${CMAKE_CFG_INTDIR}")
ENDIF()
-IF(MSVC_CRT_TYPE MATCHES "/MD")
- # Find out CRT merge module path, we're going to use it in installer
- # The path and name depends on VS version
- IF(MSVC_VERSION LESS 1900)
- # VS2015
- SET(VCREDIST_MSM_FILENAME Microsoft_VC140_CRT_${WIX_ARCH_SUFFIX}.msm)
- SET(ProgramFilesX86 "ProgramFiles(x86)")
- FIND_FILE(${VCREDIST_MSM_FILENAME}
- NO_DEFAULT_PATH
- PATHS
- "$ENV{${ProgramFilesX86}}/Common Files/Merge Modules"
- "$ENV{ProgramFiles}/Common Files/Merge Modules"
- )
- ELSEIF(MSVC_VERSION LESS 2000)
- # VS2017
- SET(VCREDIST_MSM_FILENAME Microsoft_VC141_CRT_${WIX_ARCH_SUFFIX}.msm)
- FILE(GLOB MSM_LIST "C:/Program Files*/Microsoft Visual Studio/2017/*/VC/Redist/MSVC/*/MergeModules/${VCREDIST_MSM_FILENAME}")
- LIST(LENGTH MSM_LIST LEN)
- IF(LEN GREATER 0)
- LIST(GET MSM_LIST 0 VCRedist_MSM)
- ENDIF()
- ELSE()
- # Post-VS2017. Needs to be ported when new VS is out
- MESSAGE(WARNING
- "Name of redistributable merge module not known for this version of MSVC")
- ENDIF()
- IF (NOT VCRedist_MSM)
- MESSAGE(WARNING "Can't find merge module ${VCREDIST_MSM_FILENAME}")
- ELSE()
- FILE(TO_NATIVE_PATH ${VCRedist_MSM} VCRedist_MSM)
- # MESSAGE("VCRedist_MSM=${VCRedist_MSM}")
- ENDIF()
-ENDIF()
ADD_CUSTOM_TARGET(
MSI
@@ -243,7 +210,7 @@ ADD_CUSTOM_TARGET(
-DWITH_THIRD_PARTY="${WITH_THIRD_PARTY}"
-DWIXCA_LOCATION="$<TARGET_FILE:wixca>"
-DMSVC_CRT_TYPE="${MSVC_CRT_TYPE}"
- -DVCRedist_MSM="${VCRedist_MSM}"
+ -DDYNAMIC_UCRT_LINK="${DYNAMIC_UCRT_LINK}"
-P ${CMAKE_CURRENT_SOURCE_DIR}/create_msi.cmake
)
ADD_DEPENDENCIES(MSI wixca)
diff --git a/win/packaging/create_msi.cmake b/win/packaging/create_msi.cmake
index ad935803a1e..7cb932390b5 100644
--- a/win/packaging/create_msi.cmake
+++ b/win/packaging/create_msi.cmake
@@ -59,12 +59,6 @@ IF(CMAKE_INSTALL_CONFIG_NAME)
SET(CONFIG_PARAM "-DCMAKE_INSTALL_CONFIG_NAME=${CMAKE_INSTALL_CONFIG_NAME}")
ENDIF()
-IF((MSVC_CRT_TYPE MATCHES "/MD") AND (NOT VCRedist_MSM))
- # Something was wrong, we package VC runtime merge modules
- # when compiled with dynamic C runtime.
- MESSAGE(FATAL_ERROR "Redistributable merge module was not found")
-ENDIF()
-
SET(COMPONENTS_ALL "${CPACK_COMPONENTS_ALL}")
FOREACH(comp ${COMPONENTS_ALL})
SET(ENV{DESTDIR} testinstall/${comp})
diff --git a/win/packaging/extra.wxs.in b/win/packaging/extra.wxs.in
index 1955799f6f9..907a2eac692 100644
--- a/win/packaging/extra.wxs.in
+++ b/win/packaging/extra.wxs.in
@@ -52,10 +52,6 @@
<!-- Disable advertised shortcuts weirdness -->
<Property Id="DISABLEADVTSHORTCUTS" Secure="yes" Value="1"/>
- <!-- Activate feedback plugin-->
- <Property Id="FEEDBACK" Secure="yes"/>
-
-
<!-- Quick configuration : set default storage engine to innodb, use strict sql_mode -->
<Property Id="STDCONFIG" Secure="yes" Value="1"/>
@@ -171,43 +167,6 @@
</Control>
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
</Dialog>
-
- <!-- Feedback dialog -->
- <Dialog Id="Feedback" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
-
- <Control Id="CheckBoxFeedback" Type="CheckBox" X="8" Y="61" Width="360" Height="12" Property="FEEDBACK" CheckBoxValue="1" TabSkip="no">
- <Text>{\Font1}Enable the Feedback plugin and submit anonymous usage information</Text>
- </Control>
-
- <Control Id="Text" Type="Text" X="23" Y="82" Width="290" Height="55">
- <Text>Monty Program has created a Feedback plugin for MariaDB which, if enabled, collects basic anonymous statistical information. This information is used by the developers to improve MariaDB. Enabling this plugin is an easy way to help with MariaDB development. Collected statistics, and more information on the plugin, can be viewed at http://mariadb.org/feedback_plugin </Text>
- </Control>
-
- <Control Id="MoreInfo" Type="PushButton" X="23" Y="140" Width="56" Height="17" Text="More Info" ToolTip="http://mariadb.org/feedback_plugin" >
- <Publish Property="WixShellExecTarget" Value="http://mariadb.org/feedback_plugin" Order="1">1</Publish>
- <Publish Event="DoAction" Value="LaunchUrl" Order="2">1</Publish>
- </Control>
-
-
- <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&amp;Back">
- <Publish Event="NewDialog" Value="ServicePortDlg">1</Publish>
- </Control>
- <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Text="&amp;Next">
- <Publish Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
- </Control>
- <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
- <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
- </Control>
- <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
- <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
- <Text>Submit usage information</Text>
- </Control>
- <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
- <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
- <Text>{\WixUI_Font_Title}[ProductName] setup</Text>
- </Control>
- <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
- </Dialog>
<!-- Error popup dialog -->
<Dialog Id="WarningDlg" Width="320" Height="85" Title="[ProductName] Setup" NoMinimize="yes">
@@ -358,7 +317,7 @@
</Publish>
<Publish Event="DoAction" Value="CheckDatabaseProperties">NOT WarningText</Publish>
<Publish Event="SpawnDialog" Value="WarningDlg">WarningText</Publish>
- <Publish Event="NewDialog" Value="Feedback">Not WarningText</Publish>
+ <Publish Event="NewDialog" Value="VerifyReadyDlg">Not WarningText</Publish>
</Control>
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="no" Text="Cancel">
<Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
@@ -388,7 +347,7 @@
NOT Installed AND UpgradableServiceFound
</Publish>
- <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="Feedback" Order="3" ><![CDATA[&DBInstance=3 AND NOT !DBInstance=3]]></Publish>
+ <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="ServicePortDlg" Order="3" ><![CDATA[&DBInstance=3 AND NOT !DBInstance=3]]></Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="3"> <![CDATA[OLDERVERSIONBEINGUPGRADED <>""]]></Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="ConfirmDataCleanupDlg" Order="1" ><![CDATA[(&DBInstance=2) AND (!DBInstance=3)]]></Publish>
@@ -490,19 +449,6 @@
Key="innodb_buffer_pool_size"
Value="[BUFFERPOOLSIZE]M" />
</Component>
- <Component Id="C.feedback" Guid="*" Directory="DATADIR">
- <Condition>FEEDBACK</Condition>
- <RegistryValue Root='HKLM'
- Key='SOFTWARE\@CPACK_WIX_PACKAGE_NAME@'
- Name='FEEDBACK' Value='1' Type='string' KeyPath='yes'/>
- <IniFile Id="Ini5"
- Action="createLine"
- Directory="DATADIR"
- Section="mysqld"
- Name="my.ini"
- Key="feedback"
- Value="ON" />
- </Component>
<Component Id="C.utf8" Guid="*" Directory="DATADIR">
<Condition>UTF8</Condition>
@@ -651,16 +597,6 @@
<?endif ?>
- <?if "@VCRedist_MSM@" != "" ?>
- <!-- VC runtime merge module -->
- <DirectoryRef Id="TARGETDIR">
- <Merge Id="VCRedist" SourceFile="@VCRedist_MSM@" DiskId="1" Language="0"/>
- </DirectoryRef>
- <Feature Id="VCRedist" Title="Visual C++ Runtime" AllowAdvertise="no" Display="hidden" Level="1">
- <MergeRef Id="VCRedist"/>
- </Feature>
- <?endif?>
-
<!-- Custom action, call mysql_install_db -->
<SetProperty Sequence='execute' Before='CreateDatabaseCommand' Id="SKIPNETWORKING" Value="--skip-networking" >SKIPNETWORKING</SetProperty>
<SetProperty Sequence='execute' Before='CreateDatabaseCommand' Id="ALLOWREMOTEROOTACCESS" Value="--allow-remote-root-access">ALLOWREMOTEROOTACCESS</SetProperty>
@@ -870,23 +806,12 @@
</Component>
</Feature>
- <!-- Extra condition to block the installer if NSIS based installation is detected-->
- <Property Id="NSISINSTALLKEY">
- <RegistrySearch Id='NSISKey' Type='raw'
- Root='HKLM' Key='Software\Microsoft\Windows\CurrentVersion\Uninstall\MariaDB' Name='DisplayName' />
- </Property>
- <Condition
- Message=
- 'Previous version of MariaDB was found, that used incompatible installer.&#xD;&#xA;Please remove &quot;[NSISINSTALLKEY]&quot; before you proceed with this installation.'
- >
- <![CDATA[ NOT(NSISINSTALLKEY << "MariaDB @MAJOR_VERSION@.@MINOR_VERSION@.") OR Installed]]>
- </Condition>
<Condition Message=
'Setting the ALLUSERS property is not allowed because [ProductName] is a per-machine application. Setup will now exit.'>
<![CDATA[ALLUSERS = "1"]]>
</Condition>
- <Condition Message='This application is only supported on Windows Vista, Windows Server 2008, or higher.'>
- <![CDATA[Installed OR (VersionNT >= 600)]]>
+ <Condition Message='This application is only supported on Windows 10, Windows Server 2016, or higher.'>
+ <![CDATA[Installed OR (VersionNT >= 603)]]>
</Condition>
</Fragment>
</Wix>